var _iterator = _createForOfIteratorHelper(valuePairs),
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var _step$value = Object(slicedToArray["a" /* default */])(_step.value, 2),
memberValue = _step$value[1];
stack.unshift(["".concat(key, "[").concat(member, "]"), memberValue]);
} else if (value !== undefined) {
// Null is treated as special case, equivalent to empty string.
string += '&' + [key, value].map(encodeURIComponent).join('=');
} // Loop will concatenate with leading `&`, but it's only expected for all
// but the first query parameter. This strips the leading `&`, while still
// accounting for the case that the string may in-fact be empty.
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-query-string.js
* Checks for invalid characters within the provided query string.
* @param {string} queryString The query string.
* const isValid = isValidQueryString( 'query=true&another=false' ); // true
* const isNotValid = isValidQueryString( 'query=true?another=false' ); // false
* @return {boolean} True if the argument contains a valid query string.
function isValidQueryString(queryString) {
return /^[^\s#?\/]+$/.test(queryString);
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-path-and-query-string.js
* Returns the path part and query string part of the URL.
* @param {string} url The full URL.
* const pathAndQueryString1 = getPathAndQueryString( 'http://localhost:8080/this/is/a/test?query=true' ); // '/this/is/a/test?query=true'
* const pathAndQueryString2 = getPathAndQueryString( 'https://wordpress.org/help/faq/' ); // '/help/faq'
* @return {string} The path part and query string part of the URL.
function getPathAndQueryString(url) {
var queryString = getQueryString(url);
if (queryString) value += "?".concat(queryString);
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-fragment.js
* Returns the fragment part of the URL.
* @param {string} url The full URL
* const fragment1 = getFragment( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // '#fragment'
* const fragment2 = getFragment( 'https://wordpress.org#another-fragment?query=true' ); // '#another-fragment'
* @return {string|void} The fragment part of the URL.
function getFragment(url) {
var matches = /^\S+?(#[^\s\?]*)/.exec(url);
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-fragment.js
* Checks for invalid characters within the provided fragment.
* @param {string} fragment The url fragment.
* const isValid = isValidFragment( '#valid-fragment' ); // true
* const isNotValid = isValidFragment( '#invalid-#fragment' ); // false
* @return {boolean} True if the argument contains a valid fragment.
function isValidFragment(fragment) {
return /^#[^\s#?\/]*$/.test(fragment);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = __webpack_require__("rePB");
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-args.js
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/** @typedef {import('./get-query-arg').QueryArgParsed} QueryArgParsed */
* @typedef {Record<string,QueryArgParsed>} QueryArgs
* Sets a value in object deeply by a given array of path segments. Mutates the
* @param {Record<string,*>} object Object in which to assign.
* @param {string[]} path Path segment at which to set value.
* @param {*} value Value to set.
function setPath(object, path, value) {
var length = path.length;
var lastIndex = length - 1;
for (var i = 0; i < length; i++) {
if (!key && Array.isArray(object)) {
// If key is empty string and next value is array, derive key from
// the current length of the array.
key = object.length.toString();
key = ['__proto__', 'constructor', 'prototype'].includes(key) ? key.toUpperCase() : key; // If the next key in the path is numeric (or empty string), it will be
// created as an array. Otherwise, it will be created as an object.
var isNextKeyArrayIndex = !isNaN(Number(path[i + 1]));
object[key] = i === lastIndex ? // If at end of path, assign the intended value.
value : // Otherwise, advance to the next object in the path, creating
// it if it does not yet exist.
object[key] || (isNextKeyArrayIndex ? [] : {});
if (Array.isArray(object[key]) && !isNextKeyArrayIndex) {
// If we current key is non-numeric, but the next value is an
// array, coerce the value to an object.
object[key] = _objectSpread({}, object[key]);
} // Update working reference object to the next in the path.
* Returns an object of query arguments of the given URL. If the given URL is
* invalid or has no querystring, an empty object is returned.
* @param {string} url URL.
* const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' );
* // { "foo": "bar", "bar": "baz" }
* @return {QueryArgs} Query args object.
function getQueryArgs(url) {
return (getQueryString(url) || ''). // Normalize space encoding, accounting for PHP URL encoding
// corresponding to `application/x-www-form-urlencoded`.
// See: https://tools.ietf.org/html/rfc1866#section-8.2.1
replace(/\+/g, '%20').split('&').reduce(function (accumulator, keyValue) {
var _keyValue$split$filte = keyValue.split('=') // Filtering avoids decoding as `undefined` for value, where
// default is restored in destructuring assignment.
.filter(Boolean).map(decodeURIComponent),
_keyValue$split$filte2 = Object(slicedToArray["a" /* default */])(_keyValue$split$filte, 2),
key = _keyValue$split$filte2[0],
_keyValue$split$filte3 = _keyValue$split$filte2[1],
value = _keyValue$split$filte3 === void 0 ? '' : _keyValue$split$filte3;
var segments = key.replace(/\]/g, '').split('[');
setPath(accumulator, segments, value);
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/add-query-args.js
* Appends arguments as querystring to the provided URL. If the URL already
* includes query arguments, the arguments are merged with (and take precedent
* over) the existing set.
* @param {string} [url=''] URL to which arguments should be appended. If omitted,
* only the resulting querystring is returned.
* @param {Object} [args] Query arguments to apply to URL.
* const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://google.com/?q=test
* @return {string} URL with arguments applied.
function addQueryArgs() {
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var args = arguments.length > 1 ? arguments[1] : undefined;
// If no arguments are to be appended, return original URL.
if (!args || !Object.keys(args).length) {
var baseUrl = url; // Determine whether URL already had query arguments.
var queryStringIndex = url.indexOf('?');
if (queryStringIndex !== -1) {
// Merge into existing query arguments.
args = Object.assign(getQueryArgs(url), args); // Change working base URL to omit previous query arguments.
baseUrl = baseUrl.substr(0, queryStringIndex);
return baseUrl + '?' + buildQueryString(args);
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-arg.js
/* eslint-disable jsdoc/valid-types */
* @typedef {{[key: string]: QueryArgParsed}} QueryArgObject
* @typedef {string|string[]|QueryArgObject} QueryArgParsed
* Returns a single query argument of the url
* @param {string} url URL.
* @param {string} arg Query arg name.
* const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar
* @return {QueryArgParsed|void} Query arg value.
function getQueryArg(url, arg) {
return getQueryArgs(url)[arg];
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/has-query-arg.js
* Determines whether the URL contains a given query arg.
* @param {string} url URL.
* @param {string} arg Query arg name.
* const hasBar = hasQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'bar' ); // true
* @return {boolean} Whether or not the URL contains the query arg.
function hasQueryArg(url, arg) {
return getQueryArg(url, arg) !== undefined;
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/remove-query-args.js
* Removes arguments from the query string of the url
* @param {string} url URL.
* @param {...string} args Query Args.
* const newUrl = removeQueryArgs( 'https://wordpress.org?foo=bar&bar=baz&baz=foobar', 'foo', 'bar' ); // https://wordpress.org?baz=foobar
* @return {string} Updated URL.
function removeQueryArgs(url) {
var queryStringIndex = url.indexOf('?');
if (queryStringIndex === -1) {
var query = getQueryArgs(url);
var baseURL = url.substr(0, queryStringIndex);
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
args.forEach(function (arg) {
return delete query[arg];
var queryString = buildQueryString(query);
return queryString ? baseURL + '?' + queryString : baseURL;
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/prepend-http.js
var USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i;
* Prepends "http://" to a url, if it looks like something that is meant to be a TLD.
* @param {string} url The URL to test.
* const actualURL = prependHTTP( 'wordpress.org' ); // http://wordpress.org
* @return {string} The updated URL.
function prependHTTP(url) {
if (!USABLE_HREF_REGEXP.test(url) && !isEmail(url)) {
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/safe-decode-uri.js
* Safely decodes a URI with `decodeURI`. Returns the URI unmodified if
* `decodeURI` throws an error.
* @param {string} uri URI to decode.
* const badUri = safeDecodeURI( '%z' ); // does not throw an Error, simply returns '%z'
* @return {string} Decoded URI if possible.
function safeDecodeURI(uri) {
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/safe-decode-uri-component.js
* Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if
* `decodeURIComponent` throws an error.
* @param {string} uriComponent URI component to decode.
* @return {string} Decoded URI component if possible.
function safeDecodeURIComponent(uriComponent) {
return decodeURIComponent(uriComponent);
} catch (uriComponentError) {
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/filter-url-for-display.js
* Returns a URL for display.
* @param {string} url Original URL.
* @param {number|null} maxLength URL length.
* const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg
* const imageUrl = filterURLForDisplay( 'https://www.wordpress.org/wp-content/uploads/img.png', 20 ); // …ent/uploads/img.png
* @return {string} Displayed URL.
function filterURLForDisplay(url) {
var maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
// Remove protocol and www prefixes.
var filteredURL = url.replace(/^(?:https?:)\/\/(?:www\.)?/, ''); // Ends with / and only has that single slash, strip it.
if (filteredURL.match(/^[^\/]+\/$/)) {
filteredURL = filteredURL.replace('/', '');
var mediaRegexp = /([\w|:])*\.(?:jpg|jpeg|gif|png|svg)/;
if (!maxLength || filteredURL.length <= maxLength || !filteredURL.match(mediaRegexp)) {
} // If the file is not greater than max length, return last portion of URL.
filteredURL = filteredURL.split('?')[0];
var urlPieces = filteredURL.split('/');
var file = urlPieces[urlPieces.length - 1];
if (file.length <= maxLength) {
return '…' + filteredURL.slice(-maxLength);
} // If the file is greater than max length, truncate the file.
var index = file.lastIndexOf('.');
var _ref = [file.slice(0, index), file.slice(index + 1)],
var truncatedFile = fileName.slice(-3) + '.' + extension;
return file.slice(0, maxLength - truncatedFile.length - 1) + '…' + truncatedFile;
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__("YLtl");
// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/clean-for-slug.js