function themify_create_pluploader(o){"use strict";var e=o,r=e.attr("id").replace("plupload-upload-ui",""),t=!1,p=!1,i=jQuery,l=JSON.parse(JSON.stringify(global_plupload_init));l.browse_button=r+l.browse_button,l.container=r+l.container,l.drop_element=r+l.drop_element,l.file_data_name=r+l.file_data_name,l.multipart_params.imgid=r,l.multipart_params.type=e.data("type"),l.multipart_params._ajax_nonce=e.find(".ajaxnonceplu").attr("id").replace("ajaxnonceplu",""),e.hasClass("add-preset")&&(t=!0,l.multipart_params.haspreset="haspreset"),e.hasClass("add-preview")&&(p=!0,l.multipart_params.haspreview="haspreview"),e.hasClass("add-to-media")&&(l.multipart_params.tomedia="tomedia"),e.data("postid")&&(l.multipart_params.topost=e.data("postid")),e.data("fields")&&(l.multipart_params.fields=e.data("fields")),e.data("featured")&&(l.multipart_params.featured=e.data("featured")),e.data("formats")&&(l.filters[0].extensions=e.data("formats")),l.multipart_params.action=e.data("action");const a=new plupload.Uploader(l);a.bind("Init",(o=>{})),a.init(),e.data("init",1),a.bind("FilesAdded",((o,r)=>{if(e.data("confirm")&&!confirm(e.data("confirm")))return;o.refresh(),o.start(),i(".tb_alert").addClass("busy").fadeIn(800)})),a.bind("Error",((o,e)=>{if(i(".prompt-box .show-login").hide(),i(".prompt-box .show-error").show(),-600==e.code)var r=themify_plupload_lang.filesize_error,t=themify_plupload_lang.filesize_error_fix;i(".prompt-box .show-error").length>0&&(i(".prompt-box .show-error").html('<p class="prompt-error">'+r+"</p>"),t&&i(".prompt-box .show-error").append("<p>"+t+"</p>")),i(".overlay, .prompt-box").fadeIn(500);const p=document.getElementsByClassName("overlay");p[0]&&p[0].addEventListener("click",(()=>{i(".overlay, .prompt-box").fadeOut(500)}),{once:!0})})),a.bind("FileUploaded",(function(o,l,a){var s=JSON.parse(a.response),d="";if(d="200"==a.status&&s.success?"done":"error",i(".tb_alert").removeClass("busy").addClass(d).delay(800).fadeOut(800,(function(){i(this).removeClass(d)})),!s.success){i(".prompt-box .show-login").hide(),i(".prompt-box .show-error").show(),i(".prompt-box .show-error").length>0&&i(".prompt-box .show-error").html('<p class="prompt-error">'+s.data+"</p>"),i(".overlay, .prompt-box").fadeIn(500);const o=document.getElementsByClassName("overlay");return void(o[0]&&o[0].addEventListener("click",(()=>{i(".overlay, .prompt-box").fadeOut(500)}),{once:!0,passive:!0}))}if(i("#"+l.id).fadeOut(),s.data?.reload)return void(window.location=location.href.replace(location.hash,""));const n=s.data.file,c=s.data.url;if(i("#"+r).val(c),void 0!==s.data.thumb&&(themifyMediaLib.setPreviewIcon(e.closest(".themify_field, .themify_field_row"),s.data.thumb),i("body").trigger("themify_plupload_selected",[e,s])),t){i("#"+r).closest("fieldset").children(".preset").find("img").removeClass("selected");const o=c.replace(/^.*[\\\/]/,""),e=i('<a href="#" title="'+o+'"><span title="'+n+'"></span><img src="'+c+'" alt="'+c+'" class="backgroundThumb selected" /></a>').css("display","inline-block");i("#"+r).closest("fieldset").children(".preset").append(e)}p&&i("#"+r+"-preview").attr("src",c)}))}!function($,o){"use strict";const e=function(){const e=$(".plupload-upload-uic");if(e.length>0&&e.each((function(){themify_create_pluploader($(this))})),!o.getElementsByClassName("prompt-box")[0]){const e=o.createElement("div"),r=o.createElement("div"),t=o.createElement("div");e.className="prompt-box",r.className="show-error",t.className="overlay",e.append(r),o.body.append(e,t)}};"complete"===document.readyState?e():window.addEventListener("load",e,{once:!0,passive:!0})}(jQuery,document);