1import{c as e,s as t}from"./BD_IACc3.js";import{t as n}from"./CUahCeih.js";import{t as r}from"./BeKEINCS.js";import{i,n as a}from"./CZlIYBPH.js";import{t as o}from"./CzJDEc-k.js";import{n as s}from"./LEvys-hS.js";import{t as c}from"./C3jJRkDX.js";import{t as l}from"./B7ehTkVD.js";import{n as u,t as d}from"./VDNGn_c4.js";import{n as f}from"./DgKUnDF0.js";import{t as p}from"./x70dC72q.js";import"./DtAcB3ym.js";function m(e){let t=[];return e.forEach(n=>{t.push(n),n.children&&t.push(...n.children),e=t.filter((e,n)=>t.findIndex(t=>t.id===e.id)===n)}),t}function h(e,t){let n=0,r=0;return t&&(n=e.getBoundingClientRect().top-t.getBoundingClientRect().top,r=e.getBoundingClientRect().left-(t.getBoundingClientRect().left+(t.getBoundingClientRect().width-e.getBoundingClientRect().width)/2)),{"--top":-n+`px`,"--left":-r+`px`}}function g(){let e=r(`regionsListFlat`,()=>[]),i=r(`topicsListFlat`,()=>[]),a=r(`userArticleBookmarks`,()=>[]),s=r(`userHasArticleBookmarks`,()=>!1),l=r(`userArticleBookmarksCount`,()=>0),d=r(`userHasTagBookmarks`,()=>!1),f=t(),h=P(),g=o(),{userApiBaseUrl:_}=c(),v=!_||_===`none`?null:_,y=t=>e.value.some(e=>e.id===t),b=t=>e.value.find(e=>e.id===t),x=e=>i.value.some(t=>t.id===e),S=e=>i.value.find(t=>t.id===e),C=()=>l.value++,w=()=>l.value--,T=async()=>{if(v&&h.userData?.ssoId)try{let e=`/mandators/${g.mandator}/users/${h.userData.ssoId}/bookmarks`,t=(await n(e,{responseType:`json`,method:`GET`,baseURL:v})).slice().sort((e,t)=>new Date(t.ts)-new Date(e.ts));a.value=t.map(e=>e.articleId)}catch(e){throw console.error(`Error while fetch user bookmarks`,e),Error(`Error while fetch user bookmarks`)}},E=async e=>{if(v&&h.userData?.ssoId)try{let t=`/mandators/${g.mandator}/users/${h.userData.ssoId}/bookmarks/${e}`;await n(t,{responseType:`json`,method:`POST`,baseURL:v}),C(),s.value=!0}catch(e){throw console.error(`Error while adding user article bookmark`,e),Error(`Error while adding user article bookmark`)}},D=async e=>{if(v&&h.userData?.ssoId)try{let t=`/mandators/${g.mandator}/users/${h.userData.ssoId}/bookmarks/${e}`;await n(t,{responseType:`json`,method:`DELETE`,baseURL:v}),w(),await k()}catch(e){throw console.error(`Error while removing user article bookmark`,e),Error(`Error while removing user article bookmark`)}},O=async()=>{if(v&&h.userData?.ssoId)try{let e=`/mandators/${g.mandator}/users/${h.userData.ssoId}/bookmarks-count`,t=await n(e,{responseType:`json`,baseURL:v});l.value=t}catch(e){throw console.error(`Error while checking how many bookmarks user has`,e),Error(`Error while checking how many bookmarks user has`)}},k=async()=>{if(v&&h.userData?.ssoId)try{let e=`/mandators/${g.mandator}/users/${h.userData.ssoId}/has-bookmarks`;s.value=await n(e,{responseType:`json`,baseURL:v})}catch(e){console.error(`Error while checking if user has any article bookmarks`,e)}},A=async e=>{if(v){if(h.userData?.ssoId)try{return await n(`/mandators/${g.mandator}/users/${h.userData.ssoId}/is-bookmarked/${e}`,{responseType:`json`,baseURL:v})}catch(e){return console.error(`Error while checking if article is bookmarked`,e),null}return null}},j=async()=>{if(v){if(h.userData?.ssoId){if(!e.value.length)try{let{data:t}=await f.runWithContext(()=>p(`personal-feeds/regions`));t.value&&(e.value=m(t.value))}catch(e){throw console.error(`Error while fetching regions list`,e),e}try{return await n(`/mandators/${g.mandator}/users/${h.userData.ssoId}/region-bookmarks`,{responseType:`json`,baseURL:v})}catch(e){throw console.error(`Error while fetching user region bookmarks`,e),e}}return null}},M=async e=>{if(v&&h.userData?.ssoId)try{await n(`/mandators/${g.mandator}/users/${h.userData.ssoId}/region-bookmarks/${e}`,{responseType:`json`,method:`POST`,baseURL:v}),d.value=!0}catch(e){throw console.error(`Error while adding user region bookmark`,e),Error(`Error while adding user region bookmark`)}},N=async e=>{if(v&&h.userData?.ssoId)try{await n(`/mandators/${g.mandator}/users/${h.userData.ssoId}/region-bookmarks/${e}`,{responseType:`json`,method:`DELETE`,baseURL:v}),await G()}catch(e){throw console.error(`Error while removing user region bookmark`,e),Error(`Error while removing user region bookmark`)}},F=async()=>
1{if(v){if(h.userData?.ssoId)try{return await n(`/mandators/${g.mandator}/users/${h.userData.ssoId}/has-region-bookmarks`,{responseType:`json`,baseURL:v})}catch{return!1}return null}},I=async e=>{if(v){if(h.userData?.ssoId)try{return await n(`/mandators/${g.mandator}/users/${h.userData.ssoId}/region-bookmarks/is-bookmarked/${e}`,{responseType:`json`,baseURL:v})}catch(e){return console.error(`Error while checking if region is bookmarked`,e),null}return null}},L=async()=>{if(v){if(h.userData?.ssoId){if(!i.value.length)try{let{data:e}=await f.runWithContext(()=>p(`personal-feeds/topics`));e.value&&(i.value=m(e.value))}catch(e){throw console.error(`Error while fetching topics list`,e),Error(`Error while fetching topics list`)}try{return await n(`/mandators/${g.mandator}/users/${h.userData.ssoId}/tag-bookmarks`,{responseType:`json`,baseURL:v})}catch(e){throw console.error(`Error while fetching user topic bookmarks`,e),Error(`Error while fetching user topic bookmarks`)}}return null}},R=async e=>{if(v&&h.userData?.ssoId)try{await n(`/mandators/${g.mandator}/users/${h.userData.ssoId}/tag-bookmarks/${e}`,{responseType:`json`,method:`POST`,baseURL:v}),d.value=!0}catch(e){throw console.error(`Error while adding user tag bookmark`,e),Error(`Error while adding user tag bookmark`)}},z=async e=>{if(v&&h.userData?.ssoId)try{await n(`/mandators/${g.mandator}/users/${h.userData.ssoId}/tag-bookmarks/${e}`,{responseType:`json`,method:`DELETE`,baseURL:v}),await G()}catch(e){throw console.error(`Error while removing user tag bookmark`,e),Error(`Error while removing user tag bookmark`)}},B=async()=>{if(v){if(h.userData?.ssoId)try{return await n(`/mandators/${g.mandator}/users/${h.userData.ssoId}/has-tag-bookmarks`,{responseType:`json`,baseURL:v})}catch{return!1}return null}},V=async e=>{if(v){if(h.userData?.ssoId)try{return await n(`/mandators/${g.mandator}/users/${h.userData.ssoId}/tag-bookmarks/is-bookmarked/${e}`,{responseType:`json`,baseURL:v})}catch(e){return console.error(`Error while checking if topic is bookmarked`,e),null}return null}},H=async()=>{if(h.userData?.ssoId)try{let[e,t]=await Promise.all([j(),L()]);if(t?.sort((e,t)=>x(e.id)?x(t.id)?0:-1:1),e&&t){let n=e.concat(t);return(await Promise.all(n.map(async e=>{if(y(e.id)||x(e.id))return e.label=b(e.id)?.label||S(e.id)?.label,e.target=b(e.id)?.target||S(e.id)?.target,e;try{let{data:t}=await f.runWithContext(()=>p(`tags/${e.id}`));return t.value?(e.label=t.value?.displayName,e.target=t.value?.fullPath,e):null}catch{return null}}))).filter(Boolean)}}catch(e){console.error(`Error while fetching user feed bookmarks`,e)}return null},U=async e=>y(e)?M(e):R(e),W=async e=>y(e)?N(e):z(e),G=async()=>{try{let e=await Promise.all([F().catch(()=>!1),B().catch(()=>!1)]);d.value=e.includes(!0)}catch(e){console.error(`Error while checking if user has tag bookmarks`,e),d.value=!1}};return{topicsListFlat:i,regionsListFlat:e,userArticleBookmarks:a,userHasArticleBookmarks:s,userArticleBookmarksCount:l,userHasTagBookmarks:d,isTopic:x,isRegion:y,fetchUserArticleBookmark:T,afterLoginBookmarksCallback:async()=>{try{let e=await f.runWithContext(()=>u(`bookmarkedArticleId`)),t=e.value;typeof t==`number`&&Number.isSafeInteger(t)&&t>0&&await E(t),e.value=null,await O(),await k(),await G()}catch(e){console.error(e)}},afterLogoutBookmarksCallback:async()=>{s.value=!1,l.value=0,a.value=[],d.value=!1},addUserArticleBookmark:E,removeUserArticleBookmark:D,checkIfUserHasArticleBookmarks:k,increaseUserArticleBookmarksCount:C,decreaseUserArticleBookmarksCount:w,checkIfArticleIsBookmarked:A,getRegionById:b,fetchUserRegionBookmarks:j,fetchUserFeedBookmarks:H,addUserFeedBookmark:U,removeUserFeedBookmark:W,addUserRegionBookmark:M,removeUserRegionBookmark:N,checkIfUserHasTagBookmarks:G,checkIfTagIsBookmarked:async e=>await I(e)||await V(e),fetchBookmarkedTagsArticlesIds:async e=>{try{return await n(`/api/bookmarkedTagsArticles`,{method:`POST`,body:{bookmarkedTags:e}})}catch(e){return console.error(`Error while fetching bookmarked tags articles ids`,e),[]}},fetchUserTopicBookmarks:L}}var _=s(`plenigo`,{state:()=>({customer:null}),actions:{async loadPlenigoCustomer(){try{let e=await n(`/api/plenigo/session`);this.customer=e?.customer?e.customer:null}catch{console.error(`no plenigo customer found`),this.customer=null}}}}),v=()=>{let{public:{chost:t}}=e();return{addDomainToCookieOptions:e=>{let{host:n}=new URL(t),r=(n||t).split(`.`);return r.length>=4?r.splice(0,r.length-4||1):r.length===3&&r.splice(0,1),{...e,domain:t.includes(`run.app`)?null:`.`+r.join(`.`).replace(/:\d+/,``)}},addBaseDomainToCookieOptions:e=>{let n=new URL(t);return{...e,domain:`.`+n.hostname.split(`.`).slice(1).join(`.`)}}}},y=()=>
1(Date.now()*Math.random()*1e5).toString(36),b=()=>Math.floor(0x56bc75e2d63100000*Math.random()).toString(),x=function(e){return e.accessToken=`FA_ACCESS_TOKEN`,e.refreshToken=`FA_REFRESH_TOKEN`,e.refreshTokenId=`FA_REFRESH_TOKEN_ID`,e.idToken=`FA_ID_TOKEN`,e.changePasswordCode=`FA_CPC`,e.stateCookie=`DM_STATE_`,e.anon=`anon_cookie`,e.redirectAfterLogin=`FA_RAL`,e}({}),S=function(e){return e.visits=`recent_visits`,e.cacheKey=`cache_key`,e.resortVisits=`resort_visits`,e}({}),C=function(e){return e.PUR=`PUR_USER`,e.PLUS=`PLUS_USER`,e.EPAPER=`EPAPER_USER`,e.NEWSLETTER=`PAID-NEWSLETTER`,e.NOADS=`NOADS`,e}({}),w=function(e){return e.PLUS_TAG=`PLUS-TAG-`,e}({}),T={maxAge:2592e3},E={maxAge:1728e4},D={...T,httpOnly:!1,secure:!0,sameSite:`lax`},O={...T,httpOnly:!0,secure:!0,sameSite:`lax`},k={...T,httpOnly:!0,secure:!0,sameSite:`none`},A={...T},j={...T,httpOnly:!0,secure:!0,sameSite:`lax`};({...T}),{...T};var M={...T,sameSite:`lax`};function N(){let{addDomainToCookieOptions:e}=v();function t(t){let n=u(x.anon,e(M)),r=n.value||b();if(t&&(r=b()),n.value&&n.value==r){let t=new Date;t.setTime(t.getTime()+2592e6),document.cookie=i(x.anon,r,e({expires:t,sameSite:`lax`,path:`/`}))}else n.value=r}function n(t){let n=u(x.anon,e(M));n.value=t}function r(){t(!0)}return{handleAnonId:t,setSsoIdAsAnonId:n,resetAnonId:r}}var P=s(`user`,{state:()=>({userData:null,loginStatus:!1,fontSize:112.5,stateKey:``,gdprConsent:null,missedConsentFormFields:[],onboardingCompleted:!1,isLoginProgress:!1,isNewVerifiedRegistration:!1}),getters:{recentVisits:()=>d(S.visits)||0,idToken:()=>d(x.idToken),anonId:()=>d(x.anon),firstName:e=>e.userData?.firstName,lastName:e=>e.userData?.lastName,isLoggedIn:e=>e.loginStatus,hasVerifiedEmail:e=>e.loginStatus?e.userData?.emailVerified:!1,isPurUser:e=>e.loginStatus&&e.userData?.roles?.includes(C.PUR),isPlusUser:e=>e.loginStatus&&e.userData?.roles?.includes(C.PLUS),isNoAdsUser:e=>e.loginStatus&&e.userData?.roles?.includes(C.NOADS),isNewsletterUser:e=>e.loginStatus&&e.userData?.roles?.includes(C.NEWSLETTER),isTagSubscriptionUser:e=>e.loginStatus&&e.userData?.roles?.some(e=>e.startsWith(w.PLUS_TAG)),isEpaperUser:e=>e.loginStatus&&e.userData?.roles?.includes(C.EPAPER),hasTagSubscriptionForAny:e=>t=>!t||t.length===0?!1:e.loginStatus&&e.userData?.roles.filter(e=>e.startsWith(w.PLUS_TAG)).map(e=>e.substring(w.PLUS_TAG.length)).some(e=>t.includes(parseInt(e))),hasSubscription(e){return e.loginStatus&&(e.userData?.roles?.includes(C.PUR)||e.userData?.roles?.includes(C.PLUS)||e.userData?.roles?.includes(C.NOADS)||e.userData?.roles?.some(e=>e.startsWith(w.PLUS_TAG))||e.userData?.roles?.includes(C.EPAPER))}},actions:{setGdprConsent(e){this.gdprConsent=e,a(`euconsent-v2`,{maxAge:31104e3}).value=e},setFontSize(e){this.fontSize=e;let t=u(`fontSize`,{maxAge:E.maxAge,readonly:!1});t.value=this.fontSize===112.5?null:this.fontSize},increaseVisists(){let e=(this.recentVisits||0)+1;u(S.visits,{maxAge:691200,readonly:!1}).value=e},async fetchOnboardingStatus(){try{let{isOnboardingCompleted:e=!1}=await n(`/api/onboarding`,{method:`GET`})||{};this.onboardingCompleted=e}catch(e){console.error(`Error while getting user onboarding status`,e)}},async setOnboardingStatus(e){try{let{isOnboardingCompleted:t}=await n(`/api/onboarding`,{method:`POST`,body:{isOnboardingCompleted:e}});this.onboardingCompleted=t}catch(e){console.error(`Error while set user onboarding status`,e)}},async resetLoginState(){let{afterLogoutBookmarksCallback:e}=g(),t=_();this.userData=null,this.loginStatus=!1,await e(),t.$reset();let{resetAnonId:n}=N();n()},async afterLogin(){if((await Promise.allSettled([this.loadMissingOptInConsent(),(async()=>{this.isPlusUser&&await _().loadPlenigoCustomer()})(),(async()=>{let{afterLoginBookmarksCallback:e}=g();await e()})()])).forEach(e=>{e.status===`rejected`&&console.error(`Promise rejected in afterLogin:`,e.reason)}),this.userData?.ssoId){let{setSsoIdAsAnonId:e}=N();e(this.userData?.ssoId)}},async loadMissingOptInConsent(){let e=t(),n=this.userData?.ssoId||`anonymous`,r=e.ssrContext?.event.node.req.headers[`x-request-id`]||Date.now(),{data:i}=await l(`/api/mein/oauth2/registration/form/missing-fields`,{key:`user-consents-${n}-${r}`,credentials:`include`,headers:f(e.ssrContext?.event)},`$kJalm5RhUS`);i.value&&(this.missedConsentFormFields=i.value)}},share:{enable:!0,initialize:!1}});export{D as a,A as c,S as d,y as f,h as g,g as h,T as i,C as l,_ as m,N as n,j as o,v as p,O as r,k as s,P as t,x as u};
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.