import{C}from'./chunk-311LbAVZ.js';import{d7 as ak,g,aO as Vr,b2 as mt,aM as R1,dy as K,eZ as E,b as Pa,bW as v,s as sp,m as _2,u as ub,z as zB,A as w2,a6 as KV,o as bV,ak as wx}from'./main-ajlqprgK.js';import{j}from'./chunk-L5A5rljK.js';import'./chunk-DiHKqxPg.js';import'./chunk-BAzl70Bd.js';function V(t,_){if(t&1&&(sp(0,"my-alert",1),KV(1),ub()),t&2){let e=bV();zB(),wx(e.error);}}var D=(()=>{class t{route=g(Vr);router=g(mt);search=g(j);error="";ngOnInit(){let e=this.route.snapshot.queryParams.uri;if(!e){this.error="URL-parametri puuttuu URL-parametreista";return;}this.loadUrl(e);}loadUrl(e){R1([this.search.searchVideos({search:e}),this.search.searchVideoChannels({search:e})]).subscribe(([o,r])=>{let a;if(o.data.length!==0){let l=o.data[0];a=K.buildWatchUrl(l);}else if(r.data.length!==0)a="/c/"+new E(r.data[0]).nameWithHost;else{this.error="Ei saa yhteytt\xE4 et\xE4resurssiin";return;}this.router.navigateByUrl(a);});}static ɵfac=function(o){return new(o||t)();};static ɵcmp=Pa({type:t,selectors:[["my-remote-interaction"]],decls:2,vars:1,consts:[[1,"root"],["type","danger"]],template:function(o,r){o&1&&(sp(0,"div",0),_2(1,V,2,1,"my-alert",1),ub()),o&2&&(zB(),w2(r.error?1:-1));},dependencies:[v],encapsulation:2,changeDetection:1});}return t;})();var G=[{path:"",component:D,providers:[C,j],canActivate:[ak],data:{meta:{title:"Et\xE4vuorovaikutus"}}}];/**i18n:fad79908930cbb4c308e7550a5fe49bb3841dbb330066a6429aebaa006173605*/export{G as default};//# sourceMappingURL=chunk-BgtR-7mA.js.map