import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var bT=function(a,b,c){return _.x(function*(){var d=yield(yield fetch(b,{method:_.cb,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={vg:_.Nj(d.manifestUrl,b),nj:e?_.Nj(e,b):null};a.g.info(`Media Tailor session initialized.
  - manifest URI: ${d.vg}`);return d})},cT=class extends _.Pv{constructor(){super();this.g=new _.S("clpp.mediatailor.MediaTailorPlugin")}onContentWillLoad(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().mediatailor;if(d.enabled){c.g.info("MediaTailor plugin is enabled");try{const e=yield bT(c,b.url,d);a.trigger(new _.F("mt-session-started"));b.url=e.vg}catch(e){throw c.g.error("Failed to start session",e),new _.I(_.G,9,7003,"Media Tailor session failed to initialize.");}}})}id(){return"mediatailor"}};
_.Ir(new class{create(){return new cT}});};f.call(g, window);