1import{g as pt,h as zt}from"./chunk-R4RNHZH6.js";import{a as ut,b as dt,c as kt}from"./chunk-SS2RCXOJ.js";import{e as lt,f as Rt}from"./chunk-FBXIJRUP.js";import{d as mt,h as Pt}from"./chunk-FZR4JGNM.js";import{R as S,W as _,a as z,aa as Tt,b as bt}from"./chunk-H5WV6CFL.js";import{Bc as Nt,Nb as st,O as Q,P as q,V as R,X as H,ab as et,fa as Y,ga as tt,nb as ot,sc as rt,tb as it}from"./chunk-LX5UYXNU.js";import{a as at,b as Et}from"./chunk-5TPB6CJJ.js";import{D as _t,a as D,d as vt,e as f,f as A,q as nt,r as X,w as L,y as ct}from"./chunk-OTRHGGDZ.js";import{Dd as Z,Ec as T,Fc as j,Ga as U,Hd as $,Kb as M,N as b,T as v,Tc as y,Ud as E,fc as V,hc as G,ka as Dt,mc as C,nc as m,oc as u,pa as B,pc as k,sb as O,tc as K,ua as g,uc as W,xb as F}from"./chunk-FJ6SICJU.js";import{f as N,j as a,k as I,l as x}from"./chunk-VA6OWENO.js";var ht,Bt,ft,At=N(()=>{"use strict";L();ht=({egon:r})=>r,Bt=X(ht,r=>r),ft=X(ht,r=>r.autocompleteSuggestions)});var St,Mt,Vt,Gt,Kt,Wt,jt,Zt,gt=N(()=>{"use strict";L();St=f("[App] Get Address Autocomplete",A()),Mt=f("[App] Get Address Autocomplete Success",A()),Vt=f("[App] Get Address Autocomplete Failure",A()),Gt=f("[App] Normalize Address",A()),Kt=f("[App] Normalize Address Success",A()),Wt=f("[App] Normalize Address KO Warnings",A()),jt=f("[App] Normalize Address KO Suggestion",A()),Zt=f("[App] Normalize Address Failure",A())});var J,Ct=N(()=>{"use strict";J=r=>{let n=new URLSearchParams;return Object.entries(r).forEach(([s,d])=>{d!=null&&n.append(s,d)}),n.toString()}});var It,xt=N(()=>{"use strict";E();bt();Rt();Ct();E();It=(()=>{var n;let s=class s{constructor(){I(this,n);x(this,n,g(lt)),this.getAddressAutocomplete=l=>{let p=J(l),P=this.buildUrl(`/egon/autocomplete?${p}`);return a(this,n).get(P)},this.normalizeAddress=l=>{let p=J(l),P=this.buildUrl(`/egon/normalize?${p}`);return a(this,n).post(P)},this.buildUrl=l=>`{{baseUrl}}/${z.urls.api.baseSite}/${z.urls.api.baseSiteVersion}/${z.urls.api.baseSiteId}${l}&app_version={{appVersion}}&access_token={{accessToken}}`}};n=new WeakMap,s.\u0275fac=function(p){return new(p||s)},s.\u0275prov=B({token:s,factory:s.\u0275fac,providedIn:"root"});let r=s;return r})()});function Lt(r,n){if(r&1&&k(0,"app-icon",12),r&2){let s=j();C("name",s.civicIcon)}}var ye,Jt=N(()=>{"use strict";E();tt();Nt();zt();Et();Pt();At();L();Dt();vt();Tt();gt();kt();xt();_t();E();tt();ye=(()=>{var n,s,d,l;let p=class p{constructor(){I(this,n);I(this,s);I(this,d);I(this,l);x(this,n,g(nt)),x(this,s,g(U)),x(this,d,g($)),x(this,l,g(It)),this.isDesktop$=a(this,n).select(ct),this.addressResult=new F,this.autocompleteSuggestions=a(this,n).select(ft),this.zips=[],this.departments=[],this.localities=[],this.streets=[],this.civics=[],this.suffixIcon={zip:"",department:"",locality:"",street:"",civic:""},this.selectEvent=Z(),this.WARN="warn",this.OK="ok",this.rootFormGroup=g(R)}ngOnInit(){this.form=this.rootFormGroup.control,this.listenFormControls(),this.assignSuffixIconOk(),this.autocompleteSuggestions.pipe(D(a(this,s))).subscribe({next:t=>{t&&this.parseResponse(t)}})}normalizeAddress(){let t=this.form.value,i={zip:S(this.controls[this.zip].value)?this.controls[this.zip].value:this.controls[this.zip].value.zip,department:S(this.controls[this.department].value)?this.controls[this.department].value:this.controls[this.department].value.department,town:S(this.controls[this.locality].value)?this.controls[this.locality].value:this.controls[this.locality].value.locality,street:S(this.controls[this.street].value)?this.controls[this.street].value:this.controls[this.street].value.street,civic:this.controls[this.civic].value};a(this,l).normalizeAddress(i).subscribe({next:e=>{e.blocker?(this.addressResult.emit({status:"error"}),this.suffixIcon.zip=this.WARN,this.suffixIcon.department=this.WARN,this.suffixIcon.locality=this.WARN,this.suffixIcon.street=this.WARN,this.suffixIcon.civic=this.WARN):(e.status==="OK"||e.status==="KO"&&t.modify)&&!e.suggestions?this.addressResult.emit({status:"success",response:e}):e.suggestions?this.addressResult.emit({status:"suggestions",response:e}):this.addressResult.emit({status:"no-suggestions",response:e}),a(this,d).detectChanges()},error:()=>{this.addressResult.emit({status:"error"})}})}getErrorText(t){let i=dt[t]||ut;return mt(this.form,t,i)}get controls(){return this.form.controls}listenFormControls(){this.controls[this.zip]?.valueChanges.pipe(b(400),v(),D(a(this,s))).subscribe({next:t=>{!_(t)&&S(t)&&t.length>=5&&this.dispatchAutocomplete("zip",t),(this.suffixIcon.zip===this.WARN||!t)&&(this.suffixIcon.zip="")}}),this.controls[this.department]?.valueChanges.pipe(b(400),v(),D(a(this,s))).subscribe({next:t=>{!_(t)&&S(t)&&t.length>=3&&this.dispatchAutocomplete("department",t),t||(this.controls.egonCodeDepartment.setValue(""),this.localities=[]),(this.suffixIcon.department===this.WARN||!t)&&(this.suffixIcon.department="")}}),this.controls[this.locality]?.valueChanges.pipe(b(400),v(),D(a(this,s))).subscribe({next:t=>{!_(t)&&S(t)&&t.length>=2&&this.dispatchAutocomplete("locality",t,this.controls.egonCodeDepartment.value),t||(this.controls.egonCodeCity.setValue(""),this.streets=[]),(this.suffixIcon.locality===this.WARN||!t)&&(this.suffixIcon.locality="")}}),this.controls[this.street]?.valueChanges.pipe(b(400),v(),D(a(this,s))).subscribe({next:t=>{!_(t)&&S(t)&&t.length>=3&&this.dispatchAutocomplete("street",t,this.controls.egonCodeCity.value),(this.suffixIcon.street===this.WARN||!t)&&(this.suffixIcon.street="")}})}get civicIcon(){let t="";return this.form.get(this.civic)?.valid&&(t="checked-green",this.suffixIcon?.civic==="warn"&&(t="exclamation")),t}parseResponse(t){let i=JSON.parse(t);
1switch(this.searchType){case"zip":if(i.ZIP_AREA_OUT){let{count:e,options:c}=this.transformAndAssign("CDXZIP",i.ZIP_AREA_OUT);this.zips=c,this.suffixIcon.zip=e===0?"hint":""}break;case"department":if(i.DPT_AREA_OUT){let{count:e,options:c}=this.transformAndAssign("DSXOBJDPT",i.DPT_AREA_OUT);this.departments=c,this.suffixIcon.department=e===0?"hint":""}break;case"locality":if(i.LOC_AREA_OUT){let{count:e,options:c}=this.transformAndAssign("DSXOBJCNL",i.LOC_AREA_OUT);this.localities=c,this.suffixIcon.locality=e===0?"hint":""}break;case"street":if(i.STR_AREA_OUT){let{count:e,options:c}=this.transformAndAssign("DSXOBJSTR",i.STR_AREA_OUT);this.streets=c,this.suffixIcon.street=e===0?"hint":""}break;default:break}a(this,d).detectChanges()}dispatchAutocomplete(t,i,e){this.searchType=t;let c={searchType:t,digit:i,egonCode:e};a(this,n).dispatch(St({payload:c}))}transformAndAssign(t,i){let e=["47892","47893","47894","47895","47896","47897","47898","47890","47899","47891"],c=Object.keys(i),h=c.findIndex(o=>o.includes("NR9")),Ot=h===0?1:0,yt=i[c[h]].lValue,w=[];return i[c[Ot]].forEach(o=>{w.push({id:t,name:t==="CDXZIP"?o?.DSXOBJCNL:o?.[t],zip:o?.CDXZIP,department:o?.DSXOBJDPT,locality:(o?.DSXOBJDS1?o.DSXOBJDS1+" - ":"")+(o?.DSXOBJDS2?o.DSXOBJDS2+" - ":"")+(o?.DSXOBJDS3?o.DSXOBJDS3+" - ":"")+(o?.DSXOBJCNL?o.DSXOBJCNL:""),street:o?.DSXOBJSTR,countryIso:o?.DSXSGXCNY,egonCodeCity:o?.CDPOBJCNL?o?.CDPOBJCNL?.lValue:"",egonCodeDepartment:o?.CDPOBJDPT?o?.CDPOBJDPT?.lValue:"",egonCodeStreet:o?.CDPOBJSTR?o?.CDPOBJSTR?.lValue:"",civic:o?.NRPNUMCIV?o?.DSXESP===""?o?.NRPNUMCIV?.lValue:o?.NRPNUMCIV?.lValue+" "+o?.DSXESP:"",isSanMarino:o?.DSXOBJCNL&&o?.DSXOBJCNL?.toLowerCase()==="repubblica di san marino"||o?.CDXZIP&&e.indexOf(o?.CDXZIP)!==-1||!1})}),{count:yt,options:w}}assignSuffixIconOk(){this.suffixIcon.zip=this.controls[this.zip].value?this.OK:"",this.suffixIcon.department=this.controls[this.department].value?this.OK:"",this.suffixIcon.locality=this.controls[this.locality].value?this.OK:"",this.suffixIcon.street=this.controls[this.street].value?this.OK:"",this.suffixIcon.civic=this.controls[this.civic].value?this.OK:""}onSelect(t){this.selectEvent.emit(t),this.assignSuffixIconOk()}};n=new WeakMap,s=new WeakMap,d=new WeakMap,l=new WeakMap,p.\u0275fac=function(i){return new(i||p)},p.\u0275cmp=M({type:p,selectors:[["app-address-location"]],inputs:{zip:"zip",department:"department",locality:"locality",street:"street",civic:"civic"},outputs:{addressResult:"addressResult",selectEvent:"selectEvent"},decls:24,vars:25,consts:[[3,"formGroup"],[1,"form"],["size","4"],[1,"form-label","is-required"],["ariaLabel","CAP",3,"selected","controlName","keyword","options","suffixIcon","number","errorText"],["size","7"],["ariaLabel","Provincia",3,"selected","controlName","keyword","options","suffixIcon","errorText"],["size","12"],["label","locality","ariaLabel","Citt\xE0",3,"selected","controlName","keyword","options","suffixIcon","errorText"],["ariaLabel","Indirizzo",3,"selected","controlName","keyword","options","suffixIcon","errorText"],[1,"form-input-item"],["aria-label","Numero civico",3,"formControlName","errorText"],["size","1rem",1,"suffix-icon",3,"name"]],template:function(i,e){i&1&&(K(0,0),m(1,"ion-row",1)(2,"ion-col",2)(3,"ion-label",3),y(4,"CAP"),u(),m(5,"app-autocomplete",4),T("selected",function(h){return e.onSelect(h)}),u()(),m(6,"ion-col",5)(7,"ion-label",3),y(8,"Provincia"),u(),m(9,"app-autocomplete",6),T("selected",function(h){return e.onSelect(h)}),u()(),m(10,"ion-col",7)(11,"ion-label",3),y(12,"Citt\xE0"),u(),m(13,"app-autocomplete",8),T("selected",function(h){return e.onSelect(h)}),u()(),m(14,"ion-col",5)(15,"ion-label",3),y(16,"Indirizzo"),u(),m(17,"app-autocomplete",9),T("selected",function(h){return e.onSelect(h)}),u()(),m(18,"ion-col",2)(19,"ion-label",3),y(20,"Numero civico"),u(),m(21,"ion-item",10),k(22,"ion-input",11),V(23,Lt,1,1,"app-icon",12),u()()(),W()),i&2&&(C("formGroup",e.form),O(5),C("controlName",e.zip)("keyword","zip")("options",e.zips)("suffixIcon",e.suffixIcon.zip)("number",!0)("errorText",e.getErrorText(e.zip)),O(4),C("controlName",e.department)("keyword","department")("options",e.departments)("suffixIcon",e.suffixIcon.department)("errorText",e.getErrorText(e.department)),O(4),C("controlName",e.locality)("keyword","locality")("options",e.localities)("suffixIcon",e.suffixIcon.locality)("errorText",e.getErrorText(e.locality)),O(4),C("controlName",e.street)("keyword","street")("options",e.streets)("suffixIcon",e.suffixIcon.street)("errorText",e.getErrorText(e.street)),O(5),C("formControlName",e.civic)("errorText",e.getErrorText(e.civic)),O(),G(e.civicIcon?23:-1))},dependencies:[pt,at,ot,rt,it,st,et,Y,Q,q,R,H],styles:["ion-row.form[_ngcontent-%COMP%]{justify-content:space-between}ion-row.form[_ngcontent-%COMP%] ion-col[_ngcontent-%COMP%]:not(:nth-last-child(-n+2)){margin-bottom:1.63rem}.suffix-icon[_ngcontent-%COMP%]{position:absolute;top:.9rem;right:.75rem}"]});let r=p;return r})()});
1export{ft as a,At as b,St as c,Mt as d,Vt as e,Gt as f,Kt as g,Wt as h,jt as i,Zt as j,gt as k,It as l,xt as m,ye as n,Jt as o};
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.