"use strict";(self.webpackChunkcreator_web=self.webpackChunkcreator_web||[]).push([[410],{4410:(Gi,ai,m)=>{m.d(ai,{u:()=>Mi});var He=m(1626),ve=m(4412),si=m(3294),W=m(5558),U=m(8810),le=m(7673),ke=m(4668),ci=m(8750),q=m(6354),ce=m(8141),Ge=m(9437),_e=m(6661),di=m(7366),ui=m(7057),fi=m(3068),pi=m(2740),A=m(1806),w=m(4438);A.J1` query linkCustomAdOffers($input: LinkIdentifier!, $additional_data: CustomAdOfferProviderAdditionalData!) { linkCustomAdOffers(link: $input, additional_data: $additional_data) { title call_to_action description countdown completion_token provider provider_additional_payload { taboola { available_event_url visible_event_url } } media { type ... on UrlMediaResource { content_type resource_url } } clickout_action { type ... on CustomAdOfferClickoutUrlAction { type clickout_url } } } } `;const hi=A.J1` mutation completeCustomAdOffer($completion_token: String!, $traffic_validation_token: String!, $action_id: String, $request_id: String!) { completeCustomAdOffer( completion_token: $completion_token traffic_validation_token: $traffic_validation_token action_id: $action_id request_id: $request_id ) } `;let bi=(()=>{class i extends A.sM{constructor(e){super(e),this.document=hi}static#e=this.\u0275fac=function(t){return new(t||i)(w.KVO(A.Ic))};static#i=this.\u0275prov=w.jDH({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();const wi=A.J1` mutation getDetailPageContent($linkIdentificationInput: PublicLinkIdentificationInput!, $origin: String, $additional_data: CustomAdOfferProviderAdditionalData!) { getDetailPageContent( linkIdentificationInput: $linkIdentificationInput origin: $origin additional_data: $additional_data ) { access_token payload_bag { taboola { session_id } } premium_subscription_active link { id video_url short_link_title recently_edited short_link_title description url target_type seo_faqs { body title } target_host last_edit_at link_images { url } title thumbnail_url view_count is_trending recently_edited seo_faqs { title body } percentage_rating is_premium_only_link publisher { id name subscriber_count } positive_rating negative_rating already_rated_by_user user_rating } linkCustomAdOffers { title call_to_action description countdown completion_token provider provider_additional_payload { taboola { available_event_url visible_event_url } } media { type ... on UrlMediaResource { content_type resource_url } } clickout_action { type ... on CustomAdOfferClickoutUrlAction { type clickout_url } } } link_recommendations { short_link_title target_host target_type id url publisher { id name } last_edit_at link_images { url } title thumbnail_url view_count is_trending recently_edited percentage_rating publisher { name } } target_access_information { remaining_waiting_time } } } `;let gi=(()=>{class i extends A.sM{constructor(e){super(e),this.document=wi}static#e=this.\u0275fac=function(t){return new(t||i)(w.KVO(A.Ic))};static#i=this.\u0275prov=w.jDH({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();const mi=A.J1` mutation completeDetailPageContent($linkIdentificationInput: PublicLinkIdentificationInput!, $completeDetailPageContentInput: CompleteDetailPageContentInput!) { completeDetailPageContent( linkIdentificationInput: $linkIdentificationInput completeDetailPageContentInput: $completeDetailPageContentInput ) { CUSTOM_AD_STEP TARGET additional_target_access_information { remaining_waiting_time can_not_access should_show_ads has_long_paywall_duration } } } `;let vi=(()=>{class i extends A.sM{constructor(e){super(e),this.document=mi}static#e=this.\u0275fac=function(t){return new(t||i)(w.KVO(A.Ic))};static#i=this.\u0275prov=w.jDH({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();const ki=A.J1` mutation getDetailPageTarget($linkIdentificationInput: PublicLinkIdentificationInput!, $token: String!, $action_id: String) { getDetailPageTarget( linkIdentificationInput: $linkIdentificationInput token: $token action_id: $action_id ) { type url paste short_link_title } } `;let _i=(()=>{class i extends A.sM{constructor(e){super(e),this.document=ki}static#e=this.\u0275fac=function(t){return new(t||i)(w.KVO(A.Ic))};static#i=this.\u0275prov=w.jDH({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var i,N="",de="function",$="undefined",F="object",Ae="string",X="major",a="model",n="name",r="type",s="vendor",o="version",k="architecture",K="console",f="mobile",b="tablet",v="smarttv",J="wearable",Ie="embedded",Y="inapp",Ne="user-agent",Ce="brands",H="formFactors",Oe="fullVersionList",B="platform",Se="platformVersion",ue="bitness",L="sec-ch-ua",yi=L+"-full-version-list",Ii=L+"-arch",Ti=L+"-"+ue,Ci=L+"-form-factors",Oi=L+"-"+f,Si=L+"-"+a,Fe=L+"-"+B,Ei=Fe+"-version",Ke=[Ce,Oe,f,a,B,Se,k,H,ue],y="browser",O="cpu",T="device",S="engine",I="os",z="result",fe="Amazon",Z="Apple",ze="BlackBerry",G="Google",pe="Microsoft",We="Motorola",ee="Samsung",he="Sony",Pe="Xiaomi",xe="Zebra",Q="Mobile ",ie=" Browser",D="Chromecast",te="Firefox",re="Opera",Je="Facebook",$e="Windows",_=typeof window!==$&&window.navigator?window.navigator:void 0,R=_&&_.userAgentData?_.userAgentData:void 0,be=function(i){for(var c={},e=0;e0){for(var e in i)if(E(i[e])==E(c))return!0;return!1}return!!j(i)&&-1!==E(c).indexOf(E(i))},we=function(i,c){for(var e in i)return/^(browser|cpu|device|engine|os)$/.test(e)||!!c&&we(i[e])},j=function(i){return typeof i===Ae},De=function(i){if(i){for(var c=[],e=V(/\\?\"/g,i).split(","),t=0;t-1){var l=oe(e[t]).split(";v=");c[t]={brand:l[0],version:l[1]}}else c[t]=oe(e[t]);return c}},E=function(i){return j(i)?i.toLowerCase():i},Re=function(i){return j(i)?V(/[^\d\.]/g,i).split(".")[0]:void 0},P=function(i){for(var c in i){var e=i[c];typeof e==F&&2==e.length?this[e[0]]=e[1]:this[e]=void 0}return this},V=function(i,c){return j(c)?c.replace(i,N):c},ne=function(i){return V(/\\?\"/g,i)},oe=function(i,c){if(j(i))return i=V(/^\s\s*/,i),typeof c===$?i:i.substring(0,500)},Ze=function(i,c){if(i&&c)for(var t,l,u,d,h,p,e=0;e0?2===d.length?this[d[0]]=typeof d[1]==de?d[1].call(this,p):d[1]:3===d.length?this[d[0]]=typeof d[1]!==de||d[1].exec&&d[1].test?p?p.replace(d[1],d[2]):void 0:p?d[1].call(this,p,d[2]):void 0:4===d.length&&(this[d[0]]=p?d[3].call(this,p.replace(d[1],d[2])):void 0):this[d]=p||void 0;e+=2}},ae=function(i,c){for(var e in c)if(typeof c[e]===F&&c[e].length>0){for(var t=0;t2&&this.set(a,"iPad").set(r,b);break;case I:!this.get(n)&&R&&R[B]&&this.set(n,R[B]);break;case z:var l=this.data,u=function(d){return l[d].getItem().detectFeature().get()};this.set(y,u(y)).set(O,u(O)).set(T,u(T)).set(S,u(S)).set(I,u(I))}return this},this.parseUA=function(){return this.itemType!=z&&Ze.call(this.data,this.ua,this.rgxMap),this.itemType==y&&this.set(X,Re(this.get(o))),this},this.parseCH=function(){var l=this.uaCH,u=this.rgxMap;switch(this.itemType){case y:var h,d=l[Oe]||l[Ce];if(d)for(var p in d){var g=V(/(Google|Microsoft) /,d[p].brand||d[p]),C=d[p].version;!/not.a.brand/i.test(g)&&(!h||/chrom/i.test(h)&&!/chromi/i.test(g))&&(this.set(n,g).set(o,C).set(X,Re(C)),h=g)}break;case O:var M=l[k];M&&(M&&"64"==l[ue]&&(M+="64"),Ze.call(this.data,M+";",u));break;case T:if(l[f]&&this.set(r,f),l[a]&&this.set(a,l[a]),"Xbox"==l[a]&&this.set(r,K).set(s,pe),l[H]){var me;if("string"!=typeof l[H])for(var oi=0;!me&&oi=13?"11":"10"),this.set(n,Me).set(o,Ue)}this.get(n)==$e&&"Xbox"==l[a]&&this.set(n,"Xbox").set(o,void 0);break;case z:var Ui=this.data,se=function(Hi){return Ui[Hi].getItem().setCH(l).parseCH().get()};this.set(y,se(y)).set(O,se(O)).set(T,se(T)).set(S,se(S)).set(I,se(I))}return this},P.call(this,[["itemType",i],["ua",c],["uaCH",t],["rgxMap",e],["data",Di(this,i)]]),this}function x(i,c,e){if(typeof i===F?(we(i,!0)?(typeof c===F&&(e=c),c=i):(e=i,c=void 0),i=void 0):typeof i===Ae&&!we(c,!0)&&(e=c,c=void 0),e&&typeof e.append===de){var t={};e.forEach(function(p,g){t[g]=p}),e=t}if(!(this instanceof x))return new x(i,c,e).getResult();var l=typeof i===Ae?i:e&&e[Ne]?e[Ne]:_&&_.userAgent?_.userAgent:N,u=new ri(e,!0),d=c?function(i,c){var e={},t=c;if(!we(c))for(var l in t={},c)for(var u in c[l])t[u]=c[l][u].concat(t[u]?t[u]:[]);for(var d in i)e[d]=t[d]&&t[d].length%2==0?t[d].concat(i[d]):i[d];return e}(ti,c):ti,h=function(p){return p==z?function(){return new ni(p,l,d,u).set("ua",l).set(y,this.getBrowser()).set(O,this.getCPU()).set(T,this.getDevice()).set(S,this.getEngine()).set(I,this.getOS()).get()}:function(){return new ni(p,l,d[p],u).parseUA().get()}};return P.call(this,[["getBrowser",h(y)],["getCPU",h(O)],["getDevice",h(T)],["getEngine",h(S)],["getOS",h(I)],["getResult",h(z)],["getUA",function(){return l}],["setUA",function(p){return j(p)&&(l=p.length>500?oe(p,500):p),this}]]).setUA(l),this}x.VERSION="2.0.0",x.BROWSER=be([n,o,X,r]),x.CPU=be([k]),x.DEVICE=be([a,s,r,K,f,v,b,J,Ie]),x.ENGINE=x.OS=be([n,o]);let Ri=(()=>{class i{constructor(e){this.http=e,this.taboolaUserId$=this.createTaboolaUserId$(),this.LOCAL_STORAGE_KEY="taboola-session-id"}getTaboolaUserId(){return this.taboolaUserId$}getSessionId(){const e=this.getFromLocalStorageWithTimestamp(),t=(new Date).getTime(),l=e?.created_at?.getTime(),u=Math.abs(t-l)/6e4;return!u||u>30?null:e.value}saveSessionIdWithLifetime(e){e?this.writeToLocalStorageWithCurrentTimestamp(e):console.error("updateTaboolaSessionId: Missing sessionId parameter")}writeToLocalStorageWithCurrentTimestamp(e){if(!e)return;const t=JSON.stringify({value:e,created_at:new Date});localStorage.setItem(this.LOCAL_STORAGE_KEY,t)}getFromLocalStorageWithTimestamp(){const e=localStorage.getItem(this.LOCAL_STORAGE_KEY),t=JSON.parse(e);return{value:t?.value,created_at:new Date(t?.created_at)}}postTaboolaAvailable(e){return e?.available_event_url?this.http.get(e.available_event_url):(0,U.$)(()=>new Error("API-taboola: POST: missing additionalPayload"))}postTaboolaVisible(e){return e?.visible_event_url?this.http.get(e.visible_event_url):(0,U.$)(()=>new Error("API-taboola: POST: missing additionalPayload"))}getTaboolaCookieResponse(){let e;return window.__tcfapi&&window.__tcfapi("getTCData",2,t=>{e=t.tcString}),e}getDeviceType(){const e=new x,{type:t}=e.getDevice();return"mobile"===t||"tablet"===t?"mobile":"desktop"}createTaboolaUserId$(){const t=this.getDeviceType(),l=this.getTaboolaApiKeyDependingOnDeviceType(t);return this.http.get(`https://api.taboola.com/2.0/json/linkvertise-linkvertiseapikey/user.sync?app.type=${t}&app.apikey=${l}`).pipe((0,q.T)(d=>d.user.id),(0,Ge.W)(()=>(0,le.of)("fallbackUserId")),(0,ke.t)())}getTaboolaApiKeyDependingOnDeviceType(e){return"mobile"===e?"038d3e7da839787753d209627988d813fc1b1d2e":"5f560f57763908a1256447e08a287e0aaa466fb6"}static#e=this.\u0275fac=function(t){return new(t||i)(w.KVO(He.Qq))};static#i=this.\u0275prov=w.jDH({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})(),Mi=(()=>{class i{constructor(e,t,l,u,d,h,p,g,C){this.getDetailPageContentGQL=e,this.getDetailPageTargetGQL=t,this.completeDetailPageContentGQL=l,this.completeCustomAdOfferGQL=u,this.apiTaboolaService=d,this.thumbnailService=h,this.auth=p,this.trackingService=g,this.validationService=C,this.currentParameter$$=new ve.t(void 0),this.variant$=new ve.t("old"),this.trigger$$=new ve.t(!1),this.newVariantKey="AdStepVariant25-03-25",this.oldVariantKey="AdStepVariant",this.production=_e.c.production,this.bypassCheqRTIv2secret=_e.c.bypassCheqRTIv2secret,this.bypassContentAccessLimitsecret=_e.c.bypassContentAccessLimitsecret}getVariant(){return this.variant$}setVariant(e){localStorage.removeItem(this.oldVariantKey);let t="old";const l=localStorage.getItem(this.newVariantKey);l&&(t=l),localStorage.setItem(this.newVariantKey,t),this.variant$.next(t)}setCurrentLinkIdentifierAndOrigin(e,t,l){this.currentParameter$$.next({identifier:this.getLinkIdentificationInput(e,t,l),origin:t.o,accessToken:this.currentParameter$$.value?.accessToken,postAccessToken:this.currentParameter$$.value?.postAccessToken,taboolaUserId:this.currentParameter$$.value?.taboolaUserId})}getCurrentParameter(){return this.currentParameter$$.asObservable().pipe(function li(i,c){return(0,si.F)((e,t)=>c?c(e[i],t[i]):e[i]===t[i])}("identifier"))}createPageData$(){return this.apiTaboolaService.getTaboolaUserId().pipe((0,W.n)(e=>(this.currentParameter$$.next({taboolaUserId:e,accessToken:this.currentParameter$$.value.accessToken,identifier:this.currentParameter$$.value.identifier,origin:this.currentParameter$$.value.origin,postAccessToken:this.currentParameter$$.value.postAccessToken}),this.getCurrentParameter())),(0,W.n)(e=>{const t=this.apiTaboolaService.getTaboolaCookieResponse(),l=this.apiTaboolaService.getSessionId(),u=this.getVariant().value;return e.identifier?this.getDetailPageContentGQL.mutate({linkIdentificationInput:e.identifier,origin:e.origin,additional_data:this.prepareAdditionalData(e.taboolaUserId,t,document.referrer,l,u)},{context:this.handleAdditionalHeaderForNonProduction()}):(0,U.$)(()=>new Error("API-detail-page: createPageData: Missing parameter"))}),(0,q.T)(e=>{const t=e.data.getDetailPageContent;return this.currentParameter$$.next({accessToken:t.access_token,identifier:this.currentParameter$$.value.identifier,origin:this.currentParameter$$.value.origin,postAccessToken:this.currentParameter$$.value.postAccessToken,taboolaUserId:this.currentParameter$$.value.taboolaUserId}),t}),(0,ce.M)(e=>{e.link_recommendations.forEach(t=>{this.thumbnailService.handleThumbnailUrlFallbackGeneration(t)})}),(0,W.n)(e=>e.link.link_images.length>0||e.link.video_url?(0,le.of)(e):(0,ci.Sx)(this.thumbnailService.getThumbnail(e.link.target_host,e.link.target_type)).pipe((0,q.T)(t=>(e.link.link_images.push({id:"0",url:t}),e)))),(0,ce.M)(e=>{this.apiTaboolaService.saveSessionIdWithLifetime(e.payload_bag.taboola?.session_id)}))}createPagePostAccess$(){return this.getCurrentParameter().pipe((0,W.n)(e=>e.identifier&&e.accessToken?this.completeDetailPageContentGQL.mutate({linkIdentificationInput:e.identifier,completeDetailPageContentInput:{access_token:e.accessToken}},{context:this.handleAdditionalHeaderForNonProduction()}):(0,U.$)(()=>new Error("API-detail-page: createPostAccess: Missing parameter"))),(0,q.T)(e=>{const t=e.data.completeDetailPageContent;return this.customAdStepToken=t.CUSTOM_AD_STEP,this.currentParameter$$.next({postAccessToken:t.TARGET,identifier:this.currentParameter$$.value.identifier,origin:this.currentParameter$$.value.origin,accessToken:this.currentParameter$$.value.accessToken,taboolaUserId:this.currentParameter$$.value.taboolaUserId}),t}),(0,ke.t)())}createPageTarget$(){const e=this.actionIdGenerator();return this.getCurrentParameter().pipe((0,W.n)(t=>t.identifier&&t.postAccessToken?this.getDetailPageTargetGQL.mutate({linkIdentificationInput:t.identifier,token:t.postAccessToken,action_id:e},{context:this.handleAdditionalHeaderForNonProduction()}).pipe((0,Ge.W)(l=>(JSON.stringify(l).includes("early_target_access_fraud")&&(window.location.href="https://invalid.linkvertise.com"),(0,le.of)(null))),(0,ce.M)(l=>{l&&this.trackingService.trackTargetOpened(this.auth.check(),this.getVariant().value,e)})):(0,U.$)(()=>new Error("API-detail-page: createTarget: Missing parameter"))),(0,q.T)(t=>t.data.getDetailPageTarget),(0,ke.t)())}postTaboolaAvailable(e){return this.apiTaboolaService.postTaboolaAvailable(e)}postTaboolaVisible(e){return this.apiTaboolaService.postTaboolaVisible(e)}postAdCardCompletion(e,t){if(!e)return(0,U.$)(()=>new Error("API-detail-page: AdCard: Missing adToken"));if(!this.currentParameter$$.value.postAccessToken)return(0,U.$)(()=>new Error("API-detail-page: AdCard: Missing postAccesstoken"));const l=this.customAdStepToken,u=this.actionIdGenerator(),d={completion_token:e,traffic_validation_token:l,action_id:u,request_id:this.validationService.cheqRequestId()};return this.completeCustomAdOfferGQL.mutate(d).pipe((0,ce.M)(()=>{this.trackingService.trackAdClick(t,u)}))}handleAdditionalHeaderForNonProduction(){let e=new He.Lr;return this.production||(e=e.set("bypassrtiv2",this.bypassCheqRTIv2secret),e=e.set("X-LV-Content-Access-Bypass-Secret",this.bypassContentAccessLimitsecret)),{headers:e}}prepareAdditionalData(e,t,l,u,d){return{taboola:{external_referrer:l,user_id:e,consent_string:t,url:window.location.href,test_group:d??void 0,session_id:u}}}getLinkIdentificationInput(e,t,l){let u;return"userIdAndUrl"===l?u={userIdAndUrl:{user_id:e.userId,url:e.url}}:"userIdAndHash"===l?(u={userIdAndHash:{user_id:e.userId,hash:t.r,originates_from_adfly:"adfly"===t.link_origin}},t.v&&(u.userIdAndHash.version=t.v)):"id"===l?u={id:{id:e.linkId}}:console.error("linkIdentificationType does not Match"),u}actionIdGenerator(){let e="",t=0;for(;t<3;)e+=self.crypto.randomUUID(),t+=1;return e.slice(0,100)}static#e=this.\u0275fac=function(t){return new(t||i)(w.KVO(gi),w.KVO(_i),w.KVO(vi),w.KVO(bi),w.KVO(Ri),w.KVO(ui.e),w.KVO(di.u),w.KVO(fi.b),w.KVO(pi.B))};static#i=this.\u0275prov=w.jDH({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})()}}]);