"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(target,value)=>__defProp(target,"name",{value:value,configurable:!0}),__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),__async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())}),stream_exports={};__export(stream_exports,{getStream:()=>getStream});var getStream=__name(function(_0){return __async(this,arguments,function*({link:id,providerContext:providerContext}){var _a;try{const{getBaseUrl:getBaseUrl}=providerContext,episodeId=id.split("*")[0],mediaId=id.split("*")[1],baseUrl=yield getBaseUrl("consumet"),serverUrl=`${baseUrl}/movies/flixhq/servers?episodeId=${episodeId}&mediaId=${mediaId}`,res=yield fetch(serverUrl),servers=yield res.json(),streamLinks=[];for(const server of servers){const streamUrl=`${baseUrl}/movies/flixhq/watch?server=`+server.name+"&episodeId="+episodeId+"&mediaId="+mediaId,streamRes=yield fetch(streamUrl),streamData=yield streamRes.json(),subtitles=[];(null==(_a=null==streamData?void 0:streamData.sources)?void 0:_a.length)>0&&(streamData.subtitles&&streamData.subtitles.forEach(sub=>{var _a2;subtitles.push({language:null==(_a2=null==sub?void 0:sub.lang)?void 0:_a2.slice(0,2),uri:null==sub?void 0:sub.url,type:"text/vtt",title:null==sub?void 0:sub.lang})}),streamData.sources.forEach(source=>{var _a2;streamLinks.push({server:(null==server?void 0:server.name)+"-"+(null==(_a2=null==source?void 0:source.quality)?void 0:_a2.replace("auto","MultiQuality")),link:source.url,type:source.isM3U8?"m3u8":"mp4",subtitles:subtitles})}))}return streamLinks}catch(err){return console.error(err),[]}})},"getStream");exports.getStream=getStream;