jQuery(document).ready(function(e){if(!e("body").hasClass("upload-php")){return}function addReplaceMediaButton(e){const t=e.$el;const i=t.find(".actions");if(!i.length||i.find(".mlo-replace-media-link").length){return}const n=e.model.get("id");if(!n){return}const a=MLOModalAttachment.editPostURL+"?post="+n+"&action=edit&TB_iframe=true&width=90%&height=90%";const o=i.find('a[href*="post.php"]');if(o.length){o.after(' <span class="links-separator">|</span>'+'<a href="'+a+'" class="mlo-replace-media-link thickbox" title="'+MLOModalAttachment.i18n.replaceMedia+'"> '+MLOModalAttachment.i18n.replaceMedia+"</a>")}}function extendMediaView(e){return e.extend({initialize:function(){e.prototype.initialize.apply(this,arguments)},render:function(){e.prototype.render.apply(this,arguments);addReplaceMediaButton(this);return this}})}const t=wp.media.view.Attachment.Details;wp.media.view.Attachment.Details=extendMediaView(t);if(wp.media.view.Attachment.Details.TwoColumn){const e=wp.media.view.Attachment.Details.TwoColumn;wp.media.view.Attachment.Details.TwoColumn=extendMediaView(e)}e(document).on("click",".mlo-replace-media-link.thickbox",function(){tb_init("a.thickbox")})});