import{A as ht,m as st,n as at,o as dt,p as Ae,q as lt,u as ct,v as pt,w as ut,x as mt}from"./chunk-EEUSJGKN.js";import{a as Le}from"./chunk-4SEMTXPG.js";import{o as Et}from"./chunk-NTQ4VR44.js";import{a as Ct}from"./chunk-H24LMGDB.js";import{b as wt}from"./chunk-FSY2WDF3.js";import{b as Pt}from"./chunk-KB2G34AX.js";import{c as it,d as ot,e as rt}from"./chunk-WYC34PD4.js";import{e as _t,g as ft,i as gt,p as xt}from"./chunk-5LCR2OJC.js";import{$b as je,Ac as Ze,Cb as ne,P as U,Pb as Se,Qb as ve,Ub as He,_b as Xe,aa as qe,hc as ye,jc as T,ka as Ce,na as ze,uc as Ke,wc as Ye}from"./chunk-OD6CMNJH.js";import{E as Ft,F as Tt,c as vt,e as C,h as yt,i as At,j as Lt,l as B,n as Ot,r as bt,t as It}from"./chunk-2J737MNP.js";import{a as Je}from"./chunk-R2KNOYK2.js";import{c as nt,d as X}from"./chunk-O7JFACMN.js";import{V as tt}from"./chunk-Y4LLAK7R.js";import{g as fe,h as ge,j as We,l as xe,n as se}from"./chunk-O2KDIBGD.js";import{h as H,k as ae,n as Qe,q as et}from"./chunk-767ZUJWF.js";import{D as O,d,e as l,s as Ue,v as m,w as Ge}from"./chunk-QUA65JBC.js";import{c as Re}from"./chunk-Z5BNBYBS.js";import{h as re}from"./chunk-SAGV4YDN.js";import{v as $e}from"./chunk-NTECMJTK.js";import{a as St}from"./chunk-BI3TUUDD.js";import{Bc as F,Ca as Z,Da as J,Dc as ee,Ec as te,Fc as ie,Gc as x,Hc as _,Ic as ke,J as K,Ma as Q,Mc as oe,O as v,P as G,Ra as w,Sb as De,Sc as k,Ub as A,Uc as I,Vb as N,X as we,Y as me,Z as D,Za as Pe,a as u,b as g,ed as f,fa as W,fc as Ve,gc as Ne,gd as he,ha as q,hd as _e,ib as $,jb as R,la as V,nd as Be,oc as L,rd as Me,s as ue,sb as Ee,t as b,u as Te,uc as z,vd as P,wd as E,ya as Y}from"./chunk-NRAZ4AKM.js";var yi=d("[Locations] Search Fixed Locations",l()),Ai=d("[Locations] Search Fixed Locations [Success]",l()),Li=d("[Locations] Search Fixed Locations [Error]",l()),Oi=d("[Locations] Get Fixed Location",l()),bi=d("[Locations] Get Fixed Location [Success]",l()),Ii=d("[Locations] Get Fixed Location [Error]",l()),Fi=d("[Location] Remove Search Fixed Locations"),Ti=d("[Location] Update Filter Input",l()),wi=d("[Location] Clear Filter Input"),Dt=d("[Locations] Get Counties",l()),Pi=d("[Locations] Get Counties Success",l()),Ei=d("[Locations] Get Counties Error",l()),Di=d("[Locations] Get Localities",l()),Vi=d("[Locations] Get Localities Success",l()),Ni=d("[Locations] Get Localities Error",l()),ki=d("[Locations] Remove localities"),Bi=d("[Locations] Set Location Marker",l()),Mi=d("[Locations] Set Location from map",l()),$i=d("[Locations] Set Location from cart",l()),Ri=d("[Location] Set Location skeletons",l()),Ui=d("[Location] Set favorite Location",l()),Gi=d("[Location] Set favorite Location Success",l()),Wi=d("[Location] Set favorite Location Error",l()),Oe=d("[Location] Get favorite or last used Location"),qi=d("[Location] Get favorite or last used Location Success",l()),zi=d("[Location] Get favorite or last used Location Error",l()),Hi=d("[Location] Set County input",l()),Xi=d("[Location] Set Locality input",l()),ji=d("[Location] Clear Address inputs");function Vt(e){let o=u({},e);return delete o.__typename,delete o.allowsDropOff,delete o.supportedPaymentType,delete o.schedule,delete o.restrictions,delete o.isFavorite,Qe(o)?null:o}var S=Ge("locations"),ro=m(S,e=>e.searchedFixedLocations?.data),no=m(S,e=>e.searchedFixedLocations.status),so=m(S,e=>e.searchedFixedLocations?.request),ao=m(S,e=>e.fixedLocation?.data),lo=m(S,e=>e.filterInput),co=e=>({selector:S,action:()=>Dt({countryCode:e}),map:o=>o.counties?.data,shouldDispatch:o=>o.counties.status===O.initial}),po=m(S,e=>e.localities?.data),uo=m(S,e=>e.locationMarker),mo=m(S,e=>e?.selectedLocation),ho=m(S,e=>e.showSkeletons),_o=()=>({selector:m(S,fe,(e,o)=>[e,o]),action:()=>Oe(),map:([e])=>e.favoriteOrLastUsedLocation,shouldDispatch:([e,o])=>o&&e.favoriteOrLastUsedLocation.status===O.initial}),fo=()=>({selector:m(S,fe,(e,o)=>[e,o]),action:()=>Oe(),map:([e])=>e.favoriteOrLastUsedLocation?.data,shouldDispatch:([e,o])=>o&&e.favoriteOrLastUsedLocation.status===O.initial}),go=m(S,e=>e.favoriteOrLastUsedLocation.status),xo=m(S,e=>e.favoriteOrLastUsedLocation?.data),Co=m(S,e=>!!(e.favoriteOrLastUsedLocation?.data||e.selectedLocation)),So=m(S,e=>e.selectedLocation?e.selectedLocation:Vt(e.favoriteOrLastUsedLocation?.data)),vo=m(S,e=>e.selectedLocation||void 0),yo=m(S,e=>e.countyInput),Ao=m(S,e=>e.localityInput);var de=function(e){return e[e.CUSTOMER=0]="CUSTOMER",e[e.FIXED_LOCATION=1]="FIXED_LOCATION",e[e.PICKUP_IN_STORE=2]="PICKUP_IN_STORE",e}(de||{}),le=function(e){return e.CUSTOMER="customer",e.FIXED_LOCATION="fixed-location",e.PICKUP_IN_STORE="pickup-in-store",e}(le||{}),Oo={[le.CUSTOMER]:de.CUSTOMER,[le.FIXED_LOCATION]:de.FIXED_LOCATION,[le.PICKUP_IN_STORE]:de.PICKUP_IN_STORE},be=function(e){return e.validationErrors="validationErrors",e.maxOtpCodesVerificationAttempts="maxOtpCodesVerificationAttempts",e}(be||{}),Ie=function(e){return e.validationErrors="validationErrors",e.maxOtpCodesGenerationAttempts="maxOtpCodesGenerationAttempts",e.invalidOtpCode="invalidOtpCode",e}(Ie||{});var Eo=g(u({},T),{map(e){return e.cart?.__typename==="PendingCartResource"&&e?.cart?.actions?.includes(U.SetBilling)}}),Fe=g(u({},T),{map(e){return e.cart?.__typename==="PendingCartResource"&&e?.cart?.actions?.includes(U.SetBilling)}}),Nt=g(u({},T),{map(e){return e.cart?.__typename==="PendingCartResource"&&(e?.cart?.actions?.includes(U.SetBilling)||e?.cart?.actions?.includes(U.SetBillingParty))}}),Do=g(u({},T),{map(e){return e.cart?.__typename==="PendingCartResource"&&e?.cart?.actions?.includes(U.SetShipping)}}),ce=g(u({},T),{map:e=>e.cart?.__typename==="PendingCartResource"?Le.fromCartBillingAddressToAddressRelation(e.cart?.billing):void 0}),pe=g(u({},T),{map:e=>e.cart?.__typename==="PendingCartResource"&&e.cart?.shipping?Le.fromCartShippingAddressToAddressRelation(e.cart.shipping):void 0,filter:e=>e.status===O.success||e.status===O.error}),Vo=g(u({},T),{map:e=>e.cart?.__typename==="PendingCartResource"&&e.cart.shipping?.shippingType?e.cart.shipping.shippingType:void 0}),kt=g(u({},T),{map:e=>e.newClientAcquisition.generateNewAddressOTP}),j=g(u({},T),{map:e=>e.newClientAcquisition.verifyNewAddressOTP}),No=g(u({},T),{map:e=>!!(e.cart?.__typename==="PendingCartResource"&&e.cart.isEligibleForLockers)}),ko=m(ye,e=>!(e.cart?.__typename==="PendingCartResource"&&e.cart.shipping?.shippingType.fixedLocation)),Bo=m(ye,e=>{if(e.cart?.__typename==="PendingCartResource")return e.usedAddressForShipping});var Mt=(()=>{let o=class o{constructor(t){this.httpClient=t,this.isDev=document.location.href.indexOf("localhost")>-1||document.location.href.indexOf("dev")>-1||document.location.href.indexOf("dev3")>-1,this.toggleUrl=this.isDev?"https://www-dev.orange.ro/webshopportlets/api/trafic-to-eshop":"https://www.orange.ro/webshopportlets/api/trafic-to-eshop"}isTrafficToNewShop(){return this.cache$||(this.cache$=this.httpClient.get(this.toggleUrl).pipe(Y(1))),this.cache$}checkIfIsDev(){return K(this.isDev)}};o.\u0275fac=function(i){return new(i||o)(w(re))},o.\u0275prov=Q({token:o,factory:o.\u0275fac,providedIn:"root"});let e=o;return e})();var Ht=(e,o,s)=>({cartStatus:e,generateNewAddressOTP:o,verifyNewAddressOTP:s});function Xt(e,o){e&1&&(x(0,"strong"),f(1),_()),e&2&&(A(),he(" ",o,". "))}function jt(e,o){e&1&&ke(0,"oro-skeleton-loader-line",16)}function Kt(e,o){if(e&1){let s=oe();x(0,"input",17),k("keyup",function(i){let n=$(s).$implicit,a=I(2);return R(a.switchInput(i,n))}),_()}if(e&2){let s=o.$implicit;z("formControlName",s)("id",s)}}function Yt(e,o){e&1&&f(0," Codul este necesar. ")}function Zt(e,o){e&1&&f(0," Num\u0103r de caractere invalid. ")}function Jt(e,o){if(e&1&&(x(0,"p",9),L(1,Yt,1,0)(2,Zt,1,0),_()),e&2){let s=I(2);A(),F(1,!(s.inputOne==null||s.inputOne.errors==null)&&s.inputOne.errors.required?1:!(s.inputOne==null||s.inputOne.errors==null)&&s.inputOne.errors.minlength||!(s.inputOne==null||s.inputOne.errors==null)&&s.inputOne.errors.maxlength?2:-1)}}function Qt(e,o){e&1&&f(0),e&2&&he(" \xEEn [",o,"] secunde ")}function ei(e,o){e&1&&(x(0,"oro-alert",18),f(1," A intervenit o problem\u0103 \xEEn generarea codului OTP. Te rug\u0103m \xEEncearc\u0103 mai t\xE2rziu. "),_())}function ti(e,o){e&1&&(x(0,"oro-alert",18),f(1," Ai atins num\u0103rul maxim de coduri generate. "),_())}function ii(e,o){e&1&&(x(0,"oro-alert",18),f(1," Codul introdus este invalid. "),_())}function oi(e,o){if(e&1&&f(0),e&2){let s=I(2).$implicit;_e(" ",s.message,". Error code: ",s.extensions.errorCode," ")}}function ri(e,o){e&1&&f(0," A intervenit o eroare. ")}function ni(e,o){if(e&1&&(x(0,"oro-alert",18),L(1,oi,1,2),P(2,"async"),L(3,ri,1,0),_()),e&2){let s=I(4);A(),F(1,E(2,1,s.isDev$)?1:3)}}function si(e,o){if(e&1&&L(0,ei,2,0)(1,ti,2,0)(2,ii,2,0)(3,ni,4,3),e&2){let s,t=o.$implicit,i=I(3);F(0,(s=t.extensions.errorCode)===i.generateNewClientAcquisitionOTPTypeErrors.validationErrors?0:s===i.generateNewClientAcquisitionOTPTypeErrors.maxOtpCodesGenerationAttempts?1:s===i.generateNewClientAcquisitionOTPTypeErrors.invalidOtpCode?2:3)}}function ai(e,o){e&1&&te(0,si,4,1,null,null,ee),e&2&&ie(o.errors)}function di(e,o){e&1&&(x(0,"oro-alert",18),f(1," Codul introdus nu coincide cu cel primit prin sms. Te rog s\u0103 reintroduci codul. "),_())}function li(e,o){e&1&&(x(0,"oro-alert",18),f(1," Ai atins num\u0103rul maxim de coduri pentru ast\u0103zi. Te rug\u0103m s\u0103 \xEEncerci peste 24h. "),_())}function ci(e,o){if(e&1&&f(0),e&2){let s=I(2).$implicit;_e(" ",s.message,". Error code: ",s.extensions.errorCode," ")}}function pi(e,o){e&1&&f(0," A intervenit o eroare. ")}function ui(e,o){if(e&1&&(x(0,"oro-alert",18),L(1,ci,1,2),P(2,"async"),L(3,pi,1,0),_()),e&2){let s=I(4);A(),F(1,E(2,1,s.isDev$)?1:3)}}function mi(e,o){if(e&1&&L(0,di,2,0)(1,li,2,0)(2,ui,4,3),e&2){let s,t=o.$implicit,i=I(3);F(0,(s=t.extensions.errorCode)===i.validationNumberTypeErrors.validationErrors?0:s===i.validationNumberTypeErrors.maxOtpCodesVerificationAttempts?1:2)}}function hi(e,o){e&1&&te(0,mi,3,1,null,null,ee),e&2&&ie(o.errors)}function _i(e,o){if(e&1){let s=oe();x(0,"button",19),k("click",function(){$(s);let i=I(2);return R(i.forceCheckSMSCode(!0))}),f(1," For\u021Beaz\u0103 validarea "),_()}}function fi(e,o){if(e&1){let s=oe();x(0,"div",0)(1,"div",1)(2,"h3",2),f(3,"Cod PIN"),_(),x(4,"button",3),k("click",function(){$(s);let i=I();return R(i.cancel())}),x(5,"span",4),f(6,"\xD7"),_()()(),x(7,"div",5)(8,"p",6),f(9," Pentru a continua procesul, introdu codul de validare primit prin SMS la num\u0103rul "),L(10,Xt,2,1,"strong"),P(11,"async"),L(12,jt,1,0),_(),x(13,"form",7),te(14,Kt,1,2,"input",8,ee),_(),L(16,Jt,3,1,"p",9),x(17,"div",10)(18,"p",11),f(19,"Nu ai primit codul PIN?"),_(),x(20,"button",12),k("click",function(){$(s);let i=I();return R(i.sendCodeAgain())}),f(21," Retrimite cod "),L(22,Qt,1,1),P(23,"async"),_()(),L(24,ai,2,0)(25,hi,2,0),_(),x(26,"div",13)(27,"button",14),k("click",function(){$(s);let i=I();return R(i.checkSMSCode())}),f(28," Valideaz\u0103 "),_(),L(29,_i,2,0,"button",15),P(30,"async"),_()()}if(e&2){let s,t,i,n,a=o,r=I();A(10),F(10,(s=E(11,9,r.notificationMsisdn$))?10:12,s),A(3),z("formGroup",r.form),A(),ie(r.otpFields),A(2),F(16,r.inputOne!=null&&r.inputOne.touched?16:-1),A(4),z("disabled",a.cartStatus===r.XhrStatus.loading||r.disableResendButton||!r.countdownCompleted||r.disableValidationButton),A(2),F(22,(t=!r.countdownCompleted&&E(23,11,r.countdown$))?22:-1,t),A(2),F(24,(i=a.generateNewAddressOTP)?24:-1,i),A(),F(25,(n=a.verifyNewAddressOTP)?25:-1,n),A(2),z("disabled",r.form.invalid||a.cartStatus===r.XhrStatus.loading||r.disableValidationButton),A(2),F(29,E(30,13,r.isImpersonating$)?29:-1)}}var $t=window;$t.dataLayer=$t.dataLayer||[];var Rt=(()=>{let o=class o extends Je{constructor(t,i,n,a,r,h){super(),this.dialogRef=t,this.storeSelector=i,this.trafficService=n,this.cartDeliveryAddressService=a,this.elementRef=r,this.data=h,this.otpFields=["one","two","three","four","five","six"],this.XhrStatus=O,this.validationNumberTypeErrors=be,this.generateNewClientAcquisitionOTPTypeErrors=Ie,this.countdownCompleted=!0,this.form=new Lt({one:new B("",[C.required,C.minLength(1),C.maxLength(1)]),two:new B("",[C.required,C.minLength(1),C.maxLength(1)]),three:new B("",[C.required,C.minLength(1),C.maxLength(1)]),four:new B("",[C.required,C.minLength(1),C.maxLength(1)]),five:new B("",[C.required,C.minLength(1),C.maxLength(1)]),six:new B("",[C.required,C.minLength(1),C.maxLength(1)])}),this.isImpersonating$=this.storeSelector.getWithSelector(We)}get inputOne(){return this.form.get("one")}get inputTwo(){return this.form.get("two")}get inputThree(){return this.form.get("three")}get inputFour(){return this.form.get("four")}get inputFive(){return this.form.get("five")}get inputSix(){return this.form.get("six")}onClick(t){this.elementRef.nativeElement.contains(t.target)||this.closeAddressForm()}ngOnInit(){this.generateNewAddressOTP$=this.storeSelector.getWithSelector(kt),this.verifyNewAddressOTP$=this.storeSelector.getWithSelector(j),this.cartStatus$=this.storeSelector.getWithSelector(Ze),this.isDev$=this.trafficService.checkIfIsDev(),this.notificationMsisdn$=this.generateNewAddressOTP$.pipe(v(t=>t.msisdn)),this.checkIfNeedToDisableButtons(),this.verifyNewAddressOTP$.pipe(J(this.destroyed$)).subscribe(t=>{t&&t.verified===!0&&(this.data.isCompleteOrder||(this.data.address?this.cartDeliveryAddressService.handleEditDeliveryAddress(this.data.address):this.cartDeliveryAddressService.handleAddDeliveryAddress()),this.dialogRef.close(this.data.isCompleteOrder))}),this.startCountdown()}checkSMSCode(){if(this.form.valid&&this.inputOne?.value){let t=this.inputOne?.value+this.inputTwo?.value+this.inputThree?.value+this.inputFour?.value+this.inputFive?.value+this.inputSix?.value;this.cartDeliveryAddressService.handleVerifyNewAddressOTP(t),this.track("Add Address - Validate PIN")}}forceCheckSMSCode(t){t&&(this.cartDeliveryAddressService.handleVerifyNewAddressOTP("",t),this.track("Add Address - Validate PIN"))}sendCodeAgain(){this.startCountdown(),this.cartDeliveryAddressService.generateNewAddressOTP(),this.track("Add Address - Resend PIN")}switchInput(t,i){let n=document.getElementById("one"),a=document.getElementById("two"),r=document.getElementById("three"),h=document.getElementById("four"),c=document.getElementById("five"),y=document.getElementById("six");if(n.value.length===6){let p=n.value;n.value="",this.inputOne?.setValue(p[0]),n.value=p[0],this.inputTwo?.setValue(p[1]),a.value=p[1],this.inputThree?.setValue(p[2]),r.value=p[2],this.inputFour?.setValue(p[3]),h.value=p[3],this.inputFive?.setValue(p[4]),c.value=p[4],this.inputSix?.setValue(p[5]),y.value=p[5],y.focus();return}if(n.value&&n.value.length>1){n.value="";return}if(a.value&&a.value.length>1){a.value="";return}if(r.value&&r.value.length>1){r.value="";return}if(h.value&&h.value.length>1){h.value="";return}if(c.value&&c.value.length>1){c.value="";return}if(y.value&&y.value.length>1){y.value="";return}if(i==="one"&&n.value.length===1){a?.focus();return}if(i==="two"&&a.value.length===1){r?.focus();return}if(i==="three"&&r.value.length===1){h?.focus();return}if(i==="four"&&h.value.length===1){c?.focus();return}i==="five"&&c.value.length===1&&y?.focus(),t.key==="Backspace"&&(i==="six"&&(y.value="",c.focus()),i==="five"&&(c.value="",h.focus()),i==="four"&&(h.value="",r.focus()),i==="three"&&(r.value="",a.focus()),i==="two"&&(a.value="",n.focus()),i==="one"&&(n.value=""))}checkIfNeedToDisableButtons(){this.generateNewAddressOTP$.pipe(J(this.destroyed$)).subscribe(t=>{t.errors?t.errors.forEach(i=>{this.disableResendButton=i.extensions.errorCode===this.generateNewClientAcquisitionOTPTypeErrors.maxOtpCodesGenerationAttempts}):this.disableResendButton=!1}),this.verifyNewAddressOTP$.pipe(J(this.destroyed$)).subscribe(t=>{t.errors?t.errors.forEach(i=>{this.disableValidationButton=i.extensions.errorCode===this.validationNumberTypeErrors.maxOtpCodesVerificationAttempts}):this.disableValidationButton=!1})}cancel(){this.dialogRef.close(),this.closeAddressForm()}closeAddressForm(){this.cartDeliveryAddressService._newCustomerDeliveryAddress.next({}),this.cartDeliveryAddressService.handleCloseDeliveryAddressForm(),this.track("Cancel Add Address")}track(t){let i={event:_t.MIKRO_USER_CLICK,event_action:ft.CHECKOUT_DELIVERY_OPTIONS,event_category:gt.CHECKOUT,event_label:t,event_value:xt.ZERO};Ct.analyticsPush(i)}startCountdown(){this.countdownCompleted=!1;let t=60;this.countdown$=we(1e3).pipe(W(t+1),v(i=>t-i),v(i=>(this.countdownCompleted=i===0,i)))}};o.\u0275fac=function(i){return new(i||o)(N(it),N(se),N(Mt),N(Ut),N(Ee),N(ot))},o.\u0275cmp=Pe({type:o,selectors:[["oro-otp-address-validation"]],hostBindings:function(i,n){i&1&&k("click",function(r){return n.onClick(r)},!1,De)},standalone:!0,features:[Ne,Be],decls:4,vars:11,consts:[[1,"otp-modal"],[1,"otp-modal__header"],[1,"otp-modal__tile"],["aria-label","Close",1,"otp-modal__close-button",3,"click"],["aria-hidden","true"],[1,"otp-modal__body"],[1,"otp-modal__description"],[1,"otp-modal__form",3,"formGroup"],["matInput","","type","text",1,"otp-modal__input",3,"formControlName","id"],[1,"otp-modal__error"],[1,"otp-modal__retry"],[1,"otp-modal__retry-text"],[1,"otp-modal__retry-button",3,"click","disabled"],[1,"otp-modal__footer"],[1,"btn","btn-primary",3,"click","disabled"],[1,"btn","btn-danger"],["height","15px","width","99px",2,"display","inline-block"],["matInput","","type","text",1,"otp-modal__input",3,"keyup","formControlName","id"],["type","error",1,"otp-modal__alert"],[1,"btn","btn-danger",3,"click"]],template:function(i,n){if(i&1&&(L(0,fi,31,15,"div",0),P(1,"async"),P(2,"async"),P(3,"async")),i&2){let a;F(0,(a=Me(7,Ht,E(1,1,n.cartStatus$),E(2,3,n.generateNewAddressOTP$),E(3,5,n.verifyNewAddressOTP$)))?0:-1,a)}},dependencies:[Ft,Ot,vt,yt,At,Tt,bt,It,Pt,wt,$e,St],styles:[".mat-mdc-dialog-container{border-radius:4px!important;padding:0;margin:1rem}  .mat-mdc-dialog-container .mat-mdc-dialog-surface{padding:0}  body.modal-open{height:100vh;overflow-y:hidden}.otp-modal__header[_ngcontent-%COMP%]{position:relative;display:flex;align-items:flex-start;justify-content:space-between;padding:16px 40px;border-bottom:1px solid #DDDDDD;border-top-left-radius:0;border-top-right-radius:0}.otp-modal__title[_ngcontent-%COMP%]{font-size:21px;line-height:26px;margin-bottom:0}.otp-modal__close-button[_ngcontent-%COMP%]{position:absolute;right:2.3rem;top:2.3rem;padding:15px;margin:-2rem -2rem -2rem auto;background:none;border:none;font-size:calc(1.275rem + .3vw);cursor:pointer;font-weight:bolder}.otp-modal__body[_ngcontent-%COMP%]{padding:20px 1rem}.otp-modal__description[_ngcontent-%COMP%]{margin-bottom:16px;font-size:1rem;line-height:24px}.otp-modal__form[_ngcontent-%COMP%]{display:flex;flex-direction:row;column-gap:6px}.otp-modal__input[_ngcontent-%COMP%]{width:45px;height:48px;border-radius:6px;outline:none;font-size:40px;line-height:40px;font-weight:700;text-align:center;border:2px solid #979797;caret-color:#ff7900;padding-inline:2px!important}.otp-modal__input[_ngcontent-%COMP%]::-webkit-inner-spin-button, .otp-modal__input[_ngcontent-%COMP%]::-webkit-outer-spin-button{display:none}.otp-modal__error[_ngcontent-%COMP%]{display:block;font-size:14px;line-height:18px;color:#cd3c14;margin:0;margin-top:1rem}.otp-modal__retry[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:center;margin-top:16px}.otp-modal__retry-text[_ngcontent-%COMP%]{font-size:12px;line-height:14px;color:#666;margin-bottom:0;margin-right:1rem}.otp-modal__retry-button[_ngcontent-%COMP%]{display:inline-block;border:none;font-size:12px;line-height:14px;box-shadow:none;background:transparent;padding:0;margin:0;color:#ff7900;cursor:pointer}.otp-modal__retry-button[_ngcontent-%COMP%]:disabled{color:#ccc!important;cursor:not-allowed}.otp-modal__alert[_ngcontent-%COMP%]{margin:1rem 0}.otp-modal__footer[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;padding:1.75rem;border-top:1px solid #DDDDDD}.otp-modal__footer[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{max-width:277px;width:100%;height:44px;margin:auto;font-size:1rem;font-weight:700;cursor:pointer;border:none}.otp-modal__footer[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]:disabled{cursor:not-allowed}.otp-modal__footer[_ngcontent-%COMP%]   button.btn-danger[_ngcontent-%COMP%]{margin-top:1rem}@media screen and (min-width: 768px){.otp-modal__header[_ngcontent-%COMP%]{padding:16px 40px}.otp-modal__body[_ngcontent-%COMP%]{padding:20px 40px}.otp-modal__description[_ngcontent-%COMP%]{font-size:17px;margin-bottom:36px}.otp-modal__input[_ngcontent-%COMP%]{width:60px;height:63px;font-size:51px;line-height:31px}.otp-modal__retry-text[_ngcontent-%COMP%], .otp-modal__retry-button[_ngcontent-%COMP%]{font-size:14px;line-height:18px}.otp-modal__footer[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{max-width:277px;width:100%;height:44px;margin:auto}}"]});let e=o;return e})();var xi={withCredentials:!0};function Ci(e){return et((o,s)=>o.address?.addressId===s.address?.addressId,e)}var Ut=(()=>{let o=class o{constructor(t,i,n,a,r,h){this.storeSelector=t,this.store=i,this.actions$=n,this.http=a,this.matDialog=r,this.relatedProductsService=h,this._newCustomerDeliveryAddress=new b({}),this.setDeliveryAddressSuccess$=new ue,this.deliveryAddressChanged$=new ue,this._fixedLocationContactPersonSource=new b({}),this.fixedLocationContactPerson$=this._fixedLocationContactPersonSource.asObservable(),this._selectedDeliveryAddressErrorSource=new b(!1),this.selectedDeliveryAddressError$=this._selectedDeliveryAddressErrorSource.asObservable(),this._deliveryAddressDataSource=new b({}),this.deliveryAddressData$=this._deliveryAddressDataSource.asObservable(),this._deliveryAddressFormIsVisibleSource=new b(!1),this.deliveryAddressFormIsVisible$=this._deliveryAddressFormIsVisibleSource.asObservable(),this._billingAddressDataSource=new b({}),this.billingAddressData$=this._billingAddressDataSource.asObservable(),this._billingAddressFormIsVisibleSource=new b(!1),this.billingAddressFormIsVisible$=this._billingAddressFormIsVisibleSource.asObservable(),this._addressFormIsVisibleSource=new b(!1),this.addressFormVisible$=this._addressFormIsVisibleSource.asObservable(),this._addressToggleAriadNextSource=new b(!1),this.addressToggleAriadNext$=this._addressToggleAriadNextSource.asObservable(),this.deliveryFormCompleted$=new Te,this._preferredNotificationChannelSource=new b(!1),this.preferredNotificationChannel$=this._preferredNotificationChannelSource.asObservable(),this._isBillingAddressEditForm=new b(!1),this.isBillingAddressEditForm$=this._isBillingAddressEditForm.asObservable(),this.deliveryAddressOpenContext=Ve(void 0),this.toggleAddressSubject=new b(null),this.toggleAddress$=this.toggleAddressSubject.asObservable(),this.editModeSubject=new b(null),this.editMode$=this.editModeSubject.asObservable()}getSelectedShippingAddress(){return G([this.getShippingAddressList().pipe(V()),this.storeSelector.getWithSelector(pe).pipe(V()),this.storeSelector.getWithSelector(xe).pipe(V()),this.storeSelector.getWithSelector(Ke()).pipe(V()),this.storeSelector.getWithSelector(Ye).pipe(V()),this.storeSelector.getWithSelector(T).pipe(V())]).pipe(D(([t,i,n,a,r,h])=>h.status!==O.loading&&h.cart?.__typename==="PendingCartResource"),v(([t,i,n,a,r,h])=>{if(this.isLoggedIn=n,this.selectorCartItemIsOfyOrLoy=a,this.hasAtLeastOneLoyaltyProduct=r,i?.address?.addressId){let c=t.find(y=>i.address.addressId===y.address?.addressId&&H(y.party,i.party));if(c)return this.checkShippingAddressIsComplete(c),c}else if(n){let c=t.find(({isSelected:p})=>p)||t[0],y=h.cart.shipping?.shippingType.selection;return this.checkShippingAddressIsComplete(c),c&&(!y||y===ze.Customer)&&this.store.dispatch(Se({address:c})),c}})).pipe(D(t=>!!t?.party?.type||!t)).pipe(Y(1))}getSelectedBillingAddress(){return G([this.getBillingAddressList(),this.storeSelector.getWithSelector(ce),this.storeSelector.getWithSelector(xe)]).pipe(v(([t,i,n])=>{if(i?.address?.addressId){let a=t.find(r=>i.address?.addressId===r.address?.addressId&&H(r.party,i.party));if(a)return a}else if(n){let a=t.find(({isSelected:r})=>r)||t[0];return a&&this.store.dispatch(Se({address:a})),a}})).pipe(D(t=>!!t?.party?.type||!t))}getShippingAddressList(){return this.storeSelector.getWithSelector(ge()).pipe(D(t=>t.status===O.success),v(t=>t.me?.ssoId),V(),v(t=>!!t),Z(t=>t?this.getLoggedInUserDeliveryAddresses():this.getGuestUserDeliveryAddresses()))}getBillingAddressList(){return this.storeSelector.getWithSelector(ge()).pipe(D(t=>t.status===O.success)).pipe(v(t=>!!t.me?.ssoId)).pipe(Z(t=>t?G([this.storeSelector.getWithSelector(tt),this.storeSelector.getWithSelector(Nt),this.storeSelector.getWithSelector(Fe),this.storeSelector.getWithSelector(ce),this.storeSelector.getWithSelector(Fe).pipe(Z(i=>i?this.storeSelector.getWithSelector(je()).pipe(D(({status:n})=>n!==O.loading)).pipe(v(({list:n})=>n)):K([])))]).pipe(v(([i,n,a,r,h])=>{if(!a&&r)return[g(u({},r),{isEditable:!1,isSelected:!0})];if(a&&r&&h?.length===0)return[g(u({},r),{isEditable:!0,isSelected:!0})];let c=h?Array.from(h):[];if(r&&r.address?.addressId){let p=c.find(M=>M.address?.addressId===r.address?.addressId&&H(r.party,M.party));if(!p&&(p=c.find(M=>M.address?.addressId===r.address?.addressId),p)){let M=c.indexOf(p);c[M]=g(u({},p),{party:r.party})}}if(n||!r?.party)return c;let y=c?.map(p=>g(u({},p),{party:r.party}));return Ci(y)})):this.storeSelector.getWithSelector(ce).pipe(v(i=>i?[g(u({},i),{isEditable:!0})]:[]))))}getSelectedDeliveryAddressError(){return this.selectedDeliveryAddressError$}deleteShippingAddressFromCart(){return this._deliveryAddressFormIsVisibleSource.next(!1),this._deliveryAddressDataSource.next({}),this.store.dispatch(ct()),this._addressFormIsVisibleSource.next(!1),this._addressToggleAriadNextSource.next(!1),me(this.actions$.pipe(X(pt)).pipe(q(!0)),this.actions$.pipe(X(ut)).pipe(q(!1)))}deleteBillingAddressFromCart(){return this._billingAddressFormIsVisibleSource.next(!1),this._billingAddressDataSource.next({}),this.store.dispatch(st({billing:null})),me(this.actions$.pipe(X(dt)).pipe(q(!0)),this.actions$.pipe(X(at)).pipe(q(!1)))}checkIfAddressIsCorrect(t){t.address&&!t.address.county.name||t.address&&!t.address.locality.name||t.address&&!t.address.street?.name&&!t.address.streetName||t.party&&!t.party.name?this._selectedDeliveryAddressErrorSource.next(!0):this._selectedDeliveryAddressErrorSource.next(!1)}getDeliveryAddressData(){return this.deliveryAddressData$}getIsDeliveryFormCompleted(){return this.deliveryFormCompleted$}setIsDeliveryFormCompleted(t){return this.deliveryFormCompleted$.next(t)}getDeliveryAddressFormIsVisible(){return this.deliveryAddressFormIsVisible$}handleCloseDeliveryAddressForm(){this._deliveryAddressFormIsVisibleSource.next(!1),this._deliveryAddressDataSource.next({}),this._addressFormIsVisibleSource.next(!1),this._addressToggleAriadNextSource.next(!1)}handleAddDeliveryAddress(){this._deliveryAddressFormIsVisibleSource.next(!0),this._addressFormIsVisibleSource.next(!0),this.deliveryAddressOpenContext.set("Add"),this.handleCloseBillingAddressForm()}handleEditDeliveryAddress(t,i){this._deliveryAddressDataSource.next({deliveryAddress:t,options:i}),this._deliveryAddressFormIsVisibleSource.next(!0),this._addressFormIsVisibleSource.next(!0),this.deliveryAddressOpenContext.set("Edit"),this.handleCloseBillingAddressForm()}getBillingAddressData(){return this.billingAddressData$}getBillingAddressFormIsVisible(){return this.billingAddressFormIsVisible$}handleCloseBillingAddressForm(){this._billingAddressFormIsVisibleSource.next(!1),this._billingAddressDataSource.next({})}handleAddBillingAddress(){this._isBillingAddressEditForm.next(!1),this._billingAddressFormIsVisibleSource.next(!0),this.handleCloseDeliveryAddressForm()}handleActivateEditForCompany(){this._isBillingAddressEditForm.next(!0)}handleEditBillingAddress(t,i){this._isBillingAddressEditForm.next(!0),this._billingAddressDataSource.next({billingAddress:t,options:i}),this._billingAddressFormIsVisibleSource.next(!0),this.handleCloseDeliveryAddressForm()}handleEditBillingAddressForCompany(t,i){this._isBillingAddressEditForm.next(!1),this._billingAddressDataSource.next({billingAddress:t,options:i}),this._billingAddressFormIsVisibleSource.next(!0)}handleSelectAddress(t){t.type===ne.BILLING&&this.store.dispatch(He({selection:Ce.Customer})),!t.party?.type||!t.party?.name?t.type===ne.BILLING?this.handleEditBillingAddress(t,{autoDirty:!0}):(this.selectorCartItemIsOfyOrLoy||this.hasAtLeastOneLoyaltyProduct)&&t&&!t.otpValidated&&this.isLoggedIn?this.storeSelector.getWithSelector(j).pipe(W(1)).subscribe(i=>{i.verified?this.handleEditDeliveryAddress(t,{autoDirty:!0,emailValueSet:!1}):this.handleGenerateNewAddressOTP(!1,t)}):this.handleEditDeliveryAddress(t,{autoDirty:!0,emailValueSet:!1}):t?.type===ne.BILLING&&t.party?.type!==qe.Person?this.handleEditBillingAddressForCompany(t,{autoDirty:!0}):(this.selectorCartItemIsOfyOrLoy||this.hasAtLeastOneLoyaltyProduct)&&t&&!t.otpValidated&&this.isLoggedIn?this.storeSelector.getWithSelector(j).pipe(W(1)).subscribe(i=>{i.verified?(this.store.dispatch(Ae({addressType:null})),this.store.dispatch(ve({address:t}))):this.handleGenerateNewAddressOTP()}):(this.store.dispatch(Ae({addressType:null})),this.store.dispatch(ve({address:t})))}mapAddressToCommonObject(t,i){return i&&t.address&&(t.address=ae("zipCode",t.address),t.address.locality=ae("zipCode",t.address.locality),t.address.street=ae("zipCode",t.address.street)),t.address=t.address,t.address.apartment=t.address?.apartment?t.address.apartment:"",t.address.building=t.address?.building?t.address.building:"",t.address.streetNo=t.address?.streetNo?t.address.streetNo:"",t.address.staircase=t.address?.staircase?t.address.staircase:"",t}getAddressFormIsVisible(){return this.addressFormVisible$}setAddressToggleAriadNext(t){return this._addressToggleAriadNextSource.next(t)}getAddressToggleAriadNext(){return this.addressToggleAriadNext$}setFixedLocationContactPerson(t,i=!0){this._fixedLocationContactPersonSource.next(t),i&&this.store.dispatch(lt({shippingTypeSelection:Ce.FixedLocation}))}getNotificationChannelByOCN(){return this.http.get(`${Re.getCartV2ApiUrl()}/consent/notification-channel`,g(u({},xi),{responseType:"text"}))}getPreferredNotificationChannel(){return this.preferredNotificationChannel$}setPreferredNotificationChannel(t){return this._preferredNotificationChannelSource.next(t)}generateNewAddressOTP(){this.store.dispatch(mt())}handleGenerateNewAddressOTP(t,i){return this.generateNewAddressOTP(),this.dialogRef=this.matDialog.open(Rt,{maxWidth:"500px",data:{isCompleteOrder:t}}),this.dialogRef.afterClosed()}handleVerifyNewAddressOTP(t,i){this.store.dispatch(ht({code:t,forced:i}))}toggleAddressUsage(t){this.toggleAddressSubject.next(t)}setEditMode(t){this.editModeSubject.next(t)}getLoggedInUserDeliveryAddresses(){return G([this.storeSelector.getWithSelector(pe),this.storeSelector.getWithSelector(Xe()).pipe(D(t=>t.status===O.success),v(t=>t.list||[]))]).pipe(v(([t,i])=>this.mergeDeliveryAddresses(i,t)))}getGuestUserDeliveryAddresses(){return this.storeSelector.getWithSelector(pe).pipe(v(t=>t?[g(u({},t),{isEditable:!0,isKeepBillingDataToggled:t.isKeepBillingDataToggled})]:[]))}mergeDeliveryAddresses(t,i){if(!i?.address?.addressId)return t;let n=Array.from(t),a=this.findDeliveryAddressInList(i,n);if(a){let r=n.indexOf(a);n[r]=g(u({},a),{party:i.party})}return n}findDeliveryAddressInList(t,i){return i.find(n=>n.address?.addressId===t.address?.addressId&&H(t.party,n.party))||i.find(n=>n.address?.addressId===t.address?.addressId)}checkShippingAddressIsComplete(t){t?.address&&(!t?.party||!t?.party?.name||!t?.party?.email||!t?.party?.phone)&&this.handleEditDeliveryAddress(t)}};o.\u0275fac=function(i){return new(i||o)(w(se),w(Ue),w(nt),w(re),w(rt),w(Et))},o.\u0275prov=Q({token:o,factory:o.\u0275fac,providedIn:"root"});let e=o;return e})(),Si=function(e){return e.BILLING="BILLING",e.INSTALLATION="INSTALLATION",e}(Si||{});export{yi as a,Ai as b,Li as c,Oi as d,bi as e,Ii as f,Fi as g,Ti as h,wi as i,Dt as j,Pi as k,Ei as l,Di as m,Vi as n,Ni as o,ki as p,Bi as q,Mi as r,$i as s,Ri as t,Ui as u,Gi as v,Wi as w,Oe as x,qi as y,zi as z,Hi as A,Xi as B,ji as C,Vt as D,ro as E,no as F,so as G,lo as H,co as I,po as J,uo as K,mo as L,ho as M,_o as N,fo as O,go as P,Co as Q,So as R,vo as S,yo as T,Ao as U,de as V,le as W,Oo as X,Mt as Y,Eo as Z,Fe as _,Nt as $,Do as aa,ce as ba,pe as ca,Vo as da,j as ea,No as fa,ko as ga,Bo as ha,Ut as ia,Si as ja};