1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2651],{32651:function(e,t,l){l.r(t);var o=l(57437);l(20592);var n=l(57659),i=l(58746),r=l(1588),a=l(21936),s=l(68039),d=l.n(s),c=l(37465),u=l.n(c),m=l(2265),h=l(74140),p=l(21056),x=l(18772),g=l(9668),f=l(23332),v=l(74332),y=l(45799);let j={lat:48.8586047,lng:2.3137325},w=e=>u().divIcon({className:"proposal-address-pin",html:(0,v.Dq)((0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.JO,{name:(null==e?void 0:e.icon)?n.NQ.PinFull:n.NQ.Pin,size:n.WD.Xl,color:(null==e?void 0:e.color)||"primary.base"}),(null==e?void 0:e.icon)&&(0,o.jsx)(n.JO,{name:(0,r.Z)(e.icon),size:n.WD.Sm,color:"white"})]})),iconSize:[40,40],iconAnchor:[20,40]}),C=async(e,t)=>{try{var l;let o=new window.google.maps.Geocoder,n=await o.geocode({location:{lat:e,lng:t}});if(null===(l=n.results)||void 0===l?void 0:l[0])return{...n.results[0],geometry:{...n.results[0].geometry,location:{lat:e,lng:t}}};return null}catch(e){return null}},z=e=>{let{onMapClick:t,onDiscoverPaneClose:l}=e;return(0,h.zV)({click(e){l(),t(e.latlng.lat,e.latlng.lng)},zoomstart:l}),null},b=e=>{let{position:t}=e,l=(0,h.Sx)();return m.useEffect(()=>{t&&l.flyTo([t.lat,t.lng],18)},[t,l]),null},k=()=>{let e=(0,h.Sx)();return m.useEffect(()=>{let t=setTimeout(()=>{e.invalidateSize()},100);return()=>clearTimeout(t)},[e]),null};t.default=e=>{var t;let{show:l,onClose:r,onConfirm:s,initialAddress:c,mapCenter:u,category:h,proposalInAZoneRequired:v,districts:S,onDistrictChange:_}=e,E=(0,y.Z)(),[I,L]=m.useState(c),[N,Z]=m.useState((null==c?void 0:c.formatted_address)||""),[M,P]=m.useState(null),[W,D]=m.useState(!c);m.useEffect(()=>{l&&(L(c),Z((null==c?void 0:c.formatted_address)||""),P(null),D(!c))},[l,c]);let Q=(null==c?void 0:null===(t=c.geometry)||void 0===t?void 0:t.location)||u||j,T=(0,i.qy)(S),q=e=>S.find(t=>{let[l]=(0,i.qy)([t]);return l&&new(d())(l.district).hasContainers({type:"Point",coordinates:[e.lng,e.lat]})}),F=e=>!!q(e),J=async(e,t)=>{if(v&&!F({lat:e,lng:t}))return;let l=await C(e,t);l&&(L(l),Z(l.formatted_address))},X=async e=>{try{let t=await (0,f.NU)(e);if(null==t?void 0:t[0]){let e=await (0,f.WV)(t[0]),l={...t[0],geometry:{...t[0].geometry,location:{lat:e.lat,lng:e.lng}}};if(v&&!F(l.geometry.location))return;L(l),Z(l.formatted_address),P(l.geometry.location),D(!1)}}catch(e){console.error("Error geocoding address:",e)}};return l?(0,o.jsxs)(n.u_,{show:!0,ariaLabel:E.formatMessage({id:"front.proposal.locate-on-map"}),size:n.CL.Xl,onClose:r,children:[(0,o.jsx)(n.u_.Header,{children:(0,o.jsx)(n.X6,{children:E.formatMessage({id:"front.proposal.locate-on-map"})})}),(0,o.jsx)(n.u_.Body,{p:0,children:(0,o.jsxs)(n.xu,{position:"relative",height:["calc(100vh - 100px)","550px"],children:[(0,o.jsx)(n.xu,{position:"absolute",top:"10px",left:"10px",zIndex:1001,width:["calc(100% - 20px)","66%"],maxWidth:"480px",children:(0,o.jsx)(f.ZP,{value:N,onChange:Z,onSelect:X,children:e=>{let{getInputProps:t,suggestions:l,getSuggestionItemProps:i}=e;return(0,o.jsxs)(n.xu,{position:"relative",children:[(0,o.jsx)(n.II,{...t({placeholder:E.formatMessage({id:"proposal.map.form.placeholder"})}),width:"100%"}),l.length>0&&(0,o.jsx)(n.Lt,{zIndex:1002,width:"100%",children:l.map(e=>(0,o.jsx)(n.Lt.Item,{...i(e),children:e.description},e.placeId))})]})}})}),(0,o.jsxs)(p.h,{center:Q,zoom:16,maxZoom:18,zoomControl:!1,doubleClickZoom:!1,scrollWheelZoom:!1,style:{width:"100%",height:"100%"},children:[(0,o.jsx)(k,{}),(0,o.jsx)(z,{onMapClick:J,onDiscoverPaneClose:()=>D(!1)}),(0,o.jsx)(b,{position:M}),(0,o.jsx)(i.EE,{}),T.map(e=>(0,o.jsx)(x.Q,{data:e.district,style:(0,i.z7)(e.style)},e.id)),W&&(0,o.jsx)(a.Z,{type:"SELECT",position:"bottomright",handleClose:()=>D(!1)}),I&&(0,o.jsx)(g.J,{position:[I.geometry.location.lat,I.geometry.location.lng],icon:w(h)})]})]})}),(0,o.jsx)(n.u_.Footer,{children:(0,o.jsxs)(n.kC,{justifyContent:"space-between",width:"100%",children:[(0,o.jsx)(n.zx,{leftIcon:n.NQ.LongArrowLeft,variant:"link",variantColor:"primary",onClick:r,children:E.formatMessage({id:"global.back"})}),(0,o.jsx)(n.zx,{disabled:!I,variantSize:"big",variant:"primary",onClick:()=>
1{if(I){if(v){let e=q(I.geometry.location);_((null==e?void 0:e.id)||null)}s(I),r()}},children:E.formatMessage({id:"validate-address"})})]})})]}):null}}}]);
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.