/
var
/
www
/
html
/
wordpress
/
wp-content
/
plugins
/
presto-player
/
dist
/
components
/
cjs
/
Upload File
HOME
"use strict";const getConstructor=e=>null!=e?e.constructor:null,instanceOf=(e,t)=>Boolean(e&&t&&e instanceof t),isNullOrUndefined=e=>null==e,isObject$1=e=>getConstructor(e)===Object,isString$1=e=>getConstructor(e)===String,isArray$1=e=>Array.isArray(e),isNodeList=e=>instanceOf(e,NodeList),isElement=e=>null!==e&&"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument,isEmpty=e=>isNullOrUndefined(e)||(isString$1(e)||isArray$1(e)||isNodeList(e))&&!e.length||isObject$1(e)&&!Object.keys(e).length;var is={nullOrUndefined:isNullOrUndefined,object:isObject$1,string:isString$1,nodeList:isNodeList,element:isElement,empty:isEmpty,array:isArray$1};function isArray(e){return Array.isArray?Array.isArray(e):"[object Array]"===getTag(e)}function baseToString(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function toString(e){return null==e?"":baseToString(e)}function isString(e){return"string"==typeof e}function isNumber(e){return"number"==typeof e}function isBoolean(e){return!0===e||!1===e||isObjectLike(e)&&"[object Boolean]"==getTag(e)}function isObject(e){return"object"==typeof e}function isObjectLike(e){return isObject(e)&&null!==e}function isDefined(e){return null!=e}function isBlank(e){return!e.trim().length}function getTag(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const INCORRECT_INDEX_TYPE="Incorrect 'index' type",LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY=e=>`Invalid value for key ${e}`,PATTERN_LENGTH_TOO_LARGE=e=>`Pattern length exceeds max of ${e}.`,MISSING_KEY_PROPERTY=e=>`Missing ${e} property in key`,INVALID_KEY_WEIGHT_VALUE=e=>`Property 'weight' in key '${e}' must be a positive integer`,hasOwn=Object.prototype.hasOwnProperty;class KeyStore{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=createKey(e);t+=n.weight,this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function createKey(e){let t=null,n=null,r=null,s=1,i=null;if(isString(e)||isArray(e))r=e,t=createKeyPath(e),n=createKeyId(e);else{if(!hasOwn.call(e,"name"))throw new Error(MISSING_KEY_PROPERTY("name"));const c=e.name;if(r=c,hasOwn.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(INVALID_KEY_WEIGHT_VALUE(c));t=createKeyPath(c),n=createKeyId(c),i=e.getFn}return{path:t,id:n,weight:s,src:r,getFn:i}}function createKeyPath(e){return isArray(e)?e:e.split(".")}function createKeyId(e){return isArray(e)?e.join("."):e}function get(e,t){let n=[],r=!1;const s=(e,t,i)=>{if(isDefined(e))if(t[i]){const c=e[t[i]];if(!isDefined(c))return;if(i===t.length-1&&(isString(c)||isNumber(c)||isBoolean(c)))n.push(toString(c));else if(isArray(c)){r=!0;for(let e=0,n=c.length;e<n;e+=1)s(c[e],t,i+1)}else t.length&&s(c,t,i+1)}else n.push(e)};return s(e,isString(t)?t.split("."):t,0),r?n:n[0]}const MatchOptions={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},BasicOptions={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},FuzzyOptions={location:0,threshold:.6,distance:100},AdvancedOptions={useExtendedSearch:!1,getFn:get,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Config={...BasicOptions,...MatchOptions,...FuzzyOptions,...AdvancedOptions};const SPACE=/[^ ]+/g;function norm(e=1,t=3){const n=new Map,r=Math.pow(10,t);return{get(t){const s=t.match(SPACE).length;if(n.has(s))return n.get(s);const i=1/Math.pow(s,.5*e),c=parseFloat(Math.round(i*r)/r);return n.set(s,c),c},clear(){n.clear()}}}class FuseIndex{constructor({getFn:e=Config.getFn,fieldNormWeight:t=Config.fieldNormWeight}={}){this.norm=norm(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,isString(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){const t=this.size();isString(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!isDefined(e)||isBlank(e))return;let n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}_addObject(e,t){let n={i:t,$:{}};this.keys.forEach((t,r)=>{let s=t.getFn?t.getFn(e):this.getFn(e,t.path);if(isDefined(s))if(isArray(s)){let e=[];const t=[{nestedArrIndex:-1,value:s}];for(;t.length;){const{nestedArrIndex:n,value:r}=t.pop();if(isDefined(r))if(isString(r)&&!isBlank(r)){let t={v:r,i:n,n:this.norm.get(r)};e.push(t)}else isArray(r)&&r.forEach((e,n)=>{t.push({nestedArrIndex:n,value:e})})}n.$[r]=e}else if(isString(s)&&!isBlank(s)){let e={v:s,n:this.norm.get(s)};n.$[r]=e}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function createIndex(e,t,{getFn:n=Config.getFn,fieldNormWeight:r=Config.fieldNormWeight}={}){const s=new FuseIndex({getFn:n,fieldNormWeight:r});return s.setKeys(e.map(createKey)),s.setSources(t),s.create(),s}function parseIndex(e,{getFn:t=Config.getFn,fieldNormWeight:n=Config.fieldNormWeight}={}){const{keys:r,records:s}=e,i=new FuseIndex({getFn:t,fieldNormWeight:n});return i.setKeys(r),i.setIndexRecords(s),i}function computeScore$1(e,{errors:t=0,currentLocation:n=0,expectedLocation:r=0,distance:s=Config.distance,ignoreLocation:i=Config.ignoreLocation}={}){const c=t/e.length;if(i)return c;const o=Math.abs(r-n);return s?c+o/s:o?1:c}function convertMaskToIndices(e=[],t=Config.minMatchCharLength){let n=[],r=-1,s=-1,i=0;for(let c=e.length;i<c;i+=1){let c=e[i];c&&-1===r?r=i:c||-1===r||(s=i-1,s-r+1>=t&&n.push([r,s]),r=-1)}return e[i-1]&&i-r>=t&&n.push([r,i-1]),n}const MAX_BITS=32;function search(e,t,n,{location:r=Config.location,distance:s=Config.distance,threshold:i=Config.threshold,findAllMatches:c=Config.findAllMatches,minMatchCharLength:o=Config.minMatchCharLength,includeMatches:a=Config.includeMatches,ignoreLocation:h=Config.ignoreLocation}={}){if(t.length>32)throw new Error(PATTERN_LENGTH_TOO_LARGE(32));const l=t.length,u=e.length,d=Math.max(0,Math.min(r,u));let g=i,f=d;const p=o>1||a,m=p?Array(u):[];let y;for(;(y=e.indexOf(t,f))>-1;){let e=computeScore$1(t,{currentLocation:y,expectedLocation:d,distance:s,ignoreLocation:h});if(g=Math.min(e,g),f=y+l,p){let e=0;for(;e<l;)m[y+e]=1,e+=1}}f=-1;let M=[],x=1,v=l+u;const S=1<<l-1;for(let r=0;r<l;r+=1){let i=0,o=v;for(;i<o;)computeScore$1(t,{errors:r,currentLocation:d+o,expectedLocation:d,distance:s,ignoreLocation:h})<=g?i=o:v=o,o=Math.floor((v-i)/2+i);v=o;let a=Math.max(1,d-o+1),y=c?u:Math.min(d+o,u)+l,C=Array(y+2);C[y+1]=(1<<r)-1;for(let i=y;i>=a;i-=1){let c=i-1,o=n[e.charAt(c)];if(p&&(m[c]=+!!o),C[i]=(C[i+1]<<1|1)&o,r&&(C[i]|=(M[i+1]|M[i])<<1|1|M[i+1]),C[i]&S&&(x=computeScore$1(t,{errors:r,currentLocation:c,expectedLocation:d,distance:s,ignoreLocation:h}),x<=g)){if(g=x,f=c,f<=d)break;a=Math.max(1,2*d-f)}}if(computeScore$1(t,{errors:r+1,currentLocation:d,expectedLocation:d,distance:s,ignoreLocation:h})>g)break;M=C}const C={isMatch:f>=0,score:Math.max(.001,x)};if(p){const e=convertMaskToIndices(m,o);e.length?a&&(C.indices=e):C.isMatch=!1}return C}function createPatternAlphabet(e){let t={};for(let n=0,r=e.length;n<r;n+=1){const s=e.charAt(n);t[s]=(t[s]||0)|1<<r-n-1}return t}class BitapSearch{constructor(e,{location:t=Config.location,threshold:n=Config.threshold,distance:r=Config.distance,includeMatches:s=Config.includeMatches,findAllMatches:i=Config.findAllMatches,minMatchCharLength:c=Config.minMatchCharLength,isCaseSensitive:o=Config.isCaseSensitive,ignoreLocation:a=Config.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:s,findAllMatches:i,minMatchCharLength:c,isCaseSensitive:o,ignoreLocation:a},this.pattern=o?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const h=(e,t)=>{this.chunks.push({pattern:e,alphabet:createPatternAlphabet(e),startIndex:t})},l=this.pattern.length;if(l>32){let e=0;const t=l%32,n=l-t;for(;e<n;)h(this.pattern.substr(e,32),e),e+=32;if(t){const e=l-32;h(this.pattern.substr(e),e)}}else h(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,includeMatches:n}=this.options;if(t||(e=e.toLowerCase()),this.pattern===e){let t={isMatch:!0,score:0};return n&&(t.indices=[[0,e.length-1]]),t}const{location:r,distance:s,threshold:i,findAllMatches:c,minMatchCharLength:o,ignoreLocation:a}=this.options;let h=[],l=0,u=!1;this.chunks.forEach(({pattern:t,alphabet:d,startIndex:g})=>{const{isMatch:f,score:p,indices:m}=search(e,t,d,{location:r+g,distance:s,threshold:i,findAllMatches:c,minMatchCharLength:o,includeMatches:n,ignoreLocation:a});f&&(u=!0),l+=p,f&&m&&(h=[...h,...m])});let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&n&&(d.indices=h),d}}class BaseMatch{constructor(e){this.pattern=e}static isMultiMatch(e){return getMatch(e,this.multiRegex)}static isSingleMatch(e){return getMatch(e,this.singleRegex)}search(){}}function getMatch(e,t){const n=e.match(t);return n?n[1]:null}class ExactMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class InverseExactMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class PrefixExactMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class InversePrefixExactMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class SuffixExactMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class InverseSuffixExactMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class FuzzyMatch extends BaseMatch{constructor(e,{location:t=Config.location,threshold:n=Config.threshold,distance:r=Config.distance,includeMatches:s=Config.includeMatches,findAllMatches:i=Config.findAllMatches,minMatchCharLength:c=Config.minMatchCharLength,isCaseSensitive:o=Config.isCaseSensitive,ignoreLocation:a=Config.ignoreLocation}={}){super(e),this._bitapSearch=new BitapSearch(e,{location:t,threshold:n,distance:r,includeMatches:s,findAllMatches:i,minMatchCharLength:c,isCaseSensitive:o,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class IncludeMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,n=0;const r=[],s=this.pattern.length;for(;(t=e.indexOf(this.pattern,n))>-1;)n=t+s,r.push([t,n-1]);const i=!!r.length;return{isMatch:i,score:i?0:1,indices:r}}}const searchers=[ExactMatch,IncludeMatch,PrefixExactMatch,InversePrefixExactMatch,InverseSuffixExactMatch,SuffixExactMatch,InverseExactMatch,FuzzyMatch],searchersLen=searchers.length,SPACE_RE=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,OR_TOKEN="|";function parseQuery(e,t={}){return e.split("|").map(e=>{let n=e.trim().split(SPACE_RE).filter(e=>e&&!!e.trim()),r=[];for(let e=0,s=n.length;e<s;e+=1){const s=n[e];let i=!1,c=-1;for(;!i&&++c<searchersLen;){const e=searchers[c];let n=e.isMultiMatch(s);n&&(r.push(new e(n,t)),i=!0)}if(!i)for(c=-1;++c<searchersLen;){const e=searchers[c];let n=e.isSingleMatch(s);if(n){r.push(new e(n,t));break}}}return r})}const MultiMatchSet=new Set([FuzzyMatch.type,IncludeMatch.type]);class ExtendedSearch{constructor(e,{isCaseSensitive:t=Config.isCaseSensitive,includeMatches:n=Config.includeMatches,minMatchCharLength:r=Config.minMatchCharLength,ignoreLocation:s=Config.ignoreLocation,findAllMatches:i=Config.findAllMatches,location:c=Config.location,threshold:o=Config.threshold,distance:a=Config.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:n,minMatchCharLength:r,findAllMatches:i,ignoreLocation:s,location:c,threshold:o,distance:a},this.pattern=t?e:e.toLowerCase(),this.query=parseQuery(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:r}=this.options;e=r?e:e.toLowerCase();let s=0,i=[],c=0;for(let r=0,o=t.length;r<o;r+=1){const o=t[r];i.length=0,s=0;for(let t=0,r=o.length;t<r;t+=1){const r=o[t],{isMatch:a,indices:h,score:l}=r.search(e);if(!a){c=0,s=0,i.length=0;break}if(s+=1,c+=l,n){const e=r.constructor.type;MultiMatchSet.has(e)?i=[...i,...h]:i.push(h)}}if(s){let e={isMatch:!0,score:c/s};return n&&(e.indices=i),e}}return{isMatch:!1,score:1}}}const registeredSearchers=[];function register(...e){registeredSearchers.push(...e)}function createSearcher(e,t){for(let n=0,r=registeredSearchers.length;n<r;n+=1){let r=registeredSearchers[n];if(r.condition(e,t))return new r(e,t)}return new BitapSearch(e,t)}const LogicalOperator={AND:"$and",OR:"$or"},KeyType={PATH:"$path",PATTERN:"$val"},isExpression=e=>!(!e[LogicalOperator.AND]&&!e[LogicalOperator.OR]),isPath=e=>!!e[KeyType.PATH],isLeaf=e=>!isArray(e)&&isObject(e)&&!isExpression(e),convertToExplicit=e=>({[LogicalOperator.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function parse(e,t,{auto:n=!0}={}){const r=e=>{let s=Object.keys(e);const i=isPath(e);if(!i&&s.length>1&&!isExpression(e))return r(convertToExplicit(e));if(isLeaf(e)){const r=i?e[KeyType.PATH]:s[0],c=i?e[KeyType.PATTERN]:e[r];if(!isString(c))throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(r));const o={keyId:createKeyId(r),pattern:c};return n&&(o.searcher=createSearcher(c,t)),o}let c={children:[],operator:s[0]};return s.forEach(t=>{const n=e[t];isArray(n)&&n.forEach(e=>{c.children.push(r(e))})}),c};return isExpression(e)||(e=convertToExplicit(e)),r(e)}function computeScore(e,{ignoreFieldNorm:t=Config.ignoreFieldNorm}){e.forEach(e=>{let n=1;e.matches.forEach(({key:e,norm:r,score:s})=>{const i=e?e.weight:null;n*=Math.pow(0===s&&i?Number.EPSILON:s,(i||1)*(t?1:r))}),e.score=n})}function transformMatches(e,t){const n=e.matches;t.matches=[],isDefined(n)&&n.forEach(e=>{if(!isDefined(e.indices)||!e.indices.length)return;const{indices:n,value:r}=e;let s={indices:n,value:r};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),t.matches.push(s)})}function transformScore(e,t){t.score=e.score}function format(e,t,{includeMatches:n=Config.includeMatches,includeScore:r=Config.includeScore}={}){const s=[];return n&&s.push(transformMatches),r&&s.push(transformScore),e.map(e=>{const{idx:n}=e,r={item:t[n],refIndex:n};return s.length&&s.forEach(t=>{t(e,r)}),r})}class Fuse{constructor(e,t={},n){this.options={...Config,...t},this._keyStore=new KeyStore(this.options.keys),this.setCollection(e,n)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof FuseIndex))throw new Error(INCORRECT_INDEX_TYPE);this._myIndex=t||createIndex(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){isDefined(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let n=0,r=this._docs.length;n<r;n+=1){const s=this._docs[n];e(s,n)&&(this.removeAt(n),n-=1,r-=1,t.push(s))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:n,includeScore:r,shouldSort:s,sortFn:i,ignoreFieldNorm:c}=this.options;let o=isString(e)?isString(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return computeScore(o,{ignoreFieldNorm:c}),s&&o.sort(i),isNumber(t)&&t>-1&&(o=o.slice(0,t)),format(o,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){const t=createSearcher(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:e,i:n,n:s})=>{if(!isDefined(e))return;const{isMatch:i,score:c,indices:o}=t.searchIn(e);i&&r.push({item:e,idx:n,matches:[{score:c,value:e,norm:s,indices:o}]})}),r}_searchLogical(e){const t=parse(e,this.options),n=(e,t,r)=>{if(!e.children){const{keyId:n,searcher:s}=e,i=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:s});return i&&i.length?[{idx:r,item:t,matches:i}]:[]}const s=[];for(let i=0,c=e.children.length;i<c;i+=1){const c=e.children[i],o=n(c,t,r);if(o.length)s.push(...o);else if(e.operator===LogicalOperator.AND)return[]}return s},r=this._myIndex.records,s={},i=[];return r.forEach(({$:e,i:r})=>{if(isDefined(e)){let c=n(t,e,r);c.length&&(s[r]||(s[r]={idx:r,item:e,matches:[]},i.push(s[r])),c.forEach(({matches:e})=>{s[r].matches.push(...e)}))}}),i}_searchObjectList(e){const t=createSearcher(e,this.options),{keys:n,records:r}=this._myIndex,s=[];return r.forEach(({$:e,i:r})=>{if(!isDefined(e))return;let i=[];n.forEach((n,r)=>{i.push(...this._findMatches({key:n,value:e[r],searcher:t}))}),i.length&&s.push({idx:r,item:e,matches:i})}),s}_findMatches({key:e,value:t,searcher:n}){if(!isDefined(t))return[];let r=[];if(isArray(t))t.forEach(({v:t,i:s,n:i})=>{if(!isDefined(t))return;const{isMatch:c,score:o,indices:a}=n.searchIn(t);c&&r.push({score:o,key:e,value:t,idx:s,norm:i,indices:a})});else{const{v:s,n:i}=t,{isMatch:c,score:o,indices:a}=n.searchIn(s);c&&r.push({score:o,key:e,value:s,norm:i,indices:a})}return r}}function isHLS(e){return"string"==typeof e&&e.includes(".m3u8")}function getParents(e){for(var t=[];e.parentNode&&"body"!=e.parentNode.nodeName.toLowerCase();)e=e.parentNode,t.push(e);return t}function setAttributes(e,t){is.element(e)&&!is.empty(t)&&Object.entries(t).filter(([,e])=>!is.nullOrUndefined(e)).forEach(([t,n])=>e.setAttribute(t,n))}function createElement(e,t,n){const r=document.createElement(e);return is.object(t)&&setAttributes(r,t),is.string(n)&&(r.innerText=n),r}function parseJSON(e,t){try{return JSON.parse(e)}catch(e){return console.warn("Invalid value:",e),t}}Fuse.version="6.6.2",Fuse.createIndex=createIndex,Fuse.parseIndex=parseIndex,Fuse.config=Config,Fuse.parseQuery=parse,register(ExtendedSearch);const vttToJson=e=>e?["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,n)=>(e[n]&&(t[n]=e[n]),t),{cues:e.cues&&Array.prototype.map.call(e.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})}):null,fuzzySearch=(e,t,n)=>{if(is.empty(t))return[];if(is.empty(n))return[];if(!is.string(e))return[];const r={...null==n?void 0:n.minMatchCharLength,...null==n?void 0:n.threshold,shouldSort:!1,includeMatches:!0,threshold:.3,keys:["text"]};return null!==t&&t&&0!==t.length?new Fuse(t,r).search(e):[]},searchInJson=(e,t,n)=>{if(!is.string(e))return[];if(is.empty(t))return[];if(is.empty(n))return[];const r=fuzzySearch(e,t,n);return r&&Array.prototype.map.call(r,function(e){return{time:Math.ceil(e.item.startTime),label:""}})};function searchVtt(e,t){var n,r,s,i;if(!e)return;if(!(null===(n=null==e?void 0:e.media)||void 0===n?void 0:n.textTracks)||0===(null===(s=null===(r=null==e?void 0:e.media)||void 0===r?void 0:r.textTracks)||void 0===s?void 0:s.length))return;const c=e.media.textTracks,o=(null===(i=e.config.preset)||void 0===i?void 0:i.search)||"";let a="";if(a=-1===e.captions.currentTrack?getCues(e):c[e.captions.currentTrack],is.empty(a))return[];const h=vttToJson(a);return is.empty(h)?[]:searchInJson(t,null==h?void 0:h.cues,o)}function removeOldMarkers(e){var t;if(!e)return;if(!(null==e?void 0:e.elements)||!(null===(t=null==e?void 0:e.elements)||void 0===t?void 0:t.progress))return;let n=e.elements.progress.querySelectorAll(".plyr__progress__marker");if(!is.empty(n))for(var r=0;r<n.length;r++)n[r].remove()}function setMarkers(e,t){if(!e)return;if(removeOldMarkers(e),!(null==t?void 0:t.length))return;const n=document.createDocumentFragment(),r=document.createDocumentFragment();t.forEach(t=>{const n=createElement("span",{class:"plyr__progress__marker"},""),s=t.time/e.duration*100+"%";n.addEventListener("click",()=>{e.currentTime=t.time}),n.style.left=s,r.appendChild(n)}),n.appendChild(r),e.elements.markers={points:r,tip:null},e.elements.progress.appendChild(n)}function cacheCues(e){var t,n,r,s,i,c;if(!(null===(n=null===(t=null==e?void 0:e.config.preset)||void 0===t?void 0:t.search)||void 0===n?void 0:n.enabled))return;if(!(null===(s=null===(r=null==e?void 0:e.media)||void 0===r?void 0:r.textTracks)||void 0===s?void 0:s.length)||0===(null===(c=null===(i=null==e?void 0:e.media)||void 0===i?void 0:i.textTracks)||void 0===c?void 0:c.length))return;if(-1!==(null==e?void 0:e.currentTrack))return;e.toggleCaptions(!0);let o=setInterval(()=>{var t;const n=null===(t=e.media.textTracks[0])||void 0===t?void 0:t.cues;(null==n?void 0:n.length)>0&&(setCues(e),e.toggleCaptions(!1),clearInterval(o))},200)}function getCues(e){if(!e)return;const t=localStorage.getItem("presto-player-"+e.id+"-cues");return is.empty(t)?"":JSON.parse(t)}function setCues(e){var t,n,r,s,i;if(!e||!(null===(t=null==e?void 0:e.media)||void 0===t?void 0:t.textTracks)||0===(null===(r=null===(n=null==e?void 0:e.media)||void 0===n?void 0:n.textTracks)||void 0===r?void 0:r.length))return;const c=(null===(i=null===(s=null==e?void 0:e.media)||void 0===s?void 0:s.textTracks)||void 0===i?void 0:i[0])?vttToJson(e.media.textTracks[0]):{};is.empty(c)||localStorage.setItem("presto-player-"+e.id+"-cues",JSON.stringify(c))}exports.cacheCues=cacheCues,exports.getParents=getParents,exports.isHLS=isHLS,exports.parseJSON=parseJSON,exports.removeOldMarkers=removeOldMarkers,exports.searchVtt=searchVtt,exports.setMarkers=setMarkers;