1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="800fe7bf-da76-5eed-91a7-48ea728e2e24")}catch(e){}}(); 3import{a as Cp}from"./chunk-NSSF43LG.js";import{a as yp}from"./chunk-FBEK4E5Y.js";import{a as $t,b as bp,c as Qi,d as jm,e as Bm}from"./chunk-7CATO6ZD.js";import{c as Sp}from"./chunk-TXDY4RPP.js";import{a as ho,b as xp}from"./chunk-QIJBDBXA.js";import{a as mp,b as Rs,c as Ns,d as Ti,e as Fs,f as js}from"./chunk-WWK3U4VF.js";import{a as Gn,b as Bs,c as up,d as gp}from"./chunk-UFG424WD.js";import"./chunk-TI22TATI.js";import{b as Ki,c as ep,d as tp,e as Ls,f as Vs,g as ip,h as np,i as op,j as rp,k as sp,l as ap,m as cp,o as lp,p as dp,q as $a,r as pp,s as Wa,t as Ga}from"./chunk-SLW3FWAX.js";import"./chunk-NK35ORBW.js";import{a as fp,c as vp,d as _p}from"./chunk-5HA3EBXJ.js";import{a as Us}from"./chunk-2N6NZDPD.js";import{a as hp}from"./chunk-WZR7R4MY.js";import{a as Yd}from"./chunk-6Q54STSQ.js";import{a as za}from"./chunk-KATJSNDL.js";import{b as Ds,c as Zd}from"./chunk-5DOXNI7X.js";import{a as Xd}from"./chunk-QVJJMUBK.js";import{a as Es,b as As}from"./chunk-JAVMB36G.js";import{a as Jd}from"./chunk-RIHVVWEY.js";import{g as Ms,k as qd}from"./chunk-JARC4VEB.js";import{b as Is,c as Wn,d as qi}from"./chunk-HXMI2QMR.js";import{a as Kd,b as Qd}from"./chunk-NAHODHT4.js";import{a as Gd}from"./chunk-2XU7TDDV.js";import{c as Gi,d as Md,e as Ed,f as Ad,g as Dd,h as gr,i as Ld}from"./chunk-SKOFSUBJ.js";import"./chunk-GZ4P5PE3.js";import{a as Wd}from"./chunk-YUE72EM6.js";import{a as id,d as nd,g as Vd}from"./chunk-KLCPLPUK.js";import"./chunk-NRATS2HE.js";import"./chunk-7Z2JYX24.js";import"./chunk-J53KV4IX.js";import{a as ii,b as Nd,c as ni,d as Ps,e as Fd,f as Os,g as jd,h as Bd,i as Ud,j as Hd}from"./chunk-Q7G4NIEM.js";import{e as Rd}from"./chunk-FL6PYUEN.js";import"./chunk-HDDVVXRI.js";import"./chunk-XA7QA3XI.js";import"./chunk-YDQHYKVN.js";import"./chunk-JKXALLKD.js";import"./chunk-CNXPHT75.js";import{ra as Ua,sa as Ha,va as Ts}from"./chunk-2QADSPWV.js";import"./chunk-D5VEOIAR.js";import{$ as Wi,A as Nt,B as qe,C as ci,D as hd,E as mn,F as md,G as ud,H as gd,I as fd,K as vd,L as _d,M as Cd,N as bd,O as Sd,P as Na,Q as xd,R as ks,T as yd,U as kd,V as Fa,W as wd,X as ja,Y as Td,Z as Ba,_ as ur,a as en,aa as Bo,b as ct,ba as It,c as Et,ca as Oe,d as Ot,da as Uo,e as zn,ea as ti,f as hn,fa as ws,g as $n,ga as Qt,h as Fo,ha as Ho,i as Ss,ia as Pd,j as Va,ja as Od,k as tn,ka as zo,l as Rt,la as un,m as xs,ma as _i,n as od,o as rd,p as sd,q as mr,r as ad,s as cd,t as po,u as jo,v as ld,w as dd,x as pd,y as Ra,z as ys}from"./chunk-RX7CCVCF.js";import{b as $d}from"./chunk-ALU7IMOD.js";import{a as zd}from"./chunk-MYR5NO42.js";import{b as No}from"./chunk-I7CHTL7G.js";import{a as ed}from"./chunk-CZ6C6B4U.js";import"./chunk-ZB6PSQYY.js";import{a as Id}from"./chunk-G6V4EC3J.js";import"./chunk-LYWBHDNF.js";import"./chunk-D2NYEW4J.js";import"./chunk-DZDELCLY.js";import{a as ql}from"./chunk-7T7P6ESL.js";import{a as ei}from"./chunk-G7QIRMNQ.js";import{a as jl,b as us,c as Bl,d as Vo,e as gs}from"./chunk-6PGIMACX.js";import"./chunk-W7VYE7BD.js";import"./chunk-IDYPPQCU.js";import{a as Do}from"./chunk-RVGQBOW4.js";import"./chunk-PRSRIKRG.js";import{a as $i}from"./chunk-35O4R4YN.js";import{a as Ul,b as Hl}from"./chunk-W6TBPIM7.js";import{c as Kl,e as Ql,h as Yl,i as Jl,j as Xl,n as Zl,v as bs}from"./chunk-PJW3BP5F.js";import"./chunk-P33TZQBS.js";import{a as co,b as Hn,c as He}from"./chunk-LMXP7KFS.js";import{a as ai,b as ft}from"./chunk-5TE65YMQ.js";import"./chunk-FVEQBDGJ.js";import"./chunk-OS3XHMQL.js";import"./chunk-OB7B4RDQ.js";import"./chunk-W55TFYQP.js";import{b as Lo}from"./chunk-H4EFSOVA.js";import{a as td}from"./chunk-BXEAVBW5.js";import"./chunk-I4M76G4S.js";import"./chunk-WCSLZPNH.js";import"./chunk-LVL7DOC5.js";import"./chunk-R2JMUQ77.js";import{a as vs,k as zl,t as La}from"./chunk-ITQWMIEL.js";import{a as dr,b as pr}from"./chunk-5YM3O5I6.js";import{a as Al,b as ls,c as ds}from"./chunk-ZZG5IPKY.js";import"./chunk-2SRUAFBD.js";import{O as Ll,P as hr,ca as Fl,da as Zt,ea as hs,ga as Wl,r as Da}from"./chunk-KRNZR6YH.js";import{a as Rl,b as Nl}from"./chunk-VKKAQZP5.js";import"./chunk-26TGM6QC.js";import"./chunk-PWTDXLFQ.js";import{c as Vl}from"./chunk-NU27DJEQ.js";import"./chunk-6MIUUXBY.js";import{b as fs}from"./chunk-IDEEGTYH.js";import{c as mi,d as $l,e as Gl,f as _s}from"./chunk-JU73QFWT.js";import{a as ms}from"./chunk-N3LX3THL.js";import{a as Ro}from"./chunk-FEYFR4YX.js";import{a as Ao}from"./chunk-E6YGJNAQ.js";import{a as ps}from"./chunk-VZCLJPEW.js";import"./chunk-P4U5MZI6.js";import{a as Cs}from"./chunk-6FL5NH35.js";import{a as as,b as cs}from"./chunk-KYKGDHNG.js";import"./chunk-CGOHAIKO.js";import{a as lo}from"./chunk-J6TAHOQ5.js";import{a as Je}from"./chunk-ZNBR7H42.js";import"./chunk-2B2LYKQP.js";import"./chunk-LG75LMIH.js";import"./chunk-XLFNES36.js";import{b as Dl}from"./chunk-MTX4XYDT.js";import{$ as Om,$a as es,Aa as Im,C as Ln,Fa as bl,Fb as Kt,Fd as hi,Ga as Mm,Gb as bn,Gc as is,Gd as Bn,Hc as wl,Hd as Vt,Ic as jn,Id as Zi,Jc as ns,Ld as We,Md as Ue,Nd as at,Ob as yl,Pb as Am,Sb as kl,Tb as Dm,Ua as Sl,Va as Em,W as Xt,X as Hi,Xd as zi,Y as vi,Yd as Eo,Zd as zt,_ as _l,_d as pn,aa as yi,ab as Aa,be as Pe,ce as ht,db as ki,de as rs,ea as ro,eb as so,ed as Tl,ee as Ml,fa as pt,fb as ts,fd as Lm,fe as El,gb as xl,ge as Fm,ia as Nn,k as nl,kc as Fn,l as dn,lc as lr,m as Si,n as Ni,od as Vm,rd as os,re as Un,sd as Pl,se as ss,td as wi,u as xm,ud as ao,vd as Ol,wd as Rm,xd as Il,yd as Nm,z as St,za as Cl}from"./chunk-EHJF6UKK.js";import{$ as xi,E as Qr,F as ll,I as st,K as Tm,U as Ge,V as qt,Y as Mo,Z as Ea,aa as oo,ba as xt,ca as Mi,d as Ri,e as Cn,f as Dn,g as Gr,k as qr,l as rl,m as sl,p as km,q as Kr,r as al,s as cl,t as wm}from"./chunk-7XEC5R2G.js";import{c as fn,d as Oa,e as Zc,k as Io,l as el,n as bi,q as tl,r as ln,s as Xr,t as vl,u as Rn,v as Zr}from"./chunk-OV4F6N7I.js";import{a as Ma,c as ym}from"./chunk-J5NV6OCA.js";import{c as yt,i as Ei,j as Pt,k as Ui}from"./chunk-PF63PJ47.js";import{$b as gl,C as Ht,Cb as Yr,Db as Fi,Eb as Vn,Fb as pl,Gb as hl,L as ol,O as no,Sb as Jr,Wb as ml,_b as ul,c as cr,d as En,g as Ii,gc as fl,j as An,q as il,v as pi,vc as ji,wb as dl,zb as Pm}from"./chunk-4MUTHA5V.js";import{C as Jc,D as ae,H as Xc,M as Sm,Q as zr,S as $r,V as Wr,g as ko,i as we,k as Le,l as _e,m as wo,n as To,o as Kc,q as Po,r as Ur,s as Hr,t as Oo,u as Qc,v as Mn,x as Yc,y as xe}from"./chunk-W7MJW6UT.js";import{$c as se,Ab as Uc,Bb as Ie,Bc as Wc,Ca as an,Da as et,F as Ac,Fb as Dr,Gb as So,Gc as vn,I as Dc,Ia as di,Ib as a,Ja as G,Jb as d,Ka as jc,Kb as Hc,La as Li,Lb as sr,Lc as S,Ma as Ar,Md as jr,Nc as p,Oc as Vr,P as Xi,Pb as xo,Pc as Rr,Qc as Gc,R as Co,Rb as yo,Sc as ar,Tc as Ye,U as Lc,Ua as Ut,Uc as Ne,Ud as Br,V as Vc,Va as T,Vc as Fe,Wa as P,Wb as Qe,Wd as qc,Y as Rc,Yc as Be,Za as bo,Zb as Ae,Zc as y,Zd as J,_c as de,bb as Bc,db as Ci,eb as On,ec as M,f as Ze,fb as be,fc as Lr,fd as Vi,g as bm,gd as q,h as sn,hc as c,hd as Nr,ic as nt,id as ue,ja as Nc,jc as cn,jd as fi,kc as zc,kd as Fr,lc as gt,ma as me,oc as $c,od as tt,pd as wt,q as Oc,qd as _n,r as Ic,ra as Bt,rd as Ia,sa as rr,tc as r,uc as s,ud as Re,vc as b,wc as ot,x as Mc,xa as Jt,xc as rt,y as Ec,ya as Fc,yc as In,zc as U}from"./chunk-7RQO36LL.js";import{a as Tt,b as Bi}from"./chunk-IGDKMAHN.js";import"./chunk-2EFPAZRG.js";import"./chunk-XHJ7RZ2T.js";import"./chunk-DMQT3QOG.js";import"./chunk-43G5BLPL.js";
3import"./chunk-GCEDPD4V.js";import"./chunk-YUF7ANVY.js";import{a as pe,b as Di,h as Cm,j as Mr,l as Er,m as I}from"./chunk-7Q6MBNO6.js";var wh=Cm((ic,nc)=>{(function(i,u){typeof ic=="object"&&typeof nc<"u"?nc.exports=u():typeof define=="function"&&define.amd?define(u):(i=typeof globalThis<"u"?globalThis:i||self).introJs=u();})(ic,function(){"use strict";function i(){i=function(){return C;};var C={},l=Object.prototype,g=l.hasOwnProperty,w=Object.defineProperty||function(oe,X,ve){oe[X]=ve.value;},E=typeof Symbol=="function"?Symbol:{},L=E.iterator||"@@iterator",B=E.asyncIterator||"@@asyncIterator",K=E.toStringTag||"@@toStringTag";function ne(oe,X,ve){return Object.defineProperty(oe,X,{value:ve,enumerable:!0,configurable:!0,writable:!0}),oe[X];}try{ne({},"");}catch{ne=function(X,ve,$e){return X[ve]=$e;};}function Se(oe,X,ve,$e){var Me=X&&X.prototype instanceof le?X:le,_t=Object.create(Me.prototype),Gt=new Tn($e||[]);return w(_t,"_invoke",{value:wn(oe,ve,Gt)}),_t;}function De(oe,X,ve){try{return{type:"normal",arg:oe.call(X,ve)};}catch($e){return{type:"throw",arg:$e};}}C.wrap=Se;var z={};function le(){}function fe(){}function Xe(){}var dt={};ne(dt,L,function(){return this;});var kt=Object.getPrototypeOf,Mt=kt&&kt(kt(Pn([])));Mt&&Mt!==l&&g.call(Mt,L)&&(dt=Mt);var ui=Xe.prototype=le.prototype=Object.create(dt);function gi(oe){["next","throw","return"].forEach(function(X){ne(oe,X,function(ve){return this._invoke(X,ve);});});}function on(oe,X){function ve(Me,_t,Gt,Pi){var Oi=De(oe[Me],oe,_t);if(Oi.type!=="throw"){var _o=Oi.arg,or=_o.value;return or&&typeof or=="object"&&g.call(or,"__await")?X.resolve(or.__await).then(function(io){ve("next",io,Gt,Pi);},function(io){ve("throw",io,Gt,Pi);}):X.resolve(or).then(function(io){_o.value=io,Gt(_o);},function(io){return ve("throw",io,Gt,Pi);});}Pi(Oi.arg);}var $e;w(this,"_invoke",{value:function(Me,_t){function Gt(){return new X(function(Pi,Oi){ve(Me,_t,Pi,Oi);});}return $e=$e?$e.then(Gt,Gt):Gt();}});}function wn(oe,X,ve){var $e="suspendedStart";return function(Me,_t){if($e==="executing")throw new Error("Generator is already running");if($e==="completed"){if(Me==="throw")throw _t;return rn();}for(ve.method=Me,ve.arg=_t;;){var Gt=ve.delegate;if(Gt){var Pi=to(Gt,ve);if(Pi){if(Pi===z)continue;return Pi;}}if(ve.method==="next")ve.sent=ve._sent=ve.arg;else if(ve.method==="throw"){if($e==="suspendedStart")throw $e="completed",ve.arg;ve.dispatchException(ve.arg);}else ve.method==="return"&&ve.abrupt("return",ve.arg);$e="executing";var Oi=De(oe,X,ve);if(Oi.type==="normal"){if($e=ve.done?"completed":"suspendedYield",Oi.arg===z)continue;return{value:Oi.arg,done:ve.done};}Oi.type==="throw"&&($e="completed",ve.method="throw",ve.arg=Oi.arg);}};}function to(oe,X){var ve=X.method,$e=oe.iterator[ve];if($e===void 0)return X.delegate=null,ve==="throw"&&oe.iterator.return&&(X.method="return",X.arg=void 0,to(oe,X),X.method==="throw")||ve!=="return"&&(X.method="throw",X.arg=new TypeError("The iterator does not provide a '"+ve+"' method")),z;var Me=De($e,oe.iterator,X.arg);if(Me.type==="throw")return X.method="throw",X.arg=Me.arg,X.delegate=null,z;var _t=Me.arg;return _t?_t.done?(X[oe.resultName]=_t.value,X.next=oe.nextLoc,X.method!=="return"&&(X.method="next",X.arg=void 0),X.delegate=null,z):_t:(X.method="throw",X.arg=new TypeError("iterator result is not an object"),X.delegate=null,z);}function Ir(oe){var X={tryLoc:oe[0]};1 in oe&&(X.catchLoc=oe[1]),2 in oe&&(X.finallyLoc=oe[2],X.afterLoc=oe[3]),this.tryEntries.push(X);}function vo(oe){var X=oe.completion||{};X.type="normal",delete X.arg,oe.completion=X;}function Tn(oe){this.tryEntries=[{tryLoc:"root"}],oe.forEach(Ir,this),this.reset(!0);}function Pn(oe){if(oe){var X=oe[L];if(X)return X.call(oe);if(typeof oe.next=="function")return oe;if(!isNaN(oe.length)){var ve=-1,$e=function Me(){for(;++ve<oe.length;)if(g.call(oe,ve))return Me.value=oe[ve],Me.done=!1,Me;return Me.value=void 0,Me.done=!0,Me;};return $e.next=$e;}}return{next:rn};}function rn(){return{value:void 0,done:!0};}return fe.prototype=Xe,w(ui,"constructor",{value:Xe,configurable:!0}),w(Xe,"constructor",{value:fe,configurable:!0}),fe.displayName=ne(Xe,K,"GeneratorFunction"),C.isGeneratorFunction=function(oe){var X=typeof oe=="function"&&oe.constructor;return!!X&&(X===fe||(X.displayName||X.name)==="GeneratorFunction");},C.mark=function(oe){return Object.setPrototypeOf?Object.setPrototypeOf(oe,Xe):(oe.__proto__=Xe,ne(oe,K,"GeneratorFunction")),oe.prototype=Object.create(ui),oe;},C.awrap=function(oe){return{__await:oe};},gi(on.prototype),ne(on.prototype,B,function(){return this;}),C.AsyncIterator=on,C.async=function(oe,X,ve,$e,Me){Me===void 0&&(Me=Promise);var _t=new on(Se(oe,X,ve,$e),Me);return C.isGeneratorFunction(X)?_t:_t.next().then(function(Gt){return Gt.done?Gt.value:_t.next();});},gi(ui),ne(ui,K,"Generator"),ne(ui,L,function(){return this;}),ne(ui,"toString",function(){return"[object Generator]";}),C.keys=function(oe){var X=Object(oe),ve=[];for(var $e in X)ve.push($e);return ve.reverse(),function Me(){for(;ve.length;){var _t=ve.pop();if(_t in X)return Me.value=_t,Me.done=!1,Me;}return Me.done=!0,Me;};},C.values=Pn,Tn.prototype={constructor:Tn,reset:function(oe){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEac
3h(vo),!oe)for(var X in this)X.charAt(0)==="t"&&g.call(this,X)&&!isNaN(+X.slice(1))&&(this[X]=void 0);},stop:function(){this.done=!0;var oe=this.tryEntries[0].completion;if(oe.type==="throw")throw oe.arg;return this.rval;},dispatchException:function(oe){if(this.done)throw oe;var X=this;function ve(Oi,_o){return _t.type="throw",_t.arg=oe,X.next=Oi,_o&&(X.method="next",X.arg=void 0),!!_o;}for(var $e=this.tryEntries.length-1;$e>=0;--$e){var Me=this.tryEntries[$e],_t=Me.completion;if(Me.tryLoc==="root")return ve("end");if(Me.tryLoc<=this.prev){var Gt=g.call(Me,"catchLoc"),Pi=g.call(Me,"finallyLoc");if(Gt&&Pi){if(this.prev<Me.catchLoc)return ve(Me.catchLoc,!0);if(this.prev<Me.finallyLoc)return ve(Me.finallyLoc);}else if(Gt){if(this.prev<Me.catchLoc)return ve(Me.catchLoc,!0);}else{if(!Pi)throw new Error("try statement without catch or finally");if(this.prev<Me.finallyLoc)return ve(Me.finallyLoc);}}}},abrupt:function(oe,X){for(var ve=this.tryEntries.length-1;ve>=0;--ve){var $e=this.tryEntries[ve];if($e.tryLoc<=this.prev&&g.call($e,"finallyLoc")&&this.prev<$e.finallyLoc){var Me=$e;break;}}Me&&(oe==="break"||oe==="continue")&&Me.tryLoc<=X&&X<=Me.finallyLoc&&(Me=null);var _t=Me?Me.completion:{};return _t.type=oe,_t.arg=X,Me?(this.method="next",this.next=Me.finallyLoc,z):this.complete(_t);},complete:function(oe,X){if(oe.type==="throw")throw oe.arg;return oe.type==="break"||oe.type==="continue"?this.next=oe.arg:oe.type==="return"?(this.rval=this.arg=oe.arg,this.method="return",this.next="end"):oe.type==="normal"&&X&&(this.next=X),z;},finish:function(oe){for(var X=this.tryEntries.length-1;X>=0;--X){var ve=this.tryEntries[X];if(ve.finallyLoc===oe)return this.complete(ve.completion,ve.afterLoc),vo(ve),z;}},catch:function(oe){for(var X=this.tryEntries.length-1;X>=0;--X){var ve=this.tryEntries[X];if(ve.tryLoc===oe){var $e=ve.completion;if($e.type==="throw"){var Me=$e.arg;vo(ve);}return Me;}}throw new Error("illegal catch attempt");},delegateYield:function(oe,X,ve){return this.delegate={iterator:Pn(oe),resultName:X,nextLoc:ve},this.method==="next"&&(this.arg=void 0),z;}},C;}function u(C){return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l;}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l;},u(C);}function e(C,l,g,w,E,L,B){try{var K=C[L](B),ne=K.value;}catch(Se){return void g(Se);}K.done?l(ne):Promise.resolve(ne).then(w,E);}function n(C){return function(){var l=this,g=arguments;return new Promise(function(w,E){var L=C.apply(l,g);function B(ne){e(L,w,E,B,K,"next",ne);}function K(ne){e(L,w,E,B,K,"throw",ne);}B(void 0);});};}function t(C,l){if(!(C instanceof l))throw new TypeError("Cannot call a class as a function");}function o(C,l){for(var g=0;g<l.length;g++){var w=l[g];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(C,te(w.key),w);}}function h(C,l,g){return l&&o(C.prototype,l),g&&o(C,g),Object.defineProperty(C,"prototype",{writable:!1}),C;}function k(C,l,g){return(l=te(l))in C?Object.defineProperty(C,l,{value:g,enumerable:!0,configurable:!0,writable:!0}):C[l]=g,C;}function f(C,l){return function(g){if(Array.isArray(g))return g;}(C)||function(g,w){var E=g==null?null:typeof Symbol<"u"&&g[Symbol.iterator]||g["@@iterator"];if(E!=null){var L,B,K,ne,Se=[],De=!0,z=!1;try{if(K=(E=E.call(g)).next,w===0){if(Object(E)!==E)return;De=!1;}else for(;!(De=(L=K.call(E)).done)&&(Se.push(L.value),Se.length!==w);De=!0);}catch(le){z=!0,B=le;}finally{try{if(!De&&E.return!=null&&(ne=E.return(),Object(ne)!==ne))return;}finally{if(z)throw B;}}return Se;}}(C,l)||m(C,l)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 4In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);}();}function m(C,l){if(C){if(typeof C=="string")return v(C,l);var g=Object.prototype.toString.call(C).slice(8,-1);return g==="Object"&&C.constructor&&(g=C.constructor.name),g==="Map"||g==="Set"?Array.from(C):g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g)?v(C,l):void 0;}}function v(C,l){(l==null||l>C.length)&&(l=C.length);for(var g=0,w=new Array(l);g<l;g++)w[g]=C[g];return w;}function V(C,l){var g=typeof Symbol<"u"&&C[Symbol.iterator]||C["@@iterator"];if(!g){if(Array.isArray(C)||(g=m(C))||l&&C&&typeof C.length=="number"){g&&(C=g);var w=0,E=function(){};return{s:E,n:function(){return w>=C.length?{done:!0}:{done:!1,value:C[w++]};},e:function(ne){throw ne;},f:E};}throw new TypeError(`Invalid attempt to iterate non-iterable instance. 5In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);}var L,B=!0,K=!1;return{s:function(){g=g.call(C);},n:function(){var ne=g.next();return B=ne.done,ne;},e:function(ne){K=!0,L=ne;},f:function(){try{B||g.return==null||g.return();}finally{if(K)throw L;}}};}function te(C){var l=function(g,w){if(typeof g!="object"||g===null)return g;var E=g[Symbol.toPrimitive];if(E!==void 0){var L=E.call(g,w||"default");if(typeof L!="object")return L;throw new TypeError("@@toPrimitive must return a primitive value.");}return(w==="string"?String:Number)(g);}(C,"string");return typeof l=="symbol"?l:String(l);}function $(C,l,g){var w,E=(k(w={},C,l),k(w,"path","/"),k(w,"expires",void 0),w);if(g){var L=new Date();L.setTime(L.getTime()+24*g*60*60*1e3),E.expires=L.toUTCString();}var B=[];for(var K in E)B.push("".concat(K,"=").concat(E[K]));return document.cookie=B.join("; "),H(C);}function H(C){return(l={},document.cookie.split(";").forEach(function(g){var w=f(g.split("="),2),E=w[0],L=w[1];l[E.trim()]=L;}),l)[C];var l;}var j="true";function F(C,l){l?$(C._options.dontShowAgainCookie,j,C._options.dontShowAgainCookieDays):$(C._options.dontShowAgainCookie,"",-1);}var Z,N=(Z={},function(C){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"introjs-stamp";return Z[l]=Z[l]||0,C[l]===void 0&&(C[l]=Z[l]++),C[l];}),Q=new(function(){function C(){t(this,C),k(this,"events_key","introjs_event");}return h(C,[{key:"_id",value:function(l,g,w){return l+N(g)+(w?"_".concat(N(w)):"");}},{key:"on",value:function(l,g,w,E,L){var B=this._id(g,w,E),K=function(ne){return w(E||l,ne||window.event);};"addEventListener"in l?l.addEventListener(g,K,L):"attachEvent"in l&&l.attachEvent("on".concat(g),K),l[this.events_key]=l[this.events_key]||{},l[this.events_key][B]=K;}},{key:"off",value:function(l,g,w,E,L){var B=this._id(g,w,E),K=l[this.events_key]&&l[this.events_key][B];K&&("removeEventListener"in l?l.removeEventListener(g,K,L):"detachEvent"in l&&l.detachEvent("on".concat(g),K),l[this.events_key][B]=null);}}]),C;}())(),W=function(C){return typeof C=="function";};function O(C,l){if(C instanceof SVGElement){var g=C.getAttribute("class")||"";g.match(l)||C.setAttribute("class","".concat(g," ").concat(l));}else if(C.classList!==void 0){var w,E=V(l.split(" "));try{for(E.s();!(w=E.n()).done;){var L=w.value;C.classList.add(L);}}catch(B){E.e(B);}finally{E.f();}}else C.className.match(l)||(C.className+=" ".concat(l));}function D(C,l){var g="";return"currentStyle"in C?g=C.currentStyle[l]:document.defaultView&&document.defaultView.getComputedStyle&&(g=document.defaultView.getComputedStyle(C,null).getPropertyValue(l)),g&&g.toLowerCase?g.toLowerCase():g;}function ie(C){O(C,"introjs-showElement");var l=D(C,"position");
5l!=="absolute"&&l!=="relative"&&l!=="sticky"&&l!=="fixed"&&O(C,"introjs-relativePosition");}function Te(C,l){if(C){var g=function(w){var E=window.getComputedStyle(w),L=E.position==="absolute",B=/(auto|scroll)/;if(E.position==="fixed")return document.body;for(var K=w;K=K.parentElement;)if(E=window.getComputedStyle(K),(!L||E.position!=="static")&&B.test(E.overflow+E.overflowY+E.overflowX))return K;return document.body;}(l);g!==document.body&&(g.scrollTop=l.offsetTop-g.offsetTop);}}function Ee(){if(window.innerWidth!==void 0)return{width:window.innerWidth,height:window.innerHeight};var C=document.documentElement;return{width:C.clientWidth,height:C.clientHeight};}function je(C,l,g,w,E){var L;if(l!=="off"&&C&&(L=l==="tooltip"?E.getBoundingClientRect():w.getBoundingClientRect(),!function(K){var ne=K.getBoundingClientRect();return ne.top>=0&&ne.left>=0&&ne.bottom+80<=window.innerHeight&&ne.right<=window.innerWidth;}(w))){var B=Ee().height;L.bottom-(L.bottom-L.top)<0||w.clientHeight>B?window.scrollBy(0,L.top-(B/2-L.height/2)-g):window.scrollBy(0,L.top-(B/2-L.height/2)+g);}}function Ke(C){C.setAttribute("role","button"),C.tabIndex=0;}function Ft(C){var l=C.parentElement;return!(!l||l.nodeName==="HTML")&&(D(C,"position")==="fixed"||Ft(l));}function Wt(C,l){var g=document.body,w=document.documentElement,E=window.pageYOffset||w.scrollTop||g.scrollTop,L=window.pageXOffset||w.scrollLeft||g.scrollLeft;l=l||g;var B=C.getBoundingClientRect(),K=l.getBoundingClientRect(),ne=D(l,"position"),Se={width:B.width,height:B.height};return l.tagName.toLowerCase()!=="body"&&ne==="relative"||ne==="sticky"?Object.assign(Se,{top:B.top-K.top,left
5:B.left-K.left}):Ft(C)?Object.assign(Se,{top:B.top,left:B.left}):Object.assign(Se,{top:B.top+E,left:B.left+L});}function Ai(C,l){if(C instanceof SVGElement){var g=C.getAttribute("class")||"";C.setAttribute("class",g.replace(l,"").replace(/^\s+|\s+$/g,""));}else C.className=C.className.replace(l,"").replace(/^\s+|\s+$/g,"");}function _(C,l){var g="";if(C.style.cssText&&(g+=C.style.cssText),typeof l=="string")g+=l;else for(var w in l)g+="".concat(w,":").concat(l[w],";");C.style.cssText=g;}function R(C,l,g){if(g&&l){var w=Wt(l.element,C._targetElement),E=C._options.helperElementPadding;l.element instanceof Element&&Ft(l.element)?O(g,"introjs-fixedTooltip"):Ai(g,"introjs-fixedTooltip"),l.position==="floating"&&(E=0),_(g,{width:"".concat(w.width+E,"px"),height:"".concat(w.height+E,"px"),top:"".concat(w.top-E/2,"px"),left:"".concat(w.left-E/2,"px")});}}function re(C,l,g,w,E){return C.left+l+g.width>w.width?(E.style.left="".concat(w.width-g.width-C.left,"px"),!1):(E.style.left="".concat(l,"px"),!0);}function ce(C,l,g,w){return C.left+C.width-l-g.width<0?(w.style.left="".concat(-C.left,"px"),!1):(w.style.right="".concat(l,"px"),!0);}function ge(C,l){C.includes(l)&&C.splice(C.indexOf(l),1);}function ye(C,l,g,w){var E=C.slice(),L=Ee(),B=Wt(g).height+10,K=Wt(g).width+20,ne=l.getBoundingClientRect(),Se="floating";if(ne.bottom+B>L.height&&ge(E,"bottom"),ne.top-B<0&&ge(E,"top"),ne.right+K>L.width&&ge(E,"right"),ne.left-K<0&&ge(E,"left"),w&&(w=w.split("-")[0]),E.length&&(Se=E[0],E.includes(w)&&(Se=w)),Se==="top"||Se==="bottom"){var De,z=[];Se==="top"?(De="top-middle-aligned",z=["top-left-aligned","top-middle-aligned","top-right-aligned"]):(De="bottom-middle-aligned",z=["bottom-left-aligned","bottom-middle-aligned","bottom-right-aligned"]),Se=function(le,fe,Xe,dt){var kt=fe/2,Mt=Math.min(Xe,window.screen.width);return Mt-le<fe&&(ge(dt,"top-left-aligned"),ge(dt,"bottom-left-aligned")),(le<kt||Mt-le<kt)&&(ge(dt,"top-middle-aligned"),ge(dt,"bottom-middle-aligned")),le<fe&&(ge(dt,"top-right-aligned"),ge(dt,"bottom-right-aligned")),dt.length?dt[0]:null;}(ne.left,K,L.width,z)||De;}return Se;}function vt(C,l,g,w){var E=arguments.length>4&&arguments[4]!==void 0&&arguments[4];if(l){var L,B,K,ne,Se="";g.style.top="",g.style.right="",g.style.bottom="",g.style.left="",g.style.marginLeft="",g.style.marginTop="",w.style.display="inherit",Se=typeof l.tooltipClass=="string"?l.tooltipClass:C._options.tooltipClass,g.className=["introjs-tooltip",Se].filter(Boolean).join(" "),g.setAttribute("role","dialog"),(ne=l.position)!=="floating"&&C._options.autoPosition&&(ne=ye(C._options.positionPrecedence,l.element,g,ne)),B=Wt(l.element),L=Wt(g),K=Ee(),O(g,"introjs-".concat(ne));var De=B.width/2-L.width/2;switch(ne){case"top-right-aligned":w.className="introjs-arrow bottom-right";var z=0;ce(B,z,L,g),g.style.bottom="".concat(B.height+20,"px");break;case"top-middle-aligned":w.className="introjs-arrow bottom-middle",E&&(De+=5),ce(B,De,L,g)&&(g.style.right="",re(B,De,L,K,g)),g.style.bottom="".concat(B.height+20,"px");break;case"top-left-aligned":case"top":w.className="introjs-arrow bottom",re(B,E?0:15,L,K,g),g.style.bottom="".concat(B.height+20,"px");break;case"right":g.style.left="".concat(B.width+20,"px"),B.top+L.height>K.height?(w.className="introjs-arrow left-bottom",g.style.top="-".concat(L.height-B.height-20,"px")):w.className="introjs-arrow left";break;case"left":E||C._options.showStepNumbers!==!0||(g.style.top="15px"),B.top+L.height>K.height?(g.style.top="-".concat(L.height-B.height-20,"px"),w.className="introjs-arrow right-bottom"):w.className="introjs-arrow right",g.style.right="".concat(B.width+20,"px");break;case"floating":w.style.display="none",g.style.left="50%",g.style.top="50%",g.style.marginLeft="-".concat(L.width/2,"px"),g.style.marginTop="-".concat(L.height/2,"px");break;case"bottom-right-aligned":w.className="introjs-arrow top-right",ce(B,z=0,L,g),g.style.top="".concat(B.height+20,"px");break;case"bottom-middle-aligned":w.className="introjs-arrow top-middle",E&&(De+=5),ce(B,De,L,g)&&(g.style.right="",re(B,De,L,K,g)),g.style.top="".concat(B.height+20,"px");break;default:w.className="introjs-arrow top",re(B,0,L,K,g),g.style.top="".concat(B.height+20,"px");}}}function Ct(){for(var C=0,l=Array.from(document.querySelectorAll(".introjs-showElement"));C<l.length;C++)Ai(l[C],/introjs-[a-zA-Z]+/g);}function Ve(C,l){var g=document.createElement(C);l=l||{};var w=/^(?:role|data-|aria-)/;for(var E in l){var L=l[E];E==="style"&&typeof L!="function"?_(g,L):typeof L=="string"&&E.match(w)?g.setAttribute(E,L):g[E]=L;}return g;}function jt(C,l){var g=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(g){var w=l.style.opacity||"1";_(l,{opacity:"0"}),window.setTimeout(function(){_(l,{opacity:w});},10);}C.appendChild(l);}function nn(C,l){return(C+1)/l*100;}function Sa(C,l){var g=document.querySelector(".introjs-disableInteraction");g===null&&(g=Ve("div",{className:"introjs-disableInteraction"}),C._targetElement.appendChild(g)),R(C,l,g);}function kr(C,l){var g=Ve("div",{className:"introjs-bullets"});C._options.showBullets===!1&&(g.style.display="none");var w=Ve("ul");w.setAttribute("role","tablist");for(var E=function(){var Se=this.getAttribute("data-step-number");
5Se!=null&&C.goToStep(parseInt(Se,10));},L=0;L<C._introItems.length;L++){var B=C._introItems[L].step,K=Ve("li"),ne=Ve("a");K.setAttribute("role","presentation"),ne.setAttribute("role","tab"),ne.onclick=E,L===l.step-1&&(ne.className="active"),Ke(ne),ne.innerHTML=" ",ne.setAttribute("data-step-number",B.toString()),K.appendChild(ne),w.appendChild(K);}return g.appendChild(w),g;}function wr(C,l,g){if(C){var w=l.querySelector(".introjs-bullets li > a.active"),E=l.querySelector('.introjs-bullets li > a[data-step-number="'.concat(g.step,'"]'));w&&E&&(w.className="",E.className="active");}}function x(C){var l=Ve("div");l.className="introjs-progress",C._options.showProgress===!1&&(l.style.display="none");var g=Ve("div",{className:"introjs-progressbar"});C._options.progressBarAdditionalClass&&(g.className+=" "+C._options.progressBarAdditionalClass);var w=nn(C._currentStep,C._introItems.length);return g.setAttribute("role","progress"),g.setAttribute("aria-valuemin","0"),g.setAttribute("aria-valuemax","100"),g.setAttribute("aria-valuenow",w.toString()),g.style.cssText="width:".concat(w,"%;"),l.appendChild(g),l;}function A(C,l,g){var w=C.querySelector(".introjs-progress .introjs-progressbar");if(w){var E=nn(l,g);w.style.cssText="width:".concat(E,"%;"),w.setAttribute("aria-valuenow",E.toString());}}function Y(C,l){return ee.apply(this,arguments);}function ee(){return(ee=n(i().mark(function C(l,g){var w,E,L,B,K,ne,Se,De,z,le,fe,Xe,dt,kt,Mt,ui,gi,on,wn,to,Ir,vo,Tn,Pn;return i().wrap(function(rn){for(;;)switch(rn.prev=rn.next){case 0:if(!W(l._introChangeCallback)){rn.next=3;break;}return rn.next=3,l._introChangeCallback.call(l,g.element);case 3:if(w=document.querySelector(".introjs-helperLayer"),E=document.querySelector(".introjs-tooltipReferenceLayer"),L="introjs-helperLayer",typeof g.highlightClass=="string"&&(L+=" ".concat(g.highlightClass)),typeof l._options.highlightClass=="string"&&(L+=" ".concat(l._options.highlightClass)),w!==null&&E!==null?(Se=E.querySelector(".introjs-helperNumberLayer"),De=E.querySelector(".introjs-tooltiptext"),z=E.querySelector(".introjs-tooltip-title"),le=E.querySelector(".introjs-arrow"),fe=E.querySelector(".introjs-tooltip"),ne=E.querySelector(".introjs-skipbutton"),K=E.querySelector(".introjs-prevbutton"),B=E.querySelector(".introjs-nextbutton"),w.className=L,fe.style.opacity="0",fe.style.display="none",Te(l._options.scrollToElement,g.element),R(l,g,w),R(l,g,E),Ct(),l._lastShowElementTimer&&window.clearTimeout(l._lastShowElementTimer),l._lastShowElementTimer=window.setTimeout(function(){Se!==null&&(Se.innerHTML="".concat(g.step," ").concat(l._options.stepNumbersOfLabel," ").concat(l._introItems.length)),De.innerHTML=g.intro||"",z.innerHTML=g.title||"",fe.style.display="block",vt(l,g,fe,le),wr(l._options.showBullets,E,g),A(E,l._currentStep,l._introItems.length),fe.style.opacity="1",(B!=null&&/introjs-donebutton/gi.test(B.className)||B!=null)&&B.focus(),je(l._options.scrollToElement,g.scrollTo,l._options.scrollPadding,g.element,De);},350)):(Xe=Ve("div",{className:L}),dt=Ve("div",{className:"introjs-tooltipReferenceLayer"}),kt=Ve("div",{className:"introjs-arrow"}),Mt=Ve("div",{className:"introjs-tooltip"}),ui=Ve("div",{className:"introjs-tooltiptext"}),gi=Ve("div",{className:"introjs-tooltip-header"}),on=Ve("h1",{className:"introjs-tooltip-title"}),wn=Ve("div"),_(Xe,{"box-shadow":"0 0 1px 2px rgba(33, 33, 33, 0.8), rgba(33, 33, 33, ".concat(l._options.overlayOpacity.toString(),") 0 0 0 5000px")}),Te(l._options.scrollToElement,g.element),R(l,g,Xe),R(l,g,dt),jt(l._targetElement,Xe,!0),jt(l._targetElement,dt),ui.innerHTML=g.intro,on.innerHTML=g.title,wn.className="introjs-tooltipbuttons",l._options.showButtons===!1&&(wn.style.display="none"),gi.appendChild(on),Mt.appendChild(gi),Mt.appendChild(ui),l._options.dontShowAgain&&(to=Ve("div",{className:"introjs-dontShowAgain"}),(Ir=Ve("input",{type:"checkbox",id:"introjs-dontShowAgain",name:"introjs-dontShowAgain"})).onchange=function(oe){l.setDontShowAgain(oe.target.checked);},(vo=Ve("label",{htmlFor:"introjs-dontShowAgain"})).innerText=l._options.dontShowAgainLabel,to.appendChild(Ir),to.appendChild(vo),Mt.appendChild(to)),Mt.appendChild(kr(l,g)),Mt.appendChild(x(l)),Tn=Ve("div"),l._options.showStepNumbers===!0&&(Tn.className="introjs-helper
5NumberLayer",Tn.innerHTML="".concat(g.step," ").concat(l._options.stepNumbersOfLabel," ").concat(l._introItems.length),Mt.appendChild(Tn)),Mt.appendChild(kt),dt.appendChild(Mt),(B=Ve("a")).onclick=n(i().mark(function oe(){return i().wrap(function(X){for(;;)switch(X.prev=X.next){case 0:if(l._introItems.length-1===l._currentStep){X.next=5;break;}return X.next=3,bt(l);case 3:X.next=11;break;case 5:if(!/introjs-donebutton/gi.test(B.className)){X.next=11;break;}if(!W(l._introCompleteCallback)){X.next=9;break;}return X.next=9,l._introCompleteCallback.call(l,l._currentStep,"done");case 9:return X.next=11,eo(l,l._targetElement);case 11:case"end":return X.stop();}},oe);})),Ke(B),B.innerHTML=l._options.nextLabel,(K=Ve("a")).onclick=n(i().mark(function oe(){return i().wrap(function(X){for(;;)switch(X.prev=X.next){case 0:if(!(l._currentStep>0)){X.next=3;break;}return X.next=3,Tr(l);case 3:case"end":return X.stop();}},oe);})),Ke(K),K.innerHTML=l._options.prevLabel,Ke(ne=Ve("a",{className:"introjs-skipbutton"})),ne.innerHTML=l._options.skipLabel,ne.onclick=n(i().mark(function oe(){return i().wrap(function(X){for(;;)switch(X.prev=X.next){case 0:if(l._introItems.length-1!==l._currentStep||!W(l._introCompleteCallback)){X.next=3;break;}return X.next=3,l._introCompleteCallback.call(l,l._currentStep,"skip");case 3:if(!W(l._introSkipCallback)){X.next=6;break;}return X.next=6,l._introSkipCallback.call(l,l._currentStep);case 6:return X.next=8,eo(l,l._targetElement);case 8:case"end":return X.stop();}},oe);})),gi.appendChild(ne),l._introItems.length>1&&wn.appendChild(K),wn.appendChild(B),Mt.appendChild(wn),vt(l,g,Mt,kt),je(l._options.scrollToElement,g.scrollTo,l._options.scrollPadding,g.element,Mt)),(Pn=l._targetElement.querySelector(".introjs-disableInteraction"))&&Pn.parentNode&&Pn.parentNode.removeChild(Pn),g.disableInteraction&&Sa(l,g),l._currentStep===0&&l._introItems.length>1?(B!=null&&(B.className="".concat(l._options.buttonClass," introjs-nextbutton"),B.innerHTML=l._options.nextLabel),l._options.hidePrev===!0?(K!=null&&(K.className="".concat(l._options.buttonClass," introjs-prevbutton introjs-hidden")),B!=null&&O(B,"introjs-fullbutton")):K!=null&&(K.className="".concat(l._options.buttonClass," introjs-prevbutton introjs-disabled"))):l._introItems.length-1===l._currentStep||l._introItems.length===1?(K!=null&&(K.className="".concat(l._options.buttonClass," introjs-prevbutton")),l._options.hideNext===!0?(B!=null&&(B.className="".concat(l._options.buttonClass," introjs-nextbutton introjs-hidden")),K!=null&&O(K,"introjs-fullbutton")):B!=null&&(l._options.nextToDone===!0?(B.innerHTML=l._options.doneLabel,O(B,"".concat(l._options.buttonClass," introjs-nextbutton introjs-donebutton"))):B.className="".concat(l._options.buttonClass," introjs-nextbutton introjs-disabled"))):(K!=null&&(K.className="".concat(l._options.buttonClass," introjs-prevbutton")),B!=null&&(B.className="".concat(l._options.buttonClass," introjs-nextbutton"),B.innerHTML=l._options.nextLabel)),K?.setAttribute("role","button"),B?.setAttribute("role","button"),ne?.setAttribute("role","button"),B?.focus(),ie(g.element),!W(l._introAfterChangeCallback)){rn.next=21;break;}return rn.next=21,l._introAfterChangeCallback.call(l,g.element);case 21:case"end":return rn.stop();}},C);}))).apply(this,arguments);}function Ce(C,l){return ke.apply(this,arguments);}function ke(){return(ke=n(i().mark(function C(l,g){return i().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:if(l._currentStep=g-2,l._introItems===void 0){w.next=4;break;}return w.next=4,bt(l);case 4:case"end":return w.stop();}},C);}))).apply(this,arguments);}function ze(C,l){return it.apply(this,arguments);}function it(){return(it=n(i().mark(function C(l,g){return i().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:if(l._currentStepNumber=g,l._introItems===void 0){w.next=4;break;}return w.next=4,bt(l);case 4:case"end":return w.stop();}},C);}))).apply(this,arguments);}function bt(C){return ir.apply(this,arguments);}function ir(){return ir=n(i().mark(function C(l){var g,w,E;return i().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:if(l._direction="forward",l._currentStepNumber!==void 0)for(g=0;g<l._introItems.length;g++)l._introItems[g].step===l._currentStepNumber&&(l._currentStep=g-1,l._currentStepNumber=void 0);if(l._currentStep===-1?l._currentStep=0:++l._currentStep,w=l._introItems[l._currentStep],E=!0,!W(l._introBeforeChangeCallback)){L.next=9;break;}return L.next=8,l._introBeforeChangeCallback.call(l,w&&w.element,l._currentStep,l._direction);case 8:E=L.sent;case 9:if(E!==!1){L.next=12;break;}return--l._currentStep,L.abrupt("return",!1);case 12:if(!(l._introItems.length<=l._currentStep)){L.next=19;break;}if(!W(l._introCompleteCallback)){L.next=16;break;}return L.next=16,l._introCompleteCallback.call(l,l._currentStep,"end");case 16:return L.next=18,eo(l,l._targetElement);case 18:return L.abrupt("return",!1);case 19:return L.next=21,Y(l,w);case 21:return L.abrupt("return",!0);case 22:case"end":return L.stop();}},C);})),ir.apply(this,arguments);}function Tr(C){return xa.apply(this,arguments);}function xa(){return xa=n(i().mark(function C(l){var g,w;return i().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:if(l._direction="backward",!(l._currentStep<=0)){E.next=3;break;}return E.abrupt("return",!1);case 3:if(--l._currentStep,g=l._introItems[l._currentStep],w=!0,!W(l._introBeforeChangeCallback)){E.next=10;break;}return E.next=9,l._introBeforeChangeCallback.call(l,g&&g.element,l._currentStep,l._direction);case 9:w=E.sent;case 10:if(w!==!1){E.next=13;break;}return++l._currentStep,E.abrupt("return",!1);case 13:return E.next=15,Y(l,g);case 15:return E.abrupt("return",!0);case 16:case"end":return E.stop();}},C);})),xa.apply(this,arguments);}function dc(C,l){return pc.apply(this,arguments);}function pc(){return(pc=n(i().mark(function C(l,g){var w,E;return i().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:if((w=g.code===void 0?g.which:g.code)===null&&(w=g.charCode===null?g.keyCode:g.charCode),w!=="Escape"&&w!==27||l._options.exitOnEsc!==!0){L.next=7;break;}return L.next=5,eo(l,l._targetElement);case 5:L.next=39;break;case 7:if(w!=="ArrowLeft"&&w!==37){L.next=12;break;}return L.next=10,Tr(l);case 10:L.next=39;break;case 12:if(w!=="ArrowRight"&&w!==39){L.next=17;break;}return L.next=15,bt(l);case 15:L.next=39;break;case 17:if(w!=="Enter"&&w!=="NumpadEnter"&&w!==13){L.next=39;break;}if(!(E=g.target||g.srcElement)||!E.className.match("introjs-prevbutton")){L.next=24;break;}return L.next=22,Tr(l);case 22:L.next=38;break;case 24:if(!E||!E.className.match("introjs-skipbutton")){L.next=32;break;}if(l._introItems.length-1!==l._currentStep||!W(l._introCompleteCallback)){L.next=28;break;}return L.next=28,l._introCompleteCallback.call(l,l._currentStep,"skip");case 28:return L.next=30,eo(l,l._targetElement);case 30:L.next=38;break;case 32:if(!E||!E.getAttribute("data-step-number")){L.next=36;break;}E.click(),L.next=38;break;case 36:return L.next=38,bt(l);case 38:g.preventDefault?g.preventDefault():g.returnValue=!1;case 39:case"end":return L.stop();}},C);}))).apply(this,arguments);}function ya(C){if(C===null||u(C)!=="object"||"nodeType"in C)return C;var l={};for(var g in C)"jQuery"in window&&C[g]instanceof window.jQuery?l[g]=C[g]:l[g]=ya(C[g]);return l;}function mm(C,l){var g;return function(){for(var w=arguments.length,E=new Array(w),L=0;L<w;L++)E[L]=arguments[L];window.clearTimeout(g),g=window.setTimeout(function(){C(E);},l);};}function fo(C){var l=document.querySelector(".introjs-hints");return l?Array.from(l.querySelectorAll(C)):[];}function ka(C,l){return hc.apply(this,arguments);}
5function hc(){return(hc=n(i().mark(function C(l,g){var w;return i().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:if(w=fo('.introjs-hint[data-step="'.concat(g,'"]'))[0],Pr(),w&&O(w,"introjs-hidehint"),!W(l._hintCloseCallback)){E.next=6;break;}return E.next=6,l._hintCloseCallback.call(l,g);case 6:case"end":return E.stop();}},C);}))).apply(this,arguments);}function um(C){return mc.apply(this,arguments);}function mc(){return(mc=n(i().mark(function C(l){var g,w,E,L,B;return i().wrap(function(K){for(;;)switch(K.prev=K.next){case 0:g=fo(".introjs-hint"),w=V(g),K.prev=2,w.s();case 4:if((E=w.n()).done){K.next=13;break;}if(L=E.value,B=L.getAttribute("data-step")){K.next=9;break;}return K.abrupt("continue",11);case 9:return K.next=11,ka(l,parseInt(B,10));case 11:K.next=4;break;case 13:K.next=18;break;case 15:K.prev=15,K.t0=K.catch(2),w.e(K.t0);case 18:return K.prev=18,w.f(),K.finish(18);case 21:case"end":return K.stop();}},C,null,[[2,15,18,21]]);}))).apply(this,arguments);}function gm(C){return uc.apply(this,arguments);}function uc(){return(uc=n(i().mark(function C(l){var g,w,E,L,B;return i().wrap(function(K){for(;;)switch(K.prev=K.next){case 0:if(!(g=fo(".introjs-hint"))||!g.length){K.next=23;break;}w=V(g),K.prev=3,w.s();case 5:if((E=w.n()).done){K.next=13;break;}if(L=E.value,B=L.getAttribute("data-step")){K.next=10;break;}return K.abrupt("continue",11);case 10:gc(parseInt(B,10));case 11:K.next=5;break;case 13:K.next=18;break;case 15:K.prev=15,K.t0=K.catch(3),w.e(K.t0);case 18:return K.prev=18,w.f(),K.finish(18);case 21:K.next=25;break;case 23:return K.next=25,Sc(l,l._targetElement);case 25:case"end":return K.stop();}},C,null,[[3,15,18,21]]);}))).apply(this,arguments);}function gc(C){var l=fo('.introjs-hint[data-step="'.concat(C,'"]'))[0];l&&Ai(l,/introjs-hidehint/g);}function fc(C){var l=fo('.introjs-hint[data-step="'.concat(C,'"]'))[0];l&&l.parentNode&&l.parentNode.removeChild(l);}function fm(C){return vc.apply(this,arguments);}function vc(){return(vc=n(i().mark(function C(l){var g,w,E,L,B,K,ne;return i().wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:(g=document.querySelector(".introjs-hints"))===null&&(g=Ve("div",{className:"introjs-hints"})),w=function(De){return function(z){var le=z||window.event;le&&le.stopPropagation&&le.stopPropagation(),le&&le.cancelBubble!==null&&(le.cancelBubble=!0),Cc(l,De);};},E=0;case 4:if(!(E<l._hintItems.length)){Se.next=25;break;}if(L=l._hintItems[E],!document.querySelector('.introjs-hint[data-step="'.concat(E,'"]'))){Se.next=8;break;}return Se.abrupt("return");case 8:Ke(B=Ve("a",{className:"introjs-hint"})),B.onclick=w(E),L.hintAnimation||O(B,"introjs-hint-no-anim"),Ft(L.element)&&O(B,"introjs-fixedhint"),K=Ve("div",{className:"introjs-hint-dot"}),ne=Ve("div",{className:"introjs-hint-pulse"}),B.appendChild(K),B.appendChild(ne),B.setAttribute("data-step",E.toString()),L.hintTargetElement=L.element,L.element=B,_c(L.hintPosition,B,L.hintTargetElement),g.appendChild(B);case 22:E++,Se.next=4;break;case 25:if(document.body.appendChild(g),!W(l._hintsAddedCallback)){Se.next=29;break;}return Se.next=29,l._hintsAddedCallback.call(l);case 29:l._options.hintAutoRefreshInterval>=0&&(l._hintsAutoRefreshFunction=mm(function(){return Or(l);},l._options.hintAutoRefreshInterval),Q.on(window,"scroll",l._hintsAutoRefreshFunction,l,!0));case 30:case"end":return Se.stop();}},C);}))).apply(this,arguments);}function _c(C,l,g){if(g!==void 0){var w=Wt(g),E=20,L=20;switch(C){default:case"top-left":l.style.left="".concat(w.left,"px"),l.style.top="".concat(w.top,"px");break;case"top-right":l.style.left="".concat(w.left+w.width-E,"px"),l.style.top="".concat(w.top,"px");break;case"bottom-left":l.style.left="".concat(w.left,"px"),l.style.top="".concat(w.top+w.height-L,"px");break;case"bottom-right":l.style.left="".concat(w.left+w.width-E,"px"),l.style.top="".concat(w.top+w.height-L,"px");break;case"middle-left":l.style.left="".concat(w.left,"px"),l.style.top="".concat(w.top+(w.height-L)/2,"px");break;case"middle-right":l.style.left="".concat(w.left+w.width-E,"px"),l.style.top="".concat(w.top+(w.height-L)/2,"px");break;case"middle-middle":l.style.left="".concat(w.left+(w.width-E)/2,"px"),l.style.top="".concat(w.top+(w.height-L)/2,"px");break;case"bottom-middle":l.style.left="".concat(w.left+(w.width-E)/2,"px"),l.style.top="".concat(w.top+w.height-L,"px");break;case"top-middle":l.style.left="".concat(w.left+(w.width-E)/2,"px"),l.style.top="".concat(w.top,"px");}}}function Cc(C,l){return bc.apply(this,arguments);}function bc(){return(bc=n(i().mark(function C(l,g){var w,E,L,B,K,ne,Se,De,z,le,fe;return i().wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:if(w=document.querySelector('.introjs-hint[data-step="'.concat(g,'"]')),E=l._hintItems[g],!W(l._hintClickCallback)){Xe.next=5;break;}return Xe.next=5,l._hintClickCallback.call(l,w,E,g);case 5:if((L=Pr())===void 0||parseInt(L,10)!==g){Xe.next=8;break;}return Xe.abrupt("return");case 8:B=Ve("div",{className:"introjs-tooltip"}),K=Ve("div"),ne=Ve("div"),Se=Ve("div"),B.onclick=function(dt){dt.stopPropagation?dt.stopPropagation():dt.cancelBubble=!0;}
5,K.className="introjs-tooltiptext",(De=Ve("p")).innerHTML=E.hint||"",K.appendChild(De),l._options.hintShowButton&&((z=Ve("a")).className=l._options.buttonClass,z.setAttribute("role","button"),z.innerHTML=l._options.hintButtonLabel,z.onclick=function(){return ka(l,g);},K.appendChild(z)),ne.className="introjs-arrow",B.appendChild(ne),B.appendChild(K),le=w.getAttribute("data-step")||"",l._currentStep=parseInt(le,10),fe=l._hintItems[l._currentStep],Se.className="introjs-tooltipReferenceLayer introjs-hintReference",Se.setAttribute("data-step",le),R(l,fe,Se),Se.appendChild(B),document.body.appendChild(Se),vt(l,fe,B,ne,!0);case 30:case"end":return Xe.stop();}},C);}))).apply(this,arguments);}function Pr(){var C=document.querySelector(".introjs-hintReference");if(C&&C.parentNode){var l=C.getAttribute("data-step");return l?(C.parentNode.removeChild(C),l):void 0;}}function Sc(C,l){return xc.apply(this,arguments);}function xc(){return(xc=n(i().mark(function C(l,g){var w,E,L,B,K,ne,Se,De,z,le;return i().wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:if(l._hintItems=[],!(l._options.hints&&l._options.hints.length>0)){fe.next=6;break;}w=V(l._options.hints);try{for(w.s();!(E=w.n()).done;)L=E.value,typeof(B=ya(L)).element=="string"&&(B.element=document.querySelector(B.element)),B.hintPosition=B.hintPosition||l._options.hintPosition,B.hintAnimation=B.hintAnimation||l._options.hintAnimation,B.element!==null&&l._hintItems.push(B);}catch(Xe){w.e(Xe);}finally{w.f();}fe.next=10;break;case 6:if((K=Array.from(g.querySelectorAll("*[data-hint]")))&&K.length){fe.next=9;break;}return fe.abrupt("return",!1);case 9:for(ne=0,Se=K;ne<Se.length;ne++)De=Se[ne],z=De.getAttribute("data-hint-animation"),le=l._options.hintAnimation,z&&(le=z==="true"),l._hintItems.push({element:De,hint:De.getAttribute("data-hint")||"",hintPosition:De.getAttribute("data-hint-position")||l._options.hintPosition,hintAnimation:le,tooltipClass:De.getAttribute("data-tooltip-class")||void 0,position:De.getAttribute("data-position")||l._options.tooltipPosition});case 10:return fe.next=12,fm(l);case 12:return Q.on(document,"click",Pr,l,!1),Q.on(window,"resize",Or,l,!0),fe.abrupt("return",!0);case 15:case"end":return fe.stop();}},C);}))).apply(this,arguments);}function Or(C){var l,g=V(C._hintItems);try{for(g.s();!(l=g.n()).done;){var w=l.value,E=w.hintTargetElement;_c(w.hintPosition,w.element,E);}}catch(L){g.e(L);}finally{g.f();}}function yc(C,l){var g=Array.from(l.querySelectorAll("*[data-intro]")),w=[];if(C._options.steps&&C._options.steps.length){var E,L=V(C._options.steps);try{for(L.s();!(E=L.n()).done;){var B=ya(E.value);if(B.step=w.length+1,B.title=B.title||"",typeof B.element=="string"&&(B.element=document.querySelector(B.element)||void 0),B.element===void 0||B.element===null){var K=document.querySelector(".introjsFloatingElement");K===null&&(K=Ve("div",{className:"introjsFloatingElement"}),document.body.appendChild(K)),B.element=K,B.position="floating";}B.position=B.position||C._options.tooltipPosition,B.scrollTo=B.scrollTo||C._options.scrollTo,B.disableInteraction===void 0&&(B.disableInteraction=C._options.disableInteraction),B.element!==null&&w.push(B);}}catch(gi){L.e(gi);}finally{L.f();}}else{var ne;if(g.length<1)return[];var Se,De=V(g);try{for(De.s();!(Se=De.n()).done;){var z=Se.value;if((!C._options.group||z.getAttribute("data-intro-group")===C._options.group)&&z.style.display!=="none"){var le=parseInt(z.getAttribute("data-step")||"",10);ne=C._options.disableInteraction,z.hasAttribute("data-disable-interaction")&&(ne=!!z.getAttribute("data-disable-interaction")),le>0&&(w[le-1]={step:le,element:z,title:z.getAttribute("data-title")||"",intro:z.getAttribute("data-intro")||"",tooltipClass:z.getAttribute("data-tooltip-class")||void 0,highlightClass:z.getAttribute("data-highlight-class")||void 0,position:z.getAttribute("data-position")||C._options.tooltipPosition,scrollTo:z.getAttribute("data-scroll-to")||C._options.scrollTo,disableInteraction:ne});}}}catch(gi){De.e(gi);}finally{De.f();}var fe,Xe=0,dt=V(g);try{for(dt.s();!(fe=dt.n()).done;){var kt=fe.value;if((!C._options.group||kt.getAttribute("data-intro-group")===C._options.group)&&kt.getAttribute("data-step")===null){for(;w[Xe]!==void 0;)Xe++;ne=kt.hasAttribute("data-disable-interaction")?!!kt.getAttribute("data-disable-interaction"):C._options.disableInteraction,w[Xe]={element:kt,title:kt.getAttribute("data-title")||"",intro:kt.getAttribute("data-intro")||"",step:Xe+1,tooltipClass:kt.getAttribute("data-tooltip-class")||void 0,highlightClass:kt.getAttribute("data-highlight-class")||void 0,position:kt.getAttribute("data-position")||C._options.tooltipPosition,scrollTo:kt.getAttribute("data-scroll-to")||C._options.scrollTo,disableInteraction:ne};}}}catch(gi){dt.e(gi);}finally{dt.f();}}
5for(var Mt=[],ui=0;ui<w.length;ui++)w[ui]&&Mt.push(w[ui]);return(w=Mt).sort(function(gi,on){return gi.step-on.step;}),w;}function kc(C,l){var g=C._currentStep;if(g!=null&&g!=-1){var w=C._introItems[g],E=document.querySelector(".introjs-tooltipReferenceLayer"),L=document.querySelector(".introjs-helperLayer"),B=document.querySelector(".introjs-disableInteraction");R(C,w,L),R(C,w,E),R(C,w,B),l&&(C._introItems=yc(C,C._targetElement),function(Se,De){if(Se._options.showBullets){var z=document.querySelector(".introjs-bullets");z&&z.parentNode&&z.parentNode.replaceChild(kr(Se,De),z);}}(C,w),A(E,g,C._introItems.length));var K=document.querySelector(".introjs-arrow"),ne=document.querySelector(".introjs-tooltip");return ne&&K&&vt(C,C._introItems[g],ne,K),Or(C),C;}}function wc(C){kc(C);}function nr(C){var l=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(C&&C.parentElement){var g=C.parentElement;l?(_(C,{opacity:"0"}),window.setTimeout(function(){try{g.removeChild(C);}catch{}},500)):g.removeChild(C);}}function eo(C,l){return wa.apply(this,arguments);}function wa(){return wa=n(i().mark(function C(l,g){var w,E,L,B,K,ne=arguments;return i().wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:if(w=ne.length>2&&ne[2]!==void 0&&ne[2],E=!0,l._introBeforeExitCallback===void 0){Se.next=6;break;}return Se.next=5,l._introBeforeExitCallback.call(l,g);case 5:E=Se.sent;case 6:if(w||E!==!1){Se.next=8;break;}return Se.abrupt("return");case 8:if((L=Array.from(g.querySelectorAll(".introjs-overlay")))&&L.length){B=V(L);try{for(B.s();!(K=B.n()).done;)nr(K.value);}catch(De){B.e(De);}finally{B.f();}}if(nr(g.querySelector(".introjs-helperLayer"),!0),nr(g.querySelector(".introjs-tooltipReferenceLayer")),nr(g.querySelector(".introjs-disableInteraction")),nr(document.querySelector(".introjsFloatingElement")),Ct(),Q.off(window,"keydown",dc,l,!0),Q.off(window,"resize",wc,l,!0),!W(l._introExitCallback)){Se.next=24;break;}return Se.next=24,l._introExitCallback.call(l);case 24:l._currentStep=-1;case 25:case"end":return Se.stop();}},C);})),wa.apply(this,arguments);}function vm(C,l){var g=Ve("div",{className:"introjs-overlay"});return _(g,{top:0,bottom:0,left:0,right:0,position:"fixed"}),l.appendChild(g),C._options.exitOnOverlayClick===!0&&(_(g,{cursor:"pointer"}),g.onclick=n(i().mark(function w(){return i().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return E.next=2,eo(C,l);case 2:case"end":return E.stop();}},w);}))),!0;}function _m(C,l){return Tc.apply(this,arguments);}function Tc(){return(Tc=n(i().mark(function C(l,g){var w;return i().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:if(l.isActive()){E.next=2;break;}return E.abrupt("return",!1);case 2:if(!W(l._introStartCallback)){E.next=5;break;}return E.next=5,l._introStartCallback.call(l,g);case 5:if((w=yc(l,g)).length!==0){E.next=8;break;}return E.abrupt("return",!1);case 8:return l._introItems=w,vm(l,g),E.next=12,bt(l);case 12:g.addEventListener,l._options.keyboardNavigation&&Q.on(window,"keydown",dc,l,!0),Q.on(window,"resize",wc,l,!0);case 15:return E.abrupt("return",!1);case 16:case"end":return E.stop();}},C);}))).apply(this,arguments);}function Pc(C,l,g){return C[l]=g,C;}var Ta=function(){function C(z){t(this,C),k(this,"_currentStep",-1),k(this,"_currentStepNumber",void 0),k(this,"_direction",void 0),k(this,"_targetElement",void 0),k(this,"_introItems",[]),k(this,"_hintItems",[]),k(this,"_options",void 0),k(this,"_introBeforeChangeCallback",void 0),k(this,"_introChangeCallback",void 0),k(this,"_introAfterChangeCallback",void 0),k(this,"_introCompleteCallback",void 0),k(this,"_introStartCallback",void 0),k(this,"_introExitCallback",void 0),k(this,"_introSkipCallback",void 0),k(this,"_introBeforeExitCallback",void 0),k(this,"_hintsAddedCallback",void 0),k(this,"_hintClickCallback",void 0),k(this,"_hintCloseCallback",void 0),k(this,"_lastShowElementTimer",void 0),k(this,"_hintsAutoRefreshFunction",void 0),this._targetElement=z,this._options={steps:[],hints:[],isActive:!0,nextLabel:"Next",prevLabel:"Back",skipLabel:"\xD7",doneLabel:"Done",hidePrev:!1,hideNext:!1,nextToDone:!0,tooltipPosition:"bottom",tooltipClass:"",group:"",highlightClass:"",exitOnEsc:!0,exitOnOverlayClick:!0,showStepNumbers:!1,stepNumbersOfLabel:"of",keyboardNavigation:!0,showButtons:!0,showBullets:!0,showProgress:!1,scrollToElement:!0,scrollTo:"element",scrollPadding:30,overlayOpacity:.5,autoPosition:!0,positionPrecedence:["bottom","top","right","left"],disableInteraction:!1,dontShowAgain:!1,dontShowAgainLabel:"Don't show this again",dontShowAgainCookie:"introjs-dontShowAgain",dontShowAgainCookieDays:365,helperElementPadding:10,hintPosition:"top-middle",hintButtonLabel:"Got it",hintShowButton:!0,hintAutoRefreshInterval:10,hintAnimation:!0,buttonClass:"introjs-button",progressBarAdditionalClass:!1}
5;}var l,g,w,E,L,B,K,ne,Se,De;return h(C,[{key:"isActive",value:function(){return(!this._options.dontShowAgain||(z=H(this._options.dontShowAgainCookie))===""||z!==j)&&this._options.isActive;var z;}},{key:"clone",value:function(){return new C(this._targetElement);}},{key:"setOption",value:function(z,le){return this._options=Pc(this._options,z,le),this;}},{key:"setOptions",value:function(z){return this._options=function(le,fe){for(var Xe=0,dt=Object.entries(fe);Xe<dt.length;Xe++){var kt=f(dt[Xe],2);le=Pc(le,kt[0],kt[1]);}return le;}(this._options,z),this;}},{key:"start",value:(De=n(i().mark(function z(){return i().wrap(function(le){for(;;)switch(le.prev=le.next){case 0:return le.next=2,_m(this,this._targetElement);case 2:return le.abrupt("return",this);case 3:case"end":return le.stop();}},z,this);})),function(){return De.apply(this,arguments);})},{key:"goToStep",value:(Se=n(i().mark(function z(le){return i().wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,Ce(this,le);case 2:return fe.abrupt("return",this);case 3:case"end":return fe.stop();}},z,this);})),function(z){return Se.apply(this,arguments);})},{key:"addStep",value:function(z){return this._options.steps||(this._options.steps=[]),this._options.steps.push(z),this;}},{key:"addSteps",value:function(z){if(!z.length)return this;for(var le=0;le<z.length;le++)this.addStep(z[le]);return this;}},{key:"goToStepNumber",value:(ne=n(i().mark(function z(le){return i().wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,ze(this,le);case 2:return fe.abrupt("return",this);case 3:case"end":return fe.stop();}},z,this);})),function(z){return ne.apply(this,arguments);})},{key:"nextStep",value:(K=n(i().mark(function z(){return i().wrap(function(le){for(;;)switch(le.prev=le.next){case 0:return le.next=2,bt(this);case 2:return le.abrupt("return",this);case 3:case"end":return le.stop();}},z,this);})),function(){return K.apply(this,arguments);})},{key:"previousStep",value:(B=n(i().mark(function z(){return i().wrap(function(le){for(;;)switch(le.prev=le.next){case 0:return le.next=2,Tr(this);case 2:return le.abrupt("return",this);case 3:case"end":return le.stop();}},z,this);})),function(){return B.apply(this,arguments);})},{key:"currentStep",value:function(){return this._currentStep;}},{key:"exit",value:(L=n(i().mark(function z(le){return i().wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,eo(this,this._targetElement,le);case 2:return fe.abrupt("return",this);case 3:case"end":return fe.stop();}},z,this);})),function(z){return L.apply(this,arguments);})},{key:"refresh",value:function(z){return kc(this,z),this;}},{key:"setDontShowAgain",value:function(z){return F(this,z),this;}},{key:"onbeforechange",value:function(z){if(!W(z))throw new Error("Provided callback for onbeforechange was not a function");return this._introBeforeChangeCallback=z,this;}},{key:"onchange",value:function(z){if(!W(z))throw new Error("Provided callback for onchange was not a function.");return this._introChangeCallback=z,this;}},{key:"onafterchange",value:function(z){if(!W(z))throw new Error("Provided callback for onafterchange was not a function");return this._introAfterChangeCallback=z,this;}},{key:"oncomplete",value:function(z){if(!W(z))throw new Error("Provided callback for oncomplete was not a function.");return this._introCompleteCallback=z,this;}},{key:"onhintsadded",value:function(z){if(!W(z))throw new Error("Provided callback for onhintsadded was not a function.");return this._hintsAddedCallback=z,this;}},{key:"onhintclick",value:function(z){if(!W(z))throw new Error("Provided callback for onhintclick was not a function.");return this._hintClickCallback=z,this;}},{key:"onhintclose",value:function(z){if(!W(z))throw new Error("Provided callback for onhintclose was not a function.");return this._hintCloseCallback=z,this;}},{key:"onstart",value:function(z){if(!W(z))throw new Error("Provided callback for onstart was not a function.");return this._introStartCallback=z,this;}},{key:"onexit",value:function(z){if(!W(z))throw new Error("Provided callback for onexit was not a function.");return this._introExitCallback=z,this;}},{key:"onskip",value:function(z){if(!W(z))throw new Error("Provided callback for onskip was not a function.");return this._introSkipCallback=z,this;}},{key:"onbeforeexit",value:function(z){if(!W(z))throw new Error("Provided callback for onbeforeexit was not a function.");return this._introBeforeExitCallback=z,this;}},{key:"addHints",value:function(){var z=n(i().mark(function le(){return i().wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,Sc(this,this._targetElement);case 2:return fe.abrupt("return",this);case 3:case"end":return fe.stop();}},le,this);}));return function(){return z.apply(this,arguments);};}()},{key:"hideHint",value:(E=n(i().mark(function z(le){return i().wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,ka(this,le);case 2:return fe.abrupt("return",this);case 3:case"end":return fe.stop();}},z,this);})),function(z){return E.apply(this,arguments);})},{key:"hideHints",value:(w=n(i().mark(function z(){return i().wrap(function(le){for(;;)switch(le.prev=le.next){case 0:return le.next=2,um(this);case 2:return le.abrupt("return",this);case 3:case"end":return le.stop();}},z,this);})),function(){return w.apply(this,arguments);})},{key:"showHint",value:function(z){return gc(z),this;}},{key:"showHints",value:(g=n(i().mark(function z(){return i().wrap(function(le){for(;;)switch(le.prev=le.next){case 0:return le.next=2,gm(this);case 2:return le.abrupt("return",this);case 3:case"end":return le.stop();}},z,this);})),function(){return g.apply(this,arguments);})},{key:"removeHints",value:function(){return function(z){var le,fe=V(fo(".introjs-hint"));try{for(fe.s();!(le=fe.n()).done;){var Xe=le.value.getAttribute("data-step");Xe&&fc(parseInt(Xe,10));}}
5catch(dt){fe.e(dt);}finally{fe.f();}Q.off(document,"click",Pr,z,!1),Q.off(window,"resize",Or,z,!0),z._hintsAutoRefreshFunction&&Q.off(window,"scroll",z._hintsAutoRefreshFunction,z,!0);}(this),this;}},{key:"removeHint",value:function(z){return fc(z),this;}},{key:"showHintDialog",value:(l=n(i().mark(function z(le){return i().wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,Cc(this,le);case 2:return fe.abrupt("return",this);case 3:case"end":return fe.stop();}},z,this);})),function(z){return l.apply(this,arguments);})}]),C;}(),Pa=function C(l){var g;if(u(l)==="object")g=new Ta(l);else if(typeof l=="string"){var w=document.querySelector(l);if(!w)throw new Error("There is no element with given selector.");g=new Ta(w);}else g=new Ta(document.body);return C.instances[N(g,"introjs-instance")]=g,g;};return Pa.version="7.2.0",Pa.instances={},Pa;});});ln();var Hs=class{constructor(u,e,n,t){this.active=!1,this.id=u,this.tag=e,this.contentData={script:n},this.active=t;}},At=function(i){return i.scriptRewrite="script-rewrite",i.readOnly="read-only",i.goLive="go-live",i.scriptChecker="script-checker",i.whiteboard="whiteboard",i.share="share",i.avatar="avatar",i.voiceGenerate="voice-generate",i.agentSuggestion="agent-suggestion",i.bannerAvatarAdd="banner-avatar-add",i.bannerAvatarRemove="banner-avatar-remove",i.bannerAvatarEdit="banner-avatar-edit",i.bannerAvatarGenerate="banner-avatar-generate",i.scriptAgent="script-agent",i.save="save",i.tipClickIos="tip-click-ios",i.tipClickAndroid="tip-click-android",i.tipDismiss="tip-dismiss",i.record="record",i.redo="redo",i.undo="undo",i.back="back",i;}(At||{});Ni();J();ae();Aa();Ln();J();ae();J();ae();var Um=["extra"],Hm=["extraNested"],zm=i=>({"submenu-top":i});function $m(i,u){i&1&&b(0,"img",11);}function Wm(i,u){if(i&1&&b(0,"div",12),i&2){let e=p(2).$implicit;c("ngClass",e.sideIconClass);}}function Gm(i,u){if(i&1){let e=U();r(0,"div",8),S("click",function(){T(e);let t=p().$implicit,o=p();return P(o.handleOptionClick(t,!1));}),M(1,$m,1,0,"img",9)(2,Wm,1,1,"ng-template",null,0,Re),r(4,"div",10),y(5),s()();}if(i&2){let e=Be(3),n=p().$implicit;a(),c("ngIf",!n.sideIconClass)("ngIfElse",e),a(4),se(" ",n.name," ");}}function qm(i,u){i&1&&b(0,"img",11);}function Km(i,u){if(i&1&&b(0,"div",12),i&2){let e=p(2).$implicit;c("ngClass",e.sideIconClass);}}function Qm(i,u){if(i&1){let e=U();r(0,"div",20),S("click",function(){let t=T(e).$implicit,o=p(4);return P(o.handleOptionClick(t,!0));}),r(1,"div",13)(2,"div",10),y(3),s()()();}if(i&2){let e=u.$implicit;a(3),se(" ",e.name," ");}}function Ym(i,u){if(i&1){let e=U();r(0,"div",17),S("mouseleave",function(){T(e);let t=p(3);return P(t.handleOptionHoverLeave());}),r(1,"div",18),In(2,4),s(),M(3,Qm,4,1,"div",19),s();}if(i&2){let e=p(2).$implicit,n=p();c("ngClass",ue(3,zm,n.openNestedMenuUp)),a(2),c("ngTemplateOutlet",n.extraNestedTemplateRef),a(),c("ngForOf",e.children);}}function Jm(i,u){if(i&1&&(r(0,"div",13)(1,"div",14),M(2,qm,1,0,"img",9)(3,Km,1,1,"ng-template",null,0,Re),r(5,"div",10),y(6),s()(),b(7,"img",15),M(8,Ym,4,5,"div",16),s()),i&2){let e=Be(4),n=p().$implicit,t=p();a(2),c("ngIf",!n.sideIconClass)("ngIfElse",e),a(4),se(" ",n.name," "),a(2),c("ngIf",t.selectedOption===n);}}function Xm(i,u){if(i&1){let e=U();r(0,"div",5),S("mouseenter",function(){let t=T(e).$implicit,o=p();return P(o.handleOptionHover(t));})("mouseleave",function(){T(e);let t=p();return P(t.handleOptionHoverLeave());}),M(1,Gm,6,3,"div",6)(2,Jm,9,4,"div",7),s();}if(i&2){let e=u.$implicit;a(),c("ngIf",!(!(e==null||e.children==null)&&e.children.length)>0),a(),c("ngIf",(e==null||e.children==null?null:e.children.length)>0);}}var zs=(()=>{class i{constructor(){this.options=[],this.isVisible=!1,this.leftPosition=0,this.topPosition=0,this.openNestedMenuUp=!0,this.onOptionSelected=new be(),this.selectedOption=null,this.handleOptionHoverLeave=()=>{this.selectedOption=null;};}handleOptionClick(e,n){this.onOptionSelected.emit({option:e,subOption:n});}handleOptionHover(e){e?.children?.length>0?this.selectedOption=e:this.selectedOption=null;}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["app-nested-menu"]],contentQueries:function(n,t,o){if(n&1&&(ar(o,Um,5,sr),ar(o,Hm,5,sr)),n&2){let h;Ne(h=Fe())&&(t.extraTemplateRef=h.first),Ne(h=Fe())&&(t.extraNestedTemplateRef=h.first);}},inputs:{options:"options",isVisible:"isVisible",leftPosition:"leftPosition",topPosition:"topPosition",openNestedMenuUp:"openNestedMenuUp"},outputs:{onOptionSelected:"onOptionSelected"},standalone:!0,features:[q],decls:4,vars:8,consts:[["sideIcon",""],[1,"customMenu"],[1,"menu-ul"],["class","menu-li",3,"mouseenter","mouseleave",4,"ngFor","ngForOf"],[3,"ngTemplateOutlet"],[1,"menu-li",3,"mouseenter","mouseleave"],["class","item",3,"click",4,"ngIf"],["class","item",4,"ngIf"],[1,"item",3,"click"],["src","/img/script-story-v2/popup-rewrite-option.svg","alt","option",4,"ngIf","ngIfElse"],[1,"item-txt"],["src","/img/script-story-v2/popup-rewrite-option.svg","alt","option"],[3,"ngClass"],[1,"item"],[1,"item-nested"],["src","/img/script-story-v2/nested-drop.svg","alt","sub-option",1,"nested-img"],["class","submenu",3,"ngClass","mouseleave",4,"ngIf"],[1,"submenu",3,"mouseleave","ngClass"],[1,"menu-li"],["class","menu-li",3,"click",4,"ngFor","ngForOf"],[1,"menu-li",3,"click"]],template:function(n,t){n&1&&(r(0,"div",1)(1,"div",2),M(2,Xm,3,2,"div",3),In(3,4),s()()),n&2&&(nt("display",t.isVisible?"block":"none")("left",t.leftPosition,"px")("top",t.topPosition,"px"),a(2),c("ngForOf",t.options),a(),c("ngTemplateOutlet",t.extraTemplateRef));},dependencies:[xe,we,Le,_e,Po],styles:[".customMenu[_ngcontent-%COMP%]{position:absolute;background-color:#fff;box-shadow:0 0 40px #0000001a;z-index:1000;width:280px;padding:12px 0;border-radius:10px}.customMenu[_ngcontent-%COMP%] .menu-ul[_ngcontent-%COMP%]{padding:0;margin:0;width:100%}.customMenu[_ngcontent-%COMP%] .menu-li[_ngcontent-%COMP%]{position:relative}.submenu[_ngcontent-%COMP%] .menu-li[_ngcontent-%COMP%]:hover, .customMenu[_ngcontent-%COMP%] .menu-li[_ngcontent-%COMP%]:hover{background:#4481fd14}.submenu[_ngcontent-%COMP%]{width:280px;padding:12px 0;position:absolute;top:0;left:100%;display:none;background-color:#fff;box-shadow:0 0 40px #0000001a;border-radius:10px}.submenu-top[_ngcontent-%COMP%]{top:unset;bottom:0}.customMenu[_ngcontent-%COMP%] .menu-li[_ngcontent-%COMP%]:hover .submenu[_ngcontent-%COMP%]{display:block}.menu-li[_ngcontent-%COMP%]{cursor:pointer}.menu-li[_ngcontent-%COMP%]:not(:last-child){border-bottom:1px solid rgba(123,141,177,.3)}.item[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:12px;padding:10px 16px}.item-nested[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:12px}.item-txt[_ngcontent-%COMP%]{font-size:14px;font-weight:400}.item[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:24px;height:24px}.nested-img[_ngcontent-%COMP%]{width:14px!important;height:14px!important}"]});}}return i;})();J();ae();Cn();J();ht();qt();Zi();ae();var Zm=["extra"],eu=i=>({disabled:i});function tu(i,u){if(i&1&&(r(0,"div",11),y(1),s()),i&2){let e=p();a(),se(" ",e.rewritedText," ");}}function iu(i,u){if(i&1&&(r(0,"div",12)(1,"section",13)(2,"div",14),y(3," Creating the perfect text... "),s(),r(4,"div",15),y(5," Please wait... "),s()(),r(6,"div",16),b(7,"lottie-loader",17),s()()),i&2){let e=p();a(7),c("path",e.LOTTIE_SOURCE_PATH);}}var qa=(()=>{class i{constructor(e,n,t,o,h){this.aiScriptService=e,this.storyTrackCommunicationService=n,this.eventsService=t,this.notifier=o,this.creditsService=h,this.LOTTIE_SOURCE_PATH="/assets/ai-assistance.json",this.leftPosition=0,this.topPosition=0,this.userIsLim
5ited=!1,this.checkLimits=new be(),this.changeVisability=new be(),this.onUpsell=new be(),this.isVisible=!1,this.eventListeners=[],this.applyRewritedText=()=>{this.sendEvent(this.eventsService.events.script.aiScriptRewriteOutputClick,{button:"replace"}),this.storyTrackCommunicationService.setPopupUpdateScriptTrack(this.allText),this.close(!1);},this.retry=()=>{this.sendEvent(this.eventsService.events.script.aiScriptRewriteOutputClick,{button:"retry"}),this.canRewrite?this.generateScript(this.lastPopupData,!0):(this.isVisible=!1,this.changeVisability.emit(!1),this.onUpsell.emit());},this.generateScript=(k,f=!1)=>I(this,null,function*(){try{this.lastPopupData=k,this.rewritedText=k.rewriteText,this.allText=k.allText,this.isLoading=!0,this.isVisible=!0,this.changeVisability.emit(!0);let m=yield this.aiScriptService.generateScriptRewrite(k);m&&(m[0].stop_reason=="stop"||m[0].stop_reason=="unknown")&&(this.rewritedText=m[0].text,this.allText=k.allText.replace(k.rewriteText,this.rewritedText),this.sendEvent(this.eventsService.events.script.aiScriptRewriteOutput,{isRetry:f,input:k.rewriteText,output:this.rewritedText})),this.userIsLimited&&this.checkLimits.emit();}catch(m){if(console.error(m),this.creditsService.handleCreditError(m)){this.isVisible=!1,this.changeVisability.emit(!1);return;}this.notifier.error("An error occurred while generating your script. Please try again.");}finally{this.isLoading=!1;}}),this.copyText=()=>I(this,null,function*(){this.sendEvent(this.eventsService.events.script.aiScriptRewriteOutputClick,{button:"copy"});try{yield window.navigator.clipboard.writeText(this.allText),this.notifier.info("Copied to clipboard");}catch{this.notifier.error("Failed to copy your data to clipboard");}}),this.close=(k=!0)=>{k&&this.sendEvent(this.eventsService.events.script.aiScriptRewriteOutputClick,{button:"cancel"}),this.isVisible=!1,this.changeVisability.emit(!1);},this.sendEvent=(k,f)=>{let m={storyId:this.story.storyId,request:this.lastPopupData.rewriteType===un.changeTone?`${this.lastPopupData.rewriteType}-my brand tone`:`${this.lastPopupData.rewriteType}`};this.eventsService.log(k,pe(pe({},m),f));};}ngOnInit(){this.eventListeners.push(this.storyTrackCommunicationService.observePopupRewrite().subscribe(e=>this.generateScript(e)));}ngOnDestroy(){this.eventListeners.forEach(e=>e.unsubscribe());}static{this.ɵfac=function(n){return new(n||i)(d(Ti),d(He),d(Pe),d(Ge),d(Vt));};}static{this.ɵcmp=G({type:i,selectors:[["app-rewrite-script-dialog"]],contentQueries:function(n,t,o){if(n&1&&ar(o,Zm,5,sr),n&2){let h;Ne(h=Fe())&&(t.extraTemplateRef=h.first);}},inputs:{leftPosition:"leftPosition",topPosition:"topPosition",userIsLimited:"userIsLimited",canRewrite:"canRewrite",isLoading:"isLoading",story:"story"},outputs:{checkLimits:"checkLimits",changeVisability:"changeVisability",onUpsell:"onUpsell"},standalone:!0,features:[q],decls:16,vars:11,consts:[["loadingTemplate",""],[1,"rewrite-popup",3,"hidden"],["class","text-part",4,"ngIf","ngIfElse"],[1,"control-part",3,"ngClass"],[1,"controls"],[1,"control-btn",3,"click"],["src","/img/script-story-v2/close-rewrite.svg","alt","remove"],["src","/img/script-story-v2/retry-rewrite.svg","alt","generate"],[3,"ngTemplateOutlet"],["src","/img/script-story-v2/copy-rewrite.svg","alt","copy"],[1,"replace-btn",3,"click"],[1,"text-part"],[1,"loading-container"],[1,"loading-text-container"],[1,"sub-title-black"],[1,"sub-title-black-small"],[1,"loading-container-lottie"],[3,"path"]],template:function(n,t){if(n&1){let o=U();r(0,"div",1),M(1,tu,2,1,"div",2),r(2,"div",3)(3,"div",4)(4,"button",5),S("click",function(){return T(o),P(t.close());}),b(5,"img",6),s(),r(6,"button",5),S("click",function(){return T(o),P(t.retry());}),b(7,"img",7),s(),In(8,8),s(),r(9,"div",4)(10,"button",5),S("click",function(){return T(o),P(t.copyText());}),b(11,"img",9),s(),r(12,"button",10),S("click",function(){return T(o),P(t.applyRewritedText());}),y(13," Replace "),s()()()(),M(14,iu,8,1,"ng-template",null,0,Re);}if(n&2){let o=Be(15);nt("left",t.leftPosition,"px")("top",t.topPosition,"px"),c("hidden",!t.isVisible),a(),c("ngIf",!t.isLoading)("ngIfElse",o),a(),c("ngClass",ue(9,eu,t.isLoading||!t.isVisible)),a(6),c("ngTemplateOutlet",t.extraTemplateRef);}},dependencies:[xe,we,_e,Po,Ri],styles:[".rewrite-popup[_ngcontent-%COMP%]{width:548px;border-radius:20px;border:1px solid rgba(123,141,177,.3);background:#fff;padding:24px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:16px;position:absolute;z-index:1000}.text-part[_ngcontent-%COMP%]{width:100%;height:176px;max-height:176px;overflow-y:scroll;color:#253658;font-size:16px;font-weight:400;line-height:22px;white-space:pre-line;padding-right:8px}.loading-container[_ngcontent-%COMP%]{width:100%;height:176px;max-height:176px;display:flex;align-items:center;justify-content:center;gap:24px}.loading-container-lottie[_ngcontent-%COMP%]{height:176px;
5width:200px;position:relative} .loading-container-lottie ng-lottie div{width:100%!important;height:100%!important}.sub-title-black[_ngcontent-%COMP%]{font-weight:700;font-size:20px;line-height:24px;text-align:center;color:#253658}.sub-title-black-small[_ngcontent-%COMP%]{color:#253658;text-align:center;font-size:16px;font-weight:400}.control-part[_ngcontent-%COMP%]{width:100%;height:46px;display:flex;align-items:center;justify-content:space-between}.controls[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.controls-btn[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:24px;height:24px}.replace-btn[_ngcontent-%COMP%]{height:34px;width:78px;display:flex;padding:9px 14px;justify-content:center;align-items:center;gap:10px;border-radius:10px;background:#4481fd;color:#fff;text-align:center;font-size:13px;font-weight:400}"]});}}return i;})();ro();at();Nn();J();Bn();oo();ao();ht();pn();at();Mi();bn();qt();Zi();var nu=["textAreaInputComponent"],ou=["insideList"],ru=["nestedMenuComponent"],su=["rewriteScriptDialogComponent"],au=i=>({active:i});function cu(i,u){if(i&1){let e=U();r(0,"div",22),S("dragStart",function(t){T(e);let o=p();return P(o.dragStarted(t));})("dragEnd",function(t){T(e);let o=p();return P(o.dragEnded(t));}),b(1,"img",23),s();}if(i&2){let e=p(),n=Be(23);c("dropData",e.trackData.contentData.script)("ghostDragEnabled",!0)("ghostElementTemplate",n)("showOriginalElementWhileDragging",!1);}}function lu(i,u){if(i&1&&(r(0,"div",24),b(1,"app-ai-limit-circle",25),s()),i&2){let e=p(2);a(),c("remainingCredits",e.remainingCredits)("totalCredits",e.totalCredits)("tooltipText",e.tooltipText)("loading",e.isCheckLimits);}}function du(i,u){i&1&&M(0,lu,2,4,"ng-template",null,6,Re);}function pu(i,u){if(i&1){let e=U();r(0,"div",26)(1,"div",27),S("click",function(){T(e);let t=p();return P(t.selectCustomToneAction());}),y(2,"My Brand Tone"),s(),r(3,"div",28),S("click",function(){T(e);let t=p();return P(t.openCustomToneDialog());}),b(4,"img",29),s()();}}function hu(i,u){if(i&1&&b(0,"app-ai-limit-circle",30),i&2){let e=p(2);c("remainingCredits",e.remainingCredits)("totalCredits",e.totalCredits)("tooltipText",e.tooltipText);}}function mu(i,u){i&1&&M(0,hu,1,3,"ng-template",null,6,Re);}function uu(i,u){if(i&1&&(r(0,"div",31)(1,"div",32),y(2),s()()),i&2){let e=p();a(2),se(" ",e.myInput.nativeElement.innerText," ");}}var kp="\u2060",Ka=(()=>{class i{onClick(e){this.trackData.active&&!this.insideList.nativeElement.contains(e)&&(this.showPrevMenu=!1,clearTimeout(this.timer),this.trackData.active=!1,this.trackScriptChangeAndSend());}onPageRefresh(e){this.trackData.active&&(e.returnValue="");}constructor(e,n,t,o,h,k,f,m,v,V,te){this.storyTrackCommunicationService=e,this.premiumPlanService=n,this.anonymousUserService=t,this.portableRegisterService=o,this.eventsService=h,this.planHelperService=k,this.dialogHelperService=f,this.adminRequestsService=m,this.deskManagerHelperService=v,this.notifier=V,this.creditsService=te,this.savedSelection=null,this.overlayIsActive=!1,this.topCustomMenu=0,this.leftCustomMenu=0,this.showCustomMenu=!1,this.showPrevMenu=!1,this.openNestedMenuUp=!1,this.isElementDragged=!1,this.showDragIcon=!1,this.remainingCredits=0,this.totalCredits=0,this.tooltipText="",this.setBusinessTone=$=>{$&&(this.customTone=$.brandStyle);},this.openUppsell=($=!1)=>I(this,null,function*(){if(yield this.anonymousUserService.getAnonymousUser())this.portableRegisterService.openPortableRegisterDialog();else{let H=`script-story/${this.story.storyId}`;this.premiumPlanService.openPricingDialog(yi.PRO,H,H,pt.ai);}}),this.checkRewriteLimit=($=!1)=>I(this,null,function*(){try{this.isCheckLimits=!0,this.userIsPro=yield this.planHelperService.isProOrTeamOrMaxByCurrentPlan(),$&&this.creditsService.invalidateCache();let H=yield this.creditsService.getCreditsUsage();if(this.creditsService.isFeatureLimited(H,"aiScript")){this.userIsLimited=!0;let j=this.creditsService.getRemainingActions(H,"aiScript"),F=this.creditsService.getFeature(H,"aiScript");this.remainingCredits=j;let Z=this.creditsService.getFeatureCost(F);this.totalCredits=Z?Math.floor(this.creditsService.getFeatureTotalCredits(H,"aiScript")/Z):j,this.tooltipText=`${j} AI rewrites remaining`,this.canUseAiRewrite=j>0;}
5else this.canUseAiRewrite=!0,this.userIsLimited=!1;}catch(H){console.error(H),this.canUseAiRewrite=!0,this.userIsLimited=!1;}finally{this.isCheckLimits=!1;}}),this.updateOnDebounce=()=>I(this,null,function*(){this.highlightBrackets(),clearTimeout(this.timer),this.timer=setTimeout(()=>{this.trackScriptChangeAndSend();},500);}),this.onCopyRemoveStyles=$=>{$.preventDefault();let H=$.clipboardData.getData("text/plain");document.execCommand("insertHTML",!1,H);},this.trackScriptChangeAndSend=()=>{let $=this.myInput.nativeElement.innerText,H=$.length>2&&$.charAt(-1)=="n"&&$.charAt(-2)=="/"?$.slice(0,-2):$;this.trackData.contentData.script!==H&&(this.trackData.contentData.script=H,this.storyTrackCommunicationService.updateSelectedScriptTrack(this.trackData));},this.highlightBrackets=()=>{let $=this.myInput?.nativeElement;if(!$)return;let H=$.innerText,j=this.buildHighlightedHtml(H);if($.innerHTML===j)return;let F=this.getCaretCharOffset($);$.innerHTML=j,F!==null&&this.setCaretCharOffset($,F);},this.buildHighlightedHtml=$=>(j=>j.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"))($).replace(/\n/g,"<br>").replace(mp,j=>`<span class="bracket-highlight" style="color:#00ABFE !important">${j}</span>`),this.getCaretCharOffset=$=>{let H=window.getSelection();if(!H||H.rangeCount===0)return null;let j=H.getRangeAt(0);if(!$.contains(j.endContainer))return null;let F=document.createTextNode(kp),Z=j.cloneRange();Z.collapse(!1),Z.insertNode(F);let N=$.innerText.indexOf(kp);return F.remove(),N>=0?N:null;},this.setCaretCharOffset=($,H)=>{let j=window.getSelection();if(!j)return;let F=document.createRange(),Z=H,N=!1,Q=W=>{if(W.nodeType===Node.TEXT_NODE){let O=W.textContent?.length||0;return Z<=O?(F.setStart(W,Z),F.collapse(!0),N=!0,!0):(Z-=O,!1);}if(W.nodeName==="BR")return Z===0?(F.setStartBefore(W),F.collapse(!0),N=!0,!0):(Z-=1,!1);for(let O=0;O<W.childNodes.length;O++)if(Q(W.childNodes[O]))return!0;return!1;};Q($),N||(F.selectNodeContents($),F.collapse(!1)),j.removeAllRanges(),j.addRange(F);},this.onSidebarChangesThisTrack=$=>{this.myInput.nativeElement.innerText==""||this.myInput.nativeElement.innerText==` 6`?this.trackData.contentData.script=$:this.trackData.contentData.script+=` 7 8`+$,this.trackData.active=!0,this.myInput.nativeElement.innerText=this.trackData.contentData.script,this.highlightBrackets(),this.storyTrackCommunicationService.updateSelectedScriptTrack(this.trackData);},this.onRewritePopupChanges=$=>{this.trackData.contentData.script=$,this.trackData.active=!0,this.myInput.nativeElement.innerText=this.trackData.contentData.script,this.highlightBrackets(),this.storyTrackCommunicationService.updateSelectedScriptTrack(this.trackData);},this.onRemoveBracketTagsFromScript=()=>{let $=this.trackData?.contentData?.script??"",H=Rs($);H!==$&&(!this.trackData?.contentData||!this.myInput?.nativeElement||(this.trackData.contentData.script=H,this.myInput.nativeElement.innerText=H,this.storyTrackCommunicationService.updateSelectedScriptTrack(this.trackData)));},this.onAiSidebarOpen=$=>{this.showDragIcon=$;},this.overlayToPreventSelections=$=>{this.overlayIsActive=$;},this.selectCustomToneAction=()=>{this.customToneOption.value===tn.custom?this.openCustomToneDialog():this.selectAction({option:this.customToneOption,subOption:!0});},this.openCustomToneDialog=()=>{if(this.customToneDialogOpened)return;if(!this.userIsPro){this.openUppsell(!0);return;}this.eventsService.log(this.eventsService.events.aiBrandTone.aiBrandToneEditStart,{screen:"story"}),this.customToneDialogOpened=!0;let $=new Fs();$.lastTone=this.customTone,$.onSubmit=this.createCustomTone,$.onClose=this.customToneDialogClosed;let H=new We();H.disableClose=!0,H.panelClass="ai-custom-style-tone-dialog-content",this.dialogHelperService.open($,js,H);},this.customToneDialogClosed=()=>{this.customToneDialogOpened=!1,this.dialogHelperService.close();},this.createCustomTone=$=>I(this,null,function*(){try{if(this.customToneDialogClosed(),$!=this.customTone){let H=yield this.adminRequestsService.updateBusiness({brandStyle:$,deskId:this.deskManagerHelperService.getSelectedWorkspaceId()});this.storyTrackCommunicationService.setBusiness(H),this.customTone=H.brandStyle;}this.notifier.success("Your Brand Style Created");}catch(H){console.error(H);}}),this.selectAction=$=>{let{option:H,subOption:j}=$;if(this.showCustomMenu=!1,document.removeEventListener("click",this.handleDocumentClick),this.sendEvent(this.eventsService.events.script.aiScriptRewriteMenuClick,{numWords:this.textToRewrite.split(" ").length,button:H.value}),this.canUseAiRewrite){if(this.savedSelection){let F=window.getSelection();F.removeAllRanges(),F.addRange(this.savedSelection);}this.storyTrackCommunicationService.setPopupRewrite({allText:this.trackData.contentData.script,rewriteText:this.textToRewrite,rewriteType:j?un.changeTone:H.value,tone:j?H.value:void 0});}else this.openUppsell(!0);},this.addCopyTextEventListener=()=>{document.getElementsByClassName("story-track-input-wrapper")[0]&&document.getElementsByClassName("story-track-input-wrapper")[0].addEventListener("mousedown",H=>{this.showPrevMenu=!1;}),this.insideList?.nativeElement&&this.insideList.nativeElement.addEventListener("mouseup",$=>{if(window.getSelection().toString().length&&!this.rewriteScriptDialogComponent.isVisible){this.textToRewrite=window.getSelection().toString();let j=window.getSelection().getRangeAt(0).getBoundingClientRect(),F=this.scrollableContainer.nativeElement,Z=F.getBoundingClientRect(),N=j.top-Z.top+F.scrollTop,Q=j.bottom-Z.top+F.scrollTop;this.leftCustomMenu=j.left-Z.left,this.topCustomMenu=N+j.height+5,this.checkHeight(this.topCustomMenu);let W=F.clientHeight;N<F.scrollTop?F.scrollTop=N-200:Q>F.scrollTop+W&&(F.scrollTop=Q-W+200),this.showPrevMenu=!0;}else this.showPrevMenu=!1;});},this.selectTextInScriptTrack=($,H)=>{let j=$;if(!document.getElementsByClassName("story-track-input-wrapper")[0])return;let F=document.getElementsByClassName("story-track-input-wrapper")[0],Z=window.getSelection(),N=document.createRange(),Q=F.textContent,W=j?.startIndex;if(W===null)return;let O=j?.endIndex;this.clearSelectionInScriptTrack(),this.setRange(!1,F,W,O,N);let D=R=>
8R.replace(/\\n/g,"").replace(/^"|"$/g,"").trim(),ie=JSON.stringify(j.text),Te=D(ie);if(N.toString()!=Te){if(W=Q.indexOf(j.text),W==-1)return;O=W+j.text.length,this.setRange(!0,F,W,O,N);}Z.removeAllRanges(),Z.addRange(N),this.textToRewrite=window.getSelection().toString();let je=window.getSelection().getRangeAt(0).getBoundingClientRect(),Ke=this.scrollableContainer.nativeElement,Ft=Ke.getBoundingClientRect(),Wt=je.top-Ft.top+Ke.scrollTop,Ai=je.bottom-Ft.top+Ke.scrollTop;this.leftCustomMenu=je.left-Ft.left,this.topCustomMenu=Wt+je.height+5,this.checkHeight(this.topCustomMenu),this.showPrevMenu=!0;let _=Ke.clientHeight;Wt<Ke.scrollTop?Ke.scrollTop=Wt-200:Ai>Ke.scrollTop+_&&(Ke.scrollTop=Ai-_+200),H?this.openNestedMenu():this.showCustomMenu&&(this.showCustomMenu=!1,document.removeEventListener("click",this.handleDocumentClick));},this.openNestedMenu=$=>{$&&$.preventDefault(),this.showPrevMenu=!1;let H=window.getSelection();H.toString().length&&this.leftCustomMenu&&this.topCustomMenu&&!this.rewriteScriptDialogComponent.isVisible&&(this.savedSelection=H.getRangeAt(0).cloneRange(),this.showCustomMenu=!0,this.eventsService.log(this.eventsService.events.script.aiScriptRewriteMenu,{numWords:this.textToRewrite.split(" ").length,storyId:this.story.storyId}),setTimeout(()=>{document.addEventListener("click",this.handleDocumentClick);},0));},this.handleDocumentClick=$=>{let H=$.target;this.nestedMenuComponent.nativeElement.contains(H)||(this.showCustomMenu=!1,document.removeEventListener("click",this.handleDocumentClick));},this.sendEvent=($,H)=>{let j={storyId:this.story.storyId};this.eventsService.log($,pe(pe({},j),H));},this.setRange=($=!1,H,j,F,Z)=>{let N=$?this.findTextNodeMainSearchInText(H,j):this.findTextNodeMain(H,j),Q=$?this.findTextNodeMainSearchInText(H,F):this.findTextNodeMain(H,F);if(!(!N?.node||!Q?.node))return N?.node.isSameNode(Q.node)?(Z.setStart(N.node,N.index),Z.setEnd(N.node,Q.index)):(Z.setStart(N.node,N.index),Z.setEnd(Q.node,Q.index)),Z;},this.findTextNodeMain=($,H)=>{let j=0,F=null,Z=N=>{for(let Q=0;Q<N.childNodes.length;Q++){let W=N.childNodes[Q];if(W.nodeType===Node.TEXT_NODE){let O=W.textContent?.length||0;if(H<=j+O)return F={node:W,index:H-j},!0;j+=O;}else if(W.nodeName==="BR"){if(H===j)return F={node:W,index:0},!0;j+=1;}else if(Z(W))return!0;}return!1;};return Z($),F;},this.findTextNodeMainSearchInText=($,H)=>{let j=0,F=null,Z=N=>{for(let Q=0;Q<N.childNodes.length;Q++){let W=N.childNodes[Q];if(W.nodeType===Node.TEXT_NODE){let O=W.textContent?.length||0;if(H<=j+O)return F={node:W,index:H-j},!0;j+=O;}else if(W.nodeType===Node.ELEMENT_NODE&&W.nodeName!=="BR"&&Z(W))return!0;}return!1;};return Z($),F;},this.checkHeight=$=>{let H=this.scrollableContainer.nativeElement.getBoundingClientRect();$>H.bottom*.57?this.openNestedMenuUp=!0:this.openNestedMenuUp=!1;},this.eventListeners=[];}ngOnInit(){this.eventListeners.push(this.storyTrackCommunicationService.observeSidebarUpdateSelectedScriptTrack().subscribe(this.onSidebarChangesThisTrack),this.storyTrackCommunicationService.observePopupUpdateScriptTrack().subscribe(this.onRewritePopupChanges),this.storyTrackCommunicationService.observeRemoveBracketTagsFromScript().subscribe(this.onRemoveBracketTagsFromScript),this.storyTrackCommunicationService.observeAiSidebarOpen().subscribe(this.onAiSidebarOpen),this.storyTrackCommunicationService.observeIsViewer().subscribe(e=>this.isViewer=e),this.storyTrackCommunicationService.observeStoryChanged().subscribe(e=>this.story=e),this.storyTrackCommunicationService.observeBusiness().subscribe(e=>this.setBusinessTone(e)),this.storyTrackCommunicationService.observeUserPlan().subscribe(e=>this.checkRewriteLimit()),this.storyTrackCommunicationService.observeSetSelectTextInScriptTrack().subscribe(e=>this.selectTextInScriptTrack(e.segment,e.clicked)),this.storyTrackCommunicationService.observeClearTextInScriptTrack().subscribe(()=>this.clearSelectionInScriptTrack()));}ngOnChanges(e){this.toneOptions&&(this.customToneOption=this.toneOptions.find(n=>n.style=tn.custom),this.aiMenuOptions=[new St(un.changeTone,"Change Tone","","",void 0,this.toneOptions.filter(n=>n.style!==tn.custom)),new St(un.shorten,"Shorten"),new St(un.elaborate,"Elaborate"),new St(un.simplify,"Simplify Language")]),e.trackData&&this.myInput?.nativeElement&&(this.myInput.nativeElement.innerText=this.trackData?.contentData?.script||"",this.highlightBrackets());}
8ngOnDestroy(){this.eventListeners.forEach(e=>e.unsubscribe()),this.isViewer||this.myInput.nativeElement.removeEventListener("paste",this.onCopyRemoveStyles,!1),document.removeEventListener("click",this.handleDocumentClick);}ngAfterViewInit(){this.myInput.nativeElement.innerText=this.trackData.contentData.script||"",this.myInput.nativeElement.contentEditable=!this.isViewer,this.highlightBrackets(),this.isViewer||(this.myInput.nativeElement.addEventListener("paste",this.onCopyRemoveStyles),this.addCopyTextEventListener());}dragStarted(e){document.body.style.userSelect="none",this.isElementDragged=!0,this.storyTrackCommunicationService.setScriptDragStarted(this.trackData);}dragEnded(e){document.body.style.userSelect="initial",this.isElementDragged=!1,this.storyTrackCommunicationService.setScriptDragEnded(this.trackData);}clearSelectionInScriptTrack(){let e=window.getSelection();e&&e.removeAllRanges();}static{this.ɵfac=function(n){return new(n||i)(d(He),d(hi),d(xi),d(wi),d(Pe),d(zt),d(Ue),d(xt),d(Kt),d(Ge),d(Vt));};}static{this.ɵcmp=G({type:i,selectors:[["script-track"]],viewQuery:function(n,t){if(n&1&&(Ye(nu,5,On),Ye(ou,5,On),Ye(ru,5,On),Ye(su,5,qa)),n&2){let o;Ne(o=Fe())&&(t.myInput=o.first),Ne(o=Fe())&&(t.insideList=o.first),Ne(o=Fe())&&(t.nestedMenuComponent=o.first),Ne(o=Fe())&&(t.rewriteScriptDialogComponent=o.first);}},hostBindings:function(n,t){n&1&&S("click",function(h){return t.onClick(h.target);},!1,So)("beforeunload",function(h){return t.onPageRefresh(h);},!1,Dr);},inputs:{trackData:"trackData",toneOptions:"toneOptions",scrollableContainer:"scrollableContainer"},standalone:!0,features:[Ut,q],decls:24,vars:24,consts:[["insideList",""],["textAreaInputComponent",""],["nestedMenuComponent",""],["extraNested",""],["rewriteScriptDialogComponent",""],["ghostDraggedTemplate",""],["extra",""],[1,"story-track-wrapper"],[1,"track-control-panel"],[1,"track-tag"],[1,"arrow-right"],["class","drag-handler","mwlDraggable","",3,"dropData","ghostDragEnabled","ghostElementTemplate","showOriginalElementWhileDragging","dragStart","dragEnd",4,"ngIf"],[1,"story-track",3,"ngClass"],[1,"story-track-scrollable-container"],["draggable","false","contenteditable","",1,"story-track-input-wrapper",3,"input"],[1,"overlay",3,"hidden"],[1,"prevNestedMenu",3,"click","hidden"],["src","/img/script-story-v2/popup-rewrite-option.svg","alt","option"],[3,"onOptionSelected","options","isVisible","leftPosition","topPosition","openNestedMenuUp"],[4,"ngIf"],[3,"checkLimits","changeVisability","onUpsell","story","isLoading","userIsLimited","canRewrite","leftPosition","topPosition"],[2,"z-index","1000","cursor","grab!important"],["mwlDraggable","",1,"drag-handler",3,"dragStart","dragEnd","dropData","ghostDragEnabled","ghostElementTemplate","showOriginalElementWhileDragging"],["src","/img/composer-icons/drag.svg","alt","image"],[1,"extra-li"],[3,"remainingCredits","totalCredits","tooltipText","loading"],[1,"item-extra-nested"],[1,"item-txt-b",3,"click"],[1,"ai-tone-side-icon",3,"click"],["src","/img/script-story-v2/edit-w.webp","alt","edit tone"],[3,"remainingCredits","totalCredits","tooltipText"],[1,"active-drag-class"],["draggable","false","contenteditable","",1,"story-track-input-wrapper"]],template:function(n,t){if(n&1){let o=U();r(0,"div",7,0)(2,"div",8)(3,"div",9),b(4,"div",10),y(5),s(),M(6,cu,2,4,"div",11),s(),r(7,"div",12)(8,"div",13)(9,"div",14,1),S("input",function(){return T(o),P(t.updateOnDebounce());}),s()(),b(11,"div",15),r(12,"div",16),S("click",function(k){return T(o),P(t.openNestedMenu(k));}),b(13,"img",17),s(),r(14,"app-nested-menu",18,2),S("onOptionSelected",function(k){return T(o),P(t.selectAction(k));}),M(16,du,2,0,null,19)(17,pu,5,0,"ng-template",null,3,Re),s(),r(19,"app-rewrite-script-dialog",20,4),S("checkLimits",function(){return T(o),P(t.checkRewriteLimit(!0));})("changeVisability",function(k){return T(o),P(t.overlayToPreventSelections(k));})("onUpsell",function(){return T(o),P(t.openUppsell());}),M(21,mu,2,0,null,19),s()(),M(22,uu,3,1,"ng-template",21,5,Re),s();}n&2&&(a(5),se(" ",(t.trackData==null?null:t.trackData.tag)||"TAG"," "),a(),c("ngIf",t.showDragIcon&&!t.isViewer),a(),c("ngClass",ue(22,au,(t.trackData==null?null:t.trackData.active)&&!t.isElementDragged&&!t.isViewer)),a(4),c("hidden",!t.overlayIsActive),a(),nt("top",t.topCustomMenu,"px")("left",t.leftCustomMenu,"px"),c("hidden",!t.showPrevMenu),a(2),c("options",t.aiMenuOptions)("isVisible",t.showCustomMenu)("leftPosition",t.leftCustomMenu)("topPosition",t.topCustomMenu)("openNestedMenuUp",t.openNestedMenuUp),a(2),c("ngIf",t.userIsLim
8ited),a(3),c("story",t.story)("isLoading",t.isCheckLimits)("userIsLimited",t.userIsLimited)("canRewrite",t.canUseAiRewrite)("leftPosition",t.leftCustomMenu+120)("topPosition",t.topCustomMenu+12),a(2),c("ngIf",t.userIsLimited));},dependencies:[_e,qi,Is,we,zs,qa,$i],styles:[".story-track-wrapper[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:24px}.track-control-panel[_ngcontent-%COMP%]{margin-top:24px;width:78px;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:18px}.track-tag[_ngcontent-%COMP%]{width:78px;height:24px;background:#00abfe;font-weight:600;font-size:12px;line-height:24px;text-align:center;color:#fff;position:relative}.story-track-wrapper[_ngcontent-%COMP%], .story-track[_ngcontent-%COMP%]{overflow:visible}.drag-handler[_ngcontent-%COMP%]{height:24px;width:24px;z-index:30;cursor:grab!important}.arrow-right[_ngcontent-%COMP%]{width:0;height:0;border-top:12px solid transparent;border-bottom:12px solid transparent;border-left:11px solid #00ABFE;position:absolute;top:0;right:-10px}.story-track[_ngcontent-%COMP%]{padding:24px;width:100%;display:flex;flex-direction:column;align-items:flex-start;border:3px solid transparent;border-radius:20px!important;background-color:#fff!important}.overlay[_ngcontent-%COMP%]{position:fixed;inset:0;z-index:999;pointer-events:auto}.extra-li[_ngcontent-%COMP%]{width:100%;padding:8px 12px}.item-extra-nested[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;padding:10px 16px;gap:12px}
8.item-txt-b[_ngcontent-%COMP%]{width:100%;font-weight:600;font-size:14px;font-family:Inter-Bold}.ai-tone-side-icon[_ngcontent-%COMP%]{width:24px;height:24px}.ai-tone-side-icon[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;object-position:center}.active[_ngcontent-%COMP%]{border:3px solid #00ABFE!important;cursor:text}.active-drag-class[_ngcontent-%COMP%]{padding:24px;width:320px;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:18px;border-radius:20px!important;background-color:#fff!important;z-index:99999;border:3px solid #00ABFE!important;opacity:.7!important;cursor:grab!important;transform:rotate(-5deg)}[_nghost-%COMP%] .bracket-highlight{color:#00abfe}.story-track-input-wrapper[_ngcontent-%COMP%]{width:100%;background-color:#fff!important;resize:none!important;outline:none!important;border:none!important;font-weight:400!important;font-size:16px!important;line-height:22px!important;color:#253658!important;min-height:60px;box-sizing:border-box;white-space:break-spaces;unicode-bidi:plaintext}.story-track-scrollable-container[_ngcontent-%COMP%]{width:100%;max-height:calc(100vh - 320px);overflow-y:auto;padding-right:20px;box-sizing:content-box}.prevNestedMenu[_ngcontent-%COMP%]{position:absolute;background:#fff;border:1px solid lightgrey;box-shadow:0 0 40px #0000001a;z-index:1000;padding:4px;border-radius:12px;cursor:pointer;display:flex;align-items:center;justify-content:center}.prevNestedMenu[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:24px;height:24px}@media only screen and (max-width: 768px){.track-control-panel[_ngcontent-%COMP%]{display:none}}"]});}}return i;})();ae();J();function gu(i,u){if(i&1){let e=U();r(0,"div",3),S("click",function(){let t=T(e).$implicit,o=p();return P(o.activateAndFocusOnTrack(t.id));}),b(1,"script-track",4),s();}if(i&2){let e=u.$implicit,n=p();a(),c("scrollableContainer",n.scrollableContainer)("toneOptions",n.toneOptions)("trackData",e);}}var wp=(()=>{class i{constructor(e){this.storyTrackCommunicationService=e,this.scriptTracks=[],this.onScriptTracksChange=n=>{n&&(this.scriptTracks=n);},this.activateAndFocusOnTrack=n=>{this.scriptTracks.forEach((t,o)=>{t.id===n?t.active||(this.storyTrackComponents.toArray()[o].myInput.nativeElement.focus(),t.active=!0):t.active=!1;});},this.eventListeners=[];}ngOnInit(){this.eventListeners.push(this.storyTrackCommunicationService.observeScriptTracks().subscribe(this.onScriptTracksChange));}ngOnDestroy(){this.eventListeners.forEach(e=>e.unsubscribe());}static{this.ɵfac=function(n){return new(n||i)(d(He));};}static{this.ɵcmp=G({type:i,selectors:[["script-track-list"]],viewQuery:function(n,t){if(n&1&&Ye(Ka,5),n&2){let o;Ne(o=Fe())&&(t.storyTrackComponents=o);}},inputs:{toneOptions:"toneOptions",scrollableContainer:"scrollableContainer"},standalone:!0,features:[q],decls:3,vars:1,consts:[[1,"story-track-list-component"],[1,"track-list-container"],["class","track-wrapper",3,"click",4,"ngFor","ngForOf"],[1,"track-wrapper",3,"click"],[3,"scrollableContainer","toneOptions","trackData"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),M(2,gu,2,3,"div",2),s()()),n&2&&(a(2),c("ngForOf",t.scriptTracks));},dependencies:[Le,Ka],styles:[".story-track-list-component[_ngcontent-%COMP%]{padding:0 8px;height:100%}.story-track-list-component[_ngcontent-%COMP%] .track-list-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:24px;padding-bottom:24px}.story-track-list-component[_ngcontent-%COMP%] .track-list-container[_ngcontent-%COMP%] .track-wrapper[_ngcontent-%COMP%]{cursor:pointer}.shimmer-container[_ngcontent-%COMP%]{width:100%;height:80px}"]});}}return i;})();J();ae();J();ht();var fu=i=>({"mobile-mode-wrapper":i}),vu=i=>({"mobile-mode-header":i}),_u=i=>({"mobile-mode":i});function Cu(i,u){if(i&1){let e=U();r(0,"span",8),S("click",function(){T(e);let t=p(2);return P(t.onClickClose());}),r(1,"button",9),b(2,"img",10),s()();}}function bu(i,u){if(i&1){let e=U();r(0,"footer"),y(1," Don\u2019t have our mobile app yet? download it now for "),r(2,"span",11),S("click",function(){T(e);let t=p(2);return P(t.onClickLink("ios"));}),r(3,"a",12),y(4,"iPhone/iPad"),s()(),y(5," or "),r(6,"span",11),S("click",function(){T(e);let t=p(2);return P(t.onClickLink("android"));}),r(7,"a",12),y(8,"Android"),s()()();}if(i&2){let e=p(2);a(3),c("href",e.iosLink,Ie),a(4),c("href",e.googlePlayLink,Ie);}}function Su(i,u){i&1&&(r(0,"footer"),y(1," Don\u2019t have our mobile app yet? Click here to download. "),s());}function xu(i,u){if(i&1&&(r(0,"div",2)(1,"header",3),b(2,"img",4),r(3,"div"),y(4,"Tip"),s(),M(5,
8Cu,3,0,"span",5),s(),r(6,"main",3),b(7,"img",4),r(8,"div",6),y(9," Your script will appear on your mobile as a new project as soon as you save it here. "),s()(),M(10,bu,9,2,"footer",7)(11,Su,2,0,"ng-template",null,0,Re),s()),i&2){let e=Be(12),n=p();c("ngClass",ue(8,fu,n.mobileMode)),a(),c("ngClass",ue(10,vu,n.mobileMode)),a(),c("src",n.tipImg,Ie),a(3),c("ngIf",!n.mobileMode),a(),c("ngClass",ue(12,_u,n.mobileMode)),a(),c("src",n.deviceImg,Ie),a(3),c("ngIf",!n.mobileMode)("ngIfElse",e);}}var Tp=(()=>{class i{constructor(e){this.eventsService=e,this.path=this.eventsService.events.script,this.deviceImg=yd,this.tipImg=kd,this.LOCAL_STORAGE_KEY="desk-script-tip",this.googlePlayLink="https://play.google.com/store/apps/details?id=bigvu.com.reporter&utm_source=script-button&utm_medium=web&utm_campaign=ScriptAndroid",this.iosLink="https://apps.apple.com/us/app/teleprompter-video-captions/id1124958568?utm_source=script-button&utm_medium=web&utm_campaign=ScriptApple",this.onClickLink=n=>{this.mobileMode||this.scriptScreenClickEvent(n=="android"?At.tipClickAndroid:At.tipClickIos);},this.onClickClose=()=>{this.mobileMode||(this.hidden=!0,window.localStorage.setItem(this.LOCAL_STORAGE_KEY,JSON.stringify(!0)),this.scriptScreenClickEvent(At.tipDismiss));},this.cpSlotsStore=et(ni,{optional:!0}),this.cpProjectAnalytics=et(ii),this.scriptScreenClickEvent=n=>{this.eventsService.log(this.path.scriptScreenClick,pe({storyId:this.storyId,button:n},this.cpProjectAnalytics.scriptClickAttrs({slots:this.cpSlotsStore?.slots()})));};}ngOnInit(){if(!this.mobileMode){let e=window.localStorage.getItem(this.LOCAL_STORAGE_KEY);this.hidden=!!e;}}static{this.ɵfac=function(n){return new(n||i)(d(Pe));};}static{this.ɵcmp=G({type:i,selectors:[["script-tips-dialog"]],inputs:{storyId:"storyId",mobileMode:"mobileMode"},standalone:!0,features:[q],decls:1,vars:1,consts:[["mobileFooter",""],["class","tip-container",3,"ngClass",4,"ngIf"],[1,"tip-container",3,"ngClass"],[3,"ngClass"],["alt","image",3,"src"],["class","close-button-ai-sidebar",3,"click",4,"ngIf"],[1,"main-tip-text"],[4,"ngIf","ngIfElse"],[1,"close-button-ai-sidebar",3,"click"],["aria-label","Close"],["src","/img/sidebar-close-icon.svg","alt","image"],[3,"click"],["target","_blank",3,"href"]],template:function(n,t){n&1&&M(0,xu,13,14,"div",1),n&2&&c("ngIf",!t.hidden);},dependencies:[_e,we],styles:[".tip-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:12px;gap:8px;width:164px;height:268px;background:#fff;box-shadow:0 0 40px #0000001a;border-radius:10px;z-index:1000}.mobile-mode-wrapper[_ngcontent-%COMP%]{width:94%;height:auto}header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%;font-weight:700;font-size:14px;line-height:140%;color:#000}.mobile-mode-header[_ngcontent-%COMP%]{justify-content:flex-start;gap:12px}header[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:20px;height:20px}main[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;gap:16px}.mobile-mode[_ngcontent-%COMP%]{flex-direction:row;gap:0;padding-bottom:12px}.mobile-mode[_ngcontent-%COMP%] .main-tip-text[_ngcontent-%COMP%]{font-size:14px}main[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{height:80px;margin-left:15px}.main-tip-text[_ngcontent-%COMP%]{font-weight:600;font-size:12px;line-height:16px;color:#000}.mobile-mode-wrapper[_ngcontent-%COMP%] footer[_ngcontent-%COMP%]{font-size:12px;line-height:normal;color:#00abfe}footer[_ngcontent-%COMP%]{text-align:left;font-weight:400;font-size:11px;line-height:13px;color:#000}footer[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:#00abfe}span[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{cursor:pointer;text-decoration:none;color:#00abfe}"]});}}return i;})();ae();J();var yu=["*"],ku=i=>({hasBackground:i}
8),Pp=(()=>{class i{static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["app-script-action-menu"]],inputs:{title:"title",hasBack:"hasBack"},standalone:!0,features:[q],ngContentSelectors:yu,decls:5,vars:4,consts:[[1,"script-action-menu"],[1,"title"],[1,"action-list",3,"ngClass"]],template:function(n,t){n&1&&(Vr(),r(0,"div",0)(1,"div",1),y(2),s(),r(3,"div",2),Rr(4),s()()),n&2&&(a(2),de(t.title),a(),c("ngClass",ue(2,ku,t.hasBack)));},dependencies:[we],styles:[".script-action-menu[_ngcontent-%COMP%]{width:240px;flex-shrink:0;margin-bottom:24px}.action-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:8px 16px 8px 12px;align-items:flex-start;justify-content:center;gap:10px}.hasBackground[_ngcontent-%COMP%]{border-radius:0 20px 20px 0;background:#fff}.title[_ngcontent-%COMP%]{color:#7b8db1;font-size:13px;font-weight:400;margin-left:12px;margin-bottom:8px}"]});}}return i;})();ae();J();ae();ym();J();wl();bn();Mi();at();ht();Eo();pn();qt();function Tu(i,u){i&1&&(ot(0),y(1," Add "),r(2,"b"),y(3,"Guest Viewer"),s(),y(4,", with read only access to your script and workspace "),rt());}function Pu(i,u){i&1&&(ot(0),y(1," Send script to one or multiple "),r(2,"b"),y(3,"contributors"),s(),y(4," for recording "),rt());}var Op=(()=>{class i extends Zd{get typeGuest(){return Ds.guest;}get typeContributor(){return Ds.contributors;}constructor(e,n,t,o,h,k,f,m,v,V){super(e,n,t,o,h,k,m,v,V,f),this.workspacePermissionService=e,this.workspaceInvitationService=n,this.workspaceHelperService=t,this.adminRequestsService=o,this.deskManagerHelperService=h,this.dialogHelperService=k,this.eventsService=f,this.userHelperService=m,this.planHelperService=v,this.notifier=V,this.onClick=new be(),this.SCRIPT_EVENTS=this.eventsService.events.script,this.clickBtn=()=>I(this,null,function*(){this.onClick.emit(this.configuration.type),this.eventsService.log(this.SCRIPT_EVENTS.scriptSendStart,{storyId:this.storyId,type:this.isTeam?"team":"guest"}),this.configuration.type==Ds.guest?(yield this.workspacePermissionService.canInviteExternals(Ma.VIEWER))?(this.workspaceInvitationService.openInvitationDialog(this.sendGuestInvitationRequest,void 0,Ma.VIEWER),this.eventsService.log(this.eventsService.events.collaborate.guestAddStart,{screen:this.pageOrigin})):this.notifier.error("You don't have invitation permissions. Please advise your admin"):(this.openSelectMultyOptionDialog("script"),this.eventsService.log(this.eventsService.events.collaborate.addMemberInviteStart,{screen:this.pageOrigin}));});}ngOnInit(){return I(this,null,function*(){yield Er(i.prototype,this,"ngOnInit").call(this);});}ngOnDestroy(){super.ngOnDestroy();}static{this.ɵfac=function(n){return new(n||i)(d(is),d(Gd),d(Kt),d(xt),d(Kt),d(Ue),d(Pe),d(zi),d(zt),d(Ge));};}static{this.ɵcmp=G({type:i,selectors:[["app-portable-collaborate-widget"]],outputs:{onClick:"onClick"},standalone:!0,features:[Ae,q],decls:12,vars:8,consts:[[1,"portable-container"],[1,"img-holder"],[1,"text-holder"],[3,"ngSwitch"],[4,"ngSwitchCase"],[1,"btn-holder"],[3,"click"],[1,"button-text"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),b(2,"i"),s(),r(3,"div",2),ot(4,3),M(5,Tu,5,0,"ng-container",4)(6,Pu,5,0,"ng-container",4),rt(),s(),r(7,"div",5)(8,"button",6),S("click",function(){return t.clickBtn();}),b(9,"span"),r(10,"span",7),y(11),s()()()()),n&2&&(a(2),gt(t.configuration==null?null:t.configuration.type),a(2),c("ngSwitch",t.configuration==null?null:t.configuration.type),a(),c("ngSwitchCase",t.typeGuest),a(),c("ngSwitchCase",t.typeContributor),a(3),gt(t.configuration==null||t.configuration.btn==null?null:t.configuration.btn.sideIconClass),a(2),de(t.configuration==null||t.configuration.btn==null?null:t.configuration.btn.name));},dependencies:[wo,To],styles:[".portable-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:space-between;align-items:center;padding:14px;width:164px;height:180px;background:#fff;box-shadow:0 0 40px #0000001a;border-radius:10px}.img-holder[_ngcontent-%COMP%]{width:118px;height:47px}.img-holder[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{width:100%;height:100%;background-position:center;background-size:cover;background-repeat:no-repeat;display:block}.guest[_ngcontent-%COMP%]{background-image:url(/img/portable-collaborate/guest.svg)}.contributor[_ngcontent-%COMP%]{background-image:url(/img/portable-collaborate/contributor.svg)}.text-holder[_ngcontent-%COMP%]{font-weight:500;font-size:11px;line-height:14px}.btn-holder[_ngcontent-%COMP%]{padding:10px;width:100%;height:32px;background:linear-gradient(203.96deg,#a35eef 3.69%,#2f51c7 84.62%);border-radius:4px}.btn-holder[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.btn-portable-img[_ngcontent-%COMP%]{background-repeat:no-repeat;background-position:center;background-size:contain;width:24px;height:24px;margin-right:5px}.btn-guest[_ngcontent-%COMP%]{background-image:url(/img/portable-collaborate/pluss.svg)}.btn-contributor[_ngcontent-%COMP%]{background-image:url(/img/portable-collaborate/send.svg)}.button-text[_ngcontent-%COMP%]{font-weight:700;font-size:12px;line-height:17px;color:#fff;font-family:Inter-Bold;letter-spacing:.1px}"]});}}return i;})();J();ss();at();Bt();ro();ae();Om();J();ae();ji();ss();J();ae();Fm();function Ou(i,u){if(i&1){let e=U();r(0,"div",14),S("click",function(t){T(e);let o=p();return P(o.onClearClick(t));}),b(1,"div",15),s();}}function Iu(i,u){if(i&1){let e=U();r(0,"div",16),S("click",function(t){T(e);let o=p();return P(o.onEditClick(t));}),b(1,"div",17),s();}}function Mu(i,u){if(i&1){let e=U();r(0,"button",18),S("click",function(){T(e);let t=p();return P(t.onThumbnailClick());}),b(1,"ui-avatar",19),s();}if(i&2){let e=p();a(),c("img",e.thumbnailUrl);}}function Eu(i,u){if(i&1&&b(0,"ui-avatar",19),i&2){let e=p();c("img",e.thumbnailUrl);}}function Au(i,u){if(i&1&&(r(0,"div",20)(1,"div",21),y(2),s(),b(3,"app-ai-limit-circle",22),s()),i&2){let e,n=p();a(2),de(n.creditsLabel),a(),c("remainingCredits",n.credits.remainingCredits)("totalCredits",n.credits.totalCredits)("tooltipText",n.credits.tooltipText)("loading",(e=n.credits.loading)!==null&&e!==void 0?e:!1);}}var Ws=(()=>{class i{constructor(){this.thumbnailUrl="",this.name="",this.subtitle="",this.thumbnailClickable=!1,this.showClear=!1,this.showEdit=!1,this.credits=null,this.creditsLabel="Your Credits:",this.ctaLabel="",this.ctaDisabled=!1,this.ctaLoading=!1,this.ctaVariant="primary",this.ctaClicked=new be(),this.thumbnailClicked=new be(),this.clearClicked=new be(),this.editClicked=new be();}
8onCtaClick(){this.ctaClicked.emit();}onThumbnailClick(){this.thumbnailClicked.emit();}onClearClick(e){e.stopPropagation(),this.clearClicked.emit();}onEditClick(e){e.stopPropagation(),this.editClicked.emit();}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["app-avatar-info-banner"]],inputs:{thumbnailUrl:"thumbnailUrl",name:"name",subtitle:"subtitle",thumbnailClickable:"thumbnailClickable",showClear:"showClear",showEdit:"showEdit",credits:"credits",creditsLabel:"creditsLabel",ctaLabel:"ctaLabel",ctaDisabled:"ctaDisabled",ctaLoading:"ctaLoading",ctaVariant:"ctaVariant"},outputs:{ctaClicked:"ctaClicked",thumbnailClicked:"thumbnailClicked",clearClicked:"clearClicked",editClicked:"editClicked"},standalone:!0,features:[q],decls:18,vars:11,consts:[["staticThumb",""],[1,"avatar-info-banner"],[1,"avatar-info-banner__info"],[1,"avatar-info-banner__thumbnail-wrapper"],["class","avatar-info-banner__clear",3,"click",4,"ngIf"],[1,"avatar-info-banner__thumbnail-image"],["class","avatar-info-banner__edit-overlay",3,"click",4,"ngIf"],["type","button","class","avatar-info-banner__thumbnail-button",3,"click",4,"ngIf","ngIfElse"],[1,"avatar-info-banner__content"],[1,"avatar-info-banner__name"],[1,"avatar-info-banner__subtitle"],[1,"avatar-info-banner__generation"],["class","avatar-info-banner__credits",4,"ngIf"],["size","md",3,"clicked","variant","disabled","loading"],[1,"avatar-info-banner__clear",3,"click"],[1,"icon-close-button","clear-avatar-icon"],[1,"avatar-info-banner__edit-overlay",3,"click"],[1,"banner-edit-icon","edit-icon-new-white"],["type","button",1,"avatar-info-banner__thumbnail-button",3,"click"],["size","lg","shape","square",3,"img"],[1,"avatar-info-banner__credits"],[1,"avatar-info-banner__credits-label"],[3,"remainingCredits","totalCredits","tooltipText","loading"]],template:function(n,t){if(n&1){let o=U();r(0,"div",1)(1,"div",2)(2,"div",3),M(3,Ou,2,0,"div",4),r(4,"div",5),M(5,Iu,2,0,"div",6)(6,Mu,2,1,"button",7)(7,Eu,1,1,"ng-template",null,0,Re),s()(),r(9,"div",8)(10,"div",9),y(11),s(),r(12,"div",10),y(13),s()()(),r(14,"div",11),M(15,Au,4,5,"div",12),r(16,"lib-button",13),S("clicked",function(){return T(o),P(t.onCtaClick());}),y(17),s()()();}if(n&2){let o=Be(8);a(3),c("ngIf",t.showClear),a(2),c("ngIf",t.showEdit),a(),c("ngIf",t.thumbnailClickable)("ngIfElse",o),a(5),de(t.name),a(2),de(t.subtitle),a(2),c("ngIf",t.credits),a(),c("variant",t.ctaVariant)("disabled",t.ctaDisabled)("loading",t.ctaLoading),a(),se(" ",t.ctaLabel," ");}},dependencies:[xe,_e,Un,El,$i,Fi],styles:[".avatar-info-banner[_ngcontent-%COMP%]{width:100%;min-width:700px;max-width:700px;height:80px;padding:12px 20px;margin:0 auto;display:flex;flex-direction:row;align-items:center;justify-content:space-between;background-color:#fff;border-radius:12px;border:2px solid rgba(37,54,88,.0784313725);box-sizing:border-box}.avatar-info-banner__info[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:12px;height:100%;max-width:50%}.avatar-info-banner__thumbnail-wrapper[_ngcontent-%COMP%]{position:relative}.avatar-info-banner__thumbnail-wrapper[_ngcontent-%COMP%] .avatar-img-element{object-fit:cover}.avatar-info-banner__clear[_ngcontent-%COMP%]{position:absolute;top:-5px;right:-10px;width:20px;height:20px;background-color:#253658;border-radius:50%;display:flex;align-items:center;justify-content:center;z-index:5;cursor:pointer;transition:background-color .3s ease}.avatar-info-banner__clear[_ngcontent-%COMP%]:hover{background-color:#253658cc}.avatar-info-banner__clear[_ngcontent-%COMP%] .clear-avatar-icon[_ngcontent-%COMP%]{height:10px;width:10px;background-repeat:no-repeat;background-position:center}.avatar-info-banner__thumbnail-image[_ngcontent-%COMP%]{position:relative;z-index:1}.avatar-info-banner__thumbnail-image[_ngcontent-%COMP%]:hover .avatar-info-banner__edit-overlay[_ngcontent-%COMP%]{opacity:1}.avatar-info-banner__edit-overlay[_ngcontent-%COMP%]{position:absolute;top:0;left:0;height:100%;width:100%;background-color:#0006;opacity:0;transition:opacity .3s ease;border-radius:12px;display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:2}.avatar-info-banner__edit-overlay[_ngcontent-%COMP%] .banner-edit-icon[_ngcontent-%COMP%]{width:32px;height:32px}.avatar-info-banner__thumbnail-button[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;display:block;border-radius:12px}.avatar-info-banner__thumbnail-button[_ngcontent-%COMP%]:focus-visible{outline:2px solid #4481FD;outline-offset:2px}.avatar-info-banner__content[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;justify-content:center}.avatar-info-banner__name[_ngcontent-%COMP%]{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;font-size:16px;font-weight:500;color:#253658;max-width:160px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.avatar-info-banner__subtitle[_ngcontent-%COMP%]{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;font-size:14px;font-weight:500;color:#25365899}.avatar-info-banner__generation[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:30px}.avatar-info-banner__credits[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:12px}.avatar-info-banner__credits-label[_ngcontent-%COMP%]{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;font-size:14px;font-weight:400;color:#253658}"],changeDetection:0});}}return i;})();J();at();pn();ht();ln();Gr();ae();function Vu(i,u){if(i&1){let e=U();r(0,"app-avatar-info-banner",3),S("ctaClicked",function(){T(e);let t=p(2);return P(t.onGenerateClick());})("clearClicked",function(){T(e);let t=p(2);return P(t.onClearAvatar());}
8)("editClicked",function(){T(e);let t=p(2);return P(t.onEditAvatarClick());}),s();}if(i&2){let e=p(2);c("thumbnailUrl",(e.avatar==null?null:e.avatar.imgUrl)||"")("name",(e.avatar==null?null:e.avatar.title)||"")("showClear",!0)("showEdit",!0)("credits",e.creditsVm)("ctaDisabled",!e.enableGenerateButton);}}function Ru(i,u){if(i&1){let e=U();r(0,"div",4)(1,"div",5)(2,"div",6),b(3,"img",7),s(),r(4,"div",8),y(5,"Don't want to be on camera?"),s(),r(6,"div",9)(7,"ui-button",10),S("onClick",function(){T(e);let t=p(2);return P(t.onTryAvatarClick());}),y(8,"Try an AI Influencer"),s(),r(9,"ui-button",11),S("onClick",function(){T(e);let t=p(2);return P(t.closeBanner());}),s()()()();}}function Nu(i,u){if(i&1&&(ot(0),M(1,Vu,1,6,"app-avatar-info-banner",2)(2,Ru,10,0,"ng-template",null,0,Re),rt()),i&2){let e=Be(3),n=p();a(),c("ngIf",n.avatar)("ngIfElse",e);}}var Ip=(()=>{class i{constructor(e,n,t,o,h,k){this.aiInfluencersService=e,this.dialogHelperService=n,this.storyTrackCommunicationService=t,this.planHelperService=o,this.eventsService=h,this.router=k,this.remainingCredits=0,this.totalCredits=0,this.tooltipText="",this.isCheckLimits=!1,this.unsubscribe$=new Ze(),this.showAvatarBanner=!0,this.enableGenerateButton=!1,this.onOpenAiTwinDashboard=(f=!1)=>{gs.openDashboard(this.dialogHelperService,this.storyTrackCommunicationService,this.isAIMax,this.aiInfluencersService,f);},this.cpSlotsStore=et(ni,{optional:!0}),this.cpProjectAnalytics=et(ii);}ngOnInit(){this.aiInfluencersService.checkUserPlanAndLimits(),this.aiInfluencersService.state$.pipe(me(this.unsubscribe$)).subscribe(e=>{this.avatar?.id!==e.selectedAvatar?.id&&(this.showAvatarBanner=!0),this.avatar=e.selectedAvatar,this.remainingCredits=e.remainingCredits,this.totalCredits=e.totalCredits,this.tooltipText=e.tooltipText,this.isCheckLimits=e.isCheckLimits;}),this.aiInfluencersService.dialogActions$.pipe(me(this.unsubscribe$)).subscribe(e=>{this.handleDialogAction(e);}),this.storyTrackCommunicationService.observeStoryChanged().pipe(me(this.unsubscribe$)).subscribe(e=>{this.story=e,this.script=e?.script,this.enableGenerateButton=e?.script&&e?.script!==""&&e?.script!==".";}),this.storyTrackCommunicationService.observeSelectedScriptTrack().pipe(me(this.unsubscribe$)).subscribe(e=>{let n=e.contentData.script;this.script=n,this.enableGenerateButton=n&&n!==""&&n!==".";}),this.planHelperService.getOrganizationPlansDetails().then(e=>{this.isAIMax=e.display?.name.toLowerCase().includes(yi.AI_MAX);});}get creditsVm(){return{remainingCredits:this.remainingCredits,totalCredits:this.totalCredits,tooltipText:this.tooltipText,loading:this.isCheckLimits};}onGenerateClick(){this.sendClickEvent(At.bannerAvatarGenerate),this.aiInfluencersService.generateWithAI(this.story,this.script);}closeBanner(){this.showAvatarBanner=!1;}onTryAvatarClick(){this.sendClickEvent(At.bannerAvatarAdd),this.router.navigate(["/portrait2video"],{state:{storyId:this.story?.storyId,script:this.script,source:"script"}});}onEditAvatarClick(){this.onAvatarEditClick(),this.onOpenAiTwinDashboard();}onAvatarEditClick(){this.sendClickEvent(At.bannerAvatarEdit);}onClearAvatar(){this.aiInfluencersService.clearAvatar(),this.sendClickEvent(At.bannerAvatarRemove);}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete(),this.aiInfluencersService.resetState();}handleDialogAction(e){switch(e.type){case"upsell":this.openMinutesUpsellDialogFromService(e.data);break;case"generate":this.openGenerateDialogFromService(e.data);break;case"save_story":this.handleSaveStoryAction(e.data);break;case"set_ai_video":this.handleSetAiVideoAction(e.data);break;default:console.warn("Unknown dialog action type:",e.type);}}openMinutesUpsellDialogFromService(e){let n=new We();n.panelClass="assets-dialog",this.dialogHelperService.open(e,us,n);}openGenerateDialogFromService(e){let n=new We();n.panelClass="assets-dialog",this.dialogHelperService.open(e,_l,n);}handleSaveStoryAction(e){this.storyTrackCommunicationService.setSaveStory(e.callback,!1);}handleSetAiVideoAction(e){this.storyTrackCommunicationService.setAIVideo(e);}sendClickEvent(e){this.eventsService.log(this.eventsService.events.script.scriptScreenClick,pe({button:e,storyId:this.story?.storyId},this.cpProjectAnalytics.scriptClickAttrs({story:this.story,slots:this.cpSlotsStore?.slots()})));}static{this.ɵfac=function(n){return new(n||i)(d(Vo),d(Ue),d(He),d(zt),d(Pe),d(bi));};}static{this.ɵcmp=G({type:i,selectors:[["app-ai-influencers-floating-banner"]],standalone:!0,features:[q],decls:1,vars:1,consts:[["noAvatar",""],[4,"ngIf"],["subtitle","selected Avatar","ctaLabel","Generate",3,"thumbnailUrl","name","showClear","showEdit","credits","ctaDisabled","ctaClicked","clearClicked","editClicked",4,"ngIf","ngIfElse"],["subtitle","selected Avatar","ctaLabel","Generate",3,"ctaClicked","clearClicked","editClicked","thumbnailUrl","name","showClear","showEdit","credits","ctaDisabled"],[1,"banner-wrapper"],[1,"no-avatar-wrapper"],[1,"banner-image"],["src","/img/ai-avatar-script-banner/avatars-img.webp","alt","avatars-img"],[1,"banner-text"],[1,"banner-actions-wrapper"],["variant","white-blueblack","size","md",3,"onClick"],["variant","text-royal","iconOnly","exit-icon-new","size","md",3,"onClick"]],template:function(n,t){n&1&&M(0,Nu,4,2,"ng-container",1),n&2&&c("ngIf",t.showAvatarBanner);},dependencies:[Un,Dn,xe,_e,Ws],styles:[".banner-wrapper[_ngcontent-%COMP%]{width:100%;min-width:700px;max-width:700px;height:80px;padding:0 12px;margin:0 auto;display:flex;flex-direction:row;align-items:center;justify-content:space-between;background-color:#4481fd4d;border-radius:12px;border:1px solid rgba(68,129,253,.1490196078);box-sizing:border-box}.no-avatar-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:space-around;
8gap:12px;height:100%;width:100%}.no-avatar-wrapper[_ngcontent-%COMP%] .banner-image[_ngcontent-%COMP%]{width:25%;height:100%}.no-avatar-wrapper[_ngcontent-%COMP%] .banner-image[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain}.no-avatar-wrapper[_ngcontent-%COMP%] .banner-text[_ngcontent-%COMP%]{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;font-size:18px;font-weight:700;color:#253658}.no-avatar-wrapper[_ngcontent-%COMP%] .banner-actions-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:5px}"]});}}return i;})();Nn();ro();vi();J();ht();at();pn();ln();qt();Bn();Zi();Bt();J();var Gs=(()=>{class i{constructor(){this.selectedPortraitSubject=new sn(null),this.selectedPortrait$=this.selectedPortraitSubject.asObservable();}get currentSelectedPortrait(){return this.selectedPortraitSubject.getValue();}setSelectedPortrait(e){this.selectedPortraitSubject.next(e);}clear(){this.selectedPortraitSubject.next(null);}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵprov=Jt({token:i,factory:i.ɵfac,providedIn:"root"});}}return i;})();vi();var Fu=["scrollable"],ju=["collaborate"],Bu=(i,u)=>({"blue-tint":i,"red-tint":u}),Uu=i=>({"blue-tint":!0,disabled:i});function Hu(i,u){if(i&1){let e=U();r(0,"div",16),S("click",function(){let t=T(e).$implicit,o=p();return P(o.onOpenTeleprompterClick(t.value,!0));})("mouseenter",function(){let t=T(e).index,o=p();return P(o.onMouseMenuEnter(10+t));})("mouseleave",function(){let t=T(e).index,o=p();return P(o.onMouseMenuOutput(10+t));}),b(1,"img",17),r(2,"span"),y(3),s()();}if(i&2){let e=u.$implicit,n=u.index,t=p();nt("border-color",e.style==="record-button"?"rgba(123, 141, 177, 0.30)":"transparent"),c("ngClass",fi(6,Bu,e.activeStyle==="blue",e.activeStyle==="red")),a(),c("src",t.hoveredScriptMenuAction===n+10?e.sideIconActiveClass:e.sideIconClass,Ie)("alt",e.name),a(2),de(e.name);}}function zu(i,u){if(i&1){let e=U();r(0,"div",18),S("click",function(){let t=T(e).$implicit;return P(t.actionFunction(t.action));})("mouseenter",function(){let t=T(e).index,o=p();return P(o.onMouseMenuEnter(20+t));})("mouseleave",function(){let t=T(e).index,o=p();return P(o.onMouseMenuOutput(20+t));}),b(1,"img",17),r(2,"span"),y(3),s()();}if(i&2){let e=u.$implicit,n=u.index,t=p();c("matTooltip",e.tooltip||"")("matTooltipDisabled",!e.tooltip)("ngClass",ue(6,Uu,t.isSideBarDisabled)),a(),c("src",t.hoveredScriptMenuAction===n+20?e.activeIconUrl:e.iconUrl,Ie)("alt",e.title),a(2),de(e.title);}}function $u(i,u){i&1&&b(0,"app-ai-influencers-floating-banner");}function Wu(i,u){if(i&1){let e=U();r(0,"app-avatar-info-banner",22),S("ctaClicked",function(){let t=T(e).ngIf,o=p(2);return P(o.onChooseVoiceClick(t));})("editClicked",function(){let t=T(e).ngIf,o=p(2);return P(o.onPortraitEditClick(t));})("clearClicked",function(){T(e);let t=p(2);return P(t.onPortraitClearClick());}),s();}if(i&2){let e=u.ngIf,n=p(2);c("thumbnailUrl",e.thumbnailUrl||e.imageUrl)("name",e.title)("showClear",!0)("showEdit",!0)("credits",n.p2vCredits)("creditsLabel",n.creditsLabel)("ctaLabel",n.chooseVoiceLabel)("ctaDisabled",!n.enableChooseVoice)("ctaLoading",n.isSavingForChooseVoice);}}function Gu(i,u){if(i&1&&(r(0,"div",19),M(1,$u,1,0,"app-ai-influencers-floating-banner",20),tt(2,"async"),M(3,Wu,1,9,"app-avatar-info-banner",21),tt(4,"async"),s()),i&2){let e=p();a(),c("ngIf",!wt(2,2,e.selectedPortrait$)),a(2),c("ngIf",wt(4,4,e.selectedPortrait$));}}function qu(i,u){i&1&&(r(0,"div",23),b(1,"app-cp-slot-message",24),s());}var Qa=(()=>{class i{get selectedPortrait$(){return this.portraitToVideoContextService.selectedPortrait$;}get enableChooseVoice(){let e=(this.currentScript??"").trim();return e.length>0&&e!==".";}constructor(e,n,t,o,h,k,f,m,v,V,te,$,H,j){this.storyTrackCommunicationService=e,this.eventsService=n,this.navigationHelperService=t,this.dialogHelperService=o,this.planHelperService=h,this.aiInfluencersService=k,this.router=f,this.notifier=m,this.premiumPlanService=v,this.creditsService=V,this.portraitToVideoContextService=te,this.photo2VideoService=$,this.cpSlotsStore=H,this.cpProjectAnalytics=j,this.SPINNER_ID="script-story-spinner",this.EVENT_PATH_SCRIPT=this.eventsService.events.script,this.isViewer=!0,this.isAnonymous=!1,this.scriptTrackList=[],this.scriptSidebarSections=[],this.isSideBarDisabled=!0,this.eventListeners=[],this.storySaved=!1,this.exceededScriptLimits=[],this.p2vCredits=null,this.currentScript="",this.isSavingForChooseVoice=!1,this.chooseVoiceLabel="Cho
8ose Voice",this.creditsLabel="Your Credits",this.yieldsToSlotMessage=()=>this.cpSlotsStore.scriptMessageHoldsPinnedStrip(),this.showPinnedStrip=()=>this.cpSlotsStore.slotsResolved(),this.collaborateClick=()=>{this.storyTrackCommunicationService.setSaveStory();},this.setEventListeners=()=>{this.eventListeners.push(this.storyTrackCommunicationService.observeScriptTracks().subscribe(this.setScriptTracks),this.storyTrackCommunicationService.observeStoryChanged().subscribe(F=>{F&&(this.story=F,this.isSideBarDisabled=!1,this.storySaved=!0,F.script!=null&&(this.currentScript=F.script));}),this.storyTrackCommunicationService.observeSelectedScriptTrack().subscribe(F=>{let Z=F?.contentData?.script;Z!=null&&(this.currentScript=Z);}),this.photo2VideoService.creditsState.subscribe(F=>{this.p2vCredits=F;}),this.storyTrackCommunicationService.observeIsViewer().subscribe(this.initBasedOnUser),this.storyTrackCommunicationService.observeIsAnonymous().subscribe(F=>this.isAnonymous=F),this.storyTrackCommunicationService.observeBusiness().subscribe(this.setBusiness),this.storyTrackCommunicationService.observeExceededScriptLimits().subscribe(F=>this.exceededScriptLimits=F));},this.blockIfExceeded=F=>{let Z=this.exceededScriptLimits.find(N=>N.feature===F);return Z?(this.notifier.error(""+Z.reason+" Please shorten your script and try again."),!0):!1;},this.setBusiness=F=>{F&&(this.business=F,this.setToneAndBusiness());},this.setToneAndBusiness=()=>{if(this.isAnonymous)this.setToneOptionsAndFilter();else try{this.setToneOptionsAndFilter(this.business);}catch(F){console.error(F),this.setToneOptionsAndFilter();}},this.setToneOptionsAndFilter=(F,Z)=>{F?this.toneOptions=mr(F.brandStyle):this.toneOptions=mr();},this.initBasedOnUser=F=>{this.isViewer=F,this.isViewer?this.scriptSidebarSections=[]:this.initSidebarOptions();},this.initSidebarOptions=()=>{this.scriptSidebarSections=this.isAnonymous?Va().filter(F=>F.action!=zn.SHARE):Va();for(let F of this.scriptSidebarSections)F.action===zn.SHARE||F.action===zn.AI_TWIN||F.action===zn.PORTRAIT2VIDEO?F.actionFunction=this.handleScriptMenuAction:F.actionFunction=this.handleScriptMenuSidebar;},this.onMouseMenuEnter=F=>{this.hoveredScriptMenuAction=F;},this.onMouseMenuOutput=F=>{this.hoveredScriptMenuAction=void 0;},this.onOpenTeleprompterClick=(F,Z)=>{this.storyTrackCommunicationService.setTeleprompterClick({mode:F,shouldSave:Z});},this.setScriptTracks=F=>{F&&(this.storySaved=!1,this.scriptTrackList=F);},this.toggleBar=F=>this.navigationHelperService.toggleMediaSidebarWithResult(F,!0),this.handleScriptMenuAction=F=>I(this,null,function*(){switch(F){case zn.SHARE:this.scriptScreenClickEvent(At.share),this.collaborate&&(yield this.collaborate.clickBtn());break;case zn.AI_TWIN:this.scriptScreenClickEvent(At.avatar),this.portraitToVideoContextService.currentSelectedPortrait?this.confirmExitP2VForAiAvatar():this.openAiAvatarDashboard();break;case zn.PORTRAIT2VIDEO:if(this.blockIfExceeded(hn.portrait2Video))return;if(!this.hasPortraitToVideo){let Q=this.router.url;this.premiumPlanService.openPricingDialog(yi.AI_MAX,Q,Q,pt.portrait2Video);return;}let Z=this.scriptTrackList.length>0&&this.scriptTrackList[0].contentData?.script||"",N=()=>{let Q=this.story?.storyId;this.ValidateStoryIdAndScript(Q,Z)&&this.navigateToPortrait2Video(Q,Z);};this.storySaved?N():this.storyTrackCommunicationService.setSaveStory(N);break;}}),this.handleScriptMenuSidebar=F=>I(this,null,function*(){if(this.isViewer||F===Je.AUDIOGRAM&&this.blockIfExceeded(hn.audiogram))return;let Z=this.toggleBar(F);if(F===Je.AUDIOGRAM&&Z)this.scriptScreenClickEvent(At.voiceGenerate),this.storySaved?this.storyTrackCommunicationService.setAiSidebarOpen(!0):this.storyTrackCommunicationService.setSaveStory(()=>{this.storyTrackCommunicationService.setAiSidebarOpen(!0);});else if((F===Je.AI_REWRITE||F===Je.WHITEBOARD)&&Z){this.storyTrackCommunicationService.setAiSidebarOpen(!0);let N={storyId:this.story?.storyId,aiFeature:"rewrite"};try{let Q=yield this.storyTrackCommunicationService.getAiLimits();N.creditsRemaining=this.creditsService.getFeatureAvailableCredits(Q,"aiScript");}
8catch(Q){console.error(Q);}finally{F===Je.AI_REWRITE?this.scriptScreenClickEvent(At.scriptRewrite):F===Je.WHITEBOARD&&this.scriptScreenClickEvent(At.whiteboard);}}else F===Je.AI_CHECKER_V2&&Z?(this.scriptScreenClickEvent(At.scriptChecker),this.storyTrackCommunicationService.setAiCheckSidebarOpen()):F===Je.EMOTIONS&&Z&&this.storyTrackCommunicationService.setAiSidebarOpen(!0);}),this.openMobileApp=()=>{window.open("https://bigvu.tv/app","_blank");},this.scriptScreenClickEvent=F=>{this.eventsService.log(this.EVENT_PATH_SCRIPT.scriptScreenClick,pe({storyId:this.story?.storyId,button:F},this.cpProjectAnalytics.scriptClickAttrs({story:this.story,slots:this.cpSlotsStore.slots()})));},this.navigateToPortrait2Video=(F,Z)=>{this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoBannerClick,{}),this.router.navigate(["/portrait2video"],{state:{storyId:F,script:Z,source:"script"}});},this.onChooseVoiceClick=F=>{!this.enableChooseVoice||this.isSavingForChooseVoice||this.blockIfExceeded(hn.portrait2Video)||(this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoNext,{portraitName:F?.title??"",portraitSource:this.mapPortraitSourceForEvent(F),stage:"script"}),this.isSavingForChooseVoice=!0,this.storyTrackCommunicationService.setSaveStory(Z=>{let N=Z?.storyId??this.story?.storyId;if(!N){this.isSavingForChooseVoice=!1;return;}this.router.navigate(["/portrait2video"],{state:{portrait:F,storyId:N,script:this.currentScript,returnTo:"voice"}}).finally(()=>{this.isSavingForChooseVoice=!1;});},!1));},this.onPortraitEditClick=F=>{this.eventsService.log(this.eventsService.events.portrait2video.portrait2videoBannerClick,{}),this.router.navigate(["/portrait2video"],{state:{portrait:F,storyId:this.story?.storyId,script:this.currentScript,returnTo:"portrait",source:"script"}});},this.onPortraitClearClick=()=>{this.portraitToVideoContextService.clear();},this.clearP2VWizardState=()=>{this.portraitToVideoContextService.clear();try{sessionStorage.removeItem("talking-photo-wizard-state");}catch{}},this.openAiAvatarDashboard=()=>{gs.openDashboard(this.dialogHelperService,this.storyTrackCommunicationService,this.isAIMax,this.aiInfluencersService);},this.confirmExitP2VForAiAvatar=()=>{this.dialogHelperService.showUiConfirmationDialog({title:"Exit Talking Photo?",msg:"Starting the AI Avatar flow will discard your current Talking Photo selection. Do you want to continue?",confirmationText:"Continue",cancellationText:"Cancel",onSubmit:()=>{this.dialogHelperService.close(),this.clearP2VWizardState(),this.openAiAvatarDashboard();},onClose:()=>this.dialogHelperService.close()});},this.ValidateStoryIdAndScript=(F,Z)=>{if(!F)return this.notifier.error("Cannot navigate: Story ID is missing. Please save your story and try again."),!1;if(!Z||Z.trim().length===0)return this.notifier.error("Cannot navigate: Script is empty. Please add content to your script."),!1;if(this.hasExtendedPortraitScript){let Q=Z.length;return Q>$n?(this.notifier.error("Your script is too long. It contains "+Q.toLocaleString()+" characters, but the maximum allowed is "+$n.toLocaleString()+" characters. Please shorten your script and try again."),!1):!0;}let N=Lo(Z);return N>Fo?(this.notifier.error("Your script is too long. It contains "+N+" words, but the maximum allowed is "+Fo+" words. Please shorten your script and try again."),!1):!0;};}ngOnInit(){return I(this,null,function*(){this.teleprompterButtons=cd(),this.setEventListeners(),this.isAIMax=yield this.planHelperService.isAIMaxPlanByCurrentPlan();let e=yield this.creditsService.getCreditsUsage();this.hasPortraitToVideo=this.creditsService.isFeatureEnabled(e,"portraitToVideo"),this.hasExtendedPortraitScript=this.creditsService.isFeatureEnabled(e,"portraitToVideoCameraAngles")||this.creditsService.isFeatureEnabled(e,"portraitToVideoExtended"),yield this.initializeAvatarFromRoute(),this.initializePortraitFromRoute(),this.photo2VideoService.checkUserPlanAndLimits();});}initializeAvatarFromRoute(){return I(this,null,function*(){let n=this.router.getCurrentNavigation()?.extras?.state||history.state;n?.selectedAvatar&&this.aiInfluencersService.initializeWithAvatar(n.selectedAvatar,n.selectedAvatarIndex||-1);});}initializePortraitFromRoute(){let n=this.router.getCurrentNavigation()?.extras?.state||history.state;n?.portrait&&this.portraitToVideoContextService.setSelectedPortrait(n.portrait);}
8ngOnDestroy(){this.eventListeners.forEach(e=>e.unsubscribe()),this.portraitToVideoContextService.clear(),this.isSavingForChooseVoice=!1;}mapPortraitSourceForEvent(e){return e?e._isFreshUpload?"upload":e.source==="content bank"?"bank":"library":"library";}static{this.ɵfac=function(n){return new(n||i)(d(He),d(Pe),d(ei),d(Ue),d(zt),d(Vo),d(bi),d(Ge),d(hi),d(Vt),d(Gs),d(Cp),d(ni),d(ii));};}static{this.ɵcmp=G({type:i,selectors:[["story-script-v2"]],viewQuery:function(n,t){if(n&1&&(Ye(Fu,7),Ye(ju,7)),n&2){let o;Ne(o=Fe())&&(t.scrollableContainer=o.first),Ne(o=Fe())&&(t.collaborate=o.first);}},standalone:!0,features:[Vi([Vo]),q],decls:17,vars:19,consts:[["scrollable",""],["collaborate",""],[1,"script-story-v2-container"],[1,"left-side"],[3,"title","hasBack"],["class","script-action-list-option",3,"border-color","ngClass","click","mouseenter","mouseleave",4,"ngFor","ngForOf"],["class","script-action-list-option","matTooltipPosition","right","matTooltipClass","tooltip-custom-black-script-long",3,"matTooltip","matTooltipDisabled","ngClass","click","mouseenter","mouseleave",4,"ngFor","ngForOf"],[1,"tips-wrapper-script",3,"click"],[3,"mobileMode","storyId"],[1,"tips-wrapper-script-not-mobile"],[3,"storyId"],["id","#step2",1,"script-track-textarea-wrapper"],[3,"toneOptions","scrollableContainer"],["class","ai-influencers-floating-banner-wrapper",4,"ngIf"],["class","cp-slot-message-wrapper",4,"ngIf"],[1,"hidden-element",3,"onClick","pageOrigin","storyId"],[1,"script-action-list-option",3,"click","mouseenter","mouseleave","ngClass"],[3,"src","alt"],["matTooltipPosition","right","matTooltipClass","tooltip-custom-black-script-long",1,"script-action-list-option",3,"click","mouseenter","mouseleave","matTooltip","matTooltipDisabled","ngClass"],[1,"ai-influencers-floating-banner-wrapper"],[4,"ngIf"],["subtitle","Selected Portrait",3,"thumbnailUrl","name","showClear","showEdit","credits","creditsLabel","ctaLabel","ctaDisabled","ctaLoading","ctaClicked","editClicked","clearClicked",4,"ngIf"],["subtitle","Selected Portrait",3,"ctaClicked","editClicked","clearClicked","thumbnailUrl","name","showClear","showEdit","credits","creditsLabel","ctaLabel","ctaDisabled","ctaLoading"],[1,"cp-slot-message-wrapper"],["scope","script"]],template:function(n,t){if(n&1){let o=U();r(0,"div",2)(1,"div",3)(2,"app-script-action-menu",4),M(3,Hu,4,9,"div",5),s(),r(4,"app-script-action-menu",4),M(5,zu,4,8,"div",6),s()(),r(6,"div",7),S("click",function(){return T(o),P(t.openMobileApp());}),b(7,"script-tips-dialog",8),s(),r(8,"div",9),b(9,"script-tips-dialog",10),s(),r(10,"div",11,0),b(12,"script-track-list",12),s(),M(13,Gu,5,6,"div",13)(14,qu,2,0,"div",14),s(),r(15,"app-portable-collaborate-widget",15,1),S("onClick",function(){return T(o),P(t.collaborateClick());}),s();}n&2&&(a(2),nt("opacity",t.isViewer?0:100,"%"),c("title","Teleprompter")("hasBack",!0),a(),c("ngForOf",t.teleprompterButtons),a(),nt("opacity",t.isViewer?0:100,"%"),c("title","AI Scripts")("hasBack",!0),a(),c("ngForOf",t.scriptSidebarSections),a(2),c("mobileMode",!0)("storyId",(t.story==null?null:t.story.storyId)||""),a(2),c("storyId",(t.story==null?null:t.story.storyId)||""),a(3),c("toneOptions",t.toneOptions)("scrollableContainer",t.scrollableContainer),a(),c("ngIf",t.showPinnedStrip()&&!t.yieldsToSlotMessage()),a(),c("ngIf",t.showPinnedStrip()&&t.yieldsToSlotMessage()),a(),c("pageOrigin","script-story")("storyId",(t.story==null?null:t.story.storyId)||""));},dependencies:[wp,Si,Tp,Pp,Le,_e,we,Ur,Op,Ip,Ws,Hi,Xt,Os],styles:[".script-story-v2-container[_ngcontent-%COMP%]{width:100%;height:100vh;display:flex;justify-content:flex-start;align-items:flex-start;gap:110px;overflow:hidden;background-color:#7b8db12e;padding:0}.disabled[_ngcontent-%COMP%]{pointer-events:none}.script-story-v2-container[_ngcontent-%COMP%] .left-side[_ngcontent-%COMP%]{width:437px;padding-top:17px}.script-story-v2-container[_ngcontent-%COMP%] .script-track-textarea-wrapper[_ngcontent-%COMP%]{height:calc(100vh - 100px);width:100%;overflow-y:scroll;padding-top:40px;position:relative;scroll-snap-type:y mandatory;scroll-snap-align:end}.script-story-v2-container[_ngcontent-%COMP%] .script-track-textarea-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar:horizontal{display:none!important} .script-story-v2-container .script-track-textarea-wrapper .story-track-list-component .track-list-container{max-width:680px}.hidden-element[_ngcontent-%COMP%]{display:none}@media only screen and (max-width: 1340px){ .script-story-v2-container .script-track-textarea-wrapper .story-track-list-component .track-list-container{max-width:500px}.script-story-v2-container[_ngcontent-%COMP%]{gap:128px}}.tips-wrapper-script-not-mobile[_ngcontent-%COMP%]{display:block;cursor:pointer;position:absolute;right:12px;padding:40px 8px 0;z-index:100}.tips-wrapper-script[_ngcontent-%COMP%]{display:none}.script-action-list-option[_ngcontent-%COMP%]{color:#253658;font-size:14px;font-weight:600;border-radius:10px;display:flex;align-items:center;cursor:pointer;gap:12px;padding:8px 16px;width:100%;border:1px solid transparent}.script-action-list-option[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:24px;height:24px}.blue-tint[_ngcontent-%COMP%]:hover{background:#4481fd14;
8color:#4481fd}.red-tint[_ngcontent-%COMP%]:hover{background:#ff4d5b;color:#fff}.ai-influencers-floating-banner-wrapper[_ngcontent-%COMP%]{position:absolute;bottom:30px;left:0;width:100%;z-index:30}.cp-slot-message-wrapper[_ngcontent-%COMP%]{position:absolute;bottom:30px;left:0;width:100%;display:flex;justify-content:center;padding:0 16px;z-index:31;pointer-events:none}.cp-slot-message-wrapper[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{width:100%;max-width:680px;pointer-events:auto}@media only screen and (max-width: 768px){.tips-wrapper-script[_ngcontent-%COMP%]{display:block;padding:0 8px;cursor:pointer}.tips-wrapper-script-not-mobile[_ngcontent-%COMP%]{display:none}.script-story-v2-container[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;gap:40px;overflow-y:scroll} .script-story-v2-container .script-track-textarea-wrapper .story-track-list-component .track-list-container{max-width:unset;padding-right:20px}.script-story-v2-container[_ngcontent-%COMP%] .script-track-textarea-wrapper[_ngcontent-%COMP%]{overflow:unset}.left-side[_ngcontent-%COMP%]{display:none}}"]});}}return i;})();J();at();ae();var Ku=i=>i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Ep=i=>{let u="Untitled draft";return`<ul class="take-delete-drafts-list">${i.map(n=>`<li>${Ku(n.headline?.trim()||u)}</li>`).join("")}</ul>`;};Ui();Bi();Ei();ae();J();Zr();ae();var Qu=i=>({"edit-btn-disabled":i}),Yu=i=>({"share-btn-disabled":i});function Ju(i,u){if(i&1){let e=U();r(0,"div",11),S("click",function(){let t=T(e).$implicit,o=p(2);return P(o.onActionsSelect(t.value));}),b(1,"img",12),r(2,"div"),y(3),s(),r(4,"div",13),y(5),s()();}if(i&2){let e=u.$implicit;c("ngClass",ue(6,Qu,!e.isActive)),a(),nt("margin-bottom",12,"px"),c("src",e.sideIconClass,Ie),a(2),se("",e.name," "),a(2),de(e.activeStyle);}}function Xu(i,u){if(i&1&&(r(0,"div",9),M(1,Ju,6,8,"div",10),s()),i&2){let e=p();a(),c("ngForOf",e.editActionsList);}}function Zu(i,u){if(i&1){let e=U();r(0,"div",16),S("click",function(){let t=T(e).$implicit,o=p(2);return P(o.onActionsSelect(t.value));}),b(1,"img",12),r(2,"div"),y(3),s()();}if(i&2){let e=u.$implicit;c("ngClass",ue(3,Yu,!e.isActive)),a(),c("src",e.sideIconClass,Ie),a(2),de(e.name);}}function eg(i,u){if(i&1&&(r(0,"div",14),M(1,Zu,4,5,"div",15),s()),i&2){let e=p();a(),c("ngForOf",e.shareActionsList);}}var qs=class extends Tt{},Ap=(()=>{class i extends Pt{constructor(e,n){super(e),this.data=e,this.localTakeHelperService=n,this.editActionsList=[],this.shareActionsList=[],this.allowedOptionsForViewer=[ci.downloadRealTake,ci.downloadMp4,ci.downloadWebM,ci.embed,ci.copyThumbnail],this.onActionsSelect=t=>{if(this.data.isViewer){if(this.allowedOptionsForViewer.includes(t)){let o={track:this.data.take,action:t};this.data.onSubmit(o);}}else{let o={track:this.data.take,action:t};this.data.onSubmit(o);}};}ngOnInit(){return I(this,null,function*(){this.isLoading=!0;let e=!!this.data.story.captions.find(n=>n.groupId===this.data.take.video?.groupId&&n.status===2);if(this.data.take.status===0&&this.data.take.localTake?.id)try{let n=yield this.localTakeHelperService.getVideo(this.data.take.localTake.id);n&&n.file&&(this.data.take.localTake.mimeType=n.file.type);}catch(n){console.error("Failed to load video for format detection:",n);}this.editActionsList=vd({status:this.data.take.status,kind:this.data.take.kind,composerDeleted:this.data.take.composerDeleted,composerStoryType:this.data.take.composerStoryType}),this.shareActionsList=_d(this.data.take.status,e,this.data.take),this.editActionsList.forEach(n=>n.isActive=this.data.isViewer?this.allowedOptionsForViewer.includes(n.value):n.isActive!==!1),this.shareActionsList.forEach(n=>n.isActive=this.data.isViewer?this.allowedOptionsForViewer.includes(n.value):!0),this.isLoading=!1;});}static{this.ɵfac=function(n){return new(n||i)(d(yt),d(Rn));};}static{this.ɵcmp=G({type:i,selectors:[["story-take-actions-project-dialog"]],standalone:!0,features:[Ae,q],decls:12,vars:2,consts:[[1,"story-take-actions-dialog-container"],[1,"edit-side"],[1,"take-close-button",3,"click"],["aria-label","Close"],["src","/img/sidebar-close-icon.svg","alt","image"],[1,"title"],["class","edit-btns-container",4,"ngIf"],[1,"share-side"],["class","share-btns-container",4,"ngIf"],[1,"edit-btns-container"],["class","edit-btn",3,"ngClass","click",4,"ngFor","ngForOf"],[1,"edit-btn",3,"click","ngClass"],["alt","",3,"src"],[1,"subtitle-small"],[1,"share-btns-container"],["class","share-btn",3,"ngClass","click",4,"ngFor","ngForOf"],[1,"share-btn",3,"click","ngClass"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1)(2,"div",2),S("click",function(){return t.data.onClose();}),r(3,"button",3),b(4,"img",4),s()(),r(5,"div",5),y(6," Edit "),s(),M(7,Xu,2,1,"div",6),s(),r(8,"div",7)(9,"div",5),y(10," Share "),s(),M(11,eg,2,1,"div",8),s()()),n&2&&(a(7),c("ngIf",!t.isLoading),a(4),c("ngIf",!t.isLoading));},dependencies:[xe,we,Le,_e],styles:[".story-take-actions-dialog-container[_ngcontent-%COMP%]{width:100%;height:100%;padding:32px;display:flex;justify-content:flex-start;align-items:flex-start;gap:32px;overflow:hidden;position:relative}.take-close-button[_ngcontent-%COMP%]{position:absolute;top:28px;right:28px}.story-take-actions-dialog-container[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{font-family:Inter-Bold;font-style:normal;font-weight:600;font-size:16px;line-height:19px;color:#253658;margin-bottom:24px}.edit-side[_ngcontent-%COMP%]{width:70%;height:100%}.edit-btns-container[_ngcontent-%COMP%]{width:100%;display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:flex-start;gap:16px}.beta[_ngcontent-%COMP%]{color:#0d80dc}.subtitle-small[_ngcontent-%COMP%]{color:#25365899;text-align:center;font-size:11px;font-weight:600;height:11px}.edit-btn[_ngcontent-%COMP%]{width:164px;
8height:136px;display:flex;flex-direction:column;align-items:center;justify-content:center;font-weight:600;font-size:14px;line-height:20px;color:#253658;cursor:pointer;border:1px solid rgba(123,141,177,.3);border-radius:20px;text-align:center}.edit-btn-disabled[_ngcontent-%COMP%]{cursor:default;opacity:.5}.edit-btn[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:48px;height:48px;background-repeat:no-repeat;background-size:contain;background-position:center;text-indent:100vw}.share-side[_ngcontent-%COMP%]{width:30%;height:100%}.share-btns-container[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:column}.share-btn[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;gap:12px;padding-bottom:12px;border-bottom:1px solid rgba(123,141,177,.3);font-weight:400;font-size:16px;line-height:19px;color:#253658;cursor:pointer;margin-bottom:12px}.share-btn[_ngcontent-%COMP%]:last-child{border-bottom:unset}.share-btn-disabled[_ngcontent-%COMP%]{cursor:default;opacity:.5}.share-btn[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:32px;height:32px;background-repeat:no-repeat;background-size:contain;background-position:center;text-indent:100vw}.delete-btn-full-width[_ngcontent-%COMP%]{width:524px;flex-direction:row;height:64px}.generate-translate[_ngcontent-%COMP%]{padding-top:20px}"]});}}return i;})();Oa();var Dp=(i,u)=>`<!DOCTYPE html><html lang="en"><head> <style></style></head><body> <a href="${u}" style="position: relative; background-image:url(); background-position:center; background-repeat:no-repeat; background-size:100px; cursor:pointer; display:table;"> <img src="${i}" alt="Thumbnail for video" style="width:auto; height:207px;" /> </a> <span style="box-sizing:inherit; cursor:default; display:inline-block; font-family:inherit; font-size:inherit; margin:inherit; padding:inherit; text-decoration:none; background-color:transparent;"> <a href="${u}" style="box-sizing:inherit; cursor:pointer; display:inline-block; font-family:inherit; font-size:inherit; margin:inherit; padding:inherit; text-decoration:none; background-color:transparent;"> Watch Video </a> </span></body></html>`;Bi();Ei();Ni();ae();J();var Lp=(()=>{class i{transform(e){let n=new Date(0);return n.setSeconds(e),n.setMilliseconds(e%1*1e3),n.toISOString().substring(14,23);}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵpipe=Ar({name:"timeMmSsMs",type:i,pure:!0,standalone:!0});}}return i;})();J();Ni();var Vp=i=>({active:i});function ig(i,u){i&1&&b(0,"img",24);}function ng(i,u){if(i&1&&(r(0,"div",28),y(1),s()),i&2){let e=p(2);a(),de(e.leftSegmentText);}}function og(i,u){if(i&1&&(r(0,"div",29)(1,"div"),y(2),tt(3,"timeMmSsMs"),s(),r(4,"div"),b(5,"i",30),s()()),i&2){let e=p(2);a(2),de(wt(3,1,e.leftSegment.time));}}function rg(i,u){if(i&1&&(r(0,"div",25),M(1,ng,2,1,"div",26)(2,og,6,3,"div",27),s()),i&2){let e=p();nt("width",e.segLeftWidth,"px")("left",e.segLeftPos,"px"),a(),c("ngIf",e.segLeftWidth>40),a(),c("ngIf",e.segLeftWidth>40);}}function sg(i,u){if(i&1){let e=U();r(0,"button",31),S("mousedown",function(t){T(e);let o=p();return P(o.onHandleMouseDown(t,"left"));}),b(1,"div",32),s();}}function ag(i,u){if(i&1){let e=U();r(0,"button",31),S("mousedown",function(t){T(e);let o=p();return P(o.onHandleMouseDown(t,"right"));}),b(1,"div",32),s();}}function cg(i,u){if(i&1&&(r(0,"div",28),y(1),s()),i&2){let e=p(2);a(),de(e.rightSegmentText);}}function lg(i,u){if(i&1&&(r(0,"div",34)(1,"div"),y(2),tt(3,"timeMmSsMs"),s(),r(4,"div"),b(5,"i",30),s()()),i&2){let e=p(2);a(2),de(wt(3,1,e.originalTakeDuration));}}function dg(i,u){if(i&1&&(r(0,"div",25),M(1,cg,2,1,"div",26)(2,lg,6,3,"div",33),s()),i&2){let e=p();nt("width",e.segRightWidth,"px")("right",e.segRightPos,"px"),a(),c("ngIf",e.segRightWidth>30),a(),c("ngIf",e.segRightWidth>40);}}var Rp=(()=>{class i extends bp{constructor(e,n,t){super(e,n,t),this.data=e,this.videoPlayerService=n,this.ngxSpinner=t,this.leftOffsetFlag=!1,this.rightOffsetFlag=!1,this.checkSaveButtonStatus=()=>{this.saveButtonStatus=this.originalTakeDuration-this.mainSegment.duration>=.3&&this.mainSegment.duration>=1;},this.handlebarMouseMove=o=>
8{let h=o.screenX-this.srcMouseX;if(h===0||this.pressedHandleId===void 0)return;let k=0,f=0;k=h*this.pxToSecRatio,f=this.srcVideoDurationSec+k;let m=0;switch(this.pressedHandleId){case"left":k=h*this.pxToSecRatio,f=this.srcVideoDurationSec+k,m=this.videoStartTimeSec+k,h<0?(m=m-this.leftSegment.time<=this.minSegmentDurationSec?this.minSegmentDurationSec+this.leftSegment.time:m,f=this.srcVideoDurationSec+(this.videoStartTimeSec-m),h=-(this.videoStartTimeSec-m)/this.pxToSecRatio):h>0&&(this.leftSegment&&this.rightSegment&&(m=this.videoEndTimeSec-m<=this.minSegmentDurationSec?this.videoEndTimeSec-this.minSegmentDurationSec:m),m=this.maxVideoEndTimeSec-m<=this.minSegmentDurationSec?this.maxVideoEndTimeSec-this.minSegmentDurationSec:m,f=this.srcVideoDurationSec-(m-this.videoStartTimeSec),h=(m-this.videoStartTimeSec)/this.pxToSecRatio),h<0&&this.srcSegLeftWidth+h<this.minSegmentWidth&&(h=this.minSegmentWidth-this.srcSegLeftWidth),h>0&&this.srcSegMainWidth-h<this.minActiveSegmentWidth&&(h=this.srcSegMainWidth-this.minActiveSegmentWidth),m=this.videoStartTimeSec+h*this.pxToSecRatio,f=h<0?this.srcVideoDurationSec+(this.videoStartTimeSec-m):this.srcVideoDurationSec-(m-this.videoStartTimeSec),h>0&&m-this.leftSegment.time>this.maxLeftDuration&&(m=this.maxLeftDuration+this.leftSegment.time,h=(m-this.videoStartTimeSec)/this.pxToSecRatio,f=this.srcVideoDurationSec-(m-this.videoStartTimeSec)),h<0&&f>this.maxMainDuration&&(f=this.maxMainDuration,m=this.srcVideoDurationSec+this.videoStartTimeSec-f,h=(m-this.videoStartTimeSec)/this.pxToSecRatio),this.segLeftWidth=this.srcSegLeftWidth+h,this.segMainPos=this.srcSegLeftWidth+h+this.trimmerSegmentSpacing,this.segMainWidth=this.srcSegMainWidth-h,this.mainSegment.time=m,this.mainSegment.duration=f,this.leftSegment.duration=m-this.leftSegment.time;break;case"main":m=this.videoStartTimeSec+k,m=this.maxVideoEndTimeSec-(m+this.srcVideoDurationSec)<=this.minSegmentDurationSec?this.maxVideoEndTimeSec-this.minSegmentDurationSec-this.srcVideoDurationSec:m,m=m-this.leftSegment.time<=this.minSegmentDurationSec?this.leftSegment.time+this.minSegmentDurationSec:m,h=(m-this.videoStartTimeSec)/this.pxToSecRatio,this.srcSegLeftWidth+h<this.minSegmentWidth&&(h=this.minSegmentWidth-this.srcSegLeftWidth),this.srcSegRightWidth-h<this.minSegmentWidth&&(h=this.srcSegRightWidth-this.minSegmentWidth),m=this.videoStartTimeSec+h*this.pxToSecRatio,h>0&&m-this.leftSegment.time>this.maxLeftDuration&&(m=this.maxLeftDuration+this.leftSegment.time,h=(m-this.videoStartTimeSec)/this.pxToSecRatio),h<0&&this.maxVideoEndTimeSec-(m+this.srcVideoDurationSec)>this.maxRightDuration&&(m=this.maxVideoEndTimeSec-this.maxRightDuration-this.srcVideoDurationSec,h=(m-this.videoStartTimeSec)/this.pxToSecRatio),this.segLeftWidth=this.srcSegLeftWidth+h,this.segMainPos=this.srcSegLeftWidth+h+this.trimmerSegmentSpacing,this.segRightWidth=this.srcSegRightWidth-h,this.leftSegment.duration=m-this.leftSegment.time,this.mainSegment.time=m,this.rightSegment.time=m+this.srcVideoDurationSec,this.rightSegment.duration=this.maxVideoEndTimeSec-this.rightSegment.time;break;case"right":m=this.videoEndTimeSec+k,h<0?(m=f<=this.minSegmentDurationSec?this.videoStartTimeSec+this.minSegmentDurationSec:m,f=this.srcVideoDurationSec+(this.videoStartTimeSec+m),h=-(this.videoEndTimeSec-m)/this.pxToSecRatio):h>0&&(m=this.maxVideoEndTimeSec-m<=this.minSegmentDurationSec?this.maxVideoEndTimeSec-this.minSegmentDurationSec:m,f=m-this.videoStartTimeSec,h=-(this.videoEndTimeSec-m)/this.pxToSecRatio),h<0&&this.srcSegMainWidth+h<this.minActiveSegmentWidth&&(h=this.minActiveSegmentWidth-this.srcSegMainWidth),h>0&&this.srcSegRightWidth-h<this.minSegmentWidth&&(h=this.srcSegRightWidth-this.minSegmentWidth),m=this.videoEndTimeSec+h*this.pxToSecRatio,f=h<0?this.srcVideoDurationSec+(this.videoStartTimeSec+m):m-this.videoStartTimeSec,h<0&&this.maxVideoEndTimeSec-m>this.maxRightDuration&&(m=this.maxVideoEndTimeSec-this.maxRightDuration,f=m-this.videoStartTimeSec,h=(f-this.srcVideoDurationSec)/this.pxToSecRatio),h>0&&f>this.maxMainDuration&&(f=this.maxMainDuration,m=this.videoStartTimeSec+f,h=this.maxMainWidth-this.srcSegMainWidth),this.segMainWidth=this.srcSegMainWidth+h,this.segRightWidth=this.srcSegRightWidth-h,f=this.srcVideoDurationSec+this.pxToSecRatio*h,this.mainSegment.duration=f,this.rightSegment.time=this.videoStartTimeSec+f,this.rightSegment.duration=this.maxVideoEndTimeSec-m;break;}this.checkSaveButtonStatus(),this.mainSegmentText=this.segMainWidth>this.minSegmentWidthText?`Segment ${String(this.mainSegment.index).padStart(2,"0")}`:`${String(this.mainSegment.index).padStart(2,"0")}`,this.updateMaxDurations();},this.minSegmentWidth=0,this.minSegmentDurationSec=0,this.trimmerSegmentSpacing=4;}ngOnInit(){super.ngOnInit(),this.originalTakeDuration=this.data.mainSegment.duration+this.data.leftSegment.duration+this.rightSegment.duration,this.checkSaveButtonStatus();}ngAfterViewInit(){super.ngAfterViewInit();}ngOnDestroy(){super.ngOnDestroy();}static{this.ɵfac=function(n){return new(n||i)(d(yt),d(Ao),d(nl));};}static{this.ɵcmp=G({type:i,selectors:[["take-trimmer"]],standalone:!0,features:[Ae,q],decls:39,vars:35,consts:[[1,"segmentation-editor-container"],[1,"header-container"],[1,"close-button",3,"click"],[1,"header-title"],[1,"header-text"],[1,"buttons-container"],[1,"add-button"],[1,"blue",3,"click","ngClass"],[1,"save-button"],[3,"click","ngClass"],[1,"video-container",3,"click"],["src","/img/composer-icons/preview-play-icon.svg","class","video-container-play","alt","image",4,"ngIf"],["name","segment-editor-spinner","type","cog","size","medium",3,"fullScreen","zIndex"],[1,"video-js","vjs-default-skin","vjs-big-play-centered",3,"loadedmetadata","playing","pause","id"],[3,"src"],[1,"scene-trimmer-container"],["class","scene-slider",3,"width","left",4,"ngIf"],[1,"scene-slider","active",2,"z-index","1"],["class","slider-handle",3,"mousedown",4,"ngIf"],[1,"segment-label","active",3,"mousedown"],[1,"time-indicators","start-indicator","active"],[1,"arrow-indicator","active"],[1,"time-indicators","end-indicator","active"],["class","scene-slider",3,"width","right",4,"ngIf"],["src","/img/composer-icons/preview-play-icon.svg","alt","image",1,"video-container-play"],[1,"scene-slider"],["class","segment-label",4,"ngIf"],["class","time-indicators start-indicator",4,"ngIf"],[1,"segment-label"],[1,"time-indicators","start-indicator"],[1,"arrow-indicator"],[1,"slider-handle",3,"mousedown"],[1,"handle-label"],["class","time-indicators end-indicator",4,"ngIf"],[1,"time-indicators","end-indicator"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1)(2,"div",2),S("click",function(){return t.close();}),s(),r(3,"div",3)(4,"div",4),y(5),s(),r(6,"div",5)(7,"div",6)(8,"button",7),S("click",function(){return t.saveButtonStatus&&t.submit({dialogData:t.dialogData,method:"add"});}),y(9," Add to sequence "),s()(),r(10,"div",8)(11,"button",9),S("click",function(){return t.saveButtonStatus&&t.submit({dialogData:t.dialogData,method:"trim"});}),y(12," Save "),s()()()()(),r(13,"div",10),S("click",function(h){return t.onPlayerClicked(h);}),r(14,"div"),M(15,ig,1,0,"img",11),b(16,"ngx-spinner",12),s(),r(17,"video",13),S("loadedmetadata",function(h){return t.onLoadedMetadata(h);})("playing",function(h){return t.onPlayingVideo(h);})("pause",function(h){return t.onPlayerPaused(h);}),b(18,"source",14),s()(),r(19,"div",15),M(20,rg,3,6,"div",16),r(21,"div",17),M(22,sg,2,0,"button",18),r(23,"div",19),S("mousedown",function(h){return t.onHandleMouseDown(h,"main");}),y(24),s(),r(25,"div",20)(26,"div"),y(27),tt(28,"timeMmSsMs"),s(),r(29,"div"),b(30,"i",21),s()(),r(31,"div",22)(32,"div"),y(33),tt(34,"timeMmSsMs"),s(),r(35,"div"),b(36,"i",21),s()(),M(37,ag,2,0,"button",18),s(),M(38,dg,3,6,"div",23),s()()),n&2&&(a(5),se(" ",t.dialogData.header," "),a(3),c("ngClass",ue(31,Vp,t.saveButtonStatus)),a(3),c("ngClass",ue(33,Vp,t.saveButtonStatus)),a(2),nt("width",t.trimmerWidth,"px"),a(2),c("ngIf",!t.isVideoPlaying&&!t.pressedHandleId&&!t.isVideoLoading),a(),c("fullScreen",!1)("zIndex",1),a(),Gc("id",t.PLAYER_ID),a(),c("src",t.previewUrl,Ie),a(),nt("width",t.trimmerWidth,"px"),a(),c("ngIf",t.leftSegment),a(),nt("width",t.segMainWidth,"px")("left",t.segMainPos,"px")("min-width",t.minActiveSegmentWidth,"px"),a(),c("ngIf",t.leftSegment),a(),cn("disableMove",!t.segMainCanMove),a(),se(" ",t.mainSegmentText," "),a(3),de(wt(28,27,t.mainSegment.time)),a(6),de(wt(34,29,t.mainSegment.time+t.mainSegment.duration)),a(4),c("ngIf",t.rightSegment),a(),c("ngIf",t.rightSegment));},dependencies:[we,_e,Si,dn,Lp],styles:['.segmentation-editor-container[_ngcontent-%COMP%]{width:565px;-webkit-user-select:none;user-select:none}.header-container[_ngcontent-%COMP%]{position:relative}.close-button[_ngcontent-%COMP%]{position:absolute;top:5px;right:5px;opacity:.6;width:24px;height:24px;border-radius:50%}.close-button[_ngcontent-%COMP%]:hover{background-color:#e5e6e6;cursor:pointer}.close-button[_ngcontent-%COMP%]:before, .close-button[_ngcontent-%COMP%]:after{position:absolute;content:" ";height:12px;width:1px;background-color:#333;top:6px!important;left:0!important;right:0!important;margin:0 auto}.close-button[_ngcontent-%COMP%]:before{transform:rotate(45deg)}.close-button[_ngcontent-%COMP%]:after{transform:rotate(-45deg)}.header-title[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;padding:15px 30px 15px 15px}.header-text[_ngcontent-%COMP%]{font-size:18px;font-weight:600;color:#253658}.save-button[_ngcontent-%COMP%]{display:flex;width:110px;margin:0 10px}.add-button[_ngcontent-%COMP%]{display:flex;width:126px;margin:0 10px}.add-button[_ngcontent-%COMP%] button[_ngcontent-%COMP%], .save-button[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:100%;border-radius:10px;font-size:12px;font-weight:600;padding:10px;background-color:#7b8db114;color:#2536584d;pointer-events:none}.add-button[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%], .save-button[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]{color:#fff;pointer-events:auto}.save-button[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]{background-color:#00d096}.add-button[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]{background-color:#23adfe}.add-button[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]:hover, .save-button[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]:hover{opacity:.6}.video-container[_ngcontent-%COMP%]{position:relative;margin:0 auto;border-radius:10px;overflow:hidden;box-shadow:0 0 24px #0000002e}.video-container[_ngcontent-%COMP%]:hover{cursor:pointer}.video-container-play[_ngcontent-%COMP%]{left:50%;
8top:50%;transform:translate(-50%,-50%);z-index:1;position:absolute;width:60px;height:60px;-webkit-user-select:none;user-select:none}.video-container-play[_ngcontent-%COMP%]:hover{background-color:#9a9aab;border-radius:30px;width:59px;height:59px;cursor:pointer}.scene-trimmer-container[_ngcontent-%COMP%]{position:relative;margin:55px auto 15px;height:50px}.scene-slider[_ngcontent-%COMP%]{border-radius:10px;background-color:#7b8db14d;display:flex;justify-content:space-between;align-items:center;position:absolute;height:50px}.scene-slider.active[_ngcontent-%COMP%]{background-color:#00abfe}.slider-handle[_ngcontent-%COMP%]{height:50px}.slider-handle[_ngcontent-%COMP%]:hover{cursor:col-resize}.handle-label[_ngcontent-%COMP%]{width:8px;border-left:3px solid #253658;border-right:3px solid #253658;padding-top:13px;padding-bottom:13px}.handle-label[_ngcontent-%COMP%]:hover{opacity:.6}.segment-label[_ngcontent-%COMP%]{color:#fff;font-size:14px;font-weight:800;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;flex-grow:1}.segment-label.active[_ngcontent-%COMP%]{flex-grow:0;margin:0 auto}.segment-label.active[_ngcontent-%COMP%]:hover{cursor:move}.segment-label.disableMove[_ngcontent-%COMP%]:hover{cursor:default!important}.time-indicators[_ngcontent-%COMP%]{font-size:9px;font-weight:700;position:absolute;top:-26px;color:#7b8db1}.time-indicators.active[_ngcontent-%COMP%]{color:#00abfe}.start-indicator[_ngcontent-%COMP%]{left:0}.end-indicator[_ngcontent-%COMP%]{right:0}.arrow-indicator[_ngcontent-%COMP%]{display:block;position:relative;width:24px;height:24px;left:0;right:0;margin:0 auto;top:-8px;background-position:top;background-repeat:no-repeat;background-image:url(/img/grey-down-arrow.svg)}.arrow-indicator.active[_ngcontent-%COMP%]{background-image:url(/img/blue-down-arrow.svg)}.video-container[_ngcontent-%COMP%] .vjs-tech[_ngcontent-%COMP%]{pointer-events:none}.video-container[_ngcontent-%COMP%] .vjs-time-control[_ngcontent-%COMP%]{display:block}.video-container[_ngcontent-%COMP%] .vjs-remaining-time[_ngcontent-%COMP%]{display:none}.buttons-container[_ngcontent-%COMP%]{display:flex}']});}}return i;})();ae();Ei();ji();Bi();Ui();J();ht();Mi();qt();Zi();function pg(i,u){if(i&1&&(r(0,"span",21),y(1),s()),i&2){let e=p();a(),se(" ",e.selectedCount," ");}}function hg(i,u){if(i&1){let e=U();r(0,"div",24),b(1,"i",25),r(2,"span",26),y(3),s(),r(4,"button",27),S("click",function(){let t=T(e).$implicit,o=p(2);return P(o.onRemoveLanguage(t.value));}),b(5,"img",28),s()();}if(i&2){let e=u.$implicit;a(),c("ngClass",e.sideIconClass),a(2),de(e.name);}}function mg(i,u){if(i&1&&(r(0,"div",22),M(1,hg,6,2,"div",23),s()),i&2){let e=p();a(),c("ngForOf",e.selectedLanguagesTo);}}var Qs=class extends Tt{},Np=(()=>{class i extends Pt{get availableTargetLanguages(){let e=new Set(this.selectedLanguagesTo.map(n=>n.value));return this.langOptionsTo.filter(n=>!e.has(n.value));}get ctaButtonText(){let e=this.selectedLanguagesTo.length;return e===0?"Dub Videos":`Dub Videos (${e} Language${e>1?"s":""})`;}get isCtaDisabled(){return!this.selectedLangFrom||this.selectedLanguagesTo.length===0;}get selectedCount(){let e=this.selectedLanguagesTo.length;return e>0?`(${e} selected)`:"";}constructor(e,n,t,o,h,k){super(e),this.data=e,this.translateStoryServiceService=n,this.eventsService=t,this.requestsService=o,this.notifier=h,this.creditsService=k,this.langOptionsFrom=[],this.langOptionsTo=[],this.selectedLanguagesTo=[],this.numberOfSpeakers=0,this.submitting=!1,this.PLUS_ICON_SVG='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 4V16M4 10H16" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',this.MINUS_ICON_SVG='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 7H11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',this.STEPPER_PLUS_ICON_SVG='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 3V11M3 7H11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',this.EVENT_DUBBING=this.eventsService.events.dubbing,this.onSourceLangChange=f=>{f&&(this.selectedLangFrom=f),this.logScreenClick("source-select",f?.value);},this.onAddLanguage=f=>{f&&!this.selectedLanguagesTo.some(m=>m.value===f.value)&&(this.selectedLanguagesTo=[...this.selectedLanguagesTo,f]),this.logScreenClick("destination-add",f?.value);},this.onRemoveLanguage=f=>{this.selectedLanguagesTo=this.selectedLanguagesTo.filter(m=>m.value!==f),this.logScreenClick("destination-remove");},this.incrementSpeakers=()=>{this.numberOfSpeakers<10&&this.numberOfSpeakers++,this.logScreenClick("speakers-increase");},this.decrementSpeakers=()=>{this.numberOfSpeakers>0&&this.numberOfSpeakers--,this.logScreenClick("speakers-decrease");},this.onDubVideos=()=>I(this,null,function*(){if(this.isCtaDisabled||this.submitting)return;this.submitting=!0;let f={source:{type:"storyVideo",storyVideo:{storyId:this.data.story.storyId,videoId:this.data.take.video?.id}},actions:[{type:"videoDub",videoDub:{targetLanguages:this.selectedLanguagesTo.map(m=>m.value),sourceLang:this.selectedLangFrom?.value||"auto",numSpeakers:this.numberOfSpeakers}}],shouldNotify:!0};try{let m=yield this.requestsService.generateV2Video(f);this.eventsService.log(this.EVENT_DUBBING.dubbingFinish,{storyId:this.data.story.storyId,takeId:this.data.take.video?.id,sourceLang:this.selectedLangFrom?.value||"auto",numSpeakers:this.numberOfSpeakers,destinationsLangs:this.selectedLanguagesTo.map(v=>v.value)}),this.notifier.info("Dubbing started. You will be notified when it's ready."),this.data.callback(m,this.selectedLanguagesTo.map(v=>
8v.name)),this.close();}catch(m){if(this.submitting=!1,this.creditsService.handleCreditError(m)){this.close();return;}let v=m?.responseJSON?.msg||m?.responseJSON?.error||m?.responseJSON?.error_description||"Failed to start video dubbing";this.notifier.error(v);}}),this.initLanguages=()=>I(this,null,function*(){this.langOptionsFrom=[],this.langOptionsTo=[];let f=yield this.translateStoryServiceService.getElevenlabsDubLanguages();this.langOptionsFrom=this.toDropdownOptions(this.translateStoryServiceService.setLanguageOptions(f)),this.langOptionsTo=this.toDropdownOptions(this.translateStoryServiceService.setLanguageOptions(f));let v=this.data.story?.captions?.find(te=>te.groupId===this.data.take.video?.groupId&&te.status===2)?.sourceLocale?.slice(0,2),V=navigator.language?.slice(0,2);v?this.selectedLangFrom=this.langOptionsFrom.find(te=>te.value===v):V&&(this.selectedLangFrom=this.langOptionsFrom.find(te=>te.value===V));});}ngOnInit(){return I(this,null,function*(){yield this.initLanguages(),this.eventsService.log(this.EVENT_DUBBING.dubbingOpen,{storyId:this.data.story.storyId,takeId:this.data.take.video?.id});});}logScreenClick(e,n){this.eventsService.log(this.EVENT_DUBBING.dubbingScreenClick,pe({storyId:this.data.story.storyId,takeId:this.data.take.video?.id,button:e,sourceLang:this.selectedLangFrom?.value},n&&{selectedLang:n}));}toDropdownOptions(e){return e.map(n=>({value:n.value,name:n.name,sideIconClass:n.sideIconClass}));}static{this.ɵfac=function(n){return new(n||i)(d(yt),d(Gi),d(Pe),d(xt),d(Ge),d(Vt));};}static{this.ɵcmp=G({type:i,selectors:[["app-dub-video-dialog"]],standalone:!0,features:[Ae,q],decls:35,vars:22,consts:[[1,"dub-video-container"],[1,"header-text"],[1,"title"],[1,"subtitle"],[1,"close-button",3,"click"],["src","/img/sidebar-close-icon.svg","alt","Close"],[1,"music-warning"],[1,"source-language-section"],[1,"section-label"],["placeholder","Select source language","type","outside",3,"selectionChange","dropdownOpen","options","searchable","label","value"],[1,"speakers-section"],[1,"stepper"],["size","sm","variant","ghost",3,"clicked","iconContent","disabled"],[1,"stepper-value"],[1,"destination-section"],[1,"section-label-row"],["class","selected-count",4,"ngIf"],["class","chips-container",4,"ngIf"],["placeholder","Add language","type","outside",3,"selectionChange","dropdownOpen","options","searchable","showSelected","label","leftIcon","leftIconContent"],[1,"cta-wrapper"],[3,"clicked","variant","size","disabled","loading"],[1,"selected-count"],[1,"chips-container"],["class","language-chip",4,"ngFor","ngForOf"],[1,"language-chip"],[1,"chip-flag",3,"ngClass"],[1,"chip-name"],[1,"chip-close",3,"click"],["src","/img/sidebar-close-icon.svg","alt","Remove"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"header")(2,"div",1)(3,"h2",2),y(4,"Dub Video with AI"),s(),r(5,"p",3),y(6,"Dub Video replaces your voice with natural AI speech in other languages, with matching captions."),s()(),r(7,"button",4),S("click",function(){return t.close();}),b(8,"img",5),s()(),r(9,"p",6),y(10,"Make sure your video has no music."),s(),r(11,"main")(12,"div",7)(13,"label",8),y(14,"Source"),s(),r(15,"lib-dropdown",9),S("selectionChange",function(h){return t.onSourceLangChange(h);})("dropdownOpen",function(){return t.logScreenClick("source-menu");}),s()(),r(16,"div",10)(17,"label",8),y(18,"Number of speakers"),s(),r(19,"div",11)(20,"lib-button-icon",12),S("clicked",function(){return t.decrementSpeakers();}),s(),r(21,"span",13),y(22),s(),r(23,"lib-button-icon",12),S("clicked",function(){return t.incrementSpeakers();}),s()()(),r(24,"div",14)(25,"div",15)(26,"label",8),y(27,"Destination"),s(),M(28,pg,2,1,"span",16),s(),M(29,mg,2,1,"div",17),r(30,"lib-dropdown",18),S("selectionChange",function(h){return t.onAddLanguage(h);})("dropdownOpen",function(){return t.logScreenClick("destination-menu");}),s()()(),r(31,"footer")(32,"div",19)(33,"lib-button",20),S("clicked",function(){return t.onDubVideos();}),y(34),s()()()()),n&2&&(a(15),c("options",t.langOptionsFrom)("searchable",!0)("label",!1)("value",t.selectedLangFrom==null?null:t.selectedLangFrom.value),a(5),c("iconContent",t.MINUS_ICON_SVG)("disabled",t.numberOfSpeakers<=0),a(2),de(t.numberOfSpeakers===0?"Auto":t.numberOfSpeakers),a(),c("iconContent",t.STEPPER_PLUS_ICON_SVG)("disabled",t.numberOfSpeakers>=10),a(5),c("ngIf",t.selectedLanguagesTo.length>0),a(),c("ngIf",t.selectedLanguagesTo.length>0),a(),c("options",t.availableTargetLanguages)("searchable",!0)("showSelected",!1)("label",!1)("leftIcon",!0)("leftIconContent",t.PLUS_ICON_SVG),a(3),c("variant","primary")("size","lg")("disabled",t.isCtaDisabled)("loading",t.submitting),a(),se(" ",t.ctaButtonText," "));},dependencies:[_e,Le,we,Fi,Vn,Jr],styles:[".dub-video-container[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;padding:24px;gap:24px;color:#253658;box-sizing:border-box;-webkit-user-select:none;user-select:none}.dub-video-container[_ngcontent-%COMP%] header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:flex-start}.dub-video-container[_ngcontent-%COMP%] header[_ngcontent-%COMP%] .header-text[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px}.dub-video-container[_ngcontent-%COMP%] header[_ngcontent-%COMP%] .header-text[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{font-family:Inter-Bold;font-weight:700;font-size:20px;line-height:24px;letter-spacing:-.02em;margin:0}.dub-video-container[_ngcontent-%COMP%] header[_ngcontent-%COMP%] .header-text[_ngcontent-%COMP%] .subtitle[_ngcontent-%COMP%]{font-family:Inter;font-weight:400;font-size:14px;line-height:20px;color:#25365899;margin:0}.dub-video-container[_ngcontent-%COMP%] header[_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{background:none;border:none;cursor:pointer;padding:4px;display:flex;align-items:center;justify-content:center}.dub-video-container[_ngcontent-%COMP%] header[_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:20px;height:20px}.dub-video-container[_ngcontent-%COMP%] .music-warning[_ngcontent-%COMP%]{font-family:Inter;font-weight:400;font-size:14px;line-height:20px;color:#25365899;margin:0}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:20px}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .source-language-section[_ngcontent-%COMP%], .dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .destination-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .speakers-section[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .speakers-section[_ngcontent-%COMP%] .stepper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:0;border:1px solid #EEEFF2;border-radius:8px}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .speakers-section[_ngcontent-%COMP%] .stepper[_ngcontent-%COMP%] .stepper-value[_ngcontent-%COMP%]{width:40px;text-align:center;font-family:Inter-Medium;font-weight:500;font-size:16px;line-height:20px;color:#253658;padding:6px 0}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .section-label-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .section-label[_ngcontent-%COMP%]{font-family:Inter-Medium;font-weight:500;font-size:14px;line-height:20px;color:#253658}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .selected-count[_ngcontent-%COMP%]{font-family:Inter;font-weight:400;font-size:14px;line-height:20px;color:#25365899}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .chips-container[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:8px;max-height:120px;overflow-y:auto;padding:2px 0}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .chips-container[_ngcontent-%COMP%]::-webkit-scrollbar{width:4px}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .chips-container[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#7b8db14d;border-radius:4px}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .language-chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;background:#4481fd14;border-radius:20px;font-family:Inter;font-weight:400;font-size:13px;line-height:18px;color:#253658;transition:background .15s ease}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .language-chip[_ngcontent-%COMP%]:hover{background:#4481fd26}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .language-chip[_ngcontent-%COMP%] .chip-flag[_ngcontent-%COMP%]{font-size:14px;line-height:1}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .language-chip[_ngcontent-%COMP%] .chip-name[_ng
8content-%COMP%]{white-space:nowrap}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .language-chip[_ngcontent-%COMP%] .chip-close[_ngcontent-%COMP%]{background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;opacity:.6;transition:opacity .15s ease}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .language-chip[_ngcontent-%COMP%] .chip-close[_ngcontent-%COMP%]:hover{opacity:1}.dub-video-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%] .language-chip[_ngcontent-%COMP%] .chip-close[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:12px;height:12px}.dub-video-container[_ngcontent-%COMP%] footer[_ngcontent-%COMP%] .cta-wrapper[_ngcontent-%COMP%]{width:100%}.dub-video-container[_ngcontent-%COMP%] footer[_ngcontent-%COMP%] .cta-wrapper[_ngcontent-%COMP%] lib-button{width:100%}.dub-video-container[_ngcontent-%COMP%] footer[_ngcontent-%COMP%] .cta-wrapper[_ngcontent-%COMP%] lib-button button{width:100%}@media screen and (max-width: 560px){.dub-video-container[_ngcontent-%COMP%]{height:100%;justify-content:space-between}}"]});}}return i;})();ae();J();function ug(i,u){i&1&&(r(0,"div",4),b(1,"div",5),r(2,"div",6)(3,"div",7),b(4,"div",8)(5,"div",9),s(),r(6,"div",10),b(7,"div",11)(8,"div",12)(9,"div",11),s()(),r(10,"div",13),b(11,"div",14),r(12,"div",15),b(13,"div",16)(14,"div",16)(15,"div",16)(16,"div",16)(17,"div",16),s()()());}var Fp=(()=>{class i{constructor(){this.cards=Array.from({length:6});}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["app-take-track-list-shimmer"]],standalone:!0,features:[q],decls:4,vars:1,consts:[[1,"take-track-list-shimmer"],[1,"search-bar-shimmer","shimmer-block"],[1,"cards-container"],["class","take-card-shimmer",4,"ngFor","ngForOf"],[1,"take-card-shimmer"],[1,"thumbnail","shimmer-block"],[1,"content"],[1,"top-group"],[1,"title","shimmer-block"],[1,"duration","shimmer-block"],[1,"badges"],[1,"badge","shimmer-block"],[1,"badge","shimmer-block","badge--narrow"],[1,"actions"],[1,"move","shimmer-block"],[1,"action-icons"],[1,"action-icon","shimmer-block"]],template:function(n,t){n&1&&(r(0,"div",0),b(1,"div",1),r(2,"div",2),M(3,ug,18,0,"div",3),s()()),n&2&&(a(3),c("ngForOf",t.cards));},dependencies:[Le],styles:['.take-track-list-shimmer[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;gap:16px;padding-right:16px;box-sizing:border-box}.search-bar-shimmer[_ngcontent-%COMP%]{width:100%;height:40px;border-radius:10px;flex-shrink:0}.cards-container[_ngcontent-%COMP%]{flex:1;min-height:0;display:flex;flex-direction:column;gap:10px;overflow:hidden}.take-card-shimmer[_ngcontent-%COMP%]{width:100%;padding:8px;display:flex;align-items:center;gap:12px;background:#fff;border:1px solid #e1e7f0;border-radius:10px;box-sizing:border-box;flex-shrink:0}.take-card-shimmer[_ngcontent-%COMP%] .thumbnail[_ngcontent-%COMP%]{width:70px;height:70px;flex-shrink:0;border-radius:8px}.take-card-shimmer[_ngcontent-%COMP%] .content[_ngcontent-%COMP%]{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:space-between;align-self:stretch;gap:8px}.take-card-shimmer[_ngcontent-%COMP%] .top-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px}.take-card-shimmer[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{width:60%;height:14px;border-radius:4px}.take-card-shimmer[_ngcontent-%COMP%] .duration[_ngcontent-%COMP%]{width:30%;height:10px;border-radius:4px}.take-card-shimmer[_ngcontent-%COMP%] .badges[_ngcontent-%COMP%]{display:flex;align-items:center;gap:6px}.take-card-shimmer[_ngcontent-%COMP%] .badge[_ngcontent-%COMP%]{width:56px;height:16px;border-radius:100px}.take-card-shimmer[_ngcontent-%COMP%] .badge--narrow[_ngcontent-%COMP%]{width:40px}.take-card-shimmer[_ngcontent-%COMP%] .actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;flex-direction:column;align-items:flex-end;justify-content:space-between;align-self:stretch;gap:8px}.take-card-shimmer[_ngcontent-%COMP%] .move[_ngcontent-%COMP%]{width:24px;height:24px;border-radius:6px}.take-card-shimmer[_ngcontent-%COMP%] .action-icons[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:2px}.take-card-shimmer[_ngcontent-%COMP%] .action-icon[_ngcontent-%COMP%]{width:24px;height:24px;border-radius:6px}.shimmer-block[_ngcontent-%COMP%]{position:relative;background:#4481fd1f;overflow:hidden}.shimmer-block[_ngcontent-%COMP%]:after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.45) 50%,transparent 100%);transform:translate(-100%);animation:_ngcontent-%COMP%_take-shimmer-wave 1.4s ease-in-out infinite}@keyframes _ngcontent-%COMP%_take-shimmer-wave{0%{transform:translate(-100%)}60%,to{transform:translate(100%)}}']});}}return i;})();Cn();Ni();J();Ln();var xn=function(i){return i[i.DELETE=0]="DELETE",i[i.EDIT_INTERACTIONS=1]="EDIT_INTERACTIONS",i[i.RENAME_MEDIA=2]="RENAME_MEDIA",i[i.MOVE_TO_COLLECTION=3]="MOVE_TO_COLLECTION",i[i.REASSIGN_SLIDE_OWNER=4]="REASSIGN_SLIDE_OWNER",i[i.EDIT_SLIDE_AVATAR=5]="EDIT_SLIDE_AVATAR",i;}(xn||{});J();var Ys=function(i){return i[i.TRACK_ADDED=0]="TRACK_ADDED",i[i.TRACK_REMOVED=1]="TRACK_REMOVED",i[i.TRACK_OWNER_UPDATED=2]="TRACK_OWNER_UPDATED",i;}(Ys||{});J();Eo();at();qt();var jp=(()=>{class i{constructor(e,n,t,o,h,k){this.videoSlidesService=e,this.slideListDataService=n,this.assetEventNotificationService=t,this.userHelperService=o,this.dialogHelperService=h,this.notifier=k,this.placeholderText="Drag videos from the left panel or add video from takes or projects",this.setCurrentUser=()=>I(this,null,function*(){this.currentUser||(this.currentUser=yield this.userHelperService.getUserDetails());}),this.setSlideTrackCreator=f=>{this.slideTrackCreator=f;},this.setTrackList=f=>I(this,null,function*(){if(f&&!this.trackListPopulated&&(this.trackList=f,this.trackList&&this.trackList.length>0&&this.setTrackActiveStatus(this.trackList[0].id),this.remoteAssetAddedEvent)){let{type:m,data:v}=this.remoteAssetAddedEvent;this.trackListPopulated=!0,yield this.appendToTrackList(m,v),this.slideListDataService.clearRemoteAssetAddedToList();}}),this.trackTrackBy=(f,m)=>m.id,this.onAssetAdded=f=>{f&&f.fileType==="video"&&(this.appendToTrackList("asset",f),this.assetEventNotificationService.clearAssetAdded());},this.onRemoteAssetAdded=f=>{this.remoteAssetAddedEvent=f;},this.appendToTrackList=(f,m,v=!1)=>I(this,null,function*(){let V=this.trackList.length;return yield this.addTrack(f,m,V,v);}),this.onDroppedAsset=(f,m=!1)=>{let{data:v,placeholderIndex:V}=f;this.addTrack("asset",v,V,m);},this.onSequenceDropAssetSomewhere=(f,m=!1)=>{let{data:v,type:V,placeholderIndex:te}=f;v?.fileType==="video"?this.addTrack("asset",v.data||v,te,m):this.addTrack(v.type||V||"asset",v.data||v,te,m);},this.onSequenceDropAsset=(f,m=!1)=>{let{data:v,type:V}=f,te=this.trackList.length;this.addTrack(v.type||V||"asset",v.data||v,te,m);},this.addTrack=(f,m,v,V=!1)=>I(this,null,function*(){try{yield this.setCurrentUser();let te=this.slideListDataService.createSlide(f,m,this.currentUser,V),$=yield this.slideTrackCreator.create(v,m,te,this.currentUser,this.trackEditOptions);return this.addToList($,v),this.orderTrackList(),this.emitTrackListChangeEvent(Ys.TRACK_ADDED,$.source,v,$.getDuration(),$.getVideoId()),this.slideListDataService.setSlideAddedToList($),$;}catch(te){this.notifier.error(te);}}),this.addToList=(f,m=0)=>{this.trackList.length===0?this.trackList.push(f):this.trackList.splice(m,0,f);},this.orderTrackList=()=>{this.trackList.forEach((f,m)=>{f.setId(m+1),m>0?this.setSlideTrackStartTime(f,this.trackList[m-1]):f.setStartTime(0);});},this.setSlideTrackStartTime=(f,m)=>{let v=m.getStartTime()+m.getDuration();f.setStartTime(v);},this.onTrackSwap=f=>{this.swapSlideTracks(f);},this.swapSlideTracks=f=>{f.currentIndex!=f.previousIndex&&(fp(this.trackList,f.previousIndex,f.currentIndex),this.resetTracks(),this.emitTrackListChangeEvent());},this.resetTracks=()=>{this.trackList[0].setStartTime(0).setId(1).setActive(!1);for(let f=1;f<this.trackList.length;f++){let m=this.trackList[f],v=this.trackList[f-1].getStartTime(),V=this.trackList[f-1].getDuration();
8m.setId(f+1),m.setStartTime(v+V),m.setActive(!1);}this.lastActiveTrackId=void 0;},this.setSelectedTrack=f=>{this.setTrackActiveStatus(f),this.onTrackSelected(f);},this.onTrackSelected=f=>{let m=this.trackList[f-1];this.slideListDataService.setSelectedSlide(m.getMediaSlide(),m.id);},this.setTrackActiveStatus=f=>{try{if(this.lastActiveTrackId===f)return;if(this.lastActiveTrackId!==void 0){let m=this.trackList[this.lastActiveTrackId-1];m&&(m.active=!1);}this.trackList[f-1].active=!0,this.lastActiveTrackId=f;}catch(m){console.error(m);}},this.onEditMenuSelection=f=>{let{option:m,trackId:v}=f;switch(m.value){case xn.DELETE:this.onRemoveOptionSelection(v);break;default:break;}},this.onRemoveOptionSelection=f=>{this.trackToRemoveId=f,this.dialogHelperService.showUiConfirmationDialog({title:"Remove Slide",msg:"Are you sure you want to remove this slide?",confirmationText:"Yes",cancellationText:"Cancel",onSubmit:this.removeFromTrackList});},this.removeFromTrackList=()=>{let f=this.trackList[this.trackToRemoveId-1];this.trackList.splice(this.trackToRemoveId-1,1),this.orderTrackList(),this.clearActiveTrack(f.id),this.emitTrackListChangeEvent(Ys.TRACK_REMOVED,f.source,this.trackToRemoveId-1,f.getDuration(),f.getVideoId()),this.dialogHelperService.close();},this.onSelectedTrackPlaying=f=>{let{trackId:m}=f,v=this.trackList[m-1];this.videoSlidesService.playSelectedSlide.next(v.slide);},this.emitTrackListChangeEvent=(f,m,v,V,te,$)=>{this.onTrackListChange.emit({trackList:this.trackList,name:f,trackSource:m,trackIndex:v,duration:V,videoId:te,skipPreviewer:$});},this.clearActiveTrack=f=>{this.lastActiveTrackId===f&&(this.lastActiveTrackId=void 0);},this.onTrackListChange=new be(),this.trackList=[];}ngOnInit(){return I(this,null,function*(){yield this.setCurrentUser();});}static{this.ɵfac=function(n){return new(n||i)(d($t),d(Zt),d(hs),d(zi),d(Ue),d(Ge));};}static{this.ɵdir=Li({type:i,selectors:[[""]],inputs:{trackEditOptions:"trackEditOptions"},outputs:{onTrackListChange:"onTrackListChange"},standalone:!0});}}return i;})();var qo=class{constructor(u,e,n,t,o,h=!1){this.id=u,this.title=e,this.slide=n,this.owner=t,this.editOptions=o,this.active=h,this._fromMediaSlide=k=>{this.slide=this._formatSlide(k),this.source=k.owner.type,this.thumbnailUrl=k.media.thumbnailUrl;},this._formatSlide=k=>(k.metadata.time=parseFloat(k.metadata.time.toFixed(3)),k.metadata.duration=parseFloat(k.metadata.duration.toFixed(3)),k),this.getMediaSlide=(...k)=>{let m={metadata:JSON.parse(JSON.stringify(this.slide.metadata)),media:this.slide.media,owner:this.slide.owner};return m.owner.user&&(m.owner.userId=m.owner.user.id,delete m.owner.user),delete m.owner.title,m;},this.setId=k=>(this.id=k,this),this.setOwner=k=>(this.owner=k,this),this.setSlideOwner=k=>(this.slide.owner.user=k,this),this.setEditOptions=k=>(this.editOptions=k,this),this.setTitle=k=>(this.title=k,this),this.setActive=k=>(this.active=k,this),this.getVideoId=()=>this.slide.owner.subRefId,n&&this._fromMediaSlide(n),this.id=u,this.title=e||"No Title",this.owner=t,this.editOptions=o,this.active=h;}getDuration(){return this.slide.metadata.duration;}getStartTime(){return this.slide.metadata.time;}setDuration(u){return this.slide.metadata.duration=u,this;}setStartTime(u){return this.slide.metadata.time=u,this;}};var Js=class{create(u,e,n,t,o){return Promise.resolve(new qo(u,e.title||e.headline,n,t,o));}};Oa();J();J();var Bp=(()=>{class i{constructor(e){this.videoSlidesService=e,this.setTrackPlayStateChangeListener=()=>{this.videoSlidesService.VideoEditElm_isSlidePlayed$.subscribe(n=>this.isTrackPlaying=n);},this.onSelection=n=>{this.onTrackSelected.emit(n);},this.toggleTrackState=n=>{this.isTrackPlaying=!this.isTrackPlaying;let t={trackId:n,play:this.isTrackPlaying};this.onTrackPlaying.emit(t);},this.onTrackSelected=new be(),this.onTrackPlaying=new be(),this.onEditMenuSelection=new be(),this.isTrackPlaying=!1;}ngOnInit(){this.setTrackPlayStateChangeListener();}static{this.ɵfac=function(n){return new(n||i)(d($t));};}static{this.ɵdir=Li({type:i,selectors:[[""]],outputs:{onTrackSelected:"onTrackSelected",onTrackPlaying:"onTrackPlaying",onEditMenuSelection:"onEditMenuSelection"},standalone:!0});}}return i;})();J();var Up=(()=>{class i extends Bp{constructor(){super(...arguments),this.defaultOwnerImageUrl=fn.globals.emptyProfileImgUrl,this.onMenuSelection=e=>{let n={trackId:this.id,option:e};this.onEditMenuSelection.emit(n);};}ngOnInit(){super.ngOnInit();}static{this.ɵfac=(()=>{let e;
8return function(t){return(e||(e=bo(i)))(t||i);};})();}static{this.ɵdir=Li({type:i,selectors:[["","slideTrack",""]],inputs:{id:"id",metadata:"metadata",thumbnailUrl:"thumbnailUrl",owner:"owner",title:"title",isActive:"isActive",editOptions:"editOptions"},features:[Ae]});}}return i;})();ae();J();var Hp=(()=>{class i{constructor(){}ngOnInit(){}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["slide-details"]],inputs:{id:"id",thumbnailUrl:"thumbnailUrl",title:"title",duration:"duration"},standalone:!0,features:[q],decls:13,vars:10,consts:[[1,"slide-details-component"],[1,"track-thumbnail-container"],["alt","Track Thumbnail",3,"src"],[1,"track-id"],[1,"background-shadow"],[1,"track-metadata-info"],[1,"track-title"],[1,"track-duration"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),b(2,"img",2),r(3,"div",3),y(4),tt(5,"number"),s(),b(6,"div",4),s(),r(7,"div",5)(8,"div",6),y(9),s(),r(10,"div",7),y(11),tt(12,"date"),s()()()),n&2&&(a(2),c("src",t.thumbnailUrl,Ie),a(2),de(_n(5,4,t.id,"2.0")),a(5),de(t.title),a(2),se("",_n(12,7,t.duration*1e3,"mm:ss")," min"));},dependencies:[Mn,Oo],styles:[".slide-details-component[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:flex-start;width:100%}.track-thumbnail-container[_ngcontent-%COMP%]{width:72px;height:72px;border-radius:10px;overflow:hidden;position:relative}.track-thumbnail-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;object-position:center}.track-thumbnail-container[_ngcontent-%COMP%] .track-id[_ngcontent-%COMP%]{position:absolute;width:48px;height:48px;inset:0;margin:auto;border-radius:10px;background-color:#00000014;text-align:center;color:#fff;font-size:12px;font-family:Inter-Bold;line-height:48px}.track-metadata-info[_ngcontent-%COMP%]{margin-left:12px;position:relative;height:72px;width:75%}.track-metadata-info[_ngcontent-%COMP%] .track-duration[_ngcontent-%COMP%]{position:absolute;bottom:0;font-size:12px;color:#00abfe;font-family:Inter-SemiBold}.track-metadata-info[_ngcontent-%COMP%] .track-title[_ngcontent-%COMP%]{width:100%;max-width:300px;height:70%;text-overflow:ellipsis;overflow:hidden;white-space:break-spaces;font-size:14px;color:#253658;font-family:Inter-SemiBold;letter-spacing:-.6px}"]});}}return i;})();ae();ji();J();var fg=i=>({"track-action-button-container":!0,"track-action-button-container-active":i}),vg=i=>({"slide-track-data":!0,"slide-track-data-active":i}),_g=(i,u)=>({"track-play-icon":i,"track-pause-icon":u});function Cg(i,u){if(i&1&&(r(0,"div",13),b(1,"i",14),s()),i&2){let e=p();a(),c("ngClass",fi(1,_g,!e.isTrackPlaying,e.isTrackPlaying));}}function bg(i,u){if(i&1){let e=U();r(0,"div",15),S("click",function(t){return T(e),P(t.stopPropagation());}),r(1,"lib-dropdown",16),S("selectionChange",function(t){T(e);let o=p();return P(o.onMenuSelection(t));}),s()();}if(i&2){let e=p();a(),c("iconOnly",!0)("showSelected",!1)("options",e.editOptions);}}var zp=(()=>{class i extends Up{ngOnInit(){super.ngOnInit();}static{this.ɵfac=(()=>{let e;return function(t){return(e||(e=bo(i)))(t||i);};})();}static{this.ɵcmp=G({type:i,selectors:[["sequence-track"]],standalone:!0,features:[Ae,q],decls:16,vars:17,consts:[[1,"sequence-track-component"],[1,"track-data-container"],[3,"click","ngClass"],["class","play-pause-button-container",4,"ngIf"],[1,"track-start-time"],[1,"preview-image"],["src","/img/script-story-v2/video-sequence.svg","alt",""],[1,"slide-track-info-container"],[3,"id","thumbnailUrl","title","duration"],[1,"slide-track-owner-container"],[1,"owner-profile-img-container"],["alt","image",3,"src"],["class","edit-menu-container",3,"click",4,"ngIf"],[1,"play-pause-button-container"],[3,"ngClass"],[1,"edit-menu-container",3,"click"],[3,"selectionChange","iconOnly","showSelected","options"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1)(2,"div",2),S("click",function(){return t.toggleTrackState(t.id);}),M(3,Cg,2,4,"div",3),r(4,"div",4),y(5),tt(6,"date"),s()(),r(7,"div",2),S("click",function(){return t.onSelection(t.id);}),r(8,"div",5),b(9,"img",6),s(),r(10,"div",7),b(11,"slide-details",8),s(),r(12,"div",9)(13,"div",10),b(14,"img",11),s(),M(15,bg,2,3,"div",12),s()()()()),n&2&&(a(2),c("ngClass",ue(13,fg,t.isActive)),a(),c("ngIf",t.isActive),a(2),de(_n(6,10,(t.metadata==null?null:t.metadata.time)*1e3,"mm:ss")),a(2),c("ngClass",ue(15,vg,t.isActive)),a(4),c("id",t.id)("thumbnailUrl",t.thumbnailUrl)("title",t.title)("duration",t.metadata==null?null:t.metadata.duration),a(3),c("src",(t.owner==null||t.owner.profileImgAsset==null?null:t.owner.profileImgAsset.thumbnailUrl)||(t.owner==null||t.owner.profileImgAsset==null?null:t.owner.profileImgAsset.url)||t.defaultOwnerImageUrl,Ie),a(),c("ngIf",t.editOptions));},dependencies:[we,_e,Hp,Jr,Oo],styles:[".preview-image[_ngcontent-%COMP%]{width:16px;height:16px;align-self:center}.preview-image[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain}
8.sequence-track-component[_ngcontent-%COMP%]{width:100%}.sequence-track-component[_ngcontent-%COMP%] .track-data-container[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center} .sequence-track-component .track-data-container .slide-track-info-container .slide-details-component .track-metadata-info .track-title{height:60%}",".sequence-track-component[_ngcontent-%COMP%]{width:100%}.sequence-track-component[_ngcontent-%COMP%] .track-data-container[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center}.track-action-button-container[_ngcontent-%COMP%]{width:78px;border-radius:10px;background:#7b8db114;padding:4px;display:flex;justify-content:center;align-items:center;margin-right:20px;font-size:12px;color:#25365899;pointer-events:none}.track-action-button-container-active[_ngcontent-%COMP%]{color:#fff;font-family:Inter-Bold;background-color:#00abfe;cursor:pointer;pointer-events:unset}.track-action-button-container[_ngcontent-%COMP%] .play-pause-button-container[_ngcontent-%COMP%]{width:20px;height:20px}.track-play-icon[_ngcontent-%COMP%]{background-image:url(/img/play-button-icon.svg);background-repeat:no-repeat;background-size:cover;background-position:center;width:100%;height:100%;display:inline-block;transform:rotate(90deg)}.track-pause-icon[_ngcontent-%COMP%]{background-image:url(/img/pause-button-icon.svg);background-repeat:no-repeat;background-size:cover;background-position:center;width:100%;height:100%;display:inline-block}.slide-track-data[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:flex-start;border-radius:10px;background-color:#fff;padding:14px;width:80%;border:2px solid #fff;cursor:pointer}.slide-track-data-active[_ngcontent-%COMP%]{border-color:#00abfe}.slide-track-info-container[_ngcontent-%COMP%]{width:75%}.owner-profile-img-container[_ngcontent-%COMP%]{width:24px;height:24px;border-radius:10px;overflow:hidden}.owner-profile-img-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;object-position:center}.slide-track-owner-container[_ngcontent-%COMP%]{position:relative;height:72px;display:flex;justify-content:flex-end;align-items:flex-end}.slide-track-owner-container[_ngcontent-%COMP%] .edit-menu-container[_ngcontent-%COMP%]{cursor:pointer;width:24px}.track-edit-menu[_ngcontent-%COMP%]{background:linear-gradient(to left,#131313,#404040 0%);border-radius:10px!important;box-shadow:0 8px 10px #1313133b}.track-edit-menu[_ngcontent-%COMP%] button.mat-mdc-menu-item[_ngcontent-%COMP%]{color:#fff;display:flex;font-size:12px;padding:0 16px}.track-edit-menu[_ngcontent-%COMP%] button.mat-mdc-menu-item[_ngcontent-%COMP%]:hover{opacity:.5}.slide-track-owner-container[_ngcontent-%COMP%] .edit-menu-container[_ngcontent-%COMP%] .triggers[_ngcontent-%COMP%]{padding:0;margin-left:7px}.track-menu-icon[_ngcontent-%COMP%]{background-repeat:no-repeat;background-size:cover;background-position:center;width:24px;height:24px;display:inline-block}.scissors-icon[_ngcontent-%COMP%]{background-image:url(/img/scissors-icon.svg)}"]});}}return i;})();J();ae();J();var Sg=(i,u)=>({"full-container":i,hidden:u}),$p=(()=>{class i{constructor(){this.draggable=!1,this.empty=!1,this.disabled=!1,this.drop=e=>{if(!this.disabled){let n={placeholderIndex:this.id,data:e.dropData};this.onDrop.emit(n);}},this.onDraggableEnter=()=>{this.onEnter.emit(this.id);},this.onDraggableLeave=()=>{this.onLeave.emit(this.id);},this.onDrop=new be(),this.onEnter=new be(),this.onLeave=new be();}ngOnInit(){}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["droppable-placeholder"]],inputs:{id:"id",dragoverStyle:"dragoverStyle",draggable:"draggable",empty:"empty",isLast:"isLast",disabled:"disabled"},outputs:{onDrop:"onDrop",onEnter:"onEnter",onLeave:"onLeave"},standalone:!0,features:[q],decls:3,vars:5,consts:[[1,"droppable-placeholder-component"],["mwlDroppable","","draggable","false",1,"placeholder-container",3,"dragEnter","dragLeave","drop","ngClass","dragOverClass"],[1,"info-placeholder"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),S("dragEnter",function(){return t.onDraggableEnter();})("dragLeave",function(){return t.onDraggableLeave();})("drop",function(h){return t.drop(h);}),b(2,"div",2),s()()),n&2&&(a(),c("ngClass",fi(2,Sg,t.empty||t.isLast,t.disabled))("dragOverClass",t.empty||t.isLast?"fill-container-area-marker":"placeholder-area-marker"));},dependencies:[qi,Wn,we],styles:[".droppable-placeholder-component[_ng
8content-%COMP%]{position:relative;height:10px}.placeholder-container[_ngcontent-%COMP%]{opacity:.3;width:100%;height:20px;position:relative;top:-14px;transition:margin .5s ease}.placeholder-area-marker[_ngcontent-%COMP%]{margin:20px 0}.full-container[_ngcontent-%COMP%]{height:70vh}.info-placeholder[_ngcontent-%COMP%]{display:none;width:100%;height:100%;background-color:#00abfe;border-radius:6px}.fill-container-area-marker[_ngcontent-%COMP%]{height:84vh;margin:15px 0;top:0}.fill-container-area-marker[_ngcontent-%COMP%] .info-placeholder[_ngcontent-%COMP%]{display:block;height:100%}.placeholder-area-marker[_ngcontent-%COMP%] .info-placeholder[_ngcontent-%COMP%]{display:block;height:20px}.hidden[_ngcontent-%COMP%]{display:none}"]});}}return i;})();ae();J();var xg=i=>({"full-container":i}),Wp=(()=>{class i extends $p{constructor(){super(...arguments),this.dragoverStyle="track-placeholder-area-marker";}static{this.ɵfac=(()=>{let e;return function(t){return(e||(e=bo(i)))(t||i);};})();}static{this.ɵcmp=G({type:i,selectors:[["slide-track-droppable-placeholder"]],inputs:{dragoverStyle:"dragoverStyle"},standalone:!0,features:[Ae,q],decls:3,vars:4,consts:[[1,"droppable-placeholder-component"],["mwlDroppable","","draggable","false",1,"track-placeholder-container",3,"drop","ngClass","dragOverClass"],[1,"track-full-placeholder"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),S("drop",function(h){return t.drop(h);}),b(2,"div",2),s()()),n&2&&(a(),c("ngClass",ue(2,xg,t.empty))("dragOverClass",t.empty?"fill-container-area-marker":t.dragoverStyle));},dependencies:[qi,Wn,we],styles:[".droppable-placeholder-component[_ngcontent-%COMP%]{position:relative;height:12px}.track-placeholder-container[_ngcontent-%COMP%]{opacity:.3;width:100%;height:40px;position:relative;top:-14px;transition:margin .5s ease}.track-placeholder-area-marker[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;margin:20px 0;top:-25px}.full-container[_ngcontent-%COMP%]{height:70vh}.track-full-placeholder[_ngcontent-%COMP%]{display:none;width:100%;height:100%;background-color:#00abfe;border-radius:10px}.track-duration-placeholder[_ngcontent-%COMP%]{display:none;width:75px;height:100%;background-color:#00abfe;border-radius:10px;margin-right:20px}.track-info-placeholder[_ngcontent-%COMP%]{display:none;width:100%;height:100%;background-color:#00abfe;border-radius:10px}.fill-container-area-marker[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;margin:15px 0}.fill-container-area-marker[_ngcontent-%COMP%] .track-duration-placeholder[_ngcontent-%COMP%], .fill-container-area-marker[_ngcontent-%COMP%] .track-full-placeholder[_ngcontent-%COMP%], .fill-container-area-marker[_ngcontent-%COMP%] .track-info-placeholder[_ngcontent-%COMP%]{display:block;height:100%}.track-placeholder-area-marker[_ngcontent-%COMP%] .track-duration-placeholder[_ngcontent-%COMP%], .track-placeholder-area-marker[_ngcontent-%COMP%] .track-info-placeholder[_ngcontent-%COMP%]{display:block;height:28px}.track-placeholder-area-marker[_ngcontent-%COMP%] .track-full-placeholder[_ngcontent-%COMP%]{display:block;height:32px}"]});}}return i;})();ae();J();Eo();at();qt();ns();ht();function yg(i,u){if(i&1){let e=U();r(0,"div",7)(1,"slide-track-droppable-placeholder",8),S("onDrop",function(t){T(e);let o=p(2);return P(o.onSequenceDropAssetSomewhereSendEvent(t));}),s(),r(2,"sequence-track",9),S("onTrackSelected",function(t){T(e);let o=p(2);return P(o.setSelectedTrack(t));})("onEditMenuSelection",function(t){T(e);let o=p(2);return P(o.onEditMenuSelection(t));})("onTrackPlaying",function(t){T(e);let o=p(2);return P(o.onSelectedTrackPlaying(t));}),s()();}if(i&2){let e=u.$implicit;a(),c("id",e.id-1),a(),c("id",e.id)("metadata",e==null||e.slide==null?null:e.slide.metadata)("thumbnailUrl",e.thumbnailUrl)("owner",e.owner)("title",e.title)("isActive",e.active)("editOptions",e.editOptions);}}function kg(i,u){if(i&1){let e=U();r(0,"div",10)(1,"div",11),b(2,"img",12),s(),r(3,"div",13),y(4," \u{1F449} Watch a video tutorial to learn more about sequences "),s(),r(5,"tutorial-button",14),S("onBtnClick",function(){T(e);let t=p(2);return P(t.openHelpVideoPopup());}),s()();}if(i&2){let e=p(2);a(5),c("buttonMode",!0)("featureName","Video Maker")("courseId",e.tutorialCourseId)("lessonId",e.tutorialLessonId)("btnStyle",e.tutorialBtnStyle)("btnCustomStyle",e.tutorialBtnCustomStyle);}}function wg(i,u){if(i&1){let e=U();r(0,"div",2)(1,"div",3),S("cdkDropListDropped",function(t){T(e);let o=p();return P(o.onTrackSwap(t));}),M(2,yg,3,8,"div",4),s(),r(3,"slide-track-droppable-placeholder",5),S("onDrop",function(t){T(e);let o=p();return P(o.onSequenceDropAssetSomewhereSendEvent(t));}),s(),M(4,kg,6,6,"div",6),s();}if(i&2){let e=p();a(2),c("ngForOf",e.trackList),a(),c("id",e.trackList==null?null:e.trackList.length)("empty",(e.trackList==null?null:e.trackList.length)===0)("isLast",!0),a(),c("ngIf",(e.trackList==null?null:e.trackList.length)===0);}}function Tg(i,u){i&1&&(r(0,"div",15),b(1,"app-shimmer"),s());}var Gp=(()=>{class i extends jp{constructor(e,n,t,o,h,k,f,m,v,V,te){super(e,n,t,o,h,k),this.videoSlidesService=e,this.slideListDataService=n,this.assetEventNotificationService=t,this.userHelperService=o,this.dialogHelperService=h,this.notifier=k,this.storyTrackCommunicationService=f,this.uiActionService=m,this.eventsService=v,this.cdRef=V,this.zone=te,this._HELP_VIDEO_STORY_ID="647f30019e1508879f54a0f0",this._HELP_VIDEO_MEDIA_ID="647f30019e1508879f54a0f5",this.tutorialCourseId="626a7c219dadc0984940b2a6",this.tutorialLessonId="62a58a0d7dd9369e7dc01d6f",this.tutorialBtnStyle=Es.blue,this.tutorialBtnCustomStyle={height:"40px",width:"120px"},this.EVENT_PATH_SEQUENCE=this.eventsService.events.sequence,this.setEventListeners=()=>{this.eventListeners=[this.slideListDataService.trackList$.subscribe(this.setTrackList),this.slideListDataService.remoteAssetAddedToList$.subscribe(this.onRemoteAssetAdded),this.assetEventNotificationService.assetAdded$.subscribe(this.onAssetAddedSendEvent),this.storyTrackCommunicationService.observeAddTakeToSequence().subscribe(this.onSequenceDropAsset),this.storyTrackCommunicationService.observeStoryLoading().subscribe($=>this.isLoading=$),this.storyTrackCommunicationService.observeStoryChanged().subscribe($=>this.story=$),this.videoSlidesService.slideStatus$.subscribe(this.listenToPlayAllAndChangeActiveTrack)];},this.listenToPlayAllAndChangeActiveTrack=$=>{this.zone.runOutsideAngular(()=>{let{status:H,slideIndex:j}=$;this.setTrackActiveStatus(j),this.cdRef.detectChanges();});},this.clearEventListeners=()=>
8{this.eventListeners.forEach($=>$.unsubscribe());},this.openHelpVideoPopup=()=>I(this,null,function*(){try{this.uiActionService.openFeaturePreviewVideoDialog(this._HELP_VIDEO_STORY_ID,this._HELP_VIDEO_MEDIA_ID);}catch{this.notifier.error("Failed to load the help video");}}),this.onAssetAddedSendEvent=$=>{$&&$.fileType==="video"&&this.eventsService.log(this.EVENT_PATH_SEQUENCE.add,{source:Hn.library,addMethod:co.button,storyId:this.story?.storyId||void 0}),this.onAssetAdded($);},this.onSequenceDropAssetSomewhereSendEvent=($,H=!1)=>{let{data:j}=$,F=j.type==="storyTake"?Hn.bigvu:Hn.uploads,Z=co.drag;this.eventsService.log(this.EVENT_PATH_SEQUENCE.add,{source:F,addMethod:Z,storyId:this.story.storyId}),this.onSequenceDropAssetSomewhere($,H);},this.onEditMenuSelection=$=>{let{option:H,trackId:j}=$;switch(H.value){case xn.DELETE:this.eventsService.log(this.EVENT_PATH_SEQUENCE.removeStart,{slideType:"take",storyId:this.story.storyId}),this.onRemoveOptionSelection(j);break;default:break;}},this.onRemoveOptionSelection=$=>{this.trackToRemoveId=$,this.dialogHelperService.showUiConfirmationDialog({title:"Remove Slide",msg:"Are you sure you want to remove this slide?",confirmationText:"Yes",cancellationText:"Cancel",onSubmit:this.removeFromTrackListWithEvent});},this.removeFromTrackListWithEvent=()=>{this.eventsService.log(this.EVENT_PATH_SEQUENCE.remove,{slideType:"take",storyId:this.story.storyId}),this.removeFromTrackList();},this.isLoading=!0,this.setSlideTrackCreator(new Js()),this.setEventListeners();}ngOnDestroy(){this.clearEventListeners();}static{this.ɵfac=function(n){return new(n||i)(d($t),d(Zt),d(hs),d(zi),d(Ue),d(Ge),d(He),d(jn),d(Pe),d(jr),d(yo));};}static{this.ɵcmp=G({type:i,selectors:[["sequence-track-list"]],standalone:!0,features:[Ae,q],decls:3,vars:2,consts:[["loading",""],["class","slide-track-list-component",4,"ngIf","ngIfElse"],[1,"slide-track-list-component"],["cdkDropList","",1,"track-list-container",3,"cdkDropListDropped"],["class","track-wrapper","cdkDrag","","cdkDragBoundary",".track-list-container",4,"ngFor","ngForOf"],[3,"onDrop","id","empty","isLast"],["class","tutorial-section",4,"ngIf"],["cdkDrag","","cdkDragBoundary",".track-list-container",1,"track-wrapper"],[3,"onDrop","id"],[3,"onTrackSelected","onEditMenuSelection","onTrackPlaying","id","metadata","thumbnailUrl","owner","title","isActive","editOptions"],[1,"tutorial-section"],[1,"tutorial-image"],["src","/img/script-story-v2/sequence-script.svg","alt","image"],[1,"tutorial-text"],[2,"z-index","1",3,"onBtnClick","buttonMode","featureName","courseId","lessonId","btnStyle","btnCustomStyle"],[1,"shimmer-sequence-parent"]],template:function(n,t){if(n&1&&M(0,wg,5,5,"div",1)(1,Tg,2,0,"ng-template",null,0,Re),n&2){let o=Be(2);c("ngIf",!t.isLoading)("ngIfElse",o);}},dependencies:[_e,_p,Le,vp,Wp,zp,As,hp],styles:[".empty-list-placeholder-container[_ngcontent-%COMP%]{margin:70px auto;height:calc(100vh - 394px);width:100%}.track-list-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start}.slide-track-list-component[_ngcontent-%COMP%]{padding-right:8px}.tutorial-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:16px}.tutorial-image[_ngcontent-%COMP%]{width:100%}.tutorial-image[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{object-fit:cover;width:100%}.tutorial-text[_ngcontent-%COMP%]{width:260px;text-align:center}.shimmer-sequence-parent[_ngcontent-%COMP%]{height:110px;width:100%}"]});}}return i;})();ae();ji();at();Ei();ae();Bi();Ui();J();ae();var Pg=i=>({active:i});function Og(i,u){if(i&1){let e=U();r(0,"div",7),S("click",function(){let t=T(e).$implicit,o=p();return P(o.selectedAspectRatio=t);}),r(1,"div",8),b(2,"div",9),s(),r(3,"div",10),y(4),s()();}if(i&2){let e=u.$implicit,n=p();c("ngClass",ue(4,Pg,n.selectedAspectRatio==e)),a(2),gt(e),a(2),de(e);}}var Xs=class extends Tt{},qp=(()=>{class i extends Pt{constructor(e){super(e),this.data=e,this.title="Sequence format",this.subtitle="Select the final video aspect ratio",this.buttonText="Save",this.aspectRatios=["horizontal","vertical","square"],this.selectedAspectRatio="horizontal";}ngOnInit(){this.selectedAspectRatio=this.data.selectedAspectRatio;}saveAspectRatio(){this.data.onSubmit(this.selectedAspectRatio);}static{this.ɵfac=function(n){return new(n||i)(d(yt));};}static{this.ɵcmp=G({type:i,selectors:[["change-aspect-ratio-dialog"]],standalone:!0,features:[Ae,q],decls:12,vars:4,consts:[[1,"sequence-change-aspect-ratio-dialog-wrapper"],[1,"aspect-ratio-dialog-container"],[1,"aspect-ratio-dialog-title"],[1,"aspect-ratio-dialog-subtitle"],[1,"aspect-ratio-wrapper"],["class","aspect-ratio-container",3,"ngClass","click",4,"ngFor","ngForOf"],[1,"save-btn",3,"click"],[1,"aspect-ratio-container",3,"click","ngClass"],[1,"aspect-ratio-image"],[1,"aspect-ratio-image-inner"],[1,"aspect-ratio-text"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1)(2,"div",2),y(3),s(),r(4,"div",3),y(5),s(),r(6,"div",4),M(7,Og,5,6,"div",5),s(),r(8,"div")(9,"button",6),S("click",function(){return t.saveAspectRatio();}),r(10,"div"),y(11),s()()()()()),n&2&&(a(3),de(t.title),a(2),de(t.subtitle),a(2),c("ngForOf",t.aspectRatios),a(4),de(t.buttonText));},dependencies:[xe,we,Le],styles:[".sequence-change-aspect-ratio-dialog-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;position:relative}.aspect-ratio-dialog-container[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;flex-direction:column}.aspect-ratio-dialog-title[_ngcontent-%COMP%]{color:#253658;text-align:center;font-size:20px;font-weight:700;line-height:24px;letter-spacing:-.4px;margin-bottom:8px}.aspect-ratio-dialog-subtitle[_ngcontent-%COMP%]{color:#253658;text-align:center;font-size:14px;font-weight:400;line-height:19.6px}.save-btn[_ngcontent-%COMP%]{display:flex;height:44px;width:100px;padding:24px;align-items:center;flex-shrink:0;border-radius:10px;background:#4481fd;color:#fff;text-align:center;font-size:16px;font-weight:600;justify-content:center;margin:0 auto}.aspect-ratio-image[_ngcontent-%COMP%]{position:relative;width:96px;height:96px;display:flex;align-items:center;justify-content:center;margin-right:4px;background-color:#7b8db114;border-radius:10px;cursor:pointer}.aspect-ratio-image-inner[_ngcontent-%COMP%]{max-width:72px;max-height:72px;background-color:#4481fd;border-radius:4px}.aspect-ratio-image-inner.horizontal[_ngcontent-%COMP%]{aspect-ratio:16/9;width:100%;height:auto}.aspect-ratio-image-inner.vertical[_ngcontent-%COMP%]{aspect-ratio:9/16;width:auto;height:100%}.aspect-ratio-image-inner.square[_ngcontent-%COMP%]{height:40px;width:40px}.aspect-ratio-wrapper[_ngcontent-%COMP%]{display:flex;gap:24px;margin:24px 0 40px;text-align:center}.aspect-ratio-text[_ngcontent-%COMP%]{text-transform:capitalize;margin-top:8px}.aspect-ratio-container.active[_ngcontent-%COMP%] .aspect-ratio-image-inner[_ngcontent-%COMP%]{background-color:#253658}.aspect-ratio-container.active[_ngcontent-%COMP%] .aspect-ratio-image[_ngcontent-%COMP%]{border:2px solid #253658;border-radius:10px}.aspect-ratio-container.active[_ngcontent-%COMP%] .aspect-ratio-image[_ngcontent-%COMP%]:after{content:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUiIGhlaWdodD0iMTUiIHZpZXdCb3g9IjAgMCAxNSAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPG1hc2sgaWQ9Im1hc2swXzExNjYyXzI0NzEiIHN0eWxlPSJtYXNrLXR5cGU6bHVtaW5hbmNlIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4PSIwIiB5PSIxIiB3aWR0aD0iMTUiIGhlaWdodD0iMTMiPgo8cGF0aCBkPSJNMTIuODc1OCAyLjM0OTc2QzEzLjA0OTggMi4xMzU0IDEzLjM2NDcgMi4xMDI3
8NSAxMy41NzkxIDIuMjc2ODJDMTMuNzY5NiAyLjQzMTU2IDEzLjgxNjYgMi42OTc1NiAxMy43MDI0IDIuOTA1MzFMMTMuNjUyIDIuOTgwMTZMNS42NDAxMSAxMi44NDYxQzUuNDQ5ODYgMTMuMDgwNCA1LjEwMzg5IDEzLjA5MDEgNC44OTkzOCAxMi44ODU3TDQuODQyNTcgMTIuODE3OUwxLjgxMTQ0IDguNDk0MzhDMS42NTI5MiA4LjI2ODI3IDEuNzA3NzIgNy45NTY0NiAxLjkzMzgzIDcuNzk3OTRDMi4xMzQ4MSA3LjY1NzA0IDIuNDAzNTEgNy42ODQ2NyAyLjU3MjA3IDcuODUxMzZMMi42MzAyNiA3LjkyMDMyTDUuMjgwMjQgMTEuNzAxTDEyLjg3NTggMi4zNDk3NloiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjwvbWFzaz4KPGcgbWFzaz0idXJsKCNtYXNrMF8xMTY2Ml8yNDcxKSI+CjxyZWN0IHg9Ii01IiB5PSItNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSJ3aGl0ZSIvPgo8L2c+Cjwvc3ZnPgo=);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:24px;color:#fff}"]});}}return i;})();J();pn();at();var Ig=i=>({"add-scroll":i});function Mg(i,u){if(i&1){let e=U();r(0,"lib-button",15),S("clicked",function(){let t=T(e).$implicit,o=p();return P(o.clickBtn(t.value));}),y(1),s();}if(i&2){let e=u.$implicit,n=p();c("leftIconContent",n.getButtonIcon(e))("disabled",n.trackList.length<1||n.forceDisableBtn||n.loadingDisableBtn),a(),se(" ",n.forceDisableBtn?"Available at "+n.btnDisableCounter:e.name," ");}}var uo=function(i){return i.videoMaker="Video Maker",i.createVideo="Create Video",i;}(uo||{}),Eg="/img/play-control-icon.svg",Ag="/img/pause-control-icon.svg",Dg={[uo.createVideo]:"/img/script-story-v2/video-create.svg",[uo.videoMaker]:"/img/script-story-v2/video-maker.svg"},Kp=(()=>{class i{constructor(e,n,t,o,h,k){this.videoSlidesService=e,this.styleVideoService=n,this.storyTrackCommunicationService=t,this.slideListDataService=o,this.planHelperService=h,this.dialogHelperService=k,this.attemptToFreeCreate=new be(),this._playAllButtonTexts=["Play All","Pause"],this.isPlayingAll=!1,this.totalDuration=0,this.aspectRatioValues={horizontal:"16:9",vertical:"9:16",square:"1:1"},this.createButtons=[],this.trackList=[],this.playIcon=Eg,this.pauseIcon=Ag,this.getButtonIcon=f=>Dg[f.value]||"",this.forceDisableBtn=!1,this.loadingDisableBtn=!1,this.btnDisableCounter=0,this.setEventListeners=()=>{this.eventListeners=[this.storyTrackCommunicationService.observeStoryChanged().subscribe(this.setStory),this.slideListDataService.trackList$.subscribe(this.setTrackList),this.storyTrackCommunicationService.observeSequenceLoading().subscribe(f=>{this.loadingDisableBtn=f,this.loadingDisableBtn&&this.makeBtnDisabled(5e3);}),this.videoSlidesService.slideStatus$.subscribe(f=>{let{status:m,slideIndex:v}=f;m==="pause"&&this.stopPlaying();}),this.slideListDataService.selectedSlide$.subscribe(this.onSlidePlayback),this.videoSlidesService.playSelectedSlide.subscribe(this.onSlidePlayback),this.storyTrackCommunicationService.observePlayerTrack().subscribe(this.onPlayerTrackChange),this.styleVideoService.aspectRatioStyle$.subscribe(this.setAspectRatio)];},this.onPlayerTrackChange=f=>{f&&(this.videoSlidesService.playAllSlides$.next(!1),this.stopPlaying());},this.onSlidePlayback=()=>{this.storyTrackCommunicationService.setStopVideo(),this.stopPlaying();},this.stopPlaying=()=>{this.isPlayingAll=!1,this.setPlayButtonText();},this.setSequenceTrackEditOptions=()=>{this.sequenceTrackEditOptions=[new St(xn.DELETE,"Remove Media","color: var(--red-500, #E53935)","/img/icon-library/basic-ui/delete-trash-small.svg")];},this.setTrackList=f=>{f&&(this.trackList=f,this.totalDuration=this.slideListDataService.getTotalDuration(f));},this.clickBtn=f=>I(this,null,function*(){switch(f){case uo.createVideo:(yield this.planHelperService.isFreeByCurrentPlan())?this.attemptToFreeCreate.next():this.storyTrackCommunicationService.setCreateSequence();return;case uo.videoMaker:return;}}),this.makeBtnDisabled=f=>{this.forceDisableBtn=!0,this.btnDisableCounter=f/1e3,this.intervalId=setInterval(this.countDown,1e3);},this.countDown=()=>{this.btnDisableCounter--,this.btnDisableCounter===0&&(clearInterval(this.intervalId),this.forceDisableBtn=!1,this.loadingDisableBtn=!1);},this.onTrackListChange=f=>{this.storyTrackCommunicationService.setSequenceListChanges(f);},this.playAll=()=>{this.isPlayingAll=!this.isPlayingAll,this.setPlayButtonText(),this.isPlayingAll&&this.storyTrackCommunicationService.setStopVideo(),this.videoSlidesService.playAllSlides$.next(this.isPlayingAll);},this.setPlayButtonText=()=>{this.playAllButtonText=this._playAllButtonTexts[+this.isPlayingAll];},this.setAspectRatio=f=>{this.aspectRatio=f;},this.setStory=f=>{f&&(this.story=f,this.aspectRatio||this.styleVideoService.aspectRatioStyle$.next(this.story?.metadata?.sequenceData?.aspectRatio||"horizontal"));},this.setPlayButtonText(),this.setSequenceTrackEditOptions();}
8ngOnInit(){this.createButtons=[new St(uo.createVideo,uo.createVideo,"buttons-container blue","btn-image blue-btn")],this.setEventListeners();}openChangeAspectRatioDialog(){let e=new Xs();e.selectedAspectRatio=this.aspectRatio,e.onClose=this.dialogHelperService.close,e.onSubmit=t=>{this.styleVideoService.aspectRatioStyle$.next(t),this.dialogHelperService.close();};let n=new We();n.panelClass="dialog-24p-20br",this.dialogHelperService.open(e,qp,n);}static{this.ɵfac=function(n){return new(n||i)(d($t),d(Qi),d(He),d(Zt),d(zt),d(Ue));};}static{this.ɵcmp=G({type:i,selectors:[["app-script-sequence"]],outputs:{attemptToFreeCreate:"attemptToFreeCreate"},standalone:!0,features:[q],decls:26,vars:16,consts:[[1,"script-sequence-container"],[1,"sequence-info"],[1,"header-title"],[1,"header-stats"],["size","sm","variant","primary",3,"clicked","leftIconContent","disabled"],[1,"count"],[1,"time"],["src","/img/script-story-v2/clock.svg","alt","image"],[1,"aspect-ratio",3,"click"],[1,"aspect-ratio-image"],[1,"aspect-ratio-image-inner"],[1,"header-buttons"],["size","md","variant","primary",3,"leftIconContent","disabled","clicked",4,"ngFor","ngForOf"],[1,"sequence-container",3,"ngClass"],[3,"onTrackListChange","trackEditOptions"],["size","md","variant","primary",3,"clicked","leftIconContent","disabled"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"header")(2,"div",1)(3,"div",2)(4,"div"),y(5,"Sequence"),s()(),r(6,"div",3)(7,"lib-button",4),S("clicked",function(){return t.playAll();}),y(8),s(),r(9,"div",5),y(10),s(),r(11,"div",6),b(12,"img",7),r(13,"div"),y(14),tt(15,"date"),s()(),r(16,"div",8),S("click",function(){return t.openChangeAspectRatioDialog();}),r(17,"div",9),b(18,"div",10),s(),r(19,"div"),y(20),s()()()(),r(21,"div",11),M(22,Mg,2,3,"lib-button",12),s()(),r(23,"main")(24,"div",13)(25,"sequence-track-list",14),S("onTrackListChange",function(h){return t.onTrackListChange(h);}),s()()()()),n&2&&(a(7),c("leftIconContent",t.isPlayingAll?t.pauseIcon:t.playIcon)("disabled",(t.trackList==null?null:t.trackList.length)===0),a(),se(" ",t.playAllButtonText," "),a(2),se("",t.trackList.length," Scenes"),a(4),de(_n(15,11,t.totalDuration*1e3,"mm:ss")),a(4),gt(t.aspectRatio),a(2),de(t.aspectRatioValues[t.aspectRatio]),a(2),c("ngForOf",t.createButtons),a(2),c("ngClass",ue(14,Ig,t.trackList.length>0)),a(),c("trackEditOptions",t.sequenceTrackEditOptions));},dependencies:[we,Le,Gp,Oo,Fi],styles:[".script-sequence-container[_ngcontent-%COMP%]{height:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:26px}header[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between}.sequence-info[_ngcontent-%COMP%]{width:100%;height:60px;display:flex;flex-direction:column;align-items:flex-start;justify-content:space-between}.sequence-info[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:24px;height:24px}.header-title[_ngcontent-%COMP%]{font-family:Inter,sans-serif;font-weight:700;font-size:20px;line-height:24px;display:flex;align-items:center;justify-content:flex-start;gap:4px}.header-stats[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:14px}.count[_ngcontent-%COMP%]{font-weight:400;font-size:14px;line-height:17px}.time[_ngcontent-%COMP%]{font-weight:400;font-size:14px;line-height:17px;display:flex;align-items:center;justify-content:flex-start}.header-stats[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:20px;height:20px;margin-right:2px}main[_ngcontent-%COMP%]{width:100%;height:80%}.sequence-container[_ngcontent-%COMP%]{height:100%}.add-scroll[_ngcontent-%COMP%]{overflow-y:scroll}.aspect-ratio[_ngcontent-%COMP%]{padding:0 8px;height:28px;background-color:#fff;border-radius:10px;border:1px solid #7B8DB14D;display:flex;justify-content:center;align-items:center;cursor:pointer}.aspect-ratio-image[_ngcontent-%COMP%]{width:20px;height:20px;display:flex;align-items:center;justify-content:center;margin-right:4px}.aspect-ratio-image-inner[_ngcontent-%COMP%]{max-width:15px;max-height:15px;background-color:#4481fd;border-radius:2px}.aspect-ratio-image-inner.horizontal[_ngcontent-%COMP%]{aspect-ratio:16/9;width:100%;height:auto}.aspect-ratio-image-inner.vertical[_ngcontent-%COMP%]{aspect-ratio:9/16;width:auto;height:100%}.aspect-ratio-image-inner.square[_ngcontent-%COMP%]{height:100%;width:100%}"]});}}return i;})();J();il();Bt();rr();J();J();Wr();var Zs=(()=>{class i{constructor(e){this.sanitizer=e;}transform(e){return this.sanitizer.bypassSecurityTrustResourceUrl(e);}static{this.ɵfac=function(n){return new(n||i)(d($r,16));};}static{this.ɵpipe=Ar({name:"urlSecurityPipe",type:i,pure:!0,standalone:!0});}}return i;})();ae();Tm();var Sr="Processing...",Yp="Uploading",Za="Generating captions",ea="Rendering video",Ko="Transcoding",Qp={[st.captions]:Za,[st.captionsWithMaxWords]:Za,[st.emphasizedCaptions]:Za,[st.segmentation]:"Processing captions",[st.generateVideo]:ea,[st.vdmV2GenerateVideo]:ea,[st.assetVideoGenerate]:ea,[st.collectionVideoGenerate]:ea,[st.audioGramGenerate]:"Rendering audiogram",[st.textToAiAvatarVideo]:"Generating avatar video",[st.eyeContact]:"Applying eye contact fix",[st.backgroundChange]:"Changing background",[st.blur]:"Blurring background",[st.broll]:"Generating B-roll",[st.trim]:"Trimming",[st.audioNorm]:"Normalizing audio",[st.videoDub]:"Dubbing video",[st.textToSpeech]:"Generating voice",[st.transcode]:Ko,[st.hls]:Ko,[st.assetAttach]:Ko,[st.videoAssetAttach]:Ko,[st.autoShort]:"Creating shorts",[st.chromaKey]:"Applying Backgroun
8d",[st.zoom]:"Applying AI zoom",[st.logo]:"Adding logo",[st.lower3rd]:"Adding lower 3rd",[st.intro]:"Adding intro",[st.outtro]:"Adding outro",[st.soundBed]:"Adding sound bed",[st.previewVideoAndThumbnails]:"Generating preview"};function Jp(i){if(!i||!i.actions||i.actions.length===0)return Sr;for(let u of i.actions)if(Qp[u])return Qp[u];return Sr;}ji();ji();vi();J();vi();var Vg=["badgesContainer"],Rg=i=>({"take-active":i}),Zp=i=>({$implicit:i});function Ng(i,u){if(i&1){let e=U();r(0,"lib-button-icon",16),S("clicked",function(t){T(e);let o=p(3);return P(o.onFailedDeleteClick(t));}),s();}if(i&2){let e=p(3);c("iconContent",e.closeIcon);}}function Fg(i,u){if(i&1){let e=U();ot(0),r(1,"div",11)(2,"div",12),y(3),s(),r(4,"div",13),vn(5,5),s()(),r(6,"div",14),S("click",function(t){return T(e),P(t.stopPropagation());}),M(7,Ng,1,1,"lib-button-icon",15),s(),rt();}if(i&2){let e=p(2);a(3),de(e.trackData.title),a(4),c("ngIf",!e.isViewer);}}function jg(i,u){if(i&1&&(ot(0),r(1,"div",17)(2,"div",18),y(3),s(),b(4,"app-progress-track",19),s(),rt()),i&2){let e,n=p(3);a(3),de(n.processingLabel),a(),c("progress",(e=n.realProgress)!==null&&e!==void 0?e:0)("estimate",n.processingEstimate);}}function Bg(i,u){if(i&1&&b(0,"lib-badge",32),i&2){let e=p(4);c("color",e.slotBadge.color)("text",e.slotBadge.label)("matTooltipPosition","above")("matTooltip",e.slotBadge.tooltip);}}function Ug(i,u){if(i&1){let e=U();r(0,"lib-button-icon",33),S("click",function(t){return T(e),P(t.stopPropagation());})("mousedown",function(t){T(e);let o=p(4);return P(o.onMoveMouseDown(t));})("touchstart",function(t){T(e);let o=p(4);return P(o.onMoveTouchStart(t));}),s();}if(i&2){let e=p(4);c("iconContent",e.moveIcon)("matTooltipPosition","above");}}function Hg(i,u){if(i&1&&(ot(0),r(1,"div",34),In(2,35),s(),rt()),i&2){let e=u.$implicit,n=u.index;p();let t=Be(18),o=p(3);a(),cn("is-overflow",n>=o.visibleBadgeCount),Lr("data-badge-idx",n),a(),c("ngTemplateOutlet",t)("ngTemplateOutletContext",ue(5,Zp,e));}}function zg(i,u){if(i&1&&In(0,35),i&2){let e=u.$implicit;p(2);let n=Be(18);c("ngTemplateOutlet",n)("ngTemplateOutletContext",ue(2,Zp,e));}}function $g(i,u){if(i&1&&(r(0,"div",36),M(1,zg,1,4,"ng-container",37),s()),i&2){let e=p(4);a(),c("ngForOf",e.overflowFeatures);}}function Wg(i,u){if(i&1&&b(0,"lib-badge",40),i&2){let e=p().$implicit;c("text",e.value)("matTooltipPosition","above")("matTooltip",e.tooltipName);}}function Gg(i,u){if(i&1&&(r(0,"div",41),b(1,"span"),s()),i&2){let e=p().$implicit;c("matTooltipPosition","above")("matTooltip",e.tooltipName),a(),gt(e.sideIconClass);}}function qg(i,u){if(i&1&&M(0,Wg,1,3,"lib-badge",38)(1,Gg,2,4,"div",39),i&2){let e=u.$implicit;c("ngIf",!e.sideIconClass),a(),c("ngIf",e.sideIconClass);}}function Kg(i,u){if(i&1){let e=U();r(0,"lib-button-icon",49),S("clicked",function(t){T(e);let o=p(5);return P(o.onCaptionsClick(t));}),s();}if(i&2){let e=p(5);c("iconContent",e.captionsIcon)("disabled",e.isComposerDeleted)("matTooltipPosition","above")("matTooltip",e.composerActionTooltip);}}function Qg(i,u){if(i&1){let e=U();r(0,"lib-button-icon",50),S("clicked",function(t){T(e);let o=p(5);return P(o.onCaptionsClick(t));}),s();}if(i&2){let e=p(5);c("iconContent",e.captionsIcon)("matTooltipPosition","above");}}function Yg(i,u){if(i&1){let e=U();r(0,"lib-button-icon",51),S("clicked",function(t){T(e);let o=p(5);return P(o.onWordTrimClick(t));}),s();}if(i&2){let e=p(5);c("iconContent",e.scissorsIcon)("matTooltipPosition","above");}}function Jg(i,u){if(i&1){let e=U();r(0,"lib-button-icon",52),S("clicked",function(t){T(e);let o=p(5);return P(o.onAddToSequenceClick(t));}),s();}if(i&2){let e=p(5);c("iconContent",e.sequenceIcon)("matTooltipPosition","above");}}function Xg(i,u){if(i&1){let e=U();r(0,"lib-button-icon",53),S("clicked",function(t){T(e);let o=p(5);return P(o.onRenameClick(t));}),s();}if(i&2){let e=p(5);c("iconContent",e.renameIcon)("matTooltipPosition","above");}}function Zg(i,u){if(i&1){let e=U();r(0,"lib-button-icon",16),S("clicked",function(t){T(e);let o=p(5);return P(o.onEditClick(t));}),s();}if(i&2){let e=p(5);c("iconContent",e.moreIcon);}}function e0(i,u){if(i&1){let e=U();r(0,"div",42),S("click",function(t){return T(e),P(t.stopPropagation());}),M(1,Kg,1,4,"lib-button-icon",43)(2,Qg,1,2,"lib-button-icon",44)(3,Yg,1,2,"lib-button-icon",45)(4,Jg,1,2,"lib-button-icon",46)(5,Xg,1,2,"lib-button-icon",47),r(6,"lib-button-icon",48),S("clicked",function(t){T(e);let o=p(4);return P(o.onDeleteClick(t));}),s(),M(7,Zg,1,1,"lib-button-icon",15),s();}if(i&2){let e=p(4);a(),c("ngIf",e.isComposerRow),a(),c("ngIf",!e.isComposerRow),a(),c("ngIf",!e.isComposerDraft),a(),c("ngIf",!e.isComposerDraft),a(),c("ngIf",!e.isComposerDraft),a(),c("iconContent",e.trashIcon)("matTooltipPosition","above"),a(),c("ngIf",!e.isComposerDraft);}}function t0(i,u){if(i&1&&(r(0,"div",20)(1,"div",21)(2,"div",22)(3,"div",12),y(4),s(),M(5,Bg,1,4,"lib-badge",23)(6,Ug,1,2,"lib-button-icon",24),s(),r(7,"div",25),y(8),s()(),r(9,"div",26)(10,"div",27,2),M(12,Hg,3,7,"ng-container",28),r(13,"div",29),b(14,"lib-badge",30),s(),M(15,$g,2,1,"ng-template",null,3,Re)(17,qg,2,2,"ng-template",null,4,Re),s(),M(19,e0,8,8,"div",31),s()()),i&2){let e=Be(16),n=p(3);a(4),de(n.trackData.title),a(),c("ngIf",n.slotBadge),a(),c("ngIf",!n.isViewer&&!n.isComposerDraft),a(2),de(n.formattedDuration),a(4),c("ngForOf",n.allFeatures),a(),cn("is-hidden",n.overflowCount===0),c("content",e),a(),c("text","+"+(n.overflowCount||n.allFeatures.length)),a(5),c("ngIf",!n.isViewer);}}function i0(i,u){if(i&1&&M(0,jg,5,3,"ng-container",10)(1,t0,20,10,"ng-template",null,1,Re),i&2){let e=Be(2),n=p(2);c("ngIf",n.isProcessing)("ngIfElse",e);}}function n0(i,u){if(i&1&&(r(0,"div",7)(1,"div",8),b(2,"img",9),tt(3,"urlSecurityPipe"),s(),M(4,Fg,8,2,"ng-container",10)(5,i0,3,2,"ng-template",null,0,Re),s()),i&2){let e=Be(6),n=p();c("ngClass",ue(8,Rg,n.trackData==null?null:n.trackData.active)),a(),cn("take-thumbnail--processing",n.isProcessing),a(),c("src",wt(3,6,n.takeThumbnailUrl),Ie),a(2),c("ngIf",n.isFailed)("ngIfElse",e);}}var o0="/img/icon-library/subtitles/captions.svg",r0="/img/icon-library/tools/scissors.svg",s0="/img/script-story-v2/sequence.svg",a0="/img/icon-library/basic-ui/rename-storke.svg",c0="/img/icon-library/basic-ui/delete-trash.svg",l0="/img/icons/more-vertical.svg",d0="/img/icon-library/actions/move.svg",p0="/img/icon-library/basic-ui/close-regular.svg",Xp=6,eh=(()=>{class i{constructor(e,n,t,o){this.storyTrackCommunicationService=e,this.taskProgressService=n,this.cdr=t,this.ngZone=o,this.slotBadge=null,this.instantDragRequested=new be(),this.closeIcon=p0,this.captionsIcon=o0,this.scissorsIcon=r0,this.sequenceIcon=s0,this.renameIcon=a0,this.trashIcon=c0,this.moreIcon=l0,this.moveIcon=d0,this.takeThumbnailUrl=zo,this.realProgress=null,this.allFeatures=[],this.visibleBadgeCount=0,this.formattedDuration="",this.measureRafHandle=null,this.destroyed=!1,this.processingData=null,this.processingLabel=Sr,this.processingEstimate=null,this.initTrack=h=>{this.isViewer=h,this.trackData&&(this.trackData.fromUpload&&this.processingLabel===Sr&&(this.processingLabel=Ko),this.trackData.status===ct.local?this.takeThumbnailUrl=URL.createObjectURL(this.trackData.localTake.thumbnail)||zo:this.trackData.kind==="composerDraft"?this.takeThumbnailUrl=this.trackData.composerThumbnailUrl||zo:this.trackData.video?.status==1||this.trackData.processFailed?this.takeThumbnailUrl=zo:this.takeThumbnailUrl=this.trackData.video?.thumbnails?this.trackData.video.thumbnails[this.trackData.video.thumbnails.length-1].url:zo,this.allFeatures=this.trackData.feature||[],this.visibleBadgeCount=this.allFeatures.length,this.scheduleMeasureBadges(),this.formattedDuration=this.formatDuration(this.trackData.video?.duration),this.processingEstimate=this.formatEstimateSeconds(this.trackData.video?.estimatedCompletionTimeInSeconds));},this.onCaptionsClick=h=>{h?.stopPropagation(),this.dispatchAction(qe.openVideoMaker);},this.onEditClick=h=>{h?.stopPropagation(),this.dispatchAction(qe.openMore);},this.onWordTrimClick=h=>{h?.stopPropagation(),this.dispatchAction(qe.wordTrim);},this.onAddToSequenceClick=h=>{h?.stopPropagation(),this.dispatchAction(qe.addToSequence);},this.onRenameClick=h=>{h?.stopPropagation(),this.dispatchAction(qe.rename);},this.onDeleteClick=h=>{h?.stopPropagation(),this.dispatchAction(qe.delete);},this.onFailedDeleteClick=h=>{h?.stopPropagation(),this.dispatchAction(qe.delete);},this.onMoveMouseDown=h=>{this.isViewer||this.instantDragRequested.emit(h);},this.onMoveTouchStart=h=>{this.isViewer||this.instantDragRequested.emit(h);},this.eventListeners=[];}get isComposerRow(){return!!this.trackData?.isComposerRow;}get isComposerDraft(){return this.trackData?.kind==="composerDraft";}get isComposerDeleted(){return!!this.trackData?.composerDeleted;}get composerActionTooltip(){return Ho(this.trackData?.composerStoryType)?ud:md;}get overflowFeatures(){return this.allFeatures.slice(this.visibleBadgeCount);}get overflowCount(){return Math.max(0,this.allFeatures.length-this.visibleBadgeCount);}ngOnInit(){this.eventListeners.push(this.storyTrackCommunicationService.observeIsViewer().subscribe(this.initTrack)),this.isUploading&&(this.processingLabel=Yp,this.eventListeners.push(this.uploadState.value.subscribe(e=>{this.realProgress=this.clampProgress(e?.progress??0);}))),this.trackData?.video?.id&&(this.eventListeners.push(this.taskProgressService.getProgressDataForEntity(this.trackData.video.id).subscribe(e=>{if(this.processingData=e,e){let n=this.taskProgressService.getProgressPercentage(e,this.trackData.video.id);n!=null&&(this.realProgress=this.clampProgress(n)),this.processingLabel=Jp(e);}})),this.eventListeners.push(this.taskProgressService.taskFailed$.subscribe(e=>{e&&e.entityIds&&e.entityIds.includes(this.trackData.video?.id)&&this.storyTrackCommunicationService.setTakeProcessFailed({videoId:this.trackData.video?.id,entityId:e.entityId,eventId:e.eventId,actions:e.actions,supplementary:e.supplementary});})));}ngOnChanges(e){e.trackData&&(this.trackData?.progress&&(this.realProgress=this.clampProgress(this.trackData.progress)),e.trackData.firstChange||this.initTrack(this.isViewer));}get isUploading(){return!this.trackData&&!!this.uploadState;}get isProcessing(){if(this.isUploading)return!0;
8if(this.isFailed||this.trackData?.video?.status===2||this.realProgress!==null&&this.realProgress>=100)return!1;if(this.trackData?.video?.status===1)return!0;let e=this.realProgress!==null&&this.realProgress<100,n=!!this.processingData,t=!!this.trackData?.progress;return e&&(n||t);}get isFailed(){return!!this.trackData?.processFailed||this.trackData?.video?.status===-1;}ngAfterViewInit(){this.badgesContainerRef&&typeof ResizeObserver<"u"&&this.ngZone.runOutsideAngular(()=>{this.resizeObserver=new ResizeObserver(()=>this.scheduleMeasureBadges()),this.resizeObserver.observe(this.badgesContainerRef.nativeElement);}),this.scheduleMeasureBadges();}ngOnDestroy(){this.destroyed=!0,this.measureRafHandle!==null&&(cancelAnimationFrame(this.measureRafHandle),this.measureRafHandle=null),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.eventListeners.forEach(e=>e.unsubscribe());}scheduleMeasureBadges(){this.destroyed||this.measureRafHandle!==null||this.ngZone.runOutsideAngular(()=>{this.measureRafHandle=requestAnimationFrame(()=>{this.measureRafHandle=null,!this.destroyed&&this.ngZone.run(()=>this.measureBadges());});});}measureBadges(){if(this.destroyed)return;let e=this.badgesContainerRef?.nativeElement;if(!e)return;let n=e.clientWidth;if(n===0)return;let t=Array.from(e.querySelectorAll("[data-badge-idx]")),o=e.querySelector("[data-overflow-badge]");if(t.length===0){this.visibleBadgeCount!==0&&(this.visibleBadgeCount=0,this.cdr.detectChanges());return;}let h=o?Xp+o.offsetWidth:0,k=0,f=0;for(let m=0;m<t.length;m++){let v=t[m].offsetWidth,V=k+(m>0?Xp:0)+v,$=t.length-(m+1)>0?h:0;if(V+$<=n)k=V,f=m+1;else break;}f!==this.visibleBadgeCount&&(this.visibleBadgeCount=f,this.cdr.detectChanges());}dispatchAction(e){this.isViewer||this.storyTrackCommunicationService.setTakeAction(this.trackData,e);}clampProgress(e){return Math.min(Math.max(Math.floor(e),0),100);}formatDuration(e){if(!e)return"00:00";let n=Math.floor(e/60),t=Math.floor(e%60);return`${n.toString().padStart(2,"0")}:${t.toString().padStart(2,"0")}`;}formatEstimateSeconds(e){if(!e||e<=0)return null;if(e<60)return`~${Math.round(e)}s`;let n=Math.round(e/60);if(n<60)return`~${n} min`;let t=Math.floor(n/60),o=n%60;return o?`~${t}h ${o}m`:`~${t}h`;}static{this.ɵfac=function(n){return new(n||i)(d(He),d(ms),d(jr),d(yo));};}static{this.ɵcmp=G({type:i,selectors:[["take-track"]],viewQuery:function(n,t){if(n&1&&Ye(Vg,5),n&2){let o;Ne(o=Fe())&&(t.badgesContainerRef=o.first);}},inputs:{trackData:"trackData",uploadState:"uploadState",slotBadge:"slotBadge"},outputs:{instantDragRequested:"instantDragRequested"},standalone:!0,features:[Ut,q],decls:1,vars:1,consts:()=>{let e;e="Failed";let n;n="Drag to add sequence";let t;t="Create Video";let o;o="Word Trim";let h;h="Add to Sequence";let k;k="Rename";let f;return f="Delete",[["processingOrReady",""],["readyState",""],["badgesContainer",""],["overflowTooltip",""],["badge",""],e,["class","take-track-container",3,"ngClass",4,"ngIf"],[1,"take-track-container",3,"ngClass"],[1,"take-thumbnail"],["alt","",3,"src"],[4,"ngIf","ngIfElse"],[1,"take-content","take-content--failed"],[1,"take-title"],[1,"take-failed-badge"],[1,"take-actions","take-actions--failed",3,"click"],["size","xs","variant","ghost",3,"iconContent","clicked",4,"ngIf"],["size","xs","variant","ghost",3,"clicked","iconContent"],[1,"take-content","take-content--processing"],[1,"take-processing-label"],[3,"progress","estimate"],[1,"take-content"],[1,"take-top-group"],[1,"take-title-row"],["class","take-slot-badge","size","small","shape","rectangle","matTooltipClass","tooltip-custom-black-take",3,"color","text","matTooltipPosition","matTooltip",4,"ngIf"],["class","take-move-handle","size","xs","variant","tertiary","matTooltipClass","tooltip-custom-black-take","matTooltip",n,3,"iconContent","matTooltipPosition","click","mousedown","touchstart",4,"ngIf"],[1,"take-duration"],[1,"take-bottom-row"],[1,"take-badges"],[4,"ngFor","ngForOf"],["data-overflow-badge","","tooltip","",1,"overflow-badge-wrapper",3,"content"],["size","small","color","neutral",3,"text"],["class","take-action-icons",3,"click",4,"ngIf"],["size","small","shape","rectangle","matTooltipClass","tooltip-custom-black-take",1,"take-slot-badge",3,"color","text","matTooltipPosition","matTooltip"],["size","xs","variant","tertiary","matTooltipClass","tooltip-custom-black-take","matTooltip",n,1,"take-move-handle",3,"click","mousedown","touchstart","iconContent","matTooltipPosition"],[1,"badge-slot"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"overflow-tooltip-content"],[3,"ngTemplateOutlet","ngTemplateOutletContext",4,"ngFor","ngForOf"],["size","small","color","neutral","matTooltipClass","tooltip-custom-black-take",3,"text","matTooltipPosition","matTooltip",4,"ngIf"],["class","take-flag-badge","matTooltipClass","tooltip-custom-black-take",3,"matTooltipPosition","matTooltip",4,"ngIf"],["size","small","color","neutral","matTooltipClass","tooltip-custom-black-take",3,"text","matTooltipPosition","matTooltip"],["matTooltipClass","tooltip-custom-black-take",1,"take-flag-badge",3,"matTooltipPosition","matTooltip"],[1,"take-action-icons",3,"click"],["size","xs","variant","ghost","matTooltipClass","tooltip-custom-black-take",3,"iconContent","disabled","matTooltipPosition","matTooltip","clicked",4,"ngIf"],["size","xs","variant","ghost","matTooltipClass","tooltip-custom-black-take","matTooltip",t,3,"iconContent","matTooltipPosition","clicked",4,"ngIf"],["size","xs","variant","ghost","matTooltipClass","tooltip-custom-black-take","matTooltip",o,3,"iconContent","matTooltipPosition","clicked",4,"ngIf"],["size","xs","variant","ghost","matTooltipClass","tooltip-custom-black-take","matTooltip",h,3,"iconContent","matTooltipPosition","clicked",4,"ngIf"],["size","xs","variant","ghost","matTooltipClass","tooltip-custom-black-take","matTooltip",k,3,"iconContent","matTooltipPosition","clicked",4,"ngIf"],["size","xs","variant","ghost","matTooltipClass","tooltip-custom-black-take","matTooltip",f,3,"clicked","iconContent","matTooltipPosition"],["size","xs","variant","ghost","matTooltipClass","tooltip-custom-black-take",3,"clicked","iconContent","disabled","matTooltipPosition","matTooltip"],["size","xs","variant","ghost","matTooltipClass","tooltip-custom-black-take","matTooltip",t,3,"clicked","iconContent","matTooltipPosition"],["size","xs","variant","ghost","matTooltipClass","tooltip-custom-black-take","matTooltip",o,3,"clicked","iconContent","matTooltipPosition"],["size","xs","variant","ghost","matTooltipClass","tooltip-custom-black-take","matTooltip",h,3,"clicked","iconContent","matTooltipPosition"],["size","xs","variant","ghost","matTooltipClass","tooltip-custom-black-take","matTooltip",k,3,"clicked","iconContent","matTooltipPosition"]];},template:function(n,t){n&1&&M(0,n0,7,10,"div",6),n&2&&c("ngIf",t.trackData||t.uploadState);},dependencies:[_e,we,Le,Po,Zs,Xd,Yr,Vn,Hi,Xt,zd],styles:['.take-track-container[_ngcontent-%COMP%]{width:100%;padding:8px;display:flex;align-items:center;gap:12px;background:#fff;border:1px solid #e1e7f0;border-radius:10px;box-sizing:border-box}.take-track-container.take-active[_ngcontent-%COMP%]{background:#00abfe14!important}.take-thumbnail[_ngcontent-%COMP%]{position:relative;width:70px;height:70px;flex-shrink:0;border-radius:8px;overflow:hidden}.take-thumbnail[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{display:block;width:100%;height:100%;object-fit:cover}.take-thumbnail--processing[_ngcontent-%COMP%]{pointer-events:none}.take-thumbnail--processing[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50%;height:100%;object-fit:contain;margin:0 auto}.take-thumbnail--processing[_ngcontent-%COMP%]:after{content:"";position:absolute;inset:0;z-index:2;border-radius:8px;background:#0009}.take-thumbnail--processing[_ngcontent-%COMP%]:before{content:"";position:absolute;
8left:1px;right:1px;height:3px;z-index:3;background-image:url(/img/script-story-v2/take-thumbnail-scan-line.svg);background-repeat:no-repeat;background-size:100% 100%;animation:_ngcontent-%COMP%_take-thumbnail-scan-line 2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_take-thumbnail-scan-line{0%{top:0}50%{top:calc(100% - 3px)}to{top:0}}.take-content[_ngcontent-%COMP%]{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:space-between;align-self:stretch;gap:8px}.take-content--processing[_ngcontent-%COMP%], .take-content--failed[_ngcontent-%COMP%]{justify-content:center;gap:4px}.take-top-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px}.take-title-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;width:100%;min-width:0}.take-slot-badge[_ngcontent-%COMP%]{flex:0 0 auto;white-space:nowrap}.take-title[_ngcontent-%COMP%]{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:Inter,sans-serif;font-weight:600;font-size:14px;line-height:1.4;letter-spacing:-.14px;color:#253658}.take-duration[_ngcontent-%COMP%]{font-family:Inter,sans-serif;font-weight:400;font-size:12px;line-height:1.4;letter-spacing:-.12px;color:#6b7280}.take-badges[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;flex-wrap:nowrap;gap:6px;min-width:0;overflow:hidden}.badge-slot[_ngcontent-%COMP%]{display:inline-flex;flex-shrink:0}.badge-slot.is-overflow[_ngcontent-%COMP%]{position:absolute;left:-9999px;top:0;visibility:hidden;pointer-events:none}.take-flag-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;height:16px;padding:2px 6px;background-color:#f3f4f6;border-radius:100px}.take-flag-badge[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;width:13px;height:13px}.overflow-badge-wrapper[_ngcontent-%COMP%]{flex-shrink:0;cursor:pointer}.overflow-badge-wrapper.is-hidden[_ngcontent-%COMP%]{position:absolute;left:-9999px;top:0;visibility:hidden;pointer-events:none}.overflow-tooltip-content[_ngcontent-%COMP%]{width:160px;padding:8px;display:flex;flex-wrap:wrap;align-content:flex-start;gap:4px;background:#fff;border-radius:10px;box-shadow:0 24px 48px #0000001f;box-sizing:border-box;animation:_ngcontent-%COMP%_tooltip-fade-in .2s ease-out}@keyframes _ngcontent-%COMP%_tooltip-fade-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.take-actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;justify-content:center}.take-bottom-row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0}.take-bottom-row[_ngcontent-%COMP%] .take-badges[_ngcontent-%COMP%]{flex:1 1 0}.take-action-icons[_ngcontent-%COMP%]{flex:0 0 auto;display:flex;flex-direction:row;align-items:center;gap:2px}.take-move-handle[_ngcontent-%COMP%]{flex:0 0 auto;margin-left:auto;cursor:grab;touch-action:none}.take-move-handle[_ngcontent-%COMP%]:active{cursor:grabbing}.take-processing-label[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:Inter,sans-serif;font-weight:600;font-size:14px;line-height:1.4;letter-spacing:-.14px;color:#253658}.take-failed-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;align-self:flex-start;height:16px;padding:2px 6px;background:#fee2e2;color:#b91c1c;border-radius:100px;font-family:Inter,sans-serif;font-weight:400;font-size:10px;line-height:1.4}']});}}return i;})();ae();ji();J();ht();var h0=(i,u)=>({"track-disabled":i,"drag-ready":u}),m0=(i,u,e)=>({story:i,takeId:u,headline:e}),u0=i=>({type:"storyTake",data:i}),g0=()=>({delay:100,delta:10});function f0(i,u){i&1&&(r(0,"div",10),b(1,"i",11),r(2,"span",12),vn(3,1),s()()),i&2&&c("@noteFade",void 0);}function v0(i,u){if(i&1){let e=U();r(0,"lib-button-icon",13),S("clicked",function(){T(e);let t=p();return P(t.onUploadTakeClick());}),s();}if(i&2){let e=p();c("iconContent",e.uploadTakeIcon),Lr("aria-label",e.uploadTakeLabel)("title",e.uploadTakeLabel);}}function _0(i,u){if(i&1&&(r(0,"div",14),b(1,"take-track",15),s()),i&2){let e=u.$implicit;a(),c("uploadState",e);}}function C0(i,u){if(i&1&&(r(0,"div",18),b(1,"take-track",19),s()),i&2){let e=p().$implicit;a(),c("trackData",e);}}function b0(i,u){if(i&1){let e=U();r(0,"div",16),S("click",function(){let t=T(e).$implicit,o=p();return P(o.activateTrack(t,!0));})("mousedown",function(){let t=T(e).$implicit,o=p();return P(o.onMousePressStart(t));})("mouseup",function(){T(e);let t=p();return P(t.onMousePressEnd());})("mouseleave",function(){T(e);let t=p();return P(t.onMousePressEnd());})("touchstart",function(){let t=T(e).$implicit,o=p();return P(o.onTouchStart(t));})("touchend",function(){T(e);let t=p();return P(t.onTouchEnd());})("touchcancel",function(){T(e);let t=p();return P(t.onTouchEnd());})("dragStart",function(){let t=T(e).$implicit,o=p();return P(o.dragStarted(t));})("dragEnd",function(){T(e);let t=p();return P(t.dragEnded());}),r(1,"take-track",17),S("instantDragRequested",function(){let t=T(e).$implicit,o=p();return P(o.onInstantDragRequested(t));}),s(),M(2,C0,2,1,"ng-template",null,0,Re),s();}if(i&2){let e=u.$implicit,n=Be(3),t=p();c("@takeFade",t.takeFadeState(e))("ngClass",fi(10,h0,(e.loadingStatus!=0||e.video&&(e.video==null?null:e.video.status)!=2||e.process
8Failed)&&!e.allowDelete,t.dragReadyTrackId===e.id))("validateDrag",t.validateDragFn)("dropData",ue(17,u0,Fr(13,m0,t.story,e.video==null?null:e.video.mediaId,e.title)))("ghostDragEnabled",!0)("ghostElementTemplate",n)("showOriginalElementWhileDragging",!1)("touchStartLongPress",Nr(19,g0)),a(),c("trackData",e)("slotBadge",t.slotBadgeFor(e));}}var S0="/img/icon-library/other/upload-video.svg",th="skipEnter",ih=(()=>{class i{constructor(e,n){this.storyTrackCommunicationService=e,this.eventsService=n,this.animationsDisabled=!0,this.takeTracks=[],this.filteredTakeTracks=[],this.uploadingTakeTracks={},this.searchTerm="",this.searchPlaceholder="Search",this.uploadTakeIcon=S0,this.uploadTakeLabel="Upload take",this.hasProcessingTakes=!1,this.dragReadyTrackId=null,this.touchActiveTrackId=null,this.longPressTimer=null,this.LONG_PRESS_DURATION=100,this.newActiveTrack=new be(),this.searchEvent$=new Ze(),this.validateDragFn=()=>this.dragReadyTrackId!==null||this.touchActiveTrackId!==null,this.slotsStore=et(ni,{optional:!0}),this.cpProjectAnalytics=et(ii),this.formatTrackDataForDrop=t=>t.video?{type:"storyTake",data:{story:this.story,takeId:t.video.mediaId,headline:t.title}}:null,this.onTakeTracksChange=t=>{t&&(this.takeTracks.forEach(o=>{if(o.video&&o.video?.status!=2){let h=new Date().getTime(),k=new Date(o.video.created).getTime(),f=h-k;o.allowDelete=o.allowDelete||f>1e3*60*60;}}),this.takeTracks=[...t],this.filterTakes(),this.updateProcessingState(),this.ensureActiveTrack());},this.onUploadingTakeTracksChange=t=>{t&&(this.uploadingTakeTracks=t,this.updateProcessingState());},this.logTakeSearch=t=>{let o=t?.trim();o&&this.eventsService.log(this.eventsService.events.script.takeSearch,pe({storyId:this.story?.storyId,query:o,numResults:this.filteredTakeTracks.length,numTakes:this.takeTracks.length},this.cpProjectAnalytics.attrs({story:this.story,slots:this.slotsStore?.slots()})));},this.takeFadeState=t=>t.fromUpload?th:"show",this.trackTrackBy=(t,o)=>o.video?.id??o.localTake?.id??o.composerStoryId??o.id,this.onActivateTakeById=({takeId:t,play:o})=>{let h=this.takeTracks?.find(k=>k.video?.id===t);h&&this.activateTrack(h)&&o&&this.storyTrackCommunicationService.setPlayCurrentTake();},this.activateTrack=(t,o=!1)=>{let h=t.id;return t.loadingStatus!=0||t.video?.status===1||t.processFailed||this.takeTracks.find(k=>k.id===h).loadingStatus!=Et.none?!1:(this.takeTracks.forEach((k,f)=>{k.id===h?(k.active=!0,this.newActiveTrack.emit(k)):k.active=!1;}),o&&this.logTakeScreenOpen(t),!0);},this.logTakeScreenOpen=t=>{this.eventsService.log(this.eventsService.events.script.takeScreenOpen,pe({takeId:t.video?.mediaId||"",storyId:this.story?.storyId,isLocal:t.status===ct.local,featuresApplied:Uo(t)},this.cpProjectAnalytics.attrs({story:this.story,slots:this.slotsStore?.slots()})));},this.eventListeners=[];}slotBadgeFor(e){return this.slotsStore?.badgeFor(e.video?.id)??null;}ngOnInit(){this.eventListeners.push(this.storyTrackCommunicationService.observeUploadingTakeTracks().subscribe(this.onUploadingTakeTracksChange),this.storyTrackCommunicationService.observeTakeTracks().subscribe(this.onTakeTracksChange),this.storyTrackCommunicationService.observeStoryChanged().subscribe(e=>this.story=e),this.storyTrackCommunicationService.observeIsViewer().subscribe(e=>this.isViewer=e),this.storyTrackCommunicationService.observeActivateTakeById().subscribe(this.onActivateTakeById),this.searchEvent$.pipe(Xi(500),Vc()).subscribe(this.logTakeSearch)),Promise.resolve().then(()=>this.animationsDisabled=!1);}ngOnDestroy(){this.eventListeners.forEach(e=>e.unsubscribe());}ensureActiveTrack(){if(this.takeTracks.some(n=>n.active))return;let e=this.takeTracks.find(n=>n.kind!=="composerDraft"&&n.loadingStatus===Et.none&&!n.processFailed&&n.video?.status!==1);e&&this.activateTrack(e);}onUploadTakeClick(){this.storyTrackCommunicationService.setUploadTakeRequested();}onSearchChange(e){this.searchTerm=e,this.filterTakes(),this.searchEvent$.next(e);}filterTakes(){if(!this.searchTerm){this.filteredTakeTracks=this.takeTracks;return;}let e=this.searchTerm.toLowerCase();this.filteredTakeTracks=this.takeTracks.filter(n=>n.title?.toLowerCase().includes(e));}updateProcessingState(){let e=this.uploadingTakeTracks&&Object.keys(this.uploadingTakeTracks).length>0,n=this.takeTracks.some(t=>t.loadingStatus!==Et.none||t.video&&t.video?.status!==2);this.hasProcessingTakes=e||n;}onMousePressStart(e){this.isDraggable(e)&&(this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{this.dragReadyTrackId=e.id;},this.LONG_PRESS_DURATION));}onMousePressEnd(){this.clearLongPressTimer();}onTouchStart(e){this.isDraggable(e)&&(this.touchActiveTrackId=e.id);}onTouchEnd(){this.touchActiveTrackId=null;}onInstantDragRequested(e){this.isDraggable(e)&&(this.clearLongPressTimer(),this.dragReadyTrackId=e.id,this.touchActiveTrackId=e.id);}isDraggable(e){return!e.localTake&&!this.isViewer&&e.loadingStatus===0&&e.video?.status===2&&!e.process
8Failed;}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null);}dragStarted(e){document.body.style.userSelect="none",this.storyTrackCommunicationService.setTakeDragStarted(this.formatTrackDataForDrop(e));}dragEnded(){document.body.style.userSelect="initial",this.dragReadyTrackId=null,this.touchActiveTrackId=null;}static{this.ɵfac=function(n){return new(n||i)(d(He),d(Pe));};}static{this.ɵcmp=G({type:i,selectors:[["take-track-list"]],hostVars:1,hostBindings:function(n,t){n&2&&Wc("@.disabled",t.animationsDisabled);},outputs:{newActiveTrack:"newActiveTrack"},standalone:!0,features:[q],decls:9,vars:10,consts:()=>{let e;return e="The processes may take some time. We'll notify you when it's done.",[["ghostDraggedTemplate",""],e,[1,"take-track-list-component"],["class","processing-note",4,"ngIf"],[1,"search-bar"],[3,"valueChange","label","placeholder","value"],["class","upload-take-button","size","md","variant","secondary",3,"iconContent","clicked",4,"ngIf"],[1,"track-list-container"],["class","track-wrapper",4,"ngFor","ngForOf"],["class","track-wrapper","mwlDraggable","",3,"ngClass","validateDrag","dropData","ghostDragEnabled","ghostElementTemplate","showOriginalElementWhileDragging","touchStartLongPress","click","mousedown","mouseup","mouseleave","touchstart","touchend","touchcancel","dragStart","dragEnd",4,"ngFor","ngForOf","ngForTrackBy"],[1,"processing-note"],[1,"fa","fa-bell","note-icon"],[1,"note-text"],["size","md","variant","secondary",1,"upload-take-button",3,"clicked","iconContent"],[1,"track-wrapper"],[3,"uploadState"],["mwlDraggable","",1,"track-wrapper",3,"click","mousedown","mouseup","mouseleave","touchstart","touchend","touchcancel","dragStart","dragEnd","ngClass","validateDrag","dropData","ghostDragEnabled","ghostElementTemplate","showOriginalElementWhileDragging","touchStartLongPress"],[3,"instantDragRequested","trackData","slotBadge"],[1,"track-wrapper-drag"],[3,"trackData"]];},template:function(n,t){n&1&&(r(0,"div",2),M(1,f0,4,1,"div",3),r(2,"div",4)(3,"lib-search",5),S("valueChange",function(h){return t.onSearchChange(h);}),s(),M(4,v0,1,3,"lib-button-icon",6),s(),r(5,"div",7),M(6,_0,2,1,"div",8),tt(7,"keyvalue"),M(8,b0,4,20,"div",9),s()()),n&2&&(a(),c("ngIf",t.hasProcessingTakes),a(2),c("label",!1)("placeholder",t.searchPlaceholder)("value",t.searchTerm),a(),c("ngIf",!t.isViewer),a(2),c("ngForOf",wt(7,8,t.uploadingTakeTracks)),a(2),c("ngForOf",t.filteredTakeTracks)("ngForTrackBy",t.trackTrackBy));},dependencies:[Le,eh,we,_e,qi,Is,Qc,pl,Vn],styles:["[_nghost-%COMP%]{display:block;height:100%;animation:_ngcontent-%COMP%_take-list-fade-in .22s ease-out both}@keyframes _ngcontent-%COMP%_take-list-fade-in{0%{opacity:0}to{opacity:1}}.take-track-list-component[_ngcontent-%COMP%]{height:calc(100% - 36px);padding:0 16px 0 0;display:flex;flex-direction:column;gap:16px}.processing-note[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;padding:8px;background-color:#ebf2ff;border-radius:5px;overflow:hidden}.processing-note[_ngcontent-%COMP%] .note-icon[_ngcontent-%COMP%]{font-size:16px;color:#2563eb;flex-shrink:0}.processing-note[_ngcontent-%COMP%] .note-text[_ngcontent-%COMP%]{font-size:14px;line-height:1.4;color:#253658;letter-spacing:-.14px}.search-bar[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:8px}.search-bar[_ngcontent-%COMP%] lib-search{flex:1;min-width:0}.search-bar[_ngcontent-%COMP%] .upload-take-button[_ngcontent-%COMP%]{flex-shrink:0}.track-list-container[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;margin-right:-16px;padding-right:10px;padding-bottom:2px}.track-list-container[_ngcontent-%COMP%] .track-wrapper[_ngcontent-%COMP%]{position:relative;margin-bottom:10px;cursor:pointer}.track-list-container[_ngcontent-%COMP%] .track-wrapper[_ngcontent-%COMP%]:last-child{margin-bottom:0}.track-list-container[_ngcontent-%COMP%] .track-wrapper.track-disabled[_ngcontent-%COMP%]{cursor:default!important}.track-list-container[_ngcontent-%COMP%] .track-wrapper.drag-ready[_ngcontent-%COMP%]{cursor:grab!important}.track-list-container[_ngcontent-%COMP%] .track-wrapper.drag-ready[_ngcontent-%COMP%] .take-track-container{border-color:#00abfe}.track-wrapper-drag[_ngcontent-%COMP%]{z-index:9999;background-color:#fff!important;border-radius:10px!important;opacity:.85!important;cursor:grab!important;transform:rotate(-2deg);box-shadow:0 8px 24px #00000026;pointer-events:none}@media only screen and (max-width: 1340px){.track-list-container[_ngcontent-%COMP%] .track-wrapper[_ngcontent-%COMP%]{margin-bottom:12px}.track-list-container[_ngcontent-%COMP%] .track-wrapper[_ngcontent-%COMP%]:last-child{margin-bottom:0}}"],data:{animation:[cr("takeFade",[An((e,n)=>e==="void"&&n!==th,[Ii({opacity:0,height:0,marginBottom:0,overflow:"hidden"}),En("220ms cubic-bezier(0.22, 1, 0.36, 1)",Ii({opacity:1,height:"*",marginBottom:"*"}))]),An(":leave",[Ii({overflow:"hidden",pointerEvents:"none"}),En("200ms cubic-bezier(0.4, 0, 0.6, 1)",Ii({opacity:0,height:0,marginBottom:0}))])]),cr("noteFade",[An(":enter",[Ii({opacity:0,height:0,marginBottom:"-16px",overflow:"hidden"}),En("220ms cubic-bezier(0.22, 1, 0.36, 1)",Ii({opacity:1,height:"*",marginBottom:0}))]),An(":leave",[Ii({overflow:"hidden"}),En("200ms cubic-bezier(0.4, 0, 0.6, 1)",Ii({opacity:0,height:0,marginBottom:"-16px"}))])])]}});}}return i;})();var xr=function(i){return i[i.COLLECTION=0]="COLLECTION",i[i.STORY=1]="STORY",i;}(xr||{});J();so();J();var ta=(()=>{class i{constructor(){this.fromSlides=(e,n,t)=>{let o={},h=[];return this._cloneSlides(e).forEach(f=>{let m;m=f,m.media.type="video",m.media=[m.media],m.type="image",m.metadata.audio={type:1},m.metadata.templateIds=n,h.push(m);}),o.media=h,o.type="bigvu#slider",o.aspectRatio=t,o;},this._cloneSlides=e=>e?JSON.parse(JSON.stringify(e)):[];}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵprov=Jt({token:i,factory:i.ɵfac,providedIn:"root"});}}return i;})();var oh=Mr(jm()),rh=Mr(Bm());J();var ia=function(i){return i.END="ended",i.SLIDE_CHANGE="slide",i.CARD_CHANGE="cardChange",i;}(ia||{}),Qo=(()=>{class i{constructor(e){this.zone=e,this.START_TIME=.1,this.containerSize={width:680,height:380},this.init=n=>{this.setVDMPreviewer(n),this.setOnVideoEndEventListener();},this.setOnSlideChangeEventListener=n=>{this.previewer&&this.previewer.on(ia.SLIDE_CHANGE,n);},this.setOnSlideCardChangeEventListener=n=>{this.previewer&&this.previewer.on(ia.CARD_CHANGE,n);},this.setOnVideoEndEventListener=n=>{this.previewer&&this.previewer.on(ia.END,()=>{this.pause(this.START_TIME),n&&n();});},this.setVDMPreviewer=n=>{this.previewer=new oh.VDMPluginPreviewer(n);},this.rebuild=(n,t,o,h=2)=>new Promise((k,f)=>{this.setPauseAt(h);let m=rh.default.createVDMStoryAdapter;this.VDMStoryAdapter=new m(n||{},t,{lowRes:!0,aspectRatio:o});let v={},V=this.VDMStoryAdapter.adaptStory();this.previewer.setStory(V,pe({container:this.getContainerSize(),debug:!1},v)),this.setIsBuilding(!0),this.build().then(()=>{this.setIsBuilding(!1),this.pause(this._pauseAt),k();}).catch(te=>f(te));}),this.getContainerSize=()=>this.containerSize,this.setContainerSize=n=>{this.containerSize=n;},this.play=n=>new Promise((t,o)=>{this.previewer?this.zone.runOutsideAngular(()=>I(this,null,function*(){try{yield this.previewer.play(n),t();}catch(h){o(h);}})):o();}),this.pause=n=>new Promise((t,o)=>{this.previewer?this.zone.runOutsideAngular(()=>I(this,null,function*(){try{yield this.previewer.pause(n),t();}catch(h){o(h);}})):o();}),this.build=()=>new Promise((n,t)=>{this.previewer?this.zone.runOutsideAngular(()=>I(this,null,function*(){try{let o=yield this.previewer.build();n(o);}catch(o){t(o);}})):t();}),this.moveToCard=n=>{this.previewer&&this.zone.runOutsideAngular(()=>I(this,null,function*(){this.previewer.moveToCard(n);}));}
8,this.moveToNextCard=()=>{this.previewer&&this.zone.runOutsideAngular(()=>I(this,null,function*(){this.previewer.nextCard();}));},this.moveToPreviousCard=()=>{this.previewer&&this.zone.runOutsideAngular(()=>I(this,null,function*(){this.previewer.prevCard();}));},this.isPreviewerReady=()=>this.previewer!==void 0&&this.previewer!==null,this.getIsBuilding=()=>this._isBuilding,this.setIsBuilding=n=>{this._isBuilding=n;},this.setPauseAt=n=>{this._pauseAt=n;},this.clearPreviewerFromDOM=n=>{let t=document.getElementById(n);t&&(t.innerHTML="");},this.clearPreviewer=n=>{let t=()=>{this.previewer&&(this.previewer.clear(),this.previewer.clearCallbacks(),this.previewer=void 0),this.VDMAdapter=void 0;};this.pause().finally(()=>{t(),this.clearPreviewerFromDOM(n);});},this._pauseAt=0,this._isBuilding=!1;}static{this.ɵfac=function(n){return new(n||i)(an(yo));};}static{this.ɵprov=Jt({token:i,factory:i.ɵfac});}}return i;})();var ah=(()=>{class i{constructor(e,n,t,o,h,k,f,m=xr.STORY){this.spinnerService=e,this.videoSlidesService=n,this.previewerSlidesAdapterService=t,this.styleVideoService=o,this.renderer=h,this.slideListDataService=k,this.vdmPluginService=f,this.PAUSE_OFFSET=100,this.setEventListeners=()=>{this.eventListeners=[this.videoSlidesService.slidesArraySubject$.subscribe(this.updatePreviewer),this.videoSlidesService.playSelectedSlide.subscribe(this.playSelectedSlide),this.videoSlidesService.playAllSlides$.subscribe(this.playAllSlides),this.slideListDataService.selectedSlide$.subscribe(this.moveToSlide),this.styleVideoService.aspectRatioStyle$.subscribe(this.setAspectRatio)];},this.initializeVDMPreviewer=()=>{this.vdmPluginService.init(this.id),this.vdmPluginService.setOnSlideChangeEventListener(()=>{this.pauseTimeout&&(clearTimeout(this.pauseTimeout),this.pauseTimeout=null),this.isPlayingSelectedSlide&&(this.pauseTimeout=setTimeout(()=>{this.pause(),this.isPlayingSelectedSlide=!1,this.videoSlidesService.VideoEditElm_isSlidePlayed$.next(!1);},this.slidePlayDurationInMs));});},this.playSelectedSlide=v=>{this.selectedSlide=v;let V=v.metadata.time;this.slidePlayDurationInMs=this.getSlidePlayDuration(v),this.isPlayingSelectedSlide?this.pause():this.pause(V).then(()=>{this.play(V);}),this.isPlayingSelectedSlide=!this.isPlayingSelectedSlide;},this.playAllSlides=v=>I(this,null,function*(){this.isPlayingSelectedSlide=!1,this.videoSlidesService.VideoEditElm_isSlidePlayed$.next(!1),this.isPlaying=v,yield this.pause(),v&&this.play(0);}
8),this.getSlidePlayDuration=v=>v.metadata.duration*1e3-this.PAUSE_OFFSET,this.moveToSlide=v=>I(this,null,function*(){if(v!==null){this.selectedSlide=v.slide,this.isPlayingSelectedSlide=!1;try{this.spinnerService.spin("video-slides-previewer",!0);let V=this.selectedSlide.metadata.time;this.vdmPluginService.getIsBuilding()?this.vdmPluginService.setPauseAt(V):yield this.vdmPluginService.pause(V);}catch(V){console.error("VDMPlugin: ",V);}finally{this.spinnerService.stop("video-slides-previewer");}}}),this.updatePreviewer=v=>{if(!this.vdmPluginService.isPreviewerReady()||!this.templates||!this.templates.length)return;v&&(this.slides=v);let V=this.story?this.story.aspectRatio:void 0;this.story=this.previewerSlidesAdapterService.fromSlides(this.slides,this.templateIds,V),this.vdmPluginService.rebuild(this.story,this.templates,V,this.previewerType);},this.setAspectRatio=v=>{if(this.story?this.story.aspectRatio=v:this.story={aspectRatio:v},this.slides){let V=document.getElementsByClassName("vdm-slides")[0];this.renderer.setStyle(V,"margin","auto"),this.updatePreviewer(null);}},this.onPlayButtonClick=()=>{let v=this.selectedSlide?this.selectedSlide.metadata.time:0;this.isPlaying?this.vdmPluginService.pause(v):this.vdmPluginService.play(v),this.isPlaying=!this.isPlaying;},this.play=v=>(this.isPlaying=!0,this.vdmPluginService.play(v)),this.pause=v=>(this.isPlaying=!1,this.vdmPluginService.pause(v)),this.setContainerSize=v=>{let V=window.innerWidth,te=window.innerHeight;this.scaledContainerSize={width:V*.35,height:te*.75},this.vdmPluginService.setContainerSize(this.scaledContainerSize);},this.isPlayingSelectedSlide=!1,this.templates=[],this.isPlaying=!1,this.eventListeners=[],this.previewerType=m;}ngOnInit(){this.setEventListeners();}ngAfterViewInit(){this.initializeVDMPreviewer();}ngOnDestroy(){this.pause().finally(()=>{this.vdmPluginService.clearPreviewer(this.id),this.slideListDataService.clearSelectedSlide(),this.eventListeners.forEach(e=>e.unsubscribe());});}static{this.ɵfac=function(n){return new(n||i)(d(ki),d($t),d(ta),d(Qi),d(xo),d(Zt),d(Qo),d(xr));};}static{this.ɵdir=Li({type:i,inputs:{id:"id"}});}}return i;})();Cn();Ni();ae();J();so();Ni();function y0(i,u){i&1&&(r(0,"div",4),b(1,"button",5),s());}var ch=(()=>{class i extends ah{constructor(e,n,t,o,h,k,f,m){super(e,n,t,o,h,k,f),this.spinnerService=e,this.videoSlidesService=n,this.previewerSlidesAdapterService=t,this.styleVideoService=o,this.renderer=h,this.slideListDataService=k,this.vdmPluginService=f,this.elementRef=m,this._basePreviewerContainerSize={width:343,height:192},this.REBUILD_ON_RESIZE_DEBOUNCE_IN_MS=300,this.layoutElement=null,this.startPlayIndex=1,this.startPlayTime=0,this.startPlayIndexInitiated=!1,this.setContainerSizeFromLayout=()=>{let v=this.elementRef.nativeElement.parentElement;for(;v&&!v.clientWidth;)v=v.parentElement;this.layoutElement=v;let V=v?.clientWidth;V&&this.setContainerSize({width:V,height:Math.round(V*9/16)});},this.observeLayoutResize=()=>{this.layoutElement&&(this.layoutResizeObserver=new ResizeObserver(()=>this.onLayoutResize()),this.layoutResizeObserver.observe(this.layoutElement));},this.onLayoutResize=()=>{let v=this.layoutElement?.clientWidth;!v||v===this.scaledContainerSize?.width||(this.scalePreviewerElement(v/this.scaledContainerSize.width),clearTimeout(this.rebuildOnResizeTimeout),this.rebuildOnResizeTimeout=setTimeout(this.rebuildAtLayoutSize,this.REBUILD_ON_RESIZE_DEBOUNCE_IN_MS));},this.rebuildAtLayoutSize=()=>{this.isPlaying&&this.pause(),this.setContainerSizeFromLayout(),this.scalePreviewerElement(null),this.slides&&this.updatePreviewer();},this.scalePreviewerElement=v=>{let V=document.getElementById(this.id);V&&(v?this.renderer.setStyle(V,"scale",`${v}`):this.renderer.removeStyle(V,"scale"));},this.setEventListenersNew=()=>{this.eventListeners=[this.videoSlidesService.slidesArraySubject$.subscribe(this.updatePreviewer),this.videoSlidesService.playSelectedSlide.subscribe(v=>{this.isPlaying&&this.pause(),this.startPlayIndexInitiated=!1,this.playSelectedSlide(v);}),this.videoSlidesService.playAllSlides$.subscribe(v=>{this.isPlaying&&this.pause(),this.startPlayIndexInitiated=!1,this.playAllSlides(v);}),this.slideListDataService.selectedSlide$.subscribe(v=>{this.isPlaying&&this.pause(),this.startPlayIndexInitiated=!1,this.moveToSlide(v);}),this.styleVideoService.aspectRatioStyle$.subscribe(this.setAspectRatio)];},this.setStartPlayerIndex=(v,V)=>{this.startPlayIndexInitiated||(this.startPlayTime=V,this.startPlayIndex=v,this.startPlayIndexInitiated=!0);},this.setContainerSize=v=>{this.scaledContainerSize={width:v.width,height:v.height},this.vdmPluginService.setContainerSize(this.scaledContainerSize);},this.setTemplateChangeEventListener=()=>{this.eventListeners.push(this.slideListDataService.templateList$.subscribe(v=>this.setTemplates(v)));},this.setTemplates=v=>{v&&v.length>0&&(this.templates=v,this.templateIds=this.slideListDataService.getTemplateIds(),setTimeout(()=>{this.updatePreviewer();}));};}ngOnInit(){this.setEventListenersNew(),this.setContainerSize(this._basePreviewerContainerSize),this.setTemplateChangeEventListener();}ngAfterViewInit(){this.setContainerSizeFromLayout(),this.initializeVDMPreviewerNew(),this.observeLayoutResize();}
8initializeVDMPreviewerNew(){this.vdmPluginService.init(this.id),this.vdmPluginService.setOnSlideChangeEventListener((e,n)=>{if(this.pauseTimeout&&(clearTimeout(this.pauseTimeout),this.pauseTimeout=null),this.isPlayingSelectedSlide)this.pauseTimeout=setTimeout(()=>{this.pause(),this.isPlayingSelectedSlide=!1,this.videoSlidesService.VideoEditElm_isSlidePlayed$.next(!1);},this.slidePlayDurationInMs);else{let t=n+1;this.setStartPlayerIndex(t,e),this.videoSlidesService.slideStatus$.next({status:"play",slideIndex:t});}}),this.vdmPluginService.setOnVideoEndEventListener(()=>{this.pause(this.startPlayTime).then(e=>{this.videoSlidesService.slideStatus$.next({status:"pause",slideIndex:this.startPlayIndex}),this.startPlayIndexInitiated=!1;});});}ngOnDestroy(){this.layoutResizeObserver?.disconnect(),clearTimeout(this.rebuildOnResizeTimeout),super.ngOnDestroy();}static{this.ɵfac=function(n){return new(n||i)(d(ki),d($t),d(ta),d(Qi),d(xo),d(Zt),d(Qo),d(On));};}static{this.ɵcmp=G({type:i,selectors:[["slide-story-previewer"]],standalone:!0,features:[Ae,q],decls:5,vars:2,consts:[[1,"video-slides-previewer-component",3,"click"],[3,"id"],["class","play-button-container",4,"ngIf"],["name","video-slides-previewer"],[1,"play-button-container"],["aria-label","Play"]],template:function(n,t){n&1&&(r(0,"div",0),S("click",function(){return t.onPlayButtonClick();}),r(1,"div",1),M(2,y0,2,0,"div",2),s(),r(3,"ngx-spinner",3),b(4,"lottie-loader"),s()()),n&2&&(a(),c("id",t.id),a(),c("ngIf",!t.isPlaying));},dependencies:[_e,Si,dn,Ri],styles:[".video-slides-previewer-component[_ngcontent-%COMP%]{position:relative;width:fit-content;height:100%;cursor:pointer;display:flex;align-items:flex-end}.play-button-container[_ngcontent-%COMP%]{position:absolute;width:56px;height:56px;top:16px;right:16px;z-index:16}button[_ngcontent-%COMP%]{display:block;background-image:url(/img/script-story-v2/play.svg);background-repeat:no-repeat;background-size:cover;background-position:center;width:100%;height:100%}.previewer-placeholder[_ngcontent-%COMP%]{width:680px;height:380px;background-color:#7b8db1;pointer-events:none;cursor:text}",".video-slides-previewer-component[_ngcontent-%COMP%]{position:relative;width:100%!important;height:100%;cursor:pointer;display:flex;align-items:center;background-color:#000}div#script-sequence-previewer[_ngcontent-%COMP%]{margin:0 auto}"]});}}return i;})();J();Oa();ae();Cn();ji();il();J();ht();vl();Zr();J();ln();J();var na=(()=>{class i{constructor(){this.router=et(bi);}openComposerRow(e){return this.router.navigate(this.routeFor(e));}routeFor(e){return e.composerStoryType===ed.SLIDER_V2?["composer","v2",e.composerStoryId]:["composer",e.composerStoryId];}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵprov=Jt({token:i,factory:i.ɵfac,providedIn:"root"});}}return i;})();ae();var w0=["playerContainer"];function T0(i,u){if(i&1&&(b(0,"img",10),tt(1,"urlSecurityPipe")),i&2){let e=p(2);c("src",wt(1,1,e.draftTrack.composerThumbnailUrl),Ie);}}function P0(i,u){if(i&1){let e=U();r(0,"div",6),M(1,T0,2,3,"img",7),b(2,"div",8),r(3,"lib-button",9),S("clicked",function(){T(e);let t=p();return P(t.openDraftInVideoMaker());}),y(4),s()();}if(i&2){let e=p();c("@draftFade",void 0),a(),c("ngIf",e.draftTrack.composerThumbnailUrl),a(2),c("disabled",e.draftTrack.composerDeleted)("loading",e.openingDraft),a(),de(e.draftButtonLabel);}}function O0(i,u){if(i&1&&(r(0,"div",13),b(1,"img",14),s()),i&2){let e=p(2);a(),c("src",e.playBtnImg,Ie);}}function I0(i,u){if(i&1){let e=U();r(0,"div",11),S("click",function(){T(e);let t=p();return P(t.playerBtn());}),M(1,O0,2,1,"div",12),s();}if(i&2){let e=p();a(),c("ngIf",!e.isVideoPlayed&&!e.showLoading);}}function M0(i,u){if(i&1&&(r(0,"div",15),b(1,"lottie-loader",16),s()),i&2){let e=p();a(),c("path",e.LOTTIE_SOURCE_PATH);}}var dh=(()=>{class i{constructor(e,n,t,o,h,k){this.eventsService=e,this.storyTrackCommunicationService=n,this.filesUtilityService=t,this.localTakeHelperService=o,this.videoPlayerService=h,this.composerOpenService=k,this.takePlaying=new be(),this.PREVIEW_ID=Ss,this.playBtnImg=bd,this.EVENT_SCRIPT=this.eventsService.events.videoPreview,this.LOTTIE_SOURCE_PATH="/assets/video-loading.json",this.draftTrack=null,this.openingDraft=!1,this.isSwitching=!1,this.playerInitialized=!1,this.isVideoPlayed=!1,this.showLoading=!1,this.autoplayPending=!1,this.playVideo=f=>I(this,null,function*(){if(f?.kind==="composerDraft"){this.draftTrack=f,this.playerInitialized&&this.videoPlayerService.pause(this.PREVIEW_ID),this.autoplayPending=!1,this.isVideoPlayed=!1;return;}this.draftTrack=null,this.openingDraft=!1,f&&(this.takePlaying.emit(),this.isSwitching=!0,yield this.initializePlayer(f,!0),this.startTime=0,this.isVideoPlayed=!1);}),this.openDraftInVideoMaker=()=>I(this,null,function*(){if(!this.openingDraft){this.openingDraft=!0;try{(yield this.composerOpenService.openComposerRow(this.draftTrack))||(this.openingDraft=!1);}catch(f){console.error(f),this.openingDraft=!1;}}}),this.changePlayerTimes=f=>I(this,null,function*(){f.video&&(this.takePlaying.emit(),yield this.initializePlayer(f.video,!1),this.videoPlayerService.setCurrentTime(this.PREVIEW_ID,f.start),this.startTime=f.start||0,this.endTime=f.end||this.videoPlayerService.duration(this.PREVIEW_ID),this.videoPlayerService.play(this.PREVIEW_ID));}),this.initializePlayer=(f,m)=>I(this,null,function*(){let v=f.status===ct.local?yield this.getLocalTakeSource(f.localTake):this.getVideoSources(f.video),V=f.status===ct.local?f.localTake:f.video;this.playerInitialized?(this.videoPlayerService.setOneListener(this.PREVIEW_ID,"loadedmetadata",()=>{this.isSwitching=!1,m&&(this.endTime=this.videoPlayerService.duration(this.PREVIEW_ID)),this.removeTracksAndAddNewTracks(V,!0),this.flushAutoplay();}),this.updatePlayerSrc(v)):(yield this.videoPlayerService.init(this.PREVIEW_ID,!0,!0),this.playerInitialized=!0,this.updatePlayerSrc(v),this.videoPlayerService.setOneListener(this.PREVIEW_ID,"loadedmetadata",te=>{this.isSwitching=!1,m&&(this.endTime=this.videoPlayerService.duration(this.PREVIEW_ID)),this.removeTracksAndAddNewTracks(V,!0),this.flushAutoplay();}),this.videoPlayerService.setEventListener(this.PREVIEW_ID,"play",()=>{this.isVideoPlayed=!0,this.sendEvent(f,this.EVENT_SCRIPT.play,this.cpProjectAnalytics.attrs({story:this.story,slots:this.cpSlotsStore?.slots()}));}),this.videoPlayerService.setEventListener(this.PREVIEW_ID,"pause",()=>{this.isVideoPlayed=!1,this.sendEvent(f,this.EVENT_SCRIPT.pause);}),this.videoPlayerService.setEventListener(this.PREVIEW_ID,"timeupdate",()=>{this.videoPlayerService.getCurrentTime(this.PREVIEW_ID)>=this.endTime&&(this.videoPlayerService.pause(this.PREVIEW_ID),this.isVideoPlayed=!1,this.videoPlayerService.setCurrentTime(this.PREVIEW_ID,this.startTime));}));}),this.updatePlayerSrc=f=>{f.length>0?(this.showLoading=!1,this.videoPlayerService.src(this.PREVIEW_ID,f)):(this.showLoading=!0,this.isSwitching=!1,this.autoplayPending=!1,this.videoPlayerService.src(this.PREVIEW_ID,""),this.videoPlayerService.pause(this.PREVIEW_ID));},this.getLocalTakeSource=f=>I(this,null,function*(){let m=yield this.localTakeHelperService.getVideo(f.id),v=yield this.filesUtilityService.getVideoFileAttributes(m.file);return[{src:v.url,type:"video/mp4",label:v.height,res:v.height}];}),this.getVideoSources=f=>{let m=[];
8return f.streams.forEach(v=>{v&&m.push({src:v.url,type:v.mime,label:v.height,res:v.height});}),f.hlsPlaylistUrl&&f.hlsPlaylistUrl&&f.hlsPlaylistUrl!==fn.globals.hlsPlaceholderUrl&&m.push({src:f.hlsPlaylistUrl,type:"application/x-mpegURL",label:"auto"}),m;},this.removeTracksAndAddNewTracks=(f,m)=>{let v,V;for(;(V=this.videoPlayerService.remoteTextTracks(this.PREVIEW_ID)).length>0;)m&&V[0].mode==="showing"&&(v=V[0].language),this.videoPlayerService.removeRemoteTextTrack(this.PREVIEW_ID,V[0]);let te=this.story?.captions;te&&this.getCaptionTracks(f,te).forEach(H=>{if(this.videoPlayerService.addRemoteTextTrack(this.PREVIEW_ID,H,!0),m===!0&&v){let j=this.videoPlayerService.textTracks(this.PREVIEW_ID);j[j.length-1].language===v&&(j[j.length-1].mode="showing");}});},this.getLabel=f=>{switch(f){case"es":return"Spanish";case"en":return"English";case"fr":return"French";}},this.getCaptionTracks=(f,m)=>{let v=[];return m&&m.forEach(V=>{V.status!=1&&V.groupId===f.groupId&&V.url.slice(-3)==="vtt"&&v.push({src:V.url.replace(/https:\/\/assets(-dev)?\.bigvu\.tv/,"./captions"),kind:"subtitles",label:this.getLabel(V.lang),id:this.getLabel(V.lang),language:V.lang});}),v;},this.playerBtn=()=>{this.playerInitialized&&(this.isVideoPlayed?this.videoPlayerService.pause(this.PREVIEW_ID):this.videoPlayerService.play(this.PREVIEW_ID));},this.onPlayCurrentTake=()=>{if(!this.draftTrack){if(this.playerInitialized&&!this.isSwitching){this.playFromStart();return;}this.autoplayPending=!0;}},this.flushAutoplay=()=>{this.autoplayPending&&(this.autoplayPending=!1,this.playFromStart());},this.playFromStart=()=>{this.videoPlayerService.setCurrentTime(this.PREVIEW_ID,this.startTime??0),this.videoPlayerService.play(this.PREVIEW_ID);},this.onStopVideoObserve=()=>{this.autoplayPending=!1,this.videoPlayerService.pause(this.PREVIEW_ID);},this.cpSlotsStore=et(ni,{optional:!0}),this.cpProjectAnalytics=et(ii),this.sendEvent=(f,m,v={})=>{let V=f.status==ct.local?f.localTake:f.video,te=pe({headline:this.story.headline,storyId:this.story.storyId,created:V.created},v);f.status!==ct.local&&f.video?.streams[0]?.url&&(te.url=V.streams[0].url,te.mediaId=V.mediaId),this.eventsService.log(m,te);},this.eventListeners=[];}ngOnInit(){this.eventListeners.push(this.storyTrackCommunicationService.observeStoryChanged().subscribe(e=>this.story=e),this.storyTrackCommunicationService.observePlayerTrack().subscribe(this.playVideo),this.storyTrackCommunicationService.observeVideoStartEndTime().subscribe(this.changePlayerTimes),this.storyTrackCommunicationService.observePlayCurrentTake().subscribe(this.onPlayCurrentTake),this.storyTrackCommunicationService.observeStopVideo().subscribe(this.onStopVideoObserve));}ngOnDestroy(){this.videoPlayerService.dispose(this.PREVIEW_ID),this.eventListeners.forEach(e=>e.unsubscribe());}get draftButtonLabel(){return Ho(this.draftTrack?.composerStoryType)?fd:gd;}static{this.ɵfac=function(n){return new(n||i)(d(Pe),d(He),d(Xr),d(Rn),d(Ao),d(na));};}static{this.ɵcmp=G({type:i,selectors:[["story-take-player"]],viewQuery:function(n,t){if(n&1&&Ye(w0,5),n&2){let o;Ne(o=Fe())&&(t.videoElement=o.first);}},outputs:{takePlaying:"takePlaying"},standalone:!0,features:[q],decls:6,vars:6,consts:[["playerContainer",""],[1,"story-take-player"],["class","draft-overlay",4,"ngIf"],["class","play-button-container",3,"click",4,"ngIf"],["class","loading-space",4,"ngIf"],["controls","",1,"video-script-takes","video-js",3,"id"],[1,"draft-overlay"],["class","draft-overlay__thumbnail","alt","",3,"src",4,"ngIf"],[1,"draft-overlay__backdrop"],["size","md","variant","gradient","leftIconContent","/img/icon-library/subtitles/captions.svg",1,"draft-overlay__button",3,"clicked","disabled","loading"],["alt","",1,"draft-overlay__thumbnail",3,"src"],[1,"play-button-container",3,"click"],["class","play-button-image-icon",4,"ngIf"],[1,"play-button-image-icon"],["alt","image",3,"src"],[1,"loading-space"],[3,"path"]],template:function(n,t){n&1&&(r(0,"div",1),M(1,P0,5,5,"div",2)(2,I0,2,1,"div",3)(3,M0,2,1,"div",4),b(4,"video",5,0),s()),n&2&&(cn("story-take-player--switching",t.isSwitching),a(),c("ngIf",t.draftTrack),a(),c("ngIf",!t.draftTrack),a(),c("ngIf",t.showLoading),a(),c("id",t.PREVIEW_ID));},dependencies:[xe,_e,Ri,Fi,Zs],styles:["[_nghost-%COMP%]{display:block;width:100%}.story-take-player[_ngcontent-%COMP%]{position:relative;width:100%;aspect-ratio:16/9;border-radius:10px;background-color:#000}.story-take-player[_ngcontent-%COMP%] .draft-overlay[_ngcontent-%COMP%]{position:absolute;inset:0;z-index:2;display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:10px;background-color:#000}.story-take-player[_ngcontent-%COMP%] .draft-overlay__thumbnail[_ngcontent-%COMP%]{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;filter:blur(14px);transform:scale(1.1)}.story-take-player[_ngcontent-%COMP%] .draft-overlay__backdrop[_ngcontent-%COMP%]{position:absolute;inset:0;background-color:#00000059}.story-take-player[_ngcontent-%COMP%] .draft-overlay__button[_ngcontent-%COMP%]{position:relative} .story-take-player .video-js{transition:opacity .25s ease} .story-take-player--switching .video-js{opacity:0}
8.story-take-player[_ngcontent-%COMP%] .play-button-container[_ngcontent-%COMP%]{position:absolute;z-index:1;top:16px;right:16px;cursor:pointer}.story-take-player[_ngcontent-%COMP%] .loading-space[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;aspect-ratio:16/9;z-index:1;background-color:#000} .story-take-player .loading-space lottie-loader ng-lottie div{width:100%!important;height:100%!important} .story-take-player .vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:12px!important}.story-take-player[_ngcontent-%COMP%] .play-button-image-icon[_ngcontent-%COMP%]{width:56px;height:56px;border-radius:50%;cursor:pointer}.story-take-player[_ngcontent-%COMP%] .play-button-image-icon[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;object-position:center} .video-js .vjs-big-play-button{display:none!important} .story-take-player .video-js .vjs-subs-caps-button, .story-take-player .video-js .vjs-subtitles-button, .story-take-player .video-js .vjs-captions-button{display:none!important}.vjs-tech[_ngcontent-%COMP%]:focus{outline:none!important} .video-js .vjs-tech{object-fit:contain} .vjs-resolution-button .vjs-resolution-button-label{font-size:x-small!important;line-height:3!important} .vjs-menu-button-popup .vjs-menu .vjs-menu-content{bottom:-.5em!important;z-index:2} .vjs-resolution-button>.vjs-menu-button:focus{outline:none} .vjs-poster{background-color:transparent;border-radius:10px} .vjs-control-bar{border-bottom-left-radius:10px;border-bottom-right-radius:10px}.video-script-takes[_ngcontent-%COMP%]{width:100%;height:100%;outline:none;object-fit:contain;border-radius:10px}.story-take-player[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{width:100%;border-radius:10px}"],data:{animation:[cr("draftFade",[An(":enter",[Ii({opacity:0}),En("250ms ease-out",Ii({opacity:1}))]),An(":leave",[En("250ms ease-in",Ii({opacity:0}))])])]}});}}return i;})();ae();J();var ph=(()=>{class i{constructor(e,n,t){this.videoSlidesService=e,this.slideListDataService=n,this.storyTrackCommunicationService=t,this.shouldShowShimmer=!1,this.eventListeners=[],this.playBtnImg=Cd,this.onVdmPlaying=()=>{this.vdmPlaying=!0;},this.forwardPlaySlide=o=>{!this.vdmPlaying&&o&&this.onVdmPlaying();},this.forwardPlayAll=o=>{o&&!this.vdmPlaying&&this.onVdmPlaying();},this.onTakePlaying=o=>{this.vdmPlaying&&(this.vdmPlaying=!1);},this.showShimmer=o=>{this.shouldShowShimmer=o.length<=0;},this.vdmPlaying=!1;}ngOnInit(){this.eventListeners.push(this.videoSlidesService.playSelectedSlide.subscribe(this.forwardPlaySlide),this.videoSlidesService.playAllSlides$.subscribe(this.forwardPlayAll),this.slideListDataService.selectedSlide$.subscribe(this.forwardPlaySlide),this.storyTrackCommunicationService.observePlayerTrack().subscribe(this.onTakePlaying),this.storyTrackCommunicationService.observeTakeTracks().subscribe(this.showShimmer));}ngOnDestroy(){this.eventListeners.forEach(e=>e.unsubscribe()),this.eventListeners=[];}static{this.ɵfac=function(n){return new(n||i)(d($t),d(Zt),d(He));};}static{this.ɵcmp=G({type:i,selectors:[["script-story-player"]],standalone:!0,features:[q],decls:8,vars:6,consts:[[1,"story-take-player-shimmer",3,"hidden"],[1,"play-button-image-icon-shimmer"],["alt","image",3,"src"],[3,"hidden"],[1,"story-sequence-player",3,"hidden"],[1,"story-sequence-preview-wrapper"],[3,"id"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),b(2,"img",2),s()(),r(3,"div",3),b(4,"story-take-player",3),r(5,"div",4)(6,"div",5),b(7,"slide-story-previewer",6),s()()()),n&2&&(c("hidden",!t.shouldShowShimmer),a(2),c("src",t.playBtnImg,Ie),a(),c("hidden",t.shouldShowShimmer),a(),c("hidden",t.vdmPlaying),a(),c("hidden",!t.vdmPlaying),a(2),c("id","script-sequence-previewer"));},dependencies:[dh,ch,xe],styles:["[_nghost-%COMP%]{display:block;width:100%}.story-sequence-player[_ngcontent-%COMP%]{width:100%;aspect-ratio:16/9;background-color:#7b8db12e;border-radius:10px}.story-sequence-preview-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:10px;overflow:hidden}.story-take-player-shimmer[_ngcontent-%COMP%]{position:relative;width:100%;aspect-ratio:16 / 9;background:#4481fd14;border-radius:10px;display:flex;align-items:center;justify-content:center}.story-take-player-shimmer[_ngcontent-%COMP%] .play-button-image-icon-shimmer[_ngcontent-%COMP%]{width:56px;height:56px;border-radius:50%;cursor:pointer}.story-take-player-shimmer[_ngcontent-%COMP%] .play-button-image-icon-shimmer[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;object-position:center}"]});}}return i;})();ae();Ui();Ei();Bi();J();var oa=class extends Tt{},hh=(()=>{class i extends Pt{constructor(e){super(e),this.data=e,this.sound=()=>{this.data.featureUsed?this.close():(this.close(),this.submit());},this.mainTxt=e.featureUsed?"Boost audio already applied for this take":"Maximize audio levels and remove background noise.",this.btnText=e.featureUsed?" Close":" Boost Audio";}static{this.ɵfac=function(n){return new(n||i)(d(yt));};}static{this.ɵcmp=G({type:i,selectors:[["app-boost-audio-dialog"]],standalone:!0,features:[Ae,q],decls:14,vars:2,consts:[[1,"boost-dialog-wrapper"],[1,"boost-close-button",3,"click"],["aria-label","Close"],["src","/img/sidebar-close-icon.svg","alt","image"],[1,"header-img"],["src","/img/script-story-v2/boost.svg","alt","audio boost"],[3,"click"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),S("click",function(){return t.data.onClose();}),r(2,"button",2),b(3,"img",3),s()(),r(4,"header")(5,"div",4),b(6,"img",5),s(),r(7,"div"),y(8,"Boost Audio"),s()(),r(9,"main"),y(10),s(),r(11,"footer")(12,"button",6),S("click",function(){return t.sound();}),y(13),s()()()),n&2&&(a(10),se(" ",t.mainTxt," "),a(3),se(" ",t.btnText," "));},dependencies:[xe],styles:[".boost-dialog-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;padding:32px;display:flex;justify-content:flex-start;flex-direction:column;align-items:center;gap:26px;overflow:hidden;position:relative;color:#253658}.boost-close-button[_ngcontent-%COMP%]{position:absolute;top:12px;right:12px}header[_ngcontent-%COMP%]{width:260px;height:100%;display:flex;align-items:center;justify-content:center;font-size:22px;font-weight:700;line-height:28px;gap:20px}.header-img[_ngcontent-%COMP%]{width:48px;height:48px}.header-img[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;object-position:center}main[_ngcontent-%COMP%]{width:260px;height:100%;font-size:16px;line-height:20px}footer[_ngcontent-%COMP%]{width:100%;height:100%}footer[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:280px;height:44px;padding:10px;justify-content:center;align-items:center;gap:10px;display:flex;border-radius:10px;background-color:#4481fd;font-size:16px;font-family:Inter-Bold;color:#fff;font-weight:700;margin:0 auto}"]});}}return i;})();ae();Ei();Bi();Ui();J();ht();ae();function E0(i,u){if(i&1&&(r(0,"section",8)(1,"div",9),b(2,"img",10),s(),r(3,"div"),y(4),s()()),i&2){let e=p();a(4),de(e.headerText);}}function A0(i,u){if(i&1&&(r(0,"section",8)(1,"div",9),b(2,"img",10),s(),r(3,"div"),y(4),s()()),i&2){let e=p();a(4),de(e.headerText);}}function D0(i,u){if(i&1&&(r(0,"section",8)(1,"div",9),b(2,"img",10),s(),r(3,"div"),y(4),s()()),i&2){let e=p();a(4),de(e.headerText);}}function L0(i,u){if(i&1&&(r(0,"section",11)(1,"div"),y(2),s()()),i&2){let e=p();a(2),de(e.headerText);}}function V0(i,u){if(i&1&&(r(0,"section",8)(1,"div"),y(2),s()()),i&2){let e=p();a(2),se(" ",e.bodyText," ");}}function R0(i,u){if(i&1&&(r(0,"section",8)(1,"div"),y(2),s()()),i&2){let e=p();a(2),se(" ",e.bodyText," ");}}function N0(i,u){if(i&1&&(r(0,"section",8)(1,"div"),y(2),s()()),i&2){let e=p();a(2),se(" ",e.bodyText," ");}}function F0(i,u){if(i&1&&(r(0,"section",11)(1,"div",9),b(2,"img",10),s(),r(3,"div"),y(4),s()()),i&2){let e=p();a(4),se(" ",e.bodyText," ");}}var ra=class extends Tt{},li=function(i){return i.firstStep="proposal",i.secStep="accepted",i.free="free",i.used="used",i;}(li||{}),mh=(()=>{class i extends Pt{get firstStep(){return li.firstStep;}get freeStep(){return li.free;}get secondStep(){return li.secStep;}get usedStep(){return li.used;}constructor(e,n){super(e),this.data=e,this.eventsService=n,this.setTextByState=t=>{switch(t){case li.used:this.headerText="Eye Contact Auto-Fix",this.buttonText="Close",this.bodyText="Eye Contact already applied for this take.";break;case li.firstStep:this.headerText="Eye Contact Auto-Fix",this.buttonText="Auto-Fix Eye Contact",this.bodyText="Get AI to get eyes perfectly looking at camera all the time.";break;case li.secStep:this.headerText="Processing \u{1F389}",this.buttonText="Continue",this.bodyText="Eye Contact Auto-Fix is processing. Your video will be added as a new take in your project.";break;case li.free:this.headerText="Eye Contact Auto-Fix",this.buttonText="Unlock Feature - Upgrade to AI Pro",this.bodyText="Get AI to get eyes perfectly looking at camera all the time.";break;}},this.onClick=()=>{switch(this.step){case li.used:this.close();break;case li.firstStep:this.step=this.secondStep,this.setTextByState(li.secStep),this.data.onStartProcess();break;case li.secStep:case li.free:this.close(),this.submit();break;}},e.featureUsed?this.step=li.used:e.isFree?this.step=li.free:this.step=li.firstStep,this.setTextByState(this.step);}static{this.ɵfac=function(n){return new(n||i)(d(yt),d(Pe));};}static{this.ɵcmp=G({type:i,selectors:[["app-eye-fix-dialog"]],standalone:!0,features:[Ae,q],decls:17,vars:11,consts:[[1,"eye-fix-dialog-wrapper"],[1,"boost-close-button",3,"click"],["aria-label","Close"],["src","/img/sidebar-close-icon.svg","alt","image"],[3,"ngSwitch"],["class","center",4,"ngSwitchCase"],["class","left",4,"ngSwitchCase"],[3,"click"],[1,"center"],[1,"header-img"],["src","/img/script-story-v2/eye-fix.svg","alt","audio boost"],[1,"left"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),S("click",function(){return t.data.onClose();}),r(2,"button",2),b(3,"img",3),s()(),r(4,"header",4),M(5,E0,5,1,"section",5)(6,A0,5,1,"section",5)(7,D0,5,1,"section",5)(8,L0,3,1,"section",6),s(),r(9,"main",4),M(10,V0,3,1,"section",5)(11,R0,3,1,"section",5)(12,N0,3,1,"section",5)(13,F0,5,1,"section",6),s(),r(14,"footer")(15,"button",7),S("click",function(){return t.onClick();}),y(16),s()()()),n&2&&(a(4),c("ngSwitch",t.step),a(),c("ngSwitchCase",t.firstStep),a(),c("ngSwitchCase",t.usedStep),a(),c("ngSwitchCase",t.freeStep),a(),c("ngSwitchCase",t.secondStep),a(),c("ngSwitch",t.step),a(),c("ngSwitchCase",t.firstStep),a(),c("ngSwitchCase",t.usedStep),a(),c("ngSwitchCase",t.freeStep),a(),c("ngSwitchCase",t.secondStep),a(3),se(" ",t.buttonText," "));},dependencies:[xe,wo,To],styles:[".eye-fix-dialog-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;padding:32px;display:flex;justify-content:flex-start;flex-direction:column;align-items:center;gap:12px;overflow:hidden;position:relative;color:#253658}.boost-close-button[_ngcontent-%COMP%]{position:absolute;top:12px;right:12px}header[_ngcontent-%COMP%] section[_ngcontent-%COMP%]{width:320px;height:100%;display:flex;align-items:center;justify-content:center;font-size:22px;font-weight:700;line-height:28px;gap:20px}header[_ngcontent-%COMP%] .left[_ngcontent-%COMP%]{width:340px}.header-img[_ngcontent-%COMP%]{width:48px;height:48px;flex-shrink:0}.header-img[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;object-position:center}main[_ngcontent-%COMP%]{width:340px;height:100%;font-size:16px;line-height:20px}main[_ngcontent-%COMP%] section[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-start;gap:16px}.center[_ngcontent-%COMP%]{text-align:center}.left[_ngcontent-%COMP%]{text-align:left}header[_ngcontent-%COMP%] .left[_ngcontent-%COMP%]{justify-content:left!important}footer[_ngcontent-%COMP%]{margin-top:20px;width:100%;height:100%}footer[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:340px;height:44px;padding:10px;justify-content:center;align-items:center;gap:10px;display:flex;border-radius:10px;background-color:#4481fd;font-size:16px;font-family:Inter-Bold;color:#fff;font-weight:700;margin:0 auto}"]});}}return i;})();ro();J();function ec(){return[{topic:_i.hook,topicTitle:"Hook",generatedText:"",texts:[],hasSelectedTextPart:!1},{topic:_i.topicIntro,topicTitle:"Topic Intro",generatedText:"",texts:[],hasSelectedTextPart:!1},{topic:_i.speakerIntro,topicTitle:"Speaker Intro",generatedText:"",texts:[],hasSelectedTextPart:!1},{topic:_i.highlight,topicTitle:"Highlight",generatedText:"",texts:[],hasSelectedTextPart:!1},{topic:_i.valueProposition,topicTitle:"Value Proposition",generatedText:"",texts:[],hasSelectedTextPart:!1},{topic:_i.callToAction,topicTitle:"Call-to-Action",generatedText:"",texts:[],hasSelectedTextPart:!1},{topic:_i.outro,topicTitle:"Outro",generatedText:"",texts:[],hasSelectedTextPart:!1}];}
8function gh(i,u){u.forEach(e=>{e.labels.forEach(n=>{uh(n)&&i.find(t=>t.topic===uh(n)).texts.push({text:e.text,textPreview:j0(e),active:!1,existsInTextArea:!0,startIndex:e.startIndex,endIndex:e.endIndex});});});}function j0(i){let u=i.text.split(" ").slice(0,3).join(" "),e=i.text.split(" ").slice(-3).join(" ");return`${u}...${e}`;}function sa(i){let u={};return i.forEach(n=>{n.forEach(t=>{u[t]===void 0?u[t]=1:u[t]++;});}),Object.keys(u).sort().join(",").toString();}function uh(i){switch(i){case"topic_introduction":return _i.topicIntro;case"speaker_introduction":return _i.speakerIntro;case"hook":return _i.hook;case"value_proposition":return _i.valueProposition;case"call_to_action":return _i.callToAction;case"outro":return _i.outro;case"highlight":return _i.highlight;default:return;}}ae();Ln();J();qt();oo();ht();Mi();Zi();ae();var B0=i=>({"topic-container-active":i}),U0=i=>({"topic-preview-active":i});function H0(i,u){if(i&1){let e=U();r(0,"div",7),S("click",function(){T(e);let t=p();return P(t.closeSidebar());}),r(1,"button"),b(2,"img",8),s()();}}function z0(i,u){if(i&1){let e=U();r(0,"div",20),S("click",function(){let t=T(e).$implicit,o=p(5);return P(o.setTakeAction(t.value));}),b(1,"img",21),r(2,"span"),y(3),s()();}if(i&2){let e=u.$implicit;a(),c("src",e.style,Ie)("alt",e.name),a(2),de(e.name);}}function $0(i,u){if(i&1){let e=U();r(0,"button",17),S("click",function(){let t=T(e).index,o=p(2).index,h=p(2);return P(h.setActiveTextTopic(o,t));}),y(1),r(2,"div",18),M(3,z0,4,3,"div",19),s()();}if(i&2){let e=u.$implicit,n=p(4);c("ngClass",ue(4,U0,e.active)),a(),se(" ",e.textPreview," "),a(),c("hidden",!e.active),a(),c("ngForOf",n.actionsMenu);}}function W0(i,u){if(i&1&&(r(0,"div",15),M(1,$0,4,6,"button",16),s()),i&2){let e=p().$implicit;a(),c("ngForOf",e.texts);}}function G0(i,u){i&1&&(r(0,"div",22),y(1," Not detected "),s());}function q0(i,u){if(i&1&&(r(0,"div",11)(1,"div",12),y(2),s(),r(3,"section",13),M(4,W0,2,1,"div",14)(5,G0,2,0,"ng-template",null,1,Re),s()()),i&2){let e=u.$implicit,n=Be(6);c("ngClass",ue(4,B0,e.generatedText)),a(2),de(e.topicTitle),a(2),c("ngIf",e.texts.length>0)("ngIfElse",n);}}function K0(i,u){if(i&1&&(r(0,"div",9),M(1,q0,7,6,"div",10),s()),i&2){let e=p();a(),c("ngForOf",e.topicsSections);}}function Q0(i,u){if(i&1&&(r(0,"div",23),y(1),s()),i&2){let e=p();a(),de(e.errorMessage);}}var fh=(()=>{class i{constructor(e,n,t,o,h,k,f){this.aiScriptService=e,this.notifier=n,this.storyTrackCommunicationService=t,this.anonymousUserService=o,this.eventsService=h,this.adminRequestsService=k,this.creditsService=f,this.closeExtractor=new be(),this.isLoading=!1,this.EVENT_PATH=this.eventsService.events.script,this.initSegmentationText=()=>I(this,null,function*(){let m=this.story.segmentation?this.story.segmentation.filter(te=>te.status===2&&te.locale===te.sourceLocale&&this.take.video.groupId===te.groupId).map(te=>te.url):[],v=yield this.fetchSegmentationJson(m);this.textSegmentation=v.map(te=>te.words).flat();let V=0;this.textSegmentation.forEach(te=>{te.startIndex=V,te.endIndex=V+te.word.length+1,V+=te.word.length+1;}),this.textFromSegmentation=this.textSegmentation.map(te=>te.word).join(" ");}),this.fetchSegmentationJson=m=>I(this,null,function*(){return yield(yield fetch(m[0])).json();}
8),this.getScriptTopics=()=>I(this,null,function*(){try{if(yield this.initSegmentationText(),this.topicsSections=ec(),this.lottieTitle="Analyzing your Take",this.isLoading=!0,this.sendEvent(this.EVENT_PATH.aiScriptCheckerStart,{numWords:this.textFromSegmentation.split(" ").length}),this.textFromSegmentation.length>Ti.SCRIPT_SEGMENTATION_MINIMUM_CHAR_LENGTH){let m=yield this.aiScriptService.generateScriptTopics(this.textFromSegmentation);m.length>0&&gh(this.topicsSections,m),this.sendEvent(this.EVENT_PATH.aiScriptCheckerOutput,{numWords:this.textFromSegmentation.split(" ").length,identifiedLabels:m.length>0?sa(m.map(v=>v.labels)):""}),this.showError=!1;}else this.showError=!0,this.errorMessage="Script is too short.";}catch(m){console.error(m),this.closeSidebar(),m.data?.code==="30002"?(this.notifier.error("Clip Extractor is currently only available for English take."),this.errorMessage="Clip Extractor is currently only available for English take.",this.showError=!0):this.notifier.error("An error occurred while analyzing your take. Please try again.");}finally{this.isLoading=!1;}}),this.setTakeAction=m=>I(this,null,function*(){let v,V={storyId:this.story.storyId,groupId:this.take.video.groupId,videoId:this.take.video.mediaId,templateIds:[],options:{actions:[{type:"trim",value:{startTime:this.startTime*1e3,endTime:this.endTime*1e3}}]}};try{if(this.isLoading=!0,m===qe.addToSequence)v="sequencer",this.storyTrackCommunicationService.setTakeToTrim({take:this.take,video:null,start:this.startTime,end:this.endTime,method:"add"});else if(m===qe.newTakeClipExtract){v="save";let te=yield this.adminRequestsService.generateVideo(V);this.storyTrackCommunicationService.setTakeToTrim({take:this.take,video:te,start:this.startTime,end:this.endTime,method:"trim"});}else m===qe.styleYouVideo?(v="trimmer",this.storyTrackCommunicationService.setTakeAction(this.take,qe.styleYouVideo,this.startTime,this.endTime)):m===qe.preview&&(v="play-clip",this.storyTrackCommunicationService.setVideoStartEndTime(this.startTime,this.endTime,this.take));this.sendEvent(this.EVENT_PATH.aiScriptCheckerPartSelect,{label:this.activeText?this.activeText.textPreview:"",sentence:this.activeText?this.activeText.text:"",choice:v});}catch(te){if(console.error(te),this.creditsService.handleCreditError(te))return;this.notifier.error(te.responseJSON.msg);}finally{this.isLoading=!1;}}),this.setActiveTextTopic=(m,v)=>{if(this.topicsSections[m].texts[v].active)this.topicsSections[m].texts[v].active=!1,this.topicsSections[m].hasSelectedTextPart=!1,this.startTime=0,this.endTime=0;else{this.sendEvent(this.EVENT_PATH.aiScriptCheckerSelect,{label:this.topicsSections[m].topic,sentence:this.topicsSections[m].texts[v].text}),this.makeAllTopicsUnActive(),this.topicsSections[m].texts[v].active=!0,this.topicsSections[m].hasSelectedTextPart=!0,this.activeText=this.topicsSections[m].texts[v];let V=this.topicsSections[m].texts[v].startIndex+1,te=this.topicsSections[m].texts[v].endIndex;this.startTime=Math.trunc(this.textSegmentation.find($=>$.startIndex<=V&&$.endIndex>=V).start*1e3)/1e3,this.endTime=Math.trunc(this.textSegmentation.find($=>$.startIndex<=te&&$.endIndex>=te).end*1e3)/1e3;}},this.makeAllTopicsUnActive=()=>{this.topicsSections.forEach(m=>{m.hasSelectedTextPart=!1,m.texts.forEach(v=>v.active=!1);}),this.activeText=null;},this.sendEvent=(m,v)=>{this.eventsService.log(m,pe({storyId:this.story.storyId,type:"transcript"},v));},this.isLoading=!0,this.showError=!1,this.actionsMenu=[new St(qe.newTakeClipExtract,qe.newTakeClipExtract,"img/script-story-v2/new-take-extr.svg"),new St(qe.addToSequence,qe.addToSequence,"img/script-story-v2/sequence-extr.svg"),new St(qe.styleYouVideo,"Trimmer","img/script-story-v2/trimmer-extr.svg"),new St(qe.preview,"Play Clip","img/script-story-v2/play-clip.svg")],this.topicsSections=ec();}onClick(e){if(this.topicsSections.find(n=>n.hasSelectedTextPart)){let n=document.querySelectorAll(".topic-preview"),t=!1;n.forEach(o=>{o.contains(e)&&(t=!0);}),t||this.makeAllTopicsUnActive();}}ngOnInit(){return I(this,null,function*(){yield this.getScriptTopics();});}closeSidebar(){this.closeExtractor.emit();}static{this.ɵfac=function(n){return new(n||i)(d(Ti),d(Ge),d(He),d(xi),d(Pe),d(xt),d(Vt));};}static{this.ɵcmp=G({type:i,selectors:[["app-ai-script-extractor"]],hostBindings:function(n,t){n&1&&S("click",function(h){return t.onClick(h.target);},!1,So);},inputs:{take:"take",story:"story"},outputs:{closeExtractor:"closeExtractor"},standalone:!0,features:[q],decls:12,vars:6,consts:[["errorBox",""],["emptytopic",""],[1,"ai-script-extractor-wrapper"],[1,"ai-checker-sidebar-title"],["class","close-button-ai-sidebar",3,"click",4,"ngIf"],["class","section-topics",4,"ngIf","ngIfElse"],[3,"title","subTitle","generating"],[1,"close-button-ai-sidebar",3,"click"],["src","/img/sidebar-close-icon.svg","alt","image"],[1,"section-topics"],["class","topic-container",3,"ngClass",4,"ngFor","ngForOf"],[1,"topic-container",3,"ngClass"],[1,"topic-tag"],[1,"top-section-topic"],["class","topic-scripts",4,"ngIf","ngIfElse"],[1,"topic-scripts"],["class","topic-preview",3,"ngClass","click",4,"ngFor","ngForOf"],[1,"topic-preview",3,"click","ngClass"],[1,"topic-action-wrapper",3,"hidden"],["class","topic-action",3,"click",4,"ngFor","ngForOf"],[1,"topic-action",3,"click"],[3,"src","alt"],[1,"empty-topic"],[1,"error-box"]],template:function(n,t){if(n&1&&(r(0,"div",2)(1,"header")(2,"div",3),y(3," AI Clip Extractor "),r(4,"span"),y(5,"(BETA)"),s()(),M(6,H0,3,0,"div",4),s(),r(7,"main"),M(8,K0,2,1,"div",5)(9,Q0,2,1,"ng-template",null,0,Re),s(),b(11,"app-process-fake-with-lottie",6),s()),n&2){let o=Be(10);a(6),c("ngIf",!t.isLoading),a(2),c("ngIf",!t.showError)("ngIfElse",o),a(3),c("title",t.lottieTitle)("subTitle","It will take a moment...")("generating",t.isLoading);}},dependencies:[Do,xe,we,Le,_e],styles:[".ai-script-extractor-wrapper[_ngcontent-%COMP%]{position:relative;width:100%;margin-top:0!important;background:#fff;overflow:hidden;padding:12px 0!important}.ai-checker-sidebar-title[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:#0d80dc}main[_ngcontent-%COMP%]{margin-top:24px!important;width:100%;height:calc(100vh - 360px)!important;position:relative;overflow-y:scroll;overflow-x:hidden;padding:0 4px!important}main[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px!important}header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;height:60px;position:absolute;width:100%;top:0;left:0;background:#fff;padding:0!important}footer[_ngcontent-%COMP%]{width:100%;z-index:1;background:#fff;box-shadow:0 0 40px #0000001a;position:absolute;bottom:0;left:0;height:60px}.top-section-topic[_ngcontent-%COMP%]{min-height:unset!important}
8ai-script-extractor-wrapper[_ngcontent-%COMP%] .topic-preview[_ngcontent-%COMP%]{position:relative}.topic-action-wrapper[_ngcontent-%COMP%]{position:absolute;bottom:-120px;right:0;display:flex;width:268px;min-height:128px;padding:10px 16px;align-items:flex-start;align-content:flex-start;gap:8px 16px;flex-wrap:wrap;border-radius:20px;background:#fff;box-shadow:0 0 15.7px #00000021;z-index:1}.topic-action[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px;align-items:center;width:64px;height:64px}.topic-action[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:24px;height:24px}.topic-action[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;color:#253658;text-align:center;font-size:11px}",".ai-sidebar-container[_ngcontent-%COMP%]{width:405px;margin-top:40px;background:#fff;height:calc(100vh - 124px);overflow:hidden;box-shadow:0 0 40px #0000001a;border-radius:20px;padding:24px 0 24px 12px} aside#whiteboard, aside#ai-checker, aside#ai-checker-v2, aside#ai-rewrite{left:-664px!important;width:360px!important;background:transparent!important;z-index:31} aside#emotions{left:-664px!important;width:432px!important;background:transparent!important;z-index:31} aside#audiogram{left:-664px!important;width:536px!important;background:transparent!important;z-index:31}main[_ngcontent-%COMP%]{margin-top:42px;width:100%;height:calc(100vh - 254px);position:relative;overflow-y:scroll;overflow-x:hidden;padding:0 4px}main[_ngcontent-%COMP%]::-webkit-scrollbar{width:11px}header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;height:60px;position:absolute;width:100%;top:0;left:0;background:#fff;padding:0 15px}footer[_ngcontent-%COMP%]{width:100%;z-index:1;background:#fff;box-shadow:0 0 40px #0000001a;position:absolute;bottom:0;left:0;height:60px}.ai-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#00abfe;font-family:Inter-Bold;width:110px} .ai-text-area-wrapper .text-area-input-component .mat-form-field-label{white-space:pre-wrap!important}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar{width:3px;padding-left:4px}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#00abfe}.ai-result-action-menu[_ngcontent-%COMP%]{position:absolute;right:12px;top:-18px;background:#fff;box-shadow:0 0 24px #0000002e;border-radius:10px;width:100px;height:28px;display:flex;align-items:center;justify-content:space-evenly;cursor:pointer}.ai-result-action-menu[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:0;margin:0;width:20px;height:20px}.ai-result-action-menu[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;background-repeat:no-repeat;padding:0;display:block}.ai-result-action-menu[_ngcontent-%COMP%] .delete[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-d.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .past[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-past.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .whiteboard[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-m.svg)}.ai-menu-wrapper[_ngcontent-%COMP%]{width:100%;max-width:240px;text-overflow:ellipsis;white-space:nowrap;border:1px solid rgba(37,54,88,.6);background:#fff;border-radius:20px;padding:2px 6px;font-weight:400;font-size:14px;color:#253658}.fade[_ngcontent-%COMP%]{opacity:0;transition:all .5s ease-in-out}.hide[_ngcontent-%COMP%]{display:none!important}.editing[_ngcontent-%COMP%]{cursor:default!important}.disabled[_ngcontent-%COMP%]{opacity:.4}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%], .ai-result-wrapper-active[_ngcontent-%COMP%]{border:2px solid rgba(0,171,254,.6)!important;background:#fff!important;cursor:text!important}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-result-wrapper-active[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-droppable-area[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:164px}.ai-droppable-class[_ngcontent-%COMP%]{transform:scale(.9);transition:all .3s ease-in-out}.ai-droppable-area[_ngcontent-%COMP%]{width:100%}.ai-sale-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;
8height:100%;padding:0 12px}.ai-sale-component[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;gap:14px}.ai-sale-section[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;cursor:pointer}.upgrade-text[_ngcontent-%COMP%]{max-width:100px;font-weight:500;font-size:12px;line-height:15px;color:#253658}.ai-result-list-wrapper[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:12px}.ai-result-item-container[_ngcontent-%COMP%]{position:relative;width:100%}",".ai-checker-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#253658;font-family:Inter-Bold}.section-topics[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:flex-start;gap:24px;padding-top:24px}.error-box[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;top:0;left:0;background:#fff;z-index:1;font-weight:700;font-size:20px;line-height:24px;text-align:center;color:#253658}.topic-container[_ngcontent-%COMP%]{width:100%;padding:20px 12px 12px;border-radius:12px;border:1px solid rgba(123,141,177,.3);position:relative;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;transition:all .3s ease-in-out}.topic-container-active[_ngcontent-%COMP%]{border:2px solid #4481FD}.topic-tag[_ngcontent-%COMP%]{position:absolute;padding:4px 8px;left:12px;top:-12px;display:flex;justify-content:center;align-items:center;border-radius:40px;background:#4481fd;color:#fff;font-size:12px;font-weight:700}.top-section-topic[_ngcontent-%COMP%]{width:100%;min-height:45px;display:flex;justify-content:space-between;align-items:center}.topic-scripts[_ngcontent-%COMP%]{width:100%;height:auto;display:flex;flex-wrap:wrap;gap:8px}.empty-topic[_ngcontent-%COMP%]{color:#7b8db1;font-size:14px;font-weight:400;width:100%;display:flex;align-items:center;justify-content:center}.topic-preview[_ngcontent-%COMP%]{color:#4481fd;font-size:12px;font-weight:400;display:flex;padding:4px 8px;justify-content:center;align-items:center;border-radius:40px;background:#4481fd14;cursor:pointer}.topic-preview[_ngcontent-%COMP%]:hover{background:#4481fd99;color:#fff}.topic-preview-active[_ngcontent-%COMP%]{border:2px solid #4481FD!important;background:#fff!important;color:#4481fd!important}.ai-checker-title-with-go-back[_ngcontent-%COMP%]{display:flex;gap:15px}"]});}}return i;})();Nn();J();Gr();Bt();at();ae();J();ht();at();ae();function Y0(i,u){i&1&&(r(0,"div",6),y(1," How satisfied are you with your video result? "),s());}
8function J0(i,u){i&1&&(r(0,"div",6),y(1," Thank you for your feedback! "),s());}var yr=function(i){return i.GOOD="good",i.BAD="bad",i;}(yr||{}),aa=function(i){return i.DISMISS="dismiss",i.COMMENT="comment",i.SEND="send",i;}(aa||{}),vh=(()=>{class i{constructor(e,n){this.eventsService=e,this.dialogHelperService=n,this.likeClick$=new Ze(),this.dislikeClick$=new Ze(),this.destroy$=new Ze(),this.DEBOUNCE_TIME=300,this.EVENT_PATH=this.eventsService.events.script,this.isAnswered=!1,this.cpSlotsStore=et(ni,{optional:!0}),this.cpProjectAnalytics=et(ii);}ngOnInit(){this.likeClick$.pipe(Xi(this.DEBOUNCE_TIME),me(this.destroy$)).subscribe(()=>{this.handleLikeClick();}),this.dislikeClick$.pipe(Xi(this.DEBOUNCE_TIME),me(this.destroy$)).subscribe(()=>{this.handleDislikeClick();});}ngOnChanges(e){e.take&&(this.isAnswered=!1);}onLikeClick(){this.likeClick$.next();}onDislikeClick(){this.dislikeClick$.next();}handleLikeClick(){this.sendFeedbackClickEvent(yr.GOOD),this.openFeedbackDialog(yr.GOOD);}handleDislikeClick(){this.sendFeedbackClickEvent(yr.BAD),this.openFeedbackDialog(yr.BAD);}openFeedbackDialog(e){let n=new Rl();n.title="Your feedback is important",n.inputPlaceholder="Type your feedback here",n.inputVariant="text-area",n.confirmButtonText="Send",n.showClearButton=!1,n.showValidationErrors=!1,n.onSubmit=o=>{this.sendFeedbackEvent(aa.SEND,o,e),this.dialogHelperService.close();},n.onClose=()=>{this.sendFeedbackEvent(aa.DISMISS),this.dialogHelperService.close();},n.onInputClick=()=>{this.sendFeedbackEvent(aa.COMMENT);};let t=new We();t.panelClass="confirmation-with-input-dialog",this.dialogHelperService.open(n,Nl,t);}sendFeedbackClickEvent(e){this.isAnswered=!0,this.eventsService.log(this.EVENT_PATH.takeFeedbackSelect,pe({storyId:this.storyId,videoId:this.take?.video?.id,rating:e,featuresApplied:this.take?.video?.features?this.take?.video?.features.map(n=>n.name).sort():[]},this.cpProjectAnalytics.attrs({slots:this.cpSlotsStore?.slots()})));}sendFeedbackEvent(e,n,t){this.eventsService.log(this.EVENT_PATH.takeFeedbackCommentClick,pe({storyId:this.storyId,videoId:this.take?.video?.id,rating:t,featuresApplied:this.take?.video?.features?this.take?.video?.features.map(o=>o.name).sort():[],button:e,text:n},this.cpProjectAnalytics.attrs({slots:this.cpSlotsStore?.slots()})));}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}static{this.ɵfac=function(n){return new(n||i)(d(Pe),d(Ue));};}static{this.ɵcmp=G({type:i,selectors:[["app-video-feedback"]],inputs:{take:"take",storyId:"storyId"},standalone:!0,features:[Ut,q],decls:9,vars:4,consts:[["feedbackAnswered",""],[1,"video-feedback"],["class","video-feedback__header",4,"ngIf","ngIfElse"],[1,"video-feedback__content"],["variant","secondary-blueblack","size","md","fullWidth","true","iconLeft","dislike-icon-small",1,"video-feedback__button",3,"onClick","disabled"],["variant","primary-royal","size","md","fullWidth","true","iconLeft","like-icon-small",1,"video-feedback__button",3,"onClick","disabled"],[1,"video-feedback__header"]],template:function(n,t){if(n&1){let o=U();r(0,"div",1),M(1,Y0,2,0,"div",2)(2,J0,2,0,"ng-template",null,0,Re),r(4,"div",3)(5,"ui-button",4),S("onClick",function(){return T(o),P(t.onDislikeClick());}),y(6,"Bad"),s(),r(7,"ui-button",5),S("onClick",function(){return T(o),P(t.onLikeClick());}),y(8,"Good"),s()()();}if(n&2){let o=Be(3);a(),c("ngIf",!t.isAnswered)("ngIfElse",o),a(4),c("disabled",t.isAnswered),a(2),c("disabled",t.isAnswered);}},dependencies:[Dn,xe,_e],styles:[".video-feedback[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;width:100%}.video-feedback__header[_ngcontent-%COMP%]{font-size:14px;font-weight:600;color:#253658;text-align:center}.video-feedback__content[_ngcontent-%COMP%]{display:flex;gap:10px}.video-feedback__button[_ngcontent-%COMP%]{flex:1}"]});}}return i;})();Bt();ae();bm();no();Ei();rr();Ni();ji();Bi();Cn();ss();vi();Ui();J();qt();Mi();Ea();ht();ae();Ni();Gr();Ml();var Z0=i=>({processing:i});function ef(i,u){if(i&1&&(r(0,"div",3),b(1,"lib-logo",4),s(),r(2,"div",5)(3,"div",6)(4,"div",7),b(5,"img",8),s(),r(6,"div",9),y(7," Preparing your video... "),s(),r(8,"div",10),y(9," We're applying the selected feature and getting the editor ready. This may take a moment. "),s(),r(10,"div",11),b(11,"app-progress-fake-bar",12),s()()()),i&2){let e=p();
8a(2),c("@fadeIn",void 0),a(9),c("showBackground",!1)("show",e.progress!==100)("realProgress",e.progress)("isRealProgress",!0);}}function tf(i,u){if(i&1&&(r(0,"div",31),y(1),s()),i&2){let e=p(2);a(),se(" ",e.titleText," ");}}function nf(i,u){if(i&1&&(r(0,"section",32),y(1),s()),i&2){let e=p(2);a(),se(" ",e.instructionText," ");}}function of(i,u){i&1&&b(0,"assets-move-dialog-shimmer");}function rf(i,u){if(i&1&&(ot(0),M(1,of,1,0,"assets-move-dialog-shimmer",33),rt()),i&2){let e=p(2);a(),c("ngForOf",e.shimmerCount);}}function sf(i,u){if(i&1){let e=U();r(0,"div",34),S("click",function(){let t=T(e).$implicit,o=p(2);return P(o.onOptionSelection(t));}),r(1,"div",35)(2,"div",36),b(3,"div"),r(4,"div",37),y(5),s()(),r(6,"lib-radio",38),S("change",function(){let t=T(e).$implicit,o=p(2);return P(o.onOptionSelection(t));}),s()()();}if(i&2){let e=u.$implicit,n=p(2);a(3),gt(e==null?null:e.sideIconClass),a(2),de(e==null?null:e.name),a(),c("state",(n.selectedOption==null?null:n.selectedOption.value)===(e==null?null:e.value)?"selected":"default")("checked",(n.selectedOption==null?null:n.selectedOption.value)===(e==null?null:e.value))("value",e==null?null:e.value);}}function af(i,u){i&1&&b(0,"assets-move-dialog-shimmer");}function cf(i,u){if(i&1&&(ot(0),M(1,af,1,0,"assets-move-dialog-shimmer",33),rt()),i&2){let e=p(2);a(),c("ngForOf",e.shimmerCount);}}function lf(i,u){if(i&1){let e=U();r(0,"header",13)(1,"div",14)(2,"div",15),M(3,tf,2,1,"div",16),s(),r(4,"div",17)(5,"div",18,0),b(7,"i",19),s(),r(8,"div",20),S("click",function(){T(e);let t=p();return P(t.close());}),s()()(),M(9,nf,2,1,"section",21),r(10,"div",22),b(11,"ui-search-input",23),s()(),r(12,"main")(13,"section",24),M(14,rf,2,1,"ng-container",25)(15,sf,7,6,"div",26),s(),M(16,cf,2,1,"ng-container",25),r(17,"div",27),S("scrolled",function(){T(e);let t=p();return P(t.onScrollEnd());}),y(18,"a"),s()(),r(19,"footer")(20,"div",28)(21,"ui-button",29),S("onClick",function(){T(e);let t=p();return P(t.close());}),y(22," Cancel "),s(),r(23,"ui-button",30),S("onClick",function(){T(e);let t=p();return P(t.createSubtitles());}),y(24),s()()();}if(i&2){let e=p();a(3),c("ngIf",e.titleText),a(2),c("matTooltipClass","tooltip-custom-black")("matTooltip",e.tooltipText)("matTooltipPosition","right"),a(4),c("ngIf",e.instructionText),a(2),c("showSearchButton",!1)("inputFormControl",e.searchQuery)("placeholder","Search")("showClearButton",!0),a(3),c("ngIf",e.isLoading),a(),c("ngForOf",e.filteredOptions),a(),c("ngIf",e.isLoading),a(7),c("disabled",!e.canSubmit),a(),se(" ",e.actionText," ");}}var ca=class extends Tt{},Ch=(()=>{class i extends Pt{get titleText(){return this.data.titleText??"Select Language";}get instructionText(){return this.data.instructionText??"";}get tooltipText(){return this.data.tooltipText??"";}get actionText(){return this.data.actionText??"Select";}constructor(e,n,t,o,h,k,f,m){super(e),this.data=e,this.translateService=n,this.captionsHelperService=t,this.taskProgressService=o,this.notifier=h,this.requestService=k,this.websocketService=f,this.eventsService=m,this.shimmerCount=Array(8),this.options=[],this.filteredOptions=[],this.selectedOption=null,this.searchQuery=new Ht(""),this.isLoading=!1,this.canSubmit=!1,this.isProcessing=!1,this.progress=0,this.animationState="default",this.SPINNER_NAME="language_select",this.destroy$=new Ze(),this.initializeSearch();}ngOnInit(){return I(this,null,function*(){yield this.loadOptions(),this.data?.take?.video?.id&&(this.taskProgressService.getProgressDataForEntity(this.data.take.video.mediaId).pipe(me(this.destroy$)).subscribe(e=>{this.progress=e?.taskPercent??0;}),this.taskProgressService.taskFailed$.pipe(me(this.destroy$)).subscribe(e=>{console.log("Failure:",e),this.notifier.error("Failed to create subtitles, try again later"),this.clearAllProgress();}),this.websocketService.updatedStoryId$.pipe(me(this.destroy$)).subscribe(e=>I(this,null,function*(){if(e&&e?.storyId===this.data.story.id&&e?.mediaId===this.data.take.video.mediaId){let n=yield this.requestService.getStoryById(e.storyId,!0);this.handleSubmit(n);}})));});}loadOptions(){return I(this,null,function*(){this.isLoading=!0;try{let e=yield this.translateService.getLanguages();this.options=this.translateService.setLanguageOptions(e),this.filteredOptions=this.options;}catch(e){console.error("Error loading languages:",e);}finally{this.isLoading=!1;}});}onScrollEnd(){}onOptionSelection(e){this.selectedOption=e,this.canSubmit=!0;}filterOptions(e){this.filteredOptions=e?this.options.filter(n=>n.name.toLowerCase().includes(e.toLowerCase())):[...this.options];}getCapitalLetter(e){return e?.name?.[0]?.toUpperCase()??"";}createSubtitles(){return I(this,null,function*(){try{this.isProcessing=!0,this.eventsService.log(this.eventsService.events.trim.wordtrimWaiting);let e={options:{captions:[],segmentation:{locale:this.selectedOption.value}},storyId:this.data.story.id,videoId:this.data.take.video.mediaId};yield this.requestService.audioProcessTake(e),this.websocketService.listen();}catch(e){this.isProcessing=!1,this.notifier.error("Failed to create subtitles, try again later"),console.error("Error creating subtitles:",e);}});}handleSubmit(e){!this.canSubmit||!this.selectedOption||(this.canSubmit=!1,this.data.onSubmit(e));}initializeSearch(){this.searchQuery.valueChanges.pipe(Xi(300),me(this.destroy$)).subscribe(e=>{this.filterOptions(e);});}clearAllProgress(){this.progress=0,this.selectedOption=null,this.canSubmit=!1,this.isProcessing=!1;}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}static{this.ɵfac=function(n){return new(n||i)(d(yt),d(Gi),d(Md),d(ms),d(Ge),d(xt),d(Mo),d(Pe));};}static{this.ɵcmp=G({type:i,selectors:[["language-select-dialog-new"]],standalone:!0,features:[Vi([]),Ae,q],decls:5,vars:5,consts:[["tooltip","matTooltip"],[1,"language-select-dialog-container",3,"ngClass"],[3,"name"],[1,"process-container-logo"],["type","text","color","blue"],[1,"process-container"],[1,"process-container-content"],[1,"p-image-container"],["src","/img/script-story-v2/translate-progress.svg","alt","process-container"],[1,"sub-title-black"],[1,"sub-title-black-small"],[1,"fake-progress"],[3,"showBackgroun
8d","show","realProgress","isRealProgress"],[1,"language-select-dialog-header"],[1,"language-select-dialog-header-top"],[1,"language-select-dialog-left"],["class","language-select-dialog-title",4,"ngIf"],[1,"language-select-dialog-actions"],[3,"matTooltipClass","matTooltip","matTooltipPosition"],[1,"info-icon-black"],[1,"language-select-dialog-close-btn",3,"click"],["class","language-select-dialog-instruction",4,"ngIf"],[1,"language-select-dialog-search"],["inputIcon","search-input-search-icon",3,"showSearchButton","inputFormControl","placeholder","showClearButton"],[1,"language-select-dialog-list"],[4,"ngIf"],["class","language-select-dialog-option",3,"click",4,"ngFor","ngForOf"],["appInfiniteScroll","",1,"language-select-dialog-scroll-anchor",3,"scrolled"],[1,"language-select-dialog-buttons"],["variant","text-royal","size","md",3,"onClick"],["variant","primary-royal","size","md",3,"onClick","disabled"],[1,"language-select-dialog-title"],[1,"language-select-dialog-instruction"],[4,"ngFor","ngForOf"],[1,"language-select-dialog-option",3,"click"],[1,"language-select-dialog-option-content"],[1,"language-select-dialog-option-info"],[1,"language-select-dialog-option-title"],[3,"change","state","checked","value"]],template:function(n,t){n&1&&(r(0,"div",1),M(1,ef,12,5)(2,lf,25,14),r(3,"ngx-spinner",2),b(4,"lottie-loader"),s()()),n&2&&(c("ngClass",ue(3,Z0,t.isProcessing)),a(),$c(1,t.isProcessing?1:2),a(2),c("name",t.SPINNER_NAME));},dependencies:[xe,we,Le,_e,Si,dn,Ri,Id,Un,Dn,rs,Xt,lo,hl,Vl,ml],styles:[".language-select-dialog-container[_ngcontent-%COMP%]{width:100%;height:100%;position:relative;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;overflow-x:hidden}.language-select-dialog-container.processing[_ngcontent-%COMP%]{position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:1000;background-color:#fff}.language-select-dialog-container.processing[_ngcontent-%COMP%] .process-container-logo[_ngcontent-%COMP%]{margin-top:40px;width:64px}.language-select-dialog-container.processing[_ngcontent-%COMP%] .process-container[_ngcontent-%COMP%]{margin-top:40px;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.language-select-dialog-container.processing[_ngcontent-%COMP%] .process-container[_ngcontent-%COMP%] .process-container-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;text-align:center;max-width:480px}.language-select-dialog-container.processing[_ngcontent-%COMP%] .process-container[_ngcontent-%COMP%] .process-container-content[_ngcontent-%COMP%] .p-image-container[_ngcontent-%COMP%]{width:180px}.language-select-dialog-container.processing[_ngcontent-%COMP%] .process-container[_ngcontent-%COMP%] .process-container-content[_ngcontent-%COMP%] .p-image-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;object-position:center}.language-select-dialog-container.processing[_ngcontent-%COMP%] .process-container[_ngcontent-%COMP%] .process-container-content[_ngcontent-%COMP%] .sub-title-black[_ngcontent-%COMP%]{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;font-weight:600;font-size:32px;line-height:24px;text-align:center;color:#253658}.language-select-dialog-container.processing[_ngcontent-%COMP%] .process-container[_ngcontent-%COMP%] .process-container-content[_ngcontent-%COMP%] .fake-progress[_ngcontent-%COMP%]{width:268px;height:80px;position:relative}.language-select-dialog-close-btn[_ngcontent-%COMP%]{background-image:url(/img/exit-icon.svg);background-repeat:no-repeat;background-size:cover;background-position:center;width:24px;height:24px;display:block;cursor:pointer}header[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:8px;margin-bottom:8px;padding:20px 15px 0}main[_ngcontent-%COMP%]{width:100%;max-width:475px;height:100%;padding:0 5px;overflow-y:hidden;overflow-x:hidden}main[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}main[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#7b8db14d!important}.language-select-dialog-title[_ngcontent-%COMP%]{font-size:20px;font-weight:700;color:#253658}.language-select-dialog-instruction[_ngcontent-%COMP%]{font-size:16px;color:#253658}footer[_ngcontent-%COMP%]{position:relative;width:100%;display:flex;align-items:baseline;justify-content:flex-end;
8gap:8px;padding:0 15px 20px}.language-select-dialog-header-top[_ngcontent-%COMP%]{display:flex;flex-direction:row;justify-content:space-between;width:100%}.language-select-dialog-actions[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:8px}.language-select-dialog-left[_ngcontent-%COMP%]{display:flex;align-content:center;align-items:center}.language-select-dialog-search[_ngcontent-%COMP%]{width:100%}.language-select-dialog-list[_ngcontent-%COMP%]{width:100%;overflow-y:auto;overflow-x:hidden;height:288px;padding-left:10px}.language-select-dialog-option[_ngcontent-%COMP%]{max-height:54px;width:100%;display:flex;padding-left:5px;align-items:center;justify-content:space-between;cursor:pointer}.language-select-dialog-option[_ngcontent-%COMP%]:hover{background:#00abfe14}.language-select-dialog-option-content[_ngcontent-%COMP%]{display:flex;flex-direction:row;gap:8px;align-items:center;justify-content:space-between;width:100%;padding:20px 0}.language-select-dialog-option-info[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:8px}.language-select-dialog-option-title[_ngcontent-%COMP%]{font-size:14px;font-weight:400;color:#253658}.language-select-dialog-buttons[_ngcontent-%COMP%]{display:flex;gap:8px}.language-select-dialog-scroll-anchor[_ngcontent-%COMP%]{color:transparent;height:2px;width:100%}@media (max-width: 480px){header[_ngcontent-%COMP%]{padding:16px 12px 0}footer[_ngcontent-%COMP%]{padding:0 12px 16px}.language-select-dialog-list[_ngcontent-%COMP%]{height:calc(100vh - 280px);min-height:200px;padding-left:6px}main[_ngcontent-%COMP%]{padding:0 10px}}[_nghost-%COMP%] .fake-progress .progress-fake-bar-wrapper{width:100%!important}"],data:{animation:[Jd.fadeIn]}});}}return i;})();J();at();Mi();so();bn();ln();Ea();ae();ns();xl();ht();pn();Bn();Zr();Im();qt();ao();Zi();Ni();var hf=i=>({"anonymous-takes-story-v2-container":i}),mf=i=>({"anonymous-left-section":i}),uf=i=>({"anonymous-right-section":i});function gf(i,u){if(i&1){let e=U();r(0,"app-cp-select-take-banner",17),S("select",function(){T(e);let t=p();return P(t.onSelectTakeForEditing());}),s();}}function ff(i,u){if(i&1){let e=U();r(0,"app-cp-select-take-banner",18),S("select",function(){T(e);let t=p();return P(t.onSelectEditedTake());}),s();}if(i&2){let e=p();c("variant",e.bannerVariant());}}function vf(i,u){if(i&1&&(r(0,"div",19),b(1,"lottie-loader",20),r(2,"span",21),y(3),s()()),i&2){let e=u.ngIf;a(),c("lottieWidth",32)("lottieHeight",32),a(2),de(e);}}function _f(i,u){if(i&1&&b(0,"app-cp-slot-message",22),i&2){let e=p();c("activeTakeId",e.currentActiveTrack==null||e.currentActiveTrack.video==null?null:e.currentActiveTrack.video.id)("activeTakeMediaId",e.currentActiveTrack==null||e.currentActiveTrack.video==null?null:e.currentActiveTrack.video.mediaId)("currentTime",e.readPlayerTime);}}function Cf(i,u){if(i&1&&b(0,"app-video-feedback",23),i&2){let e=p();c("take",e.currentActiveTrack)("storyId",e.story==null?null:e.story.id);}}function bf(i,u){if(i&1){let e=U();r(0,"div",24)(1,"app-ai-script-extractor",25),S("closeExtractor",function(){T(e);let t=p();return P(t.onActiveExtractorClose());}),s()();}if(i&2){let e=p();a(),c("story",e.story)("take",e.extractorTake);}}function Sf(i,u){if(i&1){let e=U();r(0,"take-track-list",26),S("newActiveTrack",function(t){T(e);let o=p();return P(o.onActiveTrackChange(t));}),s();}}function xf(i,u){i&1&&(r(0,"div",27),b(1,"app-take-track-list-shimmer"),s());}var tc=(()=>{class i{get tooltipName(){return Qt(name);}constructor(e,n,t,o,h,k,f,m,v,V,te,$,H,j,F,Z,N,Q,W,O,D,ie,Te,Ee,je,Ke,Ft,Wt,Ai){this.dialogHelperService=e,this.adminRequestsService=n,this.assetsRepo=t,this.spinnerService=o,this.deskManagerHelperService=h,this.videoSlidesService=k,this.route=f,this.router=m,this.slideListDataService=v,this.styleVideoService=V,this.websocketService=te,this.location=$,this.uiActionService=H,this.navigationHelperService=j,this.errorParseService=F,this.storyTrackCommunicationService=Z,this.eventsService=N,this.planHelperService=Q,this.premiumPlanService=W,this.localTakeHelperService=O,this.uploadService=D,this.localeService=ie,this.notifier=Te,this.portableRegisterService=Ee,this.storyHelperService=je,this.pageHelperService=Ke,this.creditsService=Ft,this.translateStoryService=Wt,this.composerOpenService=Ai,this.SPINNER_ID="takes-story-spinner",this.EVENT_SCRIPT=this.eventsService.events.script,this.EVENT_TRIM=this.eventsService.events.trim,this.storySaved=!1,this.takeTrackList=[],this.eventListeners=[],this.slotsStore=et(ni),this.slotActionRunner=et(Ps),this.cpAnalytics=et(Ts),this.cpProjectAnalytics=et(ii),this.videoPlayerService=et(Ao),this.readPlayerTime=()=>this.videoPlayerService.getCurrentTime(Ss),this.setEventListeners=()=>{this.storyTrackCommunicationService.observePlayerTrack().pipe(Co(1)).subscribe(_=>{this.currentActiveTrack=_;}),this.eventListeners.push(this.storyTrackCommunicationService.observeTakeAction().subscribe(this.applyActionOnTake),this.storyTrackCommunicationService.observeTakeTracks().subscribe(this.setTakesTracks),this.storyTrackCommunicationService.observeStoryChanged().subscribe(_=>this.story=_),this.storyTrackCommunicationService.observeIsViewer().subscribe(_=>this.isViewer=_),this.storyTrackCommunicationService.observeIsAnonymous().subscribe(_=>this.isAnonymous=_),this.storyTrackCommunicationService.observeStoryLoading().subscribe(_=>{this.isLoading=_;}));},this.setTakesTracks=_=>{_&&(this.takeTrackList=_);},this.applyActionOnTake=(_,R=!1)=>I(this,null,function*(){switch(this.sendTakeClickEvent(R,_.track,_.action),_.action){case qe.autoShorts:(yield this.planHelperService.hasPremiumPlan())?yield this.openAutoShortsAgent(_.track):this.openUpsell(pt.clipExtractor);break;case qe.delete:this.eventsService.log(this.EVENT_SCRIPT.scriptDeleteTake,pe({loc:R?"menu":"icon",storyId:this.story.storyId,takeId:_.track?.video?.mediaId||"",featuresApplied:Uo(_.track)},this.cpProjectAttrs())),this.openDeleteDialog(_.track);break;case qe.addToSequence:this.sendAddToSequence(_.track,Hn.bigvu,co.button);break;case qe.openMore:this.onOpenMoreDialog(_.track);break;case qe.rename:this.openRenameDialog(_.track);break;case qe.wordTrim:this.onWordTrim(_.track);break;case qe.upload:this.isAnonymous?this.portableRegisterService.openPortableRegisterDialog():this.onLocalTakeUpload(_.track);break;case qe.editThumbnail:(yield this.planHelperService.isFreeByCurrentPlan())?this.openUpsell(pt.thumbnailChange):this.onThumbnailUpload(_.track);break;case qe.replaceBackGround:(yield this.planHelperService.isFreeByCurrentPlan())?this.openUpsell(pt.background_change):this.onReplaceBackgroun
8d(_.track);break;case qe.styleYouVideo:(yield this.planHelperService.isFreeByCurrentPlan())?this.openUpsell(pt.trim):this.onStyleVideo(_.track,_.startTime,_.endTime);break;case qe.openVideoMaker:if(_.track.isComposerRow){_.track.composerDeleted||this.composerOpenService.openComposerRow(_.track);break;}let re=this.story.captions.some(ce=>ce.groupId===_.track.video.groupId&&ce.status===2);this.sendEvent(this.getEventName("openInComposer",_.track),_.track,re,this.cpProjectAttrs()),this.onOpenVideoMaker(_.track);break;case qe.openVideoMakerAlpha:{let ce=this.story.captions.some(ge=>ge.groupId===_.track.video.groupId&&ge.status===2);this.sendEvent(this.getEventName("openInComposer",_.track),_.track,ce,this.cpProjectAttrs()),this.onOpenVideoMakerAlpha(_.track);break;}case qe.translateSubtitles:(yield this.planHelperService.hasPremiumPlan())?this.onOpenTranslateSubtitlesDialog(_.track):this.openUpsell(pt.translateTake);break;case qe.dubVideo:(yield this.planHelperService.hasPremiumPlan())?this.onOpenDubVideoDialog(_.track):this.openUpsell(pt.dubVideo);break;case qe.boost:this.onBoostAudioDialog(_.track);break;case qe.eyeFix:this.eyeFixDialog(_.track);break;case qe.retry:yield this.onRetryFailedTake(_.track);break;case ci.downloadSrt:this.onTranslateGenerate(_.track,"captions",gr.download);break;case ci.downloadRealTake:this.onDownloadRealTake(_.track);break;case ci.downloadMp4:this.isAnonymous?this.portableRegisterService.openPortableRegisterDialog():this.onDownloadLocalTake(mn.mp4,_.track);break;case ci.downloadWebM:this.isAnonymous?this.portableRegisterService.openPortableRegisterDialog():this.onDownloadLocalTake(mn.webm,_.track);break;case ci.embed:this.onEmbed(_.track);break;case ci.addToUploads:this.onAddToUploads(_.track);break;case ci.messageVideoPage:this.onMessageVideoPage(_.track);break;case ci.postOnSocialChannels:this.onPostToSocial(_.track);break;case ci.copyThumbnail:this.onCopyThumbnail(_.track);break;case ci.bivuInspire:this.onBigvuInspireVideo(_.track);break;}}),this.onAttemptToCreateSequence=()=>{this.openUpsell(pt.sequence);},this.openUpsell=_=>{let R=`script-story/${this.story.storyId}`;this.premiumPlanService.openPricingDialog(yi.PRO,R,R,_);},this.openClipExtractor=_=>{this.extractorTake=_,this.aiExtractorOpened=!0,this.hideVideoFeedback=!0;},this.openAutoShortsAgent=_=>I(this,null,function*(){let R=yield this.translateStoryService.getLanguagesMap(),re=_.feature?.find(jt=>R.has(jt.value))?.value,ce=_.video?.thumbnails||[],ge=ce[ce.length-1]?.url||"",ye={entityType:"storyVideo",entityId:this.story.storyId,subEntityId:_.video?.id,takeName:_.title||"",streams:_.video?.streams,status:"COMPLETE",createdTime:_.video?.created||new Date().toString(),duration:_.video?.duration||0,source:"bigvu",thumbnailUrl:ge,segmentationLang:re},vt=Vd.autoShorts();vt.forEach(jt=>{jt.id===La.importVideo&&(jt.data=jt.data||{},jt.data.videoSelected=ye,jt.data.shouldSkipTypingAnimation=!0);});let Ct=new id();Ct.onClose=this.dialogHelperService.close,Ct.onSubmit=()=>this.dialogHelperService.close(),Ct.agentType=zl.AUTO_SHORTS,Ct.states=La,Ct.flow=vt,Ct.storyId=this.story.storyId;let Ve=new We();Ve.disableClose=!0,Ve.panelClass="app-ai-agent-dialog",this.dialogHelperService.open(Ct,nd,Ve);}),this.openDeleteDialog=_=>{let R=_.title||`Take ${_.id}`;if(_.isComposerRow){let ge=Ho(_.composerStoryType);this.dialogHelperService.showUiConfirmationDialog({title:ge?"Delete WordPlay Project":"Delete Video Maker Project",msg:_.kind==="composerDraft"?ge?"Are you sure you want to delete the WordPlay project \""+R+"\"?":"Are you sure you want to delete the Video Maker project \""+R+"\"?":ge?"Are you sure you want to delete \""+R+"\"? If it is the project's last video, the WordPlay project is deleted with it.":"Are you sure you want to delete \""+R+"\"? If it is the project's last video, the Video Maker project is deleted with it.",confirmationText:"Ok",cancellationText:"Cancel",onSubmit:()=>this.onApproveDelete(_),onClose:()=>this.onCancelDelete(_)});return;}let re=_.video?.composerStories??[],ce=re.filter(ge=>ge.isDraft);if(_.status===ct.notLocal&&re.length>0){let ge="";re.length>ce.length&&(ge+=`<div class="take-delete-drafts-note">${"Video Maker videos created from this take will remain, but you won't be able to edit them in Video Maker anymore."}</div>`),ce.length>0&&(ge+=`<div class="take-delete-drafts-note">${"These Video Maker drafts will be deleted:"}</div>`,ge+=Ep(ce)),this.dialogHelperService.showUiConfirmationDialog({title:"Are you sure you want to delete \""+R+"\"?",msg:ge,confirmationText:"Delete",confirmButtonVariant:"half-filled-red",cancellationText:"Cancel",customClass:"take-delete-drafts-dialog",onSubmit:()=>this.onApproveDelete(_),onClose:()=>this.onCancelDelete(_)});return;}this.dialogHelperService.showUiConfirmationDialog({title:`Delete ${_.status===ct.local?"Local Take":"Video from Story"}`,msg:_.status===ct.local?`Are you sure you want to delete "${R}" from your local takes?`:`Are you sure you want to delete "${R}" from the story?`,confirmationText:"Ok",cancellationText:"Cancel",onSubmit:()=>this.onApproveDelete(_),onClose:()=>this.onCancelDelete(_)});},this.onApproveDelete=_=>{_.kind==="composerDraft"?this.deleteComposerDraft(_):_.status===ct.local?this.deleteLocalTake(_):this.deleteTake(_),this.dialogHelperService.close();},this.onCancelDelete=_=>{this.dialogHelperService.close(),_.status===ct.notLocal&&_.kind!=="composerDraft"&&this.sendEvent(this.eventsService.events.deleteTake.cancel,_);},this.reloadParentStory=()=>{this.storyTrackCommunicationService.setStoryReload(this.story.storyId);},this.deleteDraftChildren=_=>I(this,null,function*(){let R=_.video?.composerStories?.filter(ge=>ge.isDraft)??[];if(R.length===0)return!1;let ce=(yield Promise.allSettled(R.map(ge=>
8this.adminRequestsService.deletePresenterStory({storyId:ge.id,force:!1})))).filter(ge=>ge.status==="rejected");return ce.forEach(ge=>console.error(ge.reason)),ce.length>0&&this.notifier.error("Some Video Maker drafts could not be deleted"),this.reloadParentStory(),!0;}),this.deleteComposerDraft=_=>I(this,null,function*(){try{yield this.adminRequestsService.deletePresenterStory({storyId:_.composerStoryId,force:!1}),this.notifier.info("Video Maker project was deleted"),this.reloadParentStory();}catch(R){console.error(R),this.notifier.error(R?.responseJSON?.msg||"Failed to delete the Video Maker project");}}),this.deleteTake=(_,R=!1)=>I(this,null,function*(){let re=this.takeTrackList.indexOf(_),ce=this.takeTrackList.length===1&&re===0,ge={storyId:this.story.storyId,videoId:_.video.mediaId,force:R};if(ce){try{yield this.adminRequestsService.detachTake(ge),this.deleteTakeFromList(_),this.notifier.info("Video was deleted"),this.sendEvent(this.eventsService.events.deleteTake.confirm,_),this.logDeleteTake(_);let ye=yield this.deleteDraftChildren(_);_.kind==="composerVideo"&&!ye&&this.reloadParentStory();}catch(ye){console.error(ye);let vt=this.errorParseService.parseDeleteTakeErrors(ye.responseJSON.code,ye.responseJSON.msg);ye.responseJSON.code==="10006/0"?this.dialogHelperService.showUiConfirmationDialog({title:"Delete Take",msg:`${ye.responseJSON.msg}. Are you sure you want to delete the take?`,confirmationText:"Delete",cancellationText:"Cancel",onSubmit:()=>{this.deleteTake(_,!0),this.dialogHelperService.close();},onClose:()=>this.dialogHelperService.close()}):this.notifier.error(vt);}return;}re!==-1&&this.deleteTakeFromList(_);try{yield this.adminRequestsService.detachTake(ge),this.notifier.info("Video was deleted"),this.sendEvent(this.eventsService.events.deleteTake.confirm,_),this.logDeleteTake(_);let ye=yield this.deleteDraftChildren(_);_.kind==="composerVideo"&&!ye&&this.reloadParentStory();}catch(ye){console.error(ye),re!==-1&&this.storyTrackCommunicationService.setTakeRestore(_,re);let vt=this.errorParseService.parseDeleteTakeErrors(ye.responseJSON.code,ye.responseJSON.msg);ye.responseJSON.code==="10006/0"?this.dialogHelperService.showUiConfirmationDialog({title:"Delete Take",msg:`${ye.responseJSON.msg}. Are you sure you want to delete the take?`,confirmationText:"Delete",cancellationText:"Cancel",onSubmit:()=>{this.deleteTake(_,!0),this.dialogHelperService.close();},onClose:()=>this.dialogHelperService.close()}):this.notifier.error(vt);}}),this.deleteLocalTake=_=>I(this,null,function*(){let R=this.takeTrackList.indexOf(_);if(this.takeTrackList.length===1&&R===0){try{yield this.localTakeHelperService.delete(_.localTake.id),this.deleteTakeFromList(_),this.logDeleteTake(_);}catch(ce){console.error(ce),this.notifier.error("Failed to delete the local take");}return;}R!==-1&&this.deleteTakeFromList(_);try{yield this.localTakeHelperService.delete(_.localTake.id),this.logDeleteTake(_);}catch(ce){console.error(ce),R!==-1&&this.storyTrackCommunicationService.setTakeRestore(_,R),this.notifier.error("Failed to delete the local take");}}),this.logDeleteTake=_=>{this.eventsService.log(this.EVENT_SCRIPT.deleteTake,pe({type:_?.status===ct.local?"local":"cloud",storyId:this.story.storyId,takeId:_?.video?.mediaId||"",featuresApplied:Uo(_)},this.cpProjectAttrs()));},this.deleteTakeFromList=_=>{this.storyTrackCommunicationService.setTakeDeletion(_);},this.sendAddToSequence=(_,R,re)=>{let ce={take:_,source:R,addMethod:re};this.storyTrackCommunicationService.setSendTakeToSequence(ce);},this.onOpenMoreDialog=_=>{let R=new qs();R.take=_,R.story=this.story,R.isViewer=this.isViewer,R.onClose=this.dialogHelperService.close,R.onSubmit=this.onOpenMoreDialogApprove;let re=new We();re.panelClass="story-take-actions-dialog",this.dialogHelperService.open(R,Ap,re);},this.onOpenMoreDialogApprove=_=>{this.dialogHelperService.close(),this.applyActionOnTake(_,!0);},this.openRenameDialog=_=>{this.eventsService.log(this.EVENT_SCRIPT.takeRenameStart,pe({storyId:this.story.storyId,takeId:_.video?.mediaId,currentName:_.title||"",isDefault:!_.video?.takeName},this.cpProjectAttrs()));let R=new Kd();R.title="Rename Take",R.subtitle="Rename this take to keep your versions organized and easy to identify.",R.label="Take name",R.currentName=_.title||"",R.onClose=this.dialogHelperService.close,R.onSubmit=ce=>{let ge=ce?.trim();ge&&ge!==_.title&&this.storyTrackCommunicationService.setTakeChangeTitle({take:_,title:ge}),this.dialogHelperService.close();};let re=new We();re.panelClass="common-dialog",this.dialogHelperService.open(R,Qd,re);},this.onLocalTakeUpload=_=>I(this,null,function*(){this.storyTrackCommunicationService.setTakeToUpload(_);}),this.onThumbnailUpload=_=>{this.storyTrackCommunicationService.setTakeThumbnailToUpload(_);}
8,this.onReplaceBackground=_=>{this.storyHelperService.setStory(this.story),this.router.navigate(["background",this.story.storyId,_.video.mediaId]);},this.onStyleVideo=(_,R,re)=>{let ce=_.video.streams[_.video.thumbnails.length-1].url,ge="segment-duration",ye=new Tt();ye.type=ge,ye.header="Edit Take Duration",R&&re?(ye.leftSegment={index:0,time:0,duration:R},ye.mainSegment={index:1,time:R,duration:re-R,previewUrl:ce},ye.rightSegment={index:2,time:re,duration:_.video.duration-re}):(ye.leftSegment={index:0,time:0,duration:1},ye.mainSegment={index:1,time:1,duration:_.video.duration-2,previewUrl:ce},ye.rightSegment={index:2,time:_.video.duration-1,duration:1}),this.eventsService.log(this.EVENT_TRIM.wordtrim,{storyId:this.story.storyId,mediaId:_.video?.mediaId||"",duration:_.video.duration}),ye.onClose=Ct=>{this.onStyleVideoDiscard(Ct);},ye.onSubmit=Ct=>{this.onStyleVideoApply(_,Ct);};let vt=new We();vt.disableClose=!0,vt.panelClass="remove-mat-dialog-padding",this.dialogHelperService.open(ye,Rp,vt);},this.onStyleVideoDiscard=_=>{this.dialogHelperService.close(),this.eventsService.log(this.EVENT_TRIM.wordtrimCancel,{storyId:this.story.storyId,mediaId:_?.video?.mediaId||""});},this.onStyleVideoApply=(_,R)=>I(this,null,function*(){let{dialogData:re,method:ce}=R;this.dialogHelperService.close();let{rightSegment:ge,mainSegment:ye,leftSegment:vt}=re,Ct=Math.trunc(ye.time*1e3)/1e3,Ve=Math.trunc(ge.time*1e3)/1e3;if(Ve<=0){this.notifier.error("Please select a valid end point for your video trim");return;}if(Ct>=_.video.duration){this.notifier.error("The trim start time cannot be longer than the video itself");return;}if(ce==="trim"){let jt={storyId:this.story.storyId,groupId:_.video.groupId,videoId:_.video.mediaId,templateIds:[],options:{actions:[{type:"trim",value:{startTime:Ct*1e3,endTime:Ve*1e3}}]}};try{let nn=yield this.adminRequestsService.generateVideo(jt);this.storyTrackCommunicationService.setTakeToTrim({take:_,video:nn,start:Ct,end:Ve,method:ce});}catch(nn){if(console.error(nn),this.creditsService.handleCreditError(nn))return;this.notifier.error(nn.responseJSON.msg);}}else this.storyTrackCommunicationService.setTakeToTrim({take:_,video:null,start:ye.time,end:ge.time,method:ce});}),this.onRetryFailedTake=_=>I(this,null,function*(){if(!_?.failedEventId){this.notifier.error("Cannot retry \u2014 missing event reference. Please refresh and try again.");return;}try{yield this.adminRequestsService.retryVideoProcess(_.failedEventId,void 0),_.processFailed=!1,_.failedEventId=void 0,this.notifier.info("Retrying video processing\u2026");}catch(R){let re=R?.responseJSON?.msg||"Failed to retry. Please try again.";this.notifier.error(re);}}),this.onBoostAudioDialog=_=>{this.dialogHelperService.close();let R=_.feature.map(ge=>ge.value).includes(Oe.audioNorm),re=new oa();re.featureUsed=R,re.onClose=this.closeBoostAudio,re.onSubmit=()=>this.boostAudio(_);let ce=new We();ce.panelClass="boost-audio-dialog-panel",this.dialogHelperService.open(re,hh,ce);},this.closeBoostAudio=()=>{this.dialogHelperService.close();},this.boostAudio=_=>I(this,null,function*(){if(yield this.planHelperService.isFreeByCurrentPlan()){this.openUpsell(pt.boost_audio);return;}try{this.eventsService.log(this.EVENT_SCRIPT.deskScriptTakeBoostAudio,{storyId:this.story.storyId,takeId:_.video.mediaId});let R={storyId:this.story.storyId,groupId:_.video.groupId,sourceVideoId:_.video.mediaId,templateIds:[],options:{actions:[{type:"audioNorm",value:!0}]}},re=yield this.adminRequestsService.generateVideo(R);this.storyTrackCommunicationService.setTakeAudioBoost({take:_,video:re});}catch(R){if(console.error(R),this.creditsService.handleCreditError(R))return;this.notifier.error(R.responseJSON.msg);}}),this.eyeFixDialog=_=>I(this,null,function*(){this.eventsService.log(this.EVENT_SCRIPT.deskScriptTakeEyeFixScreen,{storyId:this.story.storyId,takeId:_.video.mediaId});let R=_.feature.map(vt=>vt.value).includes(Oe.eyeContact),re=!(yield this.planHelperService.hasPremiumPlan()),ce=`script-story/${this.story.storyId}`;this.dialogHelperService.close();let ge=new ra();ge.isFree=re,ge.featureUsed=R,ge.onClose=()=>this.eyeFixClose(re,R),ge.onStartProcess=()=>this.eyeFix(_),ge.onSubmit=re?()=>this.openUpsell(pt.eye_contact):this.dialogHelperService.close;let ye=new We();ye.panelClass="eye-fix-dialog-panel",this.dialogHelperService.open(ge,mh,ye);}),this.eyeFixClose=(_,R)=>{this.dialogHelperService.close();},this.eyeFix=_=>I(this,null,function*(){try{this.eventsService.log(this.EVENT_SCRIPT.deskScriptTakeEyeFixStart,{storyId:this.story.storyId,takeId:_.video.mediaId});let R={storyId:this.story.storyId,groupId:_.video.groupId,sourceVideoId:_.video.mediaId,templateIds:[],options:{actions:[{type:"videoEffects",value:{eyeContact:!0}}]}},re=yield this.adminRequestsService.generateVideo(R);this.storyTrackCommunicationService.setEyeFix({take:_,video:re});}catch(R){if(console.error(R),this.creditsService.handleCreditError(R))return;this.notifier.error(R.responseJSON.msg);}}),this.onOpenVideoMaker=_=>{let R=this.story.captions.some(re=>re.groupId===_.video.groupId&&re.status===2)?gr.videoMakerDone:gr.videoMakerStart;this.onTranslateGenerate(_,"maker",R);},this.onOpenVideoMakerAlpha=_=>{this.onTranslateGenerate(_,"maker",gr.videoMakerV2);},this.onTranslateGenerate=(_,R,re)=>{let ce=new Dd();ce.story=this.story,ce.take=_,ce.mode=re,ce.origin=R,ce.callback=()=>this.storyTrackCommunicationService.setTakeToGenerate(_),ce.onClose=this.dialogHelperService.close,ce.onSubmit=this.dialogHelperService.close;let ge=new We();ge.panelClass="translate-generate-subtitles-dialog",this.dialogHelperService.open(ce,Ld,ge);},this.onOpenTranslateSubtitlesDialog=_=>{let R=new Ed();R.story=this.story,R.take=_,R.origin="captions",R.callback=()=>this.storyTrackCommunicationService.setTakeToGenerate(_),R.onClose=this.dialogHelperService.close,R.onSubmit=this.dialogHelperService.close;let re=new We();re.panelClass="translate-subtitles-dialog",this.dialogHelperService.open(R,Ad,re);},this.onOpenDubVideoDialog=_=>{let R=new Qs();R.story=this.story,R.take=_,R.origin="takes",R.callback=(ce,ge)=>{let ye=[];if(ce?.story?.videos){let vt=new Set((this.story.videos??[]).map(Ct=>Ct.id));ye=ce.story.videos.filter(Ct=>!vt.has(Ct.id));}else ce?.storyVideo?ye=[ce.storyVideo]:Array.isArray(ce)&&(ye=ce);ye.length>0?this.storyTrackCommunicationService.setDubVideo({take:_,videos:ye,targetLanguages:ge}):this.storyTrackCommunicationService.setTakeToGenerate(_);},R.onClose=this.dialogHelperService.close,R.onSubmit=this.dialogHelperService.close;let re=new We();re.panelClass="dub-video-dialog",this.dialogHelperService.open(R,Np,re);},this.onDownloadLocalTake=(_,R)=>I(this,null,function*(){this.storyTrackCommunicationService.setTakeToDownload(R,_);}),this.onDownloadRealTake=_=>{let R=document.createElement("a"),re=_.video.streams[0].url,ce=this.story.headline.replace(/[^\w\d]/g,"_");R.href=re.replace(fn.globals.cloudfrontAddress,fn.globals.downloadAddress)+"?filename="+ce+".mp4",R.download=ce,R.click();},this.onEmbed=_=>{let R=fn.globals.shareLink+this.story.storyId+"/"+_.video.mediaId;window.open(R,"_blank");},this.onAddToUploads=_=>I(this,null,function*(){let R,re,ce,ge;this.story&&_&&_.video.streams&&_.video.streams.length>0?(R=_.video.streams.sort(function(ye,vt){return vt.height-ye.height;}),re=R[0],ce="",this.story.presenters&&this.story.presenters.length>0&&(ce=this.story.presenters[0].fullName||ce),ge={fileType:"video",url:re.url,level:"desk",deskId:this.story.deskId,title:this.story.headline,source:["Taken by: "+ce],notes:"Take created at: "+_.video.created},this.notifier.info("Uploading take to shared bin. It may take a while"),this.adminRequestsService.attachAsset(ge).then(ye=>{let vt=this.uploadService.waitForUploadStatus(ye,()=>{},()=>{},"The take was uploaded successfully","Could not upload this take");this.eventListeners.push(vt);}).catch(ye=>{ye?this.notifier.error(ye.msg):this.notifier.error("Error: Could not upload this take!");})):this.notifier.error("Error: No videos found for this take!");}),this.onMessageVideoPage=_=>{if(_.video){let R={entityType:"storyVideo",entityId:this.story?.storyId,subEntityId:_.video.mediaId,takeN
8ame:_.title||"",thumbnailUrl:_.video.thumbnails?_.video.thumbnails[_.video.thumbnails.length-1]?.url:"",streams:_.video.streams,createdTime:_.video.created,status:_.video.status.toString(),segmentationLang:this.story.segmentation?.filter(re=>re.groupId===_.video.groupId)?.[0]?.sourceLocale,duration:_.video.duration,source:"bigvu",segmentation:this.story.segmentation?.filter(re=>re.groupId===_.video.groupId)?.[0]};this.pageHelperService.openPagesAgentDialog(R,"boards");}else this.notifier.error("No video available");},this.sendToPages=(_,R)=>{R?this.router.navigate(["pages","create",this.story.id,_.video.mediaId,R]):this.router.navigate(["pages","create",this.story.storyId,_.video.mediaId]);},this.onPostToSocial=_=>{this.sendEvent(this.EVENT_SCRIPT.export,_,void 0,this.cpProjectAttrs()),this.router.navigate(["export-video",this.story.storyId,_.video.mediaId]);},this.onWordTrim=(_,R)=>{if(!_.video||!_.video.mediaId){this.notifier.error("No video available for word trim");return;}if(_.video.status!==2){this.notifier.error("Video is still processing. Please wait.");return;}let re=R||this.story,ce=re.segmentation?.find(ge=>ge.groupId===_.video.groupId);if(!ce||!ce.url){this.openLanguageSelectDialog(_);return;}this.router.navigate(["wordtrim",re.storyId,_.video.mediaId],{state:{story:re,take:_,video:_.video,segmentation:ce}});},this.onCopyThumbnail=_=>{let R=`https://${fn.shareLinkHost}/${this.story.storyId}/${_.video.mediaId}`,re=_.video.thumbnails.length>0?this.getBestResSource(_.video.thumbnails).url:null;try{if(!re)throw"No thumbnail";let ce,ge,ye=document.getElementById("thumbnail-to-copy");ye.innerHTML=Dp(re,R),document.body.createTextRange?((ce=document.body.createTextRange()).moveToElementText(ye),ce.select()):window.getSelection&&(ge=window.getSelection(),(ce=document.createRange()).selectNodeContents(ye),ge.removeAllRanges(),ge.addRange(ce)),document.execCommand("copy"),window.getSelection().removeAllRanges(),ye.innerHTML="",this.notifier.success("Link has been copied");}catch{this.notifier.error("Cant copy to clipboard! Please try again");}},this.onBigvuInspireVideo=_=>I(this,null,function*(){try{let R=yield this.localeService.getLocale();yield this.adminRequestsService.postToVideoFeed("story",this.story.storyId,R[0],_.video.mediaId),this.notifier.info("Successfully posted to BIGVU Inspire");}catch(R){this.notifier.error("Failed post to BIGVU Inspire"),console.error(R);}}),this.onActiveTrackChange=_=>{this.currentActiveTrack=_,this.storyTrackCommunicationService.setPlayerTrack(_);},this.hasSlotMessage=()=>!!this.slotsStore.messageFor(this.currentActiveTrack?.video?.id),this.activeTakeId=()=>this.currentActiveTrack?.video?.id,this.selectTakeSlot=()=>this.slotsStore.takeSelectionSlot(),this.isDraftActive=()=>this.currentActiveTrack?.kind==="composerDraft",this.showSelectTakeBanner=()=>{let _=this.selectTakeSlot();return!!_&&!!this.activeTakeId()&&!this.slotActionRunner.isBusy(_.id);},this.onSelectTakeForEditing=()=>I(this,null,function*(){let _=this.selectTakeSlot(),R=this.activeTakeId();!_||!R||(this.cpAnalytics.createSelectStart(this.cpAnalytics.slotPayload({item:_})),this.logTakeScreenClick(this.currentActiveTrack,"workflow-take-select"),this.pendingBusyLabel.set("Handing off for editing\u2026"),yield this.slotActionRunner.selectTakeToEdit({item:_,takeId:R}));}),this.editedTakeSlot=()=>this.slotsStore.editedTakeSelectionSlot(),this.showEditedTakeBanner=()=>{let _=this.editedTakeSlot();return!!_&&!!this.activeTakeId()&&!this.slotActionRunner.isBusy(_.id);},this.cpBusy=()=>this.slotActionRunner.isAnyBusy(),this.pendingBusyLabel=Qe(null),this.cpBusyLabel=Br(()=>this.slotActionRunner.isAnyBusy()?this.pendingBusyLabel():null),this.clearBusyLabel=qc(()=>{this.slotActionRunner.isAnyBusy()||this.pendingBusyLabel.set(null);},{allowSignalWrites:!0}),this.editedTakeGoesToReview=()=>this.slotsStore.editedTakeGoesToReview(this.editedTakeSlot()),this.bannerVariant=()=>this.editedTakeGoesToReview()?"review":"publish",this.onSelectEditedTake=()=>I(this,null,function*(){let _=this.editedTakeSlot(),R=this.activeTakeId(),re=this.story?.storyId;!_||!R||!re||(this.cpAnalytics.createSelectStart(this.cpAnalytics.slotPayload({item:_})),this.logTakeScreenClick(this.currentActiveTrack,"workflow-take-select"),this.pendingBusyLabel.set(this.editedTakeGoesToReview()?"Sending for review\u2026":"Taking you to publish\u2026"),yield this.slotActionRunner.selectEditedTake({item:_,takeId:R,onApplied:ce=>{this.slotsStore.editedTakeGoesToReview(ce)||this.goToPublishUnlessTheUserLeft(re,R);}}));}),this.onActiveExtractorClose=()=>{this.aiExtractorOpened=!1,this.extractorTake=void 0,this.hideVideoFeedback=!1;},this.sendEvent=(_,R,re=void 0,ce=void 0)=>{let ge=pe({headline:this.story.headline,storyId:this.story.storyId,captions:re},ce);
8if(R){let ye=R.status==ct.local?R.localTake:R.video;ge.mediaId=ye.mediaId||"",ge.created=ye.created,R.status===ct.notLocal&&R.video?.status===2&&R.video?.streams[0]?.url&&(ge.url=R.video.streams[0].url);}this.eventsService.log(_,ge);},this.getEventName=(_,R)=>R?.video?.entityType==="sequence"?this.eventsService.events.sequence[_]:this.eventsService.events.script[_],this.sendTakeClickEvent=(_,R,re)=>{let ce=hd(re);ce&&this.logTakeScreenClick(R,ce);},this.logTakeScreenClick=(_,R)=>{this.eventsService.log(this.EVENT_SCRIPT.takeScreenClick,pe({takeId:_?.video?.mediaId||"",storyId:this.story.storyId,featuresApplied:Uo(_),isLocal:_?.status===ct.local,button:R},this.cpProjectAttrs()));},this.cpProjectAttrs=()=>this.cpProjectAnalytics.attrs({story:this.story,slots:this.slotsStore.slots()}),this.openLanguageSelectDialog=_=>{let R=new ca();R.titleText="Select Language",R.instructionText="Choose the language for your content",R.tooltipText="Select a language to apply to your video",R.actionText="Apply",R.story=this.story,R.take=_,R.onClose=()=>this.dialogHelperService.close(),R.onSubmit=ce=>{this.dialogHelperService.close(),this.onWordTrim(_,ce);};let re=new We();re.panelClass="language-select-dialog-panel",re.disableClose=!0,this.dialogHelperService.open(R,Ch,re);},this.isLoading=!0,this.aiExtractorOpened=!1;}ngOnInit(){this.setEventListeners();}ngOnDestroy(){this.eventListeners.forEach(e=>e.unsubscribe());}goToPublishUnlessTheUserLeft(e,n){let t=this.router.createUrlTree([ai,e,ft.takes]);this.router.isActive(t,{paths:"subset",queryParams:"subset",fragment:"ignored",matrixParams:"ignored"})&&this.router.navigate(Rd(e,n));}getBestResSource(e){let n=0,t=0;for(let o=0;o<e.length;o++)e[o].height>t&&(n=o,t=e[o].height);return e[n];}static{this.ɵfac=function(n){return new(n||i)(d(Ue),d(xt),d(Ro),d(ki),d(Kt),d($t),d(Io),d(bi),d(Zt),d(Qi),d(Mo),d(ko),d(jn),d(ei),d(ts),d(He),d(Pe),d(zt),d(hi),d(Rn),d(_s),d(Cl),d(Ge),d(wi),d(No),d(Wd),d(Vt),d(Gi),d(na));};}static{this.ɵcmp=G({type:i,selectors:[["story-take-v2"]],standalone:!0,features:[q],decls:20,vars:18,consts:[["loading",""],[1,"takes-story-v2-container",3,"ngClass"],[1,"left-section",3,"ngClass"],[1,"video-script"],["class","cp-select-take-banner","variant","edit",3,"select",4,"ngIf"],["class","cp-select-take-banner",3,"variant","select",4,"ngIf"],["class","cp-slot-busy",4,"ngIf"],["class","cp-slot-message","scope","take",3,"activeTakeId","activeTakeMediaId","currentTime",4,"ngIf"],["class","video-feedback",3,"take","storyId",4,"ngIf"],["class","script-part",4,"ngIf"],[1,"middle-section"],[1,"list"],[3,"newActiveTrack",4,"ngIf","ngIfElse"],[1,"right-section",3,"ngClass"],[3,"attemptToFreeCreate"],["id","thumbnail-to-copy"],[3,"name"],["variant","edit",1,"cp-select-take-banner",3,"select"],[1,"cp-select-take-banner",3,"select","variant"],[1,"cp-slot-busy"],[3,"lottieWidth","lottieHeight"],[1,"cp-slot-busy__label"],["scope","take",1,"cp-slot-message",3,"activeTakeId","activeTakeMediaId","currentTime"],[1,"video-feedback",3,"take","storyId"],[1,"script-part"],[3,"closeExtractor","story","take"],[3,"newActiveTrack"],[1,"shimmer-parent"]],template:function(n,t){if(n&1){let o=U();r(0,"div",1)(1,"div",2)(2,"div",3),b(3,"script-story-player"),M(4,gf,1,0,"app-cp-select-take-banner",4)(5,ff,1,1,"app-cp-select-take-banner",5)(6,vf,4,3,"div",6)(7,_f,1,3,"app-cp-slot-message",7)(8,Cf,1,2,"app-video-feedback",8)(9,bf,2,2,"div",9),s()(),r(10,"div",10)(11,"div",11),M(12,Sf,1,0,"take-track-list",12),s()(),r(13,"div",13)(14,"app-script-sequence",14),S("attemptToFreeCreate",function(){return T(o),P(t.onAttemptToCreateSequence());}),s()(),b(15,"div",15),r(16,"ngx-spinner",16),b(17,"lottie-loader"),s()(),M(18,xf,2,0,"ng-template",null,0,Re);}if(n&2){let o=Be(19);c("ngClass",ue(12,hf,t.isAnonymous)),a(),c("ngClass",ue(14,mf,t.isAnonymous)),a(3),c("ngIf",t.showSelectTakeBanner()),a(),c("ngIf",t.showEditedTakeBanner()),a(),c("ngIf",t.cpBusyLabel()),a(),c("ngIf",!t.showEditedTakeBanner()),a(),c("ngIf",t.currentActiveTrack&&!t.isDraftActive()&&!t.hideVideoFeedback&&!t.cpBusy()&&!t.hasSlotMessage()&&!t.showSelectTakeBanner()&&!t.showEditedTakeBanner()),a(),c("ngIf",t.aiExtractorOpened),a(3),c("ngIf",!t.isLoading)("ngIfElse",o),a(),c("ngClass",ue(16,uf,t.isAnonymous)),a(3),c("name",t.SPINNER_ID);}},dependencies:[ph,xe,we,_e,ih,Kp,Si,dn,Ri,Fp,fh,vh,Os,jd],styles:['@charset "UTF-8";.takes-story-v2-container[_ngcontent-%COMP%]{width:100%;height:100vh;display:flex;align-items:flex-start;overflow:hidden;padding:0;background-color:#7b8db12e}.takes-story-v2-container.anonymous-takes-story-v2-container[_ngcontent-%COMP%]{justify-content:flex-start}.takes-story-v2-container[_ngcontent-%COMP%] .left-section[_ngcontent-%COMP%], .takes-story-v2-container[_ngcontent-%COMP%] .middle-section[_ngcontent-%COMP%], .takes-story-v2-container[_ngcontent-%COMP%] .right-section[_ngcontent-%COMP%]{flex:1 1 0;min-width:0;height:100vh;padding:24px;overflow:hidden;box-sizing:border-box}.takes-story-v2-container[_ngcontent-%COMP%] .left-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:flex-start;align-items:center;background-color:#fff}.takes-story-v2-container[_ngcontent-%COMP%] .left-section.anonymous-left-section[_ngcontent-%COMP%]{width:440px;margin-left:510px;align-items:center!important}.takes-story-v2-container[_ngcontent-%COMP%] .left-section.anonymous-left-section[_ngcontent-%COMP%] .video-script[_ngcontent-%COMP%]{height:auto}.takes-story-v2-container[_ngcontent-%COMP%] .left-section[_ngcontent-%COMP%] .video-script[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;gap:16px}.takes-story-v2-container[_ngcontent-%COMP%] .left-section[_ngcontent-%COMP%] .video-script[_ngcontent-%COMP%] .script-part[_ngcontent-%COMP%]{width:100%}.takes-story-v2-container[_ngcontent-%COMP%] .middle-section[_ngcontent-%COMP%]{background-color:#fff}.takes-story-v2-container[_ngcontent-%COMP%] .middle-section[_ngcontent-%COMP%] .list[_ngcontent-%COMP%]{width:100%;height:calc(100vh - 48px);overflow-y:scroll}.takes-story-v2-container[_ngcontent-%COMP%] .right-section.anonymous-right-section[_ngcontent-%COMP%]{max-width:400px}.video-feedback[_ngcontent-%COMP%], .cp-slot-message[_ngcontent-%COMP%], .cp-select-take-banner[_ngcontent-%COMP%], .cp-slot-busy[_ngcontent-%COMP%]{width:100%}.cp-slot-busy[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:8px;box-sizing:border-box;padding:12px}.cp-slot-busy__label[_ngcontent-%COMP%]{color:#6b7280;font-size:13px;font-weight:500;line-height:1.4}.shimmer-parent[_ngcontent-%COMP%]{width:100%;height:100%} .anonymous-right-section .script-sequence-container{width:450px!important} story-take-v2 header-blue-light .cta-button-container{width:0!important}@media only screen and (max-width: 1340px){.takes-story-v2-container[_ngcontent-%COMP%] .left-section[_ngcontent-%COMP%]{padding:20px 8px;align-items:center}.takes-story-v2-container[_ngcontent-%COMP%] .left-section[_ngcontent-%COMP%] .video-script[_ngcontent-%COMP%]{width:100%;height:fit-content}.takes-story-v2-container[_ngcontent-%COMP%] .middle-section[_ngcontent-%COMP%]{padding:20px 8px}.takes-story-v2-container[_ngcontent-%COMP%] .middle-section[_ngcontent-%COMP%] .list[_ngcontent-%COMP%]{height:calc(100vh - 60px)}}@media only screen and (max-width: 1024px){.takes-story-v2-container[_ngcontent-%COMP%]{flex-wrap:wrap}.takes-story-v2-container[_ngcontent-%COMP%] .left-section[_ngcontent-%COMP%], .takes-story-v2-container[_ngcontent-%COMP%] .middle-section[_ngcontent-%COMP%]{flex:unset;width:100%;height:auto}.takes-story-v2-container[_ngcontent-%COMP%] .left-section[_ngcontent-%COMP%] .video-script[_ngcontent-%COMP%]{max-width:363px}.takes-story-v2-container[_ngcontent-%COMP%] .middle-section[_ngcontent-%COMP%] .list[_ngcontent-%COMP%]{width:100%;height:calc(100vh - 385px)}.takes-story-v2-container[_ngcontent-%COMP%] .right-section[_ngcontent-%COMP%]{display:none}}']});}}return i;})();J();J();at();Eo();so();Mi();ae();Wr();ns();ln();qt();var xh=(()=>{class i extends Yd{constructor(e,n,t,o,h,k,f,m,v,V,te,$,H){super(e),this.dialogHelperService=e,this.userHelperService=n,this.spinnerService=t,this.adminRequestsService=o,this.location=h,this.titleService=k,this.uiActionService=f,this.route=m,this.styleVideoService=v,this.videoSlidesService=V,this.slideListDataService=te,this.navigationHelperService=$,this.notifier=H,this.setShowHeadlineTooltip=j=>{this.showHeadlineTooltip=j;},this.updateTrackList=j=>{this.trackList=j,this.updatePreviewerSlides(j),this.setHasChanges(!0,this.getHeadline()!=="",this.isExist?this.updateCallback:this.creationCallback),this.slideListDataService.setTrackList(j);},this.setAspectRatioChangeEventListener=()=>{this.eventListeners.push(this.styleVideoService.aspectRatioStyle$.subscribe(j=>this.setAspectRatio(j)));},this.setAspectRatio=j=>{this.selectedAspectRatio=j;},this.updateAspectRatioOnStyleMenu=j=>{j&&this.styleVideoService.aspectRatioStyle$.next(j);},this.setTemplates=(j,F)=>I(this,null,function*(){yield this.slideListDataService.setTemplates(j,F);}),this.setTemplatesFromMetadata=j=>{this.slideListDataService.setTemplatesFromMetadata(j);},this.getIdFromRoute=()=>
8{let F=this.route.snapshot.paramMap.get("id");return F&&this.setIsExist(!0),F;},this.setCreationCallback=j=>{this.creationCallback=j;},this.setUpdateCallback=j=>{this.updateCallback=j;},this.setIsExist=j=>{this.isExist=j;},this.onConfirmation=()=>I(this,null,function*(){if(!this.headline){this.dialogHelperService.close(),this.showMissingHeadlineNotification();return;}try{this.dialogHelperService.close(),yield(this.isExist?this.executeUpdateCallbacks:this.creationCallback)(),this.confirm();}catch(j){this.notifier.error(j.responseJSON.msg);}}),this.setAutosaveTimer=(j,F=30)=>{this.isCallbackRegistered(j)||this.updateCallbacksQueue.push(j),this.autosaveTimer||(this.autosaveTimer=setTimeout(()=>{this.savingInfo={isSaving:!0,successfullySaved:!1},this.executeUpdateCallbacks();},F*1e3));},this.clearAutosaveTimer=()=>{clearTimeout(this.autosaveTimer),this.autosaveTimer=null;},this.isCallbackRegistered=j=>this.updateCallbacksQueue.indexOf(j)!==-1,this.executeUpdateCallbacks=()=>I(this,null,function*(){yield Promise.all(this.updateCallbacksQueue.map(j=>I(this,null,function*(){yield j();})));}),this.clearUpdateCallbacksQueue=()=>{this.updateCallbacksQueue.length=0;},this.getCurrentUserDetails=()=>I(this,null,function*(){try{this.spinnerService.spin("video-edit-screen"),this.currentUser=yield this.userHelperService.getUserDetails();}catch{this.notifier.error("Failed to load user data. Please try again");}finally{this.spinnerService.stop("video-edit-screen");}}),this.updatePreviewerSlides=j=>{let F=this.slideListDataService.getMediaSlides(j);this.videoSlidesService.slidesArraySubject$.next(F);},this.onHeadlineChange=j=>{this.setHeadline(j),this.setHasChanges(!0,this.getHeadline()!=="",this.isExist?this.updateCallback:this.creationCallback),console.warn("onHeadlineChange ",this.hasChanges);},this.setHasChanges=(j,F=!1,Z)=>{j?(this.hasChanges=!0,this.savingInfo={isSaving:!1,successfullySaved:!1},F&&Z?this.setAutosaveTimer(Z):(this.clearAutosaveTimer(),this.clearUpdateCallbacksQueue())):(this.hasChanges=!1,this.clearAutosaveTimer(),this.clearUpdateCallbacksQueue(),this.savingInfo={isSaving:!1,successfullySaved:!0});},this.replaceUrl=(j,F)=>{this.location.replaceState(j),F&&this.titleService.setTitle(F);},this.triggerUiAction=(j,F)=>{this.uiActionService.triggerAction(j,F);},this.showMissingHeadlineNotification=()=>{this.notifier.clearAll(),this.notifier.error("Headline is mandatory. Please insert one before saving");},this.setVersion=j=>{this.version=j;},this.getVersion=()=>this.version||0,this.setHeadline=j=>{this.headline=j;},this.getHeadline=()=>this.headline,this.clearTrackList=()=>{this.trackList&&(this.trackList.length=0);},this.hasTracks=()=>this.trackList&&this.trackList.length>0,this.headline="",this.savingInfo={isSaving:!1,successfullySaved:!1},this.eventListeners=[],this.updateCallbacksQueue=[],this.setAspectRatioChangeEventListener();}ngOnInit(){return I(this,null,function*(){yield this.getCurrentUserDetails();});}onPageRefresh(e){this.hasChanges&&(e.returnValue="");}ngOnDestroy(){this.eventListeners.forEach(e=>e.unsubscribe()),this.eventListeners=[],this.clearAutosaveTimer(),this.clearTrackList(),this.navigationHelperService.setShownBar(Je.NONE);}static{this.ɵfac=function(n){return new(n||i)(d(Ue),d(zi),d(ki),d(xt),d(ko),d(zr),d(jn),d(Io),d(Qi),d($t),d(Zt),d(ei),d(Ge));};}static{this.ɵdir=Li({type:i,hostBindings:function(n,t){n&1&&S("beforeunload",function(h){return t.onPageRefresh(h);},!1,Dr);},features:[Ae]});}}return i;})();ln();ae();var tr=Mr(Vm());Ln();Bt();Ln();no();ro();Nn();var Yn=class{constructor(u,e,n,t,o,h){this.storyTrackCommunicationService=e,this.anonymousUserService=n,this.portableRegisterService=t,this.eventsService=o,this.premiumPlanService=h,this.eventListeners=[],this.hasAIPlan=!1,this.remainingCredits=0,this.totalCredits=0,this.tooltipText="",this.upgradePlanImg=Sd,this.setCurrentResultIndex=(k,f=!1)=>{(this.currentResultIndex!=k||f)&&(this.currentResultIndex=k,this.textToCopy="",this.currentResultIndex>-1&&setTimeout(()=>{this.addCopyTextEventListener();},1e3));},this.addCopyTextEventListener=()=>{document.getElementsByClassName(this.className)[0]&&document.getElementsByClassName(this.className)[0].addEventListener("mouseup",k=>{window.getSelection().toString().length&&(this.textToCopy=window.getSelection().toString());});},this.pastResultToScript=k=>{let f;return this.textToCopy?(f=this.textToCopy,this.textToCopy=""):f=this.generatedText[k].description,f;},this.dragStarted=()=>{this.isDragging=!0;},this.dragEnded=()=>{this.isDragging=!1;},this.onPremiumFeatureClick=(k,f=!1,m=null)=>I(this,null,function*(){(yield this.anonymousUserService.getAnonymousUser())?this.portableRegisterService.openPortableRegisterDialog():this.openUppsell(k,f,m);}),this.openUppsell=(k,f,m=null)=>{let v=m||(k?"brand-voice":"writer-ai-sidebar"),V=`script-story/${this.story.storyId}`;this.premiumPlanService.openPricingDialog(yi.PRO,V,V,pt.ai);},this.className=u,this.generatedText=[];}};Cn();Ni();vi();ae();J();var yf=i=>({selectable:i}),kf=i=>({selected:i});function wf(i,u){if(i&1&&b(0,"img",4),i&2){let e=p();c("src",e.noteData.photo,Ie);}}var yh=(()=>{class i{constructor(){this.selectMode=!1;}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["whiteboard-note"]],inputs:{noteData:"noteData",selectMode:"selectMode"},standalone:!0,features:[q],decls:8,vars:9,consts:[[1,"whiteboard-note-container",3,"ngClass"],[1,"title"],[1,"asset-select-tag",3,"ngClass"],["class","image-show","alt","image",3,"src",4,"ngIf"],["alt","image",1,"image-show",3,"src"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"header")(2,"div",1),y(3),s(),r(4,"div",2),M(5,wf,1,1,"img",3),s()(),r(6,"main"),y(7),s()()),n&2&&(c("ngClass",ue(5,yf,t.selectMode)),a(3),de(t.
8noteData.headline),a(),c("ngClass",ue(7,kf,t.selectMode&&t.noteData.selected)),a(),c("ngIf",!t.selectMode),a(2),se(" ",t.noteData.body," "));},dependencies:[we,_e],styles:[".whiteboard-note-container[_ngcontent-%COMP%]{width:100%}.whiteboard-note-container[_ngcontent-%COMP%] header[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between}.whiteboard-note-container[_ngcontent-%COMP%] header[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{font-family:Inter-Bold;font-style:normal;font-weight:700;font-size:14px;line-height:20px;color:#253658;white-space:break-spaces;overflow-wrap:anywhere}.whiteboard-note-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%]{width:100%;font-weight:400;font-size:14px;line-height:140%;color:#253658;white-space:pre-line;overflow-wrap:anywhere}.whiteboard-note-container[_ngcontent-%COMP%] .asset-select-tag[_ngcontent-%COMP%]{position:relative;width:26px;height:26px;min-width:26px;border:1px solid #00ABFE;background:#fff;border-radius:20px}.whiteboard-note-container[_ngcontent-%COMP%] .image-show[_ngcontent-%COMP%]{width:24px;height:24px;border-radius:50%;object-fit:cover}.whiteboard-note-container[_ngcontent-%COMP%] .selected[_ngcontent-%COMP%]{background-image:url(/img/mediaAssets/selected-icon.svg);background-repeat:no-repeat;object-fit:contain;display:inline-block;border:none!important}.selectable[_ngcontent-%COMP%]{cursor:pointer}"]});}}return i;})();lr();ae();J();no();at();so();Mi();bn();qt();oo();ao();ht();Bn();vi();Ni();var Tf=["resultDiv"],Pf=i=>({"ai-sidebar-title-red":i}),Of=(i,u,e)=>({"ai-result-wrapper-active-whiteboard":i,fade:u,editing:e}),If=i=>({hide:i}),Mf=i=>({disabled:i});function Ef(i,u){if(i&1){let e=U();r(0,"span",13),S("click",function(){T(e);let t=p();return P(t.closeSidebar());}),r(1,"button"),b(2,"img",14),s()();}}function Af(i,u){if(i&1){let e=U();r(0,"div",15)(1,"div",16)(2,"div",17),y(3,"Headline of text"),s(),r(4,"div",18),b(5,"text-input",19),s()(),r(6,"div",16)(7,"div",17),y(8,"Text"),s(),r(9,"div",20),S("drop",function(t){T(e);let o=p();return P(o.onScriptDrop(t));}),b(10,"text-area-input",21)(11,"img",22),s()()();}if(i&2){let e=p();a(5),c("readonly",e.isLoading)("inputFormControl",e.headlineForm)("placeholder","Enter Headline"),a(4),c("dragOverClass","ai-droppable-class"),a(),c("hidden",e.isDragging)("readonly",e.isLoading)("inputFormControl",e.bodyForm)("width",346)("height",109)("showValidationErrors",!(e.bodyForm!=null&&e.bodyForm.pristine))("placeholder","Enter text..."),a(),c("src",e.dropImg,Ie)("hidden",!e.isDragging);}}function Df(i,u){if(i&1){let e=U();r(0,"button",27),S("click",function(){let t=T(e).$implicit,o=p(),h=o.$implicit,k=o.index,f=p();return P(f.onResultBtnClick(t.value,h,k));}),b(1,"i",28,1),s();}if(i&2){let e=u.$implicit;a(),gt(e.style),c("matTooltipPosition","above")("matTooltip",e==null?null:e.name);}}function Lf(i,u){if(i&1){let e=U();r(0,"div",23)(1,"whiteboard-note",24),S("click",function(){let t=T(e),o=t.$implicit,h=t.index,k=p();return P(k.onSelectNote(o,h));}),s(),r(2,"div",25),M(3,Df,3,4,"button",26),s()();}if(i&2){let e=u.$implicit,n=u.index,t=p();c("hidden",e.hidden)("ngClass",Fr(6,Of,t.mode!=t.selectMode&&n==t.currentResultIndex,t.isDeleting&&n==t.currentResultIndex,t.isEditing)),a(),c("selectMode",t.mode===t.selectMode)("noteData",e),a(),c("ngClass",ue(10,If,t.isLoading||n!=t.currentResultIndex||t.mode==t.selectMode)),a(),c("ngForOf",t.resultBtns);}}function Vf(i,u){if(i&1){let e=U();r(0,"button",29),S("click",function(){let t=T(e).$implicit,o=p();return P(o.onButtonClick(t));}),y(1),s();}if(i&2){let e=u.$implicit,n=p();gt(e.style),c("ngClass",ue(5,Mf,n.isLoading||n.mode==n.createMode&&e.value==4&&((n.headlineForm==null?null:n.headlineForm.invali
8d)||(n.bodyForm==null?null:n.bodyForm.invalid))||n.mode==n.viewMode&&e.value==0&&(n.notes==null?null:n.notes.length)<1||n.mode==n.selectMode&&e.value==1&&(n.notes==null?null:n.notes.length)>0&&n.selectedNotes<1))("disabled",n.isLoading||n.mode==n.createMode&&e.value==4&&((n.headlineForm==null?null:n.headlineForm.invalid)||(n.bodyForm==null?null:n.bodyForm.invalid))||n.mode==n.viewMode&&e.value==0&&(n.notes==null?null:n.notes.length)<1||n.mode==n.selectMode&&e.value==1&&(n.notes==null?null:n.notes.length)>0&&n.selectedNotes<1),a(),se(" ",e.value==1&&n.selectedNotes>0?e.name+"("+n.selectedNotes+")":e.name," ");}}var kh=(()=>{class i extends Yn{get viewMode(){return po.view;}get selectMode(){return po.select;}get createMode(){return po.create;}constructor(e,n,t,o,h,k,f,m,v,V,te,$){super("ai-result-wrapper-active-whiteboard",t,v,V,te,$),this.navigationHelperService=e,this.formBuilder=n,this.storyTrackCommunicationService=t,this.dialogHelperService=o,this.spinnerService=h,this.adminRequestsService=k,this.deskManagerHelperService=f,this.notifier=m,this.anonymousUserService=v,this.portableRegisterService=V,this.eventsService=te,this.premiumPlanService=$,this.dropImg=ks,this.spinnerName="whiteboard",this.buttonList=[],this.isLoading=!1,this.isDeleting=!1,this.isEditing=!1,this.selectedNotes=0,this.count=7,this.sb="createdAt",this.sd="down",this.EVENT_PATH_SCRIPT=this.eventsService.events.script,this.noteTrackBy=(H,j)=>j.id,this.initFormControls=()=>{this.searchInput=new Ht(""),this.headlineForm=new Ht("",[pi.required,pi.maxLength(100)]),this.bodyForm=new Ht("",[pi.required,pi.maxLength(1e3)]),this.headlineForm.markAsPristine(),this.bodyForm.markAsPristine();},this.getAssetsCommonLoigic=()=>I(this,null,function*(){let{metadata:H,result:j}=yield this.getAssetRequest();this.nextUrl=H.hasNext?H.nextUrl:"",j.length>0&&(this.adaptNotesData(j),this.notes.forEach((F,Z)=>{this.generatedText.push({id:Z,description:F.body,tipItem:!1});})),H.hasNext||(this.resultsPage=-1);}),this.getAssets=()=>I(this,null,function*(){try{this.spinnerService.spin(this.spinnerName,!0),this.isLoading=!0,this.notes=[],this.generatedText=[],yield this.getAssetsCommonLoigic(),this.changeMode(this.notes.length>0?po.view:po.create);}catch(H){console.error(H),this.notifier.error("Failed to load Whiteboard notes");}finally{this.spinnerService.stop(this.spinnerName),this.isLoading=!1;}}),this.getMoreAssets=()=>I(this,null,function*(){if(this.resultsPage>=0&&!this.moreNotesLoading)try{this.moreNotesLoading=!0,this.resultsPage++,this.spinnerService.spin(this.spinnerName,!0),yield this.getAssetsCommonLoigic();}catch(H){this.resultsPage=-1,console.error("Failed to load more notes",H);}finally{this.moreNotesLoading=!1,this.spinnerService.stop(this.spinnerName);}}),this.adaptNotesData=H=>{H.forEach(j=>{this.notes.push({id:j.id,headline:j.headline,body:j.text,photo:j.owner?.user?.profileImgUrl,selected:!1,hidden:!1});});},this.getAssetRequest=()=>I(this,null,function*(){return this.nextUrl!==""?yield this.adminRequestsService.pullPaginationNextUrl(this.nextUrl):yield this.adminRequestsService.getWhiteboardNotes(this.deskManagerHelperService.getSelectedWorkspaceId(),this.count,this.sb,this.sd);}),this.onScriptDrop=H=>{this.bodyForm.setValue(H.dropData),this.bodyForm.markAsDirty();},this.dragAiWhiteboardEnded=()=>{this.dragEnded();},this.dragAiWhiteboardStarted=()=>{this.changeMode(po.create),this.topScroll(),this.dragStarted();},this.onButtonClick=H=>{switch(H.value){case jo.cancel:this.onCancelBtn();break;case jo.save:this.onSaveBtn();break;case jo.new:this.onNewBtn();break;case jo.delete:this.openDeleteDialog();break;case jo.deleteSelect:this.onSelectStartBtn();break;}},this.onSelectNote=(H,j)=>{this.mode!=this.selectMode&&!this.isEditing?this.setCurrentResultIndex(j,!0):(this.notes.find(F=>F.id===H.id).selected=!H.selected,this.selectedNotes=this.notes.filter(F=>F.selected)?.length);},this.onSelectStartBtn=()=>{this.changeMode(this.selectMode),this.setCurrentResultIndex(0,!0),this.sendEvent(this.EVENT_PATH_SCRIPT.deskScriptWhiteboardDeleteStart,{deleteType:"multiple"});},this.openDeleteDialog=(H=!1)=>{this.dialogHelperService.showUiConfirmationDialog({title:"Delete Note",msg:"Are you sure you want to delete this note?",confirmationText:"Ok",cancellationText:"Cancel",onSubmit:()=>this.onDeleteBtn(H),onClose:()=>this.onCancelDelete(H)});},this.onCancelDelete=(H=!1)=>{this.dialogHelperService.close(),this.sendEvent(this.EVENT_PATH_SCRIPT.deskScriptWhiteboardDeleteCancel,{deleteType:H?"single":"multiple",cancelType:"popup"});},this.onDeleteBtn=(H=!1)=>I(this,null,function*(){this.dialogHelperService.close();try{this.isDeleting=!0;let j=[];H?(j.push(this.notes[this.currentResultIndex]?.id),this.notes.splice(this.currentResultIndex,1),this.generatedText.splice(this.currentResultIndex,1),this.sendEvent(this.EVENT_PATH_SCRIPT.deskScriptWhiteboardDeleteCancel,{deleteType:"single"})):(j.push(...this.notes.filter(F=>F.selected).map(F=>F.id)),this.notes=this.notes.filter(F=>!F.selected),this.sendEvent(this.EVENT_PATH_SCRIPT.deskScriptWhiteboardDeleteCancel,{deleteType:"multiple",numDeleted:this.selectedNotes})),yield this.adminRequestsService.removeNoteFromWhiteboard(j),this.setCurrentResultIndex(0,!0),this.notes.length<1&&this.changeMode(this.createMode),this.selectedNotes=0,this.notifier.info("Note was successfully deleted");}catch(j){console.error(j),this.notifier.error("Failed to delete note , Please try again");}finally{this.isDeleting=!1;}}),this.onNewBtn=()=>{this.resetInputs(),this.changeMode(this.createMode),this.topScroll(),this.setCurrentResultIndex(0,!0),this.sendEvent(this.EVENT_PATH_SCRIPT.deskScriptWhiteboardNew);},this.onSaveBtn=()=>I(this,null,function*(){try{this.isLoading=!0;let H;this.isEditing?H=yield this.adminRequestsService.updateNoteFromWhiteboard(this.notes[this.currentResultIndex].id,this.headlineForm.value||"Headline",this.bodyForm.value||"Body"):H=yield this.adminRequestsService.addNoteToWhiteboard(this.deskManagerHelperService.getSelectedWorkspaceId(),this.headlineForm.value||"Headline",this.bodyForm.value||"Body");let j={id:H.id,headline:H.headline,body:H.text,photo:H.owner?.user?.profileImgUrl,selected:!1,hidden:!1},F="";this.isEditing?(this.notes[this.currentResultIndex]=j,this.generatedText[this.currentResultIndex].description=j.body,F="Note was successfully edited"):(this.notes.unshift(j),this.generatedText.unshift({id:this.generatedText.length-1,description:j.body,tipItem:!1}),F="Note was successfully added to whiteboard"),this.notifier.info(F),this.resetInputs(),this.changeMode(this.viewMode),this.sendEvent(this.EVENT_PATH_SCRIPT.deskScriptWhiteboardSave,{type:"new"});}catch(H){console.error(H),this.notifier.error("Failed to create new note, Please try again");}finally{this.isLoading=!1,this.isEditing=!1;}}),this.resetInputs=()=>{this.headlineForm.setValue(""),this.bodyForm.setValue(""),this.headlineForm.markAsPristine(),this.headlineForm.markAsUntouched(),this.bodyForm.markAsPristine(),this.bodyForm.markAsUntouched();},this.noteAddedFromRewrite=H=>{let j={id:H.id,headline:H.headline,body:H.text,photo:H.owner?.user?.profileImgUrl,selected:!1,hidden:!1};this.notes.unshift(j),this.generatedText.unshift({id:this.generatedText.length-1,description:j.body,tipItem:!1});},this.onCancelBtn=()=>{this.mode==this.selectMode&&this.sendEvent(this.EVENT_PATH_SCRIPT.deskScriptWhiteboardDeleteCancel,{deleteType:"multiple",cancelType:"menu"}),this.isEditing&&(this.notes[this.currentResultIndex].hidden=!1,this.isEditing=!1),this.mode===this.createMode&&this.resetInputs(),this.changeMode(this.viewMode),this.selectedNotes=0;},this.onResultBtnClick=(H,j,F)=>{switch(H){case Wi.past:this.pastResultToScriptFromWhiteboard(F,j);break;case Wi.delete:this.openDeleteDialog(!0);break;case Wi.edit:this.onEdit(j);break;}},this.onEdit=H=>{this.resetInputs(),this.changeMode(this.createMode),this.isEditing=!0,this.headlineForm.setValue(this.notes[this.currentResultIndex].headline),this.bodyForm.setValue(this.notes[this.currentResultIndex].body),this.notes[this.currentResultIndex].hidden=!0,this.topScroll();},this.pastResultToScriptFromWhiteboard=(H,j)=>{let F=this.pastResultToScript(H);this.sendEvent(this.EVENT_PATH_SCRIPT.deskScriptWhiteboardAdd,{whiteboardId:j.id}),this.storyTrackCommunicationService.setSidebarUpdateSelectedScriptTrack(F);},this.changeMode=H=>{this.mode=H,this.buttonList=ld(H);},this.sendEvent=(H,j)=>{this.eventsService.log(H,pe({storyId:this.story.storyId},j));},this.currentResultIndex=0,this.isDragging=!1,this.resultBtns=Bo("whiteboard"),this.resultsPage=0,this.nextUrl="",this.moreNotesLoading=!1,this.notes=[];}ngOnInit(){this.eventListeners.push(this.storyTrackCommunicationService.observeScriptDragStarted().subscribe(this.dragAiWhiteboardStarted),this.storyTrackCommunicationService.observeScriptDragEnded().subscribe(this.dragAiWhiteboardEnded),this.storyTrackCommunicationService.observeStoryChanged().subscribe(e=>this.story=e),this.storyTrackCommunicationService.observeUserDetails().subscribe(e=>this.userId=e.userId),this.storyTrackCommunicationService.observeNoteAddedToWhiteboard().subscribe(this.noteAddedFromRewrite)),this.initFormControls(),this.getAssets();}
8ngOnDestroy(){this.eventListeners.forEach(e=>e.unsubscribe());}closeSidebar(){this.storyTrackCommunicationService.setAiSidebarOpen(!1),this.navigationHelperService.toggleMediaSidebar(Je.NONE,!0);}topScroll(){this.resultContainer?.nativeElement&&(this.resultContainer.nativeElement.scrollTop=0);}static{this.ɵfac=function(n){return new(n||i)(d(ei),d(ol),d(He),d(Ue),d(ki),d(xt),d(Kt),d(Ge),d(xi),d(wi),d(Pe),d(hi));};}static{this.ɵcmp=G({type:i,selectors:[["whiteboard-sidebar"]],viewQuery:function(n,t){if(n&1&&Ye(Tf,5),n&2){let o;Ne(o=Fe())&&(t.resultContainer=o.first);}},standalone:!0,features:[Ae,q],decls:17,vars:11,consts:[["resultDiv",""],["tooltip","matTooltip"],[1,"ai-sidebar-container","whiteboard-container"],[1,"search-section"],[1,"ai-sidebar-title",3,"ngClass"],["class","close-button-ai-sidebar",3,"click",4,"ngIf"],["class","form-container",4,"ngIf"],[1,"whiteboard-list"],["class","whiteboard-result",3,"hidden","ngClass",4,"ngFor","ngForOf"],["appInfiniteScroll","",3,"scrolled"],[3,"name"],[1,"whiteboard-control-section"],[3,"ngClass","disabled","class","click",4,"ngFor","ngForOf"],[1,"close-button-ai-sidebar",3,"click"],["src","/img/sidebar-close-icon.svg","alt","image"],[1,"form-container"],[1,"input-box"],[1,"label"],[1,"input-box-wrapper"],[3,"readonly","inputFormControl","placeholder"],["mwlDroppable","","draggable","false",1,"ai-droppable-area",3,"drop","dragOverClass"],[1,"input-box-wrapper",3,"hidden","readonly","inputFormControl","width","height","showValidationErrors","placeholder"],["alt","image",3,"src","hidden"],[1,"whiteboard-result",3,"hidden","ngClass"],[3,"click","selectMode","noteData"],[1,"ai-result-action-menu",3,"ngClass"],[3,"click",4,"ngFor","ngForOf"],[3,"click"],["matTooltipClass","tooltip-custom-black-only",3,"matTooltipPosition","matTooltip"],[3,"click","ngClass","disabled"]],template:function(n,t){if(n&1){let o=U();r(0,"div",2)(1,"header")(2,"div",3)(3,"div",4),y(4),s()(),M(5,Ef,3,0,"span",5),s(),r(6,"main",null,0),M(8,Af,12,13,"div",6),r(9,"div",7),M(10,Lf,4,12,"div",8),s(),r(11,"div",9),S("scrolled",function(){return T(o),P(t.getMoreAssets());}),s()(),r(12,"ngx-spinner",10),b(13,"lottie-loader"),s(),r(14,"footer")(15,"div",11),M(16,Vf,2,7,"button",12),s()()();}n&2&&(a(3),c("ngClass",ue(9,Pf,t.mode==t.selectMode)),a(),se(" ",t.mode==t.selectMode?"Delete":t.mode==t.createMode?"All board":"Whiteboard"," "),a(),c("ngIf",!t.isLoading),a(3),c("ngIf",t.mode===t.createMode),a(2),c("ngForOf",t.notes),a(),nt("height",1,"px"),a(),c("name",t.spinnerName),a(4),c("ngForOf",t.buttonList));},dependencies:[we,_e,Fn,qi,Wn,ps,Le,yh,Hi,Xt,Si,dn,Ri,lo],styles:[".whiteboard-container[_ngcontent-%COMP%]{position:relative}.whiteboard-container[_ngcontent-%COMP%] .search-section[_ngcontent-%COMP%]{align-items:center;width:100%;display:flex;justify-content:flex-start}.whiteboard-container[_ngcontent-%COMP%] .menu-wrapper[_ngcontent-%COMP%]{position:relative}.whiteboard-container[_ngcontent-%COMP%] .menu-wrapper[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:140px;border:1px solid transparent;border-radius:10px;background:#7b8db114;height:34px;font-weight:400;font-size:14px;line-height:17px;color:#25365899;padding:0 12px 0 26px}.whiteboard-container[_ngcontent-%COMP%] .menu-wrapper[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:active{border:1px solid #00ABFE}.whiteboard-container[_ngcontent-%COMP%] footer[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:160px;height:40px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-family:Inter-Bold;font-weight:700;font-size:16px;line-height:19px} .whiteboard-container footer .cancel{background:#7b8db114;color:#7b8db1} .whiteboard-container footer .delete{background:#ff4d5b;
8color:#fff} .whiteboard-container footer .delete-select{background:#ff4d5b14;color:#ff4d5b} .whiteboard-container footer .new{background:#00abfe;color:#fff} .whiteboard-container footer .save{background:#00abfe;color:#fff}.ai-sidebar-title-red[_ngcontent-%COMP%]{color:#ff4d5b!important}.search-icon-container[_ngcontent-%COMP%]{position:absolute;top:0;bottom:4px;left:5px;margin:auto;width:22px;height:14px}.search-icon-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;object-position:center}.whiteboard-container[_ngcontent-%COMP%] .form-container[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:16px;margin-bottom:12px}.whiteboard-container[_ngcontent-%COMP%] .form-container[_ngcontent-%COMP%] .input-box[_ngcontent-%COMP%]{width:99%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:12px}.whiteboard-container[_ngcontent-%COMP%] .form-container[_ngcontent-%COMP%] .input-box[_ngcontent-%COMP%] .label[_ngcontent-%COMP%]{font-weight:600;font-size:14px;line-height:17px;font-family:Inter-Bold;color:#253658}.whiteboard-container[_ngcontent-%COMP%] .form-container[_ngcontent-%COMP%] .input-box[_ngcontent-%COMP%] .input-box-wrapper[_ngcontent-%COMP%]{width:100%} .whiteboard-container .form-container .input-box .input-box-wrapper .text-input-component{width:100%!important;background:#7b8db114!important} .whiteboard-container .form-container .input-box .input-box-wrapper .text-area-input-component .mat-form-field-label{white-space:pre-wrap!important}.whiteboard-container[_ngcontent-%COMP%] .form-container[_ngcontent-%COMP%] .input-box.input-box-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}.whiteboard-container[_ngcontent-%COMP%] .form-container[_ngcontent-%COMP%] .input-box[_ngcontent-%COMP%] .input-box-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#00abfe}.whiteboard-container[_ngcontent-%COMP%] .form-container[_ngcontent-%COMP%] .input-box[_ngcontent-%COMP%] .input-box-wrapper[_ngcontent-%COMP%] text-area-input[_ngcontent-%COMP%]{width:100%;border:1px solid transparent;border-radius:10px;background:#7b8db114;height:100px;font-weight:400;font-size:14px;line-height:17px;color:#25365899;padding:12px;resize:none} .whiteboard-container .form-container .input-box .input-box-wrapper .text-area-input-component textarea{font-size:14px!important;color:#253658}.whiteboard-list[_ngcontent-%COMP%]{width:99%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:16px;margin-top:28px;padding-bottom:16px}.whiteboard-result[_ngcontent-%COMP%]{width:100%;cursor:pointer;border:2px solid transparent;transition:all .3s ease-in-out;background:#4481fd14;border-radius:20px;padding:16px;position:relative}.whiteboard-control-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-evenly;gap:14px;height:100%;padding:0 12px}",".ai-sidebar-container[_ngcontent-%COMP%]{width:405px;margin-top:40px;background:#fff;height:calc(100vh - 124px);overflow:hidden;box-shadow:0 0 40px #0000001a;border-radius:20px;padding:24px 0 24px 12px} aside#whiteboard, aside#ai-checker, aside#ai-checker-v2, aside#ai-rewrite{left:-664px!important;width:360px!important;background:transparent!important;z-index:31} aside#emotions{left:-664px!important;width:432px!important;background:transparent!important;z-index:31} aside#audiogram{left:-664px!important;width:536px!important;background:transparent!important;z-index:31}main[_ngcontent-%COMP%]{margin-top:42px;width:100%;height:calc(100vh - 254px);position:relative;overflow-y:scroll;overflow-x:hidden;padding:0 4px}main[_ngcontent-%COMP%]::-webkit-scrollbar{width:11px}header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;height:60px;position:absolute;width:100%;top:0;left:0;background:#fff;padding:0 15px}footer[_ngcontent-%COMP%]{width:100%;z-index:1;background:#fff;box-shadow:0 0 40px #0000001a;position:absolute;bottom:0;left:0;height:60px}.ai-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#00abfe;font-family:Inter-Bold;width:110px} .ai-text-area-wrapper .text-area-input-component .mat-form-field-label{white-space:pre-wrap!important}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar{width:3px;padding-left:4px}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#00abfe}.ai-result-action-menu[_ngcontent-%COMP%]{position:absolute;right:12px;top:-18px;background:#fff;box-shadow:0 0 24px #0000002e;border-radius:10px;width:100px;height:28px;display:flex;align-items:center;justify-content:space-evenly;cursor:pointer}.ai-result-action-menu[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:0;margin:0;width:20px;height:20px}.ai-result-action-menu[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;background-repeat:no-repeat;padding:0;display:block}
8.ai-result-action-menu[_ngcontent-%COMP%] .delete[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-d.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .past[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-past.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .whiteboard[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-m.svg)}.ai-menu-wrapper[_ngcontent-%COMP%]{width:100%;max-width:240px;text-overflow:ellipsis;white-space:nowrap;border:1px solid rgba(37,54,88,.6);background:#fff;border-radius:20px;padding:2px 6px;font-weight:400;font-size:14px;color:#253658}.fade[_ngcontent-%COMP%]{opacity:0;transition:all .5s ease-in-out}.hide[_ngcontent-%COMP%]{display:none!important}.editing[_ngcontent-%COMP%]{cursor:default!important}.disabled[_ngcontent-%COMP%]{opacity:.4}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%], .ai-result-wrapper-active[_ngcontent-%COMP%]{border:2px solid rgba(0,171,254,.6)!important;background:#fff!important;cursor:text!important}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-result-wrapper-active[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-droppable-area[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:164px}.ai-droppable-class[_ngcontent-%COMP%]{transform:scale(.9);transition:all .3s ease-in-out}.ai-droppable-area[_ngcontent-%COMP%]{width:100%}.ai-sale-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;height:100%;padding:0 12px}.ai-sale-component[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;gap:14px}.ai-sale-section[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;cursor:pointer}.upgrade-text[_ngcontent-%COMP%]{max-width:100px;font-weight:500;font-size:12px;line-height:15px;color:#253658}.ai-result-list-wrapper[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:12px}.ai-result-item-container[_ngcontent-%COMP%]{position:relative;width:100%}"]});}}return i;})();no();Dm();at();Am();var Ih=Mr(wh());lr();vi();Em();Aa();ae();Cn();J();ae();J();ae();var Th=(i,u)=>({"ai-result-wrapper-active":i,fade:u});function Rf(i,u){if(i&1&&(r(0,"div",10),y(1),s()),i&2){let e=p(2);a(),se(" ",e.rewriteItem==null?null:e.rewriteItem.description," ");}}function Nf(i,u){if(i&1){let e=U();r(0,"div",2),S("click",function(){T(e);let t=p();return P(t.setCurrentResultIndex());}),r(1,"div",3)(2,"div",4),y(3),s(),r(4,"div",5),y(5),s(),r(6,"div",6)(7,"button",7),S("click",function(){T(e);let t=p();return P(t.generateTipText());}),b(8,"img",8),s(),r(9,"div"),y(10,"Generate"),s()()(),M(11,Rf,2,1,"div",9),s();}if(i&2){let e=p();c("ngClass",fi(4,Th,e.index==e.currentResultIndex,e.isDeleting&&e.index==e.currentResultIndex)),a(3),se(" ",(e.rewriteItem==null?null:e.rewriteItem.id)+1,". "),a(2),se(" ",e.rewriteItem==null?null:e.rewriteItem.title," "),a(6),c("ngIf",e.rewriteItem==null?null:e.rewriteItem.description);}}function Ff(i,u){if(i&1){let e=U();r(0,"div",11),S("click",function(){T(e);let t=p();return P(t.setCurrentResultIndex());}),y(1),s();}if(i&2){let e=p();c("ngClass",fi(2,Th,e.index==e.currentResultIndex,e.isDeleting&&e.index==e.currentResultIndex)),a(),se(" ",e.rewriteItem==null?null:e.rewriteItem.description," ");}}var la=(()=>{class i{constructor(){this.onGenerateTipText=new be(),this.onSetCurrentResultIndex=new be(),this.generateTipText=()=>{this.onGenerateTipText.emit();},this.setCurrentResultIndex=()=>{this.rewriteItem.tipItem?this.rewriteItem.description&&this.onSetCurrentResultIndex.emit():this.onSetCurrentResultIndex.emit();};}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["app-ai-rewrite-item"]],inputs:{rewriteItem:"rewriteItem",isDeleting:"isDeleting",currentResultIndex:"currentResultIndex",index:"index"},outputs:{onGenerateTipText:"onGenerateTipText",onSetCurrentResultIndex:"onSetCurrentResultIndex"},standalone:!0,features:[q],decls:3,vars:2,consts:[["regItem",""],["class","ai-result-wrapper-tip",3,"ngClass","click",4,"ngIf","ngIfElse"],[1,"ai-result-wrapper-tip",3,"click","ngClass"],[1,"ai-result-control
8s-tip"],[1,"ai-result-number-tip"],[1,"ai-result-header-tip"],[1,"ai-result-btn-tip"],[3,"click"],["src","/img/script-story-v2/create-tip-btn.svg","alt","create script from tip"],["class","ai-result-content-tip",4,"ngIf"],[1,"ai-result-content-tip"],[1,"ai-result-wrapper",3,"click","ngClass"]],template:function(n,t){if(n&1&&M(0,Nf,12,7,"div",1)(1,Ff,2,5,"ng-template",null,0,Re),n&2){let o=Be(2);c("ngIf",t.rewriteItem==null?null:t.rewriteItem.tipItem)("ngIfElse",o);}},dependencies:[xe,we,_e],styles:[".ai-result-controls-tip[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between}.ai-result-number-tip[_ngcontent-%COMP%]{color:#4481fd;font-size:32px;font-weight:600}.ai-result-header-tip[_ngcontent-%COMP%]{color:#253658;font-size:14px;font-style:normal;font-weight:600;max-width:240px}.ai-result-btn-tip[_ngcontent-%COMP%]{font-size:11px;font-weight:600;display:flex;justify-content:center;align-items:center;flex-direction:column;cursor:pointer}.ai-result-controls-tip[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{border-radius:50%;cursor:pointer}.ai-result-controls-tip[_ngcontent-%COMP%] button[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-position:center;object-fit:cover}.ai-result-content-tip[_ngcontent-%COMP%]{font-size:14px;color:#253658;white-space:break-spaces;overflow-wrap:anywhere;margin-top:12px}.ai-result-wrapper[_ngcontent-%COMP%]{border-radius:10px;background:#4481fd14;resize:none;border:2px solid transparent;width:100%;height:auto;font-size:14px;color:#253658;white-space:break-spaces;overflow-wrap:anywhere;padding:12px;cursor:pointer;position:relative;transition:all .3s ease-in-out}.ai-result-wrapper-tip[_ngcontent-%COMP%]{border-radius:10px;background:#fff;resize:none;border:2px solid rgba(123,141,177,.3);width:100%;height:auto;padding:12px;position:relative;transition:all .3s ease-in-out}",".ai-sidebar-container[_ngcontent-%COMP%]{width:405px;margin-top:40px;background:#fff;height:calc(100vh - 124px);overflow:hidden;box-shadow:0 0 40px #0000001a;border-radius:20px;padding:24px 0 24px 12px} aside#whiteboard, aside#ai-checker, aside#ai-checker-v2, aside#ai-rewrite{left:-664px!important;width:360px!important;background:transparent!important;z-index:31} aside#emotions{left:-664px!important;width:432px!important;background:transparent!important;z-index:31} aside#audiogram{left:-664px!important;width:536px!important;background:transparent!important;z-index:31}main[_ngcontent-%COMP%]{margin-top:42px;width:100%;height:calc(100vh - 254px);position:relative;overflow-y:scroll;overflow-x:hidden;padding:0 4px}main[_ngcontent-%COMP%]::-webkit-scrollbar{width:11px}header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;height:60px;position:absolute;width:100%;top:0;left:0;background:#fff;padding:0 15px}footer[_ngcontent-%COMP%]{width:100%;z-index:1;background:#fff;box-shadow:0 0 40px #0000001a;position:absolute;bottom:0;left:0;height:60px}.ai-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#00abfe;font-family:Inter-Bold;width:110px} .ai-text-area-wrapper .text-area-input-component .mat-form-field-label{white-space:pre-wrap!important}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar{width:3px;padding-left:4px}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#00abfe}.ai-result-action-menu[_ngcontent-%COMP%]{position:absolute;right:12px;top:-18px;background:#fff;box-shadow:0 0 24px #0000002e;border-radius:10px;width:100px;height:28px;display:flex;align-items:center;justify-content:space-evenly;cursor:pointer}.ai-result-action-menu[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:0;margin:0;width:20px;height:20px}.ai-result-action-menu[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;background-repeat:no-repeat;padding:0;display:block}.ai-result-action-menu[_ngcontent-%COMP%] .delete[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-d.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .past[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-past.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .whiteboard[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-m.svg)}.ai-menu-wrapper[_ngcontent-%COMP%]{width:100%;max-width:240px;text-overflow:ellipsis;white-space:nowrap;border:1px solid rgba(37,54,88,.6);background:#fff;border-radius:20px;padding:2px 6px;font-weight:400;font-size:14px;color:#253658}.fade[_ngcontent-%COMP%]{opacity:0;transition:all .5s ease-in-out}.hide[_ngcontent-%COMP%]{display:none!important}.editing[_ngcontent-%COMP%]{cursor:default!important}.disabled[_ngcontent-%COMP%]{opacity:.4}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%], .ai-result-wrapper-active[_ngcontent-%COMP%]{border:2px solid rgba(0,171,254,.6)!important;background:#fff!important;cursor:text!important}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-result-wrapper-active[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-droppable-area[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:164px}.ai-droppable-class[_ngcontent-%COMP%]{transform:scale(.9);transition:all .3s ease-in-out}.ai-droppable-area[_ngcontent-%COMP%]{width:100%}.ai-sale-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;
8height:100%;padding:0 12px}.ai-sale-component[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;gap:14px}.ai-sale-section[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;cursor:pointer}.upgrade-text[_ngcontent-%COMP%]{max-width:100px;font-weight:500;font-size:12px;line-height:15px;color:#253658}.ai-result-list-wrapper[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:12px}.ai-result-item-container[_ngcontent-%COMP%]{position:relative;width:100%}"]});}}return i;})();ae();J();var Ph=(()=>{class i{static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["app-custom-tone-shimmer"]],standalone:!0,features:[q],decls:3,vars:0,consts:[[1,"loading-skeleton-blue"],[1,"controls"],[1,"wave"]],template:function(n,t){n&1&&(r(0,"div",0),b(1,"div",1)(2,"div",2),s());},dependencies:[xe],styles:[".loading-skeleton-blue[_ngcontent-%COMP%]{position:relative;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:#4481fd14;border-radius:10px;overflow:hidden}.controls[_ngcontent-%COMP%]{background:#4481fd33;border-radius:10px;height:10px}.wave[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffff26;transform:translate(-100%);animation:_ngcontent-%COMP%_wave 1.5s infinite}@keyframes _ngcontent-%COMP%_wave{0%{transform:translate(-100%)}50%{transform:translate(100%)}to{transform:translate(100%)}}"]});}}return i;})();var Jo=class extends Yn{constructor(u,e,n,t,o,h,k,f,m){super(u,e,n,t,o,h),this.classNameToEventCopy=u,this.storyTrackCommunicationService=e,this.anonymousUserService=n,this.portableRegisterService=t,this.eventsService=o,this.premiumPlanService=h,this.deskManagerHelperService=k,this.adminRequestsService=f,this.notifier=m,this.deleteAiWriteBlock=v=>I(this,null,function*(){this.isDeleting=!0,setTimeout(()=>{this.generatedText[v].tipItem?(this.generatedText[v].description="",this.setCurrentResultIndex(-1,!0)):(this.generatedText.splice(v,1),this.setCurrentResultIndex(0,!0)),this.isDeleting=!1;},500);}),this.pastToWhiteboard=v=>I(this,null,function*(){try{this.isLoading=!0;let V=yield this.adminRequestsService.addNoteToWhiteboard(this.deskManagerHelperService.getSelectedWorkspaceId(),this.story.headline||"New Note",this.pastResultToScript(v));this.storyTrackCommunicationService.setNoteAddedToWhiteboard(V),this.notifier.info("Note was successfully added to whiteboard");}catch(V){console.error(V),this.notifier.error("Failed add note to whiteboard, Please try again");}finally{this.isLoading=!1;}}),this.pastResultToScriptFromAiRewrite=v=>{let V=this.pastResultToScript(v);return this.storyTrackCommunicationService.setSidebarUpdateSelectedScriptTrack(V),V;},this.generatedText=[],this.isDeleting=!1;}};wm();Nn();J();so();Mi();ht();ln();bn();qt();at();oo();ao();Eo();pn();ll();Bn();Zi();vi();var Bf=["resultDiv"],Uf=["stepIntro"],Hf=["stepName"],zf=["stepDescription"],$f=["stepWebSearch"],Wf=["stepTarget"],Gf=["stepBlogOrVlog"],qf=["stepBlogInput"],Kf=i=>({"full-main":i}),Oh=i=>({"active-ai-controls-btn":i}),Qf=i=>({disabled:i}),Yf=i=>({"bold-ai":i}),Jf=i=>({hide:i});function Xf(i,u){if(i&1){let e=U();r(0,"span",26),S("click",function(){T(e);let t=p();return P(t.closeSidebar());}),r(1,"button"),b(2,"img",27),s()();}}function Zf(i,u){if(i&1&&(r(0,"div",48)(1,"div",34),y(2),s(),r(3,"div",49),y(4),s()()),i&2){let e=u.$implicit;a(2),de(e.name[0]),a(2),de(e.name);}}function ev(i,u){if(i&1){let e=U();r(0,"div",52),S("click",function(){T(e);let t=p(3);return P(t.openCustomToneDialog());}),b(1,"img",53),s();}}function tv(i,u){if(i&1&&(r(0,"div",48)(1,"div",50),y(2),s(),M(3,ev,2,0,"div",51),s()),i&2){let e=u.$implicit;a(),c("ngClass",ue(3,Yf,e.style==="mybrand")),a(),de(e.name),a(),c("ngIf",e.style==="mybrand");}}function iv(i,u){if(i&1&&b(0,"filter-option-template",54,4),i&2){let e=u.$implicit,n=p(2);nt("width",100,"%"),c("matTooltip",n.toolTipStrings.get(e==null?null:e.value))("matTooltipPosition","right")("viewValue",n.serviceFullNameStrings.get(e==null?null:e.value))("active",(e==null?null:e.value)===n.selectedServiceOption.value);}}function nv(i,u){if(i&1&&(r(0,"div",55,5)(2,"div",56),y(3),s(),r(4,"div",57),b(5,"text-input",58),s()()),i&2){let e=p(2);a(3),se(" ",e.userNameTitle," "),a(2),c("readonly",e.isLoading)("inputFormControl",e.userNameInput)("placeholder",e.userNamePlaceholder);}}function ov(i,u){if(i&1&&(r(0,"div",55)(1,"div",56),y(2),s(),r(3,"div",57),b(4,"text-input",58),s()()),i&2){let e=p(2);a(2),se(" ",e.targetInputTitle," "),a(2),c("readonly",e.isLoading)("inputFormControl",e.targetInput)("placeholder",e.targetInputPlaceholder);}}function rv(i,u){if(i&1){let e=U();r(0,"div",55)(1,"div",55,6)(3,"div",56),y(4),s(),r(5,"div",57),b(6,"text-input",58),s()(),r(7,"div",59,7)(9,"div",60),S("click",function(){T(e);let t=p(2);return P(t.setBlogOption(t.VlogValue));}),r(10,"div",61),b(11,"div",62),s(),r(12,"div",63),y(13,"Convert your article into a script"),s(),b(14,"app-question-button",64,4),s(),r(16,"div",60),S("click",function(){T(e);let t=p(2);return P(t.setBlogOption(t.BlogValue));}),r(17,"div",61),b(18,"div",62),s(),r(19,"div",63),y(20,"Create a short ad for your blog"),s(),b(21,"app-question-button",64,4),s()()();}if(i&2){let e=p(2);a(4),se(" ",e.blogTitle," "),a(2),c("readonly",e.isLoading)("inputFormControl",e.blogInput)("placeholder",e.blogPlaceholder),a(5),c("hidden",e.selectedBlogValue===e.BlogValue),a(3),c("matTooltip","Turn your blog into a video script. Perfect for vlogging or as a catchy addition to your blog.")("matTooltipPosition","right"),a(4),c("hidden",e.selectedBlogValue===e.VlogValue),a(3),c("matTooltip","Create a short advertisement script for your blog, ideal for promoting it on social media or in newsletters..")("matTooltipPosition","right");}}function sv(i,u){if(i&1&&(r(0,"div",55,8)(2,"div",56),y(3),b(4,"app-question-button",64,4),s(),r(6,"div",57),b(7,"text-input",58),s()()),i&2){let e=p(2);a(3),se(" ",e.productInputTitle," "),a(),c("matTooltip",e.inputProductTooltip)("matTooltipPosition","right"),a(3),c("readonly",e.isLoading)("inputFormControl",e.productInput)("placeholder",e.productInputPlaceholder);}}function av(i,u){if(i&1){let e=U();r(0,"div",72,10),S("click",function(){T(e);let t=p(3);return P(t.toogleWebsearch());}),r(2,"div",73),b(3,"div",74),s(),r(4,"div",75),y(5,"Include Google Search data"),s(),b(6,"app-question-button",64,4),s();}if(i&2){let e=p(3);a(3),c("hidden",e.useWebSearch===!1),a(3),c("matTooltip","Tick this box if you would like us to enhance your script with up-to-date news from the web.")("matTooltipPosition","right");}}function cv(i,u){if(i&1){let e=U();r(0,"div",55,9)(2,"div",65),S("click",function(){T(e);let t=Be(5);return P(t.show());}),y(3),b(4,"app-question-button",66,4),s(),M(6,av,8,3,"div",67),r(7,"div",68),S("drop",function(t){T(e);let o=p(2);return P(o.onScriptDrop(t));}),b(8,"text-area-input",69),r(9,"div",70)(10,"div",71),y(11,"Drop here"),s()()()();}if(i&2){let e=p(2);
8a(3),se(" ",e.descriptionInputTitle," "),a(),c("hidden",!e.descriptionInputTitle)("matTooltip",e.descriptionInputTooltip)("matTooltipPosition","right"),a(2),c("ngIf",e.showUseWebSearch),a(),c("dragOverClass","ai-droppable-class"),a(),c("hidden",e.isDragging)("readonly",e.isLoading)("inputFormControl",e.descriptionInput)("width",300)("height",164)("showValidationErrors",!(e.descriptionInput!=null&&e.descriptionInput.pristine))("placeholder",e.descriptionInputPlaceholder),a(),c("hidden",!e.isDragging);}}function lv(i,u){if(i&1){let e=U();r(0,"div",28)(1,"div",29)(2,"div",30)(3,"div",31)(4,"div",32)(5,"div",33)(6,"div",34),y(7),s()(),r(8,"div",35)(9,"select-menu",36),S("menuState",function(t){T(e);let o=p();return P(o.lengthMenuOpenState(t));})("onSelection",function(t){T(e);let o=p();return P(o.setSelectedLength(t));}),M(10,Zf,5,2,"ng-template",null,3,Re),s()()(),r(12,"div",32)(13,"div",37),b(14,"img",38),s(),r(15,"div",39)(16,"select-menu",36),S("menuState",function(t){T(e);let o=p();return P(o.toneMenuOpenState(t));})("onSelection",function(t){T(e);let o=p();return P(o.setSelectedTone(t));}),M(17,tv,4,5,"ng-template",null,3,Re),s()(),r(19,"div",40),b(20,"app-custom-tone-shimmer"),s()()(),r(21,"div",41)(22,"div",42)(23,"select-menu",43),S("onSelection",function(t){T(e);let o=p();return P(o.setSelectedService(t));}),M(24,iv,2,6,"ng-template",null,3,Re),s()(),r(26,"tutorial-button",44),S("onBtnClick",function(){T(e);let t=p();return P(t.onHelpLinkedIn());}),s()()()(),M(27,nv,6,4,"div",45)(28,ov,5,4,"div",45)(29,rv,23,10,"div",45)(30,sv,8,6,"div",45)(31,cv,12,14,"div",45),r(32,"div",46)(33,"button",47),S("click",function(){T(e);let t=p();return P(t.onWriteBtn());}),y(34," Write New "),s()()();}if(i&2){let e=p();a(4),c("ngClass",ue(31,Oh,e.lengthMenuOpen)),a(3),de(e.selectedLenOption==null?null:e.selectedLenOption.name[0]),a(2),c("shouldOpen",!e.isLoading)("selectedOption",e.selectedLenOption)("menuOptions",e.lengthOptions)("toggleMenuIconClass",e.lenTriangle)("contentStyle","ai-rewrite-dropdown-length"),a(3),c("ngClass",ue(33,Oh,e.toneMenuOpened)),a(2),c("src",e.toneBtnImg,Ie),a(),c("hidden",e.loadingBusiness),a(),c("shouldOpen",!e.isLoading&&e.showToneDropDown&&!e.loadingBusiness)("selectedOption",e.selectedToneOption)("menuOptions",e.toneOptions)("toggleMenuIconClass",e.toneTriangle)("contentStyle","ai-rewrite-dropdown-tone"),a(3),c("hidden",!e.loadingBusiness),a(4),c("shouldOpen",!e.isLoading)("selectedOption",e.selectedServiceOption)("menuOptions",e.serviceOptions)("toggleMenuIconClass","grey-triangle closed")("contentStyle","ai-rewrite-dropdown-container"),a(3),c("hidden",!(e.useLinkedInTarget&&(e.selectedServiceOption==null?null:e.selectedServiceOption.value)===e.SalesValue))("btnStyle",e.tutorialBtnStyle)("buttonMode",!0),a(),c("ngIf",e.userIsAnonymous),a(),c("ngIf",e.targetInput),a(),c("ngIf",e.blogInput),a(),c("ngIf",e.productInput),a(),c("ngIf",e.descriptionInput),a(2),c("ngClass",ue(35,Qf,e.isLoading||(e.descriptionInput==null?null:e.descriptionInput.invalid)||(e.targetInput==null?null:e.targetInput.invalid)||(e.productInput==null?null:e.productInput.invalid)||(e.blogInput==null?null:e.blogInput.invalid)||e.userIsAnonymous&&(e.userNameInput==null?null:e.userNameInput.invalid)))("disabled",e.isLoading||(e.descriptionInput==null?null:e.descriptionInput.invalid)||(e.targetInput==null?null:e.targetInput.invalid)||(e.productInput==null?null:e.productInput.invalid)||(e.blogInput==null?null:e.blogInput.invalid)||e.userIsAnonymous&&(e.userNameInput==null?null:e.userNameInput.invalid));}}function dv(i,u){if(i&1){let e=U();r(0,"button",84),S("click",function(){let t=T(e).$implicit,o=p().index,h=p(2);return P(h.onResultBtnClick(t.value,o));}),b(1,"i",85,4),s();}if(i&2){let e=u.$implicit;a(),gt(e.style),c("matTooltipPosition","above")("matTooltip",e==null?null:e.name);}}function pv(i,u){if(i&1){let e=U();r(0,"div",80)(1,"app-ai-rewrite-item",81),S("onSetCurrentResultIndex",function(){let t=T(e).index,o=p(2);return P(o.setCurrentResultIndex(t));})("onGenerateTipText",function(){let t=T(e).index,o=p(2);return P(o.generateTip(t));}),s(),r(2,"div",82),M(3,dv,3,4,"button",83),s()();}if(i&2){let e=u.$implicit,n=u.index,t=p(2);a(),c("currentResultIndex",t.currentResultIndex)("index",n)("isDeleting",t.isDeleting)("rewriteItem",e),a(),c("ngClass",ue(6,Jf,t.isLoading||n!=t.currentResultIndex)),a(),c("ngForOf",t.resultBtns);}}function hv(i,u){if(i&1&&(r(0,"div",76)(1,"div",77)(2,"div",13),y(3),s(),b(4,"app-question-button",66,4),s(),r(6,"div",78),M(7,pv,4,8,"div",79),s()()),i&2){let e=p();a(3),se(" ",e.resultTitle," "),a(),c("hidden",!e.showResultTooltip)("matTooltip","Select your favorite topic and we\u2019ll generate the complete video script. Easily create a series of scripts that boost your brand authority.")("matTooltipPosition","right"),a(3),c("ngForOf",e.generatedText);}}function mv(i,u){i&1&&(r(0,"div",86)(1,"div",87),y(2,"Results"),s(),r(3,"div",88),y(4," Your generated script will appear here :) "),s()());}function uv(i,u){if(i&1){let e=U();r(0,"div",89)(1,"img",90),S("click",function(){T(e);let t=p();return P(t.onPremiumFeatureClick(!1,!0));}),s(),r(2,"div",91),y(3,"Upgrade your plan to AI Pro"),s()();}if(i&2){let e=p();a(),c("src",e.upgradePlanImg,Ie);}}var Mh=(()=>{class i extends Jo{get SalesValue(){return Rt.scriptSalesRewrite;}get BlogValue(){return Rt.blog;}get VlogValue(){return Rt.vlog;}get TipScreen(){return Rt.tipsCreate;}constructor(e,n,t,o,h,k,f,m,v,V,te,$,H,j,F,Z,N,Q,W){super("ai-result-wrapper-active",t,H,j,f,Q,v,k,V),this.navigationHelperService=e,this.spinnerService=n,this.storyTrackCommunicationService=t,this.aiAssistanceHelperService=o,this.aiScriptService=h,this.adminRequestsService=k,this.eventsService=f,this.router=m,this.deskManagerHelperService=v,this.notifier=V,this.storyHelperService=te,this.dialogHelperService=$,this.anonymousUserService=H,this.portableRegisterService=j,this.userHelperService=F,this.planHelperService=Z,this.cookieService=N,this.premiumPlanService=Q,this.creditsService=W,this.introJS=(0,Ih.default)(),this.descriptionCacheByService={[Rt.scriptSalesRewrite]:{inputDescription:"",inputProduct:"",inputTarget:"",linkedinProfileUrl:""},[Rt.blog]:{blogUrl:""},[Rt.scriptCreate]:{inputDescription:""},[Rt.scriptNewsCreate]:{inputDescription:""},[Rt.tipsCreate]:{inputDescription:""},[Rt.paragraphRewrite]:{inputDescription:""}},this.isLoadingCredits=!0,this.briefImg=Na,this.dropImg=ks,this.toneBtnImg=Fa,this.lenBtnImg=ja,this.toneTriangle=ur,this.lenTriangle=ur,this.EVENT_PATH_SCRIPT=this.eventsService.events.script,this.linkedInStoryId="641ade3e6d4a7327eba910b6",this.linkedInMediaId="641ade3e6d4a7327eba910bb",this.INTO_JS_WAITING_TIME=600,this.tutorialBtnStyle=Es.transparent,this.initInputs=()=>{this.descriptionInput=new Ht("",[pi.minLength(20),pi.maxLength(800),pi.required]),this.descriptionInput.markAsPristine(),this.targetInput=void 0,this.productInput=void 0,this.blogInput=void 0,this.userNameInput=void 0,this.descriptionInputTitle="Paragraph to rewrite.",this.targetInputTitle="",this.productInputTitle="",this.blogTitle="",this.userNameTitle="Name",this.descriptionInputPlaceholder="I help small businesses grow using video, SEO and paid advertisements.",this.targetInputPlaceholder="",this.productInputPlaceholder="",this.blogPlaceholder="",this.userNamePlaceholder="Name",this.descriptionInputTooltip="This script introduces you and your company to the world. Think of it as your personal elevator pitch. The more facts you enter into the script generator, the more personalized and accurate the script will be. Share what makes your business unique, your background and credentials, and key accomplishments. Don\u2019t be shy!",this.inputProductTooltip="",this.targetInputTooltip="",this.lengthOptions=ad(),this.selectedLenOption=this.lengthOptions[1],this.serviceOptions=sd(),this.setSelectedService(this.serviceOptions[0],!1),this.toolTipStrings=od(),this.serviceFullNameStrings=rd(),this.showToneDropDown=!0,this.useWebSearch=!1,this.showUseWebSearch=!1,this.showLinkedInToggle=!1,this.useLinkedInTarget=!1;},this.checkUserPlanAndLimits=()=>I(this,null,function*(){yield this.checkRewriteLimit(),this.userIsPro=yield this.planHelperService.isProOrTeamOrMaxByCurrentPlan();}),this.checkRewriteLimit=(O=!1)=>I(this,null,function*(){this.isLoadingCredits=!0;try{O&&this.creditsService.invalidateCache();let D=yield this.creditsService.getCreditsUsage(),ie=this.creditsService.getFeature(D,"aiScript");this.remainingCredits=this.creditsService.getFeatureAvailableCredits(D,"aiScript"),this.totalCredits=this.creditsService.getFeatureTotalCredits(D,"aiScript"),this.tooltipText=ie?this.creditsService.formatCostTooltip(ie):"",this.userIsLim
8ited=this.creditsService.isFeatureLimited(D,"aiScript"),this.canUseAiRewrite=!this.userIsLimited;}finally{this.isLoadingCredits=!1;}}),this.setToneAndBusiness=()=>I(this,null,function*(){if(this.userIsAnonymous)this.setToneOptionsAndFilter(),this.loadingBusiness=!1;else try{this.setToneOptionsAndFilter(this.business);}catch(O){console.error(O),this.setToneOptionsAndFilter();}finally{this.loadingBusiness=!1;}}),this.setToneOptionsAndFilter=(O,D)=>{O&&(this.customTone=O.brandStyle),this.toneOptions=mr(this.customTone),D||this.customTone?this.selectedToneOption=this.toneOptions.find(ie=>ie.style===tn.custom):this.selectedToneOption=this.toneOptions.find(ie=>ie.value===tn.socialMedia);},this.setUserAnonymous=()=>I(this,null,function*(){this.userIsAnonymous=!!(yield this.anonymousUserService.getAnonymousUser()),this.userIsAnonymous?this.userNameInput=new Ht("",[pi.required]):this.userNameInput=void 0;}),this.shouldStartIntoJs=()=>I(this,null,function*(){this.userIsAnonymous&&!this.cookieService.getCookie("aiScriptWalkthrough")&&setTimeout(()=>{this.startIntoJs(this.startingServiceForAnonymous);},this.INTO_JS_WAITING_TIME);}),this.startIntoJs=O=>{let D=this.getIntoJsByAnonyomusPath(O);this.introJS.setOptions(D),this.introJS.onbeforechange(ie=>{}),this.introJS.onbeforeexit(()=>{this.cookieService.setCookie(cl.AI_SCRIPT_WALKTHROUGH,"done");}),this.introJS.start();},this.setInputsByService=(O,D)=>{let ie=xs(D)||null,{inputDescription:Te,inputTarget:Ee,inputProduct:je,blogUrl:Ke}=xs(O);this.showUseWebSearch=O===Rt.scriptNewsCreate,this.showLinkedInToggle=O===Rt.scriptSalesRewrite,ie?.inputDescription&&(this.descriptionCacheByService[D].inputDescription=this.descriptionInput.value||""),Te?(this.showToneDropDown=Te.showToneDropdown,this.descriptionInputTitle=Te.question,this.descriptionInputPlaceholder=Te.placeholder,this.descriptionInputTooltip=Te.tooltip,this.descriptionInput=new Ht(this.descriptionCacheByService[O].inputDescription,this.getInputValidators(Te)),this.descriptionInput.value?(this.descriptionInput.markAsTouched(),this.descriptionInput.markAsDirty()):this.descriptionInput.markAsPristine()):this.descriptionInput=void 0,ie?.inputProduct&&(this.descriptionCacheByService[D].inputProduct=this.productInput.value||""),je?(this.productInputTitle=je.question,this.productInputPlaceholder=je.placeholder,this.inputProductTooltip=je.tooltip,this.productInput=new Ht(this.descriptionCacheByService[O].inputProduct,this.getInputValidators(je)),this.productInput.value?(this.productInput.markAsTouched(),this.productInput.markAsDirty()):this.productInput.markAsPristine()):this.productInput=void 0,ie?.inputTarget&&(this.descriptionCacheByService[D].inputTarget=this.targetInput.value||""),Ee?(this.targetInputTitle=Ee.question,this.targetInputPlaceholder=Ee.placeholder,this.targetInputTooltip=Ee.tooltip,this.targetInput=new Ht(this.descriptionCacheByService[O].inputTarget,this.getInputValidators(Ee)),this.targetInput.value?(this.targetInput.markAsTouched(),this.targetInput.markAsDirty()):this.targetInput.markAsPristine()):this.targetInput=void 0,ie?.blogUrl&&(this.descriptionCacheByService[D].blogUrl=this.blogInput.value||""),Ke?(this.showToneDropDown=Ke.showToneDropdown,this.blogTitle=Ke.question,this.blogPlaceholder=Ke.placeholder,this.blogInput=new Ht(this.descriptionCacheByService[O].blogUrl,this.getInputValidators(Ke)),this.blogInput.value?(this.blogInput.markAsTouched(),this.blogInput.markAsDirty()):this.blogInput.markAsPristine()):this.blogInput=void 0;},this.getInputValidators=O=>{let D=[pi.minLength(O.min),pi.maxLength(O.max)];return O.required&&D.push(pi.required),O.regex&&D.push(pi.pattern(O.regex)),D;},this.setSelectedTone=O=>{O.value===tn.custom?this.openCustomToneDialog():(this.toneOptions.forEach(D=>D.isActive=D.value==O.value),this.selectedToneOption=O);},this.openCustomToneDialog=()=>{if(this.customToneDialogOpened)return;if(!this.userIsPro){this.onPremiumFeatureClick(!0);return;}this.eventsService.log(this.eventsService.events.aiBrandTone.aiBrandToneEditStart,{screen:"story"}),this.customToneDialogOpened=!0;let O=new Fs();O.lastTone=this.customTone,O.onSubmit=this.createCustomTone,O.onClose=this.customToneDialogClosed;let D=new We();D.disableClose=!0,D.panelClass="ai-custom-style-tone-dialog-content",this.dialogHelperService.open(O,js,D);},this.customToneDialogClosed=()=>{this.customToneDialogOpened=!1,this.dialogHelperService.close();},this.createCustomTone=O=>I(this,null,function*(){try{if(this.customToneDialogClosed(),O!=this.customTone){let D=yield this.adminRequestsService.updateBusiness({brandStyle:O,de
8skId:this.deskManagerHelperService.getSelectedWorkspaceId()});this.storyTrackCommunicationService.setBusiness(D),this.setToneOptionsAndFilter(D,!0);}this.notifier.success("Your Brand Style Created");}catch(D){console.error(D);}}),this.setSelectedService=(O,D=!0)=>{let ie=this.selectedServiceOption?.value;this.serviceOptions.forEach(Te=>Te.isActive=Te.value==O.value),this.selectedServiceOption=O,D&&this.eventsService.log(this.EVENT_PATH_SCRIPT.deskScriptAiChange,{storyId:this.story.storyId,fromFeature:ie,toFeature:this.selectedServiceOption.value}),this.setInputsByService(O.value,ie);},this.setSelectedLength=O=>{this.lengthOptions.forEach(D=>D.isActive=D.value==O.value),this.selectedLenOption=O;},this.onWriteBtn=()=>{this.canUseAiRewrite?this.generateScript().then(()=>{let O=this.selectedServiceOption?.value===Rt.tipsCreate?-1:0;this.setCurrentResultIndex(O,!0);}):this.userIsPro?this.creditsService.openCreditsOtpDialog({paywallTrigger:pt.ai}):this.onPremiumFeatureClick(!1);},this.generateScript=()=>I(this,null,function*(){this.isLoading=!0,this.generating=!0,this.topScroll();try{let O={};this.descriptionInput&&(O.description=this.descriptionInput.value),this.productInput&&(O.product=this.productInput.value),this.blogInput&&(O.blogUrl=this.blogInput.value),this.userIsAnonymous&&this.userNameInput&&(yield this.userHelperService.updateUser({fullName:this.userNameInput.value}));let D=this.selectedServiceOption.value;this.targetInput&&(O.target=this.targetInput.value),this.useWebSearch&&this.selectedServiceOption.value===Rt.scriptNewsCreate&&(D=Rt.scriptWebsearchCreate),this.selectedServiceOption.value===Rt.blog&&(D=this.selectedBlogValue),this.sendAiEvent(this.EVENT_PATH_SCRIPT.deskScriptAiInput,D,this.selectedToneOption.value,this.selectedLenOption.value,pe({},O));let ie=yield this.aiScriptService.generateAiRewrite(D,this.selectedToneOption.value,O,this.selectedLenOption.value),Te={},Ee={};ie&&(this.generatedText=[],ie.forEach((je,Ke)=>{Te["stopReason"+(Ke+1)]=je.stop_reason,(je.stop_reason=="stop"||je.stop_reason=="unknown")&&(D===Rt.tipsCreate?(this.resultTitle="What would you like to speak about?",this.showResultTooltip=!0,je.text.forEach((Ft,Wt)=>{Ee["output"+(Wt+1)]=Ft,this.generatedText.push({id:Wt,title:Ft,description:"",tipItem:!0});})):(this.resultTitle="Results",this.showResultTooltip=!1,Ee["output"+(Ke+1)]=je.text,this.generatedText.push({id:Ke,description:je.text,tipItem:!1})));})),this.toggleBrief(),yield this.checkRewriteLimit(!0),this.sendAiEvent(this.EVENT_PATH_SCRIPT.deskScriptAiOut,this.selectedServiceOption.value,this.selectedToneOption.value,this.selectedLenOption.value,pe(pe(pe({},O),Te),Ee));}catch(O){if(console.error(O),this.creditsService.handleCreditError(O)){this.isLoading=!1,this.generating=!1;return;}O.data?.code==="1400"?this.notifier.error("Please try again and use website in English."):this.notifier.error("An error occurred while generating your script. Please try again.");}finally{this.isLoading=!1,this.generating=!1;}}),this.pastResultToScriptFromRewrite=O=>{let D=this.pastResultToScriptFromAiRewrite(O);this.sendAiEvent(this.EVENT_PATH_SCRIPT.deskScriptAiAdd,this.selectedServiceOption.value,this.selectedToneOption.value,this.selectedLenOption.value,{description:D});},this.onScriptDrop=O=>{this.descriptionInput.setValue(O.dropData),this.descriptionInput.markAsDirty();},this.toggleBrief=()=>{this.isBriefOpen=!this.isBriefOpen,this.briefImg=this.isBriefOpen?Na:xd;},this.dragAiRewriteStarted=()=>{this.isBriefOpen||this.toggleBrief(),this.topScroll(),this.dragStarted();},this.dragAiRewriteEnded=()=>{this.dragEnded();},this.onResultBtnClick=(O,D)=>{switch(O){case Wi.delete:this.deleteResultBlock(D);break;case Wi.past:this.pastResultToScriptFromRewrite(D);break;case Wi.whiteboard:this.pastToWhiteboard(D);break;}},this.deleteResultBlock=O=>I(this,null,function*(){this.sendAiEvent(this.EVENT_PATH_SCRIPT.deskScriptAiDelete,this.selectedServiceOption.value,this.selectedToneOption.value,this.selectedLenOption.value,{outputs:this.generatedText,deletedId:O}),this.deleteAiWriteBlock(O);}),this.sendAiEvent=(O,D,ie,Te,Ee)=>{let je=pe({storyId:this.story.storyId,aiFeature:D,tone:ie===tn.custom?"brand":ie||void 0,length:Te||void 0,creditsRemaining:this.remainingCredits},Ee);this.eventsService.log(O,je);},this.onHelpLinkedIn=()=>I(this,null,function*(){if(this.linkedInStory||(this.linkedInStory=yield this.adminRequestsService.getStoryById(this.linkedInStoryId)),this.linkedInStory.status==="ready"||this.linkedInStory.status==="generating"&&this.linkedInStory.videos.length>0){let O=this.storyHelperService.getVideoById(this.linkedInStory,this.linkedInMediaId);if(O.streams.length>0){let D=new kl();D.action={video:O},D.onClose=this.dialogHelperService.close,D.onSubmit=this.dialogHelperService.close;let ie=new We();ie.panelClass="video-popup-dialog",ie.disableClose=!1,this.dialogHelperService.open(D,yl,ie),this.eventsService.log(this.EVENT_PATH_SCRIPT.aiHelpClick,{storyId:this.story.storyId,aiFeature:"linkedinWizard"});}else this.notifier.error("No video to show preview");}}),this.toogleWebsearch=()=>{this.useWebSearch=!this.useWebSearch;},this.toogleLinkedInTarget=()=>{this.useLinkedInTarget=!this.useLinkedInTarget;let{inputTarget:O}=xs(Rt.scriptSalesRewrite);this.targetInputTitle=O.question,this.targetInputPlaceholder=O.placeholder,this.targetInputTooltip=O.tooltip,this.targetInput=new Ht("",this.getInputValidators(O)),this.targetInput.markAsPristine();},this.toneMenuOpenState=O=>{this.toneMenuOpened=O,this.toneBtnImg=O?wd:Fa,this.toneTriangle=O?Ba:ur;},this.lengthMenuOpenState=O=>{this.lengthMenuOpen=O,this.lenBtnImg=O?Td:ja,this.lenTriangle=O?Ba:ur;},this.setBlogOption=O=>{this.selectedBlogValue=O;},this.generateTip=O=>I(this,null,function*(){this.isLoading=!0,this.generating=!0;try{let D=yield this.aiScriptService.generateAiRewrite(Rt.tipsSelect,this.selectedToneOption.value,{description:this.generatedText[O].title},this.selectedLenOption.value),ie={},Te={};D&&D.forEach((Ee,je)=>
8{ie["stopReason"+(je+1)]=Ee.stop_reason,Te["output"+(je+1)]=Ee.text,(Ee.stop_reason=="stop"||Ee.stop_reason=="unknown")&&(this.generatedText[O].description=Ee.text);}),this.setCurrentResultIndex(O),this.sendAiEvent(this.EVENT_PATH_SCRIPT.deskScriptAiOut,Rt.tipsSelect,this.selectedToneOption.value,this.selectedLenOption.value,pe(pe({},ie),Te));}catch(D){console.error(D),this.creditsService.handleCreditError(D);}finally{this.isLoading=!1,this.generating=!1;}}),this.currentResultIndex=0,this.generatedText=[],this.initInputs(),this.isBriefOpen=!0,this.isDragging=!1,this.generating=!1,this.toneMenuOpened=!1,this.lengthMenuOpen=!1,this.resultTitle="Results",this.showResultTooltip=!1,this.resultBtns=Bo("rewrite"),this.selectedBlogValue=Rt.vlog,this.loadingBusiness=!0;}ngOnInit(){return I(this,null,function*(){this.eventListeners.push(this.storyTrackCommunicationService.observeScriptDragStarted().subscribe(this.dragAiRewriteStarted),this.storyTrackCommunicationService.observeScriptDragEnded().subscribe(this.dragAiRewriteEnded),this.storyTrackCommunicationService.observeStoryChanged().subscribe(e=>this.story=e),this.storyTrackCommunicationService.observeBusiness().subscribe(e=>this.business=e),this.storyTrackCommunicationService.observeUserPlan().subscribe(e=>this.checkUserPlanAndLimits()),this.anonymousUserService.observeUserNotAnonymous().subscribe(this.setUserAnonymous)),yield this.setUserAnonymous(),yield this.setToneAndBusiness(),this.shouldStartIntoJs();});}ngOnDestroy(){this.eventListeners.forEach(e=>e.unsubscribe());}closeSidebar(){this.storyTrackCommunicationService.setAiSidebarOpen(!1),this.navigationHelperService.toggleMediaSidebar(Je.NONE,!0);}topScroll(){this.resultContainer?.nativeElement&&(this.resultContainer.nativeElement.scrollTop=0);}getIntoJsByAnonyomusPath(e){switch(e){case"tips":return{steps:[{element:this.stepIntro?.nativeElement,title:"Welcome to AI Writer!",intro:"Generate a script introducing your business. Start by choosing the length, tone, and type of script.",position:"right"},{element:this.stepName?.nativeElement,title:"Welcome to AI Writer!",intro:"Enter your name that will be used in the script.",position:"right"},{element:this.stepDescription?.nativeElement,title:"Almost done...",intro:"Give us a topic and we'll provide 5 script ideas. Choose one to generate a complete script.",position:"right"}],scrollTo:!0,tooltipClass:"customTooltip",showProgress:!1,exitOnOverlayClick:!1};case"news-flash":return{steps:[{element:this.stepIntro?.nativeElement,title:"Welcome to AI Writer!",intro:"Generate a script introducing your business. Start by choosing the length, tone, and type of script.",position:"right"},{element:this.stepName?.nativeElement,title:"Welcome to AI Writer!",intro:"Enter your name that will be used in the script.",position:"right"},{element:this.stepWebSearch?.nativeElement,title:"Use the web",intro:"Check this box if you want to add up-to-date news from the internet.",position:"right"},{element:this.stepDescription?.nativeElement,title:"Almost done..",intro:"Enter any specific information that you'd like to include.",position:"right"}],scrollTo:!0,tooltipClass:"customTooltip",showProgress:!1,exitOnOverlayClick:!1};case"sales-pitch":return{steps:[{element:this.stepIntro?.nativeElement,title:"Welcome to AI Writer!",intro:"Generate a script introducing your business. Start by choosing the length, tone, and type of script.",position:"right"},{element:this.stepName?.nativeElement,title:"Welcome to AI Writer!",intro:"Enter your name that will be used in the script.",position:"right"},{element:this.stepTarget.nativeElement,title:"Who are you?",intro:"Enter here the name of your company or product along with a brief description.",position:"right"},{element:this.stepDescription?.nativeElement,title:"What\u2019s your offer?",intro:"Enter the details of the service you want to promote to this potential customer.",position:"right"}],scrollTo:!0,tooltipClass:"customTooltip",showProgress:!1,exitOnOverlayClick:!1};case"vlog":return{steps:[{element:this.stepIntro?.nativeElement,title:"Welcome to AI Writer!",intro:"Generate a script introducing your business. Start by choosing the length, tone, and type of script.",position:"right"},{element:this.stepName?.nativeElement,title:"Welcome to AI Writer!",intro:"Enter your name that will be used in the script.",position:"right"},{element:this.stepBlogInput?.nativeElement,title:"Blog Link",intro:"Paste here your blog link (English only)",position:"right"},{element:this.stepBlogOrVlog?.nativeElement,title:"Type of video",intro:"Choose to:\n (1) Turn your blog post into a video script. Perfect for vlogging\n (2) Create a script for a short ad to promote your blog on social media or in newsletters.",position:"right"}],scrollTo:!0,tooltipClass:"customTooltip",showProgress:!1,exitOnOverlayClick:!1};case"rewrite":return{steps:[{element:this.stepIntro?.nativeElement,title:"Welcome to AI Writer!",intro:"Generate a script introducing your business. Start by choosing the length, tone, and type of script.",position:"right"},{element:this.stepName?.nativeElement,title:"Welcome to AI Writer!",intro:"Enter your name that will be used in the script.",position:"right"},{element:this.stepDescription?.nativeElement,title:"Welcome to BIGVU AI! \uD83D\uDC4B",intro:"Paste the text you want to rewrite here.",position:"right"}],scrollTo:!0,tooltipClass:"customTooltip",showProgress:!1,exitOnOverlayClick:!1};case"business-profile":default:return{steps:[{element:this.stepIntro?.nativeElement,title:"Welcome to AI Writer!",intro:"Generate a script introducing your business. Start by choosing the length, tone, and type of script.",position:"right"},{element:this.stepName?.nativeElement,title:"Welcome to AI Writer!",intro:"Enter your name that will be used in the script.",position:"right"},{element:this.stepDescription?.nativeElement,title:"Almost done...",intro:"Tell us about your company or product (50-200 characters). Stick to facts.",position:"right"}],scrollTo:!0,tooltipClass:"customTooltip",showProgress:!1,exitOnOverlayClick:!1};}}static{this.ɵfac=function(n){return new(n||i)(d(ei),d(ki),d(He),d($d),d(Ti),d(xt),d(Pe),d(bi),d(Kt),d(Ge),d(No),d(Ue),d(xi),d(wi),d(zi),d(zt),d(Qr),d(hi),d(Vt));};}static{this.ɵcmp=G({type:i,selectors:[["ai-rewrite-sidebar"]],viewQuery:function(n,t){if(n&1&&(Ye(Bf,5),Ye(Uf,5),Ye(Hf,5),Ye(zf,5),Ye($f,5),Ye(Wf,5),Ye(Gf,5),Ye(qf,5)),n&2){let o;Ne(o=Fe())&&(t.resultContainer=o.first),Ne(o=Fe())&&(t.stepIntro=o.first),Ne(o=Fe())&&(t.stepName=o.first),Ne(o=Fe())&&(t.stepDescription=o.first),Ne(o=Fe())&&(t.stepWebSearch=o.first),Ne(o=Fe())&&(t.stepTarget=
8o.first),Ne(o=Fe())&&(t.stepBlogOrVlog=o.first),Ne(o=Fe())&&(t.stepBlogInput=o.first);}},standalone:!0,features:[Ae,q],decls:24,vars:14,consts:[["resultDiv",""],["stepIntro",""],["resultempty",""],["optionTemplate",""],["tooltip","matTooltip"],["stepName",""],["stepBlogInput",""],["stepBlogOrVlog",""],["stepTarget",""],["stepDescription",""],["stepWebSearch",""],[1,"ai-sidebar-container","ai-rewrite-container"],[1,"ai-rewrite-header-btn"],[1,"ai-rewrite-sidebar-title"],["class","close-button-ai-sidebar",3,"click",4,"ngIf"],[3,"ngClass"],[1,"ai-main-container"],[1,"header-actions"],[1,"ai-open-brief",3,"click"],["alt","image",3,"src"],["class","ai-main-section",4,"ngIf"],["class","ai-generated-list",4,"ngIf","ngIfElse"],[1,"ai-sale-section"],[3,"remainingCredits","totalCredits","tooltipText","loading"],["class","ai-sale-component",4,"ngIf"],[3,"generating"],[1,"close-button-ai-sidebar",3,"click"],["src","/img/sidebar-close-icon.svg","alt","image"],[1,"ai-main-section"],[1,"ai-selection"],[1,"ai-select-container"],[1,"ai-controls-btn-section"],[1,"ai-controls-btn",3,"ngClass"],[1,"ai-control-img-container-txt"],[1,"ai-len-side-icon"],[1,"ai-control-menu-wrapper"],[3,"menuState","onSelection","shouldOpen","selectedOption","menuOptions","toggleMenuIconClass","contentStyle"],[1,"ai-control-img-container"],["alt","select-img",3,"src"],[1,"ai-control-menu-wrapper",3,"hidden"],[1,"shimmer-container",3,"hidden"],[1,"service-tutofrial-section"],[1,"ai-menu-wrapper"],[3,"onSelection","shouldOpen","selectedOption","menuOptions","toggleMenuIconClass","contentStyle"],[3,"onBtnClick","hidden","btnStyle","buttonMode"],["class","ai-form-element",4,"ngIf"],[1,"rewrite-btn-container"],[1,"ai-positive",3,"click","ngClass","disabled"],[1,"al-len-option-container"],[1,"name-option"],[1,"name-option",3,"ngClass"],["class","ai-tone-side-icon",3,"click",4,"ngIf"],[1,"ai-tone-side-icon",3,"click"],["src","/img/script-story-v2/edit-w.webp","alt","edit tone"],["matTooltipClass","tooltip-custom-black-script-long",3,"matTooltip","matTooltipPosition","viewValue","active"],[1,"ai-form-element"],[1,"ai-headline2"],[1,"ai-input-area"],[3,"readonly","inputFormControl","placeholder"],[1,"blog-toggles-container"],[1,"blog-toogle-input",3,"click"],[1,"checkbox-container-big"],[1,"checkmark-blue",3,"hidden"],[1,"blog-check-txt"],["matTooltipClass","tooltip-custom-black-script-long",3,"matTooltip","matTooltipPosition"],[1,"ai-headline2",3,"click"],["matTooltipClass","tooltip-custom-black-script-long",3,"hidden","matTooltip","matTooltipPosition"],["class","web-search",3,"click",4,"ngIf"],["mwlDroppable","","draggable","false",1,"ai-droppable-area",3,"drop","dragOverClass"],[1,"ai-text-area-wrapper",3,"hidden","readonly","inputFormControl","width","height","showValidationErrors","placeholder"],[1,"ai-text-area-wrapper-above",3,"hidden"],[1,"ai-drop-text"],[1,"web-search",3,"click"],[1,"checkbox-container"],[1,"checkmark",3,"hidden"],[1,"web-s-text"],[1,"ai-generated-list"],[1,"result-title-section"],[1,"ai-result-list-wrapper"],["class","ai-result-item-container",4,"ngFor","ngForOf"],[1,"ai-result-item-container"],[3,"onSetCurrentResultIndex","onGenerateTipText","currentResultIndex","index","isDeleting","rewriteItem"],[1,"ai-result-action-menu",3,"ngClass"],[3,"click",4,"ngFor","ngForOf"],[3,"click"],["matTooltipClass","tooltip-custom-black-only",3,"matTooltipPosition","matTooltip"],[1,"result-empty-wrapper"],[1,"result-empty-title"],[1,"result-empty-txt"],[1,"ai-sale-component"],["alt","image",3,"click","src"],[1,"upgrade-text"]],template:function(n,t){if(n&1){let o=U();r(0,"div",11)(1,"header")(2,"div",12)(3,"div",13),y(4," AI Writer "),s()(),M(5,Xf,3,0,"span",14),s(),r(6,"main",15,0)(8,"div",16,1)(10,"div",17)(11,"div",13),y(12," Brief "),s(),r(13,"button",18),S("click",function(){return T(o),P(t.toggleBrief());}),b(14,"img",19),s()(),M(15,lv,35,37,"div",20),s(),M(16,hv,8,5,"div",21)(17,mv,5,0,"ng-template",null,2,Re),s(),r(19,"footer")(20,"div",22),b(21,"app-ai-limit-circle",23),M(22,uv,4,1,"div",24),s()(),b(23,"app-process-fake-with-lottie",25),s();}if(n&2){let o=Be(18);a(5),c("ngIf",!t.isLoading),a(),c("ngClass",ue(12,Kf,!t.userIsLim
8ited)),a(8),c("src",t.briefImg,Ie),a(),c("ngIf",t.isBriefOpen),a(),c("ngIf",t.generatedText.length>0)("ngIfElse",o),a(5),c("remainingCredits",t.remainingCredits)("totalCredits",t.totalCredits)("tooltipText",t.tooltipText)("loading",t.isLoadingCredits),a(),c("ngIf",t.userIsLimited),a(),c("generating",t.generating);}},dependencies:[_e,we,es,Sl,Hi,Xt,Fn,ql,qi,Wn,ps,Le,Dl,As,la,Do,Ph,$i],styles:['.ai-rewrite-container[_ngcontent-%COMP%]{position:relative}.ai-rewrite-header-btn[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:12px}.ai-rewrite-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#253658;font-family:Inter-Bold}.result-title-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;margin-bottom:12px}.full-main[_ngcontent-%COMP%]{height:calc(100vh - 204px)!important}.header-actions[_ngcontent-%COMP%]{width:100%;height:32px;display:flex;justify-content:space-between;align-items:center}.ai-main-section[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-content:flex-start;gap:16px}.ai-input-wrapper[_ngcontent-%COMP%]{width:100%}.ai-selection[_ngcontent-%COMP%]{width:100%;display:flex;gap:12px;align-items:center}.ai-open-brief[_ngcontent-%COMP%]{width:32px;height:32px;padding:0}.ai-open-brief[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%}.ai-main-container[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-content:flex-start;gap:16px;padding:12px;background:#4481fd14;border-radius:10px;transition:all .3s ease-in-out}.ai-headline2[_ngcontent-%COMP%]{font-style:normal;font-weight:600;font-size:14px;line-height:17px;color:#253658;display:flex;align-items:center}.ai-select-container[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;align-content:flex-start;gap:12px}.rewrite-btn-container[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:flex-end;align-items:center}.ai-positive[_ngcontent-%COMP%]{background:#00abfe;color:#fff;width:106px;height:30px;border-radius:8px;text-align:center;font-family:Inter-Bold;font-weight:700;font-size:14px;line-height:14px}.ai-form-element[_ngcontent-%COMP%]{width:100%;display:flex;gap:12px;flex-direction:column;align-items:flex-start;justify-content:flex-start}.ai-input-area[_ngcontent-%COMP%]{width:100%} .ai-input-area .text-input-component{width:100%!important;background-color:#fff!important} .ai-text-area-wrapper .text-area-input-component{border-radius:10px!important;background-color:#fff!important;resize:none!important;border:none!important;max-width:346px!important} .ai-text-area-wrapper .text-area-input-component textarea{font-size:14px!important;color:#253658} .ai-menu-wrapper span.trigger-button-text{width:100%!important;margin-top:4px} .ai-menu-wrapper .triggers{padding:0 4px!important}.ai-generated-list[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:12px;margin-top:16px}.ai-result-list-wrapper[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:12px}.ai-result-item-container[_ngcontent-%COMP%]{position:relative;width:100%}.web-search[_ngcontent-%COMP%]{margin-left:2px;display:flex;align-items:center;justify-content:flex-start;width:80%}.web-s-text[_ngcontent-%COMP%]{font-size:14px;font-weight:400;cursor:pointer}.web-search[_ngcontent-%COMP%] .checkbox-container[_ngcontent-%COMP%]{cursor:pointer;width:16px;height:16px;margin:2px 8px 2px 0;border:1px solid #979797;position:relative}.web-search[_ngcontent-%COMP%] .checkbox-container[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]{background-color:#12b1fe;width:12px;height:12px;position:absolute;left:0;right:0;margin:1px auto}.ai-controls-btn-section[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:flex-start;align-items:center;gap:12px}.ai-controls-btn[_ngcontent-%COMP%]{display:flex;align-items:center;border-radius:20px;padding:2px 6px}.active-ai-controls-btn[_ngcontent-%COMP%]{background:#4481fd;padding-right:24px}.active-ai-controls-btn[_ngcontent-%COMP%] .ai-control-menu-wrapper[_ngcontent-%COMP%]{color:#fff!important}.ai-control-menu-wrapper[_ngcontent-%COMP%]{width:100%;max-width:120px;
8display:flex;align-items:center;text-overflow:ellipsis;white-space:nowrap;font-weight:400;font-size:14px;color:#253658} .ai-rewrite-container .ai-control-menu-wrapper select-menu .select-menu-container{height:38px} .ai-rewrite-container .ai-control-menu-wrapper select-menu .triggers{padding:10px 0} .ai-control-menu-wrapper .ai-control-menu-wrapper select-menu .trigger-button-text{margin-top:-2px} .ai-rewrite-container .ai-control-menu-wrapper select-menu span.trigger-button-text{width:100%!important} .ai-control-menu-wrapper .ai-control-menu-wrapper .select-menu .triggers .trigger-button-toggle-icon{margin:0} .ai-rewrite-container .ai-input-area .text-input-component .input-container input{width:100%!important} .ai-rewrite-container .ai-control-menu-wrapper select-menu span.trigger-button-toggle-icon{margin-left:0;margin-top:-2px}.ai-control-img-container-txt[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;width:32px;height:32px;min-width:32px;background:#fff;border-radius:50%}.ai-control-img-container[_ngcontent-%COMP%]{width:32px;height:32px;min-width:32px}.ai-control-img-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-position:center;object-fit:cover}.ai-explore[_ngcontent-%COMP%]{padding:4px 8px}.al-len-option-container[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px}.name-option[_ngcontent-%COMP%]{color:#253658;font-size:14px;font-weight:400}.ai-len-side-icon[_ngcontent-%COMP%]{color:#ff4d5b;font-weight:800;font-family:Inter-Bold;font-size:16px}.ai-tone-side-icon[_ngcontent-%COMP%]{width:24px;height:24px}.ai-tone-side-icon[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;object-position:center}.bold-ai[_ngcontent-%COMP%]{font-weight:600;font-family:Inter-Bold}.result-empty-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin-top:16px;gap:12px}.result-empty-title[_ngcontent-%COMP%]{color:#25365899;font-family:Inter-Bold;font-size:16px;font-weight:700}.result-empty-txt[_ngcontent-%COMP%]{color:#25365899;font-size:14px;font-weight:400;border-radius:10px;background:#7b8db114;display:flex;padding:12px;align-items:flex-start;gap:10px}.service-tutorial-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:stretch;justify-content:space-between}.blog-toggles-container[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;gap:16px;align-items:stretch;margin-top:16px}.blog-toogle-input[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:4px}.blog-toogle-input[_ngcontent-%COMP%] .checkbox-container-big[_ngcontent-%COMP%]{cursor:pointer;width:24px;height:24px;margin:2px 8px 2px 0;border:1px solid #979797;position:relative;border-radius:50%}.blog-toogle-input[_ngcontent-%COMP%] .checkbox-container-big[_ngcontent-%COMP%] .checkmark-blue[_ngcontent-%COMP%]{border-radius:50%;background-color:#4481fd;width:80%;height:80%;position:absolute;left:0;right:0;margin:2px auto}.blog-check-txt[_ngcontent-%COMP%]{color:#253658;font-size:14px;font-weight:400;cursor:pointer}.shimmer-container[_ngcontent-%COMP%]{width:120px;height:28px;margin-left:12px}.ai-text-area-wrapper-above[_ngcontent-%COMP%]{width:100%;height:164px;padding:32px 24px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:3px solid #4481FD!important;border-radius:20px;background:#4481fd14}.ai-drop-text[_ngcontent-%COMP%]{color:#7b8db1;font-feature-settings:"clig" off,"liga" off;font-size:20px;font-weight:400;line-height:28px}',".ai-sidebar-container[_ngcontent-%COMP%]{width:405px;margin-top:40px;background:#fff;height:calc(100vh - 124px);overflow:hidden;box-shadow:0 0 40px #0000001a;border-radius:20px;padding:24px 0 24px 12px} aside#whiteboard, aside#ai-checker, aside#ai-checker-v2, aside#ai-rewrite{left:-664px!important;width:360px!important;background:transparent!important;z-index:31} aside#emotions{left:-664px!important;width:432px!important;background:transparent!important;z-index:31} aside#audiogram{left:-664px!important;width:536px!important;background:transparent!important;z-index:31}main[_ngcontent-%COMP%]{margin-top:42px;width:100%;height:calc(100vh - 254px);position:relative;overflow-y:scroll;overflow-x:hidden;padding:0 4px}main[_ngcontent-%COMP%]::-webkit-scrollbar{width:11px}header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;height:60px;position:absolute;width:100%;top:0;left:0;background:#fff;padding:0 15px}footer[_ngcontent-%COMP%]{width:100%;z-index:1;background:#fff;box-shadow:0 0 40px #0000001a;position:absolute;bottom:0;left:0;height:60px}.ai-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#00abfe;font-family:Inter-Bold;width:110px} .ai-text-area-wrapper .text-area-input-component .mat-form-field-label{white-space:pre-wrap!important}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar{width:3px;padding-left:4px}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#00abfe}.ai-result-action-menu[_ngcontent-%COMP%]{position:absolute;right:12px;top:-18px;background:#fff;box-shadow:0 0 24px #0000002e;border-radius:10px;width:100px;height:28px;display:flex;align-items:center;justify-content:space-evenly;cursor:pointer}.ai-result-action-menu[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:0;margin:0;width:20px;height:20px}.ai-result-action-menu[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;background-repeat:no-repeat;padding:0;display:block}
8.ai-result-action-menu[_ngcontent-%COMP%] .delete[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-d.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .past[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-past.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .whiteboard[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-m.svg)}.ai-menu-wrapper[_ngcontent-%COMP%]{width:100%;max-width:240px;text-overflow:ellipsis;white-space:nowrap;border:1px solid rgba(37,54,88,.6);background:#fff;border-radius:20px;padding:2px 6px;font-weight:400;font-size:14px;color:#253658}.fade[_ngcontent-%COMP%]{opacity:0;transition:all .5s ease-in-out}.hide[_ngcontent-%COMP%]{display:none!important}.editing[_ngcontent-%COMP%]{cursor:default!important}.disabled[_ngcontent-%COMP%]{opacity:.4}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%], .ai-result-wrapper-active[_ngcontent-%COMP%]{border:2px solid rgba(0,171,254,.6)!important;background:#fff!important;cursor:text!important}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-result-wrapper-active[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-droppable-area[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:164px}.ai-droppable-class[_ngcontent-%COMP%]{transform:scale(.9);transition:all .3s ease-in-out}.ai-droppable-area[_ngcontent-%COMP%]{width:100%}.ai-sale-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;height:100%;padding:0 12px}.ai-sale-component[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;gap:14px}.ai-sale-section[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;cursor:pointer}.upgrade-text[_ngcontent-%COMP%]{max-width:100px;font-weight:500;font-size:12px;line-height:15px;color:#253658}.ai-result-list-wrapper[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:12px}.ai-result-item-container[_ngcontent-%COMP%]{position:relative;width:100%}"]});}}return i;})();ae();Bt();Nn();ro();Ln();Bt();at();Ui();Bi();Ei();no();ae();lr();J();ae();var gv=i=>({disabled:i}),da=class extends Tt{},Eh=(()=>{class i extends Pt{constructor(e){super(e),this.data=e,this.formControl=new Ht(e.title,[pi.required]);}static{this.ɵfac=function(n){return new(n||i)(d(yt));};}static{this.ɵcmp=G({type:i,selectors:[["app-change-name-clone"]],standalone:!0,features:[Ae,q],decls:11,vars:7,consts:[[1,"dialog-close-button-container"],[1,"dialog-close-button",3,"click"],[1,"confirmation-header"],[1,"input-main"],[3,"inputFormControl","label","showClearButton"],[1,"button-container"],["id","confirmation-cancel-button","type","button",3,"click"],["id","confirmation-submit-button","type","button",1,"b",3,"click","disabled","ngClass"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),S("click",function(){return t.close();}),s()(),r(2,"div",2),y(3,"Change Name"),s(),r(4,"div",3),b(5,"text-input",4),s(),r(6,"div",5)(7,"button",6),S("click",function(){return t.close();}),y(8," Cancel "),s(),r(9,"button",7),S("click",function(){return t.submit(t.formControl.value);}),y(10," Save "),s()()),n&2&&(a(5),c("inputFormControl",t.formControl)("label","Enter Title")("showClearButton",!1),a(4),c("disabled",t.formControl.invalid)("ngClass",ue(5,gv,t.formControl.invalid)));},dependencies:[xe,we,Fn],styles:[".b[_ngcontent-%COMP%]{color:#fff!important;text-align:center!important;font-size:12px!important;font-weight:700!important;border-radius:10px!important;border:2px solid #4481FD!important;background:#4481fd!important}.w[_ngcontent-%COMP%]{color:#4481fd!important;text-align:center!important;font-size:12px!important;font-weight:700!important;border-radius:10px!important;border:2px solid #4481FD!important;background:#fff!important;opacity:1!important}.confirmation-dialog-container[_ngcontent-%COMP%]{position:absolute!important;top:170px}.confirmation-dialog-container[_ngcontent-%COMP%] mat-dialog-container[_ngcontent-%COMP%]{border-radius:10px!important}.confirmation-dialog-close[_ngcontent-%COMP%]{top:7px;right:20px}.confirmation-dialog-close[_ngcontent-%COMP%]:before, .confirmation-dialog-close[_ngcontent-%COMP%]:after{height:15px}.confirmation-msg[_ngcontent-%COMP%]{font-size:16px;font-weight:500;margin:0 20px;max-width:450px}.button-container[_ngcontent-%COMP%]{display:flex;justify-content:center;gap:5px;margin-top:12px;align-content:center}.button-container[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin:0 5px}.confirmation-btn[_ngcontent-%COMP%]{display:flex;justify-content:center}.confirmation-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:126px;height:32px;background-color:#12b1fe;border-radius:22.5px;color:#fff}.confirmation-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover{background-color:#fff!important;color:#12b1fe!important;border:1px solid #12b1fe!important}.confirmation-header[_ngcontent-%COMP%]{font-size:18px;font-weight:600;text-align:center;margin-bottom:15px}.input-main[_ngcontent-%COMP%]{margin-bottom:24px;width:400px}.input-main[_ngcontent-%COMP%] .text-input-container[_ngcontent-%COMP%]{width:100%}@media only screen and (max-width: 1023px){.confirmation-dialog-close[_ngcontent-%COMP%]{right:-23px!important}.confirmation-msg[_ngcontent-%COMP%]{font-size:14px;margin-bottom:20px}}"]});}}return i;})();Bi();Ui();Ei();J();var pa=class extends Tt{},Ah=(()=>{class i extends Pt{constructor(e){super(e),this.data=e;}static{this.ɵfac=function(n){return new(n||i)(d(yt));};}static{this.ɵcmp=G({type:i,selectors:[["app-delete-voice-dialog"]],standalone:!0,features:[Ae,q],decls:11,vars:1,consts:[[1,"dialog-close-button-container"],[1,"dialog-close-button",3,"click"],[1,"confirmation-header"],[1,"input-main"],[1,"button-container"],["id","confirmation-cancel-button","type","button",3,"click"],["id","confirmation-submit-button","type","button",1,"c",3,"click"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),S("click",function(){return t.close();}),s()(),r(2,"div",2),y(3,"Delete Cloned Voice"),s(),r(4,"div",3),y(5),s(),r(6,"div",4)(7,"button",5),S("click",function(){return t.close();}),y(8," Cancel "),s(),r(9,"button",6),S("click",function(){return t.submit();}),y(10," Delete "),s()()),n&2&&(a(5),se(" ",t.data.msg,` 9`));},styles:[".c[_ngcontent-%COMP%]{color:#fff!important;text-align:center!important;font-size:12px!important;font-weight:700!important;border-radius:10px!important;border:2px solid rgba(255,77,91,1)!important;background:#ff4d5b!important;opacity:1!important}.d[_ngcontent-%COMP%]{color:#ff4d5b!important;text-align:center!important;font-size:12px!important;font-weight:700!important;border-radius:10px!important;border:2px solid rgba(255,77,91,1)!important;background:#fff!important}.d[_ngcontent-%COMP%]:hover{color:#ff4d5b!important}.confirmation-dialog-container[_ngcontent-%COMP%]{position:absolute!important;top:170px}.confirmation-dialog-container[_ngcontent-%COMP%] mat-dialog-container[_ngcontent-%COMP%]{border-radius:10px!important}.confirmation-dialog-close[_ngcontent-%COMP%]{top:7px;right:20px}.confirmation-dialog-close[_ngcontent-%COMP%]:before, .confirmation-dialog-close[_ngcontent-%COMP%]:after{height:15px}.confirmation-msg[_ngcontent-%COMP%]{font-size:16px;font-weight:500;margin:0 20px;max-width:450px}.button-container[_ngcontent-%COMP%]{display:flex;justify-content:center;gap:5px;margin-top:12px;align-content:center}.button-container[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin:0 5px}.confirmation-btn[_ngcontent-%COMP%]{display:flex;justify-content:center}.confirmation-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:126px;height:32px;background-color:#12b1fe;border-radius:22.5px;color:#fff}.confirmation-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover{background-color:#fff;color:#12b1fe;border:1px solid #12b1fe}.confirmation-header[_ngcontent-%COMP%]{font-size:18px;font-weight:600;text-align:center;margin-bottom:15px}.input-main[_ngcontent-%COMP%]{margin-bottom:24px;width:400px}.input-main[_ngcontent-%COMP%] .text-input-container[_ngcontent-%COMP%]{width:100%}@media only screen and (max-width: 1023px){.confirmation-dialog-close[_ngcontent-%COMP%]{right:-23px!important}.confirmation-msg[_ngcontent-%COMP%]{font-size:14px;margin-bottom:20px}}"]});}}return i;})();no();rr();rl();al();J();var Dh=(()=>{class i{constructor(e,n,t,o,h,k,f){this.adminRequestsService=n,this.deskManagerHelperService=t,this.audioGramDataService=o,this.eventsService=h,this.dialogHelperService=k,this.assetsRepo=f,this.EVENT_PATH=this.eventsService.events.audiogram,this.topicOptions=[],this.activeTopicOptions=[],this.unsubscribe$=new Ze(),this.assetSearchField=new Ht(""),this.getAssetsParams=()=>new qr().useRoot(new Kr().deskId(this.deskManagerHelperService.getSelectedWorkspaceId()).sortBy(as.CREATED_AT).sortDirection(cs.DOWN).level(this.assetsLevel.join(",")).is([Al.FAVORITE]).favorite(this.showOnlyFavorites)).useCommon(new pr(dr.Commom).fileType([ls.VOICE_CLONE]).title(this.assetSearchField.value||void 0).status(ds.COMPLETE)).useSystem(new pr(dr.System).language(this.selectedLanguage?.value?[this.selectedLanguage?.value]:void 0).descriptive(this.selectedStyles?.map(v=>v.value)||void 0).useCase(this.topicOptions?.filter(v=>v.isActive)?.map(v=>v.value)||void 0).gender(this.selectedGender?.value?[this.selectedGender.value]:void 0)).build(),this.getAssetsPromise=()=>this.assetsRepo.pullAssetsList(this.getAssetsParams()),this.getAssets=()=>I(this,null,function*(){try{this.isLoading=!0,this.audioGramAssets=[];let m=yield this.getAssetsPromise();this.assetsApiCursorData=m.metadata,m.result&&m.result.length>0&&m.result.forEach(v=>{this.audioGramAssets.push($a(v,v.level.includes("system")?"library":"cloned"));});}catch(m){console.error("Failed to fetch assets",m);}finally{this.isLoading=!1;}}),this.getMoreAssets=()=>I(this,null,function*(){if(this.assetsApiCursorData?.hasNext&&!this.isOnPageLoading&&!this.isLoading)try{this.isOnPageLoading=!0;let m=yield this.assetsRepo.getMoreAssets(this.assetsApiCursorData.nextUrl);this.assetsApiCursorData=m.metadata,m.result&&m.result.length>0&&m.result.forEach(v=>{this.audioGramAssets.push($a(v,v.level.includes("system")?"library":"cloned"));});}catch(m){this.resultsPage=-1,console.error("Failed to load more assets",m);}finally{this.isOnPageLoading=!1;}}),this.playAudioVent=(m,v)=>{this.eventsService.log(this.EVENT_PATH.voiceGeneratorVoiceClick,{storyId:this.storyId,voiceType:m.parent,button:"preview",voiceIndex:v,voice:m.title});},this.deleteAudio=(m,v)=>{this.eventsService.log(this.EVENT_PATH.voiceGeneratorVoiceClick,{storyId:this.storyId,voiceType:m.parent,button:"delete",voiceIndex:v,voice:m.title});let V=new pa();V.msg=`Are you sure you want to Delete cloned voice named \u201C${m.title}\u201D`,V.onSubmit=()=>this.deleteAudioAccept(m,v),V.onClose=this.dialogHelperService.close;let te=new We();te.panelClass="change-confirmation-dialog",this.dialogHelperService.open(V,Ah,te);},this.deleteAudioAccept=(m,v)=>I(this,null,function*(){this.dialogHelperService.close();try{this.eventsService.log(this.EVENT_PATH.voiceGeneratorVoiceDelete,{storyId:this.storyId,voiceIndex:v,voice:m.title}),this.isLoading=!0,yield this.adminRequestsService.deleteAsset({assetId:m.id}),this.getAssets();}catch(V){console.error(V);}finally{this.isLoading=!1;}}),this.changeNameAudio=(m,v)=>{this.eventsService.log(this.EVENT_PATH.voiceGeneratorVoiceClick,{storyId:this.storyId,voiceType:m.parent,button:"change-name",voiceIndex:v,voice:m.title});let V=new da();V.title=m.title,V.onClose=this.dialogHelperService.close,V.onSubmit=$=>this.changeNameAudioAccept(m,v,$);let te=new We();te.panelClass="change-confirmation-dialog",this.dialogHelperService.open(V,Eh,te);},this.changeNameAudioAccept=(m,v,V)=>I(this,null,function*(){this.dialogHelperService.close();try{this.isLoading=!0,yield this.adminRequestsService.updateAsset({assetId:m.id,title:V}),this.audioGramAssets[v].title=V;}catch(te){console.error(te);}finally{this.isLoading=!1;}}),this.selectAudio=(m,v)=>{this.voiceCloneAssetId?.id===m.id?this.audioGramDataService.setVoiceCloneAssetId(null):(this.eventsService.log(this.EVENT_PATH.voiceGeneratorVoiceClick,{storyId:this.storyId,voiceType:m.parent,button:"choose",voiceIndex:v,voice:m.title}),this.audioGramDataService.setVoiceCloneAssetId(m));},this.editAudio=(m,v)=>{this.eventsService.log(this.EVENT_PATH.voiceGeneratorVoiceClick,{storyId:this.storyId,voiceType:m.parent,button:"edit",voiceIndex:v,voice:m.title}),this.audioGramDataService.setEditAsset({voice:m,index:v});},this.onPlayClicked=(m,v)=>{this.eventsService.log(this.EVENT_PATH.voiceGeneratorPreviewPlay,{storyId:this.storyId,voiceType:m.parent,voice:m.title,previewType:v});},this.saveToFavorites=(m,v)=>I(this,null,function*(){try{this.eventsService.log(this.EVENT_PATH.voiceGeneratorVoiceClick,{storyId:this.storyId,voiceType:m.parent,button:"favorite",voiceIndex:v,voice:m.title}),this.isLoading=!0,m.isFavorite?yield this.adminRequestsService.removeFavorite({entityId:m.id,entityType:"asset"}):yield this.adminRequestsService.addFavorite({entityId:m.id,entityType:"asset"}),this.audioGramAssets[v].isFavorite=!m.isFavorite;}catch(V){console.error(V);}finally{this.isLoading=!1;}}),this.onSearch=()=>{},this.assetsLevel=e,this.resultsPage=0,this.isLoading=!1,this.showOnlyFavorites=!1,this.isOnPageLoading=!1,this.audioGramAssets=[],this.isAnonymous=!1,this.detectedLanguage="en",this.audioGramDataService.getVoiceCloneAssetId().pipe(me(this.unsubscribe$)).subscribe(m=>this.voiceCloneAssetId=m),this.audioGramDataService.getStoryId().pipe(me(this.unsubscribe$)).subscribe(m=>this.storyId=m),this.audioGramDataService.getIsAnonymous().pipe(me(this.unsubscribe$)).subscribe(m=>
9this.isAnonymous=m),this.assetSearchField.valueChanges.pipe(Xi(500),me(this.unsubscribe$)).subscribe(m=>{this.onSearch();});}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.unsubscribe();}static{this.ɵfac=function(n){Hc();};}static{this.ɵdir=Li({type:i});}}return i;})();J();var Lh=(()=>{class i{constructor(){}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["app-audiogram-shimmer"]],standalone:!0,features:[q],decls:7,vars:0,consts:[[1,"audio-simmer"],[1,"asset-image"],[1,"title-section-col"],[1,"title-section"],[1,"wave"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"header"),b(2,"div",1),r(3,"section",2),b(4,"div",3)(5,"div",3),s()(),b(6,"div",4),s());},styles:[".audio-simmer[_ngcontent-%COMP%]{width:500px;position:relative;display:flex;padding:9px;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:10px;border-radius:6px;background:#4481fd14;overflow:hidden}.asset-image[_ngcontent-%COMP%]{width:38px;height:38px;border-radius:50%;background:#4481fd33;flex-shrink:0}.title-section[_ngcontent-%COMP%]{width:110px;height:17px;display:flex;flex-direction:column;gap:3px;background:#4481fd33;flex-shrink:0}.title-section-col[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:flex-start;gap:4px;flex-shrink:0}.audio-simmer[_ngcontent-%COMP%] header[_ngcontent-%COMP%]{width:100%;height:38px;display:flex;align-items:center;gap:7px;flex-shrink:0;border-radius:6px}.audio-simmer[_ngcontent-%COMP%] main[_ngcontent-%COMP%]{width:100%;height:44px;overflow:hidden;display:flex;flex-wrap:wrap;gap:5px 7px;background:#4481fd33;flex-shrink:0;border-radius:6px}.wave[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffff26;transform:translate(-100%);animation:_ngcontent-%COMP%_wave 1.5s infinite}@keyframes _ngcontent-%COMP%_wave{0%{transform:translate(-100%)}50%{transform:translate(100%)}to{transform:translate(100%)}}"]});}}return i;})();ae();Aa();J();ae();J();ae();var fv=["audio"];function vv(i,u){if(i&1&&(r(0,"div",14),y(1),s()),i&2){let e=p();a(),de(e.subTitle);}}function _v(i,u){if(i&1&&(r(0,"div",23),y(1),s()),i&2){let e=u.$implicit;gt(e.type),a(),se(" ",e.text," ");}}function Cv(i,u){if(i&1){let e=U();r(0,"div",24)(1,"button",25),S("click",function(t){return T(e),p(2).startEdit(),P(t.stopPropagation());}),b(2,"img",26),r(3,"span"),y(4,"Edit audiogram"),s()(),r(5,"button",25),S("click",function(t){return T(e),p(2).renameVoice(),P(t.stopPropagation());}),b(6,"img",27),r(7,"span"),y(8,"Rename"),s()(),r(9,"button",28),S("click",function(t){return T(e),p(2).deleteVoiceAudio(),P(t.stopPropagation());}),b(10,"img",29),r(11,"span"),y(12,"Delete"),s()()();}if(i&2){let e=p(2);a(2),c("src",e.editIcon,Ie),a(4),c("src",e.changeNameIcon,Ie),a(4),c("src",e.deleteIcon,Ie);}}function bv(i,u){if(i&1){let e=U();r(0,"main")(1,"app-audio-player",15),S("clickedPlay",function(){T(e);let t=p();return P(t.clickedPlay());})("ended",function(){T(e);let t=p();return P(t.onAudioEnded());}),s(),r(2,"div",16),M(3,_v,2,3,"div",17),s(),r(4,"div",18)(5,"div",19)(6,"div",20),b(7,"img",21),s()(),M(8,Cv,13,3,"div",22),s()();}if(i&2){let e=p();a(),nt("width",100,"%"),c("url",e.audioUrl)("useSmallPlayBtn",!0),a(2),c("ngForOf",e.topics),a(4),c("src",e.readyPreviewImage,Ie),a(),c("ngIf",e.parent==="cloned");}}var Vh=(()=>{class i{constructor(){this.topics=[],this.favoriteChange=new be(),this.onSelect=new be(),this.onUpload=new be(),this.onDeleteAudio=new be(),this.onChangeName=new be(),this.onPreview=new be(),this.onEdit=new be(),this.onPlayClicked=new be(),this.playIcon=ep,this.stopIcon=tp,this.favIcon=Vs,this.favIconActive=Ls,this.deleteIcon=np,this.editIcon=rp,this.changeNameIcon=op,this.uploadIcon=ip,this.expended=!1,this.extendedClassOpened="grey-triangle opened",this.extendedClassClosed="grey-triangle closed",this.changeFavoriteStatus=()=>{this.favoriteChange.emit(!this.isFavorite);},this.clickedPlay=()=>{this.onPlayClicked.next();},this.onAudioEnded=()=>{this.isPlaying=!1;},this.hover=()=>{this.isHovered=!0;},this.unHover=()=>{this.isHovered=!1;},this.startUpload=()=>{this.onUpload.emit();},this.selectVoice=()=>{this.onSelect.emit();},this.deleteVoiceAudio=()=>{this.onDeleteAudio.emit();},this.renameVoice=()=>{this.onChangeName.emit();},this.setExpended=()=>{this.expended=!this.expended;},this.startEdit=()=>{this.onEdit.emit();};}ngOnChanges(e){let{isActive:n}=e;n&&n.currentValue===!1&&this.isPlaying&&(this.isPlaying=!1,this.audioRef.nativeElement.pause()),this.topics&&this.topics.length>0&&(this.subTitle=this.topics.filter(t=>t.text)?.map(t=>t.text.toUpperCase())?.join(", ")||"");}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["app-voice-asset"]],viewQuery:function(n,t){if(n&1&&Ye(fv,7),n&2){let o;Ne(o=Fe())&&(t.audioRef=o.first);}},inputs:{parent:"parent",isActive:"isActive",id:"id",imageUrl:"imageUrl",title:"title",isFavorite:"isFavorite",topics:"topics",audioUrl:"audioUrl",aspectRatio:"aspectRatio",backgroundAsset:"backgroundAsset",primaryColor:"primaryColor",readyPreviewImage:"readyPreviewImage"},outputs:{favoriteChange:"favoriteChange",onSelect:"onSelect",onUpload:"onUpload",onDeleteAudio:"onDeleteAudio",onChangeName:"onChangeName",onPreview:"onPreview",onEdit:"onEdit",onPlayClicked:"onPlayClicked"},standalone:!0,features:[Ut,q],decls:16,vars:8,consts:[[1,"voice-asset-wrapper"],[3,"click"],[1,"selector"],["src","img/audiogram/selected-v.svg","alt","selected",3,"hidden"],[1,"asset-image"],["alt","asset-image",3,"src"],[1,"title-section-col"],[1,"title"],["class","sub-tags",4,"ngIf"],[1,"always-show"],[1,"favorite",3,"click"],["alt","favorite",3,"src"],[1,"delete-image",3,"click"],[4,"ngIf"],[1,"sub-tags"],[3,"clickedPlay","ended","url","useSmallPlayBtn"],[1,"topic-container"],["class","topic",3,"class",4,"ngFor","ngForOf"],[1,"preview-edit"],[1,"preview-audiogram","bg-horizontal"],[1,"backround-wrapper"],["alt","wave-profile",3,"src"],["class","edit-buttons",4,"ngIf"],[1,"topic"],[1,"edit-buttons"],[1,"preview-edit-btn",3,"click"],["alt","edit",3,"src"],["alt","rename",3,"src"],[1,"delete-edit-btn",3,"click"],["alt","delete",3,"src"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"header",1),S("click",function(){return t.selectVoice();}),r(2,"div",2),b(3,"img",3),s(),r(4,"div",4),b(5,"img",5),s(),r(6,"section",6)(7,"div",7),y(8),s(),M(9,vv,2,1,"div",8),s(),r(10,"div",9)(11,"div",10),S("click",function(h){return t.changeFavoriteStatus(),h.stopPropagation();}),b(12,"img",11),s(),r(13,"div",12),S("click",function(h){return t.setExpended(),h.stopPropagation();}),b(14,"i"),s()()(),M(15,bv,9,7,"main",13),s()),n&2&&(a(3),c("hidden",!t.isActive),a(2),c("src",t.imageUrl,Ie),a(3),de(t.title),a(),c("ngIf",t.subTitle),a(3),c("src",t.isFavorite?t.favIconActive:t.favIcon,Ie),a(2),gt(t.expended?t.extendedClassOpened:t.extendedClassClosed),a(),c("ngIf",t.expended));},dependencies:[xe,Le,_e,Bs],styles:[".voice-asset-wrapper[_ngcontent-%COMP%]{width:460px;position:relative;display:flex;padding:9px;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:15px;border-radius:6px;background:#fff;cursor:pointer;border:1px solid rgba(123,141,177,.2)}.voice-asset-wrapper[_ngcontent-%COMP%] header[_ngcontent-%COMP%]{width:100%;min-height:38px;display:flex;align-items:center;position:relative;gap:8px} .voice-asset-wrapper input[type=range]{width:400px!important}.voice-asset-wrapper[_ngcontent-%COMP%] main[_ngcontent-%COMP%]{width:100%;overflow:hidden;display:flex;flex-direction:column;align-items:flex-start;gap:12px}
9.delete-image[_ngcontent-%COMP%], .change-name[_ngcontent-%COMP%]{width:18px;height:18px;cursor:pointer;flex-shrink:0}.favorite[_ngcontent-%COMP%]{width:14px;height:14px;cursor:pointer;margin-top:2px;flex-shrink:0}.asset-image[_ngcontent-%COMP%]{width:38px;height:38px;border-radius:50%;overflow:hidden;cursor:pointer;flex-shrink:0;position:relative}.upload-icon-over[_ngcontent-%COMP%]{width:38px!important;height:38px!important;background:#000;z-index:1;opacity:.5;position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center}.upload-icon-over[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:24px!important;height:24px!important}.favorite[_ngcontent-%COMP%] img[_ngcontent-%COMP%], .change-name[_ngcontent-%COMP%] img[_ngcontent-%COMP%], .delete-image[_ngcontent-%COMP%] img[_ngcontent-%COMP%], .sound-image[_ngcontent-%COMP%] img[_ngcontent-%COMP%], .asset-image[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%}.title-section[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;align-items:center;gap:12px}.title-section-col[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:flex-start;gap:4px}.always-show[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;align-items:center;gap:4px;z-index:1;flex-shrink:0;flex-grow:1}.small-show[_ngcontent-%COMP%]{width:20%!important}.title[_ngcontent-%COMP%]{color:#253658;font-size:12px;font-weight:600;line-height:17px;width:100%;overflow:hidden;text-overflow:ellipsis}.sub-tags[_ngcontent-%COMP%]{color:#7b8db199;font-size:11px;font-weight:400;line-height:17px;height:17px;width:100%;overflow:hidden;text-overflow:ellipsis}.short-title[_ngcontent-%COMP%]{width:90px;max-width:95px!important}.short-title-hovered[_ngcontent-%COMP%]{width:80px;max-width:85px!important}.sound-image[_ngcontent-%COMP%]{width:18px;height:18px;cursor:pointer;z-index:1}.topic-container[_ngcontent-%COMP%]{width:100%;display:flex;flex-wrap:wrap;gap:12px}.topic[_ngcontent-%COMP%]{height:fit-content;font-size:10px;font-weight:400;line-height:14px;display:flex;padding:2px 4px;justify-content:center;align-items:center;border-radius:3px;background:#674ff812;text-transform:capitalize}.topicLang[_ngcontent-%COMP%]{color:#ff00f566}.topicGender[_ngcontent-%COMP%]{color:#907dffba}.topicCase[_ngcontent-%COMP%]{color:#2e73ff99}audio[_ngcontent-%COMP%]{display:none}.isActive[_ngcontent-%COMP%]{border:3px solid #4481FD!important}.selector[_ngcontent-%COMP%]{border:1px solid grey;width:24px;height:24px;border-radius:50%;flex-shrink:0;cursor:pointer}.selector[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;object-position:center}.preview-edit[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between}.preview-edit-btn[_ngcontent-%COMP%]{display:flex;width:160px;padding:11px 16px 11px 10px;justify-content:center;align-items:center;gap:4px;border-radius:4px;background:#7b8db114;color:#253658;text-align:center;font-size:13px;font-weight:600;line-height:15.6px;letter-spacing:-.13px}.delete-edit-btn[_ngcontent-%COMP%]{display:flex;width:160px;padding:11px 16px 11px 10px;justify-content:center;align-items:center;gap:4px;border-radius:4px;background:#ff4d5b14;color:#253658;text-align:center;font-size:13px;font-weight:600;line-height:15.6px;letter-spacing:-.13px}.edit-buttons[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.preview-audiogram[_ngcontent-%COMP%]{background:#f4f6f9;position:relative;flex-shrink:0;border-radius:10px;overflow:hidden;margin:0 auto}.bg-vertical[_ngcontent-%COMP%]{height:276px;aspect-ratio:9 / 16}.bg-horizontal[_ngcontent-%COMP%]{width:256px;aspect-ratio:16 / 9}.bg-square[_ngcontent-%COMP%]{height:276px;width:276px}.backround-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;z-index:1}.backround-wrapper[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%}.wave-wrapper[_ngcontent-%COMP%]{position:absolute;top:50%;left:50%;transform:translate(-40%,-50%);z-index:2}.preview-edit[_ngcontent-%COMP%] .wave-wrapper[_ngcontent-%COMP%] .p-big-circle[_ng
9content-%COMP%]{width:100px;height:100px}.preview-edit[_ngcontent-%COMP%] .wave-wrapper[_ngcontent-%COMP%] .above-image[_ngcontent-%COMP%]{width:120px;height:120px}.preview-edit[_ngcontent-%COMP%] .wave-wrapper[_ngcontent-%COMP%] .preview[_ngcontent-%COMP%]{width:110px;height:110px}"]});}}return i;})();lr();J();Mi();bn();ht();at();qt();var Sv=i=>({"active-ai-controls-btn":i}),xv=(i,u)=>({"longer-list":i,"longer-filter-list":u}),Nh=i=>({"t-hidden":i}),oc=i=>({"t-active":i});function yv(i,u){if(i&1){let e=U();r(0,"div",39),S("click",function(){T(e);let t=p();return P(t.setOnlyFavorite());}),r(1,"span"),y(2,"Only Favorites"),s(),b(3,"img",40),s();}}function kv(i,u){if(i&1){let e=U();r(0,"div",39),S("click",function(){T(e);let t=p();return P(t.removeLanguage(t.selectedLanguage));}),r(1,"span"),y(2),s(),b(3,"img",40),s();}if(i&2){let e=p();a(2),de(e.selectedLanguage==null?null:e.selectedLanguage.name);}}function wv(i,u){if(i&1){let e=U();r(0,"div",39),S("click",function(){T(e);let t=p();return P(t.removeGender(t.selectedGender));}),r(1,"span"),y(2),s(),b(3,"img",40),s();}if(i&2){let e=p();a(2),de(e.selectedGender==null?null:e.selectedGender.name);}}function Tv(i,u){if(i&1){let e=U();r(0,"div",41),S("click",function(){let t=T(e),o=t.$implicit,h=t.index,k=p();return P(k.removeStyle(o,h));}),r(1,"span"),y(2),s(),b(3,"img",40),s();}if(i&2){let e=u.$implicit;c("ngClass",ue(2,Nh,!e.isActive)),a(2),de(e.name);}}function Pv(i,u){if(i&1){let e=U();r(0,"div",41),S("click",function(){let t=T(e),o=t.$implicit,h=t.index,k=p();return P(k.removeSelectedTopic(o,h));}),r(1,"span"),y(2),s(),b(3,"img",40),s();}if(i&2){let e=u.$implicit;c("ngClass",ue(2,Nh,!e.isActive)),a(2),de(e.name);}}function Ov(i,u){if(i&1){let e=U();r(0,"div",41),S("click",function(){let t=T(e).$implicit,o=p();return P(o.setGender(t));}),y(1),s();}if(i&2){let e=u.$implicit,n=p();c("ngClass",ue(2,oc,e.value===(n.selectedGender==null?null:n.selectedGender.value))),a(),se(" ",e.name," ");}}function Iv(i,u){if(i&1){let e=U();r(0,"div",41),S("click",function(){let t=T(e).index,o=p();return P(o.setStyle(t));}),y(1),s();}if(i&2){let e=u.$implicit;c("ngClass",ue(2,oc,e.isActive)),a(),se(" ",e.name," ");}}function Mv(i,u){if(i&1){let e=U();r(0,"div",41),S("click",function(){let t=T(e).index,o=p();return P(o.setTopicStatus(t));}),y(1),s();}if(i&2){let e=u.$implicit;c("ngClass",ue(2,oc,e.isActive)),a(),se(" ",e.name," ");}}function Ev(i,u){if(i&1){let e=U();r(0,"app-voice-asset",42),S("onPreview",function(){let t=T(e),o=t.$implicit,h=t.index,k=p();return P(k.playAudioVent(o,h));})("onDeleteAudio",function(){let t=T(e),o=t.$implicit,h=t.index,k=p();return P(k.deleteAudio(o,h));})("favoriteChange",function(){let t=T(e),o=t.$implicit,h=t.index,k=p();return P(k.saveToFavorites(o,h));})("onChangeName",function(){let t=T(e),o=t.$implicit,h=t.index,k=p();return P(k.changeNameAudio(o,h));})("onSelect",function(){let t=T(e),o=t.$implicit,h=t.index,k=p();return P(k.selectAudio(o,h));})("onEdit",function(){let t=T(e),o=t.$implicit,h=t.index,k=p();return P(k.editAudio(o,h));})("onPlayClicked",function(){let t=T(e),o=t.$implicit,h=t.index,k=p();return P(k.onPlayClicked(o,h));}),s();}if(i&2){let e=u.$implicit,n=p();c("parent",e.parent)("isActive",e.id===(n.voiceCloneAssetId==null?null:n.voiceCloneAssetId.id))("id",e.id)("imageUrl",e.thumbnailAsset.imageUrl)("title",e.title)("isFavorite",e.isFavorite)("topics",e.topics)("audioUrl",e.audioUrl)("aspectRatio",e.voiceClonePreset==null?null:e.voiceClonePreset.aspectRatio)("backgroundAsset",e.voiceClonePreset==null?null:e.voiceClonePreset.backgroundAsset.imageUrl)("primaryColor",e.voiceClonePreset==null?null:e.voiceClonePreset.primaryColor.imageUrl)("readyPreviewImage",e.readyPreviewImage);}}function Av(i,u){if(i&1){let e=U();r(0,"div",43)(1,"header")(2,"div",44),b(3,"img",45),s(),r(4,"div",46),b(5,"img",47),s(),r(6,"section",48)(7,"div",49),y(8,"AI Voice Clone"),s(),r(9,"div",50),y(10,"Create AI Voice Clone"),s()()(),r(11,"button",51),S("click",function(){T(e);let t=p();return P(t.onVoiceClone());}),r(12,"div",44),b(13,"img",52),s(),r(14,"span"),y(15,"Clone Your Voice"),s()()();}}function Dv(i,u){i&1&&(r(0,"div",31),b(1,"app-audiogram-shimmer")(2,"app-audiogram-shimmer")(3,"app-audiogram-shimmer"),s());}function Lv(i,u){i&1&&(r(0,"div",53),y(1," There are no voices available. "),s());}var Fh=(()=>{class i extends Dh{constructor(e,n,t,o,h,k,f,m){super(["system","desk"],e,n,t,o,h,f),this.adminRequestsService=e,this.deskManagerHelperService=n,this.audioGramDataService=t,this.eventsService=o,this.dialogHelperService=h,this.notifier=k,this.assetRepo=f,this.translateStoryServiceService=m,this.longList=!1,this.scriptLanguage="en",this.styleMenuSliced=!0,this.useCaseMenuSliced=!0,this.langStateImg="img/audiogram/lang.svg",this.gender
9StateImg="img/audiogram/gender.svg",this.styleStateImg="img/script-story-v2/ai-writer-tone.webp",this.favIconActive=Ls,this.extendedClassOpened="grey-triangle opened",this.extendedClassClosed="grey-triangle closed",this.showFilters=!1,this.initMenues=()=>I(this,null,function*(){let v=yield this.translateStoryServiceService.getElevenlabsTtsLanguages();this.languageFilterOptions=[new St(void 0,"Language"),...this.translateStoryServiceService.setLanguageOptions(v)],this.selectedLanguage=this.languageFilterOptions[0],this.styleFilterOptions=ap(),this.genderFilterOptions=sp(),this.selectedGender=new St(void 0,""),this.topicOptions=cp(),this.activeTopicOptions=[];}),this.setTopicStatus=v=>{let V=this.topicOptions[v];if(!V.isActive&&this.topicOptions.filter(te=>te.isActive)?.length>=2){this.notifier.info("Please select up to 2 Use Cases");return;}this.topicOptions[v].isActive=!V.isActive,this.activeTopicOptions=this.topicOptions.filter(te=>te.isActive);},this.setUseCaseSliced=v=>{this.useCaseMenuSliced=v;},this.removeSelectedTopic=(v,V)=>{this.topicOptions[V].isActive=!1,this.activeTopicOptions=this.topicOptions.filter(te=>te.isActive),this.resultsPage=0,this.getAssets().then(()=>{this.sendEvent(this.EVENT_PATH.audiogramFilterApply,{filterType:"use-case",value:v.value,numResults:this.audioGramAssets?.length});});},this.removeStyle=(v,V)=>{this.styleFilterOptions[V].isActive=!1,this.selectedStyles=this.styleFilterOptions.filter(te=>te.isActive),this.resultsPage=0,this.getAssets().then(()=>{this.sendEvent(this.EVENT_PATH.audiogramFilterApply,{filterType:"style",value:v.value,numResults:this.audioGramAssets?.length});});},this.removeGender=v=>{this.setGender(v),this.resultsPage=0,this.getAssets().then(()=>{this.sendEvent(this.EVENT_PATH.audiogramFilterApply,{filterType:"gender",value:v.value,numResults:this.audioGramAssets?.length});});},this.removeLanguage=v=>{this.setLanguage(this.languageFilterOptions[0]),this.resultsPage=0,this.getAssets().then(()=>{this.sendEvent(this.EVENT_PATH.audiogramFilterApply,{filterType:"language",value:v.value,numResults:this.audioGramAssets?.length});});},this.setOnlyFavorite=()=>{this.showOnlyFavorites=!this.showOnlyFavorites,this.resultsPage=0,this.getAssets();},this.setLanguage=v=>{this.selectedLanguage=v;},this.setLangMenuState=v=>{this.langState=v,this.langStateImg=v?"img/audiogram/lang-active.svg":"img/audiogram/lang.svg";},this.setGender=v=>{this.selectedGender?.value===v.value?this.selectedGender=new St(void 0,""):this.selectedGender=v;},this.setStyleMenuSliced=v=>{this.styleMenuSliced=v;},this.sendEvent=(v,V)=>{this.eventsService.log(v,pe({storyId:this.storyId},V));},this.showFiltersMenu=()=>{this.showFilters=!this.showFilters,this.audioGramDataService.setShowFilters(this.showFilters);},this.applyFilters=()=>{this.resultsPage=0,this.getAssets().then(()=>{this.sendEvent(this.EVENT_PATH.audiogramFilterApply,{filterType:"language",value:this.selectedLanguage.value,numResults:this.audioGramAssets?.length}),this.sendEvent(this.EVENT_PATH.audiogramFilterApply,{filterType:"gender",value:this.selectedGender.value,numResults:this.audioGramAssets?.length}),this.sendEvent(this.EVENT_PATH.audiogramFilterApply,{filterType:"use-case",value:this.selectedStyles?.map(v=>v.value)?.join(","),numResults:this.audioGramAssets?.length}),this.sendEvent(this.EVENT_PATH.audiogramFilterApply,{filterType:"style",value:this.activeTopicOptions?.map(v=>v.value)?.join(","),numResults:this.audioGramAssets?.length});}),this.showFilters=!1,this.audioGramDataService.setShowFilters(this.showFilters);},this.onVoiceClone=()=>{this.audioGramDataService.setCloneVoice();},this.onSearch=()=>{this.resultsPage=0,this.getAssets();},this.favIcon=Vs;}ngOnInit(){return I(this,null,function*(){yield this.initMenues();let e=this.languageFilterOptions.find(n=>n.value===this.scriptLanguage);this.selectedLanguage=e??this.languageFilterOptions[0],this.getAssets();});}setStyle(e){this.styleFilterOptions[e].isActive=!this.styleFilterOptions[e].isActive,this.selectedStyles=this.styleFilterOptions.filter(n=>n.isActive);}static{this.ɵfac=function(n){return new(n||i)(d(xt),d(Kt),d(Gn),d(Pe),d(Ue),d(Ge),d(Ro),d(Gi));};}static{this.ɵcmp=G({type:i,selectors:[["app-voice-library-sidebar"]],inputs:{longList:"longList",scriptLanguage:"scriptLanguage"},standalone:!0,features:[Vi([lo]),Ae,q],decls:75,vars:57,consts:[[1,"voice-asset-library-wrapper"],[1,"search-panel"],[1,"search-panel-top"],[1,"search-wrapper"],[3,"inputFormControl","label","showClearButton"],[3,"click"],["src","/img/filter-menu
9-mobile-icon.svg","alt","image"],[1,"topics-wrapper"],["class","topic",3,"click",4,"ngIf"],["class","topic",3,"ngClass","click",4,"ngFor","ngForOf"],[1,"voice-assets-filter",3,"hidden"],[1,"top-filter"],[1,"title-b"],["src","/img/sidebar-close-icon.svg","alt","image"],[1,"toogle-input",3,"click"],[1,"checkbox-container-big"],[1,"checkmark-blue",3,"hidden"],[1,"blog-check-txt"],[1,"favorite-f"],["alt","favorite",3,"src"],[1,"h-parts","flat-line"],[1,"ai-controls-btn",3,"ngClass"],[1,"ai-control-img-container"],["alt","select-img",3,"src"],[1,"audiogram-select-wrapper","lang"],[3,"onSelection","menuState","selectedOption","menuOptions","contentStyle","toggleMenuIconClass"],[1,"small-title"],[1,"h-parts"],[1,"long-title"],[1,"slicer",3,"click"],[1,"list-voice",3,"ngClass"],[1,"voice-assets-list"],[3,"parent","isActive","id","imageUrl","title","isFavorite","topics","audioUrl","aspectRatio","backgroundAsset","primaryColor","readyPreviewImage","onPreview","onDeleteAudio","favoriteChange","onChangeName","onSelect","onEdit","onPlayClicked",4,"ngFor","ngForOf"],["appInfiniteScroll","",1,"list-voice-scroll-anchor",3,"scrolled"],["class","clone-voice-btn",4,"ngIf"],["class","voice-assets-list",4,"ngIf"],["class","empty-voices",4,"ngIf"],[3,"hidden"],[1,"filter-confirm",3,"click"],[1,"topic",3,"click"],["src","/img/sidebar-close-icon.svg","alt","remove","width","20px","height","20px"],[1,"topic",3,"click","ngClass"],[3,"onPreview","onDeleteAudio","favoriteChange","onChangeName","onSelect","onEdit","onPlayClicked","parent","isActive","id","imageUrl","title","isFavorite","topics","audioUrl","aspectRatio","backgroundAsset","primaryColor","readyPreviewImage"],[1,"clone-voice-btn"],[1,"clone-voice-selector"],["src","img/audiogram/clone-blue.svg","alt","selected"],[1,"cv-asset-image"],["src","img/audiogram/clone-main-img.svg","alt","starts"],[1,"cv-title-section-col"],[1,"cv-title"],[1,"cv-sub-tags"],[1,"clone-btn",3,"click"],["src","img/audiogram/clone-white.svg","alt","clone starts"],[1,"empty-voices"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"section",1)(2,"section",2)(3,"div",3),b(4,"text-input",4),s(),r(5,"button",5),S("click",function(){return t.showFiltersMenu();}),b(6,"img",6),s()(),r(7,"div",7),M(8,yv,4,0,"div",8)(9,kv,4,1,"div",8)(10,wv,4,1,"div",8)(11,Tv,4,4,"div",9)(12,Pv,4,4,"div",9),s()(),r(13,"section",10)(14,"section",11)(15,"div",12),y(16,"Filter"),s(),r(17,"button",5),S("click",function(){return t.showFiltersMenu();}),b(18,"img",13),s()(),r(19,"div",14),S("click",function(){return t.setOnlyFavorite();}),r(20,"div",15),b(21,"div",16),s(),r(22,"div",17),y(23,"Only Favorites"),s(),r(24,"div",18),b(25,"img",19),s()(),r(26,"section",20)(27,"div",21)(28,"div",22),b(29,"img",23),s(),r(30,"div",24)(31,"select-menu",25),S("onSelection",function(h){return t.setLanguage(h);})("menuState",function(h){return t.setLangMenuState(h);}),s()()(),r(32,"div",26)(33,"div",22),b(34,"img",23),s(),r(35,"div",12),y(36,"Gender"),s()(),r(37,"div",7),M(38,Ov,2,4,"div",9),s()(),r(39,"section",27)(40,"div",28)(41,"div",22),b(42,"img",23),s(),r(43,"div",12),y(44,"Speaking Style"),s()(),r(45,"div",7),M(46,Iv,2,4,"div",9),tt(47,"slice"),r(48,"div",29),S("click",function(){return t.setStyleMenuSliced(!t.styleMenuSliced);}),r(49,"span"),y(50),s(),b(51,"i"),s()()(),r(52,"section",27)(53,"div",28)(54,"div",12),y(55,"Use Cases"),s(),r(56,"div"),y(57,"(Choose Up To 2)"),s()(),r(58,"div",7),M(59,Mv,2,4,"div",9),tt(60,"slice"),r(61,"div",29),S("click",function(){return t.setUseCaseSliced(!t.useCaseMenuSliced);}),r(62,"span"),y(63),s(),b(64,"i"),s()()()(),r(65,"section",30)(66,"section",31),M(67,Ev,1,12,"app-voice-asset",32),r(68,"div",33),S("scrolled",function(){return t.getMoreAssets();}),s(),M(69,Av,16,0,"div",34)(70,Dv,4,0,"div",35)(71,Lv,2,0,"div",36),s()(),r(72,"footer",37)(73,"button",38),S("click",function(){return t.applyFilters();}),y(74," Show Results "),s()()()),n&2&&(a(4),c("inputFormControl",t.assetSearchField)("label","Search by Title")("showClearButton",!1),a(4),c("ngIf",t.showOnlyFavorites),a(),c("ngIf",t.selectedLanguage==null?null:t.selectedLanguage.value),a(),c("ngIf",t.selectedGender==null?null:t.selectedGender.value),a(),c("ngForOf",t.styleFilterOptions),a(),c("ngForOf",t.topicOptions),a(),c("hidden",!t.showFilters),a(2),nt("margin-bottom",16,"px")("padding-left",10,"px"),a(6),c("hidden",!t.showOnlyFavorites),a(4),c("src",t.favIconActive,Ie),a(2),nt("width",138,"px"),c("ngClass",ue(52,Sv,t.langState)),a(2),c("src",t.langStateImg,Ie),a(2),c("selectedOption",t.selectedLanguage)("menuOptions",t.languageFilterOptions)("contentStyle","audiogram-menu
9-container")("toggleMenuIconClass","grey-triangle closed"),a(3),c("src",t.genderStateImg,Ie),a(4),c("ngForOf",t.genderFilterOptions),a(),nt("padding-left",10,"px"),a(3),c("src",t.styleStateImg,Ie),a(4),c("ngForOf",Ia(47,44,t.styleFilterOptions,0,t.styleMenuSliced?6:(t.styleFilterOptions==null?null:t.styleFilterOptions.length)-1)),a(4),de(t.styleMenuSliced?"Show More":"Show Less"),a(),gt(t.styleMenuSliced?t.extendedClassClosed:t.extendedClassOpened),a(),nt("padding-left",10,"px"),a(7),c("ngForOf",Ia(60,48,t.topicOptions,0,t.useCaseMenuSliced?8:(t.topicOptions==null?null:t.topicOptions.length)-1)),a(4),de(t.useCaseMenuSliced?"Show More":"Show Less"),a(),gt(t.useCaseMenuSliced?t.extendedClassClosed:t.extendedClassOpened),a(),c("ngClass",fi(54,xv,t.longList,t.longList&&((t.selectedLanguage==null?null:t.selectedLanguage.value)||(t.selectedGender==null?null:t.selectedGender.value)||t.activeTopicOptions.length>0))),a(2),c("ngForOf",t.audioGramAssets),a(2),c("ngIf",!t.isLoading&&!t.isOnPageLoading),a(),c("ngIf",t.isLoading||t.isOnPageLoading),a(),c("ngIf",t.audioGramAssets.length===0&&!t.isOnPageLoading&&!t.isLoading),a(),c("hidden",!t.showFilters));},dependencies:[Lh,Le,_e,es,Vh,we,Fn,Yc,lo],styles:[".filter-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;flex-direction:column;justify-content:flex-start;align-items:flex-start}.title-b[_ngcontent-%COMP%]{color:#253658;font-size:16px;font-weight:600;line-height:19px;text-transform:capitalize}.audiogram-select-wrapper[_ngcontent-%COMP%]{width:100%;height:36px;display:flex;align-items:center;text-overflow:ellipsis;white-space:nowrap;font-weight:400;font-size:13px;color:#253658}.voice-asset-library-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column!important;align-items:flex-start;justify-content:flex-start;gap:5px!important}@media screen and (max-width: 900px){.audiogram-select-wrapper[_ngcontent-%COMP%]{width:100%!important}} .lang select-menu .select-menu-container{height:38px;width:92px} .gender select-menu .select-menu-container{height:38px;width:77px} .style select-menu .select-menu-container{height:38px;width:121px} .audiogram-select-wrapper select-menu .triggers{padding:12px 0} .audiogram-select-wrapper select-menu .trigger-button-text{margin-top:-2px} .audiogram-select-wrapper select-menu span.trigger-button-text{width:100%!important} .audiogram-select-wrapper .select-menu .triggers .trigger-button-toggle-icon{margin:0} .audiogram-select-wrapper select-menu span.trigger-button-toggle-icon{margin-left:0;margin-top:-4px}.flat-line[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:4px;margin-top:22px}.long-title[_ngcontent-%COMP%]{height:20px;width:100%;display:flex;align-items:center;gap:4px;margin-top:15px;margin-bottom:12px}.small-title[_ngcontent-%COMP%]{height:20px;display:flex;align-items:center;gap:4px;margin-right:12px}.list-voice[_ngcontent-%COMP%]{width:100%;overflow-y:scroll;overflow-x:hidden}.longer-list[_ngcontent-%COMP%]{height:calc(100vh - 380px)!important}.longer-filter-list[_ngcontent-%COMP%]{height:calc(100vh - 410px
9)!important}.list-voice-scroll-anchor[_ngcontent-%COMP%]{height:1px}.topics-wrapper[_ngcontent-%COMP%]{width:100%;display:flex;flex-wrap:wrap;gap:7px 11px}.slicer[_ngcontent-%COMP%]{color:#4481fd;text-align:center;font-size:12px;font-weight:700;text-transform:capitalize;display:flex;padding:6px 8px;justify-content:center;align-items:center;gap:5px;border-radius:100px;border:1px solid #4481FD;background:#fff;cursor:pointer;height:32px}.topic[_ngcontent-%COMP%]{color:#4481fd;text-align:center;font-size:12px;font-weight:700;text-transform:capitalize;display:flex;padding:6px 8px;justify-content:center;align-items:center;gap:5px;border-radius:4px;background:#4481fd14;cursor:pointer;height:32px}.t-active[_ngcontent-%COMP%]{background:#4481fd!important;color:#fff!important}.t-hidden[_ngcontent-%COMP%]{display:none!important}.search-panel[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column}.search-panel-top[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:12px;margin-bottom:12px}.filter-confirm[_ngcontent-%COMP%]{display:flex;width:100%;height:44px;justify-content:center;align-items:center;gap:10px;flex-shrink:0;border-radius:10px;border:2px solid #4481FD;background:#fff;color:#253658;text-align:center;font-size:16px;font-weight:600}.top-filter[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between}.search-wrapper[_ngcontent-%COMP%]{width:100%}.voice-asset-library-wrapper[_ngcontent-%COMP%] footer[_ngcontent-%COMP%]{padding:24px!important;box-shadow:unset!important;height:unset!important;display:flex;align-items:center;justify-content:center;width:100%;z-index:1003;background:#fff}.clone-voice-btn[_ngcontent-%COMP%]{width:460px;position:relative;display:flex;padding:9px;align-items:center;justify-content:space-between;gap:15px;border-radius:6px;background:#4481fd14;cursor:pointer}.clone-voice-selector[_ngcontent-%COMP%]{width:24px;height:24px;border-radius:50%;flex-shrink:0}.asset-image[_ngcontent-%COMP%] img[_ngcontent-%COMP%], .clone-voice-selector[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;object-position:center}.cv-asset-image[_ngcontent-%COMP%]{width:38px;height:38px;border-radius:50%;overflow:hidden;cursor:pointer;flex-shrink:0;position:relative}.cv-title-section-col[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:flex-start}.cv-title[_ngcontent-%COMP%]{color:#253658;font-size:12px;font-weight:600;line-height:17px;width:100%;overflow:hidden;text-overflow:ellipsis}.cv-sub-tags[_ngcontent-%COMP%]{color:#7b8db199;font-size:11px;font-weight:400;line-height:17px;height:17px;width:100%;overflow:hidden;text-overflow:ellipsis}.clone-btn[_ngcontent-%COMP%]{display:flex;padding:4px 12px 4px 8px;justify-content:center;align-items:center;gap:10px;border-radius:40px;background:#4481fd;color:#fff;font-size:12px;font-weight:600;cursor:pointer}.clone-voice-btn[_ngcontent-%COMP%] header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}",".loading-wrapper[_ngcontent-%COMP%]{position:absolute;padding:62px 48px;top:0;left:0;width:100%;height:100%;background:#fff;z-index:1}.loading-wrapper-clone[_ngcontent-%COMP%]{position:absolute;padding:62px 48px;top:0;left:0;width:100%;height:100%;border-radius:13px;background:#f3f7ff;z-index:1}.voice-assets-filter[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:90%;padding:32px;border-radius:13px;background:#fff;display:flex;flex-direction:column;z-index:1002;overflow:scroll}.voice-assets-filter-clone[_ngcontent-%COMP%]{width:300px;height:100%;padding:12px;border-radius:13px;background:#f3f7ff;position:relative;flex-shrink:0}.h-parts[_ngcontent-%COMP%]{padding-bottom:20px}.h-parts-s[_ngcontent-%COMP%]{overflow-y:scroll;margin-bottom:12px;padding-bottom:24px}.voice-assets-list[_ngcontent-%COMP%]{width:100%;margin-bottom:80px;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:10px}.voice-asset-library-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;align-items:flex-start;justify-content:flex-start;gap:20px}.isActive[_ngcontent-%COMP%]{border:3px solid #4481FD!important}.empty-voices[_ngcontent-%COMP%]{color:#25365899;text-align:center;font-size:22px;font-weight:400;line-height:36px}.toogle-input[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:8px;
9cursor:pointer;padding:0 10px}.favorite-f[_ngcontent-%COMP%]{width:16px;height:16px}.favorite-f[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%}.checkbox-container-big[_ngcontent-%COMP%]{width:24px;height:24px;border:1px solid #979797;position:relative;border-radius:20%;flex-shrink:0}.voice-asset-library-wrapper[_ngcontent-%COMP%] .toogle-input[_ngcontent-%COMP%] .checkbox-container-big[_ngcontent-%COMP%] .checkmark-blue[_ngcontent-%COMP%]{border-radius:20%;background-color:#4481fd;width:12px;height:12px;position:absolute;left:0;right:0;margin:5px auto}.blog-check-txt[_ngcontent-%COMP%]{color:#253658;font-size:14px;line-height:28px;font-weight:400;cursor:pointer}.ai-control-img-container[_ngcontent-%COMP%]{width:32px;height:32px;min-width:32px}.ai-control-img-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-position:center;object-fit:cover}.ai-controls-btn[_ngcontent-%COMP%]{display:flex;align-items:center;border-radius:20px;padding:2px 6px}.active-ai-controls-btn[_ngcontent-%COMP%]{background:#4481fd}.active-ai-controls-btn[_ngcontent-%COMP%] .audiogram-select-wrapper[_ngcontent-%COMP%]{color:#fff!important}.menues-wrappers[_ngcontent-%COMP%]{width:257px;display:flex;flex-wrap:wrap}@media screen and (max-width: 900px){.voice-asset-library-wrapper[_ngcontent-%COMP%]{flex-direction:column;height:auto}.voice-assets-filter[_ngcontent-%COMP%]{height:auto!important;padding:20px!important;width:100%!important;flex-direction:row;gap:16px}.voice-assets-filter-clone[_ngcontent-%COMP%]{width:100%}.menues-wrappers[_ngcontent-%COMP%]{flex-direction:column;width:167px}}"]});}}return i;})();J();Cn();Ni();ae();Bt();at();Ln();rl();al();km();J();at();bn();ht();var Vv=i=>({"long-list":i}),ha=i=>({isActive:i});function Rv(i,u){if(i&1){let e=U();r(0,"div",16),S("click",function(){let t=T(e).$implicit,o=p(2);return P(o.setRatio(t));}),r(1,"div",17),b(2,"div"),s(),r(3,"div",18),y(4),s()();}if(i&2){let e=u.$implicit,n=p(2);a(),c("ngClass",ue(4,ha,e.value===(n.editAsset==null||n.editAsset.voiceClonePreset==null?null:n.editAsset.voiceClonePreset.aspectRatio))),a(),gt(e.value),a(2),de(e.text);}}function Nv(i,u){if(i&1&&(ot(0),r(1,"div",7),y(2,"Format"),s(),r(3,"div",14),M(4,Rv,5,6,"div",15),s(),rt()),i&2){let e=p();a(3),nt("margin-bottom",20,"px"),a(),c("ngForOf",e.aspectRatioOptions);}}function Fv(i,u){if(i&1){let e=U();r(0,"div",19),S("click",function(){let t=T(e).$implicit,o=p();return P(o.onThumbnailSelect(t));}),b(1,"img",20),s();}if(i&2){let e=u.$implicit,n=p();c("ngClass",ue(2,ha,(e==null?null:e.assetId)===(n.editAsset==null||n.editAsset.thumbnailAsset==null?null:n.editAsset.thumbnailAsset.assetId))),a(),c("src",e==null?null:e.imageUrl,Ie);}}function jv(i,u){if(i&1){let e=U();r(0,"div",19),S("click",function(){let t=T(e).$implicit,o=p();return P(o.setBackground(t));}),b(1,"img",20),s();}if(i&2){let e=u.$implicit,n=p();c("ngClass",ue(2,ha,e.assetId===(n.editAsset.voiceClonePreset==null||n.editAsset.voiceClonePreset.backgroundAsset==null?null:n.editAsset.voiceClonePreset.backgroundAsset.assetId))),a(),c("src",e==null?null:e.imageUrl,Ie);}}function Bv(i,u){if(i&1){let e=U();r(0,"div",21),S("click",function(){let t=T(e).$implicit,o=p();return P(o.setColor(t));}),b(1,"img",22),r(2,"div",18),y(3),s()();}if(i&2){let e=u.$implicit,n=p();c("ngClass",ue(3,ha,(n.editAsset.voiceClonePreset==null||n.editAsset.voiceClonePreset.primaryColor==null?null:n.editAsset.voiceClonePreset.primaryColor.assetId)===e.value)),a(),c("src",e.imageUrl,Ie),a(2),de(e.text);}}var jh=(()=>{class i{constructor(e,n,t,o,h){this.audioGramDataService=e,this.dialogHelperService=n,this.deskManagerHelperService=t,this.eventsService=o,this.assetsRepo=h,this.EVENT_PATH=this.eventsService.events.audiogram,this.unsubscribe$=new Ze(),this.isAnonymous=!1,this.longList=!1,this.editMode=!1,this.continue=new be(),this.getAssets=(k,f)=>I(this,null,function*(){try{let m=yield this.getAssetsPromise(f,k);m.result&&m.result.length>0&&m.result.forEach(v=>{f==="background"?this.backgroundAssets.push({assetId:v.assetId,imageUrl:v.resource.thumbnails.lower.url||v.resource.url,title:v.title||""}):this.userPresenters.push({assetId:v.assetId,imageUrl:v.resource.thumbnails.lower.url||v.resource.url,title:v.title||""});}),f==="background"&&this.backgroundAssets.length>0&&(this.editAsset?.voiceClonePreset?.backgroundAsset?.assetId?this.backgroundAssets.findIndex(v=>v.assetId===this.editAsset?.voiceClonePreset?.backgroundAsset?.assetId)===-1&&(this.backgroundAssets[0]={assetId:this.editAsset?.voiceClonePreset?.backgroundAsset?.assetId,imageUrl:this.editAsset?.voiceClonePreset?.backgroundAsset?.imageUrl}
9):this.setBackground(this.backgroundAssets[0])),f==="thumbnail"&&this.userPresenters.length>0&&(this.editAsset?.thumbnailAsset?.assetId?this.userPresenters.findIndex(v=>v.assetId===this.editAsset?.thumbnailAsset?.assetId)===-1&&(this.userPresenters[0]={assetId:this.editAsset?.thumbnailAsset?.assetId,imageUrl:this.editAsset?.thumbnailAsset?.imageUrl}):this.onThumbnailSelect(this.userPresenters[0]));}catch(m){console.error("Failed to fetch assets",m);}}),this.getAssetsParams=(k,f)=>new qr().useRoot(new Kr().deskId(this.deskManagerHelperService.getSelectedWorkspaceId()).sortBy(as.CREATED_AT).sortDirection(cs.DOWN).level(sl.SYSTEM).count(k)).useCommon(new pr(dr.Commom).fileType([ls.IMAGE]).status(ds.COMPLETE).subTypes([f])).build(),this.getAssetsPromise=(k,f=1)=>this.assetsRepo.pullAssetsList(this.getAssetsParams(f,k)),this.setBackground=k=>{this.sendBackgroundEvent(this.EVENT_PATH.voiceGeneratorAudiogramAssetClick,{voiceType:this.editMode?"edit":"generate",assetType:"background",value:k.title}),this.audioGramDataService.setBackgroundAsset(k);},this.sendBackgroundEvent=(k,f={})=>{this.eventsService.log(k,Di(pe({},f),{storyId:this.storyId}));},this.openMoreBackground=()=>{if(this.isAnonymous){this.audioGramDataService.openUpsellForAnonymous("upload",this.storyId);return;}this.sendBackgroundEvent(this.EVENT_PATH.voiceGeneratorAssetAddStart,{assetType:"background"});let k=new Wa();k.sidebarHeader="",k.assetSidebarType=hr.Uploads,k.subTypes=["background"],k.featureSource=Ms.audioGram,k.useMediaTypeService=!0,k.allowedMediaTypesOptions=[],k.onClose=this.dialogHelperService.close,k.onSubmit=this.onAssetBackgroundSelectDialog;let f=new We();f.panelClass="audiogram-assets-dialog",this.dialogHelperService.open(k,Ga,f);},this.onAssetBackgroundSelectDialog=k=>{this.sendBackgroundEvent(this.EVENT_PATH.voiceGeneratorAssetAdd,{assetType:"background",type:"uploads"});let f={assetId:k.assetId,imageUrl:k.resource.thumbnails.lower.url||k.resource.url};this.backgroundAssets.findIndex(m=>m.assetId===f?.assetId)===-1&&(this.backgroundAssets=this.backgroundAssets.slice(1,this.backgroundAssets.length),this.backgroundAssets.unshift(f)),this.audioGramDataService.setBackgroundAsset(f),this.dialogHelperService.close();},this.onThumbnailSelect=k=>{this.sendBackgroundEvent(this.EVENT_PATH.voiceGeneratorAudiogramAssetClick,{voiceType:this.editMode?"edit":"generate",assetType:"avatar",value:k.title}),this.audioGramDataService.setThumbnailAsset(k);},this.openMorePresenters=()=>{if(this.isAnonymous){this.audioGramDataService.openUpsellForAnonymous("upload",this.storyId);return;}this.sendBackgroundEvent(this.EVENT_PATH.voiceGeneratorAssetAddStart,{assetType:"avatar"});let k=new Wa();k.sidebarHeader="",k.assetSidebarType=hr.Uploads,k.allowedMediaTypesOptions=[new St("image","Image")],k.subTypes=["thumbnail"],k.onClose=this.dialogHelperService.close,k.onSubmit=this.onAssetPresenterSelectDialog;let f=new We();f.panelClass="audiogram-assets-dialog",this.dialogHelperService.open(k,Ga,f);},this.onAssetPresenterSelectDialog=k=>{this.sendBackgroundEvent(this.EVENT_PATH.voiceGeneratorAssetAdd,{assetType:"avatar",type:"uploads"});let f={assetId:k.assetId,imageUrl:k.resource.thumbnails.lower.url||k.resource.url};this.userPresenters.findIndex(m=>m.assetId===f?.assetId)===-1&&(this.userPresenters=this.userPresenters.slice(1,this.userPresenters.length),this.userPresenters.unshift(f)),this.audioGramDataService.setThumbnailAsset(f),this.dialogHelperService.close();},this.setColor=k=>{this.sendBackgroundEvent(this.EVENT_PATH.voiceGeneratorAudiogramAssetClick,{voiceType:this.editMode?"edit":"generate",assetType:"waveform",value:k.text}),this.audioGramDataService.setPrimaryColor(k);},this.setRatio=k=>{this.sendBackgroundEvent(this.EVENT_PATH.voiceGeneratorAudiogramAssetClick,{voiceType:this.editMode?"edit":"generate",assetType:"format",value:k.value}),this.audioGramDataService.setAspectRatio(k);},this.userPresenters=[],this.backgroundAssets=[],this.aspectRatioOptions=lp(),this.colors=dp();}ngOnInit(){this.audioGramDataService.getStoryId().pipe(me(this.unsubscribe$)).subscribe(e=>this.storyId=e),this.audioGramDataService.getIsAnonymous().pipe(me(this.unsubscribe$)).subscribe(e=>this.isAnonymous=e),this.getAssets(4,"background"),this.getAssets(4,"thumbnail");}ngOnChanges(){}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.unsubscribe();}static{this.ɵfac=function(n){return new(n||i)(d(Gn),d(Ue),d(Kt),d(Pe),d(Ro));};}static{this.ɵcmp=G({type:i,selectors:[["app-audiogram-video-setup"]],inputs:{longList:"longList",editAsset:"editAsset",editMode:"editMode"},outputs:{continue:"continue"},standalone:!0,features:[Ut,q],decls:23,vars:12,consts:[[1,"audiogram-video-setup-wrapper",3,"ngClass"],[1,"preview-audiogram"],[1,"backround-wrapper"],["alt","wave-profile",3,"src"],[1,"wave-wrapper"],[3,"imageUrl","waveUrl"],[4,"ngIf"],[1,"p-title"],[1,"uploads-section"],[1,"upload-btn",3,"click"],["src","img/audiogram/upload.svg","alt","asset"],["class","p-circle",3,"ngClass","click",4,"ngFor","ngForOf"],[1,"options-section-wave"],["class","wave",3,"ngClass","click",4,"ngFor","ngForOf"],[1,"options-section"],["class","aspect-wrapper",3,"click",4,"ngFor","ngForOf"],[1,"aspect-wrapper",3,"click"],[1,"aspect",3,"ngClass"],[1,"aspect-text"],[1,"p-circle",3,"click","ngClass"],["alt","asset",3,"src"],[1,"wave",3,"click","ngClass"],[3,"src"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1)(2,"div",2),b(3,"img",3),s(),r(4,"div",4),b(5,"app-audiogram-presenter-preview",5),s()(),M(6,Nv,5,3,"ng-container",6),r(7,"div",7),y(8,"Avatar"),s(),r(9,"div",8)(10,"div",9),S("click",function(){return t.openMorePresenters();}),b(11,"img",10),s(),M(12,Fv,2,4,"div",11),s(),r(13,"div",7),y(14,"Backgroun
9d"),s(),r(15,"div",8)(16,"div",9),S("click",function(){return t.openMoreBackground();}),b(17,"img",10),s(),M(18,jv,2,4,"div",11),s(),r(19,"div",7),y(20,"Waveform Color"),s(),r(21,"div",12),M(22,Bv,4,5,"div",13),s()()),n&2&&(c("ngClass",ue(10,Vv,t.longList)),a(),gt("bg-"+(t.editAsset==null||t.editAsset.voiceClonePreset==null?null:t.editAsset.voiceClonePreset.aspectRatio)),a(2),c("src",t.editAsset==null||t.editAsset.voiceClonePreset==null||t.editAsset.voiceClonePreset.backgroundAsset==null?null:t.editAsset.voiceClonePreset.backgroundAsset.imageUrl,Ie),a(2),c("imageUrl",t.editAsset==null||t.editAsset.thumbnailAsset==null?null:t.editAsset.thumbnailAsset.imageUrl)("waveUrl",t.editAsset==null||t.editAsset.voiceClonePreset==null||t.editAsset.voiceClonePreset.primaryColor==null?null:t.editAsset.voiceClonePreset.primaryColor.imageUrl),a(),c("ngIf",!t.editMode),a(6),c("ngForOf",t.userPresenters),a(6),c("ngForOf",t.backgroundAssets),a(4),c("ngForOf",t.colors));},dependencies:[pp,Si,Le,we,_e],styles:[".audiogram-video-setup-wrapper[_ngcontent-%COMP%]{width:100%;height:calc(100vh - 330px);overflow-y:scroll;overflow-x:hidden;padding-bottom:24px}.long-list[_ngcontent-%COMP%]{height:calc(100vh - 340px)}.preview-audiogram[_ngcontent-%COMP%]{background:#f4f6f9;position:relative;flex-shrink:0;border-radius:10px;overflow:hidden;margin:0 auto}.bg-vertical[_ngcontent-%COMP%]{height:276px;aspect-ratio:9 / 16}.bg-horizontal[_ngcontent-%COMP%]{width:376px;aspect-ratio:16 / 9}.bg-square[_ngcontent-%COMP%]{height:276px;width:276px}.backround-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;z-index:1}.backround-wrapper[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%}.wave-wrapper[_ngcontent-%COMP%]{position:absolute;top:50%;left:50%;transform:translate(-40%,-50%);z-index:2}.p-title[_ngcontent-%COMP%]{color:#253658;font-size:14px;font-weight:600;text-transform:capitalize;padding-bottom:14px;padding-top:24px}.options-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:flex-start;justify-content:flex-start;gap:14px}.aspect-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px;align-items:center;justify-content:flex-start}.aspect[_ngcontent-%COMP%]{width:96px;height:96px;background:#7b8db114;border-radius:10px;display:flex;align-items:center;justify-content:center;border:3px solid transparent;cursor:pointer}.vertical[_ngcontent-%COMP%]{background:#4481fd;opacity:.6;width:40px;height:72px;border-radius:10px}.horizontal[_ngcontent-%COMP%]{background:#4481fd;opacity:.6;width:72px;height:40px;border-radius:10px}.square[_ngcontent-%COMP%]{background:#4481fd;opacity:.6;width:40px;height:40px;border-radius:10px}.uploads-section[_ngcontent-%COMP%]{display:flex;width:100%;flex-wrap:wrap;gap:20px 25px;align-items:center;justify-content:flex-start}.upload-btn[_ngcontent-%COMP%]{width:67px;height:67px;border-radius:50%;overflow:hidden;cursor:pointer;background:#f0f0f0;display:flex;align-items:center;justify-content:center}.upload-btn[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:60%;height:60%;object-position:center;object-fit:cover}.p-circle[_ngcontent-%COMP%]{width:70px;height:70px;border-radius:50%;overflow:hidden;border:3px solid transparent;cursor:pointer}.p-circle[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-position:center;object-fit:cover}.options-section-wave[_ngcontent-%COMP%]{width:100%;display:flex;align-items:flex-start;justify-content:flex-start;flex-wrap:wrap;gap:14px}.wave[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;border:3px solid transparent;gap:6px;border-radius:10px;cursor:pointer;padding:4px}.wave[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:64px;height:64px}.aspect-text[_ngcontent-%COMP%]{color:#253658;text-align:center;font-size:12px;font-weight:400}",".loading-wrapper[_ngcontent-%COMP%]{position:absolute;padding:62px 48px;top:0;left:0;width:100%;height:100%;background:#fff;z-index:1}.loading-wrapper-clone[_ngcontent-%COMP%]{position:absolute;padding:62px 48px;top:0;left:0;width:100%;height:100%;border-radius:13px;background:#f3f7ff;z-index:1}.voice-assets-filter[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:90%;padding:32px;border-radius:13px;background:#fff;display:flex;flex-direction:column;z-index:1002;overflow:scroll}.voice-assets-filter-clone[_ngcontent-%COMP%]{width:300px;height:100%;padding:12px;border-radius:13px;background:#f3f7ff;position:relative;flex-shrink:0}.h-parts[_ngcontent-%COMP%]{padding-bottom:20px}.h-parts-s[_ngcontent-%COMP%]{overflow-y:scroll;margin-bottom:12px;padding-bottom:24px}.voice-assets-list[_ngcontent-%COMP%]{width:100%;margin-bottom:80px;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:10px}.voice-asset-library-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;align-items:flex-start;justify-content:flex-start;gap:20px}.isActive[_ngcontent-%COMP%]{border:3px solid #4481FD!important}.empty-voices[_ngcontent-%COMP%]{color:#25365899;text-align:center;font-size:22px;font-weight:400;line-height:36px}.toogle-input[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:8px;
9cursor:pointer;padding:0 10px}.favorite-f[_ngcontent-%COMP%]{width:16px;height:16px}.favorite-f[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%}.checkbox-container-big[_ngcontent-%COMP%]{width:24px;height:24px;border:1px solid #979797;position:relative;border-radius:20%;flex-shrink:0}.voice-asset-library-wrapper[_ngcontent-%COMP%] .toogle-input[_ngcontent-%COMP%] .checkbox-container-big[_ngcontent-%COMP%] .checkmark-blue[_ngcontent-%COMP%]{border-radius:20%;background-color:#4481fd;width:12px;height:12px;position:absolute;left:0;right:0;margin:5px auto}.blog-check-txt[_ngcontent-%COMP%]{color:#253658;font-size:14px;line-height:28px;font-weight:400;cursor:pointer}.ai-control-img-container[_ngcontent-%COMP%]{width:32px;height:32px;min-width:32px}.ai-control-img-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-position:center;object-fit:cover}.ai-controls-btn[_ngcontent-%COMP%]{display:flex;align-items:center;border-radius:20px;padding:2px 6px}.active-ai-controls-btn[_ngcontent-%COMP%]{background:#4481fd}.active-ai-controls-btn[_ngcontent-%COMP%] .audiogram-select-wrapper[_ngcontent-%COMP%]{color:#fff!important}.menues-wrappers[_ngcontent-%COMP%]{width:257px;display:flex;flex-wrap:wrap}@media screen and (max-width: 900px){.voice-asset-library-wrapper[_ngcontent-%COMP%]{flex-direction:column;height:auto}.voice-assets-filter[_ngcontent-%COMP%]{height:auto!important;padding:20px!important;width:100%!important;flex-direction:row;gap:16px}.voice-assets-filter-clone[_ngcontent-%COMP%]{width:100%}.menues-wrappers[_ngcontent-%COMP%]{flex-direction:column;width:167px}}"]});}}return i;})();J();Cn();ae();J();ht();function Hv(i,u){if(i&1){let e=U();r(0,"main")(1,"app-audio-player",11),S("clickedPlay",function(){T(e);let t=p();return P(t.sendEvent());}),s()();}if(i&2){let e=p();a(),c("url",e.audioUrl)("useHls",e.useHls);}}var Bh=(()=>{class i{constructor(e,n){this.eventsService=e,this.serverlessApiService=n,this.EVENT_PATH=this.eventsService.events.audiogram,this.LOTTIE_SOURCE_PATH="/assets/ai-assistance.json",this.resultStepFeedback="Are you satisfied with the result?",this.title="Audio Preview",this.subTitle="Give it a listen to see if you enjoy it. Make sure to refine your script before producing the video!\u{1F60A}",this.badBtnText="Bad",this.goodBtnText="Good",this.onBad=new be(),this.onGood=new be(),this.bad=()=>{this.onBad.emit();},this.good=()=>{this.onGood.emit();},this.sendEvent=()=>{this.eventsService.log(this.EVENT_PATH.voiceGeneratorPreviewPlay,{storyId:this.storyId,voiceType:this.audio.parent,voice:this.audio.title,previewType:"script"});};}ngOnChanges(){if(this.text&&this.voiceId){let e=this.getLimitedText(this.text);this.audioUrl=`${this.serverlessApiService.getPreviewUrl()}ai/voiceclone/preview?text=${encodeURIComponent(e)}&voiceId=${this.voiceId}`,this.useHls=!0;}else this.externalUrl&&(this.audioUrl=this.externalUrl,this.useHls=!1);}getLimitedText(e){if(e.length>=500){let n=e.split(" "),t=[],o=[],h=0;for(let k of n){if(t.push(k),t.join(" ").length>=500)return o.join(" ");o.push(k);}return o.join(" ");}else return e;}static{this.ɵfac=function(n){return new(n||i)(d(Pe),d(Cs));};}static{this.ɵcmp=G({type:i,selectors:[["app-audiogram-preset"]],inputs:{storyId:"storyId",externalUrl:"externalUrl",badBtnText:"badBtnText",goodBtnText:"goodBtnText",voiceId:"voiceId",text:"text",audio:"audio"},outputs:{onBad:"onBad",onGood:"onGood"},standalone:!0,features:[Ut,q],decls:18,vars:5,consts:[[1,"audiogram-preset-wrapper"],[1,"p-image-container"],["src","/img/audiogram/ai-audiogram-sidebar.png","alt","image"],[1,"sub-title-black"],[4,"ngIf"],[1,"small-title-s"],[1,"feedback-btn-section"],[1,"feedback-btn","bad",3,"click"],["src","img/audiogram/thumb_down.svg","alt","bad"],[1,"feedback-btn","good",3,"click"],["src","img/audiogram/thumb_up.svg","alt","good"],[3,"clickedPlay","url","useHls"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),b(2,"img",2),s(),r(3,"div",3),y(4),s(),M(5,Hv,2,2,"main",4),r(6,"footer")(7,"div",5),y(8),s(),r(9,"div",6)(10,"button",7),S("click",function(){return t.bad();}),b(11,"img",8),r(12,"div"),y(13),s()(),r(14,"button",9),S("click",function(){return t.good();}),b(15,"img",10),r(16,"div"),y(17),s()()()()()),n&2&&(a(4),se(" ",t.title," "),a(),c("ngIf",t.audioUrl),a(3),se(" ",t.resultStepFeedback," "),a(5),se(" ",t.badBtnText," "),a(4),se(" ",t.goodBtnText," "));},dependencies:[Bs,_e],styles:[".audiogram-preset-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;overflow-x:hidden;padding-bottom:24px;display:flex;flex-direction:column;align-items:center;justify-content:center;max-width:400px;margin:0 auto}@media screen and (max-height: 740px){.audiogram-preset-wrapper[_ngcontent-%COMP%]{justify-content:flex-start!important}.p-image-container[_ngcontent-%COMP%]{width:300px!important}.sub-title-black[_ngcontent-%COMP%]{font-size:18px!important}.sub-title-white[_ngcontent-%COMP%]{font-size:13px!important}.audiogram-preset-wrapper[_ngcontent-%COMP%] footer[_ngcontent-%COMP%]{padding:10px!important}}.audiogram-preset-wrapper[_ngcontent-%COMP%] main[_ngcontent-%COMP%]{width:100%}.p-image-container[_ngcontent-%COMP%]{width:400px}.p-image-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%!important;height:100%!important}.sub-title-black[_ngcontent-%COMP%]{font-weight:700;font-size:20px;line-height:24px;text-align:center;color:#253658}.sub-title-black-small[_ngcontent-%COMP%]{color:#253658;text-align:center;font-size:16px;font-weight:400}.audiogram-preset-wrapper[_ngcontent-%COMP%] footer[_ngcontent-%COMP%]{padding:24px;position:absolute;width:100%;background:#fff;bottom:0;z-index:1}.feedback-btn-section[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:center;align-items:center;gap:24px;margin-top:14px}.feedback-btn[_ngcontent-%COMP%]{display:flex;height:44px;
9width:200px;padding:24px;justify-content:center;align-items:center;gap:10px;border-radius:10px;text-align:center;font-size:16px;font-weight:600}.small-title-s[_ngcontent-%COMP%]{color:#253658;text-align:center;font-size:14px;font-weight:400;margin:0 auto}.bad[_ngcontent-%COMP%]{color:#7b8db1;background:#7b8db114}.good[_ngcontent-%COMP%]{color:#fff;background:#4481fd}",".loading-wrapper[_ngcontent-%COMP%]{position:absolute;padding:62px 48px;top:0;left:0;width:100%;height:100%;background:#fff;z-index:1}.loading-wrapper-clone[_ngcontent-%COMP%]{position:absolute;padding:62px 48px;top:0;left:0;width:100%;height:100%;border-radius:13px;background:#f3f7ff;z-index:1}.voice-assets-filter[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:90%;padding:32px;border-radius:13px;background:#fff;display:flex;flex-direction:column;z-index:1002;overflow:scroll}.voice-assets-filter-clone[_ngcontent-%COMP%]{width:300px;height:100%;padding:12px;border-radius:13px;background:#f3f7ff;position:relative;flex-shrink:0}.h-parts[_ngcontent-%COMP%]{padding-bottom:20px}.h-parts-s[_ngcontent-%COMP%]{overflow-y:scroll;margin-bottom:12px;padding-bottom:24px}.voice-assets-list[_ngcontent-%COMP%]{width:100%;margin-bottom:80px;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:10px}.voice-asset-library-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;align-items:flex-start;justify-content:flex-start;gap:20px}.isActive[_ngcontent-%COMP%]{border:3px solid #4481FD!important}.empty-voices[_ngcontent-%COMP%]{color:#25365899;text-align:center;font-size:22px;font-weight:400;line-height:36px}.toogle-input[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:8px;cursor:pointer;padding:0 10px}.favorite-f[_ngcontent-%COMP%]{width:16px;height:16px}.favorite-f[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%}.checkbox-container-big[_ngcontent-%COMP%]{width:24px;height:24px;border:1px solid #979797;position:relative;border-radius:20%;flex-shrink:0}.voice-asset-library-wrapper[_ngcontent-%COMP%] .toogle-input[_ngcontent-%COMP%] .checkbox-container-big[_ngcontent-%COMP%] .checkmark-blue[_ngcontent-%COMP%]{border-radius:20%;background-color:#4481fd;width:12px;height:12px;position:absolute;left:0;right:0;margin:5px auto}.blog-check-txt[_ngcontent-%COMP%]{color:#253658;font-size:14px;line-height:28px;font-weight:400;cursor:pointer}.ai-control-img-container[_ngcontent-%COMP%]{width:32px;height:32px;min-width:32px}.ai-control-img-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-position:center;object-fit:cover}.ai-controls-btn[_ngcontent-%COMP%]{display:flex;align-items:center;border-radius:20px;padding:2px 6px}.active-ai-controls-btn[_ngcontent-%COMP%]{background:#4481fd}.active-ai-controls-btn[_ngcontent-%COMP%] .audiogram-select-wrapper[_ngcontent-%COMP%]{color:#fff!important}.menues-wrappers[_ngcontent-%COMP%]{width:257px;display:flex;flex-wrap:wrap}@media screen and (max-width: 900px){.voice-asset-library-wrapper[_ngcontent-%COMP%]{flex-direction:column;height:auto}.voice-assets-filter[_ngcontent-%COMP%]{height:auto!important;padding:20px!important;width:100%!important;flex-direction:row;gap:16px}.voice-assets-filter-clone[_ngcontent-%COMP%]{width:100%}.menues-wrappers[_ngcontent-%COMP%]{flex-direction:column;width:167px}}"]});}}return i;})();Bi();Ui();Ei();ae();Gr();J();ae();function zv(i,u){if(i&1&&(r(0,"div",9)(1,"div",10),y(2,"Your Credits"),s(),b(3,"app-ai-limit-circle",11),s()),i&2){let e=p();a(3),c("remainingCredits",e.data.remainingCredits)("totalCredits",e.data.totalCredits)("tooltipText",e.data.tooltipText);}}var ma=class extends Tt{constructor(){super(...arguments),this.remainingCredits=0,this.totalCredits=0,this.tooltipText="",this.estimatedCredits=0;}},Uh=(()=>{class i extends Pt{constructor(e){super(e),this.data=e;}static{this.ɵfac=function(n){return new(n||i)(d(yt));};}static{this.ɵcmp=G({type:i,selectors:[["app-ai-twin-video-create-dialog"]],standalone:!0,features:[Ae,q],decls:17,vars:5,consts:[[1,"ai-twin-video-wrapper"],["ngSrc","img/ai-cards/ai-twin-video-dialog.png","alt","video create","width","226","height","226"],[1,"info-section"],[1,"title-part"],[1,"title-part-sub"],["class","ai-sale-section",4,"ngIf"],[1,"button-section"],["variant","secondary-royal","size","md",3,"onClick"],["variant","primary-royal","iconLeft","ai-stars-icon","size","md",3,"onClick"],[1,"ai-sale-section"],[1,"twin-credits"],[3,"remainingCredits","totalCredits","tooltipText"]],template:function(n,t){n&1&&(r(0,"div",0),b(1,"img",1),r(2,"section",2)(3,"div",3),y(4),s(),r(5,"div",4),y(6," Just a friendly reminder: this action will use approximately "),r(7,"b"),y(8),tt(9,"number"),s(),y(10," and can't be und
9one. "),s(),M(11,zv,4,3,"div",5),r(12,"section",6)(13,"ui-button",7),S("onClick",function(){return t.close();}),y(14,"Cancel"),s(),r(15,"ui-button",8),S("onClick",function(){return t.submit();}),y(16," Create with AI "),s()()()()),n&2&&(a(4),se(" ",t.data.title," "),a(4),se("",wt(9,3,t.data.estimatedCredits)," credits"),a(3),c("ngIf",t.data.isLimited));},dependencies:[xe,_e,Mn,$i,Jc,Dn],styles:[".ai-twin-video-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;align-items:center}.info-section[_ngcontent-%COMP%]{width:100%;height:226px;display:flex;flex-direction:column;gap:12px}.title-part[_ngcontent-%COMP%]{color:#253658;font-size:24px;font-weight:600;line-height:29px;letter-spacing:-.24px;width:300px}.title-part-sub[_ngcontent-%COMP%]{color:#253658;font-size:14px;font-weight:400;line-height:19.6px;width:300px;height:100%}.ai-sale-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between}.twin-credits[_ngcontent-%COMP%]{color:#253658;font-size:14px;font-weight:600;line-height:17px}.button-section[_ngcontent-%COMP%]{display:flex;width:100%;align-items:center;justify-content:flex-end;gap:10px}.close[_ngcontent-%COMP%]{display:flex;width:180px;height:44px;justify-content:center;align-items:center;border-radius:10px;background:#7b8db114;color:#7b8db1!important}.ai-twin-btn[_ngcontent-%COMP%]{display:flex;width:180px;height:44px;justify-content:center;align-items:center;gap:10px;border-radius:10px;background:#4481fd;color:#fff!important}.image-gbt[_ngcontent-%COMP%]{background-repeat:no-repeat;background-size:cover;background-position:center;width:24px;height:24px;background-image:url(/img/ai-cards/generate-btn-icon-white.svg)}"]});}}return i;})();at();rr();J();Bn();oo();ao();ht();ln();Mi();Zi();pn();at();qt();var $v=i=>({disabled:i});function Wv(i,u){if(i&1){let e=U();r(0,"app-audiogram-preset",14),S("onBad",function(){T(e);let t=p(2);return P(t.changeStepFromPreview(t.getAudiogramSteps.voiceOrClone));})("onGood",function(){T(e);let t=p(2);return P(t.changeStepFromPreview(t.getAudiogramSteps.generate));}),s();}if(i&2){let e=p(2);c("text",e.story==null?null:e.story.script)("badBtnText","Fix Script")("goodBtnText","Make Video")("voiceId",e.selectedAsset==null?null:e.selectedAsset.externalId)("audio",e.selectedAsset);}}function Gv(i,u){if(i&1&&(ot(0),b(1,"app-voice-library-sidebar",12),M(2,Wv,1,5,"app-audiogram-preset",13),rt()),i&2){let e=p();a(),c("hidden",e.currentStep===e.getAudiogramSteps.preview)("longList",e.aiTextToSpeechLimited)("scriptLanguage",e.scriptLanguage),a(),c("ngIf",e.currentStep===e.getAudiogramSteps.preview);}}function qv(i,u){if(i&1&&(ot(0),b(1,"app-audiogram-video-setup",15),rt()),i&2){let e=p();a(),c("editAsset",e.selectedAsset)("longList",e.aiTextToSpeechLimited)("editMode",!1);}}function Kv(i,u){if(i&1&&(ot(0),b(1,"app-audiogram-video-setup",15),rt()),i&2){let e=p();a(),c("editAsset",e.assetToEdit)("longList",e.aiTextToSpeechLimited)("editMode",!0);}}function Qv(i,u){if(i&1&&(r(0,"div",16)(1,"div",17),y(2,"Your AI Text To Speech Credits"),s(),b(3,"app-ai-limit-circle",18),s()),i&2){let e=p();a(3),c("remainingCredits",e.remainingCredits)("totalCredits",e.totalCredits)("tooltipText",e.tooltipText)("loading",e.isCheckLimits);}}var Hh=(()=>{class i extends Yn{get getAudiogramSteps(){return Ki;}constructor(e,n,t,o,h,k,f,m,v,V,te,$,H,j,F){super("ai-result-wrapper-audiogram",e,t,o,h,n),this.storyTrackCommunicationService=e,this.premiumPlanService=n,this.anonymousUserService=t,this.portableRegisterService=o,this.eventsService=h,this.navigationHelperService=k,this.audioGramDataService=f,this.router=m,this.adminRequestsService=v,this.creditsService=V,this.planHelperService=te,this.dialogHelperService=$,this.notificationsService=H,this.detectTextLanguageService=j,this.translateStoryServiceService=F,this.isCheckLimits=!1,this.generating=!1,this.timeToCounter=4*60*60,this.EVENT_PATH=this.eventsService.events.audiogram,this.titleLoading="Creating AudioGram",this.subtitleLoading="The audiogram clip will be added as a new take to your project and you will receive a notification via email.",this.MIN_AUDIOGRAM_CHARTS=50,this.MAX_AUDIOGRAM_CHARTS=1e4,this.unsubscribe$=new Ze(),this.show
9FilterPanel=!1,this.currentStep=Ki.voiceOrClone,this.editPresetMode=!1,this.voiceCloneOpened=!1,this.updateScriptLocally=Z=>{this.localScript=Z.contentData.script,this.scriptLanguage=this.detectTextLanguageService.detectLanguage(this.localScript);},this.checkUserPlanAndLimits=()=>I(this,null,function*(){if(!this.isCheckLimits)try{this.isCheckLimits=!0;let Z=yield this.creditsService.getCreditsUsage();this.hasAIPlan=this.creditsService.isFeatureEnabled(Z,"audiogram"),this.hasAIPlan&&(yield this.checkLimits(Z));}catch(Z){console.error(Z);}finally{this.isCheckLimits=!1;}}),this.checkLimits=Z=>I(this,null,function*(){let N=Z??(yield this.creditsService.getCreditsUsage()),Q=this.creditsService.getFeature(N,"audiogram");Q?(this.aiTextToSpeechLimited=!0,this.remainingCredits=this.creditsService.getFeatureAvailableCredits(N,"audiogram"),this.totalCredits=this.creditsService.getFeatureTotalCredits(N,"audiogram"),this.tooltipText=this.creditsService.formatCostTooltip(Q)):this.aiTextToSpeechLimited=!1;}),this.createAudioGramMain=()=>I(this,null,function*(){let Z={storyId:this.story.storyId,templateIds:[],options:{actions:[{type:"audiogram",value:{voiceCloneAssetId:this.selectedAsset.id,backgroundAssetId:this.selectedAsset.voiceClonePreset?.backgroundAsset?.assetId,thumbnailAssetId:this.selectedAsset.thumbnailAsset?.assetId,aspectRatio:this.selectedAsset.voiceClonePreset?.aspectRatio,primaryColor:this.selectedAsset.voiceClonePreset?.primaryColor?.assetId}}]}};if(yield this.anonymousUserService.getAnonymousUser()){this.openUpsell(pt.audiogram);return;}let N=yield this.creditsService.estimateFeatureCredits("audiogram",this.localScript);if(this.aiTextToSpeechLimited&&N>this.remainingCredits){this.openOutOfCreditsDialog(N);return;}this.openGenerateDialog(Z,N);}),this.openOutOfCreditsDialog=Z=>{let N=new jl();N.remainingCredits=this.remainingCredits,N.totalCredits=this.totalCredits,N.tooltipText=this.tooltipText,N.estimatedCredits=Z,N.onClose=()=>this.dialogHelperService.close(),N.onSubmit=()=>{this.dialogHelperService.close(),this.creditsService.openCreditsOtpDialog({paywallTrigger:pt.audiogram,minPackIndex:2});};let Q=new We();Q.panelClass="assets-dialog",this.dialogHelperService.open(N,us,Q);},this.openGenerateDialog=(Z,N)=>I(this,null,function*(){let Q=new ma();Q.isLimited=this.aiTextToSpeechLimited,Q.remainingCredits=this.remainingCredits,Q.totalCredits=this.totalCredits,Q.tooltipText=this.tooltipText,Q.estimatedCredits=N,Q.title="Generate Video with AI Voice?",Q.onClose=this.dialogHelperService.close,Q.onSubmit=()=>this.createAudioGram(Z,N);let W=new We();W.panelClass="app-generate-video-twin-dialog",this.dialogHelperService.open(Q,Uh,W);}),this.createAudioGram=(Z,N)=>I(this,null,function*(){this.dialogHelperService.close();try{if(this.sendEvent(this.EVENT_PATH.audiogramCreate,{voiceType:this.selectedAsset.parent,voice:this.selectedAsset.title,waveformColor:this.selectedAsset.voiceClonePreset?.primaryColor?.assetId,aspectRatio:this.selectedAsset.voiceClonePreset?.aspectRatio,creditsRemaining:this.remainingCredits}),!this.hasAIPlan){console.debug("[audiogram] feature not enabled, showing plan upsell"),this.openUpsell(pt.audiogram);return;}this.aiTextToSpeechLimited&&N>this.remainingCredits?this.openOutOfCreditsDialog(N):(this.generatedVideo=yield this.adminRequestsService.generateVideo(Z),this.creditsService.refreshCredits(),this.router.navigate([ai,this.story.storyId,ft.takes]).then(()=>{this.storyTrackCommunicationService.setTakeAudioGram({video:this.generatedVideo,close:!1});}),this.changeStep(Ki.voiceOrClone),this.closeSidebar());}catch(Q){if(console.error(Q),this.creditsService.handleCreditError(Q))return;this.notificationsService.error(Q.responseJSON.msg);}}),this.onSaveChanges=()=>I(this,null,function*(){try{yield this.adminRequestsService.updateAsset({assetId:this.assetToEdit.id,preset:{voiceClone:{aspectRatio:this.assetToEdit.voiceClonePreset?.aspectRatio,backgroundAssetId:this.assetToEdit.voiceClonePreset?.backgroundAsset.assetId,primaryColor:this.assetToEdit.voiceClonePreset?.primaryColor.assetId}},assetThumbnailId:this.assetToEdit.thumbnailAsset.assetId}),this.notificationsService.success("Changes applied.");}catch(Z){console.error(Z),this.notificationsService.error("Failed to save changes.");}finally{this.changeStep(Ki.voiceOrClone),this.editPresetMode=!1,this.assetToEdit=null;}}
9),this.awaitToPreview=()=>{this.changeStep(Ki.preview);},this.continue=()=>I(this,null,function*(){if(this.editPresetMode)this.onSaveChanges();else if(this.currentStep===Ki.voiceOrClone)this.awaitToPreview();else if(this.currentStep===Ki.generate){if(this.localScript.length<this.MIN_AUDIOGRAM_CHARTS){this.notificationsService.info(`Add Script to use this feature, at least ${this.MIN_AUDIOGRAM_CHARTS} characters.`);return;}if(this.localScript.length>=this.MAX_AUDIOGRAM_CHARTS){this.notificationsService.info(`The script for the audiogram should be less than ${this.MAX_AUDIOGRAM_CHARTS} characters.`);return;}let Z=yield this.translateStoryServiceService.getElevenlabsTtsLanguages(),N=this.detectTextLanguageService.detectLanguage(this.localScript);if(!Z.some(Q=>Q.langCode===N)){this.notificationsService.info("Language is not supported. Please write the script in a different language.");return;}!this.story?.storyId||this.localScript!=this.story?.script?this.storyTrackCommunicationService.setSaveStory(this.createAudioGramMain):this.createAudioGramMain();}}),this.changeStepFromPreview=Z=>{this.sendEvent(this.EVENT_PATH.voiceGeneratorPreviewSelect,{voiceType:this.selectedAsset?.parent,voice:this.selectedAsset?.title,choice:Z===Ki.voiceOrClone?"fix script":"make video"}),this.changeStep(Z);},this.changeStep=Z=>{this.currentStep=Z,this.sendEvent(this.EVENT_PATH.audiogramNext,{page:Z});},this.openCloneVoiceDialog=()=>I(this,null,function*(){if(!(yield this.planHelperService.hasPremiumPlan())&&!this.isAnonymous)this.openUpsell(pt.voiceClone);else{let Z=new up();Z.story=this.story,Z.isAnonymous=this.isAnonymous,Z.onClose=this.dialogHelperService.close,Z.onSubmit=()=>this.dialogHelperService.closeAll();let N=new We();N.panelClass="app-subtitles-fix-dialog",this.dialogHelperService.open(Z,gp,N);}}),this.sendEvent=(Z,N={})=>{this.eventsService.log(Z,pe({storyId:this.story.storyId},N));},this.openUpsell=Z=>{let N=`script-story/${this.story.storyId}/takes`;this.premiumPlanService.openPricingDialog(yi.PRO,N,N,Z);};}ngOnInit(){return I(this,null,function*(){this.localScript=this.story?.script||"",this.subscribeToFormUpdates(),this.isAnonymous=!!(yield this.anonymousUserService.getAnonymousUser()),this.audioGramDataService.setIsAnonymous(this.isAnonymous),Ic(!0).pipe(Lc(4e3)).subscribe(()=>{this.eventsService.log(this.EVENT_PATH.audiogramStart,{storyId:this.story?.storyId,detectedLang:this.detectTextLanguageService.detectLanguage(this.localScript),creditsRemaining:this.remainingCredits||void 0});});});}ngOnDestroy(){this.eventListeners.forEach(e=>e.unsubscribe()),this.unsubscribe$.next(),this.unsubscribe$.unsubscribe(),this.audioGramDataService.clear();}closeSidebar(){this.showFilterPanel?this.showFilterPanel=!1:this.editPresetMode?(this.changeStep(Ki.voiceOrClone),this.editPresetMode=!1,this.assetToEdit=null):(this.sendEvent(this.EVENT_PATH.voiceGeneratorCloneDismiss,{page:this.currentStep}),this.showFilterPanel=!1,this.editPresetMode=!1,this.assetToEdit=null,this.storyTrackCommunicationService.setAiSidebarOpen(!1),this.navigationHelperService.toggleMediaSidebar(Je.NONE,!0),this.changeStep(Ki.voiceOrClone),this.voiceCloneOpened=!1);}subscribeToFormUpdates(){this.eventListeners.push(this.storyTrackCommunicationService.observeStoryChanged().subscribe(e=>{this.story=e,this.localScript=this.story?.script||"",this.scriptLanguage=this.detectTextLanguageService.detectLanguage(this.localScript);}),this.storyTrackCommunicationService.observeSelectedScriptTrack().subscribe(this.updateScriptLocally),this.storyTrackCommunicationService.observeUserPlan().subscribe(e=>this.checkUserPlanAndLimits())),this.audioGramDataService.getVoiceCloneAssetId().pipe(me(this.unsubscribe$)).subscribe(e=>{e?this.selectedAsset=pe({},e):this.selectedAsset=null;}),this.audioGramDataService.getThumbnailAsset().pipe(me(this.unsubscribe$)).subscribe(e=>{e&&(this.editPresetMode?(this.assetToEdit.thumbnailAsset={assetId:e.assetId,imageUrl:e.imageUrl},this.assetToEdit=pe({},this.assetToEdit)):(this.selectedAsset.thumbnailAsset={assetId:e.assetId,imageUrl:e.imageUrl},this.selectedAsset=pe({},this.selectedAsset)));}
9),this.audioGramDataService.getBackgroundAsset().pipe(me(this.unsubscribe$)).subscribe(e=>{e&&(this.editPresetMode?(this.assetToEdit.voiceClonePreset.backgroundAsset={assetId:e.assetId,imageUrl:e.imageUrl},this.assetToEdit=pe({},this.assetToEdit)):(this.selectedAsset.voiceClonePreset.backgroundAsset={assetId:e.assetId,imageUrl:e.imageUrl},this.selectedAsset=pe({},this.selectedAsset)));}),this.audioGramDataService.getAspectRatio().pipe(me(this.unsubscribe$)).subscribe(e=>{e&&(this.selectedAsset.voiceClonePreset.aspectRatio=e.value,this.selectedAsset=pe({},this.selectedAsset));}),this.audioGramDataService.getPrimaryColor().pipe(me(this.unsubscribe$)).subscribe(e=>{e&&(this.editPresetMode?(this.assetToEdit.voiceClonePreset.primaryColor={assetId:e.value,imageUrl:e.imageUrl},this.assetToEdit=pe({},this.assetToEdit)):(this.selectedAsset.voiceClonePreset.primaryColor={assetId:e.value,imageUrl:e.imageUrl},this.selectedAsset=pe({},this.selectedAsset)));}),this.audioGramDataService.getShowFilters().pipe(me(this.unsubscribe$)).subscribe(e=>{this.showFilterPanel=e;}),this.audioGramDataService.getEditAsset().pipe(me(this.unsubscribe$)).subscribe(e=>{e?.voice?(this.assetToEdit=e.voice,this.editPresetMode=!0,this.sendEvent(this.EVENT_PATH.voiceGeneratorAudiogramEdit,{voiceIndex:e.index,voice:e.voice.title}),this.changeStep(Ki.audiogram)):(this.assetToEdit=null,this.editPresetMode=!1);}),this.audioGramDataService.getCloneVoice().pipe(me(this.unsubscribe$)).subscribe(e=>{this.voiceCloneOpened||(this.voiceCloneOpened=!0,this.closeSidebar(),this.openCloneVoiceDialog());});}static{this.ɵfac=function(n){return new(n||i)(d(He),d(hi),d(xi),d(wi),d(Pe),d(ei),d(Gn),d(bi),d(xt),d(Vt),d(zt),d(Ue),d(Ge),d(Bl),d(Gi));};}static{this.ɵcmp=G({type:i,selectors:[["app-audiogram-sidebar"]],standalone:!0,features:[Vi([Gn]),Ae,q],decls:18,vars:11,consts:[[1,"ai-sidebar-container","ai-audiogram-container"],[1,"top-section-titles"],[1,"ai-audiogram-title"],[1,"ai-audiogram-sub-title"],[1,"close-button-ai-sidebar",3,"click"],["src","/img/sidebar-close-icon.svg","alt","image"],[1,"asset-container-list",3,"ngSwitch"],[4,"ngSwitchDefault"],[4,"ngSwitchCase"],[3,"hidden"],["class","ai-limits-section",4,"ngIf"],[3,"click","ngClass"],[3,"hidden","longList","scriptLanguage"],[3,"text","badBtnText","goodBtnText","voiceId","audio","onBad","onGood",4,"ngIf"],[3,"onBad","onGood","text","badBtnText","goodBtnText","voiceId","audio"],[3,"editAsset","longList","editMode"],[1,"ai-limits-section"],[1,"ai-audiogram-credits"],[3,"remainingCredits","totalCredits","tooltipText","loading"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"header")(2,"section",1)(3,"div",2),y(4," AI Voices "),s(),r(5,"div",3),y(6," Voices matching the language of your script "),s()(),r(7,"span",4),S("click",function(){return t.closeSidebar();}),r(8,"button"),b(9,"img",5),s()()(),r(10,"section",6),M(11,Gv,3,4,"ng-container",7)(12,qv,2,3,"ng-container",8)(13,Kv,2,3,"ng-container",8),s(),r(14,"footer",9),M(15,Qv,4,4,"div",10),r(16,"button",11),S("click",function(){return t.continue();}),y(17),s()()()),n&2&&(a(10),c("ngSwitch",t.currentStep),a(2),c("ngSwitchCase",t.getAudiogramSteps.generate),a(),c("ngSwitchCase",t.getAudiogramSteps.audiogram),a(),c("hidden",t.currentStep===t.getAudiogramSteps.preview||t.showFilterPanel),a(),c("ngIf",t.aiTextToSpeechLimited),a(),gt(t.editPresetMode?"save-audiogram-btn":"ai-twin-btn"),c("ngClass",ue(9,$v,t.editPresetMode?!t.assetToEdit:!t.selectedAsset)),a(),se(" ",t.editPresetMode?"Save Audiogram":"Continue"," "));},dependencies:[$i,_e,wo,To,Fh,jh,we,Bh,Kc],styles:[".ai-audiogram-container[_ngcontent-%COMP%]{position:relative;width:536px!important;padding:0!important}.ai-audiogram-container[_ngcontent-%COMP%] header[_ngcontent-%COMP%]{z-index:1000;padding:32px 32px 0!important}.ai-audiogram-container[_ngcontent-%COMP%] .voice-assets-filter[_ngcontent-%COMP%]{height:80%}.ai-limits-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;height:100%;padding-bottom:4px;margin:0 auto}.ai-limits-section[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;cursor:pointer}.ai-audiogram-title[_ngcontent-%COMP%]{color:#253658;font-size:18px;font-weight:600}.ai-audiogram-sub-title[_ngcontent-%COMP%]{color:#000;font-size:12px;font-weight:400;line-height:17px}.ai-audiogram-container[_ngcontent-%COMP%] footer[_ngcontent-%COMP%]{padding:32px!important;height:unset!important;z-index:3!important}.ai-audiogram-create-section[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.ai-audiogram-no-avatar-img[_ngcontent-%COMP%]{width:315px;height:250px}.ai-audiogram-no-avatar-img[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%}.ai-audiogram-no-avatar-title[_ngcontent-%COMP%]{color:#253658;font-size:16px;font-weight:700}.ai-audiogram-no-avatar-subtitle[_ngcontent-%COMP%]{color:#253658;font-size:12px;font-weight:400}.credits-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between}.credits[_ngcontent-%COMP%]{color:#253658;font-size:14px;font-weight:600;line-height:17px}.ai-audiogram-btn[_ngcontent-%COMP%]{display:flex;width:100%;height:44px;justify-content:center;align-items:center;gap:10px;border-radius:10px;background:#4481fd;color:#fff!important}.image-gbt[_ngcontent-%COMP%]{background-repeat:no-repeat;background-size:cover;background-position:center;width:24px;height:24px;background-image:url(/img/ai-cards/generate-btn-icon-white.svg)}.asset-container-list[_ngcontent-%COMP%]{width:100%;height:calc(100% - 32px);padding:76px 32px 0;margin-bottom:46px}.asset-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;justify-content:space-between;flex-shrink:0;width:220px} .ai-twin-container .asset-container .thumbnail-container{height:220px}.ai-sale-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between}.ai-audiogram-credits[_ngcontent-%COMP%]{color:#253658;font-size:14px;font-weight:600;line-height:17px}.ai-twin-btn[_ngcontent-%COMP%]{display:flex;width:100%;height:44px;justify-content:center;align-items:center;gap:10px;border-radius:10px;background:#4481fd;color:#fff!important;font-weight:600}.save-audiogram-btn[_ngcontent-%COMP%]{display:flex;width:100%;height:44px;justify-content:center;align-items:center;gap:10px;border-radius:10px;border:2px solid #4481FD;background:#fff;color:#253658!important;font-weight:600}",".loading-wrapper[_ngcontent-%COMP%]{position:absolute;padding:62px 48px;top:0;left:0;width:100%;height:100%;background:#fff;z-index:1}.loading-wrapper-clone[_ngcontent-%COMP%]{position:absolute;padding:62px 48px;top:0;left:0;width:100%;height:100%;border-radius:13px;background:#f3f7ff;z-index:1}.voice-assets-filter[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:90%;padding:32px;border-radius:13px;background:#fff;display:flex;flex-direction:column;z-index:1002;overflow:scroll}.voice-assets-filter-clone[_ngcontent-%COMP%]{width:300px;height:100%;padding:12px;border-radius:13px;background:#f3f7ff;position:relative;flex-shrink:0}.h-parts[_ngcontent-%COMP%]{padding-bottom:20px}.h-parts-s[_ngcontent-%COMP%]{overflow-y:scroll;margin-bottom:12px;padding-bottom:24px}.voice-assets-list[_ngcontent-%COMP%]{width:100%;margin-bottom:80px;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:10px}.voice-asset-library-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;align-items:flex-start;justify-content:flex-start;gap:20px}.isActive[_ngcontent-%COMP%]{border:3px solid #4481FD!important}.empty-voices[_ngcontent-%COMP%]{color:#25365899;text-align:center;font-size:22px;font-weight:400;line-height:36px}.toogle-input[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:8px;
9cursor:pointer;padding:0 10px}.favorite-f[_ngcontent-%COMP%]{width:16px;height:16px}.favorite-f[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%}.checkbox-container-big[_ngcontent-%COMP%]{width:24px;height:24px;border:1px solid #979797;position:relative;border-radius:20%;flex-shrink:0}.voice-asset-library-wrapper[_ngcontent-%COMP%] .toogle-input[_ngcontent-%COMP%] .checkbox-container-big[_ngcontent-%COMP%] .checkmark-blue[_ngcontent-%COMP%]{border-radius:20%;background-color:#4481fd;width:12px;height:12px;position:absolute;left:0;right:0;margin:5px auto}.blog-check-txt[_ngcontent-%COMP%]{color:#253658;font-size:14px;line-height:28px;font-weight:400;cursor:pointer}.ai-control-img-container[_ngcontent-%COMP%]{width:32px;height:32px;min-width:32px}.ai-control-img-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-position:center;object-fit:cover}.ai-controls-btn[_ngcontent-%COMP%]{display:flex;align-items:center;border-radius:20px;padding:2px 6px}.active-ai-controls-btn[_ngcontent-%COMP%]{background:#4481fd}.active-ai-controls-btn[_ngcontent-%COMP%] .audiogram-select-wrapper[_ngcontent-%COMP%]{color:#fff!important}.menues-wrappers[_ngcontent-%COMP%]{width:257px;display:flex;flex-wrap:wrap}@media screen and (max-width: 900px){.voice-asset-library-wrapper[_ngcontent-%COMP%]{flex-direction:column;height:auto}.voice-assets-filter[_ngcontent-%COMP%]{height:auto!important;padding:20px!important;width:100%!important;flex-direction:row;gap:16px}.voice-assets-filter-clone[_ngcontent-%COMP%]{width:100%}.menues-wrappers[_ngcontent-%COMP%]{flex-direction:column;width:167px}}",".ai-sidebar-container[_ngcontent-%COMP%]{width:405px;margin-top:40px;background:#fff;height:calc(100vh - 124px);overflow:hidden;box-shadow:0 0 40px #0000001a;border-radius:20px;padding:24px 0 24px 12px} aside#whiteboard, aside#ai-checker, aside#ai-checker-v2, aside#ai-rewrite{left:-664px!important;width:360px!important;background:transparent!important;z-index:31} aside#emotions{left:-664px!important;width:432px!important;background:transparent!important;z-index:31} aside#audiogram{left:-664px!important;width:536px!important;background:transparent!important;z-index:31}main[_ngcontent-%COMP%]{margin-top:42px;width:100%;height:calc(100vh - 254px);position:relative;overflow-y:scroll;overflow-x:hidden;padding:0 4px}main[_ngcontent-%COMP%]::-webkit-scrollbar{width:11px}header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;height:60px;position:absolute;width:100%;top:0;left:0;background:#fff;padding:0 15px}footer[_ngcontent-%COMP%]{width:100%;z-index:1;background:#fff;box-shadow:0 0 40px #0000001a;position:absolute;bottom:0;left:0;height:60px}.ai-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#00abfe;font-family:Inter-Bold;width:110px} .ai-text-area-wrapper .text-area-input-component .mat-form-field-label{white-space:pre-wrap!important}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar{width:3px;padding-left:4px}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#00abfe}.ai-result-action-menu[_ngcontent-%COMP%]{position:absolute;right:12px;top:-18px;background:#fff;box-shadow:0 0 24px #0000002e;border-radius:10px;width:100px;height:28px;display:flex;align-items:center;justify-content:space-evenly;cursor:pointer}.ai-result-action-menu[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:0;margin:0;width:20px;height:20px}.ai-result-action-menu[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;background-repeat:no-repeat;padding:0;display:block}.ai-result-action-menu[_ngcontent-%COMP%] .delete[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-d.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .past[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-past.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .whiteboard[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-m.svg)}.ai-menu-wrapper[_ngcontent-%COMP%]{width:100%;max-width:240px;text-overflow:ellipsis;white-space:nowrap;border:1px solid rgba(37,54,88,.6);background:#fff;border-radius:20px;padding:2px 6px;font-weight:400;font-size:14px;color:#253658}.fade[_ngcontent-%COMP%]{opacity:0;transition:all .5s ease-in-out}.hide[_ngcontent-%COMP%]{display:none!important}.editing[_ngcontent-%COMP%]{cursor:default!important}.disabled[_ngcontent-%COMP%]{opacity:.4}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%], .ai-result-wrapper-active[_ngcontent-%COMP%]{border:2px solid rgba(0,171,254,.6)!important;background:#fff!important;cursor:text!important}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-result-wrapper-active[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-droppable-area[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:164px}.ai-droppable-class[_ngcontent-%COMP%]{transform:scale(.9);transition:all .3s ease-in-out}.ai-droppable-area[_ngcontent-%COMP%]{width:100%}.ai-sale-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;
9height:100%;padding:0 12px}.ai-sale-component[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;gap:14px}.ai-sale-section[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;cursor:pointer}.upgrade-text[_ngcontent-%COMP%]{max-width:100px;font-weight:500;font-size:12px;line-height:15px;color:#253658}.ai-result-list-wrapper[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:12px}.ai-result-item-container[_ngcontent-%COMP%]{position:relative;width:100%}"]});}}return i;})();J();Bt();J();J();var Yv=["*"],zh=(()=>{class i{static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["app-navbar-button"]],standalone:!0,features:[q],ngContentSelectors:Yv,decls:2,vars:0,consts:[[1,"navbar-btn"]],template:function(n,t){n&1&&(Vr(),r(0,"button",0),Rr(1),s());},styles:[".navbar-btn[_ngcontent-%COMP%]{padding:2px;height:40px;width:40px;background-color:transparent;border-radius:10px;cursor:pointer;display:flex;justify-content:center;align-items:center}.navbar-btn[_ngcontent-%COMP%]:hover{background-color:#4481fd14}"]});}}return i;})();ae();J();ae();J();var $h={hook:{label:"Hook",cataClass:"hook"},speaker_introduction:{label:"Speaker Intro",cataClass:"speaker-intro"},topic_introduction:{label:"Topic Intro",cataClass:"topic-intro"},value_proposition:{label:"Value Proposition",cataClass:"value-proposition"},call_to_action:{label:"Call-to-Action",cataClass:"call-to-action"},outro:{label:"Outro",cataClass:"outro"},highlight:{label:"Content Snipped",cataClass:"content-snippet"}};Bt();J();Bt();var Jn=class{constructor(){this.hook=[],this.topic_introduction=[],this.speaker_introduction=[],this.value_proposition=[],this.call_to_action=[],this.outro=[],this.highlight=[];}};J();ht();var Dt=(()=>{class i{constructor(e){this.eventsService=e,this.segmentsSubject=new sn({}),this.cachedSegments=null,this.pickedCategorieSubject=new sn(""),this.activeSegment=new sn({segmentLabel:null,textIndex:null}),this.changedSegmentTopicTrigger=new Ze(),this.searchTrigger=new Ze(),this.rewriteTextAgain=new Ze(),this.replaceTextInScriptTrigger=new Ze(),this.currentSegment="",this.flattenedData=[],this.searchValue="",this.storyId="",this.searchResults=[],this.setSegments=n=>{let t=new Jn(),o=pe(pe({},t),n);this.segmentsSubject.next(o),!this.cachedSegments&&this.flatDataForSearch(o);},this.getSegment=()=>this.segmentsSubject.asObservable(),this.getNewList=()=>this.segmentsSubject.value,this.setPickedCategorieSubject=n=>{this.pickedCategorieSubject.next(n);},this.getPickedCategorieSubject=()=>this.pickedCategorieSubject.asObservable(),this.setActiveSegment=(n,t)=>{this.activeSegment.next({segmentLabel:n,textIndex:t});},this.getActiveSegment=()=>this.activeSegment.asObservable(),this.clearActiveSegment=()=>{this.activeSegment.next({segmentLabel:"",textIndex:-1});},this.getChangedSegmentTopicTrigger=()=>this.changedSegmentTopicTrigger.asObservable(),this.getSearchTrigger=()=>this.searchTrigger.asObservable(),this.setRewriteTextAgainTrigger=()=>{this.rewriteTextAgain.next();},this.getRewriteTextAgainTrigger=()=>this.rewriteTextAgain.asObservable(),this.setReplaceTextInScriptTrigger=()=>{this.replaceTextInScriptTrigger.next();},this.getReplaceTextInScriptTrigger=()=>this.replaceTextInScriptTrigger.asObservable(),this.getSearchValue=()=>this.searchValue,this.getSearchResults=()=>this.searchResults,this.setStoryId=n=>{this.storyId=n;},this.getCurrentSegmentOnMenu=()=>this.currentSegmentOnMenu,this.setCurrentSegmentOnMenu=n=>{this.currentSegmentOnMenu=n;},this.deleteSegment=n=>{let t=this.segmentsSubject.value,o=this.pickedCategorieSubject.value;if(t[o]){let h=t[o].filter(k=>k.text!==n.text);this.segmentsSubject.next(Di(pe({},t),{[o]:h}));}},this.arrangeCategory=(n,t,o,h=!1)=>{let k=n,f=this.pickedCategorieSubject.value,m=o.filter(v=>!k[v]);if(m.length>0){console.error("Cannot find labels: ",m);return;}Object.keys(k).forEach(v=>{o.includes(v)||(k[v]=k[v].filter(V=>V.text!==t.text));}),o.map(v=>{if(!k[v].some(V=>V.text===t.text)){let V=Di(pe({},k[v]),{label:v});k[v]=[...k[v],t];}}),h||(this.segmentsSubject.next(k),this.changedSegmentTopicTrigger.next());},this.moveSegment=(n,t)=>{this.cachedSegments&&this.arrangeCategory(this.cachedSegments,n,t,!0),this.arrangeCategory(this.segmentsSubject.value,n,t);let o=!1;this.cachedSegments&&(o=!0);let h=o&&this.cachedSegments?this.cachedSegments:this.segmentsSubject.value;this.flatDataForSearch(h);},this.searchForSegment=n=>{if(!n)return[];let t=this.flattenedData.filter(o=>o.text.toLowerCase().includes(n.toLowerCase())&&o.existsInScript);return this.searchResults=t,t;},this.filterList=n=>{if(n.length==0)return;let t=new Jn();
9this.searchValue=n,this.searchForSegment(n).forEach(h=>{t[h.key]||(t[h.key]=[]),t[h.key].push({label:h.key,text:h.text,startIndex:h.startIndex,endIndex:h.endIndex,active:!1,existsInScript:h.existsInScript});}),this.cachedSegments||(this.cachedSegments=this.segmentsSubject.value),this.clearActiveSegment(),this.setSegments(t),this.setPickedCategorieSubject(null),this.searchTrigger.next();},this.clearSearch=()=>{if(this.cachedSegments){let n=this.cachedSegments;this.cachedSegments=null,this.searchValue="",this.setSegments(n),this.searchTrigger.next();}},this.flatDataForSearch=n=>{this.flattenedData=[],Object.keys(n).forEach(t=>{this.segmentsSubject.value[t].forEach(o=>{this.flattenedData.push({key:t,text:o.text,startIndex:o.startIndex,endIndex:o.endIndex,existsInScript:o.existsInScript});});});},this.shouldShowNothingFound=()=>!!(this.searchValue&&this.searchResults?.length===0),this.sendEvent=(n,t)=>{this.eventsService.log(n,pe({storyId:this.storyId,type:"script"},t));};}transformData(e){if(e)return e.reduce((n,t)=>(t.labels.forEach((o,h)=>{n[o].push({text:t.text,startIndex:t.startIndex,endIndex:t.endIndex,active:!1,label:o,existsInScript:!0});}),n),{hook:[],topic_introduction:[],speaker_introduction:[],value_proposition:[],call_to_action:[],outro:[],highlight:[]});}static{this.ɵfac=function(n){return new(n||i)(an(Pe));};}static{this.ɵprov=Jt({token:i,factory:i.ɵfac,providedIn:"root"});}}return i;})();ae();function Jv(i,u){if(i&1&&(r(0,"span"),y(1),s()),i&2){let e=p();a(),se(": ",e.phraseCount(),"");}}var Xo=(()=>{class i{constructor(e){this.DataService=e,this.phraseCount=Ci(0),this.category=Ci(""),this.label=Qe(""),this.active=Qe(!1),this.withCount=Ci(!1),this.activeable=Ci(!0),this.style=Qe("default-class"),this.unsubscribe$=new Ze(),this.onClick=Ci(),this.isToggle=Ci(!1),this.activeChange=new be(),this.onCategorieClick=()=>
9{this.isToggle()&&this.activeable()&&this.setIsActive();},this.setIsActive=(n="")=>{if(!this.isToggle()){n===this.category()?this.active.set(!0):this.active.set(!1);return;}this.active()?(this.activeChange.emit(!1),this.active.set(!1)):(this.activeChange.emit(!0),this.active.set(!0));};}ngOnInit(){let e=this.category(),{label:n,cataClass:t}=$h[e],o=this.activeable()?t:t+" non-activable";this.style.set(o),this.label.set(n),this.activeable()&&!this.isToggle()&&this.DataService.getPickedCategorieSubject().pipe(me(this.unsubscribe$)).subscribe(h=>{this.setIsActive(h);});}ngOnChanges(e){this.allreadyActive!=null&&this.active.set(this.allreadyActive);}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.unsubscribe();}static{this.ɵfac=function(n){return new(n||i)(d(Dt));};}static{this.ɵcmp=G({type:i,selectors:[["app-category-badge"]],inputs:{phraseCount:[di.SignalBased,"phraseCount"],category:[di.SignalBased,"category"],withCount:[di.SignalBased,"withCount"],activeable:[di.SignalBased,"activeable"],onClick:[di.SignalBased,"onClick"],isToggle:[di.SignalBased,"isToggle"],allreadyActive:"allreadyActive"},outputs:{activeChange:"activeChange"},standalone:!0,features:[Ut,q],decls:3,vars:3,consts:[[1,"category-badge",3,"click","ngClass"],[4,"ngIf"]],template:function(n,t){n&1&&(r(0,"div",0),S("click",function(){return t.onCategorieClick();}),y(1),M(2,Jv,2,1,"span",1),s()),n&2&&(c("ngClass",t.active()?t.style()+" active":t.style()),a(),se(" ",t.label()," "),a(),c("ngIf",t.withCount()===!0));},dependencies:[xe,we,_e],styles:[".category-badge[_ngcontent-%COMP%]{font-size:12px;font-weight:700;border:1px solid rgba(170,88,238,1);display:inline-block;border-radius:40px;padding:0 8px;cursor:pointer;--hookColor: rgba(68, 129, 253, 1);--topicIntroColor: rgba(0, 208, 150, 1);--speakerIntroColor:rgba(0, 171, 254, 1);--valuePropositionColor:rgba(170, 88, 238, 1);--callToActionColor:rgba(123, 141, 177, 1);--outroColor:rgba(37, 54, 88, 1);--contentSnippedColor:rgba(255, 134, 188, 1)}.hook[_ngcontent-%COMP%]{border:1px solid var(--hookColor);color:var(--hookColor)}.topic-intro[_ngcontent-%COMP%]{border:1px solid var(--topicIntroColor);color:var(--topicIntroColor)}.speaker-intro[_ngcontent-%COMP%]{border:1px solid var(--speakerIntroColor);color:var(--speakerIntroColor)}.value-proposition[_ngcontent-%COMP%]{border:1px solid var(--valuePropositionColor);color:var(--valuePropositionColor)}.call-to-action[_ngcontent-%COMP%]{border:1px solid var(--callToActionColor);color:var(--callToActionColor)}.outro[_ngcontent-%COMP%]{border:1px solid var(--outroColor);color:var(--outroColor)}.content-snippet[_ngcontent-%COMP%]{border:1px solid var(--contentSnippedColor);color:var(--contentSnippedColor)}.hook.active[_ngcontent-%COMP%]{background-color:var(--hookColor);color:#fff}.topic-intro.active[_ngcontent-%COMP%]{background-color:var(--topicIntroColor);color:#fff}.speaker-intro.active[_ngcontent-%COMP%]{background-color:var(--speakerIntroColor);color:#fff}.value-proposition.active[_ngcontent-%COMP%]{background-color:var(--valuePropositionColor);color:#fff}.call-to-action.active[_ngcontent-%COMP%]{background-color:var(--callToActionColor);color:#fff}.outro.active[_ngcontent-%COMP%]{background-color:var(--outroColor);color:#fff}.content-snippet.active[_ngcontent-%COMP%]{background-color:var(--contentSnippedColor);color:#fff}.hook[_ngcontent-%COMP%]:hover:not(.active):not(.non-activable){background-color:#4481fd33}.topic-intro[_ngcontent-%COMP%]:hover:not(.active):not(.non-activable){background-color:#00d09633}.speaker-intro[_ngcontent-%COMP%]:hover:not(.active):not(.non-activable){background-color:#00abfe33}.value-proposition[_ngcontent-%COMP%]:hover:not(.active):not(.non-activable){background-color:#aa58ee33}.call-to-action[_ngcontent-%COMP%]:hover:not(.active):not(.non-activable){background-color:#7b8db133}.outro[_ngcontent-%COMP%]:hover:not(.active):not(.non-activable){background-color:#25365833}.content-snippet[_ngcontent-%COMP%]:hover:not(.active):not(.non-activable){background-color:#ff86bc33}"]});}}return i;})();ae();J();ae();function Xv(i,u){i&1&&b(0,"hr",7);}function Zv(i,u){i&1&&b(0,"div",7);}var Wh=(()=>{class i{constructor(e){this.DataService=e,this.item=Ci(),this.searchInput=Ci(),this.index=Ci(0),this.arrLength=Ci(0),this.highlightedText=Br(()=>{if(!this.searchInput())return this.item()?.text;let n=this.item()?.text,t=n.split(" "),o=this.searchInput()?.toLowerCase();if(t.length>8){let f=t.findIndex(V=>V.toLowerCase().includes(o)),m=t.slice(0,3).join(" "),v=t.slice(-4).join(" ");if(f>=3&&f<=t.length-4){let V=t.slice(f-3,f).join(" "),te=t.slice(f+1,f+4).join(" ");n=`... ${V} ${t[f]} ${te} ... `;}else n=`${m} ... ${v}`;}let h=o?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),k=new RegExp(`(${h})`,"gi");return n?.replace(k,"<strong>$1</strong>")||"";}),this.handleSuggestionClick=()=>{this.item()&&this.DataService.filterList(this.item()?.text||"");},this.handleSuggestionOnKeyDown=n=>{n.key==="Enter"&&this.item()&&this.DataService.filterList(this.item()?.text||"");};}static{this.ɵfac=function(n){return new(n||i)(d(Dt));};}static{this.ɵcmp=G({type:i,selectors:[["app-search-suggestion-custom-componenet"]],inputs:{item:[di.SignalBased,"item"],searchInput:[di.SignalBased,"searchInput"],index:[di.SignalBased,"index"],arrLength:[di.SignalBased,"arrLength"]},standalone:!0,features:[q],decls:8,vars:6,consts:[[1,"suggestion-block"],[1,"suggestion-tile"],[1,"tile-content"],[1,"suggestion-text",3,"innerHTML"],[1,"badge"],[3,"activeable","category"],["class","horizontal",4,"ngIf"],[1,"horizontal"]],template:function(n,t){if(n&1&&(r(0,"div",0)(1,"div",1)(2,"div",2),b(3,"span",3),r(4,"
9span",4),b(5,"app-category-badge",5),s()()(),M(6,Xv,1,0,"hr",6)(7,Zv,1,0,"div",6),s()),n&2){let o;a(3),c("innerHTML",t.highlightedText(),Uc),a(2),c("activeable",!1)("activeable",!1)("category",((o=t.item())==null?null:o.key)||""),a(),c("ngIf",t.index()!==t.arrLength()-1),a(),c("ngIf",t.index()===t.arrLength()-1);}},dependencies:[Xo,xe,_e],styles:[".suggestion-tile[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;align-items:center;font-size:12px;gap:10px}.suggestion-block[_ngcontent-%COMP%]{display:flex;padding:10px 15px 0;flex-direction:column;gap:10px}.suggestion-text[_ngcontent-%COMP%]{width:66%}.tile-content[_ngcontent-%COMP%]{display:flex;flex-direction:row;justify-content:space-between;align-items:center;width:100%}.badge[_ngcontent-%COMP%]{width:auto}.badge[_ngcontent-%COMP%]:hover{background-color:unset}.horizontal[_ngcontent-%COMP%]{width:100%;border-color:#7b8db14d!important;margin:unset;padding:unset}"]});}}return i;})();lr();xm();ht();ss();no();Bt();J();ht();ae();Ml();var e_=["searchInput"];function t_(i,u){if(i&1){let e=U();r(0,"div",4),b(1,"div",5),r(2,"div",6)(3,"app-navbar-button",7),S("click",function(){T(e);let t=p();return P(t.onSearchButtonClick());}),b(4,"img",8),s()()();}}function i_(i,u){if(i&1){let e=U();r(0,"ui-search-input",9,0),S("onInputValueChange",function(t){T(e);let o=p();return P(o.searchValueChanged(t));})("onSearchButtonClick",function(t){T(e);let o=p();return P(o.searchBarButtonClick(t));})("onGoBack",function(){T(e);let t=p();return P(t.searchGoBack());})("onSuggestionClick",function(t){T(e);let o=p();return P(o.searchSuggestionClick(t));}),s();}if(i&2){let e=p();c("inputIcon","search-input-search-icon")("showSearchButton",!0)("showGoBack",!0)("inputFormControl",e.searchBarInput)("searchOutput",e.suggestionOutput())("eventPath",e.searchBarEventPath)("suggestionComponent",e.customSuggestionComponent)("suggestionsFullWidth",!0);}}var Gh=(()=>{class i{constructor(e,n){this.aiScriptDataService=e,this.eventsService=n,this.EVENT_PATH=this.eventsService.events.script,this.isSearchBarOpen=Qe(!1),this.suggestionOutput=Qe([]),this.searchBarEventPath=this.EVENT_PATH.aiScriptCheckerSearchClick,this.searchBarInput=new Ht(""),this.customSuggestionComponent=Wh,this.onSearchButtonClick=()=>{this.isSearchBarOpen.set(!0),Ac(100).pipe(Co(1)).subscribe(()=>{this.searchInput&&this.searchInput.focus();});},this.onCloseSearchBarClick=()=>{this.isSearchBarOpen.set(!1);},this.searchValueChanged=t=>{let h=this.aiScriptDataService.searchForSegment(t).map(k=>Di(pe({},k),{label:k.text}));this.suggestionOutput.set(h);},this.searchBarButtonClick=t=>{this.aiScriptDataService.filterList(t);},this.searchGoBack=()=>{this.aiScriptDataService.clearSearch(),this.isSearchBarOpen.set(!1);},this.searchSuggestionClick=t=>{this.aiScriptDataService.filterList(t.text);};}static{this.ɵfac=function(n){return new(n||i)(d(Dt),d(Pe));};}static{this.ɵcmp=G({type:i,selectors:[["app-navigation-bar"]],viewQuery:function(n,t){if(n&1&&Ye(e_,5),n&2){let o;Ne(o=Fe())&&(t.searchInput=o.first);}},standalone:!0,features:[q],decls:3,vars:2,consts:[["searchInput",""],[1,"nav-bar-container"],["class","nav-bar",4,"ngIf"],["class","search-bar-input-script",3,"inputIcon","showSearchButton","showGoBack","inputFormControl","searchOutput","eventPath","suggestionComponent","suggestionsFullWidth","onInputValueChange","onSearchButtonClick","onGoBack","onSuggestionClick",4,"ngIf"],[1,"nav-bar"],[1,"left-side"],[1,"right-side"],[3,"click"],["src","../../../../../img/script-story-v2/Search.svg","alt",""],[1,"search-bar-input-script",3,"onInputValueChange","onSearchButtonClick","onGoBack","onSuggestionClick","inputIcon","showSearchButton","showGoBack","inputFormControl","searchOutput","eventPath","suggestionComponent","suggestionsFullWidth"]],template:function(n,t){n&1&&(r(0,"nav",1),M(1,t_,5,0,"div",2)(2,i_,2,8,"ui-search-input",3),s()),n&2&&(a(),c("ngIf",t.isSearchBarOpen()===!1),a(),c("ngIf",t.isSearchBarOpen()===!0));},dependencies:[zh,xe,_e,Un,rs],styles:[".nav-bar[_ngcontent-%COMP%]{display:flex;flex-direction:row;justify-content:space-between;position:relative;min-height:45px}[_nghost-%COMP%] .search-bar-input-script .input-with-suggestions .text-input{min-width:unset!important}"]});}}return i;})();J();J();Bt();ae();var rc=function(i){return i[i.hook=0]="hook",i[i.topic_introduction=1]="topic_introduction",i[i.speaker_introduction=2]="speaker_introduction",i[i.value_proposition=3]="value_proposition",i[i.call_to_action=4]="call_to_action",i[i.outro=5]="outro",i[i.highlight=6]="highlight",i;}(rc||{}),go=function(i){return i.hook="Hook",i.topic_introduction="Topic Intro",i.speaker_introduction="Speaker Intro",i.value_proposition="Value Proposition",i.c
9all_to_action="Call-to-Action",i.outro="Outro",i.highlight="Content Snipped",i;}(go||{}),Lt=function(i){return i.hook="hook",i.topic_introduction="topicIntro",i.speaker_introduction="speakerIntro",i.value_proposition="valueProposition",i.call_to_action="callToAction",i.outro="outro",i.highlight="highlight",i;}(Lt||{}),ua={EDIT_LABELS:"edit_labels",REWRITE_WITH_AI:"rewrite_with_ai"},qh={hook:{active:!1},topic_introduction:{active:!1},speaker_introduction:{active:!1},value_proposition:{active:!1},call_to_action:{active:!1},outro:{active:!1},highlight:{active:!1}},ga=[{tooltip:"Short attention-grabber",label:"hook"},{tooltip:"Makes it clear what the video will be about.",label:"topic_introduction"},{tooltip:"Helps viewers understand your expertise and why they should listen to you",label:"speaker_introduction"},{tooltip:"Encourages viewers to take specific steps after watching your video",label:"value_proposition"},{tooltip:"Communicates the unique value offered in the video",label:"call_to_action"},{tooltip:"Wraps up the video and provides closure.",label:"outro"},{tooltip:"Key information or tips shared in the video.",label:"highlight"}],Kh=` 10 Organize text segments by applying labels. Create a repository of hooks, 11 value propositions, introductions, and calls-to-action for reuse in future scripts and AI-generated videos. 12`;vi();J();ht();ae();function n_(i,u){if(i&1){let e=U();r(0,"div",null,0)(2,"app-category-badge",5,1),S("click",function(){let t=T(e).$implicit,o=p();return P(o.handleBadgeClick(t.label));}),s()();}if(i&2){let e,n=u.$implicit,t=p();a(2),c("matTooltipClass","tooltip-custom-black-script-labels-internal")("matTooltip",n==null?null:n.tooltip)("matTooltipPosition","above")("category",n.label)("phraseCount",((e=t.segmentsArray()[n.label])==null?null:e.length)||0)("withCount",!0);}}var Qh=(()=>{class i{constructor(e,n){this.aiScriptDataService=e,this.eventsService=n,this.categories=ga,this.EVENT_PATH=this.eventsService.events.script,this.tooltipText=Kh,this.segmentsArray=Qe({}),this.unsubscribe$=new Ze(),this.handleBadgeClick=t=>{this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerLabelClick,{label:Lt[t],numParts:this.segmentsArray()[t]?.length}),this.aiScriptDataService.setPickedCategorieSubject(t);};}ngOnInit(){this.aiScriptDataService.getSearchTrigger().pipe(me(this.unsubscribe$)).subscribe(()=>{this.segmentsArray.set(this.aiScriptDataService.getNewList());}),this.aiScriptDataService.getSegment().pipe(me(this.unsubscribe$)).subscribe(()=>{this.segmentsArray.set(this.aiScriptDataService.getNewList());});}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.unsubscribe();}static{this.ɵfac=function(n){return new(n||i)(d(Dt),d(Pe));};}static{this.ɵcmp=G({type:i,selectors:[["app-badges-section"]],standalone:!0,features:[q],decls:4,vars:1,consts:[["tooltipHost",""],["tooltip","matTooltip"],[1,"badges-title"],[1,"badges-section"],[4,"ngFor","ngForOf"],["matTooltipShowDelay","750",3,"click","matTooltipClass","matTooltip","matTooltipPosition","category","phraseCount","withCount"]],template:function(n,t){n&1&&(r(0,"div",2),y(1," Show Segments By Label "),s(),r(2,"div",3),M(3,n_,4,6,"div",4),s()),n&2&&(a(3),c("ngForOf",t.categories));},dependencies:[Xo,xe,Le,Xt],styles:[".badges-section[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:10px}.badges-title[_ngcontent-%COMP%]{display:flex;align-items:center;font-size:14px;font-weight:500;color:#7b8db1;margin-bottom:15px;gap:15px}.info-icon[_ngcontent-%COMP%]{background-image:url(/img/info-icon.svg);background-repeat:no-repeat;width:16px;height:16px;object-fit:contain;display:inline-block} .tooltip-custom-black-script-labels-internal{width:100%!important;height:fit-content!important;color:#fff!important;background:linear-gradient(to right,#404040,#131313);font-size:11px!important;font-weight:700!important;line-height:14px!important;text-align:center;padding:8px 12px!important;position:relative;display:block;border-radius:10px!important} .tooltip-custom-black-script-labels-internal.mdc-tooltip__surface{max-width:340px!important;font-weight:700!important;text-align:center!important}"]});}}return i;})();J();ae();Bt();J();ae();J();ae();var o_=["MenuButton"],r_=(i,u)=>({active:i,"topic-not-exists":u}),Yh=(()=>{class i{constructor(){this.text=Qe(""),this.startIndex=Qe(0),this.endIndex=Qe(0),this.trimmedText=Qe(""),this.isActive=Qe(!1),this.openMenuEvent=ne
12w be(),this.detectLength=e=>{let n=e.split(" "),t=n.slice(0,3).join(" "),o=n.slice(-4).join(" "),h=`${t}...${o}`;this.trimmedText.set(h);},this.openMenu=(e,n)=>{e.stopPropagation();let t=this.menuButton;this.openMenuEvent.emit({buttonRef:t,segment:n});};}ngOnInit(){this.startIndex.set(this.segment.startIndex),this.endIndex.set(this.segment.endIndex),this.text.set(this.segment.text),this.isActive.set(this.segment.active),this.detectLength(this.text());}ngOnChanges(e){if(e.segment){let n=this.segment;this.startIndex.set(this.segment.startIndex),this.endIndex.set(this.segment.endIndex),this.text.set(this.segment.text),this.isActive.set(n.active),this.detectLength(n.text);}}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["app-segments-item"]],viewQuery:function(n,t){if(n&1&&Ye(o_,7),n&2){let o;Ne(o=Fe())&&(t.menuButton=o.first);}},inputs:{segment:"segment",index:"index"},outputs:{openMenuEvent:"openMenuEvent"},standalone:!0,features:[Ut,q],decls:5,vars:5,consts:[["MenuButton",""],[1,"segment-item",3,"ngClass"],[1,"menu-btn",3,"click"],["src","../../../../../../img/script-story-v2/Menu.svg",1,"open-menu-icon"]],template:function(n,t){if(n&1){let o=U();r(0,"div",1),y(1),r(2,"button",2,0),S("click",function(k){return T(o),P(t.openMenu(k,t.segment));}),b(4,"img",3),s()();}n&2&&(c("ngClass",fi(2,r_,t.segment.active,!t.segment.existsInScript)),a(),se(" ",t.trimmedText()," "));},dependencies:[xe,we],styles:[".segment-item[_ngcontent-%COMP%]{border-radius:40px;justify-content:space-between;padding:8px;background-color:#4481fd14;font-size:12px;font-weight:400;color:#4481fd;display:flex;align-content:center;cursor:pointer;align-items:center}.segment-item[_ngcontent-%COMP%]:hover{background:#4481fd4d}.segment-item.active[_ngcontent-%COMP%]{background-color:#fff;border:2px solid rgba(68,129,253,1);padding:6px}.menu-btn[_ngcontent-%COMP%]{background:transparent;border:none;border-radius:40px;width:16px;height:16px;cursor:pointer}.menu-btn[_ngcontent-%COMP%]:hover{background-color:#4481fd99;box-shadow:#4481fd99 0 0 0 3px}.menu-icon[_ngcontent-%COMP%]{height:12px}.topic-not-exists[_ngcontent-%COMP%]{text-decoration-line:line-through!important;cursor:default!important;pointer-events:none!important;background:#4481fd14!important;color:#4481fd!important;pointer-events:none}"]});}}return i;})();J();ae();var s_=["floatingMenu"];function a_(i,u){if(i&1){let e=U();ot(0),r(1,"app-segments-item",2),S("openMenuEvent",function(t){T(e);let o=p();return P(o.onTriggerMenu(t));})("mouseenter",function(){let t=T(e),o=t.$implicit,h=t.index,k=p();return P(k.onMouseEnter(o.label,h));})("mouseleave",function(){let t=T(e),o=t.$implicit,h=t.index,k=p();return P(k.onMouseLeave(o.label,h));})("click",function(t){let o=T(e),h=o.$implicit,k=o.index,f=p();return P(f.onSegementClick(h.label,k,t));}),s(),rt();}if(i&2){let e=u.$implicit,n=p();a(),cn("disabled",!e.existsInScript),c("index",n.index)("segment",e);}}var Jh=(()=>{class i{constructor(e){this.DataService=e,this.segments=Ci([]),this.unsubscribe$=new Ze(),this.isMenuOpen=Qe(!1),this.menuPosition=Qe({x:0,y:0}),this.currentSigment=Qe({text:"",startIndex:0,endIndex:0,label:null,active:!1,existsInScript:!0}),this.triggerHighlightSet=new be(),this.triggerHighlightRemoval=new be(),this.triggerOpenMenu=new be(),this.closeMenuOnKeyPress=n=>{n.key==="Escape"&&this.isMenuOpen.set(!1);},this.handleOutsideClick=n=>{let t=this.floatingMenu?.nativeElement;t&&!t.contains(n.target)&&this.isMenuOpen.set(!1);},this.deleteItem=()=>{this.DataService.deleteSegment(this.currentSigment());},this.onMouseEnter=(n,t)=>{this.triggerHighlightSet.emit({sectionLabel:n,index:t});},this.onMouseLeave=(n,t)=>{this.triggerHighlightRemoval.emit({sectionLabel:n,index:t});},this.onSegementClick=(n,t,o)=>{o.stopPropagation(),this.DataService.setActiveSegment(n,t);},this.onTriggerMenu=n=>{this.triggerOpenMenu.emit(n);};}ngOnInit(){window.addEventListener("keydown",this.closeMenuOnKeyPress.bind(this));}ngOnChanges(e){}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.unsubscribe(),window.removeEventListener("keydown",this.closeMenuOnKeyPress),document.removeEventListener("click",this.handleOutsideClick);}static{this.ɵfac=function(n){return new(n||i)(d(Dt));};}static{this.ɵcmp=G({type:i,selectors:[["app-segments"]],viewQuery:function(n,t){if(n&1&&Ye(s_,5),n&2){let o;Ne(o=Fe())&&(t.floatingMenu=o.first);}},inputs:{segments:[di.SignalBased,"segments"]},outputs:{triggerHighlightSet:"triggerHighlightSet",triggerHighlightRemoval:"triggerHighlightRemoval",triggerOpenMenu:"triggerOpenMenu"},standalone:!0,features:[Ut,q],decls:2,vars:1,consts:[[1,"segment-section"],[4,"ngFor","ngForOf"],[1,"segment",3,"openMenuEvent","mouseenter","mouseleave","click","index","segment"]],template:function(n,t){n&1&&(r(0,"section",0),M(1,a_,2,4,"ng-container",1),s()),n&2&&(a(),c("ngForOf",t.segments()));},dependencies:[xe,Le,Yh],styles:[".segment-section[_ngcontent-%COMP%]{display:flex;gap:10px;flex-direction:column;height:100%}"]});}}return i;})();J();J();Bt();var kn={GENERATE_WITH_AI:"generate_with_ai",SEGMENTS:"segments",REWRITE_WITH_AI:"rewrite",FAILED_TO_LOAD:"failedToLoad"};J();var Zo=(()=>{class i{constructor(){this.currentView=new sn(kn.SEGMENTS),this.setViewToSegments=()=>{this.currentView.next(kn.SEGMENTS);},this.setViewToGenerateWithAi=()=>{this.currentView.next(kn.GENERATE_WITH_AI);},this.setViewToRewrite=()=>{this.currentView.next(kn.REWRITE_WITH_AI);},this.setFailedToLoad=()=>{this.currentView.next(kn.FAILED_TO_LOAD);},this.getView=()=>this.currentView.asObservable();}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵprov=Jt({token:i,factory:i.ɵfac,providedIn:"root"});}}return i;})();var Xh=(()=>{class i{constructor(e){this.ViewService=e,this.onGenerateNewClick=new be(),this.onButtonClick=()=>{this.onGenerateNewClick.emit();};}static{this.ɵfac=function(n){return new(n||i)(d(Zo));};}static{this.ɵcmp=G({type:i,selectors:[["app-generate-new-button"]],outputs:{onGenerateNewClick:"onGenerateNewClick"},standalone:!0,features:[q],decls:4,vars:0,consts:[[1,"generate-with-ai",3,"click"],[1,"image-gbt"],[1,"btn-text"]],template:function(n,t){n&1&&(r(0,"button",0),S("click",function(){return t.onButtonClick();}),b(1,"i",1),r(2,"span",2),y(3,"Generate New with AI"),s()());},styles:[".generate-with-ai[_ngcontent-%COMP%]{border-radius:40px;padding:4px 12px 4px 8px;display:flex;flex-direction:row;gap:12px;background-color:#4481fd;align-items:center;border:unset;cursor:pointer}.generate-with-ai[_ngcontent-%COMP%]:hover{background:#2d67dc}.btn-text[_ngcontent-%COMP%]{color:#fff;font-weight:600}.image-gbt[_ngcontent-%COMP%]{background-repeat:no-repeat;background-size:cover;background-position:center;width:24px;height:24px;background-image:url(/img/ai-cards/generate-btn-icon-white.svg)}"]});}}return i;})();Bt();ae();J();var Zh=(()=>{class i{constructor(e){this.DataService=e,this.onGoBackClick=()=>{this.DataService.clearSearch();};}static{this.ɵfac=function(n){return new(n||i)(d(Dt));};}static{this.ɵcmp=G({type:i,selectors:[["app-nothing-found"]],standalone:!0,features:[q],decls:5,vars:0,consts:[[1,"not-found-container"],[1,"no-results"],[1,"go-back",3,"click"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"p",1),y(2," No Results :( "),s(),r(3,"button",2),S("click",function(){return t.onGoBackClick();}),y(4," Go back "),s()());},styles:[".not-found-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;height:30vh;justify-content:center}.no-results[_ngcontent-%COMP%]{font-size:16px;font-weight:400}.go-back[_ngcontent-%COMP%]{padding:11px 16px;background-color:#253658;color:#fff;border-radius:10px;font-size:17px;font-weight:700;width:50%;cursor:pointer}"]});}}return i;})();J();ae();function c_(i,u){if(i&1){let e=U();r(0,"app-generate-new-button",6),S("onGenerateNewClick",function(){T(e);let t=p(2);return P(t.onGenerateNewClick());}),s();}}function l_(i,u){if(i&1){let e=U();r(0,"div",7)(1,"div",8),y(2,"Let\u2019s add one to improve your script!"),s(),r(3,"app-generate-new-button",6),S("onGenerateNewClick",function(){T(e);let t=p(2);return P(t.onGenerateNewClick());}),s()();}}function d_(i,u){if(i&1){let e=U();ot(0),b(1,"app-badges-section"),r(2,"app-segments",4),S("triggerHighlightSet",function(t){T(e);let o=p();return P(o.onTriggerSetHighlight(t));})("triggerHighlightRemoval",function(t){T(e);let o=p();return P(o.onTriggerRemovalHighlight(t));})("triggerOpenMenu",function(t){T(e);let o=p();return P(o.onTriggerOpenMenu(t));}),s(),M(3,c_,1,0,"app-generate-new-button",5)(4,l_,4,0,"ng-template",null,1,Re),rt();}if(i&2){let e=Be(5),n=p();a(2),c("segments",n.segments()),a(),c("ngIf",n.segments().length>0)("ngIfElse",e);}}function p_(i,u){i&1&&b(0,"app-nothing-found");}var em=(()=>{class i{constructor(e){this.DataService=e,this.unsubscribe$=new Ze(),this.topicSegments$=new sn({}),this.segments=Qe([]),this.allSegmnets=Qe({}),this.triggerHighlightSet=new be(),this.triggerHighlightRemoval=new be(),this.triggerOpenMenu=new be(),this.onGenerateNewButtonClick=new be(),this.shouldShowNothingFound=!1,this.onTriggerSetHighlight=n=>{this.triggerHighlightSet.emit(n);},this.onTriggerRemovalHighlight=n=>{this.triggerHighlightRemoval.emit(n);},this.onTriggerOpenMenu=n=>{this.triggerOpenMenu.emit(n);},this.onGenerateNewClick=()=>{this.onGenerateNewButtonClick.emit();};}ngOnChanges(e){this.topicSegments$.next(this.topicSegments);}ngOnInit(){Ec([this.DataService.getPickedCategorieSubject(),this.topicSegments$.asObservable()]).pipe(me(this.unsubscribe$)).subscribe(([e,n])=>{this.allSegmnets.set(n),this.segments.set(this.topicSegments[e]||[]);}),this.DataService.getSearchTrigger().pipe(me(this.unsubscribe$)).subscribe(()=>{this.shouldShowNothingFound=this.DataService.shouldShowNothingFound();});}
12ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.unsubscribe();}static{this.ɵfac=function(n){return new(n||i)(d(Dt));};}static{this.ɵcmp=G({type:i,selectors:[["app-segments-view"]],inputs:{topicSegments:"topicSegments"},outputs:{triggerHighlightSet:"triggerHighlightSet",triggerHighlightRemoval:"triggerHighlightRemoval",triggerOpenMenu:"triggerOpenMenu",onGenerateNewButtonClick:"onGenerateNewButtonClick"},standalone:!0,features:[Ut,q],decls:4,vars:2,consts:[["showNotFound",""],["showGenerateWithText",""],[1,"segments-view"],[4,"ngIf","ngIfElse"],[1,"app-segments",3,"triggerHighlightSet","triggerHighlightRemoval","triggerOpenMenu","segments"],[3,"onGenerateNewClick",4,"ngIf","ngIfElse"],[3,"onGenerateNewClick"],[1,"generate-new-when-empty"],[1,"no-segments-text"]],template:function(n,t){if(n&1&&(r(0,"div",2),M(1,d_,6,3,"ng-container",3)(2,p_,1,0,"ng-template",null,0,Re),s()),n&2){let o=Be(3);a(),c("ngIf",!t.shouldShowNothingFound)("ngIfElse",o);}},dependencies:[Qh,Jh,Xh,xe,_e,Zh],styles:[".segments-view[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:20px;margin-top:10px}.generate-new-when-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:20px;align-items:center}.no-segments-text[_ngcontent-%COMP%]{font-size:16px}"]});}}return i;})();ae();Ln();J();Ui();Ei();Bi();ae();vi();J();ht();ae();function h_(i,u){if(i&1){let e=U();r(0,"div",14,0)(2,"app-category-badge",15),S("click",function(){let t=T(e).$implicit,o=p();return P(o.onCategoryClick(t.label));}),s()();}if(i&2){let e=u.$implicit,n=p();c("matTooltip",e==null?null:e.tooltip)("matTooltipPosition","above"),a(2),c("category",e.label)("withCount",!1)("activeable",!0)("isToggle",!0)("allreadyActive",n.data==null?null:n.data.selectedLabels[e.label]);}}var fa=class extends Tt{},tm=(()=>{class i extends Pt{constructor(e,n,t){super(e),this.data=e,this.aiScriptDataService=n,this.eventService=t,this.EVENT_PATH=this.eventService.events.script,this.categories=ga,this.selectedTopicsCount=Qe(0),this.tooltipText=` 13 Assign one or multiple labels to a segment to improve filtering, 14 organization, and retrieval in searches or the library. 15 `,this.onCategoryClick=o=>{this.data.selectedLabels[o]=!this.data.selectedLabels[o],this.data.selectedLabels[o]?this.selectedTopicsCount.update(f=>f+1):this.selectedTopicsCount.update(f=>f-1);let h=this.aiScriptDataService.getCurrentSegmentOnMenu(),k=this.sortLabelsForEvents();this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerLabelsDialogInteract,{label:Lt[h.label],sentence:h.text,button:"label",labelsChosen:k});},this.submit=()=>{let o=this.aiScriptDataService.getCurrentSegmentOnMenu(),h=this.sortLabelsForEvents();this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerLabelsDialogInteract,{label:Lt[o.label],sentence:o.text,button:"apply",labelsChosen:h}),this.data.onSubmit(this.data.selectedLabels);},this.clearAllTopics=()=>{Object.keys(this.data.selectedLabels).map(h=>this.data.selectedLabels[h]=!1),this.selectedTopicsCount.set(0);let o=this.aiScriptDataService.getCurrentSegmentOnMenu();this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerLabelsDialogInteract,{label:Lt[o.label],sentence:o.text,button:"clear"});},this.close=()=>{let o=this.sortLabelsForEvents(),h=this.aiScriptDataService.getCurrentSegmentOnMenu();this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerLabelsDialogInteract,{label:Lt[h.label],sentence:h.text,button:"dismiss",labelsChosen:o}),this.data.onClose();},this.sortLabelsForEvents=()=>Object.entries(this.data.selectedLabels).filter(([o,h])=>h).map(([o])=>o).sort(),this.selectedTopicsCount.set(Object.values(e.selectedLabels).filter(o=>o===!0).length);}static{this.ɵfac=function(n){return new(n||i)(d(yt),d(Dt),d(Pe));};}static{this.ɵcmp=G({type:i,selectors:[["app-ai-checker-select-labels-dialog"]],standalone:!0,features:[Ae,q],decls:23,vars:8,consts:[["tooltip","matTooltip"],[1,"select-labels","wrapper"],[1,"title"],[1,"title-buttons"],["matTooltipPosition","below","matTooltipShowDelay","750","matTooltipHideDelay","300000",1,"info-icon",3,"matTooltip","matTooltipClass"],["type","button",1,"btn-header",3,"click"],["src","img/pages-user-research/exit.svg","alt","exit"],[1,"text"],[1,"badges-section"],["matTooltipClass","tooltip-custom-black-script-labels","matTooltipShowDelay","500",3,"matTooltip","matTooltipPosition",4,"ngFor","ngForOf"],[1,"selected-count"],[1,"buttons"],["type","button",1,"btn-footer","clearAll",3,"click"],["type","submit",1,"btn-footer","accept",3,"click"],["matTooltipClass","tooltip-custom-black-script-labels","matTooltipShowDelay","500",3,"matTooltip","matTooltipPosition"],[3,"click","category","withCount","activeable","isToggle","allreadyActive"]],template:function(n,t){if(n&1){let o=U();r(0,"div",1)(1,"header")(2,"section")(3,"div",2),y(4),s(),r(5,"div",3),b(6,"i",4,0),r(8,"button",5),S("click",function(){return T(o),P(t.close());}),b(9,"img",6),s()()(),r(10,"div",7),y(11),s()(),r(12,"main")(13,"div",8),M(14,h_,3,7,"div",9),s()(),r(15,"footer")(16,"div",10),y(17),s(),r(18,"div",11)(19,"button",12),S("click",function(){return T(o),P(t.clearAllTopics());}),y(20),s(),r(21,"button",13),S("click",function(){return T(o),P(t.submit());}),y(22),s()()()();}n&2&&(a(4),de(t.data.title),a(2),c("matTooltip",t.tooltipText)("matTooltipClass","tooltip-custom-white-script-labels-explanation"),a(5),de(t.data.text),a(3),c("ngForOf",t.categories),a(3),se(" ",t.selectedTopicsCount()," Selected "),a(3),se(" ",t.data.cancelBtn," "),a(2),se(" ",t.data.sendBtn," "));},dependencies:[Xo,xe,Le,Xt],styles:[".select-labels[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;padding:24px;gap:32px}.select-labels[_ngcontent-%COMP%] header[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column}.select-labels[_ngcontent-%COMP%] header[_ngcontent-%COMP%] section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}.select-labels[_ngcontent-%COMP%] main[_ngcontent-%COMP%]{width:100%;height:100%;margin-bottom:39px}.select-labels[_ngcontent-%COMP%] footer[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;align-items:center;justify-content:space-between;gap:10px}.badges-section[_ngcontent-%COMP%]{width:70%;height:100%;display:flex;flex-wrap:wrap;gap:10px}.btn-header[_ngcontent-%COMP%]{width:24px;height:24px;flex-shrink:0}.btn-header[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;object-position:center}.select-labels[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{color:#000;font-size:20px;font-weight:600;line-height:24px}.select-labels[_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{color:#0000004d;font-size:14px;font-weight:600;line-height:20px}.btn-footer[_ngcontent-%COMP%]{display:flex;height:28px;padding:13px 18px;justify-content:center;align-items:center;font-size:12px;font-weight:600}.clearAll[_ngcontent-%COMP%]{color:#7b8db1;border-radius:10px;background-color:#7b8db114;border:1px solid rgba(123,141,177,.08)}.accept[_ngcontent-%COMP%]{color:#fff;border:1px solid #3E72DC;border-radius:10px;background:#3e72dc}.buttons[_ngcontent-%COMP%]{display:flex;gap:10px;flex-direction:row}.selected-count[_ngcontent-%COMP%]{font-weight:600;font-size:10px;color:#25365899}.title-buttons[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center}"]});}}return i;})();at();ae();J();J();qt();ht();ae();var m_=()=>({"topic-container-active":!0}),u_=i=>({disabled:i}),im=(()=>{class i{constructor(e,n,t,o){this.viewService=e,this.aiScriptDataService=n,this.notifier=t,this.eventsService=o,this.EVENT_PATH=this.eventsService.events.script,this.parsedTopic=Qe(null),this.isLoading=!1,this.close=()=>{this.sendEventByChoice("delete"),this.viewService.setViewToSegments();},this.retry=()=>{this.sendEventByChoice("redo"),this.aiScriptDataService.setRewriteTextAgainTrigger();},this.copyText=()=>I(this,null,function*(){this.sendEventByChoice("copy");try{yield window.navigator.clipboard.writeText(this.rewrittenText),this.notifier.info("Copied to clipboard");}catch{this.notifier.error("Failed to copy your data to clipboard");}}),this.applyRewritedText=()=>{this.sendEventByChoice("replace"),this.aiScriptDataService.setReplaceTextInScriptTrigger();},this.sendEventByChoice=h=>{this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerGeneratedClick,{label:Lt[this.currentTopic],source:"rewrite",choice:h});};}ngOnInit(){this.parsedTopic.set(go[this.currentTopic]);}static{this.ɵfac=function(n){return new(n||i)(d(Zo),d(Dt),d(Ge),d(Pe));};}static{this.ɵcmp=G({type:i,selectors:[["app-ai-checker-segments-element"]],inputs:{currentTopic:[di.None,"pickedCategory","currentTopic"],rewrittenText:"rewrittenText",currentSegmnetOnMenu:"currentSegmnetOnMenu"},standalone:!0,features:[q],decls:21,vars:9,consts:[[1,"topic-container",3,"ngClass"],[1,"topic-tag"],[1,"bottom-section-topic"],[1,"section-title"],[1,"rewrite-button",3,"click"],["src","/img/script-story-v2/autorenew.svg","alt","generate"],[1,"control-btn",3,"click"],["src","/img/script-story-v2/close-rewrite.svg","alt","remove"],[1,"topic-text-scroll"],[1,"control-part",3,"ngClass"],[1,"controls"],["src","/img/script-story-v2/retry-rewrite.svg","alt","generate"],["src","/img/script-story-v2/copy-rewrite.svg","alt","copy"],[1,"replace-btn",3,"click","hidden","disabled"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),y(2),s(),r(3,"section",2)(4,"div",3)(5,"button",4),S("click",function(){return t.retry();}),b(6,"img",5),y(7," Rewrite "),s(),r(8,"button",6),S("click",function(){return t.close();}),b(9,"img",7),s()(),r(10,"div",8),y(11),s(),r(12,"div",9)(13,"div",10)(14,"button",6),S("click",function(){return t.retry();}),b(15,"img",11),s(),r(16,"button",6),S("click",function(){return t.copyText();}),b(17,"img",12),s()(),r(18,"div",10)(19,"button",13),S("click",function(){return t.applyRewritedText();}),y(20," Replace "),s()()()()()),n&2&&(c("ngClass",Nr(6,m_)),a(2),de(t.parsedTopic()),a(9),se(" ",t.rewrittenText," "),a(),c("ngClass",ue(7,u_,t.isLoading)),a(7),c("hidden",!t.currentSegmnetOnMenu.active)("disabled",!t.currentSegmnetOnMenu.active));},dependencies:[xe,we],styles:[".checker-container[_ngcontent-%COMP%]{position:relative}.topic-generate-action[_ngcontent-%COMP%]{color:#253658;font-size:12px;font-weight:500;display:flex;justify-content:center;align-items:center;flex-direction:column;
15cursor:pointer}.topic-generate-action[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{border-radius:50%;cursor:pointer}.topic-generate-action[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{display:block;width:32px;height:32px;background:url(/img/script-story-v2/create-tip-btn-active.svg) center/cover no-repeat}.topic-generate-action[_ngcontent-%COMP%] button[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{display:block;width:32px;height:32px;background:url(/img/script-story-v2/create-tip-btn.svg) center/cover no-repeat}.bottom-section-topic[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:center}.topic-text-scroll[_ngcontent-%COMP%]{width:100%;min-height:130px;max-height:130px;overflow-y:scroll;color:#253658;font-size:13px;font-weight:400;line-height:18px;white-space:pre-line;padding-right:8px;padding-top:8px}.control-part[_ngcontent-%COMP%]{width:100%;height:46px;display:flex;align-items:center;justify-content:space-between}.controls[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.controls-btn[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:24px;height:24px}.replace-btn[_ngcontent-%COMP%]{height:34px;width:78px;display:flex;padding:9px 14px;justify-content:center;align-items:center;gap:10px;border-radius:10px;background:#4481fd;color:#fff;text-align:center;font-size:13px;font-weight:400}.section-title[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%}.rewrite-button[_ngcontent-%COMP%]{color:#4481fd;display:flex;align-items:center;font-weight:600;flex-direction:row;gap:10px}",".ai-checker-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#253658;font-family:Inter-Bold}.section-topics[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:flex-start;gap:24px;padding-top:24px}.error-box[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;top:0;left:0;background:#fff;z-index:1;font-weight:700;font-size:20px;line-height:24px;text-align:center;color:#253658}.topic-container[_ngcontent-%COMP%]{width:100%;padding:20px 12px 12px;border-radius:12px;border:1px solid rgba(123,141,177,.3);position:relative;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;transition:all .3s ease-in-out}.topic-container-active[_ngcontent-%COMP%]{border:2px solid #4481FD}.topic-tag[_ngcontent-%COMP%]{position:absolute;padding:4px 8px;left:12px;top:-12px;display:flex;justify-content:center;align-items:center;border-radius:40px;background:#4481fd;color:#fff;font-size:12px;font-weight:700}.top-section-topic[_ngcontent-%COMP%]{width:100%;min-height:45px;display:flex;justify-content:space-between;align-items:center}.topic-scripts[_ngcontent-%COMP%]{width:100%;height:auto;display:flex;flex-wrap:wrap;gap:8px}.empty-topic[_ngcontent-%COMP%]{color:#7b8db1;font-size:14px;font-weight:400;width:100%;display:flex;align-items:center;justify-content:center}.topic-preview[_ngcontent-%COMP%]{color:#4481fd;font-size:12px;font-weight:400;display:flex;padding:4px 8px;justify-content:center;align-items:center;border-radius:40px;background:#4481fd14;cursor:pointer}.topic-preview[_ngcontent-%COMP%]:hover{background:#4481fd99;color:#fff}.topic-preview-active[_ngcontent-%COMP%]{border:2px solid #4481FD!important;background:#fff!important;color:#4481fd!important}.ai-checker-title-with-go-back[_ngcontent-%COMP%]{display:flex;gap:15px}"]});}}return i;})();J();var nm=(()=>{class i{static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵcmp=G({type:i,selectors:[["app-ai-checker-rewrite-segment-view"]],inputs:{pickedCategory:"pickedCategory",rewrittenText:"rewrittenText",currentSegmnetOnMenu:"currentSegmnetOnMenu"},standalone:!0,features:[q],decls:2,vars:3,consts:[[1,"rewrite-wrapper"],[3,"pickedCategory","rewrittenText","currentSegmnetOnMenu"]],template:function(n,t){n&1&&(r(0,"div",0),b(1,"app-ai-checker-segments-element",1),s()),n&2&&(a(),c("pickedCategory",t.pickedCategory)("rewrittenText",t.rewrittenText)("currentSegmnetOnMenu",t.currentSegmnetOnMenu));},dependencies:[im]});}}return i;})();J();ae();vi();J();ht();ae();vi();var g_=i=>({hide:i});function f_(i,u){if(i&1){let e=U();r(0,"button",9),S("click",function(){let t=T(e).$implicit,o=p().index,h=p();return P(h.onResultBtnClick(t.value,o));}),b(1,"i",10,0),s();}if(i&2){let e=u.$implicit;a(),gt(e.style),c("matTooltipPosition","above")("matTooltip",e==null?null:e.name);}}function v_(i,u){if(i&1){let e=U();r(0,"div",5)(1,"app-ai-rewrite-item",6),S("onSetCurrentResultIndex",function(){let t=T(e).index,o=p();return P(o.setCurrentResultIndex(t));}),s(),r(2,"div",7),M(3,f_,3,4,"button",8),s()();}if(i&2){let e=u.$implicit,n=u.index,t=p();a(),c("currentResultIndex",t.currentResultIndex)("index",n)("isDeleting",t.isDeleting)("rewriteItem",e),a(),c("ngClass",ue(6,g_,t.isLoading||n!=t.currentResultIndex)),a(),c("ngForOf",t.resultBtns);}}var om=(()=>{class i{constructor(e,n){this.aiScriptDataService=e,this.eventsService=n,this.onSetCurrentResultIndex=new be(),this.onDeleteResultBlock=new be(),this.onPastResultToScriptFromRewrite=new be(),this.onPastToWhiteboard=new be(),this.EVENT_PATH=this.eventsService.events.script,this.parsedTopic=Qe(""),this.setCurrentResultIndex=t=>
15{this.onSetCurrentResultIndex.emit(t);},this.sendEventByChoice=t=>{this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerGeneratedClick,{label:Lt[this.currentTopic],source:"label",choice:t});},this.onResultBtnClick=(t,o)=>{switch(t){case Wi.delete:this.sendEventByChoice("delete"),this.onDeleteResultBlock.emit(o);break;case Wi.past:this.onPastResultToScriptFromRewrite.emit(o),this.sendEventByChoice("add");break;case Wi.whiteboard:this.onPastToWhiteboard.emit(o),this.sendEventByChoice("whiteboard");break;}};}ngOnInit(){this.parsedTopic.set(go[this.currentTopic]);}static{this.ɵfac=function(n){return new(n||i)(d(Dt),d(Pe));};}static{this.ɵcmp=G({type:i,selectors:[["app-ai-checker-generate-text-view"]],inputs:{currentTopic:"currentTopic",generatedText:"generatedText",isDeleting:"isDeleting",isLoading:"isLoading",currentResultIndex:"currentResultIndex",resultBtns:"resultBtns"},outputs:{onSetCurrentResultIndex:"onSetCurrentResultIndex",onDeleteResultBlock:"onDeleteResultBlock",onPastResultToScriptFromRewrite:"onPastResultToScriptFromRewrite",onPastToWhiteboard:"onPastToWhiteboard"},standalone:!0,features:[q],decls:5,vars:2,consts:[["tooltip","matTooltip"],[1,"generate-with-ai-wrapper"],[1,"generate-with-ai-header"],[1,"ai-result-list-wrapper"],["class","ai-result-item-container",4,"ngFor","ngForOf"],[1,"ai-result-item-container"],[3,"onSetCurrentResultIndex","currentResultIndex","index","isDeleting","rewriteItem"],[1,"ai-result-action-menu",3,"ngClass"],[3,"click",4,"ngFor","ngForOf"],[3,"click"],["matTooltipClass","tooltip-custom-black-only",3,"matTooltipPosition","matTooltip"]],template:function(n,t){n&1&&(r(0,"section",1)(1,"div",2),y(2),s(),r(3,"section",3),M(4,v_,4,8,"div",4),s()()),n&2&&(a(2),se(" ",t.parsedTopic()," "),a(2),c("ngForOf",t.generatedText));},dependencies:[la,xe,we,Le,Hi,Xt],styles:[".generate-with-ai-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.generate-with-ai-header[_ngcontent-%COMP%]{font-size:14px;font-weight:500}.ai-result-list-wrapper[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:12px}.ai-result-item-container[_ngcontent-%COMP%]{position:relative;width:100%}",".ai-sidebar-container[_ngcontent-%COMP%]{width:405px;margin-top:40px;background:#fff;height:calc(100vh - 124px);overflow:hidden;box-shadow:0 0 40px #0000001a;border-radius:20px;padding:24px 0 24px 12px} aside#whiteboard, aside#ai-checker, aside#ai-checker-v2, aside#ai-rewrite{left:-664px!important;width:360px!important;background:transparent!important;z-index:31} aside#emotions{left:-664px!important;width:432px!important;background:transparent!important;z-index:31} aside#audiogram{left:-664px!important;width:536px!important;background:transparent!important;z-index:31}main[_ngcontent-%COMP%]{margin-top:42px;width:100%;height:calc(100vh - 254px);position:relative;overflow-y:scroll;overflow-x:hidden;padding:0 4px}main[_ngcontent-%COMP%]::-webkit-scrollbar{width:11px}header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;height:60px;position:absolute;width:100%;top:0;left:0;background:#fff;padding:0 15px}footer[_ngcontent-%COMP%]{width:100%;z-index:1;background:#fff;box-shadow:0 0 40px #0000001a;position:absolute;bottom:0;left:0;height:60px}.ai-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#00abfe;font-family:Inter-Bold;width:110px} .ai-text-area-wrapper .text-area-input-component .mat-form-field-label{white-space:pre-wrap!important}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar{width:3px;padding-left:4px}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#00abfe}.ai-result-action-menu[_ngcontent-%COMP%]{position:absolute;right:12px;top:-18px;background:#fff;box-shadow:0 0 24px #0000002e;border-radius:10px;width:100px;height:28px;display:flex;align-items:center;justify-content:space-evenly;cursor:pointer}.ai-result-action-menu[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:0;margin:0;width:20px;height:20px}.ai-result-action-menu[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;background-repeat:no-repeat;padding:0;display:block}
15.ai-result-action-menu[_ngcontent-%COMP%] .delete[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-d.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .past[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-past.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .whiteboard[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-m.svg)}.ai-menu-wrapper[_ngcontent-%COMP%]{width:100%;max-width:240px;text-overflow:ellipsis;white-space:nowrap;border:1px solid rgba(37,54,88,.6);background:#fff;border-radius:20px;padding:2px 6px;font-weight:400;font-size:14px;color:#253658}.fade[_ngcontent-%COMP%]{opacity:0;transition:all .5s ease-in-out}.hide[_ngcontent-%COMP%]{display:none!important}.editing[_ngcontent-%COMP%]{cursor:default!important}.disabled[_ngcontent-%COMP%]{opacity:.4}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%], .ai-result-wrapper-active[_ngcontent-%COMP%]{border:2px solid rgba(0,171,254,.6)!important;background:#fff!important;cursor:text!important}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-result-wrapper-active[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-droppable-area[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:164px}.ai-droppable-class[_ngcontent-%COMP%]{transform:scale(.9);transition:all .3s ease-in-out}.ai-droppable-area[_ngcontent-%COMP%]{width:100%}.ai-sale-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;height:100%;padding:0 12px}.ai-sale-component[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;gap:14px}.ai-sale-section[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;cursor:pointer}.upgrade-text[_ngcontent-%COMP%]{max-width:100px;font-weight:500;font-size:12px;line-height:15px;color:#253658}.ai-result-list-wrapper[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:12px}.ai-result-item-container[_ngcontent-%COMP%]{position:relative;width:100%}",".ai-checker-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#253658;font-family:Inter-Bold}.section-topics[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:flex-start;gap:24px;padding-top:24px}.error-box[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;top:0;left:0;background:#fff;z-index:1;font-weight:700;font-size:20px;line-height:24px;text-align:center;color:#253658}.topic-container[_ngcontent-%COMP%]{width:100%;padding:20px 12px 12px;border-radius:12px;border:1px solid rgba(123,141,177,.3);position:relative;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;transition:all .3s ease-in-out}.topic-container-active[_ngcontent-%COMP%]{border:2px solid #4481FD}.topic-tag[_ngcontent-%COMP%]{position:absolute;padding:4px 8px;left:12px;top:-12px;display:flex;justify-content:center;align-items:center;border-radius:40px;background:#4481fd;color:#fff;font-size:12px;font-weight:700}.top-section-topic[_ngcontent-%COMP%]{width:100%;min-height:45px;display:flex;justify-content:space-between;align-items:center}.topic-scripts[_ngcontent-%COMP%]{width:100%;height:auto;display:flex;flex-wrap:wrap;gap:8px}.empty-topic[_ngcontent-%COMP%]{color:#7b8db1;font-size:14px;font-weight:400;width:100%;display:flex;align-items:center;justify-content:center}.topic-preview[_ngcontent-%COMP%]{color:#4481fd;font-size:12px;font-weight:400;display:flex;padding:4px 8px;justify-content:center;align-items:center;border-radius:40px;background:#4481fd14;cursor:pointer}.topic-preview[_ngcontent-%COMP%]:hover{background:#4481fd99;color:#fff}.topic-preview-active[_ngcontent-%COMP%]{border:2px solid #4481FD!important;background:#fff!important;color:#4481fd!important}.ai-checker-title-with-go-back[_ngcontent-%COMP%]{display:flex;gap:15px}"]});}}return i;})();J();qt();pn();oo();ao();ht();Bn();Bt();J();Sm();var rm=(()=>{class i{constructor(e){this.http=e,this.mockApiUrl="assets/mock-data.json",this.mockApiUrlRewrite="assets/mock-data-rewrite.json";}getMockData(){return this.http.get(this.mockApiUrl).pipe(Mc(e=>this.transformData(e)));}getMockDataRewrite(e,n){return this.http.get(this.mockApiUrlRewrite);}transformData(e){return e.reduce((n,t)=>
15(t.labels.forEach((o,h)=>{n[o]||(n[o]=[]),n[o].push({text:t.text,startIndex:t.startIndex,endIndex:t.endIndex,label:o,active:!1,existsInScript:!0});}),n),{});}static{this.ɵfac=function(n){return new(n||i)(an(Xc));};}static{this.ɵprov=Jt({token:i,factory:i.ɵfac,providedIn:"root"});}}return i;})();at();bn();Mi();Zi();ae();var C_=["nestedMenuComponent"];function b_(i,u){i&1&&(r(0,"div",9),y(1," AI Script Checker "),s());}function S_(i,u){if(i&1){let e=U();r(0,"div",10)(1,"button",11),S("click",function(){T(e);let t=p();return P(t.goBack());}),b(2,"img",12),s(),r(3,"div",9),y(4," AI Writer "),s()();}}function x_(i,u){if(i&1){let e=U();r(0,"span",13),S("click",function(){T(e);let t=p();return P(t.closeSidebar());}),r(1,"button"),b(2,"img",14),s()();}}function y_(i,u){i&1&&(ot(0),r(1,"div",15),y(2,"Failed to load AI Script Checker :( "),s(),rt());}function k_(i,u){if(i&1){let e=U();r(0,"app-segments-view",17),S("triggerHighlightSet",function(t){T(e);let o=p(2);return P(o.triggerHighlightSet(t));})("triggerHighlightRemoval",function(t){T(e);let o=p(2);return P(o.triggerHighlightRemoval(t));})("triggerOpenMenu",function(t){T(e);let o=p(2);return P(o.triggerOpenMenu(t));})("onGenerateNewButtonClick",function(){T(e);let t=p(2);return P(t.generateNewSegmentsWithAi());}),s();}if(i&2){let e=p(2);c("topicSegments",e.segmentsSection());}}function w_(i,u){if(i&1&&(ot(0),b(1,"app-navigation-bar"),M(2,k_,1,1,"app-segments-view",16),rt()),i&2){let e=p();a(2),c("ngIf",e.currentView()===e.Views.SEGMENTS);}}function T_(i,u){if(i&1&&(ot(0),b(1,"app-navigation-bar")(2,"app-ai-checker-rewrite-segment-view",18),rt()),i&2){let e=p();a(2),c("pickedCategory",e.currentCategory())("rewrittenText",e.textRewriteResult())("currentSegmnetOnMenu",e.currentSegmnetOnMenu);}}function P_(i,u){if(i&1){let e=U();ot(0),r(1,"app-ai-checker-generate-text-view",19),S("onDeleteResultBlock",function(t){T(e);let o=p();return P(o.deleteAiWriteBlock(t));})("onPastResultToScriptFromRewrite",function(t){T(e);let o=p();return P(o.pastResultToScriptAndUpdateTopic(t));})("onPastToWhiteboard",function(t){T(e);let o=p();return P(o.pastToWhiteboard(t));})("onSetCurrentResultIndex",function(t){T(e);let o=p();return P(o.onSetCurrentResultIndex(t));}),s(),rt();}if(i&2){let e=p();a(),c("currentTopic",e.currentCategory())("generatedText",e.generatedText)("isDeleting",e.isDeleting)("isLoading",e.isLoading)("currentResultIndex",e.currentResultIndex)("resultBtns",e.resultBtns);}}function O_(i,u){if(i&1&&(r(0,"div",20),y(1),s()),i&2){let e=p();a(),de(e.errorMessage);}}function I_(i,u){if(i&1){let e=U();r(0,"div",24)(1,"img",25),S("click",function(){T(e);let t=p(2);return P(t.onPremiumFeatureClick(!1,!0));}),s(),r(2,"div",26),y(3,"Upgrade your plan to AI Pro"),s()();}if(i&2){let e=p(2);a(),c("src",e.upgradePlanImg,Ie);}}function M_(i,u){if(i&1&&(r(0,"footer")(1,"div",21),b(2,"app-ai-limit-circle",22),M(3,I_,4,1,"div",23),s()()),i&2){let e=p();a(2),c("remainingCredits",e.remainingCredits)("totalCredits",e.totalCredits)("tooltipText",e.tooltipText)("loading",e.isCheckLimits),a(),c("ngIf",e.userIsLimited);}}var sm=(()=>{class i extends Jo{onClick(e){if(this.currentActiveSegment().textIndex>=0){let n=document.querySelectorAll(".topic-preview"),t=document.querySelectorAll(".menu-li"),o=!1,h=!1;n.forEach(k=>{k.contains(e)&&(o=!0);}),t.forEach(k=>{k.contains(e)&&(h=!0);}),!o&&!h&&(this.aiScriptDataService.clearActiveSegment(),this.makeAllTopicsUnActive(!1));}}constructor(e,n,t,o,h,k,f,m,v,V,te,$,H,j,F,Z){super("ai-result-wrapper-active-checker",e,k,f,m,v,j,F,o),this.storyTrackCommunicationService=e,this.aiScriptService=n,this.navigationHelperService=t,this.notifier=o,this.planHelperService=h,this.anonymousUserService=k,this.portableRegisterService=f,this.eventsService=m,this.premiumPlanService=v,this.aiScriptDataService=V,this.viewService=te,this.mockApi=$,this.dialogService=H,this.deskManagerHelperService=j,this.adminRequestsService=F,this.creditsService=Z,this.highlightRemovalSubject=new Ze(),this.Views=kn,this.EVENT_PATH=this.eventsService.events.script,this.isLoading=!1,this.generating=!1,this.currentView=Qe(kn.SEGMENTS),this.segmentsSection=Qe(new Jn()),this.currentActiveSegment=Qe({segmentLabel:"",textIndex:-1}),this.menuSettings=Qe({show:!1,x:0,y:0}),this.currentCategory=Qe(null),this.textRewriteResult=Qe(""),this.isCheckLimits=!1,this.failedToLoad=!1,this.onSearchTrigger=()=>{this.segmentsSection.set(this.aiScriptDataService.getNewList()),this.findFirstCategorie(this.segmentsSection());},this.checkUserPlanAndLimits=()=>I(this,null,function*(){if(!this.isCheckLimits)try{this.isCheckLimits=!0,yield this.checkLimits(),this.userIsPro=yield this.planHelperService.isProOrTeamOrMaxByCurrentPlan();}catch(N){console.error(N);}finally{this.isCheckLimits=!1;}}),this.checkLimits=(N=!1)=>I(this,null,function*(){N&&this.creditsService.invalidateCache();let Q=yield this.creditsService.getCreditsUsage(),W=this.creditsService.getFeature(Q,"aiScript");this.remainingCredits=this.creditsService.getFeatureAvailableCredits(Q,"aiScript"),this.totalCredits=this.creditsService.getFeatureTotalCredits(Q,"aiScript"),this.tooltipText=W?this.creditsService.formatCostTooltip(W):"",this.userIsLim
15ited=this.creditsService.isFeatureLimited(Q,"aiScript"),this.canUseAiRewrite=!this.userIsLimited;}),this.goBack=()=>{this.generatedText&&(this.generatedText=[]),this.viewService.setViewToSegments();},this.findFirstCategorie=N=>{for(let Q=0;Q<Object.keys(N).length;Q++){let W=rc[Q];if(N[W]?.length>0){this.aiScriptDataService.setPickedCategorieSubject(W);break;}}},this.updateScriptLocally=N=>{if(N){this.setTopicsUpdateFlag(!0),this.story.script=N.contentData.script,Object.keys(this.segmentsSection()).forEach(O=>{this.segmentsSection()[O].forEach(D=>{D.existsInScript=this.story.script.includes(D.text);});});let{segmentLabel:Q,textIndex:W}=this.currentActiveSegment();W>=0&&(this.segmentsSection()[Q][W].existsInScript||this.makeAllTopicsUnActive(!0)),this.aiScriptDataService.setSegments(this.segmentsSection());}},this.setTopicsUpdateFlag=N=>{this.shouldUpdateTopics=N;},this.updateTopicsOpenClose=()=>{this.shouldUpdateTopics&&(this.viewService.setViewToSegments(),this.getScriptTopics());},this.getScriptTopics=()=>I(this,null,function*(){try{if(this.lottieTitle="Analyzing your script",this.isLoading=!0,this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerStart,{numWords:this.story.script.split(" ").length}),this.story.script.length>Ti.SCRIPT_SEGMENTATION_MINIMUM_CHAR_LENGTH){let N=yield this.aiScriptService.generateScriptTopics(this.story.script),Q=this.aiScriptDataService.transformData(N);this.aiScriptDataService.setSegments(Q),this.segmentsSection.set(Q),this.findFirstCategorie(Q),this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerOutput,{numWords:this.story.script.split(" ").length,identifiedLabels:N.length>0?sa(N.map(W=>W.labels)):""}),this.showError=!1;}else{let N=new Jn();this.segmentsSection.set(pe({},N)),this.aiScriptDataService.setSegments(pe({},N)),this.aiScriptDataService.setPickedCategorieSubject("hook");}this.setTopicsUpdateFlag(!1);}catch(N){console.error(N),N.responseJSON&&this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerOutput,{numWords:this.story.script.split(" ").length,identifiedLabels:"",error:N.responseJSON.msg}),N.status==504&&(this.failedToLoad=!0,this.viewService.setFailedToLoad()),N.data?.code==="30002"?(this.notifier.error("Script checker is currently only available for English scripts."),this.errorMessage="Script checker is currently only available for English scripts.",this.showError=!0):this.notifier.error("An error occurred while analyzing your script. Please try again.");}finally{this.isLoading=!1;}}),this.triggerHighlightSet=N=>{let{sectionLabel:Q,index:W}=N;this.highlightRemovalSubject.next({sectionIndex:Q,textIndex:W,state:!0});},this.setTempHighlight=(N,Q)=>{let W=this.segmentsSection()[N][Q];this.story.script.includes(W.text)&&!W.active?this.storyTrackCommunicationService.setSelectTextInScriptTrack(W,!1):W.active&&this.storyTrackCommunicationService.setSelectTextInScriptTrack(W,!0);},this.removeTempHighlight=(N,Q)=>{let W=this.currentActiveSegment(),O=this.segmentsSection()[N][Q];if(this.storyTrackCommunicationService.setClearTextInScriptTrack(),!O.active){if(W.textIndex!==-1){let ie=this.segmentsSection()[W.segmentLabel][W.textIndex];this.storyTrackCommunicationService.setSelectTextInScriptTrack(ie,!0);}return;}let D=this.segmentsSection()[W.segmentLabel][W.textIndex];this.storyTrackCommunicationService.setSelectTextInScriptTrack(D,!0);},this.setActiveTextTopic=(N,Q)=>{let W=JSON.parse(JSON.stringify(this.segmentsSection()));W[N][Q].active?(W[N][Q].active=!1,this.aiScriptDataService.clearActiveSegment(),this.storyTrackCommunicationService.setClearTextInScriptTrack(),this.currentActiveSegment.set({segmentLabel:"",textIndex:-1})):(this.makeAllTopicsUnActive(!0),W=this.segmentsSection(),W[N][Q].active=!0,this.storyTrackCommunicationService.setSelectTextInScriptTrack(W[N][Q],!0),this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerGenerateOutput,{label:Lt[N],sentence:W[N][Q].text})),this.segmentsSection.set(W),this.aiScriptDataService.setSegments(W);},this.makeAllTopicsUnActive=N=>{let Q=JSON.parse(JSON.stringify(this.segmentsSection()));
15Object.keys(Q).forEach(W=>{Q[W].forEach(O=>O.active=!1);}),N&&this.storyTrackCommunicationService.setClearTextInScriptTrack(),this.segmentsSection.set(Q),this.aiScriptDataService.setSegments(Q);},this.triggerOpenMenu=N=>{this.currentSegmnetOnMenu=N.segment,this.aiScriptDataService.setCurrentSegmentOnMenu(N.segment);let W=N.buttonRef.nativeElement.getBoundingClientRect();this.menuSettings.set({show:!0,x:W.left+20,y:W.top-75}),setTimeout(()=>{document.addEventListener("click",this.handleDocumentClick);},0);},this.handleDocumentClick=N=>{let Q=N.target;this.nestedMenuComponent.nativeElement.contains(Q)||(this.menuSettings.update(W=>Di(pe({},W),{show:!1})),document.removeEventListener("click",this.handleDocumentClick));},this.labelsDialogOnClose=N=>{this.dialogService.close();},this.openChangeLabelsDialog=()=>{let N=new fa();N.title="Select Labels",N.text="Assign one or more labels to your segment to categorize its content type.",N.cancelBtn="Clear all",N.sendBtn="Apply";let Q=[...new Set(this.aiScriptDataService.searchForSegment(this.currentSegmnetOnMenu.text).map(D=>D.key))],W=qh;Object.keys(W).forEach(D=>W[D]=Q.includes(D)),N.selectedLabels=W,N.onClose=this.labelsDialogOnClose.bind(N.selectedLabels),N.onSubmit=this.handleDialogSubmit;let O=new We();this.dialogService.open(N,tm,O);},this.selectOption=N=>{let{label:Q,text:W}=this.currentSegmnetOnMenu;switch(N.option.value){case ua.EDIT_LABELS:this.openChangeLabelsDialog(),this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerPartSelect,{label:Lt[Q],sentence:W,choice:"edit"});break;case ua.REWRITE_WITH_AI:this.rewriteSegmnet(this.currentSegmnetOnMenu,this.currentCategory()),this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerPartSelect,{label:Lt[Q],sentence:W,choice:"rewrite"});break;default:break;}this.menuSettings.update(O=>Di(pe({},O),{show:!1})),document.removeEventListener("click",this.handleDocumentClick);},this.handleDialogSubmit=N=>{let Q=Object.keys(N).filter(W=>N[W]===!0);this.aiScriptDataService.moveSegment(this.currentSegmnetOnMenu,Q),this.dialogService.close();},this.rewriteSegmnet=(N,Q)=>I(this,null,function*(){if(!this.canUseAiRewrite){this.onPremiumFeatureClick(!1,!1,"ai-text-segmentation-generate-rewrite");return;}let{segmentLabel:W,textIndex:O}=this.currentActiveSegment();if(O>=0){let D=this.segmentsSection()[W][O];this.storyTrackCommunicationService.setSelectTextInScriptTrack(D,!1);}try{this.lottieTitle="Creating the perfect text...",this.isLoading=!0,this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerGenerate,{label:Lt[this.currentCategory()],source:"rewrite"});let D={tone:tn.socialMedia,rewriteType:un.changeTone,rewriteText:N.text,allText:""},ie=yield this.aiScriptService.generateScriptRewrite(D);if(ie){let Te=[];ie.forEach((Ee,je)=>{(Ee.stop_reason=="stop"||Ee.stop_reason=="unknown")&&Te.push(Ee.text);}),Te&&(this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerGenerate,{label:Lt[this.currentCategory()],output:Te.join(" "),source:"rewrite"}),this.textRewriteResult.set(Te.join(" ")),this.viewService.setViewToRewrite());}yield this.checkLimits(!0);}catch(D){console.error(D),this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerGenerate,{label:Lt[this.currentCategory()],error:D.responseJSON.msg,source:"rewrite"}),this.creditsService.handleCreditError(D);}finally{this.isLoading=!1;}}),this.onReplaceTextInRetwrite=()=>{let{segmentLabel:N,textIndex:Q}=this.currentActiveSegment(),W=this.segmentsSection()[N][Q];W.active=!1;let O=W.text,D=this.story.script.replace(O,this.textRewriteResult());this.segmentsSection()[N].splice(Q,1);let ie={text:this.textRewriteResult(),label:N,startIndex:W.startIndex,endIndex:W.startIndex+this.textRewriteResult()?.length,active:!1,existsInScript:!0};this.segmentsSection()[N].push(ie),this.aiScriptDataService.setSegments(this.segmentsSection()),this.currentActiveSegment.set({segmentLabel:"",textIndex:-1}),this.storyTrackCommunicationService.setPopupUpdateScriptTrack(D);},this.generateNewSegmentsWithAi=(N,Q)=>I(this,null,function*(){if(!this.canUseAiRewrite){this.onPremiumFeatureClick(!1,!1,"ai-text-segmentation-generate-new");return;}try{let W=go[this.currentCategory()];this.lottieTitle=`Generating ${W}`,this.isLoading=!0,this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerGenerate,{label:Lt[this.currentCategory()],source:"label"});let O=yield this.aiScriptService.generateScriptTopicPart(this.story.script,Lt[this.currentCategory()],3);if(O){let D=[];O.forEach((ie,Te)=>{(ie.stop_reason=="stop"||ie.stop_reason=="unknown")&&(this.generatedText.push({id:Te,description:ie.text,tipItem:!1}),D.push(ie.text));}),this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerGenerate,{label:Lt[this.currentCategory()],output:D,source:"label"});}this.viewService.setViewToGenerateWithAi(),yield this.checkLimits(!0);}catch(W){console.error(W),W.responseJSON&&this.aiScriptDataService.sendEvent(this.EVENT_PATH.aiScriptCheckerGenerate,{label:Lt[this.currentCategory()],error:W.responseJSON.msg,source:"label"}),this.creditsService.handleCreditError(W);}finally{this.isLoading=!1;}}),this.onSetCurrentResultIndex=N=>{this.setCurrentResultIndex(N,!1);},this.pastResultToScriptAndUpdateTopic=N=>{this.pastResultToScriptFromAiRewrite(N);let Q=this.story.script?.length-this.generatedText[N]?.description.length,W=this.story.script?.length,O={text:this.generatedText[N].description,startIndex:Q,endIndex:W,label:this.currentCategory(),active:!1,existsInScript:!0};this.segmentsSection()[this.currentCategory()].push(O);let D=this.segmentsSection();this.aiScriptDataService.setSegments(D);},this.isLoading=!1,this.shouldUpdateTopics=!0,this.showError=!1,this.segmnetMenuOptions=[new St(ua.REWRITE_WITH_AI,"Rewrite With AI")],this.currentResultIndex=0,this.resultBtns=Bo("rewrite-checker");}ngOnInit(){this.eventListeners.push(this.storyTrackCommunicationService.observeStoryChanged().subscribe(e=>{this.story=e,this.aiScriptDataService.setStoryId(e.storyId);}),this.storyTrackCommunicationService.observeAiCheckSidebarOpen().subscribe(this.updateTopicsOpenClose),this.storyTrackCommunicationService.observeSelectedScriptTrack().subscribe(this.updateScriptLocally),this.storyTrackCommunicationService.observeUserPlan().subscribe(e=>this.checkUserPlanAndLimits()),this.viewService.getView().subscribe(e=>this.currentView.set(e)),this.aiScriptDataService.getChangedSegmentTopicTrigger().subscribe(()=>this.segmentsSection.set(pe({},this.aiScriptDataService.getNewList()))),this.aiScriptDataService.getSearchTrigger().subscribe(this.onSearchTrigger),this.aiScriptDataService.getPickedCategorieSubject().subscribe(e=>{this.currentCategory.set(e),this.segmentsSection.set(pe({},this.aiScriptDataService.getNewList()));}),this.aiScriptDataService.getRewriteTextAgainTrigger().subscribe(()=>this.rewriteSegmnet(this.currentSegmnetOnMenu,this.currentCategory())),this.aiScriptDataService.getReplaceTextInScriptTrigger().subscribe(()=>this.onReplaceTextInRetwrite()),this.highlightRemovalSubject.pipe(Xi(100),Nc(e=>new Promise(n=>{let t=e.state?0:200;setTimeout(()=>n(e),t);}))).subscribe(({sectionIndex:e,textIndex:n,state:t})=>{t?this.setTempHighlight(e,n):this.removeTempHighlight(e,n);}),this.aiScriptDataService.getActiveSegment().subscribe(e=>{let{segmentLabel:n,textIndex:t}=e;n&&t!=-1?(this.currentActiveSegment.set({segmentLabel:n,textIndex:t}),this.setActiveTextTopic(n,t)):this.currentActiveSegment.set({segmentLabel:"",textIndex:-1});})),this.viewService.setFailedToLoad();}
15ngOnDestroy(){this.eventListeners.forEach(e=>e.unsubscribe()),this.highlightRemovalSubject&&this.highlightRemovalSubject.unsubscribe(),document.removeEventListener("click",this.handleDocumentClick);}triggerHighlightRemoval(e){let{sectionLabel:n,index:t}=e;this.highlightRemovalSubject.next({sectionIndex:n,textIndex:t,state:!1});}closeSidebar(){this.storyTrackCommunicationService.setAiSidebarOpen(!1),this.navigationHelperService.toggleMediaSidebar(Je.NONE,!0);}static{this.ɵfac=function(n){return new(n||i)(d(He),d(Ti),d(ei),d(Ge),d(zt),d(xi),d(wi),d(Pe),d(hi),d(Dt),d(Zo),d(rm),d(Ue),d(Kt),d(xt),d(Vt));};}static{this.ɵcmp=G({type:i,selectors:[["app-ai-checker-container"]],viewQuery:function(n,t){if(n&1&&Ye(C_,5,On),n&2){let o;Ne(o=Fe())&&(t.nestedMenuComponent=o.first);}},hostBindings:function(n,t){n&1&&S("click",function(h){return t.onClick(h.target);},!1,So);},standalone:!0,features:[Ae,q],decls:17,vars:15,consts:[["generateWithAiTitle",""],["errorBox",""],["nestedMenuComponent",""],[1,"ai-sidebar-container","checker-container"],["class","ai-checker-sidebar-title",4,"ngIf","ngIfElse"],["class","close-button-ai-sidebar",3,"click",4,"ngIf"],[4,"ngIf"],[3,"title","subTitle","generating"],[3,"onOptionSelected","options","isVisible","leftPosition","topPosition"],[1,"ai-checker-sidebar-title"],[1,"ai-checker-title-with-go-back"],[3,"click"],["src","/img/blue-left-arrow.svg","alt","Go Back"],[1,"close-button-ai-sidebar",3,"click"],["src","/img/sidebar-close-icon.svg","alt","image"],[1,"failed-to-load-text"],[3,"topicSegments","triggerHighlightSet","triggerHighlightRemoval","triggerOpenMenu","onGenerateNewButtonClick",4,"ngIf"],[3,"triggerHighlightSet","triggerHighlightRemoval","triggerOpenMenu","onGenerateNewButtonClick","topicSegments"],[3,"pickedCategory","rewrittenText","currentSegmnetOnMenu"],[3,"onDeleteResultBlock","onPastResultToScriptFromRewrite","onPastToWhiteboard","onSetCurrentResultIndex","currentTopic","generatedText","isDeleting","isLoading","currentResultIndex","resultBtns"],[1,"error-box"],[1,"ai-sale-section"],[3,"remainingCredits","totalCredits","tooltipText","loading"],["class","ai-sale-component",4,"ngIf"],[1,"ai-sale-component"],["alt","image",3,"click","src"],[1,"upgrade-text"]],template:function(n,t){if(n&1){let o=U();r(0,"div",3)(1,"header"),M(2,b_,2,0,"div",4)(3,S_,5,0,"ng-template",null,0,Re)(5,x_,3,0,"span",5),s(),r(6,"main"),M(7,y_,3,0,"ng-container",6)(8,w_,3,1,"ng-container",6)(9,T_,3,3,"ng-container",6)(10,P_,2,6,"ng-container",6)(11,O_,2,1,"ng-template",null,1,Re),s(),M(13,M_,4,5,"footer",6),b(14,"app-process-fake-with-lottie",7),s(),r(15,"app-nested-menu",8,2),S("onOptionSelected",function(k){return T(o),P(t.selectOption(k));}),s();}if(n&2){let o=Be(4);a(2),c("ngIf",t.currentView()!==t.Views.GENERATE_WITH_AI)("ngIfElse",o),a(3),c("ngIf",!t.isLoading),a(2),c("ngIf",t.currentView()===t.Views.FAILED_TO_LOAD),a(),c("ngIf",t.currentView()===t.Views.SEGMENTS),a(),c("ngIf",t.currentView()===t.Views.REWRITE_WITH_AI),a(),c("ngIf",t.currentView()===t.Views.GENERATE_WITH_AI),a(3),c("ngIf",t.currentView()!==t.Views.SEGMENTS),a(),c("title",t.lottieTitle)("subTitle","It will take a moment...")("generating",t.isLoading),a(),c("options",t.segmnetMenuOptions)("isVisible",t.menuSettings().show)("leftPosition",t.menuSettings().x)("topPosition",t.menuSettings().y);}},dependencies:[Do,Gh,em,xe,_e,zs,nm,om,$i],styles:[".checker-container[_ngcontent-%COMP%]{position:relative}.checker-container[_ngcontent-%COMP%] main[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:15px}.topic-not-exists[_ngcontent-%COMP%]{text-decoration-line:line-through!important;cursor:default!important;pointer-events:none!important;background:#4481fd14!important;color:#4481fd!important}.topic-generate-action[_ngcontent-%COMP%]{color:#253658;font-size:12px;font-weight:500;display:flex;justify-content:center;align-items:center;flex-direction:column;
15cursor:pointer}.topic-generate-action[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{border-radius:50%;cursor:pointer}.topic-generate-action[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{display:block;width:32px;height:32px;background:url(/img/script-story-v2/create-tip-btn-active.svg) center/cover no-repeat}.topic-generate-action[_ngcontent-%COMP%] button[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{display:block;width:32px;height:32px;background:url(/img/script-story-v2/create-tip-btn.svg) center/cover no-repeat}.bottom-section-topic[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:center}.topic-text-scroll[_ngcontent-%COMP%]{width:100%;height:80px;max-height:80px;overflow-y:scroll;color:#253658;font-size:13px;font-weight:400;line-height:18px;white-space:pre-line;padding-right:8px;padding-top:8px}.control-part[_ngcontent-%COMP%]{width:100%;height:46px;display:flex;align-items:center;justify-content:space-between}.controls[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.controls-btn[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:24px;height:24px}.replace-btn[_ngcontent-%COMP%]{height:34px;width:78px;display:flex;padding:9px 14px;justify-content:center;align-items:center;gap:10px;border-radius:10px;background:#4481fd;color:#fff;text-align:center;font-size:13px;font-weight:400}.feedback-section[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.feedback-btn[_ngcontent-%COMP%]{display:flex;width:160px;padding:6px 10px;justify-content:center;align-items:center;color:#fff;font-weight:600;flex-shrink:0;border-radius:10px;background:#6f54ff;z-index:11}.remove-button-container[_ngcontent-%COMP%]{background-image:url(/img/delete_icon.svg);background-repeat:no-repeat;background-size:contain;background-position:center;margin-left:20px;width:30px;height:20px;cursor:pointer}.edit-labels[_ngcontent-%COMP%]{background:#7b8db114;color:#253658!important} app-nested-menu .customMenu{z-index:unset!important}.failed-to-load-text[_ngcontent-%COMP%]{display:flex;font-weight:600;font-size:20px;height:100%;align-items:center;justify-content:center}",".ai-sidebar-container[_ngcontent-%COMP%]{width:405px;margin-top:40px;background:#fff;height:calc(100vh - 124px);overflow:hidden;box-shadow:0 0 40px #0000001a;border-radius:20px;padding:24px 0 24px 12px} aside#whiteboard, aside#ai-checker, aside#ai-checker-v2, aside#ai-rewrite{left:-664px!important;width:360px!important;background:transparent!important;z-index:31} aside#emotions{left:-664px!important;width:432px!important;background:transparent!important;z-index:31} aside#audiogram{left:-664px!important;width:536px!important;background:transparent!important;z-index:31}main[_ngcontent-%COMP%]{margin-top:42px;width:100%;height:calc(100vh - 254px);position:relative;overflow-y:scroll;overflow-x:hidden;padding:0 4px}main[_ngcontent-%COMP%]::-webkit-scrollbar{width:11px}header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;height:60px;position:absolute;width:100%;top:0;left:0;background:#fff;padding:0 15px}footer[_ngcontent-%COMP%]{width:100%;z-index:1;background:#fff;box-shadow:0 0 40px #0000001a;position:absolute;bottom:0;left:0;height:60px}.ai-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#00abfe;font-family:Inter-Bold;width:110px} .ai-text-area-wrapper .text-area-input-component .mat-form-field-label{white-space:pre-wrap!important}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar{width:3px;padding-left:4px}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#00abfe}.ai-result-action-menu[_ngcontent-%COMP%]{position:absolute;right:12px;top:-18px;background:#fff;box-shadow:0 0 24px #0000002e;border-radius:10px;width:100px;height:28px;display:flex;align-items:center;justify-content:space-evenly;cursor:pointer}.ai-result-action-menu[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:0;margin:0;width:20px;height:20px}.ai-result-action-menu[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;background-repeat:no-repeat;padding:0;display:block}
15.ai-result-action-menu[_ngcontent-%COMP%] .delete[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-d.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .past[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-past.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .whiteboard[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-m.svg)}.ai-menu-wrapper[_ngcontent-%COMP%]{width:100%;max-width:240px;text-overflow:ellipsis;white-space:nowrap;border:1px solid rgba(37,54,88,.6);background:#fff;border-radius:20px;padding:2px 6px;font-weight:400;font-size:14px;color:#253658}.fade[_ngcontent-%COMP%]{opacity:0;transition:all .5s ease-in-out}.hide[_ngcontent-%COMP%]{display:none!important}.editing[_ngcontent-%COMP%]{cursor:default!important}.disabled[_ngcontent-%COMP%]{opacity:.4}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%], .ai-result-wrapper-active[_ngcontent-%COMP%]{border:2px solid rgba(0,171,254,.6)!important;background:#fff!important;cursor:text!important}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-result-wrapper-active[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-droppable-area[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:164px}.ai-droppable-class[_ngcontent-%COMP%]{transform:scale(.9);transition:all .3s ease-in-out}.ai-droppable-area[_ngcontent-%COMP%]{width:100%}.ai-sale-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;height:100%;padding:0 12px}.ai-sale-component[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;gap:14px}.ai-sale-section[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;cursor:pointer}.upgrade-text[_ngcontent-%COMP%]{max-width:100px;font-weight:500;font-size:12px;line-height:15px;color:#253658}.ai-result-list-wrapper[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:12px}.ai-result-item-container[_ngcontent-%COMP%]{position:relative;width:100%}",".ai-checker-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#253658;font-family:Inter-Bold}.section-topics[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:flex-start;gap:24px;padding-top:24px}.error-box[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;top:0;left:0;background:#fff;z-index:1;font-weight:700;font-size:20px;line-height:24px;text-align:center;color:#253658}.topic-container[_ngcontent-%COMP%]{width:100%;padding:20px 12px 12px;border-radius:12px;border:1px solid rgba(123,141,177,.3);position:relative;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;transition:all .3s ease-in-out}.topic-container-active[_ngcontent-%COMP%]{border:2px solid #4481FD}.topic-tag[_ngcontent-%COMP%]{position:absolute;padding:4px 8px;left:12px;top:-12px;display:flex;justify-content:center;align-items:center;border-radius:40px;background:#4481fd;color:#fff;font-size:12px;font-weight:700}.top-section-topic[_ngcontent-%COMP%]{width:100%;min-height:45px;display:flex;justify-content:space-between;align-items:center}.topic-scripts[_ngcontent-%COMP%]{width:100%;height:auto;display:flex;flex-wrap:wrap;gap:8px}.empty-topic[_ngcontent-%COMP%]{color:#7b8db1;font-size:14px;font-weight:400;width:100%;display:flex;align-items:center;justify-content:center}.topic-preview[_ngcontent-%COMP%]{color:#4481fd;font-size:12px;font-weight:400;display:flex;padding:4px 8px;justify-content:center;align-items:center;border-radius:40px;background:#4481fd14;cursor:pointer}.topic-preview[_ngcontent-%COMP%]:hover{background:#4481fd99;color:#fff}.topic-preview-active[_ngcontent-%COMP%]{border:2px solid #4481FD!important;background:#fff!important;color:#4481fd!important}.ai-checker-title-with-go-back[_ngcontent-%COMP%]{display:flex;gap:15px}"]});}}return i;})();J();Pm();ae();Bt();ji();J();qt();Zi();ht();ae();function E_(i,u){if(i&1){let e=U();r(0,"span",16),S("click",function(){T(e);let t=p();return P(t.closeSidebar());}),r(1,"button"),b(2,"img",17),s()();}}var am=(()=>{class i{constructor(e,n,t,o,h,k){this.navigationHelperService=e,this.storyTrackCommunicationService=n,this.aiScriptService=t,this.notifier=o,this.creditsService=h,this.eventsService=k,this.aiIcon="/img/icon-library/ai/ai-stroke-small.svg",this.ESTIMATED_WORDS_PER_MINUTE=160,this.placeholderText="How should it sound? (e.g. Excited and conspiratorial)",this.infoMessage="Optional \u2014 leave blank to match your script's tone",this.description="",this.isLoading=!1,this.scriptTracks=[],this.latestSelectedScriptTrack=null,this.subscriptions=[],this.destroyRef=et(Bc),this.cpSlotsStore=et(ni,{optional:!0}),this.cpProjectAnalytics=et(ii),this.onDescriptionChange=f=>{this.description=f??"";},this.onGenerateClick=()=>
15{if(this.isLoading)return;let f=this.getCurrentScript();if(!f.trim()){this.notifier.error("Write some script before generating emotion tags.");return;}this.isLoading=!0,Oc(this.aiScriptService.generateEmotionTags(f,this.description)).pipe(Rc(()=>{this.isLoading=!1;}),dl(this.destroyRef)).subscribe({next:m=>{let v=m?.[0]?.text;if(typeof v!="string"||!v.trim()){this.notifier.error("Could not enhance the script. Please try again.");return;}this.logEmotionsAdded({originalScript:f,enhancedScript:v}),this.storyTrackCommunicationService.setPopupUpdateScriptTrack(v);},error:m=>{console.error(m),!this.creditsService.handleCreditError(m)&&this.notifier.error("An error occurred while generating emotion tags. Please try again.");}});},this.onRemoveEmotionsClick=()=>{if(this.isLoading)return;let f=this.getCurrentScript(),m=Ns(f);if(m.length){let{scriptLen:v,scriptDuration:V}=this.buildScriptMetrics(f);this.eventsService.log(this.eventsService.events.script.emotionsRemove,pe({scriptLen:v,scriptDuration:V,numTags:m.length,emotions:[...new Set(m)]},this.cpProjectAnalytics.attrs({slots:this.cpSlotsStore?.slots()})));}this.storyTrackCommunicationService.setRemoveBracketTagsFromScript();},this.closeSidebar=()=>{this.storyTrackCommunicationService.setAiSidebarOpen(!1),this.navigationHelperService.toggleMediaSidebar(Je.NONE,!0);},this.getCurrentScript=()=>{let f=this.latestSelectedScriptTrack?.contentData?.script;return typeof f=="string"?f:(this.scriptTracks.find(V=>V?.active)??this.scriptTracks[0])?.contentData?.script??"";},this.logEmotionsAdded=({originalScript:f,enhancedScript:m})=>{let v=this.diffAddedTags(f,m),{scriptLen:V,scriptDuration:te}=this.buildScriptMetrics(m);this.eventsService.log(this.eventsService.events.script.emotionsAdd,pe({prompt:this.description,scriptLen:V,scriptDuration:te,numTags:v.length,emotions:[...new Set(v)]},this.cpProjectAnalytics.attrs({slots:this.cpSlotsStore?.slots()})));},this.diffAddedTags=(f,m)=>{let v=new Map();for(let te of Ns(f))v.set(te,(v.get(te)??0)+1);let V=[];for(let te of Ns(m)){let $=v.get(te)??0;$>0?v.set(te,$-1):V.push(te);}return V;},this.buildScriptMetrics=f=>{let m=Lo(Rs(f));return{scriptLen:m,scriptDuration:Math.round(m/this.ESTIMATED_WORDS_PER_MINUTE*60)};};}ngOnInit(){this.subscriptions.push(this.storyTrackCommunicationService.observeScriptTracks().subscribe(e=>{this.scriptTracks=e??[];}),this.storyTrackCommunicationService.observeSelectedScriptTrack().subscribe(e=>{e&&(this.latestSelectedScriptTrack=e);}));}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe());}static{this.ɵfac=function(n){return new(n||i)(d(ei),d(He),d(Ti),d(Ge),d(Vt),d(Pe));};}static{this.ɵcmp=G({type:i,selectors:[["emotions-sidebar"]],standalone:!0,features:[q],decls:18,vars:10,consts:()=>{let e;e="Expressiveness";let n;n="Make your script sound performed, not read";let t;t="Remove emotions";let o;o="Generate";let h;return h="close",[e,n,t,o,[1,"ai-sidebar-container","emotions-container"],[1,"emotions-header"],[1,"emotions-title-block"],[1,"emotions-title"],[1,"emotions-subtitle"],["class","close-button-ai-sidebar",3,"click",4,"ngIf"],[1,"emotions-main"],["width","100%","height","98px",1,"emotions-textarea",3,"valueChange","label","aiButton","placeholder","state","value"],["status","info","variant","filled",3,"message"],[1,"emotions-footer"],["variant","ghost","size","md",3,"clicked","disabled"],["variant","primary","size","md",3,"clicked","loading","leftIconContent"],[1,"close-button-ai-sidebar",3,"click"],["src","/img/sidebar-close-icon.svg","alt",h]];},template:function(n,t){n&1&&(r(0,"div",4)(1,"header",5)(2,"div",6)(3,"div",7),vn(4,0),s(),r(5,"div",8),vn(6,1),s()(),M(7,E_,3,0,"span",9),s(),r(8,"main",10)(9,"lib-textarea",11),S("valueChange",function(h){return t.onDescriptionChange(h);}),s(),b(10,"lib-alert",12),s(),r(11,"footer",13)(12,"lib-button",14),S("clicked",function(){return t.onRemoveEmotionsClick();}),ot(13),vn(14,2),rt(),s(),r(15,"lib-button",15),S("clicked",function(){return t.onGenerateClick();}),ot(16),vn(17,3),rt(),s()()()),n&2&&(a(7),c("ngIf",!t.isLoading),a(2),c("label",!1)("aiButton",!1)("placeholder",t.placeholderText)("state",t.isLoading?"disabled":"default")("value",t.description),a(),c("message",t.infoMessage),a(2),c("disabled",t.isLoading),a(3),c("loading",t.isLoading)("leftIconContent",t.aiIcon));},dependencies:[xe,_e,fl,Fi,gl],styles:[".ai-sidebar-container[_ngcontent-%COMP%]{width:405px;margin-top:40px;background:#fff;height:calc(100vh - 124px);overflow:hidden;box-shadow:0 0 40px #0000001a;border-radius:20px;padding:24px 0 24px 12px} aside#whiteboard, aside#ai-checker, aside#ai-checker-v2, aside#ai-rewrite{left:-664px!important;width:360px!important;background:transparent!important;z-index:31} aside#emotions{left:-664px!important;width:432px!important;background:transparent!important;z-index:31} aside#audiogram{left:-664px!important;width:536px!important;background:transparent!important;z-index:31}main[_ngcontent-%COMP%]{margin-top:42px;width:100%;height:calc(100vh - 254px);position:relative;overflow-y:scroll;overflow-x:hidden;padding:0 4px}main[_ngcontent-%COMP%]::-webkit-scrollbar{width:11px}header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;height:60px;position:absolute;width:100%;top:0;left:0;background:#fff;padding:0 15px}footer[_ngcontent-%COMP%]{width:100%;z-index:1;background:#fff;box-shadow:0 0 40px #0000001a;position:absolute;bottom:0;left:0;height:60px}.ai-sidebar-title[_ngcontent-%COMP%]{font-weight:700;font-size:16px;line-height:19px;color:#00abfe;font-family:Inter-Bold;width:110px} .ai-text-area-wrapper .text-area-input-component .mat-form-field-label{white-space:pre-wrap!important}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar{width:3px;padding-left:4px}.ai-text-area-wrapper[_ngcontent-%COMP%] text-area[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#00abfe}.ai-result-action-menu[_ngcontent-%COMP%]{position:absolute;right:12px;top:-18px;background:#fff;box-shadow:0 0 24px #0000002e;border-radius:10px;width:100px;height:28px;display:flex;align-items:center;justify-content:space-evenly;cursor:pointer}.ai-result-action-menu[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:0;margin:0;width:20px;height:20px}.ai-result-action-menu[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;background-repeat:no-repeat;padding:0;display:block}
15.ai-result-action-menu[_ngcontent-%COMP%] .delete[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-d.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .past[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-past.svg)}.ai-result-action-menu[_ngcontent-%COMP%] .whiteboard[_ngcontent-%COMP%]{background-image:url(/img/script-story-v2/ai-rewrite-m.svg)}.ai-menu-wrapper[_ngcontent-%COMP%]{width:100%;max-width:240px;text-overflow:ellipsis;white-space:nowrap;border:1px solid rgba(37,54,88,.6);background:#fff;border-radius:20px;padding:2px 6px;font-weight:400;font-size:14px;color:#253658}.fade[_ngcontent-%COMP%]{opacity:0;transition:all .5s ease-in-out}.hide[_ngcontent-%COMP%]{display:none!important}.editing[_ngcontent-%COMP%]{cursor:default!important}.disabled[_ngcontent-%COMP%]{opacity:.4}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%], .ai-result-wrapper-active[_ngcontent-%COMP%]{border:2px solid rgba(0,171,254,.6)!important;background:#fff!important;cursor:text!important}.ai-result-wrapper-active-whiteboard[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-result-wrapper-active[_ngcontent-%COMP%]::selection{background:#b3d4fc!important;text-shadow:none}.ai-droppable-area[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:164px}.ai-droppable-class[_ngcontent-%COMP%]{transform:scale(.9);transition:all .3s ease-in-out}.ai-droppable-area[_ngcontent-%COMP%]{width:100%}.ai-sale-section[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;height:100%;padding:0 12px}.ai-sale-component[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;gap:14px}.ai-sale-section[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;cursor:pointer}.upgrade-text[_ngcontent-%COMP%]{max-width:100px;font-weight:500;font-size:12px;line-height:15px;color:#253658}.ai-result-list-wrapper[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:12px}.ai-result-item-container[_ngcontent-%COMP%]{position:relative;width:100%}",".emotions-container[_ngcontent-%COMP%]{width:432px;margin-top:40px;height:calc(100vh - 124px);background:#fff;box-shadow:0 0 40px #0000001a;border-radius:20px;padding:20px;display:flex;flex-direction:column;gap:20px;overflow:hidden}.emotions-header[_ngcontent-%COMP%]{position:static;display:flex;align-items:flex-start;justify-content:space-between;height:auto;width:100%;padding:0;background:transparent}.emotions-title-block[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;flex:1 0 0;min-width:0}.emotions-title[_ngcontent-%COMP%]{font-family:Inter-Bold,Inter,sans-serif;font-weight:700;font-size:20px;line-height:1.4;color:#253658}.emotions-subtitle[_ngcontent-%COMP%]{font-family:Inter,sans-serif;font-weight:400;font-size:14px;line-height:1.4;letter-spacing:-.14px;color:#4b5563}.close-button-ai-sidebar[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center}.close-button-ai-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:32px;height:32px;border:none;background:transparent;border-radius:8px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0}.close-button-ai-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover{background:#7b8db114}.emotions-main[_ngcontent-%COMP%]{position:static;margin:0;padding:0;flex:1 0 0;min-height:0;width:100%;height:auto;display:flex;flex-direction:column;gap:8px;overflow-y:auto;overflow-x:hidden}.emotions-textarea[_ngcontent-%COMP%]{width:100%}.emotions-footer[_ngcontent-%COMP%]{position:static;width:100%;height:40px;background:transparent;box-shadow:none;display:flex;align-items:center;justify-content:flex-end;gap:12px}"]});}}return i;})();var VM=[new St("image","Image")],A_=[new St("video","Video")],cm=[new ho("whiteboard",Je.WHITEBOARD,kh),new ho("ai-rewrite",Je.AI_REWRITE,Mh),new ho("ai-checker-v2",Je.AI_CHECKER_V2,sm),new ho("emotions",Je.EMOTIONS,am),new ho("video-assets-uploads",Je.MY_VIDEO_UPLOADS,qd,[{key:"assetSidebarType",value:hr.Uploads},{key:"sidebarHeader",value:"Media Library"},{key:"itemsAddable",value:!0},{key:"closeable",value:!1},{key:"closeButton",value:!0},{key:"allowedMediaTypesOptions",value:A_}
15,{key:"addButtonBackground",value:"#00d096"},{key:"featureSource",value:Ms.scriptStory}]),new ho("audiogram",Je.AUDIOGRAM,Hh)];ji();ro();Pl();var Xn=function(i){return i[i.removeAll=0]="removeAll",i[i.skin=1]="skin",i[i.beauty=2]="beauty",i[i.blur=3]="blur",i[i.spotlight=4]="spotlight",i[i.teeth=5]="teeth",i[i.face=6]="face",i[i.nose=7]="nose",i[i.eyes=8]="eyes",i[i.lips=9]="lips",i;}(Xn||{}),si=function(i){return i.removeAll="remove",i.skin="skin",i.beauty="beauty",i.blue="blue",i.spotlight="spotlight",i.teeth="teeth",i.face="face",i.nose="nose",i.eyes="eyes",i.lips="lips",i;}(si||{});function ac(i){switch(i){case si.skin:return"skin";case si.nose:return"nose";case si.face:return"face";case si.spotlight:return"softlight";case si.teeth:return"teeth";case si.eyes:return"eyes";case si.lips:return"lips";case si.blue:return"blur";}}var NM=[{id:Xn.removeAll,title:"Remove All",text:"",icon:"assets/img/b-remove-all.svg",activeStyle:"b-red",value:si.removeAll,makeActive:!1},{id:Xn.skin,title:"Skin",text:"Make your skin smoother",icon:"assets/img/b-skin.svg",activeStyle:"b-blue",value:si.skin,makeActive:!1},{id:Xn.blur,title:"Blur",text:"Blur the Background",icon:"assets/img/b-blur.svg",activeStyle:"b-blue",value:si.blue,makeActive:!1},{id:Xn.face,title:"Face",text:"Make your face thinner",icon:"assets/img/b-face.svg",activeStyle:"b-blue",value:si.face,makeActive:!1},{id:Xn.nose,title:"Nose",text:"Adjust your nose size",icon:"assets/img/b-nouse.svg",activeStyle:"b-blue",value:si.nose,makeActive:!1},{id:Xn.eyes,title:"Eyes",text:"Adjust your eyes size",icon:"assets/img/b-eyes.svg",activeStyle:"b-blue",value:si.eyes,makeActive:!1},{id:Xn.lips,title:"Lips",text:"Adjust your lips size",icon:"assets/img/b-lips.svg",activeStyle:"b-blue",value:si.lips,makeActive:!1}],lm="bytePlusEffectsKey";Ei();Ui();var lt=function(i){return i[i.UPLOAD=0]="UPLOAD",i[i.RETAKE=1]="RETAKE",i[i.DOWNLOAD_WEBM=2]="DOWNLOAD_WEBM",i[i.DOWNLOAD_MP4=3]="DOWNLOAD_MP4",i[i.DISMISS=4]="DISMISS",i[i.UPSELL=5]="UPSELL",i[i.ANONYMOUS=6]="ANONYMOUS",i;}(lt||{}),Zn=function(i){return i.UPSELL="No More BIGVU Logo",i.UPLOAD="Save",i.RETAKE="Record Again",i.DOWNLOAD_WEBM="Download .webm",i.DOWNLOAD_MP4="Download .mp4",i;}(Zn||{});ae();ae();J();Lm();Pl();J();ae();function D_(i,u){if(i&1){let e=U();r(0,"div",3)(1,"action-button",4),S("onClick",function(){let t=T(e).$implicit;return P(t.onClick(t.id));}),s()();}if(i&2){let e=u.$implicit;a(),zc(e.style),c("text",e.text)("sideIconUrl",e.sideIconUrl);}}var va=(()=>{class i{constructor(e){this.decimalPipe=e,this.isFreeUser=!1,this.isAnonymous=!1,this.setActions=()=>{let n=os(this.mimeType,this.file);this.actions=[{id:lt.UPLOAD,text:Zn.UPLOAD,style:"action-button upload-button",onClick:()=>this.isAnonymous?this.submit(lt.ANONYMOUS):this.submit(lt.UPLOAD)}],n?this.actions.push({id:lt.DOWNLOAD_MP4,text:`${Zn.DOWNLOAD_MP4} (${this.getFileSizeInMb()}MB)`,style:"action-button",onClick:()=>this.isAnonymous?this.submit(lt.ANONYMOUS):this.submit(lt.DOWNLOAD_MP4)}):this.actions.push({id:lt.DOWNLOAD_WEBM,text:`${Zn.DOWNLOAD_WEBM} (${this.getFileSizeInMb()}MB)`,style:"action-button",onClick:()=>this.isAnonymous?this.submit(lt.ANONYMOUS):this.submit(lt.DOWNLOAD_WEBM)},{id:lt.DOWNLOAD_MP4,text:`${Zn.DOWNLOAD_MP4} (${this.getFileSizeInMb()}MB)`,style:"action-button",onClick:()=>this.isAnonymous?this.submit(lt.ANONYMOUS):this.submit(lt.DOWNLOAD_MP4)}),this.actions.push({id:lt.RETAKE,text:Zn.RETAKE,style:"action-button",onClick:()=>this.submit(lt.RETAKE)}),this.isFreeUser&&!this.isAnonymous&&this.actions.splice(0,0,{id:lt.UPSELL,text:Zn.UPSELL,sideIconUrl:"../../img/diamond-blue.svg",style:"action-button upsell-button",onClick:()=>this.submit(lt.UPSELL)});},this.getFileSizeInMb=()=>{let n=this.file.size/Math.pow(10,6);return this.decimalPipe.transform(n,"1.0-1");},this.submit=n=>{this.onSubmit.emit(n);},this.onSubmit=new be();}ngOnInit(){this.setActions();}static{this.ɵfac=function(n){return new(n||i)(d(Mn));};}static{this.ɵcmp=G({type:i,selectors:[["take-actions"]],inputs:{file:"file",headline:"headline",isFreeUser:"isFreeUser",isAnonymous:"isAnonymous",mimeType:"mimeType"},outputs:{onSubmit:"onSubmit"},standalone:!0,features:[Vi([Mn]),q],decls:3,vars:1,consts:[[1,"take-actions-component"],[1,"action-button-list"],["class","action-button-container",4,"ngFor","ngForOf"],[1,"action-button-container"],[3,"onClick","text","sideIconUrl"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"div",1),M(2,D_,2,4,"div",2),s()()),n&2&&(a(2),c("ngForOf",t.actions));},dependencies:[Le,Tl],styles:[".take-actions-component .action-button button{width:210px!important;border-radius:10px;font-size:14px;margin:10px auto;padding:10px 0;text-align:center;color:#7b8db1!important;background-color:#7b8db114} .take-actions-component .upload-button button{background:linear-gradient(90deg,#00ea3b,#00d096);color:#fff!important;font-family:Inter-Bold} .take-actions-component action-button .action-button-component button{font-family:Inter-Bold;justify-content:center} .take-actions-component .upsell-button button{background:linear-gradient(216.6deg,#fb84ff 5.53%,#ff4d5b 94.56% 94.56%);color:#fff!important;font-family:Inter-Bold;padding:5px 0} .take-actions-component .upsell-button .side-icon-container{display:inline-block;height:30px}"]});}}return i;})();J();Wr();var _a=(()=>{class i{constructor(e){this.sanitizer=e,this.setPreviewUrl=()=>{this.file&&(this.previewObjectUrl=URL.createObjectURL(this.file),this.previewUrl=this.sanitizer.bypassSecurityTrustUrl(this.previewObjectUrl));};}ngOnInit(){this.setPreviewUrl();}ngOnDestroy(){URL.revokeObjectURL(this.previewObjectUrl);}static{this.ɵfac=function(n){return new(n||i)(d($r));};}static{this.ɵcmp=G({type:i,selectors:[["take-preview"]],inputs:{file:"file"},standalone:!0,features:[q],decls:2,vars:1,consts:[[1,"take-preview-component"],["controls","",3,"src"]],template:function(n,t){n&1&&(r(0,"div",0),b(1,"video",1),s()),n&2&&(a(),c("src",t.previewUrl,Ie));},styles:["video[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:10px}"]});}}return i;})();J();at();var dm=(()=>{class i extends Pt{constructor(e,n){super(n),this.dialogHelperService=e,this.data=n,this.submit=t=>{this.data.onSubmit(t);},this.onDismiss=()=>{this.dialogHelperService.close(),this.submit(lt.DISMISS);};}static{this.ɵfac=function(n){return new(n||i)(d(Ue),d(yt));};}static{this.ɵcmp=G({type:i,selectors:[["record-take-dialog"]],standalone:!0,features:[Ae,q],decls:9,vars:9,consts:[[1,"dialog-close-button-container"],["aria-label","Close",1,"dialog-close-button",3,"click"],[1,"dialog-title"],[1,"take-preview-container"],[3,"file"],[1,"take-actions-container"],[3,"onSubmit","file","headline","isFreeUser","isAnonymous","mimeType"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"button",1),S("click",function(){return t.onDismiss();}),s()(),r(2,"div",2),y(3),tt(4,"titlecase"),s(),r(5,"div",3),b(6,"take-preview",4),s(),r(7,"div",5)(8,"take-actions",6),S("onSubmit",function(h){return t.submit(h);}),s()()),n&2&&(a(3),se(" ",wt(4,7,t.data.header),` 16`),a(3),c("file",t.data.file),a(2),c("file",t.data.file)("headline",t.data.headline)("isFreeUser",t.data.isFreeUser)("isAnonymous",t.data.isAnonymous)("mimeType",t.data.mimeType));},dependencies:[_a,va,Hr],styles:[".take-preview-container[_ngcontent-%COMP%]{margin:30px auto;width:100%}.take-actions-container[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;flex-direction:column}"]});}}return i;})();Bi();var er=class extends Tt{constructor(){super(...arguments),this.isFreeUser=!1,this.isAnonymous=!1;}};var Ca=class extends er{};Ei();Ui();ae();J();at();function L_(i,u){if(i&1&&(r(0,"div",12)(1,"div",13)(2,"div",14),b(3,"img",15),s(),r(4,"div",16),y(5),tt(6,"titlecase"),s()(),r(7,"a",17)(8,"div",18)(9,"div",19)(10,"div",20),b(11,"img",21),s(),r(12,"div",22),y(13),tt(14,"longNumber"),s()(),r(15,"div",23),b(16,"img",24),s()()()()),i&2){let e=u.$implicit;a(3),c("src",e.iconUrl,Ie),a(2),de(wt(6,6,e.name)),a(2),c("href",e.streamUrl,Ie),a(2),nt("background",e.themeColor),a(4),de(_n(14,8,e.views,0));}}var pm=(()=>{class i extends Pt{get liveStreamData(){return this.data.liveStreamData;}constructor(e,n){super(n),this.dialogHelperService=e,this.data=n,this._PROVIDERS_ICON_MAP=new Map([["facebook","/img/icons-social-facebook.webp"],["facebook/page","/img/icons-social-facebook.webp"],["linkedin","/img/icons-social-linkedin.webp"],["youtube","/img/icons-social-youtube.webp"],["twitter","/img/icon-library/misc/x.svg"],["instagram","/img/icons-social-instagram.webp"]]),this._PROVIDERS_THEME_MAP=new Map([["facebook","#1877f2"],["facebook/page","#1877f2"],["linkedin","#0077b5"],["youtube","#ff0000"],["twitter","#000000"],["instagram",""]]),this.setStreamProvidersData=()=>{this.streamProvidersData=[{name:this.liveStreamData.provider,iconUrl:this._PROVIDERS_ICON_MAP.get(this.liveStreamData.provider),streamUrl:this.liveStreamData.postUrl,views:this.getViews(),theme
16Color:this._PROVIDERS_THEME_MAP.get(this.liveStreamData.provider)}];},this.getViews=()=>this.hasVideoEngagementData()?this.liveStreamData.engagement.video.views.viewers:0,this.hasVideoEngagementData=()=>this.liveStreamData&&this.liveStreamData.engagement&&this.liveStreamData.engagement.video&&this.liveStreamData.engagement.video.views,this.submit=t=>{this.data.onSubmit(t);},this.onDismiss=()=>{this.dialogHelperService.close(),this.submit(lt.DISMISS);};}ngOnInit(){this.setStreamProvidersData();}static{this.ɵfac=function(n){return new(n||i)(d(Ue),d(yt));};}static{this.ɵcmp=G({type:i,selectors:[["live-take-dialog"]],standalone:!0,features:[Ae,q],decls:17,vars:7,consts:[[1,"dialog-close-button-container"],["aria-label","Close",1,"dialog-close-button",3,"click"],[1,"dialog-title"],[1,"take-preview-container"],[3,"file"],[1,"actions-area-container"],[1,"take-actions-section"],[1,"section-header"],[3,"onSubmit","file","headline"],[1,"live-summary-section"],[1,"stream-providers-list"],["class","provider-container",4,"ngFor","ngForOf"],[1,"provider-container"],[1,"provider-details-container"],[1,"provider-icon-container"],["alt","image",3,"src"],[1,"provider-name"],["target","_blank",3,"href"],[1,"stream-link-container"],[1,"stream-views-count-container"],[1,"views-icon-container"],["src","/img/views-icon.svg","alt","Views"],[1,"views-count"],[1,"arrow-icon-container"],["src","/img/grey-right-arrow.svg","alt","image"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"button",1),S("click",function(){return t.onDismiss();}),s()(),r(2,"div",2),y(3),tt(4,"titlecase"),s(),r(5,"div",3),b(6,"take-preview",4),s(),r(7,"div",5)(8,"div",6)(9,"div",7),y(10,"Video Options:"),s(),r(11,"take-actions",8),S("onSubmit",function(h){return t.submit(h);}),s()(),r(12,"div",9)(13,"div",7),y(14,"Live Summary:"),s(),r(15,"div",10),M(16,L_,17,11,"div",11),s()()()),n&2&&(a(3),se(" ",wt(4,5,t.data.header),` 17`),a(3),c("file",t.data.file),a(5),c("file",t.data.file)("headline",t.data.headline),a(5),c("ngForOf",t.streamProvidersData));},dependencies:[_a,va,Le,Hr,td],styles:[".take-preview-container[_ngcontent-%COMP%]{margin:30px auto 17px;width:100%}.actions-area-container[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.live-summary-section[_ngcontent-%COMP%]{width:40%}.actions-area-container[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%]{color:#253658;font-size:14px;font-family:Inter-Bold;margin-bottom:20px}.provider-container[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:14px;gap:12px}.provider-details-container[_ngcontent-%COMP%]{display:flex;align-items:center}.provider-icon-container[_ngcontent-%COMP%]{width:24px;height:24px}.provider-icon-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;object-position:center}.provider-name[_ngcontent-%COMP%]{font-size:14px;color:#253658;margin-left:10px}.provider-container[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{display:block}a[_ngcontent-%COMP%] .stream-link-container[_ngcontent-%COMP%]{display:flex}.stream-views-count-container[_ngcontent-%COMP%]{display:flex;justify-content:center;width:52px;height:24px;border-radius:6px;padding:0 6px}.views-icon-container[_ngcontent-%COMP%]{width:18px;height:18px}.views-icon-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;object-position:center}.views-count[_ngcontent-%COMP%]{font-size:10px;color:#fff;margin-left:5px;margin-top:3px}.arrow-icon-container[_ngcontent-%COMP%]{margin-left:10px}.arrow-icon-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;object-position:center}"]});}}return i;})();at();Nn();var ba=class{constructor(u,e,n,t,o,h,k,f,m,v,V,te,$,H,j,F,Z,N,Q,W){this.ngCookieService=u,this.eventsService=e,this.adminRequestsService=n,this.notifier=t,this.deskManagerHelperService=o,this.localTakeHelperService=h,this.filesUtilityService=k,this.router=f,this.dialogHelperService=m,this.planHelperService=v,this.portableRegisterService=V,this.errorParseService=te,this.firebaseRemoteConfigService=$,this.userHelperService=H,this.render=j,this.EVENT_PATH_SCRIPT=this.eventsService.events.script,this.EVENT_PATH_LIVE=this.eventsService.events.live,this.Max_Polling_Time_Ms=1800*1e3,this.isTeleprompterRecording=!1,this.scriptWordCount=0,this.scriptTrackList=[],this.setStory=O=>{this.story=O;},this.setUserPlan=O=>{this.userPlan=O;},this.setIsAnonymous=O=>{this.isAnonymous=O;},this.setScript=O=>{this.scriptToUse=O;},this.setCurrentRoute=O=>{this.currentRoute=O;},this.setScriptTracks=O=>{O&&(this.scriptTrackList=O);},this.openTeleprompter=O=>{this.selectedTeleprompterMode=O;let D=this.ngCookieService.getCookie("prompter_window"),ie=D?D.split("_"):"",Te=ie?ie[0]:"768",Ee=ie?ie[1]:"800",je=window.screenLeft!==void 0?window.screenLeft:window.screenX,Ke=(window.screen.availWi
17dth-+Te)*.5+je;this.teleprompterWindow=window.open("/teleprompter","_blank",`location=false,menubar=false,toolbar=false,width=${Te},height=${Ee},top=0,left=${Ke}`),this.setMessageEventListener(),this.setWindowCloseEventListeners(),this.startWindowCloseCheck(),this.sendTeleprompterEvents(this.EVENT_PATH_SCRIPT["teleprompterRecordStart"],Nt[this.selectedTeleprompterMode]);},this.startWindowCloseCheck=()=>{this.stopWindowCloseCheck(),this.windowCloseCheckInterval=setInterval(()=>{this.teleprompterWindow&&this.teleprompterWindow.closed&&this.onTeleprompterWindowClosed();},500);},this.stopWindowCloseCheck=()=>{this.windowCloseCheckInterval&&(clearInterval(this.windowCloseCheckInterval),this.windowCloseCheckInterval=null);},this.onTeleprompterWindowClosed=()=>{this.stopWindowCloseCheck(),this.clearMessageEventListener(),this.removeWindowCloseEventListeners(),this.teleprompterWindow=null,this.isTeleprompterRecording=!1;},this.destroy=()=>{this.stopWindowCloseCheck(),this.clearMessageEventListener(),this.removeWindowCloseEventListeners(),this.teleprompterWindow&&!this.teleprompterWindow.closed&&this.teleprompterWindow.close(),this.teleprompterWindow=null;},this.setMessageEventListener=()=>{this.clearMessageEventListener(),this.messageListener=this.render.listen("window","message",this.onMessageRecieved);},this.setWindowCloseEventListeners=()=>{this.beforeUnloadListener=this.render.listen("window","beforeunload",this.onWindowBeforeUnload),this.unloadListener=this.render.listen("window","unload",this.onWindowClose);},this.clearMessageEventListener=()=>{this.messageListener&&(this.messageListener(),this.messageListener=null);},this.removeWindowCloseEventListeners=()=>{this.unloadListener&&(this.unloadListener(),this.unloadListener=null),this.beforeUnloadListener&&(this.beforeUnloadListener(),this.beforeUnloadListener=null);},this.onWindowBeforeUnload=O=>{this.isTeleprompterRecording&&(O.preventDefault(),O.returnValue="");},this.onWindowClose=O=>{this.teleprompterWindow&&this.teleprompterWindow.close();},this.onMessageRecieved=O=>{if(O.origin===`https://${window.location.host}`){let D=O.data;switch(D.type){case Ot.ready:let ie="";this.selectedTeleprompterMode===Nt.RECORD_CONSENT?ie=this.scriptToUse:this.currentRoute===It.takes?ie=this.story?this.story.script:"":ie=this.scriptTrackList[0].contentData.script?this.scriptTrackList[0].contentData.script:"";let Te=this.story?this.story.headline:"",Ee=this.selectedTeleprompterMode;this.sendTeleprompterReadyMessage(ie,Te,Ee);break;case Ot.teleprompterCameraChange:this.sendCameraChangeMessage(D);break;case Ot.recordStart:this.isTeleprompterRecording=!0;break;case Ot.take:let je=[],Ke={},Ft=localStorage.getItem(lm);if(Ft){let Ve=JSON.parse(Ft);for(let jt of Ve)jt&&(jt.key!=si.beauty&&(Ke[`effect.${ac(jt.key)}.value`]=jt.value*100),je.push(ac(jt.key)));}this.sendTeleprompterEvents(this.EVENT_PATH_SCRIPT.teleprompterRecord,Nt[this.selectedTeleprompterMode],pe({fontSize:D.data.fontSize,speed:D.data.speed,duration:D.data.duration/1e3,scriptWordCount:this.scriptWordCount,effects:je.sort()},Ke)),this.takeToUpload=D.data,this.stopWindowCloseCheck(),this.clearMessageEventListener(),this.removeWindowCloseEventListeners(),this.teleprompterWindow.close(),this.teleprompterWindow=null,this.isTeleprompterRecording=!1,this.selectedTeleprompterMode===Nt.RECORD_CONSENT?this.handleConsentVideoTake(D.data):this.selectedTeleprompterMode===Nt.LIVE?this.onLiveTakeReady(D.data):this.onRecorderTakeReady(D.data);break;case Ot.error:let Wt=this.errorParseService.parseTeleprompterError(D.data);this.notifier.error(Wt||"Teleprompter window was closed.");break;case Ot.resize:this.setWindowSizePreference(D.data);break;case Ot.liveProviders:this.sendLiveProvidersMessage();break;case Ot.connectSocial:this.teleprompterWindow.close(),this.sendLiveEvent(this.EVENT_PATH_LIVE.liveConnect,{storyId:this.story.storyId}),this.router.navigate(["social-channels"]);break;case Ot.registerLive:let Ai=D.data;this.registerLiveStream(Ai);break;case Ot.openLiveSetupDialog:this.sendLiveEvent(this.EVENT_PATH_LIVE.liveDestScreen,{storyId:this.story.storyId});break;case Ot.liveDestSelected:let _=D.data;this.sendLiveEvent(this.EVENT_PATH_LIVE.liveDestSelect,{storyId:this.story.storyId,social:_});break;case Ot.livePostScreen:this.sendLiveEvent(this.EVENT_PATH_LIVE.livePosScreen,{storyId:this.story.storyId});break;case Ot.closeLiveSetup:this.sendLiveEvent(this.EVENT_PATH_LIVE.liveConnectDism
17iss,{storyId:this.story.storyId});break;case Ot.streamCreated:let R=D.data;this.totalPollingTimeMs=0,this.waitOnPostStatusChange(R);break;case Ot.publishLiveStreamPost:let{postId:re,text:ce,title:ge}=D.data;this.publishLiveStreamPost(re,ce,ge);break;case Ot.endLiveStream:let ye=D.data.postId;this.endLiveStream(ye);break;case Ot.endLiveProcessing:clearInterval(this.postStatusPollingInterval);break;case Ot.settingsDialog:let{eventM:vt,eventP:Ct}=D.data;this.sendTeleprompterEvents(this.EVENT_PATH_SCRIPT[vt],Nt[this.selectedTeleprompterMode],pe({},Ct));break;case Ot.closeLiveNavigateSetup:this.onWindowClose(),this.router.navigate(["social-channels/accounts"]);break;default:break;}}},this.sendCameraChangeMessage=O=>I(this,null,function*(){try{yield this.firebaseRemoteConfigService.setTeleprompterCamera(O.data.value),this.sendMessage({type:Ot.teleprompterCameraRefresh,data:{}});}catch(D){console.error(D);}}),this.sendTeleprompterReadyMessage=(O,D,ie)=>I(this,null,function*(){let Te,Ee;ie===Nt.RECORD_CONSENT?(Te=!1,Ee=!1):(Te=yield this.firebaseRemoteConfigService.shouldUseBytePlus(),Ee=yield this.firebaseRemoteConfigService.canUseBytePlus());let je=localStorage.getItem("useMirror"),Ke=yield this.userHelperService.getUserDetails().catch(()=>null);this.sendMessage({type:Ot.ready,data:{script:O,headline:D,userId:Ke?.userId??"",storyId:this.story?.storyId,mode:ie===Nt.RECORD_CONSENT?Nt.RECORD:ie,isFree:this.planHelperService.isFreePlan(this.userPlan.genericName),bytePlus:Te,canUseBytePlus:Ee,useMirror:je?JSON.parse(je):!1}});}),this.sendLiveProvidersMessage=()=>I(this,null,function*(){let O=yield this.filterLiveableSocialProviders();this.sendMessage({type:Ot.liveProviders,data:O}),this.sendLiveEvent(this.EVENT_PATH_LIVE.LiveConnectScreen,{storyId:this.story.storyId});}),this.sendMessage=O=>{this.teleprompterWindow&&this.teleprompterWindow.postMessage(O,`https://${window.location.host}`);},this.onLiveTakeReady=O=>I(this,null,function*(){yield this.endLiveStream(O.postId),this.sendLiveEvent(this.EVENT_PATH_LIVE.liveEnd,{storyId:this.story.storyId,social:this.liveStreamEndData.provider,duration:O.duration,url:this.liveStreamEndData.postUrl}),yield this.handleLocalTake(O),this.openLiveTeleprompterTakeDialog(O);}),this.onRecorderTakeReady=O=>I(this,null,function*(){yield this.handleLocalTake(O),this.openRecordTakeDialog(O);}),this.endLiveStream=O=>I(this,null,function*(){try{this.liveStreamEndData=yield this.adminRequestsService.endLiveStream(O);}catch(D){console.error(D);}finally{}}),this.handleLocalTake=O=>I(this,null,function*(){let{file:D,duration:ie,mimeType:Te}=O,Ee=yield this.localTakeHelperService.save(this.story.storyId,D,ie,this.story.headline,this.isAnonymous);this.lastRecordedTake={takeId:Ee.id,file:D,fileName:this.story.headline,isAnonymous:this.isAnonymous,mimeType:Te||D.type||"video/webm"},this.currentRoute===It.takes&&this.notifyOnLocalTakeAdded(Ee);}),this.handleConsentVideoTake=O=>I(this,null,function*(){let{file:D,duration:ie}=O,Te=yield this.filesUtilityService.createVideoThumbnail(D),Ee={duration:ie,thumbnail:Te,file:D};this.notifyOnLocalTakeAdded(Ee);}),this.openRecordTakeDialog=O=>{let D=new er();D.header="Teleprompter",D.onSubmit=this.onTeleprompterTakeDialogSubmit,D.onClose=this.dialogHelperService.close,D.headline=this.story.headline,D.file=O.file,D.isFreeUser=this.planHelperService.isFreePlan(this.userPlan.genericName),D.isAnonymous=this.isAnonymous,D.mimeType=O.mimeType||O.file.type||"video/webm",this.openTeleprompterTakeDialog(D,dm);},this.openLiveTeleprompterTakeDialog=O=>{let D=new Ca();D.header="Live Ended \u{1F44F}",D.onSubmit=this.onTeleprompterTakeDialogSubmit,D.onClose=this.dialogHelperService.close,D.headline=this.story.headline,D.file=O.file,D.liveStreamData=this.liveStreamEndData,this.openTeleprompterTakeDialog(D,pm);},this.openTeleprompterTakeDialog=(O,D)=>{let ie=new We();ie.panelClass="teleprompter-take-dialog-content",this.dialogHelperService.open(O,D,ie),this.currentRoute===It.script&&this.openTeleprompterTakeDialogStoryLogic();},this.onTeleprompterTakeDialogSubmit=O=>{let D,ie={};switch(O){case lt.RETAKE:this.openTeleprompter(this.selectedTeleprompterMode),D=this.EVENT_PATH_SCRIPT.deskDialogNew;break;case lt.UPLOAD:D=this.EVENT_PATH_SCRIPT.deskDialogUpload,this.handleUploadRequest(this.takeToUpload,this.takeToUpload.file);break;case lt.DOWNLOAD_WEBM:D=this.EVENT_PATH_SCRIPT.deskDialogDownload,ie.fileType="webm",this.downloadLocalTake(this.lastRecordedTake,mn.webm);break;case lt.DOWNLOAD_MP4:D=this.EVENT_PATH_SCRIPT.deskDialogDownload,ie.fileType="mp4",this.downloadLocalTake(this.lastRecordedTake,mn.mp4);break;case lt.DISMISS:D=this.EVENT_PATH_SCRIPT.deskDialogDismiss;break;case lt.UPSELL:this.dialogHelperService.close(),this.showUpsellDialog(pt.removeWatermark),ie.feature="remove-watermark";break;case lt.ANONYMOUS:this.dialogHelperService.close(),this.portableRegisterService.openPortableRegisterDialog();break;default:break;}D&&this.sendTeleprompterEvents(D,Nt[this.selectedTeleprompterMode],ie),O!==lt.ANONYMOUS&&O!==lt.UPSELL&&this.dialogHelperService.close(),this.liveStreamEndData=null;},this.downloadLocalTake=(O,D)=>I(this,null,function*(){try{let{takeId:ie,file:Te,fileName:Ee,mimeType:je}=O,Ke=os(je,Te);switch(D){case mn.webm:this.filesUtilityService.downloadFile(Te,this.story.headline,mn.webm);break;case mn.mp4:Ke?this.filesUtilityService.downloadFile(Te,this.story.headline,mn.mp4):(yield this.localTakeHelperService.saveConvertable(ie,Te,Ee),this.filesUtilityService.convertToMp4(O),this.totalPollingTimeMs=0,this.waitOnConversionToFinish(ie));break;default:this.notifier.error(`${D} format is not supported`);break;}}catch(ie){this.notifier.error("Failed to download your video"),console.error(ie);}}),this.waitOnConversionToFinish=O=>
17I(this,null,function*(){try{this.totalPollingTimeMs+=2e3;let ie=yield this.localTakeHelperService.getConvertable(O);if(this.totalPollingTimeMs>this.Max_Polling_Time_Ms)throw"The conversion was taking too long and was terminated";ie&&ie.file.type==="video/mp4"?(yield this.localTakeHelperService.deleteConvertable(O),this.filesUtilityService.downloadFile(ie.file,ie.fileName),this.sendTeleprompterEvents(this.EVENT_PATH_SCRIPT.mp4Convert,Nt[this.selectedTeleprompterMode])):setTimeout(()=>I(this,null,function*(){return this.waitOnConversionToFinish(O);}),2e3);}catch(ie){yield this.localTakeHelperService.deleteConvertable(O).catch(()=>{}),console.error(ie),this.notifier.error(ie);}}),this.setWindowSizePreference=O=>{let D="prompter_window",ie=`${O.width}_${O.height}`;this.ngCookieService.setCookie(D,ie);},this.filterLiveableSocialProviders=()=>I(this,null,function*(){let O=[];try{(yield this.adminRequestsService.getLinkedProviders(void 0,0,void 0,"goLive",this.deskManagerHelperService.getSelectedWorkspaceId())).result.forEach(ie=>{if(ie.scopes&&ie.scopes.goLive&&O.push(ie),this.hasSubSocialAccounts(ie)){let Te=ie.subSocialAccounts.filter(Ee=>Ee.scopes&&Ee.scopes.goLive);O.push(...Te);}});}catch{this.notifier.error("Failed to load your linked social accounts");}finally{return O;}}),this.hasSubSocialAccounts=O=>O&&O.subSocialAccounts&&Object.keys(O.subSocialAccounts).length>0,this.registerLiveStream=O=>I(this,null,function*(){try{let{selectedProvider:D}=O,ie=yield this.adminRequestsService.registerLiveStream(D.id,D.subEntityExternalId);this.sendMessage({type:"register-livestream",data:ie}),this.sendLiveEvent(this.EVENT_PATH_LIVE.liveStart,{storyId:this.story.storyId,description:O.description,social:D.type});}catch{this.sendMessage({type:"stream-setup-error",data:{code:ys.REGISTER_FAILED}});}}),this.waitOnPostStatusChange=O=>I(this,null,function*(){let ie=O.id,Te;try{this.totalPollingTimeMs+=2e3;let Ee=yield this.adminRequestsService.getLiveStreamPost(ie);Te=Ee.liveStream.status,this.shouldStopWaiting(Te,this.totalPollingTimeMs)?this.sendMessage({type:"stream-status",data:Ee}):this.postStatusPollingInterval=setTimeout(()=>I(this,null,function*(){return this.waitOnPostStatusChange(O);}),2e3);}catch{this.sendMessage({type:"stream-setup-error",data:{code:ys.GENERAL}});}}),this.shouldStopWaiting=(O,D)=>O===Ra.AVAILABLE||O===Ra.FAILED||D>this.Max_Polling_Time_Ms,this.publishLiveStreamPost=(O,D,ie)=>I(this,null,function*(){try{let Te=yield this.adminRequestsService.publishSocialPost(O,D,ie);this.sendMessage({type:Ot.postPublished,data:Te});}catch{this.sendMessage({type:"stream-setup-error",data:{code:ys.POST_PUBLISH_FAILED}});}}),this.handleUploadRequest=(O,D,ie=!1)=>I(this,null,function*(){if(yield this.planHelperService.isFreeByCurrentPlan())this.showUpsellDialog(pt.uploadTake);else if(yield this.uploadNewTake(O,D,!0),!ie){let Te=this.EVENT_PATH_SCRIPT.deskDialogUpload;this.sendTeleprompterEvents(Te);}}),this.sendTeleprompterEvents=F,this.showUpsellDialog=Z,this.uploadNewTake=N,this.notifyOnLocalTakeAdded=Q,this.openTeleprompterTakeDialogStoryLogic=W;}sendLiveEvent(u,e){this.eventsService.log(u,e);}};Nn();ji();vi();Bt();rr();at();J();at();var R_=[Da.google],N_=".mp4,.mov,.mpeg,.gif,.webm",F_="video/mp4, video/mov, video/mpeg, image/gif, video/webm",cc=(()=>{class i{constructor(e,n,t){this.dialogHelperService=e,this.fileValidationService=n,this.googlePickerService=t,this.destroy$=new Ze(),this.fileSelected$=new Ze(),this.awaitingDrivePick=!1,this.takeFileSelected$=this.fileSelected$.asObservable(),this.openUploadTakeDialog=()=>{let o=new Ul();o.title="Upload take",o.subTitle="MP4, MOV, GIF or WebM files",o.customAcceptedFileTypes=N_,o.allowedUploadSources=R_,o.onClose=this.dialogHelperService.close,o.onFileSelection=this.onFileSelection,o.onExternalUploadRequest=this.onExternalUploadRequest;let h=new We();h.panelClass="assets-upload-dialog",this.dialogHelperService.open(o,Hl,h);},this.onFileSelection=o=>{let h=o?.[0];!h||!this.isUsable(h)||this.fileSelected$.next(h);},this.onExternalUploadRequest=o=>{o?.value===Da.google&&(this.awaitingDrivePick=!0,this.googlePickerService.openPicker(Ll.VIDEOS,{multiSelect:!1,maxItems:1}));},this.onDriveFilesDownloaded=o=>{this.awaitingDrivePick&&(this.awaitingDrivePick=!1,this.onFileSelection(o));},this.isUsable=o=>this.fileValidationService.isFileNameValid(o)&&this.fileValidationService.isFileFormatValid(o,F_),this.googlePickerService.selectedFiles$.pipe(me(this.destroy$)).subscribe(o=>this.onDriveFilesDownloaded(o));}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),this.fileSelected$.complete();}static{this.ɵfac=function(n){return new(n||i)(an(Ue),an(fs),an(vs));};}static{this.ɵprov=Jt({token:i,factory:i.ɵfac});}}return i;})();J();at();Mi();pn();Eo();so();bn();ln();
17Ea();ae();Wr();ns();xl();ht();wl();Nm();Bn();ll();Zr();vl();J();var hm=(()=>{class i{constructor(){this.setOnReadyCallback=(e,n)=>{this._validate(e),this._onReadyCallbackStore.set(e,n);},this.getOnReadyCallback=e=>this._onReadyCallbackStore.get(e),this.clearCallback=e=>{this._onReadyCallbackStore.delete(e);},this.hasCallbacks=()=>this._onReadyCallbackStore.size>0,this.setPendingInitialEditStory=(e,n)=>{this._validate(e),this._pendingInitialEditStories.set(e,n);},this.getPendingInitialEditStoryCallback=e=>this._pendingInitialEditStories.get(e),this.clearPendingInitialEditStory=e=>{this._pendingInitialEditStories.delete(e);},this.isPendingInitialEditStory=e=>this._pendingInitialEditStories.has(e),this._validate=e=>{if(!e||typeof e!="string")throw new Error("The provided story id is invalid");},this._onReadyCallbackStore=new Map([]),this._pendingInitialEditStories=new Map([]);}static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵprov=Jt({token:i,factory:i.ɵfac,providedIn:"root"});}}return i;})();qt();oo();ao();Rm();Mm();Zi();vi();var B_=["thumbnailFileInput"];function U_(i,u){if(i&1&&(r(0,"div",10),b(1,"lib-badge",11),s()),i&2){let e=p();c("matTooltip",e.getScriptLimitTooltip()),a(),c("text",e.scriptLimitBadgeText);}}function H_(i,u){if(i&1){let e=U();r(0,"lib-button-icon",12),S("clicked",function(){T(e);let t=p();return P(t.onUploadTakeRequested());}),s();}if(i&2){let e=p();c("iconContent",e.uploadTakeIcon)("ariaLabel",e.uploadTakeLabel);}}function z_(i,u){if(i&1){let e=U();r(0,"lib-button-icon",16),S("clicked",function(){T(e);let t=p(2);return P(t.onUploadClick());}),s();}if(i&2){let e=p(2);c("iconContent",e.uploadIcon);}}function $_(i,u){i&1&&b(0,"div",17);}function W_(i,u){if(i&1){let e=U();ot(0),M(1,z_,1,1,"lib-button-icon",13)(2,$_,1,0,"div",14),r(3,"lib-button",15),S("clicked",function(){T(e);let t=p();return P(t.onNewTake());}),y(4," New take "),s(),r(5,"lib-button",15),S("clicked",function(){T(e);let t=p();return P(t.onScriptNavigation());}),y(6," Script "),s(),rt();}if(i&2){let e=p();a(),c("ngIf",!e.isViewer),a(),c("ngIf",!e.isViewer),a(),c("leftIconContent",e.newTakeImg),a(2),c("leftIconContent",e.scriptImg);}}function G_(i,u){if(i&1&&(r(0,"div",18),b(1,"sidebar-menu",19),s()),i&2){let e=p();a(),c("openingSide","from-left-sections")("sidebars",e.sidebars);}}var lc=(()=>{class i extends xh{get isLinkedToPlan(){return Nd(this.story).length>0;}get ScriptScreen(){return It.script;}get TakesScreen(){return It.takes;}get undoable$(){return this.historyService.undoable$;}get redoable$(){return this.historyService.redoable$;}get headerMetadata(){if(this.currentRoute!==It.script)return[];let e=this.durationTake,n=e?String(e.getMinutes()).padStart(2,"0"):"00",t=e?String(e.getSeconds()).padStart(2,"0"):"00";return[{value:`${this.scriptWordCount} Words`},{value:`Duration - ${n}:${t}`}];}constructor(e,n,t,o,h,k,f,m,v,V,te,$,H,j,F,Z,N,Q,W,O,D,ie,Te,Ee,je,Ke,Ft,Wt,Ai,_,R,re,ce,ge,ye,vt,Ct,Ve,jt,nn,Sa,kr,wr){super(e,o,h,n,H,j,F,m,te,f,V,Z,re),this.dialogHelperService=e,this.adminRequestsService=n,this.planHelperService=t,this.userHelperService=o,this.spinnerService=h,this.deskManagerHelperService=k,this.videoSlidesService=f,this.route=m,this.router=v,this.slideListDataService=V,this.styleVideoService=te,this.websocketService=$,this.location=H,this.titleService=j,this.uiActionService=F,this.navigationHelperService=Z,this.errorParseService=N,this.historyService=Q,this.storyTrackCommunicationService=W,this.eventsService=O,this.workspacePermissionService=D,this.permissionService=ie,this.premiumPlanService=Te,this.ngCookieService=Ee,this.localTakeHelperService=je,this.uploadService=Ke,this.filesUtilityService=Ft,this.uploadValidationService=Wt,this.uploadStateService=Ai,this.storyScriptStateService=_,this.fileValidationService=R,this.notifier=re,this.anonymousLoginService=ce,this.anonymousUserService=ge,this.portableRegisterService=ye,this.storyHelperService=vt,this.paymentService=Ct,this.firebaseRemoteConfigService=Ve,this.translateStoryServiceService=jt,this.serverlessApiService=nn,this.creditsService=Sa,this.portraitToVideoContextService=kr,this.render=wr,this.thumbnailFileInput=null,this.allowedThumbnailFileTypes="image/jpg, image/png, image/jpeg",this.SPINNER_ID="story-spinner",this.EVENT_PATH_SCRIPT=this.eventsService.events.script,this.EVENT_PATH_SEQUENCE=this.eventsService.events.sequence,this.newTakeImg="/img/icon-library/video/takes-stroke.svg",this.scriptImg="/img/icon-library/scripts/script.svg",this.uploadIcon="/img/icon-library/basic-ui/upload-cloud.svg",this.uploadTakeIcon="/img/icon-library/other/upload-video.svg",this.uploadTakeLabel="Upload take",this.contentPlannerIcon="/img/icon-library/symbols/calendar.svg",this.plannerLinkIcon="/img/icon-library/basic-ui/link.svg",this.defaultHeadline="My Project",this.plannerLookupBusy=!1,this.cpSlotLauncherService=et(Bd),this.cpSlotsStore=et(ni),this.cpSlotActionRunner=et(Ps),this.cpStoryDeepLink=et(Fd),this.cpTakeFirstService=et(Hd),this.cpAnalytics=et(Ts),this.cpProjectAnalytics=et(ii),this.takeUploadService=et(cc),this.goBackLink="/boards",this.blockBackLink=!1,this.anonymousFakeUploadId="1",this.storySaved=!1,this.takeTrackList=[],this.scriptTrackList=[],this.scriptWordCount=0,this.scriptCharCount=0,this.exceededScriptLimits=[],this.selectedPortrait=null,this.shownSidebar=null,this.hasExtendedPortraitScript=!1,this.deepLinkVerb=null,this.deepLinkMediaId=null,this.isLoading=!1,this.isDisabled=!1,this.audiogramDialogIsOpened=!1,this.sidebars=[],this.paymentStatus=!1,this.unsunscribe$=new Ze(),this.setEventListeners=()=>{this.storyTrackCommunicationService.observeStoryChanged().pipe(me(this.unsunscribe$)).subscribe(x=>void this.cpSlotsStore.load(x)),this.portraitToVideoContextService.selectedPortrait$.pipe(me(this.unsunscribe$)).subscribe(x=>this.selectedPortrait=x),this.navigationHelperService.shownBar.pipe(me(this.unsunscribe$)).subscribe(x=>this.shownSidebar=x),this.route.paramMap.pipe(me(this.unsunscribe$)).subscribe(x=>this.initStory()),this.storyTrackCommunicationService.observeStoryReload().pipe(me(this.unsunscribe$)).subscribe(x=>void this.reloadStory(x)),this.storyTrackCommunicationService.observeTeleprompterClick().pipe(me(this.unsunscribe$)).subscribe(x=>this.onOpenTeleprompterClick(x.mode,x.shouldSave)),this.storyTrackCommunicationService.observeRecordRequest().pipe(me(this.unsunscribe$)).subscribe(()=>void this.openSlotRecording()),this.storyTrackCommunicationService.observeSelectedScriptTrack().pipe(me(this.unsunscribe$)).subscribe(this.updateScriptTakes),this.storyTrackCommunicationService.observeTakeDelete().pipe(me(this.unsunscribe$)).subscribe(this.deleteTakeFromList),this.storyTrackCommunicationService.observeTakeRestore().pipe(me(this.unsunscribe$)).subscribe(({take:x,index:A})=>this.restoreTakeInList(x,A)),this.storyTrackCommunicationService.observeTakeToDownload().pipe(me(this.unsunscribe$)).subscribe(this.onLocalTakeToDownload),this.storyTrackCommunicationService.observeTakeToU
17pload().pipe(me(this.unsunscribe$)).subscribe(this.onLocalTakeUpload),this.storyTrackCommunicationService.observeTakeToCancelUpload().pipe(me(this.unsunscribe$)).subscribe(this.onTakeUploadCancellation),this.storyTrackCommunicationService.observeUploadTakeRequested().pipe(me(this.unsunscribe$)).subscribe(this.onUploadTakeRequested),this.takeUploadService.takeFileSelected$.pipe(me(this.unsunscribe$)).subscribe(this.onUploadedTakeFileSelected),this.storyTrackCommunicationService.observeTakeThumbnailToUpload().pipe(me(this.unsunscribe$)).subscribe(this.openThumbnailFileInput),this.storyTrackCommunicationService.observeTakeThumbnailToCancelUpload().pipe(me(this.unsunscribe$)).subscribe(this.onThumbnailUploadCancellation),this.storyTrackCommunicationService.observeTakeToGenerate().pipe(me(this.unsunscribe$)).subscribe(this.onTakeGenerate),this.storyTrackCommunicationService.observeTakeAudioBoost().pipe(me(this.unsunscribe$)).subscribe(this.onAudioBoost),this.storyTrackCommunicationService.observeTakeAudioGram().pipe(me(this.unsunscribe$)).subscribe(this.onAudioGram),this.storyTrackCommunicationService.observeEyeFix().pipe(me(this.unsunscribe$)).subscribe(this.onEyeFix),this.storyTrackCommunicationService.observeDubVideo().pipe(me(this.unsunscribe$)).subscribe(this.onDubVideo),this.storyTrackCommunicationService.observeAIVideo().pipe(me(this.unsunscribe$)).subscribe(this.onGenerateAiVideo),this.storyTrackCommunicationService.observeTakeClearFromUploadList().pipe(me(this.unsunscribe$)).subscribe(this.onTakeUploadListClean),this.storyTrackCommunicationService.observeStoryTriggerUpdateThumbnail().pipe(me(this.unsunscribe$)).subscribe(this.updateStoryThumbnail),this.storyTrackCommunicationService.observeStoryTriggerUpdateTake().pipe(me(this.unsunscribe$)).subscribe(this.onStoryUpdatedTakes),this.storyTrackCommunicationService.observeTakeToTrim().pipe(me(this.unsunscribe$)).subscribe(this.onTakeTrim),this.storyTrackCommunicationService.observeTakeChangeTitle().pipe(me(this.unsunscribe$)).subscribe(this.onTakeChangeTitle),this.storyTrackCommunicationService.observeTakeProcessFailed().pipe(me(this.unsunscribe$)).subscribe(this.onTakeProcessFailed),this.storyTrackCommunicationService.observeTakeToSequence().pipe(me(this.unsunscribe$)).subscribe(this.onSendTakeToSequence),this.storyTrackCommunicationService.observeSaveStory().pipe(me(this.unsunscribe$)).subscribe(this.onHeaderButtonClickWithCallback),this.storyTrackCommunicationService.observeCreateSequence().pipe(me(this.unsunscribe$)).subscribe(()=>this.onSequenceCreate(!0)),this.storyTrackCommunicationService.observeSequenceListChanges().pipe(me(this.unsunscribe$)).subscribe(this.onTrackListChange),this.styleVideoService.aspectRatioStyle$.pipe(me(this.unsunscribe$)).subscribe(this.onSequenceAspectRatioChange),this.anonymousUserService.observeUserNotAnonymous().pipe(me(this.unsunscribe$)).subscribe(this.setUserAnonymous),this.anonymousUserService.observeFakeFileLoad().pipe(me(this.unsunscribe$)).subscribe(this.addOrRemoveAnonymousTake),this.planHelperService.organizationPlanUpdated$.pipe(me(this.unsunscribe$)).subscribe(x=>I(this,null,function*(){if(x!=null)try{this.initUserDetails();}catch(A){console.error(A);}})),this.setSocketListener(),this.storyScriptStateService.hasCallbacks()&&this.websocketService.connect(),this.router.events.subscribe(x=>I(this,null,function*(){x instanceof Zc&&x.navigationTrigger=="popstate"&&(x.url=="/"+ai||x.url=="/"+ai+"/"+this.story.storyId?(this.teleprompterController.onWindowClose(),this.navigateToExit()):x.url.includes(ft.takes)&&this.goBackLink.includes(ft.takes)&&(this.hasChanges&&(yield this.onHeaderButtonClick()),this.initStory()));}));},this.getCurrentUserDetails=()=>I(this,null,function*(){try{this.spinnerService.spin("video-edit-screen"),this.paymentStatus=yield this.paymentService.checkForSuccessPayment(this.route.snapshot.queryParams),this.currentUser=yield this.userHelperService.getUserDetails(this.paymentStatus);}catch{this.notifier.error("Failed to load user data. Please try again");}finally{this.spinnerService.stop("video-edit-screen");}}),this.initUserDetails=()=>I(this,null,function*(){this.userPlan=yield this.planHelperService.getOrganizationPlansDetails(),this.isTeam=this.planHelperService.isProPlan(this.userPlan.genericName)||this.planHelperService.isTeamPlan(this.userPlan.name)||this.planHelperService.isAIMaxPlan(this.userPlan.name),this.isViewer=yield this.workspacePermissionService.isViewer(),this.business=yield this.adminRequestsService.getBusiness(void 0,void 0,this.deskManagerHelperService.getSelectedWorkspaceId()),yield this.setUserAnonymous(),this.storyTrackCommunicationService.setUserDetails(this.currentUser),this.storyTrackCommunicationService.setUserPlan(this.userPlan),this.teleprompterController.setUserPlan(this.userPlan),this.storyTrackCommunicationService.setViewer(this.isViewer),this.storyTrackCommunicationService.setBusiness(this.business),this.sidebars=this.isViewer?[]:cm,this.sidebars.forEac
17h(x=>{x.id==="ai-rewrite"&&(x.openAtComponentMount=this.storyHelperService.getShowAIOpen());}),this.storyHelperService.getShowAIOpen()&&this.storyHelperService.showAIOnOpen(!1);}),this.updateSidebars=x=>{if(x&&x.storyId){let A=this.isAnonymous?`script-story/${x.storyId}/takes`:`script-story/${x.storyId}`;this.sidebars.find(Y=>Y.id==="video-assets-uploads")?.addInput("upsellPath",A);}else this.sidebars.find(A=>A.id==="video-assets-uploads")?.addInput("upsellPath","script-story");},this.setUserAnonymous=()=>I(this,null,function*(){this.isAnonymous=!!(yield this.anonymousUserService.getAnonymousUser()),this.storyTrackCommunicationService.setAnonymous(this.isAnonymous),this.teleprompterController.setIsAnonymous(this.isAnonymous),this.blockBackLink=!1,!this.isAnonymous&&this.currentRoute===It.takes&&this.navigationHelperService.toggleMediaSidebar(Je.NONE,!0);}),this.addOrRemoveAnonymousTake=x=>I(this,null,function*(){if(x){let{take:A}=yield this.anonymousUserService.getUploadAssets();this.notifyOnLocalTakeAdded(A);}else{let A=this.takeTrackList.find(Y=>Y.localTake.isAnonymousTake);this.deleteTakeFromList(A),this.storyTrackCommunicationService.setPlayerTrack(null),yield this.anonymousUserService.removeUploadAssets(A.localTake.id);}}),this.initChildComponent=x=>I(this,null,function*(){let A=x.storyId,Y=window.location.pathname;if(!A)yield this.router.navigate([ai,ft.script]);else{try{this.storyTrackCommunicationService.setStoryLoading(!0),this.story=yield this.adminRequestsService.getStoryById(A,!0);}catch(ee){console.error(ee),this.storyTrackCommunicationService.setStoryLoading(!1),yield this.router.navigate([ai,ft.script]),this.storyNotFoundDialog(!0,A);return;}if(this.setIsExist(!0),Y.split("/")[3]===ft.script&&!this.isAnonymous)yield this.router.navigate([ai,A,ft.script]);else{let ee=(yield this.localTakeHelperService.getAll(this.story.storyId))||[],Ce=this.story.videos?this.story.videos.filter(it=>it.status>0):[],ke=Y.split("/")[3]||ft.script,ze=this.isAnonymous?ke:Ce.length>0||ee.length>0?ft.takes:ft.script;yield this.router.navigate([ai,A,ze]);}}}),this.initCurrentPath=()=>{let x=this.location.path();this.currentRoute=x.includes(ft.takes)?It.takes:It.script,this.teleprompterController.setCurrentRoute(this.currentRoute);},this.initStory=(x=null)=>I(this,null,function*(){this.initCurrentPath(),this.cpStoryDeepLink.reset(),this.story||(this.story=new Sp(),this.story.headline="",this.story.script="",this.story.status="draft"),this.updateSidebars(this.story),this.setHeadline(this.story.headline);let A=this.story.metadata?.sequenceData?.v||0;this.setVersion(A),this.setScriptTracks(this.story.script),this.setTakesTracks(x).then(Y=>{this.takeTrackList.some(ee=>ee.feature.find(Ce=>[Oe.chromaKey,Oe.backgroundChange,Oe.blur,Oe.textToSpeech,Oe.audiogram,Oe.aiAvatarVideo,Oe.videoDub].includes(Ce.value))&&ee.video&&ee.video.status===1)&&this.websocketService.connect();}),this.story.metadata?.sequenceTemplate?this.setTemplatesFromMetadata([this.story.metadata.sequenceTemplate]):this.setTemplates([Fl.SEQUENCE],1),this.cpSlotsStore.load(this.story),setTimeout(Y=>{this.populateTrackList(this.story.metadata?.sequenceData?.media,this.story.author),this.updatePreviewerSlides(this.trackList),this.slideListDataService.setTrackList(this.trackList?this.trackList:[]),this.setGoButtonLink(),this.setStoryUpdate(),Y&&this.storyTrackCommunicationService.setStartAudiogramFlow(),this.setInitialHistoryState(),this.storyTrackCommunicationService.setStoryLoading(!1);},1e3);}),this.setSocketListener=()=>{this.updatedStorySubscription=this.websocketService.updatedStoryId$.subscribe(x=>{x&&this.updateStoryOnSocketInputAfterTakeUpload(x);});},this.onUndo=()=>{let x=this.historyService.undo();this.updateStateOnHistoryAction(x),this.scriptScreenClickEvent(At.undo);},this.onRedo=()=>{let x=this.historyService.redo();this.updateStateOnHistoryAction(x),this.scriptScreenClickEvent(At.redo);},this.openSettingsDialog=()=>{},this.onHeadlineChange=x=>{this.isViewer||(this.isValidTextLength(x)?(this.setHeadline(x),this.currentRoute===this.ScriptScreen?(this.setHasChanges(!0,this.shouldAutosaveScript(),this.isExist?this.updateCallback:this.creationCallback),this.recordChange(0,this.headline)):this.isExist?this.updateCallback():this.creationCallback()):this.showHeadlineTooLongNotification());},this.onUploadClick=()=>{this.isViewer||(this.navigationHelperService.toggleMediaSidebar(Je.MY_VIDEO_UPLOADS,!0),this.sendSidebarOpenOrClose({sidebar:Je.MY_VIDEO_UPLOADS,opened:!0}));},this.onContentPlannerClick=()=>I(this,null,function*(){if(!this.plannerLookupBusy){this.plannerLookupBusy=!0;try{yield this.cpSlotLauncherService.openForStory(this.story,{onMessageAction:this.onSlotDialogAction,onStoryTabOpened:this.reloadStory,onRecordRequested:this.openSlotRecording,onSlotsRead:x=>this.cpSlotsStore.adopt(x)});}finally{this.plannerLookupBusy=!1;}}}),this.onSlotDialogAction=(x,A)=>I(this,null,function*(){this.dialogHelperService.close(),yield this.cpSlotActionRunner.run({item:x,event:A});}),this.onBackBtnClick=()=>I(this,null,function*(){if(!this.blockBackLink)if(this.goBackLink.includes(ft.takes)){this.storyTrackCommunicationService.setAiSidebarOpen(!1),this.navigationHelperService.toggleMediaSidebar(Je.NONE,!0),this.hasChanges&&(yield this.onHeaderButtonClick());let x=Array.isArray(this.goBackLink)?this.goBackLink:[this.goBackLink];yield this.router.navigate(x),this.initStory();}else this.teleprompterController.onWindowClose(),this.navigateToExit();}),this.sendSidebarOpenOrClose=x=>I(this,null,function*(){this.isViewer||this.isAnonymous&&this.anonymousUserService.setMainStoryId(this.story.storyId);}),this.onHeaderButtonClick=()=>I(this,null,function*(){this.story.storyId?yield this.onStoryUpdate():yield this.onStoryCreate();}),this.onHeaderButtonClickWithCallback=x=>I(this,null,function*(){let{callback:A,force:Y}=x;this.story.storyId?(Y||this.hasChanges)&&(yield this.onStoryUpdate()):yield this.onStoryCreate(),A?.(this.story);}),this.onScriptNavigation=()=>I(this,null,function*(){this.navigationHelperService.toggleMediaSidebar(Je.NONE,!0),yield this.router.navigate([ai,this.story.storyId,ft.script]),this.hasChanges&&(yield this.onSequenceCreate(!1)),this.initStory();}),this.openSlotRecording=()=>I(this,null,function*(){this.currentRoute!==It.script&&(yield this.onScriptNavigation()),yield this.onOpenTeleprompterClick(Nt.RECORD,!1);}),this.onNewTake=()=>I(this,null,function*(){this.navigationHelperService.toggleMediaSidebar(Je.NONE,!0),this.eventsService.log(this.EVENT_PATH_SCRIPT.teleprompterRecordStart,{storyId:this.story.storyId,planName:this.userPlan.name,email:this.currentUser.email,name:this.currentUser.fullName,mode:"new-take"}),this.onOpenTeleprompterClick(Nt.RECORD,!1);}),this.onLocalTakeToDownload=x=>I(this,null,function*(){let A=yield this.localTakeHelperService.getVideo(x.take.localTake.id);this.teleprompterController.downloadLocalTake(A,x.format);}),this.onLocalTakeUpload=x=>I(this,null,function*(){let A=yield this.localTakeHelperService.getVideo(x.localTake.id);this.teleprompterController.handleUploadRequest(x.localTake,A.file,!0);}),this.setScriptTracks=x=>{this.scriptTrackList=[];let A=new Hs(1,"Script",x,!1);
17this.getScriptWordCount(x),this.getDuration(),this.scriptTrackList.push(A),this.setScriptTrackUpdate();},this.updateScriptTakes=x=>{x&&(this.scriptTrackList.find(A=>A.id===x.id).contentData=x.contentData,this.getScriptWordCount(x.contentData.script),this.getDuration(),this.setScriptTrackUpdate(),this.setHasChanges(!0,this.shouldAutosaveScript(),this.isExist?this.updateCallback:this.creationCallback),this.recordChange(1,tr.default.cloneDeep(this.scriptTrackList)));},this.getScriptWordCount=x=>{this.scriptWordCount=Lo(x),this.scriptCharCount=(x??"").length,this.teleprompterController.scriptWordCount=this.scriptWordCount,this.recomputeScriptLimits();},this.getDuration=()=>{let A=this.scriptWordCount*.375,Y=new Date();Y.setSeconds(A%60),Y.setMinutes(Math.floor(A/60)),this.durationTake=Y;},this.recomputeScriptLimits=()=>{let x=[];this.scriptCharCount>$n&&x.push({feature:hn.audiogram,reason:"AI voice generator scripts must be under "+$n.toLocaleString()+" characters."}),this.hasExtendedPortraitScript?this.scriptCharCount>$n&&x.push({feature:hn.portrait2Video,reason:"AI talking photo scripts must be under "+$n.toLocaleString()+" characters."}):this.scriptWordCount>Fo&&x.push({feature:hn.portrait2Video,reason:"AI talking photo scripts must be under "+Fo+" words."}),this.exceededScriptLimits=x,this.storyTrackCommunicationService.setExceededScriptLimits(x);},this.getScriptLimitTooltip=()=>this.visibleScriptLimits.map(x=>x.reason).join(` 18`),this.setTakesTracks=(x=null)=>I(this,null,function*(){this.takeTrackList=[];let A=this.story.segmentation?this.story.segmentation.filter(ee=>ee.status===1).map(ee=>ee.groupId):[],Y=this.getComposerHeadlines();if(this.story.videos&&this.story.videos.length>0){for(let ee of this.story.videos){let Ce=this.story.videos.indexOf(ee);if(Ha(ee))continue;let ke=yield this.getFeatureForTake(A,ee),ze=ke.some(bt=>bt.value===Oe.videoDub),it=new en(this.takeTrackList.length+Ce,ct.notLocal,!1,null,ee,ke,this.getStatusForTake(ke,ee),ze?null:ee.takeName,ee.status===-1,ee.status===-1,ee.progress);Ua(ee.sourceStory)&&(it.kind="composerVideo",it.composerStoryId=ee.sourceStory.storyId,it.composerStoryType=ee.sourceStory.type,it.composerDeleted=ee.sourceStory.status==="deleted",it.title=Y.get(ee.sourceStory.storyId)??it.title),this.takeTrackList.push(it);}this.takeTrackList.push(...this.getComposerDraftTracks());}try{this.story.storyId&&((yield this.localTakeHelperService.getAll(this.story.storyId))||[]).forEach((Ce,ke)=>{this.takeTrackList.push(new en(this.takeTrackList.length+ke,ct.local,!1,Ce,null,[{key:ti[Oe.local],value:Oe.local,tooltipName:Qt(Oe.local)}],Et.none,Ce.name));});}catch(ee){console.error(ee);}if(this.takeTrackList.length>0){this.takeTrackList.sort((Ce,ke)=>{let ze=this.getTrackSortDate(Ce),it=this.getTrackSortDate(ke);return ze>it?-1:1;}),this.takeTrackList.forEach((Ce,ke)=>{Ce.id=this.takeTrackList.length-ke;});let ee=yield this.translateStoryServiceService.getLanguagesMap();this.takeTrackList.forEach(Ce=>{if(Ce.feature?.some(ke=>ke.value===Oe.videoDub)&&Ce.video?.takeName){let ze=ee.get(Ce.video.takeName)?.languageEnglishName||Ce.video.takeName;Ce.title=`${Ce.title} - ${ze}`;}}),x?this.takeTrackList.find(Ce=>Ce.id==x.id).active=!0:this.takeTrackList.some(Ce=>{if(Ce.loadingStatus==Et.none&&!Ce.processFailed)return Ce.active=!0,!0;}),this.currentRoute===It.takes&&this.storyTrackCommunicationService.setPlayerTrack(this.takeTrackList.find(Ce=>Ce.active));}this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList);}),this.getFeatureForTake=(x,A)=>I(this,null,function*(){let Y=yield this.translateStoryServiceService.getLanguagesMap(),ee=this.story.captions?.filter(ke=>ke.groupId===A.groupId&&ke.status===2),Ce=[{key:ti[Oe.cloud],value:Oe.cloud,tooltipName:Qt(Oe.cloud)}];return A.entityType==="sequence"&&Ce.push({key:ti[Oe.sequence],value:Oe.sequence,tooltipName:Qt(Oe.sequence)}),Ua(A.sourceStory)&&Ce.push(Pd(A.sourceStory.type)),A.features&&Ce.push(...A.features.filter(ke=>ke.name!==ti[Oe.textToSpeech]).map(ke=>({key:ti[ws(ke.name)]||ke.name,value:ws(ke.name),tooltipName:Qt(ws(ke.name))}))),ee.forEach(ke=>{let ze=Y.get(ke.lang);ze?Ce.push({value:ze.langCode,sideIconClass:`fi fi-${this.translateStoryServiceService.convertLanguageCode(ze.langCode)}`,tooltipName:ze.languageEnglishName||ke.name}):Ce.push({value:ke.lang,sideIconClass:`fi fi-${this.translateStoryServiceService.convertLanguageCode(ke.lang)}`,tooltipName:ke.name});}),Ce;}
18),this.getStatusForTake=(x,A)=>{let{captions:Y,trim:ee,sequence:Ce}=Oe;return x.findIndex(ke=>ke.value===ee||ke.value===Ce)&&A.status===1?Et.captions:Et.none;},this.deleteTakeFromList=x=>{this.takeTrackList.splice(this.takeTrackList.indexOf(x),1),this.takeTrackList.length>0?(this.renumberAndPickActive(),this.story.videos.splice(this.story.videos.indexOf(x.video),1),this.setStoryUpdate(),this.setTakeToPlayerByStatus(),this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList)):(this.story.videos.splice(this.story.videos.indexOf(x.video),1),this.setStoryUpdate(),this.isAnonymous&&this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList),!this.isAnonymous&&this.onScriptNavigation());},this.restoreTakeInList=(x,A)=>{let Y=Math.max(0,Math.min(A,this.takeTrackList.length));if(this.takeTrackList.splice(Y,0,x),this.renumberAndPickActive(),x.video&&this.story?.videos&&this.story.videos.indexOf(x.video)===-1){let ee=Math.max(0,Math.min(A,this.story.videos.length));this.story.videos.splice(ee,0,x.video);}this.setStoryUpdate(),this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList);},this.renumberAndPickActive=()=>{let x=!1;this.takeTrackList.forEach((A,Y)=>{A.active=A.loadingStatus==Et.none&&!x,A.id=this.takeTrackList.length-Y,x=A.active;});},this.setTakeToPlayerByStatus=()=>{let x=this.takeTrackList.find(A=>A.localTake||A.video?.status===2)||this.takeTrackList[0];this.storyTrackCommunicationService.setPlayerTrack(x);},this.onTakeGenerate=x=>I(this,null,function*(){this.story.segmentation.push({groupId:x.video.groupId,status:1}),this.takeTrackList.some(A=>{if(A.id==x.id&&A.status==ct.notLocal)return A.feature=[{key:ti[Oe.cloud],value:Oe.cloud,tooltipName:Qt(Oe.cloud)}],A.loadingStatus=Et.captions,!0;}),this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList),this.setStoryUpdate(),this.websocketService.connect();}),this.setStorySaved=x=>{this.storySaved=x;},this.onStoryCreate=(x=!0,A=void 0)=>I(this,null,function*(){if(this.currentRoute!==It.takes)try{this.spinnerService.spin(this.SPINNER_ID),this.isLoading=!0,this.headline=this.headline===""?yield this.autoCreateTitle():this.headline;let Y=pe({headline:this.headline,script:A||this.scriptTrackList[0]?.contentData?.script||"",deskId:this.deskManagerHelperService.getSelectedWorkspaceId(),presenters:[this.currentUser.userId],status:"validated"},this.parentFolderId?{folderId:this.parentFolderId}:{}),ee=yield this.adminRequestsService.createPresenterStory(Y);this.updateSidebars(ee),this.afterStoryUpdatedOrCreated(ee,!0);let Ce={demo:(!!this.story.fromDefault).toString()};this.sendScriptEvent(this.EVENT_PATH_SCRIPT.create,ee,Ce),this.setIsExist(!0),this.setHasChanges(!1),this.notifier.info("Story created"),x&&this.location.replaceState("/"+ai+"/"+this.story.storyId+"/"+ft.script);}catch(Y){console.error(Y),this.notifier.error("Please try again");}finally{this.isLoading=!1,this.spinnerService.stop(this.SPINNER_ID);}}),this.onStoryUpdate=(x=!1)=>I(this,null,function*(){try{this.spinnerService.spin(this.SPINNER_ID),this.isLoading=!0;let A=Di(pe({},this.headline?{headline:this.headline}:{}),{storyId:this.story.storyId,v:this.story.v});this.currentRoute===It.script&&(A.script=this.scriptTrackList[0].contentData.script),x&&(A.vIgnore=!0),this.story.metadata?.sequenceId&&(A.sequenceStoryId=this.story.metadata?.sequenceId);let Y=yield this.adminRequestsService.updatePresenterStory(A);if(this.afterStoryUpdatedOrCreated(Y,!0),this.currentRoute===It.script){let ee=pe({demo:(!!this.story.fromDefault).toString()},this.cpProjectAnalytics.attrs(this.cpAnalyticsSource()));this.sendScriptEvent(this.EVENT_PATH_SCRIPT.saveScriptText,void 0,ee);}this.setHasChanges(!1),this.notifier.info("Story Updated");}catch(A){A.responseJSON&&A.responseJSON.code==="10008/0"?this.openVersionValidationErrorDialog():A.responseJSON&&A.responseJSON.code==="10001/0"?this.storyNotFoundDialog():(console.error(A),this.notifier.error("Please try again"));}finally{this.isLoading=!1,this.spinnerService.stop(this.SPINNER_ID);}}),this.afterStoryUpdatedOrCreated=(x,A=!1)=>{this.story=x,A&&this.setStoryUpdate(),this.storySaved=!0;},this.fetchStory=(x,A)=>I(this,null,function*(){A&&this.storyTrackCommunicationService.setStoryLoading(!0),this.story=yield this.adminRequestsService.getStoryById(x,!0),this.translateStoryServiceService.setTranslateStory(this.story);}),this.reloadStory=x=>I(this,null,function*(){if(!(!x||this.story?.storyId!==x))try{yield this.fetchStory(x,!0),this.initStory();}catch(A){console.error(A),this.storyTrackCommunicationService.setStoryLoading(!1);}}),this.updateStoryOnSocketInputAfterTakeUpload=(x,A=!1)=>I(this,null,function*(){try{let{storyId:Y,mediaId:ee,actions:Ce}=x;if(this.story.storyId!==Y)return;if(yield this.fetchStory(Y,A),ee){let ke=this.storyScriptStateService.getOnReadyCallback(ee);ke&&ke(this.story),this.storyScriptStateService.clearCallback(ee);}Ce&&Ce.includes("audiogram")&&ee&&this.audiogramDialogIsOpened&&(this.storyScriptStateService.setOnReadyCallback(ee,ke=>this.dialogHelperService.close()),this.audiogramDialogIsOpened=!1),this.initStory();}catch(Y){console.error(Y),this.storyTrackCommunicationService.setStoryLoading(!1);}}),this.openVersionValidationErrorDialog=()=>{this.dialogHelperService.showUiConfirmationDialog({title:"This story has been updated by another user",msg:`<p>Press 'OK' to save with your changes</p> 19 <p>Press 'Cancel' to update to the latest version</p> 20 <p>or create a copy of your version</p>`,confirmationText:"OK",cancellationText:"Cancel",actionText:"Create Copy",onSubmit:()=>this.onVersionValidationSubmit("force"),onClose:this.dialogHelperService.close,onAction:()=>this.onVersionValidationSubmit("copy"),confirmButtonVariant:"primary-royal",cancelButtonVariant:"half-filled-royal",actionButtonVariant:"secondary-royal"});},this.onVersionValidationSubmit=x=>{switch(this.dialogHelperService.close(),x){case"force":this.onStoryUpdate(!0);break;case"copy":this.duplicateStory();break;default:break;}},this.duplicateStory=()=>I(this,null,function*(){this.isLoading=!0;try{let x={script:this.story.script,headline:this.story.headline,vIgnore:!0},A={storyId:this.story.storyId},Y=yield this.adminRequestsService.duplicateStory(A);Y.headline.substring(0,Y.headline.length-5)===x.headline&&delete x.headline,x.storyId=Y.storyId,x.v=Y.v,this.adminRequestsService.updatePresenterStory(x).then(ee=>{this.notifier.success("Copy has been created"),this.setHasChanges(!1),this.router.navigate(this.getBoardsLinkSegments());});}
20catch(x){console.error(x),x.responseJSON&&x.responseJSON.code==="10001/0"?this.storyNotFoundDialog():this.notifier.error("Please try again");}finally{this.isLoading=!1;}}),this.onSequenceCreate=(x=!1,A=!1)=>I(this,null,function*(){!this.planHelperService.isFreePlan(this.userPlan.genericName)&&!this.currentUser.anonymous&&(this.story.metadata?.sequenceId?yield this.updateSequence(x,A):yield this.createNewSequence(x,A));}),this.updateSequence=(x=!1,A=!1)=>I(this,null,function*(){try{this.storyTrackCommunicationService.setSequenceLoading(!0);let Y=yield this.adminRequestsService.updateSequence(this.story.metadata?.sequenceId,this.getVersion(),!0,this.getHeadline(),this.selectedAspectRatio,this.slideListDataService.getMediaSlides(this.trackList),void 0,this.story.storyId);this.setVersion(Y.v),this.afterUpdateAndCreateSequence(Y),this.setStoryUpdate(),A||this.notifier.success("Sequence saved successfully"),this.setHasChanges(!1),x&&(yield this.commonLogicWithGenerateSequenceVideo(Y));}catch(Y){if(this.storyTrackCommunicationService.setSequenceLoading(!1),console.error(Y),this.creditsService.handleCreditError(Y))return;this.notifier.error("Failed to update the sequence. Please try again");}}),this.createNewSequence=(x=!1,A=!1)=>I(this,null,function*(){try{this.storyTrackCommunicationService.setSequenceLoading(!0);let Y=this.slideListDataService.getMediaSlides(this.trackList),ee=yield this.adminRequestsService.addSequence(this.getHeadline(),this.selectedAspectRatio,this.deskManagerHelperService.getSelectedWorkspaceId(),Y,void 0,this.story.storyId);this.eventsService.log(this.EVENT_PATH_SEQUENCE.create,{numSlides:Y.length,numTakes:this.trackList?.length,numAssets:0,storyId:this.story.storyId}),this.afterUpdateAndCreateSequence(ee),A||this.notifier.success("Sequence created successfully"),this.setIsExist(!0),this.setHasChanges(!1),x?yield this.commonLogicWithGenerateSequenceVideo(ee):this.sendSequenceEvent(this.eventsService.events.sequence.save,{num_videos:this.trackList?.length});}catch(Y){if(this.storyTrackCommunicationService.setSequenceLoading(!1),console.error(Y),this.creditsService.handleCreditError(Y))return;this.notifier.error("Failed to create the Sequence. Please try again");}}),this.afterUpdateAndCreateSequence=x=>{this.story.metadata.sequenceId=x.storyId,this.story.metadata.sequenceData={media:x.media,v:x.v},this.setStoryUpdate();},this.commonLogicWithGenerateSequenceVideo=x=>I(this,null,function*(){let A=yield this.generateSequence(x),Y=new en(this.takeTrackList.length,ct.notLocal,!1,null,A,[{key:ti[Oe.sequence],value:Oe.sequence,tooltipName:Qt(Oe.sequence)}],Et.captions);Y.id=this.takeTrackList.length+1,this.takeTrackList.unshift(Y),this.story.videos.push(A),this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList),this.setStoryUpdate(),this.websocketService.connect(),this.notifier.info("Generating your sequence");}),this.generateSequence=x=>this.adminRequestsService.generateVideo({storyId:x.id,templateIds:this.slideListDataService.getTemplateIds(),aspectRatio:this.selectedAspectRatio||"horizontal"}),this.sendSequenceEvent=(x,A)=>{this.eventsService.log(x,A);},this.onTrackListChange=x=>{let{name:A,trackSource:Y,trackList:ee}=x;this.updateTrackList(ee),this.recordChange(3,tr.default.cloneDeep(this.trackList));},this.onSequenceAspectRatioChange=x=>{this.story?.metadata?.sequenceData?.aspectRatio!=x&&this.trackList?.length>0&&this.setHasChanges(!0,!0,this.onSequenceCreate);},this.updateTrackList=x=>{this.trackList=x,this.updatePreviewerSlides(x),this.setHasChanges(!0,this.getHeadline()!=="",this.onSequenceCreate),this.slideListDataService.setTrackList(x);},this.populateTrackList=(x,A)=>{this.trackList=[],x?.length>0&&x.forEach((Y,ee)=>{let Ce=tr.default.cloneDeep(Y),ke=this.takeTrackList.find(it=>!it.localTake&&it.video?.mediaId===Ce.owner.subRefId),ze=new qo(ee+1,ke?ke.title:Ce.owner.title,Ce,A,[new St(xn.DELETE,"Remove Media","color: var(--red-500, #E53935)","/img/icon-library/basic-ui/delete-trash-small.svg")]);this.trackList.push(ze);});},this.updatePreviewerSlides=x=>{let A=this.slideListDataService.getMediaSlides(x);this.videoSlidesService.slidesArraySubject$.next(A);},this.recordChange=(x,A)=>{this.historyService.recordAction(Y=>{Y[x]=A;});},this.setInitialHistoryState=()=>{let x={0:this.headline||""};
20this.currentRoute===It.script?(x[1]=tr.default.cloneDeep(this.scriptTrackList)||[],x[3]=[]):(x[1]=[],x[3]=tr.default.cloneDeep(this.trackList)||[]),this.historyService.clear(),this.historyService.setInitialState(x),this.setStorySaved(!1);},this.updateStateOnHistoryAction=x=>{this.headline=x[0],this.currentRoute===It.script?(this.scriptTrackList=x[1],this.setScriptTrackUpdate(),this.getScriptWordCount(this.scriptTrackList[0].contentData.script),this.getDuration(),this.setHasChanges(!0,this.shouldAutosaveScript(),this.isExist?this.updateCallback:this.creationCallback)):(this.trackList=x[3],this.slideListDataService.setTrackList(this.trackList),this.setHasChanges(!0,this.getHeadline()!=="",this.onSequenceCreate));},this.onOpenTeleprompterClick=(x,A)=>I(this,null,function*(){if(this.recordOptionsClick(x),this.isViewer){this.permissionService.openNoPermissionErrorDialog();return;}A&&this.hasChanges&&(yield this.onHeaderButtonClick()),!this.story.storyId&&!this.storySaved?this.openSaveStoryConfirmationDialog("Story must be saved before recording. Do you want to save your story?"):(yield this.needToUpgrade(x))?this.showUpsellDialog(pt.liveStream):x===Nt.LIVE&&this.isAnonymous?this.portableRegisterService.openPortableRegisterDialog():this.teleprompterController.openTeleprompter(x);}),this.needToUpgrade=x=>I(this,null,function*(){return x===Nt.LIVE&&!(yield this.planHelperService.hasPremiumPlan());}),this.showUpsellDialog=(x=pt.liveStream,A=pt.liveStream)=>{let Y=`script-story/${this.story.storyId}`;this.premiumPlanService.openPricingDialog(yi.PRO,Y,Y,x);},this.openSaveStoryConfirmationDialog=(x,A=this.onSaveStoryConfirmation,Y)=>{this.dialogHelperService.showUiConfirmationDialog({title:"Save Story",msg:x,confirmationText:"Yes",cancellationText:"No",onSubmit:A,onClose:Y});},this.onSaveStoryConfirmation=()=>{this.onHeaderButtonClick(),this.dialogHelperService.close();},this.openTeleprompterStoryLogic=()=>{this.storyTrackCommunicationService.setAiSidebarOpen(!1),this.navigateToTakes();},this.navigateToTakes=(x=this.story?.storyId)=>(this.navigationHelperService.toggleMediaSidebar(Je.NONE,!0),this.router.navigate([ai,x,ft.takes]).then(()=>this.initStory())),this.onUploadTakeRequested=()=>I(this,null,function*(){if(!this.isViewer){if(yield this.planHelperService.isFreeByCurrentPlan()){this.showUpsellDialog(pt.uploadTake);return;}this.currentRoute===It.script&&this.hasChanges&&(yield this.onHeaderButtonClick()),this.sendScriptEvent(this.EVENT_PATH_SCRIPT.uploadClick),this.takeUploadService.openUploadTakeDialog();}}),this.onUploadedTakeFileSelected=x=>I(this,null,function*(){let A=this.currentRoute===It.script,Y=yield this.fileValidationService.getVideoDuration(x);(yield this.uploadNewTake({duration:Y,created:new Date().toISOString()},x))&&A&&this.story?.storyId&&this.navigateToTakes();}),this.uploadNewTake=(x,A,Y=!1)=>I(this,null,function*(){let ee=A.lastModified?A:this.uploadService.blobToFile(A,this.story.headline),Ce;if(Y?Ce=yield this.fileValidationService.isVideoLengthValidByDuration(x.duration,this.userPlan.name):Ce=yield this.fileValidationService.isVideoLengthValid(ee,this.userPlan.name),!Ce.isValid){let bt;return Ce.maxAllowedDuration?bt=`The video can't exceed ${Ce.maxAllowedDuration/60} minutes`:bt="We couldn't use the selected video file",this.notifier.error(bt),!1;}let ke={cancel:()=>{}},ze=this.createStateId(),it=this.addNewUploadState(mi.SCRIPT_STORY_TAKE,ze,ee,this.uploadStateSubscriptions[mi.SCRIPT_STORY_TAKE],this.onTakeUploadStateChange,bt=>{this.sendScriptEvent(this.EVENT_PATH_SCRIPT.uploadEnd,void 0,{duration:x.duration,fileSize:parseFloat((A.size/(1024*1024)).toFixed(2)),recordedDate:x.created,isImport:!1}),this.logCpTakeSelected(!1);},ke);this.sendScriptEvent(this.EVENT_PATH_SCRIPT.uploadStart,void 0,{duration:parseFloat(x.duration).toFixed(2),fileSize:parseFloat((A.size/(1024*1024)).toFixed(2)),recordedDate:x.created,isImport:!1}),this.logCpUploadStart();try{return this.uploadService.uploadImportedVideo({storyId:this.story.storyId,file:ee,defaultLevel:"organization",deskId:this.deskManagerHelperService.getSelectedWorkspaceId(),context:mi.SCRIPT_STORY_TAKE,id:it.id,onUploadFinishCallback:it.onReadyCallback,cancelUploadFunction:ke}).then(bt=>{}).catch(bt=>{bt.responseJSON?.code==="10001/0"&&(this.storyNotFoundDialog(),this.onTakeUploadCancellation(it.id));}),!0;}catch(bt){return console.error(bt),this.notifier.clearAll(),this.notifier.error("Please try again"),this.sendScriptEvent(this.EVENT_PATH_SCRIPT.uploadFailed,void 0,{error:bt}),!1;}}),this.onTakeUploadStateChange=x=>I(this,null,function*(){if(!x)return;let{id:A,status:Y,entity:ee,onReadyCallback:Ce}=x;if(Y==="completed"){let ke=ee.videos?.at(-1)?.mediaId||ee.storyId;if(this.uploadStateService.clear(mi.SCRIPT_STORY_TAKE,A),this.notifier.info("Take uploaded. Transcoding..."),!this.story?.storyId&&ee?.storyId){this.storyTrackCommunicationService.setTakeClearFromUploadList(A),yield this.navigateToTakes(ee.storyId);return;}this.storyTrackCommunicationService.setTakeClearFromUploadList(A),this.storyTrackCommunicationService.setStoryTriggerUpdateTake(ee),this.storyScriptStateService.setOnReadyCallback(ke,Ce),this.websocketService.connect();}}),this.onTakeUploadCancellation=x=>I(this,null,function*(){this.logCpImportDismissed(),setTimeout(()=>I(this,null,function*(){yield this.cancelUpload(mi.SCRIPT_STORY_TAKE,x),this.onTakeUploadListClean(x);}),1e3);}),this.onTakeUploadListClean=x=>{delete this.uploadingImportedVideos[x],this.storyTrackCommunicationService.setUploadingTakeTracks(this.uploadingImportedVideos);},this.onStoryUpdatedTakes=x=>{if(this.story=x,Ha(x.videos?.at(-1))){this.setStoryUpdate();return;}let A=new en(this.takeTrackList.length,ct.notLocal,!1,null,x.videos?.at(-1),[],0);A.id=this.takeTrackList.length+1,A.fromUpload=!0,this.takeTrackList.unshift(A),this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList),this.setStoryUpdate();},this.notifyOnLocalTakeAdded=x=>{this.takeTrackList.unshift(new en(x.id||this.takeTrackList.length+1,ct.local,!1,x,null,[{key:ti[Oe.local],value:Oe.local,tooltipName:Qt(Oe.local)}],Et.none)),this.takeTrackList.forEach((A,Y)=>{A.active=Y===0,A.id=this.takeTrackList.length-Y;}),this.storyTrackCommunicationService.setPlayerTrack(this.takeTrackList[0]),this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList);},this.openThumbnailFileInput=x=>{this.thumbnailFileInput.nativeElement.click();},this.onThumbnailUpdate=x=>
20I(this,null,function*(){let A=x.target.files,Y=this.takeTrackList.find(ee=>ee.active);try{if(yield this.uploadValidationService.isFileUploadable(A[0],"image","thumbnail")){let ee={cancel:()=>{}},Ce=this.addNewUploadState(mi.SCRIPT_STORY_THUMBNAIL,Y.video.id,A[0],this.uploadStateSubscriptions[mi.SCRIPT_STORY_THUMBNAIL],this.onThumbnailUploadStateChange,void 0,ee);this.uploadService.uploadAsset({name:A[0].name,assetType:"image",file:A[0],defaultLevel:"desk",deskId:this.deskManagerHelperService.getSelectedWorkspaceId(),subType:"thumbnail",context:mi.SCRIPT_STORY_THUMBNAIL,id:Ce.id,cancelUploadFunction:ee});}}catch{this.notifier.error("Thumbnail upload failed");}finally{x.target.value=null;}}),this.updateStoryThumbnail=x=>{let{assetId:A,videoId:Y}=x;try{let ee=this.story.videos.find(Ce=>Ce.id===Y);ee&&this.adminRequestsService.updateVideoThumbnail(this.story.id,"story",ee.id,A).then(Ce=>{this.notifier.info("Thumbnail uploaded successfully"),this.takeTrackList.filter(ke=>ke.loadingStatus==Et.thumbnail).length==0&&this.updateStoryOnSocketInputAfterTakeUpload({storyId:this.story.id,mediaId:null});});}catch(ee){this.notifier.error("Failed to update the story with the new thumbnail"),console.error(ee);}},this.onThumbnailUploadStateChange=x=>I(this,null,function*(){if(!x)return;let{id:A,context:Y,status:ee,progress:Ce,entity:ke}=x;ee==="uploading"?(this.takeTrackList.find(ze=>ze.video?.id==A).loadingStatus=Et.thumbnail,this.takeTrackList.find(ze=>ze.video?.id==A).progress=Ce):ee==="completed"&&(this.takeTrackList.find(ze=>ze.video?.id==A).loadingStatus=Et.none,this.uploadStateService.clear(Y,A),this.storyTrackCommunicationService.setStoryTriggerUpdateThumbnail({assetId:ke.assetId,videoId:A}),this.notifier.info("Story updated with the new thumbnail")),this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList);}),this.onThumbnailUploadCancellation=x=>I(this,null,function*(){setTimeout(()=>I(this,null,function*(){yield this.cancelUpload(mi.SCRIPT_STORY_THUMBNAIL,x.video.id),this.takeTrackList.find(A=>A.id===x.id).loadingStatus=Et.none,this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList);}),1e3);}),this.onTakeTrim=x=>{let{take:A,video:Y,start:ee,end:Ce,method:ke}=x;if(ke==="trim"){let ze=new en(this.takeTrackList.length,ct.notLocal,!1,null,Y,[{key:ti[Oe.cloud],value:Oe.cloud,tooltipName:Qt(Oe.cloud)},{key:ti[Oe.trim],value:Oe.trim,tooltipName:Qt(Oe.trim)}],Et.captions);ze.id=this.takeTrackList.length+1,this.takeTrackList.unshift(ze),this.story.videos.push(Y),this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList),this.setStoryUpdate(),this.websocketService.connect();}else this.commonAddTakeToSequence(A,ee,Ce),this.eventsService.log(this.EVENT_PATH_SEQUENCE.add,{source:Hn.bigvu,addMethod:co.trim,storyId:this.story.storyId});},this.renameComposerStory=(x,A)=>I(this,null,function*(){let Y=x.title;this.setComposerHeadline(x,A);try{yield this.adminRequestsService.updateComposerStoryFlat({storyId:x.composerStoryId,headline:A,vIgnore:!0}),this.notifier.success("Name successfully changed");}catch(ee){console.error(ee),this.setComposerHeadline(x,Y),this.notifier.error(ee?.responseJSON?.msg||"Failed to change the name");}}),this.onTakeChangeTitle=x=>I(this,null,function*(){let{take:A,title:Y}=x;if(this.eventsService.log(this.EVENT_PATH_SCRIPT.takeRename,{storyId:this.story.storyId,takeId:A.video?.mediaId,newName:Y,fromDefault:!A.video?.takeName}),A.isComposerRow){yield this.renameComposerStory(A,Y);return;}if(A.localTake)try{yield this.localTakeHelperService.changeTakeName(A.localTake.id,Y),Y||this.initStory(),this.notifier.success("Name successfully changed");}catch(ee){console.log(ee);}else try{yield this.onSequenceCreate(!1,!0);let ee=yield this.adminRequestsService.updateStoryVideoTakeName(this.story.storyId,A.video.id,Y);this.updateStoryOnSocketInputAfterTakeUpload(ee),this.notifier.success("Name successfully changed");}catch(ee){console.log(ee);}}),this.onTakeProcessFailed=x=>I(this,null,function*(){let{videoId:A,entityId:Y,actions:ee,supplementary:Ce,eventId:ke}=x,ze=this.takeTrackList.find(it=>it.video?.id===A);
20if(ze){ze.processFailed=!0,ze.loadingStatus=Et.none,ze.failedEventId=ke,this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList),this.notifier.error("Video processing failed. Please try again.");try{yield this.updateStoryOnSocketInputAfterTakeUpload({storyId:this.story.storyId,mediaId:A});}catch(it){console.error("Error refreshing story after failure:",it);}}}),this.onAudioGram=x=>{x.close?this.audiogramDialogIsOpened=!1:(this.story.videos.push(x.video),this.initStory(),this.audiogramDialogIsOpened=!0);},this.onAudioBoost=x=>{let{video:A,take:Y}=x,ee=new en(this.takeTrackList.length,ct.notLocal,!1,null,A,[{key:ti[Oe.cloud],value:Oe.cloud,tooltipName:Qt(Oe.cloud)},{key:ti[Oe.audioNorm],value:Oe.audioNorm,tooltipName:Qt(Oe.audioNorm)}],Et.captions);ee.id=this.takeTrackList.length+1,this.takeTrackList.unshift(ee),this.story.videos.push(A),this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList),this.setStoryUpdate(),this.websocketService.connect();},this.onEyeFix=x=>{let{video:A,take:Y}=x,ee=new en(this.takeTrackList.length,ct.notLocal,!1,null,A,[{key:ti[Oe.cloud],value:Oe.cloud,tooltipName:Qt(Oe.cloud)},{key:ti[Oe.eyeContact],value:Oe.eyeContact,tooltipName:Qt(Oe.eyeContact)}],Et.captions);ee.id=this.takeTrackList.length+1,this.takeTrackList.unshift(ee),this.story.videos.push(A),this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList),this.setStoryUpdate(),this.websocketService.connect();},this.onDubVideo=x=>{let{videos:A,take:Y,targetLanguages:ee}=x;A&&A.length>0?(A.forEach((Ce,ke)=>{let ze=ee&&ee[ke]?` - ${ee[ke]}`:"",it=`Take ${this.takeTrackList.length+1}${ze}`,bt=new en(this.takeTrackList.length,ct.notLocal,!1,null,Ce,[{key:ti[Oe.cloud],value:Oe.cloud,tooltipName:Qt(Oe.cloud)},{key:ti[Oe.videoDub],value:Oe.videoDub,tooltipName:Qt(Oe.videoDub)}],Et.captions,it);bt.id=this.takeTrackList.length+1,this.takeTrackList.unshift(bt),this.story.videos.push(Ce);}),this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList),this.setStoryUpdate(),this.websocketService.connect()):this.onTakeGenerate(Y);},this.onGenerateAiVideo=x=>{this.story.videos.push(x),this.initStory();},this.onSendTakeToSequence=x=>{let{take:A,source:Y,addMethod:ee}=x;this.commonAddTakeToSequence(A),this.eventsService.log(this.EVENT_PATH_SEQUENCE.add,{source:Y,addMethod:ee,storyId:this.story.storyId});},this.commonAddTakeToSequence=(x,A,Y)=>{this.storyTrackCommunicationService.setAddTakeToSequence({type:"storyTake",data:{story:this.story,takeId:x.video.mediaId,headline:x.title||this.story.headline,start:A||void 0,end:Y||void 0}});},this.cancelUpload=(x,A)=>I(this,null,function*(){this.uploadStateService.cancel({context:x,stateId:A});}),this.addNewUploadState=(x,A,Y,ee,Ce,ke,ze)=>{let it={id:A,context:x,progress:0,name:Y.name,status:$l.UPLOADING,isCancellable:!0,onReadyCallback:ke,cancelUploadFunction:ze},bt=this.uploadStateService.add(x,it);return ee.push(bt.subscribe(ir=>Ce(ir))),x===mi.SCRIPT_STORY_TAKE&&(this.uploadingImportedVideos[it.id]=bt,this.storyTrackCommunicationService.setUploadingTakeTracks(this.uploadingImportedVideos)),it;},this.getOngoingUploadingStates=()=>{let x=[mi.SCRIPT_STORY_TAKE,mi.SCRIPT_STORY_THUMBNAIL],A=[this.onTakeUploadStateChange,this.onThumbnailUploadStateChange];x.forEach(Y=>{let ee=this.uploadStateService.getState(Y);ee&&ee.forEach(Ce=>{let{subject:ke,observable:ze}=Ce,it=ke.getValue();Y===mi.SCRIPT_STORY_TAKE&&(this.uploadingImportedVideos[it.id]=ze,this.storyTrackCommunicationService.setUploadingTakeTracks(this.uploadingImportedVideos)),this.uploadStateSubscriptions[Y].push(ze.subscribe(A[Y])),this.uploadStateService.clearProgressBar(it.id);});});},this.setStoryUpdate=()=>{this.storyTrackCommunicationService.setStory(this.story),this.teleprompterController.setStory(this.story);},this.setScriptTrackUpdate=()=>{this.storyTrackCommunicationService.setScriptTracks(this.scriptTrackList),this.teleprompterController.setScriptTracks(this.scriptTrackList);},this.setGoButtonLink=()=>{this.currentRoute==It.script&&this.takeTrackList.length>0?(this.goBackLink=["/"+ai,this.story.storyId,ft.takes],this.blockBackLink=!1):this.goBackLink=this.getBoardsLinkSegments();},this.getBoardsLinkSegments=()=>this.parentFolderId?["/boards",this.parentFolderId]:["/boards"],this.navigateToExit=()=>{if(this.contentPlannerScheduleItemId){this.router.navigate([Zl],{queryParams:{[bs]:this.contentPlannerScheduleItemId}});return;}this.router.navigate(this.getBoardsLinkSegments());},this.isValidTextLength=(x="")=>x.length<=dd,this.showHeadlineTooLongNotification=()=>{this.notifier.error(pd);},this.sendTeleprompterEvents=(x,A,Y)=>{this.eventsService.log(x,pe(pe({storyId:this.story.storyId,planName:this.userPlan.name,email:this.currentUser.email,name:this.currentUser.fullName,mode:A},x===this.EVENT_PATH_SCRIPT.teleprompterRecord?this.cpProjectAnalytics.attrs(this.cpAnalyticsSource()):{}),Y));},this.storyNotFoundDialog=(x=!1,A=this.story.storyId)=>{this.hasChanges=!1,this.eventsService.log(this.EVENT_PATH_SCRIPT.projectDeletedPopupOpen,{storyId:A});let Y={title:"This stroy is no longer available",msg:"It appears your project was deleted. Want to start a new project ",confirmationText:"Create New Project",cancellationText:"Cancel",confirmButtonVariant:"primary-royal",cancelButtonVariant:"half-filled-royal"};x&&(Y.msg="It looks like your project was deleted. You're now on a new project page.",Y.confirmationText="Continue",Y.cancellationText=void 0),this.dialogHelperService.showUiConfirmationDialog({title:Y.title,msg:Y.msg,confirmationText:Y.confirmationText,cancellationText:Y.cancellationText,confirmButtonVariant:Y.confirmButtonVariant,cancelButtonVariant:Y.cancelButtonVariant,onSubmit:()=>I(this,null,function*(){this.storyNotFoundEventClick("new-project",A),Y.cancellationText&&(this.currentRoute===It.
20script?(this.historyService.clear(),this.storyTrackCommunicationService.clearAll(),this.router.navigate([ai,ft.script]).then(()=>{window.location.reload();})):this.router.navigate([ai,ft.script])),this.dialogHelperService.close();}),onClose:()=>{this.dialogHelperService.close(),this.storyNotFoundEventClick("dismiss",A);}});},this.storyNotFoundEventClick=(x,A=this.story?.storyId)=>{this.eventsService.log(this.EVENT_PATH_SCRIPT.projectDeletedPopupClick,{storyId:A,button:x});},this.scriptScreenClickEvent=x=>{this.eventsService.log(this.EVENT_PATH_SCRIPT.scriptScreenClick,pe({storyId:this.story?.storyId,button:x},this.cpProjectAnalytics.scriptClickAttrs(this.cpAnalyticsSource())));},this.cpAnalyticsSource=()=>({story:this.story,slots:this.cpSlotsStore.slots()}),this.recordOptionsClick=x=>{switch(x){case Nt.LIVE:this.scriptScreenClickEvent(At.goLive);break;case Nt.RECORD:this.scriptScreenClickEvent(At.record);break;case Nt.SCROLL_ONLY:this.scriptScreenClickEvent(At.readOnly);break;}},this.autoCreateTitle=()=>I(this,null,function*(){try{return(yield this.serverlessApiService.post("ai/generate/text",{type:"title/create",description:this.scriptTrackList[0]?.contentData?.script||this.story.script}))?.[0]?.text||this.defaultHeadline;}catch(x){return console.error(x),this.defaultHeadline;}}),this.parentFolderId=this.router.getCurrentNavigation()?.extras?.state?.folderId||history.state?.folderId,this.contentPlannerScheduleItemId=this.router.getCurrentNavigation()?.extras?.state?.[bs]||history.state?.[bs],this.deepLinkVerb=Xl(this.route.snapshot.queryParamMap.get(Ql)),this.deepLinkMediaId=this.route.snapshot.queryParamMap.get(Kl),this.cpStoryDeepLink.arm(this.deepLinkVerb,()=>this.currentRoute),this.goBackLink=this.parentFolderId?["/boards",this.parentFolderId]:["/boards"],this.setCreationCallback(this.onStoryCreate),this.setUpdateCallback(()=>{this.onStoryUpdate();}),this.uploadStateSubscriptions={[mi.SCRIPT_STORY_TAKE]:[],[mi.SCRIPT_STORY_THUMBNAIL]:[]},this.uploadingImportedVideos={},this.uploadProgressEvent={},this.isInitialLoad=!0,this.teleprompterController=new ba(Ee,O,n,re,k,je,Ft,v,e,t,ye,N,Ve,o,wr,this.sendTeleprompterEvents,this.showUpsellDialog,this.uploadNewTake,this.notifyOnLocalTakeAdded,this.openTeleprompterStoryLogic);}ngOnInit(){return I(this,null,function*(){if(yield Er(i.prototype,this,"ngOnInit").call(this),yield this.initUserDetails(),yield this.initChildComponent(this.route.snapshot.params),this.story?.fromDefault&&this.story?.script?.length>0&&!this.isAnonymous&&this.currentUser?.fullName&&(this.story.script=this.story.script.replace("[MY NAME]",this.currentUser?.fullName)),this.setEventListeners(),this.maybeOpenDeepLinkedRecording(),this.maybeOpenDeepLinkedReview(),this.creditsService.getCreditsUsage().then(e=>{this.hasExtendedPortraitScript=this.creditsService.isFeatureEnabled(e,"portraitToVideoCameraAngles")||this.creditsService.isFeatureEnabled(e,"portraitToVideoExtended"),this.recomputeScriptLimits();}).catch(()=>{}),this.isInitialLoad&&this.getOngoingUploadingStates(),this.isAnonymous){let{take:e,file:n}=yield this.anonymousUserService.getUploadAssets();if(this.currentUser.anonymous){if(e&&n){yield this.anonymousUserService.removeUploadAssets(e.id);let t=this.takeTrackList.find(o=>o.localTake.isAnonymousTake);this.deleteTakeFromList(t);}}else!this.planHelperService.isFreePlan(this.userPlan.genericName)&&!this.currentUser.anonymous&&(e&&n&&this.uploadNewTake(e,n.file),yield this.anonymousUserService.clearAll(),this.anonymousUserService.broadcastNotAnonymous());}});}ngOnDestroy(){super.ngOnDestroy(),this.unsunscribe$&&(this.unsunscribe$.next(),this.unsunscribe$.complete()),this.teleprompterController?.destroy(),this.historyService?.clear(),this.updatedStorySubscription&&this.updatedStorySubscription.unsubscribe(),this.uploadStateService.moveToBackground();}maybeOpenDeepLinkedRecording(){this.deepLinkVerb!==Yl||this.currentRoute!==It.script||(this.deepLinkVerb=null,this.onOpenTeleprompterClick(Nt.RECORD,!1));}maybeOpenDeepLinkedReview(){if(this.deepLinkVerb!==Jl||this.currentRoute!==It.takes||!this.deepLinkMediaId)return;let e=this.deepLinkMediaId;this.deepLinkVerb=null,this.deepLinkMediaId=null,this.storyTrackCommunicationService.observeTakeTracks().pipe(Dc(n=>!!n?.length),Co(1),me(this.unsunscribe$)).subscribe(()=>this.storyTrackCommunicationService.setActivateTakeById(e));}shouldAutosaveScript(){if(this.isExist)return this.getHeadline()!=="";let e=(this.scriptTrackList[0]?.contentData?.script??"").trim();return e.length>0&&e!==".";}get visibleScriptLimits(){return this.exceededScriptLimits.filter(e=>e.feature===hn.portrait2Video&&!!this.selectedPortrait||e.feature===hn.audiogram&&this.shownSidebar===Je.AUDIOGRAM);}get scriptLimitBadgeText(){return"Script limit reached";}getComposerHeadlines(){let e=new Map();for(let n of this.story.videos??[])for(let t of n.composerStories??[])t.headline&&e.set(t.i
20d,t.headline);return e;}getTrackSortDate(e){return e.status===ct.local?e.localTake.created:e.video?.created??e.composerLastUpdate;}getComposerDraftTracks(){let e=[];for(let n of this.story.videos)for(let t of n.composerStories??[]){if(!t.isDraft)continue;let o=Od(t.type),h=new en(this.takeTrackList.length+e.length,ct.notLocal,!1,null,null,[{key:ti[Oe.videoMakerDraft],value:Oe.videoMakerDraft,tooltipName:Qt(Oe.videoMakerDraft)},...(o?[o]:[])],Et.none,t.headline);h.kind="composerDraft",h.composerStoryId=t.id,h.composerStoryType=t.type,h.composerLastUpdate=t.lastUpdate,h.composerThumbnailUrl=n.thumbnails?.[n.thumbnails.length-1]?.url,e.push(h);}return e;}logCpUploadStart(){let e=this.cpSlotForUpload(this.cpTakeFirstService.resolveTargetSlotId(this.story));e&&this.cpAnalytics.createSelectUploadStart(this.cpAnalytics.slotPayload({item:e}));}logCpTakeSelected(e){let n=this.cpSlotForUpload(this.cpTakeFirstService.resolveTargetSlotId(this.story));n&&this.cpAnalytics.createSelect(this.cpAnalytics.slotPayload({item:n}),e);}logCpImportDismissed(){let e=this.cpSlotForUpload(this.cpTakeFirstService.resolveTargetSlotId(this.story));e&&this.cpAnalytics.createImportDismiss(this.cpAnalytics.slotPayload({item:e}));}cpSlotForUpload(e){return e?this.cpSlotsStore.slots().find(n=>n.id===e):void 0;}setComposerHeadline(e,n){e.title=n;for(let t of this.story.videos??[]){let o=t.composerStories?.find(h=>h.id===e.composerStoryId);o&&(o.headline=n);}this.storyTrackCommunicationService.setTakeTracks(this.takeTrackList);}sendScriptEvent(e,n,t){let o=n||this.story,h=pe({headline:o.headline,storyId:o.storyId},t);o.script&&(h.scriptSize=o.script.split(/\s+/).length),this.eventsService.log(e,h);}createStateId(){return Math.floor(Math.random()*Date.now()).toString();}static{this.ɵfac=function(n){return new(n||i)(d(Ue),d(xt),d(zt),d(zi),d(ki),d(Kt),d($t),d(Io),d(bi),d(Zt),d(Qi),d(Mo),d(ko),d(zr),d(jn),d(ei),d(ts),d(Us),d(He),d(Pe),d(is),d(Il),d(hi),d(Qr),d(Rn),d(_s),d(Xr),d(Wl),d(Gl),d(hm),d(fs),d(Ge),d(yp),d(xi),d(wi),d(No),d(Ol),d(bl),d(Gi),d(Cs),d(Vt),d(Gs),d(xo));};}static{this.ɵcmp=G({type:i,selectors:[["script-story-home"]],viewQuery:function(n,t){if(n&1&&Ye(B_,5),n&2){let o;Ne(o=Fe())&&(t.thumbnailFileInput=o.first);}},standalone:!0,features:[Vi([He,vs,cc,...Ud]),Ae,q],decls:13,vars:25,consts:[["thumbnailFileInput",""],["undoButtonStyle","tertiary","redoButtonStyle","tertiary","saveButtonText","Save",1,"header-scripts",3,"backClick","undoClick","redoClick","projectTitleChange","saveClick","showBackButton","projectTitle","editableTitle","placeHolderText","showUndoButton","undoDisabled","showRedoButton","redoDisabled","showAIButton","showSaveButton","saveButtonDisabled","saveButtonLoading","metadata"],["slot","right",1,"header-right-actions"],["class","button-container script-limit-warning","matTooltipClass","tooltip-credits","matTooltipPosition","below",3,"matTooltip",4,"ngIf"],["size","md","variant","secondary",3,"iconContent","ariaLabel","clicked",4,"ngIf"],["size","md","variant","secondary",3,"clicked","iconContent","iconIndicator","loading"],[4,"ngIf"],[1,"child"],["type","file","aria-label","thumbnail upload",1,"hidden-element",3,"change","accept"],["class","media-sidebar-container",4,"ngIf"],["matTooltipClass","tooltip-credits","matTooltipPosition","below",1,"button-container","script-limit-warning",3,"matTooltip"],["color","warning","size","regular","shape","rounded",3,"text"],["size","md","variant","secondary",3,"clicked","iconContent","ariaLabel"],["size","md","variant","secondary",3,"iconContent","clicked",4,"ngIf"],["class","header-divider",4,"ngIf"],["size","md","variant","secondary",3,"clicked","leftIconContent"],["size","md","variant","secondary",3,"clicked","iconContent"],[1,"header-divider"],[1,"media-sidebar-container"],[3,"openingSide","sidebars"]],template:function(n,t){if(n&1){let o=U();r(0,"lib-header-workspace",1),tt(1,"async"),tt(2,"async"),S("backClick",function(){return T(o),P(t.onBackBtnClick());})("undoClick",function(){return T(o),P(t.onUndo());})("redoClick",function(){return T(o),P(t.onRedo());})("projectTitleChange",function(k){return T(o),P(t.onHeadlineChange(k));})("saveClick",function(){return T(o),P(t.onHeaderButtonClick());}),r(3,"div",2),M(4,U_,2,2,"div",3)(5,H_,1,2,"lib-button-icon",4),r(6,"lib-button-icon",5),S("clicked",function(){return T(o),P(t.onContentPlannerClick());}),s(),M(7,W_,7,4,"ng-container",6),s()(),r(8,"div",7),b(9,"router-outlet"),s(),r(10,"input",8,0),S("change",function(k){return T(o),P(t.onThumbnailUpdate(k));}),s(),M(12,G_,2,2,"div",9);}n&2&&(c("showBackButton",!t.blockBackLink)("projectTitle",t.headline)("editableTitle",!t.isViewer)("placeHolderText","Enter project title")("showUndoButton",!t.isViewer)("undoDisabled",!wt(1,21,t.undoable$))("showRedoButton",!t.isViewer)("redoDisabled",!wt(2,23,t.redoable$))("showAIButton",!1)("showSaveButton",t.currentRoute===t.ScriptScreen)("saveButtonDisabled",(t.headline==null?null:t.headline.length)===0||!t.hasChanges||t.isViewer)("saveButtonLoading",!!(t.savingInfo!=null&&t.savingInfo.isSaving))("metadata",t.headerMetadata),a(4),c("ngIf",t.currentRoute===t.ScriptScreen&&t.visibleScriptLimits.length>0),a(),c("ngIf",t.currentRoute===t.ScriptScreen&&!t.isViewer),a(),c("iconContent",t.contentPlannerIcon)("iconIndicator",t.isLinkedToPlan?t.plannerLinkIcon:void 0)("loading",t.plannerLookupBusy),a(),c("ngIf",t.currentRoute===t.TakesScreen),a(3),c("accept",t.allowedThumbnailFileTypes),a(2),c("ngIf",!t.isViewer&&(t.sidebars==null?null:t.sidebars.length)>0));},dependencies:[ul,Fi,Vn,Ur,_e,el,xp,Yr,Hi,Xt],styles:["[_nghost-%COMP%]{display:block}.header-scripts[_ngcontent-%COMP%]{border-bottom:1px solid #e1e7f0} .header-scripts .input-wrapper{width:580px!important}.teleprompter-action-buttons-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;align-items:center;z-index:1;width:fit-content!important;position:absolute;top:108px;right:40px}@media only screen and (max-width: 1440px){.live-button[_ngcontent-%COMP%]{margin:unset;margin-bottom:10px}.teleprompter-action-buttons-container[_ngcontent-%COMP%]{width:50%}.teleprompter-action-button[_ngcontent-%COMP%]{margin:0 10px 5px 0;width:130px}}.record-icon[_ngcontent-%COMP%]{background-image:url(/img/tp-rec
20ord-icon.svg);margin-top:5px}.read-icon[_ngcontent-%COMP%]{background-image:url(/img/tp-read-icon.svg)}.live-icon[_ngcontent-%COMP%]{background-image:url(/img/tp-live-icon.svg);margin-top:5px}.teleprompter-action-button.record-button[_ngcontent-%COMP%]{background:linear-gradient(216.6deg,#fb84ff 5.53%,#ff4d5b 94.56% 94.56%)}.teleprompter-action-button.read-button[_ngcontent-%COMP%]{background:linear-gradient(90deg,#00ea3b,#00d096)}.teleprompter-action-button.live-button[_ngcontent-%COMP%]{background:linear-gradient(270deg,#28b3f7 .65%,#506aff 99.35%)}.teleprompter-action-button[_ngcontent-%COMP%]{width:164px;height:42px;box-shadow:0 4.6px 9.2px #00000040;border-radius:10px;margin-right:20px}.teleprompter-action-button[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.teleprompter-action-button[_ngcontent-%COMP%] .button-icon[_ngcontent-%COMP%]{background-repeat:no-repeat;background-position:center;background-size:contain;width:24px;height:24px;margin-right:5px}.teleprompter-action-button[_ngcontent-%COMP%] .button-text[_ngcontent-%COMP%]{font-size:12px;font-family:Inter-Bold;color:#fff}.tips-wrapper[_ngcontent-%COMP%], .tips-wrapper-invite[_ngcontent-%COMP%]{margin-top:20px;margin-right:20px}.buttons-container[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;gap:16px;margin-right:24px}.button-container[_ngcontent-%COMP%]{min-width:90px;width:max-content;height:36px;padding:11px 23px;border-radius:10px;background-color:#ffffff14;display:flex;justify-content:center;align-items:center;font-weight:800;font-size:14px;line-height:17px;font-family:Inter-Bold;gap:4px}.t-buttons-container[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;gap:16px;margin-right:24px}.header-right-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px}.header-divider[_ngcontent-%COMP%]{width:1px;height:15px;background:#c7d9fe}.t-button-container[_ngcontent-%COMP%]{min-width:90px;width:max-content;height:36px;padding:11px 16px;border-radius:10px;background-color:#fff;display:flex;justify-content:center;align-items:center;gap:4px;cursor:pointer}.t-button-container[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-family:Inter-Bold;color:#253658!important;font-weight:800;font-size:14px;line-height:17px}.t-button-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:24px;height:24px}.child[_ngcontent-%COMP%]{width:100%;height:100%}.hidden-element[_ngcontent-%COMP%]{display:none}.script-home-sidebar-container[_ngcontent-%COMP%]{margin-right:8px} .media-sidebar-container aside#video-assets-uploads{left:-660px!important;background:transparent!important;padding:2px;z-index:31} .script-home-sidebar-container .sectionable-sidebar-component .section-container .options-container{margin-top:unset;display:flex;justify-content:space-evenly;align-items:center;flex-wrap:nowrap} .script-home-sidebar-container .sectionable-sidebar-component .section-container{padding:0;border-radius:20px;background:#25365814;margin-bottom:unset!important;transform:rotate(-15deg)} .script-home-sidebar-container .sectionable-sidebar-component .section-container .options-container .sidebar-option-container .section-sidebar-option{width:48px;height:48px;margin:unset;gap:4px;transform:rotate(15deg)} .script-home-sidebar-container .sectionable-sidebar-component .section-container .options-container .sidebar-option-container .section-sidebar-option .sidebar-option-title{display:none} .script-home-sidebar-container .sectionable-sidebar-component .section-container .options-container .sidebar-option-container .section-sidebar-option .selected-option-background{width:24px}@media only screen and (max-width: 768px){ .header-scripts .shared-header-left, .header-scripts .input-wrapper{width:100%!important}.tips-wrapper-invite[_ngcontent-%COMP%], .tips-wrapper[_ngcontent-%COMP%], .teleprompter-action-buttons-container[_ngcontent-%COMP%], .media-sidebar-container[_ngcontent-%COMP%], .mobile-screen-mode[_ngcontent-%COMP%], .header-scripts .history-buttons-container, .header-scripts .script-home-sidebar-container, .header-scripts .shared-header-right .button-container{display:none} .header-scripts .shared-header-wrapper{gap:12px}}"]});}}return i;})();ae();J();var q_=[{path:ft.home,component:lc,canDeactivate:[za],children:[{path:ft.script,component:Qa},{path:ft.takes,component:tc}]},{path:ft.homeWithId,component:lc,canDeactivate:[za],children:[{path:ft.script,component:Qa},{path:ft.takes,component:tc}]}],BA=(()=>
20{class i{static{this.ɵfac=function(n){return new(n||i)();};}static{this.ɵmod=jc({type:i});}static{this.ɵinj=Fc({providers:[Us,Qo],imports:[xe,tl.forChild(q_)]});}}return i;})();export{BA as ScriptStoryModule,q_ as routes};/**i18n:a22416d48d5d315853b2ff30dd429c3cf66bb88014970864ad6c2ff7ea890e29*/ 21//# debugId=800fe7bf-da76-5eed-91a7-48ea728e2e24
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.