!function(){const{jQuery:a,tinymce:e,AWBTinyMCEOptions:n}=window;void 0!==n&&e.PluginManager.add("awb",(function(e){const i="nk_awb",t={awb_type:"",awb_stretch:"false",awb_color:"",awb_image:"",awb_video:"",awb_image_size:"full",awb_image_background_size:"cover",awb_image_background_position:"50% 50%",awb_video_mp4:"",awb_video_webm:"",awb_video_ogv:"",awb_video_start_time:0,awb_video_end_time:0,awb_video_volume:0,awb_video_always_play:"false",awb_video_mobile:"false",awb_parallax:"",awb_parallax_speed:.5,awb_parallax_mobile:"false",awb_mouse_parallax:"",awb_mouse_parallax_size:30,awb_mouse_parallax_speed:1e4,awb_class:""};function l(a,e){let n="";return Object.keys(a).forEach((i=>{n+=`<option value="${i}" ${e===a[i]?"selected":""}>${a[i]}</option>`})),n}function s(a){return 1===a||"1"===a||!0===a||"true"===a||"on"===a?'checked="checked"':""}function d(a,e,n){let i="";return i="video"===n?`\n <div class="awb_attach_video">\n <input name="${a}" class="${a} awb_attach_video_field" type="hidden" value="${e}">\n </div>\n <input type="button" class="awb_attach_video_btn button" value="Select Video" data-select-title="Select Video" data-remove-title="×">\n <small class="awb_attach_video_label">${e}</small>\n `:`\n <div class="awb_attach_image">\n <input name="${a}" class="${a} awb_attach_image_field" type="hidden" value="${e}">\n </div>\n <input type="button" class="awb_attach_image_btn button" value="Select Image" data-select-title="Select Image" data-remove-title="×">\n <small class="awb_attach_image_label">${e}</small>\n `,i}e.addCommand("awb_popup",((o,c)=>{e.windowManager.open({title:"AWB Shortcode",width:600,height:400,classes:"awb-panel",html:`\n <form class="awb-mce-form">\n\n <div class="awb-tabs">\n <a href="#awb-tab-general" class="awb-tab awb-tab-active">General</a>\n <a href="#awb-tab-styles" class="awb-tab">Styles</a>\n </div>\n\n <div data-tab="awb-tab-general" class="awb-tab-active">\n <div class="awb-col-6">\n <h3>Background Type</h3>\n <select name="awb_type">\n ${l({"":"None",color:"Color",image:"Image",yt_vm_video:"YouTube / Vimeo",video:"Self Hosted Video"},c.awb_type)}\n </select>\n </div>\n\n <div class="awb-col-6" data-cond="[name=awb_type]">\n <h3>Stretch</h3>\n <input type="checkbox" value="1" name="awb_stretch" ${s(c.awb_stretch)}>\n </div>\n\n <div data-cond="[name=awb_type] && [name=awb_type] != color">\n <div class="awb-clearfix"></div>\n <h3 class="awb-title">Image</h3>\n <div class="awb-col-6">\n ${d("awb_image",c.awb_image,"image")}\n </div>\n <div class="awb-col-6" data-cond="[name=awb_image]">\n <select name="awb_image_size">\n ${l(n.imageSizes,c.awb_image_size)}\n </select>\n </div>\n <div class="awb-clearfix"></div>\n <div class="awb-col-6" data-cond="[name=awb_image]">\n <select name="awb_image_background_size">\n ${l({cover:"Cover",contain:"Contain",fill:"Fill",pattern:"Pattern"},c.awb_image_background_size)}\n </select>\n </div>\n <div class="awb-col-6" data-cond="[name=awb_image]">\n <input type="text" name="awb_image_background_position" value="${c.awb_image_background_position}">\n <div class="awb-description">Image position. Example: 50% 50%</div>\n </div>\n </div>\n\n <div data-cond="[name=awb_type] == yt_vm_video">\n <div class="awb-clearfix"></div>\n <h3 class="awb-title">Youtube / Vimeo</h3>\n <div class="awb-col-12">\n <input type="text" name="awb_video" value="${c.awb_video}">\n <div class="awb-description">Supported YouTube and Vimeo URLs</div>\n </div>\n </div>\n\n <div data-cond="[name=awb_type] == video">\n <div class="awb-clearfix"></div>\n <h3 class="awb-title">Video</h3>\n <div class="awb-col-4">\n <h3>MP4</h3>\n ${d("awb_video_mp4",c.awb_video_mp4,"video")}\n </div>\n <div class="awb-col-4">\n <h3>WEBM</h3>\n ${d("awb_video_webm",c.awb_video_webm,"video")}\n </div>\n <div class="awb-col-4">\n <h3>OGV</h3>\n ${d("awb_video_ogv",c.awb_video_ogv,"video")}\n </div>\n </div>\n\n <div data-cond="[name=awb_type] *= video">\n <div class="awb-clearfix"></div>\n <div class="awb-col-6">\n <h3>Start Time</h3>\n <input type="text" name="awb_video_start_time" value="${c.awb_video_start_time}">\n <div class="awb-description">Start time in seconds when video <br> will be started (this value will be <br> applied also after loop)</div>\n </div>\n <div class="awb-col-6">\n <h3>End Time</h3>\n <input type="text" name="awb_video_end_time" value="${c.awb_video_end_time}">\n <div class="awb-description">End time in seconds when video <br> will be ended</div>\n </div>\n </div>\n\n <div data-cond="[name=awb_type] *= video">\n <div class="awb-clearfix"></div>\n <div class="awb-col-6">\n <h3>Always Play</h3>\n <input type="checkbox" value="1" name="awb_video_always_play" ${s(c.awb_video_always_play)}>\n <div class="awb-description">Play video also when not in viewport.</div>\n </div>\n <div class="awb-col-6">\n <h3>Enable on Mobile Devices</h3>\n <input type="checkbox" value="1" name="awb_video_mobile" ${s(c.awb_video_mobile)}>\n </div>\n </div>\n\n <div data-cond="[name=awb_type]">\n <div class="awb-clearfix"></div>\n <h3 class="awb-title">Overlay Color</h3>\n <div class="awb-col-12">\n <input class="awb-colorpicker" type="text" name="awb_color" value="${c.awb_color}" data-alpha="true">\n </div>\n </div>\n\n <div data-cond="[name=awb_type] && [name=awb_type] != color">\n <div class="awb-clearfix"></div>\n <h3 class="awb-title">Parallax</h3>\n <div class="awb-col-4">\n <h3>Type</h3>\n <select name="awb_parallax">\n ${l({"":"Disabled",scroll:"Scroll",scale:"Scale",opacity:"Opacity","scroll-opacity":"Opacity + Scroll","scale-opacity":"Opacity + Scale"},c.awb_parallax)}\n </select>\n </div>\n <div data-cond="[name=awb_parallax]">\n <div class="awb-col-4">\n <h3>Speed</h3>\n <input type="text" name="awb_parallax_speed" value="${c.awb_parallax_speed}">\n <div class="awb-description">Provide number <br> from -1.0 to 2.0</div>\n </div>\n <div class="awb-col-4">\n <h3>Enable on Mobile Devices</h3>\n <input type="checkbox" value="1" name="awb_parallax_mobile" ${s(c.awb_parallax_mobile)}>\n </div>\n </div>\n </div>\n\n <div data-cond="[name=awb_type] && [name=awb_type] != color">\n <div class="awb-clearfix"></div>\n <h3 class="awb-title">Mouse Parallax</h3>\n <div class="awb-col-4">\n <h3>Enable</h3>\n <input type="checkbox" value="1" name="awb_mouse_parallax" ${s(c.awb_mouse_parallax)}>\n </div>\n <div data-cond="[name=awb_mouse_parallax]">\n <div class="awb-col-4">\n <h3>Size</h3>\n <input type="text" name="awb_mouse_parallax_size" value="${c.awb_mouse_parallax_size}">\n <div class="awb-description">pixels</div>\n </div>\n <div class="awb-col-4">\n <h3>Speed</h3>\n <input type="text" name="awb_mouse_parallax_speed" value="${c.awb_mouse_parallax_speed}">\n <div class="awb-description">milliseconds</div>\n </div>\n </div>\n </div>\n </div>\n\n <div data-tab="awb-tab-styles">\n <div class="awb-clearfix"></div>\n <div class="awb-col-12"><h3>Padding</h3></div>\n <div class="awb-col-3">\n <h3>Top</h3>\n <input type="text" name="awb_styles_padding_top" data-style="padding-top" value="">\n </div>\n <div class="awb-col-3">\n <h3>Bottom</h3>\n <input type="text" name="awb_styles_padding_bottom" data-style="padding-bottom" value="">\n </div>\n <div class="awb-col-3">\n <h3>Left</h3>\n <input type="text" name="awb_styles_padding_left" data-style="padding-left" value="">\n </div>\n <div class="awb-col-3">\n <h3>Right</h3>\n <input type="text" name="awb_styles_padding_right" data-style="padding-right" value="">\n </div>\n\n <div class="awb-clearfix"></div>\n <h3 class="awb-title">Margin</h3>\n <div class="awb-col-3">\n <h3>Top</h3>\n <input type="text" name="awb_styles_margin_top" data-style="margin-top" value="">\n </div>\n <div class="awb-col-3">\n <h3>Bottom</h3>\n <input type="text" name="awb_styles_margin_bottom" data-style="margin-bottom" value="">\n </div>\n <div class="awb-col-3">\n <h3>Left</h3>\n <input type="text" name="awb_styles_margin_left" data-style="margin-left" value="">\n </div>\n <div class="awb-col-3">\n <h3>Right</h3>\n <input type="text" name="awb_styles_margin_right" data-style="margin-right" value="">\n </div>\n </div>\n\n </form>\n `,buttons:[{text:"Insert",classes:"widget btn primary",id:"awb-panel-insert",onclick:"submit",minHeight:32,minWidth:70},{text:"Close",classes:"widget btn secondary",onclick:"close",minHeight:32,minWidth:70}],onSubmit(){const n=e.windowManager.getWindows()[0],l=a(n.$el[0]);l.find(".wp-picker-container:visible").each((function(){a(this).find(".awb-colorpicker").css("display","inline-block"),a(this).find(".wp-picker-input-wrap.hidden").removeClass("hidden")}));const s=l.find(".awb-mce-form [name]"),d={};s.each((function(){const e=a(this);if(e.is("[type=hidden]")){if(!e.parent().is(":visible"))return}else if(!e.is(":visible"))return;d[this.name]="checkbox"===this.type?this.checked:this.value}));let o=`[${i}`;Object.keys(t).forEach((a=>{void 0!==d[a]&&d[a]&&(o+=` ${a}="${d[a]}"`)}));let b="";s.filter("[data-style]").each((function(){const e=a(this);let n=e.val();n&&(a.isNumeric(n)&&(n+="px"),b+=` ${e.attr("data-style")}: ${n};`)})),b&&(o+=` awb_styles="${b}"`);const v=c.content||"<p>Your Content Here</p>";o+=`]${v}[/${i}]`,e.insertContent(o)},onOpen(){const n=e.windowManager.getWindows()[0],i=a(n.$el[0]);"object"==typeof a.wp&&"function"==typeof a.wp.wpColorPicker&&i.find(".awb-colorpicker").wpColorPicker({alpha:!0});const t=i.find(".awb-tabs");if(t.length){const e=t.parent().children("[data-tab]");t.on("click",".awb-tab",(function(n){n.preventDefault();const i=a(this),t=e.filter(`[data-tab="${this.hash.replace("#","")}"]`);t.length&&(e.removeClass("awb-tab-active"),t.addClass("awb-tab-active"),i.addClass("awb-tab-active").siblings().removeClass("awb-tab-active"))}))}i.conditionize()}})})),e.addButton("awb",{icon:"awb",tooltip:"Advanced WordPress Backgrounds",onclick(){e.execCommand("awb_popup","",a.extend({content:e.selection.getContent()},t))}})}))}();