System.register(["./state-legacy.BfeTROjz.js","./modal-manager-legacy.BN0zLM7v.js","./ui-helpers-legacy.DZ1NznsM.js"],(function(t,e){"use strict";var a,i,n,r;return{setters:[t=>{a=t.b,i=t.g},t=>{n=t.c},t=>{r=t.c}],execute:function(){function e(t,e,n,r){const s=jQuery,l=i();t&&(s('span.setting[data-setting="alt"] input').val(t).trigger("input").trigger("change"),s('span.setting[data-setting="alt"] textarea').val(t).trigger("input").trigger("change"),s('.compat-field-image_alt textarea, input[name="attachments['+l+'][image_alt]"]').val(t).trigger("input").trigger("change"),s("#attachment_alt").val(t).trigger("input").trigger("change"),a.modal&&a.modal.length>0&&a.modal.find(".saai-current-field:nth-child(1) .saai-current-value").text(t)),e&&(s('span.setting[data-setting="caption"] textarea').val(e).trigger("input").trigger("change"),s('input[name="attachments['+l+'][post_excerpt]"]').val(e).trigger("input").trigger("change"),s("#attachment_caption").val(e).trigger("input").trigger("change"),a.modal&&a.modal.length>0&&a.modal.find(".saai-current-field:nth-child(2) .saai-current-value").text(e)),n&&(s('span.setting[data-setting="title"] input').val(n).trigger("input").trigger("change"),s('input[name="attachments['+l+'][post_title]"]').val(n).trigger("input").trigger("change"),s('#attachment_post_title, input[name="post_title"]').val(n).trigger("input").trigger("change"),a.modal&&a.modal.length>0&&a.modal.find(".saai-current-field:nth-child(3) .saai-current-value").text(n)),r&&(s('span.setting[data-setting="description"] textarea').val(r).trigger("input").trigger("change"),s('textarea[name="attachments['+l+'][post_content]"]').val(r).trigger("input").trigger("change"),s("#attachment_content, #content").val(r).trigger("input").trigger("change"),a.modal&&a.modal.length>0&&a.modal.find(".saai-current-field:nth-child(4) .saai-current-value").text(r))}t({a:function(t){const e=jQuery;if(!a.modal||0===a.modal.length)return;e(".saai-result-field").removeClass("show");const i=t.alt||t.alt_text;i&&(a.modal.find(".saai-alt-text").text(i),e('.saai-result-field[data-field="alt"]').addClass("show")),t.caption&&(a.modal.find(".saai-caption").text(t.caption),e('.saai-result-field[data-field="caption"]').addClass("show")),t.title&&(a.modal.find(".saai-title").text(t.title),e('.saai-result-field[data-field="title"]').addClass("show")),t.description&&(a.modal.find(".saai-description").text(t.description),e('.saai-result-field[data-field="description"]').addClass("show")),a.results&&a.results.show(),a.generateButton&&a.generateButton.hide(),a.saveButton&&a.saveButton.show()},s:function(){if(jQuery,!a.modal||0===a.modal.length)return;const t=a.modal.find(".saai-alt-text").text().trim(),i=a.modal.find(".saai-caption").text().trim(),s=a.modal.find(".saai-title").text().trim(),l=a.modal.find(".saai-description").text().trim();(function(t,a,i,n){var r;jQuery;let s=!1;const l=null===(r=window.wp)||void 0===r||null===(r=r.media)||void 0===r?void 0:r.frame;if(l&&l.state()){const r=l.state().get("selection");if(r&&r.first()){const l=r.first();return t&&(l.set("alt",t),s=!0),a&&(l.set("caption",a),s=!0),i&&(l.set("title",i),s=!0),n&&(l.set("description",n),s=!0),void(s&&l.save().done((()=>{e(t,a,i,n)})))}}e(t,a,i,n)})(t,i,s,l),n(),r("Image details updated successfully!")}})}}}));
