1let getModalItemData=async(e,t=!1,a={})=>{let r={},i="",n="";var l={};let o="COLLECTION";return t&&((t=window.document.getElementById("project-modal-external-api"))&&initialiseExternalApiDataFromSpan(t,l),a&&a.id?(Object.assign(l,a),o="EXTERNAL_API"):l.id&&(o="EXTERNAL_API")),parentPageCollectionData(),e&&(i=e.collectionId,n=e.itemId,n=replaceUnderscoreWithSlash(n)),r="EXTERNAL_API"===o?(console.log("processing for non-persistent item... "),await doProcessForNonPersistentData(n,i,l)):await doProcessForCollectionData(n,i)},extractAllComponent=(t,e)=>{e.forEach(e=>{e.components&&extractAllComponent(t,e.components),t.push(e)})},checkComponents=e=>{var t=[],e=(e&&((e=JSON.parse(e))||0<e.length)&&extractAllComponent(t,e),t.filter(e=>"form"===e.tagName));let a=[],r=[];return e.forEach(e=>{a=[],(a=e&&e.classes&&Array.isArray(e.classes)?e.classes.filter(e=>e.name.startsWith("dc-form-theme")||e.name.startsWith("dc-form-default")):a)&&a[0]&&(r.includes(a[0].name)||r.push(a[0].name))}),r.includes("dc-form-default")},checkForTextAreaType=async e=>{e=$(e+" textarea");e.length&&initializeSummerNoteWYSIWYGEditor(e)},checkForDateType=e=>{e=document.querySelectorAll(e+` input[type='datetime-local'], ${e} input[type='date']`);e.length&&e.forEach(e=>{addFlatPickerToElement(e)})},checkForTimepickerType=e=>{var e=document.querySelectorAll(e+" input[type=text][data-component-type=time_picker]"),t=(console.log("ð ~ drapcode modal ~ timepickerFields:",e),!!e.length);console.log("ð ~ drapcode modal ~ isTimepickerFieldExist:",t),t&&e.forEach(e=>{addTimePickerToElement(e)})},checkForSegregatedDateType=e=>{console.log("ð ~ checkForSegregatedDateType ~ query:",e);var t,a=queryElements(e+" "+DATE_SEGREGATED_FIELD_SELECTOR),a=(console.log("ð ~ dateSegregatedFields:",a),!!a.length);console.log("ð ~ checkForSegregatedDateType ~ isDateSegregateFieldExist:",a),a&&(a=queryElements(e+" "+DAY_SEGREGATED_FIELD_SELECTOR),t=queryElements(e+" "+MONTH_SEGREGATED_FIELD_SELECTOR),e=queryElements(e+" "+YEAR_SEGREGATED_FIELD_SELECTOR),populateDropdownFields(a,"day"),populateDropdownFields(t,"month"),populateDropdownFields(e,"year",SEGREGATED_DATE_QNT_YEARS,CURRENT_YEAR))},checkForTelType=async e=>{e=$(e+" input[type=tel]");
1e.length&&e.each(function(){var e=$(this).attr("defaultcountry")||"us",t=($(this).attr("allowedcountries")||"").split(",").map(e=>e.trim()).filter(e=>0<e.length),e={initialCountry:e,utilsScript:"https://asset.drapcode.com/intl-tel-input/utils.js"};0<t.length&&(e.onlyCountries=t),$(this).intlTelInput(e)})},checkForSelectType=e=>{$(e+" .select").on("change",function(){var e,t=$(this).val();Array.isArray(t)&&1<t.length?-1<(e=t.indexOf(""))&&(t.splice(e,1),$(this).val(t)):Array.isArray(t)&&0===t.length&&$(this).val(""),$(this).trigger("change.select2")})},extractModalFormComponent=e=>{e=$(`[id^=${e}] form`);return e.length?e:""},collectionFormDetailForModalUpdate=async(e,t)=>{e&&e.hasAttribute("disableitemid")||(e.method="put",e.setAttribute("action",e.getAttribute("action")+"/"+t.uuid))},addModalExternalScriptUrl=(e,a)=>{e.externalScriptURL&&(e=e&&e.externalScriptURL?e.externalScriptURL.split(","):"")&&e.forEach(e=>{var t=document.createElement("script");t.src=e.trim(),t.async=!0,t.defer=!0,a.appendChild(t)})},addModalCustomScript=(t,a)=>{if(t.customScript){t=t.customScript.trim();let e=t.startsWith("<script>")?t.replace("<script>",""):t;e=e.endsWith("<\/script>")?e.replace("<\/script>",""):e;var t=document.createElement("script"),r=document.createTextNode(""+e.trim());t.appendChild(r),a.appendChild(t)}},fetchCollectionByName=async e=>{if(e)return(e=await securedGetCall(`collection-details/${e}/name`))&&200===e.status?e.data:null},checkAndCreateValidationJS=async(a,e)=>{new Promise(function(e,t){e(a)});let t=[];var r=await(t=a?a.filter(e=>{if(e&&e.attributes)return Object.keys(e.attributes).includes("data-form-validation")}):t).map(async a=>{new Promise(function(e,t){e(a)});var e=a.attributes,t=e.id,i=e["data-form-collection"];let r=e["data-form-validation"];e=(await fetchCollectionByName(i)).validations,i=e&&0<e.length?e.find(e=>e.uuid===r):null;if(i){e=i.validationRules;let a={},r={};e.forEach(e=>{var t=a[e.field],t=(t?(t[e.key]=e.value,a[e.field]=t):a[e.field]={[e.key]:e.value},r[e.field]);t?(t[e.key]=e.message,r[e.field]=t):r[e.field]={[e.key]:e.message}});i={rules:a,messages:r};return`$("#${t}").validate(${JSON.stringify(i)});`}return""}),r=(await Promise.all(r)).join("\n"),i=document.createElement("script"),r=document.createTextNode(""+r.trim());i.appendChild(r),e.appendChild(i)},extractModalFormComponents=e=>{var t=[],e=(e&&((e=JSON.parse(e))||0<e.length)&&extractAllComponent(t,e),t.filter(e=>"form"===e.tagName));return e},parentPageCollectionData=()=>{var e=window.sessionStorage,t=window.location.pathname.split("/"),a=t[t.length-2];let r=t[t.length-1];r&&r.includes("_")&&(r=r.split("_")[1]);t={page_collection:{name:a&&r?a:"",itemId:a&&r?r:""}},a=e.getItem("previousActionResponse");a?(a=JSON.parse(a),e.setItem("previousActionResponse",JSON.stringify({...a,...t}))):e.setItem("previousActionResponse",JSON.stringify(t))},addEventsScriptForSnippet=async(e,a)=>{let i=[];var t=await securedGetCall("events");let r="";if(t&&200===t.status&&(r=t.data),e&&r){let t=e["nocode-html"];t&&"undefined"!==t&&r.forEach(e=>{if(t.includes(e.eventName)){let r=`async function ${e.eventName}(ev, url_params={}){ 2 let element,targetElement, formID; 3 if(ev){ 4 element = ev.target|| ev.srcElement ; 5 targetElement = ev.currentTarget ; 6 ev.preventDefault(); 7 formID = element && element.id ? $("#"+element.id):''; 8 } 9 const ifValidToProcess = ev && ev.type === "submit" ? formID && formID.valid() && formID.validate().pendingRequest === 0 : true; 10 let formSubmitBtn; 11 let formSubmitBtnText; 12 if(formID){ 13 formSubmitBtn = formID.find(':button[type=submit]'); 14 formSubmitBtnText = formSubmitBtn.html() 15 } 16 if(ifValidToProcess) { 17 let { dataset: targetElemDataset } = element || {}; 18 let preventDblClick = false;
19 if (targetElemDataset && targetElemDataset.hasOwnProperty('preventDblclick')) { 20 preventDblClick = true; 21 } 22 if (preventDblClick) { 23 let timeoutDuration = 5000; 24 if (targetElemDataset.hasOwnProperty('disableDuration')) { 25 const typeOfDisableDurationValue = typeof Number(targetElemDataset['disableDuration']); 26 if (typeOfDisableDurationValue === 'number') { 27 timeoutDuration = Number(targetElemDataset['disableDuration']); 28 } 29 } 30 element.style.pointerEvents = 'none'; 31 element.style.opacity = '0.5'; 32 setTimeout(() => { 33 element.style.pointerEvents = 'auto'; 34 element.style.opacity = '1'; 35 }, timeoutDuration); 36 } 37 formSubmitBtn && formSubmitBtn.prop('disabled', true); 38 formSubmitBtn && formSubmitBtn.empty().append("<i class='fa fa-spinner fa-spin'></i>"); 39 let response= null; 40 try{`;e.actions.filter(e=>!!e.step).sort((e,t)=>e.step>t.step?1:e.step==t.step?0:-1).forEach(e=>{var t=e.parameters;let a={};t.forEach(e=>{a[e.name]=e.value});t=` 41 if(response && response.status==='error' && ${"showAlertMessage"!==e.name}){ 42 formSubmitBtn && formSubmitBtn.prop('disabled', false); 43 formSubmitBtn && formSubmitBtn.html(formSubmitBtnText); 44 return; 45 } 46 response = await ${e.name}({parameters:${JSON.stringify(a)},response:response?response.data:'',element:element, targetElement:targetElement, url_params:url_params});`;r+=` 47 ${t} 48 console.log(response);`}),r+=` 49 formSubmitBtn && formSubmitBtn.prop('disabled', false); 50 formSubmitBtn && formSubmitBtn.html(formSubmitBtnText); 51 } 52 catch(error){ 53 formSubmitBtn && formSubmitBtn.prop('disabled', false); 54 formSubmitBtn && formSubmitBtn.html(formSubmitBtnText); 55 console.log("error", error); 56 } 57 } else { 58 console.log("I am submit event and not valid"); 59 } 60 }`,i.push(r.replaceAll(" ","").replaceAll("\n",""))}})}i&&i.forEach(e=>{var t=document.createElement("script"),e=document.createTextNode(""+e.trim());t.appendChild(e),a.appendChild(t)})},renderForModalExternalAPI=async(e,t)=>{console.log("ð ~ renderForModalExternalAPI ~ modal:",e);let a="";var r;return e.collectionFrom&&"EXTERNAL_API"===e.collectionFrom&&(r=e.externalApiId)&&(a=await fetchExternalApiById(r,e.uuid),appendExternalApiSpanElement(a,r,t)),a},fetchExternalApiById=async(e,t="")=>{var a,r,i;return e?(i={},a=getHostnameShort(),i=(r=sessionStorage.getItem(`__snippetExternalAPI_${a}-`+t))?JSON.parse(r):null,console.log("ð ~ fetchExternalApiById ~ externalAPIData #1:",i),i?void 0:(r=await publicGetCall("external-api/id/"+e))&&200===r.status?(i=r.data,console.log("ð ~ fetchExternalApiById ~ externalAPIData #2:",i),sessionStorage.setItem(`__snippetExternalAPI_${a}-`+t,JSON.stringify(i)),populateBrowserStorageKeyToReset(`__snippetExternalAPI_${a}-`+t),i):null):null},addComponentScriptToElem=(t,a)=>{if(t){t=t.trim();let e=t.startsWith("<script>")?t.replace("<script>",""):t;e=e.endsWith("<\/script>")?e.replace("<\/script>",""):e;var t=document.createElement("script"),r=document.createTextNode(""+e.trim());t.appendChild(r),a.appendChild(t)}},replaceNbsps=e=>{var t=new RegExp(String.fromCharCode(160),"g");return e.replace(t," ")},appendExternalApiSpanElement=(e,t,a)=>{var r,i,n;e&&({responseDataMapping:t,bodyDataFrom:e,collectionMapping:i}=((r=document.createElement("span")).id="project-modal-external-api",r.style="display:none;",r.setAttribute("data-external-api-id",t),e||""),e=(e&&"NON_PERSISTENT_COLLECTION"===e&&r.setAttribute("data-external-api-data-from",e),t||"").selectedMapping,n=(e&&((n=e._data_source_rest_api_primary_id||"")&&r.setAttribute("data-external-api-unique-key",n),r.setAttribute("data-external-api-response-mapping",JSON.stringify(e).replace(/"/g,"'"))),t||"").itemsPath,n&&r.setAttribute("data-external-api-item-path",n),i&&r.setAttribute("data-external-api-request-mapping",JSON.stringify(i).replace(/"/g,"'")),a.appendChild(r))};function loadCdnScriptDynamically(t,a,r,i=!1){if(t){console.log("ð ~ file: drapcode.js:9126 ~ loadScript ~ url:",t);let e;var n=Array.from(document.querySelectorAll("script")).find(e=>e.src===t);console.log("ð ~ file: drapcode.js:9130 ~ loadScript ~ existingScript:",n),n?e=n:((e=document.createElement("script")).type="text/javascript",e.src=t,a.appendChild(e)),e.readyState?e.onreadystatechange=()=>{"loaded"!==e.readyState&&"complete"!==e.readyState||(e.onreadystatechange=null,i&&r())}:i&&(e.onload=()=>r())}}function processVisibilityElements(e,r,t="Modal"){e=e.querySelectorAll("[data-vis-condition]");e&&e.length&&(console.log(`*** Processing Component Visibility in ${t}
60...`),e.forEach(e=>{if(!e.closest('[data-js="data-table"]')&&!e.closest('[data-js="data-group"]')){var t=parseVisibilityCondition(e),a=t.visWhenCollectionFrom;if("BROWSER_STORAGE"===a){let e={};switch(t.visWhenBsl){case"SESSION_STORAGE":e=getBrowserSessionStorageData();break;case"LOCAL_STORAGE":e=getBrowserLocalStorageData();break;case"COOKIES":e=getBrowserCookieData()}r={itemData:e}}processComponentVisibilityCondition(e,r)}}))} 61//# sourceMappingURL=drapcode.modal.js.map
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.