window.wp=window.wp||{};(function(c){var y,n,k,t,q,j,w,m=/\s?\bwp-format-[^ ]+/g,g=120,s=360,v="standard",b="short-format",e=["status"],i=["status","aside","image","audio","video"],f=["status","aside"],d=["standard","chat","status","aside","gallery"];function x(C,A){var B=c("#"+C.settings.drop_element+" .media-progress-bar div");B.width(A.percent+"%")}function a(A){c("#"+A.settings.drop_element+" .wp-format-media-select").append('
')}function r(){c(".media-progress-bar",c(".wp-format-media-holder[data-format=image]")).remove()}function l(D){var C,B,A=wp.media.string.image({size:"full",align:false,link:"none"},D.attributes);C=c(".wp-format-media-holder[data-format=image]");c(".media-progress-bar",C).remove();if("image"!==D.attributes.type){return}B=c("#wp_format_"+C.data("format"));B.val(A);c("#image-preview").remove();C.parent().prepend(['
','","
"].join(""))}function u(B,A){c.each(A,function(D,C){if(D>0){B.removeFile(C)}})}var p={dropzone:c(".wp-format-media-holder[data-format=image]"),success:l,error:r,plupload:{runtimes:"html5",filters:[{title:"Image",extensions:"jpg,jpeg,gif,png"}]},params:{}};p=new wp.Uploader(p);p.uploader.bind("BeforeUpload",a);p.uploader.bind("UploadProgress",x);p.uploader.bind("FilesAdded",u);function z(A){q.val(A);c.each([k,t,j],function(C,B){B.prop("className",B.prop("className").replace(m,"")).addClass("wp-format-"+A)})}function h(D,B){var A,C=c("#content, #content_ifr");A=C.outerHeight();if(g600){G=600}J+=' width="'+G+'"'}if(M.height){I=M.height;if(M.width&&G<'+L+J+' class="wp-'+L+'-shortcode" controls="controls" preload="none">");c(".wp-"+L+"-shortcode").mediaelementplayer()};y.on("select",function(){var G=0,I=0,H,J=y.state().get("selection").first().toJSON();if(0===J.mime.indexOf("audio")){B.val(J.url);C(J)}else{if(0===J.mime.indexOf("video")){J.src=J.url;B.val(wp.shortcode.string({tag:"video",attrs:_.pick(J,"src","width","height")}));C(J)}else{H=wp.media.string.image({size:"full",align:false,link:"none"},J);B.val(H);c("#image-preview").remove();if(J.width){G=J.width>600?600:J.width}if(J.height){I=J.height}if(G','",""].join(""))}}});y.open()})})}(jQuery));