import { buildUrl } from '@openobserve/browser-core' import { CENSORED_STRING_MARK, shouldMaskNode } from '@openobserve/browser-rum-core' import type { NodePrivacyLevel } from '@openobserve/browser-rum-core' /** * Get the element "value" to be serialized as an attribute or an input update record. It respects * the input privacy mode of the element. * PERFROMANCE OPTIMIZATION: Assumes that privacy level `HIDDEN` is never encountered because of earlier checks. */ export function getElementInputValue(element: Element, nodePrivacyLevel: NodePrivacyLevel) { /* BROWSER SPEC NOTE: , elements, the `value` is an exceptional property/attribute that has the value synced between el.value and el.getAttribute() input[type=button,checkbox,hidden,image,radio,reset,submit] */ const tagName = element.tagName const value = (element as HTMLInputElement | HTMLTextAreaElement).value if (shouldMaskNode(element, nodePrivacyLevel)) { const type = (element as HTMLInputElement | HTMLTextAreaElement).type if (tagName === 'INPUT' && (type === 'button' || type === 'submit' || type === 'reset')) { // Overrule `MASK` privacy level for button-like element values, as they are used during replay // to display their label. They can still be hidden via the "hidden" privacy attribute or class name. return value } else if (!value || tagName === 'OPTION') { //