!function(){function e(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function t(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?e(Object(n),!0).forEach(function(e){o(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function o(e,t,o){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}System.register(["./style.scss-legacy.BWo5nvXv.js"],function(e,o){"use strict";return{setters:[null],execute:function(){!function(e,o,r){const{__:n}=e.wp.i18n;r(function(){let o=!1;r.ajax({url:e.ajaxurl,type:"POST",data:{action:"adt_export_import_tools",action_type:"get_feeds_for_dropdown",nonce:e.adtObj.exportImportNonce},success:function(e){var t;if(e.success&&null!==(t=e.data)&&void 0!==t&&t.feeds){const t=r("#export_file");t.empty(),e.data.feeds.forEach(function(e){t.append('<option value="'+e.id+'">'+e.title+" (#"+e.id+")</option>")}),function(){const e=r("#export_file");e.length&&"function"==typeof e.select2&&e.select2({placeholder:n("Select Feeds","woo-product-feed-pro"),allowClear:!0,width:"100%"})}()}},error:function(e,t,o){console.warn("Failed to load feeds for dropdown:",o)}}),r(".adt-export-import-button").on("click",function(i){const s=r(this),a=r(this).data("action");if("import_feeds"===a&&!e.adtObj.isEliteActive)return void i.preventDefault();if(o)return void alert(n("Please wait for the current operation to complete.","woo-product-feed-pro"));if("export_selected_feeds"===a){const e=r("#export_file").val();if(!e||0===e.length)return void alert(n("Please select at least one feed to export.","woo-product-feed-pro"))}if("import_feeds"===a){var c;const e=s.closest("td").find('input[type="file"]')[0],t=null==e||null===(c=e.files)||void 0===c?void 0:c[0];if(!t)return void alert(n("Please select a file to import.","woo-product-feed-pro"));if(!t.name.toLowerCase().endsWith(".json"))return void alert(n("Please select a valid JSON file.","woo-product-feed-pro"));const o=10485760;if(t.size>o)return void alert(n("File too large. Maximum file size is 10MB.","woo-product-feed-pro"))}o=!0;const d=r(this).next(".adt-loader");let p;s.prop("disabled",!0),d.show();let l={url:e.ajaxurl,type:"POST"};if("import_feeds"===a){const t=s.closest("td").find('input[type="file"]')[0],o=s.closest("td").find('input[name="overwrite_existing_feeds"]')[0],r=new FormData;r.append("action","adt_export_import_tools"),r.append("action_type",a),r.append("nonce",e.adtObj.exportImportNonce),r.append("import_file",t.files[0]),r.append("overwrite_existing_feeds",o.checked?"1":"0"),l.data=r,l.processData=!1,l.contentType=!1}else{if(p={action:"adt_export_import_tools",action_type:a,nonce:e.adtObj.exportImportNonce},"export_selected_feeds"===a){const e=r("#export_file").val();p.feed_ids=e}l.data=p}r.ajax(t(t({},l),{},{success:function(e){var t;if(e.success&&"download"===(null===(t=e.data)||void 0===t?void 0:t.action)){const t=new Blob([e.data.data],{type:"application/json"}),o=window.URL.createObjectURL(t),r=document.createElement("a");r.href=o,r.download=e.data.filename,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(o),toastr.success(e.data.message||n("Feeds exported successfully.","woo-product-feed-pro"))}else if(e.success){var o;const t=(null===(o=e.data)||void 0===o?void 0:o.message)||n("Operation completed successfully.","woo-product-feed-pro");if(toastr.success(t),"import_feeds"===a){s.closest("td").find('input[type="file"]').val("")}}else{var r;const t=(null===(r=e.data)||void 0===r?void 0:r.message)||n("Operation failed.","woo-product-feed-pro");toastr.error(t)}},error:function(e,t,o){let r=n("Operation failed.","woo-product-feed-pro");e.responseJSON&&e.responseJSON.data&&e.responseJSON.data.message?r=e.responseJSON.data.message:e.responseJSON&&e.responseJSON.data&&"string"==typeof e.responseJSON.data?r=e.responseJSON.data:o&&(r=o),toastr.error(r)},complete:function(){o=!1,s.prop("disabled",!1),d.hide()}}))})})}(window,document,jQuery)}}})}();
