jQuery(document).ready(function($){var e="#_kt_gal_photoshelter_id_id",t="#_kt_gal_photoshelter_id_name",a=".selected_gallery_name",l="#_kt_gal_photoshelter_id_url",i="#sheltergalleryimage",r="",n="";jQuery(document).ready(function(){r=window.send_to_editor,n=function(n){$(t).val(n.name),$(e).val(n.id),$(a).html(n.name),$(l).val(n.url),$(i).attr("src",n.url),$(i).css("display","block"),tb_remove(),window.send_to_editor=r}}),jQuery("#photoshelter-select").click(function(){window.send_to_editor=n;var e=jQuery(this).data("iframe");return tb_show("",e),!1})}),function($){"use strict";$.ktgallery=$.ktgallery||{},$(document).ready(function(){$.ktgallery()}),$.ktgallery=function(){$("body").on({click:function(e){var t=$(this).closest(".kt_meta_image_gallery");if("kt-clear-gallery"===e.currentTarget.id){var a=t.find(".gallery_values").val("");return void t.find(".kt_gallery_images").html("")}if("undefined"!=typeof wp&&wp.media&&wp.media.gallery){e.preventDefault();var l=$(this),i=t.find(".gallery_values").val();wp.media.view.Settings.Gallery=wp.media.view.Settings.Gallery.extend({template:function(e){}});var r;if(i)r='[gallery ids="'+i+'"]',d=wp.media.gallery.edit(r);else var n={frame:"post",state:"gallery",title:wp.media.view.l10n.createGalleryTitle,multiple:!0},d=wp.media.editor.open(null,n);return d.state("gallery-edit").on("update",function(e){t.find(".kt_gallery_images").html("");var a,l="",i,r,n=e.models.map(function(e){return a=e.toJSON(),i="undefined"!=typeof a.sizes.thumbnail?a.sizes.thumbnail.url:a.url,r=a.id,l='<a class="of-uploaded-image edit-meta" data-attachment-id="'+r+'" href="#"><img class="kt-gallery-image" src="'+i+'" /></a>',t.find(".kt_gallery_images").append(l),e.id});t.find(".gallery_values").val(n.join(",")),t.find(".gallery_values")}),!1}}},".kt-gal-gallery-attachments")}}(jQuery),function($){"use strict";$.kt_attachment_gallery=$.kt_attachment_gallery||{},$(document).ready(function(){$.kt_attachment_gallery()}),$.kt_attachment_gallery=function(){$("body").on({click:function(e){var t=$(this).closest(".kt_meta_image_gallery"),a=$(this).data("attachment-id");if("undefined"!=typeof wp&&wp.media&&wp.media.gallery){e.preventDefault(),wp.media.view.Settings.Gallery=wp.media.view.Settings.Gallery.extend({template:function(e){}});var l=$(this),i=t.find(".gallery_values").val(),r='[gallery ids="'+i+'"]',n=wp.media.gallery.edit(r);return n.state("gallery-edit").on("update",function(e){t.find(".kt_gallery_images").html("");var a,l="",i,r,n=e.models.map(function(e){return a=e.toJSON(),i="undefined"!=typeof a.sizes.thumbnail?a.sizes.thumbnail.url:a.url,r=a.id,l='<a class="of-uploaded-image edit-meta" data-attachment-id="'+r+'" href="#"><img class="kt-gallery-image" src="'+i+'" /></a>',t.find(".kt_gallery_images").append(l),e.id});t.find(".gallery_values").val(n.join(",")),t.find(".gallery_values")}),!1}}},".edit-meta")}}(jQuery);