You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1 lines
123 KiB

{"version":3,"file":"primitives-event-dispatch.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/property.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/cache.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/event_type.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/event.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/event_contract_container.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/char.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/event_info.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/action_resolver.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/restriction.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/dispatcher.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/event_dispatcher.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/earlyeventcontract.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/event_contract_defines.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/eventcontract.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/bootstrap_app_scoped.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/** All properties that are used by jsaction. */\nexport const Property = {\n /**\n * The parsed value of the jsaction attribute is stored in this\n * property on the DOM node. The parsed value is an Object. The\n * property names of the object are the events; the values are the\n * names of the actions. This property is attached even on nodes\n * that don't have a jsaction attribute as an optimization, because\n * property lookup is faster than attribute access.\n */\n JSACTION: '__jsaction' as const,\n /**\n * The owner property references an a logical owner for a DOM node. JSAction\n * will follow this reference instead of parentNode when traversing the DOM\n * to find jsaction attributes. This allows overlaying a logical structure\n * over a document where the DOM structure can't reflect that structure.\n */\n OWNER: '__owner' as const,\n};\n\ndeclare global {\n interface Node {\n [Property.JSACTION]?: {[key: string]: string | undefined};\n [Property.OWNER]?: ParentNode;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Property} from './property';\n\n/**\n * Map from jsaction annotation to a parsed map from event name to action name.\n */\nconst parseCache: {[key: string]: {[key: string]: string | undefined}} = {};\n\n/**\n * Reads the jsaction parser cache from the given DOM Element.\n */\nexport function get(element: Element): {[key: string]: string | undefined} | undefined {\n return element[Property.JSACTION];\n}\n\n/**\n * Reads the jsaction parser cache for the given DOM element. If no cache is yet present,\n * creates an empty one.\n */\nexport function getDefaulted(element: Element): {[key: string]: string | undefined} {\n const cache = get(element) ?? {};\n set(element, cache);\n return cache;\n}\n\n/**\n * Writes the jsaction parser cache to the given DOM Element.\n */\nexport function set(element: Element, actionMap: {[key: string]: string | undefined}) {\n element[Property.JSACTION] = actionMap;\n}\n\n/**\n * Looks up the parsed action map from the source jsaction attribute value.\n *\n * @param text Unparsed jsaction attribute value.\n * @return Parsed jsaction attribute value, if already present in the cache.\n */\nexport function getParsed(text: string): {[key: string]: string | undefined} | undefined {\n return parseCache[text];\n}\n\n/**\n * Inserts the parse result for the given source jsaction value into the cache.\n *\n * @param text Unparsed jsaction attribute value.\n * @param parsed Attribute value parsed into the action map.\n */\nexport function setParsed(text: string, parsed: {[key: string]: string | undefined}) {\n parseCache[text] = parsed;\n}\n\n/**\n * Clears the jsaction parser cache from the given DOM Element.\n *\n * @param element .\n */\nexport function clear(element: Element) {\n if (Property.JSACTION in element) {\n delete element[Property.JSACTION];\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/*\n * Names of events that are special to jsaction. These are not all\n * event types that are legal to use in either HTML or the addEvent()\n * API, but these are the ones that are treated specially. All other\n * DOM events can be used in either addEvent() or in the value of the\n * jsaction attribute. Beware of browser specific events or events\n * that don't bubble though: If they are not mentioned here, then\n * event contract doesn't work around their peculiarities.\n */\nexport const EventType = {\n /**\n * Mouse middle click, introduced in Chrome 55 and not yet supported on\n * other browsers.\n */\n AUXCLICK: 'auxclick',\n\n /**\n * The change event fired by browsers when the `value` attribute of input,\n * select, and textarea elements are changed.\n */\n CHANGE: 'change',\n\n /**\n * The click event. In addEvent() refers to all click events, in the\n * jsaction attribute it refers to the unmodified click and Enter/Space\n * keypress events. In the latter case, a jsaction click will be triggered,\n * for accessibility reasons. See clickmod and clickonly, below.\n */\n CLICK: 'click',\n\n /**\n * Specifies the jsaction for a modified click event (i.e. a mouse\n * click with the modifier key Cmd/Ctrl pressed). This event isn't\n * separately enabled in addEvent(), because in the DOM, it's just a\n * click event.\n */\n CLICKMOD: 'clickmod',\n\n /**\n * Specifies the jsaction for a click-only event. Click-only doesn't take\n * into account the case where an element with focus receives an Enter/Space\n * keypress. This event isn't separately enabled in addEvent().\n */\n CLICKONLY: 'clickonly',\n\n /**\n * The dblclick event.\n */\n DBLCLICK: 'dblclick',\n\n /**\n * Focus doesn't bubble, but you can use it in addEvent() and\n * jsaction anyway. EventContract does the right thing under the\n * hood.\n */\n FOCUS: 'focus',\n\n /**\n * This event only exists in IE. For addEvent() and jsaction, use\n * focus instead; EventContract does the right thing even though\n * focus doesn't bubble.\n */\n FOCUSIN: 'focusin',\n\n /**\n * Analog to focus.\n */\n BLUR: 'blur',\n\n /**\n * Analog to focusin.\n */\n FOCUSOUT: 'focusout',\n\n /**\n * Submit doesn't bubble, so it cannot be used with event\n * contract. However, the browser helpfully fires a click event on\n * the submit button of a form (even if the form is not submitted by\n * a click on the submit button). So you should handle click on the\n * submit button instead.\n */\n SUBMIT: 'submit',\n\n /**\n * The keydown event. In addEvent() and non-click jsaction it represents the\n * regular DOM keydown event. It represents click actions in non-Gecko\n * browsers.\n */\n KEYDOWN: 'keydown',\n\n /**\n * The keypress event. In addEvent() and non-click jsaction it represents the\n * regular DOM keypress event. It represents click actions in Gecko browsers.\n */\n KEYPRESS: 'keypress',\n\n /**\n * The keyup event. In addEvent() and non-click jsaction it represents the\n * regular DOM keyup event. It represents click actions in non-Gecko\n * browsers.\n */\n KEYUP: 'keyup',\n\n /**\n * The mouseup event. Can either be used directly or used implicitly to\n * capture mouseup events. In addEvent(), it represents a regular DOM\n * mouseup event.\n */\n MOUSEUP: 'mouseup',\n\n /**\n * The mousedown event. Can either be used directly or used implicitly to\n * capture mouseenter events. In addEvent(), it represents a regular DOM\n * mouseover event.\n */\n MOUSEDOWN: 'mousedown',\n\n /**\n * The mouseover event. Can either be used directly or used implicitly to\n * capture mouseenter events. In addEvent(), it represents a regular DOM\n * mouseover event.\n */\n MOUSEOVER: 'mouseover',\n\n /**\n * The mouseout event. Can either be used directly or used implicitly to\n * capture mouseover events. In addEvent(), it represents a regular DOM\n * mouseout event.\n */\n MOUSEOUT: 'mouseout',\n\n /**\n * The mouseenter event. Does not bubble and fires individually on each\n * element being entered within a DOM tree.\n */\n MOUSEENTER: 'mouseenter',\n\n /**\n * The mouseleave event. Does not bubble and fires individually on each\n * element being entered within a DOM tree.\n */\n MOUSELEAVE: 'mouseleave',\n\n /**\n * The mousemove event.\n */\n MOUSEMOVE: 'mousemove',\n\n /**\n * The pointerup event. Can either be used directly or used implicitly to\n * capture pointerup events. In addEvent(), it represents a regular DOM\n * pointerup event.\n */\n POINTERUP: 'pointerup',\n\n /**\n * The pointerdown event. Can either be used directly or used implicitly to\n * capture pointerenter events. In addEvent(), it represents a regular DOM\n * mouseover event.\n */\n POINTERDOWN: 'pointerdown',\n\n /**\n * The pointerover event. Can either be used directly or used implicitly to\n * capture pointerenter events. In addEvent(), it represents a regular DOM\n * pointerover event.\n */\n POINTEROVER: 'pointerover',\n\n /**\n * The pointerout event. Can either be used directly or used implicitly to\n * capture pointerover events. In addEvent(), it represents a regular DOM\n * pointerout event.\n */\n POINTEROUT: 'pointerout',\n\n /**\n * The pointerenter event. Does not bubble and fires individually on each\n * element being entered within a DOM tree.\n */\n POINTERENTER: 'pointerenter',\n\n /**\n * The pointerleave event. Does not bubble and fires individually on each\n * element being entered within a DOM tree.\n */\n POINTERLEAVE: 'pointerleave',\n\n /**\n * The pointermove event.\n */\n POINTERMOVE: 'pointermove',\n\n /**\n * The pointercancel event.\n */\n POINTERCANCEL: 'pointercancel',\n\n /**\n * The gotpointercapture event is fired when\n * Element.setPointerCapture(pointerId) is called on a mouse input, or\n * implicitly when a touch input begins.\n */\n GOTPOINTERCAPTURE: 'gotpointercapture',\n\n /**\n * The lostpointercapture event is fired when\n * Element.releasePointerCapture(pointerId) is called, or implicitly after a\n * touch input ends.\n */\n LOSTPOINTERCAPTURE: 'lostpointercapture',\n\n /**\n * The error event. The error event doesn't bubble, but you can use it in\n * addEvent() and jsaction anyway. EventContract does the right thing under\n * the hood (except in IE8 which does not use error events).\n */\n ERROR: 'error',\n\n /**\n * The load event. The load event doesn't bubble, but you can use it in\n * addEvent() and jsaction anyway. EventContract does the right thing\n * under the hood.\n */\n LOAD: 'load',\n\n /**\n * The unload event.\n */\n UNLOAD: 'unload',\n\n /**\n * The touchstart event. Bubbles, will only ever fire in browsers with\n * touch support.\n */\n TOUCHSTART: 'touchstart',\n\n /**\n * The touchend event. Bubbles, will only ever fire in browsers with\n * touch support.\n */\n TOUCHEND: 'touchend',\n\n /**\n * The touchmove event. Bubbles, will only ever fire in browsers with\n * touch support.\n */\n TOUCHMOVE: 'touchmove',\n\n /**\n * The input event.\n */\n INPUT: 'input',\n\n /**\n * The scroll event.\n */\n SCROLL: 'scroll',\n\n /**\n * The toggle event. The toggle event doesn't bubble, but you can use it in\n * addEvent() and jsaction anyway. EventContract does the right thing\n * under the hood.\n */\n TOGGLE: 'toggle',\n\n /**\n * A custom event. The actual custom event type is declared as the 'type'\n * field in the event details. Supported in Firefox 6+, IE 9+, and all Chrome\n * versions.\n *\n * This is an internal name. Users should use jsaction's fireCustomEvent to\n * fire custom events instead of relying on this type to create them.\n */\n CUSTOM: '_custom',\n};\n\n/** All event types that do not bubble or capture and need a polyfill. */\nexport const MOUSE_SPECIAL_EVENT_TYPES = [\n EventType.MOUSEENTER,\n EventType.MOUSELEAVE,\n 'pointerenter',\n 'pointerleave',\n];\n\n/** All event types that are registered in the bubble phase. */\nexport const BUBBLE_EVENT_TYPES = [\n EventType.CLICK,\n EventType.DBLCLICK,\n EventType.FOCUSIN,\n EventType.FOCUSOUT,\n EventType.KEYDOWN,\n EventType.KEYUP,\n EventType.KEYPRESS,\n EventType.MOUSEOVER,\n EventType.MOUSEOUT,\n EventType.SUBMIT,\n EventType.TOUCHSTART,\n EventType.TOUCHEND,\n EventType.TOUCHMOVE,\n 'touchcancel',\n\n 'auxclick',\n 'change',\n 'compositionstart',\n 'compositionupdate',\n 'compositionend',\n 'beforeinput',\n 'input',\n 'select',\n\n 'copy',\n 'cut',\n 'paste',\n 'mousedown',\n 'mouseup',\n 'wheel',\n 'contextmenu',\n\n 'dragover',\n 'dragenter',\n 'dragleave',\n 'drop',\n 'dragstart',\n 'dragend',\n\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'pointercancel',\n 'pointerover',\n 'pointerout',\n 'gotpointercapture',\n 'lostpointercapture',\n\n // Video events.\n 'ended',\n 'loadedmetadata',\n\n // Page visibility events.\n 'pagehide',\n 'pageshow',\n 'visibilitychange',\n\n // Content visibility events.\n 'beforematch',\n];\n\n/** All event types that are registered in the capture phase. */\nexport const CAPTURE_EVENT_TYPES = [\n EventType.FOCUS,\n EventType.BLUR,\n EventType.ERROR,\n EventType.LOAD,\n EventType.TOGGLE,\n];\n\n/**\n * Whether or not an event type should be registered in the capture phase.\n * @param eventType\n * @returns bool\n */\nexport const isCaptureEventType = (eventType: string) =>\n CAPTURE_EVENT_TYPES.indexOf(eventType) >= 0;\n\n/** All event types that are registered early. */\nconst EARLY_EVENT_TYPES = BUBBLE_EVENT_TYPES.concat(CAPTURE_EVENT_TYPES);\n\n/**\n * Whether or not an event type is registered in the early contract.\n */\nexport const isEarlyEventType = (eventType: string) => EARLY_EVENT_TYPES.indexOf(eventType) >= 0;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {EventHandlerInfo} from './event_handler';\nimport {isCaptureEventType, EventType} from './event_type';\nimport {KeyCode} from './key_code';\n\n/**\n * Gets a browser event type, if it would differ from the JSAction event type.\n */\nexport function getBrowserEventType(eventType: string) {\n // Mouseenter and mouseleave events are not handled directly because they\n // are not available everywhere. In browsers where they are available, they\n // don't bubble and aren't visible at the container boundary. Instead, we\n // synthesize the mouseenter and mouseleave events from mouseover and\n // mouseout events, respectively. Cf. eventcontract.js.\n if (eventType === EventType.MOUSEENTER) {\n return EventType.MOUSEOVER;\n } else if (eventType === EventType.MOUSELEAVE) {\n return EventType.MOUSEOUT;\n } else if (eventType === EventType.POINTERENTER) {\n return EventType.POINTEROVER;\n } else if (eventType === EventType.POINTERLEAVE) {\n return EventType.POINTEROUT;\n }\n return eventType;\n}\n\n/**\n * Registers the event handler function with the given DOM element for\n * the given event type.\n *\n * @param element The element.\n * @param eventType The event type.\n * @param handler The handler function to install.\n * @param passive A boolean value that, if `true`, indicates that the function\n * specified by `handler` will never call `preventDefault()`.\n * @return Information needed to uninstall the event handler eventually.\n */\nexport function addEventListener(\n element: Element,\n eventType: string,\n handler: (event: Event) => void,\n passive?: boolean,\n): EventHandlerInfo {\n // All event handlers are registered in the bubbling\n // phase.\n //\n // All browsers support focus and blur, but these events only are propagated\n // in the capture phase. Very legacy browsers do not support focusin or\n // focusout.\n //\n // It would be a bad idea to register all event handlers in the\n // capture phase because then regular onclick handlers would not be\n // executed at all on events that trigger a jsaction. That's not\n // entirely what we want, at least for now.\n //\n // Error and load events (i.e. on images) do not bubble so they are also\n // handled in the capture phase.\n let capture = false;\n\n if (isCaptureEventType(eventType)) {\n capture = true;\n }\n\n const options = typeof passive === 'boolean' ? {capture, passive} : capture;\n element.addEventListener(eventType, handler, options);\n\n return {eventType, handler, capture, passive};\n}\n\n/**\n * Removes the event handler for the given event from the element.\n * the given event type.\n *\n * @param element The element.\n * @param info The information needed to deregister the handler, as returned by\n * addEventListener(), above.\n */\nexport function removeEventListener(element: Element, info: EventHandlerInfo) {\n if (element.removeEventListener) {\n // It's worth noting that some browser releases have been inconsistent on this, and unless\n // you have specific reasons otherwise, it's probably wise to use the same values used for\n // the call to addEventListener() when calling removeEventListener().\n const options = typeof info.passive === 'boolean' ? {capture: info.capture} : info.capture;\n element.removeEventListener(info.eventType, info.handler as EventListener, options);\n // `detachEvent` is an old DOM API.\n } else if ((element as any).detachEvent) {\n // `detachEvent` is an old DOM API.\n (element as any).detachEvent(`on${info.eventType}`, info.handler);\n }\n}\n\n/**\n * Cancels propagation of an event.\n * @param e The event to cancel propagation for.\n */\nexport function stopPropagation(e: Event) {\n e.stopPropagation ? e.stopPropagation() : (e.cancelBubble = true);\n}\n\n/**\n * Prevents the default action of an event.\n * @param e The event to prevent the default action for.\n */\nexport function preventDefault(e: Event) {\n e.preventDefault ? e.preventDefault() : (e.returnValue = false);\n}\n\n/**\n * Gets the target Element of the event. In Firefox, a text node may appear as\n * the target of the event, in which case we return the parent element of the\n * text node.\n * @param e The event to get the target of.\n * @return The target element.\n */\nexport function getTarget(e: Event): Element {\n let el = e.target as Element;\n\n // In Firefox, the event may have a text node as its target. We always\n // want the parent Element the text node belongs to, however.\n if (!el.getAttribute && el.parentNode) {\n el = el.parentNode as Element;\n }\n\n return el;\n}\n\n/**\n * Whether we are on a Mac. Not pulling in useragent just for this.\n */\nlet isMac: boolean = typeof navigator !== 'undefined' && /Macintosh/.test(navigator.userAgent);\n\n/**\n * Determines and returns whether the given event (which is assumed to be a\n * click event) is a middle click.\n * NOTE: There is not a consistent way to identify middle click\n * http://www.unixpapa.com/js/mouse.html\n */\nfunction isMiddleClick(e: Event): boolean {\n return (\n // `which` is an old DOM API.\n (e as any).which === 2 ||\n // `which` is an old DOM API.\n ((e as any).which == null &&\n // `button` is an old DOM API.\n (e as any).button === 4) // middle click for IE\n );\n}\n\n/**\n * Determines and returns whether the given event (which is assumed\n * to be a click event) is modified. A middle click is considered a modified\n * click to retain the default browser action, which opens a link in a new tab.\n * @param e The event.\n * @return Whether the given event is modified.\n */\nexport function isModifiedClickEvent(e: Event): boolean {\n return (\n // `metaKey` is an old DOM API.\n (isMac && (e as any).metaKey) ||\n // `ctrlKey` is an old DOM API.\n (!isMac && (e as any).ctrlKey) ||\n isMiddleClick(e) ||\n // `shiftKey` is an old DOM API.\n (e as any).shiftKey\n );\n}\n\n/** Whether we are on WebKit (e.g., Chrome). */\nexport const isWebKit: boolean =\n typeof navigator !== 'undefined' &&\n !/Opera/.test(navigator.userAgent) &&\n /WebKit/.test(navigator.userAgent);\n\n/** Whether we are on IE. */\nexport const isIe: boolean =\n typeof navigator !== 'undefined' &&\n (/MSIE/.test(navigator.userAgent) || /Trident/.test(navigator.userAgent));\n\n/** Whether we are on Gecko (e.g., Firefox). */\nexport const isGecko: boolean =\n typeof navigator !== 'undefined' &&\n !/Opera|WebKit/.test(navigator.userAgent) &&\n /Gecko/.test(navigator.product);\n\n/**\n * Determines and returns whether the given element is a valid target for\n * keypress/keydown DOM events that act like regular DOM clicks.\n * @param el The element.\n * @return Whether the given element is a valid action key target.\n */\nexport function isValidActionKeyTarget(el: Element): boolean {\n if (!('getAttribute' in el)) {\n return false;\n }\n if (isTextControl(el)) {\n return false;\n }\n if (isNativelyActivatable(el)) {\n return false;\n }\n // `isContentEditable` is an old DOM API.\n if ((el as any).isContentEditable) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Whether an event has a modifier key activated.\n * @param e The event.\n * @return True, if a modifier key is activated.\n */\nfunction hasModifierKey(e: Event): boolean {\n return (\n // `ctrlKey` is an old DOM API.\n (e as any).ctrlKey ||\n // `shiftKey` is an old DOM API.\n (e as any).shiftKey ||\n // `altKey` is an old DOM API.\n (e as any).altKey ||\n // `metaKey` is an old DOM API.\n (e as any).metaKey\n );\n}\n\n/**\n * Determines and returns whether the given event has a target that already\n * has event handlers attached because it is a native HTML control. Used to\n * determine if preventDefault should be called when isActionKeyEvent is true.\n * @param e The event.\n * @return If preventDefault should be called.\n */\nexport function shouldCallPreventDefaultOnNativeHtmlControl(e: Event): boolean {\n const el = getTarget(e);\n const tagName = el.tagName.toUpperCase();\n const role = (el.getAttribute('role') || '').toUpperCase();\n\n if (tagName === 'BUTTON' || role === 'BUTTON') {\n return true;\n }\n if (!isNativeHTMLControl(el)) {\n return false;\n }\n if (tagName === 'A') {\n return false;\n }\n /**\n * Fix for physical d-pads on feature phone platforms; the native event\n * (ie. isTrusted: true) needs to fire to show the OPTION list. See\n * b/135288469 for more info.\n */\n if (tagName === 'SELECT') {\n return false;\n }\n if (processSpace(el)) {\n return false;\n }\n if (isTextControl(el)) {\n return false;\n }\n return true;\n}\n\n/**\n * Determines and returns whether the given event acts like a regular DOM click,\n * and should be handled instead of the click. If this returns true, the caller\n * will call preventDefault() to prevent a possible duplicate event.\n * This is represented by a keypress (keydown on Gecko browsers) on Enter or\n * Space key.\n * @param e The event.\n * @return True, if the event emulates a DOM click.\n */\nexport function isActionKeyEvent(e: Event): boolean {\n let key =\n // `which` is an old DOM API.\n (e as any).which ||\n // `keyCode` is an old DOM API.\n (e as any).keyCode;\n if (!key && (e as KeyboardEvent).key) {\n key = ACTION_KEY_TO_KEYCODE[(e as KeyboardEvent).key];\n }\n if (isWebKit && key === KeyCode.MAC_ENTER) {\n key = KeyCode.ENTER;\n }\n if (key !== KeyCode.ENTER && key !== KeyCode.SPACE) {\n return false;\n }\n const el = getTarget(e);\n if (e.type !== EventType.KEYDOWN || !isValidActionKeyTarget(el) || hasModifierKey(e)) {\n return false;\n }\n\n // For <input type=\"checkbox\">, we must only handle the browser's native click\n // event, so that the browser can toggle the checkbox.\n if (processSpace(el) && key === KeyCode.SPACE) {\n return false;\n }\n\n // If this element is non-focusable, ignore stray keystrokes (b/18337209)\n // Sscreen readers can move without tab focus, so any tabIndex is focusable.\n // See B/21809604\n if (!isFocusable(el)) {\n return false;\n }\n\n const type = (\n el.getAttribute('role') ||\n (el as HTMLInputElement).type ||\n el.tagName\n ).toUpperCase();\n const isSpecificTriggerKey = IDENTIFIER_TO_KEY_TRIGGER_MAPPING[type] % key === 0;\n const isDefaultTriggerKey = !(type in IDENTIFIER_TO_KEY_TRIGGER_MAPPING) && key === KeyCode.ENTER;\n const hasType = el.tagName.toUpperCase() !== 'INPUT' || !!(el as HTMLInputElement).type;\n return (isSpecificTriggerKey || isDefaultTriggerKey) && hasType;\n}\n\n/**\n * Checks whether a DOM element can receive keyboard focus.\n * This code is based on goog.dom.isFocusable, but simplified since we shouldn't\n * care about visibility if we're already handling a keyboard event.\n */\nfunction isFocusable(el: Element): boolean {\n return (\n (el.tagName in NATIVELY_FOCUSABLE_ELEMENTS || hasSpecifiedTabIndex(el)) &&\n !(el as HTMLInputElement).disabled\n );\n}\n\n/**\n * @param element Element to check.\n * @return Whether the element has a specified tab index.\n */\nfunction hasSpecifiedTabIndex(element: Element): boolean {\n // IE returns 0 for an unset tabIndex, so we must use getAttributeNode(),\n // which returns an object with a 'specified' property if tabIndex is\n // specified. This works on other browsers, too.\n const attrNode = element.getAttributeNode('tabindex'); // Must be lowercase!\n return attrNode != null && attrNode.specified;\n}\n\n/** Element tagnames that are focusable by default. */\nconst NATIVELY_FOCUSABLE_ELEMENTS: {[key: string]: number} = {\n 'A': 1,\n 'INPUT': 1,\n 'TEXTAREA': 1,\n 'SELECT': 1,\n 'BUTTON': 1,\n};\n\n/** @return True, if the Space key was pressed. */\nexport function isSpaceKeyEvent(e: Event): boolean {\n const key =\n // `which` is an old DOM API.\n (e as any).which ||\n // `keyCode` is an old DOM API.\n (e as any).keyCode;\n const el = getTarget(e);\n const elementName = ((el as HTMLInputElement).type || el.tagName).toUpperCase();\n return key === KeyCode.SPACE && elementName !== 'CHECKBOX';\n}\n\n/**\n * Determines whether the event corresponds to a non-bubbling mouse\n * event type (mouseenter, mouseleave, pointerenter, and pointerleave).\n *\n * During mouseover (mouseenter) and pointerover (pointerenter), the\n * relatedTarget is the element being entered from. During mouseout (mouseleave)\n * and pointerout (pointerleave), the relatedTarget is the element being exited\n * to.\n *\n * In both cases, if relatedTarget is outside target, then the corresponding\n * special event has occurred, otherwise it hasn't.\n *\n * @param e The mouseover/mouseout event.\n * @param type The type of the mouse special event.\n * @param element The element on which the jsaction for the\n * mouseenter/mouseleave event is defined.\n * @return True if the event is a mouseenter/mouseleave event.\n */\nexport function isMouseSpecialEvent(e: Event, type: string, element: Element): boolean {\n // `relatedTarget` is an old DOM API.\n const related = (e as any).relatedTarget as Node;\n\n return (\n ((e.type === EventType.MOUSEOVER && type === EventType.MOUSEENTER) ||\n (e.type === EventType.MOUSEOUT && type === EventType.MOUSELEAVE) ||\n (e.type === EventType.POINTEROVER && type === EventType.POINTERENTER) ||\n (e.type === EventType.POINTEROUT && type === EventType.POINTERLEAVE)) &&\n (!related || (related !== element && !element.contains(related)))\n );\n}\n\n/**\n * Creates a new EventLike object for a mouseenter/mouseleave event that's\n * derived from the original corresponding mouseover/mouseout event.\n * @param e The event.\n * @param target The element on which the jsaction for the mouseenter/mouseleave\n * event is defined.\n * @return A modified event-like object copied from the event object passed into\n * this function.\n */\nexport function createMouseSpecialEvent(e: Event, target: Element): Event {\n // We have to create a copy of the event object because we need to mutate\n // its fields. We do this for the special mouse events because the event\n // target needs to be retargeted to the action element rather than the real\n // element (since we are simulating the special mouse events with mouseover/\n // mouseout).\n //\n // Since we're making a copy anyways, we might as well attempt to convert\n // this event into a pseudo-real mouseenter/mouseleave event by adjusting\n // its type.\n //\n const copy: {-readonly [P in keyof Event]?: Event[P]} & {'_originalEvent'?: Event} = {};\n for (const property in e) {\n if (property === 'srcElement' || property === 'target') {\n continue;\n }\n const key = property as keyof Event;\n // Making a copy requires iterating through all properties of `Event`.\n const value = e[key];\n if (typeof value === 'function') {\n continue;\n }\n // Value should be the expected type, but the value of `key` is not known\n // statically.\n copy[key] = value as any;\n }\n if (e.type === EventType.MOUSEOVER) {\n copy['type'] = EventType.MOUSEENTER;\n } else if (e.type === EventType.MOUSEOUT) {\n copy['type'] = EventType.MOUSELEAVE;\n } else if (e.type === EventType.POINTEROVER) {\n copy['type'] = EventType.POINTERENTER;\n } else {\n copy['type'] = EventType.POINTERLEAVE;\n }\n copy['target'] = copy['srcElement'] = target;\n copy['bubbles'] = false;\n copy['_originalEvent'] = e;\n return copy as Event;\n}\n\n/**\n * Returns touch data extracted from the touch event: clientX, clientY, screenX\n * and screenY. If the event has no touch information at all, the returned\n * value is null.\n *\n * The fields of this Object are unquoted.\n *\n * @param event A touch event.\n */\nexport function getTouchData(\n event: TouchEvent,\n): {clientX: number; clientY: number; screenX: number; screenY: number} | null {\n const touch =\n (event.changedTouches && event.changedTouches[0]) || (event.touches && event.touches[0]);\n if (!touch) {\n return null;\n }\n return {\n clientX: touch.clientX,\n clientY: touch.clientY,\n screenX: touch.screenX,\n screenY: touch.screenY,\n };\n}\n\ndeclare interface SyntheticMouseEvent extends Event {\n // Redeclared from Event to indicate that it is not readonly.\n defaultPrevented: boolean;\n originalEventType: string;\n _propagationStopped?: boolean;\n}\n\n/**\n * Creates a new EventLike object for a \"click\" event that's derived from the\n * original corresponding \"touchend\" event for a fast-click implementation.\n *\n * It takes a touch event, adds common fields found in a click event and\n * changes the type to 'click', so that the resulting event looks more like\n * a real click event.\n *\n * @param event A touch event.\n * @return A modified event-like object copied from the event object passed into\n * this function.\n */\nexport function recreateTouchEventAsClick(event: TouchEvent): MouseEvent {\n const click: {-readonly [P in keyof MouseEvent]?: MouseEvent[P]} & Partial<SyntheticMouseEvent> =\n {};\n click['originalEventType'] = event.type;\n click['type'] = EventType.CLICK;\n for (const property in event) {\n if (property === 'type' || property === 'srcElement') {\n continue;\n }\n const key = property as keyof TouchEvent;\n // Making a copy requires iterating through all properties of `TouchEvent`.\n const value = event[key];\n if (typeof value === 'function') {\n continue;\n }\n // Value should be the expected type, but the value of `key` is not known\n // statically.\n click[key as keyof MouseEvent] = value as any;\n }\n\n // Ensure that the event has the most recent timestamp. This timestamp\n // may be used in the future to validate or cancel subsequent click events.\n click['timeStamp'] = Date.now();\n\n // Emulate preventDefault and stopPropagation behavior\n click['defaultPrevented'] = false;\n click['preventDefault'] = syntheticPreventDefault;\n click['_propagationStopped'] = false;\n click['stopPropagation'] = syntheticStopPropagation;\n\n // Emulate click coordinates using touch info\n const touch = getTouchData(event);\n if (touch) {\n click['clientX'] = touch.clientX;\n click['clientY'] = touch.clientY;\n click['screenX'] = touch.screenX;\n click['screenY'] = touch.screenY;\n }\n return click as MouseEvent;\n}\n\n/**\n * An implementation of \"preventDefault\" for a synthesized event. Simply\n * sets \"defaultPrevented\" property to true.\n */\nfunction syntheticPreventDefault(this: Event) {\n (this as SyntheticMouseEvent).defaultPrevented = true;\n}\n\n/**\n * An implementation of \"stopPropagation\" for a synthesized event. It simply\n * sets a synthetic non-standard \"_propagationStopped\" property to true.\n */\nfunction syntheticStopPropagation(this: Event) {\n (this as SyntheticMouseEvent)._propagationStopped = true;\n}\n\n/**\n * Mapping of KeyboardEvent.key values to\n * KeyCode values.\n */\nconst ACTION_KEY_TO_KEYCODE: {[key: string]: number} = {\n 'Enter': KeyCode.ENTER,\n ' ': KeyCode.SPACE,\n};\n\n/**\n * Mapping of HTML element identifiers (ARIA role, type, or tagName) to the\n * keys (enter and/or space) that should activate them. A value of zero means\n * that both should activate them.\n */\nexport const IDENTIFIER_TO_KEY_TRIGGER_MAPPING: {[key: string]: number} = {\n 'A': KeyCode.ENTER,\n 'BUTTON': 0,\n 'CHECKBOX': KeyCode.SPACE,\n 'COMBOBOX': KeyCode.ENTER,\n 'FILE': 0,\n 'GRIDCELL': KeyCode.ENTER,\n 'LINK': KeyCode.ENTER,\n 'LISTBOX': KeyCode.ENTER,\n 'MENU': 0,\n 'MENUBAR': 0,\n 'MENUITEM': 0,\n 'MENUITEMCHECKBOX': 0,\n 'MENUITEMRADIO': 0,\n 'OPTION': 0,\n 'RADIO': KeyCode.SPACE,\n 'RADIOGROUP': KeyCode.SPACE,\n 'RESET': 0,\n 'SUBMIT': 0,\n 'SWITCH': KeyCode.SPACE,\n 'TAB': 0,\n 'TREE': KeyCode.ENTER,\n 'TREEITEM': KeyCode.ENTER,\n};\n\n/**\n * Returns whether or not to process space based on the type of the element;\n * checks to make sure that type is not null.\n * @param element The element.\n * @return Whether or not to process space based on type.\n */\nfunction processSpace(element: Element): boolean {\n const type = (element.getAttribute('type') || element.tagName).toUpperCase();\n return type in PROCESS_SPACE;\n}\n\n/**\n * Returns whether or not the given element is a text control.\n * @param el The element.\n * @return Whether or not the given element is a text control.\n */\nfunction isTextControl(el: Element): boolean {\n const type = (el.getAttribute('type') || el.tagName).toUpperCase();\n return type in TEXT_CONTROLS;\n}\n\n/**\n * Returns if the given element is a native HTML control.\n * @param el The element.\n * @return If the given element is a native HTML control.\n */\nexport function isNativeHTMLControl(el: Element): boolean {\n return el.tagName.toUpperCase() in NATIVE_HTML_CONTROLS;\n}\n\n/**\n * Returns if the given element is natively activatable. Browsers emit click\n * events for natively activatable elements, even when activated via keyboard.\n * For these elements, we don't need to raise a11y click events.\n * @param el The element.\n * @return If the given element is a native HTML control.\n */\nfunction isNativelyActivatable(el: Element): boolean {\n return (\n el.tagName.toUpperCase() === 'BUTTON' ||\n (!!(el as HTMLInputElement).type && (el as HTMLInputElement).type.toUpperCase() === 'FILE')\n );\n}\n\n/**\n * HTML <input> types (not ARIA roles) which will auto-trigger a click event for\n * the Space key, with side-effects. We will not call preventDefault if space is\n * pressed, nor will we raise a11y click events. For all other elements, we can\n * suppress the default event (which has no desired side-effects) and handle the\n * keydown ourselves.\n */\nconst PROCESS_SPACE: {[key: string]: boolean} = {\n 'CHECKBOX': true,\n 'FILE': true,\n 'OPTION': true,\n 'RADIO': true,\n};\n\n/** TagNames and Input types for which to not process enter/space as click. */\nconst TEXT_CONTROLS: {[key: string]: boolean} = {\n 'COLOR': true,\n 'DATE': true,\n 'DATETIME': true,\n 'DATETIME-LOCAL': true,\n 'EMAIL': true,\n 'MONTH': true,\n 'NUMBER': true,\n 'PASSWORD': true,\n 'RANGE': true,\n 'SEARCH': true,\n 'TEL': true,\n 'TEXT': true,\n 'TEXTAREA': true,\n 'TIME': true,\n 'URL': true,\n 'WEEK': true,\n};\n\n/** TagNames that are native HTML controls. */\nconst NATIVE_HTML_CONTROLS: {[key: string]: boolean} = {\n 'A': true,\n 'AREA': true,\n 'BUTTON': true,\n 'DIALOG': true,\n 'IMG': true,\n 'INPUT': true,\n 'LINK': true,\n 'MENU': true,\n 'OPTGROUP': true,\n 'OPTION': true,\n 'PROGRESS': true,\n 'SELECT': true,\n 'TEXTAREA': true,\n};\n\n/** Exported for testing. */\nexport const testing = {\n setIsMac(value: boolean) {\n isMac = value;\n },\n};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport * as eventLib from './event';\nimport {EventHandlerInfo} from './event_handler';\n\n/**\n * An `EventContractContainerManager` provides the common interface for managing\n * containers.\n */\nexport interface EventContractContainerManager {\n addEventListener(\n eventType: string,\n getHandler: (element: Element) => (event: Event) => void,\n passive?: boolean,\n ): void;\n\n cleanUp(): void;\n}\n\n/**\n * Whether the user agent is running on iOS.\n */\nconst isIos = typeof navigator !== 'undefined' && /iPhone|iPad|iPod/.test(navigator.userAgent);\n\n/**\n * A class representing a container node and all the event handlers\n * installed on it. Used so that handlers can be cleaned up if the\n * container is removed from the contract.\n */\nexport class EventContractContainer implements EventContractContainerManager {\n /**\n * Array of event handlers and their corresponding event types that are\n * installed on this container.\n *\n */\n private handlerInfos: EventHandlerInfo[] = [];\n\n /**\n * @param element The container Element.\n */\n constructor(readonly element: Element) {}\n\n /**\n * Installs the provided installer on the element owned by this container,\n * and maintains a reference to resulting handler in order to remove it\n * later if desired.\n */\n addEventListener(\n eventType: string,\n getHandler: (element: Element) => (event: Event) => void,\n passive?: boolean,\n ) {\n // In iOS, event bubbling doesn't happen automatically in any DOM element,\n // unless it has an onclick attribute or DOM event handler attached to it.\n // This breaks JsAction in some cases. See \"Making Elements Clickable\"\n // section at http://goo.gl/2VoGnB.\n //\n // A workaround for this issue is to change the CSS cursor style to 'pointer'\n // for the container element, which magically turns on event bubbling. This\n // solution is described in the comments section at http://goo.gl/6pEO1z.\n //\n // We use a navigator.userAgent check here as this problem is present both\n // on Mobile Safari and thin WebKit wrappers, such as Chrome for iOS.\n if (isIos) {\n (this.element as HTMLElement).style.cursor = 'pointer';\n }\n this.handlerInfos.push(\n eventLib.addEventListener(this.element, eventType, getHandler(this.element), passive),\n );\n }\n\n /**\n * Removes all the handlers installed on this container.\n */\n cleanUp() {\n for (let i = 0; i < this.handlerInfos.length; i++) {\n eventLib.removeEventListener(this.element, this.handlerInfos[i]);\n }\n\n this.handlerInfos = [];\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nexport const Char = {\n /**\n * The separator between the namespace and the action name in the\n * jsaction attribute value.\n */\n NAMESPACE_ACTION_SEPARATOR: '.' as const,\n\n /**\n * The separator between the event name and action in the jsaction\n * attribute value.\n */\n EVENT_ACTION_SEPARATOR: ':' as const,\n};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Records information about the action that should handle a given `Event`.\n */\nexport interface ActionInfo {\n name: string;\n element: Element;\n}\n\ntype ActionInfoInternal = [name: string, element: Element];\n\n/**\n * Records information for later handling of events. This type is\n * shared, and instances of it are passed, between the eventcontract\n * and the dispatcher jsbinary. Therefore, the fields of this type are\n * referenced by string literals rather than property literals\n * throughout the code.\n *\n * 'targetElement' is the element the action occurred on, 'actionElement'\n * is the element that has the jsaction handler.\n *\n * A null 'actionElement' identifies an EventInfo instance that didn't match a\n * jsaction attribute. This allows us to execute global event handlers with the\n * appropriate event type (including a11y clicks and custom events).\n * The declare portion of this interface creates a set of externs that make sure\n * renaming doesn't happen for EventInfo. This is important since EventInfo\n * is shared across multiple binaries.\n */\nexport declare interface EventInfo {\n eventType: string;\n event: Event;\n targetElement: Element;\n /** The element that is the container for this Event. */\n eic: Element;\n timeStamp: number;\n /**\n * The action parsed from the JSAction element.\n */\n eia?: ActionInfoInternal;\n /**\n * Whether this `Event` is a replay event, meaning no dispatcher was\n * installed when this `Event` was originally dispatched.\n */\n eirp?: boolean;\n /**\n * Whether this `Event` represents a `keydown` event that should be processed\n * as a `click`. Only used when a11y click events is on.\n */\n eiack?: boolean;\n /** Whether action resolution has already run on this `EventInfo`. */\n eir?: boolean;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function getEventType(eventInfo: EventInfo) {\n return eventInfo.eventType;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function setEventType(eventInfo: EventInfo, eventType: string) {\n eventInfo.eventType = eventType;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function getEvent(eventInfo: EventInfo) {\n return eventInfo.event;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function setEvent(eventInfo: EventInfo, event: Event) {\n eventInfo.event = event;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function getTargetElement(eventInfo: EventInfo) {\n return eventInfo.targetElement;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function setTargetElement(eventInfo: EventInfo, targetElement: Element) {\n eventInfo.targetElement = targetElement;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function getContainer(eventInfo: EventInfo) {\n return eventInfo.eic;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function setContainer(eventInfo: EventInfo, container: Element) {\n eventInfo.eic = container;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function getTimestamp(eventInfo: EventInfo) {\n return eventInfo.timeStamp;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function setTimestamp(eventInfo: EventInfo, timestamp: number) {\n eventInfo.timeStamp = timestamp;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function getAction(eventInfo: EventInfo) {\n return eventInfo.eia;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function setAction(eventInfo: EventInfo, actionName: string, actionElement: Element) {\n eventInfo.eia = [actionName, actionElement];\n}\n\n/** Added for readability when accessing stable property names. */\nexport function unsetAction(eventInfo: EventInfo) {\n eventInfo.eia = undefined;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function getActionName(actionInfo: ActionInfoInternal) {\n return actionInfo[0];\n}\n\n/** Added for readability when accessing stable property names. */\nexport function getActionElement(actionInfo: ActionInfoInternal) {\n return actionInfo[1];\n}\n\n/** Added for readability when accessing stable property names. */\nexport function getIsReplay(eventInfo: EventInfo) {\n return eventInfo.eirp;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function setIsReplay(eventInfo: EventInfo, replay: boolean) {\n eventInfo.eirp = replay;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function getA11yClickKey(eventInfo: EventInfo) {\n return eventInfo.eiack;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function setA11yClickKey(eventInfo: EventInfo, a11yClickKey: boolean) {\n eventInfo.eiack = a11yClickKey;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function getResolved(eventInfo: EventInfo) {\n return eventInfo.eir;\n}\n\n/** Added for readability when accessing stable property names. */\nexport function setResolved(eventInfo: EventInfo, resolved: boolean) {\n eventInfo.eir = resolved;\n}\n\n/** Clones an `EventInfo` */\nexport function cloneEventInfo(eventInfo: EventInfo): EventInfo {\n return {\n eventType: eventInfo.eventType,\n event: eventInfo.event,\n targetElement: eventInfo.targetElement,\n eic: eventInfo.eic,\n eia: eventInfo.eia,\n timeStamp: eventInfo.timeStamp,\n eirp: eventInfo.eirp,\n eiack: eventInfo.eiack,\n eir: eventInfo.eir,\n };\n}\n\n/**\n * Utility function for creating an `EventInfo`.\n *\n * This can be used from code-size sensitive compilation units, as taking\n * parameters vs. an `Object` literal reduces code size.\n */\nexport function createEventInfoFromParameters(\n eventType: string,\n event: Event,\n targetElement: Element,\n container: Element,\n timestamp: number,\n action?: ActionInfoInternal,\n isReplay?: boolean,\n a11yClickKey?: boolean,\n): EventInfo {\n return {\n eventType,\n event,\n targetElement,\n eic: container,\n timeStamp: timestamp,\n eia: action,\n eirp: isReplay,\n eiack: a11yClickKey,\n };\n}\n\n/**\n * Utility function for creating an `EventInfo`.\n *\n * This should be used in compilation units that are less sensitive to code\n * size.\n */\nexport function createEventInfo({\n eventType,\n event,\n targetElement,\n container,\n timestamp,\n action,\n isReplay,\n a11yClickKey,\n}: {\n eventType: string;\n event: Event;\n targetElement: Element;\n container: Element;\n timestamp: number;\n action?: ActionInfo;\n isReplay?: boolean;\n a11yClickKey?: boolean;\n}): EventInfo {\n return {\n eventType,\n event,\n targetElement,\n eic: container,\n timeStamp: timestamp,\n eia: action ? [action.name, action.element] : undefined,\n eirp: isReplay,\n eiack: a11yClickKey,\n };\n}\n\n/**\n * Utility class around an `EventInfo`.\n *\n * This should be used in compilation units that are less sensitive to code\n * size.\n */\nexport class EventInfoWrapper {\n constructor(readonly eventInfo: EventInfo) {}\n\n getEventType() {\n return getEventType(this.eventInfo);\n }\n\n setEventType(eventType: string) {\n setEventType(this.eventInfo, eventType);\n }\n\n getEvent() {\n return getEvent(this.eventInfo);\n }\n\n setEvent(event: Event) {\n setEvent(this.eventInfo, event);\n }\n\n getTargetElement() {\n return getTargetElement(this.eventInfo);\n }\n\n setTargetElement(targetElement: Element) {\n setTargetElement(this.eventInfo, targetElement);\n }\n\n getContainer() {\n return getContainer(this.eventInfo);\n }\n\n setContainer(container: Element) {\n setContainer(this.eventInfo, container);\n }\n getTimestamp() {\n return getTimestamp(this.eventInfo);\n }\n\n setTimestamp(timestamp: number) {\n setTimestamp(this.eventInfo, timestamp);\n }\n\n getAction() {\n const action = getAction(this.eventInfo);\n if (!action) return undefined;\n return {\n name: action[0],\n element: action[1],\n };\n }\n\n setAction(action: ActionInfo | undefined) {\n if (!action) {\n unsetAction(this.eventInfo);\n return;\n }\n setAction(this.eventInfo, action.name, action.element);\n }\n\n getIsReplay() {\n return getIsReplay(this.eventInfo);\n }\n\n setIsReplay(replay: boolean) {\n setIsReplay(this.eventInfo, replay);\n }\n\n getResolved() {\n return getResolved(this.eventInfo);\n }\n\n setResolved(resolved: boolean) {\n setResolved(this.eventInfo, resolved);\n }\n\n clone() {\n return new EventInfoWrapper(cloneEventInfo(this.eventInfo));\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Attribute} from './attribute';\nimport {Char} from './char';\nimport {EventType} from './event_type';\nimport {Property} from './property';\nimport * as a11yClick from './a11y_click';\nimport * as cache from './cache';\nimport * as eventInfoLib from './event_info';\nimport * as eventLib from './event';\n\n/**\n * Since maps from event to action are immutable we can use a single map\n * to represent the empty map.\n */\nconst EMPTY_ACTION_MAP: {[key: string]: string} = {};\n\n/**\n * This regular expression matches a semicolon.\n */\nconst REGEXP_SEMICOLON = /\\s*;\\s*/;\n\n/** If no event type is defined, defaults to `click`. */\nconst DEFAULT_EVENT_TYPE: string = EventType.CLICK;\n\n/** Resolves actions for Events. */\nexport class ActionResolver {\n private a11yClickSupport: boolean = false;\n private clickModSupport: boolean = true;\n private readonly syntheticMouseEventSupport: boolean;\n\n private updateEventInfoForA11yClick?: (eventInfo: eventInfoLib.EventInfo) => void = undefined;\n\n private preventDefaultForA11yClick?: (eventInfo: eventInfoLib.EventInfo) => void = undefined;\n\n private populateClickOnlyAction?: (\n actionElement: Element,\n eventInfo: eventInfoLib.EventInfo,\n actionMap: {[key: string]: string | undefined},\n ) => void = undefined;\n\n constructor({\n syntheticMouseEventSupport = false,\n clickModSupport = true,\n }: {\n syntheticMouseEventSupport?: boolean;\n clickModSupport?: boolean;\n } = {}) {\n this.syntheticMouseEventSupport = syntheticMouseEventSupport;\n this.clickModSupport = clickModSupport;\n }\n\n resolveEventType(eventInfo: eventInfoLib.EventInfo) {\n // We distinguish modified and plain clicks in order to support the\n // default browser behavior of modified clicks on links; usually to\n // open the URL of the link in new tab or new window on ctrl/cmd\n // click. A DOM 'click' event is mapped to the jsaction 'click'\n // event iff there is no modifier present on the event. If there is\n // a modifier, it's mapped to 'clickmod' instead.\n //\n // It's allowed to omit the event in the jsaction attribute. In that\n // case, 'click' is assumed. Thus the following two are equivalent:\n //\n // <a href=\"someurl\" jsaction=\"gna.fu\">\n // <a href=\"someurl\" jsaction=\"click:gna.fu\">\n //\n // For unmodified clicks, EventContract invokes the jsaction\n // 'gna.fu'. For modified clicks, EventContract won't find a\n // suitable action and leave the event to be handled by the\n // browser.\n //\n // In order to also invoke a jsaction handler for a modifier click,\n // 'clickmod' needs to be used:\n //\n // <a href=\"someurl\" jsaction=\"clickmod:gna.fu\">\n //\n // EventContract invokes the jsaction 'gna.fu' for modified\n // clicks. Unmodified clicks are left to the browser.\n //\n // In order to set up the event contract to handle both clickonly and\n // clickmod, only addEvent(EventType.CLICK) is necessary.\n //\n // In order to set up the event contract to handle click,\n // addEvent() is necessary for CLICK, KEYDOWN, and KEYPRESS event types. If\n // a11y click support is enabled, addEvent() will set up the appropriate key\n // event handler automatically.\n if (\n this.clickModSupport &&\n eventInfoLib.getEventType(eventInfo) === EventType.CLICK &&\n eventLib.isModifiedClickEvent(eventInfoLib.getEvent(eventInfo))\n ) {\n eventInfoLib.setEventType(eventInfo, EventType.CLICKMOD);\n } else if (this.a11yClickSupport) {\n this.updateEventInfoForA11yClick!(eventInfo);\n }\n }\n\n resolveAction(eventInfo: eventInfoLib.EventInfo) {\n if (eventInfoLib.getResolved(eventInfo)) {\n return;\n }\n this.populateAction(eventInfo, eventInfoLib.getTargetElement(eventInfo));\n eventInfoLib.setResolved(eventInfo, true);\n }\n\n resolveParentAction(eventInfo: eventInfoLib.EventInfo) {\n const action = eventInfoLib.getAction(eventInfo);\n const actionElement = action && eventInfoLib.getActionElement(action);\n eventInfoLib.unsetAction(eventInfo);\n const parentNode = actionElement && this.getParentNode(actionElement);\n if (!parentNode) {\n return;\n }\n this.populateAction(eventInfo, parentNode);\n }\n\n /**\n * Searches for a jsaction that the DOM event maps to and creates an\n * object containing event information used for dispatching by\n * jsaction.Dispatcher. This method populates the `action` and `actionElement`\n * fields of the EventInfo object passed in by finding the first\n * jsaction attribute above the target Node of the event, and below\n * the container Node, that specifies a jsaction for the event\n * type. If no such jsaction is found, then action is undefined.\n *\n * @param eventInfo `EventInfo` to set `action` and `actionElement` if an\n * action is found on any `Element` in the path of the `Event`.\n */\n private populateAction(eventInfo: eventInfoLib.EventInfo, currentTarget: Element) {\n let actionElement: Element | null = currentTarget;\n while (actionElement && actionElement !== eventInfoLib.getContainer(eventInfo)) {\n if (actionElement.nodeType === Node.ELEMENT_NODE) {\n this.populateActionOnElement(actionElement, eventInfo);\n }\n\n if (eventInfoLib.getAction(eventInfo)) {\n // An event is handled by at most one jsaction. Thus we stop at the\n // first matching jsaction specified in a jsaction attribute up the\n // ancestor chain of the event target node.\n break;\n }\n actionElement = this.getParentNode(actionElement);\n }\n\n const action = eventInfoLib.getAction(eventInfo);\n if (!action) {\n // No action found.\n return;\n }\n\n if (this.a11yClickSupport) {\n this.preventDefaultForA11yClick!(eventInfo);\n }\n\n // We attempt to handle the mouseenter/mouseleave events here by\n // detecting whether the mouseover/mouseout events correspond to\n // entering/leaving an element.\n if (this.syntheticMouseEventSupport) {\n if (\n eventInfoLib.getEventType(eventInfo) === EventType.MOUSEENTER ||\n eventInfoLib.getEventType(eventInfo) === EventType.MOUSELEAVE ||\n eventInfoLib.getEventType(eventInfo) === EventType.POINTERENTER ||\n eventInfoLib.getEventType(eventInfo) === EventType.POINTERLEAVE\n ) {\n // We attempt to handle the mouseenter/mouseleave events here by\n // detecting whether the mouseover/mouseout events correspond to\n // entering/leaving an element.\n if (\n eventLib.isMouseSpecialEvent(\n eventInfoLib.getEvent(eventInfo),\n eventInfoLib.getEventType(eventInfo),\n eventInfoLib.getActionElement(action),\n )\n ) {\n // If both mouseover/mouseout and mouseenter/mouseleave events are\n // enabled, two separate handlers for mouseover/mouseout are\n // registered. Both handlers will see the same event instance\n // so we create a copy to avoid interfering with the dispatching of\n // the mouseover/mouseout event.\n const copiedEvent = eventLib.createMouseSpecialEvent(\n eventInfoLib.getEvent(eventInfo),\n eventInfoLib.getActionElement(action),\n );\n eventInfoLib.setEvent(eventInfo, copiedEvent);\n // Since the mouseenter/mouseleave events do not bubble, the target\n // of the event is technically the `actionElement` (the node with the\n // `jsaction` attribute)\n eventInfoLib.setTargetElement(eventInfo, eventInfoLib.getActionElement(action));\n } else {\n eventInfoLib.unsetAction(eventInfo);\n }\n }\n }\n }\n\n /**\n * Walk to the parent node, unless the node has a different owner in\n * which case we walk to the owner. Attempt to walk to host of a\n * shadow root if needed.\n */\n private getParentNode(element: Element): Element | null {\n const owner = element[Property.OWNER];\n if (owner) {\n return owner as Element;\n }\n const parentNode = element.parentNode;\n if (parentNode?.nodeName === '#document-fragment') {\n return (parentNode as ShadowRoot | null)?.host ?? null;\n }\n return parentNode as Element | null;\n }\n\n /**\n * Accesses the jsaction map on a node and retrieves the name of the\n * action the given event is mapped to, if any. It parses the\n * attribute value and stores it in a property on the node for\n * subsequent retrieval without re-parsing and re-accessing the\n * attribute.\n *\n * @param actionElement The DOM node to retrieve the jsaction map from.\n * @param eventInfo `EventInfo` to set `action` and `actionElement` if an\n * action is found on the `actionElement`.\n */\n private populateActionOnElement(actionElement: Element, eventInfo: eventInfoLib.EventInfo) {\n const actionMap = this.parseActions(actionElement);\n\n const actionName = actionMap[eventInfoLib.getEventType(eventInfo)];\n if (actionName !== undefined) {\n eventInfoLib.setAction(eventInfo, actionName, actionElement);\n }\n\n if (this.a11yClickSupport) {\n this.populateClickOnlyAction!(actionElement, eventInfo, actionMap);\n }\n }\n\n /**\n * Parses and caches an element's jsaction element into a map.\n *\n * This is primarily for internal use.\n *\n * @param actionElement The DOM node to retrieve the jsaction map from.\n * @return Map from event to qualified name of the jsaction bound to it.\n */\n private parseActions(actionElement: Element): {[key: string]: string | undefined} {\n let actionMap: {[key: string]: string | undefined} | undefined = cache.get(actionElement);\n if (!actionMap) {\n const jsactionAttribute = actionElement.getAttribute(Attribute.JSACTION);\n if (!jsactionAttribute) {\n actionMap = EMPTY_ACTION_MAP;\n cache.set(actionElement, actionMap);\n } else {\n actionMap = cache.getParsed(jsactionAttribute);\n if (!actionMap) {\n actionMap = {};\n const values = jsactionAttribute.split(REGEXP_SEMICOLON);\n for (let idx = 0; idx < values.length; idx++) {\n const value = values[idx];\n if (!value) {\n continue;\n }\n const colon = value.indexOf(Char.EVENT_ACTION_SEPARATOR);\n const hasColon = colon !== -1;\n const type = hasColon ? value.substr(0, colon).trim() : DEFAULT_EVENT_TYPE;\n const action = hasColon ? value.substr(colon + 1).trim() : value;\n actionMap[type] = action;\n }\n cache.setParsed(jsactionAttribute, actionMap);\n }\n cache.set(actionElement, actionMap);\n }\n }\n return actionMap;\n }\n\n addA11yClickSupport(\n updateEventInfoForA11yClick: typeof a11yClick.updateEventInfoForA11yClick,\n preventDefaultForA11yClick: typeof a11yClick.preventDefaultForA11yClick,\n populateClickOnlyAction: typeof a11yClick.populateClickOnlyAction,\n ) {\n this.a11yClickSupport = true;\n this.updateEventInfoForA11yClick = updateEventInfoForA11yClick;\n this.preventDefaultForA11yClick = preventDefaultForA11yClick;\n this.populateClickOnlyAction = populateClickOnlyAction;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * @fileoverview An enum to control who can call certain jsaction APIs.\n */\n\nexport enum Restriction {\n I_AM_THE_JSACTION_FRAMEWORK,\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {EventInfo, EventInfoWrapper} from './event_info';\nimport {EventType} from './event_type';\nimport {Restriction} from './restriction';\nimport {UnrenamedEventContract} from './eventcontract';\nimport * as eventLib from './event';\nimport {ActionResolver} from './action_resolver';\n\n/**\n * A replayer is a function that is called when there are queued events,\n * either from the `EventContract` or when there are no detected handlers.\n */\nexport type Replayer = (eventInfoWrappers: EventInfoWrapper[]) => void;\n\n/**\n * Receives a DOM event, determines the jsaction associated with the source\n * element of the DOM event, and invokes the handler associated with the\n * jsaction.\n */\nexport class Dispatcher {\n // The ActionResolver to use to resolve actions.\n private actionResolver?: ActionResolver;\n\n /** The replayer function to be called when there are queued events. */\n private eventReplayer?: Replayer;\n\n /** Whether the event replay is scheduled. */\n private eventReplayScheduled = false;\n\n /** The queue of events. */\n private readonly replayEventInfoWrappers: EventInfoWrapper[] = [];\n\n /**\n * Options are:\n * - `eventReplayer`: When the event contract dispatches replay events\n * to the Dispatcher, the Dispatcher collects them and in the next tick\n * dispatches them to the `eventReplayer`. Defaults to dispatching to `dispatchDelegate`.\n * @param dispatchDelegate A function that should handle dispatching an `EventInfoWrapper` to handlers.\n */\n constructor(\n private readonly dispatchDelegate: (eventInfoWrapper: EventInfoWrapper) => void,\n {\n actionResolver,\n eventReplayer,\n }: {actionResolver?: ActionResolver; eventReplayer?: Replayer} = {},\n ) {\n this.actionResolver = actionResolver;\n this.eventReplayer = eventReplayer;\n }\n\n /**\n * Receives an event or the event queue from the EventContract. The event\n * queue is copied and it attempts to replay.\n * If event info is passed in it looks for an action handler that can handle\n * the given event. If there is no handler registered queues the event and\n * checks if a loader is registered for the given namespace. If so, calls it.\n *\n * Alternatively, if in global dispatch mode, calls all registered global\n * handlers for the appropriate event type.\n *\n * The three functionalities of this call are deliberately not split into\n * three methods (and then declared as an abstract interface), because the\n * interface is used by EventContract, which lives in a different jsbinary.\n * Therefore the interface between the three is defined entirely in terms that\n * are invariant under jscompiler processing (Function and Array, as opposed\n * to a custom type with method names).\n *\n * @param eventInfo The info for the event that triggered this call or the\n * queue of events from EventContract.\n */\n dispatch(eventInfo: EventInfo): void {\n const eventInfoWrapper = new EventInfoWrapper(eventInfo);\n this.actionResolver?.resolveEventType(eventInfo);\n this.actionResolver?.resolveAction(eventInfo);\n const action = eventInfoWrapper.getAction();\n if (action && shouldPreventDefaultBeforeDispatching(action.element, eventInfoWrapper)) {\n eventLib.preventDefault(eventInfoWrapper.getEvent());\n }\n if (this.eventReplayer && eventInfoWrapper.getIsReplay()) {\n this.scheduleEventInfoWrapperReplay(eventInfoWrapper);\n return;\n }\n this.dispatchDelegate(eventInfoWrapper);\n }\n\n /**\n * Schedules an `EventInfoWrapper` for replay. The replaying will happen in its own\n * stack once the current flow cedes control. This is done to mimic\n * browser event handling.\n */\n private scheduleEventInfoWrapperReplay(eventInfoWrapper: EventInfoWrapper) {\n this.replayEventInfoWrappers.push(eventInfoWrapper);\n if (this.eventReplayScheduled) {\n return;\n }\n this.eventReplayScheduled = true;\n Promise.resolve().then(() => {\n this.eventReplayScheduled = false;\n this.eventReplayer!(this.replayEventInfoWrappers);\n });\n }\n}\n\n/**\n * Creates an `EventReplayer` that calls the `replay` function for every `eventInfoWrapper` in\n * the queue.\n */\nexport function createEventReplayer(replay: (eventInfoWrapper: EventInfoWrapper) => void) {\n return (eventInfoWrappers: EventInfoWrapper[]) => {\n for (const eventInfoWrapper of eventInfoWrappers) {\n replay(eventInfoWrapper);\n }\n };\n}\n\n/**\n * Returns true if the default action of this event should be prevented before\n * this event is dispatched.\n */\nfunction shouldPreventDefaultBeforeDispatching(\n actionElement: Element,\n eventInfoWrapper: EventInfoWrapper,\n): boolean {\n // Prevent browser from following <a> node links if a jsaction is present\n // and we are dispatching the action now. Note that the targetElement may be\n // a child of an anchor that has a jsaction attached. For that reason, we\n // need to check the actionElement rather than the targetElement.\n return (\n actionElement.tagName === 'A' &&\n (eventInfoWrapper.getEventType() === EventType.CLICK ||\n eventInfoWrapper.getEventType() === EventType.CLICKMOD)\n );\n}\n\n/**\n * Registers deferred functionality for an EventContract and a Jsaction\n * Dispatcher.\n */\nexport function registerDispatcher(eventContract: UnrenamedEventContract, dispatcher: Dispatcher) {\n eventContract.ecrd((eventInfo: EventInfo) => {\n dispatcher.dispatch(eventInfo);\n }, Restriction.I_AM_THE_JSACTION_FRAMEWORK);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {ActionResolver} from './action_resolver';\nimport {Dispatcher} from './dispatcher';\nimport {EventInfo, EventInfoWrapper} from './event_info';\nimport {isCaptureEventType} from './event_type';\nimport {UnrenamedEventContract} from './eventcontract';\nimport {Restriction} from './restriction';\n\n// Necessary to make the `ngDevMode` global types available.\nimport '../../../src/util/ng_dev_mode';\n\n/**\n * A replayer is a function that is called when there are queued events, from the `EventContract`.\n */\nexport type Replayer = (eventInfoWrappers: Event[]) => void;\n\n/** An internal symbol used to indicate whether propagation should be stopped or not. */\nexport const PROPAGATION_STOPPED_SYMBOL: unique symbol =\n /* @__PURE__ */ Symbol.for('propagationStopped');\n\n/** Extra event phases beyond what the browser provides. */\nexport const EventPhase = {\n REPLAY: 101,\n};\n\nconst PREVENT_DEFAULT_ERROR_MESSAGE_DETAILS =\n ' Because event replay occurs after browser dispatch, `preventDefault` would have no ' +\n 'effect. You can check whether an event is being replayed by accessing the event phase: ' +\n '`event.eventPhase === EventPhase.REPLAY`.';\nconst PREVENT_DEFAULT_ERROR_MESSAGE = `\\`preventDefault\\` called during event replay.`;\nconst COMPOSED_PATH_ERROR_MESSAGE_DETAILS =\n ' Because event replay occurs after browser ' +\n 'dispatch, `composedPath()` will be empty. Iterate parent nodes from `event.target` or ' +\n '`event.currentTarget` if you need to check elements in the event path.';\nconst COMPOSED_PATH_ERROR_MESSAGE = `\\`composedPath\\` called during event replay.`;\n\ndeclare global {\n interface Event {\n [PROPAGATION_STOPPED_SYMBOL]?: boolean;\n }\n}\n\n/**\n * A dispatcher that uses browser-based `Event` semantics, for example bubbling, `stopPropagation`,\n * `currentTarget`, etc.\n */\nexport class EventDispatcher {\n private readonly actionResolver: ActionResolver;\n\n private readonly dispatcher: Dispatcher;\n\n constructor(\n private readonly dispatchDelegate: (event: Event, actionName: string) => void,\n private readonly clickModSupport = true,\n ) {\n this.actionResolver = new ActionResolver({clickModSupport});\n this.dispatcher = new Dispatcher(\n (eventInfoWrapper: EventInfoWrapper) => {\n this.dispatchToDelegate(eventInfoWrapper);\n },\n {\n actionResolver: this.actionResolver,\n },\n );\n }\n\n /**\n * The entrypoint for the `EventContract` dispatch.\n */\n dispatch(eventInfo: EventInfo): void {\n this.dispatcher.dispatch(eventInfo);\n }\n\n /** Internal method that does basic disaptching. */\n private dispatchToDelegate(eventInfoWrapper: EventInfoWrapper) {\n if (eventInfoWrapper.getIsReplay()) {\n prepareEventForReplay(eventInfoWrapper);\n }\n prepareEventForBubbling(eventInfoWrapper);\n while (eventInfoWrapper.getAction()) {\n prepareEventForDispatch(eventInfoWrapper);\n // If this is a capture event, ONLY dispatch if the action element is the target.\n if (\n isCaptureEventType(eventInfoWrapper.getEventType()) &&\n eventInfoWrapper.getAction()!.element !== eventInfoWrapper.getTargetElement()\n ) {\n return;\n }\n this.dispatchDelegate(eventInfoWrapper.getEvent(), eventInfoWrapper.getAction()!.name);\n if (propagationStopped(eventInfoWrapper)) {\n return;\n }\n this.actionResolver.resolveParentAction(eventInfoWrapper.eventInfo);\n }\n }\n}\n\nfunction prepareEventForBubbling(eventInfoWrapper: EventInfoWrapper) {\n const event = eventInfoWrapper.getEvent();\n const originalStopPropagation = eventInfoWrapper.getEvent().stopPropagation.bind(event);\n const stopPropagation = () => {\n event[PROPAGATION_STOPPED_SYMBOL] = true;\n originalStopPropagation();\n };\n patchEventInstance(event, 'stopPropagation', stopPropagation);\n patchEventInstance(event, 'stopImmediatePropagation', stopPropagation);\n}\n\nfunction propagationStopped(eventInfoWrapper: EventInfoWrapper) {\n const event = eventInfoWrapper.getEvent();\n return !!event[PROPAGATION_STOPPED_SYMBOL];\n}\n\nfunction prepareEventForReplay(eventInfoWrapper: EventInfoWrapper) {\n const event = eventInfoWrapper.getEvent();\n const target = eventInfoWrapper.getTargetElement();\n const originalPreventDefault = event.preventDefault.bind(event);\n patchEventInstance(event, 'target', target);\n patchEventInstance(event, 'eventPhase', EventPhase.REPLAY);\n patchEventInstance(event, 'preventDefault', () => {\n originalPreventDefault();\n throw new Error(\n PREVENT_DEFAULT_ERROR_MESSAGE + (ngDevMode ? PREVENT_DEFAULT_ERROR_MESSAGE_DETAILS : ''),\n );\n });\n patchEventInstance(event, 'composedPath', () => {\n throw new Error(\n COMPOSED_PATH_ERROR_MESSAGE + (ngDevMode ? COMPOSED_PATH_ERROR_MESSAGE_DETAILS : ''),\n );\n });\n}\n\nfunction prepareEventForDispatch(eventInfoWrapper: EventInfoWrapper) {\n const event = eventInfoWrapper.getEvent();\n const currentTarget = eventInfoWrapper.getAction()?.element;\n if (currentTarget) {\n patchEventInstance(event, 'currentTarget', currentTarget, {\n // `currentTarget` is going to get reassigned every dispatch.\n configurable: true,\n });\n }\n}\n\n/**\n * Patch `Event` instance during non-standard `Event` dispatch. This patches just the `Event`\n * instance that the browser created, it does not patch global properties or methods.\n *\n * This is necessary because dispatching an `Event` outside of browser dispatch results in\n * incorrect properties and methods that need to be polyfilled or do not work.\n *\n * JSAction dispatch adds two extra \"phases\" to event dispatch:\n * 1. Event delegation - the event is being dispatched by a delegating event handler on a container\n * (typically `window.document.documentElement`), to a delegated event handler on some child\n * element. Certain `Event` properties will be unintuitive, such as `currentTarget`, which would\n * be the container rather than the child element. Bubbling would also not work. In order to\n * emulate the browser, these properties and methods on the `Event` are patched.\n * 2. Event replay - the event is being dispatched by the framework once the handlers have been\n * loaded (during hydration, or late-loaded). Certain `Event` properties can be unset by the\n * browser because the `Event` is no longer actively being dispatched, such as `target`. Other\n * methods have no effect because the `Event` has already been dispatched, such as\n * `preventDefault`. Bubbling would also not work. These properties and methods are patched,\n * either to fill in information that the browser may have removed, or to throw errors in methods\n * that no longer behave as expected.\n */\nfunction patchEventInstance<T>(\n event: Event,\n property: string,\n value: T,\n {configurable = false}: {configurable?: boolean} = {},\n) {\n Object.defineProperty(event, property, {value, configurable});\n}\n\n/**\n * Registers deferred functionality for an EventContract and a Jsaction\n * Dispatcher.\n */\nexport function registerDispatcher(\n eventContract: UnrenamedEventContract,\n dispatcher: EventDispatcher,\n) {\n eventContract.ecrd((eventInfo: EventInfo) => {\n dispatcher.dispatch(eventInfo);\n }, Restriction.I_AM_THE_JSACTION_FRAMEWORK);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {createEventInfoFromParameters, EventInfo} from './event_info';\n\nexport declare interface EarlyJsactionDataContainer {\n _ejsa?: EarlyJsactionData;\n _ejsas?: {[appId: string]: EarlyJsactionData | undefined};\n}\n\ndeclare global {\n interface Window {\n _ejsa?: EarlyJsactionData;\n _ejsas?: {[appId: string]: EarlyJsactionData | undefined};\n }\n}\n\n/**\n * Defines the early jsaction data types.\n */\nexport declare interface EarlyJsactionData {\n /** List used to keep track of the early JSAction event types. */\n et: string[];\n\n /** List used to keep track of the early JSAction capture event types. */\n etc: string[];\n\n /** Early JSAction handler for all events. */\n h: (event: Event) => void;\n\n /** Dispatcher handler. Initializes to populating `q`. */\n d: (eventInfo: EventInfo) => void;\n\n /** List used to push `EventInfo` objects if the dispatcher is not registered. */\n q: EventInfo[];\n\n /** Container for listening to events. */\n c: HTMLElement;\n}\n\n/**\n * EarlyEventContract intercepts events in the bubbling phase at the\n * boundary of the document body. This mapping will be passed to the\n * late-loaded EventContract.\n */\nexport class EarlyEventContract {\n constructor(\n private readonly dataContainer: EarlyJsactionDataContainer = window,\n container = window.document.documentElement,\n ) {\n dataContainer._ejsa = createEarlyJsactionData(container);\n }\n\n /**\n * Installs a list of event types for container .\n */\n addEvents(types: string[], capture?: boolean) {\n addEvents(this.dataContainer._ejsa!, types, capture);\n }\n}\n\n/** Creates an `EarlyJsactionData` object. */\nexport function createEarlyJsactionData(container: HTMLElement) {\n const q: EventInfo[] = [];\n const d = (eventInfo: EventInfo) => {\n q.push(eventInfo);\n };\n const h = (event: Event) => {\n d(\n createEventInfoFromParameters(\n event.type,\n event,\n event.target as Element,\n container,\n Date.now(),\n ),\n );\n };\n return {\n c: container,\n q,\n et: [],\n etc: [],\n d,\n h,\n };\n}\n\n/** Add all the events to the container stored in the `EarlyJsactionData`. */\nexport function addEvents(\n earlyJsactionData: EarlyJsactionData,\n types: string[],\n capture?: boolean,\n) {\n for (let i = 0; i < types.length; i++) {\n const eventType = types[i];\n const eventTypes = capture ? earlyJsactionData.etc : earlyJsactionData.et;\n eventTypes.push(eventType);\n earlyJsactionData.c.addEventListener(eventType, earlyJsactionData.h, capture);\n }\n}\n\n/** Get the queued `EventInfo` objects that were dispatched before a dispatcher was registered. */\nexport function getQueuedEventInfos(earlyJsactionData: EarlyJsactionData | undefined) {\n return earlyJsactionData?.q ?? [];\n}\n\n/** Register a different dispatcher function on the `EarlyJsactionData`. */\nexport function registerDispatcher(\n earlyJsactionData: EarlyJsactionData | undefined,\n dispatcher: (eventInfo: EventInfo) => void,\n) {\n if (!earlyJsactionData) {\n return;\n }\n earlyJsactionData.d = dispatcher;\n}\n\n/** Removes all event listener handlers. */\nexport function removeAllEventListeners(earlyJsactionData: EarlyJsactionData | undefined) {\n if (!earlyJsactionData) {\n return;\n }\n removeEventListeners(earlyJsactionData.c, earlyJsactionData.et, earlyJsactionData.h);\n removeEventListeners(earlyJsactionData.c, earlyJsactionData.etc, earlyJsactionData.h, true);\n}\n\nfunction removeEventListeners(\n container: HTMLElement,\n eventTypes: string[],\n earlyEventHandler: (e: Event) => void,\n capture?: boolean,\n) {\n for (let i = 0; i < eventTypes.length; i++) {\n container.removeEventListener(eventTypes[i], earlyEventHandler, /* useCapture */ capture);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * @define Support for the non-bubbling mouseenter and mouseleave events. This\n * flag can be overridden in a build rule.\n */\nexport const MOUSE_SPECIAL_SUPPORT = false;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * @fileoverview Implements the local event handling contract. This\n * allows DOM objects in a container that enters into this contract to\n * define event handlers which are executed in a local context.\n *\n * One EventContract instance can manage the contract for multiple\n * containers, which are added using the addContainer() method.\n *\n * Events can be registered using the addEvent() method.\n *\n * A Dispatcher is added using the registerDispatcher() method. Until there is\n * a dispatcher, events are queued. The idea is that the EventContract\n * class is inlined in the HTML of the top level page and instantiated\n * right after the start of <body>. The Dispatcher class is contained\n * in the external deferred js, and instantiated and registered with\n * EventContract when the external javascript in the page loads. The\n * external javascript will also register the jsaction handlers, which\n * then pick up the queued events at the time of registration.\n *\n * Since this class is meant to be inlined in the main page HTML, the\n * size of the binary compiled from this file MUST be kept as small as\n * possible and thus its dependencies to a minimum.\n */\n\nimport {EarlyJsactionData, removeAllEventListeners} from './earlyeventcontract';\nimport * as eventLib from './event';\nimport {EventContractContainerManager} from './event_contract_container';\nimport {MOUSE_SPECIAL_SUPPORT} from './event_contract_defines';\nimport * as eventInfoLib from './event_info';\nimport {MOUSE_SPECIAL_EVENT_TYPES} from './event_type';\nimport {Restriction} from './restriction';\n\n/**\n * The API of an EventContract that is safe to call from any compilation unit.\n */\nexport declare interface UnrenamedEventContract {\n // Alias for Jsction EventContract registerDispatcher.\n ecrd(dispatcher: Dispatcher, restriction: Restriction): void;\n}\n\n/** A function that is called to handle events captured by the EventContract. */\nexport type Dispatcher = (eventInfo: eventInfoLib.EventInfo, globalDispatch?: boolean) => void;\n\n/**\n * A function that handles an event dispatched from the browser.\n *\n * eventType: May differ from `event.type` if JSAction uses a\n * short-hand name or is patching over an non-bubbling event with a bubbling\n * variant.\n * event: The native browser event.\n * container: The container for this dispatch.\n */\ntype EventHandler = (eventType: string, event: Event, container: Element) => void;\n\n/**\n * EventContract intercepts events in the bubbling phase at the\n * boundary of a container element, and maps them to generic actions\n * which are specified using the custom jsaction attribute in\n * HTML. Behavior of the application is then specified in terms of\n * handler for such actions, cf. jsaction.Dispatcher in dispatcher.js.\n *\n * This has several benefits: (1) No DOM event handlers need to be\n * registered on the specific elements in the UI. (2) The set of\n * events that the application has to handle can be specified in terms\n * of the semantics of the application, rather than in terms of DOM\n * events. (3) Invocation of handlers can be delayed and handlers can\n * be delay loaded in a generic way.\n */\nexport class EventContract implements UnrenamedEventContract {\n static MOUSE_SPECIAL_SUPPORT = MOUSE_SPECIAL_SUPPORT;\n\n private containerManager: EventContractContainerManager | null;\n\n /**\n * The DOM events which this contract covers. Used to prevent double\n * registration of event types. The value of the map is the\n * internally created DOM event handler function that handles the\n * DOM events. See addEvent().\n *\n */\n private eventHandlers: {[key: string]: EventHandler} = {};\n\n private browserEventTypeToExtraEventTypes: {[key: string]: string[]} = {};\n\n /**\n * The dispatcher function. Events are passed to this function for\n * handling once it was set using the registerDispatcher() method. This is\n * done because the function is passed from another jsbinary, so passing the\n * instance and invoking the method here would require to leave the method\n * unobfuscated.\n */\n private dispatcher: Dispatcher | null = null;\n\n /**\n * The list of suspended `EventInfo` that will be dispatched\n * as soon as the `Dispatcher` is registered.\n */\n private queuedEventInfos: eventInfoLib.EventInfo[] | null = [];\n\n constructor(containerManager: EventContractContainerManager) {\n this.containerManager = containerManager;\n }\n\n private handleEvent(eventType: string, event: Event, container: Element) {\n const eventInfo = eventInfoLib.createEventInfoFromParameters(\n /* eventType= */ eventType,\n /* event= */ event,\n /* targetElement= */ event.target as Element,\n /* container= */ container,\n /* timestamp= */ Date.now(),\n );\n this.handleEventInfo(eventInfo);\n }\n\n /**\n * Handle an `EventInfo`.\n */\n private handleEventInfo(eventInfo: eventInfoLib.EventInfo) {\n if (!this.dispatcher) {\n // All events are queued when the dispatcher isn't yet loaded.\n eventInfoLib.setIsReplay(eventInfo, true);\n this.queuedEventInfos?.push(eventInfo);\n return;\n }\n this.dispatcher(eventInfo);\n }\n\n /**\n * Enables jsaction handlers to be called for the event type given by\n * name.\n *\n * If the event is already registered, this does nothing.\n *\n * @param prefixedEventType If supplied, this event is used in\n * the actual browser event registration instead of the name that is\n * exposed to jsaction. Use this if you e.g. want users to be able\n * to subscribe to jsaction=\"transitionEnd:foo\" while the underlying\n * event is webkitTransitionEnd in one browser and mozTransitionEnd\n * in another.\n *\n * @param passive A boolean value that, if `true`, indicates that the event\n * handler will never call `preventDefault()`.\n */\n addEvent(eventType: string, prefixedEventType?: string, passive?: boolean) {\n if (eventType in this.eventHandlers || !this.containerManager) {\n return;\n }\n\n if (!EventContract.MOUSE_SPECIAL_SUPPORT && MOUSE_SPECIAL_EVENT_TYPES.indexOf(eventType) >= 0) {\n return;\n }\n\n const eventHandler = (eventType: string, event: Event, container: Element) => {\n this.handleEvent(eventType, event, container);\n };\n\n // Store the callback to allow us to replay events.\n this.eventHandlers[eventType] = eventHandler;\n\n const browserEventType = eventLib.getBrowserEventType(prefixedEventType || eventType);\n\n if (browserEventType !== eventType) {\n const eventTypes = this.browserEventTypeToExtraEventTypes[browserEventType] || [];\n eventTypes.push(eventType);\n this.browserEventTypeToExtraEventTypes[browserEventType] = eventTypes;\n }\n\n this.containerManager.addEventListener(\n browserEventType,\n (element: Element) => {\n return (event: Event) => {\n eventHandler(eventType, event, element);\n };\n },\n passive,\n );\n }\n\n /**\n * Gets the queued early events and replay them using the appropriate handler\n * in the provided event contract. Once all the events are replayed, it cleans\n * up the early contract.\n */\n replayEarlyEvents(earlyJsactionData: EarlyJsactionData | undefined = window._ejsa) {\n // Check if the early contract is present and prevent calling this function\n // more than once.\n if (!earlyJsactionData) {\n return;\n }\n\n // Replay the early contract events.\n this.replayEarlyEventInfos(earlyJsactionData.q);\n\n // Clean up the early contract.\n removeAllEventListeners(earlyJsactionData);\n delete window._ejsa;\n }\n\n /**\n * Replays all the early `EventInfo` objects, dispatching them through the normal\n * `EventContract` flow.\n */\n replayEarlyEventInfos(earlyEventInfos: eventInfoLib.EventInfo[]) {\n for (let i = 0; i < earlyEventInfos.length; i++) {\n const earlyEventInfo: eventInfoLib.EventInfo = earlyEventInfos[i];\n const eventTypes = this.getEventTypesForBrowserEventType(earlyEventInfo.eventType);\n for (let j = 0; j < eventTypes.length; j++) {\n const eventInfo = eventInfoLib.cloneEventInfo(earlyEventInfo);\n // EventInfo eventType maps to JSAction's internal event type,\n // rather than the browser event type.\n eventInfoLib.setEventType(eventInfo, eventTypes[j]);\n this.handleEventInfo(eventInfo);\n }\n }\n }\n\n /**\n * Returns all JSAction event types that have been registered for a given\n * browser event type.\n */\n private getEventTypesForBrowserEventType(browserEventType: string) {\n const eventTypes = [];\n if (this.eventHandlers[browserEventType]) {\n eventTypes.push(browserEventType);\n }\n if (this.browserEventTypeToExtraEventTypes[browserEventType]) {\n eventTypes.push(...this.browserEventTypeToExtraEventTypes[browserEventType]);\n }\n return eventTypes;\n }\n\n /**\n * Returns the event handler function for a given event type.\n */\n handler(eventType: string): EventHandler | undefined {\n return this.eventHandlers[eventType];\n }\n\n /**\n * Cleans up the event contract. This resets all of the `EventContract`'s\n * internal state. Users are responsible for not using this `EventContract`\n * after it has been cleaned up.\n */\n cleanUp() {\n this.containerManager?.cleanUp();\n this.containerManager = null;\n this.eventHandlers = {};\n this.browserEventTypeToExtraEventTypes = {};\n this.dispatcher = null;\n this.queuedEventInfos = [];\n }\n\n /**\n * Register a dispatcher function. Event info of each event mapped to\n * a jsaction is passed for handling to this callback. The queued\n * events are passed as well to the dispatcher for later replaying\n * once the dispatcher is registered. Clears the event queue to null.\n *\n * @param dispatcher The dispatcher function.\n * @param restriction\n */\n registerDispatcher(dispatcher: Dispatcher, restriction: Restriction) {\n this.ecrd(dispatcher, restriction);\n }\n\n /**\n * Unrenamed alias for registerDispatcher. Necessary for any codebases that\n * split the `EventContract` and `Dispatcher` code into different compilation\n * units.\n */\n ecrd(dispatcher: Dispatcher, restriction: Restriction) {\n this.dispatcher = dispatcher;\n\n if (this.queuedEventInfos?.length) {\n for (let i = 0; i < this.queuedEventInfos.length; i++) {\n this.handleEventInfo(this.queuedEventInfos[i]);\n }\n this.queuedEventInfos = null;\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Restriction} from './restriction';\nimport {\n EarlyJsactionDataContainer,\n addEvents,\n createEarlyJsactionData,\n getQueuedEventInfos,\n registerDispatcher,\n removeAllEventListeners,\n} from './earlyeventcontract';\nimport {EventInfo} from './event_info';\n\n/**\n * Creates an `EarlyJsactionData`, adds events to it, and populates it on a nested object on\n * the window.\n */\nexport function bootstrapAppScopedEarlyEventContract(\n container: HTMLElement,\n appId: string,\n bubbleEventTypes: string[],\n captureEventTypes: string[],\n dataContainer: EarlyJsactionDataContainer = window,\n) {\n const earlyJsactionData = createEarlyJsactionData(container);\n if (!dataContainer._ejsas) {\n dataContainer._ejsas = {};\n }\n dataContainer._ejsas[appId] = earlyJsactionData;\n addEvents(earlyJsactionData, bubbleEventTypes);\n addEvents(earlyJsactionData, captureEventTypes, /* capture= */ true);\n}\n\n/** Get the queued `EventInfo` objects that were dispatched before a dispatcher was registered. */\nexport function getAppScopedQueuedEventInfos(\n appId: string,\n dataContainer: EarlyJsactionDataContainer = window,\n) {\n return getQueuedEventInfos(dataContainer._ejsas?.[appId]);\n}\n\n/**\n * Registers a dispatcher function on the `EarlyJsactionData` present on the nested object on the\n * window.\n */\nexport function registerAppScopedDispatcher(\n restriction: Restriction,\n appId: string,\n dispatcher: (eventInfo: EventInfo) => void,\n dataContainer: EarlyJsactionDataContainer = window,\n) {\n registerDispatcher(dataContainer._ejsas?.[appId], dispatcher);\n}\n\n/** Removes all event listener handlers. */\nexport function removeAllAppScopedEventListeners(\n appId: string,\n dataContainer: EarlyJsactionDataContainer = window,\n) {\n removeAllEventListeners(dataContainer._ejsas?.[appId]);\n}\n\n/** Clear the early event contract. */\nexport function clearAppScopedEarlyEventContract(\n appId: string,\n dataContainer: EarlyJsactionDataContainer = window,\n) {\n if (!dataContainer._ejsas) {\n return;\n }\n dataContainer._ejsas[appId] = undefined;\n}\n"],"names":["Property","JSACTION","OWNER","parseCache","get","element","getDefaulted","cache","set","actionMap","getParsed","text","setParsed","parsed","EventType","AUXCLICK","CHANGE","CLICK","CLICKMOD","CLICKONLY","DBLCLICK","FOCUS","FOCUSIN","BLUR","FOCUSOUT","SUBMIT","KEYDOWN","KEYPRESS","KEYUP","MOUSEUP","MOUSEDOWN","MOUSEOVER","MOUSEOUT","MOUSEENTER","MOUSELEAVE","MOUSEMOVE","POINTERUP","POINTERDOWN","POINTEROVER","POINTEROUT","POINTERENTER","POINTERLEAVE","POINTERMOVE","POINTERCANCEL","GOTPOINTERCAPTURE","LOSTPOINTERCAPTURE","ERROR","LOAD","UNLOAD","TOUCHSTART","TOUCHEND","TOUCHMOVE","INPUT","SCROLL","TOGGLE","CUSTOM","MOUSE_SPECIAL_EVENT_TYPES","BUBBLE_EVENT_TYPES","CAPTURE_EVENT_TYPES","isCaptureEventType","eventType","indexOf","EARLY_EVENT_TYPES","concat","isEarlyEventType","getBrowserEventType","addEventListener","handler","passive","capture","options","removeEventListener","info","detachEvent","preventDefault","e","returnValue","isMac","navigator","test","userAgent","isMiddleClick","which","button","isModifiedClickEvent","metaKey","ctrlKey","shiftKey","isMouseSpecialEvent","type","related","relatedTarget","contains","createMouseSpecialEvent","target","copy","property","key","value","isIos","EventContractContainer","handlerInfos","constructor","getHandler","style","cursor","push","eventLib","cleanUp","i","length","Char","NAMESPACE_ACTION_SEPARATOR","EVENT_ACTION_SEPARATOR","getEventType","eventInfo","setEventType","getEvent","event","setEvent","getTargetElement","targetElement","setTargetElement","getContainer","eic","setContainer","container","getTimestamp","timeStamp","setTimestamp","timestamp","getAction","eia","setAction","actionName","actionElement","unsetAction","undefined","getActionElement","actionInfo","getIsReplay","eirp","setIsReplay","replay","getResolved","eir","setResolved","resolved","cloneEventInfo","eiack","createEventInfoFromParameters","action","isReplay","a11yClickKey","EventInfoWrapper","name","clone","EMPTY_ACTION_MAP","REGEXP_SEMICOLON","DEFAULT_EVENT_TYPE","ActionResolver","a11yClickSupport","clickModSupport","syntheticMouseEventSupport","updateEventInfoForA11yClick","preventDefaultForA11yClick","populateClickOnlyAction","resolveEventType","eventInfoLib","resolveAction","populateAction","resolveParentAction","parentNode","getParentNode","currentTarget","nodeType","Node","ELEMENT_NODE","populateActionOnElement","copiedEvent","owner","nodeName","host","parseActions","jsactionAttribute","getAttribute","Attribute","values","split","idx","colon","hasColon","substr","trim","addA11yClickSupport","Restriction","Dispatcher","dispatchDelegate","actionResolver","eventReplayer","eventReplayScheduled","replayEventInfoWrappers","dispatch","eventInfoWrapper","shouldPreventDefaultBeforeDispatching","scheduleEventInfoWrapperReplay","Promise","resolve","then","tagName","PROPAGATION_STOPPED_SYMBOL","Symbol","for","EventPhase","REPLAY","PREVENT_DEFAULT_ERROR_MESSAGE_DETAILS","PREVENT_DEFAULT_ERROR_MESSAGE","COMPOSED_PATH_ERROR_MESSAGE_DETAILS","COMPOSED_PATH_ERROR_MESSAGE","EventDispatcher","dispatcher","dispatchToDelegate","prepareEventForReplay","prepareEventForBubbling","prepareEventForDispatch","propagationStopped","originalStopPropagation","stopPropagation","bind","patchEventInstance","originalPreventDefault","Error","ngDevMode","configurable","Object","defineProperty","registerDispatcher","eventContract","ecrd","I_AM_THE_JSACTION_FRAMEWORK","createEarlyJsactionData","q","d","h","Date","now","c","et","etc","addEvents","earlyJsactionData","types","eventTypes","getQueuedEventInfos","removeAllEventListeners","removeEventListeners","earlyEventHandler","MOUSE_SPECIAL_SUPPORT","EventContract","containerManager","eventHandlers","browserEventTypeToExtraEventTypes","queuedEventInfos","handleEvent","handleEventInfo","addEvent","prefixedEventType","eventHandler","browserEventType","replayEarlyEvents","window","_ejsa","replayEarlyEventInfos","earlyEventInfos","earlyEventInfo","getEventTypesForBrowserEventType","j","restriction","bootstrapAppScopedEarlyEventContract","appId","bubbleEventTypes","captureEventTypes","dataContainer","_ejsas","getAppScopedQueuedEventInfos","registerAppScopedDispatcher","removeAllAppScopedEventListeners","clearAppScopedEarlyEventContract"],"mappings":";;;;;;;;AASO,MAAMA,QAAQ,GAAG;AAStBC,EAAAA,QAAQ,EAAE,YAAqB;AAO/BC,EAAAA,KAAK,EAAE;CACR;;ACbD,MAAMC,UAAU,GAAyD,EAAE;AAKrE,SAAUC,GAAGA,CAACC,OAAgB,EAAA;AAClC,EAAA,OAAOA,OAAO,CAACL,QAAQ,CAACC,QAAQ,CAAC;AACnC;AAMM,SAAUK,YAAYA,CAACD,OAAgB,EAAA;EAC3C,MAAME,KAAK,GAAGH,GAAG,CAACC,OAAO,CAAC,IAAI,EAAE;AAChCG,EAAAA,GAAG,CAACH,OAAO,EAAEE,KAAK,CAAC;AACnB,EAAA,OAAOA,KAAK;AACd;AAKgB,SAAAC,GAAGA,CAACH,OAAgB,EAAEI,SAA8C,EAAA;AAClFJ,EAAAA,OAAO,CAACL,QAAQ,CAACC,QAAQ,CAAC,GAAGQ,SAAS;AACxC;AAQM,SAAUC,SAASA,CAACC,IAA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