HEX
Server: LiteSpeed
System: Linux server315.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: globfdxw (6114)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/globfdxw/www/wp-content/plugins/wpforms-pdf/assets/js/modules/notifications.min.js
export default function(i,o,a){let t={},c={init(){c.ready()},ready(){c.setup(),c.bindEvents(),c.initExistingNotificationDropdowns()},setup(){t.$builder=a("#wpforms-builder"),c.notifications=c.getAllNotifications()},bindEvents(){t.$builder.on("wpformsPanelSectionSwitch",c.panelSectionSwitch).on("wpformsPanelSwitch",c.panelSwitch).on("wpformsSettingsBlockAdded",c.pdfAdded).on("wpformsSettingsBlockCloned",c.pdfCloned).on("wpformsUndoRedoRun",c.undoRedoRun).on("change",".wpforms-pdf-notifications select",function(){c.changeNotificationsValue(a(this))})},pdfAdded(i,o){"pdf"===o.data("block-type")&&(WPForms.Admin.Builder.UndoRedo?.preventRecord(!0),c.initNotificationDropdownsForBlock(o),c.refreshNotificationDropdown(o.find(".wpforms-pdf-notifications select")),c.setDefaultValue(o),WPForms.Admin.Builder.UndoRedo?.preventRecord("continue"))},pdfCloned(i,o,t){"pdf"===o.data("block-type")&&(WPForms.Admin.Builder.UndoRedo?.preventRecord(!0),c.initNotificationDropdownsForClonedBlock(o,t),WPForms.Admin.Builder.UndoRedo?.preventRecord("continue"))},undoRedoRun(i,o,t){c.shouldProcessUndoRedoEvent(t.args?.event??"")&&c.initExistingNotificationDropdowns()},shouldProcessUndoRedoEvent(i){return["wpformsSettingsBlockCloned","wpformsSettingsBlockAdded","wpformsSettingsBlockDeleted"].includes(i)},initExistingNotificationDropdowns(){"function"==typeof o.Choices&&t.$builder.find(".wpforms-pdf-notifications select").each(function(){c.initializeChoicesForSelect(a(this))})},initNotificationDropdownsForBlock(i){"function"==typeof o.Choices&&(i=i.find(".wpforms-pdf-notifications select"),c.initializeChoicesForSelect(i))},initNotificationDropdownsForClonedBlock(i,o){var t=i.data("block-id"),o=a(`#wpforms-panel-field-pdfs-${o}-notifications`),e=o.last().data("choicesjs")?.getValue();let n=a("<select multiple></select>").attr("id",`wpforms-panel-field-pdfs-${t}-notifications`).attr("name",`settings[pdfs][${t}][notifications]`),s=e?wpf.listPluck(e,"value"):o.val();s=Array.isArray(s)?s:[s],c.notifications.forEach(function(i){i=a("<option></option>").val(i.id).prop("selected",s.includes(i.id)).text(i.name);n.append(i)});t=i.find(".wpforms-pdf-notifications .choices");t.after(n),t.remove(),c.initNotificationDropdownsForBlock(i)},initializeChoicesForSelect(i){i.data("choicesjs")||(c.notifications=c.getAllNotifications(),WPForms.Admin.Builder.WPFormsChoicesJS.setup(i[0],{removeItemButton:!0,noChoicesText:wpforms_builder.pdf.settings.notifications_no_choices,noResultsText:wpforms_builder.pdf.settings.notifications_no_results},{}),wpf&&!0===wpf.initialSave&&wpf._updateFormState())},setDefaultValue(i){var o,i=i.find(".wpforms-pdf-notifications select"),t=i.data("choicesjs");t&&(o=c.notifications[0]?.id??"1",t.setChoiceByValue(o),c.changeNotificationsValue(i))},changeNotificationsValue(i){var o;i.length&&(o=i.closest(".wpforms-builder-settings-block-content").find(".wpforms-panel-field-pdf-notifications-json")).length&&o.val(JSON.stringify(i.val()))},panelSwitch(i,o){"settings"===o&&"pdf"===a("#wpforms-panel-settings .wpforms-panel-sidebar").find(".wpforms-panel-sidebar-section.active").data("section")&&c.refreshAllPDFNotificationDropdowns()},panelSectionSwitch(i,o){"pdf"===o&&c.refreshAllPDFNotificationDropdowns()},refreshNotificationDropdown(i){var e=i.data("choicesjs");if(e){let t=e.getValue()?.map(i=>i.value)??[];var o=c.notifications.map(i=>({value:i.id,label:i.name}));e.clearStore(),e.setChoices(o,"value","label",!0);for(let o=0;o<t.length;o++)c.notifications.some(i=>i.id===t[o])&&e.setChoiceByValue(t[o]);c.changeNotificationsValue(i)}},refreshAllPDFNotificationDropdowns(){c.notifications=c.getAllNotifications(),a(".wpforms-pdf-notifications select").each(function(){c.refreshNotificationDropdown(a(this))})},getAllNotifications(){let t=[];return a(".wpforms-panel-content-section-notifications .wpforms-notification").each(function(){var i=a(this),o=i.data("block-id").toString(),i=i.find(".wpforms-builder-settings-block-name").text().trim();o&&i&&t.push({id:o,name:i})}),t}};return c}