/*! Build: 2026-04-10T10:06:52.770Z | Commit: d41561527a11b75b82c99a43e375be57508f737d | Branch: main | App: renderer | Environment: production */
(()=>{var qg=Object.defineProperty;var Iv=Object.getOwnPropertySymbols;var Qp=Object.prototype.hasOwnProperty,Xp=Object.prototype.propertyIsEnumerable;var zp=($e,Me,Ee)=>Me in $e?qg($e,Me,{enumerable:!0,configurable:!0,writable:!0,value:Ee}):$e[Me]=Ee,zh=($e,Me)=>{for(var Ee in Me||(Me={}))Qp.call(Me,Ee)&&zp($e,Ee,Me[Ee]);if(Iv)for(var Ee of Iv(Me))Xp.call(Me,Ee)&&zp($e,Ee,Me[Ee]);return $e};var Xm=($e,Me)=>{var Ee={};for(var He in $e)Qp.call($e,He)&&Me.indexOf(He)<0&&(Ee[He]=$e[He]);if($e!=null&&Iv)for(var He of Iv($e))Me.indexOf(He)<0&&Xp.call($e,He)&&(Ee[He]=$e[He]);return Ee};var Zm=($e,Me,Ee)=>new Promise((He,Le)=>{var Ne=de=>{try{Qe(Ee.next(de))}catch(Pe){Le(Pe)}},H=de=>{try{Qe(Ee.throw(de))}catch(Pe){Le(Pe)}},Qe=de=>de.done?He(de.value):Promise.resolve(de.value).then(Ne,H);Qe((Ee=Ee.apply($e,Me)).next())});(self.webpackChunk_typeform_renderer=self.webpackChunk_typeform_renderer||[]).push([[3673],{29521($e,Me,Ee){"use strict";Ee.r(Me),Ee.d(Me,{default:()=>Xo});var He=p=>{throw TypeError(p)},Le=(p,T,w)=>T.has(p)||He("Cannot "+w),Ne=(p,T,w)=>(Le(p,T,"read from private field"),w?w.call(p):T.get(p)),H=(p,T,w)=>T.has(p)?He("Cannot add the same private member more than once"):T instanceof WeakSet?T.add(p):T.set(p,w),Qe=(p,T,w,J)=>(Le(p,T,"write to private field"),J?J.call(p,w):T.set(p,w),w),de=`<!-- prettier-ignore -->
<template id="media-theme-classic">
  <style>
    :host {
      --_primary-color: var(--media-primary-color, white);
      --_secondary-color: var(--media-secondary-color, rgb(0 0 0 / .75));
      --media-icon-color: var(--_primary-color);
      --media-range-thumb-background: var(--_primary-color);
      --media-range-bar-color: var(--_primary-color);
      --media-control-background: var(--_secondary-color);
      --media-control-hover-background: var(--_secondary-color);
      --media-time-range-buffered-color: rgba(255, 255, 255, 0.4);
      --media-range-track-background:
        linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)),
        linear-gradient(rgba(20, 20, 30, 0.7), rgba(20, 20, 30, 0.7));
      --media-preview-thumbnail-border: 0;
      --media-preview-thumbnail-border-radius: 2px 2px 0 0;
      --media-preview-time-border-radius: 0 0 2px 2px;
      --media-preview-time-text-shadow: none;
      --media-menu-border-radius: 2px;
      --media-menu-transform-in: translateY(-8px) scale(1);
      --media-menu-transform-out: translateY(-6px) scale(.99);
      --media-menu-item-hover-background: rgba(255, 255, 255, 0.28);
      --media-tooltip-display: none;
      color: var(--_primary-color);
      display: inline-block;
      width: 100%;
      height: 100%;
    }

    media-rendition-menu,
    media-audio-track-menu,
    media-captions-menu {
      position: absolute; /* ensure they don't take up space in DOM on load */
    }

    media-rendition-menu {
      min-width: 140px;
    }

    :host([audio]) {
      --media-preview-time-border-radius: 3px;
      --media-preview-time-text-shadow: none;
    }

    :host([audio]) ::slotted([slot='media']) {
      height: 0px;
    }

    :host([audio]) media-loading-indicator {
      display: none;
    }

    :host([audio]) media-controller {
      background: transparent;
    }

    :host([audio]) media-controller::part(vertical-layer) {
      background: transparent;
    }

    :host([audio]) media-control-bar {
      width: 100%;
    }

    [disabled]:not(media-live-button),
    [aria-disabled='true']:not(media-live-button) {
      opacity: 60%;
      cursor: not-allowed;
    }

    /* 0.433s is the transition duration for VTT Regions.
     * Borrowed here, so the captions don't move too fast. */
    media-controller {
      --media-webkit-text-track-transition: transform 0.433s ease-out 0.3s;
    }
    media-controller:is([mediapaused],:not([userinactive])) {
      /* 42px is the height of the control bar and progress bar
       * with an additional 5px as a buffer, to get 47px */
      --media-webkit-text-track-transform: translateY(-47px);
      --media-webkit-text-track-transition: transform 0.15s ease;
    }

    /*
     * CSS specific to iOS devices.
     * See: https://stackoverflow.com/questions/30102792/css-media-query-to-target-only-ios-devices/60220757#60220757
     */
     @supports (-webkit-touch-callout: none) {
      /* Disable subtitle adjusting for iOS Safari */
      media-controller[mediaisfullscreen] {
        --media-webkit-text-track-transform: unset;
        --media-webkit-text-track-transition: unset;
      }
    }

    :host media-time-range {
      color: var(--_primary-color);
      --media-range-thumb-opacity: 0;
    }

    :host(:not([audio])) media-time-range {
      /* Adding px is required here for calc() */
      --media-range-padding: 0px;
      background: transparent;
      z-index: 10;
      height: 10px;
      bottom: -3px;
      width: 100%;
    }

    media-control-bar {
      --media-control-padding: 4px 3px;
    }

    [breakpointsm] media-control-bar {
      --media-control-padding: 9px 5px;
    }

    [breakpointmd] media-control-bar {
      --media-control-padding: 9px 7px;
    }

    media-control-bar :is([role='button'], [role='switch'], button) {
      line-height: 0;
    }

    media-control-bar :is(media-text-display, media-time-display):first-child {
      --media-control-padding: 9px 5px 9px 10px;
    }

    .spacer {
      flex-grow: 1;
      background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
    }

    /* Add a small space on the right to have the play button and
     * fullscreen button aligned in relation to the progress bar. */
    media-control-bar:not([slot])::after {
      content: '';
      width: 2px;
      height: 100%;
      background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
    }

    media-control-bar[slot='top-chrome'] {
      min-height: 42px;
      pointer-events: none;
    }

    :host([title]) media-control-bar[slot='top-chrome']::before,
    :host([videotitle]) media-control-bar[slot='top-chrome']::before {
      content: '';
      position: absolute;
      width: 100%;
      padding-bottom: min(160px, 25%);
      background: linear-gradient(rgb(0 0 0 / 0.4), transparent);
    }

    media-control-bar[slot='top-chrome'] > * {
      --media-control-background: transparent;
      --media-control-hover-background: transparent;
      position: relative;
    }

    media-controller::part(vertical-layer) {
      transition: background-color 1s;
    }

    media-controller:is([mediapaused], :not([userinactive]))::part(vertical-layer) {
      background-color: var(--controls-backdrop-color, var(--controls, transparent));
      transition: background-color 0.25s;
    }

    .center-controls {
      --media-button-icon-width: 100%;
      --media-button-icon-height: auto;
      pointer-events: none;
      width: 100%;
      display: flex;
      flex-flow: row;
      align-items: center;
      justify-content: center;
      paint-order: stroke;
      stroke: rgba(102, 102, 102, 1);
      stroke-width: 0.3px;
    }

    .center-controls media-play-button {
      --media-control-background: transparent;
      --media-control-hover-background: transparent;
      padding: 0;
      width: max(43px, min(10%, 55px));
      filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25));
    }

    .center-controls media-seek-backward-button,
    .center-controls media-seek-forward-button {
      --media-control-background: transparent;
      --media-control-hover-background: transparent;
      padding: 0;
      margin: 0 2%;
      width: max(33px, min(8%, 40px));
      filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25));
      text-shadow: 0 0 2px rgb(0 0 0 / 0.25), 0 0 6px rgb(0 0 0 / 0.25);
    }

    media-control-bar:not([slot]) media-seek-backward-button {
      padding-right: 5px;
    }

    media-control-bar:not([slot]) media-seek-forward-button {
      padding-left: 5px;
    }

    media-loading-indicator {
      --media-loading-icon-width: 100%;
      --media-button-icon-height: auto;
      display: var(--media-control-display, var(--media-loading-indicator-display, flex));
      pointer-events: none;
      position: absolute;
      width: min(15%, 150px);
      flex-flow: row;
      align-items: center;
      justify-content: center;
    }

    /* Intentionally don't target the div for transition but the children
     of the div. Prevents messing with media-chrome's autohide feature. */
    media-loading-indicator + div * {
      transition: opacity 0.15s;
      opacity: 1;
    }

    media-loading-indicator[medialoading]:not([mediapaused]) ~ div > * {
      opacity: 0;
      transition-delay: 400ms;
    }

    media-volume-range {
      /* Adding px is required here for calc() */
      --media-range-padding-left: 10px;
      --media-range-padding-right: 10px;
      width: min(100%, 100px);
    }

    media-time-display {
      white-space: nowrap;
    }

    :is(media-time-display, media-text-display, media-playback-rate-button[role='button']) {
      color: inherit;
      line-height: 24px;
    }

    :is(.title-display, media-live-button) {
      color: inherit;
      font-size: 16px;
      text-shadow: 0 0 2px rgb(0 0 0 / 0.6);
    }

    :host([audio]) .title-display {
      flex-grow: 1;
      font-size: 21px;
    }
  </style>

  <template partial="TitleDisplay">
    <template if="videotitle">
      <template if="videotitle != true">
        <media-text-display part="top title display" class="title-display">{{videotitle}}</media-text-display>
      </template>
    </template>
    <template if="!videotitle">
      <template if="title">
        <media-text-display part="top title display" class="title-display">{{title}}</media-text-display>
      </template>
    </template>
  </template>

  <template partial="PlayButton">
    <media-play-button
      part="{{section ?? 'bottom'}} play button"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    >
      <svg aria-hidden="true" viewBox="0 0 24 24" slot="play">
        <path d="m6.73 20.93 14.05-8.54a.46.46 0 0 0 0-.78L6.73 3.07a.48.48 0 0 0-.73.39v17.07a.48.48 0 0 0 .73.4Z" />
      </svg>
      <svg aria-hidden="true" viewBox="0 0 24 24" slot="pause">
        <path
          d="M6 19.5a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5v15ZM14.5 4a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5h-3Z"
        />
      </svg>
    </media-play-button>
  </template>

  <template partial="SeekBackwardButton">
    <media-seek-backward-button
      seekoffset="{{backwardseekoffset}}"
      part="{{section ?? 'bottom'}} seek-backward button"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    >
      <svg aria-hidden="true" viewBox="0 0 22 24" slot="backward">
        <path d="M11 6V3L5.37 7 11 10.94V8a5.54 5.54 0 0 1 1.9 10.48v2.12A7.5 7.5 0 0 0 11 6Z" />
        <text class="value" transform="translate(2.5 21)" style="font-size: 8px; font-family: 'ArialMT', 'Arial'">
          {{backwardseekoffset}}
        </text>
      </svg>
    </media-seek-backward-button>
  </template>

  <template partial="SeekForwardButton">
    <media-seek-forward-button
      seekoffset="{{forwardseekoffset}}"
      part="{{section ?? 'bottom'}} seek-forward button"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    >
      <svg aria-hidden="true" viewBox="0 0 22 24" slot="forward">
        <path d="M11 6V3l5.61 4L11 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 11 6Z" />
        <text class="value" transform="translate(10 21)" style="font-size: 8px; font-family: 'ArialMT', 'Arial'">
          {{forwardseekoffset}}
        </text>
      </svg>
    </media-seek-forward-button>
  </template>

  <template partial="MuteButton">
    <media-mute-button part="bottom mute button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
      <svg aria-hidden="true" viewBox="0 0 24 24" slot="high">
        <path
          d="m11.14 4.86-4 4a.49.49 0 0 1-.35.14H3.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.5.5 0 0 0 .85-.36V5.21a.5.5 0 0 0-.86-.35Zm2.74-1.56v1.52A7.52 7.52 0 0 1 19.47 12a7.52 7.52 0 0 1-5.59 7.18v1.52A9 9 0 0 0 21 12a9 9 0 0 0-7.12-8.7Zm3.56 8.7a5.49 5.49 0 0 0-3.56-5.1v1.66a3.93 3.93 0 0 1 0 6.88v1.66a5.49 5.49 0 0 0 3.56-5.1Z"
        />
      </svg>
      <svg aria-hidden="true" viewBox="0 0 24 24" slot="low">
        <path
          d="m11.14 4.853-4 4a.49.49 0 0 1-.35.14H3.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.5.5 0 0 0 .85-.36V5.203a.5.5 0 0 0-.86-.35Zm6.3 7.14a5.49 5.49 0 0 0-3.56-5.1v1.66a3.93 3.93 0 0 1 0 6.88v1.66a5.49 5.49 0 0 0 3.56-5.1Z"
        />
      </svg>
      <svg aria-hidden="true" viewBox="0 0 24 24" slot="medium">
        <path
          d="m11.14 4.853-4 4a.49.49 0 0 1-.35.14H3.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.5.5 0 0 0 .85-.36V5.203a.5.5 0 0 0-.86-.35Zm6.3 7.14a5.49 5.49 0 0 0-3.56-5.1v1.66a3.93 3.93 0 0 1 0 6.88v1.66a5.49 5.49 0 0 0 3.56-5.1Z"
        />
      </svg>
      <svg aria-hidden="true" viewBox="0 0 24 24" slot="off">
        <path
          d="m3 4.05 4.48 4.47-.33.33a.49.49 0 0 1-.36.15H3.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.48.48 0 0 0 .36.15.5.5 0 0 0 .5-.5v-5.75l4.67 4.66a7.71 7.71 0 0 1-2.79 1.47v1.52a9.32 9.32 0 0 0 3.87-1.91L20 21l1-1L4.06 3 3 4.05Zm5.36 5.36 2.39 2.39V17L8 14.26a1.74 1.74 0 0 0-1.24-.51H4.25v-3.5h2.54A1.74 1.74 0 0 0 8 9.74l.36-.33ZM19.47 12a7.19 7.19 0 0 1-.89 3.47l1.11 1.1A8.64 8.64 0 0 0 21 12a9 9 0 0 0-7.12-8.7v1.52A7.52 7.52 0 0 1 19.47 12ZM12 8.88V5.21a.5.5 0 0 0-.5-.5.48.48 0 0 0-.36.15L9.56 6.44 12 8.88ZM15.91 12a4.284 4.284 0 0 1-.07.72l1.22 1.22a5.2 5.2 0 0 0 .38-1.94 5.49 5.49 0 0 0-3.56-5.1v1.66A4 4 0 0 1 15.91 12Z"
        />
      </svg>
    </media-mute-button>
  </template>

  <template partial="RenditionSelect">
    <media-rendition-menu-button part="bottom rendition button">
      <svg aria-hidden="true" slot="icon" viewBox="0 0 18 24">
        <path
          d="M2.25 14.5a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm6.75 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm6.75 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"/>
      </svg>
    </media-rendition-menu-button>
    <media-rendition-menu
      hidden
      anchor="auto"
      part="bottom rendition menu"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    >
      <div slot="header">Quality</div>
    </media-rendition-menu>
  </template>

  <template partial="AudioTrackSelect">
    <media-audio-track-menu-button part="bottom audio-track button">
      <svg aria-hidden="true" slot="icon" viewBox="0 0 24 24">
        <path d="M12 20.5a8.5 8.5 0 1 0 0-17 8.5 8.5 0 0 0 0 17Zm0 1.5C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10Z"/>
        <path d="M7.25 9.75a.75.75 0 0 1 .75.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 .75-.75Zm3-3a.75.75 0 0 1 .75.75v9a.75.75 0 0 1-1.5 0v-9a.75.75 0 0 1 .75-.75Zm3 2a.75.75 0 0 1 .75.75v5a.75.75 0 0 1-1.5 0v-5a.75.75 0 0 1 .75-.75Zm3-1a.75.75 0 0 1 .75.75v7a.75.75 0 0 1-1.5 0v-7a.75.75 0 0 1 .75-.75Z"/>
      </svg>
    </media-audio-track-menu-button>
    <media-audio-track-menu
      hidden
      anchor="auto"
      part="bottom audio-track menu"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
      exportparts="menu-item"
    >
      <div slot="header">Audio</div>
    </media-audio-track-menu>
  </template>

  <template partial="CaptionsSelect">
    <media-captions-menu-button part="bottom captions button">
      <svg aria-hidden="true" viewBox="0 0 26 24" slot="on">
        <path d="M22.832 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.41 10.1a3.63 3.63 0 0 1-1.51.32 4.76 4.76 0 0 1-1.63-.27 4 4 0 0 1-1.28-.83 3.67 3.67 0 0 1-.84-1.26 4.23 4.23 0 0 1-.3-1.63 4.28 4.28 0 0 1 .3-1.64 3.53 3.53 0 0 1 .84-1.21 3.89 3.89 0 0 1 1.29-.8 4.76 4.76 0 0 1 1.63-.27 4.06 4.06 0 0 1 1.35.24c.225.091.44.205.64.34a2.7 2.7 0 0 1 .55.52l-1.27 1a1.79 1.79 0 0 0-.6-.46 2 2 0 0 0-.83-.16 2 2 0 0 0-1.56.69 2.35 2.35 0 0 0-.46.77 2.78 2.78 0 0 0-.16 1c-.009.34.046.68.16 1 .104.283.26.545.46.77.188.21.415.38.67.5a2 2 0 0 0 .84.18 1.87 1.87 0 0 0 .9-.21 1.78 1.78 0 0 0 .65-.6l1.38 1a2.88 2.88 0 0 1-1.22 1.01Zm7.52 0a3.63 3.63 0 0 1-1.51.32 4.76 4.76 0 0 1-1.63-.27 3.89 3.89 0 0 1-1.28-.83 3.55 3.55 0 0 1-.85-1.26 4.23 4.23 0 0 1-.3-1.63 4.28 4.28 0 0 1 .3-1.64 3.43 3.43 0 0 1 .85-1.25 3.75 3.75 0 0 1 1.28-.8 4.76 4.76 0 0 1 1.63-.27 4 4 0 0 1 1.35.24c.225.091.44.205.64.34.21.144.395.32.55.52l-1.27 1a1.79 1.79 0 0 0-.6-.46 2 2 0 0 0-.83-.16 2 2 0 0 0-1.56.69 2.352 2.352 0 0 0-.46.77 3.01 3.01 0 0 0-.16 1c-.003.34.05.678.16 1 .108.282.263.542.46.77.188.21.416.38.67.5a2 2 0 0 0 .84.18 1.87 1.87 0 0 0 .9-.21 1.78 1.78 0 0 0 .65-.6l1.38 1a2.82 2.82 0 0 1-1.21 1.05Z"/>
      </svg>
      <svg aria-hidden="true" viewBox="0 0 26 24" slot="off">
        <path d="M22.832 5.68a2.58 2.58 0 0 0-2.3-2.5c-1.81-.12-4.67-.18-7.53-.18-2.86 0-5.72.06-7.53.18a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c1.81.12 4.67.18 7.53.18 2.86 0 5.72-.06 7.53-.18a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.137-.21-8.283 0-12.42a1.11 1.11 0 0 1 .91-1.11c1.67-.11 4.43-.18 7.43-.18s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.137.21 8.283 0 12.42ZM10.843 14a1.55 1.55 0 0 1-.76.18 1.57 1.57 0 0 1-.71-.18 1.69 1.69 0 0 1-.57-.42 2.099 2.099 0 0 1-.38-.58 2.47 2.47 0 0 1 0-1.64 2 2 0 0 1 .39-.66 1.73 1.73 0 0 1 .58-.42c.23-.103.479-.158.73-.16.241-.004.48.044.7.14.199.088.373.222.51.39l1.08-.89a2.179 2.179 0 0 0-.47-.44 2.81 2.81 0 0 0-.54-.32 2.91 2.91 0 0 0-.58-.15 2.71 2.71 0 0 0-.56 0 4.08 4.08 0 0 0-1.38.15 3.27 3.27 0 0 0-1.09.67 3.14 3.14 0 0 0-.71 1.06 3.62 3.62 0 0 0-.26 1.39 3.57 3.57 0 0 0 .26 1.38 3 3 0 0 0 .71 1.06c.316.293.687.52 1.09.67.443.16.91.238 1.38.23a3.2 3.2 0 0 0 1.28-.27c.401-.183.747-.47 1-.83l-1.17-.88a1.42 1.42 0 0 1-.53.52Zm6.62 0a1.58 1.58 0 0 1-.76.18 1.54 1.54 0 0 1-.7-.18 1.69 1.69 0 0 1-.57-.42 2.12 2.12 0 0 1-.43-.58 2.29 2.29 0 0 1 .39-2.3 1.84 1.84 0 0 1 1.32-.58c.241-.003.48.045.7.14.199.088.373.222.51.39l1.08-.92a2.43 2.43 0 0 0-.47-.44 3.22 3.22 0 0 0-.53-.29 2.999 2.999 0 0 0-.57-.15 2.87 2.87 0 0 0-.57 0 4.06 4.06 0 0 0-1.36.15 3.17 3.17 0 0 0-1.09.67 3 3 0 0 0-.72 1.06 3.62 3.62 0 0 0-.25 1.39 3.57 3.57 0 0 0 .25 1.38c.16.402.405.764.72 1.06a3.17 3.17 0 0 0 1.09.67c.44.16.904.237 1.37.23.441 0 .877-.092 1.28-.27a2.45 2.45 0 0 0 1-.83l-1.15-.85a1.49 1.49 0 0 1-.54.49Z"/>
      </svg>
    </media-captions-menu-button>
    <media-captions-menu
      hidden
      anchor="auto"
      part="bottom captions menu"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
      exportparts="menu-item"
    ></media-captions-menu>
  </template>

  <template partial="AirplayButton">
    <media-airplay-button part="bottom airplay button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
      <svg aria-hidden="true" viewBox="0 0 26 24" slot="airplay">
        <path
          d="M13.19 14.22a.25.25 0 0 0-.38 0l-5.46 6.37a.25.25 0 0 0 .19.41h10.92a.25.25 0 0 0 .19-.41l-5.46-6.37Z"
        />
        <path
          d="M22 3H4a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h2.94L8 16.75H4.25V4.25h17.5v12.5H18L19.06 18H22a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Z"
        />
      </svg>
    </media-airplay-button>
  </template>

  <template partial="CastButton">
    <media-cast-button part="bottom cast button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
      <svg aria-hidden="true" viewBox="0 0 26 24" slot="enter">
        <path d="M3 15.5V17c2.206 0 4 1.794 4 4h1.5A5.5 5.5 0 0 0 3 15.5Zm0 3V21h2.5A2.5 2.5 0 0 0 3 18.5Z" />
        <path d="M3 12.5V14c3.86 0 7 3.14 7 7h1.5A8.5 8.5 0 0 0 3 12.5Z" />
        <path
          d="M22 3H4a1 1 0 0 0-1 1v6.984c.424 0 .84.035 1.25.086V4.25h17.5v15.5h-8.82c.051.41.086.826.086 1.25H22a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Z"
        />
      </svg>
      <svg aria-hidden="true" viewBox="0 0 26 24" slot="exit">
        <path d="M3 15.5V17c2.206 0 4 1.794 4 4h1.5A5.5 5.5 0 0 0 3 15.5Zm0 3V21h2.5A2.5 2.5 0 0 0 3 18.5Z" />
        <path d="M3 12.5V14c3.86 0 7 3.14 7 7h1.5A8.5 8.5 0 0 0 3 12.5Z" />
        <path
          d="M22 3H4a1 1 0 0 0-1 1v6.984c.424 0 .84.035 1.25.086V4.25h17.5v15.5h-8.82c.051.41.086.826.086 1.25H22a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Z"
        />
        <path d="M20.5 5.5h-15v5.811c3.52.906 6.283 3.67 7.189 7.19H20.5V5.5Z" />
      </svg>
    </media-cast-button>
  </template>

  <template partial="PipButton">
    <media-pip-button part="bottom pip button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
      <svg aria-hidden="true" viewBox="0 0 26 24" slot="enter">
        <path
          d="M22 3H4a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h6.75v-1.25h-6.5V4.25h17.5v6.5H23V4a1 1 0 0 0-1-1Zm0 10h-8a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1Zm-.5 6.5h-7v-5h7v5Z"
        />
      </svg>
      <svg aria-hidden="true" viewBox="0 0 26 24" slot="exit">
        <path
          d="M22 3H4a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h6.75v-1.25h-6.5V4.25h17.5v6.5H23V4a1 1 0 0 0-1-1Zm0 10h-8a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1Zm-.5 6.5h-7v-5h7v5Z"
        />
      </svg>
    </media-pip-button>
  </template>

  <template partial="FullscreenButton">
    <media-fullscreen-button part="bottom fullscreen button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
      <svg aria-hidden="true" viewBox="0 0 24 24" slot="enter">
        <path
          d="M20.25 14.5a.76.76 0 0 0-.75.75v4.25h-4.25a.75.75 0 1 0 0 1.5h5a.76.76 0 0 0 .75-.75v-5a.76.76 0 0 0-.75-.75Zm0-11.5h-5a.76.76 0 0 0-.75.75.76.76 0 0 0 .75.75h4.25v4.25a.75.75 0 1 0 1.5 0v-5a.76.76 0 0 0-.75-.75ZM8.75 19.5H4.5v-4.25a.76.76 0 0 0-.75-.75.76.76 0 0 0-.75.75v5a.76.76 0 0 0 .75.75h5a.75.75 0 1 0 0-1.5Zm0-16.5h-5a.76.76 0 0 0-.75.75v5a.76.76 0 0 0 .75.75.76.76 0 0 0 .75-.75V4.5h4.25a.76.76 0 0 0 .75-.75.76.76 0 0 0-.75-.75Z"
        />
      </svg>
      <svg aria-hidden="true" viewBox="0 0 24 24" slot="exit">
        <path
          d="M20.25 14.5h-5a.76.76 0 0 0-.75.75v5a.75.75 0 1 0 1.5 0V16h4.25a.75.75 0 1 0 0-1.5Zm-5-5h5a.75.75 0 1 0 0-1.5H16V3.75a.75.75 0 1 0-1.5 0v5a.76.76 0 0 0 .75.75Zm-6.5 5h-5a.75.75 0 1 0 0 1.5H8v4.25a.75.75 0 1 0 1.5 0v-5a.76.76 0 0 0-.75-.75Zm0-11.5a.76.76 0 0 0-.75.75V8H3.75a.75.75 0 0 0 0 1.5h5a.76.76 0 0 0 .75-.75v-5A.76.76 0 0 0 8.75 3Z"
        />
      </svg>
    </media-fullscreen-button>
  </template>

  <template partial="LiveButton">
    <media-live-button
      part="{{section ?? 'top'}} live button"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    ></media-live-button>
  </template>

  <template partial="PlaybackRateButton">
    <media-playback-rate-button
      rates="{{playbackrates}}"
      part="bottom playback-rate button"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    ></media-playback-rate-button>
  </template>

  <template partial="VolumeRange">
    <media-volume-range
      part="bottom volume range"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    ></media-volume-range>
  </template>

  <template partial="TimeDisplay">
    <media-time-display
      remaining="{{defaultshowremainingtime}}"
      showduration="{{!hideduration}}"
      part="bottom time display"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
      
    ></media-time-display>
  </template>

  <template partial="TimeRange">
    <media-time-range
      part="bottom time range"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
      exportparts="thumb"
    ></media-time-range>
  </template>

  <media-controller
    part="controller"
    defaultstreamtype="{{defaultstreamtype ?? 'on-demand'}}"
    breakpoints="sm:300 md:700"
    gesturesdisabled="{{disabled}}"
    hotkeys="{{hotkeys}}"
    nohotkeys="{{nohotkeys}}"
    novolumepref="{{novolumepref}}"
    audio="{{audio}}"
    noautoseektolive="{{noautoseektolive}}"
    defaultsubtitles="{{defaultsubtitles}}"
    defaultduration="{{defaultduration ?? false}}"
    keyboardforwardseekoffset="{{forwardseekoffset}}"
    keyboardbackwardseekoffset="{{backwardseekoffset}}"
    exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer"
  >
    <slot name="media" slot="media"></slot>
    <slot name="poster" slot="poster"></slot>
    <media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator>
    
    <template if="audio">
      <template if="streamtype == 'on-demand'">
        <template if="title">
          <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
        </template>
        <media-control-bar part="control-bar bottom">
          {{>PlayButton}}
          {{>SeekBackwardButton}}
          {{>SeekForwardButton}}
          {{>TimeDisplay}}
          {{>TimeRange}}
          {{>MuteButton}}
          {{>VolumeRange}}
          {{>PlaybackRateButton}}
          {{>AudioTrackSelect}}
          {{>AirplayButton}}
          {{>CastButton}}
        </media-control-bar>
      </template>

      <template if="streamtype == 'live'">

        <template if="targetlivewindow > 0">
          <template if="title">
            <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
          </template>
          <media-control-bar part="control-bar bottom">
            {{>PlayButton}}
            {{>LiveButton section="bottom"}}
            {{>SeekBackwardButton}}
            {{>SeekForwardButton}}
            {{>TimeDisplay}}
            {{>TimeRange}}
            {{>MuteButton}}
            {{>VolumeRange}}
            {{>PlaybackRateButton}}
            {{>AudioTrackSelect}}
            {{>AirplayButton}}
            {{>CastButton}}
          </media-control-bar>
        </template>

        <template if="!targetlivewindow">
          <template if="title">
            <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
          </template>
          <media-control-bar part="control-bar bottom">
            {{>PlayButton}}
            {{>LiveButton section="bottom"}}
            {{>MuteButton}}
            {{>VolumeRange}}
            <div class="spacer"></div>
            {{>AudioTrackSelect}}
            {{>AirplayButton}}
            {{>CastButton}}
          </media-control-bar>
        </template>

      </template>
    </template>

    <template if="!audio">
      <media-error-dialog slot="dialog" noautohide></media-error-dialog>
      <template if="streamtype == 'on-demand'">

        <template if="!breakpointsm">
          {{>TimeRange}}
          <media-control-bar part="control-bar bottom">
            {{>PlayButton}}
            {{>MuteButton}}
            <div class="spacer"></div>
            {{>CaptionsSelect}}
            {{>FullscreenButton}}
          </media-control-bar>
        </template>

        <template if="breakpointsm">
          <template if="!breakpointmd">
            <media-control-bar part="control-bar top" slot="top-chrome">
              {{>TitleDisplay}}
            </media-control-bar>
            <div slot="centered-chrome" class="center-controls">
              {{>SeekBackwardButton section="center"}}
              {{>PlayButton section="center"}}
              {{>SeekForwardButton section="center"}}
            </div>
            {{>TimeRange}}
            <media-control-bar part="control-bar bottom">
              {{>PlayButton}}
              {{>TimeDisplay}}
              {{>MuteButton}}
              {{>VolumeRange}}
              <div class="spacer"></div>
              {{>RenditionSelect}}
              {{>PlaybackRateButton}}
              {{>AudioTrackSelect}}
              {{>CaptionsSelect}}
              {{>AirplayButton}}
              {{>CastButton}}
              {{>PipButton}}
              {{>FullscreenButton}}
            </media-control-bar>
          </template>
        </template>

        <template if="breakpointmd">
          <media-control-bar part="control-bar top" slot="top-chrome">
            {{>TitleDisplay}}
          </media-control-bar>
          <div slot="centered-chrome" class="center-controls">
            {{>PlayButton section="center"}}
          </div>
          {{>TimeRange}}
          <media-control-bar part="control-bar bottom">
            {{>PlayButton}}
            {{>SeekBackwardButton}}
            {{>SeekForwardButton}}
            {{>TimeDisplay}}
            {{>MuteButton}}
            {{>VolumeRange}}
            <div class="spacer"></div>
            {{>RenditionSelect}}
            {{>PlaybackRateButton}}
            {{>AudioTrackSelect}}
            {{>CaptionsSelect}}
            {{>AirplayButton}}
            {{>CastButton}}
            {{>PipButton}}
            {{>FullscreenButton}}
          </media-control-bar>
        </template>

      </template>

      <template if="streamtype == 'live'">

        <template if="!targetlivewindow">

          <template if="!breakpointsm">
            <media-control-bar part="control-bar top" slot="top-chrome">
              {{>LiveButton}}
            </media-control-bar>
            <media-control-bar part="control-bar bottom">
              {{>PlayButton}}
              {{>MuteButton}}
              <div class="spacer"></div>
              {{>CaptionsSelect}}
              {{>FullscreenButton}}
            </media-control-bar>
          </template>

          <template if="breakpointsm">
            <template if="!breakpointmd">
              <media-control-bar part="control-bar top" slot="top-chrome">
                {{>LiveButton}}
                {{>TitleDisplay}}
              </media-control-bar>
              <div slot="centered-chrome" class="center-controls">
                {{>PlayButton section="center"}}
              </div>
              <media-control-bar part="control-bar bottom">
                {{>PlayButton}}
                {{>MuteButton}}
                {{>VolumeRange}}
                <div class="spacer"></div>
                {{>RenditionSelect}}
                {{>AudioTrackSelect}}
                {{>CaptionsSelect}}
                {{>AirplayButton}}
                {{>CastButton}}
                {{>PipButton}}
                {{>FullscreenButton}}
              </media-control-bar>
            </template>
          </template>

          <template if="breakpointmd">
            <media-control-bar part="control-bar top" slot="top-chrome">
              {{>LiveButton}}
              {{>TitleDisplay}}
            </media-control-bar>
            <div slot="centered-chrome" class="center-controls">
              {{>PlayButton section="center"}}
            </div>
            <media-control-bar part="control-bar bottom">
              {{>PlayButton}}
              {{>MuteButton}}
              {{>VolumeRange}}
              <div class="spacer"></div>
              {{>RenditionSelect}}
              {{>AudioTrackSelect}}
              {{>CaptionsSelect}}
              {{>AirplayButton}}
              {{>CastButton}}
              {{>PipButton}}
              {{>FullscreenButton}}
            </media-control-bar>
          </template>
        </template>

        <template if="targetlivewindow > 0">

          <template if="!breakpointsm">
            <media-control-bar part="control-bar top" slot="top-chrome">
              {{>LiveButton}}
            </media-control-bar>
            {{>TimeRange}}
            <media-control-bar part="control-bar bottom">
              {{>PlayButton}}
              {{>MuteButton}}
              <div class="spacer"></div>
              {{>CaptionsSelect}}
              {{>FullscreenButton}}
            </media-control-bar>
          </template>

          <template if="breakpointsm">
            <template if="!breakpointmd">
              <media-control-bar part="control-bar top" slot="top-chrome">
                {{>LiveButton}}
                {{>TitleDisplay}}
              </media-control-bar>
              <div slot="centered-chrome" class="center-controls">
                {{>SeekBackwardButton section="center"}}
                {{>PlayButton section="center"}}
                {{>SeekForwardButton section="center"}}
              </div>
              {{>TimeRange}}
              <media-control-bar part="control-bar bottom">
                {{>PlayButton}}
                {{>MuteButton}}
                {{>VolumeRange}}
                <div class="spacer"></div>
                {{>RenditionSelect}}
                {{>AudioTrackSelect}}
                {{>CaptionsSelect}}
                {{>AirplayButton}}
                {{>CastButton}}
                {{>PipButton}}
                {{>FullscreenButton}}
              </media-control-bar>
            </template>
          </template>

          <template if="breakpointmd">
            <media-control-bar part="control-bar top" slot="top-chrome">
              {{>LiveButton}}
              {{>TitleDisplay}}
            </media-control-bar>
            <div slot="centered-chrome" class="center-controls">
              {{>PlayButton section="center"}}
            </div>
            {{>TimeRange}}
            <media-control-bar part="control-bar bottom">
              {{>PlayButton}}
              {{>SeekBackwardButton}}
              {{>SeekForwardButton}}
              {{>MuteButton}}
              {{>VolumeRange}}
              <div class="spacer"></div>
              {{>RenditionSelect}}
              {{>AudioTrackSelect}}
              {{>CaptionsSelect}}
              {{>AirplayButton}}
              {{>CastButton}}
              {{>PipButton}}
              {{>FullscreenButton}}
            </media-control-bar>
          </template>

        </template>

      </template>

    </template>

    <slot></slot>

  </media-controller>
</template>
`,Pe=class{addEventListener(){}removeEventListener(){}dispatchEvent(p){return!0}};if(typeof DocumentFragment=="undefined"){class p extends Pe{}globalThis.DocumentFragment=p}var he=class extends Pe{},O=class extends Pe{},K={get(p){},define(p,T,w){},getName(p){return null},upgrade(p){},whenDefined(p){return Promise.resolve(he)}},j,ve=class{constructor(p,T={}){H(this,j),Qe(this,j,T==null?void 0:T.detail)}get detail(){return Ne(this,j)}initCustomEvent(){}};j=new WeakMap;function at(p,T){return new he}var ze={document:{createElement:at},DocumentFragment,customElements:K,CustomEvent:ve,EventTarget:Pe,HTMLElement:he,HTMLVideoElement:O},Et=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Xe=Et?ze:globalThis,Ye=Et?ze.document:globalThis.document,Ze={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_LOOP_REQUEST:"medialooprequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},st={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},ht={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_BUFFERED:"mediaBuffered",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_CHAPTERS_CUES:"mediaChaptersCues",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_ENDED:"mediaEnded",MEDIA_ERROR:"mediaError",MEDIA_ERROR_CODE:"mediaErrorCode",MEDIA_ERROR_MESSAGE:"mediaErrorMessage",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_HAS_PLAYED:"mediaHasPlayed",MEDIA_HEIGHT:"mediaHeight",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_IS_PIP:"mediaIsPip",MEDIA_LOADING:"mediaLoading",MEDIA_MUTED:"mediaMuted",MEDIA_LOOP:"mediaLoop",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_LANG:"mediaLang",MEDIA_WIDTH:"mediaWidth"},Je=Object.entries(ht),ae=Je.reduce((p,[T,w])=>(p[T]=w.toLowerCase(),p),{}),dt={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},ke=Je.reduce((p,[T,w])=>(p[T]=w.toLowerCase(),p),zh({},dt)),mt=Object.entries(ke).reduce((p,[T,w])=>{const J=ae[T];return J&&(p[w]=J),p},{userinactivechange:"userinactive"}),At=Object.entries(ae).reduce((p,[T,w])=>{const J=ke[T];return J&&(p[w]=J),p},{userinactive:"userinactivechange"}),Ge={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},De=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},Lt=class extends De{},ut=class extends Lt{constructor(){super(...arguments),this.role=null}},Q=class{observe(){}unobserve(){}disconnect(){}},_={createElement:function(){return new pe.HTMLElement},createElementNS:function(){return new pe.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(p){return!1}},pe={ResizeObserver:Q,document:_,Node:Lt,Element:ut,HTMLElement:class extends ut{constructor(){super(...arguments),this.innerHTML=""}get content(){return new pe.DocumentFragment}},DocumentFragment:class extends De{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem(p){return null},setItem(p,T){},removeItem(p){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia(p){return{matches:!1,media:p}},DOMParser:class{parseFromString(T,w){return{body:{textContent:T}}}}},Ie="global"in globalThis&&(globalThis==null?void 0:globalThis.global)===globalThis||typeof window=="undefined"||typeof window.customElements=="undefined",ct=Object.keys(pe).every(p=>p in globalThis),_e=Ie&&!ct?pe:globalThis,Te=Ie&&!ct?_:globalThis.document,we=(p,T,w)=>{if(!T.has(p))throw TypeError("Cannot "+w)},xt=(p,T,w)=>(we(p,T,"read from private field"),w?w.call(p):T.get(p)),Ir=(p,T,w)=>{if(T.has(p))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(p):T.set(p,w)},V=(p,T,w,J)=>(we(p,T,"write to private field"),J?J.call(p,w):T.set(p,w),w),jt,Br,Rt,U,Be,je,Jt,Nt,Ut,Lr,zr,Wt=1,qe=0,Y=1,te={processCallback(p,T,w){if(w){for(const[J,Ae]of T)if(J in w){const vt=w[J];typeof vt=="boolean"&&Ae instanceof ft&&typeof Ae.element[Ae.attributeName]=="boolean"?Ae.booleanValue=vt:typeof vt=="function"&&Ae instanceof ft?Ae.element[Ae.attributeName]=vt:Ae.value=vt}}}},me=class extends _e.DocumentFragment{constructor(p,T,w=te){var J;super(),Ir(this,jt,void 0),Ir(this,Br,void 0),this.append(p.content.cloneNode(!0)),V(this,jt,it(this)),V(this,Br,w),(J=w.createCallback)==null||J.call(w,this,xt(this,jt),T),w.processCallback(this,xt(this,jt),T)}update(p){xt(this,Br).processCallback(this,xt(this,jt),p)}};jt=new WeakMap,Br=new WeakMap;var it=(p,T=[])=>{let w,J;for(const Ae of p.attributes||[])if(Ae.value.includes("{{")){const vt=new Wr;for([w,J]of Oe(Ae.value))if(!w)vt.append(J);else{const Dt=new ft(p,Ae.name,Ae.namespaceURI);vt.append(Dt),T.push([J,Dt])}Ae.value=vt.toString()}for(const Ae of p.childNodes)if(Ae.nodeType===Wt&&!(Ae instanceof HTMLTemplateElement))it(Ae,T);else{const vt=Ae.data;if(Ae.nodeType===Wt||vt.includes("{{")){const Dt=[];if(vt)for([w,J]of Oe(vt))if(!w)Dt.push(new Text(J));else{const Xt=new Qr(p);Dt.push(Xt),T.push([J,Xt])}else if(Ae instanceof HTMLTemplateElement){const Xt=new li(p,Ae);Dt.push(Xt),T.push([Xt.expression,Xt])}Ae.replaceWith(...Dt.flatMap(Xt=>Xt.replacementNodes||[Xt]))}}return T},kt={},Oe=p=>{let T="",w=0,J=kt[p],Ae=0,vt;if(J)return J;for(J=[];vt=p[Ae];Ae++)vt==="{"&&p[Ae+1]==="{"&&p[Ae-1]!=="\\"&&p[Ae+2]&&++w==1?(T&&J.push([qe,T]),T="",Ae++):vt==="}"&&p[Ae+1]==="}"&&p[Ae-1]!=="\\"&&!--w?(J.push([Y,T.trim()]),T="",Ae++):T+=vt||"";return T&&J.push([qe,(w>0?"{{":"")+T]),kt[p]=J},zt=11,Pt=class{get value(){return""}set value(p){}toString(){return this.value}},Zt=new WeakMap,Wr=class{constructor(){Ir(this,Rt,[])}[Symbol.iterator](){return xt(this,Rt).values()}get length(){return xt(this,Rt).length}item(p){return xt(this,Rt)[p]}append(...p){for(const T of p)T instanceof ft&&Zt.set(T,this),xt(this,Rt).push(T)}toString(){return xt(this,Rt).join("")}};Rt=new WeakMap;var ft=class extends Pt{constructor(p,T,w){super(),Ir(this,Nt),Ir(this,U,""),Ir(this,Be,void 0),Ir(this,je,void 0),Ir(this,Jt,void 0),V(this,Be,p),V(this,je,T),V(this,Jt,w)}get attributeName(){return xt(this,je)}get attributeNamespace(){return xt(this,Jt)}get element(){return xt(this,Be)}get value(){return xt(this,U)}set value(p){xt(this,U)!==p&&(V(this,U,p),!xt(this,Nt,Ut)||xt(this,Nt,Ut).length===1?p==null?xt(this,Be).removeAttributeNS(xt(this,Jt),xt(this,je)):xt(this,Be).setAttributeNS(xt(this,Jt),xt(this,je),p):xt(this,Be).setAttributeNS(xt(this,Jt),xt(this,je),xt(this,Nt,Ut).toString()))}get booleanValue(){return xt(this,Be).hasAttributeNS(xt(this,Jt),xt(this,je))}set booleanValue(p){if(!xt(this,Nt,Ut)||xt(this,Nt,Ut).length===1)this.value=p?"":null;else throw new DOMException("Value is not fully templatized")}};U=new WeakMap,Be=new WeakMap,je=new WeakMap,Jt=new WeakMap,Nt=new WeakSet,Ut=function(){return Zt.get(this)};var Qr=class extends Pt{constructor(p,T){super(),Ir(this,Lr,void 0),Ir(this,zr,void 0),V(this,Lr,p),V(this,zr,T?[...T]:[new Text])}get replacementNodes(){return xt(this,zr)}get parentNode(){return xt(this,Lr)}get nextSibling(){return xt(this,zr)[xt(this,zr).length-1].nextSibling}get previousSibling(){return xt(this,zr)[0].previousSibling}get value(){return xt(this,zr).map(p=>p.textContent).join("")}set value(p){this.replace(p)}replace(...p){const T=p.flat().flatMap(w=>w==null?[new Text]:w.forEach?[...w]:w.nodeType===zt?[...w.childNodes]:w.nodeType?[w]:[new Text(w)]);T.length||T.push(new Text),V(this,zr,ln(xt(this,zr)[0].parentNode,xt(this,zr),T,this.nextSibling))}};Lr=new WeakMap,zr=new WeakMap;var li=class extends Qr{constructor(p,T){const w=T.getAttribute("directive")||T.getAttribute("type");let J=T.getAttribute("expression")||T.getAttribute(w)||"";J.startsWith("{{")&&(J=J.trim().slice(2,-2).trim()),super(p),this.expression=J,this.template=T,this.directive=w}};function ln(p,T,w,J=null){let Ae=0,vt,Dt,Xt,ni=w.length,Kr=T.length;for(;Ae<ni&&Ae<Kr&&T[Ae]==w[Ae];)Ae++;for(;Ae<ni&&Ae<Kr&&w[ni-1]==T[Kr-1];)J=w[--Kr,--ni];if(Ae==Kr)for(;Ae<ni;)p.insertBefore(w[Ae++],J);if(Ae==ni)for(;Ae<Kr;)p.removeChild(T[Ae++]);else{for(vt=T[Ae];Ae<ni;)Xt=w[Ae++],Dt=vt?vt.nextSibling:J,vt==Xt?vt=Dt:Ae<ni&&w[Ae]==Dt?(p.replaceChild(Xt,vt),vt=Dt):p.insertBefore(Xt,vt);for(;vt!=J;)Dt=vt.nextSibling,p.removeChild(vt),vt=Dt}return w}function Ar(p){return p==null?void 0:p.split(/\s+/).map(Yi)}function Yi(p){if(p){const[T,w,J]=p.split(":");return{id:T,width:+w,height:+J}}}function _i(p){return p==null?void 0:p.split(/\s+/).map(br)}function br(p){if(p){const[T,w,J,Ae]=p.split(":");return{id:T,kind:w,language:J,label:Ae}}}function fe(p){return p.replace(/[-_]([a-z])/g,(T,w)=>w.toUpperCase())}function ye(p){return typeof p!="string"?!1:!isNaN(p)&&!isNaN(parseFloat(p))}var oe={string:p=>String(p)},yt=class{constructor(p){this.template=p,this.state=void 0}},qt=new WeakMap,yr=new WeakMap,Rr={partial:(p,T)=>{T[p.expression]=new yt(p.template)},if:(p,T)=>{var w;if(ie(p.expression,T))if(qt.get(p)!==p.template){qt.set(p,p.template);const J=new me(p.template,T,Ht);p.replace(J),yr.set(p,J)}else(w=yr.get(p))==null||w.update(T);else p.replace(""),qt.delete(p),yr.delete(p)}},Qt=Object.keys(Rr),Ht={processCallback(p,T,w){var J,Ae;if(w)for(const[vt,Dt]of T){if(Dt instanceof li){if(!Dt.directive){const ni=Qt.find(Kr=>Dt.template.hasAttribute(Kr));ni&&(Dt.directive=ni,Dt.expression=Dt.template.getAttribute(ni))}(J=Rr[Dt.directive])==null||J.call(Rr,Dt,w);continue}let Xt=ie(vt,w);if(Xt instanceof yt){qt.get(Dt)!==Xt.template?(qt.set(Dt,Xt.template),Xt=new me(Xt.template,Xt.state,Ht),Dt.value=Xt,yr.set(Dt,Xt)):(Ae=yr.get(Dt))==null||Ae.update(Xt.state);continue}Xt?(Dt instanceof ft&&Dt.attributeName.startsWith("aria-")&&(Xt=String(Xt)),Dt instanceof ft?typeof Xt=="boolean"?Dt.booleanValue=Xt:typeof Xt=="function"?Dt.element[Dt.attributeName]=Xt:Dt.value=Xt:(Dt.value=Xt,qt.delete(Dt),yr.delete(Dt))):Dt instanceof ft?Dt.value=void 0:(Dt.value=void 0,qt.delete(Dt),yr.delete(Dt))}}},Ci={"!":p=>!p,"!!":p=>!!p,"==":(p,T)=>p==T,"!=":(p,T)=>p!=T,">":(p,T)=>p>T,">=":(p,T)=>p>=T,"<":(p,T)=>p<T,"<=":(p,T)=>p<=T,"??":(p,T)=>p!=null?p:T,"|":(p,T)=>{var w;return(w=oe[T])==null?void 0:w.call(oe,p)}};function Ft(p){return Hr(p,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:T})=>T!=="ws")}function ie(p,T={}){var w,J,Ae,vt,Dt,Xt,ni;const Kr=Ft(p);if(Kr.length===0||Kr.some(({type:nn})=>!nn))return er(p);if(((w=Kr[0])==null?void 0:w.token)===">"){const nn=T[(J=Kr[1])==null?void 0:J.token];if(!nn)return er(p);const Ta=zh({},T);nn.state=Ta;const Ra=Kr.slice(2);for(let Mn=0;Mn<Ra.length;Mn+=3){const Bl=(Ae=Ra[Mn])==null?void 0:Ae.token,yu=(vt=Ra[Mn+1])==null?void 0:vt.token,Oc=(Dt=Ra[Mn+2])==null?void 0:Dt.token;Bl&&yu==="="&&(Ta[Bl]=Bi(Oc,T))}return nn}if(Kr.length===1)return Ai(Kr[0])?Bi(Kr[0].token,T):er(p);if(Kr.length===2){const nn=(Xt=Kr[0])==null?void 0:Xt.token,Ta=Ci[nn];if(!Ta||!Ai(Kr[1]))return er(p);const Ra=Bi(Kr[1].token,T);return Ta(Ra)}if(Kr.length===3){const nn=(ni=Kr[1])==null?void 0:ni.token,Ta=Ci[nn];if(!Ta||!Ai(Kr[0])||!Ai(Kr[2]))return er(p);const Ra=Bi(Kr[0].token,T);if(nn==="|")return Ta(Ra,Kr[2].token);const Mn=Bi(Kr[2].token,T);return Ta(Ra,Mn)}}function er(p){return console.warn(`Warning: invalid expression \`${p}\``),!1}function Ai({type:p}){return["number","boolean","string","param"].includes(p)}function Bi(p,T){const w=p[0],J=p.slice(-1);return p==="true"||p==="false"?p==="true":w===J&&["'",'"'].includes(w)?p.slice(1,-1):ye(p)?parseFloat(p):T[p]}function Hr(p,T){let w,J,Ae;const vt=[];for(;p;){Ae=null,w=p.length;for(const Dt in T)J=T[Dt].exec(p),J&&J.index<w&&(Ae={token:J[0],type:Dt,matches:J.slice(1)},w=J.index);w&&vt.push({token:p.substr(0,w),type:void 0}),Ae&&vt.push(Ae),p=p.substr(w+(Ae?Ae.token.length:0))}return vt}var pi=(p,T,w)=>{if(!T.has(p))throw TypeError("Cannot "+w)},$r=(p,T,w)=>(pi(p,T,"read from private field"),w?w.call(p):T.get(p)),Jr=(p,T,w)=>{if(T.has(p))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(p):T.set(p,w)},Yr=(p,T,w,J)=>(pi(p,T,"write to private field"),J?J.call(p,w):T.set(p,w),w),Pa=(p,T,w)=>(pi(p,T,"access private method"),w),za,un,zi,aa,ma,Oa,Qi,dn={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},Qa=Te.createElement("template");Qa.innerHTML=`
  <style>
    :host {
      display: inline-block;
      line-height: 0;
    }

    media-controller {
      width: 100%;
      height: 100%;
    }

    media-captions-button:not([mediasubtitleslist]),
    media-captions-menu:not([mediasubtitleslist]),
    media-captions-menu-button:not([mediasubtitleslist]),
    media-audio-track-menu[mediaaudiotrackunavailable],
    media-audio-track-menu-button[mediaaudiotrackunavailable],
    media-rendition-menu[mediarenditionunavailable],
    media-rendition-menu-button[mediarenditionunavailable],
    media-volume-range[mediavolumeunavailable],
    media-airplay-button[mediaairplayunavailable],
    media-fullscreen-button[mediafullscreenunavailable],
    media-cast-button[mediacastunavailable],
    media-pip-button[mediapipunavailable] {
      display: none;
    }
  </style>
`;var Si=class extends _e.HTMLElement{constructor(){super(),Jr(this,aa),Jr(this,Oa),Jr(this,za,void 0),Jr(this,un,void 0),Jr(this,zi,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());const p=new MutationObserver(T=>{var w;this.mediaController&&!((w=this.mediaController)!=null&&w.breakpointsComputed)||T.some(J=>{const Ae=J.target;return Ae===this?!0:Ae.localName!=="media-controller"?!1:!!(dn[J.attributeName]||J.attributeName.startsWith("breakpoint"))})&&this.render()});p.observe(this,{attributes:!0}),p.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.addEventListener(ke.BREAKPOINTS_COMPUTED,this.render),Pa(this,aa,ma).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var p;return(p=$r(this,za))!=null?p:this.constructor.template}set template(p){if(p===null){this.removeAttribute("template");return}typeof p=="string"?this.setAttribute("template",p):p instanceof HTMLTemplateElement&&(Yr(this,za,p),Yr(this,zi,null),this.createRenderer())}get props(){var p,T,w;const J=[...Array.from((T=(p=this.mediaController)==null?void 0:p.attributes)!=null?T:[]).filter(({name:vt})=>dn[vt]||vt.startsWith("breakpoint")),...Array.from(this.attributes)],Ae={};for(const vt of J){const Dt=(w=dn[vt.name])!=null?w:fe(vt.name);let{value:Xt}=vt;Xt!=null?(ye(Xt)&&(Xt=parseFloat(Xt)),Ae[Dt]=Xt===""?!0:Xt):Ae[Dt]=!1}return Ae}attributeChangedCallback(p,T,w){p==="template"&&T!=w&&Pa(this,Oa,Qi).call(this)}connectedCallback(){Pa(this,Oa,Qi).call(this)}createRenderer(){this.template instanceof HTMLTemplateElement&&this.template!==$r(this,un)&&(Yr(this,un,this.template),this.renderer=new me(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(Qa.content.cloneNode(!0),this.renderer))}render(){var p;(p=this.renderer)==null||p.update(this.props)}};za=new WeakMap,un=new WeakMap,zi=new WeakMap,aa=new WeakSet,ma=function(p){if(Object.prototype.hasOwnProperty.call(this,p)){const T=this[p];delete this[p],this[p]=T}},Oa=new WeakSet,Qi=function(){var p;const T=this.getAttribute("template");if(!T||T===$r(this,zi))return;const w=this.getRootNode(),J=(p=w==null?void 0:w.getElementById)==null?void 0:p.call(w,T);if(J){Yr(this,zi,T),Yr(this,za,J),this.createRenderer();return}Gs(T)&&(Yr(this,zi,T),cn(T).then(Ae=>{const vt=Te.createElement("template");vt.innerHTML=Ae,Yr(this,za,vt),this.createRenderer()}).catch(console.error))},Si.observedAttributes=["template"],Si.processor=Ht;function Gs(p){if(!/^(\/|\.\/|https?:\/\/)/.test(p))return!1;const T=/^https?:\/\//.test(p)?void 0:location.origin;try{new URL(p,T)}catch(w){return!1}return!0}function cn(p){return Zm(this,null,function*(){const T=yield fetch(p);if(T.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${T.status}`);return T.text()})}_e.customElements.get("media-theme")||_e.customElements.define("media-theme",Si);function ui({anchor:p,floating:T,placement:w}){const J=Li({anchor:p,floating:T}),{x:Ae,y:vt}=Vr(J,w);return{x:Ae,y:vt}}function Li({anchor:p,floating:T}){return{anchor:Nr(p,T.offsetParent),floating:{x:0,y:0,width:T.offsetWidth,height:T.offsetHeight}}}function Nr(p,T){var w;const J=p.getBoundingClientRect(),Ae=(w=T==null?void 0:T.getBoundingClientRect())!=null?w:{x:0,y:0};return{x:J.x-Ae.x,y:J.y-Ae.y,width:J.width,height:J.height}}function Vr({anchor:p,floating:T},w){const J=qr(w)==="x"?"y":"x",Ae=J==="y"?"height":"width",vt=di(w),Dt=p.x+p.width/2-T.width/2,Xt=p.y+p.height/2-T.height/2,ni=p[Ae]/2-T[Ae]/2;let Kr;switch(vt){case"top":Kr={x:Dt,y:p.y-T.height};break;case"bottom":Kr={x:Dt,y:p.y+p.height};break;case"right":Kr={x:p.x+p.width,y:Xt};break;case"left":Kr={x:p.x-T.width,y:Xt};break;default:Kr={x:p.x,y:p.y}}switch(w.split("-")[1]){case"start":Kr[J]-=ni;break;case"end":Kr[J]+=ni;break}return Kr}function di(p){return p.split("-")[0]}function qr(p){return["top","bottom"].includes(di(p))?"y":"x"}var Kn=new WeakMap,ha=p=>{let T=Kn.get(p);return T||Kn.set(p,T=new Set),T},X=new _e.ResizeObserver(p=>{for(const T of p)for(const w of ha(T.target))w(T)});function W(p,T){ha(p).add(T),X.observe(p)}function se(p,T){const w=ha(p);w.delete(T),w.size||X.unobserve(p)}var Vt=class extends Event{constructor(J){var Ae=J,{action:p="auto",relatedTarget:T}=Ae,w=Xm(Ae,["action","relatedTarget"]);super("invoke",w),this.action=p,this.relatedTarget=T}},Cr=class extends Event{constructor(J){var Ae=J,{newState:p,oldState:T}=Ae,w=Xm(Ae,["newState","oldState"]);super("toggle",w),this.newState=p,this.oldState=T}};function gi(p){const T={};for(const w of p)T[w.name]=w.value;return T}function ei(p){var T;return(T=Xi(p))!=null?T:Gr(p,"media-controller")}function Xi(p){var T;const{MEDIA_CONTROLLER:w}=st,J=p.getAttribute(w);if(J)return(T=Zi(p))==null?void 0:T.getElementById(J)}var Ei=(p,T)=>!p||!T?!1:p!=null&&p.contains(T)?!0:Ei(p,T.getRootNode().host),Gr=(p,T)=>{if(!p)return null;const w=p.closest(T);return w||Gr(p.getRootNode().host,T)};function na(p=document){var T;const w=p==null?void 0:p.activeElement;return w?(T=na(w.shadowRoot))!=null?T:w:null}function Zi(p){var T;const w=(T=p==null?void 0:p.getRootNode)==null?void 0:T.call(p);return w instanceof ShadowRoot||w instanceof Document?w:null}function bs(p,{depth:T=3,checkOpacity:w=!0,checkVisibilityCSS:J=!0}={}){if(p.checkVisibility)return p.checkVisibility({checkOpacity:w,checkVisibilityCSS:J});let Ae=p;for(;Ae&&T>0;){const vt=getComputedStyle(Ae);if(w&&vt.opacity==="0"||J&&vt.visibility==="hidden"||vt.display==="none")return!1;Ae=Ae.parentElement,T--}return!0}function hn(p,T){const w=Ts(p,J=>J===T);return w||xa(p,T)}function Ts(p,T){var w,J;let Ae;for(Ae of(w=p.querySelectorAll("style:not([media])"))!=null?w:[]){let vt;try{vt=(J=Ae.sheet)==null?void 0:J.cssRules}catch(Dt){continue}for(const Dt of vt!=null?vt:[])if(T(Dt.selectorText))return Dt}}function xa(p,T){var w,J;const Ae=(w=p.querySelectorAll("style:not([media])"))!=null?w:[],vt=Ae==null?void 0:Ae[Ae.length-1];return vt!=null&&vt.sheet?(vt==null||vt.sheet.insertRule(`${T}{}`,vt.sheet.cssRules.length),(J=vt.sheet.cssRules)==null?void 0:J[vt.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",p),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function Na(p,T,w=Number.NaN){const J=p.getAttribute(T);return J!=null?+J:w}function Ln(p,T,w){const J=+w;if(w==null||Number.isNaN(J)){p.hasAttribute(T)&&p.removeAttribute(T);return}Na(p,T,void 0)!==J&&p.setAttribute(T,`${J}`)}function Xa(p,T){return p.hasAttribute(T)}function kn(p,T,w){if(w==null){p.hasAttribute(T)&&p.removeAttribute(T);return}Xa(p,T)!=w&&p.toggleAttribute(T,w)}function Sa(p,T,w=null){var J;return(J=p.getAttribute(T))!=null?J:w}function Ua(p,T,w){if(w==null){p.hasAttribute(T)&&p.removeAttribute(T);return}const J=`${w}`;Sa(p,T,void 0)!==J&&p.setAttribute(T,J)}var Ks=(p,T,w)=>{if(!T.has(p))throw TypeError("Cannot "+w)},ur=(p,T,w)=>(Ks(p,T,"read from private field"),w?w.call(p):T.get(p)),hi=(p,T,w)=>{if(T.has(p))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(p):T.set(p,w)},Di=(p,T,w,J)=>(Ks(p,T,"write to private field"),J?J.call(p,w):T.set(p,w),w),ti=(p,T,w)=>(Ks(p,T,"access private method"),w),sa,fn,xi,fa,vr,In,Fa,ls,vn,Rn,Ws,us,xn,Za,fi,Ja,wn,mn,Ba,Wn,pa,oa,ki,pn,Yn,M,P,q,ue,le,We,xe,lt,Ce,wt,gt,Yt,mr,pr,Tr,Ur,wr,Fr,Xr,dr,Ki;function $i({type:p,text:T,value:w,checked:J}){const Ae=Te.createElement("media-chrome-menu-item");Ae.type=p!=null?p:"",Ae.part.add("menu-item"),p&&Ae.part.add(p),Ae.value=w,Ae.checked=J;const vt=Te.createElement("span");return vt.textContent=T,Ae.append(vt),Ae}function Ha(p,T){let w=p.querySelector(`:scope > [slot="${T}"]`);if((w==null?void 0:w.nodeName)=="SLOT"&&(w=w.assignedElements({flatten:!0})[0]),w)return w=w.cloneNode(!0),w;const J=p.shadowRoot.querySelector(`[name="${T}"] > svg`);return J?J.cloneNode(!0):""}function $n(p){return`
    <style>
      :host {
        font: var(--media-font,
          var(--media-font-weight, normal)
          var(--media-font-size, 14px) /
          var(--media-text-content-height, var(--media-control-height, 24px))
          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
        --_menu-bg: rgb(20 20 30 / .8);
        background: var(--media-menu-background, var(--media-control-background, var(--media-secondary-color, var(--_menu-bg))));
        border-radius: var(--media-menu-border-radius);
        border: var(--media-menu-border, none);
        display: var(--media-menu-display, inline-flex) !important;
        
        transition: var(--media-menu-transition-in,
          visibility 0s,
          opacity .2s ease-out,
          transform .15s ease-out,
          left .2s ease-in-out,
          min-width .2s ease-in-out,
          min-height .2s ease-in-out
        ) !important;
        
        visibility: var(--media-menu-visibility, visible);
        opacity: var(--media-menu-opacity, 1);
        max-height: var(--media-menu-max-height, var(--_menu-max-height, 300px));
        transform: var(--media-menu-transform-in, translateY(0) scale(1));
        flex-direction: column;
        
        min-height: 0;
        position: relative;
        bottom: var(--_menu-bottom);
        box-sizing: border-box;
      } 

      @-moz-document url-prefix() {
        :host{
          --_menu-bg: rgb(20 20 30);
        }
      }

      :host([hidden]) {
        transition: var(--media-menu-transition-out,
          visibility .15s ease-in,
          opacity .15s ease-in,
          transform .15s ease-in
        ) !important;
        visibility: var(--media-menu-hidden-visibility, hidden);
        opacity: var(--media-menu-hidden-opacity, 0);
        max-height: var(--media-menu-hidden-max-height,
          var(--media-menu-max-height, var(--_menu-max-height, 300px)));
        transform: var(--media-menu-transform-out, translateY(2px) scale(.99));
        pointer-events: none;
      }

      :host([slot="submenu"]) {
        background: none;
        width: 100%;
        min-height: 100%;
        position: absolute;
        bottom: 0;
        right: -100%;
      }

      #container {
        display: flex;
        flex-direction: column;
        min-height: 0;
        transition: transform .2s ease-out;
        transform: translate(0, 0);
      }

      #container.has-expanded {
        transition: transform .2s ease-in;
        transform: translate(-100%, 0);
      }

      button {
        background: none;
        color: inherit;
        border: none;
        padding: 0;
        font: inherit;
        outline: inherit;
        display: inline-flex;
        align-items: center;
      }

      slot[name="header"][hidden] {
        display: none;
      }

      slot[name="header"] > *,
      slot[name="header"]::slotted(*) {
        padding: .4em .7em;
        border-bottom: 1px solid rgb(255 255 255 / .25);
        cursor: var(--media-cursor, default);
      }

      slot[name="header"] > button[part~="back"],
      slot[name="header"]::slotted(button[part~="back"]) {
        cursor: var(--media-cursor, pointer);
      }

      svg[part~="back"] {
        height: var(--media-menu-icon-height, var(--media-control-height, 24px));
        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
        display: block;
        margin-right: .5ch;
      }

      slot:not([name]) {
        gap: var(--media-menu-gap);
        flex-direction: var(--media-menu-flex-direction, column);
        overflow: var(--media-menu-overflow, hidden auto);
        display: flex;
        min-height: 0;
      }

      :host([role="menu"]) slot:not([name]) {
        padding-block: .4em;
      }

      slot:not([name])::slotted([role="menu"]) {
        background: none;
      }

      media-chrome-menu-item > span {
        margin-right: .5ch;
        max-width: var(--media-menu-item-max-width);
        text-overflow: ellipsis;
        overflow: hidden;
      }
    </style>
    <style id="layout-row" media="width:0">

      slot[name="header"] > *,
      slot[name="header"]::slotted(*) {
        padding: .4em .5em;
      }

      slot:not([name]) {
        gap: var(--media-menu-gap, .25em);
        flex-direction: var(--media-menu-flex-direction, row);
        padding-inline: .5em;
      }

      media-chrome-menu-item {
        padding: .3em .5em;
      }

      media-chrome-menu-item[aria-checked="true"] {
        background: var(--media-menu-item-checked-background, rgb(255 255 255 / .2));
      }

      
      media-chrome-menu-item::part(checked-indicator) {
        display: var(--media-menu-item-checked-indicator-display, none);
      }
    </style>
    <div id="container" part="container">
      <slot name="header" hidden>
        <button part="back button" aria-label="Back to previous menu">
          <slot name="back-icon">
            <svg aria-hidden="true" viewBox="0 0 20 24" part="back indicator">
              <path d="m11.88 17.585.742-.669-4.2-4.665 4.2-4.666-.743-.669-4.803 5.335 4.803 5.334Z"/>
            </svg>
          </slot>
          <slot name="title"></slot>
        </button>
      </slot>
      <slot></slot>
    </div>
    <slot name="checked-indicator" hidden></slot>
  `}var ga={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"},Va=class extends _e.HTMLElement{constructor(){if(super(),hi(this,ls),hi(this,Rn),hi(this,xn),hi(this,fi),hi(this,wn),hi(this,Ba),hi(this,ki),hi(this,Yn),hi(this,P),hi(this,ue),hi(this,We),hi(this,lt),hi(this,wt),hi(this,Yt),hi(this,pr),hi(this,Ur),hi(this,Fr),hi(this,dr),hi(this,sa,null),hi(this,fn,null),hi(this,xi,null),hi(this,fa,new Set),hi(this,vr,void 0),hi(this,In,!1),hi(this,Fa,null),hi(this,us,()=>{const p=ur(this,fa),T=new Set(this.items);for(const w of p)T.has(w)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:w}));for(const w of T)p.has(w)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:w}));Di(this,fa,T)}),hi(this,pa,()=>{ti(this,ki,pn).call(this),ti(this,Yn,M).call(this,!1)}),hi(this,oa,()=>{ti(this,ki,pn).call(this)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const p=gi(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(p)}this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),Di(this,vr,new MutationObserver(ur(this,us))),ur(this,vr).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[ga.DISABLED,ga.HIDDEN,ga.STYLE,ga.ANCHOR,st.MEDIA_CONTROLLER]}static formatMenuItemText(p,T){return p}enable(){this.addEventListener("click",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this),this.addEventListener("invoke",this),this.addEventListener("toggle",this)}disable(){this.removeEventListener("click",this),this.removeEventListener("focusout",this),this.removeEventListener("keyup",this),this.removeEventListener("invoke",this),this.removeEventListener("toggle",this)}handleEvent(p){switch(p.type){case"slotchange":ti(this,ls,vn).call(this,p);break;case"invoke":ti(this,fi,Ja).call(this,p);break;case"click":ti(this,P,q).call(this,p);break;case"toggle":ti(this,We,xe).call(this,p);break;case"focusout":ti(this,wt,gt).call(this,p);break;case"keydown":ti(this,Yt,mr).call(this,p);break}}connectedCallback(){var p,T;Di(this,Fa,xa(this.shadowRoot,":host")),ti(this,xn,Za).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),Di(this,sa,Xi(this)),(T=(p=ur(this,sa))==null?void 0:p.associateElement)==null||T.call(p,this),this.hidden||(W(Cn(this),ur(this,pa)),W(this,ur(this,oa))),ti(this,Rn,Ws).call(this)}disconnectedCallback(){var p,T;se(Cn(this),ur(this,pa)),se(this,ur(this,oa)),this.disable(),(T=(p=ur(this,sa))==null?void 0:p.unassociateElement)==null||T.call(p,this),Di(this,sa,null)}attributeChangedCallback(p,T,w){var J,Ae,vt,Dt;p===ga.HIDDEN&&w!==T?(ur(this,In)||Di(this,In,!0),this.hidden?ti(this,Ba,Wn).call(this):ti(this,wn,mn).call(this),this.dispatchEvent(new Cr({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):p===st.MEDIA_CONTROLLER?(T&&((Ae=(J=ur(this,sa))==null?void 0:J.unassociateElement)==null||Ae.call(J,this),Di(this,sa,null)),w&&this.isConnected&&(Di(this,sa,Xi(this)),(Dt=(vt=ur(this,sa))==null?void 0:vt.associateElement)==null||Dt.call(vt,this))):p===ga.DISABLED&&w!==T?w==null?this.enable():this.disable():p===ga.STYLE&&w!==T&&ti(this,xn,Za).call(this)}formatMenuItemText(p,T){return this.constructor.formatMenuItemText(p,T)}get anchor(){return this.getAttribute("anchor")}set anchor(p){this.setAttribute("anchor",`${p}`)}get anchorElement(){var p;return this.anchor?(p=Zi(this))==null?void 0:p.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(qn)}get radioGroupItems(){return this.items.filter(p=>p.role==="menuitemradio")}get checkedItems(){return this.items.filter(p=>p.checked)}get value(){var p,T;return(T=(p=this.checkedItems[0])==null?void 0:p.value)!=null?T:""}set value(p){const T=this.items.find(w=>w.value===p);T&&ti(this,dr,Ki).call(this,T)}focus(){if(Di(this,fn,na()),this.items.length){ti(this,Fr,Xr).call(this,this.items[0]),this.items[0].focus();return}const p=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');p==null||p.focus()}handleSelect(p){var T;const w=ti(this,pr,Tr).call(this,p);w&&(ti(this,dr,Ki).call(this,w,w.type==="checkbox"),ur(this,xi)&&!this.hidden&&((T=ur(this,fn))==null||T.focus(),this.hidden=!0))}get keysUsed(){return["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(p){var T,w;const{key:J}=p,Ae=this.items,vt=(w=(T=ti(this,pr,Tr).call(this,p))!=null?T:ti(this,Ur,wr).call(this))!=null?w:Ae[0],Dt=Ae.indexOf(vt);let Xt=Math.max(0,Dt);J==="ArrowDown"?Xt++:J==="ArrowUp"?Xt--:p.key==="Home"?Xt=0:p.key==="End"&&(Xt=Ae.length-1),Xt<0&&(Xt=Ae.length-1),Xt>Ae.length-1&&(Xt=0),ti(this,Fr,Xr).call(this,Ae[Xt]),Ae[Xt].focus()}};sa=new WeakMap,fn=new WeakMap,xi=new WeakMap,fa=new WeakMap,vr=new WeakMap,In=new WeakMap,Fa=new WeakMap,ls=new WeakSet,vn=function(p){const T=p.target;for(const w of T.assignedNodes({flatten:!0}))w.nodeType===3&&w.textContent.trim()===""&&w.remove();["header","title"].includes(T.name)&&ti(this,Rn,Ws).call(this),T.name||ur(this,us).call(this)},Rn=new WeakSet,Ws=function(){const p=this.shadowRoot.querySelector('slot[name="header"]'),T=this.shadowRoot.querySelector('slot[name="title"]');p.hidden=T.assignedNodes().length===0&&p.assignedNodes().length===0},us=new WeakMap,xn=new WeakSet,Za=function(){var p;const T=this.shadowRoot.querySelector("#layout-row"),w=(p=getComputedStyle(this).getPropertyValue("--media-menu-layout"))==null?void 0:p.trim();T.setAttribute("media",w==="row"?"":"width:0")},fi=new WeakSet,Ja=function(p){Di(this,xi,p.relatedTarget),Ei(this,p.relatedTarget)||(this.hidden=!this.hidden)},wn=new WeakSet,mn=function(){var p;(p=ur(this,xi))==null||p.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),W(Cn(this),ur(this,pa)),W(this,ur(this,oa))},Ba=new WeakSet,Wn=function(){var p;(p=ur(this,xi))==null||p.setAttribute("aria-expanded","false"),se(Cn(this),ur(this,pa)),se(this,ur(this,oa))},pa=new WeakMap,oa=new WeakMap,ki=new WeakSet,pn=function(p){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;const{x:T,y:w}=ui({anchor:this.anchorElement,floating:this,placement:"top-start"});p!=null||(p=this.offsetWidth);const Ae=Cn(this).getBoundingClientRect(),vt=Ae.width-T-p,Dt=Ae.height-w-this.offsetHeight,{style:Xt}=ur(this,Fa);Xt.setProperty("position","absolute"),Xt.setProperty("right",`${Math.max(0,vt)}px`),Xt.setProperty("--_menu-bottom",`${Dt}px`);const ni=getComputedStyle(this),nn=Xt.getPropertyValue("--_menu-bottom")===ni.bottom?Dt:parseFloat(ni.bottom),Ta=Ae.height-nn-parseFloat(ni.marginBottom);this.style.setProperty("--_menu-max-height",`${Ta}px`)},Yn=new WeakSet,M=function(p){const T=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),w=T==null?void 0:T.querySelector('[role="menu"]'),{style:J}=ur(this,Fa);if(p||J.setProperty("--media-menu-transition-in","none"),w){const Ae=w.offsetHeight,vt=Math.max(w.offsetWidth,T.offsetWidth);this.style.setProperty("min-width",`${vt}px`),this.style.setProperty("min-height",`${Ae}px`),ti(this,ki,pn).call(this,vt)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),ti(this,ki,pn).call(this);J.removeProperty("--media-menu-transition-in")},P=new WeakSet,q=function(p){var T;if(p.stopPropagation(),p.composedPath().includes(ur(this,ue,le))){(T=ur(this,fn))==null||T.focus(),this.hidden=!0;return}const w=ti(this,pr,Tr).call(this,p);!w||w.hasAttribute("disabled")||(ti(this,Fr,Xr).call(this,w),this.handleSelect(p))},ue=new WeakSet,le=function(){var p;return(p=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:!0}))==null?void 0:p.find(w=>w.matches('button[part~="back"]'))},We=new WeakSet,xe=function(p){if(p.target===this)return;ti(this,lt,Ce).call(this);const T=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(const w of T)w.invokeTargetElement!=p.target&&p.newState=="open"&&w.getAttribute("aria-expanded")=="true"&&!w.invokeTargetElement.hidden&&w.invokeTargetElement.dispatchEvent(new Vt({relatedTarget:w}));for(const w of T)w.setAttribute("aria-expanded",`${!w.submenuElement.hidden}`);ti(this,Yn,M).call(this,!0)},lt=new WeakSet,Ce=function(){const T=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!T)},wt=new WeakSet,gt=function(p){var T;Ei(this,p.relatedTarget)||(ur(this,In)&&((T=ur(this,fn))==null||T.focus()),ur(this,xi)&&ur(this,xi)!==p.relatedTarget&&!this.hidden&&(this.hidden=!0))},Yt=new WeakSet,mr=function(p){var T,w,J,Ae,vt;const{key:Dt,ctrlKey:Xt,altKey:ni,metaKey:Kr}=p;if(!(Xt||ni||Kr)&&this.keysUsed.includes(Dt))if(p.preventDefault(),p.stopPropagation(),Dt==="Tab"){if(ur(this,In)){this.hidden=!0;return}p.shiftKey?(w=(T=this.previousElementSibling)==null?void 0:T.focus)==null||w.call(T):(Ae=(J=this.nextElementSibling)==null?void 0:J.focus)==null||Ae.call(J),this.blur()}else Dt==="Escape"?((vt=ur(this,fn))==null||vt.focus(),ur(this,In)&&(this.hidden=!0)):Dt==="Enter"||Dt===" "?this.handleSelect(p):this.handleMove(p)},pr=new WeakSet,Tr=function(p){return p.composedPath().find(T=>["menuitemradio","menuitemcheckbox"].includes(T.role))},Ur=new WeakSet,wr=function(){return this.items.find(p=>p.tabIndex===0)},Fr=new WeakSet,Xr=function(p){for(const T of this.items)T.tabIndex=T===p?0:-1},dr=new WeakSet,Ki=function(p,T){const w=[...this.checkedItems];p.type==="radio"&&this.radioGroupItems.forEach(J=>J.checked=!1),T?p.checked=!p.checked:p.checked=!0,this.checkedItems.some((J,Ae)=>J!=w[Ae])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Va.shadowRootOptions={mode:"open"},Va.getTemplateHTML=$n;function qn(p){return["menuitem","menuitemradio","menuitemcheckbox"].includes(p==null?void 0:p.role)}function Cn(p){var T;return(T=p.getAttribute("bounds")?Gr(p,`#${p.getAttribute("bounds")}`):ei(p)||p.parentElement)!=null?T:p}_e.customElements.get("media-chrome-menu")||_e.customElements.define("media-chrome-menu",Va);var Ys=(p,T,w)=>{if(!T.has(p))throw TypeError("Cannot "+w)},Pr=(p,T,w)=>(Ys(p,T,"read from private field"),w?w.call(p):T.get(p)),La=(p,T,w)=>{if(T.has(p))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(p):T.set(p,w)},ho=(p,T,w,J)=>(Ys(p,T,"write to private field"),J?J.call(p,w):T.set(p,w),w),Ga=(p,T,w)=>(Ys(p,T,"access private method"),w),_s,fo,ml,$s,Hi,pl,gl,lu,ka,qs,vo,Mi,gr,Ji,Ka;function I(p){return`
    <style>
      :host {
        transition: var(--media-menu-item-transition,
          background .15s linear,
          opacity .2s ease-in-out
        );
        outline: var(--media-menu-item-outline, 0);
        outline-offset: var(--media-menu-item-outline-offset, -1px);
        cursor: var(--media-cursor, pointer);
        display: flex;
        align-items: center;
        align-self: stretch;
        justify-self: stretch;
        white-space: nowrap;
        white-space-collapse: collapse;
        text-wrap: nowrap;
        padding: .4em .8em .4em 1em;
      }

      :host(:focus-visible) {
        box-shadow: var(--media-menu-item-focus-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));
        outline: var(--media-menu-item-hover-outline, 0);
        outline-offset: var(--media-menu-item-hover-outline-offset,  var(--media-menu-item-outline-offset, -1px));
      }

      :host(:hover) {
        cursor: var(--media-cursor, pointer);
        background: var(--media-menu-item-hover-background, rgb(92 92 102 / .5));
        outline: var(--media-menu-item-hover-outline);
        outline-offset: var(--media-menu-item-hover-outline-offset,  var(--media-menu-item-outline-offset, -1px));
      }

      :host([aria-checked="true"]) {
        background: var(--media-menu-item-checked-background);
      }

      :host([hidden]) {
        display: none;
      }

      :host([disabled]) {
        pointer-events: none;
        color: rgba(255, 255, 255, .3);
      }

      slot:not([name]) {
        width: 100%;
      }

      slot:not([name="submenu"]) {
        display: inline-flex;
        align-items: center;
        transition: inherit;
        opacity: var(--media-menu-item-opacity, 1);
      }

      slot[name="description"] {
        justify-content: end;
      }

      slot[name="description"] > span {
        display: inline-block;
        margin-inline: 1em .2em;
        max-width: var(--media-menu-item-description-max-width, 100px);
        text-overflow: ellipsis;
        overflow: hidden;
        font-size: .8em;
        font-weight: 400;
        text-align: right;
        position: relative;
        top: .04em;
      }

      slot[name="checked-indicator"] {
        display: none;
      }

      :host(:is([role="menuitemradio"],[role="menuitemcheckbox"])) slot[name="checked-indicator"] {
        display: var(--media-menu-item-checked-indicator-display, inline-block);
      }

      
      svg, img, ::slotted(svg), ::slotted(img) {
        height: var(--media-menu-item-icon-height, var(--media-control-height, 24px));
        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
        display: block;
      }

      
      [part~="indicator"],
      ::slotted([part~="indicator"]) {
        fill: var(--media-menu-item-indicator-fill,
          var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))));
        height: var(--media-menu-item-indicator-height, 1.25em);
        margin-right: .5ch;
      }

      [part~="checked-indicator"] {
        visibility: hidden;
      }

      :host([aria-checked="true"]) [part~="checked-indicator"] {
        visibility: visible;
      }
    </style>
    <slot name="checked-indicator">
      <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator">
        <path d="m10 15.17 9.193-9.191 1.414 1.414-10.606 10.606-6.364-6.364 1.414-1.414 4.95 4.95Z"/>
      </svg>
    </slot>
    <slot name="prefix"></slot>
    <slot></slot>
    <slot name="description"></slot>
    <slot name="suffix">
      ${this.getSuffixSlotInnerHTML(p)}
    </slot>
    <slot name="submenu"></slot>
  `}function A(p){return""}var k={TYPE:"type",VALUE:"value",CHECKED:"checked",DISABLED:"disabled"},x=class extends _e.HTMLElement{constructor(){if(super(),La(this,ml),La(this,Hi),La(this,gl),La(this,qs),La(this,Mi),La(this,Ji),La(this,_s,!1),La(this,fo,void 0),La(this,ka,()=>{var p,T;this.submenuElement.items&&this.setAttribute("submenusize",`${this.submenuElement.items.length}`);const w=this.shadowRoot.querySelector('slot[name="description"]'),J=(p=this.submenuElement.checkedItems)==null?void 0:p[0],Ae=(T=J==null?void 0:J.dataset.description)!=null?T:J==null?void 0:J.text,vt=Te.createElement("span");vt.textContent=Ae!=null?Ae:"",w.replaceChildren(vt)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const p=gi(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(p)}this.shadowRoot.addEventListener("slotchange",this)}static get observedAttributes(){return[k.TYPE,k.DISABLED,k.CHECKED,k.VALUE]}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),D(this)&&!this.hasAttribute("aria-checked")&&this.setAttribute("aria-checked","false"),this.addEventListener("click",this),this.addEventListener("keydown",this)}disable(){this.removeAttribute("tabindex"),this.removeEventListener("click",this),this.removeEventListener("keydown",this),this.removeEventListener("keyup",this)}handleEvent(p){switch(p.type){case"slotchange":Ga(this,ml,$s).call(this,p);break;case"click":this.handleClick(p);break;case"keydown":Ga(this,Mi,gr).call(this,p);break;case"keyup":Ga(this,qs,vo).call(this,p);break}}attributeChangedCallback(p,T,w){p===k.CHECKED&&D(this)&&!Pr(this,_s)?this.setAttribute("aria-checked",w!=null?"true":"false"):p===k.TYPE&&w!==T?this.role="menuitem"+w:p===k.DISABLED&&w!==T&&(w==null?this.enable():this.disable())}connectedCallback(){this.hasAttribute(k.DISABLED)||this.enable(),this.role="menuitem"+this.type,ho(this,fo,z(this,this.parentNode)),Ga(this,Ji,Ka).call(this),this.submenuElement&&Ga(this,Hi,pl).call(this)}disconnectedCallback(){this.disable(),Ga(this,Ji,Ka).call(this),ho(this,fo,null)}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(p){this.setAttribute("invoketarget",`${p}`)}get invokeTargetElement(){var p;return this.invokeTarget?(p=Zi(this))==null?void 0:p.querySelector(`#${this.invokeTarget}`):this.submenuElement}get submenuElement(){return this.shadowRoot.querySelector('slot[name="submenu"]').assignedElements({flatten:!0})[0]}get type(){var p;return(p=this.getAttribute(k.TYPE))!=null?p:""}set type(p){this.setAttribute(k.TYPE,`${p}`)}get value(){var p;return(p=this.getAttribute(k.VALUE))!=null?p:this.text}set value(p){this.setAttribute(k.VALUE,p)}get text(){var p;return((p=this.textContent)!=null?p:"").trim()}get checked(){if(D(this))return this.getAttribute("aria-checked")==="true"}set checked(p){D(this)&&(ho(this,_s,!0),this.setAttribute("aria-checked",p?"true":"false"),p?this.part.add("checked"):this.part.remove("checked"))}handleClick(p){D(this)||this.invokeTargetElement&&Ei(this,p.target)&&this.invokeTargetElement.dispatchEvent(new Vt({relatedTarget:this}))}get keysUsed(){return["Enter"," "]}};_s=new WeakMap,fo=new WeakMap,ml=new WeakSet,$s=function(p){const T=p.target;if(!(T!=null&&T.name))for(const J of T.assignedNodes({flatten:!0}))J instanceof Text&&J.textContent.trim()===""&&J.remove();T.name==="submenu"&&(this.submenuElement?Ga(this,Hi,pl).call(this):Ga(this,gl,lu).call(this))},Hi=new WeakSet,pl=function(){return Zm(this,null,function*(){this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",`${!this.submenuElement.hidden}`),this.submenuElement.addEventListener("change",Pr(this,ka)),this.submenuElement.addEventListener("addmenuitem",Pr(this,ka)),this.submenuElement.addEventListener("removemenuitem",Pr(this,ka)),Pr(this,ka).call(this)})},gl=new WeakSet,lu=function(){this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.submenuElement.removeEventListener("change",Pr(this,ka)),this.submenuElement.removeEventListener("addmenuitem",Pr(this,ka)),this.submenuElement.removeEventListener("removemenuitem",Pr(this,ka)),Pr(this,ka).call(this)},ka=new WeakMap,qs=new WeakSet,vo=function(p){const{key:T}=p;if(!this.keysUsed.includes(T)){this.removeEventListener("keyup",Ga(this,qs,vo));return}this.handleClick(p)},Mi=new WeakSet,gr=function(p){const{metaKey:T,altKey:w,key:J}=p;if(T||w||!this.keysUsed.includes(J)){this.removeEventListener("keyup",Ga(this,qs,vo));return}this.addEventListener("keyup",Ga(this,qs,vo),{once:!0})},Ji=new WeakSet,Ka=function(){var p;const T=(p=Pr(this,fo))==null?void 0:p.radioGroupItems;if(!T)return;let w=T.filter(J=>J.getAttribute("aria-checked")==="true").pop();w||(w=T[0]);for(const J of T)J.setAttribute("aria-checked","false");w==null||w.setAttribute("aria-checked","true")},x.shadowRootOptions={mode:"open"},x.getTemplateHTML=I,x.getSuffixSlotInnerHTML=A;function D(p){return p.type==="radio"||p.type==="checkbox"}function z(p,T){if(!p)return null;const{host:w}=p.getRootNode();return!T&&w?z(p,w):T!=null&&T.items?T:z(T,T==null?void 0:T.parentNode)}_e.customElements.get("media-chrome-menu-item")||_e.customElements.define("media-chrome-menu-item",x);function $(p){return`
    ${Va.getTemplateHTML(p)}
    <style>
      :host {
        --_menu-bg: rgb(20 20 30 / .8);
        background: var(--media-settings-menu-background,
            var(--media-menu-background,
              var(--media-control-background,
                var(--media-secondary-color, var(--_menu-bg)))));
        min-width: var(--media-settings-menu-min-width, 170px);
        border-radius: 2px 2px 0 0;
        overflow: hidden;
      }

      @-moz-document url-prefix() {
        :host{
          --_menu-bg: rgb(20 20 30);
        }
      }

      :host([role="menu"]) {
        
        justify-content: end;
      }

      slot:not([name]) {
        justify-content: var(--media-settings-menu-justify-content);
        flex-direction: var(--media-settings-menu-flex-direction, column);
        overflow: visible;
      }

      #container.has-expanded {
        --media-settings-menu-item-opacity: 0;
      }
    </style>
  `}var Fe=class extends Va{get anchorElement(){return this.anchor!=="auto"?super.anchorElement:ei(this).querySelector("media-settings-menu-button")}};Fe.getTemplateHTML=$,_e.customElements.get("media-settings-menu")||_e.customElements.define("media-settings-menu",Fe);function Ve(p){return`
    ${x.getTemplateHTML.call(this,p)}
    <style>
      slot:not([name="submenu"]) {
        opacity: var(--media-settings-menu-item-opacity, var(--media-menu-item-opacity));
      }

      :host([aria-expanded="true"]:hover) {
        background: transparent;
      }
    </style>
  `}function tt(p){return`
    <svg aria-hidden="true" viewBox="0 0 20 24">
      <path d="m8.12 17.585-.742-.669 4.2-4.665-4.2-4.666.743-.669 4.803 5.335-4.803 5.334Z"/>
    </svg>
  `}var Mt=class extends x{};Mt.shadowRootOptions={mode:"open"},Mt.getTemplateHTML=Ve,Mt.getSuffixSlotInnerHTML=tt,_e.customElements.get("media-settings-menu-item")||_e.customElements.define("media-settings-menu-item",Mt);var Gt={PLACEMENT:"placement",BOUNDS:"bounds"};function et(p){return`
    <style>
      :host {
        --_tooltip-background-color: var(--media-tooltip-background-color, var(--media-secondary-color, rgba(20, 20, 30, .7)));
        --_tooltip-background: var(--media-tooltip-background, var(--_tooltip-background-color));
        --_tooltip-arrow-half-width: calc(var(--media-tooltip-arrow-width, 12px) / 2);
        --_tooltip-arrow-height: var(--media-tooltip-arrow-height, 5px);
        --_tooltip-arrow-background: var(--media-tooltip-arrow-color, var(--_tooltip-background-color));
        position: relative;
        pointer-events: none;
        display: var(--media-tooltip-display, inline-flex);
        justify-content: center;
        align-items: center;
        box-sizing: border-box;
        z-index: var(--media-tooltip-z-index, 1);
        background: var(--_tooltip-background);
        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
        font: var(--media-font,
          var(--media-font-weight, 400)
          var(--media-font-size, 13px) /
          var(--media-text-content-height, var(--media-control-height, 18px))
          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
        padding: var(--media-tooltip-padding, .35em .7em);
        border: var(--media-tooltip-border, none);
        border-radius: var(--media-tooltip-border-radius, 5px);
        filter: var(--media-tooltip-filter, drop-shadow(0 0 4px rgba(0, 0, 0, .2)));
        white-space: var(--media-tooltip-white-space, nowrap);
      }

      :host([hidden]) {
        display: none;
      }

      img, svg {
        display: inline-block;
      }

      #arrow {
        position: absolute;
        width: 0px;
        height: 0px;
        border-style: solid;
        display: var(--media-tooltip-arrow-display, block);
      }

      :host(:not([placement])),
      :host([placement="top"]) {
        position: absolute;
        bottom: calc(100% + var(--media-tooltip-distance, 12px));
        left: 50%;
        transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0);
      }
      :host(:not([placement])) #arrow,
      :host([placement="top"]) #arrow {
        top: 100%;
        left: 50%;
        border-width: var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width);
        border-color: var(--_tooltip-arrow-background) transparent transparent transparent;
        transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0);
      }

      :host([placement="right"]) {
        position: absolute;
        left: calc(100% + var(--media-tooltip-distance, 12px));
        top: 50%;
        transform: translate(0, -50%);
      }
      :host([placement="right"]) #arrow {
        top: 50%;
        right: 100%;
        border-width: var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0;
        border-color: transparent var(--_tooltip-arrow-background) transparent transparent;
        transform: translate(0, -50%);
      }

      :host([placement="bottom"]) {
        position: absolute;
        top: calc(100% + var(--media-tooltip-distance, 12px));
        left: 50%;
        transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0);
      }
      :host([placement="bottom"]) #arrow {
        bottom: 100%;
        left: 50%;
        border-width: 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width);
        border-color: transparent transparent var(--_tooltip-arrow-background) transparent;
        transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0);
      }

      :host([placement="left"]) {
        position: absolute;
        right: calc(100% + var(--media-tooltip-distance, 12px));
        top: 50%;
        transform: translate(0, -50%);
      }
      :host([placement="left"]) #arrow {
        top: 50%;
        left: 100%;
        border-width: var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height);
        border-color: transparent transparent transparent var(--_tooltip-arrow-background);
        transform: translate(0, -50%);
      }
      
      :host([placement="none"]) #arrow {
        display: none;
      }
    </style>
    <slot></slot>
    <div id="arrow"></div>
  `}var Ue=class extends _e.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var p;if(!bs(this,{checkOpacity:!1,checkVisibilityCSS:!1}))return;const T=this.placement;if(T==="left"||T==="right"){this.style.removeProperty("--media-tooltip-offset-x");return}const w=getComputedStyle(this),J=(p=Gr(this,"#"+this.bounds))!=null?p:ei(this);if(!J)return;const{x:Ae,width:vt}=J.getBoundingClientRect(),{x:Dt,width:Xt}=this.getBoundingClientRect(),ni=Dt+Xt,Kr=Ae+vt,nn=w.getPropertyValue("--media-tooltip-offset-x"),Ta=nn?parseFloat(nn.replace("px","")):0,Ra=w.getPropertyValue("--media-tooltip-container-margin"),Mn=Ra?parseFloat(Ra.replace("px","")):0,Bl=Dt-Ae+Ta-Mn,yu=ni-Kr+Ta+Mn;if(Bl<0){this.style.setProperty("--media-tooltip-offset-x",`${Bl}px`);return}if(yu>0){this.style.setProperty("--media-tooltip-offset-x",`${yu}px`);return}this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const p=gi(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(p)}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){const p=this.placement;delete this.placement,this.placement=p}}static get observedAttributes(){return[Gt.PLACEMENT,Gt.BOUNDS]}get placement(){return Sa(this,Gt.PLACEMENT)}set placement(p){Ua(this,Gt.PLACEMENT,p)}get bounds(){return Sa(this,Gt.BOUNDS)}set bounds(p){Ua(this,Gt.BOUNDS,p)}};Ue.shadowRootOptions={mode:"open"},Ue.getTemplateHTML=et,_e.customElements.get("media-tooltip")||_e.customElements.define("media-tooltip",Ue);var bt=Ue,tr=(p,T,w)=>{if(!T.has(p))throw TypeError("Cannot "+w)},Kt=(p,T,w)=>(tr(p,T,"read from private field"),w?w.call(p):T.get(p)),Or=(p,T,w)=>{if(T.has(p))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(p):T.set(p,w)},$t=(p,T,w,J)=>(tr(p,T,"write to private field"),J?J.call(p,w):T.set(p,w),w),Ot=(p,T,w)=>(tr(p,T,"access private method"),w),St,Sr,kr,rt,ri,Ni,Vi,ii={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function oi(p,T={}){return`
    <style>
      :host {
        position: relative;
        font: var(--media-font,
          var(--media-font-weight, bold)
          var(--media-font-size, 14px) /
          var(--media-text-content-height, var(--media-control-height, 24px))
          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
        background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
        padding: var(--media-button-padding, var(--media-control-padding, 10px));
        justify-content: var(--media-button-justify-content, center);
        display: inline-flex;
        align-items: center;
        vertical-align: middle;
        box-sizing: border-box;
        transition: background .15s linear;
        pointer-events: auto;
        cursor: var(--media-cursor, pointer);
        -webkit-tap-highlight-color: transparent;
      }

      
      :host(:focus-visible) {
        box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));
        outline: 0;
      }
      
      :host(:where(:focus)) {
        box-shadow: none;
        outline: 0;
      }

      :host(:hover) {
        background: var(--media-control-hover-background, rgba(50 50 70 / .7));
      }

      svg, img, ::slotted(svg), ::slotted(img) {
        width: var(--media-button-icon-width);
        height: var(--media-button-icon-height, var(--media-control-height, 24px));
        transform: var(--media-button-icon-transform);
        transition: var(--media-button-icon-transition);
        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
        vertical-align: middle;
        max-width: 100%;
        max-height: 100%;
        min-width: 100%;
      }

      media-tooltip {
        
        max-width: 0;
        overflow-x: clip;
        opacity: 0;
        transition: opacity .3s, max-width 0s 9s;
      }

      :host(:hover) media-tooltip,
      :host(:focus-visible) media-tooltip {
        max-width: 100vw;
        opacity: 1;
        transition: opacity .3s;
      }

      :host([notooltip]) slot[name="tooltip"] {
        display: none;
      }
    </style>

    ${this.getSlotTemplateHTML(p,T)}

    <slot name="tooltip">
      <media-tooltip part="tooltip" aria-hidden="true">
        <template shadowrootmode="${bt.shadowRootOptions.mode}">
          ${bt.getTemplateHTML({})}
        </template>
        <slot name="tooltip-content">
          ${this.getTooltipContentHTML(p)}
        </slot>
      </media-tooltip>
    </slot>
  `}function Dn(p,T){return`
    <slot></slot>
  `}function As(){return""}var en=class extends _e.HTMLElement{constructor(){if(super(),Or(this,Ni),Or(this,St,void 0),this.preventClick=!1,this.tooltipEl=null,Or(this,Sr,p=>{this.preventClick||this.handleClick(p),setTimeout(Kt(this,kr),0)}),Or(this,kr,()=>{var p,T;(T=(p=this.tooltipEl)==null?void 0:p.updateXOffset)==null||T.call(p)}),Or(this,rt,p=>{const{key:T}=p;if(!this.keysUsed.includes(T)){this.removeEventListener("keyup",Kt(this,rt));return}this.preventClick||this.handleClick(p)}),Or(this,ri,p=>{const{metaKey:T,altKey:w,key:J}=p;if(T||w||!this.keysUsed.includes(J)){this.removeEventListener("keyup",Kt(this,rt));return}this.addEventListener("keyup",Kt(this,rt),{once:!0})}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const p=gi(this.attributes),T=this.constructor.getTemplateHTML(p);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(T):this.shadowRoot.innerHTML=T}this.tooltipEl=this.shadowRoot.querySelector("media-tooltip")}static get observedAttributes(){return["disabled",ii.TOOLTIP_PLACEMENT,st.MEDIA_CONTROLLER,ae.MEDIA_LANG]}enable(){this.addEventListener("click",Kt(this,Sr)),this.addEventListener("keydown",Kt(this,ri)),this.tabIndex=0}disable(){this.removeEventListener("click",Kt(this,Sr)),this.removeEventListener("keydown",Kt(this,ri)),this.removeEventListener("keyup",Kt(this,rt)),this.tabIndex=-1}attributeChangedCallback(p,T,w){var J,Ae,vt,Dt,Xt;p===st.MEDIA_CONTROLLER?(T&&((Ae=(J=Kt(this,St))==null?void 0:J.unassociateElement)==null||Ae.call(J,this),$t(this,St,null)),w&&this.isConnected&&($t(this,St,(vt=this.getRootNode())==null?void 0:vt.getElementById(w)),(Xt=(Dt=Kt(this,St))==null?void 0:Dt.associateElement)==null||Xt.call(Dt,this))):p==="disabled"&&w!==T?w==null?this.enable():this.disable():p===ii.TOOLTIP_PLACEMENT&&this.tooltipEl&&w!==T?this.tooltipEl.placement=w:p===ae.MEDIA_LANG&&(this.shadowRoot.querySelector('slot[name="tooltip-content"]').innerHTML=this.constructor.getTooltipContentHTML()),Kt(this,kr).call(this)}connectedCallback(){var p,T,w;const{style:J}=hn(this.shadowRoot,":host");J.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),this.hasAttribute("disabled")?this.disable():this.enable(),this.setAttribute("role","button");const Ae=this.getAttribute(st.MEDIA_CONTROLLER);Ae&&($t(this,St,(p=this.getRootNode())==null?void 0:p.getElementById(Ae)),(w=(T=Kt(this,St))==null?void 0:T.associateElement)==null||w.call(T,this)),_e.customElements.whenDefined("media-tooltip").then(()=>Ot(this,Ni,Vi).call(this))}disconnectedCallback(){var p,T;this.disable(),(T=(p=Kt(this,St))==null?void 0:p.unassociateElement)==null||T.call(p,this),$t(this,St,null),this.removeEventListener("mouseenter",Kt(this,kr)),this.removeEventListener("focus",Kt(this,kr)),this.removeEventListener("click",Kt(this,Sr))}get keysUsed(){return["Enter"," "]}get tooltipPlacement(){return Sa(this,ii.TOOLTIP_PLACEMENT)}set tooltipPlacement(p){Ua(this,ii.TOOLTIP_PLACEMENT,p)}get mediaController(){return Sa(this,st.MEDIA_CONTROLLER)}set mediaController(p){Ua(this,st.MEDIA_CONTROLLER,p)}get disabled(){return Xa(this,ii.DISABLED)}set disabled(p){kn(this,ii.DISABLED,p)}get noTooltip(){return Xa(this,ii.NO_TOOLTIP)}set noTooltip(p){kn(this,ii.NO_TOOLTIP,p)}handleClick(p){}};St=new WeakMap,Sr=new WeakMap,kr=new WeakMap,rt=new WeakMap,ri=new WeakMap,Ni=new WeakSet,Vi=function(){this.addEventListener("mouseenter",Kt(this,kr)),this.addEventListener("focus",Kt(this,kr)),this.addEventListener("click",Kt(this,Sr));const p=this.tooltipPlacement;p&&this.tooltipEl&&(this.tooltipEl.placement=p)},en.shadowRootOptions={mode:"open"},en.getTemplateHTML=oi,en.getSlotTemplateHTML=Dn,en.getTooltipContentHTML=As,_e.customElements.get("media-chrome-button")||_e.customElements.define("media-chrome-button",en);var la=class extends en{connectedCallback(){super.connectedCallback(),this.invokeTargetElement&&this.setAttribute("aria-haspopup","menu")}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(p){this.setAttribute("invoketarget",`${p}`)}get invokeTargetElement(){var p;return this.invokeTarget?(p=Zi(this))==null?void 0:p.querySelector(`#${this.invokeTarget}`):null}handleClick(){var p;(p=this.invokeTargetElement)==null||p.dispatchEvent(new Vt({relatedTarget:this}))}};_e.customElements.get("media-chrome-menu-button")||_e.customElements.define("media-chrome-menu-button",la);var Ss={"Start airplay":"Start airplay","Stop airplay":"Stop airplay",Audio:"Audio",Captions:"Captions","Enable captions":"Enable captions","Disable captions":"Disable captions","Start casting":"Start casting","Stop casting":"Stop casting","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",Mute:"Mute",Unmute:"Unmute",Loop:"Loop","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings",Auto:"Auto","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute","chapter: {chapterName}":"chapter: {chapterName}",live:"live",Off:"Off","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","Source Not Supported":"Source Not Supported","Encryption Error":"Encryption Error","A network error caused the media download to fail.":"A network error caused the media download to fail.","A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.":"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.","An unsupported error occurred. The server or network failed, or your browser does not support this format.":"An unsupported error occurred. The server or network failed, or your browser does not support this format.","The media is encrypted and there are no keys to decrypt it.":"The media is encrypted and there are no keys to decrypt it."},gn,Ls={en:Ss},mo=((gn=globalThis.navigator)==null?void 0:gn.language)||"en",tn=p=>{var T,w,J;const[Ae]=mo.split("-");return((T=Ls[mo])==null?void 0:T[p])||((w=Ls[Ae])==null?void 0:w[p])||((J=Ls.en)==null?void 0:J[p])||p},vi=(p,T={})=>tn(p).replace(/\{(\w+)\}/g,(w,J)=>J in T?String(T[J]):`{${J}}`);function El(){return`
    <style>
      :host([aria-expanded="true"]) slot[name=tooltip] {
        display: none;
      }
    </style>
    <slot name="icon">
      <svg aria-hidden="true" viewBox="0 0 24 24">
        <path d="M4.5 14.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm7.5 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm7.5 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z"/>
      </svg>
    </slot>
  `}function po(){return vi("Settings")}var Po=class extends la{static get observedAttributes(){return[...super.observedAttributes,"target"]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",vi("settings"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:ei(this).querySelector("media-settings-menu")}};Po.getSlotTemplateHTML=El,Po.getTooltipContentHTML=po,_e.customElements.get("media-settings-menu-button")||_e.customElements.define("media-settings-menu-button",Po);var go=(p,T,w)=>{if(!T.has(p))throw TypeError("Cannot "+w)},ta=(p,T,w)=>(go(p,T,"read from private field"),w?w.call(p):T.get(p)),ks=(p,T,w)=>{if(T.has(p))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(p):T.set(p,w)},Eo=(p,T,w,J)=>(go(p,T,"write to private field"),J?J.call(p,w):T.set(p,w),w),yl=(p,T,w)=>(go(p,T,"access private method"),w),Wa,ds,Nn,Is,js,Oo,Pd=class extends Va{constructor(){super(...arguments),ks(this,Nn),ks(this,js),ks(this,Wa,[]),ks(this,ds,void 0)}static get observedAttributes(){return[...super.observedAttributes,ae.MEDIA_AUDIO_TRACK_LIST,ae.MEDIA_AUDIO_TRACK_ENABLED,ae.MEDIA_AUDIO_TRACK_UNAVAILABLE]}attributeChangedCallback(p,T,w){super.attributeChangedCallback(p,T,w),p===ae.MEDIA_AUDIO_TRACK_ENABLED&&T!==w?this.value=w:p===ae.MEDIA_AUDIO_TRACK_LIST&&T!==w&&(Eo(this,Wa,_i(w!=null?w:"")),yl(this,Nn,Is).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",yl(this,js,Oo))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",yl(this,js,Oo))}get anchorElement(){var p;return this.anchor!=="auto"?super.anchorElement:(p=ei(this))==null?void 0:p.querySelector("media-audio-track-menu-button")}get mediaAudioTrackList(){return ta(this,Wa)}set mediaAudioTrackList(p){Eo(this,Wa,p),yl(this,Nn,Is).call(this)}get mediaAudioTrackEnabled(){var p;return(p=Sa(this,ae.MEDIA_AUDIO_TRACK_ENABLED))!=null?p:""}set mediaAudioTrackEnabled(p){Ua(this,ae.MEDIA_AUDIO_TRACK_ENABLED,p)}};Wa=new WeakMap,ds=new WeakMap,Nn=new WeakSet,Is=function(){if(ta(this,ds)===JSON.stringify(this.mediaAudioTrackList))return;Eo(this,ds,JSON.stringify(this.mediaAudioTrackList));const p=this.mediaAudioTrackList;this.defaultSlot.textContent="",p.sort((T,w)=>T.id.localeCompare(w.id,void 0,{numeric:!0}));for(const T of p){const w=this.formatMenuItemText(T.label,T),J=$i({type:"radio",text:w,value:`${T.id}`,checked:T.enabled});J.prepend(Ha(this,"checked-indicator")),this.defaultSlot.append(J)}},js=new WeakSet,Oo=function(){if(this.value==null)return;const p=new _e.CustomEvent(Ze.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(p)},_e.customElements.get("media-audio-track-menu")||_e.customElements.define("media-audio-track-menu",Pd);var Rs=`<svg aria-hidden="true" viewBox="0 0 24 24">
  <path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/>
  <path d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"/>
</svg>`;function bl(){return`
    <style>
      :host([aria-expanded="true"]) slot[name=tooltip] {
        display: none;
      }
    </style>
    <slot name="icon">${Rs}</slot>
  `}function Cc(){return vi("Audio")}var Qu=p=>{const T=vi("Audio");p.setAttribute("aria-label",T)},ra=class extends la{static get observedAttributes(){return[...super.observedAttributes,ae.MEDIA_AUDIO_TRACK_ENABLED,ae.MEDIA_AUDIO_TRACK_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),Qu(this)}attributeChangedCallback(p,T,w){super.attributeChangedCallback(p,T,w),p===ae.MEDIA_LANG&&Qu(this)}get invokeTargetElement(){var p;return this.invokeTarget!=null?super.invokeTargetElement:(p=ei(this))==null?void 0:p.querySelector("media-audio-track-menu")}get mediaAudioTrackEnabled(){var p;return(p=Sa(this,ae.MEDIA_AUDIO_TRACK_ENABLED))!=null?p:""}set mediaAudioTrackEnabled(p){Ua(this,ae.MEDIA_AUDIO_TRACK_ENABLED,p)}};ra.getSlotTemplateHTML=bl,ra.getTooltipContentHTML=Cc,_e.customElements.get("media-audio-track-menu-button")||_e.customElements.define("media-audio-track-menu-button",ra);var Od=(p="")=>p.split(/\s+/),xd=(p="")=>{const[T,w,J]=p.split(":"),Ae=J?decodeURIComponent(J):void 0;return{kind:T==="cc"?Ge.CAPTIONS:Ge.SUBTITLES,language:w,label:Ae}},Tl=(p="",T={})=>Od(p).map(w=>{const J=xd(w);return zh(zh({},T),J)}),Ea=({kind:p,label:T,language:w}={kind:"subtitles"})=>T?`${p==="captions"?"cc":"sb"}:${w}:${encodeURIComponent(T)}`:w,Ia=(p=[])=>Array.prototype.map.call(p,Ea).join(" "),Dc=p=>{var T;return!!((T=p.mediaSubtitlesShowing)!=null&&T.length)||p.hasAttribute(ae.MEDIA_SUBTITLES_SHOWING)},nt=(p,T,w)=>{if(!T.has(p))throw TypeError("Cannot "+w)},Xu=(p,T,w)=>(nt(p,T,"read from private field"),w?w.call(p):T.get(p)),uu=(p,T,w)=>{if(T.has(p))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(p):T.set(p,w)},Zu=(p,T,w,J)=>(nt(p,T,"write to private field"),J?J.call(p,w):T.set(p,w),w),xo=(p,T,w)=>(nt(p,T,"access private method"),w),No,yo,Uo,zs,Ju,Nd=`
  <svg aria-hidden="true" viewBox="0 0 26 24" part="captions-indicator indicator">
    <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
  </svg>`;function ed(p){return`
    ${Va.getTemplateHTML(p)}
    <slot name="captions-indicator" hidden>${Nd}</slot>
  `}var Fo=class extends Va{constructor(){super(...arguments),uu(this,yo),uu(this,zs),uu(this,No,void 0)}static get observedAttributes(){return[...super.observedAttributes,ae.MEDIA_SUBTITLES_LIST,ae.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(p,T,w){super.attributeChangedCallback(p,T,w),p===ae.MEDIA_SUBTITLES_LIST&&T!==w?xo(this,yo,Uo).call(this):p===ae.MEDIA_SUBTITLES_SHOWING&&T!==w&&(this.value=w||"",xo(this,yo,Uo).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",xo(this,zs,Ju))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",xo(this,zs,Ju))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:ei(this).querySelector("media-captions-menu-button")}get mediaSubtitlesList(){return du(this,ae.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(p){jn(this,ae.MEDIA_SUBTITLES_LIST,p)}get mediaSubtitlesShowing(){return du(this,ae.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(p){jn(this,ae.MEDIA_SUBTITLES_SHOWING,p)}};No=new WeakMap,yo=new WeakSet,Uo=function(){var p;const T=Xu(this,No)!==JSON.stringify(this.mediaSubtitlesList),w=this.value!==this.getAttribute(ae.MEDIA_SUBTITLES_SHOWING);if(!T&&!w)return;Zu(this,No,JSON.stringify(this.mediaSubtitlesList)),this.defaultSlot.textContent="";const J=!this.value,Ae=$i({type:"radio",text:this.formatMenuItemText(vi("Off")),value:"off",checked:J});Ae.prepend(Ha(this,"checked-indicator")),this.defaultSlot.append(Ae);const vt=this.mediaSubtitlesList;for(const Dt of vt){const Xt=$i({type:"radio",text:this.formatMenuItemText(Dt.label,Dt),value:Ea(Dt),checked:this.value==Ea(Dt)});Xt.prepend(Ha(this,"checked-indicator")),((p=Dt.kind)!=null?p:"subs")==="captions"&&Xt.append(Ha(this,"captions-indicator")),this.defaultSlot.append(Xt)}},zs=new WeakSet,Ju=function(){const p=this.mediaSubtitlesShowing,T=this.getAttribute(ae.MEDIA_SUBTITLES_SHOWING),w=this.value!==T;if(p!=null&&p.length&&w&&this.dispatchEvent(new _e.CustomEvent(Ze.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:p})),!this.value||!w)return;const J=new _e.CustomEvent(Ze.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(J)},Fo.getTemplateHTML=ed;var du=(p,T)=>{const w=p.getAttribute(T);return w?Tl(w):[]},jn=(p,T,w)=>{if(!(w!=null&&w.length)){p.removeAttribute(T);return}const J=Ia(w);p.getAttribute(T)!==J&&p.setAttribute(T,J)};_e.customElements.get("media-captions-menu")||_e.customElements.define("media-captions-menu",Fo);var ws=`<svg aria-hidden="true" viewBox="0 0 26 24">
  <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
</svg>`,td=`<svg aria-hidden="true" viewBox="0 0 26 24">
  <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.81 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/>
</svg>`;function Qs(){return`
    <style>
      :host([data-captions-enabled="true"]) slot[name=off] {
        display: none !important;
      }

      
      :host(:not([data-captions-enabled="true"])) slot[name=on] {
        display: none !important;
      }

      :host([aria-expanded="true"]) slot[name=tooltip] {
        display: none;
      }
    </style>

    <slot name="icon">
      <slot name="on">${ws}</slot>
      <slot name="off">${td}</slot>
    </slot>
  `}function _l(){return vi("Captions")}var Bo=p=>{p.setAttribute("data-captions-enabled",Dc(p).toString())},Cs=p=>{p.setAttribute("aria-label",vi("closed captions"))},Ho=class extends la{static get observedAttributes(){return[...super.observedAttributes,ae.MEDIA_SUBTITLES_LIST,ae.MEDIA_SUBTITLES_SHOWING,ae.MEDIA_LANG]}connectedCallback(){super.connectedCallback(),Cs(this),Bo(this)}attributeChangedCallback(p,T,w){super.attributeChangedCallback(p,T,w),p===ae.MEDIA_SUBTITLES_SHOWING?Bo(this):p===ae.MEDIA_LANG&&Cs(this)}get invokeTargetElement(){var p;return this.invokeTarget!=null?super.invokeTargetElement:(p=ei(this))==null?void 0:p.querySelector("media-captions-menu")}get mediaSubtitlesList(){return cu(this,ae.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(p){Vo(this,ae.MEDIA_SUBTITLES_LIST,p)}get mediaSubtitlesShowing(){return cu(this,ae.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(p){Vo(this,ae.MEDIA_SUBTITLES_SHOWING,p)}};Ho.getSlotTemplateHTML=Qs,Ho.getTooltipContentHTML=_l;var cu=(p,T)=>{const w=p.getAttribute(T);return w?Tl(w):[]},Vo=(p,T,w)=>{if(!(w!=null&&w.length)){p.removeAttribute(T);return}const J=Ia(w);p.getAttribute(T)!==J&&p.setAttribute(T,J)};_e.customElements.get("media-captions-menu-button")||_e.customElements.define("media-captions-menu-button",Ho);var rd=(p,T,w)=>{if(!T.has(p))throw TypeError("Cannot "+w)},ua=(p,T,w)=>(rd(p,T,"read from private field"),w?w.call(p):T.get(p)),Go=(p,T,w)=>{if(T.has(p))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(p):T.set(p,w)},Ko=(p,T,w,J)=>(rd(p,T,"write to private field"),J?J.call(p,w):T.set(p,w),w),bo,Xs,Al,Ds,cs,zn,Ud=class{constructor(p,T,{defaultValue:w}={defaultValue:void 0}){Go(this,cs),Go(this,bo,void 0),Go(this,Xs,void 0),Go(this,Al,void 0),Go(this,Ds,new Set),Ko(this,bo,p),Ko(this,Xs,T),Ko(this,Al,new Set(w))}[Symbol.iterator](){return ua(this,cs,zn).values()}get length(){return ua(this,cs,zn).size}get value(){var p;return(p=[...ua(this,cs,zn)].join(" "))!=null?p:""}set value(p){var T;p!==this.value&&(Ko(this,Ds,new Set),this.add(...(T=p==null?void 0:p.split(" "))!=null?T:[]))}toString(){return this.value}item(p){return[...ua(this,cs,zn)][p]}values(){return ua(this,cs,zn).values()}forEach(p,T){ua(this,cs,zn).forEach(p,T)}add(...p){var T,w;p.forEach(J=>ua(this,Ds).add(J)),!(this.value===""&&!((T=ua(this,bo))!=null&&T.hasAttribute(`${ua(this,Xs)}`)))&&((w=ua(this,bo))==null||w.setAttribute(`${ua(this,Xs)}`,`${this.value}`))}remove(...p){var T;p.forEach(w=>ua(this,Ds).delete(w)),(T=ua(this,bo))==null||T.setAttribute(`${ua(this,Xs)}`,`${this.value}`)}contains(p){return ua(this,cs,zn).has(p)}toggle(p,T){return typeof T!="undefined"?T?(this.add(p),!0):(this.remove(p),!1):this.contains(p)?(this.remove(p),!1):(this.add(p),!0)}replace(p,T){return this.remove(p),this.add(T),p===T}};bo=new WeakMap,Xs=new WeakMap,Al=new WeakMap,Ds=new WeakMap,cs=new WeakSet,zn=function(){return ua(this,Ds).size?ua(this,Ds):ua(this,Al)};var Wo=(p,T,w)=>{if(!T.has(p))throw TypeError("Cannot "+w)},Un=(p,T,w)=>(Wo(p,T,"read from private field"),w?w.call(p):T.get(p)),id=(p,T,w)=>{if(T.has(p))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(p):T.set(p,w)},yi,Ii={RATES:"rates"},ya=[1,1.2,1.5,1.7,2],ba=1;function hs(p){return`
    <style>
      :host {
        min-width: 5ch;
        padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));
      }
    </style>
    <slot name="icon">${p.mediaplaybackrate||ba}x</slot>
  `}function To(){return vi("Playback rate")}var Yo=class extends en{constructor(){var p;super(),id(this,yi,new Ud(this,Ii.RATES,{defaultValue:ya})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(p=this.mediaPlaybackRate)!=null?p:ba}x`}static get observedAttributes(){return[...super.observedAttributes,ae.MEDIA_PLAYBACK_RATE,Ii.RATES]}attributeChangedCallback(p,T,w){if(super.attributeChangedCallback(p,T,w),p===Ii.RATES&&(Un(this,yi).value=w),p===ae.MEDIA_PLAYBACK_RATE){const J=w?+w:Number.NaN,Ae=Number.isNaN(J)?ba:J;this.container.innerHTML=`${Ae}x`,this.setAttribute("aria-label",vi("Playback rate {playbackRate}",{playbackRate:Ae}))}}get rates(){return Un(this,yi)}set rates(p){p?Array.isArray(p)?Un(this,yi).value=p.join(" "):typeof p=="string"&&(Un(this,yi).value=p):Un(this,yi).value=""}get mediaPlaybackRate(){return Na(this,ae.MEDIA_PLAYBACK_RATE,ba)}set mediaPlaybackRate(p){Ln(this,ae.MEDIA_PLAYBACK_RATE,p)}handleClick(){var p,T;const w=Array.from(Un(this,yi).values(),vt=>+vt).sort((vt,Dt)=>vt-Dt),J=(T=(p=w.find(vt=>vt>this.mediaPlaybackRate))!=null?p:w[0])!=null?T:ba,Ae=new _e.CustomEvent(Ze.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:J});this.dispatchEvent(Ae)}};yi=new WeakMap,Yo.getSlotTemplateHTML=hs,Yo.getTooltipContentHTML=To,_e.customElements.get("media-playback-rate-button")||_e.customElements.define("media-playback-rate-button",Yo);var Sl=(p,T,w)=>{if(!T.has(p))throw TypeError("Cannot "+w)},Ya=(p,T,w)=>(Sl(p,T,"read from private field"),w?w.call(p):T.get(p)),$o=(p,T,w)=>{if(T.has(p))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(p):T.set(p,w)},fs=(p,T,w)=>(Sl(p,T,"access private method"),w),Fn,Qn,Zs,Ll,_o,kl={RATES:"rates"},Il=class extends Va{constructor(){super(),$o(this,Qn),$o(this,Ll),$o(this,Fn,new Ud(this,kl.RATES,{defaultValue:ya})),fs(this,Qn,Zs).call(this)}static get observedAttributes(){return[...super.observedAttributes,ae.MEDIA_PLAYBACK_RATE,kl.RATES]}attributeChangedCallback(p,T,w){super.attributeChangedCallback(p,T,w),p===ae.MEDIA_PLAYBACK_RATE&&T!=w?(this.value=w,fs(this,Qn,Zs).call(this)):p===kl.RATES&&T!=w&&(Ya(this,Fn).value=w,fs(this,Qn,Zs).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",fs(this,Ll,_o))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",fs(this,Ll,_o))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:ei(this).querySelector("media-playback-rate-menu-button")}get rates(){return Ya(this,Fn)}set rates(p){p?Array.isArray(p)?Ya(this,Fn).value=p.join(" "):typeof p=="string"&&(Ya(this,Fn).value=p):Ya(this,Fn).value="",fs(this,Qn,Zs).call(this)}get mediaPlaybackRate(){return Na(this,ae.MEDIA_PLAYBACK_RATE,ba)}set mediaPlaybackRate(p){Ln(this,ae.MEDIA_PLAYBACK_RATE,p)}};Fn=new WeakMap,Qn=new WeakSet,Zs=function(){this.defaultSlot.textContent="";const p=this.mediaPlaybackRate,T=new Set(Array.from(Ya(this,Fn)).map(J=>Number(J)));p>0&&!T.has(p)&&T.add(p);const w=Array.from(T).sort((J,Ae)=>J-Ae);for(const J of w){const Ae=$i({type:"radio",text:this.formatMenuItemText(`${J}x`,J),value:J.toString(),checked:p===J});Ae.prepend(Ha(this,"checked-indicator")),this.defaultSlot.append(Ae)}},Ll=new WeakSet,_o=function(){if(!this.value)return;const p=new _e.CustomEvent(Ze.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(p)},_e.customElements.get("media-playback-rate-menu")||_e.customElements.define("media-playback-rate-menu",Il);var qo=1;function Rl(p){return`
    <style>
      :host {
        min-width: 5ch;
        padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));
      }
      
      :host([aria-expanded="true"]) slot {
        display: block;
      }

      :host([aria-expanded="true"]) slot[name=tooltip] {
        display: none;
      }
    </style>
    <slot name="icon">${p.mediaplaybackrate||qo}x</slot>
  `}function ad(){return vi("Playback rate")}var wl=class extends la{static get observedAttributes(){return[...super.observedAttributes,ae.MEDIA_PLAYBACK_RATE]}constructor(){var p;super(),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(p=this.mediaPlaybackRate)!=null?p:qo}x`}attributeChangedCallback(p,T,w){if(super.attributeChangedCallback(p,T,w),p===ae.MEDIA_PLAYBACK_RATE){const J=w?+w:Number.NaN,Ae=Number.isNaN(J)?qo:J;this.container.innerHTML=`${Ae}x`,this.setAttribute("aria-label",vi("Playback rate {playbackRate}",{playbackRate:Ae}))}}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:ei(this).querySelector("media-playback-rate-menu")}get mediaPlaybackRate(){return Na(this,ae.MEDIA_PLAYBACK_RATE,qo)}set mediaPlaybackRate(p){Ln(this,ae.MEDIA_PLAYBACK_RATE,p)}};wl.getSlotTemplateHTML=Rl,wl.getTooltipContentHTML=ad,_e.customElements.get("media-playback-rate-menu-button")||_e.customElements.define("media-playback-rate-menu-button",wl);var hu=(p,T,w)=>{if(!T.has(p))throw TypeError("Cannot "+w)},Js=(p,T,w)=>(hu(p,T,"read from private field"),w?w.call(p):T.get(p)),Cl=(p,T,w)=>{if(T.has(p))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(p):T.set(p,w)},Dl=(p,T,w,J)=>(hu(p,T,"write to private field"),J?J.call(p,w):T.set(p,w),w),Xn=(p,T,w)=>(hu(p,T,"access private method"),w),Ao,So,qi,Ml,Zn,fu,vu=class extends Va{constructor(){super(...arguments),Cl(this,qi),Cl(this,Zn),Cl(this,Ao,[]),Cl(this,So,{})}static get observedAttributes(){return[...super.observedAttributes,ae.MEDIA_RENDITION_LIST,ae.MEDIA_RENDITION_SELECTED,ae.MEDIA_RENDITION_UNAVAILABLE,ae.MEDIA_HEIGHT]}static formatMenuItemText(p,T){return super.formatMenuItemText(p,T)}static formatRendition(p,{showBitrate:T=!1}={}){const w=`${Math.min(p.width,p.height)}p`;if(T&&p.bitrate){const J=p.bitrate/1e6,Ae=`${J.toFixed(J<1?1:0)} Mbps`;return`${w} (${Ae})`}return this.formatMenuItemText(w,p)}static compareRendition(p,T){var w,J;return T.height===p.height?((w=T.bitrate)!=null?w:0)-((J=p.bitrate)!=null?J:0):T.height-p.height}attributeChangedCallback(p,T,w){super.attributeChangedCallback(p,T,w),p===ae.MEDIA_RENDITION_SELECTED&&T!==w?(this.value=w!=null?w:"auto",Xn(this,qi,Ml).call(this)):p===ae.MEDIA_RENDITION_LIST&&T!==w?(Dl(this,Ao,Ar(w)),Xn(this,qi,Ml).call(this)):p===ae.MEDIA_HEIGHT&&T!==w&&Xn(this,qi,Ml).call(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Xn(this,Zn,fu))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Xn(this,Zn,fu))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:ei(this).querySelector("media-rendition-menu-button")}get mediaRenditionList(){return Js(this,Ao)}set mediaRenditionList(p){Dl(this,Ao,p),Xn(this,qi,Ml).call(this)}get mediaRenditionSelected(){return Sa(this,ae.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(p){Ua(this,ae.MEDIA_RENDITION_SELECTED,p)}get mediaHeight(){return Na(this,ae.MEDIA_HEIGHT)}set mediaHeight(p){Ln(this,ae.MEDIA_HEIGHT,p)}compareRendition(p,T){return this.constructor.compareRendition(p,T)}formatMenuItemText(p,T){return this.constructor.formatMenuItemText(p,T)}formatRendition(p,T){return this.constructor.formatRendition(p,T)}showRenditionBitrate(p){return this.mediaRenditionList.some(T=>T!==p&&T.height===p.height&&T.bitrate!==p.bitrate)}};Ao=new WeakMap,So=new WeakMap,qi=new WeakSet,Ml=function(){if(Js(this,So).mediaRenditionList===JSON.stringify(this.mediaRenditionList)&&Js(this,So).mediaHeight===this.mediaHeight)return;Js(this,So).mediaRenditionList=JSON.stringify(this.mediaRenditionList),Js(this,So).mediaHeight=this.mediaHeight;const p=this.mediaRenditionList.sort(this.compareRendition.bind(this)),T=p.find(Dt=>Dt.id===this.mediaRenditionSelected);for(const Dt of p)Dt.selected=Dt===T;this.defaultSlot.textContent="";const w=!this.mediaRenditionSelected;for(const Dt of p){const Xt=this.formatRendition(Dt,{showBitrate:this.showRenditionBitrate(Dt)}),ni=$i({type:"radio",text:Xt,value:`${Dt.id}`,checked:Dt.selected&&!w});ni.prepend(Ha(this,"checked-indicator")),this.defaultSlot.append(ni)}const J=T&&this.showRenditionBitrate(T),Ae=w?T?this.formatMenuItemText(`${vi("Auto")} \u2022 ${this.formatRendition(T,{showBitrate:J})}`,T):this.formatMenuItemText(`${vi("Auto")} (${this.mediaHeight}p)`):this.formatMenuItemText(vi("Auto")),vt=$i({type:"radio",text:Ae,value:"auto",checked:w});vt.dataset.description=Ae,vt.prepend(Ha(this,"checked-indicator")),this.defaultSlot.append(vt)},Zn=new WeakSet,fu=function(){if(this.value==null)return;const p=new _e.CustomEvent(Ze.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(p)},_e.customElements.get("media-rendition-menu")||_e.customElements.define("media-rendition-menu",vu);var nd=`<svg aria-hidden="true" viewBox="0 0 24 24">
  <path d="M13.5 2.5h2v6h-2v-2h-11v-2h11v-2Zm4 2h4v2h-4v-2Zm-12 4h2v6h-2v-2h-3v-2h3v-2Zm4 2h12v2h-12v-2Zm1 4h2v6h-2v-2h-8v-2h8v-2Zm4 2h7v2h-7v-2Z" />
</svg>`;function jo(){return`
    <style>
      :host([aria-expanded="true"]) slot[name=tooltip] {
        display: none;
      }
    </style>
    <slot name="icon">${nd}</slot>
  `}function rn(){return vi("Quality")}var sd=class extends la{static get observedAttributes(){return[...super.observedAttributes,ae.MEDIA_RENDITION_SELECTED,ae.MEDIA_RENDITION_UNAVAILABLE,ae.MEDIA_HEIGHT]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",vi("quality"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:ei(this).querySelector("media-rendition-menu")}get mediaRenditionSelected(){return Sa(this,ae.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(p){Ua(this,ae.MEDIA_RENDITION_SELECTED,p)}get mediaHeight(){return Na(this,ae.MEDIA_HEIGHT)}set mediaHeight(p){Ln(this,ae.MEDIA_HEIGHT,p)}};sd.getSlotTemplateHTML=jo,sd.getTooltipContentHTML=rn,_e.customElements.get("media-rendition-menu-button")||_e.customElements.define("media-rendition-menu-button",sd);var Bn=(p,T,w)=>{if(!T.has(p))throw TypeError("Cannot "+w)},Ui=(p,T,w)=>(Bn(p,T,"read from private field"),w?w.call(p):T.get(p)),En=(p,T,w)=>{if(T.has(p))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(p):T.set(p,w)},mu=(p,T,w,J)=>(Bn(p,T,"write to private field"),J?J.call(p,w):T.set(p,w),w),an=(p,T,w)=>(Bn(p,T,"access private method"),w),va,Pl,Ol,yn,Lo,pu,Fd,Ms,Ps,xl,ko,bn,gu,zo,Qo;function Mc(p){return`
      ${Va.getTemplateHTML(p)}
      <style>
        :host {
          --_menu-bg: rgb(20 20 30 / .8);
          background: var(--media-settings-menu-background,
            var(--media-menu-background,
              var(--media-control-background,
                var(--media-secondary-color, var(--_menu-bg)))));
          min-width: var(--media-settings-menu-min-width, 170px);
          border-radius: 2px;
          overflow: hidden;
        }
      </style>
    `}var Nl=class extends Va{constructor(){super(),En(this,Pl),En(this,yn),En(this,pu),En(this,Ms),En(this,ko),En(this,va,!1),En(this,xl,p=>{const T=p.target,w=(T==null?void 0:T.nodeName)==="VIDEO",J=an(this,Ms,Ps).call(this,T);(w||J)&&(Ui(this,va)?an(this,yn,Lo).call(this):an(this,ko,bn).call(this,p))}),En(this,gu,p=>{const T=p.target,w=this.contains(T),J=p.button===2,Ae=(T==null?void 0:T.nodeName)==="VIDEO",vt=an(this,Ms,Ps).call(this,T);w||J&&(Ae||vt)||an(this,yn,Lo).call(this)}),En(this,zo,p=>{p.key==="Escape"&&an(this,yn,Lo).call(this)}),En(this,Qo,p=>{var T,w;const J=p.target;if((T=J.matches)!=null&&T.call(J,'button[invoke="copy"]')){const Ae=(w=J.closest("media-context-menu-item"))==null?void 0:w.querySelector('input[slot="copy"]');Ae&&navigator.clipboard.writeText(Ae.value)}an(this,yn,Lo).call(this)}),this.setAttribute("noautohide",""),an(this,Pl,Ol).call(this)}connectedCallback(){super.connectedCallback(),ei(this).addEventListener("contextmenu",Ui(this,xl)),this.addEventListener("click",Ui(this,Qo))}disconnectedCallback(){super.disconnectedCallback(),ei(this).removeEventListener("contextmenu",Ui(this,xl)),this.removeEventListener("click",Ui(this,Qo)),document.removeEventListener("mousedown",Ui(this,gu)),document.removeEventListener("keydown",Ui(this,zo))}};va=new WeakMap,Pl=new WeakSet,Ol=function(){this.hidden=!Ui(this,va)},yn=new WeakSet,Lo=function(){mu(this,va,!1),an(this,Pl,Ol).call(this)},pu=new WeakSet,Fd=function(){document.querySelectorAll("media-context-menu").forEach(T=>{var w;T!==this&&an(w=T,yn,Lo).call(w)})},Ms=new WeakSet,Ps=function(p){return p?p.hasAttribute("slot")&&p.getAttribute("slot")==="media"?!0:p.nodeName.includes("-")&&p.tagName.includes("-")?p.hasAttribute("src")||p.hasAttribute("poster")||p.hasAttribute("preload")||p.hasAttribute("playsinline"):!1:!1},xl=new WeakMap,ko=new WeakSet,bn=function(p){p.preventDefault(),an(this,pu,Fd).call(this),mu(this,va,!0),this.style.position="fixed",this.style.left=`${p.clientX}px`,this.style.top=`${p.clientY}px`,an(this,Pl,Ol).call(this),document.addEventListener("mousedown",Ui(this,gu),{once:!0}),document.addEventListener("keydown",Ui(this,zo),{once:!0})},gu=new WeakMap,zo=new WeakMap,Qo=new WeakMap,Nl.getTemplateHTML=Mc,_e.customElements.get("media-context-menu")||_e.customElements.define("media-context-menu",Nl);function Pc(p){return`
    ${x.getTemplateHTML.call(this,p)}
    <style>
        ::slotted(*) {
            color: var(--media-text-color, white);
            text-decoration: none;
            border: none;
            background: none;
            cursor: pointer;
            padding: 0;
            min-height: var(--media-control-height, 24px);
        }
    </style>
  `}var Io=class extends x{};Io.shadowRootOptions={mode:"open"},Io.getTemplateHTML=Pc,_e.customElements.get("media-context-menu-item")||_e.customElements.define("media-context-menu-item",Io);var Jn=Ye.createElement("template");"innerHTML"in Jn&&(Jn.innerHTML=de);var Ul,Fl,Eu=class extends Si{};Eu.template=(Fl=(Ul=Jn.content)==null?void 0:Ul.children)==null?void 0:Fl[0],Xe.customElements.get("media-theme-classic")||Xe.customElements.define("media-theme-classic",Eu);var Xo=Eu},64819($e,Me,Ee){"use strict";var He=Object.defineProperty,Le=Object.defineProperties,Ne=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Qe=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,Pe=(i,u,h)=>u in i?He(i,u,{enumerable:!0,configurable:!0,writable:!0,value:h}):i[u]=h,he=(i,u)=>{for(var h in u||(u={}))Qe.call(u,h)&&Pe(i,h,u[h]);if(H)for(var h of H(u))de.call(u,h)&&Pe(i,h,u[h]);return i},O=(i,u)=>Le(i,Ne(u)),K=(i,u)=>{var h={};for(var E in i)Qe.call(i,E)&&u.indexOf(E)<0&&(h[E]=i[E]);if(i!=null&&H)for(var E of H(i))u.indexOf(E)<0&&de.call(i,E)&&(h[E]=i[E]);return h},j=(i,u,h)=>new Promise((E,R)=>{var G=_t=>{try{ge(h.next(_t))}catch(It){R(It)}},ee=_t=>{try{ge(h.throw(_t))}catch(It){R(It)}},ge=_t=>_t.done?E(_t.value):Promise.resolve(_t.value).then(G,ee);ge((h=h.apply(i,u)).next())}),ve=Object.defineProperty,at=Object.getOwnPropertyDescriptor,ze=Object.getOwnPropertyNames,Et=Object.prototype.hasOwnProperty,Xe=i=>{throw TypeError(i)},Ye=(i,u)=>{for(var h in u)ve(i,h,{get:u[h],enumerable:!0})},Ze=(i,u,h,E)=>{if(u&&typeof u=="object"||typeof u=="function")for(let R of ze(u))!Et.call(i,R)&&R!==h&&ve(i,R,{get:()=>u[R],enumerable:!(E=at(u,R))||E.enumerable});return i},st=i=>Ze(ve({},"__esModule",{value:!0}),i),ht=(i,u,h)=>u.has(i)||Xe("Cannot "+h),Je=(i,u,h)=>(ht(i,u,"read from private field"),h?h.call(i):u.get(i)),ae=(i,u,h)=>u.has(i)?Xe("Cannot add the same private member more than once"):u instanceof WeakSet?u.add(i):u.set(i,h),dt=(i,u,h,E)=>(ht(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),ke=(i,u,h)=>(ht(i,u,"access private method"),h),mt={};Ye(mt,{MediaError:()=>sr.MediaError,default:()=>Bg,generatePlayerInitTime:()=>Ri.generatePlayerInitTime,getVideoAttribute:()=>zu,playerSoftwareName:()=>jm,playerSoftwareVersion:()=>qm}),$e.exports=st(mt);var At=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment=="undefined"){class i extends At{}globalThis.DocumentFragment=i}var Ge=class extends At{},De=class extends At{},Lt={get(i){},define(i,u,h){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(Ge)}},ut,Q=class{constructor(i,u={}){ae(this,ut),dt(this,ut,u==null?void 0:u.detail)}get detail(){return Je(this,ut)}initCustomEvent(){}};ut=new WeakMap;function _(i,u){return new Ge}var pe={document:{createElement:_},DocumentFragment,customElements:Lt,CustomEvent:Q,EventTarget:At,HTMLElement:Ge,HTMLVideoElement:De},Ie=typeof window=="undefined"||typeof globalThis.customElements=="undefined",ct=Ie?pe:globalThis,_e=Ie?pe.document:globalThis.document,Te={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_LOOP_REQUEST:"medialooprequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},we={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},xt={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_BUFFERED:"mediaBuffered",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_CHAPTERS_CUES:"mediaChaptersCues",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_ENDED:"mediaEnded",MEDIA_ERROR:"mediaError",MEDIA_ERROR_CODE:"mediaErrorCode",MEDIA_ERROR_MESSAGE:"mediaErrorMessage",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_HAS_PLAYED:"mediaHasPlayed",MEDIA_HEIGHT:"mediaHeight",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_IS_PIP:"mediaIsPip",MEDIA_LOADING:"mediaLoading",MEDIA_MUTED:"mediaMuted",MEDIA_LOOP:"mediaLoop",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_LANG:"mediaLang",MEDIA_WIDTH:"mediaWidth"},Ir=Object.entries(xt),V=Ir.reduce((i,[u,h])=>(i[u]=h.toLowerCase(),i),{}),jt={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},Br=Ir.reduce((i,[u,h])=>(i[u]=h.toLowerCase(),i),he({},jt)),Rt=Object.entries(Br).reduce((i,[u,h])=>{let E=V[u];return E&&(i[h]=E),i},{userinactivechange:"userinactive"}),U=Object.entries(V).reduce((i,[u,h])=>{let E=Br[u];return E&&(i[h]=E),i},{userinactive:"userinactivechange"}),Be={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},je={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"},Jt={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},Nt={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},Ut={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},Lr={INLINE:"inline",FULLSCREEN:"fullscreen",PICTURE_IN_PICTURE:"picture-in-picture"};function zr(i){return i==null?void 0:i.map(qe).join(" ")}function Wt(i){return i==null?void 0:i.split(/\s+/).map(Y)}function qe(i){if(i){let{id:u,width:h,height:E}=i;return[u,h,E].filter(R=>R!=null).join(":")}}function Y(i){if(i){let[u,h,E]=i.split(":");return{id:u,width:+h,height:+E}}}function te(i){return i==null?void 0:i.map(it).join(" ")}function me(i){return i==null?void 0:i.split(/\s+/).map(kt)}function it(i){if(i){let{id:u,kind:h,language:E,label:R}=i;return[u,h,E,R].filter(G=>G!=null).join(":")}}function kt(i){if(i){let[u,h,E,R]=i.split(":");return{id:u,kind:h,language:E,label:R}}}function Oe(i){return i.replace(/[-_]([a-z])/g,(u,h)=>h.toUpperCase())}function zt(i){return typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i)}function Pt(i){return typeof i!="string"?!1:!isNaN(i)&&!isNaN(parseFloat(i))}var Zt=i=>new Promise(u=>setTimeout(u,i)),Wr=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],ft=(i,u)=>{let h=i===1?Wr[u].singular:Wr[u].plural;return`${i} ${h}`},Qr=i=>{if(!zt(i))return"";let u=Math.abs(i),h=u!==i,E=new Date(0,0,0,0,0,u,0);return`${[E.getHours(),E.getMinutes(),E.getSeconds()].map((R,G)=>R&&ft(R,G)).filter(R=>R).join(", ")}${h?" remaining":""}`};function li(i,u){let h=!1;i<0&&(h=!0,i=0-i),i=i<0?0:i;let E=Math.floor(i%60),R=Math.floor(i/60%60),G=Math.floor(i/3600),ee=Math.floor(u/60%60),ge=Math.floor(u/3600);return(isNaN(i)||i===1/0)&&(G=R=E="0"),G=G>0||ge>0?G+":":"",R=((G||ee>=10)&&R<10?"0"+R:R)+":",E=E<10?"0"+E:E,(h?"-":"")+G+R+E}var ln=Object.freeze({length:0,start(i){let u=i>>>0;if(u>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${u}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(i){let u=i>>>0;if(u>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${u}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Ar={"Start airplay":"Start airplay","Stop airplay":"Stop airplay",Audio:"Audio",Captions:"Captions","Enable captions":"Enable captions","Disable captions":"Disable captions","Start casting":"Start casting","Stop casting":"Stop casting","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",Mute:"Mute",Unmute:"Unmute",Loop:"Loop","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings",Auto:"Auto","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute","chapter: {chapterName}":"chapter: {chapterName}",live:"live",Off:"Off","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","Source Not Supported":"Source Not Supported","Encryption Error":"Encryption Error","A network error caused the media download to fail.":"A network error caused the media download to fail.","A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.":"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.","An unsupported error occurred. The server or network failed, or your browser does not support this format.":"An unsupported error occurred. The server or network failed, or your browser does not support this format.","The media is encrypted and there are no keys to decrypt it.":"The media is encrypted and there are no keys to decrypt it."},Yi,_i={en:Ar},br=((Yi=globalThis.navigator)==null?void 0:Yi.language)||"en",fe=i=>{br=i},ye=i=>{var u,h,E;let[R]=br.split("-");return((u=_i[br])==null?void 0:u[i])||((h=_i[R])==null?void 0:h[i])||((E=_i.en)==null?void 0:E[i])||i},oe=(i,u={})=>ye(i).replace(/\{(\w+)\}/g,(h,E)=>E in u?String(u[E]):`{${E}}`),yt=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},qt=class extends yt{},yr=class extends qt{constructor(){super(...arguments),this.role=null}},Rr=class{observe(){}unobserve(){}disconnect(){}},Qt={createElement:function(){return new Ht.HTMLElement},createElementNS:function(){return new Ht.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(i){return!1}},Ht={ResizeObserver:Rr,document:Qt,Node:qt,Element:yr,HTMLElement:class extends yr{constructor(){super(...arguments),this.innerHTML=""}get content(){return new Ht.DocumentFragment}},DocumentFragment:class extends yt{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem(i){return null},setItem(i,u){},removeItem(i){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia(i){return{matches:!1,media:i}},DOMParser:class{parseFromString(i,u){return{body:{textContent:i}}}}},Ci="global"in globalThis&&(globalThis==null?void 0:globalThis.global)===globalThis||typeof window=="undefined"||typeof window.customElements=="undefined",Ft=Object.keys(Ht).every(i=>i in globalThis),ie=Ci&&!Ft?Ht:globalThis,er=Ci&&!Ft?Qt:globalThis.document,Ai=new WeakMap,Bi=i=>{let u=Ai.get(i);return u||Ai.set(i,u=new Set),u},Hr=new ie.ResizeObserver(i=>{for(let u of i)for(let h of Bi(u.target))h(u)});function pi(i,u){Bi(i).add(u),Hr.observe(i)}function $r(i,u){let h=Bi(i);h.delete(u),h.size||Hr.unobserve(i)}function Jr(i){let u={};for(let h of i)u[h.name]=h.value;return u}function Yr(i){var u;return(u=Pa(i))!=null?u:ma(i,"media-controller")}function Pa(i){var u;let{MEDIA_CONTROLLER:h}=we,E=i.getAttribute(h);if(E)return(u=Qi(i))==null?void 0:u.getElementById(E)}var za=(i,u,h=".value")=>{let E=i.querySelector(h);E&&(E.textContent=u)},un=(i,u)=>{let h=`slot[name="${u}"]`,E=i.shadowRoot.querySelector(h);return E?E.children:[]},zi=(i,u)=>un(i,u)[0],aa=(i,u)=>!i||!u?!1:i!=null&&i.contains(u)?!0:aa(i,u.getRootNode().host),ma=(i,u)=>i?i.closest(u)||ma(i.getRootNode().host,u):null;function Oa(i=document){var u;let h=i==null?void 0:i.activeElement;return h?(u=Oa(h.shadowRoot))!=null?u:h:null}function Qi(i){var u;let h=(u=i==null?void 0:i.getRootNode)==null?void 0:u.call(i);return h instanceof ShadowRoot||h instanceof Document?h:null}function dn(i,{depth:u=3,checkOpacity:h=!0,checkVisibilityCSS:E=!0}={}){if(i.checkVisibility)return i.checkVisibility({checkOpacity:h,checkVisibilityCSS:E});let R=i;for(;R&&u>0;){let G=getComputedStyle(R);if(h&&G.opacity==="0"||E&&G.visibility==="hidden"||G.display==="none")return!1;R=R.parentElement,u--}return!0}function Qa(i,u,h,E){let R=E.x-h.x,G=E.y-h.y,ee=R*R+G*G;if(ee===0)return 0;let ge=((i-h.x)*R+(u-h.y)*G)/ee;return Math.max(0,Math.min(1,ge))}function Si(i,u){return Gs(i,E=>E===u)||cn(i,u)}function Gs(i,u){var h,E;let R;for(R of(h=i.querySelectorAll("style:not([media])"))!=null?h:[]){let G;try{G=(E=R.sheet)==null?void 0:E.cssRules}catch(ee){continue}for(let ee of G!=null?G:[])if(u(ee.selectorText))return ee}}function cn(i,u){var h,E;let R=(h=i.querySelectorAll("style:not([media])"))!=null?h:[],G=R==null?void 0:R[R.length-1];return G!=null&&G.sheet?(G==null||G.sheet.insertRule(`${u}{}`,G.sheet.cssRules.length),(E=G.sheet.cssRules)==null?void 0:E[G.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",i),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function ui(i,u,h=Number.NaN){let E=i.getAttribute(u);return E!=null?+E:h}function Li(i,u,h){let E=+h;if(h==null||Number.isNaN(E)){i.hasAttribute(u)&&i.removeAttribute(u);return}ui(i,u,void 0)!==E&&i.setAttribute(u,`${E}`)}function Nr(i,u){return i.hasAttribute(u)}function Vr(i,u,h){if(h==null){i.hasAttribute(u)&&i.removeAttribute(u);return}Nr(i,u)!=h&&i.toggleAttribute(u,h)}function di(i,u,h=null){var E;return(E=i.getAttribute(u))!=null?E:h}function qr(i,u,h){if(h==null){i.hasAttribute(u)&&i.removeAttribute(u);return}let E=`${h}`;di(i,u,void 0)!==E&&i.setAttribute(u,E)}var Kn=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},ha=(i,u,h)=>(Kn(i,u,"read from private field"),h?h.call(i):u.get(i)),X=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},W=(i,u,h,E)=>(Kn(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),se;function Vt(i){return`
    <style>
      :host {
        display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block));
        box-sizing: border-box;
      }
    </style>
  `}var Cr=class extends ie.HTMLElement{constructor(){if(super(),X(this,se,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Jr(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i)}}static get observedAttributes(){return[we.MEDIA_CONTROLLER,V.MEDIA_PAUSED]}attributeChangedCallback(i,u,h){var E,R,G,ee,ge;i===we.MEDIA_CONTROLLER&&(u&&((R=(E=ha(this,se))==null?void 0:E.unassociateElement)==null||R.call(E,this),W(this,se,null)),h&&this.isConnected&&(W(this,se,(G=this.getRootNode())==null?void 0:G.getElementById(h)),(ge=(ee=ha(this,se))==null?void 0:ee.associateElement)==null||ge.call(ee,this)))}connectedCallback(){var i,u,h,E;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),W(this,se,gi(this)),this.getAttribute(we.MEDIA_CONTROLLER)&&((u=(i=ha(this,se))==null?void 0:i.associateElement)==null||u.call(i,this)),(h=ha(this,se))==null||h.addEventListener("pointerdown",this),(E=ha(this,se))==null||E.addEventListener("click",this)}disconnectedCallback(){var i,u,h,E;this.getAttribute(we.MEDIA_CONTROLLER)&&((u=(i=ha(this,se))==null?void 0:i.unassociateElement)==null||u.call(i,this)),(h=ha(this,se))==null||h.removeEventListener("pointerdown",this),(E=ha(this,se))==null||E.removeEventListener("click",this),W(this,se,null)}handleEvent(i){var u;let h=(u=i.composedPath())==null?void 0:u[0];if(["video","media-controller"].includes(h==null?void 0:h.localName)){if(i.type==="pointerdown")this._pointerType=i.pointerType;else if(i.type==="click"){let{clientX:E,clientY:R}=i,{left:G,top:ee,width:ge,height:_t}=this.getBoundingClientRect(),It=E-G,Er=R-ee;if(It<0||Er<0||It>ge||Er>_t||ge===0&&_t===0)return;let ar=this._pointerType||"mouse";if(this._pointerType=void 0,ar===Jt.TOUCH){this.handleTap(i);return}else if(ar===Jt.MOUSE||ar===Jt.PEN){this.handleMouseClick(i);return}}}}get mediaPaused(){return Nr(this,V.MEDIA_PAUSED)}set mediaPaused(i){Vr(this,V.MEDIA_PAUSED,i)}handleTap(i){}handleMouseClick(i){let u=this.mediaPaused?Te.MEDIA_PLAY_REQUEST:Te.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new ie.CustomEvent(u,{composed:!0,bubbles:!0}))}};se=new WeakMap,Cr.shadowRootOptions={mode:"open"},Cr.getTemplateHTML=Vt;function gi(i){var u;let h=i.getAttribute(we.MEDIA_CONTROLLER);return h?(u=i.getRootNode())==null?void 0:u.getElementById(h):ma(i,"media-controller")}ie.customElements.get("media-gesture-receiver")||ie.customElements.define("media-gesture-receiver",Cr);var ei=Cr,Xi=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},Ei=(i,u,h)=>(Xi(i,u,"read from private field"),h?h.call(i):u.get(i)),Gr=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},na=(i,u,h,E)=>(Xi(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),Zi=(i,u,h)=>(Xi(i,u,"access private method"),h),bs,hn,Ts,xa,Na,Ln,Xa,kn,Sa,Ua,Ks,ur,hi,Di,ti,sa,fn,xi,fa,vr={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive",AUTOHIDE_OVER_CONTROLS:"autohideovercontrols"};function In(i){return`
    <style>
      
      :host([${V.MEDIA_IS_FULLSCREEN}]) ::slotted([slot=media]) {
        outline: none;
      }

      :host {
        box-sizing: border-box;
        position: relative;
        display: inline-block;
        line-height: 0;
        background-color: var(--media-background-color, #000);
        overflow: hidden;
      }

      :host(:not([${vr.AUDIO}])) [part~=layer]:not([part~=media-layer]) {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        display: flex;
        flex-flow: column nowrap;
        align-items: start;
        pointer-events: none;
        background: none;
      }

      slot[name=media] {
        display: var(--media-slot-display, contents);
      }

      
      :host([${vr.AUDIO}]) slot[name=media] {
        display: var(--media-slot-display, none);
      }

      
      :host([${vr.AUDIO}]) [part~=layer][part~=gesture-layer] {
        height: 0;
        display: block;
      }

      
      :host(:not([${vr.AUDIO}])[${vr.GESTURES_DISABLED}]) ::slotted([slot=gestures-chrome]),
          :host(:not([${vr.AUDIO}])[${vr.GESTURES_DISABLED}]) media-gesture-receiver[slot=gestures-chrome] {
        display: none;
      }

      
      ::slotted(:not([slot=media]):not([slot=poster]):not(media-loading-indicator):not([role=dialog]):not([hidden])) {
        pointer-events: auto;
      }

      :host(:not([${vr.AUDIO}])) *[part~=layer][part~=centered-layer] {
        align-items: center;
        justify-content: center;
      }

      :host(:not([${vr.AUDIO}])) ::slotted(media-gesture-receiver[slot=gestures-chrome]),
      :host(:not([${vr.AUDIO}])) media-gesture-receiver[slot=gestures-chrome] {
        align-self: stretch;
        flex-grow: 1;
      }

      slot[name=middle-chrome] {
        display: inline;
        flex-grow: 1;
        pointer-events: none;
        background: none;
      }

      
      ::slotted([slot=media]),
      ::slotted([slot=poster]) {
        width: 100%;
        height: 100%;
      }

      
      :host(:not([${vr.AUDIO}])) .spacer {
        flex-grow: 1;
      }

      
      :host(:-webkit-full-screen) {
        
        width: 100% !important;
        height: 100% !important;
      }

      
      ::slotted(:not([slot=media]):not([slot=poster]):not([${vr.NO_AUTOHIDE}]):not([hidden]):not([role=dialog])) {
        opacity: 1;
        transition: var(--media-control-transition-in, opacity 0.25s);
      }

      
      :host([${vr.USER_INACTIVE}]:not([${V.MEDIA_PAUSED}]):not([${V.MEDIA_IS_AIRPLAYING}]):not([${V.MEDIA_IS_CASTING}]):not([${vr.AUDIO}])) ::slotted(:not([slot=media]):not([slot=poster]):not([${vr.NO_AUTOHIDE}]):not([role=dialog])) {
        opacity: 0;
        transition: var(--media-control-transition-out, opacity 1s);
      }

      :host([${vr.USER_INACTIVE}]:not([${vr.NO_AUTOHIDE}]):not([${V.MEDIA_PAUSED}]):not([${V.MEDIA_IS_CASTING}]):not([${vr.AUDIO}])) ::slotted([slot=media]) {
        cursor: none;
      }

      :host([${vr.USER_INACTIVE}][${vr.AUTOHIDE_OVER_CONTROLS}]:not([${vr.NO_AUTOHIDE}]):not([${V.MEDIA_PAUSED}]):not([${V.MEDIA_IS_CASTING}]):not([${vr.AUDIO}])) * {
        --media-cursor: none;
        cursor: none;
      }


      ::slotted(media-control-bar)  {
        align-self: stretch;
      }

      
      :host(:not([${vr.AUDIO}])[${V.MEDIA_HAS_PLAYED}]) slot[name=poster] {
        display: none;
      }

      ::slotted([role=dialog]) {
        width: 100%;
        height: 100%;
        align-self: center;
      }

      ::slotted([role=menu]) {
        align-self: end;
      }
    </style>

    <slot name="media" part="layer media-layer"></slot>
    <slot name="poster" part="layer poster-layer"></slot>
    <slot name="gestures-chrome" part="layer gesture-layer">
      <media-gesture-receiver slot="gestures-chrome">
        <template shadowrootmode="${ei.shadowRootOptions.mode}">
          ${ei.getTemplateHTML({})}
        </template>
      </media-gesture-receiver>
    </slot>
    <span part="layer vertical-layer">
      <slot name="top-chrome" part="top chrome"></slot>
      <slot name="middle-chrome" part="middle chrome"></slot>
      <slot name="centered-chrome" part="layer centered-layer center centered chrome"></slot>
      
      <slot part="bottom chrome"></slot>
    </span>
    <slot name="dialog" part="layer dialog-layer"></slot>
  `}var Fa=Object.values(V),ls="sm:384 md:576 lg:768 xl:960";function vn(i){Rn(i.target,i.contentRect.width)}function Rn(i,u){var h;if(!i.isConnected)return;let E=(h=i.getAttribute(vr.BREAKPOINTS))!=null?h:ls,R=Ws(E),G=us(R,u),ee=!1;if(Object.keys(R).forEach(ge=>{if(G.includes(ge)){i.hasAttribute(`breakpoint${ge}`)||(i.setAttribute(`breakpoint${ge}`,""),ee=!0);return}i.hasAttribute(`breakpoint${ge}`)&&(i.removeAttribute(`breakpoint${ge}`),ee=!0)}),ee){let ge=new CustomEvent(Br.BREAKPOINTS_CHANGE,{detail:G});i.dispatchEvent(ge)}i.breakpointsComputed||(i.breakpointsComputed=!0,i.dispatchEvent(new CustomEvent(Br.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}function Ws(i){let u=i.split(/\s+/);return Object.fromEntries(u.map(h=>h.split(":")))}function us(i,u){return Object.keys(i).filter(h=>u>=parseInt(i[h]))}var xn=class extends ie.HTMLElement{constructor(){if(super(),Gr(this,Ln),Gr(this,Ua),Gr(this,ur),Gr(this,Di),Gr(this,sa),Gr(this,xi),Gr(this,bs,0),Gr(this,hn,null),Gr(this,Ts,null),Gr(this,xa,void 0),this.breakpointsComputed=!1,Gr(this,Na,new MutationObserver(Zi(this,Ln,Xa).bind(this))),Gr(this,kn,!1),Gr(this,Sa,u=>{Ei(this,kn)||(setTimeout(()=>{vn(u),na(this,kn,!1)},0),na(this,kn,!0))}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let u=Jr(this.attributes),h=this.constructor.getTemplateHTML(u);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(h):this.shadowRoot.innerHTML=h}let i=this.querySelector(":scope > slot[slot=media]");i&&i.addEventListener("slotchange",()=>{if(!i.assignedElements({flatten:!0}).length){Ei(this,hn)&&this.mediaUnsetCallback(Ei(this,hn));return}this.handleMediaUpdated(this.media)})}static get observedAttributes(){return[vr.AUTOHIDE,vr.GESTURES_DISABLED].concat(Fa).filter(i=>![V.MEDIA_RENDITION_LIST,V.MEDIA_AUDIO_TRACK_LIST,V.MEDIA_CHAPTERS_CUES,V.MEDIA_WIDTH,V.MEDIA_HEIGHT,V.MEDIA_ERROR,V.MEDIA_ERROR_MESSAGE].includes(i))}attributeChangedCallback(i,u,h){i.toLowerCase()==vr.AUTOHIDE&&(this.autohide=h)}get media(){let i=this.querySelector(":scope > [slot=media]");return(i==null?void 0:i.nodeName)=="SLOT"&&(i=i.assignedElements({flatten:!0})[0]),i}handleMediaUpdated(i){return j(this,null,function*(){i&&(na(this,hn,i),i.localName.includes("-")&&(yield ie.customElements.whenDefined(i.localName)),this.mediaSetCallback(i))})}connectedCallback(){var i;Ei(this,Na).observe(this,{childList:!0,subtree:!0}),pi(this,Ei(this,Sa));let u=this.getAttribute(vr.AUDIO)!=null?oe("audio player"):oe("video player");this.setAttribute("role","region"),this.setAttribute("aria-label",u),this.handleMediaUpdated(this.media),this.setAttribute(vr.USER_INACTIVE,""),Rn(this,this.getBoundingClientRect().width),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),(i=ie.window)==null||i.addEventListener("mouseup",this)}disconnectedCallback(){var i;Ei(this,Na).disconnect(),$r(this,Ei(this,Sa)),this.media&&this.mediaUnsetCallback(this.media),(i=ie.window)==null||i.removeEventListener("mouseup",this)}mediaSetCallback(i){}mediaUnsetCallback(i){na(this,hn,null)}handleEvent(i){switch(i.type){case"pointerdown":na(this,bs,i.timeStamp);break;case"pointermove":Zi(this,Ua,Ks).call(this,i);break;case"pointerup":Zi(this,ur,hi).call(this,i);break;case"mouseleave":Zi(this,Di,ti).call(this);break;case"mouseup":this.removeAttribute(vr.KEYBOARD_CONTROL);break;case"keyup":Zi(this,xi,fa).call(this),this.setAttribute(vr.KEYBOARD_CONTROL,"");break}}set autohide(i){let u=Number(i);na(this,xa,isNaN(u)?0:u)}get autohide(){return(Ei(this,xa)===void 0?2:Ei(this,xa)).toString()}get breakpoints(){return di(this,vr.BREAKPOINTS)}set breakpoints(i){qr(this,vr.BREAKPOINTS,i)}get audio(){return Nr(this,vr.AUDIO)}set audio(i){Vr(this,vr.AUDIO,i)}get gesturesDisabled(){return Nr(this,vr.GESTURES_DISABLED)}set gesturesDisabled(i){Vr(this,vr.GESTURES_DISABLED,i)}get keyboardControl(){return Nr(this,vr.KEYBOARD_CONTROL)}set keyboardControl(i){Vr(this,vr.KEYBOARD_CONTROL,i)}get noAutohide(){return Nr(this,vr.NO_AUTOHIDE)}set noAutohide(i){Vr(this,vr.NO_AUTOHIDE,i)}get autohideOverControls(){return Nr(this,vr.AUTOHIDE_OVER_CONTROLS)}set autohideOverControls(i){Vr(this,vr.AUTOHIDE_OVER_CONTROLS,i)}get userInteractive(){return Nr(this,vr.USER_INACTIVE)}set userInteractive(i){Vr(this,vr.USER_INACTIVE,i)}};bs=new WeakMap,hn=new WeakMap,Ts=new WeakMap,xa=new WeakMap,Na=new WeakMap,Ln=new WeakSet,Xa=function(i){let u=this.media;for(let h of i){if(h.type!=="childList")continue;let E=h.removedNodes;for(let R of E){if(R.slot!="media"||h.target!=this)continue;let G=h.previousSibling&&h.previousSibling.previousElementSibling;if(!G||!u)this.mediaUnsetCallback(R);else{let ee=G.slot!=="media";for(;(G=G.previousSibling)!==null;)G.slot=="media"&&(ee=!1);ee&&this.mediaUnsetCallback(R)}}if(u)for(let R of h.addedNodes)R===u&&this.handleMediaUpdated(u)}},kn=new WeakMap,Sa=new WeakMap,Ua=new WeakSet,Ks=function(i){if(i.pointerType!=="mouse"&&i.timeStamp-Ei(this,bs)<250)return;Zi(this,sa,fn).call(this),clearTimeout(Ei(this,Ts));let u=this.hasAttribute(vr.AUTOHIDE_OVER_CONTROLS);([this,this.media].includes(i.target)||u)&&Zi(this,xi,fa).call(this)},ur=new WeakSet,hi=function(i){if(i.pointerType==="touch"){let u=!this.hasAttribute(vr.USER_INACTIVE);[this,this.media].includes(i.target)&&u?Zi(this,Di,ti).call(this):Zi(this,xi,fa).call(this)}else i.composedPath().some(u=>["media-play-button","media-fullscreen-button"].includes(u==null?void 0:u.localName))&&Zi(this,xi,fa).call(this)},Di=new WeakSet,ti=function(){if(Ei(this,xa)<0||this.hasAttribute(vr.USER_INACTIVE))return;this.setAttribute(vr.USER_INACTIVE,"");let i=new ie.CustomEvent(Br.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(i)},sa=new WeakSet,fn=function(){if(!this.hasAttribute(vr.USER_INACTIVE))return;this.removeAttribute(vr.USER_INACTIVE);let i=new ie.CustomEvent(Br.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(i)},xi=new WeakSet,fa=function(){Zi(this,sa,fn).call(this),clearTimeout(Ei(this,Ts));let i=parseInt(this.autohide);i<0||na(this,Ts,setTimeout(()=>{Zi(this,Di,ti).call(this)},i*1e3))},xn.shadowRootOptions={mode:"open"},xn.getTemplateHTML=In,ie.customElements.get("media-container")||ie.customElements.define("media-container",xn);var Za=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},fi=(i,u,h)=>(Za(i,u,"read from private field"),h?h.call(i):u.get(i)),Ja=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},wn=(i,u,h,E)=>(Za(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),mn,Ba,Wn,pa,oa,ki,pn=class{constructor(i,u,{defaultValue:h}={defaultValue:void 0}){Ja(this,oa),Ja(this,mn,void 0),Ja(this,Ba,void 0),Ja(this,Wn,void 0),Ja(this,pa,new Set),wn(this,mn,i),wn(this,Ba,u),wn(this,Wn,new Set(h))}[Symbol.iterator](){return fi(this,oa,ki).values()}get length(){return fi(this,oa,ki).size}get value(){var i;return(i=[...fi(this,oa,ki)].join(" "))!=null?i:""}set value(i){var u;i!==this.value&&(wn(this,pa,new Set),this.add(...(u=i==null?void 0:i.split(" "))!=null?u:[]))}toString(){return this.value}item(i){return[...fi(this,oa,ki)][i]}values(){return fi(this,oa,ki).values()}forEach(i,u){fi(this,oa,ki).forEach(i,u)}add(...i){var u,h;i.forEach(E=>fi(this,pa).add(E)),!(this.value===""&&!((u=fi(this,mn))!=null&&u.hasAttribute(`${fi(this,Ba)}`)))&&((h=fi(this,mn))==null||h.setAttribute(`${fi(this,Ba)}`,`${this.value}`))}remove(...i){var u;i.forEach(h=>fi(this,pa).delete(h)),(u=fi(this,mn))==null||u.setAttribute(`${fi(this,Ba)}`,`${this.value}`)}contains(i){return fi(this,oa,ki).has(i)}toggle(i,u){return typeof u!="undefined"?u?(this.add(i),!0):(this.remove(i),!1):this.contains(i)?(this.remove(i),!1):(this.add(i),!0)}replace(i,u){return this.remove(i),this.add(u),i===u}};mn=new WeakMap,Ba=new WeakMap,Wn=new WeakMap,pa=new WeakMap,oa=new WeakSet,ki=function(){return fi(this,pa).size?fi(this,pa):fi(this,Wn)};var Yn=(i="")=>i.split(/\s+/),M=(i="")=>{let[u,h,E]=i.split(":"),R=E?decodeURIComponent(E):void 0;return{kind:u==="cc"?Be.CAPTIONS:Be.SUBTITLES,language:h,label:R}},P=(i="",u={})=>Yn(i).map(h=>{let E=M(h);return he(he({},u),E)}),q=i=>i?Array.isArray(i)?i.map(u=>typeof u=="string"?M(u):u):typeof i=="string"?P(i):[i]:[],ue=({kind:i,label:u,language:h}={kind:"subtitles"})=>u?`${i==="captions"?"cc":"sb"}:${h}:${encodeURIComponent(u)}`:h,le=(i=[])=>Array.prototype.map.call(i,ue).join(" "),We=(i,u)=>h=>h[i]===u,xe=i=>{let u=Object.entries(i).map(([h,E])=>We(h,E));return h=>u.every(E=>E(h))},lt=(i,u=[],h=[])=>{let E=q(h).map(xe),R=G=>E.some(ee=>ee(G));Array.from(u).filter(R).forEach(G=>{G.mode=i})},Ce=(i,u=()=>!0)=>{if(!(i!=null&&i.textTracks))return[];let h=typeof u=="function"?u:xe(u);return Array.from(i.textTracks).filter(h)},wt=i=>{var u;return!!((u=i.mediaSubtitlesShowing)!=null&&u.length)||i.hasAttribute(V.MEDIA_SUBTITLES_SHOWING)},gt=i=>{var u;let{media:h,fullscreenElement:E}=i;try{let R=E&&"requestFullscreen"in E?"requestFullscreen":E&&"webkitRequestFullScreen"in E?"webkitRequestFullScreen":void 0;if(R){let G=(u=E[R])==null?void 0:u.call(E);if(G instanceof Promise)return G.catch(()=>{})}else h!=null&&h.webkitEnterFullscreen?h.webkitEnterFullscreen():h!=null&&h.requestFullscreen&&h.requestFullscreen()}catch(R){console.error(R)}},Yt="exitFullscreen"in er?"exitFullscreen":"webkitExitFullscreen"in er?"webkitExitFullscreen":"webkitCancelFullScreen"in er?"webkitCancelFullScreen":void 0,mr=i=>{var u;let{documentElement:h}=i;if(Yt){let E=(u=h==null?void 0:h[Yt])==null?void 0:u.call(h);if(E instanceof Promise)return E.catch(()=>{})}},pr="fullscreenElement"in er?"fullscreenElement":"webkitFullscreenElement"in er?"webkitFullscreenElement":void 0,Tr=i=>{let{documentElement:u,media:h}=i,E=u==null?void 0:u[pr];return!E&&"webkitDisplayingFullscreen"in h&&"webkitPresentationMode"in h&&h.webkitDisplayingFullscreen&&h.webkitPresentationMode===Lr.FULLSCREEN?h:E},Ur=i=>{var u;let{media:h,documentElement:E,fullscreenElement:R=h}=i;if(!h||!E)return!1;let G=Tr(i);if(!G)return!1;if(G===R||G===h)return!0;if(G.localName.includes("-")){let ee=G.shadowRoot;if(!(pr in ee))return aa(G,R);for(;ee!=null&&ee[pr];){if(ee[pr]===R)return!0;ee=(u=ee[pr])==null?void 0:u.shadowRoot}}return!1},wr="fullscreenEnabled"in er?"fullscreenEnabled":"webkitFullscreenEnabled"in er?"webkitFullscreenEnabled":void 0,Fr=i=>{let{documentElement:u,media:h}=i;return!!(u!=null&&u[wr])||h&&"webkitSupportsFullscreen"in h},Xr,dr=()=>{var i,u;return Xr||(Xr=(u=(i=er)==null?void 0:i.createElement)==null?void 0:u.call(i,"video"),Xr)},Ki=(...i)=>j(this,[...i],function*(u=dr()){if(!u)return!1;let h=u.volume;u.volume=h/2+.1;let E=new AbortController,R=yield Promise.race([$i(u,E.signal),Ha(u,h)]);return E.abort(),R}),$i=(i,u)=>new Promise(h=>{i.addEventListener("volumechange",()=>h(!0),{signal:u})}),Ha=(i,u)=>j(this,null,function*(){for(let h=0;h<10;h++){if(i.volume===u)return!1;yield Zt(10)}return i.volume!==u}),$n=/.*Version\/.*Safari\/.*/.test(ie.navigator.userAgent),ga=(i=dr())=>ie.matchMedia("(display-mode: standalone)").matches&&$n?!1:typeof(i==null?void 0:i.requestPictureInPicture)=="function",Va=(i=dr())=>Fr({documentElement:er,media:i}),qn=Va(),Cn=ga(),Ys=!!ie.WebKitPlaybackTargetAvailabilityEvent,Pr=!!ie.chrome,La=i=>Ce(i.media,u=>[Be.SUBTITLES,Be.CAPTIONS].includes(u.kind)).sort((u,h)=>u.kind>=h.kind?1:-1),ho=i=>Ce(i.media,u=>u.mode===je.SHOWING&&[Be.SUBTITLES,Be.CAPTIONS].includes(u.kind)),Ga=(i,u)=>{let h=La(i),E=ho(i),R=!!E.length;if(h.length){if(u===!1||R&&u!==!0)lt(je.DISABLED,h,E);else if(u===!0||!R&&u!==!1){let G=h[0],{options:ee}=i;if(!(ee!=null&&ee.noSubtitlesLangPref)){let Er=globalThis.localStorage.getItem("media-chrome-pref-subtitles-lang"),ar=Er?[Er,...globalThis.navigator.languages]:globalThis.navigator.languages,nr=h.filter(rr=>ar.some(Mr=>rr.language.toLowerCase().startsWith(Mr.split("-")[0]))).sort((rr,Mr)=>{let Zr=ar.findIndex(Aa=>rr.language.toLowerCase().startsWith(Aa.split("-")[0])),mi=ar.findIndex(Aa=>Mr.language.toLowerCase().startsWith(Aa.split("-")[0]));return Zr-mi});nr[0]&&(G=nr[0])}let{language:ge,label:_t,kind:It}=G;lt(je.DISABLED,h,E),lt(je.SHOWING,h,[{language:ge,label:_t,kind:It}])}}},_s=(i,u)=>i===u?!0:i==null||u==null||typeof i!=typeof u?!1:typeof i=="number"&&Number.isNaN(i)&&Number.isNaN(u)?!0:typeof i!="object"?!1:Array.isArray(i)?fo(i,u):Object.entries(i).every(([h,E])=>h in u&&_s(E,u[h])),fo=(i,u)=>{let h=Array.isArray(i),E=Array.isArray(u);return h!==E?!1:h||E?i.length!==u.length?!1:i.every((R,G)=>_s(R,u[G])):!0},ml=Object.values(Ut),$s,Hi=Ki().then(i=>($s=i,$s)),pl=(...i)=>j(this,null,function*(){yield Promise.all(i.filter(u=>u).map(u=>j(this,null,function*(){if(!("localName"in u&&u instanceof ie.HTMLElement))return;let h=u.localName;if(!h.includes("-"))return;let E=ie.customElements.get(h);E&&u instanceof E||(yield ie.customElements.whenDefined(h),ie.customElements.upgrade(u))})))}),gl=new ie.DOMParser,lu=i=>i&&(gl.parseFromString(i,"text/html").body.textContent||i),ka={mediaError:{get(i,u){let{media:h}=i;if((u==null?void 0:u.type)!=="playing")return h==null?void 0:h.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(i,u){var h;let{media:E}=i;if((u==null?void 0:u.type)!=="playing")return(h=E==null?void 0:E.error)==null?void 0:h.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(i,u){var h,E;let{media:R}=i;if((u==null?void 0:u.type)!=="playing")return(E=(h=R==null?void 0:R.error)==null?void 0:h.message)!=null?E:""},mediaEvents:["emptied","error","playing"]},mediaWidth:{get(i){var u;let{media:h}=i;return(u=h==null?void 0:h.videoWidth)!=null?u:0},mediaEvents:["resize"]},mediaHeight:{get(i){var u;let{media:h}=i;return(u=h==null?void 0:h.videoHeight)!=null?u:0},mediaEvents:["resize"]},mediaPaused:{get(i){var u;let{media:h}=i;return(u=h==null?void 0:h.paused)!=null?u:!0},set(i,u){var h;let{media:E}=u;E&&(i?E.pause():(h=E.play())==null||h.catch(()=>{}))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(i,u){let{media:h}=i;return h?u?u.type==="playing":!h.paused:!1},mediaEvents:["playing","emptied"]},mediaEnded:{get(i){var u;let{media:h}=i;return(u=h==null?void 0:h.ended)!=null?u:!1},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(i){var u;let{media:h}=i;return(u=h==null?void 0:h.playbackRate)!=null?u:1},set(i,u){let{media:h}=u;h&&Number.isFinite(+i)&&(h.playbackRate=+i)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(i){var u;let{media:h}=i;return(u=h==null?void 0:h.muted)!=null?u:!1},set(i,u){let{media:h,options:{noMutedPref:E}={}}=u;if(h){h.muted=i;try{let R=ie.localStorage.getItem("media-chrome-pref-muted")!==null,G=h.hasAttribute("muted");if(E){R&&ie.localStorage.removeItem("media-chrome-pref-muted");return}if(G&&!R)return;ie.localStorage.setItem("media-chrome-pref-muted",i?"true":"false")}catch(R){console.debug("Error setting muted pref",R)}}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,u)=>{let{options:{noMutedPref:h}}=u,{media:E}=u;if(!(!E||E.muted||h))try{let R=ie.localStorage.getItem("media-chrome-pref-muted")==="true";ka.mediaMuted.set(R,u),i(R)}catch(R){console.debug("Error getting muted pref",R)}}]},mediaLoop:{get(i){let{media:u}=i;return u==null?void 0:u.loop},set(i,u){let{media:h}=u;h&&(h.loop=i)},mediaEvents:["medialooprequest"]},mediaVolume:{get(i){var u;let{media:h}=i;return(u=h==null?void 0:h.volume)!=null?u:1},set(i,u){let{media:h,options:{noVolumePref:E}={}}=u;if(h){try{i==null?ie.localStorage.removeItem("media-chrome-pref-volume"):!h.hasAttribute("muted")&&!E&&ie.localStorage.setItem("media-chrome-pref-volume",i.toString())}catch(R){console.debug("Error setting volume pref",R)}Number.isFinite(+i)&&(h.volume=+i)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,u)=>{let{options:{noVolumePref:h}}=u;if(!h)try{let{media:E}=u;if(!E)return;let R=ie.localStorage.getItem("media-chrome-pref-volume");if(R==null)return;ka.mediaVolume.set(+R,u),i(+R)}catch(E){console.debug("Error getting volume pref",E)}}]},mediaVolumeLevel:{get(i){let{media:u}=i;return typeof(u==null?void 0:u.volume)=="undefined"?"high":u.muted||u.volume===0?"off":u.volume<.5?"low":u.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(i){var u;let{media:h}=i;return(u=h==null?void 0:h.currentTime)!=null?u:0},set(i,u){let{media:h}=u;!h||!zt(i)||(h.currentTime=i)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(i){let{media:u,options:{defaultDuration:h}={}}=i;return h&&(!u||!u.duration||Number.isNaN(u.duration)||!Number.isFinite(u.duration))?h:Number.isFinite(u==null?void 0:u.duration)?u.duration:Number.NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(i){let{media:u}=i;return(u==null?void 0:u.readyState)<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(i){var u;let{media:h}=i;if(!((u=h==null?void 0:h.seekable)!=null&&u.length))return;let E=h.seekable.start(0),R=h.seekable.end(h.seekable.length-1);if(!(!E&&!R))return[Number(E.toFixed(3)),Number(R.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(i){var u;let{media:h}=i,E=(u=h==null?void 0:h.buffered)!=null?u:[];return Array.from(E).map((R,G)=>[Number(E.start(G).toFixed(3)),Number(E.end(G).toFixed(3))])},mediaEvents:["progress","emptied"]},mediaStreamType:{get(i){let{media:u,options:{defaultStreamType:h}={}}=i,E=[Ut.LIVE,Ut.ON_DEMAND].includes(h)?h:void 0;if(!u)return E;let{streamType:R}=u;if(ml.includes(R))return R===Ut.UNKNOWN?E:R;let G=u.duration;return G===1/0?Ut.LIVE:Number.isFinite(G)?Ut.ON_DEMAND:E},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(i){let{media:u}=i;if(!u)return Number.NaN;let{targetLiveWindow:h}=u,E=ka.mediaStreamType.get(i);return(h==null||Number.isNaN(h))&&E===Ut.LIVE?0:h},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(i){let{media:u,options:{liveEdgeOffset:h=10}={}}=i;if(!u)return!1;if(typeof u.liveEdgeStart=="number")return Number.isNaN(u.liveEdgeStart)?!1:u.currentTime>=u.liveEdgeStart;if(ka.mediaStreamType.get(i)!==Ut.LIVE)return!1;let E=u.seekable;if(!E)return!0;if(!E.length)return!1;let R=E.end(E.length-1)-h;return u.currentTime>=R},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},mediaSubtitlesList:{get(i){return La(i).map(({kind:u,label:h,language:E})=>({kind:u,label:h,language:E}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get(i){return ho(i).map(({kind:u,label:h,language:E})=>({kind:u,label:h,language:E}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(i,u)=>{var h,E;let{media:R,options:G}=u;if(!R)return;let ee=ge=>{var _t;!G.defaultSubtitles||ge&&![Be.CAPTIONS,Be.SUBTITLES].includes((_t=ge==null?void 0:ge.track)==null?void 0:_t.kind)||Ga(u,!0)};return R.addEventListener("loadstart",ee),(h=R.textTracks)==null||h.addEventListener("addtrack",ee),(E=R.textTracks)==null||E.addEventListener("removetrack",ee),()=>{var ge,_t;R.removeEventListener("loadstart",ee),(ge=R.textTracks)==null||ge.removeEventListener("addtrack",ee),(_t=R.textTracks)==null||_t.removeEventListener("removetrack",ee)}}]},mediaChaptersCues:{get(i){var u;let{media:h}=i;if(!h)return[];let[E]=Ce(h,{kind:Be.CHAPTERS});return Array.from((u=E==null?void 0:E.cues)!=null?u:[]).map(({text:R,startTime:G,endTime:ee})=>({text:lu(R),startTime:G,endTime:ee}))},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(i,u)=>{var h;let{media:E}=u;if(!E)return;let R=E.querySelector('track[kind="chapters"][default][src]'),G=(h=E.shadowRoot)==null?void 0:h.querySelector(':is(video,audio) > track[kind="chapters"][default][src]');return R==null||R.addEventListener("load",i),G==null||G.addEventListener("load",i),()=>{R==null||R.removeEventListener("load",i),G==null||G.removeEventListener("load",i)}}]},mediaIsPip:{get(i){var u,h;let{media:E,documentElement:R}=i;if(!E||!R||!R.pictureInPictureElement)return!1;if(R.pictureInPictureElement===E)return!0;if(R.pictureInPictureElement instanceof HTMLMediaElement)return(u=E.localName)!=null&&u.includes("-")?aa(E,R.pictureInPictureElement):!1;if(R.pictureInPictureElement.localName.includes("-")){let G=R.pictureInPictureElement.shadowRoot;for(;G!=null&&G.pictureInPictureElement;){if(G.pictureInPictureElement===E)return!0;G=(h=G.pictureInPictureElement)==null?void 0:h.shadowRoot}}return!1},set(i,u){let{media:h}=u;if(h)if(i){if(!er.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!h.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}let E=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};h.requestPictureInPicture().catch(R=>{if(R.code===11){if(!h.src){console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a src set.");return}if(h.readyState===0&&h.preload==="none"){let G=()=>{h.removeEventListener("loadedmetadata",ee),h.preload="none"},ee=()=>{h.requestPictureInPicture().catch(E),G()};h.addEventListener("loadedmetadata",ee),h.preload="metadata",setTimeout(()=>{h.readyState===0&&E(),G()},1e3)}else throw R}else throw R})}else er.pictureInPictureElement&&er.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(i){var u;let{media:h}=i;return[...(u=h==null?void 0:h.videoRenditions)!=null?u:[]].map(E=>he({},E))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(i){var u,h,E;let{media:R}=i;return(E=(h=R==null?void 0:R.videoRenditions)==null?void 0:h[(u=R.videoRenditions)==null?void 0:u.selectedIndex])==null?void 0:E.id},set(i,u){let{media:h}=u;if(!(h!=null&&h.videoRenditions)){console.warn("MediaController: Rendition selection not supported by this media.");return}let E=i,R=Array.prototype.findIndex.call(h.videoRenditions,G=>G.id==E);h.videoRenditions.selectedIndex!=R&&(h.videoRenditions.selectedIndex=R)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(i){var u;let{media:h}=i;return[...(u=h==null?void 0:h.audioTracks)!=null?u:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(i){var u,h;let{media:E}=i;return(h=[...(u=E==null?void 0:E.audioTracks)!=null?u:[]].find(R=>R.enabled))==null?void 0:h.id},set(i,u){let{media:h}=u;if(!(h!=null&&h.audioTracks)){console.warn("MediaChrome: Audio track selection not supported by this media.");return}let E=i;for(let R of h.audioTracks)R.enabled=E==R.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get(i){return Ur(i)},set(i,u,h){var E;i?(gt(u),h.detail&&((E=u.media)==null||E.focus())):mr(u)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(i){var u;let{media:h}=i;return!(h!=null&&h.remote)||((u=h.remote)==null?void 0:u.state)==="disconnected"?!1:!!h.remote.state},set(i,u){var h,E;let{media:R}=u;if(R&&!(i&&((h=R.remote)==null?void 0:h.state)!=="disconnected")&&!(!i&&((E=R.remote)==null?void 0:E.state)!=="connected")){if(typeof R.remote.prompt!="function"){console.warn("MediaChrome: Casting is not supported in this environment");return}R.remote.prompt().catch(()=>{})}},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get(){return!1},set(i,u){let{media:h}=u;if(h){if(!(h.webkitShowPlaybackTargetPicker&&ie.WebKitPlaybackTargetAvailabilityEvent)){console.error("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment");return}h.webkitShowPlaybackTargetPicker()}},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(i){let{media:u}=i;if(!qn||!Va(u))return Nt.UNSUPPORTED}},mediaPipUnavailable:{get(i){let{media:u}=i;if(!Cn||!ga(u))return Nt.UNSUPPORTED;if(u!=null&&u.disablePictureInPicture)return Nt.UNAVAILABLE}},mediaVolumeUnavailable:{get(i){let{media:u}=i;if($s===!1||(u==null?void 0:u.volume)==null)return Nt.UNSUPPORTED},stateOwnersUpdateHandlers:[i=>{$s==null&&Hi.then(u=>i(u?void 0:Nt.UNSUPPORTED))}]},mediaCastUnavailable:{get(i,{availability:u="not-available"}={}){var h;let{media:E}=i;if(!Pr||!((h=E==null?void 0:E.remote)!=null&&h.state))return Nt.UNSUPPORTED;if(!(u==null||u==="available"))return Nt.UNAVAILABLE},stateOwnersUpdateHandlers:[(i,u)=>{var h;let{media:E}=u;return E?(E.disableRemotePlayback||E.hasAttribute("disableremoteplayback")||(h=E==null?void 0:E.remote)==null||h.watchAvailability(R=>{i({availability:R?"available":"not-available"})}).catch(R=>{R.name==="NotSupportedError"?i({availability:null}):i({availability:"not-available"})}),()=>{var R;(R=E==null?void 0:E.remote)==null||R.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaAirplayUnavailable:{get(i,u){if(!Ys)return Nt.UNSUPPORTED;if((u==null?void 0:u.availability)==="not-available")return Nt.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(i,u)=>{var h;let{media:E}=u;return E?(E.disableRemotePlayback||E.hasAttribute("disableremoteplayback")||(h=E==null?void 0:E.remote)==null||h.watchAvailability(R=>{i({availability:R?"available":"not-available"})}).catch(R=>{R.name==="NotSupportedError"?i({availability:null}):i({availability:"not-available"})}),()=>{var R;(R=E==null?void 0:E.remote)==null||R.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaRenditionUnavailable:{get(i){var u;let{media:h}=i;if(!(h!=null&&h.videoRenditions))return Nt.UNSUPPORTED;if(!((u=h.videoRenditions)!=null&&u.length))return Nt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(i){var u,h;let{media:E}=i;if(!(E!=null&&E.audioTracks))return Nt.UNSUPPORTED;if(((h=(u=E.audioTracks)==null?void 0:u.length)!=null?h:0)<=1)return Nt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaLang:{get(i){let{options:{mediaLang:u}={}}=i;return u!=null?u:"en"}}},qs={[Te.MEDIA_PREVIEW_REQUEST](i,u,{detail:h}){var E,R,G;let{media:ee}=u,ge=h!=null?h:void 0,_t,It;if(ee&&ge!=null){let[nr]=Ce(ee,{kind:Be.METADATA,label:"thumbnails"}),rr=Array.prototype.find.call((E=nr==null?void 0:nr.cues)!=null?E:[],(Mr,Zr,mi)=>Zr===0?Mr.endTime>ge:Zr===mi.length-1?Mr.startTime<=ge:Mr.startTime<=ge&&Mr.endTime>ge);if(rr){let Mr=/'^(?:[a-z]+:)?\/\//i.test(rr.text)||(R=ee==null?void 0:ee.querySelector('track[label="thumbnails"]'))==null?void 0:R.src,Zr=new URL(rr.text,Mr);It=new URLSearchParams(Zr.hash).get("#xywh").split(",").map(mi=>+mi),_t=Zr.href}}let Er=i.mediaDuration.get(u),ar=(G=i.mediaChaptersCues.get(u).find((nr,rr,Mr)=>rr===Mr.length-1&&Er===nr.endTime?nr.startTime<=ge&&nr.endTime>=ge:nr.startTime<=ge&&nr.endTime>ge))==null?void 0:G.text;return h!=null&&ar==null&&(ar=""),{mediaPreviewTime:ge,mediaPreviewImage:_t,mediaPreviewCoords:It,mediaPreviewChapter:ar}},[Te.MEDIA_PAUSE_REQUEST](i,u){i.mediaPaused.set(!0,u)},[Te.MEDIA_PLAY_REQUEST](i,u){var h,E,R,G;let ee="mediaPaused",ge=i.mediaStreamType.get(u)===Ut.LIVE,_t=!((h=u.options)!=null&&h.noAutoSeekToLive),It=i.mediaTargetLiveWindow.get(u)>0;if(ge&&_t&&!It){let Er=(E=i.mediaSeekable.get(u))==null?void 0:E[1];if(Er){let ar=(G=(R=u.options)==null?void 0:R.seekToLiveOffset)!=null?G:0,nr=Er-ar;i.mediaCurrentTime.set(nr,u)}}i[ee].set(!1,u)},[Te.MEDIA_PLAYBACK_RATE_REQUEST](i,u,{detail:h}){let E="mediaPlaybackRate",R=h;i[E].set(R,u)},[Te.MEDIA_MUTE_REQUEST](i,u){i.mediaMuted.set(!0,u)},[Te.MEDIA_UNMUTE_REQUEST](i,u){i.mediaVolume.get(u)||i.mediaVolume.set(.25,u),i["mediaMuted"].set(!1,u)},[Te.MEDIA_LOOP_REQUEST](i,u,{detail:h}){let E="mediaLoop",R=!!h;return i[E].set(R,u),{mediaLoop:R}},[Te.MEDIA_VOLUME_REQUEST](i,u,{detail:h}){let E="mediaVolume",R=h;R&&i.mediaMuted.get(u)&&i.mediaMuted.set(!1,u),i[E].set(R,u)},[Te.MEDIA_SEEK_REQUEST](i,u,{detail:h}){let E="mediaCurrentTime",R=h;i[E].set(R,u)},[Te.MEDIA_SEEK_TO_LIVE_REQUEST](i,u){var h,E,R;let G="mediaCurrentTime",ee=(h=i.mediaSeekable.get(u))==null?void 0:h[1];if(Number.isNaN(Number(ee)))return;let ge=(R=(E=u.options)==null?void 0:E.seekToLiveOffset)!=null?R:0,_t=ee-ge;i[G].set(_t,u)},[Te.MEDIA_SHOW_SUBTITLES_REQUEST](i,u,{detail:h}){var E;let{options:R}=u,G=La(u),ee=q(h),ge=(E=ee[0])==null?void 0:E.language;ge&&!R.noSubtitlesLangPref&&ie.localStorage.setItem("media-chrome-pref-subtitles-lang",ge),lt(je.SHOWING,G,ee)},[Te.MEDIA_DISABLE_SUBTITLES_REQUEST](i,u,{detail:h}){let E=La(u),R=h!=null?h:[];lt(je.DISABLED,E,R)},[Te.MEDIA_TOGGLE_SUBTITLES_REQUEST](i,u,{detail:h}){Ga(u,h)},[Te.MEDIA_RENDITION_REQUEST](i,u,{detail:h}){let E="mediaRenditionSelected",R=h;i[E].set(R,u)},[Te.MEDIA_AUDIO_TRACK_REQUEST](i,u,{detail:h}){let E="mediaAudioTrackEnabled",R=h;i[E].set(R,u)},[Te.MEDIA_ENTER_PIP_REQUEST](i,u){i.mediaIsFullscreen.get(u)&&i.mediaIsFullscreen.set(!1,u),i["mediaIsPip"].set(!0,u)},[Te.MEDIA_EXIT_PIP_REQUEST](i,u){i.mediaIsPip.set(!1,u)},[Te.MEDIA_ENTER_FULLSCREEN_REQUEST](i,u,h){i.mediaIsPip.get(u)&&i.mediaIsPip.set(!1,u),i["mediaIsFullscreen"].set(!0,u,h)},[Te.MEDIA_EXIT_FULLSCREEN_REQUEST](i,u){i.mediaIsFullscreen.set(!1,u)},[Te.MEDIA_ENTER_CAST_REQUEST](i,u){i.mediaIsFullscreen.get(u)&&i.mediaIsFullscreen.set(!1,u),i["mediaIsCasting"].set(!0,u)},[Te.MEDIA_EXIT_CAST_REQUEST](i,u){i.mediaIsCasting.set(!1,u)},[Te.MEDIA_AIRPLAY_REQUEST](i,u){i.mediaIsAirplaying.set(!0,u)}},vo=({media:i,fullscreenElement:u,documentElement:h,stateMediator:E=ka,requestMap:R=qs,options:G={},monitorStateOwnersOnlyWithSubscriptions:ee=!0})=>{let ge=[],_t={options:he({},G)},It=Object.freeze({mediaPreviewTime:void 0,mediaPreviewImage:void 0,mediaPreviewCoords:void 0,mediaPreviewChapter:void 0}),Er=Zr=>{Zr!=null&&(_s(Zr,It)||(It=Object.freeze(he(he({},It),Zr)),ge.forEach(mi=>mi(It))))},ar=()=>{let Zr=Object.entries(E).reduce((mi,[Aa,{get:os}])=>(mi[Aa]=os(_t),mi),{});Er(Zr)},nr={},rr,Mr=(Zr,mi)=>j(this,null,function*(){var Aa,os,vl,su,Mh,Ph,Oh,xh,Nh,Uh,Fh,Bh,Hh,Vh,Gh,Kh;let Lv=!!rr;if(rr=he(he(he({},_t),rr!=null?rr:{}),Zr),Lv)return;yield pl(...Object.values(Zr));let ou=ge.length>0&&mi===0&&ee,Wh=_t.media!==rr.media,Yh=((Aa=_t.media)==null?void 0:Aa.textTracks)!==((os=rr.media)==null?void 0:os.textTracks),$h=((vl=_t.media)==null?void 0:vl.videoRenditions)!==((su=rr.media)==null?void 0:su.videoRenditions),qh=((Mh=_t.media)==null?void 0:Mh.audioTracks)!==((Ph=rr.media)==null?void 0:Ph.audioTracks),Op=((Oh=_t.media)==null?void 0:Oh.remote)!==((xh=rr.media)==null?void 0:xh.remote),xp=_t.documentElement!==rr.documentElement,Np=!!_t.media&&(Wh||ou),Up=!!((Nh=_t.media)!=null&&Nh.textTracks)&&(Yh||ou),Fp=!!((Uh=_t.media)!=null&&Uh.videoRenditions)&&($h||ou),Bp=!!((Fh=_t.media)!=null&&Fh.audioTracks)&&(qh||ou),Hp=!!((Bh=_t.media)!=null&&Bh.remote)&&(Op||ou),Vp=!!_t.documentElement&&(xp||ou),Qm=Np||Up||Fp||Bp||Hp||Vp,wc=ge.length===0&&mi===1&&ee,Gp=!!rr.media&&(Wh||wc),Kp=!!((Hh=rr.media)!=null&&Hh.textTracks)&&(Yh||wc),Wp=!!((Vh=rr.media)!=null&&Vh.videoRenditions)&&($h||wc),Yp=!!((Gh=rr.media)!=null&&Gh.audioTracks)&&(qh||wc),$p=!!((Kh=rr.media)!=null&&Kh.remote)&&(Op||wc),qp=!!rr.documentElement&&(xp||wc),jp=Gp||Kp||Wp||Yp||$p||qp;if(!(Qm||jp)){Object.entries(rr).forEach(([Wi,jh])=>{_t[Wi]=jh}),ar(),rr=void 0;return}Object.entries(E).forEach(([Wi,{get:jh,mediaEvents:Hg=[],textTracksEvents:Vg=[],videoRenditionsEvents:Gg=[],audioTracksEvents:Kg=[],remoteEvents:Wg=[],rootEvents:Yg=[],stateOwnersUpdateHandlers:$g=[]}])=>{nr[Wi]||(nr[Wi]={});let Vs=ea=>{let On=jh(_t,ea);Er({[Wi]:On})},Sn;Sn=nr[Wi].mediaEvents,Hg.forEach(ea=>{Sn&&Np&&(_t.media.removeEventListener(ea,Sn),nr[Wi].mediaEvents=void 0),Gp&&(rr.media.addEventListener(ea,Vs),nr[Wi].mediaEvents=Vs)}),Sn=nr[Wi].textTracksEvents,Vg.forEach(ea=>{var On,Mo;Sn&&Up&&((On=_t.media.textTracks)==null||On.removeEventListener(ea,Sn),nr[Wi].textTracksEvents=void 0),Kp&&((Mo=rr.media.textTracks)==null||Mo.addEventListener(ea,Vs),nr[Wi].textTracksEvents=Vs)}),Sn=nr[Wi].videoRenditionsEvents,Gg.forEach(ea=>{var On,Mo;Sn&&Fp&&((On=_t.media.videoRenditions)==null||On.removeEventListener(ea,Sn),nr[Wi].videoRenditionsEvents=void 0),Wp&&((Mo=rr.media.videoRenditions)==null||Mo.addEventListener(ea,Vs),nr[Wi].videoRenditionsEvents=Vs)}),Sn=nr[Wi].audioTracksEvents,Kg.forEach(ea=>{var On,Mo;Sn&&Bp&&((On=_t.media.audioTracks)==null||On.removeEventListener(ea,Sn),nr[Wi].audioTracksEvents=void 0),Yp&&((Mo=rr.media.audioTracks)==null||Mo.addEventListener(ea,Vs),nr[Wi].audioTracksEvents=Vs)}),Sn=nr[Wi].remoteEvents,Wg.forEach(ea=>{var On,Mo;Sn&&Hp&&((On=_t.media.remote)==null||On.removeEventListener(ea,Sn),nr[Wi].remoteEvents=void 0),$p&&((Mo=rr.media.remote)==null||Mo.addEventListener(ea,Vs),nr[Wi].remoteEvents=Vs)}),Sn=nr[Wi].rootEvents,Yg.forEach(ea=>{Sn&&Vp&&(_t.documentElement.removeEventListener(ea,Sn),nr[Wi].rootEvents=void 0),qp&&(rr.documentElement.addEventListener(ea,Vs),nr[Wi].rootEvents=Vs)});let kv=nr[Wi].stateOwnersUpdateHandlers;if(kv&&Qm&&(Array.isArray(kv)?kv:[kv]).forEach(ea=>{typeof ea=="function"&&ea()}),jp){let ea=$g.map(On=>On(Vs,rr)).filter(On=>typeof On=="function");nr[Wi].stateOwnersUpdateHandlers=ea.length===1?ea[0]:ea}else Qm&&(nr[Wi].stateOwnersUpdateHandlers=void 0)}),Object.entries(rr).forEach(([Wi,jh])=>{_t[Wi]=jh}),ar(),rr=void 0});return Mr({media:i,fullscreenElement:u,documentElement:h,options:G}),{dispatch(Zr){let{type:mi,detail:Aa}=Zr;if(R[mi]&&It.mediaErrorCode==null){Er(R[mi](E,_t,Zr));return}mi==="mediaelementchangerequest"?Mr({media:Aa}):mi==="fullscreenelementchangerequest"?Mr({fullscreenElement:Aa}):mi==="documentelementchangerequest"?Mr({documentElement:Aa}):mi==="optionschangerequest"&&(Object.entries(Aa!=null?Aa:{}).forEach(([os,vl])=>{_t.options[os]=vl}),ar())},getState(){return It},subscribe(Zr){return Mr({},ge.length+1),ge.push(Zr),Zr(It),()=>{let mi=ge.indexOf(Zr);mi>=0&&(Mr({},ge.length-1),ge.splice(mi,1))}}}},Mi=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},gr=(i,u,h)=>(Mi(i,u,"read from private field"),h?h.call(i):u.get(i)),Ji=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},Ka=(i,u,h,E)=>(Mi(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),I=(i,u,h)=>(Mi(i,u,"access private method"),h),A,k,x,D,z,$,Fe,Ve,tt,Mt,Gt,et,Ue,bt,tr,Kt,Or=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Enter"," ","f","m","k","c","l","j",">","<","p"],$t=10,Ot=.025,St=.25,Sr=.25,kr=2,rt={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",DEFAULT_DURATION:"defaultduration",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYBOARD_BACKWARD_SEEK_OFFSET:"keyboardbackwardseekoffset",KEYBOARD_FORWARD_SEEK_OFFSET:"keyboardforwardseekoffset",KEYBOARD_DOWN_VOLUME_STEP:"keyboarddownvolumestep",KEYBOARD_UP_VOLUME_STEP:"keyboardupvolumestep",KEYS_USED:"keysused",LANG:"lang",LOOP:"loop",LIVE_EDGE_OFFSET:"liveedgeoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_DEFAULT_STORE:"nodefaultstore",NO_HOTKEYS:"nohotkeys",NO_MUTED_PREF:"nomutedpref",NO_SUBTITLES_LANG_PREF:"nosubtitleslangpref",NO_VOLUME_PREF:"novolumepref",SEEK_TO_LIVE_OFFSET:"seektoliveoffset"},ri=class extends xn{constructor(){super(),Ji(this,tt),Ji(this,Gt),Ji(this,Ue),Ji(this,tr),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,Ji(this,A,new pn(this,rt.HOTKEYS)),Ji(this,k,void 0),Ji(this,x,void 0),Ji(this,D,null),Ji(this,z,void 0),Ji(this,$,void 0),Ji(this,Fe,u=>{var h;(h=gr(this,x))==null||h.dispatch(u)}),Ji(this,Ve,void 0),this.associateElement(this);let i={};Ka(this,z,u=>{Object.entries(u).forEach(([h,E])=>{if(h in i&&i[h]===E)return;this.propagateMediaState(h,E);let R=h.toLowerCase(),G=new ie.CustomEvent(U[R],{composed:!0,detail:E});this.dispatchEvent(G)}),i=u}),this.hasAttribute(rt.NO_HOTKEYS)?this.disableHotkeys():this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(rt.NO_HOTKEYS,rt.HOTKEYS,rt.DEFAULT_STREAM_TYPE,rt.DEFAULT_SUBTITLES,rt.DEFAULT_DURATION,rt.NO_MUTED_PREF,rt.NO_VOLUME_PREF,rt.LANG,rt.LOOP)}get mediaStore(){return gr(this,x)}set mediaStore(i){var u,h;if(gr(this,x)&&((u=gr(this,$))==null||u.call(this),Ka(this,$,void 0)),Ka(this,x,i),!gr(this,x)&&!this.hasAttribute(rt.NO_DEFAULT_STORE)){I(this,tt,Mt).call(this);return}Ka(this,$,(h=gr(this,x))==null?void 0:h.subscribe(gr(this,z)))}get fullscreenElement(){var i;return(i=gr(this,k))!=null?i:this}set fullscreenElement(i){var u;this.hasAttribute(rt.FULLSCREEN_ELEMENT)&&this.removeAttribute(rt.FULLSCREEN_ELEMENT),Ka(this,k,i),(u=gr(this,x))==null||u.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return Nr(this,rt.DEFAULT_SUBTITLES)}set defaultSubtitles(i){Vr(this,rt.DEFAULT_SUBTITLES,i)}get defaultStreamType(){return di(this,rt.DEFAULT_STREAM_TYPE)}set defaultStreamType(i){qr(this,rt.DEFAULT_STREAM_TYPE,i)}get defaultDuration(){return ui(this,rt.DEFAULT_DURATION)}set defaultDuration(i){Li(this,rt.DEFAULT_DURATION,i)}get noHotkeys(){return Nr(this,rt.NO_HOTKEYS)}set noHotkeys(i){Vr(this,rt.NO_HOTKEYS,i)}get keysUsed(){return di(this,rt.KEYS_USED)}set keysUsed(i){qr(this,rt.KEYS_USED,i)}get liveEdgeOffset(){return ui(this,rt.LIVE_EDGE_OFFSET)}set liveEdgeOffset(i){Li(this,rt.LIVE_EDGE_OFFSET,i)}get noAutoSeekToLive(){return Nr(this,rt.NO_AUTO_SEEK_TO_LIVE)}set noAutoSeekToLive(i){Vr(this,rt.NO_AUTO_SEEK_TO_LIVE,i)}get noVolumePref(){return Nr(this,rt.NO_VOLUME_PREF)}set noVolumePref(i){Vr(this,rt.NO_VOLUME_PREF,i)}get noMutedPref(){return Nr(this,rt.NO_MUTED_PREF)}set noMutedPref(i){Vr(this,rt.NO_MUTED_PREF,i)}get noSubtitlesLangPref(){return Nr(this,rt.NO_SUBTITLES_LANG_PREF)}set noSubtitlesLangPref(i){Vr(this,rt.NO_SUBTITLES_LANG_PREF,i)}get noDefaultStore(){return Nr(this,rt.NO_DEFAULT_STORE)}set noDefaultStore(i){Vr(this,rt.NO_DEFAULT_STORE,i)}attributeChangedCallback(i,u,h){var E,R,G,ee,ge,_t,It,Er,ar,nr,rr,Mr;if(super.attributeChangedCallback(i,u,h),i===rt.NO_HOTKEYS)h!==u&&h===""?(this.hasAttribute(rt.HOTKEYS)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):h!==u&&h===null&&this.enableHotkeys();else if(i===rt.HOTKEYS)gr(this,A).value=h;else if(i===rt.DEFAULT_SUBTITLES&&h!==u)(E=gr(this,x))==null||E.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(rt.DEFAULT_SUBTITLES)}});else if(i===rt.DEFAULT_STREAM_TYPE)(G=gr(this,x))==null||G.dispatch({type:"optionschangerequest",detail:{defaultStreamType:(R=this.getAttribute(rt.DEFAULT_STREAM_TYPE))!=null?R:void 0}});else if(i===rt.LIVE_EDGE_OFFSET)(ee=gr(this,x))==null||ee.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(rt.LIVE_EDGE_OFFSET)?+this.getAttribute(rt.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(rt.SEEK_TO_LIVE_OFFSET)?void 0:+this.getAttribute(rt.LIVE_EDGE_OFFSET)}});else if(i===rt.SEEK_TO_LIVE_OFFSET)(ge=gr(this,x))==null||ge.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(rt.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(rt.SEEK_TO_LIVE_OFFSET):void 0}});else if(i===rt.NO_AUTO_SEEK_TO_LIVE)(_t=gr(this,x))==null||_t.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(rt.NO_AUTO_SEEK_TO_LIVE)}});else if(i===rt.FULLSCREEN_ELEMENT){let Zr=h?(It=this.getRootNode())==null?void 0:It.getElementById(h):void 0;Ka(this,k,Zr),(Er=gr(this,x))==null||Er.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}else i===rt.LANG&&h!==u?(fe(h),(ar=gr(this,x))==null||ar.dispatch({type:"optionschangerequest",detail:{mediaLang:h}})):i===rt.LOOP&&h!==u?(nr=gr(this,x))==null||nr.dispatch({type:Te.MEDIA_LOOP_REQUEST,detail:h!=null}):i===rt.NO_VOLUME_PREF&&h!==u?(rr=gr(this,x))==null||rr.dispatch({type:"optionschangerequest",detail:{noVolumePref:this.hasAttribute(rt.NO_VOLUME_PREF)}}):i===rt.NO_MUTED_PREF&&h!==u&&((Mr=gr(this,x))==null||Mr.dispatch({type:"optionschangerequest",detail:{noMutedPref:this.hasAttribute(rt.NO_MUTED_PREF)}}))}connectedCallback(){var i,u;!gr(this,x)&&!this.hasAttribute(rt.NO_DEFAULT_STORE)&&I(this,tt,Mt).call(this),(i=gr(this,x))==null||i.dispatch({type:"documentelementchangerequest",detail:er}),super.connectedCallback(),gr(this,x)&&!gr(this,$)&&Ka(this,$,(u=gr(this,x))==null?void 0:u.subscribe(gr(this,z))),gr(this,Ve)!==void 0&&gr(this,x)&&this.media&&setTimeout(()=>{var h,E,R;(E=(h=this.media)==null?void 0:h.textTracks)!=null&&E.length&&((R=gr(this,x))==null||R.dispatch({type:Te.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:gr(this,Ve)}))},0),this.hasAttribute(rt.NO_HOTKEYS)?this.disableHotkeys():this.enableHotkeys()}disconnectedCallback(){var i,u,h,E,R;if((i=super.disconnectedCallback)==null||i.call(this),gr(this,x)){let G=gr(this,x).getState();Ka(this,Ve,!!((u=G.mediaSubtitlesShowing)!=null&&u.length)),(h=gr(this,x))==null||h.dispatch({type:"documentelementchangerequest",detail:void 0}),(E=gr(this,x))==null||E.dispatch({type:Te.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})}gr(this,$)&&((R=gr(this,$))==null||R.call(this),Ka(this,$,void 0))}mediaSetCallback(i){var u;super.mediaSetCallback(i),(u=gr(this,x))==null||u.dispatch({type:"mediaelementchangerequest",detail:i}),i.hasAttribute("tabindex")||(i.tabIndex=-1)}mediaUnsetCallback(i){var u;super.mediaUnsetCallback(i),(u=gr(this,x))==null||u.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(i,u){Ls(this.mediaStateReceivers,i,u)}associateElement(i){if(!i)return;let{associatedElementSubscriptions:u}=this;if(u.has(i))return;let h=this.registerMediaStateReceiver.bind(this),E=this.unregisterMediaStateReceiver.bind(this),R=mo(i,h,E);Object.values(Te).forEach(G=>{i.addEventListener(G,gr(this,Fe))}),u.set(i,R)}unassociateElement(i){if(!i)return;let{associatedElementSubscriptions:u}=this;u.has(i)&&(u.get(i)(),u.delete(i),Object.values(Te).forEach(h=>{i.removeEventListener(h,gr(this,Fe))}))}registerMediaStateReceiver(i){if(!i)return;let u=this.mediaStateReceivers;u.indexOf(i)>-1||(u.push(i),gr(this,x)&&Object.entries(gr(this,x).getState()).forEach(([h,E])=>{Ls([i],h,E)}))}unregisterMediaStateReceiver(i){let u=this.mediaStateReceivers,h=u.indexOf(i);h<0||u.splice(h,1)}enableHotkeys(){this.addEventListener("keydown",I(this,Ue,bt))}disableHotkeys(){this.removeEventListener("keydown",I(this,Ue,bt)),this.removeEventListener("keyup",I(this,Gt,et))}get hotkeys(){return di(this,rt.HOTKEYS)}set hotkeys(i){qr(this,rt.HOTKEYS,i)}keyboardShortcutHandler(i){var u,h,E,R,G,ee,ge,_t,It;let Er=i.target;if(((E=(h=(u=Er.getAttribute(rt.KEYS_USED))==null?void 0:u.split(" "))!=null?h:Er==null?void 0:Er.keysUsed)!=null?E:[]).map(Mr=>Mr==="Space"?" ":Mr).filter(Boolean).includes(i.key))return;let ar,nr,rr;if(!(gr(this,A).contains(`no${i.key.toLowerCase()}`)||i.key===" "&&gr(this,A).contains("nospace")||i.shiftKey&&(i.key==="/"||i.key==="?")&&gr(this,A).contains("noshift+/")))switch(i.key){case" ":case"k":ar=gr(this,x).getState().mediaPaused?Te.MEDIA_PLAY_REQUEST:Te.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new ie.CustomEvent(ar,{composed:!0,bubbles:!0}));break;case"m":ar=this.mediaStore.getState().mediaVolumeLevel==="off"?Te.MEDIA_UNMUTE_REQUEST:Te.MEDIA_MUTE_REQUEST,this.dispatchEvent(new ie.CustomEvent(ar,{composed:!0,bubbles:!0}));break;case"f":ar=this.mediaStore.getState().mediaIsFullscreen?Te.MEDIA_EXIT_FULLSCREEN_REQUEST:Te.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new ie.CustomEvent(ar,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new ie.CustomEvent(Te.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":case"j":{let Mr=this.hasAttribute(rt.KEYBOARD_BACKWARD_SEEK_OFFSET)?+this.getAttribute(rt.KEYBOARD_BACKWARD_SEEK_OFFSET):$t;nr=Math.max(((R=this.mediaStore.getState().mediaCurrentTime)!=null?R:0)-Mr,0),rr=new ie.CustomEvent(Te.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:nr}),this.dispatchEvent(rr);break}case"ArrowRight":case"l":{let Mr=this.hasAttribute(rt.KEYBOARD_FORWARD_SEEK_OFFSET)?+this.getAttribute(rt.KEYBOARD_FORWARD_SEEK_OFFSET):$t;nr=Math.max(((G=this.mediaStore.getState().mediaCurrentTime)!=null?G:0)+Mr,0),rr=new ie.CustomEvent(Te.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:nr}),this.dispatchEvent(rr);break}case"ArrowUp":{let Mr=this.hasAttribute(rt.KEYBOARD_UP_VOLUME_STEP)?+this.getAttribute(rt.KEYBOARD_UP_VOLUME_STEP):Ot;nr=Math.min(((ee=this.mediaStore.getState().mediaVolume)!=null?ee:1)+Mr,1),rr=new ie.CustomEvent(Te.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:nr}),this.dispatchEvent(rr);break}case"ArrowDown":{let Mr=this.hasAttribute(rt.KEYBOARD_DOWN_VOLUME_STEP)?+this.getAttribute(rt.KEYBOARD_DOWN_VOLUME_STEP):Ot;nr=Math.max(((ge=this.mediaStore.getState().mediaVolume)!=null?ge:1)-Mr,0),rr=new ie.CustomEvent(Te.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:nr}),this.dispatchEvent(rr);break}case"<":{let Mr=(_t=this.mediaStore.getState().mediaPlaybackRate)!=null?_t:1;nr=Math.max(Mr-St,Sr).toFixed(2),rr=new ie.CustomEvent(Te.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:nr}),this.dispatchEvent(rr);break}case">":{let Mr=(It=this.mediaStore.getState().mediaPlaybackRate)!=null?It:1;nr=Math.min(Mr+St,kr).toFixed(2),rr=new ie.CustomEvent(Te.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:nr}),this.dispatchEvent(rr);break}case"/":case"?":{i.shiftKey&&I(this,tr,Kt).call(this);break}case"p":{ar=this.mediaStore.getState().mediaIsPip?Te.MEDIA_EXIT_PIP_REQUEST:Te.MEDIA_ENTER_PIP_REQUEST,rr=new ie.CustomEvent(ar,{composed:!0,bubbles:!0}),this.dispatchEvent(rr);break}default:break}}};A=new WeakMap,k=new WeakMap,x=new WeakMap,D=new WeakMap,z=new WeakMap,$=new WeakMap,Fe=new WeakMap,Ve=new WeakMap,tt=new WeakSet,Mt=function(){var i;this.mediaStore=vo({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(rt.DEFAULT_SUBTITLES),defaultDuration:this.hasAttribute(rt.DEFAULT_DURATION)?+this.getAttribute(rt.DEFAULT_DURATION):void 0,defaultStreamType:(i=this.getAttribute(rt.DEFAULT_STREAM_TYPE))!=null?i:void 0,liveEdgeOffset:this.hasAttribute(rt.LIVE_EDGE_OFFSET)?+this.getAttribute(rt.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(rt.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(rt.SEEK_TO_LIVE_OFFSET):this.hasAttribute(rt.LIVE_EDGE_OFFSET)?+this.getAttribute(rt.LIVE_EDGE_OFFSET):void 0,noAutoSeekToLive:this.hasAttribute(rt.NO_AUTO_SEEK_TO_LIVE),noVolumePref:this.hasAttribute(rt.NO_VOLUME_PREF),noMutedPref:this.hasAttribute(rt.NO_MUTED_PREF),noSubtitlesLangPref:this.hasAttribute(rt.NO_SUBTITLES_LANG_PREF)}})},Gt=new WeakSet,et=function(i){let{key:u,shiftKey:h}=i;if(!(h&&(u==="/"||u==="?")||Or.includes(u))){this.removeEventListener("keyup",I(this,Gt,et));return}this.keyboardShortcutHandler(i)},Ue=new WeakSet,bt=function(i){var u;let{metaKey:h,altKey:E,key:R,shiftKey:G}=i,ee=G&&(R==="/"||R==="?");if(ee&&(u=gr(this,D))!=null&&u.open){this.removeEventListener("keyup",I(this,Gt,et));return}if(h||E||!ee&&!Or.includes(R)){this.removeEventListener("keyup",I(this,Gt,et));return}let ge=i.target,_t=ge instanceof HTMLElement&&(ge.tagName.toLowerCase()==="media-volume-range"||ge.tagName.toLowerCase()==="media-time-range");[" ","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(R)&&!(gr(this,A).contains(`no${R.toLowerCase()}`)||R===" "&&gr(this,A).contains("nospace"))&&!_t&&i.preventDefault(),this.addEventListener("keyup",I(this,Gt,et),{once:!0})},tr=new WeakSet,Kt=function(){gr(this,D)||(Ka(this,D,er.createElement("media-keyboard-shortcuts-dialog")),this.appendChild(gr(this,D))),gr(this,D).open=!0};var Ni=Object.values(V),Vi=Object.values(xt),ii=i=>{var u,h,E,R;let{observedAttributes:G}=i.constructor;!G&&(u=i.nodeName)!=null&&u.includes("-")&&(ie.customElements.upgrade(i),{observedAttributes:G}=i.constructor);let ee=(R=(E=(h=i==null?void 0:i.getAttribute)==null?void 0:h.call(i,we.MEDIA_CHROME_ATTRIBUTES))==null?void 0:E.split)==null?void 0:R.call(E,/\s+/);return Array.isArray(G||ee)?(G||ee).filter(ge=>Ni.includes(ge)):[]},oi=i=>{var u,h;return(u=i.nodeName)!=null&&u.includes("-")&&ie.customElements.get((h=i.nodeName)==null?void 0:h.toLowerCase())&&!(i instanceof ie.customElements.get(i.nodeName.toLowerCase()))&&ie.customElements.upgrade(i),Vi.some(E=>E in i)},Dn=i=>oi(i)||!!ii(i).length,As=i=>{var u;return(u=i==null?void 0:i.join)==null?void 0:u.call(i,":")},en={[V.MEDIA_SUBTITLES_LIST]:le,[V.MEDIA_SUBTITLES_SHOWING]:le,[V.MEDIA_SEEKABLE]:As,[V.MEDIA_BUFFERED]:i=>i==null?void 0:i.map(As).join(" "),[V.MEDIA_PREVIEW_COORDS]:i=>i==null?void 0:i.join(" "),[V.MEDIA_RENDITION_LIST]:zr,[V.MEDIA_AUDIO_TRACK_LIST]:te},la=(i,u,h)=>j(this,null,function*(){var E,R;if(i.isConnected||(yield Zt(0)),typeof h=="boolean"||h==null)return Vr(i,u,h);if(typeof h=="number")return Li(i,u,h);if(typeof h=="string")return qr(i,u,h);if(Array.isArray(h)&&!h.length)return i.removeAttribute(u);let G=(R=(E=en[u])==null?void 0:E.call(en,h))!=null?R:h;return i.setAttribute(u,G)}),Ss=i=>{var u;return!!((u=i.closest)!=null&&u.call(i,'*[slot="media"]'))},gn=(i,u)=>{if(Ss(i))return;let h=(R,G)=>{var ee,ge;Dn(R)&&G(R);let{children:_t=[]}=R!=null?R:{},It=(ge=(ee=R==null?void 0:R.shadowRoot)==null?void 0:ee.children)!=null?ge:[];[..._t,...It].forEach(Er=>gn(Er,G))},E=i==null?void 0:i.nodeName.toLowerCase();if(E.includes("-")&&!Dn(i)){ie.customElements.whenDefined(E).then(()=>{h(i,u)});return}h(i,u)},Ls=(i,u,h)=>{i.forEach(E=>{if(u in E){E[u]=h;return}let R=ii(E),G=u.toLowerCase();R.includes(G)&&la(E,G,h)})},mo=(i,u,h)=>{gn(i,u);let E=It=>{var Er;let ar=(Er=It==null?void 0:It.composedPath()[0])!=null?Er:It.target;u(ar)},R=It=>{var Er;let ar=(Er=It==null?void 0:It.composedPath()[0])!=null?Er:It.target;h(ar)};i.addEventListener(Te.REGISTER_MEDIA_STATE_RECEIVER,E),i.addEventListener(Te.UNREGISTER_MEDIA_STATE_RECEIVER,R);let G=It=>{It.forEach(Er=>{let{addedNodes:ar=[],removedNodes:nr=[],type:rr,target:Mr,attributeName:Zr}=Er;rr==="childList"?(Array.prototype.forEach.call(ar,mi=>gn(mi,u)),Array.prototype.forEach.call(nr,mi=>gn(mi,h))):rr==="attributes"&&Zr===we.MEDIA_CHROME_ATTRIBUTES&&(Dn(Mr)?u(Mr):h(Mr))})},ee=[],ge=It=>{let Er=It.target;Er.name!=="media"&&(ee.forEach(ar=>gn(ar,h)),ee=[...Er.assignedElements({flatten:!0})],ee.forEach(ar=>gn(ar,u)))};i.addEventListener("slotchange",ge);let _t=new MutationObserver(G);return _t.observe(i,{childList:!0,attributes:!0,subtree:!0}),()=>{gn(i,h),i.removeEventListener("slotchange",ge),_t.disconnect(),i.removeEventListener(Te.REGISTER_MEDIA_STATE_RECEIVER,E),i.removeEventListener(Te.UNREGISTER_MEDIA_STATE_RECEIVER,R)}};ie.customElements.get("media-controller")||ie.customElements.define("media-controller",ri);var tn=ri,vi={PLACEMENT:"placement",BOUNDS:"bounds"};function El(i){return`
    <style>
      :host {
        --_tooltip-background-color: var(--media-tooltip-background-color, var(--media-secondary-color, rgba(20, 20, 30, .7)));
        --_tooltip-background: var(--media-tooltip-background, var(--_tooltip-background-color));
        --_tooltip-arrow-half-width: calc(var(--media-tooltip-arrow-width, 12px) / 2);
        --_tooltip-arrow-height: var(--media-tooltip-arrow-height, 5px);
        --_tooltip-arrow-background: var(--media-tooltip-arrow-color, var(--_tooltip-background-color));
        position: relative;
        pointer-events: none;
        display: var(--media-tooltip-display, inline-flex);
        justify-content: center;
        align-items: center;
        box-sizing: border-box;
        z-index: var(--media-tooltip-z-index, 1);
        background: var(--_tooltip-background);
        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
        font: var(--media-font,
          var(--media-font-weight, 400)
          var(--media-font-size, 13px) /
          var(--media-text-content-height, var(--media-control-height, 18px))
          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
        padding: var(--media-tooltip-padding, .35em .7em);
        border: var(--media-tooltip-border, none);
        border-radius: var(--media-tooltip-border-radius, 5px);
        filter: var(--media-tooltip-filter, drop-shadow(0 0 4px rgba(0, 0, 0, .2)));
        white-space: var(--media-tooltip-white-space, nowrap);
      }

      :host([hidden]) {
        display: none;
      }

      img, svg {
        display: inline-block;
      }

      #arrow {
        position: absolute;
        width: 0px;
        height: 0px;
        border-style: solid;
        display: var(--media-tooltip-arrow-display, block);
      }

      :host(:not([placement])),
      :host([placement="top"]) {
        position: absolute;
        bottom: calc(100% + var(--media-tooltip-distance, 12px));
        left: 50%;
        transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0);
      }
      :host(:not([placement])) #arrow,
      :host([placement="top"]) #arrow {
        top: 100%;
        left: 50%;
        border-width: var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width);
        border-color: var(--_tooltip-arrow-background) transparent transparent transparent;
        transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0);
      }

      :host([placement="right"]) {
        position: absolute;
        left: calc(100% + var(--media-tooltip-distance, 12px));
        top: 50%;
        transform: translate(0, -50%);
      }
      :host([placement="right"]) #arrow {
        top: 50%;
        right: 100%;
        border-width: var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0;
        border-color: transparent var(--_tooltip-arrow-background) transparent transparent;
        transform: translate(0, -50%);
      }

      :host([placement="bottom"]) {
        position: absolute;
        top: calc(100% + var(--media-tooltip-distance, 12px));
        left: 50%;
        transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0);
      }
      :host([placement="bottom"]) #arrow {
        bottom: 100%;
        left: 50%;
        border-width: 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width);
        border-color: transparent transparent var(--_tooltip-arrow-background) transparent;
        transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0);
      }

      :host([placement="left"]) {
        position: absolute;
        right: calc(100% + var(--media-tooltip-distance, 12px));
        top: 50%;
        transform: translate(0, -50%);
      }
      :host([placement="left"]) #arrow {
        top: 50%;
        left: 100%;
        border-width: var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height);
        border-color: transparent transparent transparent var(--_tooltip-arrow-background);
        transform: translate(0, -50%);
      }
      
      :host([placement="none"]) #arrow {
        display: none;
      }
    </style>
    <slot></slot>
    <div id="arrow"></div>
  `}var po=class extends ie.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var i;if(!dn(this,{checkOpacity:!1,checkVisibilityCSS:!1}))return;let u=this.placement;if(u==="left"||u==="right"){this.style.removeProperty("--media-tooltip-offset-x");return}let h=getComputedStyle(this),E=(i=ma(this,"#"+this.bounds))!=null?i:Yr(this);if(!E)return;let{x:R,width:G}=E.getBoundingClientRect(),{x:ee,width:ge}=this.getBoundingClientRect(),_t=ee+ge,It=R+G,Er=h.getPropertyValue("--media-tooltip-offset-x"),ar=Er?parseFloat(Er.replace("px","")):0,nr=h.getPropertyValue("--media-tooltip-container-margin"),rr=nr?parseFloat(nr.replace("px","")):0,Mr=ee-R+ar-rr,Zr=_t-It+ar+rr;if(Mr<0){this.style.setProperty("--media-tooltip-offset-x",`${Mr}px`);return}if(Zr>0){this.style.setProperty("--media-tooltip-offset-x",`${Zr}px`);return}this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Jr(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i)}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){let i=this.placement;delete this.placement,this.placement=i}}static get observedAttributes(){return[vi.PLACEMENT,vi.BOUNDS]}get placement(){return di(this,vi.PLACEMENT)}set placement(i){qr(this,vi.PLACEMENT,i)}get bounds(){return di(this,vi.BOUNDS)}set bounds(i){qr(this,vi.BOUNDS,i)}};po.shadowRootOptions={mode:"open"},po.getTemplateHTML=El,ie.customElements.get("media-tooltip")||ie.customElements.define("media-tooltip",po);var Po=po,go=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},ta=(i,u,h)=>(go(i,u,"read from private field"),h?h.call(i):u.get(i)),ks=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},Eo=(i,u,h,E)=>(go(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),yl=(i,u,h)=>(go(i,u,"access private method"),h),Wa,ds,Nn,Is,js,Oo,Pd,Rs={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function bl(i,u={}){return`
    <style>
      :host {
        position: relative;
        font: var(--media-font,
          var(--media-font-weight, bold)
          var(--media-font-size, 14px) /
          var(--media-text-content-height, var(--media-control-height, 24px))
          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
        background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
        padding: var(--media-button-padding, var(--media-control-padding, 10px));
        justify-content: var(--media-button-justify-content, center);
        display: inline-flex;
        align-items: center;
        vertical-align: middle;
        box-sizing: border-box;
        transition: background .15s linear;
        pointer-events: auto;
        cursor: var(--media-cursor, pointer);
        -webkit-tap-highlight-color: transparent;
      }

      
      :host(:focus-visible) {
        box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));
        outline: 0;
      }
      
      :host(:where(:focus)) {
        box-shadow: none;
        outline: 0;
      }

      :host(:hover) {
        background: var(--media-control-hover-background, rgba(50 50 70 / .7));
      }

      svg, img, ::slotted(svg), ::slotted(img) {
        width: var(--media-button-icon-width);
        height: var(--media-button-icon-height, var(--media-control-height, 24px));
        transform: var(--media-button-icon-transform);
        transition: var(--media-button-icon-transition);
        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
        vertical-align: middle;
        max-width: 100%;
        max-height: 100%;
        min-width: 100%;
      }

      media-tooltip {
        
        max-width: 0;
        overflow-x: clip;
        opacity: 0;
        transition: opacity .3s, max-width 0s 9s;
      }

      :host(:hover) media-tooltip,
      :host(:focus-visible) media-tooltip {
        max-width: 100vw;
        opacity: 1;
        transition: opacity .3s;
      }

      :host([notooltip]) slot[name="tooltip"] {
        display: none;
      }
    </style>

    ${this.getSlotTemplateHTML(i,u)}

    <slot name="tooltip">
      <media-tooltip part="tooltip" aria-hidden="true">
        <template shadowrootmode="${Po.shadowRootOptions.mode}">
          ${Po.getTemplateHTML({})}
        </template>
        <slot name="tooltip-content">
          ${this.getTooltipContentHTML(i)}
        </slot>
      </media-tooltip>
    </slot>
  `}function Cc(i,u){return`
    <slot></slot>
  `}function Qu(){return""}var ra=class extends ie.HTMLElement{constructor(){if(super(),ks(this,Oo),ks(this,Wa,void 0),this.preventClick=!1,this.tooltipEl=null,ks(this,ds,i=>{this.preventClick||this.handleClick(i),setTimeout(ta(this,Nn),0)}),ks(this,Nn,()=>{var i,u;(u=(i=this.tooltipEl)==null?void 0:i.updateXOffset)==null||u.call(i)}),ks(this,Is,i=>{let{key:u}=i;if(!this.keysUsed.includes(u)){this.removeEventListener("keyup",ta(this,Is));return}this.preventClick||this.handleClick(i)}),ks(this,js,i=>{let{metaKey:u,altKey:h,key:E}=i;if(u||h||!this.keysUsed.includes(E)){this.removeEventListener("keyup",ta(this,Is));return}this.addEventListener("keyup",ta(this,Is),{once:!0})}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Jr(this.attributes),u=this.constructor.getTemplateHTML(i);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(u):this.shadowRoot.innerHTML=u}this.tooltipEl=this.shadowRoot.querySelector("media-tooltip")}static get observedAttributes(){return["disabled",Rs.TOOLTIP_PLACEMENT,we.MEDIA_CONTROLLER,V.MEDIA_LANG]}enable(){this.addEventListener("click",ta(this,ds)),this.addEventListener("keydown",ta(this,js)),this.tabIndex=0}disable(){this.removeEventListener("click",ta(this,ds)),this.removeEventListener("keydown",ta(this,js)),this.removeEventListener("keyup",ta(this,Is)),this.tabIndex=-1}attributeChangedCallback(i,u,h){var E,R,G,ee,ge;i===we.MEDIA_CONTROLLER?(u&&((R=(E=ta(this,Wa))==null?void 0:E.unassociateElement)==null||R.call(E,this),Eo(this,Wa,null)),h&&this.isConnected&&(Eo(this,Wa,(G=this.getRootNode())==null?void 0:G.getElementById(h)),(ge=(ee=ta(this,Wa))==null?void 0:ee.associateElement)==null||ge.call(ee,this))):i==="disabled"&&h!==u?h==null?this.enable():this.disable():i===Rs.TOOLTIP_PLACEMENT&&this.tooltipEl&&h!==u?this.tooltipEl.placement=h:i===V.MEDIA_LANG&&(this.shadowRoot.querySelector('slot[name="tooltip-content"]').innerHTML=this.constructor.getTooltipContentHTML()),ta(this,Nn).call(this)}connectedCallback(){var i,u,h;let{style:E}=Si(this.shadowRoot,":host");E.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),this.hasAttribute("disabled")?this.disable():this.enable(),this.setAttribute("role","button");let R=this.getAttribute(we.MEDIA_CONTROLLER);R&&(Eo(this,Wa,(i=this.getRootNode())==null?void 0:i.getElementById(R)),(h=(u=ta(this,Wa))==null?void 0:u.associateElement)==null||h.call(u,this)),ie.customElements.whenDefined("media-tooltip").then(()=>yl(this,Oo,Pd).call(this))}disconnectedCallback(){var i,u;this.disable(),(u=(i=ta(this,Wa))==null?void 0:i.unassociateElement)==null||u.call(i,this),Eo(this,Wa,null),this.removeEventListener("mouseenter",ta(this,Nn)),this.removeEventListener("focus",ta(this,Nn)),this.removeEventListener("click",ta(this,ds))}get keysUsed(){return["Enter"," "]}get tooltipPlacement(){return di(this,Rs.TOOLTIP_PLACEMENT)}set tooltipPlacement(i){qr(this,Rs.TOOLTIP_PLACEMENT,i)}get mediaController(){return di(this,we.MEDIA_CONTROLLER)}set mediaController(i){qr(this,we.MEDIA_CONTROLLER,i)}get disabled(){return Nr(this,Rs.DISABLED)}set disabled(i){Vr(this,Rs.DISABLED,i)}get noTooltip(){return Nr(this,Rs.NO_TOOLTIP)}set noTooltip(i){Vr(this,Rs.NO_TOOLTIP,i)}handleClick(i){}};Wa=new WeakMap,ds=new WeakMap,Nn=new WeakMap,Is=new WeakMap,js=new WeakMap,Oo=new WeakSet,Pd=function(){this.addEventListener("mouseenter",ta(this,Nn)),this.addEventListener("focus",ta(this,Nn)),this.addEventListener("click",ta(this,ds));let i=this.tooltipPlacement;i&&this.tooltipEl&&(this.tooltipEl.placement=i)},ra.shadowRootOptions={mode:"open"},ra.getTemplateHTML=bl,ra.getSlotTemplateHTML=Cc,ra.getTooltipContentHTML=Qu,ie.customElements.get("media-chrome-button")||ie.customElements.define("media-chrome-button",ra);var Od=`<svg aria-hidden="true" viewBox="0 0 26 24">
  <path d="M22.13 3H3.87a.87.87 0 0 0-.87.87v13.26a.87.87 0 0 0 .87.87h3.4L9 16H5V5h16v11h-4l1.72 2h3.4a.87.87 0 0 0 .87-.87V3.87a.87.87 0 0 0-.86-.87Zm-8.75 11.44a.5.5 0 0 0-.76 0l-4.91 5.73a.5.5 0 0 0 .38.83h9.82a.501.501 0 0 0 .38-.83l-4.91-5.73Z"/>
</svg>
`;function xd(i){return`
    <style>
      :host([${V.MEDIA_IS_AIRPLAYING}]) slot[name=icon] slot:not([name=exit]) {
        display: none !important;
      }

      
      :host(:not([${V.MEDIA_IS_AIRPLAYING}])) slot[name=icon] slot:not([name=enter]) {
        display: none !important;
      }

      :host([${V.MEDIA_IS_AIRPLAYING}]) slot[name=tooltip-enter],
      :host(:not([${V.MEDIA_IS_AIRPLAYING}])) slot[name=tooltip-exit] {
        display: none;
      }
    </style>

    <slot name="icon">
      <slot name="enter">${Od}</slot>
      <slot name="exit">${Od}</slot>
    </slot>
  `}function Tl(){return`
    <slot name="tooltip-enter">${oe("start airplay")}</slot>
    <slot name="tooltip-exit">${oe("stop airplay")}</slot>
  `}var Ea=i=>{let u=i.mediaIsAirplaying?oe("stop airplay"):oe("start airplay");i.setAttribute("aria-label",u)},Ia=class extends ra{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_IS_AIRPLAYING,V.MEDIA_AIRPLAY_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),Ea(this)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_IS_AIRPLAYING&&Ea(this)}get mediaIsAirplaying(){return Nr(this,V.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(i){Vr(this,V.MEDIA_IS_AIRPLAYING,i)}get mediaAirplayUnavailable(){return di(this,V.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(i){qr(this,V.MEDIA_AIRPLAY_UNAVAILABLE,i)}handleClick(){let i=new ie.CustomEvent(Te.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(i)}};Ia.getSlotTemplateHTML=xd,Ia.getTooltipContentHTML=Tl,ie.customElements.get("media-airplay-button")||ie.customElements.define("media-airplay-button",Ia);var Dc=`<svg aria-hidden="true" viewBox="0 0 26 24">
  <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
</svg>`,nt=`<svg aria-hidden="true" viewBox="0 0 26 24">
  <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.81 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/>
</svg>`;function Xu(i){return`
    <style>
      :host([aria-checked="true"]) slot[name=off] {
        display: none !important;
      }

      
      :host(:not([aria-checked="true"])) slot[name=on] {
        display: none !important;
      }

      :host([aria-checked="true"]) slot[name=tooltip-enable],
      :host(:not([aria-checked="true"])) slot[name=tooltip-disable] {
        display: none;
      }
    </style>

    <slot name="icon">
      <slot name="on">${Dc}</slot>
      <slot name="off">${nt}</slot>
    </slot>
  `}function uu(){return`
    <slot name="tooltip-enable">${oe("Enable captions")}</slot>
    <slot name="tooltip-disable">${oe("Disable captions")}</slot>
  `}var Zu=i=>{i.setAttribute("aria-checked",wt(i).toString())},xo=class extends ra{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_SUBTITLES_LIST,V.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",oe("closed captions")),Zu(this)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_SUBTITLES_SHOWING&&Zu(this)}get mediaSubtitlesList(){return No(this,V.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(i){yo(this,V.MEDIA_SUBTITLES_LIST,i)}get mediaSubtitlesShowing(){return No(this,V.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(i){yo(this,V.MEDIA_SUBTITLES_SHOWING,i)}handleClick(){this.dispatchEvent(new ie.CustomEvent(Te.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}};xo.getSlotTemplateHTML=Xu,xo.getTooltipContentHTML=uu;var No=(i,u)=>{let h=i.getAttribute(u);return h?P(h):[]},yo=(i,u,h)=>{if(!(h!=null&&h.length)){i.removeAttribute(u);return}let E=le(h);i.getAttribute(u)!==E&&i.setAttribute(u,E)};ie.customElements.get("media-captions-button")||ie.customElements.define("media-captions-button",xo);var Uo='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/></g></svg>',zs='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/><path class="cast_caf_icon_boxfill" d="M5,7 L5,8.63 C8,8.6 13.37,14 13.37,17 L19,17 L19,7 Z"/></g></svg>';function Ju(i){return`
    <style>
      :host([${V.MEDIA_IS_CASTING}]) slot[name=icon] slot:not([name=exit]) {
        display: none !important;
      }

      
      :host(:not([${V.MEDIA_IS_CASTING}])) slot[name=icon] slot:not([name=enter]) {
        display: none !important;
      }

      :host([${V.MEDIA_IS_CASTING}]) slot[name=tooltip-enter],
      :host(:not([${V.MEDIA_IS_CASTING}])) slot[name=tooltip-exit] {
        display: none;
      }
    </style>

    <slot name="icon">
      <slot name="enter">${Uo}</slot>
      <slot name="exit">${zs}</slot>
    </slot>
  `}function Nd(){return`
    <slot name="tooltip-enter">${oe("Start casting")}</slot>
    <slot name="tooltip-exit">${oe("Stop casting")}</slot>
  `}var ed=i=>{let u=i.mediaIsCasting?oe("stop casting"):oe("start casting");i.setAttribute("aria-label",u)},Fo=class extends ra{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_IS_CASTING,V.MEDIA_CAST_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),ed(this)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_IS_CASTING&&ed(this)}get mediaIsCasting(){return Nr(this,V.MEDIA_IS_CASTING)}set mediaIsCasting(i){Vr(this,V.MEDIA_IS_CASTING,i)}get mediaCastUnavailable(){return di(this,V.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(i){qr(this,V.MEDIA_CAST_UNAVAILABLE,i)}handleClick(){let i=this.mediaIsCasting?Te.MEDIA_EXIT_CAST_REQUEST:Te.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new ie.CustomEvent(i,{composed:!0,bubbles:!0}))}};Fo.getSlotTemplateHTML=Ju,Fo.getTooltipContentHTML=Nd,ie.customElements.get("media-cast-button")||ie.customElements.define("media-cast-button",Fo);var du=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},jn=(i,u,h)=>(du(i,u,"read from private field"),h?h.call(i):u.get(i)),ws=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},td=(i,u,h,E)=>(du(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),Qs=(i,u,h)=>(du(i,u,"access private method"),h),_l,Bo,Cs,Ho,cu,Vo,rd,ua,Go,Ko,bo,Xs,Al,Ds,cs;function zn(i){return`
    <style>
      :host {
        font: var(--media-font,
          var(--media-font-weight, normal)
          var(--media-font-size, 14px) /
          var(--media-text-content-height, var(--media-control-height, 24px))
          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
        display: var(--media-dialog-display, inline-flex);
        justify-content: center;
        align-items: center;
        
        transition-behavior: allow-discrete;
        visibility: hidden;
        opacity: 0;
        transform: translateY(2px) scale(.99);
        pointer-events: none;
      }

      :host([open]) {
        transition: display .2s, visibility 0s, opacity .2s ease-out, transform .15s ease-out;
        visibility: visible;
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
      }

      #content {
        display: flex;
        position: relative;
        box-sizing: border-box;
        width: min(320px, 100%);
        word-wrap: break-word;
        max-height: 100%;
        overflow: auto;
        text-align: center;
        line-height: 1.4;
      }
    </style>
    ${this.getSlotTemplateHTML(i)}
  `}function Ud(i){return`
    <slot id="content"></slot>
  `}var Wo={OPEN:"open",ANCHOR:"anchor"},Un=class extends ie.HTMLElement{constructor(){super(),ws(this,Ho),ws(this,Vo),ws(this,ua),ws(this,Ko),ws(this,Xs),ws(this,Ds),ws(this,_l,!1),ws(this,Bo,null),ws(this,Cs,null),this.addEventListener("invoke",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}static get observedAttributes(){return[Wo.OPEN,Wo.ANCHOR]}get open(){return Nr(this,Wo.OPEN)}set open(i){Vr(this,Wo.OPEN,i)}handleEvent(i){switch(i.type){case"invoke":Qs(this,Ko,bo).call(this,i);break;case"focusout":Qs(this,Xs,Al).call(this,i);break;case"keydown":Qs(this,Ds,cs).call(this,i);break}}connectedCallback(){Qs(this,Ho,cu).call(this),this.role||(this.role="dialog")}attributeChangedCallback(i,u,h){Qs(this,Ho,cu).call(this),i===Wo.OPEN&&h!==u&&(this.open?Qs(this,Vo,rd).call(this):Qs(this,ua,Go).call(this))}focus(){td(this,Bo,Oa());let i=!this.dispatchEvent(new Event("focus",{composed:!0,cancelable:!0})),u=!this.dispatchEvent(new Event("focusin",{composed:!0,bubbles:!0,cancelable:!0}));if(i||u)return;let h=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');h==null||h.focus()}get keysUsed(){return["Escape","Tab"]}};_l=new WeakMap,Bo=new WeakMap,Cs=new WeakMap,Ho=new WeakSet,cu=function(){if(!jn(this,_l)&&(td(this,_l,!0),!this.shadowRoot)){this.attachShadow(this.constructor.shadowRootOptions);let i=Jr(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i),queueMicrotask(()=>{let{style:u}=Si(this.shadowRoot,":host");u.setProperty("transition","display .15s, visibility .15s, opacity .15s ease-in, transform .15s ease-in")})}},Vo=new WeakSet,rd=function(){var i;(i=jn(this,Cs))==null||i.setAttribute("aria-expanded","true"),this.dispatchEvent(new Event("open",{composed:!0,bubbles:!0})),this.addEventListener("transitionend",()=>this.focus(),{once:!0})},ua=new WeakSet,Go=function(){var i;(i=jn(this,Cs))==null||i.setAttribute("aria-expanded","false"),this.dispatchEvent(new Event("close",{composed:!0,bubbles:!0}))},Ko=new WeakSet,bo=function(i){td(this,Cs,i.relatedTarget),aa(this,i.relatedTarget)||(this.open=!this.open)},Xs=new WeakSet,Al=function(i){var u;aa(this,i.relatedTarget)||((u=jn(this,Bo))==null||u.focus(),jn(this,Cs)&&jn(this,Cs)!==i.relatedTarget&&this.open&&(this.open=!1))},Ds=new WeakSet,cs=function(i){var u,h,E,R,G;let{key:ee,ctrlKey:ge,altKey:_t,metaKey:It}=i;ge||_t||It||this.keysUsed.includes(ee)&&(i.preventDefault(),i.stopPropagation(),ee==="Tab"?(i.shiftKey?(h=(u=this.previousElementSibling)==null?void 0:u.focus)==null||h.call(u):(R=(E=this.nextElementSibling)==null?void 0:E.focus)==null||R.call(E),this.blur()):ee==="Escape"&&((G=jn(this,Bo))==null||G.focus(),this.open=!1))},Un.shadowRootOptions={mode:"open"},Un.getTemplateHTML=zn,Un.getSlotTemplateHTML=Ud,ie.customElements.get("media-chrome-dialog")||ie.customElements.define("media-chrome-dialog",Un);var id=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},yi=(i,u,h)=>(id(i,u,"read from private field"),h?h.call(i):u.get(i)),Ii=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},ya=(i,u,h,E)=>(id(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),ba=(i,u,h)=>(id(i,u,"access private method"),h),hs,To,Yo,Sl,Ya,$o,fs,Fn,Qn,Zs,Ll,_o,kl,Il,qo,Rl,ad,wl,hu,Js,Cl,Dl,Xn,Ao,So;function qi(i){return`
    <style>
      :host {
        --_focus-box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));
        --_media-range-padding: var(--media-range-padding, var(--media-control-padding, 10px));

        box-shadow: var(--_focus-visible-box-shadow, none);
        background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
        height: calc(var(--media-control-height, 24px) + 2 * var(--_media-range-padding));
        display: inline-flex;
        align-items: center;
        
        vertical-align: middle;
        box-sizing: border-box;
        position: relative;
        width: 100px;
        transition: background .15s linear;
        cursor: var(--media-cursor, pointer);
        pointer-events: auto;
        touch-action: none; 
      }

      
      input[type=range]:focus {
        outline: 0;
      }
      input[type=range]:focus::-webkit-slider-runnable-track {
        outline: 0;
      }

      :host(:hover) {
        background: var(--media-control-hover-background, rgb(50 50 70 / .7));
      }

      #leftgap {
        padding-left: var(--media-range-padding-left, var(--_media-range-padding));
      }

      #rightgap {
        padding-right: var(--media-range-padding-right, var(--_media-range-padding));
      }

      #startpoint,
      #endpoint {
        position: absolute;
      }

      #endpoint {
        right: 0;
      }

      #container {
        
        width: var(--media-range-track-width, 100%);
        transform: translate(var(--media-range-track-translate-x, 0px), var(--media-range-track-translate-y, 0px));
        position: relative;
        height: 100%;
        display: flex;
        align-items: center;
        min-width: 40px;
      }

      #range {
        
        display: var(--media-time-range-hover-display, block);
        bottom: var(--media-time-range-hover-bottom, -7px);
        height: var(--media-time-range-hover-height, max(100% + 7px, 25px));
        width: 100%;
        position: absolute;
        cursor: var(--media-cursor, pointer);

        -webkit-appearance: none; 
        -webkit-tap-highlight-color: transparent;
        background: transparent; 
        margin: 0;
        z-index: 1;
      }

      @media (hover: hover) {
        #range {
          bottom: var(--media-time-range-hover-bottom, -5px);
          height: var(--media-time-range-hover-height, max(100% + 5px, 20px));
        }
      }

      
      
      #range::-webkit-slider-thumb {
        -webkit-appearance: none;
        background: transparent;
        width: .1px;
        height: .1px;
      }

      
      #range::-moz-range-thumb {
        background: transparent;
        border: transparent;
        width: .1px;
        height: .1px;
      }

      #appearance {
        height: var(--media-range-track-height, 4px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 100%;
        position: absolute;
        
        will-change: transform;
      }

      #track {
        background: var(--media-range-track-background, rgb(255 255 255 / .2));
        border-radius: var(--media-range-track-border-radius, 1px);
        border: var(--media-range-track-border, none);
        outline: var(--media-range-track-outline);
        outline-offset: var(--media-range-track-outline-offset);
        backdrop-filter: var(--media-range-track-backdrop-filter);
        -webkit-backdrop-filter: var(--media-range-track-backdrop-filter);
        box-shadow: var(--media-range-track-box-shadow, none);
        position: absolute;
        width: 100%;
        height: 100%;
        overflow: hidden;
      }

      #progress,
      #pointer {
        position: absolute;
        height: 100%;
        will-change: width;
      }

      #progress {
        background: var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238)));
        transition: var(--media-range-track-transition);
      }

      #pointer {
        background: var(--media-range-track-pointer-background);
        border-right: var(--media-range-track-pointer-border-right);
        transition: visibility .25s, opacity .25s;
        visibility: hidden;
        opacity: 0;
      }

      @media (hover: hover) {
        :host(:hover) #pointer {
          transition: visibility .5s, opacity .5s;
          visibility: visible;
          opacity: 1;
        }
      }

      #thumb,
      ::slotted([slot=thumb]) {
        width: var(--media-range-thumb-width, 10px);
        height: var(--media-range-thumb-height, 10px);
        transition: var(--media-range-thumb-transition);
        transform: var(--media-range-thumb-transform, none);
        opacity: var(--media-range-thumb-opacity, 1);
        translate: -50%;
        position: absolute;
        left: 0;
        cursor: var(--media-cursor, pointer);
      }

      #thumb {
        border-radius: var(--media-range-thumb-border-radius, 10px);
        background: var(--media-range-thumb-background, var(--media-primary-color, rgb(238 238 238)));
        box-shadow: var(--media-range-thumb-box-shadow, 1px 1px 1px transparent);
        border: var(--media-range-thumb-border, none);
      }

      :host([disabled]) #thumb {
        background-color: #777;
      }

      .segments #appearance {
        height: var(--media-range-segment-hover-height, 7px);
      }

      #track {
        clip-path: url(#segments-clipping);
      }

      #segments {
        --segments-gap: var(--media-range-segments-gap, 2px);
        position: absolute;
        width: 100%;
        height: 100%;
      }

      #segments-clipping {
        transform: translateX(calc(var(--segments-gap) / 2));
      }

      #segments-clipping:empty {
        display: none;
      }

      #segments-clipping rect {
        height: var(--media-range-track-height, 4px);
        y: calc((var(--media-range-segment-hover-height, 7px) - var(--media-range-track-height, 4px)) / 2);
        transition: var(--media-range-segment-transition, transform .1s ease-in-out);
        transform: var(--media-range-segment-transform, scaleY(1));
        transform-origin: center;
      }
    </style>
    <div id="leftgap"></div>
    <div id="container">
      <div id="startpoint"></div>
      <div id="endpoint"></div>
      <div id="appearance">
        <div id="track" part="track">
          <div id="pointer"></div>
          <div id="progress" part="progress"></div>
        </div>
        <slot name="thumb">
          <div id="thumb" part="thumb"></div>
        </slot>
        <svg id="segments"><clipPath id="segments-clipping"></clipPath></svg>
      </div>
      <input id="range" type="range" min="0" max="1" step="any" value="0">

      ${this.getContainerTemplateHTML(i)}
    </div>
    <div id="rightgap"></div>
  `}function Ml(i){return""}var Zn=class extends ie.HTMLElement{constructor(){if(super(),Ii(this,Zs),Ii(this,_o),Ii(this,Il),Ii(this,Rl),Ii(this,wl),Ii(this,Js),Ii(this,Dl),Ii(this,Ao),Ii(this,hs,void 0),Ii(this,To,void 0),Ii(this,Yo,void 0),Ii(this,Sl,void 0),Ii(this,Ya,{}),Ii(this,$o,[]),Ii(this,fs,()=>{if(this.range.matches(":focus-visible")){let{style:i}=Si(this.shadowRoot,":host");i.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),Ii(this,Fn,()=>{let{style:i}=Si(this.shadowRoot,":host");i.removeProperty("--_focus-visible-box-shadow")}),Ii(this,Qn,()=>{let i=this.shadowRoot.querySelector("#segments-clipping");i&&i.parentNode.append(i)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Jr(this.attributes),u=this.constructor.getTemplateHTML(i);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(u):this.shadowRoot.innerHTML=u}this.container=this.shadowRoot.querySelector("#container"),ya(this,Yo,this.shadowRoot.querySelector("#startpoint")),ya(this,Sl,this.shadowRoot.querySelector("#endpoint")),this.range=this.shadowRoot.querySelector("#range"),this.appearance=this.shadowRoot.querySelector("#appearance")}static get observedAttributes(){return["disabled","aria-disabled",we.MEDIA_CONTROLLER]}attributeChangedCallback(i,u,h){var E,R,G,ee,ge;i===we.MEDIA_CONTROLLER?(u&&((R=(E=yi(this,hs))==null?void 0:E.unassociateElement)==null||R.call(E,this),ya(this,hs,null)),h&&this.isConnected&&(ya(this,hs,(G=this.getRootNode())==null?void 0:G.getElementById(h)),(ge=(ee=yi(this,hs))==null?void 0:ee.associateElement)==null||ge.call(ee,this))):(i==="disabled"||i==="aria-disabled"&&u!==h)&&(h==null?(this.range.removeAttribute(i),ba(this,_o,kl).call(this)):(this.range.setAttribute(i,h),ba(this,Il,qo).call(this)))}connectedCallback(){var i,u,h;let{style:E}=Si(this.shadowRoot,":host");E.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),yi(this,Ya).pointer=Si(this.shadowRoot,"#pointer"),yi(this,Ya).progress=Si(this.shadowRoot,"#progress"),yi(this,Ya).thumb=Si(this.shadowRoot,'#thumb, ::slotted([slot="thumb"])'),yi(this,Ya).activeSegment=Si(this.shadowRoot,"#segments-clipping rect:nth-child(0)");let R=this.getAttribute(we.MEDIA_CONTROLLER);R&&(ya(this,hs,(i=this.getRootNode())==null?void 0:i.getElementById(R)),(h=(u=yi(this,hs))==null?void 0:u.associateElement)==null||h.call(u,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",yi(this,fs)),this.shadowRoot.addEventListener("focusout",yi(this,Fn)),ba(this,_o,kl).call(this),pi(this.container,yi(this,Qn))}disconnectedCallback(){var i,u;ba(this,Il,qo).call(this),(u=(i=yi(this,hs))==null?void 0:i.unassociateElement)==null||u.call(i,this),ya(this,hs,null),this.shadowRoot.removeEventListener("focusin",yi(this,fs)),this.shadowRoot.removeEventListener("focusout",yi(this,Fn)),$r(this.container,yi(this,Qn))}updatePointerBar(i){var u;(u=yi(this,Ya).pointer)==null||u.style.setProperty("width",`${this.getPointerRatio(i)*100}%`)}updateBar(){var i,u;let h=this.range.valueAsNumber*100;(i=yi(this,Ya).progress)==null||i.style.setProperty("width",`${h}%`),(u=yi(this,Ya).thumb)==null||u.style.setProperty("left",`${h}%`)}updateSegments(i){let u=this.shadowRoot.querySelector("#segments-clipping");if(u.textContent="",this.container.classList.toggle("segments",!!(i!=null&&i.length)),!(i!=null&&i.length))return;let h=[...new Set([+this.range.min,...i.flatMap(R=>[R.start,R.end]),+this.range.max])];ya(this,$o,[...h]);let E=h.pop();for(let[R,G]of h.entries()){let[ee,ge]=[R===0,R===h.length-1],_t=ee?"calc(var(--segments-gap) / -1)":`${G*100}%`,It=`calc(${((ge?E:h[R+1])-G)*100}%${ee||ge?"":" - var(--segments-gap)"})`,Er=er.createElementNS("http://www.w3.org/2000/svg","rect"),ar=cn(this.shadowRoot,`#segments-clipping rect:nth-child(${R+1})`);ar.style.setProperty("x",_t),ar.style.setProperty("width",It),u.append(Er)}}getPointerRatio(i){return Qa(i.clientX,i.clientY,yi(this,Yo).getBoundingClientRect(),yi(this,Sl).getBoundingClientRect())}get dragging(){return this.hasAttribute("dragging")}handleEvent(i){switch(i.type){case"pointermove":ba(this,Ao,So).call(this,i);break;case"input":this.updateBar();break;case"pointerenter":ba(this,wl,hu).call(this,i);break;case"pointerdown":ba(this,Rl,ad).call(this,i);break;case"pointerup":ba(this,Js,Cl).call(this);break;case"pointerleave":ba(this,Dl,Xn).call(this);break}}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}};hs=new WeakMap,To=new WeakMap,Yo=new WeakMap,Sl=new WeakMap,Ya=new WeakMap,$o=new WeakMap,fs=new WeakMap,Fn=new WeakMap,Qn=new WeakMap,Zs=new WeakSet,Ll=function(i){let u=yi(this,Ya).activeSegment;if(!u)return;let h=this.getPointerRatio(i),E=`#segments-clipping rect:nth-child(${yi(this,$o).findIndex((R,G,ee)=>{let ge=ee[G+1];return ge!=null&&h>=R&&h<=ge})+1})`;(u.selectorText!=E||!u.style.transform)&&(u.selectorText=E,u.style.setProperty("transform","var(--media-range-segment-hover-transform, scaleY(2))"))},_o=new WeakSet,kl=function(){this.hasAttribute("disabled")||(this.addEventListener("input",this),this.addEventListener("pointerdown",this),this.addEventListener("pointerenter",this))},Il=new WeakSet,qo=function(){var i,u;this.removeEventListener("input",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointerenter",this),(i=ie.window)==null||i.removeEventListener("pointerup",this),(u=ie.window)==null||u.removeEventListener("pointermove",this)},Rl=new WeakSet,ad=function(i){var u;ya(this,To,i.composedPath().includes(this.range)),(u=ie.window)==null||u.addEventListener("pointerup",this)},wl=new WeakSet,hu=function(i){var u;i.pointerType!=="mouse"&&ba(this,Rl,ad).call(this,i),this.addEventListener("pointerleave",this),(u=ie.window)==null||u.addEventListener("pointermove",this)},Js=new WeakSet,Cl=function(){var i;(i=ie.window)==null||i.removeEventListener("pointerup",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled")},Dl=new WeakSet,Xn=function(){var i,u;this.removeEventListener("pointerleave",this),(i=ie.window)==null||i.removeEventListener("pointermove",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled"),(u=yi(this,Ya).activeSegment)==null||u.style.removeProperty("transform")},Ao=new WeakSet,So=function(i){i.pointerType==="pen"&&i.buttons===0||(this.toggleAttribute("dragging",i.buttons===1||i.pointerType!=="mouse"),this.updatePointerBar(i),ba(this,Zs,Ll).call(this,i),this.dragging&&(i.pointerType!=="mouse"||!yi(this,To))&&(this.range.disabled=!0,this.range.valueAsNumber=this.getPointerRatio(i),this.range.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))))},Zn.shadowRootOptions={mode:"open"},Zn.getTemplateHTML=qi,Zn.getContainerTemplateHTML=Ml,ie.customElements.get("media-chrome-range")||ie.customElements.define("media-chrome-range",Zn);var fu=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},vu=(i,u,h)=>(fu(i,u,"read from private field"),h?h.call(i):u.get(i)),nd=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},jo=(i,u,h,E)=>(fu(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),rn;function sd(i){return`
    <style>
      :host {
        
        box-sizing: border-box;
        display: var(--media-control-display, var(--media-control-bar-display, inline-flex));
        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
        --media-loading-indicator-icon-height: 44px;
      }

      ::slotted(media-time-range),
      ::slotted(media-volume-range) {
        min-height: 100%;
      }

      ::slotted(media-time-range),
      ::slotted(media-clip-selector) {
        flex-grow: 1;
      }

      ::slotted([role="menu"]) {
        position: absolute;
      }
    </style>

    <slot></slot>
  `}var Bn=class extends ie.HTMLElement{constructor(){if(super(),nd(this,rn,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Jr(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i)}}static get observedAttributes(){return[we.MEDIA_CONTROLLER]}attributeChangedCallback(i,u,h){var E,R,G,ee,ge;i===we.MEDIA_CONTROLLER&&(u&&((R=(E=vu(this,rn))==null?void 0:E.unassociateElement)==null||R.call(E,this),jo(this,rn,null)),h&&this.isConnected&&(jo(this,rn,(G=this.getRootNode())==null?void 0:G.getElementById(h)),(ge=(ee=vu(this,rn))==null?void 0:ee.associateElement)==null||ge.call(ee,this)))}connectedCallback(){var i,u,h;let E=this.getAttribute(we.MEDIA_CONTROLLER);E&&(jo(this,rn,(i=this.getRootNode())==null?void 0:i.getElementById(E)),(h=(u=vu(this,rn))==null?void 0:u.associateElement)==null||h.call(u,this))}disconnectedCallback(){var i,u;(u=(i=vu(this,rn))==null?void 0:i.unassociateElement)==null||u.call(i,this),jo(this,rn,null)}};rn=new WeakMap,Bn.shadowRootOptions={mode:"open"},Bn.getTemplateHTML=sd,ie.customElements.get("media-control-bar")||ie.customElements.define("media-control-bar",Bn);var Ui=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},En=(i,u,h)=>(Ui(i,u,"read from private field"),h?h.call(i):u.get(i)),mu=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},an=(i,u,h,E)=>(Ui(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),va;function Pl(i,u={}){return`
    <style>
      :host {
        font: var(--media-font,
          var(--media-font-weight, normal)
          var(--media-font-size, 14px) /
          var(--media-text-content-height, var(--media-control-height, 24px))
          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
        background: var(--media-text-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))));
        padding: var(--media-control-padding, 10px);
        display: inline-flex;
        justify-content: center;
        align-items: center;
        vertical-align: middle;
        box-sizing: border-box;
        text-align: center;
        pointer-events: auto;
      }

      
      :host(:focus-visible) {
        box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9);
        outline: 0;
      }

      
      :host(:where(:focus)) {
        box-shadow: none;
        outline: 0;
      }
    </style>

    ${this.getSlotTemplateHTML(i,u)}
  `}function Ol(i,u){return`
    <slot></slot>
  `}var yn=class extends ie.HTMLElement{constructor(){if(super(),mu(this,va,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Jr(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i)}}static get observedAttributes(){return[we.MEDIA_CONTROLLER]}attributeChangedCallback(i,u,h){var E,R,G,ee,ge;i===we.MEDIA_CONTROLLER&&(u&&((R=(E=En(this,va))==null?void 0:E.unassociateElement)==null||R.call(E,this),an(this,va,null)),h&&this.isConnected&&(an(this,va,(G=this.getRootNode())==null?void 0:G.getElementById(h)),(ge=(ee=En(this,va))==null?void 0:ee.associateElement)==null||ge.call(ee,this)))}connectedCallback(){var i,u,h;let{style:E}=Si(this.shadowRoot,":host");E.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`);let R=this.getAttribute(we.MEDIA_CONTROLLER);R&&(an(this,va,(i=this.getRootNode())==null?void 0:i.getElementById(R)),(h=(u=En(this,va))==null?void 0:u.associateElement)==null||h.call(u,this))}disconnectedCallback(){var i,u;(u=(i=En(this,va))==null?void 0:i.unassociateElement)==null||u.call(i,this),an(this,va,null)}};va=new WeakMap,yn.shadowRootOptions={mode:"open"},yn.getTemplateHTML=Pl,yn.getSlotTemplateHTML=Ol,ie.customElements.get("media-text-display")||ie.customElements.define("media-text-display",yn);var Lo=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},pu=(i,u,h)=>(Lo(i,u,"read from private field"),h?h.call(i):u.get(i)),Fd=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},Ms=(i,u,h,E)=>(Lo(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),Ps;function xl(i,u){return`
    <slot>${li(u.mediaDuration)}</slot>
  `}var ko=class extends yn{constructor(){var i;super(),Fd(this,Ps,void 0),Ms(this,Ps,this.shadowRoot.querySelector("slot")),pu(this,Ps).textContent=li((i=this.mediaDuration)!=null?i:0)}static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_DURATION]}attributeChangedCallback(i,u,h){i===V.MEDIA_DURATION&&(pu(this,Ps).textContent=li(+h)),super.attributeChangedCallback(i,u,h)}get mediaDuration(){return ui(this,V.MEDIA_DURATION)}set mediaDuration(i){Li(this,V.MEDIA_DURATION,i)}};Ps=new WeakMap,ko.getSlotTemplateHTML=xl,ie.customElements.get("media-duration-display")||ie.customElements.define("media-duration-display",ko);var bn={2:oe("Network Error"),3:oe("Decode Error"),4:oe("Source Not Supported"),5:oe("Encryption Error")},gu={2:oe("A network error caused the media download to fail."),3:oe("A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format."),4:oe("An unsupported error occurred. The server or network failed, or your browser does not support this format."),5:oe("The media is encrypted and there are no keys to decrypt it.")},zo=i=>{var u,h;return i.code===1?null:{title:(u=bn[i.code])!=null?u:`Error ${i.code}`,message:(h=gu[i.code])!=null?h:i.message}},Qo=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},Mc=(i,u,h)=>(Qo(i,u,"read from private field"),h?h.call(i):u.get(i)),Nl=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},Pc=(i,u,h,E)=>(Qo(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),Io;function Jn(i){return`
    <style>
      :host {
        background: rgb(20 20 30 / .8);
      }

      #content {
        display: block;
        padding: 1.2em 1.5em;
      }

      h3,
      p {
        margin-block: 0 .3em;
      }
    </style>
    <slot name="error-${i.mediaerrorcode}" id="content">
      ${Fl({code:+i.mediaerrorcode,message:i.mediaerrormessage})}
    </slot>
  `}function Ul(i){return i.code&&zo(i)!==null}function Fl(i){var u;let{title:h,message:E}=(u=zo(i))!=null?u:{},R="";return h&&(R+=`<slot name="error-${i.code}-title"><h3>${h}</h3></slot>`),E&&(R+=`<slot name="error-${i.code}-message"><p>${E}</p></slot>`),R}var Eu=[V.MEDIA_ERROR_CODE,V.MEDIA_ERROR_MESSAGE],Xo=class extends Un{constructor(){super(...arguments),Nl(this,Io,null)}static get observedAttributes(){return[...super.observedAttributes,...Eu]}formatErrorMessage(i){return this.constructor.formatErrorMessage(i)}attributeChangedCallback(i,u,h){var E;if(super.attributeChangedCallback(i,u,h),!Eu.includes(i))return;let R=(E=this.mediaError)!=null?E:{code:this.mediaErrorCode,message:this.mediaErrorMessage};this.open=Ul(R),this.open&&(this.shadowRoot.querySelector("slot").name=`error-${this.mediaErrorCode}`,this.shadowRoot.querySelector("#content").innerHTML=this.formatErrorMessage(R))}get mediaError(){return Mc(this,Io)}set mediaError(i){Pc(this,Io,i)}get mediaErrorCode(){return ui(this,"mediaerrorcode")}set mediaErrorCode(i){Li(this,"mediaerrorcode",i)}get mediaErrorMessage(){return di(this,"mediaerrormessage")}set mediaErrorMessage(i){qr(this,"mediaerrormessage",i)}};Io=new WeakMap,Xo.getSlotTemplateHTML=Jn,Xo.formatErrorMessage=Fl,ie.customElements.get("media-error-dialog")||ie.customElements.define("media-error-dialog",Xo);var p=Xo,T=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},w=(i,u,h)=>(T(i,u,"read from private field"),h?h.call(i):u.get(i)),J=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},Ae,vt;function Dt(i){return`
    <style>
      :host {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 9999;
        background: rgb(20 20 30 / .8);
        backdrop-filter: blur(10px);
      }

      #content {
        display: block;
        width: clamp(400px, 40vw, 700px);
        max-width: 90vw;
        text-align: left;
      }

      h2 {
        margin: 0 0 1.5rem 0;
        font-size: 1.5rem;
        font-weight: 500;
        text-align: center;
      }

      .shortcuts-table {
        width: 100%;
        border-collapse: collapse;
      }

      .shortcuts-table tr {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      }

      .shortcuts-table tr:last-child {
        border-bottom: none;
      }

      .shortcuts-table td {
        padding: 0.75rem 0.5rem;
      }

      .shortcuts-table td:first-child {
        text-align: right;
        padding-right: 1rem;
        width: 40%;
        min-width: 120px;
      }

      .shortcuts-table td:last-child {
        padding-left: 1rem;
      }

      .key {
        display: inline-block;
        background: rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        padding: 0.25rem 0.5rem;
        font-family: 'Courier New', monospace;
        font-size: 0.9rem;
        font-weight: 500;
        min-width: 1.5rem;
        text-align: center;
        margin: 0 0.2rem;
      }

      .description {
        color: rgba(255, 255, 255, 0.9);
        font-size: 0.95rem;
      }

      .key-combo {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 0.3rem;
      }

      .key-separator {
        color: rgba(255, 255, 255, 0.5);
        font-size: 0.9rem;
      }
    </style>
    <slot id="content">
      ${Xt()}
    </slot>
  `}function Xt(){return`
    <h2>Keyboard Shortcuts</h2>
    <table class="shortcuts-table">${[{keys:["Space","k"],description:"Toggle Playback"},{keys:["m"],description:"Toggle mute"},{keys:["f"],description:"Toggle fullscreen"},{keys:["c"],description:"Toggle captions or subtitles, if available"},{keys:["p"],description:"Toggle Picture in Picture"},{keys:["\u2190","j"],description:"Seek back 10s"},{keys:["\u2192","l"],description:"Seek forward 10s"},{keys:["\u2191"],description:"Turn volume up"},{keys:["\u2193"],description:"Turn volume down"},{keys:["< (SHIFT+,)"],description:"Decrease playback rate"},{keys:["> (SHIFT+.)"],description:"Increase playback rate"}].map(({keys:i,description:u})=>`
      <tr>
        <td>
          <div class="key-combo">${i.map((h,E)=>E>0?`<span class="key-separator">or</span><span class="key">${h}</span>`:`<span class="key">${h}</span>`).join("")}</div>
        </td>
        <td class="description">${u}</td>
      </tr>
    `).join("")}</table>
  `}var ni=class extends Un{constructor(){super(...arguments),J(this,Ae,i=>{var u;if(!this.open)return;let h=(u=this.shadowRoot)==null?void 0:u.querySelector("#content");if(!h)return;let E=i.composedPath(),R=E[0]===this||E.includes(this),G=E.includes(h);R&&!G&&(this.open=!1)}),J(this,vt,i=>{if(!this.open)return;let u=i.shiftKey&&(i.key==="/"||i.key==="?");(i.key==="Escape"||u)&&!i.ctrlKey&&!i.altKey&&!i.metaKey&&(this.open=!1,i.preventDefault(),i.stopPropagation())})}connectedCallback(){super.connectedCallback(),this.open&&(this.addEventListener("click",w(this,Ae)),document.addEventListener("keydown",w(this,vt)))}disconnectedCallback(){this.removeEventListener("click",w(this,Ae)),document.removeEventListener("keydown",w(this,vt))}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i==="open"&&(this.open?(this.addEventListener("click",w(this,Ae)),document.addEventListener("keydown",w(this,vt))):(this.removeEventListener("click",w(this,Ae)),document.removeEventListener("keydown",w(this,vt))))}};Ae=new WeakMap,vt=new WeakMap,ni.getSlotTemplateHTML=Dt,ie.customElements.get("media-keyboard-shortcuts-dialog")||ie.customElements.define("media-keyboard-shortcuts-dialog",ni);var Kr=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},nn=(i,u,h)=>(Kr(i,u,"read from private field"),h?h.call(i):u.get(i)),Ta=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},Ra=(i,u,h,E)=>(Kr(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),Mn,Bl=`<svg aria-hidden="true" viewBox="0 0 26 24">
  <path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/>
</svg>`,yu=`<svg aria-hidden="true" viewBox="0 0 26 24">
  <path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/>
</svg>`;function Oc(i){return`
    <style>
      :host([${V.MEDIA_IS_FULLSCREEN}]) slot[name=icon] slot:not([name=exit]) {
        display: none !important;
      }

      
      :host(:not([${V.MEDIA_IS_FULLSCREEN}])) slot[name=icon] slot:not([name=enter]) {
        display: none !important;
      }

      :host([${V.MEDIA_IS_FULLSCREEN}]) slot[name=tooltip-enter],
      :host(:not([${V.MEDIA_IS_FULLSCREEN}])) slot[name=tooltip-exit] {
        display: none;
      }
    </style>

    <slot name="icon">
      <slot name="enter">${Bl}</slot>
      <slot name="exit">${yu}</slot>
    </slot>
  `}function Zh(){return`
    <slot name="tooltip-enter">${oe("Enter fullscreen mode")}</slot>
    <slot name="tooltip-exit">${oe("Exit fullscreen mode")}</slot>
  `}var xc=i=>{let u=i.mediaIsFullscreen?oe("exit fullscreen mode"):oe("enter fullscreen mode");i.setAttribute("aria-label",u)},Bd=class extends ra{constructor(){super(...arguments),Ta(this,Mn,null)}static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_IS_FULLSCREEN,V.MEDIA_FULLSCREEN_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),xc(this)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_IS_FULLSCREEN&&xc(this)}get mediaFullscreenUnavailable(){return di(this,V.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(i){qr(this,V.MEDIA_FULLSCREEN_UNAVAILABLE,i)}get mediaIsFullscreen(){return Nr(this,V.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(i){Vr(this,V.MEDIA_IS_FULLSCREEN,i)}handleClick(i){Ra(this,Mn,i);let u=nn(this,Mn)instanceof PointerEvent,h=this.mediaIsFullscreen?new ie.CustomEvent(Te.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0}):new ie.CustomEvent(Te.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0,detail:u});this.dispatchEvent(h)}};Mn=new WeakMap,Bd.getSlotTemplateHTML=Oc,Bd.getTooltipContentHTML=Zh,ie.customElements.get("media-fullscreen-button")||ie.customElements.define("media-fullscreen-button",Bd);var{MEDIA_TIME_IS_LIVE:Hd,MEDIA_PAUSED:Hl}=V,{MEDIA_SEEK_TO_LIVE_REQUEST:Jh,MEDIA_PLAY_REQUEST:od}=Te,Nc='<svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg>';function Rv(i){return`
    <style>
      :host { --media-tooltip-display: none; }
      
      slot[name=indicator] > *,
      :host ::slotted([slot=indicator]) {
        
        min-width: auto;
        fill: var(--media-live-button-icon-color, rgb(140, 140, 140));
        color: var(--media-live-button-icon-color, rgb(140, 140, 140));
      }

      :host([${Hd}]:not([${Hl}])) slot[name=indicator] > *,
      :host([${Hd}]:not([${Hl}])) ::slotted([slot=indicator]) {
        fill: var(--media-live-button-indicator-color, rgb(255, 0, 0));
        color: var(--media-live-button-indicator-color, rgb(255, 0, 0));
      }

      :host([${Hd}]:not([${Hl}])) {
        cursor: var(--media-cursor, not-allowed);
      }

      slot[name=text]{
        text-transform: uppercase;
      }

    </style>

    <slot name="indicator">${Nc}</slot>
    
    <slot name="spacer">&nbsp;</slot><slot name="text">${oe("live")}</slot>
  `}var ef=i=>{var u;let h=i.mediaPaused||!i.mediaTimeIsLive,E=oe(h?"seek to live":"playing live");i.setAttribute("aria-label",E);let R=(u=i.shadowRoot)==null?void 0:u.querySelector('slot[name="text"]');R&&(R.textContent=oe("live")),h?i.removeAttribute("aria-disabled"):i.setAttribute("aria-disabled","true")},Uc=class extends ra{static get observedAttributes(){return[...super.observedAttributes,Hd,Hl]}connectedCallback(){super.connectedCallback(),ef(this)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),ef(this)}get mediaPaused(){return Nr(this,V.MEDIA_PAUSED)}set mediaPaused(i){Vr(this,V.MEDIA_PAUSED,i)}get mediaTimeIsLive(){return Nr(this,V.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(i){Vr(this,V.MEDIA_TIME_IS_LIVE,i)}handleClick(){!this.mediaPaused&&this.mediaTimeIsLive||(this.dispatchEvent(new ie.CustomEvent(Jh,{composed:!0,bubbles:!0})),this.hasAttribute(Hl)&&this.dispatchEvent(new ie.CustomEvent(od,{composed:!0,bubbles:!0})))}};Uc.getSlotTemplateHTML=Rv,ie.customElements.get("media-live-button")||ie.customElements.define("media-live-button",Uc);var Fc=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},ld=(i,u,h)=>(Fc(i,u,"read from private field"),h?h.call(i):u.get(i)),tf=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},bu=(i,u,h,E)=>(Fc(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),eo,Tu,Vd={LOADING_DELAY:"loadingdelay",NO_AUTOHIDE:"noautohide"},rf=500,Hn=`
<svg aria-hidden="true" viewBox="0 0 100 100">
  <path d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">
    <animateTransform
       attributeName="transform"
       attributeType="XML"
       type="rotate"
       dur="1s"
       from="0 50 50"
       to="360 50 50"
       repeatCount="indefinite" />
  </path>
</svg>
`;function wv(i){return`
    <style>
      :host {
        display: var(--media-control-display, var(--media-loading-indicator-display, inline-block));
        vertical-align: middle;
        box-sizing: border-box;
        --_loading-indicator-delay: var(--media-loading-indicator-transition-delay, ${rf}ms);
      }

      #status {
        color: rgba(0,0,0,0);
        width: 0px;
        height: 0px;
      }

      :host slot[name=icon] > *,
      :host ::slotted([slot=icon]) {
        opacity: var(--media-loading-indicator-opacity, 0);
        transition: opacity 0.15s;
      }

      :host([${V.MEDIA_LOADING}]:not([${V.MEDIA_PAUSED}])) slot[name=icon] > *,
      :host([${V.MEDIA_LOADING}]:not([${V.MEDIA_PAUSED}])) ::slotted([slot=icon]) {
        opacity: var(--media-loading-indicator-opacity, 1);
        transition: opacity 0.15s var(--_loading-indicator-delay);
      }

      :host #status {
        visibility: var(--media-loading-indicator-opacity, hidden);
        transition: visibility 0.15s;
      }

      :host([${V.MEDIA_LOADING}]:not([${V.MEDIA_PAUSED}])) #status {
        visibility: var(--media-loading-indicator-opacity, visible);
        transition: visibility 0.15s var(--_loading-indicator-delay);
      }

      svg, img, ::slotted(svg), ::slotted(img) {
        width: var(--media-loading-indicator-icon-width);
        height: var(--media-loading-indicator-icon-height, 100px);
        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
        vertical-align: middle;
      }
    </style>

    <slot name="icon">${Hn}</slot>
    <div id="status" role="status" aria-live="polite">${oe("media loading")}</div>
  `}var Bc=class extends ie.HTMLElement{constructor(){if(super(),tf(this,eo,void 0),tf(this,Tu,rf),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Jr(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i)}}static get observedAttributes(){return[we.MEDIA_CONTROLLER,V.MEDIA_PAUSED,V.MEDIA_LOADING,Vd.LOADING_DELAY]}attributeChangedCallback(i,u,h){var E,R,G,ee,ge;i===Vd.LOADING_DELAY&&u!==h?this.loadingDelay=Number(h):i===we.MEDIA_CONTROLLER&&(u&&((R=(E=ld(this,eo))==null?void 0:E.unassociateElement)==null||R.call(E,this),bu(this,eo,null)),h&&this.isConnected&&(bu(this,eo,(G=this.getRootNode())==null?void 0:G.getElementById(h)),(ge=(ee=ld(this,eo))==null?void 0:ee.associateElement)==null||ge.call(ee,this)))}connectedCallback(){var i,u,h;let E=this.getAttribute(we.MEDIA_CONTROLLER);E&&(bu(this,eo,(i=this.getRootNode())==null?void 0:i.getElementById(E)),(h=(u=ld(this,eo))==null?void 0:u.associateElement)==null||h.call(u,this))}disconnectedCallback(){var i,u;(u=(i=ld(this,eo))==null?void 0:i.unassociateElement)==null||u.call(i,this),bu(this,eo,null)}get loadingDelay(){return ld(this,Tu)}set loadingDelay(i){bu(this,Tu,i);let{style:u}=Si(this.shadowRoot,":host");u.setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${i}ms)`)}get mediaPaused(){return Nr(this,V.MEDIA_PAUSED)}set mediaPaused(i){Vr(this,V.MEDIA_PAUSED,i)}get mediaLoading(){return Nr(this,V.MEDIA_LOADING)}set mediaLoading(i){Vr(this,V.MEDIA_LOADING,i)}get mediaController(){return di(this,we.MEDIA_CONTROLLER)}set mediaController(i){qr(this,we.MEDIA_CONTROLLER,i)}get noAutohide(){return Nr(this,Vd.NO_AUTOHIDE)}set noAutohide(i){Vr(this,Vd.NO_AUTOHIDE,i)}};eo=new WeakMap,Tu=new WeakMap,Bc.shadowRootOptions={mode:"open"},Bc.getTemplateHTML=wv,ie.customElements.get("media-loading-indicator")||ie.customElements.define("media-loading-indicator",Bc);var Vl=`<svg aria-hidden="true" viewBox="0 0 24 24">
  <path d="M16.5 12A4.5 4.5 0 0 0 14 8v2.18l2.45 2.45a4.22 4.22 0 0 0 .05-.63Zm2.5 0a6.84 6.84 0 0 1-.54 2.64L20 16.15A8.8 8.8 0 0 0 21 12a9 9 0 0 0-7-8.77v2.06A7 7 0 0 1 19 12ZM4.27 3 3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25A6.92 6.92 0 0 1 14 18.7v2.06A9 9 0 0 0 17.69 19l2 2.05L21 19.73l-9-9L4.27 3ZM12 4 9.91 6.09 12 8.18V4Z"/>
</svg>`,af=`<svg aria-hidden="true" viewBox="0 0 24 24">
  <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4Z"/>
</svg>`,Cv=`<svg aria-hidden="true" viewBox="0 0 24 24">
  <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4ZM14 3.23v2.06a7 7 0 0 1 0 13.42v2.06a9 9 0 0 0 0-17.54Z"/>
</svg>`;function Dv(i){return`
    <style>
      :host(:not([${V.MEDIA_VOLUME_LEVEL}])) slot[name=icon] slot:not([name=high]),
      :host([${V.MEDIA_VOLUME_LEVEL}=high]) slot[name=icon] slot:not([name=high]) {
        display: none !important;
      }

      :host([${V.MEDIA_VOLUME_LEVEL}=off]) slot[name=icon] slot:not([name=off]) {
        display: none !important;
      }

      :host([${V.MEDIA_VOLUME_LEVEL}=low]) slot[name=icon] slot:not([name=low]) {
        display: none !important;
      }

      :host([${V.MEDIA_VOLUME_LEVEL}=medium]) slot[name=icon] slot:not([name=medium]) {
        display: none !important;
      }

      :host(:not([${V.MEDIA_VOLUME_LEVEL}=off])) slot[name=tooltip-unmute],
      :host([${V.MEDIA_VOLUME_LEVEL}=off]) slot[name=tooltip-mute] {
        display: none;
      }
    </style>

    <slot name="icon">
      <slot name="off">${Vl}</slot>
      <slot name="low">${af}</slot>
      <slot name="medium">${af}</slot>
      <slot name="high">${Cv}</slot>
    </slot>
  `}function to(){return`
    <slot name="tooltip-mute">${oe("Mute")}</slot>
    <slot name="tooltip-unmute">${oe("Unmute")}</slot>
  `}var Hc=i=>{let u=i.mediaVolumeLevel==="off"?oe("unmute"):oe("mute");i.setAttribute("aria-label",u)},Gd=class extends ra{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_VOLUME_LEVEL]}connectedCallback(){super.connectedCallback(),Hc(this)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_VOLUME_LEVEL&&Hc(this)}get mediaVolumeLevel(){return di(this,V.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(i){qr(this,V.MEDIA_VOLUME_LEVEL,i)}handleClick(){let i=this.mediaVolumeLevel==="off"?Te.MEDIA_UNMUTE_REQUEST:Te.MEDIA_MUTE_REQUEST;this.dispatchEvent(new ie.CustomEvent(i,{composed:!0,bubbles:!0}))}};Gd.getSlotTemplateHTML=Dv,Gd.getTooltipContentHTML=to,ie.customElements.get("media-mute-button")||ie.customElements.define("media-mute-button",Gd);var nf=`<svg aria-hidden="true" viewBox="0 0 28 24">
  <path d="M24 3H4a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h20a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Zm-1 16H5V5h18v14Zm-3-8h-7v5h7v-5Z"/>
</svg>`;function Mv(i){return`
    <style>
      :host([${V.MEDIA_IS_PIP}]) slot[name=icon] slot:not([name=exit]) {
        display: none !important;
      }

      :host(:not([${V.MEDIA_IS_PIP}])) slot[name=icon] slot:not([name=enter]) {
        display: none !important;
      }

      :host([${V.MEDIA_IS_PIP}]) slot[name=tooltip-enter],
      :host(:not([${V.MEDIA_IS_PIP}])) slot[name=tooltip-exit] {
        display: none;
      }
    </style>

    <slot name="icon">
      <slot name="enter">${nf}</slot>
      <slot name="exit">${nf}</slot>
    </slot>
  `}function Pv(){return`
    <slot name="tooltip-enter">${oe("Enter picture in picture mode")}</slot>
    <slot name="tooltip-exit">${oe("Exit picture in picture mode")}</slot>
  `}var sf=i=>{let u=i.mediaIsPip?oe("exit picture in picture mode"):oe("enter picture in picture mode");i.setAttribute("aria-label",u)},Vc=class extends ra{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_IS_PIP,V.MEDIA_PIP_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),sf(this)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_IS_PIP&&sf(this)}get mediaPipUnavailable(){return di(this,V.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(i){qr(this,V.MEDIA_PIP_UNAVAILABLE,i)}get mediaIsPip(){return Nr(this,V.MEDIA_IS_PIP)}set mediaIsPip(i){Vr(this,V.MEDIA_IS_PIP,i)}handleClick(){let i=this.mediaIsPip?Te.MEDIA_EXIT_PIP_REQUEST:Te.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new ie.CustomEvent(i,{composed:!0,bubbles:!0}))}};Vc.getSlotTemplateHTML=Mv,Vc.getTooltipContentHTML=Pv,ie.customElements.get("media-pip-button")||ie.customElements.define("media-pip-button",Vc);var Ov=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},_u=(i,u,h)=>(Ov(i,u,"read from private field"),h?h.call(i):u.get(i)),of=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},Zo,Kd={RATES:"rates"},lf=[1,1.2,1.5,1.7,2],Au=1;function xv(i){return`
    <style>
      :host {
        min-width: 5ch;
        padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));
      }
    </style>
    <slot name="icon">${i.mediaplaybackrate||Au}x</slot>
  `}function Nv(){return oe("Playback rate")}var Gc=class extends ra{constructor(){var i;super(),of(this,Zo,new pn(this,Kd.RATES,{defaultValue:lf})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(i=this.mediaPlaybackRate)!=null?i:Au}x`}static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_PLAYBACK_RATE,Kd.RATES]}attributeChangedCallback(i,u,h){if(super.attributeChangedCallback(i,u,h),i===Kd.RATES&&(_u(this,Zo).value=h),i===V.MEDIA_PLAYBACK_RATE){let E=h?+h:Number.NaN,R=Number.isNaN(E)?Au:E;this.container.innerHTML=`${R}x`,this.setAttribute("aria-label",oe("Playback rate {playbackRate}",{playbackRate:R}))}}get rates(){return _u(this,Zo)}set rates(i){i?Array.isArray(i)?_u(this,Zo).value=i.join(" "):typeof i=="string"&&(_u(this,Zo).value=i):_u(this,Zo).value=""}get mediaPlaybackRate(){return ui(this,V.MEDIA_PLAYBACK_RATE,Au)}set mediaPlaybackRate(i){Li(this,V.MEDIA_PLAYBACK_RATE,i)}handleClick(){var i,u;let h=Array.from(_u(this,Zo).values(),G=>+G).sort((G,ee)=>G-ee),E=(u=(i=h.find(G=>G>this.mediaPlaybackRate))!=null?i:h[0])!=null?u:Au,R=new ie.CustomEvent(Te.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:E});this.dispatchEvent(R)}};Zo=new WeakMap,Gc.getSlotTemplateHTML=xv,Gc.getTooltipContentHTML=Nv,ie.customElements.get("media-playback-rate-button")||ie.customElements.define("media-playback-rate-button",Gc);var Uv=`<svg aria-hidden="true" viewBox="0 0 24 24">
  <path d="m6 21 15-9L6 3v18Z"/>
</svg>`,Fv=`<svg aria-hidden="true" viewBox="0 0 24 24">
  <path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/>
</svg>`;function uf(i){return`
    <style>
      :host([${V.MEDIA_PAUSED}]) slot[name=pause],
      :host(:not([${V.MEDIA_PAUSED}])) slot[name=play] {
        display: none !important;
      }

      :host([${V.MEDIA_PAUSED}]) slot[name=tooltip-pause],
      :host(:not([${V.MEDIA_PAUSED}])) slot[name=tooltip-play] {
        display: none;
      }
    </style>

    <slot name="icon">
      <slot name="play">${Uv}</slot>
      <slot name="pause">${Fv}</slot>
    </slot>
  `}function Kc(){return`
    <slot name="tooltip-play">${oe("Play")}</slot>
    <slot name="tooltip-pause">${oe("Pause")}</slot>
  `}var df=i=>{let u=i.mediaPaused?oe("play"):oe("pause");i.setAttribute("aria-label",u)},ud=class extends ra{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_PAUSED,V.MEDIA_ENDED]}connectedCallback(){super.connectedCallback(),df(this)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),(i===V.MEDIA_PAUSED||i===V.MEDIA_LANG)&&df(this)}get mediaPaused(){return Nr(this,V.MEDIA_PAUSED)}set mediaPaused(i){Vr(this,V.MEDIA_PAUSED,i)}handleClick(){let i=this.mediaPaused?Te.MEDIA_PLAY_REQUEST:Te.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new ie.CustomEvent(i,{composed:!0,bubbles:!0}))}};ud.getSlotTemplateHTML=uf,ud.getTooltipContentHTML=Kc,ie.customElements.get("media-play-button")||ie.customElements.define("media-play-button",ud);var vs={PLACEHOLDER_SRC:"placeholdersrc",SRC:"src"};function cf(i){return`
    <style>
      :host {
        pointer-events: none;
        display: var(--media-poster-image-display, inline-block);
        box-sizing: border-box;
      }

      img {
        max-width: 100%;
        max-height: 100%;
        min-width: 100%;
        min-height: 100%;
        background-repeat: no-repeat;
        background-position: var(--media-poster-image-background-position, var(--media-object-position, center));
        background-size: var(--media-poster-image-background-size, var(--media-object-fit, contain));
        object-fit: var(--media-object-fit, contain);
        object-position: var(--media-object-position, center);
      }
    </style>

    <img part="poster img" aria-hidden="true" id="image"/>
  `}var Bv=i=>{i.style.removeProperty("background-image")},Hv=(i,u)=>{i.style["background-image"]=`url('${u}')`},Wd=class extends ie.HTMLElement{static get observedAttributes(){return[vs.PLACEHOLDER_SRC,vs.SRC]}constructor(){if(super(),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Jr(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i)}this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(i,u,h){i===vs.SRC&&(h==null?this.image.removeAttribute(vs.SRC):this.image.setAttribute(vs.SRC,h)),i===vs.PLACEHOLDER_SRC&&(h==null?Bv(this.image):Hv(this.image,h))}get placeholderSrc(){return di(this,vs.PLACEHOLDER_SRC)}set placeholderSrc(i){qr(this,vs.SRC,i)}get src(){return di(this,vs.SRC)}set src(i){qr(this,vs.SRC,i)}};Wd.shadowRootOptions={mode:"open"},Wd.getTemplateHTML=cf,ie.customElements.get("media-poster-image")||ie.customElements.define("media-poster-image",Wd);var Os=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},da=(i,u,h)=>(Os(i,u,"read from private field"),h?h.call(i):u.get(i)),Gl=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},Jo=(i,u,h,E)=>(Os(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),Yd,Vv=class extends yn{constructor(){super(),Gl(this,Yd,void 0),Jo(this,Yd,this.shadowRoot.querySelector("slot"))}static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_PREVIEW_CHAPTER,V.MEDIA_LANG]}attributeChangedCallback(i,u,h){if(super.attributeChangedCallback(i,u,h),(i===V.MEDIA_PREVIEW_CHAPTER||i===V.MEDIA_LANG)&&h!==u&&h!=null)if(da(this,Yd).textContent=h,h!==""){let E=oe("chapter: {chapterName}",{chapterName:h});this.setAttribute("aria-valuetext",E)}else this.removeAttribute("aria-valuetext")}get mediaPreviewChapter(){return di(this,V.MEDIA_PREVIEW_CHAPTER)}set mediaPreviewChapter(i){qr(this,V.MEDIA_PREVIEW_CHAPTER,i)}};Yd=new WeakMap,ie.customElements.get("media-preview-chapter-display")||ie.customElements.define("media-preview-chapter-display",Vv);var hf=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},$d=(i,u,h)=>(hf(i,u,"read from private field"),h?h.call(i):u.get(i)),Gv=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},qd=(i,u,h,E)=>(hf(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),xs;function Kv(i){return`
    <style>
      :host {
        box-sizing: border-box;
        display: var(--media-control-display, var(--media-preview-thumbnail-display, inline-block));
        overflow: hidden;
      }

      img {
        display: none;
        position: relative;
      }
    </style>
    <img crossorigin loading="eager" decoding="async">
  `}var Kl=class extends ie.HTMLElement{constructor(){if(super(),Gv(this,xs,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Jr(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i)}}static get observedAttributes(){return[we.MEDIA_CONTROLLER,V.MEDIA_PREVIEW_IMAGE,V.MEDIA_PREVIEW_COORDS]}connectedCallback(){var i,u,h;let E=this.getAttribute(we.MEDIA_CONTROLLER);E&&(qd(this,xs,(i=this.getRootNode())==null?void 0:i.getElementById(E)),(h=(u=$d(this,xs))==null?void 0:u.associateElement)==null||h.call(u,this))}disconnectedCallback(){var i,u;(u=(i=$d(this,xs))==null?void 0:i.unassociateElement)==null||u.call(i,this),qd(this,xs,null)}attributeChangedCallback(i,u,h){var E,R,G,ee,ge;[V.MEDIA_PREVIEW_IMAGE,V.MEDIA_PREVIEW_COORDS].includes(i)&&this.update(),i===we.MEDIA_CONTROLLER&&(u&&((R=(E=$d(this,xs))==null?void 0:E.unassociateElement)==null||R.call(E,this),qd(this,xs,null)),h&&this.isConnected&&(qd(this,xs,(G=this.getRootNode())==null?void 0:G.getElementById(h)),(ge=(ee=$d(this,xs))==null?void 0:ee.associateElement)==null||ge.call(ee,this)))}get mediaPreviewImage(){return di(this,V.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(i){qr(this,V.MEDIA_PREVIEW_IMAGE,i)}get mediaPreviewCoords(){let i=this.getAttribute(V.MEDIA_PREVIEW_COORDS);if(i)return i.split(/\s+/).map(u=>+u)}set mediaPreviewCoords(i){if(!i){this.removeAttribute(V.MEDIA_PREVIEW_COORDS);return}this.setAttribute(V.MEDIA_PREVIEW_COORDS,i.join(" "))}update(){let i=this.mediaPreviewCoords,u=this.mediaPreviewImage;if(!(i&&u))return;let[h,E,R,G]=i,ee=u.split("#")[0],ge=getComputedStyle(this),{maxWidth:_t,maxHeight:It,minWidth:Er,minHeight:ar}=ge,nr=Math.min(parseInt(_t)/R,parseInt(It)/G),rr=Math.max(parseInt(Er)/R,parseInt(ar)/G),Mr=nr<1,Zr=Mr?nr:rr>1?rr:1,{style:mi}=Si(this.shadowRoot,":host"),Aa=Si(this.shadowRoot,"img").style,os=this.shadowRoot.querySelector("img"),vl=Mr?"min":"max";mi.setProperty(`${vl}-width`,"initial","important"),mi.setProperty(`${vl}-height`,"initial","important"),mi.width=`${R*Zr}px`,mi.height=`${G*Zr}px`;let su=()=>{Aa.width=`${this.imgWidth*Zr}px`,Aa.height=`${this.imgHeight*Zr}px`,Aa.display="block"};os.src!==ee&&(os.onload=()=>{this.imgWidth=os.naturalWidth,this.imgHeight=os.naturalHeight,su()},os.src=ee,su()),su(),Aa.transform=`translate(-${h*Zr}px, -${E*Zr}px)`}};xs=new WeakMap,Kl.shadowRootOptions={mode:"open"},Kl.getTemplateHTML=Kv,ie.customElements.get("media-preview-thumbnail")||ie.customElements.define("media-preview-thumbnail",Kl);var jd=Kl,dd=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},ff=(i,u,h)=>(dd(i,u,"read from private field"),h?h.call(i):u.get(i)),Wv=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},vf=(i,u,h,E)=>(dd(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),Su,Wc=class extends yn{constructor(){super(),Wv(this,Su,void 0),vf(this,Su,this.shadowRoot.querySelector("slot")),ff(this,Su).textContent=li(0)}static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_PREVIEW_TIME]}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_PREVIEW_TIME&&h!=null&&(ff(this,Su).textContent=li(parseFloat(h)))}get mediaPreviewTime(){return ui(this,V.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(i){Li(this,V.MEDIA_PREVIEW_TIME,i)}};Su=new WeakMap,ie.customElements.get("media-preview-time-display")||ie.customElements.define("media-preview-time-display",Wc);var Lu={SEEK_OFFSET:"seekoffset"},Yc=30,zd=i=>`
  <svg aria-hidden="true" viewBox="0 0 20 24">
    <defs>
      <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style>
    </defs>
    <text class="text value" transform="translate(2.18 19.87)">${i}</text>
    <path d="M10 6V3L4.37 7 10 10.94V8a5.54 5.54 0 0 1 1.9 10.48v2.12A7.5 7.5 0 0 0 10 6Z"/>
  </svg>`;function Yv(i,u){return`
    <slot name="icon">${zd(u.seekOffset)}</slot>
  `}function mf(){return oe("Seek backward")}var $v=0,$c=class extends ra{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_CURRENT_TIME,Lu.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=ui(this,Lu.SEEK_OFFSET,Yc)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===Lu.SEEK_OFFSET&&(this.seekOffset=ui(this,Lu.SEEK_OFFSET,Yc))}get seekOffset(){return ui(this,Lu.SEEK_OFFSET,Yc)}set seekOffset(i){Li(this,Lu.SEEK_OFFSET,i),this.setAttribute("aria-label",oe("seek back {seekOffset} seconds",{seekOffset:this.seekOffset})),za(zi(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return ui(this,V.MEDIA_CURRENT_TIME,$v)}set mediaCurrentTime(i){Li(this,V.MEDIA_CURRENT_TIME,i)}handleClick(){let i=Math.max(this.mediaCurrentTime-this.seekOffset,0),u=new ie.CustomEvent(Te.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:i});this.dispatchEvent(u)}};$c.getSlotTemplateHTML=Yv,$c.getTooltipContentHTML=mf,ie.customElements.get("media-seek-backward-button")||ie.customElements.define("media-seek-backward-button",$c);var ku={SEEK_OFFSET:"seekoffset"},qc=30,qv=i=>`
  <svg aria-hidden="true" viewBox="0 0 20 24">
    <defs>
      <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style>
    </defs>
    <text class="text value" transform="translate(8.9 19.87)">${i}</text>
    <path d="M10 6V3l5.61 4L10 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 10 6Z"/>
  </svg>`;function cd(i,u){return`
    <slot name="icon">${qv(u.seekOffset)}</slot>
  `}function jv(){return oe("Seek forward")}var pf=0,jc=class extends ra{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_CURRENT_TIME,ku.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=ui(this,ku.SEEK_OFFSET,qc)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===ku.SEEK_OFFSET&&(this.seekOffset=ui(this,ku.SEEK_OFFSET,qc))}get seekOffset(){return ui(this,ku.SEEK_OFFSET,qc)}set seekOffset(i){Li(this,ku.SEEK_OFFSET,i),this.setAttribute("aria-label",oe("seek forward {seekOffset} seconds",{seekOffset:this.seekOffset})),za(zi(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return ui(this,V.MEDIA_CURRENT_TIME,pf)}set mediaCurrentTime(i){Li(this,V.MEDIA_CURRENT_TIME,i)}handleClick(){let i=this.mediaCurrentTime+this.seekOffset,u=new ie.CustomEvent(Te.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:i});this.dispatchEvent(u)}};jc.getSlotTemplateHTML=cd,jc.getTooltipContentHTML=jv,ie.customElements.get("media-seek-forward-button")||ie.customElements.define("media-seek-forward-button",jc);var gf=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},zc=(i,u,h)=>(gf(i,u,"read from private field"),h?h.call(i):u.get(i)),zv=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},Qv=(i,u,h,E)=>(gf(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),Iu,el={REMAINING:"remaining",SHOW_DURATION:"showduration",NO_TOGGLE:"notoggle"},Ef=[...Object.values(el),V.MEDIA_CURRENT_TIME,V.MEDIA_DURATION,V.MEDIA_SEEKABLE],yf=["Enter"," "],Xv="&nbsp;/&nbsp;",Qc=(i,{timesSep:u=Xv}={})=>{var h,E;let R=(h=i.mediaCurrentTime)!=null?h:0,[,G]=(E=i.mediaSeekable)!=null?E:[],ee=0;Number.isFinite(i.mediaDuration)?ee=i.mediaDuration:Number.isFinite(G)&&(ee=G);let ge=i.remaining?li(0-(ee-R)):li(R);return i.showDuration?`${ge}${u}${li(ee)}`:ge},bf="video not loaded, unknown time.",Tf=i=>{var u;let h=i.mediaCurrentTime,[,E]=(u=i.mediaSeekable)!=null?u:[],R=null;if(Number.isFinite(i.mediaDuration)?R=i.mediaDuration:Number.isFinite(E)&&(R=E),h==null||R===null){i.setAttribute("aria-valuetext",bf);return}let G=i.remaining?Qr(0-(R-h)):Qr(h);if(!i.showDuration){i.setAttribute("aria-valuetext",G);return}let ee=Qr(R),ge=`${G} of ${ee}`;i.setAttribute("aria-valuetext",ge)};function _f(i,u){return`
    <slot>${Qc(u)}</slot>
  `}var hd=class extends yn{constructor(){super(),zv(this,Iu,void 0),Qv(this,Iu,this.shadowRoot.querySelector("slot")),zc(this,Iu).innerHTML=`${Qc(this)}`}static get observedAttributes(){return[...super.observedAttributes,...Ef,"disabled"]}connectedCallback(){let{style:i}=Si(this.shadowRoot,":host(:hover:not([notoggle]))");i.setProperty("cursor","var(--media-cursor, pointer)"),i.setProperty("background","var(--media-control-hover-background, rgba(50 50 70 / .7))"),this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",oe("playback time"));let u=h=>{let{key:E}=h;if(!yf.includes(E)){this.removeEventListener("keyup",u);return}this.toggleTimeDisplay()};this.addEventListener("keydown",h=>{let{metaKey:E,altKey:R,key:G}=h;if(E||R||!yf.includes(G)){this.removeEventListener("keyup",u);return}this.addEventListener("keyup",u)}),this.addEventListener("click",this.toggleTimeDisplay),super.connectedCallback()}toggleTimeDisplay(){this.noToggle||(this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining",""))}disconnectedCallback(){this.disable(),super.disconnectedCallback()}attributeChangedCallback(i,u,h){Ef.includes(i)?this.update():i==="disabled"&&h!==u&&(h==null?this.enable():this.disable()),super.attributeChangedCallback(i,u,h)}enable(){this.tabIndex=0}disable(){this.tabIndex=-1}get remaining(){return Nr(this,el.REMAINING)}set remaining(i){Vr(this,el.REMAINING,i)}get showDuration(){return Nr(this,el.SHOW_DURATION)}set showDuration(i){Vr(this,el.SHOW_DURATION,i)}get noToggle(){return Nr(this,el.NO_TOGGLE)}set noToggle(i){Vr(this,el.NO_TOGGLE,i)}get mediaDuration(){return ui(this,V.MEDIA_DURATION)}set mediaDuration(i){Li(this,V.MEDIA_DURATION,i)}get mediaCurrentTime(){return ui(this,V.MEDIA_CURRENT_TIME)}set mediaCurrentTime(i){Li(this,V.MEDIA_CURRENT_TIME,i)}get mediaSeekable(){let i=this.getAttribute(V.MEDIA_SEEKABLE);if(i)return i.split(":").map(u=>+u)}set mediaSeekable(i){if(i==null){this.removeAttribute(V.MEDIA_SEEKABLE);return}this.setAttribute(V.MEDIA_SEEKABLE,i.join(":"))}update(){let i=Qc(this);Tf(this),i!==zc(this,Iu).innerHTML&&(zc(this,Iu).innerHTML=i)}};Iu=new WeakMap,hd.getSlotTemplateHTML=_f,ie.customElements.get("media-time-display")||ie.customElements.define("media-time-display",hd);var Af=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},Oi=(i,u,h)=>(Af(i,u,"read from private field"),h?h.call(i):u.get(i)),Ns=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},es=(i,u,h,E)=>(Af(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),fd=(i,u,h,E)=>({set _(R){es(i,u,R,h)},get _(){return Oi(i,u,E)}}),Us,Wl,Ru,vd,wu,md,Cu,Du,ms,Qd,Sf=class{constructor(i,u,h){Ns(this,Us,void 0),Ns(this,Wl,void 0),Ns(this,Ru,void 0),Ns(this,vd,void 0),Ns(this,wu,void 0),Ns(this,md,void 0),Ns(this,Cu,void 0),Ns(this,Du,void 0),Ns(this,ms,0),Ns(this,Qd,(E=performance.now())=>{es(this,ms,requestAnimationFrame(Oi(this,Qd))),es(this,vd,performance.now()-Oi(this,Ru));let R=1e3/this.fps;if(Oi(this,vd)>R){es(this,Ru,E-Oi(this,vd)%R);let G=1e3/((E-Oi(this,Wl))/++fd(this,wu)._),ee=(E-Oi(this,md))/1e3/this.duration,ge=Oi(this,Cu)+ee*this.playbackRate;ge-Oi(this,Us).valueAsNumber>0?es(this,Du,this.playbackRate/this.duration/G):(es(this,Du,.995*Oi(this,Du)),ge=Oi(this,Us).valueAsNumber+Oi(this,Du)),this.callback(ge)}}),es(this,Us,i),this.callback=u,this.fps=h}start(){Oi(this,ms)===0&&(es(this,Ru,performance.now()),es(this,Wl,Oi(this,Ru)),es(this,wu,0),Oi(this,Qd).call(this))}stop(){Oi(this,ms)!==0&&(cancelAnimationFrame(Oi(this,ms)),es(this,ms,0))}update({start:i,duration:u,playbackRate:h}){let E=i-Oi(this,Us).valueAsNumber,R=Math.abs(u-this.duration);(E>0||E<-.03||R>=.5)&&this.callback(i),es(this,Cu,i),es(this,md,performance.now()),this.duration=u,this.playbackRate=h}};Us=new WeakMap,Wl=new WeakMap,Ru=new WeakMap,vd=new WeakMap,wu=new WeakMap,md=new WeakMap,Cu=new WeakMap,Du=new WeakMap,ms=new WeakMap,Qd=new WeakMap;var Xc=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},Pi=(i,u,h)=>(Xc(i,u,"read from private field"),h?h.call(i):u.get(i)),wa=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},ts=(i,u,h,E)=>(Xc(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),Ca=(i,u,h)=>(Xc(i,u,"access private method"),h),Mu,tl,Xd,pd,gd,Ed,ro,Yl,Pu,Ou,Ro,yd,Zc,Jc,rs,ps,eh,Zd,th,Jd,rh,ih,rl,xu,ec,ah,tc,Lf="video not loaded, unknown time.",kf=i=>{let u=i.range,h=Qr(+If(i)),E=Qr(+i.mediaSeekableEnd),R=h&&E?`${h} of ${E}`:Lf;u.setAttribute("aria-valuetext",R)};function rc(i){return`
    <style>
      :host {
        --media-box-border-radius: 4px;
        --media-box-padding-left: 10px;
        --media-box-padding-right: 10px;
        --media-preview-border-radius: var(--media-box-border-radius);
        --media-box-arrow-offset: var(--media-box-border-radius);
        --_control-background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
        --_preview-background: var(--media-preview-background, var(--_control-background));

        
        contain: layout;
      }

      #buffered {
        background: var(--media-time-range-buffered-color, rgb(255 255 255 / .4));
        position: absolute;
        height: 100%;
        will-change: width;
      }

      #preview-rail,
      #current-rail {
        width: 100%;
        position: absolute;
        left: 0;
        bottom: 100%;
        pointer-events: none;
        will-change: transform;
      }

      [part~="box"] {
        width: min-content;
        
        position: absolute;
        bottom: 100%;
        flex-direction: column;
        align-items: center;
        transform: translateX(-50%);
      }

      [part~="current-box"] {
        display: var(--media-current-box-display, var(--media-box-display, flex));
        margin: var(--media-current-box-margin, var(--media-box-margin, 0 0 5px));
        visibility: hidden;
      }

      [part~="preview-box"] {
        display: var(--media-preview-box-display, var(--media-box-display, flex));
        margin: var(--media-preview-box-margin, var(--media-box-margin, 0 0 5px));
        transition-property: var(--media-preview-transition-property, visibility, opacity);
        transition-duration: var(--media-preview-transition-duration-out, .25s);
        transition-delay: var(--media-preview-transition-delay-out, 0s);
        visibility: hidden;
        opacity: 0;
      }

      :host(:is([${V.MEDIA_PREVIEW_IMAGE}], [${V.MEDIA_PREVIEW_TIME}])[dragging]) [part~="preview-box"] {
        transition-duration: var(--media-preview-transition-duration-in, .5s);
        transition-delay: var(--media-preview-transition-delay-in, .25s);
        visibility: visible;
        opacity: 1;
      }

      @media (hover: hover) {
        :host(:is([${V.MEDIA_PREVIEW_IMAGE}], [${V.MEDIA_PREVIEW_TIME}]):hover) [part~="preview-box"] {
          transition-duration: var(--media-preview-transition-duration-in, .5s);
          transition-delay: var(--media-preview-transition-delay-in, .25s);
          visibility: visible;
          opacity: 1;
        }
      }

      media-preview-thumbnail,
      ::slotted(media-preview-thumbnail) {
        visibility: hidden;
        
        transition: visibility 0s .25s;
        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
        background: var(--media-preview-thumbnail-background, var(--_preview-background));
        box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px rgb(0 0 0 / .2));
        max-width: var(--media-preview-thumbnail-max-width, 180px);
        max-height: var(--media-preview-thumbnail-max-height, 160px);
        min-width: var(--media-preview-thumbnail-min-width, 120px);
        min-height: var(--media-preview-thumbnail-min-height, 80px);
        border: var(--media-preview-thumbnail-border);
        border-radius: var(--media-preview-thumbnail-border-radius,
          var(--media-preview-border-radius) var(--media-preview-border-radius) 0 0);
      }

      :host([${V.MEDIA_PREVIEW_IMAGE}][dragging]) media-preview-thumbnail,
      :host([${V.MEDIA_PREVIEW_IMAGE}][dragging]) ::slotted(media-preview-thumbnail) {
        transition-delay: var(--media-preview-transition-delay-in, .25s);
        visibility: visible;
      }

      @media (hover: hover) {
        :host([${V.MEDIA_PREVIEW_IMAGE}]:hover) media-preview-thumbnail,
        :host([${V.MEDIA_PREVIEW_IMAGE}]:hover) ::slotted(media-preview-thumbnail) {
          transition-delay: var(--media-preview-transition-delay-in, .25s);
          visibility: visible;
        }

        :host([${V.MEDIA_PREVIEW_TIME}]:hover) {
          --media-time-range-hover-display: block;
        }
      }

      media-preview-chapter-display,
      ::slotted(media-preview-chapter-display) {
        font-size: var(--media-font-size, 13px);
        line-height: 17px;
        min-width: 0;
        visibility: hidden;
        
        transition: min-width 0s, border-radius 0s, margin 0s, padding 0s, visibility 0s;
        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
        background: var(--media-preview-chapter-background, var(--_preview-background));
        border-radius: var(--media-preview-chapter-border-radius,
          var(--media-preview-border-radius) var(--media-preview-border-radius)
          var(--media-preview-border-radius) var(--media-preview-border-radius));
        padding: var(--media-preview-chapter-padding, 3.5px 9px);
        margin: var(--media-preview-chapter-margin, 0 0 5px);
        text-shadow: var(--media-preview-chapter-text-shadow, 0 0 4px rgb(0 0 0 / .75));
      }

      :host([${V.MEDIA_PREVIEW_IMAGE}]) media-preview-chapter-display,
      :host([${V.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-chapter-display) {
        transition-delay: var(--media-preview-transition-delay-in, .25s);
        border-radius: var(--media-preview-chapter-border-radius, 0);
        padding: var(--media-preview-chapter-padding, 3.5px 9px 0);
        margin: var(--media-preview-chapter-margin, 0);
        min-width: 100%;
      }

      media-preview-chapter-display[${V.MEDIA_PREVIEW_CHAPTER}],
      ::slotted(media-preview-chapter-display[${V.MEDIA_PREVIEW_CHAPTER}]) {
        visibility: visible;
      }

      media-preview-chapter-display:not([aria-valuetext]),
      ::slotted(media-preview-chapter-display:not([aria-valuetext])) {
        display: none;
      }

      media-preview-time-display,
      ::slotted(media-preview-time-display),
      media-time-display,
      ::slotted(media-time-display) {
        font-size: var(--media-font-size, 13px);
        line-height: 17px;
        min-width: 0;
        
        transition: min-width 0s, border-radius 0s;
        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
        background: var(--media-preview-time-background, var(--_preview-background));
        border-radius: var(--media-preview-time-border-radius,
          var(--media-preview-border-radius) var(--media-preview-border-radius)
          var(--media-preview-border-radius) var(--media-preview-border-radius));
        padding: var(--media-preview-time-padding, 3.5px 9px);
        margin: var(--media-preview-time-margin, 0);
        text-shadow: var(--media-preview-time-text-shadow, 0 0 4px rgb(0 0 0 / .75));
        transform: translateX(min(
          max(calc(50% - var(--_box-width) / 2),
          calc(var(--_box-shift, 0))),
          calc(var(--_box-width) / 2 - 50%)
        ));
      }

      :host([${V.MEDIA_PREVIEW_IMAGE}]) media-preview-time-display,
      :host([${V.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-time-display) {
        transition-delay: var(--media-preview-transition-delay-in, .25s);
        border-radius: var(--media-preview-time-border-radius,
          0 0 var(--media-preview-border-radius) var(--media-preview-border-radius));
        min-width: 100%;
      }

      :host([${V.MEDIA_PREVIEW_TIME}]:hover) {
        --media-time-range-hover-display: block;
      }

      [part~="arrow"],
      ::slotted([part~="arrow"]) {
        display: var(--media-box-arrow-display, inline-block);
        transform: translateX(min(
          max(calc(50% - var(--_box-width) / 2 + var(--media-box-arrow-offset)),
          calc(var(--_box-shift, 0))),
          calc(var(--_box-width) / 2 - 50% - var(--media-box-arrow-offset))
        ));
        
        border-color: transparent;
        border-top-color: var(--media-box-arrow-background, var(--_control-background));
        border-width: var(--media-box-arrow-border-width,
          var(--media-box-arrow-height, 5px) var(--media-box-arrow-width, 6px) 0);
        border-style: solid;
        justify-content: center;
        height: 0;
      }
    </style>
    <div id="preview-rail">
      <slot name="preview" part="box preview-box">
        <media-preview-thumbnail>
          <template shadowrootmode="${jd.shadowRootOptions.mode}">
            ${jd.getTemplateHTML({})}
          </template>
        </media-preview-thumbnail>
        <media-preview-chapter-display></media-preview-chapter-display>
        <media-preview-time-display></media-preview-time-display>
        <slot name="preview-arrow"><div part="arrow"></div></slot>
      </slot>
    </div>
    <div id="current-rail">
      <slot name="current" part="box current-box">
        
      </slot>
    </div>
  `}var ic=(i,u=i.mediaCurrentTime)=>{let h=Number.isFinite(i.mediaSeekableStart)?i.mediaSeekableStart:0,E=Number.isFinite(i.mediaDuration)?i.mediaDuration:i.mediaSeekableEnd;if(Number.isNaN(E))return 0;let R=(u-h)/(E-h);return Math.max(0,Math.min(R,1))},If=(i,u=i.range.valueAsNumber)=>{let h=Number.isFinite(i.mediaSeekableStart)?i.mediaSeekableStart:0,E=Number.isFinite(i.mediaDuration)?i.mediaDuration:i.mediaSeekableEnd;return Number.isNaN(E)?0:u*(E-h)+h},bd=class extends Zn{constructor(){super(),wa(this,Ro),wa(this,Zc),wa(this,ps),wa(this,Zd),wa(this,Jd),wa(this,ih),wa(this,xu),wa(this,ah),wa(this,Mu,void 0),wa(this,tl,void 0),wa(this,Xd,void 0),wa(this,pd,void 0),wa(this,gd,void 0),wa(this,Ed,void 0),wa(this,ro,void 0),wa(this,Yl,void 0),wa(this,Pu,void 0),wa(this,Ou,void 0),wa(this,rs,u=>{this.dragging||(zt(u)&&(this.range.valueAsNumber=u),Pi(this,Ou)||this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'<div id="buffered" part="buffered"></div>'),ts(this,Xd,this.shadowRoot.querySelectorAll('[part~="box"]')),ts(this,gd,this.shadowRoot.querySelector('[part~="preview-box"]')),ts(this,Ed,this.shadowRoot.querySelector('[part~="current-box"]'));let i=getComputedStyle(this);ts(this,ro,parseInt(i.getPropertyValue("--media-box-padding-left"))),ts(this,Yl,parseInt(i.getPropertyValue("--media-box-padding-right"))),ts(this,tl,new Sf(this.range,Pi(this,rs),60))}static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_PAUSED,V.MEDIA_DURATION,V.MEDIA_SEEKABLE,V.MEDIA_CURRENT_TIME,V.MEDIA_PREVIEW_IMAGE,V.MEDIA_PREVIEW_TIME,V.MEDIA_PREVIEW_CHAPTER,V.MEDIA_BUFFERED,V.MEDIA_PLAYBACK_RATE,V.MEDIA_LOADING,V.MEDIA_ENDED]}connectedCallback(){var i;super.connectedCallback(),this.range.setAttribute("aria-label",oe("seek")),Ca(this,Ro,yd).call(this),ts(this,Mu,this.getRootNode()),(i=Pi(this,Mu))==null||i.addEventListener("transitionstart",this)}disconnectedCallback(){var i;super.disconnectedCallback(),Ca(this,Ro,yd).call(this),(i=Pi(this,Mu))==null||i.removeEventListener("transitionstart",this),ts(this,Mu,null)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),u!=h&&(i===V.MEDIA_CURRENT_TIME||i===V.MEDIA_PAUSED||i===V.MEDIA_ENDED||i===V.MEDIA_LOADING||i===V.MEDIA_DURATION||i===V.MEDIA_SEEKABLE?(Pi(this,tl).update({start:ic(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),Ca(this,Ro,yd).call(this),kf(this)):i===V.MEDIA_BUFFERED&&this.updateBufferedBar(),(i===V.MEDIA_DURATION||i===V.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=Pi(this,Pu),this.updateBar()))}get mediaChaptersCues(){return Pi(this,Pu)}set mediaChaptersCues(i){var u;ts(this,Pu,i),this.updateSegments((u=Pi(this,Pu))==null?void 0:u.map(h=>({start:ic(this,h.startTime),end:ic(this,h.endTime)})))}get mediaPaused(){return Nr(this,V.MEDIA_PAUSED)}set mediaPaused(i){Vr(this,V.MEDIA_PAUSED,i)}get mediaLoading(){return Nr(this,V.MEDIA_LOADING)}set mediaLoading(i){Vr(this,V.MEDIA_LOADING,i)}get mediaDuration(){return ui(this,V.MEDIA_DURATION)}set mediaDuration(i){Li(this,V.MEDIA_DURATION,i)}get mediaCurrentTime(){return ui(this,V.MEDIA_CURRENT_TIME)}set mediaCurrentTime(i){Li(this,V.MEDIA_CURRENT_TIME,i)}get mediaPlaybackRate(){return ui(this,V.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(i){Li(this,V.MEDIA_PLAYBACK_RATE,i)}get mediaBuffered(){let i=this.getAttribute(V.MEDIA_BUFFERED);return i?i.split(" ").map(u=>u.split(":").map(h=>+h)):[]}set mediaBuffered(i){if(!i){this.removeAttribute(V.MEDIA_BUFFERED);return}let u=i.map(h=>h.join(":")).join(" ");this.setAttribute(V.MEDIA_BUFFERED,u)}get mediaSeekable(){let i=this.getAttribute(V.MEDIA_SEEKABLE);if(i)return i.split(":").map(u=>+u)}set mediaSeekable(i){if(i==null){this.removeAttribute(V.MEDIA_SEEKABLE);return}this.setAttribute(V.MEDIA_SEEKABLE,i.join(":"))}get mediaSeekableEnd(){var i;let[,u=this.mediaDuration]=(i=this.mediaSeekable)!=null?i:[];return u}get mediaSeekableStart(){var i;let[u=0]=(i=this.mediaSeekable)!=null?i:[];return u}get mediaPreviewImage(){return di(this,V.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(i){qr(this,V.MEDIA_PREVIEW_IMAGE,i)}get mediaPreviewTime(){return ui(this,V.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(i){Li(this,V.MEDIA_PREVIEW_TIME,i)}get mediaEnded(){return Nr(this,V.MEDIA_ENDED)}set mediaEnded(i){Vr(this,V.MEDIA_ENDED,i)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var i;let u=this.mediaBuffered;if(!u.length)return;let h;if(this.mediaEnded)h=1;else{let R=this.mediaCurrentTime,[,G=this.mediaSeekableStart]=(i=u.find(([ee,ge])=>ee<=R&&R<=ge))!=null?i:[];h=ic(this,G)}let{style:E}=Si(this.shadowRoot,"#buffered");E.setProperty("width",`${h*100}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;let i=Si(this.shadowRoot,"#current-rail"),u=Si(this.shadowRoot,'[part~="current-box"]'),h=Ca(this,ps,eh).call(this,Pi(this,Ed)),E=Ca(this,Zd,th).call(this,h,this.range.valueAsNumber),R=Ca(this,Jd,rh).call(this,h,this.range.valueAsNumber);i.style.transform=`translateX(${E})`,i.style.setProperty("--_range-width",`${h.range.width}`),u.style.setProperty("--_box-shift",`${R}`),u.style.setProperty("--_box-width",`${h.box.width}px`),u.style.setProperty("visibility","initial")}handleEvent(i){switch(super.handleEvent(i),i.type){case"input":Ca(this,ah,tc).call(this);break;case"pointermove":Ca(this,ih,rl).call(this,i);break;case"pointerup":Pi(this,Ou)&&ts(this,Ou,!1);break;case"pointerdown":ts(this,Ou,!0);break;case"pointerleave":Ca(this,xu,ec).call(this,null);break;case"transitionstart":aa(i.target,this)&&setTimeout(()=>Ca(this,Ro,yd).call(this),0);break}}};Mu=new WeakMap,tl=new WeakMap,Xd=new WeakMap,pd=new WeakMap,gd=new WeakMap,Ed=new WeakMap,ro=new WeakMap,Yl=new WeakMap,Pu=new WeakMap,Ou=new WeakMap,Ro=new WeakSet,yd=function(){Ca(this,Zc,Jc).call(this)?Pi(this,tl).start():Pi(this,tl).stop()},Zc=new WeakSet,Jc=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&dn(this)},rs=new WeakMap,ps=new WeakSet,eh=function(i){var u;let h=((u=this.getAttribute("bounds")?ma(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?u:this).getBoundingClientRect(),E=this.range.getBoundingClientRect(),R=i.offsetWidth,G=-(E.left-h.left-R/2),ee=h.right-E.left-R/2;return{box:{width:R,min:G,max:ee},bounds:h,range:E}},Zd=new WeakSet,th=function(i,u){let h=`${u*100}%`,{width:E,min:R,max:G}=i.box;if(!E)return h;if(Number.isNaN(R)||(h=`max(${`calc(1 / var(--_range-width) * 100 * ${R}% + var(--media-box-padding-left))`}, ${h})`),!Number.isNaN(G)){let ee=`calc(1 / var(--_range-width) * 100 * ${G}% - var(--media-box-padding-right))`;h=`min(${h}, ${ee})`}return h},Jd=new WeakSet,rh=function(i,u){let{width:h,min:E,max:R}=i.box,G=u*i.range.width;if(G<E+Pi(this,ro)){let ee=i.range.left-i.bounds.left-Pi(this,ro);return`${G-h/2+ee}px`}if(G>R-Pi(this,Yl)){let ee=i.bounds.right-i.range.right-Pi(this,Yl);return`${G+h/2-ee-i.range.width}px`}return 0},ih=new WeakSet,rl=function(i){let u=[...Pi(this,Xd)].some(Er=>i.composedPath().includes(Er));if(!this.dragging&&(u||!i.composedPath().includes(this))){Ca(this,xu,ec).call(this,null);return}let h=this.mediaSeekableEnd;if(!h)return;let E=Si(this.shadowRoot,"#preview-rail"),R=Si(this.shadowRoot,'[part~="preview-box"]'),G=Ca(this,ps,eh).call(this,Pi(this,gd)),ee=(i.clientX-G.range.left)/G.range.width;ee=Math.max(0,Math.min(1,ee));let ge=Ca(this,Zd,th).call(this,G,ee),_t=Ca(this,Jd,rh).call(this,G,ee);E.style.transform=`translateX(${ge})`,E.style.setProperty("--_range-width",`${G.range.width}`),R.style.setProperty("--_box-shift",`${_t}`),R.style.setProperty("--_box-width",`${G.box.width}px`);let It=Math.round(Pi(this,pd))-Math.round(ee*h);Math.abs(It)<1&&ee>.01&&ee<.99||(ts(this,pd,ee*h),Ca(this,xu,ec).call(this,Pi(this,pd)))},xu=new WeakSet,ec=function(i){this.dispatchEvent(new ie.CustomEvent(Te.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:i}))},ah=new WeakSet,tc=function(){Pi(this,tl).stop();let i=If(this);this.dispatchEvent(new ie.CustomEvent(Te.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:i}))},bd.shadowRootOptions={mode:"open"},bd.getContainerTemplateHTML=rc,ie.customElements.get("media-time-range")||ie.customElements.define("media-time-range",bd);var Zv=1,Rf=i=>i.mediaMuted?0:i.mediaVolume,Jv=i=>`${Math.round(i*100)}%`,wf=class extends Zn{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_VOLUME,V.MEDIA_MUTED,V.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{let i=this.range.value,u=new ie.CustomEvent(Te.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:i});this.dispatchEvent(u)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",oe("volume"))}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),(i===V.MEDIA_VOLUME||i===V.MEDIA_MUTED)&&(this.range.valueAsNumber=Rf(this),this.range.setAttribute("aria-valuetext",Jv(this.range.valueAsNumber)),this.updateBar())}get mediaVolume(){return ui(this,V.MEDIA_VOLUME,Zv)}set mediaVolume(i){Li(this,V.MEDIA_VOLUME,i)}get mediaMuted(){return Nr(this,V.MEDIA_MUTED)}set mediaMuted(i){Vr(this,V.MEDIA_MUTED,i)}get mediaVolumeUnavailable(){return di(this,V.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(i){qr(this,V.MEDIA_VOLUME_UNAVAILABLE,i)}};ie.customElements.get("media-volume-range")||ie.customElements.define("media-volume-range",wf);function nh(i){return`
      <style>
        :host {
          min-width: 4ch;
          padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));
          width: 100%;
          display: grid;
          grid-template-columns: 1fr auto;
          gap: 1rem;
          font-weight: var(--media-button-font-weight, normal);
        }

        #checked-indicator {
          display: none;
        }

        :host([${V.MEDIA_LOOP}]) #checked-indicator {
          display: block;
        }
      </style>
      
      <span id="icon">
     </span>

      <div id="checked-indicator">
        <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator">
          <path d="m10 15.17 9.193-9.191 1.414 1.414-10.606 10.606-6.364-6.364 1.414-1.414 4.95 4.95Z"/>
        </svg>
      </div>
    `}function ac(){return oe("Loop")}var sh=class extends ra{constructor(){super(...arguments),this.container=null}static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_LOOP]}connectedCallback(){var i;super.connectedCallback(),this.container=((i=this.shadowRoot)==null?void 0:i.querySelector("#icon"))||null,this.container&&(this.container.textContent=oe("Loop"))}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_LOOP&&this.container&&this.setAttribute("aria-checked",this.mediaLoop?"true":"false")}get mediaLoop(){return Nr(this,V.MEDIA_LOOP)}set mediaLoop(i){Vr(this,V.MEDIA_LOOP,i)}handleClick(){let i=!this.mediaLoop,u=new ie.CustomEvent(Te.MEDIA_LOOP_REQUEST,{composed:!0,bubbles:!0,detail:i});this.dispatchEvent(u)}};sh.getSlotTemplateHTML=nh,sh.getTooltipContentHTML=ac,ie.customElements.get("media-loop-button")||ie.customElements.define("media-loop-button",sh);var sr=Ee(58601),Ri=Ee(56543),em=Ee(56543),$l=Ee(56543);function tm(i){let u="";return Object.entries(i).forEach(([h,E])=>{E!=null&&(u+=`${Td(h)}: ${E}; `)}),u?u.trim():void 0}function Td(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Cf(i){return i.replace(/[-_]([a-z])/g,(u,h)=>h.toUpperCase())}function is(i){if(i==null)return;let u=+i;return Number.isNaN(u)?void 0:u}function nc(i){let u=Df(i).toString();return u?"?"+u:""}function Df(i){let u={};for(let h in i)i[h]!=null&&(u[h]=i[h]);return new URLSearchParams(u)}var oh=(i,u)=>!i||!u?!1:i.contains(u)?!0:oh(i,u.getRootNode().host),Mf="mux.com",Pf=()=>{try{return"3.10.2"}catch(i){}return"UNKNOWN"},rm=Pf(),sc=()=>rm,Of=(i,{token:u,customDomain:h=Mf,thumbnailTime:E,programTime:R}={})=>{var G;let ee=u==null?E:void 0,{aud:ge}=(G=(0,$l.parseJwt)(u))!=null?G:{};if(!(u&&ge!=="t"))return`https://image.${h}/${i}/thumbnail.webp${nc({token:u,time:ee,program_time:R})}`},xf=(i,{token:u,customDomain:h=Mf,programStartTime:E,programEndTime:R}={})=>{var G;let{aud:ee}=(G=(0,$l.parseJwt)(u))!=null?G:{};if(!(u&&ee!=="s"))return`https://image.${h}/${i}/storyboard.vtt${nc({token:u,format:"webp",program_start_time:E,program_end_time:R})}`},lh=i=>{if(i){if([$l.StreamTypes.LIVE,$l.StreamTypes.ON_DEMAND].includes(i))return i;if(i!=null&&i.includes("live"))return $l.StreamTypes.LIVE}},uh={crossorigin:"crossOrigin",playsinline:"playsInline"};function Nf(i){var u;return(u=uh[i])!=null?u:Cf(i)}var il,Nu,Vn,oc=class{constructor(i,u){ae(this,il),ae(this,Nu),ae(this,Vn,[]),dt(this,il,i),dt(this,Nu,u)}[Symbol.iterator](){return Je(this,Vn).values()}get length(){return Je(this,Vn).length}get value(){var i;return(i=Je(this,Vn).join(" "))!=null?i:""}set value(i){var u;i!==this.value&&(dt(this,Vn,[]),this.add(...(u=i==null?void 0:i.split(" "))!=null?u:[]))}toString(){return this.value}item(i){return Je(this,Vn)[i]}values(){return Je(this,Vn).values()}keys(){return Je(this,Vn).keys()}forEach(i){Je(this,Vn).forEach(i)}add(...i){var u,h;i.forEach(E=>{this.contains(E)||Je(this,Vn).push(E)}),!(this.value===""&&!((u=Je(this,il))!=null&&u.hasAttribute(`${Je(this,Nu)}`)))&&((h=Je(this,il))==null||h.setAttribute(`${Je(this,Nu)}`,`${this.value}`))}remove(...i){var u;i.forEach(h=>{Je(this,Vn).splice(Je(this,Vn).indexOf(h),1)}),(u=Je(this,il))==null||u.setAttribute(`${Je(this,Nu)}`,`${this.value}`)}contains(i){return Je(this,Vn).includes(i)}toggle(i,u){return typeof u!="undefined"?u?(this.add(i),!0):(this.remove(i),!1):this.contains(i)?(this.remove(i),!1):(this.add(i),!0)}replace(i,u){this.remove(i),this.add(u)}};il=new WeakMap,Nu=new WeakMap,Vn=new WeakMap;var Uf=`[mux-player ${sc()}]`;function io(...i){console.warn(Uf,...i)}function as(...i){console.error(Uf,...i)}function Ff(i){var u;let h=(u=i.message)!=null?u:"";i.context&&(h+=` ${i.context}`),i.file&&(h+=` ${(0,em.i18n)("Read more: ")}
https://github.com/muxinc/elements/blob/main/errors/${i.file}`),io(h)}var $a={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},al={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Jm=he(he({},$a),al),Bf=Object.freeze({length:0,start(i){let u=i>>>0;if(u>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${u}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(i){let u=i>>>0;if(u>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${u}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),im=Object.values($a).filter(i=>$a.PLAYSINLINE!==i),Hf=Object.values(al),am=[...im,...Hf],nm=class extends ct.HTMLElement{static get observedAttributes(){return am}constructor(){super()}attributeChangedCallback(i,u,h){var E,R;switch(i){case al.MUTED:{this.media&&(this.media.muted=h!=null,this.media.defaultMuted=h!=null);return}case al.VOLUME:{let G=(E=is(h))!=null?E:1;this.media&&(this.media.volume=G);return}case al.PLAYBACKRATE:{let G=(R=is(h))!=null?R:1;this.media&&(this.media.playbackRate=G,this.media.defaultPlaybackRate=G);return}}}play(){var i,u;return(u=(i=this.media)==null?void 0:i.play())!=null?u:Promise.reject()}pause(){var i;(i=this.media)==null||i.pause()}load(){var i;(i=this.media)==null||i.load()}get media(){var i;return(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var i,u;return(u=(i=this.media)==null?void 0:i.paused)!=null?u:!0}get duration(){var i,u;return(u=(i=this.media)==null?void 0:i.duration)!=null?u:NaN}get ended(){var i,u;return(u=(i=this.media)==null?void 0:i.ended)!=null?u:!1}get buffered(){var i,u;return(u=(i=this.media)==null?void 0:i.buffered)!=null?u:Bf}get seekable(){var i,u;return(u=(i=this.media)==null?void 0:i.seekable)!=null?u:Bf}get readyState(){var i,u;return(u=(i=this.media)==null?void 0:i.readyState)!=null?u:0}get videoWidth(){var i,u;return(u=(i=this.media)==null?void 0:i.videoWidth)!=null?u:0}get videoHeight(){var i,u;return(u=(i=this.media)==null?void 0:i.videoHeight)!=null?u:0}get currentSrc(){var i,u;return(u=(i=this.media)==null?void 0:i.currentSrc)!=null?u:""}get currentTime(){var i,u;return(u=(i=this.media)==null?void 0:i.currentTime)!=null?u:0}set currentTime(i){this.media&&(this.media.currentTime=Number(i))}get volume(){var i,u;return(u=(i=this.media)==null?void 0:i.volume)!=null?u:1}set volume(i){this.media&&(this.media.volume=Number(i))}get playbackRate(){var i,u;return(u=(i=this.media)==null?void 0:i.playbackRate)!=null?u:1}set playbackRate(i){this.media&&(this.media.playbackRate=Number(i))}get defaultPlaybackRate(){var i;return(i=is(this.getAttribute(al.PLAYBACKRATE)))!=null?i:1}set defaultPlaybackRate(i){i!=null?this.setAttribute(al.PLAYBACKRATE,`${i}`):this.removeAttribute(al.PLAYBACKRATE)}get crossOrigin(){return _d(this,$a.CROSSORIGIN)}set crossOrigin(i){this.setAttribute($a.CROSSORIGIN,`${i}`)}get autoplay(){return _d(this,$a.AUTOPLAY)!=null}set autoplay(i){i?this.setAttribute($a.AUTOPLAY,typeof i=="string"?i:""):this.removeAttribute($a.AUTOPLAY)}get loop(){return _d(this,$a.LOOP)!=null}set loop(i){i?this.setAttribute($a.LOOP,""):this.removeAttribute($a.LOOP)}get muted(){var i,u;return(u=(i=this.media)==null?void 0:i.muted)!=null?u:!1}set muted(i){this.media&&(this.media.muted=!!i)}get defaultMuted(){return _d(this,$a.MUTED)!=null}set defaultMuted(i){i?this.setAttribute($a.MUTED,""):this.removeAttribute($a.MUTED)}get playsInline(){return _d(this,$a.PLAYSINLINE)!=null}set playsInline(i){as("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(i){["","none","metadata","auto"].includes(i)?this.setAttribute($a.PRELOAD,i):this.removeAttribute($a.PRELOAD)}};function _d(i,u){return i.media?i.media.getAttribute(u):i.getAttribute(u)}var Vf=nm,Gf=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},ai=(i,u,h)=>(Gf(i,u,"read from private field"),h?h.call(i):u.get(i)),Fs=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},wo=(i,u,h,E)=>(Gf(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),Uu,lc,ql,jl,nl,Bs,sl,zl,Fu,uc,gs,dh=1,Ad=0,sm=1,ch={processCallback(i,u,h){if(h){for(let[E,R]of u)if(E in h){let G=h[E];typeof G=="boolean"&&R instanceof Hs&&typeof R.element[R.attributeName]=="boolean"?R.booleanValue=G:typeof G=="function"&&R instanceof Hs?R.element[R.attributeName]=G:R.value=G}}}},Bu=class extends ie.DocumentFragment{constructor(i,u,h=ch){var E;super(),Fs(this,Uu,void 0),Fs(this,lc,void 0),this.append(i.content.cloneNode(!0)),wo(this,Uu,Sd(this)),wo(this,lc,h),(E=h.createCallback)==null||E.call(h,this,ai(this,Uu),u),h.processCallback(this,ai(this,Uu),u)}update(i){ai(this,lc).processCallback(this,ai(this,Uu),i)}};Uu=new WeakMap,lc=new WeakMap;var Sd=(i,u=[])=>{let h,E;for(let R of i.attributes||[])if(R.value.includes("{{")){let G=new Yf;for([h,E]of Wf(R.value))if(!h)G.append(E);else{let ee=new Hs(i,R.name,R.namespaceURI);G.append(ee),u.push([E,ee])}R.value=G.toString()}for(let R of i.childNodes)if(R.nodeType===dh&&!(R instanceof HTMLTemplateElement))Sd(R,u);else{let G=R.data;if(R.nodeType===dh||G.includes("{{")){let ee=[];if(G)for([h,E]of Wf(G))if(!h)ee.push(new Text(E));else{let ge=new Hu(i);ee.push(ge),u.push([E,ge])}else if(R instanceof HTMLTemplateElement){let ge=new $f(i,R);ee.push(ge),u.push([ge.expression,ge])}R.replaceWith(...ee.flatMap(ge=>ge.replacementNodes||[ge]))}}return u},Kf={},Wf=i=>{let u="",h=0,E=Kf[i],R=0,G;if(E)return E;for(E=[];G=i[R];R++)G==="{"&&i[R+1]==="{"&&i[R-1]!=="\\"&&i[R+2]&&++h==1?(u&&E.push([Ad,u]),u="",R++):G==="}"&&i[R+1]==="}"&&i[R-1]!=="\\"&&!--h?(E.push([sm,u.trim()]),u="",R++):u+=G||"";return u&&E.push([Ad,(h>0?"{{":"")+u]),Kf[i]=E},om=11,hh=class{get value(){return""}set value(i){}toString(){return this.value}},fh=new WeakMap,Yf=class{constructor(){Fs(this,ql,[])}[Symbol.iterator](){return ai(this,ql).values()}get length(){return ai(this,ql).length}item(i){return ai(this,ql)[i]}append(...i){for(let u of i)u instanceof Hs&&fh.set(u,this),ai(this,ql).push(u)}toString(){return ai(this,ql).join("")}};ql=new WeakMap;var Hs=class extends hh{constructor(i,u,h){super(),Fs(this,zl),Fs(this,jl,""),Fs(this,nl,void 0),Fs(this,Bs,void 0),Fs(this,sl,void 0),wo(this,nl,i),wo(this,Bs,u),wo(this,sl,h)}get attributeName(){return ai(this,Bs)}get attributeNamespace(){return ai(this,sl)}get element(){return ai(this,nl)}get value(){return ai(this,jl)}set value(i){ai(this,jl)!==i&&(wo(this,jl,i),!ai(this,zl,Fu)||ai(this,zl,Fu).length===1?i==null?ai(this,nl).removeAttributeNS(ai(this,sl),ai(this,Bs)):ai(this,nl).setAttributeNS(ai(this,sl),ai(this,Bs),i):ai(this,nl).setAttributeNS(ai(this,sl),ai(this,Bs),ai(this,zl,Fu).toString()))}get booleanValue(){return ai(this,nl).hasAttributeNS(ai(this,sl),ai(this,Bs))}set booleanValue(i){if(!ai(this,zl,Fu)||ai(this,zl,Fu).length===1)this.value=i?"":null;else throw new DOMException("Value is not fully templatized")}};jl=new WeakMap,nl=new WeakMap,Bs=new WeakMap,sl=new WeakMap,zl=new WeakSet,Fu=function(){return fh.get(this)};var Hu=class extends hh{constructor(i,u){super(),Fs(this,uc,void 0),Fs(this,gs,void 0),wo(this,uc,i),wo(this,gs,u?[...u]:[new Text])}get replacementNodes(){return ai(this,gs)}get parentNode(){return ai(this,uc)}get nextSibling(){return ai(this,gs)[ai(this,gs).length-1].nextSibling}get previousSibling(){return ai(this,gs)[0].previousSibling}get value(){return ai(this,gs).map(i=>i.textContent).join("")}set value(i){this.replace(i)}replace(...i){let u=i.flat().flatMap(h=>h==null?[new Text]:h.forEach?[...h]:h.nodeType===om?[...h.childNodes]:h.nodeType?[h]:[new Text(h)]);u.length||u.push(new Text),wo(this,gs,lm(ai(this,gs)[0].parentNode,ai(this,gs),u,this.nextSibling))}};uc=new WeakMap,gs=new WeakMap;var $f=class extends Hu{constructor(i,u){let h=u.getAttribute("directive")||u.getAttribute("type"),E=u.getAttribute("expression")||u.getAttribute(h)||"";E.startsWith("{{")&&(E=E.trim().slice(2,-2).trim()),super(i),this.expression=E,this.template=u,this.directive=h}};function lm(i,u,h,E=null){let R=0,G,ee,ge,_t=h.length,It=u.length;for(;R<_t&&R<It&&u[R]==h[R];)R++;for(;R<_t&&R<It&&h[_t-1]==u[It-1];)E=h[--It,--_t];if(R==It)for(;R<_t;)i.insertBefore(h[R++],E);if(R==_t)for(;R<It;)i.removeChild(u[R++]);else{for(G=u[R];R<_t;)ge=h[R++],ee=G?G.nextSibling:E,G==ge?G=ee:R<_t&&h[R]==ee?(i.replaceChild(ge,G),G=ee):i.insertBefore(ge,G);for(;G!=E;)ee=G.nextSibling,i.removeChild(G),G=ee}return h}var qf={string:i=>String(i)},dc=class{constructor(i){this.template=i,this.state=void 0}},ol=new WeakMap,Co=new WeakMap,vh={partial:(i,u)=>{u[i.expression]=new dc(i.template)},if:(i,u)=>{var h;if(r(i.expression,u))if(ol.get(i)!==i.template){ol.set(i,i.template);let E=new Bu(i.template,u,s);i.replace(E),Co.set(i,E)}else(h=Co.get(i))==null||h.update(u);else i.replace(""),ol.delete(i),Co.delete(i)}},jf=Object.keys(vh),s={processCallback(i,u,h){var E,R;if(h)for(let[G,ee]of u){if(ee instanceof $f){if(!ee.directive){let _t=jf.find(It=>ee.template.hasAttribute(It));_t&&(ee.directive=_t,ee.expression=ee.template.getAttribute(_t))}(E=vh[ee.directive])==null||E.call(vh,ee,h);continue}let ge=r(G,h);if(ge instanceof dc){ol.get(ee)!==ge.template?(ol.set(ee,ge.template),ge=new Bu(ge.template,ge.state,s),ee.value=ge,Co.set(ee,ge)):(R=Co.get(ee))==null||R.update(ge.state);continue}ge?(ee instanceof Hs&&ee.attributeName.startsWith("aria-")&&(ge=String(ge)),ee instanceof Hs?typeof ge=="boolean"?ee.booleanValue=ge:typeof ge=="function"?ee.element[ee.attributeName]=ge:ee.value=ge:(ee.value=ge,ol.delete(ee),Co.delete(ee))):ee instanceof Hs?ee.value=void 0:(ee.value=void 0,ol.delete(ee),Co.delete(ee))}}},l={"!":i=>!i,"!!":i=>!!i,"==":(i,u)=>i==u,"!=":(i,u)=>i!=u,">":(i,u)=>i>u,">=":(i,u)=>i>=u,"<":(i,u)=>i<u,"<=":(i,u)=>i<=u,"??":(i,u)=>i!=null?i:u,"|":(i,u)=>{var h;return(h=qf[u])==null?void 0:h.call(qf,i)}};function n(i){return o(i,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:u})=>u!=="ws")}function r(i,u={}){var h,E,R,G,ee,ge,_t;let It=n(i);if(It.length===0||It.some(({type:Er})=>!Er))return e(i);if(((h=It[0])==null?void 0:h.token)===">"){let Er=u[(E=It[1])==null?void 0:E.token];if(!Er)return e(i);let ar=he({},u);Er.state=ar;let nr=It.slice(2);for(let rr=0;rr<nr.length;rr+=3){let Mr=(R=nr[rr])==null?void 0:R.token,Zr=(G=nr[rr+1])==null?void 0:G.token,mi=(ee=nr[rr+2])==null?void 0:ee.token;Mr&&Zr==="="&&(ar[Mr]=a(mi,u))}return Er}if(It.length===1)return t(It[0])?a(It[0].token,u):e(i);if(It.length===2){let Er=(ge=It[0])==null?void 0:ge.token,ar=l[Er];if(!ar||!t(It[1]))return e(i);let nr=a(It[1].token,u);return ar(nr)}if(It.length===3){let Er=(_t=It[1])==null?void 0:_t.token,ar=l[Er];if(!ar||!t(It[0])||!t(It[2]))return e(i);let nr=a(It[0].token,u);if(Er==="|")return ar(nr,It[2].token);let rr=a(It[2].token,u);return ar(nr,rr)}}function e(i){return console.warn(`Warning: invalid expression \`${i}\``),!1}function t({type:i}){return["number","boolean","string","param"].includes(i)}function a(i,u){let h=i[0],E=i.slice(-1);return i==="true"||i==="false"?i==="true":h===E&&["'",'"'].includes(h)?i.slice(1,-1):Pt(i)?parseFloat(i):u[i]}function o(i,u){let h,E,R,G=[];for(;i;){R=null,h=i.length;for(let ee in u)E=u[ee].exec(i),E&&E.index<h&&(R={token:E[0],type:ee,matches:E.slice(1)},h=E.index);h&&G.push({token:i.substr(0,h),type:void 0}),R&&G.push(R),i=i.substr(h+(R?R.token.length:0))}return G}var d=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},c=(i,u,h)=>(d(i,u,"read from private field"),h?h.call(i):u.get(i)),f=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},v=(i,u,h,E)=>(d(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),m=(i,u,h)=>(d(i,u,"access private method"),h),g,y,b,S,L,C,F,N={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},B=er.createElement("template");B.innerHTML=`
  <style>
    :host {
      display: inline-block;
      line-height: 0;
    }

    media-controller {
      width: 100%;
      height: 100%;
    }

    media-captions-button:not([mediasubtitleslist]),
    media-captions-menu:not([mediasubtitleslist]),
    media-captions-menu-button:not([mediasubtitleslist]),
    media-audio-track-menu[mediaaudiotrackunavailable],
    media-audio-track-menu-button[mediaaudiotrackunavailable],
    media-rendition-menu[mediarenditionunavailable],
    media-rendition-menu-button[mediarenditionunavailable],
    media-volume-range[mediavolumeunavailable],
    media-airplay-button[mediaairplayunavailable],
    media-fullscreen-button[mediafullscreenunavailable],
    media-cast-button[mediacastunavailable],
    media-pip-button[mediapipunavailable] {
      display: none;
    }
  </style>
`;var re=class extends ie.HTMLElement{constructor(){super(),f(this,S),f(this,C),f(this,g,void 0),f(this,y,void 0),f(this,b,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());let i=new MutationObserver(u=>{var h;this.mediaController&&!((h=this.mediaController)!=null&&h.breakpointsComputed)||u.some(E=>{let R=E.target;return R===this?!0:R.localName!=="media-controller"?!1:!!(N[E.attributeName]||E.attributeName.startsWith("breakpoint"))})&&this.render()});i.observe(this,{attributes:!0}),i.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.addEventListener(Br.BREAKPOINTS_COMPUTED,this.render),m(this,S,L).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var i;return(i=c(this,g))!=null?i:this.constructor.template}set template(i){if(i===null){this.removeAttribute("template");return}typeof i=="string"?this.setAttribute("template",i):i instanceof HTMLTemplateElement&&(v(this,g,i),v(this,b,null),this.createRenderer())}get props(){var i,u,h;let E=[...Array.from((u=(i=this.mediaController)==null?void 0:i.attributes)!=null?u:[]).filter(({name:G})=>N[G]||G.startsWith("breakpoint")),...Array.from(this.attributes)],R={};for(let G of E){let ee=(h=N[G.name])!=null?h:Oe(G.name),{value:ge}=G;ge!=null?(Pt(ge)&&(ge=parseFloat(ge)),R[ee]=ge===""?!0:ge):R[ee]=!1}return R}attributeChangedCallback(i,u,h){i==="template"&&u!=h&&m(this,C,F).call(this)}connectedCallback(){m(this,C,F).call(this)}createRenderer(){this.template instanceof HTMLTemplateElement&&this.template!==c(this,y)&&(v(this,y,this.template),this.renderer=new Bu(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(B.content.cloneNode(!0),this.renderer))}render(){var i;(i=this.renderer)==null||i.update(this.props)}};g=new WeakMap,y=new WeakMap,b=new WeakMap,S=new WeakSet,L=function(i){if(Object.prototype.hasOwnProperty.call(this,i)){let u=this[i];delete this[i],this[i]=u}},C=new WeakSet,F=function(){var i;let u=this.getAttribute("template");if(!u||u===c(this,b))return;let h=this.getRootNode(),E=(i=h==null?void 0:h.getElementById)==null?void 0:i.call(h,u);if(E){v(this,b,u),v(this,g,E),this.createRenderer();return}ce(u)&&(v(this,b,u),Se(u).then(R=>{let G=er.createElement("template");G.innerHTML=R,v(this,g,G),this.createRenderer()}).catch(console.error))},re.observedAttributes=["template"],re.processor=s;function ce(i){if(!/^(\/|\.\/|https?:\/\/)/.test(i))return!1;let u=/^https?:\/\//.test(i)?void 0:location.origin;try{new URL(i,u)}catch(h){return!1}return!0}function Se(i){return j(this,null,function*(){let u=yield fetch(i);if(u.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${u.status}`);return u.text()})}ie.customElements.get("media-theme")||ie.customElements.define("media-theme",re);var Ke=`:host {
  --media-control-display: var(--controls);
  --media-loading-indicator-display: var(--loading-indicator);
  --media-dialog-display: var(--dialog);
  --media-play-button-display: var(--play-button);
  --media-live-button-display: var(--live-button);
  --media-seek-backward-button-display: var(--seek-backward-button);
  --media-seek-forward-button-display: var(--seek-forward-button);
  --media-mute-button-display: var(--mute-button);
  --media-captions-button-display: var(--captions-button);
  --media-captions-menu-button-display: var(--captions-menu-button, var(--media-captions-button-display));
  --media-rendition-menu-button-display: var(--rendition-menu-button);
  --media-audio-track-menu-button-display: var(--audio-track-menu-button);
  --media-airplay-button-display: var(--airplay-button);
  --media-pip-button-display: var(--pip-button);
  --media-fullscreen-button-display: var(--fullscreen-button);
  --media-cast-button-display: var(--cast-button, var(--_cast-button-drm-display));
  --media-playback-rate-button-display: var(--playback-rate-button);
  --media-playback-rate-menu-button-display: var(--playback-rate-menu-button);
  --media-volume-range-display: var(--volume-range);
  --media-time-range-display: var(--time-range);
  --media-time-display-display: var(--time-display);
  --media-duration-display-display: var(--duration-display);
  --media-title-display-display: var(--title-display);

  display: inline-block;
  line-height: 0;
  width: 100%;
}

a {
  color: #fff;
  font-size: 0.9em;
  text-decoration: underline;
}

media-theme {
  display: inline-block;
  line-height: 0;
  width: 100%;
  height: 100%;
  direction: ltr;
}

media-poster-image {
  display: inline-block;
  line-height: 0;
  width: 100%;
  height: 100%;
}

media-poster-image:not([src]):not([placeholdersrc]) {
  display: none;
}

::part(top),
[part~='top'] {
  --media-control-display: var(--controls, var(--top-controls));
  --media-play-button-display: var(--play-button, var(--top-play-button));
  --media-live-button-display: var(--live-button, var(--top-live-button));
  --media-seek-backward-button-display: var(--seek-backward-button, var(--top-seek-backward-button));
  --media-seek-forward-button-display: var(--seek-forward-button, var(--top-seek-forward-button));
  --media-mute-button-display: var(--mute-button, var(--top-mute-button));
  --media-captions-button-display: var(--captions-button, var(--top-captions-button));
  --media-captions-menu-button-display: var(
    --captions-menu-button,
    var(--media-captions-button-display, var(--top-captions-menu-button))
  );
  --media-rendition-menu-button-display: var(--rendition-menu-button, var(--top-rendition-menu-button));
  --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--top-audio-track-menu-button));
  --media-airplay-button-display: var(--airplay-button, var(--top-airplay-button));
  --media-pip-button-display: var(--pip-button, var(--top-pip-button));
  --media-fullscreen-button-display: var(--fullscreen-button, var(--top-fullscreen-button));
  --media-cast-button-display: var(--cast-button, var(--top-cast-button, var(--_cast-button-drm-display)));
  --media-playback-rate-button-display: var(--playback-rate-button, var(--top-playback-rate-button));
  --media-playback-rate-menu-button-display: var(
    --captions-menu-button,
    var(--media-playback-rate-button-display, var(--top-playback-rate-menu-button))
  );
  --media-volume-range-display: var(--volume-range, var(--top-volume-range));
  --media-time-range-display: var(--time-range, var(--top-time-range));
  --media-time-display-display: var(--time-display, var(--top-time-display));
  --media-duration-display-display: var(--duration-display, var(--top-duration-display));
  --media-title-display-display: var(--title-display, var(--top-title-display));
}

::part(center),
[part~='center'] {
  --media-control-display: var(--controls, var(--center-controls));
  --media-play-button-display: var(--play-button, var(--center-play-button));
  --media-live-button-display: var(--live-button, var(--center-live-button));
  --media-seek-backward-button-display: var(--seek-backward-button, var(--center-seek-backward-button));
  --media-seek-forward-button-display: var(--seek-forward-button, var(--center-seek-forward-button));
  --media-mute-button-display: var(--mute-button, var(--center-mute-button));
  --media-captions-button-display: var(--captions-button, var(--center-captions-button));
  --media-captions-menu-button-display: var(
    --captions-menu-button,
    var(--media-captions-button-display, var(--center-captions-menu-button))
  );
  --media-rendition-menu-button-display: var(--rendition-menu-button, var(--center-rendition-menu-button));
  --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--center-audio-track-menu-button));
  --media-airplay-button-display: var(--airplay-button, var(--center-airplay-button));
  --media-pip-button-display: var(--pip-button, var(--center-pip-button));
  --media-fullscreen-button-display: var(--fullscreen-button, var(--center-fullscreen-button));
  --media-cast-button-display: var(--cast-button, var(--center-cast-button, var(--_cast-button-drm-display)));
  --media-playback-rate-button-display: var(--playback-rate-button, var(--center-playback-rate-button));
  --media-playback-rate-menu-button-display: var(
    --playback-rate-menu-button,
    var(--media-playback-rate-button-display, var(--center-playback-rate-menu-button))
  );
  --media-volume-range-display: var(--volume-range, var(--center-volume-range));
  --media-time-range-display: var(--time-range, var(--center-time-range));
  --media-time-display-display: var(--time-display, var(--center-time-display));
  --media-duration-display-display: var(--duration-display, var(--center-duration-display));
}

::part(bottom),
[part~='bottom'] {
  --media-control-display: var(--controls, var(--bottom-controls));
  --media-play-button-display: var(--play-button, var(--bottom-play-button));
  --media-live-button-display: var(--live-button, var(--bottom-live-button));
  --media-seek-backward-button-display: var(--seek-backward-button, var(--bottom-seek-backward-button));
  --media-seek-forward-button-display: var(--seek-forward-button, var(--bottom-seek-forward-button));
  --media-mute-button-display: var(--mute-button, var(--bottom-mute-button));
  --media-captions-button-display: var(--captions-button, var(--bottom-captions-button));
  --media-captions-menu-button-display: var(
    --captions-menu-button,
    var(--media-captions-button-display, var(--bottom-captions-menu-button))
  );
  --media-rendition-menu-button-display: var(--rendition-menu-button, var(--bottom-rendition-menu-button));
  --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--bottom-audio-track-menu-button));
  --media-airplay-button-display: var(--airplay-button, var(--bottom-airplay-button));
  --media-pip-button-display: var(--pip-button, var(--bottom-pip-button));
  --media-fullscreen-button-display: var(--fullscreen-button, var(--bottom-fullscreen-button));
  --media-cast-button-display: var(--cast-button, var(--bottom-cast-button, var(--_cast-button-drm-display)));
  --media-playback-rate-button-display: var(--playback-rate-button, var(--bottom-playback-rate-button));
  --media-playback-rate-menu-button-display: var(
    --playback-rate-menu-button,
    var(--media-playback-rate-button-display, var(--bottom-playback-rate-menu-button))
  );
  --media-volume-range-display: var(--volume-range, var(--bottom-volume-range));
  --media-time-range-display: var(--time-range, var(--bottom-time-range));
  --media-time-display-display: var(--time-display, var(--bottom-time-display));
  --media-duration-display-display: var(--duration-display, var(--bottom-duration-display));
  --media-title-display-display: var(--title-display, var(--bottom-title-display));
}

:host([no-tooltips]) {
  --media-tooltip-display: none;
}
`,be=new WeakMap,Z=class Zp{constructor(u,h){this.element=u,this.type=h,this.element.addEventListener(this.type,this);let E=be.get(this.element);E&&E.set(this.type,this)}set(u){if(typeof u=="function")this.handleEvent=u.bind(this.element);else if(typeof u=="object"&&typeof u.handleEvent=="function")this.handleEvent=u.handleEvent.bind(u);else{this.element.removeEventListener(this.type,this);let h=be.get(this.element);h&&h.delete(this.type)}}static for(u){be.has(u.element)||be.set(u.element,new Map);let h=u.attributeName.slice(2),E=be.get(u.element);return E&&E.has(h)?E.get(h):new Zp(u.element,h)}};function ne(i,u){return i instanceof Hs&&i.attributeName.startsWith("on")?(Z.for(i).set(u),i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),!0):!1}function Re(i,u){return u instanceof lr&&i instanceof Hu?(u.renderInto(i),!0):!1}function Tt(i,u){return u instanceof DocumentFragment&&i instanceof Hu?(u.childNodes.length&&i.replace(...u.childNodes),!0):!1}function ot(i,u){if(i instanceof Hs){let h=i.attributeNamespace,E=i.element.getAttributeNS(h,i.attributeName);return String(u)!==E&&(i.value=String(u)),!0}return i.value=String(u),!0}function pt(i,u){if(i instanceof Hs&&u instanceof Element){let h=i.element;return h[i.attributeName]!==u&&(i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),h[i.attributeName]=u),!0}return!1}function Bt(i,u){if(typeof u=="boolean"&&i instanceof Hs){let h=i.attributeNamespace,E=i.element.hasAttributeNS(h,i.attributeName);return u!==E&&(i.booleanValue=u),!0}return!1}function cr(i,u){return u===!1&&i instanceof Hu?(i.replace(""),!0):!1}function or(i,u){pt(i,u)||Bt(i,u)||ne(i,u)||cr(i,u)||Re(i,u)||Tt(i,u)||ot(i,u)}var hr=new Map,xr=new WeakMap,fr=new WeakMap,lr=class{constructor(i,u,h){this.strings=i,this.values=u,this.processor=h,this.stringsKey=this.strings.join("")}get template(){if(hr.has(this.stringsKey))return hr.get(this.stringsKey);{let i=_e.createElement("template"),u=this.strings.length-1;return i.innerHTML=this.strings.reduce((h,E,R)=>h+E+(R<u?`{{ ${R} }}`:""),""),hr.set(this.stringsKey,i),i}}renderInto(i){var u;let h=this.template;if(xr.get(i)!==h){xr.set(i,h);let R=new Bu(h,this.values,this.processor);fr.set(i,R),i instanceof Hu?i.replace(...R.children):i.appendChild(R);return}let E=fr.get(i);(u=E==null?void 0:E.update)==null||u.call(E,this.values)}},_r={processCallback(i,u,h){var E;if(h){for(let[R,G]of u)if(R in h){let ee=(E=h[R])!=null?E:"";or(G,ee)}}}};function Dr(i,...u){return new lr(i,u,_r)}function bi(i,u){i.renderInto(u)}var jr=Ee(56543),ji=i=>{let{tokens:u}=i;return u.drm?":host(:not([cast-receiver])) { --_cast-button-drm-display: none; }":""},ia=i=>Dr`
  <style>
    ${ji(i)}
    ${Ke}
  </style>
  ${si(i)}
`,Fi=i=>{let u=i.hotKeys?`${i.hotKeys}`:"";return lh(i.streamType)==="live"&&(u+=" noarrowleft noarrowright"),u},sn={TOP:"top",CENTER:"center",BOTTOM:"bottom",LAYER:"layer",MEDIA_LAYER:"media-layer",POSTER_LAYER:"poster-layer",VERTICAL_LAYER:"vertical-layer",CENTERED_LAYER:"centered-layer",GESTURE_LAYER:"gesture-layer",CONTROLLER_LAYER:"controller",BUTTON:"button",RANGE:"range",THUMB:"thumb",DISPLAY:"display",CONTROL_BAR:"control-bar",MENU_BUTTON:"menu-button",MENU:"menu",MENU_ITEM:"menu-item",OPTION:"option",POSTER:"poster",LIVE:"live",PLAY:"play",PRE_PLAY:"pre-play",SEEK_BACKWARD:"seek-backward",SEEK_FORWARD:"seek-forward",MUTE:"mute",CAPTIONS:"captions",AIRPLAY:"airplay",PIP:"pip",FULLSCREEN:"fullscreen",CAST:"cast",PLAYBACK_RATE:"playback-rate",VOLUME:"volume",TIME:"time",TITLE:"title",AUDIO_TRACK:"audio-track",RENDITION:"rendition"},Gi=Object.values(sn).join(", "),si=i=>{var u,h,E,R,G,ee,ge,_t,It,Er,ar,nr,rr,Mr,Zr,mi,Aa,os,vl,su,Mh,Ph,Oh,xh,Nh,Uh,Fh,Bh,Hh,Vh,Gh,Kh,Lv,ou,Wh,Yh,$h,qh;return Dr`
  <media-theme
    template="${i.themeTemplate||!1}"
    defaultstreamtype="${(u=i.defaultStreamType)!=null?u:!1}"
    hotkeys="${Fi(i)||!1}"
    nohotkeys="${i.noHotKeys||!i.hasSrc||!1}"
    noautoseektolive="${!!((h=i.streamType)!=null&&h.includes(jr.StreamTypes.LIVE))&&i.targetLiveWindow!==0}"
    novolumepref="${i.novolumepref||!1}"
    nomutedpref="${i.nomutedpref||!1}"
    disabled="${!i.hasSrc||i.isDialogOpen}"
    audio="${(E=i.audio)!=null?E:!1}"
    style="${(R=tm({"--media-primary-color":i.primaryColor,"--media-secondary-color":i.secondaryColor,"--media-accent-color":i.accentColor}))!=null?R:!1}"
    defaultsubtitles="${!i.defaultHiddenCaptions}"
    forwardseekoffset="${(G=i.forwardSeekOffset)!=null?G:!1}"
    backwardseekoffset="${(ee=i.backwardSeekOffset)!=null?ee:!1}"
    playbackrates="${(ge=i.playbackRates)!=null?ge:!1}"
    defaultshowremainingtime="${(_t=i.defaultShowRemainingTime)!=null?_t:!1}"
    defaultduration="${(It=i.defaultDuration)!=null?It:!1}"
    hideduration="${(Er=i.hideDuration)!=null?Er:!1}"
    title="${(ar=i.title)!=null?ar:!1}"
    videotitle="${(nr=i.videoTitle)!=null?nr:!1}"
    proudlydisplaymuxbadge="${(rr=i.proudlyDisplayMuxBadge)!=null?rr:!1}"
    exportparts="${Gi}"
    onclose="${i.onCloseErrorDialog}"
    onfocusin="${i.onFocusInErrorDialog}"
  >
    <mux-video
      slot="media"
      inert="${(Mr=i.noHotKeys)!=null?Mr:!1}"
      target-live-window="${(Zr=i.targetLiveWindow)!=null?Zr:!1}"
      stream-type="${(mi=lh(i.streamType))!=null?mi:!1}"
      crossorigin="${(Aa=i.crossOrigin)!=null?Aa:""}"
      playsinline
      autoplay="${(os=i.autoplay)!=null?os:!1}"
      muted="${(vl=i.muted)!=null?vl:!1}"
      loop="${(su=i.loop)!=null?su:!1}"
      preload="${(Mh=i.preload)!=null?Mh:!1}"
      debug="${(Ph=i.debug)!=null?Ph:!1}"
      prefer-cmcd="${(Oh=i.preferCmcd)!=null?Oh:!1}"
      disable-tracking="${(xh=i.disableTracking)!=null?xh:!1}"
      disable-cookies="${(Nh=i.disableCookies)!=null?Nh:!1}"
      prefer-playback="${(Uh=i.preferPlayback)!=null?Uh:!1}"
      start-time="${i.startTime!=null?i.startTime:!1}"
      beacon-collection-domain="${(Fh=i.beaconCollectionDomain)!=null?Fh:!1}"
      player-init-time="${(Bh=i.playerInitTime)!=null?Bh:!1}"
      player-software-name="${(Hh=i.playerSoftwareName)!=null?Hh:!1}"
      player-software-version="${(Vh=i.playerSoftwareVersion)!=null?Vh:!1}"
      env-key="${(Gh=i.envKey)!=null?Gh:!1}"
      custom-domain="${(Kh=i.customDomain)!=null?Kh:!1}"
      src="${i.src?i.src:i.playbackId?(0,jr.toMuxVideoURL)(i):!1}"
      cast-src="${i.src?i.src:i.playbackId?(0,jr.toMuxVideoURL)(i):!1}"
      cast-receiver="${(Lv=i.castReceiver)!=null?Lv:!1}"
      drm-token="${(Wh=(ou=i.tokens)==null?void 0:ou.drm)!=null?Wh:!1}"
      exportparts="video"
      disable-pseudo-ended="${(Yh=i.disablePseudoEnded)!=null?Yh:!1}"
      max-auto-resolution="${($h=i.maxAutoResolution)!=null?$h:!1}"
    >
      ${i.storyboard?Dr`<track label="thumbnails" default kind="metadata" src="${i.storyboard}" />`:Dr``}
      <slot></slot>
    </mux-video>
    <slot name="poster" slot="poster">
      <media-poster-image
        part="poster"
        exportparts="poster, img"
        src="${i.poster?i.poster:!1}"
        placeholdersrc="${(qh=i.placeholder)!=null?qh:!1}"
      ></media-poster-image>
    </slot>
  </media-theme>
`},ir=Ee(56543),qa=i=>i.charAt(0).toUpperCase()+i.slice(1),Da=(i,u=!1)=>{var h,E;if(i.muxCode){let R=qa((h=i.errorCategory)!=null?h:"video"),G=(0,ir.errorCategoryToTokenNameOrPrefix)((E=i.errorCategory)!=null?E:ir.MuxErrorCategory.VIDEO);if(i.muxCode===ir.MuxErrorCode.NETWORK_OFFLINE)return(0,ir.i18n)("Your device appears to be offline",u);if(i.muxCode===ir.MuxErrorCode.NETWORK_TOKEN_EXPIRED)return(0,ir.i18n)("{category} URL has expired",u).format({category:R});if([ir.MuxErrorCode.NETWORK_TOKEN_SUB_MISMATCH,ir.MuxErrorCode.NETWORK_TOKEN_AUD_MISMATCH,ir.MuxErrorCode.NETWORK_TOKEN_AUD_MISSING,ir.MuxErrorCode.NETWORK_TOKEN_MALFORMED].includes(i.muxCode))return(0,ir.i18n)("{category} URL is formatted incorrectly",u).format({category:R});if(i.muxCode===ir.MuxErrorCode.NETWORK_TOKEN_MISSING)return(0,ir.i18n)("Invalid {categoryName} URL",u).format({categoryName:G});if(i.muxCode===ir.MuxErrorCode.NETWORK_NOT_FOUND)return(0,ir.i18n)("{category} does not exist",u).format({category:R});if(i.muxCode===ir.MuxErrorCode.NETWORK_NOT_READY){let ee=i.streamType==="live"?"Live stream":"Video";return(0,ir.i18n)("{mediaType} is not currently available",u).format({mediaType:ee})}}if(i.code){if(i.code===ir.MediaError.MEDIA_ERR_NETWORK)return(0,ir.i18n)("Network Error",u);if(i.code===ir.MediaError.MEDIA_ERR_DECODE)return(0,ir.i18n)("Media Error",u);if(i.code===ir.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED)return(0,ir.i18n)("Source Not Supported",u)}return(0,ir.i18n)("Error",u)},Tn=(i,u=!1)=>{var h,E;if(i.muxCode){let R=qa((h=i.errorCategory)!=null?h:"video"),G=(0,ir.errorCategoryToTokenNameOrPrefix)((E=i.errorCategory)!=null?E:ir.MuxErrorCategory.VIDEO);return i.muxCode===ir.MuxErrorCode.NETWORK_OFFLINE?(0,ir.i18n)("Check your internet connection and try reloading this video.",u):i.muxCode===ir.MuxErrorCode.NETWORK_TOKEN_EXPIRED?(0,ir.i18n)("The video\u2019s secured {tokenNamePrefix}-token has expired.",u).format({tokenNamePrefix:G}):i.muxCode===ir.MuxErrorCode.NETWORK_TOKEN_SUB_MISMATCH?(0,ir.i18n)("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",u).format({tokenNamePrefix:G}):i.muxCode===ir.MuxErrorCode.NETWORK_TOKEN_MALFORMED?(0,ir.i18n)("{category} URL is formatted incorrectly",u).format({category:R}):[ir.MuxErrorCode.NETWORK_TOKEN_AUD_MISMATCH,ir.MuxErrorCode.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode)?(0,ir.i18n)("The {tokenNamePrefix}-token is formatted with incorrect information.",u).format({tokenNamePrefix:G}):[ir.MuxErrorCode.NETWORK_TOKEN_MISSING,ir.MuxErrorCode.NETWORK_INVALID_URL].includes(i.muxCode)?(0,ir.i18n)("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",u).format({tokenNamePrefix:G}):i.muxCode===ir.MuxErrorCode.NETWORK_NOT_FOUND?"":i.message}return i.code&&(i.code===ir.MediaError.MEDIA_ERR_NETWORK||i.code===ir.MediaError.MEDIA_ERR_DECODE||(i.code,ir.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED)),i.message},ca=(i,u=!1)=>{let h=Da(i,u).toString(),E=Tn(i,u).toString();return{title:h,message:E}},Pn=i=>{if(i.muxCode){if(i.muxCode===ir.MuxErrorCode.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(i.muxCode===ir.MuxErrorCode.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([ir.MuxErrorCode.NETWORK_TOKEN_AUD_MISMATCH,ir.MuxErrorCode.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode))return"403-incorrect-aud-value.md";if(i.muxCode===ir.MuxErrorCode.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(i.muxCode===ir.MuxErrorCode.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(i.muxCode===ir.MuxErrorCode.NETWORK_NOT_FOUND)return"404-not-found.md";if(i.muxCode===ir.MuxErrorCode.NETWORK_NOT_READY)return"412-not-playable.md"}if(i.code){if(i.code===ir.MediaError.MEDIA_ERR_NETWORK)return"";if(i.code===ir.MediaError.MEDIA_ERR_DECODE)return"media-decode-error.md";if(i.code===ir.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},_n=(i,u)=>{let h=Pn(i);return{message:i.message,context:i.context,file:h}},Ma=`<template id="media-theme-gerwig">
  <style>
    @keyframes pre-play-hide {
      0% {
        transform: scale(1);
        opacity: 1;
      }

      30% {
        transform: scale(0.7);
      }

      100% {
        transform: scale(1.5);
        opacity: 0;
      }
    }

    :host {
      --_primary-color: var(--media-primary-color, #fff);
      --_secondary-color: var(--media-secondary-color, transparent);
      --_accent-color: var(--media-accent-color, #fa50b5);
      --_text-color: var(--media-text-color, #000);

      --media-icon-color: var(--_primary-color);
      --media-control-background: var(--_secondary-color);
      --media-control-hover-background: var(--_accent-color);
      --media-time-buffered-color: rgba(255, 255, 255, 0.4);
      --media-preview-time-text-shadow: none;
      --media-control-height: 14px;
      --media-control-padding: 6px;
      --media-tooltip-container-margin: 6px;
      --media-tooltip-distance: 18px;

      color: var(--_primary-color);
      display: inline-block;
      width: 100%;
      height: 100%;
    }

    :host([audio]) {
      --_secondary-color: var(--media-secondary-color, black);
      --media-preview-time-text-shadow: none;
    }

    :host([audio]) ::slotted([slot='media']) {
      height: 0px;
    }

    :host([audio]) media-loading-indicator {
      display: none;
    }

    :host([audio]) media-controller {
      background: transparent;
    }

    :host([audio]) media-controller::part(vertical-layer) {
      background: transparent;
    }

    :host([audio]) media-control-bar {
      width: 100%;
      background-color: var(--media-control-background);
    }

    /*
     * 0.433s is the transition duration for VTT Regions.
     * Borrowed here, so the captions don't move too fast.
     */
    media-controller {
      --media-webkit-text-track-transform: translateY(0) scale(0.98);
      --media-webkit-text-track-transition: transform 0.433s ease-out 0.3s;
    }
    media-controller:is([mediapaused], :not([userinactive])) {
      --media-webkit-text-track-transform: translateY(-50px) scale(0.98);
      --media-webkit-text-track-transition: transform 0.15s ease;
    }

    /*
     * CSS specific to iOS devices.
     * See: https://stackoverflow.com/questions/30102792/css-media-query-to-target-only-ios-devices/60220757#60220757
     */
    @supports (-webkit-touch-callout: none) {
      /* Disable subtitle adjusting for iOS Safari */
      media-controller[mediaisfullscreen] {
        --media-webkit-text-track-transform: unset;
        --media-webkit-text-track-transition: unset;
      }
    }

    media-time-range {
      --media-box-padding-left: 6px;
      --media-box-padding-right: 6px;
      --media-range-bar-color: var(--_accent-color);
      --media-time-range-buffered-color: var(--_primary-color);
      --media-range-track-color: transparent;
      --media-range-track-background: rgba(255, 255, 255, 0.4);
      --media-range-thumb-background: radial-gradient(
        circle,
        #000 0%,
        #000 25%,
        var(--_accent-color) 25%,
        var(--_accent-color)
      );
      --media-range-thumb-width: 12px;
      --media-range-thumb-height: 12px;
      --media-range-thumb-transform: scale(0);
      --media-range-thumb-transition: transform 0.3s;
      --media-range-thumb-opacity: 1;
      --media-preview-background: var(--_primary-color);
      --media-box-arrow-background: var(--_primary-color);
      --media-preview-thumbnail-border: 5px solid var(--_primary-color);
      --media-preview-border-radius: 5px;
      --media-text-color: var(--_text-color);
      --media-control-hover-background: transparent;
      --media-preview-chapter-text-shadow: none;
      color: var(--_accent-color);
      padding: 0 6px;
    }

    :host([audio]) media-time-range {
      --media-preview-time-padding: 1.5px 6px;
      --media-preview-box-margin: 0 0 -5px;
    }

    media-time-range:hover {
      --media-range-thumb-transform: scale(1);
    }

    media-preview-thumbnail {
      border-bottom-width: 0;
    }

    [part~='menu'] {
      border-radius: 2px;
      border: 1px solid rgba(0, 0, 0, 0.1);
      bottom: 50px;
      padding: 2.5px 10px;
    }

    [part~='menu']::part(indicator) {
      fill: var(--_accent-color);
    }

    [part~='menu']::part(menu-item) {
      box-sizing: border-box;
      display: flex;
      align-items: center;
      padding: 6px 10px;
      min-height: 34px;
    }

    [part~='menu']::part(checked) {
      font-weight: 700;
    }

    media-captions-menu,
    media-rendition-menu,
    media-audio-track-menu,
    media-playback-rate-menu {
      position: absolute; /* ensure they don't take up space in DOM on load */
      --media-menu-background: var(--_primary-color);
      --media-menu-item-checked-background: transparent;
      --media-text-color: var(--_text-color);
      --media-menu-item-hover-background: transparent;
      --media-menu-item-hover-outline: var(--_accent-color) solid 1px;
    }

    media-rendition-menu {
      min-width: 140px;
    }

    /* The icon is a circle so make it 16px high instead of 14px for more balance. */
    media-audio-track-menu-button {
      --media-control-padding: 5px;
      --media-control-height: 16px;
    }

    media-playback-rate-menu-button {
      --media-control-padding: 6px 3px;
      min-width: 4.4ch;
    }

    media-playback-rate-menu {
      --media-menu-flex-direction: row;
      --media-menu-item-checked-background: var(--_accent-color);
      --media-menu-item-checked-indicator-display: none;
      margin-right: 6px;
      padding: 0;
      --media-menu-gap: 0.25em;
    }

    media-playback-rate-menu[part~='menu']::part(menu-item) {
      padding: 6px 6px 6px 8px;
    }

    media-playback-rate-menu[part~='menu']::part(checked) {
      color: #fff;
    }

    :host(:not([audio])) media-time-range {
      /* Adding px is required here for calc() */
      --media-range-padding: 0px;
      background: transparent;
      z-index: 10;
      height: 10px;
      bottom: -3px;
      width: 100%;
    }

    media-control-bar :is([role='button'], [role='switch'], button) {
      line-height: 0;
    }

    media-control-bar :is([part*='button'], [part*='range'], [part*='display']) {
      border-radius: 3px;
    }

    .spacer {
      flex-grow: 1;
      background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
    }

    media-control-bar[slot~='top-chrome'] {
      min-height: 42px;
      pointer-events: none;
    }

    media-control-bar {
      --gradient-steps:
        hsl(0 0% 0% / 0) 0%, hsl(0 0% 0% / 0.013) 8.1%, hsl(0 0% 0% / 0.049) 15.5%, hsl(0 0% 0% / 0.104) 22.5%,
        hsl(0 0% 0% / 0.175) 29%, hsl(0 0% 0% / 0.259) 35.3%, hsl(0 0% 0% / 0.352) 41.2%, hsl(0 0% 0% / 0.45) 47.1%,
        hsl(0 0% 0% / 0.55) 52.9%, hsl(0 0% 0% / 0.648) 58.8%, hsl(0 0% 0% / 0.741) 64.7%, hsl(0 0% 0% / 0.825) 71%,
        hsl(0 0% 0% / 0.896) 77.5%, hsl(0 0% 0% / 0.951) 84.5%, hsl(0 0% 0% / 0.987) 91.9%, hsl(0 0% 0%) 100%;
    }

    :host([title]) media-control-bar[slot='top-chrome']::before,
    :host([videotitle]) media-control-bar[slot='top-chrome']::before {
      content: '';
      position: absolute;
      width: 100%;
      padding-bottom: min(100px, 25%);
      background: linear-gradient(to top, var(--gradient-steps));
      opacity: 0.8;
      pointer-events: none;
    }

    :host(:not([audio])) media-control-bar[part~='bottom']::before {
      content: '';
      position: absolute;
      width: 100%;
      bottom: 0;
      left: 0;
      padding-bottom: min(100px, 25%);
      background: linear-gradient(to bottom, var(--gradient-steps));
      opacity: 0.8;
      z-index: 1;
      pointer-events: none;
    }

    media-control-bar[part~='bottom'] > * {
      z-index: 20;
    }

    media-control-bar[part~='bottom'] {
      padding: 6px 6px;
    }

    media-control-bar[slot~='top-chrome'] > * {
      --media-control-background: transparent;
      --media-control-hover-background: transparent;
      position: relative;
    }

    media-controller::part(vertical-layer) {
      transition: background-color 1s;
    }

    media-controller:is([mediapaused], :not([userinactive]))::part(vertical-layer) {
      background-color: var(--controls-backdrop-color, var(--controls, transparent));
      transition: background-color 0.25s;
    }

    .center-controls {
      --media-button-icon-width: 100%;
      --media-button-icon-height: auto;
      --media-tooltip-display: none;
      pointer-events: none;
      width: 100%;
      display: flex;
      flex-flow: row;
      align-items: center;
      justify-content: center;
      paint-order: stroke;
      stroke: rgba(102, 102, 102, 1);
      stroke-width: 0.3px;
      text-shadow:
        0 0 2px rgb(0 0 0 / 0.25),
        0 0 6px rgb(0 0 0 / 0.25);
    }

    .center-controls media-play-button {
      --media-control-background: transparent;
      --media-control-hover-background: transparent;
      --media-control-padding: 0;
      width: 40px;
      filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25));
    }

    [breakpointsm] .center-controls media-play-button {
      width: 90px;
      height: 90px;
      border-radius: 50%;
      transition: background 0.4s;
      padding: 24px;
      --media-control-background: #000;
      --media-control-hover-background: var(--_accent-color);
    }

    .center-controls media-seek-backward-button,
    .center-controls media-seek-forward-button {
      --media-control-background: transparent;
      --media-control-hover-background: transparent;
      padding: 0;
      margin: 0 20px;
      width: max(33px, min(8%, 40px));
      text-shadow:
        0 0 2px rgb(0 0 0 / 0.25),
        0 0 6px rgb(0 0 0 / 0.25);
    }

    [breakpointsm]:not([audio]) .center-controls.pre-playback {
      display: grid;
      align-items: initial;
      justify-content: initial;
      height: 100%;
      overflow: hidden;
    }

    [breakpointsm]:not([audio]) .center-controls.pre-playback media-play-button {
      place-self: var(--_pre-playback-place, center);
      grid-area: 1 / 1;
      margin: 16px;
    }

    /* Show and hide controls or pre-playback state */

    [breakpointsm]:is([mediahasplayed], :not([mediapaused])):not([audio])
      .center-controls.pre-playback
      media-play-button {
      /* Using \`forwards\` would lead to a laggy UI after the animation got in the end state */
      animation: 0.3s linear pre-play-hide;
      opacity: 0;
      pointer-events: none;
    }

    .autoplay-unmute {
      --media-control-hover-background: transparent;
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25));
    }

    .autoplay-unmute-btn {
      --media-control-height: 16px;
      border-radius: 8px;
      background: #000;
      color: var(--_primary-color);
      display: flex;
      align-items: center;
      padding: 8px 16px;
      font-size: 18px;
      font-weight: 500;
      cursor: pointer;
    }

    .autoplay-unmute-btn:hover {
      background: var(--_accent-color);
    }

    [breakpointsm] .autoplay-unmute-btn {
      --media-control-height: 30px;
      padding: 14px 24px;
      font-size: 26px;
    }

    .autoplay-unmute-btn svg {
      margin: 0 6px 0 0;
    }

    [breakpointsm] .autoplay-unmute-btn svg {
      margin: 0 10px 0 0;
    }

    media-controller:not([audio]):not([mediahasplayed]) *:is(media-control-bar, media-time-range) {
      display: none;
    }

    media-error-dialog:not([mediaerrorcode]) {
      opacity: 0;
    }

    media-loading-indicator {
      --media-loading-icon-width: 100%;
      --media-button-icon-height: auto;
      display: var(--media-control-display, var(--media-loading-indicator-display, flex));
      pointer-events: none;
      position: absolute;
      width: min(15%, 150px);
      flex-flow: row;
      align-items: center;
      justify-content: center;
    }

    /* Intentionally don't target the div for transition but the children
     of the div. Prevents messing with media-chrome's autohide feature. */
    media-loading-indicator + div * {
      transition: opacity 0.15s;
      opacity: 1;
    }

    media-loading-indicator[medialoading]:not([mediapaused]) ~ div > * {
      opacity: 0;
      transition-delay: 400ms;
    }

    media-volume-range {
      width: min(100%, 100px);
      --media-range-padding-left: 10px;
      --media-range-padding-right: 10px;
      --media-range-thumb-width: 12px;
      --media-range-thumb-height: 12px;
      --media-range-thumb-background: radial-gradient(
        circle,
        #000 0%,
        #000 25%,
        var(--_primary-color) 25%,
        var(--_primary-color)
      );
      --media-control-hover-background: none;
    }

    media-time-display {
      white-space: nowrap;
    }

    /* Generic style for explicitly disabled controls */
    media-control-bar[part~='bottom'] [disabled],
    media-control-bar[part~='bottom'] [aria-disabled='true'] {
      opacity: 60%;
      cursor: not-allowed;
    }

    media-text-display {
      --media-font-size: 16px;
      --media-control-padding: 14px;
      font-weight: 500;
    }

    media-play-button.animated *:is(g, path) {
      transition: all 0.3s;
    }

    media-play-button.animated[mediapaused] .pause-icon-pt1 {
      opacity: 0;
    }

    media-play-button.animated[mediapaused] .pause-icon-pt2 {
      transform-origin: center center;
      transform: scaleY(0);
    }

    media-play-button.animated[mediapaused] .play-icon {
      clip-path: inset(0 0 0 0);
    }

    media-play-button.animated:not([mediapaused]) .play-icon {
      clip-path: inset(0 0 0 100%);
    }

    media-seek-forward-button,
    media-seek-backward-button {
      --media-font-weight: 400;
    }

    .mute-icon {
      display: inline-block;
    }

    .mute-icon :is(path, g) {
      transition: opacity 0.5s;
    }

    .muted {
      opacity: 0;
    }

    media-mute-button[mediavolumelevel='low'] :is(.volume-medium, .volume-high),
    media-mute-button[mediavolumelevel='medium'] :is(.volume-high) {
      opacity: 0;
    }

    media-mute-button[mediavolumelevel='off'] .unmuted {
      opacity: 0;
    }

    media-mute-button[mediavolumelevel='off'] .muted {
      opacity: 1;
    }

    /**
     * Our defaults for these buttons are to hide them at small sizes
     * users can override this with CSS
     */
    media-controller:not([breakpointsm]):not([audio]) {
      --bottom-play-button: none;
      --bottom-seek-backward-button: none;
      --bottom-seek-forward-button: none;
      --bottom-time-display: none;
      --bottom-playback-rate-menu-button: none;
      --bottom-pip-button: none;
    }

    [part='mux-badge'] {
      position: absolute;
      bottom: 10px;
      right: 10px;
      z-index: 2;
      opacity: 0.6;
      transition:
        opacity 0.2s ease-in-out,
        bottom 0.2s ease-in-out;
    }

    [part='mux-badge']:hover {
      opacity: 1;
    }

    [part='mux-badge'] a {
      font-size: 14px;
      font-family: var(--_font-family);
      color: var(--_primary-color);
      text-decoration: none;
      display: flex;
      align-items: center;
      gap: 5px;
    }

    [part='mux-badge'] .mux-badge-text {
      transition: opacity 0.5s ease-in-out;
      opacity: 0;
    }

    [part='mux-badge'] .mux-badge-logo {
      width: 40px;
      height: auto;
      display: inline-block;
    }

    [part='mux-badge'] .mux-badge-logo svg {
      width: 100%;
      height: 100%;
      fill: white;
    }

    media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'],
    media-controller:not([userinactive]) [part='mux-badge'],
    media-controller[mediahasplayed][mediapaused] [part='mux-badge'] {
      transition: bottom 0.1s ease-in-out;
    }

    media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] {
      transition: bottom 0.2s ease-in-out 0.62s;
    }

    media-controller:not([userinactive]) [part='mux-badge'] .mux-badge-text,
    media-controller[mediahasplayed][mediapaused] [part='mux-badge'] .mux-badge-text {
      opacity: 1;
    }

    media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] .mux-badge-text {
      opacity: 0;
    }

    media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] {
      bottom: 10px;
    }

    media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'] {
      bottom: 10px;
    }

    media-controller:not([userinactive])[mediahasplayed] [part='mux-badge'],
    media-controller[mediahasplayed][mediapaused] [part='mux-badge'] {
      bottom: calc(28px + var(--media-control-height, 0px) + var(--media-control-padding, 0px) * 2);
    }
  </style>

  <template partial="TitleDisplay">
    <template if="videotitle">
      <template if="videotitle != true">
        <media-text-display part="top title display" class="title-display">{{videotitle}}</media-text-display>
      </template>
    </template>
    <template if="!videotitle">
      <template if="title">
        <media-text-display part="top title display" class="title-display">{{title}}</media-text-display>
      </template>
    </template>
  </template>

  <template partial="PlayButton">
    <media-play-button
      part="{{section ?? 'bottom'}} play button"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
      class="animated"
    >
      <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon">
        <g class="play-icon">
          <path
            d="M15.5987 6.2911L3.45577 0.110898C2.83667 -0.204202 2.06287 0.189698 2.06287 0.819798V13.1802C2.06287 13.8103 2.83667 14.2042 3.45577 13.8891L15.5987 7.7089C16.2178 7.3938 16.2178 6.6061 15.5987 6.2911Z"
          />
        </g>
        <g class="pause-icon">
          <path
            class="pause-icon-pt1"
            d="M5.90709 0H2.96889C2.46857 0 2.06299 0.405585 2.06299 0.9059V13.0941C2.06299 13.5944 2.46857 14 2.96889 14H5.90709C6.4074 14 6.81299 13.5944 6.81299 13.0941V0.9059C6.81299 0.405585 6.4074 0 5.90709 0Z"
          />
          <path
            class="pause-icon-pt2"
            d="M15.1571 0H12.2189C11.7186 0 11.313 0.405585 11.313 0.9059V13.0941C11.313 13.5944 11.7186 14 12.2189 14H15.1571C15.6574 14 16.063 13.5944 16.063 13.0941V0.9059C16.063 0.405585 15.6574 0 15.1571 0Z"
          />
        </g>
      </svg>
    </media-play-button>
  </template>

  <template partial="PrePlayButton">
    <media-play-button
      part="{{section ?? 'center'}} play button pre-play"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    >
      <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon" style="transform: translate(3px, 0)">
        <path
          d="M15.5987 6.2911L3.45577 0.110898C2.83667 -0.204202 2.06287 0.189698 2.06287 0.819798V13.1802C2.06287 13.8103 2.83667 14.2042 3.45577 13.8891L15.5987 7.7089C16.2178 7.3938 16.2178 6.6061 15.5987 6.2911Z"
        />
      </svg>
    </media-play-button>
  </template>

  <template partial="SeekBackwardButton">
    <media-seek-backward-button
      seekoffset="{{backwardseekoffset}}"
      part="{{section ?? 'bottom'}} seek-backward button"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    >
      <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon">
        <path
          d="M3.65 2.07888L0.0864 6.7279C-0.0288 6.87812 -0.0288 7.12188 0.0864 7.2721L3.65 11.9211C3.7792 12.0896 4 11.9703 4 11.7321V2.26787C4 2.02968 3.7792 1.9104 3.65 2.07888Z"
        />
        <text transform="translate(6 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'">
          {{backwardseekoffset}}
        </text>
      </svg>
    </media-seek-backward-button>
  </template>

  <template partial="SeekForwardButton">
    <media-seek-forward-button
      seekoffset="{{forwardseekoffset}}"
      part="{{section ?? 'bottom'}} seek-forward button"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    >
      <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon">
        <g>
          <text transform="translate(-1 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'">
            {{forwardseekoffset}}
          </text>
          <path
            d="M18.35 11.9211L21.9136 7.2721C22.0288 7.12188 22.0288 6.87812 21.9136 6.7279L18.35 2.07888C18.2208 1.91041 18 2.02968 18 2.26787V11.7321C18 11.9703 18.2208 12.0896 18.35 11.9211Z"
          />
        </g>
      </svg>
    </media-seek-forward-button>
  </template>

  <template partial="MuteButton">
    <media-mute-button part="bottom mute button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
      <svg viewBox="0 0 18 14" slot="icon" class="mute-icon" aria-hidden="true">
        <g class="unmuted">
          <path
            d="M6.76786 1.21233L3.98606 3.98924H1.19937C0.593146 3.98924 0.101743 4.51375 0.101743 5.1607V6.96412L0 6.99998L0.101743 7.03583V8.83926C0.101743 9.48633 0.593146 10.0108 1.19937 10.0108H3.98606L6.76773 12.7877C7.23561 13.2547 8 12.9007 8 12.2171V1.78301C8 1.09925 7.23574 0.745258 6.76786 1.21233Z"
          />
          <path
            class="volume-low"
            d="M10 3.54781C10.7452 4.55141 11.1393 5.74511 11.1393 6.99991C11.1393 8.25471 10.7453 9.44791 10 10.4515L10.7988 11.0496C11.6734 9.87201 12.1356 8.47161 12.1356 6.99991C12.1356 5.52821 11.6735 4.12731 10.7988 2.94971L10 3.54781Z"
          />
          <path
            class="volume-medium"
            d="M12.3778 2.40086C13.2709 3.76756 13.7428 5.35806 13.7428 7.00026C13.7428 8.64246 13.2709 10.233 12.3778 11.5992L13.2106 12.1484C14.2107 10.6185 14.739 8.83796 14.739 7.00016C14.739 5.16236 14.2107 3.38236 13.2106 1.85156L12.3778 2.40086Z"
          />
          <path
            class="volume-high"
            d="M15.5981 0.75L14.7478 1.2719C15.7937 2.9919 16.3468 4.9723 16.3468 7C16.3468 9.0277 15.7937 11.0082 14.7478 12.7281L15.5981 13.25C16.7398 11.3722 17.343 9.211 17.343 7C17.343 4.789 16.7398 2.6268 15.5981 0.75Z"
          />
        </g>
        <g class="muted">
          <path
            fill-rule="evenodd"
            clip-rule="evenodd"
            d="M4.39976 4.98924H1.19937C1.19429 4.98924 1.17777 4.98961 1.15296 5.01609C1.1271 5.04369 1.10174 5.09245 1.10174 5.1607V8.83926C1.10174 8.90761 1.12714 8.95641 1.15299 8.984C1.17779 9.01047 1.1943 9.01084 1.19937 9.01084H4.39977L7 11.6066V2.39357L4.39976 4.98924ZM7.47434 1.92006C7.4743 1.9201 7.47439 1.92002 7.47434 1.92006V1.92006ZM6.76773 12.7877L3.98606 10.0108H1.19937C0.593146 10.0108 0.101743 9.48633 0.101743 8.83926V7.03583L0 6.99998L0.101743 6.96412V5.1607C0.101743 4.51375 0.593146 3.98924 1.19937 3.98924H3.98606L6.76786 1.21233C7.23574 0.745258 8 1.09925 8 1.78301V12.2171C8 12.9007 7.23561 13.2547 6.76773 12.7877Z"
          />
          <path
            fill-rule="evenodd"
            clip-rule="evenodd"
            d="M15.2677 9.30323C15.463 9.49849 15.7796 9.49849 15.9749 9.30323C16.1701 9.10796 16.1701 8.79138 15.9749 8.59612L14.2071 6.82841L15.9749 5.06066C16.1702 4.8654 16.1702 4.54882 15.9749 4.35355C15.7796 4.15829 15.4631 4.15829 15.2678 4.35355L13.5 6.1213L11.7322 4.35348C11.537 4.15822 11.2204 4.15822 11.0251 4.35348C10.8298 4.54874 10.8298 4.86532 11.0251 5.06058L12.7929 6.82841L11.0251 8.59619C10.8299 8.79146 10.8299 9.10804 11.0251 9.3033C11.2204 9.49856 11.537 9.49856 11.7323 9.3033L13.5 7.53552L15.2677 9.30323Z"
          />
        </g>
      </svg>
    </media-mute-button>
  </template>

  <template partial="PipButton">
    <media-pip-button part="bottom pip button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
      <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon">
        <path
          d="M15.9891 0H2.011C0.9004 0 0 0.9003 0 2.0109V11.989C0 13.0996 0.9004 14 2.011 14H15.9891C17.0997 14 18 13.0997 18 11.9891V2.0109C18 0.9003 17.0997 0 15.9891 0ZM17 11.9891C17 12.5465 16.5465 13 15.9891 13H2.011C1.4536 13 1.0001 12.5465 1.0001 11.9891V2.0109C1.0001 1.4535 1.4536 0.9999 2.011 0.9999H15.9891C16.5465 0.9999 17 1.4535 17 2.0109V11.9891Z"
        />
        <path
          d="M15.356 5.67822H8.19523C8.03253 5.67822 7.90063 5.81012 7.90063 5.97282V11.3836C7.90063 11.5463 8.03253 11.6782 8.19523 11.6782H15.356C15.5187 11.6782 15.6506 11.5463 15.6506 11.3836V5.97282C15.6506 5.81012 15.5187 5.67822 15.356 5.67822Z"
        />
      </svg>
    </media-pip-button>
  </template>

  <template partial="CaptionsMenu">
    <media-captions-menu-button part="bottom captions button">
      <svg aria-hidden="true" viewBox="0 0 18 14" slot="on">
        <path
          d="M15.989 0H2.011C0.9004 0 0 0.9003 0 2.0109V11.9891C0 13.0997 0.9004 14 2.011 14H15.989C17.0997 14 18 13.0997 18 11.9891V2.0109C18 0.9003 17.0997 0 15.989 0ZM4.2292 8.7639C4.5954 9.1902 5.0935 9.4031 5.7233 9.4031C6.1852 9.4031 6.5544 9.301 6.8302 9.0969C7.1061 8.8933 7.2863 8.614 7.3702 8.26H8.4322C8.3062 8.884 8.0093 9.3733 7.5411 9.7273C7.0733 10.0813 6.4703 10.2581 5.732 10.2581C5.108 10.2581 4.5699 10.1219 4.1168 9.8489C3.6637 9.5759 3.3141 9.1946 3.0685 8.7058C2.8224 8.2165 2.6994 7.6511 2.6994 7.009C2.6994 6.3611 2.8224 5.7927 3.0685 5.3034C3.3141 4.8146 3.6637 4.4323 4.1168 4.1559C4.5699 3.88 5.108 3.7418 5.732 3.7418C6.4703 3.7418 7.0733 3.922 7.5411 4.2818C8.0094 4.6422 8.3062 5.1461 8.4322 5.794H7.3702C7.2862 5.4283 7.106 5.1368 6.8302 4.921C6.5544 4.7052 6.1852 4.5968 5.7233 4.5968C5.0934 4.5968 4.5954 4.8116 4.2292 5.2404C3.8635 5.6696 3.6804 6.259 3.6804 7.009C3.6804 7.7531 3.8635 8.3381 4.2292 8.7639ZM11.0974 8.7639C11.4636 9.1902 11.9617 9.4031 12.5915 9.4031C13.0534 9.4031 13.4226 9.301 13.6984 9.0969C13.9743 8.8933 14.1545 8.614 14.2384 8.26H15.3004C15.1744 8.884 14.8775 9.3733 14.4093 9.7273C13.9415 10.0813 13.3385 10.2581 12.6002 10.2581C11.9762 10.2581 11.4381 10.1219 10.985 9.8489C10.5319 9.5759 10.1823 9.1946 9.9367 8.7058C9.6906 8.2165 9.5676 7.6511 9.5676 7.009C9.5676 6.3611 9.6906 5.7927 9.9367 5.3034C10.1823 4.8146 10.5319 4.4323 10.985 4.1559C11.4381 3.88 11.9762 3.7418 12.6002 3.7418C13.3385 3.7418 13.9415 3.922 14.4093 4.2818C14.8776 4.6422 15.1744 5.1461 15.3004 5.794H14.2384C14.1544 5.4283 13.9742 5.1368 13.6984 4.921C13.4226 4.7052 13.0534 4.5968 12.5915 4.5968C11.9616 4.5968 11.4636 4.8116 11.0974 5.2404C10.7317 5.6696 10.5486 6.259 10.5486 7.009C10.5486 7.7531 10.7317 8.3381 11.0974 8.7639Z"
        />
      </svg>
      <svg aria-hidden="true" viewBox="0 0 18 14" slot="off">
        <path
          d="M5.73219 10.258C5.10819 10.258 4.57009 10.1218 4.11699 9.8488C3.66389 9.5758 3.31429 9.1945 3.06869 8.7057C2.82259 8.2164 2.69958 7.651 2.69958 7.0089C2.69958 6.361 2.82259 5.7926 3.06869 5.3033C3.31429 4.8145 3.66389 4.4322 4.11699 4.1558C4.57009 3.8799 5.10819 3.7417 5.73219 3.7417C6.47049 3.7417 7.07348 3.9219 7.54128 4.2817C8.00958 4.6421 8.30638 5.146 8.43238 5.7939H7.37039C7.28639 5.4282 7.10618 5.1367 6.83039 4.9209C6.55459 4.7051 6.18538 4.5967 5.72348 4.5967C5.09358 4.5967 4.59559 4.8115 4.22939 5.2403C3.86369 5.6695 3.68058 6.2589 3.68058 7.0089C3.68058 7.753 3.86369 8.338 4.22939 8.7638C4.59559 9.1901 5.09368 9.403 5.72348 9.403C6.18538 9.403 6.55459 9.3009 6.83039 9.0968C7.10629 8.8932 7.28649 8.6139 7.37039 8.2599H8.43238C8.30638 8.8839 8.00948 9.3732 7.54128 9.7272C7.07348 10.0812 6.47049 10.258 5.73219 10.258Z"
        />
        <path
          d="M12.6003 10.258C11.9763 10.258 11.4382 10.1218 10.9851 9.8488C10.532 9.5758 10.1824 9.1945 9.93685 8.7057C9.69075 8.2164 9.56775 7.651 9.56775 7.0089C9.56775 6.361 9.69075 5.7926 9.93685 5.3033C10.1824 4.8145 10.532 4.4322 10.9851 4.1558C11.4382 3.8799 11.9763 3.7417 12.6003 3.7417C13.3386 3.7417 13.9416 3.9219 14.4094 4.2817C14.8777 4.6421 15.1745 5.146 15.3005 5.7939H14.2385C14.1545 5.4282 13.9743 5.1367 13.6985 4.9209C13.4227 4.7051 13.0535 4.5967 12.5916 4.5967C11.9617 4.5967 11.4637 4.8115 11.0975 5.2403C10.7318 5.6695 10.5487 6.2589 10.5487 7.0089C10.5487 7.753 10.7318 8.338 11.0975 8.7638C11.4637 9.1901 11.9618 9.403 12.5916 9.403C13.0535 9.403 13.4227 9.3009 13.6985 9.0968C13.9744 8.8932 14.1546 8.6139 14.2385 8.2599H15.3005C15.1745 8.8839 14.8776 9.3732 14.4094 9.7272C13.9416 10.0812 13.3386 10.258 12.6003 10.258Z"
        />
        <path
          d="M15.9891 1C16.5465 1 17 1.4535 17 2.011V11.9891C17 12.5465 16.5465 13 15.9891 13H2.0109C1.4535 13 1 12.5465 1 11.9891V2.0109C1 1.4535 1.4535 0.9999 2.0109 0.9999L15.9891 1ZM15.9891 0H2.0109C0.9003 0 0 0.9003 0 2.0109V11.9891C0 13.0997 0.9003 14 2.0109 14H15.9891C17.0997 14 18 13.0997 18 11.9891V2.0109C18 0.9003 17.0997 0 15.9891 0Z"
        />
      </svg>
    </media-captions-menu-button>
    <media-captions-menu
      hidden
      anchor="auto"
      part="bottom captions menu"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
      exportparts="menu-item"
    >
      <div slot="checked-indicator">
        <style>
          .indicator {
            position: relative;
            top: 1px;
            width: 0.9em;
            height: auto;
            fill: var(--_accent-color);
            margin-right: 5px;
          }

          [aria-checked='false'] .indicator {
            display: none;
          }
        </style>
        <svg viewBox="0 0 14 18" class="indicator">
          <path
            d="M12.252 3.48c-.115.033-.301.161-.425.291-.059.063-1.407 1.815-2.995 3.894s-2.897 3.79-2.908 3.802c-.013.014-.661-.616-1.672-1.624-.908-.905-1.702-1.681-1.765-1.723-.401-.27-.783-.211-1.176.183a1.285 1.285 0 0 0-.261.342.582.582 0 0 0-.082.35c0 .165.01.205.08.35.075.153.213.296 2.182 2.271 1.156 1.159 2.17 2.159 2.253 2.222.189.143.338.196.539.194.203-.003.412-.104.618-.299.205-.193 6.7-8.693 6.804-8.903a.716.716 0 0 0 .085-.345c.01-.179.005-.203-.062-.339-.124-.252-.45-.531-.746-.639a.784.784 0 0 0-.469-.027"
            fill-rule="evenodd"
          />
        </svg></div
    ></media-captions-menu>
  </template>

  <template partial="AirplayButton">
    <media-airplay-button part="bottom airplay button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
      <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon">
        <path
          d="M16.1383 0H1.8618C0.8335 0 0 0.8335 0 1.8617V10.1382C0 11.1664 0.8335 12 1.8618 12H3.076C3.1204 11.9433 3.1503 11.8785 3.2012 11.826L4.004 11H1.8618C1.3866 11 1 10.6134 1 10.1382V1.8617C1 1.3865 1.3866 0.9999 1.8618 0.9999H16.1383C16.6135 0.9999 17.0001 1.3865 17.0001 1.8617V10.1382C17.0001 10.6134 16.6135 11 16.1383 11H13.9961L14.7989 11.826C14.8499 11.8785 14.8798 11.9432 14.9241 12H16.1383C17.1665 12 18.0001 11.1664 18.0001 10.1382V1.8617C18 0.8335 17.1665 0 16.1383 0Z"
        />
        <path
          d="M9.55061 8.21903C9.39981 8.06383 9.20001 7.98633 9.00011 7.98633C8.80021 7.98633 8.60031 8.06383 8.44951 8.21903L4.09771 12.697C3.62471 13.1838 3.96961 13.9998 4.64831 13.9998H13.3518C14.0304 13.9998 14.3754 13.1838 13.9023 12.697L9.55061 8.21903Z"
        />
      </svg>
    </media-airplay-button>
  </template>

  <template partial="FullscreenButton">
    <media-fullscreen-button part="bottom fullscreen button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
      <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter">
        <path
          d="M1.00745 4.39539L1.01445 1.98789C1.01605 1.43049 1.47085 0.978289 2.02835 0.979989L6.39375 0.992589L6.39665 -0.007411L2.03125 -0.020011C0.920646 -0.023211 0.0176463 0.874489 0.0144463 1.98509L0.00744629 4.39539H1.00745Z"
        />
        <path
          d="M17.0144 2.03431L17.0076 4.39541H18.0076L18.0144 2.03721C18.0176 0.926712 17.1199 0.0237125 16.0093 0.0205125L11.6439 0.0078125L11.641 1.00781L16.0064 1.02041C16.5638 1.02201 17.016 1.47681 17.0144 2.03431Z"
        />
        <path
          d="M16.9925 9.60498L16.9855 12.0124C16.9839 12.5698 16.5291 13.022 15.9717 13.0204L11.6063 13.0078L11.6034 14.0078L15.9688 14.0204C17.0794 14.0236 17.9823 13.1259 17.9855 12.0153L17.9925 9.60498H16.9925Z"
        />
        <path
          d="M0.985626 11.9661L0.992426 9.60498H-0.0074737L-0.0142737 11.9632C-0.0174737 13.0738 0.880226 13.9767 1.99083 13.98L6.35623 13.9926L6.35913 12.9926L1.99373 12.98C1.43633 12.9784 0.983926 12.5236 0.985626 11.9661Z"
        />
      </svg>
      <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit">
        <path
          d="M5.39655 -0.0200195L5.38955 2.38748C5.38795 2.94488 4.93315 3.39708 4.37565 3.39538L0.0103463 3.38278L0.00744629 4.38278L4.37285 4.39538C5.48345 4.39858 6.38635 3.50088 6.38965 2.39028L6.39665 -0.0200195H5.39655Z"
        />
        <path
          d="M12.6411 2.36891L12.6479 0.0078125H11.6479L11.6411 2.36601C11.6379 3.47651 12.5356 4.37951 13.6462 4.38271L18.0116 4.39531L18.0145 3.39531L13.6491 3.38271C13.0917 3.38111 12.6395 2.92641 12.6411 2.36891Z"
        />
        <path
          d="M12.6034 14.0204L12.6104 11.613C12.612 11.0556 13.0668 10.6034 13.6242 10.605L17.9896 10.6176L17.9925 9.61759L13.6271 9.60499C12.5165 9.60179 11.6136 10.4995 11.6104 11.6101L11.6034 14.0204H12.6034Z"
        />
        <path
          d="M5.359 11.6315L5.3522 13.9926H6.3522L6.359 11.6344C6.3622 10.5238 5.4645 9.62088 4.3539 9.61758L-0.0115043 9.60498L-0.0144043 10.605L4.351 10.6176C4.9084 10.6192 5.3607 11.074 5.359 11.6315Z"
        />
      </svg>
    </media-fullscreen-button>
  </template>

  <template partial="CastButton">
    <media-cast-button part="bottom cast button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
      <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter">
        <path
          d="M16.0072 0H2.0291C0.9185 0 0.0181 0.9003 0.0181 2.011V5.5009C0.357 5.5016 0.6895 5.5275 1.0181 5.5669V2.011C1.0181 1.4536 1.4716 1 2.029 1H16.0072C16.5646 1 17.0181 1.4536 17.0181 2.011V11.9891C17.0181 12.5465 16.5646 13 16.0072 13H8.4358C8.4746 13.3286 8.4999 13.6611 8.4999 13.9999H16.0071C17.1177 13.9999 18.018 13.0996 18.018 11.989V2.011C18.0181 0.9003 17.1178 0 16.0072 0ZM0 6.4999V7.4999C3.584 7.4999 6.5 10.4159 6.5 13.9999H7.5C7.5 9.8642 4.1357 6.4999 0 6.4999ZM0 8.7499V9.7499C2.3433 9.7499 4.25 11.6566 4.25 13.9999H5.25C5.25 11.1049 2.895 8.7499 0 8.7499ZM0.0181 11V14H3.0181C3.0181 12.3431 1.675 11 0.0181 11Z"
        />
      </svg>
      <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit">
        <path
          d="M15.9891 0H2.01103C0.900434 0 3.35947e-05 0.9003 3.35947e-05 2.011V5.5009C0.338934 5.5016 0.671434 5.5275 1.00003 5.5669V2.011C1.00003 1.4536 1.45353 1 2.01093 1H15.9891C16.5465 1 17 1.4536 17 2.011V11.9891C17 12.5465 16.5465 13 15.9891 13H8.41773C8.45653 13.3286 8.48183 13.6611 8.48183 13.9999H15.989C17.0996 13.9999 17.9999 13.0996 17.9999 11.989V2.011C18 0.9003 17.0997 0 15.9891 0ZM-0.0180664 6.4999V7.4999C3.56593 7.4999 6.48193 10.4159 6.48193 13.9999H7.48193C7.48193 9.8642 4.11763 6.4999 -0.0180664 6.4999ZM-0.0180664 8.7499V9.7499C2.32523 9.7499 4.23193 11.6566 4.23193 13.9999H5.23193C5.23193 11.1049 2.87693 8.7499 -0.0180664 8.7499ZM3.35947e-05 11V14H3.00003C3.00003 12.3431 1.65693 11 3.35947e-05 11Z"
        />
        <path d="M2.15002 5.634C5.18352 6.4207 7.57252 8.8151 8.35282 11.8499H15.8501V2.1499H2.15002V5.634Z" />
      </svg>
    </media-cast-button>
  </template>

  <template partial="LiveButton">
    <media-live-button part="{{section ?? 'top'}} live button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
      <span slot="text">Live</span>
    </media-live-button>
  </template>

  <template partial="PlaybackRateMenu">
    <media-playback-rate-menu-button part="bottom playback-rate button"></media-playback-rate-menu-button>
    <media-playback-rate-menu
      hidden
      anchor="auto"
      rates="{{playbackrates}}"
      exportparts="menu-item"
      part="bottom playback-rate menu"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    ></media-playback-rate-menu>
  </template>

  <template partial="VolumeRange">
    <media-volume-range
      part="bottom volume range"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    ></media-volume-range>
  </template>

  <template partial="TimeDisplay">
    <media-time-display
      remaining="{{defaultshowremainingtime}}"
      showduration="{{!hideduration}}"
      part="bottom time display"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    ></media-time-display>
  </template>

  <template partial="TimeRange">
    <media-time-range part="bottom time range" disabled="{{disabled}}" aria-disabled="{{disabled}}" exportparts="thumb">
      <media-preview-thumbnail slot="preview"></media-preview-thumbnail>
      <media-preview-chapter-display slot="preview"></media-preview-chapter-display>
      <media-preview-time-display slot="preview"></media-preview-time-display>
      <div slot="preview" part="arrow"></div>
    </media-time-range>
  </template>

  <template partial="AudioTrackMenu">
    <media-audio-track-menu-button part="bottom audio-track button">
      <svg aria-hidden="true" slot="icon" viewBox="0 0 18 16">
        <path d="M9 15A7 7 0 1 1 9 1a7 7 0 0 1 0 14Zm0 1A8 8 0 1 0 9 0a8 8 0 0 0 0 16Z" />
        <path
          d="M5.2 6.3a.5.5 0 0 1 .5.5v2.4a.5.5 0 1 1-1 0V6.8a.5.5 0 0 1 .5-.5Zm2.4-2.4a.5.5 0 0 1 .5.5v7.2a.5.5 0 0 1-1 0V4.4a.5.5 0 0 1 .5-.5ZM10 5.5a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.4-.8a.5.5 0 0 1 .5.5v5.6a.5.5 0 0 1-1 0V5.2a.5.5 0 0 1 .5-.5Z"
        />
      </svg>
    </media-audio-track-menu-button>
    <media-audio-track-menu
      hidden
      anchor="auto"
      part="bottom audio-track menu"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
      exportparts="menu-item"
    >
      <div slot="checked-indicator">
        <style>
          .indicator {
            position: relative;
            top: 1px;
            width: 0.9em;
            height: auto;
            fill: var(--_accent-color);
            margin-right: 5px;
          }

          [aria-checked='false'] .indicator {
            display: none;
          }
        </style>
        <svg viewBox="0 0 14 18" class="indicator">
          <path
            d="M12.252 3.48c-.115.033-.301.161-.425.291-.059.063-1.407 1.815-2.995 3.894s-2.897 3.79-2.908 3.802c-.013.014-.661-.616-1.672-1.624-.908-.905-1.702-1.681-1.765-1.723-.401-.27-.783-.211-1.176.183a1.285 1.285 0 0 0-.261.342.582.582 0 0 0-.082.35c0 .165.01.205.08.35.075.153.213.296 2.182 2.271 1.156 1.159 2.17 2.159 2.253 2.222.189.143.338.196.539.194.203-.003.412-.104.618-.299.205-.193 6.7-8.693 6.804-8.903a.716.716 0 0 0 .085-.345c.01-.179.005-.203-.062-.339-.124-.252-.45-.531-.746-.639a.784.784 0 0 0-.469-.027"
            fill-rule="evenodd"
          />
        </svg>
      </div>
    </media-audio-track-menu>
  </template>

  <template partial="RenditionMenu">
    <media-rendition-menu-button part="bottom rendition button">
      <svg aria-hidden="true" slot="icon" viewBox="0 0 18 14">
        <path
          d="M2.25 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM9 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm6.75 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"
        />
      </svg>
    </media-rendition-menu-button>
    <media-rendition-menu
      hidden
      anchor="auto"
      part="bottom rendition menu"
      disabled="{{disabled}}"
      aria-disabled="{{disabled}}"
    >
      <div slot="checked-indicator">
        <style>
          .indicator {
            position: relative;
            top: 1px;
            width: 0.9em;
            height: auto;
            fill: var(--_accent-color);
            margin-right: 5px;
          }

          [aria-checked='false'] .indicator {
            opacity: 0;
          }
        </style>
        <svg viewBox="0 0 14 18" class="indicator">
          <path
            d="M12.252 3.48c-.115.033-.301.161-.425.291-.059.063-1.407 1.815-2.995 3.894s-2.897 3.79-2.908 3.802c-.013.014-.661-.616-1.672-1.624-.908-.905-1.702-1.681-1.765-1.723-.401-.27-.783-.211-1.176.183a1.285 1.285 0 0 0-.261.342.582.582 0 0 0-.082.35c0 .165.01.205.08.35.075.153.213.296 2.182 2.271 1.156 1.159 2.17 2.159 2.253 2.222.189.143.338.196.539.194.203-.003.412-.104.618-.299.205-.193 6.7-8.693 6.804-8.903a.716.716 0 0 0 .085-.345c.01-.179.005-.203-.062-.339-.124-.252-.45-.531-.746-.639a.784.784 0 0 0-.469-.027"
            fill-rule="evenodd"
          />
        </svg>
      </div>
    </media-rendition-menu>
  </template>

  <template partial="MuxBadge">
    <div part="mux-badge">
      <a href="https://www.mux.com/player" target="_blank">
        <span class="mux-badge-text">Powered by</span>
        <div class="mux-badge-logo">
          <svg
            viewBox="0 0 1600 500"
            style="fill-rule: evenodd; clip-rule: evenodd; stroke-linejoin: round; stroke-miterlimit: 2"
          >
            <g>
              <path
                d="M994.287,93.486c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m0,-93.486c-34.509,-0 -62.484,27.976 -62.484,62.486l0,187.511c0,68.943 -56.09,125.033 -125.032,125.033c-68.942,-0 -125.03,-56.09 -125.03,-125.033l0,-187.511c0,-34.51 -27.976,-62.486 -62.485,-62.486c-34.509,-0 -62.484,27.976 -62.484,62.486l0,187.511c0,137.853 112.149,250.003 249.999,250.003c137.851,-0 250.001,-112.15 250.001,-250.003l0,-187.511c0,-34.51 -27.976,-62.486 -62.485,-62.486"
                style="fill-rule: nonzero"
              ></path>
              <path
                d="M1537.51,468.511c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m-275.883,-218.509l-143.33,143.329c-24.402,24.402 -24.402,63.966 0,88.368c24.402,24.402 63.967,24.402 88.369,-0l143.33,-143.329l143.328,143.329c24.402,24.4 63.967,24.402 88.369,-0c24.403,-24.402 24.403,-63.966 0.001,-88.368l-143.33,-143.329l0.001,-0.004l143.329,-143.329c24.402,-24.402 24.402,-63.965 0,-88.367c-24.402,-24.402 -63.967,-24.402 -88.369,-0l-143.329,143.328l-143.329,-143.328c-24.402,-24.401 -63.967,-24.402 -88.369,-0c-24.402,24.402 -24.402,63.965 0,88.367l143.329,143.329l0,0.004Z"
                style="fill-rule: nonzero"
              ></path>
              <path
                d="M437.511,468.521c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m23.915,-463.762c-23.348,-9.672 -50.226,-4.327 -68.096,13.544l-143.331,143.329l-143.33,-143.329c-17.871,-17.871 -44.747,-23.216 -68.096,-13.544c-23.349,9.671 -38.574,32.455 -38.574,57.729l0,375.026c0,34.51 27.977,62.486 62.487,62.486c34.51,-0 62.486,-27.976 62.486,-62.486l0,-224.173l80.843,80.844c24.404,24.402 63.965,24.402 88.369,-0l80.843,-80.844l0,224.173c0,34.51 27.976,62.486 62.486,62.486c34.51,-0 62.486,-27.976 62.486,-62.486l0,-375.026c0,-25.274 -15.224,-48.058 -38.573,-57.729"
                style="fill-rule: nonzero"
              ></path>
            </g>
          </svg>
        </div>
      </a>
    </div>
  </template>

  <media-controller
    part="controller"
    defaultstreamtype="{{defaultstreamtype ?? 'on-demand'}}"
    breakpoints="sm:470"
    gesturesdisabled="{{disabled}}"
    hotkeys="{{hotkeys}}"
    nohotkeys="{{nohotkeys}}"
    novolumepref="{{novolumepref}}"
    audio="{{audio}}"
    noautoseektolive="{{noautoseektolive}}"
    defaultsubtitles="{{defaultsubtitles}}"
    defaultduration="{{defaultduration ?? false}}"
    keyboardforwardseekoffset="{{forwardseekoffset}}"
    keyboardbackwardseekoffset="{{backwardseekoffset}}"
    exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer"
    style="--_pre-playback-place:{{preplaybackplace ?? 'center'}}"
  >
    <slot name="media" slot="media"></slot>
    <slot name="poster" slot="poster"></slot>

    <media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator>

    <template if="!audio">
      <media-error-dialog slot="dialog" noautohide></media-error-dialog>
      <!-- Pre-playback UI -->
      <!-- same for both on-demand and live -->
      <div slot="centered-chrome" class="center-controls pre-playback">
        <template if="!breakpointsm">{{>PlayButton section="center"}}</template>
        <template if="breakpointsm">{{>PrePlayButton section="center"}}</template>
      </div>

      <!-- Mux Badge -->
      <template if="proudlydisplaymuxbadge"> {{>MuxBadge}} </template>

      <!-- Autoplay centered unmute button -->
      <!--
        todo: figure out how show this with available state variables
        needs to show when:
        - autoplay is enabled
        - playback has been successful
        - audio is muted
        - in place / instead of the pre-plaback play button
        - not to show again after user has interacted with this button
          - OR user has interacted with the mute button in the control bar
      -->
      <!--
        There should be a >MuteButton to the left of the "Unmute" text, but a templating bug
        makes it appear even if commented out in the markup, add it back when code is un-commented
      -->
      <!-- <div slot="centered-chrome" class="autoplay-unmute">
        <div role="button" class="autoplay-unmute-btn">Unmute</div>
      </div> -->

      <template if="streamtype == 'on-demand'">
        <template if="breakpointsm">
          <media-control-bar part="control-bar top" slot="top-chrome">{{>TitleDisplay}} </media-control-bar>
        </template>
        {{>TimeRange}}
        <media-control-bar part="control-bar bottom">
          {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}} {{>MuteButton}}
          {{>VolumeRange}}
          <div class="spacer"></div>
          {{>RenditionMenu}} {{>PlaybackRateMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}}
          {{>CastButton}} {{>PipButton}} {{>FullscreenButton}}
        </media-control-bar>
      </template>

      <template if="streamtype == 'live'">
        <media-control-bar part="control-bar top" slot="top-chrome">
          {{>LiveButton}}
          <template if="breakpointsm"> {{>TitleDisplay}} </template>
        </media-control-bar>
        <template if="targetlivewindow > 0">{{>TimeRange}}</template>
        <media-control-bar part="control-bar bottom">
          {{>PlayButton}}
          <template if="targetlivewindow > 0">{{>SeekBackwardButton}} {{>SeekForwardButton}}</template>
          {{>MuteButton}} {{>VolumeRange}}
          <div class="spacer"></div>
          {{>RenditionMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}}
          {{>FullscreenButton}}
        </media-control-bar>
      </template>
    </template>

    <template if="audio">
      <template if="streamtype == 'on-demand'">
        <template if="title">
          <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
        </template>
        <media-control-bar part="control-bar bottom">
          {{>PlayButton}}
          <template if="breakpointsm"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>
          {{>MuteButton}}
          <template if="breakpointsm">{{>VolumeRange}}</template>
          {{>TimeDisplay}} {{>TimeRange}}
          <template if="breakpointsm">{{>PlaybackRateMenu}}</template>
          {{>AirplayButton}} {{>CastButton}}
        </media-control-bar>
      </template>

      <template if="streamtype == 'live'">
        <template if="title">
          <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
        </template>
        <media-control-bar part="control-bar bottom">
          {{>PlayButton}} {{>LiveButton section="bottom"}} {{>MuteButton}}
          <template if="breakpointsm">
            {{>VolumeRange}}
            <template if="targetlivewindow > 0"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>
          </template>
          <template if="targetlivewindow > 0"> {{>TimeDisplay}} {{>TimeRange}} </template>
          <template if="!targetlivewindow"><div class="spacer"></div></template>
          {{>AirplayButton}} {{>CastButton}}
        </media-control-bar>
      </template>
    </template>

    <slot></slot>
  </media-controller>
</template>
`;function ja({anchor:i,floating:u,placement:h}){let E=on({anchor:i,floating:u}),{x:R,y:G}=ns(E,h);return{x:R,y:G}}function on({anchor:i,floating:u}){return{anchor:Ql(i,u.offsetParent),floating:{x:0,y:0,width:u.offsetWidth,height:u.offsetHeight}}}function Ql(i,u){var h;let E=i.getBoundingClientRect(),R=(h=u==null?void 0:u.getBoundingClientRect())!=null?h:{x:0,y:0};return{x:E.x-R.x,y:E.y-R.y,width:E.width,height:E.height}}function ns({anchor:i,floating:u},h){let E=Ld(h)==="x"?"y":"x",R=E==="y"?"height":"width",G=ll(h),ee=i.x+i.width/2-u.width/2,ge=i.y+i.height/2-u.height/2,_t=i[R]/2-u[R]/2,It;switch(G){case"top":It={x:ee,y:i.y-u.height};break;case"bottom":It={x:ee,y:i.y+i.height};break;case"right":It={x:i.x+i.width,y:ge};break;case"left":It={x:i.x-u.width,y:ge};break;default:It={x:i.x,y:i.y}}switch(h.split("-")[1]){case"start":It[E]-=_t;break;case"end":It[E]+=_t;break}return It}function ll(i){return i.split("-")[0]}function Ld(i){return["top","bottom"].includes(ll(i))?"y":"x"}var Xl=class extends Event{constructor(i){var u=i,{action:h="auto",relatedTarget:E}=u,R=K(u,["action","relatedTarget"]);super("invoke",R),this.action=h,this.relatedTarget=E}},Zl=class extends Event{constructor(i){var u=i,{newState:h,oldState:E}=u,R=K(u,["newState","oldState"]);super("toggle",R),this.newState=h,this.oldState=E}},ao=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},ci=(i,u,h)=>(ao(i,u,"read from private field"),h?h.call(i):u.get(i)),Ti=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},ss=(i,u,h,E)=>(ao(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),wi=(i,u,h)=>(ao(i,u,"access private method"),h),Es,Gn,ys,An,Jl,no,eu,kd,cc,Vu,Id,tu,so,oo,Gu,hc,fc,mh,vc,ph,Ku,ru,iu,ul,Wu,gh,Eh,mc,Yu,pc,yh,ep,um,tp,dm,rp,cm,ip,bh,zf,hm,ap,Th,Qf,Xf,fm;function gc({type:i,text:u,value:h,checked:E}){let R=er.createElement("media-chrome-menu-item");R.type=i!=null?i:"",R.part.add("menu-item"),i&&R.part.add(i),R.value=h,R.checked=E;let G=er.createElement("span");return G.textContent=u,R.append(G),R}function Rd(i,u){let h=i.querySelector(`:scope > [slot="${u}"]`);if((h==null?void 0:h.nodeName)=="SLOT"&&(h=h.assignedElements({flatten:!0})[0]),h)return h=h.cloneNode(!0),h;let E=i.shadowRoot.querySelector(`[name="${u}"] > svg`);return E?E.cloneNode(!0):""}function Jp(i){return`
    <style>
      :host {
        font: var(--media-font,
          var(--media-font-weight, normal)
          var(--media-font-size, 14px) /
          var(--media-text-content-height, var(--media-control-height, 24px))
          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
        --_menu-bg: rgb(20 20 30 / .8);
        background: var(--media-menu-background, var(--media-control-background, var(--media-secondary-color, var(--_menu-bg))));
        border-radius: var(--media-menu-border-radius);
        border: var(--media-menu-border, none);
        display: var(--media-menu-display, inline-flex) !important;
        
        transition: var(--media-menu-transition-in,
          visibility 0s,
          opacity .2s ease-out,
          transform .15s ease-out,
          left .2s ease-in-out,
          min-width .2s ease-in-out,
          min-height .2s ease-in-out
        ) !important;
        
        visibility: var(--media-menu-visibility, visible);
        opacity: var(--media-menu-opacity, 1);
        max-height: var(--media-menu-max-height, var(--_menu-max-height, 300px));
        transform: var(--media-menu-transform-in, translateY(0) scale(1));
        flex-direction: column;
        
        min-height: 0;
        position: relative;
        bottom: var(--_menu-bottom);
        box-sizing: border-box;
      } 

      @-moz-document url-prefix() {
        :host{
          --_menu-bg: rgb(20 20 30);
        }
      }

      :host([hidden]) {
        transition: var(--media-menu-transition-out,
          visibility .15s ease-in,
          opacity .15s ease-in,
          transform .15s ease-in
        ) !important;
        visibility: var(--media-menu-hidden-visibility, hidden);
        opacity: var(--media-menu-hidden-opacity, 0);
        max-height: var(--media-menu-hidden-max-height,
          var(--media-menu-max-height, var(--_menu-max-height, 300px)));
        transform: var(--media-menu-transform-out, translateY(2px) scale(.99));
        pointer-events: none;
      }

      :host([slot="submenu"]) {
        background: none;
        width: 100%;
        min-height: 100%;
        position: absolute;
        bottom: 0;
        right: -100%;
      }

      #container {
        display: flex;
        flex-direction: column;
        min-height: 0;
        transition: transform .2s ease-out;
        transform: translate(0, 0);
      }

      #container.has-expanded {
        transition: transform .2s ease-in;
        transform: translate(-100%, 0);
      }

      button {
        background: none;
        color: inherit;
        border: none;
        padding: 0;
        font: inherit;
        outline: inherit;
        display: inline-flex;
        align-items: center;
      }

      slot[name="header"][hidden] {
        display: none;
      }

      slot[name="header"] > *,
      slot[name="header"]::slotted(*) {
        padding: .4em .7em;
        border-bottom: 1px solid rgb(255 255 255 / .25);
        cursor: var(--media-cursor, default);
      }

      slot[name="header"] > button[part~="back"],
      slot[name="header"]::slotted(button[part~="back"]) {
        cursor: var(--media-cursor, pointer);
      }

      svg[part~="back"] {
        height: var(--media-menu-icon-height, var(--media-control-height, 24px));
        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
        display: block;
        margin-right: .5ch;
      }

      slot:not([name]) {
        gap: var(--media-menu-gap);
        flex-direction: var(--media-menu-flex-direction, column);
        overflow: var(--media-menu-overflow, hidden auto);
        display: flex;
        min-height: 0;
      }

      :host([role="menu"]) slot:not([name]) {
        padding-block: .4em;
      }

      slot:not([name])::slotted([role="menu"]) {
        background: none;
      }

      media-chrome-menu-item > span {
        margin-right: .5ch;
        max-width: var(--media-menu-item-max-width);
        text-overflow: ellipsis;
        overflow: hidden;
      }
    </style>
    <style id="layout-row" media="width:0">

      slot[name="header"] > *,
      slot[name="header"]::slotted(*) {
        padding: .4em .5em;
      }

      slot:not([name]) {
        gap: var(--media-menu-gap, .25em);
        flex-direction: var(--media-menu-flex-direction, row);
        padding-inline: .5em;
      }

      media-chrome-menu-item {
        padding: .3em .5em;
      }

      media-chrome-menu-item[aria-checked="true"] {
        background: var(--media-menu-item-checked-background, rgb(255 255 255 / .2));
      }

      
      media-chrome-menu-item::part(checked-indicator) {
        display: var(--media-menu-item-checked-indicator-display, none);
      }
    </style>
    <div id="container" part="container">
      <slot name="header" hidden>
        <button part="back button" aria-label="Back to previous menu">
          <slot name="back-icon">
            <svg aria-hidden="true" viewBox="0 0 20 24" part="back indicator">
              <path d="m11.88 17.585.742-.669-4.2-4.665 4.2-4.666-.743-.669-4.803 5.335 4.803 5.334Z"/>
            </svg>
          </slot>
          <slot name="title"></slot>
        </button>
      </slot>
      <slot></slot>
    </div>
    <slot name="checked-indicator" hidden></slot>
  `}var wd={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"},lo=class extends ie.HTMLElement{constructor(){if(super(),Ti(this,kd),Ti(this,Vu),Ti(this,so),Ti(this,Gu),Ti(this,fc),Ti(this,vc),Ti(this,iu),Ti(this,Wu),Ti(this,Eh),Ti(this,Yu),Ti(this,yh),Ti(this,um),Ti(this,dm),Ti(this,cm),Ti(this,bh),Ti(this,hm),Ti(this,Th),Ti(this,Xf),Ti(this,Es,null),Ti(this,Gn,null),Ti(this,ys,null),Ti(this,An,new Set),Ti(this,Jl,void 0),Ti(this,no,!1),Ti(this,eu,null),Ti(this,tu,()=>{let i=ci(this,An),u=new Set(this.items);for(let h of i)u.has(h)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:h}));for(let h of u)i.has(h)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:h}));ss(this,An,u)}),Ti(this,Ku,()=>{wi(this,iu,ul).call(this),wi(this,Wu,gh).call(this,!1)}),Ti(this,ru,()=>{wi(this,iu,ul).call(this)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Jr(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i)}this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),ss(this,Jl,new MutationObserver(ci(this,tu))),ci(this,Jl).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[wd.DISABLED,wd.HIDDEN,wd.STYLE,wd.ANCHOR,we.MEDIA_CONTROLLER]}static formatMenuItemText(i,u){return i}enable(){this.addEventListener("click",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this),this.addEventListener("invoke",this),this.addEventListener("toggle",this)}disable(){this.removeEventListener("click",this),this.removeEventListener("focusout",this),this.removeEventListener("keyup",this),this.removeEventListener("invoke",this),this.removeEventListener("toggle",this)}handleEvent(i){switch(i.type){case"slotchange":wi(this,kd,cc).call(this,i);break;case"invoke":wi(this,Gu,hc).call(this,i);break;case"click":wi(this,Eh,mc).call(this,i);break;case"toggle":wi(this,yh,ep).call(this,i);break;case"focusout":wi(this,dm,rp).call(this,i);break;case"keydown":wi(this,cm,ip).call(this,i);break}}connectedCallback(){var i,u;ss(this,eu,cn(this.shadowRoot,":host")),wi(this,so,oo).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),ss(this,Es,Pa(this)),(u=(i=ci(this,Es))==null?void 0:i.associateElement)==null||u.call(i,this),this.hidden||(pi(_h(this),ci(this,Ku)),pi(this,ci(this,ru))),wi(this,Vu,Id).call(this)}disconnectedCallback(){var i,u;$r(_h(this),ci(this,Ku)),$r(this,ci(this,ru)),this.disable(),(u=(i=ci(this,Es))==null?void 0:i.unassociateElement)==null||u.call(i,this),ss(this,Es,null)}attributeChangedCallback(i,u,h){var E,R,G,ee;i===wd.HIDDEN&&h!==u?(ci(this,no)||ss(this,no,!0),this.hidden?wi(this,vc,ph).call(this):wi(this,fc,mh).call(this),this.dispatchEvent(new Zl({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):i===we.MEDIA_CONTROLLER?(u&&((R=(E=ci(this,Es))==null?void 0:E.unassociateElement)==null||R.call(E,this),ss(this,Es,null)),h&&this.isConnected&&(ss(this,Es,Pa(this)),(ee=(G=ci(this,Es))==null?void 0:G.associateElement)==null||ee.call(G,this))):i===wd.DISABLED&&h!==u?h==null?this.enable():this.disable():i===wd.STYLE&&h!==u&&wi(this,so,oo).call(this)}formatMenuItemText(i,u){return this.constructor.formatMenuItemText(i,u)}get anchor(){return this.getAttribute("anchor")}set anchor(i){this.setAttribute("anchor",`${i}`)}get anchorElement(){var i;return this.anchor?(i=Qi(this))==null?void 0:i.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(eg)}get radioGroupItems(){return this.items.filter(i=>i.role==="menuitemradio")}get checkedItems(){return this.items.filter(i=>i.checked)}get value(){var i,u;return(u=(i=this.checkedItems[0])==null?void 0:i.value)!=null?u:""}set value(i){let u=this.items.find(h=>h.value===i);u&&wi(this,Xf,fm).call(this,u)}focus(){if(ss(this,Gn,Oa()),this.items.length){wi(this,Th,Qf).call(this,this.items[0]),this.items[0].focus();return}let i=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');i==null||i.focus()}handleSelect(i){var u;let h=wi(this,bh,zf).call(this,i);h&&(wi(this,Xf,fm).call(this,h,h.type==="checkbox"),ci(this,ys)&&!this.hidden&&((u=ci(this,Gn))==null||u.focus(),this.hidden=!0))}get keysUsed(){return["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(i){var u,h;let{key:E}=i,R=this.items,G=(h=(u=wi(this,bh,zf).call(this,i))!=null?u:wi(this,hm,ap).call(this))!=null?h:R[0],ee=R.indexOf(G),ge=Math.max(0,ee);E==="ArrowDown"?ge++:E==="ArrowUp"?ge--:i.key==="Home"?ge=0:i.key==="End"&&(ge=R.length-1),ge<0&&(ge=R.length-1),ge>R.length-1&&(ge=0),wi(this,Th,Qf).call(this,R[ge]),R[ge].focus()}};Es=new WeakMap,Gn=new WeakMap,ys=new WeakMap,An=new WeakMap,Jl=new WeakMap,no=new WeakMap,eu=new WeakMap,kd=new WeakSet,cc=function(i){let u=i.target;for(let h of u.assignedNodes({flatten:!0}))h.nodeType===3&&h.textContent.trim()===""&&h.remove();["header","title"].includes(u.name)&&wi(this,Vu,Id).call(this),u.name||ci(this,tu).call(this)},Vu=new WeakSet,Id=function(){let i=this.shadowRoot.querySelector('slot[name="header"]'),u=this.shadowRoot.querySelector('slot[name="title"]');i.hidden=u.assignedNodes().length===0&&i.assignedNodes().length===0},tu=new WeakMap,so=new WeakSet,oo=function(){var i;let u=this.shadowRoot.querySelector("#layout-row"),h=(i=getComputedStyle(this).getPropertyValue("--media-menu-layout"))==null?void 0:i.trim();u.setAttribute("media",h==="row"?"":"width:0")},Gu=new WeakSet,hc=function(i){ss(this,ys,i.relatedTarget),aa(this,i.relatedTarget)||(this.hidden=!this.hidden)},fc=new WeakSet,mh=function(){var i;(i=ci(this,ys))==null||i.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),pi(_h(this),ci(this,Ku)),pi(this,ci(this,ru))},vc=new WeakSet,ph=function(){var i;(i=ci(this,ys))==null||i.setAttribute("aria-expanded","false"),$r(_h(this),ci(this,Ku)),$r(this,ci(this,ru))},Ku=new WeakMap,ru=new WeakMap,iu=new WeakSet,ul=function(i){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;let{x:u,y:h}=ja({anchor:this.anchorElement,floating:this,placement:"top-start"});i!=null||(i=this.offsetWidth);let E=_h(this).getBoundingClientRect(),R=E.width-u-i,G=E.height-h-this.offsetHeight,{style:ee}=ci(this,eu);ee.setProperty("position","absolute"),ee.setProperty("right",`${Math.max(0,R)}px`),ee.setProperty("--_menu-bottom",`${G}px`);let ge=getComputedStyle(this),_t=ee.getPropertyValue("--_menu-bottom")===ge.bottom?G:parseFloat(ge.bottom),It=E.height-_t-parseFloat(ge.marginBottom);this.style.setProperty("--_menu-max-height",`${It}px`)},Wu=new WeakSet,gh=function(i){let u=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),h=u==null?void 0:u.querySelector('[role="menu"]'),{style:E}=ci(this,eu);if(i||E.setProperty("--media-menu-transition-in","none"),h){let R=h.offsetHeight,G=Math.max(h.offsetWidth,u.offsetWidth);this.style.setProperty("min-width",`${G}px`),this.style.setProperty("min-height",`${R}px`),wi(this,iu,ul).call(this,G)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),wi(this,iu,ul).call(this);E.removeProperty("--media-menu-transition-in")},Eh=new WeakSet,mc=function(i){var u;if(i.stopPropagation(),i.composedPath().includes(ci(this,Yu,pc))){(u=ci(this,Gn))==null||u.focus(),this.hidden=!0;return}let h=wi(this,bh,zf).call(this,i);!h||h.hasAttribute("disabled")||(wi(this,Th,Qf).call(this,h),this.handleSelect(i))},Yu=new WeakSet,pc=function(){var i;return(i=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:!0}))==null?void 0:i.find(u=>u.matches('button[part~="back"]'))},yh=new WeakSet,ep=function(i){if(i.target===this)return;wi(this,um,tp).call(this);let u=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(let h of u)h.invokeTargetElement!=i.target&&i.newState=="open"&&h.getAttribute("aria-expanded")=="true"&&!h.invokeTargetElement.hidden&&h.invokeTargetElement.dispatchEvent(new Xl({relatedTarget:h}));for(let h of u)h.setAttribute("aria-expanded",`${!h.submenuElement.hidden}`);wi(this,Wu,gh).call(this,!0)},um=new WeakSet,tp=function(){let i=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!i)},dm=new WeakSet,rp=function(i){var u;aa(this,i.relatedTarget)||(ci(this,no)&&((u=ci(this,Gn))==null||u.focus()),ci(this,ys)&&ci(this,ys)!==i.relatedTarget&&!this.hidden&&(this.hidden=!0))},cm=new WeakSet,ip=function(i){var u,h,E,R,G;let{key:ee,ctrlKey:ge,altKey:_t,metaKey:It}=i;if(!(ge||_t||It)&&this.keysUsed.includes(ee))if(i.preventDefault(),i.stopPropagation(),ee==="Tab"){if(ci(this,no)){this.hidden=!0;return}i.shiftKey?(h=(u=this.previousElementSibling)==null?void 0:u.focus)==null||h.call(u):(R=(E=this.nextElementSibling)==null?void 0:E.focus)==null||R.call(E),this.blur()}else ee==="Escape"?((G=ci(this,Gn))==null||G.focus(),ci(this,no)&&(this.hidden=!0)):ee==="Enter"||ee===" "?this.handleSelect(i):this.handleMove(i)},bh=new WeakSet,zf=function(i){return i.composedPath().find(u=>["menuitemradio","menuitemcheckbox"].includes(u.role))},hm=new WeakSet,ap=function(){return this.items.find(i=>i.tabIndex===0)},Th=new WeakSet,Qf=function(i){for(let u of this.items)u.tabIndex=u===i?0:-1},Xf=new WeakSet,fm=function(i,u){let h=[...this.checkedItems];i.type==="radio"&&this.radioGroupItems.forEach(E=>E.checked=!1),u?i.checked=!i.checked:i.checked=!0,this.checkedItems.some((E,R)=>E!=h[R])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},lo.shadowRootOptions={mode:"open"},lo.getTemplateHTML=Jp;function eg(i){return["menuitem","menuitemradio","menuitemcheckbox"].includes(i==null?void 0:i.role)}function _h(i){var u;return(u=i.getAttribute("bounds")?ma(i,`#${i.getAttribute("bounds")}`):Yr(i)||i.parentElement)!=null?u:i}ie.customElements.get("media-chrome-menu")||ie.customElements.define("media-chrome-menu",lo);var vm=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},dl=(i,u,h)=>(vm(i,u,"read from private field"),h?h.call(i):u.get(i)),au=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},mm=(i,u,h,E)=>(vm(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),Do=(i,u,h)=>(vm(i,u,"access private method"),h),Zf,Ah,pm,np,Jf,gm,Em,sp,cl,Ec,Sh,ym,op,ev,bm;function tg(i){return`
    <style>
      :host {
        transition: var(--media-menu-item-transition,
          background .15s linear,
          opacity .2s ease-in-out
        );
        outline: var(--media-menu-item-outline, 0);
        outline-offset: var(--media-menu-item-outline-offset, -1px);
        cursor: var(--media-cursor, pointer);
        display: flex;
        align-items: center;
        align-self: stretch;
        justify-self: stretch;
        white-space: nowrap;
        white-space-collapse: collapse;
        text-wrap: nowrap;
        padding: .4em .8em .4em 1em;
      }

      :host(:focus-visible) {
        box-shadow: var(--media-menu-item-focus-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));
        outline: var(--media-menu-item-hover-outline, 0);
        outline-offset: var(--media-menu-item-hover-outline-offset,  var(--media-menu-item-outline-offset, -1px));
      }

      :host(:hover) {
        cursor: var(--media-cursor, pointer);
        background: var(--media-menu-item-hover-background, rgb(92 92 102 / .5));
        outline: var(--media-menu-item-hover-outline);
        outline-offset: var(--media-menu-item-hover-outline-offset,  var(--media-menu-item-outline-offset, -1px));
      }

      :host([aria-checked="true"]) {
        background: var(--media-menu-item-checked-background);
      }

      :host([hidden]) {
        display: none;
      }

      :host([disabled]) {
        pointer-events: none;
        color: rgba(255, 255, 255, .3);
      }

      slot:not([name]) {
        width: 100%;
      }

      slot:not([name="submenu"]) {
        display: inline-flex;
        align-items: center;
        transition: inherit;
        opacity: var(--media-menu-item-opacity, 1);
      }

      slot[name="description"] {
        justify-content: end;
      }

      slot[name="description"] > span {
        display: inline-block;
        margin-inline: 1em .2em;
        max-width: var(--media-menu-item-description-max-width, 100px);
        text-overflow: ellipsis;
        overflow: hidden;
        font-size: .8em;
        font-weight: 400;
        text-align: right;
        position: relative;
        top: .04em;
      }

      slot[name="checked-indicator"] {
        display: none;
      }

      :host(:is([role="menuitemradio"],[role="menuitemcheckbox"])) slot[name="checked-indicator"] {
        display: var(--media-menu-item-checked-indicator-display, inline-block);
      }

      
      svg, img, ::slotted(svg), ::slotted(img) {
        height: var(--media-menu-item-icon-height, var(--media-control-height, 24px));
        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
        display: block;
      }

      
      [part~="indicator"],
      ::slotted([part~="indicator"]) {
        fill: var(--media-menu-item-indicator-fill,
          var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))));
        height: var(--media-menu-item-indicator-height, 1.25em);
        margin-right: .5ch;
      }

      [part~="checked-indicator"] {
        visibility: hidden;
      }

      :host([aria-checked="true"]) [part~="checked-indicator"] {
        visibility: visible;
      }
    </style>
    <slot name="checked-indicator">
      <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator">
        <path d="m10 15.17 9.193-9.191 1.414 1.414-10.606 10.606-6.364-6.364 1.414-1.414 4.95 4.95Z"/>
      </svg>
    </slot>
    <slot name="prefix"></slot>
    <slot></slot>
    <slot name="description"></slot>
    <slot name="suffix">
      ${this.getSuffixSlotInnerHTML(i)}
    </slot>
    <slot name="submenu"></slot>
  `}function rg(i){return""}var uo={TYPE:"type",VALUE:"value",CHECKED:"checked",DISABLED:"disabled"},$u=class extends ie.HTMLElement{constructor(){if(super(),au(this,pm),au(this,Jf),au(this,Em),au(this,Ec),au(this,ym),au(this,ev),au(this,Zf,!1),au(this,Ah,void 0),au(this,cl,()=>{var i,u;this.submenuElement.items&&this.setAttribute("submenusize",`${this.submenuElement.items.length}`);let h=this.shadowRoot.querySelector('slot[name="description"]'),E=(i=this.submenuElement.checkedItems)==null?void 0:i[0],R=(u=E==null?void 0:E.dataset.description)!=null?u:E==null?void 0:E.text,G=er.createElement("span");G.textContent=R!=null?R:"",h.replaceChildren(G)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Jr(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i)}this.shadowRoot.addEventListener("slotchange",this)}static get observedAttributes(){return[uo.TYPE,uo.DISABLED,uo.CHECKED,uo.VALUE]}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),Lh(this)&&!this.hasAttribute("aria-checked")&&this.setAttribute("aria-checked","false"),this.addEventListener("click",this),this.addEventListener("keydown",this)}disable(){this.removeAttribute("tabindex"),this.removeEventListener("click",this),this.removeEventListener("keydown",this),this.removeEventListener("keyup",this)}handleEvent(i){switch(i.type){case"slotchange":Do(this,pm,np).call(this,i);break;case"click":this.handleClick(i);break;case"keydown":Do(this,ym,op).call(this,i);break;case"keyup":Do(this,Ec,Sh).call(this,i);break}}attributeChangedCallback(i,u,h){i===uo.CHECKED&&Lh(this)&&!dl(this,Zf)?this.setAttribute("aria-checked",h!=null?"true":"false"):i===uo.TYPE&&h!==u?this.role="menuitem"+h:i===uo.DISABLED&&h!==u&&(h==null?this.enable():this.disable())}connectedCallback(){this.hasAttribute(uo.DISABLED)||this.enable(),this.role="menuitem"+this.type,mm(this,Ah,Tm(this,this.parentNode)),Do(this,ev,bm).call(this),this.submenuElement&&Do(this,Jf,gm).call(this)}disconnectedCallback(){this.disable(),Do(this,ev,bm).call(this),mm(this,Ah,null)}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(i){this.setAttribute("invoketarget",`${i}`)}get invokeTargetElement(){var i;return this.invokeTarget?(i=Qi(this))==null?void 0:i.querySelector(`#${this.invokeTarget}`):this.submenuElement}get submenuElement(){return this.shadowRoot.querySelector('slot[name="submenu"]').assignedElements({flatten:!0})[0]}get type(){var i;return(i=this.getAttribute(uo.TYPE))!=null?i:""}set type(i){this.setAttribute(uo.TYPE,`${i}`)}get value(){var i;return(i=this.getAttribute(uo.VALUE))!=null?i:this.text}set value(i){this.setAttribute(uo.VALUE,i)}get text(){var i;return((i=this.textContent)!=null?i:"").trim()}get checked(){if(Lh(this))return this.getAttribute("aria-checked")==="true"}set checked(i){Lh(this)&&(mm(this,Zf,!0),this.setAttribute("aria-checked",i?"true":"false"),i?this.part.add("checked"):this.part.remove("checked"))}handleClick(i){Lh(this)||this.invokeTargetElement&&aa(this,i.target)&&this.invokeTargetElement.dispatchEvent(new Xl({relatedTarget:this}))}get keysUsed(){return["Enter"," "]}};Zf=new WeakMap,Ah=new WeakMap,pm=new WeakSet,np=function(i){let u=i.target;if(!(u!=null&&u.name))for(let h of u.assignedNodes({flatten:!0}))h instanceof Text&&h.textContent.trim()===""&&h.remove();u.name==="submenu"&&(this.submenuElement?Do(this,Jf,gm).call(this):Do(this,Em,sp).call(this))},Jf=new WeakSet,gm=function(){return j(this,null,function*(){this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",`${!this.submenuElement.hidden}`),this.submenuElement.addEventListener("change",dl(this,cl)),this.submenuElement.addEventListener("addmenuitem",dl(this,cl)),this.submenuElement.addEventListener("removemenuitem",dl(this,cl)),dl(this,cl).call(this)})},Em=new WeakSet,sp=function(){this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.submenuElement.removeEventListener("change",dl(this,cl)),this.submenuElement.removeEventListener("addmenuitem",dl(this,cl)),this.submenuElement.removeEventListener("removemenuitem",dl(this,cl)),dl(this,cl).call(this)},cl=new WeakMap,Ec=new WeakSet,Sh=function(i){let{key:u}=i;if(!this.keysUsed.includes(u)){this.removeEventListener("keyup",Do(this,Ec,Sh));return}this.handleClick(i)},ym=new WeakSet,op=function(i){let{metaKey:u,altKey:h,key:E}=i;if(u||h||!this.keysUsed.includes(E)){this.removeEventListener("keyup",Do(this,Ec,Sh));return}this.addEventListener("keyup",Do(this,Ec,Sh),{once:!0})},ev=new WeakSet,bm=function(){var i;let u=(i=dl(this,Ah))==null?void 0:i.radioGroupItems;if(!u)return;let h=u.filter(E=>E.getAttribute("aria-checked")==="true").pop();h||(h=u[0]);for(let E of u)E.setAttribute("aria-checked","false");h==null||h.setAttribute("aria-checked","true")},$u.shadowRootOptions={mode:"open"},$u.getTemplateHTML=tg,$u.getSuffixSlotInnerHTML=rg;function Lh(i){return i.type==="radio"||i.type==="checkbox"}function Tm(i,u){if(!i)return null;let{host:h}=i.getRootNode();return!u&&h?Tm(i,h):u!=null&&u.items?u:Tm(u,u==null?void 0:u.parentNode)}ie.customElements.get("media-chrome-menu-item")||ie.customElements.define("media-chrome-menu-item",$u);function ig(i){return`
    ${lo.getTemplateHTML(i)}
    <style>
      :host {
        --_menu-bg: rgb(20 20 30 / .8);
        background: var(--media-settings-menu-background,
            var(--media-menu-background,
              var(--media-control-background,
                var(--media-secondary-color, var(--_menu-bg)))));
        min-width: var(--media-settings-menu-min-width, 170px);
        border-radius: 2px 2px 0 0;
        overflow: hidden;
      }

      @-moz-document url-prefix() {
        :host{
          --_menu-bg: rgb(20 20 30);
        }
      }

      :host([role="menu"]) {
        
        justify-content: end;
      }

      slot:not([name]) {
        justify-content: var(--media-settings-menu-justify-content);
        flex-direction: var(--media-settings-menu-flex-direction, column);
        overflow: visible;
      }

      #container.has-expanded {
        --media-settings-menu-item-opacity: 0;
      }
    </style>
  `}var lp=class extends lo{get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Yr(this).querySelector("media-settings-menu-button")}};lp.getTemplateHTML=ig,ie.customElements.get("media-settings-menu")||ie.customElements.define("media-settings-menu",lp);function ag(i){return`
    ${$u.getTemplateHTML.call(this,i)}
    <style>
      slot:not([name="submenu"]) {
        opacity: var(--media-settings-menu-item-opacity, var(--media-menu-item-opacity));
      }

      :host([aria-expanded="true"]:hover) {
        background: transparent;
      }
    </style>
  `}function ng(i){return`
    <svg aria-hidden="true" viewBox="0 0 20 24">
      <path d="m8.12 17.585-.742-.669 4.2-4.665-4.2-4.666.743-.669 4.803 5.335-4.803 5.334Z"/>
    </svg>
  `}var tv=class extends $u{};tv.shadowRootOptions={mode:"open"},tv.getTemplateHTML=ag,tv.getSuffixSlotInnerHTML=ng,ie.customElements.get("media-settings-menu-item")||ie.customElements.define("media-settings-menu-item",tv);var yc=class extends ra{connectedCallback(){super.connectedCallback(),this.invokeTargetElement&&this.setAttribute("aria-haspopup","menu")}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(i){this.setAttribute("invoketarget",`${i}`)}get invokeTargetElement(){var i;return this.invokeTarget?(i=Qi(this))==null?void 0:i.querySelector(`#${this.invokeTarget}`):null}handleClick(){var i;(i=this.invokeTargetElement)==null||i.dispatchEvent(new Xl({relatedTarget:this}))}};ie.customElements.get("media-chrome-menu-button")||ie.customElements.define("media-chrome-menu-button",yc);function sg(){return`
    <style>
      :host([aria-expanded="true"]) slot[name=tooltip] {
        display: none;
      }
    </style>
    <slot name="icon">
      <svg aria-hidden="true" viewBox="0 0 24 24">
        <path d="M4.5 14.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm7.5 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm7.5 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z"/>
      </svg>
    </slot>
  `}function og(){return oe("Settings")}var _m=class extends yc{static get observedAttributes(){return[...super.observedAttributes,"target"]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",oe("settings"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:Yr(this).querySelector("media-settings-menu")}};_m.getSlotTemplateHTML=sg,_m.getTooltipContentHTML=og,ie.customElements.get("media-settings-menu-button")||ie.customElements.define("media-settings-menu-button",_m);var Am=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},up=(i,u,h)=>(Am(i,u,"read from private field"),h?h.call(i):u.get(i)),rv=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},Sm=(i,u,h,E)=>(Am(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),iv=(i,u,h)=>(Am(i,u,"access private method"),h),kh,av,nv,Lm,sv,km,lg=class extends lo{constructor(){super(...arguments),rv(this,nv),rv(this,sv),rv(this,kh,[]),rv(this,av,void 0)}static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_AUDIO_TRACK_LIST,V.MEDIA_AUDIO_TRACK_ENABLED,V.MEDIA_AUDIO_TRACK_UNAVAILABLE]}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_AUDIO_TRACK_ENABLED&&u!==h?this.value=h:i===V.MEDIA_AUDIO_TRACK_LIST&&u!==h&&(Sm(this,kh,me(h!=null?h:"")),iv(this,nv,Lm).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",iv(this,sv,km))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",iv(this,sv,km))}get anchorElement(){var i;return this.anchor!=="auto"?super.anchorElement:(i=Yr(this))==null?void 0:i.querySelector("media-audio-track-menu-button")}get mediaAudioTrackList(){return up(this,kh)}set mediaAudioTrackList(i){Sm(this,kh,i),iv(this,nv,Lm).call(this)}get mediaAudioTrackEnabled(){var i;return(i=di(this,V.MEDIA_AUDIO_TRACK_ENABLED))!=null?i:""}set mediaAudioTrackEnabled(i){qr(this,V.MEDIA_AUDIO_TRACK_ENABLED,i)}};kh=new WeakMap,av=new WeakMap,nv=new WeakSet,Lm=function(){if(up(this,av)===JSON.stringify(this.mediaAudioTrackList))return;Sm(this,av,JSON.stringify(this.mediaAudioTrackList));let i=this.mediaAudioTrackList;this.defaultSlot.textContent="",i.sort((u,h)=>u.id.localeCompare(h.id,void 0,{numeric:!0}));for(let u of i){let h=this.formatMenuItemText(u.label,u),E=gc({type:"radio",text:h,value:`${u.id}`,checked:u.enabled});E.prepend(Rd(this,"checked-indicator")),this.defaultSlot.append(E)}},sv=new WeakSet,km=function(){if(this.value==null)return;let i=new ie.CustomEvent(Te.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)},ie.customElements.get("media-audio-track-menu")||ie.customElements.define("media-audio-track-menu",lg);var ug=`<svg aria-hidden="true" viewBox="0 0 24 24">
  <path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/>
  <path d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"/>
</svg>`;function dg(){return`
    <style>
      :host([aria-expanded="true"]) slot[name=tooltip] {
        display: none;
      }
    </style>
    <slot name="icon">${ug}</slot>
  `}function cg(){return oe("Audio")}var dp=i=>{let u=oe("Audio");i.setAttribute("aria-label",u)},Im=class extends yc{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_AUDIO_TRACK_ENABLED,V.MEDIA_AUDIO_TRACK_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),dp(this)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_LANG&&dp(this)}get invokeTargetElement(){var i;return this.invokeTarget!=null?super.invokeTargetElement:(i=Yr(this))==null?void 0:i.querySelector("media-audio-track-menu")}get mediaAudioTrackEnabled(){var i;return(i=di(this,V.MEDIA_AUDIO_TRACK_ENABLED))!=null?i:""}set mediaAudioTrackEnabled(i){qr(this,V.MEDIA_AUDIO_TRACK_ENABLED,i)}};Im.getSlotTemplateHTML=dg,Im.getTooltipContentHTML=cg,ie.customElements.get("media-audio-track-menu-button")||ie.customElements.define("media-audio-track-menu-button",Im);var Rm=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},hg=(i,u,h)=>(Rm(i,u,"read from private field"),h?h.call(i):u.get(i)),wm=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},fg=(i,u,h,E)=>(Rm(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),ov=(i,u,h)=>(Rm(i,u,"access private method"),h),lv,uv,Cm,dv,Dm,vg=`
  <svg aria-hidden="true" viewBox="0 0 26 24" part="captions-indicator indicator">
    <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
  </svg>`;function mg(i){return`
    ${lo.getTemplateHTML(i)}
    <slot name="captions-indicator" hidden>${vg}</slot>
  `}var cp=class extends lo{constructor(){super(...arguments),wm(this,uv),wm(this,dv),wm(this,lv,void 0)}static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_SUBTITLES_LIST,V.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_SUBTITLES_LIST&&u!==h?ov(this,uv,Cm).call(this):i===V.MEDIA_SUBTITLES_SHOWING&&u!==h&&(this.value=h||"",ov(this,uv,Cm).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",ov(this,dv,Dm))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",ov(this,dv,Dm))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Yr(this).querySelector("media-captions-menu-button")}get mediaSubtitlesList(){return hp(this,V.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(i){fp(this,V.MEDIA_SUBTITLES_LIST,i)}get mediaSubtitlesShowing(){return hp(this,V.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(i){fp(this,V.MEDIA_SUBTITLES_SHOWING,i)}};lv=new WeakMap,uv=new WeakSet,Cm=function(){var i;let u=hg(this,lv)!==JSON.stringify(this.mediaSubtitlesList),h=this.value!==this.getAttribute(V.MEDIA_SUBTITLES_SHOWING);if(!u&&!h)return;fg(this,lv,JSON.stringify(this.mediaSubtitlesList)),this.defaultSlot.textContent="";let E=!this.value,R=gc({type:"radio",text:this.formatMenuItemText(oe("Off")),value:"off",checked:E});R.prepend(Rd(this,"checked-indicator")),this.defaultSlot.append(R);let G=this.mediaSubtitlesList;for(let ee of G){let ge=gc({type:"radio",text:this.formatMenuItemText(ee.label,ee),value:ue(ee),checked:this.value==ue(ee)});ge.prepend(Rd(this,"checked-indicator")),((i=ee.kind)!=null?i:"subs")==="captions"&&ge.append(Rd(this,"captions-indicator")),this.defaultSlot.append(ge)}},dv=new WeakSet,Dm=function(){let i=this.mediaSubtitlesShowing,u=this.getAttribute(V.MEDIA_SUBTITLES_SHOWING),h=this.value!==u;if(i!=null&&i.length&&h&&this.dispatchEvent(new ie.CustomEvent(Te.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:i})),!this.value||!h)return;let E=new ie.CustomEvent(Te.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(E)},cp.getTemplateHTML=mg;var hp=(i,u)=>{let h=i.getAttribute(u);return h?P(h):[]},fp=(i,u,h)=>{if(!(h!=null&&h.length)){i.removeAttribute(u);return}let E=le(h);i.getAttribute(u)!==E&&i.setAttribute(u,E)};ie.customElements.get("media-captions-menu")||ie.customElements.define("media-captions-menu",cp);var pg=`<svg aria-hidden="true" viewBox="0 0 26 24">
  <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
</svg>`,gg=`<svg aria-hidden="true" viewBox="0 0 26 24">
  <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.81 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/>
</svg>`;function Eg(){return`
    <style>
      :host([data-captions-enabled="true"]) slot[name=off] {
        display: none !important;
      }

      
      :host(:not([data-captions-enabled="true"])) slot[name=on] {
        display: none !important;
      }

      :host([aria-expanded="true"]) slot[name=tooltip] {
        display: none;
      }
    </style>

    <slot name="icon">
      <slot name="on">${pg}</slot>
      <slot name="off">${gg}</slot>
    </slot>
  `}function yg(){return oe("Captions")}var vp=i=>{i.setAttribute("data-captions-enabled",wt(i).toString())},mp=i=>{i.setAttribute("aria-label",oe("closed captions"))},Mm=class extends yc{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_SUBTITLES_LIST,V.MEDIA_SUBTITLES_SHOWING,V.MEDIA_LANG]}connectedCallback(){super.connectedCallback(),mp(this),vp(this)}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_SUBTITLES_SHOWING?vp(this):i===V.MEDIA_LANG&&mp(this)}get invokeTargetElement(){var i;return this.invokeTarget!=null?super.invokeTargetElement:(i=Yr(this))==null?void 0:i.querySelector("media-captions-menu")}get mediaSubtitlesList(){return pp(this,V.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(i){gp(this,V.MEDIA_SUBTITLES_LIST,i)}get mediaSubtitlesShowing(){return pp(this,V.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(i){gp(this,V.MEDIA_SUBTITLES_SHOWING,i)}};Mm.getSlotTemplateHTML=Eg,Mm.getTooltipContentHTML=yg;var pp=(i,u)=>{let h=i.getAttribute(u);return h?P(h):[]},gp=(i,u,h)=>{if(!(h!=null&&h.length)){i.removeAttribute(u);return}let E=le(h);i.getAttribute(u)!==E&&i.setAttribute(u,E)};ie.customElements.get("media-captions-menu-button")||ie.customElements.define("media-captions-menu-button",Mm);var Ep=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},bc=(i,u,h)=>(Ep(i,u,"read from private field"),h?h.call(i):u.get(i)),Pm=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},Tc=(i,u,h)=>(Ep(i,u,"access private method"),h),qu,_c,Ih,cv,Om,xm={RATES:"rates"},bg=class extends lo{constructor(){super(),Pm(this,_c),Pm(this,cv),Pm(this,qu,new pn(this,xm.RATES,{defaultValue:lf})),Tc(this,_c,Ih).call(this)}static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_PLAYBACK_RATE,xm.RATES]}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_PLAYBACK_RATE&&u!=h?(this.value=h,Tc(this,_c,Ih).call(this)):i===xm.RATES&&u!=h&&(bc(this,qu).value=h,Tc(this,_c,Ih).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Tc(this,cv,Om))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Tc(this,cv,Om))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Yr(this).querySelector("media-playback-rate-menu-button")}get rates(){return bc(this,qu)}set rates(i){i?Array.isArray(i)?bc(this,qu).value=i.join(" "):typeof i=="string"&&(bc(this,qu).value=i):bc(this,qu).value="",Tc(this,_c,Ih).call(this)}get mediaPlaybackRate(){return ui(this,V.MEDIA_PLAYBACK_RATE,Au)}set mediaPlaybackRate(i){Li(this,V.MEDIA_PLAYBACK_RATE,i)}};qu=new WeakMap,_c=new WeakSet,Ih=function(){this.defaultSlot.textContent="";let i=this.mediaPlaybackRate,u=new Set(Array.from(bc(this,qu)).map(E=>Number(E)));i>0&&!u.has(i)&&u.add(i);let h=Array.from(u).sort((E,R)=>E-R);for(let E of h){let R=gc({type:"radio",text:this.formatMenuItemText(`${E}x`,E),value:E.toString(),checked:i===E});R.prepend(Rd(this,"checked-indicator")),this.defaultSlot.append(R)}},cv=new WeakSet,Om=function(){if(!this.value)return;let i=new ie.CustomEvent(Te.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)},ie.customElements.get("media-playback-rate-menu")||ie.customElements.define("media-playback-rate-menu",bg);var hv=1;function Tg(i){return`
    <style>
      :host {
        min-width: 5ch;
        padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));
      }
      
      :host([aria-expanded="true"]) slot {
        display: block;
      }

      :host([aria-expanded="true"]) slot[name=tooltip] {
        display: none;
      }
    </style>
    <slot name="icon">${i.mediaplaybackrate||hv}x</slot>
  `}function _g(){return oe("Playback rate")}var Nm=class extends yc{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_PLAYBACK_RATE]}constructor(){var i;super(),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(i=this.mediaPlaybackRate)!=null?i:hv}x`}attributeChangedCallback(i,u,h){if(super.attributeChangedCallback(i,u,h),i===V.MEDIA_PLAYBACK_RATE){let E=h?+h:Number.NaN,R=Number.isNaN(E)?hv:E;this.container.innerHTML=`${R}x`,this.setAttribute("aria-label",oe("Playback rate {playbackRate}",{playbackRate:R}))}}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:Yr(this).querySelector("media-playback-rate-menu")}get mediaPlaybackRate(){return ui(this,V.MEDIA_PLAYBACK_RATE,hv)}set mediaPlaybackRate(i){Li(this,V.MEDIA_PLAYBACK_RATE,i)}};Nm.getSlotTemplateHTML=Tg,Nm.getTooltipContentHTML=_g,ie.customElements.get("media-playback-rate-menu-button")||ie.customElements.define("media-playback-rate-menu-button",Nm);var Um=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},Rh=(i,u,h)=>(Um(i,u,"read from private field"),h?h.call(i):u.get(i)),fv=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},yp=(i,u,h,E)=>(Um(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),Ac=(i,u,h)=>(Um(i,u,"access private method"),h),wh,Sc,Lc,Ch,vv,Fm,Ag=class extends lo{constructor(){super(...arguments),fv(this,Lc),fv(this,vv),fv(this,wh,[]),fv(this,Sc,{})}static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_RENDITION_LIST,V.MEDIA_RENDITION_SELECTED,V.MEDIA_RENDITION_UNAVAILABLE,V.MEDIA_HEIGHT]}static formatMenuItemText(i,u){return super.formatMenuItemText(i,u)}static formatRendition(i,{showBitrate:u=!1}={}){let h=`${Math.min(i.width,i.height)}p`;if(u&&i.bitrate){let E=i.bitrate/1e6,R=`${E.toFixed(E<1?1:0)} Mbps`;return`${h} (${R})`}return this.formatMenuItemText(h,i)}static compareRendition(i,u){var h,E;return u.height===i.height?((h=u.bitrate)!=null?h:0)-((E=i.bitrate)!=null?E:0):u.height-i.height}attributeChangedCallback(i,u,h){super.attributeChangedCallback(i,u,h),i===V.MEDIA_RENDITION_SELECTED&&u!==h?(this.value=h!=null?h:"auto",Ac(this,Lc,Ch).call(this)):i===V.MEDIA_RENDITION_LIST&&u!==h?(yp(this,wh,Wt(h)),Ac(this,Lc,Ch).call(this)):i===V.MEDIA_HEIGHT&&u!==h&&Ac(this,Lc,Ch).call(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Ac(this,vv,Fm))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Ac(this,vv,Fm))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Yr(this).querySelector("media-rendition-menu-button")}get mediaRenditionList(){return Rh(this,wh)}set mediaRenditionList(i){yp(this,wh,i),Ac(this,Lc,Ch).call(this)}get mediaRenditionSelected(){return di(this,V.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(i){qr(this,V.MEDIA_RENDITION_SELECTED,i)}get mediaHeight(){return ui(this,V.MEDIA_HEIGHT)}set mediaHeight(i){Li(this,V.MEDIA_HEIGHT,i)}compareRendition(i,u){return this.constructor.compareRendition(i,u)}formatMenuItemText(i,u){return this.constructor.formatMenuItemText(i,u)}formatRendition(i,u){return this.constructor.formatRendition(i,u)}showRenditionBitrate(i){return this.mediaRenditionList.some(u=>u!==i&&u.height===i.height&&u.bitrate!==i.bitrate)}};wh=new WeakMap,Sc=new WeakMap,Lc=new WeakSet,Ch=function(){if(Rh(this,Sc).mediaRenditionList===JSON.stringify(this.mediaRenditionList)&&Rh(this,Sc).mediaHeight===this.mediaHeight)return;Rh(this,Sc).mediaRenditionList=JSON.stringify(this.mediaRenditionList),Rh(this,Sc).mediaHeight=this.mediaHeight;let i=this.mediaRenditionList.sort(this.compareRendition.bind(this)),u=i.find(ee=>ee.id===this.mediaRenditionSelected);for(let ee of i)ee.selected=ee===u;this.defaultSlot.textContent="";let h=!this.mediaRenditionSelected;for(let ee of i){let ge=this.formatRendition(ee,{showBitrate:this.showRenditionBitrate(ee)}),_t=gc({type:"radio",text:ge,value:`${ee.id}`,checked:ee.selected&&!h});_t.prepend(Rd(this,"checked-indicator")),this.defaultSlot.append(_t)}let E=u&&this.showRenditionBitrate(u),R=h?u?this.formatMenuItemText(`${oe("Auto")} \u2022 ${this.formatRendition(u,{showBitrate:E})}`,u):this.formatMenuItemText(`${oe("Auto")} (${this.mediaHeight}p)`):this.formatMenuItemText(oe("Auto")),G=gc({type:"radio",text:R,value:"auto",checked:h});G.dataset.description=R,G.prepend(Rd(this,"checked-indicator")),this.defaultSlot.append(G)},vv=new WeakSet,Fm=function(){if(this.value==null)return;let i=new ie.CustomEvent(Te.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)},ie.customElements.get("media-rendition-menu")||ie.customElements.define("media-rendition-menu",Ag);var Sg=`<svg aria-hidden="true" viewBox="0 0 24 24">
  <path d="M13.5 2.5h2v6h-2v-2h-11v-2h11v-2Zm4 2h4v2h-4v-2Zm-12 4h2v6h-2v-2h-3v-2h3v-2Zm4 2h12v2h-12v-2Zm1 4h2v6h-2v-2h-8v-2h8v-2Zm4 2h7v2h-7v-2Z" />
</svg>`;function Lg(){return`
    <style>
      :host([aria-expanded="true"]) slot[name=tooltip] {
        display: none;
      }
    </style>
    <slot name="icon">${Sg}</slot>
  `}function kg(){return oe("Quality")}var Bm=class extends yc{static get observedAttributes(){return[...super.observedAttributes,V.MEDIA_RENDITION_SELECTED,V.MEDIA_RENDITION_UNAVAILABLE,V.MEDIA_HEIGHT]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",oe("quality"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:Yr(this).querySelector("media-rendition-menu")}get mediaRenditionSelected(){return di(this,V.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(i){qr(this,V.MEDIA_RENDITION_SELECTED,i)}get mediaHeight(){return ui(this,V.MEDIA_HEIGHT)}set mediaHeight(i){Li(this,V.MEDIA_HEIGHT,i)}};Bm.getSlotTemplateHTML=Lg,Bm.getTooltipContentHTML=kg,ie.customElements.get("media-rendition-menu-button")||ie.customElements.define("media-rendition-menu-button",Bm);var Hm=(i,u,h)=>{if(!u.has(i))throw TypeError("Cannot "+h)},hl=(i,u,h)=>(Hm(i,u,"read from private field"),h?h.call(i):u.get(i)),fl=(i,u,h)=>{if(u.has(i))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(i):u.set(i,h)},bp=(i,u,h,E)=>(Hm(i,u,"write to private field"),E?E.call(i,h):u.set(i,h),h),co=(i,u,h)=>(Hm(i,u,"access private method"),h),kc,Dh,mv,Cd,Ic,Vm,Tp,pv,Gm,gv,Km,_p,Ev,yv,bv;function Ig(i){return`
      ${lo.getTemplateHTML(i)}
      <style>
        :host {
          --_menu-bg: rgb(20 20 30 / .8);
          background: var(--media-settings-menu-background,
            var(--media-menu-background,
              var(--media-control-background,
                var(--media-secondary-color, var(--_menu-bg)))));
          min-width: var(--media-settings-menu-min-width, 170px);
          border-radius: 2px;
          overflow: hidden;
        }
      </style>
    `}var Ap=class extends lo{constructor(){super(),fl(this,Dh),fl(this,Cd),fl(this,Vm),fl(this,pv),fl(this,Km),fl(this,kc,!1),fl(this,gv,i=>{let u=i.target,h=(u==null?void 0:u.nodeName)==="VIDEO",E=co(this,pv,Gm).call(this,u);(h||E)&&(hl(this,kc)?co(this,Cd,Ic).call(this):co(this,Km,_p).call(this,i))}),fl(this,Ev,i=>{let u=i.target,h=this.contains(u),E=i.button===2,R=(u==null?void 0:u.nodeName)==="VIDEO",G=co(this,pv,Gm).call(this,u);h||E&&(R||G)||co(this,Cd,Ic).call(this)}),fl(this,yv,i=>{i.key==="Escape"&&co(this,Cd,Ic).call(this)}),fl(this,bv,i=>{var u,h;let E=i.target;if((u=E.matches)!=null&&u.call(E,'button[invoke="copy"]')){let R=(h=E.closest("media-context-menu-item"))==null?void 0:h.querySelector('input[slot="copy"]');R&&navigator.clipboard.writeText(R.value)}co(this,Cd,Ic).call(this)}),this.setAttribute("noautohide",""),co(this,Dh,mv).call(this)}connectedCallback(){super.connectedCallback(),Yr(this).addEventListener("contextmenu",hl(this,gv)),this.addEventListener("click",hl(this,bv))}disconnectedCallback(){super.disconnectedCallback(),Yr(this).removeEventListener("contextmenu",hl(this,gv)),this.removeEventListener("click",hl(this,bv)),document.removeEventListener("mousedown",hl(this,Ev)),document.removeEventListener("keydown",hl(this,yv))}};kc=new WeakMap,Dh=new WeakSet,mv=function(){this.hidden=!hl(this,kc)},Cd=new WeakSet,Ic=function(){bp(this,kc,!1),co(this,Dh,mv).call(this)},Vm=new WeakSet,Tp=function(){document.querySelectorAll("media-context-menu").forEach(i=>{var u;i!==this&&co(u=i,Cd,Ic).call(u)})},pv=new WeakSet,Gm=function(i){return i?i.hasAttribute("slot")&&i.getAttribute("slot")==="media"?!0:i.nodeName.includes("-")&&i.tagName.includes("-")?i.hasAttribute("src")||i.hasAttribute("poster")||i.hasAttribute("preload")||i.hasAttribute("playsinline"):!1:!1},gv=new WeakMap,Km=new WeakSet,_p=function(i){i.preventDefault(),co(this,Vm,Tp).call(this),bp(this,kc,!0),this.style.position="fixed",this.style.left=`${i.clientX}px`,this.style.top=`${i.clientY}px`,co(this,Dh,mv).call(this),document.addEventListener("mousedown",hl(this,Ev),{once:!0}),document.addEventListener("keydown",hl(this,yv),{once:!0})},Ev=new WeakMap,yv=new WeakMap,bv=new WeakMap,Ap.getTemplateHTML=Ig,ie.customElements.get("media-context-menu")||ie.customElements.define("media-context-menu",Ap);function Rg(i){return`
    ${$u.getTemplateHTML.call(this,i)}
    <style>
        ::slotted(*) {
            color: var(--media-text-color, white);
            text-decoration: none;
            border: none;
            background: none;
            cursor: pointer;
            padding: 0;
            min-height: var(--media-control-height, 24px);
        }
    </style>
  `}var Wm=class extends $u{};Wm.shadowRootOptions={mode:"open"},Wm.getTemplateHTML=Rg,ie.customElements.get("media-context-menu-item")||ie.customElements.define("media-context-menu-item",Wm);var Ym=_e.createElement("template");"innerHTML"in Ym&&(Ym.innerHTML=Ma);var Sp,Lp,kp=class extends re{};kp.template=(Lp=(Sp=Ym.content)==null?void 0:Sp.children)==null?void 0:Lp[0],ct.customElements.get("media-theme-gerwig")||ct.customElements.define("media-theme-gerwig",kp);var wg="gerwig",nu={SRC:"src",POSTER:"poster"},Ct={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",FULLSCREEN_ELEMENT:"fullscreen-element",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",VIDEO_TITLE:"video-title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",NO_MUTED_PREF:"no-muted-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips",PROUDLY_DISPLAY_MUX_BADGE:"proudly-display-mux-badge",DISABLE_PSEUDO_ENDED:"disable-pseudo-ended"},$m=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","videotitle","novolumepref","nomutedpref","proudlydisplaymuxbadge"];function Cg(i,u){var h,E,R;return O(he({src:!i.playbackId&&i.src,playbackId:i.playbackId,hasSrc:!!i.playbackId||!!i.src||!!i.currentSrc,poster:i.poster,storyboard:((h=i.media)==null?void 0:h.currentSrc)&&i.storyboard,storyboardSrc:i.getAttribute(Ct.STORYBOARD_SRC),fullscreenElement:i.getAttribute(Ct.FULLSCREEN_ELEMENT),placeholder:i.getAttribute("placeholder"),themeTemplate:Mg(i),thumbnailTime:!i.tokens.thumbnail&&i.thumbnailTime,autoplay:i.autoplay,crossOrigin:i.crossOrigin,loop:i.loop,noHotKeys:i.hasAttribute(Ct.NOHOTKEYS),hotKeys:i.getAttribute(Ct.HOTKEYS),muted:i.muted,paused:i.paused,preload:i.preload,envKey:i.envKey,preferCmcd:i.preferCmcd,debug:i.debug,disableTracking:i.disableTracking,disableCookies:i.disableCookies,tokens:i.tokens,beaconCollectionDomain:i.beaconCollectionDomain,maxResolution:i.maxResolution,minResolution:i.minResolution,maxAutoResolution:i.maxAutoResolution,programStartTime:i.programStartTime,programEndTime:i.programEndTime,assetStartTime:i.assetStartTime,assetEndTime:i.assetEndTime,renditionOrder:i.renditionOrder,metadata:i.metadata,playerInitTime:i.playerInitTime,playerSoftwareName:i.playerSoftwareName,playerSoftwareVersion:i.playerSoftwareVersion,startTime:i.startTime,preferPlayback:i.preferPlayback,audio:i.audio,defaultStreamType:i.defaultStreamType,targetLiveWindow:i.getAttribute(sr.Attributes.TARGET_LIVE_WINDOW),streamType:lh(i.getAttribute(sr.Attributes.STREAM_TYPE)),primaryColor:i.getAttribute(Ct.PRIMARY_COLOR),secondaryColor:i.getAttribute(Ct.SECONDARY_COLOR),accentColor:i.getAttribute(Ct.ACCENT_COLOR),forwardSeekOffset:i.forwardSeekOffset,backwardSeekOffset:i.backwardSeekOffset,defaultHiddenCaptions:i.defaultHiddenCaptions,defaultDuration:i.defaultDuration,defaultShowRemainingTime:i.defaultShowRemainingTime,hideDuration:Pg(i),playbackRates:i.getAttribute(Ct.PLAYBACK_RATES),customDomain:(E=i.getAttribute(sr.Attributes.CUSTOM_DOMAIN))!=null?E:void 0,title:i.getAttribute(Ct.TITLE),videoTitle:(R=i.getAttribute(Ct.VIDEO_TITLE))!=null?R:i.getAttribute(Ct.TITLE),novolumepref:i.hasAttribute(Ct.NO_VOLUME_PREF),nomutedpref:i.hasAttribute(Ct.NO_MUTED_PREF),proudlyDisplayMuxBadge:i.hasAttribute(Ct.PROUDLY_DISPLAY_MUX_BADGE),castReceiver:i.castReceiver,disablePseudoEnded:i.hasAttribute(Ct.DISABLE_PSEUDO_ENDED)},u),{extraSourceParams:i.extraSourceParams})}var Dg=p.formatErrorMessage;p.formatErrorMessage=i=>{var u,h;if(i instanceof sr.MediaError){let E=ca(i,!1);return`
      ${E!=null&&E.title?`<h3>${E.title}</h3>`:""}
      ${E!=null&&E.message||E!=null&&E.linkUrl?`<p>
        ${E==null?void 0:E.message}
        ${E!=null&&E.linkUrl?`<a
              href="${E.linkUrl}"
              target="_blank"
              rel="external noopener"
              aria-label="${(u=E.linkText)!=null?u:""} ${(0,Ri.i18n)("(opens in a new window)")}"
              >${(h=E.linkText)!=null?h:E.linkUrl}</a
            >`:""}
      </p>`:""}
    `}return Dg(i)};function Mg(i){var u,h;let E=i.theme;if(E){let R=(h=(u=i.getRootNode())==null?void 0:u.getElementById)==null?void 0:h.call(u,E);if(R&&R instanceof HTMLTemplateElement)return R;E.startsWith("media-theme-")||(E=`media-theme-${E}`);let G=ct.customElements.get(E);if(G!=null&&G.template)return G.template}}function Pg(i){var u;let h=(u=i.mediaController)==null?void 0:u.querySelector("media-time-display");return h&&getComputedStyle(h).getPropertyValue("--media-duration-display-display").trim()==="none"}function Ip(i){let u=i.videoTitle?{video_title:i.videoTitle}:{};return i.getAttributeNames().filter(h=>h.startsWith("metadata-")).reduce((h,E)=>{let R=i.getAttribute(E);return R!==null&&(h[E.replace(/^metadata-/,"").replace(/-/g,"_")]=R),h},u)}var Og=Object.values(sr.Attributes),xg=Object.values(nu),Ng=Object.values(Ct),qm=sc(),jm="mux-player",Rp={isDialogOpen:!1},Ug={redundant_streams:!0},Tv,_v,Av,Dd,Sv,Rc,_a,ju,wp,zm,Md,Cp,Dp,Mp,Pp,Fg=class extends Vf{constructor(){super(),ae(this,_a),ae(this,Tv),ae(this,_v,!1),ae(this,Av,{}),ae(this,Dd,!0),ae(this,Sv,new oc(this,"hotkeys")),ae(this,Rc,O(he({},Rp),{onCloseErrorDialog:i=>{var u;((u=i.composedPath()[0])==null?void 0:u.localName)==="media-error-dialog"&&ke(this,_a,zm).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:i=>{var u;((u=i.composedPath()[0])==null?void 0:u.localName)==="media-error-dialog"&&(oh(this,_e.activeElement)||i.preventDefault())}})),dt(this,Tv,(0,Ri.generatePlayerInitTime)()),this.attachShadow({mode:"open"}),ke(this,_a,wp).call(this),this.isConnected&&ke(this,_a,ju).call(this)}static get NAME(){return jm}static get VERSION(){return qm}static get observedAttributes(){var i;return[...(i=Vf.observedAttributes)!=null?i:[],...xg,...Og,...Ng]}get mediaTheme(){var i;return(i=this.shadowRoot)==null?void 0:i.querySelector("media-theme")}get mediaController(){var i,u;return(u=(i=this.mediaTheme)==null?void 0:i.shadowRoot)==null?void 0:u.querySelector("media-controller")}connectedCallback(){let i=this.media;i&&(i.metadata=Ip(this))}attributeChangedCallback(i,u,h){switch(ke(this,_a,ju).call(this),super.attributeChangedCallback(i,u,h),i){case Ct.HOTKEYS:Je(this,Sv).value=h;break;case Ct.THUMBNAIL_TIME:{h!=null&&this.tokens.thumbnail&&io((0,Ri.i18n)("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break}case Ct.THUMBNAIL_TOKEN:{if(h){let E=(0,Ri.parseJwt)(h);if(E){let{aud:R}=E,G=Ri.MuxJWTAud.THUMBNAIL;R!==G&&io((0,Ri.i18n)("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:R,expectedAud:G,tokenNamePrefix:"thumbnail"}))}}break}case Ct.STORYBOARD_TOKEN:{if(h){let E=(0,Ri.parseJwt)(h);if(E){let{aud:R}=E,G=Ri.MuxJWTAud.STORYBOARD;R!==G&&io((0,Ri.i18n)("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:R,expectedAud:G,tokenNamePrefix:"storyboard"}))}}break}case Ct.DRM_TOKEN:{if(h){let E=(0,Ri.parseJwt)(h);if(E){let{aud:R}=E,G=Ri.MuxJWTAud.DRM;R!==G&&io((0,Ri.i18n)("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:R,expectedAud:G,tokenNamePrefix:"drm"}))}}break}case sr.Attributes.PLAYBACK_ID:{h!=null&&h.includes("?token")&&as((0,Ri.i18n)("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:h}));break}case sr.Attributes.STREAM_TYPE:{h&&![Ri.StreamTypes.LIVE,Ri.StreamTypes.ON_DEMAND,Ri.StreamTypes.UNKNOWN].includes(h)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=h.includes("dvr")?Number.POSITIVE_INFINITY:0:Ff({file:"invalid-stream-type.md",message:(0,Ri.i18n)("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):h===Ri.StreamTypes.LIVE?this.getAttribute(Ct.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN;break}case Ct.FULLSCREEN_ELEMENT:{if(h!=null||h!==u){let E=_e.getElementById(h),R=E==null?void 0:E.querySelector("mux-player");this.mediaController&&E&&R&&(this.mediaController.fullscreenElement=E)}break}}[sr.Attributes.PLAYBACK_ID,nu.SRC,Ct.PLAYBACK_TOKEN].includes(i)&&u!==h&&dt(this,Rc,he(he({},Je(this,Rc)),Rp)),ke(this,_a,Md).call(this,{[Nf(i)]:h})}requestFullscreen(i){return j(this,null,function*(){var u;if(!(!this.mediaController||this.mediaController.hasAttribute(V.MEDIA_IS_FULLSCREEN)))return(u=this.mediaController)==null||u.dispatchEvent(new ct.CustomEvent(Te.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((h,E)=>{var R;(R=this.mediaController)==null||R.addEventListener(Br.MEDIA_IS_FULLSCREEN,()=>h(),{once:!0})})})}exitFullscreen(){return j(this,null,function*(){var i;if(!(!this.mediaController||!this.mediaController.hasAttribute(V.MEDIA_IS_FULLSCREEN)))return(i=this.mediaController)==null||i.dispatchEvent(new ct.CustomEvent(Te.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((u,h)=>{var E;(E=this.mediaController)==null||E.addEventListener(Br.MEDIA_IS_FULLSCREEN,()=>u(),{once:!0})})})}get preferCmcd(){var i;return(i=this.getAttribute(sr.Attributes.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?Ri.CmcdTypeValues.includes(i)?this.setAttribute(sr.Attributes.PREFER_CMCD,i):io(`Invalid value for preferCmcd. Must be one of ${Ri.CmcdTypeValues.join()}`):this.removeAttribute(sr.Attributes.PREFER_CMCD))}get hasPlayed(){var i,u;return(u=(i=this.mediaController)==null?void 0:i.hasAttribute(V.MEDIA_HAS_PLAYED))!=null?u:!1}get inLiveWindow(){var i;return(i=this.mediaController)==null?void 0:i.hasAttribute(V.MEDIA_TIME_IS_LIVE)}get _hls(){var i;return(i=this.media)==null?void 0:i._hls}get mux(){var i;return(i=this.media)==null?void 0:i.mux}get theme(){var i;return(i=this.getAttribute(Ct.THEME))!=null?i:wg}set theme(i){this.setAttribute(Ct.THEME,`${i}`)}get themeProps(){let i=this.mediaTheme;if(!i)return;let u={};for(let h of i.getAttributeNames()){if($m.includes(h))continue;let E=i.getAttribute(h);u[Cf(h)]=E===""?!0:E}return u}set themeProps(i){var u,h;ke(this,_a,ju).call(this);let E=he(he({},this.themeProps),i);for(let R in E){if($m.includes(R))continue;let G=i==null?void 0:i[R];typeof G=="boolean"||G==null?(u=this.mediaTheme)==null||u.toggleAttribute(Td(R),!!G):(h=this.mediaTheme)==null||h.setAttribute(Td(R),G)}}get playbackId(){var i;return(i=this.getAttribute(sr.Attributes.PLAYBACK_ID))!=null?i:void 0}set playbackId(i){i?this.setAttribute(sr.Attributes.PLAYBACK_ID,i):this.removeAttribute(sr.Attributes.PLAYBACK_ID)}get src(){var i,u;return this.playbackId?(i=zu(this,nu.SRC))!=null?i:void 0:(u=this.getAttribute(nu.SRC))!=null?u:void 0}set src(i){i?this.setAttribute(nu.SRC,i):this.removeAttribute(nu.SRC)}get poster(){var i;let u=this.getAttribute(nu.POSTER);if(u!=null)return u;let{tokens:h}=this;if(h.playback&&!h.thumbnail){io("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return Of(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,programTime:this.programStartTime,token:h.thumbnail})}set poster(i){i||i===""?this.setAttribute(nu.POSTER,i):this.removeAttribute(nu.POSTER)}get storyboardSrc(){var i;return(i=this.getAttribute(Ct.STORYBOARD_SRC))!=null?i:void 0}set storyboardSrc(i){i?this.setAttribute(Ct.STORYBOARD_SRC,i):this.removeAttribute(Ct.STORYBOARD_SRC)}get storyboard(){let{tokens:i}=this;if(this.storyboardSrc&&!i.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[Ri.StreamTypes.LIVE,Ri.StreamTypes.UNKNOWN].includes(this.streamType)||i.playback&&!i.storyboard))return xf(this.playbackId,{customDomain:this.customDomain,token:i.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(Ct.AUDIO)}set audio(i){if(!i){this.removeAttribute(Ct.AUDIO);return}this.setAttribute(Ct.AUDIO,"")}get hotkeys(){return Je(this,Sv)}get nohotkeys(){return this.hasAttribute(Ct.NOHOTKEYS)}set nohotkeys(i){if(!i){this.removeAttribute(Ct.NOHOTKEYS);return}this.setAttribute(Ct.NOHOTKEYS,"")}get thumbnailTime(){return is(this.getAttribute(Ct.THUMBNAIL_TIME))}set thumbnailTime(i){this.setAttribute(Ct.THUMBNAIL_TIME,`${i}`)}get videoTitle(){var i,u;return(u=(i=this.getAttribute(Ct.VIDEO_TITLE))!=null?i:this.getAttribute(Ct.TITLE))!=null?u:""}set videoTitle(i){i!==this.videoTitle&&(i?this.setAttribute(Ct.VIDEO_TITLE,i):this.removeAttribute(Ct.VIDEO_TITLE))}get placeholder(){var i;return(i=zu(this,Ct.PLACEHOLDER))!=null?i:""}set placeholder(i){this.setAttribute(Ct.PLACEHOLDER,`${i}`)}get primaryColor(){var i,u;let h=this.getAttribute(Ct.PRIMARY_COLOR);if(h!=null||this.mediaTheme&&(h=(u=(i=ct.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:u.trim(),h))return h}set primaryColor(i){this.setAttribute(Ct.PRIMARY_COLOR,`${i}`)}get secondaryColor(){var i,u;let h=this.getAttribute(Ct.SECONDARY_COLOR);if(h!=null||this.mediaTheme&&(h=(u=(i=ct.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:u.trim(),h))return h}set secondaryColor(i){this.setAttribute(Ct.SECONDARY_COLOR,`${i}`)}get accentColor(){var i,u;let h=this.getAttribute(Ct.ACCENT_COLOR);if(h!=null||this.mediaTheme&&(h=(u=(i=ct.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:u.trim(),h))return h}set accentColor(i){this.setAttribute(Ct.ACCENT_COLOR,`${i}`)}get defaultShowRemainingTime(){return this.hasAttribute(Ct.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(i){i?this.setAttribute(Ct.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(Ct.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(Ct.PLAYBACK_RATES))return this.getAttribute(Ct.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(i=>Number(i)).filter(i=>!Number.isNaN(i)).sort((i,u)=>i-u)}set playbackRates(i){if(!i){this.removeAttribute(Ct.PLAYBACK_RATES);return}this.setAttribute(Ct.PLAYBACK_RATES,i.join(" "))}get forwardSeekOffset(){var i;return(i=is(this.getAttribute(Ct.FORWARD_SEEK_OFFSET)))!=null?i:10}set forwardSeekOffset(i){this.setAttribute(Ct.FORWARD_SEEK_OFFSET,`${i}`)}get backwardSeekOffset(){var i;return(i=is(this.getAttribute(Ct.BACKWARD_SEEK_OFFSET)))!=null?i:10}set backwardSeekOffset(i){this.setAttribute(Ct.BACKWARD_SEEK_OFFSET,`${i}`)}get defaultHiddenCaptions(){return this.hasAttribute(Ct.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(i){i?this.setAttribute(Ct.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(Ct.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return is(this.getAttribute(Ct.DEFAULT_DURATION))}set defaultDuration(i){i==null?this.removeAttribute(Ct.DEFAULT_DURATION):this.setAttribute(Ct.DEFAULT_DURATION,`${i}`)}get playerInitTime(){return this.hasAttribute(sr.Attributes.PLAYER_INIT_TIME)?is(this.getAttribute(sr.Attributes.PLAYER_INIT_TIME)):Je(this,Tv)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(sr.Attributes.PLAYER_INIT_TIME):this.setAttribute(sr.Attributes.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=this.getAttribute(sr.Attributes.PLAYER_SOFTWARE_NAME))!=null?i:jm}get playerSoftwareVersion(){var i;return(i=this.getAttribute(sr.Attributes.PLAYER_SOFTWARE_VERSION))!=null?i:qm}get beaconCollectionDomain(){var i;return(i=this.getAttribute(sr.Attributes.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(sr.Attributes.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(sr.Attributes.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var i;return(i=this.getAttribute(sr.Attributes.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(sr.Attributes.MAX_RESOLUTION,i):this.removeAttribute(sr.Attributes.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(sr.Attributes.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(sr.Attributes.MIN_RESOLUTION,i):this.removeAttribute(sr.Attributes.MIN_RESOLUTION))}get maxAutoResolution(){var i;return(i=this.getAttribute(sr.Attributes.MAX_AUTO_RESOLUTION))!=null?i:void 0}set maxAutoResolution(i){i==null?this.removeAttribute(sr.Attributes.MAX_AUTO_RESOLUTION):this.setAttribute(sr.Attributes.MAX_AUTO_RESOLUTION,i)}get renditionOrder(){var i;return(i=this.getAttribute(sr.Attributes.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(sr.Attributes.RENDITION_ORDER,i):this.removeAttribute(sr.Attributes.RENDITION_ORDER))}get programStartTime(){return is(this.getAttribute(sr.Attributes.PROGRAM_START_TIME))}set programStartTime(i){i==null?this.removeAttribute(sr.Attributes.PROGRAM_START_TIME):this.setAttribute(sr.Attributes.PROGRAM_START_TIME,`${i}`)}get programEndTime(){return is(this.getAttribute(sr.Attributes.PROGRAM_END_TIME))}set programEndTime(i){i==null?this.removeAttribute(sr.Attributes.PROGRAM_END_TIME):this.setAttribute(sr.Attributes.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){return is(this.getAttribute(sr.Attributes.ASSET_START_TIME))}set assetStartTime(i){i==null?this.removeAttribute(sr.Attributes.ASSET_START_TIME):this.setAttribute(sr.Attributes.ASSET_START_TIME,`${i}`)}get assetEndTime(){return is(this.getAttribute(sr.Attributes.ASSET_END_TIME))}set assetEndTime(i){i==null?this.removeAttribute(sr.Attributes.ASSET_END_TIME):this.setAttribute(sr.Attributes.ASSET_END_TIME,`${i}`)}get extraSourceParams(){return this.hasAttribute(Ct.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(Ct.EXTRA_SOURCE_PARAMS)).entries()].reduce((i,[u,h])=>(i[u]=h,i),{}):Ug}set extraSourceParams(i){i==null?this.removeAttribute(Ct.EXTRA_SOURCE_PARAMS):this.setAttribute(Ct.EXTRA_SOURCE_PARAMS,new URLSearchParams(i).toString())}get customDomain(){var i;return(i=this.getAttribute(sr.Attributes.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(sr.Attributes.CUSTOM_DOMAIN,i):this.removeAttribute(sr.Attributes.CUSTOM_DOMAIN))}get envKey(){var i;return(i=zu(this,sr.Attributes.ENV_KEY))!=null?i:void 0}set envKey(i){this.setAttribute(sr.Attributes.ENV_KEY,`${i}`)}get noVolumePref(){return this.hasAttribute(Ct.NO_VOLUME_PREF)}set noVolumePref(i){i?this.setAttribute(Ct.NO_VOLUME_PREF,""):this.removeAttribute(Ct.NO_VOLUME_PREF)}get noMutedPref(){return this.hasAttribute(Ct.NO_MUTED_PREF)}set noMutedPref(i){i?this.setAttribute(Ct.NO_MUTED_PREF,""):this.removeAttribute(Ct.NO_MUTED_PREF)}get debug(){return zu(this,sr.Attributes.DEBUG)!=null}set debug(i){i?this.setAttribute(sr.Attributes.DEBUG,""):this.removeAttribute(sr.Attributes.DEBUG)}get disableTracking(){return zu(this,sr.Attributes.DISABLE_TRACKING)!=null}set disableTracking(i){this.toggleAttribute(sr.Attributes.DISABLE_TRACKING,!!i)}get disableCookies(){return zu(this,sr.Attributes.DISABLE_COOKIES)!=null}set disableCookies(i){i?this.setAttribute(sr.Attributes.DISABLE_COOKIES,""):this.removeAttribute(sr.Attributes.DISABLE_COOKIES)}get streamType(){var i,u,h;return(h=(u=this.getAttribute(sr.Attributes.STREAM_TYPE))!=null?u:(i=this.media)==null?void 0:i.streamType)!=null?h:Ri.StreamTypes.UNKNOWN}set streamType(i){this.setAttribute(sr.Attributes.STREAM_TYPE,`${i}`)}get defaultStreamType(){var i,u,h;return(h=(u=this.getAttribute(Ct.DEFAULT_STREAM_TYPE))!=null?u:(i=this.mediaController)==null?void 0:i.getAttribute(Ct.DEFAULT_STREAM_TYPE))!=null?h:Ri.StreamTypes.ON_DEMAND}set defaultStreamType(i){i?this.setAttribute(Ct.DEFAULT_STREAM_TYPE,i):this.removeAttribute(Ct.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var i,u;return this.hasAttribute(Ct.TARGET_LIVE_WINDOW)?+this.getAttribute(Ct.TARGET_LIVE_WINDOW):(u=(i=this.media)==null?void 0:i.targetLiveWindow)!=null?u:Number.NaN}set targetLiveWindow(i){i==this.targetLiveWindow||Number.isNaN(i)&&Number.isNaN(this.targetLiveWindow)||(i==null?this.removeAttribute(Ct.TARGET_LIVE_WINDOW):this.setAttribute(Ct.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i;return(i=this.media)==null?void 0:i.liveEdgeStart}get startTime(){return is(zu(this,sr.Attributes.START_TIME))}set startTime(i){this.setAttribute(sr.Attributes.START_TIME,`${i}`)}get preferPlayback(){let i=this.getAttribute(sr.Attributes.PREFER_PLAYBACK);if(i===Ri.PlaybackTypes.MSE||i===Ri.PlaybackTypes.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===Ri.PlaybackTypes.MSE||i===Ri.PlaybackTypes.NATIVE?this.setAttribute(sr.Attributes.PREFER_PLAYBACK,i):this.removeAttribute(sr.Attributes.PREFER_PLAYBACK))}get metadata(){var i;return(i=this.media)==null?void 0:i.metadata}set metadata(i){if(ke(this,_a,ju).call(this),!this.media){as("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata=he(he({},Ip(this)),i)}get _hlsConfig(){var i;return(i=this.media)==null?void 0:i._hlsConfig}set _hlsConfig(i){if(ke(this,_a,ju).call(this),!this.media){as("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=i}addCuePoints(i){return j(this,null,function*(){var u;if(ke(this,_a,ju).call(this),!this.media){as("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(u=this.media)==null?void 0:u.addCuePoints(i)})}get activeCuePoint(){var i;return(i=this.media)==null?void 0:i.activeCuePoint}get cuePoints(){var i,u;return(u=(i=this.media)==null?void 0:i.cuePoints)!=null?u:[]}addChapters(i){var u;if(ke(this,_a,ju).call(this),!this.media){as("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(u=this.media)==null?void 0:u.addChapters(i)}get activeChapter(){var i;return(i=this.media)==null?void 0:i.activeChapter}get chapters(){var i,u;return(u=(i=this.media)==null?void 0:i.chapters)!=null?u:[]}getStartDate(){var i;return(i=this.media)==null?void 0:i.getStartDate()}get currentPdt(){var i;return(i=this.media)==null?void 0:i.currentPdt}get tokens(){let i=this.getAttribute(Ct.PLAYBACK_TOKEN),u=this.getAttribute(Ct.DRM_TOKEN),h=this.getAttribute(Ct.THUMBNAIL_TOKEN),E=this.getAttribute(Ct.STORYBOARD_TOKEN);return he(he(he(he(he({},Je(this,Av)),i!=null?{playback:i}:{}),u!=null?{drm:u}:{}),h!=null?{thumbnail:h}:{}),E!=null?{storyboard:E}:{})}set tokens(i){dt(this,Av,i!=null?i:{})}get playbackToken(){var i;return(i=this.getAttribute(Ct.PLAYBACK_TOKEN))!=null?i:void 0}set playbackToken(i){this.setAttribute(Ct.PLAYBACK_TOKEN,`${i}`)}get drmToken(){var i;return(i=this.getAttribute(Ct.DRM_TOKEN))!=null?i:void 0}set drmToken(i){this.setAttribute(Ct.DRM_TOKEN,`${i}`)}get thumbnailToken(){var i;return(i=this.getAttribute(Ct.THUMBNAIL_TOKEN))!=null?i:void 0}set thumbnailToken(i){this.setAttribute(Ct.THUMBNAIL_TOKEN,`${i}`)}get storyboardToken(){var i;return(i=this.getAttribute(Ct.STORYBOARD_TOKEN))!=null?i:void 0}set storyboardToken(i){this.setAttribute(Ct.STORYBOARD_TOKEN,`${i}`)}addTextTrack(i,u,h,E){var R;let G=(R=this.media)==null?void 0:R.nativeEl;if(G)return(0,Ri.addTextTrack)(G,i,u,h,E)}removeTextTrack(i){var u;let h=(u=this.media)==null?void 0:u.nativeEl;if(h)return(0,Ri.removeTextTrack)(h,i)}get textTracks(){var i;return(i=this.media)==null?void 0:i.textTracks}get castReceiver(){var i;return(i=this.getAttribute(Ct.CAST_RECEIVER))!=null?i:void 0}set castReceiver(i){i!==this.castReceiver&&(i?this.setAttribute(Ct.CAST_RECEIVER,i):this.removeAttribute(Ct.CAST_RECEIVER))}get castCustomData(){var i;return(i=this.media)==null?void 0:i.castCustomData}set castCustomData(i){if(!this.media){as("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=i}get noTooltips(){return this.hasAttribute(Ct.NO_TOOLTIPS)}set noTooltips(i){if(!i){this.removeAttribute(Ct.NO_TOOLTIPS);return}this.setAttribute(Ct.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(Ct.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(i){i?this.setAttribute(Ct.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(Ct.PROUDLY_DISPLAY_MUX_BADGE)}};Tv=new WeakMap,_v=new WeakMap,Av=new WeakMap,Dd=new WeakMap,Sv=new WeakMap,Rc=new WeakMap,_a=new WeakSet,ju=function(){var i,u,h,E;if(!Je(this,_v)){dt(this,_v,!0),ke(this,_a,Md).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof ct.HTMLElement))throw""}catch(R){as("<media-theme> failed to upgrade!")}try{customElements.upgrade(this.media)}catch(R){as("underlying media element failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof tn))throw""}catch(R){as("<media-controller> failed to upgrade!")}ke(this,_a,Cp).call(this),ke(this,_a,Dp).call(this),ke(this,_a,Mp).call(this),dt(this,Dd,(u=(i=this.mediaController)==null?void 0:i.hasAttribute(vr.USER_INACTIVE))!=null?u:!0),ke(this,_a,Pp).call(this),(h=this.media)==null||h.addEventListener("streamtypechange",()=>ke(this,_a,Md).call(this)),(E=this.media)==null||E.addEventListener("loadstart",()=>ke(this,_a,Md).call(this))}},wp=function(){var i,u;try{(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(u=window==null?void 0:window.CSS)==null||u.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch(h){}},zm=function(i){Object.assign(Je(this,Rc),i),ke(this,_a,Md).call(this)},Md=function(i={}){bi(ia(Cg(this,he(he({},Je(this,Rc)),i))),this.shadowRoot)},Cp=function(){let i=u=>{var h,E;if(!(u!=null&&u.startsWith("theme-")))return;let R=u.replace(/^theme-/,"");if($m.includes(R))return;let G=this.getAttribute(u);G!=null?(h=this.mediaTheme)==null||h.setAttribute(R,G):(E=this.mediaTheme)==null||E.removeAttribute(R)};new MutationObserver(u=>{for(let{attributeName:h}of u)i(h)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(i)},Dp=function(){let i=u=>{var h;let E=(h=this.media)==null?void 0:h.error;if(!(E instanceof sr.MediaError)){let{message:G,code:ee}=E!=null?E:{};E=new sr.MediaError(G,ee)}if(!(E!=null&&E.fatal)){io(E),E.data&&io(`${E.name} data:`,E.data);return}let R=_n(E,!1);R.message&&Ff(R),as(E),E.data&&as(`${E.name} data:`,E.data),ke(this,_a,zm).call(this,{isDialogOpen:!0})};this.addEventListener("error",i),this.media&&(this.media.errorTranslator=(u={})=>{var h,E,R;if(!(((h=this.media)==null?void 0:h.error)instanceof sr.MediaError))return u;let G=_n((E=this.media)==null?void 0:E.error,!1);return{player_error_code:(R=this.media)==null?void 0:R.error.code,player_error_message:G.message?String(G.message):u.player_error_message,player_error_context:G.context?String(G.context):u.player_error_context}})},Mp=function(){var i,u,h,E;let R=()=>ke(this,_a,Md).call(this);(u=(i=this.media)==null?void 0:i.textTracks)==null||u.addEventListener("addtrack",R),(E=(h=this.media)==null?void 0:h.textTracks)==null||E.addEventListener("removetrack",R)},Pp=function(){var i,u;if(!/Firefox/i.test(navigator.userAgent))return;let h,E=new WeakMap,R=()=>this.streamType===Ri.StreamTypes.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,G=(_t,It,Er=!1)=>{R()||Array.from(_t&&_t.activeCues||[]).forEach(ar=>{if(!(!ar.snapToLines||ar.line<-5||ar.line>=0&&ar.line<10))if(!It||this.paused){let nr=ar.text.split(`
`).length,rr=-3;this.streamType===Ri.StreamTypes.LIVE&&(rr=-2);let Mr=rr-nr;if(ar.line===Mr&&!Er)return;E.has(ar)||E.set(ar,ar.line),ar.line=Mr}else setTimeout(()=>{ar.line=E.get(ar)||"auto"},500)})},ee=()=>{var _t,It;G(h,(It=(_t=this.mediaController)==null?void 0:_t.hasAttribute(vr.USER_INACTIVE))!=null?It:!1)},ge=()=>{var _t,It;let Er=Array.from(((It=(_t=this.mediaController)==null?void 0:_t.media)==null?void 0:It.textTracks)||[]).filter(ar=>["subtitles","captions"].includes(ar.kind)&&ar.mode==="showing")[0];Er!==h&&(h==null||h.removeEventListener("cuechange",ee)),h=Er,h==null||h.addEventListener("cuechange",ee),G(h,Je(this,Dd))};ge(),(i=this.textTracks)==null||i.addEventListener("change",ge),(u=this.textTracks)==null||u.addEventListener("addtrack",ge),this.addEventListener("userinactivechange",()=>{var _t,It;let Er=(It=(_t=this.mediaController)==null?void 0:_t.hasAttribute(vr.USER_INACTIVE))!=null?It:!0;Je(this,Dd)!==Er&&(dt(this,Dd,Er),G(h,Je(this,Dd)))})};function zu(i,u){return i.media?i.media.getAttribute(u):i.getAttribute(u)}var Bg=Fg},74956($e,Me,Ee){"use strict";var He=Object.create,Le=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,H=Object.getOwnPropertyNames,Qe=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty,Pe=_=>{throw TypeError(_)},he=(_,pe)=>{for(var Ie in pe)Le(_,Ie,{get:pe[Ie],enumerable:!0})},O=(_,pe,Ie,ct)=>{if(pe&&typeof pe=="object"||typeof pe=="function")for(let _e of H(pe))!de.call(_,_e)&&_e!==Ie&&Le(_,_e,{get:()=>pe[_e],enumerable:!(ct=Ne(pe,_e))||ct.enumerable});return _},K=(_,pe,Ie)=>(O(_,pe,"default"),Ie&&O(Ie,pe,"default")),j=(_,pe,Ie)=>(Ie=_!=null?He(Qe(_)):{},O(pe||!_||!_.__esModule?Le(Ie,"default",{value:_,enumerable:!0}):Ie,_)),ve=_=>O(Le({},"__esModule",{value:!0}),_),at=(_,pe,Ie)=>pe.has(_)||Pe("Cannot "+Ie),ze=(_,pe,Ie)=>(at(_,pe,"read from private field"),Ie?Ie.call(_):pe.get(_)),Et=(_,pe,Ie)=>pe.has(_)?Pe("Cannot add the same private member more than once"):pe instanceof WeakSet?pe.add(_):pe.set(_,Ie),Xe=(_,pe,Ie,ct)=>(at(_,pe,"write to private field"),ct?ct.call(_,Ie):pe.set(_,Ie),Ie),Ye={};he(Ye,{default:()=>Q}),$e.exports=ve(Ye);var Ze=class{addEventListener(){}removeEventListener(){}dispatchEvent(_){return!0}};if(typeof DocumentFragment=="undefined"){class _ extends Ze{}globalThis.DocumentFragment=_}var st=class extends Ze{},ht=class extends Ze{},Je={get(_){},define(_,pe,Ie){},getName(_){return null},upgrade(_){},whenDefined(_){return Promise.resolve(st)}},ae,dt=class{constructor(_,pe={}){Et(this,ae),Xe(this,ae,pe==null?void 0:pe.detail)}get detail(){return ze(this,ae)}initCustomEvent(){}};ae=new WeakMap;function ke(_,pe){return new st}var mt={document:{createElement:ke},DocumentFragment,customElements:Je,CustomEvent:dt,EventTarget:Ze,HTMLElement:st,HTMLVideoElement:ht},At=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Ge=At?mt:globalThis,De=At?mt.document:globalThis.document,Lt=Ee(91842),ut=j(Ee(64819));K(Ye,Ee(64819),$e.exports),Ge.customElements.get("mux-player")||(Ge.customElements.define("mux-player",ut.default),Ge.MuxPlayerElement=ut.default);var Q=ut.default},58601($e,Me,Ee){"use strict";var He=Object.defineProperty,Le=Object.getOwnPropertySymbols,Ne=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,Qe=(U,Be,je)=>Be in U?He(U,Be,{enumerable:!0,configurable:!0,writable:!0,value:je}):U[Be]=je,de=(U,Be)=>{for(var je in Be||(Be={}))Ne.call(Be,je)&&Qe(U,je,Be[je]);if(Le)for(var je of Le(Be))H.call(Be,je)&&Qe(U,je,Be[je]);return U},Pe=(U,Be,je)=>new Promise((Jt,Nt)=>{var Ut=Wt=>{try{zr(je.next(Wt))}catch(qe){Nt(qe)}},Lr=Wt=>{try{zr(je.throw(Wt))}catch(qe){Nt(qe)}},zr=Wt=>Wt.done?Jt(Wt.value):Promise.resolve(Wt.value).then(Ut,Lr);zr((je=je.apply(U,Be)).next())}),he=Object.defineProperty,O=Object.getOwnPropertyDescriptor,K=Object.getOwnPropertyNames,j=Object.prototype.hasOwnProperty,ve=U=>{throw TypeError(U)},at=(U,Be)=>{for(var je in Be)he(U,je,{get:Be[je],enumerable:!0})},ze=(U,Be,je,Jt)=>{if(Be&&typeof Be=="object"||typeof Be=="function")for(let Nt of K(Be))!j.call(U,Nt)&&Nt!==je&&he(U,Nt,{get:()=>Be[Nt],enumerable:!(Jt=O(Be,Nt))||Jt.enumerable});return U},Et=U=>ze(he({},"__esModule",{value:!0}),U),Xe=(U,Be,je)=>Be.has(U)||ve("Cannot "+je),Ye=(U,Be,je)=>(Xe(U,Be,"read from private field"),je?je.call(U):Be.get(U)),Ze=(U,Be,je)=>Be.has(U)?ve("Cannot add the same private member more than once"):Be instanceof WeakSet?Be.add(U):Be.set(U,je),st=(U,Be,je,Jt)=>(Xe(U,Be,"write to private field"),Jt?Jt.call(U,je):Be.set(U,je),je),ht=(U,Be,je)=>(Xe(U,Be,"access private method"),je),Je={};at(Je,{Attributes:()=>De,Events:()=>At.Events,MediaError:()=>ae.MediaError,MuxVideoBaseElement:()=>Rt,generatePlayerInitTime:()=>ae.generatePlayerInitTime,playerSoftwareName:()=>Q,playerSoftwareVersion:()=>ut}),$e.exports=Et(Je);var ae=Ee(56543),dt=()=>{try{return"0.29.2"}catch(U){}return"UNKNOWN"},ke=dt(),mt=()=>ke,At=Ee(98550),Ge=`
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" part="logo" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 1600 500"><g fill="#fff"><path d="M994.287 93.486c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31m0-93.486c-34.509 0-62.484 27.976-62.484 62.486v187.511c0 68.943-56.09 125.033-125.032 125.033s-125.03-56.09-125.03-125.033V62.486C681.741 27.976 653.765 0 619.256 0s-62.484 27.976-62.484 62.486v187.511C556.772 387.85 668.921 500 806.771 500c137.851 0 250.001-112.15 250.001-250.003V62.486c0-34.51-27.976-62.486-62.485-62.486M1537.51 468.511c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31m-275.883-218.509-143.33 143.329c-24.402 24.402-24.402 63.966 0 88.368 24.402 24.402 63.967 24.402 88.369 0l143.33-143.329 143.328 143.329c24.402 24.4 63.967 24.402 88.369 0 24.403-24.402 24.403-63.966.001-88.368l-143.33-143.329.001-.004 143.329-143.329c24.402-24.402 24.402-63.965 0-88.367s-63.967-24.402-88.369 0L1349.996 161.63 1206.667 18.302c-24.402-24.401-63.967-24.402-88.369 0s-24.402 63.965 0 88.367l143.329 143.329v.004ZM437.511 468.521c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31M461.426 4.759C438.078-4.913 411.2.432 393.33 18.303L249.999 161.632 106.669 18.303C88.798.432 61.922-4.913 38.573 4.759 15.224 14.43-.001 37.214-.001 62.488v375.026c0 34.51 27.977 62.486 62.487 62.486 34.51 0 62.486-27.976 62.486-62.486V213.341l80.843 80.844c24.404 24.402 63.965 24.402 88.369 0l80.843-80.844v224.173c0 34.51 27.976 62.486 62.486 62.486s62.486-27.976 62.486-62.486V62.488c0-25.274-15.224-48.058-38.573-57.729" style="fill-rule:nonzero"/></g></svg>`,De={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",DISABLE_PSEUDO_ENDED:"disable-pseudo-ended",DRM_TOKEN:"drm-token",PLAYBACK_TOKEN:"playback-token",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",MIN_RESOLUTION:"min-resolution",MAX_AUTO_RESOLUTION:"max-auto-resolution",RENDITION_ORDER:"rendition-order",PROGRAM_START_TIME:"program-start-time",PROGRAM_END_TIME:"program-end-time",ASSET_START_TIME:"asset-start-time",ASSET_END_TIME:"asset-end-time",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_INIT_TIME:"player-init-time",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type",LOGO:"logo"},Lt=Object.values(De),ut=mt(),Q="mux-video",_,pe,Ie,ct,_e,Te,we,xt,Ir,V,jt,Br,Rt=class extends At.CustomVideoElement{constructor(){super(),Ze(this,jt),Ze(this,_),Ze(this,pe),Ze(this,Ie),Ze(this,ct,{}),Ze(this,_e,{}),Ze(this,Te),Ze(this,we),Ze(this,xt),Ze(this,Ir),Ze(this,V,""),st(this,Ie,(0,ae.generatePlayerInitTime)()),this.nativeEl.addEventListener("muxmetadata",U=>{var Be;let je=(0,ae.getMetadata)(this.nativeEl),Jt=(Be=this.metadata)!=null?Be:{};this.metadata=de(de({},je),Jt),(je==null?void 0:je["com.mux.video.branding"])==="mux-free-plan"&&(st(this,V,"default"),this.updateLogo())})}static get NAME(){return Q}static get VERSION(){return ut}static get observedAttributes(){var U;return[...Lt,...(U=At.CustomVideoElement.observedAttributes)!=null?U:[]]}static getLogoHTML(U){return!U||U==="false"?"":U==="default"?Ge:`<img part="logo" src="${U}" />`}static getTemplateHTML(U={}){var Be;return`
      ${At.CustomVideoElement.getTemplateHTML(U)}
      <style>
        :host {
          position: relative;
        }
        slot[name="logo"] {
          display: flex;
          justify-content: end;
          position: absolute;
          top: 1rem;
          right: 1rem;
          opacity: 0;
          transition: opacity 0.25s ease-in-out;
          z-index: 1;
        }
        slot[name="logo"]:has([part="logo"]) {
          opacity: 1;
        }
        slot[name="logo"] [part="logo"] {
          width: 5rem;
          pointer-events: none;
          user-select: none;
        }
      </style>
      <slot name="logo">
        ${this.getLogoHTML((Be=U[De.LOGO])!=null?Be:"")}
      </slot>
    `}get preferCmcd(){var U;return(U=this.getAttribute(De.PREFER_CMCD))!=null?U:void 0}set preferCmcd(U){U!==this.preferCmcd&&(U?ae.CmcdTypeValues.includes(U)?this.setAttribute(De.PREFER_CMCD,U):console.warn(`Invalid value for preferCmcd. Must be one of ${ae.CmcdTypeValues.join()}`):this.removeAttribute(De.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(De.PLAYER_INIT_TIME)?+this.getAttribute(De.PLAYER_INIT_TIME):Ye(this,Ie)}set playerInitTime(U){U!=this.playerInitTime&&(U==null?this.removeAttribute(De.PLAYER_INIT_TIME):this.setAttribute(De.PLAYER_INIT_TIME,`${+U}`))}get playerSoftwareName(){var U;return(U=Ye(this,xt))!=null?U:Q}set playerSoftwareName(U){st(this,xt,U)}get playerSoftwareVersion(){var U;return(U=Ye(this,we))!=null?U:ut}set playerSoftwareVersion(U){st(this,we,U)}get _hls(){var U;return(U=Ye(this,_))==null?void 0:U.engine}get mux(){var U;return(U=this.nativeEl)==null?void 0:U.mux}get error(){var U;return(U=(0,ae.getError)(this.nativeEl))!=null?U:null}get errorTranslator(){return Ye(this,Ir)}set errorTranslator(U){st(this,Ir,U)}get src(){return this.getAttribute("src")}set src(U){U!==this.src&&(U==null?this.removeAttribute("src"):this.setAttribute("src",U))}get type(){var U;return(U=this.getAttribute(De.TYPE))!=null?U:void 0}set type(U){U!==this.type&&(U?this.setAttribute(De.TYPE,U):this.removeAttribute(De.TYPE))}get preload(){let U=this.getAttribute("preload");return U===""?"auto":["none","metadata","auto"].includes(U)?U:super.preload}set preload(U){U!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(U)?this.setAttribute("preload",U):this.removeAttribute("preload"))}get debug(){return this.getAttribute(De.DEBUG)!=null}set debug(U){U!==this.debug&&(U?this.setAttribute(De.DEBUG,""):this.removeAttribute(De.DEBUG))}get disableTracking(){return this.hasAttribute(De.DISABLE_TRACKING)}set disableTracking(U){U!==this.disableTracking&&this.toggleAttribute(De.DISABLE_TRACKING,!!U)}get disableCookies(){return this.hasAttribute(De.DISABLE_COOKIES)}set disableCookies(U){U!==this.disableCookies&&(U?this.setAttribute(De.DISABLE_COOKIES,""):this.removeAttribute(De.DISABLE_COOKIES))}get disablePseudoEnded(){return this.hasAttribute(De.DISABLE_PSEUDO_ENDED)}set disablePseudoEnded(U){U!==this.disablePseudoEnded&&(U?this.setAttribute(De.DISABLE_PSEUDO_ENDED,""):this.removeAttribute(De.DISABLE_PSEUDO_ENDED))}get startTime(){let U=this.getAttribute(De.START_TIME);if(U==null)return;let Be=+U;return Number.isNaN(Be)?void 0:Be}set startTime(U){U!==this.startTime&&(U==null?this.removeAttribute(De.START_TIME):this.setAttribute(De.START_TIME,`${U}`))}get playbackId(){var U;return this.hasAttribute(De.PLAYBACK_ID)?this.getAttribute(De.PLAYBACK_ID):(U=(0,ae.toPlaybackIdFromSrc)(this.src))!=null?U:void 0}set playbackId(U){U!==this.playbackId&&(U?this.setAttribute(De.PLAYBACK_ID,U):this.removeAttribute(De.PLAYBACK_ID))}get maxResolution(){var U;return(U=this.getAttribute(De.MAX_RESOLUTION))!=null?U:void 0}set maxResolution(U){U!==this.maxResolution&&(U?this.setAttribute(De.MAX_RESOLUTION,U):this.removeAttribute(De.MAX_RESOLUTION))}get minResolution(){var U;return(U=this.getAttribute(De.MIN_RESOLUTION))!=null?U:void 0}set minResolution(U){U!==this.minResolution&&(U?this.setAttribute(De.MIN_RESOLUTION,U):this.removeAttribute(De.MIN_RESOLUTION))}get maxAutoResolution(){var U;return(U=this.getAttribute(De.MAX_AUTO_RESOLUTION))!=null?U:void 0}set maxAutoResolution(U){U==null?this.removeAttribute(De.MAX_AUTO_RESOLUTION):this.setAttribute(De.MAX_AUTO_RESOLUTION,U)}get renditionOrder(){var U;return(U=this.getAttribute(De.RENDITION_ORDER))!=null?U:void 0}set renditionOrder(U){U!==this.renditionOrder&&(U?this.setAttribute(De.RENDITION_ORDER,U):this.removeAttribute(De.RENDITION_ORDER))}get programStartTime(){let U=this.getAttribute(De.PROGRAM_START_TIME);if(U==null)return;let Be=+U;return Number.isNaN(Be)?void 0:Be}set programStartTime(U){U==null?this.removeAttribute(De.PROGRAM_START_TIME):this.setAttribute(De.PROGRAM_START_TIME,`${U}`)}get programEndTime(){let U=this.getAttribute(De.PROGRAM_END_TIME);if(U==null)return;let Be=+U;return Number.isNaN(Be)?void 0:Be}set programEndTime(U){U==null?this.removeAttribute(De.PROGRAM_END_TIME):this.setAttribute(De.PROGRAM_END_TIME,`${U}`)}get assetStartTime(){let U=this.getAttribute(De.ASSET_START_TIME);if(U==null)return;let Be=+U;return Number.isNaN(Be)?void 0:Be}set assetStartTime(U){U==null?this.removeAttribute(De.ASSET_START_TIME):this.setAttribute(De.ASSET_START_TIME,`${U}`)}get assetEndTime(){let U=this.getAttribute(De.ASSET_END_TIME);if(U==null)return;let Be=+U;return Number.isNaN(Be)?void 0:Be}set assetEndTime(U){U==null?this.removeAttribute(De.ASSET_END_TIME):this.setAttribute(De.ASSET_END_TIME,`${U}`)}get customDomain(){var U;return(U=this.getAttribute(De.CUSTOM_DOMAIN))!=null?U:void 0}set customDomain(U){U!==this.customDomain&&(U?this.setAttribute(De.CUSTOM_DOMAIN,U):this.removeAttribute(De.CUSTOM_DOMAIN))}get drmToken(){var U;return(U=this.getAttribute(De.DRM_TOKEN))!=null?U:void 0}set drmToken(U){U!==this.drmToken&&(U?this.setAttribute(De.DRM_TOKEN,U):this.removeAttribute(De.DRM_TOKEN))}get playbackToken(){var U,Be,je,Jt;if(this.hasAttribute(De.PLAYBACK_TOKEN))return(U=this.getAttribute(De.PLAYBACK_TOKEN))!=null?U:void 0;if(this.hasAttribute(De.PLAYBACK_ID)){let[,Nt]=(0,ae.toPlaybackIdParts)((Be=this.playbackId)!=null?Be:"");return(je=new URLSearchParams(Nt).get("token"))!=null?je:void 0}if(this.src)return(Jt=new URLSearchParams(this.src).get("token"))!=null?Jt:void 0}set playbackToken(U){U!==this.playbackToken&&(U?this.setAttribute(De.PLAYBACK_TOKEN,U):this.removeAttribute(De.PLAYBACK_TOKEN))}get tokens(){let U=this.getAttribute(De.PLAYBACK_TOKEN),Be=this.getAttribute(De.DRM_TOKEN);return de(de(de({},Ye(this,_e)),U!=null?{playback:U}:{}),Be!=null?{drm:Be}:{})}set tokens(U){st(this,_e,U!=null?U:{})}get ended(){return(0,ae.getEnded)(this.nativeEl,this._hls)}get envKey(){var U;return(U=this.getAttribute(De.ENV_KEY))!=null?U:void 0}set envKey(U){U!==this.envKey&&(U?this.setAttribute(De.ENV_KEY,U):this.removeAttribute(De.ENV_KEY))}get beaconCollectionDomain(){var U;return(U=this.getAttribute(De.BEACON_COLLECTION_DOMAIN))!=null?U:void 0}set beaconCollectionDomain(U){U!==this.beaconCollectionDomain&&(U?this.setAttribute(De.BEACON_COLLECTION_DOMAIN,U):this.removeAttribute(De.BEACON_COLLECTION_DOMAIN))}get streamType(){var U;return(U=this.getAttribute(De.STREAM_TYPE))!=null?U:(0,ae.getStreamType)(this.nativeEl)}set streamType(U){U!==this.streamType&&(U?this.setAttribute(De.STREAM_TYPE,U):this.removeAttribute(De.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(De.TARGET_LIVE_WINDOW)?+this.getAttribute(De.TARGET_LIVE_WINDOW):(0,ae.getTargetLiveWindow)(this.nativeEl)}set targetLiveWindow(U){U!=this.targetLiveWindow&&(U==null?this.removeAttribute(De.TARGET_LIVE_WINDOW):this.setAttribute(De.TARGET_LIVE_WINDOW,`${+U}`))}get liveEdgeStart(){var U,Be;if(this.hasAttribute(De.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:je}=this,Jt=(U=this.nativeEl.seekable.end(0))!=null?U:0,Nt=(Be=this.nativeEl.seekable.start(0))!=null?Be:0;return Math.max(Nt,Jt-je)}return(0,ae.getLiveEdgeStart)(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(De.LIVE_EDGE_OFFSET))return+this.getAttribute(De.LIVE_EDGE_OFFSET)}set liveEdgeOffset(U){U!=this.liveEdgeOffset&&(U==null?this.removeAttribute(De.LIVE_EDGE_OFFSET):this.setAttribute(De.LIVE_EDGE_OFFSET,`${+U}`))}get seekable(){return(0,ae.getSeekable)(this.nativeEl)}addCuePoints(U){return Pe(this,null,function*(){return(0,ae.addCuePoints)(this.nativeEl,U)})}get activeCuePoint(){return(0,ae.getActiveCuePoint)(this.nativeEl)}get cuePoints(){return(0,ae.getCuePoints)(this.nativeEl)}addChapters(U){return Pe(this,null,function*(){return(0,ae.addChapters)(this.nativeEl,U)})}get activeChapter(){return(0,ae.getActiveChapter)(this.nativeEl)}get chapters(){return(0,ae.getChapters)(this.nativeEl)}getStartDate(){return(0,ae.getStartDate)(this.nativeEl,this._hls)}get currentPdt(){return(0,ae.getCurrentPdt)(this.nativeEl,this._hls)}get preferPlayback(){let U=this.getAttribute(De.PREFER_PLAYBACK);if(U===ae.PlaybackTypes.MSE||U===ae.PlaybackTypes.NATIVE)return U}set preferPlayback(U){U!==this.preferPlayback&&(U===ae.PlaybackTypes.MSE||U===ae.PlaybackTypes.NATIVE?this.setAttribute(De.PREFER_PLAYBACK,U):this.removeAttribute(De.PREFER_PLAYBACK))}get metadata(){return de(de({},this.getAttributeNames().filter(U=>U.startsWith("metadata-")&&![De.METADATA_URL].includes(U)).reduce((U,Be)=>{let je=this.getAttribute(Be);return je!=null&&(U[Be.replace(/^metadata-/,"").replace(/-/g,"_")]=je),U},{})),Ye(this,ct))}set metadata(U){st(this,ct,U!=null?U:{}),this.mux&&this.mux.emit("hb",Ye(this,ct))}get _hlsConfig(){return Ye(this,Te)}set _hlsConfig(U){st(this,Te,U)}get logo(){var U;return(U=this.getAttribute(De.LOGO))!=null?U:Ye(this,V)}set logo(U){U?this.setAttribute(De.LOGO,U):this.removeAttribute(De.LOGO)}load(){st(this,_,(0,ae.initialize)(this,this.nativeEl,Ye(this,_)))}unload(){(0,ae.teardown)(this.nativeEl,Ye(this,_),this),st(this,_,void 0)}attributeChangedCallback(U,Be,je){var Jt,Nt;switch(At.CustomVideoElement.observedAttributes.includes(U)&&!["src","autoplay","preload"].includes(U)&&super.attributeChangedCallback(U,Be,je),U){case De.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=je!=null?je:void 0;break;case De.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=je!=null?je:void 0;break;case"src":{let Ut=!!Be,Lr=!!je;!Ut&&Lr?ht(this,jt,Br).call(this):Ut&&!Lr?this.unload():Ut&&Lr&&(this.unload(),ht(this,jt,Br).call(this));break}case"autoplay":if(je===Be)break;(Jt=Ye(this,_))==null||Jt.setAutoplay(this.autoplay);break;case"preload":if(je===Be)break;(Nt=Ye(this,_))==null||Nt.setPreload(je);break;case De.PLAYBACK_ID:this.src=(0,ae.toMuxVideoURL)(this);break;case De.DEBUG:{let Ut=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=Ut);break}case De.METADATA_URL:je&&fetch(je).then(Ut=>Ut.json()).then(Ut=>this.metadata=Ut).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${je}!`));break;case De.STREAM_TYPE:(je==null||je!==Be)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case De.TARGET_LIVE_WINDOW:(je==null||je!==Be)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;case De.LOGO:(je==null||je!==Be)&&this.updateLogo();break;case De.DISABLE_TRACKING:{if(je==null||je!==Be){let Ut=this.currentTime,Lr=this.paused;this.unload(),ht(this,jt,Br).call(this).then(()=>{this.currentTime=Ut,Lr||this.play()})}break}case De.DISABLE_COOKIES:{(je==null||je!==Be)&&this.disableCookies&&document.cookie.split(";").forEach(Ut=>{Ut.trim().startsWith("muxData")&&(document.cookie=Ut.replace(/^ +/,"").replace(/=.*/,"=;expires="+new Date().toUTCString()+";path=/"))});break}}}updateLogo(){if(!this.shadowRoot)return;let U=this.shadowRoot.querySelector('slot[name="logo"]');if(!U)return;let Be=this.constructor.getLogoHTML(Ye(this,V)||this.logo);U.innerHTML=Be}connectedCallback(){var U;(U=super.connectedCallback)==null||U.call(this),this.nativeEl&&this.src&&!Ye(this,_)&&ht(this,jt,Br).call(this)}disconnectedCallback(){this.unload()}handleEvent(U){U.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(U.type,{composed:!0,detail:U.detail}))}};_=new WeakMap,pe=new WeakMap,Ie=new WeakMap,ct=new WeakMap,_e=new WeakMap,Te=new WeakMap,we=new WeakMap,xt=new WeakMap,Ir=new WeakMap,V=new WeakMap,jt=new WeakSet,Br=function(){return Pe(this,null,function*(){Ye(this,pe)||(yield st(this,pe,Promise.resolve()),st(this,pe,null),this.load())})}},91842($e,Me,Ee){"use strict";var He=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,Ne=Object.getOwnPropertyNames,H=Object.prototype.hasOwnProperty,Qe=_=>{throw TypeError(_)},de=(_,pe)=>{for(var Ie in pe)He(_,Ie,{get:pe[Ie],enumerable:!0})},Pe=(_,pe,Ie,ct)=>{if(pe&&typeof pe=="object"||typeof pe=="function")for(let _e of Ne(pe))!H.call(_,_e)&&_e!==Ie&&He(_,_e,{get:()=>pe[_e],enumerable:!(ct=Le(pe,_e))||ct.enumerable});return _},he=(_,pe,Ie)=>(Pe(_,pe,"default"),Ie&&Pe(Ie,pe,"default")),O=_=>Pe(He({},"__esModule",{value:!0}),_),K=(_,pe,Ie)=>pe.has(_)||Qe("Cannot "+Ie),j=(_,pe,Ie)=>(K(_,pe,"read from private field"),Ie?Ie.call(_):pe.get(_)),ve=(_,pe,Ie)=>pe.has(_)?Qe("Cannot add the same private member more than once"):pe instanceof WeakSet?pe.add(_):pe.set(_,Ie),at=(_,pe,Ie,ct)=>(K(_,pe,"write to private field"),ct?ct.call(_,Ie):pe.set(_,Ie),Ie),ze={};de(ze,{default:()=>Q}),$e.exports=O(ze);var Et=class{addEventListener(){}removeEventListener(){}dispatchEvent(_){return!0}};if(typeof DocumentFragment=="undefined"){class _ extends Et{}globalThis.DocumentFragment=_}var Xe=class extends Et{},Ye=class extends Et{},Ze={get(_){},define(_,pe,Ie){},getName(_){return null},upgrade(_){},whenDefined(_){return Promise.resolve(Xe)}},st,ht=class{constructor(_,pe={}){ve(this,st),at(this,st,pe==null?void 0:pe.detail)}get detail(){return j(this,st)}initCustomEvent(){}};st=new WeakMap;function Je(_,pe){return new Xe}var ae={document:{createElement:Je},DocumentFragment,customElements:Ze,CustomEvent:ht,EventTarget:Et,HTMLElement:Xe,HTMLVideoElement:Ye},dt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",ke=dt?ae:globalThis,mt=dt?ae.document:globalThis.document,At=Ee(58601),Ge=Ee(35232),De=Ee(18198);he(ze,Ee(58601),$e.exports);var Lt,ut=class extends(0,Ge.CastableMediaMixin)((0,De.MediaTracksMixin)(At.MuxVideoBaseElement)){constructor(){super(...arguments),ve(this,Lt)}get autoplay(){let _=this.getAttribute("autoplay");return _===null?!1:_===""?!0:_}set autoplay(_){let pe=this.autoplay;_!==pe&&(_?this.setAttribute("autoplay",typeof _=="string"?_:""):this.removeAttribute("autoplay"))}get muxCastCustomData(){return{mux:{playbackId:this.playbackId,minResolution:this.minResolution,maxResolution:this.maxResolution,renditionOrder:this.renditionOrder,customDomain:this.customDomain,tokens:{drm:this.drmToken},envKey:this.envKey,metadata:this.metadata,disableCookies:this.disableCookies,disableTracking:this.disableTracking,beaconCollectionDomain:this.beaconCollectionDomain,startTime:this.startTime,preferCmcd:this.preferCmcd}}}get castCustomData(){var _;return(_=j(this,Lt))!=null?_:this.muxCastCustomData}set castCustomData(_){at(this,Lt,_)}};Lt=new WeakMap,ke.customElements.get("mux-video")||(ke.customElements.define("mux-video",ut),ke.MuxVideoElement=ut);var Q=ut},56543($e,Me,Ee){"use strict";var He=Object.defineProperty,Le=Object.defineProperties,Ne=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Qe=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,Pe=(M,P,q)=>P in M?He(M,P,{enumerable:!0,configurable:!0,writable:!0,value:q}):M[P]=q,he=(M,P)=>{for(var q in P||(P={}))Qe.call(P,q)&&Pe(M,q,P[q]);if(H)for(var q of H(P))de.call(P,q)&&Pe(M,q,P[q]);return M},O=(M,P)=>Le(M,Ne(P)),K=(M,P,q)=>new Promise((ue,le)=>{var We=Ce=>{try{lt(q.next(Ce))}catch(wt){le(wt)}},xe=Ce=>{try{lt(q.throw(Ce))}catch(wt){le(wt)}},lt=Ce=>Ce.done?ue(Ce.value):Promise.resolve(Ce.value).then(We,xe);lt((q=q.apply(M,P)).next())}),j=Object.create,ve=Object.defineProperty,at=Object.getOwnPropertyDescriptor,ze=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Xe=Object.prototype.hasOwnProperty,Ye=(M,P)=>{for(var q in P)ve(M,q,{get:P[q],enumerable:!0})},Ze=(M,P,q,ue)=>{if(P&&typeof P=="object"||typeof P=="function")for(let le of ze(P))!Xe.call(M,le)&&le!==q&&ve(M,le,{get:()=>P[le],enumerable:!(ue=at(P,le))||ue.enumerable});return M},st=(M,P,q)=>(q=M!=null?j(Et(M)):{},Ze(P||!M||!M.__esModule?ve(q,"default",{value:M,enumerable:!0}):q,M)),ht=M=>Ze(ve({},"__esModule",{value:!0}),M),Je={};Ye(Je,{AutoplayTypes:()=>_,CmcdTypeValues:()=>_e,CmcdTypes:()=>ct,ExtensionMimeTypeMap:()=>Te,Hls:()=>ke,MaxAutoResolution:()=>Rt,MaxResolution:()=>V,MediaError:()=>Lt,MimeTypeShorthandMap:()=>we,MinResolution:()=>jt,MuxErrorCategory:()=>mt,MuxErrorCode:()=>At,MuxJWTAud:()=>Yr,PlaybackTypes:()=>Ie,RenditionOrder:()=>Br,StreamTypes:()=>pe,addChapters:()=>Ai,addCuePoints:()=>yr,addTextTrack:()=>br,allMediaTypes:()=>Ir,errorCategoryToTokenNameOrPrefix:()=>Ge,fetchAndDispatchMuxMetadata:()=>qr,generatePlayerInitTime:()=>xa,generateUUID:()=>Na,getActiveChapter:()=>Hr,getActiveCuePoint:()=>Ht,getAppCertificate:()=>xn,getChapters:()=>Bi,getCuePoints:()=>Qt,getCurrentPdt:()=>Jr,getDRMConfig:()=>us,getEnded:()=>In,getError:()=>Ua,getLicenseKey:()=>Za,getLiveEdgeStart:()=>ti,getMediaPlaylistFromMultivariantPlaylist:()=>Gs,getMetadata:()=>Ks,getMultivariantPlaylistSessionData:()=>cn,getSeekable:()=>Di,getStartDate:()=>$r,getStreamInfoFromHlsjsLevelDetails:()=>Kn,getStreamInfoFromPlaylist:()=>Nr,getStreamInfoFromSrcAndType:()=>Vr,getStreamType:()=>ur,getStreamTypeConfig:()=>Ws,getTargetLiveWindow:()=>hi,getTextTrack:()=>ye,i18n:()=>Pt,initialize:()=>Fa,isKeyOf:()=>Q,isMuxVideoSrc:()=>mn,isPseudoEnded:()=>fa,isStuckOnLastFragment:()=>vr,loadMedia:()=>Wn,mux:()=>ae.default,muxMediaState:()=>Gr,parseJwt:()=>te,parseTagAttributes:()=>Li,removeTextTrack:()=>fe,setupChapters:()=>pi,setupCuePoints:()=>Ci,setupHls:()=>Rn,setupMux:()=>Ba,setupNativeFairplayDRM:()=>fi,shorthandKeys:()=>xt,teardown:()=>ls,toAppCertURL:()=>wn,toDRMTypeFromKeySystem:()=>Si,toLicenseKeyURL:()=>Ja,toMuxVideoURL:()=>Ln,toPlaybackIdFromSrc:()=>kn,toPlaybackIdParts:()=>Nt,updateStreamInfoFromHlsjsLevelDetails:()=>ha,updateStreamInfoFromSrc:()=>di}),$e.exports=ht(Je);var ae=st(Ee(57233)),dt=st(Ee(51965)),ke=dt.default,mt={VIDEO:"video",THUMBNAIL:"thumbnail",STORYBOARD:"storyboard",DRM:"drm"},At={NOT_AN_ERROR:0,NETWORK_OFFLINE:2000002,NETWORK_UNKNOWN_ERROR:2e6,NETWORK_NO_STATUS:2000001,NETWORK_INVALID_URL:24e5,NETWORK_NOT_FOUND:2404e3,NETWORK_NOT_READY:2412e3,NETWORK_GENERIC_SERVER_FAIL:25e5,NETWORK_TOKEN_MISSING:2403201,NETWORK_TOKEN_MALFORMED:2412202,NETWORK_TOKEN_EXPIRED:2403210,NETWORK_TOKEN_AUD_MISSING:2403221,NETWORK_TOKEN_AUD_MISMATCH:2403222,NETWORK_TOKEN_SUB_MISMATCH:2403232,ENCRYPTED_ERROR:5e6,ENCRYPTED_UNSUPPORTED_KEY_SYSTEM:5000001,ENCRYPTED_GENERATE_REQUEST_FAILED:5000002,ENCRYPTED_UPDATE_LICENSE_FAILED:5000003,ENCRYPTED_UPDATE_SERVER_CERT_FAILED:5000004,ENCRYPTED_CDM_ERROR:5000005,ENCRYPTED_OUTPUT_RESTRICTED:5000006,ENCRYPTED_MISSING_TOKEN:5000002},Ge=M=>M===mt.VIDEO?"playback":M,De=class Qh extends Error{constructor(P,q=Qh.MEDIA_ERR_CUSTOM,ue,le){var We;super(P),this.name="MediaError",this.code=q,this.context=le,this.fatal=ue!=null?ue:q>=Qh.MEDIA_ERR_NETWORK&&q<=Qh.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(We=Qh.defaultMessages[this.code])!=null?We:"")}};De.MEDIA_ERR_ABORTED=1,De.MEDIA_ERR_NETWORK=2,De.MEDIA_ERR_DECODE=3,De.MEDIA_ERR_SRC_NOT_SUPPORTED=4,De.MEDIA_ERR_ENCRYPTED=5,De.MEDIA_ERR_CUSTOM=100,De.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var Lt=De,ut=M=>M==null,Q=(M,P)=>ut(P)?!1:M in P,_={ANY:"any",MUTED:"muted"},pe={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},Ie={MSE:"mse",NATIVE:"native"},ct={HEADER:"header",QUERY:"query",NONE:"none"},_e=Object.values(ct),Te={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},we={HLS:Te.M3U8},xt=Object.keys(we),Ir=[...Object.values(Te),"hls","HLS"],V={upTo720p:"720p",upTo1080p:"1080p",upTo1440p:"1440p",upTo2160p:"2160p"},jt={noLessThan480p:"480p",noLessThan540p:"540p",noLessThan720p:"720p",noLessThan1080p:"1080p",noLessThan1440p:"1440p",noLessThan2160p:"2160p"},Br={DESCENDING:"desc"},Rt={upTo720p:"720p",upTo1080p:"1080p",upTo1440p:"1440p",upTo2160p:"2160p"},U="en",Be={code:U},je=(M,P,q,ue,le=M)=>{le.addEventListener(P,q,ue),M.addEventListener("teardown",()=>{le.removeEventListener(P,q)},{once:!0})};function Jt(M,P,q){P&&q>P&&(q=P);for(let ue=0;ue<M.length;ue++)if(M.start(ue)<=q&&M.end(ue)>=q)return!0;return!1}var Nt=M=>{let P=M.indexOf("?");if(P<0)return[M];let q=M.slice(0,P),ue=M.slice(P);return[q,ue]},Ut=M=>{let{type:P}=M;if(P){let q=P.toUpperCase();return Q(q,we)?we[q]:P}return Wt(M)},Lr=M=>M==="VOD"?pe.ON_DEMAND:pe.LIVE,zr=M=>M==="EVENT"?Number.POSITIVE_INFINITY:M==="VOD"?Number.NaN:0,Wt=M=>{let{src:P}=M;if(!P)return"";let q="";try{q=new URL(P).pathname}catch(We){console.error("invalid url")}let ue=q.lastIndexOf(".");if(ue<0)return Y(M)?Te.M3U8:"";let le=q.slice(ue+1).toUpperCase();return Q(le,Te)?Te[le]:""},qe="mux.com",Y=({src:M,customDomain:P=qe})=>{let q;try{q=new URL(`${M}`)}catch(Ce){return!1}let ue=q.protocol==="https:",le=q.hostname===`stream.${P}`.toLowerCase(),We=q.pathname.split("/"),xe=We.length===2,lt=!(We!=null&&We[1].includes("."));return ue&&le&&xe&&lt},te=M=>{let P=(M!=null?M:"").split(".")[1];if(P)try{let q=P.replace(/-/g,"+").replace(/_/g,"/"),ue=decodeURIComponent(atob(q).split("").map(function(le){return"%"+("00"+le.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(ue)}catch(q){return}},me=({exp:M},P=Date.now())=>!M||M*1e3<P,it=({sub:M},P)=>M!==P,kt=({aud:M},P)=>!M,Oe=({aud:M},P)=>M!==P,zt="en";function Pt(M,P=!0){var q,ue;let le=P&&(ue=(q=Be)==null?void 0:q[M])!=null?ue:M,We=P?Be.code:zt;return new Zt(le,We)}var Zt=class{constructor(M,P=(q=>(q=Be)!=null?q:zt)()){this.message=M,this.locale=P}format(M){return this.message.replace(/\{(\w+)\}/g,(P,q)=>{var ue;return(ue=M[q])!=null?ue:""})}toString(){return this.message}},Wr=Object.values(_),ft=M=>typeof M=="boolean"||typeof M=="string"&&Wr.includes(M),Qr=(M,P,q)=>{let{autoplay:ue}=M,le=!1,We=!1,xe=ft(ue)?ue:!!ue,lt=()=>{le||je(P,"playing",()=>{le=!0},{once:!0})};if(lt(),je(P,"loadstart",()=>{le=!1,lt(),li(P,xe)},{once:!0}),je(P,"loadstart",()=>{q||(M.streamType&&M.streamType!==pe.UNKNOWN?We=M.streamType===pe.LIVE:We=!Number.isFinite(P.duration)),li(P,xe)},{once:!0}),q&&q.once(ke.Events.LEVEL_LOADED,(Ce,wt)=>{var gt;M.streamType&&M.streamType!==pe.UNKNOWN?We=M.streamType===pe.LIVE:We=(gt=wt.details.live)!=null?gt:!1}),!xe){let Ce=()=>{!We||Number.isFinite(M.startTime)||(q!=null&&q.liveSyncPosition?P.currentTime=q.liveSyncPosition:Number.isFinite(P.seekable.end(0))&&(P.currentTime=P.seekable.end(0)))};q&&je(P,"play",()=>{P.preload==="metadata"?q.once(ke.Events.LEVEL_UPDATED,Ce):Ce()},{once:!0})}return Ce=>{le||(xe=ft(Ce)?Ce:!!Ce,li(P,xe))}},li=(M,P)=>{if(!P)return;let q=M.muted,ue=()=>M.muted=q;switch(P){case _.ANY:M.play().catch(()=>{M.muted=!0,M.play().catch(ue)});break;case _.MUTED:M.muted=!0,M.play().catch(ue);break;default:M.play().catch(()=>{});break}},ln=({preload:M,src:P},q,ue)=>{let le=Yt=>{Yt!=null&&["","none","metadata","auto"].includes(Yt)?q.setAttribute("preload",Yt):q.removeAttribute("preload")};if(!ue)return le(M),le;let We=!1,xe=!1,lt=ue.config.maxBufferLength,Ce=ue.config.maxBufferSize,wt=Yt=>{le(Yt);let mr=Yt!=null?Yt:q.preload;xe||mr==="none"||(mr==="metadata"?(ue.config.maxBufferLength=1,ue.config.maxBufferSize=1):(ue.config.maxBufferLength=lt,ue.config.maxBufferSize=Ce),gt())},gt=()=>{!We&&P&&(We=!0,ue.loadSource(P))};return je(q,"play",()=>{xe=!0,ue.config.maxBufferLength=lt,ue.config.maxBufferSize=Ce,gt()},{once:!0}),wt(M),wt};function Ar(M,P){var q;if(!("videoTracks"in M))return;let ue=new WeakMap;P.on(ke.Events.MANIFEST_PARSED,function(Ce,wt){lt();let gt=M.addVideoTrack("main");gt.selected=!0;for(let[Yt,mr]of wt.levels.entries()){let pr=gt.addRendition(mr.url[0],mr.width,mr.height,mr.videoCodec,mr.bitrate);ue.set(mr,`${Yt}`),pr.id=`${Yt}`}}),P.on(ke.Events.AUDIO_TRACKS_UPDATED,function(Ce,wt){xe();for(let gt of wt.audioTracks){let Yt=gt.default?"main":"alternative",mr=M.addAudioTrack(Yt,gt.name,gt.lang);mr.id=`${gt.id}`,gt.default&&(mr.enabled=!0)}}),M.audioTracks.addEventListener("change",()=>{var Ce;let wt=+((Ce=[...M.audioTracks].find(Yt=>Yt.enabled))==null?void 0:Ce.id),gt=P.audioTracks.map(Yt=>Yt.id);wt!=P.audioTrack&&gt.includes(wt)&&(P.audioTrack=wt)}),P.on(ke.Events.LEVELS_UPDATED,function(Ce,wt){var gt;let Yt=M.videoTracks[(gt=M.videoTracks.selectedIndex)!=null?gt:0];if(!Yt)return;let mr=wt.levels.map(pr=>ue.get(pr));for(let pr of M.videoRenditions)pr.id&&!mr.includes(pr.id)&&Yt.removeRendition(pr)});let le=Ce=>{let wt=Ce.target.selectedIndex;wt!=P.nextLevel&&(P.nextLevel=wt)};(q=M.videoRenditions)==null||q.addEventListener("change",le);let We=()=>{for(let Ce of M.videoTracks)M.removeVideoTrack(Ce)},xe=()=>{for(let Ce of M.audioTracks)M.removeAudioTrack(Ce)},lt=()=>{We(),xe()};P.once(ke.Events.DESTROYING,lt)}var Yi=M=>"time"in M?M.time:M.startTime;function _i(M,P){P.on(ke.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(le,{tracks:We})=>{We.forEach(xe=>{var lt,Ce;let wt=(lt=xe.subtitleTrack)!=null?lt:xe.closedCaptions,gt=P.subtitleTracks.findIndex(({lang:mr,name:pr,type:Tr})=>mr==(wt==null?void 0:wt.lang)&&pr===xe.label&&Tr.toLowerCase()===xe.kind),Yt=((Ce=xe._id)!=null?Ce:xe.default)?"default":`${xe.kind}${gt}`;br(M,xe.kind,xe.label,wt==null?void 0:wt.lang,Yt,xe.default)})});let q=()=>{if(!P.subtitleTracks.length)return;let le=Array.from(M.textTracks).find(lt=>lt.id&&lt.mode==="showing"&&["subtitles","captions"].includes(lt.kind));if(!le)return;let We=P.subtitleTracks[P.subtitleTrack],xe=We?We.default?"default":`${P.subtitleTracks[P.subtitleTrack].type.toLowerCase()}${P.subtitleTrack}`:void 0;if(P.subtitleTrack<0||(le==null?void 0:le.id)!==xe){let lt=P.subtitleTracks.findIndex(({lang:Ce,name:wt,type:gt,default:Yt})=>le.id==="default"&&Yt||Ce==le.language&&wt===le.label&&gt.toLowerCase()===le.kind);P.subtitleTrack=lt}(le==null?void 0:le.id)===xe&&le.cues&&Array.from(le.cues).forEach(lt=>{le.addCue(lt)})};M.textTracks.addEventListener("change",q),P.on(ke.Events.CUES_PARSED,(le,{track:We,cues:xe})=>{let lt=M.textTracks.getTrackById(We);if(!lt)return;let Ce=lt.mode==="disabled";Ce&&(lt.mode="hidden"),xe.forEach(wt=>{var gt;(gt=lt.cues)!=null&&gt.getCueById(wt.id)||lt.addCue(wt)}),Ce&&(lt.mode="disabled")}),P.once(ke.Events.DESTROYING,()=>{M.textTracks.removeEventListener("change",q),M.querySelectorAll("track[data-removeondestroy]").forEach(le=>{le.remove()})});let ue=()=>{Array.from(M.textTracks).forEach(le=>{var We,xe;if(!["subtitles","caption"].includes(le.kind)&&(le.label==="thumbnails"||le.kind==="chapters")){if(!((We=le.cues)!=null&&We.length)){let lt="track";le.kind&&(lt+=`[kind="${le.kind}"]`),le.label&&(lt+=`[label="${le.label}"]`);let Ce=M.querySelector(lt),wt=(xe=Ce==null?void 0:Ce.getAttribute("src"))!=null?xe:"";Ce==null||Ce.removeAttribute("src"),setTimeout(()=>{Ce==null||Ce.setAttribute("src",wt)},0)}le.mode!=="hidden"&&(le.mode="hidden")}})};P.once(ke.Events.MANIFEST_LOADED,ue),P.once(ke.Events.MEDIA_ATTACHED,ue)}function br(M,P,q,ue,le,We){let xe=document.createElement("track");return xe.kind=P,xe.label=q,ue&&(xe.srclang=ue),le&&(xe.id=le),We&&(xe.default=!0),xe.track.mode=["subtitles","captions"].includes(P)?"disabled":"hidden",xe.setAttribute("data-removeondestroy",""),M.append(xe),xe.track}function fe(M,P){let q=Array.prototype.find.call(M.querySelectorAll("track"),ue=>ue.track===P);q==null||q.remove()}function ye(M,P,q){var ue;return(ue=Array.from(M.querySelectorAll("track")).find(le=>le.track.label===P&&le.track.kind===q))==null?void 0:ue.track}function oe(M,P,q,ue){return K(this,null,function*(){let le=ye(M,q,ue);return le||(le=br(M,ue,q),le.mode="hidden",yield new Promise(We=>setTimeout(()=>We(void 0),0))),le.mode!=="hidden"&&(le.mode="hidden"),[...P].sort((We,xe)=>Yi(xe)-Yi(We)).forEach(We=>{var xe,lt;let Ce=We.value,wt=Yi(We);if("endTime"in We&&We.endTime!=null)le==null||le.addCue(new VTTCue(wt,We.endTime,ue==="chapters"?Ce:JSON.stringify(Ce!=null?Ce:null)));else{let gt=Array.prototype.findIndex.call(le==null?void 0:le.cues,Tr=>Tr.startTime>=wt),Yt=(xe=le==null?void 0:le.cues)==null?void 0:xe[gt],mr=Yt?Yt.startTime:Number.isFinite(M.duration)?M.duration:Number.MAX_SAFE_INTEGER,pr=(lt=le==null?void 0:le.cues)==null?void 0:lt[gt-1];pr&&(pr.endTime=wt),le==null||le.addCue(new VTTCue(wt,mr,ue==="chapters"?Ce:JSON.stringify(Ce!=null?Ce:null)))}}),M.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),le})}var yt="cuepoints",qt=Object.freeze({label:yt});function yr(M,P){return K(this,arguments,function*(q,ue,le=qt){return oe(q,ue,le.label,"metadata")})}var Rr=M=>({time:M.startTime,value:JSON.parse(M.text)});function Qt(M,P={label:yt}){let q=ye(M,P.label,"metadata");return q!=null&&q.cues?Array.from(q.cues,ue=>Rr(ue)):[]}function Ht(M,P={label:yt}){var q,ue;let le=ye(M,P.label,"metadata");if(!((q=le==null?void 0:le.activeCues)!=null&&q.length))return;if(le.activeCues.length===1)return Rr(le.activeCues[0]);let{currentTime:We}=M,xe=Array.prototype.find.call((ue=le.activeCues)!=null?ue:[],({startTime:lt,endTime:Ce})=>lt<=We&&Ce>We);return Rr(xe||le.activeCues[0])}function Ci(M){return K(this,arguments,function*(P,q=qt){return new Promise(ue=>{je(P,"loadstart",()=>K(this,null,function*(){let le=yield yr(P,[],q);je(P,"cuechange",()=>{let We=Ht(P);if(We){let xe=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:We});P.dispatchEvent(xe)}},{},le),ue(le)}))})})}var Ft="chapters",ie=Object.freeze({label:Ft}),er=M=>({startTime:M.startTime,endTime:M.endTime,value:M.text});function Ai(M,P){return K(this,arguments,function*(q,ue,le=ie){return oe(q,ue,le.label,"chapters")})}function Bi(M,P={label:Ft}){var q;let ue=ye(M,P.label,"chapters");return(q=ue==null?void 0:ue.cues)!=null&&q.length?Array.from(ue.cues,le=>er(le)):[]}function Hr(M,P={label:Ft}){var q,ue;let le=ye(M,P.label,"chapters");if(!((q=le==null?void 0:le.activeCues)!=null&&q.length))return;if(le.activeCues.length===1)return er(le.activeCues[0]);let{currentTime:We}=M,xe=Array.prototype.find.call((ue=le.activeCues)!=null?ue:[],({startTime:lt,endTime:Ce})=>lt<=We&&Ce>We);return er(xe||le.activeCues[0])}function pi(M){return K(this,arguments,function*(P,q=ie){return new Promise(ue=>{je(P,"loadstart",()=>K(this,null,function*(){let le=yield Ai(P,[],q);je(P,"cuechange",()=>{let We=Hr(P);if(We){let xe=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:We});P.dispatchEvent(xe)}},{},le),ue(le)}))})})}function $r(M,P){if(P){let q=P.playingDate;if(q!=null)return new Date(q.getTime()-M.currentTime*1e3)}return typeof M.getStartDate=="function"?M.getStartDate():new Date(NaN)}function Jr(M,P){if(P&&P.playingDate)return P.playingDate;if(typeof M.getStartDate=="function"){let q=M.getStartDate();return new Date(q.getTime()+M.currentTime*1e3)}return new Date(NaN)}var Yr={VIDEO:"v",THUMBNAIL:"t",STORYBOARD:"s",DRM:"d"},Pa=M=>{if(M===mt.VIDEO)return Yr.VIDEO;if(M===mt.DRM)return Yr.DRM},za=(M,P)=>{var q,ue;let le=Ge(M),We=`${le}Token`;return(q=P.tokens)!=null&&q[le]?(ue=P.tokens)==null?void 0:ue[le]:Q(We,P)?P[We]:void 0},un=(M,P,q,ue,le=!1,We=!(xe=>(xe=globalThis.navigator)==null?void 0:xe.onLine)())=>{var xe,lt;if(We){let Fr=Pt("Your device appears to be offline",le),Xr,dr=Lt.MEDIA_ERR_NETWORK,Ki=new Lt(Fr,dr,!1,Xr);return Ki.errorCategory=P,Ki.muxCode=At.NETWORK_OFFLINE,Ki.data=M,Ki}let Ce="status"in M?M.status:M.code,wt=Date.now(),gt=Lt.MEDIA_ERR_NETWORK;if(Ce===200)return;let Yt=Ge(P),mr=za(P,q),pr=Pa(P),[Tr]=Nt((xe=q.playbackId)!=null?xe:"");if(!Ce||!Tr)return;let Ur=te(mr);if(mr&&!Ur){let Fr=Pt("The {tokenNamePrefix}-token provided is invalid or malformed.",le).format({tokenNamePrefix:Yt}),Xr=Pt("Compact JWT string: {token}",le).format({token:mr}),dr=new Lt(Fr,gt,!0,Xr);return dr.errorCategory=P,dr.muxCode=At.NETWORK_TOKEN_MALFORMED,dr.data=M,dr}if(Ce>=500){let Fr=new Lt("",gt,ue!=null?ue:!0);return Fr.errorCategory=P,Fr.muxCode=At.NETWORK_UNKNOWN_ERROR,Fr}if(Ce===403)if(Ur){if(me(Ur,wt)){let Fr={timeStyle:"medium",dateStyle:"medium"},Xr=Pt("The video\u2019s secured {tokenNamePrefix}-token has expired.",le).format({tokenNamePrefix:Yt}),dr=Pt("Expired at: {expiredDate}. Current time: {currentDate}.",le).format({expiredDate:new Intl.DateTimeFormat("en",Fr).format((lt=Ur.exp)!=null?lt:0*1e3),currentDate:new Intl.DateTimeFormat("en",Fr).format(wt)}),Ki=new Lt(Xr,gt,!0,dr);return Ki.errorCategory=P,Ki.muxCode=At.NETWORK_TOKEN_EXPIRED,Ki.data=M,Ki}if(it(Ur,Tr)){let Fr=Pt("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",le).format({tokenNamePrefix:Yt}),Xr=Pt("Specified playback ID: {playbackId} and the playback ID encoded in the {tokenNamePrefix}-token: {tokenPlaybackId}",le).format({tokenNamePrefix:Yt,playbackId:Tr,tokenPlaybackId:Ur.sub}),dr=new Lt(Fr,gt,!0,Xr);return dr.errorCategory=P,dr.muxCode=At.NETWORK_TOKEN_SUB_MISMATCH,dr.data=M,dr}if(kt(Ur,pr)){let Fr=Pt("The {tokenNamePrefix}-token is formatted with incorrect information.",le).format({tokenNamePrefix:Yt}),Xr=Pt("The {tokenNamePrefix}-token has no aud value. aud value should be {expectedAud}.",le).format({tokenNamePrefix:Yt,expectedAud:pr}),dr=new Lt(Fr,gt,!0,Xr);return dr.errorCategory=P,dr.muxCode=At.NETWORK_TOKEN_AUD_MISSING,dr.data=M,dr}if(Oe(Ur,pr)){let Fr=Pt("The {tokenNamePrefix}-token is formatted with incorrect information.",le).format({tokenNamePrefix:Yt}),Xr=Pt("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.",le).format({tokenNamePrefix:Yt,expectedAud:pr,aud:Ur.aud}),dr=new Lt(Fr,gt,!0,Xr);return dr.errorCategory=P,dr.muxCode=At.NETWORK_TOKEN_AUD_MISMATCH,dr.data=M,dr}}else{let Fr=Pt("Authorization error trying to access this {category} URL. If this is a signed URL, you might need to provide a {tokenNamePrefix}-token.",le).format({tokenNamePrefix:Yt,category:P}),Xr=Pt("Specified playback ID: {playbackId}",le).format({playbackId:Tr}),dr=new Lt(Fr,gt,ue!=null?ue:!0,Xr);return dr.errorCategory=P,dr.muxCode=At.NETWORK_TOKEN_MISSING,dr.data=M,dr}if(Ce===412){let Fr=Pt("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",le),Xr=Pt("Specified playback ID: {playbackId}",le).format({playbackId:Tr}),dr=new Lt(Fr,gt,ue!=null?ue:!0,Xr);return dr.errorCategory=P,dr.muxCode=At.NETWORK_NOT_READY,dr.streamType=q.streamType===pe.LIVE?"live":q.streamType===pe.ON_DEMAND?"on-demand":"unknown",dr.data=M,dr}if(Ce===404){let Fr=Pt("This URL or playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",le),Xr=Pt("Specified playback ID: {playbackId}",le).format({playbackId:Tr}),dr=new Lt(Fr,gt,ue!=null?ue:!0,Xr);return dr.errorCategory=P,dr.muxCode=At.NETWORK_NOT_FOUND,dr.data=M,dr}if(Ce===400){let Fr=Pt("The URL or playback-id was invalid. You may have used an invalid value as a playback-id."),Xr=Pt("Specified playback ID: {playbackId}",le).format({playbackId:Tr}),dr=new Lt(Fr,gt,ue!=null?ue:!0,Xr);return dr.errorCategory=P,dr.muxCode=At.NETWORK_INVALID_URL,dr.data=M,dr}let wr=new Lt("",gt,ue!=null?ue:!0);return wr.errorCategory=P,wr.muxCode=At.NETWORK_UNKNOWN_ERROR,wr.data=M,wr},zi=ke.DefaultConfig.capLevelController,aa={"720p":921600,"1080p":2073600,"1440p":4194304,"2160p":8294400};function ma(M){let P=M.toLowerCase().trim();return aa[P]}var Oa=class Xh extends zi{constructor(P){super(P)}static setMaxAutoResolution(P,q){q?Xh.maxAutoResolution.set(P,q):Xh.maxAutoResolution.delete(P)}getMaxAutoResolution(){var P;let q=this.hls;return(P=Xh.maxAutoResolution.get(q))!=null?P:void 0}get levels(){var P;return(P=this.hls.levels)!=null?P:[]}getValidLevels(P){return this.levels.filter((q,ue)=>this.isLevelAllowed(q)&&ue<=P)}getMaxLevelCapped(P){let q=this.getValidLevels(P),ue=this.getMaxAutoResolution();if(!ue)return super.getMaxLevel(P);let le=ma(ue);if(!le)return super.getMaxLevel(P);let We=q.filter(Ce=>Ce.width*Ce.height<=le),xe=We.findIndex(Ce=>Ce.width*Ce.height===le);if(xe!==-1){let Ce=We[xe];return q.findIndex(wt=>wt===Ce)}if(We.length===0)return 0;let lt=We[We.length-1];return q.findIndex(Ce=>Ce===lt)}getMaxLevel(P){if(this.getMaxAutoResolution()!==void 0)return this.getMaxLevelCapped(P);let q=super.getMaxLevel(P),ue=this.getValidLevels(P);if(!ue[q])return q;let le=Math.min(ue[q].width,ue[q].height),We=Xh.minMaxResolution;return le>=We?q:zi.getMaxLevelByMediaSize(ue,We*(16/9),We)}};Oa.minMaxResolution=720,Oa.maxAutoResolution=new WeakMap;var Qi=Oa,dn=Qi,Qa={FAIRPLAY:"fairplay",PLAYREADY:"playready",WIDEVINE:"widevine"},Si=M=>{if(M.includes("fps"))return Qa.FAIRPLAY;if(M.includes("playready"))return Qa.PLAYREADY;if(M.includes("widevine"))return Qa.WIDEVINE},Gs=M=>{let P=M.split(`
`).find((q,ue,le)=>ue&&le[ue-1].startsWith("#EXT-X-STREAM-INF"));return fetch(P).then(q=>q.status!==200?Promise.reject(q):q.text())},cn=M=>{let P=M.split(`
`).filter(ue=>ue.startsWith("#EXT-X-SESSION-DATA"));if(!P.length)return{};let q={};for(let ue of P){let le=Li(ue),We=le["DATA-ID"];We&&(q[We]=he({},le))}return{sessionData:q}},ui=/([A-Z0-9-]+)="?(.*?)"?(?:,|$)/g;function Li(M){let P=[...M.matchAll(ui)];return Object.fromEntries(P.map(([,q,ue])=>[q,ue]))}var Nr=M=>{var P,q,ue;let le=M.split(`
`),We=(q=((P=le.find(wt=>wt.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?P:"").split(":")[1])==null?void 0:q.trim(),xe=Lr(We),lt=zr(We),Ce;if(xe===pe.LIVE){let wt=le.find(gt=>gt.startsWith("#EXT-X-PART-INF"));if(wt)Ce=+wt.split(":")[1].split("=")[1]*2;else{let gt=le.find(mr=>mr.startsWith("#EXT-X-TARGETDURATION")),Yt=(ue=gt==null?void 0:gt.split(":"))==null?void 0:ue[1];Ce=+(Yt!=null?Yt:6)*3}}return{streamType:xe,targetLiveWindow:lt,liveEdgeStartOffset:Ce}},Vr=(M,P)=>K(this,null,function*(){if(P===Te.MP4)return{streamType:pe.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0,sessionData:void 0};if(P===Te.M3U8){let q=yield fetch(M);if(!q.ok)return Promise.reject(q);let ue=yield q.text(),le=yield Gs(ue);return he(he({},cn(ue)),Nr(le))}return console.error(`Media type ${P} is an unrecognized or unsupported type for src ${M}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0,sessionData:void 0}}),di=(M,P,...q)=>K(this,[M,P,...q],function*(ue,le,We=Ut({src:ue})){var xe,lt,Ce,wt;let{streamType:gt,targetLiveWindow:Yt,liveEdgeStartOffset:mr,sessionData:pr}=yield Vr(ue,We),Tr=pr==null?void 0:pr["com.apple.hls.chapters"];(Tr!=null&&Tr.URI||Tr!=null&&Tr.VALUE.toLocaleLowerCase().startsWith("http"))&&qr((xe=Tr.URI)!=null?xe:Tr.VALUE,le),((lt=Gr.get(le))!=null?lt:{}).liveEdgeStartOffset=mr,((Ce=Gr.get(le))!=null?Ce:{}).targetLiveWindow=Yt,le.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((wt=Gr.get(le))!=null?wt:{}).streamType=gt,le.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))}),qr=(M,P)=>K(this,null,function*(){var q,ue;try{let le=yield fetch(M);if(!le.ok)throw new Error(`Failed to fetch Mux metadata: ${le.status} ${le.statusText}`);let We=yield le.json(),xe={};if(!((q=We==null?void 0:We[0])!=null&&q.metadata))return;for(let Ce of We[0].metadata)Ce.key&&Ce.value&&(xe[Ce.key]=Ce.value);((ue=Gr.get(P))!=null?ue:{}).metadata=xe;let lt=new CustomEvent("muxmetadata");P.dispatchEvent(lt)}catch(le){console.error(le)}}),Kn=M=>{var P;let q=M.type,ue=Lr(q),le=zr(q),We,xe=!!((P=M.partList)!=null&&P.length);return ue===pe.LIVE&&(We=xe?M.partTarget*2:M.targetduration*3),{streamType:ue,targetLiveWindow:le,liveEdgeStartOffset:We,lowLatency:xe}},ha=(M,P,q)=>{var ue,le,We,xe,lt,Ce,wt,gt;let{streamType:Yt,targetLiveWindow:mr,liveEdgeStartOffset:pr,lowLatency:Tr}=Kn(M);if(Yt===pe.LIVE){Tr?(q.config.backBufferLength=(ue=q.userConfig.backBufferLength)!=null?ue:4,q.config.maxFragLookUpTolerance=(le=q.userConfig.maxFragLookUpTolerance)!=null?le:.001,q.config.abrBandWidthUpFactor=(We=q.userConfig.abrBandWidthUpFactor)!=null?We:q.config.abrBandWidthFactor):q.config.backBufferLength=(xe=q.userConfig.backBufferLength)!=null?xe:8;let Ur=Object.freeze({get length(){return P.seekable.length},start(wr){return P.seekable.start(wr)},end(wr){var Fr;return wr>this.length||wr<0||Number.isFinite(P.duration)?P.seekable.end(wr):(Fr=q.liveSyncPosition)!=null?Fr:P.seekable.end(wr)}});((lt=Gr.get(P))!=null?lt:{}).seekable=Ur}((Ce=Gr.get(P))!=null?Ce:{}).liveEdgeStartOffset=pr,((wt=Gr.get(P))!=null?wt:{}).targetLiveWindow=mr,P.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((gt=Gr.get(P))!=null?gt:{}).streamType=Yt,P.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},X,W,se=(W=(X=globalThis==null?void 0:globalThis.navigator)==null?void 0:X.userAgent)!=null?W:"",Vt,Cr,gi,ei=(gi=(Cr=(Vt=globalThis==null?void 0:globalThis.navigator)==null?void 0:Vt.userAgentData)==null?void 0:Cr.platform)!=null?gi:"",Xi=se.toLowerCase().includes("android")||["x11","android"].some(M=>ei.toLowerCase().includes(M)),Ei=M=>/^((?!chrome|android).)*safari/i.test(se)&&!!M.canPlayType("application/vnd.apple.mpegurl"),Gr=new WeakMap,na="mux.com",Zi,bs,hn=(bs=(Zi=ke).isSupported)==null?void 0:bs.call(Zi),Ts=M=>Xi||!Ei(M),xa=()=>{if(typeof window!="undefined")return ae.default.utils.now()},Na=ae.default.utils.generateUUID,Ln=({playbackId:M,customDomain:P=na,maxResolution:q,minResolution:ue,renditionOrder:le,programStartTime:We,programEndTime:xe,assetStartTime:lt,assetEndTime:Ce,playbackToken:wt,tokens:{playback:gt=wt}={},extraSourceParams:Yt={}}={})=>{if(!M)return;let[mr,pr=""]=Nt(M),Tr=new URL(`https://stream.${P}/${mr}.m3u8${pr}`);return gt||Tr.searchParams.has("token")?(Tr.searchParams.forEach((Ur,wr)=>{wr!="token"&&Tr.searchParams.delete(wr)}),gt&&Tr.searchParams.set("token",gt)):(q&&Tr.searchParams.set("max_resolution",q),ue&&(Tr.searchParams.set("min_resolution",ue),q&&+q.slice(0,-1)<+ue.slice(0,-1)&&console.error("minResolution must be <= maxResolution","minResolution",ue,"maxResolution",q)),le&&Tr.searchParams.set("rendition_order",le),We&&Tr.searchParams.set("program_start_time",`${We}`),xe&&Tr.searchParams.set("program_end_time",`${xe}`),lt&&Tr.searchParams.set("asset_start_time",`${lt}`),Ce&&Tr.searchParams.set("asset_end_time",`${Ce}`),Object.entries(Yt).forEach(([Ur,wr])=>{wr!=null&&Tr.searchParams.set(Ur,wr)})),Tr.toString()},Xa=M=>{if(!M)return;let[P]=M.split("?");return P||void 0},kn=M=>{if(!M||!M.startsWith("https://stream."))return;let[P]=new URL(M).pathname.slice(1).split(/\.m3u8|\//);return P||void 0},Sa=M=>{var P,q,ue;return(P=M==null?void 0:M.metadata)!=null&&P.video_id?M.metadata.video_id:mn(M)&&(ue=(q=Xa(M.playbackId))!=null?q:kn(M.src))!=null?ue:M.src},Ua=M=>{var P;return(P=Gr.get(M))==null?void 0:P.error},Ks=M=>{var P;return(P=Gr.get(M))==null?void 0:P.metadata},ur=M=>{var P,q;return(q=(P=Gr.get(M))==null?void 0:P.streamType)!=null?q:pe.UNKNOWN},hi=M=>{var P,q;return(q=(P=Gr.get(M))==null?void 0:P.targetLiveWindow)!=null?q:Number.NaN},Di=M=>{var P,q;return(q=(P=Gr.get(M))==null?void 0:P.seekable)!=null?q:M.seekable},ti=M=>{var P;let q=(P=Gr.get(M))==null?void 0:P.liveEdgeStartOffset;if(typeof q!="number")return Number.NaN;let ue=Di(M);return ue.length?ue.end(ue.length-1)-q:Number.NaN},sa=.034,fn=(M,P,q=sa)=>Math.abs(M-P)<=q,xi=(M,P,q=sa)=>M>P||fn(M,P,q),fa=(M,P=sa)=>M.paused&&xi(M.currentTime,M.duration,P),vr=(M,P)=>{var q,ue,le;if(!P||!M.buffered.length)return;if(M.readyState>2)return!1;let We=P.currentLevel>=0?(ue=(q=P.levels)==null?void 0:q[P.currentLevel])==null?void 0:ue.details:(le=P.levels.find(Yt=>!!Yt.details))==null?void 0:le.details;if(!We||We.live)return;let{fragments:xe}=We;if(!(xe!=null&&xe.length))return;if(M.currentTime<M.duration-(We.targetduration+.5))return!1;let lt=xe[xe.length-1];if(M.currentTime<=lt.start)return!1;let Ce=lt.start+lt.duration/2,wt=M.buffered.start(M.buffered.length-1),gt=M.buffered.end(M.buffered.length-1);return Ce>wt&&Ce<gt},In=(M,P)=>M.ended||M.loop?M.ended:P&&vr(M,P)?!0:fa(M),Fa=(M,P,q)=>{ls(P,q,M);let{metadata:ue={}}=M,{view_session_id:le=Na()}=ue,We=Sa(M);ue.view_session_id=le,ue.video_id=We,M.metadata=ue;let xe=gt=>{var Yt;(Yt=P.mux)==null||Yt.emit("hb",{view_drm_type:gt})};M.drmTypeCb=xe,Gr.set(P,{retryCount:0});let lt=Rn(M,P),Ce=ln(M,P,lt);M!=null&&M.muxDataKeepSession&&P!=null&&P.mux&&!P.mux.deleted?lt&&P.mux.addHLSJS({hlsjs:lt,Hls:lt?ke:void 0}):Ba(M,P,lt),Wn(M,P,lt),Ci(P),pi(P);let wt=Qr(M,P,lt);return{engine:lt,setAutoplay:wt,setPreload:Ce}},ls=(M,P,q)=>{let ue=P==null?void 0:P.engine;M!=null&&M.mux&&!M.mux.deleted&&(q!=null&&q.muxDataKeepSession?ue&&M.mux.removeHLSJS():(M.mux.destroy(),delete M.mux)),ue&&(ue.detachMedia(),ue.destroy()),M&&(M.hasAttribute("src")&&(M.removeAttribute("src"),M.load()),M.removeEventListener("error",oa),M.removeEventListener("error",pn),M.removeEventListener("durationchange",pa),Gr.delete(M),M.dispatchEvent(new Event("teardown")))};function vn(M,P){var q;let ue=Ut(M);if(ue!==Te.M3U8)return!0;let le=!ue||((q=P.canPlayType(ue))!=null?q:!0),{preferPlayback:We}=M,xe=We===Ie.MSE,lt=We===Ie.NATIVE,Ce=hn&&(xe||Ts(P));return le&&(lt||!Ce)}var Rn=(M,P)=>{let{debug:q,streamType:ue,startTime:le=-1,metadata:We,preferCmcd:xe,_hlsConfig:lt={},maxAutoResolution:Ce}=M,wt=Ut(M)===Te.M3U8,gt=vn(M,P);if(wt&&!gt&&hn){let Yt={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},mr=Ws(ue),pr=us(M),Tr=[ct.QUERY,ct.HEADER].includes(xe)?{useHeaders:xe===ct.HEADER,sessionId:We==null?void 0:We.view_session_id,contentId:We==null?void 0:We.video_id}:void 0,Ur=lt.capLevelToPlayerSize==null?{capLevelController:dn}:{},wr=new ke(he(he(he(he(he({debug:q,startPosition:le,cmcd:Tr,xhrSetup:(Fr,Xr)=>{var dr,Ki;if(xe&&xe!==ct.QUERY)return;let $i=new URL(Xr);if(!$i.searchParams.has("CMCD"))return;let Ha=((Ki=(dr=$i.searchParams.get("CMCD"))==null?void 0:dr.split(","))!=null?Ki:[]).filter($n=>$n.startsWith("sid")||$n.startsWith("cid")).join(",");$i.searchParams.set("CMCD",Ha),Fr.open("GET",$i)}},Ur),Yt),mr),pr),lt));return Ur.capLevelController===dn&&Ce!==void 0&&dn.setMaxAutoResolution(wr,Ce),wr.on(ke.Events.MANIFEST_PARSED,function(Fr,Xr){return K(this,null,function*(){var dr,Ki;let $i=(dr=Xr.sessionData)==null?void 0:dr["com.apple.hls.chapters"];($i!=null&&$i.URI||$i!=null&&$i.VALUE.toLocaleLowerCase().startsWith("http"))&&qr((Ki=$i==null?void 0:$i.URI)!=null?Ki:$i==null?void 0:$i.VALUE,P)})}),wr}},Ws=M=>M===pe.LIVE?{backBufferLength:8}:{},us=M=>{let{tokens:{drm:P}={},playbackId:q,drmTypeCb:ue}=M,le=Xa(q);return!P||!le?{}:{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:Ja(M,"fairplay"),serverCertificateUrl:wn(M,"fairplay")},"com.widevine.alpha":{licenseUrl:Ja(M,"widevine")},"com.microsoft.playready":{licenseUrl:Ja(M,"playready")}},requestMediaKeySystemAccessFunc:(We,xe)=>(We==="com.widevine.alpha"&&(xe=[...xe.map(lt=>{var Ce;let wt=(Ce=lt.videoCapabilities)==null?void 0:Ce.map(gt=>O(he({},gt),{robustness:"HW_SECURE_ALL"}));return O(he({},lt),{videoCapabilities:wt})}),...xe]),navigator.requestMediaKeySystemAccess(We,xe).then(lt=>{let Ce=Si(We);return ue==null||ue(Ce),lt}))}},xn=M=>K(this,null,function*(){let P=yield fetch(M);return P.status!==200?Promise.reject(P):yield P.arrayBuffer()}),Za=(M,P)=>K(this,null,function*(){let q=yield fetch(P,{method:"POST",headers:{"Content-type":"application/octet-stream"},body:M});if(q.status!==200)return Promise.reject(q);let ue=yield q.arrayBuffer();return new Uint8Array(ue)}),fi=(M,P)=>{let q=We=>K(this,null,function*(){let xe=yield navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:[We],videoCapabilities:[{contentType:"application/vnd.apple.mpegurl",robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:"not-allowed",sessionTypes:["temporary"]}]).then(Ce=>{var wt;return(wt=M.drmTypeCb)==null||wt.call(M,Qa.FAIRPLAY),Ce}).catch(()=>{let Ce=Pt("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),wt=new Lt(Ce,Lt.MEDIA_ERR_ENCRYPTED,!0);wt.errorCategory=mt.DRM,wt.muxCode=At.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM,ki(P,wt)});if(!xe)return;let lt=yield xe.createMediaKeys();try{let Ce=yield xn(wn(M,"fairplay")).catch(wt=>{if(wt instanceof Response){let gt=un(wt,mt.DRM,M);return console.error("mediaError",gt==null?void 0:gt.message,gt==null?void 0:gt.context),gt?Promise.reject(gt):Promise.reject(new Error("Unexpected error in app cert request"))}return Promise.reject(wt)});yield lt.setServerCertificate(Ce).catch(()=>{let wt=Pt("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),gt=new Lt(wt,Lt.MEDIA_ERR_ENCRYPTED,!0);return gt.errorCategory=mt.DRM,gt.muxCode=At.ENCRYPTED_UPDATE_SERVER_CERT_FAILED,Promise.reject(gt)})}catch(Ce){ki(P,Ce);return}yield P.setMediaKeys(lt)}),ue=We=>{let xe;if(We==="internal-error"){let lt=Pt("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");xe=new Lt(lt,Lt.MEDIA_ERR_ENCRYPTED,!0),xe.errorCategory=mt.DRM,xe.muxCode=At.ENCRYPTED_CDM_ERROR}else if(We==="output-restricted"||We==="output-downscaled"){let lt=Pt("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");xe=new Lt(lt,Lt.MEDIA_ERR_ENCRYPTED,!1),xe.errorCategory=mt.DRM,xe.muxCode=At.ENCRYPTED_OUTPUT_RESTRICTED}xe&&ki(P,xe)},le=(We,xe)=>K(this,null,function*(){let lt=P.mediaKeys.createSession(),Ce=()=>{lt.keyStatuses.forEach(gt=>ue(gt))},wt=gt=>K(this,null,function*(){let Yt=gt.message;try{let mr=yield Za(Yt,Ja(M,"fairplay"));try{yield lt.update(mr)}catch(pr){let Tr=Pt("Failed to update DRM license. This may be an issue with the player or your protected content."),Ur=new Lt(Tr,Lt.MEDIA_ERR_ENCRYPTED,!0);Ur.errorCategory=mt.DRM,Ur.muxCode=At.ENCRYPTED_UPDATE_LICENSE_FAILED,ki(P,Ur)}}catch(mr){if(mr instanceof Response){let pr=un(mr,mt.DRM,M);if(console.error("mediaError",pr==null?void 0:pr.message,pr==null?void 0:pr.context),pr){ki(P,pr);return}console.error("Unexpected error in license key request",mr);return}console.error(mr)}});lt.addEventListener("keystatuseschange",Ce),lt.addEventListener("message",wt),P.addEventListener("teardown",()=>{lt.removeEventListener("keystatuseschange",Ce),lt.removeEventListener("message",wt),lt.close()},{once:!0}),yield lt.generateRequest(We,xe).catch(gt=>{console.error("Failed to generate license request",gt);let Yt=Pt("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),mr=new Lt(Yt,Lt.MEDIA_ERR_ENCRYPTED,!0);return mr.errorCategory=mt.DRM,mr.muxCode=At.ENCRYPTED_GENERATE_REQUEST_FAILED,Promise.reject(mr)})});je(P,"encrypted",We=>K(this,null,function*(){try{let xe=We.initDataType;if(xe!=="skd"){console.error(`Received unexpected initialization data type "${xe}"`);return}P.mediaKeys||(yield q(xe));let lt=We.initData;if(lt==null){console.error(`Could not start encrypted playback due to missing initData in ${We.type} event`);return}yield le(xe,lt)}catch(xe){ki(P,xe);return}}))},Ja=({playbackId:M,tokens:{drm:P}={},customDomain:q=na},ue)=>{let le=Xa(M);return`https://license.${q.toLocaleLowerCase().endsWith(na)?q:na}/license/${ue}/${le}?token=${P}`},wn=({playbackId:M,tokens:{drm:P}={},customDomain:q=na},ue)=>{let le=Xa(M);return`https://license.${q.toLocaleLowerCase().endsWith(na)?q:na}/appcert/${ue}/${le}?token=${P}`},mn=({playbackId:M,src:P,customDomain:q})=>{if(M)return!0;if(typeof P!="string")return!1;let ue=window==null?void 0:window.location.href,le=new URL(P,ue).hostname.toLocaleLowerCase();return le.includes(na)||!!q&&le.includes(q.toLocaleLowerCase())},Ba=(M,P,q)=>{var ue;let{envKey:le,disableTracking:We,muxDataSDK:xe=ae.default,muxDataSDKOptions:lt={}}=M,Ce=mn(M);if(!We&&(le||Ce)){let{playerInitTime:wt,playerSoftwareName:gt,playerSoftwareVersion:Yt,beaconCollectionDomain:mr,debug:pr,disableCookies:Tr}=M,Ur=O(he({},M.metadata),{video_title:((ue=M==null?void 0:M.metadata)==null?void 0:ue.video_title)||void 0}),wr=Fr=>typeof Fr.player_error_code=="string"?!1:typeof M.errorTranslator=="function"?M.errorTranslator(Fr):Fr;xe.monitor(P,O(he({debug:pr,beaconCollectionDomain:mr,hlsjs:q,Hls:q?ke:void 0,automaticErrorTracking:!1,errorTranslator:wr,disableCookies:Tr},lt),{data:he(O(he({},le?{env_key:le}:{}),{player_software_name:gt,player_software:gt,player_software_version:Yt,player_init_time:wt}),Ur)}))}},Wn=(M,P,q)=>{var ue,le;let We=vn(M,P),{src:xe,customDomain:lt=na}=M,Ce=()=>{P.ended||M.disablePseudoEnded||!In(P,q)||(vr(P,q)?P.currentTime=P.buffered.end(P.buffered.length-1):P.dispatchEvent(new Event("ended")))},wt,gt,Yt=()=>{let mr=Di(P),pr,Tr;mr.length>0&&(pr=mr.start(0),Tr=mr.end(0)),(gt!==Tr||wt!==pr)&&P.dispatchEvent(new CustomEvent("seekablechange",{composed:!0})),wt=pr,gt=Tr};if(je(P,"durationchange",Yt),P&&We){let mr=Ut(M);if(typeof xe=="string"){if(xe.endsWith(".mp4")&&xe.includes(lt)){let Ur=kn(xe),wr=new URL(`https://stream.${lt}/${Ur}/metadata.json`);qr(wr.toString(),P)}let pr=()=>{if(ur(P)!==pe.LIVE||Number.isFinite(P.duration))return;let Ur=setInterval(Yt,1e3);P.addEventListener("teardown",()=>{clearInterval(Ur)},{once:!0}),je(P,"durationchange",()=>{Number.isFinite(P.duration)&&clearInterval(Ur)})},Tr=()=>K(this,null,function*(){return di(xe,P,mr).then(pr).catch(Ur=>{if(Ur instanceof Response){let wr=un(Ur,mt.VIDEO,M);if(wr){ki(P,wr);return}}else Ur instanceof Error})});if(P.preload==="none"){let Ur=()=>{Tr(),P.removeEventListener("loadedmetadata",wr)},wr=()=>{Tr(),P.removeEventListener("play",Ur)};je(P,"play",Ur,{once:!0}),je(P,"loadedmetadata",wr,{once:!0})}else Tr();(ue=M.tokens)!=null&&ue.drm?fi(M,P):je(P,"encrypted",()=>{let Ur=Pt("Attempting to play DRM-protected content without providing a DRM token."),wr=new Lt(Ur,Lt.MEDIA_ERR_ENCRYPTED,!0);wr.errorCategory=mt.DRM,wr.muxCode=At.ENCRYPTED_MISSING_TOKEN,ki(P,wr)},{once:!0}),P.setAttribute("src",xe),M.startTime&&(((le=Gr.get(P))!=null?le:{}).startTime=M.startTime,P.addEventListener("durationchange",pa,{once:!0}))}else P.removeAttribute("src");P.addEventListener("error",oa),P.addEventListener("error",pn),P.addEventListener("emptied",()=>{P.querySelectorAll("track[data-removeondestroy]").forEach(pr=>{pr.remove()})},{once:!0}),je(P,"pause",Ce),je(P,"seeked",Ce),je(P,"play",()=>{P.ended||xi(P.currentTime,P.duration)&&(P.currentTime=P.seekable.length?P.seekable.start(0):0)})}else q&&xe?(q.once(ke.Events.LEVEL_LOADED,(mr,pr)=>{ha(pr.details,P,q),Yt(),ur(P)===pe.LIVE&&!Number.isFinite(P.duration)&&(q.on(ke.Events.LEVEL_UPDATED,Yt),je(P,"durationchange",()=>{Number.isFinite(P.duration)&&q.off(ke.Events.LEVELS_UPDATED,Yt)}))}),q.on(ke.Events.ERROR,(mr,pr)=>{var Tr,Ur;let wr=Yn(pr,M);if(wr.muxCode===At.NETWORK_NOT_READY){let Fr=(Tr=Gr.get(P))!=null?Tr:{},Xr=(Ur=Fr.retryCount)!=null?Ur:0;if(Xr<6){let dr=Xr===0?5e3:6e4,Ki=new Lt(`Retrying in ${dr/1e3} seconds...`,wr.code,wr.fatal);Object.assign(Ki,wr),ki(P,Ki),setTimeout(()=>{Fr.retryCount=Xr+1,pr.details==="manifestLoadError"&&pr.url&&q.loadSource(pr.url)},dr);return}else{Fr.retryCount=0;let dr=new Lt('Try again later or <a href="#" onclick="window.location.reload(); return false;" style="color: #4a90e2;">click here to retry</a>',wr.code,wr.fatal);Object.assign(dr,wr),ki(P,dr);return}}ki(P,wr)}),q.on(ke.Events.MANIFEST_LOADED,()=>{let mr=Gr.get(P);mr&&mr.error&&(mr.error=null,mr.retryCount=0,P.dispatchEvent(new Event("emptied")),P.dispatchEvent(new Event("loadstart")))}),P.addEventListener("error",pn),je(P,"waiting",Ce),Ar(M,q),_i(P,q),q.attachMedia(P)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function pa(M){var P;let q=M.target,ue=(P=Gr.get(q))==null?void 0:P.startTime;if(ue&&Jt(q.seekable,q.duration,ue)){let le=q.preload==="auto";le&&(q.preload="none"),q.currentTime=ue,le&&(q.preload="auto")}}function oa(M){return K(this,null,function*(){if(!M.isTrusted)return;M.stopImmediatePropagation();let P=M.target;if(!(P!=null&&P.error))return;let{message:q,code:ue}=P.error,le=new Lt(q,ue);if(P.src&&ue===Lt.MEDIA_ERR_SRC_NOT_SUPPORTED&&P.readyState===HTMLMediaElement.HAVE_NOTHING){setTimeout(()=>{var We;let xe=(We=Ua(P))!=null?We:P.error;(xe==null?void 0:xe.code)===Lt.MEDIA_ERR_SRC_NOT_SUPPORTED&&ki(P,le)},500);return}if(P.src&&(ue!==Lt.MEDIA_ERR_DECODE||ue!==void 0))try{let{status:We}=yield fetch(P.src);le.data={response:{code:We}}}catch(We){}ki(P,le)})}function ki(M,P){var q;P.fatal&&(((q=Gr.get(M))!=null?q:{}).error=P,M.dispatchEvent(new CustomEvent("error",{detail:P})))}function pn(M){var P,q;if(!(M instanceof CustomEvent)||!(M.detail instanceof Lt))return;let ue=M.target,le=M.detail;!le||!le.fatal||(((P=Gr.get(ue))!=null?P:{}).error=le,(q=ue.mux)==null||q.emit("error",{player_error_code:le.code,player_error_message:le.message,player_error_context:le.context}))}var Yn=(M,P)=>{var q,ue,le;M.fatal?console.error("getErrorFromHlsErrorData()",M):P.debug&&console.warn("getErrorFromHlsErrorData() (non-fatal)",M);let We={[ke.ErrorTypes.NETWORK_ERROR]:Lt.MEDIA_ERR_NETWORK,[ke.ErrorTypes.MEDIA_ERROR]:Lt.MEDIA_ERR_DECODE,[ke.ErrorTypes.KEY_SYSTEM_ERROR]:Lt.MEDIA_ERR_ENCRYPTED},xe=gt=>[ke.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,ke.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED].includes(gt.details)?Lt.MEDIA_ERR_NETWORK:We[gt.type],lt=gt=>{if(gt.type===ke.ErrorTypes.KEY_SYSTEM_ERROR)return mt.DRM;if(gt.type===ke.ErrorTypes.NETWORK_ERROR)return mt.VIDEO},Ce,wt=xe(M);if(wt===Lt.MEDIA_ERR_NETWORK&&M.response){let gt=(q=lt(M))!=null?q:mt.VIDEO;Ce=(ue=un(M.response,gt,P,M.fatal))!=null?ue:new Lt("",wt,M.fatal)}else if(wt===Lt.MEDIA_ERR_ENCRYPTED)if(M.details===ke.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE){let gt=Pt("Attempting to play DRM-protected content without providing a DRM token.");Ce=new Lt(gt,Lt.MEDIA_ERR_ENCRYPTED,M.fatal),Ce.errorCategory=mt.DRM,Ce.muxCode=At.ENCRYPTED_MISSING_TOKEN}else if(M.details===ke.ErrorDetails.KEY_SYSTEM_NO_ACCESS){let gt=Pt("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.");Ce=new Lt(gt,Lt.MEDIA_ERR_ENCRYPTED,M.fatal),Ce.errorCategory=mt.DRM,Ce.muxCode=At.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM}else if(M.details===ke.ErrorDetails.KEY_SYSTEM_NO_SESSION){let gt=Pt("Failed to generate a DRM license request. This may be an issue with the player or your protected content.");Ce=new Lt(gt,Lt.MEDIA_ERR_ENCRYPTED,!0),Ce.errorCategory=mt.DRM,Ce.muxCode=At.ENCRYPTED_GENERATE_REQUEST_FAILED}else if(M.details===ke.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED){let gt=Pt("Failed to update DRM license. This may be an issue with the player or your protected content.");Ce=new Lt(gt,Lt.MEDIA_ERR_ENCRYPTED,M.fatal),Ce.errorCategory=mt.DRM,Ce.muxCode=At.ENCRYPTED_UPDATE_LICENSE_FAILED}else if(M.details===ke.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED){let gt=Pt("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate.");Ce=new Lt(gt,Lt.MEDIA_ERR_ENCRYPTED,M.fatal),Ce.errorCategory=mt.DRM,Ce.muxCode=At.ENCRYPTED_UPDATE_SERVER_CERT_FAILED}else if(M.details===ke.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR){let gt=Pt("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");Ce=new Lt(gt,Lt.MEDIA_ERR_ENCRYPTED,M.fatal),Ce.errorCategory=mt.DRM,Ce.muxCode=At.ENCRYPTED_CDM_ERROR}else if(M.details===ke.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED){let gt=Pt("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");Ce=new Lt(gt,Lt.MEDIA_ERR_ENCRYPTED,!1),Ce.errorCategory=mt.DRM,Ce.muxCode=At.ENCRYPTED_OUTPUT_RESTRICTED}else Ce=new Lt(M.error.message,Lt.MEDIA_ERR_ENCRYPTED,M.fatal),Ce.errorCategory=mt.DRM,Ce.muxCode=At.ENCRYPTED_ERROR;else Ce=new Lt("",wt,M.fatal);return Ce.context||(Ce.context=`${M.url?`url: ${M.url}
`:""}${M.response&&(M.response.code||M.response.text)?`response: ${M.response.code}, ${M.response.text}
`:""}${M.reason?`failure reason: ${M.reason}
`:""}${M.level?`level: ${M.level}
`:""}${M.parent?`parent stream controller: ${M.parent}
`:""}${M.buffer?`buffer length: ${M.buffer}
`:""}${M.error?`error: ${M.error}
`:""}${M.event?`event: ${M.event}
`:""}${M.err?`error message: ${(le=M.err)==null?void 0:le.message}
`:""}`),Ce.data=M,Ce}},82744($e,Me,Ee){"use strict";var He=Ee(89249);Object.defineProperty(Me,"__esModule",{value:!0});var Le={MUX_PLAYBACK_TOKEN_TTL:!0};Object.defineProperty(Me,"MUX_PLAYBACK_TOKEN_TTL",{enumerable:!0,get:function(){return de.MUX_PLAYBACK_TOKEN_TTL}}),Me.default=void 0;var Ne=He(Ee(45397)),H=Ee(88431);Object.keys(H).forEach(function(he){he==="default"||he==="__esModule"||Object.prototype.hasOwnProperty.call(Le,he)||he in Me&&Me[he]===H[he]||Object.defineProperty(Me,he,{enumerable:!0,get:function(){return H[he]}})});var Qe=Ee(88481);Object.keys(Qe).forEach(function(he){he==="default"||he==="__esModule"||Object.prototype.hasOwnProperty.call(Le,he)||he in Me&&Me[he]===Qe[he]||Object.defineProperty(Me,he,{enumerable:!0,get:function(){return Qe[he]}})});var de=Ee(40805),Pe=Me.default=Ne.default},52121($e,Me,Ee){"use strict";var He=Ee(89249);Object.defineProperty(Me,"__esModule",{value:!0}),Me.interactionEvents=Me.fullScreenEvents=Me.default=Me.MuxPlayerAutoplay=Me.AUTOPLAY_PLAY_BUTTON_CLASS=void 0;var Le=He(Ee(81987)),Ne=He(Ee(3504)),H=He(Ee(66326)),Qe=He(Ee(29296)),de=He(Ee(38144)),Pe=He(Ee(74956)),he=Ee(76322),O=Ee(88481),K="white",j="#655D67",ve="transparent",at="white",ze="#7C7C7C",Et="black",Xe="300px",Ye={COVER:"--media-object-fit: cover;",CONTAIN:"--media-object-fit: contain;"},Ze=300,st="after-playing",ht="autoplay",Je="16px",ae="mux-player-wrapper",dt="mux-player-wrapper",ke=Me.AUTOPLAY_PLAY_BUTTON_CLASS="autoplay-play-button",mt=function(_e){return`
  <style>
    mux-player#`.concat(_e,` {
      height: 100%;
      background-color: white;
      --volume-range: none;
      --seek-backward-button: none;
      --seek-forward-button: none;
      border: 1px solid #514c4026;
      border-radius: 8px;
      overflow: hidden;
    }
  </style>`)},At=function(_e){var Te=_e.id,we=_e.cover,xt=we===void 0?!1:we,Ir=_e.hideCaptionsControl,V=Ir===void 0?!1:Ir;return`
  <style>
    mux-player#`.concat(Te,` {
      height: 100%;
      --seek-backward-button: none;
      --seek-forward-button: none;
      --bottom-controls: none;
      `).concat(xt?Ye.COVER:Ye.CONTAIN,`
    }
    
    mux-player#`).concat(Te,".").concat(st,` {
      --bottom-controls: initial;
      --live-button: none;
      --airplay-button: none;
      --pip-button: none;
      --cast-button: none;
      --volume-range: none;
      --media-rendition-menu-button-display: none;
      --media-range-track-border-radius: 48px; 
    }
      
    mux-player#`).concat(Te,".").concat(ht,` {
      --play-button: none;
      --loading-indicator: none;
      cursor: pointer;
    }   

    mux-player#`).concat(Te,`::part(control-bar bottom) {
      background: linear-gradient(transparent, `).concat(Et,`);
    }

    mux-player#`).concat(Te,`::part(bottom time display) {
      pointer-events: none;
      padding-left: `).concat(Je,`;
    }
    
    mux-player#`).concat(Te,`::part(bottom play button) {
      padding-left: `).concat(Je,`;
    }

    mux-player#`).concat(Te,`::part(bottom fullscreen button) {
      padding-right: `).concat(Je,`;
    }

    mux-player#`).concat(Te,`::part(captions listbox) {
      background: rgba(0,0,0,0.5);
      border-radius: 8px;
      margin-right: 16px;
    }
    
    mux-player#`).concat(Te,`::part(captions) {
        display: `).concat(V?"none":"block",`;
    }

    mux-player#`).concat(Te,`::part(range) {
      padding: 0 `).concat(Je,`;
    }

    #`).concat(ae,"-").concat(Te,` {
      height: 100%;
      width: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    #`).concat(ae,"-").concat(Te," .").concat(ke,` {
      width: max(43px, min(10%, 55px));
      height: auto;
      background-color: transparent;
      border: none;
      cursor: pointer;
      position: absolute;
      pointer-events: none;
      padding: 0;
    }

    #`).concat(ae,"-").concat(Te," .").concat(ke,` svg {
      width: 100%;
      height: auto;
      stroke: #666666;
      stroke-width: 0.3;
      text-shadow: 0 0 2px rgb(0 0 0 / 0.25), 0 0 6px rgb(0 0 0 / 0.25);
      paint-order: stroke;
    }

    @container (min-width: `).concat(Xe,`) {
      mux-player#`).concat(Te,` {
        --bottom-play-button: none;
      }
    }
  </style>`)},Ge=function(_e){var Te=_e.id,we=_e.cover,xt=we===void 0?!1:we,Ir=_e.hideCaptionsControl,V=Ir===void 0?!1:Ir,jt=_e.isAudioMode,Br=jt===void 0?!1:jt;return Br?mt(Te):At({id:Te,cover:xt,hideCaptionsControl:V})},De=Me.fullScreenEvents=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],Lt=Me.interactionEvents=["click","touchend","touchstart","keydown"],ut=Me.MuxPlayerAutoplay={UNMUTED:"unmuted",MUTED:"muted"},Q=`
  <svg aria-hidden="true" viewBox="0 0 24 24">
    <path d="m6.73 20.93 14.05-8.54a.46.46 0 0 0 0-.78L6.73 3.07a.48.48 0 0 0-.73.39v17.07a.48.48 0 0 0 .73.4Z" fill="white"></path>
  </svg>
`,_=function(){var _e=document.createElement("button");return _e.dataset.qa="autoplay-play-button",_e.innerHTML=Q,_e.setAttribute("aria-label","Play"),_e.tabIndex=0,_e.role="button",_e.className=ke,_e},pe=function(_e){var Te=document.createElement("div");return Te.id="".concat(ae,"-").concat(_e),Te.className=dt,Te},Ie=Me.default=function(){function ct(_e,Te){var we=this,xt=Te.cover,Ir=Te.audioMode,V=Ir===void 0?!1:Ir,jt=Te.hideCaptionsControl,Br=Te.autoplay,Rt=Te.thumbnailUrl,U=Te.id,Be=Te.onPlay,je=Te.onAutoplayFailed,Jt=Te.onLoadedMetadata,Nt=Te.onEnded,Ut=Te.metadata,Lr=Te.timeUpdateDelay,zr=Te.onTimeUpdate;(0,H.default)(this,ct),(0,de.default)(this,"autoplay",void 0),(0,de.default)(this,"thumbnailUrl",void 0),(0,de.default)(this,"onPlay",void 0),(0,de.default)(this,"onEnded",void 0),(0,de.default)(this,"onAutoplayFailed",void 0),(0,de.default)(this,"onLoadedMetadata",void 0),(0,de.default)(this,"onTimeUpdate",void 0),(0,de.default)(this,"audioMode",void 0),(0,de.default)(this,"throttledTimeUpdate",void 0),(0,de.default)(this,"videoElement",void 0),(0,de.default)(this,"rootElement",void 0),(0,de.default)(this,"isFullScreen",void 0),(0,de.default)(this,"isAutoplay",void 0),(0,de.default)(this,"shouldMuteAutoplay",void 0),(0,de.default)(this,"autoplayPlayButton",null),(0,de.default)(this,"handleTimeUpdate",function(){var Y,te=we.videoElement,me=te.currentTime,it=te.duration;(Y=we.onTimeUpdate)===null||Y===void 0||Y.call(we,{currentTime:me,videoDuration:it})}),(0,de.default)(this,"showBottomControls",function(){we.videoElement.classList.add(st)}),(0,de.default)(this,"onFullScreenChange",function(){we.isFullScreen=!we.isFullScreen;var Y=we.rootElement.innerHTML.includes(Ye.COVER);Y&&(we.isFullScreen?(we.videoElement.removeAttribute(Ye.COVER),we.videoElement.setAttribute("style",Ye.CONTAIN)):(we.videoElement.removeAttribute(Ye.CONTAIN),we.videoElement.setAttribute("style",Ye.COVER)))}),(0,de.default)(this,"defaultAbortController",new AbortController),(0,de.default)(this,"interactionController",new AbortController),(0,de.default)(this,"onAutoplayClick",function(){var Y=(0,Ne.default)(Le.default.mark(function te(me){var it;return Le.default.wrap(function(Oe){for(;;)switch(Oe.prev=Oe.next){case 0:if(we.interactionController.abort(),me.preventDefault(),Oe.prev=2,!we.videoElement.muted){Oe.next=13;break}return we.pause(),we.videoElement.currentTime=0,we.showBottomControls(),Oe.next=9,Promise.resolve(we.play());case 9:we.videoElement.muted=!1,we.videoElement.classList.remove(ht),(it=we.onPlay)===null||it===void 0||it.call(we,!1),we.shouldMuteAutoplay=!1;case 13:we.videoElement.addEventListener("play",function(){var zt;return(zt=we.onPlay)===null||zt===void 0?void 0:zt.call(we,!1)},{signal:we.defaultAbortController.signal}),Oe.next=19;break;case 16:Oe.prev=16,Oe.t0=Oe.catch(2),console.error(Oe.t0);case 19:case"end":return Oe.stop()}},te,null,[[2,16]])}));return function(te){return Y.apply(this,arguments)}}()),(0,de.default)(this,"checkAutoplay",function(){var Y;if(we.videoElement.hasPlayed||!we.videoElement.paused){we.handleOnAutoplay();return}(Y=we.onAutoplayFailed)===null||Y===void 0||Y.call(we),we.videoElement.classList.remove(ht)}),(0,de.default)(this,"showAutoplayPlayButton",function(){var Y,te=we.rootElement.querySelector("#".concat(ae,"-").concat(we.videoElement.id));we.autoplayPlayButton=_();var me=function(kt){["Enter","Space"].includes(kt.code)&&we.onAutoplayClick(kt)};(Y=we.autoplayPlayButton)===null||Y===void 0||Y.addEventListener("keydown",me,{once:!0,signal:we.defaultAbortController.signal}),te.appendChild(we.autoplayPlayButton)}),(0,de.default)(this,"hideAutoplayPlayButton",function(){var Y;(Y=we.autoplayPlayButton)===null||Y===void 0||Y.remove()}),(0,de.default)(this,"handleOnAutoplay",function(){var Y,te=we.interactionController.signal,me=!we.videoElement.muted;me||(we.videoElement.classList.add(ht),we.videoElement.defaultHiddenCaptions=!1),(Y=we.onPlay)===null||Y===void 0||Y.call(we,!0,me),Lt.forEach(function(it){we.videoElement.addEventListener(it,we.onAutoplayClick,{once:!0,signal:te})})}),(0,de.default)(this,"handleOnEnded",function(){if(we.shouldMuteAutoplay)we.reset();else{var Y;(Y=we.onEnded)===null||Y===void 0||Y.call(we)}}),this.isFullScreen=!1,this.isAutoplay=!!Br,this.shouldMuteAutoplay=Br===ut.MUTED,this.thumbnailUrl=Rt,this.onPlay=function(Y,te){var me=Y&&!te;me?we.showAutoplayPlayButton():we.hideAutoplayPlayButton(),Be==null||Be(Y,te)},this.onEnded=Nt,this.onAutoplayFailed=je,this.onLoadedMetadata=Jt,this.onTimeUpdate=zr,this.throttledTimeUpdate=(0,he.throttle)(Lr||1e3,this.handleTimeUpdate),this.audioMode=V,this.rootElement=_e,globalThis!=null&&globalThis.MuxPlayerElement?this.videoElement=new globalThis.MuxPlayerElement:this.videoElement=new Pe.default,this.videoElement.src=U;var Wt=(0,O.getRandomHtmlElementId)();this.videoElement.id=Wt,Rt&&(this.videoElement.poster=Rt),this.videoElement.theme="classic",this.videoElement.primaryColor=V?j:K,this.videoElement.accentColor=ze,this.videoElement.secondaryColor=V?at:ve,this.videoElement.defaultHiddenCaptions=!0,this.videoElement.noTooltips=!0,this.videoElement.audio=V,this.isAutoplay&&(this.videoElement.defaultHiddenCaptions=jt),this.rootElement.innerHTML=Ge({id:Wt,cover:xt,hideCaptionsControl:jt,isAudioMode:V});var qe=pe(Wt);qe.appendChild(this.videoElement),this.rootElement.appendChild(qe),Ut&&(this.videoElement.metadata=Ut),this.addEventListeners(),this.isAutoplay&&this.tryToAutoplay(this.shouldMuteAutoplay)}return(0,Qe.default)(ct,[{key:"pause",value:function(){this.videoElement.autoplay=!1,this.videoElement.pause()}},{key:"play",value:function(){return this.videoElement.play()}},{key:"stop",value:function(){var Te=this.videoElement.src;this.videoElement.removeAttribute("src"),this.videoElement.src=Te,this.videoElement.autoplay=!1}},{key:"reset",value:function(){this.pause(),this.videoElement.currentTime=0,this.thumbnailUrl&&(this.videoElement.poster=this.thumbnailUrl)}},{key:"setMuted",value:function(Te){this.videoElement.muted=Te}},{key:"destroy",value:function(){var _e=(0,Ne.default)(Le.default.mark(function we(){return Le.default.wrap(function(Ir){for(;;)switch(Ir.prev=Ir.next){case 0:this.videoElement.remove(),this.rootElement.innerHTML="",this.defaultAbortController.abort(),this.interactionController.abort();case 4:case"end":return Ir.stop()}},we,this)}));function Te(){return _e.apply(this,arguments)}return Te}()},{key:"tryToAutoplay",value:function(){var _e=(0,Ne.default)(function(){var we=this,xt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return Le.default.mark(function Ir(){return Le.default.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return we.videoElement.autoplay=!1,we.videoElement.muted=xt,jt.prev=2,jt.next=5,we.play().then(function(){we.videoElement.muted=we.shouldMuteAutoplay,we.handleOnAutoplay()});case 5:jt.next=15;break;case 7:if(jt.prev=7,jt.t0=jt.catch(2),xt){jt.next=12;break}return we.tryToAutoplay(!0),jt.abrupt("return");case 12:we.videoElement.autoplay=!0,we.videoElement.muted=we.shouldMuteAutoplay,setTimeout(we.checkAutoplay,Ze);case 15:case"end":return jt.stop()}},Ir,null,[[2,7]])})()});function Te(){return _e.apply(this,arguments)}return Te}()},{key:"addEventListeners",value:function(){var Te=this,we=this.defaultAbortController.signal;De.map(function(xt){Te.videoElement.addEventListener(xt,Te.onFullScreenChange,{signal:we})}),this.onPlay&&!this.isAutoplay&&this.videoElement.addEventListener("play",function(){var xt;return(xt=Te.onPlay)===null||xt===void 0?void 0:xt.call(Te,!1)},{signal:we}),!this.audioMode&&!this.shouldMuteAutoplay&&this.videoElement.addEventListener("play",this.showBottomControls,{once:!0,signal:we}),this.onEnded&&this.videoElement.addEventListener("ended",this.handleOnEnded,{signal:we}),this.onTimeUpdate&&this.videoElement.addEventListener("timeupdate",this.throttledTimeUpdate,{signal:we}),this.onLoadedMetadata&&this.videoElement.addEventListener("loadedmetadata",this.onLoadedMetadata,{signal:we})}}])}()},11304($e,Me,Ee){"use strict";var He=Ee(89249);Object.defineProperty(Me,"__esModule",{value:!0}),Me.getBestFileForDevice=Me.default=void 0;var Le=He(Ee(81987)),Ne=He(Ee(66326)),H=He(Ee(29296)),Qe=He(Ee(38144)),de=He(Ee(3504)),Pe=function(){var ht=window,Je=ht.navigator,ae=Je.connection||Je.mozConnection||Je.webkitConnection;return!ae||!ae.effectiveType?null:ae.effectiveType},he=function(ht){switch(ht){case"slow-2g":case"2g":return[426,240];case"3g":return[960,540];case"4g":default:return[1920,1080]}},O=function(ht,Je){return Math.abs(ht[0]*ht[1]-Je[0]*Je[1])},K=function(ht){return[ht.width,ht.height]},j=Me.getBestFileForDevice=function(ht){var Je=he(Pe()),ae=ht.filter(function(dt){return dt.file_type==="video/mp4"}).filter(function(dt){return dt.width&&dt.height}).sort(function(dt,ke){return O(K(dt),Je)-O(K(ke),Je)});return ae[0]},ve=function(){var st=(0,de.default)(Le.default.mark(function ht(Je,ae){var dt,ke;return Le.default.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:return dt="https://api.pexels.com/videos/videos/".concat(Je),At.next=3,fetch(dt,{headers:new Headers({Authorization:ae,Accept:"application/json"})});case 3:if(ke=At.sent,ke.ok){At.next=6;break}return At.abrupt("return",Promise.reject(ke.status));case 6:return At.abrupt("return",ke.json());case 7:case"end":return At.stop()}},ht)}));return function(Je,ae){return st.apply(this,arguments)}}(),at=new Map,ze=function(){var st=(0,de.default)(Le.default.mark(function ht(Je,ae){var dt;return Le.default.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:if(!at.has(Je)){mt.next=2;break}return mt.abrupt("return",at.get(Je));case 2:return mt.next=4,ve(Je,ae);case 4:return dt=mt.sent,at.set(Je,dt),mt.abrupt("return",dt);case 7:case"end":return mt.stop()}},ht)}));return function(Je,ae){return st.apply(this,arguments)}}(),Et=function(){var st=(0,de.default)(Le.default.mark(function ht(Je,ae){var dt,ke;return Le.default.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:return At.next=2,ze(Je,ae);case 2:return dt=At.sent,ke=j(dt.video_files),At.abrupt("return",{src:ke.link,type:ke.file_type});case 5:case"end":return At.stop()}},ht)}));return function(Je,ae){return st.apply(this,arguments)}}(),Xe=function(){var st=(0,de.default)(Le.default.mark(function ht(Je,ae){var dt;return Le.default.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:return mt.next=2,ze(Je,ae);case 2:return dt=mt.sent,mt.abrupt("return",dt.image);case 4:case"end":return mt.stop()}},ht)}));return function(Je,ae){return st.apply(this,arguments)}}(),Ye=function(){function st(ht,Je){var ae=Je.id,dt=Je.cover,ke=Je.autoplay,mt=Je.pexelsApiKey;(0,Ne.default)(this,st),(0,Qe.default)(this,"id",void 0),(0,Qe.default)(this,"videoElement",void 0),this.id=Math.random(),this.init(ht,ae,dt,ke,mt),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.setCover=this.setCover.bind(this),this.init=this.init.bind(this)}return(0,H.default)(st,[{key:"init",value:function(){var ht=(0,de.default)(Le.default.mark(function ae(dt,ke,mt,At,Ge){var De=this,Lt,ut,Q,_,pe,Ie;return Le.default.wrap(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return _e.prev=0,_e.next=3,Et(ke,Ge);case 3:return Lt=_e.sent,ut=Lt.src,Q=Lt.type,_e.next=8,Xe(ke,Ge);case 8:_=_e.sent,pe=document.createElement("video"),this.videoElement=pe,this.setCover(mt),pe.setAttribute("preload","auto"),pe.setAttribute("loop",""),pe.setAttribute("muted",""),pe.setAttribute("playsinline",""),pe.setAttribute("loop",""),pe.setAttribute("poster",_),dt.innerHTML="",dt.appendChild(pe),Ie=document.createElement("source"),Ie.setAttribute("type",Q),Ie.setAttribute("src",ut),pe.appendChild(Ie),pe.muted=!0,At&&setTimeout(function(){return De.play()},100),_e.next=31;break;case 28:_e.prev=28,_e.t0=_e.catch(0);case 31:case"end":return _e.stop()}},ae,this,[[0,28]])}));function Je(ae,dt,ke,mt,At){return ht.apply(this,arguments)}return Je}()},{key:"setCover",value:function(Je){this.videoElement&&this.videoElement.setAttribute("style",Je?"width: 100%; height: 100%; object-fit: cover;":"")}},{key:"pause",value:function(){this.videoElement&&this.videoElement.pause()}},{key:"play",value:function(){var ht=(0,de.default)(Le.default.mark(function ae(){var dt=this;return Le.default.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:return mt.prev=0,mt.next=3,this.videoElement.play();case 3:mt.next=8;break;case 5:mt.prev=5,mt.t0=mt.catch(0),setTimeout(function(){return dt.play()},200);case 8:case"end":return mt.stop()}},ae,this,[[0,5]])}));function Je(){return ht.apply(this,arguments)}return Je}()}])}(),Ze=Me.default=Ye},40805($e,Me,Ee){"use strict";var He=Ee(89249);Object.defineProperty(Me,"__esModule",{value:!0}),Me.default=Me.Status=Me.MUX_PLAYBACK_TOKEN_TTL=void 0;var Le=He(Ee(81987)),Ne=He(Ee(3504)),H=He(Ee(71184)),Qe=He(Ee(66326)),de=He(Ee(29296)),Pe=He(Ee(38144));Ee(29521);var he=Ee(88481),O=He(Ee(52121)),K=["refetchTimeout"],j=["id","onError","thumbnailTime"];function ve(Ze,st){var ht=Object.keys(Ze);if(Object.getOwnPropertySymbols){var Je=Object.getOwnPropertySymbols(Ze);st&&(Je=Je.filter(function(ae){return Object.getOwnPropertyDescriptor(Ze,ae).enumerable})),ht.push.apply(ht,Je)}return ht}function at(Ze){for(var st=1;st<arguments.length;st++){var ht=arguments[st]!=null?arguments[st]:{};st%2?ve(Object(ht),!0).forEach(function(Je){(0,Pe.default)(Ze,Je,ht[Je])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Ze,Object.getOwnPropertyDescriptors(ht)):ve(Object(ht)).forEach(function(Je){Object.defineProperty(Ze,Je,Object.getOwnPropertyDescriptor(ht,Je))})}return Ze}var ze=Me.MUX_PLAYBACK_TOKEN_TTL=60*15*1e3,Et={uploadPending:"upload_pending",processing:"processing",error:"error",ready:"ready"},Xe=Me.Status={pending:"pending",prepared:"prepared",error:"error"},Ye=Me.default=function(){function Ze(st,ht){(0,Qe.default)(this,Ze),(0,Pe.default)(this,"videoPlayer",void 0),(0,Pe.default)(this,"rootElement",void 0),(0,Pe.default)(this,"status",void 0),(0,Pe.default)(this,"ready",void 0),(0,Pe.default)(this,"refetchTimeout",null),this.status=Xe.pending,this.rootElement=st,this.ready=this.init(ht)}return(0,de.default)(Ze,[{key:"init",value:function(ht){var Je=this,ae=ht.refetchTimeout,dt=ae===void 0?ze:ae,ke=(0,H.default)(ht,K);return this.refetchTimeout=setTimeout((0,Ne.default)(Le.default.mark(function mt(){return Le.default.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:return Ge.next=2,Je.destroy();case 2:Je.init(ht);case 3:case"end":return Ge.stop()}},mt)})),dt),this.initPlayer(ke)}},{key:"initPlayer",value:function(){var st=(0,Ne.default)(Le.default.mark(function Je(ae){var dt,ke,mt,At,Ge,De,Lt,ut,Q,_,pe;return Le.default.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:return dt=ae.id,ke=ae.onError,mt=ae.thumbnailTime,At=(0,H.default)(ae,j),Ge=(0,he.buildMediaServiceUrl)(dt,mt),ct.prev=2,ct.next=5,fetch(Ge);case 5:if(De=ct.sent,De.ok){ct.next=10;break}return this.status=Xe.error,ke==null||ke(new Error("".concat(De==null?void 0:De.status," ").concat(De==null?void 0:De.statusText))),ct.abrupt("return");case 10:return ct.next=12,De.json();case 12:if(Lt=ct.sent,ut=Lt.playback_url,Q=Lt.thumbnail_url,_=Lt.transcode_status,_!==Et.error){ct.next=19;break}return ke==null||ke(new Error("video transcoding failed")),ct.abrupt("return");case 19:if(ut){ct.next=22;break}return ke==null||ke(new Error("missing playback_url")),ct.abrupt("return");case 22:pe=(0,he.getIsAudioUrl)(dt),this.videoPlayer=new O.default(this.rootElement,at({id:ut,thumbnailUrl:Q,audioMode:pe},At)),this.status=Xe.prepared,ct.next=31;break;case 27:ct.prev=27,ct.t0=ct.catch(2),this.status=Xe.error,ke==null||ke(ct.t0);case 31:case"end":return ct.stop()}},Je,this,[[2,27]])}));function ht(Je){return st.apply(this,arguments)}return ht}()},{key:"isReady",value:function(){return this.ready}},{key:"pause",value:function(){this.videoPlayer.pause()}},{key:"play",value:function(){this.videoPlayer.play()}},{key:"stop",value:function(){this.videoPlayer.stop()}},{key:"reset",value:function(){this.videoPlayer.reset()}},{key:"setMuted",value:function(ht){this.videoPlayer.setMuted(ht)}},{key:"destroy",value:function(){var st=(0,Ne.default)(Le.default.mark(function Je(){var ae;return Le.default.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:return this.refetchTimeout&&(clearTimeout(this.refetchTimeout),this.refetchTimeout=null),ke.abrupt("return",(ae=this.videoPlayer)===null||ae===void 0?void 0:ae.destroy());case 2:case"end":return ke.stop()}},Je,this)}));function ht(){return st.apply(this,arguments)}return ht}()}])}()},71177($e,Me,Ee){"use strict";var He=Ee(89249);Object.defineProperty(Me,"__esModule",{value:!0}),Me.default=void 0;var Le=He(Ee(66326)),Ne=He(Ee(29296)),H=He(Ee(38144)),Qe=He(Ee(64624)),de=Me.default=function(){function Pe(he,O){(0,Le.default)(this,Pe),(0,H.default)(this,"player",void 0);var K=O==null?void 0:O.id;if(he.nodeName!=="IFRAME"&&K){var j=he.querySelector("iframe");j||(j=this.embedVideo(he));var ve="".concat(K).concat(K.includes("?")?"&":"?","embed_type=typeform&autoplay=false");j.setAttribute("allow","camera *; microphone *; autoplay *; encrypted-media *; fullscreen *; display-capture *;"),j.setAttribute("style","border: none"),j.setAttribute("title","Player"),j.setAttribute("src",ve),this.player=new Qe.default.Player(j)}}return(0,Ne.default)(Pe,[{key:"embedVideo",value:function(O){var K=document.createElement("iframe");return O.appendChild(K),K}},{key:"pause",value:function(){this.player.pause()}},{key:"play",value:function(){this.player.play()}}])}()},45397($e,Me,Ee){"use strict";var He=Ee(89249);Object.defineProperty(Me,"__esModule",{value:!0}),Me.default=at;var Le=He(Ee(38144)),Ne=He(Ee(54656)),H=He(Ee(96554)),Qe=He(Ee(71177)),de=He(Ee(11304)),Pe=Ee(88431),he=Ee(88481),O=He(Ee(40805)),K=He(Ee(52121)),j=function(Et){return(0,he.isVimeoVideo)(Et.id)?{url:Et.id}:{id:parseInt(Et.id)}},ve=(0,Le.default)((0,Le.default)((0,Le.default)((0,Le.default)((0,Le.default)((0,Le.default)({},Pe.YOUTUBE_PROVIDER,function(ze,Et){var Xe=(0,H.default)(ze,{videoId:Et.id,playerVars:{autoplay:0,disablekb:1,modestbranding:1,origin:window.location.origin,rel:0,loop:1}}),Ye=new Promise(function(Ze,st){Xe.on("ready",Ze),Xe.on("error",st)});return{loadVideo:function(st){var ht=st.id;return Xe.loadVideoById(ht)},pause:function(){return Xe.pauseVideo()},play:function(){return Xe.playVideo()},onLoad:function(){return Ye},destroy:Xe.destroy}}),Pe.VIMEO_PROVIDER,function(ze,Et){var Xe=j(Et),Ye=new Ne.default(ze,Xe);return{loadVideo:function(st){Ye.destroy(),Ye=new Ne.default(ze,j(st))},pause:function(){return Ye.pause()},play:function(){return Ye.play()},onLoad:function(){return Ye.ready()},destroy:function(){return Ye.destroy()}}}),Pe.TYPEFORM_PROVIDER,function(ze,Et){var Xe=new O.default(ze,Et);return{pause:function(){return Xe.pause()},play:function(){return Xe.play()},stop:function(){return Xe.stop()},destroy:function(){return Xe.destroy()},loadVideo:function(Ze){Xe=new O.default(ze,Ze)},reset:function(){return Xe.reset()},setMuted:function(Ze){return Xe.setMuted(Ze)}}}),Pe.MUX_PROVIDER,function(ze,Et){var Xe=new K.default(ze,Et);return{pause:function(){return Xe.pause()},play:function(){return Xe.play()},stop:function(){return Xe.stop()},destroy:function(){return Xe.destroy()},loadVideo:function(Ze){Xe=new K.default(ze,Ze)}}}),Pe.VIDEOASK_PROVIDER,function(ze,Et){var Xe=new Qe.default(ze,{id:Et.id});return{loadVideo:function(Ze){var st=Ze.id;Xe=new Qe.default(ze,{id:st})},pause:function(){return Xe.pause()},play:function(){return Xe.play()}}}),Pe.PEXELS_PROVIDER,function(ze,Et){var Xe=new de.default(ze,Et);return{loadVideo:function(Ze){Xe=new de.default(ze,Ze)},setCover:Xe.setCover,pause:Xe.pause,play:Xe.play}});function at(ze,Et,Xe){if(!ze||!ve[Et])return null;var Ye=ve[Et];return Ye(ze,Xe)}},54656($e,Me,Ee){"use strict";Ee.r(Me),Ee.d(Me,{default:()=>Wt});var He=Object.defineProperty,Le=Object.getOwnPropertySymbols,Ne=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,Qe=(qe,Y,te)=>Y in qe?He(qe,Y,{enumerable:!0,configurable:!0,writable:!0,value:te}):qe[Y]=te,de=(qe,Y)=>{for(var te in Y||(Y={}))Ne.call(Y,te)&&Qe(qe,te,Y[te]);if(Le)for(var te of Le(Y))H.call(Y,te)&&Qe(qe,te,Y[te]);return qe},Pe=(qe,Y,te)=>Qe(qe,typeof Y!="symbol"?Y+"":Y,te),he=(qe,Y,te)=>new Promise((me,it)=>{var kt=Pt=>{try{zt(te.next(Pt))}catch(Zt){it(Zt)}},Oe=Pt=>{try{zt(te.throw(Pt))}catch(Zt){it(Zt)}},zt=Pt=>Pt.done?me(Pt.value):Promise.resolve(Pt.value).then(kt,Oe);zt((te=te.apply(qe,Y)).next())});/*! @vimeo/player v2.30.3 | (c) 2026 Vimeo | MIT License | https://github.com/vimeo/player.js */const O=typeof Ee.g!="undefined"&&{}.toString.call(Ee.g)==="[object global]",K=typeof Bun!="undefined",j=typeof Deno!="undefined",ve=typeof WebSocketPair=="function"&&typeof(caches==null?void 0:caches.default)!="undefined",at=O||K||j||ve;function ze(qe,Y){return qe.indexOf(Y.toLowerCase())===0?qe:`${Y.toLowerCase()}${qe.substr(0,1).toUpperCase()}${qe.substr(1)}`}function Et(qe){return!!(qe&&qe.nodeType===1&&"nodeName"in qe&&qe.ownerDocument&&qe.ownerDocument.defaultView)}function Xe(qe){return!isNaN(parseFloat(qe))&&isFinite(qe)&&Math.floor(qe)==qe}function Ye(qe){return/^(https?:)?\/\/((((player|www)\.)?vimeo\.com)|((player\.)?[a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))(?=$|\/)/.test(qe)}function Ze(qe){return/^https:\/\/player\.((vimeo\.com)|([a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))\/video\/\d+/.test(qe)}function st(qe){const Y=(qe||"").match(/^(?:https?:)?(?:\/\/)?([^/?]+)/),te=(Y&&Y[1]||"").replace("player.",""),me=[".videoji.hk",".vimeo.work",".videoji.cn"];for(const it of me)if(te.endsWith(it))return te;return"vimeo.com"}function ht(){let qe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const Y=qe.id,te=qe.url,me=Y||te;if(!me)throw new Error("An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.");if(Xe(me))return`https://vimeo.com/${me}`;if(Ye(me))return me.replace("http:","https:");throw Y?new TypeError(`\u201C${Y}\u201D is not a valid video id.`):new TypeError(`\u201C${me}\u201D is not a vimeo.com url.`)}const Je=function(qe,Y,te){let me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"addEventListener",it=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"removeEventListener";const kt=typeof Y=="string"?[Y]:Y;return kt.forEach(Oe=>{qe[me](Oe,te)}),{cancel:()=>kt.forEach(Oe=>qe[it](Oe,te))}};function ae(qe){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document;if(!qe||!Y||typeof Y.querySelectorAll!="function")return null;const te=Y.querySelectorAll("iframe");for(let me=0;me<te.length;me++)if(te[me]&&te[me].contentWindow===qe)return te[me];return null}const dt=typeof Array.prototype.indexOf!="undefined",ke=typeof window!="undefined"&&typeof window.postMessage!="undefined";if(!at&&(!dt||!ke))throw new Error("Sorry, the Vimeo Player API is not available in this browser.");var mt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof Ee.g!="undefined"?Ee.g:typeof self!="undefined"?self:{};function At(qe,Y){return Y={exports:{}},qe(Y,Y.exports),Y.exports}/*!
 * weakmap-polyfill v2.0.4 - ECMAScript6 WeakMap polyfill
 * https://github.com/polygonplanet/weakmap-polyfill
 * Copyright (c) 2015-2021 polygonplanet <polygon.planet.aqua@gmail.com>
 * @license MIT
 */(function(qe){if(qe.WeakMap)return;var Y=Object.prototype.hasOwnProperty,te=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{value:1}).x===1}catch(kt){}}(),me=function(kt,Oe,zt){te?Object.defineProperty(kt,Oe,{configurable:!0,writable:!0,value:zt}):kt[Oe]=zt};qe.WeakMap=function(){function kt(){if(this===void 0)throw new TypeError("Constructor WeakMap requires 'new'");if(me(this,"_id",zt("_WeakMap")),arguments.length>0)throw new TypeError("WeakMap iterable is not supported")}me(kt.prototype,"delete",function(Zt){if(Oe(this,"delete"),!it(Zt))return!1;var Wr=Zt[this._id];return Wr&&Wr[0]===Zt?(delete Zt[this._id],!0):!1}),me(kt.prototype,"get",function(Zt){if(Oe(this,"get"),!!it(Zt)){var Wr=Zt[this._id];if(Wr&&Wr[0]===Zt)return Wr[1]}}),me(kt.prototype,"has",function(Zt){if(Oe(this,"has"),!it(Zt))return!1;var Wr=Zt[this._id];return!!(Wr&&Wr[0]===Zt)}),me(kt.prototype,"set",function(Zt,Wr){if(Oe(this,"set"),!it(Zt))throw new TypeError("Invalid value used as weak map key");var ft=Zt[this._id];return ft&&ft[0]===Zt?(ft[1]=Wr,this):(me(Zt,this._id,[Zt,Wr]),this)});function Oe(Zt,Wr){if(!it(Zt)||!Y.call(Zt,"_id"))throw new TypeError(Wr+" method called on incompatible receiver "+typeof Zt)}function zt(Zt){return Zt+"_"+Pt()+"."+Pt()}function Pt(){return Math.random().toString().substring(2)}return me(kt,"_polyfill",!0),kt}();function it(kt){return Object(kt)===kt}})(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:mt);var Ge=At(function(qe){/*! Native Promise Only
    v0.8.1 (c) Kyle Simpson
    MIT License: http://getify.mit-license.org
*/(function(te,me,it){me[te]=me[te]||it(),qe.exports&&(qe.exports=me[te])})("Promise",mt,function(){var te,me,it,kt=Object.prototype.toString,Oe=typeof setImmediate!="undefined"?function(fe){return setImmediate(fe)}:setTimeout;try{Object.defineProperty({},"x",{}),te=function(fe,ye,oe,yt){return Object.defineProperty(fe,ye,{value:oe,writable:!0,configurable:yt!==!1})}}catch(br){te=function(ye,oe,yt){return ye[oe]=yt,ye}}it=function(){var fe,ye,oe;function yt(qt,yr){this.fn=qt,this.self=yr,this.next=void 0}return{add:function(yr,Rr){oe=new yt(yr,Rr),ye?ye.next=oe:fe=oe,ye=oe,oe=void 0},drain:function(){var yr=fe;for(fe=ye=me=void 0;yr;)yr.fn.call(yr.self),yr=yr.next}}}();function zt(br,fe){it.add(br,fe),me||(me=Oe(it.drain))}function Pt(br){var fe,ye=typeof br;return br!=null&&(ye=="object"||ye=="function")&&(fe=br.then),typeof fe=="function"?fe:!1}function Zt(){for(var br=0;br<this.chain.length;br++)Wr(this,this.state===1?this.chain[br].success:this.chain[br].failure,this.chain[br]);this.chain.length=0}function Wr(br,fe,ye){var oe,yt;try{fe===!1?ye.reject(br.msg):(fe===!0?oe=br.msg:oe=fe.call(void 0,br.msg),oe===ye.promise?ye.reject(TypeError("Promise-chain cycle")):(yt=Pt(oe))?yt.call(oe,ye.resolve,ye.reject):ye.resolve(oe))}catch(qt){ye.reject(qt)}}function ft(br){var fe,ye=this;if(!ye.triggered){ye.triggered=!0,ye.def&&(ye=ye.def);try{(fe=Pt(br))?zt(function(){var oe=new ln(ye);try{fe.call(br,function(){ft.apply(oe,arguments)},function(){Qr.apply(oe,arguments)})}catch(yt){Qr.call(oe,yt)}}):(ye.msg=br,ye.state=1,ye.chain.length>0&&zt(Zt,ye))}catch(oe){Qr.call(new ln(ye),oe)}}}function Qr(br){var fe=this;fe.triggered||(fe.triggered=!0,fe.def&&(fe=fe.def),fe.msg=br,fe.state=2,fe.chain.length>0&&zt(Zt,fe))}function li(br,fe,ye,oe){for(var yt=0;yt<fe.length;yt++)(function(yr){br.resolve(fe[yr]).then(function(Qt){ye(yr,Qt)},oe)})(yt)}function ln(br){this.def=br,this.triggered=!1}function Ar(br){this.promise=br,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function Yi(br){if(typeof br!="function")throw TypeError("Not a function");if(this.__NPO__!==0)throw TypeError("Not a promise");this.__NPO__=1;var fe=new Ar(this);this.then=function(oe,yt){var qt={success:typeof oe=="function"?oe:!0,failure:typeof yt=="function"?yt:!1};return qt.promise=new this.constructor(function(Rr,Qt){if(typeof Rr!="function"||typeof Qt!="function")throw TypeError("Not a function");qt.resolve=Rr,qt.reject=Qt}),fe.chain.push(qt),fe.state!==0&&zt(Zt,fe),qt.promise},this.catch=function(oe){return this.then(void 0,oe)};try{br.call(void 0,function(oe){ft.call(fe,oe)},function(oe){Qr.call(fe,oe)})}catch(ye){Qr.call(fe,ye)}}var _i=te({},"constructor",Yi,!1);return Yi.prototype=_i,te(_i,"__NPO__",0,!1),te(Yi,"resolve",function(fe){var ye=this;return fe&&typeof fe=="object"&&fe.__NPO__===1?fe:new ye(function(yt,qt){if(typeof yt!="function"||typeof qt!="function")throw TypeError("Not a function");yt(fe)})}),te(Yi,"reject",function(fe){return new this(function(oe,yt){if(typeof oe!="function"||typeof yt!="function")throw TypeError("Not a function");yt(fe)})}),te(Yi,"all",function(fe){var ye=this;return kt.call(fe)!="[object Array]"?ye.reject(TypeError("Not an array")):fe.length===0?ye.resolve([]):new ye(function(yt,qt){if(typeof yt!="function"||typeof qt!="function")throw TypeError("Not a function");var yr=fe.length,Rr=Array(yr),Qt=0;li(ye,fe,function(Ci,Ft){Rr[Ci]=Ft,++Qt===yr&&yt(Rr)},qt)})}),te(Yi,"race",function(fe){var ye=this;return kt.call(fe)!="[object Array]"?ye.reject(TypeError("Not an array")):new ye(function(yt,qt){if(typeof yt!="function"||typeof qt!="function")throw TypeError("Not a function");li(ye,fe,function(Rr,Qt){yt(Qt)},qt)})}),Yi})});const De=new WeakMap;function Lt(qe,Y,te){const me=De.get(qe.element)||{};Y in me||(me[Y]=[]),me[Y].push(te),De.set(qe.element,me)}function ut(qe,Y){return(De.get(qe.element)||{})[Y]||[]}function Q(qe,Y,te){const me=De.get(qe.element)||{};if(!me[Y])return!0;if(!te)return me[Y]=[],De.set(qe.element,me),!0;const it=me[Y].indexOf(te);return it!==-1&&me[Y].splice(it,1),De.set(qe.element,me),me[Y]&&me[Y].length===0}function _(qe,Y){const te=ut(qe,Y);if(te.length<1)return!1;const me=te.shift();return Q(qe,Y,me),me}function pe(qe,Y){const te=De.get(qe);De.set(Y,te),De.delete(qe)}function Ie(qe){if(typeof qe=="string")try{qe=JSON.parse(qe)}catch(Y){return console.warn(Y),{}}return qe}function ct(qe,Y,te){if(!qe.element.contentWindow||!qe.element.contentWindow.postMessage)return;let me={method:Y};te!==void 0&&(me.value=te);const it=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,"$1"));it>=8&&it<10&&(me=JSON.stringify(me)),qe.element.contentWindow.postMessage(me,qe.origin)}function _e(qe,Y){Y=Ie(Y);let te=[],me;if(Y.event)Y.event==="error"&&ut(qe,Y.data.method).forEach(kt=>{const Oe=new Error(Y.data.message);Oe.name=Y.data.name,kt.reject(Oe),Q(qe,Y.data.method,kt)}),te=ut(qe,`event:${Y.event}`),me=Y.data;else if(Y.method){const it=_(qe,Y.method);it&&(te.push(it),me=Y.value)}te.forEach(it=>{try{if(typeof it=="function"){it.call(qe,me);return}it.resolve(me)}catch(kt){}})}const Te=["airplay","audio_tracks","audiotrack","autopause","autoplay","background","byline","cc","chapter_id","chapters","chromecast","color","colors","controls","dnt","end_time","fullscreen","height","id","initial_quality","interactive_params","keyboard","loop","maxheight","max_quality","maxwidth","min_quality","muted","play_button_position","playsinline","portrait","preload","progress_bar","quality","quality_selector","responsive","skipping_forward","speed","start_time","texttrack","thumbnail_id","title","transcript","transparent","unmute_button","url","vimeo_logo","volume","watch_full_video","width"];function we(qe){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Te.reduce((te,me)=>{const it=qe.getAttribute(`data-vimeo-${me}`);return(it||it==="")&&(te[me]=it===""?1:it),te},Y)}function xt(qe,Y){let{html:te}=qe;if(!Y)throw new TypeError("An element must be provided");if(Y.getAttribute("data-vimeo-initialized")!==null)return Y.querySelector("iframe");const me=document.createElement("div");return me.innerHTML=te,Y.appendChild(me.firstChild),Y.setAttribute("data-vimeo-initialized","true"),Y.querySelector("iframe")}function Ir(qe){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},te=arguments.length>2?arguments[2]:void 0;return new Promise((me,it)=>{if(!Ye(qe))throw new TypeError(`\u201C${qe}\u201D is not a vimeo.com url.`);let Oe=`https://${st(qe)}/api/oembed.json?url=${encodeURIComponent(qe)}`;for(const Pt in Y)Y.hasOwnProperty(Pt)&&(Oe+=`&${Pt}=${encodeURIComponent(Y[Pt])}`);const zt="XDomainRequest"in window?new XDomainRequest:new XMLHttpRequest;zt.open("GET",Oe,!0),zt.onload=function(){if(zt.status===404){it(new Error(`\u201C${qe}\u201D was not found.`));return}if(zt.status===403){it(new Error(`\u201C${qe}\u201D is not embeddable.`));return}try{const Pt=JSON.parse(zt.responseText);if(Pt.domain_status_code===403){xt(Pt,te),it(new Error(`\u201C${qe}\u201D is not embeddable.`));return}me(Pt)}catch(Pt){it(Pt)}},zt.onerror=function(){const Pt=zt.status?` (${zt.status})`:"";it(new Error(`There was an error fetching the embed code from Vimeo${Pt}.`))},zt.send()})}function V(){let qe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;const Y=[].slice.call(qe.querySelectorAll("[data-vimeo-id], [data-vimeo-url]")),te=me=>{"console"in window&&console.error&&console.error(`There was an error creating an embed: ${me}`)};Y.forEach(me=>{try{if(me.getAttribute("data-vimeo-defer")!==null)return;const it=we(me),kt=ht(it);Ir(kt,it,me).then(Oe=>xt(Oe,me)).catch(te)}catch(it){te(it)}})}function jt(){let qe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;if(window.VimeoPlayerResizeEmbeds_)return;window.VimeoPlayerResizeEmbeds_=!0;const Y=te=>{if(!Ye(te.origin)||!te.data||te.data.event!=="spacechange")return;const me=te.source?ae(te.source,qe):null;if(me){const it=me.parentElement;it.style.paddingBottom=`${te.data.data[0].bottom}px`}};window.addEventListener("message",Y)}function Br(){let qe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;if(window.VimeoSeoMetadataAppended)return;window.VimeoSeoMetadataAppended=!0;const Y=te=>{if(!Ye(te.origin))return;const me=Ie(te.data);if(!me||me.event!=="ready")return;const it=te.source?ae(te.source,qe):null;it&&Ze(it.src)&&new zr(it).callMethod("appendVideoMetadata",window.location.href)};window.addEventListener("message",Y)}function Rt(){let qe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;if(window.VimeoCheckedUrlTimeParam)return;window.VimeoCheckedUrlTimeParam=!0;const Y=me=>{"console"in window&&console.error&&console.error(`There was an error getting video Id: ${me}`)},te=me=>{if(!Ye(me.origin))return;const it=Ie(me.data);if(!it||it.event!=="ready")return;const kt=me.source?ae(me.source,qe):null;if(kt&&Ze(kt.src)){const Oe=new zr(kt);Oe.getVideoId().then(zt=>{const Pt=new RegExp(`[?&]vimeo_t_${zt}=([^&#]*)`).exec(window.location.href);if(Pt&&Pt[1]){const Zt=decodeURI(Pt[1]);Oe.setCurrentTime(Zt)}}).catch(Y)}};window.addEventListener("message",te)}function U(){if(window.VimeoDRMEmbedsUpdated)return;window.VimeoDRMEmbedsUpdated=!0;const qe=Y=>{if(!Ye(Y.origin))return;const te=Ie(Y.data);if(!te||te.event!=="drminitfailed")return;const me=Y.source?ae(Y.source):null;if(!me)return;const it=me.getAttribute("allow")||"";if(!it.includes("encrypted-media")){me.setAttribute("allow",`${it}; encrypted-media`);const Oe=new URL(me.getAttribute("src"));Oe.searchParams.set("forcereload","drm"),me.setAttribute("src",Oe.toString());return}};window.addEventListener("message",qe)}function Be(){const qe=function(){let me;const it=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]];let kt=0;const Oe=it.length,zt={};for(;kt<Oe;kt++)if(me=it[kt],me&&me[1]in document){for(kt=0;kt<me.length;kt++)zt[it[0][kt]]=me[kt];return zt}return!1}(),Y={fullscreenchange:qe.fullscreenchange,fullscreenerror:qe.fullscreenerror},te={request(me){return new Promise((it,kt)=>{const Oe=function(){te.off("fullscreenchange",Oe),it()};te.on("fullscreenchange",Oe),me=me||document.documentElement;const zt=me[qe.requestFullscreen]();zt instanceof Promise&&zt.then(Oe).catch(kt)})},exit(){return new Promise((me,it)=>{if(!te.isFullscreen){me();return}const kt=function(){te.off("fullscreenchange",kt),me()};te.on("fullscreenchange",kt);const Oe=document[qe.exitFullscreen]();Oe instanceof Promise&&Oe.then(kt).catch(it)})},on(me,it){const kt=Y[me];kt&&document.addEventListener(kt,it)},off(me,it){const kt=Y[me];kt&&document.removeEventListener(kt,it)}};return Object.defineProperties(te,{isFullscreen:{get(){return!!document[qe.fullscreenElement]}},element:{enumerable:!0,get(){return document[qe.fullscreenElement]}},isEnabled:{enumerable:!0,get(){return!!document[qe.fullscreenEnabled]}}}),te}const je={role:"viewer",autoPlayMuted:!0,allowedDrift:.3,maxAllowedDrift:1,minCheckInterval:.1,maxRateAdjustment:.2,maxTimeToCatchUp:1};class Jt extends EventTarget{constructor(Y,te){let me=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},it=arguments.length>3?arguments[3]:void 0;super(),Pe(this,"logger"),Pe(this,"speedAdjustment",0),Pe(this,"adjustSpeed",(kt,Oe)=>he(this,null,function*(){if(this.speedAdjustment===Oe)return;const zt=(yield kt.getPlaybackRate())-this.speedAdjustment+Oe;this.log(`New playbackRate:  ${zt}`),yield kt.setPlaybackRate(zt),this.speedAdjustment=Oe})),this.logger=it,this.init(te,Y,de(de({},je),me))}disconnect(){this.dispatchEvent(new Event("disconnect"))}init(Y,te,me){return he(this,null,function*(){if(yield this.waitForTOReadyState(Y,"open"),me.role==="viewer"){yield this.updatePlayer(Y,te,me);const it=Je(Y,"change",()=>this.updatePlayer(Y,te,me)),kt=this.maintainPlaybackPosition(Y,te,me);this.addEventListener("disconnect",()=>{kt.cancel(),it.cancel()})}else{yield this.updateTimingObject(Y,te);const it=Je(te,["seeked","play","pause","ratechange"],()=>this.updateTimingObject(Y,te),"on","off");this.addEventListener("disconnect",()=>it.cancel())}})}updateTimingObject(Y,te){return he(this,null,function*(){const[me,it,kt]=yield Promise.all([te.getCurrentTime(),te.getPaused(),te.getPlaybackRate()]);Y.update({position:me,velocity:it?0:kt})})}updatePlayer(Y,te,me){return he(this,null,function*(){const{position:it,velocity:kt}=Y.query();typeof it=="number"&&te.setCurrentTime(it),typeof kt=="number"&&(kt===0?(yield te.getPaused())===!1&&te.pause():kt>0&&((yield te.getPaused())===!0&&(yield te.play().catch(Oe=>he(this,null,function*(){Oe.name==="NotAllowedError"&&me.autoPlayMuted&&(yield te.setMuted(!0),yield te.play().catch(zt=>console.error("Couldn't play the video from TimingSrcConnector. Error:",zt)))})),this.updatePlayer(Y,te,me)),(yield te.getPlaybackRate())!==kt&&te.setPlaybackRate(kt)))})}maintainPlaybackPosition(Y,te,me){const{allowedDrift:it,maxAllowedDrift:kt,minCheckInterval:Oe,maxRateAdjustment:zt,maxTimeToCatchUp:Pt}=me,Zt=Math.min(Pt,Math.max(Oe,kt))*1e3,Wr=()=>he(this,null,function*(){if(Y.query().velocity===0||(yield te.getPaused())===!0)return;const Qr=Y.query().position-(yield te.getCurrentTime()),li=Math.abs(Qr);if(this.log(`Drift: ${Qr}`),li>kt)yield this.adjustSpeed(te,0),te.setCurrentTime(Y.query().position),this.log("Resync by currentTime");else if(li>it){const ln=li/Pt,Ar=zt,Yi=ln<Ar?(Ar-ln)/2:Ar;yield this.adjustSpeed(te,Yi*Math.sign(Qr)),this.log("Resync by playbackRate")}}),ft=setInterval(()=>Wr(),Zt);return{cancel:()=>clearInterval(ft)}}log(Y){var te;(te=this.logger)==null||te.call(this,`TimingSrcConnector: ${Y}`)}waitForTOReadyState(Y,te){return new Promise(me=>{const it=()=>{Y.readyState===te?me():Y.addEventListener("readystatechange",it,{once:!0})};it()})}}const Nt=new WeakMap,Ut=new WeakMap;let Lr={};class zr{constructor(Y){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(window.jQuery&&Y instanceof jQuery&&(Y.length>1&&window.console&&console.warn&&console.warn("A jQuery object with multiple elements was passed, using the first element."),Y=Y[0]),typeof document!="undefined"&&typeof Y=="string"&&(Y=document.getElementById(Y)),!Et(Y))throw new TypeError("You must pass either a valid element or a valid id.");if(Y.nodeName!=="IFRAME"){const it=Y.querySelector("iframe");it&&(Y=it)}if(Y.nodeName==="IFRAME"&&!Ye(Y.getAttribute("src")||""))throw new Error("The player element passed isn\u2019t a Vimeo embed.");if(Nt.has(Y))return Nt.get(Y);this._window=Y.ownerDocument.defaultView,this.element=Y,this.origin="*";const me=new Ge((it,kt)=>{if(this._onMessage=Oe=>{if(!Ye(Oe.origin)||this.element.contentWindow!==Oe.source)return;this.origin==="*"&&(this.origin=Oe.origin);const zt=Ie(Oe.data);if(zt&&zt.event==="error"&&zt.data&&zt.data.method==="ready"){const Qr=new Error(zt.data.message);Qr.name=zt.data.name,kt(Qr);return}const Wr=zt&&zt.event==="ready",ft=zt&&zt.method==="ping";if(Wr||ft){this.element.setAttribute("data-ready","true"),it();return}_e(this,zt)},this._window.addEventListener("message",this._onMessage),this.element.nodeName!=="IFRAME"){const Oe=we(Y,te),zt=ht(Oe);Ir(zt,Oe,Y).then(Pt=>{const Zt=xt(Pt,Y);return this.element=Zt,this._originalElement=Y,pe(Y,Zt),Nt.set(this.element,this),Pt}).catch(kt)}});if(Ut.set(this,me),Nt.set(this.element,this),this.element.nodeName==="IFRAME"&&ct(this,"ping"),Lr.isEnabled){const it=()=>Lr.exit();this.fullscreenchangeHandler=()=>{Lr.isFullscreen?Lt(this,"event:exitFullscreen",it):Q(this,"event:exitFullscreen",it),this.ready().then(()=>{ct(this,"fullscreenchange",Lr.isFullscreen)})},Lr.on("fullscreenchange",this.fullscreenchangeHandler)}return this}static isVimeoUrl(Y){return Ye(Y)}callMethod(Y){for(var te=arguments.length,me=new Array(te>1?te-1:0),it=1;it<te;it++)me[it-1]=arguments[it];if(Y==null)throw new TypeError("You must pass a method name.");return new Ge((kt,Oe)=>this.ready().then(()=>{Lt(this,Y,{resolve:kt,reject:Oe}),me.length===0?me={}:me.length===1&&(me=me[0]),ct(this,Y,me)}).catch(Oe))}get(Y){return new Ge((te,me)=>(Y=ze(Y,"get"),this.ready().then(()=>{Lt(this,Y,{resolve:te,reject:me}),ct(this,Y)}).catch(me)))}set(Y,te){return new Ge((me,it)=>{if(Y=ze(Y,"set"),te==null)throw new TypeError("There must be a value to set.");return this.ready().then(()=>{Lt(this,Y,{resolve:me,reject:it}),ct(this,Y,te)}).catch(it)})}on(Y,te){if(!Y)throw new TypeError("You must pass an event name.");if(!te)throw new TypeError("You must pass a callback function.");if(typeof te!="function")throw new TypeError("The callback must be a function.");ut(this,`event:${Y}`).length===0&&this.callMethod("addEventListener",Y).catch(()=>{}),Lt(this,`event:${Y}`,te)}off(Y,te){if(!Y)throw new TypeError("You must pass an event name.");if(te&&typeof te!="function")throw new TypeError("The callback must be a function.");Q(this,`event:${Y}`,te)&&this.callMethod("removeEventListener",Y).catch(it=>{})}loadVideo(Y){return this.callMethod("loadVideo",Y)}ready(){const Y=Ut.get(this)||new Ge((te,me)=>{me(new Error("Unknown player. Probably unloaded."))});return Ge.resolve(Y)}addCuePoint(Y){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.callMethod("addCuePoint",{time:Y,data:te})}removeCuePoint(Y){return this.callMethod("removeCuePoint",Y)}enableTextTrack(Y){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,me=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!Y)throw new TypeError("You must pass a language.");return this.callMethod("enableTextTrack",{language:Y,kind:te,showing:me})}disableTextTrack(){return this.callMethod("disableTextTrack")}selectAudioTrack(Y,te){if(!Y)throw new TypeError("You must pass a language.");return this.callMethod("selectAudioTrack",{language:Y,kind:te})}selectDefaultAudioTrack(){return this.callMethod("selectDefaultAudioTrack")}pause(){return this.callMethod("pause")}play(){return this.callMethod("play")}requestFullscreen(){return Lr.isEnabled?Lr.request(this.element):this.callMethod("requestFullscreen")}exitFullscreen(){return Lr.isEnabled?Lr.exit():this.callMethod("exitFullscreen")}getFullscreen(){return Lr.isEnabled?Ge.resolve(Lr.isFullscreen):this.get("fullscreen")}requestPictureInPicture(){return this.callMethod("requestPictureInPicture")}exitPictureInPicture(){return this.callMethod("exitPictureInPicture")}getPictureInPicture(){return this.get("pictureInPicture")}remotePlaybackPrompt(){return this.callMethod("remotePlaybackPrompt")}unload(){return this.callMethod("unload")}destroy(){return new Ge(Y=>{if(Ut.delete(this),Nt.delete(this.element),this._originalElement&&(Nt.delete(this._originalElement),this._originalElement.removeAttribute("data-vimeo-initialized")),this.element&&this.element.nodeName==="IFRAME"&&this.element.parentNode&&(this.element.parentNode.parentNode&&this._originalElement&&this._originalElement!==this.element.parentNode?this.element.parentNode.parentNode.removeChild(this.element.parentNode):this.element.parentNode.removeChild(this.element)),this.element&&this.element.nodeName==="DIV"&&this.element.parentNode){this.element.removeAttribute("data-vimeo-initialized");const te=this.element.querySelector("iframe");te&&te.parentNode&&(te.parentNode.parentNode&&this._originalElement&&this._originalElement!==te.parentNode?te.parentNode.parentNode.removeChild(te.parentNode):te.parentNode.removeChild(te))}this._window.removeEventListener("message",this._onMessage),Lr.isEnabled&&Lr.off("fullscreenchange",this.fullscreenchangeHandler),Y()})}getAutopause(){return this.get("autopause")}setAutopause(Y){return this.set("autopause",Y)}getBuffered(){return this.get("buffered")}getCameraProps(){return this.get("cameraProps")}setCameraProps(Y){return this.set("cameraProps",Y)}getChapters(){return this.get("chapters")}getCurrentChapter(){return this.get("currentChapter")}getColor(){return this.get("color")}getColors(){return Ge.all([this.get("colorOne"),this.get("colorTwo"),this.get("colorThree"),this.get("colorFour")])}setColor(Y){return this.set("color",Y)}setColors(Y){if(!Array.isArray(Y))return new Ge((it,kt)=>kt(new TypeError("Argument must be an array.")));const te=new Ge(it=>it(null)),me=[Y[0]?this.set("colorOne",Y[0]):te,Y[1]?this.set("colorTwo",Y[1]):te,Y[2]?this.set("colorThree",Y[2]):te,Y[3]?this.set("colorFour",Y[3]):te];return Ge.all(me)}getCuePoints(){return this.get("cuePoints")}getCurrentTime(){return this.get("currentTime")}setCurrentTime(Y){return this.set("currentTime",Y)}getDuration(){return this.get("duration")}getEnded(){return this.get("ended")}getLoop(){return this.get("loop")}setLoop(Y){return this.set("loop",Y)}setMuted(Y){return this.set("muted",Y)}getMuted(){return this.get("muted")}getPaused(){return this.get("paused")}getPlaybackRate(){return this.get("playbackRate")}setPlaybackRate(Y){return this.set("playbackRate",Y)}getPlayed(){return this.get("played")}getQualities(){return this.get("qualities")}getQuality(){return this.get("quality")}setQuality(Y){return this.set("quality",Y)}getRemotePlaybackAvailability(){return this.get("remotePlaybackAvailability")}getRemotePlaybackState(){return this.get("remotePlaybackState")}getSeekable(){return this.get("seekable")}getSeeking(){return this.get("seeking")}getTextTracks(){return this.get("textTracks")}getAudioTracks(){return this.get("audioTracks")}getEnabledAudioTrack(){return this.get("enabledAudioTrack")}getDefaultAudioTrack(){return this.get("defaultAudioTrack")}getVideoEmbedCode(){return this.get("videoEmbedCode")}getVideoId(){return this.get("videoId")}getVideoTitle(){return this.get("videoTitle")}getVideoWidth(){return this.get("videoWidth")}getVideoHeight(){return this.get("videoHeight")}getVideoUrl(){return this.get("videoUrl")}getVolume(){return this.get("volume")}setVolume(Y){return this.set("volume",Y)}setTimingSrc(Y,te){return he(this,null,function*(){if(!Y)throw new TypeError("A Timing Object must be provided.");yield this.ready();const me=new Jt(this,Y,te);return ct(this,"notifyTimingObjectConnect"),me.addEventListener("disconnect",()=>ct(this,"notifyTimingObjectDisconnect")),me})}}at||(Lr=Be(),V(),jt(),Br(),Rt(),U());const Wt=zr},80210($e,Me,Ee){var He=Ee(80629);Me.formatArgs=Ne,Me.save=H,Me.load=Qe,Me.useColors=Le,Me.storage=de(),Me.destroy=(()=>{let he=!1;return()=>{he||(he=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),Me.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Le(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let he;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(he=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(he[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ne(he){if(he[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+he[0]+(this.useColors?"%c ":" ")+"+"+$e.exports.humanize(this.diff),!this.useColors)return;const O="color: "+this.color;he.splice(1,0,O,"color: inherit");let K=0,j=0;he[0].replace(/%[a-zA-Z%]/g,ve=>{ve!=="%%"&&(K++,ve==="%c"&&(j=K))}),he.splice(j,0,O)}Me.log=console.debug||console.log||(()=>{});function H(he){try{he?Me.storage.setItem("debug",he):Me.storage.removeItem("debug")}catch(O){}}function Qe(){let he;try{he=Me.storage.getItem("debug")||Me.storage.getItem("DEBUG")}catch(O){}return!he&&typeof He!="undefined"&&"env"in He&&(he=He.env.DEBUG),he}function de(){try{return localStorage}catch(he){}}$e.exports=Ee(33437)(Me);const{formatters:Pe}=$e.exports;Pe.j=function(he){try{return JSON.stringify(he)}catch(O){return"[UnexpectedJSONParseError]: "+O.message}}},33437($e,Me,Ee){function He(Le){H.debug=H,H.default=H,H.coerce=K,H.disable=he,H.enable=de,H.enabled=O,H.humanize=Ee(27764),H.destroy=j,Object.keys(Le).forEach(ve=>{H[ve]=Le[ve]}),H.names=[],H.skips=[],H.formatters={};function Ne(ve){let at=0;for(let ze=0;ze<ve.length;ze++)at=(at<<5)-at+ve.charCodeAt(ze),at|=0;return H.colors[Math.abs(at)%H.colors.length]}H.selectColor=Ne;function H(ve){let at,ze=null,Et,Xe;function Ye(...Ze){if(!Ye.enabled)return;const st=Ye,ht=Number(new Date),Je=ht-(at||ht);st.diff=Je,st.prev=at,st.curr=ht,at=ht,Ze[0]=H.coerce(Ze[0]),typeof Ze[0]!="string"&&Ze.unshift("%O");let ae=0;Ze[0]=Ze[0].replace(/%([a-zA-Z%])/g,(ke,mt)=>{if(ke==="%%")return"%";ae++;const At=H.formatters[mt];if(typeof At=="function"){const Ge=Ze[ae];ke=At.call(st,Ge),Ze.splice(ae,1),ae--}return ke}),H.formatArgs.call(st,Ze),(st.log||H.log).apply(st,Ze)}return Ye.namespace=ve,Ye.useColors=H.useColors(),Ye.color=H.selectColor(ve),Ye.extend=Qe,Ye.destroy=H.destroy,Object.defineProperty(Ye,"enabled",{enumerable:!0,configurable:!1,get:()=>ze!==null?ze:(Et!==H.namespaces&&(Et=H.namespaces,Xe=H.enabled(ve)),Xe),set:Ze=>{ze=Ze}}),typeof H.init=="function"&&H.init(Ye),Ye}function Qe(ve,at){const ze=H(this.namespace+(typeof at=="undefined"?":":at)+ve);return ze.log=this.log,ze}function de(ve){H.save(ve),H.namespaces=ve,H.names=[],H.skips=[];const at=(typeof ve=="string"?ve:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const ze of at)ze[0]==="-"?H.skips.push(ze.slice(1)):H.names.push(ze)}function Pe(ve,at){let ze=0,Et=0,Xe=-1,Ye=0;for(;ze<ve.length;)if(Et<at.length&&(at[Et]===ve[ze]||at[Et]==="*"))at[Et]==="*"?(Xe=Et,Ye=ze,Et++):(ze++,Et++);else if(Xe!==-1)Et=Xe+1,Ye++,ze=Ye;else return!1;for(;Et<at.length&&at[Et]==="*";)Et++;return Et===at.length}function he(){const ve=[...H.names,...H.skips.map(at=>"-"+at)].join(",");return H.enable(""),ve}function O(ve){for(const at of H.skips)if(Pe(ve,at))return!1;for(const at of H.names)if(Pe(ve,at))return!0;return!1}function K(ve){return ve instanceof Error?ve.stack||ve.message:ve}function j(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return H.enable(H.load()),H}$e.exports=He},51965($e){(function Me(Ee){(function(He,Le){$e.exports=Le()})(this,function(){"use strict";function He(s,l,n){if(O())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,l);var e=new(s.bind.apply(s,r));return n&&ve(e,n.prototype),e}function Le(s,l){for(var n=0;n<l.length;n++){var r=l[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(s,ze(r.key),r)}}function Ne(s,l,n){return l&&Le(s.prototype,l),n&&Le(s,n),Object.defineProperty(s,"prototype",{writable:!1}),s}function H(s,l,n){return(l=ze(l))in s?Object.defineProperty(s,l,{value:n,enumerable:!0,configurable:!0,writable:!0}):s[l]=n,s}function Qe(){return Qe=Object.assign?Object.assign.bind():function(s){for(var l=1;l<arguments.length;l++){var n=arguments[l];for(var r in n)({}).hasOwnProperty.call(n,r)&&(s[r]=n[r])}return s},Qe.apply(null,arguments)}function de(s){return de=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(l){return l.__proto__||Object.getPrototypeOf(l)},de(s)}function Pe(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,ve(s,l)}function he(s){try{return Function.toString.call(s).indexOf("[native code]")!==-1}catch(l){return typeof s=="function"}}function O(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(l){}return(O=function(){return!!s})()}function K(s,l){var n=Object.keys(s);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(s);l&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable})),n.push.apply(n,r)}return n}function j(s){for(var l=1;l<arguments.length;l++){var n=arguments[l]!=null?arguments[l]:{};l%2?K(Object(n),!0).forEach(function(r){H(s,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(r){Object.defineProperty(s,r,Object.getOwnPropertyDescriptor(n,r))})}return s}function ve(s,l){return ve=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ve(s,l)}function at(s,l){if(typeof s!="object"||!s)return s;var n=s[Symbol.toPrimitive];if(n!==void 0){var r=n.call(s,l);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(s)}function ze(s){var l=at(s,"string");return typeof l=="symbol"?l:l+""}function Et(s){var l=typeof Map=="function"?new Map:void 0;return Et=function(n){if(n===null||!he(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(l!==void 0){if(l.has(n))return l.get(n);l.set(n,r)}function r(){return He(n,arguments,de(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ve(r,n)},Et(s)}function Xe(){try{return crypto.randomUUID()}catch(e){try{var s=URL.createObjectURL(new Blob),l=s.toString();return URL.revokeObjectURL(s),l.slice(l.lastIndexOf("/")+1)}catch(t){var n=new Date().getTime(),r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var o=(n+Math.random()*16)%16|0;return n=Math.floor(n/16),(a=="x"?o:o&3|8).toString(16)});return r}}}function Ye(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Ze={exports:{}},st;function ht(){return st||(st=1,function(s){var l=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function e(d,c,f){this.fn=d,this.context=c,this.once=f||!1}function t(d,c,f,v,m){if(typeof f!="function")throw new TypeError("The listener must be a function");var g=new e(f,v||d,m),y=n?n+c:c;return d._events[y]?d._events[y].fn?d._events[y]=[d._events[y],g]:d._events[y].push(g):(d._events[y]=g,d._eventsCount++),d}function a(d,c){--d._eventsCount===0?d._events=new r:delete d._events[c]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],f,v;if(this._eventsCount===0)return c;for(v in f=this._events)l.call(f,v)&&c.push(n?v.slice(1):v);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(f)):c},o.prototype.listeners=function(c){var f=n?n+c:c,v=this._events[f];if(!v)return[];if(v.fn)return[v.fn];for(var m=0,g=v.length,y=new Array(g);m<g;m++)y[m]=v[m].fn;return y},o.prototype.listenerCount=function(c){var f=n?n+c:c,v=this._events[f];return v?v.fn?1:v.length:0},o.prototype.emit=function(c,f,v,m,g,y){var b=n?n+c:c;if(!this._events[b])return!1;var S=this._events[b],L=arguments.length,C,F;if(S.fn){switch(S.once&&this.removeListener(c,S.fn,void 0,!0),L){case 1:return S.fn.call(S.context),!0;case 2:return S.fn.call(S.context,f),!0;case 3:return S.fn.call(S.context,f,v),!0;case 4:return S.fn.call(S.context,f,v,m),!0;case 5:return S.fn.call(S.context,f,v,m,g),!0;case 6:return S.fn.call(S.context,f,v,m,g,y),!0}for(F=1,C=new Array(L-1);F<L;F++)C[F-1]=arguments[F];S.fn.apply(S.context,C)}else{var N=S.length,B;for(F=0;F<N;F++)switch(S[F].once&&this.removeListener(c,S[F].fn,void 0,!0),L){case 1:S[F].fn.call(S[F].context);break;case 2:S[F].fn.call(S[F].context,f);break;case 3:S[F].fn.call(S[F].context,f,v);break;case 4:S[F].fn.call(S[F].context,f,v,m);break;default:if(!C)for(B=1,C=new Array(L-1);B<L;B++)C[B-1]=arguments[B];S[F].fn.apply(S[F].context,C)}}return!0},o.prototype.on=function(c,f,v){return t(this,c,f,v,!1)},o.prototype.once=function(c,f,v){return t(this,c,f,v,!0)},o.prototype.removeListener=function(c,f,v,m){var g=n?n+c:c;if(!this._events[g])return this;if(!f)return a(this,g),this;var y=this._events[g];if(y.fn)y.fn===f&&(!m||y.once)&&(!v||y.context===v)&&a(this,g);else{for(var b=0,S=[],L=y.length;b<L;b++)(y[b].fn!==f||m&&!y[b].once||v&&y[b].context!==v)&&S.push(y[b]);S.length?this._events[g]=S.length===1?S[0]:S:a(this,g)}return this},o.prototype.removeAllListeners=function(c){var f;return c?(f=n?n+c:c,this._events[f]&&a(this,f)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,s.exports=o}(Ze)),Ze.exports}var Je=ht(),ae=Ye(Je),dt={exports:{}},ke;function mt(){return ke||(ke=1,function(s,l){(function(n){var r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,e=/^(?=([^\/?#]*))\1([^]*)$/,t=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(d,c,f){if(f=f||{},d=d.trim(),c=c.trim(),!c){if(!f.alwaysNormalize)return d;var v=o.parseURL(d);if(!v)throw new Error("Error trying to parse base URL.");return v.path=o.normalizePath(v.path),o.buildURLFromParts(v)}var m=o.parseURL(c);if(!m)throw new Error("Error trying to parse relative URL.");if(m.scheme)return f.alwaysNormalize?(m.path=o.normalizePath(m.path),o.buildURLFromParts(m)):c;var g=o.parseURL(d);if(!g)throw new Error("Error trying to parse base URL.");if(!g.netLoc&&g.path&&g.path[0]!=="/"){var y=e.exec(g.path);g.netLoc=y[1],g.path=y[2]}g.netLoc&&!g.path&&(g.path="/");var b={scheme:g.scheme,netLoc:m.netLoc,path:null,params:m.params,query:m.query,fragment:m.fragment};if(!m.netLoc&&(b.netLoc=g.netLoc,m.path[0]!=="/"))if(!m.path)b.path=g.path,m.params||(b.params=g.params,m.query||(b.query=g.query));else{var S=g.path,L=S.substring(0,S.lastIndexOf("/")+1)+m.path;b.path=o.normalizePath(L)}return b.path===null&&(b.path=f.alwaysNormalize?o.normalizePath(m.path):m.path),o.buildURLFromParts(b)},parseURL:function(d){var c=r.exec(d);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(d){for(d=d.split("").reverse().join("").replace(t,"");d.length!==(d=d.replace(a,"")).length;);return d.split("").reverse().join("")},buildURLFromParts:function(d){return d.scheme+d.netLoc+d.path+d.params+d.query+d.fragment}};s.exports=o})()}(dt)),dt.exports}var At=mt(),Ge=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},De=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=Lt},Lt=Number.MAX_SAFE_INTEGER||9007199254740991,ut=function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s}({}),Q=function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",s.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",s.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.ASSET_LIST_LOAD_ERROR="assetListLoadError",s.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",s.ASSET_LIST_PARSING_ERROR="assetListParsingError",s.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.ATTACH_MEDIA_ERROR="attachMediaError",s.UNKNOWN="unknown",s}({}),_=function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.MEDIA_ENDED="hlsMediaEnded",s.STALL_RESOLVED="hlsStallResolved",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFERED_TO_END="hlsBufferedToEnd",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",s.ASSET_LIST_LOADING="hlsAssetListLoading",s.ASSET_LIST_LOADED="hlsAssetListLoaded",s.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",s.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",s.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",s.INTERSTITIAL_STARTED="hlsInterstitialStarted",s.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",s.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",s.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",s.INTERSTITIAL_ENDED="hlsInterstitialEnded",s.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",s.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",s.EVENT_CUE_ENTER="hlsEventCueEnter",s}({}),pe={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ie={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"},ct=function(){function s(n,r,e){r===void 0&&(r=0),e===void 0&&(e=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=n,this.alpha_=n?Math.exp(Math.log(.5)/n):0,this.estimate_=r,this.totalWeight_=e}var l=s.prototype;return l.sample=function(r,e){var t=Math.pow(this.alpha_,r);this.estimate_=e*(1-t)+t*this.estimate_,this.totalWeight_+=r},l.getTotalWeight=function(){return this.totalWeight_},l.getEstimate=function(){if(this.alpha_){var r=1-Math.pow(this.alpha_,this.totalWeight_);if(r)return this.estimate_/r}return this.estimate_},s}(),_e=function(){function s(n,r,e,t){t===void 0&&(t=100),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=e,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ct(n),this.fast_=new ct(r),this.defaultTTFB_=t,this.ttfb_=new ct(n)}var l=s.prototype;return l.update=function(r,e){var t=this.slow_,a=this.fast_,o=this.ttfb_;t.halfLife!==r&&(this.slow_=new ct(r,t.getEstimate(),t.getTotalWeight())),a.halfLife!==e&&(this.fast_=new ct(e,a.getEstimate(),a.getTotalWeight())),o.halfLife!==r&&(this.ttfb_=new ct(r,o.getEstimate(),o.getTotalWeight()))},l.sample=function(r,e){r=Math.max(r,this.minDelayMs_);var t=8*e,a=r/1e3,o=t/a;this.fast_.sample(a,o),this.slow_.sample(a,o)},l.sampleTTFB=function(r){var e=r/1e3,t=Math.sqrt(2)*Math.exp(-Math.pow(e,2)/2);this.ttfb_.sample(t,Math.max(r,5))},l.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_},l.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},l.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},l.destroy=function(){},Ne(s,[{key:"defaultEstimate",get:function(){return this.defaultEstimate_}}])}(),Te=function(l,n){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;var r="["+l+"]:";this.trace=we,this.debug=n.debug.bind(null,r),this.log=n.log.bind(null,r),this.warn=n.warn.bind(null,r),this.info=n.info.bind(null,r),this.error=n.error.bind(null,r)},we=function(){},xt={trace:we,debug:we,log:we,warn:we,info:we,error:we};function Ir(){return Qe({},xt)}function V(s,l){var n=self.console[s];return n?n.bind(self.console,(l?"["+l+"] ":"")+"["+s+"] >"):we}function jt(s,l,n){return l[s]?l[s].bind(l):V(s,n)}var Br=Ir();function Rt(s,l,n){var r=Ir();if(typeof console=="object"&&s===!0||typeof s=="object"){var e=["debug","log","info","warn","error"];e.forEach(function(t){r[t]=jt(t,s,n)});try{r.log('Debug logs enabled for "'+l+'" in hls.js version 1.6.15')}catch(t){return Ir()}e.forEach(function(t){Br[t]=jt(t,s)})}else Qe(Br,r);return r}var U=Br;function Be(s){if(s===void 0&&(s=!0),typeof self!="undefined"){var l=(s||!self.MediaSource)&&self.ManagedMediaSource;return l||self.MediaSource||self.WebKitMediaSource}}function je(s){return typeof self!="undefined"&&s===self.ManagedMediaSource}function Jt(s,l){var n=Object.keys(s),r=Object.keys(l),e=n.length,t=r.length;return!e||!t||e===t&&!n.some(function(a){return r.indexOf(a)===-1})}function Nt(s,l){if(l===void 0&&(l=!1),typeof TextDecoder!="undefined"){var n=new TextDecoder("utf-8"),r=n.decode(s);if(l){var e=r.indexOf("\0");return e!==-1?r.substring(0,e):r}return r.replace(/\0/g,"")}for(var t=s.length,a,o,d,c="",f=0;f<t;){if(a=s[f++],a===0&&l)return c;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(a);break;case 12:case 13:o=s[f++],c+=String.fromCharCode((a&31)<<6|o&63);break;case 14:o=s[f++],d=s[f++],c+=String.fromCharCode((a&15)<<12|(o&63)<<6|(d&63)<<0);break}}return c}function Ut(s){for(var l="",n=0;n<s.length;n++){var r=s[n].toString(16);r.length<2&&(r="0"+r),l+=r}return l}function Lr(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}var zr=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}},Wt={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"},qe=function(){function s(n){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof n=="string"&&(n={url:n}),this.base=n,kt(this,"stats")}var l=s.prototype;return l.setByteRange=function(r,e){var t=r.split("@",2),a;t.length===1?a=(e==null?void 0:e.byteRangeEndOffset)||0:a=parseInt(t[1]),this._byteRange=[a,parseInt(t[0])+a]},l.clearElementaryStreamInfo=function(){var r=this.elementaryStreams;r[Wt.AUDIO]=null,r[Wt.VIDEO]=null,r[Wt.AUDIOVIDEO]=null},Ne(s,[{key:"baseurl",get:function(){return this.base.url}},{key:"byteRange",get:function(){return this._byteRange===null?[]:this._byteRange}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"elementaryStreams",get:function(){if(this._streams===null){var r;this._streams=(r={},r[Wt.AUDIO]=null,r[Wt.VIDEO]=null,r[Wt.AUDIOVIDEO]=null,r)}return this._streams},set:function(r){this._streams=r}},{key:"hasStats",get:function(){return this._stats!==null}},{key:"hasStreams",get:function(){return this._streams!==null}},{key:"stats",get:function(){return this._stats===null&&(this._stats=new zr),this._stats},set:function(r){this._stats=r}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=At.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(r){this._url=r}}])}();function Y(s){return s.sn!=="initSegment"}var te=function(s){function l(r,e){var t;return t=s.call(this,e)||this,t._decryptdata=null,t._programDateTime=null,t._ref=null,t._bitrate=void 0,t.rawProgramDateTime=null,t.tagList=[],t.duration=0,t.sn=0,t.levelkeys=void 0,t.type=void 0,t.loader=null,t.keyLoader=null,t.level=-1,t.cc=0,t.startPTS=void 0,t.endPTS=void 0,t.startDTS=void 0,t.endDTS=void 0,t.start=0,t.playlistOffset=0,t.deltaPTS=void 0,t.maxStartPTS=void 0,t.minEndPTS=void 0,t.data=void 0,t.bitrateTest=!1,t.title=null,t.initSegment=null,t.endList=void 0,t.gap=void 0,t.urlId=0,t.type=r,t}Pe(l,s);var n=l.prototype;return n.addStart=function(e){this.setStart(this.start+e)},n.setStart=function(e){this.start=e,this._ref&&(this._ref.start=e)},n.setDuration=function(e){this.duration=e,this._ref&&(this._ref.duration=e)},n.setKeyFormat=function(e){var t=this.levelkeys;if(t){var a,o=t[e];o&&!((a=this._decryptdata)!=null&&a.keyId)&&(this._decryptdata=o.getDecryptData(this.sn,t))}},n.abortRequests=function(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()},n.setElementaryStreamInfo=function(e,t,a,o,d,c){c===void 0&&(c=!1);var f=this.elementaryStreams,v=f[e];if(!v){f[e]={startPTS:t,endPTS:a,startDTS:o,endDTS:d,partial:c};return}v.startPTS=Math.min(v.startPTS,t),v.endPTS=Math.max(v.endPTS,a),v.startDTS=Math.min(v.startDTS,o),v.endDTS=Math.max(v.endDTS,d)},Ne(l,[{key:"byteLength",get:function(){if(this.hasStats){var e=this.stats.total;if(e)return e}if(this.byteRange.length){var t=this.byteRange[0],a=this.byteRange[1];if(Ge(t)&&Ge(a))return a-t}return null}},{key:"bitrate",get:function(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null},set:function(e){this._bitrate=e}},{key:"decryptdata",get:function(){var e,t=this.levelkeys;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){var a=Object.keys(t);if(a.length===1){var o=this._decryptdata=t[a[0]]||null;o&&(this._decryptdata=o.getDecryptData(this.sn,t))}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;var e=Ge(this.duration)?this.duration:0;return this.programDateTime+e*1e3}},{key:"encrypted",get:function(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t,a=Object.keys(this.levelkeys),o=a.length;if(o>1||o===1&&(t=this.levelkeys[a[0]])!=null&&t.encrypted)return!0}return!1}},{key:"programDateTime",get:function(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime},set:function(e){if(!Ge(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}},{key:"ref",get:function(){return Y(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}}])}(qe),me=function(s){function l(n,r,e,t,a){var o;o=s.call(this,e)||this,o.fragOffset=0,o.duration=0,o.gap=!1,o.independent=!1,o.relurl=void 0,o.fragment=void 0,o.index=void 0,o.duration=n.decimalFloatingPoint("DURATION"),o.gap=n.bool("GAP"),o.independent=n.bool("INDEPENDENT"),o.relurl=n.enumeratedString("URI"),o.fragment=r,o.index=t;var d=n.enumeratedString("BYTERANGE");return d&&o.setByteRange(d,a),a&&(o.fragOffset=a.fragOffset+a.duration),o}return Pe(l,s),Ne(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var r=this.elementaryStreams;return!!(r.audio||r.video||r.audiovideo)}}])}(qe);function it(s,l){var n=Object.getPrototypeOf(s);if(n){var r=Object.getOwnPropertyDescriptor(n,l);return r||it(n,l)}}function kt(s,l){var n=it(s,l);n&&(n.enumerable=!0,Object.defineProperty(s,l,n))}var Oe=Math.pow(2,32)-1,zt=[].push,Pt={video:1,audio:2,id3:3,text:4};function Zt(s){return String.fromCharCode.apply(null,s)}function Wr(s,l){var n=s[l]<<8|s[l+1];return n<0?65536+n:n}function ft(s,l){var n=li(s,l);return n<0?4294967296+n:n}function Qr(s,l){var n=ft(s,l);return n*=Math.pow(2,32),n+=ft(s,l+4),n}function li(s,l){return s[l]<<24|s[l+1]<<16|s[l+2]<<8|s[l+3]}function ln(s){for(var l=s.byteLength,n=0;n<l;){var r=ft(s,n);if(r>8&&s[n+4]===109&&s[n+5]===111&&s[n+6]===111&&s[n+7]===102)return!0;n=r>1?n+r:l}return!1}function Ar(s,l){var n=[];if(!l.length)return n;for(var r=s.byteLength,e=0;e<r;){var t=ft(s,e),a=Zt(s.subarray(e+4,e+8)),o=t>1?e+t:r;if(a===l[0])if(l.length===1)n.push(s.subarray(e+8,o));else{var d=Ar(s.subarray(e+8,o),l.slice(1));d.length&&zt.apply(n,d)}e=o}return n}function Yi(s){var l=[],n=s[0],r=8,e=ft(s,r);r+=4;var t=0,a=0;n===0?(t=ft(s,r),a=ft(s,r+4),r+=8):(t=Qr(s,r),a=Qr(s,r+8),r+=16),r+=2;var o=s.length+a,d=Wr(s,r);r+=2;for(var c=0;c<d;c++){var f=r,v=ft(s,f);f+=4;var m=v&2147483647,g=(v&2147483648)>>>31;if(g===1)return U.warn("SIDX has hierarchical references (not supported)"),null;var y=ft(s,f);f+=4,l.push({referenceSize:m,subsegmentDuration:y,info:{duration:y/e,start:o,end:o+m-1}}),o+=m,f+=4,r=f}return{earliestPresentationTime:t,timescale:e,version:n,referencesCount:d,references:l}}function _i(s){for(var l=[],n=Ar(s,["moov","trak"]),r=0;r<n.length;r++){var e=n[r],t=Ar(e,["tkhd"])[0];if(t){var a=t[0],o=ft(t,a===0?12:20),d=Ar(e,["mdia","mdhd"])[0];if(d){a=d[0];var c=ft(d,a===0?12:20),f=Ar(e,["mdia","hdlr"])[0];if(f){var v=Zt(f.subarray(8,12)),m={soun:Wt.AUDIO,vide:Wt.VIDEO}[v],g=Ar(e,["mdia","minf","stbl","stsd"])[0],y=br(g);m?(l[o]={timescale:c,type:m,stsd:y},l[m]=j({timescale:c,id:o},y)):l[o]={timescale:c,type:v,stsd:y}}}}}var b=Ar(s,["moov","mvex","trex"]);return b.forEach(function(S){var L=ft(S,4),C=l[L];C&&(C.default={duration:ft(S,12),flags:ft(S,20)})}),l}function br(s){var l=s.subarray(8),n=l.subarray(86),r=Zt(l.subarray(4,8)),e=r,t,a=r==="enca"||r==="encv";if(a){var o=Ar(l,[r])[0],d=o.subarray(r==="enca"?28:78),c=Ar(d,["sinf"]);c.forEach(function(ir){var qa=Ar(ir,["schm"])[0];if(qa){var Da=Zt(qa.subarray(4,8));if(Da==="cbcs"||Da==="cenc"){var Tn=Ar(ir,["frma"])[0];Tn&&(e=Zt(Tn))}}})}var f=e;switch(e){case"avc1":case"avc2":case"avc3":case"avc4":{var v=Ar(n,["avcC"])[0];v&&v.length>3&&(e+="."+yt(v[1])+yt(v[2])+yt(v[3]),t=fe(f==="avc1"?"dva1":"dvav",n));break}case"mp4a":{var m=Ar(l,[r])[0],g=Ar(m.subarray(28),["esds"])[0];if(g&&g.length>7){var y=4;if(g[y++]!==3)break;y=oe(g,y),y+=2;var b=g[y++];if(b&128&&(y+=2),b&64&&(y+=g[y++]),g[y++]!==4)break;y=oe(g,y);var S=g[y++];if(S===64)e+="."+yt(S);else break;if(y+=12,g[y++]!==5)break;y=oe(g,y);var L=g[y++],C=(L&248)>>3;C===31&&(C+=1+((L&7)<<3)+((g[y]&224)>>5)),e+="."+C}break}case"hvc1":case"hev1":{var F=Ar(n,["hvcC"])[0];if(F&&F.length>12){var N=F[1],B=["","A","B","C"][N>>6],re=N&31,ce=ft(F,2),Se=(N&32)>>5?"H":"L",Ke=F[12],be=F.subarray(6,12);e+="."+B+re,e+="."+ye(ce).toString(16).toUpperCase(),e+="."+Se+Ke;for(var Z="",ne=be.length;ne--;){var Re=be[ne];if(Re||Z){var Tt=Re.toString(16).toUpperCase();Z="."+Tt+Z}}e+=Z}t=fe(f=="hev1"?"dvhe":"dvh1",n);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{e=fe(e,n)||e;break}case"vp09":{var ot=Ar(n,["vpcC"])[0];if(ot&&ot.length>6){var pt=ot[4],Bt=ot[5],cr=ot[6]>>4&15;e+="."+qt(pt)+"."+qt(Bt)+"."+qt(cr)}break}case"av01":{var or=Ar(n,["av1C"])[0];if(or&&or.length>2){var hr=or[1]>>>5,xr=or[1]&31,fr=or[2]>>>7?"H":"M",lr=(or[2]&64)>>6,_r=(or[2]&32)>>5,Dr=hr===2&&lr?_r?12:10:lr?10:8,bi=(or[2]&16)>>4,jr=(or[2]&8)>>3,ji=(or[2]&4)>>2,ia=or[2]&3,Fi=1,sn=1,Gi=1,si=0;e+="."+hr+"."+qt(xr)+fr+"."+qt(Dr)+"."+bi+"."+jr+ji+ia+"."+qt(Fi)+"."+qt(sn)+"."+qt(Gi)+"."+si,t=fe("dav1",n)}break}}return{codec:e,encrypted:a,supplemental:t}}function fe(s,l){var n=Ar(l,["dvvC"]),r=n.length?n[0]:Ar(l,["dvcC"])[0];if(r){var e=r[2]>>1&127,t=r[2]<<5&32|r[3]>>3&31;return s+"."+qt(e)+"."+qt(t)}}function ye(s){for(var l=0,n=0;n<32;n++)l|=(s>>n&1)<<31-n;return l>>>0}function oe(s,l){for(var n=l+5;s[l++]&128&&l<n;);return l}function yt(s){return("0"+s.toString(16).toUpperCase()).slice(-2)}function qt(s){return(s<10?"0":"")+s}function yr(s,l){if(!(!s||!l)){var n=l.keyId;n&&l.isCommonEncryption&&Qt(s,function(r,e){var t=r.subarray(8,24);t.some(function(a){return a!==0})||(U.log("[eme] Patching keyId in 'enc"+(e?"a":"v")+">sinf>>tenc' box: "+Ut(t)+" -> "+Ut(n)),r.set(n,8))})}}function Rr(s){var l=[];return Qt(s,function(n){return l.push(n.subarray(8,24))}),l}function Qt(s,l){var n=Ar(s,["moov","trak"]);n.forEach(function(r){var e=Ar(r,["mdia","minf","stbl","stsd"])[0];if(e){var t=e.subarray(8),a=Ar(t,["enca"]),o=a.length>0;o||(a=Ar(t,["encv"])),a.forEach(function(d){var c=o?d.subarray(28):d.subarray(78),f=Ar(c,["sinf"]);f.forEach(function(v){var m=Ht(v);m&&l(m,o)})})}})}function Ht(s){var l=Ar(s,["schm"])[0];if(l){var n=Zt(l.subarray(4,8));if(n==="cbcs"||n==="cenc"){var r=Ar(s,["schi","tenc"])[0];if(r)return r}}}function Ci(s,l,n){for(var r={},e=Ar(s,["moof","traf"]),t=0;t<e.length;t++){var a=e[t],o=Ar(a,["tfhd"])[0],d=ft(o,4),c=l[d];if(c){r[d]||(r[d]={start:NaN,duration:0,sampleCount:0,timescale:c.timescale,type:c.type});var f=r[d],v=Ar(a,["tfdt"])[0];if(v){var m=v[0],g=ft(v,4);m===1&&(g===Oe?n.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(g*=Oe+1,g+=ft(v,8))),Ge(g)&&(!Ge(f.start)||g<f.start)&&(f.start=g)}var y=c.default,b=ft(o,0)|(y==null?void 0:y.flags),S=(y==null?void 0:y.duration)||0;b&8&&(b&2?S=ft(o,12):S=ft(o,8));for(var L=Ar(a,["trun"]),C=f.start||0,F=0,N=S,B=0;B<L.length;B++){var re=L[B],ce=ft(re,4),Se=f.sampleCount;f.sampleCount+=ce;var Ke=re[3]&1,be=re[3]&4,Z=re[2]&1,ne=re[2]&2,Re=re[2]&4,Tt=re[2]&8,ot=8,pt=ce;if(Ke&&(ot+=4),be&&ce){var Bt=re[ot+1]&1;!Bt&&f.keyFrameIndex===void 0&&(f.keyFrameIndex=Se),ot+=4,Z?(N=ft(re,ot),ot+=4):N=S,ne&&(ot+=4),Tt&&(ot+=4),C+=N,F+=N,pt--}for(;pt--;){if(Z?(N=ft(re,ot),ot+=4):N=S,ne&&(ot+=4),Re){var cr=re[ot+1]&1;cr||f.keyFrameIndex===void 0&&(f.keyFrameIndex=f.sampleCount-(pt+1),f.keyFrameStart=C),ot+=4}Tt&&(ot+=4),C+=N,F+=N}!F&&S&&(F+=S*ce)}f.duration+=F}}if(!Object.keys(r).some(function(Dr){return r[Dr].duration})){for(var or=1/0,hr=0,xr=Ar(s,["sidx"]),fr=0;fr<xr.length;fr++){var lr=Yi(xr[fr]);if(lr!=null&&lr.references){or=Math.min(or,lr.earliestPresentationTime/lr.timescale);var _r=lr.references.reduce(function(Dr,bi){return Dr+bi.info.duration||0},0);hr=Math.max(hr,_r+lr.earliestPresentationTime/lr.timescale)}}hr&&Ge(hr)&&Object.keys(r).forEach(function(Dr){r[Dr].duration||(r[Dr].duration=hr*r[Dr].timescale-r[Dr].start)})}return r}function Ft(s){var l={valid:null,remainder:null},n=Ar(s,["moof"]);if(n.length<2)return l.remainder=s,l;var r=n[n.length-1];return l.valid=s.slice(0,r.byteOffset-8),l.remainder=s.slice(r.byteOffset-8),l}function ie(s,l){var n=new Uint8Array(s.length+l.length);return n.set(s),n.set(l,s.length),n}function er(s,l){var n=[],r=l.samples,e=l.timescale,t=l.id,a=!1,o=Ar(r,["moof"]);return o.map(function(d){var c=d.byteOffset-8,f=Ar(d,["traf"]);f.map(function(v){var m=Ar(v,["tfdt"]).map(function(g){var y=g[0],b=ft(g,4);return y===1&&(b*=Math.pow(2,32),b+=ft(g,8)),b/e})[0];return m!==void 0&&(s=m),Ar(v,["tfhd"]).map(function(g){var y=ft(g,4),b=ft(g,0)&16777215,S=(b&1)!==0,L=(b&2)!==0,C=(b&8)!==0,F=0,N=(b&16)!==0,B=0,re=(b&32)!==0,ce=8;y===t&&(S&&(ce+=8),L&&(ce+=4),C&&(F=ft(g,ce),ce+=4),N&&(B=ft(g,ce),ce+=4),re&&(ce+=4),l.type==="video"&&(a=Ai(l.codec)),Ar(v,["trun"]).map(function(Se){var Ke=Se[0],be=ft(Se,0)&16777215,Z=(be&1)!==0,ne=0,Re=(be&4)!==0,Tt=(be&256)!==0,ot=0,pt=(be&512)!==0,Bt=0,cr=(be&1024)!==0,or=(be&2048)!==0,hr=0,xr=ft(Se,4),fr=8;Z&&(ne=ft(Se,fr),fr+=4),Re&&(fr+=4);for(var lr=ne+c,_r=0;_r<xr;_r++){if(Tt?(ot=ft(Se,fr),fr+=4):ot=F,pt?(Bt=ft(Se,fr),fr+=4):Bt=B,cr&&(fr+=4),or&&(Ke===0?hr=ft(Se,fr):hr=li(Se,fr),fr+=4),l.type===Wt.VIDEO)for(var Dr=0;Dr<Bt;){var bi=ft(r,lr);if(lr+=4,Bi(a,r[lr])){var jr=r.subarray(lr,lr+bi);Hr(jr,a?2:1,s+hr/e,n)}lr+=bi,Dr+=bi+4}s+=ot/e}}))})})}),n}function Ai(s){if(!s)return!1;var l=s.substring(0,4);return l==="hvc1"||l==="hev1"||l==="dvh1"||l==="dvhe"}function Bi(s,l){if(s){var n=l>>1&63;return n===39||n===40}else{var r=l&31;return r===6}}function Hr(s,l,n,r){var e=pi(s),t=0;t+=l;for(var a=0,o=0,d=0;t<e.length;){a=0;do{if(t>=e.length)break;d=e[t++],a+=d}while(d===255);o=0;do{if(t>=e.length)break;d=e[t++],o+=d}while(d===255);var c=e.length-t,f=t;if(o<c)t+=o;else if(o>c){U.error("Malformed SEI payload. "+o+" is too small, only "+c+" bytes left to parse.");break}if(a===4){var v=e[f++];if(v===181){var m=Wr(e,f);if(f+=2,m===49){var g=ft(e,f);if(f+=4,g===1195456820){var y=e[f++];if(y===3){var b=e[f++],S=31&b,L=64&b,C=L?2+S*3:0,F=new Uint8Array(C);if(L){F[0]=b;for(var N=1;N<C;N++)F[N]=e[f++]}r.push({type:y,payloadType:a,pts:n,bytes:F})}}}}}else if(a===5&&o>16){for(var B=[],re=0;re<16;re++){var ce=e[f++].toString(16);B.push(ce.length==1?"0"+ce:ce),(re===3||re===5||re===7||re===9)&&B.push("-")}for(var Se=o-16,Ke=new Uint8Array(Se),be=0;be<Se;be++)Ke[be]=e[f++];r.push({payloadType:a,pts:n,uuid:B.join(""),userData:Nt(Ke),userDataBytes:Ke})}}}function pi(s){for(var l=s.byteLength,n=[],r=1;r<l-2;)s[r]===0&&s[r+1]===0&&s[r+2]===3?(n.push(r+2),r+=2):r++;if(n.length===0)return s;var e=l-n.length,t=new Uint8Array(e),a=0;for(r=0;r<e;a++,r++)a===n[0]&&(a++,n.shift()),t[r]=s[a];return t}function $r(s){var l=s[0],n="",r="",e=0,t=0,a=0,o=0,d=0,c=0;if(l===0){for(;Zt(s.subarray(c,c+1))!=="\0";)n+=Zt(s.subarray(c,c+1)),c+=1;for(n+=Zt(s.subarray(c,c+1)),c+=1;Zt(s.subarray(c,c+1))!=="\0";)r+=Zt(s.subarray(c,c+1)),c+=1;r+=Zt(s.subarray(c,c+1)),c+=1,e=ft(s,12),t=ft(s,16),o=ft(s,20),d=ft(s,24),c=28}else if(l===1){c+=4,e=ft(s,c),c+=4;var f=ft(s,c);c+=4;var v=ft(s,c);for(c+=4,a=Math.pow(2,32)*f+v,De(a)||(a=Number.MAX_SAFE_INTEGER,U.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=ft(s,c),c+=4,d=ft(s,c),c+=4;Zt(s.subarray(c,c+1))!=="\0";)n+=Zt(s.subarray(c,c+1)),c+=1;for(n+=Zt(s.subarray(c,c+1)),c+=1;Zt(s.subarray(c,c+1))!=="\0";)r+=Zt(s.subarray(c,c+1)),c+=1;r+=Zt(s.subarray(c,c+1)),c+=1}var m=s.subarray(c,s.byteLength);return{schemeIdUri:n,value:r,timeScale:e,presentationTime:a,presentationTimeDelta:t,eventDuration:o,id:d,payload:m}}function Jr(s){for(var l=arguments.length,n=new Array(l>1?l-1:0),r=1;r<l;r++)n[r-1]=arguments[r];for(var e=n.length,t=8,a=e;a--;)t+=n[a].byteLength;var o=new Uint8Array(t);for(o[0]=t>>24&255,o[1]=t>>16&255,o[2]=t>>8&255,o[3]=t&255,o.set(s,4),a=0,t=8;a<e;a++)o.set(n[a],t),t+=n[a].byteLength;return o}function Yr(s,l,n){if(s.byteLength!==16)throw new RangeError("Invalid system id");var r,e;r=0,e=new Uint8Array;var t;r>0?(t=new Uint8Array(4),l.length>0&&new DataView(t.buffer).setUint32(0,l.length,!1)):t=new Uint8Array;var a=new Uint8Array(4);return n.byteLength>0&&new DataView(a.buffer).setUint32(0,n.byteLength,!1),Jr([112,115,115,104],new Uint8Array([r,0,0,0]),s,t,e,a,n)}function Pa(s){var l=[];if(s instanceof ArrayBuffer)for(var n=s.byteLength,r=0;r+32<n;){var e=new DataView(s,r),t=za(e);l.push(t),r+=t.size}return l}function za(s){var l=s.getUint32(0),n=s.byteOffset,r=s.byteLength;if(r<l)return{offset:n,size:r};var e=s.getUint32(4);if(e!==1886614376)return{offset:n,size:l};var t=s.getUint32(8)>>>24;if(t!==0&&t!==1)return{offset:n,size:l};var a=s.buffer,o=Ut(new Uint8Array(a,n+12,16)),d=null,c=null,f=0;if(t===0)f=28;else{var v=s.getUint32(28);if(!v||r<32+v*16)return{offset:n,size:l};d=[];for(var m=0;m<v;m++)d.push(new Uint8Array(a,n+32+m*16,16));f=32+v*16}if(!f)return{offset:n,size:l};var g=s.getUint32(f);return l-32<g?{offset:n,size:l}:(c=new Uint8Array(a,n+f+4,g),{version:t,systemId:o,kids:d,data:c,offset:n,size:l})}var un=function(){return/\(Windows.+Firefox\//i.test(navigator.userAgent)},zi={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function aa(s,l){var n=zi[l];return!!n&&!!n[s.slice(0,4)]}function ma(s,l,n){return n===void 0&&(n=!0),!s.split(",").some(function(r){return!Oa(r,l,n)})}function Oa(s,l,n){var r;n===void 0&&(n=!0);var e=Be(n);return(r=e==null?void 0:e.isTypeSupported(Qi(s,l)))!=null?r:!1}function Qi(s,l){return l+"/mp4;codecs="+s}function dn(s){if(s){var l=s.substring(0,4);return zi.video[l]}return 2}function Qa(s){var l=un();return s.split(",").reduce(function(n,r){var e=l&&Ai(r),t=e?9:zi.video[r];return t?(t*2+n)/(n?3:2):(zi.audio[r]+n)/(n?2:1)},0)}var Si={};function Gs(s,l){if(l===void 0&&(l=!0),Si[s])return Si[s];for(var n={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[s],r=0;r<n.length;r++){var e;if(Oa(n[r],"audio",l))return Si[s]=n[r],n[r];if(n[r]==="mp3"&&(e=Be(l))!=null&&e.isTypeSupported("audio/mpeg"))return""}return s}var cn=/flac|opus|mp4a\.40\.34/i;function ui(s,l){return l===void 0&&(l=!0),s.replace(cn,function(n){return Gs(n.toLowerCase(),l)})}function Li(s,l){var n=[];if(s)for(var r=s.split(","),e=0;e<r.length;e++)aa(r[e],"video")||n.push(r[e]);return l&&n.push(l),n.join(",")}function Nr(s,l){if(s&&(s.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(s)!==-1)&&(Vr(s,"audio")||Vr(s,"video")))return s;if(l){var n=l.split(",");if(n.length>1){if(s){for(var r=n.length;r--;)if(n[r].substring(0,4)===s.substring(0,4))return n[r]}return n[0]}}return l||s}function Vr(s,l){return aa(s,l)&&Oa(s,l)}function di(s){for(var l=s.split(","),n=0;n<l.length;n++){var r=l[n].split(".");r.length>2&&r[0]==="avc1"&&(l[n]="avc1."+parseInt(r[1]).toString(16)+("000"+parseInt(r[2]).toString(16)).slice(-4))}return l.join(",")}function qr(s){if(s.startsWith("av01.")){for(var l=s.split("."),n=["0","111","01","01","01","0"],r=l.length;r>4&&r<10;r++)l[r]=n[r-4];return l.join(".")}return s}function Kn(s){var l=Be(s)||{isTypeSupported:function(){return!1}};return{mpeg:l.isTypeSupported("audio/mpeg"),mp3:l.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:l.isTypeSupported('audio/mp4; codecs="ac-3"')}}function ha(s){return s.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}var X={supported:!0,powerEfficient:!0,smooth:!0},W={supported:!1,smooth:!1,powerEfficient:!1},se={supported:!0,configurations:[],decodingInfoResults:[X]};function Vt(s,l){return{supported:!1,configurations:l,decodingInfoResults:[W],error:s}}function Cr(s,l,n,r,e,t){var a=s.videoCodec,o=s.audioCodec?s.audioGroups:null,d=t==null?void 0:t.audioCodec,c=t==null?void 0:t.channels,f=c?parseInt(c):d?1/0:2,v=null;if(o!=null&&o.length)try{o.length===1&&o[0]?v=l.groups[o[0]].channels:v=o.reduce(function(m,g){if(g){var y=l.groups[g];if(!y)throw new Error("Audio track group "+g+" not found");Object.keys(y.channels).forEach(function(b){m[b]=(m[b]||0)+y.channels[b]})}return m},{2:0})}catch(m){return!0}return a!==void 0&&(a.split(",").some(function(m){return Ai(m)})||s.width>1920&&s.height>1088||s.height>1920&&s.width>1088||s.frameRate>Math.max(r,30)||s.videoRange!=="SDR"&&s.videoRange!==n||s.bitrate>Math.max(e,8e6))||!!v&&Ge(f)&&Object.keys(v).some(function(m){return parseInt(m)>f})}function gi(s,l,n,r){r===void 0&&(r={});var e=s.videoCodec;if(!e&&!s.audioCodec||!n)return Promise.resolve(se);for(var t=[],a=ei(s),o=a.length,d=Xi(s,l,o>0),c=d.length,f=o||1*c||1;f--;){var v={type:"media-source"};if(o&&(v.video=a[f%o]),c){v.audio=d[f%c];var m=v.audio.bitrate;v.video&&m&&(v.video.bitrate-=m)}t.push(v)}if(e){var g=navigator.userAgent;if(e.split(",").some(function(y){return Ai(y)})&&un())return Promise.resolve(Vt(new Error("Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: ("+g+")"),t))}return Promise.all(t.map(function(y){var b=na(y);return r[b]||(r[b]=n.decodingInfo(y))})).then(function(y){return{supported:!y.some(function(b){return!b.supported}),configurations:t,decodingInfoResults:y}}).catch(function(y){return{supported:!1,configurations:t,decodingInfoResults:[],error:y}})}function ei(s){var l,n=(l=s.videoCodec)==null?void 0:l.split(","),r=Gr(s),e=s.width||640,t=s.height||480,a=s.frameRate||30,o=s.videoRange.toLowerCase();return n?n.map(function(d){var c={contentType:Qi(qr(d),"video"),width:e,height:t,bitrate:r,framerate:a};return o!=="sdr"&&(c.transferFunction=o),c}):[]}function Xi(s,l,n){var r,e=(r=s.audioCodec)==null?void 0:r.split(","),t=Gr(s);return e&&s.audioGroups?s.audioGroups.reduce(function(a,o){var d,c=o?(d=l.groups[o])==null?void 0:d.tracks:null;return c?c.reduce(function(f,v){if(v.groupId===o){var m=parseFloat(v.channels||"");e.forEach(function(g){var y={contentType:Qi(g,"audio"),bitrate:n?Ei(g,t):t};m&&(y.channels=""+m),f.push(y)})}return f},a):a},[]):[]}function Ei(s,l){if(l<=1)return 1;var n=128e3;return s==="ec-3"?n=768e3:s==="ac-3"&&(n=64e4),Math.min(l/2,n)}function Gr(s){return Math.ceil(Math.max(s.bitrate*.9,s.averageBitrate)/1e3)*1e3||1}function na(s){var l="",n=s.audio,r=s.video;if(r){var e=ha(r.contentType);l+=e+"_r"+r.height+"x"+r.width+"f"+Math.ceil(r.framerate)+(r.transferFunction||"sd")+"_"+Math.ceil(r.bitrate/1e5)}if(n){var t=ha(n.contentType);l+=(r?"_":"")+t+"_c"+n.channels}return l}var Zi=["NONE","TYPE-0","TYPE-1",null];function bs(s){return Zi.indexOf(s)>-1}var hn=["SDR","PQ","HLG"];function Ts(s){return!!s&&hn.indexOf(s)>-1}var xa={No:"",Yes:"YES",v2:"v2"};function Na(s){var l=s.canSkipUntil,n=s.canSkipDateRanges,r=s.age,e=r<l/2;return l&&e?n?xa.v2:xa.Yes:xa.No}var Ln=function(){function s(n,r,e){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=n,this.part=r,this.skip=e}var l=s.prototype;return l.addDirectives=function(r){var e=new self.URL(r);return this.msn!==void 0&&e.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.href},s}(),Xa=function(){function s(n){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[n.url],this._attrs=[n.attrs],this.bitrate=n.bitrate,n.details&&(this.details=n.details),this.id=n.id||0,this.name=n.name,this.width=n.width||0,this.height=n.height||0,this.frameRate=n.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=n.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=n.audioCodec,this.videoCodec=n.videoCodec,this.codecSet=[n.videoCodec,n.audioCodec].filter(function(t){return!!t}).map(function(t){return t.substring(0,4)}).join(","),"supplemental"in n){var r;this.supplemental=n.supplemental;var e=(r=n.supplemental)==null?void 0:r.videoCodec;e&&e!==n.videoCodec&&(this.codecSet+=","+e.substring(0,4))}this.addGroupId("audio",n.attrs.AUDIO),this.addGroupId("text",n.attrs.SUBTITLES)}var l=s.prototype;return l.hasAudioGroup=function(r){return kn(this._audioGroups,r)},l.hasSubtitleGroup=function(r){return kn(this._subtitleGroups,r)},l.addGroupId=function(r,e){if(e){if(r==="audio"){var t=this._audioGroups;t||(t=this._audioGroups=[]),t.indexOf(e)===-1&&t.push(e)}else if(r==="text"){var a=this._subtitleGroups;a||(a=this._subtitleGroups=[]),a.indexOf(e)===-1&&a.push(e)}}},l.addFallback=function(){},Ne(s,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"averageBitrate",get:function(){return this._avgBitrate||this.realBitrate||this.bitrate}},{key:"attrs",get:function(){return this._attrs[0]}},{key:"codecs",get:function(){return this.attrs.CODECS||""}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"videoRange",get:function(){return this.attrs["VIDEO-RANGE"]||"SDR"}},{key:"score",get:function(){return this.attrs.optionalFloat("SCORE",0)}},{key:"uri",get:function(){return this.url[0]||""}},{key:"audioGroups",get:function(){return this._audioGroups}},{key:"subtitleGroups",get:function(){return this._subtitleGroups}},{key:"urlId",get:function(){return 0},set:function(r){}},{key:"audioGroupIds",get:function(){return this.audioGroups?[this.audioGroupId]:void 0}},{key:"textGroupIds",get:function(){return this.subtitleGroups?[this.textGroupId]:void 0}},{key:"audioGroupId",get:function(){var r;return(r=this.audioGroups)==null?void 0:r[0]}},{key:"textGroupId",get:function(){var r;return(r=this.subtitleGroups)==null?void 0:r[0]}}])}();function kn(s,l){return!l||!s?!1:s.indexOf(l)!==-1}function Sa(){if(typeof matchMedia=="function"){var s=matchMedia("(dynamic-range: high)"),l=matchMedia("bad query");if(s.media!==l.media)return s.matches===!0}return!1}function Ua(s,l){var n=!1,r=[];if(s&&(n=s!=="SDR",r=[s]),l){r=l.allowedVideoRanges||hn.slice(0);var e=r.join("")!=="SDR"&&!l.videoCodec;n=l.preferHDR!==void 0?l.preferHDR:e&&Sa(),n||(r=["SDR"])}return{preferHDR:n,allowedVideoRanges:r}}var Ks=function(l){var n=new WeakSet;return function(r,e){if(l&&(e=l(r,e)),typeof e=="object"&&e!==null){if(n.has(e))return;n.add(e)}return e}},ur=function(l,n){return JSON.stringify(l,Ks(n))};function hi(s,l,n,r,e){for(var t=Object.keys(s),a=r==null?void 0:r.channels,o=r==null?void 0:r.audioCodec,d=e==null?void 0:e.videoCodec,c=a&&parseInt(a)===2,f=!1,v=!1,m=1/0,g=1/0,y=1/0,b=1/0,S=0,L=[],C=Ua(l,e),F=C.preferHDR,N=C.allowedVideoRanges,B=function(){var ne=s[t[re]];f||(f=ne.channels[2]>0),m=Math.min(m,ne.minHeight),g=Math.min(g,ne.minFramerate),y=Math.min(y,ne.minBitrate);var Re=N.filter(function(Tt){return ne.videoRanges[Tt]>0});Re.length>0&&(v=!0)},re=t.length;re--;)B();m=Ge(m)?m:0,g=Ge(g)?g:0;var ce=Math.max(1080,m),Se=Math.max(30,g);y=Ge(y)?y:n,n=Math.max(y,n),v||(l=void 0);var Ke=t.length>1,be=t.reduce(function(Z,ne){var Re=s[ne];if(ne===Z)return Z;if(L=v?N.filter(function(Tt){return Re.videoRanges[Tt]>0}):[],Ke){if(Re.minBitrate>n)return Di(ne,"min bitrate of "+Re.minBitrate+" > current estimate of "+n),Z;if(!Re.hasDefaultAudio)return Di(ne,"no renditions with default or auto-select sound found"),Z;if(o&&ne.indexOf(o.substring(0,4))%5!==0)return Di(ne,'audio codec preference "'+o+'" not found'),Z;if(a&&!c){if(!Re.channels[a])return Di(ne,"no renditions with "+a+" channel sound found (channels options: "+Object.keys(Re.channels)+")"),Z}else if((!o||c)&&f&&Re.channels[2]===0)return Di(ne,"no renditions with stereo sound found"),Z;if(Re.minHeight>ce)return Di(ne,"min resolution of "+Re.minHeight+" > maximum of "+ce),Z;if(Re.minFramerate>Se)return Di(ne,"min framerate of "+Re.minFramerate+" > maximum of "+Se),Z;if(!L.some(function(Tt){return Re.videoRanges[Tt]>0}))return Di(ne,"no variants with VIDEO-RANGE of "+ur(L)+" found"),Z;if(d&&ne.indexOf(d.substring(0,4))%5!==0)return Di(ne,'video codec preference "'+d+'" not found'),Z;if(Re.maxScore<S)return Di(ne,"max score of "+Re.maxScore+" < selected max of "+S),Z}return Z&&(Qa(ne)>=Qa(Z)||Re.fragmentError>s[Z].fragmentError)?Z:(b=Re.minIndex,S=Re.maxScore,ne)},void 0);return{codecSet:be,videoRanges:L,preferHDR:F,minFramerate:g,minBitrate:y,minIndex:b}}function Di(s,l){U.log('[abr] start candidates with "'+s+'" ignored because '+l)}function ti(s){return s.reduce(function(l,n){var r=l.groups[n.groupId];r||(r=l.groups[n.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(n);var e=n.channels||"2";return r.channels[e]=(r.channels[e]||0)+1,r.hasDefault=r.hasDefault||n.default,r.hasAutoSelect=r.hasAutoSelect||n.autoselect,r.hasDefault&&(l.hasDefaultAudio=!0),r.hasAutoSelect&&(l.hasAutoSelectAudio=!0),l},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function sa(s,l,n,r){return s.slice(n,r+1).reduce(function(e,t,a){if(!t.codecSet)return e;var o=t.audioGroups,d=e[t.codecSet];d||(e[t.codecSet]=d={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),d.minBitrate=Math.min(d.minBitrate,t.bitrate);var c=Math.min(t.height,t.width);return d.minHeight=Math.min(d.minHeight,c),d.minFramerate=Math.min(d.minFramerate,t.frameRate),d.minIndex=Math.min(d.minIndex,a),d.maxScore=Math.max(d.maxScore,t.score),d.fragmentError+=t.fragmentError,d.videoRanges[t.videoRange]=(d.videoRanges[t.videoRange]||0)+1,o&&o.forEach(function(f){if(f){var v=l.groups[f];v&&(d.hasDefaultAudio=d.hasDefaultAudio||l.hasDefaultAudio?v.hasDefault:v.hasAutoSelect||!l.hasDefaultAudio&&!l.hasAutoSelectAudio,Object.keys(v.channels).forEach(function(m){d.channels[m]=(d.channels[m]||0)+v.channels[m]}))}}),e},{})}function fn(s){if(!s)return s;var l=s,n=l.lang,r=l.assocLang,e=l.characteristics,t=l.channels,a=l.audioCodec;return{lang:n,assocLang:r,characteristics:e,channels:t,audioCodec:a}}function xi(s,l,n){if("attrs"in s){var r=l.indexOf(s);if(r!==-1)return r}for(var e=0;e<l.length;e++){var t=l[e];if(fa(s,t,n))return e}return-1}function fa(s,l,n){var r=s.groupId,e=s.name,t=s.lang,a=s.assocLang,o=s.default,d=s.forced;return(r===void 0||l.groupId===r)&&(e===void 0||l.name===e)&&(t===void 0||vr(t,l.lang))&&(t===void 0||l.assocLang===a)&&(o===void 0||l.default===o)&&(d===void 0||l.forced===d)&&(!("characteristics"in s)||In(s.characteristics||"",l.characteristics))&&(n===void 0||n(s,l))}function vr(s,l){return l===void 0&&(l="--"),s.length===l.length?s===l:s.startsWith(l)||l.startsWith(s)}function In(s,l){l===void 0&&(l="");var n=s.split(","),r=l.split(",");return n.length===r.length&&!n.some(function(e){return r.indexOf(e)===-1})}function Fa(s,l){var n=s.audioCodec,r=s.channels;return(n===void 0||(l.audioCodec||"").substring(0,4)===n.substring(0,4))&&(r===void 0||r===(l.channels||"2"))}function ls(s,l,n,r,e){var t=l[r],a=l.reduce(function(m,g,y){var b=g.uri,S=m[b]||(m[b]=[]);return S.push(y),m},{}),o=a[t.uri];o.length>1&&(r=Math.max.apply(Math,o));var d=t.videoRange,c=t.frameRate,f=t.codecSet.substring(0,4),v=vn(l,r,function(m){if(m.videoRange!==d||m.frameRate!==c||m.codecSet.substring(0,4)!==f)return!1;var g=m.audioGroups,y=n.filter(function(b){return!g||g.indexOf(b.groupId)!==-1});return xi(s,y,e)>-1});return v>-1?v:vn(l,r,function(m){var g=m.audioGroups,y=n.filter(function(b){return!g||g.indexOf(b.groupId)!==-1});return xi(s,y,e)>-1})}function vn(s,l,n){for(var r=l;r>-1;r--)if(n(s[r]))return r;for(var e=l+1;e<s.length;e++)if(n(s[e]))return e;return-1}function Rn(s,l){var n;return!!s&&s!==((n=l.loadLevelObj)==null?void 0:n.uri)}var Ws=function(s){function l(r){var e;return e=s.call(this,"abr",r.logger)||this,e.hls=void 0,e.lastLevelLoadSec=0,e.lastLoadedFragLevel=-1,e.firstSelection=-1,e._nextAutoLevel=-1,e.nextAutoLevelKey="",e.audioTracksByGroup=null,e.codecTiers=null,e.timer=-1,e.fragCurrent=null,e.partCurrent=null,e.bitrateTestDelay=0,e.rebufferNotice=-1,e.supportedCache={},e.bwEstimator=void 0,e._abandonRulesCheck=function(t){var a,o=e,d=o.fragCurrent,c=o.partCurrent,f=o.hls,v=f.autoLevelEnabled,m=f.media;if(!(!d||!m)){var g=performance.now(),y=c?c.stats:d.stats,b=c?c.duration:d.duration,S=g-y.loading.start,L=f.minAutoLevel,C=d.level,F=e._nextAutoLevel;if(y.aborted||y.loaded&&y.loaded===y.total||C<=L){e.clearTimer(),e._nextAutoLevel=-1;return}if(v){var N=F>-1&&F!==C,B=!!t||N;if(!(!B&&(m.paused||!m.playbackRate||!m.readyState))){var re=f.mainForwardBufferInfo;if(!(!B&&re===null)){var ce=e.bwEstimator.getEstimateTTFB(),Se=Math.abs(m.playbackRate);if(!(S<=Math.max(ce,1e3*(b/(Se*2))))){var Ke=re?re.len/Se:0,be=y.loading.first?y.loading.first-y.loading.start:-1,Z=y.loaded&&be>-1,ne=e.getBwEstimate(),Re=f.levels,Tt=Re[C],ot=Math.max(y.loaded,Math.round(b*(d.bitrate||Tt.averageBitrate)/8)),pt=Z?S-be:S;pt<1&&Z&&(pt=Math.min(S,y.loaded*8/ne));var Bt=Z?y.loaded*1e3/pt:0,cr=ce/1e3,or=Bt?(ot-y.loaded)/Bt:ot*8/ne+cr;if(!(or<=Ke)){var hr=Bt?Bt*8:ne,xr=((a=(t==null?void 0:t.details)||e.hls.latestLevelDetails)==null?void 0:a.live)===!0,fr=e.hls.config.abrBandWidthUpFactor,lr=Number.POSITIVE_INFINITY,_r;for(_r=C-1;_r>L;_r--){var Dr=Re[_r].maxBitrate,bi=!Re[_r].details||xr;if(lr=e.getTimeToLoadFrag(cr,hr,b*Dr,bi),lr<Math.min(Ke,b+cr))break}if(!(lr>=or)&&!(lr>b*10)){Z?e.bwEstimator.sample(S-Math.min(ce,be),y.loaded):e.bwEstimator.sampleTTFB(S);var jr=Re[_r].maxBitrate;e.getBwEstimate()*fr>jr&&e.resetEstimator(jr);var ji=e.findBestLevel(jr,L,_r,0,Ke,1,1);ji>-1&&(_r=ji),e.warn("Fragment "+d.sn+(c?" part "+c.index:"")+" of level "+C+` is loading too slowly;
      Fragment duration: `+d.duration.toFixed(3)+`
      Time to underbuffer: `+Ke.toFixed(3)+` s
      Estimated load time for current fragment: `+or.toFixed(3)+` s
      Estimated load time for down switch fragment: `+lr.toFixed(3)+` s
      TTFB estimate: `+(be|0)+` ms
      Current BW estimate: `+(Ge(ne)?ne|0:"Unknown")+` bps
      New BW estimate: `+(e.getBwEstimate()|0)+` bps
      Switching to level `+_r+" @ "+(jr|0)+" bps"),f.nextLoadLevel=f.nextAutoLevel=_r,e.clearTimer();var ia=function(){if(e.clearTimer(),e.fragCurrent===d&&e.hls.loadLevel===_r&&_r>0){var sn=e.getStarvationDelay();if(e.warn("Aborting inflight request "+(_r>0?"and switching down":"")+`
      Fragment duration: `+d.duration.toFixed(3)+` s
      Time to underbuffer: `+sn.toFixed(3)+" s"),d.abortRequests(),e.fragCurrent=e.partCurrent=null,_r>L){var Gi=e.findBestLevel(e.hls.levels[L].bitrate,L,_r,0,sn,1,1);Gi===-1&&(Gi=L),e.hls.nextLoadLevel=e.hls.nextAutoLevel=Gi,e.resetEstimator(e.hls.levels[Gi].bitrate)}}};N||or>lr*2?ia():e.timer=self.setInterval(ia,lr*1e3),f.trigger(_.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:c,stats:y})}}}}}}}},e.hls=r,e.bwEstimator=e.initEstimator(),e.registerListeners(),e}Pe(l,s);var n=l.prototype;return n.resetEstimator=function(e){e&&(this.log("setting initial bwe to "+e),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()},n.initEstimator=function(){var e=this.hls.config;return new _e(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)},n.registerListeners=function(){var e=this.hls;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(_.ERROR,this.onError,this)},n.unregisterListeners=function(){var e=this.hls;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(_.ERROR,this.onError,this))},n.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null},n.onManifestLoading=function(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()},n.onLevelsUpdated=function(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null},n.onMaxAutoLevelUpdated=function(){this.firstSelection=-1,this.nextAutoLevelKey=""},n.onFragLoading=function(e,t){var a=t.frag;if(!this.ignoreFragment(a)){if(!a.bitrateTest){var o;this.fragCurrent=a,this.partCurrent=(o=t.part)!=null?o:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}},n.onLevelSwitching=function(e,t){this.clearTimer()},n.onError=function(e,t){if(!t.fatal)switch(t.details){case Q.BUFFER_ADD_CODEC_ERROR:case Q.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Q.FRAG_LOAD_TIMEOUT:{var a=t.frag,o=this.fragCurrent,d=this.partCurrent;if(a&&o&&a.sn===o.sn&&a.level===o.level){var c=performance.now(),f=d?d.stats:a.stats,v=c-f.loading.start,m=f.loading.first?f.loading.first-f.loading.start:-1,g=f.loaded&&m>-1;if(g){var y=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(v-Math.min(y,m),f.loaded)}else this.bwEstimator.sampleTTFB(v)}break}}},n.getTimeToLoadFrag=function(e,t,a,o){var d=e+a/t,c=o?e+this.lastLevelLoadSec:0;return d+c},n.onLevelLoaded=function(e,t){var a=this.hls.config,o=t.stats.loading,d=o.end-o.first;Ge(d)&&(this.lastLevelLoadSec=d/1e3),t.details.live?this.bwEstimator.update(a.abrEwmaSlowLive,a.abrEwmaFastLive):this.bwEstimator.update(a.abrEwmaSlowVoD,a.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)},n.onFragLoaded=function(e,t){var a=t.frag,o=t.part,d=o?o.stats:a.stats;if(a.type===Ie.MAIN&&this.bwEstimator.sampleTTFB(d.loading.first-d.loading.start),!this.ignoreFragment(a)){if(this.clearTimer(),a.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){var c=o?o.duration:a.duration,f=this.hls.levels[a.level],v=(f.loaded?f.loaded.bytes:0)+d.loaded,m=(f.loaded?f.loaded.duration:0)+c;f.loaded={bytes:v,duration:m},f.realBitrate=Math.round(8*v/m)}if(a.bitrateTest){var g={stats:d,frag:a,part:o,id:a.type};this.onFragBuffered(_.FRAG_BUFFERED,g),a.bitrateTest=!1}else this.lastLoadedFragLevel=a.level}},n.onFragBuffered=function(e,t){var a=t.frag,o=t.part,d=o!=null&&o.stats.loaded?o.stats:a.stats;if(!d.aborted&&!this.ignoreFragment(a)){var c=d.parsing.end-d.loading.start-Math.min(d.loading.first-d.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(c,d.loaded),d.bwEstimate=this.getBwEstimate(),a.bitrateTest?this.bitrateTestDelay=c/1e3:this.bitrateTestDelay=0}},n.ignoreFragment=function(e){return e.type!==Ie.MAIN||e.sn==="initSegment"},n.clearTimer=function(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)},n.getAutoLevelKey=function(){return this.getBwEstimate()+"_"+this.getStarvationDelay().toFixed(2)},n.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,a=this.hls;if(a.levels.length<=1)return a.loadLevel;var o=a.maxAutoLevel,d=a.config,c=a.minAutoLevel,f=t?t.duration:e?e.duration:0,v=this.getBwEstimate(),m=this.getStarvationDelay(),g=d.abrBandWidthFactor,y=d.abrBandWidthUpFactor;if(m){var b=this.findBestLevel(v,c,o,m,0,g,y);if(b>=0)return this.rebufferNotice=-1,b}var S=f?Math.min(f,d.maxStarvationDelay):d.maxStarvationDelay;if(!m){var L=this.bitrateTestDelay;if(L){var C=f?Math.min(f,d.maxLoadingDelay):d.maxLoadingDelay;S=C-L,this.info("bitrate test took "+Math.round(1e3*L)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*S)+" ms"),g=y=1}}var F=this.findBestLevel(v,c,o,m,S,g,y);if(this.rebufferNotice!==F&&(this.rebufferNotice=F,this.info((m?"rebuffering expected":"buffer is empty")+", optimal quality level "+F)),F>-1)return F;var N=a.levels[c],B=a.loadLevelObj;return B&&(N==null?void 0:N.bitrate)<B.bitrate?c:a.loadLevel},n.getStarvationDelay=function(){var e=this.hls,t=e.media;if(!t)return 1/0;var a=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,o=e.mainForwardBufferInfo;return(o?o.len:0)/a},n.getBwEstimate=function(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate},n.findBestLevel=function(e,t,a,o,d,c,f){var v,m=this,g=o+d,y=this.lastLoadedFragLevel,b=y===-1?this.hls.firstLevel:y,S=this.fragCurrent,L=this.partCurrent,C=this.hls,F=C.levels,N=C.allAudioTracks,B=C.loadLevel,re=C.config;if(F.length===1)return 0;var ce=F[b],Se=!!((v=this.hls.latestLevelDetails)!=null&&v.live),Ke=B===-1||y===-1,be,Z="SDR",ne=(ce==null?void 0:ce.frameRate)||0,Re=re.audioPreference,Tt=re.videoPreference,ot=this.audioTracksByGroup||(this.audioTracksByGroup=ti(N)),pt=-1;if(Ke){if(this.firstSelection!==-1)return this.firstSelection;var Bt=this.codecTiers||(this.codecTiers=sa(F,ot,t,a)),cr=hi(Bt,Z,e,Re,Tt),or=cr.codecSet,hr=cr.videoRanges,xr=cr.minFramerate,fr=cr.minBitrate,lr=cr.minIndex,_r=cr.preferHDR;pt=lr,be=or,Z=_r?hr[hr.length-1]:hr[0],ne=xr,e=Math.max(e,fr),this.log("picked start tier "+ur(cr))}else be=ce==null?void 0:ce.codecSet,Z=ce==null?void 0:ce.videoRange;for(var Dr=L?L.duration:S?S.duration:0,bi=this.bwEstimator.getEstimateTTFB()/1e3,jr=[],ji=function(){var Gi,si=F[Fi],ir=Fi>b;if(!si)return 0;if(re.useMediaCapabilities&&!si.supportedResult&&!si.supportedPromise){var qa=navigator.mediaCapabilities;typeof(qa==null?void 0:qa.decodingInfo)=="function"&&Cr(si,ot,Z,ne,e,Re)?(si.supportedPromise=gi(si,ot,qa,m.supportedCache),si.supportedPromise.then(function(on){if(m.hls){si.supportedResult=on;var Ql=m.hls.levels,ns=Ql.indexOf(si);on.error?m.warn('MediaCapabilities decodingInfo error: "'+on.error+'" for level '+ns+" "+ur(on)):on.supported?on.decodingInfoResults.some(function(ll){return ll.smooth===!1||ll.powerEfficient===!1})&&m.log("MediaCapabilities decodingInfo for level "+ns+" not smooth or powerEfficient: "+ur(on)):(m.warn("Unsupported MediaCapabilities decodingInfo result for level "+ns+" "+ur(on)),ns>-1&&Ql.length>1&&(m.log("Removing unsupported level "+ns),m.hls.removeLevel(ns),m.hls.loadLevel===-1&&(m.hls.nextLoadLevel=0)))}}).catch(function(on){m.warn("Error handling MediaCapabilities decodingInfo: "+on)})):si.supportedResult=se}if((be&&si.codecSet!==be||Z&&si.videoRange!==Z||ir&&ne>si.frameRate||!ir&&ne>0&&ne<si.frameRate||(Gi=si.supportedResult)!=null&&(Gi=Gi.decodingInfoResults)!=null&&Gi.some(function(on){return on.smooth===!1}))&&(!Ke||Fi!==pt))return jr.push(Fi),0;var Da=si.details,Tn=(L?Da==null?void 0:Da.partTarget:Da==null?void 0:Da.averagetargetduration)||Dr,ca;ir?ca=f*e:ca=c*e;var Pn=Dr&&o>=Dr*2&&d===0?si.averageBitrate:si.maxBitrate,_n=m.getTimeToLoadFrag(bi,ca,Pn*Tn,Da===void 0),Ma=ca>=Pn&&(Fi===y||si.loadError===0&&si.fragmentError===0)&&(_n<=bi||!Ge(_n)||Se&&!m.bitrateTestDelay||_n<g);if(Ma){var ja=m.forcedAutoLevel;return Fi!==B&&(ja===-1||ja!==B)&&(jr.length&&m.trace("Skipped level(s) "+jr.join(",")+" of "+a+' max with CODECS and VIDEO-RANGE:"'+F[jr[0]].codecs+'" '+F[jr[0]].videoRange+'; not compatible with "'+be+'" '+Z),m.info("switch candidate:"+b+"->"+Fi+" adjustedbw("+Math.round(ca)+")-bitrate="+Math.round(ca-Pn)+" ttfb:"+bi.toFixed(1)+" avgDuration:"+Tn.toFixed(1)+" maxFetchDuration:"+g.toFixed(1)+" fetchDuration:"+_n.toFixed(1)+" firstSelection:"+Ke+" codecSet:"+si.codecSet+" videoRange:"+si.videoRange+" hls.loadLevel:"+B)),Ke&&(m.firstSelection=Fi),{v:Fi}}},ia,Fi=a;Fi>=t;Fi--)if(ia=ji(),ia!==0&&ia)return ia.v;return-1},n.deriveNextAutoLevel=function(e){var t=this.hls,a=t.maxAutoLevel,o=t.minAutoLevel;return Math.min(Math.max(e,o),a)},Ne(l,[{key:"firstAutoLevel",get:function(){var e=this.hls,t=e.maxAutoLevel,a=e.minAutoLevel,o=this.getBwEstimate(),d=this.hls.config.maxStarvationDelay,c=this.findBestLevel(o,a,t,0,d,1,1);if(c>-1)return c;var f=this.hls.firstLevel,v=Math.min(Math.max(f,a),t);return this.warn("Could not find best starting auto level. Defaulting to first in playlist "+f+" clamped to "+v),v}},{key:"forcedAutoLevel",get:function(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}},{key:"nextAutoLevel",get:function(){var e=this.forcedAutoLevel,t=this.bwEstimator,a=t.canEstimate(),o=this.lastLoadedFragLevel>-1;if(e!==-1&&(!a||!o||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;var d=a&&o?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){var c=this.hls.levels;if(c.length>Math.max(e,d)&&c[e].loadError<=c[d].loadError)return e}return this._nextAutoLevel=d,this.nextAutoLevelKey=this.getAutoLevelKey(),d},set:function(e){var t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}}])}(Te),us={search:function(l,n){for(var r=0,e=l.length-1,t=null,a=null;r<=e;){t=(r+e)/2|0,a=l[t];var o=n(a);if(o>0)r=t+1;else if(o<0)e=t-1;else return a}return null}};function xn(s,l,n){if(l===null||!Array.isArray(s)||!s.length||!Ge(l))return null;var r=s[0].programDateTime;if(l<(r||0))return null;var e=s[s.length-1].endProgramDateTime;if(l>=(e||0))return null;for(var t=0;t<s.length;++t){var a=s[t];if(wn(l,n,a))return a}return null}function Za(s,l,n,r,e){n===void 0&&(n=0),r===void 0&&(r=0),e===void 0&&(e=.005);var t=null;if(s){t=l[1+s.sn-l[0].sn]||null;var a=s.endDTS-n;a>0&&a<15e-7&&(n+=15e-7),t&&s.level!==t.level&&t.end<=s.end&&(t=l[2+s.sn-l[0].sn]||null)}else n===0&&l[0].start===0&&(t=l[0]);if(t&&((!s||s.level===t.level)&&Ja(n,r,t)===0||fi(t,s,Math.min(e,r))))return t;var o=us.search(l,Ja.bind(null,n,r));return o&&(o!==s||!t)?o:t}function fi(s,l,n){if(l&&l.start===0&&l.level<s.level&&(l.endPTS||0)>0){var r=l.tagList.reduce(function(e,t){return t[0]==="INF"&&(e+=parseFloat(t[1])),e},n);return s.start<=r}return!1}function Ja(s,l,n){if(s===void 0&&(s=0),l===void 0&&(l=0),n.start<=s&&n.start+n.duration>s)return 0;var r=Math.min(l,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-r<=s?1:n.start-r>s&&n.start?-1:0}function wn(s,l,n){var r=Math.min(l,n.duration+(n.deltaPTS?n.deltaPTS:0))*1e3,e=n.endProgramDateTime||0;return e-r>s}function mn(s,l,n){if(s&&s.startCC<=l&&s.endCC>=l){var r=s.fragments,e=s.fragmentHint;e&&(r=r.concat(e));var t;return us.search(r,function(a){return a.cc<l?1:a.cc>l?-1:(t=a,a.end<=n?1:a.start>n?-1:0)}),t||null}return null}function Ba(s){switch(s.details){case Q.FRAG_LOAD_TIMEOUT:case Q.KEY_LOAD_TIMEOUT:case Q.LEVEL_LOAD_TIMEOUT:case Q.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Wn(s){return s.details.startsWith("key")}function pa(s){return Wn(s)&&!!s.frag&&!s.frag.decryptdata}function oa(s,l){var n=Ba(l);return s.default[(n?"timeout":"error")+"Retry"]}function ki(s,l){var n=s.backoff==="linear"?1:Math.pow(2,l);return Math.min(n*s.retryDelayMs,s.maxRetryDelayMs)}function pn(s){return j(j({},s),{errorRetry:null,timeoutRetry:null})}function Yn(s,l,n,r){if(!s)return!1;var e=r==null?void 0:r.code,t=l<s.maxNumRetry&&(M(e)||!!n);return s.shouldRetry?s.shouldRetry(s,l,n,r,t):t}function M(s){return P(s)||!!s&&(s<400||s>499)}function P(s){return s===0&&navigator.onLine===!1}var q={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},ue={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4},le=function(s){function l(r){var e;return e=s.call(this,"error-controller",r.logger)||this,e.hls=void 0,e.playlistError=0,e.hls=r,e.registerListeners(),e}Pe(l,s);var n=l.prototype;return n.registerListeners=function(){var e=this.hls;e.on(_.ERROR,this.onError,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this)},n.unregisterListeners=function(){var e=this.hls;e&&(e.off(_.ERROR,this.onError,this),e.off(_.ERROR,this.onErrorOut,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this))},n.destroy=function(){this.unregisterListeners(),this.hls=null},n.startLoad=function(e){},n.stopLoad=function(){this.playlistError=0},n.getVariantLevelIndex=function(e){return(e==null?void 0:e.type)===Ie.MAIN?e.level:this.getVariantIndex()},n.getVariantIndex=function(){var e,t=this.hls,a=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||a===-1?t.loadLevel:a},n.variantHasKey=function(e,t){if(e){var a;if((a=e.details)!=null&&a.hasKey(t))return!0;var o=e.audioGroups;if(o){var d=this.hls.allAudioTracks.filter(function(c){return o.indexOf(c.groupId)>=0});return d.some(function(c){var f;return(f=c.details)==null?void 0:f.hasKey(t)})}}return!1},n.onManifestLoading=function(){this.playlistError=0},n.onLevelUpdated=function(){this.playlistError=0},n.onError=function(e,t){var a;if(!t.fatal){var o=this.hls,d=t.context;switch(t.details){case Q.FRAG_LOAD_ERROR:case Q.FRAG_LOAD_TIMEOUT:case Q.KEY_LOAD_ERROR:case Q.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case Q.FRAG_PARSING_ERROR:if((a=t.frag)!=null&&a.gap){t.errorAction=We();return}case Q.FRAG_GAP:case Q.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=q.SendAlternateToPenaltyBox;return}case Q.LEVEL_EMPTY_ERROR:case Q.LEVEL_PARSING_ERROR:{var c,f=t.parent===Ie.MAIN?t.level:o.loadLevel;t.details===Q.LEVEL_EMPTY_ERROR&&((c=t.context)!=null&&(c=c.levelDetails)!=null&&c.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,f):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,f))}return;case Q.LEVEL_LOAD_ERROR:case Q.LEVEL_LOAD_TIMEOUT:typeof(d==null?void 0:d.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,d.level));return;case Q.AUDIO_TRACK_LOAD_ERROR:case Q.AUDIO_TRACK_LOAD_TIMEOUT:case Q.SUBTITLE_LOAD_ERROR:case Q.SUBTITLE_TRACK_LOAD_TIMEOUT:if(d){var v=o.loadLevelObj;if(v&&(d.type===pe.AUDIO_TRACK&&v.hasAudioGroup(d.groupId)||d.type===pe.SUBTITLE_TRACK&&v.hasSubtitleGroup(d.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.loadLevel),t.errorAction.action=q.SendAlternateToPenaltyBox,t.errorAction.flags=ue.MoveAllAlternatesMatchingHost;return}}return;case Q.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:q.SendAlternateToPenaltyBox,flags:ue.MoveAllAlternatesMatchingHDCP};return;case Q.KEY_SYSTEM_SESSION_UPDATE_FAILED:case Q.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case Q.KEY_SYSTEM_NO_SESSION:t.errorAction={action:q.SendAlternateToPenaltyBox,flags:ue.MoveAllAlternatesMatchingKey};return;case Q.BUFFER_ADD_CODEC_ERROR:case Q.REMUX_ALLOC_ERROR:case Q.BUFFER_APPEND_ERROR:if(!t.errorAction){var m;t.errorAction=this.getLevelSwitchAction(t,(m=t.level)!=null?m:o.loadLevel)}return;case Q.INTERNAL_EXCEPTION:case Q.BUFFER_APPENDING_ERROR:case Q.BUFFER_FULL_ERROR:case Q.LEVEL_SWITCH_ERROR:case Q.BUFFER_STALLED_ERROR:case Q.BUFFER_SEEK_OVER_HOLE:case Q.BUFFER_NUDGE_ON_STALL:t.errorAction=We();return}t.type===ut.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=We())}},n.getPlaylistRetryOrSwitchAction=function(e,t){var a=this.hls,o=oa(a.config.playlistLoadPolicy,e),d=this.playlistError++,c=Yn(o,d,Ba(e),e.response);if(c)return{action:q.RetryRequest,flags:ue.None,retryConfig:o,retryCount:d};var f=this.getLevelSwitchAction(e,t);return o&&(f.retryConfig=o,f.retryCount=d),f},n.getFragRetryOrSwitchAction=function(e){var t=this.hls,a=this.getVariantLevelIndex(e.frag),o=t.levels[a],d=t.config,c=d.fragLoadPolicy,f=d.keyLoadPolicy,v=oa(Wn(e)?f:c,e),m=t.levels.reduce(function(b,S){return b+S.fragmentError},0);if(o&&(e.details!==Q.FRAG_GAP&&o.fragmentError++,!pa(e))){var g=Yn(v,m,Ba(e),e.response);if(g)return{action:q.RetryRequest,flags:ue.None,retryConfig:v,retryCount:m}}var y=this.getLevelSwitchAction(e,a);return v&&(y.retryConfig=v,y.retryCount=m),y},n.getLevelSwitchAction=function(e,t){var a=this.hls;t==null&&(t=a.loadLevel);var o=this.hls.levels[t];if(o){var d,c,f=e.details;o.loadError++,f===Q.BUFFER_APPEND_ERROR&&o.fragmentError++;var v=-1,m=a.levels,g=a.loadLevel,y=a.minAutoLevel,b=a.maxAutoLevel;!a.autoLevelEnabled&&!a.config.preserveManualLevelOnError&&(a.loadLevel=-1);for(var S=(d=e.frag)==null?void 0:d.type,L=S===Ie.AUDIO&&f===Q.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(f===Q.BUFFER_ADD_CODEC_ERROR||f===Q.BUFFER_APPEND_ERROR),C=L&&m.some(function(Z){var ne=Z.audioCodec;return o.audioCodec!==ne}),F=e.sourceBufferName==="video"&&(f===Q.BUFFER_ADD_CODEC_ERROR||f===Q.BUFFER_APPEND_ERROR),N=F&&m.some(function(Z){var ne=Z.codecSet,Re=Z.audioCodec;return o.codecSet!==ne&&o.audioCodec===Re}),B=(c=e.context)!=null?c:{},re=B.type,ce=B.groupId,Se=function(){var ne=(be+g)%m.length;if(ne!==g&&ne>=y&&ne<=b&&m[ne].loadError===0){var Re,Tt,ot=m[ne];if(f===Q.FRAG_GAP&&S===Ie.MAIN&&e.frag){var pt=m[ne].details;if(pt){var Bt=Za(e.frag,pt.fragments,e.frag.start);if(Bt!=null&&Bt.gap)return 0}}else{if(re===pe.AUDIO_TRACK&&ot.hasAudioGroup(ce)||re===pe.SUBTITLE_TRACK&&ot.hasSubtitleGroup(ce))return 0;if(S===Ie.AUDIO&&(Re=o.audioGroups)!=null&&Re.some(function(cr){return ot.hasAudioGroup(cr)})||S===Ie.SUBTITLE&&(Tt=o.subtitleGroups)!=null&&Tt.some(function(cr){return ot.hasSubtitleGroup(cr)})||C&&o.audioCodec===ot.audioCodec||N&&o.codecSet===ot.codecSet||!C&&o.codecSet!==ot.codecSet)return 0}return v=ne,1}},Ke,be=m.length;be--&&(Ke=Se(),!(Ke!==0&&Ke===1)););if(v>-1&&a.loadLevel!==v)return e.levelRetry=!0,this.playlistError=0,{action:q.SendAlternateToPenaltyBox,flags:ue.None,nextAutoLevel:v}}return{action:q.SendAlternateToPenaltyBox,flags:ue.MoveAllAlternatesMatchingHost}},n.onErrorOut=function(e,t){var a;switch((a=t.errorAction)==null?void 0:a.action){case q.DoNothing:break;case q.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==Q.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn('MediaSource ended after "'+t.sourceBufferName+'" sourceBuffer append error. Attempting to recover from media error.'),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}},n.sendAlternateToPenaltyBox=function(e){var t=this.hls,a=e.errorAction;if(a){var o=a.flags,d=a.nextAutoLevel;switch(o){case ue.None:this.switchLevel(e,d);break;case ue.MoveAllAlternatesMatchingHDCP:{var c=this.getVariantLevelIndex(e.frag),f=t.levels[c],v=f==null?void 0:f.attrs["HDCP-LEVEL"];if(a.hdcpLevel=v,v==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(v){t.maxHdcpLevel=Zi[Zi.indexOf(v)-1],a.resolved=!0,this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower');break}}case ue.MoveAllAlternatesMatchingKey:{var m=e.decryptdata;if(m){for(var g=this.hls.levels,y=g.length,b=y;b--;)if(this.variantHasKey(g[b],m)){var S,L;this.log("Banned key found in level "+b+" ("+g[b].bitrate+'bps) or audio group "'+((S=g[b].audioGroups)==null?void 0:S.join(","))+'" ('+((L=e.frag)==null?void 0:L.type)+" fragment) "+Ut(m.keyId||[])),g[b].fragmentError++,g[b].loadError++,this.log("Removing level "+b+" with key error ("+e.error+")"),this.hls.removeLevel(b)}var C=e.frag;if(this.hls.levels.length<y)a.resolved=!0;else if(C&&C.type!==Ie.MAIN){var F=C.decryptdata;F&&!m.matches(F)&&(a.resolved=!0)}}break}}a.resolved||this.switchLevel(e,d)}},n.switchLevel=function(e,t){if(t!==void 0&&e.errorAction&&(this.warn("switching to level "+t+" after "+e.details),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===Q.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo"))for(var a=ha(e.mimeType),o=this.hls.levels,d=o.length;d--;)o[d][e.sourceBufferName+"Codec"]===a&&(this.log("Removing level "+d+" for "+e.details+' ("'+a+'" not supported)'),this.hls.removeLevel(d))},l}(Te);function We(s){var l={action:q.DoNothing,flags:ue.None};return s&&(l.resolved=!0),l}var xe={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"},lt=function(){function s(n){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=n,this._registerListeners()}var l=s.prototype;return l._registerListeners=function(){var r=this.hls;r&&(r.on(_.MANIFEST_LOADING,this.onManifestLoading,this),r.on(_.BUFFER_APPENDED,this.onBufferAppended,this),r.on(_.FRAG_BUFFERED,this.onFragBuffered,this),r.on(_.FRAG_LOADED,this.onFragLoaded,this))},l._unregisterListeners=function(){var r=this.hls;r&&(r.off(_.MANIFEST_LOADING,this.onManifestLoading,this),r.off(_.BUFFER_APPENDED,this.onBufferAppended,this),r.off(_.FRAG_BUFFERED,this.onFragBuffered,this),r.off(_.FRAG_LOADED,this.onFragLoaded,this))},l.destroy=function(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null},l.getAppendedFrag=function(r,e){var t=this.activePartLists[e];if(t)for(var a=t.length;a--;){var o=t[a];if(!o)break;if(o.start<=r&&r<=o.end&&o.loaded)return o}return this.getBufferedFrag(r,e)},l.getBufferedFrag=function(r,e){return this.getFragAtPos(r,e,!0)},l.getFragAtPos=function(r,e,t){for(var a=this.fragments,o=Object.keys(a),d=o.length;d--;){var c=a[o[d]];if((c==null?void 0:c.body.type)===e&&(!t||c.buffered)){var f=c.body;if(f.start<=r&&r<=f.end)return f}}return null},l.detectEvictedFragments=function(r,e,t,a,o){var d=this;this.timeRanges&&(this.timeRanges[r]=e);var c=(a==null?void 0:a.fragment.sn)||-1;Object.keys(this.fragments).forEach(function(f){var v=d.fragments[f];if(v&&!(c>=v.body.sn)){if(!v.buffered&&(!v.loaded||o)){v.body.type===t&&d.removeFragment(v.body);return}var m=v.range[r];if(m){if(m.time.length===0){d.removeFragment(v.body);return}m.time.some(function(g){var y=!d.isTimeBuffered(g.startPTS,g.endPTS,e);return y&&d.removeFragment(v.body),y})}}})},l.detectPartialFragments=function(r){var e=this,t=this.timeRanges;if(!(!t||r.frag.sn==="initSegment")){var a=r.frag,o=wt(a),d=this.fragments[o];if(!(!d||d.buffered&&a.gap)){var c=!a.relurl;Object.keys(t).forEach(function(f){var v=a.elementaryStreams[f];if(v){var m=t[f],g=c||v.partial===!0;d.range[f]=e.getBufferedTimes(a,r.part,g,m)}}),d.loaded=null,Object.keys(d.range).length?(this.bufferedEnd(d,a),Ce(d)||this.removeParts(a.sn-1,a.type)):this.removeFragment(d.body)}}},l.bufferedEnd=function(r,e){r.buffered=!0;var t=r.body.endList=e.endList||r.body.endList;t&&(this.endListFragments[r.body.type]=r)},l.removeParts=function(r,e){var t=this.activePartLists[e];t&&(this.activePartLists[e]=gt(t,function(a){return a.fragment.sn>=r}))},l.fragBuffered=function(r,e){var t=wt(r),a=this.fragments[t];!a&&e&&(a=this.fragments[t]={body:r,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},r.gap&&(this.hasGaps=!0)),a&&(a.loaded=null,this.bufferedEnd(a,r))},l.getBufferedTimes=function(r,e,t,a){for(var o={time:[],partial:t},d=r.start,c=r.end,f=r.minEndPTS||c,v=r.maxStartPTS||d,m=0;m<a.length;m++){var g=a.start(m)-this.bufferPadding,y=a.end(m)+this.bufferPadding;if(v>=g&&f<=y){o.time.push({startPTS:Math.max(d,a.start(m)),endPTS:Math.min(c,a.end(m))});break}else if(d<y&&c>g){var b=Math.max(d,a.start(m)),S=Math.min(c,a.end(m));S>b&&(o.partial=!0,o.time.push({startPTS:b,endPTS:S}))}else if(c<=g)break}return o},l.getPartialFragment=function(r){var e=null,t,a,o,d=0,c=this.bufferPadding,f=this.fragments;return Object.keys(f).forEach(function(v){var m=f[v];m&&Ce(m)&&(a=m.body.start-c,o=m.body.end+c,r>=a&&r<=o&&(t=Math.min(r-a,o-r),d<=t&&(e=m.body,d=t)))}),e},l.isEndListAppended=function(r){var e=this.endListFragments[r];return e!==void 0&&(e.buffered||Ce(e))},l.getState=function(r){var e=wt(r),t=this.fragments[e];return t?t.buffered?Ce(t)?xe.PARTIAL:xe.OK:xe.APPENDING:xe.NOT_LOADED},l.isTimeBuffered=function(r,e,t){for(var a,o,d=0;d<t.length;d++){if(a=t.start(d)-this.bufferPadding,o=t.end(d)+this.bufferPadding,r>=a&&e<=o)return!0;if(e<=a)return!1}return!1},l.onManifestLoading=function(){this.removeAllFragments()},l.onFragLoaded=function(r,e){if(!(e.frag.sn==="initSegment"||e.frag.bitrateTest)){var t=e.frag,a=e.part?null:e,o=wt(t);this.fragments[o]={body:t,appendedPTS:null,loaded:a,buffered:!1,range:Object.create(null)}}},l.onBufferAppended=function(r,e){var t=e.frag,a=e.part,o=e.timeRanges,d=e.type;if(t.sn!=="initSegment"){var c=t.type;if(a){var f=this.activePartLists[c];f||(this.activePartLists[c]=f=[]),f.push(a)}this.timeRanges=o;var v=o[d];this.detectEvictedFragments(d,v,c,a)}},l.onFragBuffered=function(r,e){this.detectPartialFragments(e)},l.hasFragment=function(r){var e=wt(r);return!!this.fragments[e]},l.hasFragments=function(r){var e=this.fragments,t=Object.keys(e);if(!r)return t.length>0;for(var a=t.length;a--;){var o=e[t[a]];if((o==null?void 0:o.body.type)===r)return!0}return!1},l.hasParts=function(r){var e;return!!((e=this.activePartLists[r])!=null&&e.length)},l.removeFragmentsInRange=function(r,e,t,a,o){var d=this;a&&!this.hasGaps||Object.keys(this.fragments).forEach(function(c){var f=d.fragments[c];if(f){var v=f.body;v.type!==t||a&&!v.gap||v.start<e&&v.end>r&&(f.buffered||o)&&d.removeFragment(v)}})},l.removeFragment=function(r){var e=wt(r);r.clearElementaryStreamInfo();var t=this.activePartLists[r.type];if(t){var a=r.sn;this.activePartLists[r.type]=gt(t,function(o){return o.fragment.sn!==a})}delete this.fragments[e],r.endList&&delete this.endListFragments[r.type]},l.removeAllFragments=function(){var r;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;var e=(r=this.hls)==null||(r=r.latestLevelDetails)==null?void 0:r.partList;e&&e.forEach(function(t){return t.clearElementaryStreamInfo()})},s}();function Ce(s){var l,n,r;return s.buffered&&!!(s.body.gap||(l=s.range.video)!=null&&l.partial||(n=s.range.audio)!=null&&n.partial||(r=s.range.audiovideo)!=null&&r.partial)}function wt(s){return s.type+"_"+s.level+"_"+s.sn}function gt(s,l){return s.filter(function(n){var r=l(n);return r||n.clearElementaryStreamInfo(),r})}var Yt={cbc:0,ctr:1},mr=function(){function s(n,r,e){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=n,this.aesIV=r,this.aesMode=e}var l=s.prototype;return l.decrypt=function(r,e){switch(this.aesMode){case Yt.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,r);case Yt.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},e,r);default:throw new Error("[AESCrypto] invalid aes mode "+this.aesMode)}},s}();function pr(s){var l=s.byteLength,n=l&&new DataView(s.buffer).getUint8(l-1);return n?s.slice(0,l-n):s}var Tr=function(){function s(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var l=s.prototype;return l.uint8ArrayToUint32Array_=function(r){for(var e=new DataView(r),t=new Uint32Array(4),a=0;a<4;a++)t[a]=e.getUint32(a*4);return t},l.initTable=function(){var r=this.sBox,e=this.invSBox,t=this.subMix,a=t[0],o=t[1],d=t[2],c=t[3],f=this.invSubMix,v=f[0],m=f[1],g=f[2],y=f[3],b=new Uint32Array(256),S=0,L=0,C=0;for(C=0;C<256;C++)C<128?b[C]=C<<1:b[C]=C<<1^283;for(C=0;C<256;C++){var F=L^L<<1^L<<2^L<<3^L<<4;F=F>>>8^F&255^99,r[S]=F,e[F]=S;var N=b[S],B=b[N],re=b[B],ce=b[F]*257^F*16843008;a[S]=ce<<24|ce>>>8,o[S]=ce<<16|ce>>>16,d[S]=ce<<8|ce>>>24,c[S]=ce,ce=re*16843009^B*65537^N*257^S*16843008,v[F]=ce<<24|ce>>>8,m[F]=ce<<16|ce>>>16,g[F]=ce<<8|ce>>>24,y[F]=ce,S?(S=N^b[b[b[re^N]]],L^=b[b[L]]):S=L=1}},l.expandKey=function(r){for(var e=this.uint8ArrayToUint32Array_(r),t=!0,a=0;a<e.length&&t;)t=e[a]===this.key[a],a++;if(!t){this.key=e;var o=this.keySize=e.length;if(o!==4&&o!==6&&o!==8)throw new Error("Invalid aes key size="+o);var d=this.ksRows=(o+6+1)*4,c,f,v=this.keySchedule=new Uint32Array(d),m=this.invKeySchedule=new Uint32Array(d),g=this.sBox,y=this.rcon,b=this.invSubMix,S=b[0],L=b[1],C=b[2],F=b[3],N,B;for(c=0;c<d;c++){if(c<o){N=v[c]=e[c];continue}B=N,c%o===0?(B=B<<8|B>>>24,B=g[B>>>24]<<24|g[B>>>16&255]<<16|g[B>>>8&255]<<8|g[B&255],B^=y[c/o|0]<<24):o>6&&c%o===4&&(B=g[B>>>24]<<24|g[B>>>16&255]<<16|g[B>>>8&255]<<8|g[B&255]),v[c]=N=(v[c-o]^B)>>>0}for(f=0;f<d;f++)c=d-f,f&3?B=v[c]:B=v[c-4],f<4||c<=4?m[f]=B:m[f]=S[g[B>>>24]]^L[g[B>>>16&255]]^C[g[B>>>8&255]]^F[g[B&255]],m[f]=m[f]>>>0}},l.networkToHostOrderSwap=function(r){return r<<24|(r&65280)<<8|(r&16711680)>>8|r>>>24},l.decrypt=function(r,e,t){for(var a=this.keySize+6,o=this.invKeySchedule,d=this.invSBox,c=this.invSubMix,f=c[0],v=c[1],m=c[2],g=c[3],y=this.uint8ArrayToUint32Array_(t),b=y[0],S=y[1],L=y[2],C=y[3],F=new Int32Array(r),N=new Int32Array(F.length),B,re,ce,Se,Ke,be,Z,ne,Re,Tt,ot,pt,Bt,cr,or=this.networkToHostOrderSwap;e<F.length;){for(Re=or(F[e]),Tt=or(F[e+1]),ot=or(F[e+2]),pt=or(F[e+3]),Ke=Re^o[0],be=pt^o[1],Z=ot^o[2],ne=Tt^o[3],Bt=4,cr=1;cr<a;cr++)B=f[Ke>>>24]^v[be>>16&255]^m[Z>>8&255]^g[ne&255]^o[Bt],re=f[be>>>24]^v[Z>>16&255]^m[ne>>8&255]^g[Ke&255]^o[Bt+1],ce=f[Z>>>24]^v[ne>>16&255]^m[Ke>>8&255]^g[be&255]^o[Bt+2],Se=f[ne>>>24]^v[Ke>>16&255]^m[be>>8&255]^g[Z&255]^o[Bt+3],Ke=B,be=re,Z=ce,ne=Se,Bt=Bt+4;B=d[Ke>>>24]<<24^d[be>>16&255]<<16^d[Z>>8&255]<<8^d[ne&255]^o[Bt],re=d[be>>>24]<<24^d[Z>>16&255]<<16^d[ne>>8&255]<<8^d[Ke&255]^o[Bt+1],ce=d[Z>>>24]<<24^d[ne>>16&255]<<16^d[Ke>>8&255]<<8^d[be&255]^o[Bt+2],Se=d[ne>>>24]<<24^d[Ke>>16&255]<<16^d[be>>8&255]<<8^d[Z&255]^o[Bt+3],N[e]=or(B^b),N[e+1]=or(Se^S),N[e+2]=or(ce^L),N[e+3]=or(re^C),b=Re,S=Tt,L=ot,C=pt,e=e+4}return N.buffer},s}(),Ur=function(){function s(n,r,e){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=n,this.key=r,this.aesMode=e}var l=s.prototype;return l.expandKey=function(){var r=wr(this.aesMode);return this.subtle.importKey("raw",this.key,{name:r},!1,["encrypt","decrypt"])},s}();function wr(s){switch(s){case Yt.cbc:return"AES-CBC";case Yt.ctr:return"AES-CTR";default:throw new Error("[FastAESKey] invalid aes mode "+s)}}var Fr=16,Xr=function(){function s(n,r){var e=r===void 0?{}:r,t=e.removePKCS7Padding,a=t===void 0?!0:t;if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=n.enableSoftwareAES,this.removePKCS7Padding=a,a)try{var o=self.crypto;o&&(this.subtle=o.subtle||o.webkitSubtle)}catch(d){}this.useSoftware=!this.subtle}var l=s.prototype;return l.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},l.isSync=function(){return this.useSoftware},l.flush=function(){var r=this.currentResult,e=this.remainderData;if(!r||e)return this.reset(),null;var t=new Uint8Array(r);return this.reset(),this.removePKCS7Padding?pr(t):t},l.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},l.decrypt=function(r,e,t,a){var o=this;return this.useSoftware?new Promise(function(d,c){var f=ArrayBuffer.isView(r)?r:new Uint8Array(r);o.softwareDecrypt(f,e,t,a);var v=o.flush();v?d(v.buffer):c(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(r),e,t,a)},l.softwareDecrypt=function(r,e,t,a){var o=this.currentIV,d=this.currentResult,c=this.remainderData;if(a!==Yt.cbc||e.byteLength!==16)return U.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),c&&(r=ie(c,r),this.remainderData=null);var f=this.getValidChunk(r);if(!f.length)return null;o&&(t=o);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new Tr),v.expandKey(e);var m=d;return this.currentResult=v.decrypt(f.buffer,0,t),this.currentIV=f.slice(-16).buffer,m||null},l.webCryptoDecrypt=function(r,e,t,a){var o=this;if(this.key!==e||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(r,e,t,a));this.key=e,this.fastAesKey=new Ur(this.subtle,e,a)}return this.fastAesKey.expandKey().then(function(d){if(!o.subtle)return Promise.reject(new Error("web crypto not initialized"));o.logOnce("WebCrypto AES decrypt");var c=new mr(o.subtle,new Uint8Array(t),a);return c.decrypt(r.buffer,d)}).catch(function(d){return U.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+d.name+": "+d.message),o.onWebCryptoError(r,e,t,a)})},l.onWebCryptoError=function(r,e,t,a){var o=this.enableSoftwareAES;if(o){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(r,e,t,a);var d=this.flush();if(d)return d.buffer}throw new Error("WebCrypto"+(o?" and softwareDecrypt":"")+": failed to decrypt data")},l.getValidChunk=function(r){var e=r,t=r.length-r.length%Fr;return t!==r.length&&(e=r.slice(0,t),this.remainderData=r.slice(t)),e},l.logOnce=function(r){this.logEnabled&&(U.log("[decrypter]: "+r),this.logEnabled=!1)},s}(),dr=Math.pow(2,17),Ki=function(){function s(n){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=n}var l=s.prototype;return l.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},l.abort=function(){this.loader&&this.loader.abort()},l.load=function(r,e){var t=this,a=r.url;if(!a)return Promise.reject(new ga({type:ut.NETWORK_ERROR,details:Q.FRAG_LOAD_ERROR,fatal:!1,frag:r,error:new Error("Fragment does not have a "+(a?"part list":"url")),networkDetails:null}));this.abort();var o=this.config,d=o.fLoader,c=o.loader;return new Promise(function(f,v){if(t.loader&&t.loader.destroy(),r.gap)if(r.tagList.some(function(L){return L[0]==="GAP"})){v(Ha(r));return}else r.gap=!1;var m=t.loader=d?new d(o):new c(o),g=$i(r);r.loader=m;var y=pn(o.fragLoadPolicy.default),b={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:r.sn==="initSegment"?1/0:dr};r.stats=m.stats;var S={onSuccess:function(C,F,N,B){t.resetLoader(r,m);var re=C.data;N.resetIV&&r.decryptdata&&(r.decryptdata.iv=new Uint8Array(re.slice(0,16)),re=re.slice(16)),f({frag:r,part:null,payload:re,networkDetails:B})},onError:function(C,F,N,B){t.resetLoader(r,m),v(new ga({type:ut.NETWORK_ERROR,details:Q.FRAG_LOAD_ERROR,fatal:!1,frag:r,response:j({url:a,data:void 0},C),error:new Error("HTTP Error "+C.code+" "+C.text),networkDetails:N,stats:B}))},onAbort:function(C,F,N){t.resetLoader(r,m),v(new ga({type:ut.NETWORK_ERROR,details:Q.INTERNAL_ABORTED,fatal:!1,frag:r,error:new Error("Aborted"),networkDetails:N,stats:C}))},onTimeout:function(C,F,N){t.resetLoader(r,m),v(new ga({type:ut.NETWORK_ERROR,details:Q.FRAG_LOAD_TIMEOUT,fatal:!1,frag:r,error:new Error("Timeout after "+b.timeout+"ms"),networkDetails:N,stats:C}))}};e&&(S.onProgress=function(L,C,F,N){return e({frag:r,part:null,payload:F,networkDetails:N})}),m.load(g,b,S)})},l.loadPart=function(r,e,t){var a=this;this.abort();var o=this.config,d=o.fLoader,c=o.loader;return new Promise(function(f,v){if(a.loader&&a.loader.destroy(),r.gap||e.gap){v(Ha(r,e));return}var m=a.loader=d?new d(o):new c(o),g=$i(r,e);r.loader=m;var y=pn(o.fragLoadPolicy.default),b={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:dr};e.stats=m.stats,m.load(g,b,{onSuccess:function(L,C,F,N){a.resetLoader(r,m),a.updateStatsFromPart(r,e);var B={frag:r,part:e,payload:L.data,networkDetails:N};t(B),f(B)},onError:function(L,C,F,N){a.resetLoader(r,m),v(new ga({type:ut.NETWORK_ERROR,details:Q.FRAG_LOAD_ERROR,fatal:!1,frag:r,part:e,response:j({url:g.url,data:void 0},L),error:new Error("HTTP Error "+L.code+" "+L.text),networkDetails:F,stats:N}))},onAbort:function(L,C,F){r.stats.aborted=e.stats.aborted,a.resetLoader(r,m),v(new ga({type:ut.NETWORK_ERROR,details:Q.INTERNAL_ABORTED,fatal:!1,frag:r,part:e,error:new Error("Aborted"),networkDetails:F,stats:L}))},onTimeout:function(L,C,F){a.resetLoader(r,m),v(new ga({type:ut.NETWORK_ERROR,details:Q.FRAG_LOAD_TIMEOUT,fatal:!1,frag:r,part:e,error:new Error("Timeout after "+b.timeout+"ms"),networkDetails:F,stats:L}))}})})},l.updateStatsFromPart=function(r,e){var t=r.stats,a=e.stats,o=a.total;if(t.loaded+=a.loaded,o){var d=Math.round(r.duration/e.duration),c=Math.min(Math.round(t.loaded/o),d),f=d-c,v=f*Math.round(t.loaded/c);t.total=t.loaded+v}else t.total=Math.max(t.loaded,t.total);var m=t.loading,g=a.loading;m.start?m.first+=g.first-g.start:(m.start=g.start,m.first=g.first),m.end=g.end},l.resetLoader=function(r,e){r.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()},s}();function $i(s,l){l===void 0&&(l=null);var n=l||s,r={frag:s,part:l,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},e=n.byteRangeStartOffset,t=n.byteRangeEndOffset;if(Ge(e)&&Ge(t)){var a,o=e,d=t;if(s.sn==="initSegment"&&$n((a=s.decryptdata)==null?void 0:a.method)){var c=t-e;c%16&&(d=t+(16-c%16)),e!==0&&(r.resetIV=!0,o=e-16)}r.rangeStart=o,r.rangeEnd=d}return r}function Ha(s,l){var n=new Error("GAP "+(s.gap?"tag":"attribute")+" found"),r={type:ut.MEDIA_ERROR,details:Q.FRAG_GAP,fatal:!1,frag:s,error:n,networkDetails:null};return l&&(r.part=l),(l||s).stats.aborted=!0,new ga(r)}function $n(s){return s==="AES-128"||s==="AES-256"}var ga=function(s){function l(n){var r;return r=s.call(this,n.error.message)||this,r.data=void 0,r.data=n,r}return Pe(l,s),l}(Et(Error)),Va=function(s){function l(r,e){var t;return t=s.call(this,r,e)||this,t._boundTick=void 0,t._tickTimer=null,t._tickInterval=null,t._tickCallCount=0,t._boundTick=t.tick.bind(t),t}Pe(l,s);var n=l.prototype;return n.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},n.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},n.onHandlerDestroyed=function(){},n.hasInterval=function(){return!!this._tickInterval},n.hasNextTick=function(){return!!this._tickTimer},n.setInterval=function(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)},n.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},n.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},n.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},n.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},n.doTick=function(){},l}(Te),qn=function(l,n,r,e,t,a){e===void 0&&(e=0),t===void 0&&(t=-1),a===void 0&&(a=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Cn(),this.buffering={audio:Cn(),video:Cn(),audiovideo:Cn()},this.level=l,this.sn=n,this.id=r,this.size=e,this.part=t,this.partial=a};function Cn(){return{start:0,executeStart:0,executeEnd:0,end:0}}var Ys={length:0,start:function(){return 0},end:function(){return 0}},Pr=function(){function s(){}return s.isBuffered=function(n,r){if(n){for(var e=s.getBuffered(n),t=e.length;t--;)if(r>=e.start(t)&&r<=e.end(t))return!0}return!1},s.bufferedRanges=function(n){if(n){var r=s.getBuffered(n);return s.timeRangesToArray(r)}return[]},s.timeRangesToArray=function(n){for(var r=[],e=0;e<n.length;e++)r.push({start:n.start(e),end:n.end(e)});return r},s.bufferInfo=function(n,r,e){if(n){var t=s.bufferedRanges(n);if(t.length)return s.bufferedInfo(t,r,e)}return{len:0,start:r,end:r,bufferedIndex:-1}},s.bufferedInfo=function(n,r,e){r=Math.max(0,r),n.length>1&&n.sort(function(L,C){return L.start-C.start||C.end-L.end});var t=-1,a=[];if(e)for(var o=0;o<n.length;o++){r>=n[o].start&&r<=n[o].end&&(t=o);var d=a.length;if(d){var c=a[d-1].end;n[o].start-c<e?n[o].end>c&&(a[d-1].end=n[o].end):a.push(n[o])}else a.push(n[o])}else a=n;for(var f=0,v,m=r,g=r,y=0;y<a.length;y++){var b=a[y].start,S=a[y].end;if(t===-1&&r>=b&&r<=S&&(t=y),r+e>=b&&r<S)m=b,g=S,f=g-r;else if(r+e<b){v=b;break}}return{len:f,start:m||0,end:g||0,nextStart:v,buffered:n,bufferedIndex:t}},s.getBuffered=function(n){try{return n.buffered||Ys}catch(r){return U.log("failed to get media.buffered",r),Ys}},s}(),La=/\{\$([a-zA-Z0-9-_]+)\}/g;function ho(s){return La.test(s)}function Ga(s,l){if(s.variableList!==null||s.hasVariableRefs){var n=s.variableList;return l.replace(La,function(r){var e=r.substring(2,r.length-1),t=n==null?void 0:n[e];return t===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+e+'"')),r):t})}return l}function _s(s,l,n){var r=s.variableList;r||(s.variableList=r={});var e,t;if("QUERYPARAM"in l){e=l.QUERYPARAM;try{var a=new self.URL(n).searchParams;if(a.has(e))t=a.get(e);else throw new Error('"'+e+'" does not match any query parameter in URI: "'+n+'"')}catch(o){s.playlistParsingError||(s.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+o.message))}}else e=l.NAME,t=l.VALUE;e in r?s.playlistParsingError||(s.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+e+'"')):r[e]=t||""}function fo(s,l,n){var r=l.IMPORT;if(n&&r in n){var e=s.variableList;e||(s.variableList=e={}),e[r]=n[r]}else s.playlistParsingError||(s.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+r+'"'))}var ml=/^(\d+)x(\d+)$/,$s=/(.+?)=(".*?"|.*?)(?:,|$)/g,Hi=function(){function s(n,r){typeof n=="string"&&(n=s.parseAttrList(n,r)),Qe(this,n)}var l=s.prototype;return l.decimalInteger=function(r){var e=parseInt(this[r],10);return e>Number.MAX_SAFE_INTEGER?1/0:e},l.hexadecimalInteger=function(r){if(this[r]){var e=(this[r]||"0x").slice(2);e=(e.length&1?"0":"")+e;for(var t=new Uint8Array(e.length/2),a=0;a<e.length/2;a++)t[a]=parseInt(e.slice(a*2,a*2+2),16);return t}return null},l.hexadecimalIntegerAsNumber=function(r){var e=parseInt(this[r],16);return e>Number.MAX_SAFE_INTEGER?1/0:e},l.decimalFloatingPoint=function(r){return parseFloat(this[r])},l.optionalFloat=function(r,e){var t=this[r];return t?parseFloat(t):e},l.enumeratedString=function(r){return this[r]},l.enumeratedStringList=function(r,e){var t=this[r];return(t?t.split(/[ ,]+/):[]).reduce(function(a,o){return a[o.toLowerCase()]=!0,a},e)},l.bool=function(r){return this[r]==="YES"},l.decimalResolution=function(r){var e=ml.exec(this[r]);if(e!==null)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},s.parseAttrList=function(r,e){var t,a={},o='"';for($s.lastIndex=0;(t=$s.exec(r))!==null;){var d=t[1].trim(),c=t[2],f=c.indexOf(o)===0&&c.lastIndexOf(o)===c.length-1,v=!1;if(f)c=c.slice(1,-1);else switch(d){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":v=!0}if(e&&(f||v))c=Ga(e,c);else if(!v&&!f)switch(d){case"CLOSED-CAPTIONS":if(c==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":U.warn(r+": attribute "+d+" is missing quotes")}a[d]=c}return a},Ne(s,[{key:"clientAttrs",get:function(){return Object.keys(this).filter(function(r){return r.substring(0,2)==="X-"})}}])}(),pl="com.apple.hls.interstitial";function gl(s){return s!=="ID"&&s!=="CLASS"&&s!=="CUE"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function lu(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"||s==="SCTE35-CMD"}var ka=function(){function s(l,n,r){var e;if(r===void 0&&(r=0),this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(n==null?void 0:n.tagAnchor)||null,this.tagOrder=(e=n==null?void 0:n.tagOrder)!=null?e:r,n){var t=n.attr;for(var a in t)if(Object.prototype.hasOwnProperty.call(l,a)&&l[a]!==t[a]){U.warn('DATERANGE tag attribute: "'+a+'" does not match for tags with ID: "'+l.ID+'"'),this._badValueForSameId=a;break}l=Qe(new Hi({}),t,l)}if(this.attr=l,n?(this._startDate=n._startDate,this._cue=n._cue,this._endDate=n._endDate,this._dateAtEnd=n._dateAtEnd):this._startDate=new Date(l["START-DATE"]),"END-DATE"in this.attr){var o=(n==null?void 0:n.endDate)||new Date(this.attr["END-DATE"]);Ge(o.getTime())&&(this._endDate=o)}}return Ne(s,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"cue",get:function(){var n=this._cue;return n===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):n}},{key:"startTime",get:function(){var n=this.tagAnchor;return n===null||n.programDateTime===null?(U.warn('Expected tagAnchor Fragment with PDT set for DateRange "'+this.id+'": '+n),NaN):n.start+(this.startDate.getTime()-n.programDateTime)/1e3}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){var n=this._endDate||this._dateAtEnd;if(n)return n;var r=this.duration;return r!==null?this._dateAtEnd=new Date(this._startDate.getTime()+r*1e3):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var n=this.attr.decimalFloatingPoint("DURATION");if(Ge(n))return n}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isInterstitial",get:function(){return this.class===pl}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&Ge(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}])}(),qs=10,vo=function(){function s(n){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=n}var l=s.prototype;return l.reloaded=function(r){if(!r){this.advanced=!0,this.updated=!0;return}var e=this.lastPartSn-r.lastPartSn,t=this.lastPartIndex-r.lastPartIndex;this.updated=this.endSN!==r.endSN||!!t||!!e||!this.live,this.advanced=this.endSN>r.endSN||e>0||e===0&&t>0,this.updated||this.advanced?this.misses=Math.floor(r.misses*.6):this.misses=r.misses+1},l.hasKey=function(r){return this.encryptedFragments.some(function(e){var t=e.decryptdata;return t||(e.setKeyFormat(r.keyFormat),t=e.decryptdata),!!t&&r.matches(t)})},Ne(s,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Ge(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||qs}},{key:"drift",get:function(){var r=this.driftEndTime-this.driftStartTime;if(r>0){var e=this.driftEnd-this.driftStart;return e*1e3/r}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var r;return(r=this.partList)!=null&&r.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}},{key:"fragmentStart",get:function(){return this.fragments.length?this.fragments[0].start:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var r;return(r=this.partList)!=null&&r.length?this.partList[this.partList.length-1].index:-1}},{key:"maxPartIndex",get:function(){var r=this.partList;if(r){var e=this.lastPartIndex;if(e!==-1){for(var t=r.length;t--;)if(r[t].index>e)return r[t].index;return e}}return 0}},{key:"lastPartSn",get:function(){var r;return(r=this.partList)!=null&&r.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}},{key:"expired",get:function(){if(this.live&&this.age&&this.misses<3){var r=this.partEnd-this.fragmentStart;return this.age>Math.max(r,this.totalduration)+this.levelTargetDuration}return!1}}])}();function Mi(s,l){return s.length===l.length?!s.some(function(n,r){return n!==l[r]}):!1}function gr(s,l){return!s&&!l?!0:!s||!l?!1:Mi(s,l)}function Ji(s){return s==="AES-128"||s==="AES-256"||s==="AES-256-CTR"}function Ka(s){switch(s){case"AES-128":case"AES-256":return Yt.cbc;case"AES-256-CTR":return Yt.ctr;default:throw new Error("invalid full segment method "+s)}}function I(s){return Uint8Array.from(atob(s),function(l){return l.charCodeAt(0)})}function A(s){return Uint8Array.from(unescape(encodeURIComponent(s)),function(l){return l.charCodeAt(0)})}function k(s){var l=A(s).subarray(0,16),n=new Uint8Array(16);return n.set(l,16-l.length),n}function x(s){var l=function(r,e,t){var a=r[e];r[e]=r[t],r[t]=a};l(s,0,3),l(s,1,2),l(s,4,5),l(s,6,7)}function D(s){var l=s.split(":"),n=null;if(l[0]==="data"&&l.length===2){var r=l[1].split(";"),e=r[r.length-1].split(",");if(e.length===2){var t=e[0]==="base64",a=e[1];t?(r.splice(-1,1),n=I(a)):n=k(a)}}return n}var z=typeof self!="undefined"?self:void 0,$={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Fe={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Ve(s){switch(s){case Fe.FAIRPLAY:return $.FAIRPLAY;case Fe.PLAYREADY:return $.PLAYREADY;case Fe.WIDEVINE:return $.WIDEVINE;case Fe.CLEARKEY:return $.CLEARKEY}}function tt(s){switch(s){case $.FAIRPLAY:return Fe.FAIRPLAY;case $.PLAYREADY:return Fe.PLAYREADY;case $.WIDEVINE:return Fe.WIDEVINE;case $.CLEARKEY:return Fe.CLEARKEY}}function Mt(s){var l=s.drmSystems,n=s.widevineLicenseUrl,r=l?[$.FAIRPLAY,$.WIDEVINE,$.PLAYREADY,$.CLEARKEY].filter(function(e){return!!l[e]}):[];return!r[$.WIDEVINE]&&n&&r.push($.WIDEVINE),r}var Gt=function(s){return z!=null&&(s=z.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function et(s,l,n,r){var e;switch(s){case $.FAIRPLAY:e=["cenc","sinf"];break;case $.WIDEVINE:case $.PLAYREADY:e=["cenc"];break;case $.CLEARKEY:e=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+s)}return Ue(e,l,n,r)}function Ue(s,l,n,r){var e={initDataTypes:s,persistentState:r.persistentState||"optional",distinctiveIdentifier:r.distinctiveIdentifier||"optional",sessionTypes:r.sessionTypes||[r.sessionType||"temporary"],audioCapabilities:l.map(function(t){return{contentType:"audio/mp4; codecs="+t,robustness:r.audioRobustness||"",encryptionScheme:r.audioEncryptionScheme||null}}),videoCapabilities:n.map(function(t){return{contentType:"video/mp4; codecs="+t,robustness:r.videoRobustness||"",encryptionScheme:r.videoEncryptionScheme||null}})};return[e]}function bt(s){var l;return!!s&&(s.sessionType==="persistent-license"||!!((l=s.sessionTypes)!=null&&l.some(function(n){return n==="persistent-license"})))}function tr(s){var l=new Uint16Array(s.buffer,s.byteOffset,s.byteLength/2),n=String.fromCharCode.apply(null,Array.from(l)),r=n.substring(n.indexOf("<"),n.length),e=new DOMParser,t=e.parseFromString(r,"text/xml"),a=t.getElementsByTagName("KID")[0];if(a){var o=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(o){var d=I(o).subarray(0,16);return x(d),d}}return null}var Kt={},Or=function(){function s(n,r,e,t,a,o){t===void 0&&(t=[1]),a===void 0&&(a=null),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=n,this.uri=r,this.keyFormat=e,this.keyFormatVersions=t,this.iv=a,this.encrypted=n?n!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Ji(n),o!=null&&o.startsWith("0x")&&(this.keyId=new Uint8Array(Lr(o)))}s.clearKeyUriToKeyIdMap=function(){Kt={}},s.setKeyIdForUri=function(r,e){Kt[r]=e},s.addKeyIdForUri=function(r){var e=Object.keys(Kt).length%Number.MAX_SAFE_INTEGER,t=new Uint8Array(16),a=new DataView(t.buffer,12,4);return a.setUint32(0,e),Kt[r]=t,t};var l=s.prototype;return l.matches=function(r){return r.uri===this.uri&&r.method===this.method&&r.encrypted===this.encrypted&&r.keyFormat===this.keyFormat&&Mi(r.keyFormatVersions,this.keyFormatVersions)&&gr(r.iv,this.iv)&&gr(r.keyId,this.keyId)},l.isSupported=function(){if(this.method){if(Ji(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Fe.FAIRPLAY:case Fe.WIDEVINE:case Fe.PLAYREADY:case Fe.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1},l.getDecryptData=function(r,e){if(!this.encrypted||!this.uri)return null;if(Ji(this.method)){var t=this.iv;t||(typeof r!="number"&&(U.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),r=0),t=St(r));var a=new s(this.method,this.uri,"identity",this.keyFormatVersions,t);return a}if(this.keyId){var o=Kt[this.uri];if(o&&!Mi(this.keyId,o)&&s.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}var d=D(this.uri);if(d)switch(this.keyFormat){case Fe.WIDEVINE:if(this.pssh=d,!this.keyId){var c=Pa(d.buffer);if(c.length){var f,v=c[0];this.keyId=(f=v.kids)!=null&&f.length?v.kids[0]:null}}this.keyId||(this.keyId=Ot(e));break;case Fe.PLAYREADY:{var m=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Yr(m,null,d),this.keyId=tr(d);break}default:{var g=d.subarray(0,16);if(g.length!==16){var y=new Uint8Array(16);y.set(g,16-g.length),g=y}this.keyId=g;break}}if(!this.keyId||this.keyId.byteLength!==16){var b;b=$t(e),b||(b=Ot(e),b||(b=Kt[this.uri])),b&&(this.keyId=b,s.setKeyIdForUri(this.uri,b))}return this},s}();function $t(s){var l=s==null?void 0:s[Fe.WIDEVINE];return l?l.keyId:null}function Ot(s){var l=s==null?void 0:s[Fe.PLAYREADY];if(l){var n=D(l.uri);if(n)return tr(n)}return null}function St(s){for(var l=new Uint8Array(16),n=12;n<16;n++)l[n]=s>>8*(15-n)&255;return l}var Sr=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,kr=/#EXT-X-MEDIA:(.*)/g,rt=/^#EXT(?:INF|-X-TARGETDURATION):/m,ri=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Ni=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),Vi=function(){function s(){}return s.findGroup=function(n,r){for(var e=0;e<n.length;e++){var t=n[e];if(t.id===r)return t}},s.resolve=function(n,r){return At.buildAbsoluteURL(r,n,{alwaysNormalize:!0})},s.isMediaPlaylist=function(n){return rt.test(n)},s.parseMasterPlaylist=function(n,r){var e=ho(n),t={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:e},a=[];if(Sr.lastIndex=0,!n.startsWith("#EXTM3U"))return t.playlistParsingError=new Error("no EXTM3U delimiter"),t;for(var o;(o=Sr.exec(n))!=null;)if(o[1]){var d,c=new Hi(o[1],t),f=Ga(t,o[2]),v={attrs:c,bitrate:c.decimalInteger("BANDWIDTH")||c.decimalInteger("AVERAGE-BANDWIDTH"),name:c.NAME,url:s.resolve(f,r)},m=c.decimalResolution("RESOLUTION");m&&(v.width=m.width,v.height=m.height),en(c.CODECS,v);var g=c["SUPPLEMENTAL-CODECS"];g&&(v.supplemental={},en(g,v.supplemental)),(d=v.unknownCodecs)!=null&&d.length||a.push(v),t.levels.push(v)}else if(o[3]){var y=o[3],b=o[4];switch(y){case"SESSION-DATA":{var S=new Hi(b,t),L=S["DATA-ID"];L&&(t.sessionData===null&&(t.sessionData={}),t.sessionData[L]=S);break}case"SESSION-KEY":{var C=Dn(b,r,t);C.encrypted&&C.isSupported()?(t.sessionKeys===null&&(t.sessionKeys=[]),t.sessionKeys.push(C)):U.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+b+'"');break}case"DEFINE":{{var F=new Hi(b,t);_s(t,F,r)}break}case"CONTENT-STEERING":{var N=new Hi(b,t);t.contentSteering={uri:s.resolve(N["SERVER-URI"],r),pathwayId:N["PATHWAY-ID"]||"."};break}case"START":{t.startTimeOffset=As(b);break}}}var B=a.length>0&&a.length<t.levels.length;return t.levels=B?a:t.levels,t.levels.length===0&&(t.playlistParsingError=new Error("no levels found in manifest")),t},s.parseMasterPlaylistMedia=function(n,r,e){var t,a={},o=e.levels,d={AUDIO:o.map(function(B){return{id:B.attrs.AUDIO,audioCodec:B.audioCodec}}),SUBTITLES:o.map(function(B){return{id:B.attrs.SUBTITLES,textCodec:B.textCodec}}),"CLOSED-CAPTIONS":[]},c=0;for(kr.lastIndex=0;(t=kr.exec(n))!==null;){var f=new Hi(t[1],e),v=f.TYPE;if(v){var m=d[v],g=a[v]||[];a[v]=g;var y=f.LANGUAGE,b=f["ASSOC-LANGUAGE"],S=f.CHANNELS,L=f.CHARACTERISTICS,C=f["INSTREAM-ID"],F={attrs:f,bitrate:0,id:c++,groupId:f["GROUP-ID"]||"",name:f.NAME||y||"",type:v,default:f.bool("DEFAULT"),autoselect:f.bool("AUTOSELECT"),forced:f.bool("FORCED"),lang:y,url:f.URI?s.resolve(f.URI,r):""};if(b&&(F.assocLang=b),S&&(F.channels=S),L&&(F.characteristics=L),C&&(F.instreamId=C),m!=null&&m.length){var N=s.findGroup(m,F.groupId)||m[0];la(F,N,"audioCodec"),la(F,N,"textCodec")}g.push(F)}}return a},s.parseLevelPlaylist=function(n,r,e,t,a,o){var d,c={url:r},f=new vo(r),v=f.fragments,m=[],g=null,y=0,b=0,S=0,L=0,C=0,F=null,N=new te(t,c),B,re,ce,Se=-1,Ke=!1,be=null,Z;if(ri.lastIndex=0,f.m3u8=n,f.hasVariableRefs=ho(n),((d=ri.exec(n))==null?void 0:d[0])!=="#EXTM3U")return f.playlistParsingError=new Error("Missing format identifier #EXTM3U"),f;for(;(B=ri.exec(n))!==null;){Ke&&(Ke=!1,N=new te(t,c),N.playlistOffset=S,N.setStart(S),N.sn=y,N.cc=L,C&&(N.bitrate=C),N.level=e,g&&(N.initSegment=g,g.rawProgramDateTime&&(N.rawProgramDateTime=g.rawProgramDateTime,g.rawProgramDateTime=null),be&&(N.setByteRange(be),be=null)));var ne=B[1];if(ne){N.duration=parseFloat(ne);var Re=(" "+B[2]).slice(1);N.title=Re||null,N.tagList.push(Re?["INF",ne,Re]:["INF",ne])}else if(B[3]){if(Ge(N.duration)){N.playlistOffset=S,N.setStart(S),ce&&mo(N,ce,f),N.sn=y,N.level=e,N.cc=L,v.push(N);var Tt=(" "+B[3]).slice(1);N.relurl=Ga(f,Tt),gn(N,F,m),F=N,S+=N.duration,y++,b=0,Ke=!0}}else{if(B=B[0].match(Ni),!B){U.warn("No matches on slow regex match for level playlist!");continue}for(re=1;re<B.length&&B[re]===void 0;re++);var ot=(" "+B[re]).slice(1),pt=(" "+B[re+1]).slice(1),Bt=B[re+2]?(" "+B[re+2]).slice(1):null;switch(ot){case"BYTERANGE":F?N.setByteRange(pt,F):N.setByteRange(pt);break;case"PROGRAM-DATE-TIME":N.rawProgramDateTime=pt,N.tagList.push(["PROGRAM-DATE-TIME",pt]),Se===-1&&(Se=v.length);break;case"PLAYLIST-TYPE":f.type&&tn(f,ot,B),f.type=pt.toUpperCase();break;case"MEDIA-SEQUENCE":f.startSN!==0?tn(f,ot,B):v.length>0&&vi(f,ot,B),y=f.startSN=parseInt(pt);break;case"SKIP":{f.skippedSegments&&tn(f,ot,B);var cr=new Hi(pt,f),or=cr.decimalInteger("SKIPPED-SEGMENTS");if(Ge(or)){f.skippedSegments+=or;for(var hr=or;hr--;)v.push(null);y+=or}var xr=cr.enumeratedString("RECENTLY-REMOVED-DATERANGES");xr&&(f.recentlyRemovedDateranges=(f.recentlyRemovedDateranges||[]).concat(xr.split("	")));break}case"TARGETDURATION":f.targetduration!==0&&tn(f,ot,B),f.targetduration=Math.max(parseInt(pt),1);break;case"VERSION":f.version!==null&&tn(f,ot,B),f.version=parseInt(pt);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":f.live||tn(f,ot,B),f.live=!1;break;case"#":(pt||Bt)&&N.tagList.push(Bt?[pt,Bt]:[pt]);break;case"DISCONTINUITY":L++,N.tagList.push(["DIS"]);break;case"GAP":N.gap=!0,N.tagList.push([ot]);break;case"BITRATE":N.tagList.push([ot,pt]),C=parseInt(pt)*1e3,Ge(C)?N.bitrate=C:C=0;break;case"DATERANGE":{var fr=new Hi(pt,f),lr=new ka(fr,f.dateRanges[fr.ID],f.dateRangeTagCount);f.dateRangeTagCount++,lr.isValid||f.skippedSegments?f.dateRanges[lr.id]=lr:U.warn('Ignoring invalid DATERANGE tag: "'+pt+'"'),N.tagList.push(["EXT-X-DATERANGE",pt]);break}case"DEFINE":{{var _r=new Hi(pt,f);"IMPORT"in _r?fo(f,_r,o):_s(f,_r,r)}break}case"DISCONTINUITY-SEQUENCE":f.startCC!==0?tn(f,ot,B):v.length>0&&vi(f,ot,B),f.startCC=L=parseInt(pt);break;case"KEY":{var Dr=Dn(pt,r,f);if(Dr.isSupported()){if(Dr.method==="NONE"){ce=void 0;break}ce||(ce={});var bi=ce[Dr.keyFormat];bi!=null&&bi.matches(Dr)||(bi&&(ce=Qe({},ce)),ce[Dr.keyFormat]=Dr)}else U.warn('[Keys] Ignoring unsupported EXT-X-KEY tag: "'+pt+'"');break}case"START":f.startTimeOffset=As(pt);break;case"MAP":{var jr=new Hi(pt,f);if(N.duration){var ji=new te(t,c);Ls(ji,jr,e,ce),g=ji,N.initSegment=g,g.rawProgramDateTime&&!N.rawProgramDateTime&&(N.rawProgramDateTime=g.rawProgramDateTime)}else{var ia=N.byteRangeEndOffset;if(ia){var Fi=N.byteRangeStartOffset;be=ia-Fi+"@"+Fi}else be=null;Ls(N,jr,e,ce),g=N,Ke=!0}g.cc=L;break}case"SERVER-CONTROL":{Z&&tn(f,ot,B),Z=new Hi(pt),f.canBlockReload=Z.bool("CAN-BLOCK-RELOAD"),f.canSkipUntil=Z.optionalFloat("CAN-SKIP-UNTIL",0),f.canSkipDateRanges=f.canSkipUntil>0&&Z.bool("CAN-SKIP-DATERANGES"),f.partHoldBack=Z.optionalFloat("PART-HOLD-BACK",0),f.holdBack=Z.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{f.partTarget&&tn(f,ot,B);var sn=new Hi(pt);f.partTarget=sn.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Gi=f.partList;Gi||(Gi=f.partList=[]);var si=b>0?Gi[Gi.length-1]:void 0,ir=b++,qa=new Hi(pt,f),Da=new me(qa,N,c,ir,si);Gi.push(Da),N.duration+=Da.duration;break}case"PRELOAD-HINT":{var Tn=new Hi(pt,f);f.preloadHint=Tn;break}case"RENDITION-REPORT":{var ca=new Hi(pt,f);f.renditionReports=f.renditionReports||[],f.renditionReports.push(ca);break}default:U.warn("line parsed but not handled: "+B);break}}}F&&!F.relurl?(v.pop(),S-=F.duration,f.partList&&(f.fragmentHint=F)):f.partList&&(gn(N,F,m),N.cc=L,f.fragmentHint=N,ce&&mo(N,ce,f)),f.targetduration||(f.playlistParsingError=new Error("Missing Target Duration"));var Pn=v.length,_n=v[0],Ma=v[Pn-1];if(S+=f.skippedSegments*f.targetduration,S>0&&Pn&&Ma){f.averagetargetduration=S/Pn;var ja=Ma.sn;f.endSN=ja!=="initSegment"?ja:0,f.live||(Ma.endList=!0),Se>0&&(Ss(v,Se),_n&&m.unshift(_n))}return f.fragmentHint&&(S+=f.fragmentHint.duration),f.totalduration=S,m.length&&f.dateRangeTagCount&&_n&&ii(m,f),f.endCC=L,f},s}();function ii(s,l){var n=s.length;if(!n)if(l.hasProgramDateTime){var r=l.fragments[l.fragments.length-1];s.push(r),n++}else return;for(var e=s[n-1],t=l.live?1/0:l.totalduration,a=Object.keys(l.dateRanges),o=a.length;o--;){var d=l.dateRanges[a[o]],c=d.startDate.getTime();d.tagAnchor=e.ref;for(var f=n;f--;){var v;if(((v=s[f])==null?void 0:v.sn)<l.startSN)break;var m=oi(l,c,s,f,t);if(m!==-1){d.tagAnchor=l.fragments[m].ref;break}}}}function oi(s,l,n,r,e){var t=n[r];if(t){var a=t.programDateTime;if(l>=a||r===0){var o,d=(((o=n[r+1])==null?void 0:o.start)||e)-t.start;if(l<=a+d*1e3){var c=n[r].sn-s.startSN;if(c<0)return-1;var f=s.fragments;if(f.length>n.length)for(var v=n[r+1]||f[f.length-1],m=v.sn-s.startSN,g=m;g>c;g--){var y=f[g].programDateTime;if(l>=y&&l<y+f[g].duration*1e3)return g}return c}}}return-1}function Dn(s,l,n){var r,e,t=new Hi(s,n),a=(r=t.METHOD)!=null?r:"",o=t.URI,d=t.hexadecimalInteger("IV"),c=t.KEYFORMATVERSIONS,f=(e=t.KEYFORMAT)!=null?e:"identity";o&&t.IV&&!d&&U.error("Invalid IV: "+t.IV);var v=o?Vi.resolve(o,l):"",m=(c||"1").split("/").map(Number).filter(Number.isFinite);return new Or(a,v,f,m,d,t.KEYID)}function As(s){var l=new Hi(s),n=l.decimalFloatingPoint("TIME-OFFSET");return Ge(n)?n:null}function en(s,l){var n=(s||"").split(/[ ,]+/).filter(function(r){return r});["video","audio","text"].forEach(function(r){var e=n.filter(function(t){return aa(t,r)});e.length&&(l[r+"Codec"]=e.map(function(t){return t.split("/")[0]}).join(","),n=n.filter(function(t){return e.indexOf(t)===-1}))}),l.unknownCodecs=n}function la(s,l,n){var r=l[n];r&&(s[n]=r)}function Ss(s,l){for(var n=s[l],r=l;r--;){var e=s[r];if(!e)return;e.programDateTime=n.programDateTime-e.duration*1e3,n=e}}function gn(s,l,n){s.rawProgramDateTime?n.push(s):l!=null&&l.programDateTime&&(s.programDateTime=l.endProgramDateTime)}function Ls(s,l,n,r){s.relurl=l.URI,l.BYTERANGE&&s.setByteRange(l.BYTERANGE),s.level=n,s.sn="initSegment",r&&(s.levelkeys=r),s.initSegment=null}function mo(s,l,n){s.levelkeys=l;var r=n.encryptedFragments;(!r.length||r[r.length-1].levelkeys!==l)&&Object.keys(l).some(function(e){return l[e].isCommonEncryption})&&r.push(s)}function tn(s,l,n){s.playlistParsingError=new Error("#EXT-X-"+l+" must not appear more than once ("+n[0]+")")}function vi(s,l,n){s.playlistParsingError=new Error("#EXT-X-"+l+" must appear before the first Media Segment ("+n[0]+")")}function El(s,l){var n=l.startPTS;if(Ge(n)){var r=0,e;l.sn>s.sn?(r=n-s.start,e=s):(r=s.start-n,e=l),e.duration!==r&&e.setDuration(r)}else if(l.sn>s.sn){var t=s.cc===l.cc;t&&s.minEndPTS?l.setStart(s.start+(s.minEndPTS-s.start)):l.setStart(s.start+s.duration)}else l.setStart(Math.max(s.start-l.duration,0))}function po(s,l,n,r,e,t,a){var o=r-n;o<=0&&(a.warn("Fragment should have a positive duration",l),r=n+l.duration,t=e+l.duration);var d=n,c=r,f=l.startPTS,v=l.endPTS;if(Ge(f)){var m=Math.abs(f-n);s&&m>s.totalduration?a.warn("media timestamps and playlist times differ by "+m+"s for level "+l.level+" "+s.url):Ge(l.deltaPTS)?l.deltaPTS=Math.max(m,l.deltaPTS):l.deltaPTS=m,d=Math.max(n,f),n=Math.min(n,f),e=l.startDTS!==void 0?Math.min(e,l.startDTS):e,c=Math.min(r,v),r=Math.max(r,v),t=l.endDTS!==void 0?Math.max(t,l.endDTS):t}var g=n-l.start;l.start!==0&&l.setStart(n),l.setDuration(r-l.start),l.startPTS=n,l.maxStartPTS=d,l.startDTS=e,l.endPTS=r,l.minEndPTS=c,l.endDTS=t;var y=l.sn;if(!s||y<s.startSN||y>s.endSN)return 0;var b,S=y-s.startSN,L=s.fragments;for(L[S]=l,b=S;b>0;b--)El(L[b],L[b-1]);for(b=S;b<L.length-1;b++)El(L[b],L[b+1]);return s.fragmentHint&&El(L[L.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,g}function Po(s,l,n){if(s!==l){for(var r=null,e=s.fragments,t=e.length-1;t>=0;t--){var a=e[t].initSegment;if(a){r=a;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var o;ks(s,l,function(L,C,F,N){if((!l.startCC||l.skippedSegments)&&C.cc!==L.cc){for(var B=L.cc-C.cc,re=F;re<N.length;re++)N[re].cc+=B;l.endCC=N[N.length-1].cc}Ge(L.startPTS)&&Ge(L.endPTS)&&(C.setStart(C.startPTS=L.startPTS),C.startDTS=L.startDTS,C.maxStartPTS=L.maxStartPTS,C.endPTS=L.endPTS,C.endDTS=L.endDTS,C.minEndPTS=L.minEndPTS,C.setDuration(L.endPTS-L.startPTS),C.duration&&(o=C),l.PTSKnown=l.alignedSliding=!0),L.hasStreams&&(C.elementaryStreams=L.elementaryStreams),C.loader=L.loader,L.hasStats&&(C.stats=L.stats),L.initSegment&&(C.initSegment=L.initSegment,r=L.initSegment)});var d=l.fragments,c=l.fragmentHint?d.concat(l.fragmentHint):d;if(r&&c.forEach(function(L){var C;L&&(!L.initSegment||L.initSegment.relurl===((C=r)==null?void 0:C.relurl))&&(L.initSegment=r)}),l.skippedSegments){if(l.deltaUpdateFailed=d.some(function(L){return!L}),l.deltaUpdateFailed){n.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var f=l.skippedSegments;f--;)d.shift();l.startSN=d[0].sn}else{l.canSkipDateRanges&&(l.dateRanges=go(s.dateRanges,l,n));var v=s.fragments.filter(function(L){return L.rawProgramDateTime});if(s.hasProgramDateTime&&!l.hasProgramDateTime)for(var m=1;m<c.length;m++)c[m].programDateTime===null&&gn(c[m],c[m-1],v);ii(v,l)}l.endCC=d[d.length-1].cc}if(!l.startCC){var g,y=Nn(s,l.startSN-1);l.startCC=(g=y==null?void 0:y.cc)!=null?g:d[0].cc}ta(s.partList,l.partList,function(L,C){C.elementaryStreams=L.elementaryStreams,C.stats=L.stats}),o?po(l,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS,n):yl(s,l),d.length&&(l.totalduration=l.edge-d[0].start),l.driftStartTime=s.driftStartTime,l.driftStart=s.driftStart;var b=l.advancedDateTime;if(l.advanced&&b){var S=l.edge;l.driftStart||(l.driftStartTime=b,l.driftStart=S),l.driftEndTime=b,l.driftEnd=S}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime;l.requestScheduled===-1&&(l.requestScheduled=s.requestScheduled)}}function go(s,l,n){var r=l.dateRanges,e=l.recentlyRemovedDateranges,t=Qe({},s);e&&e.forEach(function(d){delete t[d]});var a=Object.keys(t),o=a.length;return o?(Object.keys(r).forEach(function(d){var c=t[d],f=new ka(r[d].attr,c);f.isValid?(t[d]=f,c||(f.tagOrder+=o)):n.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+ur(r[d].attr)+'"')}),t):r}function ta(s,l,n){if(s&&l)for(var r=0,e=0,t=s.length;e<=t;e++){var a=s[e],o=l[e+r];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?n(a,o):r--}}function ks(s,l,n){for(var r=l.skippedSegments,e=Math.max(s.startSN,l.startSN)-l.startSN,t=(s.fragmentHint?1:0)+(r?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,a=l.startSN-s.startSN,o=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,d=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=e;c<=t;c++){var f=d[a+c],v=o[c];if(r&&!v&&f&&(v=l.fragments[c]=f),f&&v){n(f,v,c,o);var m=f.relurl,g=v.relurl;if(m&&Pd(m,g)){l.playlistParsingError=Eo("media sequence mismatch "+v.sn+":",s,l,f,v);return}else if(f.cc!==v.cc){l.playlistParsingError=Eo("discontinuity sequence mismatch ("+f.cc+"!="+v.cc+")",s,l,f,v);return}}}}function Eo(s,l,n,r,e){return new Error(s+" "+e.url+`
Playlist starting @`+l.startSN+`
`+l.m3u8+`

Playlist starting @`+n.startSN+`
`+n.m3u8)}function yl(s,l,n){n===void 0&&(n=!0);var r=l.startSN+l.skippedSegments-s.startSN,e=s.fragments,t=r>=0,a=0;if(t&&r<e.length)a=e[r].start;else if(t&&l.startSN===s.endSN+1)a=s.fragmentEnd;else if(t&&n)a=s.fragmentStart+r*l.levelTargetDuration;else if(!l.skippedSegments&&l.fragmentStart===0)a=s.fragmentStart;else return;Wa(l,a)}function Wa(s,l){if(l){for(var n=s.fragments,r=s.skippedSegments;r<n.length;r++)n[r].addStart(l);s.fragmentHint&&s.fragmentHint.addStart(l)}}function ds(s,l){l===void 0&&(l=1/0);var n=1e3*s.targetduration;if(s.updated){var r=s.fragments,e=4;if(r.length&&n*e>l){var t=r[r.length-1].duration*1e3;t<n&&(n=t)}}else n/=2;return Math.round(n)}function Nn(s,l,n){if(!s)return null;var r=s.fragments[l-s.startSN];return r||(r=s.fragmentHint,r&&r.sn===l)?r:l<s.startSN&&n&&n.sn===l?n:null}function Is(s,l,n){return s?js(s.partList,l,n):null}function js(s,l,n){if(s)for(var r=s.length;r--;){var e=s[r];if(e.index===n&&e.fragment.sn===l)return e}return null}function Oo(s){s.forEach(function(l,n){var r;(r=l.details)==null||r.fragments.forEach(function(e){e.level=n,e.initSegment&&(e.initSegment.level=n)})})}function Pd(s,l){return s!==l&&l?Rs(s)!==Rs(l):!1}function Rs(s){return s.replace(/\?[^?]*$/,"")}function bl(s,l){for(var n=0,r=s.length;n<r;n++){var e;if(((e=s[n])==null?void 0:e.cc)===l)return s[n]}return null}function Cc(s,l){return!!(s&&l.startCC<s.endCC&&l.endCC>s.startCC)}function Qu(s,l){var n=s.start+l;s.startPTS=n,s.setStart(n),s.endPTS=n+s.duration}function ra(s,l){for(var n=l.fragments,r=0,e=n.length;r<e;r++)Qu(n[r],s);l.fragmentHint&&Qu(l.fragmentHint,s),l.alignedSliding=!0}function Od(s,l){s&&(xd(l,s),l.alignedSliding||Tl(l,s),!l.alignedSliding&&!l.skippedSegments&&yl(s,l,!1))}function xd(s,l){if(Cc(l,s)){var n=Math.min(l.endCC,s.endCC),r=bl(l.fragments,n),e=bl(s.fragments,n);if(!(!r||!e)){U.log("Aligning playlist at start of dicontinuity sequence "+n);var t=r.start-e.start;ra(t,s)}}}function Tl(s,l){if(!(!s.hasProgramDateTime||!l.hasProgramDateTime)){var n=s.fragments,r=l.fragments;if(!(!n.length||!r.length)){var e,t,a=Math.min(l.endCC,s.endCC);l.startCC<a&&s.startCC<a&&(e=bl(r,a),t=bl(n,a)),(!e||!t)&&(e=r[Math.floor(r.length/2)],t=bl(n,e.cc)||n[Math.floor(n.length/2)]);var o=e.programDateTime,d=t.programDateTime;if(!(!o||!d)){var c=(d-o)/1e3-(t.start-e.start);ra(c,s)}}}}function Ea(s,l,n){Ia(s,l,n),s.addEventListener(l,n)}function Ia(s,l,n){s.removeEventListener(l,n)}var Dc={toString:function(l){for(var n="",r=l.length,e=0;e<r;e++)n+="["+l.start(e).toFixed(3)+"-"+l.end(e).toFixed(3)+"]";return n}},nt={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},Xu=function(s){function l(r,e,t,a,o){var d;return d=s.call(this,a,r.logger)||this,d.hls=void 0,d.fragPrevious=null,d.fragCurrent=null,d.fragmentTracker=void 0,d.transmuxer=null,d._state=nt.STOPPED,d.playlistType=void 0,d.media=null,d.mediaBuffer=null,d.config=void 0,d.bitrateTest=!1,d.lastCurrentTime=0,d.nextLoadPosition=0,d.startPosition=0,d.startTimeOffset=null,d.retryDate=0,d.levels=null,d.fragmentLoader=void 0,d.keyLoader=void 0,d.levelLastLoaded=null,d.startFragRequested=!1,d.decrypter=void 0,d.initPTS=[],d.buffering=!0,d.loadingParts=!1,d.loopSn=void 0,d.onMediaSeeking=function(){var c=d,f=c.config,v=c.fragCurrent,m=c.media,g=c.mediaBuffer,y=c.state,b=m?m.currentTime:0,S=Pr.bufferInfo(g||m,b,f.maxBufferHole),L=!S.len;if(d.log("Media seeking to "+(Ge(b)?b.toFixed(3):b)+", state: "+y+", "+(L?"out of":"in")+" buffer"),d.state===nt.ENDED)d.resetLoadingState();else if(v){var C=f.maxFragLookUpTolerance,F=v.start-C,N=v.start+v.duration+C;if(L||N<S.start||F>S.end){var B=b>N;(b<F||B)&&(B&&v.loader&&(d.log("Cancelling fragment load for seek (sn: "+v.sn+")"),v.abortRequests(),d.resetLoadingState()),d.fragPrevious=null)}}if(m){d.fragmentTracker.removeFragmentsInRange(b,1/0,d.playlistType,!0);var re=d.lastCurrentTime;if(b>re&&(d.lastCurrentTime=b),!d.loadingParts){var ce=Math.max(S.end,b),Se=d.shouldLoadParts(d.getLevelDetails(),ce);Se&&(d.log("LL-Part loading ON after seeking to "+b.toFixed(2)+" with buffer @"+ce.toFixed(2)),d.loadingParts=Se)}}d.hls.hasEnoughToStart||(d.log("Setting "+(L?"startPosition":"nextLoadPosition")+" to "+b+" for seek without enough to start"),d.nextLoadPosition=b,L&&(d.startPosition=b)),L&&d.state===nt.IDLE&&d.tickImmediate()},d.onMediaEnded=function(){d.log("setting startPosition to 0 because media ended"),d.startPosition=d.lastCurrentTime=0},d.playlistType=o,d.hls=r,d.fragmentLoader=new Ki(r.config),d.keyLoader=t,d.fragmentTracker=e,d.config=r.config,d.decrypter=new Xr(r.config),d}Pe(l,s);var n=l.prototype;return n.registerListeners=function(){var e=this.hls;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.ERROR,this.onError,this)},n.unregisterListeners=function(){var e=this.hls;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.ERROR,this.onError,this)},n.doTick=function(){this.onTickEnd()},n.onTickEnd=function(){},n.startLoad=function(e){},n.stopLoad=function(){if(this.state!==nt.STOPPED){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);var e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=nt.STOPPED}},n.pauseBuffering=function(){this.buffering=!1},n.resumeBuffering=function(){this.buffering=!0},n._streamEnded=function(e,t){if(t.live||!this.media)return!1;var a=e.end||0,o=this.config.timelineOffset||0;if(a<=o)return!1;var d=e.buffered;this.config.maxBufferHole&&d&&d.length>1&&(e=Pr.bufferedInfo(d,e.start,0));var c=e.nextStart,f=c&&c>o&&c<t.edge;if(f||this.media.currentTime<e.start)return!1;var v=t.partList;if(v!=null&&v.length){var m=v[v.length-1],g=Pr.isBuffered(this.media,m.start+m.duration/2);return g}var y=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(y)},n.getLevelDetails=function(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details},n.onMediaAttached=function(e,t){var a=this.media=this.mediaBuffer=t.media;Ea(a,"seeking",this.onMediaSeeking),Ea(a,"ended",this.onMediaEnded);var o=this.config;this.levels&&o.autoStartLoad&&this.state===nt.STOPPED&&this.startLoad(o.startPosition)},n.onMediaDetaching=function(e,t){var a=!!t.transferMedia,o=this.media;if(o!==null){if(o.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Ia(o,"seeking",this.onMediaSeeking),Ia(o,"ended",this.onMediaEnded),this.keyLoader&&!a&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,a){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}},n.onManifestLoading=function(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1},n.onError=function(e,t){},n.onManifestLoaded=function(e,t){this.startTimeOffset=t.startTimeOffset},n.onHandlerDestroying=function(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),s.prototype.onHandlerDestroying.call(this),this.hls=this.onMediaSeeking=this.onMediaEnded=null},n.onHandlerDestroyed=function(){this.state=nt.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,s.prototype.onHandlerDestroyed.call(this)},n.loadFragment=function(e,t,a){this.startFragRequested=!0,this._loadFragForPlayback(e,t,a)},n._loadFragForPlayback=function(e,t,a){var o=this,d=function(f){var v=f.frag;if(o.fragContextChanged(v)){o.warn(v.type+" sn: "+v.sn+(f.part?" part: "+f.part.index:"")+" of "+o.fragInfo(v,!1,f.part)+") was dropped during download."),o.fragmentTracker.removeFragment(v);return}v.stats.chunkCount++,o._handleFragmentLoadProgress(f)};this._doFragLoad(e,t,a,d).then(function(c){if(c){var f=o.state,v=c.frag;if(o.fragContextChanged(v)){(f===nt.FRAG_LOADING||!o.fragCurrent&&f===nt.PARSING)&&(o.fragmentTracker.removeFragment(v),o.state=nt.IDLE);return}"payload"in c&&(o.log("Loaded "+v.type+" sn: "+v.sn+" of "+o.playlistLabel()+" "+v.level),o.hls.trigger(_.FRAG_LOADED,c)),o._handleFragmentLoadComplete(c)}}).catch(function(c){o.state===nt.STOPPED||o.state===nt.ERROR||(o.warn("Frag error: "+((c==null?void 0:c.message)||c)),o.resetFragmentLoading(e))})},n.clearTrackerIfNeeded=function(e){var t,a=this.fragmentTracker,o=a.getState(e);if(o===xe.APPENDING){var d=e.type,c=this.getFwdBufferInfo(this.mediaBuffer,d),f=Math.max(e.duration,c?c.len:this.config.maxBufferLength),v=this.backtrackFragment,m=v?e.sn-v.sn:0;(m===1||this.reduceMaxBufferLength(f,e.duration))&&a.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?a.removeAllFragments():a.hasParts(e.type)&&(a.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),a.getState(e)===xe.PARTIAL&&a.removeFragment(e))},n.checkLiveUpdate=function(e){if(e.updated&&!e.live){var t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)},n.waitForLive=function(e){var t=e.details;return(t==null?void 0:t.live)&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)},n.flushMainBuffer=function(e,t,a){if(a===void 0&&(a=null),!!(e-t)){var o={startOffset:e,endOffset:t,type:a};this.hls.trigger(_.BUFFER_FLUSHING,o)}},n._loadInitSegment=function(e,t){var a=this;this._doFragLoad(e,t).then(function(o){var d=o==null?void 0:o.frag;if(!d||a.fragContextChanged(d)||!a.levels)throw new Error("init load aborted");return o}).then(function(o){var d=a.hls,c=o.frag,f=o.payload,v=c.decryptdata;if(f&&f.byteLength>0&&v!=null&&v.key&&v.iv&&Ji(v.method)){var m=self.performance.now();return a.decrypter.decrypt(new Uint8Array(f),v.key.buffer,v.iv.buffer,Ka(v.method)).catch(function(g){throw d.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.FRAG_DECRYPT_ERROR,fatal:!1,error:g,reason:g.message,frag:c}),g}).then(function(g){var y=self.performance.now();return d.trigger(_.FRAG_DECRYPTED,{frag:c,payload:g,stats:{tstart:m,tdecrypt:y}}),o.payload=g,a.completeInitSegmentLoad(o)})}return a.completeInitSegmentLoad(o)}).catch(function(o){a.state===nt.STOPPED||a.state===nt.ERROR||(a.warn(o),a.resetFragmentLoading(e))})},n.completeInitSegmentLoad=function(e){var t=this.levels;if(!t)throw new Error("init load aborted, missing levels");var a=e.frag.stats;this.state!==nt.STOPPED&&(this.state=nt.IDLE),e.frag.data=new Uint8Array(e.payload),a.parsing.start=a.buffering.start=self.performance.now(),a.parsing.end=a.buffering.end=self.performance.now(),this.tick()},n.unhandledEncryptionError=function(e,t){var a,o,d=e.tracks;if(d&&!t.encrypted&&((a=d.audio)!=null&&a.encrypted||(o=d.video)!=null&&o.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){var c=this.media,f=new Error("Encrypted track with no key in "+this.fragInfo(t)+" (media "+(c?"attached mediaKeys: "+c.mediaKeys:"detached")+")");return this.warn(f.message),!c||c.mediaKeys?!1:(this.hls.trigger(_.ERROR,{type:ut.KEY_SYSTEM_ERROR,details:Q.KEY_SYSTEM_NO_KEYS,fatal:!1,error:f,frag:t}),this.resetTransmuxer(),!0)}return!1},n.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!t||e.sn!==t.sn||e.level!==t.level},n.fragBufferedComplete=function(e,t){var a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log("Buffered "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+this.fragInfo(e,!1,t)+" > buffer:"+(a?Dc.toString(Pr.getBuffered(a)):"(detached)")+")"),Y(e)){var o;if(e.type!==Ie.SUBTITLE){var d=e.elementaryStreams;if(!Object.keys(d).some(function(f){return!!d[f]})){this.state=nt.IDLE;return}}var c=(o=this.levels)==null?void 0:o[e.level];c!=null&&c.fragmentError&&(this.log("Resetting level fragment error count of "+c.fragmentError+" on frag buffered"),c.fragmentError=0)}this.state=nt.IDLE},n._handleFragmentLoadComplete=function(e){var t=this.transmuxer;if(t){var a=e.frag,o=e.part,d=e.partsLoaded,c=!d||d.length===0||d.some(function(v){return!v}),f=new qn(a.level,a.sn,a.stats.chunkCount+1,0,o?o.index:-1,!c);t.flush(f)}},n._handleFragmentLoadProgress=function(e){},n._doFragLoad=function(e,t,a,o){var d,c=this;a===void 0&&(a=null),this.fragCurrent=e;var f=t.details;if(!this.levels||!f)throw new Error("frag load aborted, missing level"+(f?"":" detail")+"s");var v=null;if(e.encrypted&&!((d=e.decryptdata)!=null&&d.key)){if(this.log("Loading key for "+e.sn+" of ["+f.startSN+"-"+f.endSN+"], "+this.playlistLabel()+" "+e.level),this.state=nt.KEY_LOADING,this.fragCurrent=e,v=this.keyLoader.load(e).then(function(B){if(!c.fragContextChanged(B.frag))return c.hls.trigger(_.KEY_LOADED,B),c.state===nt.KEY_LOADING&&(c.state=nt.IDLE),B}),this.hls.trigger(_.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(v=this.keyLoader.loadClear(e,f.encryptedFragments,this.startFragRequested),v&&this.log("[eme] blocking frag load until media-keys acquired"));var m=this.fragPrevious;if(Y(e)&&(!m||e.sn!==m.sn)){var g=this.shouldLoadParts(t.details,e.end);g!==this.loadingParts&&(this.log("LL-Part loading "+(g?"ON":"OFF")+" loading sn "+(m==null?void 0:m.sn)+"->"+e.sn),this.loadingParts=g)}if(a=Math.max(e.start,a||0),this.loadingParts&&Y(e)){var y=f.partList;if(y&&o){a>f.fragmentEnd&&f.fragmentHint&&(e=f.fragmentHint);var b=this.getNextPart(y,e,a);if(b>-1){var S=y[b];e=this.fragCurrent=S.fragment,this.log("Loading "+e.type+" sn: "+e.sn+" part: "+S.index+" ("+b+"/"+(y.length-1)+") of "+this.fragInfo(e,!1,S)+") cc: "+e.cc+" ["+f.startSN+"-"+f.endSN+"], target: "+parseFloat(a.toFixed(3))),this.nextLoadPosition=S.start+S.duration,this.state=nt.FRAG_LOADING;var L;return v?L=v.then(function(B){return!B||c.fragContextChanged(B.frag)?null:c.doFragPartsLoad(e,S,t,o)}).catch(function(B){return c.handleFragLoadError(B)}):L=this.doFragPartsLoad(e,S,t,o).catch(function(B){return c.handleFragLoadError(B)}),this.hls.trigger(_.FRAG_LOADING,{frag:e,part:S,targetBufferTime:a}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):L}else if(!e.url||this.loadedEndOfParts(y,a))return Promise.resolve(null)}}if(Y(e)&&this.loadingParts){var C;this.log("LL-Part loading OFF after next part miss @"+a.toFixed(2)+" Check buffer at sn: "+e.sn+" loaded parts: "+((C=f.partList)==null?void 0:C.filter(function(B){return B.loaded}).map(function(B){return"["+B.start+"-"+B.end+"]"}))),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log("Loading "+e.type+" sn: "+e.sn+" of "+this.fragInfo(e,!1)+") cc: "+e.cc+" "+("["+f.startSN+"-"+f.endSN+"]")+", target: "+parseFloat(a.toFixed(3))),Ge(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=nt.FRAG_LOADING;var F=this.config.progressive&&e.type!==Ie.SUBTITLE,N;return F&&v?N=v.then(function(B){return!B||c.fragContextChanged(B.frag)?null:c.fragmentLoader.load(e,o)}).catch(function(B){return c.handleFragLoadError(B)}):N=Promise.all([this.fragmentLoader.load(e,F?o:void 0),v]).then(function(B){var re=B[0];return!F&&o&&o(re),re}).catch(function(B){return c.handleFragLoadError(B)}),this.hls.trigger(_.FRAG_LOADING,{frag:e,targetBufferTime:a}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):N},n.doFragPartsLoad=function(e,t,a,o){var d=this;return new Promise(function(c,f){var v,m=[],g=(v=a.details)==null?void 0:v.partList,y=function(S){d.fragmentLoader.loadPart(e,S,o).then(function(L){m[S.index]=L;var C=L.part;d.hls.trigger(_.FRAG_LOADED,L);var F=Is(a.details,e.sn,S.index+1)||js(g,e.sn,S.index+1);if(F)y(F);else return c({frag:e,part:C,partsLoaded:m})}).catch(f)};y(t)})},n.handleFragLoadError=function(e){if("data"in e){var t=e.data;t.frag&&t.details===Q.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===ut.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(_.ERROR,t)}else this.hls.trigger(_.ERROR,{type:ut.OTHER_ERROR,details:Q.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null},n._handleTransmuxerFlush=function(e){var t=this.getCurrentContext(e);if(!t||this.state!==nt.PARSING){!this.fragCurrent&&this.state!==nt.STOPPED&&this.state!==nt.ERROR&&(this.state=nt.IDLE);return}var a=t.frag,o=t.part,d=t.level,c=self.performance.now();a.stats.parsing.end=c,o&&(o.stats.parsing.end=c);var f=this.getLevelDetails(),v=f&&a.sn>f.endSN,m=v||this.shouldLoadParts(f,a.end);m!==this.loadingParts&&(this.log("LL-Part loading "+(m?"ON":"OFF")+" after parsing segment ending @"+a.end.toFixed(2)),this.loadingParts=m),this.updateLevelTiming(a,o,d,e.partial)},n.shouldLoadParts=function(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var a,o=e.partList[0];if(o.fragment.type===Ie.SUBTITLE)return!1;var d=o.end+(((a=e.fragmentHint)==null?void 0:a.duration)||0);if(t>=d){var c,f=this.hls.hasEnoughToStart?((c=this.media)==null?void 0:c.currentTime)||this.lastCurrentTime:this.getLoadPosition();if(f>o.start-o.fragment.duration)return!0}}}return!1},n.getCurrentContext=function(e){var t=this.levels,a=this.fragCurrent,o=e.level,d=e.sn,c=e.part;if(!(t!=null&&t[o]))return this.warn("Levels object was unset while buffering fragment "+d+" of "+this.playlistLabel()+" "+o+". The current chunk will not be buffered."),null;var f=t[o],v=f.details,m=c>-1?Is(v,d,c):null,g=m?m.fragment:Nn(v,d,a);return g?(a&&a!==g&&(g.stats=a.stats),{frag:g,part:m,level:f}):null},n.bufferFragmentData=function(e,t,a,o,d){if(this.state===nt.PARSING){var c=e.data1,f=e.data2,v=c;if(f&&(v=ie(c,f)),!!v.length){var m=this.initPTS[t.cc],g=m?-m.baseTime/m.timescale:void 0,y={type:e.type,frag:t,part:a,chunkMeta:o,offset:g,parent:t.type,data:v};if(this.hls.trigger(_.BUFFER_APPENDING,y),e.dropped&&e.independent&&!a){if(d)return;this.flushBufferGap(t)}}}},n.flushBufferGap=function(e){var t=this.media;if(t){if(!Pr.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}var a=t.currentTime,o=Pr.bufferInfo(t,a,0),d=e.duration,c=Math.min(this.config.maxFragLookUpTolerance*2,d*.25),f=Math.max(Math.min(e.start-c,o.end-c),a+c);e.start-f>c&&this.flushMainBuffer(f,e.start)}},n.getFwdBufferInfo=function(e,t){var a,o=this.getLoadPosition();if(!Ge(o))return null;var d=this.lastCurrentTime>o,c=d||(a=this.media)!=null&&a.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,o,t,c)},n.getFwdBufferInfoAtPos=function(e,t,a,o){var d=Pr.bufferInfo(e,t,o);if(d.len===0&&d.nextStart!==void 0){var c=this.fragmentTracker.getBufferedFrag(t,a);if(c&&(d.nextStart<=c.end||c.gap)){var f=Math.max(Math.min(d.nextStart,c.end)-t,o);return Pr.bufferInfo(e,t,f)}}return d},n.getMaxBufferLength=function(e){var t=this.config,a;return e?a=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):a=t.maxBufferLength,Math.min(a,t.maxMaxBufferLength)},n.reduceMaxBufferLength=function(e,t){var a=this.config,o=Math.max(Math.min(e-t,a.maxBufferLength),t),d=Math.max(e-t*3,a.maxMaxBufferLength/2,o);return d>=o?(a.maxMaxBufferLength=d,this.warn("Reduce max buffer length to "+d+"s"),!0):!1},n.getAppendedFrag=function(e,t){t===void 0&&(t=Ie.MAIN);var a=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return a&&"fragment"in a?a.fragment:a},n.getNextFragment=function(e,t){var a=t.fragments,o=a.length;if(!o)return null;var d=this.config,c=a[0].start,f=d.lowLatencyMode&&!!t.partList,v=null;if(t.live){var m=d.initialLiveManifestSize;if(o<m)return this.warn("Not enough fragments to start playback (have: "+o+", need: "+m+")"),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<c){var g;f&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),v=this.getInitialLiveFragment(t);var y=this.hls.startPosition,b=this.hls.liveSyncPosition,S=v?(y!==-1&&y>=c?y:b)||v.start:e;this.log("Setting startPosition to "+S+" to match start frag at live edge. mainStart: "+y+" liveSyncPosition: "+b+" frag.start: "+((g=v)==null?void 0:g.start)),this.startPosition=this.nextLoadPosition=S}}else e<=c&&(v=a[0]);if(!v){var L=this.loadingParts?t.partEnd:t.fragmentEnd;v=this.getFragmentAtPosition(e,L,t)}var C=this.filterReplacedPrimary(v,t);if(!C&&v){var F=v.sn-t.startSN;C=this.filterReplacedPrimary(a[F+1]||null,t)}return this.mapToInitFragWhenRequired(C)},n.isLoopLoading=function(e,t){var a=this.fragmentTracker.getState(e);return(a===xe.OK||a===xe.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t},n.getNextFragmentLoopLoading=function(e,t,a,o,d){var c=null;if(e.gap&&(c=this.getNextFragment(this.nextLoadPosition,t),c&&!c.gap&&a.nextStart)){var f=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,a.nextStart,o,0);if(f!==null&&a.len+f.len>=d){var v=c.sn;return this.loopSn!==v&&(this.log('buffer full after gaps in "'+o+'" playlist starting at sn: '+v),this.loopSn=v),null}}return this.loopSn=void 0,c},n.filterReplacedPrimary=function(e,t){if(!e)return e;if(uu(this.config)&&e.type!==Ie.SUBTITLE){var a=this.hls.interstitialsManager,o=a==null?void 0:a.bufferingItem;if(o){var d=o.event;if(d){if(d.appendInPlace||Math.abs(e.start-o.start)>1||o.start===0)return null}else if(e.end<=o.start&&(t==null?void 0:t.live)===!1||e.start>o.end&&o.nextEvent&&(o.nextEvent.appendInPlace||e.start-o.end>1))return null}var c=a==null?void 0:a.playerQueue;if(c)for(var f=c.length;f--;){var v=c[f].interstitial;if(v.appendInPlace&&e.start>=v.startTime&&e.end<=v.resumeTime)return null}}return e},n.mapToInitFragWhenRequired=function(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e},n.getNextPart=function(e,t,a){for(var o=-1,d=!1,c=!0,f=0,v=e.length;f<v;f++){var m=e[f];if(c=c&&!m.independent,o>-1&&a<m.start)break;var g=m.loaded;g?o=-1:(d||(m.independent||c)&&m.fragment===t)&&(m.fragment!==t&&this.warn("Need buffer at "+a+" but next unloaded part starts at "+m.start),o=f),d=g}return o},n.loadedEndOfParts=function(e,t){for(var a,o=e.length;o--;){if(a=e[o],!a.loaded)return!1;if(t>a.start)return!0}return!1},n.getInitialLiveFragment=function(e){var t=e.fragments,a=this.fragPrevious,o=null;if(a){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+a.programDateTime),o=xn(t,a.endProgramDateTime,this.config.maxFragLookUpTolerance)),!o){var d=a.sn+1;if(d>=e.startSN&&d<=e.endSN){var c=t[d-e.startSN];a.cc===c.cc&&(o=c,this.log("Live playlist, switching playlist, load frag with next SN: "+o.sn))}o||(o=mn(e,a.cc,a.end),o&&this.log("Live playlist, switching playlist, load frag with same CC: "+o.sn))}}else{var f=this.hls.liveSyncPosition;f!==null&&(o=this.getFragmentAtPosition(f,this.bitrateTest?e.fragmentEnd:e.edge,e))}return o},n.getFragmentAtPosition=function(e,t,a){var o=this.config,d=this.fragPrevious,c=a.fragments,f=a.endSN,v=a.fragmentHint,m=o.maxFragLookUpTolerance,g=a.partList,y=!!(this.loadingParts&&g!=null&&g.length&&v);y&&!this.bitrateTest&&g[g.length-1].fragment.sn===v.sn&&(c=c.concat(v),f=v.sn);var b;if(e<t){var S,L=e<this.lastCurrentTime,C=L||e>t-m||(S=this.media)!=null&&S.paused||!this.startFragRequested?0:m;b=Za(d,c,e,C)}else b=c[c.length-1];if(b){var F=b.sn-a.startSN,N=this.fragmentTracker.getState(b);if((N===xe.OK||N===xe.PARTIAL&&b.gap)&&(d=b),d&&b.sn===d.sn&&(!y||g[0].fragment.sn>b.sn||!a.live)){var B=b.level===d.level;if(B){var re=c[F+1];b.sn<f&&this.fragmentTracker.getState(re)!==xe.OK?b=re:b=null}}}return b},n.alignPlaylists=function(e,t,a){var o=e.fragments.length;if(!o)return this.warn("No fragments in live playlist"),0;var d=e.fragmentStart,c=!t,f=e.alignedSliding&&Ge(d);if(c||!f&&!d){Od(a,e);var v=e.fragmentStart;return this.log("Live playlist sliding: "+v.toFixed(2)+" start-sn: "+(t?t.startSN:"na")+"->"+e.startSN+" fragments: "+o),v}return d},n.waitForCdnTuneIn=function(e){var t=3;return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*t)},n.setStartPosition=function(e,t){var a=this.startPosition;a<t&&(a=-1);var o=this.timelineOffset;if(a===-1){var d=this.startTimeOffset!==null,c=d?this.startTimeOffset:e.startTimeOffset;c!==null&&Ge(c)?(a=t+c,c<0&&(a+=e.edge),a=Math.min(Math.max(t,a),t+e.totalduration),this.log("Setting startPosition to "+a+" for start time offset "+c+" found in "+(d?"multivariant":"media")+" playlist"),this.startPosition=a):e.live?(a=this.hls.liveSyncPosition||t,this.log("Setting startPosition to -1 to start at live edge "+a),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=a=0),this.lastCurrentTime=a+o}this.nextLoadPosition=a+o},n.getLoadPosition=function(){var e,t=this.media,a=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?a=t.currentTime:this.nextLoadPosition>=0&&(a=this.nextLoadPosition),a},n.handleFragLoadAborted=function(e,t){this.transmuxer&&e.type===this.playlistType&&Y(e)&&e.stats.aborted&&(this.log("Fragment "+e.sn+(t?" part "+t.index:"")+" of "+this.playlistLabel()+" "+e.level+" was aborted"),this.resetFragmentLoading(e))},n.resetFragmentLoading=function(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==nt.FRAG_LOADING_WAITING_RETRY)&&(this.state=nt.IDLE)},n.onFragmentOrKeyLoadError=function(e,t){var a;if(t.chunkMeta&&!t.frag){var o=this.getCurrentContext(t.chunkMeta);o&&(t.frag=o.frag)}var d=t.frag;if(!(!d||d.type!==e||!this.levels)){if(this.fragContextChanged(d)){var c;this.warn("Frag load error must match current frag to retry "+d.url+" > "+((c=this.fragCurrent)==null?void 0:c.url));return}var f=t.details===Q.FRAG_GAP;f&&this.fragmentTracker.fragBuffered(d,!0);var v=t.errorAction;if(!v){this.state=nt.ERROR;return}var m=v.action,g=v.flags,y=v.retryCount,b=y===void 0?0:y,S=v.retryConfig,L=!!S,C=L&&m===q.RetryRequest,F=L&&!v.resolved&&g===ue.MoveAllAlternatesMatchingHost,N=(a=this.hls.latestLevelDetails)==null?void 0:a.live;if(!C&&F&&Y(d)&&!d.endList&&N&&!pa(t))this.resetFragmentErrors(e),this.treatAsGap(d),v.resolved=!0;else if((C||F)&&b<S.maxNumRetry){var B,re=P((B=t.response)==null?void 0:B.code),ce=ki(S,b);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+ce,this.state=nt.FRAG_LOADING_WAITING_RETRY,v.resolved=!0,re){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn("Fragment "+d.sn+" of "+e+" "+d.level+" errored with "+t.details+", retrying loading "+(b+1)+"/"+S.maxNumRetry+" in "+ce+"ms")}else if(S)if(this.resetFragmentErrors(e),b<S.maxNumRetry)!f&&m!==q.RemoveAlternatePermanently&&(v.resolved=!0);else{this.warn(t.details+" reached or exceeded max retry ("+b+")");return}else m===q.SendAlternateToPenaltyBox?this.state=nt.WAITING_LEVEL:this.state=nt.ERROR;this.tickImmediate()}},n.checkRetryDate=function(){var e=self.performance.now(),t=this.retryDate,a=t===1/0;(!t||e>=t||a&&!P(0))&&(a&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=nt.IDLE)},n.reduceLengthAndFlushBuffer=function(e){if(this.state===nt.PARSING||this.state===nt.PARSED){var t=e.frag,a=e.parent,o=this.getFwdBufferInfo(this.mediaBuffer,a),d=o&&o.len>.5;d&&this.reduceMaxBufferLength(o.len,(t==null?void 0:t.duration)||10);var c=!d;return c&&this.warn("Buffer full error while media.currentTime ("+this.getLoadPosition()+") is not buffered, flush "+a+" buffer"),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),c}return!1},n.resetFragmentErrors=function(e){e===Ie.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==nt.STOPPED&&(this.state=nt.IDLE)},n.afterBufferFlushed=function(e,t,a){if(e){var o=Pr.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,o,a),this.state===nt.ENDED&&this.resetLoadingState()}},n.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==nt.STOPPED&&(this.state=nt.IDLE)},n.resetStartWhenNotLoaded=function(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;var e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},n.resetWhenMissingContext=function(e){this.log("Loading context changed while buffering sn "+e.sn+" of "+this.playlistLabel()+" "+(e.level===-1?"<removed>":e.level)+". This chunk will not be buffered."),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()},n.removeUnbufferedFrags=function(e){e===void 0&&(e=0),this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)},n.updateLevelTiming=function(e,t,a,o){var d=this,c=a.details;if(!c){this.warn("level.details undefined");return}var f=Object.keys(e.elementaryStreams).reduce(function(y,b){var S=e.elementaryStreams[b];if(S){var L=S.endPTS-S.startPTS;if(L<=0)return d.warn("Could not parse fragment "+e.sn+" "+b+" duration reliably ("+L+")"),y||!1;var C=o?0:po(c,e,S.startPTS,S.endPTS,S.startDTS,S.endDTS,d);return d.hls.trigger(_.LEVEL_PTS_UPDATED,{details:c,level:a,drift:C,type:b,frag:e,start:S.startPTS,end:S.endPTS}),!0}return y},!1);if(!f){var v,m=((v=this.transmuxer)==null?void 0:v.error)===null;if((a.fragmentError===0||m&&(a.fragmentError<2||e.endList))&&this.treatAsGap(e,a),m){var g=new Error("Found no media in fragment "+e.sn+" of "+this.playlistLabel()+" "+e.level+" resetting transmuxer to fallback to playlist timing");if(this.warn(g.message),this.hls.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.FRAG_PARSING_ERROR,fatal:!1,error:g,frag:e,reason:"Found no media in msn "+e.sn+" of "+this.playlistLabel()+' "'+a.url+'"'}),!this.hls)return;this.resetTransmuxer()}}this.state=nt.PARSED,this.log("Parsed "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+this.fragInfo(e,!1,t)+")"),this.hls.trigger(_.FRAG_PARSED,{frag:e,part:t})},n.playlistLabel=function(){return this.playlistType===Ie.MAIN?"level":"track"},n.fragInfo=function(e,t,a){var o,d;return t===void 0&&(t=!0),this.playlistLabel()+" "+e.level+" ("+(a?"part":"frag")+":["+((o=t&&!a?e.startPTS:(a||e).start)!=null?o:NaN).toFixed(3)+"-"+((d=t&&!a?e.endPTS:(a||e).end)!=null?d:NaN).toFixed(3)+"]"+(a&&e.type==="main"?"INDEPENDENT="+(a.independent?"YES":"NO"):"")},n.treatAsGap=function(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)},n.resetTransmuxer=function(){var e;(e=this.transmuxer)==null||e.reset()},n.recoverWorkerError=function(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())},Ne(l,[{key:"startPositionValue",get:function(){var e=this.nextLoadPosition,t=this.startPosition;return t===-1&&e?e:t}},{key:"bufferingEnabled",get:function(){return this.buffering}},{key:"inFlightFrag",get:function(){return{frag:this.fragCurrent,state:this.state}}},{key:"timelineOffset",get:function(){var e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}},{key:"primaryPrefetch",get:function(){if(uu(this.config)){var e,t=(e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event;if(t)return!0}return!1}},{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+"->"+e))}}])}(Va);function uu(s){return!!s.interstitialsController&&s.enableInterstitialPlayback!==!1}var Zu=function(){function s(){this.chunks=[],this.dataLength=0}var l=s.prototype;return l.push=function(r){this.chunks.push(r),this.dataLength+=r.length},l.flush=function(){var r=this.chunks,e=this.dataLength,t;if(r.length)r.length===1?t=r[0]:t=xo(r,e);else return new Uint8Array(0);return this.reset(),t},l.reset=function(){this.chunks.length=0,this.dataLength=0},s}();function xo(s,l){for(var n=new Uint8Array(l),r=0,e=0;e<s.length;e++){var t=s[e];n.set(t,r),r+=t.length}return n}function No(s,l){return l+10<=s.length&&s[l]===51&&s[l+1]===68&&s[l+2]===73&&s[l+3]<255&&s[l+4]<255&&s[l+6]<128&&s[l+7]<128&&s[l+8]<128&&s[l+9]<128}function yo(s,l){return l+10<=s.length&&s[l]===73&&s[l+1]===68&&s[l+2]===51&&s[l+3]<255&&s[l+4]<255&&s[l+6]<128&&s[l+7]<128&&s[l+8]<128&&s[l+9]<128}function Uo(s,l){var n=0;return n=(s[l]&127)<<21,n|=(s[l+1]&127)<<14,n|=(s[l+2]&127)<<7,n|=s[l+3]&127,n}function zs(s,l){for(var n=l,r=0;yo(s,l);){r+=10;var e=Uo(s,l+6);r+=e,No(s,l+10)&&(r+=10),l+=r}if(r>0)return s.subarray(n,n+r)}function Ju(s,l,n,r){var e=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],t=l[n+2],a=t>>2&15;if(a>12){var o=new Error("invalid ADTS sampling index:"+a);s.emit(_.ERROR,_.ERROR,{type:ut.MEDIA_ERROR,details:Q.FRAG_PARSING_ERROR,fatal:!0,error:o,reason:o.message});return}var d=(t>>6&3)+1,c=l[n+3]>>6&3|(t&1)<<2,f="mp4a.40."+d,v=e[a],m=a;(d===5||d===29)&&(m-=3);var g=[d<<3|(m&14)>>1,(m&1)<<7|c<<3];return U.log("manifest codec:"+r+", parsed codec:"+f+", channels:"+c+", rate:"+v+" (ADTS object type:"+d+" sampling index:"+a+")"),{config:g,samplerate:v,channelCount:c,codec:f,parsedCodec:f,manifestCodec:r}}function Nd(s,l){return s[l]===255&&(s[l+1]&246)===240}function ed(s,l){return s[l+1]&1?7:9}function Fo(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function du(s,l){return l+5<s.length}function jn(s,l){return l+1<s.length&&Nd(s,l)}function ws(s,l){return du(s,l)&&Nd(s,l)&&Fo(s,l)<=s.length-l}function td(s,l){if(jn(s,l)){var n=ed(s,l);if(l+n>=s.length)return!1;var r=Fo(s,l);if(r<=n)return!1;var e=l+r;return e===s.length||jn(s,e)}return!1}function Qs(s,l,n,r,e){if(!s.samplerate){var t=Ju(l,n,r,e);if(!t)return;Qe(s,t)}}function _l(s){return 1024*9e4/s}function Bo(s,l){var n=ed(s,l);if(l+n<=s.length){var r=Fo(s,l)-n;if(r>0)return{headerLength:n,frameLength:r}}}function Cs(s,l,n,r,e){var t=_l(s.samplerate),a=r+e*t,o=Bo(l,n),d;if(o){var c=o.frameLength,f=o.headerLength,v=f+c,m=Math.max(0,n+v-l.length);m?(d=new Uint8Array(v-f),d.set(l.subarray(n+f,l.length),0)):d=l.subarray(n+f,n+v);var g={unit:d,pts:a};return m||s.samples.push(g),{sample:g,length:v,missing:m}}var y=l.length-n;d=new Uint8Array(y),d.set(l.subarray(n,l.length),0);var b={unit:d,pts:a};return{sample:b,length:y,missing:-1}}function Ho(s,l){return yo(s,l)&&Uo(s,l+6)+10<=s.length-l}function cu(s){return s instanceof ArrayBuffer?s:s.byteOffset==0&&s.byteLength==s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer}function Vo(s,l,n){return l===void 0&&(l=0),n===void 0&&(n=1/0),rd(s,l,n,Uint8Array)}function rd(s,l,n,r){var e=ua(s),t=1;"BYTES_PER_ELEMENT"in r&&(t=r.BYTES_PER_ELEMENT);var a=Go(s)?s.byteOffset:0,o=(a+s.byteLength)/t,d=(a+l)/t,c=Math.floor(Math.max(0,Math.min(d,o))),f=Math.floor(Math.min(c+Math.max(n,0),o));return new r(e,c,f-c)}function ua(s){return s instanceof ArrayBuffer?s:s.buffer}function Go(s){return s&&s.buffer instanceof ArrayBuffer&&s.byteLength!==void 0&&s.byteOffset!==void 0}function Ko(s){var l={key:s.type,description:"",data:"",mimeType:null,pictureType:null},n=3;if(!(s.size<2)){if(s.data[0]!==n){console.log("Ignore frame with unrecognized character encoding");return}var r=s.data.subarray(1).indexOf(0);if(r!==-1){var e=Nt(Vo(s.data,1,r)),t=s.data[2+r],a=s.data.subarray(3+r).indexOf(0);if(a!==-1){var o=Nt(Vo(s.data,3+r,a)),d;return e==="-->"?d=Nt(Vo(s.data,4+r+a)):d=cu(s.data.subarray(4+r+a)),l.mimeType=e,l.pictureType=t,l.description=o,l.data=d,l}}}}function bo(s){if(!(s.size<2)){var l=Nt(s.data,!0),n=new Uint8Array(s.data.subarray(l.length+1));return{key:s.type,info:l,data:n.buffer}}}function Xs(s){if(!(s.size<2)){if(s.type==="TXXX"){var l=1,n=Nt(s.data.subarray(l),!0);l+=n.length+1;var r=Nt(s.data.subarray(l));return{key:s.type,info:n,data:r}}var e=Nt(s.data.subarray(1));return{key:s.type,info:"",data:e}}}function Al(s){if(s.type==="WXXX"){if(s.size<2)return;var l=1,n=Nt(s.data.subarray(l),!0);l+=n.length+1;var r=Nt(s.data.subarray(l));return{key:s.type,info:n,data:r}}var e=Nt(s.data);return{key:s.type,info:"",data:e}}function Ds(s){return s.type==="PRIV"?bo(s):s.type[0]==="W"?Al(s):s.type==="APIC"?Ko(s):Xs(s)}function cs(s){var l=String.fromCharCode(s[0],s[1],s[2],s[3]),n=Uo(s,4),r=10;return{type:l,size:n,data:s.subarray(r,r+n)}}var zn=10,Ud=10;function Wo(s){for(var l=0,n=[];yo(s,l);){var r=Uo(s,l+6);s[l+5]>>6&1&&(l+=zn),l+=zn;for(var e=l+r;l+Ud<e;){var t=cs(s.subarray(l)),a=Ds(t);a&&n.push(a),l+=t.size+zn}No(s,l)&&(l+=zn)}return n}function Un(s){return s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp"}function id(s){if(s.data.byteLength===8){var l=new Uint8Array(s.data),n=l[3]&1,r=(l[4]<<23)+(l[5]<<15)+(l[6]<<7)+l[7];return r/=45,n&&(r+=4772185884e-2),Math.round(r)}}function yi(s){for(var l=Wo(s),n=0;n<l.length;n++){var r=l[n];if(Un(r))return id(r)}}var Ii=function(s){return s.audioId3="org.id3",s.dateRange="com.apple.quicktime.HLS",s.emsg="https://aomedia.org/emsg/ID3",s.misbklv="urn:misb:KLV:bin:1910.1",s}({});function ya(s,l){return s===void 0&&(s=""),l===void 0&&(l=9e4),{type:s,id:-1,pid:-1,inputTimeScale:l,sequenceNumber:-1,samples:[],dropped:0}}var ba=function(){function s(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var l=s.prototype;return l.resetInitSegment=function(r,e,t,a){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},l.resetTimeStamp=function(r){this.initPTS=r,this.resetContiguity()},l.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},l.canParse=function(r,e){return!1},l.appendFrame=function(r,e,t){},l.demux=function(r,e){this.cachedData&&(r=ie(this.cachedData,r),this.cachedData=null);var t=zs(r,0),a=t?t.length:0,o,d=this._audioTrack,c=this._id3Track,f=t?yi(t):void 0,v=r.length;for((this.basePTS===null||this.frameIndex===0&&Ge(f))&&(this.basePTS=hs(f,e,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),t&&t.length>0&&c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:t,type:Ii.audioId3,duration:Number.POSITIVE_INFINITY});a<v;){if(this.canParse(r,a)){var m=this.appendFrame(d,r,a);m?(this.frameIndex++,this.lastPTS=m.sample.pts,a+=m.length,o=a):a=v}else Ho(r,a)?(t=zs(r,a),c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:t,type:Ii.audioId3,duration:Number.POSITIVE_INFINITY}),a+=t.length,o=a):a++;if(a===v&&o!==v){var g=r.slice(o);this.cachedData?this.cachedData=ie(this.cachedData,g):this.cachedData=g}}return{audioTrack:d,videoTrack:ya(),id3Track:c,textTrack:ya()}},l.demuxSampleAes=function(r,e,t){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},l.flush=function(r){var e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),{audioTrack:this._audioTrack,videoTrack:ya(),id3Track:this._id3Track,textTrack:ya()}},l.destroy=function(){this.cachedData=null,this._audioTrack=this._id3Track=void 0},s}(),hs=function(l,n,r){if(Ge(l))return l*90;var e=r?r.baseTime*9e4/r.timescale:0;return n*9e4+e},To=null,Yo=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Sl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Ya=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],$o=[0,1,1,4];function fs(s,l,n,r,e){if(!(n+24>l.length)){var t=Fn(l,n);if(t&&n+t.frameLength<=l.length){var a=t.samplesPerFrame*9e4/t.sampleRate,o=r+e*a,d={unit:l.subarray(n,n+t.frameLength),pts:o,dts:o};return s.config=[],s.channelCount=t.channelCount,s.samplerate=t.sampleRate,s.samples.push(d),{sample:d,length:t.frameLength,missing:0}}}}function Fn(s,l){var n=s[l+1]>>3&3,r=s[l+1]>>1&3,e=s[l+2]>>4&15,t=s[l+2]>>2&3;if(n!==1&&e!==0&&e!==15&&t!==3){var a=s[l+2]>>1&1,o=s[l+3]>>6,d=n===3?3-r:r===3?3:4,c=Yo[d*14+e-1]*1e3,f=n===3?0:n===2?1:2,v=Sl[f*3+t],m=o===3?1:2,g=Ya[n][r],y=$o[r],b=g*8*y,S=Math.floor(g*c/v+a)*y;if(To===null){var L=navigator.userAgent||"",C=L.match(/Chrome\/(\d+)/i);To=C?parseInt(C[1]):0}var F=!!To&&To<=87;return F&&r===2&&c>=224e3&&o===0&&(s[l+3]=s[l+3]|128),{sampleRate:v,channelCount:m,frameLength:S,samplesPerFrame:b}}}function Qn(s,l){return s[l]===255&&(s[l+1]&224)===224&&(s[l+1]&6)!==0}function Zs(s,l){return l+1<s.length&&Qn(s,l)}function Ll(s,l){var n=4;return Qn(s,l)&&n<=s.length-l}function _o(s,l){if(l+1<s.length&&Qn(s,l)){var n=4,r=Fn(s,l),e=n;r!=null&&r.frameLength&&(e=r.frameLength);var t=l+e;return t===s.length||Zs(s,t)}return!1}var kl=function(s){function l(r,e){var t;return t=s.call(this)||this,t.observer=void 0,t.config=void 0,t.observer=r,t.config=e,t}Pe(l,s);var n=l.prototype;return n.resetInitSegment=function(e,t,a,o){s.prototype.resetInitSegment.call(this,e,t,a,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:o,inputTimeScale:9e4,dropped:0}},l.probe=function(e,t){if(!e)return!1;var a=zs(e,0),o=(a==null?void 0:a.length)||0;if(_o(e,o))return!1;for(var d=e.length;o<d;o++)if(td(e,o))return t.log("ADTS sync word found !"),!0;return!1},n.canParse=function(e,t){return ws(e,t)},n.appendFrame=function(e,t,a){Qs(e,this.observer,t,a,e.manifestCodec);var o=Cs(e,t,a,this.basePTS,this.frameIndex);if(o&&o.missing===0)return o},l}(ba),Il=function(l,n){var r=0,e=5;n+=e;for(var t=new Uint32Array(1),a=new Uint32Array(1),o=new Uint8Array(1);e>0;){o[0]=l[n];var d=Math.min(e,8),c=8-d;a[0]=4278190080>>>24+c<<c,t[0]=(o[0]&a[0])>>c,r=r?r<<d|t[0]:t[0],n+=1,e-=d}return r},qo=function(s){function l(r){var e;return e=s.call(this)||this,e.observer=void 0,e.observer=r,e}Pe(l,s);var n=l.prototype;return n.resetInitSegment=function(e,t,a,o){s.prototype.resetInitSegment.call(this,e,t,a,o),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:o,inputTimeScale:9e4,dropped:0}},n.canParse=function(e,t){return t+64<e.length},n.appendFrame=function(e,t,a){var o=Rl(e,t,a,this.basePTS,this.frameIndex);if(o!==-1){var d=e.samples[e.samples.length-1];return{sample:d,length:o,missing:0}}},l.probe=function(e){if(!e)return!1;var t=zs(e,0);if(!t)return!1;var a=t.length;return e[a]===11&&e[a+1]===119&&yi(t)!==void 0&&Il(e,a)<16},l}(ba);function Rl(s,l,n,r,e){if(n+8>l.length||l[n]!==11||l[n+1]!==119)return-1;var t=l[n+4]>>6;if(t>=3)return-1;var a=[48e3,44100,32e3],o=a[t],d=l[n+4]&63,c=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920],f=c[d*3+t]*2;if(n+f>l.length)return-1;var v=l[n+6]>>5,m=0;v===2?m+=2:(v&1&&v!==1&&(m+=2),v&4&&(m+=2));var g=(l[n+6]<<8|l[n+7])>>12-m&1,y=[2,1,2,3,3,4,4,5],b=y[v]+g,S=l[n+5]>>3,L=l[n+5]&7,C=new Uint8Array([t<<6|S<<1|L>>2,(L&3)<<6|v<<3|g<<2|d>>4,d<<4&224]),F=1536/o*9e4,N=r+e*F,B=l.subarray(n,n+f);return s.config=C,s.channelCount=b,s.samplerate=o,s.samples.push({unit:B,pts:N}),f}var ad=function(s){function l(){return s.apply(this,arguments)||this}Pe(l,s);var n=l.prototype;return n.resetInitSegment=function(e,t,a,o){s.prototype.resetInitSegment.call(this,e,t,a,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:o,inputTimeScale:9e4,dropped:0}},l.probe=function(e){if(!e)return!1;var t=zs(e,0),a=(t==null?void 0:t.length)||0;if(t&&e[a]===11&&e[a+1]===119&&yi(t)!==void 0&&Il(e,a)<=16)return!1;for(var o=e.length;a<o;a++)if(_o(e,a))return U.log("MPEG Audio sync word found !"),!0;return!1},n.canParse=function(e,t){return Ll(e,t)},n.appendFrame=function(e,t,a){if(this.basePTS!==null)return fs(e,t,a,this.basePTS,this.frameIndex)},l}(ba),wl=/\/emsg[-/]ID3/i,hu=function(){function s(n,r){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=r}var l=s.prototype;return l.resetTimeStamp=function(){},l.resetInitSegment=function(r,e,t,a){var o=this.videoTrack=ya("video",1),d=this.audioTrack=ya("audio",1),c=this.txtTrack=ya("text",1);if(this.id3Track=ya("id3",1),this.timeOffset=0,!!(r!=null&&r.byteLength)){var f=_i(r);if(f.video){var v=f.video,m=v.id,g=v.timescale,y=v.codec,b=v.supplemental;o.id=m,o.timescale=c.timescale=g,o.codec=y,o.supplemental=b}if(f.audio){var S=f.audio,L=S.id,C=S.timescale,F=S.codec;d.id=L,d.timescale=C,d.codec=F}c.id=Pt.text,o.sampleDuration=0,o.duration=d.duration=a}},l.resetContiguity=function(){this.remainderData=null},s.probe=function(r){return ln(r)},l.demux=function(r,e){this.timeOffset=e;var t=r,a=this.videoTrack,o=this.txtTrack;if(this.config.progressive){this.remainderData&&(t=ie(this.remainderData,r));var d=Ft(t);this.remainderData=d.remainder,a.samples=d.valid||new Uint8Array}else a.samples=t;var c=this.extractID3Track(a,e);return o.samples=er(e,a),{videoTrack:a,audioTrack:this.audioTrack,id3Track:c,textTrack:this.txtTrack}},l.flush=function(){var r=this.timeOffset,e=this.videoTrack,t=this.txtTrack;e.samples=this.remainderData||new Uint8Array,this.remainderData=null;var a=this.extractID3Track(e,this.timeOffset);return t.samples=er(r,e),{videoTrack:e,audioTrack:ya(),id3Track:a,textTrack:ya()}},l.extractID3Track=function(r,e){var t=this,a=this.id3Track;if(r.samples.length){var o=Ar(r.samples,["emsg"]);o&&o.forEach(function(d){var c=$r(d);if(wl.test(c.schemeIdUri)){var f=Js(c,e),v=c.eventDuration===4294967295?Number.POSITIVE_INFINITY:c.eventDuration/c.timeScale;v<=.001&&(v=Number.POSITIVE_INFINITY);var m=c.payload;a.samples.push({data:m,len:m.byteLength,dts:f,pts:f,type:Ii.emsg,duration:v})}else if(t.config.enableEmsgKLVMetadata&&c.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){var g=Js(c,e);a.samples.push({data:c.payload,len:c.payload.byteLength,dts:g,pts:g,type:Ii.misbklv,duration:Number.POSITIVE_INFINITY})}})}return a},l.demuxSampleAes=function(r,e,t){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},l.destroy=function(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0},s}();function Js(s,l){return Ge(s.presentationTime)?s.presentationTime/s.timeScale:l+s.presentationTimeDelta/s.timeScale}var Cl=function(){function s(n,r,e){this.keyData=void 0,this.decrypter=void 0,this.keyData=e,this.decrypter=new Xr(r,{removePKCS7Padding:!1})}var l=s.prototype;return l.decryptBuffer=function(r){return this.decrypter.decrypt(r,this.keyData.key.buffer,this.keyData.iv.buffer,Yt.cbc)},l.decryptAacSample=function(r,e,t){var a=this,o=r[e].unit;if(!(o.length<=16)){var d=o.subarray(16,o.length-o.length%16),c=d.buffer.slice(d.byteOffset,d.byteOffset+d.length);this.decryptBuffer(c).then(function(f){var v=new Uint8Array(f);o.set(v,16),a.decrypter.isSync()||a.decryptAacSamples(r,e+1,t)}).catch(t)}},l.decryptAacSamples=function(r,e,t){for(;;e++){if(e>=r.length){t();return}if(!(r[e].unit.length<32)&&(this.decryptAacSample(r,e,t),!this.decrypter.isSync()))return}},l.getAvcEncryptedData=function(r){for(var e=Math.floor((r.length-48)/160)*16+16,t=new Int8Array(e),a=0,o=32;o<r.length-16;o+=160,a+=16)t.set(r.subarray(o,o+16),a);return t},l.getAvcDecryptedUnit=function(r,e){for(var t=new Uint8Array(e),a=0,o=32;o<r.length-16;o+=160,a+=16)r.set(t.subarray(a,a+16),o);return r},l.decryptAvcSample=function(r,e,t,a,o){var d=this,c=pi(o.data),f=this.getAvcEncryptedData(c);this.decryptBuffer(f.buffer).then(function(v){o.data=d.getAvcDecryptedUnit(c,v),d.decrypter.isSync()||d.decryptAvcSamples(r,e,t+1,a)}).catch(a)},l.decryptAvcSamples=function(r,e,t,a){if(r instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,t=0){if(e>=r.length){a();return}for(var o=r[e].units;!(t>=o.length);t++){var d=o[t];if(!(d.data.length<=48||d.type!==1&&d.type!==5)&&(this.decryptAvcSample(r,e,t,a,d),!this.decrypter.isSync()))return}}},s}(),Dl=function(){function s(){this.VideoSample=null}var l=s.prototype;return l.createVideoSample=function(r,e,t){return{key:r,frame:!1,pts:e,dts:t,units:[],length:0}},l.getLastNalUnit=function(r){var e,t=this.VideoSample,a;if((!t||t.units.length===0)&&(t=r[r.length-1]),(e=t)!=null&&e.units){var o=t.units;a=o[o.length-1]}return a},l.pushAccessUnit=function(r,e){if(r.units.length&&r.frame){if(r.pts===void 0){var t=e.samples,a=t.length;if(a){var o=t[a-1];r.pts=o.pts,r.dts=o.dts}else{e.dropped++;return}}e.samples.push(r)}},l.parseNALu=function(r,e,t){var a=e.byteLength,o=r.naluState||0,d=o,c=[],f=0,v,m,g,y=-1,b=0;for(o===-1&&(y=0,b=this.getNALuType(e,0),o=0,f=1);f<a;){if(v=e[f++],!o){o=v?0:1;continue}if(o===1){o=v?0:2;continue}if(!v)o=3;else if(v===1){if(m=f-o-1,y>=0){var S={data:e.subarray(y,m),type:b};c.push(S)}else{var L=this.getLastNalUnit(r.samples);L&&(d&&f<=4-d&&L.state&&(L.data=L.data.subarray(0,L.data.byteLength-d)),m>0&&(L.data=ie(L.data,e.subarray(0,m)),L.state=0))}f<a?(g=this.getNALuType(e,f),y=f,b=g,o=0):o=-1}else o=0}if(y>=0&&o>=0){var C={data:e.subarray(y,a),type:b,state:o};c.push(C)}if(c.length===0){var F=this.getLastNalUnit(r.samples);F&&(F.data=ie(F.data,e))}return r.naluState=o,c},s}(),Xn=function(){function s(n){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=n,this.bytesAvailable=n.byteLength,this.word=0,this.bitsAvailable=0}var l=s.prototype;return l.loadWord=function(){var r=this.data,e=this.bytesAvailable,t=r.byteLength-e,a=new Uint8Array(4),o=Math.min(4,e);if(o===0)throw new Error("no bytes available");a.set(r.subarray(t,t+o)),this.word=new DataView(a.buffer).getUint32(0),this.bitsAvailable=o*8,this.bytesAvailable-=o},l.skipBits=function(r){var e;r=Math.min(r,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>r?(this.word<<=r,this.bitsAvailable-=r):(r-=this.bitsAvailable,e=r>>3,r-=e<<3,this.bytesAvailable-=e,this.loadWord(),this.word<<=r,this.bitsAvailable-=r)},l.readBits=function(r){var e=Math.min(this.bitsAvailable,r),t=this.word>>>32-e;if(r>32&&U.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0)this.word<<=e;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return e=r-e,e>0&&this.bitsAvailable?t<<e|this.readBits(e):t},l.skipLZ=function(){var r;for(r=0;r<this.bitsAvailable;++r)if((this.word&2147483648>>>r)!==0)return this.word<<=r,this.bitsAvailable-=r,r;return this.loadWord(),r+this.skipLZ()},l.skipUEG=function(){this.skipBits(1+this.skipLZ())},l.skipEG=function(){this.skipBits(1+this.skipLZ())},l.readUEG=function(){var r=this.skipLZ();return this.readBits(r+1)-1},l.readEG=function(){var r=this.readUEG();return 1&r?1+r>>>1:-1*(r>>>1)},l.readBoolean=function(){return this.readBits(1)===1},l.readUByte=function(){return this.readBits(8)},l.readUShort=function(){return this.readBits(16)},l.readUInt=function(){return this.readBits(32)},s}(),Ao=function(s){function l(){return s.apply(this,arguments)||this}Pe(l,s);var n=l.prototype;return n.parsePES=function(e,t,a,o){var d=this,c=this.parseNALu(e,a.data,o),f=this.VideoSample,v,m=!1;a.data=null,f&&c.length&&!e.audFound&&(this.pushAccessUnit(f,e),f=this.VideoSample=this.createVideoSample(!1,a.pts,a.dts)),c.forEach(function(g){var y,b;switch(g.type){case 1:{var S=!1;v=!0;var L=g.data;if(m&&L.length>4){var C=d.readSliceType(L);(C===2||C===4||C===7||C===9)&&(S=!0)}if(S){var F;(F=f)!=null&&F.frame&&!f.key&&(d.pushAccessUnit(f,e),f=d.VideoSample=null)}f||(f=d.VideoSample=d.createVideoSample(!0,a.pts,a.dts)),f.frame=!0,f.key=S;break}case 5:v=!0,(y=f)!=null&&y.frame&&!f.key&&(d.pushAccessUnit(f,e),f=d.VideoSample=null),f||(f=d.VideoSample=d.createVideoSample(!0,a.pts,a.dts)),f.key=!0,f.frame=!0;break;case 6:{v=!0,Hr(g.data,1,a.pts,t.samples);break}case 7:{var N,B;v=!0,m=!0;var re=g.data,ce=d.readSPS(re);if(!e.sps||e.width!==ce.width||e.height!==ce.height||((N=e.pixelRatio)==null?void 0:N[0])!==ce.pixelRatio[0]||((B=e.pixelRatio)==null?void 0:B[1])!==ce.pixelRatio[1]){e.width=ce.width,e.height=ce.height,e.pixelRatio=ce.pixelRatio,e.sps=[re];for(var Se=re.subarray(1,4),Ke="avc1.",be=0;be<3;be++){var Z=Se[be].toString(16);Z.length<2&&(Z="0"+Z),Ke+=Z}e.codec=Ke}break}case 8:v=!0,e.pps=[g.data];break;case 9:v=!0,e.audFound=!0,(b=f)!=null&&b.frame&&(d.pushAccessUnit(f,e),f=null),f||(f=d.VideoSample=d.createVideoSample(!1,a.pts,a.dts));break;case 12:v=!0;break;default:v=!1;break}if(f&&v){var ne=f.units;ne.push(g)}}),o&&f&&(this.pushAccessUnit(f,e),this.VideoSample=null)},n.getNALuType=function(e,t){return e[t]&31},n.readSliceType=function(e){var t=new Xn(e);return t.readUByte(),t.readUEG(),t.readUEG()},n.skipScalingList=function(e,t){for(var a=8,o=8,d,c=0;c<e;c++)o!==0&&(d=t.readEG(),o=(a+d+256)%256),a=o===0?a:o},n.readSPS=function(e){var t=new Xn(e),a=0,o=0,d=0,c=0,f,v,m,g=t.readUByte.bind(t),y=t.readBits.bind(t),b=t.readUEG.bind(t),S=t.readBoolean.bind(t),L=t.skipBits.bind(t),C=t.skipEG.bind(t),F=t.skipUEG.bind(t),N=this.skipScalingList.bind(this);g();var B=g();if(y(5),L(3),g(),F(),B===100||B===110||B===122||B===244||B===44||B===83||B===86||B===118||B===128){var re=b();if(re===3&&L(1),F(),F(),L(1),S())for(v=re!==3?8:12,m=0;m<v;m++)S()&&(m<6?N(16,t):N(64,t))}F();var ce=b();if(ce===0)b();else if(ce===1)for(L(1),C(),C(),f=b(),m=0;m<f;m++)C();F(),L(1);var Se=b(),Ke=b(),be=y(1);be===0&&L(1),L(1),S()&&(a=b(),o=b(),d=b(),c=b());var Z=[1,1];if(S()&&S()){var ne=g();switch(ne){case 1:Z=[1,1];break;case 2:Z=[12,11];break;case 3:Z=[10,11];break;case 4:Z=[16,11];break;case 5:Z=[40,33];break;case 6:Z=[24,11];break;case 7:Z=[20,11];break;case 8:Z=[32,11];break;case 9:Z=[80,33];break;case 10:Z=[18,11];break;case 11:Z=[15,11];break;case 12:Z=[64,33];break;case 13:Z=[160,99];break;case 14:Z=[4,3];break;case 15:Z=[3,2];break;case 16:Z=[2,1];break;case 255:{Z=[g()<<8|g(),g()<<8|g()];break}}}return{width:Math.ceil((Se+1)*16-a*2-o*2),height:(2-be)*(Ke+1)*16-(be?2:4)*(d+c),pixelRatio:Z}},l}(Dl),So=function(s){function l(){for(var r,e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return r=s.call.apply(s,[this].concat(t))||this,r.initVPS=null,r}Pe(l,s);var n=l.prototype;return n.parsePES=function(e,t,a,o){var d=this,c=this.parseNALu(e,a.data,o),f=this.VideoSample,v,m=!1;a.data=null,f&&c.length&&!e.audFound&&(this.pushAccessUnit(f,e),f=this.VideoSample=this.createVideoSample(!1,a.pts,a.dts)),c.forEach(function(g){var y,b;switch(g.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:f||(f=d.VideoSample=d.createVideoSample(!1,a.pts,a.dts)),f.frame=!0,v=!0;break;case 16:case 17:case 18:case 21:if(v=!0,m){var S;(S=f)!=null&&S.frame&&!f.key&&(d.pushAccessUnit(f,e),f=d.VideoSample=null)}f||(f=d.VideoSample=d.createVideoSample(!0,a.pts,a.dts)),f.key=!0,f.frame=!0;break;case 19:case 20:v=!0,(y=f)!=null&&y.frame&&!f.key&&(d.pushAccessUnit(f,e),f=d.VideoSample=null),f||(f=d.VideoSample=d.createVideoSample(!0,a.pts,a.dts)),f.key=!0,f.frame=!0;break;case 39:v=!0,Hr(g.data,2,a.pts,t.samples);break;case 32:v=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=Qe(e.params,d.readVPS(g.data)),d.initVPS=g.data),e.vps=[g.data];break;case 33:if(v=!0,m=!0,e.vps!==void 0&&e.vps[0]!==d.initVPS&&e.sps!==void 0&&!d.matchSPS(e.sps[0],g.data)&&(d.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){var L=d.readSPS(g.data);e.width=L.width,e.height=L.height,e.pixelRatio=L.pixelRatio,e.codec=L.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(var C in L.params)e.params[C]=L.params[C]}d.pushParameterSet(e.sps,g.data,e.vps),f||(f=d.VideoSample=d.createVideoSample(!0,a.pts,a.dts)),f.key=!0;break;case 34:if(v=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];var F=d.readPPS(g.data);for(var N in F)e.params[N]=F[N]}d.pushParameterSet(e.pps,g.data,e.vps)}break;case 35:v=!0,e.audFound=!0,(b=f)!=null&&b.frame&&(d.pushAccessUnit(f,e),f=null),f||(f=d.VideoSample=d.createVideoSample(!1,a.pts,a.dts));break;default:v=!1;break}if(f&&v){var B=f.units;B.push(g)}}),o&&f&&(this.pushAccessUnit(f,e),this.VideoSample=null)},n.pushParameterSet=function(e,t,a){(a&&a[0]===this.initVPS||!a&&!e.length)&&e.push(t)},n.getNALuType=function(e,t){return(e[t]&126)>>>1},n.ebsp2rbsp=function(e){for(var t=new Uint8Array(e.byteLength),a=0,o=0;o<e.byteLength;o++)o>=2&&e[o]===3&&e[o-1]===0&&e[o-2]===0||(t[a]=e[o],a++);return new Uint8Array(t.buffer,0,a)},n.pushAccessUnit=function(e,t){s.prototype.pushAccessUnit.call(this,e,t),this.initVPS&&(this.initVPS=null)},n.readVPS=function(e){var t=new Xn(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);var a=t.readBits(3),o=t.readBoolean();return{numTemporalLayers:a+1,temporalIdNested:o}},n.readSPS=function(e){var t=new Xn(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);var a=t.readBits(3);t.readBoolean();for(var o=t.readBits(2),d=t.readBoolean(),c=t.readBits(5),f=t.readUByte(),v=t.readUByte(),m=t.readUByte(),g=t.readUByte(),y=t.readUByte(),b=t.readUByte(),S=t.readUByte(),L=t.readUByte(),C=t.readUByte(),F=t.readUByte(),N=t.readUByte(),B=[],re=[],ce=0;ce<a;ce++)B.push(t.readBoolean()),re.push(t.readBoolean());if(a>0)for(var Se=a;Se<8;Se++)t.readBits(2);for(var Ke=0;Ke<a;Ke++)B[Ke]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),re[Ke]&&t.readUByte();t.readUEG();var be=t.readUEG();be==3&&t.skipBits(1);var Z=t.readUEG(),ne=t.readUEG(),Re=t.readBoolean(),Tt=0,ot=0,pt=0,Bt=0;Re&&(Tt+=t.readUEG(),ot+=t.readUEG(),pt+=t.readUEG(),Bt+=t.readUEG());for(var cr=t.readUEG(),or=t.readUEG(),hr=t.readUEG(),xr=t.readBoolean(),fr=xr?0:a;fr<=a;fr++)t.skipUEG(),t.skipUEG(),t.skipUEG();t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG();var lr=t.readBoolean();if(lr){var _r=t.readBoolean();if(_r)for(var Dr=0;Dr<4;Dr++)for(var bi=0;bi<(Dr===3?2:6);bi++){var jr=t.readBoolean();if(!jr)t.readUEG();else{var ji=Math.min(64,1<<4+(Dr<<1));Dr>1&&t.readEG();for(var ia=0;ia<ji;ia++)t.readEG()}}}t.readBoolean(),t.readBoolean();var Fi=t.readBoolean();Fi&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());for(var sn=t.readUEG(),Gi=0,si=0;si<sn;si++){var ir=!1;if(si!==0&&(ir=t.readBoolean()),ir){si===sn&&t.readUEG(),t.readBoolean(),t.readUEG();for(var qa=0,Da=0;Da<=Gi;Da++){var Tn=t.readBoolean(),ca=!1;Tn||(ca=t.readBoolean()),(Tn||ca)&&qa++}Gi=qa}else{var Pn=t.readUEG(),_n=t.readUEG();Gi=Pn+_n;for(var Ma=0;Ma<Pn;Ma++)t.readUEG(),t.readBoolean();for(var ja=0;ja<_n;ja++)t.readUEG(),t.readBoolean()}}var on=t.readBoolean();if(on)for(var Ql=t.readUEG(),ns=0;ns<Ql;ns++){for(var ll=0;ll<hr+4;ll++)t.readBits(1);t.readBits(1)}var Ld=0,Xl=1,Zl=1,ao=!0,ci=1,Ti=0;t.readBoolean(),t.readBoolean();var ss=!1,wi=t.readBoolean();if(wi){var Es=t.readBoolean();if(Es){var Gn=t.readUByte(),ys=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],An=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Gn>0&&Gn<16?(Xl=ys[Gn-1],Zl=An[Gn-1]):Gn===255&&(Xl=t.readBits(16),Zl=t.readBits(16))}var Jl=t.readBoolean();Jl&&t.readBoolean();var no=t.readBoolean();if(no){t.readBits(3),t.readBoolean();var eu=t.readBoolean();eu&&(t.readUByte(),t.readUByte(),t.readUByte())}var kd=t.readBoolean();kd&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),ss=t.readBoolean(),ss&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG());var cc=t.readBoolean();if(cc){ci=t.readBits(32),Ti=t.readBits(32);var Vu=t.readBoolean();Vu&&t.readUEG();var Id=t.readBoolean();if(Id){var tu=t.readBoolean(),so=t.readBoolean(),oo=!1;(tu||so)&&(oo=t.readBoolean(),oo&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),oo&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(var Gu=0;Gu<=a;Gu++){ao=t.readBoolean();var hc=ao||t.readBoolean(),fc=!1;hc?t.readEG():fc=t.readBoolean();var mh=fc?1:t.readUEG()+1;if(tu)for(var vc=0;vc<mh;vc++)t.readUEG(),t.readUEG(),oo&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(so)for(var ph=0;ph<mh;ph++)t.readUEG(),t.readUEG(),oo&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}}var Ku=t.readBoolean();Ku&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),Ld=t.readUEG())}var ru=Z,iu=ne;if(Re){var ul=1,Wu=1;be===1?ul=Wu=2:be==2&&(ul=2),ru=Z-ul*ot-ul*Tt,iu=ne-Wu*Bt-Wu*pt}for(var gh=o?["A","B","C"][o]:"",Eh=f<<24|v<<16|m<<8|g,mc=0,Yu=0;Yu<32;Yu++)mc=(mc|(Eh>>Yu&1)<<31-Yu)>>>0;var pc=mc.toString(16);c===1&&pc==="2"&&(pc="6");var yh=d?"H":"L";return{codecString:"hvc1."+gh+c+"."+pc+"."+yh+N+".B0",params:{general_tier_flag:d,general_profile_idc:c,general_profile_space:o,general_profile_compatibility_flags:[f,v,m,g],general_constraint_indicator_flags:[y,b,S,L,C,F],general_level_idc:N,bit_depth:cr+8,bit_depth_luma_minus8:cr,bit_depth_chroma_minus8:or,min_spatial_segmentation_idc:Ld,chroma_format_idc:be,frame_rate:{fixed:ao,fps:Ti/ci}},width:ru,height:iu,pixelRatio:[Xl,Zl]}},n.readPPS=function(e){var t=new Xn(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2);var a=t.readBoolean();a&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);var o=t.readBoolean(),d=t.readBoolean(),c=1;return d&&o?c=0:d?c=3:o&&(c=2),{parallelismType:c}},n.matchSPS=function(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)},l}(Dl),qi=188,Ml=function(){function s(n,r,e,t){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=n,this.config=r,this.typeSupported=e,this.logger=t,this.videoParser=null}s.probe=function(r,e){var t=s.syncOffset(r);return t>0&&e.warn("MPEG2-TS detected but first sync word found @ offset "+t),t!==-1},s.syncOffset=function(r){for(var e=r.length,t=Math.min(qi*5,e-qi)+1,a=0;a<t;){for(var o=!1,d=-1,c=0,f=a;f<e;f+=qi)if(r[f]===71&&(e-f===qi||r[f+qi]===71)){if(c++,d===-1&&(d=f,d!==0&&(t=Math.min(d+qi*99,r.length-qi)+1)),o||(o=Zn(r,f)===0),o&&c>1&&(d===0&&c>2||f+qi>t))return d}else{if(c)return-1;break}a++}return-1},s.createTrack=function(r,e){return{container:r==="video"||r==="audio"?"video/mp2t":void 0,type:r,id:Pt[r],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:r==="audio"?e:void 0}};var l=s.prototype;return l.resetInitSegment=function(r,e,t,a){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=s.createTrack("video"),this._videoTrack.duration=a,this._audioTrack=s.createTrack("audio",a),this._id3Track=s.createTrack("id3"),this._txtTrack=s.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=e,this.videoCodec=t},l.resetTimeStamp=function(){},l.resetContiguity=function(){var r=this._audioTrack,e=this._videoTrack,t=this._id3Track;r&&(r.pesData=null),e&&(e.pesData=null),t&&(t.pesData=null),this.aacOverFlow=null,this.remainderData=null},l.demux=function(r,e,t,a){t===void 0&&(t=!1),a===void 0&&(a=!1),t||(this.sampleAes=null);var o,d=this._videoTrack,c=this._audioTrack,f=this._id3Track,v=this._txtTrack,m=d.pid,g=d.pesData,y=c.pid,b=f.pid,S=c.pesData,L=f.pesData,C=null,F=this.pmtParsed,N=this._pmtId,B=r.length;if(this.remainderData&&(r=ie(this.remainderData,r),B=r.length,this.remainderData=null),B<qi&&!a)return this.remainderData=r,{audioTrack:c,videoTrack:d,id3Track:f,textTrack:v};var re=Math.max(0,s.syncOffset(r));B-=(B-re)%qi,B<r.byteLength&&!a&&(this.remainderData=new Uint8Array(r.buffer,B,r.buffer.byteLength-B));for(var ce=0,Se=re;Se<B;Se+=qi)if(r[Se]===71){var Ke=!!(r[Se+1]&64),be=Zn(r,Se),Z=(r[Se+3]&48)>>4,ne=void 0;if(Z>1){if(ne=Se+5+r[Se+4],ne===Se+qi)continue}else ne=Se+4;switch(be){case m:Ke&&(g&&(o=rn(g,this.logger))&&(this.readyVideoParser(d.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(d,v,o,!1)),g={data:[],size:0}),g&&(g.data.push(r.subarray(ne,Se+qi)),g.size+=Se+qi-ne);break;case y:if(Ke){if(S&&(o=rn(S,this.logger)))switch(c.segmentCodec){case"aac":this.parseAACPES(c,o);break;case"mp3":this.parseMPEGPES(c,o);break;case"ac3":this.parseAC3PES(c,o);break}S={data:[],size:0}}S&&(S.data.push(r.subarray(ne,Se+qi)),S.size+=Se+qi-ne);break;case b:Ke&&(L&&(o=rn(L,this.logger))&&this.parseID3PES(f,o),L={data:[],size:0}),L&&(L.data.push(r.subarray(ne,Se+qi)),L.size+=Se+qi-ne);break;case 0:Ke&&(ne+=r[ne]+1),N=this._pmtId=fu(r,ne);break;case N:{Ke&&(ne+=r[ne]+1);var Re=vu(r,ne,this.typeSupported,t,this.observer,this.logger);m=Re.videoPid,m>0&&(d.pid=m,d.segmentCodec=Re.segmentVideoCodec),y=Re.audioPid,y>0&&(c.pid=y,c.segmentCodec=Re.segmentAudioCodec),b=Re.id3Pid,b>0&&(f.pid=b),C!==null&&!F&&(this.logger.warn("MPEG-TS PMT found at "+Se+" after unknown PID '"+C+"'. Backtracking to sync byte @"+re+" to parse all TS packets."),C=null,Se=re-188),F=this.pmtParsed=!0;break}case 17:case 8191:break;default:C=be;break}}else ce++;ce>0&&nd(this.observer,new Error("Found "+ce+" TS packet/s that do not start with 0x47"),void 0,this.logger),d.pesData=g,c.pesData=S,f.pesData=L;var Tt={audioTrack:c,videoTrack:d,id3Track:f,textTrack:v};return a&&this.extractRemainingSamples(Tt),Tt},l.flush=function(){var r=this.remainderData;this.remainderData=null;var e;return r?e=this.demux(r,-1,!1,!0):e={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},l.extractRemainingSamples=function(r){var e=r.audioTrack,t=r.videoTrack,a=r.id3Track,o=r.textTrack,d=t.pesData,c=e.pesData,f=a.pesData,v;if(d&&(v=rn(d,this.logger))?(this.readyVideoParser(t.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(t,o,v,!0),t.pesData=null)):t.pesData=d,c&&(v=rn(c,this.logger))){switch(e.segmentCodec){case"aac":this.parseAACPES(e,v);break;case"mp3":this.parseMPEGPES(e,v);break;case"ac3":this.parseAC3PES(e,v);break}e.pesData=null}else c!=null&&c.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),e.pesData=c;f&&(v=rn(f,this.logger))?(this.parseID3PES(a,v),a.pesData=null):a.pesData=f},l.demuxSampleAes=function(r,e,t){var a=this.demux(r,t,!0,!this.config.progressive),o=this.sampleAes=new Cl(this.observer,this.config,e);return this.decrypt(a,o)},l.readyVideoParser=function(r){this.videoParser===null&&(r==="avc"?this.videoParser=new Ao:r==="hevc"&&(this.videoParser=new So))},l.decrypt=function(r,e){return new Promise(function(t){var a=r.audioTrack,o=r.videoTrack;a.samples&&a.segmentCodec==="aac"?e.decryptAacSamples(a.samples,0,function(){o.samples?e.decryptAvcSamples(o.samples,0,0,function(){t(r)}):t(r)}):o.samples&&e.decryptAvcSamples(o.samples,0,0,function(){t(r)})})},l.destroy=function(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0},l.parseAACPES=function(r,e){var t=0,a=this.aacOverFlow,o=e.data;if(a){this.aacOverFlow=null;var d=a.missing,c=a.sample.unit.byteLength;if(d===-1)o=ie(a.sample.unit,o);else{var f=c-d;a.sample.unit.set(o.subarray(0,d),f),r.samples.push(a.sample),t=a.missing}}var v,m;for(v=t,m=o.length;v<m-1&&!jn(o,v);v++);if(v!==t){var g,y=v<m-1;if(y?g="AAC PES did not start with ADTS header,offset:"+v:g="No ADTS header found in AAC PES",nd(this.observer,new Error(g),y,this.logger),!y)return}Qs(r,this.observer,o,v,this.audioCodec);var b;if(e.pts!==void 0)b=e.pts;else if(a){var S=_l(r.samplerate);b=a.sample.pts+S}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var L=0,C;v<m;)if(C=Cs(r,o,v,b,L),v+=C.length,C.missing){this.aacOverFlow=C;break}else for(L++;v<m-1&&!jn(o,v);v++);},l.parseMPEGPES=function(r,e){var t=e.data,a=t.length,o=0,d=0,c=e.pts;if(c===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;d<a;)if(Zs(t,d)){var f=fs(r,t,d,c,o);if(f)d+=f.length,o++;else break}else d++},l.parseAC3PES=function(r,e){{var t=e.data,a=e.pts;if(a===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}for(var o=t.length,d=0,c=0,f;c<o&&(f=Rl(r,t,c,a,d++))>0;)c+=f}},l.parseID3PES=function(r,e){if(e.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}var t=Qe({},e,{type:this._videoTrack?Ii.emsg:Ii.audioId3,duration:Number.POSITIVE_INFINITY});r.samples.push(t)},s}();function Zn(s,l){return((s[l+1]&31)<<8)+s[l+2]}function fu(s,l){return(s[l+10]&31)<<8|s[l+11]}function vu(s,l,n,r,e,t){var a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(s[l+1]&15)<<8|s[l+2],d=l+3+o-4,c=(s[l+10]&15)<<8|s[l+11];for(l+=12+c;l<d;){var f=Zn(s,l),v=(s[l+3]&15)<<8|s[l+4];switch(s[l]){case 207:if(!r){jo("ADTS AAC",t);break}case 15:a.audioPid===-1&&(a.audioPid=f);break;case 21:a.id3Pid===-1&&(a.id3Pid=f);break;case 219:if(!r){jo("H.264",t);break}case 27:a.videoPid===-1&&(a.videoPid=f);break;case 3:case 4:!n.mpeg&&!n.mp3?t.log("MPEG audio found, not supported in this browser"):a.audioPid===-1&&(a.audioPid=f,a.segmentAudioCodec="mp3");break;case 193:if(!r){jo("AC-3",t);break}case 129:n.ac3?a.audioPid===-1&&(a.audioPid=f,a.segmentAudioCodec="ac3"):t.log("AC-3 audio found, not supported in this browser");break;case 6:if(a.audioPid===-1&&v>0)for(var m=l+5,g=v;g>2;){var y=s[m];switch(y){case 106:n.ac3!==!0?t.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=f,a.segmentAudioCodec="ac3");break}var b=s[m+1]+2;m+=b,g-=b}break;case 194:case 135:return nd(e,new Error("Unsupported EC-3 in M2TS found"),void 0,t),a;case 36:a.videoPid===-1&&(a.videoPid=f,a.segmentVideoCodec="hevc",t.log("HEVC in M2TS found"));break}l+=v+5}return a}function nd(s,l,n,r){r.warn("parsing error: "+l.message),s.emit(_.ERROR,_.ERROR,{type:ut.MEDIA_ERROR,details:Q.FRAG_PARSING_ERROR,fatal:!1,levelRetry:n,error:l,reason:l.message})}function jo(s,l){l.log(s+" with AES-128-CBC encryption found in unencrypted stream")}function rn(s,l){var n=0,r,e,t,a,o,d=s.data;if(!s||s.size===0)return null;for(;d[0].length<19&&d.length>1;)d[0]=ie(d[0],d[1]),d.splice(1,1);r=d[0];var c=(r[0]<<16)+(r[1]<<8)+r[2];if(c===1){if(e=(r[4]<<8)+r[5],e&&e>s.size-6)return null;var f=r[7];f&192&&(a=(r[9]&14)*536870912+(r[10]&255)*4194304+(r[11]&254)*16384+(r[12]&255)*128+(r[13]&254)/2,f&64?(o=(r[14]&14)*536870912+(r[15]&255)*4194304+(r[16]&254)*16384+(r[17]&255)*128+(r[18]&254)/2,a-o>60*9e4&&(l.warn(Math.round((a-o)/9e4)+"s delta between PTS and DTS, align them"),a=o)):o=a),t=r[8];var v=t+9;if(s.size<=v)return null;s.size-=v;for(var m=new Uint8Array(s.size),g=0,y=d.length;g<y;g++){r=d[g];var b=r.byteLength;if(v)if(v>b){v-=b;continue}else r=r.subarray(v),b-=v,v=0;m.set(r,n),n+=b}return e&&(e-=t+3),{data:m,pts:a,dts:o,len:e}}return null}var sd=function(){function s(){}return s.getSilentFrame=function(n,r){switch(n){case"mp4a.40.2":if(r===1)return new Uint8Array([0,200,0,128,35,128]);if(r===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(r===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(r===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(r===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(r===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(r===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(r===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(r===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}},s}(),Bn=Math.pow(2,32)-1,Ui=function(){function s(){}return s.init=function(){s.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var n;for(n in s.types)s.types.hasOwnProperty(n)&&(s.types[n]=[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);s.HDLR_TYPES={video:r,audio:e};var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);s.STTS=s.STSC=s.STCO=a,s.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),s.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),s.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),s.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),d=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);s.FTYP=s.box(s.types.ftyp,o,c,o,d),s.DINF=s.box(s.types.dinf,s.box(s.types.dref,t))},s.box=function(n){for(var r=8,e=arguments.length,t=new Array(e>1?e-1:0),a=1;a<e;a++)t[a-1]=arguments[a];for(var o=t.length,d=o;o--;)r+=t[o].byteLength;var c=new Uint8Array(r);for(c[0]=r>>24&255,c[1]=r>>16&255,c[2]=r>>8&255,c[3]=r&255,c.set(n,4),o=0,r=8;o<d;o++)c.set(t[o],r),r+=t[o].byteLength;return c},s.hdlr=function(n){return s.box(s.types.hdlr,s.HDLR_TYPES[n])},s.mdat=function(n){return s.box(s.types.mdat,n)},s.mdhd=function(n,r){r*=n;var e=Math.floor(r/(Bn+1)),t=Math.floor(r%(Bn+1));return s.box(s.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,e>>24,e>>16&255,e>>8&255,e&255,t>>24,t>>16&255,t>>8&255,t&255,85,196,0,0]))},s.mdia=function(n){return s.box(s.types.mdia,s.mdhd(n.timescale||0,n.duration||0),s.hdlr(n.type),s.minf(n))},s.mfhd=function(n){return s.box(s.types.mfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255]))},s.minf=function(n){return n.type==="audio"?s.box(s.types.minf,s.box(s.types.smhd,s.SMHD),s.DINF,s.stbl(n)):s.box(s.types.minf,s.box(s.types.vmhd,s.VMHD),s.DINF,s.stbl(n))},s.moof=function(n,r,e){return s.box(s.types.moof,s.mfhd(n),s.traf(e,r))},s.moov=function(n){for(var r=n.length,e=[];r--;)e[r]=s.trak(n[r]);return s.box.apply(null,[s.types.moov,s.mvhd(n[0].timescale||0,n[0].duration||0)].concat(e).concat(s.mvex(n)))},s.mvex=function(n){for(var r=n.length,e=[];r--;)e[r]=s.trex(n[r]);return s.box.apply(null,[s.types.mvex].concat(e))},s.mvhd=function(n,r){r*=n;var e=Math.floor(r/(Bn+1)),t=Math.floor(r%(Bn+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,e>>24,e>>16&255,e>>8&255,e&255,t>>24,t>>16&255,t>>8&255,t&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return s.box(s.types.mvhd,a)},s.sdtp=function(n){var r=n.samples||[],e=new Uint8Array(4+r.length),t,a;for(t=0;t<r.length;t++)a=r[t].flags,e[t+4]=a.dependsOn<<4|a.isDependedOn<<2|a.hasRedundancy;return s.box(s.types.sdtp,e)},s.stbl=function(n){return s.box(s.types.stbl,s.stsd(n),s.box(s.types.stts,s.STTS),s.box(s.types.stsc,s.STSC),s.box(s.types.stsz,s.STSZ),s.box(s.types.stco,s.STCO))},s.avc1=function(n){var r=[],e=[],t,a,o;for(t=0;t<n.sps.length;t++)a=n.sps[t],o=a.byteLength,r.push(o>>>8&255),r.push(o&255),r=r.concat(Array.prototype.slice.call(a));for(t=0;t<n.pps.length;t++)a=n.pps[t],o=a.byteLength,e.push(o>>>8&255),e.push(o&255),e=e.concat(Array.prototype.slice.call(a));var d=s.box(s.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|n.sps.length].concat(r).concat([n.pps.length]).concat(e))),c=n.width,f=n.height,v=n.pixelRatio[0],m=n.pixelRatio[1];return s.box(s.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,c&255,f>>8&255,f&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d,s.box(s.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),s.box(s.types.pasp,new Uint8Array([v>>24,v>>16&255,v>>8&255,v&255,m>>24,m>>16&255,m>>8&255,m&255])))},s.esds=function(n){var r=n.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2].concat(r,[6,1,2]))},s.audioStsd=function(n){var r=n.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n.channelCount||0,0,16,0,0,0,0,r>>8&255,r&255,0,0])},s.mp4a=function(n){return s.box(s.types.mp4a,s.audioStsd(n),s.box(s.types.esds,s.esds(n)))},s.mp3=function(n){return s.box(s.types[".mp3"],s.audioStsd(n))},s.ac3=function(n){return s.box(s.types["ac-3"],s.audioStsd(n),s.box(s.types.dac3,n.config))},s.stsd=function(n){var r=n.segmentCodec;if(n.type==="audio"){if(r==="aac")return s.box(s.types.stsd,s.STSD,s.mp4a(n));if(r==="ac3"&&n.config)return s.box(s.types.stsd,s.STSD,s.ac3(n));if(r==="mp3"&&n.codec==="mp3")return s.box(s.types.stsd,s.STSD,s.mp3(n))}else if(n.pps&&n.sps){if(r==="avc")return s.box(s.types.stsd,s.STSD,s.avc1(n));if(r==="hevc"&&n.vps)return s.box(s.types.stsd,s.STSD,s.hvc1(n))}else throw new Error("video track missing pps or sps");throw new Error("unsupported "+n.type+" segment codec ("+r+"/"+n.codec+")")},s.tkhd=function(n){var r=n.id,e=(n.duration||0)*(n.timescale||0),t=n.width||0,a=n.height||0,o=Math.floor(e/(Bn+1)),d=Math.floor(e%(Bn+1));return s.box(s.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,r&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,d>>24,d>>16&255,d>>8&255,d&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,t>>8&255,t&255,0,0,a>>8&255,a&255,0,0]))},s.traf=function(n,r){var e=s.sdtp(n),t=n.id,a=Math.floor(r/(Bn+1)),o=Math.floor(r%(Bn+1));return s.box(s.types.traf,s.box(s.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255])),s.box(s.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255])),s.trun(n,e.length+16+20+8+16+8+8),e)},s.trak=function(n){return n.duration=n.duration||4294967295,s.box(s.types.trak,s.tkhd(n),s.mdia(n))},s.trex=function(n){var r=n.id;return s.box(s.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},s.trun=function(n,r){var e=n.samples||[],t=e.length,a=12+16*t,o=new Uint8Array(a),d,c,f,v,m,g;for(r+=8+a,o.set([n.type==="video"?1:0,0,15,1,t>>>24&255,t>>>16&255,t>>>8&255,t&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255],0),d=0;d<t;d++)c=e[d],f=c.duration,v=c.size,m=c.flags,g=c.cts,o.set([f>>>24&255,f>>>16&255,f>>>8&255,f&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,m.isLeading<<2|m.dependsOn,m.isDependedOn<<6|m.hasRedundancy<<4|m.paddingValue<<1|m.isNonSync,m.degradPrio&61440,m.degradPrio&15,g>>>24&255,g>>>16&255,g>>>8&255,g&255],12+16*d);return s.box(s.types.trun,o)},s.initSegment=function(n){s.types||s.init();var r=s.moov(n),e=ie(s.FTYP,r);return e},s.hvc1=function(n){for(var r=n.params,e=[n.vps,n.sps,n.pps],t=4,a=new Uint8Array([1,r.general_profile_space<<6|(r.general_tier_flag?32:0)|r.general_profile_idc,r.general_profile_compatibility_flags[0],r.general_profile_compatibility_flags[1],r.general_profile_compatibility_flags[2],r.general_profile_compatibility_flags[3],r.general_constraint_indicator_flags[0],r.general_constraint_indicator_flags[1],r.general_constraint_indicator_flags[2],r.general_constraint_indicator_flags[3],r.general_constraint_indicator_flags[4],r.general_constraint_indicator_flags[5],r.general_level_idc,240|r.min_spatial_segmentation_idc>>8,255&r.min_spatial_segmentation_idc,252|r.parallelismType,252|r.chroma_format_idc,248|r.bit_depth_luma_minus8,248|r.bit_depth_chroma_minus8,0,parseInt(r.frame_rate.fps),t-1|r.temporal_id_nested<<2|r.num_temporal_layers<<3|(r.frame_rate.fixed?64:0),e.length]),o=a.length,d=0;d<e.length;d+=1){o+=3;for(var c=0;c<e[d].length;c+=1)o+=2+e[d][c].length}var f=new Uint8Array(o);f.set(a,0),o=a.length;for(var v=e.length-1,m=0;m<e.length;m+=1){f.set(new Uint8Array([32+m|(m===v?128:0),0,e[m].length]),o),o+=3;for(var g=0;g<e[m].length;g+=1)f.set(new Uint8Array([e[m][g].length>>8,e[m][g].length&255]),o),o+=2,f.set(e[m][g],o),o+=e[m][g].length}var y=s.box(s.types.hvcC,f),b=n.width,S=n.height,L=n.pixelRatio[0],C=n.pixelRatio[1];return s.box(s.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b>>8&255,b&255,S>>8&255,S&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),y,s.box(s.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),s.box(s.types.pasp,new Uint8Array([L>>24,L>>16&255,L>>8&255,L&255,C>>24,C>>16&255,C>>8&255,C&255])))},s}();Ui.types=void 0,Ui.HDLR_TYPES=void 0,Ui.STTS=void 0,Ui.STSC=void 0,Ui.STCO=void 0,Ui.STSZ=void 0,Ui.VMHD=void 0,Ui.SMHD=void 0,Ui.STSD=void 0,Ui.FTYP=void 0,Ui.DINF=void 0;var En=9e4;function mu(s,l,n,r){n===void 0&&(n=1),r===void 0&&(r=!1);var e=s*l*n;return r?Math.round(e):e}function an(s,l,n,r){return n===void 0&&(n=1),r===void 0&&(r=!1),mu(s,l,1/n,r)}function va(s,l){return mu(s,1e3,1/En,l)}function Pl(s,l){return l===void 0&&(l=1),mu(s,En,1/l)}function Ol(s){var l=s.baseTime,n=s.timescale,r=s.trackId;return l/n+" ("+l+"/"+n+") trackId: "+r}var yn=10*1e3,Lo=1024,pu=1152,Fd=1536,Ms=null,Ps=null;function xl(s,l,n,r){return{duration:l,size:n,cts:r,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:s?2:1,isNonSync:s?0:1}}}var ko=function(s){function l(r,e,t,a){var o;if(o=s.call(this,"mp4-remuxer",a)||this,o.observer=void 0,o.config=void 0,o.typeSupported=void 0,o.ISGenerated=!1,o._initPTS=null,o._initDTS=null,o.nextVideoTs=null,o.nextAudioTs=null,o.videoSampleDuration=null,o.isAudioContiguous=!1,o.isVideoContiguous=!1,o.videoTrackConfig=void 0,o.observer=r,o.config=e,o.typeSupported=t,o.ISGenerated=!1,Ms===null){var d=navigator.userAgent||"",c=d.match(/Chrome\/(\d+)/i);Ms=c?parseInt(c[1]):0}if(Ps===null){var f=navigator.userAgent.match(/Safari\/(\d+)/i);Ps=f?parseInt(f[1]):0}return o}Pe(l,s);var n=l.prototype;return n.destroy=function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null},n.resetTimeStamp=function(e){var t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log("Reset initPTS: "+(t&&Ol(t))+" > "+(e&&Ol(e))),this._initPTS=this._initDTS=e},n.resetNextTimestamp=function(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},n.resetInitSegment=function(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0},n.getVideoStartPts=function(e){var t=!1,a=e[0].pts,o=e.reduce(function(d,c){var f=c.pts,v=f-d;return v<-4294967296&&(t=!0,f=bn(f,a),v=f-d),v>0?d:f},a);return t&&this.debug("PTS rollover detected"),o},n.remux=function(e,t,a,o,d,c,f,v){var m,g,y,b,S,L,C=d,F=d,N=e.pid>-1,B=t.pid>-1,re=t.samples.length,ce=e.samples.length>0,Se=f&&re>0||re>1,Ke=(!N||ce)&&(!B||Se)||this.ISGenerated||f;if(Ke){if(this.ISGenerated){var be,Z,ne,Re,Tt=this.videoTrackConfig;(Tt&&(t.width!==Tt.width||t.height!==Tt.height||((be=t.pixelRatio)==null?void 0:be[0])!==((Z=Tt.pixelRatio)==null?void 0:Z[0])||((ne=t.pixelRatio)==null?void 0:ne[1])!==((Re=Tt.pixelRatio)==null?void 0:Re[1]))||!Tt&&Se||this.nextAudioTs===null&&ce)&&this.resetInitSegment()}this.ISGenerated||(y=this.generateIS(e,t,d,c));var ot=this.isVideoContiguous,pt=-1,Bt;if(Se&&(pt=gu(t.samples),!ot&&this.config.forceKeyFrameOnDiscontinuity))if(L=!0,pt>0){this.warn("Dropped "+pt+" out of "+re+" video samples due to a missing keyframe");var cr=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(pt),t.dropped+=pt,F+=(t.samples[0].pts-cr)/t.inputTimeScale,Bt=F}else pt===-1&&(this.warn("No keyframe found out of "+re+" video samples"),L=!1);if(this.ISGenerated){if(ce&&Se){var or=this.getVideoStartPts(t.samples),hr=bn(e.samples[0].pts,or)-or,xr=hr/t.inputTimeScale;C+=Math.max(0,xr),F+=Math.max(0,-xr)}if(ce){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),y=this.generateIS(e,t,d,c)),g=this.remuxAudio(e,C,this.isAudioContiguous,c,B||Se||v===Ie.AUDIO?F:void 0),Se){var fr=g?g.endPTS-g.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),y=this.generateIS(e,t,d,c)),m=this.remuxVideo(t,F,ot,fr)}}else Se&&(m=this.remuxVideo(t,F,ot,0));m&&(m.firstKeyFrame=pt,m.independent=pt!==-1,m.firstKeyFramePTS=Bt)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(a.samples.length&&(S=zo(a,d,this._initPTS,this._initDTS)),o.samples.length&&(b=Qo(o,d,this._initPTS))),{audio:g,video:m,initSegment:y,independent:L,text:b,id3:S}},n.computeInitPts=function(e,t,a,o){var d=Math.round(a*t),c=bn(e,d);if(c<d+t)for(this.log("Adjusting PTS for rollover in timeline near "+(d-c)/t+" "+o);c<d+t;)c+=8589934592;return c-d},n.generateIS=function(e,t,a,o){var d=e.samples,c=t.samples,f=this.typeSupported,v={},m=this._initPTS,g=!m||o,y="audio/mp4",b,S,L,C=-1;if(g&&(b=S=1/0),e.config&&d.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":f.mpeg?(y="audio/mpeg",e.codec=""):f.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}v.audio={id:"audio",container:y,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&f.mpeg?new Uint8Array(0):Ui.initSegment([e]),metadata:{channelCount:e.channelCount}},g&&(C=e.id,L=e.inputTimeScale,!m||L!==m.timescale?b=S=this.computeInitPts(d[0].pts,L,a,"audio"):g=!1)}if(t.sps&&t.pps&&c.length){if(t.timescale=t.inputTimeScale,v.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Ui.initSegment([t]),metadata:{width:t.width,height:t.height}},g)if(C=t.id,L=t.inputTimeScale,!m||L!==m.timescale){var F=this.getVideoStartPts(c),N=bn(c[0].dts,F),B=this.computeInitPts(N,L,a,"video"),re=this.computeInitPts(F,L,a,"video");S=Math.min(S,B),b=Math.min(b,re)}else g=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(v).length)return this.ISGenerated=!0,g?(m&&this.warn("Timestamps at playlist time: "+(o?"":"~")+a+" "+b/L+" != initPTS: "+m.baseTime/m.timescale+" ("+m.baseTime+"/"+m.timescale+") trackId: "+m.trackId),this.log("Found initPTS at playlist time: "+a+" offset: "+b/L+" ("+b+"/"+L+") trackId: "+C),this._initPTS={baseTime:b,timescale:L,trackId:C},this._initDTS={baseTime:S,timescale:L,trackId:C}):b=L=void 0,{tracks:v,initPTS:b,timescale:L,trackId:C}},n.remuxVideo=function(e,t,a,o){var d=e.inputTimeScale,c=e.samples,f=[],v=c.length,m=this._initPTS,g=m.baseTime*d/m.timescale,y=this.nextVideoTs,b=8,S=this.videoSampleDuration,L,C,F=Number.POSITIVE_INFINITY,N=Number.NEGATIVE_INFINITY,B=!1;if(!a||y===null){var re=g+t*d,ce=c[0].pts-bn(c[0].dts,c[0].pts);Ms&&y!==null&&Math.abs(re-ce-(y+g))<15e3?a=!0:y=re-ce-g}for(var Se=y+g,Ke=0;Ke<v;Ke++){var be=c[Ke];be.pts=bn(be.pts,Se),be.dts=bn(be.dts,Se),be.dts<c[Ke>0?Ke-1:Ke].dts&&(B=!0)}B&&c.sort(function(so,oo){var Gu=so.dts-oo.dts,hc=so.pts-oo.pts;return Gu||hc}),L=c[0].dts,C=c[c.length-1].dts;var Z=C-L,ne=Z?Math.round(Z/(v-1)):S||e.inputTimeScale/30;if(a){var Re=L-Se,Tt=Re>ne,ot=Re<-1;if((Tt||ot)&&(Tt?this.warn((e.segmentCodec||"").toUpperCase()+": "+va(Re,!0)+" ms ("+Re+"dts) hole between fragments detected at "+t.toFixed(3)):this.warn((e.segmentCodec||"").toUpperCase()+": "+va(-Re,!0)+" ms ("+Re+"dts) overlapping between fragments detected at "+t.toFixed(3)),!ot||Se>=c[0].pts||Ms)){L=Se;var pt=c[0].pts-Re;if(Tt)c[0].dts=L,c[0].pts=pt;else for(var Bt=!0,cr=0;cr<c.length&&!(c[cr].dts>pt&&Bt);cr++){var or=c[cr].pts;if(c[cr].dts-=Re,c[cr].pts-=Re,cr<c.length-1){var hr=c[cr+1].pts,xr=c[cr].pts,fr=hr<=xr,lr=hr<=or;Bt=fr==lr}}this.log("Video: Initial PTS/DTS adjusted: "+va(pt,!0)+"/"+va(L,!0)+", delta: "+va(Re,!0)+" ms")}}L=Math.max(0,L);for(var _r=0,Dr=0,bi=L,jr=0;jr<v;jr++){for(var ji=c[jr],ia=ji.units,Fi=ia.length,sn=0,Gi=0;Gi<Fi;Gi++)sn+=ia[Gi].data.length;Dr+=sn,_r+=Fi,ji.length=sn,ji.dts<bi?(ji.dts=bi,bi+=ne/4|0||1):bi=ji.dts,F=Math.min(ji.pts,F),N=Math.max(ji.pts,N)}C=c[v-1].dts;var si=Dr+4*_r+8,ir;try{ir=new Uint8Array(si)}catch(so){this.observer.emit(_.ERROR,_.ERROR,{type:ut.MUX_ERROR,details:Q.REMUX_ALLOC_ERROR,fatal:!1,error:so,bytes:si,reason:"fail allocating video mdat "+si});return}var qa=new DataView(ir.buffer);qa.setUint32(0,si),ir.set(Ui.types.mdat,4);for(var Da=!1,Tn=Number.POSITIVE_INFINITY,ca=Number.POSITIVE_INFINITY,Pn=Number.NEGATIVE_INFINITY,_n=Number.NEGATIVE_INFINITY,Ma=0;Ma<v;Ma++){for(var ja=c[Ma],on=ja.units,Ql=0,ns=0,ll=on.length;ns<ll;ns++){var Ld=on[ns],Xl=Ld.data,Zl=Ld.data.byteLength;qa.setUint32(b,Zl),b+=4,ir.set(Xl,b),b+=Zl,Ql+=4+Zl}var ao=void 0;if(Ma<v-1)S=c[Ma+1].dts-ja.dts,ao=c[Ma+1].pts-ja.pts;else{var ci=this.config,Ti=Ma>0?ja.dts-c[Ma-1].dts:ne;if(ao=Ma>0?ja.pts-c[Ma-1].pts:ne,ci.stretchShortVideoTrack&&this.nextAudioTs!==null){var ss=Math.floor(ci.maxBufferHole*d),wi=(o?F+o*d:this.nextAudioTs+g)-ja.pts;wi>ss?(S=wi-Ti,S<0?S=Ti:Da=!0,this.log("It is approximately "+wi/90+" ms to the next segment; using duration "+S/90+" ms for the last video frame.")):S=Ti}else S=Ti}var Es=Math.round(ja.pts-ja.dts);Tn=Math.min(Tn,S),Pn=Math.max(Pn,S),ca=Math.min(ca,ao),_n=Math.max(_n,ao),f.push(xl(ja.key,S,Ql,Es))}if(f.length){if(Ms){if(Ms<70){var Gn=f[0].flags;Gn.dependsOn=2,Gn.isNonSync=0}}else if(Ps&&_n-ca<Pn-Tn&&ne/Pn<.025&&f[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var ys=L,An=0,Jl=f.length;An<Jl;An++){var no=ys+f[An].duration,eu=ys+f[An].cts;if(An<Jl-1){var kd=no+f[An+1].cts;f[An].duration=kd-eu}else f[An].duration=An?f[An-1].duration:ne;f[An].cts=0,ys=no}}}S=Da||!S?ne:S;var cc=C+S;this.nextVideoTs=y=cc-g,this.videoSampleDuration=S,this.isVideoContiguous=!0;var Vu=Ui.moof(e.sequenceNumber++,L,Qe(e,{samples:f})),Id="video",tu={data1:Vu,data2:ir,startPTS:(F-g)/d,endPTS:(N+S-g)/d,startDTS:(L-g)/d,endDTS:y/d,type:Id,hasAudio:!1,hasVideo:!0,nb:f.length,dropped:e.dropped};return e.samples=[],e.dropped=0,tu},n.getSamplesPerFrame=function(e){switch(e.segmentCodec){case"mp3":return pu;case"ac3":return Fd;default:return Lo}},n.remuxAudio=function(e,t,a,o,d){var c=e.inputTimeScale,f=e.samplerate?e.samplerate:c,v=c/f,m=this.getSamplesPerFrame(e),g=m*v,y=this._initPTS,b=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,S=[],L=d!==void 0,C=e.samples,F=b?0:8,N=this.nextAudioTs||-1,B=y.baseTime*c/y.timescale,re=B+t*c;if(this.isAudioContiguous=a=a||C.length&&N>0&&(o&&Math.abs(re-(N+B))<9e3||Math.abs(bn(C[0].pts,re)-(N+B))<20*g),C.forEach(function(ca){ca.pts=bn(ca.pts,re)}),!a||N<0){var ce=C.length;if(C=C.filter(function(ca){return ca.pts>=0}),ce!==C.length&&this.warn("Removed "+(C.length-ce)+" of "+ce+" samples (initPTS "+B+" / "+c+")"),!C.length)return;d===0?N=0:o&&!L?N=Math.max(0,re-B):N=C[0].pts-B}if(e.segmentCodec==="aac")for(var Se=this.config.maxAudioFramesDrift,Ke=0,be=N+B;Ke<C.length;Ke++){var Z=C[Ke],ne=Z.pts,Re=ne-be,Tt=Math.abs(1e3*Re/c);if(Re<=-Se*g&&L)Ke===0&&(this.warn("Audio frame @ "+(ne/c).toFixed(3)+"s overlaps marker by "+Math.round(1e3*Re/c)+" ms."),this.nextAudioTs=N=ne-B,be=ne);else if(Re>=Se*g&&Tt<yn&&L){var ot=Math.round(Re/g);for(be=ne-ot*g;be<0&&ot&&g;)ot--,be+=g;Ke===0&&(this.nextAudioTs=N=be-B),this.warn("Injecting "+ot+" audio frames @ "+((be-B)/c).toFixed(3)+"s due to "+Math.round(1e3*Re/c)+" ms gap.");for(var pt=0;pt<ot;pt++){var Bt=sd.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Bt||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),Bt=Z.unit.subarray()),C.splice(Ke,0,{unit:Bt,pts:be}),be+=g,Ke++}}Z.pts=be,be+=g}for(var cr=null,or=null,hr,xr=0,fr=C.length;fr--;)xr+=C[fr].unit.byteLength;for(var lr=0,_r=C.length;lr<_r;lr++){var Dr=C[lr],bi=Dr.unit,jr=Dr.pts;if(or!==null){var ji=S[lr-1];ji.duration=Math.round((jr-or)/v)}else if(a&&e.segmentCodec==="aac"&&(jr=N+B),cr=jr,xr>0){xr+=F;try{hr=new Uint8Array(xr)}catch(ca){this.observer.emit(_.ERROR,_.ERROR,{type:ut.MUX_ERROR,details:Q.REMUX_ALLOC_ERROR,fatal:!1,error:ca,bytes:xr,reason:"fail allocating audio mdat "+xr});return}if(!b){var ia=new DataView(hr.buffer);ia.setUint32(0,xr),hr.set(Ui.types.mdat,4)}}else return;hr.set(bi,F);var Fi=bi.byteLength;F+=Fi,S.push(xl(!0,m,Fi,0)),or=jr}var sn=S.length;if(sn){var Gi=S[S.length-1];N=or-B,this.nextAudioTs=N+v*Gi.duration;var si=b?new Uint8Array(0):Ui.moof(e.sequenceNumber++,cr/v,Qe({},e,{samples:S}));e.samples=[];var ir=(cr-B)/c,qa=this.nextAudioTs/c,Da="audio",Tn={data1:si,data2:hr,startPTS:ir,endPTS:qa,startDTS:ir,endDTS:qa,type:Da,hasAudio:!0,hasVideo:!1,nb:sn};return this.isAudioContiguous=!0,Tn}},l}(Te);function bn(s,l){var n;if(l===null)return s;for(l<s?n=-8589934592:n=8589934592;Math.abs(s-l)>4294967296;)s+=n;return s}function gu(s){for(var l=0;l<s.length;l++)if(s[l].key)return l;return-1}function zo(s,l,n,r){var e=s.samples.length;if(e){for(var t=s.inputTimeScale,a=0;a<e;a++){var o=s.samples[a];o.pts=bn(o.pts-n.baseTime*t/n.timescale,l*t)/t,o.dts=bn(o.dts-r.baseTime*t/r.timescale,l*t)/t}var d=s.samples;return s.samples=[],{samples:d}}}function Qo(s,l,n){var r=s.samples.length;if(r){for(var e=s.inputTimeScale,t=0;t<r;t++){var a=s.samples[t];a.pts=bn(a.pts-n.baseTime*e/n.timescale,l*e)/e}s.samples.sort(function(d,c){return d.pts-c.pts});var o=s.samples;return s.samples=[],{samples:o}}}var Mc=function(s){function l(r,e,t,a){var o;return o=s.call(this,"passthrough-remuxer",a)||this,o.emitInitSegment=!1,o.audioCodec=void 0,o.videoCodec=void 0,o.initData=void 0,o.initPTS=null,o.initTracks=void 0,o.lastEndTime=null,o.isVideoContiguous=!1,o}Pe(l,s);var n=l.prototype;return n.destroy=function(){},n.resetTimeStamp=function(e){this.lastEndTime=null;var t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)},n.resetNextTimestamp=function(){this.isVideoContiguous=!1,this.lastEndTime=null},n.resetInitSegment=function(e,t,a,o){this.audioCodec=t,this.videoCodec=a,this.generateInitSegment(e,o),this.emitInitSegment=!0},n.generateInitSegment=function(e,t){var a=this.audioCodec,o=this.videoCodec;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=_i(e),c=d.audio,f=d.video;if(t)yr(e,t);else{var v=c||f;v!=null&&v.encrypted&&this.warn('Init segment with encrypted track with has no key ("'+v.codec+'")!')}c&&(a=Io(c,Wt.AUDIO,this)),f&&(o=Io(f,Wt.VIDEO,this));var m={};c&&f?m.audiovideo={container:"video/mp4",codec:a+","+o,supplemental:f.supplemental,encrypted:f.encrypted,initSegment:e,id:"main"}:c?m.audio={container:"audio/mp4",codec:a,encrypted:c.encrypted,initSegment:e,id:"audio"}:f?m.video={container:"video/mp4",codec:o,supplemental:f.supplemental,encrypted:f.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=m},n.remux=function(e,t,a,o,d,c){var f,v,m=this.initPTS,g=this.lastEndTime,y={audio:void 0,video:void 0,text:o,id3:a,initSegment:void 0};Ge(g)||(g=this.lastEndTime=d||0);var b=t.samples;if(!b.length)return y;var S={initPTS:void 0,timescale:void 0,trackId:void 0},L=this.initData;if((f=L)!=null&&f.length||(this.generateInitSegment(b),L=this.initData),!((v=L)!=null&&v.length))return this.warn("Failed to generate initSegment."),y;this.emitInitSegment&&(S.tracks=this.initTracks,this.emitInitSegment=!1);var C=Ci(b,L,this),F=L.audio?C[L.audio.id]:null,N=L.video?C[L.video.id]:null,B=Nl(N,1/0),re=Nl(F,1/0),ce=Nl(N,0,!0),Se=Nl(F,0,!0),Ke=d,be=0,Z=F&&(!N||!m&&re<B||m&&m.trackId===L.audio.id),ne=Z?F:N;if(ne){var Re=ne.timescale,Tt=ne.start-d*Re,ot=Z?L.audio.id:L.video.id;Ke=ne.start/Re,be=Z?Se-re:ce-B,(c||!m)&&(Pc(m,Ke,d,be)||Re!==m.timescale)&&(m&&this.warn("Timestamps at playlist time: "+(c?"":"~")+d+" "+Tt/Re+" != initPTS: "+m.baseTime/m.timescale+" ("+m.baseTime+"/"+m.timescale+") trackId: "+m.trackId),this.log("Found initPTS at playlist time: "+d+" offset: "+(Ke-d)+" ("+Tt+"/"+Re+") trackId: "+ot),m=null,S.initPTS=Tt,S.timescale=Re,S.trackId=ot)}else this.warn("No audio or video samples found for initPTS at playlist time: "+d);m?(S.initPTS=m.baseTime,S.timescale=m.timescale,S.trackId=m.trackId):((!S.timescale||S.trackId===void 0||S.initPTS===void 0)&&(this.warn("Could not set initPTS"),S.initPTS=Ke,S.timescale=1,S.trackId=-1),this.initPTS=m={baseTime:S.initPTS,timescale:S.timescale,trackId:S.trackId});var pt=Ke-m.baseTime/m.timescale,Bt=pt+be;be>0?this.lastEndTime=Bt:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var cr=!!L.audio,or=!!L.video,hr="";cr&&(hr+="audio"),or&&(hr+="video");var xr=(L.audio?L.audio.encrypted:!1)||(L.video?L.video.encrypted:!1),fr={data1:b,startPTS:pt,startDTS:pt,endPTS:Bt,endDTS:Bt,type:hr,hasAudio:cr,hasVideo:or,nb:1,dropped:0,encrypted:xr};y.audio=cr&&!or?fr:void 0,y.video=or?fr:void 0;var lr=N==null?void 0:N.sampleCount;if(lr){var _r=N.keyFrameIndex,Dr=_r!==-1;fr.nb=lr,fr.dropped=_r===0||this.isVideoContiguous?0:Dr?_r:lr,fr.independent=Dr,fr.firstKeyFrame=_r,Dr&&N.keyFrameStart&&(fr.firstKeyFramePTS=(N.keyFrameStart-m.baseTime)/m.timescale),this.isVideoContiguous||(y.independent=Dr),this.isVideoContiguous||(this.isVideoContiguous=Dr),fr.dropped&&this.warn("fmp4 does not start with IDR: firstIDR "+_r+"/"+lr+" dropped: "+fr.dropped+" start: "+(fr.firstKeyFramePTS||"NA"))}return y.initSegment=S,y.id3=zo(a,d,m,m),o.samples.length&&(y.text=Qo(o,d,m)),y},l}(Te);function Nl(s,l,n){return n===void 0&&(n=!1),(s==null?void 0:s.start)!==void 0?(s.start+(n?s.duration:0))/s.timescale:l}function Pc(s,l,n,r){if(s===null)return!0;var e=Math.max(r,1),t=l-s.baseTime/s.timescale;return Math.abs(t-n)>e}function Io(s,l,n){var r=s.codec;if(r&&r.length>4)return r;if(l===Wt.AUDIO){if(r==="ec-3"||r==="ac-3"||r==="alac")return r;if(r==="fLaC"||r==="Opus"){var e=!1;return ui(r,e)}return n.warn('Unhandled audio codec "'+r+'" in mp4 MAP'),r||"mp4a"}return n.warn('Unhandled video codec "'+r+'" in mp4 MAP'),r||"avc1"}var Jn;try{Jn=self.performance.now.bind(self.performance)}catch(s){Jn=Date.now}var Ul=[{demux:hu,remux:Mc},{demux:Ml,remux:ko},{demux:kl,remux:ko},{demux:ad,remux:ko}];Ul.splice(2,0,{demux:qo,remux:ko});var Fl=function(){function s(n,r,e,t,a,o){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=n,this.typeSupported=r,this.config=e,this.id=a,this.logger=o}var l=s.prototype;return l.configure=function(r){this.transmuxConfig=r,this.decrypter&&this.decrypter.reset()},l.push=function(r,e,t,a){var o=this,d=t.transmuxing;d.executeStart=Jn();var c=new Uint8Array(r),f=this.currentTransmuxState,v=this.transmuxConfig;a&&(this.currentTransmuxState=a);var m=a||f,g=m.contiguous,y=m.discontinuity,b=m.trackSwitch,S=m.accurateTimeOffset,L=m.timeOffset,C=m.initSegmentChange,F=v.audioCodec,N=v.videoCodec,B=v.defaultInitPts,re=v.duration,ce=v.initSegmentData,Se=Eu(c,e);if(Se&&Ji(Se.method)){var Ke=this.getDecrypter(),be=Ka(Se.method);if(Ke.isSync()){var Z=Ke.softwareDecrypt(c,Se.key.buffer,Se.iv.buffer,be),ne=t.part>-1;if(ne){var Re=Ke.flush();Z=Re&&Re.buffer}if(!Z)return d.executeEnd=Jn(),Xo(t);c=new Uint8Array(Z)}else return this.asyncResult=!0,this.decryptionPromise=Ke.webCryptoDecrypt(c,Se.key.buffer,Se.iv.buffer,be).then(function(cr){var or=o.push(cr,null,t);return o.decryptionPromise=null,or}),this.decryptionPromise}var Tt=this.needsProbing(y,b);if(Tt){var ot=this.configureTransmuxer(c);if(ot)return this.logger.warn("[transmuxer] "+ot.message),this.observer.emit(_.ERROR,_.ERROR,{type:ut.MEDIA_ERROR,details:Q.FRAG_PARSING_ERROR,fatal:!1,error:ot,reason:ot.message}),d.executeEnd=Jn(),Xo(t)}(y||b||C||Tt)&&this.resetInitSegment(ce,F,N,re,e),(y||C||Tt)&&this.resetInitialTimestamp(B),g||this.resetContiguity();var pt=this.transmux(c,Se,L,S,t);this.asyncResult=p(pt);var Bt=this.currentTransmuxState;return Bt.contiguous=!0,Bt.discontinuity=!1,Bt.trackSwitch=!1,d.executeEnd=Jn(),pt},l.flush=function(r){var e=this,t=r.transmuxing;t.executeStart=Jn();var a=this.decrypter,o=this.currentTransmuxState,d=this.decryptionPromise;if(d)return this.asyncResult=!0,d.then(function(){return e.flush(r)});var c=[],f=o.timeOffset;if(a){var v=a.flush();v&&c.push(this.push(v.buffer,null,r))}var m=this.demuxer,g=this.remuxer;if(!m||!g){t.executeEnd=Jn();var y=[Xo(r)];return this.asyncResult?Promise.resolve(y):y}var b=m.flush(f);return p(b)?(this.asyncResult=!0,b.then(function(S){return e.flushRemux(c,S,r),c})):(this.flushRemux(c,b,r),this.asyncResult?Promise.resolve(c):c)},l.flushRemux=function(r,e,t){var a=e.audioTrack,o=e.videoTrack,d=e.id3Track,c=e.textTrack,f=this.currentTransmuxState,v=f.accurateTimeOffset,m=f.timeOffset;this.logger.log("[transmuxer.ts]: Flushed "+this.id+" sn: "+t.sn+(t.part>-1?" part: "+t.part:"")+" of "+(this.id===Ie.MAIN?"level":"track")+" "+t.level);var g=this.remuxer.remux(a,o,d,c,m,v,!0,this.id);r.push({remuxResult:g,chunkMeta:t}),t.transmuxing.executeEnd=Jn()},l.resetInitialTimestamp=function(r){var e=this.demuxer,t=this.remuxer;!e||!t||(e.resetTimeStamp(r),t.resetTimeStamp(r))},l.resetContiguity=function(){var r=this.demuxer,e=this.remuxer;!r||!e||(r.resetContiguity(),e.resetNextTimestamp())},l.resetInitSegment=function(r,e,t,a,o){var d=this.demuxer,c=this.remuxer;!d||!c||(d.resetInitSegment(r,e,t,a),c.resetInitSegment(r,e,t,o))},l.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},l.transmux=function(r,e,t,a,o){var d;return e&&e.method==="SAMPLE-AES"?d=this.transmuxSampleAes(r,e,t,a,o):d=this.transmuxUnencrypted(r,t,a,o),d},l.transmuxUnencrypted=function(r,e,t,a){var o=this.demuxer.demux(r,e,!1,!this.config.progressive),d=o.audioTrack,c=o.videoTrack,f=o.id3Track,v=o.textTrack,m=this.remuxer.remux(d,c,f,v,e,t,!1,this.id);return{remuxResult:m,chunkMeta:a}},l.transmuxSampleAes=function(r,e,t,a,o){var d=this;return this.demuxer.demuxSampleAes(r,e,t).then(function(c){var f=d.remuxer.remux(c.audioTrack,c.videoTrack,c.id3Track,c.textTrack,t,a,!1,d.id);return{remuxResult:f,chunkMeta:o}})},l.configureTransmuxer=function(r){for(var e=this.config,t=this.observer,a=this.typeSupported,o,d=0,c=Ul.length;d<c;d++){var f;if((f=Ul[d].demux)!=null&&f.probe(r,this.logger)){o=Ul[d];break}}if(!o)return new Error("Failed to find demuxer by probing fragment data");var v=this.demuxer,m=this.remuxer,g=o.remux,y=o.demux;(!m||!(m instanceof g))&&(this.remuxer=new g(t,e,a,this.logger)),(!v||!(v instanceof y))&&(this.demuxer=new y(t,e,a,this.logger),this.probe=y.probe)},l.needsProbing=function(r,e){return!this.demuxer||!this.remuxer||r||e},l.getDecrypter=function(){var r=this.decrypter;return r||(r=this.decrypter=new Xr(this.config)),r},s}();function Eu(s,l){var n=null;return s.byteLength>0&&(l==null?void 0:l.key)!=null&&l.iv!==null&&l.method!=null&&(n=l),n}var Xo=function(l){return{remuxResult:{},chunkMeta:l}};function p(s){return"then"in s&&s.then instanceof Function}var T=function(l,n,r,e,t){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=l,this.videoCodec=n,this.initSegmentData=r,this.duration=e,this.defaultInitPts=t||null},w=function(l,n,r,e,t,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=l,this.contiguous=n,this.accurateTimeOffset=r,this.trackSwitch=e,this.timeOffset=t,this.initSegmentChange=a},J=[];typeof Ee!="undefined"&&Ee&&Ae();function Ae(){self.addEventListener("message",function(s){var l=s.data,n=l.instanceNo;if(n!==void 0){var r=J[n];if(l.cmd==="reset"&&(delete J[l.resetNo],r&&r.destroy(),l.cmd="init"),l.cmd==="init"){var e=JSON.parse(l.config),t=new ae;t.on(_.FRAG_DECRYPTED,ni),t.on(_.ERROR,ni);var a=Rt(e.debug,l.id);Kr(a,n),J[n]=new Fl(t,l.typeSupported,e,"",l.id,a),ni("init",null,n);return}if(r)switch(l.cmd){case"configure":{r.configure(l.config);break}case"demux":{var o=r.push(l.data,l.decryptdata,l.chunkMeta,l.state);p(o)?o.then(function(f){vt(self,f,n)}).catch(function(f){ni(_.ERROR,{instanceNo:n,type:ut.MEDIA_ERROR,details:Q.FRAG_PARSING_ERROR,chunkMeta:l.chunkMeta,fatal:!1,error:f,err:f,reason:"transmuxer-worker push error"},n)}):vt(self,o,n);break}case"flush":{var d=l.chunkMeta,c=r.flush(d);p(c)?c.then(function(f){Xt(self,f,d,n)}).catch(function(f){ni(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.FRAG_PARSING_ERROR,chunkMeta:l.chunkMeta,fatal:!1,error:f,err:f,reason:"transmuxer-worker flush error"},n)}):Xt(self,c,d,n);break}}}})}function vt(s,l,n){if(nn(l.remuxResult))return!1;var r=[],e=l.remuxResult,t=e.audio,a=e.video;return t&&Dt(r,t),a&&Dt(r,a),s.postMessage({event:"transmuxComplete",data:l,instanceNo:n},r),!0}function Dt(s,l){l.data1&&s.push(l.data1.buffer),l.data2&&s.push(l.data2.buffer)}function Xt(s,l,n,r){var e=l.reduce(function(t,a){return vt(s,a,r)||t},!1);e||s.postMessage({event:"transmuxComplete",data:l[0],instanceNo:r}),s.postMessage({event:"flush",data:n,instanceNo:r})}function ni(s,l,n){self.postMessage({event:s,data:l,instanceNo:n})}function Kr(s,l){var n=function(t){s[t]=function(){var a=Array.prototype.join.call(arguments," ");ni("workerLog",{logType:t,message:a},l)}};for(var r in s)n(r)}function nn(s){return!s.audio&&!s.video&&!s.text&&!s.id3&&!s.initSegment}var Ta="1.6.15",Ra={};function Mn(){return typeof Me=="function"}function Bl(){var s=Ra[Ta];if(s)return s.clientCount++,s;var l=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;("+Me.toString()+")(true);"],{type:"text/javascript"}),n=self.URL.createObjectURL(l),r=new self.Worker(n),e={worker:r,objectURL:n,clientCount:1};return Ra[Ta]=e,e}function yu(s){var l=Ra[s];if(l)return l.clientCount++,l;var n=new self.URL(s,self.location.href).href,r=new self.Worker(n),e={worker:r,scriptURL:n,clientCount:1};return Ra[s]=e,e}function Oc(s){var l=Ra[s||Ta];if(l){var n=l.clientCount--;if(n===1){var r=l.worker,e=l.objectURL;delete Ra[s||Ta],e&&self.URL.revokeObjectURL(e),r.terminate()}}}var Zh=0,xc=function(){function s(n,r,e,t){var a=this;this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Zh++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=function(g){var y=g.data,b=a.hls;if(!(!b||!(y!=null&&y.event)||y.instanceNo!==a.instanceNo))switch(y.event){case"init":{var S,L=(S=a.workerContext)==null?void 0:S.objectURL;L&&self.URL.revokeObjectURL(L);break}case"transmuxComplete":{a.handleTransmuxComplete(y.data);break}case"flush":{a.onFlush(y.data);break}case"workerLog":{b.logger[y.data.logType]&&b.logger[y.data.logType](y.data.message);break}default:{y.data=y.data||{},y.data.frag=a.frag,y.data.part=a.part,y.data.id=a.id,b.trigger(y.event,y.data);break}}},this.onWorkerError=function(g){if(a.hls){var y=new Error(g.message+"  ("+g.filename+":"+g.lineno+")");a.hls.config.enableWorker=!1,a.hls.logger.warn('Error in "'+a.id+'" Web Worker, fallback to inline'),a.hls.trigger(_.ERROR,{type:ut.OTHER_ERROR,details:Q.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:y})}};var o=n.config;this.hls=n,this.id=r,this.useWorker=!!o.enableWorker,this.onTransmuxComplete=e,this.onFlush=t;var d=function(y,b){b=b||{},b.frag=a.frag||void 0,y===_.ERROR&&(b=b,b.parent=a.id,b.part=a.part,a.error=b.error),a.hls.trigger(y,b)};this.observer=new ae,this.observer.on(_.FRAG_DECRYPTED,d),this.observer.on(_.ERROR,d);var c=Kn(o.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){var f=this.hls.logger,v=o.workerPath||Mn();if(v){try{o.workerPath?(f.log("loading Web Worker "+o.workerPath+' for "'+r+'"'),this.workerContext=yu(o.workerPath)):(f.log('injecting Web Worker for "'+r+'"'),this.workerContext=Bl());var m=this.workerContext.worker;m.addEventListener("message",this.onWorkerMessage),m.addEventListener("error",this.onWorkerError),m.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:c,id:r,config:ur(o)})}catch(g){f.warn('Error setting up "'+r+'" Web Worker, fallback to inline',g),this.terminateWorker(),this.error=null,this.transmuxer=new Fl(this.observer,c,o,"",r,n.logger)}return}}this.transmuxer=new Fl(this.observer,c,o,"",r,n.logger)}var l=s.prototype;return l.reset=function(){if(this.frag=null,this.part=null,this.workerContext){var r=this.instanceNo;this.instanceNo=Zh++;var e=this.hls.config,t=Kn(e.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:r,typeSupported:t,id:this.id,config:ur(e)})}},l.terminateWorker=function(){if(this.workerContext){var r=this.workerContext.worker;this.workerContext=null,r.removeEventListener("message",this.onWorkerMessage),r.removeEventListener("error",this.onWorkerError),Oc(this.hls.config.workerPath)}},l.destroy=function(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{var r=this.transmuxer;r&&(r.destroy(),this.transmuxer=null)}var e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null},l.push=function(r,e,t,a,o,d,c,f,v,m){var g,y,b=this;v.transmuxing.start=self.performance.now();var S=this.instanceNo,L=this.transmuxer,C=d?d.start:o.start,F=o.decryptdata,N=this.frag,B=!(N&&o.cc===N.cc),re=!(N&&v.level===N.level),ce=N?v.sn-N.sn:-1,Se=this.part?v.part-this.part.index:-1,Ke=ce===0&&v.id>1&&v.id===(N==null?void 0:N.stats.chunkCount),be=!re&&(ce===1||ce===0&&(Se===1||Ke&&Se<=0)),Z=self.performance.now();(re||ce||o.stats.parsing.start===0)&&(o.stats.parsing.start=Z),d&&(Se||!be)&&(d.stats.parsing.start=Z);var ne=!(N&&((g=o.initSegment)==null?void 0:g.url)===((y=N.initSegment)==null?void 0:y.url)),Re=new w(B,be,f,re,C,ne);if(!be||B||ne){this.hls.logger.log("[transmuxer-interface]: Starting new transmux session for "+o.type+" sn: "+v.sn+(v.part>-1?" part: "+v.part:"")+" "+(this.id===Ie.MAIN?"level":"track")+": "+v.level+" id: "+v.id+`
        discontinuity: `+B+`
        trackSwitch: `+re+`
        contiguous: `+be+`
        accurateTimeOffset: `+f+`
        timeOffset: `+C+`
        initSegmentChange: `+ne);var Tt=new T(t,a,e,c,m);this.configureTransmuxer(Tt)}if(this.frag=o,this.part=d,this.workerContext)this.workerContext.worker.postMessage({instanceNo:S,cmd:"demux",data:r,decryptdata:F,chunkMeta:v,state:Re},r instanceof ArrayBuffer?[r]:[]);else if(L){var ot=L.push(r,F,v,Re);p(ot)?ot.then(function(pt){b.handleTransmuxComplete(pt)}).catch(function(pt){b.transmuxerError(pt,v,"transmuxer-interface push error")}):this.handleTransmuxComplete(ot)}},l.flush=function(r){var e=this;r.transmuxing.start=self.performance.now();var t=this.instanceNo,a=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:r});else if(a){var o=a.flush(r);p(o)?o.then(function(d){e.handleFlushResult(d,r)}).catch(function(d){e.transmuxerError(d,r,"transmuxer-interface flush error")}):this.handleFlushResult(o,r)}},l.transmuxerError=function(r,e,t){this.hls&&(this.error=r,this.hls.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.FRAG_PARSING_ERROR,chunkMeta:e,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:r,err:r,reason:t}))},l.handleFlushResult=function(r,e){var t=this;r.forEach(function(a){t.handleTransmuxComplete(a)}),this.onFlush(e)},l.configureTransmuxer=function(r){var e=this.instanceNo,t=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({instanceNo:e,cmd:"configure",config:r}):t&&t.configure(r)},l.handleTransmuxComplete=function(r){r.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(r)},s}(),Bd=100,Hd=function(s){function l(r,e,t){var a;return a=s.call(this,r,e,t,"audio-stream-controller",Ie.AUDIO)||this,a.mainAnchor=null,a.mainFragLoading=null,a.audioOnly=!1,a.bufferedTrack=null,a.switchingTrack=null,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.flushing=!1,a.bufferFlushed=!1,a.cachedTrackLoadedData=null,a.registerListeners(),a}Pe(l,s);var n=l.prototype;return n.onHandlerDestroying=function(){this.unregisterListeners(),s.prototype.onHandlerDestroying.call(this),this.resetItem()},n.resetItem=function(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null},n.registerListeners=function(){s.prototype.registerListeners.call(this);var e=this.hls;e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(_.BUFFER_RESET,this.onBufferReset,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)},n.unregisterListeners=function(){var e=this.hls;e&&(s.prototype.unregisterListeners.call(this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(_.BUFFER_RESET,this.onBufferReset,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this))},n.onInitPtsFound=function(e,t){var a=t.frag,o=t.id,d=t.initPTS,c=t.timescale,f=t.trackId;if(o===Ie.MAIN){var v=a.cc,m=this.fragCurrent;if(this.initPTS[v]={baseTime:d,timescale:c,trackId:f},this.log("InitPTS for cc: "+v+" found from main: "+d/c+" ("+d+"/"+c+") trackId: "+f),this.mainAnchor=a,this.state===nt.WAITING_INIT_PTS){var g=this.waitingData;(!g&&!this.loadingParts||g&&g.frag.cc!==v)&&this.syncWithAnchor(a,g==null?void 0:g.frag)}else!this.hls.hasEnoughToStart&&m&&m.cc!==v?(m.abortRequests(),this.syncWithAnchor(a,m)):this.state===nt.IDLE&&this.tick()}},n.getLoadPosition=function(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:s.prototype.getLoadPosition.call(this)},n.syncWithAnchor=function(e,t){var a,o=((a=this.mainFragLoading)==null?void 0:a.frag)||null;if(!(t&&(o==null?void 0:o.cc)===t.cc)){var d=(o||e).cc,c=this.getLevelDetails(),f=this.getLoadPosition(),v=mn(c,d,f);v&&(this.log("Syncing with main frag at "+v.start+" cc "+v.cc),this.startFragRequested=!1,this.nextLoadPosition=v.start,this.resetLoadingState(),this.state===nt.IDLE&&this.doTickIdle())}},n.startLoad=function(e,t){if(!this.levels){this.startPosition=e,this.state=nt.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(Bd),a>0&&e===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),e=a,this.state=nt.IDLE):this.state=nt.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()},n.doTick=function(){switch(this.state){case nt.IDLE:this.doTickIdle();break;case nt.WAITING_TRACK:{var e=this.levels,t=this.trackId,a=e==null?void 0:e[t],o=a==null?void 0:a.details;if(o&&!this.waitForLive(a)){if(this.waitForCdnTuneIn(o))break;this.state=nt.WAITING_INIT_PTS}break}case nt.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case nt.WAITING_INIT_PTS:{var d=this.waitingData;if(d){var c=d.frag,f=d.part,v=d.cache,m=d.complete,g=this.mainAnchor;if(this.initPTS[c.cc]!==void 0){this.waitingData=null,this.state=nt.FRAG_LOADING;var y=v.flush().buffer,b={frag:c,part:f,payload:y,networkDetails:null};this._handleFragmentLoadProgress(b),m&&s.prototype._handleFragmentLoadComplete.call(this,b)}else g&&g.cc!==d.frag.cc&&this.syncWithAnchor(g,d.frag)}else this.state=nt.IDLE}}this.onTickEnd()},n.resetLoadingState=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),s.prototype.resetLoadingState.call(this)},n.onTickEnd=function(){var e=this.media;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)},n.doTickIdle=function(){var e,t=this.hls,a=this.levels,o=this.media,d=this.trackId,c=t.config;if(!(!this.buffering||!o&&!this.primaryPrefetch&&(this.startFragRequested||!c.startFragPrefetch)||!(a!=null&&a[d]))){var f=a[d],v=f.details;if(!v||this.waitForLive(f)||this.waitForCdnTuneIn(v)){this.state=nt.WAITING_TRACK,this.startFragRequested=!1;return}var m=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&m&&(this.bufferFlushed=!1,this.afterBufferFlushed(m,Wt.AUDIO,Ie.AUDIO));var g=this.getFwdBufferInfo(m,Ie.AUDIO);if(g!==null){if(!this.switchingTrack&&this._streamEnded(g,v)){t.trigger(_.BUFFER_EOS,{type:"audio"}),this.state=nt.ENDED;return}var y=g.len,b=t.maxBufferLength,S=v.fragments,L=S[0].start,C=this.getLoadPosition(),F=this.flushing?C:g.end;if(this.switchingTrack&&o){var N=C;v.PTSKnown&&N<L&&(g.end>L||g.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),o.currentTime=L+.05)}if(!(y>=b&&!this.switchingTrack&&F<S[S.length-1].start)){var B=this.getNextFragment(F,v);if(B&&this.isLoopLoading(B,F)&&(B=this.getNextFragmentLoopLoading(B,v,g,Ie.MAIN,b)),!B){this.bufferFlushed=!0;return}var re=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&re&&Y(B)&&!B.endList&&(!v.live||!this.loadingParts&&F<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(re)===xe.OK&&(this.mainFragLoading=re=null),re&&Y(re))){if(B.start>re.end){var ce=this.fragmentTracker.getFragAtPos(F,Ie.MAIN);ce&&ce.end>re.end&&(re=ce,this.mainFragLoading={frag:ce,targetBufferTime:null})}var Se=B.start>re.end;if(Se)return}this.loadFragment(B,f,F)}}}},n.onMediaDetaching=function(e,t){this.bufferFlushed=this.flushing=!1,s.prototype.onMediaDetaching.call(this,e,t)},n.onAudioTracksUpdated=function(e,t){var a=t.audioTracks;this.resetTransmuxer(),this.levels=a.map(function(o){return new Xa(o)})},n.onAudioTrackSwitching=function(e,t){var a=!!t.url;this.trackId=t.id;var o=this.fragCurrent;o&&(o.abortRequests(),this.removeUnbufferedFrags(o.start)),this.resetLoadingState(),a?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==nt.STOPPED&&(this.setInterval(Bd),this.state=nt.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())},n.onManifestLoading=function(){s.prototype.onManifestLoading.call(this),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1},n.onLevelLoaded=function(e,t){this.mainDetails=t.details;var a=this.cachedTrackLoadedData;a&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(_.AUDIO_TRACK_LOADED,a))},n.onAudioTrackLoaded=function(e,t){var a,o=this.levels,d=t.details,c=t.id,f=t.groupId,v=t.track;if(!o){this.warn("Audio tracks reset while loading track "+c+' "'+v.name+'" of "'+f+'"');return}var m=this.mainDetails;if(!m||d.endCC>m.endCC||m.expired){this.cachedTrackLoadedData=t,this.state!==nt.STOPPED&&(this.state=nt.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log("Audio track "+c+' "'+v.name+'" of "'+f+'" loaded ['+d.startSN+","+d.endSN+"]"+(d.lastPartSn?"[part-"+d.lastPartSn+"-"+d.lastPartIndex+"]":"")+",duration:"+d.totalduration);var g=o[c],y=0;if(d.live||(a=g.details)!=null&&a.live){if(this.checkLiveUpdate(d),d.deltaUpdateFailed)return;if(g.details){var b;y=this.alignPlaylists(d,g.details,(b=this.levelLastLoaded)==null?void 0:b.details)}d.alignedSliding||(xd(d,m),d.alignedSliding||Tl(d,m),y=d.fragmentStart)}g.details=d,this.levelLastLoaded=g,this.startFragRequested||this.setStartPosition(m,y),this.hls.trigger(_.AUDIO_TRACK_UPDATED,{details:d,id:c,groupId:t.groupId}),this.state===nt.WAITING_TRACK&&!this.waitForCdnTuneIn(d)&&(this.state=nt.IDLE),this.tick()},n._handleFragmentLoadProgress=function(e){var t,a=e.frag,o=e.part,d=e.payload,c=this.config,f=this.trackId,v=this.levels;if(!v){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var m=v[f];if(!m){this.warn("Audio track is undefined on fragment load progress");return}var g=m.details;if(!g){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(a.start);return}var y=c.defaultAudioCodec||m.audioCodec||"mp4a.40.2",b=this.transmuxer;b||(b=this.transmuxer=new xc(this.hls,Ie.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var S=this.initPTS[a.cc],L=(t=a.initSegment)==null?void 0:t.data;if(S!==void 0){var C=!1,F=o?o.index:-1,N=F!==-1,B=new qn(a.level,a.sn,a.stats.chunkCount,d.byteLength,F,N);b.push(d,L,y,"",a,o,g.totalduration,C,B,S)}else{this.log("Unknown video PTS for cc "+a.cc+", waiting for video PTS before demuxing audio frag "+a.sn+" of ["+g.startSN+" ,"+g.endSN+"],track "+f);var re=this.waitingData=this.waitingData||{frag:a,part:o,cache:new Zu,complete:!1},ce=re.cache;ce.push(new Uint8Array(d)),this.state!==nt.STOPPED&&(this.state=nt.WAITING_INIT_PTS)}},n._handleFragmentLoadComplete=function(e){if(this.waitingData){this.waitingData.complete=!0;return}s.prototype._handleFragmentLoadComplete.call(this,e)},n.onBufferReset=function(){this.mediaBuffer=null},n.onBufferCreated=function(e,t){this.bufferFlushed=this.flushing=!1;var a=t.tracks.audio;a&&(this.mediaBuffer=a.buffer||null)},n.onFragLoading=function(e,t){!this.audioOnly&&t.frag.type===Ie.MAIN&&Y(t.frag)&&(this.mainFragLoading=t,this.state===nt.IDLE&&this.tick())},n.onFragBuffered=function(e,t){var a=t.frag,o=t.part;if(a.type!==Ie.AUDIO){!this.audioOnly&&a.type===Ie.MAIN&&!a.elementaryStreams.video&&!a.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(o?" p: "+o.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+(this.switchingTrack?this.switchingTrack.name:"false"));return}if(Y(a)){this.fragPrevious=a;var d=this.switchingTrack;d&&(this.bufferedTrack=d,this.switchingTrack=null,this.hls.trigger(_.AUDIO_TRACK_SWITCHED,j({},d)))}this.fragBufferedComplete(a,o),this.media&&this.tick()},n.onError=function(e,t){var a;if(t.fatal){this.state=nt.ERROR;return}switch(t.details){case Q.FRAG_GAP:case Q.FRAG_PARSING_ERROR:case Q.FRAG_DECRYPT_ERROR:case Q.FRAG_LOAD_ERROR:case Q.FRAG_LOAD_TIMEOUT:case Q.KEY_LOAD_ERROR:case Q.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ie.AUDIO,t);break;case Q.AUDIO_TRACK_LOAD_ERROR:case Q.AUDIO_TRACK_LOAD_TIMEOUT:case Q.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===nt.WAITING_TRACK&&((a=t.context)==null?void 0:a.type)===pe.AUDIO_TRACK&&(this.state=nt.IDLE);break;case Q.BUFFER_ADD_CODEC_ERROR:case Q.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case Q.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,s.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"));break;case Q.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}},n.onBufferFlushing=function(e,t){var a=t.type;a!==Wt.VIDEO&&(this.flushing=!0)},n.onBufferFlushed=function(e,t){var a=t.type;if(a!==Wt.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===nt.ENDED&&(this.state=nt.IDLE);var o=this.mediaBuffer||this.media;o&&(this.afterBufferFlushed(o,a,Ie.AUDIO),this.tick())}},n._handleTransmuxComplete=function(e){var t,a="audio",o=this.hls,d=e.remuxResult,c=e.chunkMeta,f=this.getCurrentContext(c);if(!f){this.resetWhenMissingContext(c);return}var v=f.frag,m=f.part,g=f.level,y=g.details,b=d.audio,S=d.text,L=d.id3,C=d.initSegment;if(this.fragContextChanged(v)||!y){this.fragmentTracker.removeFragment(v);return}if(this.state=nt.PARSING,this.switchingTrack&&b&&this.completeAudioSwitch(this.switchingTrack),C!=null&&C.tracks){var F=v.initSegment||v;if(this.unhandledEncryptionError(C,v))return;this._bufferInitSegment(g,C.tracks,F,c),o.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:C.tracks})}if(b){var N=b.startPTS,B=b.endPTS,re=b.startDTS,ce=b.endDTS;m&&(m.elementaryStreams[Wt.AUDIO]={startPTS:N,endPTS:B,startDTS:re,endDTS:ce}),v.setElementaryStreamInfo(Wt.AUDIO,N,B,re,ce),this.bufferFragmentData(b,v,m,c)}if(L!=null&&(t=L.samples)!=null&&t.length){var Se=Qe({id:a,frag:v,details:y},L);o.trigger(_.FRAG_PARSING_METADATA,Se)}if(S){var Ke=Qe({id:a,frag:v,details:y},S);o.trigger(_.FRAG_PARSING_USERDATA,Ke)}},n._bufferInitSegment=function(e,t,a,o){if(this.state===nt.PARSING&&(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!!t.audio)){var d=t.audio;d.id=Ie.AUDIO;var c=e.audioCodec;this.log("Init audio buffer, container:"+d.container+", codecs[level/parsed]=["+c+"/"+d.codec+"]"),c&&c.split(",").length===1&&(d.levelCodec=c),this.hls.trigger(_.BUFFER_CODECS,t);var f=d.initSegment;if(f!=null&&f.byteLength){var v={type:"audio",frag:a,part:null,chunkMeta:o,parent:a.type,data:f};this.hls.trigger(_.BUFFER_APPENDING,v)}this.tickImmediate()}},n.loadFragment=function(e,t,a){var o=this.fragmentTracker.getState(e);if(this.switchingTrack||o===xe.NOT_LOADED||o===xe.PARTIAL){var d;if(!Y(e))this._loadInitSegment(e,t);else if((d=t.details)!=null&&d.live&&!this.initPTS[e.cc]){this.log("Waiting for video PTS in continuity counter "+e.cc+" of live stream before loading audio fragment "+e.sn+" of level "+this.trackId),this.state=nt.WAITING_INIT_PTS;var c=this.mainDetails;c&&c.fragmentStart!==t.details.fragmentStart&&Tl(t.details,c)}else s.prototype.loadFragment.call(this,e,t,a)}else this.clearTrackerIfNeeded(e)},n.flushAudioIfNeeded=function(e){if(this.media&&this.bufferedTrack){var t=this.bufferedTrack,a=t.name,o=t.lang,d=t.assocLang,c=t.characteristics,f=t.audioCodec,v=t.channels;fa({name:a,lang:o,assocLang:d,characteristics:c,audioCodec:f,channels:v},e,Fa)||(Rn(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),s.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}},n.completeAudioSwitch=function(e){var t=this.hls;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(_.AUDIO_TRACK_SWITCHED,j({},e))},l}(Xu),Hl=function(s){function l(r,e){var t;return t=s.call(this,e,r.logger)||this,t.hls=void 0,t.canLoad=!1,t.timer=-1,t.hls=r,t}Pe(l,s);var n=l.prototype;return n.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},n.clearTimer=function(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)},n.startLoad=function(){this.canLoad=!0,this.loadPlaylist()},n.stopLoad=function(){this.canLoad=!1,this.clearTimer()},n.switchParams=function(e,t,a){var o=t==null?void 0:t.renditionReports;if(o){for(var d=-1,c=0;c<o.length;c++){var f=o[c],v=void 0;try{v=new self.URL(f.URI,t.url).href}catch(L){this.warn("Could not construct new URL for Rendition Report: "+L),v=f.URI||""}if(v===e){d=c;break}else v===e.substring(0,v.length)&&(d=c)}if(d!==-1){var m=o[d],g=parseInt(m["LAST-MSN"])||t.lastPartSn,y=parseInt(m["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){var b=Math.min(t.age-t.partTarget,t.targetduration);y>=0&&b>t.partTarget&&(y+=1)}var S=a&&Na(a);return new Ln(g,y>=0?y:void 0,S)}}},n.loadPlaylist=function(e){this.clearTimer()},n.loadingPlaylist=function(e,t){this.clearTimer()},n.shouldLoadPlaylist=function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)},n.getUrlWithDirectives=function(e,t){if(t)try{return t.addDirectives(e)}catch(a){this.warn("Could not construct new URL with HLS Delivery Directives: "+a)}return e},n.playlistLoaded=function(e,t,a){var o=t.details,d=t.stats,c=self.performance.now(),f=d.loading.first?Math.max(0,c-d.loading.first):0;o.advancedDateTime=Date.now()-f;var v=this.hls.config.timelineOffset;if(v!==o.appliedTimelineOffset){var m=Math.max(v||0,0);o.appliedTimelineOffset=m,o.fragments.forEach(function(hr){hr.setStart(hr.playlistOffset+m)})}if(o.live||a!=null&&a.live){var g="levelInfo"in t?t.levelInfo:t.track;if(o.reloaded(a),a&&o.fragments.length>0){Po(a,o,this);var y=o.playlistParsingError;if(y){this.warn(y);var b=this.hls;if(!b.config.ignorePlaylistParsingErrors){var S,L=t.networkDetails;b.trigger(_.ERROR,{type:ut.NETWORK_ERROR,details:Q.LEVEL_PARSING_ERROR,fatal:!1,url:o.url,error:y,reason:y.message,level:t.level||void 0,parent:(S=o.fragments[0])==null?void 0:S.type,networkDetails:L,stats:d});return}o.playlistParsingError=null}}o.requestScheduled===-1&&(o.requestScheduled=d.loading.start);var C=this.hls.mainForwardBufferInfo,F=C?C.end-C.len:0,N=(o.edge-F)*1e3,B=ds(o,N);if(o.requestScheduled+B<c?o.requestScheduled=c:o.requestScheduled+=B,this.log("live playlist "+e+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:o.updated?"UPDATED":"MISSED")),!this.canLoad||!o.live)return;var re,ce=void 0,Se=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var Ke=this.hls.config.lowLatencyMode,be=o.lastPartSn,Z=o.endSN,ne=o.lastPartIndex,Re=ne!==-1,Tt=be===Z;Re?Tt?(ce=Z+1,Se=Ke?0:ne):(ce=be,Se=Ke?ne+1:o.maxPartIndex):ce=Z+1;var ot=o.age,pt=ot+o.ageHeader,Bt=Math.min(pt-o.partTarget,o.targetduration*1.5);if(Bt>0){if(pt>o.targetduration*3)this.log("Playlist last advanced "+ot.toFixed(2)+"s ago. Omitting segment and part directives."),ce=void 0,Se=void 0;else if(a!=null&&a.tuneInGoal&&pt-o.partTarget>a.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+a.tuneInGoal+" to: "+Bt+" with playlist age: "+o.age),Bt=0;else{var cr=Math.floor(Bt/o.targetduration);if(ce+=cr,Se!==void 0){var or=Math.round(Bt%o.targetduration/o.partTarget);Se+=or}this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+ot.toFixed(2)+"s goal: "+Bt+" skip sn "+cr+" to part "+Se)}o.tuneInGoal=Bt}if(re=this.getDeliveryDirectives(o,t.deliveryDirectives,ce,Se),Ke||!Tt){o.requestScheduled=c,this.loadingPlaylist(g,re);return}}else(o.canBlockReload||o.canSkipUntil)&&(re=this.getDeliveryDirectives(o,t.deliveryDirectives,ce,Se));re&&ce!==void 0&&o.canBlockReload&&(o.requestScheduled=d.loading.first+Math.max(B-f*2,B/2)),this.scheduleLoading(g,re,o)}else this.clearTimer()},n.scheduleLoading=function(e,t,a){var o=this,d=a||e.details;if(!d){this.loadingPlaylist(e,t);return}var c=self.performance.now(),f=d.requestScheduled;if(c>=f){this.loadingPlaylist(e,t);return}var v=f-c;this.log("reload live playlist "+(e.name||e.bitrate+"bps")+" in "+Math.round(v)+" ms"),this.clearTimer(),this.timer=self.setTimeout(function(){return o.loadingPlaylist(e,t)},v)},n.getDeliveryDirectives=function(e,t,a,o){var d=Na(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(a=t.msn,o=t.part,d=xa.No),new Ln(a,o,d)},n.checkRetry=function(e){var t=this,a=e.details,o=Ba(e),d=e.errorAction,c=d||{},f=c.action,v=c.retryCount,m=v===void 0?0:v,g=c.retryConfig,y=!!d&&!!g&&(f===q.RetryRequest||!d.resolved&&f===q.SendAlternateToPenaltyBox);if(y){var b;if(m>=g.maxNumRetry)return!1;if(o&&(b=e.context)!=null&&b.deliveryDirectives)this.warn("Retrying playlist loading "+(m+1)+"/"+g.maxNumRetry+' after "'+a+'" without delivery-directives'),this.loadPlaylist();else{var S=ki(g,m);this.clearTimer(),this.timer=self.setTimeout(function(){return t.loadPlaylist()},S),this.warn("Retrying playlist loading "+(m+1)+"/"+g.maxNumRetry+' after "'+a+'" in '+S+"ms")}e.levelRetry=!0,d.resolved=!0}return y},l}(Te);function Jh(s,l){if(s.length!==l.length)return!1;for(var n=0;n<s.length;n++)if(!od(s[n].attrs,l[n].attrs))return!1;return!0}function od(s,l,n){var r=s["STABLE-RENDITION-ID"];return r&&!n?r===l["STABLE-RENDITION-ID"]:!(n||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(function(e){return s[e]!==l[e]})}function Nc(s,l){return l.label.toLowerCase()===s.name.toLowerCase()&&(!l.language||l.language.toLowerCase()===(s.lang||"").toLowerCase())}var Rv=function(s){function l(r){var e;return e=s.call(this,r,"audio-track-controller")||this,e.tracks=[],e.groupIds=null,e.tracksInGroup=[],e.trackId=-1,e.currentTrack=null,e.selectDefaultTrack=!0,e.registerListeners(),e}Pe(l,s);var n=l.prototype;return n.registerListeners=function(){var e=this.hls;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(_.ERROR,this.onError,this)},n.unregisterListeners=function(){var e=this.hls;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(_.ERROR,this.onError,this)},n.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,s.prototype.destroy.call(this)},n.onManifestLoading=function(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0},n.onManifestParsed=function(e,t){this.tracks=t.audioTracks||[]},n.onAudioTrackLoaded=function(e,t){var a=t.id,o=t.groupId,d=t.details,c=this.tracksInGroup[a];if(!c||c.groupId!==o){this.warn("Audio track with id:"+a+" and group:"+o+" not found in active group "+(c==null?void 0:c.groupId));return}var f=c.details;c.details=t.details,this.log("Audio track "+a+' "'+c.name+'" lang:'+c.lang+" group:"+o+" loaded ["+d.startSN+"-"+d.endSN+"]"),a===this.trackId&&this.playlistLoaded(a,t,f)},n.onLevelLoading=function(e,t){this.switchLevel(t.level)},n.onLevelSwitching=function(e,t){this.switchLevel(t.level)},n.switchLevel=function(e){var t=this.hls.levels[e];if(t){var a=t.audioGroups||null,o=this.groupIds,d=this.currentTrack;if(!a||(o==null?void 0:o.length)!==(a==null?void 0:a.length)||a!=null&&a.some(function(C){return(o==null?void 0:o.indexOf(C))===-1})){this.groupIds=a,this.trackId=-1,this.currentTrack=null;var c=this.tracks.filter(function(C){return!a||a.indexOf(C.groupId)!==-1});if(c.length)this.selectDefaultTrack&&!c.some(function(C){return C.default})&&(this.selectDefaultTrack=!1),c.forEach(function(C,F){C.id=F});else if(!d&&!this.tracksInGroup.length)return;this.tracksInGroup=c;var f=this.hls.config.audioPreference;if(!d&&f){var v=xi(f,c,Fa);if(v>-1)d=c[v];else{var m=xi(f,this.tracks);d=this.tracks[m]}}var g=this.findTrackId(d);g===-1&&d&&(g=this.findTrackId(null));var y={audioTracks:c};this.log("Updating audio tracks, "+c.length+" track(s) found in group(s): "+(a==null?void 0:a.join(","))),this.hls.trigger(_.AUDIO_TRACKS_UPDATED,y);var b=this.trackId;if(g!==-1&&b===-1)this.setAudioTrack(g);else if(c.length&&b===-1){var S,L=new Error("No audio track selected for current audio group-ID(s): "+((S=this.groupIds)==null?void 0:S.join(","))+" track count: "+c.length);this.warn(L.message),this.hls.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:L})}}}},n.onError=function(e,t){t.fatal||!t.context||t.context.type===pe.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)},n.setAudioOption=function(e){var t=this.hls;if(t.config.audioPreference=e,e){var a=this.allAudioTracks;if(this.selectDefaultTrack=!1,a.length){var o=this.currentTrack;if(o&&fa(e,o,Fa))return o;var d=xi(e,this.tracksInGroup,Fa);if(d>-1){var c=this.tracksInGroup[d];return this.setAudioTrack(d),c}else if(o){var f=t.loadLevel;f===-1&&(f=t.firstAutoLevel);var v=ls(e,t.levels,a,f,Fa);if(v===-1)return null;t.nextLoadLevel=v}if(e.channels||e.audioCodec){var m=xi(e,a);if(m>-1)return a[m]}}}return null},n.setAudioTrack=function(e){var t=this.tracksInGroup;if(e<0||e>=t.length){this.warn("Invalid audio track id: "+e);return}this.selectDefaultTrack=!1;var a=this.currentTrack,o=t[e],d=o.details&&!o.details.live;if(!(e===this.trackId&&o===a&&d)&&(this.log("Switching to audio-track "+e+' "'+o.name+'" lang:'+o.lang+" group:"+o.groupId+" channels:"+o.channels),this.trackId=e,this.currentTrack=o,this.hls.trigger(_.AUDIO_TRACK_SWITCHING,j({},o)),!d)){var c=this.switchParams(o.url,a==null?void 0:a.details,o.details);this.loadPlaylist(c)}},n.findTrackId=function(e){for(var t=this.tracksInGroup,a=0;a<t.length;a++){var o=t[a];if(!(this.selectDefaultTrack&&!o.default)&&(!e||fa(e,o,Fa)))return a}if(e){for(var d=e.name,c=e.lang,f=e.assocLang,v=e.characteristics,m=e.audioCodec,g=e.channels,y=0;y<t.length;y++){var b=t[y];if(fa({name:d,lang:c,assocLang:f,characteristics:v,audioCodec:m,channels:g},b,Fa))return y}for(var S=0;S<t.length;S++){var L=t[S];if(od(e.attrs,L.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return S}for(var C=0;C<t.length;C++){var F=t[C];if(od(e.attrs,F.attrs,["LANGUAGE"]))return C}}return-1},n.loadPlaylist=function(e){s.prototype.loadPlaylist.call(this);var t=this.currentTrack;this.shouldLoadPlaylist(t)&&Rn(t.url,this.hls)&&this.scheduleLoading(t,e)},n.loadingPlaylist=function(e,t){s.prototype.loadingPlaylist.call(this,e,t);var a=e.id,o=e.groupId,d=this.getUrlWithDirectives(e.url,t),c=e.details,f=c==null?void 0:c.age;this.log("Loading audio-track "+a+' "'+e.name+'" lang:'+e.lang+" group:"+o+((t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:"")+(f&&c.live?" age "+f.toFixed(1)+(c.type?" "+c.type||0:""):"")+" "+d),this.hls.trigger(_.AUDIO_TRACK_LOADING,{url:d,id:a,groupId:o,deliveryDirectives:t||null,track:e})},Ne(l,[{key:"allAudioTracks",get:function(){return this.tracks}},{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}}])}(Hl),ef=function(){function s(n){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=n}var l=s.prototype;return l.destroy=function(){this.tracks=this.queues=null},l.append=function(r,e,t){if(!(this.queues===null||this.tracks===null)){var a=this.queues[e];a.push(r),a.length===1&&!t&&this.executeNext(e)}},l.appendBlocker=function(r){var e=this;return new Promise(function(t){var a={label:"async-blocker",execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};e.append(a,r)})},l.prependBlocker=function(r){var e=this;return new Promise(function(t){if(e.queues){var a={label:"async-blocker-prepend",execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};e.queues[r].unshift(a)}})},l.removeBlockers=function(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(function(r){var e,t=(e=r[0])==null?void 0:e.label;(t==="async-blocker"||t==="async-blocker-prepend")&&(r[0].execute(),r.splice(0,1))})},l.unblockAudio=function(r){if(this.queues!==null){var e=this.queues.audio;e[0]===r&&this.shiftAndExecuteNext("audio")}},l.executeNext=function(r){if(!(this.queues===null||this.tracks===null)){var e=this.queues[r];if(e.length){var t=e[0];try{t.execute()}catch(d){var a;if(t.onError(d),this.queues===null||this.tracks===null)return;var o=(a=this.tracks[r])==null?void 0:a.buffer;o!=null&&o.updating||this.shiftAndExecuteNext(r)}}}},l.shiftAndExecuteNext=function(r){this.queues!==null&&(this.queues[r].shift(),this.executeNext(r))},l.current=function(r){var e;return((e=this.queues)==null?void 0:e[r][0])||null},l.toString=function(){var r=this.queues,e=this.tracks;return r===null||e===null?"<destroyed>":`
`+this.list("video")+`
`+this.list("audio")+`
`+this.list("audiovideo")+"}"},l.list=function(r){var e,t;return(e=this.queues)!=null&&e[r]||(t=this.tracks)!=null&&t[r]?r+": ("+this.listSbInfo(r)+") "+this.listOps(r):""},l.listSbInfo=function(r){var e,t=(e=this.tracks)==null?void 0:e[r],a=t==null?void 0:t.buffer;return a?"SourceBuffer"+(a.updating?" updating":"")+(t.ended?" ended":"")+(t.ending?" ending":""):"none"},l.listOps=function(r){var e;return((e=this.queues)==null?void 0:e[r].map(function(t){return t.label}).join(", "))||""},s}(),Uc=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,Fc="HlsJsTrackRemovedError",ld=function(s){function l(n){var r;return r=s.call(this,n)||this,r.name=Fc,r}return Pe(l,s),l}(Et(Error)),tf=function(s){function l(r,e){var t;return t=s.call(this,"buffer-controller",r.logger)||this,t.hls=void 0,t.fragmentTracker=void 0,t.details=null,t._objectUrl=null,t.operationQueue=null,t.bufferCodecEventsTotal=0,t.media=null,t.mediaSource=null,t.lastMpegAudioChunk=null,t.blockedAudioAppend=null,t.lastVideoAppendEnd=0,t.appendSource=void 0,t.transferData=void 0,t.overrides=void 0,t.appendErrors={audio:0,video:0,audiovideo:0},t.tracks={},t.sourceBuffers=[[null,null],[null,null]],t._onEndStreaming=function(a){var o;t.hls&&((o=t.mediaSource)==null?void 0:o.readyState)==="open"&&t.hls.pauseBuffering()},t._onStartStreaming=function(a){t.hls&&t.hls.resumeBuffering()},t._onMediaSourceOpen=function(a){var o=t,d=o.media,c=o.mediaSource;a&&t.log("Media source opened"),!(!d||!c)&&(c.removeEventListener("sourceopen",t._onMediaSourceOpen),d.removeEventListener("emptied",t._onMediaEmptied),t.updateDuration(),t.hls.trigger(_.MEDIA_ATTACHED,{media:d,mediaSource:c}),t.mediaSource!==null&&t.checkPendingTracks())},t._onMediaSourceClose=function(){t.log("Media source closed")},t._onMediaSourceEnded=function(){t.log("Media source ended")},t._onMediaEmptied=function(){var a=t,o=a.mediaSrc,d=a._objectUrl;o!==d&&t.error("Media element src was set while attaching MediaSource ("+d+" > "+o+")")},t.hls=r,t.fragmentTracker=e,t.appendSource=je(Be(r.config.preferManagedMediaSource)),t.initTracks(),t.registerListeners(),t}Pe(l,s);var n=l.prototype;return n.hasSourceTypes=function(){return Object.keys(this.tracks).length>0},n.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null},n.registerListeners=function(){var e=this.hls;e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.BUFFER_RESET,this.onBufferReset,this),e.on(_.BUFFER_APPENDING,this.onBufferAppending,this),e.on(_.BUFFER_CODECS,this.onBufferCodecs,this),e.on(_.BUFFER_EOS,this.onBufferEos,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(_.FRAG_PARSED,this.onFragParsed,this),e.on(_.FRAG_CHANGED,this.onFragChanged,this),e.on(_.ERROR,this.onError,this)},n.unregisterListeners=function(){var e=this.hls;e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.BUFFER_RESET,this.onBufferReset,this),e.off(_.BUFFER_APPENDING,this.onBufferAppending,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.BUFFER_EOS,this.onBufferEos,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(_.FRAG_PARSED,this.onFragParsed,this),e.off(_.FRAG_CHANGED,this.onFragChanged,this),e.off(_.ERROR,this.onError,this)},n.transferMedia=function(){var e=this,t=this.media,a=this.mediaSource;if(!t)return null;var o={};if(this.operationQueue){var d=this.isUpdating();d||this.operationQueue.removeBlockers();var c=this.isQueued();(d||c)&&this.warn("Transfering MediaSource with"+(c?" operations in queue":"")+(d?" updating SourceBuffer(s)":"")+" "+this.operationQueue),this.operationQueue.destroy()}var f=this.transferData;return!this.sourceBufferCount&&f&&f.mediaSource===a?Qe(o,f.tracks):this.sourceBuffers.forEach(function(v){var m=v[0];m&&(o[m]=Qe({},e.tracks[m]),e.removeBuffer(m)),v[0]=v[1]=null}),{media:t,mediaSource:a,tracks:o}},n.initTracks=function(){var e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0},n.onManifestLoading=function(){this.bufferCodecEventsTotal=0,this.details=null},n.onManifestParsed=function(e,t){var a,o=2;(t.audio&&!t.video||!t.altAudio)&&(o=1),this.bufferCodecEventsTotal=o,this.log(o+" bufferCodec event(s) expected."),(a=this.transferData)!=null&&a.mediaSource&&this.sourceBufferCount&&o&&this.bufferCreated()},n.onMediaAttaching=function(e,t){var a=this.media=t.media;this.transferData=this.overrides=void 0;var o=Be(this.appendSource);if(o){var d=!!t.mediaSource;(d||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);var c=this.mediaSource=t.mediaSource||new o;if(this.assignMediaSource(c),d)this._objectUrl=a.src,this.attachTransferred();else{var f=this._objectUrl=self.URL.createObjectURL(c);if(this.appendSource)try{a.removeAttribute("src");var v=self.ManagedMediaSource;a.disableRemotePlayback=a.disableRemotePlayback||v&&c instanceof v,bu(a),eo(a,f),a.load()}catch(m){a.src=f}else a.src=f}a.addEventListener("emptied",this._onMediaEmptied)}},n.assignMediaSource=function(e){var t,a;this.log((((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created")+" media source: "+((a=e.constructor)==null?void 0:a.name)),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))},n.attachTransferred=function(){var e=this,t=this.media,a=this.transferData;if(!(!a||!t)){var o=this.tracks,d=a.tracks,c=d?Object.keys(d):null,f=c?c.length:0,v=function(){Promise.resolve().then(function(){e.media&&e.mediaSourceOpenOrEnded&&e._onMediaSourceOpen()})};if(d&&c&&f){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log("attachTransferred: (bufferCodecEventsTotal "+this.bufferCodecEventsTotal+`)
required tracks: `+ur(o,function(b,S){return b==="initSegment"?void 0:S})+`;
transfer tracks: `+ur(d,function(b,S){return b==="initSegment"?void 0:S})+"}"),!Jt(d,o)){a.mediaSource=null,a.tracks=void 0;var m=t.currentTime,g=this.details,y=Math.max(m,(g==null?void 0:g.fragments[0].start)||0);if(y-m>1){this.log("attachTransferred: waiting for playback to reach new tracks start time "+m+" -> "+y);return}this.warn('attachTransferred: resetting MediaSource for incompatible tracks ("'+Object.keys(d)+'"->"'+Object.keys(o)+'") start time: '+y+" currentTime: "+m),this.onMediaDetaching(_.MEDIA_DETACHING,{}),this.onMediaAttaching(_.MEDIA_ATTACHING,a),t.currentTime=y;return}this.transferData=void 0,c.forEach(function(b){var S=b,L=d[S];if(L){var C=L.buffer;if(C){var F=e.fragmentTracker,N=L.id;if(F.hasFragments(N)||F.hasParts(N)){var B=Pr.getBuffered(C);F.detectEvictedFragments(S,B,N,null,!0)}var re=Tu(S),ce=[S,C];e.sourceBuffers[re]=ce,C.updating&&e.operationQueue&&e.operationQueue.prependBlocker(S),e.trackSourceBuffer(S,L)}}}),v(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),v()}},n.onMediaDetaching=function(e,t){var a=this,o=!!t.transferMedia;this.transferData=this.overrides=void 0;var d=this.media,c=this.mediaSource,f=this._objectUrl;if(c){if(this.log("media source "+(o?"transferring":"detaching")),o)this.sourceBuffers.forEach(function(y){var b=y[0];b&&a.removeBuffer(b)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){var v=c.readyState==="open";try{for(var m=c.sourceBuffers,g=m.length;g--;)v&&m[g].abort(),c.removeSourceBuffer(m[g]);v&&c.endOfStream()}catch(y){this.warn("onMediaDetaching: "+y.message+" while calling endOfStream")}}this.sourceBufferCount&&this.onBufferReset()}c.removeEventListener("sourceopen",this._onMediaSourceOpen),c.removeEventListener("sourceended",this._onMediaSourceEnded),c.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(c.removeEventListener("startstreaming",this._onStartStreaming),c.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}d&&(d.removeEventListener("emptied",this._onMediaEmptied),o||(f&&self.URL.revokeObjectURL(f),this.mediaSrc===f?(d.removeAttribute("src"),this.appendSource&&bu(d),d.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(_.MEDIA_DETACHED,t)},n.onBufferReset=function(){var e=this;this.sourceBuffers.forEach(function(t){var a=t[0];a&&e.resetBuffer(a)}),this.initTracks()},n.resetBuffer=function(e){var t,a=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),a)try{var o;(o=this.mediaSource)!=null&&o.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(a)}catch(d){this.warn("onBufferReset "+e,d)}delete this.tracks[e]},n.removeBuffer=function(e){this.removeBufferListeners(e),this.sourceBuffers[Tu(e)]=[null,null];var t=this.tracks[e];t&&(t.buffer=void 0)},n.resetQueue=function(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new ef(this.tracks)},n.onBufferCodecs=function(e,t){var a=this,o,d=this.tracks,c=Object.keys(t);this.log('BUFFER_CODECS: "'+c+'" (current SB count '+this.sourceBufferCount+")");var f="audiovideo"in t&&(d.audio||d.video)||d.audiovideo&&("audio"in t||"video"in t),v=!f&&this.sourceBufferCount&&this.media&&c.some(function(m){return!d[m]});if(f||v){this.warn('Unsupported transition between "'+Object.keys(d)+'" and "'+c+'" SourceBuffers');return}c.forEach(function(m){var g,y,b=t[m],S=b.id,L=b.codec,C=b.levelCodec,F=b.container,N=b.metadata,B=b.supplemental,re=d[m],ce=(g=a.transferData)==null||(g=g.tracks)==null?void 0:g[m],Se=ce!=null&&ce.buffer?ce:re,Ke=(Se==null?void 0:Se.pendingCodec)||(Se==null?void 0:Se.codec),be=Se==null?void 0:Se.levelCodec;re||(re=d[m]={buffer:void 0,listeners:[],codec:L,supplemental:B,container:F,levelCodec:C,metadata:N,id:S});var Z=Nr(Ke,be),ne=Z==null?void 0:Z.replace(Uc,"$1"),Re=Nr(L,C),Tt=(y=Re)==null?void 0:y.replace(Uc,"$1");Re&&Z&&ne!==Tt&&(m.slice(0,5)==="audio"&&(Re=ui(Re,a.appendSource)),a.log("switching codec "+Ke+" to "+Re),Re!==(re.pendingCodec||re.codec)&&(re.pendingCodec=Re),re.container=F,a.appendChangeType(m,F,Re))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((o=t.audio)==null?void 0:o.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())},n.appendChangeType=function(e,t,a){var o=this,d=t+";codecs="+a,c={label:"change-type="+d,execute:function(){var v=o.tracks[e];if(v){var m=v.buffer;m!=null&&m.changeType&&(o.log("changing "+e+" sourceBuffer type to "+d),m.changeType(d),v.codec=a,v.container=t)}o.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(v){o.warn("Failed to change "+e+" SourceBuffer type",v)}};this.append(c,e,this.isPending(this.tracks[e]))},n.blockAudio=function(e){var t,a=this,o=e.start,d=o+e.duration*.05,c=((t=this.fragmentTracker.getAppendedFrag(o,Ie.MAIN))==null?void 0:t.gap)===!0;if(!c){var f={label:"block-audio",execute:function(){var m,g=a.tracks.video;(a.lastVideoAppendEnd>d||g!=null&&g.buffer&&Pr.isBuffered(g.buffer,d)||((m=a.fragmentTracker.getAppendedFrag(d,Ie.MAIN))==null?void 0:m.gap)===!0)&&(a.blockedAudioAppend=null,a.shiftAndExecuteNext("audio"))},onStart:function(){},onComplete:function(){},onError:function(m){a.warn("Error executing block-audio operation",m)}};this.blockedAudioAppend={op:f,frag:e},this.append(f,"audio",!0)}},n.unblockAudio=function(){var e=this.blockedAudioAppend,t=this.operationQueue;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))},n.onBufferAppending=function(e,t){var a=this,o=this.tracks,d=t.data,c=t.type,f=t.parent,v=t.frag,m=t.part,g=t.chunkMeta,y=t.offset,b=g.buffering[c],S=v.sn,L=v.cc,C=self.performance.now();b.start=C;var F=v.stats.buffering,N=m?m.stats.buffering:null;F.start===0&&(F.start=C),N&&N.start===0&&(N.start=C);var B=o.audio,re=!1;c==="audio"&&(B==null?void 0:B.container)==="audio/mpeg"&&(re=!this.lastMpegAudioChunk||g.id===1||this.lastMpegAudioChunk.sn!==g.sn,this.lastMpegAudioChunk=g);var ce=o.video,Se=ce==null?void 0:ce.buffer;if(Se&&S!=="initSegment"){var Ke=m||v,be=this.blockedAudioAppend;if(c==="audio"&&f!=="main"&&!this.blockedAudioAppend&&!(ce.ending||ce.ended)){var Z=Ke.start,ne=Z+Ke.duration*.05,Re=Se.buffered,Tt=this.currentOp("video");!Re.length&&!Tt?this.blockAudio(Ke):!Tt&&!Pr.isBuffered(Se,ne)&&this.lastVideoAppendEnd<ne&&this.blockAudio(Ke)}else if(c==="video"){var ot=Ke.end;if(be){var pt=be.frag.start;(ot>pt||ot<this.lastVideoAppendEnd||Pr.isBuffered(Se,pt))&&this.unblockAudio()}this.lastVideoAppendEnd=ot}}var Bt=(m||v).start,cr={label:"append-"+c,execute:function(){var hr;b.executeStart=self.performance.now();var xr=(hr=a.tracks[c])==null?void 0:hr.buffer;xr&&(re?a.updateTimestampOffset(xr,Bt,.1,c,S,L):y!==void 0&&Ge(y)&&a.updateTimestampOffset(xr,y,1e-6,c,S,L)),a.appendExecutor(d,c)},onStart:function(){},onComplete:function(){var hr=self.performance.now();b.executeEnd=b.end=hr,F.first===0&&(F.first=hr),N&&N.first===0&&(N.first=hr);var xr={};a.sourceBuffers.forEach(function(fr){var lr=fr[0],_r=fr[1];lr&&(xr[lr]=Pr.getBuffered(_r))}),a.appendErrors[c]=0,c==="audio"||c==="video"?a.appendErrors.audiovideo=0:(a.appendErrors.audio=0,a.appendErrors.video=0),a.hls.trigger(_.BUFFER_APPENDED,{type:c,frag:v,part:m,chunkMeta:g,parent:v.type,timeRanges:xr})},onError:function(hr){var xr,fr={type:ut.MEDIA_ERROR,parent:v.type,details:Q.BUFFER_APPEND_ERROR,sourceBufferName:c,frag:v,part:m,chunkMeta:g,error:hr,err:hr,fatal:!1},lr=(xr=a.media)==null?void 0:xr.error;if(hr.code===DOMException.QUOTA_EXCEEDED_ERR||hr.name=="QuotaExceededError"||"quota"in hr)fr.details=Q.BUFFER_FULL_ERROR;else if(hr.code===DOMException.INVALID_STATE_ERR&&a.mediaSourceOpenOrEnded&&!lr)fr.errorAction=We(!0);else if(hr.name===Fc&&a.sourceBufferCount===0)fr.errorAction=We(!0);else{var _r=++a.appendErrors[c];a.warn("Failed "+_r+"/"+a.hls.config.appendErrorMaxRetry+' times to append segment in "'+c+'" sourceBuffer ('+(lr||"no media error")+")"),(_r>=a.hls.config.appendErrorMaxRetry||lr)&&(fr.fatal=!0)}a.hls.trigger(_.ERROR,fr)}};this.log('queuing "'+c+'" append sn: '+S+(m?" p: "+m.index:"")+" of "+(v.type===Ie.MAIN?"level":"track")+" "+v.level+" cc: "+L),this.append(cr,c,this.isPending(this.tracks[c]))},n.getFlushOp=function(e,t,a){var o=this;return this.log('queuing "'+e+'" remove '+t+"-"+a),{label:"remove",execute:function(){o.removeExecutor(e,t,a)},onStart:function(){},onComplete:function(){o.hls.trigger(_.BUFFER_FLUSHED,{type:e})},onError:function(c){o.warn("Failed to remove "+t+"-"+a+' from "'+e+'" SourceBuffer',c)}}},n.onBufferFlushing=function(e,t){var a=this,o=t.type,d=t.startOffset,c=t.endOffset;o?this.append(this.getFlushOp(o,d,c),o):this.sourceBuffers.forEach(function(f){var v=f[0];v&&a.append(a.getFlushOp(v,d,c),v)})},n.onFragParsed=function(e,t){var a=this,o=t.frag,d=t.part,c=[],f=d?d.elementaryStreams:o.elementaryStreams;f[Wt.AUDIOVIDEO]?c.push("audiovideo"):(f[Wt.AUDIO]&&c.push("audio"),f[Wt.VIDEO]&&c.push("video"));var v=function(){var g=self.performance.now();o.stats.buffering.end=g,d&&(d.stats.buffering.end=g);var y=d?d.stats:o.stats;a.hls.trigger(_.FRAG_BUFFERED,{frag:o,part:d,stats:y,id:o.type})};c.length===0&&this.warn("Fragments must have at least one ElementaryStreamType set. type: "+o.type+" level: "+o.level+" sn: "+o.sn),this.blockBuffers(v,c).catch(function(m){a.warn("Fragment buffered callback "+m),a.stepOperationQueue(a.sourceBufferTypes)})},n.onFragChanged=function(e,t){this.trimBuffers()},n.onBufferEos=function(e,t){var a=this,o;this.sourceBuffers.forEach(function(f){var v=f[0];if(v){var m=a.tracks[v];(!t.type||t.type===v)&&(m.ending=!0,m.ended||(m.ended=!0,a.log(v+" buffer reached EOS")))}});var d=((o=this.overrides)==null?void 0:o.endOfStream)!==!1,c=this.sourceBufferCount>0&&!this.sourceBuffers.some(function(f){var v,m=f[0];return m&&!((v=a.tracks[m])!=null&&v.ended)});c?d?(this.log("Queueing EOS"),this.blockUntilOpen(function(){a.tracksEnded();var f=a.mediaSource;if(!f||f.readyState!=="open"){f&&a.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: "+f.readyState);return}a.log("Calling mediaSource.endOfStream()"),f.endOfStream(),a.hls.trigger(_.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(_.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()},n.tracksEnded=function(){var e=this;this.sourceBuffers.forEach(function(t){var a=t[0];if(a!==null){var o=e.tracks[a];o&&(o.ending=!1)}})},n.onLevelUpdated=function(e,t){var a=t.details;a.fragments.length&&(this.details=a,this.updateDuration())},n.updateDuration=function(){var e=this;this.blockUntilOpen(function(){var t=e.getDurationAndRange();t&&e.updateMediaSource(t)})},n.onError=function(e,t){if(t.details===Q.BUFFER_APPEND_ERROR&&t.frag){var a,o=(a=t.errorAction)==null?void 0:a.nextAutoLevel;Ge(o)&&o!==t.frag.level&&this.resetAppendErrors()}},n.resetAppendErrors=function(){this.appendErrors={audio:0,video:0,audiovideo:0}},n.trimBuffers=function(){var e=this.hls,t=this.details,a=this.media;if(!(!a||t===null)&&this.sourceBufferCount){var o=e.config,d=a.currentTime,c=t.levelTargetDuration,f=t.live&&o.liveBackBufferLength!==null?o.liveBackBufferLength:o.backBufferLength;if(Ge(f)&&f>=0){var v=Math.max(f,c),m=Math.floor(d/c)*c-v;this.flushBackBuffer(d,c,m)}var g=o.frontBufferFlushThreshold;if(Ge(g)&&g>0){var y=Math.max(o.maxBufferLength,g),b=Math.max(y,c),S=Math.floor(d/c)*c+b;this.flushFrontBuffer(d,c,S)}}},n.flushBackBuffer=function(e,t,a){var o=this;this.sourceBuffers.forEach(function(d){var c=d[0],f=d[1];if(f){var v=Pr.getBuffered(f);if(v.length>0&&a>v.start(0)){var m;o.hls.trigger(_.BACK_BUFFER_REACHED,{bufferEnd:a});var g=o.tracks[c];if((m=o.details)!=null&&m.live)o.hls.trigger(_.LIVE_BACK_BUFFER_REACHED,{bufferEnd:a});else if(g!=null&&g.ended){o.log("Cannot flush "+c+" back buffer while SourceBuffer is in ended state");return}o.hls.trigger(_.BUFFER_FLUSHING,{startOffset:0,endOffset:a,type:c})}}})},n.flushFrontBuffer=function(e,t,a){var o=this;this.sourceBuffers.forEach(function(d){var c=d[0],f=d[1];if(f){var v=Pr.getBuffered(f),m=v.length;if(m<2)return;var g=v.start(m-1),y=v.end(m-1);if(a>g||e>=g&&e<=y)return;o.hls.trigger(_.BUFFER_FLUSHING,{startOffset:g,endOffset:1/0,type:c})}})},n.getDurationAndRange=function(){var e,t=this.details,a=this.mediaSource;if(!t||!this.media||(a==null?void 0:a.readyState)!=="open")return null;var o=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){var d=t.fragments.length;if(d&&a.setLiveSeekableRange){var c=Math.max(0,t.fragmentStart),f=Math.max(c,o);return{duration:1/0,start:c,end:f}}return{duration:1/0}}var v=(e=this.overrides)==null?void 0:e.duration;if(v)return Ge(v)?{duration:v}:null;var m=this.media.duration,g=Ge(a.duration)?a.duration:0;return o>g&&o>m||!Ge(m)?{duration:o}:null},n.updateMediaSource=function(e){var t=e.duration,a=e.start,o=e.end,d=this.mediaSource;!this.media||!d||d.readyState!=="open"||(d.duration!==t&&(Ge(t)&&this.log("Updating MediaSource duration to "+t.toFixed(3)),d.duration=t),a!==void 0&&o!==void 0&&(this.log("MediaSource duration is set to "+d.duration+". Setting seekable range to "+a+"-"+o+"."),d.setLiveSeekableRange(a,o)))},n.checkPendingTracks=function(){var e=this.bufferCodecEventsTotal,t=this.pendingTrackCount,a=this.tracks;if(this.log("checkPendingTracks (pending: "+t+" codec events expected: "+e+") "+ur(a)),this.tracksReady){var o,d=(o=this.transferData)==null?void 0:o.tracks;d&&Object.keys(d).length?this.attachTransferred():this.createSourceBuffers()}},n.bufferCreated=function(){var e=this;if(this.sourceBufferCount){var t={};this.sourceBuffers.forEach(function(o){var d=o[0],c=o[1];if(d){var f=e.tracks[d];t[d]={buffer:c,container:f.container,codec:f.codec,supplemental:f.supplemental,levelCodec:f.levelCodec,id:f.id,metadata:f.metadata}}}),this.hls.trigger(_.BUFFER_CREATED,{tracks:t}),this.log("SourceBuffers created. Running queue: "+this.operationQueue),this.sourceBuffers.forEach(function(o){var d=o[0];e.executeNext(d)})}else{var a=new Error("could not create source buffer for media codec(s)");this.hls.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:a,reason:a.message})}},n.createSourceBuffers=function(){var e=this.tracks,t=this.sourceBuffers,a=this.mediaSource;if(!a)throw new Error("createSourceBuffers called when mediaSource was null");for(var o in e){var d=o,c=e[d];if(this.isPending(c)){var f=this.getTrackCodec(c,d),v=c.container+";codecs="+f;c.codec=f,this.log("creating sourceBuffer("+v+")"+(this.currentOp(d)?" Queued":"")+" "+ur(c));try{var m=a.addSourceBuffer(v),g=Tu(d),y=[d,m];t[g]=y,c.buffer=m}catch(S){var b;this.error("error while trying to add sourceBuffer: "+S.message),this.shiftAndExecuteNext(d),(b=this.operationQueue)==null||b.removeBlockers(),delete this.tracks[d],this.hls.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:S,sourceBufferName:d,mimeType:v,parent:c.id});return}this.trackSourceBuffer(d,c)}}this.bufferCreated()},n.getTrackCodec=function(e,t){var a=e.supplemental,o=e.codec;a&&(t==="video"||t==="audiovideo")&&ma(a,"video")&&(o=Li(o,a));var d=Nr(o,e.levelCodec);return d?t.slice(0,5)==="audio"?ui(d,this.appendSource):d:""},n.trackSourceBuffer=function(e,t){var a=this,o=t.buffer;if(o){var d=this.getTrackCodec(t,e);this.tracks[e]={buffer:o,codec:d,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",function(c,f){var v=f.removedRanges;v!=null&&v.length&&a.hls.trigger(_.BUFFER_FLUSHED,{type:c})})}},n.onSBUpdateStart=function(e){var t=this.currentOp(e);t&&t.onStart()},n.onSBUpdateEnd=function(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}var a=this.currentOp(e);a&&(a.onComplete(),this.shiftAndExecuteNext(e))},n.onSBUpdateError=function(e,t){var a,o=new Error(e+" SourceBuffer error. MediaSource readyState: "+((a=this.mediaSource)==null?void 0:a.readyState));this.error(""+o,t),this.hls.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:o,fatal:!1});var d=this.currentOp(e);d&&d.onError(o)},n.updateTimestampOffset=function(e,t,a,o,d,c){var f=t-e.timestampOffset;Math.abs(f)>=a&&(this.log("Updating "+o+" SourceBuffer timestampOffset to "+t+" (sn: "+d+" cc: "+c+")"),e.timestampOffset=t)},n.removeExecutor=function(e,t,a){var o=this.media,d=this.mediaSource,c=this.tracks[e],f=c==null?void 0:c.buffer;if(!o||!d||!f){this.warn("Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),this.shiftAndExecuteNext(e);return}var v=Ge(o.duration)?o.duration:1/0,m=Ge(d.duration)?d.duration:1/0,g=Math.max(0,t),y=Math.min(a,v,m);y>g&&(!c.ending||c.ended)?(c.ended=!1,this.log("Removing ["+g+","+y+"] from the "+e+" SourceBuffer"),f.remove(g,y)):this.shiftAndExecuteNext(e)},n.appendExecutor=function(e,t){var a=this.tracks[t],o=a==null?void 0:a.buffer;if(!o)throw new ld("Attempting to append to the "+t+" SourceBuffer, but it does not exist");a.ending=!1,a.ended=!1,o.appendBuffer(e)},n.blockUntilOpen=function(e){var t=this;if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(function(a){t.warn("SourceBuffer blocked callback "+a),t.stepOperationQueue(t.sourceBufferTypes)});else try{e()}catch(a){this.warn("Callback run without blocking "+this.operationQueue+" "+a)}},n.isUpdating=function(){return this.sourceBuffers.some(function(e){var t=e[0],a=e[1];return t&&a.updating})},n.isQueued=function(){var e=this;return this.sourceBuffers.some(function(t){var a=t[0];return a&&!!e.currentOp(a)})},n.isPending=function(e){return!!e&&!e.buffer},n.blockBuffers=function(e,t){var a=this;if(t===void 0&&(t=this.sourceBufferTypes),!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);var o=this.operationQueue,d=t.map(function(f){return a.appendBlocker(f)}),c=t.length>1&&!!this.blockedAudioAppend;return c&&this.unblockAudio(),Promise.all(d).then(function(f){o===a.operationQueue&&(e(),a.stepOperationQueue(a.sourceBufferTypes))})},n.stepOperationQueue=function(e){var t=this;e.forEach(function(a){var o,d=(o=t.tracks[a])==null?void 0:o.buffer;!d||d.updating||t.shiftAndExecuteNext(a)})},n.append=function(e,t,a){this.operationQueue&&this.operationQueue.append(e,t,a)},n.appendBlocker=function(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)},n.currentOp=function(e){return this.operationQueue?this.operationQueue.current(e):null},n.executeNext=function(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)},n.shiftAndExecuteNext=function(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)},n.addBufferListener=function(e,t,a){var o=this.tracks[e];if(o){var d=o.buffer;if(d){var c=a.bind(this,e);o.listeners.push({event:t,listener:c}),d.addEventListener(t,c)}}},n.removeBufferListeners=function(e){var t=this.tracks[e];if(t){var a=t.buffer;a&&(t.listeners.forEach(function(o){a.removeEventListener(o.event,o.listener)}),t.listeners.length=0)}},Ne(l,[{key:"mediaSourceOpenOrEnded",get:function(){var e,t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}},{key:"sourceBufferTracks",get:function(){var e=this;return Object.keys(this.tracks).reduce(function(t,a){var o=e.tracks[a];return t[a]={id:o.id,container:o.container,codec:o.codec,levelCodec:o.levelCodec},t},{})}},{key:"bufferedToEnd",get:function(){var e=this;return this.sourceBufferCount>0&&!this.sourceBuffers.some(function(t){var a=t[0];if(a){var o=e.tracks[a];if(o)return!o.ended||o.ending}return!1})}},{key:"tracksReady",get:function(){var e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}},{key:"mediaSrc",get:function(){var e,t,a=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return a==null?void 0:a.src}},{key:"pendingTrackCount",get:function(){var e=this;return Object.keys(this.tracks).reduce(function(t,a){return t+(e.isPending(e.tracks[a])?1:0)},0)}},{key:"sourceBufferCount",get:function(){return this.sourceBuffers.reduce(function(e,t){var a=t[0];return e+(a?1:0)},0)}},{key:"sourceBufferTypes",get:function(){return this.sourceBuffers.map(function(e){var t=e[0];return t}).filter(function(e){return!!e})}}])}(Te);function bu(s){var l=s.querySelectorAll("source");[].slice.call(l).forEach(function(n){s.removeChild(n)})}function eo(s,l){var n=self.document.createElement("source");n.type="video/mp4",n.src=l,s.appendChild(n)}function Tu(s){return s==="audio"?1:0}var Vd=function(){function s(n){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=n,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var l=s.prototype;return l.setStreamController=function(r){this.streamController=r},l.destroy=function(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},l.registerListeners=function(){var r=this.hls;r.on(_.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),r.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),r.on(_.MANIFEST_PARSED,this.onManifestParsed,this),r.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),r.on(_.BUFFER_CODECS,this.onBufferCodecs,this),r.on(_.MEDIA_DETACHING,this.onMediaDetaching,this)},l.unregisterListener=function(){var r=this.hls;r.off(_.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),r.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),r.off(_.MANIFEST_PARSED,this.onManifestParsed,this),r.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),r.off(_.BUFFER_CODECS,this.onBufferCodecs,this),r.off(_.MEDIA_DETACHING,this.onMediaDetaching,this)},l.onFpsDropLevelCapping=function(r,e){var t=this.hls.levels[e.droppedLevel];this.isLevelAllowed(t)&&this.restrictedLevels.push({bitrate:t.bitrate,height:t.height,width:t.width})},l.onMediaAttaching=function(r,e){this.media=e.media instanceof HTMLVideoElement?e.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()},l.onManifestParsed=function(r,e){var t=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,t.config.capLevelToPlayerSize&&e.video&&this.startCapping()},l.onLevelsUpdated=function(r,e){this.timer&&Ge(this.autoLevelCapping)&&this.detectPlayerSize()},l.onBufferCodecs=function(r,e){var t=this.hls;t.config.capLevelToPlayerSize&&e.video&&this.startCapping()},l.onMediaDetaching=function(){this.stopCapping(),this.media=null},l.detectPlayerSize=function(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}var r=this.hls.levels;if(r.length){var e=this.hls,t=this.getMaxLevel(r.length-1);t!==this.autoLevelCapping&&e.logger.log("Setting autoLevelCapping to "+t+": "+r[t].height+"p@"+r[t].bitrate+" for media "+this.mediaWidth+"x"+this.mediaHeight),e.autoLevelCapping=t,e.autoLevelEnabled&&e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}},l.getMaxLevel=function(r){var e=this,t=this.hls.levels;if(!t.length)return-1;var a=t.filter(function(o,d){return e.isLevelAllowed(o)&&d<=r});return this.clientRect=null,s.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)},l.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},l.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},l.getDimensions=function(){if(this.clientRect)return this.clientRect;var r=this.media,e={width:0,height:0};if(r){var t=r.getBoundingClientRect();e.width=t.width,e.height=t.height,!e.width&&!e.height&&(e.width=t.right-t.left||r.width||0,e.height=t.bottom-t.top||r.height||0)}return this.clientRect=e,e},l.isLevelAllowed=function(r){var e=this.restrictedLevels;return!e.some(function(t){return r.bitrate===t.bitrate&&r.width===t.width&&r.height===t.height})},s.getMaxLevelByMediaSize=function(r,e,t){if(!(r!=null&&r.length))return-1;for(var a=function(m,g){return g?m.width!==g.width||m.height!==g.height:!0},o=r.length-1,d=Math.max(e,t),c=0;c<r.length;c+=1){var f=r[c];if((f.width>=d||f.height>=d)&&a(f,r[c+1])){o=c;break}}return o},Ne(s,[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var r=1;if(!this.hls.config.ignoreDevicePixelRatio)try{r=self.devicePixelRatio}catch(e){}return Math.min(r,this.hls.config.maxDevicePixelRatio)}}])}(),rf={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Hn=rf,wv={HLS:"h"},Bc=wv,Vl=function s(l,n){Array.isArray(l)&&(l=l.map(function(r){return r instanceof s?r:new s(r)})),this.value=l,this.params=n},af="Dict";function Cv(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function Dv(s,l,n,r){return new Error("failed to "+s+' "'+Cv(l)+'" as '+n,{cause:r})}function to(s,l,n){return Dv("serialize",s,l,n)}var Hc=function(l){this.description=l},Gd="Bare Item",nf="Boolean";function Mv(s){if(typeof s!="boolean")throw to(s,nf);return s?"?1":"?0"}function Pv(s){return btoa(String.fromCharCode.apply(String,s))}var sf="Byte Sequence";function Vc(s){if(ArrayBuffer.isView(s)===!1)throw to(s,sf);return":"+Pv(s)+":"}var Ov="Integer";function _u(s){return s<-999999999999999||999999999999999<s}function of(s){if(_u(s))throw to(s,Ov);return s.toString()}function Zo(s){return"@"+of(s.getTime()/1e3)}function Kd(s,l){if(s<0)return-Kd(-s,l);var n=Math.pow(10,l),r=Math.abs(s*n%1-.5)<Number.EPSILON;if(r){var e=Math.floor(s*n);return(e%2===0?e:e+1)/n}else return Math.round(s*n)/n}var lf="Decimal";function Au(s){var l=Kd(s,3);if(Math.floor(Math.abs(l)).toString().length>12)throw to(s,lf);var n=l.toString();return n.includes(".")?n:n+".0"}var xv="String",Nv=/[\x00-\x1f\x7f]+/;function Gc(s){if(Nv.test(s))throw to(s,xv);return'"'+s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function Uv(s){return s.description||s.toString().slice(7,-1)}var Fv="Token";function uf(s){var l=Uv(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(l)===!1)throw to(l,Fv);return l}function Kc(s){switch(typeof s){case"number":if(!Ge(s))throw to(s,Gd);return Number.isInteger(s)?of(s):Au(s);case"string":return Gc(s);case"symbol":return uf(s);case"boolean":return Mv(s);case"object":if(s instanceof Date)return Zo(s);if(s instanceof Uint8Array)return Vc(s);if(s instanceof Hc)return uf(s);default:throw to(s,Gd)}}var df="Key";function ud(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw to(s,df);return s}function vs(s){return s==null?"":Object.entries(s).map(function(l){var n=l[0],r=l[1];return r===!0?";"+ud(n):";"+ud(n)+"="+Kc(r)}).join("")}function cf(s){return s instanceof Vl?""+Kc(s.value)+vs(s.params):Kc(s)}function Bv(s){return"("+s.value.map(cf).join(" ")+")"+vs(s.params)}function Hv(s,l){if(l===void 0&&(l={whitespace:!0}),typeof s!="object"||s==null)throw to(s,af);var n=s instanceof Map?s.entries():Object.entries(s),r=l!=null&&l.whitespace?" ":"";return Array.from(n).map(function(e){var t=e[0],a=e[1];a instanceof Vl||(a=new Vl(a));var o=ud(t);return a.value===!0?o+=vs(a.params):(o+="=",Array.isArray(a.value)?o+=Bv(a):o+=cf(a)),o}).join(","+r)}function Wd(s,l){return Hv(s,l)}var Os="CMCD-Object",da="CMCD-Request",Gl="CMCD-Session",Jo="CMCD-Status",Yd={br:Os,ab:Os,d:Os,ot:Os,tb:Os,tpb:Os,lb:Os,tab:Os,lab:Os,url:Os,pb:da,bl:da,tbl:da,dl:da,ltc:da,mtp:da,nor:da,nrr:da,rc:da,sn:da,sta:da,su:da,ttfb:da,ttfbb:da,ttlb:da,cmsdd:da,cmsds:da,smrt:da,df:da,cs:da,ts:da,cid:Gl,pr:Gl,sf:Gl,sid:Gl,st:Gl,v:Gl,msd:Gl,bs:Jo,bsd:Jo,cdn:Jo,rtp:Jo,bg:Jo,pt:Jo,ec:Jo,e:Jo},Vv={REQUEST:da};function hf(s){return Object.keys(s).reduce(function(l,n){var r;return(r=s[n])===null||r===void 0||r.forEach(function(e){return l[e]=n}),l},{})}function $d(s,l){var n={};if(!s)return n;var r=Object.keys(s),e=l?hf(l):{};return r.reduce(function(t,a){var o,d=Yd[a]||e[a]||Vv.REQUEST,c=(o=t[d])!==null&&o!==void 0?o:t[d]={};return c[a]=s[a],t},n)}function Gv(s){return["ot","sf","st","e","sta"].includes(s)}function qd(s){return typeof s=="number"?Ge(s):s!=null&&s!==""&&s!==!1}var xs="event";function Kv(s,l){var n=new URL(s),r=new URL(l);if(n.origin!==r.origin)return s;for(var e=n.pathname.split("/").slice(1),t=r.pathname.split("/").slice(1,-1);e[0]===t[0];)e.shift(),t.shift();for(;t.length;)t.shift(),e.unshift("..");var a=e.join("/");return a+n.search+n.hash}var Kl=function(l){return Math.round(l)},jd=function(l,n){return Array.isArray(l)?l.map(function(r){return jd(r,n)}):l instanceof Vl&&typeof l.value=="string"?new Vl(jd(l.value,n),l.params):(n.baseUrl&&(l=Kv(l,n.baseUrl)),n.version===1?encodeURIComponent(l):l)},dd=function(l){return Kl(l/100)*100},ff=function(l,n){var r=l;return n.version>=2&&(l instanceof Vl&&typeof l.value=="string"?r=new Vl([l]):typeof l=="string"&&(r=[l])),jd(r,n)},Wv={br:Kl,d:Kl,bl:dd,dl:dd,mtp:dd,nor:ff,rtp:dd,tb:Kl},vf="request",Su="response",Wc=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],Lu=["e"],Yc=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function zd(s){return Yc.test(s)}function Yv(s){return Wc.includes(s)||Lu.includes(s)||zd(s)}var mf=["d","dl","nor","ot","rtp","su"];function $v(s){return Wc.includes(s)||mf.includes(s)||zd(s)}var $c=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function ku(s){return Wc.includes(s)||mf.includes(s)||$c.includes(s)||zd(s)}var qc=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function qv(s){return qc.includes(s)||zd(s)}var cd,jv=(cd={},cd[Su]=ku,cd[xs]=Yv,cd[vf]=$v,cd);function pf(s,l){l===void 0&&(l={});var n={};if(s==null||typeof s!="object")return n;var r=l.version||s.v||1,e=l.reportingMode||vf,t=r===1?qv:jv[e],a=Object.keys(s).filter(t),o=l.filter;typeof o=="function"&&(a=a.filter(o));var d=e===Su||e===xs;d&&!a.includes("ts")&&a.push("ts"),r>1&&!a.includes("v")&&a.push("v");var c=Qe({},Wv,l.formatters),f={version:r,reportingMode:e,baseUrl:l.baseUrl};return a.sort().forEach(function(v){var m=s[v],g=c[v];if(typeof g=="function"&&(m=g(m,f)),v==="v"){if(r===1)return;m=r}v=="pr"&&m===1||(d&&v==="ts"&&!Ge(m)&&(m=Date.now()),qd(m)&&(Gv(v)&&typeof m=="string"&&(m=new Hc(m)),n[v]=m))}),n}function jc(s,l){l===void 0&&(l={});var n={};if(!s)return n;var r=pf(s,l),e=$d(r,l==null?void 0:l.customHeaderMap);return Object.entries(e).reduce(function(t,a){var o=a[0],d=a[1],c=Wd(d,{whitespace:!1});return c&&(t[o]=c),t},n)}function gf(s,l,n){return Qe(s,jc(l,n))}var zc="CMCD";function zv(s,l){return l===void 0&&(l={}),s?Wd(pf(s,l),{whitespace:!1}):""}function Qv(s,l){if(l===void 0&&(l={}),!s)return"";var n=zv(s,l);return encodeURIComponent(n)}function Iu(s,l){if(l===void 0&&(l={}),!s)return"";var n=Qv(s,l);return zc+"="+n}var el=/CMCD=[^&#]+/;function Ef(s,l,n){var r=Iu(l,n);if(!r)return s;if(el.test(s))return s.replace(el,r);var e=s.includes("?")?"&":"?";return""+s+e+r}var yf=function(){function s(n){var r=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){r.initialized&&(r.starved=!0),r.buffering=!0},this.onPlaying=function(){r.initialized||(r.initialized=!0),r.buffering=!1},this.applyPlaylistData=function(a){try{r.apply(a,{ot:Hn.MANIFEST,su:!r.initialized})}catch(o){r.hls.logger.warn("Could not generate manifest CMCD data.",o)}},this.applyFragmentData=function(a){try{var o=a.frag,d=a.part,c=r.hls.levels[o.level],f=r.getObjectType(o),v={d:(d||o).duration*1e3,ot:f};(f===Hn.VIDEO||f===Hn.AUDIO||f==Hn.MUXED)&&(v.br=c.bitrate/1e3,v.tb=r.getTopBandwidth(f)/1e3,v.bl=r.getBufferLength(f));var m=d?r.getNextPart(d):r.getNextFrag(o);m!=null&&m.url&&m.url!==o.url&&(v.nor=m.url),r.apply(a,v)}catch(g){r.hls.logger.warn("Could not generate segment CMCD data.",g)}},this.hls=n;var e=this.config=n.config,t=e.cmcd;t!=null&&(e.pLoader=this.createPlaylistLoader(),e.fLoader=this.createFragmentLoader(),this.sid=t.sessionId||n.sessionId,this.cid=t.contentId,this.useHeaders=t.useHeaders===!0,this.includeKeys=t.includeKeys,this.registerListeners())}var l=s.prototype;return l.registerListeners=function(){var r=this.hls;r.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(_.MEDIA_DETACHED,this.onMediaDetached,this),r.on(_.BUFFER_CREATED,this.onBufferCreated,this)},l.unregisterListeners=function(){var r=this.hls;r.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(_.MEDIA_DETACHED,this.onMediaDetached,this),r.off(_.BUFFER_CREATED,this.onBufferCreated,this)},l.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null},l.onMediaAttached=function(r,e){this.media=e.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},l.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},l.onBufferCreated=function(r,e){var t,a;this.audioBuffer=(t=e.tracks.audio)==null?void 0:t.buffer,this.videoBuffer=(a=e.tracks.video)==null?void 0:a.buffer},l.createData=function(){var r;return{v:1,sf:Bc.HLS,sid:this.sid,cid:this.cid,pr:(r=this.media)==null?void 0:r.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},l.apply=function(r,e){e===void 0&&(e={}),Qe(e,this.createData());var t=e.ot===Hn.INIT||e.ot===Hn.VIDEO||e.ot===Hn.MUXED;this.starved&&t&&(e.bs=!0,e.su=!0,this.starved=!1),e.su==null&&(e.su=this.buffering);var a=this.includeKeys;a&&(e=Object.keys(e).reduce(function(d,c){return a.includes(c)&&(d[c]=e[c]),d},{}));var o={baseUrl:r.url};this.useHeaders?(r.headers||(r.headers={}),gf(r.headers,e,o)):r.url=Ef(r.url,e,o)},l.getNextFrag=function(r){var e,t=(e=this.hls.levels[r.level])==null?void 0:e.details;if(t){var a=r.sn-t.startSN;return t.fragments[a+1]}},l.getNextPart=function(r){var e,t=r.index,a=r.fragment,o=(e=this.hls.levels[a.level])==null||(e=e.details)==null?void 0:e.partList;if(o)for(var d=a.sn,c=o.length-1;c>=0;c--){var f=o[c];if(f.index===t&&f.fragment.sn===d)return o[c+1]}},l.getObjectType=function(r){var e=r.type;if(e==="subtitle")return Hn.TIMED_TEXT;if(r.sn==="initSegment")return Hn.INIT;if(e==="audio")return Hn.AUDIO;if(e==="main")return this.hls.audioTracks.length?Hn.VIDEO:Hn.MUXED},l.getTopBandwidth=function(r){var e=0,t,a=this.hls;if(r===Hn.AUDIO)t=a.audioTracks;else{var o=a.maxAutoLevel,d=o>-1?o+1:a.levels.length;t=a.levels.slice(0,d)}return t.forEach(function(c){c.bitrate>e&&(e=c.bitrate)}),e>0?e:NaN},l.getBufferLength=function(r){var e=this.media,t=r===Hn.AUDIO?this.audioBuffer:this.videoBuffer;if(!t||!e)return NaN;var a=Pr.bufferInfo(t,e.currentTime,this.config.maxBufferHole);return a.len*1e3},l.createPlaylistLoader=function(){var r=this.config.pLoader,e=this.applyPlaylistData,t=r||this.config.loader;return function(){function a(d){this.loader=void 0,this.loader=new t(d)}var o=a.prototype;return o.destroy=function(){this.loader.destroy()},o.abort=function(){this.loader.abort()},o.load=function(c,f,v){e(c),this.loader.load(c,f,v)},Ne(a,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}])}()},l.createFragmentLoader=function(){var r=this.config.fLoader,e=this.applyFragmentData,t=r||this.config.loader;return function(){function a(d){this.loader=void 0,this.loader=new t(d)}var o=a.prototype;return o.destroy=function(){this.loader.destroy()},o.abort=function(){this.loader.abort()},o.load=function(c,f,v){e(c),this.loader.load(c,f,v)},Ne(a,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}])}()},s}(),Xv=3e5,Qc=function(s){function l(r){var e;return e=s.call(this,"content-steering",r.logger)||this,e.hls=void 0,e.loader=null,e.uri=null,e.pathwayId=".",e._pathwayPriority=null,e.timeToLoad=300,e.reloadTimer=-1,e.updated=0,e.started=!1,e.enabled=!0,e.levels=null,e.audioTracks=null,e.subtitleTracks=null,e.penalizedPathways={},e.hls=r,e.registerListeners(),e}Pe(l,s);var n=l.prototype;return n.registerListeners=function(){var e=this.hls;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.ERROR,this.onError,this)},n.unregisterListeners=function(){var e=this.hls;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.ERROR,this.onError,this))},n.pathways=function(){return(this.levels||[]).reduce(function(e,t){return e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e},[])},n.startLoad=function(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){var e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}},n.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()},n.clearTimeout=function(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)},n.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},n.removeLevel=function(e){var t=this.levels;t&&(this.levels=t.filter(function(a){return a!==e}))},n.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},n.onManifestLoaded=function(e,t){var a=t.contentSteering;a!==null&&(this.pathwayId=a.pathwayId,this.uri=a.uri,this.started&&this.startLoad())},n.onManifestParsed=function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks},n.onError=function(e,t){var a=t.errorAction;if((a==null?void 0:a.action)===q.SendAlternateToPenaltyBox&&a.flags===ue.MoveAllAlternatesMatchingHost){var o=this.levels,d=this._pathwayPriority,c=this.pathwayId;if(t.context){var f=t.context,v=f.groupId,m=f.pathwayId,g=f.type;v&&o?c=this.getPathwayForGroupId(v,g,c):m&&(c=m)}c in this.penalizedPathways||(this.penalizedPathways[c]=performance.now()),!d&&o&&(d=this.pathways()),d&&d.length>1&&(this.updatePathwayPriority(d),a.resolved=this.pathwayId!==c),t.details===Q.BUFFER_APPEND_ERROR&&!t.fatal?a.resolved=!0:a.resolved||this.warn("Could not resolve "+t.details+' ("'+t.error.message+'") with content-steering for Pathway: '+c+" levels: "+(o&&o.length)+" priorities: "+ur(d)+" penalized: "+ur(this.penalizedPathways))}},n.filterParsedLevels=function(e){this.levels=e;var t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){var a=e[0].pathwayId;this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+a+'"'),t=this.getLevelsForPathway(a),this.pathwayId=a}return t.length!==e.length&&this.log("Found "+t.length+"/"+e.length+' levels in Pathway "'+this.pathwayId+'"'),t},n.getLevelsForPathway=function(e){return this.levels===null?[]:this.levels.filter(function(t){return e===t.pathwayId})},n.updatePathwayPriority=function(e){this._pathwayPriority=e;var t,a=this.penalizedPathways,o=performance.now();Object.keys(a).forEach(function(g){o-a[g]>Xv&&delete a[g]});for(var d=0;d<e.length;d++){var c=e[d];if(!(c in a)){if(c===this.pathwayId)return;var f=this.hls.nextLoadLevel,v=this.hls.levels[f];if(t=this.getLevelsForPathway(c),t.length>0){this.log('Setting Pathway to "'+c+'"'),this.pathwayId=c,Oo(t),this.hls.trigger(_.LEVELS_UPDATED,{levels:t});var m=this.hls.levels[f];v&&m&&this.levels&&(m.attrs["STABLE-VARIANT-ID"]!==v.attrs["STABLE-VARIANT-ID"]&&m.bitrate!==v.bitrate&&this.log("Unstable Pathways change from bitrate "+v.bitrate+" to "+m.bitrate),this.hls.nextLoadLevel=f);break}}}},n.getPathwayForGroupId=function(e,t,a){for(var o=this.getLevelsForPathway(a).concat(this.levels||[]),d=0;d<o.length;d++)if(t===pe.AUDIO_TRACK&&o[d].hasAudioGroup(e)||t===pe.SUBTITLE_TRACK&&o[d].hasSubtitleGroup(e))return o[d].pathwayId;return a},n.clonePathways=function(e){var t=this,a=this.levels;if(a){var o={},d={};e.forEach(function(c){var f=c.ID,v=c["BASE-ID"],m=c["URI-REPLACEMENT"];if(!a.some(function(y){return y.pathwayId===f})){var g=t.getLevelsForPathway(v).map(function(y){var b=new Hi(y.attrs);b["PATHWAY-ID"]=f;var S=b.AUDIO&&b.AUDIO+"_clone_"+f,L=b.SUBTITLES&&b.SUBTITLES+"_clone_"+f;S&&(o[b.AUDIO]=S,b.AUDIO=S),L&&(d[b.SUBTITLES]=L,b.SUBTITLES=L);var C=Tf(y.uri,b["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",m),F=new Xa({attrs:b,audioCodec:y.audioCodec,bitrate:y.bitrate,height:y.height,name:y.name,url:C,videoCodec:y.videoCodec,width:y.width});if(y.audioGroups)for(var N=1;N<y.audioGroups.length;N++)F.addGroupId("audio",y.audioGroups[N]+"_clone_"+f);if(y.subtitleGroups)for(var B=1;B<y.subtitleGroups.length;B++)F.addGroupId("text",y.subtitleGroups[B]+"_clone_"+f);return F});a.push.apply(a,g),bf(t.audioTracks,o,m,f),bf(t.subtitleTracks,d,m,f)}})}},n.loadSteeringManifest=function(e){var t=this,a=this.hls.config,o=a.loader;this.loader&&this.loader.destroy(),this.loader=new o(a);var d;try{d=new self.URL(e)}catch(b){this.enabled=!1,this.log("Failed to parse Steering Manifest URI: "+e);return}if(d.protocol!=="data:"){var c=(this.hls.bandwidthEstimate||a.abrEwmaDefaultEstimate)|0;d.searchParams.set("_HLS_pathway",this.pathwayId),d.searchParams.set("_HLS_throughput",""+c)}var f={responseType:"json",url:d.href},v=a.steeringManifestLoadPolicy.default,m=v.errorRetry||v.timeoutRetry||{},g={loadPolicy:v,timeout:v.maxLoadTimeMs,maxRetry:m.maxNumRetry||0,retryDelay:m.retryDelayMs||0,maxRetryDelay:m.maxRetryDelayMs||0},y={onSuccess:function(S,L,C,F){t.log('Loaded steering manifest: "'+d+'"');var N=S.data;if((N==null?void 0:N.VERSION)!==1){t.log("Steering VERSION "+N.VERSION+" not supported!");return}t.updated=performance.now(),t.timeToLoad=N.TTL;var B=N["RELOAD-URI"],re=N["PATHWAY-CLONES"],ce=N["PATHWAY-PRIORITY"];if(B)try{t.uri=new self.URL(B,d).href}catch(Ke){t.enabled=!1,t.log("Failed to parse Steering Manifest RELOAD-URI: "+B);return}t.scheduleRefresh(t.uri||C.url),re&&t.clonePathways(re);var Se={steeringManifest:N,url:d.toString()};t.hls.trigger(_.STEERING_MANIFEST_LOADED,Se),ce&&t.updatePathwayPriority(ce)},onError:function(S,L,C,F){if(t.log("Error loading steering manifest: "+S.code+" "+S.text+" ("+L.url+")"),t.stopLoad(),S.code===410){t.enabled=!1,t.log("Steering manifest "+L.url+" no longer available");return}var N=t.timeToLoad*1e3;if(S.code===429){var B=t.loader;if(typeof(B==null?void 0:B.getResponseHeader)=="function"){var re=B.getResponseHeader("Retry-After");re&&(N=parseFloat(re)*1e3)}t.log("Steering manifest "+L.url+" rate limited");return}t.scheduleRefresh(t.uri||L.url,N)},onTimeout:function(S,L,C){t.log("Timeout loading steering manifest ("+L.url+")"),t.scheduleRefresh(t.uri||L.url)}};this.log("Requesting steering manifest: "+d),this.loader.load(f,g,y)},n.scheduleRefresh=function(e,t){var a=this;t===void 0&&(t=this.timeToLoad*1e3),this.clearTimeout(),this.reloadTimer=self.setTimeout(function(){var o,d=(o=a.hls)==null?void 0:o.media;if(d&&!d.ended){a.loadSteeringManifest(e);return}a.scheduleRefresh(e,a.timeToLoad*1e3)},t)},Ne(l,[{key:"pathwayPriority",get:function(){return this._pathwayPriority},set:function(e){this.updatePathwayPriority(e)}}])}(Te);function bf(s,l,n,r){s&&Object.keys(l).forEach(function(e){var t=s.filter(function(a){return a.groupId===e}).map(function(a){var o=Qe({},a);return o.details=void 0,o.attrs=new Hi(o.attrs),o.url=o.attrs.URI=Tf(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",n),o.groupId=o.attrs["GROUP-ID"]=l[e],o.attrs["PATHWAY-ID"]=r,o});s.push.apply(s,t)})}function Tf(s,l,n,r){var e=r.HOST,t=r.PARAMS,a=r[n],o;l&&(o=a==null?void 0:a[l],o&&(s=o));var d=new self.URL(s);return e&&!o&&(d.host=e),t&&Object.keys(t).sort().forEach(function(c){c&&d.searchParams.set(c,t[c])}),d.href}var _f=function(s){function l(r){var e;return e=s.call(this,"eme",r.logger)||this,e.hls=void 0,e.config=void 0,e.media=null,e.mediaResolved=void 0,e.keyFormatPromise=null,e.keySystemAccessPromises={},e._requestLicenseFailureCount=0,e.mediaKeySessions=[],e.keyIdToKeySessionPromise={},e.mediaKeys=null,e.setMediaKeysQueue=l.CDMCleanupPromise?[l.CDMCleanupPromise]:[],e.bannedKeyIds={},e.onMediaEncrypted=function(t){var a=t.initDataType,o=t.initData,d='"'+t.type+'" event: init data type: "'+a+'"';if(e.debug(d),o!==null){if(!e.keyFormatPromise){var c=Object.keys(e.keySystemAccessPromises);c.length||(c=Mt(e.config));var f=c.map(tt).filter(function(v){return!!v});e.keyFormatPromise=e.getKeyFormatPromise(f)}e.keyFormatPromise.then(function(v){var m=Ve(v);if(a!=="sinf"||m!==$.FAIRPLAY){e.log('Ignoring "'+t.type+'" event with init data type: "'+a+'" for selected key-system '+m);return}var g;try{var y=Zt(new Uint8Array(o)),b=I(JSON.parse(y).sinf),S=Ht(b);if(!S)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");g=new Uint8Array(S.subarray(8,24))}catch(Ke){e.warn(d+" Failed to parse sinf: "+Ke);return}for(var L=Ut(g),C=e,F=C.keyIdToKeySessionPromise,N=C.mediaKeySessions,B=F[L],re=function(){var be=N[Se],Z=be.decryptdata;if(!Z.keyId)return 0;var ne=Ut(Z.keyId);if(Mi(g,Z.keyId)||Z.uri.replace(/-/g,"").indexOf(L)!==-1)return B=F[ne],B?(Z.pssh||(delete F[ne],Z.pssh=new Uint8Array(o),Z.keyId=g,B=F[L]=B.then(function(){return e.generateRequestWithPreferredKeySession(be,a,o,"encrypted-event-key-match")}),B.catch(function(Re){return e.handleError(Re)})),1):0},ce,Se=0;Se<N.length&&(ce=re(),!(ce!==0&&ce===1));Se++);B||e.handleError(new Error("Key ID "+L+" not encountered in playlist. Key-system sessions "+N.length+"."))}).catch(function(v){return e.handleError(v)})}},e.onWaitingForKey=function(t){e.log('"'+t.type+'" event')},e.hls=r,e.config=r.config,e.registerListeners(),e}Pe(l,s);var n=l.prototype;return n.destroy=function(){this.onDestroying(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null},n.registerListeners=function(){this.hls.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(_.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(_.DESTROYING,this.onDestroying,this)},n.unregisterListeners=function(){this.hls.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(_.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(_.DESTROYING,this.onDestroying,this)},n.getLicenseServerUrl=function(e){var t=this.config,a=t.drmSystems,o=t.widevineLicenseUrl,d=a==null?void 0:a[e];if(d)return d.licenseUrl;if(e===$.WIDEVINE&&o)return o},n.getLicenseServerUrlOrThrow=function(e){var t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error('no license server URL configured for key-system "'+e+'"');return t},n.getServerCertificateUrl=function(e){var t=this.config.drmSystems,a=t==null?void 0:t[e];if(a)return a.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},n.attemptKeySystemAccess=function(e){var t=this,a=this.hls.levels,o=function(v,m,g){return!!v&&g.indexOf(v)===m},d=a.map(function(f){return f.audioCodec}).filter(o),c=a.map(function(f){return f.videoCodec}).filter(o);return d.length+c.length===0&&c.push("avc1.42e01e"),new Promise(function(f,v){var m=function(y){var b=y.shift();t.getMediaKeysPromise(b,d,c).then(function(S){return f({keySystem:b,mediaKeys:S})}).catch(function(S){y.length?m(y):S instanceof Oi?v(S):v(new Oi({type:ut.KEY_SYSTEM_ERROR,details:Q.KEY_SYSTEM_NO_ACCESS,error:S,fatal:!0},S.message))})};m(e)})},n.requestMediaKeySystemAccess=function(e,t){var a=this.config.requestMediaKeySystemAccessFunc;if(typeof a!="function"){var o="Configured requestMediaKeySystemAccess is not a function "+a;return Gt===null&&self.location.protocol==="http:"&&(o="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(o))}return a(e,t)},n.getMediaKeysPromise=function(e,t,a){var o,d=this,c=et(e,t,a,this.config.drmSystemOptions||{}),f=this.keySystemAccessPromises[e],v=(o=f)==null?void 0:o.keySystemAccess;if(!v){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+ur(c)),v=this.requestMediaKeySystemAccess(e,c);var m=f=this.keySystemAccessPromises[e]={keySystemAccess:v};return v.catch(function(g){d.log('Failed to obtain access to key-system "'+e+'": '+g)}),v.then(function(g){d.log('Access for key-system "'+g.keySystem+'" obtained');var y=d.fetchServerCertificate(e);d.log('Create media-keys for "'+e+'"');var b=m.mediaKeys=g.createMediaKeys().then(function(S){return d.log('Media-keys created for "'+e+'"'),m.hasMediaKeys=!0,y.then(function(L){return L?d.setMediaKeysServerCertificate(S,e,L):S})});return b.catch(function(S){d.error('Failed to create media-keys for "'+e+'"}: '+S)}),b})}return v.then(function(){return f.mediaKeys})},n.createMediaKeySessionContext=function(e){var t=e.decryptdata,a=e.keySystem,o=e.mediaKeys;this.log('Creating key-system session "'+a+'" keyId: '+Ut(t.keyId||[])+" keyUri: "+t.uri);var d=o.createSession(),c={decryptdata:t,keySystem:a,mediaKeys:o,mediaKeysSession:d,keyStatus:"status-pending"};return this.mediaKeySessions.push(c),c},n.renewKeySession=function(e){var t=e.decryptdata;if(t.pssh){var a=this.createMediaKeySessionContext(e),o=hd(t),d="cenc";this.keyIdToKeySessionPromise[o]=this.generateRequestWithPreferredKeySession(a,d,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},n.updateKeySession=function(e,t){var a=e.mediaKeysSession;return this.log('Updating key-session "'+a.sessionId+'" for keyId '+Ut(e.decryptdata.keyId||[])+`
      } (data length: `+t.byteLength+")"),a.update(t)},n.getSelectedKeySystemFormats=function(){var e=this;return Object.keys(this.keySystemAccessPromises).map(function(t){return{keySystem:t,hasMediaKeys:e.keySystemAccessPromises[t].hasMediaKeys}}).filter(function(t){var a=t.hasMediaKeys;return!!a}).map(function(t){var a=t.keySystem;return tt(a)}).filter(function(t){return!!t})},n.getKeySystemAccess=function(e){var t=this;return this.getKeySystemSelectionPromise(e).then(function(a){var o=a.keySystem,d=a.mediaKeys;return t.attemptSetMediaKeys(o,d)})},n.selectKeySystem=function(e){var t=this;return new Promise(function(a,o){t.getKeySystemSelectionPromise(e).then(function(d){var c=d.keySystem,f=tt(c);f?a(f):o(new Error('Unable to find format for key-system "'+c+'"'))}).catch(o)})},n.selectKeySystemFormat=function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise},n.getKeyFormatPromise=function(e){var t=Mt(this.config),a=e.map(Ve).filter(function(o){return!!o&&t.indexOf(o)!==-1});return this.selectKeySystem(a)},n.getKeyStatus=function(e){for(var t=this.mediaKeySessions,a=0;a<t.length;a++){var o=Af(e,t[a]);if(o)return o}},n.loadKey=function(e){var t=this,a=e.keyInfo.decryptdata,o=hd(a),d=this.bannedKeyIds[o];if(d||this.getKeyStatus(a)==="internal-error"){var c=Ns(d||"internal-error",a);return this.handleError(c,e.frag),Promise.reject(c)}var f="(keyId: "+o+' format: "'+a.keyFormat+'" method: '+a.method+" uri: "+a.uri+")";this.log("Starting session for key "+f);var v=this.keyIdToKeySessionPromise[o];if(!v){var m=this.getKeySystemForKeyPromise(a).then(function(g){var y=g.keySystem,b=g.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+f),t.attemptSetMediaKeys(y,b).then(function(){return t.throwIfDestroyed(),t.createMediaKeySessionContext({keySystem:y,mediaKeys:b,decryptdata:a})})}).then(function(g){var y="cenc",b=a.pssh?a.pssh.buffer:null;return t.generateRequestWithPreferredKeySession(g,y,b,"playlist-key")});return m.catch(function(g){return t.handleError(g,e.frag)}),this.keyIdToKeySessionPromise[o]=m,m}return v.catch(function(g){if(g instanceof Oi){var y=j({},g.data);t.getKeyStatus(a)==="internal-error"&&(y.decryptdata=a);var b=new Oi(y,g.message);t.handleError(b,e.frag)}}),v},n.throwIfDestroyed=function(e){if(!this.hls)throw new Error("invalid state")},n.handleError=function(e,t){if(this.hls)if(e instanceof Oi){t&&(e.data.frag=t);var a=e.data.decryptdata;this.error(""+e.message+(a?" ("+Ut(a.keyId||[])+")":"")),this.hls.trigger(_.ERROR,e.data)}else this.error(e.message),this.hls.trigger(_.ERROR,{type:ut.KEY_SYSTEM_ERROR,details:Q.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})},n.getKeySystemForKeyPromise=function(e){var t=hd(e),a=this.keyIdToKeySessionPromise[t];if(!a){var o=Ve(e.keyFormat),d=o?[o]:Mt(this.config);return this.attemptKeySystemAccess(d)}return a},n.getKeySystemSelectionPromise=function(e){if(e.length||(e=Mt(this.config)),e.length===0)throw new Oi({type:ut.KEY_SYSTEM_ERROR,details:Q.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+ur({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},n.attemptSetMediaKeys=function(e,t){var a=this;if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();var o=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var d=Promise.all(o).then(function(){return a.media?a.media.setMediaKeys(t):new Promise(function(c,f){a.mediaResolved=function(){if(a.mediaResolved=void 0,!a.media)return f(new Error("Attempted to set mediaKeys without media element attached"));a.mediaKeys=t,a.media.setMediaKeys(t).then(c).catch(f)}})});return this.mediaKeys=t,this.setMediaKeysQueue.push(d),d.then(function(){a.log('Media-keys set for "'+e+'"'),o.push(d),a.setMediaKeysQueue=a.setMediaKeysQueue.filter(function(c){return o.indexOf(c)===-1})})},n.generateRequestWithPreferredKeySession=function(e,t,a,o){var d,c=this,f=(d=this.config.drmSystems)==null||(d=d[e.keySystem])==null?void 0:d.generateRequest;if(f)try{var v=f.call(this.hls,t,a,e);if(!v)throw new Error("Invalid response from configured generateRequest filter");t=v.initDataType,a=v.initData?v.initData:null,e.decryptdata.pssh=a?new Uint8Array(a):null}catch(F){if(this.warn(F.message),this.hls&&this.hls.config.debug)throw F}if(a===null)return this.log('Skipping key-session request for "'+o+'" (no initData)'),Promise.resolve(e);var m=hd(e.decryptdata),g=e.decryptdata.uri;this.log('Generating key-session request for "'+o+'" keyId: '+m+" URI: "+g+" (init data type: "+t+" length: "+a.byteLength+")");var y=new ae,b=e._onmessage=function(F){var N=e.mediaKeysSession;if(!N){y.emit("error",new Error("invalid state"));return}var B=F.messageType,re=F.message;c.log('"'+B+'" message event for session "'+N.sessionId+'" message size: '+re.byteLength),B==="license-request"||B==="license-renewal"?c.renewLicense(e,re).catch(function(ce){y.eventNames().length?y.emit("error",ce):c.handleError(ce)}):B==="license-release"?e.keySystem===$.FAIRPLAY&&c.updateKeySession(e,A("acknowledged")).then(function(){return c.removeSession(e)}).catch(function(ce){return c.handleError(ce)}):c.warn('unhandled media key message type "'+B+'"')},S=function(N,B){B.keyStatus=N;var re;N.startsWith("usable")?y.emit("resolved"):N==="internal-error"||N==="output-restricted"||N==="output-downscaled"?re=Ns(N,B.decryptdata):N==="expired"?re=new Error("key expired (keyId: "+m+")"):N==="released"?re=new Error("key released"):N==="status-pending"||c.warn('unhandled key status change "'+N+'" (keyId: '+m+")"),re&&(y.eventNames().length?y.emit("error",re):c.handleError(re))},L=e._onkeystatuseschange=function(F){var N=e.mediaKeysSession;if(!N){y.emit("error",new Error("invalid state"));return}var B=c.getKeyStatuses(e),re=Object.keys(B);if(re.some(function(be){return B[be]!=="status-pending"})){if(B[m]==="expired"){c.log("Expired key "+ur(B)+' in key-session "'+e.mediaKeysSession.sessionId+'"'),c.renewKeySession(e);return}var ce=B[m];if(ce)S(ce,e);else{var Se,Ke=1e3;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(Se=e.keyStatusTimeouts)[m]||(Se[m]=self.setTimeout(function(){if(!(!e.mediaKeysSession||!c.mediaKeys)){var be=c.getKeyStatus(e.decryptdata);if(be&&be!=="status-pending")return c.log("No status for keyId "+m+' in key-session "'+e.mediaKeysSession.sessionId+'". Using session key-status '+be+" from other session."),S(be,e);c.log("key status for "+m+' in key-session "'+e.mediaKeysSession.sessionId+'" timed out after '+Ke+"ms"),ce="internal-error",S(ce,e)}},Ke)),c.log("No status for keyId "+m+" ("+ur(B)+").")}}};Ea(e.mediaKeysSession,"message",b),Ea(e.mediaKeysSession,"keystatuseschange",L);var C=new Promise(function(F,N){y.on("error",N),y.on("resolved",F)});return e.mediaKeysSession.generateRequest(t,a).then(function(){c.log('Request generated for key-session "'+e.mediaKeysSession.sessionId+'" keyId: '+m+" URI: "+g)}).catch(function(F){throw new Oi({type:ut.KEY_SYSTEM_ERROR,details:Q.KEY_SYSTEM_NO_SESSION,error:F,decryptdata:e.decryptdata,fatal:!1},"Error generating key-session request: "+F)}).then(function(){return C}).catch(function(F){return y.removeAllListeners(),c.removeSession(e).then(function(){throw F})}).then(function(){return y.removeAllListeners(),e})},n.getKeyStatuses=function(e){var t=this,a={};return e.mediaKeysSession.keyStatuses.forEach(function(o,d){if(typeof d=="string"&&typeof o=="object"){var c=d;d=o,o=c}var f="buffer"in d?new Uint8Array(d.buffer,d.byteOffset,d.byteLength):new Uint8Array(d);if(e.keySystem===$.PLAYREADY&&f.length===16){var v=Ut(f);a[v]=o,x(f)}var m=Ut(f);o==="internal-error"&&(t.bannedKeyIds[m]=o),t.log('key status change "'+o+'" for keyStatuses keyId: '+m+' key-session "'+e.mediaKeysSession.sessionId+'"'),a[m]=o}),a},n.fetchServerCertificate=function(e){var t=this.config,a=t.loader,o=new a(t),d=this.getServerCertificateUrl(e);return d?(this.log('Fetching server certificate for "'+e+'"'),new Promise(function(c,f){var v={responseType:"arraybuffer",url:d},m=t.certLoadPolicy.default,g={loadPolicy:m,timeout:m.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},y={onSuccess:function(S,L,C,F){c(S.data)},onError:function(S,L,C,F){f(new Oi({type:ut.KEY_SYSTEM_ERROR,details:Q.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:C,response:j({url:v.url,data:void 0},S)},'"'+e+'" certificate request failed ('+d+"). Status: "+S.code+" ("+S.text+")"))},onTimeout:function(S,L,C){f(new Oi({type:ut.KEY_SYSTEM_ERROR,details:Q.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:C,response:{url:v.url,data:void 0}},'"'+e+'" certificate request timed out ('+d+")"))},onAbort:function(S,L,C){f(new Error("aborted"))}};o.load(v,g,y)})):Promise.resolve()},n.setMediaKeysServerCertificate=function(e,t,a){var o=this;return new Promise(function(d,c){e.setServerCertificate(a).then(function(f){o.log("setServerCertificate "+(f?"success":"not supported by CDM")+" ("+a.byteLength+') on "'+t+'"'),d(e)}).catch(function(f){c(new Oi({type:ut.KEY_SYSTEM_ERROR,details:Q.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:f,fatal:!0},f.message))})})},n.renewLicense=function(e,t){var a=this;return this.requestLicense(e,new Uint8Array(t)).then(function(o){return a.updateKeySession(e,new Uint8Array(o)).catch(function(d){throw new Oi({type:ut.KEY_SYSTEM_ERROR,details:Q.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:d,fatal:!1},d.message)})})},n.unpackPlayReadyKeyMessage=function(e,t){var a=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!a.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;var o=new DOMParser().parseFromString(a,"application/xml"),d=o.querySelectorAll("HttpHeader");if(d.length>0)for(var c,f=0,v=d.length;f<v;f++){var m,g;c=d[f];var y=(m=c.querySelector("name"))==null?void 0:m.textContent,b=(g=c.querySelector("value"))==null?void 0:g.textContent;y&&b&&e.setRequestHeader(y,b)}var S=o.querySelector("Challenge"),L=S==null?void 0:S.textContent;if(!L)throw new Error("Cannot find <Challenge> in key message");return A(atob(L))},n.setupLicenseXHR=function(e,t,a,o){var d=this,c=this.config.licenseXhrSetup;return c?Promise.resolve().then(function(){if(!a.decryptdata)throw new Error("Key removed");return c.call(d.hls,e,t,a,o)}).catch(function(f){if(!a.decryptdata)throw f;return e.open("POST",t,!0),c.call(d.hls,e,t,a,o)}).then(function(f){e.readyState||e.open("POST",t,!0);var v=f||o;return{xhr:e,licenseChallenge:v}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:o}))},n.requestLicense=function(e,t){var a=this,o=this.config.keyLoadPolicy.default;return new Promise(function(d,c){var f=a.getLicenseServerUrlOrThrow(e.keySystem);a.log("Sending license request to URL: "+f);var v=new XMLHttpRequest;v.responseType="arraybuffer",v.onreadystatechange=function(){if(!a.hls||!e.mediaKeysSession)return c(new Error("invalid state"));if(v.readyState===4)if(v.status===200){a._requestLicenseFailureCount=0;var m=v.response;a.log("License received "+(m instanceof ArrayBuffer?m.byteLength:m));var g=a.config.licenseResponseCallback;if(g)try{m=g.call(a.hls,v,f,e)}catch(L){a.error(L)}d(m)}else{var y=o.errorRetry,b=y?y.maxNumRetry:0;if(a._requestLicenseFailureCount++,a._requestLicenseFailureCount>b||v.status>=400&&v.status<500)c(new Oi({type:ut.KEY_SYSTEM_ERROR,details:Q.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:v,response:{url:f,data:void 0,code:v.status,text:v.statusText}},"License Request XHR failed ("+f+"). Status: "+v.status+" ("+v.statusText+")"));else{var S=b-a._requestLicenseFailureCount+1;a.warn("Retrying license request, "+S+" attempts left"),a.requestLicense(e,t).then(d,c)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=v,a.setupLicenseXHR(v,f,e,t).then(function(m){var g=m.xhr,y=m.licenseChallenge;e.keySystem==$.PLAYREADY&&(y=a.unpackPlayReadyKeyMessage(g,y)),g.send(y)}).catch(c)})},n.onDestroying=function(){this.unregisterListeners(),this._clear()},n.onMediaAttached=function(e,t){if(this.config.emeEnabled){var a=t.media;this.media=a,Ea(a,"encrypted",this.onMediaEncrypted),Ea(a,"waitingforkey",this.onWaitingForKey);var o=this.mediaResolved;o?o():this.mediaKeys=a.mediaKeys}},n.onMediaDetached=function(){var e=this.media;e&&(Ia(e,"encrypted",this.onMediaEncrypted),Ia(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)},n._clear=function(){var e=this,t;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};var a=this.mediaResolved;if(a&&a(),!(!this.mediaKeys&&!this.mediaKeySessions.length)){var o=this.media,d=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Or.clearKeyUriToKeyIdMap();var c=d.length;l.CDMCleanupPromise=Promise.all(d.map(function(f){return e.removeSession(f)}).concat((o==null||(t=o.setMediaKeys(null))==null?void 0:t.catch(function(f){e.log("Could not clear media keys: "+f),e.hls&&e.hls.trigger(_.ERROR,{type:ut.OTHER_ERROR,details:Q.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error("Could not clear media keys: "+f)})}))||Promise.resolve())).catch(function(f){e.log("Could not close sessions and clear media keys: "+f),e.hls&&e.hls.trigger(_.ERROR,{type:ut.OTHER_ERROR,details:Q.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error("Could not close sessions and clear media keys: "+f)})}).then(function(){c&&e.log("finished closing key sessions and clearing media keys")})}},n.onManifestLoading=function(){this._clear()},n.onManifestLoaded=function(e,t){var a=t.sessionKeys;if(!(!a||!this.config.emeEnabled)&&!this.keyFormatPromise){var o=a.reduce(function(d,c){return d.indexOf(c.keyFormat)===-1&&d.push(c.keyFormat),d},[]);this.log("Selecting key-system from session-keys "+o.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(o)}},n.removeSession=function(e){var t=this,a=e.mediaKeysSession,o=e.licenseXhr,d=e.decryptdata;if(a){this.log('Remove licenses and keys and close session "'+a.sessionId+'" keyId: '+Ut((d==null?void 0:d.keyId)||[])),e._onmessage&&(a.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(a.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),o&&o.readyState!==XMLHttpRequest.DONE&&o.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var c=this.mediaKeySessions.indexOf(e);c>-1&&this.mediaKeySessions.splice(c,1);var f=e.keyStatusTimeouts;f&&Object.keys(f).forEach(function(g){return self.clearTimeout(f[g])});var v=this.config.drmSystemOptions,m=bt(v)?new Promise(function(g,y){self.setTimeout(function(){return y(new Error("MediaKeySession.remove() timeout"))},8e3),a.remove().then(g).catch(y)}):Promise.resolve();return m.catch(function(g){t.log("Could not remove session: "+g),t.hls&&t.hls.trigger(_.ERROR,{type:ut.OTHER_ERROR,details:Q.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error("Could not remove session: "+g)})}).then(function(){return a.close()}).catch(function(g){t.log("Could not close session: "+g),t.hls&&t.hls.trigger(_.ERROR,{type:ut.OTHER_ERROR,details:Q.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error("Could not close session: "+g)})})}return Promise.resolve()},l}(Te);_f.CDMCleanupPromise=void 0;function hd(s){if(!s)throw new Error("Could not read keyId of undefined decryptdata");if(s.keyId===null)throw new Error("keyId is null");return Ut(s.keyId)}function Af(s,l){if(s.keyId&&l.mediaKeysSession.keyStatuses.has(s.keyId))return l.mediaKeysSession.keyStatuses.get(s.keyId);if(s.matches(l.decryptdata))return l.keyStatus}var Oi=function(s){function l(n,r){var e;return e=s.call(this,r)||this,e.data=void 0,n.error||(n.error=new Error(r)),e.data=n,n.err=n.error,e}return Pe(l,s),l}(Et(Error));function Ns(s,l){var n=s==="output-restricted",r=n?Q.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:Q.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Oi({type:ut.KEY_SYSTEM_ERROR,details:r,fatal:!1,decryptdata:l},n?"HDCP level output restricted":'key status changed to "'+s+'"')}var es=function(){function s(n){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=n,this.registerListeners()}var l=s.prototype;return l.setStreamController=function(r){this.streamController=r},l.registerListeners=function(){this.hls.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(_.MEDIA_DETACHING,this.onMediaDetaching,this)},l.unregisterListeners=function(){this.hls.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(_.MEDIA_DETACHING,this.onMediaDetaching,this)},l.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},l.onMediaAttaching=function(r,e){var t=this.hls.config;if(t.capLevelOnFPSDrop){var a=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=a,a&&typeof a.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),t.fpsDroppedMonitoringPeriod)}},l.onMediaDetaching=function(){this.media=null},l.checkFPS=function(r,e,t){var a=performance.now();if(e){if(this.lastTime){var o=a-this.lastTime,d=t-this.lastDroppedFrames,c=e-this.lastDecodedFrames,f=1e3*d/o,v=this.hls;if(v.trigger(_.FPS_DROP,{currentDropped:d,currentDecoded:c,totalDroppedFrames:t}),f>0&&d>v.config.fpsDroppedMonitoringThreshold*c){var m=v.currentLevel;v.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+m),m>0&&(v.autoLevelCapping===-1||v.autoLevelCapping>=m)&&(m=m-1,v.trigger(_.FPS_DROP_LEVEL_CAPPING,{level:m,droppedLevel:v.currentLevel}),v.autoLevelCapping=m,this.streamController.nextLevelSwitch())}}this.lastTime=a,this.lastDroppedFrames=t,this.lastDecodedFrames=e}},l.checkFPSInterval=function(){var r=this.media;if(r)if(this.isVideoPlaybackQualityAvailable){var e=r.getVideoPlaybackQuality();this.checkFPS(r,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(r,r.webkitDecodedFrameCount,r.webkitDroppedFrameCount)},s}();function fd(s){for(var l=5381,n=s.length;n;)l=l*33^s.charCodeAt(--n);return(l>>>0).toString()}var Us=.025,Wl=function(s){return s[s.Point=0]="Point",s[s.Range=1]="Range",s}({});function Ru(s,l,n){return s.identifier+"-"+(n+1)+"-"+fd(l)}var vd=function(){function s(n,r){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=r,this.dateRange=n,this.setDateRange(n)}var l=s.prototype;return l.setDateRange=function(r){this.dateRange=r,this.resumeOffset=r.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=r.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=r.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=r.attr.enumeratedStringList("X-SNAP",this.snapOptions)},l.reset=function(){var r;this.appendInPlaceStarted=!1,(r=this.assetListLoader)==null||r.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)},l.isAssetPastPlayoutLimit=function(r){var e;if(r>0&&r>=this.assetList.length)return!0;var t=this.playoutLimit;if(r<=0||isNaN(t))return!1;if(t===0)return!0;var a=((e=this.assetList[r])==null?void 0:e.startOffset)||0;return a>t},l.findAssetIndex=function(r){var e=this.assetList.indexOf(r);return e},l.toString=function(){return Du(this)},Ne(s,[{key:"identifier",get:function(){return this.dateRange.id}},{key:"startDate",get:function(){return this.dateRange.startDate}},{key:"startTime",get:function(){var r=this.dateRange.startTime;if(this.snapOptions.out){var e=this.dateRange.tagAnchor;if(e)return wu(r,e)}return r}},{key:"startOffset",get:function(){return this.cue.pre?0:this.startTime}},{key:"startIsAligned",get:function(){if(this.startTime===0||this.snapOptions.out)return!0;var r=this.dateRange.tagAnchor;if(r){var e=this.dateRange.startTime,t=wu(e,r);return e-t<.1}return!1}},{key:"resumptionOffset",get:function(){var r=this.resumeOffset,e=Ge(r)?r:this.duration;return this.cumulativeDuration+e}},{key:"resumeTime",get:function(){var r=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){var e=this.resumeAnchor;if(e)return wu(r,e)}return r}},{key:"appendInPlace",get:function(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<Us))},set:function(r){if(this.appendInPlaceStarted){this.resetOnResume=!r;return}this.appendInPlaceDisabled=!r}},{key:"timelineStart",get:function(){return this._timelineStart!==null?this._timelineStart:this.startTime},set:function(r){this._timelineStart=r}},{key:"duration",get:function(){var r=this.playoutLimit,e;return this._duration!==null?e=this._duration:this.dateRange.duration?e=this.dateRange.duration:e=this.dateRange.plannedDuration||0,!isNaN(r)&&r<e&&(e=r),e},set:function(r){this._duration=r}},{key:"cue",get:function(){return this.dateRange.cue}},{key:"timelineOccupancy",get:function(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Wl.Range:Wl.Point}},{key:"supplementsPrimary",get:function(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}},{key:"contentMayVary",get:function(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}},{key:"assetUrl",get:function(){return this.dateRange.attr["X-ASSET-URI"]}},{key:"assetListUrl",get:function(){return this.dateRange.attr["X-ASSET-LIST"]}},{key:"baseUrl",get:function(){return this.base.url}},{key:"assetListLoaded",get:function(){return this.assetList.length>0||this.assetListResponse!==null}}])}();function wu(s,l){return s-l.start<l.duration/2&&!(Math.abs(s-(l.start+l.duration))<Us)?l.start:l.start+l.duration}function md(s,l,n){var r=new self.URL(s,n);return r.protocol!=="data:"&&r.searchParams.set("_HLS_primary_id",l),r}function Cu(s,l){for(;(n=s.assetList[++l])!=null&&n.error;)var n;return l}function Du(s){return'["'+s.identifier+'" '+(s.cue.pre?"<pre>":s.cue.post?"<post>":"")+s.timelineStart.toFixed(2)+"-"+s.resumeTime.toFixed(2)+"]"}function ms(s){var l=s.timelineStart,n=s.duration||0;return'["'+s.identifier+'" '+l.toFixed(2)+"-"+(l+n).toFixed(2)+"]"}var Qd=function(){function s(n,r,e,t){var a=this;this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=function(){a.reachedPlayout(a.currentTime)&&a.hls&&a.hls.trigger(_.PLAYOUT_LIMIT_REACHED,{})};var o=this.hls=new n(r);this.interstitial=e,this.assetItem=t;var d=function(){a.hasDetails=!0};o.once(_.LEVEL_LOADED,d),o.once(_.AUDIO_TRACK_LOADED,d),o.once(_.SUBTITLE_TRACK_LOADED,d),o.on(_.MEDIA_ATTACHING,function(c,f){var v=f.media;a.removeMediaListeners(),a.mediaAttached=v;var m=a.interstitial;m.playoutLimit&&(v.addEventListener("timeupdate",a.checkPlayout),a.appendInPlace&&o.on(_.BUFFER_APPENDED,function(){var g=a.bufferedEnd;a.reachedPlayout(g)&&(a._bufferedEosTime=g,o.trigger(_.BUFFERED_TO_END,void 0))}))})}var l=s.prototype;return l.loadSource=function(){var r=this.hls;if(r)if(r.url)r.levels.length&&!r.started&&r.startLoad(-1,!0);else{var e=this.assetItem.uri;try{e=md(e,r.config.primarySessionId||"").href}catch(t){}r.loadSource(e)}},l.bufferedInPlaceToEnd=function(r){var e;if(!this.appendInPlace)return!1;if((e=this.hls)!=null&&e.bufferedToEnd)return!0;if(!r)return!1;var t=Math.min(this._bufferedEosTime||1/0,this.duration),a=this.timelineOffset,o=Pr.bufferInfo(r,a,0),d=this.getAssetTime(o.end);return d>=t-.02},l.reachedPlayout=function(r){var e=this.interstitial,t=e.playoutLimit;return this.startOffset+r>=t},l.getAssetTime=function(r){var e=this.timelineOffset,t=this.duration;return Math.min(Math.max(0,r-e),t)},l.removeMediaListeners=function(){var r=this.mediaAttached;r&&(this._currentTime=r.currentTime,this.bufferSnapShot(),r.removeEventListener("timeupdate",this.checkPlayout))},l.bufferSnapShot=function(){if(this.mediaAttached){var r;(r=this.hls)!=null&&r.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}},l.destroy=function(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null},l.attachMedia=function(r){var e;this.loadSource(),(e=this.hls)==null||e.attachMedia(r)},l.detachMedia=function(){var r;this.removeMediaListeners(),this.mediaAttached=null,(r=this.hls)==null||r.detachMedia()},l.resumeBuffering=function(){var r;(r=this.hls)==null||r.resumeBuffering()},l.pauseBuffering=function(){var r;(r=this.hls)==null||r.pauseBuffering()},l.transferMedia=function(){var r;return this.bufferSnapShot(),((r=this.hls)==null?void 0:r.transferMedia())||null},l.resetDetails=function(){var r=this.hls;if(r&&this.hasDetails){r.stopLoad();var e=function(a){return delete a.details};r.levels.forEach(e),r.allAudioTracks.forEach(e),r.allSubtitleTracks.forEach(e),this.hasDetails=!1}},l.on=function(r,e,t){var a;(a=this.hls)==null||a.on(r,e)},l.once=function(r,e,t){var a;(a=this.hls)==null||a.once(r,e)},l.off=function(r,e,t){var a;(a=this.hls)==null||a.off(r,e)},l.toString=function(){var r;return"HlsAssetPlayer: "+ms(this.assetItem)+" "+((r=this.hls)==null?void 0:r.sessionId)+" "+(this.appendInPlace?"append-in-place":"")},Ne(s,[{key:"appendInPlace",get:function(){return this.interstitial.appendInPlace}},{key:"destroyed",get:function(){var r;return!((r=this.hls)!=null&&r.userConfig)}},{key:"assetId",get:function(){return this.assetItem.identifier}},{key:"interstitialId",get:function(){return this.assetItem.parentIdentifier}},{key:"media",get:function(){var r;return((r=this.hls)==null?void 0:r.media)||null}},{key:"bufferedEnd",get:function(){var r=this.media||this.mediaAttached;if(!r)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;var e=Pr.bufferInfo(r,r.currentTime,.001);return this.getAssetTime(e.end)}},{key:"currentTime",get:function(){var r=this.media||this.mediaAttached;return r?this.getAssetTime(r.currentTime):this._currentTime||0}},{key:"duration",get:function(){var r=this.assetItem.duration;if(!r)return 0;var e=this.interstitial.playoutLimit;if(e){var t=e-this.startOffset;if(t>0&&t<r)return t}return r}},{key:"remaining",get:function(){var r=this.duration;return r?Math.max(0,r-this.currentTime):0}},{key:"startOffset",get:function(){return this.assetItem.startOffset}},{key:"timelineOffset",get:function(){var r;return((r=this.hls)==null?void 0:r.config.timelineOffset)||0},set:function(r){var e=this.timelineOffset;if(r!==e){var t=r-e;if(Math.abs(t)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=r}}}}])}(),Sf=.033,Xc=function(s){function l(r,e){var t;return t=s.call(this,"interstitials-sched",e)||this,t.onScheduleUpdate=void 0,t.eventMap={},t.events=null,t.items=null,t.durations={primary:0,playout:0,integrated:0},t.onScheduleUpdate=r,t}Pe(l,s);var n=l.prototype;return n.destroy=function(){this.reset(),this.onScheduleUpdate=null},n.reset=function(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(function(e){return e.reset()}),this.events=this.items=null},n.resetErrorsInRange=function(e,t){return this.events?this.events.reduce(function(a,o){return e<=o.startOffset&&t>o.startOffset?(delete o.error,a+1):a},0):0},n.getEvent=function(e){return e&&this.eventMap[e]||null},n.hasEvent=function(e){return e in this.eventMap},n.findItemIndex=function(e,t){if(e.event)return this.findEventIndex(e.event.identifier);var a=-1;e.nextEvent?a=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(a=this.findEventIndex(e.previousEvent.identifier)+1);var o=this.items;if(o)for(o[a]||(t===void 0&&(t=e.start),a=this.findItemIndexAtTime(t));a>=0&&(d=o[a])!=null&&d.event;){var d;a--}return a},n.findItemIndexAtTime=function(e,t){var a=this.items;if(a)for(var o=0;o<a.length;o++){var d=a[o];if(t&&t!=="primary"&&(d=d[t]),e===d.start||e>d.start&&e<d.end)return o}return-1},n.findJumpRestrictedIndex=function(e,t){var a=this.items;if(a)for(var o=e;o<=t&&a[o];o++){var d=a[o].event;if(d!=null&&d.restrictions.jump&&!d.appendInPlace)return o}return-1},n.findEventIndex=function(e){var t=this.items;if(t)for(var a=t.length;a--;){var o;if(((o=t[a].event)==null?void 0:o.identifier)===e)return a}return-1},n.findAssetIndex=function(e,t){var a=e.assetList,o=a.length;if(o>1)for(var d=0;d<o;d++){var c=a[d];if(!c.error){var f=c.timelineStart;if(t===f||t>f&&(t<f+(c.duration||0)||d===o-1))return d}}return 0},n.parseInterstitialDateRanges=function(e,t){var a=this,o=e.main.details,d=o.dateRanges,c=this.events,f=this.parseDateRanges(d,{url:o.url},t),v=Object.keys(d),m=c?c.filter(function(g){return!v.includes(g.identifier)}):[];f.length&&f.sort(function(g,y){var b=g.cue.pre,S=g.cue.post,L=y.cue.pre,C=y.cue.post;if(b&&!L)return-1;if(L&&!b||S&&!C)return 1;if(C&&!S)return-1;if(!b&&!L&&!S&&!C){var F=g.startTime,N=y.startTime;if(F!==N)return F-N}return g.dateRange.tagOrder-y.dateRange.tagOrder}),this.events=f,m.forEach(function(g){a.removeEvent(g)}),this.updateSchedule(e,m)},n.updateSchedule=function(e,t,a){t===void 0&&(t=[]),a===void 0&&(a=!1);var o=this.events||[];if(o.length||t.length||this.length<2){var d=this.items,c=this.parseSchedule(o,e),f=a||t.length||(d==null?void 0:d.length)!==c.length||c.some(function(v,m){return Math.abs(v.playout.start-d[m].playout.start)>.005||Math.abs(v.playout.end-d[m].playout.end)>.005});f&&(this.items=c,this.onScheduleUpdate(t,d))}},n.parseDateRanges=function(e,t,a){for(var o=[],d=Object.keys(e),c=0;c<d.length;c++){var f=d[c],v=e[f];if(v.isInterstitial){var m=this.eventMap[f];m?m.setDateRange(v):(m=new vd(v,t),this.eventMap[f]=m,a===!1&&(m.appendInPlace=a)),o.push(m)}}return o},n.parseSchedule=function(e,t){var a=[],o=t.main.details,d=o.live?1/0:o.edge,c=0;if(e=e.filter(function(C){return!C.error&&!(C.cue.once&&C.hasPlayed)}),e.length){this.resolveOffsets(e,t);var f=0,v=0;if(e.forEach(function(C,F){var N=C.cue.pre,B=C.cue.post,re=e[F-1]||null,ce=C.appendInPlace,Se=B?d:C.startOffset,Ke=C.duration,be=C.timelineOccupancy===Wl.Range?Ke:0,Z=C.resumptionOffset,ne=(re==null?void 0:re.startTime)===Se,Re=Se+C.cumulativeDuration,Tt=ce?Re+Ke:Se+Z;if(N||!B&&Se<=0){var ot=v;v+=be,C.timelineStart=Re;var pt=c;c+=Ke,a.push({event:C,start:Re,end:Tt,playout:{start:pt,end:c},integrated:{start:ot,end:v}})}else if(Se<=d){if(!ne){var Bt=Se-f;if(Bt>Sf){var cr=f,or=v;v+=Bt;var hr=c;c+=Bt;var xr={previousEvent:e[F-1]||null,nextEvent:C,start:cr,end:cr+Bt,playout:{start:hr,end:c},integrated:{start:or,end:v}};a.push(xr)}else Bt>0&&re&&(re.cumulativeDuration+=Bt,a[a.length-1].end=Se)}B&&(Tt=Re),C.timelineStart=Re;var fr=v;v+=be;var lr=c;c+=Ke,a.push({event:C,start:Re,end:Tt,playout:{start:lr,end:c},integrated:{start:fr,end:v}})}else return;var _r=C.resumeTime;B||_r>d?f=d:f=_r}),f<d){var m,g=f,y=v,b=d-f;v+=b;var S=c;c+=b,a.push({previousEvent:((m=a[a.length-1])==null?void 0:m.event)||null,nextEvent:null,start:f,end:g+b,playout:{start:S,end:c},integrated:{start:y,end:v}})}this.setDurations(d,c,v)}else{var L=0;a.push({previousEvent:null,nextEvent:null,start:L,end:d,playout:{start:L,end:d},integrated:{start:L,end:d}}),this.setDurations(d,d,d)}return a},n.setDurations=function(e,t,a){this.durations={primary:e,playout:t,integrated:a}},n.resolveOffsets=function(e,t){var a=this,o=t.main.details,d=o.live?1/0:o.edge,c=0,f=-1;e.forEach(function(v,m){var g=v.cue.pre,y=v.cue.post,b=g?0:y?d:v.startTime;a.updateAssetDurations(v);var S=f===b;if(S?v.cumulativeDuration=c:(c=0,f=b),!y&&v.snapOptions.in&&(v.resumeAnchor=Za(null,o.fragments,v.startOffset+v.resumptionOffset,0,0)||void 0),v.appendInPlace&&!v.appendInPlaceStarted){var L=a.primaryCanResumeInPlaceAt(v,t);L||(v.appendInPlace=!1)}if(!v.appendInPlace&&m+1<e.length){var C=e[m+1].startTime-e[m].resumeTime;C<Sf&&(e[m+1].appendInPlace=!1,e[m+1].appendInPlace&&a.warn("Could not change append strategy for abutting event "+v))}var F=Ge(v.resumeOffset)?v.resumeOffset:v.duration;c+=F})},n.primaryCanResumeInPlaceAt=function(e,t){var a=this,o=e.resumeTime,d=e.startTime+e.resumptionOffset;if(Math.abs(o-d)>Us)return this.log('"'+e.identifier+'" resumption '+o+" not aligned with estimated timeline end "+d),!1;var c=Object.keys(t);return!c.some(function(f){var v=t[f].details,m=v.edge;if(o>=m)return a.log('"'+e.identifier+'" resumption '+o+" past "+f+" playlist end "+m),!1;var g=Za(null,v.fragments,o);if(!g)return a.log('"'+e.identifier+'" resumption '+o+" does not align with any fragments in "+f+" playlist ("+v.fragStart+"-"+v.fragmentEnd+")"),!0;var y=f==="audio"?.175:0,b=Math.abs(g.start-o)<Us+y||Math.abs(g.end-o)<Us+y;return b?!1:(a.log('"'+e.identifier+'" resumption '+o+" not aligned with "+f+" fragment bounds ("+g.start+"-"+g.end+" sn: "+g.sn+" cc: "+g.cc+")"),!0)})},n.updateAssetDurations=function(e){if(e.assetListLoaded){for(var t=e.timelineStart,a=0,o=!1,d=!1,c=0;c<e.assetList.length;c++){var f=e.assetList[c],v=t+a;f.startOffset=a,f.timelineStart=v,o||(o=f.duration===null),d||(d=!!f.error);var m=f.error?0:f.duration||0;a+=m}o&&!d?e.duration=Math.max(a,e.duration):e.duration=a}},n.removeEvent=function(e){e.reset(),delete this.eventMap[e.identifier]},Ne(l,[{key:"duration",get:function(){var e=this.items;return e?e[e.length-1].end:0}},{key:"length",get:function(){return this.items?this.items.length:0}},{key:"assetIdAtEnd",get:function(){var e,t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){var a=t.assetList,o=a[a.length-1];if(o)return o.identifier}return null}}])}(Te);function Pi(s){return"["+(s.event?'"'+s.event.identifier+'"':"primary")+": "+s.start.toFixed(2)+"-"+s.end.toFixed(2)+"]"}var wa=function(){function s(n){this.hls=void 0,this.hls=n}var l=s.prototype;return l.destroy=function(){this.hls=null},l.loadAssetList=function(r,e){var t=this,a=r.assetListUrl,o;try{o=md(a,this.hls.sessionId,r.baseUrl)}catch(S){var d=this.assignAssetListError(r,Q.ASSET_LIST_LOAD_ERROR,S,a);this.hls.trigger(_.ERROR,d);return}e&&o.protocol!=="data:"&&o.searchParams.set("_HLS_start_offset",""+e);var c=this.hls.config,f=c.loader,v=new f(c),m={responseType:"json",url:o.href},g=c.interstitialAssetListLoadPolicy.default,y={loadPolicy:g,timeout:g.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},b={onSuccess:function(L,C,F,N){var B=L.data,re=B==null?void 0:B.ASSETS;if(!Array.isArray(re)){var ce=t.assignAssetListError(r,Q.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),F.url,C,N);t.hls.trigger(_.ERROR,ce);return}r.assetListResponse=B,t.hls.trigger(_.ASSET_LIST_LOADED,{event:r,assetListResponse:B,networkDetails:N})},onError:function(L,C,F,N){var B=t.assignAssetListError(r,Q.ASSET_LIST_LOAD_ERROR,new Error("Error loading X-ASSET-LIST: HTTP status "+L.code+" "+L.text+" ("+C.url+")"),C.url,N,F);t.hls.trigger(_.ERROR,B)},onTimeout:function(L,C,F){var N=t.assignAssetListError(r,Q.ASSET_LIST_LOAD_TIMEOUT,new Error("Timeout loading X-ASSET-LIST ("+C.url+")"),C.url,L,F);t.hls.trigger(_.ERROR,N)}};return v.load(m,y,b),this.hls.trigger(_.ASSET_LIST_LOADING,{event:r}),v},l.assignAssetListError=function(r,e,t,a,o,d){return r.error=t,{type:ut.NETWORK_ERROR,details:e,fatal:!1,interstitial:r,url:a,error:t,networkDetails:d,stats:o}},s}();function ts(s){var l;s==null||(l=s.play())==null||l.catch(function(){})}function Ca(s,l){return"["+s+"] Advancing timeline position to "+l}var Mu=function(s){function l(r,e){var t;return t=s.call(this,"interstitials",r.logger)||this,t.HlsPlayerClass=void 0,t.hls=void 0,t.assetListLoader=void 0,t.mediaSelection=null,t.altSelection=null,t.media=null,t.detachedData=null,t.requiredTracks=null,t.manager=null,t.playerQueue=[],t.bufferedPos=-1,t.timelinePos=-1,t.schedule=void 0,t.playingItem=null,t.bufferingItem=null,t.waitingItem=null,t.endedItem=null,t.playingAsset=null,t.endedAsset=null,t.bufferingAsset=null,t.shouldPlay=!1,t.onPlay=function(){t.shouldPlay=!0},t.onPause=function(){t.shouldPlay=!1},t.onSeeking=function(){var a=t.currentTime;if(!(a===void 0||t.playbackDisabled||!t.schedule)){var o=a-t.timelinePos,d=Math.abs(o)<1/7056e5;if(!d){var c=o<=-.01;t.timelinePos=a,t.bufferedPos=a;var f=t.playingItem;if(!f){t.checkBuffer();return}if(c){var v=t.schedule.resetErrorsInRange(a,a-o);v&&t.updateSchedule(!0)}if(t.checkBuffer(),c&&a<f.start||a>=f.end){var m,g=t.findItemIndex(f),y=t.schedule.findItemIndexAtTime(a);if(y===-1&&(y=g+(c?-1:1),t.log("seeked "+(c?"back ":"")+"to position not covered by schedule "+a+" (resolving from "+g+" to "+y+")")),!t.isInterstitial(f)&&(m=t.media)!=null&&m.paused&&(t.shouldPlay=!1),!c&&y>g){var b=t.schedule.findJumpRestrictedIndex(g+1,y);if(b>g){t.setSchedulePosition(b);return}}t.setSchedulePosition(y);return}var S=t.playingAsset;if(!S){if(t.playingLastItem&&t.isInterstitial(f)){var L=f.event.assetList[0];L&&(t.endedItem=t.playingItem,t.playingItem=null,t.setScheduleToAssetAtTime(a,L))}return}var C=S.timelineStart,F=S.duration||0;if(c&&a<C||a>=C+F){var N;(N=f.event)!=null&&N.appendInPlace&&(t.clearAssetPlayers(f.event,f),t.flushFrontBuffer(a)),t.setScheduleToAssetAtTime(a,S)}}}},t.onTimeupdate=function(){var a=t.currentTime;if(!(a===void 0||t.playbackDisabled)){if(a>t.timelinePos)t.timelinePos=a,a>t.bufferedPos&&t.checkBuffer();else return;var o=t.playingItem;if(!(!o||t.playingLastItem)){if(a>=o.end){t.timelinePos=o.end;var d=t.findItemIndex(o);t.setSchedulePosition(d+1)}var c=t.playingAsset;if(c){var f=c.timelineStart+(c.duration||0);a>=f&&t.setScheduleToAssetAtTime(a,c)}}}},t.onScheduleUpdate=function(a,o){var d=t.schedule;if(d){var c=t.playingItem,f=d.events||[],v=d.items||[],m=d.durations,g=a.map(function(C){return C.identifier}),y=!!(f.length||g.length);(y||o)&&t.log("INTERSTITIALS_UPDATED ("+f.length+"): "+f+`
Schedule: `+v.map(function(C){return Pi(C)})+" pos: "+t.timelinePos),g.length&&t.log("Removed events "+g);var b=null,S=null;c&&(b=t.updateItem(c,t.timelinePos),t.itemsMatch(c,b)?t.playingItem=b:t.waitingItem=t.endedItem=null),t.waitingItem=t.updateItem(t.waitingItem),t.endedItem=t.updateItem(t.endedItem);var L=t.bufferingItem;if(L&&(S=t.updateItem(L,t.bufferedPos),t.itemsMatch(L,S)?t.bufferingItem=S:L.event&&(t.bufferingItem=t.playingItem,t.clearInterstitial(L.event,null))),a.forEach(function(C){C.assetList.forEach(function(F){t.clearAssetPlayer(F.identifier,null)})}),t.playerQueue.forEach(function(C){if(C.interstitial.appendInPlace){var F=C.assetItem.timelineStart,N=C.timelineOffset-F;if(N)try{C.timelineOffset=F}catch(B){Math.abs(N)>Us&&t.warn(B+' ("'+C.assetId+'" '+C.timelineOffset+"->"+F+")")}}}),y||o){if(t.hls.trigger(_.INTERSTITIALS_UPDATED,{events:f.slice(0),schedule:v.slice(0),durations:m,removedIds:g}),t.isInterstitial(c)&&g.includes(c.event.identifier)){t.warn('Interstitial "'+c.event.identifier+'" removed while playing'),t.primaryFallback(c.event);return}c&&t.trimInPlace(b,c),L&&S!==b&&t.trimInPlace(S,L),t.checkBuffer()}}},t.hls=r,t.HlsPlayerClass=e,t.assetListLoader=new wa(r),t.schedule=new Xc(t.onScheduleUpdate,r.logger),t.registerListeners(),t}Pe(l,s);var n=l.prototype;return n.registerListeners=function(){var e=this.hls;e&&(e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(_.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(_.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(_.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(_.BUFFER_APPENDED,this.onBufferAppended,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(_.MEDIA_ENDED,this.onMediaEnded,this),e.on(_.ERROR,this.onError,this),e.on(_.DESTROYING,this.onDestroying,this))},n.unregisterListeners=function(){var e=this.hls;e&&(e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(_.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(_.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(_.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.BUFFER_APPENDED,this.onBufferAppended,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(_.MEDIA_ENDED,this.onMediaEnded,this),e.off(_.ERROR,this.onError,this),e.off(_.DESTROYING,this.onDestroying,this))},n.startLoad=function(){this.resumeBuffering()},n.stopLoad=function(){this.pauseBuffering()},n.resumeBuffering=function(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()},n.pauseBuffering=function(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()},n.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null},n.onDestroying=function(){var e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)},n.removeMediaListeners=function(e){Ia(e,"play",this.onPlay),Ia(e,"pause",this.onPause),Ia(e,"seeking",this.onSeeking),Ia(e,"timeupdate",this.onTimeupdate)},n.onMediaAttaching=function(e,t){var a=this.media=t.media;Ea(a,"seeking",this.onSeeking),Ea(a,"timeupdate",this.onTimeupdate),Ea(a,"play",this.onPlay),Ea(a,"pause",this.onPause)},n.onMediaAttached=function(e,t){var a=this.effectivePlayingItem,o=this.detachedData;if(this.detachedData=null,a===null)this.checkStart();else if(!o){this.clearScheduleState();var d=this.findItemIndex(a);this.setSchedulePosition(d)}},n.clearScheduleState=function(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null},n.onMediaDetaching=function(e,t){var a=!!t.transferMedia,o=this.media;if(this.media=null,!a&&(o&&this.removeMediaListeners(o),this.detachedData)){var d=this.getBufferingPlayer();d&&(this.log("Removing schedule state for detachedData and "+d),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,d.detachMedia()),this.shouldPlay=!1}},n.isInterstitial=function(e){return!!(e!=null&&e.event)},n.retreiveMediaSource=function(e,t){var a=this.getAssetPlayer(e);a&&this.transferMediaFromPlayer(a,t)},n.transferMediaFromPlayer=function(e,t){var a=e.interstitial.appendInPlace,o=e.media;if(a&&o===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&o){this.detachedData={media:o};return}var d=e.transferMedia();this.log("transfer MediaSource from "+e+" "+ur(d)),this.detachedData=d}else t&&o&&(this.shouldPlay||(this.shouldPlay=!o.paused))},n.transferMediaTo=function(e,t){var a,o=this,d;if(e.media!==t){var c=null,f=this.hls,v=e!==f,m=v&&e.interstitial.appendInPlace,g=(a=this.detachedData)==null?void 0:a.mediaSource,y;if(f.media)m&&(c=f.transferMedia(),this.detachedData=c),y="Primary";else if(g){var b=this.getBufferingPlayer();b?(c=b.transferMedia(),y=""+b):y="detached MediaSource"}else y="detached media";if(!c){if(g)c=this.detachedData,this.log("using detachedData: MediaSource "+ur(c));else if(!this.detachedData||f.media===t){var S=this.playerQueue;S.length>1&&S.forEach(function(B){if(v&&B.interstitial.appendInPlace!==m){var re=B.interstitial;o.clearInterstitial(B.interstitial,null),re.appendInPlace=!1,re.appendInPlace&&o.warn("Could not change append strategy for queued assets "+re)}}),this.hls.detachMedia(),this.detachedData={media:t}}}var L=c&&"mediaSource"in c&&((d=c.mediaSource)==null?void 0:d.readyState)!=="closed",C=L&&c?c:t;this.log((L?"transfering MediaSource":"attaching media")+" to "+(v?e:"Primary")+" from "+y+" (media.currentTime: "+t.currentTime+")");var F=this.schedule;if(C===c&&F){var N=v&&e.assetId===F.assetIdAtEnd;C.overrides={duration:F.duration,endOfStream:!v||N,cueRemoval:!v}}e.attachMedia(C)}},n.onInterstitialCueEnter=function(){this.onTimeupdate()},n.checkStart=function(){var e=this.schedule,t=e==null?void 0:e.events;if(!(!t||this.playbackDisabled||!this.media)){this.bufferedPos===-1&&(this.bufferedPos=0);var a=this.timelinePos,o=this.effectivePlayingItem;if(a===-1){var d=this.hls.startPosition;if(this.log(Ca("checkStart",d)),this.timelinePos=d,t.length&&t[0].cue.pre){var c=e.findEventIndex(t[0].identifier);this.setSchedulePosition(c)}else if(d>=0||!this.primaryLive){var f=this.timelinePos=d>0?d:0,v=e.findItemIndexAtTime(f);this.setSchedulePosition(v)}}else if(o&&!this.playingItem){var m=e.findItemIndex(o);this.setSchedulePosition(m)}}},n.advanceAssetBuffering=function(e,t){var a=e.event,o=a.findAssetIndex(t),d=Cu(a,o);if(!a.isAssetPastPlayoutLimit(d))this.bufferedToEvent(e,d);else if(this.schedule){var c,f=(c=this.schedule.items)==null?void 0:c[this.findItemIndex(e)+1];f&&this.bufferedToItem(f)}},n.advanceAfterAssetEnded=function(e,t,a){var o=Cu(e,a);if(e.isAssetPastPlayoutLimit(o)){if(this.schedule){var c=this.schedule.items;if(c){var f=t+1,v=c.length;if(f>=v){this.setSchedulePosition(-1);return}var m=e.resumeTime;this.timelinePos<m&&(this.log(Ca("advanceAfterAssetEnded",m)),this.timelinePos=m,e.appendInPlace&&this.advanceInPlace(m),this.checkBuffer(this.bufferedPos<m)),this.setSchedulePosition(f)}}}else{if(e.appendInPlace){var d=e.assetList[o];d&&this.advanceInPlace(d.timelineStart)}this.setSchedulePosition(t,o)}},n.setScheduleToAssetAtTime=function(e,t){var a=this.schedule;if(a){var o=t.parentIdentifier,d=a.getEvent(o);if(d){var c=a.findEventIndex(o),f=a.findAssetIndex(d,e);this.advanceAfterAssetEnded(d,c,f-1)}}},n.setSchedulePosition=function(e,t){var a,o=(a=this.schedule)==null?void 0:a.items;if(!(!o||this.playbackDisabled)){var d=e>=0?o[e]:null;this.log("setSchedulePosition "+e+", "+t+" ("+(d&&Pi(d))+") pos: "+this.timelinePos);var c=this.waitingItem||this.playingItem,f=this.playingLastItem;if(this.isInterstitial(c)){var v=c.event,m=this.playingAsset,g=m==null?void 0:m.identifier,y=g?this.getAssetPlayer(g):null;if(y&&g&&(!this.eventItemsMatch(c,d)||t!==void 0&&g!==v.assetList[t].identifier)){var b,S=v.findAssetIndex(m);if(this.log("INTERSTITIAL_ASSET_ENDED "+(S+1)+"/"+v.assetList.length+" "+ms(m)),this.endedAsset=m,this.playingAsset=null,this.hls.trigger(_.INTERSTITIAL_ASSET_ENDED,{asset:m,assetListIndex:S,event:v,schedule:o.slice(0),scheduleIndex:e,player:y}),c!==this.playingItem){this.itemsMatch(c,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(v,this.findItemIndex(this.playingItem),S);return}this.retreiveMediaSource(g,d),y.media&&!((b=this.detachedData)!=null&&b.mediaSource)&&y.detachMedia()}if(!this.eventItemsMatch(c,d)&&(this.endedItem=c,this.playingItem=null,this.log("INTERSTITIAL_ENDED "+v+" "+Pi(c)),v.hasPlayed=!0,this.hls.trigger(_.INTERSTITIAL_ENDED,{event:v,schedule:o.slice(0),scheduleIndex:e}),v.cue.once)){var L;this.updateSchedule();var C=(L=this.schedule)==null?void 0:L.items;if(d&&C){var F=this.findItemIndex(d);this.advanceSchedule(F,C,t,c,f)}return}}this.advanceSchedule(e,o,t,c,f)}},n.advanceSchedule=function(e,t,a,o,d){var c=this,f=this.schedule;if(f){var v=t[e]||null,m=this.primaryMedia,g=this.playerQueue;if(g.length&&g.forEach(function(N){var B=N.interstitial,re=f.findEventIndex(B.identifier);(re<e||re>e+1)&&c.clearInterstitial(B,v)}),this.isInterstitial(v)){this.timelinePos=Math.min(Math.max(this.timelinePos,v.start),v.end);var y=v.event;if(a===void 0){a=f.findAssetIndex(y,this.timelinePos);var b=Cu(y,a-1);if(y.isAssetPastPlayoutLimit(b)||y.appendInPlace&&this.timelinePos===v.end){this.advanceAfterAssetEnded(y,e,a);return}a=b}var S=this.waitingItem;this.assetsBuffered(v,m)||this.setBufferingItem(v);var L=this.preloadAssets(y,a);if(this.eventItemsMatch(v,S||o)||(this.waitingItem=v,this.log("INTERSTITIAL_STARTED "+Pi(v)+" "+(y.appendInPlace?"append in place":"")),this.hls.trigger(_.INTERSTITIAL_STARTED,{event:y,schedule:t.slice(0),scheduleIndex:e})),!y.assetListLoaded){this.log("Waiting for ASSET-LIST to complete loading "+y);return}if(y.assetListLoader&&(y.assetListLoader.destroy(),y.assetListLoader=void 0),!m){this.log("Waiting for attachMedia to start Interstitial "+y);return}this.waitingItem=this.endedItem=null,this.playingItem=v;var C=y.assetList[a];if(!C){this.advanceAfterAssetEnded(y,e,a||0);return}if(L||(L=this.getAssetPlayer(C.identifier)),L===null||L.destroyed){var F=y.assetList.length;this.warn("asset "+(a+1)+"/"+F+" player destroyed "+y),L=this.createAssetPlayer(y,C,a),L.loadSource()}if(!this.eventItemsMatch(v,this.bufferingItem)&&y.appendInPlace&&this.isAssetBuffered(C))return;this.startAssetPlayer(L,a,t,e,m),this.shouldPlay&&ts(L.media)}else v?(this.resumePrimary(v,e,o),this.shouldPlay&&ts(this.hls.media)):d&&this.isInterstitial(o)&&(this.endedItem=null,this.playingItem=o,o.event.appendInPlace||this.attachPrimary(f.durations.primary,null))}},n.resumePrimary=function(e,t,a){var o,d;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log("resuming "+Pi(e)),!((o=this.detachedData)!=null&&o.mediaSource)){var c=this.timelinePos;(c<e.start||c>=e.end)&&(c=this.getPrimaryResumption(e,t),this.log(Ca("resumePrimary",c)),this.timelinePos=c),this.attachPrimary(c,e)}if(a){var f=(d=this.schedule)==null?void 0:d.items;f&&(this.log("INTERSTITIALS_PRIMARY_RESUMED "+Pi(e)),this.hls.trigger(_.INTERSTITIALS_PRIMARY_RESUMED,{schedule:f.slice(0),scheduleIndex:t}),this.checkBuffer())}},n.getPrimaryResumption=function(e,t){var a=e.start;if(this.primaryLive){var o=this.primaryDetails;if(t===0)return this.hls.startPosition;if(o&&(a<o.fragmentStart||a>o.edge))return this.hls.liveSyncPosition||-1}return a},n.isAssetBuffered=function(e){var t=this.getAssetPlayer(e.identifier);if(t!=null&&t.hls)return t.hls.bufferedToEnd;var a=Pr.bufferInfo(this.primaryMedia,this.timelinePos,0);return a.end+1>=e.timelineStart+(e.duration||0)},n.attachPrimary=function(e,t,a){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;var o=this.primaryMedia;if(o){var d=this.hls;d.media?this.checkBuffer():(this.transferMediaTo(d,o),a&&this.startLoadingPrimaryAt(e,a)),a||(this.log(Ca("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,a))}},n.startLoadingPrimaryAt=function(e,t){var a,o=this.hls;!o.loadingEnabled||!o.media||Math.abs((((a=o.mainForwardBufferInfo)==null?void 0:a.start)||o.media.currentTime)-e)>.5?o.startLoad(e,t):o.bufferingEnabled||o.resumeBuffering()},n.onManifestLoading=function(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(_.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(_.BUFFER_CODECS,this.onBufferCodecs,this)},n.onLevelUpdated=function(e,t){if(!(t.level===-1||!this.schedule)){var a=this.hls.levels[t.level];if(a.details){var o=j(j({},this.mediaSelection||this.altSelection),{},{main:a});this.mediaSelection=o,this.schedule.parseInterstitialDateRanges(o,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}}},n.onAudioTrackUpdated=function(e,t){var a=this.hls.audioTracks[t.id],o=this.mediaSelection;if(!o){this.altSelection=j(j({},this.altSelection),{},{audio:a});return}var d=j(j({},o),{},{audio:a});this.mediaSelection=d},n.onSubtitleTrackUpdated=function(e,t){var a=this.hls.subtitleTracks[t.id],o=this.mediaSelection;if(!o){this.altSelection=j(j({},this.altSelection),{},{subtitles:a});return}var d=j(j({},o),{},{subtitles:a});this.mediaSelection=d},n.onAudioTrackSwitching=function(e,t){var a=fn(t);this.playerQueue.forEach(function(o){var d=o.hls;return d&&(d.setAudioOption(t)||d.setAudioOption(a))})},n.onSubtitleTrackSwitch=function(e,t){var a=fn(t);this.playerQueue.forEach(function(o){var d=o.hls;return d&&(d.setSubtitleOption(t)||t.id!==-1&&d.setSubtitleOption(a))})},n.onBufferCodecs=function(e,t){var a=t.tracks;a&&(this.requiredTracks=a)},n.onBufferAppended=function(e,t){this.checkBuffer()},n.onBufferFlushed=function(e,t){var a=this.playingItem;if(a&&!this.itemsMatch(a,this.bufferingItem)&&!this.isInterstitial(a)){var o=this.timelinePos;this.bufferedPos=o,this.checkBuffer()}},n.onBufferedToEnd=function(e){if(this.schedule){var t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(var a=0;a<t.length;a++){var o=t[a];if(o.cue.post){var d,c=this.schedule.findEventIndex(o.identifier),f=(d=this.schedule.items)==null?void 0:d[c];this.isInterstitial(f)&&this.eventItemsMatch(f,this.bufferingItem)&&this.bufferedToItem(f,0);break}}this.bufferedPos=Number.MAX_VALUE}}},n.onMediaEnded=function(e){var t=this.playingItem;if(!this.playingLastItem&&t){var a=this.findItemIndex(t);this.setSchedulePosition(a+1)}else this.shouldPlay=!1},n.updateItem=function(e,t){var a,o=(a=this.schedule)==null?void 0:a.items;if(e&&o){var d=this.findItemIndex(e,t);return o[d]||null}return null},n.trimInPlace=function(e,t){var a=this;if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach(function(f,v){e.event.isAssetPastPlayoutLimit(v)&&a.clearAssetPlayer(f.identifier,null)});var o=e.end+.25,d=Pr.bufferInfo(this.primaryMedia,o,0);if(d.end>o||(d.nextStart||0)>o){this.log("trim buffered interstitial "+Pi(e)+" (was "+Pi(t)+")");var c=!0;this.attachPrimary(o,null,c),this.flushFrontBuffer(o)}}},n.itemsMatch=function(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))},n.eventItemsMatch=function(e,t){var a;return!!t&&(e===t||e.event.identifier===((a=t.event)==null?void 0:a.identifier))},n.findItemIndex=function(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1},n.updateSchedule=function(e){var t;e===void 0&&(e=!1);var a=this.mediaSelection;a&&((t=this.schedule)==null||t.updateSchedule(a,[],e))},n.checkBuffer=function(e){var t,a=(t=this.schedule)==null?void 0:t.items;if(a){var o=Pr.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=o.len<1),this.updateBufferedPos(o.end,a,e)}},n.updateBufferedPos=function(e,t,a){var o=this.schedule,d=this.bufferingItem;if(!(this.bufferedPos>e||!o)){if(t.length===1&&this.itemsMatch(t[0],d)){this.bufferedPos=e;return}var c=this.playingItem,f=this.findItemIndex(c),v=o.findItemIndexAtTime(e);if(this.bufferedPos<e){var m,g=this.findItemIndex(d),y=Math.min(g+1,t.length-1),b=t[y];if((v===-1&&d&&e>=d.end||(m=b.event)!=null&&m.appendInPlace&&e+.01>=b.start)&&(v=y),this.isInterstitial(d)){var S=d.event;if(y-f>1&&S.appendInPlace===!1||S.assetList.length===0&&S.assetListLoader)return}if(this.bufferedPos=e,v>g&&v>f)this.bufferedToItem(b);else{var L=this.primaryDetails;this.primaryLive&&L&&e>L.edge-L.targetduration&&b.start<L.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(b)&&this.preloadAssets(b.event,0)}}else a&&c&&!this.itemsMatch(c,d)&&(v===f?this.bufferedToItem(c):v===f+1&&this.bufferedToItem(t[v]))}},n.assetsBuffered=function(e,t){var a=this,o=e.event.assetList;return o.length===0?!1:!e.event.assetList.some(function(d){var c=a.getAssetPlayer(d.identifier);return!(c!=null&&c.bufferedInPlaceToEnd(t))})},n.setBufferingItem=function(e){var t=this,a=this.bufferingItem,o=this.schedule;if(!this.itemsMatch(e,a)&&o){var d=o.items,c=o.events;if(!d||!c)return a;var f=this.isInterstitial(e),v=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));var m=v?v.remaining:a?a.end-this.timelinePos:0;if(this.log("INTERSTITIALS_BUFFERED_TO_BOUNDARY "+Pi(e)+(a?" ("+m.toFixed(2)+" remaining)":"")),!this.playbackDisabled)if(f){var g=o.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach(function(y,b){var S=t.getAssetPlayer(y.identifier);S&&(b===g&&S.loadSource(),S.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(function(y){return y.pauseBuffering()});this.hls.trigger(_.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:c.slice(0),schedule:d.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return a},n.bufferedToItem=function(e,t){t===void 0&&(t=0);var a=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(a!==null){this.bufferingAsset=null;var o=this.detachedData;if(o)if(o.mediaSource){var d=!0;this.attachPrimary(e.start,e,d)}else this.preloadPrimary(e);else this.preloadPrimary(e)}}},n.preloadPrimary=function(e){var t=this.findItemIndex(e),a=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(a)},n.bufferedToEvent=function(e,t){var a=e.event,o=a.assetList.length===0&&!a.assetListLoader,d=a.cue.once;if(o||!d){var c=this.preloadAssets(a,t);if(c!=null&&c.interstitial.appendInPlace){var f=this.primaryMedia;f&&this.bufferAssetPlayer(c,f)}}},n.preloadAssets=function(e,t){var a=e.assetUrl,o=e.assetList.length,d=o===0&&!e.assetListLoader,c=e.cue.once;if(d){var f=e.timelineStart;if(e.appendInPlace){var v,m=this.playingItem;!this.isInterstitial(m)&&(m==null||(v=m.nextEvent)==null?void 0:v.identifier)===e.identifier&&this.flushFrontBuffer(f+.25)}var g,y=0;if(!this.playingItem&&this.primaryLive&&(y=this.hls.startPosition,y===-1&&(y=this.hls.liveSyncPosition||0)),y&&!(e.cue.pre||e.cue.post)){var b=y-f;b>0&&(g=Math.round(b*1e3)/1e3)}if(this.log("Load interstitial asset "+(t+1)+"/"+(a?1:o)+" "+e+(g?" live-start: "+y+" start-offset: "+g:"")),a)return this.createAsset(e,0,0,f,e.duration,a);var S=this.assetListLoader.loadAssetList(e,g);S&&(e.assetListLoader=S)}else if(!c&&o){for(var L=t;L<o;L++){var C=e.assetList[L],F=this.getAssetPlayerQueueIndex(C.identifier);(F===-1||this.playerQueue[F].destroyed)&&!C.error&&this.createAssetPlayer(e,C,L)}var N=e.assetList[t];if(N){var B=this.getAssetPlayer(N.identifier);return B&&B.loadSource(),B}}return null},n.flushFrontBuffer=function(e){var t=this,a=this.requiredTracks;if(a){this.log("Removing front buffer starting at "+e);var o=Object.keys(a);o.forEach(function(d){t.hls.trigger(_.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:d})})}},n.getAssetPlayerQueueIndex=function(e){for(var t=this.playerQueue,a=0;a<t.length;a++)if(e===t[a].assetId)return a;return-1},n.getAssetPlayer=function(e){var t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null},n.getBufferingPlayer=function(){var e=this.playerQueue,t=this.primaryMedia;if(t){for(var a=0;a<e.length;a++)if(e[a].media===t)return e[a]}return null},n.createAsset=function(e,t,a,o,d,c){var f={parentIdentifier:e.identifier,identifier:Ru(e,c,t),duration:d,startOffset:a,timelineStart:o,uri:c};return this.createAssetPlayer(e,f,t)},n.createAssetPlayer=function(e,t,a){var o=this,d=this.hls,c=d.userConfig,f=c.videoPreference,v=d.loadLevelObj||d.levels[d.currentLevel];(f||v)&&(f=Qe({},f),v.videoCodec&&(f.videoCodec=v.videoCodec),v.videoRange&&(f.allowedVideoRanges=[v.videoRange]));var m=d.audioTracks[d.audioTrack],g=d.subtitleTracks[d.subtitleTrack],y=0;if(this.primaryLive||e.appendInPlace){var b=this.timelinePos-t.timelineStart;if(b>1){var S=t.duration;S&&b<S&&(y=b)}}var L=t.identifier,C=j(j({},c),{},{maxMaxBufferLength:Math.min(180,d.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:d.sessionId,assetPlayerId:L,abrEwmaDefaultEstimate:d.bandwidthEstimate,interstitialsController:void 0,startPosition:y,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:f,audioPreference:m||c.audioPreference,subtitlePreference:g||c.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(C.timelineOffset=t.timelineStart));var F=C.cmcd;F!=null&&F.sessionId&&F.contentId&&(C.cmcd=Qe({},F,{contentId:fd(t.uri)})),this.getAssetPlayer(L)&&this.warn("Duplicate date range identifier "+e+" and asset "+L);var N=new Qd(this.HlsPlayerClass,C,e,t);this.playerQueue.push(N),e.assetList[a]=t;var B=!0,re=function(Z){if(Z.live){var ne,Re=new Error("Interstitials MUST be VOD assets "+e),Tt={fatal:!0,type:ut.OTHER_ERROR,details:Q.INTERSTITIAL_ASSET_ITEM_ERROR,error:Re},ot=((ne=o.schedule)==null?void 0:ne.findEventIndex(e.identifier))||-1;o.handleAssetItemError(Tt,e,ot,a,Re.message);return}var pt=Z.edge-Z.fragmentStart,Bt=t.duration;(B||Bt===null||pt>Bt)&&(B=!1,o.log('Interstitial asset "'+L+'" duration change '+Bt+" > "+pt),t.duration=pt,o.updateSchedule())};N.on(_.LEVEL_UPDATED,function(be,Z){var ne=Z.details;return re(ne)}),N.on(_.LEVEL_PTS_UPDATED,function(be,Z){var ne=Z.details;return re(ne)}),N.on(_.EVENT_CUE_ENTER,function(){return o.onInterstitialCueEnter()});var ce=function(Z,ne){var Re=o.getAssetPlayer(L);if(Re&&ne.tracks){Re.off(_.BUFFER_CODECS,ce),Re.tracks=ne.tracks;var Tt=o.primaryMedia;o.bufferingAsset===Re.assetItem&&Tt&&!Re.media&&o.bufferAssetPlayer(Re,Tt)}};N.on(_.BUFFER_CODECS,ce);var Se=function(){var Z,ne=o.getAssetPlayer(L);if(o.log("buffered to end of asset "+ne),!(!ne||!o.schedule)){var Re=o.schedule.findEventIndex(e.identifier),Tt=(Z=o.schedule.items)==null?void 0:Z[Re];o.isInterstitial(Tt)&&o.advanceAssetBuffering(Tt,t)}};N.on(_.BUFFERED_TO_END,Se);var Ke=function(Z){return function(){var ne=o.getAssetPlayer(L);if(!(!ne||!o.schedule)){o.shouldPlay=!0;var Re=o.schedule.findEventIndex(e.identifier);o.advanceAfterAssetEnded(e,Re,Z)}}};return N.once(_.MEDIA_ENDED,Ke(a)),N.once(_.PLAYOUT_LIMIT_REACHED,Ke(1/0)),N.on(_.ERROR,function(be,Z){if(o.schedule){var ne=o.getAssetPlayer(L);if(Z.details===Q.BUFFER_STALLED_ERROR){if(ne!=null&&ne.appendInPlace){o.handleInPlaceStall(e);return}o.onTimeupdate(),o.checkBuffer(!0);return}o.handleAssetItemError(Z,e,o.schedule.findEventIndex(e.identifier),a,"Asset player error "+Z.error+" "+e)}}),N.on(_.DESTROYING,function(){var be=o.getAssetPlayer(L);if(!(!be||!o.schedule)){var Z=new Error("Asset player destroyed unexpectedly "+L),ne={fatal:!0,type:ut.OTHER_ERROR,details:Q.INTERSTITIAL_ASSET_ITEM_ERROR,error:Z};o.handleAssetItemError(ne,e,o.schedule.findEventIndex(e.identifier),a,Z.message)}}),this.log("INTERSTITIAL_ASSET_PLAYER_CREATED "+ms(t)),this.hls.trigger(_.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:a,event:e,player:N}),N},n.clearInterstitial=function(e,t){this.clearAssetPlayers(e,t),e.reset()},n.clearAssetPlayers=function(e,t){var a=this;e.assetList.forEach(function(o){a.clearAssetPlayer(o.identifier,t)})},n.resetAssetPlayer=function(e){var t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log('reset asset player "'+e+'" after error');var a=this.playerQueue[t];this.transferMediaFromPlayer(a,null),a.resetDetails()}},n.clearAssetPlayer=function(e,t){var a=this.getAssetPlayerQueueIndex(e);if(a!==-1){var o=this.playerQueue[a];this.log("clear "+o+" toSegment: "+(t&&Pi(t))),this.transferMediaFromPlayer(o,t),this.playerQueue.splice(a,1),o.destroy()}},n.emptyPlayerQueue=function(){for(var e;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]},n.startAssetPlayer=function(e,t,a,o,d){var c=e.interstitial,f=e.assetItem,v=e.assetId,m=c.assetList.length,g=this.playingAsset;this.endedAsset=null,this.playingAsset=f,(!g||g.identifier!==v)&&(g&&(this.clearAssetPlayer(g.identifier,a[o]),delete g.error),this.log("INTERSTITIAL_ASSET_STARTED "+(t+1)+"/"+m+" "+ms(f)),this.hls.trigger(_.INTERSTITIAL_ASSET_STARTED,{asset:f,assetListIndex:t,event:c,schedule:a.slice(0),scheduleIndex:o,player:e})),this.bufferAssetPlayer(e,d)},n.bufferAssetPlayer=function(e,t){var a,o;if(this.schedule){var d=e.interstitial,c=e.assetItem,f=this.schedule.findEventIndex(d.identifier),v=(a=this.schedule.items)==null?void 0:a[f];if(v){e.loadSource(),this.setBufferingItem(v),this.bufferingAsset=c;var m=this.getBufferingPlayer();if(m!==e){var g=d.appendInPlace;if(!(g&&(m==null?void 0:m.interstitial.appendInPlace)===!1)){var y=(m==null?void 0:m.tracks)||((o=this.detachedData)==null?void 0:o.tracks)||this.requiredTracks;if(g&&c!==this.playingAsset){if(!e.tracks){this.log("Waiting for track info before buffering "+e);return}if(y&&!Jt(y,e.tracks)){var b=new Error("Asset "+ms(c)+" SourceBuffer tracks ('"+Object.keys(e.tracks)+"') are not compatible with primary content tracks ('"+Object.keys(y)+"')"),S={fatal:!0,type:ut.OTHER_ERROR,details:Q.INTERSTITIAL_ASSET_ITEM_ERROR,error:b},L=d.findAssetIndex(c);this.handleAssetItemError(S,d,f,L,b.message);return}}this.transferMediaTo(e,t)}}}}},n.handleInPlaceStall=function(e){var t=this.schedule,a=this.primaryMedia;if(!(!t||!a)){var o=a.currentTime,d=t.findAssetIndex(e,o),c=e.assetList[d];if(c){var f=this.getAssetPlayer(c.identifier);if(f){var v=f.currentTime||o-c.timelineStart,m=f.duration-v;if(this.warn("Stalled at "+v+" of "+(v+m)+" in "+f+" "+e+" (media.currentTime: "+o+")"),v&&(m/a.playbackRate<.5||f.bufferedInPlaceToEnd(a))&&f.hls){var g=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,g,d)}}}}},n.advanceInPlace=function(e){var t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)},n.handleAssetItemError=function(e,t,a,o,d){if(e.details!==Q.BUFFER_STALLED_ERROR){var c=t.assetList[o]||null;if(this.warn("INTERSTITIAL_ASSET_ERROR "+(c&&ms(c))+" "+e.error),!!this.schedule){var f=(c==null?void 0:c.identifier)||"",v=this.getAssetPlayerQueueIndex(f),m=this.playerQueue[v]||null,g=this.schedule.items,y=Qe({},e,{fatal:!1,errorAction:We(!0),asset:c,assetListIndex:o,event:t,schedule:g,scheduleIndex:a,player:m});if(this.hls.trigger(_.INTERSTITIAL_ASSET_ERROR,y),!!e.fatal){var b=this.playingAsset,S=this.bufferingAsset,L=new Error(d);if(c&&(this.clearAssetPlayer(f,null),c.error=L),!t.assetList.some(function(F){return!F.error}))t.error=L;else for(var C=o;C<t.assetList.length;C++)this.resetAssetPlayer(t.assetList[C].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):b&&b.identifier===f?this.advanceAfterAssetEnded(t,a,o):S&&S.identifier===f&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,S)}}}},n.primaryFallback=function(e){var t=e.timelineStart,a=this.effectivePlayingItem,o=this.timelinePos;if(a){this.log('Fallback to primary from event "'+e.identifier+'" start: '+t+" pos: "+o+" playing: "+Pi(a)+" error: "+e.error),o===-1&&(o=this.hls.startPosition);var d=this.updateItem(a,o);this.itemsMatch(a,d)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(o===-1){this.checkStart();return}if(this.schedule){var c=this.schedule.findItemIndexAtTime(o);this.setSchedulePosition(c)}},n.onAssetListLoaded=function(e,t){var a,o=this,d,c=t.event,f=c.identifier,v=t.assetListResponse.ASSETS;if((a=this.schedule)!=null&&a.hasEvent(f)){var m=c.timelineStart,g=c.duration,y=0;v.forEach(function(Ke,be){var Z=parseFloat(Ke.DURATION);o.createAsset(c,be,y,m+y,Z,Ke.URI),y+=Z}),c.duration=y,this.log("Loaded asset-list with duration: "+y+" (was: "+g+") "+c);var b=this.waitingItem,S=(b==null?void 0:b.event.identifier)===f;this.updateSchedule();var L=(d=this.bufferingItem)==null?void 0:d.event;if(S){var C,F=this.schedule.findEventIndex(f),N=(C=this.schedule.items)==null?void 0:C[F];if(N){if(!this.playingItem&&this.timelinePos>N.end){var B=this.schedule.findItemIndexAtTime(this.timelinePos);if(B!==F){c.error=new Error("Interstitial "+(v.length?"no longer within playback range":"asset-list is empty")+" "+this.timelinePos+" "+c),this.log(c.error.message),this.updateSchedule(!0),this.primaryFallback(c);return}}this.setBufferingItem(N)}this.setSchedulePosition(F)}else if((L==null?void 0:L.identifier)===f){var re=c.assetList[0];if(re){var ce=this.getAssetPlayer(re.identifier);if(L.appendInPlace){var Se=this.primaryMedia;ce&&Se&&this.bufferAssetPlayer(ce,Se)}else ce&&ce.loadSource()}}}},n.onError=function(e,t){if(this.schedule)switch(t.details){case Q.ASSET_LIST_PARSING_ERROR:case Q.ASSET_LIST_LOAD_ERROR:case Q.ASSET_LIST_LOAD_TIMEOUT:{var a=t.interstitial;a&&(this.updateSchedule(!0),this.primaryFallback(a));break}case Q.BUFFER_STALLED_ERROR:{var o=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(o)&&o.event.appendInPlace){this.handleInPlaceStall(o.event);return}this.log("Primary player stall @"+this.timelinePos+" bufferedPos: "+this.bufferedPos),this.onTimeupdate(),this.checkBuffer(!0);break}}},Ne(l,[{key:"interstitialsManager",get:function(){if(!this.hls)return null;if(this.manager)return this.manager;var e=this,t=function(){return e.bufferingItem||e.waitingItem},a=function(b){return b&&e.getAssetPlayer(b.identifier)},o=function(b,S,L,C,F){if(b){var N=b[S].start,B=b.event;if(B){if(S==="playout"||B.timelineOccupancy!==Wl.Point){var re=a(L);(re==null?void 0:re.interstitial)===B&&(N+=re.assetItem.startOffset+re[F])}}else{var ce=C==="bufferedPos"?c():e[C];N+=ce-b.start}return N}return 0},d=function(b,S){var L;if(b!==0&&S!=="primary"&&(L=e.schedule)!=null&&L.length){var C,F=e.schedule.findItemIndexAtTime(b),N=(C=e.schedule.items)==null?void 0:C[F];if(N){var B=N[S].start-N.start;return b+B}}return b},c=function(){var b=e.bufferedPos;return b===Number.MAX_VALUE?f("primary"):Math.max(b,0)},f=function(b){var S,L;return(S=e.primaryDetails)!=null&&S.live?e.primaryDetails.edge:((L=e.schedule)==null?void 0:L.durations[b])||0},v=function(b,S){var L,C,F=e.effectivePlayingItem;if(!(F!=null&&(L=F.event)!=null&&L.restrictions.skip||!e.schedule)){e.log("seek to "+b+' "'+S+'"');var N=e.effectivePlayingItem,B=e.schedule.findItemIndexAtTime(b,S),re=(C=e.schedule.items)==null?void 0:C[B],ce=e.getBufferingPlayer(),Se=ce==null?void 0:ce.interstitial,Ke=Se==null?void 0:Se.appendInPlace,be=N&&e.itemsMatch(N,re);if(N&&(Ke||be)){var Z=a(e.playingAsset),ne=(Z==null?void 0:Z.media)||e.primaryMedia;if(ne){var Re=S==="primary"?ne.currentTime:o(N,S,e.playingAsset,"timelinePos","currentTime"),Tt=b-Re,ot=(Ke?Re:ne.currentTime)+Tt;if(ot>=0&&(!Z||Ke||ot<=Z.duration)){ne.currentTime=ot;return}}}if(re){var pt=b;if(S!=="primary"){var Bt=re[S].start,cr=b-Bt;pt=re.start+cr}var or=!e.isInterstitial(re);if((!e.isInterstitial(N)||N.event.appendInPlace)&&(or||re.event.appendInPlace)){var hr=e.media||(Ke?ce==null?void 0:ce.media:null);hr&&(hr.currentTime=pt)}else if(N){var xr=e.findItemIndex(N);if(B>xr){var fr=e.schedule.findJumpRestrictedIndex(xr+1,B);if(fr>xr){e.setSchedulePosition(fr);return}}var lr=0;if(or)e.timelinePos=pt,e.checkBuffer();else for(var _r=re.event.assetList,Dr=b-(re[S]||re).start,bi=_r.length;bi--;){var jr=_r[bi];if(jr.duration&&Dr>=jr.startOffset&&Dr<jr.startOffset+jr.duration){lr=bi;break}}e.setSchedulePosition(B,lr)}}}},m=function(){var b=e.effectivePlayingItem;if(e.isInterstitial(b))return b;var S=t();return e.isInterstitial(S)?S:null},g={get bufferedEnd(){var y=t(),b=e.bufferingItem;if(b&&b===y){var S;return o(b,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-b.playout.start||((S=e.bufferingAsset)==null?void 0:S.startOffset)||0}return 0},get currentTime(){var y=m(),b=e.effectivePlayingItem;return b&&b===y?o(b,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-b.playout.start:0},set currentTime(y){var b=m(),S=e.effectivePlayingItem;S&&S===b&&v(y+S.playout.start,"playout")},get duration(){var y=m();return y?y.playout.end-y.playout.start:0},get assetPlayers(){var y,b=(y=m())==null?void 0:y.event.assetList;return b?b.map(function(S){return e.getAssetPlayer(S.identifier)}):[]},get playingIndex(){var y,b=(y=m())==null?void 0:y.event;return b&&e.effectivePlayingAsset?b.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return m()}};return this.manager={get events(){var y;return((y=e.schedule)==null||(y=y.events)==null?void 0:y.slice(0))||[]},get schedule(){var y;return((y=e.schedule)==null||(y=y.items)==null?void 0:y.slice(0))||[]},get interstitialPlayer(){return m()?g:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){var y=t();return e.findItemIndex(y)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){var y=e.effectivePlayingItem;return e.findItemIndex(y)},primary:{get bufferedEnd(){return c()},get currentTime(){var y=e.timelinePos;return y>0?y:0},set currentTime(y){v(y,"primary")},get duration(){return f("primary")},get seekableStart(){var y;return((y=e.primaryDetails)==null?void 0:y.fragmentStart)||0}},integrated:{get bufferedEnd(){return o(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return o(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(y){v(y,"integrated")},get duration(){return f("integrated")},get seekableStart(){var y;return d(((y=e.primaryDetails)==null?void 0:y.fragmentStart)||0,"integrated")}},skip:function(){var b=e.effectivePlayingItem,S=b==null?void 0:b.event;if(S&&!S.restrictions.skip){var L=e.findItemIndex(b);if(S.appendInPlace){var C=b.playout.start+b.event.duration;v(C+.001,"playout")}else e.advanceAfterAssetEnded(S,L,1/0)}}}}},{key:"effectivePlayingItem",get:function(){return this.waitingItem||this.playingItem||this.endedItem}},{key:"effectivePlayingAsset",get:function(){return this.playingAsset||this.endedAsset}},{key:"playingLastItem",get:function(){var e,t=this.playingItem,a=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!a?!1:this.findItemIndex(t)===a.length-1}},{key:"playbackStarted",get:function(){return this.effectivePlayingItem!==null}},{key:"currentTime",get:function(){var e,t;if(this.mediaSelection!==null){var a=this.waitingItem||this.playingItem;if(!(this.isInterstitial(a)&&!a.event.appendInPlace)){var o=this.media;!o&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(o=this.primaryMedia);var d=(t=o)==null?void 0:t.currentTime;if(!(d===void 0||!Ge(d)))return d}}}},{key:"primaryMedia",get:function(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}},{key:"playbackDisabled",get:function(){return this.hls.config.enableInterstitialPlayback===!1}},{key:"primaryDetails",get:function(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}},{key:"primaryLive",get:function(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}}])}(Te),tl=500,Xd=function(s){function l(r,e,t){var a;return a=s.call(this,r,e,t,"subtitle-stream-controller",Ie.SUBTITLE)||this,a.currentTrackId=-1,a.tracksBuffered=[],a.mainDetails=null,a.registerListeners(),a}Pe(l,s);var n=l.prototype;return n.onHandlerDestroying=function(){this.unregisterListeners(),s.prototype.onHandlerDestroying.call(this),this.mainDetails=null},n.registerListeners=function(){s.prototype.registerListeners.call(this);var e=this.hls;e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(_.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this)},n.unregisterListeners=function(){s.prototype.unregisterListeners.call(this);var e=this.hls;e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(_.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this)},n.startLoad=function(e,t){this.stopLoad(),this.state=nt.IDLE,this.setInterval(tl),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()},n.onManifestLoading=function(){s.prototype.onManifestLoading.call(this),this.mainDetails=null},n.onMediaDetaching=function(e,t){this.tracksBuffered=[],s.prototype.onMediaDetaching.call(this,e,t)},n.onLevelLoaded=function(e,t){this.mainDetails=t.details},n.onSubtitleFragProcessed=function(e,t){var a=t.frag,o=t.success;if(this.fragContextChanged(a)||(Y(a)&&(this.fragPrevious=a),this.state=nt.IDLE),!!o){var d=this.tracksBuffered[this.currentTrackId];if(d){for(var c,f=a.start,v=0;v<d.length;v++)if(f>=d[v].start&&f<=d[v].end){c=d[v];break}var m=a.start+a.duration;c?c.end=m:(c={start:f,end:m},d.push(c)),this.fragmentTracker.fragBuffered(a),this.fragBufferedComplete(a,null),this.media&&this.tick()}}},n.onBufferFlushing=function(e,t){var a=t.startOffset,o=t.endOffset;if(a===0&&o!==Number.POSITIVE_INFINITY){var d=o-1;if(d<=0)return;t.endOffsetSubtitles=Math.max(0,d),this.tracksBuffered.forEach(function(c){for(var f=0;f<c.length;){if(c[f].end<=d){c.shift();continue}else if(c[f].start<d)c[f].start=d;else break;f++}}),this.fragmentTracker.removeFragmentsInRange(a,d,Ie.SUBTITLE)}},n.onError=function(e,t){var a=t.frag;(a==null?void 0:a.type)===Ie.SUBTITLE&&(t.details===Q.FRAG_GAP&&this.fragmentTracker.fragBuffered(a,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==nt.STOPPED&&(this.state=nt.IDLE))},n.onSubtitleTracksUpdated=function(e,t){var a=this,o=t.subtitleTracks;if(this.levels&&Jh(this.levels,o)){this.levels=o.map(function(d){return new Xa(d)});return}this.tracksBuffered=[],this.levels=o.map(function(d){var c=new Xa(d);return a.tracksBuffered[c.id]=[],c}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ie.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null},n.onSubtitleTrackSwitch=function(e,t){var a;if(this.currentTrackId=t.id,!((a=this.levels)!=null&&a.length)||this.currentTrackId===-1){this.clearInterval();return}var o=this.levels[this.currentTrackId];o!=null&&o.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,o&&this.state!==nt.STOPPED&&this.setInterval(tl)},n.onSubtitleTrackLoaded=function(e,t){var a,o=this.currentTrackId,d=this.levels,c=t.details,f=t.id;if(!d){this.warn("Subtitle tracks were reset while loading level "+f);return}var v=d[f];if(!(f>=d.length||!v)){this.log("Subtitle track "+f+" loaded ["+c.startSN+","+c.endSN+"]"+(c.lastPartSn?"[part-"+c.lastPartSn+"-"+c.lastPartIndex+"]":"")+",duration:"+c.totalduration),this.mediaBuffer=this.mediaBufferTimeRanges;var m=0;if(c.live||(a=v.details)!=null&&a.live){if(c.deltaUpdateFailed)return;var g=this.mainDetails;if(!g){this.startFragRequested=!1;return}var y=g.fragments[0];if(!v.details)c.hasProgramDateTime&&g.hasProgramDateTime?(Tl(c,g),m=c.fragmentStart):y&&(m=y.start,Wa(c,m));else{var b;m=this.alignPlaylists(c,v.details,(b=this.levelLastLoaded)==null?void 0:b.details),m===0&&y&&(m=y.start,Wa(c,m))}g&&!this.startFragRequested&&this.setStartPosition(g,m)}if(v.details=c,this.levelLastLoaded=v,f===o&&(this.hls.trigger(_.SUBTITLE_TRACK_UPDATED,{details:c,id:f,groupId:t.groupId}),this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===nt.IDLE)){var S=Za(null,c.fragments,this.media.currentTime,0);S||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}}},n._handleFragmentLoadComplete=function(e){var t=this,a=e.frag,o=e.payload,d=a.decryptdata,c=this.hls;if(!this.fragContextChanged(a)&&o&&o.byteLength>0&&d!=null&&d.key&&d.iv&&Ji(d.method)){var f=performance.now();this.decrypter.decrypt(new Uint8Array(o),d.key.buffer,d.iv.buffer,Ka(d.method)).catch(function(v){throw c.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.FRAG_DECRYPT_ERROR,fatal:!1,error:v,reason:v.message,frag:a}),v}).then(function(v){var m=performance.now();c.trigger(_.FRAG_DECRYPTED,{frag:a,payload:v,stats:{tstart:f,tdecrypt:m}})}).catch(function(v){t.warn(v.name+": "+v.message),t.state=nt.IDLE})}},n.doTick=function(){if(!this.media){this.state=nt.IDLE;return}if(this.state===nt.IDLE){var e=this.currentTrackId,t=this.levels,a=t==null?void 0:t[e];if(!a||!t.length||!a.details||this.waitForLive(a))return;var o=this.config,d=this.getLoadPosition(),c=Pr.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],d,o.maxBufferHole),f=c.end,v=c.len,m=a.details,g=this.hls.maxBufferLength+m.levelTargetDuration;if(v>g)return;var y=m.fragments,b=y.length,S=m.edge,L=null,C=this.fragPrevious;if(f<S){var F=o.maxFragLookUpTolerance,N=f>S-F?0:F;L=Za(C,y,Math.max(y[0].start,f),N),!L&&C&&C.start<y[0].start&&(L=y[0])}else L=y[b-1];if(L=this.filterReplacedPrimary(L,a.details),!L)return;var B=L.sn-m.startSN,re=y[B-1];if(re&&re.cc===L.cc&&this.fragmentTracker.getState(re)===xe.NOT_LOADED&&(L=re),this.fragmentTracker.getState(L)===xe.NOT_LOADED){var ce=this.mapToInitFragWhenRequired(L);ce&&this.loadFragment(ce,a,f)}}},n.loadFragment=function(e,t,a){Y(e)?s.prototype.loadFragment.call(this,e,t,a):this._loadInitSegment(e,t)},Ne(l,[{key:"mediaBufferTimeRanges",get:function(){return new pd(this.tracksBuffered[this.currentTrackId]||[])}}])}(Xu),pd=function(l){this.buffered=void 0;var n=function(e,t,a){if(t=t>>>0,t>a-1)throw new DOMException("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is greater than the maximum bound ("+a+")");return l[t][e]};this.buffered={get length(){return l.length},end:function(e){return n("end",e,l.length)},start:function(e){return n("start",e,l.length)}}};function gd(s,l){var n;try{n=new Event("addtrack")}catch(r){n=document.createEvent("Event"),n.initEvent("addtrack",!1,!1)}n.track=s,l.dispatchEvent(n)}function Ed(s,l){var n=s.mode;if(n==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(l.id))try{if(s.addCue(l),!s.cues.getCueById(l.id))throw new Error("addCue is failed for: "+l)}catch(e){U.debug("[texttrack-utils]: "+e);try{var r=new self.TextTrackCue(l.startTime,l.endTime,l.text);r.id=l.id,s.addCue(r)}catch(t){U.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: "+t)}}n==="disabled"&&(s.mode=n)}function ro(s,l){var n=s.mode;if(n==="disabled"&&(s.mode="hidden"),s.cues)for(var r=s.cues.length;r--;)l&&s.cues[r].removeEventListener("enter",l),s.removeCue(s.cues[r]);n==="disabled"&&(s.mode=n)}function Yl(s,l,n,r){var e=s.mode;if(e==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0)for(var t=Ou(s.cues,l,n),a=0;a<t.length;a++)(!r||r(t[a]))&&s.removeCue(t[a]);e==="disabled"&&(s.mode=e)}function Pu(s,l){if(l<=s[0].startTime)return 0;var n=s.length-1;if(l>s[n].endTime)return-1;for(var r=0,e=n,t;r<=e;)if(t=Math.floor((e+r)/2),l<s[t].startTime)e=t-1;else if(l>s[t].startTime&&r<n)r=t+1;else return t;return s[r].startTime-l<l-s[e].startTime?r:e}function Ou(s,l,n){var r=[],e=Pu(s,l);if(e>-1)for(var t=e,a=s.length;t<a;t++){var o=s[t];if(o.startTime>=l&&o.endTime<=n)r.push(o);else if(o.startTime>n)return r}return r}function Ro(s){for(var l=[],n=0;n<s.length;n++){var r=s[n];(r.kind==="subtitles"||r.kind==="captions")&&r.label&&l.push(s[n])}return l}var yd=function(s){function l(r){var e;return e=s.call(this,r,"subtitle-track-controller")||this,e.media=null,e.tracks=[],e.groupIds=null,e.tracksInGroup=[],e.trackId=-1,e.currentTrack=null,e.selectDefaultTrack=!0,e.queuedDefaultTrack=-1,e.useTextTrackPolling=!1,e.subtitlePollingInterval=-1,e._subtitleDisplay=!0,e.asyncPollTrackChange=function(){return e.pollTrackChange(0)},e.onTextTracksChanged=function(){if(e.useTextTrackPolling||self.clearInterval(e.subtitlePollingInterval),!(!e.media||!e.hls.config.renderTextTracksNatively)){for(var t=null,a=Ro(e.media.textTracks),o=0;o<a.length;o++)if(a[o].mode==="hidden")t=a[o];else if(a[o].mode==="showing"){t=a[o];break}var d=e.findTrackForTextTrack(t);e.subtitleTrack!==d&&e.setSubtitleTrack(d)}},e.registerListeners(),e}Pe(l,s);var n=l.prototype;return n.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,s.prototype.destroy.call(this)},n.registerListeners=function(){var e=this.hls;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(_.ERROR,this.onError,this)},n.unregisterListeners=function(){var e=this.hls;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(_.ERROR,this.onError,this)},n.onMediaAttached=function(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},n.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)},n.onMediaDetaching=function(e,t){var a=this.media;if(a){var o=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||a.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,!o){var d=Ro(a.textTracks);d.forEach(function(c){ro(c)})}}},n.onManifestLoading=function(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0},n.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},n.onSubtitleTrackLoaded=function(e,t){var a=t.id,o=t.groupId,d=t.details,c=this.tracksInGroup[a];if(!c||c.groupId!==o){this.warn("Subtitle track with id:"+a+" and group:"+o+" not found in active group "+(c==null?void 0:c.groupId));return}var f=c.details;c.details=t.details,this.log("Subtitle track "+a+' "'+c.name+'" lang:'+c.lang+" group:"+o+" loaded ["+d.startSN+"-"+d.endSN+"]"),a===this.trackId&&this.playlistLoaded(a,t,f)},n.onLevelLoading=function(e,t){this.switchLevel(t.level)},n.onLevelSwitching=function(e,t){this.switchLevel(t.level)},n.switchLevel=function(e){var t=this.hls.levels[e];if(t){var a=t.subtitleGroups||null,o=this.groupIds,d=this.currentTrack;if(!a||(o==null?void 0:o.length)!==(a==null?void 0:a.length)||a!=null&&a.some(function(b){return(o==null?void 0:o.indexOf(b))===-1})){this.groupIds=a,this.trackId=-1,this.currentTrack=null;var c=this.tracks.filter(function(b){return!a||a.indexOf(b.groupId)!==-1});if(c.length)this.selectDefaultTrack&&!c.some(function(b){return b.default})&&(this.selectDefaultTrack=!1),c.forEach(function(b,S){b.id=S});else if(!d&&!this.tracksInGroup.length)return;this.tracksInGroup=c;var f=this.hls.config.subtitlePreference;if(!d&&f){this.selectDefaultTrack=!1;var v=xi(f,c);if(v>-1)d=c[v];else{var m=xi(f,this.tracks);d=this.tracks[m]}}var g=this.findTrackId(d);g===-1&&d&&(g=this.findTrackId(null));var y={subtitleTracks:c};this.log("Updating subtitle tracks, "+c.length+' track(s) found in "'+(a==null?void 0:a.join(","))+'" group-id'),this.hls.trigger(_.SUBTITLE_TRACKS_UPDATED,y),g!==-1&&this.trackId===-1&&this.setSubtitleTrack(g)}}},n.findTrackId=function(e){for(var t=this.tracksInGroup,a=this.selectDefaultTrack,o=0;o<t.length;o++){var d=t[o];if(!(a&&!d.default||!a&&!e)&&(!e||fa(d,e)))return o}if(e){for(var c=0;c<t.length;c++){var f=t[c];if(od(e.attrs,f.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return c}for(var v=0;v<t.length;v++){var m=t[v];if(od(e.attrs,m.attrs,["LANGUAGE"]))return v}}return-1},n.findTrackForTextTrack=function(e){if(e)for(var t=this.tracksInGroup,a=0;a<t.length;a++){var o=t[a];if(Nc(o,e))return a}return-1},n.onError=function(e,t){t.fatal||!t.context||t.context.type===pe.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)},n.setSubtitleOption=function(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;var t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){var a=this.currentTrack;if(a&&fa(e,a))return a;var o=xi(e,this.tracksInGroup);if(o>-1){var d=this.tracksInGroup[o];return this.setSubtitleTrack(o),d}else{if(a)return null;var c=xi(e,t);if(c>-1)return t[c]}}}return null},n.loadPlaylist=function(e){s.prototype.loadPlaylist.call(this),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)},n.loadingPlaylist=function(e,t){s.prototype.loadingPlaylist.call(this,e,t);var a=e.id,o=e.groupId,d=this.getUrlWithDirectives(e.url,t),c=e.details,f=c==null?void 0:c.age;this.log("Loading subtitle "+a+' "'+e.name+'" lang:'+e.lang+" group:"+o+((t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:"")+(f&&c.live?" age "+f.toFixed(1)+(c.type?" "+c.type||0:""):"")+" "+d),this.hls.trigger(_.SUBTITLE_TRACK_LOADING,{url:d,id:a,groupId:o,deliveryDirectives:t||null,track:e})},n.toggleTrackModes=function(){var e=this.media;if(e){var t=Ro(e.textTracks),a=this.currentTrack,o;if(a&&(o=t.filter(function(c){return Nc(a,c)})[0],o||this.warn('Unable to find subtitle TextTrack with name "'+a.name+'" and language "'+a.lang+'"')),[].slice.call(t).forEach(function(c){c.mode!=="disabled"&&c!==o&&(c.mode="disabled")}),o){var d=this.subtitleDisplay?"showing":"hidden";o.mode!==d&&(o.mode=d)}}},n.setSubtitleTrack=function(e){var t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!Ge(e)){this.warn("Invalid subtitle track id: "+e);return}this.selectDefaultTrack=!1;var a=this.currentTrack,o=t[e]||null;if(this.trackId=e,this.currentTrack=o,this.toggleTrackModes(),!o){this.hls.trigger(_.SUBTITLE_TRACK_SWITCH,{id:e});return}var d=!!o.details&&!o.details.live;if(!(e===this.trackId&&o===a&&d)){this.log("Switching to subtitle-track "+e+(o?' "'+o.name+'" lang:'+o.lang+" group:"+o.groupId:""));var c=o.id,f=o.groupId,v=f===void 0?"":f,m=o.name,g=o.type,y=o.url;this.hls.trigger(_.SUBTITLE_TRACK_SWITCH,{id:c,groupId:v,name:m,type:g,url:y});var b=this.switchParams(o.url,a==null?void 0:a.details,o.details);this.loadPlaylist(b)}},Ne(l,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}},{key:"allSubtitleTracks",get:function(){return this.tracks}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}}])}(Hl),Zc={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Jc=function(l){return String.fromCharCode(Zc[l]||l)},rs=15,ps=100,eh={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Zd={17:2,18:4,21:6,22:8,23:10,19:13,20:15},th={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Jd={25:2,26:4,29:6,30:8,31:10,27:13,28:15},rh=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],ih=function(){function s(){this.time=null,this.verboseLevel=0}var l=s.prototype;return l.log=function(r,e){if(this.verboseLevel>=r){var t=typeof e=="function"?e():e;U.log(this.time+" ["+r+"] "+t)}},s}(),rl=function(l){for(var n=[],r=0;r<l.length;r++)n.push(l[r].toString(16));return n},xu=function(){function s(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}var l=s.prototype;return l.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},l.setStyles=function(r){for(var e=["foreground","underline","italics","background","flash"],t=0;t<e.length;t++){var a=e[t];r.hasOwnProperty(a)&&(this[a]=r[a])}},l.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},l.equals=function(r){return this.foreground===r.foreground&&this.underline===r.underline&&this.italics===r.italics&&this.background===r.background&&this.flash===r.flash},l.copy=function(r){this.foreground=r.foreground,this.underline=r.underline,this.italics=r.italics,this.background=r.background,this.flash=r.flash},l.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},s}(),ec=function(){function s(){this.uchar=" ",this.penState=new xu}var l=s.prototype;return l.reset=function(){this.uchar=" ",this.penState.reset()},l.setChar=function(r,e){this.uchar=r,this.penState.copy(e)},l.setPenState=function(r){this.penState.copy(r)},l.equals=function(r){return this.uchar===r.uchar&&this.penState.equals(r.penState)},l.copy=function(r){this.uchar=r.uchar,this.penState.copy(r.penState)},l.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},s}(),ah=function(){function s(n){this.chars=[],this.pos=0,this.currPenState=new xu,this.cueStartTime=null,this.logger=void 0;for(var r=0;r<ps;r++)this.chars.push(new ec);this.logger=n}var l=s.prototype;return l.equals=function(r){for(var e=0;e<ps;e++)if(!this.chars[e].equals(r.chars[e]))return!1;return!0},l.copy=function(r){for(var e=0;e<ps;e++)this.chars[e].copy(r.chars[e])},l.isEmpty=function(){for(var r=!0,e=0;e<ps;e++)if(!this.chars[e].isEmpty()){r=!1;break}return r},l.setCursor=function(r){this.pos!==r&&(this.pos=r),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>ps&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=ps)},l.moveCursor=function(r){var e=this.pos+r;if(r>1)for(var t=this.pos+1;t<e+1;t++)this.chars[t].setPenState(this.currPenState);this.setCursor(e)},l.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},l.insertChar=function(r){var e=this;r>=144&&this.backSpace();var t=Jc(r);if(this.pos>=ps){this.logger.log(0,function(){return"Cannot insert "+r.toString(16)+" ("+t+") at position "+e.pos+". Skipping it!"});return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)},l.clearFromPos=function(r){var e;for(e=r;e<ps;e++)this.chars[e].reset()},l.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},l.clearToEndOfRow=function(){this.clearFromPos(this.pos)},l.getTextString=function(){for(var r=[],e=!0,t=0;t<ps;t++){var a=this.chars[t].uchar;a!==" "&&(e=!1),r.push(a)}return e?"":r.join("")},l.setPenStyles=function(r){this.currPenState.setStyles(r);var e=this.chars[this.pos];e.setPenState(this.currPenState)},s}(),tc=function(){function s(n){this.rows=[],this.currRow=rs-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(var r=0;r<rs;r++)this.rows.push(new ah(n));this.logger=n}var l=s.prototype;return l.reset=function(){for(var r=0;r<rs;r++)this.rows[r].clear();this.currRow=rs-1},l.equals=function(r){for(var e=!0,t=0;t<rs;t++)if(!this.rows[t].equals(r.rows[t])){e=!1;break}return e},l.copy=function(r){for(var e=0;e<rs;e++)this.rows[e].copy(r.rows[e])},l.isEmpty=function(){for(var r=!0,e=0;e<rs;e++)if(!this.rows[e].isEmpty()){r=!1;break}return r},l.backSpace=function(){var r=this.rows[this.currRow];r.backSpace()},l.clearToEndOfRow=function(){var r=this.rows[this.currRow];r.clearToEndOfRow()},l.insertChar=function(r){var e=this.rows[this.currRow];e.insertChar(r)},l.setPen=function(r){var e=this.rows[this.currRow];e.setPenStyles(r)},l.moveCursor=function(r){var e=this.rows[this.currRow];e.moveCursor(r)},l.setCursor=function(r){this.logger.log(2,"setCursor: "+r);var e=this.rows[this.currRow];e.setCursor(r)},l.setPAC=function(r){this.logger.log(2,function(){return"pacData = "+ur(r)});var e=r.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(var t=0;t<rs;t++)this.rows[t].clear();var a=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){var d=o.rows[a].cueStartTime,c=this.logger.time;if(d!==null&&c!==null&&d<c)for(var f=0;f<this.nrRollUpRows;f++)this.rows[e-this.nrRollUpRows+f+1].copy(o.rows[a+f])}}this.currRow=e;var v=this.rows[this.currRow];if(r.indent!==null){var m=r.indent,g=Math.max(m-1,0);v.setCursor(r.indent),r.color=v.chars[g].penState.foreground}var y={foreground:r.color,underline:r.underline,italics:r.italics,background:"black",flash:!1};this.setPen(y)},l.setBkgData=function(r){this.logger.log(2,function(){return"bkgData = "+ur(r)}),this.backSpace(),this.setPen(r),this.insertChar(32)},l.setRollUpRows=function(r){this.nrRollUpRows=r},l.rollUp=function(){var r=this;if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,function(){return r.getDisplayText()});var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")},l.getDisplayText=function(r){r=r||!1;for(var e=[],t="",a=-1,o=0;o<rs;o++){var d=this.rows[o].getTextString();d&&(a=o+1,r?e.push("Row "+a+": '"+d+"'"):e.push(d.trim()))}return e.length>0&&(r?t="["+e.join(" | ")+"]":t=e.join(`
`)),t},l.getTextAndFormat=function(){return this.rows},s}(),Lf=function(){function s(n,r,e){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=n,this.outputFilter=r,this.mode=null,this.verbose=0,this.displayedMemory=new tc(e),this.nonDisplayedMemory=new tc(e),this.lastOutputScreen=new tc(e),this.currRollUpRow=this.displayedMemory.rows[rs-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=e}var l=s.prototype;return l.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[rs-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},l.getHandler=function(){return this.outputFilter},l.setHandler=function(r){this.outputFilter=r},l.setPAC=function(r){this.writeScreen.setPAC(r)},l.setBkgData=function(r){this.writeScreen.setBkgData(r)},l.setMode=function(r){r!==this.mode&&(this.mode=r,this.logger.log(2,function(){return"MODE="+r}),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=r)},l.insertChars=function(r){for(var e=this,t=0;t<r.length;t++)this.writeScreen.insertChar(r[t]);var a=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,function(){return a+": "+e.writeScreen.getDisplayText(!0)}),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,function(){return"DISPLAYED: "+e.displayedMemory.getDisplayText(!0)}),this.outputDataUpdate())},l.ccRCL=function(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},l.ccBS=function(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},l.ccAOF=function(){},l.ccAON=function(){},l.ccDER=function(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},l.ccRU=function(r){this.logger.log(2,"RU("+r+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(r)},l.ccFON=function(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},l.ccRDC=function(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},l.ccTR=function(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")},l.ccRTD=function(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")},l.ccEDM=function(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},l.ccCR=function(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},l.ccENM=function(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},l.ccEOC=function(){var r=this;if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,function(){return"DISP: "+r.displayedMemory.getDisplayText()})}this.outputDataUpdate(!0)},l.ccTO=function(r){this.logger.log(2,"TO("+r+") - Tab Offset"),this.writeScreen.moveCursor(r)},l.ccMIDROW=function(r){var e={flash:!1};if(e.underline=r%2===1,e.italics=r>=46,e.italics)e.foreground="white";else{var t=Math.floor(r/2)-16,a=["white","green","blue","cyan","red","yellow","magenta"];e.foreground=a[t]}this.logger.log(2,"MIDROW: "+ur(e)),this.writeScreen.setPen(e)},l.outputDataUpdate=function(r){r===void 0&&(r=!1);var e=this.logger.time;e!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=e:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),r&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:e),this.lastOutputScreen.copy(this.displayedMemory))},l.cueSplitAtTime=function(r){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,r,this.displayedMemory),this.cueStartTime=r))},s}(),kf=function(){function s(n,r,e){this.channels=void 0,this.currentChannel=0,this.cmdHistory=If(),this.logger=void 0;var t=this.logger=new ih;this.channels=[null,new Lf(n,r,t),new Lf(n+1,e,t)]}var l=s.prototype;return l.getHandler=function(r){return this.channels[r].getHandler()},l.setHandler=function(r,e){this.channels[r].setHandler(e)},l.addData=function(r,e){var t=this;this.logger.time=r;for(var a=function(f){var v=e[f]&127,m=e[f+1]&127,g=!1,y=null;if(v===0&&m===0)return 0;t.logger.log(3,function(){return"["+rl([e[f],e[f+1]])+"] -> ("+rl([v,m])+")"});var b=t.cmdHistory,S=v>=16&&v<=31;if(S){if(ic(v,m,b))return rc(null,null,b),t.logger.log(3,function(){return"Repeated command ("+rl([v,m])+") is dropped"}),0;rc(v,m,t.cmdHistory),g=t.parseCmd(v,m),g||(g=t.parseMidrow(v,m)),g||(g=t.parsePAC(v,m)),g||(g=t.parseBackgroundAttributes(v,m))}else rc(null,null,b);if(!g&&(y=t.parseChars(v,m),y)){var L=t.currentChannel;if(L&&L>0){var C=t.channels[L];C.insertChars(y)}else t.logger.log(2,"No channel found yet. TEXT-MODE?")}!g&&!y&&t.logger.log(2,function(){return"Couldn't parse cleaned data "+rl([v,m])+" orig: "+rl([e[f],e[f+1]])})},o,d=0;d<e.length;d+=2)o=a(d)},l.parseCmd=function(r,e){var t=(r===20||r===28||r===21||r===29)&&e>=32&&e<=47,a=(r===23||r===31)&&e>=33&&e<=35;if(!(t||a))return!1;var o=r===20||r===21||r===23?1:2,d=this.channels[o];return r===20||r===21||r===28||r===29?e===32?d.ccRCL():e===33?d.ccBS():e===34?d.ccAOF():e===35?d.ccAON():e===36?d.ccDER():e===37?d.ccRU(2):e===38?d.ccRU(3):e===39?d.ccRU(4):e===40?d.ccFON():e===41?d.ccRDC():e===42?d.ccTR():e===43?d.ccRTD():e===44?d.ccEDM():e===45?d.ccCR():e===46?d.ccENM():e===47&&d.ccEOC():d.ccTO(e-32),this.currentChannel=o,!0},l.parseMidrow=function(r,e){var t=0;if((r===17||r===25)&&e>=32&&e<=47){if(r===17?t=1:t=2,t!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;var a=this.channels[t];return a?(a.ccMIDROW(e),this.logger.log(3,function(){return"MIDROW ("+rl([r,e])+")"}),!0):!1}return!1},l.parsePAC=function(r,e){var t,a=(r>=17&&r<=23||r>=25&&r<=31)&&e>=64&&e<=127,o=(r===16||r===24)&&e>=64&&e<=95;if(!(a||o))return!1;var d=r<=23?1:2;e>=64&&e<=95?t=d===1?eh[r]:th[r]:t=d===1?Zd[r]:Jd[r];var c=this.channels[d];return c?(c.setPAC(this.interpretPAC(t,e)),this.currentChannel=d,!0):!1},l.interpretPAC=function(r,e){var t,a={color:null,italics:!1,indent:null,underline:!1,row:r};return e>95?t=e-96:t=e-64,a.underline=(t&1)===1,t<=13?a.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(t/2)]:t<=15?(a.italics=!0,a.color="white"):a.indent=Math.floor((t-16)/2)*4,a},l.parseChars=function(r,e){var t,a=null,o=null;if(r>=25?(t=2,o=r-8):(t=1,o=r),o>=17&&o<=19){var d;o===17?d=e+80:o===18?d=e+112:d=e+144,this.logger.log(2,function(){return"Special char '"+Jc(d)+"' in channel "+t}),a=[d]}else r>=32&&r<=127&&(a=e===0?[r]:[r,e]);return a&&this.logger.log(3,function(){return"Char codes =  "+rl(a).join(",")}),a},l.parseBackgroundAttributes=function(r,e){var t=(r===16||r===24)&&e>=32&&e<=47,a=(r===23||r===31)&&e>=45&&e<=47;if(!(t||a))return!1;var o,d={};r===16||r===24?(o=Math.floor((e-32)/2),d.background=rh[o],e%2===1&&(d.background=d.background+"_semi")):e===45?d.background="transparent":(d.foreground="black",e===47&&(d.underline=!0));var c=r<=23?1:2,f=this.channels[c];return f.setBkgData(d),!0},l.reset=function(){for(var r=0;r<Object.keys(this.channels).length;r++){var e=this.channels[r];e&&e.reset()}rc(null,null,this.cmdHistory)},l.cueSplitAtTime=function(r){for(var e=0;e<this.channels.length;e++){var t=this.channels[e];t&&t.cueSplitAtTime(r)}},s}();function rc(s,l,n){n.a=s,n.b=l}function ic(s,l,n){return n.a===s&&n.b===l}function If(){return{a:null,b:null}}var bd=function(){if(z!=null&&z.VTTCue)return self.VTTCue;var s=["","lr","rl"],l=["start","middle","end","left","right"];function n(o,d){if(typeof d!="string"||!Array.isArray(o))return!1;var c=d.toLowerCase();return~o.indexOf(c)?c:!1}function r(o){return n(s,o)}function e(o){return n(l,o)}function t(o){for(var d=arguments.length,c=new Array(d>1?d-1:0),f=1;f<d;f++)c[f-1]=arguments[f];for(var v=1;v<arguments.length;v++){var m=arguments[v];for(var g in m)o[g]=m[g]}return o}function a(o,d,c){var f=this,v={enumerable:!0};f.hasBeenReset=!1;var m="",g=!1,y=o,b=d,S=c,L=null,C="",F=!0,N="auto",B="start",re=50,ce="middle",Se=50,Ke="middle";Object.defineProperty(f,"id",t({},v,{get:function(){return m},set:function(Z){m=""+Z}})),Object.defineProperty(f,"pauseOnExit",t({},v,{get:function(){return g},set:function(Z){g=!!Z}})),Object.defineProperty(f,"startTime",t({},v,{get:function(){return y},set:function(Z){if(typeof Z!="number")throw new TypeError("Start time must be set to a number.");y=Z,this.hasBeenReset=!0}})),Object.defineProperty(f,"endTime",t({},v,{get:function(){return b},set:function(Z){if(typeof Z!="number")throw new TypeError("End time must be set to a number.");b=Z,this.hasBeenReset=!0}})),Object.defineProperty(f,"text",t({},v,{get:function(){return S},set:function(Z){S=""+Z,this.hasBeenReset=!0}})),Object.defineProperty(f,"region",t({},v,{get:function(){return L},set:function(Z){L=Z,this.hasBeenReset=!0}})),Object.defineProperty(f,"vertical",t({},v,{get:function(){return C},set:function(Z){var ne=r(Z);if(ne===!1)throw new SyntaxError("An invalid or illegal string was specified.");C=ne,this.hasBeenReset=!0}})),Object.defineProperty(f,"snapToLines",t({},v,{get:function(){return F},set:function(Z){F=!!Z,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",t({},v,{get:function(){return N},set:function(Z){if(typeof Z!="number"&&Z!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");N=Z,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",t({},v,{get:function(){return B},set:function(Z){var ne=e(Z);if(!ne)throw new SyntaxError("An invalid or illegal string was specified.");B=ne,this.hasBeenReset=!0}})),Object.defineProperty(f,"position",t({},v,{get:function(){return re},set:function(Z){if(Z<0||Z>100)throw new Error("Position must be between 0 and 100.");re=Z,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",t({},v,{get:function(){return ce},set:function(Z){var ne=e(Z);if(!ne)throw new SyntaxError("An invalid or illegal string was specified.");ce=ne,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",t({},v,{get:function(){return Se},set:function(Z){if(Z<0||Z>100)throw new Error("Size must be between 0 and 100.");Se=Z,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",t({},v,{get:function(){return Ke},set:function(Z){var ne=e(Z);if(!ne)throw new SyntaxError("An invalid or illegal string was specified.");Ke=ne,this.hasBeenReset=!0}})),f.displayState=void 0}return a.prototype.getCueAsHTML=function(){var o=self.WebVTT;return o.convertCueToDOMTree(self,this.text)},a}(),Zv=function(){function s(){}var l=s.prototype;return l.decode=function(r,e){if(!r)return"";if(typeof r!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(r))},s}();function Rf(s){function l(r,e,t,a){return(r|0)*3600+(e|0)*60+(t|0)+parseFloat(a||0)}var n=s.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?l(n[2],n[3],0,n[4]):l(n[1],n[2],n[3],n[4]):null}var Jv=function(){function s(){this.values=Object.create(null)}var l=s.prototype;return l.set=function(r,e){!this.get(r)&&e!==""&&(this.values[r]=e)},l.get=function(r,e,t){return t?this.has(r)?this.values[r]:e[t]:this.has(r)?this.values[r]:e},l.has=function(r){return r in this.values},l.alt=function(r,e,t){for(var a=0;a<t.length;++a)if(e===t[a]){this.set(r,e);break}},l.integer=function(r,e){/^-?\d+$/.test(e)&&this.set(r,parseInt(e,10))},l.percent=function(r,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var t=parseFloat(e);if(t>=0&&t<=100)return this.set(r,t),!0}return!1},s}();function wf(s,l,n,r){var e=r?s.split(r):[s];for(var t in e)if(typeof e[t]=="string"){var a=e[t].split(n);if(a.length===2){var o=a[0],d=a[1];l(o,d)}}}var nh=new bd(0,0,""),ac=nh.align==="middle"?"middle":"center";function sh(s,l,n){var r=s;function e(){var o=Rf(s);if(o===null)throw new Error("Malformed timestamp: "+r);return s=s.replace(/^[^\sa-zA-Z-]+/,""),o}function t(o,d){var c=new Jv;wf(o,function(m,g){var y;switch(m){case"region":for(var b=n.length-1;b>=0;b--)if(n[b].id===g){c.set(m,n[b].region);break}break;case"vertical":c.alt(m,g,["rl","lr"]);break;case"line":y=g.split(","),c.integer(m,y[0]),c.percent(m,y[0])&&c.set("snapToLines",!1),c.alt(m,y[0],["auto"]),y.length===2&&c.alt("lineAlign",y[1],["start",ac,"end"]);break;case"position":y=g.split(","),c.percent(m,y[0]),y.length===2&&c.alt("positionAlign",y[1],["start",ac,"end","line-left","line-right","auto"]);break;case"size":c.percent(m,g);break;case"align":c.alt(m,g,["start",ac,"end","left","right"]);break}},/:/,/\s/),d.region=c.get("region",null),d.vertical=c.get("vertical","");var f=c.get("line","auto");f==="auto"&&nh.line===-1&&(f=-1),d.line=f,d.lineAlign=c.get("lineAlign","start"),d.snapToLines=c.get("snapToLines",!0),d.size=c.get("size",100),d.align=c.get("align",ac);var v=c.get("position","auto");v==="auto"&&nh.position===50&&(v=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=v}function a(){s=s.replace(/^\s+/,"")}if(a(),l.startTime=e(),a(),s.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+r);s=s.slice(3),a(),l.endTime=e(),a(),t(s,l)}function sr(s){return s.replace(/<br(?: \/)?>/gi,`
`)}var Ri=function(){function s(){this.state="INITIAL",this.buffer="",this.decoder=new Zv,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var l=s.prototype;return l.parse=function(r){var e=this;r&&(e.buffer+=e.decoder.decode(r,{stream:!0}));function t(){var v=e.buffer,m=0;for(v=sr(v);m<v.length&&v[m]!=="\r"&&v[m]!==`
`;)++m;var g=v.slice(0,m);return v[m]==="\r"&&++m,v[m]===`
`&&++m,e.buffer=v.slice(m),g}function a(v){wf(v,function(m,g){},/:/)}try{var o="";if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;o=t();var d=o.match(/^(ï»¿)?WEBVTT([ \t].*)?$/);if(!(d!=null&&d[0]))throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var c=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(c?c=!1:o=t(),e.state){case"HEADER":/:/.test(o)?a(o):o||(e.state="ID");continue;case"NOTE":o||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(o)){e.state="NOTE";break}if(!o)continue;if(e.cue=new bd(0,0,""),e.state="CUE",o.indexOf("-->")===-1){e.cue.id=o;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{sh(o,e.cue,e.regionList)}catch(v){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{var f=o.indexOf("-->")!==-1;if(!o||f&&(c=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(e.cue===null)continue;e.cue.text&&(e.cue.text+=`
`),e.cue.text+=o}continue;case"BADCUE":o||(e.state="ID")}}}catch(v){e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},l.flush=function(){var r=this;try{if((r.cue||r.state==="HEADER")&&(r.buffer+=`

`,r.parse()),r.state==="INITIAL"||r.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(e){r.onparsingerror&&r.onparsingerror(e)}return r.onflush&&r.onflush(),this},s}(),em=/\r\n|\n\r|\n|\r/g,$l=function(l,n,r){return r===void 0&&(r=0),l.slice(r,r+n.length)===n},tm=function(l){var n=parseInt(l.slice(-3)),r=parseInt(l.slice(-6,-4)),e=parseInt(l.slice(-9,-7)),t=l.length>9?parseInt(l.substring(0,l.indexOf(":"))):0;if(!Ge(n)||!Ge(r)||!Ge(e)||!Ge(t))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return n+=1e3*r,n+=60*1e3*e,n+=60*60*1e3*t,n};function Td(s,l,n){return fd(s.toString())+fd(l.toString())+fd(n)}var Cf=function(l,n,r){var e=l[n],t=l[e.prevCC];if(!t||!t.new&&e.new){l.ccOffset=l.presentationOffset=e.start,e.new=!1;return}for(;(a=t)!=null&&a.new;){var a;l.ccOffset+=e.start-t.start,e.new=!1,e=t,t=l[e.prevCC]}l.presentationOffset=r};function is(s,l,n,r,e,t,a){var o=new Ri,d=Nt(new Uint8Array(s)).trim().replace(em,`
`).split(`
`),c=[],f=l?Pl(l.baseTime,l.timescale):0,v="00:00.000",m=0,g=0,y,b=!0;o.oncue=function(S){var L=n[r],C=n.ccOffset,F=(m-f)/9e4;if(L!=null&&L.new&&(g!==void 0?C=n.ccOffset=L.start:Cf(n,r,F)),F){if(!l){y=new Error("Missing initPTS for VTT MPEGTS");return}C=F-n.presentationOffset}var N=S.endTime-S.startTime,B=bn((S.startTime+C-g)*9e4,e*9e4)/9e4;S.startTime=Math.max(B,0),S.endTime=Math.max(B+N,0);var re=S.text.trim();S.text=decodeURIComponent(encodeURIComponent(re)),S.id||(S.id=Td(S.startTime,S.endTime,re)),S.endTime>0&&c.push(S)},o.onparsingerror=function(S){y=S},o.onflush=function(){if(y){a(y);return}t(c)},d.forEach(function(S){if(b)if($l(S,"X-TIMESTAMP-MAP=")){b=!1,S.slice(16).split(",").forEach(function(L){$l(L,"LOCAL:")?v=L.slice(6):$l(L,"MPEGTS:")&&(m=parseInt(L.slice(7)))});try{g=tm(v)/1e3}catch(L){y=L}return}else S===""&&(b=!1);o.parse(S+`
`)}),o.flush()}var nc="stpp.ttml.im1t",Df=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,oh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Mf={left:"start",center:"center",right:"end",start:"start",end:"end"};function Pf(s,l,n,r){var e=Ar(new Uint8Array(s),["mdat"]);if(e.length===0){r(new Error("Could not parse IMSC1 mdat"));return}var t=e.map(function(o){return Nt(o)}),a=an(l.baseTime,1,l.timescale);try{t.forEach(function(o){return n(rm(o,a))})}catch(o){r(o)}}function rm(s,l){var n=new DOMParser,r=n.parseFromString(s,"text/xml"),e=r.getElementsByTagName("tt")[0];if(!e)throw new Error("Invalid ttml");var t={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(t).reduce(function(v,m){return v[m]=e.getAttribute("ttp:"+m)||t[m],v},{}),o=e.getAttribute("xml:space")!=="preserve",d=Of(sc(e,"styling","style")),c=Of(sc(e,"layout","region")),f=sc(e,"body","[begin]");return[].map.call(f,function(v){var m=xf(v,o);if(!m||!v.hasAttribute("begin"))return null;var g=il(v.getAttribute("begin"),a),y=il(v.getAttribute("dur"),a),b=il(v.getAttribute("end"),a);if(g===null)throw Nf(v);if(b===null){if(y===null)throw Nf(v);b=g+y}var S=new bd(g-l,b-l,m);S.id=Td(S.startTime,S.endTime,S.text);var L=c[v.getAttribute("region")],C=d[v.getAttribute("style")],F=lh(L,C,d),N=F.textAlign;if(N){var B=Mf[N];B&&(S.lineAlign=B),S.align=N}return Qe(S,F),S}).filter(function(v){return v!==null})}function sc(s,l,n){var r=s.getElementsByTagName(l)[0];return r?[].slice.call(r.querySelectorAll(n)):[]}function Of(s){return s.reduce(function(l,n){var r=n.getAttribute("xml:id");return r&&(l[r]=n),l},{})}function xf(s,l){return[].slice.call(s.childNodes).reduce(function(n,r,e){var t;return r.nodeName==="br"&&e?n+`
`:(t=r.childNodes)!=null&&t.length?xf(r,l):l?n+r.textContent.trim().replace(/\s+/g," "):n+r.textContent},"")}function lh(s,l,n){var r="http://www.w3.org/ns/ttml#styling",e=null,t=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return a&&n.hasOwnProperty(a)&&(e=n[a]),t.reduce(function(o,d){var c=uh(l,r,d)||uh(s,r,d)||uh(e,r,d);return c&&(o[d]=c),o},{})}function uh(s,l,n){return s&&s.hasAttributeNS(l,n)?s.getAttributeNS(l,n):null}function Nf(s){return new Error("Could not parse ttml timestamp "+s)}function il(s,l){if(!s)return null;var n=Rf(s);return n===null&&(Df.test(s)?n=Nu(s,l):oh.test(s)&&(n=Vn(s,l))),n}function Nu(s,l){var n=Df.exec(s),r=(n[4]|0)+(n[5]|0)/l.subFrameRate;return(n[1]|0)*3600+(n[2]|0)*60+(n[3]|0)+r/l.frameRate}function Vn(s,l){var n=oh.exec(s),r=Number(n[1]),e=n[2];switch(e){case"h":return r*3600;case"m":return r*60;case"ms":return r*1e3;case"f":return r/l.frameRate;case"t":return r/l.tickRate}return r}var oc=function(){function s(n,r){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=n,this.trackName=r}var l=s.prototype;return l.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},l.newCue=function(r,e,t){(this.startTime===null||this.startTime>r)&&(this.startTime=r),this.endTime=e,this.screen=t,this.timelineController.createCaptionsTrack(this.trackName)},l.reset=function(){this.cueRanges=[],this.startTime=null},s}(),Uf=function(){function s(n){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=$a(),this.captionsProperties=void 0,this.hls=n,this.config=n.config,this.Cues=n.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},n.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),n.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(_.MANIFEST_LOADING,this.onManifestLoading,this),n.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),n.on(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.on(_.FRAG_LOADING,this.onFragLoading,this),n.on(_.FRAG_LOADED,this.onFragLoaded,this),n.on(_.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),n.on(_.FRAG_DECRYPTED,this.onFragDecrypted,this),n.on(_.INIT_PTS_FOUND,this.onInitPtsFound,this),n.on(_.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),n.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this)}var l=s.prototype;return l.destroy=function(){var r=this.hls;r.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),r.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(_.MANIFEST_LOADING,this.onManifestLoading,this),r.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),r.off(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),r.off(_.FRAG_LOADING,this.onFragLoading,this),r.off(_.FRAG_LOADED,this.onFragLoaded,this),r.off(_.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),r.off(_.FRAG_DECRYPTED,this.onFragDecrypted,this),r.off(_.INIT_PTS_FOUND,this.onInitPtsFound,this),r.off(_.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),r.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0},l.initCea608Parsers=function(){var r=new oc(this,"textTrack1"),e=new oc(this,"textTrack2"),t=new oc(this,"textTrack3"),a=new oc(this,"textTrack4");this.cea608Parser1=new kf(1,r,e),this.cea608Parser2=new kf(3,t,a)},l.addCues=function(r,e,t,a,o){for(var d=!1,c=o.length;c--;){var f=o[c],v=Ff(f[0],f[1],e,t);if(v>=0&&(f[0]=Math.min(f[0],e),f[1]=Math.max(f[1],t),d=!0,v/(t-e)>.5))return}if(d||o.push([e,t]),this.config.renderTextTracksNatively){var m=this.captionsTracks[r];this.Cues.newCue(m,e,t,a)}else{var g=this.Cues.newCue(null,e,t,a);this.hls.trigger(_.CUES_PARSED,{type:"captions",cues:g,track:r})}},l.onInitPtsFound=function(r,e){var t=this,a=e.frag,o=e.id,d=e.initPTS,c=e.timescale,f=e.trackId,v=this.unparsedVttFrags;o===Ie.MAIN&&(this.initPTS[a.cc]={baseTime:d,timescale:c,trackId:f}),v.length&&(this.unparsedVttFrags=[],v.forEach(function(m){t.initPTS[m.frag.cc]?t.onFragLoaded(_.FRAG_LOADED,m):t.hls.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))},l.getExistingTrack=function(r,e){var t=this.media;if(t)for(var a=0;a<t.textTracks.length;a++){var o=t.textTracks[a];if(as(o,{name:r,lang:e,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return o}return null},l.createCaptionsTrack=function(r){this.config.renderTextTracksNatively?this.createNativeTrack(r):this.createNonNativeTrack(r)},l.createNativeTrack=function(r){if(!this.captionsTracks[r]){var e=this.captionsProperties,t=this.captionsTracks,a=this.media,o=e[r],d=o.label,c=o.languageCode,f=this.getExistingTrack(d,c);if(f)t[r]=f,ro(t[r]),gd(t[r],a);else{var v=this.createTextTrack("captions",d,c);v&&(v[r]=!0,t[r]=v)}}},l.createNonNativeTrack=function(r){if(!this.nonNativeCaptionsTracks[r]){var e=this.captionsProperties[r];if(e){var t=e.label,a={_id:r,label:t,kind:"captions",default:e.media?!!e.media.default:!1,closedCaptions:e.media};this.nonNativeCaptionsTracks[r]=a,this.hls.trigger(_.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[a]})}}},l.createTextTrack=function(r,e,t){var a=this.media;if(a)return a.addTextTrack(r,e,t)},l.onMediaAttaching=function(r,e){this.media=e.media,e.mediaSource||this._cleanTracks()},l.onMediaDetaching=function(r,e){var t=!!e.transferMedia;if(this.media=null,!t){var a=this.captionsTracks;Object.keys(a).forEach(function(o){ro(a[o]),delete a[o]}),this.nonNativeCaptionsTracks={}}},l.onManifestLoading=function(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=$a(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},l._cleanTracks=function(){var r=this.media;if(r){var e=r.textTracks;if(e)for(var t=0;t<e.length;t++)ro(e[t])}},l.onSubtitleTracksUpdated=function(r,e){var t=this,a=e.subtitleTracks||[],o=a.some(function(g){return g.textCodec===nc});if(this.config.enableWebVTT||o&&this.config.enableIMSC1){var d=Jh(this.tracks,a);if(d){this.tracks=a;return}if(this.textTracks=[],this.tracks=a,this.config.renderTextTracksNatively){var c=this.media,f=c?Ro(c.textTracks):null;if(this.tracks.forEach(function(g,y){var b;if(f){for(var S=null,L=0;L<f.length;L++)if(f[L]&&as(f[L],g)){S=f[L],f[L]=null;break}S&&(b=S)}if(b)ro(b);else{var C=io(g);b=t.createTextTrack(C,g.name,g.lang),b&&(b.mode="disabled")}b&&t.textTracks.push(b)}),f!=null&&f.length){var v=f.filter(function(g){return g!==null}).map(function(g){return g.label});v.length&&this.hls.logger.warn("Media element contains unused subtitle tracks: "+v.join(", ")+". Replace media element for each source to clear TextTracks and captions menu.")}}else if(this.tracks.length){var m=this.tracks.map(function(g){return{label:g.name,kind:g.type.toLowerCase(),default:g.default,subtitleTrack:g}});this.hls.trigger(_.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:m})}}},l.onManifestLoaded=function(r,e){var t=this;this.config.enableCEA708Captions&&e.captions&&e.captions.forEach(function(a){var o=/(?:CC|SERVICE)([1-4])/.exec(a.instreamId);if(o){var d="textTrack"+o[1],c=t.captionsProperties[d];c&&(c.label=a.name,a.lang&&(c.languageCode=a.lang),c.media=a)}})},l.closedCaptionsForLevel=function(r){var e=this.hls.levels[r.level];return e==null?void 0:e.attrs["CLOSED-CAPTIONS"]},l.onFragLoading=function(r,e){if(this.enabled&&e.frag.type===Ie.MAIN){var t,a,o=this.cea608Parser1,d=this.cea608Parser2,c=this.lastSn,f=e.frag,v=f.cc,m=f.sn,g=(t=(a=e.part)==null?void 0:a.index)!=null?t:-1;o&&d&&(m!==c+1||m===c&&g!==this.lastPartIndex+1||v!==this.lastCc)&&(o.reset(),d.reset()),this.lastCc=v,this.lastSn=m,this.lastPartIndex=g}},l.onFragLoaded=function(r,e){var t=e.frag,a=e.payload;if(t.type===Ie.SUBTITLE)if(a.byteLength){var o=t.decryptdata,d="stats"in e;if(o==null||!o.encrypted||d){var c=this.tracks[t.level],f=this.vttCCs;f[t.cc]||(f[t.cc]={start:t.start,prevCC:this.prevCC,new:!0},this.prevCC=t.cc),c&&c.textCodec===nc?this._parseIMSC1(t,a):this._parseVTTs(e)}}else this.hls.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:new Error("Empty subtitle payload")})},l._parseIMSC1=function(r,e){var t=this,a=this.hls;Pf(e,this.initPTS[r.cc],function(o){t._appendCues(o,r.level),a.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},function(o){a.logger.log("Failed to parse IMSC1: "+o),a.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:o})})},l._parseVTTs=function(r){var e,t=this,a=r.frag,o=r.payload,d=this.initPTS,c=this.unparsedVttFrags,f=d.length-1;if(!d[a.cc]&&f===-1){c.push(r);return}var v=this.hls,m=(e=a.initSegment)!=null&&e.data?ie(a.initSegment.data,new Uint8Array(o)).buffer:o;is(m,this.initPTS[a.cc],this.vttCCs,a.cc,a.start,function(g){t._appendCues(g,a.level),v.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},function(g){var y=g.message==="Missing initPTS for VTT MPEGTS";y?c.push(r):t._fallbackToIMSC1(a,o),v.logger.log("Failed to parse VTT cue: "+g),!(y&&f>a.cc)&&v.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:g})})},l._fallbackToIMSC1=function(r,e){var t=this,a=this.tracks[r.level];a.textCodec||Pf(e,this.initPTS[r.cc],function(){a.textCodec=nc,t._parseIMSC1(r,e)},function(){a.textCodec="wvtt"})},l._appendCues=function(r,e){var t=this.hls;if(this.config.renderTextTracksNatively){var a=this.textTracks[e];if(!a||a.mode==="disabled")return;r.forEach(function(c){return Ed(a,c)})}else{var o=this.tracks[e];if(!o)return;var d=o.default?"default":"subtitles"+e;t.trigger(_.CUES_PARSED,{type:"subtitles",cues:r,track:d})}},l.onFragDecrypted=function(r,e){var t=e.frag;t.type===Ie.SUBTITLE&&this.onFragLoaded(_.FRAG_LOADED,e)},l.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},l.onFragParsingUserdata=function(r,e){if(!(!this.enabled||!this.config.enableCEA708Captions)){var t=e.frag,a=e.samples;if(!(t.type===Ie.MAIN&&this.closedCaptionsForLevel(t)==="NONE"))for(var o=0;o<a.length;o++){var d=a[o].bytes;if(d){this.cea608Parser1||this.initCea608Parsers();var c=this.extractCea608Data(d);this.cea608Parser1.addData(a[o].pts,c[0]),this.cea608Parser2.addData(a[o].pts,c[1])}}}},l.onBufferFlushing=function(r,e){var t=e.startOffset,a=e.endOffset,o=e.endOffsetSubtitles,d=e.type,c=this.media;if(!(!c||c.currentTime<a)){if(!d||d==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(m){return Yl(f[m],t,a)})}if(this.config.renderTextTracksNatively&&t===0&&o!==void 0){var v=this.textTracks;Object.keys(v).forEach(function(m){return Yl(v[m],t,o)})}}},l.extractCea608Data=function(r){for(var e=[[],[]],t=r[0]&31,a=2,o=0;o<t;o++){var d=r[a++],c=127&r[a++],f=127&r[a++];if(!(c===0&&f===0)){var v=(4&d)!==0;if(v){var m=3&d;(m===0||m===1)&&(e[m].push(c),e[m].push(f))}}}return e},s}();function io(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function as(s,l){return!!s&&s.kind===io(l)&&Nc(l,s)}function Ff(s,l,n,r){return Math.min(l,r)-Math.max(s,n)}function $a(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}var al=/\s/,Jm={newCue:function(l,n,r,e){for(var t=[],a,o,d,c,f,v=self.VTTCue||self.TextTrackCue,m=0;m<e.rows.length;m++)if(a=e.rows[m],d=!0,c=0,f="",!a.isEmpty()){for(var g,y=0;y<a.chars.length;y++)al.test(a.chars[y].uchar)&&d?c++:(f+=a.chars[y].uchar,d=!1);a.cueStartTime=n,n===r&&(r+=1e-4),c>=16?c--:c++;var b=sr(f.trim()),S=Td(n,r,b);l!=null&&(g=l.cues)!=null&&g.getCueById(S)||(o=new v(n,r,b),o.id=S,o.line=m+1,o.align="left",o.position=10+Math.min(80,Math.floor(c*8/32)*10),t.push(o))}return l&&t.length&&(t.sort(function(L,C){return L.line==="auto"||C.line==="auto"?0:L.line>8&&C.line>8?C.line-L.line:L.line-C.line}),t.forEach(function(L){return Ed(l,L)})),t}};function Bf(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var im=/(\d+)-(\d+)\/(\d+)/,Hf=function(){function s(n){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=n.fetchSetup||Vf,this.controller=new self.AbortController,this.stats=new zr}var l=s.prototype;return l.destroy=function(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null},l.abortInternal=function(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())},l.abort=function(){var r;this.abortInternal(),(r=this.callbacks)!=null&&r.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},l.load=function(r,e,t){var a=this,o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();var d=am(r,this.controller.signal),c=r.responseType==="arraybuffer",f=c?"byteLength":"length",v=e.loadPolicy,m=v.maxTimeToFirstByteMs,g=v.maxLoadTimeMs;this.context=r,this.config=e,this.callbacks=t,this.request=this.fetchSetup(r,d),self.clearTimeout(this.requestTimeout),e.timeout=m&&Ge(m)?m:g,this.requestTimeout=self.setTimeout(function(){a.callbacks&&(a.abortInternal(),a.callbacks.onTimeout(o,r,a.response))},e.timeout);var y=p(this.request)?this.request.then(self.fetch):self.fetch(this.request);y.then(function(b){var S;a.response=a.loader=b;var L=Math.max(self.performance.now(),o.loading.start);if(self.clearTimeout(a.requestTimeout),e.timeout=g,a.requestTimeout=self.setTimeout(function(){a.callbacks&&(a.abortInternal(),a.callbacks.onTimeout(o,r,a.response))},g-(L-o.loading.start)),!b.ok){var C=b.status,F=b.statusText;throw new Gf(F||"fetch, bad network response",C,b)}o.loading.first=L,o.total=_d(b.headers)||o.total;var N=(S=a.callbacks)==null?void 0:S.onProgress;return N&&Ge(e.highWaterMark)?a.loadProgressively(b,o,r,e.highWaterMark,N):c?b.arrayBuffer():r.responseType==="json"?b.json():b.text()}).then(function(b){var S,L,C=a.response;if(!C)throw new Error("loader destroyed");self.clearTimeout(a.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first);var F=b[f];F&&(o.loaded=o.total=F);var N={url:C.url,data:b,code:C.status},B=(S=a.callbacks)==null?void 0:S.onProgress;B&&!Ge(e.highWaterMark)&&B(o,r,b,C),(L=a.callbacks)==null||L.onSuccess(N,o,r,C)}).catch(function(b){var S;if(self.clearTimeout(a.requestTimeout),!o.aborted){var L=b&&b.code||0,C=b?b.message:null;(S=a.callbacks)==null||S.onError({code:L,text:C},r,b?b.details:null,o)}})},l.getCacheAge=function(){var r=null;if(this.response){var e=this.response.headers.get("age");r=e?parseFloat(e):null}return r},l.getResponseHeader=function(r){return this.response?this.response.headers.get(r):null},l.loadProgressively=function(r,e,t,a,o){a===void 0&&(a=0);var d=new Zu,c=r.body.getReader(),f=function(){return c.read().then(function(m){if(m.done)return d.dataLength&&o(e,t,d.flush().buffer,r),Promise.resolve(new ArrayBuffer(0));var g=m.value,y=g.length;return e.loaded+=y,y<a||d.dataLength?(d.push(g),d.dataLength>=a&&o(e,t,d.flush().buffer,r)):o(e,t,g.buffer,r),f()}).catch(function(){return Promise.reject()})};return f()},s}();function am(s,l){var n={method:"GET",mode:"cors",credentials:"same-origin",signal:l,headers:new self.Headers(Qe({},s.headers))};return s.rangeEnd&&n.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),n}function nm(s){var l=im.exec(s);if(l)return parseInt(l[2])-parseInt(l[1])+1}function _d(s){var l=s.get("Content-Range");if(l){var n=nm(l);if(Ge(n))return n}var r=s.get("Content-Length");if(r)return parseInt(r)}function Vf(s,l){return new self.Request(s.url,l)}var Gf=function(s){function l(n,r,e){var t;return t=s.call(this,n)||this,t.code=void 0,t.details=void 0,t.code=r,t.details=e,t}return Pe(l,s),l}(Et(Error)),ai=/^age:\s*[\d.]+\s*$/im,Fs=function(){function s(n){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=n&&n.xhrSetup||null,this.stats=new zr,this.retryDelay=0}var l=s.prototype;return l.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null},l.abortInternal=function(){var r=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),r&&(r.onreadystatechange=null,r.onprogress=null,r.readyState!==4&&(this.stats.aborted=!0,r.abort()))},l.abort=function(){var r;this.abortInternal(),(r=this.callbacks)!=null&&r.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},l.load=function(r,e,t){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=r,this.config=e,this.callbacks=t,this.loadInternal()},l.loadInternal=function(){var r=this,e=this.config,t=this.context;if(!(!e||!t)){var a=this.loader=new self.XMLHttpRequest,o=this.stats;o.loading.first=0,o.loaded=0,o.aborted=!1;var d=this.xhrSetup;d?Promise.resolve().then(function(){if(!(r.loader!==a||r.stats.aborted))return d(a,t.url)}).catch(function(c){if(!(r.loader!==a||r.stats.aborted))return a.open("GET",t.url,!0),d(a,t.url)}).then(function(){r.loader!==a||r.stats.aborted||r.openAndSendXhr(a,t,e)}).catch(function(c){var f;(f=r.callbacks)==null||f.onError({code:a.status,text:c.message},t,a,o)}):this.openAndSendXhr(a,t,e)}},l.openAndSendXhr=function(r,e,t){r.readyState||r.open("GET",e.url,!0);var a=e.headers,o=t.loadPolicy,d=o.maxTimeToFirstByteMs,c=o.maxLoadTimeMs;if(a)for(var f in a)r.setRequestHeader(f,a[f]);e.rangeEnd&&r.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),r.onreadystatechange=this.readystatechange.bind(this),r.onprogress=this.loadprogress.bind(this),r.responseType=e.responseType,self.clearTimeout(this.requestTimeout),t.timeout=d&&Ge(d)?d:c,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),t.timeout),r.send()},l.readystatechange=function(){var r=this.context,e=this.loader,t=this.stats;if(!(!r||!e)){var a=e.readyState,o=this.config;if(!t.aborted&&a>=2&&(t.loading.first===0&&(t.loading.first=Math.max(self.performance.now(),t.loading.start),o.timeout!==o.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),o.timeout=o.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.loadPolicy.maxLoadTimeMs-(t.loading.first-t.loading.start)))),a===4)){self.clearTimeout(this.requestTimeout),e.onreadystatechange=null,e.onprogress=null;var d=e.status,c=e.responseType==="text"?e.responseText:null;if(d>=200&&d<300){var f=c!=null?c:e.response;if(f!=null){var v,m;t.loading.end=Math.max(self.performance.now(),t.loading.first);var g=e.responseType==="arraybuffer"?f.byteLength:f.length;t.loaded=t.total=g,t.bwEstimate=t.total*8e3/(t.loading.end-t.loading.first);var y=(v=this.callbacks)==null?void 0:v.onProgress;y&&y(t,r,f,e);var b={url:e.responseURL,data:f,code:d};(m=this.callbacks)==null||m.onSuccess(b,t,r,e);return}}var S=o.loadPolicy.errorRetry,L=t.retry,C={url:r.url,data:void 0,code:d};if(Yn(S,L,!1,C))this.retry(S);else{var F;U.error(d+" while loading "+r.url),(F=this.callbacks)==null||F.onError({code:d,text:e.statusText},r,e,t)}}}},l.loadtimeout=function(){if(this.config){var r=this.config.loadPolicy.timeoutRetry,e=this.stats.retry;if(Yn(r,e,!0))this.retry(r);else{var t;U.warn("timeout while loading "+((t=this.context)==null?void 0:t.url));var a=this.callbacks;a&&(this.abortInternal(),a.onTimeout(this.stats,this.context,this.loader))}}},l.retry=function(r){var e=this.context,t=this.stats;this.retryDelay=ki(r,t.retry),t.retry++,U.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+(e==null?void 0:e.url)+", retrying "+t.retry+"/"+r.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)},l.loadprogress=function(r){var e=this.stats;e.loaded=r.loaded,r.lengthComputable&&(e.total=r.total)},l.getCacheAge=function(){var r=null;if(this.loader&&ai.test(this.loader.getAllResponseHeaders())){var e=this.loader.getResponseHeader("age");r=e?parseFloat(e):null}return r},l.getResponseHeader=function(r){return this.loader&&new RegExp("^"+r+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(r):null},s}(),wo={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Uu=j(j({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:Fs,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Ws,bufferController:tf,capLevelController:Vd,errorController:le,fpsController:es,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Gt,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:wo},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},lc()),{},{subtitleStreamController:Xd,subtitleTrackController:yd,timelineController:Uf,audioStreamController:Hd,audioTrackController:Rv,emeController:_f,cmcdController:yf,contentSteeringController:Qc,interstitialsController:Mu});function lc(){return{cueHandler:Jm,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function ql(s,l,n){if((l.liveSyncDurationCount||l.liveMaxLatencyDurationCount)&&(l.liveSyncDuration||l.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(l.liveMaxLatencyDurationCount!==void 0&&(l.liveSyncDurationCount===void 0||l.liveMaxLatencyDurationCount<=l.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(l.liveMaxLatencyDuration!==void 0&&(l.liveSyncDuration===void 0||l.liveMaxLatencyDuration<=l.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var r=jl(s),e=["manifest","level","frag"],t=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return e.forEach(function(a){var o=(a==="level"?"playlist":a)+"LoadPolicy",d=l[o]===void 0,c=[];t.forEach(function(f){var v=a+"Loading"+f,m=l[v];if(m!==void 0&&d){c.push(v);var g=r[o].default;switch(l[o]={default:g},f){case"TimeOut":g.maxLoadTimeMs=m,g.maxTimeToFirstByteMs=m;break;case"MaxRetry":g.errorRetry.maxNumRetry=m,g.timeoutRetry.maxNumRetry=m;break;case"RetryDelay":g.errorRetry.retryDelayMs=m,g.timeoutRetry.retryDelayMs=m;break;case"MaxRetryTimeout":g.errorRetry.maxRetryDelayMs=m,g.timeoutRetry.maxRetryDelayMs=m;break}}}),c.length&&n.warn('hls.js config: "'+c.join('", "')+'" setting(s) are deprecated, use "'+o+'": '+ur(l[o]))}),j(j({},r),l)}function jl(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(jl):Object.keys(s).reduce(function(l,n){return l[n]=jl(s[n]),l},{}):s}function nl(s,l){var n=s.loader;if(n!==Hf&&n!==Fs)l.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var r=Bf();r&&(s.loader=Hf,s.progressive=!0,s.enableSoftwareAES=!0,l.log("[config]: Progressive streaming enabled, using FetchLoader"))}}var Bs=2,sl=.1,zl=.05,Fu=100,uc=function(s){function l(r,e){var t;return t=s.call(this,"gap-controller",r.logger)||this,t.hls=void 0,t.fragmentTracker=void 0,t.media=null,t.mediaSource=void 0,t.nudgeRetry=0,t.stallReported=!1,t.stalled=null,t.moved=!1,t.seeking=!1,t.buffered={},t.lastCurrentTime=0,t.ended=0,t.waiting=0,t.onMediaPlaying=function(){t.ended=0,t.waiting=0},t.onMediaWaiting=function(){var a;(a=t.media)!=null&&a.seeking||(t.waiting=self.performance.now(),t.tick())},t.onMediaEnded=function(){if(t.hls){var a;t.ended=((a=t.media)==null?void 0:a.currentTime)||1,t.hls.trigger(_.MEDIA_ENDED,{stalled:!1})}},t.hls=r,t.fragmentTracker=e,t.registerListeners(),t}Pe(l,s);var n=l.prototype;return n.registerListeners=function(){var e=this.hls;e&&(e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.BUFFER_APPENDED,this.onBufferAppended,this))},n.unregisterListeners=function(){var e=this.hls;e&&(e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.BUFFER_APPENDED,this.onBufferAppended,this))},n.destroy=function(){s.prototype.destroy.call(this),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0},n.onMediaAttached=function(e,t){this.setInterval(Fu),this.mediaSource=t.mediaSource;var a=this.media=t.media;Ea(a,"playing",this.onMediaPlaying),Ea(a,"waiting",this.onMediaWaiting),Ea(a,"ended",this.onMediaEnded)},n.onMediaDetaching=function(e,t){this.clearInterval();var a=this.media;a&&(Ia(a,"playing",this.onMediaPlaying),Ia(a,"waiting",this.onMediaWaiting),Ia(a,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0},n.onBufferAppended=function(e,t){this.buffered=t.timeRanges},n.tick=function(){var e;if(!(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)){var t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}},n.poll=function(e,t){var a,o,d=(a=this.hls)==null?void 0:a.config;if(d){var c=this.media;if(c){var f=c.seeking,v=this.seeking&&!f,m=!this.seeking&&f,g=c.paused&&!f||c.ended||c.playbackRate===0;if(this.seeking=f,e!==t){t&&(this.ended=0),this.moved=!0,f||(this.nudgeRetry=0,d.nudgeOnVideoHole&&!g&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(m||v){v&&this.stallResolved(e);return}if(g){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&c.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(_.MEDIA_ENDED,{stalled:!1}));return}if(!Pr.getBuffered(c).length){this.nudgeRetry=0;return}var y=Pr.bufferInfo(c,e,0),b=y.nextStart||0,S=this.fragmentTracker;if(f&&S&&this.hls){var L=gs(this.hls.inFlightFragments,e),C=y.len>Bs,F=!b||L||b-e>Bs&&!S.getPartialFragment(e);if(C||F)return;this.moved=!1}var N=(o=this.hls)==null?void 0:o.latestLevelDetails;if(!this.moved&&this.stalled!==null&&S){var B=y.len>0;if(!B&&!b)return;var re=Math.max(b,y.start||0)-e,ce=!!(N!=null&&N.live),Se=ce?N.targetduration*2:Bs,Ke=Ad(e,S);if(re>0&&(re<=Se||Ke)){c.paused||this._trySkipBufferHole(Ke);return}}var be=d.detectStallWithCurrentTimeMs,Z=self.performance.now(),ne=this.waiting,Re=this.stalled;if(Re===null)if(ne>0&&Z-ne<be)Re=this.stalled=ne;else{this.stalled=Z;return}var Tt=Z-Re;if(!f&&(Tt>=be||ne)&&this.hls){var ot;if(((ot=this.mediaSource)==null?void 0:ot.readyState)==="ended"&&!(N!=null&&N.live)&&Math.abs(e-((N==null?void 0:N.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(_.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(y),!this.media||!this.hls)return}var pt=Pr.bufferInfo(c,e,d.maxBufferHole);this._tryFixBufferStall(pt,Tt,e)}}},n.stallResolved=function(e){var t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){var a=self.performance.now()-t;this.log("playback not stuck anymore @"+e+", after "+Math.round(a)+"ms"),this.stallReported=!1,this.waiting=0,this.hls.trigger(_.STALL_RESOLVED,{})}},n.nudgeOnVideoHole=function(e,t){var a,o=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(a=this.buffered.audio)!=null&&a.length&&o&&o.length>1&&e>o.end(0)){var d=Pr.bufferedInfo(Pr.timeRangesToArray(this.buffered.audio),e,0);if(d.len>1&&t>=d.start){var c=Pr.timeRangesToArray(o),f=Pr.bufferedInfo(c,t,0).bufferedIndex;if(f>-1&&f<c.length-1){var v=Pr.bufferedInfo(c,e,0).bufferedIndex,m=c[f].end,g=c[f+1].start;if((v===-1||v>f)&&g-m<1&&e-m<2){var y=new Error("nudging playhead to flush pipeline after video hole. currentTime: "+e+" hole: "+m+" -> "+g+" buffered index: "+v);this.warn(y.message),this.media.currentTime+=1e-6;var b=Ad(e,this.fragmentTracker);b&&"fragment"in b?b=b.fragment:b||(b=void 0);var S=Pr.bufferInfo(this.media,e,0);this.hls.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:y,reason:y.message,frag:b,buffer:S.len,bufferInfo:S})}}}}},n._tryFixBufferStall=function(e,t,a){var o,d,c=this.fragmentTracker,f=this.media,v=(o=this.hls)==null?void 0:o.config;if(!(!f||!c||!v)){var m=(d=this.hls)==null?void 0:d.latestLevelDetails,g=Ad(a,c);if(g||m!=null&&m.live&&a<m.fragmentStart){var y=this._trySkipBufferHole(g);if(y||!this.media)return}var b=e.buffered,S=this.adjacentTraversal(e,a);(b&&b.length>1&&e.len>v.maxBufferHole||e.nextStart&&(e.nextStart-a<v.maxBufferHole||S))&&(t>v.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}},n.adjacentTraversal=function(e,t){var a=this.fragmentTracker,o=e.nextStart;if(a&&o){var d=a.getFragAtPos(t,Ie.MAIN),c=a.getFragAtPos(o,Ie.MAIN);if(d&&c)return c.sn-d.sn<2}return!1},n._reportStall=function(e){var t=this.hls,a=this.media,o=this.stallReported,d=this.stalled;if(!o&&d!==null&&a&&t){this.stallReported=!0;var c=new Error("Playback stalling at @"+a.currentTime+" due to low buffer ("+ur(e)+")");this.warn(c.message),t.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.BUFFER_STALLED_ERROR,fatal:!1,error:c,buffer:e.len,bufferInfo:e,stalled:{start:d}})}},n._trySkipBufferHole=function(e){var t,a=this.fragmentTracker,o=this.media,d=(t=this.hls)==null?void 0:t.config;if(!o||!a||!d)return 0;var c=o.currentTime,f=Pr.bufferInfo(o,c,0),v=c<f.start?f.start:f.nextStart;if(v&&this.hls){var m=f.len<=d.maxBufferHole,g=f.len>0&&f.len<1&&o.readyState<3,y=v-c;if(y>0&&(m||g)){if(y>d.maxBufferHole){var b=!1;if(c===0){var S=a.getAppendedFrag(0,Ie.MAIN);S&&v<S.end&&(b=!0)}if(!b&&e){var L;if(!((L=this.hls.loadLevelObj)!=null&&L.details))return 0;var C=gs(this.hls.inFlightFragments,v);if(C)return 0;for(var F=!1,N=e.end;N<v;){var B=Ad(N,a);if(B)N+=B.duration;else{F=!0;break}}if(F)return 0}}var re=Math.max(v+zl,c+sl);if(this.warn("skipping hole, adjusting currentTime from "+c+" to "+re),this.moved=!0,o.currentTime=re,!(e!=null&&e.gap)){var ce=new Error("fragment loaded with buffer holes, seeking from "+c+" to "+re),Se={type:ut.MEDIA_ERROR,details:Q.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:ce,reason:ce.message,buffer:f.len,bufferInfo:f};e&&("fragment"in e?Se.part=e:Se.frag=e),this.hls.trigger(_.ERROR,Se)}return re}}return 0},n._tryNudgeBuffer=function(e){var t=this.hls,a=this.media,o=this.nudgeRetry,d=t==null?void 0:t.config;if(!a||!d)return 0;var c=a.currentTime;if(this.nudgeRetry++,o<d.nudgeMaxRetry){var f=c+(o+1)*d.nudgeOffset,v=new Error("Nudging 'currentTime' from "+c+" to "+f);this.warn(v.message),a.currentTime=f,t.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.BUFFER_NUDGE_ON_STALL,error:v,fatal:!1,buffer:e.len,bufferInfo:e})}else{var m=new Error("Playhead still not moving while enough data buffered @"+c+" after "+d.nudgeMaxRetry+" nudges");this.error(m.message),t.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.BUFFER_STALLED_ERROR,error:m,fatal:!0,buffer:e.len,bufferInfo:e})}},Ne(l,[{key:"hasBuffered",get:function(){return Object.keys(this.buffered).length>0}}])}(Va);function gs(s,l){var n=dh(s.main);if(n&&n.start<=l)return n;var r=dh(s.audio);return r&&r.start<=l?r:null}function dh(s){if(!s)return null;switch(s.state){case nt.IDLE:case nt.STOPPED:case nt.ENDED:case nt.ERROR:return null}return s.frag}function Ad(s,l){return l.getAppendedFrag(s,Ie.MAIN)||l.getPartialFragment(s)}var sm=.25;function ch(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Bu(s,l,n,r,e){var t=new s(l,n,"");try{t.value=r,e&&(t.type=e)}catch(a){t=new s(l,n,ur(e?j({type:e},r):r))}return t}var Sd=function(){var s=ch();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch(l){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}(),Kf=function(){function s(n){var r=this;this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=function(){r.hls&&r.hls.trigger(_.EVENT_CUE_ENTER,{})},this.hls=n,this._registerListeners()}var l=s.prototype;return l.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null},l._registerListeners=function(){var r=this.hls;r&&(r.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),r.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(_.MANIFEST_LOADING,this.onManifestLoading,this),r.on(_.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),r.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),r.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),r.on(_.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))},l._unregisterListeners=function(){var r=this.hls;r&&(r.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),r.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(_.MANIFEST_LOADING,this.onManifestLoading,this),r.off(_.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),r.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),r.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),r.off(_.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))},l.onMediaAttaching=function(r,e){var t;this.media=e.media,((t=e.overrides)==null?void 0:t.cueRemoval)===!1&&(this.removeCues=!1)},l.onMediaAttached=function(){var r,e=(r=this.hls)==null?void 0:r.latestLevelDetails;e&&this.updateDateRangeCues(e)},l.onMediaDetaching=function(r,e){this.media=null;var t=!!e.transferMedia;t||(this.id3Track&&(this.removeCues&&ro(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})},l.onManifestLoading=function(){this.dateRangeCuesAppended={}},l.createTrack=function(r){var e=this.getID3Track(r.textTracks);return e.mode="hidden",e},l.getID3Track=function(r){if(this.media){for(var e=0;e<r.length;e++){var t=r[e];if(t.kind==="metadata"&&t.label==="id3")return gd(t,this.media),t}return this.media.addTextTrack("metadata","id3")}},l.onFragParsingMetadata=function(r,e){if(!(!this.media||!this.hls)){var t=this.hls.config,a=t.enableEmsgMetadataCues,o=t.enableID3MetadataCues;if(!(!a&&!o)){var d=e.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));var c=ch();if(c)for(var f=0;f<d.length;f++){var v=d[f].type;if(!(v===Ii.emsg&&!a||!o)){var m=Wo(d[f].data),g=d[f].pts,y=g+d[f].duration;y>Sd&&(y=Sd);var b=y-g;b<=0&&(y=g+sm);for(var S=0;S<m.length;S++){var L=m[S];if(!Un(L)){this.updateId3CueEnds(g,v);var C=Bu(c,g,y,L,v);C&&this.id3Track.addCue(C)}}}}}}},l.updateId3CueEnds=function(r,e){var t,a=(t=this.id3Track)==null?void 0:t.cues;if(a)for(var o=a.length;o--;){var d=a[o];d.type===e&&d.startTime<r&&d.endTime===Sd&&(d.endTime=r)}},l.onBufferFlushing=function(r,e){var t=e.startOffset,a=e.endOffset,o=e.type,d=this.id3Track,c=this.hls;if(c){var f=c.config,v=f.enableEmsgMetadataCues,m=f.enableID3MetadataCues;if(d&&(v||m)){var g;o==="audio"?g=function(b){return b.type===Ii.audioId3&&m}:o==="video"?g=function(b){return b.type===Ii.emsg&&v}:g=function(b){return b.type===Ii.audioId3&&m||b.type===Ii.emsg&&v},Yl(d,t,a,g)}}},l.onLevelUpdated=function(r,e){var t=e.details;this.updateDateRangeCues(t,!0)},l.onLevelPtsUpdated=function(r,e){Math.abs(e.drift)>.01&&this.updateDateRangeCues(e.details)},l.updateDateRangeCues=function(r,e){var t=this;if(!(!this.hls||!this.media)){var a=this.hls.config,o=a.assetPlayerId,d=a.timelineOffset,c=a.enableDateRangeMetadataCues,f=a.interstitialsController;if(c){var v=ch();if(o&&d&&!f){var m=r.fragmentStart,g=r.fragmentEnd,y=this.assetCue;y?(y.startTime=m,y.endTime=g):v&&(y=this.assetCue=Bu(v,m,g,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),y&&(y.id=o,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(y),y.addEventListener("enter",this.onEventCueEnter)))}if(r.hasProgramDateTime){var b=this.id3Track,S=r.dateRanges,L=Object.keys(S),C=this.dateRangeCuesAppended;if(b&&e){var F;if((F=b.cues)!=null&&F.length)for(var N=Object.keys(C).filter(function(be){return!L.includes(be)}),B=function(){var Z,ne=N[re],Re=(Z=C[ne])==null?void 0:Z.cues;delete C[ne],Re&&Object.keys(Re).forEach(function(Tt){var ot=Re[Tt];if(ot){ot.removeEventListener("enter",t.onEventCueEnter);try{b.removeCue(ot)}catch(pt){}}})},re=N.length;re--;)B();else C=this.dateRangeCuesAppended={}}var ce=r.fragments[r.fragments.length-1];if(!(L.length===0||!Ge(ce==null?void 0:ce.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var Se=function(){var Z=L[Ke],ne=S[Z],Re=ne.startTime,Tt=C[Z],ot=(Tt==null?void 0:Tt.cues)||{},pt=(Tt==null?void 0:Tt.durationKnown)||!1,Bt=Sd,cr=ne.duration,or=ne.endDate;if(or&&cr!==null)Bt=Re+cr,pt=!0;else if(ne.endOnNext&&!pt){var hr=L.reduce(function(ji,ia){if(ia!==ne.id){var Fi=S[ia];if(Fi.class===ne.class&&Fi.startDate>ne.startDate&&(!ji||ne.startDate<ji.startDate))return Fi}return ji},null);hr&&(Bt=hr.startTime,pt=!0)}for(var xr=Object.keys(ne.attr),fr=0;fr<xr.length;fr++){var lr=xr[fr];if(gl(lr)){var _r=ot[lr];if(_r)pt&&!(Tt!=null&&Tt.durationKnown)?_r.endTime=Bt:Math.abs(_r.startTime-Re)>.01&&(_r.startTime=Re,_r.endTime=Bt);else if(v){var Dr=ne.attr[lr];lu(lr)&&(Dr=Lr(Dr));var bi={key:lr,data:Dr},jr=Bu(v,Re,Bt,bi,Ii.dateRange);jr&&(jr.id=Z,t.id3Track.addCue(jr),ot[lr]=jr,f&&(lr==="X-ASSET-LIST"||lr==="X-ASSET-URL")&&jr.addEventListener("enter",t.onEventCueEnter))}}}C[Z]={cues:ot,dateRange:ne,durationKnown:pt}},Ke=0;Ke<L.length;Ke++)Se()}}}}},s}(),Wf=function(){function s(n){var r=this;this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=function(){var e=r.media,t=r.levelDetails;if(!(!e||!t)){r.currentTime=e.currentTime;var a=r.computeLatency();if(a!==null){r._latency=a;var o=r.config,d=o.lowLatencyMode,c=o.maxLiveSyncPlaybackRate;if(!(!d||c===1||!t.live)){var f=r.targetLatency;if(f!==null){var v=a-f,m=Math.min(r.maxLatency,f+t.targetduration),g=v<m;if(g&&v>.05&&r.forwardBufferLength>1){var y=Math.min(2,Math.max(1,c)),b=Math.round(2/(1+Math.exp(-.75*v-r.edgeStalled))*20)/20,S=Math.min(y,Math.max(1,b));r.changeMediaPlaybackRate(e,S)}else e.playbackRate!==1&&e.playbackRate!==0&&r.changeMediaPlaybackRate(e,1)}}}}},this.hls=n,this.config=n.config,this.registerListeners()}var l=s.prototype;return l.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null},l.registerListeners=function(){var r=this.hls;r&&(r.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(_.MANIFEST_LOADING,this.onManifestLoading,this),r.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),r.on(_.ERROR,this.onError,this))},l.unregisterListeners=function(){var r=this.hls;r&&(r.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(_.MANIFEST_LOADING,this.onManifestLoading,this),r.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),r.off(_.ERROR,this.onError,this))},l.onMediaAttached=function(r,e){this.media=e.media,this.media.addEventListener("timeupdate",this.onTimeupdate)},l.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)},l.onManifestLoading=function(){this._latency=null,this.stallCount=0},l.onLevelUpdated=function(r,e){var t=e.details;t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)},l.onError=function(r,e){var t;e.details===Q.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(t=this.levelDetails)!=null&&t.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))},l.changeMediaPlaybackRate=function(r,e){var t,a;r.playbackRate!==e&&((t=this.hls)==null||t.logger.debug("[latency-controller]: latency="+this.latency.toFixed(3)+", targetLatency="+((a=this.targetLatency)==null?void 0:a.toFixed(3))+", forwardBufferLength="+this.forwardBufferLength.toFixed(3)+": adjusting playback rate from "+r.playbackRate+" to "+e),r.playbackRate=e)},l.estimateLiveEdge=function(){var r=this.levelDetails;return r===null?null:r.edge+r.age},l.computeLatency=function(){var r=this.estimateLiveEdge();return r===null?null:r-this.currentTime},Ne(s,[{key:"levelDetails",get:function(){var r;return((r=this.hls)==null?void 0:r.latestLevelDetails)||null}},{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var r=this.config;if(r.liveMaxLatencyDuration!==void 0)return r.liveMaxLatencyDuration;var e=this.levelDetails;return e?r.liveMaxLatencyDurationCount*e.targetduration:0}},{key:"targetLatency",get:function(){var r=this.levelDetails;if(r===null||this.hls===null)return null;var e=r.holdBack,t=r.partHoldBack,a=r.targetduration,o=this.config,d=o.liveSyncDuration,c=o.liveSyncDurationCount,f=o.lowLatencyMode,v=this.hls.userConfig,m=f&&t||e;(this._targetLatencyUpdated||v.liveSyncDuration||v.liveSyncDurationCount||m===0)&&(m=d!==void 0?d:c*a);var g=a;return m+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,g)},set:function(r){this.stallCount=0,this.config.liveSyncDuration=r,this._targetLatencyUpdated=!0}},{key:"liveSyncPosition",get:function(){var r=this.estimateLiveEdge(),e=this.targetLatency;if(r===null||e===null)return null;var t=this.levelDetails;if(t===null)return null;var a=t.edge,o=r-e-this.edgeStalled,d=a-t.totalduration,c=a-(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.min(Math.max(d,o),c)}},{key:"drift",get:function(){var r=this.levelDetails;return r===null?1:r.drift}},{key:"edgeStalled",get:function(){var r=this.levelDetails;if(r===null)return 0;var e=(this.config.lowLatencyMode&&r.partTarget||r.targetduration)*3;return Math.max(r.age-e,0)}},{key:"forwardBufferLength",get:function(){var r=this.media,e=this.levelDetails;if(!r||!e)return 0;var t=r.buffered.length;return(t?r.buffered.end(t-1):e.edge)-this.currentTime}}])}(),om=function(s){function l(r,e){var t;return t=s.call(this,r,"level-controller")||this,t._levels=[],t._firstLevel=-1,t._maxAutoLevel=-1,t._startLevel=void 0,t.currentLevel=null,t.currentLevelIndex=-1,t.manualLevelIndex=-1,t.steering=void 0,t.onParsedComplete=void 0,t.steering=e,t._registerListeners(),t}Pe(l,s);var n=l.prototype;return n._registerListeners=function(){var e=this.hls;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.ERROR,this.onError,this)},n._unregisterListeners=function(){var e=this.hls;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.ERROR,this.onError,this)},n.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),s.prototype.destroy.call(this)},n.stopLoad=function(){var e=this._levels;e.forEach(function(t){t.loadError=0,t.fragmentError=0}),s.prototype.stopLoad.call(this)},n.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1},n.onManifestLoading=function(e,t){this.resetLevels()},n.onManifestLoaded=function(e,t){var a=this,o=this.hls.config.preferManagedMediaSource,d=[],c={},f={},v=!1,m=!1,g=!1;t.levels.forEach(function(y){var b=y.attrs,S=y.audioCodec,L=y.videoCodec;S&&(y.audioCodec=S=ui(S,o)||void 0),L&&(L=y.videoCodec=di(L));var C=y.width,F=y.height,N=y.unknownCodecs,B=(N==null?void 0:N.length)||0;if(v||(v=!!(C&&F)),m||(m=!!L),g||(g=!!S),B||S&&!a.isAudioSupported(S)||L&&!a.isVideoSupported(L)){a.log('Some or all CODECS not supported "'+b.CODECS+'"');return}var re=b.CODECS,ce=b["FRAME-RATE"],Se=b["HDCP-LEVEL"],Ke=b["PATHWAY-ID"],be=b.RESOLUTION,Z=b["VIDEO-RANGE"],ne=(Ke||".")+"-",Re=""+ne+y.bitrate+"-"+be+"-"+ce+"-"+re+"-"+Z+"-"+Se;if(c[Re])if(c[Re].uri!==y.url&&!y.attrs["PATHWAY-ID"]){var ot=f[Re]+=1;y.attrs["PATHWAY-ID"]=new Array(ot+1).join(".");var pt=a.createLevel(y);c[Re]=pt,d.push(pt)}else c[Re].addGroupId("audio",b.AUDIO),c[Re].addGroupId("text",b.SUBTITLES);else{var Tt=a.createLevel(y);c[Re]=Tt,f[Re]=1,d.push(Tt)}}),this.filterAndSortMediaOptions(d,t,v,m,g)},n.createLevel=function(e){var t=new Xa(e),a=e.supplemental;if(a!=null&&a.videoCodec&&!this.isVideoSupported(a.videoCodec)){var o=new Error('SUPPLEMENTAL-CODECS not supported "'+a.videoCodec+'"');this.log(o.message),t.supportedResult=Vt(o,[])}return t},n.isAudioSupported=function(e){return ma(e,"audio",this.hls.config.preferManagedMediaSource)},n.isVideoSupported=function(e){return ma(e,"video",this.hls.config.preferManagedMediaSource)},n.filterAndSortMediaOptions=function(e,t,a,o,d){var c,f=this,v=[],m=[],g=e,y=((c=t.stats)==null?void 0:c.parsing)||{};if((a||o)&&d&&(g=g.filter(function(Z){var ne=Z.videoCodec,Re=Z.videoRange,Tt=Z.width,ot=Z.height;return(!!ne||!!(Tt&&ot))&&Ts(Re)})),g.length===0){Promise.resolve().then(function(){if(f.hls){var Z="no level with compatible codecs found in manifest",ne=Z;t.levels.length&&(ne="one or more CODECS in variant not supported: "+ur(t.levels.map(function(Tt){return Tt.attrs.CODECS}).filter(function(Tt,ot,pt){return pt.indexOf(Tt)===ot})),f.warn(ne),Z+=" ("+ne+")");var Re=new Error(Z);f.hls.trigger(_.ERROR,{type:ut.MEDIA_ERROR,details:Q.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:Re,reason:ne})}}),y.end=performance.now();return}t.audioTracks&&(v=t.audioTracks.filter(function(Z){return!Z.audioCodec||f.isAudioSupported(Z.audioCodec)}),hh(v)),t.subtitles&&(m=t.subtitles,hh(m));var b=g.slice(0);g.sort(function(Z,ne){if(Z.attrs["HDCP-LEVEL"]!==ne.attrs["HDCP-LEVEL"])return(Z.attrs["HDCP-LEVEL"]||"")>(ne.attrs["HDCP-LEVEL"]||"")?1:-1;if(a&&Z.height!==ne.height)return Z.height-ne.height;if(Z.frameRate!==ne.frameRate)return Z.frameRate-ne.frameRate;if(Z.videoRange!==ne.videoRange)return hn.indexOf(Z.videoRange)-hn.indexOf(ne.videoRange);if(Z.videoCodec!==ne.videoCodec){var Re=dn(Z.videoCodec),Tt=dn(ne.videoCodec);if(Re!==Tt)return Tt-Re}if(Z.uri===ne.uri&&Z.codecSet!==ne.codecSet){var ot=Qa(Z.codecSet),pt=Qa(ne.codecSet);if(ot!==pt)return pt-ot}return Z.averageBitrate!==ne.averageBitrate?Z.averageBitrate-ne.averageBitrate:0});var S=b[0];if(this.steering&&(g=this.steering.filterParsedLevels(g),g.length!==b.length)){for(var L=0;L<b.length;L++)if(b[L].pathwayId===g[0].pathwayId){S=b[L];break}}this._levels=g;for(var C=0;C<g.length;C++)if(g[C]===S){var F;this._firstLevel=C;var N=S.bitrate,B=this.hls.bandwidthEstimate;if(this.log("manifest loaded, "+g.length+" level(s) found, first bitrate: "+N),((F=this.hls.userConfig)==null?void 0:F.abrEwmaDefaultEstimate)===void 0){var re=Math.min(N,this.hls.config.abrEwmaDefaultEstimateMax);re>B&&B===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=re)}break}var ce=d&&!o,Se=this.hls.config,Ke=!!(Se.audioStreamController&&Se.audioTrackController),be={levels:g,audioTracks:v,subtitleTracks:m,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:d,video:o,altAudio:Ke&&!ce&&v.some(function(Z){return!!Z.url})};y.end=performance.now(),this.hls.trigger(_.MANIFEST_PARSED,be)},n.onError=function(e,t){t.fatal||!t.context||t.context.type===pe.LEVEL&&t.context.level===this.level&&this.checkRetry(t)},n.onFragBuffered=function(e,t){var a=t.frag;if(a!==void 0&&a.type===Ie.MAIN){var o=a.elementaryStreams;if(!Object.keys(o).some(function(c){return!!o[c]}))return;var d=this._levels[a.level];d!=null&&d.loadError&&(this.log("Resetting level error count of "+d.loadError+" on frag buffered"),d.loadError=0)}},n.onLevelLoaded=function(e,t){var a,o=t.level,d=t.details,c=t.levelInfo;if(!c){var f;this.warn("Invalid level index "+o),(f=t.deliveryDirectives)!=null&&f.skip&&(d.deltaUpdateFailed=!0);return}if(c===this.currentLevel||t.withoutMultiVariant){c.fragmentError===0&&(c.loadError=0);var v=c.details;v===t.details&&v.advanced&&(v=void 0),this.playlistLoaded(o,t,v)}else(a=t.deliveryDirectives)!=null&&a.skip&&(d.deltaUpdateFailed=!0)},n.loadPlaylist=function(e){s.prototype.loadPlaylist.call(this),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)},n.loadingPlaylist=function(e,t){s.prototype.loadingPlaylist.call(this,e,t);var a=this.getUrlWithDirectives(e.uri,t),o=this.currentLevelIndex,d=e.attrs["PATHWAY-ID"],c=e.details,f=c==null?void 0:c.age;this.log("Loading level index "+o+((t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:"")+(d?" Pathway "+d:"")+(f&&c.live?" age "+f.toFixed(1)+(c.type?" "+c.type||0:""):"")+" "+a),this.hls.trigger(_.LEVEL_LOADING,{url:a,level:o,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})},n.removeLevel=function(e){var t=this,a;if(this._levels.length!==1){var o=this._levels.filter(function(c,f){return f!==e?!0:(t.steering&&t.steering.removeLevel(c),c===t.currentLevel&&(t.currentLevel=null,t.currentLevelIndex=-1,c.details&&c.details.fragments.forEach(function(v){return v.level=-1})),!1)});Oo(o),this._levels=o,this.currentLevelIndex>-1&&(a=this.currentLevel)!=null&&a.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);var d=o.length-1;this._firstLevel=Math.min(this._firstLevel,d),this._startLevel&&(this._startLevel=Math.min(this._startLevel,d)),this.hls.trigger(_.LEVELS_UPDATED,{levels:o})}},n.onLevelsUpdated=function(e,t){var a=t.levels;this._levels=a},n.checkMaxAutoUpdated=function(){var e=this.hls,t=e.autoLevelCapping,a=e.maxAutoLevel,o=e.maxHdcpLevel;this._maxAutoLevel!==a&&(this._maxAutoLevel=a,this.hls.trigger(_.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:a,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:o}))},Ne(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"loadLevelObj",get:function(){return this.currentLevel}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;if(t.length!==0){if(e<0||e>=t.length){var a=new Error("invalid level idx"),o=e<0;if(this.hls.trigger(_.ERROR,{type:ut.OTHER_ERROR,details:Q.LEVEL_SWITCH_ERROR,level:e,fatal:o,error:a,reason:a.message}),o)return;e=Math.min(e,t.length-1)}var d=this.currentLevelIndex,c=this.currentLevel,f=c?c.attrs["PATHWAY-ID"]:void 0,v=t[e],m=v.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=v,!(d===e&&c&&f===m)){this.log("Switching to level "+e+" ("+(v.height?v.height+"p ":"")+(v.videoRange?v.videoRange+" ":"")+(v.codecSet?v.codecSet+" ":"")+"@"+v.bitrate+")"+(m?" with Pathway "+m:"")+" from level "+d+(f?" with Pathway "+f:""));var g={level:e,attrs:v.attrs,details:v.details,bitrate:v.bitrate,averageBitrate:v.averageBitrate,maxBitrate:v.maxBitrate,realBitrate:v.realBitrate,width:v.width,height:v.height,codecSet:v.codecSet,audioCodec:v.audioCodec,videoCodec:v.videoCodec,audioGroups:v.audioGroups,subtitleGroups:v.subtitleGroups,loaded:v.loaded,loadError:v.loadError,fragmentError:v.fragmentError,name:v.name,id:v.id,uri:v.uri,url:v.url,urlId:0,audioGroupIds:v.audioGroupIds,textGroupIds:v.textGroupIds};this.hls.trigger(_.LEVEL_SWITCHING,g);var y=v.details;if(!y||y.live){var b=this.switchParams(v.uri,c==null?void 0:c.details,y);this.loadPlaylist(b)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"pathways",get:function(){return this.steering?this.steering.pathways():[]}},{key:"pathwayPriority",get:function(){return this.steering?this.steering.pathwayPriority:null},set:function(e){if(this.steering){var t=this.steering.pathways(),a=e.filter(function(o){return t.indexOf(o)!==-1});if(e.length<1){this.warn("pathwayPriority "+e+" should contain at least one pathway from list: "+t);return}this.steering.pathwayPriority=a}}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}}])}(Hl);function hh(s){var l={};s.forEach(function(n){var r=n.groupId||"";n.id=l[r]=l[r]||0,l[r]++})}function fh(){return self.SourceBuffer||self.WebKitSourceBuffer}function Yf(){var s=Be();if(!s)return!1;var l=fh();return!l||l.prototype&&typeof l.prototype.appendBuffer=="function"&&typeof l.prototype.remove=="function"}function Hs(){if(!Yf())return!1;var s=Be();return typeof(s==null?void 0:s.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(function(l){return s.isTypeSupported(Qi(l,"video"))})||["mp4a.40.2","fLaC"].some(function(l){return s.isTypeSupported(Qi(l,"audio"))}))}function Hu(){var s,l=fh();return typeof(l==null||(s=l.prototype)==null?void 0:s.changeType)=="function"}var $f=100,lm=function(s){function l(r,e,t){var a;return a=s.call(this,r,e,t,"stream-controller",Ie.MAIN)||this,a.audioCodecSwap=!1,a.level=-1,a._forceStartLoad=!1,a._hasEnoughToStart=!1,a.altAudio=0,a.audioOnly=!1,a.fragPlaying=null,a.fragLastKbps=0,a.couldBacktrack=!1,a.backtrackFragment=null,a.audioCodecSwitch=!1,a.videoBuffer=null,a.onMediaPlaying=function(){a.tick()},a.onMediaSeeked=function(){var o=a.media,d=o?o.currentTime:null;if(!(d===null||!Ge(d))&&(a.log("Media seeked to "+d.toFixed(3)),!!a.getBufferedFrag(d))){var c=a.getFwdBufferInfoAtPos(o,d,Ie.MAIN,0);if(c===null||c.len===0){a.warn("Main forward buffer length at "+d+' on "seeked" event '+(c?c.len:"empty")+")");return}a.tick()}},a.registerListeners(),a}Pe(l,s);var n=l.prototype;return n.registerListeners=function(){s.prototype.registerListeners.call(this);var e=this.hls;e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)},n.unregisterListeners=function(){s.prototype.unregisterListeners.call(this);var e=this.hls;e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this)},n.onHandlerDestroying=function(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),s.prototype.onHandlerDestroying.call(this)},n.startLoad=function(e,t){if(this.levels){var a=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval($f),this.level=-1,!this.startFragRequested){var d=o.startLevel;d===-1&&(o.config.testBandwidth&&this.levels.length>1?(d=0,this.bitrateTest=!0):d=o.firstAutoLevel),o.nextLoadLevel=d,this.level=o.loadLevel,this._hasEnoughToStart=!!t}a>0&&e===-1&&!t&&(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),e=a),this.state=nt.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=nt.STOPPED},n.stopLoad=function(){this._forceStartLoad=!1,s.prototype.stopLoad.call(this)},n.doTick=function(){switch(this.state){case nt.WAITING_LEVEL:{var e=this.levels,t=this.level,a=e==null?void 0:e[t],o=a==null?void 0:a.details;if(o&&(!o.live||this.levelLastLoaded===a&&!this.waitForLive(a))){if(this.waitForCdnTuneIn(o))break;this.state=nt.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=nt.IDLE;break}break}case nt.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===nt.IDLE&&this.doTickIdle(),this.onTickEnd()},n.onTickEnd=function(){var e;s.prototype.onTickEnd.call(this),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()},n.doTickIdle=function(){var e=this.hls,t=this.levelLastLoaded,a=this.levels,o=this.media;if(!(t===null||!o&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch))&&!(this.altAudio&&this.audioOnly)){var d=this.buffering?e.nextLoadLevel:e.loadLevel;if(a!=null&&a[d]){var c=a[d],f=this.getMainFwdBufferInfo();if(f!==null){var v=this.getLevelDetails();if(v&&this._streamEnded(f,v)){var m={};this.altAudio===2&&(m.type="video"),this.hls.trigger(_.BUFFER_EOS,m),this.state=nt.ENDED;return}if(this.buffering){e.loadLevel!==d&&e.manualLevel===-1&&this.log("Adapting to level "+d+" from level "+this.level),this.level=e.nextLoadLevel=d;var g=c.details;if(!g||this.state===nt.WAITING_LEVEL||this.waitForLive(c)){this.level=d,this.state=nt.WAITING_LEVEL,this.startFragRequested=!1;return}var y=f.len,b=this.getMaxBufferLength(c.maxBitrate);if(!(y>=b)){this.backtrackFragment&&this.backtrackFragment.start>f.end&&(this.backtrackFragment=null);var S=this.backtrackFragment?this.backtrackFragment.start:f.end,L=this.getNextFragment(S,g);if(this.couldBacktrack&&!this.fragPrevious&&L&&Y(L)&&this.fragmentTracker.getState(L)!==xe.OK){var C,F=((C=this.backtrackFragment)!=null?C:L).sn,N=F-g.startSN,B=g.fragments[N-1];B&&L.cc===B.cc&&(L=B,this.fragmentTracker.removeFragment(B))}else this.backtrackFragment&&f.len&&(this.backtrackFragment=null);if(L&&this.isLoopLoading(L,S)){var re=L.gap;if(!re){var ce=this.audioOnly&&!this.altAudio?Wt.AUDIO:Wt.VIDEO,Se=(ce===Wt.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;Se&&this.afterBufferFlushed(Se,ce,Ie.MAIN)}L=this.getNextFragmentLoopLoading(L,g,f,Ie.MAIN,b)}L&&(L.initSegment&&!L.initSegment.data&&!this.bitrateTest&&(L=L.initSegment),this.loadFragment(L,c,S))}}}}}},n.loadFragment=function(e,t,a){var o=this.fragmentTracker.getState(e);o===xe.NOT_LOADED||o===xe.PARTIAL?Y(e)?this.bitrateTest?(this.log("Fragment "+e.sn+" of level "+e.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(e,t)):s.prototype.loadFragment.call(this,e,t,a):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)},n.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,Ie.MAIN)},n.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},n.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},n.nextLevelSwitch=function(){var e=this.levels,t=this.media;if(t!=null&&t.readyState){var a,o=this.getAppendedFrag(t.currentTime);o&&o.start>1&&this.flushMainBuffer(0,o.start-1);var d=this.getLevelDetails();if(d!=null&&d.live){var c=this.getMainFwdBufferInfo();if(!c||c.len<d.targetduration*2)return}if(!t.paused&&e){var f=this.hls.nextLoadLevel,v=e[f],m=this.fragLastKbps;m&&this.fragCurrent?a=this.fragCurrent.duration*v.maxBitrate/(1e3*m)+1:a=0}else a=0;var g=this.getBufferedFrag(t.currentTime+a);if(g){var y=this.followingBufferedFrag(g);if(y){this.abortCurrentFrag();var b=y.maxStartPTS?y.maxStartPTS:y.start,S=y.duration,L=Math.max(g.end,b+Math.min(Math.max(S-this.config.maxFragLookUpTolerance,S*(this.couldBacktrack?.5:.125)),S*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(L,Number.POSITIVE_INFINITY)}}}},n.abortCurrentFrag=function(){var e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case nt.KEY_LOADING:case nt.FRAG_LOADING:case nt.FRAG_LOADING_WAITING_RETRY:case nt.PARSING:case nt.PARSED:this.state=nt.IDLE;break}this.nextLoadPosition=this.getLoadPosition()},n.flushMainBuffer=function(e,t){s.prototype.flushMainBuffer.call(this,e,t,this.altAudio===2?"video":null)},n.onMediaAttached=function(e,t){s.prototype.onMediaAttached.call(this,e,t);var a=t.media;Ea(a,"playing",this.onMediaPlaying),Ea(a,"seeked",this.onMediaSeeked)},n.onMediaDetaching=function(e,t){var a=this.media;a&&(Ia(a,"playing",this.onMediaPlaying),Ia(a,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,s.prototype.onMediaDetaching.call(this,e,t);var o=!!t.transferMedia;o||(this._hasEnoughToStart=!1)},n.onManifestLoading=function(){s.prototype.onManifestLoading.call(this),this.log("Trigger BUFFER_RESET"),this.hls.trigger(_.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1},n.onManifestParsed=function(e,t){for(var a=!1,o=!1,d=0;d<t.levels.length;d++){var c=t.levels[d].audioCodec;c&&(a=a||c.indexOf("mp4a.40.2")!==-1,o=o||c.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=a&&o&&!Hu(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},n.onLevelLoading=function(e,t){var a=this.levels;if(!(!a||this.state!==nt.IDLE)){var o=t.levelInfo;(!o.details||o.details.live&&(this.levelLastLoaded!==o||o.details.expired)||this.waitForCdnTuneIn(o.details))&&(this.state=nt.WAITING_LEVEL)}},n.onLevelLoaded=function(e,t){var a,o=this.levels,d=this.startFragRequested,c=t.level,f=t.details,v=f.totalduration;if(!o){this.warn("Levels were reset while loading level "+c);return}this.log("Level "+c+" loaded ["+f.startSN+","+f.endSN+"]"+(f.lastPartSn?"[part-"+f.lastPartSn+"-"+f.lastPartIndex+"]":"")+", cc ["+f.startCC+", "+f.endCC+"] duration:"+v);var m=t.levelInfo,g=this.fragCurrent;g&&(this.state===nt.FRAG_LOADING||this.state===nt.FRAG_LOADING_WAITING_RETRY)&&g.level!==t.level&&g.loader&&this.abortCurrentFrag();var y=0;if(f.live||(a=m.details)!=null&&a.live){var b;if(this.checkLiveUpdate(f),f.deltaUpdateFailed)return;y=this.alignPlaylists(f,m.details,(b=this.levelLastLoaded)==null?void 0:b.details)}if(m.details=f,this.levelLastLoaded=m,d||this.setStartPosition(f,y),this.hls.trigger(_.LEVEL_UPDATED,{details:f,level:c}),this.state===nt.WAITING_LEVEL){if(this.waitForCdnTuneIn(f))return;this.state=nt.IDLE}d&&f.live&&this.synchronizeToLiveEdge(f),this.tick()},n.synchronizeToLiveEdge=function(e){var t=this.config,a=this.media;if(a){var o=this.hls.liveSyncPosition,d=this.getLoadPosition(),c=e.fragmentStart,f=e.edge,v=d>=c-t.maxFragLookUpTolerance&&d<=f;if(o!==null&&a.duration>o&&(d<o||!v)){var m=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!v&&a.readyState<4||d<f-m)&&(this._hasEnoughToStart||(this.nextLoadPosition=o),a.readyState))if(this.warn("Playback: "+d.toFixed(3)+" is located too far from the end of live sliding playlist: "+f+", reset currentTime to : "+o.toFixed(3)),this.config.liveSyncMode==="buffered"){var g,y=Pr.bufferInfo(a,o,0);if(!((g=y.buffered)!=null&&g.length)){a.currentTime=o;return}var b=y.start<=d;if(b){a.currentTime=o;return}var S=Pr.bufferedInfo(y.buffered,d,0),L=S.nextStart;L&&(a.currentTime=L)}else a.currentTime=o}}},n._handleFragmentLoadProgress=function(e){var t,a=e.frag,o=e.part,d=e.payload,c=this.levels;if(!c){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var f=c[a.level];if(!f){this.warn("Level "+a.level+" not found on progress");return}var v=f.details;if(!v){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset"),this.fragmentTracker.removeFragment(a);return}var m=f.videoCodec,g=v.PTSKnown||!v.live,y=(t=a.initSegment)==null?void 0:t.data,b=this._getAudioCodec(f),S=this.transmuxer=this.transmuxer||new xc(this.hls,Ie.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),L=o?o.index:-1,C=L!==-1,F=new qn(a.level,a.sn,a.stats.chunkCount,d.byteLength,L,C),N=this.initPTS[a.cc];S.push(d,y,b,m,a,o,v.totalduration,g,F,N)},n.onAudioTrackSwitching=function(e,t){var a=this,o=this.hls,d=this.altAudio!==0,c=Rn(t.url,o);if(c)this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var f=this.fragCurrent;f&&(this.log("Switching to main audio track, cancel main fragment load"),f.abortRequests(),this.fragmentTracker.removeFragment(f)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(d){this.altAudio=0,this.fragmentTracker.removeAllFragments(),o.once(_.BUFFER_FLUSHED,function(){a.hls&&a.hls.trigger(_.AUDIO_TRACK_SWITCHED,t)}),o.trigger(_.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}o.trigger(_.AUDIO_TRACK_SWITCHED,t)}},n.onAudioTrackSwitched=function(e,t){var a=Rn(t.url,this.hls);if(a){var o=this.videoBuffer;o&&this.mediaBuffer!==o&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=o)}this.altAudio=a?2:0,this.tick()},n.onBufferCreated=function(e,t){var a=t.tracks,o,d,c=!1;for(var f in a){var v=a[f];if(v.id==="main"){if(d=f,o=v,f==="video"){var m=a[f];m&&(this.videoBuffer=m.buffer)}}else c=!0}c&&o?(this.log("Alternate track found, use "+d+".buffered to schedule main fragment loading"),this.mediaBuffer=o.buffer):this.mediaBuffer=this.media},n.onFragBuffered=function(e,t){var a=t.frag,o=t.part,d=a.type===Ie.MAIN;if(d){if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(o?" p: "+o.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===nt.PARSED&&(this.state=nt.IDLE);return}var c=o?o.stats:a.stats;this.fragLastKbps=Math.round(8*c.total/(c.buffering.end-c.loading.first)),Y(a)&&(this.fragPrevious=a),this.fragBufferedComplete(a,o)}var f=this.media;f&&(!this._hasEnoughToStart&&Pr.getBuffered(f).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),d&&this.tick())},n.onError=function(e,t){var a;if(t.fatal){this.state=nt.ERROR;return}switch(t.details){case Q.FRAG_GAP:case Q.FRAG_PARSING_ERROR:case Q.FRAG_DECRYPT_ERROR:case Q.FRAG_LOAD_ERROR:case Q.FRAG_LOAD_TIMEOUT:case Q.KEY_LOAD_ERROR:case Q.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ie.MAIN,t);break;case Q.LEVEL_LOAD_ERROR:case Q.LEVEL_LOAD_TIMEOUT:case Q.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===nt.WAITING_LEVEL&&((a=t.context)==null?void 0:a.type)===pe.LEVEL&&(this.state=nt.IDLE);break;case Q.BUFFER_ADD_CODEC_ERROR:case Q.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case Q.BUFFER_FULL_ERROR:if(t.parent!=="main")return;if(this.reduceLengthAndFlushBuffer(t)){var o=!this.config.interstitialsController&&this.config.assetPlayerId;o?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}break;case Q.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}},n.onFragLoadEmergencyAborted=function(){this.state=nt.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()},n.onBufferFlushed=function(e,t){var a=t.type;if(a!==Wt.AUDIO||!this.altAudio){var o=(a===Wt.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;o&&(this.afterBufferFlushed(o,a,Ie.MAIN),this.tick())}},n.onLevelsUpdated=function(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels},n.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},n.seekToStartPos=function(){var e=this.media;if(e){var t=e.currentTime,a=this.startPosition;if(a>=0&&t<a){if(e.seeking){this.log("could not seek to "+a+", already seeking at "+t);return}var o=this.timelineOffset;o&&a&&(a+=o);var d=this.getLevelDetails(),c=Pr.getBuffered(e),f=c.length?c.start(0):0,v=f-a,m=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||v>0&&(v<m||this.loadingParts&&v<2*((d==null?void 0:d.partTarget)||0)))&&(this.log("adjusting start position by "+v+" to match buffer start"),a+=v,this.startPosition=a),t<a&&(this.log("seek to target start position "+a+" from current time "+t+" buffer start "+f),e.currentTime=a)}}},n._getAudioCodec=function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t},n._loadBitrateTestFrag=function(e,t){var a=this;e.bitrateTest=!0,this._doFragLoad(e,t).then(function(o){var d=a.hls,c=o==null?void 0:o.frag;if(!(!c||a.fragContextChanged(c))){t.fragmentError=0,a.state=nt.IDLE,a.startFragRequested=!1,a.bitrateTest=!1;var f=c.stats;f.parsing.start=f.parsing.end=f.buffering.start=f.buffering.end=self.performance.now(),d.trigger(_.FRAG_LOADED,o),c.bitrateTest=!1}}).catch(function(o){a.state===nt.STOPPED||a.state===nt.ERROR||(a.warn(o),a.resetFragmentLoading(e))})},n._handleTransmuxComplete=function(e){var t=this.playlistType,a=this.hls,o=e.remuxResult,d=e.chunkMeta,c=this.getCurrentContext(d);if(!c){this.resetWhenMissingContext(d);return}var f=c.frag,v=c.part,m=c.level,g=o.video,y=o.text,b=o.id3,S=o.initSegment,L=m.details,C=this.altAudio?void 0:o.audio;if(this.fragContextChanged(f)){this.fragmentTracker.removeFragment(f);return}if(this.state=nt.PARSING,S){var F=S.tracks;if(F){var N=f.initSegment||f;if(this.unhandledEncryptionError(S,f))return;this._bufferInitSegment(m,F,N,d),a.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:t,tracks:F})}var B=S.initPTS,re=S.timescale,ce=this.initPTS[f.cc];if(Ge(B)&&(!ce||ce.baseTime!==B||ce.timescale!==re)){var Se=S.trackId;this.initPTS[f.cc]={baseTime:B,timescale:re,trackId:Se},a.trigger(_.INIT_PTS_FOUND,{frag:f,id:t,initPTS:B,timescale:re,trackId:Se})}}if(g&&L){C&&g.type==="audiovideo"&&this.logMuxedErr(f);var Ke=L.fragments[f.sn-1-L.startSN],be=f.sn===L.startSN,Z=!Ke||f.cc>Ke.cc;if(o.independent!==!1){var ne=g.startPTS,Re=g.endPTS,Tt=g.startDTS,ot=g.endDTS;if(v)v.elementaryStreams[g.type]={startPTS:ne,endPTS:Re,startDTS:Tt,endDTS:ot};else if(g.firstKeyFrame&&g.independent&&d.id===1&&!Z&&(this.couldBacktrack=!0),g.dropped&&g.independent){var pt=this.getMainFwdBufferInfo(),Bt=(pt?pt.end:this.getLoadPosition())+this.config.maxBufferHole,cr=g.firstKeyFramePTS?g.firstKeyFramePTS:ne;if(!be&&Bt<cr-this.config.maxBufferHole&&!Z){this.backtrack(f);return}else Z&&(f.gap=!0);f.setElementaryStreamInfo(g.type,f.start,Re,f.start,ot,!0)}else be&&ne-(L.appliedTimelineOffset||0)>Bs&&(f.gap=!0);f.setElementaryStreamInfo(g.type,ne,Re,Tt,ot),this.backtrackFragment&&(this.backtrackFragment=f),this.bufferFragmentData(g,f,v,d,be||Z)}else if(be||Z)f.gap=!0;else{this.backtrack(f);return}}if(C){var or=C.startPTS,hr=C.endPTS,xr=C.startDTS,fr=C.endDTS;v&&(v.elementaryStreams[Wt.AUDIO]={startPTS:or,endPTS:hr,startDTS:xr,endDTS:fr}),f.setElementaryStreamInfo(Wt.AUDIO,or,hr,xr,fr),this.bufferFragmentData(C,f,v,d)}if(L&&b!=null&&b.samples.length){var lr={id:t,frag:f,details:L,samples:b.samples};a.trigger(_.FRAG_PARSING_METADATA,lr)}if(L&&y){var _r={id:t,frag:f,details:L,samples:y.samples};a.trigger(_.FRAG_PARSING_USERDATA,_r)}},n.logMuxedErr=function(e){this.warn((Y(e)?"Media":"Init")+" segment with muxed audiovideo where only video expected: "+e.url)},n._bufferInitSegment=function(e,t,a,o){var d=this;if(this.state===nt.PARSING){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(a));var c=t.audio,f=t.video,v=t.audiovideo;if(c){var m=e.audioCodec,g=Nr(c.codec,m);g==="mp4a"&&(g="mp4a.40.5");var y=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){g&&(g.indexOf("mp4a.40.5")!==-1?g="mp4a.40.2":g="mp4a.40.5");var b=c.metadata;b&&"channelCount"in b&&(b.channelCount||1)!==1&&y.indexOf("firefox")===-1&&(g="mp4a.40.5")}g&&g.indexOf("mp4a.40.5")!==-1&&y.indexOf("android")!==-1&&c.container!=="audio/mpeg"&&(g="mp4a.40.2",this.log("Android: force audio codec to "+g)),m&&m!==g&&this.log('Swapping manifest audio codec "'+m+'" for "'+g+'"'),c.levelCodec=g,c.id=Ie.MAIN,this.log("Init audio buffer, container:"+c.container+", codecs[selected/level/parsed]=["+(g||"")+"/"+(m||"")+"/"+c.codec+"]"),delete t.audiovideo}if(f){f.levelCodec=e.videoCodec,f.id=Ie.MAIN;var S=f.codec;if((S==null?void 0:S.length)===4)switch(S){case"hvc1":case"hev1":f.codec="hvc1.1.6.L120.90";break;case"av01":f.codec="av01.0.04M.08";break;case"avc1":f.codec="avc1.42e01e";break}this.log("Init video buffer, container:"+f.container+", codecs[level/parsed]=["+(e.videoCodec||"")+"/"+S+"]"+(f.codec!==S?" parsed-corrected="+f.codec:"")+(f.supplemental?" supplemental="+f.supplemental:"")),delete t.audiovideo}v&&(this.log("Init audiovideo buffer, container:"+v.container+", codecs[level/parsed]=["+e.codecs+"/"+v.codec+"]"),delete t.video,delete t.audio);var L=Object.keys(t);if(L.length){if(this.hls.trigger(_.BUFFER_CODECS,t),!this.hls)return;L.forEach(function(C){var F=t[C],N=F.initSegment;N!=null&&N.byteLength&&d.hls.trigger(_.BUFFER_APPENDING,{type:C,data:N,frag:a,part:null,chunkMeta:o,parent:a.type})})}this.tickImmediate()}},n.getMainFwdBufferInfo=function(){var e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,Ie.MAIN)},n.backtrack=function(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=nt.IDLE},n.checkFragmentChanged=function(){var e=this.media,t=null;if(e&&e.readyState>1&&e.seeking===!1){var a=e.currentTime;if(Pr.isBuffered(e,a)?t=this.getAppendedFrag(a):Pr.isBuffered(e,a+.1)&&(t=this.getAppendedFrag(a+.1)),t){this.backtrackFragment=null;var o=this.fragPlaying,d=t.level;(!o||t.sn!==o.sn||o.level!==d)&&(this.fragPlaying=t,this.hls.trigger(_.FRAG_CHANGED,{frag:t}),(!o||o.level!==d)&&this.hls.trigger(_.LEVEL_SWITCHED,{level:d}))}}},Ne(l,[{key:"hasEnoughToStart",get:function(){return this._hasEnoughToStart}},{key:"maxBufferLength",get:function(){var e=this.levels,t=this.level,a=e==null?void 0:e[t];return a?this.getMaxBufferLength(a.maxBitrate):this.config.maxBufferLength}},{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentFrag",get:function(){var e;if(this.fragPlaying)return this.fragPlaying;var t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return Ge(t)?this.getAppendedFrag(t):null}},{key:"currentProgramDateTime",get:function(){var e,t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(Ge(t)){var a=this.getLevelDetails(),o=this.currentFrag||(a?Za(null,a.fragments,t):null);if(o){var d=o.programDateTime;if(d!==null){var c=d+(t-o.start)*1e3;return new Date(c)}}}return null}},{key:"currentLevel",get:function(){var e=this.currentFrag;return e?e.level:-1}},{key:"nextBufferedFrag",get:function(){var e=this.currentFrag;return e?this.followingBufferedFrag(e):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])}(Xu),qf=function(s){function l(r,e){var t;return t=s.call(this,"key-loader",e)||this,t.config=void 0,t.keyIdToKeyInfo={},t.emeController=null,t.config=r,t}Pe(l,s);var n=l.prototype;return n.abort=function(e){for(var t in this.keyIdToKeyInfo){var a=this.keyIdToKeyInfo[t].loader;if(a){var o;if(e&&e!==((o=a.context)==null?void 0:o.frag.type))return;a.abort()}}},n.detach=function(){for(var e in this.keyIdToKeyInfo){var t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}},n.destroy=function(){this.detach();for(var e in this.keyIdToKeyInfo){var t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}},n.createKeyLoadError=function(e,t,a,o,d){return t===void 0&&(t=Q.KEY_LOAD_ERROR),new ga({type:ut.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:d,error:a,networkDetails:o})},n.loadClear=function(e,t,a){var o=this;if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length){for(var d=function(){var y=t[f];if(e.cc<=y.cc&&(!Y(e)||!Y(y)||e.sn<y.sn)||!a&&f==v-1)return{v:o.emeController.selectKeySystemFormat(y).then(function(b){if(o.emeController){y.setKeyFormat(b);var S=Ve(b);if(S)return o.emeController.getKeySystemAccess([S])}})}},c,f=0,v=t.length;f<v;f++)if(c=d(),c)return c.v}if(this.config.requireKeySystemAccessOnStart){var m=Mt(this.config);if(m.length)return this.emeController.getKeySystemAccess(m)}}return null},n.load=function(e){var t=this;return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(function(a){return t.loadInternal(e,a)}):this.loadInternal(e)},n.loadInternal=function(e,t){var a,o;t&&e.setKeyFormat(t);var d=e.decryptdata;if(!d){var c=new Error(t?"Expected frag.decryptdata to be defined after setting format "+t:"Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: "+(this.emeController&&this.config.emeEnabled)+")");return Promise.reject(this.createKeyLoadError(e,Q.KEY_LOAD_ERROR,c))}var f=d.uri;if(!f)return Promise.reject(this.createKeyLoadError(e,Q.KEY_LOAD_ERROR,new Error('Invalid key URI: "'+f+'"')));var v=dc(d),m=this.keyIdToKeyInfo[v];if((a=m)!=null&&a.decryptdata.key)return d.key=m.decryptdata.key,Promise.resolve({frag:e,keyInfo:m});if(this.emeController&&(o=m)!=null&&o.keyLoadPromise){var g=this.emeController.getKeyStatus(m.decryptdata);switch(g){case"usable":case"usable-in-future":return m.keyLoadPromise.then(function(y){var b=y.keyInfo;return d.key=b.decryptdata.key,{frag:e,keyInfo:b}})}}switch(this.log((this.keyIdToKeyInfo[v]?"Rel":"L")+"oading"+(d.keyId?" keyId: "+Ut(d.keyId):"")+" URI: "+d.uri+" from "+e.type+" "+e.level),m=this.keyIdToKeyInfo[v]={decryptdata:d,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},d.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return d.keyFormat==="identity"?this.loadKeyHTTP(m,e):this.loadKeyEME(m,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(m,e);default:return Promise.reject(this.createKeyLoadError(e,Q.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'+d.method+'"')))}},n.loadKeyEME=function(e,t){var a={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var o;if(!e.decryptdata.keyId&&(o=t.initSegment)!=null&&o.data){var d=Rr(t.initSegment.data);if(d.length){var c=d[0];c.some(function(v){return v!==0})?(this.log("Using keyId found in init segment "+Ut(c)),Or.setKeyIdForUri(e.decryptdata.uri,c)):(c=Or.addKeyIdForUri(e.decryptdata.uri),this.log("Generating keyId to patch media "+Ut(c))),e.decryptdata.keyId=c}}if(!e.decryptdata.keyId&&!Y(t))return Promise.resolve(a);var f=this.emeController.loadKey(a);return(e.keyLoadPromise=f.then(function(v){return e.mediaKeySessionContext=v,a})).catch(function(v){throw e.keyLoadPromise=null,"data"in v&&(v.data.frag=t),v})}return Promise.resolve(a)},n.loadKeyHTTP=function(e,t){var a=this,o=this.config,d=o.loader,c=new d(o);return t.keyLoader=e.loader=c,e.keyLoadPromise=new Promise(function(f,v){var m={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},g=o.keyLoadPolicy.default,y={loadPolicy:g,timeout:g.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},b={onSuccess:function(L,C,F,N){var B=F.frag,re=F.keyInfo,ce=dc(re.decryptdata);if(!B.decryptdata||re!==a.keyIdToKeyInfo[ce])return v(a.createKeyLoadError(B,Q.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),N));re.decryptdata.key=B.decryptdata.key=new Uint8Array(L.data),B.keyLoader=null,re.loader=null,f({frag:B,keyInfo:re})},onError:function(L,C,F,N){a.resetLoader(C),v(a.createKeyLoadError(t,Q.KEY_LOAD_ERROR,new Error("HTTP Error "+L.code+" loading key "+L.text),F,j({url:m.url,data:void 0},L)))},onTimeout:function(L,C,F){a.resetLoader(C),v(a.createKeyLoadError(t,Q.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),F))},onAbort:function(L,C,F){a.resetLoader(C),v(a.createKeyLoadError(t,Q.INTERNAL_ABORTED,new Error("key loading aborted"),F))}};c.load(m,y,b)})},n.resetLoader=function(e){var t=e.frag,a=e.keyInfo,o=e.url,d=a.loader;t.keyLoader===d&&(t.keyLoader=null,a.loader=null);var c=dc(a.decryptdata)||o;delete this.keyIdToKeyInfo[c],d&&d.destroy()},l}(Te);function dc(s){if(s.keyFormat!==Fe.FAIRPLAY){var l=s.keyId;if(l)return Ut(l)}return s.uri}function ol(s){var l=s.type;switch(l){case pe.AUDIO_TRACK:return Ie.AUDIO;case pe.SUBTITLE_TRACK:return Ie.SUBTITLE;default:return Ie.MAIN}}function Co(s,l){var n=s.url;return(n===void 0||n.indexOf("data:")===0)&&(n=l.url),n}var vh=function(){function s(n){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=n,this.registerListeners()}var l=s.prototype;return l.startLoad=function(r){},l.stopLoad=function(){this.destroyInternalLoaders()},l.registerListeners=function(){var r=this.hls;r.on(_.MANIFEST_LOADING,this.onManifestLoading,this),r.on(_.LEVEL_LOADING,this.onLevelLoading,this),r.on(_.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.on(_.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),r.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this)},l.unregisterListeners=function(){var r=this.hls;r.off(_.MANIFEST_LOADING,this.onManifestLoading,this),r.off(_.LEVEL_LOADING,this.onLevelLoading,this),r.off(_.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.off(_.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),r.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this)},l.createInternalLoader=function(r){var e=this.hls.config,t=e.pLoader,a=e.loader,o=t||a,d=new o(e);return this.loaders[r.type]=d,d},l.getInternalLoader=function(r){return this.loaders[r.type]},l.resetInternalLoader=function(r){this.loaders[r]&&delete this.loaders[r]},l.destroyInternalLoaders=function(){for(var r in this.loaders){var e=this.loaders[r];e&&e.destroy(),this.resetInternalLoader(r)}},l.destroy=function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()},l.onManifestLoading=function(r,e){var t=e.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:pe.MANIFEST,url:t,deliveryDirectives:null,levelOrTrack:null})},l.onLevelLoading=function(r,e){var t=e.id,a=e.level,o=e.pathwayId,d=e.url,c=e.deliveryDirectives,f=e.levelInfo;this.load({id:t,level:a,pathwayId:o,responseType:"text",type:pe.LEVEL,url:d,deliveryDirectives:c,levelOrTrack:f})},l.onAudioTrackLoading=function(r,e){var t=e.id,a=e.groupId,o=e.url,d=e.deliveryDirectives,c=e.track;this.load({id:t,groupId:a,level:null,responseType:"text",type:pe.AUDIO_TRACK,url:o,deliveryDirectives:d,levelOrTrack:c})},l.onSubtitleTrackLoading=function(r,e){var t=e.id,a=e.groupId,o=e.url,d=e.deliveryDirectives,c=e.track;this.load({id:t,groupId:a,level:null,responseType:"text",type:pe.SUBTITLE_TRACK,url:o,deliveryDirectives:d,levelOrTrack:c})},l.onLevelsUpdated=function(r,e){var t=this.loaders[pe.LEVEL];if(t){var a=t.context;a&&!e.levels.some(function(o){return o===a.levelOrTrack})&&(t.abort(),delete this.loaders[pe.LEVEL])}},l.load=function(r){var e,t=this,a=this.hls.config,o=this.getInternalLoader(r);if(o){var d=this.hls.logger,c=o.context;if(c&&c.levelOrTrack===r.levelOrTrack&&(c.url===r.url||c.deliveryDirectives&&!r.deliveryDirectives)){c.url===r.url?d.log("[playlist-loader]: ignore "+r.url+" ongoing request"):d.log("[playlist-loader]: ignore "+r.url+" in favor of "+c.url);return}d.log("[playlist-loader]: aborting previous loader for type: "+r.type),o.abort()}var f;if(r.type===pe.MANIFEST?f=a.manifestLoadPolicy.default:f=Qe({},a.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),o=this.createInternalLoader(r),Ge((e=r.deliveryDirectives)==null?void 0:e.part)){var v;if(r.type===pe.LEVEL&&r.level!==null?v=this.hls.levels[r.level].details:r.type===pe.AUDIO_TRACK&&r.id!==null?v=this.hls.audioTracks[r.id].details:r.type===pe.SUBTITLE_TRACK&&r.id!==null&&(v=this.hls.subtitleTracks[r.id].details),v){var m=v.partTarget,g=v.targetduration;if(m&&g){var y=Math.max(m*3,g*.8)*1e3;f=Qe({},f,{maxTimeToFirstByteMs:Math.min(y,f.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(y,f.maxTimeToFirstByteMs)})}}}var b=f.errorRetry||f.timeoutRetry||{},S={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:b.maxNumRetry||0,retryDelay:b.retryDelayMs||0,maxRetryDelay:b.maxRetryDelayMs||0},L={onSuccess:function(F,N,B,re){var ce=t.getInternalLoader(B);t.resetInternalLoader(B.type);var Se=F.data;N.parsing.start=performance.now(),Vi.isMediaPlaylist(Se)||B.type!==pe.MANIFEST?t.handleTrackOrLevelPlaylist(F,N,B,re||null,ce):t.handleMasterPlaylist(F,N,B,re)},onError:function(F,N,B,re){t.handleNetworkError(N,B,!1,F,re)},onTimeout:function(F,N,B){t.handleNetworkError(N,B,!0,void 0,F)}};o.load(r,S,L)},l.checkAutostartLoad=function(){if(this.hls){var r=this.hls,e=r.config,t=e.autoStartLoad,a=e.startPosition,o=r.forceStartLoad;(t||o)&&(this.hls.logger.log((t?"auto":"force")+" startLoad with configured startPosition "+a),this.hls.startLoad(a))}},l.handleMasterPlaylist=function(r,e,t,a){var o=this,d=this.hls,c=r.data,f=Co(r,t),v=Vi.parseMasterPlaylist(c,f);if(v.playlistParsingError){e.parsing.end=performance.now(),this.handleManifestParsingError(r,t,v.playlistParsingError,a,e);return}var m=v.contentSteering,g=v.levels,y=v.sessionData,b=v.sessionKeys,S=v.startTimeOffset,L=v.variableList;this.variableList=L,g.forEach(function(Se){var Ke=Se.unknownCodecs;if(Ke)for(var be=o.hls.config.preferManagedMediaSource,Z=Se.audioCodec,ne=Se.videoCodec,Re=Ke.length;Re--;){var Tt=Ke[Re];ma(Tt,"audio",be)?(Se.audioCodec=Z=Z?Z+","+Tt:Tt,zi.audio[Z.substring(0,4)]=2,Ke.splice(Re,1)):ma(Tt,"video",be)&&(Se.videoCodec=ne=ne?ne+","+Tt:Tt,zi.video[ne.substring(0,4)]=2,Ke.splice(Re,1))}});var C=Vi.parseMasterPlaylistMedia(c,f,v),F=C.AUDIO,N=F===void 0?[]:F,B=C.SUBTITLES,re=C["CLOSED-CAPTIONS"];if(N.length){var ce=N.some(function(Se){return!Se.url});!ce&&g[0].audioCodec&&!g[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),N.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Hi({}),bitrate:0,url:""}))}d.trigger(_.MANIFEST_LOADED,{levels:g,audioTracks:N,subtitles:B,captions:re,contentSteering:m,url:f,stats:e,networkDetails:a,sessionData:y,sessionKeys:b,startTimeOffset:S,variableList:L})},l.handleTrackOrLevelPlaylist=function(r,e,t,a,o){var d=this.hls,c=t.id,f=t.level,v=t.type,m=Co(r,t),g=Ge(f)?f:Ge(c)?c:0,y=ol(t),b=Vi.parseLevelPlaylist(r.data,m,g,y,0,this.variableList);if(v===pe.MANIFEST){var S={attrs:new Hi({}),bitrate:0,details:b,name:"",url:m};b.requestScheduled=e.loading.start+ds(b,0),d.trigger(_.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:m,stats:e,networkDetails:a,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}e.parsing.end=performance.now(),t.levelDetails=b,this.handlePlaylistLoaded(b,r,e,t,a,o)},l.handleManifestParsingError=function(r,e,t,a,o){this.hls.trigger(_.ERROR,{type:ut.NETWORK_ERROR,details:Q.MANIFEST_PARSING_ERROR,fatal:e.type===pe.MANIFEST,url:r.url,err:t,error:t,reason:t.message,response:r,context:e,networkDetails:a,stats:o})},l.handleNetworkError=function(r,e,t,a,o){t===void 0&&(t=!1);var d="A network "+(t?"timeout":"error"+(a?" (status "+a.code+")":""))+" occurred while loading "+r.type;r.type===pe.LEVEL?d+=": "+r.level+" id: "+r.id:(r.type===pe.AUDIO_TRACK||r.type===pe.SUBTITLE_TRACK)&&(d+=" id: "+r.id+' group-id: "'+r.groupId+'"');var c=new Error(d);this.hls.logger.warn("[playlist-loader]: "+d);var f=Q.UNKNOWN,v=!1,m=this.getInternalLoader(r);switch(r.type){case pe.MANIFEST:f=t?Q.MANIFEST_LOAD_TIMEOUT:Q.MANIFEST_LOAD_ERROR,v=!0;break;case pe.LEVEL:f=t?Q.LEVEL_LOAD_TIMEOUT:Q.LEVEL_LOAD_ERROR,v=!1;break;case pe.AUDIO_TRACK:f=t?Q.AUDIO_TRACK_LOAD_TIMEOUT:Q.AUDIO_TRACK_LOAD_ERROR,v=!1;break;case pe.SUBTITLE_TRACK:f=t?Q.SUBTITLE_TRACK_LOAD_TIMEOUT:Q.SUBTITLE_LOAD_ERROR,v=!1;break}m&&this.resetInternalLoader(r.type);var g={type:ut.NETWORK_ERROR,details:f,fatal:v,url:r.url,loader:m,context:r,error:c,networkDetails:e,stats:o};if(a){var y=(e==null?void 0:e.url)||r.url;g.response=j({url:y,data:void 0},a)}this.hls.trigger(_.ERROR,g)},l.handlePlaylistLoaded=function(r,e,t,a,o,d){var c=this.hls,f=a.type,v=a.level,m=a.levelOrTrack,g=a.id,y=a.groupId,b=a.deliveryDirectives,S=Co(e,a),L=ol(a),C=typeof a.level=="number"&&L===Ie.MAIN?v:void 0,F=r.playlistParsingError;if(F){if(this.hls.logger.warn(F+" "+r.url),!c.config.ignorePlaylistParsingErrors){c.trigger(_.ERROR,{type:ut.NETWORK_ERROR,details:Q.LEVEL_PARSING_ERROR,fatal:!1,url:S,error:F,reason:F.message,response:e,context:a,level:C,parent:L,networkDetails:o,stats:t});return}r.playlistParsingError=null}if(!r.fragments.length){var N=r.playlistParsingError=new Error("No Segments found in Playlist");c.trigger(_.ERROR,{type:ut.NETWORK_ERROR,details:Q.LEVEL_EMPTY_ERROR,fatal:!1,url:S,error:N,reason:N.message,response:e,context:a,level:C,parent:L,networkDetails:o,stats:t});return}switch(r.live&&d&&(d.getCacheAge&&(r.ageHeader=d.getCacheAge()||0),(!d.getCacheAge||isNaN(r.ageHeader))&&(r.ageHeader=0)),f){case pe.MANIFEST:case pe.LEVEL:if(C){if(!m)C=0;else if(m!==c.levels[C]){var B=c.levels.indexOf(m);B>-1&&(C=B)}}c.trigger(_.LEVEL_LOADED,{details:r,levelInfo:m||c.levels[0],level:C||0,id:g||0,stats:t,networkDetails:o,deliveryDirectives:b,withoutMultiVariant:f===pe.MANIFEST});break;case pe.AUDIO_TRACK:c.trigger(_.AUDIO_TRACK_LOADED,{details:r,track:m,id:g||0,groupId:y||"",stats:t,networkDetails:o,deliveryDirectives:b});break;case pe.SUBTITLE_TRACK:c.trigger(_.SUBTITLE_TRACK_LOADED,{details:r,track:m,id:g||0,groupId:y||"",stats:t,networkDetails:o,deliveryDirectives:b});break}},s}(),jf=function(){function s(n){n===void 0&&(n={}),this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new ae,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;var r=this.logger=Rt(n.debug||!1,"Hls instance",n.assetPlayerId),e=this.config=ql(s.DefaultConfig,n,r);this.userConfig=n,e.progressive&&nl(e,r);var t=e.abrController,a=e.bufferController,o=e.capLevelController,d=e.errorController,c=e.fpsController,f=new d(this),v=this.abrController=new t(this),m=new lt(this),g=e.interstitialsController,y=g?this.interstitialsController=new g(this,s):null,b=this.bufferController=new a(this,m),S=this.capLevelController=new o(this),L=new c(this),C=new vh(this),F=e.contentSteeringController,N=F?new F(this):null,B=this.levelController=new om(this,N),re=new Kf(this),ce=new qf(this.config,this.logger),Se=this.streamController=new lm(this,m,ce),Ke=this.gapController=new uc(this,m);S.setStreamController(Se),L.setStreamController(Se);var be=[C,B,Se];y&&be.splice(1,0,y),N&&be.splice(1,0,N),this.networkControllers=be;var Z=[v,b,Ke,S,L,re,m];this.audioTrackController=this.createController(e.audioTrackController,be);var ne=e.audioStreamController;ne&&be.push(this.audioStreamController=new ne(this,m,ce)),this.subtitleTrackController=this.createController(e.subtitleTrackController,be);var Re=e.subtitleStreamController;Re&&be.push(this.subtititleStreamController=new Re(this,m,ce)),this.createController(e.timelineController,Z),ce.emeController=this.emeController=this.createController(e.emeController,Z),this.cmcdController=this.createController(e.cmcdController,Z),this.latencyController=this.createController(Wf,Z),this.coreComponents=Z,be.push(f);var Tt=f.onErrorOut;typeof Tt=="function"&&this.on(_.ERROR,Tt,f),this.on(_.MANIFEST_LOADED,C.onManifestLoaded,C)}s.isMSESupported=function(){return Yf()},s.isSupported=function(){return Hs()},s.getMediaSource=function(){return Be()};var l=s.prototype;return l.createController=function(r,e){if(r){var t=new r(this);return e&&e.push(t),t}return null},l.on=function(r,e,t){t===void 0&&(t=this),this._emitter.on(r,e,t)},l.once=function(r,e,t){t===void 0&&(t=this),this._emitter.once(r,e,t)},l.removeAllListeners=function(r){this._emitter.removeAllListeners(r)},l.off=function(r,e,t,a){t===void 0&&(t=this),this._emitter.off(r,e,t,a)},l.listeners=function(r){return this._emitter.listeners(r)},l.emit=function(r,e,t){return this._emitter.emit(r,e,t)},l.trigger=function(r,e){if(this.config.debug)return this.emit(r,r,e);try{return this.emit(r,r,e)}catch(a){if(this.logger.error("An internal error happened while handling event "+r+'. Error message: "'+a.message+'". Here is a stacktrace:',a),!this.triggeringException){this.triggeringException=!0;var t=r===_.ERROR;this.trigger(_.ERROR,{type:ut.OTHER_ERROR,details:Q.INTERNAL_EXCEPTION,fatal:t,event:r,error:a}),this.triggeringException=!1}}return!1},l.listenerCount=function(r){return this._emitter.listenerCount(r)},l.destroy=function(){this.logger.log("destroy"),this.trigger(_.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(function(e){return e.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(e){return e.destroy()}),this.coreComponents.length=0;var r=this.config;r.xhrSetup=r.fetchSetup=void 0,this.userConfig=null},l.attachMedia=function(r){if(!r||"media"in r&&!r.media){var e=new Error("attachMedia failed: invalid argument ("+r+")");this.trigger(_.ERROR,{type:ut.OTHER_ERROR,details:Q.ATTACH_MEDIA_ERROR,fatal:!0,error:e});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());var t="media"in r,a=t?r.media:r,o=t?r:{media:a};this._media=a,this.trigger(_.MEDIA_ATTACHING,o)},l.detachMedia=function(){this.logger.log("detachMedia"),this.trigger(_.MEDIA_DETACHING,{}),this._media=null},l.transferMedia=function(){this._media=null;var r=this.bufferController.transferMedia();return this.trigger(_.MEDIA_DETACHING,{transferMedia:r}),r},l.loadSource=function(r){this.stopLoad();var e=this.media,t=this._url,a=this._url=At.buildAbsoluteURL(self.location.href,r,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log("loadSource:"+a),e&&t&&(t!==a||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(e)),this.trigger(_.MANIFEST_LOADING,{url:r})},l.startLoad=function(r,e){r===void 0&&(r=-1),this.logger.log("startLoad("+(r+(e?", <skip seek to start>":""))+")"),this.started=!0,this.resumeBuffering();for(var t=0;t<this.networkControllers.length&&(this.networkControllers[t].startLoad(r,e),!(!this.started||!this.networkControllers));t++);},l.stopLoad=function(){this.logger.log("stopLoad"),this.started=!1;for(var r=0;r<this.networkControllers.length&&(this.networkControllers[r].stopLoad(),!(this.started||!this.networkControllers));r++);},l.resumeBuffering=function(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(function(r){r.resumeBuffering&&r.resumeBuffering()}))},l.pauseBuffering=function(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(function(r){r.pauseBuffering&&r.pauseBuffering()}))},l.swapAudioCodec=function(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},l.recoverMediaError=function(){this.logger.log("recoverMediaError");var r=this._media,e=r==null?void 0:r.currentTime;this.detachMedia(),r&&(this.attachMedia(r),e&&this.startLoad(e))},l.removeLevel=function(r){this.levelController.removeLevel(r)},l.setAudioOption=function(r){var e;return((e=this.audioTrackController)==null?void 0:e.setAudioOption(r))||null},l.setSubtitleOption=function(r){var e;return((e=this.subtitleTrackController)==null?void 0:e.setSubtitleOption(r))||null},l.getMediaDecodingInfo=function(r,e){e===void 0&&(e=this.allAudioTracks);var t=ti(e);return gi(r,t,navigator.mediaCapabilities)},Ne(s,[{key:"url",get:function(){return this._url}},{key:"hasEnoughToStart",get:function(){return this.streamController.hasEnoughToStart}},{key:"startPosition",get:function(){return this.streamController.startPositionValue}},{key:"loadingEnabled",get:function(){return this.started}},{key:"bufferingEnabled",get:function(){return this.streamController.bufferingEnabled}},{key:"inFlightFragments",get:function(){var r,e=(r={},r[Ie.MAIN]=this.streamController.inFlightFrag,r);return this.audioStreamController&&(e[Ie.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[Ie.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}},{key:"sessionId",get:function(){var r=this._sessionId;return r||(r=this._sessionId=Xe()),r}},{key:"levels",get:function(){var r=this.levelController.levels;return r||[]}},{key:"latestLevelDetails",get:function(){return this.streamController.getLevelDetails()||null}},{key:"loadLevelObj",get:function(){return this.levelController.loadLevelObj}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(r){this.logger.log("set currentLevel:"+r),this.levelController.manualLevel=r,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(r){this.logger.log("set nextLevel:"+r),this.levelController.manualLevel=r,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(r){this.logger.log("set loadLevel:"+r),this.levelController.manualLevel=r}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(r){this.levelController.nextLoadLevel=r}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(r){this.logger.log("set firstLevel:"+r),this.levelController.firstLevel=r}},{key:"startLevel",get:function(){var r=this.levelController.startLevel;return r===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:r},set:function(r){this.logger.log("set startLevel:"+r),r!==-1&&(r=Math.max(r,this.minAutoLevel)),this.levelController.startLevel=r}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(r){var e=!!r;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(r){this._autoLevelCapping!==r&&(this.logger.log("set autoLevelCapping:"+r),this._autoLevelCapping=r,this.levelController.checkMaxAutoUpdated())}},{key:"bandwidthEstimate",get:function(){var r=this.abrController.bwEstimator;return r?r.getEstimate():NaN},set:function(r){this.abrController.resetEstimator(r)}},{key:"abrEwmaDefaultEstimate",get:function(){var r=this.abrController.bwEstimator;return r?r.defaultEstimate:NaN}},{key:"ttfbEstimate",get:function(){var r=this.abrController.bwEstimator;return r?r.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(r){bs(r)&&this._maxHdcpLevel!==r&&(this._maxHdcpLevel=r,this.levelController.checkMaxAutoUpdated())}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var r=this.levels,e=this.config.minAutoBitrate;if(!r)return 0;for(var t=r.length,a=0;a<t;a++)if(r[a].maxBitrate>=e)return a;return 0}},{key:"maxAutoLevel",get:function(){var r=this.levels,e=this.autoLevelCapping,t=this.maxHdcpLevel,a;if(e===-1&&r!=null&&r.length?a=r.length-1:a=e,t)for(var o=a;o--;){var d=r[o].attrs["HDCP-LEVEL"];if(d&&d<=t)return o}return a}},{key:"firstAutoLevel",get:function(){return this.abrController.firstAutoLevel}},{key:"nextAutoLevel",get:function(){return this.abrController.nextAutoLevel},set:function(r){this.abrController.nextAutoLevel=r}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"maxBufferLength",get:function(){return this.streamController.maxBufferLength}},{key:"allAudioTracks",get:function(){var r=this.audioTrackController;return r?r.allAudioTracks:[]}},{key:"audioTracks",get:function(){var r=this.audioTrackController;return r?r.audioTracks:[]}},{key:"audioTrack",get:function(){var r=this.audioTrackController;return r?r.audioTrack:-1},set:function(r){var e=this.audioTrackController;e&&(e.audioTrack=r)}},{key:"allSubtitleTracks",get:function(){var r=this.subtitleTrackController;return r?r.allSubtitleTracks:[]}},{key:"subtitleTracks",get:function(){var r=this.subtitleTrackController;return r?r.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var r=this.subtitleTrackController;return r?r.subtitleTrack:-1},set:function(r){var e=this.subtitleTrackController;e&&(e.subtitleTrack=r)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var r=this.subtitleTrackController;return r?r.subtitleDisplay:!1},set:function(r){var e=this.subtitleTrackController;e&&(e.subtitleDisplay=r)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(r){this.config.lowLatencyMode=r}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency},set:function(r){this.latencyController.targetLatency=r}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}},{key:"pathways",get:function(){return this.levelController.pathways}},{key:"pathwayPriority",get:function(){return this.levelController.pathwayPriority},set:function(r){this.levelController.pathwayPriority=r}},{key:"bufferedToEnd",get:function(){var r;return!!((r=this.bufferController)!=null&&r.bufferedToEnd)}},{key:"interstitialsManager",get:function(){var r;return((r=this.interstitialsController)==null?void 0:r.interstitialsManager)||null}}],[{key:"version",get:function(){return Ta}},{key:"Events",get:function(){return _}},{key:"MetadataSchema",get:function(){return Ii}},{key:"ErrorTypes",get:function(){return ut}},{key:"ErrorDetails",get:function(){return Q}},{key:"DefaultConfig",get:function(){return s.defaultConfig?s.defaultConfig:Uu},set:function(r){s.defaultConfig=r}}])}();return jf.defaultConfig=void 0,jf})})(!1)},4340($e){$e.exports=function(Ne,H,Qe){var de=document.head||document.getElementsByTagName("head")[0],Pe=document.createElement("script");typeof H=="function"&&(Qe=H,H={}),H=H||{},Qe=Qe||function(){},Pe.type=H.type||"text/javascript",Pe.charset=H.charset||"utf8",Pe.async="async"in H?!!H.async:!0,Pe.src=Ne,H.attrs&&Me(Pe,H.attrs),H.text&&(Pe.text=""+H.text);var he="onload"in Pe?Ee:He;he(Pe,Qe),Pe.onload||Ee(Pe,Qe),de.appendChild(Pe)};function Me(Le,Ne){for(var H in Ne)Le.setAttribute(H,Ne[H])}function Ee(Le,Ne){Le.onload=function(){this.onerror=this.onload=null,Ne(null,Le)},Le.onerror=function(){this.onerror=this.onload=null,Ne(new Error("Failed to load "+this.src),Le)}}function He(Le,Ne){Le.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,Ne(null,Le))}}},27764($e){var Me=1e3,Ee=Me*60,He=Ee*60,Le=He*24,Ne=Le*7,H=Le*365.25;$e.exports=function(O,K){K=K||{};var j=typeof O;if(j==="string"&&O.length>0)return Qe(O);if(j==="number"&&isFinite(O))return K.long?Pe(O):de(O);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(O))};function Qe(O){if(O=String(O),!(O.length>100)){var K=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(O);if(K){var j=parseFloat(K[1]),ve=(K[2]||"ms").toLowerCase();switch(ve){case"years":case"year":case"yrs":case"yr":case"y":return j*H;case"weeks":case"week":case"w":return j*Ne;case"days":case"day":case"d":return j*Le;case"hours":case"hour":case"hrs":case"hr":case"h":return j*He;case"minutes":case"minute":case"mins":case"min":case"m":return j*Ee;case"seconds":case"second":case"secs":case"sec":case"s":return j*Me;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return j;default:return}}}}function de(O){var K=Math.abs(O);return K>=Le?Math.round(O/Le)+"d":K>=He?Math.round(O/He)+"h":K>=Ee?Math.round(O/Ee)+"m":K>=Me?Math.round(O/Me)+"s":O+"ms"}function Pe(O){var K=Math.abs(O);return K>=Le?he(O,K,Le,"day"):K>=He?he(O,K,He,"hour"):K>=Ee?he(O,K,Ee,"minute"):K>=Me?he(O,K,Me,"second"):O+" ms"}function he(O,K,j,ve){var at=K>=j*1.5;return Math.round(O/j)+" "+ve+(at?"s":"")}},57233($e,Me,Ee){"use strict";var He=Object.create,Le=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,H=Object.getOwnPropertyNames,Qe=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty,Pe=function(I,A){return function(){return I&&(A=I(I=0)),A}},he=function(I,A){return function(){return A||I((A={exports:{}}).exports,A),A.exports}},O=function(I,A){for(var k in A)Le(I,k,{get:A[k],enumerable:!0})},K=function(I,A,k,x){if(A&&typeof A=="object"||typeof A=="function")for(var D=H(A),z=0,$=D.length,Fe;z<$;z++)Fe=D[z],!de.call(I,Fe)&&Fe!==k&&Le(I,Fe,{get:function(Ve){return A[Ve]}.bind(null,Fe),enumerable:!(x=Ne(A,Fe))||x.enumerable});return I},j=function(I,A,k){return k=I!=null?He(Qe(I)):{},K(A||!I||!I.__esModule?Le(k,"default",{value:I,enumerable:!0}):k,I)},ve=function(I){return K(Le({},"__esModule",{value:!0}),I)},at=he(function(I,A){var k;typeof window!="undefined"?k=window:typeof Ee.g!="undefined"?k=Ee.g:typeof self!="undefined"?k=self:k={},A.exports=k});function ze(I,A){return A!=null&&typeof Symbol!="undefined"&&A[Symbol.hasInstance]?!!A[Symbol.hasInstance](I):ze(I,A)}var Et=Pe(function(){Et()});function Xe(I){"@swc/helpers - typeof";return I&&typeof Symbol!="undefined"&&I.constructor===Symbol?"symbol":typeof I}var Ye=Pe(function(){}),Ze=he(function(I,A){var k=Array.prototype.slice;A.exports=x;function x(D,z){for(("length"in D)||(D=[D]),D=k.call(D);D.length;){var $=D.shift(),Fe=z($);if(Fe)return Fe;$.childNodes&&$.childNodes.length&&(D=k.call($.childNodes).concat(D))}}}),st=he(function(I,A){Et(),A.exports=k;function k(x,D){if(!ze(this,k))return new k(x,D);this.data=x,this.nodeValue=x,this.length=x.length,this.ownerDocument=D||null}k.prototype.nodeType=8,k.prototype.nodeName="#comment",k.prototype.toString=function(){return"[object Comment]"}}),ht=he(function(I,A){Et(),A.exports=k;function k(x,D){if(!ze(this,k))return new k(x);this.data=x||"",this.length=this.data.length,this.ownerDocument=D||null}k.prototype.type="DOMTextNode",k.prototype.nodeType=3,k.prototype.nodeName="#text",k.prototype.toString=function(){return this.data},k.prototype.replaceData=function(x,D,z){var $=this.data,Fe=$.substring(0,x),Ve=$.substring(x+D,$.length);this.data=Fe+z+Ve,this.length=this.data.length}}),Je=he(function(I,A){A.exports=k;function k(x){var D=this,z=x.type;x.target||(x.target=D),D.listeners||(D.listeners={});var $=D.listeners[z];if($)return $.forEach(function(Fe){x.currentTarget=D,typeof Fe=="function"?Fe(x):Fe.handleEvent(x)});D.parentNode&&D.parentNode.dispatchEvent(x)}}),ae=he(function(I,A){A.exports=k;function k(x,D){var z=this;z.listeners||(z.listeners={}),z.listeners[x]||(z.listeners[x]=[]),z.listeners[x].indexOf(D)===-1&&z.listeners[x].push(D)}}),dt=he(function(I,A){A.exports=k;function k(x,D){var z=this;if(z.listeners&&z.listeners[x]){var $=z.listeners[x],Fe=$.indexOf(D);Fe!==-1&&$.splice(Fe,1)}}}),ke=he(function(I,A){Ye(),A.exports=x;var k=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function x(et){switch(et.nodeType){case 3:return Mt(et.data);case 8:return"<!--"+et.data+"-->";default:return D(et)}}function D(et){var Ue=[],bt=et.tagName;return et.namespaceURI==="http://www.w3.org/1999/xhtml"&&(bt=bt.toLowerCase()),Ue.push("<"+bt+tt(et)+Fe(et)),k.indexOf(bt)>-1?Ue.push(" />"):(Ue.push(">"),et.childNodes.length?Ue.push.apply(Ue,et.childNodes.map(x)):et.textContent||et.innerText?Ue.push(Mt(et.textContent||et.innerText)):et.innerHTML&&Ue.push(et.innerHTML),Ue.push("</"+bt+">")),Ue.join("")}function z(et,Ue){var bt=Xe(et[Ue]);return Ue==="style"&&Object.keys(et.style).length>0?!0:et.hasOwnProperty(Ue)&&(bt==="string"||bt==="boolean"||bt==="number")&&Ue!=="nodeName"&&Ue!=="className"&&Ue!=="tagName"&&Ue!=="textContent"&&Ue!=="innerText"&&Ue!=="namespaceURI"&&Ue!=="innerHTML"}function $(et){if(typeof et=="string")return et;var Ue="";return Object.keys(et).forEach(function(bt){var tr=et[bt];bt=bt.replace(/[A-Z]/g,function(Kt){return"-"+Kt.toLowerCase()}),Ue+=bt+":"+tr+";"}),Ue}function Fe(et){var Ue=et.dataset,bt=[];for(var tr in Ue)bt.push({name:"data-"+tr,value:Ue[tr]});return bt.length?Ve(bt):""}function Ve(et){var Ue=[];return et.forEach(function(bt){var tr=bt.name,Kt=bt.value;tr==="style"&&(Kt=$(Kt)),Ue.push(tr+'="'+Gt(Kt)+'"')}),Ue.length?" "+Ue.join(" "):""}function tt(et){var Ue=[];for(var bt in et)z(et,bt)&&Ue.push({name:bt,value:et[bt]});for(var tr in et._attributes)for(var Kt in et._attributes[tr]){var Or=et._attributes[tr][Kt],$t=(Or.prefix?Or.prefix+":":"")+Kt;Ue.push({name:$t,value:Or.value})}return et.className&&Ue.push({name:"class",value:et.className}),Ue.length?Ve(Ue):""}function Mt(et){var Ue="";return typeof et=="string"?Ue=et:et&&(Ue=et.toString()),Ue.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Gt(et){return Mt(et).replace(/"/g,"&quot;")}}),mt=he(function(I,A){Et();var k=Ze(),x=Je(),D=ae(),z=dt(),$=ke(),Fe="http://www.w3.org/1999/xhtml";A.exports=Ve;function Ve(tt,Mt,Gt){if(!ze(this,Ve))return new Ve(tt);var et=Gt===void 0?Fe:Gt||null;this.tagName=et===Fe?String(tt).toUpperCase():tt,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=Mt||null,this.namespaceURI=et,this._attributes={},this.tagName==="INPUT"&&(this.type="text")}Ve.prototype.type="DOMElement",Ve.prototype.nodeType=1,Ve.prototype.appendChild=function(tt){return tt.parentNode&&tt.parentNode.removeChild(tt),this.childNodes.push(tt),tt.parentNode=this,tt},Ve.prototype.replaceChild=function(tt,Mt){tt.parentNode&&tt.parentNode.removeChild(tt);var Gt=this.childNodes.indexOf(Mt);return Mt.parentNode=null,this.childNodes[Gt]=tt,tt.parentNode=this,Mt},Ve.prototype.removeChild=function(tt){var Mt=this.childNodes.indexOf(tt);return this.childNodes.splice(Mt,1),tt.parentNode=null,tt},Ve.prototype.insertBefore=function(tt,Mt){tt.parentNode&&tt.parentNode.removeChild(tt);var Gt=Mt==null?-1:this.childNodes.indexOf(Mt);return Gt>-1?this.childNodes.splice(Gt,0,tt):this.childNodes.push(tt),tt.parentNode=this,tt},Ve.prototype.setAttributeNS=function(tt,Mt,Gt){var et=null,Ue=Mt,bt=Mt.indexOf(":");if(bt>-1&&(et=Mt.substr(0,bt),Ue=Mt.substr(bt+1)),this.tagName==="INPUT"&&Mt==="type")this.type=Gt;else{var tr=this._attributes[tt]||(this._attributes[tt]={});tr[Ue]={value:Gt,prefix:et}}},Ve.prototype.getAttributeNS=function(tt,Mt){var Gt=this._attributes[tt],et=Gt&&Gt[Mt]&&Gt[Mt].value;return this.tagName==="INPUT"&&Mt==="type"?this.type:typeof et!="string"?null:et},Ve.prototype.removeAttributeNS=function(tt,Mt){var Gt=this._attributes[tt];Gt&&delete Gt[Mt]},Ve.prototype.hasAttributeNS=function(tt,Mt){var Gt=this._attributes[tt];return!!Gt&&Mt in Gt},Ve.prototype.setAttribute=function(tt,Mt){return this.setAttributeNS(null,tt,Mt)},Ve.prototype.getAttribute=function(tt){return this.getAttributeNS(null,tt)},Ve.prototype.removeAttribute=function(tt){return this.removeAttributeNS(null,tt)},Ve.prototype.hasAttribute=function(tt){return this.hasAttributeNS(null,tt)},Ve.prototype.removeEventListener=z,Ve.prototype.addEventListener=D,Ve.prototype.dispatchEvent=x,Ve.prototype.focus=function(){},Ve.prototype.toString=function(){return $(this)},Ve.prototype.getElementsByClassName=function(tt){var Mt=tt.split(" "),Gt=[];return k(this,function(et){if(et.nodeType===1){var Ue=et.className||"",bt=Ue.split(" ");Mt.every(function(tr){return bt.indexOf(tr)!==-1})&&Gt.push(et)}}),Gt},Ve.prototype.getElementsByTagName=function(tt){tt=tt.toLowerCase();var Mt=[];return k(this.childNodes,function(Gt){Gt.nodeType===1&&(tt==="*"||Gt.tagName.toLowerCase()===tt)&&Mt.push(Gt)}),Mt},Ve.prototype.contains=function(tt){return k(this,function(Mt){return tt===Mt})||!1}}),At=he(function(I,A){Et();var k=mt();A.exports=x;function x(D){if(!ze(this,x))return new x;this.childNodes=[],this.parentNode=null,this.ownerDocument=D||null}x.prototype.type="DocumentFragment",x.prototype.nodeType=11,x.prototype.nodeName="#document-fragment",x.prototype.appendChild=k.prototype.appendChild,x.prototype.replaceChild=k.prototype.replaceChild,x.prototype.removeChild=k.prototype.removeChild,x.prototype.toString=function(){return this.childNodes.map(function(D){return String(D)}).join("")}}),Ge=he(function(I,A){A.exports=k;function k(x){}k.prototype.initEvent=function(x,D,z){this.type=x,this.bubbles=D,this.cancelable=z},k.prototype.preventDefault=function(){}}),De=he(function(I,A){Et();var k=Ze(),x=st(),D=ht(),z=mt(),$=At(),Fe=Ge(),Ve=Je(),tt=ae(),Mt=dt();A.exports=Gt;function Gt(){if(!ze(this,Gt))return new Gt;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}var et=Gt.prototype;et.createTextNode=function(Ue){return new D(Ue,this)},et.createElementNS=function(Ue,bt){var tr=Ue===null?null:String(Ue);return new z(bt,this,tr)},et.createElement=function(Ue){return new z(Ue,this)},et.createDocumentFragment=function(){return new $(this)},et.createEvent=function(Ue){return new Fe(Ue)},et.createComment=function(Ue){return new x(Ue,this)},et.getElementById=function(Ue){Ue=String(Ue);var bt=k(this.childNodes,function(tr){if(String(tr.id)===Ue)return tr});return bt||null},et.getElementsByClassName=z.prototype.getElementsByClassName,et.getElementsByTagName=z.prototype.getElementsByTagName,et.contains=z.prototype.contains,et.removeEventListener=Mt,et.addEventListener=tt,et.dispatchEvent=Ve}),Lt=he(function(I,A){var k=De();A.exports=new k}),ut=he(function(I,A){var k=typeof Ee.g!="undefined"?Ee.g:typeof window!="undefined"?window:{},x=Lt(),D;typeof document!="undefined"?D=document:(D=k["__GLOBAL_DOCUMENT_CACHE@4"],D||(D=k["__GLOBAL_DOCUMENT_CACHE@4"]=x)),A.exports=D}),Q={};O(Q,{default:function(){return Ka}}),$e.exports=ve(Q);function _(I){if(Array.isArray(I))return I}function pe(I,A){var k=I==null?null:typeof Symbol!="undefined"&&I[Symbol.iterator]||I["@@iterator"];if(k!=null){var x=[],D=!0,z=!1,$,Fe;try{for(k=k.call(I);!(D=($=k.next()).done)&&(x.push($.value),!(A&&x.length===A));D=!0);}catch(Ve){z=!0,Fe=Ve}finally{try{!D&&k.return!=null&&k.return()}finally{if(z)throw Fe}}return x}}function Ie(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ct(I,A){(A==null||A>I.length)&&(A=I.length);for(var k=0,x=new Array(A);k<A;k++)x[k]=I[k];return x}function _e(I,A){if(I){if(typeof I=="string")return ct(I,A);var k=Object.prototype.toString.call(I).slice(8,-1);if(k==="Object"&&I.constructor&&(k=I.constructor.name),k==="Map"||k==="Set")return Array.from(k);if(k==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(k))return ct(I,A)}}function Te(I,A){return _(I)||pe(I,A)||_e(I,A)||Ie()}var we=j(at()),xt=j(at()),Ir=j(at()),V={now:function(){var I=Ir.default.performance,A=I&&I.timing,k=A&&A.navigationStart,x=typeof k=="number"&&typeof I.now=="function"?k+I.now():Date.now();return Math.round(x)}},jt=V,Br=function(){var I,A,k;if(typeof((I=xt.default.crypto)===null||I===void 0?void 0:I.getRandomValues)=="function"){k=new Uint8Array(32),xt.default.crypto.getRandomValues(k);for(var x=0;x<32;x++)k[x]=k[x]%16}else{k=[];for(var D=0;D<32;D++)k[D]=Math.random()*16|0}var z=0;A="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(Ve){var tt=Ve==="x"?k[z]:k[z]&3|8;return z++,tt.toString(16)});var $=jt.now(),Fe=$==null?void 0:$.toString(16).substring(3);return Fe?A.substring(0,28)+Fe:A},Rt=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},U=function(I){if(I&&typeof I.nodeName!="undefined")return I.muxId||(I.muxId=Rt()),I.muxId;var A;try{A=document.querySelector(I)}catch(k){}return A&&!A.muxId&&(A.muxId=I),(A==null?void 0:A.muxId)||I},Be=function(I){var A;I&&typeof I.nodeName!="undefined"?(A=I,I=U(A)):A=document.querySelector(I);var k=A&&A.nodeName?A.nodeName.toLowerCase():"";return[A,I,k]};function je(I){if(Array.isArray(I))return ct(I)}function Jt(I){if(typeof Symbol!="undefined"&&I[Symbol.iterator]!=null||I["@@iterator"]!=null)return Array.from(I)}function Nt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ut(I){return je(I)||Jt(I)||_e(I)||Nt()}var Lr={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},zr=function(I){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3,k,x,D,z,$,Fe=I?[console,I]:[console],Ve=(k=console.trace).bind.apply(k,Ut(Fe)),tt=(x=console.info).bind.apply(x,Ut(Fe)),Mt=(D=console.debug).bind.apply(D,Ut(Fe)),Gt=(z=console.warn).bind.apply(z,Ut(Fe)),et=($=console.error).bind.apply($,Ut(Fe)),Ue=A;return{trace:function(){for(var bt=arguments.length,tr=new Array(bt),Kt=0;Kt<bt;Kt++)tr[Kt]=arguments[Kt];if(!(Ue>Lr.TRACE))return Ve.apply(void 0,Ut(tr))},debug:function(){for(var bt=arguments.length,tr=new Array(bt),Kt=0;Kt<bt;Kt++)tr[Kt]=arguments[Kt];if(!(Ue>Lr.DEBUG))return Mt.apply(void 0,Ut(tr))},info:function(){for(var bt=arguments.length,tr=new Array(bt),Kt=0;Kt<bt;Kt++)tr[Kt]=arguments[Kt];if(!(Ue>Lr.INFO))return tt.apply(void 0,Ut(tr))},warn:function(){for(var bt=arguments.length,tr=new Array(bt),Kt=0;Kt<bt;Kt++)tr[Kt]=arguments[Kt];if(!(Ue>Lr.WARN))return Gt.apply(void 0,Ut(tr))},error:function(){for(var bt=arguments.length,tr=new Array(bt),Kt=0;Kt<bt;Kt++)tr[Kt]=arguments[Kt];if(!(Ue>Lr.ERROR))return et.apply(void 0,Ut(tr))},get level(){return Ue},set level(bt){bt!==this.level&&(Ue=bt!=null?bt:A)}}},Wt=zr("[mux]"),qe=j(at());function Y(){var I=qe.default.doNotTrack||qe.default.navigator&&qe.default.navigator.doNotTrack;return I==="1"}function te(I){if(I===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I}Et();function me(I,A){if(!ze(I,A))throw new TypeError("Cannot call a class as a function")}function it(I,A){for(var k=0;k<A.length;k++){var x=A[k];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(I,x.key,x)}}function kt(I,A,k){return A&&it(I.prototype,A),k&&it(I,k),I}function Oe(I,A,k){return A in I?Object.defineProperty(I,A,{value:k,enumerable:!0,configurable:!0,writable:!0}):I[A]=k,I}function zt(I){return zt=Object.setPrototypeOf?Object.getPrototypeOf:function(A){return A.__proto__||Object.getPrototypeOf(A)},zt(I)}function Pt(I,A){for(;!Object.prototype.hasOwnProperty.call(I,A)&&(I=zt(I),I!==null););return I}function Zt(I,A,k){return typeof Reflect!="undefined"&&Reflect.get?Zt=Reflect.get:Zt=function(x,D,z){var $=Pt(x,D);if($){var Fe=Object.getOwnPropertyDescriptor($,D);return Fe.get?Fe.get.call(z||x):Fe.value}},Zt(I,A,k||I)}function Wr(I,A){return Wr=Object.setPrototypeOf||function(k,x){return k.__proto__=x,k},Wr(I,A)}function ft(I,A){if(typeof A!="function"&&A!==null)throw new TypeError("Super expression must either be null or a function");I.prototype=Object.create(A&&A.prototype,{constructor:{value:I,writable:!0,configurable:!0}}),A&&Wr(I,A)}function Qr(I,A){if(I==null)return{};var k={},x=Object.keys(I),D,z;for(z=0;z<x.length;z++)D=x[z],!(A.indexOf(D)>=0)&&(k[D]=I[D]);return k}function li(I,A){if(I==null)return{};var k=Qr(I,A),x,D;if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols(I);for(D=0;D<z.length;D++)x=z[D],!(A.indexOf(x)>=0)&&Object.prototype.propertyIsEnumerable.call(I,x)&&(k[x]=I[x])}return k}function ln(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(I){return!1}}Ye();function Ar(I,A){return A&&(Xe(A)==="object"||typeof A=="function")?A:te(I)}function Yi(I){var A=ln();return function(){var k=zt(I),x;if(A){var D=zt(this).constructor;x=Reflect.construct(k,arguments,D)}else x=k.apply(this,arguments);return Ar(this,x)}}var _i=function(I){return br(I)[0]},br=function(I){if(typeof I!="string"||I==="")return["localhost"];var A=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,k=I.match(A)||[],x=k[4],D;return x&&(D=(x.match(/[^\.]+\.[^\.]+$/)||[])[0]),[x,D]},fe=j(at()),ye={exists:function(){var I=fe.default.performance,A=I&&I.timing;return A!==void 0},domContentLoadedEventEnd:function(){var I=fe.default.performance,A=I&&I.timing;return A&&A.domContentLoadedEventEnd},navigationStart:function(){var I=fe.default.performance,A=I&&I.timing;return A&&A.navigationStart}},oe=ye;function yt(I,A,k){k=k===void 0?1:k,I[A]=I[A]||0,I[A]+=k}function qt(I){for(var A=1;A<arguments.length;A++){var k=arguments[A]!=null?arguments[A]:{},x=Object.keys(k);typeof Object.getOwnPropertySymbols=="function"&&(x=x.concat(Object.getOwnPropertySymbols(k).filter(function(D){return Object.getOwnPropertyDescriptor(k,D).enumerable}))),x.forEach(function(D){Oe(I,D,k[D])})}return I}function yr(I,A){var k=Object.keys(I);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(I);A&&(x=x.filter(function(D){return Object.getOwnPropertyDescriptor(I,D).enumerable})),k.push.apply(k,x)}return k}function Rr(I,A){return A=A!=null?A:{},Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(A)):yr(Object(A)).forEach(function(k){Object.defineProperty(I,k,Object.getOwnPropertyDescriptor(A,k))}),I}var Qt=["x-cdn","content-type"],Ht=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],Ci=Qt.concat(Ht);function Ft(I){I=I||"";var A={},k=I.trim().split(/[\r\n]+/);return k.forEach(function(x){if(x){var D=x.split(": "),z=D.shift();z&&(Ci.indexOf(z.toLowerCase())>=0||z.toLowerCase().indexOf("x-litix-")===0)&&(A[z]=D.join(": "))}}),A}function ie(I){if(I){var A=Ht.find(function(k){return I[k]!==void 0});return A?I[A]:void 0}}var er=function(I){var A={};for(var k in I){var x=I[k],D=x["DATA-ID"].search("io.litix.data.");if(D!==-1){var z=x["DATA-ID"].replace("io.litix.data.","");A[z]=x.VALUE}}return A},Ai=er,Bi=function(I){if(!I)return{};var A=oe.navigationStart(),k=I.loading,x=k?k.start:I.trequest,D=k?k.first:I.tfirst,z=k?k.end:I.tload;return{bytesLoaded:I.total,requestStart:Math.round(A+x),responseStart:Math.round(A+D),responseEnd:Math.round(A+z)}},Hr=function(I){if(!(!I||typeof I.getAllResponseHeaders!="function"))return Ft(I.getAllResponseHeaders())},pi=function(I,A,k){var x=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},D=arguments.length>4?arguments[4]:void 0,z=I.log,$=I.utils.secondsToMs,Fe=function(Or){var $t=parseInt(D.version),Ot;return $t===1&&Or.programDateTime!==null&&(Ot=Or.programDateTime),$t===0&&Or.pdt!==null&&(Ot=Or.pdt),Ot};if(!oe.exists()){z.warn("performance timing not supported. Not tracking HLS.js.");return}var Ve=function(Or,$t){return I.emit(A,Or,$t)},tt=function(Or,$t){var Ot=$t.levels,St=$t.audioTracks,Sr=$t.url,kr=$t.stats,rt=$t.networkDetails,ri=$t.sessionData,Ni={},Vi={};Ot.forEach(function(la,Ss){Ni[Ss]={width:la.width,height:la.height,bitrate:la.bitrate,attrs:la.attrs}}),St.forEach(function(la,Ss){Vi[Ss]={name:la.name,language:la.lang,bitrate:la.bitrate}});var ii=Bi(kr),oi=ii.bytesLoaded,Dn=ii.requestStart,As=ii.responseStart,en=ii.responseEnd;Ve("requestcompleted",Rr(qt({},Ai(ri)),{request_event_type:Or,request_bytes_loaded:oi,request_start:Dn,request_response_start:As,request_response_end:en,request_type:"manifest",request_hostname:_i(Sr),request_response_headers:Hr(rt),request_rendition_lists:{media:Ni,audio:Vi,video:{}}}))};k.on(D.Events.MANIFEST_LOADED,tt);var Mt=function(Or,$t){var Ot=$t.details,St=$t.level,Sr=$t.networkDetails,kr=$t.stats,rt=Bi(kr),ri=rt.bytesLoaded,Ni=rt.requestStart,Vi=rt.responseStart,ii=rt.responseEnd,oi=Ot.fragments[Ot.fragments.length-1],Dn=Fe(oi)+$(oi.duration);Ve("requestcompleted",{request_event_type:Or,request_bytes_loaded:ri,request_start:Ni,request_response_start:Vi,request_response_end:ii,request_current_level:St,request_type:"manifest",request_hostname:_i(Ot.url),request_response_headers:Hr(Sr),video_holdback:Ot.holdBack&&$(Ot.holdBack),video_part_holdback:Ot.partHoldBack&&$(Ot.partHoldBack),video_part_target_duration:Ot.partTarget&&$(Ot.partTarget),video_target_duration:Ot.targetduration&&$(Ot.targetduration),video_source_is_live:Ot.live,player_manifest_newest_program_time:isNaN(Dn)?void 0:Dn})};k.on(D.Events.LEVEL_LOADED,Mt);var Gt=function(Or,$t){var Ot=$t.details,St=$t.networkDetails,Sr=$t.stats,kr=Bi(Sr),rt=kr.bytesLoaded,ri=kr.requestStart,Ni=kr.responseStart,Vi=kr.responseEnd;Ve("requestcompleted",{request_event_type:Or,request_bytes_loaded:rt,request_start:ri,request_response_start:Ni,request_response_end:Vi,request_type:"manifest",request_hostname:_i(Ot.url),request_response_headers:Hr(St)})};k.on(D.Events.AUDIO_TRACK_LOADED,Gt);var et=function(Or,$t){var Ot=$t.stats,St=$t.networkDetails,Sr=$t.frag;Ot=Ot||Sr.stats;var kr=Bi(Ot),rt=kr.bytesLoaded,ri=kr.requestStart,Ni=kr.responseStart,Vi=kr.responseEnd,ii=St?Hr(St):void 0,oi={request_event_type:Or,request_bytes_loaded:rt,request_start:ri,request_response_start:Ni,request_response_end:Vi,request_hostname:St?_i(St.responseURL):void 0,request_id:ii?ie(ii):void 0,request_response_headers:ii,request_media_duration:Sr.duration,request_url:St==null?void 0:St.responseURL};Sr.type==="main"?(oi.request_type="media",oi.request_current_level=Sr.level,oi.request_video_width=(k.levels[Sr.level]||{}).width,oi.request_video_height=(k.levels[Sr.level]||{}).height,oi.request_labeled_bitrate=(k.levels[Sr.level]||{}).bitrate):oi.request_type=Sr.type,Ve("requestcompleted",oi)};k.on(D.Events.FRAG_LOADED,et);var Ue=function(Or,$t){var Ot=$t.frag,St=Ot.start,Sr=Fe(Ot),kr={currentFragmentPDT:Sr,currentFragmentStart:$(St)};Ve("fragmentchange",kr)};k.on(D.Events.FRAG_CHANGED,Ue);var bt=function(Or,$t){var Ot=$t.type,St=$t.details,Sr=$t.response,kr=$t.fatal,rt=$t.frag,ri=$t.networkDetails,Ni=(rt==null?void 0:rt.url)||$t.url||"",Vi=ri?Hr(ri):void 0;if((St===D.ErrorDetails.MANIFEST_LOAD_ERROR||St===D.ErrorDetails.MANIFEST_LOAD_TIMEOUT||St===D.ErrorDetails.FRAG_LOAD_ERROR||St===D.ErrorDetails.FRAG_LOAD_TIMEOUT||St===D.ErrorDetails.LEVEL_LOAD_ERROR||St===D.ErrorDetails.LEVEL_LOAD_TIMEOUT||St===D.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||St===D.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT||St===D.ErrorDetails.SUBTITLE_LOAD_ERROR||St===D.ErrorDetails.SUBTITLE_LOAD_TIMEOUT||St===D.ErrorDetails.KEY_LOAD_ERROR||St===D.ErrorDetails.KEY_LOAD_TIMEOUT)&&Ve("requestfailed",{request_error:St,request_url:Ni,request_hostname:_i(Ni),request_id:Vi?ie(Vi):void 0,request_type:St===D.ErrorDetails.FRAG_LOAD_ERROR||St===D.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":St===D.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||St===D.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":St===D.ErrorDetails.SUBTITLE_LOAD_ERROR||St===D.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":St===D.ErrorDetails.KEY_LOAD_ERROR||St===D.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:Sr==null?void 0:Sr.code,request_error_text:Sr==null?void 0:Sr.text}),kr){var ii,oi="".concat(Ni?"url: ".concat(Ni,`
`):"")+"".concat(Sr&&(Sr.code||Sr.text)?"response: ".concat(Sr.code,", ").concat(Sr.text,`
`):"")+"".concat($t.reason?"failure reason: ".concat($t.reason,`
`):"")+"".concat($t.level?"level: ".concat($t.level,`
`):"")+"".concat($t.parent?"parent stream controller: ".concat($t.parent,`
`):"")+"".concat($t.buffer?"buffer length: ".concat($t.buffer,`
`):"")+"".concat($t.error?"error: ".concat($t.error,`
`):"")+"".concat($t.event?"event: ".concat($t.event,`
`):"")+"".concat($t.err?"error message: ".concat((ii=$t.err)===null||ii===void 0?void 0:ii.message,`
`):"");Ve("error",{player_error_code:Ot,player_error_message:St,player_error_context:oi})}};k.on(D.Events.ERROR,bt);var tr=function(Or,$t){var Ot=$t.frag,St=Ot&&Ot._url||"";Ve("requestcanceled",{request_event_type:Or,request_url:St,request_type:"media",request_hostname:_i(St)})};k.on(D.Events.FRAG_LOAD_EMERGENCY_ABORTED,tr);var Kt=function(Or,$t){var Ot=$t.level,St=k.levels[Ot];if(St&&St.attrs&&St.attrs.BANDWIDTH){var Sr=St.attrs.BANDWIDTH,kr,rt=parseFloat(St.attrs["FRAME-RATE"]);isNaN(rt)||(kr=rt),Sr?Ve("renditionchange",{video_source_fps:kr,video_source_bitrate:Sr,video_source_width:St.width,video_source_height:St.height,video_source_rendition_name:St.name,video_source_codec:St==null?void 0:St.videoCodec}):z.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};k.on(D.Events.LEVEL_SWITCHED,Kt),k._stopMuxMonitor=function(){k.off(D.Events.MANIFEST_LOADED,tt),k.off(D.Events.LEVEL_LOADED,Mt),k.off(D.Events.AUDIO_TRACK_LOADED,Gt),k.off(D.Events.FRAG_LOADED,et),k.off(D.Events.FRAG_CHANGED,Ue),k.off(D.Events.ERROR,bt),k.off(D.Events.FRAG_LOAD_EMERGENCY_ABORTED,tr),k.off(D.Events.LEVEL_SWITCHED,Kt),k.off(D.Events.DESTROYING,k._stopMuxMonitor),delete k._stopMuxMonitor},k.on(D.Events.DESTROYING,k._stopMuxMonitor)},$r=function(I){I&&typeof I._stopMuxMonitor=="function"&&I._stopMuxMonitor()},Jr=function(I,A){if(!I||!I.requestEndDate)return{};var k=_i(I.url),x=I.url,D=I.bytesLoaded,z=new Date(I.requestStartDate).getTime(),$=new Date(I.firstByteDate).getTime(),Fe=new Date(I.requestEndDate).getTime(),Ve=isNaN(I.duration)?0:I.duration,tt=typeof A.getMetricsFor=="function"?A.getMetricsFor(I.mediaType).HttpList:A.getDashMetrics().getHttpRequests(I.mediaType),Mt;tt.length>0&&(Mt=Ft(tt[tt.length-1]._responseHeaders||""));var Gt=Mt?ie(Mt):void 0;return{requestStart:z,requestResponseStart:$,requestResponseEnd:Fe,requestBytesLoaded:D,requestResponseHeaders:Mt,requestMediaDuration:Ve,requestHostname:k,requestUrl:x,requestId:Gt}},Yr=function(I,A){var k=A.getQualityFor(I),x=A.getCurrentTrackFor(I).bitrateList;return x?{currentLevel:k,renditionWidth:x[k].width||null,renditionHeight:x[k].height||null,renditionBitrate:x[k].bandwidth}:{}},Pa=function(I){var A;return(A=I.match(/.*codecs\*?="(.*)"/))===null||A===void 0?void 0:A[1]},za=function(I){try{var A,k,x=(k=I.getVersion)===null||k===void 0||(A=k.call(I))===null||A===void 0?void 0:A.split(".").map(function(D){return parseInt(D)})[0];return x}catch(D){return!1}},un=function(I,A,k){var x=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},D=I.log;if(!k||!k.on){D.warn("Invalid dash.js player reference. Monitoring blocked.");return}var z=za(k),$=function(Ot,St){return I.emit(A,Ot,St)},Fe=function(Ot){var St=Ot.type,Sr=Ot.data,kr=(Sr||{}).url;$("requestcompleted",{request_event_type:St,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:_i(kr),request_url:kr})};k.on("manifestLoaded",Fe);var Ve={},tt=function(Ot){if(typeof Ot.getRequests!="function")return null;var St=Ot.getRequests({state:"executed"});return St.length===0?null:St[St.length-1]},Mt=function(Ot){var St=Ot.type,Sr=Ot.fragmentModel,kr=Ot.chunk,rt=tt(Sr);Gt({type:St,request:rt,chunk:kr})},Gt=function(Ot){var St=Ot.type,Sr=Ot.chunk,kr=Ot.request,rt=(Sr||{}).mediaInfo,ri=rt||{},Ni=ri.type,Vi=ri.bitrateList;Vi=Vi||[];var ii={};Vi.forEach(function(tn,vi){ii[vi]={},ii[vi].width=tn.width,ii[vi].height=tn.height,ii[vi].bitrate=tn.bandwidth,ii[vi].attrs={}}),Ni==="video"?Ve.video=ii:Ni==="audio"?Ve.audio=ii:Ve.media=ii;var oi=Jr(kr,k),Dn=oi.requestStart,As=oi.requestResponseStart,en=oi.requestResponseEnd,la=oi.requestResponseHeaders,Ss=oi.requestMediaDuration,gn=oi.requestHostname,Ls=oi.requestUrl,mo=oi.requestId;$("requestcompleted",{request_event_type:St,request_start:Dn,request_response_start:As,request_response_end:en,request_bytes_loaded:-1,request_type:Ni+"_init",request_response_headers:la,request_hostname:gn,request_id:mo,request_url:Ls,request_media_duration:Ss,request_rendition_lists:Ve})};z>=4?k.on("initFragmentLoaded",Gt):k.on("initFragmentLoaded",Mt);var et=function(Ot){var St=Ot.type,Sr=Ot.fragmentModel,kr=Ot.chunk,rt=tt(Sr);Ue({type:St,request:rt,chunk:kr})},Ue=function(Ot){var St=Ot.type,Sr=Ot.chunk,kr=Ot.request,rt=Sr||{},ri=rt.mediaInfo,Ni=rt.start,Vi=ri||{},ii=Vi.type,oi=Jr(kr,k),Dn=oi.requestStart,As=oi.requestResponseStart,en=oi.requestResponseEnd,la=oi.requestBytesLoaded,Ss=oi.requestResponseHeaders,gn=oi.requestMediaDuration,Ls=oi.requestHostname,mo=oi.requestUrl,tn=oi.requestId,vi=Yr(ii,k),El=vi.currentLevel,po=vi.renditionWidth,Po=vi.renditionHeight,go=vi.renditionBitrate;$("requestcompleted",{request_event_type:St,request_start:Dn,request_response_start:As,request_response_end:en,request_bytes_loaded:la,request_type:ii,request_response_headers:Ss,request_hostname:Ls,request_id:tn,request_url:mo,request_media_start_time:Ni,request_media_duration:gn,request_current_level:El,request_labeled_bitrate:go,request_video_width:po,request_video_height:Po})};z>=4?k.on("mediaFragmentLoaded",Ue):k.on("mediaFragmentLoaded",et);var bt={video:void 0,audio:void 0,totalBitrate:void 0},tr=function(){if(bt.video&&typeof bt.video.bitrate=="number"){if(!(bt.video.width&&bt.video.height)){D.warn("have bitrate info for video but missing width/height");return}var Ot=bt.video.bitrate;if(bt.audio&&typeof bt.audio.bitrate=="number"&&(Ot+=bt.audio.bitrate),Ot!==bt.totalBitrate)return bt.totalBitrate=Ot,{video_source_bitrate:Ot,video_source_height:bt.video.height,video_source_width:bt.video.width,video_source_codec:Pa(bt.video.codec)}}},Kt=function(Ot,St,Sr){if(typeof Ot.newQuality!="number"){D.warn("missing evt.newQuality in qualityChangeRendered event",Ot);return}var kr=Ot.mediaType;if(kr==="audio"||kr==="video"){var rt=k.getBitrateInfoListFor(kr).find(function(Ni){var Vi=Ni.qualityIndex;return Vi===Ot.newQuality});if(!(rt&&typeof rt.bitrate=="number")){D.warn("missing bitrate info for ".concat(kr));return}bt[kr]=Rr(qt({},rt),{codec:k.getCurrentTrackFor(kr).codec});var ri=tr();ri&&$("renditionchange",ri)}};k.on("qualityChangeRendered",Kt);var Or=function(Ot){var St=Ot.request,Sr=Ot.mediaType;St=St||{},$("requestcanceled",{request_event_type:St.type+"_"+St.action,request_url:St.url,request_type:Sr,request_hostname:_i(St.url)})};k.on("fragmentLoadingAbandoned",Or);var $t=function(Ot){var St=Ot.error,Sr,kr,rt=(St==null||(Sr=St.data)===null||Sr===void 0?void 0:Sr.request)||{},ri=(St==null||(kr=St.data)===null||kr===void 0?void 0:kr.response)||{};(St==null?void 0:St.code)===27&&$("requestfailed",{request_error:rt.type+"_"+rt.action,request_url:rt.url,request_hostname:_i(rt.url),request_type:rt.mediaType,request_error_code:ri.status,request_error_text:ri.statusText});var Ni="".concat(rt!=null&&rt.url?"url: ".concat(rt.url,`
`):"")+"".concat(ri!=null&&ri.status||ri!=null&&ri.statusText?"response: ".concat(ri==null?void 0:ri.status,", ").concat(ri==null?void 0:ri.statusText,`
`):"");$("error",{player_error_code:St==null?void 0:St.code,player_error_message:St==null?void 0:St.message,player_error_context:Ni})};k.on("error",$t),k._stopMuxMonitor=function(){k.off("manifestLoaded",Fe),k.off("initFragmentLoaded",Gt),k.off("mediaFragmentLoaded",Ue),k.off("qualityChangeRendered",Kt),k.off("error",$t),k.off("fragmentLoadingAbandoned",Or),delete k._stopMuxMonitor}},zi=function(I){I&&typeof I._stopMuxMonitor=="function"&&I._stopMuxMonitor()},aa=0,ma=function(){"use strict";function I(){me(this,I),Oe(this,"_listeners",void 0)}return kt(I,[{key:"on",value:function(A,k,x){return k._eventEmitterGuid=k._eventEmitterGuid||++aa,this._listeners=this._listeners||{},this._listeners[A]=this._listeners[A]||[],x&&(k=k.bind(x)),this._listeners[A].push(k),k}},{key:"off",value:function(A,k){var x=this._listeners&&this._listeners[A];x&&x.forEach(function(D,z){D._eventEmitterGuid===k._eventEmitterGuid&&x.splice(z,1)})}},{key:"one",value:function(A,k,x){var D=this;k._eventEmitterGuid=k._eventEmitterGuid||++aa;var z=function(){D.off(A,z),k.apply(x||this,arguments)};z._eventEmitterGuid=k._eventEmitterGuid,this.on(A,z)}},{key:"emit",value:function(A,k){var x=this;if(this._listeners){k=k||{};var D=this._listeners["before"+A]||[],z=this._listeners["before*"]||[],$=this._listeners[A]||[],Fe=this._listeners["after"+A]||[],Ve=function(tt,Mt){tt=tt.slice(),tt.forEach(function(Gt){Gt.call(x,{type:A},Mt)})};Ve(D,k),Ve(z,k),Ve($,k),Ve(Fe,k)}}}]),I}(),Oa=ma,Qi=j(at()),dn=function(){"use strict";function I(A){var k=this;me(this,I),Oe(this,"_playbackHeartbeatInterval",void 0),Oe(this,"_playheadShouldBeProgressing",void 0),Oe(this,"pm",void 0),this.pm=A,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,A.on("playing",function(){k._playheadShouldBeProgressing=!0}),A.on("play",this._startPlaybackHeartbeatInterval.bind(this)),A.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),A.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),A.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),A.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),A.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),A.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),A.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),A.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),A.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),A.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),A.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),A.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),A.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),A.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),A.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),A.on("seeked",function(){A.data.player_is_paused?k._stopPlaybackHeartbeatInterval():k._startPlaybackHeartbeatInterval()}),A.on("timeupdate",function(){k._playbackHeartbeatInterval!==null&&A.emit("playbackheartbeat")}),A.on("devicesleep",function(x,D){k._playbackHeartbeatInterval!==null&&(Qi.default.clearInterval(k._playbackHeartbeatInterval),A.emit("playbackheartbeatend",{viewer_time:D.viewer_time}),k._playbackHeartbeatInterval=null)})}return kt(I,[{key:"_startPlaybackHeartbeatInterval",value:function(){var A=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=Qi.default.setInterval(function(){A.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(Qi.default.clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}]),I}(),Qa=dn,Si=function I(A){"use strict";var k=this;me(this,I),Oe(this,"viewErrored",void 0),A.on("viewinit",function(){k.viewErrored=!1}),A.on("error",function(x,D){try{var z=A.errorTranslator({player_error_code:D.player_error_code,player_error_message:D.player_error_message,player_error_context:D.player_error_context,player_error_severity:D.player_error_severity,player_error_business_exception:D.player_error_business_exception});z&&(A.data.player_error_code=z.player_error_code||D.player_error_code,A.data.player_error_message=z.player_error_message||D.player_error_message,A.data.player_error_context=z.player_error_context||D.player_error_context,A.data.player_error_severity=z.player_error_severity||D.player_error_severity,A.data.player_error_business_exception=z.player_error_business_exception||D.player_error_business_exception,k.viewErrored=!0)}catch($){A.mux.log.warn("Exception in error translator callback.",$),k.viewErrored=!0}}),A.on("aftererror",function(){var x,D,z,$,Fe;(x=A.data)===null||x===void 0||delete x.player_error_code,(D=A.data)===null||D===void 0||delete D.player_error_message,(z=A.data)===null||z===void 0||delete z.player_error_context,($=A.data)===null||$===void 0||delete $.player_error_severity,(Fe=A.data)===null||Fe===void 0||delete Fe.player_error_business_exception})},Gs=Si,cn=function(){"use strict";function I(A){me(this,I),Oe(this,"_watchTimeTrackerLastCheckedTime",void 0),Oe(this,"pm",void 0),this.pm=A,this._watchTimeTrackerLastCheckedTime=null,A.on("playbackheartbeat",this._updateWatchTime.bind(this)),A.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}return kt(I,[{key:"_updateWatchTime",value:function(A,k){var x=k.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=x),yt(this.pm.data,"view_watch_time",x-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=x}},{key:"_clearWatchTimeState",value:function(A,k){this._updateWatchTime(A,k),this._watchTimeTrackerLastCheckedTime=null}}]),I}(),ui=cn,Li=function(){"use strict";function I(A){var k=this;me(this,I),Oe(this,"_playbackTimeTrackerLastPlayheadPosition",void 0),Oe(this,"_lastTime",void 0),Oe(this,"_isAdPlaying",void 0),Oe(this,"_callbackUpdatePlaybackTime",void 0),Oe(this,"pm",void 0),this.pm=A,this._playbackTimeTrackerLastPlayheadPosition=-1,this._lastTime=jt.now(),this._isAdPlaying=!1,this._callbackUpdatePlaybackTime=null,A.on("viewinit",function(){k.pm.data.view_playing_time_ms_cumulative=0});var x=this._startPlaybackTimeTracking.bind(this);A.on("playing",x),A.on("adplaying",x),A.on("seeked",x),A.on("rebufferend",x);var D=this._stopPlaybackTimeTracking.bind(this);A.on("playbackheartbeatend",D),A.on("seeking",D),A.on("rebufferstart",D),A.on("adplaying",function(){k._isAdPlaying=!0}),A.on("adended",function(){k._isAdPlaying=!1}),A.on("adpause",function(){k._isAdPlaying=!1}),A.on("adbreakstart",function(){k._isAdPlaying=!1}),A.on("adbreakend",function(){k._isAdPlaying=!1}),A.on("adplay",function(){k._isAdPlaying=!1}),A.on("viewinit",function(){k._playbackTimeTrackerLastPlayheadPosition=-1,k._lastTime=jt.now(),k._isAdPlaying=!1,k._callbackUpdatePlaybackTime=null})}return kt(I,[{key:"_startPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime===null&&(this._callbackUpdatePlaybackTime=this._updatePlaybackTime.bind(this),this._playbackTimeTrackerLastPlayheadPosition=this.pm.data.player_playhead_time,this._lastTime=jt.now(),this.pm.on("playbackheartbeat",this._callbackUpdatePlaybackTime))}},{key:"_stopPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime&&(this._updatePlaybackTime(),this.pm.off("playbackheartbeat",this._callbackUpdatePlaybackTime),this._callbackUpdatePlaybackTime=null,this._playbackTimeTrackerLastPlayheadPosition=-1)}},{key:"_updatePlaybackTime",value:function(){var A=this.pm.data.player_playhead_time||0,k=jt.now(),x=k-this._lastTime,D=-1;this._playbackTimeTrackerLastPlayheadPosition>=0&&A>this._playbackTimeTrackerLastPlayheadPosition?D=A-this._playbackTimeTrackerLastPlayheadPosition:this._isAdPlaying&&(D=x),D>0&&D<=1e3&&yt(this.pm.data,"view_content_playback_time",D),this._callbackUpdatePlaybackTime!==null&&x>0&&x<=1e3&&(this._isAdPlaying&&yt(this.pm.data,"ad_playing_time_ms_cumulative",x),yt(this.pm.data,"view_playing_time_ms_cumulative",x)),this._playbackTimeTrackerLastPlayheadPosition=A,this._lastTime=k}}]),I}(),Nr=Li,Vr=function(){"use strict";function I(A){me(this,I),Oe(this,"pm",void 0),this.pm=A;var k=this._updatePlayheadTime.bind(this);A.on("playbackheartbeat",k),A.on("playbackheartbeatend",k),A.on("timeupdate",k),A.on("destroy",function(){A.off("timeupdate",k)})}return kt(I,[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=typeof this.pm.data.view_max_playhead_position=="undefined"?this.pm.data.player_playhead_time:Math.max(this.pm.data.view_max_playhead_position,this.pm.data.player_playhead_time)}},{key:"_updatePlayheadTime",value:function(A,k){var x=this,D=function(){x.pm.currentFragmentPDT&&x.pm.currentFragmentStart&&(x.pm.data.player_program_time=x.pm.currentFragmentPDT+x.pm.data.player_playhead_time-x.pm.currentFragmentStart)};if(k&&k.player_playhead_time)this.pm.data.player_playhead_time=k.player_playhead_time,D(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var z=this.pm.getPlayheadTime();typeof z!="undefined"&&(this.pm.data.player_playhead_time=z,D(),this._updateMaxPlayheadPosition())}}}]),I}(),di=Vr,qr=5*60*1e3,Kn=function I(A){"use strict";if(me(this,I),!A.disableRebufferTracking){var k,x=function(z,$){D($),k=void 0},D=function(z){if(k){var $=z.viewer_time-k;yt(A.data,"view_rebuffer_duration",$),k=z.viewer_time,A.data.view_rebuffer_duration>qr&&(A.emit("viewend"),A.send("viewend"),A.mux.log.warn("Ending view after rebuffering for longer than ".concat(qr,"ms, future events will be ignored unless a programchange or videochange occurs.")))}A.data.view_watch_time>=0&&A.data.view_rebuffer_count>0&&(A.data.view_rebuffer_frequency=A.data.view_rebuffer_count/A.data.view_watch_time,A.data.view_rebuffer_percentage=A.data.view_rebuffer_duration/A.data.view_watch_time)};A.on("playbackheartbeat",function(z,$){return D($)}),A.on("rebufferstart",function(z,$){k||(yt(A.data,"view_rebuffer_count",1),k=$.viewer_time,A.one("rebufferend",x))}),A.on("viewinit",function(){k=void 0,A.off("rebufferend",x)})}},ha=Kn,X=function(){"use strict";function I(A){var k=this;me(this,I),Oe(this,"_lastCheckedTime",void 0),Oe(this,"_lastPlayheadTime",void 0),Oe(this,"_lastPlayheadTimeUpdatedTime",void 0),Oe(this,"_rebuffering",void 0),Oe(this,"pm",void 0),this.pm=A,!(A.disableRebufferTracking||A.disablePlayheadRebufferTracking)&&(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,A.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),A.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),A.on("seeking",function(){k._cleanupRebufferTracker(null,{viewer_time:jt.now()})}))}return kt(I,[{key:"_checkIfRebuffering",value:function(A,k){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing){this._cleanupRebufferTracker(A,k);return}if(this._lastCheckedTime===null){this._prepareRebufferTrackerState(k.viewer_time);return}if(this._lastPlayheadTime!==this.pm.data.player_playhead_time){this._cleanupRebufferTracker(A,k,!0);return}var x=k.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&x>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=k.viewer_time}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(A){this._lastCheckedTime=A,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=A}},{key:"_cleanupRebufferTracker",value:function(A,k){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:k.viewer_time});else{if(this._lastCheckedTime===null)return;var D=this.pm.data.player_playhead_time-this._lastPlayheadTime,z=k.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&D>0&&z-D>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+z-D}))}x?this._prepareRebufferTrackerState(k.viewer_time):this._clearRebufferTrackerState()}}]),I}(),W=X,se=function(){"use strict";function I(A){var k=this;me(this,I),Oe(this,"pm",void 0),this.pm=A,A.on("viewinit",function(){var x=A.data,D=x.view_id;if(!x.view_program_changed){var z=function($,Fe){var Ve=Fe.viewer_time;($.type==="playing"&&typeof A.data.view_time_to_first_frame=="undefined"||$.type==="adplaying"&&(typeof A.data.view_time_to_first_frame=="undefined"||k._inPrerollPosition()))&&k.calculateTimeToFirstFrame(Ve||jt.now(),D)};A.one("playing",z),A.one("adplaying",z),A.one("viewend",function(){A.off("playing",z),A.off("adplaying",z)})}})}return kt(I,[{key:"_inPrerollPosition",value:function(){return typeof this.pm.data.view_content_playback_time=="undefined"||this.pm.data.view_content_playback_time<=1e3}},{key:"calculateTimeToFirstFrame",value:function(A,k){k===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:A}),this.pm.data.view_time_to_first_frame=this.pm.data.view_watch_time,(this.pm.data.player_autoplay_on||this.pm.data.video_is_autoplay)&&this.pm.pageLoadInitTime&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.pm.pageLoadInitTime))}}]),I}(),Vt=se,Cr=function I(A){"use strict";var k=this;me(this,I),Oe(this,"_lastPlayerHeight",void 0),Oe(this,"_lastPlayerWidth",void 0),Oe(this,"_lastPlayheadPosition",void 0),Oe(this,"_lastSourceHeight",void 0),Oe(this,"_lastSourceWidth",void 0),A.on("viewinit",function(){k._lastPlayheadPosition=-1});var x=["pause","rebufferstart","seeking","error","adbreakstart","hb","renditionchange","orientationchange","viewend","playbackmodechange"],D=["playing","hb","renditionchange","orientationchange","playbackmodechange"];x.forEach(function(z){A.on(z,function(){if(k._lastPlayheadPosition>=0&&A.data.player_playhead_time>=0&&k._lastPlayerWidth>=0&&k._lastSourceWidth>0&&k._lastPlayerHeight>=0&&k._lastSourceHeight>0){var $=A.data.player_playhead_time-k._lastPlayheadPosition;if($<0){k._lastPlayheadPosition=-1;return}var Fe=Math.min(k._lastPlayerWidth/k._lastSourceWidth,k._lastPlayerHeight/k._lastSourceHeight),Ve=Math.max(0,Fe-1),tt=Math.max(0,1-Fe);A.data.view_max_upscale_percentage=Math.max(A.data.view_max_upscale_percentage||0,Ve),A.data.view_max_downscale_percentage=Math.max(A.data.view_max_downscale_percentage||0,tt),yt(A.data,"view_total_content_playback_time",$),yt(A.data,"view_total_upscaling",Ve*$),yt(A.data,"view_total_downscaling",tt*$)}k._lastPlayheadPosition=-1})}),D.forEach(function(z){A.on(z,function(){k._lastPlayheadPosition=A.data.player_playhead_time,k._lastPlayerWidth=A.data.player_width,k._lastPlayerHeight=A.data.player_height,k._lastSourceWidth=A.data.video_source_width,k._lastSourceHeight=A.data.video_source_height})})},gi=Cr,ei=2e3,Xi=function I(A){"use strict";var k=this;me(this,I),Oe(this,"isSeeking",void 0),this.isSeeking=!1;var x=-1,D=function(){var z=jt.now(),$=(A.data.viewer_time||z)-(x||z);yt(A.data,"view_seek_duration",$),A.data.view_max_seek_time=Math.max(A.data.view_max_seek_time||0,$),k.isSeeking=!1,x=-1};A.on("seeking",function(z,$){if(Object.assign(A.data,$),k.isSeeking&&$.viewer_time-x<=ei){x=$.viewer_time;return}k.isSeeking&&D(),k.isSeeking=!0,x=$.viewer_time,yt(A.data,"view_seek_count",1),A.send("seeking")}),A.on("seeked",function(){D()}),A.on("viewend",function(){k.isSeeking&&(D(),A.send("seeked")),k.isSeeking=!1,x=-1})},Ei=Xi,Gr=function(I,A){I.push(A),I.sort(function(k,x){return k.viewer_time-x.viewer_time})},na=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror","adclicked","adskipped"],Zi=function(){"use strict";function I(A){var k=this;me(this,I),Oe(this,"_adHasPlayed",void 0),Oe(this,"_adRequests",void 0),Oe(this,"_adResponses",void 0),Oe(this,"_currentAdRequestNumber",void 0),Oe(this,"_currentAdResponseNumber",void 0),Oe(this,"_prerollPlayTime",void 0),Oe(this,"_wouldBeNewAdPlay",void 0),Oe(this,"isAdBreak",void 0),Oe(this,"pm",void 0),this.pm=A,A.on("viewinit",function(){k.isAdBreak=!1,k._currentAdRequestNumber=0,k._currentAdResponseNumber=0,k._adRequests=[],k._adResponses=[],k._adHasPlayed=!1,k._wouldBeNewAdPlay=!0,k._prerollPlayTime=void 0}),na.forEach(function(D){return A.on(D,k._updateAdData.bind(k))});var x=function(){k.isAdBreak=!1};A.on("adbreakstart",function(){k.isAdBreak=!0}),A.on("play",x),A.on("playing",x),A.on("viewend",x),A.on("adrequest",function(D,z){z=Object.assign({ad_request_id:"generatedAdRequestId"+k._currentAdRequestNumber++},z),Gr(k._adRequests,z),yt(A.data,"view_ad_request_count"),k.inPrerollPosition()&&(A.data.view_preroll_requested=!0,k._adHasPlayed||yt(A.data,"view_preroll_request_count"))}),A.on("adresponse",function(D,z){z=Object.assign({ad_request_id:"generatedAdRequestId"+k._currentAdResponseNumber++},z),Gr(k._adResponses,z);var $=k.findAdRequest(z.ad_request_id);$&&yt(A.data,"view_ad_request_time",Math.max(0,z.viewer_time-$.viewer_time))}),A.on("adplay",function(D,z){k._adHasPlayed=!0,k._wouldBeNewAdPlay&&(k._wouldBeNewAdPlay=!1,yt(A.data,"view_ad_played_count")),k.inPrerollPosition()&&!A.data.view_preroll_played&&(A.data.view_preroll_played=!0,k._adRequests.length>0&&(A.data.view_preroll_request_time=Math.max(0,z.viewer_time-k._adRequests[0].viewer_time)),A.data.view_start&&(A.data.view_startup_preroll_request_time=Math.max(0,z.viewer_time-A.data.view_start)),k._prerollPlayTime=z.viewer_time)}),A.on("adplaying",function(D,z){k.inPrerollPosition()&&typeof A.data.view_preroll_load_time=="undefined"&&typeof k._prerollPlayTime!="undefined"&&(A.data.view_preroll_load_time=z.viewer_time-k._prerollPlayTime,A.data.view_startup_preroll_load_time=z.viewer_time-k._prerollPlayTime)}),A.on("adclicked",function(D,z){k._wouldBeNewAdPlay||yt(A.data,"view_ad_clicked_count")}),A.on("adskipped",function(D,z){k._wouldBeNewAdPlay||yt(A.data,"view_ad_skipped_count")}),A.on("adended",function(){k._wouldBeNewAdPlay=!0}),A.on("aderror",function(){k._wouldBeNewAdPlay=!0})}return kt(I,[{key:"inPrerollPosition",value:function(){return typeof this.pm.data.view_content_playback_time=="undefined"||this.pm.data.view_content_playback_time<=1e3}},{key:"findAdRequest",value:function(A){for(var k=0;k<this._adRequests.length;k++)if(this._adRequests[k].ad_request_id===A)return this._adRequests[k]}},{key:"_updateAdData",value:function(A,k){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&k.ad_tag_url){var x=Te(br(k.ad_tag_url),2),D=x[0],z=x[1];this.pm.data.view_preroll_ad_tag_domain=z,this.pm.data.view_preroll_ad_tag_hostname=D}if(!this.pm.data.view_preroll_ad_asset_hostname&&k.ad_asset_url){var $=Te(br(k.ad_asset_url),2),Fe=$[0],Ve=$[1];this.pm.data.view_preroll_ad_asset_domain=Ve,this.pm.data.view_preroll_ad_asset_hostname=Fe}this.pm.data.ad_type="preroll"}this.pm.data.ad_asset_url=k==null?void 0:k.ad_asset_url,this.pm.data.ad_tag_url=k==null?void 0:k.ad_tag_url,this.pm.data.ad_creative_id=k==null?void 0:k.ad_creative_id,this.pm.data.ad_id=k==null?void 0:k.ad_id,this.pm.data.ad_universal_id=k==null?void 0:k.ad_universal_id,k!=null&&k.ad_type&&(this.pm.data.ad_type=k==null?void 0:k.ad_type)}}]),I}(),bs=Zi,hn=function I(A){"use strict";var k=this;me(this,I),Oe(this,"lastWallClockTime",void 0);var x=function(){k.lastWallClockTime=jt.now(),A.on("before*",D)},D=function(z){var $=jt.now(),Fe=k.lastWallClockTime;k.lastWallClockTime=$,$-Fe>3e4&&(A.emit("devicesleep",{viewer_time:Fe}),Object.assign(A.data,{viewer_time:Fe}),A.send("devicesleep"),A.emit("devicewake",{viewer_time:$}),Object.assign(A.data,{viewer_time:$}),A.send("devicewake"))};A.one("playbackheartbeat",x),A.on("playbackheartbeatend",function(){A.off("before*",D),A.one("playbackheartbeat",x)})},Ts=hn,xa=j(at()),Na=function(I){return I()}(function(){var I=function(){for(var k=0,x={};k<arguments.length;k++){var D=arguments[k];for(var z in D)x[z]=D[z]}return x};function A(k){function x(D,z,$){var Fe;if(typeof document!="undefined"){if(arguments.length>1){if($=I({path:"/"},x.defaults,$),typeof $.expires=="number"){var Ve=new Date;Ve.setMilliseconds(Ve.getMilliseconds()+$.expires*864e5),$.expires=Ve}try{Fe=JSON.stringify(z),/^[\{\[]/.test(Fe)&&(z=Fe)}catch(tr){}return k.write?z=k.write(z,D):z=encodeURIComponent(String(z)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),D=encodeURIComponent(String(D)),D=D.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),D=D.replace(/[\(\)]/g,escape),document.cookie=[D,"=",z,$.expires?"; expires="+$.expires.toUTCString():"",$.path?"; path="+$.path:"",$.domain?"; domain="+$.domain:"",$.secure?"; secure":""].join("")}D||(Fe={});for(var tt=document.cookie?document.cookie.split("; "):[],Mt=/(%[0-9A-Z]{2})+/g,Gt=0;Gt<tt.length;Gt++){var et=tt[Gt].split("="),Ue=et.slice(1).join("=");Ue.charAt(0)==='"'&&(Ue=Ue.slice(1,-1));try{var bt=et[0].replace(Mt,decodeURIComponent);if(Ue=k.read?k.read(Ue,bt):k(Ue,bt)||Ue.replace(Mt,decodeURIComponent),this.json)try{Ue=JSON.parse(Ue)}catch(tr){}if(D===bt){Fe=Ue;break}D||(Fe[bt]=Ue)}catch(tr){}}return Fe}}return x.set=x,x.get=function(D){return x.call(x,D)},x.getJSON=function(){return x.apply({json:!0},[].slice.call(arguments))},x.defaults={},x.remove=function(D,z){x(D,"",I(z,{expires:-1}))},x.withConverter=A,x}return A(function(){})}),Ln="muxData",Xa=function(I){return Object.entries(I).map(function(A){var k=Te(A,2),x=k[0],D=k[1];return"".concat(x,"=").concat(D)}).join("&")},kn=function(I){return I.split("&").reduce(function(A,k){var x=Te(k.split("="),2),D=x[0],z=x[1],$=+z,Fe=z&&$==z?$:z;return A[D]=Fe,A},{})},Sa=function(){var I;try{I=kn(Na.get(Ln)||"")}catch(A){I={}}return I},Ua=function(I){try{Na.set(Ln,Xa(I),{expires:365})}catch(A){}},Ks=function(){var I=Sa();return I.mux_viewer_id=I.mux_viewer_id||Br(),I.msn=I.msn||Math.random(),Ua(I),{mux_viewer_id:I.mux_viewer_id,mux_sample_number:I.msn}},ur=function(){var I=Sa(),A=jt.now();return I.session_start&&(I.sst=I.session_start,delete I.session_start),I.session_id&&(I.sid=I.session_id,delete I.session_id),I.session_expires&&(I.sex=I.session_expires,delete I.session_expires),(!I.sex||I.sex<A)&&(I.sid=Br(),I.sst=A),I.sex=A+25*60*1e3,Ua(I),{session_id:I.sid,session_start:I.sst,session_expires:I.sex}};function hi(I,A){var k=A.beaconCollectionDomain,x=A.beaconDomain;if(k)return"https://"+k;I=I||"inferred";var D=x||"litix.io";return I.match(/^[a-z0-9]+$/)?"https://"+I+"."+D:"https://img.litix.io/a.gif"}var Di=j(at()),ti=function(){var I;switch(sa()){case"cellular":I="cellular";break;case"ethernet":I="wired";break;case"wifi":I="wifi";break;case void 0:break;default:I="other"}return I},sa=function(){var I=Di.default.navigator,A=I&&(I.connection||I.mozConnection||I.webkitConnection);return A&&A.type};ti.getConnectionFromAPI=sa;var fn=ti,xi={a:"env",b:"beacon",c:"custom",d:"ad",e:"event",f:"experiment",i:"internal",m:"mux",n:"response",p:"player",q:"request",r:"retry",s:"session",t:"timestamp",u:"viewer",v:"video",w:"page",x:"view",y:"sub"},fa=Fa(xi),vr={ad:"ad",af:"affiliate",ag:"aggregate",ap:"api",al:"application",ao:"audio",ar:"architecture",as:"asset",au:"autoplay",av:"average",bi:"bitrate",bn:"brand",br:"break",bw:"browser",by:"bytes",bz:"business",ca:"cached",cb:"cancel",cc:"codec",cd:"code",cg:"category",ch:"changed",ci:"client",ck:"clicked",cl:"canceled",cm:"cmcd",cn:"config",co:"count",ce:"counter",cp:"complete",cq:"creator",cr:"creative",cs:"captions",ct:"content",cu:"current",cv:"cumulative",cx:"connection",cz:"context",da:"data",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",dr:"drm",dp:"dropped",du:"duration",dv:"device",dy:"dynamic",eb:"enabled",ec:"encoding",ed:"edge",en:"end",eg:"engine",em:"embed",er:"error",ep:"experiments",es:"errorcode",et:"errortext",ee:"event",ev:"events",ex:"expires",ez:"exception",fa:"failed",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",ha:"has",hb:"holdback",he:"headers",ho:"host",hn:"hostname",ht:"height",id:"id",ii:"init",in:"instance",ip:"ip",is:"is",ke:"key",la:"language",lb:"labeled",le:"level",li:"live",ld:"loaded",lo:"load",ls:"lists",lt:"latency",ma:"max",md:"media",me:"message",mf:"manifest",mi:"mime",ml:"midroll",mm:"min",mn:"manufacturer",mo:"model",mp:"mode",ms:"ms",mx:"mux",ne:"newest",nm:"name",no:"number",on:"on",or:"origin",os:"os",pa:"paused",pb:"playback",pd:"producer",pe:"percentage",pf:"played",pg:"program",ph:"playhead",pi:"plugin",pl:"preroll",pn:"playing",po:"poster",pp:"pip",pr:"preload",ps:"position",pt:"part",pv:"previous",py:"property",px:"pop",pz:"plan",ra:"rate",rd:"requested",re:"rebuffer",rf:"rendition",rg:"range",rm:"remote",ro:"ratio",rp:"response",rq:"request",rs:"requests",sa:"sample",sd:"skipped",se:"session",sh:"shift",sk:"seek",sm:"stream",so:"source",sq:"sequence",sr:"series",ss:"status",st:"start",su:"startup",sv:"server",sw:"software",sy:"severity",ta:"tag",tc:"tech",te:"text",tg:"target",th:"throughput",ti:"time",tl:"total",to:"to",tt:"title",ty:"type",ug:"upscaling",un:"universal",up:"upscale",ur:"url",us:"user",va:"variant",vd:"viewed",vi:"video",ve:"version",vw:"view",vr:"viewer",wd:"width",wa:"watch",wt:"waiting"},In=Fa(vr);function Fa(I){var A={};for(var k in I)I.hasOwnProperty(k)&&(A[I[k]]=k);return A}function ls(I){var A={},k={};return Object.keys(I).forEach(function(x){var D=!1;if(I.hasOwnProperty(x)&&I[x]!==void 0){var z=x.split("_"),$=z[0],Fe=fa[$];Fe||(Wt.info("Data key word `"+z[0]+"` not expected in "+x),Fe=$+"_"),z.splice(1).forEach(function(Ve){Ve==="url"&&(D=!0),In[Ve]?Fe+=In[Ve]:Number.isInteger(Number(Ve))?Fe+=Ve:(Wt.info("Data key word `"+Ve+"` not expected in "+x),Fe+="_"+Ve+"_")}),D?k[Fe]=I[x]:A[Fe]=I[x]}}),Object.assign(A,k)}var vn=j(at()),Rn=j(ut()),Ws={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},us=56*1024,xn=["hb","requestcompleted","requestfailed","requestcanceled"],Za="https://img.litix.io",fi=function(I){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=I||Za,this._eventQueue=[],this._postInFlight=!1,this._resendAfterPost=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},Ws,A)};fi.prototype.queueEvent=function(I,A){var k=Object.assign({},A);return this._eventQueue.length<=this._options.maxQueueLength||I==="eventrateexceeded"?(this._eventQueue.push(k),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength):!1},fi.prototype.flushEvents=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(I&&this._eventQueue.length===1){this._eventQueue.pop();return}this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending()},fi.prototype.destroy=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.destroyed=!0,I?this._clearBeaconQueue():this.flushEvents(),vn.default.clearTimeout(this._sendTimeout)},fi.prototype._clearBeaconQueue=function(){var I=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,A=this._eventQueue.slice(I);I>0&&Object.assign(A[A.length-1],ls({mux_view_message:"event queue truncated"}));var k=this._createPayload(A);wn(this._beaconUrl,k,!0,function(){})},fi.prototype._sendBeaconQueue=function(){var I=this;if(this._postInFlight){this._resendAfterPost=!0;return}var A=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var k=this._createPayload(A),x=jt.now();wn(this._beaconUrl,k,!1,function(D,z){z?(I._eventQueue=A.concat(I._eventQueue),I._failureCount+=1,Wt.info("Error sending beacon: "+z)):I._failureCount=0,I._roundTripTime=jt.now()-x,I._postInFlight=!1,I._resendAfterPost&&(I._resendAfterPost=!1,I._eventQueue.length>0&&I._sendBeaconQueue())})},fi.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var I=Math.pow(2,this._failureCount-1);return I=I*Math.random(),(1+I)*this._options.baseTimeBetweenBeacons},fi.prototype._startBeaconSending=function(){var I=this;vn.default.clearTimeout(this._sendTimeout),!this.destroyed&&(this._sendTimeout=vn.default.setTimeout(function(){I._eventQueue.length&&I._sendBeaconQueue(),I._startBeaconSending()},this._getNextBeaconTime()))},fi.prototype._createPayload=function(I){var A=this,k={transmission_timestamp:Math.round(jt.now())};this._roundTripTime&&(k.rtt_ms=Math.round(this._roundTripTime));var x,D,z,$=function(){x=JSON.stringify({metadata:k,events:D||I}),z=x.length/1024},Fe=function(){return z<=A._options.maxPayloadKBSize};return $(),Fe()||(Wt.info("Payload size is too big ("+z+" kb). Removing unnecessary events."),D=I.filter(function(Ve){return xn.indexOf(Ve.e)===-1}),$()),Fe()||(Wt.info("Payload size still too big ("+z+" kb). Cropping fields.."),D.forEach(function(Ve){for(var tt in Ve){var Mt=Ve[tt],Gt=50*1024;typeof Mt=="string"&&Mt.length>Gt&&(Ve[tt]=Mt.substring(0,Gt))}}),$()),x};var Ja=typeof Rn.default.exitPictureInPicture=="function"?function(I){return I.length<=us}:function(I){return!1},wn=function(I,A,k,x){if(k&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(I,A)){x();return}if(vn.default.fetch){vn.default.fetch(I,{method:"POST",body:A,headers:{"Content-Type":"text/plain"},keepalive:Ja(A)}).then(function(z){return x(null,z.ok?null:"Error")}).catch(function(z){return x(null,z)});return}if(vn.default.XMLHttpRequest){var D=new vn.default.XMLHttpRequest;D.onreadystatechange=function(){if(D.readyState===4)return x(null,D.status!==200?"error":void 0)},D.open("POST",I),D.setRequestHeader("Content-Type","text/plain"),D.send(A);return}x()},mn=fi,Ba=["env_key","view_id","view_sequence_number","player_sequence_number","beacon_domain","player_playhead_time","viewer_time","mux_api_version","event","video_id","player_instance_id","player_error_code","player_error_message","player_error_context","player_error_severity","player_error_business_exception","view_playing_time_ms_cumulative","ad_playing_time_ms_cumulative"],Wn=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse","adrequest"],pa=["ad_id","ad_creative_id","ad_universal_id"],oa=["viewstart","error","ended","viewend"],ki=10*60*1e3,pn=function(){"use strict";function I(A,k){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};me(this,I);var D,z,$,Fe,Ve,tt,Mt,Gt,et,Ue,bt,tr;Oe(this,"mux",void 0),Oe(this,"envKey",void 0),Oe(this,"options",void 0),Oe(this,"eventQueue",void 0),Oe(this,"sampleRate",void 0),Oe(this,"disableCookies",void 0),Oe(this,"respectDoNotTrack",void 0),Oe(this,"previousBeaconData",void 0),Oe(this,"lastEventTime",void 0),Oe(this,"rateLimited",void 0),Oe(this,"pageLevelData",void 0),Oe(this,"viewerData",void 0),this.mux=A,this.envKey=k,this.options=x,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.eventQueue=new mn(hi(this.envKey,this.options));var Kt;this.sampleRate=(Kt=this.options.sampleRate)!==null&&Kt!==void 0?Kt:1;var Or;this.disableCookies=(Or=this.options.disableCookies)!==null&&Or!==void 0?Or:!1;var $t;this.respectDoNotTrack=($t=this.options.respectDoNotTrack)!==null&&$t!==void 0?$t:!1,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:(D=this.options.platform)===null||D===void 0?void 0:D.name,viewer_application_version:(z=this.options.platform)===null||z===void 0?void 0:z.version,viewer_application_engine:($=this.options.platform)===null||$===void 0?void 0:$.layout,viewer_device_name:(Fe=this.options.platform)===null||Fe===void 0?void 0:Fe.product,viewer_device_category:"",viewer_device_manufacturer:(Ve=this.options.platform)===null||Ve===void 0?void 0:Ve.manufacturer,viewer_os_family:(Mt=this.options.platform)===null||Mt===void 0||(tt=Mt.os)===null||tt===void 0?void 0:tt.family,viewer_os_architecture:(et=this.options.platform)===null||et===void 0||(Gt=et.os)===null||Gt===void 0?void 0:Gt.architecture,viewer_os_version:(bt=this.options.platform)===null||bt===void 0||(Ue=bt.os)===null||Ue===void 0?void 0:Ue.version,viewer_connection_type:fn(),page_url:xa.default===null||xa.default===void 0||(tr=xa.default.location)===null||tr===void 0?void 0:tr.href},this.viewerData=this.disableCookies?{}:Ks()}return kt(I,[{key:"send",value:function(A,k){if(!(!A||!(k!=null&&k.view_id))){if(this.respectDoNotTrack&&Y())return Wt.info("Not sending `"+A+"` because Do Not Track is enabled");if(!k||typeof k!="object")return Wt.error("A data object was expected in send() but was not provided");var x=this.disableCookies?{}:ur(),D=Rr(qt({},this.pageLevelData,k,x,this.viewerData),{event:A,env_key:this.envKey});D.user_id&&(D.viewer_user_id=D.user_id,delete D.user_id);var z,$=((z=D.mux_sample_number)!==null&&z!==void 0?z:0)>=this.sampleRate,Fe=this._deduplicateBeaconData(A,D),Ve=ls(Fe);if(this.lastEventTime=this.mux.utils.now(),$)return Wt.info("Not sending event due to sample rate restriction",A,D,Ve);if(this.envKey||Wt.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",A,D,Ve),!this.rateLimited)if(Wt.info("Sending event",A,D,Ve),this.rateLimited=!this.eventQueue.queueEvent(A,Ve),this.mux.WINDOW_UNLOADING&&A==="viewend")this.eventQueue.destroy(!0);else{if(this.mux.WINDOW_HIDDEN&&A==="hb")this.eventQueue.flushEvents(!0);else if(oa.indexOf(A)>=0){if(A==="error"&&k.player_error_severity==="warning")return;this.eventQueue.flushEvents()}if(this.rateLimited)return D.event="eventrateexceeded",Ve=ls(D),this.eventQueue.queueEvent(D.event,Ve),Wt.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(A,k){var x=this,D={},z=k.view_id;if(z==="-1"||A==="viewstart"||A==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=ki)D=qt({},k),z&&(this.previousBeaconData=D),z&&A==="viewend"&&(this.previousBeaconData=null);else{var $=A.indexOf("request")===0;Object.entries(k).forEach(function(Fe){var Ve=Te(Fe,2),tt=Ve[0],Mt=Ve[1];x.previousBeaconData&&(Mt!==x.previousBeaconData[tt]||Ba.indexOf(tt)>-1||x.objectHasChanged($,tt,Mt,x.previousBeaconData[tt])||x.eventRequiresKey(A,tt))&&(D[tt]=Mt,x.previousBeaconData[tt]=Mt)})}return D}},{key:"objectHasChanged",value:function(A,k,x,D){return!A||k.indexOf("request_")!==0?!1:k==="request_response_headers"||typeof x!="object"||typeof D!="object"?!0:Object.keys(x||{}).length!==Object.keys(D||{}).length}},{key:"eventRequiresKey",value:function(A,k){return!!(A==="renditionchange"&&k.indexOf("video_source_")===0||pa.includes(k)&&Wn.includes(A))}}]),I}(),Yn=function I(A){"use strict";me(this,I);var k=0,x=0,D=0,z=0,$=0,Fe=0,Ve=0,tt=function(et,Ue){var bt=Ue.request_start,tr=Ue.request_response_start,Kt=Ue.request_response_end,Or=Ue.request_bytes_loaded;z++;var $t,Ot;if(tr?($t=tr-(bt!=null?bt:0),Ot=(Kt!=null?Kt:0)-tr):Ot=(Kt!=null?Kt:0)-(bt!=null?bt:0),Ot>0&&Or&&Or>0){var St=Or/Ot*8e3;$++,x+=Or,D+=Ot,A.data.view_min_request_throughput=Math.min(A.data.view_min_request_throughput||1/0,St),A.data.view_average_request_throughput=x/D*8e3,A.data.view_request_count=z,$t>0&&(k+=$t,A.data.view_max_request_latency=Math.max(A.data.view_max_request_latency||0,$t),A.data.view_average_request_latency=k/$)}},Mt=function(et,Ue){z++,Fe++,A.data.view_request_count=z,A.data.view_request_failed_count=Fe},Gt=function(et,Ue){z++,Ve++,A.data.view_request_count=z,A.data.view_request_canceled_count=Ve};A.on("requestcompleted",tt),A.on("requestfailed",Mt),A.on("requestcanceled",Gt)},M=Yn,P=60*60*1e3,q=function I(A){"use strict";var k=this;me(this,I),Oe(this,"_lastEventTime",void 0),A.on("before*",function(x,D){var z=D.viewer_time,$=jt.now(),Fe=k._lastEventTime;if(k._lastEventTime=$,Fe&&$-Fe>P){var Ve=Object.keys(A.data).reduce(function(Mt,Gt){return Gt.indexOf("video_")===0?Object.assign(Mt,Oe({},Gt,A.data[Gt])):Mt},{});A.mux.log.info("Received event after at least an hour inactivity, creating a new view");var tt=A.playbackHeartbeat._playheadShouldBeProgressing;A._resetView(Object.assign({viewer_time:z},Ve)),A.playbackHeartbeat._playheadShouldBeProgressing=tt,A.playbackHeartbeat._playheadShouldBeProgressing&&x.type!=="play"&&x.type!=="adbreakstart"&&(A.emit("play",{viewer_time:z}),x.type!=="playing"&&A.emit("playing",{viewer_time:z}))}})},ue=q,le=function I(A){"use strict";me(this,I);var k=function(Fe){var Ve=xe(Fe),tt=lt(Fe);if(Ve!=null&&!We(Ve,z)&&$<=tt){z=Ve,$=tt;var Mt={video_cdn:Ve};A.emit("cdnchange",Mt)}},x=null,D=null,z=null,$=0;A.on("viewinit",function(){x=null,D=null,z=null,$=0}),A.on("beforecdnchange",function(Fe,Ve){var tt=Ve==null?void 0:Ve.video_cdn;tt&&(typeof Ve.video_previous_cdn=="undefined"||Ve.video_previous_cdn===null)&&(We(tt,D)?Ve.video_previous_cdn=x!=null?x:void 0:(Ve.video_previous_cdn=D!=null?D:void 0,x=D,D=tt))}),A.on("requestcompleted",function(Fe,Ve){k(Ve)})};function We(I,A){return(I==null?void 0:I.toLowerCase())===(A==null?void 0:A.toLowerCase())}function xe(I){var A;return I!=null&&I.request_type&&(I.request_type==="media"||I.request_type==="video")&&!((A=I.request_response_headers)===null||A===void 0)&&A["x-cdn"]?I.request_response_headers["x-cdn"]:I!=null&&I.video_cdn?I.video_cdn:null}function lt(I){return I!=null&&I.request_start?I.request_start:I!=null&&I.viewer_time?I.viewer_time:Date.now()}var Ce=le,wt=function(I){try{return JSON.parse(I),!0}catch(A){return!1}},gt=function I(A){"use strict";var k=this;me(this,I),Oe(this,"_emittingAutomaticEvent",!1),Oe(this,"_hasInitialized",!1),A.on("viewstart",function(){k._hasInitialized||(k._hasInitialized=!0,k._emittingAutomaticEvent=!0,A.emit("playbackmodechange",{player_playback_mode:"standard",player_playback_mode_data:"{}"}),k._emittingAutomaticEvent=!1)}),A.on("viewend",function(){k._hasInitialized=!1}),A.on("playbackmodechange",function(x,D){k._emittingAutomaticEvent||(D.player_playback_mode_data?wt(D.player_playback_mode_data)||(A.mux.log.warn("Invalid JSON string for player_playback_mode_data"),D.player_playback_mode_data="{}"):D.player_playback_mode_data="{}",A.data.player_playback_mode_data=D.player_playback_mode_data,A.data.player_playback_mode=D.player_playback_mode)})},Yt=gt,mr=["viewstart","ended","loadstart","pause","play","playing","ratechange","waiting","adplay","adpause","adended","aderror","adplaying","adrequest","adresponse","adbreakstart","adbreakend","adfirstquartile","admidpoint","adthirdquartile","rebufferstart","rebufferend","seeked","error","hb","requestcompleted","requestfailed","requestcanceled","renditionchange","cdnchange","playbackmodechange"],pr=new Set(["requestcompleted","requestfailed","requestcanceled"]),Tr=function(I){"use strict";ft(k,I);var A=Yi(k);function k(x,D,z){me(this,k);var $;$=A.call(this),Oe(te($),"pageLoadEndTime",void 0),Oe(te($),"pageLoadInitTime",void 0),Oe(te($),"_destroyed",void 0),Oe(te($),"_heartBeatTimeout",void 0),Oe(te($),"adTracker",void 0),Oe(te($),"dashjs",void 0),Oe(te($),"data",void 0),Oe(te($),"disablePlayheadRebufferTracking",void 0),Oe(te($),"disableRebufferTracking",void 0),Oe(te($),"errorTracker",void 0),Oe(te($),"errorTranslator",void 0),Oe(te($),"emitTranslator",void 0),Oe(te($),"getAdData",void 0),Oe(te($),"getPlayheadTime",void 0),Oe(te($),"getStateData",void 0),Oe(te($),"stateDataTranslator",void 0),Oe(te($),"hlsjs",void 0),Oe(te($),"id",void 0),Oe(te($),"longResumeTracker",void 0),Oe(te($),"minimumRebufferDuration",void 0),Oe(te($),"mux",void 0),Oe(te($),"playbackEventDispatcher",void 0),Oe(te($),"playbackHeartbeat",void 0),Oe(te($),"playbackHeartbeatTime",void 0),Oe(te($),"playheadTime",void 0),Oe(te($),"seekingTracker",void 0),Oe(te($),"sustainedRebufferThreshold",void 0),Oe(te($),"watchTimeTracker",void 0),Oe(te($),"currentFragmentPDT",void 0),Oe(te($),"currentFragmentStart",void 0),$.pageLoadInitTime=oe.navigationStart(),$.pageLoadEndTime=oe.domContentLoadedEventEnd();var Fe={debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(et){return et},emitTranslator:function(){for(var et=arguments.length,Ue=new Array(et),bt=0;bt<et;bt++)Ue[bt]=arguments[bt];return Ue},stateDataTranslator:function(et){return et}};$.mux=x,$.id=D,z!=null&&z.beaconDomain&&$.mux.log.warn("The `beaconDomain` setting has been deprecated in favor of `beaconCollectionDomain`. Please change your integration to use `beaconCollectionDomain` instead of `beaconDomain`."),z=Object.assign(Fe,z),z.data=z.data||{},z.data.property_key&&(z.data.env_key=z.data.property_key,delete z.data.property_key),Wt.level=z.debug?Lr.DEBUG:Lr.WARN,$.getPlayheadTime=z.getPlayheadTime,$.getStateData=z.getStateData||function(){return{}},$.getAdData=z.getAdData||function(){},$.minimumRebufferDuration=z.minimumRebufferDuration,$.sustainedRebufferThreshold=z.sustainedRebufferThreshold,$.playbackHeartbeatTime=z.playbackHeartbeatTime,$.disableRebufferTracking=z.disableRebufferTracking,$.disableRebufferTracking&&$.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."),$.disablePlayheadRebufferTracking=z.disablePlayheadRebufferTracking,$.errorTranslator=z.errorTranslator,$.emitTranslator=z.emitTranslator,$.stateDataTranslator=z.stateDataTranslator,$.playbackEventDispatcher=new pn(x,z.data.env_key,z),$.data={player_instance_id:Br(),mux_sample_rate:z.sampleRate,beacon_domain:z.beaconCollectionDomain||z.beaconDomain},$.data.view_sequence_number=1,$.data.player_sequence_number=1;var Ve=function(){typeof this.data.view_start=="undefined"&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"),this.emit("renditionchange"))}.bind(te($));if($.on("viewinit",function(et,Ue){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,Ue),this._initializeViewData(),this.one("play",Ve),this.one("adbreakstart",Ve)}),$.on("videochange",function(et,Ue){this._resetView(Ue)}),$.on("programchange",function(et,Ue){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),this._resetView(Object.assign(Ue,{view_program_changed:!0})),Ve(),this.emit("play"),this.emit("playing")}),$.on("fragmentchange",function(et,Ue){this.currentFragmentPDT=Ue.currentFragmentPDT,this.currentFragmentStart=Ue.currentFragmentStart}),$.on("destroy",$.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var tt=function(){var et=typeof $.data.view_start!="undefined";$.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",et&&$.mux.WINDOW_HIDDEN&&($.data.player_is_paused||$.emit("hb"))};window.addEventListener("visibilitychange",tt,!1);var Mt=function(et){et.persisted||$.destroy()};window.addEventListener("pagehide",Mt,!1),$.on("destroy",function(){window.removeEventListener("visibilitychange",tt),window.removeEventListener("pagehide",Mt)})}$.on("playerready",function(et,Ue){Object.assign(this.data,Ue)}),mr.forEach(function(et){$.on(et,function(Ue,bt){et.indexOf("ad")!==0&&this._updateStateData(),Object.assign(this.data,bt),this._sanitizeData()}),$.on("after"+et,function(){(et!=="error"||this.errorTracker.viewErrored)&&this.send(et)})}),$.on("viewend",function(et,Ue){Object.assign($.data,Ue)});var Gt=function(et){var Ue=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=Ue-this.data.player_init_time),this.pageLoadInitTime=this.data.page_load_init_time||this.pageLoadInitTime,this.pageLoadEndTime=this.data.page_load_end_time||this.pageLoadEndTime,!this.mux.PLAYER_TRACKED&&this.pageLoadInitTime&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.pageLoadEndTime)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.pageLoadEndTime||1/0)-this.pageLoadInitTime)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time};return $.one("playerready",Gt),$.longResumeTracker=new ue(te($)),$.errorTracker=new Gs(te($)),new Ts(te($)),$.seekingTracker=new Ei(te($)),$.playheadTime=new di(te($)),$.playbackHeartbeat=new Qa(te($)),new gi(te($)),$.watchTimeTracker=new ui(te($)),new Nr(te($)),$.adTracker=new bs(te($)),new W(te($)),new ha(te($)),new Vt(te($)),new M(te($)),new Ce(te($)),new Yt(te($)),z.hlsjs&&$.addHLSJS(z),z.dashjs&&$.addDashJS(z),$.emit("viewinit",z.data),$}return kt(k,[{key:"emit",value:function(x,D){var z,$=Object.assign({viewer_time:this.mux.utils.now()},D),Fe=[x,$];if(this.emitTranslator)try{Fe=this.emitTranslator(x,$)}catch(Ve){this.mux.log.warn("Exception in emit translator callback.",Ve)}Fe!=null&&Fe.length&&(z=Zt(zt(k.prototype),"emit",this)).call.apply(z,[this].concat(Ut(Fe)))}},{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,typeof this.data.view_start!="undefined"&&(this.emit("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(x){if(this.data.view_id){var D=Object.assign({},this.data),z=["player_program_time","player_manifest_newest_program_time","player_live_edge_program_time","player_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"];if(D.video_source_is_live===void 0&&(D.player_source_duration===1/0||D.video_source_duration===1/0?D.video_source_is_live=!0:(D.player_source_duration>0||D.video_source_duration>0)&&(D.video_source_is_live=!1)),D.video_source_is_live||z.forEach(function(tt){D[tt]=void 0}),D.video_source_url=D.video_source_url||D.player_source_url,D.video_source_url){var $=Te(br(D.video_source_url),2),Fe=$[0],Ve=$[1];D.video_source_domain=Ve,D.video_source_hostname=Fe}delete D.ad_request_id,this.playbackEventDispatcher.send(x,D),this.data.view_sequence_number++,this.data.player_sequence_number++,pr.has(x)||this._restartHeartBeat(),x==="viewend"&&delete this.data.view_id}}},{key:"_resetView",value:function(x){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",x)}},{key:"_updateStateData",value:function(){var x,D=this.getStateData();if(typeof this.stateDataTranslator=="function")try{D=this.stateDataTranslator(D)}catch(Fe){this.mux.log.warn("Exception in stateDataTranslator translator callback.",Fe)}if(!((x=this.data)===null||x===void 0)&&x.video_cdn&&D!=null&&D.video_cdn){var z=D.video_cdn,$=li(D,["video_cdn"]);D=$}Object.assign(this.data,D),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var x=this,D=["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"];D.forEach(function($){var Fe=parseInt(x.data[$],10);x.data[$]=isNaN(Fe)?void 0:Fe});var z=["player_source_url","video_source_url"];z.forEach(function($){if(x.data[$]){var Fe=x.data[$].toLowerCase();(Fe.indexOf("data:")===0||Fe.indexOf("blob:")===0)&&(x.data[$]="MSE style URL")}})}},{key:"_resetVideoData",value:function(){var x=this;Object.keys(this.data).forEach(function(D){D.indexOf("video_")===0&&delete x.data[D]})}},{key:"_resetViewData",value:function(){var x=this;Object.keys(this.data).forEach(function(D){D.indexOf("view_")===0&&delete x.data[D]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(){delete this.data.player_error_code,delete this.data.player_error_message,delete this.data.player_error_context,delete this.data.player_error_severity,delete this.data.player_error_business_exception}},{key:"_initializeViewData",value:function(){var x=this,D=this.data.view_id=Br(),z=function(){D===x.data.view_id&&yt(x.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",z):z()}},{key:"_restartHeartBeat",value:function(){var x=this;window.clearTimeout(this._heartBeatTimeout),this._heartBeatTimeout=window.setTimeout(function(){x.data.player_is_paused||x.emit("hb")},1e4)}},{key:"addHLSJS",value:function(x){if(!x.hlsjs){this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.");return}if(this.hlsjs){this.mux.log.warn("An instance of HLS.js is already being monitored for this player.");return}this.hlsjs=x.hlsjs,pi(this.mux,this.id,x.hlsjs,{},x.Hls||window.Hls)}},{key:"removeHLSJS",value:function(){this.hlsjs&&($r(this.hlsjs),this.hlsjs=void 0)}},{key:"addDashJS",value:function(x){if(!x.dashjs){this.mux.log.warn("You must pass a valid dashjs instance in order to track it.");return}if(this.dashjs){this.mux.log.warn("An instance of Dash.js is already being monitored for this player.");return}this.dashjs=x.dashjs,un(this.mux,this.id,x.dashjs)}},{key:"removeDashJS",value:function(){this.dashjs&&(zi(this.dashjs),this.dashjs=void 0)}}]),k}(Oa),Ur=Tr,wr=j(ut());function Fr(){return wr.default&&!!(wr.default.fullscreenElement||wr.default.webkitFullscreenElement||wr.default.mozFullScreenElement||wr.default.msFullscreenElement)}var Xr=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],dr={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};function Ki(I,A,k){var x=Te(Be(A),3),D=x[0],z=x[1],$=x[2],Fe=I.log,Ve=I.utils.getComputedStyle,tt=I.utils.secondsToMs,Mt={automaticErrorTracking:!0};if(D){if($!=="video"&&$!=="audio")return Fe.error("The element of `"+z+"` was not a media element.")}else return Fe.error("No element was found with the `"+z+"` query selector.");D.mux&&(D.mux.destroy(),delete D.mux,Fe.warn("Already monitoring this video element, replacing existing event listeners"));var Gt={getPlayheadTime:function(){return tt(D.currentTime)},getStateData:function(){var Ue,bt,tr,Kt=((Ue=(bt=this).getPlayheadTime)===null||Ue===void 0?void 0:Ue.call(bt))||tt(D.currentTime),Or=this.hlsjs&&this.hlsjs.url,$t=this.dashjs&&typeof this.dashjs.getSource=="function"&&this.dashjs.getSource(),Ot={player_is_paused:D.paused,player_width:parseInt(Ve(D,"width")),player_height:parseInt(Ve(D,"height")),player_autoplay_on:D.autoplay,player_preload_on:D.preload,player_language_code:D.lang,player_is_fullscreen:Fr(),video_poster_url:D.poster,video_source_url:Or||$t||D.currentSrc,video_source_duration:tt(D.duration),video_source_height:D.videoHeight,video_source_width:D.videoWidth,view_dropped_frame_count:D==null||(tr=D.getVideoPlaybackQuality)===null||tr===void 0?void 0:tr.call(D).droppedVideoFrames};if(D.getStartDate&&Kt>0){var St=D.getStartDate();if(St&&typeof St.getTime=="function"&&St.getTime()){var Sr=St.getTime();if(Ot.player_program_time=Sr+Kt,D.seekable.length>0){var kr=Sr+D.seekable.end(D.seekable.length-1);Ot.player_live_edge_program_time=kr}}}return Ot}};k=Object.assign(Mt,k,Gt),k.data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:I.VERSION},k.data),D.mux=D.mux||{},D.mux.deleted=!1,D.mux.emit=function(Ue,bt){I.emit(z,Ue,bt)},D.mux.updateData=function(Ue){D.mux.emit("hb",Ue)};var et=function(){Fe.error("The monitor for this video element has already been destroyed.")};D.mux.destroy=function(){Object.keys(D.mux.listeners).forEach(function(Ue){D.removeEventListener(Ue,D.mux.listeners[Ue],!1)}),delete D.mux.listeners,D.mux.destroy=et,D.mux.swapElement=et,D.mux.emit=et,D.mux.addHLSJS=et,D.mux.addDashJS=et,D.mux.removeHLSJS=et,D.mux.removeDashJS=et,D.mux.updateData=et,D.mux.setEmitTranslator=et,D.mux.setStateDataTranslator=et,D.mux.setGetPlayheadTime=et,D.mux.deleted=!0,I.emit(z,"destroy")},D.mux.swapElement=function(Ue){var bt=Te(Be(Ue),3),tr=bt[0],Kt=bt[1],Or=bt[2];if(tr){if(Or!=="video"&&Or!=="audio")return I.log.error("The element of `"+Kt+"` was not a media element.")}else return I.log.error("No element was found with the `"+Kt+"` query selector.");tr.muxId=D.muxId,delete D.muxId,tr.mux=tr.mux||{},tr.mux.listeners=Object.assign({},D.mux.listeners),delete D.mux.listeners,Object.keys(tr.mux.listeners).forEach(function($t){D.removeEventListener($t,tr.mux.listeners[$t],!1),tr.addEventListener($t,tr.mux.listeners[$t],!1)}),tr.mux.swapElement=D.mux.swapElement,tr.mux.destroy=D.mux.destroy,delete D.mux,D=tr},D.mux.addHLSJS=function(Ue){I.addHLSJS(z,Ue)},D.mux.addDashJS=function(Ue){I.addDashJS(z,Ue)},D.mux.removeHLSJS=function(){I.removeHLSJS(z)},D.mux.removeDashJS=function(){I.removeDashJS(z)},D.mux.setEmitTranslator=function(Ue){I.setEmitTranslator(z,Ue)},D.mux.setStateDataTranslator=function(Ue){I.setStateDataTranslator(z,Ue)},D.mux.setGetPlayheadTime=function(Ue){Ue||(Ue=k.getPlayheadTime),I.setGetPlayheadTime(z,Ue)},I.init(z,k),I.emit(z,"playerready"),D.paused||(I.emit(z,"play"),D.readyState>2&&I.emit(z,"playing")),D.mux.listeners={},Xr.forEach(function(Ue){Ue==="error"&&!k.automaticErrorTracking||(D.mux.listeners[Ue]=function(){var bt={};if(Ue==="error"){if(!D.error||D.error.code===1)return;bt.player_error_code=D.error.code,bt.player_error_message=dr[D.error.code]||D.error.message}I.emit(z,Ue,bt)},D.addEventListener(Ue,D.mux.listeners[Ue],!1))})}function $i(I,A,k,x){var D=x;if(I&&typeof I[A]=="function")try{D=I[A].apply(I,k)}catch(z){Wt.info("safeCall error",z)}return D}var Ha=j(at()),$n;Ha.default&&Ha.default.WeakMap&&($n=new WeakMap);function ga(I,A){if(!I||!A||!Ha.default||typeof Ha.default.getComputedStyle!="function")return"";var k;return $n&&$n.has(I)&&(k=$n.get(I)),k||(k=Ha.default.getComputedStyle(I,null),$n&&$n.set(I,k)),k.getPropertyValue(A)}function Va(I){return Math.floor(I*1e3)}var qn={TARGET_DURATION:"#EXT-X-TARGETDURATION",PART_INF:"#EXT-X-PART-INF",SERVER_CONTROL:"#EXT-X-SERVER-CONTROL",INF:"#EXTINF",PROGRAM_DATE_TIME:"#EXT-X-PROGRAM-DATE-TIME",VERSION:"#EXT-X-VERSION",SESSION_DATA:"#EXT-X-SESSION-DATA"},Cn=function(I){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(I),this.manifest};Cn.prototype.process=function(I){var A;for(this.buffer+=I,A=this.buffer.indexOf(`
`);A>-1;A=this.buffer.indexOf(`
`))this.processLine(this.buffer.substring(0,A)),this.buffer=this.buffer.substring(A+1)},Cn.prototype.processLine=function(I){var A=I.indexOf(":"),k=fo(I,A),x=k[0],D=k.length===2?La(k[1]):void 0;if(x[0]!=="#")this.currentUri.uri=x,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(x){case qn.TARGET_DURATION:{if(!isFinite(D)||D<0)return;this.manifest.targetDuration=D,this.setHoldBack();break}case qn.PART_INF:{Ys(this.manifest,k),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break}case qn.SERVER_CONTROL:{Ys(this.manifest,k),this.setHoldBack();break}case qn.INF:{D===0?this.currentUri.duration=.01:D>0&&(this.currentUri.duration=D);break}case qn.PROGRAM_DATE_TIME:{var z=D,$=new Date(z);this.manifest.dateTimeString||(this.manifest.dateTimeString=z,this.manifest.dateTimeObject=$),this.currentUri.dateTimeString=z,this.currentUri.dateTimeObject=$;break}case qn.VERSION:{Ys(this.manifest,k);break}case qn.SESSION_DATA:{var Fe=ml(k[1]),Ve=Ai(Fe);Object.assign(this.manifest.sessionData,Ve)}}},Cn.prototype.setHoldBack=function(){var I=this.manifest,A=I.serverControl,k=I.targetDuration,x=I.partTargetDuration;if(A){var D="holdBack",z="partHoldBack",$=k&&k*3,Fe=x&&x*2;k&&!A.hasOwnProperty(D)&&(A[D]=$),$&&A[D]<$&&(A[D]=$),x&&!A.hasOwnProperty(z)&&(A[z]=x*3),x&&A[z]<Fe&&(A[z]=Fe)}};var Ys=function(I,A){var k=Pr(A[0].replace("#EXT-X-","")),x;_s(A[1])?(x={},x=Object.assign(Ga(A[1]),x)):x=La(A[1]),I[k]=x},Pr=function(I){return I.toLowerCase().replace(/-(\w)/g,function(A){return A[1].toUpperCase()})},La=function(I){if(I.toLowerCase()==="yes"||I.toLowerCase()==="no")return I.toLowerCase()==="yes";var A=I.indexOf(":")!==-1?I:parseFloat(I);return isNaN(A)?I:A},ho=function(I){var A={},k=I.split("=");if(k.length>1){var x=Pr(k[0]);A[x]=La(k[1])}return A},Ga=function(I){for(var A=I.split(","),k={},x=0;A.length>x;x++){var D=A[x],z=ho(D);k=Object.assign(z,k)}return k},_s=function(I){return I.indexOf("=")>-1},fo=function(I,A){return A===-1?[I]:[I.substring(0,A),I.substring(A+1)]},ml=function(I){var A={};if(I){var k=I.search(","),x=I.slice(0,k),D=I.slice(k+1),z=[x,D];return z.forEach(function($,Fe){for(var Ve=$.replace(/['"]+/g,"").split("="),tt=0;tt<Ve.length;tt++)Ve[tt]==="DATA-ID"&&(A["DATA-ID"]=Ve[1-tt]),Ve[tt]==="VALUE"&&(A.VALUE=Ve[1-tt])}),{data:A}}},$s=Cn,Hi={safeCall:$i,safeIncrement:yt,getComputedStyle:ga,secondsToMs:Va,assign:Object.assign,headersStringToObject:Ft,cdnHeadersToRequestId:ie,extractHostnameAndDomain:br,extractHostname:_i,manifestParser:$s,generateShortID:Rt,generateUUID:Br,now:jt.now,findMediaElement:Be},pl=Hi,gl={PLAYER_READY:"playerready",VIEW_INIT:"viewinit",VIDEO_CHANGE:"videochange",PLAY:"play",PAUSE:"pause",PLAYING:"playing",TIME_UPDATE:"timeupdate",SEEKING:"seeking",SEEKED:"seeked",REBUFFER_START:"rebufferstart",REBUFFER_END:"rebufferend",ERROR:"error",ENDED:"ended",RENDITION_CHANGE:"renditionchange",ORIENTATION_CHANGE:"orientationchange",PLAYBACK_MODE_CHANGE:"playbackmodechange",AD_REQUEST:"adrequest",AD_RESPONSE:"adresponse",AD_BREAK_START:"adbreakstart",AD_PLAY:"adplay",AD_PLAYING:"adplaying",AD_PAUSE:"adpause",AD_FIRST_QUARTILE:"adfirstquartile",AD_MID_POINT:"admidpoint",AD_THIRD_QUARTILE:"adthirdquartile",AD_ENDED:"adended",AD_BREAK_END:"adbreakend",AD_ERROR:"aderror",REQUEST_COMPLETED:"requestcompleted",REQUEST_FAILED:"requestfailed",REQUEST_CANCELLED:"requestcanceled",HEARTBEAT:"hb",DESTROY:"destroy"},lu=gl,ka="mux-embed",qs="5.14.0",vo="2.1",Mi={},gr=function(I){var A=arguments;typeof I=="string"?gr.hasOwnProperty(I)?we.default.setTimeout(function(){A=Array.prototype.splice.call(A,1),gr[I].apply(null,A)},0):Wt.warn("`"+I+"` is an unknown task"):typeof I=="function"?we.default.setTimeout(function(){I(gr)},0):Wt.warn("`"+I+"` is invalid.")},Ji={loaded:jt.now(),NAME:ka,VERSION:qs,API_VERSION:vo,PLAYER_TRACKED:!1,monitor:function(I,A){return Ki(gr,I,A)},destroyMonitor:function(I){var A=Te(Be(I),1),k=A[0];k&&k.mux&&typeof k.mux.destroy=="function"?k.mux.destroy():Wt.error("A video element monitor for `"+I+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(I,A){var k=U(I);Mi[k]?Mi[k].addHLSJS(A):Wt.error("A monitor for `"+k+"` has not been initialized.")},addDashJS:function(I,A){var k=U(I);Mi[k]?Mi[k].addDashJS(A):Wt.error("A monitor for `"+k+"` has not been initialized.")},removeHLSJS:function(I){var A=U(I);Mi[A]?Mi[A].removeHLSJS():Wt.error("A monitor for `"+A+"` has not been initialized.")},removeDashJS:function(I){var A=U(I);Mi[A]?Mi[A].removeDashJS():Wt.error("A monitor for `"+A+"` has not been initialized.")},init:function(I,A){Y()&&A&&A.respectDoNotTrack&&Wt.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var k=U(I);Mi[k]=new Ur(gr,k,A)},emit:function(I,A,k){var x=U(I);Mi[x]?(Mi[x].emit(A,k),A==="destroy"&&delete Mi[x]):Wt.error("A monitor for `"+x+"` has not been initialized.")},updateData:function(I,A){var k=U(I);Mi[k]?Mi[k].emit("hb",A):Wt.error("A monitor for `"+k+"` has not been initialized.")},setEmitTranslator:function(I,A){var k=U(I);Mi[k]?Mi[k].emitTranslator=A:Wt.error("A monitor for `"+k+"` has not been initialized.")},setStateDataTranslator:function(I,A){var k=U(I);Mi[k]?Mi[k].stateDataTranslator=A:Wt.error("A monitor for `"+k+"` has not been initialized.")},setGetPlayheadTime:function(I,A){var k=U(I);Mi[k]?Mi[k].getPlayheadTime=A:Wt.error("A monitor for `"+k+"` has not been initialized.")},checkDoNotTrack:Y,log:Wt,utils:pl,events:lu,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(gr,Ji),typeof we.default!="undefined"&&typeof we.default.addEventListener=="function"&&we.default.addEventListener("pagehide",function(I){I.persisted||(gr.WINDOW_UNLOADING=!0)},!1);var Ka=gr;/*!
* JavaScript Cookie v2.1.3
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
* Released under the MIT license
*/},64624($e,Me,Ee){var He;/*! Player.js - v0.1.0 - 2017-10-24
* http://github.com/embedly/player.js
* Copyright (c) 2017 Embedly; Licensed BSD */(function(Le,Ne){var H={};H.DEBUG=!1,H.VERSION="0.0.11",H.CONTEXT="player.js",H.POST_MESSAGE=!!Le.postMessage,H.origin=function(O){return O.substr(0,2)==="//"&&(O=Le.location.protocol+O),O.split("/").slice(0,3).join("/")},H.addEvent=function(O,K,j){O&&(O.addEventListener?O.addEventListener(K,j,!1):O.attachEvent?O.attachEvent("on"+K,j):O["on"+K]=j)},H.log=function(){H.log.history=H.log.history||[],H.log.history.push(arguments),Le.console&&H.DEBUG&&Le.console.log(Array.prototype.slice.call(arguments))},H.isString=function(O){return Object.prototype.toString.call(O)==="[object String]"},H.isObject=function(O){return Object.prototype.toString.call(O)==="[object Object]"},H.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"},H.isNone=function(O){return O==null},H.has=function(O,K){return Object.prototype.hasOwnProperty.call(O,K)},H.indexOf=function(O,K){if(O==null)return-1;var j=0,ve=O.length;if(Array.prototype.IndexOf&&O.indexOf===Array.prototype.IndexOf)return O.indexOf(K);for(;j<ve;j++)if(O[j]===K)return j;return-1},H.assert=function(O,K){if(!O)throw K||"Player.js Assert Failed"},H.Keeper=function(){this.init()},H.Keeper.prototype.init=function(){this.data={}},H.Keeper.prototype.getUUID=function(){return"listener-xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(O){var K=Math.random()*16|0,j=O==="x"?K:K&3|8;return j.toString(16)})},H.Keeper.prototype.has=function(O,K){if(!this.data.hasOwnProperty(O))return!1;if(H.isNone(K))return!0;for(var j=this.data[O],ve=0;ve<j.length;ve++)if(j[ve].id===K)return!0;return!1},H.Keeper.prototype.add=function(O,K,j,ve,at){var ze={id:O,event:K,cb:j,ctx:ve,one:at};this.has(K)?this.data[K].push(ze):this.data[K]=[ze]},H.Keeper.prototype.execute=function(O,K,j,ve){if(!this.has(O,K))return!1;for(var at=[],ze=[],Et=0;Et<this.data[O].length;Et++){var Xe=this.data[O][Et];H.isNone(K)||!H.isNone(K)&&Xe.id===K?(ze.push({cb:Xe.cb,ctx:Xe.ctx?Xe.ctx:ve,data:j}),Xe.one===!1&&at.push(Xe)):at.push(Xe)}at.length===0?delete this.data[O]:this.data[O]=at;for(var Ye=0;Ye<ze.length;Ye++){var Ze=ze[Ye];Ze.cb.call(Ze.ctx,Ze.data)}},H.Keeper.prototype.on=function(O,K,j,ve){this.add(O,K,j,ve,!1)},H.Keeper.prototype.one=function(O,K,j,ve){this.add(O,K,j,ve,!0)},H.Keeper.prototype.off=function(O,K){var j=[];if(!this.data.hasOwnProperty(O))return j;for(var ve=[],at=0;at<this.data[O].length;at++){var ze=this.data[O][at];!H.isNone(K)&&ze.cb!==K?ve.push(ze):H.isNone(ze.id)||j.push(ze.id)}return ve.length===0?delete this.data[O]:this.data[O]=ve,j},H.Player=function(O,K){if(!(this instanceof H.Player))return new H.Player(O,K);this.init(O,K)},H.EVENTS={READY:"ready",PLAY:"play",PAUSE:"pause",ENDED:"ended",TIMEUPDATE:"timeupdate",PROGRESS:"progress",ERROR:"error"},H.EVENTS.all=function(){var O=[];for(var K in H.EVENTS)H.has(H.EVENTS,K)&&H.isString(H.EVENTS[K])&&O.push(H.EVENTS[K]);return O},H.METHODS={PLAY:"play",PAUSE:"pause",GETPAUSED:"getPaused",MUTE:"mute",UNMUTE:"unmute",GETMUTED:"getMuted",SETVOLUME:"setVolume",GETVOLUME:"getVolume",GETDURATION:"getDuration",SETCURRENTTIME:"setCurrentTime",GETCURRENTTIME:"getCurrentTime",SETLOOP:"setLoop",GETLOOP:"getLoop",REMOVEEVENTLISTENER:"removeEventListener",ADDEVENTLISTENER:"addEventListener"},H.METHODS.all=function(){var O=[];for(var K in H.METHODS)H.has(H.METHODS,K)&&H.isString(H.METHODS[K])&&O.push(H.METHODS[K]);return O},H.READIED=[],H.Player.prototype.init=function(O,K){var j=this;H.isString(O)&&(O=Ne.getElementById(O)),this.elem=O,H.assert(O.nodeName==="IFRAME",'playerjs.Player constructor requires an Iframe, got "'+O.nodeName+'"'),H.assert(O.src,"playerjs.Player constructor requires a Iframe with a 'src' attribute."),this.origin=H.origin(O.src),this.keeper=new H.Keeper,this.isReady=!1,this.queue=[],this.events=H.EVENTS.all(),this.methods=H.METHODS.all(),H.POST_MESSAGE?H.addEvent(Le,"message",function(ve){j.receive(ve)}):H.log("Post Message is not Available."),H.indexOf(H.READIED,O.src)>-1?j.loaded=!0:this.elem.onload=function(){j.loaded=!0}},H.Player.prototype.send=function(O,K,j){if(O.context=H.CONTEXT,O.version=H.VERSION,K){var ve=this.keeper.getUUID();O.listener=ve,this.keeper.one(ve,O.method,K,j)}return!this.isReady&&O.value!=="ready"?(H.log("Player.queue",O),this.queue.push(O),!1):(H.log("Player.send",O,this.origin),this.loaded===!0&&this.elem.contentWindow.postMessage(JSON.stringify(O),this.origin),!0)},H.Player.prototype.receive=function(O){if(H.log("Player.receive",O),O.origin!==this.origin)return!1;var K;try{K=JSON.parse(O.data)}catch(j){return!1}if(K.context!==H.CONTEXT)return!1;K.event==="ready"&&K.value&&K.value.src===this.elem.src&&this.ready(K),this.keeper.has(K.event,K.listener)&&this.keeper.execute(K.event,K.listener,K.value,this)},H.Player.prototype.ready=function(O){if(this.isReady===!0)return!1;O.value.events&&(this.events=O.value.events),O.value.methods&&(this.methods=O.value.methods),this.isReady=!0,this.loaded=!0;for(var K=0;K<this.queue.length;K++){var j=this.queue[K];H.log("Player.dequeue",j),O.event==="ready"&&this.keeper.execute(j.event,j.listener,!0,this),this.send(j)}this.queue=[]},H.Player.prototype.on=function(O,K,j){var ve=this.keeper.getUUID();return O==="ready"?this.keeper.one(ve,O,K,j):this.keeper.on(ve,O,K,j),this.send({method:"addEventListener",value:O,listener:ve}),!0},H.Player.prototype.off=function(O,K){var j=this.keeper.off(O,K);if(H.log("Player.off",j),j.length>0)for(var ve in j)return this.send({method:"removeEventListener",value:O,listener:j[ve]}),!0;return!1},H.Player.prototype.supports=function(O,K){H.assert(H.indexOf(["method","event"],O)>-1,'evtOrMethod needs to be either "event" or "method" got '+O),K=H.isArray(K)?K:[K];for(var j=O==="event"?this.events:this.methods,ve=0;ve<K.length;ve++)if(H.indexOf(j,K[ve])===-1)return!1;return!0};function Qe(O){return function(){var K={method:O},j=Array.prototype.slice.call(arguments);/^get/.test(O)?(H.assert(j.length>0,"Get methods require a callback."),j.unshift(K)):(/^set/.test(O)&&(H.assert(j.length!==0,"Set methods require a value."),K.value=j[0]),j=[K]),this.send.apply(this,j)}}for(var de=0,Pe=H.METHODS.all().length;de<Pe;de++){var he=H.METHODS.all()[de];H.Player.prototype.hasOwnProperty(he)||(H.Player.prototype[he]=Qe(he))}H.addEvent(Le,"message",function(O){var K;try{K=JSON.parse(O.data)}catch(j){return!1}if(K.context!==H.CONTEXT)return!1;K.event==="ready"&&K.value&&K.value.src&&H.READIED.push(K.value.src)}),H.Receiver=function(O,K){this.init(O,K)},H.Receiver.prototype.init=function(O,K){var j=this;this.isReady=!1,this.origin=H.origin(Ne.referrer),this.methods={},this.supported={events:O||H.EVENTS.all(),methods:K||H.METHODS.all()},this.eventListeners={},this.reject=!(Le.self!==Le.top&&H.POST_MESSAGE),this.reject||H.addEvent(Le,"message",function(ve){j.receive(ve)})},H.Receiver.prototype.receive=function(O){if(O.origin!==this.origin)return!1;var K={};if(H.isObject(O.data))K=O.data;else try{K=Le.JSON.parse(O.data)}catch(at){H.log("JSON Parse Error",at)}if(H.log("Receiver.receive",O,K),!K.method||K.context!==H.CONTEXT)return!1;if(H.indexOf(H.METHODS.all(),K.method)===-1)return this.emit("error",{code:2,msg:'Invalid Method "'+K.method+'"'}),!1;var j=H.isNone(K.listener)?null:K.listener;if(K.method==="addEventListener")this.eventListeners.hasOwnProperty(K.value)?H.indexOf(this.eventListeners[K.value],j)===-1&&this.eventListeners[K.value].push(j):this.eventListeners[K.value]=[j],K.value==="ready"&&this.isReady&&this.ready();else if(K.method==="removeEventListener"){if(this.eventListeners.hasOwnProperty(K.value)){var ve=H.indexOf(this.eventListeners[K.value],j);ve>-1&&this.eventListeners[K.value].splice(ve,1),this.eventListeners[K.value].length===0&&delete this.eventListeners[K.value]}}else this.get(K.method,K.value,j)},H.Receiver.prototype.get=function(O,K,j){var ve=this;if(!this.methods.hasOwnProperty(O))return this.emit("error",{code:3,msg:'Method Not Supported"'+O+'"'}),!1;var at=this.methods[O];if(O.substr(0,3)==="get"){var ze=function(Et){ve.send(O,Et,j)};at.call(this,ze)}else at.call(this,K)},H.Receiver.prototype.on=function(O,K){this.methods[O]=K},H.Receiver.prototype.send=function(O,K,j){if(H.log("Receiver.send",O,K,j),this.reject)return H.log("Receiver.send.reject",O,K,j),!1;var ve={context:H.CONTEXT,version:H.VERSION,event:O};H.isNone(K)||(ve.value=K),H.isNone(j)||(ve.listener=j);var at=JSON.stringify(ve);Le.parent.postMessage(at,this.origin===""?"*":this.origin)},H.Receiver.prototype.emit=function(O,K){if(!this.eventListeners.hasOwnProperty(O))return!1;H.log("Instance.emit",O,K,this.eventListeners[O]);for(var j=0;j<this.eventListeners[O].length;j++){var ve=this.eventListeners[O][j];this.send(O,K,ve)}return!0},H.Receiver.prototype.ready=function(){H.log("Receiver.ready"),this.isReady=!0;var O={src:Le.location.toString(),events:this.supported.events,methods:this.supported.methods};this.emit("ready",O)||this.send("ready",O)},H.HTML5Adapter=function(O){if(!(this instanceof H.HTML5Adapter))return new H.HTML5Adapter(O);this.init(O)},H.HTML5Adapter.prototype.init=function(O){H.assert(O,"playerjs.HTML5Adapter requires a video element");var K=this.receiver=new H.Receiver;O.addEventListener("playing",function(){K.emit("play")}),O.addEventListener("pause",function(){K.emit("pause")}),O.addEventListener("ended",function(){K.emit("ended")}),O.addEventListener("timeupdate",function(){K.emit("timeupdate",{seconds:O.currentTime,duration:O.duration})}),O.addEventListener("progress",function(){K.emit("buffered",{percent:O.buffered.length})}),K.on("play",function(){O.play()}),K.on("pause",function(){O.pause()}),K.on("getPaused",function(j){j(O.paused)}),K.on("getCurrentTime",function(j){j(O.currentTime)}),K.on("setCurrentTime",function(j){O.currentTime=j}),K.on("getDuration",function(j){j(O.duration)}),K.on("getVolume",function(j){j(O.volume*100)}),K.on("setVolume",function(j){O.volume=j/100}),K.on("mute",function(){O.muted=!0}),K.on("unmute",function(){O.muted=!1}),K.on("getMuted",function(j){j(O.muted)}),K.on("getLoop",function(j){j(O.loop)}),K.on("setLoop",function(j){O.loop=j})},H.HTML5Adapter.prototype.ready=function(){this.receiver.ready()},H.JWPlayerAdapter=function(O){if(!(this instanceof H.JWPlayerAdapter))return new H.JWPlayerAdapter(O);this.init(O)},H.JWPlayerAdapter.prototype.init=function(O){H.assert(O,"playerjs.JWPlayerAdapter requires a player object");var K=this.receiver=new H.Receiver;this.looped=!1,O.on("pause",function(){K.emit("pause")}),O.on("play",function(){K.emit("play")}),O.on("time",function(ve){var at=ve.position,ze=ve.duration;if(!at||!ze)return!1;var Et={seconds:at,duration:ze};K.emit("timeupdate",Et)});var j=this;O.on("complete",function(){j.looped===!0?O.seek(0):K.emit("ended")}),O.on("error",function(){K.emit("error")}),K.on("play",function(){O.play(!0)}),K.on("pause",function(){O.pause(!0)}),K.on("getPaused",function(ve){ve(O.getState().toLowerCase()!=="PLAYING".toLowerCase())}),K.on("getCurrentTime",function(ve){ve(O.getPosition())}),K.on("setCurrentTime",function(ve){O.seek(ve)}),K.on("getDuration",function(ve){ve(O.getDuration())}),K.on("getVolume",function(ve){ve(O.getVolume())}),K.on("setVolume",function(ve){O.setVolume(ve)}),K.on("mute",function(){O.setMute(!0)}),K.on("unmute",function(){O.setMute(!1)}),K.on("getMuted",function(ve){ve(O.getMute()===!0)}),K.on("getLoop",function(ve){ve(this.looped)},this),K.on("setLoop",function(ve){this.looped=ve},this)},H.JWPlayerAdapter.prototype.ready=function(){this.receiver.ready()},H.MockAdapter=function(){if(!(this instanceof H.MockAdapter))return new H.MockAdapter;this.init()},H.MockAdapter.prototype.init=function(){var O={duration:20,currentTime:0,interval:null,timeupdate:function(){},volume:100,mute:!1,playing:!1,loop:!1,play:function(){O.interval=setInterval(function(){O.currentTime+=.25,O.timeupdate({seconds:O.currentTime,duration:O.duration})},250),O.playing=!0},pause:function(){clearInterval(O.interval),O.playing=!1}},K=this.receiver=new H.Receiver;K.on("play",function(){var j=this;O.play(),this.emit("play"),O.timeupdate=function(ve){j.emit("timeupdate",ve)}}),K.on("pause",function(){O.pause(),this.emit("pause")}),K.on("getPaused",function(j){j(!O.playing)}),K.on("getCurrentTime",function(j){j(O.currentTime)}),K.on("setCurrentTime",function(j){O.currentTime=j}),K.on("getDuration",function(j){j(O.duration)}),K.on("getVolume",function(j){j(O.volume)}),K.on("setVolume",function(j){O.volume=j}),K.on("mute",function(){O.mute=!0}),K.on("unmute",function(){O.mute=!1}),K.on("getMuted",function(j){j(O.mute)}),K.on("getLoop",function(j){j(O.loop)}),K.on("setLoop",function(j){O.loop=j})},H.MockAdapter.prototype.ready=function(){this.receiver.ready()},H.VideoJSAdapter=function(O){if(!(this instanceof H.VideoJSAdapter))return new H.VideoJSAdapter(O);this.init(O)},H.VideoJSAdapter.prototype.init=function(O){H.assert(O,"playerjs.VideoJSReceiver requires a player object");var K=this.receiver=new H.Receiver;O.on("pause",function(){K.emit("pause")}),O.on("play",function(){K.emit("play")}),O.on("timeupdate",function(j){var ve=O.currentTime(),at=O.duration();if(!ve||!at)return!1;var ze={seconds:ve,duration:at};K.emit("timeupdate",ze)}),O.on("ended",function(){K.emit("ended")}),O.on("error",function(){K.emit("error")}),K.on("play",function(){O.play()}),K.on("pause",function(){O.pause()}),K.on("getPaused",function(j){j(O.paused())}),K.on("getCurrentTime",function(j){j(O.currentTime())}),K.on("setCurrentTime",function(j){O.currentTime(j)}),K.on("getDuration",function(j){j(O.duration())}),K.on("getVolume",function(j){j(O.volume()*100)}),K.on("setVolume",function(j){O.volume(j/100)}),K.on("mute",function(){O.volume(0)}),K.on("unmute",function(){O.volume(1)}),K.on("getMuted",function(j){j(O.volume()===0)}),K.on("getLoop",function(j){j(O.loop())}),K.on("setLoop",function(j){O.loop(j)})},H.VideoJSAdapter.prototype.ready=function(){this.receiver.ready()},He=function(){return H}.call(Me,Ee,Me,$e),He!==void 0&&($e.exports=He)})(window,document)},43921($e){"use strict";var Me;/**
* @link https://github.com/gajus/sister for the canonical source repository
* @license https://github.com/gajus/sister/blob/master/LICENSE BSD 3-Clause
*/Me=function(){var Ee={},He={};return Ee.on=function(Le,Ne){var H={name:Le,handler:Ne};return He[Le]=He[Le]||[],He[Le].unshift(H),H},Ee.off=function(Le){var Ne=He[Le.name].indexOf(Le);Ne!==-1&&He[Le.name].splice(Ne,1)},Ee.trigger=function(Le,Ne){var H=He[Le],Qe;if(H)for(Qe=H.length;Qe--;)H[Qe].handler(Ne)},Ee},$e.exports=Me},18437($e,Me,Ee){"use strict";Object.defineProperty(Me,"__esModule",{value:!0});var He=Ee(38329),Le=Ne(He);function Ne(H){return H&&H.__esModule?H:{default:H}}Me.default={pauseVideo:{acceptableStates:[Le.default.ENDED,Le.default.PAUSED],stateChangeRequired:!1},playVideo:{acceptableStates:[Le.default.ENDED,Le.default.PLAYING],stateChangeRequired:!1},seekTo:{acceptableStates:[Le.default.ENDED,Le.default.PLAYING,Le.default.PAUSED],stateChangeRequired:!0,timeout:3e3}},$e.exports=Me.default},38686($e,Me,Ee){"use strict";Object.defineProperty(Me,"__esModule",{value:!0});var He=Ee(80210),Le=O(He),Ne=Ee(18437),H=O(Ne),Qe=Ee(8232),de=O(Qe),Pe=Ee(57202),he=O(Pe);function O(ve){return ve&&ve.__esModule?ve:{default:ve}}const K=(0,Le.default)("youtube-player"),j={};j.proxyEvents=ve=>{const at={};for(const ze of de.default){const Et="on"+ze.slice(0,1).toUpperCase()+ze.slice(1);at[Et]=Xe=>{K('event "%s"',Et,Xe),ve.trigger(ze,Xe)}}return at},j.promisifyPlayer=(ve,at=!1)=>{const ze={};for(const Et of he.default)at&&H.default[Et]?ze[Et]=(...Xe)=>ve.then(Ye=>{const Ze=H.default[Et],st=Ye.getPlayerState(),ht=Ye[Et].apply(Ye,Xe);return Ze.stateChangeRequired||Array.isArray(Ze.acceptableStates)&&!Ze.acceptableStates.includes(st)?new Promise(Je=>{const ae=()=>{const dt=Ye.getPlayerState();let ke;typeof Ze.timeout=="number"&&(ke=setTimeout(()=>{Ye.removeEventListener("onStateChange",ae),Je()},Ze.timeout)),Array.isArray(Ze.acceptableStates)&&Ze.acceptableStates.includes(dt)&&(Ye.removeEventListener("onStateChange",ae),clearTimeout(ke),Je())};Ye.addEventListener("onStateChange",ae)}).then(()=>ht):ht}):ze[Et]=(...Xe)=>ve.then(Ye=>Ye[Et].apply(Ye,Xe));return ze},Me.default=j,$e.exports=Me.default},38329($e,Me){"use strict";Object.defineProperty(Me,"__esModule",{value:!0}),Me.default={BUFFERING:3,ENDED:0,PAUSED:2,PLAYING:1,UNSTARTED:-1,VIDEO_CUED:5},$e.exports=Me.default},8232($e,Me){"use strict";Object.defineProperty(Me,"__esModule",{value:!0}),Me.default=["ready","stateChange","playbackQualityChange","playbackRateChange","error","apiChange","volumeChange"],$e.exports=Me.default},57202($e,Me){"use strict";Object.defineProperty(Me,"__esModule",{value:!0}),Me.default=["cueVideoById","loadVideoById","cueVideoByUrl","loadVideoByUrl","playVideo","pauseVideo","stopVideo","getVideoLoadedFraction","cuePlaylist","loadPlaylist","nextVideo","previousVideo","playVideoAt","setShuffle","setLoop","getPlaylist","getPlaylistIndex","setOption","mute","unMute","isMuted","setVolume","getVolume","seekTo","getPlayerState","getPlaybackRate","setPlaybackRate","getAvailablePlaybackRates","getPlaybackQuality","setPlaybackQuality","getAvailableQualityLevels","getCurrentTime","getDuration","removeEventListener","getVideoUrl","getVideoEmbedCode","getOptions","getOption","addEventListener","destroy","setSize","getIframe","getSphericalProperties","setSphericalProperties"],$e.exports=Me.default},96554($e,Me,Ee){"use strict";Object.defineProperty(Me,"__esModule",{value:!0});var He=Ee(43921),Le=Pe(He),Ne=Ee(38686),H=Pe(Ne),Qe=Ee(11471),de=Pe(Qe);function Pe(O){return O&&O.__esModule?O:{default:O}}let he;Me.default=(O,K={},j=!1)=>{const ve=(0,Le.default)();if(he||(he=(0,de.default)(ve)),K.events)throw new Error("Event handlers cannot be overwritten.");if(typeof O=="string"&&!document.getElementById(O))throw new Error('Element "'+O+'" does not exist.');K.events=H.default.proxyEvents(ve);const at=new Promise(Et=>{typeof O=="object"&&O.playVideo instanceof Function?Et(O):he.then(Xe=>{const Ye=new Xe.Player(O,K);return ve.on("ready",()=>{Et(Ye)}),null})}),ze=H.default.promisifyPlayer(at,j);return ze.on=ve.on,ze.off=ve.off,ze},$e.exports=Me.default},11471($e,Me,Ee){"use strict";Object.defineProperty(Me,"__esModule",{value:!0});var He=Ee(4340),Le=Ne(He);function Ne(H){return H&&H.__esModule?H:{default:H}}Me.default=H=>new Promise(de=>{if(window.YT&&window.YT.Player&&window.YT.Player instanceof Function){de(window.YT);return}else{const he=window.location.protocol==="http:"?"http:":"https:";(0,Le.default)(he+"//www.youtube.com/iframe_api",O=>{O&&H.trigger("error",O)})}const Pe=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{Pe&&Pe(),de(window.YT)}}),$e.exports=Me.default},25239($e){function Me(Ee,He){this.v=Ee,this.k=He}$e.exports=Me,$e.exports.__esModule=!0,$e.exports.default=$e.exports},3504($e){function Me(He,Le,Ne,H,Qe,de,Pe){try{var he=He[de](Pe),O=he.value}catch(K){return void Ne(K)}he.done?Le(O):Promise.resolve(O).then(H,Qe)}function Ee(He){return function(){var Le=this,Ne=arguments;return new Promise(function(H,Qe){var de=He.apply(Le,Ne);function Pe(O){Me(de,H,Qe,Pe,he,"next",O)}function he(O){Me(de,H,Qe,Pe,he,"throw",O)}Pe(void 0)})}}$e.exports=Ee,$e.exports.__esModule=!0,$e.exports.default=$e.exports},71184($e,Me,Ee){var He=Ee(85188);function Le(Ne,H){if(Ne==null)return{};var Qe,de,Pe=He(Ne,H);if(Object.getOwnPropertySymbols){var he=Object.getOwnPropertySymbols(Ne);for(de=0;de<he.length;de++)Qe=he[de],H.indexOf(Qe)===-1&&{}.propertyIsEnumerable.call(Ne,Qe)&&(Pe[Qe]=Ne[Qe])}return Pe}$e.exports=Le,$e.exports.__esModule=!0,$e.exports.default=$e.exports},85188($e){function Me(Ee,He){if(Ee==null)return{};var Le={};for(var Ne in Ee)if({}.hasOwnProperty.call(Ee,Ne)){if(He.indexOf(Ne)!==-1)continue;Le[Ne]=Ee[Ne]}return Le}$e.exports=Me,$e.exports.__esModule=!0,$e.exports.default=$e.exports},50154($e,Me,Ee){var He=Ee(75129);function Le(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var Ne,H,Qe=typeof Symbol=="function"?Symbol:{},de=Qe.iterator||"@@iterator",Pe=Qe.toStringTag||"@@toStringTag";function he(Xe,Ye,Ze,st){var ht=Ye&&Ye.prototype instanceof K?Ye:K,Je=Object.create(ht.prototype);return He(Je,"_invoke",function(ae,dt,ke){var mt,At,Ge,De=0,Lt=ke||[],ut=!1,Q={p:0,n:0,v:Ne,a:_,f:_.bind(Ne,4),d:function(Ie,ct){return mt=Ie,At=0,Ge=Ne,Q.n=ct,O}};function _(pe,Ie){for(At=pe,Ge=Ie,H=0;!ut&&De&&!ct&&H<Lt.length;H++){var ct,_e=Lt[H],Te=Q.p,we=_e[2];pe>3?(ct=we===Ie)&&(Ge=_e[(At=_e[4])?5:(At=3,3)],_e[4]=_e[5]=Ne):_e[0]<=Te&&((ct=pe<2&&Te<_e[1])?(At=0,Q.v=Ie,Q.n=_e[1]):Te<we&&(ct=pe<3||_e[0]>Ie||Ie>we)&&(_e[4]=pe,_e[5]=Ie,Q.n=we,At=0))}if(ct||pe>1)return O;throw ut=!0,Ie}return function(pe,Ie,ct){if(De>1)throw TypeError("Generator is already running");for(ut&&Ie===1&&_(Ie,ct),At=Ie,Ge=ct;(H=At<2?Ne:Ge)||!ut;){mt||(At?At<3?(At>1&&(Q.n=-1),_(At,Ge)):Q.n=Ge:Q.v=Ge);try{if(De=2,mt){if(At||(pe="next"),H=mt[pe]){if(!(H=H.call(mt,Ge)))throw TypeError("iterator result is not an object");if(!H.done)return H;Ge=H.value,At<2&&(At=0)}else At===1&&(H=mt.return)&&H.call(mt),At<2&&(Ge=TypeError("The iterator does not provide a '"+pe+"' method"),At=1);mt=Ne}else if((H=(ut=Q.n<0)?Ge:ae.call(dt,Q))!==O)break}catch(_e){mt=Ne,At=1,Ge=_e}finally{De=1}}return{value:H,done:ut}}}(Xe,Ze,st),!0),Je}var O={};function K(){}function j(){}function ve(){}H=Object.getPrototypeOf;var at=[][de]?H(H([][de]())):(He(H={},de,function(){return this}),H),ze=ve.prototype=K.prototype=Object.create(at);function Et(Xe){return Object.setPrototypeOf?Object.setPrototypeOf(Xe,ve):(Xe.__proto__=ve,He(Xe,Pe,"GeneratorFunction")),Xe.prototype=Object.create(ze),Xe}return j.prototype=ve,He(ze,"constructor",ve),He(ve,"constructor",j),j.displayName="GeneratorFunction",He(ve,Pe,"GeneratorFunction"),He(ze),He(ze,Pe,"Generator"),He(ze,de,function(){return this}),He(ze,"toString",function(){return"[object Generator]"}),($e.exports=Le=function(){return{w:he,m:Et}},$e.exports.__esModule=!0,$e.exports.default=$e.exports)()}$e.exports=Le,$e.exports.__esModule=!0,$e.exports.default=$e.exports},53632($e,Me,Ee){var He=Ee(27124);function Le(Ne,H,Qe,de,Pe){var he=He(Ne,H,Qe,de,Pe);return he.next().then(function(O){return O.done?O.value:he.next()})}$e.exports=Le,$e.exports.__esModule=!0,$e.exports.default=$e.exports},27124($e,Me,Ee){var He=Ee(50154),Le=Ee(74346);function Ne(H,Qe,de,Pe,he){return new Le(He().w(H,Qe,de,Pe),he||Promise)}$e.exports=Ne,$e.exports.__esModule=!0,$e.exports.default=$e.exports},74346($e,Me,Ee){var He=Ee(25239),Le=Ee(75129);function Ne(H,Qe){function de(he,O,K,j){try{var ve=H[he](O),at=ve.value;return at instanceof He?Qe.resolve(at.v).then(function(ze){de("next",ze,K,j)},function(ze){de("throw",ze,K,j)}):Qe.resolve(at).then(function(ze){ve.value=ze,K(ve)},function(ze){return de("throw",ze,K,j)})}catch(ze){j(ze)}}var Pe;this.next||(Le(Ne.prototype),Le(Ne.prototype,typeof Symbol=="function"&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),Le(this,"_invoke",function(he,O,K){function j(){return new Qe(function(ve,at){de(he,K,ve,at)})}return Pe=Pe?Pe.then(j,j):j()},!0)}$e.exports=Ne,$e.exports.__esModule=!0,$e.exports.default=$e.exports},75129($e){function Me(Ee,He,Le,Ne){var H=Object.defineProperty;try{H({},"",{})}catch(Qe){H=0}$e.exports=Me=function(de,Pe,he,O){function K(j,ve){Me(de,j,function(at){return this._invoke(j,ve,at)})}Pe?H?H(de,Pe,{value:he,enumerable:!O,configurable:!O,writable:!O}):de[Pe]=he:(K("next",0),K("throw",1),K("return",2))},$e.exports.__esModule=!0,$e.exports.default=$e.exports,Me(Ee,He,Le,Ne)}$e.exports=Me,$e.exports.__esModule=!0,$e.exports.default=$e.exports},88786($e){function Me(Ee){var He=Object(Ee),Le=[];for(var Ne in He)Le.unshift(Ne);return function H(){for(;Le.length;)if((Ne=Le.pop())in He)return H.value=Ne,H.done=!1,H;return H.done=!0,H}}$e.exports=Me,$e.exports.__esModule=!0,$e.exports.default=$e.exports},97924($e,Me,Ee){var He=Ee(25239),Le=Ee(50154),Ne=Ee(53632),H=Ee(27124),Qe=Ee(74346),de=Ee(88786),Pe=Ee(29284);function he(){"use strict";var O=Le(),K=O.m(he),j=(Object.getPrototypeOf?Object.getPrototypeOf(K):K.__proto__).constructor;function ve(Et){var Xe=typeof Et=="function"&&Et.constructor;return!!Xe&&(Xe===j||(Xe.displayName||Xe.name)==="GeneratorFunction")}var at={throw:1,return:2,break:3,continue:3};function ze(Et){var Xe,Ye;return function(Ze){Xe||(Xe={stop:function(){return Ye(Ze.a,2)},catch:function(){return Ze.v},abrupt:function(ht,Je){return Ye(Ze.a,at[ht],Je)},delegateYield:function(ht,Je,ae){return Xe.resultName=Je,Ye(Ze.d,Pe(ht),ae)},finish:function(ht){return Ye(Ze.f,ht)}},Ye=function(ht,Je,ae){Ze.p=Xe.prev,Ze.n=Xe.next;try{return ht(Je,ae)}finally{Xe.next=Ze.n}}),Xe.resultName&&(Xe[Xe.resultName]=Ze.v,Xe.resultName=void 0),Xe.sent=Ze.v,Xe.next=Ze.n;try{return Et.call(this,Xe)}finally{Ze.p=Xe.prev,Ze.n=Xe.next}}}return($e.exports=he=function(){return{wrap:function(Ye,Ze,st,ht){return O.w(ze(Ye),Ze,st,ht&&ht.reverse())},isGeneratorFunction:ve,mark:O.m,awrap:function(Ye,Ze){return new He(Ye,Ze)},AsyncIterator:Qe,async:function(Ye,Ze,st,ht,Je){return(ve(Ze)?H:Ne)(ze(Ye),Ze,st,ht,Je)},keys:de,values:Pe}},$e.exports.__esModule=!0,$e.exports.default=$e.exports)()}$e.exports=he,$e.exports.__esModule=!0,$e.exports.default=$e.exports},29284($e,Me,Ee){var He=Ee(99787).default;function Le(Ne){if(Ne!=null){var H=Ne[typeof Symbol=="function"&&Symbol.iterator||"@@iterator"],Qe=0;if(H)return H.call(Ne);if(typeof Ne.next=="function")return Ne;if(!isNaN(Ne.length))return{next:function(){return Ne&&Qe>=Ne.length&&(Ne=void 0),{value:Ne&&Ne[Qe++],done:!Ne}}}}throw new TypeError(He(Ne)+" is not iterable")}$e.exports=Le,$e.exports.__esModule=!0,$e.exports.default=$e.exports},81987($e,Me,Ee){var He=Ee(97924)();$e.exports=He;try{regeneratorRuntime=He}catch(Le){typeof globalThis=="object"?globalThis.regeneratorRuntime=He:Function("r","regeneratorRuntime = r")(He)}},76322($e,Me){"use strict";Object.defineProperty(Me,"__esModule",{value:!0});function Ee(Le,Ne,H){var Qe=H||{},de=Qe.noTrailing,Pe=de===void 0?!1:de,he=Qe.noLeading,O=he===void 0?!1:he,K=Qe.debounceMode,j=K===void 0?void 0:K,ve,at=!1,ze=0;function Et(){ve&&clearTimeout(ve)}function Xe(Ze){var st=Ze||{},ht=st.upcomingOnly,Je=ht===void 0?!1:ht;Et(),at=!Je}function Ye(){for(var Ze=arguments.length,st=new Array(Ze),ht=0;ht<Ze;ht++)st[ht]=arguments[ht];var Je=this,ae=Date.now()-ze;if(at)return;function dt(){ze=Date.now(),Ne.apply(Je,st)}function ke(){ve=void 0}!O&&j&&!ve&&dt(),Et(),j===void 0&&ae>Le?O?(ze=Date.now(),Pe||(ve=setTimeout(j?ke:dt,Le))):dt():Pe!==!0&&(ve=setTimeout(j?ke:dt,j===void 0?Le-ae:Le))}return Ye.cancel=Xe,Ye}function He(Le,Ne,H){var Qe=H||{},de=Qe.atBegin,Pe=de===void 0?!1:de;return Ee(Le,Ne,{debounceMode:Pe!==!1})}Me.debounce=He,Me.throttle=Ee},13766($e,Me,Ee){"use strict";Ee.d(Me,{A:()=>Le});function He(Ne,H,Qe,de,Pe,he,O){try{var K=Ne[he](O),j=K.value}catch(ve){return void Qe(ve)}K.done?H(j):Promise.resolve(j).then(de,Pe)}function Le(Ne){return function(){var H=this,Qe=arguments;return new Promise(function(de,Pe){var he=Ne.apply(H,Qe);function O(j){He(he,de,Pe,O,K,"next",j)}function K(j){He(he,de,Pe,O,K,"throw",j)}O(void 0)})}}},35232($e,Me,Ee){"use strict";Ee.r(Me),Ee.d(Me,{CastableMediaMixin:()=>_i,CastableVideoMixin:()=>br});var He=Object.defineProperty,Le=Object.getOwnPropertySymbols,Ne=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,Qe=(fe,ye,oe)=>ye in fe?He(fe,ye,{enumerable:!0,configurable:!0,writable:!0,value:oe}):fe[ye]=oe,de=(fe,ye)=>{for(var oe in ye||(ye={}))Ne.call(ye,oe)&&Qe(fe,oe,ye[oe]);if(Le)for(var oe of Le(ye))H.call(ye,oe)&&Qe(fe,oe,ye[oe]);return fe},Pe=(fe,ye,oe)=>new Promise((yt,qt)=>{var yr=Ht=>{try{Qt(oe.next(Ht))}catch(Ci){qt(Ci)}},Rr=Ht=>{try{Qt(oe.throw(Ht))}catch(Ci){qt(Ci)}},Qt=Ht=>Ht.done?yt(Ht.value):Promise.resolve(Ht.value).then(yr,Rr);Qt((oe=oe.apply(fe,ye)).next())});const he=new WeakMap;class O extends Error{}class K extends Error{}class j extends null{}const ve=["application/x-mpegURL","application/vnd.apple.mpegurl","audio/mpegurl"],at=globalThis.WeakRef?class extends Set{add(fe){super.add(new WeakRef(fe))}forEach(fe){super.forEach(ye=>{const oe=ye.deref();oe&&fe(oe)})}}:Set;function ze(fe){var ye,oe,yt;(oe=(ye=globalThis.chrome)==null?void 0:ye.cast)!=null&&oe.isAvailable?(yt=globalThis.cast)!=null&&yt.framework?fe():customElements.whenDefined("google-cast-button").then(fe):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(fe)}}function Et(){return globalThis.chrome}function Xe(){var fe;const ye="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if((fe=globalThis.chrome)!=null&&fe.cast||document.querySelector(`script[src="${ye}"]`))return;const oe=document.createElement("script");oe.src=ye,document.head.append(oe)}function Ye(){var fe,ye;return(ye=(fe=globalThis.cast)==null?void 0:fe.framework)==null?void 0:ye.CastContext.getInstance()}function Ze(){var fe;return(fe=Ye())==null?void 0:fe.getCurrentSession()}function st(){var fe;return(fe=Ze())==null?void 0:fe.getSessionObj().media[0]}function ht(fe){return new Promise((ye,oe)=>{st().editTracksInfo(fe,ye,oe)})}function Je(fe){return new Promise((ye,oe)=>{st().getStatus(fe,ye,oe)})}function ae(fe){return Ye().setOptions(de(de({},dt()),fe))}function dt(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}function ke(fe){if(!fe)return;const ye=/\.([a-zA-Z0-9]+)(?:\?.*)?$/,oe=fe.match(ye);return oe?oe[1]:null}function mt(fe){const ye=fe.split(`
`),oe=[];for(let yt=0;yt<ye.length;yt++)if(ye[yt].trim().startsWith("#EXT-X-STREAM-INF")){const yr=ye[yt+1]?ye[yt+1].trim():"";yr&&!yr.startsWith("#")&&oe.push(yr)}return oe}function At(fe){return fe.split(`
`).find(yt=>!yt.trim().startsWith("#")&&yt.trim()!=="")}function Ge(fe){return Pe(this,null,function*(){try{const oe=(yield fetch(fe,{method:"HEAD"})).headers.get("Content-Type");return ve.some(yt=>oe===yt)}catch(ye){return console.error("Error while trying to get the Content-Type of the manifest",ye),!1}})}function De(fe){return Pe(this,null,function*(){try{const ye=yield(yield fetch(fe)).text();let oe=ye;const yt=mt(ye);if(yt.length>0){const Rr=new URL(yt[0],fe).toString();oe=yield(yield fetch(Rr)).text()}const qt=At(oe);return ke(qt)}catch(ye){console.error("Error while trying to parse the manifest playlist",ye);return}})}var Lt=fe=>{throw TypeError(fe)},ut=(fe,ye,oe)=>ye.has(fe)||Lt("Cannot "+oe),Q=(fe,ye,oe)=>(ut(fe,ye,"read from private field"),oe?oe.call(fe):ye.get(fe)),_=(fe,ye,oe)=>ye.has(fe)?Lt("Cannot add the same private member more than once"):ye instanceof WeakSet?ye.add(fe):ye.set(fe,oe),pe=(fe,ye,oe,yt)=>(ut(fe,ye,"write to private field"),yt?yt.call(fe,oe):ye.set(fe,oe),oe),Ie=(fe,ye,oe)=>(ut(fe,ye,"access private method"),oe),ct=(fe,ye,oe)=>new Promise((yt,qt)=>{var yr=Ht=>{try{Qt(oe.next(Ht))}catch(Ci){qt(Ci)}},Rr=Ht=>{try{Qt(oe.throw(Ht))}catch(Ci){qt(Ci)}},Qt=Ht=>Ht.done?yt(Ht.value):Promise.resolve(Ht.value).then(yr,Rr);Qt((oe=oe.apply(fe,ye)).next())}),_e,Te,we,xt,Ir,V,jt,Br,Rt,U,Be,je,Jt,Nt,Ut,Lr,zr;const Wt=new at,qe=new WeakSet;let Y;ze(()=>{var fe,ye,oe,yt;if(!((ye=(fe=globalThis.chrome)==null?void 0:fe.cast)!=null&&ye.isAvailable)){console.debug("chrome.cast.isAvailable",(yt=(oe=globalThis.chrome)==null?void 0:oe.cast)==null?void 0:yt.isAvailable);return}Y||(Y=cast.framework,Ye().addEventListener(Y.CastContextEventType.CAST_STATE_CHANGED,qt=>{Wt.forEach(yr=>{var Rr,Qt;return(Qt=(Rr=he.get(yr)).onCastStateChanged)==null?void 0:Qt.call(Rr,qt)})}),Ye().addEventListener(Y.CastContextEventType.SESSION_STATE_CHANGED,qt=>{Wt.forEach(yr=>{var Rr,Qt;return(Qt=(Rr=he.get(yr)).onSessionStateChanged)==null?void 0:Qt.call(Rr,qt)})}),Wt.forEach(qt=>{var yr,Rr;return(Rr=(yr=he.get(qt)).init)==null?void 0:Rr.call(yr)}))});let te=0;class me extends EventTarget{constructor(ye){super(),_(this,Rt),_(this,_e),_(this,Te),_(this,we),_(this,xt),_(this,Ir,"disconnected"),_(this,V,!1),_(this,jt,new Set),_(this,Br,new WeakMap),pe(this,_e,ye),Wt.add(this),he.set(this,{init:()=>Ie(this,Rt,Ut).call(this),onCastStateChanged:()=>Ie(this,Rt,Jt).call(this),onSessionStateChanged:()=>Ie(this,Rt,Nt).call(this),getCastPlayer:()=>Q(this,Rt,U)}),Ie(this,Rt,Ut).call(this)}get state(){return Q(this,Ir)}watchAvailability(ye){return ct(this,null,function*(){if(Q(this,_e).disableRemotePlayback)throw new O("disableRemotePlayback attribute is present.");return Q(this,Br).set(ye,++te),Q(this,jt).add(ye),queueMicrotask(()=>ye(Ie(this,Rt,je).call(this))),te})}cancelWatchAvailability(ye){return ct(this,null,function*(){if(Q(this,_e).disableRemotePlayback)throw new O("disableRemotePlayback attribute is present.");ye?Q(this,jt).delete(ye):Q(this,jt).clear()})}prompt(){return ct(this,null,function*(){var ye,oe,yt,qt;if(Q(this,_e).disableRemotePlayback)throw new O("disableRemotePlayback attribute is present.");if(!((oe=(ye=globalThis.chrome)==null?void 0:ye.cast)!=null&&oe.isAvailable))throw new K("The RemotePlayback API is disabled on this platform.");const yr=qe.has(Q(this,_e));qe.add(Q(this,_e)),ae(Q(this,_e).castOptions),Object.entries(Q(this,xt)).forEach(([Rr,Qt])=>{Q(this,we).controller.addEventListener(Rr,Qt)});try{yield Ye().requestSession()}catch(Rr){if(yr||qe.delete(Q(this,_e)),Rr==="cancel")return;throw new Error(Rr)}(qt=(yt=he.get(Q(this,_e)))==null?void 0:yt.loadOnPrompt)==null||qt.call(yt)})}}_e=new WeakMap,Te=new WeakMap,we=new WeakMap,xt=new WeakMap,Ir=new WeakMap,V=new WeakMap,jt=new WeakMap,Br=new WeakMap,Rt=new WeakSet,U=function(){if(qe.has(Q(this,_e)))return Q(this,we)},Be=function(){qe.has(Q(this,_e))&&(Object.entries(Q(this,xt)).forEach(([fe,ye])=>{Q(this,we).controller.removeEventListener(fe,ye)}),qe.delete(Q(this,_e)),Q(this,_e).muted=Q(this,we).isMuted,Q(this,_e).currentTime=Q(this,we).savedPlayerState.currentTime,Q(this,we).savedPlayerState.isPaused===!1&&Q(this,_e).play())},je=function(){var fe;const ye=(fe=Ye())==null?void 0:fe.getCastState();return ye&&ye!=="NO_DEVICES_AVAILABLE"},Jt=function(){const fe=Ye().getCastState();if(qe.has(Q(this,_e))&&fe==="CONNECTING"&&(pe(this,Ir,"connecting"),this.dispatchEvent(new Event("connecting"))),!Q(this,V)&&(fe!=null&&fe.includes("CONNECT"))){pe(this,V,!0);for(let ye of Q(this,jt))ye(!0)}else if(Q(this,V)&&(!fe||fe==="NO_DEVICES_AVAILABLE")){pe(this,V,!1);for(let ye of Q(this,jt))ye(!1)}},Nt=function(){return ct(this,null,function*(){var fe;const{SESSION_RESUMED:ye}=Y.SessionState;if(Ye().getSessionState()===ye&&Q(this,_e).castSrc===((fe=st())==null?void 0:fe.media.contentId)){qe.add(Q(this,_e)),Object.entries(Q(this,xt)).forEach(([oe,yt])=>{Q(this,we).controller.addEventListener(oe,yt)});try{yield Je(new chrome.cast.media.GetStatusRequest)}catch(oe){console.error(oe)}Q(this,xt)[Y.RemotePlayerEventType.IS_PAUSED_CHANGED](),Q(this,xt)[Y.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}})},Ut=function(){!Y||Q(this,Te)||(pe(this,Te,!0),ae(Q(this,_e).castOptions),Q(this,_e).textTracks.addEventListener("change",()=>Ie(this,Rt,zr).call(this)),Ie(this,Rt,Jt).call(this),pe(this,we,new Y.RemotePlayer),new Y.RemotePlayerController(Q(this,we)),pe(this,xt,{[Y.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:fe})=>{fe===!0?(pe(this,Ir,"connected"),this.dispatchEvent(new Event("connect"))):(Ie(this,Rt,Be).call(this),pe(this,Ir,"disconnected"),this.dispatchEvent(new Event("disconnect")))},[Y.RemotePlayerEventType.DURATION_CHANGED]:()=>{Q(this,_e).dispatchEvent(new Event("durationchange"))},[Y.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{Q(this,_e).dispatchEvent(new Event("volumechange"))},[Y.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{Q(this,_e).dispatchEvent(new Event("volumechange"))},[Y.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{var fe;(fe=Q(this,Rt,U))!=null&&fe.isMediaLoaded&&Q(this,_e).dispatchEvent(new Event("timeupdate"))},[Y.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{Q(this,_e).dispatchEvent(new Event("resize"))},[Y.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{Q(this,_e).dispatchEvent(new Event(this.paused?"pause":"play"))},[Y.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var fe,ye;((fe=Q(this,Rt,U))==null?void 0:fe.playerState)!==chrome.cast.media.PlayerState.PAUSED&&Q(this,_e).dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(ye=Q(this,Rt,U))==null?void 0:ye.playerState]))},[Y.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:()=>ct(this,null,function*(){var fe;(fe=Q(this,Rt,U))!=null&&fe.isMediaLoaded&&(yield Promise.resolve(),Ie(this,Rt,Lr).call(this))})}))},Lr=function(){Ie(this,Rt,zr).call(this)},zr=function(){return ct(this,null,function*(){var fe,ye,oe,yt,qt;if(!Q(this,Rt,U))return;const Rr=((ye=(fe=Q(this,we).mediaInfo)==null?void 0:fe.tracks)!=null?ye:[]).filter(({type:Hr})=>Hr===chrome.cast.media.TrackType.TEXT),Qt=[...Q(this,_e).textTracks].filter(({kind:Hr})=>Hr==="subtitles"||Hr==="captions"),Ht=Rr.map(({language:Hr,name:pi,trackId:$r})=>{var Jr;const{mode:Yr}=(Jr=Qt.find(Pa=>Pa.language===Hr&&Pa.label===pi))!=null?Jr:{};return Yr?{mode:Yr,trackId:$r}:!1}).filter(Boolean),Ft=Ht.filter(({mode:Hr})=>Hr!=="showing").map(({trackId:Hr})=>Hr),ie=Ht.find(({mode:Hr})=>Hr==="showing"),er=(qt=(yt=(oe=Ze())==null?void 0:oe.getSessionObj().media[0])==null?void 0:yt.activeTrackIds)!=null?qt:[];let Ai=er;if(er.length&&(Ai=Ai.filter(Hr=>!Ft.includes(Hr))),ie!=null&&ie.trackId&&(Ai=[...Ai,ie.trackId]),Ai=[...new Set(Ai)],!((Hr,pi)=>Hr.length===pi.length&&Hr.every($r=>pi.includes($r)))(er,Ai))try{const Hr=new chrome.cast.media.EditTracksInfoRequest(Ai);yield ht(Hr)}catch(Hr){console.error(Hr)}})};var it=Object.defineProperty,kt=Object.getPrototypeOf,Oe=Reflect.get,zt=fe=>{throw TypeError(fe)},Pt=(fe,ye,oe)=>ye in fe?it(fe,ye,{enumerable:!0,configurable:!0,writable:!0,value:oe}):fe[ye]=oe,Zt=(fe,ye,oe)=>Pt(fe,typeof ye!="symbol"?ye+"":ye,oe),Wr=(fe,ye,oe)=>ye.has(fe)||zt("Cannot "+oe),ft=(fe,ye,oe)=>(Wr(fe,ye,"read from private field"),oe?oe.call(fe):ye.get(fe)),Qr=(fe,ye,oe)=>ye.has(fe)?zt("Cannot add the same private member more than once"):ye instanceof WeakSet?ye.add(fe):ye.set(fe,oe),li=(fe,ye,oe,yt)=>(Wr(fe,ye,"write to private field"),yt?yt.call(fe,oe):ye.set(fe,oe),oe),ln=(fe,ye,oe)=>(Wr(fe,ye,"access private method"),oe),Ar=(fe,ye,oe)=>Oe(kt(fe),oe,ye),Yi=(fe,ye,oe)=>new Promise((yt,qt)=>{var yr=Ht=>{try{Qt(oe.next(Ht))}catch(Ci){qt(Ci)}},Rr=Ht=>{try{Qt(oe.throw(Ht))}catch(Ci){qt(Ci)}},Qt=Ht=>Ht.done?yt(Ht.value):Promise.resolve(Ht.value).then(yr,Rr);Qt((oe=oe.apply(fe,ye)).next())});const _i=fe=>{var ye,oe,yt,qt,yr,Rr,Qt,Ht,Ci;return oe=class extends fe{constructor(){super(...arguments),Qr(this,Qt),Qr(this,yt,{paused:!1}),Qr(this,qt,dt()),Qr(this,yr),Qr(this,Rr)}get remote(){return ft(this,Rr)?ft(this,Rr):Et()?(this.disableRemotePlayback||Xe(),he.set(this,{loadOnPrompt:()=>ln(this,Qt,Ci).call(this)}),li(this,Rr,new me(this))):super.remote}attributeChangedCallback(Ft,ie,er){if(super.attributeChangedCallback(Ft,ie,er),Ft==="cast-receiver"&&er){ft(this,qt).receiverApplicationId=er;return}if(ft(this,Qt,Ht))switch(Ft){case"cast-stream-type":case"cast-src":this.load();break}}load(){return Yi(this,null,function*(){var Ft,ie;if(!ft(this,Qt,Ht))return Ar(oe.prototype,this,"load").call(this);const er=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType);er.customData=this.castCustomData;const Ai=[...this.querySelectorAll("track")].filter(({kind:$r,src:Jr})=>Jr&&($r==="subtitles"||$r==="captions")),Bi=[];let Hr=0;if(Ai.length&&(er.tracks=Ai.map($r=>{const Jr=++Hr;Bi.length===0&&$r.track.mode==="showing"&&Bi.push(Jr);const Yr=new chrome.cast.media.Track(Jr,chrome.cast.media.TrackType.TEXT);return Yr.trackContentId=$r.src,Yr.trackContentType="text/vtt",Yr.subtype=$r.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,Yr.name=$r.label,Yr.language=$r.srclang,Yr})),this.castStreamType==="live"?er.streamType=chrome.cast.media.StreamType.LIVE:er.streamType=chrome.cast.media.StreamType.BUFFERED,er.metadata=new chrome.cast.media.GenericMediaMetadata,er.metadata.title=this.title,er.metadata.images=[{url:this.poster}],Ge(this.castSrc)){const $r=yield De(this.castSrc);($r==null?void 0:$r.includes("m4s"))||($r==null?void 0:$r.includes("mp4"))?(er.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.FMP4,er.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.FMP4):$r!=null&&$r.includes("ts")&&(er.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.TS,er.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.TS)}const pi=new chrome.cast.media.LoadRequest(er);pi.currentTime=(Ft=Ar(oe.prototype,this,"currentTime"))!=null?Ft:0,pi.autoplay=!ft(this,yt).paused,pi.activeTrackIds=Bi,yield(ie=Ze())==null?void 0:ie.loadMedia(pi),this.dispatchEvent(new Event("volumechange"))})}play(){var Ft;if(ft(this,Qt,Ht)){ft(this,Qt,Ht).isPaused&&((Ft=ft(this,Qt,Ht).controller)==null||Ft.playOrPause());return}return super.play()}pause(){var Ft;if(ft(this,Qt,Ht)){ft(this,Qt,Ht).isPaused||(Ft=ft(this,Qt,Ht).controller)==null||Ft.playOrPause();return}super.pause()}get castOptions(){return ft(this,qt)}get castReceiver(){var Ft;return(Ft=this.getAttribute("cast-receiver"))!=null?Ft:void 0}set castReceiver(Ft){this.castReceiver!=Ft&&this.setAttribute("cast-receiver",`${Ft}`)}get castSrc(){var Ft,ie,er;return(er=(ie=this.getAttribute("cast-src"))!=null?ie:(Ft=this.querySelector("source"))==null?void 0:Ft.src)!=null?er:this.currentSrc}set castSrc(Ft){this.castSrc!=Ft&&this.setAttribute("cast-src",`${Ft}`)}get castContentType(){var Ft;return(Ft=this.getAttribute("cast-content-type"))!=null?Ft:void 0}set castContentType(Ft){this.setAttribute("cast-content-type",`${Ft}`)}get castStreamType(){var Ft,ie;return(ie=(Ft=this.getAttribute("cast-stream-type"))!=null?Ft:this.streamType)!=null?ie:void 0}set castStreamType(Ft){this.setAttribute("cast-stream-type",`${Ft}`)}get castCustomData(){return ft(this,yr)}set castCustomData(Ft){const ie=typeof Ft;if(!["object","undefined"].includes(ie)){console.error(`castCustomData must be nullish or an object but value was of type ${ie}`);return}li(this,yr,Ft)}get readyState(){if(ft(this,Qt,Ht))switch(ft(this,Qt,Ht).playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return ft(this,Qt,Ht)?ft(this,Qt,Ht).isPaused:super.paused}get muted(){var Ft;return ft(this,Qt,Ht)?(Ft=ft(this,Qt,Ht))==null?void 0:Ft.isMuted:super.muted}set muted(Ft){var ie;if(ft(this,Qt,Ht)){(Ft&&!ft(this,Qt,Ht).isMuted||!Ft&&ft(this,Qt,Ht).isMuted)&&((ie=ft(this,Qt,Ht).controller)==null||ie.muteOrUnmute());return}super.muted=Ft}get volume(){var Ft,ie;return ft(this,Qt,Ht)?(ie=(Ft=ft(this,Qt,Ht))==null?void 0:Ft.volumeLevel)!=null?ie:1:super.volume}set volume(Ft){var ie;if(ft(this,Qt,Ht)){ft(this,Qt,Ht).volumeLevel=+Ft,(ie=ft(this,Qt,Ht).controller)==null||ie.setVolumeLevel();return}super.volume=Ft}get duration(){var Ft,ie,er;return ft(this,Qt,Ht)&&((Ft=ft(this,Qt,Ht))!=null&&Ft.isMediaLoaded)?(er=(ie=ft(this,Qt,Ht))==null?void 0:ie.duration)!=null?er:NaN:super.duration}get currentTime(){var Ft,ie,er;return ft(this,Qt,Ht)&&((Ft=ft(this,Qt,Ht))!=null&&Ft.isMediaLoaded)?(er=(ie=ft(this,Qt,Ht))==null?void 0:ie.currentTime)!=null?er:0:super.currentTime}set currentTime(Ft){var ie;if(ft(this,Qt,Ht)){ft(this,Qt,Ht).currentTime=Ft,(ie=ft(this,Qt,Ht).controller)==null||ie.seek();return}super.currentTime=Ft}},yt=new WeakMap,qt=new WeakMap,yr=new WeakMap,Rr=new WeakMap,Qt=new WeakSet,Ht=function(){var Ft,ie;return(ie=(Ft=he.get(this.remote))==null?void 0:Ft.getCastPlayer)==null?void 0:ie.call(Ft)},Ci=function(){return Yi(this,null,function*(){ft(this,yt).paused=Ar(oe.prototype,this,"paused"),Ar(oe.prototype,this,"pause").call(this),this.muted=Ar(oe.prototype,this,"muted");try{yield this.load()}catch(Ft){console.error(Ft)}})},Zt(oe,"observedAttributes",[...(ye=fe.observedAttributes)!=null?ye:[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"]),oe},br=_i},98550($e,Me,Ee){"use strict";Ee.r(Me),Ee.d(Me,{Attributes:()=>at,CustomAudioElement:()=>Je,CustomMediaMixin:()=>Xe,CustomVideoElement:()=>ht,Events:()=>ve});var He=Object.defineProperty,Le=ae=>{throw TypeError(ae)},Ne=(ae,dt,ke)=>dt in ae?He(ae,dt,{enumerable:!0,configurable:!0,writable:!0,value:ke}):ae[dt]=ke,H=(ae,dt,ke)=>Ne(ae,typeof dt!="symbol"?dt+"":dt,ke),Qe=(ae,dt,ke)=>dt.has(ae)||Le("Cannot "+ke),de=(ae,dt,ke)=>(Qe(ae,dt,"read from private field"),ke?ke.call(ae):dt.get(ae)),Pe=(ae,dt,ke)=>dt.has(ae)?Le("Cannot add the same private member more than once"):dt instanceof WeakSet?dt.add(ae):dt.set(ae,ke),he=(ae,dt,ke,mt)=>(Qe(ae,dt,"write to private field"),mt?mt.call(ae,ke):dt.set(ae,ke),ke),O=(ae,dt,ke)=>(Qe(ae,dt,"access private method"),ke),K,j;const ve=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],at=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function ze(ae){return`
    <style>
      :host {
        display: inline-flex;
        line-height: 0;
        flex-direction: column;
        justify-content: end;
      }

      audio {
        width: 100%;
      }
    </style>
    <slot name="media">
      <audio${Ze(ae)}></audio>
    </slot>
    <slot></slot>
  `}function Et(ae){return`
    <style>
      :host {
        display: inline-block;
        line-height: 0;
      }

      video {
        max-width: 100%;
        max-height: 100%;
        min-width: 100%;
        min-height: 100%;
        object-fit: var(--media-object-fit, contain);
        object-position: var(--media-object-position, 50% 50%);
      }

      video::-webkit-media-text-track-container {
        transform: var(--media-webkit-text-track-transform);
        transition: var(--media-webkit-text-track-transition);
      }
    </style>
    <slot name="media">
      <video${Ze(ae)}></video>
    </slot>
    <slot></slot>
  `}function Xe(ae,{tag:dt,is:ke}){var mt,At,Ge,De,Lt,ut,Q,_,pe,Ie,ct,_e,Te,we,xt,Ir,V;const jt=(At=(mt=globalThis.document)==null?void 0:mt.createElement)==null?void 0:At.call(mt,dt,{is:ke}),Br=jt?Ye(jt):[];return Ge=class extends ae{constructor(){super(...arguments),Pe(this,ct),Pe(this,Q,!1),Pe(this,_,null),Pe(this,pe,new Map),Pe(this,Ie),H(this,"get"),H(this,"set"),H(this,"call")}static get observedAttributes(){var Rt,U,Be;return O(Rt=Ge,Lt,ut).call(Rt),[...(Be=(U=jt==null?void 0:jt.constructor)==null?void 0:U.observedAttributes)!=null?Be:[],...at]}get nativeEl(){var Rt,U,Be,je,Jt;return O(this,ct,_e).call(this),(Jt=(je=(U=(Rt=de(this,_))!=null?Rt:this.querySelector(":scope > [slot=media]"))!=null?U:this.querySelector(dt))!=null?je:(Be=this.shadowRoot)==null?void 0:Be.querySelector(dt))!=null?Jt:null}set nativeEl(Rt){he(this,_,Rt)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(Rt){this.toggleAttribute("muted",Rt)}get src(){return this.getAttribute("src")}set src(Rt){this.setAttribute("src",`${Rt}`)}get preload(){var Rt,U;return(U=this.getAttribute("preload"))!=null?U:(Rt=this.nativeEl)==null?void 0:Rt.preload}set preload(Rt){this.setAttribute("preload",`${Rt}`)}init(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const Rt=st(this.attributes);ke&&(Rt.is=ke),dt&&(Rt.part=dt),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(Rt)}this.nativeEl.muted=this.hasAttribute("muted");for(const Rt of Br)O(this,ct,Ir).call(this,Rt);he(this,Ie,new MutationObserver(O(this,ct,we).bind(this))),this.shadowRoot.addEventListener("slotchange",()=>O(this,ct,Te).call(this)),O(this,ct,Te).call(this);for(const Rt of this.constructor.Events)this.shadowRoot.addEventListener(Rt,this,!0)}handleEvent(Rt){Rt.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(Rt.type,{detail:Rt.detail}))}attributeChangedCallback(Rt,U,Be){O(this,ct,_e).call(this),O(this,ct,V).call(this,Rt,U,Be)}connectedCallback(){O(this,ct,_e).call(this)}},De=new WeakMap,Lt=new WeakSet,ut=function(){if(de(this,De))return;he(this,De,!0);const Rt=new Set(this.observedAttributes);Rt.delete("muted");for(const U of Br)if(!(U in this.prototype))if(typeof jt[U]=="function")this.prototype[U]=function(...Be){return O(this,ct,_e).call(this),(()=>{var Jt;if(this.call)return this.call(U,...Be);const Nt=(Jt=this.nativeEl)==null?void 0:Jt[U];return Nt==null?void 0:Nt.apply(this.nativeEl,Be)})()};else{const Be={get(){var je,Jt,Nt;O(this,ct,_e).call(this);const Ut=U.toLowerCase();if(Rt.has(Ut)){const Lr=this.getAttribute(Ut);return Lr===null?!1:Lr===""?!0:Lr}return(Nt=(je=this.get)==null?void 0:je.call(this,U))!=null?Nt:(Jt=this.nativeEl)==null?void 0:Jt[U]}};U!==U.toUpperCase()&&(Be.set=function(je){O(this,ct,_e).call(this);const Jt=U.toLowerCase();if(Rt.has(Jt)){je===!0||je===!1||je==null?this.toggleAttribute(Jt,!!je):this.setAttribute(Jt,je);return}if(this.set){this.set(U,je);return}this.nativeEl&&(this.nativeEl[U]=je)}),Object.defineProperty(this.prototype,U,Be)}},Q=new WeakMap,_=new WeakMap,pe=new WeakMap,Ie=new WeakMap,ct=new WeakSet,_e=function(){de(this,Q)||(he(this,Q,!0),this.init())},Te=function(){var Rt;const U=new Map(de(this,pe)),Be=(Rt=this.shadowRoot)==null?void 0:Rt.querySelector("slot:not([name])");(Be==null?void 0:Be.assignedElements({flatten:!0}).filter(Jt=>["track","source"].includes(Jt.localName))).forEach(Jt=>{var Nt,Ut;U.delete(Jt);let Lr=de(this,pe).get(Jt);Lr||(Lr=Jt.cloneNode(),de(this,pe).set(Jt,Lr),(Nt=de(this,Ie))==null||Nt.observe(Jt,{attributes:!0})),(Ut=this.nativeEl)==null||Ut.append(Lr),O(this,ct,xt).call(this,Lr)}),U.forEach((Jt,Nt)=>{Jt.remove(),de(this,pe).delete(Nt)})},we=function(Rt){var U;for(const Be of Rt)if(Be.type==="attributes"){const{target:je,attributeName:Jt}=Be,Nt=de(this,pe).get(je);Nt&&Jt&&(Nt.setAttribute(Jt,(U=je.getAttribute(Jt))!=null?U:""),O(this,ct,xt).call(this,Nt))}},xt=function(Rt){Rt&&Rt.localName==="track"&&Rt.default&&(Rt.kind==="chapters"||Rt.kind==="metadata")&&Rt.track.mode==="disabled"&&(Rt.track.mode="hidden")},Ir=function(Rt){if(Object.prototype.hasOwnProperty.call(this,Rt)){const U=this[Rt];delete this[Rt],this[Rt]=U}},V=function(Rt,U,Be){var je,Jt,Nt;["id","class"].includes(Rt)||!Ge.observedAttributes.includes(Rt)&&this.constructor.observedAttributes.includes(Rt)||(Be===null?(je=this.nativeEl)==null||je.removeAttribute(Rt):((Jt=this.nativeEl)==null?void 0:Jt.getAttribute(Rt))!==Be&&((Nt=this.nativeEl)==null||Nt.setAttribute(Rt,Be)))},Pe(Ge,Lt),H(Ge,"getTemplateHTML",dt.endsWith("audio")?ze:Et),H(Ge,"shadowRootOptions",{mode:"open"}),H(Ge,"Events",ve),Pe(Ge,De,!1),Ge}function Ye(ae){const dt=[];for(let ke=Object.getPrototypeOf(ae);ke&&ke!==HTMLElement.prototype;ke=Object.getPrototypeOf(ke)){const mt=Object.getOwnPropertyNames(ke);dt.push(...mt)}return dt}function Ze(ae){let dt="";for(const ke in ae){if(!at.includes(ke))continue;const mt=ae[ke];mt===""?dt+=` ${ke}`:dt+=` ${ke}="${mt}"`}return dt}function st(ae){const dt={};for(const ke of ae)dt[ke.name]=ke.value;return dt}const ht=Xe((K=globalThis.HTMLElement)!=null?K:class{},{tag:"video"}),Je=Xe((j=globalThis.HTMLElement)!=null?j:class{},{tag:"audio"})},18198($e,Me,Ee){"use strict";Ee.r(Me),Ee.d(Me,{AudioRendition:()=>Ci,AudioRenditionList:()=>br,AudioTrack:()=>Li,AudioTrackList:()=>zi,MediaTracksMixin:()=>di,RenditionEvent:()=>mt,TrackEvent:()=>H,VideoRendition:()=>Jt,VideoRenditionList:()=>we,VideoTrack:()=>kt,VideoTrackList:()=>Je});var He=Object.defineProperty,Le=(X,W,se)=>W in X?He(X,W,{enumerable:!0,configurable:!0,writable:!0,value:se}):X[W]=se,Ne=(X,W,se)=>Le(X,typeof W!="symbol"?W+"":W,se);class H extends Event{constructor(W,se){super(W),Ne(this,"track"),this.track=se.track}}const Qe=new WeakMap;function de(X){var W;return(W=Qe.get(X))!=null?W:Pe(X,{})}function Pe(X,W){let se=Qe.get(X);return se||Qe.set(X,se={}),Object.assign(se,W)}var he=X=>{throw TypeError(X)},O=(X,W,se)=>W.has(X)||he("Cannot "+se),K=(X,W,se)=>(O(X,W,"read from private field"),se?se.call(X):W.get(X)),j=(X,W,se)=>W.has(X)?he("Cannot add the same private member more than once"):W instanceof WeakSet?W.add(X):W.set(X,se),ve=(X,W,se,Vt)=>(O(X,W,"write to private field"),Vt?Vt.call(X,se):W.set(X,se),se),at,ze,Et,Xe,Ye;function Ze(X,W){const se=X.videoTracks;de(W).media=X,de(W).renditionSet||(de(W).renditionSet=new Set);const Vt=de(se).trackSet;Vt.add(W);const Cr=Vt.size-1;Cr in Je.prototype||Object.defineProperty(Je.prototype,Cr,{get(){return[...de(this).trackSet][Cr]}}),queueMicrotask(()=>{se.dispatchEvent(new H("addtrack",{track:W}))})}function st(X){var W;const se=(W=de(X).media)==null?void 0:W.videoTracks;if(!se)return;de(se).trackSet.delete(X),queueMicrotask(()=>{se.dispatchEvent(new H("removetrack",{track:X}))})}function ht(X){var W;const se=(W=de(X).media.videoTracks)!=null?W:[];let Vt=!1;for(const Cr of se)Cr!==X&&(Cr.selected=!1,Vt=!0);if(Vt){if(de(se).changeRequested)return;de(se).changeRequested=!0,queueMicrotask(()=>{delete de(se).changeRequested,se.dispatchEvent(new Event("change"))})}}class Je extends EventTarget{constructor(){super(),j(this,Xe),j(this,at),j(this,ze),j(this,Et),de(this).trackSet=new Set}[Symbol.iterator](){return K(this,Xe,Ye).values()}get length(){return K(this,Xe,Ye).size}getTrackById(W){var se;return(se=[...K(this,Xe,Ye)].find(Vt=>Vt.id===W))!=null?se:null}get selectedIndex(){return[...K(this,Xe,Ye)].findIndex(W=>W.selected)}get onaddtrack(){return K(this,at)}set onaddtrack(W){K(this,at)&&(this.removeEventListener("addtrack",K(this,at)),ve(this,at,void 0)),typeof W=="function"&&(ve(this,at,W),this.addEventListener("addtrack",W))}get onremovetrack(){return K(this,ze)}set onremovetrack(W){K(this,ze)&&(this.removeEventListener("removetrack",K(this,ze)),ve(this,ze,void 0)),typeof W=="function"&&(ve(this,ze,W),this.addEventListener("removetrack",W))}get onchange(){return K(this,Et)}set onchange(W){K(this,Et)&&(this.removeEventListener("change",K(this,Et)),ve(this,Et,void 0)),typeof W=="function"&&(ve(this,Et,W),this.addEventListener("change",W))}}at=new WeakMap,ze=new WeakMap,Et=new WeakMap,Xe=new WeakSet,Ye=function(){return de(this).trackSet};var ae=Object.defineProperty,dt=(X,W,se)=>W in X?ae(X,W,{enumerable:!0,configurable:!0,writable:!0,value:se}):X[W]=se,ke=(X,W,se)=>dt(X,typeof W!="symbol"?W+"":W,se);class mt extends Event{constructor(W,se){super(W),ke(this,"rendition"),this.rendition=se.rendition}}var At=X=>{throw TypeError(X)},Ge=(X,W,se)=>W.has(X)||At("Cannot "+se),De=(X,W,se)=>(Ge(X,W,"read from private field"),se?se.call(X):W.get(X)),Lt=(X,W,se)=>W.has(X)?At("Cannot add the same private member more than once"):W instanceof WeakSet?W.add(X):W.set(X,se),ut=(X,W,se,Vt)=>(Ge(X,W,"write to private field"),Vt?Vt.call(X,se):W.set(X,se),se),Q,_,pe;function Ie(X,W){const se=de(X).media.videoRenditions;de(W).media=de(X).media,de(W).track=X;const Vt=de(X).renditionSet;Vt.add(W);const Cr=Vt.size-1;Cr in we.prototype||Object.defineProperty(we.prototype,Cr,{get(){return Te(this)[Cr]}}),queueMicrotask(()=>{X.selected&&se.dispatchEvent(new mt("addrendition",{rendition:W}))})}function ct(X){const W=de(X).media.videoRenditions,se=de(X).track;de(se).renditionSet.delete(X),queueMicrotask(()=>{de(X).track.selected&&W.dispatchEvent(new mt("removerendition",{rendition:X}))})}function _e(X){const W=de(X).media.videoRenditions;!W||de(W).changeRequested||(de(W).changeRequested=!0,queueMicrotask(()=>{delete de(W).changeRequested,de(X).track.selected&&W.dispatchEvent(new Event("change"))}))}function Te(X){return[...de(X).media.videoTracks].filter(se=>se.selected).flatMap(se=>[...de(se).renditionSet])}class we extends EventTarget{constructor(){super(...arguments),Lt(this,Q),Lt(this,_),Lt(this,pe)}[Symbol.iterator](){return Te(this).values()}get length(){return Te(this).length}getRenditionById(W){var se;return(se=Te(this).find(Vt=>`${Vt.id}`==`${W}`))!=null?se:null}get selectedIndex(){return Te(this).findIndex(W=>W.selected)}set selectedIndex(W){for(const[se,Vt]of Te(this).entries())Vt.selected=se===W}get onaddrendition(){return De(this,Q)}set onaddrendition(W){De(this,Q)&&(this.removeEventListener("addrendition",De(this,Q)),ut(this,Q,void 0)),typeof W=="function"&&(ut(this,Q,W),this.addEventListener("addrendition",W))}get onremoverendition(){return De(this,_)}set onremoverendition(W){De(this,_)&&(this.removeEventListener("removerendition",De(this,_)),ut(this,_,void 0)),typeof W=="function"&&(ut(this,_,W),this.addEventListener("removerendition",W))}get onchange(){return De(this,pe)}set onchange(W){De(this,pe)&&(this.removeEventListener("change",De(this,pe)),ut(this,pe,void 0)),typeof W=="function"&&(ut(this,pe,W),this.addEventListener("change",W))}}Q=new WeakMap,_=new WeakMap,pe=new WeakMap;var xt=Object.defineProperty,Ir=X=>{throw TypeError(X)},V=(X,W,se)=>W in X?xt(X,W,{enumerable:!0,configurable:!0,writable:!0,value:se}):X[W]=se,jt=(X,W,se)=>V(X,typeof W!="symbol"?W+"":W,se),Br=(X,W,se)=>W.has(X)||Ir("Cannot "+se),Rt=(X,W,se)=>(Br(X,W,"read from private field"),se?se.call(X):W.get(X)),U=(X,W,se)=>W.has(X)?Ir("Cannot add the same private member more than once"):W instanceof WeakSet?W.add(X):W.set(X,se),Be=(X,W,se,Vt)=>(Br(X,W,"write to private field"),Vt?Vt.call(X,se):W.set(X,se),se),je;class Jt{constructor(){jt(this,"src"),jt(this,"id"),jt(this,"width"),jt(this,"height"),jt(this,"bitrate"),jt(this,"frameRate"),jt(this,"codec"),U(this,je,!1)}get selected(){return Rt(this,je)}set selected(W){Rt(this,je)!==W&&(Be(this,je,W),_e(this))}}je=new WeakMap;var Nt=Object.defineProperty,Ut=X=>{throw TypeError(X)},Lr=(X,W,se)=>W in X?Nt(X,W,{enumerable:!0,configurable:!0,writable:!0,value:se}):X[W]=se,zr=(X,W,se)=>Lr(X,typeof W!="symbol"?W+"":W,se),Wt=(X,W,se)=>W.has(X)||Ut("Cannot "+se),qe=(X,W,se)=>(Wt(X,W,"read from private field"),se?se.call(X):W.get(X)),Y=(X,W,se)=>W.has(X)?Ut("Cannot add the same private member more than once"):W instanceof WeakSet?W.add(X):W.set(X,se),te=(X,W,se,Vt)=>(Wt(X,W,"write to private field"),Vt?Vt.call(X,se):W.set(X,se),se),me;const it={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"};class kt{constructor(){zr(this,"id"),zr(this,"kind"),zr(this,"label",""),zr(this,"language",""),zr(this,"sourceBuffer"),Y(this,me,!1)}addRendition(W,se,Vt,Cr,gi,ei){const Xi=new Jt;return Xi.src=W,Xi.width=se,Xi.height=Vt,Xi.frameRate=ei,Xi.bitrate=gi,Xi.codec=Cr,Ie(this,Xi),Xi}removeRendition(W){ct(W)}get selected(){return qe(this,me)}set selected(W){qe(this,me)!==W&&(te(this,me,W),W===!0&&ht(this))}}me=new WeakMap;var Oe=X=>{throw TypeError(X)},zt=(X,W,se)=>W.has(X)||Oe("Cannot "+se),Pt=(X,W,se)=>(zt(X,W,"read from private field"),se?se.call(X):W.get(X)),Zt=(X,W,se)=>W.has(X)?Oe("Cannot add the same private member more than once"):W instanceof WeakSet?W.add(X):W.set(X,se),Wr=(X,W,se,Vt)=>(zt(X,W,"write to private field"),Vt?Vt.call(X,se):W.set(X,se),se),ft,Qr,li;function ln(X,W){const se=de(X).media.audioRenditions;de(W).media=de(X).media,de(W).track=X;const Vt=de(X).renditionSet;Vt.add(W);const Cr=Vt.size-1;Cr in br.prototype||Object.defineProperty(br.prototype,Cr,{get(){return _i(this)[Cr]}}),queueMicrotask(()=>{X.enabled&&se.dispatchEvent(new mt("addrendition",{rendition:W}))})}function Ar(X){const W=de(X).media.audioRenditions,se=de(X).track;de(se).renditionSet.delete(X),queueMicrotask(()=>{de(X).track.enabled&&W.dispatchEvent(new mt("removerendition",{rendition:X}))})}function Yi(X){const W=de(X).media.audioRenditions;!W||de(W).changeRequested||(de(W).changeRequested=!0,queueMicrotask(()=>{delete de(W).changeRequested,de(X).track.enabled&&W.dispatchEvent(new Event("change"))}))}function _i(X){return[...de(X).media.audioTracks].filter(se=>se.enabled).flatMap(se=>[...de(se).renditionSet])}class br extends EventTarget{constructor(){super(...arguments),Zt(this,ft),Zt(this,Qr),Zt(this,li)}[Symbol.iterator](){return _i(this).values()}get length(){return _i(this).length}getRenditionById(W){var se;return(se=_i(this).find(Vt=>`${Vt.id}`==`${W}`))!=null?se:null}get selectedIndex(){return _i(this).findIndex(W=>W.selected)}set selectedIndex(W){for(const[se,Vt]of _i(this).entries())Vt.selected=se===W}get onaddrendition(){return Pt(this,ft)}set onaddrendition(W){Pt(this,ft)&&(this.removeEventListener("addrendition",Pt(this,ft)),Wr(this,ft,void 0)),typeof W=="function"&&(Wr(this,ft,W),this.addEventListener("addrendition",W))}get onremoverendition(){return Pt(this,Qr)}set onremoverendition(W){Pt(this,Qr)&&(this.removeEventListener("removerendition",Pt(this,Qr)),Wr(this,Qr,void 0)),typeof W=="function"&&(Wr(this,Qr,W),this.addEventListener("removerendition",W))}get onchange(){return Pt(this,li)}set onchange(W){Pt(this,li)&&(this.removeEventListener("change",Pt(this,li)),Wr(this,li,void 0)),typeof W=="function"&&(Wr(this,li,W),this.addEventListener("change",W))}}ft=new WeakMap,Qr=new WeakMap,li=new WeakMap;var fe=Object.defineProperty,ye=X=>{throw TypeError(X)},oe=(X,W,se)=>W in X?fe(X,W,{enumerable:!0,configurable:!0,writable:!0,value:se}):X[W]=se,yt=(X,W,se)=>oe(X,typeof W!="symbol"?W+"":W,se),qt=(X,W,se)=>W.has(X)||ye("Cannot "+se),yr=(X,W,se)=>(qt(X,W,"read from private field"),se?se.call(X):W.get(X)),Rr=(X,W,se)=>W.has(X)?ye("Cannot add the same private member more than once"):W instanceof WeakSet?W.add(X):W.set(X,se),Qt=(X,W,se,Vt)=>(qt(X,W,"write to private field"),Vt?Vt.call(X,se):W.set(X,se),se),Ht;class Ci{constructor(){yt(this,"src"),yt(this,"id"),yt(this,"bitrate"),yt(this,"codec"),Rr(this,Ht,!1)}get selected(){return yr(this,Ht)}set selected(W){yr(this,Ht)!==W&&(Qt(this,Ht,W),Yi(this))}}Ht=new WeakMap;var Ft=X=>{throw TypeError(X)},ie=(X,W,se)=>W.has(X)||Ft("Cannot "+se),er=(X,W,se)=>(ie(X,W,"read from private field"),se?se.call(X):W.get(X)),Ai=(X,W,se)=>W.has(X)?Ft("Cannot add the same private member more than once"):W instanceof WeakSet?W.add(X):W.set(X,se),Bi=(X,W,se,Vt)=>(ie(X,W,"write to private field"),Vt?Vt.call(X,se):W.set(X,se),se),Hr,pi,$r,Jr,Yr;function Pa(X,W){const se=X.audioTracks;de(W).media=X,de(W).renditionSet||(de(W).renditionSet=new Set);const Vt=de(se).trackSet;Vt.add(W);const Cr=Vt.size-1;Cr in zi.prototype||Object.defineProperty(zi.prototype,Cr,{get(){return[...de(this).trackSet][Cr]}}),queueMicrotask(()=>{se.dispatchEvent(new H("addtrack",{track:W}))})}function za(X){var W;const se=(W=de(X).media)==null?void 0:W.audioTracks;if(!se)return;de(se).trackSet.delete(X),queueMicrotask(()=>{se.dispatchEvent(new H("removetrack",{track:X}))})}function un(X){const W=de(X).media.audioTracks;!W||de(W).changeRequested||(de(W).changeRequested=!0,queueMicrotask(()=>{delete de(W).changeRequested,W.dispatchEvent(new Event("change"))}))}class zi extends EventTarget{constructor(){super(),Ai(this,Jr),Ai(this,Hr),Ai(this,pi),Ai(this,$r),de(this).trackSet=new Set}[Symbol.iterator](){return er(this,Jr,Yr).values()}get length(){return er(this,Jr,Yr).size}getTrackById(W){var se;return(se=[...er(this,Jr,Yr)].find(Vt=>Vt.id===W))!=null?se:null}get onaddtrack(){return er(this,Hr)}set onaddtrack(W){er(this,Hr)&&(this.removeEventListener("addtrack",er(this,Hr)),Bi(this,Hr,void 0)),typeof W=="function"&&(Bi(this,Hr,W),this.addEventListener("addtrack",W))}get onremovetrack(){return er(this,pi)}set onremovetrack(W){er(this,pi)&&(this.removeEventListener("removetrack",er(this,pi)),Bi(this,pi,void 0)),typeof W=="function"&&(Bi(this,pi,W),this.addEventListener("removetrack",W))}get onchange(){return er(this,$r)}set onchange(W){er(this,$r)&&(this.removeEventListener("change",er(this,$r)),Bi(this,$r,void 0)),typeof W=="function"&&(Bi(this,$r,W),this.addEventListener("change",W))}}Hr=new WeakMap,pi=new WeakMap,$r=new WeakMap,Jr=new WeakSet,Yr=function(){return de(this).trackSet};var aa=Object.defineProperty,ma=X=>{throw TypeError(X)},Oa=(X,W,se)=>W in X?aa(X,W,{enumerable:!0,configurable:!0,writable:!0,value:se}):X[W]=se,Qi=(X,W,se)=>Oa(X,typeof W!="symbol"?W+"":W,se),dn=(X,W,se)=>W.has(X)||ma("Cannot "+se),Qa=(X,W,se)=>(dn(X,W,"read from private field"),se?se.call(X):W.get(X)),Si=(X,W,se)=>W.has(X)?ma("Cannot add the same private member more than once"):W instanceof WeakSet?W.add(X):W.set(X,se),Gs=(X,W,se,Vt)=>(dn(X,W,"write to private field"),Vt?Vt.call(X,se):W.set(X,se),se),cn;const ui={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"};class Li{constructor(){Qi(this,"id"),Qi(this,"kind"),Qi(this,"label",""),Qi(this,"language",""),Qi(this,"sourceBuffer"),Si(this,cn,!1)}addRendition(W,se,Vt){const Cr=new Ci;return Cr.src=W,Cr.codec=se,Cr.bitrate=Vt,ln(this,Cr),Cr}removeRendition(W){Ar(W)}get enabled(){return Qa(this,cn)}set enabled(W){Qa(this,cn)!==W&&(Gs(this,cn,W),un(this))}}cn=new WeakMap;const Nr=qr(globalThis.HTMLMediaElement,"video"),Vr=qr(globalThis.HTMLMediaElement,"audio");function di(X){if(!(X!=null&&X.prototype))return X;const W=qr(X,"video");(!W||`${W}`.includes("[native code]"))&&Object.defineProperty(X.prototype,"videoTracks",{get(){return Kn(this)}});const se=qr(X,"audio");(!se||`${se}`.includes("[native code]"))&&Object.defineProperty(X.prototype,"audioTracks",{get(){return ha(this)}}),"addVideoTrack"in X.prototype||(X.prototype.addVideoTrack=function(gi,ei="",Xi=""){const Ei=new kt;return Ei.kind=gi,Ei.label=ei,Ei.language=Xi,Ze(this,Ei),Ei}),"removeVideoTrack"in X.prototype||(X.prototype.removeVideoTrack=st),"addAudioTrack"in X.prototype||(X.prototype.addAudioTrack=function(gi,ei="",Xi=""){const Ei=new Li;return Ei.kind=gi,Ei.label=ei,Ei.language=Xi,Pa(this,Ei),Ei}),"removeAudioTrack"in X.prototype||(X.prototype.removeAudioTrack=za),"videoRenditions"in X.prototype||Object.defineProperty(X.prototype,"videoRenditions",{get(){return Vt(this)}});const Vt=gi=>{let ei=de(gi).videoRenditions;return ei||(ei=new we,de(ei).media=gi,de(gi).videoRenditions=ei),ei};"audioRenditions"in X.prototype||Object.defineProperty(X.prototype,"audioRenditions",{get(){return Cr(this)}});const Cr=gi=>{let ei=de(gi).audioRenditions;return ei||(ei=new br,de(ei).media=gi,de(gi).audioRenditions=ei),ei};return X}function qr(X,W){var se;if(X!=null&&X.prototype)return(se=Object.getOwnPropertyDescriptor(X.prototype,`${W}Tracks`))==null?void 0:se.get}function Kn(X){var W;let se=de(X).videoTracks;if(!se&&(se=new Je,de(X).videoTracks=se,Nr)){const Vt=Nr.call((W=X.nativeEl)!=null?W:X);for(const Cr of Vt)Ze(X,Cr);Vt.addEventListener("change",()=>{se.dispatchEvent(new Event("change"))}),Vt.addEventListener("addtrack",Cr=>{if([...se].some(gi=>gi instanceof kt)){for(const gi of Vt)st(gi);return}Ze(X,Cr.track)}),Vt.addEventListener("removetrack",Cr=>{st(Cr.track)})}return se}function ha(X){var W;let se=de(X).audioTracks;if(!se&&(se=new zi,de(X).audioTracks=se,Vr)){const Vt=Vr.call((W=X.nativeEl)!=null?W:X);for(const Cr of Vt)Pa(X,Cr);Vt.addEventListener("change",()=>{se.dispatchEvent(new Event("change"))}),Vt.addEventListener("addtrack",Cr=>{if([...se].some(gi=>gi instanceof Li)){for(const gi of Vt)za(gi);return}Pa(X,Cr.track)}),Vt.addEventListener("removetrack",Cr=>{za(Cr.track)})}return se}}}]);})();
