1(this["webpackJsonpcoop-public-web"]=this["webpackJsonpcoop-public-web"]||[]).push([[18,22,32],{837:function(e,t,n){"use strict";n.r(t);n(1);var o=n(15),c=n(434),a=n(152),i=n(941),r=n(2);t.default=function(e){var t=e.visibleBranches,n=e.selectedBranch,s=e.setSelectedBranch,l=n&&t.includes(n);if(t.length>4&&!l)return null;var u=(t.length>4&&n?[n]:t).map((function(e){var t=Object(i.b)(e.streetAddress),c=Object(i.a)(e.title).toLowerCase();return{heading:e.title,panelContent:Object(r.jsxs)(r.Fragment,{children:[Object(r.jsxs)("p",{children:[t,Object(r.jsx)("br",{}),e.city]}),e.telephone&&Object(r.jsx)("p",{children:Object(r.jsx)("a",{href:"tel:".concat(e.telephone),className:"u-font-weight-normal",children:e.telephone})}),Object(r.jsx)("p",{children:Object(r.jsx)(o.a,{to:"/branches/".concat(Object(a.b)(c)),className:"u-link-with-arrow","data-analytics-event":!0,children:"More branch details"})})]}),id:String(e.contentId),expanded:e.contentId===(null===n||void 0===n?void 0:n.contentId)}}));return Object(r.jsx)(c.a,{storeStateInSession:!1,items:u,size:"small",id:"branches",allowMultipleExpanded:!1,onClick:function(e){var n=e.id,o=e.expanded;s(o?t.find((function(e){return String(e.contentId)===n})):void 0)}},(null===n||void 0===n?void 0:n.contentId)||"branches")}},842:function(e,t,n){"use strict";n.r(t),n.d(t,"WELLINGTON_HEAD_QUARTER",(function(){return u})),n.d(t,"SEARCH_ZOOM_LEVEL",(function(){return d})),n.d(t,"DEFAULT_ZOOM_LEVEL",(function(){return b}));var o=n(100),c=n(1),a=n(111),i=n(201),r=n(987),s=(n(966),n(837)),l=n(2),u={lat:-41.28319512911415,lng:174.77532968549735},d=11,b=16,j="map:branches:position";t.default=function(e){var t=e.branches,n=e.google,h=e.locationUpdate,f=e.onRequestGeoLocation,O=Object(c.useState)([]),g=Object(o.a)(O,2),p=g[0],m=g[1],v=Object(c.useState)(),x=Object(o.a)(v,2),S=x[0],L=x[1],w=Object(c.useState)(),N=Object(o.a)(w,2),y=N[0],B=N[1];Object(c.useEffect)((function(){y&&h&&(y.panTo(h),y.setZoom(d))}),[y,h]);var E=Object(c.useMemo)((function(){var e={url:"/images/location-marker.png",anchor:new n.maps.Point(14,41),scaledSize:new n.maps.Size(28,41)};return Object(l.jsx)(r.Map,{google:n,initialCenter:u,zoom:b,mapTypeControl:!1,scaleControl:!1,streetViewControl:!0,panControl:!1,rotateControl:!1,fullscreenControl:!0,onReady:function(e,o){if(o){B(o);var c=sessionStorage.getItem(j);if(c){var a=JSON.parse(c);return o.panTo(null===a||void 0===a?void 0:a.latLng),void o.setZoom(null===a||void 0===a?void 0:a.zoom)}f&&f();var i=new n.maps.LatLngBounds;t.forEach((function(e){e.coords&&i.extend({lat:Number(e.coords.latitude),lng:Number(e.coords.longitude)})})),o.fitBounds(i,0)}},onBoundsChanged:function(e,o){var c=[];t.forEach((function(e){var t,a,i,r=new n.maps.LatLng({lat:Number(null===(t=e.coords)||void 0===t?void 0:t.latitude),lng:Number(null===(a=e.coords)||void 0===a?void 0:a.longitude)});(null===o||void 0===o||null===(i=o.getBounds())||void 0===i?void 0:i.contains(r))&&c.push(e)})),m(c),o&&sessionStorage.setItem(j,JSON.stringify({latLng:o.getCenter(),zoom:o.getZoom()}))},children:t.map((function(t){return t.coords&&Object(l.jsx)(r.Marker,{title:t.title,position:{lat:Number(t.coords.latitude),lng:Number(t.coords.longitude)},icon:e,onClick:function(e){if(L(t),e){var n=e.map,o=e.position;n.setZoom(b),n.panTo(o)}}},t.contentId)}))})}),[t,n]);return Object(l.jsxs)("div",{className:"branch-list-map","data-testid":"branch-list-map",children:[Object(l.jsx)("div",{className:"branch-list-map__container",children:E}),Boolean(S||p.length>0)&&Object(l.jsx)(a.a,{className:"branch-list-map__details",children:Object(l.jsx)(i.a,{size:"small",children:Object(l.jsx)(s.default,{visibleBranches:p,selectedBranch:S,setSelectedBranch:L})})})]})}},843:function(e,t,n){"use strict";n.r(t);var o=n(7),c=n(307),a=n(100),i=n(1),r=n(3),s=n.n(r),l=n(831),u=n(135),d=n(977),b=n.n(d),j=n(2);t.default=function(e){var t=e.onSelectSearchLocation,n=e.onRequestGeoLocation,r=e.showGeoLocationRequestButton,h=e.geoLocationAddress,f=Object(i.useState)(""),O=Object(a.a)(f,2),g=O[0],p=O[1],m=Object(i.useState)(""),v=Object(a.a)(m,2),x=v[0],S=v[1],L=Object(i.useState)(""),w=Object(a.a)(L,2),N=w[0],y=w[1],B=Object(i.useState)(),E=Object(a.a)(B,2),C=E[0],I=E[1];Object(i.useEffect)((function(){h&&(I(!1),S(h))}),[h]);
1var _=function(e){S(e),I(!1),Object(d.geocodeByAddress)(e).then((function(e){return Object(d.getLatLng)(e[0])})).then((function(e){t(e)}))},G=function(){I(!0),n&&n()};return Object(j.jsx)(b.a,{value:x,onSelect:_,onChange:function(e){S(e),y("")},debounce:300,onError:function(e){y("ZERO_RESULTS"===e?"No places found. Please try entering a different location.":"An error occurred searching for places. Please try again or select a branch from the list below.")},searchOptions:{componentRestrictions:{country:"nz"}},highlightFirstSuggestion:!0,children:function(e){var t=e.getInputProps,n=e.suggestions,a=e.getSuggestionItemProps,d=e.loading,b=t(),h=b.onBlur,f=Object(c.a)(b,["onBlur"]);return Object(j.jsx)(l.a,Object(o.a)(Object(o.a)({},f),{},{label:"Find a branch",placeholder:"Enter address or suburb",submitButtonLabel:"Search",id:"search-branch",icon:"location",isLoading:d||C,onGeoLocationButtonClick:G,showGeoLocationButton:r,onBlur:function(e){var t;p((null===(t=n[0])||void 0===t?void 0:t.description)||""),h(e)},onSubmit:function(){_(g)},autoComplete:"off",error:Boolean(N),errorMessage:N,autoCompleteSuggestions:!N&&Boolean(n.length)&&n.map((function(e){return Object(i.createElement)(u.a,Object(o.a)(Object(o.a)({},a(e,{className:s()({"is-active":e.active})})),{},{key:e.placeId}),e.description.replace(/, New Zealand/,""))})),"data-testid":"search-bar"}))}})}},852:function(e,t,n){"use strict";n.r(t);var o=n(100),c=n(1),a=n(995),i=n.n(a),r=n(201),s=n(111),l=n(101),u=n(136),d=n(174),b=n(112),j=n(175),h=n(19),f=n(951),O=n(152),g=n(58),p=n(842),m=n(843),v=n(941),x=n(2);t.default=function(e){var t,n,a,S,L,w,N,y,B=e.page,E=i()({src:"https://maps.googleapis.com/maps/api/js?key=".concat(window.AppConfig.GOOGLE_MAPS_API_KEY,"&libraries=places"),checkForExisting:!0}),C=Object(o.a)(E,2),I=C[0],_=C[1],G=Object(c.useState)(navigator.geolocation?void 0:"Browser doesn't support Geolocation"),R=Object(o.a)(G,2),k=R[0],A=R[1],M=Object(c.useState)(),T=Object(o.a)(M,2),z=T[0],q=T[1],P=Object(c.useState)(),Z=Object(o.a)(P,2),F=Z[0],U=Z[1],J=Object(c.useState)(),D=Object(o.a)(J,2),V=D[0],H=D[1];Object(c.useEffect)((function(){navigator.permissions?navigator.permissions.query({name:"geolocation"}).then((function(e){"denied"===e.state&&A("The request for Geolocation has been denied")})):K((function(){}))}),[]),Object(c.useEffect)((function(){z&&(window.google?(new google.maps.Geocoder).geocode({location:z},(function(e,t){if("OK"===t){var n=e.find((function(e){return e.types.includes("locality")}));if(n)return void U(n.formatted_address||"")}U("")})):U(""))}),[z]);var K=function(e){!k&&navigator.geolocation.getCurrentPosition(e,(function(e){A(e.message)}))},Q=function(){U(void 0),K((function(e){var t={lat:e.coords.latitude,lng:e.coords.longitude};H(t),q(t)}))},W=B.slots,Y=W.branches.content.list,$=Object(c.useMemo)((function(){return Object(f.b)(Y)}),[Y]),X=Object(c.useMemo)((function(){return Object(f.a)($,"North")}),[$]),ee=Object(c.useMemo)((function(){return Object(f.a)($,"South")}),[$]),te=function(e){var t=Object(v.a)(e.title).toLowerCase();return Object(x.jsx)("li",{children:Object(x.jsx)(h.c,{to:"/branches/".concat(Object(O.b)(t)),"data-analytics-event":!0,children:e.title})},e.contentId)};return Object(x.jsxs)(x.Fragment,{children:[Object(x.jsx)(r.a,{className:"u-bg-white",children:Object(x.jsx)(s.a,{children:Object(x.jsx)(l.a,{children:Object(x.jsxs)(u.a,{children:[Object(x.jsx)("h1",{children:"Branch finder"}),(null===(t=W.introduction)||void 0===t||null===(n=t.content)||void 0===n?void 0:n.body)&&Object(x.jsx)("div",{"data-slot-name":"introduction",children:Object(x.jsx)(g.a,{plugName:null===(a=W.introduction)||void 0===a?void 0:a.contentType,content:null===(S=W.introduction)||void 0===S?void 0:S.content})}),(null===(L=W.alert)||void 0===L||null===(w=L.content)||void 0===w?void 0:w.body)&&Object(x.jsx)("div",{"data-slot-name":"alert",children:Object(x.jsx)(g.a,{plugName:null===(N=W.alert)||void 0===N?void 0:N.contentType,content:null===(y=W.alert)||void 0===y?void 0:y.content})}),!I&&!_&&Object(x.jsx)(m.default,{geoLocationAddress:F,showGeoLocationRequestButton:!k,onRequestGeoLocation:Q,onSelectSearchLocation:H})]})})})}),!I&&!_&&window.google&&Object(x.jsx)(p.default,{branches:$,google:window.google,locationUpdate:V,onRequestGeoLocation:Q}
1),Object(x.jsx)(r.a,{hasBackgroundColor:!0,className:"u-bg-white","data-slot-name":"branches",children:Object(x.jsx)(s.a,{children:Object(x.jsx)(l.a,{size:"large",children:Object(x.jsxs)(d.a,{children:[Object(x.jsxs)(b.a,{medium:"2/3",className:"u-m-b-l@small-only","data-testid":"branch-list-1",children:[Object(x.jsx)("h2",{children:"North Island"}),Object(x.jsx)(j.a,{listStyle:"unstyled",style:{columnCount:2},children:X.map(te)})]}),Object(x.jsxs)(b.a,{medium:"1/3","data-testid":"branch-list-2",children:[Object(x.jsx)("h2",{children:"South Island"}),Object(x.jsx)(j.a,{listStyle:"unstyled",children:ee.map(te)})]})]})})})})]})}},941:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return c}));var o=function(e){return null===e||void 0===e?void 0:e.replace(/\.?\s*\(.*\)\.?\s*$/,"")},c=function(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}},951:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return c}));var o=function(e){return e.slice().sort((function(e,t){return parseInt(e.branchSortOrder)-parseInt(t.branchSortOrder)}))},c=function(e,t){return e.filter((function(e){return e.island===t}))}},966:function(e,t,n){}}]);
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.