(function(h,i,e,j,c){if(typeof j==="undefined"||!j.media||!j.media.editor){return}function f(m){var n=m.attr("data-st-media-target");var l=e('[name="'+n.replace(/[ !"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~]/g,"\\$&")+'"]');return l}function b(m){var l=f(m);j.media.editor.send.attachment=function(n,o){if(!l.length){return}l.val(o.url)};j.media.editor.open(m)}function k(m){var l=f(m);if(!l.length){return}l.val("")}function a(l){l.on("click",function(m){m.preventDefault();m.stopPropagation();b(l)})}function d(l){l.on("click",function(m){m.preventDefault();m.stopPropagation();k(l)})}function g(){e("[data-st-media-editor-button]").each(function(){a(e(this))});e("[data-st-media-reset-button]").each(function(){d(e(this))})}e(g)}(window,window.document,jQuery,wp));