children such as `TableCell`.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object.isRequired,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\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\n /* @typescript-to-proptypes-ignore */\n .elementType,\n\n /**\n * If `true`, the table row will shade on hover.\n */\n hover: PropTypes.bool,\n\n /**\n * If `true`, the table row will have the selected shading.\n */\n selected: PropTypes.bool\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiTableRow'\n})(TableRow);","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nimport ButtonBase from '../ButtonBase';\nimport capitalize from '../utils/capitalize';\nimport unsupportedProp from '../utils/unsupportedProp';\nexport var styles = function styles(theme) {\n var _extends2;\n\n return {\n /* Styles applied to the root element. */\n root: _extends({}, theme.typography.button, (_extends2 = {\n maxWidth: 264,\n minWidth: 72,\n position: 'relative',\n boxSizing: 'border-box',\n minHeight: 48,\n flexShrink: 0,\n padding: '6px 12px'\n }, _defineProperty(_extends2, theme.breakpoints.up('sm'), {\n padding: '6px 24px'\n }), _defineProperty(_extends2, \"overflow\", 'hidden'), _defineProperty(_extends2, \"whiteSpace\", 'normal'), _defineProperty(_extends2, \"textAlign\", 'center'), _defineProperty(_extends2, theme.breakpoints.up('sm'), {\n minWidth: 160\n }), _extends2)),\n\n /* Styles applied to the root element if both `icon` and `label` are provided. */\n labelIcon: {\n minHeight: 72,\n paddingTop: 9,\n '& $wrapper > *:first-child': {\n marginBottom: 6\n }\n },\n\n /* Styles applied to the root element if the parent [`Tabs`](/api/tabs/) has `textColor=\"inherit\"`. */\n textColorInherit: {\n color: 'inherit',\n opacity: 0.7,\n '&$selected': {\n opacity: 1\n },\n '&$disabled': {\n opacity: 0.5\n }\n },\n\n /* Styles applied to the root element if the parent [`Tabs`](/api/tabs/) has `textColor=\"primary\"`. */\n textColorPrimary: {\n color: theme.palette.text.secondary,\n '&$selected': {\n color: theme.palette.primary.main\n },\n '&$disabled': {\n color: theme.palette.text.disabled\n }\n },\n\n /* Styles applied to the root element if the parent [`Tabs`](/api/tabs/) has `textColor=\"secondary\"`. */\n textColorSecondary: {\n color: theme.palette.text.secondary,\n '&$selected': {\n color: theme.palette.secondary.main\n },\n '&$disabled': {\n color: theme.palette.text.disabled\n }\n },\n\n /* Pseudo-class applied to the root element if `selected={true}` (controlled by the Tabs component). */\n selected: {},\n\n /* Pseudo-class applied to the root element if `disabled={true}` (controlled by the Tabs component). */\n disabled: {},\n\n /* Styles applied to the root element if `fullWidth={true}` (controlled by the Tabs component). */\n fullWidth: {\n flexShrink: 1,\n flexGrow: 1,\n flexBasis: 0,\n maxWidth: 'none'\n },\n\n /* Styles applied to the root element if `wrapped={true}`. */\n wrapped: {\n fontSize: theme.typography.pxToRem(12),\n lineHeight: 1.5\n },\n\n /* Styles applied to the `icon` and `label`'s wrapper element. */\n wrapper: {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n flexDirection: 'column'\n }\n };\n};\nvar Tab = /*#__PURE__*/React.forwardRef(function Tab(props, ref) {\n var classes = props.classes,\n className = props.className,\n _props$disabled = props.disabled,\n disabled = _props$disabled === void 0 ? false : _props$disabled,\n _props$disableFocusRi = props.disableFocusRipple,\n disableFocusRipple = _props$disableFocusRi === void 0 ? false : _props$disableFocusRi,\n fullWidth = props.fullWidth,\n icon = props.icon,\n indicator = props.indicator,\n label = props.label,\n onChange = props.onChange,\n onClick = props.onClick,\n onFocus = props.onFocus,\n selected = props.selected,\n selectionFollowsFocus = props.selectionFollowsFocus,\n _props$textColor = props.textColor,\n textColor = _props$textColor === void 0 ? 'inherit' : _props$textColor,\n value = props.value,\n _props$wrapped = props.wrapped,\n wrapped = _props$wrapped === void 0 ? false : _props$wrapped,\n other = _objectWithoutProperties(props, [\"classes\", \"className\", \"disabled\", \"disableFocusRipple\", \"fullWidth\", \"icon\", \"indicator\", \"label\", \"onChange\", \"onClick\", \"onFocus\", \"selected\", \"selectionFollowsFocus\", \"textColor\", \"value\", \"wrapped\"]);\n\n var handleClick = function handleClick(event) {\n if (onChange) {\n onChange(event, value);\n }\n\n if (onClick) {\n onClick(event);\n }\n };\n\n var handleFocus = function handleFocus(event) {\n if (selectionFollowsFocus && !selected && onChange) {\n onChange(event, value);\n }\n\n if (onFocus) {\n onFocus(event);\n }\n };\n\n return /*#__PURE__*/React.createElement(ButtonBase, _extends({\n focusRipple: !disableFocusRipple,\n className: clsx(classes.root, classes[\"textColor\".concat(capitalize(textColor))], className, disabled && classes.disabled, selected && classes.selected, label && icon && classes.labelIcon, fullWidth && classes.fullWidth, wrapped && classes.wrapped),\n ref: ref,\n role: \"tab\",\n \"aria-selected\": selected,\n disabled: disabled,\n onClick: handleClick,\n onFocus: handleFocus,\n tabIndex: selected ? 0 : -1\n }, other), /*#__PURE__*/React.createElement(\"span\", {\n className: classes.wrapper\n }, icon, label), indicator);\n});\nprocess.env.NODE_ENV !== \"production\" ? Tab.propTypes = {\n /**\n * This prop isn't supported.\n * Use the `component` prop if you need to change the children structure.\n */\n children: unsupportedProp,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object.isRequired,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * If `true`, the tab will be disabled.\n */\n disabled: PropTypes.bool,\n\n /**\n * If `true`, the keyboard focus ripple will be disabled.\n */\n disableFocusRipple: PropTypes.bool,\n\n /**\n * If `true`, the ripple effect will be disabled.\n */\n disableRipple: PropTypes.bool,\n\n /**\n * @ignore\n */\n fullWidth: PropTypes.bool,\n\n /**\n * The icon element.\n */\n icon: PropTypes.node,\n\n /**\n * @ignore\n * For server-side rendering consideration, we let the selected tab\n * render the indicator.\n */\n indicator: PropTypes.node,\n\n /**\n * The label element.\n */\n label: PropTypes.node,\n\n /**\n * @ignore\n */\n onChange: PropTypes.func,\n\n /**\n * @ignore\n */\n onClick: PropTypes.func,\n\n /**\n * @ignore\n */\n onFocus: PropTypes.func,\n\n /**\n * @ignore\n */\n selected: PropTypes.bool,\n\n /**\n * @ignore\n */\n selectionFollowsFocus: PropTypes.bool,\n\n /**\n * @ignore\n */\n textColor: PropTypes.oneOf(['secondary', 'primary', 'inherit']),\n\n /**\n * You can provide your own value. Otherwise, we fallback to the child position index.\n */\n value: PropTypes.any,\n\n /**\n * Tab labels appear in a single row.\n * They can use a second line if needed.\n */\n wrapped: PropTypes.bool\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiTab'\n})(Tab);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { withStyles } from '@material-ui/core/styles';\nimport { getPanelId, getTabId, useTabContext } from '../TabContext';\nexport var styles = function styles(theme) {\n return {\n /* Styles applied to the root element. */\n root: {\n padding: theme.spacing(3)\n }\n };\n};\nvar TabPanel = /*#__PURE__*/React.forwardRef(function TabPanel(props, ref) {\n var children = props.children,\n className = props.className,\n classes = props.classes,\n value = props.value,\n other = _objectWithoutProperties(props, [\"children\", \"className\", \"classes\", \"value\"]);\n\n var context = useTabContext();\n\n if (context === null) {\n throw new TypeError('No TabContext provided');\n }\n\n var id = getPanelId(context, value);\n var tabId = getTabId(context, value);\n return /*#__PURE__*/React.createElement(\"div\", _extends({\n \"aria-labelledby\": tabId,\n className: clsx(classes.root, className),\n hidden: value !== context.value,\n id: id,\n ref: ref,\n role: \"tabpanel\"\n }, other), value === context.value && children);\n});\nprocess.env.NODE_ENV !== \"production\" ? TabPanel.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\r\n * The content of the component.\r\n */\n children: PropTypes.node,\n\n /**\r\n * Override or extend the styles applied to the component.\r\n * See [CSS API](#css) below for more details.\r\n */\n classes: PropTypes.object,\n\n /**\r\n * @ignore\r\n */\n className: PropTypes.string,\n\n /**\r\n * The `value` of the corresponding `Tab`. Must use the index of the `Tab` when\r\n * no `value` was passed to `Tab`.\r\n */\n value: PropTypes.string.isRequired\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiTabPanel'\n})(TabPanel);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nexport var styles = {\n /* Styles applied to the root element. */\n root: {\n width: '100%',\n overflowX: 'auto'\n }\n};\nvar TableContainer = /*#__PURE__*/React.forwardRef(function TableContainer(props, ref) {\n var classes = props.classes,\n className = props.className,\n _props$component = props.component,\n Component = _props$component === void 0 ? 'div' : _props$component,\n other = _objectWithoutProperties(props, [\"classes\", \"className\", \"component\"]);\n\n return /*#__PURE__*/React.createElement(Component, _extends({\n ref: ref,\n className: clsx(classes.root, className)\n }, other));\n});\nprocess.env.NODE_ENV !== \"production\" ? TableContainer.propTypes = {\n /**\n * The table itself, normally ``\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object.isRequired,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\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\n /* @typescript-to-proptypes-ignore */\n .elementType\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiTableContainer'\n})(TableContainer);","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { chainPropTypes } from '@material-ui/utils';\nimport withStyles from '../styles/withStyles';\nimport TableContext from './TableContext';\nexport var styles = function styles(theme) {\n return {\n /* Styles applied to the root element. */\n root: {\n display: 'table',\n width: '100%',\n borderCollapse: 'collapse',\n borderSpacing: 0,\n '& caption': _extends({}, theme.typography.body2, {\n padding: theme.spacing(2),\n color: theme.palette.text.secondary,\n textAlign: 'left',\n captionSide: 'bottom'\n })\n },\n\n /* Styles applied to the root element if `stickyHeader={true}`. */\n stickyHeader: {\n borderCollapse: 'separate'\n }\n };\n};\nvar defaultComponent = 'table';\nvar Table = /*#__PURE__*/React.forwardRef(function Table(props, ref) {\n var classes = props.classes,\n className = props.className,\n _props$component = props.component,\n Component = _props$component === void 0 ? defaultComponent : _props$component,\n _props$padding = props.padding,\n padding = _props$padding === void 0 ? 'normal' : _props$padding,\n _props$size = props.size,\n size = _props$size === void 0 ? 'medium' : _props$size,\n _props$stickyHeader = props.stickyHeader,\n stickyHeader = _props$stickyHeader === void 0 ? false : _props$stickyHeader,\n other = _objectWithoutProperties(props, [\"classes\", \"className\", \"component\", \"padding\", \"size\", \"stickyHeader\"]);\n\n var table = React.useMemo(function () {\n return {\n padding: padding,\n size: size,\n stickyHeader: stickyHeader\n };\n }, [padding, size, stickyHeader]);\n return /*#__PURE__*/React.createElement(TableContext.Provider, {\n value: table\n }, /*#__PURE__*/React.createElement(Component, _extends({\n role: Component === defaultComponent ? null : 'table',\n ref: ref,\n className: clsx(classes.root, className, stickyHeader && classes.stickyHeader)\n }, other)));\n});\nprocess.env.NODE_ENV !== \"production\" ? Table.propTypes = {\n /**\n * The content of the table, normally `TableHead` and `TableBody`.\n */\n children: PropTypes.node.isRequired,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object.isRequired,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\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\n /* @typescript-to-proptypes-ignore */\n .elementType,\n\n /**\n * Allows TableCells to inherit padding of the Table.\n * `default` is deprecated, use `normal` instead.\n */\n padding: chainPropTypes(PropTypes.oneOf(['normal', 'checkbox', 'none', 'default']), function (props) {\n if (props.padding === 'default') {\n return new Error('Material-UI: padding=\"default\" was renamed to padding=\"normal\" for consistency.');\n }\n\n return null;\n }),\n\n /**\n * Allows TableCells to inherit size of the Table.\n */\n size: PropTypes.oneOf(['small', 'medium']),\n\n /**\n * Set the header sticky.\n *\n * ⚠️ It doesn't work with IE 11.\n */\n stickyHeader: PropTypes.bool\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiTable'\n})(Table);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nimport Tablelvl2Context from '../Table/Tablelvl2Context';\nexport var styles = {\n /* Styles applied to the root element. */\n root: {\n display: 'table-header-group'\n }\n};\nvar tablelvl2 = {\n variant: 'head'\n};\nvar defaultComponent = 'thead';\nvar TableHead = /*#__PURE__*/React.forwardRef(function TableHead(props, ref) {\n var classes = props.classes,\n className = props.className,\n _props$component = props.component,\n Component = _props$component === void 0 ? defaultComponent : _props$component,\n other = _objectWithoutProperties(props, [\"classes\", \"className\", \"component\"]);\n\n return /*#__PURE__*/React.createElement(Tablelvl2Context.Provider, {\n value: tablelvl2\n }, /*#__PURE__*/React.createElement(Component, _extends({\n className: clsx(classes.root, className),\n ref: ref,\n role: Component === defaultComponent ? null : 'rowgroup'\n }, other)));\n});\nprocess.env.NODE_ENV !== \"production\" ? TableHead.propTypes = {\n /**\n * The content of the component, normally `TableRow`.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object.isRequired,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\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\n /* @typescript-to-proptypes-ignore */\n .elementType\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiTableHead'\n})(TableHead);","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { chainPropTypes } from '@material-ui/utils';\nimport withStyles from '../styles/withStyles';\nimport capitalize from '../utils/capitalize';\nimport { darken, alpha, lighten } from '../styles/colorManipulator';\nimport TableContext from '../Table/TableContext';\nimport Tablelvl2Context from '../Table/Tablelvl2Context';\nexport var styles = function styles(theme) {\n return {\n /* Styles applied to the root element. */\n root: _extends({}, theme.typography.body2, {\n display: 'table-cell',\n verticalAlign: 'inherit',\n // Workaround for a rendering bug with spanned columns in Chrome 62.0.\n // Removes the alpha (sets it to 1), and lightens or darkens the theme color.\n borderBottom: \"1px solid\\n \".concat(theme.palette.type === 'light' ? lighten(alpha(theme.palette.divider, 1), 0.88) : darken(alpha(theme.palette.divider, 1), 0.68)),\n textAlign: 'left',\n padding: 16\n }),\n\n /* Styles applied to the root element if `variant=\"head\"` or `context.table.head`. */\n head: {\n color: theme.palette.text.primary,\n lineHeight: theme.typography.pxToRem(24),\n fontWeight: theme.typography.fontWeightMedium\n },\n\n /* Styles applied to the root element if `variant=\"body\"` or `context.table.body`. */\n body: {\n color: theme.palette.text.primary\n },\n\n /* Styles applied to the root element if `variant=\"footer\"` or `context.table.footer`. */\n footer: {\n color: theme.palette.text.secondary,\n lineHeight: theme.typography.pxToRem(21),\n fontSize: theme.typography.pxToRem(12)\n },\n\n /* Styles applied to the root element if `size=\"small\"`. */\n sizeSmall: {\n padding: '6px 24px 6px 16px',\n '&:last-child': {\n paddingRight: 16\n },\n '&$paddingCheckbox': {\n width: 24,\n // prevent the checkbox column from growing\n padding: '0 12px 0 16px',\n '&:last-child': {\n paddingLeft: 12,\n paddingRight: 16\n },\n '& > *': {\n padding: 0\n }\n }\n },\n\n /* Styles applied to the root element if `padding=\"checkbox\"`. */\n paddingCheckbox: {\n width: 48,\n // prevent the checkbox column from growing\n padding: '0 0 0 4px',\n '&:last-child': {\n paddingLeft: 0,\n paddingRight: 4\n }\n },\n\n /* Styles applied to the root element if `padding=\"none\"`. */\n paddingNone: {\n padding: 0,\n '&:last-child': {\n padding: 0\n }\n },\n\n /* Styles applied to the root element if `align=\"left\"`. */\n alignLeft: {\n textAlign: 'left'\n },\n\n /* Styles applied to the root element if `align=\"center\"`. */\n alignCenter: {\n textAlign: 'center'\n },\n\n /* Styles applied to the root element if `align=\"right\"`. */\n alignRight: {\n textAlign: 'right',\n flexDirection: 'row-reverse'\n },\n\n /* Styles applied to the root element if `align=\"justify\"`. */\n alignJustify: {\n textAlign: 'justify'\n },\n\n /* Styles applied to the root element if `context.table.stickyHeader={true}`. */\n stickyHeader: {\n position: 'sticky',\n top: 0,\n left: 0,\n zIndex: 2,\n backgroundColor: theme.palette.background.default\n }\n };\n};\n/**\n * The component renders a `` element when the parent context is a header\n * or otherwise a ` | ` element.\n */\n\nvar TableCell = /*#__PURE__*/React.forwardRef(function TableCell(props, ref) {\n var _props$align = props.align,\n align = _props$align === void 0 ? 'inherit' : _props$align,\n classes = props.classes,\n className = props.className,\n component = props.component,\n paddingProp = props.padding,\n scopeProp = props.scope,\n sizeProp = props.size,\n sortDirection = props.sortDirection,\n variantProp = props.variant,\n other = _objectWithoutProperties(props, [\"align\", \"classes\", \"className\", \"component\", \"padding\", \"scope\", \"size\", \"sortDirection\", \"variant\"]);\n\n var table = React.useContext(TableContext);\n var tablelvl2 = React.useContext(Tablelvl2Context);\n var isHeadCell = tablelvl2 && tablelvl2.variant === 'head';\n var role;\n var Component;\n\n if (component) {\n Component = component;\n role = isHeadCell ? 'columnheader' : 'cell';\n } else {\n Component = isHeadCell ? 'th' : 'td';\n }\n\n var scope = scopeProp;\n\n if (!scope && isHeadCell) {\n scope = 'col';\n }\n\n var padding = paddingProp || (table && table.padding ? table.padding : 'normal');\n var size = sizeProp || (table && table.size ? table.size : 'medium');\n var variant = variantProp || tablelvl2 && tablelvl2.variant;\n var ariaSort = null;\n\n if (sortDirection) {\n ariaSort = sortDirection === 'asc' ? 'ascending' : 'descending';\n }\n\n return /*#__PURE__*/React.createElement(Component, _extends({\n ref: ref,\n className: clsx(classes.root, classes[variant], className, align !== 'inherit' && classes[\"align\".concat(capitalize(align))], padding !== 'normal' && classes[\"padding\".concat(capitalize(padding))], size !== 'medium' && classes[\"size\".concat(capitalize(size))], variant === 'head' && table && table.stickyHeader && classes.stickyHeader),\n \"aria-sort\": ariaSort,\n role: role,\n scope: scope\n }, other));\n});\nprocess.env.NODE_ENV !== \"production\" ? TableCell.propTypes = {\n /**\n * Set the text-align on the table cell content.\n *\n * Monetary or generally number fields **should be right aligned** as that allows\n * you to add them up quickly in your head without having to worry about decimals.\n */\n align: PropTypes.oneOf(['center', 'inherit', 'justify', 'left', 'right']),\n\n /**\n * The table cell contents.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\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\n /* @typescript-to-proptypes-ignore */\n .elementType,\n\n /**\n * Sets the padding applied to the cell.\n * By default, the Table parent component set the value (`normal`).\n * `default` is deprecated, use `normal` instead.\n */\n padding: chainPropTypes(PropTypes.oneOf(['normal', 'checkbox', 'none', 'default']), function (props) {\n if (props.padding === 'default') {\n return new Error('Material-UI: padding=\"default\" was renamed to padding=\"normal\" for consistency.');\n }\n\n return null;\n }),\n\n /**\n * Set scope attribute.\n */\n scope: PropTypes.string,\n\n /**\n * Specify the size of the cell.\n * By default, the Table parent component set the value (`medium`).\n */\n size: PropTypes.oneOf(['medium', 'small']),\n\n /**\n * Set aria-sort direction.\n */\n sortDirection: PropTypes.oneOf(['asc', 'desc', false]),\n\n /**\n * Specify the cell type.\n * By default, the TableHead, TableBody or TableFooter parent component set the value.\n */\n variant: PropTypes.oneOf(['body', 'footer', 'head'])\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiTableCell'\n})(TableCell);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nimport Tablelvl2Context from '../Table/Tablelvl2Context';\nexport var styles = {\n /* Styles applied to the root element. */\n root: {\n display: 'table-row-group'\n }\n};\nvar tablelvl2 = {\n variant: 'body'\n};\nvar defaultComponent = 'tbody';\nvar TableBody = /*#__PURE__*/React.forwardRef(function TableBody(props, ref) {\n var classes = props.classes,\n className = props.className,\n _props$component = props.component,\n Component = _props$component === void 0 ? defaultComponent : _props$component,\n other = _objectWithoutProperties(props, [\"classes\", \"className\", \"component\"]);\n\n return /*#__PURE__*/React.createElement(Tablelvl2Context.Provider, {\n value: tablelvl2\n }, /*#__PURE__*/React.createElement(Component, _extends({\n className: clsx(classes.root, className),\n ref: ref,\n role: Component === defaultComponent ? null : 'rowgroup'\n }, other)));\n});\nprocess.env.NODE_ENV !== \"production\" ? TableBody.propTypes = {\n /**\n * The content of the component, normally `TableRow`.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object.isRequired,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\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\n /* @typescript-to-proptypes-ignore */\n .elementType\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiTableBody'\n})(TableBody);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport withStyles from '../styles/withStyles';\nimport { exactProp } from '@material-ui/utils';\nexport var html = {\n WebkitFontSmoothing: 'antialiased',\n // Antialiasing.\n MozOsxFontSmoothing: 'grayscale',\n // Antialiasing.\n // Change from `box-sizing: content-box` so that `width`\n // is not affected by `padding` or `border`.\n boxSizing: 'border-box'\n};\nexport var body = function body(theme) {\n return _extends({\n color: theme.palette.text.primary\n }, theme.typography.body2, {\n backgroundColor: theme.palette.background.default,\n '@media print': {\n // Save printer ink.\n backgroundColor: theme.palette.common.white\n }\n });\n};\nexport var styles = function styles(theme) {\n return {\n '@global': {\n html: html,\n '*, *::before, *::after': {\n boxSizing: 'inherit'\n },\n 'strong, b': {\n fontWeight: theme.typography.fontWeightBold\n },\n body: _extends({\n margin: 0\n }, body(theme), {\n // Add support for document.body.requestFullScreen().\n // Other elements, if background transparent, are not supported.\n '&::backdrop': {\n backgroundColor: theme.palette.background.default\n }\n })\n }\n };\n};\n/**\n * Kickstart an elegant, consistent, and simple baseline to build upon.\n */\n\nfunction CssBaseline(props) {\n /* eslint-disable no-unused-vars */\n var _props$children = props.children,\n children = _props$children === void 0 ? null : _props$children,\n classes = props.classes;\n /* eslint-enable no-unused-vars */\n\n return /*#__PURE__*/React.createElement(React.Fragment, null, children);\n}\n\nprocess.env.NODE_ENV !== \"production\" ? CssBaseline.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * You can wrap a node.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object\n} : void 0;\n\nif (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line\n CssBaseline['propTypes' + ''] = exactProp(CssBaseline.propTypes);\n}\n\nexport default withStyles(styles, {\n name: 'MuiCssBaseline'\n})(CssBaseline);","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __assign, __extends } from \"tslib\";\r\nimport { CoreUtils } from '@microsoft/applicationinsights-core-js';\r\nimport * as React from 'react';\r\n/**\r\n * Higher-order component function to hook Application Insights tracking\r\n * in a React component's lifecycle.\r\n *\r\n * @param reactPlugin ReactPlugin instance\r\n * @param Component the React component to be instrumented\r\n * @param componentName (optional) component name\r\n * @param className (optional) className of the HOC div\r\n */\r\nexport default function withAITracking(reactPlugin, Component, componentName, className) {\r\n if (componentName === undefined || componentName === null || typeof componentName !== 'string') {\r\n componentName = Component.prototype &&\r\n Component.prototype.constructor &&\r\n Component.prototype.constructor.name ||\r\n 'Unknown';\r\n }\r\n if (className === undefined || className === null || typeof className !== 'string') {\r\n className = '';\r\n }\r\n return /** @class */ (function (_super) {\r\n __extends(class_1, _super);\r\n function class_1() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._mountTimestamp = 0;\r\n _this._firstActiveTimestamp = 0;\r\n _this._idleStartTimestamp = 0;\r\n _this._lastActiveTimestamp = 0;\r\n _this._totalIdleTime = 0;\r\n _this._idleCount = 0;\r\n _this._idleTimeout = 5000;\r\n _this.trackActivity = function (e) {\r\n if (_this._firstActiveTimestamp === 0) {\r\n _this._firstActiveTimestamp = CoreUtils.dateNow();\r\n _this._lastActiveTimestamp = _this._firstActiveTimestamp;\r\n }\r\n else {\r\n _this._lastActiveTimestamp = CoreUtils.dateNow();\r\n }\r\n if (_this._idleStartTimestamp > 0) {\r\n var lastIdleTime = _this._lastActiveTimestamp - _this._idleStartTimestamp;\r\n _this._totalIdleTime += lastIdleTime;\r\n _this._idleStartTimestamp = 0;\r\n }\r\n };\r\n return _this;\r\n }\r\n class_1.prototype.componentDidMount = function () {\r\n var _this = this;\r\n this._mountTimestamp = CoreUtils.dateNow();\r\n this._firstActiveTimestamp = 0;\r\n this._totalIdleTime = 0;\r\n this._lastActiveTimestamp = 0;\r\n this._idleStartTimestamp = 0;\r\n this._idleCount = 0;\r\n this._intervalId = setInterval(function () {\r\n if (_this._lastActiveTimestamp > 0 && _this._idleStartTimestamp === 0 && CoreUtils.dateNow() - _this._lastActiveTimestamp >= _this._idleTimeout) {\r\n _this._idleStartTimestamp = CoreUtils.dateNow();\r\n _this._idleCount++;\r\n }\r\n }, 100);\r\n };\r\n class_1.prototype.componentWillUnmount = function () {\r\n if (this._mountTimestamp === 0) {\r\n throw new Error('withAITracking:componentWillUnmount: mountTimestamp is not initialized.');\r\n }\r\n if (this._intervalId) {\r\n clearInterval(this._intervalId);\r\n }\r\n if (this._firstActiveTimestamp === 0) {\r\n return;\r\n }\r\n var engagementTime = this.getEngagementTimeSeconds();\r\n var metricData = {\r\n average: engagementTime,\r\n name: 'React Component Engaged Time (seconds)',\r\n sampleCount: 1\r\n };\r\n var additionalProperties = { 'Component Name': componentName };\r\n reactPlugin.trackMetric(metricData, additionalProperties);\r\n };\r\n class_1.prototype.render = function () {\r\n return (React.createElement(\"div\", { onKeyDown: this.trackActivity, onMouseMove: this.trackActivity, onScroll: this.trackActivity, onMouseDown: this.trackActivity, onTouchStart: this.trackActivity, onTouchMove: this.trackActivity, className: className },\r\n React.createElement(Component, __assign({}, this.props))));\r\n };\r\n class_1.prototype.getEngagementTimeSeconds = function () {\r\n return (CoreUtils.dateNow() - this._firstActiveTimestamp - this._totalIdleTime - this._idleCount * this._idleTimeout) / 1000;\r\n };\r\n return class_1;\r\n }(React.Component));\r\n}\r\n//# sourceMappingURL=withAITracking.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { arrForEach, isFunction } from \"./HelperFuncs\";\r\nvar processTelemetry = \"processTelemetry\";\r\nvar priority = \"priority\";\r\nvar setNextPlugin = \"setNextPlugin\";\r\nvar isInitialized = \"isInitialized\";\r\n/**\r\n * Initialize the queue of plugins\r\n * @param plugins - The array of plugins to initialize and setting of the next plugin\r\n * @param config The current config for the instance\r\n * @param core THe current core instance\r\n * @param extensions The extensions\r\n */\r\nexport function initializePlugins(processContext, extensions) {\r\n // Set the next plugin and identified the uninitialized plugins\r\n var initPlugins = [];\r\n var lastPlugin = null;\r\n var proxy = processContext.getNext();\r\n while (proxy) {\r\n var thePlugin = proxy.getPlugin();\r\n if (thePlugin) {\r\n if (lastPlugin &&\r\n isFunction(lastPlugin[setNextPlugin]) &&\r\n isFunction(thePlugin[processTelemetry])) {\r\n // Set this plugin as the next for the previous one\r\n lastPlugin[setNextPlugin](thePlugin);\r\n }\r\n if (!isFunction(thePlugin[isInitialized]) || !thePlugin[isInitialized]()) {\r\n initPlugins.push(thePlugin);\r\n }\r\n lastPlugin = thePlugin;\r\n proxy = proxy.getNext();\r\n }\r\n }\r\n // Now initiatilize the plugins\r\n arrForEach(initPlugins, function (thePlugin) {\r\n thePlugin.initialize(processContext.getCfg(), processContext.core(), extensions, processContext.getNext());\r\n });\r\n}\r\nexport function sortPlugins(plugins) {\r\n // Sort by priority\r\n return plugins.sort(function (extA, extB) {\r\n var result = 0;\r\n var bHasProcess = isFunction(extB[processTelemetry]);\r\n if (isFunction(extA[processTelemetry])) {\r\n result = bHasProcess ? extA[priority] - extB[priority] : 1;\r\n }\r\n else if (bHasProcess) {\r\n result = -1;\r\n }\r\n return result;\r\n });\r\n // sort complete\r\n}\r\n//# sourceMappingURL=TelemetryHelpers.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { __extends } from \"tslib\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { BaseTelemetryPlugin } from \"./BaseTelemetryPlugin\";\r\nimport { ProcessTelemetryContext } from \"./ProcessTelemetryContext\";\r\nimport { initializePlugins } from \"./TelemetryHelpers\";\r\nimport { arrForEach, objDefineAccessors, throwError } from \"./HelperFuncs\";\r\nvar ChannelControllerPriority = 500;\r\nvar ChannelValidationMessage = \"Channel has invalid priority\";\r\nvar ChannelController = /** @class */ (function (_super) {\r\n __extends(ChannelController, _super);\r\n function ChannelController() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"ChannelControllerPlugin\";\r\n _this.priority = ChannelControllerPriority; // in reserved range 100 to 200\r\n var _channelQueue;\r\n dynamicProto(ChannelController, _this, function (_self, _base) {\r\n _self.setNextPlugin = function (next) {\r\n // The Channel controller is last in pipeline\r\n };\r\n _self.processTelemetry = function (item, itemCtx) {\r\n if (_channelQueue) {\r\n arrForEach(_channelQueue, function (queues) {\r\n // pass on to first item in queue\r\n if (queues.length > 0) {\r\n // Copying the item context as we could have mutiple chains that are executing asynchronously\r\n // and calling _getDefTelCtx as it's possible that the caller doesn't pass any context\r\n var chainCtx = _this._getTelCtx(itemCtx).createNew(queues);\r\n chainCtx.processNext(item);\r\n }\r\n });\r\n }\r\n };\r\n _self.getChannelControls = function () {\r\n return _channelQueue;\r\n };\r\n _self.initialize = function (config, core, extensions) {\r\n if (_self.isInitialized()) {\r\n // already initialized\r\n return;\r\n }\r\n _base.initialize(config, core, extensions);\r\n _createChannelQueues((config || {}).channels, extensions);\r\n // Initialize the Queues\r\n arrForEach(_channelQueue, function (queue) { return initializePlugins(new ProcessTelemetryContext(queue, config, core), extensions); });\r\n };\r\n });\r\n function _checkQueuePriority(queue) {\r\n arrForEach(queue, function (queueItem) {\r\n if (queueItem.priority < ChannelControllerPriority) {\r\n throwError(ChannelValidationMessage + queueItem.identifier);\r\n }\r\n });\r\n }\r\n function _addChannelQueue(queue) {\r\n if (queue && queue.length > 0) {\r\n queue = queue.sort(function (a, b) {\r\n return a.priority - b.priority;\r\n });\r\n _checkQueuePriority(queue);\r\n _channelQueue.push(queue);\r\n }\r\n }\r\n function _createChannelQueues(channels, extensions) {\r\n _channelQueue = [];\r\n if (channels) {\r\n // Add and sort the configuration channel queues\r\n arrForEach(channels, function (queue) { return _addChannelQueue(queue); });\r\n }\r\n if (extensions) {\r\n // Create a new channel queue for any extensions with a priority > the ChannelControllerPriority\r\n var extensionQueue_1 = [];\r\n arrForEach(extensions, function (plugin) {\r\n if (plugin.priority > ChannelControllerPriority) {\r\n extensionQueue_1.push(plugin);\r\n }\r\n });\r\n _addChannelQueue(extensionQueue_1);\r\n }\r\n }\r\n return _this;\r\n }\r\n ChannelController.prototype.processTelemetry = function (item, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ChannelController.prototype.getChannelControls = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n ChannelController.prototype.initialize = function (config, core, extensions) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Static constructor, attempt to create accessors\r\n */\r\n // tslint:disable-next-line\r\n ChannelController._staticInit = (function () {\r\n var proto = ChannelController.prototype;\r\n // Dynamically create get/set property accessors\r\n objDefineAccessors(proto, \"ChannelControls\", proto.getChannelControls);\r\n objDefineAccessors(proto, \"channelQueue\", proto.getChannelControls);\r\n })();\r\n return ChannelController;\r\n}(BaseTelemetryPlugin));\r\nexport { ChannelController };\r\n//# sourceMappingURL=ChannelController.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { __spreadArray } from \"tslib\";\r\nimport { objCreateFn } from \"@microsoft/applicationinsights-shims\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { ChannelController } from \"./ChannelController\";\r\nimport { ProcessTelemetryContext } from \"./ProcessTelemetryContext\";\r\nimport { initializePlugins, sortPlugins } from \"./TelemetryHelpers\";\r\nimport { LoggingSeverity } from \"../JavaScriptSDK.Enums/LoggingEnums\";\r\nimport { getGblPerfMgr, PerfManager } from \"./PerfManager\";\r\nimport { createCookieMgr } from \"./CookieMgr\";\r\nimport { arrForEach, isNullOrUndefined, toISOString, getSetValue, setValue, throwError, isNotTruthy, isFunction } from \"./HelperFuncs\";\r\nimport { strExtensionConfig, strIKey } from \"./Constants\";\r\nimport { DiagnosticLogger } from \"./DiagnosticLogger\";\r\nvar validationError = \"Extensions must provide callback to initialize\";\r\nvar strNotificationManager = \"_notificationManager\";\r\n/**\r\n * Helper to create the default performance manager\r\n * @param core\r\n * @param notificationMgr\r\n */\r\nfunction _createPerfManager(core, notificationMgr) {\r\n return new PerfManager(notificationMgr);\r\n}\r\nvar BaseCore = /** @class */ (function () {\r\n function BaseCore() {\r\n var _isInitialized = false;\r\n var _eventQueue;\r\n var _channelController;\r\n var _notificationManager;\r\n var _perfManager;\r\n var _cookieManager;\r\n dynamicProto(BaseCore, this, function (_self) {\r\n _self._extensions = new Array();\r\n _channelController = new ChannelController();\r\n // Use a default logger so initialization errors are not dropped on the floor with full logging\r\n _self.logger = new DiagnosticLogger({ loggingLevelConsole: LoggingSeverity.CRITICAL });\r\n _eventQueue = [];\r\n _self.isInitialized = function () { return _isInitialized; };\r\n _self.initialize = function (config, extensions, logger, notificationManager) {\r\n // Make sure core is only initialized once\r\n if (_self.isInitialized()) {\r\n throwError(\"Core should not be initialized more than once\");\r\n }\r\n if (!config || isNullOrUndefined(config.instrumentationKey)) {\r\n throwError(\"Please provide instrumentation key\");\r\n }\r\n _notificationManager = notificationManager;\r\n // For backward compatibility only\r\n _self[strNotificationManager] = notificationManager;\r\n _self.config = config || {};\r\n if (_self.config.enablePerfMgr) {\r\n // Set the performance manager creation function if not defined\r\n setValue(_self.config, \"createPerfMgr\", _createPerfManager);\r\n }\r\n config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;\r\n // add notification to the extensions in the config so other plugins can access it\r\n var extConfig = getSetValue(config, strExtensionConfig);\r\n extConfig.NotificationManager = notificationManager;\r\n if (logger) {\r\n _self.logger = logger;\r\n }\r\n // Concat all available extensions\r\n var allExtensions = [];\r\n allExtensions.push.apply(allExtensions, __spreadArray(__spreadArray([], extensions, false), config.extensions, false));\r\n allExtensions = sortPlugins(allExtensions);\r\n var coreExtensions = [];\r\n var channelExtensions = [];\r\n // Check if any two extensions have the same priority, then warn to console\r\n // And extract the local extensions from the\r\n var extPriorities = {};\r\n // Extension validation\r\n arrForEach(allExtensions, function (ext) {\r\n if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {\r\n throwError(validationError);\r\n }\r\n var extPriority = ext.priority;\r\n var identifier = ext.identifier;\r\n if (ext && extPriority) {\r\n if (!isNullOrUndefined(extPriorities[extPriority])) {\r\n logger.warnToConsole(\"Two extensions have same priority #\" + extPriority + \" - \" + extPriorities[extPriority] + \", \" + identifier);\r\n }\r\n else {\r\n // set a value\r\n extPriorities[extPriority] = identifier;\r\n }\r\n }\r\n // Split extensions to core and channelController\r\n if (!extPriority || extPriority < _channelController.priority) {\r\n // Add to core extension that will be managed by BaseCore\r\n coreExtensions.push(ext);\r\n }\r\n else {\r\n // Add all other extensions to be managed by the channel controller\r\n channelExtensions.push(ext);\r\n }\r\n });\r\n // Validation complete\r\n // Add the channelController to the complete extension collection and\r\n // to the end of the core extensions\r\n allExtensions.push(_channelController);\r\n coreExtensions.push(_channelController);\r\n // Sort the complete set of extensions by priority\r\n allExtensions = sortPlugins(allExtensions);\r\n _self._extensions = allExtensions;\r\n // initialize channel controller first, this will initialize all channel plugins\r\n initializePlugins(new ProcessTelemetryContext([_channelController], config, _self), allExtensions);\r\n initializePlugins(new ProcessTelemetryContext(coreExtensions, config, _self), allExtensions);\r\n // Now reset the extensions to just those being managed by Basecore\r\n _self._extensions = coreExtensions;\r\n if (_self.getTransmissionControls().length === 0) {\r\n throwError(\"No channels available\");\r\n }\r\n _isInitialized = true;\r\n _self.releaseQueue();\r\n };\r\n _self.getTransmissionControls = function () {\r\n return _channelController.getChannelControls();\r\n };\r\n _self.track = function (telemetryItem) {\r\n // setup default iKey if not passed in\r\n setValue(telemetryItem, strIKey, _self.config.instrumentationKey, null, isNotTruthy);\r\n // add default timestamp if not passed in\r\n setValue(telemetryItem, \"time\", toISOString(new Date()), null, isNotTruthy);\r\n // Common Schema 4.0\r\n setValue(telemetryItem, \"ver\", \"4.0\", null, isNullOrUndefined);\r\n if (_self.isInitialized()) {\r\n // Process the telemetry plugin chain\r\n _self.getProcessTelContext().processNext(telemetryItem);\r\n }\r\n else {\r\n // Queue events until all extensions are initialized\r\n _eventQueue.push(telemetryItem);\r\n }\r\n };\r\n _self.getProcessTelContext = function () {\r\n var extensions = _self._extensions;\r\n var thePlugins = extensions;\r\n // invoke any common telemetry processors before sending through pipeline\r\n if (!extensions || extensions.length === 0) {\r\n // Pass to Channel controller so data is sent to correct channel queues\r\n thePlugins = [_channelController];\r\n }\r\n return new ProcessTelemetryContext(thePlugins, _self.config, _self);\r\n };\r\n _self.getNotifyMgr = function () {\r\n if (!_notificationManager) {\r\n // Create Dummy notification manager\r\n _notificationManager = objCreateFn({\r\n addNotificationListener: function (listener) { },\r\n removeNotificationListener: function (listener) { },\r\n eventsSent: function (events) { },\r\n eventsDiscarded: function (events, reason) { },\r\n eventsSendRequest: function (sendReason, isAsync) { }\r\n });\r\n // For backward compatibility only\r\n _self[strNotificationManager] = _notificationManager;\r\n }\r\n return _notificationManager;\r\n };\r\n _self.getCookieMgr = function () {\r\n if (!_cookieManager) {\r\n _cookieManager = createCookieMgr(_self.config, _self.logger);\r\n }\r\n return _cookieManager;\r\n };\r\n _self.setCookieMgr = function (cookieMgr) {\r\n _cookieManager = cookieMgr;\r\n };\r\n _self.getPerfMgr = function () {\r\n if (!_perfManager) {\r\n if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {\r\n _perfManager = _self.config.createPerfMgr(_self, _self.getNotifyMgr());\r\n }\r\n }\r\n return _perfManager || getGblPerfMgr();\r\n };\r\n _self.setPerfMgr = function (perfMgr) {\r\n _perfManager = perfMgr;\r\n };\r\n _self.eventCnt = function () {\r\n return _eventQueue.length;\r\n };\r\n _self.releaseQueue = function () {\r\n if (_eventQueue.length > 0) {\r\n arrForEach(_eventQueue, function (event) {\r\n _self.getProcessTelContext().processNext(event);\r\n });\r\n _eventQueue = [];\r\n }\r\n };\r\n });\r\n }\r\n BaseCore.prototype.initialize = function (config, extensions, logger, notificationManager) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseCore.prototype.getTransmissionControls = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n BaseCore.prototype.track = function (telemetryItem) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseCore.prototype.getProcessTelContext = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n BaseCore.prototype.getNotifyMgr = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Get the current cookie manager for this instance\r\n */\r\n BaseCore.prototype.getCookieMgr = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Set the current cookie manager for this instance\r\n * @param cookieMgr - The manager, if set to null/undefined will cause the default to be created\r\n */\r\n BaseCore.prototype.setCookieMgr = function (cookieMgr) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseCore.prototype.getPerfMgr = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n BaseCore.prototype.setPerfMgr = function (perfMgr) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseCore.prototype.eventCnt = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return 0;\r\n };\r\n BaseCore.prototype.releaseQueue = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return BaseCore;\r\n}());\r\nexport { BaseCore };\r\n//# sourceMappingURL=BaseCore.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n/**\r\n * The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.\r\n */\r\nexport var EventsDiscardedReason = {\r\n /**\r\n * Unknown.\r\n */\r\n Unknown: 0,\r\n /**\r\n * Status set to non-retryable.\r\n */\r\n NonRetryableStatus: 1,\r\n /**\r\n * The event is invalid.\r\n */\r\n InvalidEvent: 2,\r\n /**\r\n * The size of the event is too large.\r\n */\r\n SizeLimitExceeded: 3,\r\n /**\r\n * The server is not accepting events from this instrumentation key.\r\n */\r\n KillSwitch: 4,\r\n /**\r\n * The event queue is full.\r\n */\r\n QueueFull: 5\r\n};\r\n//# sourceMappingURL=EventsDiscardedReason.js.map","import dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { arrForEach, arrIndexOf } from \"./HelperFuncs\";\r\n/**\r\n * Class to manage sending notifications to all the listeners.\r\n */\r\nvar NotificationManager = /** @class */ (function () {\r\n function NotificationManager(config) {\r\n this.listeners = [];\r\n var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;\r\n dynamicProto(NotificationManager, this, function (_self) {\r\n _self.addNotificationListener = function (listener) {\r\n _self.listeners.push(listener);\r\n };\r\n /**\r\n * Removes all instances of the listener.\r\n * @param {INotificationListener} listener - AWTNotificationListener to remove.\r\n */\r\n _self.removeNotificationListener = function (listener) {\r\n var index = arrIndexOf(_self.listeners, listener);\r\n while (index > -1) {\r\n _self.listeners.splice(index, 1);\r\n index = arrIndexOf(_self.listeners, listener);\r\n }\r\n };\r\n /**\r\n * Notification for events sent.\r\n * @param {ITelemetryItem[]} events - The array of events that have been sent.\r\n */\r\n _self.eventsSent = function (events) {\r\n arrForEach(_self.listeners, function (listener) {\r\n if (listener && listener.eventsSent) {\r\n setTimeout(function () { return listener.eventsSent(events); }, 0);\r\n }\r\n });\r\n };\r\n /**\r\n * Notification for events being discarded.\r\n * @param {ITelemetryItem[]} events - The array of events that have been discarded by the SDK.\r\n * @param {number} reason - The reason for which the SDK discarded the events. The EventsDiscardedReason\r\n * constant should be used to check the different values.\r\n */\r\n _self.eventsDiscarded = function (events, reason) {\r\n arrForEach(_self.listeners, function (listener) {\r\n if (listener && listener.eventsDiscarded) {\r\n setTimeout(function () { return listener.eventsDiscarded(events, reason); }, 0);\r\n }\r\n });\r\n };\r\n /**\r\n * [Optional] A function called when the events have been requested to be sent to the sever.\r\n * @param {number} sendReason - The reason why the event batch is being sent.\r\n * @param {boolean} isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.\r\n */\r\n _self.eventsSendRequest = function (sendReason, isAsync) {\r\n arrForEach(_self.listeners, function (listener) {\r\n if (listener && listener.eventsSendRequest) {\r\n if (isAsync) {\r\n setTimeout(function () { return listener.eventsSendRequest(sendReason, isAsync); }, 0);\r\n }\r\n else {\r\n try {\r\n listener.eventsSendRequest(sendReason, isAsync);\r\n }\r\n catch (e) {\r\n // Catch errors to ensure we don't block sending the requests\r\n }\r\n }\r\n }\r\n });\r\n };\r\n _self.perfEvent = function (perfEvent) {\r\n if (perfEvent) {\r\n // Send all events or only parent events\r\n if (perfEvtsSendAll || !perfEvent.isChildEvt()) {\r\n arrForEach(_self.listeners, function (listener) {\r\n if (listener && listener.perfEvent) {\r\n if (perfEvent.isAsync) {\r\n setTimeout(function () { return listener.perfEvent(perfEvent); }, 0);\r\n }\r\n else {\r\n try {\r\n listener.perfEvent(perfEvent);\r\n }\r\n catch (e) {\r\n // Catch errors to ensure we don't block sending the requests\r\n }\r\n }\r\n }\r\n });\r\n }\r\n }\r\n };\r\n });\r\n }\r\n /**\r\n * Adds a notification listener.\r\n * @param {INotificationListener} listener - The notification listener to be added.\r\n */\r\n NotificationManager.prototype.addNotificationListener = function (listener) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Removes all instances of the listener.\r\n * @param {INotificationListener} listener - AWTNotificationListener to remove.\r\n */\r\n NotificationManager.prototype.removeNotificationListener = function (listener) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Notification for events sent.\r\n * @param {ITelemetryItem[]} events - The array of events that have been sent.\r\n */\r\n NotificationManager.prototype.eventsSent = function (events) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Notification for events being discarded.\r\n * @param {ITelemetryItem[]} events - The array of events that have been discarded by the SDK.\r\n * @param {number} reason - The reason for which the SDK discarded the events. The EventsDiscardedReason\r\n * constant should be used to check the different values.\r\n */\r\n NotificationManager.prototype.eventsDiscarded = function (events, reason) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * [Optional] A function called when the events have been requested to be sent to the sever.\r\n * @param {number} sendReason - The reason why the event batch is being sent.\r\n * @param {boolean} isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.\r\n */\r\n NotificationManager.prototype.eventsSendRequest = function (sendReason, isAsync) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return NotificationManager;\r\n}());\r\nexport { NotificationManager };\r\n//# sourceMappingURL=NotificationManager.js.map","import { __extends } from \"tslib\";\r\nimport { BaseCore } from \"./BaseCore\";\r\nimport { EventsDiscardedReason } from \"../JavaScriptSDK.Enums/EventsDiscardedReason\";\r\nimport { NotificationManager } from \"./NotificationManager\";\r\nimport { doPerf } from \"./PerfManager\";\r\nimport { _InternalLogMessage, DiagnosticLogger } from \"./DiagnosticLogger\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { arrForEach, isNullOrUndefined, toISOString, throwError } from \"./HelperFuncs\";\r\n\"use strict\";\r\nvar AppInsightsCore = /** @class */ (function (_super) {\r\n __extends(AppInsightsCore, _super);\r\n function AppInsightsCore() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * Internal log poller\r\n */\r\n var _internalLogPoller = 0;\r\n dynamicProto(AppInsightsCore, _this, function (_self, _base) {\r\n _self.initialize = function (config, extensions, logger, notificationManager) {\r\n _base.initialize(config, extensions, logger || new DiagnosticLogger(config), notificationManager || new NotificationManager(config));\r\n };\r\n _self.track = function (telemetryItem) {\r\n doPerf(_self.getPerfMgr(), function () { return \"AppInsightsCore:track\"; }, function () {\r\n if (telemetryItem === null) {\r\n _notifyInvalidEvent(telemetryItem);\r\n // throw error\r\n throwError(\"Invalid telemetry item\");\r\n }\r\n // do basic validation before sending it through the pipeline\r\n _validateTelemetryItem(telemetryItem);\r\n _base.track(telemetryItem);\r\n }, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));\r\n };\r\n /**\r\n * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.\r\n * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be\r\n * called.\r\n * @param {INotificationListener} listener - An INotificationListener object.\r\n */\r\n _self.addNotificationListener = function (listener) {\r\n var manager = _self.getNotifyMgr();\r\n if (manager) {\r\n manager.addNotificationListener(listener);\r\n }\r\n };\r\n /**\r\n * Removes all instances of the listener.\r\n * @param {INotificationListener} listener - INotificationListener to remove.\r\n */\r\n _self.removeNotificationListener = function (listener) {\r\n var manager = _self.getNotifyMgr();\r\n if (manager) {\r\n manager.removeNotificationListener(listener);\r\n }\r\n };\r\n /**\r\n * Periodically check logger.queue for log messages to be flushed\r\n */\r\n _self.pollInternalLogs = function (eventName) {\r\n var interval = _self.config.diagnosticLogInterval;\r\n if (!interval || !(interval > 0)) {\r\n interval = 10000;\r\n }\r\n if (_internalLogPoller) {\r\n _self.stopPollingInternalLogs();\r\n }\r\n _internalLogPoller = setInterval(function () {\r\n var queue = _self.logger ? _self.logger.queue : [];\r\n arrForEach(queue, function (logMessage) {\r\n var item = {\r\n name: eventName ? eventName : \"InternalMessageId: \" + logMessage.messageId,\r\n iKey: _self.config.instrumentationKey,\r\n time: toISOString(new Date()),\r\n baseType: _InternalLogMessage.dataType,\r\n baseData: { message: logMessage.message }\r\n };\r\n _self.track(item);\r\n });\r\n queue.length = 0;\r\n }, interval);\r\n return _internalLogPoller;\r\n };\r\n /**\r\n * Stop polling log messages from logger.queue\r\n */\r\n _self.stopPollingInternalLogs = function () {\r\n if (!_internalLogPoller)\r\n return;\r\n clearInterval(_internalLogPoller);\r\n _internalLogPoller = 0;\r\n };\r\n function _validateTelemetryItem(telemetryItem) {\r\n if (isNullOrUndefined(telemetryItem.name)) {\r\n _notifyInvalidEvent(telemetryItem);\r\n throw Error(\"telemetry name required\");\r\n }\r\n }\r\n function _notifyInvalidEvent(telemetryItem) {\r\n var manager = _self.getNotifyMgr();\r\n if (manager) {\r\n manager.eventsDiscarded([telemetryItem], EventsDiscardedReason.InvalidEvent);\r\n }\r\n }\r\n });\r\n return _this;\r\n }\r\n AppInsightsCore.prototype.initialize = function (config, extensions, logger, notificationManager) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n AppInsightsCore.prototype.track = function (telemetryItem) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.\r\n * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be\r\n * called.\r\n * @param {INotificationListener} listener - An INotificationListener object.\r\n */\r\n AppInsightsCore.prototype.addNotificationListener = function (listener) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Removes all instances of the listener.\r\n * @param {INotificationListener} listener - INotificationListener to remove.\r\n */\r\n AppInsightsCore.prototype.removeNotificationListener = function (listener) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Periodically check logger.queue for\r\n */\r\n AppInsightsCore.prototype.pollInternalLogs = function (eventName) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return 0;\r\n };\r\n /**\r\n * Periodically check logger.queue for\r\n */\r\n AppInsightsCore.prototype.stopPollingInternalLogs = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return AppInsightsCore;\r\n}(BaseCore));\r\nexport { AppInsightsCore };\r\n//# sourceMappingURL=AppInsightsCore.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the\r\nexport { Util, CorrelationIdHelper, DateTimeUtils, dateTimeUtilsNow, dateTimeUtilsDuration, UrlHelper, isInternalApplicationInsightsEndpoint } from \"./Util\";\r\nexport { parseConnectionString, ConnectionStringParser } from \"./ConnectionStringParser\";\r\nexport { RequestHeaders } from \"./RequestResponseHeaders\";\r\nexport { DisabledPropertyName, ProcessLegacy, SampleRate, HttpMethod, DEFAULT_BREEZE_ENDPOINT, strNotSpecified } from \"./Constants\";\r\nexport { Data as AIData } from \"./Interfaces/Contracts/Generated/Data\";\r\nexport { Base as AIBase } from \"./Interfaces/Contracts/Generated/Base\";\r\nexport { Envelope } from \"./Telemetry/Common/Envelope\";\r\nexport { Event } from \"./Telemetry/Event\";\r\nexport { Exception } from \"./Telemetry/Exception\";\r\nexport { Metric } from \"./Telemetry/Metric\";\r\nexport { PageView } from \"./Telemetry/PageView\";\r\nexport { PageViewData } from \"./Interfaces/Contracts/Generated/PageViewData\";\r\nexport { RemoteDependencyData } from \"./Telemetry/RemoteDependencyData\";\r\nexport { Trace } from \"./Telemetry/Trace\";\r\nexport { PageViewPerformance } from \"./Telemetry/PageViewPerformance\";\r\nexport { Data } from \"./Telemetry/Common/Data\";\r\nexport { SeverityLevel } from \"./Interfaces/Contracts/Generated/SeverityLevel\";\r\nexport { ConfigurationManager } from \"./Interfaces/IConfig\";\r\nexport { ContextTagKeys } from \"./Interfaces/Contracts/Generated/ContextTagKeys\";\r\nexport { DataSanitizer, dataSanitizeKeyAndAddUniqueness, dataSanitizeKey, dataSanitizeString, dataSanitizeUrl, dataSanitizeMessage, dataSanitizeException, dataSanitizeProperties, dataSanitizeMeasurements, dataSanitizeId, dataSanitizeInput, dsPadNumber } from \"./Telemetry/Common/DataSanitizer\";\r\nexport { TelemetryItemCreator } from \"./TelemetryItemCreator\";\r\nexport { CtxTagKeys, Extensions } from \"./Interfaces/PartAExtensions\";\r\nexport { DistributedTracingModes } from \"./Enums\";\r\nexport { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from \"./HelperFuncs\";\r\nexport { isBeaconsSupported as isBeaconApiSupported } from \"@microsoft/applicationinsights-core-js\";\r\nexport { createDomEvent } from \"./DomHelperFuncs\";\r\nexport { utlDisableStorage, utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage, utlRemoveStorage, utlCanUseSessionStorage, utlGetSessionStorageKeys, utlGetSessionStorage, utlSetSessionStorage, utlRemoveSessionStorage } from \"./StorageHelperFuncs\";\r\nexport { urlParseUrl, urlGetAbsoluteUrl, urlGetPathName, urlGetCompleteUrl, urlParseHost, urlParseFullHost } from \"./UrlHelperFuncs\";\r\nexport var PropertiesPluginIdentifier = \"AppInsightsPropertiesPlugin\";\r\nexport var BreezeChannelIdentifier = \"AppInsightsChannelPlugin\";\r\nexport var AnalyticsPluginIdentifier = \"ApplicationInsightsAnalytics\";\r\n//# sourceMappingURL=applicationinsights-common.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { LoggingSeverity, _InternalMessageId, hasJSON, getJSON, objForEachKey, isObject, strTrim } from \"@microsoft/applicationinsights-core-js\";\r\nexport function dataSanitizeKeyAndAddUniqueness(logger, key, map) {\r\n var origLength = key.length;\r\n var field = dataSanitizeKey(logger, key);\r\n // validation truncated the length. We need to add uniqueness\r\n if (field.length !== origLength) {\r\n var i = 0;\r\n var uniqueField = field;\r\n while (map[uniqueField] !== undefined) {\r\n i++;\r\n uniqueField = field.substring(0, 150 /* MAX_NAME_LENGTH */ - 3) + dsPadNumber(i);\r\n }\r\n field = uniqueField;\r\n }\r\n return field;\r\n}\r\nexport function dataSanitizeKey(logger, name) {\r\n var nameTrunc;\r\n if (name) {\r\n // Remove any leading or trailing whitespace\r\n name = strTrim(name.toString());\r\n // truncate the string to 150 chars\r\n if (name.length > 150 /* MAX_NAME_LENGTH */) {\r\n nameTrunc = name.substring(0, 150 /* MAX_NAME_LENGTH */);\r\n logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, \"name is too long. It has been truncated to \" + 150 /* MAX_NAME_LENGTH */ + \" characters.\", { name: name }, true);\r\n }\r\n }\r\n return nameTrunc || name;\r\n}\r\nexport function dataSanitizeString(logger, value, maxLength) {\r\n if (maxLength === void 0) { maxLength = 1024 /* MAX_STRING_LENGTH */; }\r\n var valueTrunc;\r\n if (value) {\r\n maxLength = maxLength ? maxLength : 1024 /* MAX_STRING_LENGTH */; // in case default parameters dont work\r\n value = strTrim(value);\r\n if (value.toString().length > maxLength) {\r\n valueTrunc = value.toString().substring(0, maxLength);\r\n logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, \"string value is too long. It has been truncated to \" + maxLength + \" characters.\", { value: value }, true);\r\n }\r\n }\r\n return valueTrunc || value;\r\n}\r\nexport function dataSanitizeUrl(logger, url) {\r\n return dataSanitizeInput(logger, url, 2048 /* MAX_URL_LENGTH */, _InternalMessageId.UrlTooLong);\r\n}\r\nexport function dataSanitizeMessage(logger, message) {\r\n var messageTrunc;\r\n if (message) {\r\n if (message.length > 32768 /* MAX_MESSAGE_LENGTH */) {\r\n messageTrunc = message.substring(0, 32768 /* MAX_MESSAGE_LENGTH */);\r\n logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.MessageTruncated, \"message is too long, it has been truncated to \" + 32768 /* MAX_MESSAGE_LENGTH */ + \" characters.\", { message: message }, true);\r\n }\r\n }\r\n return messageTrunc || message;\r\n}\r\nexport function dataSanitizeException(logger, exception) {\r\n var exceptionTrunc;\r\n if (exception) {\r\n // Make surte its a string\r\n var value = \"\" + exception;\r\n if (value.length > 32768 /* MAX_EXCEPTION_LENGTH */) {\r\n exceptionTrunc = value.substring(0, 32768 /* MAX_EXCEPTION_LENGTH */);\r\n logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ExceptionTruncated, \"exception is too long, it has been truncated to \" + 32768 /* MAX_EXCEPTION_LENGTH */ + \" characters.\", { exception: exception }, true);\r\n }\r\n }\r\n return exceptionTrunc || exception;\r\n}\r\nexport function dataSanitizeProperties(logger, properties) {\r\n if (properties) {\r\n var tempProps_1 = {};\r\n objForEachKey(properties, function (prop, value) {\r\n if (isObject(value) && hasJSON()) {\r\n // Stringify any part C properties\r\n try {\r\n value = getJSON().stringify(value);\r\n }\r\n catch (e) {\r\n logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, \"custom property is not valid\", { exception: e }, true);\r\n }\r\n }\r\n value = dataSanitizeString(logger, value, 8192 /* MAX_PROPERTY_LENGTH */);\r\n prop = dataSanitizeKeyAndAddUniqueness(logger, prop, tempProps_1);\r\n tempProps_1[prop] = value;\r\n });\r\n properties = tempProps_1;\r\n }\r\n return properties;\r\n}\r\nexport function dataSanitizeMeasurements(logger, measurements) {\r\n if (measurements) {\r\n var tempMeasurements_1 = {};\r\n objForEachKey(measurements, function (measure, value) {\r\n measure = dataSanitizeKeyAndAddUniqueness(logger, measure, tempMeasurements_1);\r\n tempMeasurements_1[measure] = value;\r\n });\r\n measurements = tempMeasurements_1;\r\n }\r\n return measurements;\r\n}\r\nexport function dataSanitizeId(logger, id) {\r\n return id ? dataSanitizeInput(logger, id, 128 /* MAX_ID_LENGTH */, _InternalMessageId.IdTooLong).toString() : id;\r\n}\r\nexport function dataSanitizeInput(logger, input, maxLength, _msgId) {\r\n var inputTrunc;\r\n if (input) {\r\n input = strTrim(input);\r\n if (input.length > maxLength) {\r\n inputTrunc = input.substring(0, maxLength);\r\n logger && logger.throwInternal(LoggingSeverity.WARNING, _msgId, \"input is too long, it has been truncated to \" + maxLength + \" characters.\", { data: input }, true);\r\n }\r\n }\r\n return inputTrunc || input;\r\n}\r\nexport function dsPadNumber(num) {\r\n var s = \"00\" + num;\r\n return s.substr(s.length - 3);\r\n}\r\n/**\r\n * Provides the DataSanitizer functions within the previous namespace.\r\n */\r\nexport var DataSanitizer = {\r\n MAX_NAME_LENGTH: 150 /* MAX_NAME_LENGTH */,\r\n MAX_ID_LENGTH: 128 /* MAX_ID_LENGTH */,\r\n MAX_PROPERTY_LENGTH: 8192 /* MAX_PROPERTY_LENGTH */,\r\n MAX_STRING_LENGTH: 1024 /* MAX_STRING_LENGTH */,\r\n MAX_URL_LENGTH: 2048 /* MAX_URL_LENGTH */,\r\n MAX_MESSAGE_LENGTH: 32768 /* MAX_MESSAGE_LENGTH */,\r\n MAX_EXCEPTION_LENGTH: 32768 /* MAX_EXCEPTION_LENGTH */,\r\n sanitizeKeyAndAddUniqueness: dataSanitizeKeyAndAddUniqueness,\r\n sanitizeKey: dataSanitizeKey,\r\n sanitizeString: dataSanitizeString,\r\n sanitizeUrl: dataSanitizeUrl,\r\n sanitizeMessage: dataSanitizeMessage,\r\n sanitizeException: dataSanitizeException,\r\n sanitizeProperties: dataSanitizeProperties,\r\n sanitizeMeasurements: dataSanitizeMeasurements,\r\n sanitizeId: dataSanitizeId,\r\n sanitizeInput: dataSanitizeInput,\r\n padNumber: dsPadNumber,\r\n trim: strTrim\r\n};\r\n//# sourceMappingURL=DataSanitizer.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\n/**\r\n * Type of the metric data measurement.\r\n */\r\nexport var DataPointType;\r\n(function (DataPointType) {\r\n DataPointType[DataPointType[\"Measurement\"] = 0] = \"Measurement\";\r\n DataPointType[DataPointType[\"Aggregation\"] = 1] = \"Aggregation\";\r\n})(DataPointType || (DataPointType = {}));\r\n//# sourceMappingURL=DataPointType.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { dataSanitizeString } from \"./Telemetry/Common/DataSanitizer\";\r\nimport { objForEachKey, isNullOrUndefined, toISOString } from \"@microsoft/applicationinsights-core-js\";\r\nimport { strNotSpecified, strIkey } from \"./Constants\";\r\nvar TelemetryItemCreator = /** @class */ (function () {\r\n function TelemetryItemCreator() {\r\n }\r\n /**\r\n * Create a telemetry item that the 1DS channel understands\r\n * @param item domain specific properties; part B\r\n * @param baseType telemetry item type. ie PageViewData\r\n * @param envelopeName name of the envelope. ie Microsoft.ApplicationInsights..PageView\r\n * @param customProperties user defined custom properties; part C\r\n * @param systemProperties system properties that are added to the context; part A\r\n * @returns ITelemetryItem that is sent to channel\r\n */\r\n TelemetryItemCreator.create = function (item, baseType, envelopeName, logger, customProperties, systemProperties) {\r\n envelopeName = dataSanitizeString(logger, envelopeName) || strNotSpecified;\r\n if (isNullOrUndefined(item) ||\r\n isNullOrUndefined(baseType) ||\r\n isNullOrUndefined(envelopeName)) {\r\n throw Error(\"Input doesn't contain all required fields\");\r\n }\r\n var iKey = \"\";\r\n if (item[strIkey]) {\r\n iKey = item[strIkey];\r\n delete item[strIkey];\r\n }\r\n var telemetryItem = {\r\n name: envelopeName,\r\n time: toISOString(new Date()),\r\n iKey: iKey,\r\n ext: systemProperties ? systemProperties : {},\r\n tags: [],\r\n data: {},\r\n baseType: baseType,\r\n baseData: item // Part B\r\n };\r\n // Part C\r\n if (!isNullOrUndefined(customProperties)) {\r\n objForEachKey(customProperties, function (prop, value) {\r\n telemetryItem.data[prop] = value;\r\n });\r\n }\r\n return telemetryItem;\r\n };\r\n return TelemetryItemCreator;\r\n}());\r\nexport { TelemetryItemCreator };\r\n//# sourceMappingURL=TelemetryItemCreator.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n/**\r\n * Instances of Event represent structured event records that can be grouped and searched by their properties. Event data item also creates a metric of event count by name.\r\n */\r\nvar EventData = /** @class */ (function () {\r\n function EventData() {\r\n /**\r\n * Schema version\r\n */\r\n this.ver = 2;\r\n /**\r\n * Collection of custom properties.\r\n */\r\n this.properties = {};\r\n /**\r\n * Collection of custom measurements.\r\n */\r\n this.measurements = {};\r\n }\r\n return EventData;\r\n}());\r\nexport { EventData };\r\n//# sourceMappingURL=EventData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport { EventData } from \"../Interfaces/Contracts/Generated/EventData\";\r\nimport { dataSanitizeString, dataSanitizeProperties, dataSanitizeMeasurements } from \"./Common/DataSanitizer\";\r\nimport { strNotSpecified } from \"../Constants\";\r\nvar Event = /** @class */ (function (_super) {\r\n __extends(Event, _super);\r\n /**\r\n * Constructs a new instance of the EventTelemetry object\r\n */\r\n function Event(logger, name, properties, measurements) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n ver: 1 /* Required */,\r\n name: 1 /* Required */,\r\n properties: 0 /* Default */,\r\n measurements: 0 /* Default */\r\n };\r\n _this.name = dataSanitizeString(logger, name) || strNotSpecified;\r\n _this.properties = dataSanitizeProperties(logger, properties);\r\n _this.measurements = dataSanitizeMeasurements(logger, measurements);\r\n return _this;\r\n }\r\n Event.envelopeType = \"Microsoft.ApplicationInsights.{0}.Event\";\r\n Event.dataType = \"EventData\";\r\n return Event;\r\n}(EventData));\r\nexport { Event };\r\n//# sourceMappingURL=Event.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport { MessageData } from \"../Interfaces/Contracts/Generated/MessageData\";\r\nimport { dataSanitizeMessage, dataSanitizeProperties, dataSanitizeMeasurements } from \"./Common/DataSanitizer\";\r\nimport { strNotSpecified } from \"../Constants\";\r\nvar Trace = /** @class */ (function (_super) {\r\n __extends(Trace, _super);\r\n /**\r\n * Constructs a new instance of the TraceTelemetry object\r\n */\r\n function Trace(logger, message, severityLevel, properties, measurements) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n ver: 1 /* Required */,\r\n message: 1 /* Required */,\r\n severityLevel: 0 /* Default */,\r\n properties: 0 /* Default */\r\n };\r\n message = message || strNotSpecified;\r\n _this.message = dataSanitizeMessage(logger, message);\r\n _this.properties = dataSanitizeProperties(logger, properties);\r\n _this.measurements = dataSanitizeMeasurements(logger, measurements);\r\n if (severityLevel) {\r\n _this.severityLevel = severityLevel;\r\n }\r\n return _this;\r\n }\r\n Trace.envelopeType = \"Microsoft.ApplicationInsights.{0}.Message\";\r\n Trace.dataType = \"MessageData\";\r\n return Trace;\r\n}(MessageData));\r\nexport { Trace };\r\n//# sourceMappingURL=Trace.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n/**\r\n * Instances of Message represent printf-like trace statements that are text-searched. Log4Net, NLog and other text-based log file entries are translated into intances of this type. The message does not have measurements.\r\n */\r\nvar MessageData = /** @class */ (function () {\r\n function MessageData() {\r\n /**\r\n * Schema version\r\n */\r\n this.ver = 2;\r\n /**\r\n * Collection of custom properties.\r\n */\r\n this.properties = {};\r\n /**\r\n * Collection of custom measurements.\r\n */\r\n this.measurements = {};\r\n }\r\n return MessageData;\r\n}());\r\nexport { MessageData };\r\n//# sourceMappingURL=MessageData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n/**\r\n * An instance of the Metric item is a list of measurements (single data points) and/or aggregations.\r\n */\r\nvar MetricData = /** @class */ (function () {\r\n function MetricData() {\r\n /**\r\n * Schema version\r\n */\r\n this.ver = 2;\r\n /**\r\n * List of metrics. Only one metric in the list is currently supported by Application Insights storage. If multiple data points were sent only the first one will be used.\r\n */\r\n this.metrics = [];\r\n /**\r\n * Collection of custom properties.\r\n */\r\n this.properties = {};\r\n /**\r\n * Collection of custom measurements.\r\n */\r\n this.measurements = {};\r\n }\r\n return MetricData;\r\n}());\r\nexport { MetricData };\r\n//# sourceMappingURL=MetricData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport { DataPoint as AIDataPoint } from \"../../Interfaces/Contracts/Generated/DataPoint\";\r\nvar DataPoint = /** @class */ (function (_super) {\r\n __extends(DataPoint, _super);\r\n function DataPoint() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * The data contract for serializing this object.\r\n */\r\n _this.aiDataContract = {\r\n name: 1 /* Required */,\r\n kind: 0 /* Default */,\r\n value: 1 /* Required */,\r\n count: 0 /* Default */,\r\n min: 0 /* Default */,\r\n max: 0 /* Default */,\r\n stdDev: 0 /* Default */\r\n };\r\n return _this;\r\n }\r\n return DataPoint;\r\n}(AIDataPoint));\r\nexport { DataPoint };\r\n//# sourceMappingURL=DataPoint.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport { MetricData } from \"../Interfaces/Contracts/Generated/MetricData\";\r\nimport { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString } from \"./Common/DataSanitizer\";\r\nimport { DataPoint } from \"./Common/DataPoint\";\r\nimport { strNotSpecified } from \"../Constants\";\r\nvar Metric = /** @class */ (function (_super) {\r\n __extends(Metric, _super);\r\n /**\r\n * Constructs a new instance of the MetricTelemetry object\r\n */\r\n function Metric(logger, name, value, count, min, max, stdDev, properties, measurements) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n ver: 1 /* Required */,\r\n metrics: 1 /* Required */,\r\n properties: 0 /* Default */\r\n };\r\n var dataPoint = new DataPoint();\r\n dataPoint.count = count > 0 ? count : undefined;\r\n dataPoint.max = isNaN(max) || max === null ? undefined : max;\r\n dataPoint.min = isNaN(min) || min === null ? undefined : min;\r\n dataPoint.name = dataSanitizeString(logger, name) || strNotSpecified;\r\n dataPoint.value = value;\r\n dataPoint.stdDev = isNaN(stdDev) || stdDev === null ? undefined : stdDev;\r\n _this.metrics = [dataPoint];\r\n _this.properties = dataSanitizeProperties(logger, properties);\r\n _this.measurements = dataSanitizeMeasurements(logger, measurements);\r\n return _this;\r\n }\r\n Metric.envelopeType = \"Microsoft.ApplicationInsights.{0}.Metric\";\r\n Metric.dataType = \"MetricData\";\r\n return Metric;\r\n}(MetricData));\r\nexport { Metric };\r\n//# sourceMappingURL=Metric.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\n// THIS FILE WAS AUTOGENERATED\r\nimport { EventData } from \"./EventData\";\r\n/**\r\n * An instance of PageView represents a generic action on a page like a button click. It is also the base type for PageView.\r\n */\r\nvar PageViewData = /** @class */ (function (_super) {\r\n __extends(PageViewData, _super);\r\n function PageViewData() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * Schema version\r\n */\r\n _this.ver = 2;\r\n /**\r\n * Collection of custom properties.\r\n */\r\n _this.properties = {};\r\n /**\r\n * Collection of custom measurements.\r\n */\r\n _this.measurements = {};\r\n return _this;\r\n }\r\n return PageViewData;\r\n}(EventData));\r\nexport { PageViewData };\r\n//# sourceMappingURL=PageViewData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport { PageViewData } from \"../Interfaces/Contracts/Generated/PageViewData\";\r\nimport { dataSanitizeId, dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString, dataSanitizeUrl } from \"./Common/DataSanitizer\";\r\nimport { msToTimeSpan } from \"../HelperFuncs\";\r\nimport { strNotSpecified } from \"../Constants\";\r\nvar PageView = /** @class */ (function (_super) {\r\n __extends(PageView, _super);\r\n /**\r\n * Constructs a new instance of the PageEventTelemetry object\r\n */\r\n function PageView(logger, name, url, durationMs, properties, measurements, id) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n ver: 1 /* Required */,\r\n name: 0 /* Default */,\r\n url: 0 /* Default */,\r\n duration: 0 /* Default */,\r\n properties: 0 /* Default */,\r\n measurements: 0 /* Default */,\r\n id: 0 /* Default */\r\n };\r\n _this.id = dataSanitizeId(logger, id);\r\n _this.url = dataSanitizeUrl(logger, url);\r\n _this.name = dataSanitizeString(logger, name) || strNotSpecified;\r\n if (!isNaN(durationMs)) {\r\n _this.duration = msToTimeSpan(durationMs);\r\n }\r\n _this.properties = dataSanitizeProperties(logger, properties);\r\n _this.measurements = dataSanitizeMeasurements(logger, measurements);\r\n return _this;\r\n }\r\n PageView.envelopeType = \"Microsoft.ApplicationInsights.{0}.Pageview\";\r\n PageView.dataType = \"PageviewData\";\r\n return PageView;\r\n}(PageViewData));\r\nexport { PageView };\r\n//# sourceMappingURL=PageView.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport { PageViewPerfData } from \"../Interfaces/Contracts/Generated/PageViewPerfData\";\r\nimport { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString, dataSanitizeUrl } from \"./Common/DataSanitizer\";\r\nimport { strNotSpecified } from \"../Constants\";\r\nvar PageViewPerformance = /** @class */ (function (_super) {\r\n __extends(PageViewPerformance, _super);\r\n /**\r\n * Constructs a new instance of the PageEventTelemetry object\r\n */\r\n function PageViewPerformance(logger, name, url, unused, properties, measurements, cs4BaseData) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n ver: 1 /* Required */,\r\n name: 0 /* Default */,\r\n url: 0 /* Default */,\r\n duration: 0 /* Default */,\r\n perfTotal: 0 /* Default */,\r\n networkConnect: 0 /* Default */,\r\n sentRequest: 0 /* Default */,\r\n receivedResponse: 0 /* Default */,\r\n domProcessing: 0 /* Default */,\r\n properties: 0 /* Default */,\r\n measurements: 0 /* Default */\r\n };\r\n _this.url = dataSanitizeUrl(logger, url);\r\n _this.name = dataSanitizeString(logger, name) || strNotSpecified;\r\n _this.properties = dataSanitizeProperties(logger, properties);\r\n _this.measurements = dataSanitizeMeasurements(logger, measurements);\r\n if (cs4BaseData) {\r\n _this.domProcessing = cs4BaseData.domProcessing;\r\n _this.duration = cs4BaseData.duration;\r\n _this.networkConnect = cs4BaseData.networkConnect;\r\n _this.perfTotal = cs4BaseData.perfTotal;\r\n _this.receivedResponse = cs4BaseData.receivedResponse;\r\n _this.sentRequest = cs4BaseData.sentRequest;\r\n }\r\n return _this;\r\n }\r\n PageViewPerformance.envelopeType = \"Microsoft.ApplicationInsights.{0}.PageviewPerformance\";\r\n PageViewPerformance.dataType = \"PageviewPerformanceData\";\r\n return PageViewPerformance;\r\n}(PageViewPerfData));\r\nexport { PageViewPerformance };\r\n//# sourceMappingURL=PageViewPerformance.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\n// THIS FILE WAS AUTOGENERATED\r\nimport { PageViewData } from \"./PageViewData\";\r\n/**\r\n * An instance of PageViewPerf represents: a page view with no performance data, a page view with performance data, or just the performance data of an earlier page request.\r\n */\r\nvar PageViewPerfData = /** @class */ (function (_super) {\r\n __extends(PageViewPerfData, _super);\r\n function PageViewPerfData() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * Schema version\r\n */\r\n _this.ver = 2;\r\n /**\r\n * Collection of custom properties.\r\n */\r\n _this.properties = {};\r\n /**\r\n * Collection of custom measurements.\r\n */\r\n _this.measurements = {};\r\n return _this;\r\n }\r\n return PageViewPerfData;\r\n}(PageViewData));\r\nexport { PageViewPerfData };\r\n//# sourceMappingURL=PageViewPerfData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\n/**\r\n * Stack frame information.\r\n */\r\nvar StackFrame = /** @class */ (function () {\r\n function StackFrame() {\r\n }\r\n return StackFrame;\r\n}());\r\nexport { StackFrame };\r\n//# sourceMappingURL=StackFrame.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n/**\r\n * Exception details of the exception in a chain.\r\n */\r\nvar ExceptionDetails = /** @class */ (function () {\r\n function ExceptionDetails() {\r\n /**\r\n * Indicates if full exception stack is provided in the exception. The stack may be trimmed, such as in the case of a StackOverflow exception.\r\n */\r\n this.hasFullStack = true;\r\n /**\r\n * List of stack frames. Either stack or parsedStack should have a value.\r\n */\r\n this.parsedStack = [];\r\n }\r\n return ExceptionDetails;\r\n}());\r\nexport { ExceptionDetails };\r\n//# sourceMappingURL=ExceptionDetails.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __assign, __extends } from \"tslib\";\r\nimport { StackFrame } from \"../Interfaces/Contracts/Generated/StackFrame\";\r\nimport { ExceptionData } from \"../Interfaces/Contracts/Generated/ExceptionData\";\r\nimport { ExceptionDetails } from \"../Interfaces/Contracts/Generated/ExceptionDetails\";\r\nimport { dataSanitizeException, dataSanitizeMeasurements, dataSanitizeMessage, dataSanitizeProperties, dataSanitizeString } from \"./Common/DataSanitizer\";\r\nimport { isNullOrUndefined, arrMap, isString, strTrim, isArray, isError, arrForEach, isObject, isFunction } from \"@microsoft/applicationinsights-core-js\";\r\nimport { strNotSpecified } from \"../Constants\";\r\nvar NoMethod = \"\";\r\nvar strError = \"error\";\r\nvar strStack = \"stack\";\r\nvar strStackDetails = \"stackDetails\";\r\nvar strErrorSrc = \"errorSrc\";\r\nvar strMessage = \"message\";\r\nvar strDescription = \"description\";\r\nfunction _stringify(value, convertToString) {\r\n var result = value;\r\n if (result && !isString(result)) {\r\n if (JSON && JSON.stringify) {\r\n result = JSON.stringify(value);\r\n if (convertToString && (!result || result === \"{}\")) {\r\n if (isFunction(value.toString)) {\r\n result = value.toString();\r\n }\r\n else {\r\n result = \"\" + value;\r\n }\r\n }\r\n }\r\n else {\r\n result = \"\" + value + \" - (Missing JSON.stringify)\";\r\n }\r\n }\r\n return result || \"\";\r\n}\r\nfunction _formatMessage(theEvent, errorType) {\r\n var evtMessage = theEvent;\r\n if (theEvent) {\r\n if (evtMessage && !isString(evtMessage)) {\r\n evtMessage = theEvent[strMessage] || theEvent[strDescription] || evtMessage;\r\n }\r\n // Make sure the message is a string\r\n if (evtMessage && !isString(evtMessage)) {\r\n // tslint:disable-next-line: prefer-conditional-expression\r\n evtMessage = _stringify(evtMessage, true);\r\n }\r\n if (theEvent[\"filename\"]) {\r\n // Looks like an event object with filename\r\n evtMessage = evtMessage + \" @\" + (theEvent[\"filename\"] || \"\") + \":\" + (theEvent[\"lineno\"] || \"?\") + \":\" + (theEvent[\"colno\"] || \"?\");\r\n }\r\n }\r\n // Automatically add the error type to the message if it does already appear to be present\r\n if (errorType && errorType !== \"String\" && errorType !== \"Object\" && errorType !== \"Error\" && (evtMessage || \"\").indexOf(errorType) === -1) {\r\n evtMessage = errorType + \": \" + evtMessage;\r\n }\r\n return evtMessage || \"\";\r\n}\r\nfunction _isExceptionDetailsInternal(value) {\r\n try {\r\n if (isObject(value)) {\r\n return \"hasFullStack\" in value && \"typeName\" in value;\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n return false;\r\n}\r\nfunction _isExceptionInternal(value) {\r\n try {\r\n if (isObject(value)) {\r\n return (\"ver\" in value && \"exceptions\" in value && \"properties\" in value);\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n return false;\r\n}\r\nfunction _isStackDetails(details) {\r\n return details && details.src && isString(details.src) && details.obj && isArray(details.obj);\r\n}\r\nfunction _convertStackObj(errorStack) {\r\n var src = errorStack || \"\";\r\n if (!isString(src)) {\r\n if (isString(src[strStack])) {\r\n src = src[strStack];\r\n }\r\n else {\r\n src = \"\" + src;\r\n }\r\n }\r\n var items = src.split(\"\\n\");\r\n return {\r\n src: src,\r\n obj: items\r\n };\r\n}\r\nfunction _getOperaStack(errorMessage) {\r\n var stack = [];\r\n var lines = errorMessage.split(\"\\n\");\r\n for (var lp = 0; lp < lines.length; lp++) {\r\n var entry = lines[lp];\r\n if (lines[lp + 1]) {\r\n entry += \"@\" + lines[lp + 1];\r\n lp++;\r\n }\r\n stack.push(entry);\r\n }\r\n return {\r\n src: errorMessage,\r\n obj: stack\r\n };\r\n}\r\nfunction _getStackFromErrorObj(errorObj) {\r\n var details = null;\r\n if (errorObj) {\r\n try {\r\n /* Using bracket notation is support older browsers (IE 7/8 -- dont remember the version) that throw when using dot\r\n notation for undefined objects and we don't want to loose the error from being reported */\r\n if (errorObj[strStack]) {\r\n // Chrome/Firefox\r\n details = _convertStackObj(errorObj[strStack]);\r\n }\r\n else if (errorObj[strError] && errorObj[strError][strStack]) {\r\n // Edge error event provides the stack and error object\r\n details = _convertStackObj(errorObj[strError][strStack]);\r\n }\r\n else if (errorObj[\"exception\"] && errorObj.exception[strStack]) {\r\n details = _convertStackObj(errorObj.exception[strStack]);\r\n }\r\n else if (_isStackDetails(errorObj)) {\r\n details = errorObj;\r\n }\r\n else if (_isStackDetails(errorObj[strStackDetails])) {\r\n details = errorObj[strStackDetails];\r\n }\r\n else if (window[\"opera\"] && errorObj[strMessage]) {\r\n // Opera\r\n details = _getOperaStack(errorObj.message);\r\n }\r\n else if (isString(errorObj)) {\r\n details = _convertStackObj(errorObj);\r\n }\r\n else {\r\n var evtMessage = errorObj[strMessage] || errorObj[strDescription] || \"\";\r\n if (isString(errorObj[strErrorSrc])) {\r\n if (evtMessage) {\r\n evtMessage += \"\\n\";\r\n }\r\n evtMessage += \" from \" + errorObj[strErrorSrc];\r\n }\r\n if (evtMessage) {\r\n details = _convertStackObj(evtMessage);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // something unexpected happened so to avoid failing to report any error lets swallow the exception\r\n // and fallback to the callee/caller method\r\n details = _convertStackObj(e);\r\n }\r\n }\r\n return details || {\r\n src: \"\",\r\n obj: null\r\n };\r\n}\r\nfunction _formatStackTrace(stackDetails) {\r\n var stack = \"\";\r\n if (stackDetails) {\r\n if (stackDetails.obj) {\r\n arrForEach(stackDetails.obj, function (entry) {\r\n stack += entry + \"\\n\";\r\n });\r\n }\r\n else {\r\n stack = stackDetails.src || \"\";\r\n }\r\n }\r\n return stack;\r\n}\r\nfunction _parseStack(stack) {\r\n var parsedStack;\r\n var frames = stack.obj;\r\n if (frames && frames.length > 0) {\r\n parsedStack = [];\r\n var level_1 = 0;\r\n var totalSizeInBytes_1 = 0;\r\n arrForEach(frames, function (frame) {\r\n var theFrame = frame.toString();\r\n if (_StackFrame.regex.test(theFrame)) {\r\n var parsedFrame = new _StackFrame(theFrame, level_1++);\r\n totalSizeInBytes_1 += parsedFrame.sizeInBytes;\r\n parsedStack.push(parsedFrame);\r\n }\r\n });\r\n // DP Constraint - exception parsed stack must be < 32KB\r\n // remove frames from the middle to meet the threshold\r\n var exceptionParsedStackThreshold = 32 * 1024;\r\n if (totalSizeInBytes_1 > exceptionParsedStackThreshold) {\r\n var left = 0;\r\n var right = parsedStack.length - 1;\r\n var size = 0;\r\n var acceptedLeft = left;\r\n var acceptedRight = right;\r\n while (left < right) {\r\n // check size\r\n var lSize = parsedStack[left].sizeInBytes;\r\n var rSize = parsedStack[right].sizeInBytes;\r\n size += lSize + rSize;\r\n if (size > exceptionParsedStackThreshold) {\r\n // remove extra frames from the middle\r\n var howMany = acceptedRight - acceptedLeft + 1;\r\n parsedStack.splice(acceptedLeft, howMany);\r\n break;\r\n }\r\n // update pointers\r\n acceptedLeft = left;\r\n acceptedRight = right;\r\n left++;\r\n right--;\r\n }\r\n }\r\n }\r\n return parsedStack;\r\n}\r\nfunction _getErrorType(errorType) {\r\n // Gets the Error Type by passing the constructor (used to get the true type of native error object).\r\n var typeName = \"\";\r\n if (errorType) {\r\n typeName = errorType.typeName || errorType.name || \"\";\r\n if (!typeName) {\r\n try {\r\n var funcNameRegex = /function (.{1,200})\\(/;\r\n var results = (funcNameRegex).exec((errorType).constructor.toString());\r\n typeName = (results && results.length > 1) ? results[1] : \"\";\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty -- Ignoring any failures as nothing we can do\r\n }\r\n }\r\n }\r\n return typeName;\r\n}\r\n/**\r\n * Formats the provided errorObj for display and reporting, it may be a String, Object, integer or undefined depending on the browser.\r\n * @param errorObj The supplied errorObj\r\n */\r\nexport function _formatErrorCode(errorObj) {\r\n if (errorObj) {\r\n try {\r\n if (!isString(errorObj)) {\r\n var errorType = _getErrorType(errorObj);\r\n var result = _stringify(errorObj, false);\r\n if (!result || result === \"{}\") {\r\n if (errorObj[strError]) {\r\n // Looks like an MS Error Event\r\n errorObj = errorObj[strError];\r\n errorType = _getErrorType(errorObj);\r\n }\r\n result = _stringify(errorObj, true);\r\n }\r\n if (result.indexOf(errorType) !== 0 && errorType !== \"String\") {\r\n return errorType + \":\" + result;\r\n }\r\n return result;\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty -- Ignoring any failures as nothing we can do\r\n }\r\n }\r\n // Fallback to just letting the object format itself into a string\r\n return \"\" + (errorObj || \"\");\r\n}\r\nvar Exception = /** @class */ (function (_super) {\r\n __extends(Exception, _super);\r\n /**\r\n * Constructs a new instance of the ExceptionTelemetry object\r\n */\r\n function Exception(logger, exception, properties, measurements, severityLevel, id) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n ver: 1 /* Required */,\r\n exceptions: 1 /* Required */,\r\n severityLevel: 0 /* Default */,\r\n properties: 0 /* Default */,\r\n measurements: 0 /* Default */\r\n };\r\n if (!_isExceptionInternal(exception)) {\r\n if (!properties) {\r\n properties = {};\r\n }\r\n _this.exceptions = [new _ExceptionDetails(logger, exception, properties)];\r\n _this.properties = dataSanitizeProperties(logger, properties);\r\n _this.measurements = dataSanitizeMeasurements(logger, measurements);\r\n if (severityLevel) {\r\n _this.severityLevel = severityLevel;\r\n }\r\n if (id) {\r\n _this.id = id;\r\n }\r\n }\r\n else {\r\n _this.exceptions = exception.exceptions;\r\n _this.properties = exception.properties;\r\n _this.measurements = exception.measurements;\r\n if (exception.severityLevel) {\r\n _this.severityLevel = exception.severityLevel;\r\n }\r\n if (exception.id) {\r\n _this.id = exception.id;\r\n }\r\n if (exception.problemGroup) {\r\n _this.problemGroup = exception.problemGroup;\r\n }\r\n // bool/int types, use isNullOrUndefined\r\n _this.ver = 2; // TODO: handle the CS\"4.0\" ==> breeze 2 conversion in a better way\r\n if (!isNullOrUndefined(exception.isManual)) {\r\n _this.isManual = exception.isManual;\r\n }\r\n }\r\n return _this;\r\n }\r\n Exception.CreateAutoException = function (message, url, lineNumber, columnNumber, error, evt, stack, errorSrc) {\r\n var errorType = _getErrorType(error || evt || message);\r\n return {\r\n message: _formatMessage(message, errorType),\r\n url: url,\r\n lineNumber: lineNumber,\r\n columnNumber: columnNumber,\r\n error: _formatErrorCode(error || evt || message),\r\n evt: _formatErrorCode(evt || message),\r\n typeName: errorType,\r\n stackDetails: _getStackFromErrorObj(stack || error || evt),\r\n errorSrc: errorSrc\r\n };\r\n };\r\n Exception.CreateFromInterface = function (logger, exception, properties, measurements) {\r\n var exceptions = exception.exceptions\r\n && arrMap(exception.exceptions, function (ex) { return _ExceptionDetails.CreateFromInterface(logger, ex); });\r\n var exceptionData = new Exception(logger, __assign(__assign({}, exception), { exceptions: exceptions }), properties, measurements);\r\n return exceptionData;\r\n };\r\n Exception.prototype.toInterface = function () {\r\n var _a = this, exceptions = _a.exceptions, properties = _a.properties, measurements = _a.measurements, severityLevel = _a.severityLevel, ver = _a.ver, problemGroup = _a.problemGroup, id = _a.id, isManual = _a.isManual;\r\n var exceptionDetailsInterface = exceptions instanceof Array\r\n && arrMap(exceptions, function (exception) { return exception.toInterface(); })\r\n || undefined;\r\n return {\r\n ver: \"4.0\",\r\n exceptions: exceptionDetailsInterface,\r\n severityLevel: severityLevel,\r\n properties: properties,\r\n measurements: measurements,\r\n problemGroup: problemGroup,\r\n id: id,\r\n isManual: isManual\r\n };\r\n };\r\n /**\r\n * Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.\r\n */\r\n Exception.CreateSimpleException = function (message, typeName, assembly, fileName, details, line) {\r\n return {\r\n exceptions: [\r\n {\r\n hasFullStack: true,\r\n message: message,\r\n stack: details,\r\n typeName: typeName\r\n }\r\n ]\r\n };\r\n };\r\n Exception.envelopeType = \"Microsoft.ApplicationInsights.{0}.Exception\";\r\n Exception.dataType = \"ExceptionData\";\r\n Exception.formatError = _formatErrorCode;\r\n return Exception;\r\n}(ExceptionData));\r\nexport { Exception };\r\nvar _ExceptionDetails = /** @class */ (function (_super) {\r\n __extends(_ExceptionDetails, _super);\r\n function _ExceptionDetails(logger, exception, properties) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n id: 0 /* Default */,\r\n outerId: 0 /* Default */,\r\n typeName: 1 /* Required */,\r\n message: 1 /* Required */,\r\n hasFullStack: 0 /* Default */,\r\n stack: 0 /* Default */,\r\n parsedStack: 2 /* Array */\r\n };\r\n if (!_isExceptionDetailsInternal(exception)) {\r\n var error = exception;\r\n var evt = error && error.evt;\r\n if (!isError(error)) {\r\n error = error[strError] || evt || error;\r\n }\r\n _this.typeName = dataSanitizeString(logger, _getErrorType(error)) || strNotSpecified;\r\n _this.message = dataSanitizeMessage(logger, _formatMessage(exception || error, _this.typeName)) || strNotSpecified;\r\n var stack = exception[strStackDetails] || _getStackFromErrorObj(exception);\r\n _this.parsedStack = _parseStack(stack);\r\n _this[strStack] = dataSanitizeException(logger, _formatStackTrace(stack));\r\n _this.hasFullStack = isArray(_this.parsedStack) && _this.parsedStack.length > 0;\r\n if (properties) {\r\n properties.typeName = properties.typeName || _this.typeName;\r\n }\r\n }\r\n else {\r\n _this.typeName = exception.typeName;\r\n _this.message = exception.message;\r\n _this[strStack] = exception[strStack];\r\n _this.parsedStack = exception.parsedStack;\r\n _this.hasFullStack = exception.hasFullStack;\r\n }\r\n return _this;\r\n }\r\n _ExceptionDetails.prototype.toInterface = function () {\r\n var parsedStack = this.parsedStack instanceof Array\r\n && arrMap(this.parsedStack, function (frame) { return frame.toInterface(); });\r\n var exceptionDetailsInterface = {\r\n id: this.id,\r\n outerId: this.outerId,\r\n typeName: this.typeName,\r\n message: this.message,\r\n hasFullStack: this.hasFullStack,\r\n stack: this[strStack],\r\n parsedStack: parsedStack || undefined\r\n };\r\n return exceptionDetailsInterface;\r\n };\r\n _ExceptionDetails.CreateFromInterface = function (logger, exception) {\r\n var parsedStack = (exception.parsedStack instanceof Array\r\n && arrMap(exception.parsedStack, function (frame) { return _StackFrame.CreateFromInterface(frame); }))\r\n || exception.parsedStack;\r\n var exceptionDetails = new _ExceptionDetails(logger, __assign(__assign({}, exception), { parsedStack: parsedStack }));\r\n return exceptionDetails;\r\n };\r\n return _ExceptionDetails;\r\n}(ExceptionDetails));\r\nexport { _ExceptionDetails };\r\nvar _StackFrame = /** @class */ (function (_super) {\r\n __extends(_StackFrame, _super);\r\n function _StackFrame(sourceFrame, level) {\r\n var _this = _super.call(this) || this;\r\n _this.sizeInBytes = 0;\r\n _this.aiDataContract = {\r\n level: 1 /* Required */,\r\n method: 1 /* Required */,\r\n assembly: 0 /* Default */,\r\n fileName: 0 /* Default */,\r\n line: 0 /* Default */\r\n };\r\n // Not converting this to isString() as typescript uses this logic to \"understand\" the different\r\n // types for the 2 different code paths\r\n if (typeof sourceFrame === \"string\") {\r\n var frame = sourceFrame;\r\n _this.level = level;\r\n _this.method = NoMethod;\r\n _this.assembly = strTrim(frame);\r\n _this.fileName = \"\";\r\n _this.line = 0;\r\n var matches = frame.match(_StackFrame.regex);\r\n if (matches && matches.length >= 5) {\r\n _this.method = strTrim(matches[2]) || _this.method;\r\n _this.fileName = strTrim(matches[4]);\r\n _this.line = parseInt(matches[5]) || 0;\r\n }\r\n }\r\n else {\r\n _this.level = sourceFrame.level;\r\n _this.method = sourceFrame.method;\r\n _this.assembly = sourceFrame.assembly;\r\n _this.fileName = sourceFrame.fileName;\r\n _this.line = sourceFrame.line;\r\n _this.sizeInBytes = 0;\r\n }\r\n _this.sizeInBytes += _this.method.length;\r\n _this.sizeInBytes += _this.fileName.length;\r\n _this.sizeInBytes += _this.assembly.length;\r\n // todo: these might need to be removed depending on how the back-end settles on their size calculation\r\n _this.sizeInBytes += _StackFrame.baseSize;\r\n _this.sizeInBytes += _this.level.toString().length;\r\n _this.sizeInBytes += _this.line.toString().length;\r\n return _this;\r\n }\r\n _StackFrame.CreateFromInterface = function (frame) {\r\n return new _StackFrame(frame, null /* level is available in frame interface */);\r\n };\r\n _StackFrame.prototype.toInterface = function () {\r\n return {\r\n level: this.level,\r\n method: this.method,\r\n assembly: this.assembly,\r\n fileName: this.fileName,\r\n line: this.line\r\n };\r\n };\r\n // regex to match stack frames from ie/chrome/ff\r\n // methodName=$2, fileName=$4, lineNo=$5, column=$6\r\n _StackFrame.regex = /^([\\s]+at)?[\\s]{0,50}([^\\@\\()]+?)[\\s]{0,50}(\\@|\\()([^\\(\\n]+):([0-9]+):([0-9]+)(\\)?)$/;\r\n _StackFrame.baseSize = 58; // '{\"method\":\"\",\"level\":,\"assembly\":\"\",\"fileName\":\"\",\"line\":}'.length\r\n return _StackFrame;\r\n}(StackFrame));\r\nexport { _StackFrame };\r\n//# sourceMappingURL=Exception.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\n/**\r\n * Defines the level of severity for the event.\r\n */\r\nexport var SeverityLevel;\r\n(function (SeverityLevel) {\r\n SeverityLevel[SeverityLevel[\"Verbose\"] = 0] = \"Verbose\";\r\n SeverityLevel[SeverityLevel[\"Information\"] = 1] = \"Information\";\r\n SeverityLevel[SeverityLevel[\"Warning\"] = 2] = \"Warning\";\r\n SeverityLevel[SeverityLevel[\"Error\"] = 3] = \"Error\";\r\n SeverityLevel[SeverityLevel[\"Critical\"] = 4] = \"Critical\";\r\n})(SeverityLevel || (SeverityLevel = {}));\r\n//# sourceMappingURL=SeverityLevel.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n/**\r\n * Type of storage to differentiate between local storage and session storage\r\n */\r\nexport var StorageType;\r\n(function (StorageType) {\r\n StorageType[StorageType[\"LocalStorage\"] = 0] = \"LocalStorage\";\r\n StorageType[StorageType[\"SessionStorage\"] = 1] = \"SessionStorage\";\r\n})(StorageType || (StorageType = {}));\r\nexport var DistributedTracingModes;\r\n(function (DistributedTracingModes) {\r\n /**\r\n * (Default) Send Application Insights correlation headers\r\n */\r\n DistributedTracingModes[DistributedTracingModes[\"AI\"] = 0] = \"AI\";\r\n /**\r\n * Send both W3C Trace Context headers and back-compatibility Application Insights headers\r\n */\r\n DistributedTracingModes[DistributedTracingModes[\"AI_AND_W3C\"] = 1] = \"AI_AND_W3C\";\r\n /**\r\n * Send W3C Trace Context headers\r\n */\r\n DistributedTracingModes[DistributedTracingModes[\"W3C\"] = 2] = \"W3C\";\r\n})(DistributedTracingModes || (DistributedTracingModes = {}));\r\n//# sourceMappingURL=Enums.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n/**\r\n * An instance of Exception represents a handled or unhandled exception that occurred during execution of the monitored application.\r\n */\r\nvar ExceptionData = /** @class */ (function () {\r\n function ExceptionData() {\r\n /**\r\n * Schema version\r\n */\r\n this.ver = 2;\r\n /**\r\n * Exception chain - list of inner exceptions.\r\n */\r\n this.exceptions = [];\r\n /**\r\n * Collection of custom properties.\r\n */\r\n this.properties = {};\r\n /**\r\n * Collection of custom measurements.\r\n */\r\n this.measurements = {};\r\n }\r\n return ExceptionData;\r\n}());\r\nexport { ExceptionData };\r\n//# sourceMappingURL=ExceptionData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { dumpObj, getExceptionName, getGlobal, getGlobalInst, isNullOrUndefined, LoggingSeverity, objForEachKey, _InternalMessageId } from \"@microsoft/applicationinsights-core-js\";\r\nimport { StorageType } from \"./Enums\";\r\nvar _canUseLocalStorage = undefined;\r\nvar _canUseSessionStorage = undefined;\r\n/**\r\n * Gets the localStorage object if available\r\n * @return {Storage} - Returns the storage object if available else returns null\r\n */\r\nfunction _getLocalStorageObject() {\r\n if (utlCanUseLocalStorage()) {\r\n return _getVerifiedStorageObject(StorageType.LocalStorage);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Tests storage object (localStorage or sessionStorage) to verify that it is usable\r\n * More details here: https://mathiasbynens.be/notes/localstorage-pattern\r\n * @param storageType Type of storage\r\n * @return {Storage} Returns storage object verified that it is usable\r\n */\r\nfunction _getVerifiedStorageObject(storageType) {\r\n try {\r\n if (isNullOrUndefined(getGlobal())) {\r\n return null;\r\n }\r\n var uid = new Date;\r\n var storage = getGlobalInst(storageType === StorageType.LocalStorage ? \"localStorage\" : \"sessionStorage\");\r\n storage.setItem(uid.toString(), uid.toString());\r\n var fail = storage.getItem(uid.toString()) !== uid.toString();\r\n storage.removeItem(uid.toString());\r\n if (!fail) {\r\n return storage;\r\n }\r\n }\r\n catch (exception) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return null;\r\n}\r\n/**\r\n * Gets the sessionStorage object if available\r\n * @return {Storage} - Returns the storage object if available else returns null\r\n */\r\nfunction _getSessionStorageObject() {\r\n if (utlCanUseSessionStorage()) {\r\n return _getVerifiedStorageObject(StorageType.SessionStorage);\r\n }\r\n return null;\r\n}\r\nexport function utlDisableStorage() {\r\n _canUseLocalStorage = false;\r\n _canUseSessionStorage = false;\r\n}\r\nexport function utlCanUseLocalStorage() {\r\n if (_canUseLocalStorage === undefined) {\r\n _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);\r\n }\r\n return _canUseLocalStorage;\r\n}\r\nexport function utlGetLocalStorage(logger, name) {\r\n var storage = _getLocalStorageObject();\r\n if (storage !== null) {\r\n try {\r\n return storage.getItem(name);\r\n }\r\n catch (e) {\r\n _canUseLocalStorage = false;\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadLocalStorage, \"Browser failed read of local storage. \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return null;\r\n}\r\nexport function utlSetLocalStorage(logger, name, data) {\r\n var storage = _getLocalStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage.setItem(name, data);\r\n return true;\r\n }\r\n catch (e) {\r\n _canUseLocalStorage = false;\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteLocalStorage, \"Browser failed write to local storage. \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return false;\r\n}\r\nexport function utlRemoveStorage(logger, name) {\r\n var storage = _getLocalStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage.removeItem(name);\r\n return true;\r\n }\r\n catch (e) {\r\n _canUseLocalStorage = false;\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromLocalStorage, \"Browser failed removal of local storage item. \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return false;\r\n}\r\nexport function utlCanUseSessionStorage() {\r\n if (_canUseSessionStorage === undefined) {\r\n _canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);\r\n }\r\n return _canUseSessionStorage;\r\n}\r\nexport function utlGetSessionStorageKeys() {\r\n var keys = [];\r\n if (utlCanUseSessionStorage()) {\r\n objForEachKey(getGlobalInst(\"sessionStorage\"), function (key) {\r\n keys.push(key);\r\n });\r\n }\r\n return keys;\r\n}\r\nexport function utlGetSessionStorage(logger, name) {\r\n var storage = _getSessionStorageObject();\r\n if (storage !== null) {\r\n try {\r\n return storage.getItem(name);\r\n }\r\n catch (e) {\r\n _canUseSessionStorage = false;\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadSessionStorage, \"Browser failed read of session storage. \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return null;\r\n}\r\nexport function utlSetSessionStorage(logger, name, data) {\r\n var storage = _getSessionStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage.setItem(name, data);\r\n return true;\r\n }\r\n catch (e) {\r\n _canUseSessionStorage = false;\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteSessionStorage, \"Browser failed write to session storage. \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return false;\r\n}\r\nexport function utlRemoveSessionStorage(logger, name) {\r\n var storage = _getSessionStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage.removeItem(name);\r\n return true;\r\n }\r\n catch (e) {\r\n _canUseSessionStorage = false;\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromSessionStorage, \"Browser failed removal of session storage item. \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return false;\r\n}\r\n//# sourceMappingURL=StorageHelperFuncs.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { isFunction, getDocument } from \"@microsoft/applicationinsights-core-js\";\r\nexport function createDomEvent(eventName) {\r\n var event = null;\r\n if (isFunction(Event)) { // Use Event constructor when available\r\n event = new Event(eventName);\r\n }\r\n else { // Event has no constructor in IE\r\n var doc = getDocument();\r\n if (doc && doc.createEvent) {\r\n event = doc.createEvent(\"Event\");\r\n event.initEvent(eventName, true, true);\r\n }\r\n }\r\n return event;\r\n}\r\n//# sourceMappingURL=DomHelperFuncs.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport var RequestHeaders = {\r\n requestContextHeader: \"Request-Context\",\r\n requestContextTargetKey: \"appId\",\r\n requestContextAppIdFormat: \"appId=cid-v1:\",\r\n requestIdHeader: \"Request-Id\",\r\n traceParentHeader: \"traceparent\",\r\n traceStateHeader: \"tracestate\",\r\n sdkContextHeader: \"Sdk-Context\",\r\n sdkContextHeaderAppIdRequest: \"appId\",\r\n requestContextHeaderLowerCase: \"request-context\"\r\n};\r\n//# sourceMappingURL=RequestResponseHeaders.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { getDocument, isString } from \"@microsoft/applicationinsights-core-js\";\r\nvar _document = getDocument() || {};\r\nvar _htmlAnchorIdx = 0;\r\n// Use an array of temporary values as it's possible for multiple calls to parseUrl() will be called with different URLs\r\n// Using a cache size of 5 for now as it current depth usage is at least 2, so adding a minor buffer to handle future updates\r\nvar _htmlAnchorElement = [null, null, null, null, null];\r\nexport function urlParseUrl(url) {\r\n var anchorIdx = _htmlAnchorIdx;\r\n var anchorCache = _htmlAnchorElement;\r\n var tempAnchor = anchorCache[anchorIdx];\r\n if (!_document.createElement) {\r\n // Always create the temp instance if createElement is not available\r\n tempAnchor = { host: urlParseHost(url, true) };\r\n }\r\n else if (!anchorCache[anchorIdx]) {\r\n // Create and cache the unattached anchor instance\r\n tempAnchor = anchorCache[anchorIdx] = _document.createElement(\"a\");\r\n }\r\n tempAnchor.href = url;\r\n // Move the cache index forward\r\n anchorIdx++;\r\n if (anchorIdx >= anchorCache.length) {\r\n anchorIdx = 0;\r\n }\r\n _htmlAnchorIdx = anchorIdx;\r\n return tempAnchor;\r\n}\r\nexport function urlGetAbsoluteUrl(url) {\r\n var result;\r\n var a = urlParseUrl(url);\r\n if (a) {\r\n result = a.href;\r\n }\r\n return result;\r\n}\r\nexport function urlGetPathName(url) {\r\n var result;\r\n var a = urlParseUrl(url);\r\n if (a) {\r\n result = a.pathname;\r\n }\r\n return result;\r\n}\r\nexport function urlGetCompleteUrl(method, absoluteUrl) {\r\n if (method) {\r\n return method.toUpperCase() + \" \" + absoluteUrl;\r\n }\r\n return absoluteUrl;\r\n}\r\n// Fallback method to grab host from url if document.createElement method is not available\r\nexport function urlParseHost(url, inclPort) {\r\n var fullHost = urlParseFullHost(url, inclPort) || \"\";\r\n if (fullHost) {\r\n var match = fullHost.match(/(www[0-9]?\\.)?(.[^/:]+)(\\:[\\d]+)?/i);\r\n if (match != null && match.length > 3 && isString(match[2]) && match[2].length > 0) {\r\n return match[2] + (match[3] || \"\");\r\n }\r\n }\r\n return fullHost;\r\n}\r\nexport function urlParseFullHost(url, inclPort) {\r\n var result = null;\r\n if (url) {\r\n var match = url.match(/(\\w*):\\/\\/(.[^/:]+)(\\:[\\d]+)?/i);\r\n if (match != null && match.length > 2 && isString(match[2]) && match[2].length > 0) {\r\n result = match[2] || \"\";\r\n if (inclPort && match.length > 2) {\r\n var protocol = (match[1] || \"\").toLowerCase();\r\n var port = match[3] || \"\";\r\n // IE includes the standard port so pass it off if it's the same as the protocol\r\n if (protocol === \"http\" && port === \":80\") {\r\n port = \"\";\r\n }\r\n else if (protocol === \"https\" && port === \":443\") {\r\n port = \"\";\r\n }\r\n result += port;\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=UrlHelperFuncs.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { getPerformance, getExceptionName as coreGetExceptionName, dumpObj, isNullOrUndefined, strTrim, random32, isArray, isError, isDate, newId, generateW3CId, toISOString, arrForEach, getIEVersion, attachEvent, dateNow, uaDisallowsSameSiteNone, disableCookies as coreDisableCookies, canUseCookies as coreCanUseCookies, getCookie as coreGetCookie, setCookie as coreSetCookie, deleteCookie as coreDeleteCookie, isBeaconsSupported } from \"@microsoft/applicationinsights-core-js\";\r\nimport { RequestHeaders } from \"./RequestResponseHeaders\";\r\nimport { dataSanitizeString } from \"./Telemetry/Common/DataSanitizer\";\r\nimport { createDomEvent } from \"./DomHelperFuncs\";\r\nimport { stringToBoolOrDefault, msToTimeSpan, isCrossOriginError, getExtensionByName } from \"./HelperFuncs\";\r\nimport { strNotSpecified } from \"./Constants\";\r\nimport { utlCanUseLocalStorage, utlCanUseSessionStorage, utlDisableStorage, utlGetSessionStorage, utlGetSessionStorageKeys, utlGetLocalStorage, utlRemoveSessionStorage, utlRemoveStorage, utlSetSessionStorage, utlSetLocalStorage } from \"./StorageHelperFuncs\";\r\nimport { urlGetAbsoluteUrl, urlGetCompleteUrl, urlGetPathName, urlParseFullHost, urlParseHost, urlParseUrl } from \"./UrlHelperFuncs\";\r\n// listing only non-geo specific locations\r\nvar _internalEndpoints = [\r\n \"https://dc.services.visualstudio.com/v2/track\",\r\n \"https://breeze.aimon.applicationinsights.io/v2/track\",\r\n \"https://dc-int.services.visualstudio.com/v2/track\"\r\n];\r\nexport function isInternalApplicationInsightsEndpoint(endpointUrl) {\r\n return _internalEndpoints.indexOf(endpointUrl.toLowerCase()) !== -1;\r\n}\r\nexport var Util = {\r\n NotSpecified: strNotSpecified,\r\n createDomEvent: createDomEvent,\r\n disableStorage: utlDisableStorage,\r\n isInternalApplicationInsightsEndpoint: isInternalApplicationInsightsEndpoint,\r\n canUseLocalStorage: utlCanUseLocalStorage,\r\n getStorage: utlGetLocalStorage,\r\n setStorage: utlSetLocalStorage,\r\n removeStorage: utlRemoveStorage,\r\n canUseSessionStorage: utlCanUseSessionStorage,\r\n getSessionStorageKeys: utlGetSessionStorageKeys,\r\n getSessionStorage: utlGetSessionStorage,\r\n setSessionStorage: utlSetSessionStorage,\r\n removeSessionStorage: utlRemoveSessionStorage,\r\n disableCookies: coreDisableCookies,\r\n canUseCookies: coreCanUseCookies,\r\n disallowsSameSiteNone: uaDisallowsSameSiteNone,\r\n setCookie: coreSetCookie,\r\n stringToBoolOrDefault: stringToBoolOrDefault,\r\n getCookie: coreGetCookie,\r\n deleteCookie: coreDeleteCookie,\r\n trim: strTrim,\r\n newId: newId,\r\n random32: function () {\r\n return random32(true);\r\n },\r\n generateW3CId: generateW3CId,\r\n isArray: isArray,\r\n isError: isError,\r\n isDate: isDate,\r\n toISOStringForIE8: toISOString,\r\n getIEVersion: getIEVersion,\r\n msToTimeSpan: msToTimeSpan,\r\n isCrossOriginError: isCrossOriginError,\r\n dump: dumpObj,\r\n getExceptionName: coreGetExceptionName,\r\n addEventHandler: attachEvent,\r\n IsBeaconApiSupported: isBeaconsSupported,\r\n getExtension: getExtensionByName\r\n};\r\nexport var UrlHelper = {\r\n parseUrl: urlParseUrl,\r\n getAbsoluteUrl: urlGetAbsoluteUrl,\r\n getPathName: urlGetPathName,\r\n getCompleteUrl: urlGetCompleteUrl,\r\n parseHost: urlParseHost,\r\n parseFullHost: urlParseFullHost\r\n};\r\nexport var CorrelationIdHelper = {\r\n correlationIdPrefix: \"cid-v1:\",\r\n /**\r\n * Checks if a request url is not on a excluded domain list and if it is safe to add correlation headers.\r\n * Headers are always included if the current domain matches the request domain. If they do not match (CORS),\r\n * they are regex-ed across correlationHeaderDomains and correlationHeaderExcludedDomains to determine if headers are included.\r\n * Some environments don't give information on currentHost via window.location.host (e.g. Cordova). In these cases, the user must\r\n * manually supply domains to include correlation headers on. Else, no headers will be included at all.\r\n */\r\n canIncludeCorrelationHeader: function (config, requestUrl, currentHost) {\r\n if (!requestUrl || (config && config.disableCorrelationHeaders)) {\r\n return false;\r\n }\r\n if (config && config.correlationHeaderExcludePatterns) {\r\n for (var i = 0; i < config.correlationHeaderExcludePatterns.length; i++) {\r\n if (config.correlationHeaderExcludePatterns[i].test(requestUrl)) {\r\n return false;\r\n }\r\n }\r\n }\r\n var requestHost = urlParseUrl(requestUrl).host.toLowerCase();\r\n if (requestHost && (requestHost.indexOf(\":443\") !== -1 || requestHost.indexOf(\":80\") !== -1)) {\r\n // [Bug #1260] IE can include the port even for http and https URLs so if present\r\n // try and parse it to remove if it matches the default protocol port\r\n requestHost = (urlParseFullHost(requestUrl, true) || \"\").toLowerCase();\r\n }\r\n if ((!config || !config.enableCorsCorrelation) && (requestHost && requestHost !== currentHost)) {\r\n return false;\r\n }\r\n var includedDomains = config && config.correlationHeaderDomains;\r\n if (includedDomains) {\r\n var matchExists_1;\r\n arrForEach(includedDomains, function (domain) {\r\n var regex = new RegExp(domain.toLowerCase().replace(/\\\\/g, \"\\\\\\\\\").replace(/\\./g, \"\\\\.\").replace(/\\*/g, \".*\"));\r\n matchExists_1 = matchExists_1 || regex.test(requestHost);\r\n });\r\n if (!matchExists_1) {\r\n return false;\r\n }\r\n }\r\n var excludedDomains = config && config.correlationHeaderExcludedDomains;\r\n if (!excludedDomains || excludedDomains.length === 0) {\r\n return true;\r\n }\r\n for (var i = 0; i < excludedDomains.length; i++) {\r\n var regex = new RegExp(excludedDomains[i].toLowerCase().replace(/\\\\/g, \"\\\\\\\\\").replace(/\\./g, \"\\\\.\").replace(/\\*/g, \".*\"));\r\n if (regex.test(requestHost)) {\r\n return false;\r\n }\r\n }\r\n // if we don't know anything about the requestHost, require the user to use included/excludedDomains.\r\n // Previously we always returned false for a falsy requestHost\r\n return requestHost && requestHost.length > 0;\r\n },\r\n /**\r\n * Combines target appId and target role name from response header.\r\n */\r\n getCorrelationContext: function (responseHeader) {\r\n if (responseHeader) {\r\n var correlationId = CorrelationIdHelper.getCorrelationContextValue(responseHeader, RequestHeaders.requestContextTargetKey);\r\n if (correlationId && correlationId !== CorrelationIdHelper.correlationIdPrefix) {\r\n return correlationId;\r\n }\r\n }\r\n },\r\n /**\r\n * Gets key from correlation response header\r\n */\r\n getCorrelationContextValue: function (responseHeader, key) {\r\n if (responseHeader) {\r\n var keyValues = responseHeader.split(\",\");\r\n for (var i = 0; i < keyValues.length; ++i) {\r\n var keyValue = keyValues[i].split(\"=\");\r\n if (keyValue.length === 2 && keyValue[0] === key) {\r\n return keyValue[1];\r\n }\r\n }\r\n }\r\n }\r\n};\r\nexport function AjaxHelperParseDependencyPath(logger, absoluteUrl, method, commandName) {\r\n var target, name = commandName, data = commandName;\r\n if (absoluteUrl && absoluteUrl.length > 0) {\r\n var parsedUrl = urlParseUrl(absoluteUrl);\r\n target = parsedUrl.host;\r\n if (!name) {\r\n if (parsedUrl.pathname != null) {\r\n var pathName = (parsedUrl.pathname.length === 0) ? \"/\" : parsedUrl.pathname;\r\n if (pathName.charAt(0) !== \"/\") {\r\n pathName = \"/\" + pathName;\r\n }\r\n data = parsedUrl.pathname;\r\n name = dataSanitizeString(logger, method ? method + \" \" + pathName : pathName);\r\n }\r\n else {\r\n name = dataSanitizeString(logger, absoluteUrl);\r\n }\r\n }\r\n }\r\n else {\r\n target = commandName;\r\n name = commandName;\r\n }\r\n return {\r\n target: target,\r\n name: name,\r\n data: data\r\n };\r\n}\r\nexport function dateTimeUtilsNow() {\r\n // returns the window or webworker performance object\r\n var perf = getPerformance();\r\n if (perf && perf.now && perf.timing) {\r\n var now = perf.now() + perf.timing.navigationStart;\r\n // Known issue with IE where this calculation can be negative, so if it is then ignore and fallback\r\n if (now > 0) {\r\n return now;\r\n }\r\n }\r\n return dateNow();\r\n}\r\nexport function dateTimeUtilsDuration(start, end) {\r\n var result = null;\r\n if (start !== 0 && end !== 0 && !isNullOrUndefined(start) && !isNullOrUndefined(end)) {\r\n result = end - start;\r\n }\r\n return result;\r\n}\r\n/**\r\n * A utility class that helps getting time related parameters\r\n */\r\nexport var DateTimeUtils = {\r\n Now: dateTimeUtilsNow,\r\n GetDuration: dateTimeUtilsDuration\r\n};\r\n//# sourceMappingURL=Util.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString, dataSanitizeUrl } from \"./Common/DataSanitizer\";\r\nimport { AjaxHelperParseDependencyPath } from \"../Util\";\r\nimport { RemoteDependencyData as GeneratedRemoteDependencyData } from \"../Interfaces/Contracts/Generated/RemoteDependencyData\";\r\nimport { msToTimeSpan } from \"../HelperFuncs\";\r\nvar RemoteDependencyData = /** @class */ (function (_super) {\r\n __extends(RemoteDependencyData, _super);\r\n /**\r\n * Constructs a new instance of the RemoteDependencyData object\r\n */\r\n function RemoteDependencyData(logger, id, absoluteUrl, commandName, value, success, resultCode, method, requestAPI, correlationContext, properties, measurements) {\r\n if (requestAPI === void 0) { requestAPI = \"Ajax\"; }\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n id: 1 /* Required */,\r\n ver: 1 /* Required */,\r\n name: 0 /* Default */,\r\n resultCode: 0 /* Default */,\r\n duration: 0 /* Default */,\r\n success: 0 /* Default */,\r\n data: 0 /* Default */,\r\n target: 0 /* Default */,\r\n type: 0 /* Default */,\r\n properties: 0 /* Default */,\r\n measurements: 0 /* Default */,\r\n kind: 0 /* Default */,\r\n value: 0 /* Default */,\r\n count: 0 /* Default */,\r\n min: 0 /* Default */,\r\n max: 0 /* Default */,\r\n stdDev: 0 /* Default */,\r\n dependencyKind: 0 /* Default */,\r\n dependencySource: 0 /* Default */,\r\n commandName: 0 /* Default */,\r\n dependencyTypeName: 0 /* Default */\r\n };\r\n _this.id = id;\r\n _this.duration = msToTimeSpan(value);\r\n _this.success = success;\r\n _this.resultCode = resultCode + \"\";\r\n _this.type = dataSanitizeString(logger, requestAPI);\r\n var dependencyFields = AjaxHelperParseDependencyPath(logger, absoluteUrl, method, commandName);\r\n _this.data = dataSanitizeUrl(logger, commandName) || dependencyFields.data; // get a value from hosturl if commandName not available\r\n _this.target = dataSanitizeString(logger, dependencyFields.target);\r\n if (correlationContext) {\r\n _this.target = _this.target + \" | \" + correlationContext;\r\n }\r\n _this.name = dataSanitizeString(logger, dependencyFields.name);\r\n _this.properties = dataSanitizeProperties(logger, properties);\r\n _this.measurements = dataSanitizeMeasurements(logger, measurements);\r\n return _this;\r\n }\r\n RemoteDependencyData.envelopeType = \"Microsoft.ApplicationInsights.{0}.RemoteDependency\";\r\n RemoteDependencyData.dataType = \"RemoteDependencyData\";\r\n return RemoteDependencyData;\r\n}(GeneratedRemoteDependencyData));\r\nexport { RemoteDependencyData };\r\n//# sourceMappingURL=RemoteDependencyData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { dateTimeUtilsDuration } from \"@microsoft/applicationinsights-common\";\r\nimport { LoggingSeverity, _InternalMessageId, getDocument, getLocation, arrForEach, isNullOrUndefined, getExceptionName, dumpObj } from \"@microsoft/applicationinsights-core-js\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\n/**\r\n * Class encapsulates sending page views and page view performance telemetry.\r\n */\r\nvar PageViewManager = /** @class */ (function () {\r\n function PageViewManager(appInsights, overridePageViewDuration, core, pageViewPerformanceManager) {\r\n dynamicProto(PageViewManager, this, function (_self) {\r\n var intervalHandle = null;\r\n var itemQueue = [];\r\n var pageViewPerformanceSent = false;\r\n var _logger;\r\n if (core) {\r\n _logger = core.logger;\r\n }\r\n function _flushChannels() {\r\n if (core) {\r\n arrForEach(core.getTransmissionControls(), function (queues) {\r\n arrForEach(queues, function (q) { return q.flush(true); });\r\n });\r\n }\r\n }\r\n function _addQueue(cb) {\r\n itemQueue.push(cb);\r\n if (!intervalHandle) {\r\n intervalHandle = setInterval((function () {\r\n var allItems = itemQueue.slice(0);\r\n var doFlush = false;\r\n itemQueue = [];\r\n arrForEach(allItems, function (item) {\r\n if (!item()) {\r\n // Not processed so rescheduled\r\n itemQueue.push(item);\r\n }\r\n else {\r\n doFlush = true;\r\n }\r\n });\r\n if (itemQueue.length === 0) {\r\n clearInterval(intervalHandle);\r\n intervalHandle = null;\r\n }\r\n if (doFlush) {\r\n // We process at least one item so flush the queue\r\n _flushChannels();\r\n }\r\n }), 100);\r\n }\r\n }\r\n _self.trackPageView = function (pageView, customProperties) {\r\n var name = pageView.name;\r\n if (isNullOrUndefined(name) || typeof name !== \"string\") {\r\n var doc = getDocument();\r\n name = pageView.name = doc && doc.title || \"\";\r\n }\r\n var uri = pageView.uri;\r\n if (isNullOrUndefined(uri) || typeof uri !== \"string\") {\r\n var location_1 = getLocation();\r\n uri = pageView.uri = location_1 && location_1.href || \"\";\r\n }\r\n // case 1a. if performance timing is not supported by the browser, send the page view telemetry with the duration provided by the user. If the user\r\n // do not provide the duration, set duration to undefined\r\n // Also this is case 4\r\n if (!pageViewPerformanceManager.isPerformanceTimingSupported()) {\r\n appInsights.sendPageViewInternal(pageView, customProperties);\r\n _flushChannels();\r\n // no navigation timing (IE 8, iOS Safari 8.4, Opera Mini 8 - see http://caniuse.com/#feat=nav-timing)\r\n _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NavigationTimingNotSupported, \"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.\");\r\n return;\r\n }\r\n var pageViewSent = false;\r\n var customDuration;\r\n // if the performance timing is supported by the browser, calculate the custom duration\r\n var start = pageViewPerformanceManager.getPerformanceTiming().navigationStart;\r\n if (start > 0) {\r\n customDuration = dateTimeUtilsDuration(start, +new Date);\r\n if (!pageViewPerformanceManager.shouldCollectDuration(customDuration)) {\r\n customDuration = undefined;\r\n }\r\n }\r\n // if the user has provided duration, send a page view telemetry with the provided duration. Otherwise, if\r\n // overridePageViewDuration is set to true, send a page view telemetry with the custom duration calculated earlier\r\n var duration;\r\n if (!isNullOrUndefined(customProperties) &&\r\n !isNullOrUndefined(customProperties.duration)) {\r\n duration = customProperties.duration;\r\n }\r\n if (overridePageViewDuration || !isNaN(duration)) {\r\n if (isNaN(duration)) {\r\n // case 3\r\n if (!customProperties) {\r\n customProperties = {};\r\n }\r\n customProperties[\"duration\"] = customDuration;\r\n }\r\n // case 2\r\n appInsights.sendPageViewInternal(pageView, customProperties);\r\n _flushChannels();\r\n pageViewSent = true;\r\n }\r\n // now try to send the page view performance telemetry\r\n var maxDurationLimit = 60000;\r\n if (!customProperties) {\r\n customProperties = {};\r\n }\r\n // Queue the event for processing\r\n _addQueue(function () {\r\n var processed = false;\r\n try {\r\n if (pageViewPerformanceManager.isPerformanceTimingDataReady()) {\r\n processed = true;\r\n var pageViewPerformance = {\r\n name: name,\r\n uri: uri\r\n };\r\n pageViewPerformanceManager.populatePageViewPerformanceEvent(pageViewPerformance);\r\n if (!pageViewPerformance.isValid && !pageViewSent) {\r\n // If navigation timing gives invalid numbers, then go back to \"override page view duration\" mode.\r\n // That's the best value we can get that makes sense.\r\n customProperties[\"duration\"] = customDuration;\r\n appInsights.sendPageViewInternal(pageView, customProperties);\r\n }\r\n else {\r\n if (!pageViewSent) {\r\n customProperties[\"duration\"] = pageViewPerformance.durationMs;\r\n appInsights.sendPageViewInternal(pageView, customProperties);\r\n }\r\n if (!pageViewPerformanceSent) {\r\n appInsights.sendPageViewPerformanceInternal(pageViewPerformance, customProperties);\r\n pageViewPerformanceSent = true;\r\n }\r\n }\r\n }\r\n else if (start > 0 && dateTimeUtilsDuration(start, +new Date) > maxDurationLimit) {\r\n // if performance timings are not ready but we exceeded the maximum duration limit, just log a page view telemetry\r\n // with the maximum duration limit. Otherwise, keep waiting until performance timings are ready\r\n processed = true;\r\n if (!pageViewSent) {\r\n customProperties[\"duration\"] = maxDurationLimit;\r\n appInsights.sendPageViewInternal(pageView, customProperties);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailedCalc, \"trackPageView failed on page load calculation: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n return processed;\r\n });\r\n };\r\n });\r\n }\r\n /**\r\n * Currently supported cases:\r\n * 1) (default case) track page view called with default parameters, overridePageViewDuration = false. Page view is sent with page view performance when navigation timing data is available.\r\n * a. If navigation timing is not supported then page view is sent right away with undefined duration. Page view performance is not sent.\r\n * 2) overridePageViewDuration = true, custom duration provided. Custom duration is used, page view sends right away.\r\n * 3) overridePageViewDuration = true, custom duration NOT provided. Page view is sent right away, duration is time spent from page load till now (or undefined if navigation timing is not supported).\r\n * 4) overridePageViewDuration = false, custom duration is provided. Page view is sent right away with custom duration.\r\n *\r\n * In all cases page view performance is sent once (only for the 1st call of trackPageView), or not sent if navigation timing is not supported.\r\n */\r\n PageViewManager.prototype.trackPageView = function (pageView, customProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return PageViewManager;\r\n}());\r\nexport { PageViewManager };\r\n//# sourceMappingURL=PageViewManager.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { utlCanUseSessionStorage, utlGetSessionStorage, utlRemoveSessionStorage, utlSetSessionStorage } from \"@microsoft/applicationinsights-common\";\r\nimport { hasJSON, getJSON, dateNow, dumpObj, throwError } from \"@microsoft/applicationinsights-core-js\";\r\n/**\r\n * Used to track page visit durations\r\n */\r\nvar PageVisitTimeManager = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of PageVisitTimeManager\r\n * @param pageVisitTimeTrackingHandler Delegate that will be called to send telemetry data to AI (when trackPreviousPageVisit is called)\r\n * @returns {}\r\n */\r\n function PageVisitTimeManager(logger, pageVisitTimeTrackingHandler) {\r\n this.prevPageVisitDataKeyName = \"prevPageVisitData\";\r\n this.pageVisitTimeTrackingHandler = pageVisitTimeTrackingHandler;\r\n this._logger = logger;\r\n }\r\n /**\r\n * Tracks the previous page visit time telemetry (if exists) and starts timing of new page visit time\r\n * @param currentPageName Name of page to begin timing for visit duration\r\n * @param currentPageUrl Url of page to begin timing for visit duration\r\n */\r\n PageVisitTimeManager.prototype.trackPreviousPageVisit = function (currentPageName, currentPageUrl) {\r\n try {\r\n // Restart timer for new page view\r\n var prevPageVisitTimeData = this.restartPageVisitTimer(currentPageName, currentPageUrl);\r\n // If there was a page already being timed, track the visit time for it now.\r\n if (prevPageVisitTimeData) {\r\n this.pageVisitTimeTrackingHandler(prevPageVisitTimeData.pageName, prevPageVisitTimeData.pageUrl, prevPageVisitTimeData.pageVisitTime);\r\n }\r\n }\r\n catch (e) {\r\n this._logger.warnToConsole(\"Auto track page visit time failed, metric will not be collected: \" + dumpObj(e));\r\n }\r\n };\r\n /**\r\n * Stops timing of current page (if exists) and starts timing for duration of visit to pageName\r\n * @param pageName Name of page to begin timing visit duration\r\n * @returns {PageVisitData} Page visit data (including duration) of pageName from last call to start or restart, if exists. Null if not.\r\n */\r\n PageVisitTimeManager.prototype.restartPageVisitTimer = function (pageName, pageUrl) {\r\n try {\r\n var prevPageVisitData = this.stopPageVisitTimer();\r\n this.startPageVisitTimer(pageName, pageUrl);\r\n return prevPageVisitData;\r\n }\r\n catch (e) {\r\n this._logger.warnToConsole(\"Call to restart failed: \" + dumpObj(e));\r\n return null;\r\n }\r\n };\r\n /**\r\n * Starts timing visit duration of pageName\r\n * @param pageName\r\n * @returns {}\r\n */\r\n PageVisitTimeManager.prototype.startPageVisitTimer = function (pageName, pageUrl) {\r\n try {\r\n if (utlCanUseSessionStorage()) {\r\n if (utlGetSessionStorage(this._logger, this.prevPageVisitDataKeyName) != null) {\r\n throwError(\"Cannot call startPageVisit consecutively without first calling stopPageVisit\");\r\n }\r\n var currPageVisitData = new PageVisitData(pageName, pageUrl);\r\n var currPageVisitDataStr = getJSON().stringify(currPageVisitData);\r\n utlSetSessionStorage(this._logger, this.prevPageVisitDataKeyName, currPageVisitDataStr);\r\n }\r\n }\r\n catch (e) {\r\n // TODO: Remove this catch in next phase, since if start is called twice in a row the exception needs to be propagated out\r\n this._logger.warnToConsole(\"Call to start failed: \" + dumpObj(e));\r\n }\r\n };\r\n /**\r\n * Stops timing of current page, if exists.\r\n * @returns {PageVisitData} Page visit data (including duration) of pageName from call to start, if exists. Null if not.\r\n */\r\n PageVisitTimeManager.prototype.stopPageVisitTimer = function () {\r\n try {\r\n if (utlCanUseSessionStorage()) {\r\n // Define end time of page's visit\r\n var pageVisitEndTime = dateNow();\r\n // Try to retrieve page name and start time from session storage\r\n var pageVisitDataJsonStr = utlGetSessionStorage(this._logger, this.prevPageVisitDataKeyName);\r\n if (pageVisitDataJsonStr && hasJSON()) {\r\n // if previous page data exists, set end time of visit\r\n var prevPageVisitData = getJSON().parse(pageVisitDataJsonStr);\r\n prevPageVisitData.pageVisitTime = pageVisitEndTime - prevPageVisitData.pageVisitStartTime;\r\n // Remove data from storage since we already used it\r\n utlRemoveSessionStorage(this._logger, this.prevPageVisitDataKeyName);\r\n // Return page visit data\r\n return prevPageVisitData;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n return null;\r\n }\r\n catch (e) {\r\n this._logger.warnToConsole(\"Stop page visit timer failed: \" + dumpObj(e));\r\n return null;\r\n }\r\n };\r\n return PageVisitTimeManager;\r\n}());\r\nexport { PageVisitTimeManager };\r\nvar PageVisitData = /** @class */ (function () {\r\n function PageVisitData(pageName, pageUrl) {\r\n this.pageVisitStartTime = dateNow();\r\n this.pageName = pageName;\r\n this.pageUrl = pageUrl;\r\n }\r\n return PageVisitData;\r\n}());\r\nexport { PageVisitData };\r\n//# sourceMappingURL=PageVisitTimeManager.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { dateTimeUtilsDuration, msToTimeSpan } from \"@microsoft/applicationinsights-common\";\r\nimport { LoggingSeverity, _InternalMessageId, getNavigator, getPerformance } from \"@microsoft/applicationinsights-core-js\";\r\n/**\r\n * Class encapsulates sending page view performance telemetry.\r\n */\r\nvar PageViewPerformanceManager = /** @class */ (function () {\r\n function PageViewPerformanceManager(core) {\r\n this.MAX_DURATION_ALLOWED = 3600000; // 1h\r\n if (core) {\r\n this._logger = core.logger;\r\n }\r\n }\r\n PageViewPerformanceManager.prototype.populatePageViewPerformanceEvent = function (pageViewPerformance) {\r\n pageViewPerformance.isValid = false;\r\n /*\r\n * http://www.w3.org/TR/navigation-timing/#processing-model\r\n * |-navigationStart\r\n * | |-connectEnd\r\n * | ||-requestStart\r\n * | || |-responseStart\r\n * | || | |-responseEnd\r\n * | || | |\r\n * | || | | |-loadEventEnd\r\n * |---network---||---request---|---response---|---dom---|\r\n * |--------------------------total----------------------|\r\n *\r\n * total = The difference between the load event of the current document is completed and the first recorded timestamp of the performance entry : https://developer.mozilla.org/en-US/docs/Web/Performance/Navigation_and_resource_timings#duration\r\n * network = Redirect time + App Cache + DNS lookup time + TCP connection time\r\n * request = Request time : https://developer.mozilla.org/en-US/docs/Web/Performance/Navigation_and_resource_timings#request_time\r\n * response = Response time\r\n * dom = Document load time : https://html.spec.whatwg.org/multipage/dom.html#document-load-timing-info\r\n * = Document processing time : https://developers.google.com/web/fundamentals/performance/navigation-and-resource-timing/#document_processing\r\n * + Loading time : https://developers.google.com/web/fundamentals/performance/navigation-and-resource-timing/#loading\r\n */\r\n var navigationTiming = this.getPerformanceNavigationTiming();\r\n var timing = this.getPerformanceTiming();\r\n var total = 0;\r\n var network = 0;\r\n var request = 0;\r\n var response = 0;\r\n var dom = 0;\r\n if (navigationTiming || timing) {\r\n if (navigationTiming) {\r\n total = navigationTiming.duration;\r\n /**\r\n * support both cases:\r\n * - startTime is always zero: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming\r\n * - for older browsers where the startTime is not zero\r\n */\r\n network = navigationTiming.startTime === 0 ? navigationTiming.connectEnd : dateTimeUtilsDuration(navigationTiming.startTime, navigationTiming.connectEnd);\r\n request = dateTimeUtilsDuration(navigationTiming.requestStart, navigationTiming.responseStart);\r\n response = dateTimeUtilsDuration(navigationTiming.responseStart, navigationTiming.responseEnd);\r\n dom = dateTimeUtilsDuration(navigationTiming.responseEnd, navigationTiming.loadEventEnd);\r\n }\r\n else {\r\n total = dateTimeUtilsDuration(timing.navigationStart, timing.loadEventEnd);\r\n network = dateTimeUtilsDuration(timing.navigationStart, timing.connectEnd);\r\n request = dateTimeUtilsDuration(timing.requestStart, timing.responseStart);\r\n response = dateTimeUtilsDuration(timing.responseStart, timing.responseEnd);\r\n dom = dateTimeUtilsDuration(timing.responseEnd, timing.loadEventEnd);\r\n }\r\n if (total === 0) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ErrorPVCalc, \"error calculating page view performance.\", { total: total, network: network, request: request, response: response, dom: dom });\r\n }\r\n else if (!this.shouldCollectDuration(total, network, request, response, dom)) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.InvalidDurationValue, \"Invalid page load duration value. Browser perf data won't be sent.\", { total: total, network: network, request: request, response: response, dom: dom });\r\n }\r\n else if (total < Math.floor(network) + Math.floor(request) + Math.floor(response) + Math.floor(dom)) {\r\n // some browsers may report individual components incorrectly so that the sum of the parts will be bigger than total PLT\r\n // in this case, don't report client performance from this page\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ClientPerformanceMathError, \"client performance math error.\", { total: total, network: network, request: request, response: response, dom: dom });\r\n }\r\n else {\r\n pageViewPerformance.durationMs = total;\r\n // // convert to timespans\r\n pageViewPerformance.perfTotal = pageViewPerformance.duration = msToTimeSpan(total);\r\n pageViewPerformance.networkConnect = msToTimeSpan(network);\r\n pageViewPerformance.sentRequest = msToTimeSpan(request);\r\n pageViewPerformance.receivedResponse = msToTimeSpan(response);\r\n pageViewPerformance.domProcessing = msToTimeSpan(dom);\r\n pageViewPerformance.isValid = true;\r\n }\r\n }\r\n };\r\n PageViewPerformanceManager.prototype.getPerformanceTiming = function () {\r\n if (this.isPerformanceTimingSupported()) {\r\n return getPerformance().timing;\r\n }\r\n return null;\r\n };\r\n PageViewPerformanceManager.prototype.getPerformanceNavigationTiming = function () {\r\n if (this.isPerformanceNavigationTimingSupported()) {\r\n return getPerformance().getEntriesByType(\"navigation\")[0];\r\n }\r\n return null;\r\n };\r\n /**\r\n * Returns true is window PerformanceNavigationTiming API is supported, false otherwise.\r\n */\r\n PageViewPerformanceManager.prototype.isPerformanceNavigationTimingSupported = function () {\r\n var perf = getPerformance();\r\n return perf && perf.getEntriesByType && perf.getEntriesByType(\"navigation\").length > 0;\r\n };\r\n /**\r\n * Returns true is window performance timing API is supported, false otherwise.\r\n */\r\n PageViewPerformanceManager.prototype.isPerformanceTimingSupported = function () {\r\n var perf = getPerformance();\r\n return perf && perf.timing;\r\n };\r\n /**\r\n * As page loads different parts of performance timing numbers get set. When all of them are set we can report it.\r\n * Returns true if ready, false otherwise.\r\n */\r\n PageViewPerformanceManager.prototype.isPerformanceTimingDataReady = function () {\r\n var perf = getPerformance();\r\n var timing = perf ? perf.timing : 0;\r\n return timing\r\n && timing.domainLookupStart > 0\r\n && timing.navigationStart > 0\r\n && timing.responseStart > 0\r\n && timing.requestStart > 0\r\n && timing.loadEventEnd > 0\r\n && timing.responseEnd > 0\r\n && timing.connectEnd > 0\r\n && timing.domLoading > 0;\r\n };\r\n /**\r\n * This method tells if given durations should be excluded from collection.\r\n */\r\n PageViewPerformanceManager.prototype.shouldCollectDuration = function () {\r\n var durations = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n durations[_i] = arguments[_i];\r\n }\r\n var _navigator = getNavigator() || {};\r\n // a full list of Google crawlers user agent strings - https://support.google.com/webmasters/answer/1061943?hl=en\r\n var botAgentNames = [\"googlebot\", \"adsbot-google\", \"apis-google\", \"mediapartners-google\"];\r\n var userAgent = _navigator.userAgent;\r\n var isGoogleBot = false;\r\n if (userAgent) {\r\n for (var i = 0; i < botAgentNames.length; i++) {\r\n isGoogleBot = isGoogleBot || userAgent.toLowerCase().indexOf(botAgentNames[i]) !== -1;\r\n }\r\n }\r\n if (isGoogleBot) {\r\n // Don't report durations for GoogleBot, it is returning invalid values in performance.timing API.\r\n return false;\r\n }\r\n else {\r\n // for other page views, don't report if it's outside of a reasonable range\r\n for (var i = 0; i < durations.length; i++) {\r\n if (durations[i] < 0 || durations[i] >= this.MAX_DURATION_ALLOWED) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n return PageViewPerformanceManager;\r\n}());\r\nexport { PageViewPerformanceManager };\r\n//# sourceMappingURL=PageViewPerformanceManager.js.map","/**\r\n * ApplicationInsights.ts\r\n * @copyright Microsoft 2018\r\n */\r\nimport { __assign, __extends } from \"tslib\";\r\nimport { PageViewPerformance, PageView, RemoteDependencyData, Event as EventTelemetry, TelemetryItemCreator, Metric, Exception, SeverityLevel, Trace, dateTimeUtilsDuration, PropertiesPluginIdentifier, AnalyticsPluginIdentifier, stringToBoolOrDefault, createDomEvent, strNotSpecified, isCrossOriginError, utlDisableStorage, dataSanitizeString } from \"@microsoft/applicationinsights-common\";\r\nimport { BaseTelemetryPlugin, LoggingSeverity, _InternalMessageId, getWindow, getDocument, getHistory, getLocation, doPerf, objForEachKey, isString, isFunction, isNullOrUndefined, arrForEach, generateW3CId, dumpObj, getExceptionName, safeGetCookieMgr } from \"@microsoft/applicationinsights-core-js\";\r\nimport { PageViewManager } from \"./Telemetry/PageViewManager\";\r\nimport { PageVisitTimeManager } from \"./Telemetry/PageVisitTimeManager\";\r\nimport { PageViewPerformanceManager } from \"./Telemetry/PageViewPerformanceManager\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\n\"use strict\";\r\nvar durationProperty = \"duration\";\r\nvar strEvent = \"event\";\r\nfunction _dispatchEvent(target, evnt) {\r\n if (target && target.dispatchEvent && evnt) {\r\n target.dispatchEvent(evnt);\r\n }\r\n}\r\nfunction _getReason(error) {\r\n if (error && error.reason) {\r\n var reason = error.reason;\r\n if (!isString(reason) && isFunction(reason.toString)) {\r\n return reason.toString();\r\n }\r\n return dumpObj(reason);\r\n }\r\n // Pass the original object down which will eventually get evaluated for any message or description\r\n return error || \"\";\r\n}\r\nvar ApplicationInsights = /** @class */ (function (_super) {\r\n __extends(ApplicationInsights, _super);\r\n function ApplicationInsights() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = AnalyticsPluginIdentifier; // do not change name or priority\r\n _this.priority = 180; // take from reserved priority range 100- 200\r\n _this.autoRoutePVDelay = 500; // ms; Time to wait after a route change before triggering a pageview to allow DOM changes to take place\r\n var _eventTracking;\r\n var _pageTracking;\r\n var _properties;\r\n // Counts number of trackAjax invocations.\r\n // By default we only monitor X ajax call per view to avoid too much load.\r\n // Default value is set in config.\r\n // This counter keeps increasing even after the limit is reached.\r\n var _trackAjaxAttempts = 0;\r\n // array with max length of 2 that store current url and previous url for SPA page route change trackPageview use.\r\n var _prevUri; // Assigned in the constructor\r\n var _currUri;\r\n dynamicProto(ApplicationInsights, _this, function (_self, _base) {\r\n var location = getLocation(true);\r\n _prevUri = location && location.href || \"\";\r\n _self.getCookieMgr = function () {\r\n return safeGetCookieMgr(_self.core);\r\n };\r\n _self.processTelemetry = function (env, itemCtx) {\r\n doPerf(_self.core, function () { return _self.identifier + \":processTelemetry\"; }, function () {\r\n var doNotSendItem = false;\r\n var telemetryInitializersCount = _self._telemetryInitializers.length;\r\n itemCtx = _self._getTelCtx(itemCtx);\r\n for (var i = 0; i < telemetryInitializersCount; ++i) {\r\n var telemetryInitializer = _self._telemetryInitializers[i];\r\n if (telemetryInitializer) {\r\n try {\r\n if (telemetryInitializer.apply(null, [env]) === false) {\r\n doNotSendItem = true;\r\n break;\r\n }\r\n }\r\n catch (e) {\r\n // log error but dont stop executing rest of the telemetry initializers\r\n // doNotSendItem = true;\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, \"One of telemetry initializers failed, telemetry item will not be sent: \" + getExceptionName(e), { exception: dumpObj(e) }, true);\r\n }\r\n }\r\n }\r\n if (!doNotSendItem) {\r\n _self.processNext(env, itemCtx);\r\n }\r\n }, function () { return ({ item: env }); }, !(env.sync));\r\n };\r\n _self.trackEvent = function (event, customProperties) {\r\n try {\r\n var telemetryItem = TelemetryItemCreator.create(event, EventTelemetry.dataType, EventTelemetry.envelopeType, _self.diagLog(), customProperties);\r\n _self.core.track(telemetryItem);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, \"trackTrace failed, trace will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * Start timing an extended event. Call `stopTrackEvent` to log the event when it ends.\r\n * @param name A string that identifies this event uniquely within the document.\r\n */\r\n _self.startTrackEvent = function (name) {\r\n try {\r\n _eventTracking.start(name);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackEventFailed, \"startTrackEvent failed, event will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * Log an extended event that you started timing with `startTrackEvent`.\r\n * @param name The string you used to identify this event in `startTrackEvent`.\r\n * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.\r\n * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.\r\n */\r\n _self.stopTrackEvent = function (name, properties, measurements) {\r\n try {\r\n _eventTracking.stop(name, undefined, properties); // Todo: Fix to pass measurements once type is updated\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackEventFailed, \"stopTrackEvent failed, event will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * @description Log a diagnostic message\r\n * @param {ITraceTelemetry} trace\r\n * @param ICustomProperties.\r\n * @memberof ApplicationInsights\r\n */\r\n _self.trackTrace = function (trace, customProperties) {\r\n try {\r\n var telemetryItem = TelemetryItemCreator.create(trace, Trace.dataType, Trace.envelopeType, _self.diagLog(), customProperties);\r\n _self.core.track(telemetryItem);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, \"trackTrace failed, trace will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * @description Log a numeric value that is not associated with a specific event. Typically\r\n * used to send regular reports of performance indicators. To send single measurement, just\r\n * use the name and average fields of {@link IMetricTelemetry}. If you take measurements\r\n * frequently, you can reduce the telemetry bandwidth by aggregating multiple measurements\r\n * and sending the resulting average at intervals\r\n * @param {IMetricTelemetry} metric input object argument. Only name and average are mandatory.\r\n * @param {{[key: string]: any}} customProperties additional data used to filter metrics in the\r\n * portal. Defaults to empty.\r\n * @memberof ApplicationInsights\r\n */\r\n _self.trackMetric = function (metric, customProperties) {\r\n try {\r\n var telemetryItem = TelemetryItemCreator.create(metric, Metric.dataType, Metric.envelopeType, _self.diagLog(), customProperties);\r\n _self.core.track(telemetryItem);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackMetricFailed, \"trackMetric failed, metric will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * Logs that a page or other item was viewed.\r\n * @param IPageViewTelemetry The string you used as the name in startTrackPage. Defaults to the document title.\r\n * @param customProperties Additional data used to filter events and metrics. Defaults to empty.\r\n * If a user wants to provide duration for pageLoad, it'll have to be in pageView.properties.duration\r\n */\r\n _self.trackPageView = function (pageView, customProperties) {\r\n try {\r\n var inPv = pageView || {};\r\n _self._pageViewManager.trackPageView(inPv, __assign(__assign(__assign({}, inPv.properties), inPv.measurements), customProperties));\r\n if (_self.config.autoTrackPageVisitTime) {\r\n _self._pageVisitTimeManager.trackPreviousPageVisit(inPv.name, inPv.uri);\r\n }\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, \"trackPageView failed, page view will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * Create a page view telemetry item and send it to the SDK pipeline through the core.track API\r\n * @param pageView Page view item to be sent\r\n * @param properties Custom properties (Part C) that a user can add to the telemetry item\r\n * @param systemProperties System level properties (Part A) that a user can add to the telemetry item\r\n */\r\n _self.sendPageViewInternal = function (pageView, properties, systemProperties) {\r\n var doc = getDocument();\r\n if (doc) {\r\n pageView.refUri = pageView.refUri === undefined ? doc.referrer : pageView.refUri;\r\n }\r\n var telemetryItem = TelemetryItemCreator.create(pageView, PageView.dataType, PageView.envelopeType, _self.diagLog(), properties, systemProperties);\r\n _self.core.track(telemetryItem);\r\n // reset ajaxes counter\r\n _trackAjaxAttempts = 0;\r\n };\r\n /**\r\n * @ignore INTERNAL ONLY\r\n * @param pageViewPerformance\r\n * @param properties\r\n */\r\n _self.sendPageViewPerformanceInternal = function (pageViewPerformance, properties, systemProperties) {\r\n var telemetryItem = TelemetryItemCreator.create(pageViewPerformance, PageViewPerformance.dataType, PageViewPerformance.envelopeType, _self.diagLog(), properties, systemProperties);\r\n _self.core.track(telemetryItem);\r\n };\r\n /**\r\n * Send browser performance metrics.\r\n * @param pageViewPerformance\r\n * @param customProperties\r\n */\r\n _self.trackPageViewPerformance = function (pageViewPerformance, customProperties) {\r\n try {\r\n _self._pageViewPerformanceManager.populatePageViewPerformanceEvent(pageViewPerformance);\r\n _self.sendPageViewPerformanceInternal(pageViewPerformance, customProperties);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, \"trackPageViewPerformance failed, page view will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * Starts the timer for tracking a page load time. Use this instead of `trackPageView` if you want to control when the page view timer starts and stops,\r\n * but don't want to calculate the duration yourself. This method doesn't send any telemetry. Call `stopTrackPage` to log the end of the page view\r\n * and send the event.\r\n * @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.\r\n */\r\n _self.startTrackPage = function (name) {\r\n try {\r\n if (typeof name !== \"string\") {\r\n var doc = getDocument();\r\n name = doc && doc.title || \"\";\r\n }\r\n _pageTracking.start(name);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackFailed, \"startTrackPage failed, page view may not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * Stops the timer that was started by calling `startTrackPage` and sends the pageview load time telemetry with the specified properties and measurements.\r\n * The duration of the page view will be the time between calling `startTrackPage` and `stopTrackPage`.\r\n * @param name The string you used as the name in startTrackPage. Defaults to the document title.\r\n * @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.\r\n * @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.\r\n * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.\r\n */\r\n _self.stopTrackPage = function (name, url, properties, measurement) {\r\n try {\r\n if (typeof name !== \"string\") {\r\n var doc = getDocument();\r\n name = doc && doc.title || \"\";\r\n }\r\n if (typeof url !== \"string\") {\r\n var loc = getLocation();\r\n url = loc && loc.href || \"\";\r\n }\r\n _pageTracking.stop(name, url, properties, measurement);\r\n if (_self.config.autoTrackPageVisitTime) {\r\n _self._pageVisitTimeManager.trackPreviousPageVisit(name, url);\r\n }\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackFailed, \"stopTrackPage failed, page view will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * @ignore INTERNAL ONLY\r\n * @param exception\r\n * @param properties\r\n * @param systemProperties\r\n */\r\n _self.sendExceptionInternal = function (exception, customProperties, systemProperties) {\r\n var theError = exception.exception || exception.error || new Error(strNotSpecified);\r\n var exceptionPartB = new Exception(_self.diagLog(), theError, exception.properties || customProperties, exception.measurements, exception.severityLevel, exception.id).toInterface();\r\n var telemetryItem = TelemetryItemCreator.create(exceptionPartB, Exception.dataType, Exception.envelopeType, _self.diagLog(), customProperties, systemProperties);\r\n _self.core.track(telemetryItem);\r\n };\r\n /**\r\n * Log an exception you have caught.\r\n *\r\n * @param {IExceptionTelemetry} exception Object which contains exception to be sent\r\n * @param {{[key: string]: any}} customProperties Additional data used to filter pages and metrics in the portal. Defaults to empty.\r\n *\r\n * Any property of type double will be considered a measurement, and will be treated by Application Insights as a metric.\r\n * @memberof ApplicationInsights\r\n */\r\n _self.trackException = function (exception, customProperties) {\r\n try {\r\n _self.sendExceptionInternal(exception, customProperties);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackExceptionFailed, \"trackException failed, exception will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * @description Custom error handler for Application Insights Analytics\r\n * @param {IAutoExceptionTelemetry} exception\r\n * @memberof ApplicationInsights\r\n */\r\n _self._onerror = function (exception) {\r\n var error = exception && exception.error;\r\n var evt = exception && exception.evt;\r\n try {\r\n if (!evt) {\r\n var _window = getWindow();\r\n if (_window) {\r\n evt = _window[strEvent];\r\n }\r\n }\r\n var url = (exception && exception.url) || (getDocument() || {}).URL;\r\n // If no error source is provided assume the default window.onerror handler\r\n var errorSrc = exception.errorSrc || \"window.onerror@\" + url + \":\" + (exception.lineNumber || 0) + \":\" + (exception.columnNumber || 0);\r\n var properties = {\r\n errorSrc: errorSrc,\r\n url: url,\r\n lineNumber: exception.lineNumber || 0,\r\n columnNumber: exception.columnNumber || 0,\r\n message: exception.message\r\n };\r\n if (isCrossOriginError(exception.message, exception.url, exception.lineNumber, exception.columnNumber, exception.error)) {\r\n _sendCORSException(Exception.CreateAutoException(\"Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.\", url, exception.lineNumber || 0, exception.columnNumber || 0, error, evt, null, errorSrc), properties);\r\n }\r\n else {\r\n if (!exception.errorSrc) {\r\n exception.errorSrc = errorSrc;\r\n }\r\n _self.trackException({ exception: exception, severityLevel: SeverityLevel.Error }, properties);\r\n }\r\n }\r\n catch (e) {\r\n var errorString = error ? (error.name + \", \" + error.message) : \"null\";\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ExceptionWhileLoggingError, \"_onError threw exception while logging error, error will not be collected: \"\r\n + getExceptionName(e), { exception: dumpObj(e), errorString: errorString });\r\n }\r\n };\r\n _self.addTelemetryInitializer = function (telemetryInitializer) {\r\n _self._telemetryInitializers.push(telemetryInitializer);\r\n };\r\n _self.initialize = function (config, core, extensions, pluginChain) {\r\n if (_self.isInitialized()) {\r\n return;\r\n }\r\n if (isNullOrUndefined(core)) {\r\n throw Error(\"Error initializing\");\r\n }\r\n _base.initialize(config, core, extensions, pluginChain);\r\n _self.setInitialized(false); // resetting the initialized state, just in case the following fails\r\n var ctx = _self._getTelCtx();\r\n var identifier = _self.identifier;\r\n _self.config = ctx.getExtCfg(identifier);\r\n // load default values if specified\r\n var defaults = ApplicationInsights.getDefaultConfig(config);\r\n if (defaults !== undefined) {\r\n objForEachKey(defaults, function (field, value) {\r\n // for each unspecified field, set the default value\r\n _self.config[field] = ctx.getConfig(identifier, field, value);\r\n if (_self.config[field] === undefined) {\r\n _self.config[field] = value;\r\n }\r\n });\r\n }\r\n // Todo: move this out of static state\r\n if (_self.config.isStorageUseDisabled) {\r\n utlDisableStorage();\r\n }\r\n var configGetters = {\r\n instrumentationKey: function () { return config.instrumentationKey; },\r\n accountId: function () { return _self.config.accountId || config.accountId; },\r\n sessionRenewalMs: function () { return _self.config.sessionRenewalMs || config.sessionRenewalMs; },\r\n sessionExpirationMs: function () { return _self.config.sessionExpirationMs || config.sessionExpirationMs; },\r\n sampleRate: function () { return _self.config.samplingPercentage || config.samplingPercentage; },\r\n sdkExtension: function () { return _self.config.sdkExtension || config.sdkExtension; },\r\n isBrowserLinkTrackingEnabled: function () { return _self.config.isBrowserLinkTrackingEnabled || config.isBrowserLinkTrackingEnabled; },\r\n appId: function () { return _self.config.appId || config.appId; }\r\n };\r\n _self._pageViewPerformanceManager = new PageViewPerformanceManager(_self.core);\r\n _self._pageViewManager = new PageViewManager(_this, _self.config.overridePageViewDuration, _self.core, _self._pageViewPerformanceManager);\r\n _self._pageVisitTimeManager = new PageVisitTimeManager(_self.diagLog(), function (pageName, pageUrl, pageVisitTime) { return trackPageVisitTime(pageName, pageUrl, pageVisitTime); });\r\n _self._telemetryInitializers = _self._telemetryInitializers || [];\r\n _addDefaultTelemetryInitializers(configGetters);\r\n _eventTracking = new Timing(_self.diagLog(), \"trackEvent\");\r\n _eventTracking.action =\r\n function (name, url, duration, properties) {\r\n if (!properties) {\r\n properties = {};\r\n }\r\n properties[durationProperty] = duration.toString();\r\n _self.trackEvent({ name: name, properties: properties });\r\n };\r\n // initialize page view timing\r\n _pageTracking = new Timing(_self.diagLog(), \"trackPageView\");\r\n _pageTracking.action = function (name, url, duration, properties, measurements) {\r\n // duration must be a custom property in order for the collector to extract it\r\n if (isNullOrUndefined(properties)) {\r\n properties = {};\r\n }\r\n properties[durationProperty] = duration.toString();\r\n var pageViewItem = {\r\n name: name,\r\n uri: url,\r\n properties: properties,\r\n measurements: measurements\r\n };\r\n _self.sendPageViewInternal(pageViewItem, properties);\r\n };\r\n var _window = getWindow();\r\n var _history = getHistory();\r\n var _location = getLocation(true);\r\n var instance = _this;\r\n if (_self.config.disableExceptionTracking === false &&\r\n !_self.config.autoExceptionInstrumented && _window) {\r\n // We want to enable exception auto collection and it has not been done so yet\r\n var onerror_1 = \"onerror\";\r\n var originalOnError_1 = _window[onerror_1];\r\n _window.onerror = function (message, url, lineNumber, columnNumber, error) {\r\n var evt = _window[strEvent];\r\n var handled = originalOnError_1 && originalOnError_1(message, url, lineNumber, columnNumber, error);\r\n if (handled !== true) { // handled could be typeof function\r\n instance._onerror(Exception.CreateAutoException(message, url, lineNumber, columnNumber, error, evt));\r\n }\r\n return handled;\r\n };\r\n _self.config.autoExceptionInstrumented = true;\r\n }\r\n if (_self.config.disableExceptionTracking === false &&\r\n _self.config.enableUnhandledPromiseRejectionTracking === true &&\r\n !_self.config.autoUnhandledPromiseInstrumented && _window) {\r\n // We want to enable exception auto collection and it has not been done so yet\r\n var onunhandledrejection_1 = \"onunhandledrejection\";\r\n var originalOnUnhandledRejection_1 = _window[onunhandledrejection_1];\r\n _window[onunhandledrejection_1] = function (error) {\r\n var evt = _window[strEvent];\r\n var handled = originalOnUnhandledRejection_1 && originalOnUnhandledRejection_1.call(_window, error);\r\n if (handled !== true) { // handled could be typeof function\r\n instance._onerror(Exception.CreateAutoException(_getReason(error), _location ? _location.href : \"\", 0, 0, error, evt));\r\n }\r\n return handled;\r\n };\r\n _self.config.autoUnhandledPromiseInstrumented = true;\r\n }\r\n /**\r\n * Create a custom \"locationchange\" event which is triggered each time the history object is changed\r\n */\r\n if (_self.config.enableAutoRouteTracking === true\r\n && _history && isFunction(_history.pushState) && isFunction(_history.replaceState)\r\n && _window\r\n && typeof Event !== \"undefined\") {\r\n var _self_1 = _this;\r\n // Find the properties plugin\r\n arrForEach(extensions, function (extension) {\r\n if (extension.identifier === PropertiesPluginIdentifier) {\r\n _properties = extension;\r\n }\r\n });\r\n _history.pushState = (function (f) { return function pushState() {\r\n var ret = f.apply(this, arguments);\r\n _dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + \"pushState\"));\r\n _dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + \"locationchange\"));\r\n return ret;\r\n }; })(_history.pushState);\r\n _history.replaceState = (function (f) { return function replaceState() {\r\n var ret = f.apply(this, arguments);\r\n _dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + \"replaceState\"));\r\n _dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + \"locationchange\"));\r\n return ret;\r\n }; })(_history.replaceState);\r\n if (_window.addEventListener) {\r\n _window.addEventListener(_self_1.config.namePrefix + \"popstate\", function () {\r\n _dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + \"locationchange\"));\r\n });\r\n _window.addEventListener(_self_1.config.namePrefix + \"locationchange\", function () {\r\n if (_properties && _properties.context && _properties.context.telemetryTrace) {\r\n _properties.context.telemetryTrace.traceID = generateW3CId();\r\n var traceLocationName = \"_unknown_\";\r\n if (_location && _location.pathname) {\r\n traceLocationName = _location.pathname + (_location.hash || \"\");\r\n }\r\n // This populates the ai.operation.name which has a maximum size of 1024 so we need to sanitize it\r\n _properties.context.telemetryTrace.name = dataSanitizeString(_self_1.diagLog(), traceLocationName);\r\n }\r\n if (_currUri) {\r\n _prevUri = _currUri;\r\n _currUri = _location && _location.href || \"\";\r\n }\r\n else {\r\n _currUri = _location && _location.href || \"\";\r\n }\r\n setTimeout((function (uri) {\r\n // todo: override start time so that it is not affected by autoRoutePVDelay\r\n _self_1.trackPageView({ refUri: uri, properties: { duration: 0 } }); // SPA route change loading durations are undefined, so send 0\r\n }).bind(_this, _prevUri), _self_1.autoRoutePVDelay);\r\n });\r\n }\r\n }\r\n _self.setInitialized(true);\r\n };\r\n /**\r\n * Log a page visit time\r\n * @param pageName Name of page\r\n * @param pageVisitDuration Duration of visit to the page in milleseconds\r\n */\r\n function trackPageVisitTime(pageName, pageUrl, pageVisitTime) {\r\n var properties = { PageName: pageName, PageUrl: pageUrl };\r\n _self.trackMetric({\r\n name: \"PageVisitTime\",\r\n average: pageVisitTime,\r\n max: pageVisitTime,\r\n min: pageVisitTime,\r\n sampleCount: 1\r\n }, properties);\r\n }\r\n function _addDefaultTelemetryInitializers(configGetters) {\r\n if (!configGetters.isBrowserLinkTrackingEnabled()) {\r\n var browserLinkPaths_1 = [\"/browserLinkSignalR/\", \"/__browserLink/\"];\r\n var dropBrowserLinkRequests = function (envelope) {\r\n if (envelope.baseType === RemoteDependencyData.dataType) {\r\n var remoteData = envelope.baseData;\r\n if (remoteData) {\r\n for (var i = 0; i < browserLinkPaths_1.length; i++) {\r\n if (remoteData.target && remoteData.target.indexOf(browserLinkPaths_1[i]) >= 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n _addTelemetryInitializer(dropBrowserLinkRequests);\r\n }\r\n }\r\n function _addTelemetryInitializer(telemetryInitializer) {\r\n _self._telemetryInitializers.push(telemetryInitializer);\r\n }\r\n function _sendCORSException(exception, properties) {\r\n var telemetryItem = TelemetryItemCreator.create(exception, Exception.dataType, Exception.envelopeType, _self.diagLog(), properties);\r\n _self.core.track(telemetryItem);\r\n }\r\n });\r\n return _this;\r\n }\r\n ApplicationInsights.getDefaultConfig = function (config) {\r\n if (!config) {\r\n config = {};\r\n }\r\n // set default values\r\n config.sessionRenewalMs = 30 * 60 * 1000;\r\n config.sessionExpirationMs = 24 * 60 * 60 * 1000;\r\n config.disableExceptionTracking = stringToBoolOrDefault(config.disableExceptionTracking);\r\n config.autoTrackPageVisitTime = stringToBoolOrDefault(config.autoTrackPageVisitTime);\r\n config.overridePageViewDuration = stringToBoolOrDefault(config.overridePageViewDuration);\r\n config.enableUnhandledPromiseRejectionTracking = stringToBoolOrDefault(config.enableUnhandledPromiseRejectionTracking);\r\n if (isNaN(config.samplingPercentage) || config.samplingPercentage <= 0 || config.samplingPercentage >= 100) {\r\n config.samplingPercentage = 100;\r\n }\r\n config.isStorageUseDisabled = stringToBoolOrDefault(config.isStorageUseDisabled);\r\n config.isBrowserLinkTrackingEnabled = stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled);\r\n config.enableAutoRouteTracking = stringToBoolOrDefault(config.enableAutoRouteTracking);\r\n config.namePrefix = config.namePrefix || \"\";\r\n config.enableDebug = stringToBoolOrDefault(config.enableDebug);\r\n config.disableFlushOnBeforeUnload = stringToBoolOrDefault(config.disableFlushOnBeforeUnload);\r\n config.disableFlushOnUnload = stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);\r\n return config;\r\n };\r\n /**\r\n * Get the current cookie manager for this instance\r\n */\r\n ApplicationInsights.prototype.getCookieMgr = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n ApplicationInsights.prototype.processTelemetry = function (env, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ApplicationInsights.prototype.trackEvent = function (event, customProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Start timing an extended event. Call `stopTrackEvent` to log the event when it ends.\r\n * @param name A string that identifies this event uniquely within the document.\r\n */\r\n ApplicationInsights.prototype.startTrackEvent = function (name) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Log an extended event that you started timing with `startTrackEvent`.\r\n * @param name The string you used to identify this event in `startTrackEvent`.\r\n * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.\r\n * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.\r\n */\r\n ApplicationInsights.prototype.stopTrackEvent = function (name, properties, measurements) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * @description Log a diagnostic message\r\n * @param {ITraceTelemetry} trace\r\n * @param ICustomProperties.\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype.trackTrace = function (trace, customProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * @description Log a numeric value that is not associated with a specific event. Typically\r\n * used to send regular reports of performance indicators. To send single measurement, just\r\n * use the name and average fields of {@link IMetricTelemetry}. If you take measurements\r\n * frequently, you can reduce the telemetry bandwidth by aggregating multiple measurements\r\n * and sending the resulting average at intervals\r\n * @param {IMetricTelemetry} metric input object argument. Only name and average are mandatory.\r\n * @param {{[key: string]: any}} customProperties additional data used to filter metrics in the\r\n * portal. Defaults to empty.\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype.trackMetric = function (metric, customProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Logs that a page or other item was viewed.\r\n * @param IPageViewTelemetry The string you used as the name in startTrackPage. Defaults to the document title.\r\n * @param customProperties Additional data used to filter events and metrics. Defaults to empty.\r\n * If a user wants to provide duration for pageLoad, it'll have to be in pageView.properties.duration\r\n */\r\n ApplicationInsights.prototype.trackPageView = function (pageView, customProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Create a page view telemetry item and send it to the SDK pipeline through the core.track API\r\n * @param pageView Page view item to be sent\r\n * @param properties Custom properties (Part C) that a user can add to the telemetry item\r\n * @param systemProperties System level properties (Part A) that a user can add to the telemetry item\r\n */\r\n ApplicationInsights.prototype.sendPageViewInternal = function (pageView, properties, systemProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * @ignore INTERNAL ONLY\r\n * @param pageViewPerformance\r\n * @param properties\r\n */\r\n ApplicationInsights.prototype.sendPageViewPerformanceInternal = function (pageViewPerformance, properties, systemProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Send browser performance metrics.\r\n * @param pageViewPerformance\r\n * @param customProperties\r\n */\r\n ApplicationInsights.prototype.trackPageViewPerformance = function (pageViewPerformance, customProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Starts the timer for tracking a page load time. Use this instead of `trackPageView` if you want to control when the page view timer starts and stops,\r\n * but don't want to calculate the duration yourself. This method doesn't send any telemetry. Call `stopTrackPage` to log the end of the page view\r\n * and send the event.\r\n * @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.\r\n */\r\n ApplicationInsights.prototype.startTrackPage = function (name) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Stops the timer that was started by calling `startTrackPage` and sends the pageview load time telemetry with the specified properties and measurements.\r\n * The duration of the page view will be the time between calling `startTrackPage` and `stopTrackPage`.\r\n * @param name The string you used as the name in startTrackPage. Defaults to the document title.\r\n * @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.\r\n * @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.\r\n * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.\r\n */\r\n ApplicationInsights.prototype.stopTrackPage = function (name, url, properties, measurement) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * @ignore INTERNAL ONLY\r\n * @param exception\r\n * @param properties\r\n * @param systemProperties\r\n */\r\n ApplicationInsights.prototype.sendExceptionInternal = function (exception, customProperties, systemProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Log an exception you have caught.\r\n *\r\n * @param {IExceptionTelemetry} exception Object which contains exception to be sent\r\n * @param {{[key: string]: any}} customProperties Additional data used to filter pages and metrics in the portal. Defaults to empty.\r\n *\r\n * Any property of type double will be considered a measurement, and will be treated by Application Insights as a metric.\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype.trackException = function (exception, customProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * @description Custom error handler for Application Insights Analytics\r\n * @param {IAutoExceptionTelemetry} exception\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype._onerror = function (exception) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ApplicationInsights.prototype.addTelemetryInitializer = function (telemetryInitializer) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ApplicationInsights.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ApplicationInsights.Version = \"2.7.1\"; // Not currently used anywhere\r\n return ApplicationInsights;\r\n}(BaseTelemetryPlugin));\r\nexport { ApplicationInsights };\r\n/**\r\n * Used to record timed events and page views.\r\n */\r\nvar Timing = /** @class */ (function () {\r\n function Timing(logger, name) {\r\n var _self = this;\r\n var _events = {};\r\n _self.start = function (name) {\r\n if (typeof _events[name] !== \"undefined\") {\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, \"start was called more than once for this event without calling stop.\", { name: name, key: name }, true);\r\n }\r\n _events[name] = +new Date;\r\n };\r\n _self.stop = function (name, url, properties, measurements) {\r\n var start = _events[name];\r\n if (isNaN(start)) {\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, \"stop was called without a corresponding start.\", { name: name, key: name }, true);\r\n }\r\n else {\r\n var end = +new Date;\r\n var duration = dateTimeUtilsDuration(start, end);\r\n _self.action(name, url, duration, properties, measurements);\r\n }\r\n delete _events[name];\r\n _events[name] = undefined;\r\n };\r\n }\r\n return Timing;\r\n}());\r\n//# sourceMappingURL=ApplicationInsights.js.map","import { __extends } from \"tslib\";\r\nimport { utlGetSessionStorage, utlSetSessionStorage } from \"@microsoft/applicationinsights-common\";\r\nimport { LoggingSeverity, _InternalMessageId, getJSON, arrForEach, isFunction, arrIndexOf, isString, dumpObj, isArray, getExceptionName } from \"@microsoft/applicationinsights-core-js\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nvar BaseSendBuffer = /** @class */ (function () {\r\n function BaseSendBuffer(logger, config) {\r\n var _buffer = [];\r\n var _bufferFullMessageSent = false;\r\n this._get = function () {\r\n return _buffer;\r\n };\r\n this._set = function (buffer) {\r\n _buffer = buffer;\r\n return _buffer;\r\n };\r\n dynamicProto(BaseSendBuffer, this, function (_self) {\r\n _self.enqueue = function (payload) {\r\n if (_self.count() >= config.eventsLimitInMem()) {\r\n // sent internal log only once per page view\r\n if (!_bufferFullMessageSent) {\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.InMemoryStorageBufferFull, \"Maximum in-memory buffer size reached: \" + _self.count(), true);\r\n _bufferFullMessageSent = true;\r\n }\r\n return;\r\n }\r\n _buffer.push(payload);\r\n };\r\n _self.count = function () {\r\n return _buffer.length;\r\n };\r\n _self.size = function () {\r\n var size = _buffer.length;\r\n for (var lp = 0; lp < _buffer.length; lp++) {\r\n size += _buffer[lp].length;\r\n }\r\n if (!config.emitLineDelimitedJson()) {\r\n size += 2;\r\n }\r\n return size;\r\n };\r\n _self.clear = function () {\r\n _buffer = [];\r\n _bufferFullMessageSent = false;\r\n };\r\n _self.getItems = function () {\r\n return _buffer.slice(0);\r\n };\r\n _self.batchPayloads = function (payload) {\r\n if (payload && payload.length > 0) {\r\n var batch = config.emitLineDelimitedJson() ?\r\n payload.join(\"\\n\") :\r\n \"[\" + payload.join(\",\") + \"]\";\r\n return batch;\r\n }\r\n return null;\r\n };\r\n });\r\n }\r\n BaseSendBuffer.prototype.enqueue = function (payload) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseSendBuffer.prototype.count = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return 0;\r\n };\r\n BaseSendBuffer.prototype.size = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return 0;\r\n };\r\n BaseSendBuffer.prototype.clear = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseSendBuffer.prototype.getItems = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n BaseSendBuffer.prototype.batchPayloads = function (payload) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return BaseSendBuffer;\r\n}());\r\n/*\r\n * An array based send buffer.\r\n */\r\nvar ArraySendBuffer = /** @class */ (function (_super) {\r\n __extends(ArraySendBuffer, _super);\r\n function ArraySendBuffer(logger, config) {\r\n var _this = _super.call(this, logger, config) || this;\r\n dynamicProto(ArraySendBuffer, _this, function (_self, _base) {\r\n _self.markAsSent = function (payload) {\r\n _base.clear();\r\n };\r\n _self.clearSent = function (payload) {\r\n // not supported\r\n };\r\n });\r\n return _this;\r\n }\r\n ArraySendBuffer.prototype.markAsSent = function (payload) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ArraySendBuffer.prototype.clearSent = function (payload) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return ArraySendBuffer;\r\n}(BaseSendBuffer));\r\nexport { ArraySendBuffer };\r\n/*\r\n * Session storage buffer holds a copy of all unsent items in the browser session storage.\r\n */\r\nvar SessionStorageSendBuffer = /** @class */ (function (_super) {\r\n __extends(SessionStorageSendBuffer, _super);\r\n function SessionStorageSendBuffer(logger, config) {\r\n var _this = _super.call(this, logger, config) || this;\r\n var _bufferFullMessageSent = false;\r\n dynamicProto(SessionStorageSendBuffer, _this, function (_self, _base) {\r\n var bufferItems = _getBuffer(SessionStorageSendBuffer.BUFFER_KEY);\r\n var notDeliveredItems = _getBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY);\r\n var buffer = _self._set(bufferItems.concat(notDeliveredItems));\r\n // If the buffer has too many items, drop items from the end.\r\n if (buffer.length > SessionStorageSendBuffer.MAX_BUFFER_SIZE) {\r\n buffer.length = SessionStorageSendBuffer.MAX_BUFFER_SIZE;\r\n }\r\n _setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, []);\r\n _setBuffer(SessionStorageSendBuffer.BUFFER_KEY, buffer);\r\n _self.enqueue = function (payload) {\r\n if (_self.count() >= SessionStorageSendBuffer.MAX_BUFFER_SIZE) {\r\n // sent internal log only once per page view\r\n if (!_bufferFullMessageSent) {\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionStorageBufferFull, \"Maximum buffer size reached: \" + _self.count(), true);\r\n _bufferFullMessageSent = true;\r\n }\r\n return;\r\n }\r\n _base.enqueue(payload);\r\n _setBuffer(SessionStorageSendBuffer.BUFFER_KEY, _self._get());\r\n };\r\n _self.clear = function () {\r\n _base.clear();\r\n _setBuffer(SessionStorageSendBuffer.BUFFER_KEY, _self._get());\r\n _setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, []);\r\n _bufferFullMessageSent = false;\r\n };\r\n _self.markAsSent = function (payload) {\r\n _setBuffer(SessionStorageSendBuffer.BUFFER_KEY, _self._set(_removePayloadsFromBuffer(payload, _self._get())));\r\n var sentElements = _getBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY);\r\n if (sentElements instanceof Array && payload instanceof Array) {\r\n sentElements = sentElements.concat(payload);\r\n if (sentElements.length > SessionStorageSendBuffer.MAX_BUFFER_SIZE) {\r\n // We send telemetry normally. If the SENT_BUFFER is too big we don't add new elements\r\n // until we receive a response from the backend and the buffer has free space again (see clearSent method)\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.SessionStorageBufferFull, \"Sent buffer reached its maximum size: \" + sentElements.length, true);\r\n sentElements.length = SessionStorageSendBuffer.MAX_BUFFER_SIZE;\r\n }\r\n _setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, sentElements);\r\n }\r\n };\r\n _self.clearSent = function (payload) {\r\n var sentElements = _getBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY);\r\n sentElements = _removePayloadsFromBuffer(payload, sentElements);\r\n _setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, sentElements);\r\n };\r\n function _removePayloadsFromBuffer(payloads, buffer) {\r\n var remaining = [];\r\n arrForEach(buffer, function (value) {\r\n if (!isFunction(value) && arrIndexOf(payloads, value) === -1) {\r\n remaining.push(value);\r\n }\r\n });\r\n return remaining;\r\n }\r\n function _getBuffer(key) {\r\n var prefixedKey = key;\r\n try {\r\n prefixedKey = config.namePrefix && config.namePrefix() ? config.namePrefix() + \"_\" + prefixedKey : prefixedKey;\r\n var bufferJson = utlGetSessionStorage(logger, prefixedKey);\r\n if (bufferJson) {\r\n var buffer_1 = getJSON().parse(bufferJson);\r\n if (isString(buffer_1)) {\r\n // When using some version prototype.js the stringify / parse cycle does not decode array's correctly\r\n buffer_1 = getJSON().parse(buffer_1);\r\n }\r\n if (buffer_1 && isArray(buffer_1)) {\r\n return buffer_1;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToRestoreStorageBuffer, \" storage key: \" + prefixedKey + \", \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n return [];\r\n }\r\n function _setBuffer(key, buffer) {\r\n var prefixedKey = key;\r\n try {\r\n prefixedKey = config.namePrefix && config.namePrefix() ? config.namePrefix() + \"_\" + prefixedKey : prefixedKey;\r\n var bufferJson = JSON.stringify(buffer);\r\n utlSetSessionStorage(logger, prefixedKey, bufferJson);\r\n }\r\n catch (e) {\r\n // if there was an error, clear the buffer\r\n // telemetry is stored in the _buffer array so we won't loose any items\r\n utlSetSessionStorage(logger, prefixedKey, JSON.stringify([]));\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedToSetStorageBuffer, \" storage key: \" + prefixedKey + \", \" + getExceptionName(e) + \". Buffer cleared\", { exception: dumpObj(e) });\r\n }\r\n }\r\n });\r\n return _this;\r\n }\r\n SessionStorageSendBuffer.prototype.enqueue = function (payload) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n SessionStorageSendBuffer.prototype.clear = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n SessionStorageSendBuffer.prototype.markAsSent = function (payload) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n SessionStorageSendBuffer.prototype.clearSent = function (payload) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n SessionStorageSendBuffer.BUFFER_KEY = \"AI_buffer\";\r\n SessionStorageSendBuffer.SENT_BUFFER_KEY = \"AI_sentBuffer\";\r\n // Maximum number of payloads stored in the buffer. If the buffer is full, new elements will be dropped.\r\n SessionStorageSendBuffer.MAX_BUFFER_SIZE = 2000;\r\n return SessionStorageSendBuffer;\r\n}(BaseSendBuffer));\r\nexport { SessionStorageSendBuffer };\r\n//# sourceMappingURL=SendBuffer.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport { createClassFromInterface } from \"@microsoft/applicationinsights-core-js\";\r\nfunction _aiNameFunc(baseName) {\r\n var aiName = \"ai.\" + baseName + \".\";\r\n return function (name) {\r\n return aiName + name;\r\n };\r\n}\r\nvar _aiApplication = _aiNameFunc(\"application\");\r\nvar _aiDevice = _aiNameFunc(\"device\");\r\nvar _aiLocation = _aiNameFunc(\"location\");\r\nvar _aiOperation = _aiNameFunc(\"operation\");\r\nvar _aiSession = _aiNameFunc(\"session\");\r\nvar _aiUser = _aiNameFunc(\"user\");\r\nvar _aiCloud = _aiNameFunc(\"cloud\");\r\nvar _aiInternal = _aiNameFunc(\"internal\");\r\nvar ContextTagKeys = /** @class */ (function (_super) {\r\n __extends(ContextTagKeys, _super);\r\n function ContextTagKeys() {\r\n return _super.call(this) || this;\r\n }\r\n return ContextTagKeys;\r\n}(createClassFromInterface({\r\n applicationVersion: _aiApplication(\"ver\"),\r\n applicationBuild: _aiApplication(\"build\"),\r\n applicationTypeId: _aiApplication(\"typeId\"),\r\n applicationId: _aiApplication(\"applicationId\"),\r\n applicationLayer: _aiApplication(\"layer\"),\r\n deviceId: _aiDevice(\"id\"),\r\n deviceIp: _aiDevice(\"ip\"),\r\n deviceLanguage: _aiDevice(\"language\"),\r\n deviceLocale: _aiDevice(\"locale\"),\r\n deviceModel: _aiDevice(\"model\"),\r\n deviceFriendlyName: _aiDevice(\"friendlyName\"),\r\n deviceNetwork: _aiDevice(\"network\"),\r\n deviceNetworkName: _aiDevice(\"networkName\"),\r\n deviceOEMName: _aiDevice(\"oemName\"),\r\n deviceOS: _aiDevice(\"os\"),\r\n deviceOSVersion: _aiDevice(\"osVersion\"),\r\n deviceRoleInstance: _aiDevice(\"roleInstance\"),\r\n deviceRoleName: _aiDevice(\"roleName\"),\r\n deviceScreenResolution: _aiDevice(\"screenResolution\"),\r\n deviceType: _aiDevice(\"type\"),\r\n deviceMachineName: _aiDevice(\"machineName\"),\r\n deviceVMName: _aiDevice(\"vmName\"),\r\n deviceBrowser: _aiDevice(\"browser\"),\r\n deviceBrowserVersion: _aiDevice(\"browserVersion\"),\r\n locationIp: _aiLocation(\"ip\"),\r\n locationCountry: _aiLocation(\"country\"),\r\n locationProvince: _aiLocation(\"province\"),\r\n locationCity: _aiLocation(\"city\"),\r\n operationId: _aiOperation(\"id\"),\r\n operationName: _aiOperation(\"name\"),\r\n operationParentId: _aiOperation(\"parentId\"),\r\n operationRootId: _aiOperation(\"rootId\"),\r\n operationSyntheticSource: _aiOperation(\"syntheticSource\"),\r\n operationCorrelationVector: _aiOperation(\"correlationVector\"),\r\n sessionId: _aiSession(\"id\"),\r\n sessionIsFirst: _aiSession(\"isFirst\"),\r\n sessionIsNew: _aiSession(\"isNew\"),\r\n userAccountAcquisitionDate: _aiUser(\"accountAcquisitionDate\"),\r\n userAccountId: _aiUser(\"accountId\"),\r\n userAgent: _aiUser(\"userAgent\"),\r\n userId: _aiUser(\"id\"),\r\n userStoreRegion: _aiUser(\"storeRegion\"),\r\n userAuthUserId: _aiUser(\"authUserId\"),\r\n userAnonymousUserAcquisitionDate: _aiUser(\"anonUserAcquisitionDate\"),\r\n userAuthenticatedUserAcquisitionDate: _aiUser(\"authUserAcquisitionDate\"),\r\n cloudName: _aiCloud(\"name\"),\r\n cloudRole: _aiCloud(\"role\"),\r\n cloudRoleVer: _aiCloud(\"roleVer\"),\r\n cloudRoleInstance: _aiCloud(\"roleInstance\"),\r\n cloudEnvironment: _aiCloud(\"environment\"),\r\n cloudLocation: _aiCloud(\"location\"),\r\n cloudDeploymentUnit: _aiCloud(\"deploymentUnit\"),\r\n internalNodeName: _aiInternal(\"nodeName\"),\r\n internalSdkVersion: _aiInternal(\"sdkVersion\"),\r\n internalAgentVersion: _aiInternal(\"agentVersion\"),\r\n internalSnippet: _aiInternal(\"snippet\"),\r\n internalSdkSrc: _aiInternal(\"sdkSrc\")\r\n})));\r\nexport { ContextTagKeys };\r\n//# sourceMappingURL=ContextTagKeys.js.map","import { ContextTagKeys } from \"./Contracts/Generated/ContextTagKeys\";\r\nexport var Extensions = {\r\n UserExt: \"user\",\r\n DeviceExt: \"device\",\r\n TraceExt: \"trace\",\r\n WebExt: \"web\",\r\n AppExt: \"app\",\r\n OSExt: \"os\",\r\n SessionExt: \"ses\",\r\n SDKExt: \"sdk\"\r\n};\r\nexport var CtxTagKeys = new ContextTagKeys();\r\n//# sourceMappingURL=PartAExtensions.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport { Envelope as AIEnvelope } from \"../../Interfaces/Contracts/Generated/Envelope\";\r\nimport { dataSanitizeString } from \"./DataSanitizer\";\r\nimport { toISOString } from \"@microsoft/applicationinsights-core-js\";\r\nimport { strNotSpecified } from \"../../Constants\";\r\nvar Envelope = /** @class */ (function (_super) {\r\n __extends(Envelope, _super);\r\n /**\r\n * Constructs a new instance of telemetry data.\r\n */\r\n function Envelope(logger, data, name) {\r\n var _this = _super.call(this) || this;\r\n _this.name = dataSanitizeString(logger, name) || strNotSpecified;\r\n _this.data = data;\r\n _this.time = toISOString(new Date());\r\n _this.aiDataContract = {\r\n time: 1 /* Required */,\r\n iKey: 1 /* Required */,\r\n name: 1 /* Required */,\r\n sampleRate: function () {\r\n return (_this.sampleRate === 100) ? 4 /* Hidden */ : 1 /* Required */;\r\n },\r\n tags: 1 /* Required */,\r\n data: 1 /* Required */\r\n };\r\n return _this;\r\n }\r\n return Envelope;\r\n}(AIEnvelope));\r\nexport { Envelope };\r\n//# sourceMappingURL=Envelope.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\n/**\r\n * Data struct to contain only C section with custom fields.\r\n */\r\nvar Base = /** @class */ (function () {\r\n function Base() {\r\n }\r\n return Base;\r\n}());\r\nexport { Base };\r\n//# sourceMappingURL=Base.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport { Data as AIData } from \"../../Interfaces/Contracts/Generated/Data\";\r\nvar Data = /** @class */ (function (_super) {\r\n __extends(Data, _super);\r\n /**\r\n * Constructs a new instance of telemetry data.\r\n */\r\n function Data(baseType, data) {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * The data contract for serializing this object.\r\n */\r\n _this.aiDataContract = {\r\n baseType: 1 /* Required */,\r\n baseData: 1 /* Required */\r\n };\r\n _this.baseType = baseType;\r\n _this.baseData = data;\r\n return _this;\r\n }\r\n return Data;\r\n}(AIData));\r\nexport { Data };\r\n//# sourceMappingURL=Data.js.map","import { __assign } from \"tslib\";\r\nimport { Data, Envelope, RemoteDependencyData, Event, Exception, Metric, PageView, Trace, PageViewPerformance, CtxTagKeys, HttpMethod, SampleRate, dataSanitizeString } from \"@microsoft/applicationinsights-common\";\r\nimport { LoggingSeverity, _InternalMessageId, hasJSON, getJSON, objForEachKey, isNullOrUndefined, isNumber, isString, toISOString, setValue, isTruthy, optimizeObject } from \"@microsoft/applicationinsights-core-js\";\r\n// these two constants are used to filter out properties not needed when trying to extract custom properties and measurements from the incoming payload\r\nvar strBaseType = \"baseType\";\r\nvar strBaseData = \"baseData\";\r\nvar strProperties = \"properties\";\r\nvar strTrue = \"true\";\r\nfunction _setValueIf(target, field, value) {\r\n return setValue(target, field, value, isTruthy);\r\n}\r\n/*\r\n * Maps Part A data from CS 4.0\r\n */\r\nfunction _extractPartAExtensions(logger, item, env) {\r\n // todo: switch to keys from common in this method\r\n var envTags = env.tags = env.tags || {};\r\n var itmExt = item.ext = item.ext || {};\r\n var itmTags = item.tags = item.tags || [];\r\n var extUser = itmExt.user;\r\n if (extUser) {\r\n _setValueIf(envTags, CtxTagKeys.userAuthUserId, extUser.authId);\r\n _setValueIf(envTags, CtxTagKeys.userId, extUser.id || extUser.localId);\r\n }\r\n var extApp = itmExt.app;\r\n if (extApp) {\r\n _setValueIf(envTags, CtxTagKeys.sessionId, extApp.sesId);\r\n }\r\n var extDevice = itmExt.device;\r\n if (extDevice) {\r\n _setValueIf(envTags, CtxTagKeys.deviceId, extDevice.id || extDevice.localId);\r\n _setValueIf(envTags, CtxTagKeys.deviceType, extDevice.deviceClass);\r\n _setValueIf(envTags, CtxTagKeys.deviceIp, extDevice.ip);\r\n _setValueIf(envTags, CtxTagKeys.deviceModel, extDevice.model);\r\n _setValueIf(envTags, CtxTagKeys.deviceType, extDevice.deviceType);\r\n }\r\n var web = item.ext.web;\r\n if (web) {\r\n _setValueIf(envTags, CtxTagKeys.deviceLanguage, web.browserLang);\r\n _setValueIf(envTags, CtxTagKeys.deviceBrowserVersion, web.browserVer);\r\n _setValueIf(envTags, CtxTagKeys.deviceBrowser, web.browser);\r\n var envData = env.data = env.data || {};\r\n var envBaseData = envData[strBaseData] = envData[strBaseData] || {};\r\n var envProps = envBaseData[strProperties] = envBaseData[strProperties] || {};\r\n _setValueIf(envProps, \"domain\", web.domain);\r\n _setValueIf(envProps, \"isManual\", web.isManual ? strTrue : null);\r\n _setValueIf(envProps, \"screenRes\", web.screenRes);\r\n _setValueIf(envProps, \"userConsent\", web.userConsent ? strTrue : null);\r\n }\r\n var extOs = itmExt.os;\r\n if (extOs) {\r\n _setValueIf(envTags, CtxTagKeys.deviceOS, extOs.name);\r\n }\r\n // No support for mapping Trace.traceState to 2.0 as it is currently empty\r\n var extTrace = itmExt.trace;\r\n if (extTrace) {\r\n _setValueIf(envTags, CtxTagKeys.operationParentId, extTrace.parentID);\r\n _setValueIf(envTags, CtxTagKeys.operationName, dataSanitizeString(logger, extTrace.name));\r\n _setValueIf(envTags, CtxTagKeys.operationId, extTrace.traceID);\r\n }\r\n // Sample 4.0 schema\r\n // {\r\n // \"time\" : \"2018-09-05T22:51:22.4936Z\",\r\n // \"name\" : \"MetricWithNamespace\",\r\n // \"iKey\" : \"ABC-5a4cbd20-e601-4ef5-a3c6-5d6577e4398e\",\r\n // \"ext\": { \"cloud\": {\r\n // \"role\": \"WATSON3\",\r\n // \"roleInstance\": \"CO4AEAP00000260\"\r\n // },\r\n // \"device\": {}, \"correlation\": {} },\r\n // \"tags\": [\r\n // { \"amazon.region\" : \"east2\" },\r\n // { \"os.expid\" : \"wp:02df239\" }\r\n // ]\r\n // }\r\n var tgs = {};\r\n // deals with tags.push({object})\r\n for (var i = itmTags.length - 1; i >= 0; i--) {\r\n var tg = itmTags[i];\r\n objForEachKey(tg, function (key, value) {\r\n tgs[key] = value;\r\n });\r\n itmTags.splice(i, 1);\r\n }\r\n // deals with tags[key]=value (and handles hasOwnProperty)\r\n objForEachKey(itmTags, function (tg, value) {\r\n tgs[tg] = value;\r\n });\r\n var theTags = __assign(__assign({}, envTags), tgs);\r\n if (!theTags[CtxTagKeys.internalSdkVersion]) {\r\n // Append a version in case it is not already set\r\n theTags[CtxTagKeys.internalSdkVersion] = \"javascript:\" + EnvelopeCreator.Version;\r\n }\r\n env.tags = optimizeObject(theTags);\r\n}\r\nfunction _extractPropsAndMeasurements(data, properties, measurements) {\r\n if (!isNullOrUndefined(data)) {\r\n objForEachKey(data, function (key, value) {\r\n if (isNumber(value)) {\r\n measurements[key] = value;\r\n }\r\n else if (isString(value)) {\r\n properties[key] = value;\r\n }\r\n else if (hasJSON()) {\r\n properties[key] = getJSON().stringify(value);\r\n }\r\n });\r\n }\r\n}\r\nfunction _convertPropsUndefinedToCustomDefinedValue(properties, customUndefinedValue) {\r\n if (!isNullOrUndefined(properties)) {\r\n objForEachKey(properties, function (key, value) {\r\n properties[key] = value || customUndefinedValue;\r\n });\r\n }\r\n}\r\n// TODO: Do we want this to take logger as arg or use this._logger as nonstatic?\r\nfunction _createEnvelope(logger, envelopeType, telemetryItem, data) {\r\n var envelope = new Envelope(logger, data, envelopeType);\r\n _setValueIf(envelope, \"sampleRate\", telemetryItem[SampleRate]);\r\n if ((telemetryItem[strBaseData] || {}).startTime) {\r\n envelope.time = toISOString(telemetryItem[strBaseData].startTime);\r\n }\r\n envelope.iKey = telemetryItem.iKey;\r\n var iKeyNoDashes = telemetryItem.iKey.replace(/-/g, \"\");\r\n envelope.name = envelope.name.replace(\"{0}\", iKeyNoDashes);\r\n // extract all extensions from ctx\r\n _extractPartAExtensions(logger, telemetryItem, envelope);\r\n // loop through the envelope tags (extension of Part A) and pick out the ones that should go in outgoing envelope tags\r\n telemetryItem.tags = telemetryItem.tags || [];\r\n return optimizeObject(envelope);\r\n}\r\nfunction EnvelopeCreatorInit(logger, telemetryItem) {\r\n if (isNullOrUndefined(telemetryItem[strBaseData])) {\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, \"telemetryItem.baseData cannot be null.\");\r\n }\r\n}\r\nexport var EnvelopeCreator = {\r\n Version: \"2.7.1\"\r\n};\r\nexport function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {\r\n EnvelopeCreatorInit(logger, telemetryItem);\r\n var customMeasurements = telemetryItem[strBaseData].measurements || {};\r\n var customProperties = telemetryItem[strBaseData][strProperties] || {};\r\n _extractPropsAndMeasurements(telemetryItem.data, customProperties, customMeasurements);\r\n if (!isNullOrUndefined(customUndefinedValue)) {\r\n _convertPropsUndefinedToCustomDefinedValue(customProperties, customUndefinedValue);\r\n }\r\n var bd = telemetryItem[strBaseData];\r\n if (isNullOrUndefined(bd)) {\r\n logger.warnToConsole(\"Invalid input for dependency data\");\r\n return null;\r\n }\r\n var method = bd[strProperties] && bd[strProperties][HttpMethod] ? bd[strProperties][HttpMethod] : \"GET\";\r\n var remoteDepData = new RemoteDependencyData(logger, bd.id, bd.target, bd.name, bd.duration, bd.success, bd.responseCode, method, bd.type, bd.correlationContext, customProperties, customMeasurements);\r\n var data = new Data(RemoteDependencyData.dataType, remoteDepData);\r\n return _createEnvelope(logger, RemoteDependencyData.envelopeType, telemetryItem, data);\r\n}\r\nexport function EventEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {\r\n EnvelopeCreatorInit(logger, telemetryItem);\r\n var customProperties = {};\r\n var customMeasurements = {};\r\n if (telemetryItem[strBaseType] !== Event.dataType) {\r\n customProperties[\"baseTypeSource\"] = telemetryItem[strBaseType]; // save the passed in base type as a property\r\n }\r\n if (telemetryItem[strBaseType] === Event.dataType) { // take collection\r\n customProperties = telemetryItem[strBaseData][strProperties] || {};\r\n customMeasurements = telemetryItem[strBaseData].measurements || {};\r\n }\r\n else { // if its not a known type, convert to custom event\r\n if (telemetryItem[strBaseData]) {\r\n _extractPropsAndMeasurements(telemetryItem[strBaseData], customProperties, customMeasurements);\r\n }\r\n }\r\n // Extract root level properties from part C telemetryItem.data\r\n _extractPropsAndMeasurements(telemetryItem.data, customProperties, customMeasurements);\r\n if (!isNullOrUndefined(customUndefinedValue)) {\r\n _convertPropsUndefinedToCustomDefinedValue(customProperties, customUndefinedValue);\r\n }\r\n var eventName = telemetryItem[strBaseData].name;\r\n var eventData = new Event(logger, eventName, customProperties, customMeasurements);\r\n var data = new Data(Event.dataType, eventData);\r\n return _createEnvelope(logger, Event.envelopeType, telemetryItem, data);\r\n}\r\nexport function ExceptionEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {\r\n EnvelopeCreatorInit(logger, telemetryItem);\r\n // Extract root level properties from part C telemetryItem.data\r\n var customMeasurements = telemetryItem[strBaseData].measurements || {};\r\n var customProperties = telemetryItem[strBaseData][strProperties] || {};\r\n _extractPropsAndMeasurements(telemetryItem.data, customProperties, customMeasurements);\r\n if (!isNullOrUndefined(customUndefinedValue)) {\r\n _convertPropsUndefinedToCustomDefinedValue(customProperties, customUndefinedValue);\r\n }\r\n var bd = telemetryItem[strBaseData];\r\n var exData = Exception.CreateFromInterface(logger, bd, customProperties, customMeasurements);\r\n var data = new Data(Exception.dataType, exData);\r\n return _createEnvelope(logger, Exception.envelopeType, telemetryItem, data);\r\n}\r\nexport function MetricEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {\r\n EnvelopeCreatorInit(logger, telemetryItem);\r\n var baseData = telemetryItem[strBaseData];\r\n var props = baseData[strProperties] || {};\r\n var measurements = baseData.measurements || {};\r\n _extractPropsAndMeasurements(telemetryItem.data, props, measurements);\r\n if (!isNullOrUndefined(customUndefinedValue)) {\r\n _convertPropsUndefinedToCustomDefinedValue(props, customUndefinedValue);\r\n }\r\n var baseMetricData = new Metric(logger, baseData.name, baseData.average, baseData.sampleCount, baseData.min, baseData.max, props, measurements);\r\n var data = new Data(Metric.dataType, baseMetricData);\r\n return _createEnvelope(logger, Metric.envelopeType, telemetryItem, data);\r\n}\r\nexport function PageViewEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {\r\n EnvelopeCreatorInit(logger, telemetryItem);\r\n // Since duration is not part of the domain properties in Common Schema, extract it from part C\r\n var strDuration = \"duration\";\r\n var duration;\r\n var baseData = telemetryItem[strBaseData];\r\n if (!isNullOrUndefined(baseData) &&\r\n !isNullOrUndefined(baseData[strProperties]) &&\r\n !isNullOrUndefined(baseData[strProperties][strDuration])) { // from part B properties\r\n duration = baseData[strProperties][strDuration];\r\n delete baseData[strProperties][strDuration];\r\n }\r\n else if (!isNullOrUndefined(telemetryItem.data) &&\r\n !isNullOrUndefined(telemetryItem.data[strDuration])) { // from custom properties\r\n duration = telemetryItem.data[strDuration];\r\n delete telemetryItem.data[strDuration];\r\n }\r\n var bd = telemetryItem[strBaseData];\r\n // special case: pageview.id is grabbed from current operation id. Analytics plugin is decoupled from properties plugin, so this is done here instead. This can be made a default telemetry intializer instead if needed to be decoupled from channel\r\n var currentContextId;\r\n if (((telemetryItem.ext || {}).trace || {}).traceID) {\r\n currentContextId = telemetryItem.ext.trace.traceID;\r\n }\r\n var id = bd.id || currentContextId;\r\n var name = bd.name;\r\n var url = bd.uri;\r\n var properties = bd[strProperties] || {};\r\n var measurements = bd.measurements || {};\r\n // refUri is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property\r\n if (!isNullOrUndefined(bd.refUri)) {\r\n properties[\"refUri\"] = bd.refUri;\r\n }\r\n // pageType is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property\r\n if (!isNullOrUndefined(bd.pageType)) {\r\n properties[\"pageType\"] = bd.pageType;\r\n }\r\n // isLoggedIn is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property\r\n if (!isNullOrUndefined(bd.isLoggedIn)) {\r\n properties[\"isLoggedIn\"] = bd.isLoggedIn.toString();\r\n }\r\n // pageTags is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property\r\n if (!isNullOrUndefined(bd[strProperties])) {\r\n var pageTags = bd[strProperties];\r\n objForEachKey(pageTags, function (key, value) {\r\n properties[key] = value;\r\n });\r\n }\r\n _extractPropsAndMeasurements(telemetryItem.data, properties, measurements);\r\n if (!isNullOrUndefined(customUndefinedValue)) {\r\n _convertPropsUndefinedToCustomDefinedValue(properties, customUndefinedValue);\r\n }\r\n var pageViewData = new PageView(logger, name, url, duration, properties, measurements, id);\r\n var data = new Data(PageView.dataType, pageViewData);\r\n return _createEnvelope(logger, PageView.envelopeType, telemetryItem, data);\r\n}\r\nexport function PageViewPerformanceEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {\r\n EnvelopeCreatorInit(logger, telemetryItem);\r\n var bd = telemetryItem[strBaseData];\r\n var name = bd.name;\r\n var url = bd.uri || bd.url;\r\n var properties = bd[strProperties] || {};\r\n var measurements = bd.measurements || {};\r\n _extractPropsAndMeasurements(telemetryItem.data, properties, measurements);\r\n if (!isNullOrUndefined(customUndefinedValue)) {\r\n _convertPropsUndefinedToCustomDefinedValue(properties, customUndefinedValue);\r\n }\r\n var baseData = new PageViewPerformance(logger, name, url, undefined, properties, measurements, bd);\r\n var data = new Data(PageViewPerformance.dataType, baseData);\r\n return _createEnvelope(logger, PageViewPerformance.envelopeType, telemetryItem, data);\r\n}\r\nexport function TraceEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {\r\n EnvelopeCreatorInit(logger, telemetryItem);\r\n var message = telemetryItem[strBaseData].message;\r\n var severityLevel = telemetryItem[strBaseData].severityLevel;\r\n var props = telemetryItem[strBaseData][strProperties] || {};\r\n var measurements = telemetryItem[strBaseData].measurements || {};\r\n _extractPropsAndMeasurements(telemetryItem.data, props, measurements);\r\n if (!isNullOrUndefined(customUndefinedValue)) {\r\n _convertPropsUndefinedToCustomDefinedValue(props, customUndefinedValue);\r\n }\r\n var baseData = new Trace(logger, message, severityLevel, props, measurements);\r\n var data = new Data(Trace.dataType, baseData);\r\n return _createEnvelope(logger, Trace.envelopeType, telemetryItem, data);\r\n}\r\n//# sourceMappingURL=EnvelopeCreator.js.map","import { LoggingSeverity, _InternalMessageId, getJSON, objForEachKey, isFunction, isObject, isArray } from \"@microsoft/applicationinsights-core-js\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nvar Serializer = /** @class */ (function () {\r\n function Serializer(logger) {\r\n dynamicProto(Serializer, this, function (_self) {\r\n /**\r\n * Serializes the current object to a JSON string.\r\n */\r\n _self.serialize = function (input) {\r\n var output = _serializeObject(input, \"root\");\r\n try {\r\n return getJSON().stringify(output);\r\n }\r\n catch (e) {\r\n // if serialization fails return an empty string\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && isFunction(e.toString)) ? e.toString() : \"Error serializing object\", null, true);\r\n }\r\n };\r\n function _serializeObject(source, name) {\r\n var circularReferenceCheck = \"__aiCircularRefCheck\";\r\n var output = {};\r\n if (!source) {\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, \"cannot serialize object because it is null or undefined\", { name: name }, true);\r\n return output;\r\n }\r\n if (source[circularReferenceCheck]) {\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CircularReferenceDetected, \"Circular reference detected while serializing object\", { name: name }, true);\r\n return output;\r\n }\r\n if (!source.aiDataContract) {\r\n // special case for measurements/properties/tags\r\n if (name === \"measurements\") {\r\n output = _serializeStringMap(source, \"number\", name);\r\n }\r\n else if (name === \"properties\") {\r\n output = _serializeStringMap(source, \"string\", name);\r\n }\r\n else if (name === \"tags\") {\r\n output = _serializeStringMap(source, \"string\", name);\r\n }\r\n else if (isArray(source)) {\r\n output = _serializeArray(source, name);\r\n }\r\n else {\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, \"Attempting to serialize an object which does not implement ISerializable\", { name: name }, true);\r\n try {\r\n // verify that the object can be stringified\r\n getJSON().stringify(source);\r\n output = source;\r\n }\r\n catch (e) {\r\n // if serialization fails return an empty string\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && isFunction(e.toString)) ? e.toString() : \"Error serializing object\", null, true);\r\n }\r\n }\r\n return output;\r\n }\r\n source[circularReferenceCheck] = true;\r\n objForEachKey(source.aiDataContract, function (field, contract) {\r\n var isRequired = (isFunction(contract)) ? (contract() & 1 /* Required */) : (contract & 1 /* Required */);\r\n var isHidden = (isFunction(contract)) ? (contract() & 4 /* Hidden */) : (contract & 4 /* Hidden */);\r\n var isArray = contract & 2 /* Array */;\r\n var isPresent = source[field] !== undefined;\r\n var isObj = isObject(source[field]) && source[field] !== null;\r\n if (isRequired && !isPresent && !isArray) {\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.MissingRequiredFieldSpecification, \"Missing required field specification. The field is required but not present on source\", { field: field, name: name });\r\n // If not in debug mode, continue and hope the error is permissible\r\n }\r\n else if (!isHidden) { // Don't serialize hidden fields\r\n var value = void 0;\r\n if (isObj) {\r\n if (isArray) {\r\n // special case; recurse on each object in the source array\r\n value = _serializeArray(source[field], field);\r\n }\r\n else {\r\n // recurse on the source object in this field\r\n value = _serializeObject(source[field], field);\r\n }\r\n }\r\n else {\r\n // assign the source field to the output even if undefined or required\r\n value = source[field];\r\n }\r\n // only emit this field if the value is defined\r\n if (value !== undefined) {\r\n output[field] = value;\r\n }\r\n }\r\n });\r\n delete source[circularReferenceCheck];\r\n return output;\r\n }\r\n function _serializeArray(sources, name) {\r\n var output;\r\n if (!!sources) {\r\n if (!isArray(sources)) {\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ItemNotInArray, \"This field was specified as an array in the contract but the item is not an array.\\r\\n\", { name: name }, true);\r\n }\r\n else {\r\n output = [];\r\n for (var i = 0; i < sources.length; i++) {\r\n var source = sources[i];\r\n var item = _serializeObject(source, name + \"[\" + i + \"]\");\r\n output.push(item);\r\n }\r\n }\r\n }\r\n return output;\r\n }\r\n function _serializeStringMap(map, expectedType, name) {\r\n var output;\r\n if (map) {\r\n output = {};\r\n objForEachKey(map, function (field, value) {\r\n if (expectedType === \"string\") {\r\n if (value === undefined) {\r\n output[field] = \"undefined\";\r\n }\r\n else if (value === null) {\r\n output[field] = \"null\";\r\n }\r\n else if (!value.toString) {\r\n output[field] = \"invalid field: toString() is not defined.\";\r\n }\r\n else {\r\n output[field] = value.toString();\r\n }\r\n }\r\n else if (expectedType === \"number\") {\r\n if (value === undefined) {\r\n output[field] = \"undefined\";\r\n }\r\n else if (value === null) {\r\n output[field] = \"null\";\r\n }\r\n else {\r\n var num = parseFloat(value);\r\n if (isNaN(num)) {\r\n output[field] = \"NaN\";\r\n }\r\n else {\r\n output[field] = num;\r\n }\r\n }\r\n }\r\n else {\r\n output[field] = \"invalid field: \" + name + \" is of unknown type.\";\r\n logger.throwInternal(LoggingSeverity.CRITICAL, output[field], null, true);\r\n }\r\n });\r\n }\r\n return output;\r\n }\r\n });\r\n }\r\n /**\r\n * Serializes the current object to a JSON string.\r\n */\r\n Serializer.prototype.serialize = function (input) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return Serializer;\r\n}());\r\nexport { Serializer };\r\n//# sourceMappingURL=Serializer.js.map","var _a;\r\nimport { __assign, __extends } from \"tslib\";\r\nimport { SessionStorageSendBuffer, ArraySendBuffer } from \"./SendBuffer\";\r\nimport { DependencyEnvelopeCreator, EventEnvelopeCreator, ExceptionEnvelopeCreator, MetricEnvelopeCreator, PageViewEnvelopeCreator, PageViewPerformanceEnvelopeCreator, TraceEnvelopeCreator } from \"./EnvelopeCreator\";\r\nimport { Serializer } from \"./Serializer\"; // todo move to channel\r\nimport { DisabledPropertyName, RequestHeaders, PageView, Event, Trace, Exception, Metric, PageViewPerformance, RemoteDependencyData, ProcessLegacy, BreezeChannelIdentifier, SampleRate, isInternalApplicationInsightsEndpoint, utlCanUseSessionStorage } from \"@microsoft/applicationinsights-common\";\r\nimport { _InternalMessageId, LoggingSeverity, getWindow, getNavigator, getJSON, BaseTelemetryPlugin, objForEachKey, isNullOrUndefined, arrForEach, dateNow, dumpObj, getExceptionName, getIEVersion, throwError, objKeys, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported, isArray } from \"@microsoft/applicationinsights-core-js\";\r\nimport { Offline } from \"./Offline\";\r\nimport { Sample } from \"./TelemetryProcessors/Sample\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nvar FetchSyncRequestSizeLimitBytes = 65000; // approx 64kb (the current Edge, Firefox and Chrome max limit)\r\nfunction _getResponseText(xhr) {\r\n try {\r\n return xhr.responseText;\r\n }\r\n catch (e) {\r\n // Best effort, as XHR may throw while XDR wont so just ignore\r\n }\r\n return null;\r\n}\r\nfunction _getDefaultAppInsightsChannelConfig() {\r\n // set default values\r\n return {\r\n endpointUrl: function () { return \"https://dc.services.visualstudio.com/v2/track\"; },\r\n emitLineDelimitedJson: function () { return false; },\r\n maxBatchInterval: function () { return 15000; },\r\n maxBatchSizeInBytes: function () { return 102400; },\r\n disableTelemetry: function () { return false; },\r\n enableSessionStorageBuffer: function () { return true; },\r\n isRetryDisabled: function () { return false; },\r\n isBeaconApiDisabled: function () { return true; },\r\n disableXhr: function () { return false; },\r\n onunloadDisableFetch: function () { return false; },\r\n onunloadDisableBeacon: function () { return false; },\r\n instrumentationKey: function () { return undefined; },\r\n namePrefix: function () { return undefined; },\r\n samplingPercentage: function () { return 100; },\r\n customHeaders: function () { return undefined; },\r\n convertUndefined: function () { return undefined; },\r\n eventsLimitInMem: function () { return 10000; }\r\n };\r\n}\r\nvar EnvelopeTypeCreator = (_a = {},\r\n _a[Event.dataType] = EventEnvelopeCreator,\r\n _a[Trace.dataType] = TraceEnvelopeCreator,\r\n _a[PageView.dataType] = PageViewEnvelopeCreator,\r\n _a[PageViewPerformance.dataType] = PageViewPerformanceEnvelopeCreator,\r\n _a[Exception.dataType] = ExceptionEnvelopeCreator,\r\n _a[Metric.dataType] = MetricEnvelopeCreator,\r\n _a[RemoteDependencyData.dataType] = DependencyEnvelopeCreator,\r\n _a);\r\nvar Sender = /** @class */ (function (_super) {\r\n __extends(Sender, _super);\r\n function Sender() {\r\n var _this = _super.call(this) || this;\r\n _this.priority = 1001;\r\n _this.identifier = BreezeChannelIdentifier;\r\n /**\r\n * How many times in a row a retryable error condition has occurred.\r\n */\r\n var _consecutiveErrors;\r\n /**\r\n * The time to retry at in milliseconds from 1970/01/01 (this makes the timer calculation easy).\r\n */\r\n var _retryAt;\r\n /**\r\n * The time of the last send operation.\r\n */\r\n var _lastSend;\r\n /**\r\n * Flag indicating that the sending should be paused\r\n */\r\n var _paused = false;\r\n /**\r\n * Handle to the timer for delayed sending of batches of data.\r\n */\r\n var _timeoutHandle;\r\n var _serializer;\r\n var _stamp_specific_redirects;\r\n var _headers = {};\r\n // Keep track of the outstanding sync fetch payload total (as sync fetch has limits)\r\n var _syncFetchPayload = 0;\r\n /**\r\n * The sender to use if the payload size is too large\r\n */\r\n var _fallbackSender;\r\n /**\r\n * The identified sender to use for the synchronous unload stage\r\n */\r\n var _syncUnloadSender;\r\n _this._senderConfig = _getDefaultAppInsightsChannelConfig();\r\n dynamicProto(Sender, _this, function (_self, _base) {\r\n function _notImplemented() {\r\n throwError(\"Method not implemented.\");\r\n }\r\n _self.pause = function () {\r\n _clearScheduledTimer();\r\n _paused = true;\r\n };\r\n _self.resume = function () {\r\n if (_paused) {\r\n _paused = false;\r\n _retryAt = null;\r\n // flush if we have exceeded the max-size already\r\n if (_self._buffer.size() > _self._senderConfig.maxBatchSizeInBytes()) {\r\n _self.triggerSend(true, null, 10 /* MaxBatchSize */);\r\n }\r\n _setupTimer();\r\n }\r\n };\r\n _self.flush = function () {\r\n if (!_paused) {\r\n // Clear the normal schedule timer as we are going to try and flush ASAP\r\n _clearScheduledTimer();\r\n try {\r\n _self.triggerSend(true, null, 1 /* ManualFlush */);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FlushFailed, \"flush failed, telemetry will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n };\r\n _self.onunloadFlush = function () {\r\n if (!_paused) {\r\n if ((_self._senderConfig.onunloadDisableBeacon() === false || _self._senderConfig.isBeaconApiDisabled() === false) && isBeaconsSupported()) {\r\n try {\r\n _self.triggerSend(true, _doUnloadSend, 2 /* Unload */);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToSendQueuedTelemetry, \"failed to flush with beacon sender on page unload, telemetry will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n else {\r\n _self.flush();\r\n }\r\n }\r\n };\r\n _self.teardown = _notImplemented;\r\n _self.addHeader = function (name, value) {\r\n _headers[name] = value;\r\n };\r\n _self.initialize = function (config, core, extensions, pluginChain) {\r\n _base.initialize(config, core, extensions, pluginChain);\r\n var ctx = _self._getTelCtx();\r\n var identifier = _self.identifier;\r\n _serializer = new Serializer(core.logger);\r\n _consecutiveErrors = 0;\r\n _retryAt = null;\r\n _lastSend = 0;\r\n _self._sender = null;\r\n _stamp_specific_redirects = 0;\r\n var diagLog = _self.diagLog();\r\n var defaultConfig = _getDefaultAppInsightsChannelConfig();\r\n objForEachKey(defaultConfig, function (field, value) {\r\n _self._senderConfig[field] = function () { return ctx.getConfig(identifier, field, value()); };\r\n });\r\n _self._buffer = (_self._senderConfig.enableSessionStorageBuffer() && utlCanUseSessionStorage())\r\n ? new SessionStorageSendBuffer(diagLog, _self._senderConfig) : new ArraySendBuffer(diagLog, _self._senderConfig);\r\n _self._sample = new Sample(_self._senderConfig.samplingPercentage(), diagLog);\r\n if (!_validateInstrumentationKey(config)) {\r\n diagLog.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidInstrumentationKey, \"Invalid Instrumentation key \" + config.instrumentationKey);\r\n }\r\n if (!isInternalApplicationInsightsEndpoint(_self._senderConfig.endpointUrl()) && _self._senderConfig.customHeaders() && _self._senderConfig.customHeaders().length > 0) {\r\n arrForEach(_self._senderConfig.customHeaders(), function (customHeader) {\r\n _this.addHeader(customHeader.header, customHeader.value);\r\n });\r\n }\r\n var senderConfig = _self._senderConfig;\r\n var sendPostFunc = null;\r\n if (!senderConfig.disableXhr() && useXDomainRequest()) {\r\n sendPostFunc = _xdrSender; // IE 8 and 9\r\n }\r\n else if (!senderConfig.disableXhr() && isXhrSupported()) {\r\n sendPostFunc = _xhrSender;\r\n }\r\n if (!sendPostFunc && isFetchSupported()) {\r\n sendPostFunc = _fetchSender;\r\n }\r\n // always fallback to XHR\r\n _fallbackSender = sendPostFunc || _xhrSender;\r\n if (!senderConfig.isBeaconApiDisabled() && isBeaconsSupported()) {\r\n // Config is set to always used beacon sending\r\n sendPostFunc = _beaconSender;\r\n }\r\n _self._sender = sendPostFunc || _xhrSender;\r\n if (!senderConfig.onunloadDisableFetch() && isFetchSupported(true)) {\r\n // Try and use the fetch with keepalive\r\n _syncUnloadSender = _fetchKeepAliveSender;\r\n }\r\n else if (isBeaconsSupported()) {\r\n // Try and use sendBeacon\r\n _syncUnloadSender = _beaconSender;\r\n }\r\n else if (!senderConfig.disableXhr() && useXDomainRequest()) {\r\n _syncUnloadSender = _xdrSender; // IE 8 and 9\r\n }\r\n else if (!senderConfig.disableXhr() && isXhrSupported()) {\r\n _syncUnloadSender = _xhrSender;\r\n }\r\n else {\r\n _syncUnloadSender = _fallbackSender;\r\n }\r\n };\r\n _self.processTelemetry = function (telemetryItem, itemCtx) {\r\n itemCtx = _self._getTelCtx(itemCtx);\r\n try {\r\n // if master off switch is set, don't send any data\r\n if (_self._senderConfig.disableTelemetry()) {\r\n // Do not send/save data\r\n return;\r\n }\r\n // validate input\r\n if (!telemetryItem) {\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSendEmptyTelemetry, \"Cannot send empty telemetry\");\r\n return;\r\n }\r\n // validate event\r\n if (telemetryItem.baseData && !telemetryItem.baseType) {\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidEvent, \"Cannot send telemetry without baseData and baseType\");\r\n return;\r\n }\r\n if (!telemetryItem.baseType) {\r\n // Default\r\n telemetryItem.baseType = \"EventData\";\r\n }\r\n // ensure a sender was constructed\r\n if (!_self._sender) {\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, \"Sender was not initialized\");\r\n return;\r\n }\r\n // check if this item should be sampled in, else add sampleRate tag\r\n if (!_isSampledIn(telemetryItem)) {\r\n // Item is sampled out, do not send it\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TelemetrySampledAndNotSent, \"Telemetry item was sampled out and not sent\", { SampleRate: _self._sample.sampleRate });\r\n return;\r\n }\r\n else {\r\n telemetryItem[SampleRate] = _self._sample.sampleRate;\r\n }\r\n var convertUndefined = _self._senderConfig.convertUndefined() || undefined;\r\n // construct an envelope that Application Insights endpoint can understand\r\n // if ikey of telemetry is provided and not empty, envelope will use this iKey instead of senderConfig iKey\r\n var defaultEnvelopeIkey = telemetryItem.iKey || _self._senderConfig.instrumentationKey();\r\n var aiEnvelope_1 = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, itemCtx.diagLog(), convertUndefined);\r\n if (!aiEnvelope_1) {\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CreateEnvelopeError, \"Unable to create an AppInsights envelope\");\r\n return;\r\n }\r\n var doNotSendItem_1 = false;\r\n // this is for running in legacy mode, where customer may already have a custom initializer present\r\n if (telemetryItem.tags && telemetryItem.tags[ProcessLegacy]) {\r\n arrForEach(telemetryItem.tags[ProcessLegacy], function (callBack) {\r\n try {\r\n if (callBack && callBack(aiEnvelope_1) === false) {\r\n doNotSendItem_1 = true;\r\n itemCtx.diagLog().warnToConsole(\"Telemetry processor check returns false\");\r\n }\r\n }\r\n catch (e) {\r\n // log error but dont stop executing rest of the telemetry initializers\r\n // doNotSendItem = true;\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, \"One of telemetry initializers failed, telemetry item will not be sent: \" + getExceptionName(e), { exception: dumpObj(e) }, true);\r\n }\r\n });\r\n delete telemetryItem.tags[ProcessLegacy];\r\n }\r\n if (doNotSendItem_1) {\r\n return; // do not send, no need to execute next plugin\r\n }\r\n // check if the incoming payload is too large, truncate if necessary\r\n var payload = _serializer.serialize(aiEnvelope_1);\r\n // flush if we would exceed the max-size limit by adding this item\r\n var buffer = _self._buffer;\r\n var bufferSize = buffer.size();\r\n if ((bufferSize + payload.length) > _self._senderConfig.maxBatchSizeInBytes()) {\r\n _self.triggerSend(true, null, 10 /* MaxBatchSize */);\r\n }\r\n // enqueue the payload\r\n buffer.enqueue(payload);\r\n // ensure an invocation timeout is set\r\n _setupTimer();\r\n }\r\n catch (e) {\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedAddingTelemetryToBuffer, \"Failed adding telemetry to the sender's buffer, some telemetry will be lost: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n // hand off the telemetry item to the next plugin\r\n _self.processNext(telemetryItem, itemCtx);\r\n };\r\n /**\r\n * xhr state changes\r\n */\r\n _self._xhrReadyStateChange = function (xhr, payload, countOfItemsInPayload) {\r\n if (xhr.readyState === 4) {\r\n _checkResponsStatus(xhr.status, payload, xhr.responseURL, countOfItemsInPayload, _formatErrorMessageXhr(xhr), _getResponseText(xhr) || xhr.response);\r\n }\r\n };\r\n /**\r\n * Immediately send buffered data\r\n * @param async {boolean} - Indicates if the events should be sent asynchronously\r\n * @param forcedSender {SenderFunction} - Indicates the forcedSender, undefined if not passed\r\n */\r\n _self.triggerSend = function (async, forcedSender, sendReason) {\r\n if (async === void 0) { async = true; }\r\n if (!_paused) {\r\n try {\r\n var buffer = _self._buffer;\r\n // Send data only if disableTelemetry is false\r\n if (!_self._senderConfig.disableTelemetry()) {\r\n if (buffer.count() > 0) {\r\n var payload = buffer.getItems();\r\n _notifySendRequest(sendReason || 0 /* Undefined */, async);\r\n // invoke send\r\n if (forcedSender) {\r\n forcedSender.call(_this, payload, async);\r\n }\r\n else {\r\n _self._sender(payload, async);\r\n }\r\n }\r\n // update lastSend time to enable throttling\r\n _lastSend = +new Date;\r\n }\r\n else {\r\n buffer.clear();\r\n }\r\n _clearScheduledTimer();\r\n }\r\n catch (e) {\r\n /* Ignore this error for IE under v10 */\r\n var ieVer = getIEVersion();\r\n if (!ieVer || ieVer > 9) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TransmissionFailed, \"Telemetry transmission failed, some telemetry will be lost: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * error handler\r\n */\r\n _self._onError = function (payload, message, event) {\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.OnError, \"Failed to send telemetry.\", { message: message });\r\n _self._buffer.clearSent(payload);\r\n };\r\n /**\r\n * partial success handler\r\n */\r\n _self._onPartialSuccess = function (payload, results) {\r\n var failed = [];\r\n var retry = [];\r\n // Iterate through the reversed array of errors so that splicing doesn't have invalid indexes after the first item.\r\n var errors = results.errors.reverse();\r\n for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) {\r\n var error = errors_1[_i];\r\n var extracted = payload.splice(error.index, 1)[0];\r\n if (_isRetriable(error.statusCode)) {\r\n retry.push(extracted);\r\n }\r\n else {\r\n // All other errors, including: 402 (Monthly quota exceeded) and 439 (Too many requests and refresh cache).\r\n failed.push(extracted);\r\n }\r\n }\r\n if (payload.length > 0) {\r\n _self._onSuccess(payload, results.itemsAccepted);\r\n }\r\n if (failed.length > 0) {\r\n _self._onError(failed, _formatErrorMessageXhr(null, [\"partial success\", results.itemsAccepted, \"of\", results.itemsReceived].join(\" \")));\r\n }\r\n if (retry.length > 0) {\r\n _resendPayload(retry);\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, \"Partial success. \" +\r\n \"Delivered: \" + payload.length + \", Failed: \" + failed.length +\r\n \". Will retry to send \" + retry.length + \" our of \" + results.itemsReceived + \" items\");\r\n }\r\n };\r\n /**\r\n * success handler\r\n */\r\n _self._onSuccess = function (payload, countOfItemsInPayload) {\r\n _self._buffer.clearSent(payload);\r\n };\r\n /**\r\n * xdr state changes\r\n */\r\n _self._xdrOnLoad = function (xdr, payload) {\r\n var responseText = _getResponseText(xdr);\r\n if (xdr && (responseText + \"\" === \"200\" || responseText === \"\")) {\r\n _consecutiveErrors = 0;\r\n _self._onSuccess(payload, 0);\r\n }\r\n else {\r\n var results = _parseResponse(responseText);\r\n if (results && results.itemsReceived && results.itemsReceived > results.itemsAccepted\r\n && !_self._senderConfig.isRetryDisabled()) {\r\n _self._onPartialSuccess(payload, results);\r\n }\r\n else {\r\n _self._onError(payload, _formatErrorMessageXdr(xdr));\r\n }\r\n }\r\n };\r\n function _isSampledIn(envelope) {\r\n return _self._sample.isSampledIn(envelope);\r\n }\r\n function _checkResponsStatus(status, payload, responseUrl, countOfItemsInPayload, errorMessage, res) {\r\n var response = null;\r\n if (!_self._appId) {\r\n response = _parseResponse(res);\r\n if (response && response.appId) {\r\n _self._appId = response.appId;\r\n }\r\n }\r\n if ((status < 200 || status >= 300) && status !== 0) {\r\n // Update End Point url if permanent redirect or moved permanently\r\n // Updates the end point url before retry\r\n if (status === 301 || status === 307 || status === 308) {\r\n if (!_checkAndUpdateEndPointUrl(responseUrl)) {\r\n _self._onError(payload, errorMessage);\r\n return;\r\n }\r\n }\r\n if (!_self._senderConfig.isRetryDisabled() && _isRetriable(status)) {\r\n _resendPayload(payload);\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, \". \" +\r\n \"Response code \" + status + \". Will retry to send \" + payload.length + \" items.\");\r\n }\r\n else {\r\n _self._onError(payload, errorMessage);\r\n }\r\n }\r\n else if (Offline.isOffline()) { // offline\r\n // Note: Don't check for status == 0, since adblock gives this code\r\n if (!_self._senderConfig.isRetryDisabled()) {\r\n var offlineBackOffMultiplier = 10; // arbritrary number\r\n _resendPayload(payload, offlineBackOffMultiplier);\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, \". Offline - Response Code: \" + status + \". Offline status: \" + Offline.isOffline() + \". Will retry to send \" + payload.length + \" items.\");\r\n }\r\n }\r\n else {\r\n // check if the xhr's responseURL or fetch's response.url is same as endpoint url\r\n // TODO after 10 redirects force send telemetry with 'redirect=false' as query parameter.\r\n _checkAndUpdateEndPointUrl(responseUrl);\r\n if (status === 206) {\r\n if (!response) {\r\n response = _parseResponse(res);\r\n }\r\n if (response && !_self._senderConfig.isRetryDisabled()) {\r\n _self._onPartialSuccess(payload, response);\r\n }\r\n else {\r\n _self._onError(payload, errorMessage);\r\n }\r\n }\r\n else {\r\n _consecutiveErrors = 0;\r\n _self._onSuccess(payload, countOfItemsInPayload);\r\n }\r\n }\r\n }\r\n function _checkAndUpdateEndPointUrl(responseUrl) {\r\n // Maximum stamp specific redirects allowed(uncomment this when breeze is ready with not allowing redirects feature)\r\n if (_stamp_specific_redirects >= 10) {\r\n // _self._senderConfig.endpointUrl = () => Sender._getDefaultAppInsightsChannelConfig().endpointUrl()+\"/?redirect=false\";\r\n // _stamp_specific_redirects = 0;\r\n return false;\r\n }\r\n if (!isNullOrUndefined(responseUrl) && responseUrl !== \"\") {\r\n if (responseUrl !== _self._senderConfig.endpointUrl()) {\r\n _self._senderConfig.endpointUrl = function () { return responseUrl; };\r\n ++_stamp_specific_redirects;\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n function _doUnloadSend(payload, isAsync) {\r\n if (_syncUnloadSender) {\r\n // We are unloading so always call the sender with sync set to false\r\n _syncUnloadSender(payload, false);\r\n }\r\n else {\r\n // Fallback to the previous beacon Sender (which causes a CORB warning on chrome now)\r\n _beaconSender(payload, isAsync);\r\n }\r\n }\r\n function _doBeaconSend(payload) {\r\n var nav = getNavigator();\r\n var buffer = _self._buffer;\r\n var url = _self._senderConfig.endpointUrl();\r\n var batch = _self._buffer.batchPayloads(payload);\r\n // Chrome only allows CORS-safelisted values for the sendBeacon data argument\r\n // see: https://bugs.chromium.org/p/chromium/issues/detail?id=720283\r\n var plainTextBatch = new Blob([batch], { type: \"text/plain;charset=UTF-8\" });\r\n // The sendBeacon method returns true if the user agent is able to successfully queue the data for transfer. Otherwise it returns false.\r\n var queued = nav.sendBeacon(url, plainTextBatch);\r\n if (queued) {\r\n buffer.markAsSent(payload);\r\n // no response from beaconSender, clear buffer\r\n _self._onSuccess(payload, payload.length);\r\n }\r\n return queued;\r\n }\r\n /**\r\n * Send Beacon API request\r\n * @param payload {string} - The data payload to be sent.\r\n * @param isAsync {boolean} - not used\r\n * Note: Beacon API does not support custom headers and we are not able to get\r\n * appId from the backend for the correct correlation.\r\n */\r\n function _beaconSender(payload, isAsync) {\r\n if (isArray(payload) && payload.length > 0) {\r\n // The sendBeacon method returns true if the user agent is able to successfully queue the data for transfer. Otherwise it returns false.\r\n if (!_doBeaconSend(payload)) {\r\n // Failed to send entire payload so try and split data and try to send as much events as possible\r\n var droppedPayload = [];\r\n for (var lp = 0; lp < payload.length; lp++) {\r\n var thePayload = payload[lp];\r\n if (!_doBeaconSend([thePayload])) {\r\n // Can't send anymore, so split the batch and drop the rest\r\n droppedPayload.push(thePayload);\r\n }\r\n }\r\n if (droppedPayload.length > 0) {\r\n _fallbackSender(droppedPayload, true);\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, \". \" + \"Failed to send telemetry with Beacon API, retried with normal sender.\");\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Send XMLHttpRequest\r\n * @param payload {string} - The data payload to be sent.\r\n * @param isAsync {boolean} - Indicates if the request should be sent asynchronously\r\n */\r\n function _xhrSender(payload, isAsync) {\r\n var xhr = new XMLHttpRequest();\r\n var endPointUrl = _self._senderConfig.endpointUrl();\r\n try {\r\n xhr[DisabledPropertyName] = true;\r\n }\r\n catch (e) {\r\n // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would\r\n // cause the request to fail and we no telemetry would be sent\r\n }\r\n xhr.open(\"POST\", endPointUrl, isAsync);\r\n xhr.setRequestHeader(\"Content-type\", \"application/json\");\r\n // append Sdk-Context request header only in case of breeze endpoint\r\n if (isInternalApplicationInsightsEndpoint(endPointUrl)) {\r\n xhr.setRequestHeader(RequestHeaders.sdkContextHeader, RequestHeaders.sdkContextHeaderAppIdRequest);\r\n }\r\n arrForEach(objKeys(_headers), function (headerName) {\r\n xhr.setRequestHeader(headerName, _headers[headerName]);\r\n });\r\n xhr.onreadystatechange = function () { return _self._xhrReadyStateChange(xhr, payload, payload.length); };\r\n xhr.onerror = function (event) { return _self._onError(payload, _formatErrorMessageXhr(xhr), event); };\r\n // compose an array of payloads\r\n var batch = _self._buffer.batchPayloads(payload);\r\n xhr.send(batch);\r\n _self._buffer.markAsSent(payload);\r\n }\r\n function _fetchKeepAliveSender(payload, isAsync) {\r\n if (isArray(payload)) {\r\n var payloadSize = payload.length;\r\n for (var lp = 0; lp < payload.length; lp++) {\r\n payloadSize += payload[lp].length;\r\n }\r\n if ((_syncFetchPayload + payloadSize) <= FetchSyncRequestSizeLimitBytes) {\r\n _doFetchSender(payload, false);\r\n }\r\n else if (isBeaconsSupported()) {\r\n // Fallback to beacon sender as we at least get told which events can't be scheduled\r\n _beaconSender(payload, isAsync);\r\n }\r\n else {\r\n // Payload is going to be too big so just try and send via XHR\r\n _fallbackSender && _fallbackSender(payload, true);\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, \". \" + \"Failed to send telemetry with Beacon API, retried with xhrSender.\");\r\n }\r\n }\r\n }\r\n /**\r\n * Send fetch API request\r\n * @param payload {string} - The data payload to be sent.\r\n * @param isAsync {boolean} - not used\r\n */\r\n function _fetchSender(payload, isAsync) {\r\n _doFetchSender(payload, true);\r\n }\r\n /**\r\n * Send fetch API request\r\n * @param payload {string} - The data payload to be sent.\r\n * @param isAsync {boolean} - not used\r\n */\r\n function _doFetchSender(payload, isAsync) {\r\n var _a;\r\n var endPointUrl = _self._senderConfig.endpointUrl();\r\n var batch = _self._buffer.batchPayloads(payload);\r\n var plainTextBatch = new Blob([batch], { type: \"application/json\" });\r\n var requestHeaders = new Headers();\r\n var batchLength = batch.length;\r\n // append Sdk-Context request header only in case of breeze endpoint\r\n if (isInternalApplicationInsightsEndpoint(endPointUrl)) {\r\n requestHeaders.append(RequestHeaders.sdkContextHeader, RequestHeaders.sdkContextHeaderAppIdRequest);\r\n }\r\n arrForEach(objKeys(_headers), function (headerName) {\r\n requestHeaders.append(headerName, _headers[headerName]);\r\n });\r\n var init = (_a = {\r\n method: \"POST\",\r\n headers: requestHeaders,\r\n body: plainTextBatch\r\n },\r\n _a[DisabledPropertyName] = true // Mark so we don't attempt to track this request\r\n ,\r\n _a);\r\n if (!isAsync) {\r\n init.keepalive = true;\r\n _syncFetchPayload += batchLength;\r\n }\r\n var request = new Request(endPointUrl, init);\r\n try {\r\n // Also try and tag the request (just in case the value in init is not copied over)\r\n request[DisabledPropertyName] = true;\r\n }\r\n catch (e) {\r\n // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would\r\n // cause the request to fail and we no telemetry would be sent\r\n }\r\n fetch(request).then(function (response) {\r\n if (!isAsync) {\r\n _syncFetchPayload -= batchLength;\r\n batchLength = 0;\r\n }\r\n /**\r\n * The Promise returned from fetch() won’t reject on HTTP error status even if the response is an HTTP 404 or 500.\r\n * Instead, it will resolve normally (with ok status set to false), and it will only reject on network failure\r\n * or if anything prevented the request from completing.\r\n */\r\n if (!response.ok) {\r\n _self._onError(payload, response.statusText);\r\n }\r\n else {\r\n response.text().then(function (text) {\r\n _checkResponsStatus(response.status, payload, response.url, payload.length, response.statusText, text);\r\n });\r\n }\r\n })[\"catch\"](function (error) {\r\n if (!isAsync) {\r\n _syncFetchPayload -= batchLength;\r\n batchLength = 0;\r\n }\r\n _self._onError(payload, error.message);\r\n });\r\n _self._buffer.markAsSent(payload);\r\n }\r\n /**\r\n * Parses the response from the backend.\r\n * @param response - XMLHttpRequest or XDomainRequest response\r\n */\r\n function _parseResponse(response) {\r\n try {\r\n if (response && response !== \"\") {\r\n var result = getJSON().parse(response);\r\n if (result && result.itemsReceived && result.itemsReceived >= result.itemsAccepted &&\r\n result.itemsReceived - result.itemsAccepted === result.errors.length) {\r\n return result;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidBackendResponse, \"Cannot parse the response. \" + getExceptionName(e), {\r\n response: response\r\n });\r\n }\r\n return null;\r\n }\r\n /**\r\n * Resend payload. Adds payload back to the send buffer and setup a send timer (with exponential backoff).\r\n * @param payload\r\n */\r\n function _resendPayload(payload, linearFactor) {\r\n if (linearFactor === void 0) { linearFactor = 1; }\r\n if (!payload || payload.length === 0) {\r\n return;\r\n }\r\n var buffer = _self._buffer;\r\n buffer.clearSent(payload);\r\n _consecutiveErrors++;\r\n for (var _i = 0, payload_1 = payload; _i < payload_1.length; _i++) {\r\n var item = payload_1[_i];\r\n buffer.enqueue(item);\r\n }\r\n // setup timer\r\n _setRetryTime(linearFactor);\r\n _setupTimer();\r\n }\r\n /**\r\n * Calculates the time to wait before retrying in case of an error based on\r\n * http://en.wikipedia.org/wiki/Exponential_backoff\r\n */\r\n function _setRetryTime(linearFactor) {\r\n var SlotDelayInSeconds = 10;\r\n var delayInSeconds;\r\n if (_consecutiveErrors <= 1) {\r\n delayInSeconds = SlotDelayInSeconds;\r\n }\r\n else {\r\n var backOffSlot = (Math.pow(2, _consecutiveErrors) - 1) / 2;\r\n // tslint:disable-next-line:insecure-random\r\n var backOffDelay = Math.floor(Math.random() * backOffSlot * SlotDelayInSeconds) + 1;\r\n backOffDelay = linearFactor * backOffDelay;\r\n delayInSeconds = Math.max(Math.min(backOffDelay, 3600), SlotDelayInSeconds);\r\n }\r\n // TODO: Log the backoff time like the C# version does.\r\n var retryAfterTimeSpan = dateNow() + (delayInSeconds * 1000);\r\n // TODO: Log the retry at time like the C# version does.\r\n _retryAt = retryAfterTimeSpan;\r\n }\r\n /**\r\n * Sets up the timer which triggers actually sending the data.\r\n */\r\n function _setupTimer() {\r\n if (!_timeoutHandle && !_paused) {\r\n var retryInterval = _retryAt ? Math.max(0, _retryAt - dateNow()) : 0;\r\n var timerValue = Math.max(_self._senderConfig.maxBatchInterval(), retryInterval);\r\n _timeoutHandle = setTimeout(function () {\r\n _timeoutHandle = null;\r\n _self.triggerSend(true, null, 1 /* NormalSchedule */);\r\n }, timerValue);\r\n }\r\n }\r\n function _clearScheduledTimer() {\r\n clearTimeout(_timeoutHandle);\r\n _timeoutHandle = null;\r\n _retryAt = null;\r\n }\r\n /**\r\n * Checks if the SDK should resend the payload after receiving this status code from the backend.\r\n * @param statusCode\r\n */\r\n function _isRetriable(statusCode) {\r\n return statusCode === 408 // Timeout\r\n || statusCode === 429 // Too many requests.\r\n || statusCode === 500 // Internal server error.\r\n || statusCode === 503; // Service unavailable.\r\n }\r\n function _formatErrorMessageXhr(xhr, message) {\r\n if (xhr) {\r\n return \"XMLHttpRequest,Status:\" + xhr.status + \",Response:\" + _getResponseText(xhr) || xhr.response || \"\";\r\n }\r\n return message;\r\n }\r\n /**\r\n * Send XDomainRequest\r\n * @param payload {string} - The data payload to be sent.\r\n * @param isAsync {boolean} - Indicates if the request should be sent asynchronously\r\n *\r\n * Note: XDomainRequest does not support sync requests. This 'isAsync' parameter is added\r\n * to maintain consistency with the xhrSender's contract\r\n * Note: XDomainRequest does not support custom headers and we are not able to get\r\n * appId from the backend for the correct correlation.\r\n */\r\n function _xdrSender(payload, isAsync) {\r\n var buffer = _self._buffer;\r\n var _window = getWindow();\r\n var xdr = new XDomainRequest();\r\n xdr.onload = function () { return _self._xdrOnLoad(xdr, payload); };\r\n xdr.onerror = function (event) { return _self._onError(payload, _formatErrorMessageXdr(xdr), event); };\r\n // XDomainRequest requires the same protocol as the hosting page.\r\n // If the protocol doesn't match, we can't send the telemetry :(.\r\n var hostingProtocol = _window && _window.location && _window.location.protocol || \"\";\r\n if (_self._senderConfig.endpointUrl().lastIndexOf(hostingProtocol, 0) !== 0) {\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, \". \" +\r\n \"Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.\");\r\n buffer.clear();\r\n return;\r\n }\r\n var endpointUrl = _self._senderConfig.endpointUrl().replace(/^(https?:)/, \"\");\r\n xdr.open(\"POST\", endpointUrl);\r\n // compose an array of payloads\r\n var batch = buffer.batchPayloads(payload);\r\n xdr.send(batch);\r\n buffer.markAsSent(payload);\r\n }\r\n function _formatErrorMessageXdr(xdr, message) {\r\n if (xdr) {\r\n return \"XDomainRequest,Response:\" + _getResponseText(xdr) || \"\";\r\n }\r\n return message;\r\n }\r\n // Using function lookups for backward compatibility as the getNotifyMgr() did not exist until after v2.5.6\r\n function _getNotifyMgr() {\r\n var func = \"getNotifyMgr\";\r\n if (_self.core[func]) {\r\n return _self.core[func]();\r\n }\r\n // using _self.core['_notificationManager'] for backward compatibility\r\n return _self.core[\"_notificationManager\"];\r\n }\r\n function _notifySendRequest(sendRequest, isAsync) {\r\n var manager = _getNotifyMgr();\r\n if (manager && manager.eventsSendRequest) {\r\n try {\r\n manager.eventsSendRequest(sendRequest, isAsync);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.NotificationException, \"send request notification failed: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n }\r\n /**\r\n * Validate UUID Format\r\n * Specs taken from https://tools.ietf.org/html/rfc4122 and breeze repo\r\n */\r\n function _validateInstrumentationKey(config) {\r\n var disableIKeyValidationFlag = isNullOrUndefined(config.disableInstrumentationKeyValidation) ? false : config.disableInstrumentationKeyValidation;\r\n if (disableIKeyValidationFlag) {\r\n return true;\r\n }\r\n var UUID_Regex = \"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$\";\r\n var regexp = new RegExp(UUID_Regex);\r\n return regexp.test(config.instrumentationKey);\r\n }\r\n });\r\n return _this;\r\n }\r\n Sender.constructEnvelope = function (orig, iKey, logger, convertUndefined) {\r\n var envelope;\r\n if (iKey !== orig.iKey && !isNullOrUndefined(iKey)) {\r\n envelope = __assign(__assign({}, orig), { iKey: iKey });\r\n }\r\n else {\r\n envelope = orig;\r\n }\r\n var creator = EnvelopeTypeCreator[envelope.baseType] || EventEnvelopeCreator;\r\n return creator(logger, envelope, convertUndefined);\r\n };\r\n /**\r\n * Pause the sending (transmission) of events, this will cause all events to be batched only until the maximum limits are\r\n * hit at which point new events are dropped. Will also cause events to NOT be sent during page unload, so if Session storage\r\n * is disabled events will be lost.\r\n * SessionStorage Limit is 2000 events, In-Memory (Array) Storage is 10,000 events (can be configured via the eventsLimitInMem).\r\n */\r\n Sender.prototype.pause = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Resume the sending (transmission) of events, this will restart the timer and any batched events will be sent using the normal\r\n * send interval.\r\n */\r\n Sender.prototype.resume = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Flush the batched events immediately (not synchronously).\r\n * Will not flush if the Sender has been paused.\r\n */\r\n Sender.prototype.flush = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Flush the batched events synchronously (if possible -- based on configuration).\r\n * Will not flush if the Send has been paused.\r\n */\r\n Sender.prototype.onunloadFlush = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n Sender.prototype.teardown = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n Sender.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n Sender.prototype.processTelemetry = function (telemetryItem, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * xhr state changes\r\n */\r\n Sender.prototype._xhrReadyStateChange = function (xhr, payload, countOfItemsInPayload) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Immediately send buffered data\r\n * @param async {boolean} - Indicates if the events should be sent asynchronously\r\n * @param forcedSender {SenderFunction} - Indicates the forcedSender, undefined if not passed\r\n */\r\n Sender.prototype.triggerSend = function (async, forcedSender, sendReason) {\r\n if (async === void 0) { async = true; }\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * error handler\r\n */\r\n Sender.prototype._onError = function (payload, message, event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * partial success handler\r\n */\r\n Sender.prototype._onPartialSuccess = function (payload, results) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * success handler\r\n */\r\n Sender.prototype._onSuccess = function (payload, countOfItemsInPayload) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * xdr state changes\r\n */\r\n Sender.prototype._xdrOnLoad = function (xdr, payload) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Add header to request\r\n * @param name - Header name.\r\n * @param value - Header value.\r\n */\r\n Sender.prototype.addHeader = function (name, value) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n return Sender;\r\n}(BaseTelemetryPlugin));\r\nexport { Sender };\r\n//# sourceMappingURL=Sender.js.map","import { getWindow, getDocument, getNavigator, isUndefined, isNullOrUndefined, attachEvent } from \"@microsoft/applicationinsights-core-js\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\n/**\r\n * @description Monitors browser for offline events\r\n * @export default - Offline: Static instance of OfflineListener\r\n * @class OfflineListener\r\n */\r\nvar OfflineListener = /** @class */ (function () {\r\n function OfflineListener() {\r\n var _window = getWindow();\r\n var _document = getDocument();\r\n var isListening = false;\r\n var _onlineStatus = true;\r\n dynamicProto(OfflineListener, this, function (_self) {\r\n try {\r\n if (_window) {\r\n if (attachEvent(_window, \"online\", _setOnline)) {\r\n attachEvent(_window, \"offline\", _setOffline);\r\n isListening = true;\r\n }\r\n }\r\n if (_document) {\r\n // Also attach to the document.body or document\r\n var target = _document.body || _document;\r\n if (!isUndefined(target.ononline)) {\r\n target.ononline = _setOnline;\r\n target.onoffline = _setOffline;\r\n isListening = true;\r\n }\r\n }\r\n if (isListening) {\r\n // We are listening to events so lets set the current status rather than assuming we are online #1538\r\n var _navigator = getNavigator(); // Gets the window.navigator or workerNavigator depending on the global\r\n if (_navigator && !isNullOrUndefined(_navigator.onLine)) { // navigator.onLine is undefined in react-native\r\n _onlineStatus = _navigator.onLine;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // this makes react-native less angry\r\n isListening = false;\r\n }\r\n _self.isListening = isListening;\r\n _self.isOnline = function () {\r\n var result = true;\r\n var _navigator = getNavigator();\r\n if (isListening) {\r\n result = _onlineStatus;\r\n }\r\n else if (_navigator && !isNullOrUndefined(_navigator.onLine)) { // navigator.onLine is undefined in react-native\r\n result = _navigator.onLine;\r\n }\r\n return result;\r\n };\r\n _self.isOffline = function () {\r\n return !_self.isOnline();\r\n };\r\n function _setOnline() {\r\n _onlineStatus = true;\r\n }\r\n function _setOffline() {\r\n _onlineStatus = false;\r\n }\r\n });\r\n }\r\n OfflineListener.prototype.isOnline = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n OfflineListener.prototype.isOffline = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n OfflineListener.Offline = new OfflineListener;\r\n return OfflineListener;\r\n}());\r\nexport { OfflineListener };\r\nexport var Offline = OfflineListener.Offline;\r\n//# sourceMappingURL=Offline.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// (Magic number) DJB algorithm can't work on shorter strings (results in poor distribution\r\nvar MIN_INPUT_LENGTH = 8;\r\nvar HashCodeScoreGenerator = /** @class */ (function () {\r\n function HashCodeScoreGenerator() {\r\n }\r\n HashCodeScoreGenerator.prototype.getHashCodeScore = function (key) {\r\n var score = this.getHashCode(key) / HashCodeScoreGenerator.INT_MAX_VALUE;\r\n return score * 100;\r\n };\r\n HashCodeScoreGenerator.prototype.getHashCode = function (input) {\r\n if (input === \"\") {\r\n return 0;\r\n }\r\n while (input.length < MIN_INPUT_LENGTH) {\r\n input = input.concat(input);\r\n }\r\n // 5381 is a magic number: http://stackoverflow.com/questions/10696223/reason-for-5381-number-in-djb-hash-function\r\n var hash = 5381;\r\n for (var i = 0; i < input.length; ++i) {\r\n hash = ((hash << 5) + hash) + input.charCodeAt(i);\r\n // 'hash' is of number type which means 53 bit integer (http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types-number-type)\r\n // 'hash & hash' will keep it 32 bit integer - just to make it clearer what the result is.\r\n hash = hash & hash;\r\n }\r\n return Math.abs(hash);\r\n };\r\n // We're using 32 bit math, hence max value is (2^31 - 1)\r\n HashCodeScoreGenerator.INT_MAX_VALUE = 2147483647;\r\n return HashCodeScoreGenerator;\r\n}());\r\nexport { HashCodeScoreGenerator };\r\n//# sourceMappingURL=HashCodeScoreGenerator.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { HashCodeScoreGenerator } from \"./HashCodeScoreGenerator\";\r\nimport { ContextTagKeys } from \"@microsoft/applicationinsights-common\";\r\nvar SamplingScoreGenerator = /** @class */ (function () {\r\n function SamplingScoreGenerator() {\r\n var _self = this;\r\n var hashCodeGenerator = new HashCodeScoreGenerator();\r\n var keys = new ContextTagKeys();\r\n _self.getSamplingScore = function (item) {\r\n var score = 0;\r\n if (item.tags && item.tags[keys.userId]) { // search in tags first, then ext\r\n score = hashCodeGenerator.getHashCodeScore(item.tags[keys.userId]);\r\n }\r\n else if (item.ext && item.ext.user && item.ext.user.id) {\r\n score = hashCodeGenerator.getHashCodeScore(item.ext.user.id);\r\n }\r\n else if (item.tags && item.tags[keys.operationId]) { // search in tags first, then ext\r\n score = hashCodeGenerator.getHashCodeScore(item.tags[keys.operationId]);\r\n }\r\n else if (item.ext && item.ext.telemetryTrace && item.ext.telemetryTrace.traceID) {\r\n score = hashCodeGenerator.getHashCodeScore(item.ext.telemetryTrace.traceID);\r\n }\r\n else {\r\n // tslint:disable-next-line:insecure-random\r\n score = (Math.random() * 100);\r\n }\r\n return score;\r\n };\r\n }\r\n return SamplingScoreGenerator;\r\n}());\r\nexport { SamplingScoreGenerator };\r\n//# sourceMappingURL=SamplingScoreGenerator.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { SamplingScoreGenerator } from \"./SamplingScoreGenerators/SamplingScoreGenerator\";\r\nimport { Metric } from \"@microsoft/applicationinsights-common\";\r\nimport { _InternalMessageId, LoggingSeverity, safeGetLogger } from \"@microsoft/applicationinsights-core-js\";\r\nvar Sample = /** @class */ (function () {\r\n function Sample(sampleRate, logger) {\r\n // We're using 32 bit math, hence max value is (2^31 - 1)\r\n this.INT_MAX_VALUE = 2147483647;\r\n var _logger = logger || safeGetLogger(null);\r\n if (sampleRate > 100 || sampleRate < 0) {\r\n _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SampleRateOutOfRange, \"Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.\", { samplingRate: sampleRate }, true);\r\n sampleRate = 100;\r\n }\r\n this.sampleRate = sampleRate;\r\n this.samplingScoreGenerator = new SamplingScoreGenerator();\r\n }\r\n /**\r\n * Determines if an envelope is sampled in (i.e. will be sent) or not (i.e. will be dropped).\r\n */\r\n Sample.prototype.isSampledIn = function (envelope) {\r\n var samplingPercentage = this.sampleRate; // 0 - 100\r\n var isSampledIn = false;\r\n if (samplingPercentage === null || samplingPercentage === undefined || samplingPercentage >= 100) {\r\n return true;\r\n }\r\n else if (envelope.baseType === Metric.dataType) {\r\n // exclude MetricData telemetry from sampling\r\n return true;\r\n }\r\n isSampledIn = this.samplingScoreGenerator.getSamplingScore(envelope) < samplingPercentage;\r\n return isSampledIn;\r\n };\r\n return Sample;\r\n}());\r\nexport { Sample };\r\n//# sourceMappingURL=Sample.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage } from \"@microsoft/applicationinsights-common\";\r\nimport { _InternalMessageId, LoggingSeverity, safeGetCookieMgr, isFunction, newId, dumpObj, getExceptionName, dateNow, safeGetLogger } from \"@microsoft/applicationinsights-core-js\";\r\nvar cookieNameConst = \"ai_session\";\r\nvar Session = /** @class */ (function () {\r\n function Session() {\r\n }\r\n return Session;\r\n}());\r\nexport { Session };\r\nvar _SessionManager = /** @class */ (function () {\r\n function _SessionManager(config, core) {\r\n var self = this;\r\n var _storageNamePrefix;\r\n var _cookieUpdatedTimestamp;\r\n var _logger = safeGetLogger(core);\r\n var _cookieManager = safeGetCookieMgr(core);\r\n dynamicProto(_SessionManager, self, function (_self) {\r\n if (!config) {\r\n config = {};\r\n }\r\n if (!isFunction(config.sessionExpirationMs)) {\r\n config.sessionExpirationMs = function () { return _SessionManager.acquisitionSpan; };\r\n }\r\n if (!isFunction(config.sessionRenewalMs)) {\r\n config.sessionRenewalMs = function () { return _SessionManager.renewalSpan; };\r\n }\r\n _self.config = config;\r\n // sessionCookiePostfix takes the preference if it is configured, otherwise takes namePrefix if configured.\r\n var sessionCookiePostfix = (_self.config.sessionCookiePostfix && _self.config.sessionCookiePostfix()) ?\r\n _self.config.sessionCookiePostfix() :\r\n ((_self.config.namePrefix && _self.config.namePrefix()) ? _self.config.namePrefix() : \"\");\r\n _storageNamePrefix = function () { return cookieNameConst + sessionCookiePostfix; };\r\n _self.automaticSession = new Session();\r\n _self.update = function () {\r\n // Always using Date getTime() as there is a bug in older IE instances that causes the performance timings to have the hi-bit set eg 0x800000000 causing\r\n // the number to be incorrect.\r\n var nowMs = dateNow();\r\n var isExpired = false;\r\n var session = _self.automaticSession;\r\n if (!session.id) {\r\n isExpired = !_initializeAutomaticSession(session, nowMs);\r\n }\r\n var sessionExpirationMs = _self.config.sessionExpirationMs();\r\n if (!isExpired && sessionExpirationMs > 0) {\r\n var sessionRenewalMs = _self.config.sessionRenewalMs();\r\n var timeSinceAcqMs = nowMs - session.acquisitionDate;\r\n var timeSinceRenewalMs = nowMs - session.renewalDate;\r\n isExpired = timeSinceAcqMs < 0 || timeSinceRenewalMs < 0; // expired if the acquisition or last renewal are in the future\r\n isExpired = isExpired || timeSinceAcqMs > sessionExpirationMs; // expired if the time since acquisition is more than session Expiration\r\n isExpired = isExpired || timeSinceRenewalMs > sessionRenewalMs; // expired if the time since last renewal is more than renewal period\r\n }\r\n // renew if acquisitionSpan or renewalSpan has elapsed\r\n if (isExpired) {\r\n // update automaticSession so session state has correct id\r\n _renew(nowMs);\r\n }\r\n else {\r\n // do not update the cookie more often than cookieUpdateInterval\r\n if (!_cookieUpdatedTimestamp || nowMs - _cookieUpdatedTimestamp > _SessionManager.cookieUpdateInterval) {\r\n _setCookie(session, nowMs);\r\n }\r\n }\r\n };\r\n /**\r\n * Record the current state of the automatic session and store it in our cookie string format\r\n * into the browser's local storage. This is used to restore the session data when the cookie\r\n * expires.\r\n */\r\n _self.backup = function () {\r\n var session = _self.automaticSession;\r\n _setStorage(session.id, session.acquisitionDate, session.renewalDate);\r\n };\r\n /**\r\n * Use config.namePrefix + ai_session cookie data or local storage data (when the cookie is unavailable) to\r\n * initialize the automatic session.\r\n * @returns true if values set otherwise false\r\n */\r\n function _initializeAutomaticSession(session, now) {\r\n var isValid = false;\r\n var cookieValue = _cookieManager.get(_storageNamePrefix());\r\n if (cookieValue && isFunction(cookieValue.split)) {\r\n isValid = _initializeAutomaticSessionWithData(session, cookieValue);\r\n }\r\n else {\r\n // There's no cookie, but we might have session data in local storage\r\n // This can happen if the session expired or the user actively deleted the cookie\r\n // We only want to recover data if the cookie is missing from expiry. We should respect the user's wishes if the cookie was deleted actively.\r\n // The User class handles this for us and deletes our local storage object if the persistent user cookie was removed.\r\n var storageValue = utlGetLocalStorage(_logger, _storageNamePrefix());\r\n if (storageValue) {\r\n isValid = _initializeAutomaticSessionWithData(session, storageValue);\r\n }\r\n }\r\n return isValid || !!session.id;\r\n }\r\n /**\r\n * Extract id, acquisitionDate, and renewalDate from an ai_session payload string and\r\n * use this data to initialize automaticSession.\r\n *\r\n * @param {string} sessionData - The string stored in an ai_session cookie or local storage backup\r\n * @returns true if values set otherwise false\r\n */\r\n function _initializeAutomaticSessionWithData(session, sessionData) {\r\n var isValid = false;\r\n var sessionReset = \", session will be reset\";\r\n var tokens = sessionData.split(\"|\");\r\n if (tokens.length >= 2) {\r\n try {\r\n var acqMs = +tokens[1] || 0;\r\n var renewalMs = +tokens[2] || 0;\r\n if (isNaN(acqMs) || acqMs <= 0) {\r\n _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, \"AI session acquisition date is 0\" + sessionReset);\r\n }\r\n else if (isNaN(renewalMs) || renewalMs <= 0) {\r\n _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, \"AI session renewal date is 0\" + sessionReset);\r\n }\r\n else if (tokens[0]) {\r\n // Everything looks valid so set the values\r\n session.id = tokens[0];\r\n session.acquisitionDate = acqMs;\r\n session.renewalDate = renewalMs;\r\n isValid = true;\r\n }\r\n }\r\n catch (e) {\r\n _logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ErrorParsingAISessionCookie, \"Error parsing ai_session value [\" + (sessionData || \"\") + \"]\" + sessionReset + \" - \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return isValid;\r\n }\r\n function _renew(nowMs) {\r\n var theConfig = (_self.config || {});\r\n var getNewId = (theConfig.getNewId ? theConfig.getNewId() : null) || newId;\r\n _self.automaticSession.id = getNewId(theConfig.idLength ? theConfig.idLength() : 22);\r\n _self.automaticSession.acquisitionDate = nowMs;\r\n _setCookie(_self.automaticSession, nowMs);\r\n // If this browser does not support local storage, fire an internal log to keep track of it at this point\r\n if (!utlCanUseLocalStorage()) {\r\n _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserDoesNotSupportLocalStorage, \"Browser does not support local storage. Session durations will be inaccurate.\");\r\n }\r\n }\r\n function _setCookie(session, nowMs) {\r\n var acq = session.acquisitionDate;\r\n session.renewalDate = nowMs;\r\n var config = _self.config;\r\n var renewalPeriodMs = config.sessionRenewalMs();\r\n // Set cookie to expire after the session expiry time passes or the session renewal deadline, whichever is sooner\r\n // Expiring the cookie will cause the session to expire even if the user isn't on the page\r\n var acqTimeLeftMs = (acq + config.sessionExpirationMs()) - nowMs;\r\n var cookie = [session.id, acq, nowMs];\r\n var maxAgeSec = 0;\r\n if (acqTimeLeftMs < renewalPeriodMs) {\r\n maxAgeSec = acqTimeLeftMs / 1000;\r\n }\r\n else {\r\n maxAgeSec = renewalPeriodMs / 1000;\r\n }\r\n var cookieDomain = config.cookieDomain ? config.cookieDomain() : null;\r\n // if sessionExpirationMs is set to 0, it means the expiry is set to 0 for this session cookie\r\n // A cookie with 0 expiry in the session cookie will never expire for that browser session. If the browser is closed the cookie expires.\r\n // Depending on the browser, another instance does not inherit this cookie, however, another tab will\r\n _cookieManager.set(_storageNamePrefix(), cookie.join(\"|\"), config.sessionExpirationMs() > 0 ? maxAgeSec : null, cookieDomain);\r\n _cookieUpdatedTimestamp = nowMs;\r\n }\r\n function _setStorage(guid, acq, renewal) {\r\n // Keep data in local storage to retain the last session id, allowing us to cleanly end the session when it expires\r\n // Browsers that don't support local storage won't be able to end sessions cleanly from the client\r\n // The server will notice this and end the sessions itself, with loss of accurate session duration\r\n utlSetLocalStorage(_logger, _storageNamePrefix(), [guid, acq, renewal].join(\"|\"));\r\n }\r\n });\r\n }\r\n _SessionManager.prototype.update = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Record the current state of the automatic session and store it in our cookie string format\r\n * into the browser's local storage. This is used to restore the session data when the cookie\r\n * expires.\r\n */\r\n _SessionManager.prototype.backup = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n _SessionManager.acquisitionSpan = 86400000; // 24 hours in ms\r\n _SessionManager.renewalSpan = 1800000; // 30 minutes in ms\r\n _SessionManager.cookieUpdateInterval = 60000; // 1 minute in ms\r\n return _SessionManager;\r\n}());\r\nexport { _SessionManager };\r\n//# sourceMappingURL=Session.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Application = /** @class */ (function () {\r\n function Application() {\r\n }\r\n return Application;\r\n}());\r\nexport { Application };\r\n//# sourceMappingURL=Application.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Device = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the Device class\r\n */\r\n function Device() {\r\n // don't attempt to fingerprint browsers\r\n this.id = \"browser\";\r\n // Device type is a dimension in our data platform\r\n // Setting it to 'Browser' allows to separate client and server dependencies/exceptions\r\n this.deviceClass = \"Browser\";\r\n }\r\n return Device;\r\n}());\r\nexport { Device };\r\n//# sourceMappingURL=Device.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Version = \"2.7.1\";\r\nvar Internal = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the internal telemetry data class.\r\n */\r\n function Internal(config) {\r\n this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + \"_\" : \"\") + \"javascript:\" + Version;\r\n }\r\n return Internal;\r\n}());\r\nexport { Internal };\r\n//# sourceMappingURL=Internal.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { utlRemoveStorage } from \"@microsoft/applicationinsights-common\";\r\nimport { _InternalMessageId, LoggingSeverity, safeGetCookieMgr, safeGetLogger, newId, toISOString } from \"@microsoft/applicationinsights-core-js\";\r\nfunction _validateUserInput(id) {\r\n // Validate:\r\n // 1. Id is a non-empty string.\r\n // 2. It does not contain special characters for cookies.\r\n if (typeof id !== \"string\" ||\r\n !id ||\r\n id.match(/,|;|=| |\\|/)) {\r\n return false;\r\n }\r\n return true;\r\n}\r\nvar User = /** @class */ (function () {\r\n function User(config, core) {\r\n /**\r\n * A flag indicating whether this represents a new user\r\n */\r\n this.isNewUser = false;\r\n /**\r\n * A flag indicating whether the user cookie has been set\r\n */\r\n this.isUserCookieSet = false;\r\n var _logger = safeGetLogger(core);\r\n var _cookieManager = safeGetCookieMgr(core);\r\n var _storageNamePrefix;\r\n dynamicProto(User, this, function (_self) {\r\n _self.config = config;\r\n var userCookiePostfix = (_self.config.userCookiePostfix && _self.config.userCookiePostfix()) ? _self.config.userCookiePostfix() : \"\";\r\n _storageNamePrefix = function () { return User.userCookieName + userCookiePostfix; };\r\n // get userId or create new one if none exists\r\n var cookie = _cookieManager.get(_storageNamePrefix());\r\n if (cookie) {\r\n _self.isNewUser = false;\r\n var params = cookie.split(User.cookieSeparator);\r\n if (params.length > 0) {\r\n _self.id = params[0];\r\n // we already have a cookie\r\n _self.isUserCookieSet = !!_self.id;\r\n }\r\n }\r\n function _generateNewId() {\r\n var theConfig = (config || {});\r\n var getNewId = (theConfig.getNewId ? theConfig.getNewId() : null) || newId;\r\n var id = getNewId(theConfig.idLength ? config.idLength() : 22);\r\n return id;\r\n }\r\n function _generateNewCookie(userId) {\r\n var acqStr = toISOString(new Date());\r\n _self.accountAcquisitionDate = acqStr;\r\n _self.isNewUser = true;\r\n var newCookie = [userId, acqStr];\r\n return newCookie;\r\n }\r\n function _setUserCookie(cookie) {\r\n // without expiration, cookies expire at the end of the session\r\n // set it to 365 days from now\r\n // 365 * 24 * 60 * 60 = 31536000\r\n var oneYear = 31536000;\r\n _self.isUserCookieSet = _cookieManager.set(_storageNamePrefix(), cookie, oneYear);\r\n }\r\n if (!_self.id) {\r\n _self.id = _generateNewId();\r\n var newCookie = _generateNewCookie(_self.id);\r\n _setUserCookie(newCookie.join(User.cookieSeparator));\r\n // If we have an config.namePrefix() + ai_session in local storage this means the user actively removed our cookies.\r\n // We should respect their wishes and clear ourselves from local storage\r\n var name_1 = config.namePrefix && config.namePrefix() ? config.namePrefix() + \"ai_session\" : \"ai_session\";\r\n utlRemoveStorage(_logger, name_1);\r\n }\r\n // We still take the account id from the ctor param for backward compatibility.\r\n // But if the the customer set the accountId through the newer setAuthenticatedUserContext API, we will override it.\r\n _self.accountId = config.accountId ? config.accountId() : undefined;\r\n // Get the auth user id and account id from the cookie if exists\r\n // Cookie is in the pattern: |\r\n var authCookie = _cookieManager.get(User.authUserCookieName);\r\n if (authCookie) {\r\n authCookie = decodeURI(authCookie);\r\n var authCookieString = authCookie.split(User.cookieSeparator);\r\n if (authCookieString[0]) {\r\n _self.authenticatedId = authCookieString[0];\r\n }\r\n if (authCookieString.length > 1 && authCookieString[1]) {\r\n _self.accountId = authCookieString[1];\r\n }\r\n }\r\n _self.setAuthenticatedUserContext = function (authenticatedUserId, accountId, storeInCookie) {\r\n if (storeInCookie === void 0) { storeInCookie = false; }\r\n // Validate inputs to ensure no cookie control characters.\r\n var isInvalidInput = !_validateUserInput(authenticatedUserId) || (accountId && !_validateUserInput(accountId));\r\n if (isInvalidInput) {\r\n _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SetAuthContextFailedAccountName, \"Setting auth user context failed. \" +\r\n \"User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.\", true);\r\n return;\r\n }\r\n // Create cookie string.\r\n _self.authenticatedId = authenticatedUserId;\r\n var authCookie = _self.authenticatedId;\r\n if (accountId) {\r\n _self.accountId = accountId;\r\n authCookie = [_self.authenticatedId, _self.accountId].join(User.cookieSeparator);\r\n }\r\n if (storeInCookie) {\r\n // Set the cookie. No expiration date because this is a session cookie (expires when browser closed).\r\n // Encoding the cookie to handle unexpected unicode characters.\r\n _cookieManager.set(User.authUserCookieName, encodeURI(authCookie));\r\n }\r\n };\r\n /**\r\n * Clears the authenticated user id and the account id from the user context.\r\n * @returns {}\r\n */\r\n _self.clearAuthenticatedUserContext = function () {\r\n _self.authenticatedId = null;\r\n _self.accountId = null;\r\n _cookieManager.del(User.authUserCookieName);\r\n };\r\n _self.update = function (userId) {\r\n // Optimizations to avoid setting and processing the cookie when not needed\r\n if (_self.id !== userId || !_self.isUserCookieSet) {\r\n var user_id = userId ? userId : _generateNewId();\r\n var user_cookie = _generateNewCookie(user_id);\r\n _setUserCookie(user_cookie.join(User.cookieSeparator));\r\n }\r\n };\r\n });\r\n }\r\n /**\r\n * Sets the authenticated user id and the account id in this session.\r\n *\r\n * @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.\r\n * @param accountId {string} - An optional string to represent the account associated with the authenticated user.\r\n */\r\n User.prototype.setAuthenticatedUserContext = function (authenticatedUserId, accountId, storeInCookie) {\r\n if (storeInCookie === void 0) { storeInCookie = false; }\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Clears the authenticated user id and the account id from the user context.\r\n * @returns {}\r\n */\r\n User.prototype.clearAuthenticatedUserContext = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Update or create the user cookie if cookies where previously disabled or the new userId does not match the existing value.\r\n * If you pass nothing a new random user id will be created.\r\n * @param userId - Specific either the current (via appInsights.context.user.id) or new id that you want to set\r\n */\r\n User.prototype.update = function (userId) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n User.cookieSeparator = \"|\";\r\n User.userCookieName = \"ai_user\";\r\n User.authUserCookieName = \"ai_authUser\";\r\n return User;\r\n}());\r\nexport { User };\r\n//# sourceMappingURL=User.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Location = /** @class */ (function () {\r\n function Location() {\r\n }\r\n return Location;\r\n}());\r\nexport { Location };\r\n//# sourceMappingURL=Location.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { dataSanitizeString } from \"@microsoft/applicationinsights-common\";\r\nimport { generateW3CId, getLocation } from \"@microsoft/applicationinsights-core-js\";\r\nvar TelemetryTrace = /** @class */ (function () {\r\n function TelemetryTrace(id, parentId, name, logger) {\r\n var _self = this;\r\n _self.traceID = id || generateW3CId();\r\n _self.parentID = parentId;\r\n _self.name = name;\r\n var location = getLocation();\r\n if (!name && location && location.pathname) {\r\n _self.name = location.pathname;\r\n }\r\n _self.name = dataSanitizeString(logger, _self.name);\r\n }\r\n return TelemetryTrace;\r\n}());\r\nexport { TelemetryTrace };\r\n//# sourceMappingURL=TelemetryTrace.js.map","/**\r\n * TelemetryContext.ts\r\n * @copyright Microsoft 2018\r\n */\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { isString, objKeys, hasWindow, _InternalLogMessage, setValue, getSetValue } from \"@microsoft/applicationinsights-core-js\";\r\nimport { Session, _SessionManager } from \"./Context/Session\";\r\nimport { Extensions, CtxTagKeys, PageView } from \"@microsoft/applicationinsights-common\";\r\nimport { Application } from \"./Context/Application\";\r\nimport { Device } from \"./Context/Device\";\r\nimport { Internal } from \"./Context/Internal\";\r\nimport { User } from \"./Context/User\";\r\nimport { Location } from \"./Context/Location\";\r\nimport { TelemetryTrace } from \"./Context/TelemetryTrace\";\r\nvar strExt = \"ext\";\r\nvar strTags = \"tags\";\r\nfunction _removeEmpty(target, name) {\r\n if (target && target[name] && objKeys(target[name]).length === 0) {\r\n delete target[name];\r\n }\r\n}\r\nvar TelemetryContext = /** @class */ (function () {\r\n function TelemetryContext(core, defaultConfig) {\r\n var _this = this;\r\n var logger = core.logger;\r\n this.appId = function () { return null; };\r\n this.getSessionId = function () { return null; };\r\n dynamicProto(TelemetryContext, this, function (_self) {\r\n _self.application = new Application();\r\n _self.internal = new Internal(defaultConfig);\r\n if (hasWindow()) {\r\n _self.sessionManager = new _SessionManager(defaultConfig, core);\r\n _self.device = new Device();\r\n _self.location = new Location();\r\n _self.user = new User(defaultConfig, core);\r\n _self.telemetryTrace = new TelemetryTrace(undefined, undefined, undefined, logger);\r\n _self.session = new Session();\r\n }\r\n _self.getSessionId = function () {\r\n var session = _self.session;\r\n var sesId = null;\r\n // If customer set session info, apply their context; otherwise apply context automatically generated\r\n if (session && isString(session.id)) {\r\n sesId = session.id;\r\n }\r\n else {\r\n // Gets the automatic session if it exists or an empty object\r\n var autoSession = (_self.sessionManager || {}).automaticSession;\r\n sesId = autoSession && isString(autoSession.id) ? autoSession.id : null;\r\n }\r\n return sesId;\r\n };\r\n _self.applySessionContext = function (evt, itemCtx) {\r\n setValue(getSetValue(evt.ext, Extensions.AppExt), \"sesId\", _self.getSessionId(), isString);\r\n };\r\n _self.applyOperatingSystemContxt = function (evt, itemCtx) {\r\n setValue(evt.ext, Extensions.OSExt, _self.os);\r\n };\r\n _self.applyApplicationContext = function (evt, itemCtx) {\r\n var application = _self.application;\r\n if (application) {\r\n // evt.ext.app\r\n var tags = getSetValue(evt, strTags);\r\n setValue(tags, CtxTagKeys.applicationVersion, application.ver, isString);\r\n setValue(tags, CtxTagKeys.applicationBuild, application.build, isString);\r\n }\r\n };\r\n _self.applyDeviceContext = function (evt, itemCtx) {\r\n var device = _self.device;\r\n if (device) {\r\n // evt.ext.device\r\n var extDevice = getSetValue(getSetValue(evt, strExt), Extensions.DeviceExt);\r\n setValue(extDevice, \"localId\", device.id, isString);\r\n setValue(extDevice, \"ip\", device.ip, isString);\r\n setValue(extDevice, \"model\", device.model, isString);\r\n setValue(extDevice, \"deviceClass\", device.deviceClass, isString);\r\n }\r\n };\r\n _self.applyInternalContext = function (evt, itemCtx) {\r\n var internal = _self.internal;\r\n if (internal) {\r\n var tags = getSetValue(evt, strTags);\r\n setValue(tags, CtxTagKeys.internalAgentVersion, internal.agentVersion, isString); // not mapped in CS 4.0\r\n setValue(tags, CtxTagKeys.internalSdkVersion, internal.sdkVersion, isString);\r\n if (evt.baseType === _InternalLogMessage.dataType || evt.baseType === PageView.dataType) {\r\n setValue(tags, CtxTagKeys.internalSnippet, internal.snippetVer, isString);\r\n setValue(tags, CtxTagKeys.internalSdkSrc, internal.sdkSrc, isString);\r\n }\r\n }\r\n };\r\n _self.applyLocationContext = function (evt, itemCtx) {\r\n var location = _this.location;\r\n if (location) {\r\n setValue(getSetValue(evt, strTags, []), CtxTagKeys.locationIp, location.ip, isString);\r\n }\r\n };\r\n _self.applyOperationContext = function (evt, itemCtx) {\r\n var telemetryTrace = _self.telemetryTrace;\r\n if (telemetryTrace) {\r\n var extTrace = getSetValue(getSetValue(evt, strExt), Extensions.TraceExt, { traceID: undefined, parentID: undefined });\r\n setValue(extTrace, \"traceID\", telemetryTrace.traceID, isString);\r\n setValue(extTrace, \"name\", telemetryTrace.name, isString);\r\n setValue(extTrace, \"parentID\", telemetryTrace.parentID, isString);\r\n }\r\n };\r\n _self.applyWebContext = function (evt, itemCtx) {\r\n var web = _this.web;\r\n if (web) {\r\n setValue(getSetValue(evt, strExt), Extensions.WebExt, web);\r\n }\r\n };\r\n _self.applyUserContext = function (evt, itemCtx) {\r\n var user = _self.user;\r\n if (user) {\r\n var tags = getSetValue(evt, strTags, []);\r\n // stays in tags\r\n setValue(tags, CtxTagKeys.userAccountId, user.accountId, isString);\r\n // CS 4.0\r\n var extUser = getSetValue(getSetValue(evt, strExt), Extensions.UserExt);\r\n setValue(extUser, \"id\", user.id, isString);\r\n setValue(extUser, \"authId\", user.authenticatedId, isString);\r\n }\r\n };\r\n _self.cleanUp = function (evt, itemCtx) {\r\n var ext = evt.ext;\r\n if (ext) {\r\n _removeEmpty(ext, Extensions.DeviceExt);\r\n _removeEmpty(ext, Extensions.UserExt);\r\n _removeEmpty(ext, Extensions.WebExt);\r\n _removeEmpty(ext, Extensions.OSExt);\r\n _removeEmpty(ext, Extensions.AppExt);\r\n _removeEmpty(ext, Extensions.TraceExt);\r\n }\r\n };\r\n });\r\n }\r\n TelemetryContext.prototype.applySessionContext = function (evt, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyOperatingSystemContxt = function (event, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyApplicationContext = function (event, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyDeviceContext = function (event, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyInternalContext = function (event, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyLocationContext = function (event, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyOperationContext = function (event, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyWebContext = function (event, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyUserContext = function (event, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.cleanUp = function (event, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return TelemetryContext;\r\n}());\r\nexport { TelemetryContext };\r\n//# sourceMappingURL=TelemetryContext.js.map","/**\r\n * PropertiesPlugin.ts\r\n * @copyright Microsoft 2018\r\n */\r\nimport { __extends } from \"tslib\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { BaseTelemetryPlugin, isNullOrUndefined, _InternalLogMessage, LoggingSeverity, _InternalMessageId, getNavigator, objForEachKey, getSetValue } from \"@microsoft/applicationinsights-core-js\";\r\nimport { TelemetryContext } from \"./TelemetryContext\";\r\nimport { PageView, BreezeChannelIdentifier, PropertiesPluginIdentifier, getExtensionByName } from \"@microsoft/applicationinsights-common\";\r\nvar PropertiesPlugin = /** @class */ (function (_super) {\r\n __extends(PropertiesPlugin, _super);\r\n function PropertiesPlugin() {\r\n var _this = _super.call(this) || this;\r\n _this.priority = 110;\r\n _this.identifier = PropertiesPluginIdentifier;\r\n var _breezeChannel; // optional. If exists, grab appId from it\r\n var _extensionConfig;\r\n dynamicProto(PropertiesPlugin, _this, function (_self, _base) {\r\n _self.initialize = function (config, core, extensions, pluginChain) {\r\n _base.initialize(config, core, extensions, pluginChain);\r\n var ctx = _self._getTelCtx();\r\n var identifier = _self.identifier;\r\n var defaultConfig = PropertiesPlugin.getDefaultConfig();\r\n _extensionConfig = _extensionConfig || {};\r\n objForEachKey(defaultConfig, function (field, value) {\r\n _extensionConfig[field] = function () { return ctx.getConfig(identifier, field, value()); };\r\n });\r\n _self.context = new TelemetryContext(core, _extensionConfig);\r\n _breezeChannel = getExtensionByName(extensions, BreezeChannelIdentifier);\r\n _self.context.appId = function () { return _breezeChannel ? _breezeChannel[\"_appId\"] : null; };\r\n // Test hook to allow accessing the internal values -- explicitly not defined as an available property on the class\r\n _self[\"_extConfig\"] = _extensionConfig;\r\n };\r\n /**\r\n * Add Part A fields to the event\r\n * @param event The event that needs to be processed\r\n */\r\n _self.processTelemetry = function (event, itemCtx) {\r\n if (isNullOrUndefined(event)) {\r\n // TODO(barustum): throw an internal event once we have support for internal logging\r\n }\r\n else {\r\n itemCtx = _self._getTelCtx(itemCtx);\r\n // If the envelope is PageView, reset the internal message count so that we can send internal telemetry for the new page.\r\n if (event.name === PageView.envelopeType) {\r\n itemCtx.diagLog().resetInternalMessageCount();\r\n }\r\n var theContext = (_self.context || {});\r\n if (theContext.session) {\r\n // If customer did not provide custom session id update the session manager\r\n if (typeof _self.context.session.id !== \"string\" && theContext.sessionManager) {\r\n theContext.sessionManager.update();\r\n }\r\n }\r\n var userCtx = theContext.user;\r\n if (userCtx && !userCtx.isUserCookieSet) {\r\n userCtx.update(theContext.user.id);\r\n }\r\n _processTelemetryInternal(event, itemCtx);\r\n if (userCtx && userCtx.isNewUser) {\r\n userCtx.isNewUser = false;\r\n var message = new _InternalLogMessage(_InternalMessageId.SendBrowserInfoOnUserInit, ((getNavigator() || {}).userAgent || \"\"));\r\n itemCtx.diagLog().logInternalMessage(LoggingSeverity.CRITICAL, message);\r\n }\r\n _self.processNext(event, itemCtx);\r\n }\r\n };\r\n function _processTelemetryInternal(evt, itemCtx) {\r\n // Set Part A fields\r\n getSetValue(evt, \"tags\", []);\r\n getSetValue(evt, \"ext\", {});\r\n var ctx = _self.context;\r\n ctx.applySessionContext(evt, itemCtx);\r\n ctx.applyApplicationContext(evt, itemCtx);\r\n ctx.applyDeviceContext(evt, itemCtx);\r\n ctx.applyOperationContext(evt, itemCtx);\r\n ctx.applyUserContext(evt, itemCtx);\r\n ctx.applyOperatingSystemContxt(evt, itemCtx);\r\n ctx.applyWebContext(evt, itemCtx);\r\n ctx.applyLocationContext(evt, itemCtx); // legacy tags\r\n ctx.applyInternalContext(evt, itemCtx); // legacy tags\r\n ctx.cleanUp(evt, itemCtx);\r\n }\r\n });\r\n return _this;\r\n }\r\n PropertiesPlugin.getDefaultConfig = function () {\r\n var defaultConfig = {\r\n instrumentationKey: function () { return undefined; },\r\n accountId: function () { return null; },\r\n sessionRenewalMs: function () { return 30 * 60 * 1000; },\r\n samplingPercentage: function () { return 100; },\r\n sessionExpirationMs: function () { return 24 * 60 * 60 * 1000; },\r\n cookieDomain: function () { return null; },\r\n sdkExtension: function () { return null; },\r\n isBrowserLinkTrackingEnabled: function () { return false; },\r\n appId: function () { return null; },\r\n getSessionId: function () { return null; },\r\n namePrefix: function () { return undefined; },\r\n sessionCookiePostfix: function () { return undefined; },\r\n userCookiePostfix: function () { return undefined; },\r\n idLength: function () { return 22; },\r\n getNewId: function () { return null; }\r\n };\r\n return defaultConfig;\r\n };\r\n PropertiesPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Add Part A fields to the event\r\n * @param event The event that needs to be processed\r\n */\r\n PropertiesPlugin.prototype.processTelemetry = function (event, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return PropertiesPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport default PropertiesPlugin;\r\n//# sourceMappingURL=PropertiesPlugin.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { strShimFunction, strShimPrototype } from \"@microsoft/applicationinsights-shims\";\r\nimport { hasOwnProperty } from \"./HelperFuncs\";\r\nvar aiInstrumentHooks = \"_aiHooks\";\r\nvar cbNames = [\r\n \"req\", \"rsp\", \"hkErr\", \"fnErr\"\r\n];\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar str__Proto = \"__proto__\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strConstructor = \"constructor\";\r\n/** @ignore */\r\nfunction _arrLoop(arr, fn) {\r\n if (arr) {\r\n for (var lp = 0; lp < arr.length; lp++) {\r\n if (fn(arr[lp], lp)) {\r\n break;\r\n }\r\n }\r\n }\r\n}\r\n/** @ignore */\r\nfunction _doCallbacks(hooks, callDetails, cbArgs, hookCtx, type) {\r\n if (type >= 0 /* Request */ && type <= 2 /* HookError */) {\r\n _arrLoop(hooks, function (hook, idx) {\r\n var cbks = hook.cbks;\r\n var cb = cbks[cbNames[type]];\r\n if (cb) {\r\n // Set the specific hook context implementation using a lazy creation pattern\r\n callDetails.ctx = function () {\r\n var ctx = hookCtx[idx] = (hookCtx[idx] || {});\r\n return ctx;\r\n };\r\n try {\r\n cb.apply(callDetails.inst, cbArgs);\r\n }\r\n catch (err) {\r\n var orgEx = callDetails.err;\r\n try {\r\n // Report Hook error via the callback\r\n var hookErrorCb = cbks[cbNames[2 /* HookError */]];\r\n if (hookErrorCb) {\r\n callDetails.err = err;\r\n hookErrorCb.apply(callDetails.inst, cbArgs);\r\n }\r\n }\r\n catch (e) {\r\n // Not much we can do here -- swallowing the exception to avoid crashing the hosting app\r\n }\r\n finally {\r\n // restore the original exception (if any)\r\n callDetails.err = orgEx;\r\n }\r\n }\r\n }\r\n });\r\n }\r\n}\r\n/** @ignore */\r\nfunction _createFunctionHook(aiHook) {\r\n // Define a temporary method that queues-up a the real method call\r\n return function () {\r\n var funcThis = this;\r\n // Capture the original arguments passed to the method\r\n var orgArgs = arguments;\r\n var hooks = aiHook.h;\r\n var funcArgs = {\r\n name: aiHook.n,\r\n inst: funcThis,\r\n ctx: null,\r\n set: _replaceArg\r\n };\r\n var hookCtx = [];\r\n var cbArgs = _createArgs([funcArgs], orgArgs);\r\n function _createArgs(target, theArgs) {\r\n _arrLoop(theArgs, function (arg) {\r\n target.push(arg);\r\n });\r\n return target;\r\n }\r\n function _replaceArg(idx, value) {\r\n orgArgs = _createArgs([], orgArgs);\r\n orgArgs[idx] = value;\r\n cbArgs = _createArgs([funcArgs], orgArgs);\r\n }\r\n // Call the pre-request hooks\r\n _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 0 /* Request */);\r\n // Call the original function was called\r\n var theFunc = aiHook.f;\r\n try {\r\n funcArgs.rslt = theFunc.apply(funcThis, orgArgs);\r\n }\r\n catch (err) {\r\n // Report the request callback\r\n funcArgs.err = err;\r\n _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 3 /* FunctionError */);\r\n // rethrow the original exception so anyone listening for it can catch the exception\r\n throw err;\r\n }\r\n // Call the post-request hooks\r\n _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 1 /* Response */);\r\n return funcArgs.rslt;\r\n };\r\n}\r\n/**\r\n * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)\r\n * @ignore\r\n */\r\nvar _objGetPrototypeOf = Object[\"getPrototypeOf\"];\r\n/**\r\n * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.\r\n * @ignore\r\n */\r\nfunction _getObjProto(target) {\r\n if (target) {\r\n // This method doesn't existing in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n return _objGetPrototypeOf(target);\r\n }\r\n // target[Constructor] May break if the constructor has been changed or removed\r\n var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];\r\n if (newProto) {\r\n return newProto;\r\n }\r\n }\r\n return null;\r\n}\r\n/** @ignore */\r\nfunction _getOwner(target, name, checkPrototype) {\r\n var owner = null;\r\n if (target) {\r\n if (hasOwnProperty(target, name)) {\r\n owner = target;\r\n }\r\n else if (checkPrototype) {\r\n owner = _getOwner(_getObjProto(target), name, false);\r\n }\r\n }\r\n return owner;\r\n}\r\n/**\r\n * Intercept the named prototype functions for the target class / object\r\n * @param target - The target object\r\n * @param funcName - The function name\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n */\r\nexport function InstrumentProto(target, funcName, callbacks) {\r\n if (target) {\r\n return InstrumentFunc(target[strShimPrototype], funcName, callbacks, false);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Intercept the named prototype functions for the target class / object\r\n * @param target - The target object\r\n * @param funcNames - The function names to intercept and call\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n */\r\nexport function InstrumentProtos(target, funcNames, callbacks) {\r\n if (target) {\r\n return InstrumentFuncs(target[strShimPrototype], funcNames, callbacks, false);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Intercept the named prototype functions for the target class / object\r\n * @param target - The target object\r\n * @param funcName - The function name\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function\r\n */\r\nexport function InstrumentFunc(target, funcName, callbacks, checkPrototype) {\r\n if (checkPrototype === void 0) { checkPrototype = true; }\r\n if (target && funcName && callbacks) {\r\n var owner = _getOwner(target, funcName, checkPrototype);\r\n if (owner) {\r\n var fn = owner[funcName];\r\n if (typeof fn === strShimFunction) {\r\n var aiHook_1 = fn[aiInstrumentHooks];\r\n if (!aiHook_1) {\r\n // Only hook the function once\r\n aiHook_1 = {\r\n i: 0,\r\n n: funcName,\r\n f: fn,\r\n h: []\r\n };\r\n // Override (hook) the original function\r\n var newFunc = _createFunctionHook(aiHook_1);\r\n newFunc[aiInstrumentHooks] = aiHook_1; // Tag and store the function hooks\r\n owner[funcName] = newFunc;\r\n }\r\n var theHook = {\r\n // tslint:disable:object-literal-shorthand\r\n id: aiHook_1.i,\r\n cbks: callbacks,\r\n rm: function () {\r\n // DO NOT Use () => { shorthand for the function as the this gets replaced\r\n // with the outer this and not the this for theHook instance.\r\n var id = this.id;\r\n _arrLoop(aiHook_1.h, function (hook, idx) {\r\n if (hook.id === id) {\r\n aiHook_1.h.splice(idx, 1);\r\n return 1;\r\n }\r\n });\r\n }\r\n // tslint:enable:object-literal-shorthand\r\n };\r\n aiHook_1.i++;\r\n aiHook_1.h.push(theHook);\r\n return theHook;\r\n }\r\n }\r\n }\r\n return null;\r\n}\r\n/**\r\n * Intercept the named functions for the target class / object\r\n * @param target - The target object\r\n * @param funcNames - The function names to intercept and call\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function\r\n */\r\nexport function InstrumentFuncs(target, funcNames, callbacks, checkPrototype) {\r\n if (checkPrototype === void 0) { checkPrototype = true; }\r\n var hooks = null;\r\n _arrLoop(funcNames, function (funcName) {\r\n var hook = InstrumentFunc(target, funcName, callbacks, checkPrototype);\r\n if (hook) {\r\n if (!hooks) {\r\n hooks = [];\r\n }\r\n hooks.push(hook);\r\n }\r\n });\r\n return hooks;\r\n}\r\n//# sourceMappingURL=InstrumentHooks.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { dataSanitizeUrl, dateTimeUtilsDuration, urlGetAbsoluteUrl, urlGetCompleteUrl, msToTimeSpan } from \"@microsoft/applicationinsights-common\";\r\nimport { objKeys, arrForEach, isNumber, isString, normalizeJsName, objForEachKey } from \"@microsoft/applicationinsights-core-js\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nvar strProperties = \"properties\";\r\n/** @ignore */\r\nfunction _calcPerfDuration(resourceEntry, start, end) {\r\n var result = 0;\r\n var from = resourceEntry[start];\r\n var to = resourceEntry[end];\r\n if (from && to) {\r\n result = dateTimeUtilsDuration(from, to);\r\n }\r\n return result;\r\n}\r\n/** @ignore */\r\nfunction _setPerfDuration(props, name, resourceEntry, start, end) {\r\n var result = 0;\r\n var value = _calcPerfDuration(resourceEntry, start, end);\r\n if (value) {\r\n result = _setPerfValue(props, name, msToTimeSpan(value));\r\n }\r\n return result;\r\n}\r\n/** @ignore */\r\nfunction _setPerfValue(props, name, value) {\r\n var strPerf = \"ajaxPerf\";\r\n var result = 0;\r\n if (props && name && value) {\r\n var perfData = props[strPerf] = (props[strPerf] || {});\r\n perfData[name] = value;\r\n result = 1;\r\n }\r\n return result;\r\n}\r\n/** @ignore */\r\nfunction _populatePerfData(ajaxData, dependency) {\r\n /*\r\n * https://developer.mozilla.org/en-US/docs/Web/API/Resource_Timing_API/Using_the_Resource_Timing_API\r\n * | -startTime\r\n * | -redirectStart\r\n * | | -redirectEnd\r\n * | | | -fetchStart\r\n * | | | | -domainLookupStart\r\n * | | | | |- domainLookupEnd\r\n * | | | | | | -connectStart\r\n * | | | | | | | -secureConnectionStart\r\n * | | | | | | | | -connectEnd\r\n * | | | | | | | | | -requestStart\r\n * | | | | | | | | | | | -responseStart\r\n * | | | | | | | | | | | | | -responseEnd\r\n * +------------+-+---+----------------+-+--+--------+-+-----------+-+------------+-+\r\n * |--redirect--| |---|--domainLookup--| |--connect--| |--request--| |--response--| |\r\n * |-------------------networkConnect----------------|\r\n * | |---------sentRequest--------|\r\n * |------------------------------------perfTotal-----------------------------------|\r\n */\r\n var resourceEntry = ajaxData.perfTiming;\r\n var props = dependency[strProperties] || {};\r\n var propsSet = 0;\r\n var strName = \"name\";\r\n var strStart = \"Start\";\r\n var strEnd = \"End\";\r\n var strDomainLookup = \"domainLookup\";\r\n var strConnect = \"connect\";\r\n var strRedirect = \"redirect\";\r\n var strRequest = \"request\";\r\n var strResponse = \"response\";\r\n var strDuration = \"duration\";\r\n var strStartTime = \"startTime\";\r\n var strDomainLookupStart = strDomainLookup + strStart;\r\n var strDomainLookupEnd = strDomainLookup + strEnd;\r\n var strConnectStart = strConnect + strStart;\r\n var strConnectEnd = strConnect + strEnd;\r\n var strRequestStart = strRequest + strStart;\r\n var strRequestEnd = strRequest + strEnd;\r\n var strResponseStart = strResponse + strStart;\r\n var strResponseEnd = strResponse + strEnd;\r\n var strRedirectStart = strRedirect + strStart;\r\n var strRedirectEnd = strRedirect = strEnd;\r\n var strTransferSize = \"transferSize\";\r\n var strEncodedBodySize = \"encodedBodySize\";\r\n var strDecodedBodySize = \"decodedBodySize\";\r\n var strServerTiming = \"serverTiming\";\r\n if (resourceEntry) {\r\n // redirect\r\n propsSet |= _setPerfDuration(props, strRedirect, resourceEntry, strRedirectStart, strRedirectEnd);\r\n // domainLookup\r\n propsSet |= _setPerfDuration(props, strDomainLookup, resourceEntry, strDomainLookupStart, strDomainLookupEnd);\r\n // connect\r\n propsSet |= _setPerfDuration(props, strConnect, resourceEntry, strConnectStart, strConnectEnd);\r\n // request\r\n propsSet |= _setPerfDuration(props, strRequest, resourceEntry, strRequestStart, strRequestEnd);\r\n // response\r\n propsSet |= _setPerfDuration(props, strResponse, resourceEntry, strResponseStart, strResponseEnd);\r\n // Network connection time\r\n propsSet |= _setPerfDuration(props, \"networkConnect\", resourceEntry, strStartTime, strConnectEnd);\r\n // Sent Request\r\n propsSet |= _setPerfDuration(props, \"sentRequest\", resourceEntry, strRequestStart, strResponseEnd);\r\n // PerfTotal / Duration\r\n var duration = resourceEntry[strDuration];\r\n if (!duration) {\r\n duration = _calcPerfDuration(resourceEntry, strStartTime, strResponseEnd) || 0;\r\n }\r\n propsSet |= _setPerfValue(props, strDuration, duration);\r\n propsSet |= _setPerfValue(props, \"perfTotal\", duration);\r\n var serverTiming = resourceEntry[strServerTiming];\r\n if (serverTiming) {\r\n var server_1 = {};\r\n arrForEach(serverTiming, function (value, idx) {\r\n var name = normalizeJsName(value[strName] || \"\" + idx);\r\n var newValue = server_1[name] || {};\r\n objForEachKey(value, function (key, val) {\r\n if (key !== strName && isString(val) || isNumber(val)) {\r\n if (newValue[key]) {\r\n val = newValue[key] + \";\" + val;\r\n }\r\n if (val || !isString(val)) {\r\n // Only set the value if it has a value and it's not an empty string\r\n newValue[key] = val;\r\n }\r\n }\r\n });\r\n server_1[name] = newValue;\r\n });\r\n propsSet |= _setPerfValue(props, strServerTiming, server_1);\r\n }\r\n propsSet |= _setPerfValue(props, strTransferSize, resourceEntry[strTransferSize]);\r\n propsSet |= _setPerfValue(props, strEncodedBodySize, resourceEntry[strEncodedBodySize]);\r\n propsSet |= _setPerfValue(props, strDecodedBodySize, resourceEntry[strDecodedBodySize]);\r\n }\r\n else {\r\n if (ajaxData.perfMark) {\r\n propsSet |= _setPerfValue(props, \"missing\", ajaxData.perfAttempts);\r\n }\r\n }\r\n if (propsSet) {\r\n dependency[strProperties] = props;\r\n }\r\n}\r\nvar XHRMonitoringState = /** @class */ (function () {\r\n function XHRMonitoringState() {\r\n var self = this;\r\n self.openDone = false;\r\n self.setRequestHeaderDone = false;\r\n self.sendDone = false;\r\n self.abortDone = false;\r\n // True, if onreadyStateChangeCallback function attached to xhr, otherwise false\r\n self.stateChangeAttached = false;\r\n }\r\n return XHRMonitoringState;\r\n}());\r\nexport { XHRMonitoringState };\r\nvar ajaxRecord = /** @class */ (function () {\r\n function ajaxRecord(traceID, spanID, logger) {\r\n var self = this;\r\n var _logger = logger;\r\n var strResponseText = \"responseText\";\r\n // Assigning the initial/default values within the constructor to avoid typescript from creating a bunch of\r\n // this.XXXX = null\r\n self.perfMark = null;\r\n self.completed = false;\r\n self.requestHeadersSize = null;\r\n self.requestHeaders = null;\r\n self.responseReceivingDuration = null;\r\n self.callbackDuration = null;\r\n self.ajaxTotalDuration = null;\r\n self.aborted = 0;\r\n self.pageUrl = null;\r\n self.requestUrl = null;\r\n self.requestSize = 0;\r\n self.method = null;\r\n self.status = null;\r\n self.requestSentTime = null;\r\n self.responseStartedTime = null;\r\n self.responseFinishedTime = null;\r\n self.callbackFinishedTime = null;\r\n self.endTime = null;\r\n self.xhrMonitoringState = new XHRMonitoringState();\r\n self.clientFailure = 0;\r\n self.traceID = traceID;\r\n self.spanID = spanID;\r\n dynamicProto(ajaxRecord, self, function (self) {\r\n self.getAbsoluteUrl = function () {\r\n return self.requestUrl ? urlGetAbsoluteUrl(self.requestUrl) : null;\r\n };\r\n self.getPathName = function () {\r\n return self.requestUrl ? dataSanitizeUrl(_logger, urlGetCompleteUrl(self.method, self.requestUrl)) : null;\r\n };\r\n self.CreateTrackItem = function (ajaxType, enableRequestHeaderTracking, getResponse) {\r\n var _a;\r\n // round to 3 decimal points\r\n self.ajaxTotalDuration = Math.round(dateTimeUtilsDuration(self.requestSentTime, self.responseFinishedTime) * 1000) / 1000;\r\n if (self.ajaxTotalDuration < 0) {\r\n return null;\r\n }\r\n var dependency = (_a = {\r\n id: \"|\" + self.traceID + \".\" + self.spanID,\r\n target: self.getAbsoluteUrl(),\r\n name: self.getPathName(),\r\n type: ajaxType,\r\n startTime: null,\r\n duration: self.ajaxTotalDuration,\r\n success: (+(self.status)) >= 200 && (+(self.status)) < 400,\r\n responseCode: (+(self.status)),\r\n method: self.method\r\n },\r\n _a[strProperties] = { HttpMethod: self.method },\r\n _a);\r\n if (self.requestSentTime) {\r\n // Set the correct dependency start time\r\n dependency.startTime = new Date();\r\n dependency.startTime.setTime(self.requestSentTime);\r\n }\r\n // Add Ajax perf details if available\r\n _populatePerfData(self, dependency);\r\n if (enableRequestHeaderTracking) {\r\n if (objKeys(self.requestHeaders).length > 0) {\r\n dependency[strProperties] = dependency[strProperties] || {};\r\n dependency[strProperties].requestHeaders = self.requestHeaders;\r\n }\r\n }\r\n if (getResponse) {\r\n var response = getResponse();\r\n if (response) {\r\n // enrich dependency target with correlation context from the server\r\n var correlationContext = response.correlationContext;\r\n if (correlationContext) {\r\n dependency.correlationContext = /* dependency.target + \" | \" + */ correlationContext;\r\n }\r\n if (response.headerMap) {\r\n if (objKeys(response.headerMap).length > 0) {\r\n dependency[strProperties] = dependency[strProperties] || {};\r\n dependency[strProperties].responseHeaders = response.headerMap;\r\n }\r\n }\r\n if (self.errorStatusText && self.status >= 400) {\r\n var responseType = response.type;\r\n dependency[strProperties] = dependency[strProperties] || {};\r\n if (responseType === \"\" || responseType === \"text\") {\r\n dependency[strProperties][strResponseText] = response[strResponseText] ? response.statusText + \" - \" + response[strResponseText] : response.statusText;\r\n }\r\n if (responseType === \"json\") {\r\n dependency[strProperties][strResponseText] = response.response ? response.statusText + \" - \" + JSON.stringify(response.response) : response.statusText;\r\n }\r\n }\r\n }\r\n }\r\n return dependency;\r\n };\r\n });\r\n }\r\n ajaxRecord.prototype.getAbsoluteUrl = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n ajaxRecord.prototype.getPathName = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n ajaxRecord.prototype.CreateTrackItem = function (ajaxType, enableRequestHeaderTracking, getResponse) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return ajaxRecord;\r\n}());\r\nexport { ajaxRecord };\r\n//# sourceMappingURL=ajaxRecord.js.map","import { generateW3CId } from \"@microsoft/applicationinsights-core-js\";\r\nvar Traceparent = /** @class */ (function () {\r\n function Traceparent(traceId, spanId) {\r\n var self = this;\r\n self.traceFlag = Traceparent.DEFAULT_TRACE_FLAG;\r\n self.version = Traceparent.DEFAULT_VERSION;\r\n if (traceId && Traceparent.isValidTraceId(traceId)) {\r\n self.traceId = traceId;\r\n }\r\n else {\r\n self.traceId = generateW3CId();\r\n }\r\n if (spanId && Traceparent.isValidSpanId(spanId)) {\r\n self.spanId = spanId;\r\n }\r\n else {\r\n self.spanId = generateW3CId().substr(0, 16);\r\n }\r\n }\r\n Traceparent.isValidTraceId = function (id) {\r\n return id.match(/^[0-9a-f]{32}$/) && id !== \"00000000000000000000000000000000\";\r\n };\r\n Traceparent.isValidSpanId = function (id) {\r\n return id.match(/^[0-9a-f]{16}$/) && id !== \"0000000000000000\";\r\n };\r\n Traceparent.prototype.toString = function () {\r\n var self = this;\r\n return self.version + \"-\" + self.traceId + \"-\" + self.spanId + \"-\" + self.traceFlag;\r\n };\r\n Traceparent.DEFAULT_TRACE_FLAG = \"01\";\r\n Traceparent.DEFAULT_VERSION = \"00\";\r\n return Traceparent;\r\n}());\r\nexport { Traceparent };\r\n//# sourceMappingURL=TraceParent.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __assign, __extends } from \"tslib\";\r\nimport { RequestHeaders, CorrelationIdHelper, TelemetryItemCreator, RemoteDependencyData, dateTimeUtilsNow, DisabledPropertyName, PropertiesPluginIdentifier, DistributedTracingModes, isInternalApplicationInsightsEndpoint } from \"@microsoft/applicationinsights-common\";\r\nimport { isNullOrUndefined, arrForEach, isString, strTrim, isFunction, LoggingSeverity, _InternalMessageId, BaseTelemetryPlugin, getLocation, getGlobal, strPrototype, InstrumentFunc, InstrumentProto, getPerformance, objForEachKey, generateW3CId, getIEVersion, dumpObj, isXhrSupported, attachEvent } from \"@microsoft/applicationinsights-core-js\";\r\nimport { ajaxRecord } from \"./ajaxRecord\";\r\nimport { Traceparent } from \"./TraceParent\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nvar AJAX_MONITOR_PREFIX = \"ai.ajxmn.\";\r\nvar strDiagLog = \"diagLog\";\r\nvar strAjaxData = \"ajaxData\";\r\nvar strThrowInternal = \"throwInternal\";\r\nvar strFetch = \"fetch\";\r\n// Using a global value so that to handle same iKey with multiple app insights instances (mostly for testing)\r\nvar _markCount = 0;\r\n/** @Ignore */\r\nfunction _supportsFetch() {\r\n var _global = getGlobal();\r\n if (!_global ||\r\n isNullOrUndefined(_global.Request) ||\r\n isNullOrUndefined(_global.Request[strPrototype]) ||\r\n isNullOrUndefined(_global[strFetch])) {\r\n return null;\r\n }\r\n return _global[strFetch];\r\n}\r\n/**\r\n * Determines whether ajax monitoring can be enabled on this document\r\n * @returns True if Ajax monitoring is supported on this page, otherwise false\r\n * @ignore\r\n */\r\nfunction _supportsAjaxMonitoring(ajaxMonitorInstance) {\r\n var result = false;\r\n if (isXhrSupported()) {\r\n var proto = XMLHttpRequest[strPrototype];\r\n result = !isNullOrUndefined(proto) &&\r\n !isNullOrUndefined(proto.open) && // eslint-disable-line security/detect-non-literal-fs-filename -- false positive\r\n !isNullOrUndefined(proto.send) &&\r\n !isNullOrUndefined(proto.abort);\r\n }\r\n var ieVer = getIEVersion();\r\n if (ieVer && ieVer < 9) {\r\n result = false;\r\n }\r\n if (result) {\r\n // Disable if the XmlHttpRequest can't be extended or hooked\r\n try {\r\n var xhr = new XMLHttpRequest();\r\n xhr[strAjaxData] = {};\r\n // Check that we can update the prototype\r\n var theOpen = XMLHttpRequest[strPrototype].open;\r\n XMLHttpRequest[strPrototype].open = theOpen;\r\n }\r\n catch (e) {\r\n // We can't decorate the xhr object so disable monitoring\r\n result = false;\r\n _throwInternalCritical(ajaxMonitorInstance, _InternalMessageId.FailedMonitorAjaxOpen, \"Failed to enable XMLHttpRequest monitoring, extension is not supported\", {\r\n exception: dumpObj(e)\r\n });\r\n }\r\n }\r\n return result;\r\n}\r\n/** @Ignore */\r\nfunction _getFailedAjaxDiagnosticsMessage(xhr) {\r\n var result = \"\";\r\n try {\r\n if (!isNullOrUndefined(xhr) &&\r\n !isNullOrUndefined(xhr[strAjaxData]) &&\r\n !isNullOrUndefined(xhr[strAjaxData].requestUrl)) {\r\n result += \"(url: '\" + xhr[strAjaxData].requestUrl + \"')\";\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return result;\r\n}\r\n/** @ignore */\r\nfunction _throwInternalCritical(ajaxMonitorInstance, msgId, message, properties, isUserAct) {\r\n ajaxMonitorInstance[strDiagLog]()[strThrowInternal](LoggingSeverity.CRITICAL, msgId, message, properties, isUserAct);\r\n}\r\n/** @ignore */\r\nfunction _throwInternalWarning(ajaxMonitorInstance, msgId, message, properties, isUserAct) {\r\n ajaxMonitorInstance[strDiagLog]()[strThrowInternal](LoggingSeverity.WARNING, msgId, message, properties, isUserAct);\r\n}\r\n/** @Ignore */\r\nfunction _createErrorCallbackFunc(ajaxMonitorInstance, internalMessage, message) {\r\n // tslint:disable-next-line\r\n return function (args) {\r\n _throwInternalCritical(ajaxMonitorInstance, internalMessage, message, {\r\n ajaxDiagnosticsMessage: _getFailedAjaxDiagnosticsMessage(args.inst),\r\n exception: dumpObj(args.err)\r\n });\r\n };\r\n}\r\nfunction _indexOf(value, match) {\r\n if (value && match) {\r\n return value.indexOf(match);\r\n }\r\n return -1;\r\n}\r\nvar AjaxMonitor = /** @class */ (function (_super) {\r\n __extends(AjaxMonitor, _super);\r\n function AjaxMonitor() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = AjaxMonitor.identifier;\r\n _this.priority = 120;\r\n var strTrackDependencyDataInternal = \"trackDependencyDataInternal\"; // Using string to help with minification\r\n var location = getLocation();\r\n var _fetchInitialized = false; // fetch monitoring initialized\r\n var _xhrInitialized = false; // XHR monitoring initialized\r\n var _currentWindowHost = location && location.host && location.host.toLowerCase();\r\n var _config = AjaxMonitor.getEmptyConfig();\r\n var _enableRequestHeaderTracking = false;\r\n var _enableAjaxErrorStatusText = false;\r\n var _trackAjaxAttempts = 0;\r\n var _context;\r\n var _isUsingW3CHeaders;\r\n var _isUsingAIHeaders;\r\n var _markPrefix;\r\n var _enableAjaxPerfTracking = false;\r\n var _maxAjaxCallsPerView = 0;\r\n var _enableResponseHeaderTracking = false;\r\n var _hooks = [];\r\n var _disabledUrls = {};\r\n var _excludeRequestFromAutoTrackingPatterns;\r\n var _addRequestContext;\r\n dynamicProto(AjaxMonitor, _this, function (_self, base) {\r\n _self.initialize = function (config, core, extensions, pluginChain) {\r\n if (!_self.isInitialized()) {\r\n base.initialize(config, core, extensions, pluginChain);\r\n var ctx_1 = _self._getTelCtx();\r\n var defaultConfig = AjaxMonitor.getDefaultConfig();\r\n objForEachKey(defaultConfig, function (field, value) {\r\n _config[field] = ctx_1.getConfig(AjaxMonitor.identifier, field, value);\r\n });\r\n var distributedTracingMode = _config.distributedTracingMode;\r\n _enableRequestHeaderTracking = _config.enableRequestHeaderTracking;\r\n _enableAjaxErrorStatusText = _config.enableAjaxErrorStatusText;\r\n _enableAjaxPerfTracking = _config.enableAjaxPerfTracking;\r\n _maxAjaxCallsPerView = _config.maxAjaxCallsPerView;\r\n _enableResponseHeaderTracking = _config.enableResponseHeaderTracking;\r\n _excludeRequestFromAutoTrackingPatterns = _config.excludeRequestFromAutoTrackingPatterns;\r\n _addRequestContext = _config.addRequestContext;\r\n _isUsingAIHeaders = distributedTracingMode === DistributedTracingModes.AI || distributedTracingMode === DistributedTracingModes.AI_AND_W3C;\r\n _isUsingW3CHeaders = distributedTracingMode === DistributedTracingModes.AI_AND_W3C || distributedTracingMode === DistributedTracingModes.W3C;\r\n if (_enableAjaxPerfTracking) {\r\n var iKey = config.instrumentationKey || \"unkwn\";\r\n if (iKey.length > 5) {\r\n _markPrefix = AJAX_MONITOR_PREFIX + iKey.substring(iKey.length - 5) + \".\";\r\n }\r\n else {\r\n _markPrefix = AJAX_MONITOR_PREFIX + iKey + \".\";\r\n }\r\n }\r\n if (_config.disableAjaxTracking === false) {\r\n _instrumentXhr();\r\n }\r\n _instrumentFetch();\r\n if (extensions.length > 0 && extensions) {\r\n var propExt = void 0, extIx = 0;\r\n while (!propExt && extIx < extensions.length) {\r\n if (extensions[extIx] && extensions[extIx].identifier === PropertiesPluginIdentifier) {\r\n propExt = extensions[extIx];\r\n }\r\n extIx++;\r\n }\r\n if (propExt) {\r\n _context = propExt.context; // we could move IPropertiesPlugin to common as well\r\n }\r\n }\r\n }\r\n };\r\n _self.teardown = function () {\r\n // Remove all instrumentation hooks\r\n arrForEach(_hooks, function (fn) {\r\n fn.rm();\r\n });\r\n _hooks = [];\r\n _fetchInitialized = false;\r\n _xhrInitialized = false;\r\n _self.setInitialized(false);\r\n };\r\n _self.trackDependencyData = function (dependency, properties) {\r\n _self[strTrackDependencyDataInternal](dependency, properties);\r\n };\r\n _self.includeCorrelationHeaders = function (ajaxData, input, init, xhr) {\r\n // Test Hook to allow the overriding of the location host\r\n var currentWindowHost = _self[\"_currentWindowHost\"] || _currentWindowHost;\r\n if (input) { // Fetch\r\n if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {\r\n if (!init) {\r\n init = {};\r\n }\r\n // init headers override original request headers\r\n // so, if they exist use only them, otherwise use request's because they should have been applied in the first place\r\n // not using original request headers will result in them being lost\r\n init.headers = new Headers(init.headers || (input instanceof Request ? (input.headers || {}) : {}));\r\n if (_isUsingAIHeaders) {\r\n var id = \"|\" + ajaxData.traceID + \".\" + ajaxData.spanID;\r\n init.headers.set(RequestHeaders.requestIdHeader, id);\r\n if (_enableRequestHeaderTracking) {\r\n ajaxData.requestHeaders[RequestHeaders.requestIdHeader] = id;\r\n }\r\n }\r\n var appId = _config.appId || (_context && _context.appId());\r\n if (appId) {\r\n init.headers.set(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId);\r\n if (_enableRequestHeaderTracking) {\r\n ajaxData.requestHeaders[RequestHeaders.requestContextHeader] = RequestHeaders.requestContextAppIdFormat + appId;\r\n }\r\n }\r\n if (_isUsingW3CHeaders) {\r\n var traceparent = new Traceparent(ajaxData.traceID, ajaxData.spanID);\r\n init.headers.set(RequestHeaders.traceParentHeader, traceparent.toString());\r\n if (_enableRequestHeaderTracking) {\r\n ajaxData.requestHeaders[RequestHeaders.traceParentHeader] = traceparent.toString();\r\n }\r\n }\r\n }\r\n return init;\r\n }\r\n else if (xhr) { // XHR\r\n if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {\r\n if (_isUsingAIHeaders) {\r\n var id = \"|\" + ajaxData.traceID + \".\" + ajaxData.spanID;\r\n xhr.setRequestHeader(RequestHeaders.requestIdHeader, id);\r\n if (_enableRequestHeaderTracking) {\r\n ajaxData.requestHeaders[RequestHeaders.requestIdHeader] = id;\r\n }\r\n }\r\n var appId = _config.appId || (_context && _context.appId());\r\n if (appId) {\r\n xhr.setRequestHeader(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId);\r\n if (_enableRequestHeaderTracking) {\r\n ajaxData.requestHeaders[RequestHeaders.requestContextHeader] = RequestHeaders.requestContextAppIdFormat + appId;\r\n }\r\n }\r\n if (_isUsingW3CHeaders) {\r\n var traceparent = new Traceparent(ajaxData.traceID, ajaxData.spanID);\r\n xhr.setRequestHeader(RequestHeaders.traceParentHeader, traceparent.toString());\r\n if (_enableRequestHeaderTracking) {\r\n ajaxData.requestHeaders[RequestHeaders.traceParentHeader] = traceparent.toString();\r\n }\r\n }\r\n }\r\n return xhr;\r\n }\r\n return undefined;\r\n };\r\n _self[strTrackDependencyDataInternal] = function (dependency, properties, systemProperties) {\r\n if (_maxAjaxCallsPerView === -1 || _trackAjaxAttempts < _maxAjaxCallsPerView) {\r\n // Hack since expected format in w3c mode is |abc.def.\r\n // Non-w3c format is |abc.def\r\n // @todo Remove if better solution is available, e.g. handle in portal\r\n if ((_config.distributedTracingMode === DistributedTracingModes.W3C\r\n || _config.distributedTracingMode === DistributedTracingModes.AI_AND_W3C)\r\n && typeof dependency.id === \"string\" && dependency.id[dependency.id.length - 1] !== \".\") {\r\n dependency.id += \".\";\r\n }\r\n if (isNullOrUndefined(dependency.startTime)) {\r\n dependency.startTime = new Date();\r\n }\r\n var item = TelemetryItemCreator.create(dependency, RemoteDependencyData.dataType, RemoteDependencyData.envelopeType, _self[strDiagLog](), properties, systemProperties);\r\n _self.core.track(item);\r\n }\r\n else if (_trackAjaxAttempts === _maxAjaxCallsPerView) {\r\n _throwInternalCritical(_self, _InternalMessageId.MaxAjaxPerPVExceeded, \"Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.\", true);\r\n }\r\n ++_trackAjaxAttempts;\r\n };\r\n // discard the header if it's defined as ignoreHeaders in ICorrelationConfig\r\n function _canIncludeHeaders(header) {\r\n var rlt = true;\r\n if (header || _config.ignoreHeaders) {\r\n arrForEach(_config.ignoreHeaders, (function (key) {\r\n if (key.toLowerCase() === header.toLowerCase()) {\r\n rlt = false;\r\n return -1;\r\n }\r\n }));\r\n }\r\n return rlt;\r\n }\r\n // Fetch Stuff\r\n function _instrumentFetch() {\r\n var fetch = _supportsFetch();\r\n if (!fetch) {\r\n return;\r\n }\r\n var global = getGlobal();\r\n var isPolyfill = fetch.polyfill;\r\n if (_config.disableFetchTracking === false) {\r\n _hooks.push(InstrumentFunc(global, strFetch, {\r\n // Add request hook\r\n req: function (callDetails, input, init) {\r\n var fetchData;\r\n if (_fetchInitialized &&\r\n !_isDisabledRequest(null, input, init) &&\r\n // If we have a polyfil and XHR instrumented then let XHR report otherwise we get duplicates\r\n !(isPolyfill && _xhrInitialized)) {\r\n var ctx = callDetails.ctx();\r\n fetchData = _createFetchRecord(input, init);\r\n var newInit = _self.includeCorrelationHeaders(fetchData, input, init);\r\n if (newInit !== init) {\r\n callDetails.set(1, newInit);\r\n }\r\n ctx.data = fetchData;\r\n }\r\n },\r\n rsp: function (callDetails, input) {\r\n var fetchData = callDetails.ctx().data;\r\n if (fetchData) {\r\n // Replace the result with the new promise from this code\r\n callDetails.rslt = callDetails.rslt.then(function (response) {\r\n _reportFetchMetrics(callDetails, (response || {}).status, input, response, fetchData, function () {\r\n var ajaxResponse = {\r\n statusText: response.statusText,\r\n headerMap: null,\r\n correlationContext: _getFetchCorrelationContext(response)\r\n };\r\n if (_enableResponseHeaderTracking) {\r\n var responseHeaderMap_1 = {};\r\n response.headers.forEach(function (value, name) {\r\n if (_canIncludeHeaders(name)) {\r\n responseHeaderMap_1[name] = value;\r\n }\r\n });\r\n ajaxResponse.headerMap = responseHeaderMap_1;\r\n }\r\n return ajaxResponse;\r\n });\r\n return response;\r\n })[\"catch\"](function (reason) {\r\n _reportFetchMetrics(callDetails, 0, input, null, fetchData, null, { error: reason.message });\r\n throw reason;\r\n });\r\n }\r\n },\r\n // Create an error callback to report any hook errors\r\n hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxOpen, \"Failed to monitor Window.fetch, monitoring data for this fetch call may be incorrect.\")\r\n }));\r\n _fetchInitialized = true;\r\n }\r\n else if (isPolyfill) {\r\n // If fetch is a polyfill we need to capture the request to ensure that we correctly track\r\n // disabled request URLS (i.e. internal urls) to ensure we don't end up in a constant loop\r\n // of reporting ourselves, for example React Native uses a polyfill for fetch\r\n // Note: Polyfill implementations that don't support the \"poyyfill\" tag are not supported\r\n // the workaround is to add a polyfill property to your fetch implementation before initializing\r\n // App Insights\r\n _hooks.push(InstrumentFunc(global, strFetch, {\r\n req: function (callDetails, input, init) {\r\n // Just call so that we record any disabled URL\r\n _isDisabledRequest(null, input, init);\r\n }\r\n }));\r\n }\r\n if (isPolyfill) {\r\n // retag the instrumented fetch with the same polyfill settings this is mostly for testing\r\n // But also supports multiple App Insights usages\r\n global[strFetch].polyfill = isPolyfill;\r\n }\r\n }\r\n function _hookProto(target, funcName, callbacks) {\r\n _hooks.push(InstrumentProto(target, funcName, callbacks));\r\n }\r\n function _instrumentXhr() {\r\n if (_supportsAjaxMonitoring(_self) && !_xhrInitialized) {\r\n // Instrument open\r\n _hookProto(XMLHttpRequest, \"open\", {\r\n req: function (args, method, url, async) {\r\n var xhr = args.inst;\r\n var ajaxData = xhr[strAjaxData];\r\n if (!_isDisabledRequest(xhr, url) && _isMonitoredXhrInstance(xhr, true)) {\r\n if (!ajaxData || !ajaxData.xhrMonitoringState.openDone) {\r\n // Only create a single ajaxData (even when multiple AI instances are running)\r\n _openHandler(xhr, method, url, async);\r\n }\r\n // always attach to the on ready state change (required for handling multiple instances)\r\n _attachToOnReadyStateChange(xhr);\r\n }\r\n },\r\n hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxOpen, \"Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.\")\r\n });\r\n // Instrument send\r\n _hookProto(XMLHttpRequest, \"send\", {\r\n req: function (args, context) {\r\n var xhr = args.inst;\r\n var ajaxData = xhr[strAjaxData];\r\n if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState.sendDone) {\r\n _createMarkId(\"xhr\", ajaxData);\r\n ajaxData.requestSentTime = dateTimeUtilsNow();\r\n _self.includeCorrelationHeaders(ajaxData, undefined, undefined, xhr);\r\n ajaxData.xhrMonitoringState.sendDone = true;\r\n }\r\n },\r\n hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxSend, \"Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.\")\r\n });\r\n // Instrument abort\r\n _hookProto(XMLHttpRequest, \"abort\", {\r\n req: function (args) {\r\n var xhr = args.inst;\r\n var ajaxData = xhr[strAjaxData];\r\n if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState.abortDone) {\r\n ajaxData.aborted = 1;\r\n ajaxData.xhrMonitoringState.abortDone = true;\r\n }\r\n },\r\n hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxAbort, \"Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.\")\r\n });\r\n // Instrument setRequestHeader\r\n if (_enableRequestHeaderTracking) {\r\n _hookProto(XMLHttpRequest, \"setRequestHeader\", {\r\n req: function (args, header, value) {\r\n var xhr = args.inst;\r\n if (_isMonitoredXhrInstance(xhr) && _canIncludeHeaders(header)) {\r\n xhr[strAjaxData].requestHeaders[header] = value;\r\n }\r\n },\r\n hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxSetRequestHeader, \"Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.\")\r\n });\r\n }\r\n _xhrInitialized = true;\r\n }\r\n }\r\n function _isDisabledRequest(xhr, request, init) {\r\n var isDisabled = false;\r\n var theUrl = ((!isString(request) ? (request || {}).url || \"\" : request) || \"\").toLowerCase();\r\n // check excludeRequestFromAutoTrackingPatterns before stripping off any query string\r\n arrForEach(_excludeRequestFromAutoTrackingPatterns, function (regex) {\r\n var theRegex = regex;\r\n if (isString(regex)) {\r\n theRegex = new RegExp(regex);\r\n }\r\n if (!isDisabled) {\r\n isDisabled = theRegex.test(theUrl);\r\n }\r\n });\r\n // if request url matches with exclude regex pattern, return true and no need to check for headers\r\n if (isDisabled) {\r\n return isDisabled;\r\n }\r\n var idx = _indexOf(theUrl, \"?\");\r\n var idx2 = _indexOf(theUrl, \"#\");\r\n if (idx === -1 || (idx2 !== -1 && idx2 < idx)) {\r\n idx = idx2;\r\n }\r\n if (idx !== -1) {\r\n // Strip off any Query string\r\n theUrl = theUrl.substring(0, idx);\r\n }\r\n // check that this instance is not not used by ajax call performed inside client side monitoring to send data to collector\r\n if (!isNullOrUndefined(xhr)) {\r\n // Look on the XMLHttpRequest of the URL string value\r\n isDisabled = xhr[DisabledPropertyName] === true || theUrl[DisabledPropertyName] === true;\r\n }\r\n else if (!isNullOrUndefined(request)) { // fetch\r\n // Look for DisabledPropertyName in either Request or RequestInit\r\n isDisabled = (typeof request === \"object\" ? request[DisabledPropertyName] === true : false) ||\r\n (init ? init[DisabledPropertyName] === true : false);\r\n }\r\n // Also add extra check just in case the XHR or fetch objects where not decorated with the DisableProperty due to sealing or freezing\r\n if (!isDisabled && theUrl && isInternalApplicationInsightsEndpoint(theUrl)) {\r\n isDisabled = true;\r\n }\r\n if (isDisabled) {\r\n // Add the disabled url if not present\r\n if (!_disabledUrls[theUrl]) {\r\n _disabledUrls[theUrl] = 1;\r\n }\r\n }\r\n else {\r\n // Check to see if the url is listed as disabled\r\n if (_disabledUrls[theUrl]) {\r\n isDisabled = true;\r\n }\r\n }\r\n return isDisabled;\r\n }\r\n /// Verifies that particalar instance of XMLHttpRequest needs to be monitored\r\n /// Optional parameter. True if ajaxData must be excluded from verification\r\n /// True if instance needs to be monitored, otherwise false\r\n function _isMonitoredXhrInstance(xhr, excludeAjaxDataValidation) {\r\n var ajaxValidation = true;\r\n var initialized = _xhrInitialized;\r\n if (!isNullOrUndefined(xhr)) {\r\n ajaxValidation = excludeAjaxDataValidation === true || !isNullOrUndefined(xhr[strAjaxData]);\r\n }\r\n // checking to see that all interested functions on xhr were instrumented\r\n return initialized\r\n // checking on ajaxData to see that it was not removed in user code\r\n && ajaxValidation;\r\n }\r\n function _openHandler(xhr, method, url, async) {\r\n var traceID = (_context && _context.telemetryTrace && _context.telemetryTrace.traceID) || generateW3CId();\r\n var spanID = generateW3CId().substr(0, 16);\r\n var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog]());\r\n ajaxData.method = method;\r\n ajaxData.requestUrl = url;\r\n ajaxData.xhrMonitoringState.openDone = true;\r\n ajaxData.requestHeaders = {};\r\n ajaxData.async = async;\r\n ajaxData.errorStatusText = _enableAjaxErrorStatusText;\r\n xhr[strAjaxData] = ajaxData;\r\n }\r\n function _attachToOnReadyStateChange(xhr) {\r\n xhr[strAjaxData].xhrMonitoringState.stateChangeAttached = attachEvent(xhr, \"readystatechange\", function () {\r\n try {\r\n if (xhr && xhr.readyState === 4 && _isMonitoredXhrInstance(xhr)) {\r\n _onAjaxComplete(xhr);\r\n }\r\n }\r\n catch (e) {\r\n var exceptionText = dumpObj(e);\r\n // ignore messages with c00c023f, as this a known IE9 XHR abort issue\r\n if (!exceptionText || _indexOf(exceptionText.toLowerCase(), \"c00c023f\") === -1) {\r\n _throwInternalCritical(_self, _InternalMessageId.FailedMonitorAjaxRSC, \"Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.\", {\r\n ajaxDiagnosticsMessage: _getFailedAjaxDiagnosticsMessage(xhr),\r\n exception: exceptionText\r\n });\r\n }\r\n }\r\n });\r\n }\r\n function _getResponseText(xhr) {\r\n try {\r\n var responseType = xhr.responseType;\r\n if (responseType === \"\" || responseType === \"text\") {\r\n // As per the specification responseText is only valid if the type is an empty string or \"text\"\r\n return xhr.responseText;\r\n }\r\n }\r\n catch (e) {\r\n // This shouldn't happen because of the above check -- but just in case, so just ignore\r\n }\r\n return null;\r\n }\r\n function _onAjaxComplete(xhr) {\r\n var ajaxData = xhr[strAjaxData];\r\n ajaxData.responseFinishedTime = dateTimeUtilsNow();\r\n ajaxData.status = xhr.status;\r\n function _reportXhrError(e, failedProps) {\r\n var errorProps = failedProps || {};\r\n errorProps[\"ajaxDiagnosticsMessage\"] = _getFailedAjaxDiagnosticsMessage(xhr);\r\n if (e) {\r\n errorProps[\"exception\"] = dumpObj(e);\r\n }\r\n _throwInternalWarning(_self, _InternalMessageId.FailedMonitorAjaxDur, \"Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.\", errorProps);\r\n }\r\n _findPerfResourceEntry(\"xmlhttprequest\", ajaxData, function () {\r\n try {\r\n var dependency = ajaxData.CreateTrackItem(\"Ajax\", _enableRequestHeaderTracking, function () {\r\n var ajaxResponse = {\r\n statusText: xhr.statusText,\r\n headerMap: null,\r\n correlationContext: _getAjaxCorrelationContext(xhr),\r\n type: xhr.responseType,\r\n responseText: _getResponseText(xhr),\r\n response: xhr.response\r\n };\r\n if (_enableResponseHeaderTracking) {\r\n var headers = xhr.getAllResponseHeaders();\r\n if (headers) {\r\n // xhr.getAllResponseHeaders() method returns all the response headers, separated by CRLF, as a string or null\r\n // the regex converts the header string into an array of individual headers\r\n var arr = strTrim(headers).split(/[\\r\\n]+/);\r\n var responseHeaderMap_2 = {};\r\n arrForEach(arr, function (line) {\r\n var parts = line.split(\": \");\r\n var header = parts.shift();\r\n var value = parts.join(\": \");\r\n if (_canIncludeHeaders(header)) {\r\n responseHeaderMap_2[header] = value;\r\n }\r\n });\r\n ajaxResponse.headerMap = responseHeaderMap_2;\r\n }\r\n }\r\n return ajaxResponse;\r\n });\r\n var properties = void 0;\r\n try {\r\n if (!!_addRequestContext) {\r\n properties = _addRequestContext({ status: xhr.status, xhr: xhr });\r\n }\r\n }\r\n catch (e) {\r\n _throwInternalWarning(_self, _InternalMessageId.FailedAddingCustomDefinedRequestContext, \"Failed to add custom defined request context as configured call back may missing a null check.\");\r\n }\r\n if (dependency) {\r\n if (properties !== undefined) {\r\n dependency.properties = __assign(__assign({}, dependency.properties), properties);\r\n }\r\n _self[strTrackDependencyDataInternal](dependency);\r\n }\r\n else {\r\n _reportXhrError(null, {\r\n requestSentTime: ajaxData.requestSentTime,\r\n responseFinishedTime: ajaxData.responseFinishedTime\r\n });\r\n }\r\n }\r\n finally {\r\n // cleanup telemetry data\r\n try {\r\n xhr[strAjaxData] = null;\r\n }\r\n catch (e) {\r\n // May throw in environments that prevent extension or freeze xhr\r\n }\r\n }\r\n }, function (e) {\r\n _reportXhrError(e, null);\r\n });\r\n }\r\n function _getAjaxCorrelationContext(xhr) {\r\n try {\r\n var responseHeadersString = xhr.getAllResponseHeaders();\r\n if (responseHeadersString !== null) {\r\n var index = _indexOf(responseHeadersString.toLowerCase(), RequestHeaders.requestContextHeaderLowerCase);\r\n if (index !== -1) {\r\n var responseHeader = xhr.getResponseHeader(RequestHeaders.requestContextHeader);\r\n return CorrelationIdHelper.getCorrelationContext(responseHeader);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _throwInternalWarning(_self, _InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, \"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.\", {\r\n ajaxDiagnosticsMessage: _getFailedAjaxDiagnosticsMessage(xhr),\r\n exception: dumpObj(e)\r\n });\r\n }\r\n }\r\n function _createMarkId(type, ajaxData) {\r\n if (ajaxData.requestUrl && _markPrefix && _enableAjaxPerfTracking) {\r\n var performance_1 = getPerformance();\r\n if (performance_1 && isFunction(performance_1.mark)) {\r\n _markCount++;\r\n var markId = _markPrefix + type + \"#\" + _markCount;\r\n performance_1.mark(markId);\r\n var entries = performance_1.getEntriesByName(markId);\r\n if (entries && entries.length === 1) {\r\n ajaxData.perfMark = entries[0];\r\n }\r\n }\r\n }\r\n }\r\n function _findPerfResourceEntry(initiatorType, ajaxData, trackCallback, reportError) {\r\n var perfMark = ajaxData.perfMark;\r\n var performance = getPerformance();\r\n var maxAttempts = _config.maxAjaxPerfLookupAttempts;\r\n var retryDelay = _config.ajaxPerfLookupDelay;\r\n var requestUrl = ajaxData.requestUrl;\r\n var attempt = 0;\r\n (function locateResourceTiming() {\r\n try {\r\n if (performance && perfMark) {\r\n attempt++;\r\n var perfTiming = null;\r\n var entries = performance.getEntries();\r\n for (var lp = entries.length - 1; lp >= 0; lp--) {\r\n var entry = entries[lp];\r\n if (entry) {\r\n if (entry.entryType === \"resource\") {\r\n if (entry.initiatorType === initiatorType &&\r\n (_indexOf(entry.name, requestUrl) !== -1 || _indexOf(requestUrl, entry.name) !== -1)) {\r\n perfTiming = entry;\r\n }\r\n }\r\n else if (entry.entryType === \"mark\" && entry.name === perfMark.name) {\r\n // We hit the start event\r\n ajaxData.perfTiming = perfTiming;\r\n break;\r\n }\r\n if (entry.startTime < perfMark.startTime - 1000) {\r\n // Fallback to try and reduce the time spent looking for the perf entry\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n if (!perfMark || // - we don't have a perfMark or\r\n ajaxData.perfTiming || // - we have not found the perf entry or\r\n attempt >= maxAttempts || // - we have tried too many attempts or\r\n ajaxData.async === false) { // - this is a sync request\r\n if (perfMark && isFunction(performance.clearMarks)) {\r\n // Remove the mark so we don't fill up the performance resources too much\r\n performance.clearMarks(perfMark.name);\r\n }\r\n ajaxData.perfAttempts = attempt;\r\n // just continue and report the track event\r\n trackCallback();\r\n }\r\n else {\r\n // We need to wait for the browser to populate the window.performance entry\r\n // This needs to be at least 1ms as waiting <= 1 (on firefox) is not enough time for fetch or xhr,\r\n // this is a scheduling issue for the browser implementation\r\n setTimeout(locateResourceTiming, retryDelay);\r\n }\r\n }\r\n catch (e) {\r\n reportError(e);\r\n }\r\n })();\r\n }\r\n function _createFetchRecord(input, init) {\r\n var traceID = (_context && _context.telemetryTrace && _context.telemetryTrace.traceID) || generateW3CId();\r\n var spanID = generateW3CId().substr(0, 16);\r\n var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog]());\r\n ajaxData.requestSentTime = dateTimeUtilsNow();\r\n ajaxData.errorStatusText = _enableAjaxErrorStatusText;\r\n if (input instanceof Request) {\r\n ajaxData.requestUrl = input ? input.url : \"\";\r\n }\r\n else {\r\n ajaxData.requestUrl = input;\r\n }\r\n var method = \"GET\";\r\n if (init && init.method) {\r\n method = init.method;\r\n }\r\n else if (input && input instanceof Request) {\r\n method = input.method;\r\n }\r\n ajaxData.method = method;\r\n var requestHeaders = {};\r\n if (_enableRequestHeaderTracking) {\r\n var headers = new Headers((init ? init.headers : 0) || (input instanceof Request ? (input.headers || {}) : {}));\r\n headers.forEach(function (value, key) {\r\n if (_canIncludeHeaders(key)) {\r\n requestHeaders[key] = value;\r\n }\r\n });\r\n }\r\n ajaxData.requestHeaders = requestHeaders;\r\n _createMarkId(\"fetch\", ajaxData);\r\n return ajaxData;\r\n }\r\n function _getFailedFetchDiagnosticsMessage(input) {\r\n var result = \"\";\r\n try {\r\n if (!isNullOrUndefined(input)) {\r\n if (typeof (input) === \"string\") {\r\n result += \"(url: '\" + input + \"')\";\r\n }\r\n else {\r\n result += \"(url: '\" + input.url + \"')\";\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _throwInternalCritical(_self, _InternalMessageId.FailedMonitorAjaxOpen, \"Failed to grab failed fetch diagnostics message\", { exception: dumpObj(e) });\r\n }\r\n return result;\r\n }\r\n function _reportFetchMetrics(callDetails, status, input, response, ajaxData, getResponse, properties) {\r\n if (!ajaxData) {\r\n return;\r\n }\r\n function _reportFetchError(msgId, e, failedProps) {\r\n var errorProps = failedProps || {};\r\n errorProps[\"fetchDiagnosticsMessage\"] = _getFailedFetchDiagnosticsMessage(input);\r\n if (e) {\r\n errorProps[\"exception\"] = dumpObj(e);\r\n }\r\n _throwInternalWarning(_self, msgId, \"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.\", errorProps);\r\n }\r\n ajaxData.responseFinishedTime = dateTimeUtilsNow();\r\n ajaxData.status = status;\r\n _findPerfResourceEntry(\"fetch\", ajaxData, function () {\r\n var dependency = ajaxData.CreateTrackItem(\"Fetch\", _enableRequestHeaderTracking, getResponse);\r\n var properties;\r\n try {\r\n if (!!_addRequestContext) {\r\n properties = _addRequestContext({ status: status, request: input, response: response });\r\n }\r\n }\r\n catch (e) {\r\n _throwInternalWarning(_self, _InternalMessageId.FailedAddingCustomDefinedRequestContext, \"Failed to add custom defined request context as configured call back may missing a null check.\");\r\n }\r\n if (dependency) {\r\n if (properties !== undefined) {\r\n dependency.properties = __assign(__assign({}, dependency.properties), properties);\r\n }\r\n _self[strTrackDependencyDataInternal](dependency);\r\n }\r\n else {\r\n _reportFetchError(_InternalMessageId.FailedMonitorAjaxDur, null, {\r\n requestSentTime: ajaxData.requestSentTime,\r\n responseFinishedTime: ajaxData.responseFinishedTime\r\n });\r\n }\r\n }, function (e) {\r\n _reportFetchError(_InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, e, null);\r\n });\r\n }\r\n function _getFetchCorrelationContext(response) {\r\n if (response && response.headers) {\r\n try {\r\n var responseHeader = response.headers.get(RequestHeaders.requestContextHeader);\r\n return CorrelationIdHelper.getCorrelationContext(responseHeader);\r\n }\r\n catch (e) {\r\n _throwInternalWarning(_self, _InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, \"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.\", {\r\n fetchDiagnosticsMessage: _getFailedFetchDiagnosticsMessage(response),\r\n exception: dumpObj(e)\r\n });\r\n }\r\n }\r\n }\r\n });\r\n return _this;\r\n }\r\n AjaxMonitor.getDefaultConfig = function () {\r\n var config = {\r\n maxAjaxCallsPerView: 500,\r\n disableAjaxTracking: false,\r\n disableFetchTracking: true,\r\n excludeRequestFromAutoTrackingPatterns: undefined,\r\n disableCorrelationHeaders: false,\r\n distributedTracingMode: DistributedTracingModes.AI_AND_W3C,\r\n correlationHeaderExcludedDomains: [\r\n \"*.blob.core.windows.net\",\r\n \"*.blob.core.chinacloudapi.cn\",\r\n \"*.blob.core.cloudapi.de\",\r\n \"*.blob.core.usgovcloudapi.net\"\r\n ],\r\n correlationHeaderDomains: undefined,\r\n correlationHeaderExcludePatterns: undefined,\r\n appId: undefined,\r\n enableCorsCorrelation: false,\r\n enableRequestHeaderTracking: false,\r\n enableResponseHeaderTracking: false,\r\n enableAjaxErrorStatusText: false,\r\n enableAjaxPerfTracking: false,\r\n maxAjaxPerfLookupAttempts: 3,\r\n ajaxPerfLookupDelay: 25,\r\n ignoreHeaders: [\r\n \"Authorization\",\r\n \"X-API-Key\",\r\n \"WWW-Authenticate\"\r\n ],\r\n addRequestContext: undefined\r\n };\r\n return config;\r\n };\r\n AjaxMonitor.getEmptyConfig = function () {\r\n var emptyConfig = this.getDefaultConfig();\r\n objForEachKey(emptyConfig, function (value) {\r\n emptyConfig[value] = undefined;\r\n });\r\n return emptyConfig;\r\n };\r\n AjaxMonitor.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n AjaxMonitor.prototype.teardown = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n AjaxMonitor.prototype.processTelemetry = function (item, itemCtx) {\r\n this.processNext(item, itemCtx);\r\n };\r\n /**\r\n * Logs dependency call\r\n * @param dependencyData dependency data object\r\n */\r\n AjaxMonitor.prototype.trackDependencyData = function (dependency, properties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n AjaxMonitor.prototype.includeCorrelationHeaders = function (ajaxData, input, init, xhr) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Protected function to allow sub classes the chance to add additional properties to the dependency event\r\n * before it's sent. This function calls track, so sub-classes must call this function after they have\r\n * populated their properties.\r\n * @param dependencyData dependency data object\r\n */\r\n AjaxMonitor.prototype.trackDependencyDataInternal = function (dependency, properties, systemProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n AjaxMonitor.identifier = \"AjaxDependencyPlugin\";\r\n return AjaxMonitor;\r\n}(BaseTelemetryPlugin));\r\nexport { AjaxMonitor };\r\n//# sourceMappingURL=ajax.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { DEFAULT_BREEZE_ENDPOINT } from \"./Constants\";\r\nimport { arrReduce, objKeys } from \"@microsoft/applicationinsights-core-js\";\r\nvar _FIELDS_SEPARATOR = \";\";\r\nvar _FIELD_KEY_VALUE_SEPARATOR = \"=\";\r\nexport function parseConnectionString(connectionString) {\r\n if (!connectionString) {\r\n return {};\r\n }\r\n var kvPairs = connectionString.split(_FIELDS_SEPARATOR);\r\n var result = arrReduce(kvPairs, function (fields, kv) {\r\n var kvParts = kv.split(_FIELD_KEY_VALUE_SEPARATOR);\r\n if (kvParts.length === 2) { // only save fields with valid formats\r\n var key = kvParts[0].toLowerCase();\r\n var value = kvParts[1];\r\n fields[key] = value;\r\n }\r\n return fields;\r\n }, {});\r\n if (objKeys(result).length > 0) {\r\n // this is a valid connection string, so parse the results\r\n if (result.endpointsuffix) {\r\n // use endpoint suffix where overrides are not provided\r\n var locationPrefix = result.location ? result.location + \".\" : \"\";\r\n result.ingestionendpoint = result.ingestionendpoint || (\"https://\" + locationPrefix + \"dc.\" + result.endpointsuffix);\r\n }\r\n // apply the default endpoints\r\n result.ingestionendpoint = result.ingestionendpoint || DEFAULT_BREEZE_ENDPOINT;\r\n }\r\n return result;\r\n}\r\nexport var ConnectionStringParser = {\r\n parse: parseConnectionString\r\n};\r\n//# sourceMappingURL=ConnectionStringParser.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { isNullOrUndefined } from \"@microsoft/applicationinsights-core-js\";\r\nvar ConfigurationManager = /** @class */ (function () {\r\n function ConfigurationManager() {\r\n }\r\n ConfigurationManager.getConfig = function (config, field, identifier, defaultValue) {\r\n if (defaultValue === void 0) { defaultValue = false; }\r\n var configValue;\r\n if (identifier && config.extensionConfig && config.extensionConfig[identifier] && !isNullOrUndefined(config.extensionConfig[identifier][field])) {\r\n configValue = config.extensionConfig[identifier][field];\r\n }\r\n else {\r\n configValue = config[field];\r\n }\r\n return !isNullOrUndefined(configValue) ? configValue : defaultValue;\r\n };\r\n return ConfigurationManager;\r\n}());\r\nexport { ConfigurationManager };\r\n//# sourceMappingURL=IConfig.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { AppInsightsCore, LoggingSeverity, _InternalMessageId, hasWindow, hasDocument, isReactNative, doPerf, objForEachKey, proxyAssign, arrForEach, isString, isFunction, isNullOrUndefined, isArray, throwError, addPageUnloadEventListener, addPageHideEventListener } from \"@microsoft/applicationinsights-core-js\";\r\nimport { ApplicationInsights } from \"@microsoft/applicationinsights-analytics-js\";\r\nimport { Sender } from \"@microsoft/applicationinsights-channel-js\";\r\nimport { PropertiesPlugin } from \"@microsoft/applicationinsights-properties-js\";\r\nimport { AjaxPlugin as DependenciesPlugin } from \"@microsoft/applicationinsights-dependencies-js\";\r\nimport { Util, CorrelationIdHelper, UrlHelper, DateTimeUtils, ConnectionStringParser, RequestHeaders, DisabledPropertyName, ProcessLegacy, SampleRate, HttpMethod, DEFAULT_BREEZE_ENDPOINT, AIData, AIBase, Envelope, Event, Exception, Metric, PageView, PageViewData, RemoteDependencyData, Trace, PageViewPerformance, Data, SeverityLevel, ConfigurationManager, ContextTagKeys, DataSanitizer, TelemetryItemCreator, CtxTagKeys, Extensions, DistributedTracingModes, PropertiesPluginIdentifier, BreezeChannelIdentifier, AnalyticsPluginIdentifier, parseConnectionString } from \"@microsoft/applicationinsights-common\";\r\n\"use strict\";\r\nvar _internalSdkSrc;\r\n// This is an exclude list of properties that should not be updated during initialization\r\n// They include a combination of private and internal property names\r\nvar _ignoreUpdateSnippetProperties = [\r\n \"snippet\", \"dependencies\", \"properties\", \"_snippetVersion\", \"appInsightsNew\", \"getSKUDefaults\"\r\n];\r\n// Re-exposing the Common classes as Telemetry, the list was taken by reviewing the generated code for the build while using\r\n// the previous configuration :-\r\n// import * as Common from \"@microsoft/applicationinsights-common\"\r\n// export const Telemetry = Common;\r\nvar fieldType = {\r\n Default: 0 /* Default */,\r\n Required: 1 /* Required */,\r\n Array: 2 /* Array */,\r\n Hidden: 4 /* Hidden */\r\n};\r\n/**\r\n * Telemetry type classes, e.g. PageView, Exception, etc\r\n */\r\nexport var Telemetry = {\r\n __proto__: null,\r\n PropertiesPluginIdentifier: PropertiesPluginIdentifier,\r\n BreezeChannelIdentifier: BreezeChannelIdentifier,\r\n AnalyticsPluginIdentifier: AnalyticsPluginIdentifier,\r\n Util: Util,\r\n CorrelationIdHelper: CorrelationIdHelper,\r\n UrlHelper: UrlHelper,\r\n DateTimeUtils: DateTimeUtils,\r\n ConnectionStringParser: ConnectionStringParser,\r\n FieldType: fieldType,\r\n RequestHeaders: RequestHeaders,\r\n DisabledPropertyName: DisabledPropertyName,\r\n ProcessLegacy: ProcessLegacy,\r\n SampleRate: SampleRate,\r\n HttpMethod: HttpMethod,\r\n DEFAULT_BREEZE_ENDPOINT: DEFAULT_BREEZE_ENDPOINT,\r\n AIData: AIData,\r\n AIBase: AIBase,\r\n Envelope: Envelope,\r\n Event: Event,\r\n Exception: Exception,\r\n Metric: Metric,\r\n PageView: PageView,\r\n PageViewData: PageViewData,\r\n RemoteDependencyData: RemoteDependencyData,\r\n Trace: Trace,\r\n PageViewPerformance: PageViewPerformance,\r\n Data: Data,\r\n SeverityLevel: SeverityLevel,\r\n ConfigurationManager: ConfigurationManager,\r\n ContextTagKeys: ContextTagKeys,\r\n DataSanitizer: DataSanitizer,\r\n TelemetryItemCreator: TelemetryItemCreator,\r\n CtxTagKeys: CtxTagKeys,\r\n Extensions: Extensions,\r\n DistributedTracingModes: DistributedTracingModes\r\n};\r\n/**\r\n * Application Insights API\r\n * @class Initialization\r\n * @implements {IApplicationInsights}\r\n */\r\nvar Initialization = /** @class */ (function () {\r\n function Initialization(snippet) {\r\n var _self = this;\r\n // initialize the queue and config in case they are undefined\r\n _self._snippetVersion = \"\" + (snippet.sv || snippet.version || \"\");\r\n snippet.queue = snippet.queue || [];\r\n snippet.version = snippet.version || 2.0; // Default to new version\r\n var config = snippet.config || {};\r\n if (config.connectionString) {\r\n var cs = parseConnectionString(config.connectionString);\r\n var ingest = cs.ingestionendpoint;\r\n config.endpointUrl = ingest ? ingest + \"/v2/track\" : config.endpointUrl; // only add /v2/track when from connectionstring\r\n config.instrumentationKey = cs.instrumentationkey || config.instrumentationKey;\r\n }\r\n _self.appInsights = new ApplicationInsights();\r\n _self.properties = new PropertiesPlugin();\r\n _self.dependencies = new DependenciesPlugin();\r\n _self.core = new AppInsightsCore();\r\n _self._sender = new Sender();\r\n _self.snippet = snippet;\r\n _self.config = config;\r\n _self.getSKUDefaults();\r\n }\r\n // Analytics Plugin\r\n /**\r\n * Get the current cookie manager for this instance\r\n */\r\n Initialization.prototype.getCookieMgr = function () {\r\n return this.appInsights.getCookieMgr();\r\n };\r\n /**\r\n * Log a user action or other occurrence.\r\n * @param {IEventTelemetry} event\r\n * @param {ICustomProperties} [customProperties]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackEvent = function (event, customProperties) {\r\n this.appInsights.trackEvent(event, customProperties);\r\n };\r\n /**\r\n * Logs that a page, or similar container was displayed to the user.\r\n * @param {IPageViewTelemetry} pageView\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackPageView = function (pageView) {\r\n var inPv = pageView || {};\r\n this.appInsights.trackPageView(inPv);\r\n };\r\n /**\r\n * Log a bag of performance information via the customProperties field.\r\n * @param {IPageViewPerformanceTelemetry} pageViewPerformance\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackPageViewPerformance = function (pageViewPerformance) {\r\n var inPvp = pageViewPerformance || {};\r\n this.appInsights.trackPageViewPerformance(inPvp);\r\n };\r\n /**\r\n * Log an exception that you have caught.\r\n * @param {IExceptionTelemetry} exception\r\n * @param {{[key: string]: any}} customProperties Additional data used to filter pages and metrics in the portal. Defaults to empty.\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackException = function (exception, customProperties) {\r\n if (exception && !exception.exception && exception.error) {\r\n exception.exception = exception.error;\r\n }\r\n this.appInsights.trackException(exception, customProperties);\r\n };\r\n /**\r\n * Manually send uncaught exception telemetry. This method is automatically triggered\r\n * on a window.onerror event.\r\n * @param {IAutoExceptionTelemetry} exception\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype._onerror = function (exception) {\r\n this.appInsights._onerror(exception);\r\n };\r\n /**\r\n * Log a diagnostic scenario such entering or leaving a function.\r\n * @param {ITraceTelemetry} trace\r\n * @param {ICustomProperties} [customProperties]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackTrace = function (trace, customProperties) {\r\n this.appInsights.trackTrace(trace, customProperties);\r\n };\r\n /**\r\n * Log a numeric value that is not associated with a specific event. Typically used\r\n * to send regular reports of performance indicators.\r\n *\r\n * To send a single measurement, just use the `name` and `average` fields\r\n * of {@link IMetricTelemetry}.\r\n *\r\n * If you take measurements frequently, you can reduce the telemetry bandwidth by\r\n * aggregating multiple measurements and sending the resulting average and modifying\r\n * the `sampleCount` field of {@link IMetricTelemetry}.\r\n * @param {IMetricTelemetry} metric input object argument. Only `name` and `average` are mandatory.\r\n * @param {ICustomProperties} [customProperties]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackMetric = function (metric, customProperties) {\r\n this.appInsights.trackMetric(metric, customProperties);\r\n };\r\n /**\r\n * Starts the timer for tracking a page load time. Use this instead of `trackPageView` if you want to control when the page view timer starts and stops,\r\n * but don't want to calculate the duration yourself. This method doesn't send any telemetry. Call `stopTrackPage` to log the end of the page view\r\n * and send the event.\r\n * @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.\r\n */\r\n Initialization.prototype.startTrackPage = function (name) {\r\n this.appInsights.startTrackPage(name);\r\n };\r\n /**\r\n * Stops the timer that was started by calling `startTrackPage` and sends the pageview load time telemetry with the specified properties and measurements.\r\n * The duration of the page view will be the time between calling `startTrackPage` and `stopTrackPage`.\r\n * @param name The string you used as the name in startTrackPage. Defaults to the document title.\r\n * @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.\r\n * @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.\r\n * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.\r\n */\r\n Initialization.prototype.stopTrackPage = function (name, url, customProperties, measurements) {\r\n this.appInsights.stopTrackPage(name, url, customProperties, measurements);\r\n };\r\n Initialization.prototype.startTrackEvent = function (name) {\r\n this.appInsights.startTrackEvent(name);\r\n };\r\n /**\r\n * Log an extended event that you started timing with `startTrackEvent`.\r\n * @param name The string you used to identify this event in `startTrackEvent`.\r\n * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.\r\n * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.\r\n */\r\n Initialization.prototype.stopTrackEvent = function (name, properties, measurements) {\r\n this.appInsights.stopTrackEvent(name, properties, measurements); // Todo: Fix to pass measurements once type is updated\r\n };\r\n Initialization.prototype.addTelemetryInitializer = function (telemetryInitializer) {\r\n return this.appInsights.addTelemetryInitializer(telemetryInitializer);\r\n };\r\n // Properties Plugin\r\n /**\r\n * Set the authenticated user id and the account id. Used for identifying a specific signed-in user. Parameters must not contain whitespace or ,;=|\r\n *\r\n * The method will only set the `authenticatedUserId` and `accountId` in the current page view. To set them for the whole session, you should set `storeInCookie = true`\r\n * @param {string} authenticatedUserId\r\n * @param {string} [accountId]\r\n * @param {boolean} [storeInCookie=false]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.setAuthenticatedUserContext = function (authenticatedUserId, accountId, storeInCookie) {\r\n if (storeInCookie === void 0) { storeInCookie = false; }\r\n this.properties.context.user.setAuthenticatedUserContext(authenticatedUserId, accountId, storeInCookie);\r\n };\r\n /**\r\n * Clears the authenticated user id and account id. The associated cookie is cleared, if present.\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.clearAuthenticatedUserContext = function () {\r\n this.properties.context.user.clearAuthenticatedUserContext();\r\n };\r\n // Dependencies Plugin\r\n /**\r\n * Log a dependency call (e.g. ajax)\r\n * @param {IDependencyTelemetry} dependency\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackDependencyData = function (dependency) {\r\n this.dependencies.trackDependencyData(dependency);\r\n };\r\n // Misc\r\n /**\r\n * Manually trigger an immediate send of all telemetry still in the buffer.\r\n * @param {boolean} [async=true]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.flush = function (async) {\r\n var _this = this;\r\n if (async === void 0) { async = true; }\r\n doPerf(this.core, function () { return \"AISKU.flush\"; }, function () {\r\n arrForEach(_this.core.getTransmissionControls(), function (channels) {\r\n arrForEach(channels, function (channel) {\r\n channel.flush(async);\r\n });\r\n });\r\n }, null, async);\r\n };\r\n /**\r\n * Manually trigger an immediate send of all telemetry still in the buffer using beacon Sender.\r\n * Fall back to xhr sender if beacon is not supported.\r\n * @param {boolean} [async=true]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.onunloadFlush = function (async) {\r\n if (async === void 0) { async = true; }\r\n arrForEach(this.core.getTransmissionControls(), function (channels) {\r\n arrForEach(channels, function (channel) {\r\n if (channel.onunloadFlush) {\r\n channel.onunloadFlush();\r\n }\r\n else {\r\n channel.flush(async);\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Initialize this instance of ApplicationInsights\r\n * @returns {IApplicationInsights}\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.loadAppInsights = function (legacyMode, logger, notificationManager) {\r\n var _this = this;\r\n if (legacyMode === void 0) { legacyMode = false; }\r\n var _self = this;\r\n function _updateSnippetProperties(snippet) {\r\n if (snippet) {\r\n var snippetVer = \"\";\r\n if (!isNullOrUndefined(_self._snippetVersion)) {\r\n snippetVer += _self._snippetVersion;\r\n }\r\n if (legacyMode) {\r\n snippetVer += \".lg\";\r\n }\r\n if (_self.context && _self.context.internal) {\r\n _self.context.internal.snippetVer = snippetVer || \"-\";\r\n }\r\n // apply updated properties to the global instance (snippet)\r\n objForEachKey(_self, function (field, value) {\r\n if (isString(field) &&\r\n !isFunction(value) &&\r\n field && field[0] !== \"_\" && // Don't copy \"internal\" values\r\n _ignoreUpdateSnippetProperties.indexOf(field) === -1) {\r\n snippet[field] = value;\r\n }\r\n });\r\n }\r\n }\r\n // dont allow additional channels/other extensions for legacy mode; legacy mode is only to allow users to switch with no code changes!\r\n if (legacyMode && _self.config.extensions && _self.config.extensions.length > 0) {\r\n throwError(\"Extensions not allowed in legacy mode\");\r\n }\r\n doPerf(_self.core, function () { return \"AISKU.loadAppInsights\"; }, function () {\r\n var extensions = [];\r\n extensions.push(_self._sender);\r\n extensions.push(_self.properties);\r\n extensions.push(_self.dependencies);\r\n extensions.push(_self.appInsights);\r\n // initialize core\r\n _self.core.initialize(_self.config, extensions, logger, notificationManager);\r\n _self.context = _self.properties.context;\r\n if (_internalSdkSrc && _self.context) {\r\n _self.context.internal.sdkSrc = _internalSdkSrc;\r\n }\r\n _updateSnippetProperties(_self.snippet);\r\n // Empty queue of all api calls logged prior to sdk download\r\n _self.emptyQueue();\r\n _self.pollInternalLogs();\r\n _self.addHousekeepingBeforeUnload(_this);\r\n });\r\n return _self;\r\n };\r\n /**\r\n * Overwrite the lazy loaded fields of global window snippet to contain the\r\n * actual initialized API methods\r\n * @param {Snippet} snippet\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.updateSnippetDefinitions = function (snippet) {\r\n // apply full appInsights to the global instance\r\n // Note: This must be called before loadAppInsights is called\r\n proxyAssign(snippet, this, function (name) {\r\n // Not excluding names prefixed with \"_\" as we need to proxy some functions like _onError\r\n return name && _ignoreUpdateSnippetProperties.indexOf(name) === -1;\r\n });\r\n };\r\n /**\r\n * Call any functions that were queued before the main script was loaded\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.emptyQueue = function () {\r\n var _self = this;\r\n // call functions that were queued before the main script was loaded\r\n try {\r\n if (isArray(_self.snippet.queue)) {\r\n // note: do not check length in the for-loop conditional in case something goes wrong and the stub methods are not overridden.\r\n var length_1 = _self.snippet.queue.length;\r\n for (var i = 0; i < length_1; i++) {\r\n var call = _self.snippet.queue[i];\r\n call();\r\n }\r\n _self.snippet.queue = undefined;\r\n delete _self.snippet.queue;\r\n }\r\n }\r\n catch (exception) {\r\n var properties = {};\r\n if (exception && isFunction(exception.toString)) {\r\n properties.exception = exception.toString();\r\n }\r\n // need from core\r\n // Microsoft.ApplicationInsights._InternalLogging.throwInternal(\r\n // LoggingSeverity.WARNING,\r\n // _InternalMessageId.FailedToSendQueuedTelemetry,\r\n // \"Failed to send queued telemetry\",\r\n // properties);\r\n }\r\n };\r\n Initialization.prototype.pollInternalLogs = function () {\r\n this.core.pollInternalLogs();\r\n };\r\n Initialization.prototype.stopPollingInternalLogs = function () {\r\n this.core.stopPollingInternalLogs();\r\n };\r\n Initialization.prototype.addHousekeepingBeforeUnload = function (appInsightsInstance) {\r\n // Add callback to push events when the user navigates away\r\n if (hasWindow() || hasDocument()) {\r\n var performHousekeeping = function () {\r\n // Adds the ability to flush all data before the page unloads.\r\n // Note: This approach tries to push a sync request with all the pending events onbeforeunload.\r\n // Firefox does not respect this.Other browsers DO push out the call with < 100% hit rate.\r\n // Telemetry here will help us analyze how effective this approach is.\r\n // Another approach would be to make this call sync with a acceptable timeout to reduce the\r\n // impact on user experience.\r\n // appInsightsInstance.context._sender.triggerSend();\r\n appInsightsInstance.onunloadFlush(false);\r\n // Back up the current session to local storage\r\n // This lets us close expired sessions after the cookies themselves expire\r\n arrForEach(appInsightsInstance.appInsights.core[\"_extensions\"], function (ext) {\r\n if (ext.identifier === PropertiesPluginIdentifier) {\r\n if (ext && ext.context && ext.context._sessionManager) {\r\n ext.context._sessionManager.backup();\r\n }\r\n return -1;\r\n }\r\n });\r\n };\r\n var added = false;\r\n var excludePageUnloadEvents = appInsightsInstance.appInsights.config.disablePageUnloadEvents;\r\n if (!appInsightsInstance.appInsights.config.disableFlushOnBeforeUnload) {\r\n // Hook the unload event for the document, window and body to ensure that the client events are flushed to the server\r\n // As just hooking the window does not always fire (on chrome) for page navigation's.\r\n added = addPageUnloadEventListener(performHousekeeping, excludePageUnloadEvents);\r\n // We also need to hook the pagehide and visibilitychange events as not all versions of Safari support load/unload events.\r\n added = addPageHideEventListener(performHousekeeping, excludePageUnloadEvents) || added;\r\n // A reactNative app may not have a window and therefore the beforeunload/pagehide events -- so don't\r\n // log the failure in this case\r\n if (!added && !isReactNative()) {\r\n appInsightsInstance.appInsights.core.logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToAddHandlerForOnBeforeUnload, \"Could not add handler for beforeunload and pagehide\");\r\n }\r\n }\r\n if (!added && !appInsightsInstance.appInsights.config.disableFlushOnUnload) {\r\n // If we didn't add the normal set then attempt to add the pagehide and visibilitychange only\r\n addPageHideEventListener(performHousekeeping, excludePageUnloadEvents);\r\n }\r\n }\r\n };\r\n Initialization.prototype.getSender = function () {\r\n return this._sender;\r\n };\r\n Initialization.prototype.getSKUDefaults = function () {\r\n var _self = this;\r\n _self.config.diagnosticLogInterval =\r\n _self.config.diagnosticLogInterval && _self.config.diagnosticLogInterval > 0 ? _self.config.diagnosticLogInterval : 10000;\r\n };\r\n return Initialization;\r\n}());\r\nexport { Initialization };\r\n// tslint:disable-next-line\r\n(function () {\r\n var sdkSrc = null;\r\n var isModule = false;\r\n var cdns = [\r\n \"://js.monitor.azure.com/\",\r\n \"://az416426.vo.msecnd.net/\"\r\n ];\r\n try {\r\n // Try and determine whether the sdk is being loaded from the CDN\r\n // currentScript is only valid during initial processing\r\n var scrpt = (document || {}).currentScript;\r\n if (scrpt) {\r\n sdkSrc = scrpt.src;\r\n // } else {\r\n // // We need to update to at least typescript 2.9 for this to work :-(\r\n // // Leaving as a stub for now so after we upgrade this breadcrumb is available\r\n // let meta = import.meta;\r\n // sdkSrc = (meta || {}).url;\r\n // isModule = true;\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n if (sdkSrc) {\r\n try {\r\n var url = sdkSrc.toLowerCase();\r\n if (url) {\r\n var src = \"\";\r\n for (var idx = 0; idx < cdns.length; idx++) {\r\n if (url.indexOf(cdns[idx]) !== -1) {\r\n src = \"cdn\" + (idx + 1);\r\n if (url.indexOf(\"/scripts/\") === -1) {\r\n if (url.indexOf(\"/next/\") !== -1) {\r\n src += \"-next\";\r\n }\r\n else if (url.indexOf(\"/beta/\") !== -1) {\r\n src += \"-beta\";\r\n }\r\n }\r\n _internalSdkSrc = src + (isModule ? \".mod\" : \"\");\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n }\r\n})();\r\n//# sourceMappingURL=Initialization.js.map","// Source from https://github.com/alitaheri/normalize-scroll-left\nvar cachedType;\n/**\n * Based on the jquery plugin https://github.com/othree/jquery.rtl-scroll-type\n *\n * Types of scrollLeft, assuming scrollWidth=100 and direction is rtl.\n *\n * Type | <- Most Left | Most Right -> | Initial\n * ---------------- | ------------ | ------------- | -------\n * default | 0 | 100 | 100\n * negative (spec*) | -100 | 0 | 0\n * reverse | 100 | 0 | 0\n *\n * Edge 85: default\n * Safari 14: negative\n * Chrome 85: negative\n * Firefox 81: negative\n * IE 11: reverse\n *\n * spec* https://drafts.csswg.org/cssom-view/#dom-window-scroll\n */\n\nexport function detectScrollType() {\n if (cachedType) {\n return cachedType;\n }\n\n var dummy = document.createElement('div');\n var container = document.createElement('div');\n container.style.width = '10px';\n container.style.height = '1px';\n dummy.appendChild(container);\n dummy.dir = 'rtl';\n dummy.style.fontSize = '14px';\n dummy.style.width = '4px';\n dummy.style.height = '1px';\n dummy.style.position = 'absolute';\n dummy.style.top = '-1000px';\n dummy.style.overflow = 'scroll';\n document.body.appendChild(dummy);\n cachedType = 'reverse';\n\n if (dummy.scrollLeft > 0) {\n cachedType = 'default';\n } else {\n dummy.scrollLeft = 1;\n\n if (dummy.scrollLeft === 0) {\n cachedType = 'negative';\n }\n }\n\n document.body.removeChild(dummy);\n return cachedType;\n} // Based on https://stackoverflow.com/a/24394376\n\nexport function getNormalizedScrollLeft(element, direction) {\n var scrollLeft = element.scrollLeft; // Perform the calculations only when direction is rtl to avoid messing up the ltr bahavior\n\n if (direction !== 'rtl') {\n return scrollLeft;\n }\n\n var type = detectScrollType();\n\n switch (type) {\n case 'negative':\n return element.scrollWidth - element.clientWidth + scrollLeft;\n\n case 'reverse':\n return element.scrollWidth - element.clientWidth - scrollLeft;\n\n default:\n return scrollLeft;\n }\n}","function easeInOutSin(time) {\n return (1 + Math.sin(Math.PI * time - Math.PI / 2)) / 2;\n}\n\nexport default function animate(property, element, to) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n var cb = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {};\n var _options$ease = options.ease,\n ease = _options$ease === void 0 ? easeInOutSin : _options$ease,\n _options$duration = options.duration,\n duration = _options$duration === void 0 ? 300 : _options$duration;\n var start = null;\n var from = element[property];\n var cancelled = false;\n\n var cancel = function cancel() {\n cancelled = true;\n };\n\n var step = function step(timestamp) {\n if (cancelled) {\n cb(new Error('Animation cancelled'));\n return;\n }\n\n if (start === null) {\n start = timestamp;\n }\n\n var time = Math.min(1, (timestamp - start) / duration);\n element[property] = ease(time) * (to - from) + from;\n\n if (time >= 1) {\n requestAnimationFrame(function () {\n cb(null);\n });\n return;\n }\n\n requestAnimationFrame(step);\n };\n\n if (from === to) {\n cb(new Error('Element already at target position'));\n return cancel;\n }\n\n requestAnimationFrame(step);\n return cancel;\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from '../utils/debounce';\nvar styles = {\n width: 99,\n height: 99,\n position: 'absolute',\n top: -9999,\n overflow: 'scroll'\n};\n/**\n * @ignore - internal component.\n * The component originates from https://github.com/STORIS/react-scrollbar-size.\n * It has been moved into the core in order to minimize the bundle size.\n */\n\nexport default function ScrollbarSize(props) {\n var onChange = props.onChange,\n other = _objectWithoutProperties(props, [\"onChange\"]);\n\n var scrollbarHeight = React.useRef();\n var nodeRef = React.useRef(null);\n\n var setMeasurements = function setMeasurements() {\n scrollbarHeight.current = nodeRef.current.offsetHeight - nodeRef.current.clientHeight;\n };\n\n React.useEffect(function () {\n var handleResize = debounce(function () {\n var prevHeight = scrollbarHeight.current;\n setMeasurements();\n\n if (prevHeight !== scrollbarHeight.current) {\n onChange(scrollbarHeight.current);\n }\n });\n window.addEventListener('resize', handleResize);\n return function () {\n handleResize.clear();\n window.removeEventListener('resize', handleResize);\n };\n }, [onChange]);\n React.useEffect(function () {\n setMeasurements();\n onChange(scrollbarHeight.current);\n }, [onChange]);\n return /*#__PURE__*/React.createElement(\"div\", _extends({\n style: styles,\n ref: nodeRef\n }, other));\n}\nprocess.env.NODE_ENV !== \"production\" ? ScrollbarSize.propTypes = {\n onChange: PropTypes.func.isRequired\n} : void 0;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nimport capitalize from '../utils/capitalize';\nexport var styles = function styles(theme) {\n return {\n root: {\n position: 'absolute',\n height: 2,\n bottom: 0,\n width: '100%',\n transition: theme.transitions.create()\n },\n colorPrimary: {\n backgroundColor: theme.palette.primary.main\n },\n colorSecondary: {\n backgroundColor: theme.palette.secondary.main\n },\n vertical: {\n height: '100%',\n width: 2,\n right: 0\n }\n };\n};\n/**\n * @ignore - internal component.\n */\n\nvar TabIndicator = /*#__PURE__*/React.forwardRef(function TabIndicator(props, ref) {\n var classes = props.classes,\n className = props.className,\n color = props.color,\n orientation = props.orientation,\n other = _objectWithoutProperties(props, [\"classes\", \"className\", \"color\", \"orientation\"]);\n\n return /*#__PURE__*/React.createElement(\"span\", _extends({\n className: clsx(classes.root, classes[\"color\".concat(capitalize(color))], className, orientation === 'vertical' && classes.vertical),\n ref: ref\n }, other));\n});\nprocess.env.NODE_ENV !== \"production\" ? TabIndicator.propTypes = {\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object.isRequired,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * @ignore\n * The color of the tab indicator.\n */\n color: PropTypes.oneOf(['primary', 'secondary']).isRequired,\n\n /**\n * The tabs orientation (layout flow direction).\n */\n orientation: PropTypes.oneOf(['horizontal', 'vertical']).isRequired\n} : void 0;\nexport default withStyles(styles, {\n name: 'PrivateTabIndicator'\n})(TabIndicator);","import * as React from 'react';\nimport createSvgIcon from '../../utils/createSvgIcon';\n/**\n * @ignore - internal component.\n */\n\nexport default createSvgIcon( /*#__PURE__*/React.createElement(\"path\", {\n d: \"M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z\"\n}), 'KeyboardArrowLeft');","import * as React from 'react';\nimport createSvgIcon from '../../utils/createSvgIcon';\n/**\n * @ignore - internal component.\n */\n\nexport default createSvgIcon( /*#__PURE__*/React.createElement(\"path\", {\n d: \"M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z\"\n}), 'KeyboardArrowRight');","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\n\n/* eslint-disable jsx-a11y/aria-role */\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport KeyboardArrowLeft from '../internal/svg-icons/KeyboardArrowLeft';\nimport KeyboardArrowRight from '../internal/svg-icons/KeyboardArrowRight';\nimport withStyles from '../styles/withStyles';\nimport ButtonBase from '../ButtonBase';\nexport var styles = {\n /* Styles applied to the root element. */\n root: {\n width: 40,\n flexShrink: 0,\n opacity: 0.8,\n '&$disabled': {\n opacity: 0\n }\n },\n\n /* Styles applied to the root element if `orientation=\"vertical\"`. */\n vertical: {\n width: '100%',\n height: 40,\n '& svg': {\n transform: 'rotate(90deg)'\n }\n },\n\n /* Pseudo-class applied to the root element if `disabled={true}`. */\n disabled: {}\n};\n\nvar _ref = /*#__PURE__*/React.createElement(KeyboardArrowLeft, {\n fontSize: \"small\"\n});\n\nvar _ref2 = /*#__PURE__*/React.createElement(KeyboardArrowRight, {\n fontSize: \"small\"\n});\n\nvar TabScrollButton = /*#__PURE__*/React.forwardRef(function TabScrollButton(props, ref) {\n var classes = props.classes,\n classNameProp = props.className,\n direction = props.direction,\n orientation = props.orientation,\n disabled = props.disabled,\n other = _objectWithoutProperties(props, [\"classes\", \"className\", \"direction\", \"orientation\", \"disabled\"]);\n\n return /*#__PURE__*/React.createElement(ButtonBase, _extends({\n component: \"div\",\n className: clsx(classes.root, classNameProp, disabled && classes.disabled, orientation === 'vertical' && classes.vertical),\n ref: ref,\n role: null,\n tabIndex: null\n }, other), direction === 'left' ? _ref : _ref2);\n});\nprocess.env.NODE_ENV !== \"production\" ? TabScrollButton.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * Which direction should the button indicate?\n */\n direction: PropTypes.oneOf(['left', 'right']).isRequired,\n\n /**\n * If `true`, the element will be disabled.\n */\n disabled: PropTypes.bool,\n\n /**\n * The tabs orientation (layout flow direction).\n */\n orientation: PropTypes.oneOf(['horizontal', 'vertical']).isRequired\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiTabScrollButton'\n})(TabScrollButton);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport * as React from 'react';\nimport { isFragment } from 'react-is';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { refType } from '@material-ui/utils';\nimport debounce from '../utils/debounce';\nimport ownerWindow from '../utils/ownerWindow';\nimport { getNormalizedScrollLeft, detectScrollType } from '../utils/scrollLeft';\nimport animate from '../internal/animate';\nimport ScrollbarSize from './ScrollbarSize';\nimport withStyles from '../styles/withStyles';\nimport TabIndicator from './TabIndicator';\nimport TabScrollButton from '../TabScrollButton';\nimport useEventCallback from '../utils/useEventCallback';\nimport useTheme from '../styles/useTheme';\nexport var styles = function styles(theme) {\n return {\n /* Styles applied to the root element. */\n root: {\n overflow: 'hidden',\n minHeight: 48,\n WebkitOverflowScrolling: 'touch',\n // Add iOS momentum scrolling.\n display: 'flex'\n },\n\n /* Styles applied to the root element if `orientation=\"vertical\"`. */\n vertical: {\n flexDirection: 'column'\n },\n\n /* Styles applied to the flex container element. */\n flexContainer: {\n display: 'flex'\n },\n\n /* Styles applied to the flex container element if `orientation=\"vertical\"`. */\n flexContainerVertical: {\n flexDirection: 'column'\n },\n\n /* Styles applied to the flex container element if `centered={true}` & `!variant=\"scrollable\"`. */\n centered: {\n justifyContent: 'center'\n },\n\n /* Styles applied to the tablist element. */\n scroller: {\n position: 'relative',\n display: 'inline-block',\n flex: '1 1 auto',\n whiteSpace: 'nowrap'\n },\n\n /* Styles applied to the tablist element if `!variant=\"scrollable\"`\b\b\b. */\n fixed: {\n overflowX: 'hidden',\n width: '100%'\n },\n\n /* Styles applied to the tablist element if `variant=\"scrollable\"`. */\n scrollable: {\n overflowX: 'scroll',\n // Hide dimensionless scrollbar on MacOS\n scrollbarWidth: 'none',\n // Firefox\n '&::-webkit-scrollbar': {\n display: 'none' // Safari + Chrome\n\n }\n },\n\n /* Styles applied to the `ScrollButtonComponent` component. */\n scrollButtons: {},\n\n /* Styles applied to the `ScrollButtonComponent` component if `scrollButtons=\"auto\"` or scrollButtons=\"desktop\"`. */\n scrollButtonsDesktop: _defineProperty({}, theme.breakpoints.down('xs'), {\n display: 'none'\n }),\n\n /* Styles applied to the `TabIndicator` component. */\n indicator: {}\n };\n};\nvar Tabs = /*#__PURE__*/React.forwardRef(function Tabs(props, ref) {\n var ariaLabel = props['aria-label'],\n ariaLabelledBy = props['aria-labelledby'],\n action = props.action,\n _props$centered = props.centered,\n centered = _props$centered === void 0 ? false : _props$centered,\n childrenProp = props.children,\n classes = props.classes,\n className = props.className,\n _props$component = props.component,\n Component = _props$component === void 0 ? 'div' : _props$component,\n _props$indicatorColor = props.indicatorColor,\n indicatorColor = _props$indicatorColor === void 0 ? 'secondary' : _props$indicatorColor,\n onChange = props.onChange,\n _props$orientation = props.orientation,\n orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,\n _props$ScrollButtonCo = props.ScrollButtonComponent,\n ScrollButtonComponent = _props$ScrollButtonCo === void 0 ? TabScrollButton : _props$ScrollButtonCo,\n _props$scrollButtons = props.scrollButtons,\n scrollButtons = _props$scrollButtons === void 0 ? 'auto' : _props$scrollButtons,\n selectionFollowsFocus = props.selectionFollowsFocus,\n _props$TabIndicatorPr = props.TabIndicatorProps,\n TabIndicatorProps = _props$TabIndicatorPr === void 0 ? {} : _props$TabIndicatorPr,\n TabScrollButtonProps = props.TabScrollButtonProps,\n _props$textColor = props.textColor,\n textColor = _props$textColor === void 0 ? 'inherit' : _props$textColor,\n value = props.value,\n _props$variant = props.variant,\n variant = _props$variant === void 0 ? 'standard' : _props$variant,\n other = _objectWithoutProperties(props, [\"aria-label\", \"aria-labelledby\", \"action\", \"centered\", \"children\", \"classes\", \"className\", \"component\", \"indicatorColor\", \"onChange\", \"orientation\", \"ScrollButtonComponent\", \"scrollButtons\", \"selectionFollowsFocus\", \"TabIndicatorProps\", \"TabScrollButtonProps\", \"textColor\", \"value\", \"variant\"]);\n\n var theme = useTheme();\n var scrollable = variant === 'scrollable';\n var isRtl = theme.direction === 'rtl';\n var vertical = orientation === 'vertical';\n var scrollStart = vertical ? 'scrollTop' : 'scrollLeft';\n var start = vertical ? 'top' : 'left';\n var end = vertical ? 'bottom' : 'right';\n var clientSize = vertical ? 'clientHeight' : 'clientWidth';\n var size = vertical ? 'height' : 'width';\n\n if (process.env.NODE_ENV !== 'production') {\n if (centered && scrollable) {\n console.error('Material-UI: You can not use the `centered={true}` and `variant=\"scrollable\"` properties ' + 'at the same time on a `Tabs` component.');\n }\n }\n\n var _React$useState = React.useState(false),\n mounted = _React$useState[0],\n setMounted = _React$useState[1];\n\n var _React$useState2 = React.useState({}),\n indicatorStyle = _React$useState2[0],\n setIndicatorStyle = _React$useState2[1];\n\n var _React$useState3 = React.useState({\n start: false,\n end: false\n }),\n displayScroll = _React$useState3[0],\n setDisplayScroll = _React$useState3[1];\n\n var _React$useState4 = React.useState({\n overflow: 'hidden',\n marginBottom: null\n }),\n scrollerStyle = _React$useState4[0],\n setScrollerStyle = _React$useState4[1];\n\n var valueToIndex = new Map();\n var tabsRef = React.useRef(null);\n var tabListRef = React.useRef(null);\n\n var getTabsMeta = function getTabsMeta() {\n var tabsNode = tabsRef.current;\n var tabsMeta;\n\n if (tabsNode) {\n var rect = tabsNode.getBoundingClientRect(); // create a new object with ClientRect class props + scrollLeft\n\n tabsMeta = {\n clientWidth: tabsNode.clientWidth,\n scrollLeft: tabsNode.scrollLeft,\n scrollTop: tabsNode.scrollTop,\n scrollLeftNormalized: getNormalizedScrollLeft(tabsNode, theme.direction),\n scrollWidth: tabsNode.scrollWidth,\n top: rect.top,\n bottom: rect.bottom,\n left: rect.left,\n right: rect.right\n };\n }\n\n var tabMeta;\n\n if (tabsNode && value !== false) {\n var _children = tabListRef.current.children;\n\n if (_children.length > 0) {\n var tab = _children[valueToIndex.get(value)];\n\n if (process.env.NODE_ENV !== 'production') {\n if (!tab) {\n console.error([\"Material-UI: The value provided to the Tabs component is invalid.\", \"None of the Tabs' children match with `\".concat(value, \"`.\"), valueToIndex.keys ? \"You can provide one of the following values: \".concat(Array.from(valueToIndex.keys()).join(', '), \".\") : null].join('\\n'));\n }\n }\n\n tabMeta = tab ? tab.getBoundingClientRect() : null;\n }\n }\n\n return {\n tabsMeta: tabsMeta,\n tabMeta: tabMeta\n };\n };\n\n var updateIndicatorState = useEventCallback(function () {\n var _newIndicatorStyle;\n\n var _getTabsMeta = getTabsMeta(),\n tabsMeta = _getTabsMeta.tabsMeta,\n tabMeta = _getTabsMeta.tabMeta;\n\n var startValue = 0;\n\n if (tabMeta && tabsMeta) {\n if (vertical) {\n startValue = tabMeta.top - tabsMeta.top + tabsMeta.scrollTop;\n } else {\n var correction = isRtl ? tabsMeta.scrollLeftNormalized + tabsMeta.clientWidth - tabsMeta.scrollWidth : tabsMeta.scrollLeft;\n startValue = tabMeta.left - tabsMeta.left + correction;\n }\n }\n\n var newIndicatorStyle = (_newIndicatorStyle = {}, _defineProperty(_newIndicatorStyle, start, startValue), _defineProperty(_newIndicatorStyle, size, tabMeta ? tabMeta[size] : 0), _newIndicatorStyle);\n\n if (isNaN(indicatorStyle[start]) || isNaN(indicatorStyle[size])) {\n setIndicatorStyle(newIndicatorStyle);\n } else {\n var dStart = Math.abs(indicatorStyle[start] - newIndicatorStyle[start]);\n var dSize = Math.abs(indicatorStyle[size] - newIndicatorStyle[size]);\n\n if (dStart >= 1 || dSize >= 1) {\n setIndicatorStyle(newIndicatorStyle);\n }\n }\n });\n\n var scroll = function scroll(scrollValue) {\n animate(scrollStart, tabsRef.current, scrollValue);\n };\n\n var moveTabsScroll = function moveTabsScroll(delta) {\n var scrollValue = tabsRef.current[scrollStart];\n\n if (vertical) {\n scrollValue += delta;\n } else {\n scrollValue += delta * (isRtl ? -1 : 1); // Fix for Edge\n\n scrollValue *= isRtl && detectScrollType() === 'reverse' ? -1 : 1;\n }\n\n scroll(scrollValue);\n };\n\n var handleStartScrollClick = function handleStartScrollClick() {\n moveTabsScroll(-tabsRef.current[clientSize]);\n };\n\n var handleEndScrollClick = function handleEndScrollClick() {\n moveTabsScroll(tabsRef.current[clientSize]);\n };\n\n var handleScrollbarSizeChange = React.useCallback(function (scrollbarHeight) {\n setScrollerStyle({\n overflow: null,\n marginBottom: -scrollbarHeight\n });\n }, []);\n\n var getConditionalElements = function getConditionalElements() {\n var conditionalElements = {};\n conditionalElements.scrollbarSizeListener = scrollable ? /*#__PURE__*/React.createElement(ScrollbarSize, {\n className: classes.scrollable,\n onChange: handleScrollbarSizeChange\n }) : null;\n var scrollButtonsActive = displayScroll.start || displayScroll.end;\n var showScrollButtons = scrollable && (scrollButtons === 'auto' && scrollButtonsActive || scrollButtons === 'desktop' || scrollButtons === 'on');\n conditionalElements.scrollButtonStart = showScrollButtons ? /*#__PURE__*/React.createElement(ScrollButtonComponent, _extends({\n orientation: orientation,\n direction: isRtl ? 'right' : 'left',\n onClick: handleStartScrollClick,\n disabled: !displayScroll.start,\n className: clsx(classes.scrollButtons, scrollButtons !== 'on' && classes.scrollButtonsDesktop)\n }, TabScrollButtonProps)) : null;\n conditionalElements.scrollButtonEnd = showScrollButtons ? /*#__PURE__*/React.createElement(ScrollButtonComponent, _extends({\n orientation: orientation,\n direction: isRtl ? 'left' : 'right',\n onClick: handleEndScrollClick,\n disabled: !displayScroll.end,\n className: clsx(classes.scrollButtons, scrollButtons !== 'on' && classes.scrollButtonsDesktop)\n }, TabScrollButtonProps)) : null;\n return conditionalElements;\n };\n\n var scrollSelectedIntoView = useEventCallback(function () {\n var _getTabsMeta2 = getTabsMeta(),\n tabsMeta = _getTabsMeta2.tabsMeta,\n tabMeta = _getTabsMeta2.tabMeta;\n\n if (!tabMeta || !tabsMeta) {\n return;\n }\n\n if (tabMeta[start] < tabsMeta[start]) {\n // left side of button is out of view\n var nextScrollStart = tabsMeta[scrollStart] + (tabMeta[start] - tabsMeta[start]);\n scroll(nextScrollStart);\n } else if (tabMeta[end] > tabsMeta[end]) {\n // right side of button is out of view\n var _nextScrollStart = tabsMeta[scrollStart] + (tabMeta[end] - tabsMeta[end]);\n\n scroll(_nextScrollStart);\n }\n });\n var updateScrollButtonState = useEventCallback(function () {\n if (scrollable && scrollButtons !== 'off') {\n var _tabsRef$current = tabsRef.current,\n scrollTop = _tabsRef$current.scrollTop,\n scrollHeight = _tabsRef$current.scrollHeight,\n clientHeight = _tabsRef$current.clientHeight,\n scrollWidth = _tabsRef$current.scrollWidth,\n clientWidth = _tabsRef$current.clientWidth;\n var showStartScroll;\n var showEndScroll;\n\n if (vertical) {\n showStartScroll = scrollTop > 1;\n showEndScroll = scrollTop < scrollHeight - clientHeight - 1;\n } else {\n var scrollLeft = getNormalizedScrollLeft(tabsRef.current, theme.direction); // use 1 for the potential rounding error with browser zooms.\n\n showStartScroll = isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;\n showEndScroll = !isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;\n }\n\n if (showStartScroll !== displayScroll.start || showEndScroll !== displayScroll.end) {\n setDisplayScroll({\n start: showStartScroll,\n end: showEndScroll\n });\n }\n }\n });\n React.useEffect(function () {\n var handleResize = debounce(function () {\n updateIndicatorState();\n updateScrollButtonState();\n });\n var win = ownerWindow(tabsRef.current);\n win.addEventListener('resize', handleResize);\n return function () {\n handleResize.clear();\n win.removeEventListener('resize', handleResize);\n };\n }, [updateIndicatorState, updateScrollButtonState]);\n var handleTabsScroll = React.useCallback(debounce(function () {\n updateScrollButtonState();\n }));\n React.useEffect(function () {\n return function () {\n handleTabsScroll.clear();\n };\n }, [handleTabsScroll]);\n React.useEffect(function () {\n setMounted(true);\n }, []);\n React.useEffect(function () {\n updateIndicatorState();\n updateScrollButtonState();\n });\n React.useEffect(function () {\n scrollSelectedIntoView();\n }, [scrollSelectedIntoView, indicatorStyle]);\n React.useImperativeHandle(action, function () {\n return {\n updateIndicator: updateIndicatorState,\n updateScrollButtons: updateScrollButtonState\n };\n }, [updateIndicatorState, updateScrollButtonState]);\n var indicator = /*#__PURE__*/React.createElement(TabIndicator, _extends({\n className: classes.indicator,\n orientation: orientation,\n color: indicatorColor\n }, TabIndicatorProps, {\n style: _extends({}, indicatorStyle, TabIndicatorProps.style)\n }));\n var childIndex = 0;\n var children = React.Children.map(childrenProp, function (child) {\n if (! /*#__PURE__*/React.isValidElement(child)) {\n return null;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (isFragment(child)) {\n console.error([\"Material-UI: The Tabs component doesn't accept a Fragment as a child.\", 'Consider providing an array instead.'].join('\\n'));\n }\n }\n\n var childValue = child.props.value === undefined ? childIndex : child.props.value;\n valueToIndex.set(childValue, childIndex);\n var selected = childValue === value;\n childIndex += 1;\n return /*#__PURE__*/React.cloneElement(child, {\n fullWidth: variant === 'fullWidth',\n indicator: selected && !mounted && indicator,\n selected: selected,\n selectionFollowsFocus: selectionFollowsFocus,\n onChange: onChange,\n textColor: textColor,\n value: childValue\n });\n });\n\n var handleKeyDown = function handleKeyDown(event) {\n var target = event.target; // Keyboard navigation assumes that [role=\"tab\"] are siblings\n // though we might warn in the future about nested, interactive elements\n // as a a11y violation\n\n var role = target.getAttribute('role');\n\n if (role !== 'tab') {\n return;\n }\n\n var newFocusTarget = null;\n var previousItemKey = orientation !== \"vertical\" ? 'ArrowLeft' : 'ArrowUp';\n var nextItemKey = orientation !== \"vertical\" ? 'ArrowRight' : 'ArrowDown';\n\n if (orientation !== \"vertical\" && theme.direction === 'rtl') {\n // swap previousItemKey with nextItemKey\n previousItemKey = 'ArrowRight';\n nextItemKey = 'ArrowLeft';\n }\n\n switch (event.key) {\n case previousItemKey:\n newFocusTarget = target.previousElementSibling || tabListRef.current.lastChild;\n break;\n\n case nextItemKey:\n newFocusTarget = target.nextElementSibling || tabListRef.current.firstChild;\n break;\n\n case 'Home':\n newFocusTarget = tabListRef.current.firstChild;\n break;\n\n case 'End':\n newFocusTarget = tabListRef.current.lastChild;\n break;\n\n default:\n break;\n }\n\n if (newFocusTarget !== null) {\n newFocusTarget.focus();\n event.preventDefault();\n }\n };\n\n var conditionalElements = getConditionalElements();\n return /*#__PURE__*/React.createElement(Component, _extends({\n className: clsx(classes.root, className, vertical && classes.vertical),\n ref: ref\n }, other), conditionalElements.scrollButtonStart, conditionalElements.scrollbarSizeListener, /*#__PURE__*/React.createElement(\"div\", {\n className: clsx(classes.scroller, scrollable ? classes.scrollable : classes.fixed),\n style: scrollerStyle,\n ref: tabsRef,\n onScroll: handleTabsScroll\n }, /*#__PURE__*/React.createElement(\"div\", {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n className: clsx(classes.flexContainer, vertical && classes.flexContainerVertical, centered && !scrollable && classes.centered),\n onKeyDown: handleKeyDown,\n ref: tabListRef,\n role: \"tablist\"\n }, children), mounted && indicator), conditionalElements.scrollButtonEnd);\n});\nprocess.env.NODE_ENV !== \"production\" ? Tabs.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * Callback fired when the component mounts.\n * This is useful when you want to trigger an action programmatically.\n * It supports two actions: `updateIndicator()` and `updateScrollButtons()`\n *\n * @param {object} actions This object contains all possible actions\n * that can be triggered programmatically.\n */\n action: refType,\n\n /**\n * The label for the Tabs as a string.\n */\n 'aria-label': PropTypes.string,\n\n /**\n * An id or list of ids separated by a space that label the Tabs.\n */\n 'aria-labelledby': PropTypes.string,\n\n /**\n * If `true`, the tabs will be centered.\n * This property is intended for large views.\n */\n centered: PropTypes.bool,\n\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\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\n /* @typescript-to-proptypes-ignore */\n .elementType,\n\n /**\n * Determines the color of the indicator.\n */\n indicatorColor: PropTypes.oneOf(['primary', 'secondary']),\n\n /**\n * Callback fired when the value changes.\n *\n * @param {object} event The event source of the callback\n * @param {any} value We default to the index of the child (number)\n */\n onChange: PropTypes.func,\n\n /**\n * The tabs orientation (layout flow direction).\n */\n orientation: PropTypes.oneOf(['horizontal', 'vertical']),\n\n /**\n * The component used to render the scroll buttons.\n */\n ScrollButtonComponent: PropTypes.elementType,\n\n /**\n * Determine behavior of scroll buttons when tabs are set to scroll:\n *\n * - `auto` will only present them when not all the items are visible.\n * - `desktop` will only present them on medium and larger viewports.\n * - `on` will always present them.\n * - `off` will never present them.\n */\n scrollButtons: PropTypes.oneOf(['auto', 'desktop', 'off', 'on']),\n\n /**\n * If `true` the selected tab changes on focus. Otherwise it only\n * changes on activation.\n */\n selectionFollowsFocus: PropTypes.bool,\n\n /**\n * Props applied to the tab indicator element.\n */\n TabIndicatorProps: PropTypes.object,\n\n /**\n * Props applied to the [`TabScrollButton`](/api/tab-scroll-button/) element.\n */\n TabScrollButtonProps: PropTypes.object,\n\n /**\n * Determines the color of the `Tab`.\n */\n textColor: PropTypes.oneOf(['inherit', 'primary', 'secondary']),\n\n /**\n * The value of the currently selected `Tab`.\n * If you don't want any selected `Tab`, you can set this property to `false`.\n */\n value: PropTypes.any,\n\n /**\n * Determines additional display behavior of the tabs:\n *\n * - `scrollable` will invoke scrolling properties and allow for horizontally\n * scrolling (or swiping) of the tab bar.\n * -`fullWidth` will make the tabs grow to use all the available space,\n * which should be used for small views, like on mobile.\n * - `standard` will render the default state.\n */\n variant: PropTypes.oneOf(['fullWidth', 'scrollable', 'standard'])\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiTabs'\n})(Tabs);","import * as React from 'react';\nimport { createSvgIcon } from '@material-ui/core/utils';\n/**\r\n * @ignore - internal component.\r\n */\n\nexport default createSvgIcon( /*#__PURE__*/React.createElement(\"path\", {\n d: \"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z\"\n}), 'SuccessOutlined');","import * as React from 'react';\nimport { createSvgIcon } from '@material-ui/core/utils';\n/**\r\n * @ignore - internal component.\r\n */\n\nexport default createSvgIcon( /*#__PURE__*/React.createElement(\"path\", {\n d: \"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z\"\n}), 'ReportProblemOutlined');","import * as React from 'react';\nimport { createSvgIcon } from '@material-ui/core/utils';\n/**\r\n * @ignore - internal component.\r\n */\n\nexport default createSvgIcon( /*#__PURE__*/React.createElement(\"path\", {\n d: \"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z\"\n}), 'ErrorOutline');","import * as React from 'react';\nimport { createSvgIcon } from '@material-ui/core/utils';\n/**\r\n * @ignore - internal component.\r\n */\n\nexport default createSvgIcon( /*#__PURE__*/React.createElement(\"path\", {\n d: \"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z\"\n}), 'InfoOutlined');","import * as React from 'react';\nimport { createSvgIcon } from '@material-ui/core/utils';\n/**\r\n * @ignore - internal component.\r\n */\n\nexport default createSvgIcon( /*#__PURE__*/React.createElement(\"path\", {\n d: \"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"\n}), 'Close');","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { withStyles, lighten, darken } from '@material-ui/core/styles';\nimport Paper from '@material-ui/core/Paper';\nimport SuccessOutlinedIcon from '../internal/svg-icons/SuccessOutlined';\nimport ReportProblemOutlinedIcon from '../internal/svg-icons/ReportProblemOutlined';\nimport ErrorOutlineIcon from '../internal/svg-icons/ErrorOutline';\nimport InfoOutlinedIcon from '../internal/svg-icons/InfoOutlined';\nimport CloseIcon from '../internal/svg-icons/Close';\nimport IconButton from '@material-ui/core/IconButton';\nimport { capitalize } from '@material-ui/core/utils';\nexport var styles = function styles(theme) {\n var getColor = theme.palette.type === 'light' ? darken : lighten;\n var getBackgroundColor = theme.palette.type === 'light' ? lighten : darken;\n return {\n /* Styles applied to the root element. */\n root: _extends({}, theme.typography.body2, {\n borderRadius: theme.shape.borderRadius,\n backgroundColor: 'transparent',\n display: 'flex',\n padding: '6px 16px'\n }),\n\n /* Styles applied to the root element if `variant=\"standard\"` and `color=\"success\"`. */\n standardSuccess: {\n color: getColor(theme.palette.success.main, 0.6),\n backgroundColor: getBackgroundColor(theme.palette.success.main, 0.9),\n '& $icon': {\n color: theme.palette.success.main\n }\n },\n\n /* Styles applied to the root element if `variant=\"standard\"` and `color=\"info\"`. */\n standardInfo: {\n color: getColor(theme.palette.info.main, 0.6),\n backgroundColor: getBackgroundColor(theme.palette.info.main, 0.9),\n '& $icon': {\n color: theme.palette.info.main\n }\n },\n\n /* Styles applied to the root element if `variant=\"standard\"` and `color=\"warning\"`. */\n standardWarning: {\n color: getColor(theme.palette.warning.main, 0.6),\n backgroundColor: getBackgroundColor(theme.palette.warning.main, 0.9),\n '& $icon': {\n color: theme.palette.warning.main\n }\n },\n\n /* Styles applied to the root element if `variant=\"standard\"` and `color=\"error\"`. */\n standardError: {\n color: getColor(theme.palette.error.main, 0.6),\n backgroundColor: getBackgroundColor(theme.palette.error.main, 0.9),\n '& $icon': {\n color: theme.palette.error.main\n }\n },\n\n /* Styles applied to the root element if `variant=\"outlined\"` and `color=\"success\"`. */\n outlinedSuccess: {\n color: getColor(theme.palette.success.main, 0.6),\n border: \"1px solid \".concat(theme.palette.success.main),\n '& $icon': {\n color: theme.palette.success.main\n }\n },\n\n /* Styles applied to the root element if `variant=\"outlined\"` and `color=\"info\"`. */\n outlinedInfo: {\n color: getColor(theme.palette.info.main, 0.6),\n border: \"1px solid \".concat(theme.palette.info.main),\n '& $icon': {\n color: theme.palette.info.main\n }\n },\n\n /* Styles applied to the root element if `variant=\"outlined\"` and `color=\"warning\"`. */\n outlinedWarning: {\n color: getColor(theme.palette.warning.main, 0.6),\n border: \"1px solid \".concat(theme.palette.warning.main),\n '& $icon': {\n color: theme.palette.warning.main\n }\n },\n\n /* Styles applied to the root element if `variant=\"outlined\"` and `color=\"error\"`. */\n outlinedError: {\n color: getColor(theme.palette.error.main, 0.6),\n border: \"1px solid \".concat(theme.palette.error.main),\n '& $icon': {\n color: theme.palette.error.main\n }\n },\n\n /* Styles applied to the root element if `variant=\"filled\"` and `color=\"success\"`. */\n filledSuccess: {\n color: '#fff',\n fontWeight: theme.typography.fontWeightMedium,\n backgroundColor: theme.palette.success.main\n },\n\n /* Styles applied to the root element if `variant=\"filled\"` and `color=\"info\"`. */\n filledInfo: {\n color: '#fff',\n fontWeight: theme.typography.fontWeightMedium,\n backgroundColor: theme.palette.info.main\n },\n\n /* Styles applied to the root element if `variant=\"filled\"` and `color=\"warning\"`. */\n filledWarning: {\n color: '#fff',\n fontWeight: theme.typography.fontWeightMedium,\n backgroundColor: theme.palette.warning.main\n },\n\n /* Styles applied to the root element if `variant=\"filled\"` and `color=\"error\"`. */\n filledError: {\n color: '#fff',\n fontWeight: theme.typography.fontWeightMedium,\n backgroundColor: theme.palette.error.main\n },\n\n /* Styles applied to the icon wrapper element. */\n icon: {\n marginRight: 12,\n padding: '7px 0',\n display: 'flex',\n fontSize: 22,\n opacity: 0.9\n },\n\n /* Styles applied to the message wrapper element. */\n message: {\n padding: '8px 0'\n },\n\n /* Styles applied to the action wrapper element if `action` is provided. */\n action: {\n display: 'flex',\n alignItems: 'center',\n marginLeft: 'auto',\n paddingLeft: 16,\n marginRight: -8\n }\n };\n};\nvar defaultIconMapping = {\n success: /*#__PURE__*/React.createElement(SuccessOutlinedIcon, {\n fontSize: \"inherit\"\n }),\n warning: /*#__PURE__*/React.createElement(ReportProblemOutlinedIcon, {\n fontSize: \"inherit\"\n }),\n error: /*#__PURE__*/React.createElement(ErrorOutlineIcon, {\n fontSize: \"inherit\"\n }),\n info: /*#__PURE__*/React.createElement(InfoOutlinedIcon, {\n fontSize: \"inherit\"\n })\n};\n\nvar _ref = /*#__PURE__*/React.createElement(CloseIcon, {\n fontSize: \"small\"\n});\n\nvar Alert = /*#__PURE__*/React.forwardRef(function Alert(props, ref) {\n var action = props.action,\n children = props.children,\n classes = props.classes,\n className = props.className,\n _props$closeText = props.closeText,\n closeText = _props$closeText === void 0 ? 'Close' : _props$closeText,\n color = props.color,\n icon = props.icon,\n _props$iconMapping = props.iconMapping,\n iconMapping = _props$iconMapping === void 0 ? defaultIconMapping : _props$iconMapping,\n onClose = props.onClose,\n _props$role = props.role,\n role = _props$role === void 0 ? 'alert' : _props$role,\n _props$severity = props.severity,\n severity = _props$severity === void 0 ? 'success' : _props$severity,\n _props$variant = props.variant,\n variant = _props$variant === void 0 ? 'standard' : _props$variant,\n other = _objectWithoutProperties(props, [\"action\", \"children\", \"classes\", \"className\", \"closeText\", \"color\", \"icon\", \"iconMapping\", \"onClose\", \"role\", \"severity\", \"variant\"]);\n\n return /*#__PURE__*/React.createElement(Paper, _extends({\n role: role,\n square: true,\n elevation: 0,\n className: clsx(classes.root, classes[\"\".concat(variant).concat(capitalize(color || severity))], className),\n ref: ref\n }, other), icon !== false ? /*#__PURE__*/React.createElement(\"div\", {\n className: classes.icon\n }, icon || iconMapping[severity] || defaultIconMapping[severity]) : null, /*#__PURE__*/React.createElement(\"div\", {\n className: classes.message\n }, children), action != null ? /*#__PURE__*/React.createElement(\"div\", {\n className: classes.action\n }, action) : null, action == null && onClose ? /*#__PURE__*/React.createElement(\"div\", {\n className: classes.action\n }, /*#__PURE__*/React.createElement(IconButton, {\n size: \"small\",\n \"aria-label\": closeText,\n title: closeText,\n color: \"inherit\",\n onClick: onClose\n }, _ref)) : null);\n});\nprocess.env.NODE_ENV !== \"production\" ? Alert.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\r\n * The action to display. It renders after the message, at the end of the alert.\r\n */\n action: PropTypes.node,\n\n /**\r\n * The content of the component.\r\n */\n children: PropTypes.node,\n\n /**\r\n * Override or extend the styles applied to the component.\r\n * See [CSS API](#css) below for more details.\r\n */\n classes: PropTypes.object,\n\n /**\r\n * @ignore\r\n */\n className: PropTypes.string,\n\n /**\r\n * Override the default label for the *close popup* icon button.\r\n *\r\n * For localization purposes, you can use the provided [translations](/guides/localization/).\r\n */\n closeText: PropTypes.string,\n\n /**\r\n * The main color for the alert. Unless provided, the value is taken from the `severity` prop.\r\n */\n color: PropTypes.oneOf(['error', 'info', 'success', 'warning']),\n\n /**\r\n * Override the icon displayed before the children.\r\n * Unless provided, the icon is mapped to the value of the `severity` prop.\r\n */\n icon: PropTypes.node,\n\n /**\r\n * The component maps the `severity` prop to a range of different icons,\r\n * for instance success to ``.\r\n * If you wish to change this mapping, you can provide your own.\r\n * Alternatively, you can use the `icon` prop to override the icon displayed.\r\n */\n iconMapping: PropTypes.shape({\n error: PropTypes.node,\n info: PropTypes.node,\n success: PropTypes.node,\n warning: PropTypes.node\n }),\n\n /**\r\n * Callback fired when the component requests to be closed.\r\n * When provided and no `action` prop is set, a close icon button is displayed that triggers the callback when clicked.\r\n *\r\n * @param {object} event The event source of the callback.\r\n */\n onClose: PropTypes.func,\n\n /**\r\n * The ARIA role attribute of the element.\r\n */\n role: PropTypes.string,\n\n /**\r\n * The severity of the alert. This defines the color and icon used.\r\n */\n severity: PropTypes.oneOf(['error', 'info', 'success', 'warning']),\n\n /**\r\n * The variant to use.\r\n */\n variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiAlert'\n})(Alert);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { getThemeProps, useTheme } from '@material-ui/styles';\nexport default function useMediaQuery(queryInput) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var theme = useTheme();\n var props = getThemeProps({\n theme: theme,\n name: 'MuiUseMediaQuery',\n props: {}\n });\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof queryInput === 'function' && theme === null) {\n console.error(['Material-UI: The `query` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\\n'));\n }\n }\n\n var query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;\n query = query.replace(/^@media( ?)/m, ''); // Wait for jsdom to support the match media feature.\n // All the browsers Material-UI support have this built-in.\n // This defensive check is here for simplicity.\n // Most of the time, the match media logic isn't central to people tests.\n\n var supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';\n\n var _props$options = _extends({}, props, options),\n _props$options$defaul = _props$options.defaultMatches,\n defaultMatches = _props$options$defaul === void 0 ? false : _props$options$defaul,\n _props$options$matchM = _props$options.matchMedia,\n matchMedia = _props$options$matchM === void 0 ? supportMatchMedia ? window.matchMedia : null : _props$options$matchM,\n _props$options$noSsr = _props$options.noSsr,\n noSsr = _props$options$noSsr === void 0 ? false : _props$options$noSsr,\n _props$options$ssrMat = _props$options.ssrMatchMedia,\n ssrMatchMedia = _props$options$ssrMat === void 0 ? null : _props$options$ssrMat;\n\n var _React$useState = React.useState(function () {\n if (noSsr && supportMatchMedia) {\n return matchMedia(query).matches;\n }\n\n if (ssrMatchMedia) {\n return ssrMatchMedia(query).matches;\n } // Once the component is mounted, we rely on the\n // event listeners to return the correct matches value.\n\n\n return defaultMatches;\n }),\n match = _React$useState[0],\n setMatch = _React$useState[1];\n\n React.useEffect(function () {\n var active = true;\n\n if (!supportMatchMedia) {\n return undefined;\n }\n\n var queryList = matchMedia(query);\n\n var updateMatch = function updateMatch() {\n // Workaround Safari wrong implementation of matchMedia\n // TODO can we remove it?\n // https://github.com/mui-org/material-ui/pull/17315#issuecomment-528286677\n if (active) {\n setMatch(queryList.matches);\n }\n };\n\n updateMatch();\n queryList.addListener(updateMatch);\n return function () {\n active = false;\n queryList.removeListener(updateMatch);\n };\n }, [query, matchMedia, supportMatchMedia]);\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useDebugValue({\n query: query,\n match: match\n });\n }\n\n return match;\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { getDisplayName } from '@material-ui/utils';\nimport { getThemeProps } from '@material-ui/styles';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport useTheme from '../styles/useTheme';\nimport { keys as breakpointKeys } from '../styles/createBreakpoints';\nimport useMediaQuery from '../useMediaQuery'; // By default, returns true if screen width is the same or greater than the given breakpoint.\n\nexport var isWidthUp = function isWidthUp(breakpoint, width) {\n var inclusive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n if (inclusive) {\n return breakpointKeys.indexOf(breakpoint) <= breakpointKeys.indexOf(width);\n }\n\n return breakpointKeys.indexOf(breakpoint) < breakpointKeys.indexOf(width);\n}; // By default, returns true if screen width is the same or less than the given breakpoint.\n\nexport var isWidthDown = function isWidthDown(breakpoint, width) {\n var inclusive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n if (inclusive) {\n return breakpointKeys.indexOf(width) <= breakpointKeys.indexOf(breakpoint);\n }\n\n return breakpointKeys.indexOf(width) < breakpointKeys.indexOf(breakpoint);\n};\nvar useEnhancedEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;\n\nvar withWidth = function withWidth() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return function (Component) {\n var _options$withTheme = options.withTheme,\n withThemeOption = _options$withTheme === void 0 ? false : _options$withTheme,\n _options$noSSR = options.noSSR,\n noSSR = _options$noSSR === void 0 ? false : _options$noSSR,\n initialWidthOption = options.initialWidth;\n\n function WithWidth(props) {\n var contextTheme = useTheme();\n var theme = props.theme || contextTheme;\n\n var _getThemeProps = getThemeProps({\n theme: theme,\n name: 'MuiWithWidth',\n props: _extends({}, props)\n }),\n initialWidth = _getThemeProps.initialWidth,\n width = _getThemeProps.width,\n other = _objectWithoutProperties(_getThemeProps, [\"initialWidth\", \"width\"]);\n\n var _React$useState = React.useState(false),\n mountedState = _React$useState[0],\n setMountedState = _React$useState[1];\n\n useEnhancedEffect(function () {\n setMountedState(true);\n }, []);\n /**\n * innerWidth |xs sm md lg xl\n * |-------|-------|-------|-------|------>\n * width | xs | sm | md | lg | xl\n */\n\n var keys = theme.breakpoints.keys.slice().reverse();\n var widthComputed = keys.reduce(function (output, key) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n var matches = useMediaQuery(theme.breakpoints.up(key));\n return !output && matches ? key : output;\n }, null);\n\n var more = _extends({\n width: width || (mountedState || noSSR ? widthComputed : undefined) || initialWidth || initialWidthOption\n }, withThemeOption ? {\n theme: theme\n } : {}, other); // When rendering the component on the server,\n // we have no idea about the client browser screen width.\n // In order to prevent blinks and help the reconciliation of the React tree\n // we are not rendering the child component.\n //\n // An alternative is to use the `initialWidth` property.\n\n\n if (more.width === undefined) {\n return null;\n }\n\n return /*#__PURE__*/React.createElement(Component, more);\n }\n\n process.env.NODE_ENV !== \"production\" ? WithWidth.propTypes = {\n /**\n * As `window.innerWidth` is unavailable on the server,\n * we default to rendering an empty component during the first mount.\n * You might want to use an heuristic to approximate\n * the screen width of the client browser screen width.\n *\n * For instance, you could be using the user-agent or the client-hints.\n * https://caniuse.com/#search=client%20hint\n */\n initialWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),\n\n /**\n * @ignore\n */\n theme: PropTypes.object,\n\n /**\n * Bypass the width calculation logic.\n */\n width: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl'])\n } : void 0;\n\n if (process.env.NODE_ENV !== 'production') {\n WithWidth.displayName = \"WithWidth(\".concat(getDisplayName(Component), \")\");\n }\n\n hoistNonReactStatics(WithWidth, Component);\n return WithWidth;\n };\n};\n\nexport default withWidth;","import PropTypes from 'prop-types';\nimport { exactProp } from '@material-ui/utils';\nimport withWidth, { isWidthDown, isWidthUp } from '../withWidth';\nimport useTheme from '../styles/useTheme';\n/**\n * @ignore - internal component.\n */\n\nfunction HiddenJs(props) {\n var children = props.children,\n only = props.only,\n width = props.width;\n var theme = useTheme();\n var visible = true; // `only` check is faster to get out sooner if used.\n\n if (only) {\n if (Array.isArray(only)) {\n for (var i = 0; i < only.length; i += 1) {\n var breakpoint = only[i];\n\n if (width === breakpoint) {\n visible = false;\n break;\n }\n }\n } else if (only && width === only) {\n visible = false;\n }\n } // Allow `only` to be combined with other props. If already hidden, no need to check others.\n\n\n if (visible) {\n // determine visibility based on the smallest size up\n for (var _i = 0; _i < theme.breakpoints.keys.length; _i += 1) {\n var _breakpoint = theme.breakpoints.keys[_i];\n var breakpointUp = props[\"\".concat(_breakpoint, \"Up\")];\n var breakpointDown = props[\"\".concat(_breakpoint, \"Down\")];\n\n if (breakpointUp && isWidthUp(_breakpoint, width) || breakpointDown && isWidthDown(_breakpoint, width)) {\n visible = false;\n break;\n }\n }\n }\n\n if (!visible) {\n return null;\n }\n\n return children;\n}\n\nHiddenJs.propTypes = {\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * Specify which implementation to use. 'js' is the default, 'css' works better for\n * server-side rendering.\n */\n implementation: PropTypes.oneOf(['js', 'css']),\n\n /**\n * You can use this prop when choosing the `js` implementation with server-side rendering.\n *\n * As `window.innerWidth` is unavailable on the server,\n * we default to rendering an empty component during the first mount.\n * You might want to use an heuristic to approximate\n * the screen width of the client browser screen width.\n *\n * For instance, you could be using the user-agent or the client-hints.\n * https://caniuse.com/#search=client%20hint\n */\n initialWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n lgDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n lgUp: PropTypes.bool,\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n mdDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n mdUp: PropTypes.bool,\n\n /**\n * Hide the given breakpoint(s).\n */\n only: PropTypes.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']), PropTypes.arrayOf(PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']))]),\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n smDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n smUp: PropTypes.bool,\n\n /**\n * @ignore\n * width prop provided by withWidth decorator.\n */\n width: PropTypes.string.isRequired,\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n xlDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n xlUp: PropTypes.bool,\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n xsDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n xsUp: PropTypes.bool\n};\n\nif (process.env.NODE_ENV !== 'production') {\n HiddenJs.propTypes = exactProp(HiddenJs.propTypes);\n}\n\nexport default withWidth()(HiddenJs);","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport capitalize from '../utils/capitalize';\nimport withStyles from '../styles/withStyles';\nimport useTheme from '../styles/useTheme';\n\nvar styles = function styles(theme) {\n var hidden = {\n display: 'none'\n };\n return theme.breakpoints.keys.reduce(function (acc, key) {\n acc[\"only\".concat(capitalize(key))] = _defineProperty({}, theme.breakpoints.only(key), hidden);\n acc[\"\".concat(key, \"Up\")] = _defineProperty({}, theme.breakpoints.up(key), hidden);\n acc[\"\".concat(key, \"Down\")] = _defineProperty({}, theme.breakpoints.down(key), hidden);\n return acc;\n }, {});\n};\n/**\n * @ignore - internal component.\n */\n\n\nfunction HiddenCss(props) {\n var children = props.children,\n classes = props.classes,\n className = props.className,\n only = props.only,\n other = _objectWithoutProperties(props, [\"children\", \"classes\", \"className\", \"only\"]);\n\n var theme = useTheme();\n\n if (process.env.NODE_ENV !== 'production') {\n var unknownProps = Object.keys(other).filter(function (propName) {\n var isUndeclaredBreakpoint = !theme.breakpoints.keys.some(function (breakpoint) {\n return \"\".concat(breakpoint, \"Up\") === propName || \"\".concat(breakpoint, \"Down\") === propName;\n });\n return isUndeclaredBreakpoint;\n });\n\n if (unknownProps.length > 0) {\n console.error(\"Material-UI: Unsupported props received by ``: \".concat(unknownProps.join(', '), \". Did you forget to wrap this component in a ThemeProvider declaring these breakpoints?\"));\n }\n }\n\n var clsx = [];\n\n if (className) {\n clsx.push(className);\n }\n\n for (var i = 0; i < theme.breakpoints.keys.length; i += 1) {\n var breakpoint = theme.breakpoints.keys[i];\n var breakpointUp = props[\"\".concat(breakpoint, \"Up\")];\n var breakpointDown = props[\"\".concat(breakpoint, \"Down\")];\n\n if (breakpointUp) {\n clsx.push(classes[\"\".concat(breakpoint, \"Up\")]);\n }\n\n if (breakpointDown) {\n clsx.push(classes[\"\".concat(breakpoint, \"Down\")]);\n }\n }\n\n if (only) {\n var onlyBreakpoints = Array.isArray(only) ? only : [only];\n onlyBreakpoints.forEach(function (breakpoint) {\n clsx.push(classes[\"only\".concat(capitalize(breakpoint))]);\n });\n }\n\n return /*#__PURE__*/React.createElement(\"div\", {\n className: clsx.join(' ')\n }, children);\n}\n\nprocess.env.NODE_ENV !== \"production\" ? HiddenCss.propTypes = {\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object.isRequired,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * Specify which implementation to use. 'js' is the default, 'css' works better for\n * server-side rendering.\n */\n implementation: PropTypes.oneOf(['js', 'css']),\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n lgDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n lgUp: PropTypes.bool,\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n mdDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n mdUp: PropTypes.bool,\n\n /**\n * Hide the given breakpoint(s).\n */\n only: PropTypes.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']), PropTypes.arrayOf(PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']))]),\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n smDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n smUp: PropTypes.bool,\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n xlDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n xlUp: PropTypes.bool,\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n xsDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n xsUp: PropTypes.bool\n} : void 0;\nexport default withStyles(styles, {\n name: 'PrivateHiddenCss'\n})(HiddenCss);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport HiddenJs from './HiddenJs';\nimport HiddenCss from './HiddenCss';\n/**\n * Responsively hides children based on the selected implementation.\n */\n\nfunction Hidden(props) {\n var _props$implementation = props.implementation,\n implementation = _props$implementation === void 0 ? 'js' : _props$implementation,\n _props$lgDown = props.lgDown,\n lgDown = _props$lgDown === void 0 ? false : _props$lgDown,\n _props$lgUp = props.lgUp,\n lgUp = _props$lgUp === void 0 ? false : _props$lgUp,\n _props$mdDown = props.mdDown,\n mdDown = _props$mdDown === void 0 ? false : _props$mdDown,\n _props$mdUp = props.mdUp,\n mdUp = _props$mdUp === void 0 ? false : _props$mdUp,\n _props$smDown = props.smDown,\n smDown = _props$smDown === void 0 ? false : _props$smDown,\n _props$smUp = props.smUp,\n smUp = _props$smUp === void 0 ? false : _props$smUp,\n _props$xlDown = props.xlDown,\n xlDown = _props$xlDown === void 0 ? false : _props$xlDown,\n _props$xlUp = props.xlUp,\n xlUp = _props$xlUp === void 0 ? false : _props$xlUp,\n _props$xsDown = props.xsDown,\n xsDown = _props$xsDown === void 0 ? false : _props$xsDown,\n _props$xsUp = props.xsUp,\n xsUp = _props$xsUp === void 0 ? false : _props$xsUp,\n other = _objectWithoutProperties(props, [\"implementation\", \"lgDown\", \"lgUp\", \"mdDown\", \"mdUp\", \"smDown\", \"smUp\", \"xlDown\", \"xlUp\", \"xsDown\", \"xsUp\"]);\n\n if (implementation === 'js') {\n return /*#__PURE__*/React.createElement(HiddenJs, _extends({\n lgDown: lgDown,\n lgUp: lgUp,\n mdDown: mdDown,\n mdUp: mdUp,\n smDown: smDown,\n smUp: smUp,\n xlDown: xlDown,\n xlUp: xlUp,\n xsDown: xsDown,\n xsUp: xsUp\n }, other));\n }\n\n return /*#__PURE__*/React.createElement(HiddenCss, _extends({\n lgDown: lgDown,\n lgUp: lgUp,\n mdDown: mdDown,\n mdUp: mdUp,\n smDown: smDown,\n smUp: smUp,\n xlDown: xlDown,\n xlUp: xlUp,\n xsDown: xsDown,\n xsUp: xsUp\n }, other));\n}\n\nprocess.env.NODE_ENV !== \"production\" ? Hidden.propTypes = {\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * Specify which implementation to use. 'js' is the default, 'css' works better for\n * server-side rendering.\n */\n implementation: PropTypes.oneOf(['js', 'css']),\n\n /**\n * You can use this prop when choosing the `js` implementation with server-side rendering.\n *\n * As `window.innerWidth` is unavailable on the server,\n * we default to rendering an empty component during the first mount.\n * You might want to use an heuristic to approximate\n * the screen width of the client browser screen width.\n *\n * For instance, you could be using the user-agent or the client-hints.\n * https://caniuse.com/#search=client%20hint\n */\n initialWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n lgDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n lgUp: PropTypes.bool,\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n mdDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n mdUp: PropTypes.bool,\n\n /**\n * Hide the given breakpoint(s).\n */\n only: PropTypes.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']), PropTypes.arrayOf(PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']))]),\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n smDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n smUp: PropTypes.bool,\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n xlDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n xlUp: PropTypes.bool,\n\n /**\n * If `true`, screens this size and down will be hidden.\n */\n xsDown: PropTypes.bool,\n\n /**\n * If `true`, screens this size and up will be hidden.\n */\n xsUp: PropTypes.bool\n} : void 0;\nexport default Hidden;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from '../utils/debounce';\nimport useForkRef from '../utils/useForkRef';\nimport deprecatedPropType from '../utils/deprecatedPropType';\n\nfunction getStyleValue(computedStyle, property) {\n return parseInt(computedStyle[property], 10) || 0;\n}\n\nvar useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\nvar styles = {\n /* Styles applied to the shadow textarea element. */\n shadow: {\n // Visibility needed to hide the extra text area on iPads\n visibility: 'hidden',\n // Remove from the content flow\n position: 'absolute',\n // Ignore the scrollbar width\n overflow: 'hidden',\n height: 0,\n top: 0,\n left: 0,\n // Create a new layer, increase the isolation of the computed values\n transform: 'translateZ(0)'\n }\n};\nvar TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize(props, ref) {\n var onChange = props.onChange,\n rows = props.rows,\n rowsMax = props.rowsMax,\n rowsMinProp = props.rowsMin,\n maxRowsProp = props.maxRows,\n _props$minRows = props.minRows,\n minRowsProp = _props$minRows === void 0 ? 1 : _props$minRows,\n style = props.style,\n value = props.value,\n other = _objectWithoutProperties(props, [\"onChange\", \"rows\", \"rowsMax\", \"rowsMin\", \"maxRows\", \"minRows\", \"style\", \"value\"]);\n\n var maxRows = maxRowsProp || rowsMax;\n var minRows = rows || rowsMinProp || minRowsProp;\n\n var _React$useRef = React.useRef(value != null),\n isControlled = _React$useRef.current;\n\n var inputRef = React.useRef(null);\n var handleRef = useForkRef(ref, inputRef);\n var shadowRef = React.useRef(null);\n var renders = React.useRef(0);\n\n var _React$useState = React.useState({}),\n state = _React$useState[0],\n setState = _React$useState[1];\n\n var syncHeight = React.useCallback(function () {\n var input = inputRef.current;\n var computedStyle = window.getComputedStyle(input);\n var inputShallow = shadowRef.current;\n inputShallow.style.width = computedStyle.width;\n inputShallow.value = input.value || props.placeholder || 'x';\n\n if (inputShallow.value.slice(-1) === '\\n') {\n // Certain fonts which overflow the line height will cause the textarea\n // to report a different scrollHeight depending on whether the last line\n // is empty. Make it non-empty to avoid this issue.\n inputShallow.value += ' ';\n }\n\n var boxSizing = computedStyle['box-sizing'];\n var padding = getStyleValue(computedStyle, 'padding-bottom') + getStyleValue(computedStyle, 'padding-top');\n var border = getStyleValue(computedStyle, 'border-bottom-width') + getStyleValue(computedStyle, 'border-top-width'); // The height of the inner content\n\n var innerHeight = inputShallow.scrollHeight - padding; // Measure height of a textarea with a single row\n\n inputShallow.value = 'x';\n var singleRowHeight = inputShallow.scrollHeight - padding; // The height of the outer content\n\n var outerHeight = innerHeight;\n\n if (minRows) {\n outerHeight = Math.max(Number(minRows) * singleRowHeight, outerHeight);\n }\n\n if (maxRows) {\n outerHeight = Math.min(Number(maxRows) * singleRowHeight, outerHeight);\n }\n\n outerHeight = Math.max(outerHeight, singleRowHeight); // Take the box sizing into account for applying this value as a style.\n\n var outerHeightStyle = outerHeight + (boxSizing === 'border-box' ? padding + border : 0);\n var overflow = Math.abs(outerHeight - innerHeight) <= 1;\n setState(function (prevState) {\n // Need a large enough difference to update the height.\n // This prevents infinite rendering loop.\n if (renders.current < 20 && (outerHeightStyle > 0 && Math.abs((prevState.outerHeightStyle || 0) - outerHeightStyle) > 1 || prevState.overflow !== overflow)) {\n renders.current += 1;\n return {\n overflow: overflow,\n outerHeightStyle: outerHeightStyle\n };\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (renders.current === 20) {\n console.error(['Material-UI: Too many re-renders. The layout is unstable.', 'TextareaAutosize limits the number of renders to prevent an infinite loop.'].join('\\n'));\n }\n }\n\n return prevState;\n });\n }, [maxRows, minRows, props.placeholder]);\n React.useEffect(function () {\n var handleResize = debounce(function () {\n renders.current = 0;\n syncHeight();\n });\n window.addEventListener('resize', handleResize);\n return function () {\n handleResize.clear();\n window.removeEventListener('resize', handleResize);\n };\n }, [syncHeight]);\n useEnhancedEffect(function () {\n syncHeight();\n });\n React.useEffect(function () {\n renders.current = 0;\n }, [value]);\n\n var handleChange = function handleChange(event) {\n renders.current = 0;\n\n if (!isControlled) {\n syncHeight();\n }\n\n if (onChange) {\n onChange(event);\n }\n };\n\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"textarea\", _extends({\n value: value,\n onChange: handleChange,\n ref: handleRef // Apply the rows prop to get a \"correct\" first SSR paint\n ,\n rows: minRows,\n style: _extends({\n height: state.outerHeightStyle,\n // Need a large enough difference to allow scrolling.\n // This prevents infinite rendering loop.\n overflow: state.overflow ? 'hidden' : null\n }, style)\n }, other)), /*#__PURE__*/React.createElement(\"textarea\", {\n \"aria-hidden\": true,\n className: props.className,\n readOnly: true,\n ref: shadowRef,\n tabIndex: -1,\n style: _extends({}, styles.shadow, style)\n }));\n});\nprocess.env.NODE_ENV !== \"production\" ? TextareaAutosize.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * Maximum number of rows to display.\n */\n maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Minimum number of rows to display.\n */\n minRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * @ignore\n */\n onChange: PropTypes.func,\n\n /**\n * @ignore\n */\n placeholder: PropTypes.string,\n\n /**\n * Minimum number of rows to display.\n * @deprecated Use `minRows` instead.\n */\n rows: deprecatedPropType(PropTypes.oneOfType([PropTypes.number, PropTypes.string]), 'Use `minRows` instead.'),\n\n /**\n * Maximum number of rows to display.\n * @deprecated Use `maxRows` instead.\n */\n rowsMax: deprecatedPropType(PropTypes.oneOfType([PropTypes.number, PropTypes.string]), 'Use `maxRows` instead.'),\n\n /**\n * Minimum number of rows to display.\n * @deprecated Use `minRows` instead.\n */\n rowsMin: deprecatedPropType(PropTypes.oneOfType([PropTypes.number, PropTypes.string]), 'Use `minRows` instead.'),\n\n /**\n * @ignore\n */\n style: PropTypes.object,\n\n /**\n * @ignore\n */\n value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.number, PropTypes.string])\n} : void 0;\nexport default TextareaAutosize;","// Supports determination of isControlled().\n// Controlled input accepts its current value as a prop.\n//\n// @see https://facebook.github.io/react/docs/forms.html#controlled-components\n// @param value\n// @returns {boolean} true if string (including '') or number (including zero)\nexport function hasValue(value) {\n return value != null && !(Array.isArray(value) && value.length === 0);\n} // Determine if field is empty or filled.\n// Response determines if label is presented above field or as placeholder.\n//\n// @param obj\n// @param SSR\n// @returns {boolean} False when not present or empty string.\n// True when any number or string with length.\n\nexport function isFilled(obj) {\n var SSR = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n return obj && (hasValue(obj.value) && obj.value !== '' || SSR && hasValue(obj.defaultValue) && obj.defaultValue !== '');\n} // Determine if an Input is adorned on start.\n// It's corresponding to the left with LTR.\n//\n// @param obj\n// @returns {boolean} False when no adornments.\n// True when adorned at the start.\n\nexport function isAdornedStart(obj) {\n return obj.startAdornment;\n}","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { formatMuiErrorMessage as _formatMuiErrorMessage } from \"@material-ui/utils\";\n\n/* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { refType } from '@material-ui/utils';\nimport formControlState from '../FormControl/formControlState';\nimport FormControlContext, { useFormControl } from '../FormControl/FormControlContext';\nimport withStyles from '../styles/withStyles';\nimport capitalize from '../utils/capitalize';\nimport useForkRef from '../utils/useForkRef';\nimport TextareaAutosize from '../TextareaAutosize';\nimport { isFilled } from './utils';\nexport var styles = function styles(theme) {\n var light = theme.palette.type === 'light';\n var placeholder = {\n color: 'currentColor',\n opacity: light ? 0.42 : 0.5,\n transition: theme.transitions.create('opacity', {\n duration: theme.transitions.duration.shorter\n })\n };\n var placeholderHidden = {\n opacity: '0 !important'\n };\n var placeholderVisible = {\n opacity: light ? 0.42 : 0.5\n };\n return {\n '@global': {\n '@keyframes mui-auto-fill': {},\n '@keyframes mui-auto-fill-cancel': {}\n },\n\n /* Styles applied to the root element. */\n root: _extends({}, theme.typography.body1, {\n color: theme.palette.text.primary,\n lineHeight: '1.1876em',\n // Reset (19px), match the native input line-height\n boxSizing: 'border-box',\n // Prevent padding issue with fullWidth.\n position: 'relative',\n cursor: 'text',\n display: 'inline-flex',\n alignItems: 'center',\n '&$disabled': {\n color: theme.palette.text.disabled,\n cursor: 'default'\n }\n }),\n\n /* Styles applied to the root element if the component is a descendant of `FormControl`. */\n formControl: {},\n\n /* Styles applied to the root element if the component is focused. */\n focused: {},\n\n /* Styles applied to the root element if `disabled={true}`. */\n disabled: {},\n\n /* Styles applied to the root element if `startAdornment` is provided. */\n adornedStart: {},\n\n /* Styles applied to the root element if `endAdornment` is provided. */\n adornedEnd: {},\n\n /* Pseudo-class applied to the root element if `error={true}`. */\n error: {},\n\n /* Styles applied to the `input` element if `margin=\"dense\"`. */\n marginDense: {},\n\n /* Styles applied to the root element if `multiline={true}`. */\n multiline: {\n padding: \"\".concat(8 - 2, \"px 0 \").concat(8 - 1, \"px\"),\n '&$marginDense': {\n paddingTop: 4 - 1\n }\n },\n\n /* Styles applied to the root element if the color is secondary. */\n colorSecondary: {},\n\n /* Styles applied to the root element if `fullWidth={true}`. */\n fullWidth: {\n width: '100%'\n },\n\n /* Styles applied to the `input` element. */\n input: {\n font: 'inherit',\n letterSpacing: 'inherit',\n color: 'currentColor',\n padding: \"\".concat(8 - 2, \"px 0 \").concat(8 - 1, \"px\"),\n border: 0,\n boxSizing: 'content-box',\n background: 'none',\n height: '1.1876em',\n // Reset (19px), match the native input line-height\n margin: 0,\n // Reset for Safari\n WebkitTapHighlightColor: 'transparent',\n display: 'block',\n // Make the flex item shrink with Firefox\n minWidth: 0,\n width: '100%',\n // Fix IE 11 width issue\n animationName: 'mui-auto-fill-cancel',\n animationDuration: '10ms',\n '&::-webkit-input-placeholder': placeholder,\n '&::-moz-placeholder': placeholder,\n // Firefox 19+\n '&:-ms-input-placeholder': placeholder,\n // IE 11\n '&::-ms-input-placeholder': placeholder,\n // Edge\n '&:focus': {\n outline: 0\n },\n // Reset Firefox invalid required input style\n '&:invalid': {\n boxShadow: 'none'\n },\n '&::-webkit-search-decoration': {\n // Remove the padding when type=search.\n '-webkit-appearance': 'none'\n },\n // Show and hide the placeholder logic\n 'label[data-shrink=false] + $formControl &': {\n '&::-webkit-input-placeholder': placeholderHidden,\n '&::-moz-placeholder': placeholderHidden,\n // Firefox 19+\n '&:-ms-input-placeholder': placeholderHidden,\n // IE 11\n '&::-ms-input-placeholder': placeholderHidden,\n // Edge\n '&:focus::-webkit-input-placeholder': placeholderVisible,\n '&:focus::-moz-placeholder': placeholderVisible,\n // Firefox 19+\n '&:focus:-ms-input-placeholder': placeholderVisible,\n // IE 11\n '&:focus::-ms-input-placeholder': placeholderVisible // Edge\n\n },\n '&$disabled': {\n opacity: 1 // Reset iOS opacity\n\n },\n '&:-webkit-autofill': {\n animationDuration: '5000s',\n animationName: 'mui-auto-fill'\n }\n },\n\n /* Styles applied to the `input` element if `margin=\"dense\"`. */\n inputMarginDense: {\n paddingTop: 4 - 1\n },\n\n /* Styles applied to the `input` element if `multiline={true}`. */\n inputMultiline: {\n height: 'auto',\n resize: 'none',\n padding: 0\n },\n\n /* Styles applied to the `input` element if `type=\"search\"`. */\n inputTypeSearch: {\n // Improve type search style.\n '-moz-appearance': 'textfield',\n '-webkit-appearance': 'textfield'\n },\n\n /* Styles applied to the `input` element if `startAdornment` is provided. */\n inputAdornedStart: {},\n\n /* Styles applied to the `input` element if `endAdornment` is provided. */\n inputAdornedEnd: {},\n\n /* Styles applied to the `input` element if `hiddenLabel={true}`. */\n inputHiddenLabel: {}\n };\n};\nvar useEnhancedEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;\n/**\n * `InputBase` contains as few styles as possible.\n * It aims to be a simple building block for creating an input.\n * It contains a load of style reset and some state logic.\n */\n\nvar InputBase = /*#__PURE__*/React.forwardRef(function InputBase(props, ref) {\n var ariaDescribedby = props['aria-describedby'],\n autoComplete = props.autoComplete,\n autoFocus = props.autoFocus,\n classes = props.classes,\n className = props.className,\n color = props.color,\n defaultValue = props.defaultValue,\n disabled = props.disabled,\n endAdornment = props.endAdornment,\n error = props.error,\n _props$fullWidth = props.fullWidth,\n fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,\n id = props.id,\n _props$inputComponent = props.inputComponent,\n inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,\n _props$inputProps = props.inputProps,\n inputPropsProp = _props$inputProps === void 0 ? {} : _props$inputProps,\n inputRefProp = props.inputRef,\n margin = props.margin,\n _props$multiline = props.multiline,\n multiline = _props$multiline === void 0 ? false : _props$multiline,\n name = props.name,\n onBlur = props.onBlur,\n onChange = props.onChange,\n onClick = props.onClick,\n onFocus = props.onFocus,\n onKeyDown = props.onKeyDown,\n onKeyUp = props.onKeyUp,\n placeholder = props.placeholder,\n readOnly = props.readOnly,\n renderSuffix = props.renderSuffix,\n rows = props.rows,\n rowsMax = props.rowsMax,\n rowsMin = props.rowsMin,\n maxRows = props.maxRows,\n minRows = props.minRows,\n startAdornment = props.startAdornment,\n _props$type = props.type,\n type = _props$type === void 0 ? 'text' : _props$type,\n valueProp = props.value,\n other = _objectWithoutProperties(props, [\"aria-describedby\", \"autoComplete\", \"autoFocus\", \"classes\", \"className\", \"color\", \"defaultValue\", \"disabled\", \"endAdornment\", \"error\", \"fullWidth\", \"id\", \"inputComponent\", \"inputProps\", \"inputRef\", \"margin\", \"multiline\", \"name\", \"onBlur\", \"onChange\", \"onClick\", \"onFocus\", \"onKeyDown\", \"onKeyUp\", \"placeholder\", \"readOnly\", \"renderSuffix\", \"rows\", \"rowsMax\", \"rowsMin\", \"maxRows\", \"minRows\", \"startAdornment\", \"type\", \"value\"]);\n\n var value = inputPropsProp.value != null ? inputPropsProp.value : valueProp;\n\n var _React$useRef = React.useRef(value != null),\n isControlled = _React$useRef.current;\n\n var inputRef = React.useRef();\n var handleInputRefWarning = React.useCallback(function (instance) {\n if (process.env.NODE_ENV !== 'production') {\n if (instance && instance.nodeName !== 'INPUT' && !instance.focus) {\n console.error(['Material-UI: You have provided a `inputComponent` to the input component', 'that does not correctly handle the `inputRef` prop.', 'Make sure the `inputRef` prop is called with a HTMLInputElement.'].join('\\n'));\n }\n }\n }, []);\n var handleInputPropsRefProp = useForkRef(inputPropsProp.ref, handleInputRefWarning);\n var handleInputRefProp = useForkRef(inputRefProp, handleInputPropsRefProp);\n var handleInputRef = useForkRef(inputRef, handleInputRefProp);\n\n var _React$useState = React.useState(false),\n focused = _React$useState[0],\n setFocused = _React$useState[1];\n\n var muiFormControl = useFormControl();\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(function () {\n if (muiFormControl) {\n return muiFormControl.registerEffect();\n }\n\n return undefined;\n }, [muiFormControl]);\n }\n\n var fcs = formControlState({\n props: props,\n muiFormControl: muiFormControl,\n states: ['color', 'disabled', 'error', 'hiddenLabel', 'margin', 'required', 'filled']\n });\n fcs.focused = muiFormControl ? muiFormControl.focused : focused; // The blur won't fire when the disabled state is set on a focused input.\n // We need to book keep the focused state manually.\n\n React.useEffect(function () {\n if (!muiFormControl && disabled && focused) {\n setFocused(false);\n\n if (onBlur) {\n onBlur();\n }\n }\n }, [muiFormControl, disabled, focused, onBlur]);\n var onFilled = muiFormControl && muiFormControl.onFilled;\n var onEmpty = muiFormControl && muiFormControl.onEmpty;\n var checkDirty = React.useCallback(function (obj) {\n if (isFilled(obj)) {\n if (onFilled) {\n onFilled();\n }\n } else if (onEmpty) {\n onEmpty();\n }\n }, [onFilled, onEmpty]);\n useEnhancedEffect(function () {\n if (isControlled) {\n checkDirty({\n value: value\n });\n }\n }, [value, checkDirty, isControlled]);\n\n var handleFocus = function handleFocus(event) {\n // Fix a bug with IE 11 where the focus/blur events are triggered\n // while the input is disabled.\n if (fcs.disabled) {\n event.stopPropagation();\n return;\n }\n\n if (onFocus) {\n onFocus(event);\n }\n\n if (inputPropsProp.onFocus) {\n inputPropsProp.onFocus(event);\n }\n\n if (muiFormControl && muiFormControl.onFocus) {\n muiFormControl.onFocus(event);\n } else {\n setFocused(true);\n }\n };\n\n var handleBlur = function handleBlur(event) {\n if (onBlur) {\n onBlur(event);\n }\n\n if (inputPropsProp.onBlur) {\n inputPropsProp.onBlur(event);\n }\n\n if (muiFormControl && muiFormControl.onBlur) {\n muiFormControl.onBlur(event);\n } else {\n setFocused(false);\n }\n };\n\n var handleChange = function handleChange(event) {\n if (!isControlled) {\n var element = event.target || inputRef.current;\n\n if (element == null) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? \"Material-UI: Expected valid input target. Did you use a custom `inputComponent` and forget to forward refs? See https://material-ui.com/r/input-component-ref-interface for more info.\" : _formatMuiErrorMessage(1));\n }\n\n checkDirty({\n value: element.value\n });\n }\n\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n if (inputPropsProp.onChange) {\n inputPropsProp.onChange.apply(inputPropsProp, [event].concat(args));\n } // Perform in the willUpdate\n\n\n if (onChange) {\n onChange.apply(void 0, [event].concat(args));\n }\n }; // Check the input state on mount, in case it was filled by the user\n // or auto filled by the browser before the hydration (for SSR).\n\n\n React.useEffect(function () {\n checkDirty(inputRef.current);\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n var handleClick = function handleClick(event) {\n if (inputRef.current && event.currentTarget === event.target) {\n inputRef.current.focus();\n }\n\n if (onClick) {\n onClick(event);\n }\n };\n\n var InputComponent = inputComponent;\n\n var inputProps = _extends({}, inputPropsProp, {\n ref: handleInputRef\n });\n\n if (typeof InputComponent !== 'string') {\n inputProps = _extends({\n // Rename ref to inputRef as we don't know the\n // provided `inputComponent` structure.\n inputRef: handleInputRef,\n type: type\n }, inputProps, {\n ref: null\n });\n } else if (multiline) {\n if (rows && !maxRows && !minRows && !rowsMax && !rowsMin) {\n InputComponent = 'textarea';\n } else {\n inputProps = _extends({\n minRows: rows || minRows,\n rowsMax: rowsMax,\n maxRows: maxRows\n }, inputProps);\n InputComponent = TextareaAutosize;\n }\n } else {\n inputProps = _extends({\n type: type\n }, inputProps);\n }\n\n var handleAutoFill = function handleAutoFill(event) {\n // Provide a fake value as Chrome might not let you access it for security reasons.\n checkDirty(event.animationName === 'mui-auto-fill-cancel' ? inputRef.current : {\n value: 'x'\n });\n };\n\n React.useEffect(function () {\n if (muiFormControl) {\n muiFormControl.setAdornedStart(Boolean(startAdornment));\n }\n }, [muiFormControl, startAdornment]);\n return /*#__PURE__*/React.createElement(\"div\", _extends({\n className: clsx(classes.root, classes[\"color\".concat(capitalize(fcs.color || 'primary'))], className, fcs.disabled && classes.disabled, fcs.error && classes.error, fullWidth && classes.fullWidth, fcs.focused && classes.focused, muiFormControl && classes.formControl, multiline && classes.multiline, startAdornment && classes.adornedStart, endAdornment && classes.adornedEnd, fcs.margin === 'dense' && classes.marginDense),\n onClick: handleClick,\n ref: ref\n }, other), startAdornment, /*#__PURE__*/React.createElement(FormControlContext.Provider, {\n value: null\n }, /*#__PURE__*/React.createElement(InputComponent, _extends({\n \"aria-invalid\": fcs.error,\n \"aria-describedby\": ariaDescribedby,\n autoComplete: autoComplete,\n autoFocus: autoFocus,\n defaultValue: defaultValue,\n disabled: fcs.disabled,\n id: id,\n onAnimationStart: handleAutoFill,\n name: name,\n placeholder: placeholder,\n readOnly: readOnly,\n required: fcs.required,\n rows: rows,\n value: value,\n onKeyDown: onKeyDown,\n onKeyUp: onKeyUp\n }, inputProps, {\n className: clsx(classes.input, inputPropsProp.className, fcs.disabled && classes.disabled, multiline && classes.inputMultiline, fcs.hiddenLabel && classes.inputHiddenLabel, startAdornment && classes.inputAdornedStart, endAdornment && classes.inputAdornedEnd, type === 'search' && classes.inputTypeSearch, fcs.margin === 'dense' && classes.inputMarginDense),\n onBlur: handleBlur,\n onChange: handleChange,\n onFocus: handleFocus\n }))), endAdornment, renderSuffix ? renderSuffix(_extends({}, fcs, {\n startAdornment: startAdornment\n })) : null);\n});\nprocess.env.NODE_ENV !== \"production\" ? InputBase.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * @ignore\n */\n 'aria-describedby': PropTypes.string,\n\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoComplete: PropTypes.string,\n\n /**\n * If `true`, the `input` element will be focused during the first mount.\n */\n autoFocus: PropTypes.bool,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n */\n color: PropTypes.oneOf(['primary', 'secondary']),\n\n /**\n * The default `input` element value. Use when the component is not controlled.\n */\n defaultValue: PropTypes.any,\n\n /**\n * If `true`, the `input` element will be disabled.\n */\n disabled: PropTypes.bool,\n\n /**\n * End `InputAdornment` for this component.\n */\n endAdornment: PropTypes.node,\n\n /**\n * If `true`, the input will indicate an error. This is normally obtained via context from\n * FormControl.\n */\n error: PropTypes.bool,\n\n /**\n * If `true`, the input will take up the full width of its container.\n */\n fullWidth: PropTypes.bool,\n\n /**\n * The id of the `input` element.\n */\n id: PropTypes.string,\n\n /**\n * The component used for the `input` element.\n * Either a string to use a HTML element or a component.\n */\n inputComponent: PropTypes.elementType,\n\n /**\n * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.\n */\n inputProps: PropTypes.object,\n\n /**\n * Pass a ref to the `input` element.\n */\n inputRef: refType,\n\n /**\n * If `dense`, will adjust vertical spacing. This is normally obtained via context from\n * FormControl.\n */\n margin: PropTypes.oneOf(['dense', 'none']),\n\n /**\n * Maximum number of rows to display when multiline option is set to true.\n */\n maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Minimum number of rows to display when multiline option is set to true.\n */\n minRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * If `true`, a textarea element will be rendered.\n */\n multiline: PropTypes.bool,\n\n /**\n * Name attribute of the `input` element.\n */\n name: PropTypes.string,\n\n /**\n * Callback fired when the input is blurred.\n *\n * Notice that the first argument (event) might be undefined.\n */\n onBlur: PropTypes.func,\n\n /**\n * Callback fired when the value is changed.\n *\n * @param {object} event The event source of the callback.\n * You can pull out the new value by accessing `event.target.value` (string).\n */\n onChange: PropTypes.func,\n\n /**\n * @ignore\n */\n onClick: PropTypes.func,\n\n /**\n * @ignore\n */\n onFocus: PropTypes.func,\n\n /**\n * @ignore\n */\n onKeyDown: PropTypes.func,\n\n /**\n * @ignore\n */\n onKeyUp: PropTypes.func,\n\n /**\n * The short hint displayed in the input before the user enters a value.\n */\n placeholder: PropTypes.string,\n\n /**\n * It prevents the user from changing the value of the field\n * (not from interacting with the field).\n */\n readOnly: PropTypes.bool,\n\n /**\n * @ignore\n */\n renderSuffix: PropTypes.func,\n\n /**\n * If `true`, the `input` element will be required.\n */\n required: PropTypes.bool,\n\n /**\n * Number of rows to display when multiline option is set to true.\n */\n rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Maximum number of rows to display.\n * @deprecated Use `maxRows` instead.\n */\n rowsMax: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Minimum number of rows to display.\n * @deprecated Use `minRows` instead.\n */\n rowsMin: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Start `InputAdornment` for this component.\n */\n startAdornment: PropTypes.node,\n\n /**\n * Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).\n */\n type: PropTypes.string,\n\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value: PropTypes.any\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiInputBase'\n})(InputBase);","export default function formControlState(_ref) {\n var props = _ref.props,\n states = _ref.states,\n muiFormControl = _ref.muiFormControl;\n return states.reduce(function (acc, state) {\n acc[state] = props[state];\n\n if (muiFormControl) {\n if (typeof props[state] === 'undefined') {\n acc[state] = muiFormControl[state];\n }\n }\n\n return acc;\n }, {});\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { refType } from '@material-ui/utils';\nimport InputBase from '../InputBase';\nimport withStyles from '../styles/withStyles';\nexport var styles = function styles(theme) {\n var light = theme.palette.type === 'light';\n var bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';\n return {\n /* Styles applied to the root element. */\n root: {\n position: 'relative'\n },\n\n /* Styles applied to the root element if the component is a descendant of `FormControl`. */\n formControl: {\n 'label + &': {\n marginTop: 16\n }\n },\n\n /* Styles applied to the root element if the component is focused. */\n focused: {},\n\n /* Styles applied to the root element if `disabled={true}`. */\n disabled: {},\n\n /* Styles applied to the root element if color secondary. */\n colorSecondary: {\n '&$underline:after': {\n borderBottomColor: theme.palette.secondary.main\n }\n },\n\n /* Styles applied to the root element if `disableUnderline={false}`. */\n underline: {\n '&:after': {\n borderBottom: \"2px solid \".concat(theme.palette.primary.main),\n left: 0,\n bottom: 0,\n // Doing the other way around crash on IE 11 \"''\" https://github.com/cssinjs/jss/issues/242\n content: '\"\"',\n position: 'absolute',\n right: 0,\n transform: 'scaleX(0)',\n transition: theme.transitions.create('transform', {\n duration: theme.transitions.duration.shorter,\n easing: theme.transitions.easing.easeOut\n }),\n pointerEvents: 'none' // Transparent to the hover style.\n\n },\n '&$focused:after': {\n transform: 'scaleX(1)'\n },\n '&$error:after': {\n borderBottomColor: theme.palette.error.main,\n transform: 'scaleX(1)' // error is always underlined in red\n\n },\n '&:before': {\n borderBottom: \"1px solid \".concat(bottomLineColor),\n left: 0,\n bottom: 0,\n // Doing the other way around crash on IE 11 \"''\" https://github.com/cssinjs/jss/issues/242\n content: '\"\\\\00a0\"',\n position: 'absolute',\n right: 0,\n transition: theme.transitions.create('border-bottom-color', {\n duration: theme.transitions.duration.shorter\n }),\n pointerEvents: 'none' // Transparent to the hover style.\n\n },\n '&:hover:not($disabled):before': {\n borderBottom: \"2px solid \".concat(theme.palette.text.primary),\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n borderBottom: \"1px solid \".concat(bottomLineColor)\n }\n },\n '&$disabled:before': {\n borderBottomStyle: 'dotted'\n }\n },\n\n /* Pseudo-class applied to the root element if `error={true}`. */\n error: {},\n\n /* Styles applied to the `input` element if `margin=\"dense\"`. */\n marginDense: {},\n\n /* Styles applied to the root element if `multiline={true}`. */\n multiline: {},\n\n /* Styles applied to the root element if `fullWidth={true}`. */\n fullWidth: {},\n\n /* Styles applied to the `input` element. */\n input: {},\n\n /* Styles applied to the `input` element if `margin=\"dense\"`. */\n inputMarginDense: {},\n\n /* Styles applied to the `input` element if `multiline={true}`. */\n inputMultiline: {},\n\n /* Styles applied to the `input` element if `type=\"search\"`. */\n inputTypeSearch: {}\n };\n};\nvar Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {\n var disableUnderline = props.disableUnderline,\n classes = props.classes,\n _props$fullWidth = props.fullWidth,\n fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,\n _props$inputComponent = props.inputComponent,\n inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,\n _props$multiline = props.multiline,\n multiline = _props$multiline === void 0 ? false : _props$multiline,\n _props$type = props.type,\n type = _props$type === void 0 ? 'text' : _props$type,\n other = _objectWithoutProperties(props, [\"disableUnderline\", \"classes\", \"fullWidth\", \"inputComponent\", \"multiline\", \"type\"]);\n\n return /*#__PURE__*/React.createElement(InputBase, _extends({\n classes: _extends({}, classes, {\n root: clsx(classes.root, !disableUnderline && classes.underline),\n underline: null\n }),\n fullWidth: fullWidth,\n inputComponent: inputComponent,\n multiline: multiline,\n ref: ref,\n type: type\n }, other));\n});\nprocess.env.NODE_ENV !== \"production\" ? Input.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoComplete: PropTypes.string,\n\n /**\n * If `true`, the `input` element will be focused during the first mount.\n */\n autoFocus: PropTypes.bool,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n */\n color: PropTypes.oneOf(['primary', 'secondary']),\n\n /**\n * The default `input` element value. Use when the component is not controlled.\n */\n defaultValue: PropTypes.any,\n\n /**\n * If `true`, the `input` element will be disabled.\n */\n disabled: PropTypes.bool,\n\n /**\n * If `true`, the input will not have an underline.\n */\n disableUnderline: PropTypes.bool,\n\n /**\n * End `InputAdornment` for this component.\n */\n endAdornment: PropTypes.node,\n\n /**\n * If `true`, the input will indicate an error. This is normally obtained via context from\n * FormControl.\n */\n error: PropTypes.bool,\n\n /**\n * If `true`, the input will take up the full width of its container.\n */\n fullWidth: PropTypes.bool,\n\n /**\n * The id of the `input` element.\n */\n id: PropTypes.string,\n\n /**\n * The component used for the `input` element.\n * Either a string to use a HTML element or a component.\n */\n inputComponent: PropTypes.elementType,\n\n /**\n * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.\n */\n inputProps: PropTypes.object,\n\n /**\n * Pass a ref to the `input` element.\n */\n inputRef: refType,\n\n /**\n * If `dense`, will adjust vertical spacing. This is normally obtained via context from\n * FormControl.\n */\n margin: PropTypes.oneOf(['dense', 'none']),\n\n /**\n * Maximum number of rows to display when multiline option is set to true.\n */\n maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * If `true`, a textarea element will be rendered.\n */\n multiline: PropTypes.bool,\n\n /**\n * Name attribute of the `input` element.\n */\n name: PropTypes.string,\n\n /**\n * Callback fired when the value is changed.\n *\n * @param {object} event The event source of the callback.\n * You can pull out the new value by accessing `event.target.value` (string).\n */\n onChange: PropTypes.func,\n\n /**\n * The short hint displayed in the input before the user enters a value.\n */\n placeholder: PropTypes.string,\n\n /**\n * It prevents the user from changing the value of the field\n * (not from interacting with the field).\n */\n readOnly: PropTypes.bool,\n\n /**\n * If `true`, the `input` element will be required.\n */\n required: PropTypes.bool,\n\n /**\n * Number of rows to display when multiline option is set to true.\n */\n rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Start `InputAdornment` for this component.\n */\n startAdornment: PropTypes.node,\n\n /**\n * Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).\n */\n type: PropTypes.string,\n\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value: PropTypes.any\n} : void 0;\nInput.muiName = 'Input';\nexport default withStyles(styles, {\n name: 'MuiInput'\n})(Input);","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport ownerDocument from '../utils/ownerDocument';\nimport useForkRef from '../utils/useForkRef';\nimport useEventCallback from '../utils/useEventCallback';\nimport { elementAcceptingRef, exactProp } from '@material-ui/utils';\n\nfunction mapEventPropToEvent(eventProp) {\n return eventProp.substring(2).toLowerCase();\n}\n\nfunction clickedRootScrollbar(event) {\n return document.documentElement.clientWidth < event.clientX || document.documentElement.clientHeight < event.clientY;\n}\n/**\n * Listen for click events that occur somewhere in the document, outside of the element itself.\n * For instance, if you need to hide a menu when people click anywhere else on your page.\n */\n\n\nfunction ClickAwayListener(props) {\n var children = props.children,\n _props$disableReactTr = props.disableReactTree,\n disableReactTree = _props$disableReactTr === void 0 ? false : _props$disableReactTr,\n _props$mouseEvent = props.mouseEvent,\n mouseEvent = _props$mouseEvent === void 0 ? 'onClick' : _props$mouseEvent,\n onClickAway = props.onClickAway,\n _props$touchEvent = props.touchEvent,\n touchEvent = _props$touchEvent === void 0 ? 'onTouchEnd' : _props$touchEvent;\n var movedRef = React.useRef(false);\n var nodeRef = React.useRef(null);\n var activatedRef = React.useRef(false);\n var syntheticEventRef = React.useRef(false);\n React.useEffect(function () {\n // Ensure that this component is not \"activated\" synchronously.\n // https://github.com/facebook/react/issues/20074\n setTimeout(function () {\n activatedRef.current = true;\n }, 0);\n return function () {\n activatedRef.current = false;\n };\n }, []); // can be removed once we drop support for non ref forwarding class components\n\n var handleOwnRef = React.useCallback(function (instance) {\n // #StrictMode ready\n nodeRef.current = ReactDOM.findDOMNode(instance);\n }, []);\n var handleRef = useForkRef(children.ref, handleOwnRef); // The handler doesn't take event.defaultPrevented into account:\n //\n // event.preventDefault() is meant to stop default behaviours like\n // clicking a checkbox to check it, hitting a button to submit a form,\n // and hitting left arrow to move the cursor in a text input etc.\n // Only special HTML elements have these default behaviors.\n\n var handleClickAway = useEventCallback(function (event) {\n // Given developers can stop the propagation of the synthetic event,\n // we can only be confident with a positive value.\n var insideReactTree = syntheticEventRef.current;\n syntheticEventRef.current = false; // 1. IE 11 support, which trigger the handleClickAway even after the unbind\n // 2. The child might render null.\n // 3. Behave like a blur listener.\n\n if (!activatedRef.current || !nodeRef.current || clickedRootScrollbar(event)) {\n return;\n } // Do not act if user performed touchmove\n\n\n if (movedRef.current) {\n movedRef.current = false;\n return;\n }\n\n var insideDOM; // If not enough, can use https://github.com/DieterHolvoet/event-propagation-path/blob/master/propagationPath.js\n\n if (event.composedPath) {\n insideDOM = event.composedPath().indexOf(nodeRef.current) > -1;\n } else {\n // TODO v6 remove dead logic https://caniuse.com/#search=composedPath.\n var doc = ownerDocument(nodeRef.current);\n insideDOM = !doc.documentElement.contains(event.target) || nodeRef.current.contains(event.target);\n }\n\n if (!insideDOM && (disableReactTree || !insideReactTree)) {\n onClickAway(event);\n }\n }); // Keep track of mouse/touch events that bubbled up through the portal.\n\n var createHandleSynthetic = function createHandleSynthetic(handlerName) {\n return function (event) {\n syntheticEventRef.current = true;\n var childrenPropsHandler = children.props[handlerName];\n\n if (childrenPropsHandler) {\n childrenPropsHandler(event);\n }\n };\n };\n\n var childrenProps = {\n ref: handleRef\n };\n\n if (touchEvent !== false) {\n childrenProps[touchEvent] = createHandleSynthetic(touchEvent);\n }\n\n React.useEffect(function () {\n if (touchEvent !== false) {\n var mappedTouchEvent = mapEventPropToEvent(touchEvent);\n var doc = ownerDocument(nodeRef.current);\n\n var handleTouchMove = function handleTouchMove() {\n movedRef.current = true;\n };\n\n doc.addEventListener(mappedTouchEvent, handleClickAway);\n doc.addEventListener('touchmove', handleTouchMove);\n return function () {\n doc.removeEventListener(mappedTouchEvent, handleClickAway);\n doc.removeEventListener('touchmove', handleTouchMove);\n };\n }\n\n return undefined;\n }, [handleClickAway, touchEvent]);\n\n if (mouseEvent !== false) {\n childrenProps[mouseEvent] = createHandleSynthetic(mouseEvent);\n }\n\n React.useEffect(function () {\n if (mouseEvent !== false) {\n var mappedMouseEvent = mapEventPropToEvent(mouseEvent);\n var doc = ownerDocument(nodeRef.current);\n doc.addEventListener(mappedMouseEvent, handleClickAway);\n return function () {\n doc.removeEventListener(mappedMouseEvent, handleClickAway);\n };\n }\n\n return undefined;\n }, [handleClickAway, mouseEvent]);\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.cloneElement(children, childrenProps));\n}\n\nprocess.env.NODE_ENV !== \"production\" ? ClickAwayListener.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The wrapped element.\n */\n children: elementAcceptingRef.isRequired,\n\n /**\n * If `true`, the React tree is ignored and only the DOM tree is considered.\n * This prop changes how portaled elements are handled.\n */\n disableReactTree: PropTypes.bool,\n\n /**\n * The mouse event to listen to. You can disable the listener by providing `false`.\n */\n mouseEvent: PropTypes.oneOf(['onClick', 'onMouseDown', 'onMouseUp', false]),\n\n /**\n * Callback fired when a \"click away\" event is detected.\n */\n onClickAway: PropTypes.func.isRequired,\n\n /**\n * The touch event to listen to. You can disable the listener by providing `false`.\n */\n touchEvent: PropTypes.oneOf(['onTouchEnd', 'onTouchStart', false])\n} : void 0;\n\nif (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line\n ClickAwayListener['propTypes' + ''] = exactProp(ClickAwayListener.propTypes);\n}\n\nexport default ClickAwayListener;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { Transition } from 'react-transition-group';\nimport useTheme from '../styles/useTheme';\nimport { reflow, getTransitionProps } from '../transitions/utils';\nimport useForkRef from '../utils/useForkRef';\n\nfunction getScale(value) {\n return \"scale(\".concat(value, \", \").concat(Math.pow(value, 2), \")\");\n}\n\nvar styles = {\n entering: {\n opacity: 1,\n transform: getScale(1)\n },\n entered: {\n opacity: 1,\n transform: 'none'\n }\n};\n/**\n * The Grow transition is used by the [Tooltip](/components/tooltips/) and\n * [Popover](/components/popover/) components.\n * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.\n */\n\nvar Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {\n var children = props.children,\n _props$disableStrictM = props.disableStrictModeCompat,\n disableStrictModeCompat = _props$disableStrictM === void 0 ? false : _props$disableStrictM,\n inProp = props.in,\n onEnter = props.onEnter,\n onEntered = props.onEntered,\n onEntering = props.onEntering,\n onExit = props.onExit,\n onExited = props.onExited,\n onExiting = props.onExiting,\n style = props.style,\n _props$timeout = props.timeout,\n timeout = _props$timeout === void 0 ? 'auto' : _props$timeout,\n _props$TransitionComp = props.TransitionComponent,\n TransitionComponent = _props$TransitionComp === void 0 ? Transition : _props$TransitionComp,\n other = _objectWithoutProperties(props, [\"children\", \"disableStrictModeCompat\", \"in\", \"onEnter\", \"onEntered\", \"onEntering\", \"onExit\", \"onExited\", \"onExiting\", \"style\", \"timeout\", \"TransitionComponent\"]);\n\n var timer = React.useRef();\n var autoTimeout = React.useRef();\n var theme = useTheme();\n var enableStrictModeCompat = theme.unstable_strictMode && !disableStrictModeCompat;\n var nodeRef = React.useRef(null);\n var foreignRef = useForkRef(children.ref, ref);\n var handleRef = useForkRef(enableStrictModeCompat ? nodeRef : undefined, foreignRef);\n\n var normalizedTransitionCallback = function normalizedTransitionCallback(callback) {\n return function (nodeOrAppearing, maybeAppearing) {\n if (callback) {\n var _ref = enableStrictModeCompat ? [nodeRef.current, nodeOrAppearing] : [nodeOrAppearing, maybeAppearing],\n _ref2 = _slicedToArray(_ref, 2),\n node = _ref2[0],\n isAppearing = _ref2[1]; // onEnterXxx and onExitXxx callbacks have a different arguments.length value.\n\n\n if (isAppearing === undefined) {\n callback(node);\n } else {\n callback(node, isAppearing);\n }\n }\n };\n };\n\n var handleEntering = normalizedTransitionCallback(onEntering);\n var handleEnter = normalizedTransitionCallback(function (node, isAppearing) {\n reflow(node); // So the animation always start from the start.\n\n var _getTransitionProps = getTransitionProps({\n style: style,\n timeout: timeout\n }, {\n mode: 'enter'\n }),\n transitionDuration = _getTransitionProps.duration,\n delay = _getTransitionProps.delay;\n\n var duration;\n\n if (timeout === 'auto') {\n duration = theme.transitions.getAutoHeightDuration(node.clientHeight);\n autoTimeout.current = duration;\n } else {\n duration = transitionDuration;\n }\n\n node.style.transition = [theme.transitions.create('opacity', {\n duration: duration,\n delay: delay\n }), theme.transitions.create('transform', {\n duration: duration * 0.666,\n delay: delay\n })].join(',');\n\n if (onEnter) {\n onEnter(node, isAppearing);\n }\n });\n var handleEntered = normalizedTransitionCallback(onEntered);\n var handleExiting = normalizedTransitionCallback(onExiting);\n var handleExit = normalizedTransitionCallback(function (node) {\n var _getTransitionProps2 = getTransitionProps({\n style: style,\n timeout: timeout\n }, {\n mode: 'exit'\n }),\n transitionDuration = _getTransitionProps2.duration,\n delay = _getTransitionProps2.delay;\n\n var duration;\n\n if (timeout === 'auto') {\n duration = theme.transitions.getAutoHeightDuration(node.clientHeight);\n autoTimeout.current = duration;\n } else {\n duration = transitionDuration;\n }\n\n node.style.transition = [theme.transitions.create('opacity', {\n duration: duration,\n delay: delay\n }), theme.transitions.create('transform', {\n duration: duration * 0.666,\n delay: delay || duration * 0.333\n })].join(',');\n node.style.opacity = '0';\n node.style.transform = getScale(0.75);\n\n if (onExit) {\n onExit(node);\n }\n });\n var handleExited = normalizedTransitionCallback(onExited);\n\n var addEndListener = function addEndListener(nodeOrNext, maybeNext) {\n var next = enableStrictModeCompat ? nodeOrNext : maybeNext;\n\n if (timeout === 'auto') {\n timer.current = setTimeout(next, autoTimeout.current || 0);\n }\n };\n\n React.useEffect(function () {\n return function () {\n clearTimeout(timer.current);\n };\n }, []);\n return /*#__PURE__*/React.createElement(TransitionComponent, _extends({\n appear: true,\n in: inProp,\n nodeRef: enableStrictModeCompat ? nodeRef : undefined,\n onEnter: handleEnter,\n onEntered: handleEntered,\n onEntering: handleEntering,\n onExit: handleExit,\n onExited: handleExited,\n onExiting: handleExiting,\n addEndListener: addEndListener,\n timeout: timeout === 'auto' ? null : timeout\n }, other), function (state, childProps) {\n return /*#__PURE__*/React.cloneElement(children, _extends({\n style: _extends({\n opacity: 0,\n transform: getScale(0.75),\n visibility: state === 'exited' && !inProp ? 'hidden' : undefined\n }, styles[state], style, children.props.style),\n ref: handleRef\n }, childProps));\n });\n});\nprocess.env.NODE_ENV !== \"production\" ? Grow.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * A single child content element.\n */\n children: PropTypes.element,\n\n /**\n * Enable this prop if you encounter 'Function components cannot be given refs',\n * use `unstable_createStrictModeTheme`,\n * and can't forward the ref in the child component.\n */\n disableStrictModeCompat: PropTypes.bool,\n\n /**\n * If `true`, show the component; triggers the enter or exit animation.\n */\n in: PropTypes.bool,\n\n /**\n * @ignore\n */\n onEnter: PropTypes.func,\n\n /**\n * @ignore\n */\n onEntered: PropTypes.func,\n\n /**\n * @ignore\n */\n onEntering: PropTypes.func,\n\n /**\n * @ignore\n */\n onExit: PropTypes.func,\n\n /**\n * @ignore\n */\n onExited: PropTypes.func,\n\n /**\n * @ignore\n */\n onExiting: PropTypes.func,\n\n /**\n * @ignore\n */\n style: PropTypes.object,\n\n /**\n * The duration for the transition, in milliseconds.\n * You may specify a single timeout for all transitions, or individually with an object.\n *\n * Set to 'auto' to automatically calculate transition time based on height.\n */\n timeout: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.shape({\n appear: PropTypes.number,\n enter: PropTypes.number,\n exit: PropTypes.number\n })])\n} : void 0;\nGrow.muiSupportAuto = true;\nexport default Grow;","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nimport Paper from '../Paper';\nimport { emphasize } from '../styles/colorManipulator';\nexport var styles = function styles(theme) {\n var emphasis = theme.palette.type === 'light' ? 0.8 : 0.98;\n var backgroundColor = emphasize(theme.palette.background.default, emphasis);\n return {\n /* Styles applied to the root element. */\n root: _extends({}, theme.typography.body2, _defineProperty({\n color: theme.palette.getContrastText(backgroundColor),\n backgroundColor: backgroundColor,\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n padding: '6px 16px',\n borderRadius: theme.shape.borderRadius,\n flexGrow: 1\n }, theme.breakpoints.up('sm'), {\n flexGrow: 'initial',\n minWidth: 288\n })),\n\n /* Styles applied to the message wrapper element. */\n message: {\n padding: '8px 0'\n },\n\n /* Styles applied to the action wrapper element if `action` is provided. */\n action: {\n display: 'flex',\n alignItems: 'center',\n marginLeft: 'auto',\n paddingLeft: 16,\n marginRight: -8\n }\n };\n};\nvar SnackbarContent = /*#__PURE__*/React.forwardRef(function SnackbarContent(props, ref) {\n var action = props.action,\n classes = props.classes,\n className = props.className,\n message = props.message,\n _props$role = props.role,\n role = _props$role === void 0 ? 'alert' : _props$role,\n other = _objectWithoutProperties(props, [\"action\", \"classes\", \"className\", \"message\", \"role\"]);\n\n return /*#__PURE__*/React.createElement(Paper, _extends({\n role: role,\n square: true,\n elevation: 6,\n className: clsx(classes.root, className),\n ref: ref\n }, other), /*#__PURE__*/React.createElement(\"div\", {\n className: classes.message\n }, message), action ? /*#__PURE__*/React.createElement(\"div\", {\n className: classes.action\n }, action) : null);\n});\nprocess.env.NODE_ENV !== \"production\" ? SnackbarContent.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The action to display. It renders after the message, at the end of the snackbar.\n */\n action: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The message to display.\n */\n message: PropTypes.node,\n\n /**\n * The ARIA role attribute of the element.\n */\n role: PropTypes.string\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiSnackbarContent'\n})(SnackbarContent);","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nimport { duration } from '../styles/transitions';\nimport ClickAwayListener from '../ClickAwayListener';\nimport useEventCallback from '../utils/useEventCallback';\nimport capitalize from '../utils/capitalize';\nimport createChainedFunction from '../utils/createChainedFunction';\nimport deprecatedPropType from '../utils/deprecatedPropType';\nimport Grow from '../Grow';\nimport SnackbarContent from '../SnackbarContent';\nexport var styles = function styles(theme) {\n var top1 = {\n top: 8\n };\n var bottom1 = {\n bottom: 8\n };\n var right = {\n justifyContent: 'flex-end'\n };\n var left = {\n justifyContent: 'flex-start'\n };\n var top3 = {\n top: 24\n };\n var bottom3 = {\n bottom: 24\n };\n var right3 = {\n right: 24\n };\n var left3 = {\n left: 24\n };\n var center = {\n left: '50%',\n right: 'auto',\n transform: 'translateX(-50%)'\n };\n return {\n /* Styles applied to the root element. */\n root: {\n zIndex: theme.zIndex.snackbar,\n position: 'fixed',\n display: 'flex',\n left: 8,\n right: 8,\n justifyContent: 'center',\n alignItems: 'center'\n },\n\n /* Styles applied to the root element if `anchorOrigin={{ 'top', 'center' }}`. */\n anchorOriginTopCenter: _extends({}, top1, _defineProperty({}, theme.breakpoints.up('sm'), _extends({}, top3, center))),\n\n /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'center' }}`. */\n anchorOriginBottomCenter: _extends({}, bottom1, _defineProperty({}, theme.breakpoints.up('sm'), _extends({}, bottom3, center))),\n\n /* Styles applied to the root element if `anchorOrigin={{ 'top', 'right' }}`. */\n anchorOriginTopRight: _extends({}, top1, right, _defineProperty({}, theme.breakpoints.up('sm'), _extends({\n left: 'auto'\n }, top3, right3))),\n\n /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'right' }}`. */\n anchorOriginBottomRight: _extends({}, bottom1, right, _defineProperty({}, theme.breakpoints.up('sm'), _extends({\n left: 'auto'\n }, bottom3, right3))),\n\n /* Styles applied to the root element if `anchorOrigin={{ 'top', 'left' }}`. */\n anchorOriginTopLeft: _extends({}, top1, left, _defineProperty({}, theme.breakpoints.up('sm'), _extends({\n right: 'auto'\n }, top3, left3))),\n\n /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'left' }}`. */\n anchorOriginBottomLeft: _extends({}, bottom1, left, _defineProperty({}, theme.breakpoints.up('sm'), _extends({\n right: 'auto'\n }, bottom3, left3)))\n };\n};\nvar Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(props, ref) {\n var action = props.action,\n _props$anchorOrigin = props.anchorOrigin;\n _props$anchorOrigin = _props$anchorOrigin === void 0 ? {\n vertical: 'bottom',\n horizontal: 'center'\n } : _props$anchorOrigin;\n\n var vertical = _props$anchorOrigin.vertical,\n horizontal = _props$anchorOrigin.horizontal,\n _props$autoHideDurati = props.autoHideDuration,\n autoHideDuration = _props$autoHideDurati === void 0 ? null : _props$autoHideDurati,\n children = props.children,\n classes = props.classes,\n className = props.className,\n ClickAwayListenerProps = props.ClickAwayListenerProps,\n ContentProps = props.ContentProps,\n _props$disableWindowB = props.disableWindowBlurListener,\n disableWindowBlurListener = _props$disableWindowB === void 0 ? false : _props$disableWindowB,\n message = props.message,\n onClose = props.onClose,\n onEnter = props.onEnter,\n onEntered = props.onEntered,\n onEntering = props.onEntering,\n onExit = props.onExit,\n onExited = props.onExited,\n onExiting = props.onExiting,\n onMouseEnter = props.onMouseEnter,\n onMouseLeave = props.onMouseLeave,\n open = props.open,\n resumeHideDuration = props.resumeHideDuration,\n _props$TransitionComp = props.TransitionComponent,\n TransitionComponent = _props$TransitionComp === void 0 ? Grow : _props$TransitionComp,\n _props$transitionDura = props.transitionDuration,\n transitionDuration = _props$transitionDura === void 0 ? {\n enter: duration.enteringScreen,\n exit: duration.leavingScreen\n } : _props$transitionDura,\n TransitionProps = props.TransitionProps,\n other = _objectWithoutProperties(props, [\"action\", \"anchorOrigin\", \"autoHideDuration\", \"children\", \"classes\", \"className\", \"ClickAwayListenerProps\", \"ContentProps\", \"disableWindowBlurListener\", \"message\", \"onClose\", \"onEnter\", \"onEntered\", \"onEntering\", \"onExit\", \"onExited\", \"onExiting\", \"onMouseEnter\", \"onMouseLeave\", \"open\", \"resumeHideDuration\", \"TransitionComponent\", \"transitionDuration\", \"TransitionProps\"]);\n\n var timerAutoHide = React.useRef();\n\n var _React$useState = React.useState(true),\n exited = _React$useState[0],\n setExited = _React$useState[1];\n\n var handleClose = useEventCallback(function () {\n if (onClose) {\n onClose.apply(void 0, arguments);\n }\n });\n var setAutoHideTimer = useEventCallback(function (autoHideDurationParam) {\n if (!onClose || autoHideDurationParam == null) {\n return;\n }\n\n clearTimeout(timerAutoHide.current);\n timerAutoHide.current = setTimeout(function () {\n handleClose(null, 'timeout');\n }, autoHideDurationParam);\n });\n React.useEffect(function () {\n if (open) {\n setAutoHideTimer(autoHideDuration);\n }\n\n return function () {\n clearTimeout(timerAutoHide.current);\n };\n }, [open, autoHideDuration, setAutoHideTimer]); // Pause the timer when the user is interacting with the Snackbar\n // or when the user hide the window.\n\n var handlePause = function handlePause() {\n clearTimeout(timerAutoHide.current);\n }; // Restart the timer when the user is no longer interacting with the Snackbar\n // or when the window is shown back.\n\n\n var handleResume = React.useCallback(function () {\n if (autoHideDuration != null) {\n setAutoHideTimer(resumeHideDuration != null ? resumeHideDuration : autoHideDuration * 0.5);\n }\n }, [autoHideDuration, resumeHideDuration, setAutoHideTimer]);\n\n var handleMouseEnter = function handleMouseEnter(event) {\n if (onMouseEnter) {\n onMouseEnter(event);\n }\n\n handlePause();\n };\n\n var handleMouseLeave = function handleMouseLeave(event) {\n if (onMouseLeave) {\n onMouseLeave(event);\n }\n\n handleResume();\n };\n\n var handleClickAway = function handleClickAway(event) {\n if (onClose) {\n onClose(event, 'clickaway');\n }\n };\n\n var handleExited = function handleExited() {\n setExited(true);\n };\n\n var handleEnter = function handleEnter() {\n setExited(false);\n };\n\n React.useEffect(function () {\n if (!disableWindowBlurListener && open) {\n window.addEventListener('focus', handleResume);\n window.addEventListener('blur', handlePause);\n return function () {\n window.removeEventListener('focus', handleResume);\n window.removeEventListener('blur', handlePause);\n };\n }\n\n return undefined;\n }, [disableWindowBlurListener, handleResume, open]); // So we only render active snackbars.\n\n if (!open && exited) {\n return null;\n }\n\n return /*#__PURE__*/React.createElement(ClickAwayListener, _extends({\n onClickAway: handleClickAway\n }, ClickAwayListenerProps), /*#__PURE__*/React.createElement(\"div\", _extends({\n className: clsx(classes.root, classes[\"anchorOrigin\".concat(capitalize(vertical)).concat(capitalize(horizontal))], className),\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n ref: ref\n }, other), /*#__PURE__*/React.createElement(TransitionComponent, _extends({\n appear: true,\n in: open,\n onEnter: createChainedFunction(handleEnter, onEnter),\n onEntered: onEntered,\n onEntering: onEntering,\n onExit: onExit,\n onExited: createChainedFunction(handleExited, onExited),\n onExiting: onExiting,\n timeout: transitionDuration,\n direction: vertical === 'top' ? 'down' : 'up'\n }, TransitionProps), children || /*#__PURE__*/React.createElement(SnackbarContent, _extends({\n message: message,\n action: action\n }, ContentProps)))));\n});\nprocess.env.NODE_ENV !== \"production\" ? Snackbar.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The action to display. It renders after the message, at the end of the snackbar.\n */\n action: PropTypes.node,\n\n /**\n * The anchor of the `Snackbar`.\n */\n anchorOrigin: PropTypes.shape({\n horizontal: PropTypes.oneOf(['center', 'left', 'right']).isRequired,\n vertical: PropTypes.oneOf(['bottom', 'top']).isRequired\n }),\n\n /**\n * The number of milliseconds to wait before automatically calling the\n * `onClose` function. `onClose` should then set the state of the `open`\n * prop to hide the Snackbar. This behavior is disabled by default with\n * the `null` value.\n */\n autoHideDuration: PropTypes.number,\n\n /**\n * Replace the `SnackbarContent` component.\n */\n children: PropTypes.element,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * Props applied to the `ClickAwayListener` element.\n */\n ClickAwayListenerProps: PropTypes.object,\n\n /**\n * Props applied to the [`SnackbarContent`](/api/snackbar-content/) element.\n */\n ContentProps: PropTypes.object,\n\n /**\n * If `true`, the `autoHideDuration` timer will expire even if the window is not focused.\n */\n disableWindowBlurListener: PropTypes.bool,\n\n /**\n * When displaying multiple consecutive Snackbars from a parent rendering a single\n * , add the key prop to ensure independent treatment of each message.\n * e.g. , otherwise, the message may update-in-place and\n * features such as autoHideDuration may be canceled.\n */\n key: PropTypes.any,\n\n /**\n * The message to display.\n */\n message: PropTypes.node,\n\n /**\n * Callback fired when the component requests to be closed.\n * Typically `onClose` is used to set state in the parent component,\n * which is used to control the `Snackbar` `open` prop.\n * The `reason` parameter can optionally be used to control the response to `onClose`,\n * for example ignoring `clickaway`.\n *\n * @param {object} event The event source of the callback.\n * @param {string} reason Can be: `\"timeout\"` (`autoHideDuration` expired), `\"clickaway\"`.\n */\n onClose: PropTypes.func,\n\n /**\n * Callback fired before the transition is entering.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onEnter: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired when the transition has entered.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onEntered: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired when the transition is entering.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onEntering: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired before the transition is exiting.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onExit: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired when the transition has exited.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onExited: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired when the transition is exiting.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onExiting: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * @ignore\n */\n onMouseEnter: PropTypes.func,\n\n /**\n * @ignore\n */\n onMouseLeave: PropTypes.func,\n\n /**\n * If `true`, `Snackbar` is open.\n */\n open: PropTypes.bool,\n\n /**\n * The number of milliseconds to wait before dismissing after user interaction.\n * If `autoHideDuration` prop isn't specified, it does nothing.\n * If `autoHideDuration` prop is specified but `resumeHideDuration` isn't,\n * we default to `autoHideDuration / 2` ms.\n */\n resumeHideDuration: PropTypes.number,\n\n /**\n * The component used for the transition.\n * [Follow this guide](/components/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.\n */\n TransitionComponent: PropTypes.elementType,\n\n /**\n * The duration for the transition, in milliseconds.\n * You may specify a single timeout for all transitions, or individually with an object.\n */\n transitionDuration: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({\n appear: PropTypes.number,\n enter: PropTypes.number,\n exit: PropTypes.number\n })]),\n\n /**\n * Props applied to the [`Transition`](http://reactcommunity.org/react-transition-group/transition#Transition-props) element.\n */\n TransitionProps: PropTypes.object\n} : void 0;\nexport default withStyles(styles, {\n flip: false,\n name: 'MuiSnackbar'\n})(Snackbar);","import * as React from 'react';\nimport createSvgIcon from '../../utils/createSvgIcon';\n/**\n * @ignore - internal component.\n */\n\nexport default createSvgIcon( /*#__PURE__*/React.createElement(\"path\", {\n d: \"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z\"\n}), 'MoreHoriz');","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport withStyles from '../styles/withStyles';\nimport { emphasize } from '../styles/colorManipulator';\nimport MoreHorizIcon from '../internal/svg-icons/MoreHoriz';\nimport ButtonBase from '../ButtonBase';\n\nvar styles = function styles(theme) {\n return {\n root: {\n display: 'flex',\n marginLeft: theme.spacing(0.5),\n marginRight: theme.spacing(0.5),\n backgroundColor: theme.palette.grey[100],\n color: theme.palette.grey[700],\n borderRadius: 2,\n cursor: 'pointer',\n '&:hover, &:focus': {\n backgroundColor: theme.palette.grey[200]\n },\n '&:active': {\n boxShadow: theme.shadows[0],\n backgroundColor: emphasize(theme.palette.grey[200], 0.12)\n }\n },\n icon: {\n width: 24,\n height: 16\n }\n };\n};\n/**\n * @ignore - internal component.\n */\n\n\nfunction BreadcrumbCollapsed(props) {\n var classes = props.classes,\n other = _objectWithoutProperties(props, [\"classes\"]);\n\n return /*#__PURE__*/React.createElement(ButtonBase, _extends({\n component: \"li\",\n className: classes.root,\n focusRipple: true\n }, other), /*#__PURE__*/React.createElement(MoreHorizIcon, {\n className: classes.icon\n }));\n}\n\nprocess.env.NODE_ENV !== \"production\" ? BreadcrumbCollapsed.propTypes = {\n /**\n * @ignore\n */\n classes: PropTypes.object.isRequired\n} : void 0;\nexport default withStyles(styles, {\n name: 'PrivateBreadcrumbCollapsed'\n})(BreadcrumbCollapsed);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport { isFragment } from 'react-is';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nimport Typography from '../Typography';\nimport BreadcrumbCollapsed from './BreadcrumbCollapsed';\nexport var styles = {\n /* Styles applied to the root element. */\n root: {},\n\n /* Styles applied to the ol element. */\n ol: {\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n padding: 0,\n margin: 0,\n listStyle: 'none'\n },\n\n /* Styles applied to the li element. */\n li: {},\n\n /* Styles applied to the separator element. */\n separator: {\n display: 'flex',\n userSelect: 'none',\n marginLeft: 8,\n marginRight: 8\n }\n};\n\nfunction insertSeparators(items, className, separator) {\n return items.reduce(function (acc, current, index) {\n if (index < items.length - 1) {\n acc = acc.concat(current, /*#__PURE__*/React.createElement(\"li\", {\n \"aria-hidden\": true,\n key: \"separator-\".concat(index),\n className: className\n }, separator));\n } else {\n acc.push(current);\n }\n\n return acc;\n }, []);\n}\n\nvar Breadcrumbs = /*#__PURE__*/React.forwardRef(function Breadcrumbs(props, ref) {\n var children = props.children,\n classes = props.classes,\n className = props.className,\n _props$component = props.component,\n Component = _props$component === void 0 ? 'nav' : _props$component,\n _props$expandText = props.expandText,\n expandText = _props$expandText === void 0 ? 'Show path' : _props$expandText,\n _props$itemsAfterColl = props.itemsAfterCollapse,\n itemsAfterCollapse = _props$itemsAfterColl === void 0 ? 1 : _props$itemsAfterColl,\n _props$itemsBeforeCol = props.itemsBeforeCollapse,\n itemsBeforeCollapse = _props$itemsBeforeCol === void 0 ? 1 : _props$itemsBeforeCol,\n _props$maxItems = props.maxItems,\n maxItems = _props$maxItems === void 0 ? 8 : _props$maxItems,\n _props$separator = props.separator,\n separator = _props$separator === void 0 ? '/' : _props$separator,\n other = _objectWithoutProperties(props, [\"children\", \"classes\", \"className\", \"component\", \"expandText\", \"itemsAfterCollapse\", \"itemsBeforeCollapse\", \"maxItems\", \"separator\"]);\n\n var _React$useState = React.useState(false),\n expanded = _React$useState[0],\n setExpanded = _React$useState[1];\n\n var renderItemsBeforeAndAfter = function renderItemsBeforeAndAfter(allItems) {\n var handleClickExpand = function handleClickExpand(event) {\n setExpanded(true); // The clicked element received the focus but gets removed from the DOM.\n // Let's keep the focus in the component after expanding.\n\n var focusable = event.currentTarget.parentNode.querySelector('a[href],button,[tabindex]');\n\n if (focusable) {\n focusable.focus();\n }\n }; // This defends against someone passing weird input, to ensure that if all\n // items would be shown anyway, we just show all items without the EllipsisItem\n\n\n if (itemsBeforeCollapse + itemsAfterCollapse >= allItems.length) {\n if (process.env.NODE_ENV !== 'production') {\n console.error(['Material-UI: You have provided an invalid combination of props to the Breadcrumbs.', \"itemsAfterCollapse={\".concat(itemsAfterCollapse, \"} + itemsBeforeCollapse={\").concat(itemsBeforeCollapse, \"} >= maxItems={\").concat(maxItems, \"}\")].join('\\n'));\n }\n\n return allItems;\n }\n\n return [].concat(_toConsumableArray(allItems.slice(0, itemsBeforeCollapse)), [/*#__PURE__*/React.createElement(BreadcrumbCollapsed, {\n \"aria-label\": expandText,\n key: \"ellipsis\",\n onClick: handleClickExpand\n })], _toConsumableArray(allItems.slice(allItems.length - itemsAfterCollapse, allItems.length)));\n };\n\n var allItems = React.Children.toArray(children).filter(function (child) {\n if (process.env.NODE_ENV !== 'production') {\n if (isFragment(child)) {\n console.error([\"Material-UI: The Breadcrumbs component doesn't accept a Fragment as a child.\", 'Consider providing an array instead.'].join('\\n'));\n }\n }\n\n return /*#__PURE__*/React.isValidElement(child);\n }).map(function (child, index) {\n return /*#__PURE__*/React.createElement(\"li\", {\n className: classes.li,\n key: \"child-\".concat(index)\n }, child);\n });\n return /*#__PURE__*/React.createElement(Typography, _extends({\n ref: ref,\n component: Component,\n color: \"textSecondary\",\n className: clsx(classes.root, className)\n }, other), /*#__PURE__*/React.createElement(\"ol\", {\n className: classes.ol\n }, insertSeparators(expanded || maxItems && allItems.length <= maxItems ? allItems : renderItemsBeforeAndAfter(allItems), classes.separator, separator)));\n});\nprocess.env.NODE_ENV !== \"production\" ? Breadcrumbs.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The breadcrumb children.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\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\n /* @typescript-to-proptypes-ignore */\n .elementType,\n\n /**\n * Override the default label for the expand button.\n *\n * For localization purposes, you can use the provided [translations](/guides/localization/).\n */\n expandText: PropTypes.string,\n\n /**\n * If max items is exceeded, the number of items to show after the ellipsis.\n */\n itemsAfterCollapse: PropTypes.number,\n\n /**\n * If max items is exceeded, the number of items to show before the ellipsis.\n */\n itemsBeforeCollapse: PropTypes.number,\n\n /**\n * Specifies the maximum number of breadcrumbs to display. When there are more\n * than the maximum number, only the first `itemsBeforeCollapse` and last `itemsAfterCollapse`\n * will be shown, with an ellipsis in between.\n */\n maxItems: PropTypes.number,\n\n /**\n * Custom separator node.\n */\n separator: PropTypes.node\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiBreadcrumbs'\n})(Breadcrumbs);","import * as React from 'react';\nimport createSvgIcon from '../../utils/createSvgIcon';\n/**\n * @ignore - internal component.\n */\n\nexport default createSvgIcon( /*#__PURE__*/React.createElement(\"path\", {\n d: \"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z\"\n}), 'Cancel');","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport CancelIcon from '../internal/svg-icons/Cancel';\nimport withStyles from '../styles/withStyles';\nimport { emphasize, alpha } from '../styles/colorManipulator';\nimport useForkRef from '../utils/useForkRef';\nimport unsupportedProp from '../utils/unsupportedProp';\nimport capitalize from '../utils/capitalize';\nimport ButtonBase from '../ButtonBase';\nexport var styles = function styles(theme) {\n var backgroundColor = theme.palette.type === 'light' ? theme.palette.grey[300] : theme.palette.grey[700];\n var deleteIconColor = alpha(theme.palette.text.primary, 0.26);\n return {\n /* Styles applied to the root element. */\n root: {\n fontFamily: theme.typography.fontFamily,\n fontSize: theme.typography.pxToRem(13),\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n height: 32,\n color: theme.palette.getContrastText(backgroundColor),\n backgroundColor: backgroundColor,\n borderRadius: 32 / 2,\n whiteSpace: 'nowrap',\n transition: theme.transitions.create(['background-color', 'box-shadow']),\n // label will inherit this from root, then `clickable` class overrides this for both\n cursor: 'default',\n // We disable the focus ring for mouse, touch and keyboard users.\n outline: 0,\n textDecoration: 'none',\n border: 'none',\n // Remove `button` border\n padding: 0,\n // Remove `button` padding\n verticalAlign: 'middle',\n boxSizing: 'border-box',\n '&$disabled': {\n opacity: 0.5,\n pointerEvents: 'none'\n },\n '& $avatar': {\n marginLeft: 5,\n marginRight: -6,\n width: 24,\n height: 24,\n color: theme.palette.type === 'light' ? theme.palette.grey[700] : theme.palette.grey[300],\n fontSize: theme.typography.pxToRem(12)\n },\n '& $avatarColorPrimary': {\n color: theme.palette.primary.contrastText,\n backgroundColor: theme.palette.primary.dark\n },\n '& $avatarColorSecondary': {\n color: theme.palette.secondary.contrastText,\n backgroundColor: theme.palette.secondary.dark\n },\n '& $avatarSmall': {\n marginLeft: 4,\n marginRight: -4,\n width: 18,\n height: 18,\n fontSize: theme.typography.pxToRem(10)\n }\n },\n\n /* Styles applied to the root element if `size=\"small\"`. */\n sizeSmall: {\n height: 24\n },\n\n /* Styles applied to the root element if `color=\"primary\"`. */\n colorPrimary: {\n backgroundColor: theme.palette.primary.main,\n color: theme.palette.primary.contrastText\n },\n\n /* Styles applied to the root element if `color=\"secondary\"`. */\n colorSecondary: {\n backgroundColor: theme.palette.secondary.main,\n color: theme.palette.secondary.contrastText\n },\n\n /* Pseudo-class applied to the root element if `disabled={true}`. */\n disabled: {},\n\n /* Styles applied to the root element if `onClick` is defined or `clickable={true}`. */\n clickable: {\n userSelect: 'none',\n WebkitTapHighlightColor: 'transparent',\n cursor: 'pointer',\n '&:hover, &:focus': {\n backgroundColor: emphasize(backgroundColor, 0.08)\n },\n '&:active': {\n boxShadow: theme.shadows[1]\n }\n },\n\n /* Styles applied to the root element if `onClick` and `color=\"primary\"` is defined or `clickable={true}`. */\n clickableColorPrimary: {\n '&:hover, &:focus': {\n backgroundColor: emphasize(theme.palette.primary.main, 0.08)\n }\n },\n\n /* Styles applied to the root element if `onClick` and `color=\"secondary\"` is defined or `clickable={true}`. */\n clickableColorSecondary: {\n '&:hover, &:focus': {\n backgroundColor: emphasize(theme.palette.secondary.main, 0.08)\n }\n },\n\n /* Styles applied to the root element if `onDelete` is defined. */\n deletable: {\n '&:focus': {\n backgroundColor: emphasize(backgroundColor, 0.08)\n }\n },\n\n /* Styles applied to the root element if `onDelete` and `color=\"primary\"` is defined. */\n deletableColorPrimary: {\n '&:focus': {\n backgroundColor: emphasize(theme.palette.primary.main, 0.2)\n }\n },\n\n /* Styles applied to the root element if `onDelete` and `color=\"secondary\"` is defined. */\n deletableColorSecondary: {\n '&:focus': {\n backgroundColor: emphasize(theme.palette.secondary.main, 0.2)\n }\n },\n\n /* Styles applied to the root element if `variant=\"outlined\"`. */\n outlined: {\n backgroundColor: 'transparent',\n border: \"1px solid \".concat(theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'),\n '$clickable&:hover, $clickable&:focus, $deletable&:focus': {\n backgroundColor: alpha(theme.palette.text.primary, theme.palette.action.hoverOpacity)\n },\n '& $avatar': {\n marginLeft: 4\n },\n '& $avatarSmall': {\n marginLeft: 2\n },\n '& $icon': {\n marginLeft: 4\n },\n '& $iconSmall': {\n marginLeft: 2\n },\n '& $deleteIcon': {\n marginRight: 5\n },\n '& $deleteIconSmall': {\n marginRight: 3\n }\n },\n\n /* Styles applied to the root element if `variant=\"outlined\"` and `color=\"primary\"`. */\n outlinedPrimary: {\n color: theme.palette.primary.main,\n border: \"1px solid \".concat(theme.palette.primary.main),\n '$clickable&:hover, $clickable&:focus, $deletable&:focus': {\n backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity)\n }\n },\n\n /* Styles applied to the root element if `variant=\"outlined\"` and `color=\"secondary\"`. */\n outlinedSecondary: {\n color: theme.palette.secondary.main,\n border: \"1px solid \".concat(theme.palette.secondary.main),\n '$clickable&:hover, $clickable&:focus, $deletable&:focus': {\n backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.hoverOpacity)\n }\n },\n // TODO v5: remove\n\n /* Styles applied to the `avatar` element. */\n avatar: {},\n\n /* Styles applied to the `avatar` element if `size=\"small\"`. */\n avatarSmall: {},\n\n /* Styles applied to the `avatar` element if `color=\"primary\"`. */\n avatarColorPrimary: {},\n\n /* Styles applied to the `avatar` element if `color=\"secondary\"`. */\n avatarColorSecondary: {},\n\n /* Styles applied to the `icon` element. */\n icon: {\n color: theme.palette.type === 'light' ? theme.palette.grey[700] : theme.palette.grey[300],\n marginLeft: 5,\n marginRight: -6\n },\n\n /* Styles applied to the `icon` element if `size=\"small\"`. */\n iconSmall: {\n width: 18,\n height: 18,\n marginLeft: 4,\n marginRight: -4\n },\n\n /* Styles applied to the `icon` element if `color=\"primary\"`. */\n iconColorPrimary: {\n color: 'inherit'\n },\n\n /* Styles applied to the `icon` element if `color=\"secondary\"`. */\n iconColorSecondary: {\n color: 'inherit'\n },\n\n /* Styles applied to the label `span` element. */\n label: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n paddingLeft: 12,\n paddingRight: 12,\n whiteSpace: 'nowrap'\n },\n\n /* Styles applied to the label `span` element if `size=\"small\"`. */\n labelSmall: {\n paddingLeft: 8,\n paddingRight: 8\n },\n\n /* Styles applied to the `deleteIcon` element. */\n deleteIcon: {\n WebkitTapHighlightColor: 'transparent',\n color: deleteIconColor,\n height: 22,\n width: 22,\n cursor: 'pointer',\n margin: '0 5px 0 -6px',\n '&:hover': {\n color: alpha(deleteIconColor, 0.4)\n }\n },\n\n /* Styles applied to the `deleteIcon` element if `size=\"small\"`. */\n deleteIconSmall: {\n height: 16,\n width: 16,\n marginRight: 4,\n marginLeft: -4\n },\n\n /* Styles applied to the deleteIcon element if `color=\"primary\"` and `variant=\"default\"`. */\n deleteIconColorPrimary: {\n color: alpha(theme.palette.primary.contrastText, 0.7),\n '&:hover, &:active': {\n color: theme.palette.primary.contrastText\n }\n },\n\n /* Styles applied to the deleteIcon element if `color=\"secondary\"` and `variant=\"default\"`. */\n deleteIconColorSecondary: {\n color: alpha(theme.palette.secondary.contrastText, 0.7),\n '&:hover, &:active': {\n color: theme.palette.secondary.contrastText\n }\n },\n\n /* Styles applied to the deleteIcon element if `color=\"primary\"` and `variant=\"outlined\"`. */\n deleteIconOutlinedColorPrimary: {\n color: alpha(theme.palette.primary.main, 0.7),\n '&:hover, &:active': {\n color: theme.palette.primary.main\n }\n },\n\n /* Styles applied to the deleteIcon element if `color=\"secondary\"` and `variant=\"outlined\"`. */\n deleteIconOutlinedColorSecondary: {\n color: alpha(theme.palette.secondary.main, 0.7),\n '&:hover, &:active': {\n color: theme.palette.secondary.main\n }\n }\n };\n};\n\nfunction isDeleteKeyboardEvent(keyboardEvent) {\n return keyboardEvent.key === 'Backspace' || keyboardEvent.key === 'Delete';\n}\n/**\n * Chips represent complex entities in small blocks, such as a contact.\n */\n\n\nvar Chip = /*#__PURE__*/React.forwardRef(function Chip(props, ref) {\n var avatarProp = props.avatar,\n classes = props.classes,\n className = props.className,\n clickableProp = props.clickable,\n _props$color = props.color,\n color = _props$color === void 0 ? 'default' : _props$color,\n ComponentProp = props.component,\n deleteIconProp = props.deleteIcon,\n _props$disabled = props.disabled,\n disabled = _props$disabled === void 0 ? false : _props$disabled,\n iconProp = props.icon,\n label = props.label,\n onClick = props.onClick,\n onDelete = props.onDelete,\n onKeyDown = props.onKeyDown,\n onKeyUp = props.onKeyUp,\n _props$size = props.size,\n size = _props$size === void 0 ? 'medium' : _props$size,\n _props$variant = props.variant,\n variant = _props$variant === void 0 ? 'default' : _props$variant,\n other = _objectWithoutProperties(props, [\"avatar\", \"classes\", \"className\", \"clickable\", \"color\", \"component\", \"deleteIcon\", \"disabled\", \"icon\", \"label\", \"onClick\", \"onDelete\", \"onKeyDown\", \"onKeyUp\", \"size\", \"variant\"]);\n\n var chipRef = React.useRef(null);\n var handleRef = useForkRef(chipRef, ref);\n\n var handleDeleteIconClick = function handleDeleteIconClick(event) {\n // Stop the event from bubbling up to the `Chip`\n event.stopPropagation();\n\n if (onDelete) {\n onDelete(event);\n }\n };\n\n var handleKeyDown = function handleKeyDown(event) {\n // Ignore events from children of `Chip`.\n if (event.currentTarget === event.target && isDeleteKeyboardEvent(event)) {\n // will be handled in keyUp, otherwise some browsers\n // might init navigation\n event.preventDefault();\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n var handleKeyUp = function handleKeyUp(event) {\n // Ignore events from children of `Chip`.\n if (event.currentTarget === event.target) {\n if (onDelete && isDeleteKeyboardEvent(event)) {\n onDelete(event);\n } else if (event.key === 'Escape' && chipRef.current) {\n chipRef.current.blur();\n }\n }\n\n if (onKeyUp) {\n onKeyUp(event);\n }\n };\n\n var clickable = clickableProp !== false && onClick ? true : clickableProp;\n var small = size === 'small';\n var Component = ComponentProp || (clickable ? ButtonBase : 'div');\n var moreProps = Component === ButtonBase ? {\n component: 'div'\n } : {};\n var deleteIcon = null;\n\n if (onDelete) {\n var customClasses = clsx(color !== 'default' && (variant === \"default\" ? classes[\"deleteIconColor\".concat(capitalize(color))] : classes[\"deleteIconOutlinedColor\".concat(capitalize(color))]), small && classes.deleteIconSmall);\n deleteIcon = deleteIconProp && /*#__PURE__*/React.isValidElement(deleteIconProp) ? /*#__PURE__*/React.cloneElement(deleteIconProp, {\n className: clsx(deleteIconProp.props.className, classes.deleteIcon, customClasses),\n onClick: handleDeleteIconClick\n }) : /*#__PURE__*/React.createElement(CancelIcon, {\n className: clsx(classes.deleteIcon, customClasses),\n onClick: handleDeleteIconClick\n });\n }\n\n var avatar = null;\n\n if (avatarProp && /*#__PURE__*/React.isValidElement(avatarProp)) {\n avatar = /*#__PURE__*/React.cloneElement(avatarProp, {\n className: clsx(classes.avatar, avatarProp.props.className, small && classes.avatarSmall, color !== 'default' && classes[\"avatarColor\".concat(capitalize(color))])\n });\n }\n\n var icon = null;\n\n if (iconProp && /*#__PURE__*/React.isValidElement(iconProp)) {\n icon = /*#__PURE__*/React.cloneElement(iconProp, {\n className: clsx(classes.icon, iconProp.props.className, small && classes.iconSmall, color !== 'default' && classes[\"iconColor\".concat(capitalize(color))])\n });\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (avatar && icon) {\n console.error('Material-UI: The Chip component can not handle the avatar ' + 'and the icon prop at the same time. Pick one.');\n }\n }\n\n return /*#__PURE__*/React.createElement(Component, _extends({\n role: clickable || onDelete ? 'button' : undefined,\n className: clsx(classes.root, className, color !== 'default' && [classes[\"color\".concat(capitalize(color))], clickable && classes[\"clickableColor\".concat(capitalize(color))], onDelete && classes[\"deletableColor\".concat(capitalize(color))]], variant !== \"default\" && [classes.outlined, {\n 'primary': classes.outlinedPrimary,\n 'secondary': classes.outlinedSecondary\n }[color]], disabled && classes.disabled, small && classes.sizeSmall, clickable && classes.clickable, onDelete && classes.deletable),\n \"aria-disabled\": disabled ? true : undefined,\n tabIndex: clickable || onDelete ? 0 : undefined,\n onClick: onClick,\n onKeyDown: handleKeyDown,\n onKeyUp: handleKeyUp,\n ref: handleRef\n }, moreProps, other), avatar || icon, /*#__PURE__*/React.createElement(\"span\", {\n className: clsx(classes.label, small && classes.labelSmall)\n }, label), deleteIcon);\n});\nprocess.env.NODE_ENV !== \"production\" ? Chip.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * Avatar element.\n */\n avatar: PropTypes.element,\n\n /**\n * This prop isn't supported.\n * Use the `component` prop if you need to change the children structure.\n */\n children: unsupportedProp,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * If `true`, the chip will appear clickable, and will raise when pressed,\n * even if the onClick prop is not defined.\n * If false, the chip will not be clickable, even if onClick prop is defined.\n * This can be used, for example,\n * along with the component prop to indicate an anchor Chip is clickable.\n */\n clickable: PropTypes.bool,\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n */\n color: PropTypes.oneOf(['default', 'primary', 'secondary']),\n\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\n /* @typescript-to-proptypes-ignore */\n .elementType,\n\n /**\n * Override the default delete icon element. Shown only if `onDelete` is set.\n */\n deleteIcon: PropTypes.element,\n\n /**\n * If `true`, the chip should be displayed in a disabled state.\n */\n disabled: PropTypes.bool,\n\n /**\n * Icon element.\n */\n icon: PropTypes.element,\n\n /**\n * The content of the label.\n */\n label: PropTypes.node,\n\n /**\n * @ignore\n */\n onClick: PropTypes.func,\n\n /**\n * Callback function fired when the delete icon is clicked.\n * If set, the delete icon will be shown.\n */\n onDelete: PropTypes.func,\n\n /**\n * @ignore\n */\n onKeyDown: PropTypes.func,\n\n /**\n * @ignore\n */\n onKeyUp: PropTypes.func,\n\n /**\n * The size of the chip.\n */\n size: PropTypes.oneOf(['medium', 'small']),\n\n /**\n * The variant to use.\n */\n variant: PropTypes.oneOf(['default', 'outlined'])\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiChip'\n})(Chip);"],"sourceRoot":""} |