\n * _DASH_pathway and _DASH_throughput\n *\n * @param {string} uri to add content steering server parameters to.\n * @return a new uri as a string with the added steering query parameters.\n */\n\n setSteeringParams_(url) {\n const urlObject = new window$1.URL(url);\n const path = this.getPathway();\n const networkThroughput = this.getBandwidth_();\n if (path) {\n const pathwayKey = `_${this.manifestType_}_pathway`;\n urlObject.searchParams.set(pathwayKey, path);\n }\n if (networkThroughput) {\n const throughputKey = `_${this.manifestType_}_throughput`;\n urlObject.searchParams.set(throughputKey, networkThroughput);\n }\n return urlObject.toString();\n }\n /**\n * Assigns the current steering manifest properties and to the SteeringManifest object\n *\n * @param {Object} steeringJson the raw JSON steering manifest\n */\n\n assignSteeringProperties_(steeringJson) {\n this.steeringManifest.version = steeringJson.VERSION;\n if (!this.steeringManifest.version) {\n this.logger_(`manifest version is ${steeringJson.VERSION}, which is not supported.`);\n this.trigger('error');\n return;\n }\n this.steeringManifest.ttl = steeringJson.TTL;\n this.steeringManifest.reloadUri = steeringJson['RELOAD-URI']; // HLS = PATHWAY-PRIORITY required. DASH = SERVICE-LOCATION-PRIORITY optional\n\n this.steeringManifest.priority = steeringJson['PATHWAY-PRIORITY'] || steeringJson['SERVICE-LOCATION-PRIORITY']; // Pathway clones to be created/updated in HLS.\n // See section 7.2 https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/\n\n this.steeringManifest.pathwayClones = steeringJson['PATHWAY-CLONES'];\n this.nextPathwayClones = this.steeringManifest.pathwayClones; // 1. apply first pathway from the array.\n // 2. if first pathway doesn't exist in manifest, try next pathway.\n // a. if all pathways are exhausted, ignore the steering manifest priority.\n // 3. if segments fail from an established pathway, try all variants/renditions, then exclude the failed pathway.\n // a. exclude a pathway for a minimum of the last TTL duration. Meaning, from the next steering response,\n // the excluded pathway will be ignored.\n // See excludePathway usage in excludePlaylist().\n // If there are no available pathways, we need to stop content steering.\n\n if (!this.availablePathways_.size) {\n this.logger_('There are no available pathways for content steering. Ending content steering.');\n this.trigger('error');\n this.dispose();\n }\n const chooseNextPathway = pathwaysByPriority => {\n for (const path of pathwaysByPriority) {\n if (this.availablePathways_.has(path)) {\n return path;\n }\n } // If no pathway matches, ignore the manifest and choose the first available.\n\n return [...this.availablePathways_][0];\n };\n const nextPathway = chooseNextPathway(this.steeringManifest.priority);\n if (this.currentPathway !== nextPathway) {\n this.currentPathway = nextPathway;\n this.trigger('content-steering');\n }\n }\n /**\n * Returns the pathway to use for steering decisions\n *\n * @return {string} returns the current pathway or the default\n */\n\n getPathway() {\n return this.currentPathway || this.defaultPathway;\n }\n /**\n * Chooses the manifest request URI based on proxy URIs and server URLs.\n * Also accounts for exclusion on certain manifest URIs.\n *\n * @param {string} reloadUri the base uri before parameters\n *\n * @return {string} the final URI for the request to the manifest server.\n */\n\n getRequestURI(reloadUri) {\n if (!reloadUri) {\n return null;\n }\n const isExcluded = uri => this.excludedSteeringManifestURLs.has(uri);\n if (this.proxyServerUrl_) {\n const proxyURI = this.setProxyServerUrl_(reloadUri);\n if (!isExcluded(proxyURI)) {\n return proxyURI;\n }\n }\n const steeringURI = this.setSteeringParams_(reloadUri);\n if (!isExcluded(steeringURI)) {\n return steeringURI;\n } // Return nothing if all valid manifest URIs are excluded.\n\n return null;\n }\n /**\n * Start the timeout for re-requesting the steering manifest at the TTL interval.\n *\n * @param {number} ttl time in seconds of the timeout. Defaults to the\n * ttl interval in the steering manifest\n */\n\n startTTLTimeout_(ttl = this.steeringManifest.ttl) {\n // 300 (5 minutes) is the default value.\n const ttlMS = ttl * 1000;\n this.ttlTimeout_ = window$1.setTimeout(() => {\n this.requestSteeringManifest();\n }, ttlMS);\n }\n /**\n * Clear the TTL timeout if necessary.\n */\n\n clearTTLTimeout_() {\n window$1.clearTimeout(this.ttlTimeout_);\n this.ttlTimeout_ = null;\n }\n /**\n * aborts any current steering xhr and sets the current request object to null\n */\n\n abort() {\n if (this.request_) {\n this.request_.abort();\n }\n this.request_ = null;\n }\n /**\n * aborts steering requests clears the ttl timeout and resets all properties.\n */\n\n dispose() {\n this.off('content-steering');\n this.off('error');\n this.abort();\n this.clearTTLTimeout_();\n this.currentPathway = null;\n this.defaultPathway = null;\n this.queryBeforeStart = null;\n this.proxyServerUrl_ = null;\n this.manifestType_ = null;\n this.ttlTimeout_ = null;\n this.request_ = null;\n this.excludedSteeringManifestURLs = new Set();\n this.availablePathways_ = new Set();\n this.steeringManifest = new SteeringManifest();\n }\n /**\n * adds a pathway to the available pathways set\n *\n * @param {string} pathway the pathway string to add\n */\n\n addAvailablePathway(pathway) {\n if (pathway) {\n this.availablePathways_.add(pathway);\n }\n }\n /**\n * Clears all pathways from the available pathways set\n */\n\n clearAvailablePathways() {\n this.availablePathways_.clear();\n }\n /**\n * Removes a pathway from the available pathways set.\n */\n\n excludePathway(pathway) {\n return this.availablePathways_.delete(pathway);\n }\n /**\n * Checks the refreshed DASH manifest content steering tag for changes.\n *\n * @param {string} baseURL new steering tag on DASH manifest refresh\n * @param {Object} newTag the new tag to check for changes\n * @return a true or false whether the new tag has different values\n */\n\n didDASHTagChange(baseURL, newTag) {\n return !newTag && this.steeringManifest.reloadUri || newTag && (resolveUrl(baseURL, newTag.serverURL) !== this.steeringManifest.reloadUri || newTag.defaultServiceLocation !== this.defaultPathway || newTag.queryBeforeStart !== this.queryBeforeStart || newTag.proxyServerURL !== this.proxyServerUrl_);\n }\n getAvailablePathways() {\n return this.availablePathways_;\n }\n}\nconst debounce = (callback, wait) => {\n let timeoutId = null;\n return (...args) => {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => {\n callback.apply(null, args);\n }, wait);\n };\n};\nconst ABORT_EARLY_EXCLUSION_SECONDS = 10;\nlet Vhs$1; // SegmentLoader stats that need to have each loader's\n// values summed to calculate the final value\n\nconst loaderStats = ['mediaRequests', 'mediaRequestsAborted', 'mediaRequestsTimedout', 'mediaRequestsErrored', 'mediaTransferDuration', 'mediaBytesTransferred', 'mediaAppends'];\nconst sumLoaderStat = function (stat) {\n return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat];\n};\nconst shouldSwitchToMedia = function ({\n currentPlaylist,\n buffered,\n currentTime,\n nextPlaylist,\n bufferLowWaterLine,\n bufferHighWaterLine,\n duration,\n bufferBasedABR,\n log\n}) {\n // we have no other playlist to switch to\n if (!nextPlaylist) {\n videojs.log.warn('We received no playlist to switch to. Please check your stream.');\n return false;\n }\n const sharedLogLine = `allowing switch ${currentPlaylist && currentPlaylist.id || 'null'} -> ${nextPlaylist.id}`;\n if (!currentPlaylist) {\n log(`${sharedLogLine} as current playlist is not set`);\n return true;\n } // no need to switch if playlist is the same\n\n if (nextPlaylist.id === currentPlaylist.id) {\n return false;\n } // determine if current time is in a buffered range.\n\n const isBuffered = Boolean(findRange(buffered, currentTime).length); // If the playlist is live, then we want to not take low water line into account.\n // This is because in LIVE, the player plays 3 segments from the end of the\n // playlist, and if `BUFFER_LOW_WATER_LINE` is greater than the duration availble\n // in those segments, a viewer will never experience a rendition upswitch.\n\n if (!currentPlaylist.endList) {\n // For LLHLS live streams, don't switch renditions before playback has started, as it almost\n // doubles the time to first playback.\n if (!isBuffered && typeof currentPlaylist.partTargetDuration === 'number') {\n log(`not ${sharedLogLine} as current playlist is live llhls, but currentTime isn't in buffered.`);\n return false;\n }\n log(`${sharedLogLine} as current playlist is live`);\n return true;\n }\n const forwardBuffer = timeAheadOf(buffered, currentTime);\n const maxBufferLowWaterLine = bufferBasedABR ? Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config.MAX_BUFFER_LOW_WATER_LINE; // For the same reason as LIVE, we ignore the low water line when the VOD\n // duration is below the max potential low water line\n\n if (duration < maxBufferLowWaterLine) {\n log(`${sharedLogLine} as duration < max low water line (${duration} < ${maxBufferLowWaterLine})`);\n return true;\n }\n const nextBandwidth = nextPlaylist.attributes.BANDWIDTH;\n const currBandwidth = currentPlaylist.attributes.BANDWIDTH; // when switching down, if our buffer is lower than the high water line,\n // we can switch down\n\n if (nextBandwidth < currBandwidth && (!bufferBasedABR || forwardBuffer < bufferHighWaterLine)) {\n let logLine = `${sharedLogLine} as next bandwidth < current bandwidth (${nextBandwidth} < ${currBandwidth})`;\n if (bufferBasedABR) {\n logLine += ` and forwardBuffer < bufferHighWaterLine (${forwardBuffer} < ${bufferHighWaterLine})`;\n }\n log(logLine);\n return true;\n } // and if our buffer is higher than the low water line,\n // we can switch up\n\n if ((!bufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) {\n let logLine = `${sharedLogLine} as forwardBuffer >= bufferLowWaterLine (${forwardBuffer} >= ${bufferLowWaterLine})`;\n if (bufferBasedABR) {\n logLine += ` and next bandwidth > current bandwidth (${nextBandwidth} > ${currBandwidth})`;\n }\n log(logLine);\n return true;\n }\n log(`not ${sharedLogLine} as no switching criteria met`);\n return false;\n};\n/**\n * the main playlist controller controller all interactons\n * between playlists and segmentloaders. At this time this mainly\n * involves a main playlist and a series of audio playlists\n * if they are available\n *\n * @class PlaylistController\n * @extends videojs.EventTarget\n */\n\nclass PlaylistController extends videojs.EventTarget {\n constructor(options) {\n super(); // Adding a slight debounce to avoid duplicate calls during rapid quality changes, for example:\n // When selecting quality from the quality list,\n // where we may have multiple bandwidth profiles for the same vertical resolution.\n\n this.fastQualityChange_ = debounce(this.fastQualityChange_.bind(this), 100);\n const {\n src,\n withCredentials,\n tech,\n bandwidth,\n externVhs,\n useCueTags,\n playlistExclusionDuration,\n enableLowInitialPlaylist,\n sourceType,\n cacheEncryptionKeys,\n bufferBasedABR,\n leastPixelDiffSelector,\n captionServices,\n experimentalUseMMS\n } = options;\n if (!src) {\n throw new Error('A non-empty playlist URL or JSON manifest string is required');\n }\n let {\n maxPlaylistRetries\n } = options;\n if (maxPlaylistRetries === null || typeof maxPlaylistRetries === 'undefined') {\n maxPlaylistRetries = Infinity;\n }\n Vhs$1 = externVhs;\n this.bufferBasedABR = Boolean(bufferBasedABR);\n this.leastPixelDiffSelector = Boolean(leastPixelDiffSelector);\n this.withCredentials = withCredentials;\n this.tech_ = tech;\n this.vhs_ = tech.vhs;\n this.player_ = options.player_;\n this.sourceType_ = sourceType;\n this.useCueTags_ = useCueTags;\n this.playlistExclusionDuration = playlistExclusionDuration;\n this.maxPlaylistRetries = maxPlaylistRetries;\n this.enableLowInitialPlaylist = enableLowInitialPlaylist;\n this.usingManagedMediaSource_ = false;\n if (this.useCueTags_) {\n this.cueTagsTrack_ = this.tech_.addTextTrack('metadata', 'ad-cues');\n this.cueTagsTrack_.inBandMetadataTrackDispatchType = '';\n }\n this.requestOptions_ = {\n withCredentials,\n maxPlaylistRetries,\n timeout: null\n };\n this.on('error', this.pauseLoading);\n this.mediaTypes_ = createMediaTypes();\n if (experimentalUseMMS && window$1.ManagedMediaSource) {\n // Airplay source not yet implemented. Remote playback must be disabled.\n this.tech_.el_.disableRemotePlayback = true;\n this.mediaSource = new window$1.ManagedMediaSource();\n this.usingManagedMediaSource_ = true;\n videojs.log('Using ManagedMediaSource');\n } else if (window$1.MediaSource) {\n this.mediaSource = new window$1.MediaSource();\n }\n this.handleDurationChange_ = this.handleDurationChange_.bind(this);\n this.handleSourceOpen_ = this.handleSourceOpen_.bind(this);\n this.handleSourceEnded_ = this.handleSourceEnded_.bind(this);\n this.load = this.load.bind(this);\n this.pause = this.pause.bind(this);\n this.mediaSource.addEventListener('durationchange', this.handleDurationChange_); // load the media source into the player\n\n this.mediaSource.addEventListener('sourceopen', this.handleSourceOpen_);\n this.mediaSource.addEventListener('sourceended', this.handleSourceEnded_);\n this.mediaSource.addEventListener('startstreaming', this.load);\n this.mediaSource.addEventListener('endstreaming', this.pause); // we don't have to handle sourceclose since dispose will handle termination of\n // everything, and the MediaSource should not be detached without a proper disposal\n\n this.seekable_ = createTimeRanges();\n this.hasPlayed_ = false;\n this.syncController_ = new SyncController(options);\n this.segmentMetadataTrack_ = tech.addRemoteTextTrack({\n kind: 'metadata',\n label: 'segment-metadata'\n }, false).track;\n this.decrypter_ = new Decrypter();\n this.sourceUpdater_ = new SourceUpdater(this.mediaSource);\n this.inbandTextTracks_ = {};\n this.timelineChangeController_ = new TimelineChangeController();\n this.keyStatusMap_ = new Map();\n const segmentLoaderSettings = {\n vhs: this.vhs_,\n parse708captions: options.parse708captions,\n useDtsForTimestampOffset: options.useDtsForTimestampOffset,\n captionServices,\n mediaSource: this.mediaSource,\n currentTime: this.tech_.currentTime.bind(this.tech_),\n seekable: () => this.seekable(),\n seeking: () => this.tech_.seeking(),\n duration: () => this.duration(),\n hasPlayed: () => this.hasPlayed_,\n goalBufferLength: () => this.goalBufferLength(),\n bandwidth,\n syncController: this.syncController_,\n decrypter: this.decrypter_,\n sourceType: this.sourceType_,\n inbandTextTracks: this.inbandTextTracks_,\n cacheEncryptionKeys,\n sourceUpdater: this.sourceUpdater_,\n timelineChangeController: this.timelineChangeController_,\n exactManifestTimings: options.exactManifestTimings,\n addMetadataToTextTrack: this.addMetadataToTextTrack.bind(this)\n }; // The source type check not only determines whether a special DASH playlist loader\n // should be used, but also covers the case where the provided src is a vhs-json\n // manifest object (instead of a URL). In the case of vhs-json, the default\n // PlaylistLoader should be used.\n\n this.mainPlaylistLoader_ = this.sourceType_ === 'dash' ? new DashPlaylistLoader(src, this.vhs_, merge(this.requestOptions_, {\n addMetadataToTextTrack: this.addMetadataToTextTrack.bind(this)\n })) : new PlaylistLoader(src, this.vhs_, merge(this.requestOptions_, {\n addDateRangesToTextTrack: this.addDateRangesToTextTrack_.bind(this)\n }));\n this.setupMainPlaylistLoaderListeners_(); // setup segment loaders\n // combined audio/video or just video when alternate audio track is selected\n\n this.mainSegmentLoader_ = new SegmentLoader(merge(segmentLoaderSettings, {\n segmentMetadataTrack: this.segmentMetadataTrack_,\n loaderType: 'main'\n }), options); // alternate audio track\n\n this.audioSegmentLoader_ = new SegmentLoader(merge(segmentLoaderSettings, {\n loaderType: 'audio'\n }), options);\n this.subtitleSegmentLoader_ = new VTTSegmentLoader(merge(segmentLoaderSettings, {\n loaderType: 'vtt',\n featuresNativeTextTracks: this.tech_.featuresNativeTextTracks,\n loadVttJs: () => new Promise((resolve, reject) => {\n function onLoad() {\n tech.off('vttjserror', onError);\n resolve();\n }\n function onError() {\n tech.off('vttjsloaded', onLoad);\n reject();\n }\n tech.one('vttjsloaded', onLoad);\n tech.one('vttjserror', onError); // safe to call multiple times, script will be loaded only once:\n\n tech.addWebVttScript_();\n })\n }), options);\n const getBandwidth = () => {\n return this.mainSegmentLoader_.bandwidth;\n };\n this.contentSteeringController_ = new ContentSteeringController(this.vhs_.xhr, getBandwidth);\n this.setupSegmentLoaderListeners_();\n if (this.bufferBasedABR) {\n this.mainPlaylistLoader_.one('loadedplaylist', () => this.startABRTimer_());\n this.tech_.on('pause', () => this.stopABRTimer_());\n this.tech_.on('play', () => this.startABRTimer_());\n } // Create SegmentLoader stat-getters\n // mediaRequests_\n // mediaRequestsAborted_\n // mediaRequestsTimedout_\n // mediaRequestsErrored_\n // mediaTransferDuration_\n // mediaBytesTransferred_\n // mediaAppends_\n\n loaderStats.forEach(stat => {\n this[stat + '_'] = sumLoaderStat.bind(this, stat);\n });\n this.logger_ = logger('pc');\n this.triggeredFmp4Usage = false;\n if (this.tech_.preload() === 'none') {\n this.loadOnPlay_ = () => {\n this.loadOnPlay_ = null;\n this.mainPlaylistLoader_.load();\n };\n this.tech_.one('play', this.loadOnPlay_);\n } else {\n this.mainPlaylistLoader_.load();\n }\n this.timeToLoadedData__ = -1;\n this.mainAppendsToLoadedData__ = -1;\n this.audioAppendsToLoadedData__ = -1;\n const event = this.tech_.preload() === 'none' ? 'play' : 'loadstart'; // start the first frame timer on loadstart or play (for preload none)\n\n this.tech_.one(event, () => {\n const timeToLoadedDataStart = Date.now();\n this.tech_.one('loadeddata', () => {\n this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart;\n this.mainAppendsToLoadedData__ = this.mainSegmentLoader_.mediaAppends;\n this.audioAppendsToLoadedData__ = this.audioSegmentLoader_.mediaAppends;\n });\n });\n }\n mainAppendsToLoadedData_() {\n return this.mainAppendsToLoadedData__;\n }\n audioAppendsToLoadedData_() {\n return this.audioAppendsToLoadedData__;\n }\n appendsToLoadedData_() {\n const main = this.mainAppendsToLoadedData_();\n const audio = this.audioAppendsToLoadedData_();\n if (main === -1 || audio === -1) {\n return -1;\n }\n return main + audio;\n }\n timeToLoadedData_() {\n return this.timeToLoadedData__;\n }\n /**\n * Run selectPlaylist and switch to the new playlist if we should\n *\n * @param {string} [reason=abr] a reason for why the ABR check is made\n * @private\n */\n\n checkABR_(reason = 'abr') {\n const nextPlaylist = this.selectPlaylist();\n if (nextPlaylist && this.shouldSwitchToMedia_(nextPlaylist)) {\n this.switchMedia_(nextPlaylist, reason);\n }\n }\n switchMedia_(playlist, cause, delay) {\n const oldMedia = this.media();\n const oldId = oldMedia && (oldMedia.id || oldMedia.uri);\n const newId = playlist && (playlist.id || playlist.uri);\n if (oldId && oldId !== newId) {\n this.logger_(`switch media ${oldId} -> ${newId} from ${cause}`);\n const metadata = {\n renditionInfo: {\n id: newId,\n bandwidth: playlist.attributes.BANDWIDTH,\n resolution: playlist.attributes.RESOLUTION,\n codecs: playlist.attributes.CODECS\n },\n cause\n };\n this.trigger({\n type: 'renditionselected',\n metadata\n });\n this.tech_.trigger({\n type: 'usage',\n name: `vhs-rendition-change-${cause}`\n });\n }\n this.mainPlaylistLoader_.media(playlist, delay);\n }\n /**\n * A function that ensures we switch our playlists inside of `mediaTypes`\n * to match the current `serviceLocation` provided by the contentSteering controller.\n * We want to check media types of `AUDIO`, `SUBTITLES`, and `CLOSED-CAPTIONS`.\n *\n * This should only be called on a DASH playback scenario while using content steering.\n * This is necessary due to differences in how media in HLS manifests are generally tied to\n * a video playlist, where in DASH that is not always the case.\n */\n\n switchMediaForDASHContentSteering_() {\n ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => {\n const mediaType = this.mediaTypes_[type];\n const activeGroup = mediaType ? mediaType.activeGroup() : null;\n const pathway = this.contentSteeringController_.getPathway();\n if (activeGroup && pathway) {\n // activeGroup can be an array or a single group\n const mediaPlaylists = activeGroup.length ? activeGroup[0].playlists : activeGroup.playlists;\n const dashMediaPlaylists = mediaPlaylists.filter(p => p.attributes.serviceLocation === pathway); // Switch the current active playlist to the correct CDN\n\n if (dashMediaPlaylists.length) {\n this.mediaTypes_[type].activePlaylistLoader.media(dashMediaPlaylists[0]);\n }\n }\n });\n }\n /**\n * Start a timer that periodically calls checkABR_\n *\n * @private\n */\n\n startABRTimer_() {\n this.stopABRTimer_();\n this.abrTimer_ = window$1.setInterval(() => this.checkABR_(), 250);\n }\n /**\n * Stop the timer that periodically calls checkABR_\n *\n * @private\n */\n\n stopABRTimer_() {\n // if we're scrubbing, we don't need to pause.\n // This getter will be added to Video.js in version 7.11.\n if (this.tech_.scrubbing && this.tech_.scrubbing()) {\n return;\n }\n window$1.clearInterval(this.abrTimer_);\n this.abrTimer_ = null;\n }\n /**\n * Get a list of playlists for the currently selected audio playlist\n *\n * @return {Array} the array of audio playlists\n */\n\n getAudioTrackPlaylists_() {\n const main = this.main();\n const defaultPlaylists = main && main.playlists || []; // if we don't have any audio groups then we can only\n // assume that the audio tracks are contained in main\n // playlist array, use that or an empty array.\n\n if (!main || !main.mediaGroups || !main.mediaGroups.AUDIO) {\n return defaultPlaylists;\n }\n const AUDIO = main.mediaGroups.AUDIO;\n const groupKeys = Object.keys(AUDIO);\n let track; // get the current active track\n\n if (Object.keys(this.mediaTypes_.AUDIO.groups).length) {\n track = this.mediaTypes_.AUDIO.activeTrack(); // or get the default track from main if mediaTypes_ isn't setup yet\n } else {\n // default group is `main` or just the first group.\n const defaultGroup = AUDIO.main || groupKeys.length && AUDIO[groupKeys[0]];\n for (const label in defaultGroup) {\n if (defaultGroup[label].default) {\n track = {\n label\n };\n break;\n }\n }\n } // no active track no playlists.\n\n if (!track) {\n return defaultPlaylists;\n }\n const playlists = []; // get all of the playlists that are possible for the\n // active track.\n\n for (const group in AUDIO) {\n if (AUDIO[group][track.label]) {\n const properties = AUDIO[group][track.label];\n if (properties.playlists && properties.playlists.length) {\n playlists.push.apply(playlists, properties.playlists);\n } else if (properties.uri) {\n playlists.push(properties);\n } else if (main.playlists.length) {\n // if an audio group does not have a uri\n // see if we have main playlists that use it as a group.\n // if we do then add those to the playlists list.\n for (let i = 0; i < main.playlists.length; i++) {\n const playlist = main.playlists[i];\n if (playlist.attributes && playlist.attributes.AUDIO && playlist.attributes.AUDIO === group) {\n playlists.push(playlist);\n }\n }\n }\n }\n }\n if (!playlists.length) {\n return defaultPlaylists;\n }\n return playlists;\n }\n /**\n * Register event handlers on the main playlist loader. A helper\n * function for construction time.\n *\n * @private\n */\n\n setupMainPlaylistLoaderListeners_() {\n this.mainPlaylistLoader_.on('loadedmetadata', () => {\n const media = this.mainPlaylistLoader_.media();\n const requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to\n // timeout the request.\n\n if (isLowestEnabledRendition(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.media())) {\n this.requestOptions_.timeout = 0;\n } else {\n this.requestOptions_.timeout = requestTimeout;\n } // if this isn't a live video and preload permits, start\n // downloading segments\n\n if (media.endList && this.tech_.preload() !== 'none') {\n this.mainSegmentLoader_.playlist(media, this.requestOptions_);\n this.mainSegmentLoader_.load();\n }\n setupMediaGroups({\n sourceType: this.sourceType_,\n segmentLoaders: {\n AUDIO: this.audioSegmentLoader_,\n SUBTITLES: this.subtitleSegmentLoader_,\n main: this.mainSegmentLoader_\n },\n tech: this.tech_,\n requestOptions: this.requestOptions_,\n mainPlaylistLoader: this.mainPlaylistLoader_,\n vhs: this.vhs_,\n main: this.main(),\n mediaTypes: this.mediaTypes_,\n excludePlaylist: this.excludePlaylist.bind(this)\n });\n this.triggerPresenceUsage_(this.main(), media);\n this.setupFirstPlay();\n if (!this.mediaTypes_.AUDIO.activePlaylistLoader || this.mediaTypes_.AUDIO.activePlaylistLoader.media()) {\n this.trigger('selectedinitialmedia');\n } else {\n // We must wait for the active audio playlist loader to\n // finish setting up before triggering this event so the\n // representations API and EME setup is correct\n this.mediaTypes_.AUDIO.activePlaylistLoader.one('loadedmetadata', () => {\n this.trigger('selectedinitialmedia');\n });\n }\n });\n this.mainPlaylistLoader_.on('loadedplaylist', () => {\n if (this.loadOnPlay_) {\n this.tech_.off('play', this.loadOnPlay_);\n }\n let updatedPlaylist = this.mainPlaylistLoader_.media();\n if (!updatedPlaylist) {\n // Add content steering listeners on first load and init.\n this.attachContentSteeringListeners_();\n this.initContentSteeringController_(); // exclude any variants that are not supported by the browser before selecting\n // an initial media as the playlist selectors do not consider browser support\n\n this.excludeUnsupportedVariants_();\n let selectedMedia;\n if (this.enableLowInitialPlaylist) {\n selectedMedia = this.selectInitialPlaylist();\n }\n if (!selectedMedia) {\n selectedMedia = this.selectPlaylist();\n }\n if (!selectedMedia || !this.shouldSwitchToMedia_(selectedMedia)) {\n return;\n }\n this.initialMedia_ = selectedMedia;\n this.switchMedia_(this.initialMedia_, 'initial'); // Under the standard case where a source URL is provided, loadedplaylist will\n // fire again since the playlist will be requested. In the case of vhs-json\n // (where the manifest object is provided as the source), when the media\n // playlist's `segments` list is already available, a media playlist won't be\n // requested, and loadedplaylist won't fire again, so the playlist handler must be\n // called on its own here.\n\n const haveJsonSource = this.sourceType_ === 'vhs-json' && this.initialMedia_.segments;\n if (!haveJsonSource) {\n return;\n }\n updatedPlaylist = this.initialMedia_;\n }\n this.handleUpdatedMediaPlaylist(updatedPlaylist);\n });\n this.mainPlaylistLoader_.on('error', () => {\n const error = this.mainPlaylistLoader_.error;\n this.excludePlaylist({\n playlistToExclude: error.playlist,\n error\n });\n });\n this.mainPlaylistLoader_.on('mediachanging', () => {\n this.mainSegmentLoader_.abort();\n this.mainSegmentLoader_.pause();\n });\n this.mainPlaylistLoader_.on('mediachange', () => {\n const media = this.mainPlaylistLoader_.media();\n const requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to\n // timeout the request.\n\n if (isLowestEnabledRendition(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.media())) {\n this.requestOptions_.timeout = 0;\n } else {\n this.requestOptions_.timeout = requestTimeout;\n }\n if (this.sourceType_ === 'dash') {\n // we don't want to re-request the same hls playlist right after it was changed\n // Initially it was implemented as workaround to restart playlist loader for live\n // when playlist loader is paused because of playlist exclusions:\n // see: https://github.com/videojs/http-streaming/pull/1339\n // but this introduces duplicate \"loadedplaylist\" event.\n // Ideally we want to re-think playlist loader life-cycle events,\n // but simply checking \"paused\" state should help a lot\n if (this.mainPlaylistLoader_.isPaused) {\n this.mainPlaylistLoader_.load();\n }\n } // TODO: Create a new event on the PlaylistLoader that signals\n // that the segments have changed in some way and use that to\n // update the SegmentLoader instead of doing it twice here and\n // on `loadedplaylist`\n\n this.mainSegmentLoader_.pause();\n this.mainSegmentLoader_.playlist(media, this.requestOptions_);\n if (this.waitingForFastQualityPlaylistReceived_) {\n this.runFastQualitySwitch_();\n } else {\n this.mainSegmentLoader_.load();\n }\n this.tech_.trigger({\n type: 'mediachange',\n bubbles: true\n });\n });\n this.mainPlaylistLoader_.on('playlistunchanged', () => {\n const updatedPlaylist = this.mainPlaylistLoader_.media(); // ignore unchanged playlists that have already been\n // excluded for not-changing. We likely just have a really slowly updating\n // playlist.\n\n if (updatedPlaylist.lastExcludeReason_ === 'playlist-unchanged') {\n return;\n }\n const playlistOutdated = this.stuckAtPlaylistEnd_(updatedPlaylist);\n if (playlistOutdated) {\n // Playlist has stopped updating and we're stuck at its end. Try to\n // exclude it and switch to another playlist in the hope that that\n // one is updating (and give the player a chance to re-adjust to the\n // safe live point).\n this.excludePlaylist({\n error: {\n message: 'Playlist no longer updating.',\n reason: 'playlist-unchanged'\n }\n }); // useful for monitoring QoS\n\n this.tech_.trigger('playliststuck');\n }\n });\n this.mainPlaylistLoader_.on('renditiondisabled', () => {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-rendition-disabled'\n });\n });\n this.mainPlaylistLoader_.on('renditionenabled', () => {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-rendition-enabled'\n });\n });\n const playlistLoaderEvents = ['manifestrequeststart', 'manifestrequestcomplete', 'manifestparsestart', 'manifestparsecomplete', 'playlistrequeststart', 'playlistrequestcomplete', 'playlistparsestart', 'playlistparsecomplete', 'renditiondisabled', 'renditionenabled'];\n playlistLoaderEvents.forEach(eventName => {\n this.mainPlaylistLoader_.on(eventName, metadata => {\n // trigger directly on the player to ensure early events are fired.\n this.player_.trigger(_extends({}, metadata));\n });\n });\n }\n /**\n * Given an updated media playlist (whether it was loaded for the first time, or\n * refreshed for live playlists), update any relevant properties and state to reflect\n * changes in the media that should be accounted for (e.g., cues and duration).\n *\n * @param {Object} updatedPlaylist the updated media playlist object\n *\n * @private\n */\n\n handleUpdatedMediaPlaylist(updatedPlaylist) {\n if (this.useCueTags_) {\n this.updateAdCues_(updatedPlaylist);\n } // TODO: Create a new event on the PlaylistLoader that signals\n // that the segments have changed in some way and use that to\n // update the SegmentLoader instead of doing it twice here and\n // on `mediachange`\n\n this.mainSegmentLoader_.pause();\n this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_);\n if (this.waitingForFastQualityPlaylistReceived_) {\n this.runFastQualitySwitch_();\n }\n this.updateDuration(!updatedPlaylist.endList); // If the player isn't paused, ensure that the segment loader is running,\n // as it is possible that it was temporarily stopped while waiting for\n // a playlist (e.g., in case the playlist errored and we re-requested it).\n\n if (!this.tech_.paused()) {\n this.mainSegmentLoader_.load();\n if (this.audioSegmentLoader_) {\n this.audioSegmentLoader_.load();\n }\n }\n }\n /**\n * A helper function for triggerring presence usage events once per source\n *\n * @private\n */\n\n triggerPresenceUsage_(main, media) {\n const mediaGroups = main.mediaGroups || {};\n let defaultDemuxed = true;\n const audioGroupKeys = Object.keys(mediaGroups.AUDIO);\n for (const mediaGroup in mediaGroups.AUDIO) {\n for (const label in mediaGroups.AUDIO[mediaGroup]) {\n const properties = mediaGroups.AUDIO[mediaGroup][label];\n if (!properties.uri) {\n defaultDemuxed = false;\n }\n }\n }\n if (defaultDemuxed) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-demuxed'\n });\n }\n if (Object.keys(mediaGroups.SUBTITLES).length) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-webvtt'\n });\n }\n if (Vhs$1.Playlist.isAes(media)) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-aes'\n });\n }\n if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-alternate-audio'\n });\n }\n if (this.useCueTags_) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-playlist-cue-tags'\n });\n }\n }\n shouldSwitchToMedia_(nextPlaylist) {\n const currentPlaylist = this.mainPlaylistLoader_.media() || this.mainPlaylistLoader_.pendingMedia_;\n const currentTime = this.tech_.currentTime();\n const bufferLowWaterLine = this.bufferLowWaterLine();\n const bufferHighWaterLine = this.bufferHighWaterLine();\n const buffered = this.tech_.buffered();\n return shouldSwitchToMedia({\n buffered,\n currentTime,\n currentPlaylist,\n nextPlaylist,\n bufferLowWaterLine,\n bufferHighWaterLine,\n duration: this.duration(),\n bufferBasedABR: this.bufferBasedABR,\n log: this.logger_\n });\n }\n /**\n * Register event handlers on the segment loaders. A helper function\n * for construction time.\n *\n * @private\n */\n\n setupSegmentLoaderListeners_() {\n this.mainSegmentLoader_.on('bandwidthupdate', () => {\n // Whether or not buffer based ABR or another ABR is used, on a bandwidth change it's\n // useful to check to see if a rendition switch should be made.\n this.checkABR_('bandwidthupdate');\n this.tech_.trigger('bandwidthupdate');\n });\n this.mainSegmentLoader_.on('timeout', () => {\n if (this.bufferBasedABR) {\n // If a rendition change is needed, then it would've be done on `bandwidthupdate`.\n // Here the only consideration is that for buffer based ABR there's no guarantee\n // of an immediate switch (since the bandwidth is averaged with a timeout\n // bandwidth value of 1), so force a load on the segment loader to keep it going.\n this.mainSegmentLoader_.load();\n }\n }); // `progress` events are not reliable enough of a bandwidth measure to trigger buffer\n // based ABR.\n\n if (!this.bufferBasedABR) {\n this.mainSegmentLoader_.on('progress', () => {\n this.trigger('progress');\n });\n }\n this.mainSegmentLoader_.on('error', () => {\n const error = this.mainSegmentLoader_.error();\n this.excludePlaylist({\n playlistToExclude: error.playlist,\n error\n });\n });\n this.mainSegmentLoader_.on('appenderror', () => {\n this.error = this.mainSegmentLoader_.error_;\n this.trigger('error');\n });\n this.mainSegmentLoader_.on('syncinfoupdate', () => {\n this.onSyncInfoUpdate_();\n });\n this.mainSegmentLoader_.on('timestampoffset', () => {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-timestamp-offset'\n });\n });\n this.audioSegmentLoader_.on('syncinfoupdate', () => {\n this.onSyncInfoUpdate_();\n });\n this.audioSegmentLoader_.on('appenderror', () => {\n this.error = this.audioSegmentLoader_.error_;\n this.trigger('error');\n });\n this.mainSegmentLoader_.on('ended', () => {\n this.logger_('main segment loader ended');\n this.onEndOfStream();\n }); // There is the possibility of the video segment and the audio segment\n // at a current time to be on different timelines. When this occurs, the player\n // forwards playback to a point where these two segment types are back on the same\n // timeline. This time will be just after the end of the audio segment that is on\n // a previous timeline.\n\n this.timelineChangeController_.on('audioTimelineBehind', () => {\n const segmentInfo = this.audioSegmentLoader_.pendingSegment_;\n if (!segmentInfo || !segmentInfo.segment || !segmentInfo.segment.syncInfo) {\n return;\n } // Update the current time to just after the faulty audio segment.\n // This moves playback to a spot where both audio and video segments\n // are on the same timeline.\n\n const newTime = segmentInfo.segment.syncInfo.end + 0.01;\n this.tech_.setCurrentTime(newTime);\n });\n this.timelineChangeController_.on('fixBadTimelineChange', () => {\n // pause, reset-everything and load for all segment-loaders\n this.logger_('Fix bad timeline change. Restarting al segment loaders...');\n this.mainSegmentLoader_.pause();\n this.mainSegmentLoader_.resetEverything();\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n this.audioSegmentLoader_.pause();\n this.audioSegmentLoader_.resetEverything();\n }\n if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {\n this.subtitleSegmentLoader_.pause();\n this.subtitleSegmentLoader_.resetEverything();\n } // start segment loader loading in case they are paused\n\n this.load();\n });\n this.mainSegmentLoader_.on('earlyabort', event => {\n // never try to early abort with the new ABR algorithm\n if (this.bufferBasedABR) {\n return;\n }\n this.delegateLoaders_('all', ['abort']);\n this.excludePlaylist({\n error: {\n message: 'Aborted early because there isn\\'t enough bandwidth to complete ' + 'the request without rebuffering.'\n },\n playlistExclusionDuration: ABORT_EARLY_EXCLUSION_SECONDS\n });\n });\n const updateCodecs = () => {\n if (!this.sourceUpdater_.hasCreatedSourceBuffers()) {\n return this.tryToCreateSourceBuffers_();\n }\n const codecs = this.getCodecsOrExclude_(); // no codecs means that the playlist was excluded\n\n if (!codecs) {\n return;\n }\n this.sourceUpdater_.addOrChangeSourceBuffers(codecs);\n };\n this.mainSegmentLoader_.on('trackinfo', updateCodecs);\n this.audioSegmentLoader_.on('trackinfo', updateCodecs);\n this.mainSegmentLoader_.on('fmp4', () => {\n if (!this.triggeredFmp4Usage) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-fmp4'\n });\n this.triggeredFmp4Usage = true;\n }\n });\n this.audioSegmentLoader_.on('fmp4', () => {\n if (!this.triggeredFmp4Usage) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-fmp4'\n });\n this.triggeredFmp4Usage = true;\n }\n });\n this.audioSegmentLoader_.on('ended', () => {\n this.logger_('audioSegmentLoader ended');\n this.onEndOfStream();\n });\n const segmentLoaderEvents = ['segmentselected', 'segmentloadstart', 'segmentloaded', 'segmentkeyloadstart', 'segmentkeyloadcomplete', 'segmentdecryptionstart', 'segmentdecryptioncomplete', 'segmenttransmuxingstart', 'segmenttransmuxingcomplete', 'segmenttransmuxingtrackinfoavailable', 'segmenttransmuxingtiminginfoavailable', 'segmentappendstart', 'appendsdone', 'bandwidthupdated', 'timelinechange', 'codecschange'];\n segmentLoaderEvents.forEach(eventName => {\n this.mainSegmentLoader_.on(eventName, metadata => {\n this.player_.trigger(_extends({}, metadata));\n });\n this.audioSegmentLoader_.on(eventName, metadata => {\n this.player_.trigger(_extends({}, metadata));\n });\n this.subtitleSegmentLoader_.on(eventName, metadata => {\n this.player_.trigger(_extends({}, metadata));\n });\n });\n }\n mediaSecondsLoaded_() {\n return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded);\n }\n /**\n * Call load on our SegmentLoaders\n */\n\n load() {\n this.mainSegmentLoader_.load();\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n this.audioSegmentLoader_.load();\n }\n if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {\n this.subtitleSegmentLoader_.load();\n }\n }\n /**\n * Call pause on our SegmentLoaders\n */\n\n pause() {\n this.mainSegmentLoader_.pause();\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n this.audioSegmentLoader_.pause();\n }\n if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {\n this.subtitleSegmentLoader_.pause();\n }\n }\n /**\n * Re-tune playback quality level for the current player\n * conditions. This method will perform destructive actions like removing\n * already buffered content in order to readjust the currently active\n * playlist quickly. This is good for manual quality changes\n *\n * @private\n */\n\n fastQualityChange_(media = this.selectPlaylist()) {\n if (media && media === this.mainPlaylistLoader_.media()) {\n this.logger_('skipping fastQualityChange because new media is same as old');\n return;\n }\n this.switchMedia_(media, 'fast-quality'); // we would like to avoid race condition when we call fastQuality,\n // reset everything and start loading segments from prev segments instead of new because new playlist is not received yet\n\n this.waitingForFastQualityPlaylistReceived_ = true;\n }\n runFastQualitySwitch_() {\n this.waitingForFastQualityPlaylistReceived_ = false;\n this.mainSegmentLoader_.pause();\n this.mainSegmentLoader_.resetEverything();\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n this.audioSegmentLoader_.pause();\n this.audioSegmentLoader_.resetEverything();\n }\n if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {\n this.subtitleSegmentLoader_.pause();\n this.subtitleSegmentLoader_.resetEverything();\n } // start segment loader loading in case they are paused\n\n this.load();\n }\n /**\n * Begin playback.\n */\n\n play() {\n if (this.setupFirstPlay()) {\n return;\n }\n if (this.tech_.ended()) {\n this.tech_.setCurrentTime(0);\n }\n if (this.hasPlayed_) {\n this.load();\n }\n const seekable = this.tech_.seekable(); // if the viewer has paused and we fell out of the live window,\n // seek forward to the live point\n\n if (this.tech_.duration() === Infinity) {\n if (this.tech_.currentTime() < seekable.start(0)) {\n return this.tech_.setCurrentTime(seekable.end(seekable.length - 1));\n }\n }\n }\n /**\n * Seek to the latest media position if this is a live video and the\n * player and video are loaded and initialized.\n */\n\n setupFirstPlay() {\n const media = this.mainPlaylistLoader_.media(); // Check that everything is ready to begin buffering for the first call to play\n // If 1) there is no active media\n // 2) the player is paused\n // 3) the first play has already been setup\n // then exit early\n\n if (!media || this.tech_.paused() || this.hasPlayed_) {\n return false;\n } // when the video is a live stream and/or has a start time\n\n if (!media.endList || media.start) {\n const seekable = this.seekable();\n if (!seekable.length) {\n // without a seekable range, the player cannot seek to begin buffering at the\n // live or start point\n return false;\n }\n const seekableEnd = seekable.end(0);\n let startPoint = seekableEnd;\n if (media.start) {\n const offset = media.start.timeOffset;\n if (offset < 0) {\n startPoint = Math.max(seekableEnd + offset, seekable.start(0));\n } else {\n startPoint = Math.min(seekableEnd, offset);\n }\n } // trigger firstplay to inform the source handler to ignore the next seek event\n\n this.trigger('firstplay'); // seek to the live point\n\n this.tech_.setCurrentTime(startPoint);\n }\n this.hasPlayed_ = true; // we can begin loading now that everything is ready\n\n this.load();\n return true;\n }\n /**\n * handle the sourceopen event on the MediaSource\n *\n * @private\n */\n\n handleSourceOpen_() {\n // Only attempt to create the source buffer if none already exist.\n // handleSourceOpen is also called when we are \"re-opening\" a source buffer\n // after `endOfStream` has been called (in response to a seek for instance)\n this.tryToCreateSourceBuffers_(); // if autoplay is enabled, begin playback. This is duplicative of\n // code in video.js but is required because play() must be invoked\n // *after* the media source has opened.\n\n if (this.tech_.autoplay()) {\n const playPromise = this.tech_.play(); // Catch/silence error when a pause interrupts a play request\n // on browsers which return a promise\n\n if (typeof playPromise !== 'undefined' && typeof playPromise.then === 'function') {\n playPromise.then(null, e => {});\n }\n }\n this.trigger('sourceopen');\n }\n /**\n * handle the sourceended event on the MediaSource\n *\n * @private\n */\n\n handleSourceEnded_() {\n if (!this.inbandTextTracks_.metadataTrack_) {\n return;\n }\n const cues = this.inbandTextTracks_.metadataTrack_.cues;\n if (!cues || !cues.length) {\n return;\n }\n const duration = this.duration();\n cues[cues.length - 1].endTime = isNaN(duration) || Math.abs(duration) === Infinity ? Number.MAX_VALUE : duration;\n }\n /**\n * handle the durationchange event on the MediaSource\n *\n * @private\n */\n\n handleDurationChange_() {\n this.tech_.trigger('durationchange');\n }\n /**\n * Calls endOfStream on the media source when all active stream types have called\n * endOfStream\n *\n * @param {string} streamType\n * Stream type of the segment loader that called endOfStream\n * @private\n */\n\n onEndOfStream() {\n let isEndOfStream = this.mainSegmentLoader_.ended_;\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n const mainMediaInfo = this.mainSegmentLoader_.getCurrentMediaInfo_(); // if the audio playlist loader exists, then alternate audio is active\n\n if (!mainMediaInfo || mainMediaInfo.hasVideo) {\n // if we do not know if the main segment loader contains video yet or if we\n // definitively know the main segment loader contains video, then we need to wait\n // for both main and audio segment loaders to call endOfStream\n isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_;\n } else {\n // otherwise just rely on the audio loader\n isEndOfStream = this.audioSegmentLoader_.ended_;\n }\n }\n if (!isEndOfStream) {\n return;\n }\n this.stopABRTimer_();\n this.sourceUpdater_.endOfStream();\n }\n /**\n * Check if a playlist has stopped being updated\n *\n * @param {Object} playlist the media playlist object\n * @return {boolean} whether the playlist has stopped being updated or not\n */\n\n stuckAtPlaylistEnd_(playlist) {\n const seekable = this.seekable();\n if (!seekable.length) {\n // playlist doesn't have enough information to determine whether we are stuck\n return false;\n }\n const expired = this.syncController_.getExpiredTime(playlist, this.duration());\n if (expired === null) {\n return false;\n } // does not use the safe live end to calculate playlist end, since we\n // don't want to say we are stuck while there is still content\n\n const absolutePlaylistEnd = Vhs$1.Playlist.playlistEnd(playlist, expired);\n const currentTime = this.tech_.currentTime();\n const buffered = this.tech_.buffered();\n if (!buffered.length) {\n // return true if the playhead reached the absolute end of the playlist\n return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA;\n }\n const bufferedEnd = buffered.end(buffered.length - 1); // return true if there is too little buffer left and buffer has reached absolute\n // end of playlist\n\n return bufferedEnd - currentTime <= SAFE_TIME_DELTA && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA;\n }\n /**\n * Exclude a playlist for a set amount of time, making it unavailable for selection by\n * the rendition selection algorithm, then force a new playlist (rendition) selection.\n *\n * @param {Object=} playlistToExclude\n * the playlist to exclude, defaults to the currently selected playlist\n * @param {Object=} error\n * an optional error\n * @param {number=} playlistExclusionDuration\n * an optional number of seconds to exclude the playlist\n */\n\n excludePlaylist({\n playlistToExclude = this.mainPlaylistLoader_.media(),\n error = {},\n playlistExclusionDuration\n }) {\n // If the `error` was generated by the playlist loader, it will contain\n // the playlist we were trying to load (but failed) and that should be\n // excluded instead of the currently selected playlist which is likely\n // out-of-date in this scenario\n playlistToExclude = playlistToExclude || this.mainPlaylistLoader_.media();\n playlistExclusionDuration = playlistExclusionDuration || error.playlistExclusionDuration || this.playlistExclusionDuration; // If there is no current playlist, then an error occurred while we were\n // trying to load the main OR while we were disposing of the tech\n\n if (!playlistToExclude) {\n this.error = error;\n if (this.mediaSource.readyState !== 'open') {\n this.trigger('error');\n } else {\n this.sourceUpdater_.endOfStream('network');\n }\n return;\n }\n playlistToExclude.playlistErrors_++;\n const playlists = this.mainPlaylistLoader_.main.playlists;\n const enabledPlaylists = playlists.filter(isEnabled);\n const isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === playlistToExclude; // Don't exclude the only playlist unless it was excluded\n // forever\n\n if (playlists.length === 1 && playlistExclusionDuration !== Infinity) {\n videojs.log.warn(`Problem encountered with playlist ${playlistToExclude.id}. ` + 'Trying again since it is the only playlist.');\n this.tech_.trigger('retryplaylist'); // if this is a final rendition, we should delay\n\n return this.mainPlaylistLoader_.load(isFinalRendition);\n }\n if (isFinalRendition) {\n // If we're content steering, try other pathways.\n if (this.main().contentSteering) {\n const pathway = this.pathwayAttribute_(playlistToExclude); // Ignore at least 1 steering manifest refresh.\n\n const reIncludeDelay = this.contentSteeringController_.steeringManifest.ttl * 1000;\n this.contentSteeringController_.excludePathway(pathway);\n this.excludeThenChangePathway_();\n setTimeout(() => {\n this.contentSteeringController_.addAvailablePathway(pathway);\n }, reIncludeDelay);\n return;\n } // Since we're on the final non-excluded playlist, and we're about to exclude\n // it, instead of erring the player or retrying this playlist, clear out the current\n // exclusion list. This allows other playlists to be attempted in case any have been\n // fixed.\n\n let reincluded = false;\n playlists.forEach(playlist => {\n // skip current playlist which is about to be excluded\n if (playlist === playlistToExclude) {\n return;\n }\n const excludeUntil = playlist.excludeUntil; // a playlist cannot be reincluded if it wasn't excluded to begin with.\n\n if (typeof excludeUntil !== 'undefined' && excludeUntil !== Infinity) {\n reincluded = true;\n delete playlist.excludeUntil;\n }\n });\n if (reincluded) {\n videojs.log.warn('Removing other playlists from the exclusion list because the last ' + 'rendition is about to be excluded.'); // Technically we are retrying a playlist, in that we are simply retrying a previous\n // playlist. This is needed for users relying on the retryplaylist event to catch a\n // case where the player might be stuck and looping through \"dead\" playlists.\n\n this.tech_.trigger('retryplaylist');\n }\n } // Exclude this playlist\n\n let excludeUntil;\n if (playlistToExclude.playlistErrors_ > this.maxPlaylistRetries) {\n excludeUntil = Infinity;\n } else {\n excludeUntil = Date.now() + playlistExclusionDuration * 1000;\n }\n playlistToExclude.excludeUntil = excludeUntil;\n if (error.reason) {\n playlistToExclude.lastExcludeReason_ = error.reason;\n }\n this.tech_.trigger('excludeplaylist');\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-rendition-excluded'\n }); // TODO: only load a new playlist if we're excluding the current playlist\n // If this function was called with a playlist that's not the current active playlist\n // (e.g., media().id !== playlistToExclude.id),\n // then a new playlist should not be selected and loaded, as there's nothing wrong with the current playlist.\n\n const nextPlaylist = this.selectPlaylist();\n if (!nextPlaylist) {\n this.error = 'Playback cannot continue. No available working or supported playlists.';\n this.trigger('error');\n return;\n }\n const logFn = error.internal ? this.logger_ : videojs.log.warn;\n const errorMessage = error.message ? ' ' + error.message : '';\n logFn(`${error.internal ? 'Internal problem' : 'Problem'} encountered with playlist ${playlistToExclude.id}.` + `${errorMessage} Switching to playlist ${nextPlaylist.id}.`); // if audio group changed reset audio loaders\n\n if (nextPlaylist.attributes.AUDIO !== playlistToExclude.attributes.AUDIO) {\n this.delegateLoaders_('audio', ['abort', 'pause']);\n } // if subtitle group changed reset subtitle loaders\n\n if (nextPlaylist.attributes.SUBTITLES !== playlistToExclude.attributes.SUBTITLES) {\n this.delegateLoaders_('subtitle', ['abort', 'pause']);\n }\n this.delegateLoaders_('main', ['abort', 'pause']);\n const delayDuration = nextPlaylist.targetDuration / 2 * 1000 || 5 * 1000;\n const shouldDelay = typeof nextPlaylist.lastRequest === 'number' && Date.now() - nextPlaylist.lastRequest <= delayDuration; // delay if it's a final rendition or if the last refresh is sooner than half targetDuration\n\n return this.switchMedia_(nextPlaylist, 'exclude', isFinalRendition || shouldDelay);\n }\n /**\n * Pause all segment/playlist loaders\n */\n\n pauseLoading() {\n this.delegateLoaders_('all', ['abort', 'pause']);\n this.stopABRTimer_();\n }\n /**\n * Call a set of functions in order on playlist loaders, segment loaders,\n * or both types of loaders.\n *\n * @param {string} filter\n * Filter loaders that should call fnNames using a string. Can be:\n * * all - run on all loaders\n * * audio - run on all audio loaders\n * * subtitle - run on all subtitle loaders\n * * main - run on the main loaders\n *\n * @param {Array|string} fnNames\n * A string or array of function names to call.\n */\n\n delegateLoaders_(filter, fnNames) {\n const loaders = [];\n const dontFilterPlaylist = filter === 'all';\n if (dontFilterPlaylist || filter === 'main') {\n loaders.push(this.mainPlaylistLoader_);\n }\n const mediaTypes = [];\n if (dontFilterPlaylist || filter === 'audio') {\n mediaTypes.push('AUDIO');\n }\n if (dontFilterPlaylist || filter === 'subtitle') {\n mediaTypes.push('CLOSED-CAPTIONS');\n mediaTypes.push('SUBTITLES');\n }\n mediaTypes.forEach(mediaType => {\n const loader = this.mediaTypes_[mediaType] && this.mediaTypes_[mediaType].activePlaylistLoader;\n if (loader) {\n loaders.push(loader);\n }\n });\n ['main', 'audio', 'subtitle'].forEach(name => {\n const loader = this[`${name}SegmentLoader_`];\n if (loader && (filter === name || filter === 'all')) {\n loaders.push(loader);\n }\n });\n loaders.forEach(loader => fnNames.forEach(fnName => {\n if (typeof loader[fnName] === 'function') {\n loader[fnName]();\n }\n }));\n }\n /**\n * set the current time on all segment loaders\n *\n * @param {TimeRange} currentTime the current time to set\n * @return {TimeRange} the current time\n */\n\n setCurrentTime(currentTime) {\n const buffered = findRange(this.tech_.buffered(), currentTime);\n if (!(this.mainPlaylistLoader_ && this.mainPlaylistLoader_.media())) {\n // return immediately if the metadata is not ready yet\n return 0;\n } // it's clearly an edge-case but don't thrown an error if asked to\n // seek within an empty playlist\n\n if (!this.mainPlaylistLoader_.media().segments) {\n return 0;\n } // if the seek location is already buffered, continue buffering as usual\n\n if (buffered && buffered.length) {\n return currentTime;\n } // cancel outstanding requests so we begin buffering at the new\n // location\n\n this.mainSegmentLoader_.pause();\n this.mainSegmentLoader_.resetEverything();\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n this.audioSegmentLoader_.pause();\n this.audioSegmentLoader_.resetEverything();\n }\n if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {\n this.subtitleSegmentLoader_.pause();\n this.subtitleSegmentLoader_.resetEverything();\n } // start segment loader loading in case they are paused\n\n this.load();\n }\n /**\n * get the current duration\n *\n * @return {TimeRange} the duration\n */\n\n duration() {\n if (!this.mainPlaylistLoader_) {\n return 0;\n }\n const media = this.mainPlaylistLoader_.media();\n if (!media) {\n // no playlists loaded yet, so can't determine a duration\n return 0;\n } // Don't rely on the media source for duration in the case of a live playlist since\n // setting the native MediaSource's duration to infinity ends up with consequences to\n // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details.\n //\n // This is resolved in the spec by https://github.com/w3c/media-source/pull/92,\n // however, few browsers have support for setLiveSeekableRange()\n // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange\n //\n // Until a time when the duration of the media source can be set to infinity, and a\n // seekable range specified across browsers, just return Infinity.\n\n if (!media.endList) {\n return Infinity;\n } // Since this is a VOD video, it is safe to rely on the media source's duration (if\n // available). If it's not available, fall back to a playlist-calculated estimate.\n\n if (this.mediaSource) {\n return this.mediaSource.duration;\n }\n return Vhs$1.Playlist.duration(media);\n }\n /**\n * check the seekable range\n *\n * @return {TimeRange} the seekable range\n */\n\n seekable() {\n return this.seekable_;\n }\n getSeekableRange_(playlistLoader, mediaType) {\n const media = playlistLoader.media();\n if (!media) {\n return null;\n }\n const mediaSequenceSync = this.syncController_.getMediaSequenceSync(mediaType);\n if (mediaSequenceSync && mediaSequenceSync.isReliable) {\n const start = mediaSequenceSync.start;\n const end = mediaSequenceSync.end;\n if (!isFinite(start) || !isFinite(end)) {\n return null;\n }\n const liveEdgeDelay = Vhs$1.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main, media); // Make sure our seekable end is not negative\n\n const calculatedEnd = Math.max(0, end - liveEdgeDelay);\n if (calculatedEnd < start) {\n return null;\n }\n return createTimeRanges([[start, calculatedEnd]]);\n }\n const expired = this.syncController_.getExpiredTime(media, this.duration());\n if (expired === null) {\n return null;\n }\n const seekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main, media));\n return seekable.length ? seekable : null;\n }\n computeFinalSeekable_(mainSeekable, audioSeekable) {\n if (!audioSeekable) {\n return mainSeekable;\n }\n const mainStart = mainSeekable.start(0);\n const mainEnd = mainSeekable.end(0);\n const audioStart = audioSeekable.start(0);\n const audioEnd = audioSeekable.end(0);\n if (audioStart > mainEnd || mainStart > audioEnd) {\n // Seekables are far apart, rely on main\n return mainSeekable;\n } // Return the overlapping seekable range\n\n return createTimeRanges([[Math.max(mainStart, audioStart), Math.min(mainEnd, audioEnd)]]);\n }\n onSyncInfoUpdate_() {\n // TODO check for creation of both source buffers before updating seekable\n //\n // A fix was made to this function where a check for\n // this.sourceUpdater_.hasCreatedSourceBuffers\n // was added to ensure that both source buffers were created before seekable was\n // updated. However, it originally had a bug where it was checking for a true and\n // returning early instead of checking for false. Setting it to check for false to\n // return early though created other issues. A call to play() would check for seekable\n // end without verifying that a seekable range was present. In addition, even checking\n // for that didn't solve some issues, as handleFirstPlay is sometimes worked around\n // due to a media update calling load on the segment loaders, skipping a seek to live,\n // thereby starting live streams at the beginning of the stream rather than at the end.\n //\n // This conditional should be fixed to wait for the creation of two source buffers at\n // the same time as the other sections of code are fixed to properly seek to live and\n // not throw an error due to checking for a seekable end when no seekable range exists.\n //\n // For now, fall back to the older behavior, with the understanding that the seekable\n // range may not be completely correct, leading to a suboptimal initial live point.\n if (!this.mainPlaylistLoader_) {\n return;\n }\n const mainSeekable = this.getSeekableRange_(this.mainPlaylistLoader_, 'main');\n if (!mainSeekable) {\n return;\n }\n let audioSeekable;\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n audioSeekable = this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader, 'audio');\n if (!audioSeekable) {\n return;\n }\n }\n const oldSeekable = this.seekable_;\n this.seekable_ = this.computeFinalSeekable_(mainSeekable, audioSeekable);\n if (!this.seekable_) {\n return;\n }\n if (oldSeekable && oldSeekable.length && this.seekable_.length) {\n if (oldSeekable.start(0) === this.seekable_.start(0) && oldSeekable.end(0) === this.seekable_.end(0)) {\n // Seekable range hasn't changed\n return;\n }\n }\n this.logger_(`seekable updated [${printableRange(this.seekable_)}]`);\n const metadata = {\n seekableRanges: this.seekable_\n };\n this.trigger({\n type: 'seekablerangeschanged',\n metadata\n });\n this.tech_.trigger('seekablechanged');\n }\n /**\n * Update the player duration\n */\n\n updateDuration(isLive) {\n if (this.updateDuration_) {\n this.mediaSource.removeEventListener('sourceopen', this.updateDuration_);\n this.updateDuration_ = null;\n }\n if (this.mediaSource.readyState !== 'open') {\n this.updateDuration_ = this.updateDuration.bind(this, isLive);\n this.mediaSource.addEventListener('sourceopen', this.updateDuration_);\n return;\n }\n if (isLive) {\n const seekable = this.seekable();\n if (!seekable.length) {\n return;\n } // Even in the case of a live playlist, the native MediaSource's duration should not\n // be set to Infinity (even though this would be expected for a live playlist), since\n // setting the native MediaSource's duration to infinity ends up with consequences to\n // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details.\n //\n // This is resolved in the spec by https://github.com/w3c/media-source/pull/92,\n // however, few browsers have support for setLiveSeekableRange()\n // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange\n //\n // Until a time when the duration of the media source can be set to infinity, and a\n // seekable range specified across browsers, the duration should be greater than or\n // equal to the last possible seekable value.\n // MediaSource duration starts as NaN\n // It is possible (and probable) that this case will never be reached for many\n // sources, since the MediaSource reports duration as the highest value without\n // accounting for timestamp offset. For example, if the timestamp offset is -100 and\n // we buffered times 0 to 100 with real times of 100 to 200, even though current\n // time will be between 0 and 100, the native media source may report the duration\n // as 200. However, since we report duration separate from the media source (as\n // Infinity), and as long as the native media source duration value is greater than\n // our reported seekable range, seeks will work as expected. The large number as\n // duration for live is actually a strategy used by some players to work around the\n // issue of live seekable ranges cited above.\n\n if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable.end(seekable.length - 1)) {\n this.sourceUpdater_.setDuration(seekable.end(seekable.length - 1));\n }\n return;\n }\n const buffered = this.tech_.buffered();\n let duration = Vhs$1.Playlist.duration(this.mainPlaylistLoader_.media());\n if (buffered.length > 0) {\n duration = Math.max(duration, buffered.end(buffered.length - 1));\n }\n if (this.mediaSource.duration !== duration) {\n this.sourceUpdater_.setDuration(duration);\n }\n }\n /**\n * dispose of the PlaylistController and everything\n * that it controls\n */\n\n dispose() {\n this.trigger('dispose');\n this.decrypter_.terminate();\n this.mainPlaylistLoader_.dispose();\n this.mainSegmentLoader_.dispose();\n this.contentSteeringController_.dispose();\n this.keyStatusMap_.clear();\n if (this.loadOnPlay_) {\n this.tech_.off('play', this.loadOnPlay_);\n }\n ['AUDIO', 'SUBTITLES'].forEach(type => {\n const groups = this.mediaTypes_[type].groups;\n for (const id in groups) {\n groups[id].forEach(group => {\n if (group.playlistLoader) {\n group.playlistLoader.dispose();\n }\n });\n }\n });\n this.audioSegmentLoader_.dispose();\n this.subtitleSegmentLoader_.dispose();\n this.sourceUpdater_.dispose();\n this.timelineChangeController_.dispose();\n this.stopABRTimer_();\n if (this.updateDuration_) {\n this.mediaSource.removeEventListener('sourceopen', this.updateDuration_);\n }\n this.mediaSource.removeEventListener('durationchange', this.handleDurationChange_); // load the media source into the player\n\n this.mediaSource.removeEventListener('sourceopen', this.handleSourceOpen_);\n this.mediaSource.removeEventListener('sourceended', this.handleSourceEnded_);\n this.off();\n }\n /**\n * return the main playlist object if we have one\n *\n * @return {Object} the main playlist object that we parsed\n */\n\n main() {\n return this.mainPlaylistLoader_.main;\n }\n /**\n * return the currently selected playlist\n *\n * @return {Object} the currently selected playlist object that we parsed\n */\n\n media() {\n // playlist loader will not return media if it has not been fully loaded\n return this.mainPlaylistLoader_.media() || this.initialMedia_;\n }\n areMediaTypesKnown_() {\n const usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;\n const hasMainMediaInfo = !!this.mainSegmentLoader_.getCurrentMediaInfo_(); // if we are not using an audio loader, then we have audio media info\n // otherwise check on the segment loader.\n\n const hasAudioMediaInfo = !usingAudioLoader ? true : !!this.audioSegmentLoader_.getCurrentMediaInfo_(); // one or both loaders has not loaded sufficently to get codecs\n\n if (!hasMainMediaInfo || !hasAudioMediaInfo) {\n return false;\n }\n return true;\n } // find from and to for codec switch event\n\n getCodecsOrExclude_() {\n const media = {\n main: this.mainSegmentLoader_.getCurrentMediaInfo_() || {},\n audio: this.audioSegmentLoader_.getCurrentMediaInfo_() || {}\n };\n const playlist = this.mainSegmentLoader_.getPendingSegmentPlaylist() || this.media(); // set \"main\" media equal to video\n\n media.video = media.main;\n const playlistCodecs = codecsForPlaylist(this.main(), playlist);\n const codecs = {};\n const usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;\n if (media.main.hasVideo) {\n codecs.video = playlistCodecs.video || media.main.videoCodec || DEFAULT_VIDEO_CODEC;\n }\n if (media.main.isMuxed) {\n codecs.video += `,${playlistCodecs.audio || media.main.audioCodec || DEFAULT_AUDIO_CODEC}`;\n }\n if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) {\n codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || DEFAULT_AUDIO_CODEC; // set audio isFmp4 so we use the correct \"supports\" function below\n\n media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4;\n } // no codecs, no playback.\n\n if (!codecs.audio && !codecs.video) {\n this.excludePlaylist({\n playlistToExclude: playlist,\n error: {\n message: 'Could not determine codecs for playlist.'\n },\n playlistExclusionDuration: Infinity\n });\n return;\n } // fmp4 relies on browser support, while ts relies on muxer support\n\n const supportFunction = (isFmp4, codec) => isFmp4 ? browserSupportsCodec(codec, this.usingManagedMediaSource_) : muxerSupportsCodec(codec);\n const unsupportedCodecs = {};\n let unsupportedAudio;\n ['video', 'audio'].forEach(function (type) {\n if (codecs.hasOwnProperty(type) && !supportFunction(media[type].isFmp4, codecs[type])) {\n const supporter = media[type].isFmp4 ? 'browser' : 'muxer';\n unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || [];\n unsupportedCodecs[supporter].push(codecs[type]);\n if (type === 'audio') {\n unsupportedAudio = supporter;\n }\n }\n });\n if (usingAudioLoader && unsupportedAudio && playlist.attributes.AUDIO) {\n const audioGroup = playlist.attributes.AUDIO;\n this.main().playlists.forEach(variant => {\n const variantAudioGroup = variant.attributes && variant.attributes.AUDIO;\n if (variantAudioGroup === audioGroup && variant !== playlist) {\n variant.excludeUntil = Infinity;\n }\n });\n this.logger_(`excluding audio group ${audioGroup} as ${unsupportedAudio} does not support codec(s): \"${codecs.audio}\"`);\n } // if we have any unsupported codecs exclude this playlist.\n\n if (Object.keys(unsupportedCodecs).length) {\n const message = Object.keys(unsupportedCodecs).reduce((acc, supporter) => {\n if (acc) {\n acc += ', ';\n }\n acc += `${supporter} does not support codec(s): \"${unsupportedCodecs[supporter].join(',')}\"`;\n return acc;\n }, '') + '.';\n this.excludePlaylist({\n playlistToExclude: playlist,\n error: {\n internal: true,\n message\n },\n playlistExclusionDuration: Infinity\n });\n return;\n } // check if codec switching is happening\n\n if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) {\n const switchMessages = [];\n ['video', 'audio'].forEach(type => {\n const newCodec = (parseCodecs(this.sourceUpdater_.codecs[type] || '')[0] || {}).type;\n const oldCodec = (parseCodecs(codecs[type] || '')[0] || {}).type;\n if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) {\n switchMessages.push(`\"${this.sourceUpdater_.codecs[type]}\" -> \"${codecs[type]}\"`);\n }\n });\n if (switchMessages.length) {\n this.excludePlaylist({\n playlistToExclude: playlist,\n error: {\n message: `Codec switching not supported: ${switchMessages.join(', ')}.`,\n internal: true\n },\n playlistExclusionDuration: Infinity\n });\n return;\n }\n } // TODO: when using the muxer shouldn't we just return\n // the codecs that the muxer outputs?\n\n return codecs;\n }\n /**\n * Create source buffers and exlude any incompatible renditions.\n *\n * @private\n */\n\n tryToCreateSourceBuffers_() {\n // media source is not ready yet or sourceBuffers are already\n // created.\n if (this.mediaSource.readyState !== 'open' || this.sourceUpdater_.hasCreatedSourceBuffers()) {\n return;\n }\n if (!this.areMediaTypesKnown_()) {\n return;\n }\n const codecs = this.getCodecsOrExclude_(); // no codecs means that the playlist was excluded\n\n if (!codecs) {\n return;\n }\n this.sourceUpdater_.createSourceBuffers(codecs);\n const codecString = [codecs.video, codecs.audio].filter(Boolean).join(',');\n this.excludeIncompatibleVariants_(codecString);\n }\n /**\n * Excludes playlists with codecs that are unsupported by the muxer and browser.\n */\n\n excludeUnsupportedVariants_() {\n const playlists = this.main().playlists;\n const ids = []; // TODO: why don't we have a property to loop through all\n // playlist? Why did we ever mix indexes and keys?\n\n Object.keys(playlists).forEach(key => {\n const variant = playlists[key]; // check if we already processed this playlist.\n\n if (ids.indexOf(variant.id) !== -1) {\n return;\n }\n ids.push(variant.id);\n const codecs = codecsForPlaylist(this.main, variant);\n const unsupported = [];\n if (codecs.audio && !muxerSupportsCodec(codecs.audio) && !browserSupportsCodec(codecs.audio, this.usingManagedMediaSource_)) {\n unsupported.push(`audio codec ${codecs.audio}`);\n }\n if (codecs.video && !muxerSupportsCodec(codecs.video) && !browserSupportsCodec(codecs.video, this.usingManagedMediaSource_)) {\n unsupported.push(`video codec ${codecs.video}`);\n }\n if (codecs.text && codecs.text === 'stpp.ttml.im1t') {\n unsupported.push(`text codec ${codecs.text}`);\n }\n if (unsupported.length) {\n variant.excludeUntil = Infinity;\n this.logger_(`excluding ${variant.id} for unsupported: ${unsupported.join(', ')}`);\n }\n });\n }\n /**\n * Exclude playlists that are known to be codec or\n * stream-incompatible with the SourceBuffer configuration. For\n * instance, Media Source Extensions would cause the video element to\n * stall waiting for video data if you switched from a variant with\n * video and audio to an audio-only one.\n *\n * @param {Object} media a media playlist compatible with the current\n * set of SourceBuffers. Variants in the current main playlist that\n * do not appear to have compatible codec or stream configurations\n * will be excluded from the default playlist selection algorithm\n * indefinitely.\n * @private\n */\n\n excludeIncompatibleVariants_(codecString) {\n const ids = [];\n const playlists = this.main().playlists;\n const codecs = unwrapCodecList(parseCodecs(codecString));\n const codecCount_ = codecCount(codecs);\n const videoDetails = codecs.video && parseCodecs(codecs.video)[0] || null;\n const audioDetails = codecs.audio && parseCodecs(codecs.audio)[0] || null;\n Object.keys(playlists).forEach(key => {\n const variant = playlists[key]; // check if we already processed this playlist.\n // or it if it is already excluded forever.\n\n if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) {\n return;\n }\n ids.push(variant.id);\n const exclusionReasons = []; // get codecs from the playlist for this variant\n\n const variantCodecs = codecsForPlaylist(this.mainPlaylistLoader_.main, variant);\n const variantCodecCount = codecCount(variantCodecs); // if no codecs are listed, we cannot determine that this\n // variant is incompatible. Wait for mux.js to probe\n\n if (!variantCodecs.audio && !variantCodecs.video) {\n return;\n } // TODO: we can support this by removing the\n // old media source and creating a new one, but it will take some work.\n // The number of streams cannot change\n\n if (variantCodecCount !== codecCount_) {\n exclusionReasons.push(`codec count \"${variantCodecCount}\" !== \"${codecCount_}\"`);\n } // only exclude playlists by codec change, if codecs cannot switch\n // during playback.\n\n if (!this.sourceUpdater_.canChangeType()) {\n const variantVideoDetails = variantCodecs.video && parseCodecs(variantCodecs.video)[0] || null;\n const variantAudioDetails = variantCodecs.audio && parseCodecs(variantCodecs.audio)[0] || null; // the video codec cannot change\n\n if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) {\n exclusionReasons.push(`video codec \"${variantVideoDetails.type}\" !== \"${videoDetails.type}\"`);\n } // the audio codec cannot change\n\n if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) {\n exclusionReasons.push(`audio codec \"${variantAudioDetails.type}\" !== \"${audioDetails.type}\"`);\n }\n }\n if (exclusionReasons.length) {\n variant.excludeUntil = Infinity;\n this.logger_(`excluding ${variant.id}: ${exclusionReasons.join(' && ')}`);\n }\n });\n }\n updateAdCues_(media) {\n let offset = 0;\n const seekable = this.seekable();\n if (seekable.length) {\n offset = seekable.start(0);\n }\n updateAdCues(media, this.cueTagsTrack_, offset);\n }\n /**\n * Calculates the desired forward buffer length based on current time\n *\n * @return {number} Desired forward buffer length in seconds\n */\n\n goalBufferLength() {\n const currentTime = this.tech_.currentTime();\n const initial = Config.GOAL_BUFFER_LENGTH;\n const rate = Config.GOAL_BUFFER_LENGTH_RATE;\n const max = Math.max(initial, Config.MAX_GOAL_BUFFER_LENGTH);\n return Math.min(initial + currentTime * rate, max);\n }\n /**\n * Calculates the desired buffer low water line based on current time\n *\n * @return {number} Desired buffer low water line in seconds\n */\n\n bufferLowWaterLine() {\n const currentTime = this.tech_.currentTime();\n const initial = Config.BUFFER_LOW_WATER_LINE;\n const rate = Config.BUFFER_LOW_WATER_LINE_RATE;\n const max = Math.max(initial, Config.MAX_BUFFER_LOW_WATER_LINE);\n const newMax = Math.max(initial, Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);\n return Math.min(initial + currentTime * rate, this.bufferBasedABR ? newMax : max);\n }\n bufferHighWaterLine() {\n return Config.BUFFER_HIGH_WATER_LINE;\n }\n addDateRangesToTextTrack_(dateRanges) {\n createMetadataTrackIfNotExists(this.inbandTextTracks_, 'com.apple.streaming', this.tech_);\n addDateRangeMetadata({\n inbandTextTracks: this.inbandTextTracks_,\n dateRanges\n });\n }\n addMetadataToTextTrack(dispatchType, metadataArray, videoDuration) {\n const timestampOffset = this.sourceUpdater_.videoBuffer ? this.sourceUpdater_.videoTimestampOffset() : this.sourceUpdater_.audioTimestampOffset(); // There's potentially an issue where we could double add metadata if there's a muxed\n // audio/video source with a metadata track, and an alt audio with a metadata track.\n // However, this probably won't happen, and if it does it can be handled then.\n\n createMetadataTrackIfNotExists(this.inbandTextTracks_, dispatchType, this.tech_);\n addMetadata({\n inbandTextTracks: this.inbandTextTracks_,\n metadataArray,\n timestampOffset,\n videoDuration\n });\n }\n /**\n * Utility for getting the pathway or service location from an HLS or DASH playlist.\n *\n * @param {Object} playlist for getting pathway from.\n * @return the pathway attribute of a playlist\n */\n\n pathwayAttribute_(playlist) {\n return playlist.attributes['PATHWAY-ID'] || playlist.attributes.serviceLocation;\n }\n /**\n * Initialize available pathways and apply the tag properties.\n */\n\n initContentSteeringController_() {\n const main = this.main();\n if (!main.contentSteering) {\n return;\n }\n for (const playlist of main.playlists) {\n this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(playlist));\n }\n this.contentSteeringController_.assignTagProperties(main.uri, main.contentSteering); // request the steering manifest immediately if queryBeforeStart is set.\n\n if (this.contentSteeringController_.queryBeforeStart) {\n // When queryBeforeStart is true, initial request should omit steering parameters.\n this.contentSteeringController_.requestSteeringManifest(true);\n return;\n } // otherwise start content steering after playback starts\n\n this.tech_.one('canplay', () => {\n this.contentSteeringController_.requestSteeringManifest();\n });\n }\n /**\n * Reset the content steering controller and re-init.\n */\n\n resetContentSteeringController_() {\n this.contentSteeringController_.clearAvailablePathways();\n this.contentSteeringController_.dispose();\n this.initContentSteeringController_();\n }\n /**\n * Attaches the listeners for content steering.\n */\n\n attachContentSteeringListeners_() {\n this.contentSteeringController_.on('content-steering', this.excludeThenChangePathway_.bind(this));\n const contentSteeringEvents = ['contentsteeringloadstart', 'contentsteeringloadcomplete', 'contentsteeringparsed'];\n contentSteeringEvents.forEach(eventName => {\n this.contentSteeringController_.on(eventName, metadata => {\n this.trigger(_extends({}, metadata));\n });\n });\n if (this.sourceType_ === 'dash') {\n this.mainPlaylistLoader_.on('loadedplaylist', () => {\n const main = this.main(); // check if steering tag or pathways changed.\n\n const didDashTagChange = this.contentSteeringController_.didDASHTagChange(main.uri, main.contentSteering);\n const didPathwaysChange = () => {\n const availablePathways = this.contentSteeringController_.getAvailablePathways();\n const newPathways = [];\n for (const playlist of main.playlists) {\n const serviceLocation = playlist.attributes.serviceLocation;\n if (serviceLocation) {\n newPathways.push(serviceLocation);\n if (!availablePathways.has(serviceLocation)) {\n return true;\n }\n }\n } // If we have no new serviceLocations and previously had availablePathways\n\n if (!newPathways.length && availablePathways.size) {\n return true;\n }\n return false;\n };\n if (didDashTagChange || didPathwaysChange()) {\n this.resetContentSteeringController_();\n }\n });\n }\n }\n /**\n * Simple exclude and change playlist logic for content steering.\n */\n\n excludeThenChangePathway_() {\n const currentPathway = this.contentSteeringController_.getPathway();\n if (!currentPathway) {\n return;\n }\n this.handlePathwayClones_();\n const main = this.main();\n const playlists = main.playlists;\n const ids = new Set();\n let didEnablePlaylists = false;\n Object.keys(playlists).forEach(key => {\n const variant = playlists[key];\n const pathwayId = this.pathwayAttribute_(variant);\n const differentPathwayId = pathwayId && currentPathway !== pathwayId;\n const steeringExclusion = variant.excludeUntil === Infinity && variant.lastExcludeReason_ === 'content-steering';\n if (steeringExclusion && !differentPathwayId) {\n delete variant.excludeUntil;\n delete variant.lastExcludeReason_;\n didEnablePlaylists = true;\n }\n const noExcludeUntil = !variant.excludeUntil && variant.excludeUntil !== Infinity;\n const shouldExclude = !ids.has(variant.id) && differentPathwayId && noExcludeUntil;\n if (!shouldExclude) {\n return;\n }\n ids.add(variant.id);\n variant.excludeUntil = Infinity;\n variant.lastExcludeReason_ = 'content-steering'; // TODO: kind of spammy, maybe move this.\n\n this.logger_(`excluding ${variant.id} for ${variant.lastExcludeReason_}`);\n });\n if (this.contentSteeringController_.manifestType_ === 'DASH') {\n Object.keys(this.mediaTypes_).forEach(key => {\n const type = this.mediaTypes_[key];\n if (type.activePlaylistLoader) {\n const currentPlaylist = type.activePlaylistLoader.media_; // Check if the current media playlist matches the current CDN\n\n if (currentPlaylist && currentPlaylist.attributes.serviceLocation !== currentPathway) {\n didEnablePlaylists = true;\n }\n }\n });\n }\n if (didEnablePlaylists) {\n this.changeSegmentPathway_();\n }\n }\n /**\n * Add, update, or delete playlists and media groups for\n * the pathway clones for HLS Content Steering.\n *\n * See https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/\n *\n * NOTE: Pathway cloning does not currently support the `PER_VARIANT_URIS` and\n * `PER_RENDITION_URIS` as we do not handle `STABLE-VARIANT-ID` or\n * `STABLE-RENDITION-ID` values.\n */\n\n handlePathwayClones_() {\n const main = this.main();\n const playlists = main.playlists;\n const currentPathwayClones = this.contentSteeringController_.currentPathwayClones;\n const nextPathwayClones = this.contentSteeringController_.nextPathwayClones;\n const hasClones = currentPathwayClones && currentPathwayClones.size || nextPathwayClones && nextPathwayClones.size;\n if (!hasClones) {\n return;\n }\n for (const [id, clone] of currentPathwayClones.entries()) {\n const newClone = nextPathwayClones.get(id); // Delete the old pathway clone.\n\n if (!newClone) {\n this.mainPlaylistLoader_.updateOrDeleteClone(clone);\n this.contentSteeringController_.excludePathway(id);\n }\n }\n for (const [id, clone] of nextPathwayClones.entries()) {\n const oldClone = currentPathwayClones.get(id); // Create a new pathway if it is a new pathway clone object.\n\n if (!oldClone) {\n const playlistsToClone = playlists.filter(p => {\n return p.attributes['PATHWAY-ID'] === clone['BASE-ID'];\n });\n playlistsToClone.forEach(p => {\n this.mainPlaylistLoader_.addClonePathway(clone, p);\n });\n this.contentSteeringController_.addAvailablePathway(id);\n continue;\n } // There have not been changes to the pathway clone object, so skip.\n\n if (this.equalPathwayClones_(oldClone, clone)) {\n continue;\n } // Update a preexisting cloned pathway.\n // True is set for the update flag.\n\n this.mainPlaylistLoader_.updateOrDeleteClone(clone, true);\n this.contentSteeringController_.addAvailablePathway(id);\n } // Deep copy contents of next to current pathways.\n\n this.contentSteeringController_.currentPathwayClones = new Map(JSON.parse(JSON.stringify([...nextPathwayClones])));\n }\n /**\n * Determines whether two pathway clone objects are equivalent.\n *\n * @param {Object} a The first pathway clone object.\n * @param {Object} b The second pathway clone object.\n * @return {boolean} True if the pathway clone objects are equal, false otherwise.\n */\n\n equalPathwayClones_(a, b) {\n if (a['BASE-ID'] !== b['BASE-ID'] || a.ID !== b.ID || a['URI-REPLACEMENT'].HOST !== b['URI-REPLACEMENT'].HOST) {\n return false;\n }\n const aParams = a['URI-REPLACEMENT'].PARAMS;\n const bParams = b['URI-REPLACEMENT'].PARAMS; // We need to iterate through both lists of params because one could be\n // missing a parameter that the other has.\n\n for (const p in aParams) {\n if (aParams[p] !== bParams[p]) {\n return false;\n }\n }\n for (const p in bParams) {\n if (aParams[p] !== bParams[p]) {\n return false;\n }\n }\n return true;\n }\n /**\n * Changes the current playlists for audio, video and subtitles after a new pathway\n * is chosen from content steering.\n */\n\n changeSegmentPathway_() {\n const nextPlaylist = this.selectPlaylist();\n this.pauseLoading(); // Switch audio and text track playlists if necessary in DASH\n\n if (this.contentSteeringController_.manifestType_ === 'DASH') {\n this.switchMediaForDASHContentSteering_();\n }\n this.switchMedia_(nextPlaylist, 'content-steering');\n }\n /**\n * Iterates through playlists and check their keyId set and compare with the\n * keyStatusMap, only enable playlists that have a usable key. If the playlist\n * has no keyId leave it enabled by default.\n */\n\n excludeNonUsablePlaylistsByKeyId_() {\n if (!this.mainPlaylistLoader_ || !this.mainPlaylistLoader_.main) {\n return;\n }\n let nonUsableKeyStatusCount = 0;\n const NON_USABLE = 'non-usable';\n this.mainPlaylistLoader_.main.playlists.forEach(playlist => {\n const keyIdSet = this.mainPlaylistLoader_.getKeyIdSet(playlist); // If the playlist doesn't have keyIDs lets not exclude it.\n\n if (!keyIdSet || !keyIdSet.size) {\n return;\n }\n keyIdSet.forEach(key => {\n const USABLE = 'usable';\n const hasUsableKeyStatus = this.keyStatusMap_.has(key) && this.keyStatusMap_.get(key) === USABLE;\n const nonUsableExclusion = playlist.lastExcludeReason_ === NON_USABLE && playlist.excludeUntil === Infinity;\n if (!hasUsableKeyStatus) {\n // Only exclude playlists that haven't already been excluded as non-usable.\n if (playlist.excludeUntil !== Infinity && playlist.lastExcludeReason_ !== NON_USABLE) {\n playlist.excludeUntil = Infinity;\n playlist.lastExcludeReason_ = NON_USABLE;\n this.logger_(`excluding playlist ${playlist.id} because the key ID ${key} doesn't exist in the keyStatusMap or is not ${USABLE}`);\n } // count all nonUsableKeyStatus\n\n nonUsableKeyStatusCount++;\n } else if (hasUsableKeyStatus && nonUsableExclusion) {\n delete playlist.excludeUntil;\n delete playlist.lastExcludeReason_;\n this.logger_(`enabling playlist ${playlist.id} because key ID ${key} is ${USABLE}`);\n }\n });\n }); // If for whatever reason every playlist has a non usable key status. Lets try re-including the SD renditions as a failsafe.\n\n if (nonUsableKeyStatusCount >= this.mainPlaylistLoader_.main.playlists.length) {\n this.mainPlaylistLoader_.main.playlists.forEach(playlist => {\n const isNonHD = playlist && playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height < 720;\n const excludedForNonUsableKey = playlist.excludeUntil === Infinity && playlist.lastExcludeReason_ === NON_USABLE;\n if (isNonHD && excludedForNonUsableKey) {\n // Only delete the excludeUntil so we don't try and re-exclude these playlists.\n delete playlist.excludeUntil;\n videojs.log.warn(`enabling non-HD playlist ${playlist.id} because all playlists were excluded due to ${NON_USABLE} key IDs`);\n }\n });\n }\n }\n /**\n * Adds a keystatus to the keystatus map, tries to convert to string if necessary.\n *\n * @param {any} keyId the keyId to add a status for\n * @param {string} status the status of the keyId\n */\n\n addKeyStatus_(keyId, status) {\n const isString = typeof keyId === 'string';\n const keyIdHexString = isString ? keyId : bufferToHexString(keyId);\n const formattedKeyIdString = keyIdHexString.slice(0, 32).toLowerCase();\n this.logger_(`KeyStatus '${status}' with key ID ${formattedKeyIdString} added to the keyStatusMap`);\n this.keyStatusMap_.set(formattedKeyIdString, status);\n }\n /**\n * Utility function for adding key status to the keyStatusMap and filtering usable encrypted playlists.\n *\n * @param {any} keyId the keyId from the keystatuschange event\n * @param {string} status the key status string\n */\n\n updatePlaylistByKeyStatus(keyId, status) {\n this.addKeyStatus_(keyId, status);\n if (!this.waitingForFastQualityPlaylistReceived_) {\n this.excludeNonUsableThenChangePlaylist_();\n } // Listen to loadedplaylist with a single listener and check for new contentProtection elements when a playlist is updated.\n\n this.mainPlaylistLoader_.off('loadedplaylist', this.excludeNonUsableThenChangePlaylist_.bind(this));\n this.mainPlaylistLoader_.on('loadedplaylist', this.excludeNonUsableThenChangePlaylist_.bind(this));\n }\n excludeNonUsableThenChangePlaylist_() {\n this.excludeNonUsablePlaylistsByKeyId_();\n this.fastQualityChange_();\n }\n}\n\n/**\n * Returns a function that acts as the Enable/disable playlist function.\n *\n * @param {PlaylistLoader} loader - The main playlist loader\n * @param {string} playlistID - id of the playlist\n * @param {Function} changePlaylistFn - A function to be called after a\n * playlist's enabled-state has been changed. Will NOT be called if a\n * playlist's enabled-state is unchanged\n * @param {boolean=} enable - Value to set the playlist enabled-state to\n * or if undefined returns the current enabled-state for the playlist\n * @return {Function} Function for setting/getting enabled\n */\n\nconst enableFunction = (loader, playlistID, changePlaylistFn) => enable => {\n const playlist = loader.main.playlists[playlistID];\n const incompatible = isIncompatible(playlist);\n const currentlyEnabled = isEnabled(playlist);\n if (typeof enable === 'undefined') {\n return currentlyEnabled;\n }\n if (enable) {\n delete playlist.disabled;\n } else {\n playlist.disabled = true;\n }\n const metadata = {\n renditionInfo: {\n id: playlistID,\n bandwidth: playlist.attributes.BANDWIDTH,\n resolution: playlist.attributes.RESOLUTION,\n codecs: playlist.attributes.CODECS\n },\n cause: 'fast-quality'\n };\n if (enable !== currentlyEnabled && !incompatible) {\n // Ensure the outside world knows about our changes\n if (enable) {\n // call fast quality change only when the playlist is enabled\n changePlaylistFn(playlist);\n loader.trigger({\n type: 'renditionenabled',\n metadata\n });\n } else {\n loader.trigger({\n type: 'renditiondisabled',\n metadata\n });\n }\n }\n return enable;\n};\n/**\n * The representation object encapsulates the publicly visible information\n * in a media playlist along with a setter/getter-type function (enabled)\n * for changing the enabled-state of a particular playlist entry\n *\n * @class Representation\n */\n\nclass Representation {\n constructor(vhsHandler, playlist, id) {\n const {\n playlistController_: pc\n } = vhsHandler;\n const qualityChangeFunction = pc.fastQualityChange_.bind(pc); // some playlist attributes are optional\n\n if (playlist.attributes) {\n const resolution = playlist.attributes.RESOLUTION;\n this.width = resolution && resolution.width;\n this.height = resolution && resolution.height;\n this.bandwidth = playlist.attributes.BANDWIDTH;\n this.frameRate = playlist.attributes['FRAME-RATE'];\n }\n this.codecs = codecsForPlaylist(pc.main(), playlist);\n this.playlist = playlist; // The id is simply the ordinality of the media playlist\n // within the main playlist\n\n this.id = id; // Partially-apply the enableFunction to create a playlist-\n // specific variant\n\n this.enabled = enableFunction(vhsHandler.playlists, playlist.id, qualityChangeFunction);\n }\n}\n/**\n * A mixin function that adds the `representations` api to an instance\n * of the VhsHandler class\n *\n * @param {VhsHandler} vhsHandler - An instance of VhsHandler to add the\n * representation API into\n */\n\nconst renditionSelectionMixin = function (vhsHandler) {\n // Add a single API-specific function to the VhsHandler instance\n vhsHandler.representations = () => {\n const main = vhsHandler.playlistController_.main();\n const playlists = isAudioOnly(main) ? vhsHandler.playlistController_.getAudioTrackPlaylists_() : main.playlists;\n if (!playlists) {\n return [];\n }\n return playlists.filter(media => !isIncompatible(media)).map((e, i) => new Representation(vhsHandler, e, e.id));\n };\n};\n\n/**\n * @file playback-watcher.js\n *\n * Playback starts, and now my watch begins. It shall not end until my death. I shall\n * take no wait, hold no uncleared timeouts, father no bad seeks. I shall wear no crowns\n * and win no glory. I shall live and die at my post. I am the corrector of the underflow.\n * I am the watcher of gaps. I am the shield that guards the realms of seekable. I pledge\n * my life and honor to the Playback Watch, for this Player and all the Players to come.\n */\n\nconst timerCancelEvents = ['seeking', 'seeked', 'pause', 'playing', 'error'];\n/**\n * @class PlaybackWatcher\n */\n\nclass PlaybackWatcher extends videojs.EventTarget {\n /**\n * Represents an PlaybackWatcher object.\n *\n * @class\n * @param {Object} options an object that includes the tech and settings\n */\n constructor(options) {\n super();\n this.playlistController_ = options.playlistController;\n this.tech_ = options.tech;\n this.seekable = options.seekable;\n this.allowSeeksWithinUnsafeLiveWindow = options.allowSeeksWithinUnsafeLiveWindow;\n this.liveRangeSafeTimeDelta = options.liveRangeSafeTimeDelta;\n this.media = options.media;\n this.playedRanges_ = [];\n this.consecutiveUpdates = 0;\n this.lastRecordedTime = null;\n this.checkCurrentTimeTimeout_ = null;\n this.logger_ = logger('PlaybackWatcher');\n this.logger_('initialize');\n const playHandler = () => this.monitorCurrentTime_();\n const canPlayHandler = () => this.monitorCurrentTime_();\n const waitingHandler = () => this.techWaiting_();\n const cancelTimerHandler = () => this.resetTimeUpdate_();\n const pc = this.playlistController_;\n const loaderTypes = ['main', 'subtitle', 'audio'];\n const loaderChecks = {};\n loaderTypes.forEach(type => {\n loaderChecks[type] = {\n reset: () => this.resetSegmentDownloads_(type),\n updateend: () => this.checkSegmentDownloads_(type)\n };\n pc[`${type}SegmentLoader_`].on('appendsdone', loaderChecks[type].updateend); // If a rendition switch happens during a playback stall where the buffer\n // isn't changing we want to reset. We cannot assume that the new rendition\n // will also be stalled, until after new appends.\n\n pc[`${type}SegmentLoader_`].on('playlistupdate', loaderChecks[type].reset); // Playback stalls should not be detected right after seeking.\n // This prevents one segment playlists (single vtt or single segment content)\n // from being detected as stalling. As the buffer will not change in those cases, since\n // the buffer is the entire video duration.\n\n this.tech_.on(['seeked', 'seeking'], loaderChecks[type].reset);\n });\n /**\n * We check if a seek was into a gap through the following steps:\n * 1. We get a seeking event and we do not get a seeked event. This means that\n * a seek was attempted but not completed.\n * 2. We run `fixesBadSeeks_` on segment loader appends. This means that we already\n * removed everything from our buffer and appended a segment, and should be ready\n * to check for gaps.\n */\n\n const setSeekingHandlers = fn => {\n ['main', 'audio'].forEach(type => {\n pc[`${type}SegmentLoader_`][fn]('appended', this.seekingAppendCheck_);\n });\n };\n this.seekingAppendCheck_ = () => {\n if (this.fixesBadSeeks_()) {\n this.consecutiveUpdates = 0;\n this.lastRecordedTime = this.tech_.currentTime();\n setSeekingHandlers('off');\n }\n };\n this.clearSeekingAppendCheck_ = () => setSeekingHandlers('off');\n this.watchForBadSeeking_ = () => {\n this.clearSeekingAppendCheck_();\n setSeekingHandlers('on');\n };\n this.tech_.on('seeked', this.clearSeekingAppendCheck_);\n this.tech_.on('seeking', this.watchForBadSeeking_);\n this.tech_.on('waiting', waitingHandler);\n this.tech_.on(timerCancelEvents, cancelTimerHandler);\n this.tech_.on('canplay', canPlayHandler);\n /*\n An edge case exists that results in gaps not being skipped when they exist at the beginning of a stream. This case\n is surfaced in one of two ways:\n 1) The `waiting` event is fired before the player has buffered content, making it impossible\n to find or skip the gap. The `waiting` event is followed by a `play` event. On first play\n we can check if playback is stalled due to a gap, and skip the gap if necessary.\n 2) A source with a gap at the beginning of the stream is loaded programatically while the player\n is in a playing state. To catch this case, it's important that our one-time play listener is setup\n even if the player is in a playing state\n */\n\n this.tech_.one('play', playHandler); // Define the dispose function to clean up our events\n\n this.dispose = () => {\n this.clearSeekingAppendCheck_();\n this.logger_('dispose');\n this.tech_.off('waiting', waitingHandler);\n this.tech_.off(timerCancelEvents, cancelTimerHandler);\n this.tech_.off('canplay', canPlayHandler);\n this.tech_.off('play', playHandler);\n this.tech_.off('seeking', this.watchForBadSeeking_);\n this.tech_.off('seeked', this.clearSeekingAppendCheck_);\n loaderTypes.forEach(type => {\n pc[`${type}SegmentLoader_`].off('appendsdone', loaderChecks[type].updateend);\n pc[`${type}SegmentLoader_`].off('playlistupdate', loaderChecks[type].reset);\n this.tech_.off(['seeked', 'seeking'], loaderChecks[type].reset);\n });\n if (this.checkCurrentTimeTimeout_) {\n window$1.clearTimeout(this.checkCurrentTimeTimeout_);\n }\n this.resetTimeUpdate_();\n };\n }\n /**\n * Periodically check current time to see if playback stopped\n *\n * @private\n */\n\n monitorCurrentTime_() {\n this.checkCurrentTime_();\n if (this.checkCurrentTimeTimeout_) {\n window$1.clearTimeout(this.checkCurrentTimeTimeout_);\n } // 42 = 24 fps // 250 is what Webkit uses // FF uses 15\n\n this.checkCurrentTimeTimeout_ = window$1.setTimeout(this.monitorCurrentTime_.bind(this), 250);\n }\n /**\n * Reset stalled download stats for a specific type of loader\n *\n * @param {string} type\n * The segment loader type to check.\n *\n * @listens SegmentLoader#playlistupdate\n * @listens Tech#seeking\n * @listens Tech#seeked\n */\n\n resetSegmentDownloads_(type) {\n const loader = this.playlistController_[`${type}SegmentLoader_`];\n if (this[`${type}StalledDownloads_`] > 0) {\n this.logger_(`resetting possible stalled download count for ${type} loader`);\n }\n this[`${type}StalledDownloads_`] = 0;\n this[`${type}Buffered_`] = loader.buffered_();\n }\n /**\n * Checks on every segment `appendsdone` to see\n * if segment appends are making progress. If they are not\n * and we are still downloading bytes. We exclude the playlist.\n *\n * @param {string} type\n * The segment loader type to check.\n *\n * @listens SegmentLoader#appendsdone\n */\n\n checkSegmentDownloads_(type) {\n const pc = this.playlistController_;\n const loader = pc[`${type}SegmentLoader_`];\n const buffered = loader.buffered_();\n const isBufferedDifferent = isRangeDifferent(this[`${type}Buffered_`], buffered);\n this[`${type}Buffered_`] = buffered; // if another watcher is going to fix the issue or\n // the buffered value for this loader changed\n // appends are working\n\n if (isBufferedDifferent) {\n const metadata = {\n bufferedRanges: buffered\n };\n pc.trigger({\n type: 'bufferedrangeschanged',\n metadata\n });\n this.resetSegmentDownloads_(type);\n return;\n }\n this[`${type}StalledDownloads_`]++;\n this.logger_(`found #${this[`${type}StalledDownloads_`]} ${type} appends that did not increase buffer (possible stalled download)`, {\n playlistId: loader.playlist_ && loader.playlist_.id,\n buffered: timeRangesToArray(buffered)\n }); // after 10 possibly stalled appends with no reset, exclude\n\n if (this[`${type}StalledDownloads_`] < 10) {\n return;\n }\n this.logger_(`${type} loader stalled download exclusion`);\n this.resetSegmentDownloads_(type);\n this.tech_.trigger({\n type: 'usage',\n name: `vhs-${type}-download-exclusion`\n });\n if (type === 'subtitle') {\n return;\n } // TODO: should we exclude audio tracks rather than main tracks\n // when type is audio?\n\n pc.excludePlaylist({\n error: {\n message: `Excessive ${type} segment downloading detected.`\n },\n playlistExclusionDuration: Infinity\n });\n }\n /**\n * The purpose of this function is to emulate the \"waiting\" event on\n * browsers that do not emit it when they are waiting for more\n * data to continue playback\n *\n * @private\n */\n\n checkCurrentTime_() {\n if (this.tech_.paused() || this.tech_.seeking()) {\n return;\n }\n const currentTime = this.tech_.currentTime();\n const buffered = this.tech_.buffered();\n if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA >= buffered.end(buffered.length - 1))) {\n // If current time is at the end of the final buffered region, then any playback\n // stall is most likely caused by buffering in a low bandwidth environment. The tech\n // should fire a `waiting` event in this scenario, but due to browser and tech\n // inconsistencies. Calling `techWaiting_` here allows us to simulate\n // responding to a native `waiting` event when the tech fails to emit one.\n return this.techWaiting_();\n }\n if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) {\n this.consecutiveUpdates++;\n this.waiting_();\n } else if (currentTime === this.lastRecordedTime) {\n this.consecutiveUpdates++;\n } else {\n this.playedRanges_.push(createTimeRanges([this.lastRecordedTime, currentTime]));\n const metadata = {\n playedRanges: this.playedRanges_\n };\n this.playlistController_.trigger({\n type: 'playedrangeschanged',\n metadata\n });\n this.consecutiveUpdates = 0;\n this.lastRecordedTime = currentTime;\n }\n }\n /**\n * Resets the 'timeupdate' mechanism designed to detect that we are stalled\n *\n * @private\n */\n\n resetTimeUpdate_() {\n this.consecutiveUpdates = 0;\n }\n /**\n * Fixes situations where there's a bad seek\n *\n * @return {boolean} whether an action was taken to fix the seek\n * @private\n */\n\n fixesBadSeeks_() {\n const seeking = this.tech_.seeking();\n if (!seeking) {\n return false;\n } // TODO: It's possible that these seekable checks should be moved out of this function\n // and into a function that runs on seekablechange. It's also possible that we only need\n // afterSeekableWindow as the buffered check at the bottom is good enough to handle before\n // seekable range.\n\n const seekable = this.seekable();\n const currentTime = this.tech_.currentTime();\n const isAfterSeekableRange = this.afterSeekableWindow_(seekable, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow);\n let seekTo;\n if (isAfterSeekableRange) {\n const seekableEnd = seekable.end(seekable.length - 1); // sync to live point (if VOD, our seekable was updated and we're simply adjusting)\n\n seekTo = seekableEnd;\n }\n if (this.beforeSeekableWindow_(seekable, currentTime)) {\n const seekableStart = seekable.start(0); // sync to the beginning of the live window\n // provide a buffer of .1 seconds to handle rounding/imprecise numbers\n\n seekTo = seekableStart + (\n // if the playlist is too short and the seekable range is an exact time (can\n // happen in live with a 3 segment playlist), then don't use a time delta\n seekableStart === seekable.end(0) ? 0 : SAFE_TIME_DELTA);\n }\n if (typeof seekTo !== 'undefined') {\n this.logger_(`Trying to seek outside of seekable at time ${currentTime} with ` + `seekable range ${printableRange(seekable)}. Seeking to ` + `${seekTo}.`);\n this.tech_.setCurrentTime(seekTo);\n return true;\n }\n const sourceUpdater = this.playlistController_.sourceUpdater_;\n const buffered = this.tech_.buffered();\n const audioBuffered = sourceUpdater.audioBuffer ? sourceUpdater.audioBuffered() : null;\n const videoBuffered = sourceUpdater.videoBuffer ? sourceUpdater.videoBuffered() : null;\n const media = this.media(); // verify that at least two segment durations or one part duration have been\n // appended before checking for a gap.\n\n const minAppendedDuration = media.partTargetDuration ? media.partTargetDuration : (media.targetDuration - TIME_FUDGE_FACTOR) * 2; // verify that at least two segment durations have been\n // appended before checking for a gap.\n\n const bufferedToCheck = [audioBuffered, videoBuffered];\n for (let i = 0; i < bufferedToCheck.length; i++) {\n // skip null buffered\n if (!bufferedToCheck[i]) {\n continue;\n }\n const timeAhead = timeAheadOf(bufferedToCheck[i], currentTime); // if we are less than two video/audio segment durations or one part\n // duration behind we haven't appended enough to call this a bad seek.\n\n if (timeAhead < minAppendedDuration) {\n return false;\n }\n }\n const nextRange = findNextRange(buffered, currentTime); // we have appended enough content, but we don't have anything buffered\n // to seek over the gap\n\n if (nextRange.length === 0) {\n return false;\n }\n seekTo = nextRange.start(0) + SAFE_TIME_DELTA;\n this.logger_(`Buffered region starts (${nextRange.start(0)}) ` + ` just beyond seek point (${currentTime}). Seeking to ${seekTo}.`);\n this.tech_.setCurrentTime(seekTo);\n return true;\n }\n /**\n * Handler for situations when we determine the player is waiting.\n *\n * @private\n */\n\n waiting_() {\n if (this.techWaiting_()) {\n return;\n } // All tech waiting checks failed. Use last resort correction\n\n const currentTime = this.tech_.currentTime();\n const buffered = this.tech_.buffered();\n const currentRange = findRange(buffered, currentTime); // Sometimes the player can stall for unknown reasons within a contiguous buffered\n // region with no indication that anything is amiss (seen in Firefox). Seeking to\n // currentTime is usually enough to kickstart the player. This checks that the player\n // is currently within a buffered region before attempting a corrective seek.\n // Chrome does not appear to continue `timeupdate` events after a `waiting` event\n // until there is ~ 3 seconds of forward buffer available. PlaybackWatcher should also\n // make sure there is ~3 seconds of forward buffer before taking any corrective action\n // to avoid triggering an `unknownwaiting` event when the network is slow.\n\n if (currentRange.length && currentTime + 3 <= currentRange.end(0)) {\n this.resetTimeUpdate_();\n this.tech_.setCurrentTime(currentTime);\n this.logger_(`Stopped at ${currentTime} while inside a buffered region ` + `[${currentRange.start(0)} -> ${currentRange.end(0)}]. Attempting to resume ` + 'playback by seeking to the current time.'); // unknown waiting corrections may be useful for monitoring QoS\n\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-unknown-waiting'\n });\n return;\n }\n }\n /**\n * Handler for situations when the tech fires a `waiting` event\n *\n * @return {boolean}\n * True if an action (or none) was needed to correct the waiting. False if no\n * checks passed\n * @private\n */\n\n techWaiting_() {\n const seekable = this.seekable();\n const currentTime = this.tech_.currentTime();\n if (this.tech_.seeking()) {\n // Tech is seeking or already waiting on another action, no action needed\n return true;\n }\n if (this.beforeSeekableWindow_(seekable, currentTime)) {\n const livePoint = seekable.end(seekable.length - 1);\n this.logger_(`Fell out of live window at time ${currentTime}. Seeking to ` + `live point (seekable end) ${livePoint}`);\n this.resetTimeUpdate_();\n this.tech_.setCurrentTime(livePoint); // live window resyncs may be useful for monitoring QoS\n\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-live-resync'\n });\n return true;\n }\n const sourceUpdater = this.tech_.vhs.playlistController_.sourceUpdater_;\n const buffered = this.tech_.buffered();\n const videoUnderflow = this.videoUnderflow_({\n audioBuffered: sourceUpdater.audioBuffered(),\n videoBuffered: sourceUpdater.videoBuffered(),\n currentTime\n });\n if (videoUnderflow) {\n // Even though the video underflowed and was stuck in a gap, the audio overplayed\n // the gap, leading currentTime into a buffered range. Seeking to currentTime\n // allows the video to catch up to the audio position without losing any audio\n // (only suffering ~3 seconds of frozen video and a pause in audio playback).\n this.resetTimeUpdate_();\n this.tech_.setCurrentTime(currentTime); // video underflow may be useful for monitoring QoS\n\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-video-underflow'\n });\n return true;\n }\n const nextRange = findNextRange(buffered, currentTime); // check for gap\n\n if (nextRange.length > 0) {\n this.logger_(`Stopped at ${currentTime} and seeking to ${nextRange.start(0)}`);\n this.resetTimeUpdate_();\n this.skipTheGap_(currentTime);\n return true;\n } // All checks failed. Returning false to indicate failure to correct waiting\n\n return false;\n }\n afterSeekableWindow_(seekable, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow = false) {\n if (!seekable.length) {\n // we can't make a solid case if there's no seekable, default to false\n return false;\n }\n let allowedEnd = seekable.end(seekable.length - 1) + SAFE_TIME_DELTA;\n const isLive = !playlist.endList;\n const isLLHLS = typeof playlist.partTargetDuration === 'number';\n if (isLive && (isLLHLS || allowSeeksWithinUnsafeLiveWindow)) {\n allowedEnd = seekable.end(seekable.length - 1) + playlist.targetDuration * 3;\n }\n if (currentTime > allowedEnd) {\n return true;\n }\n return false;\n }\n beforeSeekableWindow_(seekable, currentTime) {\n if (seekable.length &&\n // can't fall before 0 and 0 seekable start identifies VOD stream\n seekable.start(0) > 0 && currentTime < seekable.start(0) - this.liveRangeSafeTimeDelta) {\n return true;\n }\n return false;\n }\n videoUnderflow_({\n videoBuffered,\n audioBuffered,\n currentTime\n }) {\n // audio only content will not have video underflow :)\n if (!videoBuffered) {\n return;\n }\n let gap; // find a gap in demuxed content.\n\n if (videoBuffered.length && audioBuffered.length) {\n // in Chrome audio will continue to play for ~3s when we run out of video\n // so we have to check that the video buffer did have some buffer in the\n // past.\n const lastVideoRange = findRange(videoBuffered, currentTime - 3);\n const videoRange = findRange(videoBuffered, currentTime);\n const audioRange = findRange(audioBuffered, currentTime);\n if (audioRange.length && !videoRange.length && lastVideoRange.length) {\n gap = {\n start: lastVideoRange.end(0),\n end: audioRange.end(0)\n };\n } // find a gap in muxed content.\n } else {\n const nextRange = findNextRange(videoBuffered, currentTime); // Even if there is no available next range, there is still a possibility we are\n // stuck in a gap due to video underflow.\n\n if (!nextRange.length) {\n gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime);\n }\n }\n if (gap) {\n this.logger_(`Encountered a gap in video from ${gap.start} to ${gap.end}. ` + `Seeking to current time ${currentTime}`);\n return true;\n }\n return false;\n }\n /**\n * Timer callback. If playback still has not proceeded, then we seek\n * to the start of the next buffered region.\n *\n * @private\n */\n\n skipTheGap_(scheduledCurrentTime) {\n const buffered = this.tech_.buffered();\n const currentTime = this.tech_.currentTime();\n const nextRange = findNextRange(buffered, currentTime);\n this.resetTimeUpdate_();\n if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) {\n return;\n }\n this.logger_('skipTheGap_:', 'currentTime:', currentTime, 'scheduled currentTime:', scheduledCurrentTime, 'nextRange start:', nextRange.start(0)); // only seek if we still have not played\n\n this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR);\n const metadata = {\n gapInfo: {\n from: currentTime,\n to: nextRange.start(0)\n }\n };\n this.playlistController_.trigger({\n type: 'gapjumped',\n metadata\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-gap-skip'\n });\n }\n gapFromVideoUnderflow_(buffered, currentTime) {\n // At least in Chrome, if there is a gap in the video buffer, the audio will continue\n // playing for ~3 seconds after the video gap starts. This is done to account for\n // video buffer underflow/underrun (note that this is not done when there is audio\n // buffer underflow/underrun -- in that case the video will stop as soon as it\n // encounters the gap, as audio stalls are more noticeable/jarring to a user than\n // video stalls). The player's time will reflect the playthrough of audio, so the\n // time will appear as if we are in a buffered region, even if we are stuck in a\n // \"gap.\"\n //\n // Example:\n // video buffer: 0 => 10.1, 10.2 => 20\n // audio buffer: 0 => 20\n // overall buffer: 0 => 10.1, 10.2 => 20\n // current time: 13\n //\n // Chrome's video froze at 10 seconds, where the video buffer encountered the gap,\n // however, the audio continued playing until it reached ~3 seconds past the gap\n // (13 seconds), at which point it stops as well. Since current time is past the\n // gap, findNextRange will return no ranges.\n //\n // To check for this issue, we see if there is a gap that starts somewhere within\n // a 3 second range (3 seconds +/- 1 second) back from our current time.\n const gaps = findGaps(buffered);\n for (let i = 0; i < gaps.length; i++) {\n const start = gaps.start(i);\n const end = gaps.end(i); // gap is starts no more than 4 seconds back\n\n if (currentTime - start < 4 && currentTime - start > 2) {\n return {\n start,\n end\n };\n }\n }\n return null;\n }\n}\nconst defaultOptions = {\n errorInterval: 30,\n getSource(next) {\n const tech = this.tech({\n IWillNotUseThisInPlugins: true\n });\n const sourceObj = tech.currentSource_ || this.currentSource();\n return next(sourceObj);\n }\n};\n/**\n * Main entry point for the plugin\n *\n * @param {Player} player a reference to a videojs Player instance\n * @param {Object} [options] an object with plugin options\n * @private\n */\n\nconst initPlugin = function (player, options) {\n let lastCalled = 0;\n let seekTo = 0;\n const localOptions = merge(defaultOptions, options);\n player.ready(() => {\n player.trigger({\n type: 'usage',\n name: 'vhs-error-reload-initialized'\n });\n });\n /**\n * Player modifications to perform that must wait until `loadedmetadata`\n * has been triggered\n *\n * @private\n */\n\n const loadedMetadataHandler = function () {\n if (seekTo) {\n player.currentTime(seekTo);\n }\n };\n /**\n * Set the source on the player element, play, and seek if necessary\n *\n * @param {Object} sourceObj An object specifying the source url and mime-type to play\n * @private\n */\n\n const setSource = function (sourceObj) {\n if (sourceObj === null || sourceObj === undefined) {\n return;\n }\n seekTo = player.duration() !== Infinity && player.currentTime() || 0;\n player.one('loadedmetadata', loadedMetadataHandler);\n player.src(sourceObj);\n player.trigger({\n type: 'usage',\n name: 'vhs-error-reload'\n });\n player.play();\n };\n /**\n * Attempt to get a source from either the built-in getSource function\n * or a custom function provided via the options\n *\n * @private\n */\n\n const errorHandler = function () {\n // Do not attempt to reload the source if a source-reload occurred before\n // 'errorInterval' time has elapsed since the last source-reload\n if (Date.now() - lastCalled < localOptions.errorInterval * 1000) {\n player.trigger({\n type: 'usage',\n name: 'vhs-error-reload-canceled'\n });\n return;\n }\n if (!localOptions.getSource || typeof localOptions.getSource !== 'function') {\n videojs.log.error('ERROR: reloadSourceOnError - The option getSource must be a function!');\n return;\n }\n lastCalled = Date.now();\n return localOptions.getSource.call(player, setSource);\n };\n /**\n * Unbind any event handlers that were bound by the plugin\n *\n * @private\n */\n\n const cleanupEvents = function () {\n player.off('loadedmetadata', loadedMetadataHandler);\n player.off('error', errorHandler);\n player.off('dispose', cleanupEvents);\n };\n /**\n * Cleanup before re-initializing the plugin\n *\n * @param {Object} [newOptions] an object with plugin options\n * @private\n */\n\n const reinitPlugin = function (newOptions) {\n cleanupEvents();\n initPlugin(player, newOptions);\n };\n player.on('error', errorHandler);\n player.on('dispose', cleanupEvents); // Overwrite the plugin function so that we can correctly cleanup before\n // initializing the plugin\n\n player.reloadSourceOnError = reinitPlugin;\n};\n/**\n * Reload the source when an error is detected as long as there\n * wasn't an error previously within the last 30 seconds\n *\n * @param {Object} [options] an object with plugin options\n */\n\nconst reloadSourceOnError = function (options) {\n initPlugin(this, options);\n};\nvar version$4 = \"3.16.2\";\nvar version$3 = \"7.1.0\";\nvar version$2 = \"1.3.1\";\nvar version$1 = \"7.2.0\";\nvar version = \"4.0.2\";\nconst Vhs = {\n PlaylistLoader,\n Playlist,\n utils,\n STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector,\n INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector,\n lastBandwidthSelector,\n movingAverageBandwidthSelector,\n comparePlaylistBandwidth,\n comparePlaylistResolution,\n xhr: xhrFactory()\n}; // Define getter/setters for config properties\n\nObject.keys(Config).forEach(prop => {\n Object.defineProperty(Vhs, prop, {\n get() {\n videojs.log.warn(`using Vhs.${prop} is UNSAFE be sure you know what you are doing`);\n return Config[prop];\n },\n set(value) {\n videojs.log.warn(`using Vhs.${prop} is UNSAFE be sure you know what you are doing`);\n if (typeof value !== 'number' || value < 0) {\n videojs.log.warn(`value of Vhs.${prop} must be greater than or equal to 0`);\n return;\n }\n Config[prop] = value;\n }\n });\n});\nconst LOCAL_STORAGE_KEY = 'videojs-vhs';\n/**\n * Updates the selectedIndex of the QualityLevelList when a mediachange happens in vhs.\n *\n * @param {QualityLevelList} qualityLevels The QualityLevelList to update.\n * @param {PlaylistLoader} playlistLoader PlaylistLoader containing the new media info.\n * @function handleVhsMediaChange\n */\n\nconst handleVhsMediaChange = function (qualityLevels, playlistLoader) {\n const newPlaylist = playlistLoader.media();\n let selectedIndex = -1;\n for (let i = 0; i < qualityLevels.length; i++) {\n if (qualityLevels[i].id === newPlaylist.id) {\n selectedIndex = i;\n break;\n }\n }\n qualityLevels.selectedIndex_ = selectedIndex;\n qualityLevels.trigger({\n selectedIndex,\n type: 'change'\n });\n};\n/**\n * Adds quality levels to list once playlist metadata is available\n *\n * @param {QualityLevelList} qualityLevels The QualityLevelList to attach events to.\n * @param {Object} vhs Vhs object to listen to for media events.\n * @function handleVhsLoadedMetadata\n */\n\nconst handleVhsLoadedMetadata = function (qualityLevels, vhs) {\n vhs.representations().forEach(rep => {\n qualityLevels.addQualityLevel(rep);\n });\n handleVhsMediaChange(qualityLevels, vhs.playlists);\n}; // VHS is a source handler, not a tech. Make sure attempts to use it\n// as one do not cause exceptions.\n\nVhs.canPlaySource = function () {\n return videojs.log.warn('VHS is no longer a tech. Please remove it from ' + 'your player\\'s techOrder.');\n};\nconst emeKeySystems = (keySystemOptions, mainPlaylist, audioPlaylist) => {\n if (!keySystemOptions) {\n return keySystemOptions;\n }\n let codecs = {};\n if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) {\n codecs = unwrapCodecList(parseCodecs(mainPlaylist.attributes.CODECS));\n }\n if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) {\n codecs.audio = audioPlaylist.attributes.CODECS;\n }\n const videoContentType = getMimeForCodec(codecs.video);\n const audioContentType = getMimeForCodec(codecs.audio); // upsert the content types based on the selected playlist\n\n const keySystemContentTypes = {};\n for (const keySystem in keySystemOptions) {\n keySystemContentTypes[keySystem] = {};\n if (audioContentType) {\n keySystemContentTypes[keySystem].audioContentType = audioContentType;\n }\n if (videoContentType) {\n keySystemContentTypes[keySystem].videoContentType = videoContentType;\n } // Default to using the video playlist's PSSH even though they may be different, as\n // videojs-contrib-eme will only accept one in the options.\n //\n // This shouldn't be an issue for most cases as early intialization will handle all\n // unique PSSH values, and if they aren't, then encrypted events should have the\n // specific information needed for the unique license.\n\n if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) {\n keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh;\n } // videojs-contrib-eme accepts the option of specifying: 'com.some.cdm': 'url'\n // so we need to prevent overwriting the URL entirely\n\n if (typeof keySystemOptions[keySystem] === 'string') {\n keySystemContentTypes[keySystem].url = keySystemOptions[keySystem];\n }\n }\n return merge(keySystemOptions, keySystemContentTypes);\n};\n/**\n * @typedef {Object} KeySystems\n *\n * keySystems configuration for https://github.com/videojs/videojs-contrib-eme\n * Note: not all options are listed here.\n *\n * @property {Uint8Array} [pssh]\n * Protection System Specific Header\n */\n\n/**\n * Goes through all the playlists and collects an array of KeySystems options objects\n * containing each playlist's keySystems and their pssh values, if available.\n *\n * @param {Object[]} playlists\n * The playlists to look through\n * @param {string[]} keySystems\n * The keySystems to collect pssh values for\n *\n * @return {KeySystems[]}\n * An array of KeySystems objects containing available key systems and their\n * pssh values\n */\n\nconst getAllPsshKeySystemsOptions = (playlists, keySystems) => {\n return playlists.reduce((keySystemsArr, playlist) => {\n if (!playlist.contentProtection) {\n return keySystemsArr;\n }\n const keySystemsOptions = keySystems.reduce((keySystemsObj, keySystem) => {\n const keySystemOptions = playlist.contentProtection[keySystem];\n if (keySystemOptions && keySystemOptions.pssh) {\n keySystemsObj[keySystem] = {\n pssh: keySystemOptions.pssh\n };\n }\n return keySystemsObj;\n }, {});\n if (Object.keys(keySystemsOptions).length) {\n keySystemsArr.push(keySystemsOptions);\n }\n return keySystemsArr;\n }, []);\n};\n/**\n * Returns a promise that waits for the\n * [eme plugin](https://github.com/videojs/videojs-contrib-eme) to create a key session.\n *\n * Works around https://bugs.chromium.org/p/chromium/issues/detail?id=895449 in non-IE11\n * browsers.\n *\n * As per the above ticket, this is particularly important for Chrome, where, if\n * unencrypted content is appended before encrypted content and the key session has not\n * been created, a MEDIA_ERR_DECODE will be thrown once the encrypted content is reached\n * during playback.\n *\n * @param {Object} player\n * The player instance\n * @param {Object[]} sourceKeySystems\n * The key systems options from the player source\n * @param {Object} [audioMedia]\n * The active audio media playlist (optional)\n * @param {Object[]} mainPlaylists\n * The playlists found on the main playlist object\n *\n * @return {Object}\n * Promise that resolves when the key session has been created\n */\n\nconst waitForKeySessionCreation = ({\n player,\n sourceKeySystems,\n audioMedia,\n mainPlaylists\n}) => {\n if (!player.eme.initializeMediaKeys) {\n return Promise.resolve();\n } // TODO should all audio PSSH values be initialized for DRM?\n //\n // All unique video rendition pssh values are initialized for DRM, but here only\n // the initial audio playlist license is initialized. In theory, an encrypted\n // event should be fired if the user switches to an alternative audio playlist\n // where a license is required, but this case hasn't yet been tested. In addition, there\n // may be many alternate audio playlists unlikely to be used (e.g., multiple different\n // languages).\n\n const playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists;\n const keySystemsOptionsArr = getAllPsshKeySystemsOptions(playlists, Object.keys(sourceKeySystems));\n const initializationFinishedPromises = [];\n const keySessionCreatedPromises = []; // Since PSSH values are interpreted as initData, EME will dedupe any duplicates. The\n // only place where it should not be deduped is for ms-prefixed APIs, but\n // the existence of modern EME APIs in addition to\n // ms-prefixed APIs on Edge should prevent this from being a concern.\n // initializeMediaKeys also won't use the webkit-prefixed APIs.\n\n keySystemsOptionsArr.forEach(keySystemsOptions => {\n keySessionCreatedPromises.push(new Promise((resolve, reject) => {\n player.tech_.one('keysessioncreated', resolve);\n }));\n initializationFinishedPromises.push(new Promise((resolve, reject) => {\n player.eme.initializeMediaKeys({\n keySystems: keySystemsOptions\n }, err => {\n if (err) {\n reject(err);\n return;\n }\n resolve();\n });\n }));\n }); // The reasons Promise.race is chosen over Promise.any:\n //\n // * Promise.any is only available in Safari 14+.\n // * None of these promises are expected to reject. If they do reject, it might be\n // better here for the race to surface the rejection, rather than mask it by using\n // Promise.any.\n\n return Promise.race([\n // If a session was previously created, these will all finish resolving without\n // creating a new session, otherwise it will take until the end of all license\n // requests, which is why the key session check is used (to make setup much faster).\n Promise.all(initializationFinishedPromises),\n // Once a single session is created, the browser knows DRM will be used.\n Promise.race(keySessionCreatedPromises)]);\n};\n/**\n * If the [eme](https://github.com/videojs/videojs-contrib-eme) plugin is available, and\n * there are keySystems on the source, sets up source options to prepare the source for\n * eme.\n *\n * @param {Object} player\n * The player instance\n * @param {Object[]} sourceKeySystems\n * The key systems options from the player source\n * @param {Object} media\n * The active media playlist\n * @param {Object} [audioMedia]\n * The active audio media playlist (optional)\n *\n * @return {boolean}\n * Whether or not options were configured and EME is available\n */\n\nconst setupEmeOptions = ({\n player,\n sourceKeySystems,\n media,\n audioMedia\n}) => {\n const sourceOptions = emeKeySystems(sourceKeySystems, media, audioMedia);\n if (!sourceOptions) {\n return false;\n }\n player.currentSource().keySystems = sourceOptions; // eme handles the rest of the setup, so if it is missing\n // do nothing.\n\n if (sourceOptions && !player.eme) {\n videojs.log.warn('DRM encrypted source cannot be decrypted without a DRM plugin');\n return false;\n }\n return true;\n};\nconst getVhsLocalStorage = () => {\n if (!window$1.localStorage) {\n return null;\n }\n const storedObject = window$1.localStorage.getItem(LOCAL_STORAGE_KEY);\n if (!storedObject) {\n return null;\n }\n try {\n return JSON.parse(storedObject);\n } catch (e) {\n // someone may have tampered with the value\n return null;\n }\n};\nconst updateVhsLocalStorage = options => {\n if (!window$1.localStorage) {\n return false;\n }\n let objectToStore = getVhsLocalStorage();\n objectToStore = objectToStore ? merge(objectToStore, options) : options;\n try {\n window$1.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(objectToStore));\n } catch (e) {\n // Throws if storage is full (e.g., always on iOS 5+ Safari private mode, where\n // storage is set to 0).\n // https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem#Exceptions\n // No need to perform any operation.\n return false;\n }\n return objectToStore;\n};\n/**\n * Parses VHS-supported media types from data URIs. See\n * https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs\n * for information on data URIs.\n *\n * @param {string} dataUri\n * The data URI\n *\n * @return {string|Object}\n * The parsed object/string, or the original string if no supported media type\n * was found\n */\n\nconst expandDataUri = dataUri => {\n if (dataUri.toLowerCase().indexOf('data:application/vnd.videojs.vhs+json,') === 0) {\n return JSON.parse(dataUri.substring(dataUri.indexOf(',') + 1));\n } // no known case for this data URI, return the string as-is\n\n return dataUri;\n};\n/**\n * Adds a request hook to an xhr object\n *\n * @param {Object} xhr object to add the onRequest hook to\n * @param {function} callback hook function for an xhr request\n */\n\nconst addOnRequestHook = (xhr, callback) => {\n if (!xhr._requestCallbackSet) {\n xhr._requestCallbackSet = new Set();\n }\n xhr._requestCallbackSet.add(callback);\n};\n/**\n * Adds a response hook to an xhr object\n *\n * @param {Object} xhr object to add the onResponse hook to\n * @param {function} callback hook function for an xhr response\n */\n\nconst addOnResponseHook = (xhr, callback) => {\n if (!xhr._responseCallbackSet) {\n xhr._responseCallbackSet = new Set();\n }\n xhr._responseCallbackSet.add(callback);\n};\n/**\n * Removes a request hook on an xhr object, deletes the onRequest set if empty.\n *\n * @param {Object} xhr object to remove the onRequest hook from\n * @param {function} callback hook function to remove\n */\n\nconst removeOnRequestHook = (xhr, callback) => {\n if (!xhr._requestCallbackSet) {\n return;\n }\n xhr._requestCallbackSet.delete(callback);\n if (!xhr._requestCallbackSet.size) {\n delete xhr._requestCallbackSet;\n }\n};\n/**\n * Removes a response hook on an xhr object, deletes the onResponse set if empty.\n *\n * @param {Object} xhr object to remove the onResponse hook from\n * @param {function} callback hook function to remove\n */\n\nconst removeOnResponseHook = (xhr, callback) => {\n if (!xhr._responseCallbackSet) {\n return;\n }\n xhr._responseCallbackSet.delete(callback);\n if (!xhr._responseCallbackSet.size) {\n delete xhr._responseCallbackSet;\n }\n};\n/**\n * Whether the browser has built-in HLS support.\n */\n\nVhs.supportsNativeHls = function () {\n if (!document$1 || !document$1.createElement) {\n return false;\n }\n const video = document$1.createElement('video'); // native HLS is definitely not supported if HTML5 video isn't\n\n if (!videojs.getTech('Html5').isSupported()) {\n return false;\n } // HLS manifests can go by many mime-types\n\n const canPlay = [\n // Apple santioned\n 'application/vnd.apple.mpegurl',\n // Apple sanctioned for backwards compatibility\n 'audio/mpegurl',\n // Very common\n 'audio/x-mpegurl',\n // Very common\n 'application/x-mpegurl',\n // Included for completeness\n 'video/x-mpegurl', 'video/mpegurl', 'application/mpegurl'];\n return canPlay.some(function (canItPlay) {\n return /maybe|probably/i.test(video.canPlayType(canItPlay));\n });\n}();\nVhs.supportsNativeDash = function () {\n if (!document$1 || !document$1.createElement || !videojs.getTech('Html5').isSupported()) {\n return false;\n }\n return /maybe|probably/i.test(document$1.createElement('video').canPlayType('application/dash+xml'));\n}();\nVhs.supportsTypeNatively = type => {\n if (type === 'hls') {\n return Vhs.supportsNativeHls;\n }\n if (type === 'dash') {\n return Vhs.supportsNativeDash;\n }\n return false;\n};\n/**\n * VHS is a source handler, not a tech. Make sure attempts to use it\n * as one do not cause exceptions.\n */\n\nVhs.isSupported = function () {\n return videojs.log.warn('VHS is no longer a tech. Please remove it from ' + 'your player\\'s techOrder.');\n};\n/**\n * A global function for setting an onRequest hook\n *\n * @param {function} callback for request modifiction\n */\n\nVhs.xhr.onRequest = function (callback) {\n addOnRequestHook(Vhs.xhr, callback);\n};\n/**\n * A global function for setting an onResponse hook\n *\n * @param {callback} callback for response data retrieval\n */\n\nVhs.xhr.onResponse = function (callback) {\n addOnResponseHook(Vhs.xhr, callback);\n};\n/**\n * Deletes a global onRequest callback if it exists\n *\n * @param {function} callback to delete from the global set\n */\n\nVhs.xhr.offRequest = function (callback) {\n removeOnRequestHook(Vhs.xhr, callback);\n};\n/**\n * Deletes a global onResponse callback if it exists\n *\n * @param {function} callback to delete from the global set\n */\n\nVhs.xhr.offResponse = function (callback) {\n removeOnResponseHook(Vhs.xhr, callback);\n};\nconst Component = videojs.getComponent('Component');\n/**\n * The Vhs Handler object, where we orchestrate all of the parts\n * of VHS to interact with video.js\n *\n * @class VhsHandler\n * @extends videojs.Component\n * @param {Object} source the soruce object\n * @param {Tech} tech the parent tech object\n * @param {Object} options optional and required options\n */\n\nclass VhsHandler extends Component {\n constructor(source, tech, options) {\n super(tech, options.vhs); // if a tech level `initialBandwidth` option was passed\n // use that over the VHS level `bandwidth` option\n\n if (typeof options.initialBandwidth === 'number') {\n this.options_.bandwidth = options.initialBandwidth;\n }\n this.logger_ = logger('VhsHandler'); // we need access to the player in some cases,\n // so, get it from Video.js via the `playerId`\n\n if (tech.options_ && tech.options_.playerId) {\n const _player = videojs.getPlayer(tech.options_.playerId);\n this.player_ = _player;\n }\n this.tech_ = tech;\n this.source_ = source;\n this.stats = {};\n this.ignoreNextSeekingEvent_ = false;\n this.setOptions_();\n if (this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) {\n tech.overrideNativeAudioTracks(true);\n tech.overrideNativeVideoTracks(true);\n } else if (this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) {\n // overriding native VHS only works if audio tracks have been emulated\n // error early if we're misconfigured\n throw new Error('Overriding native VHS requires emulated tracks. ' + 'See https://git.io/vMpjB');\n } // listen for fullscreenchange events for this player so that we\n // can adjust our quality selection quickly\n\n this.on(document$1, ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'], event => {\n const fullscreenElement = document$1.fullscreenElement || document$1.webkitFullscreenElement || document$1.mozFullScreenElement || document$1.msFullscreenElement;\n if (fullscreenElement && fullscreenElement.contains(this.tech_.el())) {\n this.playlistController_.fastQualityChange_();\n } else {\n // When leaving fullscreen, since the in page pixel dimensions should be smaller\n // than full screen, see if there should be a rendition switch down to preserve\n // bandwidth.\n this.playlistController_.checkABR_();\n }\n });\n this.on(this.tech_, 'seeking', function () {\n if (this.ignoreNextSeekingEvent_) {\n this.ignoreNextSeekingEvent_ = false;\n return;\n }\n this.setCurrentTime(this.tech_.currentTime());\n });\n this.on(this.tech_, 'error', function () {\n // verify that the error was real and we are loaded\n // enough to have pc loaded.\n if (this.tech_.error() && this.playlistController_) {\n this.playlistController_.pauseLoading();\n }\n });\n this.on(this.tech_, 'play', this.play);\n }\n /**\n * Set VHS options based on options from configuration, as well as partial\n * options to be passed at a later time.\n *\n * @param {Object} options A partial chunk of config options\n */\n\n setOptions_(options = {}) {\n this.options_ = merge(this.options_, options); // defaults\n\n this.options_.withCredentials = this.options_.withCredentials || false;\n this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true;\n this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false;\n this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== 'undefined' ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false;\n this.options_.useForcedSubtitles = this.options_.useForcedSubtitles || false;\n this.options_.useNetworkInformationApi = this.options_.useNetworkInformationApi || false;\n this.options_.useDtsForTimestampOffset = this.options_.useDtsForTimestampOffset || false;\n this.options_.customTagParsers = this.options_.customTagParsers || [];\n this.options_.customTagMappers = this.options_.customTagMappers || [];\n this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false;\n this.options_.llhls = this.options_.llhls === false ? false : true;\n this.options_.bufferBasedABR = this.options_.bufferBasedABR || false;\n if (typeof this.options_.playlistExclusionDuration !== 'number') {\n this.options_.playlistExclusionDuration = 60;\n }\n if (typeof this.options_.bandwidth !== 'number') {\n if (this.options_.useBandwidthFromLocalStorage) {\n const storedObject = getVhsLocalStorage();\n if (storedObject && storedObject.bandwidth) {\n this.options_.bandwidth = storedObject.bandwidth;\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-bandwidth-from-local-storage'\n });\n }\n if (storedObject && storedObject.throughput) {\n this.options_.throughput = storedObject.throughput;\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-throughput-from-local-storage'\n });\n }\n }\n } // if bandwidth was not set by options or pulled from local storage, start playlist\n // selection at a reasonable bandwidth\n\n if (typeof this.options_.bandwidth !== 'number') {\n this.options_.bandwidth = Config.INITIAL_BANDWIDTH;\n } // If the bandwidth number is unchanged from the initial setting\n // then this takes precedence over the enableLowInitialPlaylist option\n\n this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config.INITIAL_BANDWIDTH; // grab options passed to player.src\n\n ['withCredentials', 'useDevicePixelRatio', 'customPixelRatio', 'limitRenditionByPlayerDimensions', 'bandwidth', 'customTagParsers', 'customTagMappers', 'cacheEncryptionKeys', 'playlistSelector', 'initialPlaylistSelector', 'bufferBasedABR', 'liveRangeSafeTimeDelta', 'llhls', 'useForcedSubtitles', 'useNetworkInformationApi', 'useDtsForTimestampOffset', 'exactManifestTimings', 'leastPixelDiffSelector'].forEach(option => {\n if (typeof this.source_[option] !== 'undefined') {\n this.options_[option] = this.source_[option];\n }\n });\n this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions;\n this.useDevicePixelRatio = this.options_.useDevicePixelRatio;\n const customPixelRatio = this.options_.customPixelRatio; // Ensure the custom pixel ratio is a number greater than or equal to 0\n\n if (typeof customPixelRatio === 'number' && customPixelRatio >= 0) {\n this.customPixelRatio = customPixelRatio;\n }\n } // alias for public method to set options\n\n setOptions(options = {}) {\n this.setOptions_(options);\n }\n /**\n * called when player.src gets called, handle a new source\n *\n * @param {Object} src the source object to handle\n */\n\n src(src, type) {\n // do nothing if the src is falsey\n if (!src) {\n return;\n }\n this.setOptions_(); // add main playlist controller options\n\n this.options_.src = expandDataUri(this.source_.src);\n this.options_.tech = this.tech_;\n this.options_.externVhs = Vhs;\n this.options_.sourceType = simpleTypeFromSourceType(type); // Whenever we seek internally, we should update the tech\n\n this.options_.seekTo = time => {\n this.tech_.setCurrentTime(time);\n }; // pass player to allow for player level eventing on construction.\n\n this.options_.player_ = this.player_;\n this.playlistController_ = new PlaylistController(this.options_);\n const playbackWatcherOptions = merge({\n liveRangeSafeTimeDelta: SAFE_TIME_DELTA\n }, this.options_, {\n seekable: () => this.seekable(),\n media: () => this.playlistController_.media(),\n playlistController: this.playlistController_\n });\n this.playbackWatcher_ = new PlaybackWatcher(playbackWatcherOptions);\n this.attachStreamingEventListeners_();\n this.playlistController_.on('error', () => {\n const player = videojs.players[this.tech_.options_.playerId];\n let error = this.playlistController_.error;\n if (typeof error === 'object' && !error.code) {\n error.code = 3;\n } else if (typeof error === 'string') {\n error = {\n message: error,\n code: 3\n };\n }\n player.error(error);\n });\n const defaultSelector = this.options_.bufferBasedABR ? Vhs.movingAverageBandwidthSelector(0.55) : Vhs.STANDARD_PLAYLIST_SELECTOR; // `this` in selectPlaylist should be the VhsHandler for backwards\n // compatibility with < v2\n\n this.playlistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this);\n this.playlistController_.selectInitialPlaylist = Vhs.INITIAL_PLAYLIST_SELECTOR.bind(this); // re-expose some internal objects for backwards compatibility with < v2\n\n this.playlists = this.playlistController_.mainPlaylistLoader_;\n this.mediaSource = this.playlistController_.mediaSource; // Proxy assignment of some properties to the main playlist\n // controller. Using a custom property for backwards compatibility\n // with < v2\n\n Object.defineProperties(this, {\n selectPlaylist: {\n get() {\n return this.playlistController_.selectPlaylist;\n },\n set(selectPlaylist) {\n this.playlistController_.selectPlaylist = selectPlaylist.bind(this);\n }\n },\n throughput: {\n get() {\n return this.playlistController_.mainSegmentLoader_.throughput.rate;\n },\n set(throughput) {\n this.playlistController_.mainSegmentLoader_.throughput.rate = throughput; // By setting `count` to 1 the throughput value becomes the starting value\n // for the cumulative average\n\n this.playlistController_.mainSegmentLoader_.throughput.count = 1;\n }\n },\n bandwidth: {\n get() {\n let playerBandwidthEst = this.playlistController_.mainSegmentLoader_.bandwidth;\n const networkInformation = window$1.navigator.connection || window$1.navigator.mozConnection || window$1.navigator.webkitConnection;\n const tenMbpsAsBitsPerSecond = 10e6;\n if (this.options_.useNetworkInformationApi && networkInformation) {\n // downlink returns Mbps\n // https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/downlink\n const networkInfoBandwidthEstBitsPerSec = networkInformation.downlink * 1000 * 1000; // downlink maxes out at 10 Mbps. In the event that both networkInformationApi and the player\n // estimate a bandwidth greater than 10 Mbps, use the larger of the two estimates to ensure that\n // high quality streams are not filtered out.\n\n if (networkInfoBandwidthEstBitsPerSec >= tenMbpsAsBitsPerSecond && playerBandwidthEst >= tenMbpsAsBitsPerSecond) {\n playerBandwidthEst = Math.max(playerBandwidthEst, networkInfoBandwidthEstBitsPerSec);\n } else {\n playerBandwidthEst = networkInfoBandwidthEstBitsPerSec;\n }\n }\n return playerBandwidthEst;\n },\n set(bandwidth) {\n this.playlistController_.mainSegmentLoader_.bandwidth = bandwidth; // setting the bandwidth manually resets the throughput counter\n // `count` is set to zero that current value of `rate` isn't included\n // in the cumulative average\n\n this.playlistController_.mainSegmentLoader_.throughput = {\n rate: 0,\n count: 0\n };\n }\n },\n /**\n * `systemBandwidth` is a combination of two serial processes bit-rates. The first\n * is the network bitrate provided by `bandwidth` and the second is the bitrate of\n * the entire process after that - decryption, transmuxing, and appending - provided\n * by `throughput`.\n *\n * Since the two process are serial, the overall system bandwidth is given by:\n * sysBandwidth = 1 / (1 / bandwidth + 1 / throughput)\n */\n systemBandwidth: {\n get() {\n const invBandwidth = 1 / (this.bandwidth || 1);\n let invThroughput;\n if (this.throughput > 0) {\n invThroughput = 1 / this.throughput;\n } else {\n invThroughput = 0;\n }\n const systemBitrate = Math.floor(1 / (invBandwidth + invThroughput));\n return systemBitrate;\n },\n set() {\n videojs.log.error('The \"systemBandwidth\" property is read-only');\n }\n }\n });\n if (this.options_.bandwidth) {\n this.bandwidth = this.options_.bandwidth;\n }\n if (this.options_.throughput) {\n this.throughput = this.options_.throughput;\n }\n Object.defineProperties(this.stats, {\n bandwidth: {\n get: () => this.bandwidth || 0,\n enumerable: true\n },\n mediaRequests: {\n get: () => this.playlistController_.mediaRequests_() || 0,\n enumerable: true\n },\n mediaRequestsAborted: {\n get: () => this.playlistController_.mediaRequestsAborted_() || 0,\n enumerable: true\n },\n mediaRequestsTimedout: {\n get: () => this.playlistController_.mediaRequestsTimedout_() || 0,\n enumerable: true\n },\n mediaRequestsErrored: {\n get: () => this.playlistController_.mediaRequestsErrored_() || 0,\n enumerable: true\n },\n mediaTransferDuration: {\n get: () => this.playlistController_.mediaTransferDuration_() || 0,\n enumerable: true\n },\n mediaBytesTransferred: {\n get: () => this.playlistController_.mediaBytesTransferred_() || 0,\n enumerable: true\n },\n mediaSecondsLoaded: {\n get: () => this.playlistController_.mediaSecondsLoaded_() || 0,\n enumerable: true\n },\n mediaAppends: {\n get: () => this.playlistController_.mediaAppends_() || 0,\n enumerable: true\n },\n mainAppendsToLoadedData: {\n get: () => this.playlistController_.mainAppendsToLoadedData_() || 0,\n enumerable: true\n },\n audioAppendsToLoadedData: {\n get: () => this.playlistController_.audioAppendsToLoadedData_() || 0,\n enumerable: true\n },\n appendsToLoadedData: {\n get: () => this.playlistController_.appendsToLoadedData_() || 0,\n enumerable: true\n },\n timeToLoadedData: {\n get: () => this.playlistController_.timeToLoadedData_() || 0,\n enumerable: true\n },\n buffered: {\n get: () => timeRangesToArray(this.tech_.buffered()),\n enumerable: true\n },\n currentTime: {\n get: () => this.tech_.currentTime(),\n enumerable: true\n },\n currentSource: {\n get: () => this.tech_.currentSource_,\n enumerable: true\n },\n currentTech: {\n get: () => this.tech_.name_,\n enumerable: true\n },\n duration: {\n get: () => this.tech_.duration(),\n enumerable: true\n },\n main: {\n get: () => this.playlists.main,\n enumerable: true\n },\n playerDimensions: {\n get: () => this.tech_.currentDimensions(),\n enumerable: true\n },\n seekable: {\n get: () => timeRangesToArray(this.tech_.seekable()),\n enumerable: true\n },\n timestamp: {\n get: () => Date.now(),\n enumerable: true\n },\n videoPlaybackQuality: {\n get: () => this.tech_.getVideoPlaybackQuality(),\n enumerable: true\n }\n });\n this.tech_.one('canplay', this.playlistController_.setupFirstPlay.bind(this.playlistController_));\n this.tech_.on('bandwidthupdate', () => {\n if (this.options_.useBandwidthFromLocalStorage) {\n updateVhsLocalStorage({\n bandwidth: this.bandwidth,\n throughput: Math.round(this.throughput)\n });\n }\n });\n this.playlistController_.on('selectedinitialmedia', () => {\n // Add the manual rendition mix-in to VhsHandler\n renditionSelectionMixin(this);\n });\n this.playlistController_.sourceUpdater_.on('createdsourcebuffers', () => {\n this.setupEme_();\n }); // the bandwidth of the primary segment loader is our best\n // estimate of overall bandwidth\n\n this.on(this.playlistController_, 'progress', function () {\n this.tech_.trigger('progress');\n }); // In the live case, we need to ignore the very first `seeking` event since\n // that will be the result of the seek-to-live behavior\n\n this.on(this.playlistController_, 'firstplay', function () {\n this.ignoreNextSeekingEvent_ = true;\n });\n this.setupQualityLevels_(); // do nothing if the tech has been disposed already\n // this can occur if someone sets the src in player.ready(), for instance\n\n if (!this.tech_.el()) {\n return;\n }\n this.mediaSourceUrl_ = window$1.URL.createObjectURL(this.playlistController_.mediaSource); // If we are playing HLS with MSE in Safari, add source elements for both the blob and manifest URLs.\n // The latter will enable Airplay playback on receiver devices.\n\n if ((videojs.browser.IS_ANY_SAFARI || videojs.browser.IS_IOS) && this.options_.overrideNative && this.options_.sourceType === 'hls' && typeof this.tech_.addSourceElement === 'function') {\n this.tech_.addSourceElement(this.mediaSourceUrl_);\n this.tech_.addSourceElement(this.source_.src);\n } else {\n this.tech_.src(this.mediaSourceUrl_);\n }\n }\n createKeySessions_() {\n const audioPlaylistLoader = this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;\n this.logger_('waiting for EME key session creation');\n waitForKeySessionCreation({\n player: this.player_,\n sourceKeySystems: this.source_.keySystems,\n audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(),\n mainPlaylists: this.playlists.main.playlists\n }).then(() => {\n this.logger_('created EME key session');\n this.playlistController_.sourceUpdater_.initializedEme();\n }).catch(err => {\n this.logger_('error while creating EME key session', err);\n this.player_.error({\n message: 'Failed to initialize media keys for EME',\n code: 3\n });\n });\n }\n handleWaitingForKey_() {\n // If waitingforkey is fired, it's possible that the data that's necessary to retrieve\n // the key is in the manifest. While this should've happened on initial source load, it\n // may happen again in live streams where the keys change, and the manifest info\n // reflects the update.\n //\n // Because videojs-contrib-eme compares the PSSH data we send to that of PSSH data it's\n // already requested keys for, we don't have to worry about this generating extraneous\n // requests.\n this.logger_('waitingforkey fired, attempting to create any new key sessions');\n this.createKeySessions_();\n }\n /**\n * If necessary and EME is available, sets up EME options and waits for key session\n * creation.\n *\n * This function also updates the source updater so taht it can be used, as for some\n * browsers, EME must be configured before content is appended (if appending unencrypted\n * content before encrypted content).\n */\n\n setupEme_() {\n const audioPlaylistLoader = this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;\n const didSetupEmeOptions = setupEmeOptions({\n player: this.player_,\n sourceKeySystems: this.source_.keySystems,\n media: this.playlists.media(),\n audioMedia: audioPlaylistLoader && audioPlaylistLoader.media()\n });\n this.player_.tech_.on('keystatuschange', e => {\n this.playlistController_.updatePlaylistByKeyStatus(e.keyId, e.status);\n });\n this.handleWaitingForKey_ = this.handleWaitingForKey_.bind(this);\n this.player_.tech_.on('waitingforkey', this.handleWaitingForKey_);\n if (!didSetupEmeOptions) {\n // If EME options were not set up, we've done all we could to initialize EME.\n this.playlistController_.sourceUpdater_.initializedEme();\n return;\n }\n this.createKeySessions_();\n }\n /**\n * Initializes the quality levels and sets listeners to update them.\n *\n * @method setupQualityLevels_\n * @private\n */\n\n setupQualityLevels_() {\n const player = videojs.players[this.tech_.options_.playerId]; // if there isn't a player or there isn't a qualityLevels plugin\n // or qualityLevels_ listeners have already been setup, do nothing.\n\n if (!player || !player.qualityLevels || this.qualityLevels_) {\n return;\n }\n this.qualityLevels_ = player.qualityLevels();\n this.playlistController_.on('selectedinitialmedia', () => {\n handleVhsLoadedMetadata(this.qualityLevels_, this);\n });\n this.playlists.on('mediachange', () => {\n handleVhsMediaChange(this.qualityLevels_, this.playlists);\n });\n }\n /**\n * return the version\n */\n\n static version() {\n return {\n '@videojs/http-streaming': version$4,\n 'mux.js': version$3,\n 'mpd-parser': version$2,\n 'm3u8-parser': version$1,\n 'aes-decrypter': version\n };\n }\n /**\n * return the version\n */\n\n version() {\n return this.constructor.version();\n }\n canChangeType() {\n return SourceUpdater.canChangeType();\n }\n /**\n * Begin playing the video.\n */\n\n play() {\n this.playlistController_.play();\n }\n /**\n * a wrapper around the function in PlaylistController\n */\n\n setCurrentTime(currentTime) {\n this.playlistController_.setCurrentTime(currentTime);\n }\n /**\n * a wrapper around the function in PlaylistController\n */\n\n duration() {\n return this.playlistController_.duration();\n }\n /**\n * a wrapper around the function in PlaylistController\n */\n\n seekable() {\n return this.playlistController_.seekable();\n }\n /**\n * Abort all outstanding work and cleanup.\n */\n\n dispose() {\n if (this.playbackWatcher_) {\n this.playbackWatcher_.dispose();\n }\n if (this.playlistController_) {\n this.playlistController_.dispose();\n }\n if (this.qualityLevels_) {\n this.qualityLevels_.dispose();\n }\n if (this.tech_ && this.tech_.vhs) {\n delete this.tech_.vhs;\n }\n if (this.mediaSourceUrl_ && window$1.URL.revokeObjectURL) {\n window$1.URL.revokeObjectURL(this.mediaSourceUrl_);\n this.mediaSourceUrl_ = null;\n }\n if (this.tech_) {\n this.tech_.off('waitingforkey', this.handleWaitingForKey_);\n }\n super.dispose();\n }\n convertToProgramTime(time, callback) {\n return getProgramTime({\n playlist: this.playlistController_.media(),\n time,\n callback\n });\n } // the player must be playing before calling this\n\n seekToProgramTime(programTime, callback, pauseAfterSeek = true, retryCount = 2) {\n return seekToProgramTime({\n programTime,\n playlist: this.playlistController_.media(),\n retryCount,\n pauseAfterSeek,\n seekTo: this.options_.seekTo,\n tech: this.options_.tech,\n callback\n });\n }\n /**\n * Adds the onRequest, onResponse, offRequest and offResponse functions\n * to the VhsHandler xhr Object.\n */\n\n setupXhrHooks_() {\n /**\n * A player function for setting an onRequest hook\n *\n * @param {function} callback for request modifiction\n */\n this.xhr.onRequest = callback => {\n addOnRequestHook(this.xhr, callback);\n };\n /**\n * A player function for setting an onResponse hook\n *\n * @param {callback} callback for response data retrieval\n */\n\n this.xhr.onResponse = callback => {\n addOnResponseHook(this.xhr, callback);\n };\n /**\n * Deletes a player onRequest callback if it exists\n *\n * @param {function} callback to delete from the player set\n */\n\n this.xhr.offRequest = callback => {\n removeOnRequestHook(this.xhr, callback);\n };\n /**\n * Deletes a player onResponse callback if it exists\n *\n * @param {function} callback to delete from the player set\n */\n\n this.xhr.offResponse = callback => {\n removeOnResponseHook(this.xhr, callback);\n }; // Trigger an event on the player to notify the user that vhs is ready to set xhr hooks.\n // This allows hooks to be set before the source is set to vhs when handleSource is called.\n\n this.player_.trigger('xhr-hooks-ready');\n }\n attachStreamingEventListeners_() {\n const playlistControllerEvents = ['seekablerangeschanged', 'bufferedrangeschanged', 'contentsteeringloadstart', 'contentsteeringloadcomplete', 'contentsteeringparsed'];\n const playbackWatcher = ['gapjumped', 'playedrangeschanged']; // re-emit streaming events and payloads on the player.\n\n playlistControllerEvents.forEach(eventName => {\n this.playlistController_.on(eventName, metadata => {\n this.player_.trigger(_extends({}, metadata));\n });\n });\n playbackWatcher.forEach(eventName => {\n this.playbackWatcher_.on(eventName, metadata => {\n this.player_.trigger(_extends({}, metadata));\n });\n });\n }\n}\n/**\n * The Source Handler object, which informs video.js what additional\n * MIME types are supported and sets up playback. It is registered\n * automatically to the appropriate tech based on the capabilities of\n * the browser it is running in. It is not necessary to use or modify\n * this object in normal usage.\n */\n\nconst VhsSourceHandler = {\n name: 'videojs-http-streaming',\n VERSION: version$4,\n canHandleSource(srcObj, options = {}) {\n const localOptions = merge(videojs.options, options); // If not opting to experimentalUseMMS, and playback is only supported with MediaSource, cannot handle source\n\n if (!localOptions.vhs.experimentalUseMMS && !browserSupportsCodec('avc1.4d400d,mp4a.40.2', false)) {\n return false;\n }\n return VhsSourceHandler.canPlayType(srcObj.type, localOptions);\n },\n handleSource(source, tech, options = {}) {\n const localOptions = merge(videojs.options, options);\n tech.vhs = new VhsHandler(source, tech, localOptions);\n tech.vhs.xhr = xhrFactory();\n tech.vhs.setupXhrHooks_();\n tech.vhs.src(source.src, source.type);\n return tech.vhs;\n },\n canPlayType(type, options) {\n const simpleType = simpleTypeFromSourceType(type);\n if (!simpleType) {\n return '';\n }\n const overrideNative = VhsSourceHandler.getOverrideNative(options);\n const supportsTypeNatively = Vhs.supportsTypeNatively(simpleType);\n const canUseMsePlayback = !supportsTypeNatively || overrideNative;\n return canUseMsePlayback ? 'maybe' : '';\n },\n getOverrideNative(options = {}) {\n const {\n vhs = {}\n } = options;\n const defaultOverrideNative = !(videojs.browser.IS_ANY_SAFARI || videojs.browser.IS_IOS);\n const {\n overrideNative = defaultOverrideNative\n } = vhs;\n return overrideNative;\n }\n};\n/**\n * Check to see if either the native MediaSource or ManagedMediaSource\n * objectx exist and support an MP4 container with both H.264 video\n * and AAC-LC audio.\n *\n * @return {boolean} if native media sources are supported\n */\n\nconst supportsNativeMediaSources = () => {\n return browserSupportsCodec('avc1.4d400d,mp4a.40.2', true);\n}; // register source handlers with the appropriate techs\n\nif (supportsNativeMediaSources()) {\n videojs.getTech('Html5').registerSourceHandler(VhsSourceHandler, 0);\n}\nvideojs.VhsHandler = VhsHandler;\nvideojs.VhsSourceHandler = VhsSourceHandler;\nvideojs.Vhs = Vhs;\nif (!videojs.use) {\n videojs.registerComponent('Vhs', Vhs);\n}\nvideojs.options.vhs = videojs.options.vhs || {};\nif (!videojs.getPlugin || !videojs.getPlugin('reloadSourceOnError')) {\n videojs.registerPlugin('reloadSourceOnError', reloadSourceOnError);\n}\n\nexport { videojs as default };\n","import $ from \"jquery\";\r\nimport videojs from 'video.js';\r\nimport 'video.js/dist/video-js.min.css';\r\n// import ApexCharts from 'apexcharts';\r\n\r\nconst chartJs = (() => {\r\n const defaultAccordion = () => {\r\n // function createChart(ctx, yeniEtiketler, yeniIcerikler) {\r\n // var gradient = ctx.createLinearGradient(0, 0, 0, 400);\r\n // gradient.addColorStop(0, 'rgba(2, 69, 586, 0.1)'); \r\n // gradient.addColorStop(1, 'rgba(2, 69, 128, 0)');\r\n \r\n // return new Chart(ctx, {\r\n // type: 'line',\r\n // displayColors:false,\r\n // data: {\r\n // labels: yeniEtiketler, // Yeni etiketleri kullan\r\n // datasets: [{\r\n // label: \"EURO\",\r\n // data: yeniIcerikler, // Yeni içerikleri kullan\r\n // backgroundColor: gradient,\r\n // borderColor: '#004481',\r\n // tension: 0.1,\r\n // fill:\"start\",\r\n // }]\r\n // },\r\n // options: {\r\n // scales: {\r\n // y: {\r\n // display: false, // Y eksenini gizle\r\n // beginAtZero: true\r\n // },\r\n // x:{\r\n // grid: {\r\n // display: true, // Dikey grid çizgilerini göster\r\n // borderColor: 'dotted', // Border stilini belirle\r\n // borderWidth: 2, // Border kalınlığını ayarla\r\n // }\r\n // }\r\n \r\n // },\r\n // elements: {\r\n // grid: {\r\n // borderDash: [5, 5] // Çizgiyi dashed yapmak için\r\n // }\r\n // },\r\n // hover: {\r\n // mode: 'nearest', \r\n // intersect: true \r\n // },\r\n // interaction: {\r\n // mode: 'index',\r\n // intersect: false \r\n // },\r\n // plugins: {\r\n // labelColor:false, \r\n // legend: {\r\n // display: false\r\n // },\r\n // tooltip: {\r\n // displayColors: false,\r\n // enabled: true,\r\n // position: 'nearest',\r\n // usePointStyle: false,\r\n // xAlign: \"center\", \r\n // cornerRadius: 0, \r\n // backgroundColor: \"#F1F6FC\", \r\n // titleColor: \"#042a0b\", \r\n // bodyColor: \"#042a0b\", \r\n // padding:10,\r\n // bodyFont: {\r\n // size: 30 \r\n // },\r\n // callbacks: {\r\n // label: function(context) {\r\n // return context.parsed.y + ' TL';\r\n // },\r\n // title: function() {\r\n // return ''; // Boş bir string döndürerek başlığın gösterilmemesini sağlar\r\n // },\r\n // // HTML içeriği oluşturmak için kullanılacak fonksiyon\r\n // labelColor: function(context) {\r\n // var label = context.dataset.label || 'Euro';\r\n // var value = context.parsed.y || 0;\r\n // return {\r\n // borderColor: '#000',\r\n // backgroundColor: '#000',\r\n // color: '#fff',\r\n // borderRadius: 10,\r\n // borderWidth: 1,\r\n // padding: 20,\r\n // content: label + ': ' + value\r\n // };\r\n // }\r\n // }\r\n // }\r\n // }\r\n // }\r\n // });\r\n // }\r\n \r\n // // Grafik 1\r\n // var ctx1 = document.getElementById('dovizChart').getContext('2d');\r\n // createChart(ctx1, ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem'], [65, 59, 80, 81, 56, 55, 55]);\r\n \r\n // // Grafik 2\r\n // var ctx2 = document.getElementById('altinChart').getContext('2d');\r\n // createChart(ctx2, ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz'], [65, 59, 80, 81, 56, 55]);\r\n \r\n };\r\n const customVideo = () => {\r\n const videoElements = document.querySelectorAll('.custom-video');\r\n\r\n videoElements.forEach((videoElement) => {\r\n videojs(videoElement, {\r\n controls: true,\r\n autoplay: false,\r\n preload: 'auto',\r\n });\r\n });\r\n };\r\n\r\n // const dfChart = () => {\r\n // var chart1Nm = document.querySelector(\"#dovizChart\");\r\n // if(chart1Nm){\r\n // var options = {\r\n // series: [{\r\n // data: [\r\n // [1327359600000,30.95],\r\n // [1327446000000,31.34],\r\n // [1327532400000,31.18],\r\n // [1327618800000,31.05],\r\n // [1327878000000,31.00],\r\n // [1327964400000,30.95],\r\n // [1328050800000,31.24],\r\n // [1328137200000,31.29],\r\n // [1328223600000,31.85],\r\n // [1328482800000,31.86],\r\n // [1328569200000,32.28],\r\n // [1328655600000,32.10],\r\n // [1328742000000,32.65],\r\n // [1328828400000,32.21],\r\n // [1329087600000,32.35],\r\n // [1329174000000,32.44],\r\n // [1329260400000,32.46],\r\n // [1329346800000,32.86],\r\n // [1329433200000,32.75],\r\n // [1329778800000,32.54],\r\n // [1329865200000,32.33],\r\n // [1329951600000,32.97],\r\n // [1330038000000,33.41],\r\n // [1330297200000,33.27],\r\n // [1330383600000,33.27],\r\n // [1330470000000,32.89],\r\n // [1330556400000,33.10],\r\n // [1330642800000,33.73],\r\n // [1330902000000,33.22],\r\n // [1330988400000,31.99],\r\n // [1331074800000,32.41],\r\n // [1331161200000,33.05],\r\n // [1331247600000,33.64],\r\n // [1331506800000,33.56],\r\n // [1331593200000,34.22],\r\n // [1331679600000,33.77],\r\n // [1331766000000,34.17],\r\n // [1331852400000,33.82],\r\n // [1332111600000,34.51],\r\n // [1332198000000,33.16],\r\n // [1332284400000,33.56],\r\n // [1332370800000,33.71],\r\n // [1332457200000,33.81],\r\n // [1332712800000,34.40],\r\n // [1332799200000,34.63],\r\n // [1332885600000,34.46],\r\n // [1332972000000,34.48],\r\n // [1333058400000,34.31],\r\n // [1333317600000,34.70],\r\n // [1333404000000,34.31],\r\n // [1333490400000,33.46],\r\n // [1333576800000,33.59],\r\n // [1333922400000,33.22],\r\n // [1334008800000,32.61],\r\n // [1334095200000,33.01],\r\n // [1334181600000,33.55],\r\n // [1334268000000,33.18],\r\n // [1334527200000,32.84],\r\n // [1334613600000,33.84],\r\n // [1334700000000,33.39],\r\n // [1334786400000,32.91],\r\n // [1334872800000,33.06],\r\n // [1335132000000,32.62],\r\n // [1335218400000,32.40],\r\n // [1335304800000,33.13],\r\n // [1335391200000,33.26],\r\n // [1335477600000,33.58],\r\n // [1335736800000,33.55],\r\n // [1335823200000,33.77],\r\n // [1335909600000,33.76],\r\n // [1335996000000,33.32],\r\n // [1336082400000,32.61],\r\n // [1336341600000,32.52],\r\n // [1336428000000,32.67],\r\n // [1336514400000,32.52],\r\n // [1336600800000,31.92],\r\n // [1336687200000,32.20],\r\n // [1336946400000,32.23],\r\n // [1337032800000,32.33],\r\n // [1337119200000,32.36],\r\n // [1337205600000,32.01],\r\n // [1337292000000,31.31],\r\n // [1337551200000,32.01],\r\n // [1337637600000,32.01],\r\n // [1337724000000,32.18],\r\n // [1337810400000,31.54],\r\n // [1337896800000,31.60],\r\n // [1338242400000,32.05],\r\n // [1338328800000,31.29],\r\n // [1338415200000,31.05],\r\n // [1338501600000,29.82],\r\n // [1338760800000,30.31],\r\n // [1338847200000,30.70],\r\n // [1338933600000,31.69],\r\n // [1339020000000,31.32],\r\n // [1339106400000,31.65],\r\n // [1339365600000,31.13],\r\n // [1339452000000,31.77],\r\n // [1339538400000,31.79],\r\n // [1339624800000,31.67],\r\n // [1339711200000,32.39],\r\n // [1339970400000,32.63],\r\n // [1340056800000,32.89],\r\n // [1340143200000,31.99],\r\n // [1340229600000,31.23],\r\n // [1340316000000,31.57],\r\n // [1340575200000,30.84],\r\n // [1340661600000,31.07],\r\n // [1340748000000,31.41],\r\n // [1340834400000,31.17],\r\n // [1340920800000,32.37],\r\n // [1341180000000,32.19],\r\n // [1341266400000,32.51],\r\n // [1341439200000,32.53],\r\n // [1341525600000,31.37],\r\n // [1341784800000,30.43],\r\n // [1341871200000,30.44],\r\n // [1341957600000,30.20],\r\n // [1342044000000,30.14],\r\n // [1342130400000,30.65],\r\n // [1342389600000,30.40],\r\n // [1342476000000,30.65],\r\n // [1342562400000,31.43],\r\n // [1342648800000,31.89],\r\n // [1342735200000,31.38],\r\n // [1342994400000,30.64],\r\n // [1343080800000,30.02],\r\n // [1343167200000,30.33],\r\n // [1343253600000,30.95],\r\n // [1343340000000,31.89],\r\n // [1343599200000,31.01],\r\n // [1343685600000,30.88],\r\n // [1343772000000,30.69],\r\n // [1343858400000,30.58],\r\n // [1343944800000,32.02],\r\n // [1344204000000,32.14],\r\n // [1344290400000,32.37],\r\n // [1344376800000,32.51],\r\n // [1344463200000,32.65],\r\n // [1344549600000,32.64],\r\n // [1344808800000,32.27],\r\n // [1344895200000,32.10],\r\n // [1344981600000,32.91],\r\n // [1345068000000,33.65],\r\n // [1345154400000,33.80],\r\n // [1345413600000,33.92],\r\n // [1345500000000,33.75],\r\n // [1345586400000,33.84],\r\n // [1345672800000,33.50],\r\n // [1345759200000,32.26],\r\n // [1346018400000,32.32],\r\n // [1346104800000,32.06],\r\n // [1346191200000,31.96],\r\n // [1346277600000,31.46],\r\n // [1346364000000,31.27],\r\n // [1346709600000,31.43],\r\n // [1346796000000,32.26],\r\n // [1346882400000,32.79],\r\n // [1346968800000,32.46],\r\n // [1347228000000,32.13],\r\n // [1347314400000,32.43],\r\n // [1347400800000,32.42],\r\n // [1347487200000,32.81],\r\n // [1347573600000,33.34],\r\n // [1347832800000,33.41],\r\n // [1347919200000,32.57],\r\n // [1348005600000,33.12],\r\n // [1348092000000,34.53],\r\n // [1348178400000,33.83],\r\n // [1348437600000,33.41],\r\n // [1348524000000,32.90],\r\n // [1348610400000,32.53],\r\n // [1348696800000,32.80],\r\n // [1348783200000,32.44],\r\n // [1349042400000,32.62],\r\n // [1349128800000,32.57],\r\n // [1349215200000,32.60],\r\n // [1349301600000,32.68],\r\n // [1349388000000,32.47],\r\n // [1349647200000,32.23],\r\n // [1349733600000,31.68],\r\n // [1349820000000,31.51],\r\n // [1349906400000,31.78],\r\n // [1349992800000,31.94],\r\n // [1350252000000,32.33],\r\n // [1350338400000,33.24],\r\n // [1350424800000,33.44],\r\n // [1350511200000,33.48],\r\n // [1350597600000,33.24],\r\n // [1350856800000,33.49],\r\n // [1350943200000,33.31],\r\n // [1351029600000,33.36],\r\n // [1351116000000,33.40],\r\n // [1351202400000,34.01],\r\n // [1351638000000,34.02],\r\n // [1351724400000,34.36],\r\n // [1351810800000,34.39],\r\n // [1352070000000,34.24],\r\n // [1352156400000,34.39],\r\n // [1352242800000,33.47],\r\n // [1352329200000,32.98],\r\n // [1352415600000,32.90],\r\n // [1352674800000,32.70],\r\n // [1352761200000,32.54],\r\n // [1352847600000,32.23],\r\n // [1352934000000,32.64],\r\n // [1353020400000,32.65],\r\n // [1353279600000,32.92],\r\n // [1353366000000,32.64],\r\n // [1353452400000,32.84],\r\n // [1353625200000,33.40],\r\n // [1353884400000,33.30],\r\n // [1353970800000,33.18],\r\n // [1354057200000,33.88],\r\n // [1354143600000,34.09],\r\n // [1354230000000,34.61],\r\n // [1354489200000,34.70],\r\n // [1354575600000,35.30],\r\n // [1354662000000,35.40],\r\n // [1354748400000,35.14],\r\n // [1354834800000,35.48],\r\n // [1355094000000,35.75],\r\n // [1355180400000,35.54],\r\n // [1355266800000,35.96],\r\n // [1355353200000,35.53],\r\n // [1355439600000,37.56],\r\n // [1355698800000,37.42],\r\n // [1355785200000,37.49],\r\n // [1355871600000,38.09],\r\n // [1355958000000,37.87],\r\n // [1356044400000,37.71],\r\n // [1356303600000,37.53],\r\n // [1356476400000,37.55],\r\n // [1356562800000,37.30],\r\n // [1356649200000,36.90],\r\n // [1356908400000,37.68],\r\n // [1357081200000,38.34],\r\n // [1357167600000,37.75],\r\n // [1357254000000,38.13],\r\n // [1357513200000,37.94],\r\n // [1357599600000,38.14],\r\n // [1357686000000,38.66],\r\n // [1357772400000,38.62],\r\n // [1357858800000,38.09],\r\n // [1358118000000,38.16],\r\n // [1358204400000,38.15],\r\n // [1358290800000,37.88],\r\n // [1358377200000,37.73],\r\n // [1358463600000,37.98],\r\n // [1358809200000,37.95],\r\n // [1358895600000,38.25],\r\n // [1358982000000,38.10],\r\n // [1359068400000,38.32],\r\n // [1359327600000,38.24],\r\n // [1359414000000,38.52],\r\n // [1359500400000,37.94],\r\n // [1359586800000,37.83],\r\n // [1359673200000,38.34],\r\n // [1359932400000,38.10],\r\n // [1360018800000,38.51],\r\n // [1360105200000,38.40],\r\n // [1360191600000,38.07],\r\n // [1360278000000,39.12],\r\n // [1360537200000,38.64],\r\n // [1360623600000,38.89],\r\n // [1360710000000,38.81],\r\n // [1360796400000,38.61],\r\n // [1360882800000,38.63],\r\n // [1361228400000,38.99],\r\n // [1361314800000,38.77],\r\n // [1361401200000,38.34],\r\n // [1361487600000,38.55],\r\n // [1361746800000,38.11],\r\n // [1361833200000,38.59],\r\n // [1361919600000,39.60],\r\n // ]\r\n // }],\r\n // chart: {\r\n // id: 'area-datetime',\r\n // type: 'area',\r\n // height: 300,\r\n // toolbar: {\r\n // show: false,\r\n // },\r\n // zoom: {\r\n // enabled: false\r\n // }\r\n // },\r\n // stroke: {\r\n // width: 2,\r\n // colors: ['rgba(15, 73, 140, 0.8)']\r\n // },\r\n // grid: {\r\n // show: true,\r\n // padding: { left: -10, right: -10, top: 0, bottom: 0 },\r\n // strokeDashArray: 3,\r\n // yaxis: {\r\n // lines: {\r\n // show: false\r\n // }\r\n // },\r\n // xaxis: {\r\n // lines: {\r\n // show: true\r\n // }\r\n // }\r\n // },\r\n // dataLabels: {\r\n // enabled: false\r\n // },\r\n // markers: {\r\n // size: 0,\r\n // style: 'hollow',\r\n // },\r\n // yaxis: {\r\n // show:false,\r\n // },\r\n // xaxis: {\r\n // type: 'datetime',\r\n // min: new Date('01 Mar 2012').getTime(),\r\n // tickAmount: 6,\r\n // // categories: ['2024-01-01', '2024-02-01', '2024-03-01', '2024-04-01', '2024-05-01', '2024-06-01', '2024-07-01'],\r\n // labels: {\r\n // formatter: function(value, timestamp, opts) {\r\n // // Tarihi istediğiniz formatta gösterebilirsiniz\r\n // var date = new Date(value);\r\n // return date.toLocaleDateString('tr-TR', {\r\n // month: 'short', // Kısa ay ismi (Oca, Şub, vb.)\r\n // day: 'numeric', // Gün sayısı (1, 2, vb.)\r\n // year: 'numeric' // Yıl sayısı (2024)\r\n // });\r\n // },\r\n // style: {\r\n // colors: ['#808695'],\r\n // fontSize: '12px'\r\n // }\r\n // },\r\n // axisBorder: {\r\n // show: false\r\n // },\r\n // axisTicks: {\r\n // show: false\r\n // }\r\n // },\r\n // tooltip: {\r\n // x: {\r\n // format: 'dd MMMM yyyy'\r\n // },\r\n // custom: function({series, seriesIndex, dataPointIndex, w}) {\r\n // return '' +\r\n // '' + series[seriesIndex][dataPointIndex] + ' TRY' +\r\n // '
'\r\n // }\r\n // },\r\n // fill: {\r\n // type: 'gradient',\r\n // gradient: {\r\n // shade: 'dark',\r\n // gradientToColors: ['#00377B'],\r\n // shadeIntensity: 0,\r\n // opacityFrom: 1,\r\n // opacityTo: 0,\r\n // stops: [0, 100],\r\n // colorStops: [\r\n // {\r\n // offset: 0,\r\n // color: \"#00377B\", // Başlangıç rengi\r\n // opacity: 0.1\r\n // },\r\n // {\r\n // offset: 100,\r\n // color: \"#00377B\", // Bitiş rengi\r\n // opacity: 0\r\n // }\r\n // ]\r\n // }\r\n // },\r\n // };\r\n \r\n // var chart = new ApexCharts(document.querySelector(\"#dovizChart\"), options); \r\n // chart.render();\r\n \r\n \r\n // var resetCssClasses = function(activeEl) {\r\n // var els = document.querySelectorAll('button')\r\n // Array.prototype.forEach.call(els, function(el) {\r\n // el.classList.remove('active')\r\n // })\r\n \r\n // activeEl.target.classList.add('active')\r\n // }\r\n \r\n // document\r\n // .querySelector('#one_month')\r\n // .addEventListener('click', function(e) {\r\n // resetCssClasses(e)\r\n \r\n // chart.zoomX(\r\n // new Date('28 Jan 2013').getTime(),\r\n // new Date('27 Feb 2013').getTime()\r\n // )\r\n // })\r\n \r\n // document\r\n // .querySelector('#six_months')\r\n // .addEventListener('click', function(e) {\r\n // resetCssClasses(e)\r\n \r\n // chart.zoomX(\r\n // new Date('27 Sep 2012').getTime(),\r\n // new Date('27 Feb 2013').getTime()\r\n // )\r\n // })\r\n \r\n // document\r\n // .querySelector('#one_year')\r\n // .addEventListener('click', function(e) {\r\n // resetCssClasses(e)\r\n // chart.zoomX(\r\n // new Date('27 Feb 2012').getTime(),\r\n // new Date('27 Feb 2013').getTime()\r\n // )\r\n // })\r\n \r\n // document.querySelector('#ytd').addEventListener('click', function(e) {\r\n // resetCssClasses(e)\r\n \r\n // chart.zoomX(\r\n // new Date('01 Jan 2013').getTime(),\r\n // new Date('27 Feb 2013').getTime()\r\n // )\r\n // })\r\n \r\n // document.querySelector('#all').addEventListener('click', function(e) {\r\n // resetCssClasses(e)\r\n \r\n // chart.zoomX(\r\n // new Date('23 Jan 2012').getTime(),\r\n // new Date('27 Feb 2013').getTime()\r\n // )\r\n // })\r\n // }\r\n \r\n // var chart2Nm = document.querySelector(\"#altinChart\");\r\n // if(chart2Nm){\r\n // var options2 = {\r\n // series: [{\r\n // data: [\r\n // [1327359600000,30.95],\r\n // [1327446000000,31.34],\r\n // [1327532400000,31.18],\r\n // [1327618800000,31.05],\r\n // [1327878000000,31.00],\r\n // [1327964400000,30.95],\r\n // [1328050800000,31.24],\r\n // [1328137200000,31.29],\r\n // [1328223600000,31.85],\r\n // [1328482800000,31.86],\r\n // [1328569200000,32.28],\r\n // [1328655600000,32.10],\r\n // [1328742000000,32.65],\r\n // [1328828400000,32.21],\r\n // [1329087600000,32.35],\r\n // [1329174000000,32.44],\r\n // [1329260400000,32.46],\r\n // [1329346800000,32.86],\r\n // [1329433200000,32.75],\r\n // [1329778800000,32.54],\r\n // [1329865200000,32.33],\r\n // [1329951600000,32.97],\r\n // [1330038000000,33.41],\r\n // [1330297200000,33.27],\r\n // [1330383600000,33.27],\r\n // [1330470000000,32.89],\r\n // [1330556400000,33.10],\r\n // [1330642800000,33.73],\r\n // [1330902000000,33.22],\r\n // [1330988400000,31.99],\r\n // [1331074800000,32.41],\r\n // [1331161200000,33.05],\r\n // [1331247600000,33.64],\r\n // [1331506800000,33.56],\r\n // [1331593200000,34.22],\r\n // [1331679600000,33.77],\r\n // [1331766000000,34.17],\r\n // [1331852400000,33.82],\r\n // [1332111600000,34.51],\r\n // [1332198000000,33.16],\r\n // [1332284400000,33.56],\r\n // [1332370800000,33.71],\r\n // [1332457200000,33.81],\r\n // [1332712800000,34.40],\r\n // [1332799200000,34.63],\r\n // [1332885600000,34.46],\r\n // [1332972000000,34.48],\r\n // [1333058400000,34.31],\r\n // [1333317600000,34.70],\r\n // [1333404000000,34.31],\r\n // [1333490400000,33.46],\r\n // [1333576800000,33.59],\r\n // [1333922400000,33.22],\r\n // [1334008800000,32.61],\r\n // [1334095200000,33.01],\r\n // [1334181600000,33.55],\r\n // [1334268000000,33.18],\r\n // [1334527200000,32.84],\r\n // [1334613600000,33.84],\r\n // [1334700000000,33.39],\r\n // [1334786400000,32.91],\r\n // [1334872800000,33.06],\r\n // [1335132000000,32.62],\r\n // [1335218400000,32.40],\r\n // [1335304800000,33.13],\r\n // [1335391200000,33.26],\r\n // [1335477600000,33.58],\r\n // [1335736800000,33.55],\r\n // [1335823200000,33.77],\r\n // [1335909600000,33.76],\r\n // [1335996000000,33.32],\r\n // [1336082400000,32.61],\r\n // [1336341600000,32.52],\r\n // [1336428000000,32.67],\r\n // [1336514400000,32.52],\r\n // [1336600800000,31.92],\r\n // [1336687200000,32.20],\r\n // [1336946400000,32.23],\r\n // [1337032800000,32.33],\r\n // [1337119200000,32.36],\r\n // [1337205600000,32.01],\r\n // [1337292000000,31.31],\r\n // [1337551200000,32.01],\r\n // [1337637600000,32.01],\r\n // [1337724000000,32.18],\r\n // [1337810400000,31.54],\r\n // [1337896800000,31.60],\r\n // [1338242400000,32.05],\r\n // [1338328800000,31.29],\r\n // [1338415200000,31.05],\r\n // [1338501600000,29.82],\r\n // [1338760800000,30.31],\r\n // [1338847200000,30.70],\r\n // [1338933600000,31.69],\r\n // [1339020000000,31.32],\r\n // [1339106400000,31.65],\r\n // [1339365600000,31.13],\r\n // [1339452000000,31.77],\r\n // [1339538400000,31.79],\r\n // [1339624800000,31.67],\r\n // [1339711200000,32.39],\r\n // [1339970400000,32.63],\r\n // [1340056800000,32.89],\r\n // [1340143200000,31.99],\r\n // [1340229600000,31.23],\r\n // [1340316000000,31.57],\r\n // [1340575200000,30.84],\r\n // [1340661600000,31.07],\r\n // [1340748000000,31.41],\r\n // [1340834400000,31.17],\r\n // [1340920800000,32.37],\r\n // [1341180000000,32.19],\r\n // [1341266400000,32.51],\r\n // [1341439200000,32.53],\r\n // [1341525600000,31.37],\r\n // [1341784800000,30.43],\r\n // [1341871200000,30.44],\r\n // [1341957600000,30.20],\r\n // [1342044000000,30.14],\r\n // [1342130400000,30.65],\r\n // [1342389600000,30.40],\r\n // [1342476000000,30.65],\r\n // [1342562400000,31.43],\r\n // [1342648800000,31.89],\r\n // [1342735200000,31.38],\r\n // [1342994400000,30.64],\r\n // [1343080800000,30.02],\r\n // [1343167200000,30.33],\r\n // [1343253600000,30.95],\r\n // [1343340000000,31.89],\r\n // [1343599200000,31.01],\r\n // [1343685600000,30.88],\r\n // [1343772000000,30.69],\r\n // [1343858400000,30.58],\r\n // [1343944800000,32.02],\r\n // [1344204000000,32.14],\r\n // [1344290400000,32.37],\r\n // [1344376800000,32.51],\r\n // [1344463200000,32.65],\r\n // [1344549600000,32.64],\r\n // [1344808800000,32.27],\r\n // [1344895200000,32.10],\r\n // [1344981600000,32.91],\r\n // [1345068000000,33.65],\r\n // [1345154400000,33.80],\r\n // [1345413600000,33.92],\r\n // [1345500000000,33.75],\r\n // [1345586400000,33.84],\r\n // [1345672800000,33.50],\r\n // [1345759200000,32.26],\r\n // [1346018400000,32.32],\r\n // [1346104800000,32.06],\r\n // [1346191200000,31.96],\r\n // [1346277600000,31.46],\r\n // [1346364000000,31.27],\r\n // [1346709600000,31.43],\r\n // [1346796000000,32.26],\r\n // [1346882400000,32.79],\r\n // [1346968800000,32.46],\r\n // [1347228000000,32.13],\r\n // [1347314400000,32.43],\r\n // [1347400800000,32.42],\r\n // [1347487200000,32.81],\r\n // [1347573600000,33.34],\r\n // [1347832800000,33.41],\r\n // [1347919200000,32.57],\r\n // [1348005600000,33.12],\r\n // [1348092000000,34.53],\r\n // [1348178400000,33.83],\r\n // [1348437600000,33.41],\r\n // [1348524000000,32.90],\r\n // [1348610400000,32.53],\r\n // [1348696800000,32.80],\r\n // [1348783200000,32.44],\r\n // [1349042400000,32.62],\r\n // [1349128800000,32.57],\r\n // [1349215200000,32.60],\r\n // [1349301600000,32.68],\r\n // [1349388000000,32.47],\r\n // [1349647200000,32.23],\r\n // [1349733600000,31.68],\r\n // [1349820000000,31.51],\r\n // [1349906400000,31.78],\r\n // [1349992800000,31.94],\r\n // [1350252000000,32.33],\r\n // [1350338400000,33.24],\r\n // [1350424800000,33.44],\r\n // [1350511200000,33.48],\r\n // [1350597600000,33.24],\r\n // [1350856800000,33.49],\r\n // [1350943200000,33.31],\r\n // [1351029600000,33.36],\r\n // [1351116000000,33.40],\r\n // [1351202400000,34.01],\r\n // [1351638000000,34.02],\r\n // [1351724400000,34.36],\r\n // [1351810800000,34.39],\r\n // [1352070000000,34.24],\r\n // [1352156400000,34.39],\r\n // [1352242800000,33.47],\r\n // [1352329200000,32.98],\r\n // [1352415600000,32.90],\r\n // [1352674800000,32.70],\r\n // [1352761200000,32.54],\r\n // [1352847600000,32.23],\r\n // [1352934000000,32.64],\r\n // [1353020400000,32.65],\r\n // [1353279600000,32.92],\r\n // [1353366000000,32.64],\r\n // [1353452400000,32.84],\r\n // [1353625200000,33.40],\r\n // [1353884400000,33.30],\r\n // [1353970800000,33.18],\r\n // [1354057200000,33.88],\r\n // [1354143600000,34.09],\r\n // [1354230000000,34.61],\r\n // [1354489200000,34.70],\r\n // [1354575600000,35.30],\r\n // [1354662000000,35.40],\r\n // [1354748400000,35.14],\r\n // [1354834800000,35.48],\r\n // [1355094000000,35.75],\r\n // [1355180400000,35.54],\r\n // [1355266800000,35.96],\r\n // [1355353200000,35.53],\r\n // [1355439600000,37.56],\r\n // [1355698800000,37.42],\r\n // [1355785200000,37.49],\r\n // [1355871600000,38.09],\r\n // [1355958000000,37.87],\r\n // [1356044400000,37.71],\r\n // [1356303600000,37.53],\r\n // [1356476400000,37.55],\r\n // [1356562800000,37.30],\r\n // [1356649200000,36.90],\r\n // [1356908400000,37.68],\r\n // [1357081200000,38.34],\r\n // [1357167600000,37.75],\r\n // [1357254000000,38.13],\r\n // [1357513200000,37.94],\r\n // [1357599600000,38.14],\r\n // [1357686000000,38.66],\r\n // [1357772400000,38.62],\r\n // [1357858800000,38.09],\r\n // [1358118000000,38.16],\r\n // [1358204400000,38.15],\r\n // [1358290800000,37.88],\r\n // [1358377200000,37.73],\r\n // [1358463600000,37.98],\r\n // [1358809200000,37.95],\r\n // [1358895600000,38.25],\r\n // [1358982000000,38.10],\r\n // [1359068400000,38.32],\r\n // [1359327600000,38.24],\r\n // [1359414000000,38.52],\r\n // [1359500400000,37.94],\r\n // [1359586800000,37.83],\r\n // [1359673200000,38.34],\r\n // [1359932400000,38.10],\r\n // [1360018800000,38.51],\r\n // [1360105200000,38.40],\r\n // [1360191600000,38.07],\r\n // [1360278000000,39.12],\r\n // [1360537200000,38.64],\r\n // [1360623600000,38.89],\r\n // [1360710000000,38.81],\r\n // [1360796400000,38.61],\r\n // [1360882800000,38.63],\r\n // [1361228400000,38.99],\r\n // [1361314800000,38.77],\r\n // [1361401200000,38.34],\r\n // [1361487600000,38.55],\r\n // [1361746800000,38.11],\r\n // [1361833200000,38.59],\r\n // [1361919600000,39.60],\r\n // ]\r\n // }],\r\n // chart: {\r\n // id: 'area-datetime',\r\n // type: 'area',\r\n // height: 300,\r\n // toolbar: {\r\n // show: false,\r\n // },\r\n // zoom: {\r\n // enabled: false\r\n // }\r\n // },\r\n // grid: {\r\n // show: true,\r\n // padding: { left: -10, right: -10, top: 0, bottom: 0 },\r\n // },\r\n // dataLabels: {\r\n // enabled: false\r\n // },\r\n // markers: {\r\n // size: 0,\r\n // style: 'hollow',\r\n // },\r\n // yaxis: {\r\n // show:false,\r\n // },\r\n // xaxis: {\r\n // type: 'datetime',\r\n // min: new Date('01 Mar 2012').getTime(),\r\n // tickAmount: 6,\r\n // },\r\n // tooltip: {\r\n // x: {\r\n // format: 'dd MMMM yyyy'\r\n // },\r\n // custom: function({series, seriesIndex, dataPointIndex, w}) {\r\n // return '' +\r\n // '' + series[seriesIndex][dataPointIndex] + ' TRY' +\r\n // '
'\r\n // }\r\n // },\r\n // fill: {\r\n // type: 'gradient',\r\n // gradient: {\r\n // shade: 'dark',\r\n // gradientToColors: ['#014581', '#014581'],\r\n // shadeIntensity: 0,\r\n // opacityFrom: 1,\r\n // opacityTo: 0,\r\n // stops: [0, 90, 100],\r\n // colorStops: [],\r\n // }\r\n // },\r\n // };\r\n \r\n // var chartGold = new ApexCharts(document.querySelector(\"#altinChart\"), options2); \r\n // chartGold.render();\r\n \r\n \r\n // var resetCssClasses2 = function(activeEl2) {\r\n // var els2 = document.querySelectorAll('button')\r\n // Array.prototype.forEach.call(els2, function(el) {\r\n // el.classList.remove('active')\r\n // })\r\n \r\n // activeEl2.target.classList.add('active')\r\n // }\r\n \r\n // document\r\n // .querySelector('#one_month_altin')\r\n // .addEventListener('click', function(e) {\r\n // resetCssClasses2(e)\r\n \r\n // chartGold.zoomX(\r\n // new Date('28 Jan 2013').getTime(),\r\n // new Date('27 Feb 2013').getTime()\r\n // )\r\n // })\r\n \r\n // document\r\n // .querySelector('#six_months_altin')\r\n // .addEventListener('click', function(e) {\r\n // resetCssClasses2(e)\r\n \r\n // chartGold.zoomX(\r\n // new Date('27 Sep 2012').getTime(),\r\n // new Date('27 Feb 2013').getTime()\r\n // )\r\n // })\r\n \r\n // document\r\n // .querySelector('#one_year_altin')\r\n // .addEventListener('click', function(e) {\r\n // resetCssClasses2(e)\r\n // chartGold.zoomX(\r\n // new Date('27 Feb 2012').getTime(),\r\n // new Date('27 Feb 2013').getTime()\r\n // )\r\n // })\r\n \r\n // document.querySelector('#ytd_altin').addEventListener('click', function(e) {\r\n // resetCssClasses2(e)\r\n \r\n // chartGold.zoomX(\r\n // new Date('01 Jan 2013').getTime(),\r\n // new Date('27 Feb 2013').getTime()\r\n // )\r\n // })\r\n \r\n // document.querySelector('#all_altin').addEventListener('click', function(e) {\r\n // resetCssClasses2(e)\r\n \r\n // chartGold.zoomX(\r\n // new Date('23 Jan 2012').getTime(),\r\n // new Date('27 Feb 2013').getTime()\r\n // )\r\n // })\r\n // }\r\n \r\n // // var chart2Nm = document.querySelector(\"#altinChart2\");\r\n // // if(chart2Nm){\r\n // // var options2 = {\r\n // // series: [{\r\n // // data: [\r\n // // [1327359600000,30.95],\r\n // // [1327446000000,31.34],\r\n // // [1327532400000,31.18],\r\n // // [1327618800000,31.05],\r\n // // [1327878000000,31.00],\r\n // // [1327964400000,30.95],\r\n // // [1328050800000,31.24],\r\n // // [1328137200000,31.29],\r\n // // [1328223600000,31.85],\r\n // // [1328482800000,31.86],\r\n // // [1328569200000,32.28],\r\n // // [1328655600000,32.10],\r\n // // [1328742000000,32.65],\r\n // // [1328828400000,32.21],\r\n // // [1329087600000,32.35],\r\n // // [1329174000000,32.44],\r\n // // [1329260400000,32.46],\r\n // // [1329346800000,32.86],\r\n // // [1329433200000,32.75],\r\n // // [1329778800000,32.54],\r\n // // [1329865200000,32.33],\r\n // // [1329951600000,32.97],\r\n // // [1330038000000,33.41],\r\n // // [1330297200000,33.27],\r\n // // [1330383600000,33.27],\r\n // // [1330470000000,32.89],\r\n // // [1330556400000,33.10],\r\n // // [1330642800000,33.73],\r\n // // [1330902000000,33.22],\r\n // // [1330988400000,31.99],\r\n // // [1331074800000,32.41],\r\n // // [1331161200000,33.05],\r\n // // [1331247600000,33.64],\r\n // // [1331506800000,33.56],\r\n // // [1331593200000,34.22],\r\n // // [1331679600000,33.77],\r\n // // [1331766000000,34.17],\r\n // // [1331852400000,33.82],\r\n // // [1332111600000,34.51],\r\n // // [1332198000000,33.16],\r\n // // [1332284400000,33.56],\r\n // // [1332370800000,33.71],\r\n // // [1332457200000,33.81],\r\n // // [1332712800000,34.40],\r\n // // [1332799200000,34.63],\r\n // // [1332885600000,34.46],\r\n // // [1332972000000,34.48],\r\n // // [1333058400000,34.31],\r\n // // [1333317600000,34.70],\r\n // // [1333404000000,34.31],\r\n // // [1333490400000,33.46],\r\n // // [1333576800000,33.59],\r\n // // [1333922400000,33.22],\r\n // // [1334008800000,32.61],\r\n // // [1334095200000,33.01],\r\n // // [1334181600000,33.55],\r\n // // [1334268000000,33.18],\r\n // // [1334527200000,32.84],\r\n // // [1334613600000,33.84],\r\n // // [1334700000000,33.39],\r\n // // [1334786400000,32.91],\r\n // // [1334872800000,33.06],\r\n // // [1335132000000,32.62],\r\n // // [1335218400000,32.40],\r\n // // [1335304800000,33.13],\r\n // // [1335391200000,33.26],\r\n // // [1335477600000,33.58],\r\n // // [1335736800000,33.55],\r\n // // [1335823200000,33.77],\r\n // // [1335909600000,33.76],\r\n // // [1335996000000,33.32],\r\n // // [1336082400000,32.61],\r\n // // [1336341600000,32.52],\r\n // // [1336428000000,32.67],\r\n // // [1336514400000,32.52],\r\n // // [1336600800000,31.92],\r\n // // [1336687200000,32.20],\r\n // // [1336946400000,32.23],\r\n // // [1337032800000,32.33],\r\n // // [1337119200000,32.36],\r\n // // [1337205600000,32.01],\r\n // // [1337292000000,31.31],\r\n // // [1337551200000,32.01],\r\n // // [1337637600000,32.01],\r\n // // [1337724000000,32.18],\r\n // // [1337810400000,31.54],\r\n // // [1337896800000,31.60],\r\n // // [1338242400000,32.05],\r\n // // [1338328800000,31.29],\r\n // // [1338415200000,31.05],\r\n // // [1338501600000,29.82],\r\n // // [1338760800000,30.31],\r\n // // [1338847200000,30.70],\r\n // // [1338933600000,31.69],\r\n // // [1339020000000,31.32],\r\n // // [1339106400000,31.65],\r\n // // [1339365600000,31.13],\r\n // // [1339452000000,31.77],\r\n // // [1339538400000,31.79],\r\n // // [1339624800000,31.67],\r\n // // [1339711200000,32.39],\r\n // // [1339970400000,32.63],\r\n // // [1340056800000,32.89],\r\n // // [1340143200000,31.99],\r\n // // [1340229600000,31.23],\r\n // // [1340316000000,31.57],\r\n // // [1340575200000,30.84],\r\n // // [1340661600000,31.07],\r\n // // [1340748000000,31.41],\r\n // // [1340834400000,31.17],\r\n // // [1340920800000,32.37],\r\n // // [1341180000000,32.19],\r\n // // [1341266400000,32.51],\r\n // // [1341439200000,32.53],\r\n // // [1341525600000,31.37],\r\n // // [1341784800000,30.43],\r\n // // [1341871200000,30.44],\r\n // // [1341957600000,30.20],\r\n // // [1342044000000,30.14],\r\n // // [1342130400000,30.65],\r\n // // [1342389600000,30.40],\r\n // // [1342476000000,30.65],\r\n // // [1342562400000,31.43],\r\n // // [1342648800000,31.89],\r\n // // [1342735200000,31.38],\r\n // // [1342994400000,30.64],\r\n // // [1343080800000,30.02],\r\n // // [1343167200000,30.33],\r\n // // [1343253600000,30.95],\r\n // // [1343340000000,31.89],\r\n // // [1343599200000,31.01],\r\n // // [1343685600000,30.88],\r\n // // [1343772000000,30.69],\r\n // // [1343858400000,30.58],\r\n // // [1343944800000,32.02],\r\n // // [1344204000000,32.14],\r\n // // [1344290400000,32.37],\r\n // // [1344376800000,32.51],\r\n // // [1344463200000,32.65],\r\n // // [1344549600000,32.64],\r\n // // [1344808800000,32.27],\r\n // // [1344895200000,32.10],\r\n // // [1344981600000,32.91],\r\n // // [1345068000000,33.65],\r\n // // [1345154400000,33.80],\r\n // // [1345413600000,33.92],\r\n // // [1345500000000,33.75],\r\n // // [1345586400000,33.84],\r\n // // [1345672800000,33.50],\r\n // // [1345759200000,32.26],\r\n // // [1346018400000,32.32],\r\n // // [1346104800000,32.06],\r\n // // [1346191200000,31.96],\r\n // // [1346277600000,31.46],\r\n // // [1346364000000,31.27],\r\n // // [1346709600000,31.43],\r\n // // [1346796000000,32.26],\r\n // // [1346882400000,32.79],\r\n // // [1346968800000,32.46],\r\n // // [1347228000000,32.13],\r\n // // [1347314400000,32.43],\r\n // // [1347400800000,32.42],\r\n // // [1347487200000,32.81],\r\n // // [1347573600000,33.34],\r\n // // [1347832800000,33.41],\r\n // // [1347919200000,32.57],\r\n // // [1348005600000,33.12],\r\n // // [1348092000000,34.53],\r\n // // [1348178400000,33.83],\r\n // // [1348437600000,33.41],\r\n // // [1348524000000,32.90],\r\n // // [1348610400000,32.53],\r\n // // [1348696800000,32.80],\r\n // // [1348783200000,32.44],\r\n // // [1349042400000,32.62],\r\n // // [1349128800000,32.57],\r\n // // [1349215200000,32.60],\r\n // // [1349301600000,32.68],\r\n // // [1349388000000,32.47],\r\n // // [1349647200000,32.23],\r\n // // [1349733600000,31.68],\r\n // // [1349820000000,31.51],\r\n // // [1349906400000,31.78],\r\n // // [1349992800000,31.94],\r\n // // [1350252000000,32.33],\r\n // // [1350338400000,33.24],\r\n // // [1350424800000,33.44],\r\n // // [1350511200000,33.48],\r\n // // [1350597600000,33.24],\r\n // // [1350856800000,33.49],\r\n // // [1350943200000,33.31],\r\n // // [1351029600000,33.36],\r\n // // [1351116000000,33.40],\r\n // // [1351202400000,34.01],\r\n // // [1351638000000,34.02],\r\n // // [1351724400000,34.36],\r\n // // [1351810800000,34.39],\r\n // // [1352070000000,34.24],\r\n // // [1352156400000,34.39],\r\n // // [1352242800000,33.47],\r\n // // [1352329200000,32.98],\r\n // // [1352415600000,32.90],\r\n // // [1352674800000,32.70],\r\n // // [1352761200000,32.54],\r\n // // [1352847600000,32.23],\r\n // // [1352934000000,32.64],\r\n // // [1353020400000,32.65],\r\n // // [1353279600000,32.92],\r\n // // [1353366000000,32.64],\r\n // // [1353452400000,32.84],\r\n // // [1353625200000,33.40],\r\n // // [1353884400000,33.30],\r\n // // [1353970800000,33.18],\r\n // // [1354057200000,33.88],\r\n // // [1354143600000,34.09],\r\n // // [1354230000000,34.61],\r\n // // [1354489200000,34.70],\r\n // // [1354575600000,35.30],\r\n // // [1354662000000,35.40],\r\n // // [1354748400000,35.14],\r\n // // [1354834800000,35.48],\r\n // // [1355094000000,35.75],\r\n // // [1355180400000,35.54],\r\n // // [1355266800000,35.96],\r\n // // [1355353200000,35.53],\r\n // // [1355439600000,37.56],\r\n // // [1355698800000,37.42],\r\n // // [1355785200000,37.49],\r\n // // [1355871600000,38.09],\r\n // // [1355958000000,37.87],\r\n // // [1356044400000,37.71],\r\n // // [1356303600000,37.53],\r\n // // [1356476400000,37.55],\r\n // // [1356562800000,37.30],\r\n // // [1356649200000,36.90],\r\n // // [1356908400000,37.68],\r\n // // [1357081200000,38.34],\r\n // // [1357167600000,37.75],\r\n // // [1357254000000,38.13],\r\n // // [1357513200000,37.94],\r\n // // [1357599600000,38.14],\r\n // // [1357686000000,38.66],\r\n // // [1357772400000,38.62],\r\n // // [1357858800000,38.09],\r\n // // [1358118000000,38.16],\r\n // // [1358204400000,38.15],\r\n // // [1358290800000,37.88],\r\n // // [1358377200000,37.73],\r\n // // [1358463600000,37.98],\r\n // // [1358809200000,37.95],\r\n // // [1358895600000,38.25],\r\n // // [1358982000000,38.10],\r\n // // [1359068400000,38.32],\r\n // // [1359327600000,38.24],\r\n // // [1359414000000,38.52],\r\n // // [1359500400000,37.94],\r\n // // [1359586800000,37.83],\r\n // // [1359673200000,38.34],\r\n // // [1359932400000,38.10],\r\n // // [1360018800000,38.51],\r\n // // [1360105200000,38.40],\r\n // // [1360191600000,38.07],\r\n // // [1360278000000,39.12],\r\n // // [1360537200000,38.64],\r\n // // [1360623600000,38.89],\r\n // // [1360710000000,38.81],\r\n // // [1360796400000,38.61],\r\n // // [1360882800000,38.63],\r\n // // [1361228400000,38.99],\r\n // // [1361314800000,38.77],\r\n // // [1361401200000,38.34],\r\n // // [1361487600000,38.55],\r\n // // [1361746800000,38.11],\r\n // // [1361833200000,38.59],\r\n // // [1361919600000,39.60],\r\n // // ]\r\n // // }],\r\n // // chart: {\r\n // // id: 'area-datetime',\r\n // // type: 'area',\r\n // // height: 300,\r\n // // toolbar: {\r\n // // show: false,\r\n // // },\r\n // // zoom: {\r\n // // enabled: false\r\n // // }\r\n // // },\r\n // // grid: {\r\n // // show: true,\r\n // // padding: { left: -10, right: -10, top: 0, bottom: 0 },\r\n // // },\r\n // // dataLabels: {\r\n // // enabled: false\r\n // // },\r\n // // markers: {\r\n // // size: 0,\r\n // // style: 'hollow',\r\n // // },\r\n // // yaxis: {\r\n // // show:false,\r\n // // },\r\n // // xaxis: {\r\n // // type: 'datetime',\r\n // // min: new Date('01 Mar 2012').getTime(),\r\n // // tickAmount: 6,\r\n // // },\r\n // // tooltip: {\r\n // // x: {\r\n // // format: 'dd MMMM yyyy'\r\n // // },\r\n // // custom: function({series, seriesIndex, dataPointIndex, w}) {\r\n // // return '' +\r\n // // '' + series[seriesIndex][dataPointIndex] + ' TRY' +\r\n // // '
'\r\n // // }\r\n // // },\r\n // // fill: {\r\n // // type: 'gradient',\r\n // // gradient: {\r\n // // shade: 'dark',\r\n // // gradientToColors: ['#00377B', '#00377B'],\r\n // // shadeIntensity: 0,\r\n // // opacityFrom: 1,\r\n // // opacityTo: 0,\r\n // // stops: [0, 90, 100],\r\n // // colorStops: [],\r\n // // }\r\n // // },\r\n // // };\r\n \r\n // // var chartGold = new ApexCharts(document.querySelector(\"#altinChart2\"), options2); \r\n // // chartGold.render();\r\n \r\n \r\n // // var resetCssClasses2 = function(activeEl2) {\r\n // // var els2 = document.querySelectorAll('button')\r\n // // Array.prototype.forEach.call(els2, function(el) {\r\n // // el.classList.remove('active')\r\n // // })\r\n \r\n // // activeEl2.target.classList.add('active')\r\n // // }\r\n \r\n // // document\r\n // // .querySelector('#one_month2')\r\n // // .addEventListener('click', function(e) {\r\n // // resetCssClasses2(e)\r\n \r\n // // chartGold.zoomX(\r\n // // new Date('28 Jan 2013').getTime(),\r\n // // new Date('27 Feb 2013').getTime()\r\n // // )\r\n // // })\r\n \r\n // // document\r\n // // .querySelector('#six_months2')\r\n // // .addEventListener('click', function(e) {\r\n // // resetCssClasses2(e)\r\n \r\n // // chartGold.zoomX(\r\n // // new Date('27 Sep 2012').getTime(),\r\n // // new Date('27 Feb 2013').getTime()\r\n // // )\r\n // // })\r\n \r\n // // document\r\n // // .querySelector('#one_year2')\r\n // // .addEventListener('click', function(e) {\r\n // // resetCssClasses2(e)\r\n // // chartGold.zoomX(\r\n // // new Date('27 Feb 2012').getTime(),\r\n // // new Date('27 Feb 2013').getTime()\r\n // // )\r\n // // })\r\n \r\n // // document.querySelector('#ytd2').addEventListener('click', function(e) {\r\n // // resetCssClasses2(e)\r\n \r\n // // chartGold.zoomX(\r\n // // new Date('01 Jan 2013').getTime(),\r\n // // new Date('27 Feb 2013').getTime()\r\n // // )\r\n // // })\r\n \r\n // // document.querySelector('#all2').addEventListener('click', function(e) {\r\n // // resetCssClasses2(e)\r\n \r\n // // chartGold.zoomX(\r\n // // new Date('23 Jan 2012').getTime(),\r\n // // new Date('27 Feb 2013').getTime()\r\n // // )\r\n // // })\r\n // // }\r\n \r\n \r\n \r\n // };\r\n\r\n const init = () => {\r\n defaultAccordion();\r\n customVideo();\r\n // dfChart();\r\n };\r\n\r\n return {\r\n init,\r\n };\r\n})();\r\n\r\nexport default chartJs;\r\n","const t=(t,e=1e4)=>(t=parseFloat(t+\"\")||0,Math.round((t+Number.EPSILON)*e)/e),e=function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf(\"hidden\"),s=-1!==i.indexOf(\"visible\");return e&&!n&&!s},i=function(t,n=void 0){return!(!t||t===document.body||n&&t===n)&&(e(t)?t:i(t.parentElement,n))},n=function(t){var e=(new DOMParser).parseFromString(t,\"text/html\").body;if(e.childElementCount>1){for(var i=document.createElement(\"div\");e.firstChild;)i.appendChild(e.firstChild);return i}return e.firstChild},s=t=>`${t||\"\"}`.split(\" \").filter((t=>!!t)),o=(t,e,i)=>{t&&s(e).forEach((e=>{t.classList.toggle(e,i||!1)}))};class a{constructor(t){Object.defineProperty(this,\"pageX\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"pageY\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"clientX\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"clientY\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"id\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"time\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"nativePointer\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const r={passive:!1};class l{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,\"element\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"startCallback\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"moveCallback\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"endCallback\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"currentPointers\",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,\"startPointers\",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of[\"onPointerStart\",\"onTouchStart\",\"onMove\",\"onTouchEnd\",\"onPointerEnd\",\"onWindowBlur\"])this[t]=this[t].bind(this);this.element.addEventListener(\"mousedown\",this.onPointerStart,r),this.element.addEventListener(\"touchstart\",this.onTouchStart,r),this.element.addEventListener(\"touchmove\",this.onMove,r),this.element.addEventListener(\"touchend\",this.onTouchEnd),this.element.addEventListener(\"touchcancel\",this.onTouchEnd)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new a(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener(\"mousemove\",this.onMove),window.addEventListener(\"mouseup\",this.onPointerEnd),window.addEventListener(\"blur\",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches||[]))this.triggerPointerStart(new a(e),t);window.addEventListener(\"blur\",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i=\"changedTouches\"in t?Array.from(t.changedTouches||[]).map((t=>new a(t))):[new a(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new a(t)),window.removeEventListener(\"mousemove\",this.onMove),window.removeEventListener(\"mouseup\",this.onPointerEnd),window.removeEventListener(\"blur\",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches||[]))this.triggerPointerEnd(t,new a(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event(\"touchend\",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener(\"mousedown\",this.onPointerStart,r),this.element.removeEventListener(\"touchstart\",this.onTouchStart,r),this.element.removeEventListener(\"touchmove\",this.onMove,r),this.element.removeEventListener(\"touchend\",this.onTouchEnd),this.element.removeEventListener(\"touchcancel\",this.onTouchEnd),window.removeEventListener(\"mousemove\",this.onMove),window.removeEventListener(\"mouseup\",this.onPointerEnd),window.removeEventListener(\"blur\",this.onWindowBlur)}}function c(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function h(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const d=t=>\"object\"==typeof t&&null!==t&&t.constructor===Object&&\"[object Object]\"===Object.prototype.toString.call(t),u=(t,...e)=>{const i=e.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};t[e]||Object.assign(t,{[e]:n}),d(i)?Object.assign(t[e],u(n,i)):Array.isArray(i)?Object.assign(t,{[e]:[...i]}):Object.assign(t,{[e]:i})}))}return t},p=function(t,e){return t.split(\".\").reduce(((t,e)=>\"object\"==typeof t?t[e]:void 0),e)};class f{constructor(t={}){Object.defineProperty(this,\"options\",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,\"events\",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith(\"on\")&&\"function\"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?u({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option(\"on\")||{}))this.on(t,e)}option(t,...e){let i=p(t,this.options);return i&&\"function\"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=p(e,t);var o;\"string\"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),\"true\"===s&&(s=!0),\"false\"===s&&(s=!1),s&&\"function\"==typeof s&&(s=s.call(this,this,t,...n));let a=p(e,this.options);return a&&\"function\"==typeof a?s=a.call(this,this,t,...n,s):void 0===s&&(s=a),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||\"\"}localize(t,e=[]){t=String(t).replace(/\\{\\{(\\w+).?(\\w+)?\\}\\}/g,((t,e,i)=>{let n=\"\";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];\"string\"==typeof t?i=t.split(\" \"):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];\"string\"==typeof t?i=t.split(\" \"):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),\"*\"!==t&&this.emit(\"*\",t,...e)}}Object.defineProperty(f,\"version\",{enumerable:!0,configurable:!0,writable:!0,value:\"5.0.36\"}),Object.defineProperty(f,\"defaults\",{enumerable:!0,configurable:!0,writable:!0,value:{}});class g extends f{constructor(t={}){super(t),Object.defineProperty(this,\"plugins\",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach()}detachPlugins(t){t=t||Object.keys(this.plugins);for(const e of t){const t=this.plugins[e];t&&t.detach(),delete this.plugins[e]}return this.emit(\"detachPlugins\"),this}}var m;!function(t){t[t.Init=0]=\"Init\",t[t.Error=1]=\"Error\",t[t.Ready=2]=\"Ready\",t[t.Panning=3]=\"Panning\",t[t.Mousemove=4]=\"Mousemove\",t[t.Destroy=5]=\"Destroy\"}(m||(m={}));const v=[\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"],b={PANUP:\"Move up\",PANDOWN:\"Move down\",PANLEFT:\"Move left\",PANRIGHT:\"Move right\",ZOOMIN:\"Zoom in\",ZOOMOUT:\"Zoom out\",TOGGLEZOOM:\"Toggle zoom level\",TOGGLE1TO1:\"Toggle zoom level\",ITERATEZOOM:\"Toggle zoom level\",ROTATECCW:\"Rotate counterclockwise\",ROTATECW:\"Rotate clockwise\",FLIPX:\"Flip horizontally\",FLIPY:\"Flip vertically\",FITX:\"Fit horizontally\",FITY:\"Fit vertically\",RESET:\"Reset\",TOGGLEFS:\"Toggle fullscreen\"},y={content:null,width:\"auto\",height:\"auto\",panMode:\"drag\",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:\"auto\",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:\"toggleZoom\",dblClick:!1,wheel:\"zoom\",wheelLimit:7,spinner:!0,bounds:\"auto\",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:\"f-panzoom__content\",isLoading:\"is-loading\",canZoomIn:\"can-zoom_in\",canZoomOut:\"can-zoom_out\",isDraggable:\"is-draggable\",isDragging:\"is-dragging\",inFullscreen:\"in-fullscreen\",htmlHasFullscreen:\"with-panzoom-in-fullscreen\"},l10n:b},w='',x='\",E=t=>t&&null!==t&&t instanceof Element&&\"nodeType\"in t,S=(t,e)=>{t&&s(e).forEach((e=>{t.classList.remove(e)}))},P=(t,e)=>{t&&s(e).forEach((e=>{t.classList.add(e)}))},C={a:1,b:0,c:0,d:1,e:0,f:0},T=1e5,M=1e4,O=\"mousemove\",A=\"drag\",L=\"content\",z=\"auto\";let R=null,k=null;class I extends g{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return null===k&&(k=window.matchMedia(\"(hover: none)\").matches),k}get isMobile(){return null===R&&(R=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),R}get panMode(){return this.options.panMode!==O||this.isTouchDevice?A:O}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return t===z?this.isTouchDevice:t}get isInfinite(){return this.option(\"infinite\")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option(\"minScale\")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option(\"maxScale\")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const t=this.content;return!!(t&&t instanceof HTMLImageElement)&&!t.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of v){const e=\"e\"==t||\"f\"===t?1e-4:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var s;if(super(e),Object.defineProperty(this,\"pointerTracker\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"resizeObserver\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"updateTimer\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"clickTimer\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"rAF\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"isTicking\",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,\"ignoreBounds\",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,\"isBouncingX\",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,\"isBouncingY\",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,\"clicks\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"trackingPoints\",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,\"pwt\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"cwd\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"pmme\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"friction\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"state\",{enumerable:!0,configurable:!0,writable:!0,value:m.Init}),Object.defineProperty(this,\"isDragging\",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,\"container\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"content\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"spinner\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"containerRect\",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,\"contentRect\",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,\"dragStart\",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,\"dragOffset\",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,\"current\",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},C)}),Object.defineProperty(this,\"target\",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},C)}),Object.defineProperty(this,\"velocity\",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,\"lockedAxis\",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error(\"Container Element Not Found\");this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},I.Plugins),i)),this.emit(\"attachPlugins\"),this.emit(\"init\");const o=this.content;if(o.addEventListener(\"load\",this.onLoad),o.addEventListener(\"error\",this.onError),this.isContentLoading){if(this.option(\"spinner\")){t.classList.add(this.cn(\"isLoading\"));const e=n(x);!t.contains(o)||o.parentElement instanceof HTMLPictureElement?this.spinner=t.appendChild(e):this.spinner=(null===(s=o.parentElement)||void 0===s?void 0:s.insertBefore(e,o))||null}this.emit(\"beforeLoad\")}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this,e=this.cn(L);let i=this.option(L)||t.querySelector(`.${e}`);if(i||(i=t.querySelector(\"img,picture\")||t.firstElementChild,i&&P(i,e)),i instanceof HTMLPictureElement&&(i=i.querySelector(\"img\")),!i)throw new Error(\"No content found\");this.content=i}onLoad(){const{spinner:t,container:e,state:i}=this;t&&(t.remove(),this.spinner=null),this.option(\"spinner\")&&e.classList.remove(this.cn(\"isLoading\")),this.emit(\"afterLoad\"),i===m.Init?this.enable():this.updateMetrics()}onError(){this.state!==m.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=m.Error,this.emit(\"error\"))}getNextScale(t){const{fullScale:e,targetScale:i,coverScale:n,maxScale:s,minScale:o}=this;let a=o;switch(t){case\"toggleMax\":a=i-o<.5*(s-o)?s:o;break;case\"toggleCover\":a=i-o<.5*(n-o)?n:o;break;case\"toggleZoom\":a=i-o<.5*(e-o)?e:o;break;case\"iterateZoom\":let t=[1,e,s].sort(((t,e)=>t-e)),r=t.findIndex((t=>t>i+1e-5));a=t[r]||1}return a}attachObserver(){var t;const e=()=>{const{container:t,containerRect:e}=this;return Math.abs(e.width-t.getBoundingClientRect().width)>.1||Math.abs(e.height-t.getBoundingClientRect().height)>.1};this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((()=>{this.updateTimer||(e()?(this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{e()&&this.onResize(),this.updateTimer=null}),500))):this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null))}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener(\"click\",this.onClick,{passive:!1,capture:!1}),t.addEventListener(\"wheel\",this.onWheel,{passive:!1}),this.pointerTracker=new l(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(O,this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener(\"click\",this.onClick,{passive:!1,capture:!1}),e.removeEventListener(\"wheel\",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener(O,this.onMouseMove),document.removeEventListener(\"keydown\",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.friction,e=this.option(\"maxVelocity\");for(const i of v)t?(this.velocity[i]*=1-t,e&&!this.isScaling&&(this.velocity[i]=Math.max(Math.min(this.velocity[i],e),-1*e)),this.current[i]+=this.velocity[i]):this.current[i]=this.target[i];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop(\"current\")}setTargetForce(){for(const t of v)\"e\"===t&&this.isBouncingX||\"f\"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:a,y:r}=o,l=a.min,c=a.max,h=r.min,d=r.max;let u=0,p=0;return l!==1/0&&nc&&(u=c-n),h!==1/0&&sd&&(p=d-s),Math.abs(u)<1e-4&&(u=0),Math.abs(p)<1e-4&&(p=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:p,inBounds:!u&&!p})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:a}=i;let r=o,l=a;if(this.option(\"zoom\")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&(\"none\"===window.getComputedStyle(e).maxWidth||\"none\"===window.getComputedStyle(e).maxHeight),c=i?o:n,h=i?a:s,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),p=new DOMPoint(0+c,0).matrixTransform(d),f=new DOMPoint(0+c,0+h).matrixTransform(d),g=new DOMPoint(0,0+h).matrixTransform(d),m=Math.abs(f.x-u.x),v=Math.abs(f.y-u.y),b=Math.abs(g.x-p.x),y=Math.abs(g.y-p.y);r=Math.max(m,b),l=Math.max(v,y)}return{contentWidth:r,contentHeight:l}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===O||this.targetScale{const t=window.getSelection();return t&&\"Range\"===t.type})()&&!i.closest(\"button\"))return;const n=i.closest(\"[data-panzoom-action]\"),s=i.closest(\"[data-panzoom-change]\"),o=n||s,a=o&&E(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn(\"The given data was not valid JSON\")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();if(i.closest(\"[data-fancybox]\"))return;const r=this.content.getBoundingClientRect(),l=this.dragStart;if(l.time&&!this.canZoomOut()&&(Math.abs(r.x-l.x)>2||Math.abs(r.y-l.y)>2))return;this.dragStart.time=0;const c=e=>{this.option(\"zoom\",t)&&e&&\"string\"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&\"function\"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},h=this.option(\"click\",t),d=this.option(\"dblClick\",t);d?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit(\"click\",t),!t.defaultPrevented&&h&&c(h)):(this.emit(\"dblClick\",t),t.defaultPrevented||c(d)),this.clicks=0,this.clickTimer=null}),350))):(this.emit(\"click\",t),!t.defaultPrevented&&h&&c(h))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,e,i){var n;if(!1===this.option(\"touch\",t))return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const s=this.content.getBoundingClientRect();if(this.dragStart={x:s.x,y:s.y,top:s.top,left:s.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===O&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;const o=t.composedPath()[0];if(!i.length){if([\"TEXTAREA\",\"OPTION\",\"INPUT\",\"SELECT\",\"VIDEO\",\"IFRAME\"].includes(o.nodeName)||o.closest(\"[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]\"))return!1;null===(n=window.getSelection())||void 0===n||n.removeAllRanges()}if(\"mousedown\"===t.type)[\"A\",\"BUTTON\"].includes(o.nodeName)||t.preventDefault();else if(Math.abs(this.velocity.a)>.3)return!1;return this.target.e=this.current.e,this.target.f=this.current.f,this.stop(),this.isDragging||(this.isDragging=!0,this.addTrackingPoint(e),this.emit(\"touchStart\",t)),!0}onPointerMove(e,n,s){if(!1===this.option(\"touch\",e))return;if(!this.isDragging)return;if(n.length<2&&this.panOnlyZoomed&&t(this.targetScale)<=t(this.minScale))return;if(this.emit(\"touchMove\",e),e.defaultPrevented)return;this.addTrackingPoint(n[0]);const{content:o}=this,a=h(s[0],s[1]),r=h(n[0],n[1]);let l=0,d=0;if(n.length>1){const t=o.getBoundingClientRect();l=a.clientX-t.left-.5*t.width,d=a.clientY-t.top-.5*t.height}const u=c(s[0],s[1]),p=c(n[0],n[1]);let f=u?p/u:1,g=r.clientX-a.clientX,m=r.clientY-a.clientY;this.dragOffset.x+=g,this.dragOffset.y+=m,this.dragOffset.time=Date.now()-this.dragStart.time;let v=t(this.targetScale)===t(this.minScale)&&this.option(\"lockAxis\");if(v&&!this.lockedAxis)if(\"xy\"===v||\"y\"===v||\"touchmove\"===e.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void e.preventDefault();const t=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=t>45&&t<135?\"y\":\"x\",this.dragOffset.x=0,this.dragOffset.y=0,g=0,m=0}else this.lockedAxis=v;if(i(e.target,this.content)&&(v=\"x\",this.dragOffset.y=0),v&&\"xy\"!==v&&this.lockedAxis!==v&&t(this.targetScale)===t(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn(\"isDragging\"));const b=this.checkBounds(g,m);this.option(\"rubberband\")?(\"x\"!==this.isInfinite&&(b.xDiff>0&&g<0||b.xDiff<0&&g>0)&&(g*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*b.xDiff))),\"y\"!==this.isInfinite&&(b.yDiff>0&&m<0||b.yDiff<0&&m>0)&&(m*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*b.yDiff)))):(b.xDiff&&(g=0),b.yDiff&&(m=0));const y=this.targetScale,w=this.minScale,x=this.maxScale;y<.5*w&&(f=Math.max(f,w)),y>1.5*x&&(f=Math.min(f,x)),\"y\"===this.lockedAxis&&t(y)===t(w)&&(g=0),\"x\"===this.lockedAxis&&t(y)===t(w)&&(m=0),this.applyChange({originX:l,originY:d,panX:g,panY:m,scale:f,friction:this.option(\"dragFriction\"),ignoreBounds:!0})}onPointerUp(t,e,n){if(n.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn(\"isDragging\")),this.isDragging&&(this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),i(t.target,this.content)&&\"y\"===this.lockedAxis&&(this.trackingPoints=[]),this.emit(\"touchEnd\",t),this.isDragging=!1,this.lockedAxis=!1,this.state!==m.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){var e;const i=this.isScaling;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of v)this.velocity[t]=0;this.target.e=this.current.e,this.target.f=this.current.f,S(this.container,\"is-scaling\"),S(this.container,\"is-animating\"),this.isTicking=!1;const{trackingPoints:n}=this,s=n[0],o=n[n.length-1];let a=0,r=0,l=0;o&&s&&(a=o.clientX-s.clientX,r=o.clientY-s.clientY,l=o.time-s.time);const c=(null===(e=window.visualViewport)||void 0===e?void 0:e.scale)||1;1!==c&&(a*=c,r*=c);let h=0,d=0,u=0,p=0,f=this.option(\"decelFriction\");const g=this.targetScale;if(l>0){u=Math.abs(a)>3?a/(l/30):0,p=Math.abs(r)>3?r/(l/30):0;const t=this.option(\"maxVelocity\");t&&(u=Math.max(Math.min(u,t),-1*t),p=Math.max(Math.min(p,t),-1*t))}u&&(h=u/(1/(1-f)-1)),p&&(d=p/(1/(1-f)-1)),(\"y\"===this.option(\"lockAxis\")||\"xy\"===this.option(\"lockAxis\")&&\"y\"===this.lockedAxis&&t(g)===this.minScale)&&(h=u=0),(\"x\"===this.option(\"lockAxis\")||\"xy\"===this.option(\"lockAxis\")&&\"x\"===this.lockedAxis&&t(g)===this.minScale)&&(d=p=0);const m=this.dragOffset.x,b=this.dragOffset.y,y=this.option(\"dragMinThreshold\")||0;Math.abs(m)this.maxScale+1e-5)||i&&!h&&!d)&&(f=.35),this.applyChange({panX:h,panY:d,friction:f}),this.emit(\"decel\",u,p,m,b)}onWheel(t){var e=[-t.deltaX||0,-t.deltaY||0,-t.detail||0].reduce((function(t,e){return Math.abs(e)>Math.abs(t)?e:t}));const i=Math.max(-1,Math.min(1,e));if(this.emit(\"wheel\",t,i),this.panMode===O)return;if(t.defaultPrevented)return;const n=this.option(\"wheel\");\"pan\"===n?(t.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-t.deltaX,panY:2*-t.deltaY,bounce:!1})):\"zoom\"===n&&!1!==this.option(\"zoom\")&&this.zoomWithWheel(t)}onMouseMove(t){this.panWithMouse(t)}onKeydown(t){\"Escape\"===t.key&&this.toggleFS()}onResize(){this.updateMetrics(),this.checkBounds().inBounds||this.requestTick()}setTransform(){this.emit(\"beforeTransform\");const{current:e,target:i,content:n,contentRect:s}=this,o=Object.assign({},C);for(const n of v){const s=\"e\"==n||\"f\"===n?M:T;o[n]=t(e[n],s),Math.abs(i[n]-e[n])<(\"e\"==n||\"f\"===n?.51:.001)&&(e[n]=i[n])}let{a:a,b:r,c:l,d:c,e:h,f:d}=o,u=`matrix(${a}, ${r}, ${l}, ${c}, ${h}, ${d})`,p=n.parentElement instanceof HTMLPictureElement?n.parentElement:n;if(this.option(\"transformParent\")&&(p=p.parentElement||p),p.style.transform===u)return;p.style.transform=u;const{contentWidth:f,contentHeight:g}=this.calculateContentDim();s.width=f,s.height=g,this.emit(\"afterTransform\")}updateMetrics(e=!1){var i;if(!this||this.state===m.Destroy)return;if(this.isContentLoading)return;const n=Math.max(1,(null===(i=window.visualViewport)||void 0===i?void 0:i.scale)||1),{container:s,content:o}=this,a=o instanceof HTMLImageElement,r=s.getBoundingClientRect(),l=getComputedStyle(this.container);let c=r.width*n,h=r.height*n;const d=parseFloat(l.paddingTop)+parseFloat(l.paddingBottom),u=c-(parseFloat(l.paddingLeft)+parseFloat(l.paddingRight)),p=h-d;this.containerRect={width:c,height:h,innerWidth:u,innerHeight:p};const f=parseFloat(o.dataset.width||\"\")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:Math.max(t.offsetWidth,t.scrollWidth),e||0})(o),g=parseFloat(o.dataset.height||\"\")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:Math.max(t.offsetHeight,t.scrollHeight),e||0})(o);let v=this.option(\"width\",f)||z,b=this.option(\"height\",g)||z;const y=v===z,w=b===z;\"number\"!=typeof v&&(v=f),\"number\"!=typeof b&&(b=g),y&&(v=f*(b/g)),w&&(b=g/(f/v));let x=o.parentElement instanceof HTMLPictureElement?o.parentElement:o;this.option(\"transformParent\")&&(x=x.parentElement||x);const E=x.getAttribute(\"style\")||\"\";x.style.setProperty(\"transform\",\"none\",\"important\"),a&&(x.style.width=\"\",x.style.height=\"\"),x.offsetHeight;const S=o.getBoundingClientRect();let P=S.width*n,C=S.height*n,T=P,M=C;P=Math.min(P,v),C=Math.min(C,b),a?({width:P,height:C}=((t,e,i,n)=>{const s=i/t,o=n/e,a=Math.min(s,o);return{width:t*=a,height:e*=a}})(v,b,P,C)):(P=Math.min(P,v),C=Math.min(C,b));let O=.5*(M-C),A=.5*(T-P);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:S.top-r.top+O,bottom:r.bottom-S.bottom+O,left:S.left-r.left+A,right:r.right-S.right+A,fitWidth:P,fitHeight:C,width:P,height:C,fullWidth:v,fullHeight:b}),x.style.cssText=E,a&&(x.style.width=`${P}px`,x.style.height=`${C}px`),this.setTransform(),!0!==e&&this.emit(\"refresh\"),this.ignoreBounds||(t(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===m.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}calculateBounds(){const{contentWidth:e,contentHeight:i}=this.calculateContentDim(this.target),{targetScale:n,lockedAxis:s}=this,{fitWidth:o,fitHeight:a}=this.contentRect;let r=0,l=0,c=0,h=0;const d=this.option(\"infinite\");if(!0===d||s&&d===s)r=-1/0,c=1/0,l=-1/0,h=1/0;else{let{containerRect:s,contentRect:d}=this,u=t(o*n,M),p=t(a*n,M),{innerWidth:f,innerHeight:g}=s;if(s.width===u&&(f=s.width),s.width===p&&(g=s.height),e>f){c=.5*(e-f),r=-1*c;let t=.5*(d.right-d.left);r+=t,c+=t}if(o>f&&eg){h=.5*(i-g),l=-1*h;let t=.5*(d.bottom-d.top);l+=t,h+=t}a>g&&it(s.fitWidth,1)||t(s.height,1)>t(s.fitHeight,1))&&(p=!0)),t(s.width*a,1)t(a),g=!f&&!p&&d&&t(l)i&&(n=i/t)}y=y.scale(n)}y=y.translate(-o,-a).translate(-f,-g).multiply(b),s&&(y=y.rotate(s)),l&&(y=y.scale(-1,1)),c&&(y=y.scale(1,-1));for(const e of v)\"e\"!==e&&\"f\"!==e&&(y[e]>this.minScale+1e-5||y[e].1||this.panMode===O||!1===d)&&!h&&this.clampTargetBounds(),u===m.Init?this.animate():this.isResting||(this.state=m.Panning,this.requestTick())}stop(t=!1){if(this.state===m.Init||this.state===m.Destroy)return;const e=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of v)this.velocity[e]=0,\"current\"===t?this.current[e]=this.target[e]:\"target\"===t&&(this.target[e]=this.current[e]);this.setTransform(),S(this.container,\"is-scaling\"),S(this.container,\"is-animating\"),this.isTicking=!1,this.state=m.Ready,e&&(this.emit(\"endAnimation\"),this.updateControls())}requestTick(){this.isTicking||(this.emit(\"startAnimation\"),this.updateControls(),P(this.container,\"is-animating\"),this.isScaling&&P(this.container,\"is-scaling\")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(e,i=this.option(\"mouseMoveFriction\")){if(this.pmme=e,this.panMode!==O||!e)return;if(t(this.targetScale)<=t(this.minScale))return;this.emit(\"mouseMove\",e);const{container:n,containerRect:s,contentRect:o}=this,a=s.width,r=s.height,l=n.getBoundingClientRect(),c=(e.clientX||0)-l.left,h=(e.clientY||0)-l.top;let{contentWidth:d,contentHeight:u}=this.calculateContentDim(this.target);const p=this.option(\"mouseMoveFactor\");p>1&&(d!==a&&(d*=p),u!==r&&(u*=p));let f=.5*(d-a)-c/a*100/100*(d-a);f+=.5*(o.right-o.left);let g=.5*(u-r)-h/r*100/100*(u-r);g+=.5*(o.bottom-o.top),this.applyChange({panX:f-this.target.e,panY:g-this.target.f,friction:i})}zoomWithWheel(e){if(this.state===m.Destroy||this.state===m.Init)return;const i=Date.now();if(i-this.pwt<45)return void e.preventDefault();this.pwt=i;var n=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce((function(t,e){return Math.abs(e)>Math.abs(t)?e:t}));const s=Math.max(-1,Math.min(1,n)),{targetScale:o,maxScale:a,minScale:r}=this;let l=o*(100+45*s)/100;t(l)t(a)&&t(o)>=t(a)?(this.cwd+=Math.abs(s),l=a):(this.cwd=0,l=Math.max(Math.min(l,a),r)),this.cwd>this.option(\"wheelLimit\")||(e.preventDefault(),t(l)!==t(o)&&this.zoomTo(l,{event:e}))}canZoomIn(){return this.option(\"zoom\")&&(t(this.contentRect.width,1)t(this.minScale)}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo(\"fit\",t)}zoomToCover(t){this.zoomTo(\"cover\",t)}zoomToFull(t){this.zoomTo(\"full\",t)}zoomToMax(t){this.zoomTo(\"max\",t)}toggleZoom(t){this.zoomTo(this.getNextScale(\"toggleZoom\"),t)}toggleMax(t){this.zoomTo(this.getNextScale(\"toggleMax\"),t)}toggleCover(t){this.zoomTo(this.getNextScale(\"toggleCover\"),t)}iterateZoom(t){this.zoomTo(\"next\",t)}zoomTo(t=1,{friction:e=z,originX:i=z,originY:n=z,event:s}={}){if(this.isContentLoading||this.state===m.Destroy)return;const{targetScale:o,fullScale:a,maxScale:r,coverScale:l}=this;if(this.stop(),this.panMode===O&&(s=this.pmme||s),s||i===z||n===z){const t=this.content.getBoundingClientRect(),e=this.container.getBoundingClientRect(),o=s?s.clientX:e.left+.5*e.width,a=s?s.clientY:e.top+.5*e.height;i=o-t.left-.5*t.width,n=a-t.top-.5*t.height}let c=1;\"number\"==typeof t?c=t:\"full\"===t?c=a:\"cover\"===t?c=l:\"max\"===t?c=r:\"fit\"===t?c=1:\"next\"===t&&(c=this.getNextScale(\"iterateZoom\")),c=c/o||1,e=e===z?c>1?.15:.25:e,this.applyChange({scale:c,originX:i,originY:n,friction:e}),s&&this.panMode===O&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop(\"target\");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop(\"target\");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.innerHeight-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn(\"inFullscreen\"),i=this.cn(\"htmlHasFullscreen\");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener(\"keydown\",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener(\"keydown\",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?\"enterFS\":\"exitFS\")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:a}=t;return new DOMMatrix([e,i,n,s,o,a])}reset(t){if(this.state!==m.Init&&this.state!==m.Destroy){this.stop(\"current\");for(const t of v)this.target[t]=C[t];this.target.a=this.minScale,this.target.d=this.minScale,this.clampTargetBounds(),this.isResting||(this.friction=void 0===t?this.option(\"friction\"):t,this.state=m.Panning,this.requestTick())}}destroy(){this.stop(),this.state=m.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option(\"classes\")||{};for(const e of Object.values(i))t.classList.remove(e+\"\");e&&(e.removeEventListener(\"load\",this.onLoad),e.removeEventListener(\"error\",this.onError)),this.detachPlugins()}}Object.defineProperty(I,\"defaults\",{enumerable:!0,configurable:!0,writable:!0,value:y}),Object.defineProperty(I,\"Plugins\",{enumerable:!0,configurable:!0,writable:!0,value:{}});const D=function(t,e){let i=!0;return(...n)=>{i&&(i=!1,t(...n),setTimeout((()=>{i=!0}),e))}},F=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},j={viewport:null,track:null,enabled:!0,slides:[],axis:\"x\",transition:\"fade\",preload:1,slidesPerPage:\"auto\",initialPage:0,friction:.12,Panzoom:{decelFriction:.12},center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:\"ltr\",classes:{container:\"f-carousel\",viewport:\"f-carousel__viewport\",track:\"f-carousel__track\",slide:\"f-carousel__slide\",isLTR:\"is-ltr\",isRTL:\"is-rtl\",isHorizontal:\"is-horizontal\",isVertical:\"is-vertical\",inTransition:\"in-transition\",isSelected:\"is-selected\"},l10n:{NEXT:\"Next slide\",PREV:\"Previous slide\",GOTO:\"Go to slide #%d\"}};var B;!function(t){t[t.Init=0]=\"Init\",t[t.Ready=1]=\"Ready\",t[t.Destroy=2]=\"Destroy\"}(B||(B={}));const H=t=>{if(\"string\"==typeof t||t instanceof HTMLElement)t={html:t};else{const e=t.thumb;void 0!==e&&(\"string\"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:\"\",el:null,isDom:!1,class:\"\",customClass:\"\",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},N=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class _ extends f{constructor(t,e){super(e),Object.defineProperty(this,\"instance\",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const $={classes:{list:\"f-carousel__dots\",isDynamic:\"is-dynamic\",hasDots:\"has-dots\",dot:\"f-carousel__dot\",isBeforePrev:\"is-before-prev\",isPrev:\"is-prev\",isCurrent:\"is-current\",isNext:\"is-next\",isAfterNext:\"is-after-next\"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class W extends _{constructor(){super(...arguments),Object.defineProperty(this,\"isDynamic\",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,\"list\",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;if(!t){t=document.createElement(\"ul\"),P(t,this.cn(\"list\")),t.setAttribute(\"role\",\"tablist\");const e=this.instance.container;e.appendChild(t),P(e,this.cn(\"hasDots\")),this.list=t}return t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option(\"minCount\")),n=Math.max(2e3,this.option(\"maxCount\")),s=this.option(\"dynamicFrom\");if(en)return void this.cleanup();const a=\"number\"==typeof s&&e>5&&e>=s,r=!this.list||this.isDynamic!==a||this.list.children.length!==e;r&&this.cleanup();const l=this.build();if(o(l,this.cn(\"isDynamic\"),!!a),r)for(let t=0;t=e-1&&s.setAttribute(X,\"\")))}addBtn(t){var e;const i=this.instance,n=document.createElement(\"button\");n.setAttribute(\"tabindex\",\"0\"),n.setAttribute(\"title\",i.localize(`{{${t.toUpperCase()}}}`)),P(n,this.cn(\"button\")+\" \"+this.cn(t===q?\"isNext\":\"isPrev\"));const s=i.isRTL?t===q?Y:q:t;var o;return n.innerHTML=i.localize(this.option(`${s}Tpl`)),n.dataset[`carousel${o=t,o?o.match(\"^[a-z]\")?o.charAt(0).toUpperCase()+o.substring(1):o:\"\"}`]=\"true\",null===(e=this.container)||void 0===e||e.appendChild(n),n}build(){const t=this.instance.container,e=this.cn(\"container\");let{container:i,prev:n,next:s}=this;i||(i=t.querySelector(\".\"+e),this.isDom=!!i),i||(i=document.createElement(\"div\"),P(i,e),t.appendChild(i)),this.container=i,s||(s=i.querySelector(\"[data-carousel-next]\")),s||(s=this.addBtn(q)),this.next=s,n||(n=i.querySelector(\"[data-carousel-prev]\")),n||(n=this.addBtn(Y)),this.prev=n}cleanup(){this.isDom||(this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove()),this.prev=null,this.next=null,this.container=null,this.isDom=!1}attach(){this.instance.on([\"refresh\",\"change\"],this.onRefresh)}detach(){this.instance.off([\"refresh\",\"change\"],this.onRefresh),this.cleanup()}}Object.defineProperty(V,\"defaults\",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:\"f-carousel__nav\",button:\"f-button\",isNext:\"is-next\",isPrev:\"is-prev\"},nextTpl:'',prevTpl:''}});class Z extends _{constructor(){super(...arguments),Object.defineProperty(this,\"selectedIndex\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"target\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"nav\",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){const{nav:t,target:e}=this;t&&e&&(t.options.initialSlide=e.options.initialPage,t.state===B.Ready?this.onNavReady(t):t.on(\"ready\",this.onNavReady),e.state===B.Ready?this.onTargetReady(e):e.on(\"ready\",this.onTargetReady))}onNavReady(t){t.on(\"createSlide\",this.onNavCreateSlide),t.on(\"Panzoom.click\",this.onNavClick),t.on(\"Panzoom.touchEnd\",this.onNavTouch),this.onTargetChange()}onTargetReady(t){t.on(\"change\",this.onTargetChange),t.on(\"Panzoom.refresh\",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){this.onNavTouch(t,t.panzoom,i)}onNavTouch(t,e,i){var n,s;if(Math.abs(e.dragOffset.x)>3||Math.abs(e.dragOffset.y)>3)return;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const l=o.closest(\"[data-index]\");if(i.stopPropagation(),i.preventDefault(),!l)return;const c=parseInt(l.dataset.index||\"\",10)||0,h=r.getPageForSlide(c),d=a.getPageForSlide(c);a.slideTo(d),r.slideTo(h,{friction:(null===(s=null===(n=this.nav)||void 0===n?void 0:n.plugins)||void 0===s?void 0:s.Sync.option(\"friction\"))||0}),this.markSelectedSlide(c)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){var t,e;const{target:i,nav:n}=this;if(!i||!n)return;if(n.state!==B.Ready||i.state!==B.Ready)return;const s=null===(e=null===(t=i.pages[i.page])||void 0===t?void 0:t.slides[0])||void 0===e?void 0:e.index,o=n.getPageForSlide(s);this.markSelectedSlide(s),n.slideTo(o,null===n.prevPage&&null===i.prevPage?{friction:0}:void 0)}markSelectedSlide(t){const e=this.nav;e&&e.state===B.Ready&&(this.selectedIndex=t,[...e.slides].map((e=>{e.el&&e.el.classList[e.index===t?\"add\":\"remove\"](\"is-nav-selected\")})))}attach(){const t=this;let e=t.options.target,i=t.options.nav;e?t.addAsNavFor(e):i&&t.addAsTargetFor(i)}detach(){const t=this,e=t.nav,i=t.target;e&&(e.off(\"ready\",t.onNavReady),e.off(\"createSlide\",t.onNavCreateSlide),e.off(\"Panzoom.click\",t.onNavClick),e.off(\"Panzoom.touchEnd\",t.onNavTouch)),t.nav=null,i&&(i.off(\"ready\",t.onTargetReady),i.off(\"refresh\",t.onTargetChange),i.off(\"change\",t.onTargetChange)),t.target=null}}Object.defineProperty(Z,\"defaults\",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const U={Navigation:V,Dots:W,Sync:Z},G=\"animationend\",K=\"isSelected\",J=\"slide\";class Q extends g{get axis(){return this.isHorizontal?\"e\":\"f\"}get isEnabled(){return this.state===B.Ready}get isInfinite(){let t=!1;const{contentDim:e,viewportDim:i,pages:n,slides:s}=this,o=s[0];return n.length>=2&&o&&e+o.dim>=i&&(t=this.option(\"infinite\")),t}get isRTL(){return\"rtl\"===this.option(\"direction\")}get isHorizontal(){return\"x\"===this.option(\"axis\")}constructor(t,e={},i={}){if(super(),Object.defineProperty(this,\"bp\",{enumerable:!0,configurable:!0,writable:!0,value:\"\"}),Object.defineProperty(this,\"lp\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"userOptions\",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,\"userPlugins\",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,\"state\",{enumerable:!0,configurable:!0,writable:!0,value:B.Init}),Object.defineProperty(this,\"page\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"prevPage\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"container\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"viewport\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"track\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"slides\",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,\"pages\",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,\"panzoom\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"inTransition\",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,\"contentDim\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"viewportDim\",{enumerable:!0,configurable:!0,writable:!0,value:0}),\"string\"==typeof t&&(t=document.querySelector(t)),!t||!E(t))throw new Error(\"No Element found\");this.container=t,this.slideNext=D(this.slideNext.bind(this),150),this.slidePrev=D(this.slidePrev.bind(this),150),this.userOptions=e,this.userPlugins=i,queueMicrotask((()=>{this.processOptions()}))}processOptions(){var t,e;const i=u({},Q.defaults,this.userOptions);let n=\"\";const s=i.breakpoints;if(s&&d(s))for(const[t,e]of Object.entries(s))window.matchMedia(t).matches&&d(e)&&(n+=t,u(i,e));n===this.bp&&this.state!==B.Init||(this.bp=n,this.state===B.Ready&&(i.initialSlide=(null===(e=null===(t=this.pages[this.page])||void 0===t?void 0:t.slides[0])||void 0===e?void 0:e.index)||0),this.state!==B.Init&&this.destroy(),super.setOptions(i),!1===this.option(\"enabled\")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=B.Init,this.emit(\"init\"),this.attachPlugins(Object.assign(Object.assign({},Q.Plugins),this.userPlugins)),this.emit(\"attachPlugins\"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=B.Ready,this.emit(\"ready\")}initLayout(){const{container:t}=this,e=this.option(\"classes\");P(t,this.cn(\"container\")),o(t,e.isLTR,!this.isRTL),o(t,e.isRTL,this.isRTL),o(t,e.isVertical,!this.isHorizontal),o(t,e.isHorizontal,this.isHorizontal);let i=this.option(\"viewport\")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement(\"div\"),P(i,e.viewport),i.append(...F(t,`.${e.slide}`)),t.prepend(i)),i.addEventListener(\"scroll\",this.onScroll);let n=this.option(\"track\")||t.querySelector(`.${e.track}`);n||(n=document.createElement(\"div\"),P(n,e.track),n.append(...Array.from(i.childNodes))),n.setAttribute(\"aria-live\",\"polite\"),i.contains(n)||i.prepend(n),this.viewport=i,this.track=n,this.emit(\"initLayout\")}initSlides(){const{track:t}=this;if(!t)return;const e=[...this.slides],i=[];[...F(t,`.${this.cn(J)}`)].forEach((t=>{if(E(t)){const e=H({el:t,isDom:!0,index:this.slides.length});i.push(e)}}));for(let t of[...this.option(\"slides\",[])||[],...e])i.push(H(t));this.slides=i;for(let t=0;t!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on(\"*\",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on(\"decel\",this.onDecel),this.panzoom.on(\"refresh\",this.onRefresh),this.panzoom.on(\"beforeTransform\",this.onBeforeTransform),this.panzoom.on(\"endAnimation\",this.onEndAnimation)}attachEvents(){const t=this.container;t&&(t.addEventListener(\"click\",this.onClick,{passive:!1,capture:!1}),t.addEventListener(\"slideTo\",this.onSlideTo)),window.addEventListener(\"resize\",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this;let n=this.option(\"slidesPerPage\");n=(\"auto\"===n||e<=i)&&!1!==this.option(\"fill\")?1/0:parseFloat(n+\"\");let s=0,o=0,a=0;for(const e of this.slides)(!t.length||o+e.dim-i>.05||a>=n)&&(t.push(N()),s=t.length-1,o=0,a=0),t[s].slides.push(e),o+=e.dim+e.gap,a++;return t}processPages(){const e=this.pages,{contentDim:i,viewportDim:n,isInfinite:s}=this,o=this.option(\"center\"),a=this.option(\"fill\"),r=a&&o&&i>n&&!s;if(e.forEach(((t,e)=>{var s;t.index=e,t.pos=(null===(s=t.slides[0])||void 0===s?void 0:s.pos)||0,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e=i-.5*n?t.pos=i-n:o&&(t.pos+=-.5*(n-t.dim))})),e.forEach((e=>{a&&!s&&i>n&&(e.pos=Math.max(e.pos,0),e.pos=Math.min(e.pos,i-n)),e.pos=t(e.pos,1e3),e.dim=t(e.dim,1e3),Math.abs(e.pos)<=.1&&(e.pos=0)})),s)return e;const l=[];let c;return e.forEach((t=>{const e=Object.assign({},t);c&&e.pos===c.pos?(c.dim+=e.dim,c.slides=[...c.slides,...e.slides]):(e.index=l.length,c=e,l.push(e))})),l}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,e-1),0),i}getSlideMetrics(e){var i,n;const s=this.isHorizontal?\"width\":\"height\";let o=0,a=0,r=e.el;const l=!(!r||r.parentNode);if(r?o=parseFloat(r.dataset[s]||\"\")||0:(r=document.createElement(\"div\"),r.style.visibility=\"hidden\",(this.track||document.body).prepend(r)),P(r,this.cn(J)+\" \"+e.class+\" \"+e.customClass),o)r.style[s]=`${o}px`,r.style[\"width\"===s?\"height\":\"width\"]=\"\";else{l&&(this.track||document.body).prepend(r),o=r.getBoundingClientRect()[s]*Math.max(1,(null===(i=window.visualViewport)||void 0===i?void 0:i.scale)||1);let t=r[this.isHorizontal?\"offsetWidth\":\"offsetHeight\"];t-1>o&&(o=t)}const c=getComputedStyle(r);return\"content-box\"===c.boxSizing&&(this.isHorizontal?(o+=parseFloat(c.paddingLeft)||0,o+=parseFloat(c.paddingRight)||0):(o+=parseFloat(c.paddingTop)||0,o+=parseFloat(c.paddingBottom)||0)),a=parseFloat(c[this.isHorizontal?\"marginRight\":\"marginBottom\"])||0,l?null===(n=r.parentElement)||void 0===n||n.removeChild(r):e.el||r.remove(),{dim:t(o,1e3),gap:t(a,1e3)}}getBounds(){const{isInfinite:t,isRTL:e,isHorizontal:i,pages:n}=this;let s={min:0,max:0};if(t)s={min:-1/0,max:1/0};else if(n.length){const t=n[0].pos,o=n[n.length-1].pos;s=e&&i?{min:t,max:o}:{min:-1*o,max:-1*t}}return{x:i?s:{min:0,max:0},y:i?{min:0,max:0}:s}}repositionSlides(){let e,{isHorizontal:i,isRTL:n,isInfinite:s,viewport:o,viewportDim:a,contentDim:r,page:l,pages:c,slides:h,panzoom:d}=this,u=0,p=0,f=0,g=0;d?g=-1*d.current[this.axis]:c[l]&&(g=c[l].pos||0),e=i?n?\"right\":\"left\":\"top\",n&&i&&(g*=-1);for(const i of h){const n=i.el;n?(\"top\"===e?(n.style.right=\"\",n.style.left=\"\"):n.style.top=\"\",i.index!==u?n.style[e]=0===p?\"\":`${t(p,1e3)}px`:n.style[e]=\"\",f+=i.dim+i.gap,u++):p+=i.dim+i.gap}if(s&&f&&o){let n=getComputedStyle(o),s=\"padding\",l=i?\"Right\":\"Bottom\",c=parseFloat(n[s+(i?\"Left\":\"Top\")]);g-=c,a+=c,a+=parseFloat(n[s+l]);for(const i of h)i.el&&(t(i.pos)t(r-a)&&(i.el.style[e]=`${t(p+f,1e3)}px`),t(i.pos+i.gap)>=t(r-a)&&t(i.pos)>t(g+a)&&t(g)1&&(m=c[b[0]],v=c[b[1]]),m&&v){let i=0;for(const n of h)n.el?this.inTransition.has(n.index)&&m.slides.indexOf(n)<0&&(n.el.style[e]=`${t(i+(m.pos-v.pos),1e3)}px`):i+=n.dim+n.gap}}createSlideEl(t){const{track:e,slides:i}=this;if(!e||!t)return;if(t.el&&t.el.parentNode)return;const n=t.el||document.createElement(\"div\");P(n,this.cn(J)),P(n,t.class),P(n,t.customClass);const s=t.html;s&&(s instanceof HTMLElement?n.appendChild(s):n.innerHTML=t.html+\"\");const o=[];i.forEach(((t,e)=>{t.el&&o.push(e)}));const a=t.index;let r=null;if(o.length){r=i[o.reduce(((t,e)=>Math.abs(e-a)1)return!1;let h=t>a?1:-1;this.isInfinite&&(0===a&&t===r.length-1&&(h=-1),a===r.length-1&&0===t&&(h=1));const d=r[c].pos*(this.isRTL?1:-1);if(a===c&&Math.abs(d-l.target[this.axis])<1)return!1;this.clearTransitions();const u=l.isResting;P(this.container,this.cn(\"inTransition\"));const p=(null===(s=r[a])||void 0===s?void 0:s.slides[0])||null,f=(null===(o=r[c])||void 0===o?void 0:o.slides[0])||null;this.inTransition.add(f.index),this.createSlideEl(f);let g=p.el,m=f.el;u||e===J||(e=\"fadeFast\",g=null);const v=this.isRTL?\"next\":\"prev\",b=this.isRTL?\"prev\":\"next\";return g&&(this.inTransition.add(p.index),p.transition=e,g.addEventListener(G,this.onAnimationEnd),g.classList.add(`f-${e}Out`,`to-${h>0?b:v}`)),m&&(f.transition=e,m.addEventListener(G,this.onAnimationEnd),m.classList.add(`f-${e}In`,`from-${h>0?v:b}`)),l.current[this.axis]=d,l.target[this.axis]=d,l.requestTick(),this.onChange(c),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option(\"preload\",0)+\"\")||0);for(const n of this.slides)i.has(n)?t.add(n):e.add(n);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t=\"aria-hidden\";let e=this.cn(K);if(e)for(const i of this.slides){const n=i.el;n&&(n.dataset.index=`${i.index}`,n.classList.contains(\"f-thumbs__slide\")?this.getVisibleSlides(0).has(i)?n.removeAttribute(t):n.setAttribute(t,\"true\"):this.pages[this.page].slides.includes(i)?(n.classList.contains(e)||(P(n,e),this.emit(\"selectSlide\",i)),n.removeAttribute(t)):(n.classList.contains(e)&&(S(n,e),this.emit(\"unselectSlide\",i)),n.setAttribute(t,\"true\")))}}flipInfiniteTrack(){const{axis:t,isHorizontal:e,isInfinite:i,isRTL:n,viewportDim:s,contentDim:o}=this,a=this.panzoom;if(!a||!i)return;let r=a.current[t],l=a.target[t]-r,c=0,h=.5*s;n&&e?(r<-h&&(c=-1,r+=o),r>o-h&&(c=1,r-=o)):(r>h&&(c=1,r-=o),r<-o+h&&(c=-1,r+=o)),c&&(a.current[t]=r,a.target[t]=r+l)}lazyLoadImg(t,e){const i=this,s=\"f-fadeIn\",o=\"is-preloading\";let a=!1,r=null;const l=()=>{a||(a=!0,r&&(r.remove(),r=null),S(e,o),e.complete&&(P(e,s),setTimeout((()=>{S(e,s)}),350)),this.option(\"adaptiveHeight\")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&(i.updateMetrics(),i.setViewportHeight()),this.emit(\"load\",t))};P(e,o),e.src=e.dataset.lazySrcset||e.dataset.lazySrc||\"\",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.addEventListener(\"error\",(()=>{l()})),e.addEventListener(\"load\",(()=>{l()})),setTimeout((()=>{const i=e.parentNode;i&&t.el&&(e.complete?l():a||(r=n(x),i.insertBefore(r,e)))}),300)}lazyLoadSlide(t){const e=t&&t.el;if(!e)return;const i=new Set;let n=Array.from(e.querySelectorAll(\"[data-lazy-src],[data-lazy-srcset]\"));e.dataset.lazySrc&&n.push(e),n.map((t=>{t instanceof HTMLImageElement?i.add(t):t instanceof HTMLElement&&t.dataset.lazySrc&&(t.style.backgroundImage=`url('${t.dataset.lazySrc}')`,delete t.dataset.lazySrc)}));for(const e of i)this.lazyLoadImg(t,e)}onAnimationEnd(t){var e;const i=t.target,n=i?parseInt(i.dataset.index||\"\",10)||0:-1,s=this.slides[n],o=t.animationName;if(!i||!s||!o)return;const a=!!this.inTransition.has(n)&&s.transition;a&&o.substring(0,a.length+2)===`f-${a}`&&this.inTransition.delete(n),this.inTransition.size||this.clearTransitions(),n===this.page&&(null===(e=this.panzoom)||void 0===e?void 0:e.isResting)&&this.emit(\"settle\")}onDecel(t,e=0,i=0,n=0,s=0){if(this.option(\"dragFree\"))return void this.setPageFromPosition();const{isRTL:o,isHorizontal:a,axis:r,pages:l}=this,c=l.length,h=Math.abs(Math.atan2(i,e)/(Math.PI/180));let d=0;if(d=h>45&&h<135?a?0:i:a?e:0,!c)return;let u=this.page,p=o&&a?1:-1;const f=t.current[r]*p;let{pageIndex:g}=this.getPageFromPosition(f);Math.abs(d)>5?(l[u].dim=t&&(this.page+=d.length),this.updateMetrics(),a){const e=(null===(s=this.pages[this.page])||void 0===s?void 0:s.pos)||0,i=(null===(o=this.pages[this.page])||void 0===o?void 0:o.dim)||0,n=this.pages.length||1,h=this.isRTL?l-i:i-l,d=this.isRTL?r-e:e-r;c&&1===n?(t<=this.page&&(a.current[this.axis]-=h,a.target[this.axis]-=h),a.panTo({[this.isHorizontal?\"x\":\"y\"]:-1*e})):d&&t<=this.page&&(a.target[this.axis]-=d,a.current[this.axis]-=d,a.requestTick())}for(const t of d)this.emit(\"initSlide\",t,t.index)}prependSlide(t){this.addSlide(0,t)}appendSlide(t){this.addSlide(this.slides.length,t)}removeSlide(t){const e=this.slides.length;t=(t%e+e)%e;const i=this.slides[t];if(i){this.removeSlideEl(i,!0),this.slides.splice(t,1);for(let t=0;tthis.page?-1:1;let l=-1*o.current.e,c=t((l-r.pos)/(1*r.dim),1e3),h=c,d=c;this.isInfinite&&!0!==n&&(h=t((l-r.pos+a)/(1*r.dim),1e3),d=t((l-r.pos-a)/(1*r.dim),1e3));let u=[c,h,d].reduce((function(t,e){return Math.abs(e)1?1:u<-1?-1:u}setViewportHeight(){const{page:t,pages:e,viewport:i,isHorizontal:n}=this;if(!i||!e[t])return;let s=0;n&&this.track&&(this.track.style.height=\"auto\",e[t].slides.forEach((t=>{t.el&&(s=Math.max(s,t.el.offsetHeight))}))),i.style.height=s?`${s}px`:\"\"}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(t=0){var e;const i=new Set;let{panzoom:n,contentDim:s,viewportDim:o,pages:a,page:r}=this;if(o){s=s+(null===(e=this.slides[this.slides.length-1])||void 0===e?void 0:e.gap)||0;let l=0;l=n&&n.state!==m.Init&&n.state!==m.Destroy?-1*n.current[this.axis]:a[r]&&a[r].pos||0,this.isInfinite&&(l-=Math.floor(l/s)*s),this.isRTL&&this.isHorizontal&&(l*=-1);const c=l-o*t,h=l+o*(t+1),d=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of d){const n=t.pos+e*s,o=n+t.dim+t.gap;nc&&i.add(t)}}return i}getPageFromPosition(t){const{viewportDim:e,contentDim:i,slides:n,pages:s,panzoom:o}=this,a=s.length,r=n.length,l=n[0],c=n[r-1],h=this.option(\"center\");let d=0,u=0,p=0,f=void 0===t?-1*((null==o?void 0:o.target[this.axis])||0):t;h&&(f+=.5*e),this.isInfinite?(fc.pos+c.dim+.5*c.gap&&(f-=i,p=1)):f=Math.max(l.pos||0,Math.min(f,c.pos));let g=c,m=n.find((t=>{const e=t.pos-.5*g.gap,i=t.pos+t.dim+.5*t.gap;return g=t,f>=e&&f{this.removeSlideEl(t)})),this.detachPlugins(),e&&(e.removeEventListener(\"scroll\",this.onScroll),e.offsetParent&&i&&i.offsetParent&&e.replaceWith(...i.childNodes));for(const[e,i]of Object.entries(o))\"container\"!==e&&i&&t.classList.remove(i);this.track=null,this.viewport=null,this.page=0,this.slides=[];const a=this.events.get(\"ready\");this.events=new Map,a&&this.events.set(\"ready\",a)}}Object.defineProperty(Q,\"Panzoom\",{enumerable:!0,configurable:!0,writable:!0,value:I}),Object.defineProperty(Q,\"defaults\",{enumerable:!0,configurable:!0,writable:!0,value:j}),Object.defineProperty(Q,\"Plugins\",{enumerable:!0,configurable:!0,writable:!0,value:U});const tt=function(t){if(!E(t))return 0;const e=window.scrollY,i=window.innerHeight,n=e+i,s=t.getBoundingClientRect(),o=s.y+e,a=s.height,r=o+a;if(e>r||nr)return 100;if(on)return 100;let l=a;on&&(l-=r-n);const c=l/i*100;return Math.round(c)},et=!(\"undefined\"==typeof window||!window.document||!window.document.createElement);let it;const nt=[\"a[href]\",\"area[href]\",'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\"select:not([disabled]):not([aria-hidden])\",\"textarea:not([disabled]):not([aria-hidden])\",\"button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)\",\"iframe\",\"object\",\"embed\",\"video\",\"audio\",\"[contenteditable]\",'[tabindex]:not([tabindex^=\"-\"]):not([disabled]):not([aria-hidden])'].join(\",\"),st=t=>{if(t&&et){void 0===it&&document.createElement(\"div\").focus({get preventScroll(){return it=!0,!1}});try{if(it)t.focus({preventScroll:!0});else{const e=window.scrollY||document.body.scrollTop,i=window.scrollX||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:\"auto\"})}}catch(t){}}},ot=()=>{const t=document;let e,i=\"\",n=\"\",s=\"\";return t.fullscreenEnabled?(i=\"requestFullscreen\",n=\"exitFullscreen\",s=\"fullscreenElement\"):t.webkitFullscreenEnabled&&(i=\"webkitRequestFullscreen\",n=\"webkitExitFullscreen\",s=\"webkitFullscreenElement\"),i&&(e={request:function(e=t.documentElement){return\"webkitRequestFullscreen\"===i?e[i](Element.ALLOW_KEYBOARD_INPUT):e[i]()},exit:function(){return t[s]&&t[n]()},isFullscreen:function(){return t[s]}}),e},at={animated:!0,autoFocus:!0,backdropClick:\"close\",Carousel:{classes:{container:\"fancybox__carousel\",viewport:\"fancybox__viewport\",track:\"fancybox__track\",slide:\"fancybox__slide\"}},closeButton:\"auto\",closeExisting:!1,commonCaption:!1,compact:()=>window.matchMedia(\"(max-width: 578px), (max-height: 578px)\").matches,contentClick:\"toggleZoom\",contentDblClick:!1,defaultType:\"image\",defaultDisplay:\"flex\",dragToClose:!0,Fullscreen:{autoStart:!1},groupAll:!1,groupAttr:\"data-fancybox\",hideClass:\"f-fadeOut\",hideScrollbar:!0,idle:3500,keyboard:{Escape:\"close\",Delete:\"close\",Backspace:\"close\",PageUp:\"next\",PageDown:\"prev\",ArrowUp:\"prev\",ArrowDown:\"next\",ArrowRight:\"next\",ArrowLeft:\"prev\"},l10n:Object.assign(Object.assign({},b),{CLOSE:\"Close\",NEXT:\"Next\",PREV:\"Previous\",MODAL:\"You can close this modal content with the ESC key\",ERROR:\"Something Went Wrong, Please Try Again Later\",IMAGE_ERROR:\"Image Not Found\",ELEMENT_NOT_FOUND:\"HTML Element Not Found\",AJAX_NOT_FOUND:\"Error Loading AJAX : Not Found\",AJAX_FORBIDDEN:\"Error Loading AJAX : Forbidden\",IFRAME_ERROR:\"Error Loading Page\",TOGGLE_ZOOM:\"Toggle zoom level\",TOGGLE_THUMBS:\"Toggle thumbnails\",TOGGLE_SLIDESHOW:\"Toggle slideshow\",TOGGLE_FULLSCREEN:\"Toggle full-screen mode\",DOWNLOAD:\"Download\"}),parentEl:null,placeFocusBack:!0,showClass:\"f-zoomInUp\",startIndex:0,tpl:{closeButton:'',main:''},trapFocus:!0,wheel:\"zoom\"};var rt,lt;!function(t){t[t.Init=0]=\"Init\",t[t.Ready=1]=\"Ready\",t[t.Closing=2]=\"Closing\",t[t.CustomClosing=3]=\"CustomClosing\",t[t.Destroy=4]=\"Destroy\"}(rt||(rt={})),function(t){t[t.Loading=0]=\"Loading\",t[t.Opening=1]=\"Opening\",t[t.Ready=2]=\"Ready\",t[t.Closing=3]=\"Closing\"}(lt||(lt={}));let ct=\"\",ht=!1,dt=!1,ut=null;const pt=()=>{let t=\"\",e=\"\";const i=Oe.getInstance();if(i){const n=i.carousel,s=i.getSlide();if(n&&s){let o=s.slug||void 0,a=s.triggerEl||void 0;e=o||(i.option(\"slug\")||\"\"),!e&&a&&a.dataset&&(e=a.dataset.fancybox||\"\"),e&&\"true\"!==e&&(t=\"#\"+e+(!o&&n.slides.length>1?\"-\"+(s.index+1):\"\"))}}return{hash:t,slug:e,index:1}},ft=()=>{const t=new URL(document.URL).hash,e=t.slice(1).split(\"-\"),i=e[e.length-1],n=i&&/^\\+?\\d+$/.test(i)&&parseInt(e.pop()||\"1\",10)||1;return{hash:t,slug:e.join(\"-\"),index:n}},gt=()=>{const{slug:t,index:e}=ft();if(!t)return;let i=document.querySelector(`[data-slug=\"${t}\"]`);if(i&&i.dispatchEvent(new CustomEvent(\"click\",{bubbles:!0,cancelable:!0})),Oe.getInstance())return;const n=document.querySelectorAll(`[data-fancybox=\"${t}\"]`);n.length&&(i=n[e-1],i&&i.dispatchEvent(new CustomEvent(\"click\",{bubbles:!0,cancelable:!0})))},mt=()=>{if(!1===Oe.defaults.Hash)return;const t=Oe.getInstance();if(!1===(null==t?void 0:t.options.Hash))return;const{slug:e,index:i}=ft(),{slug:n}=pt();t&&(e===n?t.jumpTo(i-1):(ht=!0,t.close())),gt()},vt=()=>{ut&&clearTimeout(ut),queueMicrotask((()=>{mt()}))},bt=()=>{window.addEventListener(\"hashchange\",vt,!1),setTimeout((()=>{mt()}),500)};et&&(/complete|interactive|loaded/.test(document.readyState)?bt():document.addEventListener(\"DOMContentLoaded\",bt));const yt=\"is-zooming-in\";class wt extends _{onCreateSlide(t,e,i){const n=this.instance.optionFor(i,\"src\")||\"\";i.el&&\"image\"===i.type&&\"string\"==typeof n&&this.setImage(i,n)}onRemoveSlide(t,e,i){i.panzoom&&i.panzoom.destroy(),i.panzoom=void 0,i.imageEl=void 0}onChange(t,e,i,n){S(this.instance.container,yt);for(const t of e.slides){const e=t.panzoom;e&&t.index!==i&&e.reset(.35)}}onClose(){var t;const e=this.instance,i=e.container,n=e.getSlide();if(!i||!i.parentElement||!n)return;const{el:s,contentEl:o,panzoom:a,thumbElSrc:r}=n;if(!s||!r||!o||!a||a.isContentLoading||a.state===m.Init||a.state===m.Destroy)return;a.updateMetrics();let l=this.getZoomInfo(n);if(!l)return;this.instance.state=rt.CustomClosing,i.classList.remove(yt),i.classList.add(\"is-zooming-out\"),o.style.backgroundImage=`url('${r}')`;const c=i.getBoundingClientRect();1===((null===(t=window.visualViewport)||void 0===t?void 0:t.scale)||1)&&Object.assign(i.style,{position:\"absolute\",top:`${i.offsetTop+window.scrollY}px`,left:`${i.offsetLeft+window.scrollX}px`,bottom:\"auto\",right:\"auto\",width:`${c.width}px`,height:`${c.height}px`,overflow:\"hidden\"});const{x:h,y:d,scale:u,opacity:p}=l;if(p){const t=((t,e,i,n)=>{const s=e-t,o=n-i;return e=>i+((e-t)/s*o||0)})(a.scale,u,1,0);a.on(\"afterTransform\",(()=>{o.style.opacity=t(a.scale)+\"\"}))}a.on(\"endAnimation\",(()=>{e.destroy()})),a.target.a=u,a.target.b=0,a.target.c=0,a.target.d=u,a.panTo({x:h,y:d,scale:u,friction:p?.2:.33,ignoreBounds:!0}),a.isResting&&e.destroy()}setImage(t,e){const i=this.instance;t.src=e,this.process(t,e).then((e=>{const{contentEl:n,imageEl:s,thumbElSrc:o,el:a}=t;if(i.isClosing()||!n||!s)return;n.offsetHeight;const r=!!i.isOpeningSlide(t)&&this.getZoomInfo(t);if(this.option(\"protected\")&&a){a.addEventListener(\"contextmenu\",(t=>{t.preventDefault()}));const t=document.createElement(\"div\");P(t,\"fancybox-protected\"),n.appendChild(t)}if(o&&r){const s=e.contentRect,a=Math.max(s.fullWidth,s.fullHeight);let c=null;!r.opacity&&a>1200&&(c=document.createElement(\"img\"),P(c,\"fancybox-ghost\"),c.src=o,n.appendChild(c));const h=()=>{c&&(P(c,\"f-fadeFastOut\"),setTimeout((()=>{c&&(c.remove(),c=null)}),200))};(l=o,new Promise(((t,e)=>{const i=new Image;i.onload=t,i.onerror=e,i.src=l}))).then((()=>{i.hideLoading(t),t.state=lt.Opening,this.instance.emit(\"reveal\",t),this.zoomIn(t).then((()=>{h(),this.instance.done(t)}),(()=>{})),c&&setTimeout((()=>{h()}),a>2500?800:200)}),(()=>{i.hideLoading(t),i.revealContent(t)}))}else{const n=this.optionFor(t,\"initialSize\"),s=this.optionFor(t,\"zoom\"),o={event:i.prevMouseMoveEvent||i.options.event,friction:s?.12:0};let a=i.optionFor(t,\"showClass\")||void 0,r=!0;i.isOpeningSlide(t)&&(\"full\"===n?e.zoomToFull(o):\"cover\"===n?e.zoomToCover(o):\"max\"===n?e.zoomToMax(o):r=!1,e.stop(\"current\")),r&&a&&(a=e.isDragging?\"f-fadeIn\":\"\"),i.hideLoading(t),i.revealContent(t,a)}var l}),(()=>{i.setError(t,\"{{IMAGE_ERROR}}\")}))}process(t,e){return new Promise(((i,s)=>{var o;const a=this.instance,r=t.el;a.clearContent(t),a.showLoading(t);let l=this.optionFor(t,\"content\");if(\"string\"==typeof l&&(l=n(l)),!l||!E(l)){if(l=document.createElement(\"img\"),l instanceof HTMLImageElement){let i=\"\",n=t.caption;i=\"string\"==typeof n&&n?n.replace(/<[^>]+>/gi,\"\").substring(0,1e3):`Image ${t.index+1} of ${(null===(o=a.carousel)||void 0===o?void 0:o.pages.length)||1}`,l.src=e||\"\",l.alt=i,l.draggable=!1,t.srcset&&l.setAttribute(\"srcset\",t.srcset),this.instance.isOpeningSlide(t)&&(l.fetchPriority=\"high\")}t.sizes&&l.setAttribute(\"sizes\",t.sizes)}P(l,\"fancybox-image\"),t.imageEl=l,a.setContent(t,l,!1);t.panzoom=new I(r,u({transformParent:!0},this.option(\"Panzoom\")||{},{content:l,width:(e,i)=>a.optionFor(t,\"width\",\"auto\",i)||\"auto\",height:(e,i)=>a.optionFor(t,\"height\",\"auto\",i)||\"auto\",wheel:()=>{const t=a.option(\"wheel\");return(\"zoom\"===t||\"pan\"==t)&&t},click:(e,i)=>{var n,s;if(a.isCompact||a.isClosing())return!1;if(t.index!==(null===(n=a.getSlide())||void 0===n?void 0:n.index))return!1;if(i){const t=i.composedPath()[0];if([\"A\",\"BUTTON\",\"TEXTAREA\",\"OPTION\",\"INPUT\",\"SELECT\",\"VIDEO\"].includes(t.nodeName))return!1}let o=!i||i.target&&(null===(s=t.contentEl)||void 0===s?void 0:s.contains(i.target));return a.option(o?\"contentClick\":\"backdropClick\")||!1},dblClick:()=>a.isCompact?\"toggleZoom\":a.option(\"contentDblClick\")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,on:{ready:t=>{i(t)},error:()=>{s()},destroy:()=>{s()}}}))}))}zoomIn(t){return new Promise(((e,i)=>{const n=this.instance,s=n.container,{panzoom:o,contentEl:a,el:r}=t;o&&o.updateMetrics();const l=this.getZoomInfo(t);if(!(l&&r&&a&&o&&s))return void i();const{x:c,y:h,scale:d,opacity:u}=l,p=()=>{t.state!==lt.Closing&&(u&&(a.style.opacity=Math.max(Math.min(1,1-(1-o.scale)/(1-d)),0)+\"\"),o.scale>=1&&o.scale>o.targetScale-.1&&e(o))},f=t=>{(t.scale<.99||t.scale>1.01)&&!t.isDragging||(S(s,yt),a.style.opacity=\"\",t.off(\"endAnimation\",f),t.off(\"touchStart\",f),t.off(\"afterTransform\",p),e(t))};o.on(\"endAnimation\",f),o.on(\"touchStart\",f),o.on(\"afterTransform\",p),o.on([\"error\",\"destroy\"],(()=>{i()})),o.panTo({x:c,y:h,scale:d,friction:0,ignoreBounds:!0}),o.stop(\"current\");const g={event:\"mousemove\"===o.panMode?n.prevMouseMoveEvent||n.options.event:void 0},m=this.optionFor(t,\"initialSize\");P(s,yt),n.hideLoading(t),\"full\"===m?o.zoomToFull(g):\"cover\"===m?o.zoomToCover(g):\"max\"===m?o.zoomToMax(g):o.reset(.172)}))}getZoomInfo(t){const{el:e,imageEl:i,thumbEl:n,panzoom:s}=t,o=this.instance,a=o.container;if(!e||!i||!n||!s||tt(n)<3||!this.optionFor(t,\"zoom\")||!a||o.state===rt.Destroy)return!1;if(\"0\"===getComputedStyle(a).getPropertyValue(\"--f-images-zoom\"))return!1;const r=window.visualViewport||null;if(1!==(r?r.scale:1))return!1;let{top:l,left:c,width:h,height:d}=n.getBoundingClientRect(),{top:u,left:p,fitWidth:f,fitHeight:g}=s.contentRect;if(!(h&&d&&f&&g))return!1;const m=s.container.getBoundingClientRect();p+=m.left,u+=m.top;const v=-1*(p+.5*f-(c+.5*h)),b=-1*(u+.5*g-(l+.5*d)),y=h/f;let w=this.option(\"zoomOpacity\")||!1;return\"auto\"===w&&(w=Math.abs(h/d-f/g)>.1),{x:v,y:b,scale:y,opacity:w}}attach(){const t=this,e=t.instance;e.on(\"Carousel.change\",t.onChange),e.on(\"Carousel.createSlide\",t.onCreateSlide),e.on(\"Carousel.removeSlide\",t.onRemoveSlide),e.on(\"close\",t.onClose)}detach(){const t=this,e=t.instance;e.off(\"Carousel.change\",t.onChange),e.off(\"Carousel.createSlide\",t.onCreateSlide),e.off(\"Carousel.removeSlide\",t.onRemoveSlide),e.off(\"close\",t.onClose)}}Object.defineProperty(wt,\"defaults\",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:\"fit\",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:\"auto\"}}),\"function\"==typeof SuppressedError&&SuppressedError;const xt=\"html\",Et=\"image\",St=\"map\",Pt=\"youtube\",Ct=\"vimeo\",Tt=\"html5video\",Mt=(t,e={})=>{const i=new URL(t),n=new URLSearchParams(i.search),s=new URLSearchParams;for(const[t,i]of[...n,...Object.entries(e)]){let e=i+\"\";if(\"t\"===t){let t=e.match(/((\\d*)m)?(\\d*)s?/);t&&s.set(\"start\",60*parseInt(t[2]||\"0\")+parseInt(t[3]||\"0\")+\"\")}else s.set(t,e)}let o=s+\"\",a=t.match(/#t=((.*)?\\d+s)/);return a&&(o+=`#t=${a[1]}`),o},Ot={ajax:null,autoSize:!0,iframeAttr:{allow:\"autoplay; fullscreen\",scrolling:\"auto\"},preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:'',videoFormat:\"\",vimeo:{byline:1,color:\"00adef\",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,nocookie:1,rel:0,fs:1}},At=[\"image\",\"html\",\"ajax\",\"inline\",\"clone\",\"iframe\",\"map\",\"pdf\",\"html5video\",\"youtube\",\"vimeo\"];class Lt extends _{onBeforeInitSlide(t,e,i){this.processType(i)}onCreateSlide(t,e,i){this.setContent(i)}onClearContent(t,e){e.xhr&&(e.xhr.abort(),e.xhr=null);const i=e.iframeEl;i&&(i.onload=i.onerror=null,i.src=\"//about:blank\",e.iframeEl=null);const n=e.contentEl,s=e.placeholderEl;if(\"inline\"===e.type&&n&&s)n.classList.remove(\"fancybox__content\"),\"none\"!==getComputedStyle(n).getPropertyValue(\"display\")&&(n.style.display=\"none\"),setTimeout((()=>{s&&(n&&s.parentNode&&s.parentNode.insertBefore(n,s),s.remove())}),0),e.contentEl=void 0,e.placeholderEl=void 0;else for(;e.el&&e.el.firstChild;)e.el.removeChild(e.el.firstChild)}onSelectSlide(t,e,i){i.state===lt.Ready&&this.playVideo()}onUnselectSlide(t,e,i){var n,s;if(i.type===Tt){try{null===(s=null===(n=i.el)||void 0===n?void 0:n.querySelector(\"video\"))||void 0===s||s.pause()}catch(t){}return}let o;i.type===Ct?o={method:\"pause\",value:\"true\"}:i.type===Pt&&(o={event:\"command\",func:\"pauseVideo\"}),o&&i.iframeEl&&i.iframeEl.contentWindow&&i.iframeEl.contentWindow.postMessage(JSON.stringify(o),\"*\"),i.poller&&clearTimeout(i.poller)}onDone(t,e){t.isCurrentSlide(e)&&!t.isClosing()&&this.playVideo()}onRefresh(t,e){e.slides.forEach((t=>{t.el&&(this.resizeIframe(t),this.setAspectRatio(t))}))}onMessage(t){try{let e=JSON.parse(t.data);if(\"https://player.vimeo.com\"===t.origin){if(\"ready\"===e.event)for(let e of Array.from(document.getElementsByClassName(\"fancybox__iframe\")))e instanceof HTMLIFrameElement&&e.contentWindow===t.source&&(e.dataset.ready=\"true\")}else if(t.origin.match(/^https:\\/\\/(www.)?youtube(-nocookie)?.com$/)&&\"onReady\"===e.event){const t=document.getElementById(e.id);t&&(t.dataset.ready=\"true\")}}catch(t){}}loadAjaxContent(t){const e=this.instance.optionFor(t,\"src\")||\"\";this.instance.showLoading(t);const i=this.instance,n=new XMLHttpRequest;i.showLoading(t),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&i.state===rt.Ready&&(i.hideLoading(t),200===n.status?i.setContent(t,n.responseText):i.setError(t,404===n.status?\"{{AJAX_NOT_FOUND}}\":\"{{AJAX_FORBIDDEN}}\"))};const s=t.ajax||null;n.open(s?\"POST\":\"GET\",e+\"\"),n.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\"),n.setRequestHeader(\"X-Requested-With\",\"XMLHttpRequest\"),n.send(s),t.xhr=n}setInlineContent(t){let e=null;if(E(t.src))e=t.src;else if(\"string\"==typeof t.src){const i=t.src.split(\"#\",2).pop();e=i?document.getElementById(i):null}if(e){if(\"clone\"===t.type||e.closest(\".fancybox__slide\")){e=e.cloneNode(!0);const i=e.dataset.animationName;i&&(e.classList.remove(i),delete e.dataset.animationName);let n=e.getAttribute(\"id\");n=n?`${n}--clone`:`clone-${this.instance.id}-${t.index}`,e.setAttribute(\"id\",n)}else if(e.parentNode){const i=document.createElement(\"div\");i.classList.add(\"fancybox-placeholder\"),e.parentNode.insertBefore(i,e),t.placeholderEl=i}this.instance.setContent(t,e)}else this.instance.setError(t,\"{{ELEMENT_NOT_FOUND}}\")}setIframeContent(t){const{src:e,el:i}=t;if(!e||\"string\"!=typeof e||!i)return;i.classList.add(\"is-loading\");const n=this.instance,s=document.createElement(\"iframe\");s.className=\"fancybox__iframe\",s.setAttribute(\"id\",`fancybox__iframe_${n.id}_${t.index}`);for(const[e,i]of Object.entries(this.optionFor(t,\"iframeAttr\")||{}))s.setAttribute(e,i);s.onerror=()=>{n.setError(t,\"{{IFRAME_ERROR}}\")},t.iframeEl=s;const o=this.optionFor(t,\"preload\");if(\"iframe\"!==t.type||!1===o)return s.setAttribute(\"src\",t.src+\"\"),n.setContent(t,s,!1),this.resizeIframe(t),void n.revealContent(t);n.showLoading(t),s.onload=()=>{if(!s.src.length)return;const e=\"true\"!==s.dataset.ready;s.dataset.ready=\"true\",this.resizeIframe(t),e?n.revealContent(t):n.hideLoading(t)},s.setAttribute(\"src\",e),n.setContent(t,s,!1)}resizeIframe(t){const{type:e,iframeEl:i}=t;if(e===Pt||e===Ct)return;const n=null==i?void 0:i.parentElement;if(!i||!n)return;let s=t.autoSize;void 0===s&&(s=this.optionFor(t,\"autoSize\"));let o=t.width||0,a=t.height||0;o&&a&&(s=!1);const r=n&&n.style;if(!1!==t.preload&&!1!==s&&r)try{const t=window.getComputedStyle(n),e=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),s=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),l=i.contentWindow;if(l){const t=l.document,i=t.getElementsByTagName(xt)[0],n=t.body;r.width=\"\",n.style.overflow=\"hidden\",o=o||i.scrollWidth+e,r.width=`${o}px`,n.style.overflow=\"\",r.flex=\"0 0 auto\",r.height=`${n.scrollHeight}px`,a=i.scrollHeight+s}}catch(t){}if(o||a){const t={flex:\"0 1 auto\",width:\"\",height:\"\"};o&&\"auto\"!==o&&(t.width=`${o}px`),a&&\"auto\"!==a&&(t.height=`${a}px`),Object.assign(r,t)}}playVideo(){const t=this.instance.getSlide();if(!t)return;const{el:e}=t;if(!e||!e.offsetParent)return;if(!this.optionFor(t,\"videoAutoplay\"))return;if(t.type===Tt)try{const t=e.querySelector(\"video\");if(t){const e=t.play();void 0!==e&&e.then((()=>{})).catch((e=>{t.muted=!0,t.play()}))}}catch(t){}if(t.type!==Pt&&t.type!==Ct)return;const i=()=>{if(t.iframeEl&&t.iframeEl.contentWindow){let e;if(\"true\"===t.iframeEl.dataset.ready)return e=t.type===Pt?{event:\"command\",func:\"playVideo\"}:{method:\"play\",value:\"true\"},e&&t.iframeEl.contentWindow.postMessage(JSON.stringify(e),\"*\"),void(t.poller=void 0);t.type===Pt&&(e={event:\"listening\",id:t.iframeEl.getAttribute(\"id\")},t.iframeEl.contentWindow.postMessage(JSON.stringify(e),\"*\"))}t.poller=setTimeout(i,250)};i()}processType(t){if(t.html)return t.type=xt,t.src=t.html,void(t.html=\"\");const e=this.instance.optionFor(t,\"src\",\"\");if(!e||\"string\"!=typeof e)return;let i=t.type,n=null;if(n=e.match(/(youtube\\.com|youtu\\.be|youtube\\-nocookie\\.com)\\/(?:watch\\?(?:.*&)?v=|v\\/|u\\/|shorts\\/|embed\\/?)?(videoseries\\?list=(?:.*)|[\\w-]{11}|\\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const s=this.optionFor(t,Pt),{nocookie:o}=s,a=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&\"function\"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0?\"svembed\":\"embed\"}`,i=St):(n=e.match(/(?:maps\\.)?google\\.([a-z]{2,3}(?:\\.[a-z]{2})?)\\/(?:maps\\/search\\/)(.*)/i))&&(t.src=`https://maps.google.${n[1]}/maps?q=${n[2].replace(\"query=\",\"q=\").replace(\"api=1\",\"\")}&output=embed`,i=St),i=i||this.instance.option(\"defaultType\"),t.type=i,i===Et&&(t.thumbSrc=t.thumbSrc||t.src)}setContent(t){const e=this.instance.optionFor(t,\"src\")||\"\";if(t&&t.type&&e){switch(t.type){case xt:this.instance.setContent(t,e);break;case Tt:const i=this.option(\"videoTpl\");i&&this.instance.setContent(t,i.replace(/\\{\\{src\\}\\}/gi,e+\"\").replace(/\\{\\{format\\}\\}/gi,this.optionFor(t,\"videoFormat\")||\"\").replace(/\\{\\{poster\\}\\}/gi,t.poster||t.thumbSrc||\"\"));break;case\"inline\":case\"clone\":this.setInlineContent(t);break;case\"ajax\":this.loadAjaxContent(t);break;case\"pdf\":case St:case Pt:case Ct:t.preload=!1;case\"iframe\":this.setIframeContent(t)}this.setAspectRatio(t)}}setAspectRatio(t){const e=t.contentEl;if(!(t.el&&e&&t.type&&[Pt,Ct,Tt].includes(t.type)))return;let i,n=t.width||\"auto\",s=t.height||\"auto\";if(\"auto\"===n||\"auto\"===s){i=this.optionFor(t,\"videoRatio\");const e=(i+\"\").match(/(\\d+)\\s*\\/\\s?(\\d+)/);i=e&&e.length>2?parseFloat(e[1])/parseFloat(e[2]):parseFloat(i+\"\")}else n&&s&&(i=n/s);if(!i)return;e.style.aspectRatio=\"\",e.style.width=\"\",e.style.height=\"\",e.offsetHeight;const o=e.getBoundingClientRect(),a=o.width||1,r=o.height||1;e.style.aspectRatio=i+\"\",i{t.timer=null,t.inHover||t.onTimerEnd()}),i),t.emit(\"set\")}clear(){const t=this;t.timer&&(clearTimeout(t.timer),t.timer=null),t.removeProgressBar()}start(){const t=this;if(t.set(),t.state!==kt){if(t.option(\"pauseOnHover\")){const e=t.instance.container;e.addEventListener(\"mouseenter\",t.onMouseEnter,!1),e.addEventListener(\"mouseleave\",t.onMouseLeave,!1)}document.addEventListener(\"visibilitychange\",t.onVisibilityChange,!1),t.emit(\"start\")}}stop(){const t=this,e=t.state,i=t.instance.container;t.clear(),t.state=kt,i.removeEventListener(\"mouseenter\",t.onMouseEnter,!1),i.removeEventListener(\"mouseleave\",t.onMouseLeave,!1),document.removeEventListener(\"visibilitychange\",t.onVisibilityChange,!1),S(i,\"has-autoplay\"),e!==kt&&t.emit(\"stop\")}pause(){const t=this;t.state===zt&&(t.state=Rt,t.clear(),t.emit(Rt))}resume(){const t=this,e=t.instance;if(e.isInfinite||e.page!==e.pages.length-1)if(t.state!==zt){if(t.state===Rt&&!t.inHover){const e=new Event(\"resume\",{bubbles:!0,cancelable:!0});t.emit(\"resume\",e),e.defaultPrevented||t.set()}}else t.set();else t.stop()}toggle(){this.state===zt||this.state===Rt?this.stop():this.start()}attach(){const t=this,e=t.instance;e.on(\"ready\",t.onReady),e.on(\"Panzoom.startAnimation\",t.onChange),e.on(\"Panzoom.endAnimation\",t.onSettle),e.on(\"Panzoom.touchMove\",t.onChange)}detach(){const t=this,e=t.instance;e.off(\"ready\",t.onReady),e.off(\"Panzoom.startAnimation\",t.onChange),e.off(\"Panzoom.endAnimation\",t.onSettle),e.off(\"Panzoom.touchMove\",t.onChange),t.stop()}}Object.defineProperty(It,\"defaults\",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class Dt extends _{constructor(){super(...arguments),Object.defineProperty(this,\"ref\",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(t){const e=t.carousel;if(!e)return;const i=t.container;i&&(e.options.Autoplay=u({autoStart:!1},this.option(\"Autoplay\")||{},{pauseOnHover:!1,timeout:this.option(\"timeout\"),progressParentEl:()=>this.option(\"progressParentEl\")||null,on:{start:()=>{t.emit(\"startSlideshow\")},set:e=>{var n;i.classList.add(\"has-slideshow\"),(null===(n=t.getSlide())||void 0===n?void 0:n.state)!==lt.Ready&&e.pause()},stop:()=>{i.classList.remove(\"has-slideshow\"),t.isCompact||t.endIdle(),t.emit(\"endSlideshow\")},resume:(e,i)=>{var n,s,o;!i||!i.cancelable||(null===(n=t.getSlide())||void 0===n?void 0:n.state)===lt.Ready&&(null===(o=null===(s=t.carousel)||void 0===s?void 0:s.panzoom)||void 0===o?void 0:o.isResting)||i.preventDefault()}}}),e.attachPlugins({Autoplay:It}),this.ref=e.plugins.Autoplay)}onReady(t){const e=t.carousel,i=this.ref;i&&e&&this.option(\"playOnStart\")&&(e.isInfinite||e.page{t.isCurrentSlide(e)&&i.stop()})),t.isCurrentSlide(e)&&i.resume()}onKeydown(t,e){var i;const n=this.ref;n&&e===this.option(\"key\")&&\"BUTTON\"!==(null===(i=document.activeElement)||void 0===i?void 0:i.nodeName)&&n.toggle()}attach(){const t=this,e=t.instance;e.on(\"Carousel.init\",t.onPrepare),e.on(\"Carousel.ready\",t.onReady),e.on(\"done\",t.onDone),e.on(\"keydown\",t.onKeydown)}detach(){const t=this,e=t.instance;e.off(\"Carousel.init\",t.onPrepare),e.off(\"Carousel.ready\",t.onReady),e.off(\"done\",t.onDone),e.off(\"keydown\",t.onKeydown)}}Object.defineProperty(Dt,\"defaults\",{enumerable:!0,configurable:!0,writable:!0,value:{key:\" \",playOnStart:!1,progressParentEl:t=>{var e;return(null===(e=t.instance.container)||void 0===e?void 0:e.querySelector(\".fancybox__toolbar [data-fancybox-toggle-slideshow]\"))||t.instance.container},timeout:3e3}});const Ft={classes:{container:\"f-thumbs f-carousel__thumbs\",viewport:\"f-thumbs__viewport\",track:\"f-thumbs__track\",slide:\"f-thumbs__slide\",isResting:\"is-resting\",isSelected:\"is-selected\",isLoading:\"is-loading\",hasThumbs:\"has-thumbs\"},minCount:2,parentEl:null,thumbTpl:'',type:\"modern\"};var jt;!function(t){t[t.Init=0]=\"Init\",t[t.Ready=1]=\"Ready\",t[t.Hidden=2]=\"Hidden\"}(jt||(jt={}));const Bt=\"isResting\",Ht=\"thumbWidth\",Nt=\"thumbHeight\",_t=\"thumbClipWidth\";let $t=class extends _{constructor(){super(...arguments),Object.defineProperty(this,\"type\",{enumerable:!0,configurable:!0,writable:!0,value:\"modern\"}),Object.defineProperty(this,\"container\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"track\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"carousel\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"thumbWidth\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"thumbClipWidth\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"thumbHeight\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"thumbGap\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"thumbExtraGap\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"state\",{enumerable:!0,configurable:!0,writable:!0,value:jt.Init})}get isModern(){return\"modern\"===this.type}onInitSlide(t,e){const i=e.el?e.el.dataset:void 0;i&&(e.thumbSrc=i.thumbSrc||e.thumbSrc||\"\",e[_t]=parseFloat(i[_t]||\"\")||e[_t]||0,e[Nt]=parseFloat(i.thumbHeight||\"\")||e[Nt]||0),this.addSlide(e)}onInitSlides(){this.build()}onChange(){var t;if(!this.isModern)return;const e=this.container,i=this.instance,n=i.panzoom,s=this.carousel,a=s?s.panzoom:null,r=i.page;if(n&&s&&a){if(n.isDragging){S(e,this.cn(Bt));let n=(null===(t=s.pages[r])||void 0===t?void 0:t.pos)||0;n+=i.getProgress(r)*(this[_t]+this.thumbGap);let o=a.getBounds();-1*n>o.x.min&&-1*nparseFloat(getComputedStyle(t).getPropertyValue(\"--f-thumb-\"+e))||0;this.thumbGap=e(\"gap\"),this.thumbExtraGap=e(\"extra-gap\"),this[Ht]=e(\"width\")||40,this[_t]=e(\"clip-width\")||40,this[Nt]=e(\"height\")||40}build(){const t=this;if(t.state!==jt.Init)return;if(t.isDisabled())return void t.emit(\"disabled\");const e=t.instance,i=e.container,n=t.getSlides(),s=t.option(\"type\");t.type=s;const o=t.option(\"parentEl\"),a=t.cn(\"container\"),r=t.cn(\"track\");let l=null==o?void 0:o.querySelector(\".\"+a);l||(l=document.createElement(\"div\"),P(l,a),o?o.appendChild(l):i.after(l)),P(l,`is-${s}`),P(i,t.cn(\"hasThumbs\")),t.container=l,t.updateProps();let c=l.querySelector(\".\"+r);c||(c=document.createElement(\"div\"),P(c,t.cn(\"track\")),l.appendChild(c)),t.track=c;const h=u({},{track:c,infinite:!1,center:!0,fill:\"classic\"===s,dragFree:!0,slidesPerPage:1,transition:!1,preload:.25,friction:.12,Panzoom:{maxVelocity:0},Dots:!1,Navigation:!1,classes:{container:\"f-thumbs\",viewport:\"f-thumbs__viewport\",track:\"f-thumbs__track\",slide:\"f-thumbs__slide\"}},t.option(\"Carousel\")||{},{Sync:{target:e},slides:n}),d=new e.constructor(l,h);d.on(\"createSlide\",((e,i)=>{t.setProps(i.index),t.emit(\"createSlide\",i,i.el)})),d.on(\"ready\",(()=>{t.shiftModern(),t.emit(\"ready\")})),d.on(\"refresh\",(()=>{t.shiftModern()})),d.on(\"Panzoom.click\",((e,i,n)=>{t.onClick(n)})),t.carousel=d,t.state=jt.Ready}onClick(t){t.preventDefault(),t.stopPropagation();const e=this.instance,{pages:i,page:n}=e,s=t=>{if(t){const e=t.closest(\"[data-carousel-index]\");if(e)return[parseInt(e.dataset.carouselIndex||\"\",10)||0,e]}return[-1,void 0]},o=(t,e)=>{const i=document.elementFromPoint(t,e);return i?s(i):[-1,void 0]};let[a,r]=s(t.target);if(a>-1)return;const l=this[_t],c=t.clientX,h=t.clientY;let[d,u]=o(c-l,h),[p,f]=o(c+l,h);u&&f?(a=Math.abs(c-u.getBoundingClientRect().right)-1&&i[a]&&e.slideTo(a)}getShift(t){var e;const i=this,{instance:n}=i,s=i.carousel;if(!n||!s)return 0;const o=i[Ht],a=i[_t],r=i.thumbGap,l=i.thumbExtraGap;if(!(null===(e=s.slides[t])||void 0===e?void 0:e.el))return 0;const c=.5*(o-a),h=n.pages.length-1;let d=n.getProgress(0),u=n.getProgress(h),p=n.getProgress(t,!1,!0),f=0,g=c+l+r;const m=d<0&&d>-1,v=u>0&&u<1;return 0===t?(f=g*Math.abs(d),v&&1===d&&(f-=g*Math.abs(u))):t===h?(f=g*Math.abs(u)*-1,m&&-1===u&&(f+=g*Math.abs(d))):m||v?(f=-1*g,f+=g*Math.abs(d),f+=g*(1-Math.abs(u))):f=g*p,f}setProps(e){var i;const n=this;if(!n.isModern)return;const{instance:s}=n,o=n.carousel;if(s&&o){const a=null===(i=o.slides[e])||void 0===i?void 0:i.el;if(a&&a.childNodes.length){let i=t(1-Math.abs(s.getProgress(e))),o=t(n.getShift(e));a.style.setProperty(\"--progress\",i?i+\"\":\"\"),a.style.setProperty(\"--shift\",o+\"\")}}}shiftModern(){const t=this;if(!t.isModern)return;const{instance:e,track:i}=t,n=e.panzoom,s=t.carousel;if(!(e&&i&&n&&s))return;if(n.state===m.Init||n.state===m.Destroy)return;for(const i of e.slides)t.setProps(i.index);let o=(t[_t]+t.thumbGap)*(s.slides.length||0);i.style.setProperty(\"--width\",o+\"\")}cleanup(){const t=this;t.carousel&&t.carousel.destroy(),t.carousel=null,t.container&&t.container.remove(),t.container=null,t.track&&t.track.remove(),t.track=null,t.state=jt.Init,S(t.instance.container,t.cn(\"hasThumbs\"))}attach(){const t=this,e=t.instance;e.on(\"initSlide\",t.onInitSlide),e.state===B.Init?e.on(\"initSlides\",t.onInitSlides):t.onInitSlides(),e.on([\"change\",\"Panzoom.afterTransform\"],t.onChange),e.on(\"Panzoom.refresh\",t.onRefresh)}detach(){const t=this,e=t.instance;e.off(\"initSlide\",t.onInitSlide),e.off(\"initSlides\",t.onInitSlides),e.off([\"change\",\"Panzoom.afterTransform\"],t.onChange),e.off(\"Panzoom.refresh\",t.onRefresh),t.cleanup()}};Object.defineProperty($t,\"defaults\",{enumerable:!0,configurable:!0,writable:!0,value:Ft});const Wt=Object.assign(Object.assign({},Ft),{key:\"t\",showOnStart:!0,parentEl:null}),Xt=\"is-masked\",qt=\"aria-hidden\";class Yt extends _{constructor(){super(...arguments),Object.defineProperty(this,\"ref\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"hidden\",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get isEnabled(){const t=this.ref;return t&&!t.isDisabled()}get isHidden(){return this.hidden}onClick(t,e){e.stopPropagation()}onCreateSlide(t,e){var i,n,s;const o=(null===(s=null===(n=null===(i=this.instance)||void 0===i?void 0:i.carousel)||void 0===n?void 0:n.slides[e.index])||void 0===s?void 0:s.type)||\"\",a=e.el;if(a&&o){let t=`for-${o}`;[\"video\",\"youtube\",\"vimeo\",\"html5video\"].includes(o)&&(t+=\" for-video\"),P(a,t)}}onInit(){var t;const e=this,i=e.instance,n=i.carousel;if(e.ref||!n)return;const s=e.option(\"parentEl\")||i.footer||i.container;if(!s)return;const o=u({},e.options,{parentEl:s,classes:{container:\"f-thumbs fancybox__thumbs\"},Carousel:{Sync:{friction:i.option(\"Carousel.friction\")||0}},on:{ready:t=>{const i=t.container;i&&this.hidden&&(e.refresh(),i.style.transition=\"none\",e.hide(),i.offsetHeight,queueMicrotask((()=>{i.style.transition=\"\",e.show()})))}}});o.Carousel=o.Carousel||{},o.Carousel.on=u((null===(t=e.options.Carousel)||void 0===t?void 0:t.on)||{},{click:this.onClick,createSlide:this.onCreateSlide}),n.options.Thumbs=o,n.attachPlugins({Thumbs:$t}),e.ref=n.plugins.Thumbs,e.option(\"showOnStart\")||(e.ref.state=jt.Hidden,e.hidden=!0)}onResize(){var t;const e=null===(t=this.ref)||void 0===t?void 0:t.container;e&&(e.style.maxHeight=\"\")}onKeydown(t,e){const i=this.option(\"key\");i&&i===e&&this.toggle()}toggle(){const t=this.ref;if(t&&!t.isDisabled())return t.state===jt.Hidden?(t.state=jt.Init,void t.build()):void(this.hidden?this.show():this.hide())}show(){const t=this.ref;if(!t||t.isDisabled())return;const e=t.container;e&&(this.refresh(),e.offsetHeight,e.removeAttribute(qt),e.classList.remove(Xt),this.hidden=!1)}hide(){const t=this.ref,e=t&&t.container;e&&(this.refresh(),e.offsetHeight,e.classList.add(Xt),e.setAttribute(qt,\"true\")),this.hidden=!0}refresh(){const t=this.ref;if(!t||!t.state)return;const e=t.container,i=(null==e?void 0:e.firstChild)||null;e&&i&&i.childNodes.length&&(e.style.maxHeight=`${i.getBoundingClientRect().height}px`)}attach(){const t=this,e=t.instance;e.state===rt.Init?e.on(\"Carousel.init\",t.onInit):t.onInit(),e.on(\"resize\",t.onResize),e.on(\"keydown\",t.onKeydown)}detach(){var t;const e=this,i=e.instance;i.off(\"Carousel.init\",e.onInit),i.off(\"resize\",e.onResize),i.off(\"keydown\",e.onKeydown),null===(t=i.carousel)||void 0===t||t.detachPlugins([\"Thumbs\"]),e.ref=null}}Object.defineProperty(Yt,\"defaults\",{enumerable:!0,configurable:!0,writable:!0,value:Wt});const Vt={panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:\"zoomIn\"},zoomOut:{icon:'',action:\"zoomOut\"},toggle1to1:{icon:'',action:\"toggleZoom\"},toggleZoom:{icon:'',action:\"toggleZoom\"},iterateZoom:{icon:'',action:\"iterateZoom\"},rotateCCW:{icon:'',action:\"rotateCCW\"},rotateCW:{icon:'',action:\"rotateCW\"},flipX:{icon:'',action:\"flipX\"},flipY:{icon:'',action:\"flipY\"},fitX:{icon:'',action:\"fitX\"},fitY:{icon:'',action:\"fitY\"},reset:{icon:'',action:\"reset\"},toggleFS:{icon:'',action:\"toggleFS\"}};var Zt;!function(t){t[t.Init=0]=\"Init\",t[t.Ready=1]=\"Ready\",t[t.Disabled=2]=\"Disabled\"}(Zt||(Zt={}));const Ut={absolute:\"auto\",display:{left:[\"infobar\"],middle:[],right:[\"iterateZoom\",\"slideshow\",\"fullscreen\",\"thumbs\",\"close\"]},enabled:\"auto\",items:{infobar:{tpl:'/
'},download:{tpl:''},prev:{tpl:''},next:{tpl:''},slideshow:{tpl:''},fullscreen:{tpl:''},thumbs:{tpl:''},close:{tpl:''}},parentEl:null},Gt={tabindex:\"-1\",width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",xmlns:\"http://www.w3.org/2000/svg\"},Kt=\"has-toolbar\",Jt=\"fancybox__toolbar\";class Qt extends _{constructor(){super(...arguments),Object.defineProperty(this,\"state\",{enumerable:!0,configurable:!0,writable:!0,value:Zt.Init}),Object.defineProperty(this,\"container\",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(t){var e;if(!t.carousel)return;let i=this.option(\"display\"),n=this.option(\"absolute\"),s=this.option(\"enabled\");if(\"auto\"===s){const t=this.instance.carousel;let e=0;if(t)for(const i of t.slides)(i.panzoom||\"image\"===i.type)&&e++;e||(s=!1)}s||(i=void 0);let o=0;const a={left:[],middle:[],right:[]};if(i)for(const t of[\"left\",\"middle\",\"right\"])for(const n of i[t]){const i=this.createEl(n);i&&(null===(e=a[t])||void 0===e||e.push(i),o++)}let r=null;if(o&&(r=this.createContainer()),r){for(const[t,e]of Object.entries(a)){const i=document.createElement(\"div\");P(i,Jt+\"__column is-\"+t);for(const t of e)i.appendChild(t);\"auto\"!==n||\"middle\"!==t||e.length||(n=!0),r.appendChild(i)}!0===n&&P(r,\"is-absolute\"),this.state=Zt.Ready,this.onRefresh()}else this.state=Zt.Disabled}onClick(t){var e,i;const n=this.instance,s=n.getSlide(),o=null==s?void 0:s.panzoom,a=t.target,r=a&&E(a)?a.dataset:null;if(!r)return;if(void 0!==r.fancyboxToggleThumbs)return t.preventDefault(),t.stopPropagation(),void(null===(e=n.plugins.Thumbs)||void 0===e||e.toggle());if(void 0!==r.fancyboxToggleFullscreen)return t.preventDefault(),t.stopPropagation(),void this.instance.toggleFullscreen();if(void 0!==r.fancyboxToggleSlideshow){t.preventDefault(),t.stopPropagation();const e=null===(i=n.carousel)||void 0===i?void 0:i.plugins.Autoplay;let s=e.isActive;return o&&\"mousemove\"===o.panMode&&!s&&o.reset(),void(s?e.stop():e.start())}const l=r.panzoomAction,c=r.panzoomChange;if((c||l)&&(t.preventDefault(),t.stopPropagation()),c){let t={};try{t=JSON.parse(c)}catch(t){}o&&o.applyChange(t)}else l&&o&&o[l]&&o[l]()}onChange(){this.onRefresh()}onRefresh(){if(this.instance.isClosing())return;const t=this.container;if(!t)return;const e=this.instance.getSlide();if(!e||e.state!==lt.Ready)return;const i=e&&!e.error&&e.panzoom;for(const e of t.querySelectorAll(\"[data-panzoom-action]\"))i?(e.removeAttribute(\"disabled\"),e.removeAttribute(\"tabindex\")):(e.setAttribute(\"disabled\",\"\"),e.setAttribute(\"tabindex\",\"-1\"));let n=i&&i.canZoomIn(),s=i&&i.canZoomOut();for(const e of t.querySelectorAll('[data-panzoom-action=\"zoomIn\"]'))n?(e.removeAttribute(\"disabled\"),e.removeAttribute(\"tabindex\")):(e.setAttribute(\"disabled\",\"\"),e.setAttribute(\"tabindex\",\"-1\"));for(const e of t.querySelectorAll('[data-panzoom-action=\"zoomOut\"]'))s?(e.removeAttribute(\"disabled\"),e.removeAttribute(\"tabindex\")):(e.setAttribute(\"disabled\",\"\"),e.setAttribute(\"tabindex\",\"-1\"));for(const e of t.querySelectorAll('[data-panzoom-action=\"toggleZoom\"],[data-panzoom-action=\"iterateZoom\"]')){s||n?(e.removeAttribute(\"disabled\"),e.removeAttribute(\"tabindex\")):(e.setAttribute(\"disabled\",\"\"),e.setAttribute(\"tabindex\",\"-1\"));const t=e.querySelector(\"g\");t&&(t.style.display=n?\"\":\"none\")}}onDone(t,e){var i;null===(i=e.panzoom)||void 0===i||i.on(\"afterTransform\",(()=>{this.instance.isCurrentSlide(e)&&this.onRefresh()})),this.instance.isCurrentSlide(e)&&this.onRefresh()}createContainer(){const t=this.instance.container;if(!t)return null;const e=this.option(\"parentEl\")||t;let i=e.querySelector(\".\"+Jt);return i||(i=document.createElement(\"div\"),P(i,Jt),e.prepend(i)),i.addEventListener(\"click\",this.onClick,{passive:!1,capture:!0}),t&&P(t,Kt),this.container=i,i}createEl(t){const e=this.instance,i=e.carousel;if(!i)return null;if(\"toggleFS\"===t)return null;if(\"fullscreen\"===t&&!ot())return null;let s=null;const o=i.slides.length||0;let a=0,r=0;for(const t of i.slides)(t.panzoom||\"image\"===t.type)&&a++,(\"image\"===t.type||t.downloadSrc)&&r++;if(o<2&&[\"infobar\",\"prev\",\"next\"].includes(t))return s;if(void 0!==Vt[t]&&!a)return null;if(\"download\"===t&&!r)return null;if(\"thumbs\"===t){const t=e.plugins.Thumbs;if(!t||!t.isEnabled)return null}if(\"slideshow\"===t){if(!i.plugins.Autoplay||o<2)return null}if(void 0!==Vt[t]){const e=Vt[t];s=document.createElement(\"button\"),s.setAttribute(\"title\",this.instance.localize(`{{${t.toUpperCase()}}}`)),P(s,\"f-button\"),e.action&&(s.dataset.panzoomAction=e.action),e.change&&(s.dataset.panzoomChange=JSON.stringify(e.change)),s.appendChild(n(this.instance.localize(e.icon)))}else{const e=(this.option(\"items\")||[])[t];e&&(s=n(this.instance.localize(e.tpl)),\"function\"==typeof e.click&&s.addEventListener(\"click\",(t=>{t.preventDefault(),t.stopPropagation(),\"function\"==typeof e.click&&e.click.call(this,this,t)})))}const l=null==s?void 0:s.querySelector(\"svg\");if(l)for(const[t,e]of Object.entries(Gt))l.getAttribute(t)||l.setAttribute(t,String(e));return s}removeContainer(){const t=this.container;t&&t.remove(),this.container=null,this.state=Zt.Disabled;const e=this.instance.container;e&&S(e,Kt)}attach(){const t=this,e=t.instance;e.on(\"Carousel.initSlides\",t.onReady),e.on(\"done\",t.onDone),e.on([\"reveal\",\"Carousel.change\"],t.onChange),t.onReady(t.instance)}detach(){const t=this,e=t.instance;e.off(\"Carousel.initSlides\",t.onReady),e.off(\"done\",t.onDone),e.off([\"reveal\",\"Carousel.change\"],t.onChange),t.removeContainer()}}Object.defineProperty(Qt,\"defaults\",{enumerable:!0,configurable:!0,writable:!0,value:Ut});const te={Hash:class extends _{onReady(){ht=!1}onChange(t){ut&&clearTimeout(ut);const{hash:e}=pt(),{hash:i}=ft(),n=t.isOpeningSlide(t.getSlide());n&&(ct=i===e?\"\":i),e&&e!==i&&(ut=setTimeout((()=>{try{if(t.state===rt.Ready){let t=\"replaceState\";n&&!dt&&(t=\"pushState\",dt=!0),window.history[t]({},document.title,window.location.pathname+window.location.search+e)}}catch(t){}}),300))}onClose(t){if(ut&&clearTimeout(ut),!ht&&dt)return dt=!1,ht=!1,void window.history.back();if(!ht)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(ct||\"\"))}catch(t){}}attach(){const t=this.instance;t.on(\"ready\",this.onReady),t.on([\"Carousel.ready\",\"Carousel.change\"],this.onChange),t.on(\"close\",this.onClose)}detach(){const t=this.instance;t.off(\"ready\",this.onReady),t.off([\"Carousel.ready\",\"Carousel.change\"],this.onChange),t.off(\"close\",this.onClose)}static parseURL(){return ft()}static startFromUrl(){gt()}static destroy(){window.removeEventListener(\"hashchange\",vt,!1)}},Html:Lt,Images:wt,Slideshow:Dt,Thumbs:Yt,Toolbar:Qt},ee=\"with-fancybox\",ie=\"hide-scrollbar\",ne=\"--fancybox-scrollbar-compensate\",se=\"--fancybox-body-margin\",oe=\"aria-hidden\",ae=\"is-using-tab\",re=\"is-animated\",le=\"is-compact\",ce=\"is-loading\",he=\"is-opening\",de=\"has-caption\",ue=\"disabled\",pe=\"tabindex\",fe=\"download\",ge=\"href\",me=\"src\",ve=t=>\"string\"==typeof t,be=function(){var t=window.getSelection();return!!t&&\"Range\"===t.type};let ye,we=null,xe=null,Ee=0,Se=0,Pe=0,Ce=0;const Te=new Map;let Me=0;class Oe extends g{get isIdle(){return this.idle}get isCompact(){return this.option(\"compact\")}constructor(t=[],e={},i={}){super(e),Object.defineProperty(this,\"userSlides\",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,\"userPlugins\",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,\"idle\",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,\"idleTimer\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"clickTimer\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"pwt\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"ignoreFocusChange\",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,\"startedFs\",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,\"state\",{enumerable:!0,configurable:!0,writable:!0,value:rt.Init}),Object.defineProperty(this,\"id\",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,\"container\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"caption\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"footer\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"carousel\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"lastFocus\",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,\"prevMouseMoveEvent\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),ye||(ye=ot()),this.id=e.id||++Me,Te.set(this.id,this),this.userSlides=t,this.userPlugins=i,queueMicrotask((()=>{this.init()}))}init(){if(this.state===rt.Destroy)return;this.state=rt.Init,this.attachPlugins(Object.assign(Object.assign({},Oe.Plugins),this.userPlugins)),this.emit(\"init\"),this.emit(\"attachPlugins\"),!0===this.option(\"hideScrollbar\")&&(()=>{if(!et)return;const t=document,e=t.body,i=t.documentElement;if(e.classList.contains(ie))return;let n=window.innerWidth-i.getBoundingClientRect().width;const s=parseFloat(window.getComputedStyle(e).marginRight);n<0&&(n=0),i.style.setProperty(ne,`${n}px`),s&&e.style.setProperty(se,`${s}px`),e.classList.add(ie)})(),this.initLayout(),this.scale();const t=()=>{this.initCarousel(this.userSlides),this.state=rt.Ready,this.attachEvents(),this.emit(\"ready\"),setTimeout((()=>{this.container&&this.container.setAttribute(oe,\"false\")}),16)};this.option(\"Fullscreen.autoStart\")&&ye&&!ye.isFullscreen()?ye.request().then((()=>{this.startedFs=!0,t()})).catch((()=>t())):t()}initLayout(){var t,e;const i=this.option(\"parentEl\")||document.body,s=n(this.localize(this.option(\"tpl.main\")||\"\"));if(s){if(s.setAttribute(\"id\",`fancybox-${this.id}`),s.setAttribute(\"aria-label\",this.localize(\"{{MODAL}}\")),s.classList.toggle(le,this.isCompact),P(s,this.option(\"mainClass\")||\"\"),P(s,he),this.container=s,this.footer=s.querySelector(\".fancybox__footer\"),i.appendChild(s),P(document.documentElement,ee),we&&xe||(we=document.createElement(\"span\"),P(we,\"fancybox-focus-guard\"),we.setAttribute(pe,\"0\"),we.setAttribute(oe,\"true\"),we.setAttribute(\"aria-label\",\"Focus guard\"),xe=we.cloneNode(),null===(t=s.parentElement)||void 0===t||t.insertBefore(we,s),null===(e=s.parentElement)||void 0===e||e.append(xe)),s.addEventListener(\"mousedown\",(t=>{Ee=t.pageX,Se=t.pageY,S(s,ae)})),this.option(\"closeExisting\"))for(const t of Te.values())t.id!==this.id&&t.close();else this.option(\"animated\")&&(P(s,re),setTimeout((()=>{this.isClosing()||S(s,re)}),350));this.emit(\"initLayout\")}}initCarousel(t){const i=this.container;if(!i)return;const n=i.querySelector(\".fancybox__carousel\");if(!n)return;const s=this.carousel=new Q(n,u({},{slides:t,transition:\"fade\",Panzoom:{lockAxis:this.option(\"dragToClose\")?\"xy\":\"x\",infinite:!!this.option(\"dragToClose\")&&\"y\"},Dots:!1,Navigation:{classes:{container:\"fancybox__nav\",button:\"f-button\",isNext:\"is-next\",isPrev:\"is-prev\"}},initialPage:this.option(\"startIndex\"),l10n:this.option(\"l10n\")},this.option(\"Carousel\")||{}));s.on(\"*\",((t,e,...i)=>{this.emit(`Carousel.${e}`,t,...i)})),s.on([\"ready\",\"change\"],(()=>{this.manageCaption()})),this.on(\"Carousel.removeSlide\",((t,e,i)=>{this.clearContent(i),i.state=void 0})),s.on(\"Panzoom.touchStart\",(()=>{var t,e;this.isCompact||this.endIdle(),(null===(t=document.activeElement)||void 0===t?void 0:t.closest(\".f-thumbs\"))&&(null===(e=this.container)||void 0===e||e.focus())})),s.on(\"settle\",(()=>{this.idleTimer||this.isCompact||!this.option(\"idle\")||this.setIdle(),this.option(\"autoFocus\")&&!this.isClosing&&this.checkFocus()})),this.option(\"dragToClose\")&&(s.on(\"Panzoom.afterTransform\",((t,i)=>{const n=this.getSlide();if(n&&e(n.el))return;const s=this.container;if(s){const t=Math.abs(i.current.f),e=t<1?\"\":Math.max(.5,Math.min(1,1-t/i.contentRect.fitHeight*1.5));s.style.setProperty(\"--fancybox-ts\",e?\"0s\":\"\"),s.style.setProperty(\"--fancybox-opacity\",e+\"\")}})),s.on(\"Panzoom.touchEnd\",((t,i,n)=>{var s;const o=this.getSlide();if(o&&e(o.el))return;if(i.isMobile&&document.activeElement&&-1!==[\"TEXTAREA\",\"INPUT\"].indexOf(null===(s=document.activeElement)||void 0===s?void 0:s.nodeName))return;const a=Math.abs(i.dragOffset.y);\"y\"===i.lockedAxis&&(a>=200||a>=50&&i.dragOffset.time<300)&&(n&&n.cancelable&&n.preventDefault(),this.close(n,\"f-throwOut\"+(i.current.f<0?\"Up\":\"Down\")))}))),s.on(\"change\",(t=>{var e;let i=null===(e=this.getSlide())||void 0===e?void 0:e.triggerEl;if(i){const e=new CustomEvent(\"slideTo\",{bubbles:!0,cancelable:!0,detail:t.page});i.dispatchEvent(e)}})),s.on([\"refresh\",\"change\"],(t=>{const e=this.container;if(!e)return;for(const i of e.querySelectorAll(\"[data-fancybox-current-index]\"))i.innerHTML=t.page+1;for(const i of e.querySelectorAll(\"[data-fancybox-count]\"))i.innerHTML=t.pages.length;if(!t.isInfinite){for(const i of e.querySelectorAll(\"[data-fancybox-next]\"))t.page0?(i.removeAttribute(ue),i.removeAttribute(pe)):(i.setAttribute(ue,\"\"),i.setAttribute(pe,\"-1\"))}const i=this.getSlide();if(!i)return;let n=i.downloadSrc||\"\";n||\"image\"!==i.type||i.error||!ve(i[me])||(n=i[me]);for(const t of e.querySelectorAll(\"[data-fancybox-download]\")){const e=i.downloadFilename;n?(t.removeAttribute(ue),t.removeAttribute(pe),t.setAttribute(ge,n),t.setAttribute(fe,e||n),t.setAttribute(\"target\",\"_blank\")):(t.setAttribute(ue,\"\"),t.setAttribute(pe,\"-1\"),t.removeAttribute(ge),t.removeAttribute(fe))}})),this.emit(\"initCarousel\")}attachEvents(){const t=this,e=t.container;if(!e)return;e.addEventListener(\"click\",t.onClick,{passive:!1,capture:!1}),e.addEventListener(\"wheel\",t.onWheel,{passive:!1,capture:!1}),document.addEventListener(\"keydown\",t.onKeydown,{passive:!1,capture:!0}),document.addEventListener(\"visibilitychange\",t.onVisibilityChange,!1),document.addEventListener(\"mousemove\",t.onMousemove),t.option(\"trapFocus\")&&document.addEventListener(\"focus\",t.onFocus,!0),window.addEventListener(\"resize\",t.onResize);const i=window.visualViewport;i&&(i.addEventListener(\"scroll\",t.onResize),i.addEventListener(\"resize\",t.onResize))}detachEvents(){const t=this,e=t.container;if(!e)return;document.removeEventListener(\"keydown\",t.onKeydown,{passive:!1,capture:!0}),e.removeEventListener(\"wheel\",t.onWheel,{passive:!1,capture:!1}),e.removeEventListener(\"click\",t.onClick,{passive:!1,capture:!1}),document.removeEventListener(\"mousemove\",t.onMousemove),window.removeEventListener(\"resize\",t.onResize);const i=window.visualViewport;i&&(i.removeEventListener(\"resize\",t.onResize),i.removeEventListener(\"scroll\",t.onResize)),document.removeEventListener(\"visibilitychange\",t.onVisibilityChange,!1),document.removeEventListener(\"focus\",t.onFocus,!0)}scale(){const t=this.container;if(!t)return;const e=window.visualViewport,i=Math.max(1,(null==e?void 0:e.scale)||1);let n=\"\",s=\"\",o=\"\";if(e&&i>1){let t=`${e.offsetLeft}px`,a=`${e.offsetTop}px`;n=e.width*i+\"px\",s=e.height*i+\"px\",o=`translate3d(${t}, ${a}, 0) scale(${1/i})`}t.style.transform=o,t.style.width=n,t.style.height=s}onClick(t){var e;const{container:i,isCompact:n}=this;if(!i||this.isClosing())return;!n&&this.option(\"idle\")&&this.resetIdle();const s=t.composedPath()[0];if(s.closest(\".fancybox-spinner\")||s.closest(\"[data-fancybox-close]\"))return t.preventDefault(),void this.close(t);if(s.closest(\"[data-fancybox-prev]\"))return t.preventDefault(),void this.prev();if(s.closest(\"[data-fancybox-next]\"))return t.preventDefault(),void this.next();if(\"click\"===t.type&&0===t.detail)return;if(Math.abs(t.pageX-Ee)>30||Math.abs(t.pageY-Se)>30)return;const o=document.activeElement;if(be()&&o&&i.contains(o))return;if(n&&\"image\"===(null===(e=this.getSlide())||void 0===e?void 0:e.type))return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout((()=>{this.toggleIdle(),this.clickTimer=null}),350));if(this.emit(\"click\",t),t.defaultPrevented)return;let a=!1;if(s.closest(\".fancybox__content\")){if(o){if(o.closest(\"[contenteditable]\"))return;s.matches(nt)||o.blur()}if(be())return;a=this.option(\"contentClick\")}else s.closest(\".fancybox__carousel\")&&!s.matches(nt)&&(a=this.option(\"backdropClick\"));\"close\"===a?(t.preventDefault(),this.close(t)):\"next\"===a?(t.preventDefault(),this.next()):\"prev\"===a&&(t.preventDefault(),this.prev())}onWheel(t){const e=t.target;let n=this.option(\"wheel\",t);e.closest(\".fancybox__thumbs\")&&(n=\"slide\");const s=\"slide\"===n,o=[-t.deltaX||0,-t.deltaY||0,-t.detail||0].reduce((function(t,e){return Math.abs(e)>Math.abs(t)?e:t})),a=Math.max(-1,Math.min(1,o)),r=Date.now();this.pwt&&r-this.pwt<300?s&&t.preventDefault():(this.pwt=r,this.emit(\"wheel\",t,a),t.defaultPrevented||(\"close\"===n?(t.preventDefault(),this.close(t)):\"slide\"===n&&(i(e)||(t.preventDefault(),this[a>0?\"prev\":\"next\"]()))))}onScroll(){window.scrollTo(Pe,Ce)}onKeydown(t){if(!this.isTopmost())return;this.isCompact||!this.option(\"idle\")||this.isClosing()||this.resetIdle();const e=t.key,i=this.option(\"keyboard\");if(!i)return;const n=t.composedPath()[0],s=document.activeElement&&document.activeElement.classList,o=s&&s.contains(\"f-button\")||n.dataset.carouselPage||n.dataset.carouselIndex;if(\"Escape\"!==e&&!o&&E(n)){if(n.isContentEditable||-1!==[\"TEXTAREA\",\"OPTION\",\"INPUT\",\"SELECT\",\"VIDEO\"].indexOf(n.nodeName))return}if(\"Tab\"===t.key?P(this.container,ae):S(this.container,ae),t.ctrlKey||t.altKey||t.shiftKey)return;this.emit(\"keydown\",e,t);const a=i[e];a&&\"function\"==typeof this[a]&&(t.preventDefault(),this[a]())}onResize(){const t=this.container;if(!t)return;const e=this.isCompact;t.classList.toggle(le,e),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.scale(),this.emit(\"resize\")}onFocus(t){this.isTopmost()&&this.checkFocus(t)}onMousemove(t){this.prevMouseMoveEvent=t,!this.isCompact&&this.option(\"idle\")&&this.resetIdle()}onVisibilityChange(){\"visible\"===document.visibilityState?this.checkFocus():this.endIdle()}manageCloseBtn(t){const e=this.optionFor(t,\"closeButton\")||!1;if(\"auto\"===e){const t=this.plugins.Toolbar;if(t&&t.state===Zt.Ready)return}if(!e)return;if(!t.contentEl||t.closeBtnEl)return;const i=this.option(\"tpl.closeButton\");if(i){const e=n(this.localize(i));t.closeBtnEl=t.contentEl.appendChild(e),t.el&&P(t.el,\"has-close-btn\")}}manageCaption(t=void 0){var e,i;const n=\"fancybox__caption\",s=this.container;if(!s)return;S(s,de);const o=this.isCompact||this.option(\"commonCaption\"),a=!o;if(this.caption&&this.stop(this.caption),a&&this.caption&&(this.caption.remove(),this.caption=null),o&&!this.caption)for(const t of(null===(e=this.carousel)||void 0===e?void 0:e.slides)||[])t.captionEl&&(t.captionEl.remove(),t.captionEl=void 0,S(t.el,de),null===(i=t.el)||void 0===i||i.removeAttribute(\"aria-labelledby\"));if(t||(t=this.getSlide()),!t||o&&!this.isCurrentSlide(t))return;const r=t.el;let l=this.optionFor(t,\"caption\",\"\");if(!l)return void(o&&this.caption&&this.animate(this.caption,\"f-fadeOut\",(()=>{this.caption&&(this.caption.innerHTML=\"\")})));let c=null;if(a){if(c=t.captionEl||null,r&&!c){const e=n+`_${this.id}_${t.index}`;c=document.createElement(\"div\"),P(c,n),c.setAttribute(\"id\",e),t.captionEl=r.appendChild(c),P(r,de),r.setAttribute(\"aria-labelledby\",e)}}else{if(c=this.caption,c||(c=s.querySelector(\".\"+n)),!c){c=document.createElement(\"div\"),c.dataset.fancyboxCaption=\"\",P(c,n);(this.footer||s).prepend(c)}P(s,de),this.caption=c}c&&(c.innerHTML=\"\",ve(l)||\"number\"==typeof l?c.innerHTML=l+\"\":l instanceof HTMLElement&&c.appendChild(l))}checkFocus(t){this.focus(t)}focus(t){var e;if(this.ignoreFocusChange)return;const i=document.activeElement||null,n=(null==t?void 0:t.target)||null,s=this.container,o=null===(e=this.carousel)||void 0===e?void 0:e.viewport;if(!s||!o)return;if(!t&&i&&s.contains(i))return;const a=this.getSlide(),r=a&&a.state===lt.Ready?a.el:null;if(!r||r.contains(i)||s===i)return;t&&t.cancelable&&t.preventDefault(),this.ignoreFocusChange=!0;const l=Array.from(s.querySelectorAll(nt));let c=[],h=null;for(let t of l){const e=!t.offsetParent||!!t.closest('[aria-hidden=\"true\"]'),i=r&&r.contains(t),n=!o.contains(t);if(t===s||(i||n)&&!e){c.push(t);const e=t.dataset.origTabindex;void 0!==e&&e&&(t.tabIndex=parseFloat(e)),t.removeAttribute(\"data-orig-tabindex\"),!t.hasAttribute(\"autoFocus\")&&h||(h=t)}else{const e=void 0===t.dataset.origTabindex?t.getAttribute(\"tabindex\")||\"\":t.dataset.origTabindex;e&&(t.dataset.origTabindex=e),t.tabIndex=-1}}let d=null;t?(!n||c.indexOf(n)<0)&&(d=h||s,c.length&&(i===xe?d=c[0]:this.lastFocus!==s&&i!==we||(d=c[c.length-1]))):d=a&&\"image\"===a.type?s:h||s,d&&st(d),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const t=this.carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.carousel&&this.carousel.slideTo(...t)}isTopmost(){var t;return(null===(t=Oe.getInstance())||void 0===t?void 0:t.id)==this.id}animate(t=null,e=\"\",i){if(!t||!e)return void(i&&i());this.stop(t);const n=s=>{s.target===t&&t.dataset.animationName&&(t.removeEventListener(\"animationend\",n),delete t.dataset.animationName,i&&i(),S(t,e))};t.dataset.animationName=e,t.addEventListener(\"animationend\",n),P(t,e)}stop(t){t&&t.dispatchEvent(new CustomEvent(\"animationend\",{bubbles:!1,cancelable:!0,currentTarget:t}))}setContent(t,e=\"\",i=!0){if(this.isClosing())return;const s=t.el;if(!s)return;let o=null;if(E(e)?o=e:(o=n(e+\"\"),E(o)||(o=document.createElement(\"div\"),o.innerHTML=e+\"\")),[\"img\",\"picture\",\"iframe\",\"video\",\"audio\"].includes(o.nodeName.toLowerCase())){const t=document.createElement(\"div\");t.appendChild(o),o=t}E(o)&&t.filter&&!t.error&&(o=o.querySelector(t.filter)),o&&E(o)?(P(o,\"fancybox__content\"),t.id&&o.setAttribute(\"id\",t.id),s.classList.add(`has-${t.error?\"error\":t.type||\"unknown\"}`),s.prepend(o),\"none\"===o.style.display&&(o.style.display=\"\"),\"none\"===getComputedStyle(o).getPropertyValue(\"display\")&&(o.style.display=t.display||this.option(\"defaultDisplay\")||\"flex\"),t.contentEl=o,i&&this.revealContent(t),this.manageCloseBtn(t),this.manageCaption(t)):this.setError(t,\"{{ELEMENT_NOT_FOUND}}\")}revealContent(t,e){const i=t.el,n=t.contentEl;i&&n&&(this.emit(\"reveal\",t),this.hideLoading(t),t.state=lt.Opening,(e=this.isOpeningSlide(t)?void 0===e?this.optionFor(t,\"showClass\"):e:\"f-fadeIn\")?this.animate(n,e,(()=>{this.done(t)})):this.done(t))}done(t){this.isClosing()||(t.state=lt.Ready,this.emit(\"done\",t),P(t.el,\"is-done\"),this.isCurrentSlide(t)&&this.option(\"autoFocus\")&&queueMicrotask((()=>{var e;null===(e=t.panzoom)||void 0===e||e.updateControls(),this.option(\"autoFocus\")&&this.focus()})),this.isOpeningSlide(t)&&(S(this.container,he),!this.isCompact&&this.option(\"idle\")&&this.setIdle()))}isCurrentSlide(t){const e=this.getSlide();return!(!t||!e)&&e.index===t.index}isOpeningSlide(t){var e,i;return null===(null===(e=this.carousel)||void 0===e?void 0:e.prevPage)&&t&&t.index===(null===(i=this.getSlide())||void 0===i?void 0:i.index)}showLoading(t){t.state=lt.Loading;const e=t.el;if(!e)return;P(e,ce),this.emit(\"loading\",t),t.spinnerEl||setTimeout((()=>{if(!this.isClosing()&&!t.spinnerEl&&t.state===lt.Loading){let i=n(x);P(i,\"fancybox-spinner\"),t.spinnerEl=i,e.prepend(i),this.animate(i,\"f-fadeIn\")}}),250)}hideLoading(t){const e=t.el;if(!e)return;const i=t.spinnerEl;this.isClosing()?null==i||i.remove():(S(e,ce),i&&this.animate(i,\"f-fadeOut\",(()=>{i.remove()})),t.state===lt.Loading&&(this.emit(\"loaded\",t),t.state=lt.Ready))}setError(t,e){if(this.isClosing())return;const i=new Event(\"error\",{bubbles:!0,cancelable:!0});if(this.emit(\"error\",i,t),i.defaultPrevented)return;t.error=e,this.hideLoading(t),this.clearContent(t);const n=document.createElement(\"div\");n.classList.add(\"fancybox-error\"),n.innerHTML=this.localize(e||\"{{ERROR}}
\"),this.setContent(t,n)}clearContent(t){if(void 0===t.state)return;this.emit(\"clearContent\",t),t.contentEl&&(t.contentEl.remove(),t.contentEl=void 0);const e=t.el;e&&(S(e,\"has-error\"),S(e,\"has-unknown\"),S(e,`has-${t.type||\"unknown\"}`)),t.closeBtnEl&&t.closeBtnEl.remove(),t.closeBtnEl=void 0,t.captionEl&&t.captionEl.remove(),t.captionEl=void 0,t.spinnerEl&&t.spinnerEl.remove(),t.spinnerEl=void 0}getSlide(){var t;const e=this.carousel;return(null===(t=null==e?void 0:e.pages[null==e?void 0:e.page])||void 0===t?void 0:t.slides[0])||void 0}close(t,e){if(this.isClosing())return;const i=new Event(\"shouldClose\",{bubbles:!0,cancelable:!0});if(this.emit(\"shouldClose\",i,t),i.defaultPrevented)return;t&&t.cancelable&&(t.preventDefault(),t.stopPropagation());const n=()=>{this.proceedClose(t,e)};this.startedFs&&ye&&ye.isFullscreen()?Promise.resolve(ye.exit()).then((()=>n())):n()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(t=!1){const e=()=>{this.clearIdle(),this.idle=!0,P(this.container,\"is-idle\"),this.emit(\"setIdle\")};if(this.clearIdle(),!this.isClosing())if(t)e();else{const t=this.option(\"idle\");t&&(this.idleTimer=setTimeout(e,t))}}endIdle(){this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,S(this.container,\"is-idle\"),this.emit(\"endIdle\"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){ye&&(ye.isFullscreen()?ye.exit():ye.request().then((()=>{this.startedFs=!0})))}isClosing(){return[rt.Closing,rt.CustomClosing,rt.Destroy].includes(this.state)}proceedClose(t,e){var i,n;this.state=rt.Closing,this.clearIdle(),this.detachEvents();const s=this.container,o=this.carousel,a=this.getSlide(),r=a&&this.option(\"placeFocusBack\")?a.triggerEl||this.option(\"triggerEl\"):null;if(r&&(tt(r)?st(r):r.focus()),s&&(S(s,he),P(s,\"is-closing\"),s.setAttribute(oe,\"true\"),this.option(\"animated\")&&P(s,re),s.style.pointerEvents=\"none\"),o){o.clearTransitions(),null===(i=o.panzoom)||void 0===i||i.destroy(),null===(n=o.plugins.Navigation)||void 0===n||n.detach();for(const t of o.slides){t.state=lt.Closing,this.hideLoading(t);const e=t.contentEl;e&&this.stop(e);const i=null==t?void 0:t.panzoom;i&&(i.stop(),i.detachEvents(),i.detachObserver()),this.isCurrentSlide(t)||o.emit(\"removeSlide\",t)}}Pe=window.scrollX,Ce=window.scrollY,window.addEventListener(\"scroll\",this.onScroll),this.emit(\"close\",t),this.state!==rt.CustomClosing?(void 0===e&&a&&(e=this.optionFor(a,\"hideClass\")),e&&a?(this.animate(a.contentEl,e,(()=>{o&&o.emit(\"removeSlide\",a)})),setTimeout((()=>{this.destroy()}),500)):this.destroy()):setTimeout((()=>{this.destroy()}),500)}destroy(){var t;if(this.state===rt.Destroy)return;window.removeEventListener(\"scroll\",this.onScroll),this.state=rt.Destroy,null===(t=this.carousel)||void 0===t||t.destroy();const e=this.container;e&&e.remove(),Te.delete(this.id);const i=Oe.getInstance();i?i.focus():(we&&(we.remove(),we=null),xe&&(xe.remove(),xe=null),S(document.documentElement,ee),(()=>{if(!et)return;const t=document,e=t.body;e.classList.remove(ie),e.style.setProperty(se,\"\"),t.documentElement.style.setProperty(ne,\"\")})(),this.emit(\"destroy\"))}static bind(t,e,i){if(!et)return;let n,s=\"\",o={};if(void 0===t?n=document.body:ve(t)?(n=document.body,s=t,\"object\"==typeof e&&(o=e||{})):(n=t,ve(e)&&(s=e),\"object\"==typeof i&&(o=i||{})),!n||!E(n))return;s=s||\"[data-fancybox]\";const a=Oe.openers.get(n)||new Map;a.set(s,o),Oe.openers.set(n,a),1===a.size&&n.addEventListener(\"click\",Oe.fromEvent)}static unbind(t,e){let i,n=\"\";if(ve(t)?(i=document.body,n=t):(i=t,ve(e)&&(n=e)),!i)return;const s=Oe.openers.get(i);s&&n&&s.delete(n),n&&s||(Oe.openers.delete(i),i.removeEventListener(\"click\",Oe.fromEvent))}static destroy(){let t;for(;t=Oe.getInstance();)t.destroy();for(const t of Oe.openers.keys())t.removeEventListener(\"click\",Oe.fromEvent);Oe.openers=new Map}static fromEvent(t){if(t.defaultPrevented)return;if(t.button&&0!==t.button)return;if(t.ctrlKey||t.metaKey||t.shiftKey)return;let e=t.composedPath()[0];const i=e.closest(\"[data-fancybox-trigger]\");if(i){const t=i.dataset.fancyboxTrigger||\"\",n=document.querySelectorAll(`[data-fancybox=\"${t}\"]`),s=parseInt(i.dataset.fancyboxIndex||\"\",10)||0;e=n[s]||e}if(!(e&&e instanceof Element))return;let n,s,o,a;if([...Oe.openers].reverse().find((([t,i])=>!(!t.contains(e)||![...i].reverse().find((([i,r])=>{let l=e.closest(i);return!!l&&(n=t,s=i,o=l,a=r,!0)}))))),!n||!s||!o)return;a=a||{},t.preventDefault(),e=o;let r=[],l=u({},at,a);l.event=t,l.triggerEl=e,l.delegate=i;const c=l.groupAll,h=l.groupAttr,d=h&&e?e.getAttribute(`${h}`):\"\";if((!e||d||c)&&(r=[].slice.call(n.querySelectorAll(s))),e&&!c&&(r=d?r.filter((t=>t.getAttribute(`${h}`)===d)):[e]),!r.length)return;const p=Oe.getInstance();return p&&p.options.triggerEl&&r.indexOf(p.options.triggerEl)>-1?void 0:(e&&(l.startIndex=r.indexOf(e)),Oe.fromNodes(r,l))}static fromSelector(t,e,i){let n=null,s=\"\",o={};if(ve(t)?(n=document.body,s=t,\"object\"==typeof e&&(o=e||{})):t instanceof HTMLElement&&ve(e)&&(n=t,s=e,\"object\"==typeof i&&(o=i||{})),!n||!s)return!1;const a=Oe.openers.get(n);return!!a&&(o=u({},a.get(s)||{},o),!!o&&Oe.fromNodes(Array.from(n.querySelectorAll(s)),o))}static fromNodes(t,e){e=u({},at,e||{});const i=[];for(const n of t){const t=n.dataset||{},s=t[me]||n.getAttribute(ge)||n.getAttribute(\"currentSrc\")||n.getAttribute(me)||void 0;let o;const a=e.delegate;let r;a&&i.length===e.startIndex&&(o=a instanceof HTMLImageElement?a:a.querySelector(\"img:not([aria-hidden])\")),o||(o=n instanceof HTMLImageElement?n:n.querySelector(\"img:not([aria-hidden])\")),o&&(r=o.currentSrc||o[me]||void 0,!r&&o.dataset&&(r=o.dataset.lazySrc||o.dataset[me]||void 0));const l={src:s,triggerEl:n,thumbEl:o,thumbElSrc:r,thumbSrc:r};for(const e in t){let i=t[e]+\"\";i=\"false\"!==i&&(\"true\"===i||i),l[e]=i}i.push(l)}return new Oe(i,e)}static getInstance(t){if(t)return Te.get(t);return Array.from(Te.values()).reverse().find((t=>!t.isClosing()&&t))||null}static getSlide(){var t;return(null===(t=Oe.getInstance())||void 0===t?void 0:t.getSlide())||null}static show(t=[],e={}){return new Oe(t,e)}static next(){const t=Oe.getInstance();t&&t.next()}static prev(){const t=Oe.getInstance();t&&t.prev()}static close(t=!0,...e){if(t)for(const t of Te.values())t.close(...e);else{const t=Oe.getInstance();t&&t.close(...e)}}}Object.defineProperty(Oe,\"version\",{enumerable:!0,configurable:!0,writable:!0,value:\"5.0.36\"}),Object.defineProperty(Oe,\"defaults\",{enumerable:!0,configurable:!0,writable:!0,value:at}),Object.defineProperty(Oe,\"Plugins\",{enumerable:!0,configurable:!0,writable:!0,value:te}),Object.defineProperty(Oe,\"openers\",{enumerable:!0,configurable:!0,writable:!0,value:new Map});export{Q as Carousel,Oe as Fancybox,I as Panzoom};\n","/**\r\n * select2 Component\r\n *\r\n * @file custom select2.js\r\n */\r\n\r\n\r\nimport 'select2/dist/css/select2.min.css';\r\nimport $ from \"jquery\";\r\nimport 'select2';\r\nimport { Fancybox } from \"@fancyapps/ui\";\r\nimport \"@fancyapps/ui/dist/fancybox/fancybox.css\";\r\n\r\n\r\n\r\nconst customSelect = (() => {\r\n \r\n const buttonChangeDataUrl = () => {\r\n document.addEventListener('DOMContentLoaded', function() {\r\n const linkElements = document.querySelectorAll('.pl-button.aqua.data-sp-tooltip');\r\n \r\n linkElements.forEach(linkElement => {\r\n linkElement.addEventListener('click', function(event) {\r\n event.preventDefault();\r\n \r\n const userAgent = navigator.userAgent.toLowerCase();\r\n let targetLink;\r\n \r\n if (userAgent.includes('iphone') || userAgent.includes('ipad')) {\r\n targetLink = this.getAttribute('data-mobile-link-ios');\r\n } else if (userAgent.includes('android')) {\r\n targetLink = this.getAttribute('data-mobile-link-android');\r\n } else {\r\n targetLink = this.getAttribute('data-desktop-link');\r\n }\r\n \r\n window.open(targetLink, '_blank'); // Yeni sekmede açılır\r\n });\r\n });\r\n });\r\n };\r\n\r\n const defaultFancybox = () => {\r\n const cookieModalClass = document.getElementById(\"cookie-dialog-content\");\r\n Fancybox.bind('[data-fancybox]', {\r\n // Custom options for all galleries\r\n dragToClose: false, // Sürüklemeyi devre dışı bırak\r\n on: {\r\n close: (fancybox, slide) => {\r\n cookieModalClass.classList.remove(\"d-block\");\r\n cookieModalClass.classList.add(\"d-none\");\r\n }\r\n }\r\n }); \r\n $(\".cookie-accept\").on(\"click\", function(){\r\n Fancybox.close();\r\n });\r\n };\r\n\r\n\r\n const defaultcustomSelect = () => {\r\n //if language sorgusu buraya gelecek html lang koduyla değişkene aktarılacak \r\n $('.calculate-select').select2({\r\n theme: \"calculate-custom-option-select\",\r\n language: {\r\n noResults: function () {\r\n // Dillere göre yazı getireceğiz\r\n return \"Sonuç bulunamadı\";\r\n }\r\n },\r\n templateResult: function (option) {\r\n if (!option.id) {\r\n return option.text;\r\n }\r\n var $option = $(\r\n '
' + option.text + ''\r\n );\r\n return $option;\r\n },\r\n templateSelection: function (option) {\r\n if (!option.id) {\r\n return option.text;\r\n }\r\n var $option = $(\r\n '
' + option.text + ''\r\n );\r\n return $option;\r\n }\r\n }).on('select2:open', function(e){\r\n // Dillere göre yazı getireceğiz\r\n $('.select2-search__field').attr('placeholder', 'Arama yap');\r\n });\r\n };\r\n const defaultcustomSelectMini = () => {\r\n //if language sorgusu buraya gelecek html lang koduyla değişkene aktarılacak \r\n $('.calculate-select-mini').select2({\r\n theme: \"calculate-custom-option-select-mini\",\r\n minimumResultsForSearch: Infinity\r\n });\r\n };\r\n\r\n const defaultOnlyNumber = () => {\r\n const inputs = document.querySelectorAll('.inp-only-number');\r\n\r\n // Her bir input için dinleyici ekle\r\n inputs.forEach(input => {\r\n input.addEventListener('input', function() {\r\n // Girilen değeri kontrol et\r\n let value = this.value;\r\n\r\n // Sadece rakam içeren bir değere izin ver\r\n value = value.replace(/[^0-9]/g, '');\r\n\r\n // Input değerini güncelle\r\n this.value = value;\r\n });\r\n });\r\n };\r\n\r\n const init = () => {\r\n buttonChangeDataUrl();\r\n defaultFancybox();\r\n defaultcustomSelect();\r\n defaultcustomSelectMini();\r\n defaultOnlyNumber();\r\n };\r\n\r\n return {\r\n init,\r\n };\r\n})();\r\n\r\nexport default customSelect;\r\n","/**\r\n * Get Current Browser\r\n *\r\n * @file browser.js\r\n */\r\nconst browser = (() => {\r\n const nAgt = navigator.userAgent;\r\n let browserName = navigator.appName;\r\n let fullVersion = `${ parseFloat(navigator.appVersion) }`;\r\n let majorVersion = parseInt(navigator.appVersion, 10);\r\n let nameOffset;\r\n let verOffset;\r\n let ix;\r\n\r\n /**\r\n * Get Browser Detail\r\n * Browser name and version\r\n */\r\n const getBrowserDetail = () => {\r\n if ((nAgt.indexOf('Opera')) !== -1) {\r\n verOffset = nAgt.indexOf('Opera');\r\n browserName = 'Opera';\r\n fullVersion = nAgt.substring(verOffset + 6);\r\n if ((nAgt.indexOf('Version')) !== -1) {\r\n verOffset = nAgt.indexOf('Version');\r\n fullVersion = nAgt.substring(verOffset + 8);\r\n }\r\n } else if ((nAgt.indexOf('MSIE')) !== -1) {\r\n verOffset = nAgt.indexOf('MSIE');\r\n browserName = 'Microsoft Internet Explorer';\r\n fullVersion = nAgt.substring(verOffset + 5);\r\n } else if ((nAgt.indexOf('Chrome')) !== -1) {\r\n verOffset = nAgt.indexOf('Chrome');\r\n browserName = 'Chrome';\r\n fullVersion = nAgt.substring(verOffset + 7);\r\n } else if ((nAgt.indexOf('Safari')) !== -1) {\r\n verOffset = nAgt.indexOf('Safari');\r\n browserName = 'Safari';\r\n fullVersion = nAgt.substring(verOffset + 7);\r\n if ((nAgt.indexOf('Version')) !== -1) {\r\n verOffset = nAgt.indexOf('Version');\r\n fullVersion = nAgt.substring(verOffset + 8);\r\n }\r\n } else if ((nAgt.indexOf('Firefox')) !== -1) {\r\n verOffset = nAgt.indexOf('Firefox');\r\n browserName = 'Firefox';\r\n fullVersion = nAgt.substring(verOffset + 8);\r\n } else if ((nAgt.lastIndexOf(' ') + 1) < (nAgt.lastIndexOf('/'))) {\r\n nameOffset = nAgt.lastIndexOf(' ') + 1;\r\n verOffset = nAgt.lastIndexOf('/');\r\n browserName = nAgt.substring(nameOffset, verOffset);\r\n fullVersion = nAgt.substring(verOffset + 1);\r\n\r\n if (browserName.toLowerCase() === browserName.toUpperCase()) {\r\n browserName = navigator.appName;\r\n }\r\n }\r\n\r\n // trim the fullVersion string at semicolon/space if present\r\n if ((fullVersion.indexOf(';')) !== -1) {\r\n ix = fullVersion.indexOf(';');\r\n fullVersion = fullVersion.substring(0, ix);\r\n }\r\n\r\n if ((fullVersion.indexOf(' ')) !== -1) {\r\n ix = fullVersion.indexOf(' ');\r\n fullVersion = fullVersion.substring(0, ix);\r\n }\r\n\r\n majorVersion = parseInt(`${ fullVersion }`, 10);\r\n\r\n // eslint-disable-next-line\r\n if (isNaN(majorVersion)) {\r\n fullVersion = `${ parseFloat(navigator.appVersion) }`;\r\n majorVersion = parseInt(navigator.appVersion, 10);\r\n }\r\n\r\n return { name: browserName, version: majorVersion };\r\n };\r\n\r\n return {\r\n getDetail: getBrowserDetail,\r\n };\r\n})(navigator, document);\r\n\r\nexport default browser;\r\n","/**\r\n * autoNumeric Component\r\n *\r\n * @file custom autoNumeric.js\r\n */\r\n\r\n// import AutoNumeric from 'autonumeric';\r\nimport $ from \"jquery\";\r\n\r\n\r\n\r\nconst inputMoney = (() => {\r\n const defaultinputMoney = () => {\r\n // var inputs = document.querySelectorAll('.calculate-number-inp');\r\n // inputs.forEach(function(input) {\r\n // new AutoNumeric(input, {\r\n // currencySymbol: '', // Para birimi simgesi olarak Türk Lirası simgesi\r\n // currencySymbolPlacement: 's', // Para birimi simgesinin başa geleceğini belirtir\r\n // digitGroupSeparator: '.', // Binlik ayırıcı\r\n // decimalCharacter: ',', // Ondalık ayırıcı\r\n // decimalPlaces: 0, // Ondalık basamak sayısı\r\n // minimumValue: 0, // Minimum değeri belirtin\r\n // maximumValue: 10000000, // Maksimum değeri belirtin (10 milyon TL) \r\n // unformatOnSubmit: true,\r\n // });\r\n // });\r\n };\r\n\r\n const slideRange = () => {\r\n document.addEventListener(\"DOMContentLoaded\", function() {\r\n const rangeInputs = document.querySelectorAll('.range-to-up-calc');\r\n \r\n rangeInputs.forEach(rangeInput => {\r\n const startDiv = rangeInput.parentElement.querySelector('.calc-start');\r\n const stopDiv = rangeInput.parentElement.querySelector('.calc-stop');\r\n \r\n // Başlangıç ve bitiş değerlerini güncelle\r\n startDiv.textContent = rangeInput.min;\r\n stopDiv.textContent = rangeInput.max;\r\n \r\n // Input değeri değiştiğinde div içeriklerini güncelle\r\n rangeInput.addEventListener('input', function() {\r\n startDiv.textContent = this.value;\r\n });\r\n });\r\n });\r\n };\r\n\r\n const slideRangeNumber = () => {\r\n // document.addEventListener(\"DOMContentLoaded\", function() {\r\n // var inputContainer = document.querySelectorAll('.c-form-calc-inp');\r\n\r\n // inputContainer.forEach(function(inputContainer) {\r\n // // Giriş alanlarına eriş\r\n // var inp = inputContainer.querySelector('.calculate-inp');\r\n // var range = inputContainer.querySelector('.range-to-number-calc');\r\n \r\n // // Giriş alanlarının değerlerini senkronize et\r\n // var inpNumeric = new AutoNumeric(inp, {\r\n // currencySymbol: '', // Para birimi simgesi olarak Türk Lirası simgesi\r\n // currencySymbolPlacement: 's', // Para birimi simgesinin başa geleceğini belirtir\r\n // digitGroupSeparator: '.', // Binlik ayırıcı\r\n // decimalCharacter: ',', // Ondalık ayırıcı\r\n // decimalPlaces: 0, // Ondalık basamak sayısı\r\n // minimumValue: 0, // Minimum değeri belirtin\r\n // maximumValue: 10000000, // Maksimum değeri belirtin (10 milyon TL) \r\n // unformatOnSubmit: true,\r\n // });\r\n \r\n // // Giriş alanlarının değerlerini senkronize et\r\n // inp.addEventListener('input', function() {\r\n // var inputValue = inpNumeric.getNumber();\r\n // // 7 haneli sayıya uygun olacak şekilde formatlayalım\r\n // range.value = (\"0000000\" + inputValue).slice(-7); // 7 haneli olacak şekilde düzenleme\r\n // });\r\n \r\n // range.addEventListener('input', function() {\r\n // inpNumeric.set(range.value);\r\n // });\r\n // });\r\n // });\r\n };\r\n\r\n const rateInputOnlyNumber = () => {\r\n var rateCheckbox = document.querySelectorAll('.checkProfitRateCheckbox');\r\n var rateInput = document.getElementById('checkProfitRateInput');\r\n if($(\".checkProfitRateCheckbox\").is(\":visible\")){\r\n rateCheckbox.forEach(function(checkbox) {\r\n checkbox.addEventListener('change', function() {\r\n if (this.checked) { \r\n rateInput.readOnly = false; \r\n rateInput.focus();\r\n } else {\r\n rateInput.readOnly = true; \r\n rateInput.value = \"\";\r\n }\r\n });\r\n });\r\n document.getElementById('checkProfitRateInput').addEventListener('input', function(event) {\r\n // Sayfa dilini kontrol et\r\n var lang = document.documentElement.lang;\r\n \r\n if (lang === 'tr') {\r\n // Türkçe dilinde sadece sayı ve nokta işaretine izin ver\r\n this.value = this.value.replace(/[^0-9.]/g, '');\r\n } else if (lang === 'en') {\r\n // İngilizce dilinde sadece sayı ve virgül işaretine izin ver\r\n this.value = this.value.replace(/[^0-9,]/g, '');\r\n }\r\n });\r\n // rateInput.addEventListener('input', function() {\r\n // var value = rateInput.value.replace(/\\D/g, '');\r\n // if (value.length > 2) { \r\n // rateInput.value = value.substring(0, value.length - 2) + ',' + value.substring(value.length - 2); \r\n // } else { \r\n // rateInput.value = value; \r\n // }\r\n // });\r\n }\r\n };\r\n\r\n const init = () => {\r\n defaultinputMoney();\r\n slideRange();\r\n slideRangeNumber();\r\n rateInputOnlyNumber();\r\n };\r\n\r\n return {\r\n init,\r\n };\r\n})();\r\n\r\nexport default inputMoney;\r\n","/**\r\n * Tab Component\r\n *\r\n * @file tooltip.js\r\n */\r\n\r\nconst tooltip = (() => {\r\n /**\r\n * Default Tab\r\n * Project default tab style\r\n */\r\n const asistanTooltip = () => {\r\n document.addEventListener(\"DOMContentLoaded\", function() {\r\n const tooltips = document.querySelectorAll('.data-sp-tooltip');\r\n \r\n tooltips.forEach(tooltip => {\r\n const tooltipText = tooltip.getAttribute('data-title');\r\n \r\n if (tooltipText) { // data-title mevcutsa\r\n tooltip.insertAdjacentHTML('beforeend', `${tooltipText}`);\r\n }\r\n });\r\n });\r\n };\r\n\r\n const init = () => {\r\n asistanTooltip();\r\n };\r\n\r\n return {\r\n init,\r\n };\r\n})();\r\n\r\nexport default tooltip;\r\n","export const hasTouch = 'ontouchstart' in document;\r\nexport const isApple = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);\r\nexport const isAndroid = /(Android)/i.test(navigator.platform);\r\nexport const isIpad = navigator.userAgent.match(/iPad/i);\r\nexport const isMobile = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(BlackBerry)|(IEMobile)|(Windows Phone)|(kindle)|(Opera Mini)|(webOS)/i);\r\nexport const isIeBrowser = navigator.userAgent.match(/MSIE/i);\r\n","import browser from './browser';\r\nimport { hasTouch, isMobile } from './constants';\r\n\r\n/**\r\n * After Load\r\n *\r\n * @file loadPage.js\r\n */\r\nconst loadPage = (() => {\r\n const documentHtml = document.getElementsByTagName('html')[0];\r\n const browserName = browser.getDetail().name.toLowerCase() || '';\r\n const browserVersion = browser.getDetail().version || '';\r\n\r\n const classes = [];\r\n\r\n\r\n /**\r\n * JS Load Class\r\n * js load class for css\r\n */\r\n const htmlAddedClasses = () => {\r\n classes.push('no-js');\r\n if (hasTouch) {\r\n classes.push('touch');\r\n } else {\r\n classes.push('no-touch');\r\n }\r\n\r\n if (isMobile) {\r\n classes.push('mobile');\r\n } else {\r\n classes.push('desktop');\r\n }\r\n classes.push(browserName.replace(/ /g, '-'));\r\n classes.push(browserVersion);\r\n classes.push('js');\r\n classes.shift();\r\n documentHtml.className = classes.join(' ');\r\n };\r\n\r\n const init = () => {\r\n htmlAddedClasses();\r\n };\r\n\r\n\r\n return {\r\n init,\r\n };\r\n})();\r\n\r\nexport default loadPage;\r\n","/**\r\nValidation *\r\n * @file validation.js\r\n */\r\n\r\nimport $ from \"jquery\";\r\nrequire('jquery-validation');\r\n\r\n\r\nconst validation = (() => {\r\n /**\r\n * Default Tab\r\n * Project default tab style\r\n */\r\n const writeToUsForm = () => {\r\n $('.write-to-us-form').validate({\r\n rules: {\r\n notificationType: {\r\n required: true\r\n },\r\n message: {\r\n required: true\r\n },\r\n name: {\r\n required: true\r\n },\r\n email: {\r\n required: true\r\n },\r\n phone: {\r\n required: true\r\n },\r\n identityNumber: {\r\n required: true\r\n },\r\n kvkk: {\r\n required: true\r\n },\r\n // email: {\r\n // required: true,\r\n // email: true\r\n // }\r\n },\r\n messages: {\r\n notificationType: \"Bu alanın doldurulması zorunludur.\",\r\n message: \"Bu alanın doldurulması zorunludur.\",\r\n name: \"Bu alanın doldurulması zorunludur.\",\r\n email: \"Bu alanın doldurulması zorunludur.\",\r\n phone: \"Bu alanın doldurulması zorunludur.\",\r\n identityNumber: \"Bu alanın doldurulması zorunludur.\",\r\n kvkk: \"Bu alanın doldurulması zorunludur.\",\r\n // email: {\r\n // required: \"Lütfen bir e-posta adresi girin.\",\r\n // email: \"Lütfen geçerli bir e-posta adresi girin.\"\r\n // }\r\n },\r\n // Hata mesajlarını yerleştireceğimiz alanı belirt\r\n // errorPlacement: function(error, element) {\r\n // if (element.is(\":radio\") || element.is(\":checkbox\")) {\r\n // error.appendTo(element.parent());\r\n // } else {\r\n // error.insertAfter(element);\r\n // }\r\n // },\r\n // Hata olduğunda elemanın üst divine class ekleme\r\n highlight: function(element) {\r\n $(element).closest('.inp').addClass('error');\r\n },\r\n // Hata giderildiğinde elemanın üst divinden class kaldırma\r\n unhighlight: function(element) {\r\n $(element).closest('.inp').removeClass('error');\r\n }\r\n });\r\n };\r\n \r\n const init = () => {\r\n writeToUsForm();\r\n };\r\n \r\n return {\r\n init,\r\n };\r\n })();\r\n \r\n export default validation;\r\n ","/**\r\n * @author Blueprint Frontend Team\r\n */\r\nimport \"../scss/index.scss\";\r\nimport { header } from './layouts';\r\nimport { slider, tabs, accordion, chartJs, customSelect, inputMoney, tooltip } from './components';\r\n\r\nimport { loadPage, validation } from './utils';\r\n\r\n(function () {\r\n loadPage.init();\r\n\r\n // Layouts\r\n header.init();\r\n\r\n\r\n // Partials Modules\r\n slider.init();\r\n tabs.init();\r\n chartJs.init();\r\n accordion.init();\r\n customSelect.init();\r\n inputMoney.init();\r\n tooltip.init();\r\n validation.init();\r\n\r\n\r\n // Page Modules\r\n}());\r\n"],"sourceRoot":""}