import{e as st}from"./chunk-YPF2NLHA.js";import{a,i as S,p as rt}from"./chunk-5LCR2OJC.js";import{$ as tt,P as l,R as D,Z,_ as J,hc as et,m as K}from"./chunk-OD6CMNJH.js";import{a as it}from"./chunk-LJOGZC7V.js";import{a as ot}from"./chunk-DQJ2JX5Z.js";import{l as ct}from"./chunk-WBE3ZYZY.js";import{d as nt,e as O,f as at}from"./chunk-2EFIA7AT.js";import{a as B}from"./chunk-WBUWFVE4.js";import{b as Y,c as b,d as Q,h as P,i as $,l as z,n as p}from"./chunk-O2KDIBGD.js";import{D as X,s as v}from"./chunk-QUA65JBC.js";import{c as y}from"./chunk-Z5BNBYBS.js";import{a as W,b as f,k as h}from"./chunk-LUW5RRY5.js";import{Ca as F,Fa as L,J as A,Ma as c,O as I,P as w,Ra as s,Sa as m,Vd as G,Xd as q,Z as g,ba as V,fa as N,fb as j,fc as H,g as U}from"./chunk-NRAZ4AKM.js";var _=U(B());var pt=(()=>{let o=class o{constructor(){this.config={cookieName:"insurance_feature_enabled",defaultValue:!1,expirationDays:30},this._isEnabled=H(this.getFeatureState()),this.isEnabled=this._isEnabled.asReadonly(),this.isDisable=G(()=>!this.isEnabled()),q(()=>{let e=this._isEnabled();this.setCookie(this.config.cookieName,e.toString(),this.config.expirationDays)})}shouldBlockInsuranceRoute(e){return!this.isEnabled()&&this.isInsuranceRoute(e)}isInsuranceRoute(e){return e.startsWith("/asigurari")}getFeatureState(){let e=this.getCookie(this.config.cookieName);return!y.isProduction()||e==="true"?!0:this.config.defaultValue}getCookie(e){return _.default.get(e)||null}setCookie(e,i,u){let d=new Date;d.setTime(d.getTime()+u*24*60*60*1e3),_.default.set(e,i,{expires:d})}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"});let t=o;return t})();var Dt=[l.SetShipping,l.SetBilling,l.SetPayment];function R(t,o){return t.find(r=>r?.code===o)}function _t(t){return j(t,()=>{let o=m(p),r=!1;return o.getWithSelector(st()).pipe(N(1)).subscribe(e=>{r=e}),r})}function Et(t){let o=t.items.some(e=>e?.product?.__typename==="SubscriptionOfferingSubResource"&&e.product.acq==="ACQUISITION_PORT_IN"&&e.product.portInDetails?.needOtpValidation),r=t.items.some(e=>e?.items?.some(i=>i?.product&&i.product.__typename==="SubscriptionOfferingSubResource"&&i.product.acq==="ACQUISITION_PORT_IN"&&i.product.portInDetails?.needOtpValidation));return o||r}function kt(t){let o=t.items.some(e=>e?.product?.__typename==="SubscriptionOfferingSubResource"&&e?.product?.acq==="ACQUISITION_PORT_IN"&&e.product.portInDetails?.hasUploadedInvoiceOrSimDoc===!1),r=t.items.some(e=>e?.items?.some(i=>i?.product&&i.product.__typename==="SubscriptionOfferingSubResource"&&i.product.acq==="ACQUISITION_PORT_IN"&&i.product.portInDetails?.hasUploadedInvoiceOrSimDoc===!1));return o||r}function Bt(t){let o=[];return t?.__typename==="PendingCartResource"&&(t?.actions?.some(r=>r&&Dt.includes(r))||o.push(n.canNotPerformAtLeastOneShippingAction),t?.items?.length||o.push(n.emptyCart),t?.items.some(r=>r?.notifications?.length)&&t?.items.some(r=>r?.notifications?.find(e=>e&&e.duration!==Z.Temporary))&&o.push(n.cartItemNotification),t?.items.some(r=>r?.items?r?.items.some(e=>e?.notifications?.find(i=>i&&i.code===mt.portInNotEligible)):!1)&&o.push(n.cartItemNotification),t?.notifications?.some(r=>r.level===J.Error&&!Mt.includes(r?.code||"")&&r?.page!==tt.Shipping)&&o.push(n.cartNotification)),o}function Xt(t,o,r){let e=[];return t?.__typename==="PendingCartResource"&&(!o?.hasPaymentCommitment&&t.actions.includes(l.HasPaymentCommitment)&&e.push(n.paymentCommitmentHasError),t.actions?.includes(l.CanPlaceOrder)||e.push(n.impersonatedUserCanPlaceOrder),t?.billing||e.push(n.billing),t?.payment||e.push(n.payment),!t?.shipping&&!t.actions.includes(l.IsFastOrder)&&!t.actions.includes(l.IsESimPrePayFlow)&&e.push(n.shipping),!t?.telewebInfo&&t.actions.includes(l.CanImpersonate)&&e.push(n.impersonation),R(t?.notifications,"MAX_VALUE_EXCEEDED")&&e.push(n.maxValueExceeded),R(t.notifications,"MISSING_CONTACT_PERSON_PHONE_NUMBER_FROM_SHIPPING")&&e.push(n.missingPhoneNumberFromDeliveryContactPerson),R(t?.notifications,"MISSING_UNIQUE_ID_PERSON")&&e.push(n.billingMissingUniqueId),R(t?.notifications,"CARD_PAYMENT_NOT_AVAILABLE_FOR_LOCKER")&&e.push(n.cardPaymentNotAvailableForLocker),t.newCustomerDetails?.isNCAFlow&&!t.newCustomerDetails.userDetails&&e.push(n.newCustomerDetailsIsNull),Et(t)&&e.push(n.portInOtpNeedValidate),kt(t)&&e.push(n.portInNeedUploadDoc),r&&_t(r)&&e.push(n.ppy2ppdOtpNeedValidate)),e}function Yt(t){let o=[];return t?.__typename==="PendingCartResource"&&R(t?.notifications,D.ContactEmailNotValidated)&&o.push(n.contactEmailNotValidated),o}var Mt=["INSTALLMENT_LIMIT_REACHED","MAX_VALUE_EXCEEDED",D.ContactEmailNotValidated,"PORT_IN_OFI_ARIADNEXT_CNP_NOT_MATCHING"],mt=function(t){return t.portInNotEligible="PORTIN_NOT_ELIGIBLE",t}(mt||{}),n=function(t){return t.billing="billing",t.billingStreet="billingStreet",t.billingMissingUniqueId="billingMissingUniqueId",t.canNotPerformAtLeastOneShippingAction="canNotPerformAtLeastOneShippingAction",t.cartItemNotification="cartItemNotification",t.cartNotification="cartNotification",t.dontAcceptValidation="dontAcceptValidation",t.dontHaveOCRConsent="dontHaveOCRConsent",t.emptyCart="emptyCart",t.impersonatedUserCanPlaceOrder="impersonatedUserCanPlaceOrder",t.impersonation="impersonation",t.maxValueExceeded="maxValueExceeded",t.contactEmailNotValidated="CONTACT_EMAIL_NOT_VALIDATED",t.missingPhoneNumberFromDeliveryContactPerson="missingPhoneNumberFromDeliveryContactPerson",t.newCustomerDetailsIsNull="newCustomerDetailsIsNull",t.portInOtpNeedValidate="portInOtpNeedValidate",t.portInNeedUploadDoc="portInNeedUploadDoc",t.orderDetailsNotCompleted="orderDetailsNotCompleted",t.payment="payment",t.paymentCommitmentHasError="paymentCommitmentHasError",t.shipping="shipping",t.shippingStreet="shippingStreet",t.technicalErrors="technicalErrors",t.transportAndPaymentNotCompleted="transportAndPaymentNotCompleted",t.emailConfirmationNotCompleted="emailConfirmationNotCompleted",t.ppy2ppdOtpNeedValidate="ppy2ppdOtpNeedValidate",t.cardPaymentNotAvailableForLocker="cardPaymentNotAvailableForLocker",t}(n||{}),lt=t=>!!t&&/^\/adaugat-la-cos(\?.*)?$/.test(t),ut=t=>!!t&&/^\/adaugat-la-cos\/numar-telefon.*/.test(t);var dt=t=>!!t&&/^\/adaugat-la-cos\/scanare.*/.test(t),ft=t=>!!t&&/^\/adaugat-la-cos\/transport-si-plata.*/.test(t);var Qt=t=>!!t&&/^\/adaugat-la-cos\/plaseaza-comanda/.test(t),ht=t=>!!t&&/^\/adaugat-la-cos\/(comanda-scanare-validare|confirma-comanda|comanda-confirmata(\/[\d-]+)?(\/[\da-z-]+)?)(\?.*)?$/.test(t);var Nt=(()=>{let o=class o{constructor(e,i){this.storeSelector=e,this.router=i}resolve(e){return this.storeSelector.getWithSelector(P()).pipe(g(i=>!!i.me||!!i.error)).pipe(L(i=>{Y(i.me)&&!b(i.me)&&i.me?.channel!==y.getChannel()&&this.router.navigate(["/canal-incorect"])})).pipe(N(1))}};o.\u0275fac=function(i){return new(i||o)(s(p),s(h))},o.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"});let t=o;return t})();var yt=(()=>{let o=class o{constructor(e){this.storeSelector=e}canActivate(e,{url:i}){return this.storeSelector.getWithSelector(P()).pipe(g(Q)).pipe(I(({me:u})=>{if(!b(u))throw Error("user has no impersonation rights");return!0})).pipe(N(1)).pipe(V(()=>(it(),A(!1))))}};o.\u0275fac=function(i){return new(i||o)(s(p))},o.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"});let t=o;return t})();var Pt=(()=>{let o=class o{constructor(e,i){this.router=e,this.storeSelector=i}canActivate(){return this.storeSelector.getWithSelector($()).pipe(I(e=>!e.ssoId||e.channel===y.getChannel()?(this.router.navigate(["/"]),!1):!0))}};o.\u0275fac=function(i){return new(i||o)(s(h),s(p))},o.\u0275prov=c({token:o,factory:o.\u0275fac});let t=o;return t})();var St=Object.entries(nt).map(([t,o])=>({pathMatch:"full",path:`${o}-cat-${t}`,redirectTo:at(parseInt(t,10),o).replace(/^\//,""),queryParamsHandling:"preserve"}));var At=U(B());var Ot=(()=>{let o=class o{constructor(){this.store=m(v),this.storeSelector=m(p),this.identityApiService=m(ot)}canActivate(e,{url:i}){let u=e.queryParams.fromStatic?e.queryParams.fromStatic:null;return w([this.store.select(et),this.storeSelector.getWithSelector(P()).pipe(g(d=>d.status===X.success)),this.storeSelector.getWithSelector(z),this.identityApiService.getAuthUrlToCurrentPage()]).pipe(F(([d,M,x,bt])=>!d.wasAskedToSignIn&&!M.me?.ssoId&&!x&&u==="true"?(At.default.set("redirect_cookie",i),window.open(`${bt}`,"_self"),A(!1)):(!d.wasAskedToSignIn&&M.me?.ssoId&&x&&this.store.dispatch(K()),A(!0))))}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"});let t=o;return t})();var Ct=(t,o)=>Tt(o.url),Rt=(t,o)=>Tt(o.url);function Tt(t){let o=m(pt),r=m(h);return o.shouldBlockInsuranceRoute(t)?r.createUrlTree(["/"]):!0}function E(t){if(t.length){let r=t[0].path.match(/^(.+)-pd-(\d+)\b/);if(r)return{consumed:[t[0]],posParams:{productSlug:new f(r[1],{}),productId:new f(r[2],{})}}}return null}function vt(t){if(t.length){let o=t[0].path,r=O[o];if(r)return{consumed:[t[0]],posParams:{categorySlug:new f(o,{}),categoryId:new f(r.toString(),{})}}}return null}function xt(t){if(t.length){let o=t[0].path,r=O[o],e=t[1]?.path;if(r)return{consumed:[...t],posParams:{categorySlug:new f(o,{}),categoryId:new f(r.toString(),{}),brandFilter:new f(e,{})}}}return null}var Ut=[{path:a.Root,loadChildren:()=>import("./chunk-X3IT2KCU.js"),data:{revalidate:60}},{path:a.Impersonation,loadComponent:()=>import("./chunk-W3MCDNX5.js"),canActivate:[yt]},{path:a.Comparator,loadChildren:()=>import("./chunk-JDVY62ZH.js")},{path:a.OrderHistory,loadChildren:()=>import("./chunk-BIWZXCZP.js")},{path:a.Reviews,loadChildren:()=>import("./chunk-RLGZKPXV.js")},{path:a.Favorites,data:{name:"favorite"},loadComponent:()=>import("./chunk-KVPOYXOP.js")},{path:"cos",redirectTo:a.Cart},{path:a.Cart,loadChildren:()=>import("./chunk-FGAAGHJY.js"),data:{pageType:"cart"}},{matcher:E,canActivate:[Ot],loadChildren:()=>import("./chunk-TXETIVLL.js")},{path:a.Subscription,loadChildren:()=>import("./chunk-4HJWLDVZ.js")},...St,{matcher:xt,loadChildren:()=>import("./chunk-PU7BQUI5.js")},{path:a.MobileScanConfirmed,loadComponent:()=>import("./chunk-VKPVHDY2.js")},{path:a.Insurance,canActivate:[Ct],canActivateChild:[Rt],loadChildren:()=>import("./chunk-BFH6N672.js")}],Ge=[{path:a.IncorrectChannel,canActivate:[Pt],loadComponent:()=>import("./chunk-6FGOWFEI.js").then(t=>t)},{path:a.Root,resolve:{identity:Nt},children:Ut},{path:"**",loadComponent:()=>import("./chunk-TOXEMPFZ.js").then(t=>t)}];var k=window;k.dataLayer=k.dataLayer||[];var T=function(t){return t[t.DETAILS=0]="DETAILS",t[t.SCAN=1]="SCAN",t[t.TRANSPORT_AND_PAYMENT=2]="TRANSPORT_AND_PAYMENT",t[t.CONFIRMATION=3]="CONFIRMATION",t}(T||{}),Je=(()=>{let o=class o{constructor(e,i){this.router=e,this.store=i}locate(){let i=this.router.parseUrl(this.router.url).root.children[W],u="home";return this.router.url!=="/"&&i&&(u=this.identifyPage(i.segments)),u}track(e,i="Menu Tabs"){e==="Show"&&this.locate()==="checkout"&&(i="Checkout Delivery",e="Select Number"),this.locate()==="product"&&(e="Product Detail Top"),k.dataLayer.push({event:"mikroUserClick",event_action:i,event_category:"User Profile",event_label:e,event_value:rt.ZERO})}identifyPage(e){return vt(e)||e[0]&&e[0].path==="abonamente"?"listing":E(e)?"product":e[1]&&e[1].path==="transport-si-plata"?"checkout":this.router.url.substring(1)}identifyEventCategory(){return this.store.select(ct).pipe(I(({params:e,url:i})=>O[e.categorySlug]||i.startsWith("/abonamente")?S.LISTING:i.match(/^(.+)-pd-(\d+)\b/)?S.PRODUCT_DETAIL:i.startsWith("/comenzile-mele")?S.ORDERS_HISTORY:i==="/"?S.HOME:S.HOME))}identifyCartStep(){if(lt(this.router.url)||ut(this.router.url))return T.DETAILS;if(ht(this.router.url))return T.CONFIRMATION;if(dt(this.router.url))return T.SCAN;if(ft(this.router.url))return T.TRANSPORT_AND_PAYMENT}};o.\u0275fac=function(i){return new(i||o)(s(h),s(v))},o.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"});let t=o;return t})();export{pt as a,Bt as b,Xt as c,Yt as d,n as e,lt as f,ft as g,Qt as h,ht as i,Ge as j,T as k,Je as l};