1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[184],{184:function(l,o,t){t.r(o);var e=t(828),i=t(9815),n=t(5893),d=t(7294),u=t(9008),r=t.n(u),a=t(356),s=t(8390),c=t(7520),v=function(l,o){return l.apply(Math,o)},g=function(l){var o,t,e=l.filter((function(l){var o;return Boolean(null===(o=l.location)||void 0===o?void 0:o.lat)})).map((function(l){var t;return null!==(o=null===(t=l.location)||void 0===t?void 0:t.lat)&&void 0!==o?o:0})),i=l.filter((function(l){var o;return Boolean(null===(o=l.location)||void 0===o?void 0:o.lng)})).map((function(l){var o;return null!==(t=null===(o=l.location)||void 0===o?void 0:o.lng)&&void 0!==t?t:0})),n=[[v(Math.min,i),v(Math.min,e)],[v(Math.max,i),v(Math.max,e)]],d=new a.DW({width:1e3,height:800}).fitBounds(n,{padding:200});return{longitude:d.longitude,latitude:d.latitude,zoom:d.zoom,cornersLngLat:n}},f=function(l){var o,t,e,i,d,u=l.producer,r=l.selectedProducer,s=l.setSelectedProducer,v=l.location,g=(null===r||void 0===r?void 0:r.id)===(null===u||void 0===u?void 0:u.id),f=null===u||void 0===u||null===(o=u.image)||void 0===o?void 0:o[0];return(0,n.jsx)(a.Jx,{latitude:null!==(i=v.latitude)&&void 0!==i?i:0,longitude:null!==(d=v.longitude)&&void 0!==d?d:0,offsetLeft:-20,offsetTop:-20,draggable:!1,className:g?"z-50":void 0,children:(0,n.jsxs)(c.Ly,{mode:"relative",className:"z-50",children:[u&&g?(0,n.jsxs)(c.Ly,{mode:"absolute",className:"bg-white shadow-lg",style:{width:270,left:"100%",top:"50%",transform:"translate(12px, -50%)"},children:[(0,n.jsx)("div",{className:"absolute bg-white",style:{width:16,height:16,left:0,top:"50%",transform:"rotate(45deg) translate(-12px, 0)"}}),(0,n.jsx)(c.T,{padding:"4",children:(0,n.jsxs)(c.rj,{gapY:"4",children:[(0,n.jsx)(c.GO,{ratio:"16/9",children:f?(0,n.jsx)(c.Ee,{srcSet:{sm:f.sm,md:f.md,lg:f.lg,xl:f.xl},alt:f.title,display:"fill"}):null}),(0,n.jsxs)(c.rj,{gapY:"1",children:[(0,n.jsx)(c.rU,{href:"/producers/".concat(u.slug),className:"hover:underline",children:(0,n.jsx)(c.X6,{level:"3",size:{default:"lg",md:"xl",lg:"2xl"},leading:"tight",children:null===u||void 0===u?void 0:u.title})}),(0,n.jsx)(c.xv,{size:{lg:"lg"},leading:"snug",className:"text-green",style:{textDecoration:"none !important"},children:null===(t=u.businessCategory)||void 0===t||null===(e=t[0])||void 0===e?void 0:e.title})]})]})})]}):null,(0,n.jsx)("button",{onClick:u&&s?function(){return s(u)}:void 0,children:(0,n.jsx)(p,{})})]})})},p=function(){return(0,n.jsx)(c.Ee,{src:"/assets/filled-pin.svg",alt:"Pin",fill:"contain",width:"40",height:"40"})};o.default=function(l){var o,t,u,c,v,p,m,h=l.location,x=l.producers,j={latitude:null!==(v=null===h||void 0===h?void 0:h.latitude)&&void 0!==v?v:52.3555,longitude:null!==(p=null===h||void 0===h?void 0:h.longitude)&&void 0!==p?p:.1278,zoom:null!==(m=null===h||void 0===h?void 0:h.zoom)&&void 0!==m?m:5.5};(null===x||void 0===x?void 0:x.length)&&(j=g(x));var b=(0,e.Z)(d.useState(j.latitude),2),y=b[0],w=b[1],k=(0,e.Z)(d.useState(j.longitude),2),z=k[0],Z=k[1],N=(0,e.Z)(d.useState(j.zoom),2),C=N[0],E=N[1],M=function(l){var o,t,e;w(null!==(o=l.latitude)&&void 0!==o?o:0),Z(null!==(t=l.longitude)&&void 0!==t?t:0),E(null!==(e=l.zoom)&&void 0!==e?e:0)};d.useEffect((function(){h&&M(h)}),[h]),d.useEffect((function(){j&&M(j)}),[x]);var P=(0,e.Z)(d.useState(),2),S=P[0],L=P[1];d.useEffect((function(){L(void 0)}),[x]),d.useEffect((function(){if(S){var l,o=null!==(l=null===x||void 0===x?void 0:x.filter((function(l){return l.id===S.id}))[0])&&void 0!==l?l:null;o&&M({latitude:o.location.lat,longitude:o.location.lng,zoom:C})}}),[S]);var J,D=(0,i.Z)((null!==x&&void 0!==x?x:[]).filter((function(l){var o,t;return(null===(o=l.location)||void 0===o?void 0:o.lat)&&(null===(t=l.location)||void 0===t?void 0:t.lng)})).map((function(l){var o,t;return{type:"Feature",properties:{cluster:!1,producer:l},geometry:{type:"Point",coordinates:[null===(o=l.location)||void 0===o?void 0:o.lng,null===(t=l.location)||void 0===t?void 0:t.lat]}}}))),_=d.useRef(),B=null!==(J=null===(c=null===(u=null===(t=null===(o=_.current)||void 0===o?void 0:o.getMap())||void 0===t?void 0:t.getBounds())||void 0===u?void 0:u.toArray())||void 0===c?void 0:c.flat())&&void 0!==J?J:null;(null===x||void 0===x?void 0:x.length)&&(B=g(x).cornersLngLat.flat());var I,G,T=(0,s.Z)({points:D,bounds:B,zoom:C,options:{radius:45}}),A=T.clusters,V=T.supercluster;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(r(),{children:[(0,n.jsx)("link",{rel:"preload",href:"https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css",as:"style"}),(0,n.jsx)("link",{href:"https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css",rel:"stylesheet"})]}),(0,n.jsxs)(a.ZP,{mapStyle:"mapbox://styles/mapbox/streets-v11",mapboxApiAccessToken:"pk.eyJ1IjoicHJvZHVjZWRpbmtlbnQiLCJhIjoiY2tnajM3cG50MDN2cDJ4bGxuMmZ1dGZmdCJ9.DJ4Vka_IkvE5zDgkeIS2xg",width:"100%",height:"100%",latitude:y,longitude:z,zoom:C<14?C:14,scrollZoom:!1,onViewportChange:function(l){return M(l)},onClick:function(){return L(void 0)},ref:_,children:[A.map((function(l){var o,t,i,d=(0,e.Z)(l.geometry.coordinates,2),u=d[0],r=d[1];if(null===(o=l.properties)||void 0===o?void 0:o.cluster)return(0,n.jsx)(a.Jx,{latitude:r,longitude:u,offsetLeft:-25,offsetTop:-25,draggable:!1,
1children:(0,n.jsx)("button",{className:"relative flex items-center justify-center transition-colors duration-150 bg-black rounded-full shadow-md hover:bg-primary",style:{width:50,height:50},onClick:function(){var o=Math.min(V.getClusterExpansionZoom(l.id),20);M({latitude:r,longitude:u,zoom:o,transitionInterpolator:new a.Cf({speed:2})})},children:(0,n.jsx)("p",{className:"text-xl font-medium text-white",children:l.properties.point_count})})},l.id);var s,c,v=l.properties.producer;return(0,n.jsx)(f,{producer:v,selectedProducer:S,setSelectedProducer:L,location:{latitude:null!==(s=null===(t=v.location)||void 0===t?void 0:t.lat)&&void 0!==s?s:0,longitude:null!==(c=null===(i=v.location)||void 0===i?void 0:i.lng)&&void 0!==c?c:0}},v.id)})),A.length?null:null===x||void 0===x?void 0:x.filter((function(l){var o;return Boolean(null===(o=l.location)||void 0===o?void 0:o.lat)})).map((function(l){var o,t;return(0,n.jsx)(f,{producer:l,selectedProducer:S,setSelectedProducer:L,location:{latitude:null!==(I=null===(o=l.location)||void 0===o?void 0:o.lat)&&void 0!==I?I:0,longitude:null!==(G=null===(t=l.location)||void 0===t?void 0:t.lng)&&void 0!==G?G:0}},l.id)})),h?(0,n.jsx)(f,{location:{latitude:h.latitude,longitude:h.longitude}}):null,(0,n.jsx)(a.Pv,{className:"top-0 right-0 p-2"})]})]})}}}]);
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.