PageSourceSearch

https://www.green.car/_next/static/chunks/634b21ace314bff34a6b7da29fdbfeeb9b8ec375.06edac90460b1c652e43.js

js green.car collected 2026-10-04 09:19:33 UTC 10,438 bytes, 1 lines download raw bytes

1(window.webpackJsonp_N_E=window.webpackJsonp_N_E||[]).push([[11],{"/AzC":function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i}));var r=/^([A-Za-z][A-Ha-hJ-Yj-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|GIR|gir ?0A{2})$/,i=/^[a-zA-Z]+( [a-zA-Z]+)*$/},"0gAs":function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e[e.Postcode=0]="Postcode",e[e.Location=1]="Location"}(r||(r={}))},"CAB/":function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var r=n("vJKn"),i=n.n(r),a=n("rg98"),o=n("H+61"),c=n("UlJF"),s=n("cpVT"),l=n("njlU"),u=function(){function e(){Object(o.a)(this,e),Object(s.a)(this,"distanceMatrixServiceInstance",void 0),Object(s.a)(this,"directionsServiceInstance",void 0),Object(s.a)(this,"autocompleteServiceInstance",void 0)}return Object(c.a)(e,[{key:"getMileagePerYear",value:function(){var t=Object(a.a)(i.a.mark((function t(n){var r,a,o,c,s,u,d,p,f,v,g,m,y;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n.homeAddress){t.next=2;break}throw new Error("JourneyService: Home Address is required");case 2:if(r=2,a=0,o=0,c=0,s=0,u=0,d=0,!n.workAddress||""===n.workAddress.placeId){t.next=14;break}return t.next=12,this.getJourneysDistance(n.homeAddress,[{origin:n.homeAddress,destination:n.workAddress,frequency:1}]);case 12:null!==(p=t.sent)&&(c=e.calculateTotalJourneyDistances(p)*r);case 14:if(!(n.longJourneys&&n.longJourneys.length>0)){t.next=20;break}return f=n.longJourneys.map((function(e){return{origin:n.homeAddress,destination:e.address,frequency:e.timesPerYear}})),t.next=18,this.getJourneysDistance(n.homeAddress,f);case 18:null!==(v=t.sent)&&(s=e.calculateTotalJourneyDistances(v)*r,d=v.reduce((function(e,t){var n;return e+(null!==(n=t.frequency)&&void 0!==n?n:0)}),0),u=s/r/d);case 20:return n.localMilesPerDay&&n.localMilesPerDay>0&&n.localDaysPerWeek&&n.localDaysPerWeek>0&&(a=n.localMilesPerDay*n.localDaysPerWeek),n.localWeekendTripMiles&&n.localWeekendTripMiles>0&&n.localSaturdayAndSunday&&n.localSaturdayAndSunday.length>0&&(o=n.localWeekendTripMiles*n.localSaturdayAndSunday.length),g=c+(n.localMilesPerDay?n.localMilesPerDay:0),m=c*(n.commuteDays&&n.commuteDays>0?n.commuteDays:5)*l.a.WorkWeeksPerYear,y=(a+o)*l.a.WeeksPerYear,t.abrupt("return",{commuteMiles:c,commuteMilesPerYear:m,localMiles:a+o,localMilesPerYear:y,longJourneyMilesPerYear:s,totalDailyMiles:g,totalLongJourneyAverage:u,totalLongJourneyCount:d,totalMilesPerYear:Math.ceil(m+y+s)});case 26:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"getRouteDistanceBetween",value:function(e,t){var n=this;return new Promise((function(r,i){var a=[{lat:e.lat,lng:e.lng}],o=t.map((function(e){return{lat:e.lat,lng:e.lng}}));n.distanceMatrixService.getDistanceMatrix({origins:a,destinations:o,travelMode:google.maps.TravelMode.DRIVING,region:"GB",unitSystem:google.maps.UnitSystem.IMPERIAL},(function(e,t){t===google.maps.DistanceMatrixStatus.OK?r(e):i(t)}))}))}},{key:"getJourneysDistance",value:function(e,t){var n=this;return new Promise((function(r){var i=t.filter((function(e){return e.destination&&e.destination.lat&&0!==e.destination.lat&&e.destination.lng&&0!==e.destination.lng&&e.frequency&&e.frequency>0}));n.getRouteDistanceBetween(e,i.map((function(e){return e.destination}))).then((function(e){var t=e;t&&t.rows&&t.rows.length>0&&(t.rows[0].elements.forEach((function(e,t){e.status===google.maps.DistanceMatrixElementStatus.OK&&(i[t].distance={text:e.distance.text,value:e.distance.value})})),r(i)),r(null)})).catch((function(){r(null)}))}))}},{key:"getRoute",value:function(e,t){var n=this;return new Promise((function(r,i){n.directionsService.route({origin:e,destination:t,travelMode:google.maps.TravelMode.DRIVING,unitSystem:google.maps.UnitSystem.IMPERIAL,region:"GB"},(function(e,t){t===google.maps.DirectionsStatus.OK?r(e):i(t)}))}))}},{key:"getPlacesAutocomplete",value:function(){var e=Object(a.a)(i.a.mark((function e(t){var n=this;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}throw new Error("Autocomplete Service: Must provide a value");case 2:return e.abrupt("return",new Promise((function(e,r){n.autocompleteService.getPlacePredictions({input:t,componentRestrictions:{country:"GB"}},(function(t,n){n===google.maps.places.PlacesServiceStatus.OK?e(t):r(n)}))})));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},{key:"distanceMatrixService",get:function(){return this.distanceMatrixServiceInstance||(this.distanceMatrixServiceInstance=new google.maps.DistanceMatrixService)}},{key:"directionsService",get:function(){return this.directionsServiceInstance||(this.directionsServiceInstance=new google.maps.DirectionsService)}},{key:"autocompleteService",get:function(){return this.autocompleteServiceInstance||(this.autocompleteServiceInstance=new google.maps.places.AutocompleteService)}}],[{key:"calculateTotalJourneyDistances",value:function(e){var t=0;e.filter((function(e){return null!==e}
1)).forEach((function(e){var n,r,i=null!==(n=null===e||void 0===e||null===(r=e.distance)||void 0===r?void 0:r.value)&&void 0!==n?n:0,a=e.frequency&&e.frequency>0?e.frequency:1;t+=i*a}));var n=t/l.a.MileInMeters;return n>0?n:0}},{key:"instance",get:function(){return this.serviceInstance||(this.serviceInstance=new this)}}]),e}();Object(s.a)(u,"serviceInstance",void 0);var d=u.instance},DFqO:function(e,t,n){"use strict";var r=n("cpVT"),i=n("nKUr"),a=n("dhJC"),o=(n("q1tI"),n("lElZ"));function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){Object(r.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.a=function(e){var t=e.disabled,n=void 0!==t&&t,r=e.type,c=void 0===r?"button":r,l=e.size,u=void 0===l?"small":l,d=e.isSelected,p=e.className,f=e.ariaLabel,v=e.children,g=e.onClick,m=e.variant,y=e.state,h=Object(a.a)(e,["disabled","type","size","isSelected","className","ariaLabel","children","onClick","variant","state"]);return Object(i.jsx)(o.a,s(s({isSelected:d,"aria-label":f,className:p,disabled:n,variant:m,onClick:g,state:y,size:u,type:c},h),{},{children:v}))}},"H+61":function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"a",(function(){return r}))},RojS:function(e,t,n){"use strict";var r=n("nKUr"),i=n("q1tI"),a=n("1Du9"),o=n("GtWR"),c=n("/AzC"),s=n("0gAs"),l=n("qO0S"),u=n("CAB/"),d=n("vOnD"),p=n("DFqO"),f=n("o03k"),v=n("21WQ"),g=d.c.div.withConfig({displayName:"AddressFinderStyles__AddressFinderContainer",componentId:"cpslwg-0"})([""]),m=d.c.div.withConfig({displayName:"AddressFinderStyles__AddressFinderTop",componentId:"cpslwg-1"})(["@media(min-width:","){display:flex;}"],v.b.breakpoints.l),y=Object(d.c)(f.a).withConfig({displayName:"AddressFinderStyles__AddressFinderInput",componentId:"cpslwg-2"})(["margin-bottom:10px;@media(min-width:","){margin-bottom:unset;margin-right:16px;flex:1;}"],v.b.breakpoints.l),h=Object(d.c)(p.a).withConfig({displayName:"AddressFinderStyles__AddressFinderButton",componentId:"cpslwg-3"})(["border:none;@media(min-width:","){flex:.5;}"],v.b.breakpoints.l),b=d.c.div.withConfig({displayName:"AddressFinderStyles__AddressFinderMapContainer",componentId:"cpslwg-4"})(["margin-top:30px;width:100%;height:300px;border:1px solid ",";background-color:",";border-radius:",";"],v.b.colours.misc.tertiary,v.b.colours.misc.primary,v.b.radii.primary);t.a=function(e){var t=e.placeholder,n=void 0===t?"Enter postcode":t,d=e.showInput,p=void 0===d||d,f=e.showMap,v=void 0===f||f,w=e.showButton,O=void 0===w||w,j=e.onChange,S=e.state,k=e.performSearch,P=e.mode,A=void 0===P?s.a.Postcode:P,M=e.id,x=e.zoom,D=Object(i.useState)(new l.a),I=D[0],C=D[1],J=Object(i.useState)(""),E=J[0],T=J[1],_=Object(i.useState)(!1),q=_[0],F=_[1],z=function(){E&&u.a.getPlacesAutocomplete(E).then((function(e){var t;t=e[0],(new google.maps.Geocoder).geocode({placeId:t.place_id},(function(e,n){if(n!==google.maps.GeocoderStatus.OK)throw new Error("Geocoder Service: ".concat(n));var r=e[0].geometry.location,i=new l.a;i.lat=r.lat(),i.lng=r.lng(),i.placeId=t.place_id,i.input=E,i.addressLookupType=A,C(i)}))})).catch((function(e){j({target:{id:M,value:null,error:e}})}))};return Object(i.useEffect)((function(){!function(){switch(A){case s.a.Postcode:F(c.b.test(E));break;case s.a.Location:F(c.a.test(E)||c.b.test(E));break;default:throw new Error("Invalid Type")}}()}),[E]),Object(i.useEffect)((function(){j({target:{id:M,value:I,error:!1}})}),[I]),Object(i.useEffect)((function(){z()}),[k]),Object(r.jsxs)(g,{children:[p&&Object(r.jsxs)(m,{children:[Object(r.jsx)(y,{placeholder:n,onChange:function(e){T(e.target.value)},value:E,state:S,name:M,id:M,autoComplete:A===s.a.Postcode?"postal-code":"street-address"}),O&&Object(r.jsx)(h,{disabled:!q,onClick:z,variant:"primary",children:"Find"})]}),v&&I&&0!==I.lat&&0!==I.lng&&Object(r.jsx)(b,{children:Object(r.jsx)(o.a,{center:I,zoom:x,children:Object(r.jsx)(a.d,{position:I,clickable:!1})})})]})}},UlJF:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}n.d(t,"a",(function(){return i}))},qO0S:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}
1));var r=n("H+61"),i=n("cpVT"),a=n("0gAs"),o=function e(){Object(r.a)(this,e),Object(i.a)(this,"lat",0),Object(i.a)(this,"lng",0),Object(i.a)(this,"placeId",""),Object(i.a)(this,"input",""),Object(i.a)(this,"addressLookupType",a.a.Postcode)}},rg98:function(e,t,n){"use strict";function r(e,t,n,r,i,a,o){try{var c=e[a](o),s=c.value}catch(l){return void n(l)}c.done?t(s):Promise.resolve(s).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function c(e){r(o,i,a,c,s,"next",e)}function s(e){r(o,i,a,c,s,"throw",e)}c(void 0)}))}}n.d(t,"a",(function(){return i}))}}]);

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.