1function CMSForms(e){let t,r,i,a,n,o=this;this.create=function(){t=$("#plugin-forms-"+e),r=t.parent().find(".plugin-form-loader"),a=void 0!==window["formDropzones_"+e],n=void 0!==window["formMaps_"+e],o.bind()},this.bind=function(){a&&o.bindDropzone(),n&&o.bindMaps(),t.find(".plugin-form-submit").on("click",function(e){e.preventDefault(),r.show(),o.submitForm()}),$("#confirmationSmsButton").on("click",function(e){e.preventDefault(),r.show(),o.confirmSms()}),$(document).ready(function(){$("#plugin-forms-"+e+" .info").tooltip(),$("textarea.g-recaptcha-response").attr("aria-label","Google recaptcha")})},this.bindDropzone=function(){let t=JSON.parse(window["formDropzones_"+e]),r=parseInt(window["uploadFileMaxSize_"+e]),a=parseInt(window["uploadFileAllMaxSize_"+e]),n=window["dropzoneTranslation_"+e],s=0;i=new FormData;for(let l in t){let d=$("#file-field-"+l),c=t[l],f=$("#"+l),p=d.parent();i.append(l,""),d.dropzone({url:URL_CLIENT_REQUEST,acceptedFiles:c.allowedExtensionsMimes.join(),addRemoveLinks:!0,maxFilesize:r/1024/1024,maxFiles:c.isMultiple?null:1,uploadMultiple:!1,dictCancelUpload:n.dictCancelUpload,dictCancelUploadConfirmation:n.dictCancelUploadConfirmation,dictDefaultMessage:f.attr("placeholder")?f.attr("placeholder"):n.dictDefaultMessage,dictFallbackMessage:n.dictFallbackMessage,dictFallbackText:n.dictFallbackText,dictFileTooBig:n.dictFileTooBig,dictInvalidFileType:n.dictInvalidFileType.replace("{{fileExt}}",c.allowedExtensions),dictMaxFilesExceeded:n.dictMaxFilesExceeded,dictRemoveFile:n.dictRemoveFile,dictResponseError:n.dictResponseError,dictUploadCanceled:n.dictUploadCanceled,hiddenInputContainer:p[0],renameFilename:function(e){return e.replace(/[<>:"/\\\|?*]|[\x00-\x1F]|[\x7F\xA0\xAD]|[#\[\]@!$&\'()+,;=]|[{}^\~`]/g,"")},accept:function(e,t){s>=a?(e.status=Dropzone.CANCELED,this._errorProcessing([e],n.dictMaxFilesExceeded,null)):t()},init:function(){dzClosure=this,p.find(".dz-hidden-input").attr("aria-label","Dropzone field"),d.keyup(function(e){13===e.which&&this.click()}),this.on("addedfile",function(e){s+=e.size}),this.on("removedfile",function(t){if(0!==t.upload.progress&&(s-=t.size),""!==i.get(l)){let r=JSON.parse(i.get(l)),a=r.find(function(e){return e.uuid===t.upload.uuid&&e});a&&($.ajax({type:"POST",url:URL_CLIENT_REQUEST,data:{Action:"REMOVE_FILE",PluginName:"forms",formId:e,fieldSlug:l,fileName:a.name,csrf_token:getCsrfTokenJs()},success:function(){},error:ajaxErrorResponse}),r.splice(r.findIndex(function(e,r){return e.uuid===t.upload.uuid&&r}),1),i.set(l,JSON.stringify(r)))}}),this.on("error",function(e){s-=e.size,void 0!==e.xhr&&void 0!==e.xhr.status&&e.xhr.status&&419===e.xhr.status&&ajaxErrorResponse(e.xhr)}),this.on("sending",function(t,r,i){i.append("Action","UPLOAD_FILE"),i.append("PluginName","forms"),i.append("fieldSlug",l),i.append("formId",e),i.append("csrf_token",getCsrfTokenJs())}),this.on("success",function(e,t){let r=JSON.parse(t),a=""===i.get(l)?[]:JSON.parse(i.get(l));if("success"===r.status){const t=r.file_data[l].file_size;if(t){s-=e.size,s+=t;const r=e.previewElement.querySelector("[data-dz-size]");r&&(r.innerHTML=o.formatBytes(t)),Object.defineProperty(e,"size",{value:t})}a.push({uuid:e.upload.uuid,name:r.file_data[l].temp_file_name}),i.set(l,JSON.stringify(a))}else e.status=Dropzone.CANCELED,s+=e.size,this._errorProcessing([e],r.errors[l],null);p.find(".dz-hidden-input").attr("aria-label","Dropzone field"),d.find(".dz-file-preview .dz-image > img").remove()})}})}},this.formatBytes=function(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return"<b>"+parseFloat((e/Math.pow(1024,t)).toFixed(2))+"</b> "+["B","KB","MB","GB","TB"][t]},this.bindMaps=function(){let t=JSON.parse(window["formMaps_"+e]);for(let i in t){let a=t[i],n=L.map(a.map_id,{center:[a.latitude,a.longitude],minZoom:2,zoom:a.zoom});function r(){let t=i,r=$("#geolocation-"+t).val(),a=$("#geolocate-error-"+t);a.html("");let s=window["localizationTranslation_"+e];r.length>2?$.getJSON("https://nominatim.openstreetmap.org/search?format=json&limit=1&q="+r,function(e){e.length?$.each(e,function(e,r){let i={latlng:[r.lat,r.lon]};o.addMarker(i,n,t)}):(o.removeMarker(n,t),a.html('<p class="error text-danger" role="alert">'+s.not_localized+"</p>"))}):(o.removeMarker(n,t),a.html('<p class="error text-danger" role="alert">'+s.no_data_provided+"</p>"))}L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"OSM"}).addTo(n),n.on("click",function(e){o.addMarker(e,n,i)}),$("#geolocate-"+i).on("click",function(e){e.preventDefault(),r()}),$("#geolocation-"+i).on("keypress",function(e){13===e.which&&(e.preventDefault(),r())})}},this.addMarker=function(e,t,r){o.removeMarker(t,r);let i=L.marker(e.latlng,{draggable:!0,icon:L.icon({iconUrl:"/cms/assets/plugins/leaflet/image/marker-icon.png",iconSize:[25,40],iconAnchor:[16,32],popupAnchor:[0,-32]})}).addTo(t).on("dragend",function(){$("#"+r).val(JSON.stringify({latitude:i.getLatLng().lat,longitude:i.getLatLng().lng})),t.panTo([i.getLatLng().lat,i.getLatLng().lng])});$("#"+r).val(JSON.stringify({latitude:i.getLatLng().lat,longitude:i.getLatLng().lng})),t.panTo(e.latlng),t.flyTo(e.latlng,13)},this.removeMarker=function(e,t){e.eachLayer(function(t){t instanceof L.Marker&&e.removeLayer(t)}),$("#"+t).val("")},this.submitForm=function(){const s=t.find("[name=recaptcha_key]").val();let l=new FormData(t[0]);
1a&&i.forEach(function(e,t){let r=[];if(""!==e){JSON.parse(e).forEach(function(e,t){r.push(e.name)})}l.set(t,JSON.stringify(r))}),grecaptcha.ready(function(){try{grecaptcha.execute(s,{action:"submit"}).then(function(s){t.find("[name=recaptcha_token]").val(s),l.append("csrf_token",getCsrfTokenJs()),l.set("recaptcha_token",s),$.ajax({type:"POST",url:URL_CLIENT_REQUEST+"?Action=SUBMIT_PUBLIC_FORM&PluginName=forms",data:l,contentType:!1,processData:!1,success:function(s){let l=JSON.parse(s);if(o.clearMessages(t),"success"===l.status){if(o.showSuccessMessage(t,l.message),t[0].reset(),t.find(".showConfirmationUserContainer").hide(),l.showSmsConfirm&&$("#confirmationSmsContainer").show(),a&&(i.forEach(function(e,t){Dropzone.forElement("#file-field-"+t).destroy()}),o.bindDropzone()),n){let t=JSON.parse(window["formMaps_"+e]);for(let e in t){let r=$("#map-localization-"+e),i='<div id="map_field_'+e+'" class="forms-map"></div>',a=$("#"+t[e].map_id);a.off(),a.remove(),r.append(i),$("#"+e).val("")}o.bindMaps()}void 0!==l.refresh&&o.refreshSelectLimitedField(l.refresh)}else"error"===l.status&&o.showValidationErrors(t,l.errors);r.hide()},error:ajaxErrorResponse})})}catch(e){o.clearMessages(t),o.showErrorMessage(t,t.find("[name=recaptcha_error_message]").val()),r.hide()}})},this.confirmSms=function(){let t=$("#confirmationSms");$.ajax({type:"POST",url:URL_CLIENT_REQUEST,data:{Action:"CONFIRM_SMS",PluginName:"forms",form_id:e,confirmationCode:$("#confirmationCode").val(),csrf_token:getCsrfTokenJs()},success:function(e){let r=JSON.parse(e);o.clearMessages(t),"success"===r.status?(t[0].reset(),o.showSuccessMessage(t,r.message)):o.showErrorMessage(t,r.message)},complete:function(){r.hide()},error:ajaxErrorResponse})},this.clearMessages=function(e){e.find(".alert, .error").remove(),e.find(".error-map").removeClass("error-map"),e.find("[aria-invalid]").attr("aria-invalid","false"),e.find("[aria-describedby]").removeAttr("aria-describedby")},this.showSuccessMessage=function(e,t){e.append('<div class="alert alert-success" role="status">'+t+"</div>")},this.showErrorMessage=function(e,t){e.append('<div class="alert alert-danger" role="status">'+t+"</div>")},this.showValidationErrors=function(e,t){let[r]=Object.keys(t),i=document.querySelector('label[for="'+r+'"]');if(i)i.scrollIntoView();else if(i=document.querySelector('input[name="'+r+'"]'),i){let e=i.parentNode.parentNode.parentNode.querySelector("legend");e&&e.scrollIntoView()}else if(i=document.querySelector('input[name="'+r+'[]"]'),i){let e=i.parentNode.parentNode.parentNode.querySelector("legend");e&&(console.log(e),e.scrollIntoView())}for(let r in t)if("refresh"===r)o.refreshSelectLimitedField(t[r]);else{let i="";"string"!=typeof t[r]?t[r].forEach(function(e,t){if(i+=e+"<br>","map_error"===r){let t=$("#map_field_"+e);1===t.length&&t.addClass("error-map")}}):i=t[r];let a=r+"_error",n='<p id="'+a+'" class="error text-danger" role="alert">'+i+"</p>";if("custom"===r){e.find(".plugin-form-submit").before(n)}if("captcha"===r&&o.showErrorMessage(e,i),"confirmation_limit"===r){n='<p class="error text-danger text-left" role="alert">'+i+"</p>",e.find(".plugin-form-submit").before(n)}else{let t=e.find('[name="'+r+'"]');t.length>1?(t=$(t[0]),t.parents("div.formBox").after(n),t.parents("fieldset").attr("aria-describedby",a)):0===t.length?(t=e.find('[name="'+r+'[]"]'),t.length>1&&(t=$(t[0])),"file"===t.attr("type")?(t.attr("aria-invalid","true"),t.attr("aria-describedby",a),t.after(n)):(t.parents("div.formBox").after(n),t.parents("fieldset").attr("aria-describedby",a))):t.parent().hasClass("agreement-checkbox")?(t.parent().after(n),t.attr("aria-invalid","true"),t.attr("aria-describedby",a)):(t.after(n),t.attr("aria-invalid","true"),t.attr("aria-describedby",a))}}},this.refreshSelectLimitedField=function(e){let r=e;for(let e in r){let i=t.find('[name="'+e+'"]');i.length>0&&(i=$(i[0]),i.empty(),"string"==typeof r[e]?setTimeout(function(){window.location.reload()},3e3):r[e].forEach(function(e,t){i.append('<option value="'+e.value+'">'+e.text+"</option>")}))}}}
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.