{"version":3,"file":"address.js","names":["autoCompleteArray","address_format","subpremise","street_number","route","locality","administrative_area_level_1","administrative_area_level_2","country","postal_code","postal_code_suffix","postal_town","postal_code_prefix","initAutocomplete","$","each","thisID","this","attr","google","maps","places","Autocomplete","types","event","addListener","place","getPlace","addressContainer","parents","i","address_components","length","segmentType","segmentVal","find","val","countyElement","countyValue","replace","hasClass","selectize","createItem","timeout","setTimeout","setValue","clearTimeout","trigger","focus","gm_authFailure","ShowCustomAlert","window","location","hostname"],"sources":["address.js"],"mappings":"AAAA,IAAIA,kBAAoB,CAAC,EACrBC,eAAiB,CAAEC,WAAY,YAAaC,cAAe,aAAcC,MAAO,YAAaC,SAAU,YAAaC,4BAA6B,YAAaC,4BAA6B,YAAaC,QAAS,YAAaC,YAAa,aAAcC,mBAAoB,aAAcC,YAAa,YAAaC,mBAAoB,aAC7U,SAASC,mBACLC,GAAE,WACEA,EAAE,iBAAiBC,MAAK,WACpB,IAAIC,EAASF,EAAEG,MAAMC,KAAK,MAC1BlB,kBAAkBgB,GAAU,IAAIG,OAAOC,KAAKC,OAAOC,aAAaR,EAAEG,MAAM,GAAI,CAAEM,MAAO,CAAC,aACtFJ,OAAOC,KAAKI,MAAMC,YAAYzB,kBAAkBgB,GAAS,iBAAiB,WACtE,IAAIU,EAAQ1B,kBAAkBgB,GAAQW,WACtC,GAAa,MAATD,EAAJ,CAGA,IADA,IAAIE,EAAmBd,EAAE,IAAME,GAAQa,QAAQ,kBACtCC,EAAI,EAAGA,EAAIJ,EAAMK,mBAAmBC,OAAQF,IAAK,CACtD,IAAIG,EAAcP,EAAMK,mBAAmBD,GAAGP,MAAM,GACpD,QAA2C,IAAhCtB,eAAegC,GAA8B,CACpD,IAAIC,EAAaR,EAAMK,mBAAmBD,GAAG7B,eAAegC,IAC5D,GAAmB,iBAAfA,EACAL,EAAiBO,KAAK,QAAUnB,EAAS,KAAKoB,IAAIF,QACjD,GAAmB,cAAfD,EACLL,EAAiBO,KAAK,kBAAkBC,IAAIF,QAC3C,GAAmB,SAAfD,EACLL,EAAiBO,KAAK,QAAUnB,EAAS,KAAKoB,IAAIR,EAAiBO,KAAK,QAAUnB,EAAS,KAAKoB,MAAQ,IAAMF,QAC7G,GAAmB,YAAfD,GAA4C,eAAfA,EAClCL,EAAiBO,KAAK,cAAcC,IAAIF,QACvC,GAAmB,+BAAfD,EACLL,EAAiBO,KAAK,uBAAuBC,IAAIF,QAChD,GAAmB,WAAfD,EACLL,EAAiBO,KAAK,iBAAiBC,IAAIF,QAC1C,GAAmB,eAAfD,GAA+C,sBAAfA,EACrCL,EAAiBO,KAAK,iBAAiBC,IAAIF,QAC1C,GAAmB,sBAAfD,EACLL,EAAiBO,KAAK,iBAAiBC,IAAIR,EAAiBO,KAAK,iBAAiBC,MAAQ,IAAMF,QAC/F,GAAmB,+BAAfD,GAAgDnB,EAAE,oBAAsBE,EAAS,KAAKgB,OAAS,EAAG,CACvG,IAAIK,EAAgBvB,EAAE,oBAAsBE,EAAS,KACjDsB,EAAcJ,EAAWK,QAAQ,YAAa,IAClD,GAAIF,EAAcG,SAAS,cAAe,CACtCH,EAAc,GAAGI,UAAUC,WAAWJ,GAAa,GACnD,IAAIK,EAAUC,YAAW,WACrBP,EAAc,GAAGI,UAAUI,SAASP,GAAa,GACjDQ,aAAaH,EACjB,GAAG,IACP,MAEIN,EAAcD,IAAIE,EAC1B,CACJ,CACJ,CACAV,EAAiBO,KAAK,gBAAgBY,QAAQ,SArCpC,CAsCd,IAEAjC,EAAEG,MAAM+B,OAAM,WACVlC,EAAEG,MAAMC,KAAK,eAAgB,OACjC,GACJ,GACJ,GACJ,CAEA,SAAS+B,iBACLC,gBAAgB,+CAAiDC,OAAOC,SAASC,SAAW,mEAChG","sourcesContent":["var autoCompleteArray = {};\r\nvar address_format = { subpremise: 'long_name', street_number: 'short_name', route: 'long_name', locality: 'long_name', administrative_area_level_1: 'long_name', administrative_area_level_2: 'long_name', country: 'long_name', postal_code: 'short_name', postal_code_suffix: 'short_name', postal_town: 'long_name', postal_code_prefix: 'long_name' };\r\nfunction initAutocomplete() {\r\n $(function () {\r\n $(\".autocomplete\").each(function () {\r\n var thisID = $(this).attr(\"id\");\r\n autoCompleteArray[thisID] = new google.maps.places.Autocomplete($(this)[0], { types: ['geocode'] });\r\n google.maps.event.addListener(autoCompleteArray[thisID], 'place_changed', function () {\r\n var place = autoCompleteArray[thisID].getPlace();\r\n if (place == null)\r\n return;\r\n var addressContainer = $(\"#\" + thisID).parents(\".address-block\");\r\n for (var i = 0; i < place.address_components.length; i++) {\r\n var segmentType = place.address_components[i].types[0];\r\n if (typeof address_format[segmentType] !== 'undefined') {\r\n var segmentVal = place.address_components[i][address_format[segmentType]];\r\n if (segmentType == \"street_number\")\r\n addressContainer.find(\"[id$=\" + thisID + \"]\").val(segmentVal);\r\n else if (segmentType == \"subpremise\")\r\n addressContainer.find(\"[id$=Address2]\").val(segmentVal);\r\n else if (segmentType == \"route\")\r\n addressContainer.find(\"[id$=\" + thisID + \"]\").val(addressContainer.find(\"[id$=\" + thisID + \"]\").val() + \" \" + segmentVal);\r\n else if (segmentType == \"locality\" || segmentType == \"postal_town\")\r\n addressContainer.find(\"[id$=City]\").val(segmentVal);\r\n else if (segmentType == \"administrative_area_level_1\")\r\n addressContainer.find(\"[id$=StateProvince]\").val(segmentVal);\r\n else if (segmentType == \"country\")\r\n addressContainer.find(\"[id$=Country]\").val(segmentVal);\r\n else if (segmentType == \"postal_code\" || segmentType == 'postal_code_prefix')\r\n addressContainer.find(\"[id$=ZipCode]\").val(segmentVal);\r\n else if (segmentType == \"postal_code_suffix\")\r\n addressContainer.find(\"[id$=ZipCode]\").val(addressContainer.find(\"[id$=ZipCode]\").val() + \"-\" + segmentVal);\r\n else if (segmentType == \"administrative_area_level_2\" && $(\"[data-county-for=\" + thisID + \"]\").length > 0) {\r\n var countyElement = $(\"[data-county-for=\" + thisID + \"]\");\r\n var countyValue = segmentVal.replace(/ County$/i, \"\");\r\n if (countyElement.hasClass(\"selectized\")) {\r\n countyElement[0].selectize.createItem(countyValue, true);\r\n var timeout = setTimeout(function () {\r\n countyElement[0].selectize.setValue(countyValue, true);\r\n clearTimeout(timeout);\r\n }, 500);\r\n }\r\n else\r\n countyElement.val(countyValue);\r\n }\r\n }\r\n }\r\n addressContainer.find(\"input,select\").trigger(\"change\");\r\n });\r\n\r\n $(this).focus(function () {\r\n $(this).attr(\"autocomplete\", \"nope\");\r\n });\r\n });\r\n });\r\n}\r\n\r\nfunction gm_authFailure() {\r\n ShowCustomAlert(\"Google Maps is not currently configured for \" + window.location.hostname + \". Please contact the Novi support team if the problem continues.\");\r\n}"]}