WordPress/wp-includes/js/media-views.min.js
desrosj e4a97cc8e9 Build/Test Tools: Update NPM dependencies to their latest versions.
The following dependencies are being updated:

- `copy-webpack-plugin` from `10.2.4` to `11.0.0`.
- `dotenv` from `16.0.1` to `16.0.2`.
- `dotenv-expand` from `8.0.3` to `9.0.0`.
- `sass` from `1.53.0` to `1.55.0`.
- `sinon-test` from `3.1.3` to `3.1.4`.
- `source-map-loader` from `3.0.1` to `4.0.0`.
- `terser-webpack-plugin` from `5.3.1` to `5.3.6`.
- `uglify-js` from `3.16.1` to `3.17.1`.
- `uuid` from `8.3.2` to `9.0.0`.
- `webpack` from `5.72.0` to `5.74.0`.

This also contains changes after running `npm audit fix`.

Fixes #56641.
Built from https://develop.svn.wordpress.org/trunk@54296


git-svn-id: http://core.svn.wordpress.org/trunk@53855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 19:55:30 +00:00

2 lines
108 KiB
JavaScript

/*! This file is auto-generated */
!function(){var i={1517:function(t){var s=wp.media.model.Selection,o=wp.media.controller.Library,e=o.extend({defaults:_.defaults({multiple:"add",filterable:"uploaded",priority:100,syncSelection:!1},o.prototype.defaults),initialize:function(){var t=this.get("collectionType");"video"===this.get("type")&&(t="video-"+t),this.set("id",t+"-library"),this.set("toolbar",t+"-add"),this.set("menu",t),this.get("library")||this.set("library",wp.media.query({type:this.get("type")})),o.prototype.initialize.apply(this,arguments)},activate:function(){var t=this.get("library"),e=this.get("editLibrary"),i=this.frame.state(this.get("collectionType")+"-edit").get("library");e&&e!==i&&t.unobserve(e),t.validator=function(t){return!!this.mirroring.get(t.cid)&&!i.get(t.cid)&&s.prototype.validator.apply(this,arguments)},t.reset(t.mirroring.models,{silent:!0}),t.observe(i),this.set("editLibrary",i),o.prototype.activate.apply(this,arguments)}});t.exports=e},1817:function(t){var e=wp.media.controller.Library,a=wp.media.view.l10n,r=jQuery,i=e.extend({defaults:{multiple:!1,sortable:!0,date:!1,searchable:!1,content:"browse",describe:!0,dragInfo:!0,idealColumnWidth:170,editing:!1,priority:60,SettingsView:!1,syncSelection:!1},initialize:function(){var t=this.get("collectionType");"video"===this.get("type")&&(t="video-"+t),this.set("id",t+"-edit"),this.set("toolbar",t+"-edit"),this.get("library")||this.set("library",new wp.media.model.Selection),this.get("AttachmentView")||this.set("AttachmentView",wp.media.view.Attachment.EditLibrary),e.prototype.initialize.apply(this,arguments)},activate:function(){this.get("library").props.set("type",this.get("type")),this.get("library").observe(wp.Uploader.queue),this.frame.on("content:render:browse",this.renderSettings,this),e.prototype.activate.apply(this,arguments)},deactivate:function(){this.get("library").unobserve(wp.Uploader.queue),this.frame.off("content:render:browse",this.renderSettings,this),e.prototype.deactivate.apply(this,arguments)},renderSettings:function(t){var e=this.get("library"),i=this.get("collectionType"),s=this.get("dragInfoText"),o=this.get("SettingsView"),n={};e&&t&&(e[i]=e[i]||new Backbone.Model,n[i]=new o({controller:this,model:e[i],priority:40}),t.sidebar.set(n),s&&t.toolbar.set("dragInfo",new wp.media.View({el:r('<div class="instructions">'+s+"</div>")[0],priority:-40})),t.toolbar.set("reverse",{text:a.reverseOrder,priority:80,click:function(){e.reset(e.toArray().reverse())}}))}});t.exports=i},2288:function(t){var i=wp.media.view.l10n,e=wp.media.controller.State.extend({defaults:{id:"cropper",title:i.cropImage,toolbar:"crop",content:"crop",router:!1,canSkipCrop:!1,doCropArgs:{}},activate:function(){this.frame.on("content:create:crop",this.createCropContent,this),this.frame.on("close",this.removeCropper,this),this.set("selection",new Backbone.Collection(this.frame._selection.single))},deactivate:function(){this.frame.toolbar.mode("browse")},createCropContent:function(){this.cropperView=new wp.media.view.Cropper({controller:this,attachment:this.get("selection").first()}),this.cropperView.on("image-loaded",this.createCropToolbar,this),this.frame.content.set(this.cropperView)},removeCropper:function(){this.imgSelect.cancelSelection(),this.imgSelect.setOptions({remove:!0}),this.imgSelect.update(),this.cropperView.remove()},createCropToolbar:function(){var t=this.get("canSkipCrop")||!1,e={controller:this.frame,items:{insert:{style:"primary",text:i.cropImage,priority:80,requires:{library:!1,selection:!1},click:function(){var e=this.controller,t=e.state().get("selection").first();t.set({cropDetails:e.state().imgSelect.getSelection()}),this.$el.text(i.cropping),this.$el.attr("disabled",!0),e.state().doCrop(t).done(function(t){e.trigger("cropped",t),e.close()}).fail(function(){e.trigger("content:error:crop")})}}}};t&&_.extend(e.items,{skip:{style:"secondary",text:i.skipCropping,priority:70,requires:{library:!1,selection:!1},click:function(){var t=this.controller.state().get("selection").first();this.controller.state().cropperView.remove(),this.controller.trigger("skippedcrop",t),this.controller.close()}}}),this.frame.toolbar.set(new wp.media.view.Toolbar(e))},doCrop:function(t){return wp.ajax.post("custom-header-crop",_.extend({},this.defaults.doCropArgs,{nonce:t.get("nonces").edit,id:t.get("id"),cropDetails:t.get("cropDetails")}))}});t.exports=e},6934:function(t){var e=wp.media.controller.Cropper.extend({doCrop:function(t){var e=t.get("cropDetails"),i=this.get("control"),s=e.width/e.height;return i.params.flex_width&&i.params.flex_height?(e.dst_width=e.width,e.dst_height=e.height):(e.dst_width=i.params.flex_width?i.params.height*s:i.params.width,e.dst_height=i.params.flex_height?i.params.width/s:i.params.height),wp.ajax.post("crop-image",{wp_customize:"on",nonce:t.get("nonces").edit,id:t.get("id"),context:i.id,cropDetails:e})}});t.exports=e},7658:function(t){var s=wp.media.view.l10n,e=wp.media.controller.State.extend({defaults:{id:"edit-image",title:s.editImage,menu:!1,toolbar:"edit-image",content:"edit-image",url:""},activate:function(){this.frame.on("toolbar:render:edit-image",_.bind(this.toolbar,this))},deactivate:function(){this.frame.off("toolbar:render:edit-image")},toolbar:function(){var t=this.frame,e=t.lastState(),i=e&&e.id;t.toolbar.set(new wp.media.view.Toolbar({controller:t,items:{back:{style:"primary",text:s.back,priority:20,click:function(){i?t.setState(i):t.close()}}}}))}});t.exports=e},9067:function(t){var e=wp.media.view.l10n,a=Backbone.$,e=wp.media.controller.State.extend({defaults:{id:"embed",title:e.insertFromUrlTitle,content:"embed",menu:"default",toolbar:"main-embed",priority:120,type:"link",url:"",metadata:{}},sensitivity:400,initialize:function(t){this.metadata=t.metadata,this.debouncedScan=_.debounce(_.bind(this.scan,this),this.sensitivity),this.props=new Backbone.Model(this.metadata||{url:""}),this.props.on("change:url",this.debouncedScan,this),this.props.on("change:url",this.refresh,this),this.on("scan",this.scanImage,this)},scan:function(){var t,e=this,i={type:"link",scanners:[]};this.props.get("url")&&this.trigger("scan",i),i.scanners.length?(t=i.scanners=a.when.apply(a,i.scanners)).always(function(){e.get("scanners")===t&&e.set("loading",!1)}):i.scanners=null,i.loading=!!i.scanners,this.set(i)},scanImage:function(t){var e=this.frame,i=this,s=this.props.get("url"),o=new Image,n=a.Deferred();t.scanners.push(n.promise()),o.onload=function(){n.resolve(),i===e.state()&&s===i.props.get("url")&&(i.set({type:"image"}),i.props.set({width:o.width,height:o.height}))},o.onerror=n.reject,o.src=s},refresh:function(){this.frame.toolbar.get().refresh()},reset:function(){this.props.clear().set({url:""}),this.active&&this.refresh()}});t.exports=e},5095:function(t){var s=wp.media.model.Attachment,e=wp.media.controller.Library,i=wp.media.view.l10n,i=e.extend({defaults:_.defaults({id:"featured-image",title:i.setFeaturedImageTitle,multiple:!1,filterable:"uploaded",toolbar:"featured-image",priority:60,syncSelection:!0},e.prototype.defaults),initialize:function(){var t,o;this.get("library")||this.set("library",wp.media.query({type:"image"})),e.prototype.initialize.apply(this,arguments),t=this.get("library"),o=t.comparator,t.comparator=function(t,e){var i=!!this.mirroring.get(t.cid),s=!!this.mirroring.get(e.cid);return!i&&s?-1:i&&!s?1:o.apply(this,arguments)},t.observe(this.get("selection"))},activate:function(){this.frame.on("open",this.updateSelection,this),e.prototype.activate.apply(this,arguments)},deactivate:function(){this.frame.off("open",this.updateSelection,this),e.prototype.deactivate.apply(this,arguments)},updateSelection:function(){var t,e=this.get("selection"),i=wp.media.view.settings.post.featuredImageId;""!==i&&-1!==i&&(t=s.get(i)).fetch(),e.reset(t?[t]:[])}});t.exports=i},7323:function(t){var i=wp.media.model.Selection,s=wp.media.controller.Library,e=wp.media.view.l10n,e=s.extend({defaults:_.defaults({id:"gallery-library",title:e.addToGalleryTitle,multiple:"add",filterable:"uploaded",menu:"gallery",toolbar:"gallery-add",priority:100,syncSelection:!1},s.prototype.defaults),initialize:function(){this.get("library")||this.set("library",wp.media.query({type:"image"})),s.prototype.initialize.apply(this,arguments)},activate:function(){var t=this.get("library"),e=this.frame.state("gallery-edit").get("library");this.editLibrary&&this.editLibrary!==e&&t.unobserve(this.editLibrary),t.validator=function(t){return!!this.mirroring.get(t.cid)&&!e.get(t.cid)&&i.prototype.validator.apply(this,arguments)},t.reset(t.mirroring.models,{silent:!0}),t.observe(e),this.editLibrary=e,s.prototype.activate.apply(this,arguments)}});t.exports=e},6328:function(t){var e=wp.media.controller.Library,i=wp.media.view.l10n,s=e.extend({defaults:{id:"gallery-edit",title:i.editGalleryTitle,multiple:!1,searchable:!1,sortable:!0,date:!1,display:!1,content:"browse",toolbar:"gallery-edit",describe:!0,displaySettings:!0,dragInfo:!0,idealColumnWidth:170,editing:!1,priority:60,syncSelection:!1},initialize:function(){this.get("library")||this.set("library",new wp.media.model.Selection),this.get("AttachmentView")||this.set("AttachmentView",wp.media.view.Attachment.EditLibrary),e.prototype.initialize.apply(this,arguments)},activate:function(){this.get("library").props.set("type","image"),this.get("library").observe(wp.Uploader.queue),this.frame.on("content:render:browse",this.gallerySettings,this),e.prototype.activate.apply(this,arguments)},deactivate:function(){this.get("library").unobserve(wp.Uploader.queue),this.frame.off("content:render:browse",this.gallerySettings,this),e.prototype.deactivate.apply(this,arguments)},gallerySettings:function(t){var e;!this.get("displaySettings")||(e=this.get("library"))&&t&&(e.gallery=e.gallery||new Backbone.Model,t.sidebar.set({gallery:new wp.media.view.Settings.Gallery({controller:this,model:e.gallery,priority:40})}),t.toolbar.set("reverse",{text:i.reverseOrder,priority:80,click:function(){e.reset(e.toArray().reverse())}}))}});t.exports=s},3849:function(t){var e=wp.media.controller.State,i=wp.media.controller.Library,s=wp.media.view.l10n,s=e.extend({defaults:_.defaults({id:"image-details",title:s.imageDetailsTitle,content:"image-details",menu:!1,router:!1,toolbar:"image-details",editing:!1,priority:60},i.prototype.defaults),initialize:function(t){this.image=t.image,e.prototype.initialize.apply(this,arguments)},activate:function(){this.frame.modal.$el.addClass("image-details")}});t.exports=s},9024:function(t){var e=wp.media.view.l10n,i=window.getUserSetting,s=window.setUserSetting,e=wp.media.controller.State.extend({defaults:{id:"library",title:e.mediaLibraryTitle,multiple:!1,content:"upload",menu:"default",router:"browse",toolbar:"select",searchable:!0,filterable:!1,sortable:!0,autoSelect:!0,describe:!1,contentUserSetting:!0,syncSelection:!0},initialize:function(){var t=this.get("selection");this.get("library")||this.set("library",wp.media.query()),t instanceof wp.media.model.Selection||((t=t)||(t=this.get("library").props.toJSON(),t=_.omit(t,"orderby","query")),this.set("selection",new wp.media.model.Selection(null,{multiple:this.get("multiple"),props:t}))),this.resetDisplays()},activate:function(){this.syncSelection(),wp.Uploader.queue.on("add",this.uploading,this),this.get("selection").on("add remove reset",this.refreshContent,this),this.get("router")&&this.get("contentUserSetting")&&(this.frame.on("content:activate",this.saveContentMode,this),this.set("content",i("libraryContent",this.get("content"))))},deactivate:function(){this.recordSelection(),this.frame.off("content:activate",this.saveContentMode,this),this.get("selection").off(null,null,this),wp.Uploader.queue.off(null,null,this)},reset:function(){this.get("selection").reset(),this.resetDisplays(),this.refreshContent()},resetDisplays:function(){var t=wp.media.view.settings.defaultProps;this._displays=[],this._defaultDisplaySettings={align:i("align",t.align)||"none",size:i("imgsize",t.size)||"medium",link:i("urlbutton",t.link)||"none"}},display:function(t){var e=this._displays;return e[t.cid]||(e[t.cid]=new Backbone.Model(this.defaultDisplaySettings(t))),e[t.cid]},defaultDisplaySettings:function(t){var e=_.clone(this._defaultDisplaySettings);return e.canEmbed=this.canEmbed(t),e.canEmbed?e.link="embed":this.isImageAttachment(t)||"none"!==e.link||(e.link="file"),e},isImageAttachment:function(t){return t.get("uploading")?/\.(jpe?g|png|gif|webp)$/i.test(t.get("filename")):"image"===t.get("type")},canEmbed:function(t){if(!t.get("uploading")){var e=t.get("type");if("audio"!==e&&"video"!==e)return!1}return _.contains(wp.media.view.settings.embedExts,t.get("filename").split(".").pop())},refreshContent:function(){var t=this.get("selection"),e=this.frame,i=e.router.get(),e=e.content.mode();this.active&&!t.length&&i&&!i.get(e)&&this.frame.content.render(this.get("content"))},uploading:function(t){"upload"===this.frame.content.mode()&&this.frame.content.mode("browse"),this.get("autoSelect")&&(this.get("selection").add(t),this.frame.trigger("library:selection:add"))},saveContentMode:function(){var t,e;"browse"===this.get("router")&&(t=this.frame.content.mode(),(e=this.frame.router.get())&&e.get(t)&&s("libraryContent",t))}});_.extend(e.prototype,wp.media.selectionSync),t.exports=e},3742:function(t){var e=wp.media.controller.Library,i=e.extend({defaults:_.defaults({filterable:"uploaded",displaySettings:!1,priority:80,syncSelection:!1},e.prototype.defaults),initialize:function(t){this.media=t.media,this.type=t.type,this.set("library",wp.media.query({type:this.type})),e.prototype.initialize.apply(this,arguments)},activate:function(){wp.media.frame.lastMime&&(this.set("library",wp.media.query({type:wp.media.frame.lastMime})),delete wp.media.frame.lastMime),e.prototype.activate.apply(this,arguments)}});t.exports=i},4903:function(t){function e(t){_.extend(this,_.pick(t||{},"id","view","selector"))}e.extend=Backbone.Model.extend,_.extend(e.prototype,{mode:function(t){return t?(t!==this._mode&&(this.trigger("deactivate"),this._mode=t,this.render(t),this.trigger("activate")),this):this._mode},render:function(t){return t&&t!==this._mode?this.mode(t):(this.trigger("create",t={view:null}),this.trigger("render",t=t.view),t&&this.set(t),this)},get:function(){return this.view.views.first(this.selector)},set:function(t,e){return e&&(e.add=!1),this.view.views.set(this.selector,t,e)},trigger:function(t){var e,i;if(this._mode)return i=_.toArray(arguments),e=this.id+":"+t,i[0]=e+":"+this._mode,this.view.trigger.apply(this.view,i),i[0]=e,this.view.trigger.apply(this.view,i),this}}),t.exports=e},8493:function(t){var i=wp.media.controller.Library,e=wp.media.view.l10n,e=i.extend({defaults:_.defaults({id:"replace-image",title:e.replaceImageTitle,multiple:!1,filterable:"uploaded",toolbar:"replace",menu:!1,priority:60,syncSelection:!0},i.prototype.defaults),initialize:function(t){var e,o;this.image=t.image,this.get("library")||this.set("library",wp.media.query({type:"image"})),i.prototype.initialize.apply(this,arguments),e=this.get("library"),o=e.comparator,e.comparator=function(t,e){var i=!!this.mirroring.get(t.cid),s=!!this.mirroring.get(e.cid);return!i&&s?-1:i&&!s?1:o.apply(this,arguments)},e.observe(this.get("selection"))},activate:function(){this.frame.on("content:render:browse",this.updateSelection,this),i.prototype.activate.apply(this,arguments)},deactivate:function(){this.frame.off("content:render:browse",this.updateSelection,this),i.prototype.deactivate.apply(this,arguments)},updateSelection:function(){var t=this.get("selection"),e=this.image.attachment;t.reset(e?[e]:[])}});t.exports=e},5274:function(t){var e=wp.media.controller.Cropper.extend({activate:function(){this.frame.on("content:create:crop",this.createCropContent,this),this.frame.on("close",this.removeCropper,this),this.set("selection",new Backbone.Collection(this.frame._selection.single))},createCropContent:function(){this.cropperView=new wp.media.view.SiteIconCropper({controller:this,attachment:this.get("selection").first()}),this.cropperView.on("image-loaded",this.createCropToolbar,this),this.frame.content.set(this.cropperView)},doCrop:function(t){var e=t.get("cropDetails"),i=this.get("control");return e.dst_width=i.params.width,e.dst_height=i.params.height,wp.ajax.post("crop-image",{nonce:t.get("nonces").edit,id:t.get("id"),context:"site-icon",cropDetails:e})}});t.exports=e},5466:function(t){function e(){return{extend:Backbone.Model.extend}}_.extend(e.prototype,Backbone.Events,{state:function(t){return this.states=this.states||new Backbone.Collection,(t=t||this._state)&&!this.states.get(t)&&this.states.add({id:t}),this.states.get(t)},setState:function(t){var e=this.state();return e&&t===e.id||!this.states||!this.states.get(t)||(e&&(e.trigger("deactivate"),this._lastState=e.id),this._state=t,this.state().trigger("activate")),this},lastState:function(){if(this._lastState)return this.state(this._lastState)}}),_.each(["on","off","trigger"],function(t){e.prototype[t]=function(){return this.states=this.states||new Backbone.Collection,this.states[t].apply(this.states,arguments),this}}),t.exports=e},5826:function(t){var i=Backbone.Model.extend({constructor:function(){this.on("activate",this._preActivate,this),this.on("activate",this.activate,this),this.on("activate",this._postActivate,this),this.on("deactivate",this._deactivate,this),this.on("deactivate",this.deactivate,this),this.on("reset",this.reset,this),this.on("ready",this._ready,this),this.on("ready",this.ready,this),Backbone.Model.apply(this,arguments),this.on("change:menu",this._updateMenu,this)},ready:function(){},activate:function(){},deactivate:function(){},reset:function(){},_ready:function(){this._updateMenu()},_preActivate:function(){this.active=!0},_postActivate:function(){this.on("change:menu",this._menu,this),this.on("change:titleMode",this._title,this),this.on("change:content",this._content,this),this.on("change:toolbar",this._toolbar,this),this.frame.on("title:render:default",this._renderTitle,this),this._title(),this._menu(),this._toolbar(),this._content(),this._router()},_deactivate:function(){this.active=!1,this.frame.off("title:render:default",this._renderTitle,this),this.off("change:menu",this._menu,this),this.off("change:titleMode",this._title,this),this.off("change:content",this._content,this),this.off("change:toolbar",this._toolbar,this)},_title:function(){this.frame.title.render(this.get("titleMode")||"default")},_renderTitle:function(t){t.$el.text(this.get("title")||"")},_router:function(){var t=this.frame.router,e=this.get("router");this.frame.$el.toggleClass("hide-router",!e),e&&(this.frame.router.render(e),(e=t.get())&&e.select&&e.select(this.frame.content.mode()))},_menu:function(){var t=this.frame.menu,e=this.get("menu");this.frame.$el.toggleClass("hide-menu",!e),e&&(t.mode(e),(e=t.get())&&e.select&&e.select(this.id))},_updateMenu:function(){var t=this.previous("menu"),e=this.get("menu");t&&this.frame.off("menu:render:"+t,this._renderMenu,this),e&&this.frame.on("menu:render:"+e,this._renderMenu,this)},_renderMenu:function(t){var e=this.get("menuItem"),i=this.get("title"),s=this.get("priority");!e&&i&&(e={text:i},s&&(e.priority=s)),e&&t.set(this.id,e)}});_.each(["toolbar","content"],function(e){i.prototype["_"+e]=function(){var t=this.get(e);t&&this.frame[e].render(t)}}),t.exports=i},3526:function(t){t.exports={syncSelection:function(){var t=this.get("selection"),e=this.frame._selection;this.get("syncSelection")&&e&&t&&(t.multiple&&(t.reset([],{silent:!0}),t.validateAll(e.attachments),e.difference=_.difference(e.attachments.models,t.models)),t.single(e.single))},recordSelection:function(){var t=this.get("selection"),e=this.frame._selection;this.get("syncSelection")&&e&&t&&(t.multiple?(e.attachments.reset(t.toArray().concat(e.difference)),e.difference=[]):e.attachments.add(t.toArray()),e.single=t._single)}}},8093:function(t){var e=wp.media.View,i=e.extend({tagName:"form",className:"compat-item",events:{submit:"preventDefault","change input":"save","change select":"save","change textarea":"save"},initialize:function(){this.listenTo(this.model,"change:compat",this.render)},dispose:function(){return this.$(":focus").length&&this.save(),e.prototype.dispose.apply(this,arguments)},render:function(){var t=this.model.get("compat");if(t&&t.item)return this.views.detach(),this.$el.html(t.item),this.views.render(),this},preventDefault:function(t){t.preventDefault()},save:function(t){var e={};t&&t.preventDefault(),_.each(this.$el.serializeArray(),function(t){e[t.name]=t.value}),this.controller.trigger("attachment:compat:waiting",["waiting"]),this.model.saveCompat(e).always(_.bind(this.postSave,this))},postSave:function(){this.controller.trigger("attachment:compat:ready",["ready"])}});t.exports=i},4906:function(t){var i=jQuery,e=wp.media.View.extend({tagName:"select",className:"attachment-filters",id:"media-attachment-filters",events:{change:"change"},keys:[],initialize:function(){this.createFilters(),_.extend(this.filters,this.options.filters),this.$el.html(_.chain(this.filters).map(function(t,e){return{el:i("<option></option>").val(e).html(t.text)[0],priority:t.priority||50}},this).sortBy("priority").pluck("el").value()),this.listenTo(this.model,"change",this.select),this.select()},createFilters:function(){this.filters={}},change:function(){var t=this.filters[this.el.value];t&&this.model.set(t.props)},select:function(){var t=this.model,i="all",s=t.toJSON();_.find(this.filters,function(t,e){if(_.all(t.props,function(t,e){return t===(_.isUndefined(s[e])?null:s[e])}))return i=e}),this.$el.val(i)}});t.exports=e},2868:function(t){var e=wp.media.view.l10n,i=wp.media.view.AttachmentFilters.extend({createFilters:function(){var i={},t=window.userSettings?parseInt(window.userSettings.uid,10):0;_.each(wp.media.view.settings.mimeTypes||{},function(t,e){i[e]={text:t,props:{status:null,type:e,uploadedTo:null,orderby:"date",order:"DESC",author:null}}}),i.all={text:e.allMediaItems,props:{status:null,type:null,uploadedTo:null,orderby:"date",order:"DESC",author:null},priority:10},wp.media.view.settings.post.id&&(i.uploaded={text:e.uploadedToThisPost,props:{status:null,type:null,uploadedTo:wp.media.view.settings.post.id,orderby:"menuOrder",order:"ASC",author:null},priority:20}),i.unattached={text:e.unattached,props:{status:null,uploadedTo:0,type:null,orderby:"menuOrder",order:"ASC",author:null},priority:50},t&&(i.mine={text:e.mine,props:{status:null,type:null,uploadedTo:null,orderby:"date",order:"DESC",author:t},priority:50}),wp.media.view.settings.mediaTrash&&this.controller.isModeActive("grid")&&(i.trash={text:e.trash,props:{uploadedTo:null,status:"trash",type:null,orderby:"date",order:"DESC",author:null},priority:50}),this.filters=i}});t.exports=i},9663:function(t){var e=wp.media.view.l10n,i=wp.media.view.AttachmentFilters.extend({id:"media-attachment-date-filters",createFilters:function(){var i={};_.each(wp.media.view.settings.months||{},function(t,e){i[e]={text:t.text,props:{year:t.year,monthnum:t.month}}}),i.all={text:e.allDates,props:{monthnum:!1,year:!1},priority:10},this.filters=i}});t.exports=i},7040:function(t){var o=wp.media.view.l10n,e=wp.media.view.AttachmentFilters.extend({createFilters:function(){var t,e=this.model.get("type"),i=wp.media.view.settings.mimeTypes,s=window.userSettings?parseInt(window.userSettings.uid,10):0;i&&e&&(t=i[e]),this.filters={all:{text:t||o.allMediaItems,props:{uploadedTo:null,orderby:"date",order:"DESC",author:null},priority:10},uploaded:{text:o.uploadedToThisPost,props:{uploadedTo:wp.media.view.settings.post.id,orderby:"menuOrder",order:"ASC",author:null},priority:20},unattached:{text:o.unattached,props:{uploadedTo:0,orderby:"menuOrder",order:"ASC",author:null},priority:50}},s&&(this.filters.mine={text:o.mine,props:{orderby:"date",order:"DESC",author:s},priority:50})}});t.exports=e},5019:function(t){var e=wp.media.View,o=jQuery,i=e.extend({tagName:"li",className:"attachment",template:wp.template("attachment"),attributes:function(){return{tabIndex:0,role:"checkbox","aria-label":this.model.get("title"),"aria-checked":!1,"data-id":this.model.get("id")}},events:{click:"toggleSelectionHandler","change [data-setting]":"updateSetting","change [data-setting] input":"updateSetting","change [data-setting] select":"updateSetting","change [data-setting] textarea":"updateSetting","click .attachment-close":"removeFromLibrary","click .check":"checkClickHandler",keydown:"toggleSelectionHandler"},buttons:{},initialize:function(){var t=this.options.selection;_.defaults(this.options,{rerenderOnModelChange:!0}).rerenderOnModelChange?this.listenTo(this.model,"change",this.render):this.listenTo(this.model,"change:percent",this.progress),this.listenTo(this.model,"change:title",this._syncTitle),this.listenTo(this.model,"change:caption",this._syncCaption),this.listenTo(this.model,"change:artist",this._syncArtist),this.listenTo(this.model,"change:album",this._syncAlbum),this.listenTo(this.model,"add",this.select),this.listenTo(this.model,"remove",this.deselect),t&&(t.on("reset",this.updateSelect,this),this.listenTo(this.model,"selection:single selection:unsingle",this.details),this.details(this.model,this.controller.state().get("selection"))),this.listenTo(this.controller.states,"attachment:compat:waiting attachment:compat:ready",this.updateSave)},dispose:function(){var t=this.options.selection;return this.updateAll(),t&&t.off(null,null,this),e.prototype.dispose.apply(this,arguments),this},render:function(){var t=_.defaults(this.model.toJSON(),{orientation:"landscape",uploading:!1,type:"",subtype:"",icon:"",filename:"",caption:"",title:"",dateFormatted:"",width:"",height:"",compat:!1,alt:"",description:""},this.options);return t.buttons=this.buttons,t.describe=this.controller.state().get("describe"),"image"===t.type&&(t.size=this.imageSize()),t.can={},t.nonces&&(t.can.remove=!!t.nonces.delete,t.can.save=!!t.nonces.update),this.controller.state().get("allowLocalEdits")&&(t.allowLocalEdits=!0),t.uploading&&!t.percent&&(t.percent=0),this.views.detach(),this.$el.html(this.template(t)),this.$el.toggleClass("uploading",t.uploading),t.uploading?this.$bar=this.$(".media-progress-bar div"):delete this.$bar,this.updateSelect(),this.updateSave(),this.views.render(),this},progress:function(){this.$bar&&this.$bar.length&&this.$bar.width(this.model.get("percent")+"%")},toggleSelectionHandler:function(t){var e;if("INPUT"!==t.target.nodeName&&"BUTTON"!==t.target.nodeName)if(37===t.keyCode||38===t.keyCode||39===t.keyCode||40===t.keyCode)this.controller.trigger("attachment:keydown:arrow",t);else if("keydown"!==t.type||13===t.keyCode||32===t.keyCode){if(t.preventDefault(),this.controller.isModeActive("grid")){if(this.controller.isModeActive("edit"))return void this.controller.trigger("edit:attachment",this.model,t.currentTarget);this.controller.isModeActive("select")&&(e="toggle")}t.shiftKey?e="between":(t.ctrlKey||t.metaKey)&&(e="toggle"),this.toggleSelection({method:e}),this.controller.trigger("selection:toggle")}},toggleSelection:function(t){var e,i,s,o=this.collection,n=this.options.selection,a=this.model,t=t&&t.method;if(n){if(e=n.single(),"between"===(t=_.isUndefined(t)?n.multiple:t)&&e&&n.multiple)return e===a?void 0:(o=(i=o.indexOf(e))<(s=o.indexOf(this.model))?o.models.slice(i,s+1):o.models.slice(s,i+1),n.add(o),void n.single(a));"toggle"===t?(n[this.selected()?"remove":"add"](a),n.single(a)):"add"===t?(n.add(a),n.single(a)):("add"!==(t=t||"add")&&(t="reset"),this.selected()?n[e===a?"remove":"single"](a):(n[t](a),n.single(a)))}},updateSelect:function(){this[this.selected()?"select":"deselect"]()},selected:function(){var t=this.options.selection;if(t)return!!t.get(this.model.cid)},select:function(t,e){var i=this.options.selection,s=this.controller;!i||e&&e!==i||this.$el.hasClass("selected")||(this.$el.addClass("selected").attr("aria-checked",!0),s.isModeActive("grid")&&s.isModeActive("select")||this.$(".check").attr("tabindex","0"))},deselect:function(t,e){var i=this.options.selection;!i||e&&e!==i||this.$el.removeClass("selected").attr("aria-checked",!1).find(".check").attr("tabindex","-1")},details:function(t,e){var i=this.options.selection;i===e&&(e=i.single(),this.$el.toggleClass("details",e===this.model))},imageSize:function(t){var e=this.model.get("sizes"),i=!1;return t=t||"medium",e&&(e[t]?i=e[t]:e.large?i=e.large:e.thumbnail?i=e.thumbnail:e.full&&(i=e.full),i)?_.clone(i):{url:this.model.get("url"),width:this.model.get("width"),height:this.model.get("height"),orientation:this.model.get("orientation")}},updateSetting:function(t){var e=o(t.target).closest("[data-setting]");e.length&&(e=e.data("setting"),t=t.target.value,this.model.get(e)!==t&&this.save(e,t))},save:function(){var t=this,e=this._save=this._save||{status:"ready"},i=this.model.save.apply(this.model,arguments),s=e.requests?o.when(i,e.requests):i;e.savedTimer&&clearTimeout(e.savedTimer),this.updateSave("waiting"),(e.requests=s).always(function(){e.requests===s&&(t.updateSave("resolved"===s.state()?"complete":"error"),e.savedTimer=setTimeout(function(){t.updateSave("ready"),delete e.savedTimer},2e3))})},updateSave:function(t){var e=this._save=this._save||{status:"ready"};return t&&t!==e.status&&(this.$el.removeClass("save-"+e.status),e.status=t),this.$el.addClass("save-"+e.status),this},updateAll:function(){var t=this.$("[data-setting]"),i=this.model,t=_.chain(t).map(function(t){var e=o("input, textarea, select, [value]",t);if(e.length)return t=o(t).data("setting"),e=e.val(),i.get(t)!==e?[t,e]:void 0}).compact().object().value();_.isEmpty(t)||i.save(t)},removeFromLibrary:function(t){"keydown"===t.type&&13!==t.keyCode&&32!==t.keyCode||(t.stopPropagation(),this.collection.remove(this.model))},checkClickHandler:function(t){var e=this.options.selection;e&&(t.stopPropagation(),e.where({id:this.model.get("id")}).length?(e.remove(this.model),this.$el.focus()):e.add(this.model),this.controller.trigger("selection:toggle"))}});_.each({caption:"_syncCaption",title:"_syncTitle",artist:"_syncArtist",album:"_syncAlbum"},function(t,s){i.prototype[t]=function(t,e){var i=this.$('[data-setting="'+s+'"]');return!i.length||e===i.find("input, textarea, select, [value]").val()?this:this.render()}}),t.exports=i},7274:function(t){var e=wp.media.view.Attachment,i=wp.media.view.l10n,o=jQuery,n=wp.i18n.__,s=e.extend({tagName:"div",className:"attachment-details",template:wp.template("attachment-details"),attributes:{},events:{"change [data-setting]":"updateSetting","change [data-setting] input":"updateSetting","change [data-setting] select":"updateSetting","change [data-setting] textarea":"updateSetting","click .delete-attachment":"deleteAttachment","click .trash-attachment":"trashAttachment","click .untrash-attachment":"untrashAttachment","click .edit-attachment":"editAttachment",keydown:"toggleSelectionHandler"},copyAttachmentDetailsURLClipboard:function(){var s;new ClipboardJS(".copy-attachment-url").on("success",function(t){var e=o(t.trigger),i=o(".success",e.closest(".copy-to-clipboard-container"));t.clearSelection(),e.trigger("focus"),clearTimeout(s),i.removeClass("hidden"),s=setTimeout(function(){i.addClass("hidden")},3e3),wp.a11y.speak(n("The file URL has been copied to your clipboard"))})},initialize:function(){this.options=_.defaults(this.options,{rerenderOnModelChange:!1}),e.prototype.initialize.apply(this,arguments),this.copyAttachmentDetailsURLClipboard()},getFocusableElements:function(){var t=o('li[data-id="'+this.model.id+'"]');this.previousAttachment=t.prev(),this.nextAttachment=t.next()},moveFocus:function(){this.previousAttachment.length?this.previousAttachment.trigger("focus"):this.nextAttachment.length?this.nextAttachment.trigger("focus"):this.controller.uploader&&this.controller.uploader.$browser?this.controller.uploader.$browser.trigger("focus"):this.moveFocusToLastFallback()},moveFocusToLastFallback:function(){o(".media-frame").attr("tabindex","-1").trigger("focus")},deleteAttachment:function(t){t.preventDefault(),this.getFocusableElements(),window.confirm(i.warnDelete)&&(this.model.destroy({wait:!0,error:function(){window.alert(i.errorDeleting)}}),this.moveFocus())},trashAttachment:function(t){var e=this.controller.library,i=this;t.preventDefault(),this.getFocusableElements(),wp.media.view.settings.mediaTrash&&"edit-metadata"===this.controller.content.mode()?(this.model.set("status","trash"),this.model.save().done(function(){e._requery(!0),i.moveFocusToLastFallback()})):(this.model.destroy(),this.moveFocus())},untrashAttachment:function(t){var e=this.controller.library;t.preventDefault(),this.model.set("status","inherit"),this.model.save().done(function(){e._requery(!0)})},editAttachment:function(t){var e=this.controller.states.get("edit-image");window.imageEdit&&e?(t.preventDefault(),e.set("image",this.model),this.controller.setState("edit-image")):this.$el.addClass("needs-refresh")},toggleSelectionHandler:function(t){if("keydown"===t.type&&9===t.keyCode&&t.shiftKey&&t.target===this.$(":tabbable").get(0))return this.controller.trigger("attachment:details:shift-tab",t),!1},render:function(){e.prototype.render.apply(this,arguments),wp.media.mixin.removeAllPlayers(),this.$("audio, video").each(function(t,e){e=wp.media.view.MediaDetails.prepareSrc(e);new window.MediaElementPlayer(e,wp.media.mixin.mejsSettings)})}});t.exports=s},4640:function(t){var e=wp.media.view.Attachment.extend({buttons:{close:!0}});t.exports=e},1009:function(t){var e=wp.media.view.Attachment.Selection.extend({buttons:{close:!0}});t.exports=e},9254:function(t){var e=wp.media.view.Attachment.extend({buttons:{check:!0}});t.exports=e},9003:function(t){var e=wp.media.view.Attachment.extend({className:"attachment selection",toggleSelection:function(){this.options.selection.single(this.model)}});t.exports=e},8408:function(t){var e=wp.media.View,n=jQuery,i=wp.media.view.settings.infiniteScrolling,s=e.extend({tagName:"ul",className:"attachments",attributes:{tabIndex:-1},initialize:function(){this.el.id=_.uniqueId("__attachments-view-"),_.defaults(this.options,{infiniteScrolling:i||!1,refreshSensitivity:wp.media.isTouchDevice?300:200,refreshThreshold:3,AttachmentView:wp.media.view.Attachment,sortable:!1,resize:!0,idealColumnWidth:n(window).width()<640?135:150}),this._viewsByCid={},this.$window=n(window),this.resizeEvent="resize.media-modal-columns",this.collection.on("add",function(t){this.views.add(this.createAttachmentView(t),{at:this.collection.indexOf(t)})},this),this.collection.on("remove",function(t){var e=this._viewsByCid[t.cid];delete this._viewsByCid[t.cid],e&&e.remove()},this),this.collection.on("reset",this.render,this),this.controller.on("library:selection:add",this.attachmentFocus,this),this.options.infiniteScrolling&&(this.scroll=_.chain(this.scroll).bind(this).throttle(this.options.refreshSensitivity).value(),this.options.scrollElement=this.options.scrollElement||this.el,n(this.options.scrollElement).on("scroll",this.scroll)),this.initSortable(),_.bindAll(this,"setColumns"),this.options.resize&&(this.on("ready",this.bindEvents),this.controller.on("open",this.setColumns),_.defer(this.setColumns,this))},bindEvents:function(){this.$window.off(this.resizeEvent).on(this.resizeEvent,_.debounce(this.setColumns,50))},attachmentFocus:function(){this.columns&&this.$el.focus()},restoreFocus:function(){this.$("li.selected:first").focus()},arrowEvent:function(t){var e=this.$el.children("li"),i=this.columns,s=e.filter(":focus").index(),o=s+1<=i?1:Math.ceil((s+1)/i);if(-1!==s){if(37===t.keyCode){if(0===s)return;e.eq(s-1).focus()}if(38===t.keyCode){if(1===o)return;e.eq(s-i).focus()}if(39===t.keyCode){if(e.length===s)return;e.eq(s+1).focus()}40===t.keyCode&&Math.ceil(e.length/i)!==o&&e.eq(s+i).focus()}},dispose:function(){this.collection.props.off(null,null,this),this.options.resize&&this.$window.off(this.resizeEvent),e.prototype.dispose.apply(this,arguments)},setColumns:function(){var t=this.columns,e=this.$el.width();e&&(this.columns=Math.min(Math.round(e/this.options.idealColumnWidth),12)||1,t&&t===this.columns||this.$el.closest(".media-frame-content").attr("data-columns",this.columns))},initSortable:function(){var o=this.collection;this.options.sortable&&n.fn.sortable&&(this.$el.sortable(_.extend({disabled:!!o.comparator,tolerance:"pointer",start:function(t,e){e.item.data("sortableIndexStart",e.item.index())},update:function(t,e){var i=o.at(e.item.data("sortableIndexStart")),s=o.comparator;delete o.comparator,o.remove(i,{silent:!0}),o.add(i,{silent:!0,at:e.item.index()}),o.comparator=s,o.trigger("reset",o),o.saveMenuOrder()}},this.options.sortable)),o.props.on("change:orderby",function(){this.$el.sortable("option","disabled",!!o.comparator)},this),this.collection.props.on("change:orderby",this.refreshSortable,this),this.refreshSortable())},refreshSortable:function(){var t;this.options.sortable&&n.fn.sortable&&(t="menuOrder"===(t=this.collection).props.get("orderby")||!t.comparator,this.$el.sortable("option","disabled",!t))},createAttachmentView:function(t){var e=new this.options.AttachmentView({controller:this.controller,model:t,collection:this.collection,selection:this.options.selection});return this._viewsByCid[t.cid]=e},prepare:function(){this.collection.length?this.views.set(this.collection.map(this.createAttachmentView,this)):(this.views.unset(),this.options.infiniteScrolling&&this.collection.more().done(this.scroll))},ready:function(){this.options.infiniteScrolling&&this.scroll()},scroll:function(){var t,e=this,i=this.options.scrollElement,s=i.scrollTop;i===document&&(i=document.body,s=n(document).scrollTop()),n(i).is(":visible")&&this.collection.hasMore()&&(t=this.views.parent.toolbar,i.scrollHeight-(s+i.clientHeight)<i.clientHeight/3&&t.get("spinner").show(),i.scrollHeight<s+i.clientHeight*this.options.refreshThreshold&&this.collection.more().done(function(){e.scroll(),t.get("spinner").hide()}))}});t.exports=s},9239:function(t){var s=wp.media.View,o=wp.media.view.settings.mediaTrash,n=wp.media.view.l10n,a=jQuery,i=wp.media.view.settings.infiniteScrolling,r=wp.i18n.__,e=wp.i18n.sprintf,l=s.extend({tagName:"div",className:"attachments-browser",initialize:function(){_.defaults(this.options,{filters:!1,search:!0,date:!0,display:!1,sidebar:!0,AttachmentView:wp.media.view.Attachment.Library}),this.controller.on("toggle:upload:attachment",this.toggleUploader,this),this.controller.on("edit:selection",this.editSelection),this.options.sidebar&&"errors"===this.options.sidebar&&this.createSidebar(),this.controller.isModeActive("grid")?(this.createUploader(),this.createToolbar()):(this.createToolbar(),this.createUploader()),this.createAttachmentsHeading(),this.createAttachmentsWrapperView(),i||(this.$el.addClass("has-load-more"),this.createLoadMoreView()),this.options.sidebar&&"errors"!==this.options.sidebar&&this.createSidebar(),this.updateContent(),i||this.updateLoadMoreView(),this.options.sidebar&&"errors"!==this.options.sidebar||(this.$el.addClass("hide-sidebar"),"errors"===this.options.sidebar&&this.$el.addClass("sidebar-for-errors")),this.collection.on("add remove reset",this.updateContent,this),i||this.collection.on("add remove reset",this.updateLoadMoreView,this),this.collection.on("attachments:received",this.announceSearchResults,this)},announceSearchResults:_.debounce(function(){var t,e=r("Number of media items displayed: %d. Click load more for more results.");i&&(e=r("Number of media items displayed: %d. Scroll the page for more results.")),this.collection.mirroring&&this.collection.mirroring.args.s&&(0===(t=this.collection.length)?wp.a11y.speak(n.noMediaTryNewSearch):this.collection.hasMore()?wp.a11y.speak(e.replace("%d",t)):wp.a11y.speak(n.mediaFound.replace("%d",t)))},200),editSelection:function(t){t.$(".media-button-backToLibrary").focus()},dispose:function(){return this.options.selection.off(null,null,this),s.prototype.dispose.apply(this,arguments),this},createToolbar:function(){var t,e=-1!==a.inArray(this.options.filters,["uploaded","all"]),i={controller:this.controller};this.controller.isModeActive("grid")&&(i.className="media-toolbar wp-filter"),this.toolbar=new wp.media.view.Toolbar(i),this.views.add(this.toolbar),this.toolbar.set("spinner",new wp.media.view.Spinner({priority:-20})),(e||this.options.date)&&this.toolbar.set("filters-heading",new wp.media.view.Heading({priority:-100,text:n.filterAttachments,level:"h2",className:"media-attachments-filter-heading"}).render()),e&&(this.toolbar.set("filtersLabel",new wp.media.view.Label({value:n.filterByType,attributes:{for:"media-attachment-filters"},priority:-80}).render()),"uploaded"===this.options.filters?this.toolbar.set("filters",new wp.media.view.AttachmentFilters.Uploaded({controller:this.controller,model:this.collection.props,priority:-80}).render()):(t=new wp.media.view.AttachmentFilters.All({controller:this.controller,model:this.collection.props,priority:-80}),this.toolbar.set("filters",t.render()))),this.controller.isModeActive("grid")?(i=s.extend({className:"view-switch media-grid-view-switch",template:wp.template("media-library-view-switcher")}),this.toolbar.set("libraryViewSwitcher",new i({controller:this.controller,priority:-90}).render()),this.toolbar.set("dateFilterLabel",new wp.media.view.Label({value:n.filterByDate,attributes:{for:"media-attachment-date-filters"},priority:-75}).render()),this.toolbar.set("dateFilter",new wp.media.view.DateFilter({controller:this.controller,model:this.collection.props,priority:-75}).render()),this.toolbar.set("selectModeToggleButton",new wp.media.view.SelectModeToggleButton({text:n.bulkSelect,controller:this.controller,priority:-70}).render()),this.toolbar.set("deleteSelectedButton",new wp.media.view.DeleteSelectedButton({filters:t,style:"primary",disabled:!0,text:o?n.trashSelected:n.deletePermanently,controller:this.controller,priority:-80,click:function(){var e=[],i=[],t=this.controller.state().get("selection"),s=this.controller.state().get("library");!t.length||!o&&!window.confirm(n.warnBulkDelete)||o&&"trash"!==t.at(0).get("status")&&!window.confirm(n.warnBulkTrash)||(t.each(function(t){t.get("nonces").delete?o&&"trash"===t.get("status")?(t.set("status","inherit"),e.push(t.save()),i.push(t)):o?(t.set("status","trash"),e.push(t.save()),i.push(t)):t.destroy({wait:!0}):i.push(t)}),e.length?(t.remove(i),a.when.apply(null,e).then(_.bind(function(){s._requery(!0),this.controller.trigger("selection:action:done")},this))):this.controller.trigger("selection:action:done"))}}).render()),o&&this.toolbar.set("deleteSelectedPermanentlyButton",new wp.media.view.DeleteSelectedPermanentlyButton({filters:t,style:"link button-link-delete",disabled:!0,text:n.deletePermanently,controller:this.controller,priority:-55,click:function(){var e=[],i=[],t=this.controller.state().get("selection");t.length&&window.confirm(n.warnBulkDelete)&&(t.each(function(t){(t.get("nonces").delete?i:e).push(t)}),e.length&&t.remove(e),i.length&&a.when.apply(null,i.map(function(t){return t.destroy()})).then(_.bind(function(){this.controller.trigger("selection:action:done")},this)))}}).render())):this.options.date&&(this.toolbar.set("dateFilterLabel",new wp.media.view.Label({value:n.filterByDate,attributes:{for:"media-attachment-date-filters"},priority:-75}).render()),this.toolbar.set("dateFilter",new wp.media.view.DateFilter({controller:this.controller,model:this.collection.props,priority:-75}).render())),this.options.search&&(this.toolbar.set("searchLabel",new wp.media.view.Label({value:n.searchLabel,className:"media-search-input-label",attributes:{for:"media-search-input"},priority:60}).render()),this.toolbar.set("search",new wp.media.view.Search({controller:this.controller,model:this.collection.props,priority:60}).render())),this.options.dragInfo&&this.toolbar.set("dragInfo",new s({el:a('<div class="instructions">'+n.dragInfo+"</div>")[0],priority:-40})),this.options.suggestedWidth&&this.options.suggestedHeight&&this.toolbar.set("suggestedDimensions",new s({el:a('<div class="instructions">'+n.suggestedDimensions.replace("%1$s",this.options.suggestedWidth).replace("%2$s",this.options.suggestedHeight)+"</div>")[0],priority:-40}))},updateContent:function(){var t=this,e=this.controller.isModeActive("grid")?t.attachmentsNoResults:t.uploader;this.collection.length?(e.$el.addClass("hidden"),t.toolbar.get("spinner").hide()):(this.toolbar.get("spinner").show(),this.dfd=this.collection.more().done(function(){t.collection.length?e.$el.addClass("hidden"):e.$el.removeClass("hidden"),t.toolbar.get("spinner").hide()}))},createUploader:function(){this.uploader=new wp.media.view.UploaderInline({controller:this.controller,status:!1,message:this.controller.isModeActive("grid")?"":n.noItemsFound,canClose:this.controller.isModeActive("grid")}),this.uploader.$el.addClass("hidden"),this.views.add(this.uploader)},toggleUploader:function(){this.uploader.$el.hasClass("hidden")?this.uploader.show():this.uploader.hide()},createAttachmentsWrapperView:function(){this.attachmentsWrapper=new wp.media.View({className:"attachments-wrapper"}),this.views.add(this.attachmentsWrapper),this.createAttachments()},createAttachments:function(){this.attachments=new wp.media.view.Attachments({controller:this.controller,collection:this.collection,selection:this.options.selection,model:this.model,sortable:this.options.sortable,scrollElement:this.options.scrollElement,idealColumnWidth:this.options.idealColumnWidth,AttachmentView:this.options.AttachmentView}),this.controller.on("attachment:keydown:arrow",_.bind(this.attachments.arrowEvent,this.attachments)),this.controller.on("attachment:details:shift-tab",_.bind(this.attachments.restoreFocus,this.attachments)),this.views.add(".attachments-wrapper",this.attachments),this.controller.isModeActive("grid")&&(this.attachmentsNoResults=new s({controller:this.controller,tagName:"p"}),this.attachmentsNoResults.$el.addClass("hidden no-media"),this.attachmentsNoResults.$el.html(n.noMedia),this.views.add(this.attachmentsNoResults))},createLoadMoreView:function(){var t=this;this.loadMoreWrapper=new s({controller:this.controller,className:"load-more-wrapper"}),this.loadMoreCount=new s({controller:this.controller,tagName:"p",className:"load-more-count hidden"}),this.loadMoreButton=new wp.media.view.Button({text:r("Load more"),className:"load-more hidden",style:"primary",size:"",click:function(){t.loadMoreAttachments()}}),this.loadMoreSpinner=new wp.media.view.Spinner,this.loadMoreJumpToFirst=new wp.media.view.Button({text:r("Jump to first loaded item"),className:"load-more-jump hidden",size:"",click:function(){t.jumpToFirstAddedItem()}}),this.views.add(".attachments-wrapper",this.loadMoreWrapper),this.views.add(".load-more-wrapper",this.loadMoreSpinner),this.views.add(".load-more-wrapper",this.loadMoreCount),this.views.add(".load-more-wrapper",this.loadMoreButton),this.views.add(".load-more-wrapper",this.loadMoreJumpToFirst)},updateLoadMoreView:_.debounce(function(){this.loadMoreButton.$el.addClass("hidden"),this.loadMoreCount.$el.addClass("hidden"),this.loadMoreJumpToFirst.$el.addClass("hidden").prop("disabled",!0),this.collection.getTotalAttachments()&&(this.collection.length&&(this.loadMoreCount.$el.text(e(r("Showing %1$s of %2$s media items"),this.collection.length,this.collection.getTotalAttachments())),this.loadMoreCount.$el.removeClass("hidden")),this.collection.hasMore()&&this.loadMoreButton.$el.removeClass("hidden"),this.firstAddedMediaItem=this.$el.find(".attachment").eq(this.firstAddedMediaItemIndex),this.firstAddedMediaItem.length&&(this.firstAddedMediaItem.addClass("new-media"),this.loadMoreJumpToFirst.$el.removeClass("hidden").prop("disabled",!1)),this.firstAddedMediaItem.length&&!this.collection.hasMore()&&this.loadMoreJumpToFirst.$el.trigger("focus"))},10),loadMoreAttachments:function(){var t=this;this.collection.hasMore()&&(this.firstAddedMediaItemIndex=this.collection.length,this.$el.addClass("more-loaded"),this.collection.each(function(t){t=t.attributes.id;a('[data-id="'+t+'"]').addClass("found-media")}),t.loadMoreSpinner.show(),this.collection.once("attachments:received",function(){t.loadMoreSpinner.hide()}),this.collection.more())},jumpToFirstAddedItem:function(){this.firstAddedMediaItem.focus()},createAttachmentsHeading:function(){this.attachmentsHeading=new wp.media.view.Heading({text:n.attachmentsList,level:"h2",className:"media-views-heading screen-reader-text"}),this.views.add(this.attachmentsHeading)},createSidebar:function(){var t=this.options.selection,e=this.sidebar=new wp.media.view.Sidebar({controller:this.controller});this.views.add(e),this.controller.uploader&&e.set("uploads",new wp.media.view.UploaderStatus({controller:this.controller,priority:40})),t.on("selection:single",this.createSingle,this),t.on("selection:unsingle",this.disposeSingle,this),t.single()&&this.createSingle()},createSingle:function(){var t=this.sidebar,e=this.options.selection.single();t.set("details",new wp.media.view.Attachment.Details({controller:this.controller,model:e,priority:80})),t.set("compat",new wp.media.view.AttachmentCompat({controller:this.controller,model:e,priority:120})),this.options.display&&t.set("display",new wp.media.view.Settings.AttachmentDisplay({controller:this.controller,model:this.model.display(e),attachment:e,priority:160,userSettings:this.model.get("displayUserSettings")})),"insert"===this.model.id&&t.$el.addClass("visible")},disposeSingle:function(){var t=this.sidebar;t.unset("details"),t.unset("compat"),t.unset("display"),t.$el.removeClass("visible")}});t.exports=l},1223:function(t){var e=wp.media.view.Attachments,i=e.extend({events:{},initialize:function(){return _.defaults(this.options,{sortable:!1,resize:!1,AttachmentView:wp.media.view.Attachment.Selection}),e.prototype.initialize.apply(this,arguments)}});t.exports=i},4094:function(t){var e=Backbone.$,i=wp.media.View.extend({tagName:"div",className:"button-group button-large media-button-group",initialize:function(){this.buttons=_.map(this.options.buttons||[],function(t){return t instanceof Backbone.View?t:new wp.media.view.Button(t).render()}),delete this.options.buttons,this.options.classes&&this.$el.addClass(this.options.classes)},render:function(){return this.$el.html(e(_.pluck(this.buttons,"el")).detach()),this}});t.exports=i},3157:function(t){var e=wp.media.View.extend({tagName:"button",className:"media-button",attributes:{type:"button"},events:{click:"click"},defaults:{text:"",style:"",size:"large",disabled:!1},initialize:function(){this.model=new Backbone.Model(this.defaults),_.each(this.defaults,function(t,e){var i=this.options[e];_.isUndefined(i)||(this.model.set(e,i),delete this.options[e])},this),this.listenTo(this.model,"change",this.render)},render:function(){var t=["button",this.className],e=this.model.toJSON();return e.style&&t.push("button-"+e.style),e.size&&t.push("button-"+e.size),t=_.uniq(t.concat(this.options.classes)),this.el.className=t.join(" "),this.$el.attr("disabled",e.disabled),this.$el.text(this.model.get("text")),this},click:function(t){"#"===this.attributes.href&&t.preventDefault(),this.options.click&&!this.model.get("disabled")&&this.options.click.apply(this,arguments)}});t.exports=e},7137:function(t){var e=wp.media.View,i=wp.media.view.UploaderStatus,s=wp.media.view.l10n,o=jQuery,n=e.extend({className:"crop-content",template:wp.template("crop-content"),initialize:function(){_.bindAll(this,"onImageLoad")},ready:function(){this.controller.frame.on("content:error:crop",this.onError,this),this.$image=this.$el.find(".crop-image"),this.$image.on("load",this.onImageLoad),o(window).on("resize.cropper",_.debounce(this.onImageLoad,250))},remove:function(){o(window).off("resize.cropper"),this.$el.remove(),this.$el.off(),e.prototype.remove.apply(this,arguments)},prepare:function(){return{title:s.cropYourImage,url:this.options.attachment.get("url")}},onImageLoad:function(){var i,t=this.controller.get("imgSelectOptions");"function"==typeof t&&(t=t(this.options.attachment,this.controller)),t=_.extend(t,{parent:this.$el,onInit:function(){var e=i.getOptions().aspectRatio;this.parent.children().on("mousedown touchstart",function(t){!e&&t.shiftKey&&i.setOptions({aspectRatio:"1:1"})}),this.parent.children().on("mouseup touchend",function(){i.setOptions({aspectRatio:e||!1})})}}),this.trigger("image-loaded"),i=this.controller.imgSelect=this.$image.imgAreaSelect(t)},onError:function(){var t=this.options.attachment.get("filename");this.views.add(".upload-errors",new wp.media.view.UploaderStatusError({filename:i.prototype.filename(t),message:window._wpMediaViewsL10n.cropError}),{at:0})}});t.exports=n},5970:function(t){var e=wp.media.View,i=e.extend({className:"image-editor",template:wp.template("image-editor"),initialize:function(t){this.editor=window.imageEdit,this.controller=t.controller,e.prototype.initialize.apply(this,arguments)},prepare:function(){return this.model.toJSON()},loadEditor:function(){this.editor.open(this.model.get("id"),this.model.get("nonces").edit,this)},back:function(){var t=this.controller.lastState();this.controller.setState(t)},refresh:function(){this.model.fetch()},save:function(){var t=this.controller.lastState();this.model.fetch().done(_.bind(function(){this.controller.setState(t)},this))}});t.exports=i},5138:function(t){var e=wp.media.View.extend({className:"media-embed",initialize:function(){this.url=new wp.media.view.EmbedUrl({controller:this.controller,model:this.model.props}).render(),this.views.set([this.url]),this.refresh(),this.listenTo(this.model,"change:type",this.refresh),this.listenTo(this.model,"change:loading",this.loading)},settings:function(t){this._settings&&this._settings.remove(),this._settings=t,this.views.add(t)},refresh:function(){var t,e=this.model.get("type");if("image"===e)t=wp.media.view.EmbedImage;else{if("link"!==e)return;t=wp.media.view.EmbedLink}this.settings(new t({controller:this.controller,model:this.model.props,priority:40}))},loading:function(){this.$el.toggleClass("embed-loading",this.model.get("loading"))}});t.exports=e},1338:function(t){var e=wp.media.view.Settings.AttachmentDisplay,i=e.extend({className:"embed-media-settings",template:wp.template("embed-image-settings"),initialize:function(){e.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:url",this.updateImage)},updateImage:function(){this.$("img").attr("src",this.model.get("url"))}});t.exports=i},6959:function(t){var i=jQuery,e=wp.media.view.Settings.extend({className:"embed-link-settings",template:wp.template("embed-link-settings"),initialize:function(){this.listenTo(this.model,"change:url",this.updateoEmbed)},updateoEmbed:_.debounce(function(){var t=this.model.get("url");this.$(".embed-container").hide().find(".embed-preview").empty(),this.$(".setting").hide(),t&&(t.length<11||!t.match(/^http(s)?:\/\//))||this.fetch()},wp.media.controller.Embed.sensitivity),fetch:function(){var t,e=this.model.get("url");i("#embed-url-field").val()===e&&(this.dfd&&"pending"===this.dfd.state()&&this.dfd.abort(),(t=/https?:\/\/www\.youtube\.com\/embed\/([^/]+)/.exec(e))&&(e="https://www.youtube.com/watch?v="+t[1]),this.dfd=wp.apiRequest({url:wp.media.view.settings.oEmbedProxyUrl,data:{url:e,maxwidth:this.model.get("width"),maxheight:this.model.get("height")},type:"GET",dataType:"json",context:this}).done(function(t){this.renderoEmbed({data:{body:t.html||""}})}).fail(this.renderFail))},renderFail:function(t,e){"abort"!==e&&this.$(".link-text").show()},renderoEmbed:function(t){t=t&&t.data&&t.data.body||"";t?this.$(".embed-container").show().find(".embed-preview").html(t):this.renderFail()}});t.exports=e},4848:function(t){var e=wp.media.View,i=jQuery,s=wp.media.view.l10n,o=e.extend({tagName:"span",className:"embed-url",events:{input:"url"},initialize:function(){this.$input=i('<input id="embed-url-field" type="url" />').attr("aria-label",s.insertFromUrlTitle).val(this.model.get("url")),this.input=this.$input[0],this.spinner=i('<span class="spinner" />')[0],this.$el.append([this.input,this.spinner]),this.listenTo(this.model,"change:url",this.render),this.model.get("url")&&_.delay(_.bind(function(){this.model.trigger("change:url")},this),500)},render:function(){var t=this.$input;if(!t.is(":focus"))return this.model.get("url")?this.input.value=this.model.get("url"):this.input.setAttribute("placeholder","https://"),e.prototype.render.apply(this,arguments),this},url:function(t){t=t.target.value||"";this.model.set("url",t.trim())}});t.exports=o},6557:function(t){var o=jQuery,e=wp.media.View.extend({events:{keydown:"focusManagementMode"},initialize:function(t){this.mode=t.mode||"constrainTabbing",this.tabsAutomaticActivation=t.tabsAutomaticActivation||!1},focusManagementMode:function(t){"constrainTabbing"===this.mode&&this.constrainTabbing(t),"tabsNavigation"===this.mode&&this.tabsNavigation(t)},getTabbables:function(){return this.$(":tabbable").not('.moxie-shim input[type="file"]')},focus:function(){this.$(".media-modal").trigger("focus")},constrainTabbing:function(t){var e;if(9===t.keyCode)return(e=this.getTabbables()).last()[0]!==t.target||t.shiftKey?e.first()[0]===t.target&&t.shiftKey?(e.last().focus(),!1):void 0:(e.first().focus(),!1)},setAriaHiddenOnBodyChildren:function(e){var t,i=this;this.isBodyAriaHidden||(t=document.body.children,_.each(t,function(t){t!==e[0]&&i.elementShouldBeHidden(t)&&(t.setAttribute("aria-hidden","true"),i.ariaHiddenElements.push(t))}),this.isBodyAriaHidden=!0)},removeAriaHiddenFromBodyChildren:function(){_.each(this.ariaHiddenElements,function(t){t.removeAttribute("aria-hidden")}),this.ariaHiddenElements=[],this.isBodyAriaHidden=!1},elementShouldBeHidden:function(t){var e=t.getAttribute("role");return!("SCRIPT"===t.tagName||t.hasAttribute("aria-hidden")||t.hasAttribute("aria-live")||-1!==["alert","status","log","marquee","timer"].indexOf(e))},isBodyAriaHidden:!1,ariaHiddenElements:[],tabs:o(),setupAriaTabs:function(){this.tabs=this.$('[role="tab"]'),this.tabs.attr({"aria-selected":"false",tabIndex:"-1"}),this.tabs.filter(".active").removeAttr("tabindex").attr("aria-selected","true")},tabsNavigation:function(t){var e="horizontal";-1===[32,35,36,37,38,39,40].indexOf(t.which)||"horizontal"===(e="vertical"===this.$el.attr("aria-orientation")?"vertical":e)&&-1!==[38,40].indexOf(t.which)||"vertical"===e&&-1!==[37,39].indexOf(t.which)||this.switchTabs(t,this.tabs)},switchTabs:function(t){var e,i=t.which,s=this.tabs.index(o(t.target));switch(i){case 32:this.activateTab(this.tabs[s]);break;case 35:t.preventDefault(),this.activateTab(this.tabs[this.tabs.length-1]);break;case 36:t.preventDefault(),this.activateTab(this.tabs[0]);break;case 37:case 38:t.preventDefault(),e=s-1<0?this.tabs.length-1:s-1,this.activateTab(this.tabs[e]);break;case 39:case 40:t.preventDefault(),e=s+1===this.tabs.length?0:s+1,this.activateTab(this.tabs[e])}},activateTab:function(t){t&&(t.focus(),this.tabsAutomaticActivation?(t.removeAttribute("tabindex"),t.setAttribute("aria-selected","true"),t.click()):o(t).on("click",function(){t.removeAttribute("tabindex"),t.setAttribute("aria-selected","true")}))}});t.exports=e},3647:function(t){var e=wp.media.View.extend({initialize:function(){_.defaults(this.options,{mode:["select"]}),this._createRegions(),this._createStates(),this._createModes()},_createRegions:function(){this.regions=this.regions?this.regions.slice():[],_.each(this.regions,function(t){this[t]=new wp.media.controller.Region({view:this,id:t,selector:".media-frame-"+t})},this)},_createStates:function(){this.states=new Backbone.Collection(null,{model:wp.media.controller.State}),this.states.on("add",function(t){t.frame=this,t.trigger("ready")},this),this.options.states&&this.states.add(this.options.states)},_createModes:function(){this.activeModes=new Backbone.Collection,this.activeModes.on("add remove reset",_.bind(this.triggerModeEvents,this)),_.each(this.options.mode,function(t){this.activateMode(t)},this)},reset:function(){return this.states.invoke("trigger","reset"),this},triggerModeEvents:function(t,e,i){var s,o={add:"activate",remove:"deactivate"};_.each(i,function(t,e){t&&(s=e)}),_.has(o,s)&&(i=t.get("id")+":"+o[s],this.trigger(i))},activateMode:function(t){if(!this.isModeActive(t))return this.activeModes.add([{id:t}]),this.$el.addClass("mode-"+t),this},deactivateMode:function(t){return this.isModeActive(t)&&(this.activeModes.remove(this.activeModes.where({id:t})),this.$el.removeClass("mode-"+t),this.trigger(t+":deactivate")),this},isModeActive:function(t){return Boolean(this.activeModes.where({id:t}).length)}});_.extend(e.prototype,wp.media.controller.StateMachine.prototype),t.exports=e},9142:function(t){var e=wp.media.view.MediaFrame.Select,s=wp.media.view.l10n,i=e.extend({defaults:{id:"image",url:"",menu:"image-details",content:"image-details",toolbar:"image-details",type:"link",title:s.imageDetailsTitle,priority:120},initialize:function(t){this.image=new wp.media.model.PostImage(t.metadata),this.options.selection=new wp.media.model.Selection(this.image.attachment,{multiple:!1}),e.prototype.initialize.apply(this,arguments)},bindHandlers:function(){e.prototype.bindHandlers.apply(this,arguments),this.on("menu:create:image-details",this.createMenu,this),this.on("content:create:image-details",this.imageDetailsContent,this),this.on("content:render:edit-image",this.editImageContent,this),this.on("toolbar:render:image-details",this.renderImageDetailsToolbar,this),this.on("toolbar:render:replace",this.renderReplaceImageToolbar,this)},createStates:function(){this.states.add([new wp.media.controller.ImageDetails({image:this.image,editable:!1}),new wp.media.controller.ReplaceImage({id:"replace-image",library:wp.media.query({type:"image"}),image:this.image,multiple:!1,title:s.imageReplaceTitle,toolbar:"replace",priority:80,displaySettings:!0}),new wp.media.controller.EditImage({image:this.image,selection:this.options.selection})])},imageDetailsContent:function(t){t.view=new wp.media.view.ImageDetails({controller:this,model:this.state().image,attachment:this.state().image.attachment})},editImageContent:function(){var t=this.state().get("image");t&&(t=new wp.media.view.EditImage({model:t,controller:this}).render(),this.content.set(t),t.loadEditor())},renderImageDetailsToolbar:function(){this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{select:{style:"primary",text:s.update,priority:80,click:function(){var t=this.controller,e=t.state();t.close(),e.trigger("update",t.image.toJSON()),t.setState(t.options.state),t.reset()}}}}))},renderReplaceImageToolbar:function(){var t=this,e=t.lastState(),i=e&&e.id;this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{back:{text:s.back,priority:80,click:function(){i?t.setState(i):t.close()}},replace:{style:"primary",text:s.replace,priority:20,requires:{selection:!0},click:function(){var t=this.controller,e=t.state(),i=e.get("selection").single();t.close(),t.image.changeAttachment(i,e.display(i)),e.trigger("replace",t.image.toJSON()),t.setState(t.options.state),t.reset()}}}}))}});t.exports=i},9075:function(t){var e=wp.media.view.MediaFrame.Select,i=wp.media.controller.Library,o=wp.media.view.l10n,s=e.extend({initialize:function(){this.counts={audio:{count:wp.media.view.settings.attachmentCounts.audio,state:"playlist"},video:{count:wp.media.view.settings.attachmentCounts.video,state:"video-playlist"}},_.defaults(this.options,{multiple:!0,editing:!1,state:"insert",metadata:{}}),e.prototype.initialize.apply(this,arguments),this.createIframeStates()},createStates:function(){var t=this.options;this.states.add([new i({id:"insert",title:o.insertMediaTitle,priority:20,toolbar:"main-insert",filterable:"all",library:wp.media.query(t.library),multiple:!!t.multiple&&"reset",editable:!0,allowLocalEdits:!0,displaySettings:!0,displayUserSettings:!0}),new i({id:"gallery",title:o.createGalleryTitle,priority:40,toolbar:"main-gallery",filterable:"uploaded",multiple:"add",editable:!1,library:wp.media.query(_.defaults({type:"image"},t.library))}),new wp.media.controller.Embed({metadata:t.metadata}),new wp.media.controller.EditImage({model:t.editImage}),new wp.media.controller.GalleryEdit({library:t.selection,editing:t.editing,menu:"gallery"}),new wp.media.controller.GalleryAdd,new i({id:"playlist",title:o.createPlaylistTitle,priority:60,toolbar:"main-playlist",filterable:"uploaded",multiple:"add",editable:!1,library:wp.media.query(_.defaults({type:"audio"},t.library))}),new wp.media.controller.CollectionEdit({type:"audio",collectionType:"playlist",title:o.editPlaylistTitle,SettingsView:wp.media.view.Settings.Playlist,library:t.selection,editing:t.editing,menu:"playlist",dragInfoText:o.playlistDragInfo,dragInfo:!1}),new wp.media.controller.CollectionAdd({type:"audio",collectionType:"playlist",title:o.addToPlaylistTitle}),new i({id:"video-playlist",title:o.createVideoPlaylistTitle,priority:60,toolbar:"main-video-playlist",filterable:"uploaded",multiple:"add",editable:!1,library:wp.media.query(_.defaults({type:"video"},t.library))}),new wp.media.controller.CollectionEdit({type:"video",collectionType:"playlist",title:o.editVideoPlaylistTitle,SettingsView:wp.media.view.Settings.Playlist,library:t.selection,editing:t.editing,menu:"video-playlist",dragInfoText:o.videoPlaylistDragInfo,dragInfo:!1}),new wp.media.controller.CollectionAdd({type:"video",collectionType:"playlist",title:o.addToVideoPlaylistTitle})]),wp.media.view.settings.post.featuredImageId&&this.states.add(new wp.media.controller.FeaturedImage)},bindHandlers:function(){e.prototype.bindHandlers.apply(this,arguments),this.on("activate",this.activate,this),void 0!==_.find(this.counts,function(t){return 0===t.count})&&this.listenTo(wp.media.model.Attachments.all,"change:type",this.mediaTypeCounts),this.on("menu:create:gallery",this.createMenu,this),this.on("menu:create:playlist",this.createMenu,this),this.on("menu:create:video-playlist",this.createMenu,this),this.on("toolbar:create:main-insert",this.createToolbar,this),this.on("toolbar:create:main-gallery",this.createToolbar,this),this.on("toolbar:create:main-playlist",this.createToolbar,this),this.on("toolbar:create:main-video-playlist",this.createToolbar,this),this.on("toolbar:create:featured-image",this.featuredImageToolbar,this),this.on("toolbar:create:main-embed",this.mainEmbedToolbar,this),_.each({menu:{default:"mainMenu",gallery:"galleryMenu",playlist:"playlistMenu","video-playlist":"videoPlaylistMenu"},content:{embed:"embedContent","edit-image":"editImageContent","edit-selection":"editSelectionContent"},toolbar:{"main-insert":"mainInsertToolbar","main-gallery":"mainGalleryToolbar","gallery-edit":"galleryEditToolbar","gallery-add":"galleryAddToolbar","main-playlist":"mainPlaylistToolbar","playlist-edit":"playlistEditToolbar","playlist-add":"playlistAddToolbar","main-video-playlist":"mainVideoPlaylistToolbar","video-playlist-edit":"videoPlaylistEditToolbar","video-playlist-add":"videoPlaylistAddToolbar"}},function(t,i){_.each(t,function(t,e){this.on(i+":render:"+e,this[t],this)},this)},this)},activate:function(){_.each(this.counts,function(t){t.count<1&&this.menuItemVisibility(t.state,"hide")},this)},mediaTypeCounts:function(t,e){void 0!==this.counts[e]&&this.counts[e].count<1&&(this.counts[e].count++,this.menuItemVisibility(this.counts[e].state,"show"))},mainMenu:function(t){t.set({"library-separator":new wp.media.View({className:"separator",priority:100,attributes:{role:"presentation"}})})},menuItemVisibility:function(t,e){var i=this.menu.get();"hide"===e?i.hide(t):"show"===e&&i.show(t)},galleryMenu:function(t){var e=this.lastState(),i=e&&e.id,s=this;t.set({cancel:{text:o.cancelGalleryTitle,priority:20,click:function(){i?s.setState(i):s.close(),this.controller.modal.focusManager.focus()}},separateCancel:new wp.media.View({className:"separator",priority:40})})},playlistMenu:function(t){var e=this.lastState(),i=e&&e.id,s=this;t.set({cancel:{text:o.cancelPlaylistTitle,priority:20,click:function(){i?s.setState(i):s.close(),this.controller.modal.focusManager.focus()}},separateCancel:new wp.media.View({className:"separator",priority:40})})},videoPlaylistMenu:function(t){var e=this.lastState(),i=e&&e.id,s=this;t.set({cancel:{text:o.cancelVideoPlaylistTitle,priority:20,click:function(){i?s.setState(i):s.close(),this.controller.modal.focusManager.focus()}},separateCancel:new wp.media.View({className:"separator",priority:40})})},embedContent:function(){var t=new wp.media.view.Embed({controller:this,model:this.state()}).render();this.content.set(t)},editSelectionContent:function(){var t=this.state(),e=t.get("selection"),e=new wp.media.view.AttachmentsBrowser({controller:this,collection:e,selection:e,model:t,sortable:!0,search:!1,date:!1,dragInfo:!0,AttachmentView:wp.media.view.Attachments.EditSelection}).render();e.toolbar.set("backToLibrary",{text:o.returnToLibrary,priority:-100,click:function(){this.controller.content.mode("browse"),this.controller.modal.focusManager.focus()}}),this.content.set(e),this.trigger("edit:selection",this)},editImageContent:function(){var t=this.state().get("image"),t=new wp.media.view.EditImage({model:t,controller:this}).render();this.content.set(t),t.loadEditor()},selectionStatusToolbar:function(t){var e=this.state().get("editable");t.set("selection",new wp.media.view.Selection({controller:this,collection:this.state().get("selection"),priority:-40,editable:e&&function(){this.controller.content.mode("edit-selection")}}).render())},mainInsertToolbar:function(t){var i=this;this.selectionStatusToolbar(t),t.set("insert",{style:"primary",priority:80,text:o.insertIntoPost,requires:{selection:!0},click:function(){var t=i.state(),e=t.get("selection");i.close(),t.trigger("insert",e).reset()}})},mainGalleryToolbar:function(t){var s=this;this.selectionStatusToolbar(t),t.set("gallery",{style:"primary",text:o.createNewGallery,priority:60,requires:{selection:!0},click:function(){var t=s.state().get("selection"),e=s.state("gallery-edit"),i=t.where({type:"image"});e.set("library",new wp.media.model.Selection(i,{props:t.props.toJSON(),multiple:!0})),this.controller.setState("gallery-edit"),this.controller.modal.focusManager.focus()}})},mainPlaylistToolbar:function(t){var s=this;this.selectionStatusToolbar(t),t.set("playlist",{style:"primary",text:o.createNewPlaylist,priority:100,requires:{selection:!0},click:function(){var t=s.state().get("selection"),e=s.state("playlist-edit"),i=t.where({type:"audio"});e.set("library",new wp.media.model.Selection(i,{props:t.props.toJSON(),multiple:!0})),this.controller.setState("playlist-edit"),this.controller.modal.focusManager.focus()}})},mainVideoPlaylistToolbar:function(t){var s=this;this.selectionStatusToolbar(t),t.set("video-playlist",{style:"primary",text:o.createNewVideoPlaylist,priority:100,requires:{selection:!0},click:function(){var t=s.state().get("selection"),e=s.state("video-playlist-edit"),i=t.where({type:"video"});e.set("library",new wp.media.model.Selection(i,{props:t.props.toJSON(),multiple:!0})),this.controller.setState("video-playlist-edit"),this.controller.modal.focusManager.focus()}})},featuredImageToolbar:function(t){this.createSelectToolbar(t,{text:o.setFeaturedImage,state:this.options.state})},mainEmbedToolbar:function(t){t.view=new wp.media.view.Toolbar.Embed({controller:this})},galleryEditToolbar:function(){var t=this.state().get("editing");this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:t?o.updateGallery:o.insertGallery,priority:80,requires:{library:!0},click:function(){var t=this.controller,e=t.state();t.close(),e.trigger("update",e.get("library")),t.setState(t.options.state),t.reset()}}}}))},galleryAddToolbar:function(){this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:o.addToGallery,priority:80,requires:{selection:!0},click:function(){var t=this.controller,e=t.state();t.state("gallery-edit").get("library").add(e.get("selection").models),e.trigger("reset"),t.setState("gallery-edit"),this.controller.modal.focusManager.focus()}}}}))},playlistEditToolbar:function(){var t=this.state().get("editing");this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:t?o.updatePlaylist:o.insertPlaylist,priority:80,requires:{library:!0},click:function(){var t=this.controller,e=t.state();t.close(),e.trigger("update",e.get("library")),t.setState(t.options.state),t.reset()}}}}))},playlistAddToolbar:function(){this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:o.addToPlaylist,priority:80,requires:{selection:!0},click:function(){var t=this.controller,e=t.state();t.state("playlist-edit").get("library").add(e.get("selection").models),e.trigger("reset"),t.setState("playlist-edit"),this.controller.modal.focusManager.focus()}}}}))},videoPlaylistEditToolbar:function(){var t=this.state().get("editing");this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:t?o.updateVideoPlaylist:o.insertVideoPlaylist,priority:140,requires:{library:!0},click:function(){var t=this.controller,e=t.state(),i=e.get("library");i.type="video",t.close(),e.trigger("update",i),t.setState(t.options.state),t.reset()}}}}))},videoPlaylistAddToolbar:function(){this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:o.addToVideoPlaylist,priority:140,requires:{selection:!0},click:function(){var t=this.controller,e=t.state();t.state("video-playlist-edit").get("library").add(e.get("selection").models),e.trigger("reset"),t.setState("video-playlist-edit"),this.controller.modal.focusManager.focus()}}}}))}});t.exports=s},8719:function(t){var e=wp.media.view.MediaFrame,i=wp.media.view.l10n,s=e.extend({initialize:function(){e.prototype.initialize.apply(this,arguments),_.defaults(this.options,{selection:[],library:{},multiple:!1,state:"library"}),this.createSelection(),this.createStates(),this.bindHandlers()},createSelection:function(){var t=this.options.selection;t instanceof wp.media.model.Selection||(this.options.selection=new wp.media.model.Selection(t,{multiple:this.options.multiple})),this._selection={attachments:new wp.media.model.Attachments,difference:[]}},editImageContent:function(){var t=this.state().get("image"),t=new wp.media.view.EditImage({model:t,controller:this}).render();this.content.set(t),t.loadEditor()},createStates:function(){var t=this.options;this.options.states||this.states.add([new wp.media.controller.Library({library:wp.media.query(t.library),multiple:t.multiple,title:t.title,priority:20}),new wp.media.controller.EditImage({model:t.editImage})])},bindHandlers:function(){this.on("router:create:browse",this.createRouter,this),this.on("router:render:browse",this.browseRouter,this),this.on("content:create:browse",this.browseContent,this),this.on("content:render:upload",this.uploadContent,this),this.on("toolbar:create:select",this.createSelectToolbar,this),this.on("content:render:edit-image",this.editImageContent,this)},browseRouter:function(t){t.set({upload:{text:i.uploadFilesTitle,priority:20},browse:{text:i.mediaLibraryTitle,priority:40}})},browseContent:function(t){var e=this.state();this.$el.removeClass("hide-toolbar"),t.view=new wp.media.view.AttachmentsBrowser({controller:this,collection:e.get("library"),selection:e.get("selection"),model:e,sortable:e.get("sortable"),search:e.get("searchable"),filters:e.get("filterable"),date:e.get("date"),display:e.has("display")?e.get("display"):e.get("displaySettings"),dragInfo:e.get("dragInfo"),idealColumnWidth:e.get("idealColumnWidth"),suggestedWidth:e.get("suggestedWidth"),suggestedHeight:e.get("suggestedHeight"),AttachmentView:e.get("AttachmentView")})},uploadContent:function(){this.$el.removeClass("hide-toolbar"),this.content.set(new wp.media.view.UploaderInline({controller:this}))},createSelectToolbar:function(t,e){(e=e||this.options.button||{}).controller=this,t.view=new wp.media.view.Toolbar.Select(e)}});t.exports=s},7990:function(t){var e=wp.media.View.extend({tagName:function(){return this.options.level||"h1"},className:"media-views-heading",initialize:function(){this.options.className&&this.$el.addClass(this.options.className),this.text=this.options.text},render:function(){return this.$el.html(this.text),this}});t.exports=e},6217:function(t){var e=wp.media.View.extend({className:"media-iframe",render:function(){return this.views.detach(),this.$el.html('<iframe src="'+this.controller.state().get("src")+'" />'),this.views.render(),this}});t.exports=e},7598:function(t){var e=wp.media.view.Settings.AttachmentDisplay,o=jQuery,i=e.extend({className:"image-details",template:wp.template("image-details"),events:_.defaults(e.prototype.events,{"click .edit-attachment":"editAttachment","click .replace-attachment":"replaceAttachment","click .advanced-toggle":"onToggleAdvanced",'change [data-setting="customWidth"]':"onCustomSize",'change [data-setting="customHeight"]':"onCustomSize",'keyup [data-setting="customWidth"]':"onCustomSize",'keyup [data-setting="customHeight"]':"onCustomSize"}),initialize:function(){this.options.attachment=this.model.attachment,this.listenTo(this.model,"change:url",this.updateUrl),this.listenTo(this.model,"change:link",this.toggleLinkSettings),this.listenTo(this.model,"change:size",this.toggleCustomSize),e.prototype.initialize.apply(this,arguments)},prepare:function(){var t=!1;return this.model.attachment&&(t=this.model.attachment.toJSON()),_.defaults({model:this.model.toJSON(),attachment:t},this.options)},render:function(){var t=arguments;return this.model.attachment&&"pending"===this.model.dfd.state()?this.model.dfd.done(_.bind(function(){e.prototype.render.apply(this,t),this.postRender()},this)).fail(_.bind(function(){this.model.attachment=!1,e.prototype.render.apply(this,t),this.postRender()},this)):(e.prototype.render.apply(this,arguments),this.postRender()),this},postRender:function(){setTimeout(_.bind(this.scrollToTop,this),10),this.toggleLinkSettings(),"show"===window.getUserSetting("advImgDetails")&&this.toggleAdvanced(!0),this.trigger("post-render")},scrollToTop:function(){this.$(".embed-media-settings").scrollTop(0)},updateUrl:function(){this.$(".image img").attr("src",this.model.get("url")),this.$(".url").val(this.model.get("url"))},toggleLinkSettings:function(){"none"===this.model.get("link")?this.$(".link-settings").addClass("hidden"):this.$(".link-settings").removeClass("hidden")},toggleCustomSize:function(){"custom"!==this.model.get("size")?this.$(".custom-size").addClass("hidden"):this.$(".custom-size").removeClass("hidden")},onCustomSize:function(t){var e,i=o(t.target).data("setting"),s=o(t.target).val();!/^\d+/.test(s)||parseInt(s,10)<1?t.preventDefault():("customWidth"===i?(e=Math.round(1/this.model.get("aspectRatio")*s),this.model.set("customHeight",e,{silent:!0}),this.$('[data-setting="customHeight"]')):(e=Math.round(this.model.get("aspectRatio")*s),this.model.set("customWidth",e,{silent:!0}),this.$('[data-setting="customWidth"]'))).val(e)},onToggleAdvanced:function(t){t.preventDefault(),this.toggleAdvanced()},toggleAdvanced:function(t){var e=this.$el.find(".advanced-section"),t=e.hasClass("advanced-visible")||!1===t?(e.removeClass("advanced-visible"),e.find(".advanced-settings").addClass("hidden"),"hide"):(e.addClass("advanced-visible"),e.find(".advanced-settings").removeClass("hidden"),"show");window.setUserSetting("advImgDetails",t)},editAttachment:function(t){var e=this.controller.states.get("edit-image");window.imageEdit&&e&&(t.preventDefault(),e.set("image",this.model.attachment),this.controller.setState("edit-image"))},replaceAttachment:function(t){t.preventDefault(),this.controller.setState("replace-image")}});t.exports=i},6644:function(t){var e=wp.media.View.extend({tagName:"label",className:"screen-reader-text",initialize:function(){this.value=this.options.value},render:function(){return this.$el.html(this.value),this}});t.exports=e},4861:function(t){var e=wp.media.view.Frame,i=wp.media.view.l10n,o=jQuery,s=e.extend({className:"media-frame",template:wp.template("media-frame"),regions:["menu","title","content","toolbar","router"],events:{"click .media-frame-menu-toggle":"toggleMenu"},initialize:function(){e.prototype.initialize.apply(this,arguments),_.defaults(this.options,{title:i.mediaFrameDefaultTitle,modal:!0,uploader:!0}),this.$el.addClass("wp-core-ui"),this.options.modal&&(this.modal=new wp.media.view.Modal({controller:this,title:this.options.title}),this.modal.content(this)),!wp.Uploader.limitExceeded&&wp.Uploader.browser.supported||(this.options.uploader=!1),this.options.uploader&&(this.uploader=new wp.media.view.UploaderWindow({controller:this,uploader:{dropzone:(this.modal||this).$el,container:this.$el}}),this.views.set(".media-frame-uploader",this.uploader)),this.on("attach",_.bind(this.views.ready,this.views),this),this.on("title:create:default",this.createTitle,this),this.title.mode("default"),this.on("menu:create:default",this.createMenu,this),this.on("open",this.setMenuTabPanelAriaAttributes,this),this.on("open",this.setRouterTabPanelAriaAttributes,this),this.on("content:render",this.setMenuTabPanelAriaAttributes,this),this.on("content:render",this.setRouterTabPanelAriaAttributes,this)},setMenuTabPanelAriaAttributes:function(){var t=this.state().get("id"),e=this.$el.find(".media-frame-tab-panel");e.removeAttr("role aria-labelledby tabindex"),this.state().get("menu")&&this.menuView&&this.menuView.isVisible&&e.attr({role:"tabpanel","aria-labelledby":"menu-item-"+t,tabIndex:"0"})},setRouterTabPanelAriaAttributes:function(){var t,e=this.$el.find(".media-frame-content");e.removeAttr("role aria-labelledby tabindex"),this.state().get("router")&&this.routerView&&this.routerView.isVisible&&this.content._mode&&(t="menu-item-"+this.content._mode,e.attr({role:"tabpanel","aria-labelledby":t,tabIndex:"0"}))},render:function(){return!this.state()&&this.options.state&&this.setState(this.options.state),e.prototype.render.apply(this,arguments)},createTitle:function(t){t.view=new wp.media.View({controller:this,tagName:"h1"})},createMenu:function(t){t.view=new wp.media.view.Menu({controller:this,attributes:{role:"tablist","aria-orientation":"vertical"}}),this.menuView=t.view},toggleMenu:function(t){var e=this.$el.find(".media-menu");e.toggleClass("visible"),o(t.target).attr("aria-expanded",e.hasClass("visible"))},createToolbar:function(t){t.view=new wp.media.view.Toolbar({controller:this})},createRouter:function(t){t.view=new wp.media.view.Router({controller:this,attributes:{role:"tablist","aria-orientation":"horizontal"}}),this.routerView=t.view},createIframeStates:function(i){var t=wp.media.view.settings,e=t.tabs,s=t.tabUrl;e&&s&&((t=o("#post_ID")).length&&(s+="&post_id="+t.val()),_.each(e,function(t,e){this.state("iframe:"+e).set(_.defaults({tab:e,src:s+"&tab="+e,title:t,content:"iframe",menu:"default"},i))},this),this.on("content:create:iframe",this.iframeContent,this),this.on("content:deactivate:iframe",this.iframeContentCleanup,this),this.on("menu:render:default",this.iframeMenu,this),this.on("open",this.hijackThickbox,this),this.on("close",this.restoreThickbox,this))},iframeContent:function(t){this.$el.addClass("hide-toolbar"),t.view=new wp.media.view.Iframe({controller:this})},iframeContentCleanup:function(){this.$el.removeClass("hide-toolbar")},iframeMenu:function(t){var i={};t&&(_.each(wp.media.view.settings.tabs,function(t,e){i["iframe:"+e]={text:this.state("iframe:"+e).get("title"),priority:200}},this),t.set(i))},hijackThickbox:function(){var t=this;window.tb_remove&&!this._tb_remove&&(this._tb_remove=window.tb_remove,window.tb_remove=function(){t.close(),t.reset(),t.setState(t.options.state),t._tb_remove.call(window)})},restoreThickbox:function(){this._tb_remove&&(window.tb_remove=this._tb_remove,delete this._tb_remove)}});_.each(["open","close","attach","detach","escape"],function(t){s.prototype[t]=function(){return this.modal&&this.modal[t].apply(this.modal,arguments),this}}),t.exports=s},917:function(t){var e=wp.media.View.extend({tagName:"button",className:"media-menu-item",attributes:{type:"button",role:"tab"},events:{click:"_click"},_click:function(){var t=this.options.click;t?t.call(this):this.click()},click:function(){var t=this.options.state;t&&(this.controller.setState(t),this.views.parent.$el.removeClass("visible"))},render:function(){var t=this.options,e=t.state||t.contentMode;return t.text?this.$el.text(t.text):t.html&&this.$el.html(t.html),this.$el.attr("id","menu-item-"+e),this}});t.exports=e},2596:function(t){var e=wp.media.view.MenuItem,i=wp.media.view.PriorityList,e=i.extend({tagName:"div",className:"media-menu",property:"state",ItemView:e,region:"menu",attributes:{role:"tablist","aria-orientation":"horizontal"},initialize:function(){this._views={},this.set(_.extend({},this._views,this.options.views),{silent:!0}),delete this.options.views,this.options.silent||this.render(),this.focusManager=new wp.media.view.FocusManager({el:this.el,mode:"tabsNavigation"}),this.isVisible=!0},toView:function(t,e){return(t=t||{})[this.property]=t[this.property]||e,new this.ItemView(t).render()},ready:function(){i.prototype.ready.apply(this,arguments),this.visibility(),this.focusManager.setupAriaTabs()},set:function(){i.prototype.set.apply(this,arguments),this.visibility()},unset:function(){i.prototype.unset.apply(this,arguments),this.visibility()},visibility:function(){var t=this.region,e=this.controller[t].get(),i=this.views.get(),i=!i||i.length<2;this===e&&(this.isVisible=!i,this.controller.$el.toggleClass("hide-"+t,i))},select:function(t){t=this.get(t);t&&(this.deselect(),t.$el.addClass("active"),this.focusManager.setupAriaTabs())},deselect:function(){this.$el.children().removeClass("active")},hide:function(t){t=this.get(t);t&&t.$el.addClass("hidden")},show:function(t){t=this.get(t);t&&t.$el.removeClass("hidden")}});t.exports=e},3939:function(t){var i=jQuery,e=wp.media.View.extend({tagName:"div",template:wp.template("media-modal"),events:{"click .media-modal-backdrop, .media-modal-close":"escapeHandler",keydown:"keydown"},clickedOpenerEl:null,initialize:function(){_.defaults(this.options,{container:document.body,title:"",propagate:!0,hasCloseButton:!0}),this.focusManager=new wp.media.view.FocusManager({el:this.el})},prepare:function(){return{title:this.options.title,hasCloseButton:this.options.hasCloseButton}},attach:function(){return this.views.attached?this:(this.views.rendered||this.render(),this.$el.appendTo(this.options.container),this.views.attached=!0,this.views.ready(),this.propagate("attach"))},detach:function(){return this.$el.is(":visible")&&this.close(),this.$el.detach(),this.views.attached=!1,this.propagate("detach")},open:function(){var t,e=this.$el;return e.is(":visible")?this:(this.clickedOpenerEl=document.activeElement,this.views.attached||this.attach(),i("body").addClass("modal-open"),e.show(),"ontouchend"in document&&(t=window.tinymce&&window.tinymce.activeEditor)&&!t.isHidden()&&t.iframeElement&&(t.iframeElement.focus(),t.iframeElement.blur(),setTimeout(function(){t.iframeElement.blur()},100)),this.$(".media-modal").trigger("focus"),this.focusManager.setAriaHiddenOnBodyChildren(e),this.propagate("open"))},close:function(t){return this.views.attached&&this.$el.is(":visible")&&(i(".mejs-pause button").trigger("click"),i("body").removeClass("modal-open"),this.$el.hide(),this.focusManager.removeAriaHiddenFromBodyChildren(),null!==this.clickedOpenerEl?this.clickedOpenerEl.focus():i("#wpbody-content").attr("tabindex","-1").trigger("focus"),this.propagate("close"),t&&t.escape&&this.propagate("escape")),this},escape:function(){return this.close({escape:!0})},escapeHandler:function(t){t.preventDefault(),this.escape()},content:function(t){return this.views.set(".media-modal-content",t),this},propagate:function(t){return this.trigger(t),this.options.propagate&&this.controller.trigger(t),this},keydown:function(t){27===t.which&&this.$el.is(":visible")&&(this.escape(),t.stopImmediatePropagation())}});t.exports=e},1993:function(t){var e=wp.media.View.extend({tagName:"div",initialize:function(){this._views={},this.set(_.extend({},this._views,this.options.views),{silent:!0}),delete this.options.views,this.options.silent||this.render()},set:function(t,e,i){var s,o;return i=i||{},_.isObject(t)?_.each(t,function(t,e){this.set(e,t)},this):((e=e instanceof Backbone.View?e:this.toView(e,t,i)).controller=e.controller||this.controller,this.unset(t),s=e.options.priority||10,i=this.views.get()||[],_.find(i,function(t,e){if(t.options.priority>s)return o=e,!0}),this._views[t]=e,this.views.add(e,{at:_.isNumber(o)?o:i.length||0})),this},get:function(t){return this._views[t]},unset:function(t){var e=this.get(t);return e&&e.remove(),delete this._views[t],this},toView:function(t){return new wp.media.View(t)}});t.exports=e},9484:function(t){var e=wp.media.view.MenuItem.extend({click:function(){var t=this.options.contentMode;t&&this.controller.content.mode(t)}});t.exports=e},1562:function(t){var e=wp.media.view.Menu,i=e.extend({tagName:"div",className:"media-router",property:"contentMode",ItemView:wp.media.view.RouterItem,region:"router",attributes:{role:"tablist","aria-orientation":"horizontal"},initialize:function(){this.controller.on("content:render",this.update,this),e.prototype.initialize.apply(this,arguments)},update:function(){var t=this.controller.content.mode();t&&this.select(t)}});t.exports=i},4556:function(t){var e=wp.media.View.extend({tagName:"input",className:"search",id:"media-search-input",attributes:{type:"search"},events:{input:"search"},render:function(){return this.el.value=this.model.escape("search"),this},search:_.debounce(function(t){t=t.target.value.trim();t&&1<t.length?this.model.set("search",t):this.model.unset("search")},500)});t.exports=e},6191:function(t){var i=wp.i18n._n,s=wp.i18n.sprintf,e=wp.media.View.extend({tagName:"div",className:"media-selection",template:wp.template("media-selection"),events:{"click .edit-selection":"edit","click .clear-selection":"clear"},initialize:function(){_.defaults(this.options,{editable:!1,clearable:!0}),this.attachments=new wp.media.view.Attachments.Selection({controller:this.controller,collection:this.collection,selection:this.collection,model:new Backbone.Model}),this.views.set(".selection-view",this.attachments),this.collection.on("add remove reset",this.refresh,this),this.controller.on("content:activate",this.refresh,this)},ready:function(){this.refresh()},refresh:function(){var t,e;this.$el.children().length&&(t=this.collection,e="edit-selection"===this.controller.content.mode(),this.$el.toggleClass("empty",!t.length),this.$el.toggleClass("one",1===t.length),this.$el.toggleClass("editing",e),this.$(".count").text(s(i("%s item selected","%s items selected",t.length),t.length)))},edit:function(t){t.preventDefault(),this.options.editable&&this.options.editable.call(this,this.collection)},clear:function(t){t.preventDefault(),this.collection.reset(),this.controller.modal.focusManager.focus()}});t.exports=e},859:function(t){var e=wp.media.View,s=Backbone.$,i=e.extend({events:{"click button":"updateHandler","change input":"updateHandler","change select":"updateHandler","change textarea":"updateHandler"},initialize:function(){this.model=this.model||new Backbone.Model,this.listenTo(this.model,"change",this.updateChanges)},prepare:function(){return _.defaults({model:this.model.toJSON()},this.options)},render:function(){return e.prototype.render.apply(this,arguments),_(this.model.attributes).chain().keys().each(this.update,this),this},update:function(t){var e,i=this.model.get(t),s=this.$('[data-setting="'+t+'"]');s.length&&(s.is("select")?(e=s.find('[value="'+i+'"]')).length?(s.find("option").prop("selected",!1),e.prop("selected",!0)):this.model.set(t,s.find(":selected").val()):s.hasClass("button-group")?s.find("button").removeClass("active").attr("aria-pressed","false").filter('[value="'+i+'"]').addClass("active").attr("aria-pressed","true"):s.is('input[type="text"], textarea')?s.is(":focus")||s.val(i):s.is('input[type="checkbox"]')&&s.prop("checked",!!i&&"false"!==i))},updateHandler:function(t){var e=s(t.target).closest("[data-setting]"),i=t.target.value;t.preventDefault(),e.length&&(e.is('input[type="checkbox"]')&&(i=e[0].checked),this.model.set(e.data("setting"),i),(t=e.data("userSetting"))&&window.setUserSetting(t,i))},updateChanges:function(t){t.hasChanged()&&_(t.changed).chain().keys().each(this.update,this)}});t.exports=i},2176:function(t){var e=wp.media.view.Settings,i=e.extend({className:"attachment-display-settings",template:wp.template("attachment-display-settings"),initialize:function(){var t=this.options.attachment;_.defaults(this.options,{userSettings:!1}),e.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:link",this.updateLinkTo),t&&t.on("change:uploading",this.render,this)},dispose:function(){var t=this.options.attachment;t&&t.off(null,null,this),e.prototype.dispose.apply(this,arguments)},render:function(){var t=this.options.attachment;return t&&_.extend(this.options,{sizes:t.get("sizes"),type:t.get("type")}),e.prototype.render.call(this),this.updateLinkTo(),this},updateLinkTo:function(){var t=this.model.get("link"),e=this.$(".link-to-custom"),i=this.options.attachment;"none"===t||"embed"===t||!i&&"custom"!==t?e.closest(".setting").addClass("hidden"):(i&&("post"===t?e.val(i.get("link")):"file"===t?e.val(i.get("url")):this.model.get("linkUrl")||e.val("http://"),e.prop("readonly","custom"!==t)),e.closest(".setting").removeClass("hidden"),e.length&&e[0].scrollIntoView())}});t.exports=i},6872:function(t){var e=wp.media.view.Settings.extend({className:"collection-settings gallery-settings",template:wp.template("gallery-settings")});t.exports=e},8488:function(t){var e=wp.media.view.Settings.extend({className:"collection-settings playlist-settings",template:wp.template("playlist-settings")});t.exports=e},9799:function(t){var e=wp.media.view.PriorityList.extend({className:"media-sidebar"});t.exports=e},5187:function(t){var e=wp.media.view,i=e.Cropper.extend({className:"crop-content site-icon",ready:function(){e.Cropper.prototype.ready.apply(this,arguments),this.$(".crop-image").on("load",_.bind(this.addSidebar,this))},addSidebar:function(){this.sidebar=new wp.media.view.Sidebar({controller:this.controller}),this.sidebar.set("preview",new wp.media.view.SiteIconPreview({controller:this.controller,attachment:this.options.attachment})),this.controller.cropperView.views.add(this.sidebar)}});t.exports=i},8260:function(t){var e=wp.media.View,a=jQuery,e=e.extend({className:"site-icon-preview",template:wp.template("site-icon-preview"),ready:function(){this.controller.imgSelect.setOptions({onInit:this.updatePreview,onSelectChange:this.updatePreview})},prepare:function(){return{url:this.options.attachment.get("url")}},updatePreview:function(t,e){var i=64/e.width,s=64/e.height,o=16/e.width,n=16/e.height;a("#preview-app-icon").css({width:Math.round(i*this.imageWidth)+"px",height:Math.round(s*this.imageHeight)+"px",marginLeft:"-"+Math.round(i*e.x1)+"px",marginTop:"-"+Math.round(s*e.y1)+"px"}),a("#preview-favicon").css({width:Math.round(o*this.imageWidth)+"px",height:Math.round(n*this.imageHeight)+"px",marginLeft:"-"+Math.round(o*e.x1)+"px",marginTop:"-"+Math.floor(n*e.y1)+"px"})}});t.exports=e},2234:function(t){var e=wp.media.View.extend({tagName:"span",className:"spinner",spinnerTimeout:!1,delay:400,show:function(){return this.spinnerTimeout||(this.spinnerTimeout=_.delay(function(t){t.addClass("is-active")},this.delay,this.$el)),this},hide:function(){return this.$el.removeClass("is-active"),this.spinnerTimeout=clearTimeout(this.spinnerTimeout),this}});t.exports=e},9510:function(t){var e=wp.media.View,i=e.extend({tagName:"div",className:"media-toolbar",initialize:function(){var t=this.controller.state(),e=this.selection=t.get("selection"),t=this.library=t.get("library");this._views={},this.primary=new wp.media.view.PriorityList,this.secondary=new wp.media.view.PriorityList,this.primary.$el.addClass("media-toolbar-primary search-form"),this.secondary.$el.addClass("media-toolbar-secondary"),this.views.set([this.secondary,this.primary]),this.options.items&&this.set(this.options.items,{silent:!0}),this.options.silent||this.render(),e&&e.on("add remove reset",this.refresh,this),t&&t.on("add remove reset",this.refresh,this)},dispose:function(){return this.selection&&this.selection.off(null,null,this),this.library&&this.library.off(null,null,this),e.prototype.dispose.apply(this,arguments)},ready:function(){this.refresh()},set:function(t,e,i){return i=i||{},_.isObject(t)?_.each(t,function(t,e){this.set(e,t,{silent:!0})},this):(e instanceof Backbone.View||(e.classes=["media-button-"+t].concat(e.classes||[]),e=new wp.media.view.Button(e).render()),e.controller=e.controller||this.controller,this._views[t]=e,this[e.options.priority<0?"secondary":"primary"].set(t,e,i)),i.silent||this.refresh(),this},get:function(t){return this._views[t]},unset:function(t,e){return delete this._views[t],this.primary.unset(t,e),this.secondary.unset(t,e),e&&e.silent||this.refresh(),this},refresh:function(){var t=this.controller.state(),s=t.get("library"),o=t.get("selection");_.each(this._views,function(t){var e,i;t.model&&t.options&&t.options.requires&&(e=t.options.requires,i=!1,o&&o.models&&(i=_.some(o.models,function(t){return!0===t.get("uploading")})),(e.selection&&o&&!o.length||e.library&&s&&!s.length)&&(i=!0),t.model.set("disabled",i))})}});t.exports=i},7128:function(t){var e=wp.media.view.Toolbar.Select,i=wp.media.view.l10n,s=e.extend({initialize:function(){_.defaults(this.options,{text:i.insertIntoPost,requires:!1}),e.prototype.initialize.apply(this,arguments)},refresh:function(){var t=this.controller.state().props.get("url");this.get("select").model.set("disabled",!t||"http://"===t),e.prototype.refresh.apply(this,arguments)}});t.exports=s},6850:function(t){var e=wp.media.view.Toolbar,i=wp.media.view.l10n,s=e.extend({initialize:function(){var t=this.options;_.bindAll(this,"clickSelect"),_.defaults(t,{event:"select",state:!1,reset:!0,close:!0,text:i.select,requires:{selection:!0}}),t.items=_.defaults(t.items||{},{select:{style:"primary",text:t.text,priority:80,click:this.clickSelect,requires:t.requires}}),e.prototype.initialize.apply(this,arguments)},clickSelect:function(){var t=this.options,e=this.controller;t.close&&e.close(),t.event&&e.state().trigger(t.event),t.state&&e.setState(t.state),t.reset&&e.reset()}});t.exports=s},841:function(t){var e=wp.media.View,i=wp.media.view.l10n,s=jQuery,o=e.extend({tagName:"div",className:"uploader-editor",template:wp.template("uploader-editor"),localDrag:!1,overContainer:!1,overDropzone:!1,draggingFile:null,initialize:function(){return this.initialized=!1,window.tinyMCEPreInit&&window.tinyMCEPreInit.dragDropUpload&&this.browserSupport()&&(this.$document=s(document),this.dropzones=[],this.files=[],this.$document.on("drop",".uploader-editor",_.bind(this.drop,this)),this.$document.on("dragover",".uploader-editor",_.bind(this.dropzoneDragover,this)),this.$document.on("dragleave",".uploader-editor",_.bind(this.dropzoneDragleave,this)),this.$document.on("click",".uploader-editor",_.bind(this.click,this)),this.$document.on("dragover",_.bind(this.containerDragover,this)),this.$document.on("dragleave",_.bind(this.containerDragleave,this)),this.$document.on("dragstart dragend drop",_.bind(function(t){this.localDrag="dragstart"===t.type,"drop"===t.type&&this.containerDragleave()},this)),this.initialized=!0),this},browserSupport:function(){var t=document.createElement("div");return("draggable"in t||"ondragstart"in t&&"ondrop"in t)&&!!(window.File&&window.FileList&&window.FileReader)},isDraggingFile:function(t){if(null===this.draggingFile){if(_.isUndefined(t.originalEvent)||_.isUndefined(t.originalEvent.dataTransfer))return!1;this.draggingFile=-1<_.indexOf(t.originalEvent.dataTransfer.types,"Files")&&-1===_.indexOf(t.originalEvent.dataTransfer.types,"text/plain")}return this.draggingFile},refresh:function(t){for(var e in this.dropzones)this.dropzones[e].toggle(this.overContainer||this.overDropzone);return _.isUndefined(t)||s(t.target).closest(".uploader-editor").toggleClass("droppable",this.overDropzone),this.overContainer||this.overDropzone||(this.draggingFile=null),this},render:function(){return this.initialized&&(e.prototype.render.apply(this,arguments),s(".wp-editor-wrap").each(_.bind(this.attach,this))),this},attach:function(t,e){var i=this.$el.clone();return this.dropzones.push(i),s(e).append(i),this},drop:function(t){if(this.containerDragleave(t),this.dropzoneDragleave(t),this.files=t.originalEvent.dataTransfer.files,!(this.files.length<1))return 0<(t=s(t.target).parents(".wp-editor-wrap")).length&&t[0].id&&(window.wpActiveEditor=t[0].id.slice(3,-5)),this.workflow?(this.workflow.state().reset(),this.addFiles.apply(this),this.workflow.open()):(this.workflow=wp.media.editor.open(window.wpActiveEditor,{frame:"post",state:"insert",title:i.addMedia,multiple:!0}),(t=this.workflow.uploader).uploader&&t.uploader.ready?this.addFiles.apply(this):this.workflow.on("uploader:ready",this.addFiles,this)),!1},addFiles:function(){return this.files.length&&(this.workflow.uploader.uploader.uploader.addFile(_.toArray(this.files)),this.files=[]),this},containerDragover:function(t){!this.localDrag&&this.isDraggingFile(t)&&(this.overContainer=!0,this.refresh())},containerDragleave:function(){this.overContainer=!1,_.delay(_.bind(this.refresh,this),50)},dropzoneDragover:function(t){if(!this.localDrag&&this.isDraggingFile(t))return this.overDropzone=!0,this.refresh(t),!1},dropzoneDragleave:function(t){this.overDropzone=!1,_.delay(_.bind(this.refresh,this,t),50)},click:function(t){this.containerDragleave(t),this.dropzoneDragleave(t),this.localDrag=!1}});t.exports=o},6353:function(t){var e=wp.media.View,i=e.extend({tagName:"div",className:"uploader-inline",template:wp.template("uploader-inline"),events:{"click .close":"hide"},initialize:function(){_.defaults(this.options,{message:"",status:!0,canClose:!1}),!this.options.$browser&&this.controller.uploader&&(this.options.$browser=this.controller.uploader.$browser),_.isUndefined(this.options.postId)&&(this.options.postId=wp.media.view.settings.post.id),this.options.status&&this.views.set(".upload-inline-status",new wp.media.view.UploaderStatus({controller:this.controller}))},prepare:function(){var t=this.controller.state().get("suggestedWidth"),e=this.controller.state().get("suggestedHeight"),i={};return i.message=this.options.message,i.canClose=this.options.canClose,t&&e&&(i.suggestedWidth=t,i.suggestedHeight=e),i},dispose:function(){return this.disposing?e.prototype.dispose.apply(this,arguments):(this.disposing=!0,this.remove())},remove:function(){var t=e.prototype.remove.apply(this,arguments);return _.defer(_.bind(this.refresh,this)),t},refresh:function(){var t=this.controller.uploader;t&&t.refresh()},ready:function(){var t,e=this.options.$browser;if(this.controller.uploader){if((t=this.$(".browser"))[0]===e[0])return;e.detach().text(t.text()),e[0].className=t[0].className,e[0].setAttribute("aria-labelledby",e[0].id+" "+t[0].getAttribute("aria-labelledby")),t.replaceWith(e.show())}return this.refresh(),this},show:function(){this.$el.removeClass("hidden"),this.controller.$uploaderToggler&&this.controller.$uploaderToggler.length&&this.controller.$uploaderToggler.attr("aria-expanded","true")},hide:function(){this.$el.addClass("hidden"),this.controller.$uploaderToggler&&this.controller.$uploaderToggler.length&&this.controller.$uploaderToggler.attr("aria-expanded","false").trigger("focus")}});t.exports=i},9411:function(t){var e=wp.media.View.extend({className:"upload-error",template:wp.template("uploader-status-error")});t.exports=e},2894:function(t){var e=wp.media.View,i=e.extend({className:"media-uploader-status",template:wp.template("uploader-status"),events:{"click .upload-dismiss-errors":"dismiss"},initialize:function(){this.queue=wp.Uploader.queue,this.queue.on("add remove reset",this.visibility,this),this.queue.on("add remove reset change:percent",this.progress,this),this.queue.on("add remove reset change:uploading",this.info,this),this.errors=wp.Uploader.errors,this.errors.reset(),this.errors.on("add remove reset",this.visibility,this),this.errors.on("add",this.error,this)},dispose:function(){return wp.Uploader.queue.off(null,null,this),e.prototype.dispose.apply(this,arguments),this},visibility:function(){this.$el.toggleClass("uploading",!!this.queue.length),this.$el.toggleClass("errors",!!this.errors.length),this.$el.toggle(!!this.queue.length||!!this.errors.length)},ready:function(){_.each({$bar:".media-progress-bar div",$index:".upload-index",$total:".upload-total",$filename:".upload-filename"},function(t,e){this[e]=this.$(t)},this),this.visibility(),this.progress(),this.info()},progress:function(){var t=this.queue,e=this.$bar;e&&t.length&&e.width(t.reduce(function(t,e){return e.get("uploading")?(e=e.get("percent"),t+(_.isNumber(e)?e:100)):t+100},0)/t.length+"%")},info:function(){var t,e=this.queue,i=0;e.length&&(t=this.queue.find(function(t,e){return i=e,t.get("uploading")}),this.$index&&this.$total&&this.$filename&&(this.$index.text(i+1),this.$total.text(e.length),this.$filename.html(t?this.filename(t.get("filename")):"")))},filename:function(t){return _.escape(t)},error:function(t){var e=new wp.media.view.UploaderStatusError({filename:this.filename(t.get("file").name),message:t.get("message")}),i=this.$el.find("button");this.views.add(".upload-errors",e,{at:0}),_.delay(function(){i.trigger("focus"),wp.a11y.speak(t.get("message"),"assertive")},1e3)},dismiss:function(){var t=this.views.get(".upload-errors");t&&_.invoke(t,"remove"),wp.Uploader.errors.reset(),this.controller.modal&&this.controller.modal.focusManager.focus()}});t.exports=i},5823:function(t){var e=jQuery,i=wp.media.View.extend({tagName:"div",className:"uploader-window",template:wp.template("uploader-window"),initialize:function(){var t;this.$browser=e('<button type="button" class="browser" />').hide().appendTo("body"),!(t=this.options.uploader=_.defaults(this.options.uploader||{},{dropzone:this.$el,browser:this.$browser,params:{}})).dropzone||t.dropzone instanceof e||(t.dropzone=e(t.dropzone)),this.controller.on("activate",this.refresh,this),this.controller.on("detach",function(){this.$browser.remove()},this)},refresh:function(){this.uploader&&this.uploader.refresh()},ready:function(){var t=wp.media.view.settings.post.id;this.uploader||(t&&(this.options.uploader.params.post_id=t),this.uploader=new wp.Uploader(this.options.uploader),(t=this.uploader.dropzone).on("dropzone:enter",_.bind(this.show,this)),t.on("dropzone:leave",_.bind(this.hide,this)),e(this.uploader).on("uploader:ready",_.bind(this._ready,this)))},_ready:function(){this.controller.trigger("uploader:ready")},show:function(){var t=this.$el.show();_.defer(function(){t.css({opacity:1})})},hide:function(){var t=this.$el.css({opacity:0});wp.media.transition(t).done(function(){"0"===t.css("opacity")&&t.hide()}),_.delay(function(){"0"===t.css("opacity")&&t.is(":visible")&&t.hide()},500)}});t.exports=i},487:function(t){var e=wp.Backbone.View.extend({constructor:function(t){t&&t.controller&&(this.controller=t.controller),wp.Backbone.View.apply(this,arguments)},dispose:function(){return this.undelegateEvents(),this.model&&this.model.off&&this.model.off(null,null,this),this.collection&&this.collection.off&&this.collection.off(null,null,this),this.controller&&this.controller.off&&this.controller.off(null,null,this),this},remove:function(){return this.dispose(),wp.Backbone.View.prototype.remove.apply(this,arguments)}});t.exports=e}},s={};function o(t){var e=s[t];return void 0!==e||(e=s[t]={exports:{}},i[t](e,e.exports,o)),e.exports}var e,t,n,a,r;a=wp.media,r=jQuery,a.isTouchDevice="ontouchend"in document,t=a.view.l10n=window._wpMediaViewsL10n||{},a.view.settings=t.settings||{},delete t.settings,a.model.settings.post=a.view.settings.post,r.support.transition=(e=document.documentElement.style,t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},(n=_.find(_.keys(t),function(t){return!_.isUndefined(e[t])}))&&{end:t[n]}),a.events=_.extend({},Backbone.Events),a.transition=function(t,e){var i=r.Deferred();return e=e||2e3,r.support.transition?((t=t instanceof r?t:r(t)).first().one(r.support.transition.end,i.resolve),_.delay(i.resolve,e)):i.resolve(),i.promise()},a.controller.Region=o(4903),a.controller.StateMachine=o(5466),a.controller.State=o(5826),a.selectionSync=o(3526),a.controller.Library=o(9024),a.controller.ImageDetails=o(3849),a.controller.GalleryEdit=o(6328),a.controller.GalleryAdd=o(7323),a.controller.CollectionEdit=o(1817),a.controller.CollectionAdd=o(1517),a.controller.FeaturedImage=o(5095),a.controller.ReplaceImage=o(8493),a.controller.EditImage=o(7658),a.controller.MediaLibrary=o(3742),a.controller.Embed=o(9067),a.controller.Cropper=o(2288),a.controller.CustomizeImageCropper=o(6934),a.controller.SiteIconCropper=o(5274),a.View=o(487),a.view.Frame=o(3647),a.view.MediaFrame=o(4861),a.view.MediaFrame.Select=o(8719),a.view.MediaFrame.Post=o(9075),a.view.MediaFrame.ImageDetails=o(9142),a.view.Modal=o(3939),a.view.FocusManager=o(6557),a.view.UploaderWindow=o(5823),a.view.EditorUploader=o(841),a.view.UploaderInline=o(6353),a.view.UploaderStatus=o(2894),a.view.UploaderStatusError=o(9411),a.view.Toolbar=o(9510),a.view.Toolbar.Select=o(6850),a.view.Toolbar.Embed=o(7128),a.view.Button=o(3157),a.view.ButtonGroup=o(4094),a.view.PriorityList=o(1993),a.view.MenuItem=o(917),a.view.Menu=o(2596),a.view.RouterItem=o(9484),a.view.Router=o(1562),a.view.Sidebar=o(9799),a.view.Attachment=o(5019),a.view.Attachment.Library=o(9254),a.view.Attachment.EditLibrary=o(4640),a.view.Attachments=o(8408),a.view.Search=o(4556),a.view.AttachmentFilters=o(4906),a.view.DateFilter=o(9663),a.view.AttachmentFilters.Uploaded=o(7040),a.view.AttachmentFilters.All=o(2868),a.view.AttachmentsBrowser=o(9239),a.view.Selection=o(6191),a.view.Attachment.Selection=o(9003),a.view.Attachments.Selection=o(1223),a.view.Attachment.EditSelection=o(1009),a.view.Settings=o(859),a.view.Settings.AttachmentDisplay=o(2176),a.view.Settings.Gallery=o(6872),a.view.Settings.Playlist=o(8488),a.view.Attachment.Details=o(7274),a.view.AttachmentCompat=o(8093),a.view.Iframe=o(6217),a.view.Embed=o(5138),a.view.Label=o(6644),a.view.EmbedUrl=o(4848),a.view.EmbedLink=o(6959),a.view.EmbedImage=o(1338),a.view.ImageDetails=o(7598),a.view.Cropper=o(7137),a.view.SiteIconCropper=o(5187),a.view.SiteIconPreview=o(8260),a.view.EditImage=o(5970),a.view.Spinner=o(2234),a.view.Heading=o(7990)}();