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0B,IAAIR,EAAYS,KAAK,KAC7D,CAEZ,IAEFlD,EAAEkB,EAAEG,QAAQE,KAAK,YAAYC,cAAcC,SAAS,6BAC3C,IACA,WAERzB,EAAEkB,EAAEG,QAAQ8B,KAAK,sDAAwDC,YAAYC,qBAAuB,UACpG,GAEL,EAAEC,KAAKxC,MACX,EAEI,IAAIN,CAEX,EArED,CAqEG+C,QCrEY,SAAWvD,GACtB,SAASwD,IACL1C,KAAK2C,iBACL3C,KAAKC,cACT,CAEAyC,EAAiBxC,UAAUyC,eAAiB,WACxC,MAAMpC,EAASrB,EAAE,uBACjBA,EAAE,8BAA+BqB,GAAQE,KAAK,cAAcmC,KAAK,YAAY,GAAOC,KAAK,mBAAmB,GAC5G3D,EAAE,+BAAgCqB,GAAQE,KAAK,qBAAqBmC,KAAK,YAAY,EACzF,EAEAF,EAAiBxC,UAAUD,aAAe,WACtCf,EAAE,sBAAsB4D,OAAO,SAAS1C,GACpC,MAAMG,EAASrB,EAAEkB,EAAEG,QAAQC,QAAQ,uBACnC,IAAIuC,EAAc7D,EAAEkB,EAAEG,QAAQsC,KAAK,eACnC,QAA2B,IAAhBE,GAA+BA,EAAYf,OAAS,EAAG,CAC9De,EAAcA,EAAYC,WAAW,IAAK,KAC1C,IAAIC,EAAeC,KAAKC,MAAMJ,GAE9BxC,EAAOE,KAAK,uCAA2CwC,EAAaG,MAAQ,SAASC,OACrF9C,EAAOE,KAAK,2BAA6BsC,EAAc,MAAMO,MACjE,CAEAtD,KAAK2C,gBACT,EAAEH,KAAKxC,MACX,EAEI,IAAI0C,CAEX,CA9BD,CA8BGD,O","sources":["webpack://modularity-form-builder/./source/js/front/get-location.js","webpack://modularity-form-builder/./source/js/front/handle-conditions.js"],"sourcesContent":["export default (function ($) {\n\n\tvar componentForm = {\n\t \tstreet_number: \t{name : 'street', \t\taddressType : 'short_name'},\n\t route: \t\t\t{name : 'street', \t\taddressType : 'short_name'},\n\t locality: \t\t{name : 'city', \t\taddressType : 'long_name'},\n\t postal_code: \t{name : 'postal-code',\taddressType : 'long_name'}\n \t};\n\n function GetLocation() {\n \tvar locationButton = document.getElementById('form-get-location');\n \tif (!navigator.geolocation || locationButton === null) {\n\t\t\treturn;\n\t\t}\n\n this.handleEvents();\n }\n\n GetLocation.prototype.handleEvents = function() {\n $('#form-get-location').click(function(e) {\n \te.preventDefault();\n\n $target = $(e.target).parents('[class*=\"mod-form\"]');\n $(e.target).find('.pricon').removeClass().addClass('spinner spinner-dark');\n\n\t navigator.geolocation.getCurrentPosition(\n\t function(position) {\n\t\t\t var lat = position.coords.latitude,\n\t\t\t \tlng = position.coords.longitude,\n\t\t\t \tgoogleMapsPos = new google.maps.LatLng(lat, lng),\n\t\t\t \tgoogleMapsGeocoder = new google.maps.Geocoder();\n\n\t\t\t\t\t\tgoogleMapsGeocoder.geocode({'latLng': googleMapsPos},\n\t\t\t\t\t\t function(results, status) {\n\t\t\t\t\t\t \tvar fullAddress = [];\n\n\t\t\t\t\t\t\t\tif (status == google.maps.GeocoderStatus.OK && results[0]) {\n\t\t\t\t\t\t\t // Get each component of the address from the place details and fill the form\n\t\t\t\t\t\t\t for (var i = 0; i < results[0].address_components.length; i++) {\n\t\t\t\t\t\t\t \tvar addressType = results[0].address_components[i].types[0];\n\n\t\t\t\t\t\t\t \tif (componentForm[addressType]) {\n\t\t\t\t\t\t\t \tvar value = results[0].address_components[i][componentForm[addressType].addressType];\n\t\t\t\t\t\t\t \t$target.find('[id$=\"address-' + componentForm[addressType].name + '\"]').val(value);\n\t\t\t\t\t\t\t \t}\n\n\t\t\t\t\t\t\t\t \t// Combine street name and street number\n\t\t\t\t\t\t \tif (addressType == 'route') {\n\t\t\t\t\t\t \t\tfullAddress[0] = value;\n\t\t\t\t\t\t \t} else if(addressType == 'street_number') {\n\t\t\t\t\t\t \t\tfullAddress[1] = value;\n\t\t\t\t\t\t \t}\n\t\t\t\t\t\t \t$target.find('[id$=\"address-street\"]').val(fullAddress.join(' '));\n\t\t\t\t\t \t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t// Reset button icon\n\t\t\t\t$(e.target).find('.spinner').removeClass().addClass('pricon pricon-location-pin');\n\t },\n\t function() {\n\t \t// Show message if Geolocate went wrong\n\t\t\t\t\t$(e.target).html(' ' + formbuilder.something_went_wrong + '');\n\t }\n\t );\n }.bind(this));\n };\n\n\treturn new GetLocation();\n\n})(jQuery);\n","export default (function ($) {\n function HandleConditions() {\n this.handleRequired();\n this.handleEvents();\n }\n\n HandleConditions.prototype.handleRequired = function () {\n const target = $('[class*=\"mod-form\"]');\n $('[conditional-target]:hidden', target).find('[required]').prop('required', false).attr('hidden-required', true);\n $('[conditional-target]:visible', target).find('[hidden-required]').prop('required', true);\n };\n\n HandleConditions.prototype.handleEvents = function () {\n $('input[conditional]').change(function(e) {\n const target = $(e.target).parents('[class*=\"mod-form\"]');\n var conditional = $(e.target).attr('conditional');\n if (typeof conditional !== 'undefined' && conditional.length > 0) {\n conditional = conditional.replaceAll(\"'\", '\"'); //HTML attribute breaks when using double quotes, therefore single quotes are used\n var conditionObj = JSON.parse(conditional);\n\n target.find(\"div[conditional-target^='{\\\"label\\\":\\\"\" + conditionObj.label + \"\\\",']\").hide();\n target.find(\"div[conditional-target='\" + conditional + \"']\").show();\n }\n\n this.handleRequired();\n }.bind(this));\n };\n\n\treturn new HandleConditions();\n\n})(jQuery);\n"],"names":["$","componentForm","street_number","name","addressType","route","locality","postal_code","GetLocation","locationButton","document","getElementById","navigator","geolocation","this","handleEvents","prototype","click","e","preventDefault","$target","target","parents","find","removeClass","addClass","getCurrentPosition","position","lat","coords","latitude","lng","longitude","googleMapsPos","google","maps","LatLng","Geocoder","geocode","results","status","fullAddress","GeocoderStatus","OK","i","address_components","length","types","value","val","join","html","formbuilder","something_went_wrong","bind","jQuery","HandleConditions","handleRequired","prop","attr","change","conditional","replaceAll","conditionObj","JSON","parse","label","hide","show"],"sourceRoot":""}