text: /* Do not modify this file directly. It is compiled from other files. */
  /* global _wpMediaViewsL10n, _wpGalleryWidgetAdminSettings */
  !function(e){var t,i;e(function(){e(document.body).on("click",".gallery-widget-choose-images",function(l){l.preventDefault();var n=e(this).closest("form, .form");t=n.find(".gallery-widget-ids"),i=n.find(".gallery-widget-thumbs");var r=function(e){if(!e)return null;var t=wp.shortcode.next("gallery",'[gallery ids="'+e+'"]');return t=t.shortcode,wp.media.gallery.attachments(t)}(t.val()),a=null,o=!1;r&&(a=function(e){var t=new wp.media.model.Selection(e.models,{props:e.props.toJSON(),multiple:!0});return t.gallery=e.gallery,t.more().done(function(){t.props.set({query:!1}),t.unmirror(),t.props.unset("orderby")}),t}(r),o=!0),function(e){var l=new wp.media.view.MediaFrame.GalleryWidget(e);return l.on("update",function(e){var n=l.state();if(e=e||n.get("selection")){var r=e.map(function(e){return e.get("id")}).join(",");t.val(r).trigger("change"),function(e,t){t.empty();var i=_wpGalleryWidgetAdminSettings.thumbSize;e.each(function(e){var l=e.get("url")+"?w="+i+"&h="+i+"&crop=true",n=jQuery("<img>",{src:l,alt:e.get("title"),title:e.get("title"),width:i,height:i,class:"thumb"});t.append(n)})}(e,i)}},this),l.setState(l.options.state),l}({state:"gallery-edit",title:wp.media.view.l10n.addMedia,multiple:!0,editing:o,selection:a}).open()}),e(".widget-inside").on("change",".gallery-widget-style",r),r()});var l,n=wp.media;function r(){e(".widget-inside .gallery-widget-style").each(function(){var t=e(this).val(),i=e(this).parents("form");switch(t){case"slideshow":i.find(".gallery-widget-link-wrapper").hide(),i.find(".gallery-widget-columns-wrapper").hide();break;default:i.find(".gallery-widget-link-wrapper").show(),i.find(".gallery-widget-columns-wrapper").show()}})}l=n.view.l10n="undefined"==typeof _wpMediaViewsL10n?{}:_wpMediaViewsL10n,n.view.MediaFrame.GalleryWidget=n.view.MediaFrame.Post.extend({createStates:function(){var e=this.options;"CollectionEdit"in n.controller?this.states.add([new n.controller.CollectionEdit({type:"image",collectionType:"gallery",title:l.editGalleryTitle,SettingsView:n.view.Settings.Gallery,library:e.selection,editing:e.editing,menu:"gallery"}),new n.controller.CollectionAdd({type:"image",collectionType:"gallery",title:l.addToGalleryTitle})]):("WidgetGalleryEdit"in n.controller||(n.controller.WidgetGalleryEdit=n.controller.GalleryEdit.extend({gallerySettings:function(){}})),this.states.add([new n.controller.WidgetGalleryEdit({library:e.selection,editing:e.editing,menu:"gallery"}),new n.controller.GalleryAdd({})]))}})}(jQuery);