var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var media_fullscreen_button_exports = {}; __export(media_fullscreen_button_exports, { default: () => media_fullscreen_button_default }); module.exports = __toCommonJS(media_fullscreen_button_exports); var import_media_chrome_button = require("./media-chrome-button.js"); var import_server_safe_globals = require("./utils/server-safe-globals.js"); var import_constants = require("./constants.js"); var import_labels = require("./labels/labels.js"); var import_element_utils = require("./utils/element-utils.js"); const enterFullscreenIcon = ``; const exitFullscreenIcon = ``; const slotTemplate = import_server_safe_globals.document.createElement("template"); slotTemplate.innerHTML = /*html*/ ` ${enterFullscreenIcon} ${exitFullscreenIcon} `; const tooltipContent = ( /*html*/ ` ${import_labels.tooltipLabels.ENTER_FULLSCREEN} ${import_labels.tooltipLabels.EXIT_FULLSCREEN} ` ); const updateAriaLabel = (el) => { const label = el.mediaIsFullscreen ? import_labels.verbs.EXIT_FULLSCREEN() : import_labels.verbs.ENTER_FULLSCREEN(); el.setAttribute("aria-label", label); }; class MediaFullscreenButton extends import_media_chrome_button.MediaChromeButton { static get observedAttributes() { return [ ...super.observedAttributes, import_constants.MediaUIAttributes.MEDIA_IS_FULLSCREEN, import_constants.MediaUIAttributes.MEDIA_FULLSCREEN_UNAVAILABLE ]; } constructor(options = {}) { super({ slotTemplate, tooltipContent, ...options }); } connectedCallback() { super.connectedCallback(); updateAriaLabel(this); } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === import_constants.MediaUIAttributes.MEDIA_IS_FULLSCREEN) { updateAriaLabel(this); } } /** * @type {string | undefined} Fullscreen unavailability state */ get mediaFullscreenUnavailable() { return (0, import_element_utils.getStringAttr)(this, import_constants.MediaUIAttributes.MEDIA_FULLSCREEN_UNAVAILABLE); } set mediaFullscreenUnavailable(value) { (0, import_element_utils.setStringAttr)(this, import_constants.MediaUIAttributes.MEDIA_FULLSCREEN_UNAVAILABLE, value); } /** * @type {boolean} Whether fullscreen is available */ get mediaIsFullscreen() { return (0, import_element_utils.getBooleanAttr)(this, import_constants.MediaUIAttributes.MEDIA_IS_FULLSCREEN); } set mediaIsFullscreen(value) { (0, import_element_utils.setBooleanAttr)(this, import_constants.MediaUIAttributes.MEDIA_IS_FULLSCREEN, value); } handleClick() { const eventName = this.mediaIsFullscreen ? import_constants.MediaUIEvents.MEDIA_EXIT_FULLSCREEN_REQUEST : import_constants.MediaUIEvents.MEDIA_ENTER_FULLSCREEN_REQUEST; this.dispatchEvent( new import_server_safe_globals.globalThis.CustomEvent(eventName, { composed: true, bubbles: true }) ); } } if (!import_server_safe_globals.globalThis.customElements.get("media-fullscreen-button")) { import_server_safe_globals.globalThis.customElements.define( "media-fullscreen-button", MediaFullscreenButton ); } var media_fullscreen_button_default = MediaFullscreenButton;