import{e as le}from"./chunk-4POUEPB7.js";import{a as c,i as A,p as ae}from"./chunk-5LCR2OJC.js";import{$ as oe,P as u,R as b,Z as ee,_ as te,hc as ie,m as J}from"./chunk-XS4DMB2U.js";import{a as re}from"./chunk-RKDMG5J6.js";import{a as ne}from"./chunk-4E6OXLGZ.js";import{l as pe}from"./chunk-F24Q3MRY.js";import{d as se,e as R,f as ce}from"./chunk-RF2FNIBX.js";import{a as Y}from"./chunk-LPS5FO3A.js";import{b as $,c as E,d as z,i as S,j as K,m as Z,o as m}from"./chunk-DAYGRJHR.js";import{D as Q,s as _}from"./chunk-VYUKN3XQ.js";import{c as P}from"./chunk-AYHVL37M.js";import{a as X,b as h,k as g}from"./chunk-AWMJHCA7.js";import{Da as j,Ga as H,K as C,Na as p,P as I,Q as F,Sa as l,Ta as d,Wd as W,Yd as B,_ as N,ca as L,g as V,ga as y,gb as G,gc as q}from"./chunk-XNQ3RS5P.js";var k=V(Y());var me=(()=>{let o=class o{constructor(){this.config={cookieName:"insurance_feature_enabled",defaultValue:!1,expirationDays:30},this._isEnabled=q(this.getFeatureState()),this.isEnabled=this._isEnabled.asReadonly(),this.isDisable=W(()=>!this.isEnabled()),B(()=>{let t=this._isEnabled();this.setCookie(this.config.cookieName,t.toString(),this.config.expirationDays)})}shouldBlockInsuranceRoute(t){return!this.isEnabled()&&this.isInsuranceRoute(t)}isInsuranceRoute(t){return t.startsWith("/asigurari")}getFeatureState(){let t=this.getCookie(this.config.cookieName);return!P.isProduction()||t==="true"?!0:this.config.defaultValue}getCookie(t){return k.default.get(t)||null}setCookie(t,i,n){let a=new Date;a.setTime(a.getTime()+n*24*60*60*1e3),k.default.set(t,i,{expires:a})}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=p({token:o,factory:o.\u0275fac,providedIn:"root"});let e=o;return e})();var be=[u.SetShipping,u.SetBilling,u.SetPayment];function v(e,o){return e.find(r=>(r==null?void 0:r.code)===o)}function ke(e){return G(e,()=>{let o=d(m),r=!1;return o.getWithSelector(le()).pipe(y(1)).subscribe(t=>{r=t}),r})}function Me(e){let o=e.items.some(t=>{var i,n;return((i=t==null?void 0:t.product)==null?void 0:i.__typename)==="SubscriptionOfferingSubResource"&&t.product.acq==="ACQUISITION_PORT_IN"&&((n=t.product.portInDetails)==null?void 0:n.needOtpValidation)}),r=e.items.some(t=>{var i;return(i=t==null?void 0:t.items)==null?void 0:i.some(n=>{var a;return(n==null?void 0:n.product)&&n.product.__typename==="SubscriptionOfferingSubResource"&&n.product.acq==="ACQUISITION_PORT_IN"&&((a=n.product.portInDetails)==null?void 0:a.needOtpValidation)})});return o||r}function xe(e){let o=e.items.some(t=>{var i,n,a;return((i=t==null?void 0:t.product)==null?void 0:i.__typename)==="SubscriptionOfferingSubResource"&&((n=t==null?void 0:t.product)==null?void 0:n.acq)==="ACQUISITION_PORT_IN"&&((a=t.product.portInDetails)==null?void 0:a.hasUploadedInvoiceOrSimDoc)===!1}),r=e.items.some(t=>{var i;return(i=t==null?void 0:t.items)==null?void 0:i.some(n=>{var a;return(n==null?void 0:n.product)&&n.product.__typename==="SubscriptionOfferingSubResource"&&n.product.acq==="ACQUISITION_PORT_IN"&&((a=n.product.portInDetails)==null?void 0:a.hasUploadedInvoiceOrSimDoc)===!1})});return o||r}function Ye(e){var r,t,i;let o=[];return(e==null?void 0:e.__typename)==="PendingCartResource"&&((r=e==null?void 0:e.actions)!=null&&r.some(n=>n&&be.includes(n))||o.push(s.canNotPerformAtLeastOneShippingAction),(t=e==null?void 0:e.items)!=null&&t.length||o.push(s.emptyCart),e!=null&&e.items.some(n=>{var a;return(a=n==null?void 0:n.notifications)==null?void 0:a.length})&&(e!=null&&e.items.some(n=>{var a;return(a=n==null?void 0:n.notifications)==null?void 0:a.find(f=>f&&f.duration!==ee.Temporary)}))&&o.push(s.cartItemNotification),e!=null&&e.items.some(n=>n!=null&&n.items?n==null?void 0:n.items.some(a=>{var f;return(f=a==null?void 0:a.notifications)==null?void 0:f.find(O=>O&&O.code===de.portInNotEligible)}):!1)&&o.push(s.cartItemNotification),(i=e==null?void 0:e.notifications)!=null&&i.some(n=>n.level===te.Error&&!Ue.includes((n==null?void 0:n.code)||"")&&(n==null?void 0:n.page)!==oe.Shipping)&&o.push(s.cartNotification)),o}function Qe(e,o,r){var i,n;let t=[];return(e==null?void 0:e.__typename)==="PendingCartResource"&&(!(o!=null&&o.hasPaymentCommitment)&&e.actions.includes(u.HasPaymentCommitment)&&t.push(s.paymentCommitmentHasError),(i=e.actions)!=null&&i.includes(u.CanPlaceOrder)||t.push(s.impersonatedUserCanPlaceOrder),e!=null&&e.billing||t.push(s.billing),e!=null&&e.payment||t.push(s.payment),!(e!=null&&e.shipping)&&!e.actions.includes(u.IsFastOrder)&&!e.actions.includes(u.IsESimPrePayFlow)&&t.push(s.shipping),!(e!=null&&e.telewebInfo)&&e.actions.includes(u.CanImpersonate)&&t.push(s.impersonation),v(e==null?void 0:e.notifications,"MAX_VALUE_EXCEEDED")&&t.push(s.maxValueExceeded),v(e.notifications,"MISSING_CONTACT_PERSON_PHONE_NUMBER_FROM_SHIPPING")&&t.push(s.missingPhoneNumberFromDeliveryContactPerson),v(e==null?void 0:e.notifications,"MISSING_UNIQUE_ID_PERSON")&&t.push(s.billingMissingUniqueId),v(e==null?void 0:e.notifications,"CARD_PAYMENT_NOT_AVAILABLE_FOR_LOCKER")&&t.push(s.cardPaymentNotAvailableForLocker),(n=e.newCustomerDetails)!=null&&n.isNCAFlow&&!e.newCustomerDetails.userDetails&&t.push(s.newCustomerDetailsIsNull),Me(e)&&t.push(s.portInOtpNeedValidate),xe(e)&&t.push(s.portInNeedUploadDoc),r&&ke(r)&&t.push(s.ppy2ppdOtpNeedValidate)),t}function $e(e){let o=[];return(e==null?void 0:e.__typename)==="PendingCartResource"&&v(e==null?void 0:e.notifications,b.ContactEmailNotValidated)&&o.push(s.contactEmailNotValidated),o}var Ue=["INSTALLMENT_LIMIT_REACHED","MAX_VALUE_EXCEEDED",b.ContactEmailNotValidated,"PORT_IN_OFI_ARIADNEXT_CNP_NOT_MATCHING"],de=function(e){return e.portInNotEligible="PORTIN_NOT_ELIGIBLE",e}(de||{}),s=function(e){return e.billing="billing",e.billingStreet="billingStreet",e.billingMissingUniqueId="billingMissingUniqueId",e.canNotPerformAtLeastOneShippingAction="canNotPerformAtLeastOneShippingAction",e.cartItemNotification="cartItemNotification",e.cartNotification="cartNotification",e.dontAcceptValidation="dontAcceptValidation",e.dontHaveOCRConsent="dontHaveOCRConsent",e.emptyCart="emptyCart",e.impersonatedUserCanPlaceOrder="impersonatedUserCanPlaceOrder",e.impersonation="impersonation",e.maxValueExceeded="maxValueExceeded",e.contactEmailNotValidated="CONTACT_EMAIL_NOT_VALIDATED",e.missingPhoneNumberFromDeliveryContactPerson="missingPhoneNumberFromDeliveryContactPerson",e.newCustomerDetailsIsNull="newCustomerDetailsIsNull",e.portInOtpNeedValidate="portInOtpNeedValidate",e.portInNeedUploadDoc="portInNeedUploadDoc",e.orderDetailsNotCompleted="orderDetailsNotCompleted",e.payment="payment",e.paymentCommitmentHasError="paymentCommitmentHasError",e.shipping="shipping",e.shippingStreet="shippingStreet",e.technicalErrors="technicalErrors",e.transportAndPaymentNotCompleted="transportAndPaymentNotCompleted",e.emailConfirmationNotCompleted="emailConfirmationNotCompleted",e.ppy2ppdOtpNeedValidate="ppy2ppdOtpNeedValidate",e.cardPaymentNotAvailableForLocker="cardPaymentNotAvailableForLocker",e}(s||{}),ue=e=>!!e&&/^\/adaugat-la-cos(\?.*)?$/.test(e),fe=e=>!!e&&/^\/adaugat-la-cos\/numar-telefon.*/.test(e);var he=e=>!!e&&/^\/adaugat-la-cos\/scanare.*/.test(e),ge=e=>!!e&&/^\/adaugat-la-cos\/transport-si-plata.*/.test(e);var ze=e=>!!e&&/^\/adaugat-la-cos\/plaseaza-comanda/.test(e),Ie=e=>!!e&&/^\/adaugat-la-cos\/(comanda-scanare-validare|confirma-comanda|comanda-confirmata(\/[\d-]+)?(\/[\da-z-]+)?)(\?.*)?$/.test(e);var Pe=(()=>{let o=class o{constructor(t,i){this.storeSelector=t,this.router=i}resolve(t){return this.storeSelector.getWithSelector(S()).pipe(N(i=>!!i.me||!!i.error)).pipe(H(i=>{var n;$(i.me)&&!E(i.me)&&((n=i.me)==null?void 0:n.channel)!==P.getChannel()&&this.router.navigate(["/canal-incorect"])})).pipe(y(1))}};o.\u0275fac=function(i){return new(i||o)(l(m),l(g))},o.\u0275prov=p({token:o,factory:o.\u0275fac,providedIn:"root"});let e=o;return e})();var Se=(()=>{let o=class o{constructor(t){this.storeSelector=t}canActivate(t,{url:i}){return this.storeSelector.getWithSelector(S()).pipe(N(z)).pipe(I(({me:n})=>{if(!E(n))throw Error("user has no impersonation rights");return!0})).pipe(y(1)).pipe(L(()=>(re(),C(!1))))}};o.\u0275fac=function(i){return new(i||o)(l(m))},o.\u0275prov=p({token:o,factory:o.\u0275fac,providedIn:"root"});let e=o;return e})();var Ae=(()=>{let o=class o{constructor(t,i){this.router=t,this.storeSelector=i}canActivate(){return this.storeSelector.getWithSelector(K()).pipe(I(t=>!t.ssoId||t.channel===P.getChannel()?(this.router.navigate(["/"]),!1):!0))}};o.\u0275fac=function(i){return new(i||o)(l(g),l(m))},o.\u0275prov=p({token:o,factory:o.\u0275fac});let e=o;return e})();var Oe=Object.entries(se).map(([e,o])=>({pathMatch:"full",path:"".concat(o,"-cat-").concat(e),redirectTo:ce(parseInt(e,10),o).replace(/^\//,""),queryParamsHandling:"preserve"}));var Ce=V(Y());var Re=(()=>{let o=class o{constructor(){this.store=d(_),this.storeSelector=d(m),this.identityApiService=d(ne)}canActivate(t,{url:i}){let n=t.queryParams.fromStatic?t.queryParams.fromStatic:null;return F([this.store.select(ie),this.storeSelector.getWithSelector(S()).pipe(N(a=>a.status===Q.success)),this.storeSelector.getWithSelector(Z),this.identityApiService.getAuthUrlToCurrentPage()]).pipe(j(([a,f,O,Ee])=>{var U,w;return!a.wasAskedToSignIn&&!((U=f.me)!=null&&U.ssoId)&&!O&&n==="true"?(Ce.default.set("redirect_cookie",i),window.open("".concat(Ee),"_self"),C(!1)):(!a.wasAskedToSignIn&&((w=f.me)!=null&&w.ssoId)&&O&&this.store.dispatch(J()),C(!0))}))}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=p({token:o,factory:o.\u0275fac,providedIn:"root"});let e=o;return e})();var Te=(e,o)=>De(o.url),ve=(e,o)=>De(o.url);function De(e){let o=d(me),r=d(g);return o.shouldBlockInsuranceRoute(e)?r.createUrlTree(["/"]):!0}function M(e){if(e.length){let r=e[0].path.match(/^(.+)-pd-(\d+)\b/);if(r)return{consumed:[e[0]],posParams:{productSlug:new h(r[1],{}),productId:new h(r[2],{})}}}return null}function _e(e){if(e.length){let o=e[0].path,r=R[o];if(r)return{consumed:[e[0]],posParams:{categorySlug:new h(o,{}),categoryId:new h(r.toString(),{})}}}return null}function we(e){var o;if(e.length){let r=e[0].path,t=R[r],i=(o=e[1])==null?void 0:o.path;if(t)return{consumed:[...e],posParams:{categorySlug:new h(r,{}),categoryId:new h(t.toString(),{}),brandFilter:new h(i,{})}}}return null}var Ve=[{path:c.Root,loadChildren:()=>import("./chunk-HU2YB2FN.js"),data:{revalidate:60}},{path:c.Impersonation,loadComponent:()=>import("./chunk-O2WILYUV.js"),canActivate:[Se]},{path:c.Comparator,loadChildren:()=>import("./chunk-3HSEKQC6.js")},{path:c.OrderHistory,loadChildren:()=>import("./chunk-XPG3FWOJ.js")},{path:c.Reviews,loadChildren:()=>import("./chunk-F4AYOEOG.js")},{path:c.Favorites,data:{name:"favorite"},loadComponent:()=>import("./chunk-2YG7TBFU.js")},{path:"cos",redirectTo:c.Cart},{path:c.Cart,loadChildren:()=>import("./chunk-ZOZVQJJC.js"),data:{pageType:"cart"}},{matcher:M,canActivate:[Re],loadChildren:()=>import("./chunk-QRZ7YITP.js")},{path:c.Subscription,loadChildren:()=>import("./chunk-HFUJHVTW.js")},...Oe,{matcher:we,loadChildren:()=>import("./chunk-5XVOPUBR.js")},{path:c.MobileScanConfirmed,loadComponent:()=>import("./chunk-CXLIB7ZI.js")},{path:c.Insurance,canActivate:[Te],canActivateChild:[ve],loadChildren:()=>import("./chunk-HG4FFFXC.js")}],Wt=[{path:c.IncorrectChannel,canActivate:[Ae],loadComponent:()=>import("./chunk-ASHQ4L2R.js").then(e=>e)},{path:c.Root,resolve:{identity:Pe},children:Ve},{path:"**",loadComponent:()=>import("./chunk-ZVDD35KY.js").then(e=>e)}];var x=window;x.dataLayer=x.dataLayer||[];var D=function(e){return e[e.DETAILS=0]="DETAILS",e[e.SCAN=1]="SCAN",e[e.TRANSPORT_AND_PAYMENT=2]="TRANSPORT_AND_PAYMENT",e[e.CONFIRMATION=3]="CONFIRMATION",e}(D||{}),to=(()=>{let o=class o{constructor(t,i){this.router=t,this.store=i}locate(){let i=this.router.parseUrl(this.router.url).root.children[X],n="home";return this.router.url!=="/"&&i&&(n=this.identifyPage(i.segments)),n}track(t,i="Menu Tabs"){t==="Show"&&this.locate()==="checkout"&&(i="Checkout Delivery",t="Select Number"),this.locate()==="product"&&(t="Product Detail Top"),x.dataLayer.push({event:"mikroUserClick",event_action:i,event_category:"User Profile",event_label:t,event_value:ae.ZERO})}identifyPage(t){return _e(t)||t[0]&&t[0].path==="abonamente"?"listing":M(t)?"product":t[1]&&t[1].path==="transport-si-plata"?"checkout":this.router.url.substring(1)}identifyEventCategory(){return this.store.select(pe).pipe(I(({params:t,url:i})=>R[t.categorySlug]||i.startsWith("/abonamente")?A.LISTING:i.match(/^(.+)-pd-(\d+)\b/)?A.PRODUCT_DETAIL:i.startsWith("/comenzile-mele")?A.ORDERS_HISTORY:i==="/"?A.HOME:A.HOME))}identifyCartStep(){if(ue(this.router.url)||fe(this.router.url))return D.DETAILS;if(Ie(this.router.url))return D.CONFIRMATION;if(he(this.router.url))return D.SCAN;if(ge(this.router.url))return D.TRANSPORT_AND_PAYMENT}};o.\u0275fac=function(i){return new(i||o)(l(g),l(_))},o.\u0275prov=p({token:o,factory:o.\u0275fac,providedIn:"root"});let e=o;return e})();export{me as a,Ye as b,Qe as c,$e as d,s as e,ue as f,ge as g,ze as h,Ie as i,Wt as j,D as k,to as l};