wp/wp-includes/js/dist/url.js
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
     1 this["wp"] = this["wp"] || {}; this["wp"]["url"] =
     1 /******/ (function() { // webpackBootstrap
     2 /******/ (function(modules) { // webpackBootstrap
     2 /******/ 	"use strict";
     3 /******/ 	// The module cache
     3 /******/ 	// The require scope
     4 /******/ 	var installedModules = {};
     4 /******/ 	var __webpack_require__ = {};
     5 /******/
     5 /******/ 	
     6 /******/ 	// The require function
     6 /************************************************************************/
     7 /******/ 	function __webpack_require__(moduleId) {
     7 /******/ 	/* webpack/runtime/define property getters */
     8 /******/
     8 /******/ 	!function() {
     9 /******/ 		// Check if module is in cache
     9 /******/ 		// define getter functions for harmony exports
    10 /******/ 		if(installedModules[moduleId]) {
    10 /******/ 		__webpack_require__.d = function(exports, definition) {
    11 /******/ 			return installedModules[moduleId].exports;
    11 /******/ 			for(var key in definition) {
    12 /******/ 		}
    12 /******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
    13 /******/ 		// Create a new module (and put it into the cache)
    13 /******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
    14 /******/ 		var module = installedModules[moduleId] = {
    14 /******/ 				}
    15 /******/ 			i: moduleId,
    15 /******/ 			}
    16 /******/ 			l: false,
       
    17 /******/ 			exports: {}
       
    18 /******/ 		};
    16 /******/ 		};
    19 /******/
    17 /******/ 	}();
    20 /******/ 		// Execute the module function
    18 /******/ 	
    21 /******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
    19 /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
    22 /******/
    20 /******/ 	!function() {
    23 /******/ 		// Flag the module as loaded
    21 /******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
    24 /******/ 		module.l = true;
    22 /******/ 	}();
    25 /******/
    23 /******/ 	
    26 /******/ 		// Return the exports of the module
    24 /******/ 	/* webpack/runtime/make namespace object */
    27 /******/ 		return module.exports;
    25 /******/ 	!function() {
    28 /******/ 	}
    26 /******/ 		// define __esModule on exports
    29 /******/
    27 /******/ 		__webpack_require__.r = function(exports) {
    30 /******/
    28 /******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
    31 /******/ 	// expose the modules object (__webpack_modules__)
    29 /******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
    32 /******/ 	__webpack_require__.m = modules;
    30 /******/ 			}
    33 /******/
    31 /******/ 			Object.defineProperty(exports, '__esModule', { value: true });
    34 /******/ 	// expose the module cache
    32 /******/ 		};
    35 /******/ 	__webpack_require__.c = installedModules;
    33 /******/ 	}();
    36 /******/
    34 /******/ 	
    37 /******/ 	// define getter function for harmony exports
       
    38 /******/ 	__webpack_require__.d = function(exports, name, getter) {
       
    39 /******/ 		if(!__webpack_require__.o(exports, name)) {
       
    40 /******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
       
    41 /******/ 		}
       
    42 /******/ 	};
       
    43 /******/
       
    44 /******/ 	// define __esModule on exports
       
    45 /******/ 	__webpack_require__.r = function(exports) {
       
    46 /******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
       
    47 /******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
       
    48 /******/ 		}
       
    49 /******/ 		Object.defineProperty(exports, '__esModule', { value: true });
       
    50 /******/ 	};
       
    51 /******/
       
    52 /******/ 	// create a fake namespace object
       
    53 /******/ 	// mode & 1: value is a module id, require it
       
    54 /******/ 	// mode & 2: merge all properties of value into the ns
       
    55 /******/ 	// mode & 4: return value when already ns object
       
    56 /******/ 	// mode & 8|1: behave like require
       
    57 /******/ 	__webpack_require__.t = function(value, mode) {
       
    58 /******/ 		if(mode & 1) value = __webpack_require__(value);
       
    59 /******/ 		if(mode & 8) return value;
       
    60 /******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
       
    61 /******/ 		var ns = Object.create(null);
       
    62 /******/ 		__webpack_require__.r(ns);
       
    63 /******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
       
    64 /******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
       
    65 /******/ 		return ns;
       
    66 /******/ 	};
       
    67 /******/
       
    68 /******/ 	// getDefaultExport function for compatibility with non-harmony modules
       
    69 /******/ 	__webpack_require__.n = function(module) {
       
    70 /******/ 		var getter = module && module.__esModule ?
       
    71 /******/ 			function getDefault() { return module['default']; } :
       
    72 /******/ 			function getModuleExports() { return module; };
       
    73 /******/ 		__webpack_require__.d(getter, 'a', getter);
       
    74 /******/ 		return getter;
       
    75 /******/ 	};
       
    76 /******/
       
    77 /******/ 	// Object.prototype.hasOwnProperty.call
       
    78 /******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
       
    79 /******/
       
    80 /******/ 	// __webpack_public_path__
       
    81 /******/ 	__webpack_require__.p = "";
       
    82 /******/
       
    83 /******/
       
    84 /******/ 	// Load entry module and return exports
       
    85 /******/ 	return __webpack_require__(__webpack_require__.s = "lbya");
       
    86 /******/ })
       
    87 /************************************************************************/
    35 /************************************************************************/
    88 /******/ ({
    36 var __webpack_exports__ = {};
    89 
       
    90 /***/ "YLtl":
       
    91 /***/ (function(module, exports) {
       
    92 
       
    93 (function() { module.exports = window["lodash"]; }());
       
    94 
       
    95 /***/ }),
       
    96 
       
    97 /***/ "lbya":
       
    98 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
    99 
       
   100 "use strict";
       
   101 // ESM COMPAT FLAG
    37 // ESM COMPAT FLAG
   102 __webpack_require__.r(__webpack_exports__);
    38 __webpack_require__.r(__webpack_exports__);
   103 
    39 
   104 // EXPORTS
    40 // EXPORTS
   105 __webpack_require__.d(__webpack_exports__, "isURL", function() { return /* reexport */ isURL; });
    41 __webpack_require__.d(__webpack_exports__, {
   106 __webpack_require__.d(__webpack_exports__, "isEmail", function() { return /* reexport */ isEmail; });
    42   "addQueryArgs": function() { return /* reexport */ addQueryArgs; },
   107 __webpack_require__.d(__webpack_exports__, "getProtocol", function() { return /* reexport */ getProtocol; });
    43   "buildQueryString": function() { return /* reexport */ buildQueryString; },
   108 __webpack_require__.d(__webpack_exports__, "isValidProtocol", function() { return /* reexport */ isValidProtocol; });
    44   "cleanForSlug": function() { return /* reexport */ cleanForSlug; },
   109 __webpack_require__.d(__webpack_exports__, "getAuthority", function() { return /* reexport */ getAuthority; });
    45   "filterURLForDisplay": function() { return /* reexport */ filterURLForDisplay; },
   110 __webpack_require__.d(__webpack_exports__, "isValidAuthority", function() { return /* reexport */ isValidAuthority; });
    46   "getAuthority": function() { return /* reexport */ getAuthority; },
   111 __webpack_require__.d(__webpack_exports__, "getPath", function() { return /* reexport */ getPath; });
    47   "getFilename": function() { return /* reexport */ getFilename; },
   112 __webpack_require__.d(__webpack_exports__, "isValidPath", function() { return /* reexport */ isValidPath; });
    48   "getFragment": function() { return /* reexport */ getFragment; },
   113 __webpack_require__.d(__webpack_exports__, "getQueryString", function() { return /* reexport */ getQueryString; });
    49   "getPath": function() { return /* reexport */ getPath; },
   114 __webpack_require__.d(__webpack_exports__, "buildQueryString", function() { return /* reexport */ buildQueryString; });
    50   "getPathAndQueryString": function() { return /* reexport */ getPathAndQueryString; },
   115 __webpack_require__.d(__webpack_exports__, "isValidQueryString", function() { return /* reexport */ isValidQueryString; });
    51   "getProtocol": function() { return /* reexport */ getProtocol; },
   116 __webpack_require__.d(__webpack_exports__, "getPathAndQueryString", function() { return /* reexport */ getPathAndQueryString; });
    52   "getQueryArg": function() { return /* reexport */ getQueryArg; },
   117 __webpack_require__.d(__webpack_exports__, "getFragment", function() { return /* reexport */ getFragment; });
    53   "getQueryArgs": function() { return /* reexport */ getQueryArgs; },
   118 __webpack_require__.d(__webpack_exports__, "isValidFragment", function() { return /* reexport */ isValidFragment; });
    54   "getQueryString": function() { return /* reexport */ getQueryString; },
   119 __webpack_require__.d(__webpack_exports__, "addQueryArgs", function() { return /* reexport */ addQueryArgs; });
    55   "hasQueryArg": function() { return /* reexport */ hasQueryArg; },
   120 __webpack_require__.d(__webpack_exports__, "getQueryArg", function() { return /* reexport */ getQueryArg; });
    56   "isEmail": function() { return /* reexport */ isEmail; },
   121 __webpack_require__.d(__webpack_exports__, "getQueryArgs", function() { return /* reexport */ getQueryArgs; });
    57   "isURL": function() { return /* reexport */ isURL; },
   122 __webpack_require__.d(__webpack_exports__, "hasQueryArg", function() { return /* reexport */ hasQueryArg; });
    58   "isValidAuthority": function() { return /* reexport */ isValidAuthority; },
   123 __webpack_require__.d(__webpack_exports__, "removeQueryArgs", function() { return /* reexport */ removeQueryArgs; });
    59   "isValidFragment": function() { return /* reexport */ isValidFragment; },
   124 __webpack_require__.d(__webpack_exports__, "prependHTTP", function() { return /* reexport */ prependHTTP; });
    60   "isValidPath": function() { return /* reexport */ isValidPath; },
   125 __webpack_require__.d(__webpack_exports__, "safeDecodeURI", function() { return /* reexport */ safeDecodeURI; });
    61   "isValidProtocol": function() { return /* reexport */ isValidProtocol; },
   126 __webpack_require__.d(__webpack_exports__, "safeDecodeURIComponent", function() { return /* reexport */ safeDecodeURIComponent; });
    62   "isValidQueryString": function() { return /* reexport */ isValidQueryString; },
   127 __webpack_require__.d(__webpack_exports__, "filterURLForDisplay", function() { return /* reexport */ filterURLForDisplay; });
    63   "normalizePath": function() { return /* reexport */ normalizePath; },
   128 __webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return /* reexport */ cleanForSlug; });
    64   "prependHTTP": function() { return /* reexport */ prependHTTP; },
   129 
    65   "removeQueryArgs": function() { return /* reexport */ removeQueryArgs; },
   130 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-url.js
    66   "safeDecodeURI": function() { return /* reexport */ safeDecodeURI; },
       
    67   "safeDecodeURIComponent": function() { return /* reexport */ safeDecodeURIComponent; }
       
    68 });
       
    69 
       
    70 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-url.js
   131 /**
    71 /**
   132  * Determines whether the given string looks like a URL.
    72  * Determines whether the given string looks like a URL.
   133  *
    73  *
   134  * @param {string} url The string to scrutinise.
    74  * @param {string} url The string to scrutinise.
   135  *
    75  *
   152   } catch {
    92   } catch {
   153     return false;
    93     return false;
   154   }
    94   }
   155 }
    95 }
   156 
    96 
   157 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-email.js
    97 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-email.js
   158 const EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i;
    98 const EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i;
   159 /**
    99 /**
   160  * Determines whether the given string looks like an email.
   100  * Determines whether the given string looks like an email.
   161  *
   101  *
   162  * @param {string} email The string to scrutinise.
   102  * @param {string} email The string to scrutinise.
   171 
   111 
   172 function isEmail(email) {
   112 function isEmail(email) {
   173   return EMAIL_REGEXP.test(email);
   113   return EMAIL_REGEXP.test(email);
   174 }
   114 }
   175 
   115 
   176 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-protocol.js
   116 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-protocol.js
   177 /**
   117 /**
   178  * Returns the protocol part of the URL.
   118  * Returns the protocol part of the URL.
   179  *
   119  *
   180  * @param {string} url The full URL.
   120  * @param {string} url The full URL.
   181  *
   121  *
   193   if (matches) {
   133   if (matches) {
   194     return matches[1];
   134     return matches[1];
   195   }
   135   }
   196 }
   136 }
   197 
   137 
   198 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-protocol.js
   138 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-protocol.js
   199 /**
   139 /**
   200  * Tests if a url protocol is valid.
   140  * Tests if a url protocol is valid.
   201  *
   141  *
   202  * @param {string} protocol The url protocol.
   142  * @param {string} protocol The url protocol.
   203  *
   143  *
   215   }
   155   }
   216 
   156 
   217   return /^[a-z\-.\+]+[0-9]*:$/i.test(protocol);
   157   return /^[a-z\-.\+]+[0-9]*:$/i.test(protocol);
   218 }
   158 }
   219 
   159 
   220 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-authority.js
   160 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-authority.js
   221 /**
   161 /**
   222  * Returns the authority part of the URL.
   162  * Returns the authority part of the URL.
   223  *
   163  *
   224  * @param {string} url The full URL.
   164  * @param {string} url The full URL.
   225  *
   165  *
   237   if (matches) {
   177   if (matches) {
   238     return matches[1];
   178     return matches[1];
   239   }
   179   }
   240 }
   180 }
   241 
   181 
   242 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-authority.js
   182 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-authority.js
   243 /**
   183 /**
   244  * Checks for invalid characters within the provided authority.
   184  * Checks for invalid characters within the provided authority.
   245  *
   185  *
   246  * @param {string} authority A string containing the URL authority.
   186  * @param {string} authority A string containing the URL authority.
   247  *
   187  *
   259   }
   199   }
   260 
   200 
   261   return /^[^\s#?]+$/.test(authority);
   201   return /^[^\s#?]+$/.test(authority);
   262 }
   202 }
   263 
   203 
   264 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-path.js
   204 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-path.js
   265 /**
   205 /**
   266  * Returns the path part of the URL.
   206  * Returns the path part of the URL.
   267  *
   207  *
   268  * @param {string} url The full URL.
   208  * @param {string} url The full URL.
   269  *
   209  *
   281   if (matches) {
   221   if (matches) {
   282     return matches[1];
   222     return matches[1];
   283   }
   223   }
   284 }
   224 }
   285 
   225 
   286 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-path.js
   226 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-path.js
   287 /**
   227 /**
   288  * Checks for invalid characters within the provided path.
   228  * Checks for invalid characters within the provided path.
   289  *
   229  *
   290  * @param {string} path The URL path.
   230  * @param {string} path The URL path.
   291  *
   231  *
   303   }
   243   }
   304 
   244 
   305   return /^[^\s#?]+$/.test(path);
   245   return /^[^\s#?]+$/.test(path);
   306 }
   246 }
   307 
   247 
   308 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-string.js
   248 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-string.js
   309 /**
   249 /**
   310  * Returns the query string part of the URL.
   250  * Returns the query string part of the URL.
   311  *
   251  *
   312  * @param {string} url The full URL.
   252  * @param {string} url The full URL.
   313  *
   253  *
   328   if (query) {
   268   if (query) {
   329     return query;
   269     return query;
   330   }
   270   }
   331 }
   271 }
   332 
   272 
   333 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/build-query-string.js
   273 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/build-query-string.js
   334 /**
   274 /**
   335  * Generates URL-encoded query string using input query data.
   275  * Generates URL-encoded query string using input query data.
   336  *
   276  *
   337  * It is intended to behave equivalent as PHP's `http_build_query`, configured
   277  * It is intended to behave equivalent as PHP's `http_build_query`, configured
   338  * with encoding type PHP_QUERY_RFC3986 (spaces as `%20`).
   278  * with encoding type PHP_QUERY_RFC3986 (spaces as `%20`).
   388 
   328 
   389 
   329 
   390   return string.substr(1);
   330   return string.substr(1);
   391 }
   331 }
   392 
   332 
   393 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-query-string.js
   333 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-query-string.js
   394 /**
   334 /**
   395  * Checks for invalid characters within the provided query string.
   335  * Checks for invalid characters within the provided query string.
   396  *
   336  *
   397  * @param {string} queryString The query string.
   337  * @param {string} queryString The query string.
   398  *
   338  *
   410   }
   350   }
   411 
   351 
   412   return /^[^\s#?\/]+$/.test(queryString);
   352   return /^[^\s#?\/]+$/.test(queryString);
   413 }
   353 }
   414 
   354 
   415 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-path-and-query-string.js
   355 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-path-and-query-string.js
   416 /**
   356 /**
   417  * Internal dependencies
   357  * Internal dependencies
   418  */
   358  */
   419 
   359 
   420 /**
   360 /**
   438   if (path) value += path;
   378   if (path) value += path;
   439   if (queryString) value += `?${queryString}`;
   379   if (queryString) value += `?${queryString}`;
   440   return value;
   380   return value;
   441 }
   381 }
   442 
   382 
   443 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-fragment.js
   383 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-fragment.js
   444 /**
   384 /**
   445  * Returns the fragment part of the URL.
   385  * Returns the fragment part of the URL.
   446  *
   386  *
   447  * @param {string} url The full URL
   387  * @param {string} url The full URL
   448  *
   388  *
   460   if (matches) {
   400   if (matches) {
   461     return matches[1];
   401     return matches[1];
   462   }
   402   }
   463 }
   403 }
   464 
   404 
   465 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-fragment.js
   405 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-fragment.js
   466 /**
   406 /**
   467  * Checks for invalid characters within the provided fragment.
   407  * Checks for invalid characters within the provided fragment.
   468  *
   408  *
   469  * @param {string} fragment The url fragment.
   409  * @param {string} fragment The url fragment.
   470  *
   410  *
   482   }
   422   }
   483 
   423 
   484   return /^#[^\s#?\/]*$/.test(fragment);
   424   return /^#[^\s#?\/]*$/.test(fragment);
   485 }
   425 }
   486 
   426 
   487 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-args.js
   427 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-args.js
   488 /**
   428 /**
   489  * Internal dependencies
   429  * Internal dependencies
   490  */
   430  */
   491 
   431 
   492 /** @typedef {import('./get-query-arg').QueryArgParsed} QueryArgParsed */
   432 /** @typedef {import('./get-query-arg').QueryArgParsed} QueryArgParsed */
   513 
   453 
   514     if (!key && Array.isArray(object)) {
   454     if (!key && Array.isArray(object)) {
   515       // If key is empty string and next value is array, derive key from
   455       // If key is empty string and next value is array, derive key from
   516       // the current length of the array.
   456       // the current length of the array.
   517       key = object.length.toString();
   457       key = object.length.toString();
   518     } // If the next key in the path is numeric (or empty string), it will be
   458     }
       
   459 
       
   460     key = ['__proto__', 'constructor', 'prototype'].includes(key) ? key.toUpperCase() : key; // If the next key in the path is numeric (or empty string), it will be
   519     // created as an array. Otherwise, it will be created as an object.
   461     // created as an array. Otherwise, it will be created as an object.
   520 
       
   521 
   462 
   522     const isNextKeyArrayIndex = !isNaN(Number(path[i + 1]));
   463     const isNextKeyArrayIndex = !isNaN(Number(path[i + 1]));
   523     object[key] = i === lastIndex ? // If at end of path, assign the intended value.
   464     object[key] = i === lastIndex ? // If at end of path, assign the intended value.
   524     value : // Otherwise, advance to the next object in the path, creating
   465     value : // Otherwise, advance to the next object in the path, creating
   525     // it if it does not yet exist.
   466     // it if it does not yet exist.
   551  * @return {QueryArgs} Query args object.
   492  * @return {QueryArgs} Query args object.
   552  */
   493  */
   553 
   494 
   554 
   495 
   555 function getQueryArgs(url) {
   496 function getQueryArgs(url) {
   556   return (getQueryString(url) || ''). // Normalize space encoding, accounting for PHP URL encoding
   497   return (getQueryString(url) || '' // Normalize space encoding, accounting for PHP URL encoding
   557   // corresponding to `application/x-www-form-urlencoded`.
   498   // corresponding to `application/x-www-form-urlencoded`.
   558   //
   499   //
   559   // See: https://tools.ietf.org/html/rfc1866#section-8.2.1
   500   // See: https://tools.ietf.org/html/rfc1866#section-8.2.1
   560   replace(/\+/g, '%20').split('&').reduce((accumulator, keyValue) => {
   501   ).replace(/\+/g, '%20').split('&').reduce((accumulator, keyValue) => {
   561     const [key, value = ''] = keyValue.split('=') // Filtering avoids decoding as `undefined` for value, where
   502     const [key, value = ''] = keyValue.split('=') // Filtering avoids decoding as `undefined` for value, where
   562     // default is restored in destructuring assignment.
   503     // default is restored in destructuring assignment.
   563     .filter(Boolean).map(decodeURIComponent);
   504     .filter(Boolean).map(decodeURIComponent);
   564 
   505 
   565     if (key) {
   506     if (key) {
   566       const segments = key.replace(/\]/g, '').split('[');
   507       const segments = key.replace(/\]/g, '').split('[');
   567       setPath(accumulator, segments, value);
   508       setPath(accumulator, segments, value);
   568     }
   509     }
   569 
   510 
   570     return accumulator;
   511     return accumulator;
   571   }, {});
   512   }, Object.create(null));
   572 }
   513 }
   573 
   514 
   574 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/add-query-args.js
   515 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/add-query-args.js
   575 /**
   516 /**
   576  * Internal dependencies
   517  * Internal dependencies
   577  */
   518  */
   578 
   519 
   579 
   520 
   580 /**
   521 /**
   581  * Appends arguments as querystring to the provided URL. If the URL already
   522  * Appends arguments as querystring to the provided URL. If the URL already
   582  * includes query arguments, the arguments are merged with (and take precedent
   523  * includes query arguments, the arguments are merged with (and take precedent
   583  * over) the existing set.
   524  * over) the existing set.
   584  *
   525  *
   585  * @param {string} [url='']  URL to which arguments should be appended. If omitted,
   526  * @param {string} [url=''] URL to which arguments should be appended. If omitted,
   586  *                           only the resulting querystring is returned.
   527  *                          only the resulting querystring is returned.
   587  * @param {Object} [args]    Query arguments to apply to URL.
   528  * @param {Object} [args]   Query arguments to apply to URL.
   588  *
   529  *
   589  * @example
   530  * @example
   590  * ```js
   531  * ```js
   591  * const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://google.com/?q=test
   532  * const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://google.com/?q=test
   592  * ```
   533  * ```
   593  *
   534  *
   594  * @return {string} URL with arguments applied.
   535  * @return {string} URL with arguments applied.
   595  */
   536  */
   596 
   537 
   597 function addQueryArgs(url = '', args) {
   538 function addQueryArgs() {
       
   539   let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
       
   540   let args = arguments.length > 1 ? arguments[1] : undefined;
       
   541 
   598   // If no arguments are to be appended, return original URL.
   542   // If no arguments are to be appended, return original URL.
   599   if (!args || !Object.keys(args).length) {
   543   if (!args || !Object.keys(args).length) {
   600     return url;
   544     return url;
   601   }
   545   }
   602 
   546 
   612   }
   556   }
   613 
   557 
   614   return baseUrl + '?' + buildQueryString(args);
   558   return baseUrl + '?' + buildQueryString(args);
   615 }
   559 }
   616 
   560 
   617 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-arg.js
   561 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-arg.js
   618 /**
   562 /**
   619  * Internal dependencies
   563  * Internal dependencies
   620  */
   564  */
   621 
   565 
   622 /**
   566 /**
   643 
   587 
   644 function getQueryArg(url, arg) {
   588 function getQueryArg(url, arg) {
   645   return getQueryArgs(url)[arg];
   589   return getQueryArgs(url)[arg];
   646 }
   590 }
   647 
   591 
   648 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/has-query-arg.js
   592 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/has-query-arg.js
   649 /**
   593 /**
   650  * Internal dependencies
   594  * Internal dependencies
   651  */
   595  */
   652 
   596 
   653 /**
   597 /**
   666 
   610 
   667 function hasQueryArg(url, arg) {
   611 function hasQueryArg(url, arg) {
   668   return getQueryArg(url, arg) !== undefined;
   612   return getQueryArg(url, arg) !== undefined;
   669 }
   613 }
   670 
   614 
   671 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/remove-query-args.js
   615 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/remove-query-args.js
   672 /**
   616 /**
   673  * Internal dependencies
   617  * Internal dependencies
   674  */
   618  */
   675 
   619 
   676 
   620 
   686  * ```
   630  * ```
   687  *
   631  *
   688  * @return {string} Updated URL.
   632  * @return {string} Updated URL.
   689  */
   633  */
   690 
   634 
   691 function removeQueryArgs(url, ...args) {
   635 function removeQueryArgs(url) {
   692   const queryStringIndex = url.indexOf('?');
   636   const queryStringIndex = url.indexOf('?');
   693 
   637 
   694   if (queryStringIndex === -1) {
   638   if (queryStringIndex === -1) {
   695     return url;
   639     return url;
   696   }
   640   }
   697 
   641 
   698   const query = getQueryArgs(url);
   642   const query = getQueryArgs(url);
   699   const baseURL = url.substr(0, queryStringIndex);
   643   const baseURL = url.substr(0, queryStringIndex);
       
   644 
       
   645   for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
       
   646     args[_key - 1] = arguments[_key];
       
   647   }
       
   648 
   700   args.forEach(arg => delete query[arg]);
   649   args.forEach(arg => delete query[arg]);
   701   const queryString = buildQueryString(query);
   650   const queryString = buildQueryString(query);
   702   return queryString ? baseURL + '?' + queryString : baseURL;
   651   return queryString ? baseURL + '?' + queryString : baseURL;
   703 }
   652 }
   704 
   653 
   705 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/prepend-http.js
   654 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/prepend-http.js
   706 /**
   655 /**
   707  * Internal dependencies
   656  * Internal dependencies
   708  */
   657  */
   709 
   658 
   710 const USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i;
   659 const USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i;
   733   }
   682   }
   734 
   683 
   735   return url;
   684   return url;
   736 }
   685 }
   737 
   686 
   738 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/safe-decode-uri.js
   687 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/safe-decode-uri.js
   739 /**
   688 /**
   740  * Safely decodes a URI with `decodeURI`. Returns the URI unmodified if
   689  * Safely decodes a URI with `decodeURI`. Returns the URI unmodified if
   741  * `decodeURI` throws an error.
   690  * `decodeURI` throws an error.
   742  *
   691  *
   743  * @param {string} uri URI to decode.
   692  * @param {string} uri URI to decode.
   755   } catch (uriError) {
   704   } catch (uriError) {
   756     return uri;
   705     return uri;
   757   }
   706   }
   758 }
   707 }
   759 
   708 
   760 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/safe-decode-uri-component.js
   709 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/safe-decode-uri-component.js
   761 /**
   710 /**
   762  * Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if
   711  * Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if
   763  * `decodeURIComponent` throws an error.
   712  * `decodeURIComponent` throws an error.
   764  *
   713  *
   765  * @param {string} uriComponent URI component to decode.
   714  * @param {string} uriComponent URI component to decode.
   772   } catch (uriComponentError) {
   721   } catch (uriComponentError) {
   773     return uriComponent;
   722     return uriComponent;
   774   }
   723   }
   775 }
   724 }
   776 
   725 
   777 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/filter-url-for-display.js
   726 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/filter-url-for-display.js
   778 /**
   727 /**
   779  * Returns a URL for display.
   728  * Returns a URL for display.
   780  *
   729  *
   781  * @param {string} url Original URL.
   730  * @param {string}      url       Original URL.
   782  * @param {number|null} maxLength URL length.
   731  * @param {number|null} maxLength URL length.
   783  *
   732  *
   784  * @example
   733  * @example
   785  * ```js
   734  * ```js
   786  * const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg
   735  * const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg
   787  * const imageUrl = filterURLForDisplay( 'https://www.wordpress.org/wp-content/uploads/img.png', 20 ); // …ent/uploads/img.png
   736  * const imageUrl = filterURLForDisplay( 'https://www.wordpress.org/wp-content/uploads/img.png', 20 ); // …ent/uploads/img.png
   788  * ```
   737  * ```
   789  *
   738  *
   790  * @return {string} Displayed URL.
   739  * @return {string} Displayed URL.
   791  */
   740  */
   792 function filterURLForDisplay(url, maxLength = null) {
   741 function filterURLForDisplay(url) {
       
   742   let maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
   793   // Remove protocol and www prefixes.
   743   // Remove protocol and www prefixes.
   794   let filteredURL = url.replace(/^(?:https?:)\/\/(?:www\.)?/, ''); // Ends with / and only has that single slash, strip it.
   744   let filteredURL = url.replace(/^(?:https?:)\/\/(?:www\.)?/, ''); // Ends with / and only has that single slash, strip it.
   795 
   745 
   796   if (filteredURL.match(/^[^\/]+\/$/)) {
   746   if (filteredURL.match(/^[^\/]+\/$/)) {
   797     filteredURL = filteredURL.replace('/', '');
   747     filteredURL = filteredURL.replace('/', '');
   817   const [fileName, extension] = [file.slice(0, index), file.slice(index + 1)];
   767   const [fileName, extension] = [file.slice(0, index), file.slice(index + 1)];
   818   const truncatedFile = fileName.slice(-3) + '.' + extension;
   768   const truncatedFile = fileName.slice(-3) + '.' + extension;
   819   return file.slice(0, maxLength - truncatedFile.length - 1) + '…' + truncatedFile;
   769   return file.slice(0, maxLength - truncatedFile.length - 1) + '…' + truncatedFile;
   820 }
   770 }
   821 
   771 
   822 // EXTERNAL MODULE: external "lodash"
   772 ;// CONCATENATED MODULE: external "lodash"
   823 var external_lodash_ = __webpack_require__("YLtl");
   773 var external_lodash_namespaceObject = window["lodash"];
   824 
   774 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/clean-for-slug.js
   825 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/clean-for-slug.js
       
   826 /**
   775 /**
   827  * External dependencies
   776  * External dependencies
   828  */
   777  */
   829 
   778 
   830 /**
   779 /**
   847 function cleanForSlug(string) {
   796 function cleanForSlug(string) {
   848   if (!string) {
   797   if (!string) {
   849     return '';
   798     return '';
   850   }
   799   }
   851 
   800 
   852   return Object(external_lodash_["trim"])(Object(external_lodash_["deburr"])(string).replace(/[\s\./]+/g, '-').replace(/[^\w-]+/g, '').toLowerCase(), '-');
   801   return (0,external_lodash_namespaceObject.trim)((0,external_lodash_namespaceObject.deburr)(string).replace(/[\s\./]+/g, '-').replace(/[^\p{L}\p{N}_-]+/gu, '').toLowerCase(), '-');
   853 }
   802 }
   854 
   803 
   855 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/index.js
   804 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-filename.js
   856 
   805 /**
   857 
   806  * Returns the filename part of the URL.
   858 
   807  *
   859 
   808  * @param {string} url The full URL.
   860 
   809  *
   861 
   810  * @example
   862 
   811  * ```js
   863 
   812  * const filename1 = getFilename( 'http://localhost:8080/this/is/a/test.jpg' ); // 'test.jpg'
   864 
   813  * const filename2 = getFilename( '/this/is/a/test.png' ); // 'test.png'
   865 
   814  * ```
   866 
   815  *
   867 
   816  * @return {string|void} The filename part of the URL.
   868 
   817  */
   869 
   818 function getFilename(url) {
   870 
   819   let filename;
   871 
   820 
   872 
   821   try {
   873 
   822     filename = new URL(url, 'http://example.com').pathname.split('/').pop();
   874 
   823   } catch (error) {}
   875 
   824 
   876 
   825   if (filename) {
   877 
   826     return filename;
   878 
   827   }
   879 
   828 }
   880 
   829 
   881 
   830 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/normalize-path.js
   882 /***/ })
   831 /**
   883 
   832  * Given a path, returns a normalized path where equal query parameter values
   884 /******/ });
   833  * will be treated as identical, regardless of order they appear in the original
       
   834  * text.
       
   835  *
       
   836  * @param {string} path Original path.
       
   837  *
       
   838  * @return {string} Normalized path.
       
   839  */
       
   840 function normalizePath(path) {
       
   841   const splitted = path.split('?');
       
   842   const query = splitted[1];
       
   843   const base = splitted[0];
       
   844 
       
   845   if (!query) {
       
   846     return base;
       
   847   } // 'b=1%2C2&c=2&a=5'
       
   848 
       
   849 
       
   850   return base + '?' + query // [ 'b=1%2C2', 'c=2', 'a=5' ]
       
   851   .split('&') // [ [ 'b, '1%2C2' ], [ 'c', '2' ], [ 'a', '5' ] ]
       
   852   .map(entry => entry.split('=')) // [ [ 'b', '1,2' ], [ 'c', '2' ], [ 'a', '5' ] ]
       
   853   .map(pair => pair.map(decodeURIComponent)) // [ [ 'a', '5' ], [ 'b, '1,2' ], [ 'c', '2' ] ]
       
   854   .sort((a, b) => a[0].localeCompare(b[0])) // [ [ 'a', '5' ], [ 'b, '1%2C2' ], [ 'c', '2' ] ]
       
   855   .map(pair => pair.map(encodeURIComponent)) // [ 'a=5', 'b=1%2C2', 'c=2' ]
       
   856   .map(pair => pair.join('=')) // 'a=5&b=1%2C2&c=2'
       
   857   .join('&');
       
   858 }
       
   859 
       
   860 ;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/index.js
       
   861 
       
   862 
       
   863 
       
   864 
       
   865 
       
   866 
       
   867 
       
   868 
       
   869 
       
   870 
       
   871 
       
   872 
       
   873 
       
   874 
       
   875 
       
   876 
       
   877 
       
   878 
       
   879 
       
   880 
       
   881 
       
   882 
       
   883 
       
   884 
       
   885 
       
   886 
       
   887 
       
   888 (window.wp = window.wp || {}).url = __webpack_exports__;
       
   889 /******/ })()
       
   890 ;