@wordpress/url 4.34.0 → 4.34.1-next.2f1c7c01b.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/build/add-query-args.js +2 -0
  2. package/build/add-query-args.js.map +1 -1
  3. package/build/build-query-string.js +2 -0
  4. package/build/build-query-string.js.map +1 -1
  5. package/build/clean-for-slug.js +2 -0
  6. package/build/clean-for-slug.js.map +1 -1
  7. package/build/filter-url-for-display.js +2 -0
  8. package/build/filter-url-for-display.js.map +1 -1
  9. package/build/get-authority.js +2 -0
  10. package/build/get-authority.js.map +1 -1
  11. package/build/get-filename.js +2 -0
  12. package/build/get-filename.js.map +1 -1
  13. package/build/get-fragment.js +2 -0
  14. package/build/get-fragment.js.map +1 -1
  15. package/build/get-path-and-query-string.js +2 -0
  16. package/build/get-path-and-query-string.js.map +1 -1
  17. package/build/get-path.js +2 -0
  18. package/build/get-path.js.map +1 -1
  19. package/build/get-protocol.js +2 -0
  20. package/build/get-protocol.js.map +1 -1
  21. package/build/get-query-arg.js +2 -0
  22. package/build/get-query-arg.js.map +1 -1
  23. package/build/get-query-args.js +2 -0
  24. package/build/get-query-args.js.map +1 -1
  25. package/build/get-query-string.js +2 -0
  26. package/build/get-query-string.js.map +1 -1
  27. package/build/has-query-arg.js +2 -0
  28. package/build/has-query-arg.js.map +1 -1
  29. package/build/index.js +2 -0
  30. package/build/index.js.map +1 -1
  31. package/build/is-email.js +3 -1
  32. package/build/is-email.js.map +1 -1
  33. package/build/is-phone-number.js +3 -1
  34. package/build/is-phone-number.js.map +1 -1
  35. package/build/is-url.js +2 -0
  36. package/build/is-url.js.map +1 -1
  37. package/build/is-valid-authority.js +2 -0
  38. package/build/is-valid-authority.js.map +1 -1
  39. package/build/is-valid-fragment.js +2 -0
  40. package/build/is-valid-fragment.js.map +1 -1
  41. package/build/is-valid-path.js +2 -0
  42. package/build/is-valid-path.js.map +1 -1
  43. package/build/is-valid-protocol.js +2 -0
  44. package/build/is-valid-protocol.js.map +1 -1
  45. package/build/is-valid-query-string.js +2 -0
  46. package/build/is-valid-query-string.js.map +1 -1
  47. package/build/normalize-path.js +2 -0
  48. package/build/normalize-path.js.map +1 -1
  49. package/build/prepend-http.js +3 -1
  50. package/build/prepend-http.js.map +1 -1
  51. package/build/prepend-https.js +2 -0
  52. package/build/prepend-https.js.map +1 -1
  53. package/build/remove-query-args.js +2 -0
  54. package/build/remove-query-args.js.map +1 -1
  55. package/build/safe-decode-uri-component.js +2 -0
  56. package/build/safe-decode-uri-component.js.map +1 -1
  57. package/build/safe-decode-uri.js +2 -0
  58. package/build/safe-decode-uri.js.map +1 -1
  59. package/build-module/add-query-args.js +1 -0
  60. package/build-module/add-query-args.js.map +1 -1
  61. package/build-module/build-query-string.js +1 -0
  62. package/build-module/build-query-string.js.map +1 -1
  63. package/build-module/clean-for-slug.js +1 -0
  64. package/build-module/clean-for-slug.js.map +1 -1
  65. package/build-module/filter-url-for-display.js +1 -0
  66. package/build-module/filter-url-for-display.js.map +1 -1
  67. package/build-module/get-authority.js +1 -0
  68. package/build-module/get-authority.js.map +1 -1
  69. package/build-module/get-filename.js +1 -0
  70. package/build-module/get-filename.js.map +1 -1
  71. package/build-module/get-fragment.js +1 -0
  72. package/build-module/get-fragment.js.map +1 -1
  73. package/build-module/get-path-and-query-string.js +1 -0
  74. package/build-module/get-path-and-query-string.js.map +1 -1
  75. package/build-module/get-path.js +1 -0
  76. package/build-module/get-path.js.map +1 -1
  77. package/build-module/get-protocol.js +1 -0
  78. package/build-module/get-protocol.js.map +1 -1
  79. package/build-module/get-query-arg.js +1 -0
  80. package/build-module/get-query-arg.js.map +1 -1
  81. package/build-module/get-query-args.js +1 -0
  82. package/build-module/get-query-args.js.map +1 -1
  83. package/build-module/get-query-string.js +1 -0
  84. package/build-module/get-query-string.js.map +1 -1
  85. package/build-module/has-query-arg.js +1 -0
  86. package/build-module/has-query-arg.js.map +1 -1
  87. package/build-module/index.js +1 -0
  88. package/build-module/index.js.map +1 -1
  89. package/build-module/is-email.js +2 -1
  90. package/build-module/is-email.js.map +1 -1
  91. package/build-module/is-phone-number.js +2 -1
  92. package/build-module/is-phone-number.js.map +1 -1
  93. package/build-module/is-url.js +1 -0
  94. package/build-module/is-url.js.map +1 -1
  95. package/build-module/is-valid-authority.js +1 -0
  96. package/build-module/is-valid-authority.js.map +1 -1
  97. package/build-module/is-valid-fragment.js +1 -0
  98. package/build-module/is-valid-fragment.js.map +1 -1
  99. package/build-module/is-valid-path.js +1 -0
  100. package/build-module/is-valid-path.js.map +1 -1
  101. package/build-module/is-valid-protocol.js +1 -0
  102. package/build-module/is-valid-protocol.js.map +1 -1
  103. package/build-module/is-valid-query-string.js +1 -0
  104. package/build-module/is-valid-query-string.js.map +1 -1
  105. package/build-module/normalize-path.js +1 -0
  106. package/build-module/normalize-path.js.map +1 -1
  107. package/build-module/prepend-http.js +2 -1
  108. package/build-module/prepend-http.js.map +1 -1
  109. package/build-module/prepend-https.js +1 -0
  110. package/build-module/prepend-https.js.map +1 -1
  111. package/build-module/remove-query-args.js +1 -0
  112. package/build-module/remove-query-args.js.map +1 -1
  113. package/build-module/safe-decode-uri-component.js +1 -0
  114. package/build-module/safe-decode-uri-component.js.map +1 -1
  115. package/build-module/safe-decode-uri.js +1 -0
  116. package/build-module/safe-decode-uri.js.map +1 -1
  117. package/package.json +2 -2
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/url/src/remove-query-args.ts
19
21
  var remove_query_args_exports = {};
20
22
  __export(remove_query_args_exports, {
21
23
  removeQueryArgs: () => removeQueryArgs
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/remove-query-args.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { getQueryArgs } from './get-query-args';\nimport { buildQueryString } from './build-query-string';\n\n/**\n * Removes arguments from the query string of the url\n *\n * @param url URL.\n * @param args Query Args.\n *\n * @example\n * ```js\n * const newUrl = removeQueryArgs( 'https://wordpress.org?foo=bar&bar=baz&baz=foobar', 'foo', 'bar' ); // https://wordpress.org?baz=foobar\n * ```\n *\n * @return Updated URL.\n */\nexport function removeQueryArgs( url: string, ...args: string[] ): string {\n\tconst fragment = url.replace( /^[^#]*/, '' );\n\turl = url.replace( /#.*/, '' );\n\n\tconst queryStringIndex = url.indexOf( '?' );\n\tif ( queryStringIndex === -1 ) {\n\t\treturn url + fragment;\n\t}\n\n\tconst query = getQueryArgs( url );\n\tconst baseURL = url.substr( 0, queryStringIndex );\n\targs.forEach( ( arg ) => delete query[ arg ] );\n\tconst queryString = buildQueryString( query );\n\tconst updatedUrl = queryString ? baseURL + '?' + queryString : baseURL;\n\treturn updatedUrl + fragment;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,4BAA6B;AAC7B,gCAAiC;AAe1B,SAAS,gBAAiB,QAAgB,MAAyB;AACzE,QAAM,WAAW,IAAI,QAAS,UAAU,EAAG;AAC3C,QAAM,IAAI,QAAS,OAAO,EAAG;AAE7B,QAAM,mBAAmB,IAAI,QAAS,GAAI;AAC1C,MAAK,qBAAqB,IAAK;AAC9B,WAAO,MAAM;AAAA,EACd;AAEA,QAAM,YAAQ,oCAAc,GAAI;AAChC,QAAM,UAAU,IAAI,OAAQ,GAAG,gBAAiB;AAChD,OAAK,QAAS,CAAE,QAAS,OAAO,MAAO,GAAI,CAAE;AAC7C,QAAM,kBAAc,4CAAkB,KAAM;AAC5C,QAAM,aAAa,cAAc,UAAU,MAAM,cAAc;AAC/D,SAAO,aAAa;AACrB;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,4BAA6B;AAC7B,gCAAiC;AAe1B,SAAS,gBAAiB,QAAgB,MAAyB;AACzE,QAAM,WAAW,IAAI,QAAS,UAAU,EAAG;AAC3C,QAAM,IAAI,QAAS,OAAO,EAAG;AAE7B,QAAM,mBAAmB,IAAI,QAAS,GAAI;AAC1C,MAAK,qBAAqB,IAAK;AAC9B,WAAO,MAAM;AAAA,EACd;AAEA,QAAM,YAAQ,oCAAc,GAAI;AAChC,QAAM,UAAU,IAAI,OAAQ,GAAG,gBAAiB;AAChD,OAAK,QAAS,CAAE,QAAS,OAAO,MAAO,GAAI,CAAE;AAC7C,QAAM,kBAAc,4CAAkB,KAAM;AAC5C,QAAM,aAAa,cAAc,UAAU,MAAM,cAAc;AAC/D,SAAO,aAAa;AACrB;",
6
6
  "names": []
7
7
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/url/src/safe-decode-uri-component.ts
19
21
  var safe_decode_uri_component_exports = {};
20
22
  __export(safe_decode_uri_component_exports, {
21
23
  safeDecodeURIComponent: () => safeDecodeURIComponent
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/safe-decode-uri-component.ts"],
4
4
  "sourcesContent": ["/**\n * Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if\n * `decodeURIComponent` throws an error.\n *\n * @param uriComponent URI component to decode.\n *\n * @return Decoded URI component if possible.\n */\nexport function safeDecodeURIComponent( uriComponent: string ): string {\n\ttry {\n\t\treturn decodeURIComponent( uriComponent );\n\t} catch ( uriComponentError ) {\n\t\treturn uriComponent;\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,SAAS,uBAAwB,cAA+B;AACtE,MAAI;AACH,WAAO,mBAAoB,YAAa;AAAA,EACzC,SAAU,mBAAoB;AAC7B,WAAO;AAAA,EACR;AACD;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,SAAS,uBAAwB,cAA+B;AACtE,MAAI;AACH,WAAO,mBAAoB,YAAa;AAAA,EACzC,SAAU,mBAAoB;AAC7B,WAAO;AAAA,EACR;AACD;",
6
6
  "names": []
7
7
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/url/src/safe-decode-uri.ts
19
21
  var safe_decode_uri_exports = {};
20
22
  __export(safe_decode_uri_exports, {
21
23
  safeDecodeURI: () => safeDecodeURI
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/safe-decode-uri.ts"],
4
4
  "sourcesContent": ["/**\n * Safely decodes a URI with `decodeURI`. Returns the URI unmodified if\n * `decodeURI` throws an error.\n *\n * @param uri URI to decode.\n *\n * @example\n * ```js\n * const badUri = safeDecodeURI( '%z' ); // does not throw an Error, simply returns '%z'\n * ```\n *\n * @return Decoded URI if possible.\n */\nexport function safeDecodeURI( uri: string ): string {\n\ttry {\n\t\treturn decodeURI( uri );\n\t} catch ( uriError ) {\n\t\treturn uri;\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,cAAe,KAAsB;AACpD,MAAI;AACH,WAAO,UAAW,GAAI;AAAA,EACvB,SAAU,UAAW;AACpB,WAAO;AAAA,EACR;AACD;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,cAAe,KAAsB;AACpD,MAAI;AACH,WAAO,UAAW,GAAI;AAAA,EACvB,SAAU,UAAW;AACpB,WAAO;AAAA,EACR;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/add-query-args.ts
1
2
  import { getQueryArgs } from "./get-query-args";
2
3
  import { buildQueryString } from "./build-query-string";
3
4
  import { getFragment } from "./get-fragment";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/add-query-args.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { getQueryArgs } from './get-query-args';\nimport { buildQueryString } from './build-query-string';\nimport { getFragment } from './get-fragment';\n\n/**\n * Appends arguments as querystring to the provided URL. If the URL already\n * includes query arguments, the arguments are merged with (and take precedent\n * over) the existing set.\n *\n * @param url URL to which arguments should be appended. If omitted,\n * only the resulting querystring is returned.\n * @param args Query arguments to apply to URL.\n *\n * @example\n * ```js\n * const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://google.com/?q=test\n * ```\n *\n * @return URL with arguments applied.\n */\nexport function addQueryArgs(\n\turl: string = '',\n\targs?: Record< string, unknown >\n): string {\n\t// If no arguments are to be appended, return original URL.\n\tif ( ! args || ! Object.keys( args ).length ) {\n\t\treturn url;\n\t}\n\n\tconst fragment = getFragment( url ) || '';\n\tlet baseUrl = url.replace( fragment, '' );\n\n\t// Determine whether URL already had query arguments.\n\tconst queryStringIndex = url.indexOf( '?' );\n\tif ( queryStringIndex !== -1 ) {\n\t\t// Merge into existing query arguments.\n\t\targs = Object.assign( getQueryArgs( url ), args );\n\n\t\t// Change working base URL to omit previous query arguments.\n\t\tbaseUrl = baseUrl.substr( 0, queryStringIndex );\n\t}\n\n\treturn baseUrl + '?' + buildQueryString( args ) + fragment;\n}\n"],
5
- "mappings": "AAGA,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAkBrB,SAAS,aACf,MAAc,IACd,MACS;AAET,MAAK,CAAE,QAAQ,CAAE,OAAO,KAAM,IAAK,EAAE,QAAS;AAC7C,WAAO;AAAA,EACR;AAEA,QAAM,WAAW,YAAa,GAAI,KAAK;AACvC,MAAI,UAAU,IAAI,QAAS,UAAU,EAAG;AAGxC,QAAM,mBAAmB,IAAI,QAAS,GAAI;AAC1C,MAAK,qBAAqB,IAAK;AAE9B,WAAO,OAAO,OAAQ,aAAc,GAAI,GAAG,IAAK;AAGhD,cAAU,QAAQ,OAAQ,GAAG,gBAAiB;AAAA,EAC/C;AAEA,SAAO,UAAU,MAAM,iBAAkB,IAAK,IAAI;AACnD;",
5
+ "mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAkBrB,SAAS,aACf,MAAc,IACd,MACS;AAET,MAAK,CAAE,QAAQ,CAAE,OAAO,KAAM,IAAK,EAAE,QAAS;AAC7C,WAAO;AAAA,EACR;AAEA,QAAM,WAAW,YAAa,GAAI,KAAK;AACvC,MAAI,UAAU,IAAI,QAAS,UAAU,EAAG;AAGxC,QAAM,mBAAmB,IAAI,QAAS,GAAI;AAC1C,MAAK,qBAAqB,IAAK;AAE9B,WAAO,OAAO,OAAQ,aAAc,GAAI,GAAG,IAAK;AAGhD,cAAU,QAAQ,OAAQ,GAAG,gBAAiB;AAAA,EAC/C;AAEA,SAAO,UAAU,MAAM,iBAAkB,IAAK,IAAI;AACnD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/build-query-string.ts
1
2
  function buildQueryString(data) {
2
3
  let string = "";
3
4
  const stack = Object.entries(data);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/build-query-string.ts"],
4
4
  "sourcesContent": ["/**\n * Generates URL-encoded query string using input query data.\n *\n * It is intended to behave equivalent as PHP's `http_build_query`, configured\n * with encoding type PHP_QUERY_RFC3986 (spaces as `%20`).\n *\n * @example\n * ```js\n * const queryString = buildQueryString( {\n * simple: 'is ok',\n * arrays: [ 'are', 'fine', 'too' ],\n * objects: {\n * evenNested: {\n * ok: 'yes',\n * },\n * },\n * } );\n * // \"simple=is%20ok&arrays%5B0%5D=are&arrays%5B1%5D=fine&arrays%5B2%5D=too&objects%5BevenNested%5D%5Bok%5D=yes\"\n * ```\n *\n * @param data Data to encode.\n *\n * @return Query string.\n */\nexport function buildQueryString( data: Record< string, unknown > ): string {\n\tlet string = '';\n\n\tconst stack: Array< [ string, unknown ] > = Object.entries( data );\n\n\tlet pair;\n\twhile ( ( pair = stack.shift() ) ) {\n\t\tlet [ key, value ] = pair;\n\n\t\t// Support building deeply nested data, from array or object values.\n\t\tconst hasNestedData =\n\t\t\tArray.isArray( value ) || ( value && value.constructor === Object );\n\n\t\tif ( hasNestedData ) {\n\t\t\t// Push array or object values onto the stack as composed of their\n\t\t\t// original key and nested index or key, retaining order by a\n\t\t\t// combination of Array#reverse and Array#unshift onto the stack.\n\t\t\tconst valuePairs = Object.entries( value as object ).reverse();\n\t\t\tfor ( const [ member, memberValue ] of valuePairs ) {\n\t\t\t\tstack.unshift( [ `${ key }[${ member }]`, memberValue ] );\n\t\t\t}\n\t\t} else if ( value !== undefined ) {\n\t\t\t// Null is treated as special case, equivalent to empty string.\n\t\t\tif ( value === null ) {\n\t\t\t\tvalue = '';\n\t\t\t}\n\n\t\t\tstring +=\n\t\t\t\t'&' +\n\t\t\t\t[ key, String( value ) ].map( encodeURIComponent ).join( '=' );\n\t\t}\n\t}\n\n\t// Loop will concatenate with leading `&`, but it's only expected for all\n\t// but the first query parameter. This strips the leading `&`, while still\n\t// accounting for the case that the string may in-fact be empty.\n\treturn string.substr( 1 );\n}\n"],
5
- "mappings": "AAwBO,SAAS,iBAAkB,MAA0C;AAC3E,MAAI,SAAS;AAEb,QAAM,QAAsC,OAAO,QAAS,IAAK;AAEjE,MAAI;AACJ,SAAU,OAAO,MAAM,MAAM,GAAM;AAClC,QAAI,CAAE,KAAK,KAAM,IAAI;AAGrB,UAAM,gBACL,MAAM,QAAS,KAAM,KAAO,SAAS,MAAM,gBAAgB;AAE5D,QAAK,eAAgB;AAIpB,YAAM,aAAa,OAAO,QAAS,KAAgB,EAAE,QAAQ;AAC7D,iBAAY,CAAE,QAAQ,WAAY,KAAK,YAAa;AACnD,cAAM,QAAS,CAAE,GAAI,GAAI,IAAK,MAAO,KAAK,WAAY,CAAE;AAAA,MACzD;AAAA,IACD,WAAY,UAAU,QAAY;AAEjC,UAAK,UAAU,MAAO;AACrB,gBAAQ;AAAA,MACT;AAEA,gBACC,MACA,CAAE,KAAK,OAAQ,KAAM,CAAE,EAAE,IAAK,kBAAmB,EAAE,KAAM,GAAI;AAAA,IAC/D;AAAA,EACD;AAKA,SAAO,OAAO,OAAQ,CAAE;AACzB;",
5
+ "mappings": ";AAwBO,SAAS,iBAAkB,MAA0C;AAC3E,MAAI,SAAS;AAEb,QAAM,QAAsC,OAAO,QAAS,IAAK;AAEjE,MAAI;AACJ,SAAU,OAAO,MAAM,MAAM,GAAM;AAClC,QAAI,CAAE,KAAK,KAAM,IAAI;AAGrB,UAAM,gBACL,MAAM,QAAS,KAAM,KAAO,SAAS,MAAM,gBAAgB;AAE5D,QAAK,eAAgB;AAIpB,YAAM,aAAa,OAAO,QAAS,KAAgB,EAAE,QAAQ;AAC7D,iBAAY,CAAE,QAAQ,WAAY,KAAK,YAAa;AACnD,cAAM,QAAS,CAAE,GAAI,GAAI,IAAK,MAAO,KAAK,WAAY,CAAE;AAAA,MACzD;AAAA,IACD,WAAY,UAAU,QAAY;AAEjC,UAAK,UAAU,MAAO;AACrB,gBAAQ;AAAA,MACT;AAEA,gBACC,MACA,CAAE,KAAK,OAAQ,KAAM,CAAE,EAAE,IAAK,kBAAmB,EAAE,KAAM,GAAI;AAAA,IAC/D;AAAA,EACD;AAKA,SAAO,OAAO,OAAQ,CAAE;AACzB;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/clean-for-slug.ts
1
2
  import removeAccents from "remove-accents";
2
3
  function cleanForSlug(string) {
3
4
  if (!string) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/clean-for-slug.ts"],
4
4
  "sourcesContent": ["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * Performs some basic cleanup of a string for use as a post slug.\n *\n * This replicates some of what `sanitize_title_with_dashes()` does in WordPress core, but\n * is only designed to approximate what the slug will be.\n *\n * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin\n * letters. Removes combining diacritical marks. Converts whitespace, periods,\n * and forward slashes to hyphens. Removes any remaining non-word characters\n * except hyphens. Converts remaining string to lowercase. It does not account\n * for octets, HTML entities, or other encoded characters.\n *\n * @param string Title or slug to be processed.\n *\n * @return Processed string.\n */\nexport function cleanForSlug( string: string ): string {\n\tif ( ! string ) {\n\t\treturn '';\n\t}\n\treturn (\n\t\tremoveAccents( string )\n\t\t\t// Convert &nbsp, &ndash, and &mdash to hyphens.\n\t\t\t.replace( /(&nbsp;|&ndash;|&mdash;)/g, '-' )\n\t\t\t// Convert each group of whitespace, periods, and forward slashes to a hyphen.\n\t\t\t.replace( /[\\s\\./]+/g, '-' )\n\t\t\t// Remove all HTML entities.\n\t\t\t.replace( /&\\S+?;/g, '' )\n\t\t\t// Remove anything that's not a letter, number, underscore or hyphen.\n\t\t\t.replace( /[^\\p{L}\\p{N}_-]+/gu, '' )\n\t\t\t// Convert to lowercase\n\t\t\t.toLowerCase()\n\t\t\t// Replace multiple hyphens with a single one.\n\t\t\t.replace( /-+/g, '-' )\n\t\t\t// Remove any remaining leading or trailing hyphens.\n\t\t\t.replace( /(^-+)|(-+$)/g, '' )\n\t);\n}\n"],
5
- "mappings": "AAGA,OAAO,mBAAmB;AAkBnB,SAAS,aAAc,QAAyB;AACtD,MAAK,CAAE,QAAS;AACf,WAAO;AAAA,EACR;AACA,SACC,cAAe,MAAO,EAEpB,QAAS,6BAA6B,GAAI,EAE1C,QAAS,aAAa,GAAI,EAE1B,QAAS,WAAW,EAAG,EAEvB,QAAS,sBAAsB,EAAG,EAElC,YAAY,EAEZ,QAAS,OAAO,GAAI,EAEpB,QAAS,gBAAgB,EAAG;AAEhC;",
5
+ "mappings": ";AAGA,OAAO,mBAAmB;AAkBnB,SAAS,aAAc,QAAyB;AACtD,MAAK,CAAE,QAAS;AACf,WAAO;AAAA,EACR;AACA,SACC,cAAe,MAAO,EAEpB,QAAS,6BAA6B,GAAI,EAE1C,QAAS,aAAa,GAAI,EAE1B,QAAS,WAAW,EAAG,EAEvB,QAAS,sBAAsB,EAAG,EAElC,YAAY,EAEZ,QAAS,OAAO,GAAI,EAEpB,QAAS,gBAAgB,EAAG;AAEhC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/filter-url-for-display.ts
1
2
  function filterURLForDisplay(url, maxLength = null) {
2
3
  if (!url) {
3
4
  return "";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/filter-url-for-display.ts"],
4
4
  "sourcesContent": ["/**\n * Returns a URL for display.\n *\n * @param url Original URL.\n * @param maxLength URL length.\n *\n * @example\n * ```js\n * const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg\n * const imageUrl = filterURLForDisplay( 'https://www.wordpress.org/wp-content/uploads/img.png', 20 ); // \u2026ent/uploads/img.png\n * ```\n *\n * @return Displayed URL.\n */\nexport function filterURLForDisplay(\n\turl: string,\n\tmaxLength: number | null = null\n): string {\n\tif ( ! url ) {\n\t\treturn '';\n\t}\n\n\t// Remove protocol and www prefixes.\n\tlet filteredURL = url\n\t\t.replace( /^[a-z\\-.\\+]+[0-9]*:(\\/\\/)?/i, '' )\n\t\t.replace( /^www\\./i, '' );\n\n\t// Ends with / and only has that single slash, strip it.\n\tif ( filteredURL.match( /^[^\\/]+\\/$/ ) ) {\n\t\tfilteredURL = filteredURL.replace( '/', '' );\n\t}\n\n\t// capture file name from URL\n\tconst fileRegexp = /\\/([^\\/?]+)\\.(?:[\\w]+)(?=\\?|$)/;\n\n\tif (\n\t\t! maxLength ||\n\t\tfilteredURL.length <= maxLength ||\n\t\t! filteredURL.match( fileRegexp )\n\t) {\n\t\treturn filteredURL;\n\t}\n\n\t// If the file is not greater than max length, return last portion of URL.\n\tfilteredURL = filteredURL.split( '?' )[ 0 ];\n\tconst urlPieces = filteredURL.split( '/' );\n\tconst file = urlPieces[ urlPieces.length - 1 ];\n\tif ( file.length <= maxLength ) {\n\t\treturn '\u2026' + filteredURL.slice( -maxLength );\n\t}\n\n\t// If the file is greater than max length, truncate the file.\n\tconst index = file.lastIndexOf( '.' );\n\tconst [ fileName, extension ] = [\n\t\tfile.slice( 0, index ),\n\t\tfile.slice( index + 1 ),\n\t];\n\tconst truncatedFile = fileName.slice( -3 ) + '.' + extension;\n\treturn (\n\t\tfile.slice( 0, maxLength - truncatedFile.length - 1 ) +\n\t\t'\u2026' +\n\t\ttruncatedFile\n\t);\n}\n"],
5
- "mappings": "AAcO,SAAS,oBACf,KACA,YAA2B,MAClB;AACT,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAGA,MAAI,cAAc,IAChB,QAAS,+BAA+B,EAAG,EAC3C,QAAS,WAAW,EAAG;AAGzB,MAAK,YAAY,MAAO,YAAa,GAAI;AACxC,kBAAc,YAAY,QAAS,KAAK,EAAG;AAAA,EAC5C;AAGA,QAAM,aAAa;AAEnB,MACC,CAAE,aACF,YAAY,UAAU,aACtB,CAAE,YAAY,MAAO,UAAW,GAC/B;AACD,WAAO;AAAA,EACR;AAGA,gBAAc,YAAY,MAAO,GAAI,EAAG,CAAE;AAC1C,QAAM,YAAY,YAAY,MAAO,GAAI;AACzC,QAAM,OAAO,UAAW,UAAU,SAAS,CAAE;AAC7C,MAAK,KAAK,UAAU,WAAY;AAC/B,WAAO,WAAM,YAAY,MAAO,CAAC,SAAU;AAAA,EAC5C;AAGA,QAAM,QAAQ,KAAK,YAAa,GAAI;AACpC,QAAM,CAAE,UAAU,SAAU,IAAI;AAAA,IAC/B,KAAK,MAAO,GAAG,KAAM;AAAA,IACrB,KAAK,MAAO,QAAQ,CAAE;AAAA,EACvB;AACA,QAAM,gBAAgB,SAAS,MAAO,EAAG,IAAI,MAAM;AACnD,SACC,KAAK,MAAO,GAAG,YAAY,cAAc,SAAS,CAAE,IACpD,WACA;AAEF;",
5
+ "mappings": ";AAcO,SAAS,oBACf,KACA,YAA2B,MAClB;AACT,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAGA,MAAI,cAAc,IAChB,QAAS,+BAA+B,EAAG,EAC3C,QAAS,WAAW,EAAG;AAGzB,MAAK,YAAY,MAAO,YAAa,GAAI;AACxC,kBAAc,YAAY,QAAS,KAAK,EAAG;AAAA,EAC5C;AAGA,QAAM,aAAa;AAEnB,MACC,CAAE,aACF,YAAY,UAAU,aACtB,CAAE,YAAY,MAAO,UAAW,GAC/B;AACD,WAAO;AAAA,EACR;AAGA,gBAAc,YAAY,MAAO,GAAI,EAAG,CAAE;AAC1C,QAAM,YAAY,YAAY,MAAO,GAAI;AACzC,QAAM,OAAO,UAAW,UAAU,SAAS,CAAE;AAC7C,MAAK,KAAK,UAAU,WAAY;AAC/B,WAAO,WAAM,YAAY,MAAO,CAAC,SAAU;AAAA,EAC5C;AAGA,QAAM,QAAQ,KAAK,YAAa,GAAI;AACpC,QAAM,CAAE,UAAU,SAAU,IAAI;AAAA,IAC/B,KAAK,MAAO,GAAG,KAAM;AAAA,IACrB,KAAK,MAAO,QAAQ,CAAE;AAAA,EACvB;AACA,QAAM,gBAAgB,SAAS,MAAO,EAAG,IAAI,MAAM;AACnD,SACC,KAAK,MAAO,GAAG,YAAY,cAAc,SAAS,CAAE,IACpD,WACA;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/get-authority.ts
1
2
  function getAuthority(url) {
2
3
  const matches = /^[^\/\s:]+:(?:\/\/)?\/?([^\/\s#?]+)[\/#?]{0,1}\S*$/.exec(
3
4
  url
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/get-authority.ts"],
4
4
  "sourcesContent": ["/**\n * Returns the authority part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const authority1 = getAuthority( 'https://wordpress.org/help/' ); // 'wordpress.org'\n * const authority2 = getAuthority( 'https://localhost:8080/test/' ); // 'localhost:8080'\n * ```\n *\n * @return The authority part of the URL.\n */\nexport function getAuthority( url: string ): string | void {\n\tconst matches = /^[^\\/\\s:]+:(?:\\/\\/)?\\/?([^\\/\\s#?]+)[\\/#?]{0,1}\\S*$/.exec(\n\t\turl\n\t);\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],
5
- "mappings": "AAaO,SAAS,aAAc,KAA6B;AAC1D,QAAM,UAAU,qDAAqD;AAAA,IACpE;AAAA,EACD;AACA,MAAK,SAAU;AACd,WAAO,QAAS,CAAE;AAAA,EACnB;AACD;",
5
+ "mappings": ";AAaO,SAAS,aAAc,KAA6B;AAC1D,QAAM,UAAU,qDAAqD;AAAA,IACpE;AAAA,EACD;AACA,MAAK,SAAU;AACd,WAAO,QAAS,CAAE;AAAA,EACnB;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/get-filename.ts
1
2
  function getFilename(url) {
2
3
  let filename;
3
4
  if (!url) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/get-filename.ts"],
4
4
  "sourcesContent": ["/**\n * Returns the filename part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const filename1 = getFilename( 'http://localhost:8080/this/is/a/test.jpg' ); // 'test.jpg'\n * const filename2 = getFilename( '/this/is/a/test.png' ); // 'test.png'\n * ```\n *\n * @return The filename part of the URL.\n */\nexport function getFilename( url: string ): string | void {\n\tlet filename;\n\n\tif ( ! url ) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\tfilename = new URL( url, 'http://example.com' ).pathname\n\t\t\t.split( '/' )\n\t\t\t.pop();\n\t} catch ( error ) {}\n\n\tif ( filename ) {\n\t\treturn filename;\n\t}\n}\n"],
5
- "mappings": "AAaO,SAAS,YAAa,KAA6B;AACzD,MAAI;AAEJ,MAAK,CAAE,KAAM;AACZ;AAAA,EACD;AAEA,MAAI;AACH,eAAW,IAAI,IAAK,KAAK,oBAAqB,EAAE,SAC9C,MAAO,GAAI,EACX,IAAI;AAAA,EACP,SAAU,OAAQ;AAAA,EAAC;AAEnB,MAAK,UAAW;AACf,WAAO;AAAA,EACR;AACD;",
5
+ "mappings": ";AAaO,SAAS,YAAa,KAA6B;AACzD,MAAI;AAEJ,MAAK,CAAE,KAAM;AACZ;AAAA,EACD;AAEA,MAAI;AACH,eAAW,IAAI,IAAK,KAAK,oBAAqB,EAAE,SAC9C,MAAO,GAAI,EACX,IAAI;AAAA,EACP,SAAU,OAAQ;AAAA,EAAC;AAEnB,MAAK,UAAW;AACf,WAAO;AAAA,EACR;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/get-fragment.ts
1
2
  function getFragment(url) {
2
3
  const matches = /^\S+?(#[^\s\?]*)/.exec(url);
3
4
  if (matches) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/get-fragment.ts"],
4
4
  "sourcesContent": ["/**\n * Returns the fragment part of the URL.\n *\n * @param url The full URL\n *\n * @example\n * ```js\n * const fragment1 = getFragment( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // '#fragment'\n * const fragment2 = getFragment( 'https://wordpress.org#another-fragment?query=true' ); // '#another-fragment'\n * ```\n *\n * @return The fragment part of the URL.\n */\nexport function getFragment( url: string ): string | void {\n\tconst matches = /^\\S+?(#[^\\s\\?]*)/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],
5
- "mappings": "AAaO,SAAS,YAAa,KAA6B;AACzD,QAAM,UAAU,mBAAmB,KAAM,GAAI;AAC7C,MAAK,SAAU;AACd,WAAO,QAAS,CAAE;AAAA,EACnB;AACD;",
5
+ "mappings": ";AAaO,SAAS,YAAa,KAA6B;AACzD,QAAM,UAAU,mBAAmB,KAAM,GAAI;AAC7C,MAAK,SAAU;AACd,WAAO,QAAS,CAAE;AAAA,EACnB;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/get-path-and-query-string.ts
1
2
  import { getPath, getQueryString } from ".";
2
3
  function getPathAndQueryString(url) {
3
4
  const path = getPath(url);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/get-path-and-query-string.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { getPath, getQueryString } from '.';\n\n/**\n * Returns the path part and query string part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const pathAndQueryString1 = getPathAndQueryString( 'http://localhost:8080/this/is/a/test?query=true' ); // '/this/is/a/test?query=true'\n * const pathAndQueryString2 = getPathAndQueryString( 'https://wordpress.org/help/faq/' ); // '/help/faq'\n * ```\n *\n * @return The path part and query string part of the URL.\n */\nexport function getPathAndQueryString( url: string ): string {\n\tconst path = getPath( url );\n\tconst queryString = getQueryString( url );\n\tlet value = '/';\n\tif ( path ) {\n\t\tvalue += path;\n\t}\n\tif ( queryString ) {\n\t\tvalue += `?${ queryString }`;\n\t}\n\treturn value;\n}\n"],
5
- "mappings": "AAGA,SAAS,SAAS,sBAAsB;AAejC,SAAS,sBAAuB,KAAsB;AAC5D,QAAM,OAAO,QAAS,GAAI;AAC1B,QAAM,cAAc,eAAgB,GAAI;AACxC,MAAI,QAAQ;AACZ,MAAK,MAAO;AACX,aAAS;AAAA,EACV;AACA,MAAK,aAAc;AAClB,aAAS,IAAK,WAAY;AAAA,EAC3B;AACA,SAAO;AACR;",
5
+ "mappings": ";AAGA,SAAS,SAAS,sBAAsB;AAejC,SAAS,sBAAuB,KAAsB;AAC5D,QAAM,OAAO,QAAS,GAAI;AAC1B,QAAM,cAAc,eAAgB,GAAI;AACxC,MAAI,QAAQ;AACZ,MAAK,MAAO;AACX,aAAS;AAAA,EACV;AACA,MAAK,aAAc;AAClB,aAAS,IAAK,WAAY;AAAA,EAC3B;AACA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/get-path.ts
1
2
  function getPath(url) {
2
3
  const matches = /^[^\/\s:]+:(?:\/\/)?[^\/\s#?]+[\/]([^\s#?]+)[#?]{0,1}\S*$/.exec(url);
3
4
  if (matches) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/get-path.ts"],
4
4
  "sourcesContent": ["/**\n * Returns the path part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const path1 = getPath( 'http://localhost:8080/this/is/a/test?query=true' ); // 'this/is/a/test'\n * const path2 = getPath( 'https://wordpress.org/help/faq/' ); // 'help/faq'\n * ```\n *\n * @return The path part of the URL.\n */\nexport function getPath( url: string ): string | void {\n\tconst matches =\n\t\t/^[^\\/\\s:]+:(?:\\/\\/)?[^\\/\\s#?]+[\\/]([^\\s#?]+)[#?]{0,1}\\S*$/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],
5
- "mappings": "AAaO,SAAS,QAAS,KAA6B;AACrD,QAAM,UACL,4DAA4D,KAAM,GAAI;AACvE,MAAK,SAAU;AACd,WAAO,QAAS,CAAE;AAAA,EACnB;AACD;",
5
+ "mappings": ";AAaO,SAAS,QAAS,KAA6B;AACrD,QAAM,UACL,4DAA4D,KAAM,GAAI;AACvE,MAAK,SAAU;AACd,WAAO,QAAS,CAAE;AAAA,EACnB;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/get-protocol.ts
1
2
  function getProtocol(url) {
2
3
  const matches = /^([^\s:]+:)/.exec(url);
3
4
  if (matches) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/get-protocol.ts"],
4
4
  "sourcesContent": ["/**\n * Returns the protocol part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const protocol1 = getProtocol( 'tel:012345678' ); // 'tel:'\n * const protocol2 = getProtocol( 'https://wordpress.org' ); // 'https:'\n * ```\n *\n * @return The protocol part of the URL.\n */\nexport function getProtocol( url: string ): string | void {\n\tconst matches = /^([^\\s:]+:)/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],
5
- "mappings": "AAaO,SAAS,YAAa,KAA6B;AACzD,QAAM,UAAU,cAAc,KAAM,GAAI;AACxC,MAAK,SAAU;AACd,WAAO,QAAS,CAAE;AAAA,EACnB;AACD;",
5
+ "mappings": ";AAaO,SAAS,YAAa,KAA6B;AACzD,QAAM,UAAU,cAAc,KAAM,GAAI;AACxC,MAAK,SAAU;AACd,WAAO,QAAS,CAAE;AAAA,EACnB;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/get-query-arg.ts
1
2
  import { getQueryArgs } from "./get-query-args";
2
3
  function getQueryArg(url, arg) {
3
4
  return getQueryArgs(url)[arg];
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/get-query-arg.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { getQueryArgs } from './get-query-args';\n\nexport interface QueryArgObject {\n\t[ key: string ]: QueryArgParsed;\n}\n\nexport type QueryArgParsed = string | string[] | QueryArgObject;\n\n/**\n * Returns a single query argument of the url\n *\n * @param url URL.\n * @param arg Query arg name.\n *\n * @example\n * ```js\n * const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar\n * ```\n *\n * @return Query arg value.\n */\nexport function getQueryArg(\n\turl: string,\n\targ: string\n): QueryArgParsed | undefined {\n\treturn getQueryArgs( url )[ arg ];\n}\n"],
5
- "mappings": "AAGA,SAAS,oBAAoB;AAqBtB,SAAS,YACf,KACA,KAC6B;AAC7B,SAAO,aAAc,GAAI,EAAG,GAAI;AACjC;",
5
+ "mappings": ";AAGA,SAAS,oBAAoB;AAqBtB,SAAS,YACf,KACA,KAC6B;AAC7B,SAAO,aAAc,GAAI,EAAG,GAAI;AACjC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/get-query-args.ts
1
2
  import { safeDecodeURIComponent } from "./safe-decode-uri-component";
2
3
  import { getQueryString } from "./get-query-string";
3
4
  function setPath(object, path, value) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/get-query-args.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { safeDecodeURIComponent } from './safe-decode-uri-component';\nimport { getQueryString } from './get-query-string';\nimport type { QueryArgParsed } from './get-query-arg';\n\ntype QueryArgs = Record< string, QueryArgParsed >;\n\n/**\n * Sets a value in object deeply by a given array of path segments. Mutates the\n * object reference.\n *\n * @param object Object in which to assign.\n * @param path Path segment at which to set value.\n * @param value Value to set.\n */\nfunction setPath( object: Record< string, any >, path: string[], value: any ) {\n\tconst length = path.length;\n\tconst lastIndex = length - 1;\n\tfor ( let i = 0; i < length; i++ ) {\n\t\tlet key = path[ i ];\n\n\t\tif ( ! key && Array.isArray( object ) ) {\n\t\t\t// If key is empty string and next value is array, derive key from\n\t\t\t// the current length of the array.\n\t\t\tkey = object.length.toString();\n\t\t}\n\n\t\tkey = [ '__proto__', 'constructor', 'prototype' ].includes( key )\n\t\t\t? key.toUpperCase()\n\t\t\t: key;\n\n\t\t// If the next key in the path is numeric (or empty string), it will be\n\t\t// created as an array. Otherwise, it will be created as an object.\n\t\tconst isNextKeyArrayIndex = ! isNaN( Number( path[ i + 1 ] ) );\n\n\t\tobject[ key ] =\n\t\t\ti === lastIndex\n\t\t\t\t? // If at end of path, assign the intended value.\n\t\t\t\t value\n\t\t\t\t: // Otherwise, advance to the next object in the path, creating\n\t\t\t\t // it if it does not yet exist.\n\t\t\t\t object[ key ] || ( isNextKeyArrayIndex ? [] : {} );\n\n\t\tif ( Array.isArray( object[ key ] ) && ! isNextKeyArrayIndex ) {\n\t\t\t// If we current key is non-numeric, but the next value is an\n\t\t\t// array, coerce the value to an object.\n\t\t\tobject[ key ] = { ...object[ key ] };\n\t\t}\n\n\t\t// Update working reference object to the next in the path.\n\t\tobject = object[ key ];\n\t}\n}\n\n/**\n * Returns an object of query arguments of the given URL. If the given URL is\n * invalid or has no querystring, an empty object is returned.\n *\n * @param url URL.\n *\n * @example\n * ```js\n * const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' );\n * // { \"foo\": \"bar\", \"bar\": \"baz\" }\n * ```\n *\n * @return Query args object.\n */\nexport function getQueryArgs( url: string ): QueryArgs {\n\treturn (\n\t\t( getQueryString( url ) || '' )\n\t\t\t// Normalize space encoding, accounting for PHP URL encoding\n\t\t\t// corresponding to `application/x-www-form-urlencoded`.\n\t\t\t//\n\t\t\t// See: https://tools.ietf.org/html/rfc1866#section-8.2.1\n\t\t\t.replace( /\\+/g, '%20' )\n\t\t\t.split( '&' )\n\t\t\t.reduce( ( accumulator, keyValue ) => {\n\t\t\t\tconst [ key, value = '' ] = keyValue\n\t\t\t\t\t.split( '=' )\n\t\t\t\t\t// Filtering avoids decoding as `undefined` for value, where\n\t\t\t\t\t// default is restored in destructuring assignment.\n\t\t\t\t\t.filter( Boolean )\n\t\t\t\t\t.map( safeDecodeURIComponent );\n\n\t\t\t\tif ( key ) {\n\t\t\t\t\tconst segments = key.replace( /\\]/g, '' ).split( '[' );\n\t\t\t\t\tsetPath( accumulator, segments, value );\n\t\t\t\t}\n\n\t\t\t\treturn accumulator;\n\t\t\t}, Object.create( null ) )\n\t);\n}\n"],
5
- "mappings": "AAGA,SAAS,8BAA8B;AACvC,SAAS,sBAAsB;AAa/B,SAAS,QAAS,QAA+B,MAAgB,OAAa;AAC7E,QAAM,SAAS,KAAK;AACpB,QAAM,YAAY,SAAS;AAC3B,WAAU,IAAI,GAAG,IAAI,QAAQ,KAAM;AAClC,QAAI,MAAM,KAAM,CAAE;AAElB,QAAK,CAAE,OAAO,MAAM,QAAS,MAAO,GAAI;AAGvC,YAAM,OAAO,OAAO,SAAS;AAAA,IAC9B;AAEA,UAAM,CAAE,aAAa,eAAe,WAAY,EAAE,SAAU,GAAI,IAC7D,IAAI,YAAY,IAChB;AAIH,UAAM,sBAAsB,CAAE,MAAO,OAAQ,KAAM,IAAI,CAAE,CAAE,CAAE;AAE7D,WAAQ,GAAI,IACX,MAAM;AAAA;AAAA,MAEH;AAAA;AAAA;AAAA;AAAA,MAGA,OAAQ,GAAI,MAAO,sBAAsB,CAAC,IAAI,CAAC;AAAA;AAEnD,QAAK,MAAM,QAAS,OAAQ,GAAI,CAAE,KAAK,CAAE,qBAAsB;AAG9D,aAAQ,GAAI,IAAI,EAAE,GAAG,OAAQ,GAAI,EAAE;AAAA,IACpC;AAGA,aAAS,OAAQ,GAAI;AAAA,EACtB;AACD;AAgBO,SAAS,aAAc,KAAyB;AACtD,UACG,eAAgB,GAAI,KAAK,IAKzB,QAAS,OAAO,KAAM,EACtB,MAAO,GAAI,EACX,OAAQ,CAAE,aAAa,aAAc;AACrC,UAAM,CAAE,KAAK,QAAQ,EAAG,IAAI,SAC1B,MAAO,GAAI,EAGX,OAAQ,OAAQ,EAChB,IAAK,sBAAuB;AAE9B,QAAK,KAAM;AACV,YAAM,WAAW,IAAI,QAAS,OAAO,EAAG,EAAE,MAAO,GAAI;AACrD,cAAS,aAAa,UAAU,KAAM;AAAA,IACvC;AAEA,WAAO;AAAA,EACR,GAAG,uBAAO,OAAQ,IAAK,CAAE;AAE5B;",
5
+ "mappings": ";AAGA,SAAS,8BAA8B;AACvC,SAAS,sBAAsB;AAa/B,SAAS,QAAS,QAA+B,MAAgB,OAAa;AAC7E,QAAM,SAAS,KAAK;AACpB,QAAM,YAAY,SAAS;AAC3B,WAAU,IAAI,GAAG,IAAI,QAAQ,KAAM;AAClC,QAAI,MAAM,KAAM,CAAE;AAElB,QAAK,CAAE,OAAO,MAAM,QAAS,MAAO,GAAI;AAGvC,YAAM,OAAO,OAAO,SAAS;AAAA,IAC9B;AAEA,UAAM,CAAE,aAAa,eAAe,WAAY,EAAE,SAAU,GAAI,IAC7D,IAAI,YAAY,IAChB;AAIH,UAAM,sBAAsB,CAAE,MAAO,OAAQ,KAAM,IAAI,CAAE,CAAE,CAAE;AAE7D,WAAQ,GAAI,IACX,MAAM;AAAA;AAAA,MAEH;AAAA;AAAA;AAAA;AAAA,MAGA,OAAQ,GAAI,MAAO,sBAAsB,CAAC,IAAI,CAAC;AAAA;AAEnD,QAAK,MAAM,QAAS,OAAQ,GAAI,CAAE,KAAK,CAAE,qBAAsB;AAG9D,aAAQ,GAAI,IAAI,EAAE,GAAG,OAAQ,GAAI,EAAE;AAAA,IACpC;AAGA,aAAS,OAAQ,GAAI;AAAA,EACtB;AACD;AAgBO,SAAS,aAAc,KAAyB;AACtD,UACG,eAAgB,GAAI,KAAK,IAKzB,QAAS,OAAO,KAAM,EACtB,MAAO,GAAI,EACX,OAAQ,CAAE,aAAa,aAAc;AACrC,UAAM,CAAE,KAAK,QAAQ,EAAG,IAAI,SAC1B,MAAO,GAAI,EAGX,OAAQ,OAAQ,EAChB,IAAK,sBAAuB;AAE9B,QAAK,KAAM;AACV,YAAM,WAAW,IAAI,QAAS,OAAO,EAAG,EAAE,MAAO,GAAI;AACrD,cAAS,aAAa,UAAU,KAAM;AAAA,IACvC;AAEA,WAAO;AAAA,EACR,GAAG,uBAAO,OAAQ,IAAK,CAAE;AAE5B;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/get-query-string.ts
1
2
  function getQueryString(url) {
2
3
  let query;
3
4
  try {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/get-query-string.ts"],
4
4
  "sourcesContent": ["/**\n * Returns the query string part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const queryString = getQueryString( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // 'query=true'\n * ```\n *\n * @return The query string part of the URL.\n */\nexport function getQueryString( url: string ): string | void {\n\tlet query;\n\ttry {\n\t\tquery = new URL( url, 'http://example.com' ).search.substring( 1 );\n\t} catch ( error ) {}\n\n\tif ( query ) {\n\t\treturn query;\n\t}\n}\n"],
5
- "mappings": "AAYO,SAAS,eAAgB,KAA6B;AAC5D,MAAI;AACJ,MAAI;AACH,YAAQ,IAAI,IAAK,KAAK,oBAAqB,EAAE,OAAO,UAAW,CAAE;AAAA,EAClE,SAAU,OAAQ;AAAA,EAAC;AAEnB,MAAK,OAAQ;AACZ,WAAO;AAAA,EACR;AACD;",
5
+ "mappings": ";AAYO,SAAS,eAAgB,KAA6B;AAC5D,MAAI;AACJ,MAAI;AACH,YAAQ,IAAI,IAAK,KAAK,oBAAqB,EAAE,OAAO,UAAW,CAAE;AAAA,EAClE,SAAU,OAAQ;AAAA,EAAC;AAEnB,MAAK,OAAQ;AACZ,WAAO;AAAA,EACR;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/has-query-arg.ts
1
2
  import { getQueryArg } from "./get-query-arg";
2
3
  function hasQueryArg(url, arg) {
3
4
  return getQueryArg(url, arg) !== void 0;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/has-query-arg.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { getQueryArg } from './get-query-arg';\n\n/**\n * Determines whether the URL contains a given query arg.\n *\n * @param url URL.\n * @param arg Query arg name.\n *\n * @example\n * ```js\n * const hasBar = hasQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'bar' ); // true\n * ```\n *\n * @return Whether or not the URL contains the query arg.\n */\nexport function hasQueryArg( url: string, arg: string ): boolean {\n\treturn getQueryArg( url, arg ) !== undefined;\n}\n"],
5
- "mappings": "AAGA,SAAS,mBAAmB;AAerB,SAAS,YAAa,KAAa,KAAuB;AAChE,SAAO,YAAa,KAAK,GAAI,MAAM;AACpC;",
5
+ "mappings": ";AAGA,SAAS,mBAAmB;AAerB,SAAS,YAAa,KAAa,KAAuB;AAChE,SAAO,YAAa,KAAK,GAAI,MAAM;AACpC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/index.ts
1
2
  import { isURL } from "./is-url";
2
3
  import { isEmail } from "./is-email";
3
4
  import { isPhoneNumber } from "./is-phone-number";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
4
  "sourcesContent": ["export { isURL } from './is-url';\nexport { isEmail } from './is-email';\nexport { isPhoneNumber } from './is-phone-number';\nexport { getProtocol } from './get-protocol';\nexport { isValidProtocol } from './is-valid-protocol';\nexport { getAuthority } from './get-authority';\nexport { isValidAuthority } from './is-valid-authority';\nexport { getPath } from './get-path';\nexport { isValidPath } from './is-valid-path';\nexport { getQueryString } from './get-query-string';\nexport { buildQueryString } from './build-query-string';\nexport { isValidQueryString } from './is-valid-query-string';\nexport { getPathAndQueryString } from './get-path-and-query-string';\nexport { getFragment } from './get-fragment';\nexport { isValidFragment } from './is-valid-fragment';\nexport { addQueryArgs } from './add-query-args';\nexport { getQueryArg } from './get-query-arg';\nexport { getQueryArgs } from './get-query-args';\nexport { hasQueryArg } from './has-query-arg';\nexport { removeQueryArgs } from './remove-query-args';\nexport { prependHTTP } from './prepend-http';\nexport { safeDecodeURI } from './safe-decode-uri';\nexport { safeDecodeURIComponent } from './safe-decode-uri-component';\nexport { filterURLForDisplay } from './filter-url-for-display';\nexport { cleanForSlug } from './clean-for-slug';\nexport { getFilename } from './get-filename';\nexport { normalizePath } from './normalize-path';\nexport { prependHTTPS } from './prepend-https';\n"],
5
- "mappings": "AAAA,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AACvC,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;",
5
+ "mappings": ";AAAA,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AACvC,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
- const EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i;
1
+ // packages/url/src/is-email.ts
2
+ var EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i;
2
3
  function isEmail(email) {
3
4
  return EMAIL_REGEXP.test(email);
4
5
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/is-email.ts"],
4
4
  "sourcesContent": ["const EMAIL_REGEXP =\n\t/^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\\.[a-z]{2,63}$/i;\n\n/**\n * Determines whether the given string looks like an email.\n *\n * @param email The string to scrutinise.\n *\n * @example\n * ```js\n * const isEmail = isEmail( 'hello@wordpress.org' ); // true\n * ```\n *\n * @return Whether or not it looks like an email.\n */\nexport function isEmail( email: string ): boolean {\n\treturn EMAIL_REGEXP.test( email );\n}\n"],
5
- "mappings": "AAAA,MAAM,eACL;AAcM,SAAS,QAAS,OAAyB;AACjD,SAAO,aAAa,KAAM,KAAM;AACjC;",
5
+ "mappings": ";AAAA,IAAM,eACL;AAcM,SAAS,QAAS,OAAyB;AACjD,SAAO,aAAa,KAAM,KAAM;AACjC;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
- const PHONE_REGEXP = /^(tel:)?(\+)?\d{6,15}$/;
1
+ // packages/url/src/is-phone-number.ts
2
+ var PHONE_REGEXP = /^(tel:)?(\+)?\d{6,15}$/;
2
3
  function isPhoneNumber(phoneNumber) {
3
4
  phoneNumber = phoneNumber.replace(/[-.() ]/g, "");
4
5
  return PHONE_REGEXP.test(phoneNumber);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/is-phone-number.ts"],
4
4
  "sourcesContent": ["const PHONE_REGEXP = /^(tel:)?(\\+)?\\d{6,15}$/;\n\n/**\n * Determines whether the given string looks like a phone number.\n *\n * @param phoneNumber The string to scrutinize.\n *\n * @example\n * ```js\n * const isPhoneNumber = isPhoneNumber('+1 (555) 123-4567'); // true\n * ```\n *\n * @return Whether or not it looks like a phone number.\n */\nexport function isPhoneNumber( phoneNumber: string ): boolean {\n\t// Remove any separator from phone number.\n\tphoneNumber = phoneNumber.replace( /[-.() ]/g, '' );\n\treturn PHONE_REGEXP.test( phoneNumber );\n}\n"],
5
- "mappings": "AAAA,MAAM,eAAe;AAcd,SAAS,cAAe,aAA+B;AAE7D,gBAAc,YAAY,QAAS,YAAY,EAAG;AAClD,SAAO,aAAa,KAAM,WAAY;AACvC;",
5
+ "mappings": ";AAAA,IAAM,eAAe;AAcd,SAAS,cAAe,aAA+B;AAE7D,gBAAc,YAAY,QAAS,YAAY,EAAG;AAClD,SAAO,aAAa,KAAM,WAAY;AACvC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/is-url.ts
1
2
  function isURL(url) {
2
3
  try {
3
4
  new URL(url);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/is-url.ts"],
4
4
  "sourcesContent": ["/**\n * Determines whether the given string looks like a URL.\n *\n * @param url The string to scrutinise.\n *\n * @example\n * ```js\n * const isURL = isURL( 'https://wordpress.org' ); // true\n * ```\n *\n * @see https://url.spec.whatwg.org/\n * @see https://url.spec.whatwg.org/#valid-url-string\n *\n * @return Whether or not it looks like a URL.\n */\nexport function isURL( url: string ): boolean {\n\t// A URL can be considered value if the `URL` constructor is able to parse\n\t// it. The constructor throws an error for an invalid URL.\n\ttry {\n\t\tnew URL( url );\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n"],
5
- "mappings": "AAeO,SAAS,MAAO,KAAuB;AAG7C,MAAI;AACH,QAAI,IAAK,GAAI;AACb,WAAO;AAAA,EACR,QAAQ;AACP,WAAO;AAAA,EACR;AACD;",
5
+ "mappings": ";AAeO,SAAS,MAAO,KAAuB;AAG7C,MAAI;AACH,QAAI,IAAK,GAAI;AACb,WAAO;AAAA,EACR,QAAQ;AACP,WAAO;AAAA,EACR;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/is-valid-authority.ts
1
2
  function isValidAuthority(authority) {
2
3
  if (!authority) {
3
4
  return false;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/is-valid-authority.ts"],
4
4
  "sourcesContent": ["/**\n * Checks for invalid characters within the provided authority.\n *\n * @param authority A string containing the URL authority.\n *\n * @example\n * ```js\n * const isValid = isValidAuthority( 'wordpress.org' ); // true\n * const isNotValid = isValidAuthority( 'wordpress#org' ); // false\n * ```\n *\n * @return True if the argument contains a valid authority.\n */\nexport function isValidAuthority( authority: string ): boolean {\n\tif ( ! authority ) {\n\t\treturn false;\n\t}\n\treturn /^[^\\s#?]+$/.test( authority );\n}\n"],
5
- "mappings": "AAaO,SAAS,iBAAkB,WAA6B;AAC9D,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AACA,SAAO,aAAa,KAAM,SAAU;AACrC;",
5
+ "mappings": ";AAaO,SAAS,iBAAkB,WAA6B;AAC9D,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AACA,SAAO,aAAa,KAAM,SAAU;AACrC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/is-valid-fragment.ts
1
2
  function isValidFragment(fragment) {
2
3
  if (!fragment) {
3
4
  return false;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/is-valid-fragment.ts"],
4
4
  "sourcesContent": ["/**\n * Checks for invalid characters within the provided fragment.\n *\n * @param fragment The url fragment.\n *\n * @example\n * ```js\n * const isValid = isValidFragment( '#valid-fragment' ); // true\n * const isNotValid = isValidFragment( '#invalid-#fragment' ); // false\n * ```\n *\n * @return True if the argument contains a valid fragment.\n */\nexport function isValidFragment( fragment: string ): boolean {\n\tif ( ! fragment ) {\n\t\treturn false;\n\t}\n\treturn /^#[^\\s#?\\/]*$/.test( fragment );\n}\n"],
5
- "mappings": "AAaO,SAAS,gBAAiB,UAA4B;AAC5D,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AACA,SAAO,gBAAgB,KAAM,QAAS;AACvC;",
5
+ "mappings": ";AAaO,SAAS,gBAAiB,UAA4B;AAC5D,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AACA,SAAO,gBAAgB,KAAM,QAAS;AACvC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/is-valid-path.ts
1
2
  function isValidPath(path) {
2
3
  if (!path) {
3
4
  return false;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/is-valid-path.ts"],
4
4
  "sourcesContent": ["/**\n * Checks for invalid characters within the provided path.\n *\n * @param path The URL path.\n *\n * @example\n * ```js\n * const isValid = isValidPath( 'test/path/' ); // true\n * const isNotValid = isValidPath( '/invalid?test/path/' ); // false\n * ```\n *\n * @return True if the argument contains a valid path\n */\nexport function isValidPath( path: string ): boolean {\n\tif ( ! path ) {\n\t\treturn false;\n\t}\n\treturn /^[^\\s#?]+$/.test( path );\n}\n"],
5
- "mappings": "AAaO,SAAS,YAAa,MAAwB;AACpD,MAAK,CAAE,MAAO;AACb,WAAO;AAAA,EACR;AACA,SAAO,aAAa,KAAM,IAAK;AAChC;",
5
+ "mappings": ";AAaO,SAAS,YAAa,MAAwB;AACpD,MAAK,CAAE,MAAO;AACb,WAAO;AAAA,EACR;AACA,SAAO,aAAa,KAAM,IAAK;AAChC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/is-valid-protocol.ts
1
2
  function isValidProtocol(protocol) {
2
3
  if (!protocol) {
3
4
  return false;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/is-valid-protocol.ts"],
4
4
  "sourcesContent": ["/**\n * Tests if a url protocol is valid.\n *\n * @param protocol The url protocol.\n *\n * @example\n * ```js\n * const isValid = isValidProtocol( 'https:' ); // true\n * const isNotValid = isValidProtocol( 'https :' ); // false\n * ```\n *\n * @return True if the argument is a valid protocol (e.g. http:, tel:).\n */\nexport function isValidProtocol( protocol: string ): boolean {\n\tif ( ! protocol ) {\n\t\treturn false;\n\t}\n\treturn /^[a-z\\-.\\+]+[0-9]*:$/i.test( protocol );\n}\n"],
5
- "mappings": "AAaO,SAAS,gBAAiB,UAA4B;AAC5D,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AACA,SAAO,wBAAwB,KAAM,QAAS;AAC/C;",
5
+ "mappings": ";AAaO,SAAS,gBAAiB,UAA4B;AAC5D,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AACA,SAAO,wBAAwB,KAAM,QAAS;AAC/C;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/is-valid-query-string.ts
1
2
  function isValidQueryString(queryString) {
2
3
  if (!queryString) {
3
4
  return false;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/is-valid-query-string.ts"],
4
4
  "sourcesContent": ["/**\n * Checks for invalid characters within the provided query string.\n *\n * @param queryString The query string.\n *\n * @example\n * ```js\n * const isValid = isValidQueryString( 'query=true&another=false' ); // true\n * const isNotValid = isValidQueryString( 'query=true?another=false' ); // false\n * ```\n *\n * @return True if the argument contains a valid query string.\n */\nexport function isValidQueryString( queryString: string ): boolean {\n\tif ( ! queryString ) {\n\t\treturn false;\n\t}\n\treturn /^[^\\s#?\\/]+$/.test( queryString );\n}\n"],
5
- "mappings": "AAaO,SAAS,mBAAoB,aAA+B;AAClE,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AACA,SAAO,eAAe,KAAM,WAAY;AACzC;",
5
+ "mappings": ";AAaO,SAAS,mBAAoB,aAA+B;AAClE,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AACA,SAAO,eAAe,KAAM,WAAY;AACzC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/normalize-path.ts
1
2
  function normalizePath(path) {
2
3
  const split = path.split("?");
3
4
  const query = split[1];
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/normalize-path.ts"],
4
4
  "sourcesContent": ["/**\n * Given a path, returns a normalized path where equal query parameter values\n * will be treated as identical, regardless of order they appear in the original\n * text.\n *\n * @param path Original path.\n *\n * @return Normalized path.\n */\nexport function normalizePath( path: string ): string {\n\tconst split = path.split( '?' );\n\tconst query = split[ 1 ];\n\tconst base = split[ 0 ];\n\tif ( ! query ) {\n\t\treturn base;\n\t}\n\n\t// 'b=1%2C2&c=2&a=5'\n\treturn (\n\t\tbase +\n\t\t'?' +\n\t\tquery\n\t\t\t// [ 'b=1%2C2', 'c=2', 'a=5' ]\n\t\t\t.split( '&' )\n\t\t\t// [ [ 'b, '1%2C2' ], [ 'c', '2' ], [ 'a', '5' ] ]\n\t\t\t.map( ( entry ) => entry.split( '=' ) )\n\t\t\t// [ [ 'b', '1,2' ], [ 'c', '2' ], [ 'a', '5' ] ]\n\t\t\t.map( ( pair ) => pair.map( decodeURIComponent ) )\n\t\t\t// [ [ 'a', '5' ], [ 'b, '1,2' ], [ 'c', '2' ] ]\n\t\t\t.sort( ( a, b ) => a[ 0 ].localeCompare( b[ 0 ] ) )\n\t\t\t// [ [ 'a', '5' ], [ 'b, '1%2C2' ], [ 'c', '2' ] ]\n\t\t\t.map( ( pair ) => pair.map( encodeURIComponent ) )\n\t\t\t// [ 'a=5', 'b=1%2C2', 'c=2' ]\n\t\t\t.map( ( pair ) => pair.join( '=' ) )\n\t\t\t// 'a=5&b=1%2C2&c=2'\n\t\t\t.join( '&' )\n\t);\n}\n"],
5
- "mappings": "AASO,SAAS,cAAe,MAAuB;AACrD,QAAM,QAAQ,KAAK,MAAO,GAAI;AAC9B,QAAM,QAAQ,MAAO,CAAE;AACvB,QAAM,OAAO,MAAO,CAAE;AACtB,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AAGA,SACC,OACA,MACA,MAEE,MAAO,GAAI,EAEX,IAAK,CAAE,UAAW,MAAM,MAAO,GAAI,CAAE,EAErC,IAAK,CAAE,SAAU,KAAK,IAAK,kBAAmB,CAAE,EAEhD,KAAM,CAAE,GAAG,MAAO,EAAG,CAAE,EAAE,cAAe,EAAG,CAAE,CAAE,CAAE,EAEjD,IAAK,CAAE,SAAU,KAAK,IAAK,kBAAmB,CAAE,EAEhD,IAAK,CAAE,SAAU,KAAK,KAAM,GAAI,CAAE,EAElC,KAAM,GAAI;AAEd;",
5
+ "mappings": ";AASO,SAAS,cAAe,MAAuB;AACrD,QAAM,QAAQ,KAAK,MAAO,GAAI;AAC9B,QAAM,QAAQ,MAAO,CAAE;AACvB,QAAM,OAAO,MAAO,CAAE;AACtB,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AAGA,SACC,OACA,MACA,MAEE,MAAO,GAAI,EAEX,IAAK,CAAE,UAAW,MAAM,MAAO,GAAI,CAAE,EAErC,IAAK,CAAE,SAAU,KAAK,IAAK,kBAAmB,CAAE,EAEhD,KAAM,CAAE,GAAG,MAAO,EAAG,CAAE,EAAE,cAAe,EAAG,CAAE,CAAE,CAAE,EAEjD,IAAK,CAAE,SAAU,KAAK,IAAK,kBAAmB,CAAE,EAEhD,IAAK,CAAE,SAAU,KAAK,KAAM,GAAI,CAAE,EAElC,KAAM,GAAI;AAEd;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
+ // packages/url/src/prepend-http.ts
1
2
  import { isEmail } from "./is-email";
2
- const USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i;
3
+ var USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i;
3
4
  function prependHTTP(url) {
4
5
  if (!url) {
5
6
  return url;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/prepend-http.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { isEmail } from './is-email';\n\nconst USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\\?|\\.|\\/)/i;\n\n/**\n * Prepends \"http://\" to a url, if it looks like something that is meant to be a TLD.\n *\n * @param url The URL to test.\n *\n * @example\n * ```js\n * const actualURL = prependHTTP( 'wordpress.org' ); // http://wordpress.org\n * ```\n *\n * @return The updated URL.\n */\nexport function prependHTTP( url: string ): string {\n\tif ( ! url ) {\n\t\treturn url;\n\t}\n\n\turl = url.trim();\n\tif ( ! USABLE_HREF_REGEXP.test( url ) && ! isEmail( url ) ) {\n\t\treturn 'http://' + url;\n\t}\n\n\treturn url;\n}\n"],
5
- "mappings": "AAGA,SAAS,eAAe;AAExB,MAAM,qBAAqB;AAcpB,SAAS,YAAa,KAAsB;AAClD,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAEA,QAAM,IAAI,KAAK;AACf,MAAK,CAAE,mBAAmB,KAAM,GAAI,KAAK,CAAE,QAAS,GAAI,GAAI;AAC3D,WAAO,YAAY;AAAA,EACpB;AAEA,SAAO;AACR;",
5
+ "mappings": ";AAGA,SAAS,eAAe;AAExB,IAAM,qBAAqB;AAcpB,SAAS,YAAa,KAAsB;AAClD,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAEA,QAAM,IAAI,KAAK;AACf,MAAK,CAAE,mBAAmB,KAAM,GAAI,KAAK,CAAE,QAAS,GAAI,GAAI;AAC3D,WAAO,YAAY;AAAA,EACpB;AAEA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/prepend-https.ts
1
2
  import { prependHTTP } from "./prepend-http";
2
3
  function prependHTTPS(url) {
3
4
  if (!url) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/prepend-https.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { prependHTTP } from './prepend-http';\n\n/**\n * Prepends \"https://\" to a url, if it looks like something that is meant to be a TLD.\n *\n * Note: this will not replace \"http://\" with \"https://\".\n *\n * @param url The URL to test.\n *\n * @example\n * ```js\n * const actualURL = prependHTTPS( 'wordpress.org' ); // https://wordpress.org\n * ```\n *\n * @return The updated URL.\n */\nexport function prependHTTPS( url: string ): string {\n\tif ( ! url ) {\n\t\treturn url;\n\t}\n\n\t// If url starts with http://, return it as is.\n\tif ( url.startsWith( 'http://' ) ) {\n\t\treturn url;\n\t}\n\n\turl = prependHTTP( url );\n\n\treturn url.replace( /^http:/, 'https:' );\n}\n"],
5
- "mappings": "AAGA,SAAS,mBAAmB;AAgBrB,SAAS,aAAc,KAAsB;AACnD,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAGA,MAAK,IAAI,WAAY,SAAU,GAAI;AAClC,WAAO;AAAA,EACR;AAEA,QAAM,YAAa,GAAI;AAEvB,SAAO,IAAI,QAAS,UAAU,QAAS;AACxC;",
5
+ "mappings": ";AAGA,SAAS,mBAAmB;AAgBrB,SAAS,aAAc,KAAsB;AACnD,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAGA,MAAK,IAAI,WAAY,SAAU,GAAI;AAClC,WAAO;AAAA,EACR;AAEA,QAAM,YAAa,GAAI;AAEvB,SAAO,IAAI,QAAS,UAAU,QAAS;AACxC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/remove-query-args.ts
1
2
  import { getQueryArgs } from "./get-query-args";
2
3
  import { buildQueryString } from "./build-query-string";
3
4
  function removeQueryArgs(url, ...args) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/remove-query-args.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { getQueryArgs } from './get-query-args';\nimport { buildQueryString } from './build-query-string';\n\n/**\n * Removes arguments from the query string of the url\n *\n * @param url URL.\n * @param args Query Args.\n *\n * @example\n * ```js\n * const newUrl = removeQueryArgs( 'https://wordpress.org?foo=bar&bar=baz&baz=foobar', 'foo', 'bar' ); // https://wordpress.org?baz=foobar\n * ```\n *\n * @return Updated URL.\n */\nexport function removeQueryArgs( url: string, ...args: string[] ): string {\n\tconst fragment = url.replace( /^[^#]*/, '' );\n\turl = url.replace( /#.*/, '' );\n\n\tconst queryStringIndex = url.indexOf( '?' );\n\tif ( queryStringIndex === -1 ) {\n\t\treturn url + fragment;\n\t}\n\n\tconst query = getQueryArgs( url );\n\tconst baseURL = url.substr( 0, queryStringIndex );\n\targs.forEach( ( arg ) => delete query[ arg ] );\n\tconst queryString = buildQueryString( query );\n\tconst updatedUrl = queryString ? baseURL + '?' + queryString : baseURL;\n\treturn updatedUrl + fragment;\n}\n"],
5
- "mappings": "AAGA,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAe1B,SAAS,gBAAiB,QAAgB,MAAyB;AACzE,QAAM,WAAW,IAAI,QAAS,UAAU,EAAG;AAC3C,QAAM,IAAI,QAAS,OAAO,EAAG;AAE7B,QAAM,mBAAmB,IAAI,QAAS,GAAI;AAC1C,MAAK,qBAAqB,IAAK;AAC9B,WAAO,MAAM;AAAA,EACd;AAEA,QAAM,QAAQ,aAAc,GAAI;AAChC,QAAM,UAAU,IAAI,OAAQ,GAAG,gBAAiB;AAChD,OAAK,QAAS,CAAE,QAAS,OAAO,MAAO,GAAI,CAAE;AAC7C,QAAM,cAAc,iBAAkB,KAAM;AAC5C,QAAM,aAAa,cAAc,UAAU,MAAM,cAAc;AAC/D,SAAO,aAAa;AACrB;",
5
+ "mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAe1B,SAAS,gBAAiB,QAAgB,MAAyB;AACzE,QAAM,WAAW,IAAI,QAAS,UAAU,EAAG;AAC3C,QAAM,IAAI,QAAS,OAAO,EAAG;AAE7B,QAAM,mBAAmB,IAAI,QAAS,GAAI;AAC1C,MAAK,qBAAqB,IAAK;AAC9B,WAAO,MAAM;AAAA,EACd;AAEA,QAAM,QAAQ,aAAc,GAAI;AAChC,QAAM,UAAU,IAAI,OAAQ,GAAG,gBAAiB;AAChD,OAAK,QAAS,CAAE,QAAS,OAAO,MAAO,GAAI,CAAE;AAC7C,QAAM,cAAc,iBAAkB,KAAM;AAC5C,QAAM,aAAa,cAAc,UAAU,MAAM,cAAc;AAC/D,SAAO,aAAa;AACrB;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/safe-decode-uri-component.ts
1
2
  function safeDecodeURIComponent(uriComponent) {
2
3
  try {
3
4
  return decodeURIComponent(uriComponent);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/safe-decode-uri-component.ts"],
4
4
  "sourcesContent": ["/**\n * Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if\n * `decodeURIComponent` throws an error.\n *\n * @param uriComponent URI component to decode.\n *\n * @return Decoded URI component if possible.\n */\nexport function safeDecodeURIComponent( uriComponent: string ): string {\n\ttry {\n\t\treturn decodeURIComponent( uriComponent );\n\t} catch ( uriComponentError ) {\n\t\treturn uriComponent;\n\t}\n}\n"],
5
- "mappings": "AAQO,SAAS,uBAAwB,cAA+B;AACtE,MAAI;AACH,WAAO,mBAAoB,YAAa;AAAA,EACzC,SAAU,mBAAoB;AAC7B,WAAO;AAAA,EACR;AACD;",
5
+ "mappings": ";AAQO,SAAS,uBAAwB,cAA+B;AACtE,MAAI;AACH,WAAO,mBAAoB,YAAa;AAAA,EACzC,SAAU,mBAAoB;AAC7B,WAAO;AAAA,EACR;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/url/src/safe-decode-uri.ts
1
2
  function safeDecodeURI(uri) {
2
3
  try {
3
4
  return decodeURI(uri);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/safe-decode-uri.ts"],
4
4
  "sourcesContent": ["/**\n * Safely decodes a URI with `decodeURI`. Returns the URI unmodified if\n * `decodeURI` throws an error.\n *\n * @param uri URI to decode.\n *\n * @example\n * ```js\n * const badUri = safeDecodeURI( '%z' ); // does not throw an Error, simply returns '%z'\n * ```\n *\n * @return Decoded URI if possible.\n */\nexport function safeDecodeURI( uri: string ): string {\n\ttry {\n\t\treturn decodeURI( uri );\n\t} catch ( uriError ) {\n\t\treturn uri;\n\t}\n}\n"],
5
- "mappings": "AAaO,SAAS,cAAe,KAAsB;AACpD,MAAI;AACH,WAAO,UAAW,GAAI;AAAA,EACvB,SAAU,UAAW;AACpB,WAAO;AAAA,EACR;AACD;",
5
+ "mappings": ";AAaO,SAAS,cAAe,KAAsB;AACpD,MAAI;AACH,WAAO,UAAW,GAAI;AAAA,EACvB,SAAU,UAAW;AACpB,WAAO;AAAA,EACR;AACD;",
6
6
  "names": []
7
7
  }