@wordpress/url 4.32.0 → 4.32.1-next.b8c8708f3.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 +35 -40
  2. package/build/add-query-args.js.map +7 -1
  3. package/build/build-query-string.js +30 -43
  4. package/build/build-query-string.js.map +7 -1
  5. package/build/clean-for-slug.js +39 -43
  6. package/build/clean-for-slug.js.map +7 -1
  7. package/build/filter-url-for-display.js +39 -39
  8. package/build/filter-url-for-display.js.map +7 -1
  9. package/build/get-authority.js +29 -19
  10. package/build/get-authority.js.map +7 -1
  11. package/build/get-filename.js +29 -21
  12. package/build/get-filename.js.map +7 -1
  13. package/build/get-fragment.js +26 -18
  14. package/build/get-fragment.js.map +7 -1
  15. package/build/get-path-and-query-string.js +30 -26
  16. package/build/get-path-and-query-string.js.map +7 -1
  17. package/build/get-path.js +26 -18
  18. package/build/get-path.js.map +7 -1
  19. package/build/get-protocol.js +26 -18
  20. package/build/get-protocol.js.map +7 -1
  21. package/build/get-query-arg.js +28 -24
  22. package/build/get-query-arg.js.map +7 -1
  23. package/build/get-query-args.js +42 -65
  24. package/build/get-query-args.js.map +7 -1
  25. package/build/get-query-string.js +29 -20
  26. package/build/get-query-string.js.map +7 -1
  27. package/build/has-query-arg.js +28 -24
  28. package/build/has-query-arg.js.map +7 -1
  29. package/build/index.js +109 -201
  30. package/build/index.js.map +7 -1
  31. package/build/is-email.js +26 -18
  32. package/build/is-email.js.map +7 -1
  33. package/build/is-phone-number.js +27 -20
  34. package/build/is-phone-number.js.map +7 -1
  35. package/build/is-url.js +26 -23
  36. package/build/is-url.js.map +7 -1
  37. package/build/is-valid-authority.js +26 -18
  38. package/build/is-valid-authority.js.map +7 -1
  39. package/build/is-valid-fragment.js +26 -18
  40. package/build/is-valid-fragment.js.map +7 -1
  41. package/build/is-valid-path.js +26 -18
  42. package/build/is-valid-path.js.map +7 -1
  43. package/build/is-valid-protocol.js +26 -18
  44. package/build/is-valid-protocol.js.map +7 -1
  45. package/build/is-valid-query-string.js +26 -18
  46. package/build/is-valid-query-string.js.map +7 -1
  47. package/build/normalize-path.js +28 -32
  48. package/build/normalize-path.js.map +7 -1
  49. package/build/prepend-http.js +29 -25
  50. package/build/prepend-http.js.map +7 -1
  51. package/build/prepend-https.js +30 -29
  52. package/build/prepend-https.js.map +7 -1
  53. package/build/remove-query-args.js +35 -31
  54. package/build/remove-query-args.js.map +7 -1
  55. package/build/safe-decode-uri-component.js +26 -13
  56. package/build/safe-decode-uri-component.js.map +7 -1
  57. package/build/safe-decode-uri.js +26 -18
  58. package/build/safe-decode-uri.js.map +7 -1
  59. package/build-module/add-query-args.js +12 -35
  60. package/build-module/add-query-args.js.map +7 -1
  61. package/build-module/build-query-string.js +9 -40
  62. package/build-module/build-query-string.js.map +7 -1
  63. package/build-module/clean-for-slug.js +8 -39
  64. package/build-module/clean-for-slug.js.map +7 -1
  65. package/build-module/filter-url-for-display.js +18 -36
  66. package/build-module/filter-url-for-display.js.map +7 -1
  67. package/build-module/get-authority.js +8 -16
  68. package/build-module/get-authority.js.map +7 -1
  69. package/build-module/get-filename.js +8 -18
  70. package/build-module/get-filename.js.map +7 -1
  71. package/build-module/get-fragment.js +5 -15
  72. package/build-module/get-fragment.js.map +7 -1
  73. package/build-module/get-path-and-query-string.js +7 -21
  74. package/build-module/get-path-and-query-string.js.map +7 -1
  75. package/build-module/get-path.js +5 -15
  76. package/build-module/get-path.js.map +7 -1
  77. package/build-module/get-protocol.js +5 -15
  78. package/build-module/get-protocol.js.map +7 -1
  79. package/build-module/get-query-arg.js +6 -19
  80. package/build-module/get-query-arg.js.map +7 -1
  81. package/build-module/get-query-args.js +21 -61
  82. package/build-module/get-query-args.js.map +7 -1
  83. package/build-module/get-query-string.js +8 -17
  84. package/build-module/get-query-string.js.map +7 -1
  85. package/build-module/has-query-arg.js +7 -21
  86. package/build-module/has-query-arg.js.map +7 -1
  87. package/build-module/index.js +59 -29
  88. package/build-module/index.js.map +7 -1
  89. package/build-module/is-email.js +5 -15
  90. package/build-module/is-email.js.map +7 -1
  91. package/build-module/is-phone-number.js +6 -17
  92. package/build-module/is-phone-number.js.map +7 -1
  93. package/build-module/is-url.js +5 -20
  94. package/build-module/is-url.js.map +7 -1
  95. package/build-module/is-valid-authority.js +5 -15
  96. package/build-module/is-valid-authority.js.map +7 -1
  97. package/build-module/is-valid-fragment.js +5 -15
  98. package/build-module/is-valid-fragment.js.map +7 -1
  99. package/build-module/is-valid-path.js +5 -15
  100. package/build-module/is-valid-path.js.map +7 -1
  101. package/build-module/is-valid-protocol.js +5 -15
  102. package/build-module/is-valid-protocol.js.map +7 -1
  103. package/build-module/is-valid-query-string.js +5 -15
  104. package/build-module/is-valid-query-string.js.map +7 -1
  105. package/build-module/normalize-path.js +7 -29
  106. package/build-module/normalize-path.js.map +7 -1
  107. package/build-module/prepend-http.js +7 -20
  108. package/build-module/prepend-http.js.map +7 -1
  109. package/build-module/prepend-https.js +8 -25
  110. package/build-module/prepend-https.js.map +7 -1
  111. package/build-module/remove-query-args.js +12 -26
  112. package/build-module/remove-query-args.js.map +7 -1
  113. package/build-module/safe-decode-uri-component.js +5 -10
  114. package/build-module/safe-decode-uri-component.js.map +7 -1
  115. package/build-module/safe-decode-uri.js +5 -15
  116. package/build-module/safe-decode-uri.js.map +7 -1
  117. package/package.json +10 -3
@@ -1,20 +1,10 @@
1
- /**
2
- * Returns the protocol part of the URL.
3
- *
4
- * @param url The full URL.
5
- *
6
- * @example
7
- * ```js
8
- * const protocol1 = getProtocol( 'tel:012345678' ); // 'tel:'
9
- * const protocol2 = getProtocol( 'https://wordpress.org' ); // 'https:'
10
- * ```
11
- *
12
- * @return The protocol part of the URL.
13
- */
14
- export function getProtocol(url) {
1
+ function getProtocol(url) {
15
2
  const matches = /^([^\s:]+:)/.exec(url);
16
3
  if (matches) {
17
4
  return matches[1];
18
5
  }
19
6
  }
20
- //# sourceMappingURL=get-protocol.js.map
7
+ export {
8
+ getProtocol
9
+ };
10
+ //# sourceMappingURL=get-protocol.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getProtocol","url","matches","exec"],"sources":["@wordpress/url/src/get-protocol.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,WAAWA,CAAEC,GAAW,EAAkB;EACzD,MAAMC,OAAO,GAAG,aAAa,CAACC,IAAI,CAAEF,GAAI,CAAC;EACzC,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/get-protocol.ts"],
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;",
6
+ "names": []
7
+ }
@@ -1,21 +1,8 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { getQueryArgs } from './get-query-args';
5
- /**
6
- * Returns a single query argument of the url
7
- *
8
- * @param url URL.
9
- * @param arg Query arg name.
10
- *
11
- * @example
12
- * ```js
13
- * const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar
14
- * ```
15
- *
16
- * @return Query arg value.
17
- */
18
- export function getQueryArg(url, arg) {
1
+ import { getQueryArgs } from "./get-query-args";
2
+ function getQueryArg(url, arg) {
19
3
  return getQueryArgs(url)[arg];
20
4
  }
21
- //# sourceMappingURL=get-query-arg.js.map
5
+ export {
6
+ getQueryArg
7
+ };
8
+ //# sourceMappingURL=get-query-arg.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getQueryArgs","getQueryArg","url","arg"],"sources":["@wordpress/url/src/get-query-arg.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,kBAAkB;AAQ/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAC1BC,GAAW,EACXC,GAAW,EACkB;EAC7B,OAAOH,YAAY,CAAEE,GAAI,CAAC,CAAEC,GAAG,CAAE;AAClC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/get-query-arg.ts"],
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;",
6
+ "names": []
7
+ }
@@ -1,80 +1,40 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { safeDecodeURIComponent } from './safe-decode-uri-component';
5
- import { getQueryString } from './get-query-string';
6
- /**
7
- * Sets a value in object deeply by a given array of path segments. Mutates the
8
- * object reference.
9
- *
10
- * @param object Object in which to assign.
11
- * @param path Path segment at which to set value.
12
- * @param value Value to set.
13
- */
1
+ import { safeDecodeURIComponent } from "./safe-decode-uri-component";
2
+ import { getQueryString } from "./get-query-string";
14
3
  function setPath(object, path, value) {
15
4
  const length = path.length;
16
5
  const lastIndex = length - 1;
17
6
  for (let i = 0; i < length; i++) {
18
7
  let key = path[i];
19
8
  if (!key && Array.isArray(object)) {
20
- // If key is empty string and next value is array, derive key from
21
- // the current length of the array.
22
9
  key = object.length.toString();
23
10
  }
24
- key = ['__proto__', 'constructor', 'prototype'].includes(key) ? key.toUpperCase() : key;
25
-
26
- // If the next key in the path is numeric (or empty string), it will be
27
- // created as an array. Otherwise, it will be created as an object.
11
+ key = ["__proto__", "constructor", "prototype"].includes(key) ? key.toUpperCase() : key;
28
12
  const isNextKeyArrayIndex = !isNaN(Number(path[i + 1]));
29
- object[key] = i === lastIndex ?
30
- // If at end of path, assign the intended value.
31
- value :
32
- // Otherwise, advance to the next object in the path, creating
33
- // it if it does not yet exist.
34
- object[key] || (isNextKeyArrayIndex ? [] : {});
13
+ object[key] = i === lastIndex ? (
14
+ // If at end of path, assign the intended value.
15
+ value
16
+ ) : (
17
+ // Otherwise, advance to the next object in the path, creating
18
+ // it if it does not yet exist.
19
+ object[key] || (isNextKeyArrayIndex ? [] : {})
20
+ );
35
21
  if (Array.isArray(object[key]) && !isNextKeyArrayIndex) {
36
- // If we current key is non-numeric, but the next value is an
37
- // array, coerce the value to an object.
38
- object[key] = {
39
- ...object[key]
40
- };
22
+ object[key] = { ...object[key] };
41
23
  }
42
-
43
- // Update working reference object to the next in the path.
44
24
  object = object[key];
45
25
  }
46
26
  }
47
-
48
- /**
49
- * Returns an object of query arguments of the given URL. If the given URL is
50
- * invalid or has no querystring, an empty object is returned.
51
- *
52
- * @param url URL.
53
- *
54
- * @example
55
- * ```js
56
- * const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' );
57
- * // { "foo": "bar", "bar": "baz" }
58
- * ```
59
- *
60
- * @return Query args object.
61
- */
62
- export function getQueryArgs(url) {
63
- return (getQueryString(url) || ''
64
- // Normalize space encoding, accounting for PHP URL encoding
65
- // corresponding to `application/x-www-form-urlencoded`.
66
- //
67
- // See: https://tools.ietf.org/html/rfc1866#section-8.2.1
68
- ).replace(/\+/g, '%20').split('&').reduce((accumulator, keyValue) => {
69
- const [key, value = ''] = keyValue.split('=')
70
- // Filtering avoids decoding as `undefined` for value, where
71
- // default is restored in destructuring assignment.
72
- .filter(Boolean).map(safeDecodeURIComponent);
27
+ function getQueryArgs(url) {
28
+ return (getQueryString(url) || "").replace(/\+/g, "%20").split("&").reduce((accumulator, keyValue) => {
29
+ const [key, value = ""] = keyValue.split("=").filter(Boolean).map(safeDecodeURIComponent);
73
30
  if (key) {
74
- const segments = key.replace(/\]/g, '').split('[');
31
+ const segments = key.replace(/\]/g, "").split("[");
75
32
  setPath(accumulator, segments, value);
76
33
  }
77
34
  return accumulator;
78
- }, Object.create(null));
35
+ }, /* @__PURE__ */ Object.create(null));
79
36
  }
80
- //# sourceMappingURL=get-query-args.js.map
37
+ export {
38
+ getQueryArgs
39
+ };
40
+ //# sourceMappingURL=get-query-args.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["safeDecodeURIComponent","getQueryString","setPath","object","path","value","length","lastIndex","i","key","Array","isArray","toString","includes","toUpperCase","isNextKeyArrayIndex","isNaN","Number","getQueryArgs","url","replace","split","reduce","accumulator","keyValue","filter","Boolean","map","segments","Object","create"],"sources":["@wordpress/url/src/get-query-args.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAsB,QAAQ,6BAA6B;AACpE,SAASC,cAAc,QAAQ,oBAAoB;AAKnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,OAAOA,CAAEC,MAA6B,EAAEC,IAAc,EAAEC,KAAU,EAAG;EAC7E,MAAMC,MAAM,GAAGF,IAAI,CAACE,MAAM;EAC1B,MAAMC,SAAS,GAAGD,MAAM,GAAG,CAAC;EAC5B,KAAM,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,MAAM,EAAEE,CAAC,EAAE,EAAG;IAClC,IAAIC,GAAG,GAAGL,IAAI,CAAEI,CAAC,CAAE;IAEnB,IAAK,CAAEC,GAAG,IAAIC,KAAK,CAACC,OAAO,CAAER,MAAO,CAAC,EAAG;MACvC;MACA;MACAM,GAAG,GAAGN,MAAM,CAACG,MAAM,CAACM,QAAQ,CAAC,CAAC;IAC/B;IAEAH,GAAG,GAAG,CAAE,WAAW,EAAE,aAAa,EAAE,WAAW,CAAE,CAACI,QAAQ,CAAEJ,GAAI,CAAC,GAC9DA,GAAG,CAACK,WAAW,CAAC,CAAC,GACjBL,GAAG;;IAEN;IACA;IACA,MAAMM,mBAAmB,GAAG,CAAEC,KAAK,CAAEC,MAAM,CAAEb,IAAI,CAAEI,CAAC,GAAG,CAAC,CAAG,CAAE,CAAC;IAE9DL,MAAM,CAAEM,GAAG,CAAE,GACZD,CAAC,KAAKD,SAAS;IACZ;IACAF,KAAK;IACL;IACA;IACAF,MAAM,CAAEM,GAAG,CAAE,KAAMM,mBAAmB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAE;IAEtD,IAAKL,KAAK,CAACC,OAAO,CAAER,MAAM,CAAEM,GAAG,CAAG,CAAC,IAAI,CAAEM,mBAAmB,EAAG;MAC9D;MACA;MACAZ,MAAM,CAAEM,GAAG,CAAE,GAAG;QAAE,GAAGN,MAAM,CAAEM,GAAG;MAAG,CAAC;IACrC;;IAEA;IACAN,MAAM,GAAGA,MAAM,CAAEM,GAAG,CAAE;EACvB;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASS,YAAYA,CAAEC,GAAW,EAAc;EACtD,OACC,CAAElB,cAAc,CAAEkB,GAAI,CAAC,IAAI;EAC1B;EACA;EACA;EACA;EAAA,EACCC,OAAO,CAAE,KAAK,EAAE,KAAM,CAAC,CACvBC,KAAK,CAAE,GAAI,CAAC,CACZC,MAAM,CAAE,CAAEC,WAAW,EAAEC,QAAQ,KAAM;IACrC,MAAM,CAAEf,GAAG,EAAEJ,KAAK,GAAG,EAAE,CAAE,GAAGmB,QAAQ,CAClCH,KAAK,CAAE,GAAI;IACZ;IACA;IAAA,CACCI,MAAM,CAAEC,OAAQ,CAAC,CACjBC,GAAG,CAAE3B,sBAAuB,CAAC;IAE/B,IAAKS,GAAG,EAAG;MACV,MAAMmB,QAAQ,GAAGnB,GAAG,CAACW,OAAO,CAAE,KAAK,EAAE,EAAG,CAAC,CAACC,KAAK,CAAE,GAAI,CAAC;MACtDnB,OAAO,CAAEqB,WAAW,EAAEK,QAAQ,EAAEvB,KAAM,CAAC;IACxC;IAEA,OAAOkB,WAAW;EACnB,CAAC,EAAEM,MAAM,CAACC,MAAM,CAAE,IAAK,CAAE,CAAC;AAE7B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/get-query-args.ts"],
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;",
6
+ "names": []
7
+ }
@@ -1,23 +1,14 @@
1
- /* wp:polyfill */
2
- /**
3
- * Returns the query string part of the URL.
4
- *
5
- * @param url The full URL.
6
- *
7
- * @example
8
- * ```js
9
- * const queryString = getQueryString( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // 'query=true'
10
- * ```
11
- *
12
- * @return The query string part of the URL.
13
- */
14
- export function getQueryString(url) {
1
+ function getQueryString(url) {
15
2
  let query;
16
3
  try {
17
- query = new URL(url, 'http://example.com').search.substring(1);
18
- } catch (error) {}
4
+ query = new URL(url, "http://example.com").search.substring(1);
5
+ } catch (error) {
6
+ }
19
7
  if (query) {
20
8
  return query;
21
9
  }
22
10
  }
23
- //# sourceMappingURL=get-query-string.js.map
11
+ export {
12
+ getQueryString
13
+ };
14
+ //# sourceMappingURL=get-query-string.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getQueryString","url","query","URL","search","substring","error"],"sources":["@wordpress/url/src/get-query-string.ts"],"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"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,cAAcA,CAAEC,GAAW,EAAkB;EAC5D,IAAIC,KAAK;EACT,IAAI;IACHA,KAAK,GAAG,IAAIC,GAAG,CAAEF,GAAG,EAAE,oBAAqB,CAAC,CAACG,MAAM,CAACC,SAAS,CAAE,CAAE,CAAC;EACnE,CAAC,CAAC,OAAQC,KAAK,EAAG,CAAC;EAEnB,IAAKJ,KAAK,EAAG;IACZ,OAAOA,KAAK;EACb;AACD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/get-query-string.ts"],
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;",
6
+ "names": []
7
+ }
@@ -1,22 +1,8 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { getQueryArg } from './get-query-arg';
5
-
6
- /**
7
- * Determines whether the URL contains a given query arg.
8
- *
9
- * @param url URL.
10
- * @param arg Query arg name.
11
- *
12
- * @example
13
- * ```js
14
- * const hasBar = hasQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'bar' ); // true
15
- * ```
16
- *
17
- * @return Whether or not the URL contains the query arg.
18
- */
19
- export function hasQueryArg(url, arg) {
20
- return getQueryArg(url, arg) !== undefined;
1
+ import { getQueryArg } from "./get-query-arg";
2
+ function hasQueryArg(url, arg) {
3
+ return getQueryArg(url, arg) !== void 0;
21
4
  }
22
- //# sourceMappingURL=has-query-arg.js.map
5
+ export {
6
+ hasQueryArg
7
+ };
8
+ //# sourceMappingURL=has-query-arg.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getQueryArg","hasQueryArg","url","arg","undefined"],"sources":["@wordpress/url/src/has-query-arg.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAEC,GAAW,EAAEC,GAAW,EAAY;EAChE,OAAOH,WAAW,CAAEE,GAAG,EAAEC,GAAI,CAAC,KAAKC,SAAS;AAC7C","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/has-query-arg.ts"],
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;",
6
+ "names": []
7
+ }
@@ -1,29 +1,59 @@
1
- export { isURL } from './is-url';
2
- export { isEmail } from './is-email';
3
- export { isPhoneNumber } from './is-phone-number';
4
- export { getProtocol } from './get-protocol';
5
- export { isValidProtocol } from './is-valid-protocol';
6
- export { getAuthority } from './get-authority';
7
- export { isValidAuthority } from './is-valid-authority';
8
- export { getPath } from './get-path';
9
- export { isValidPath } from './is-valid-path';
10
- export { getQueryString } from './get-query-string';
11
- export { buildQueryString } from './build-query-string';
12
- export { isValidQueryString } from './is-valid-query-string';
13
- export { getPathAndQueryString } from './get-path-and-query-string';
14
- export { getFragment } from './get-fragment';
15
- export { isValidFragment } from './is-valid-fragment';
16
- export { addQueryArgs } from './add-query-args';
17
- export { getQueryArg } from './get-query-arg';
18
- export { getQueryArgs } from './get-query-args';
19
- export { hasQueryArg } from './has-query-arg';
20
- export { removeQueryArgs } from './remove-query-args';
21
- export { prependHTTP } from './prepend-http';
22
- export { safeDecodeURI } from './safe-decode-uri';
23
- export { safeDecodeURIComponent } from './safe-decode-uri-component';
24
- export { filterURLForDisplay } from './filter-url-for-display';
25
- export { cleanForSlug } from './clean-for-slug';
26
- export { getFilename } from './get-filename';
27
- export { normalizePath } from './normalize-path';
28
- export { prependHTTPS } from './prepend-https';
29
- //# sourceMappingURL=index.js.map
1
+ import { isURL } from "./is-url";
2
+ import { isEmail } from "./is-email";
3
+ import { isPhoneNumber } from "./is-phone-number";
4
+ import { getProtocol } from "./get-protocol";
5
+ import { isValidProtocol } from "./is-valid-protocol";
6
+ import { getAuthority } from "./get-authority";
7
+ import { isValidAuthority } from "./is-valid-authority";
8
+ import { getPath } from "./get-path";
9
+ import { isValidPath } from "./is-valid-path";
10
+ import { getQueryString } from "./get-query-string";
11
+ import { buildQueryString } from "./build-query-string";
12
+ import { isValidQueryString } from "./is-valid-query-string";
13
+ import { getPathAndQueryString } from "./get-path-and-query-string";
14
+ import { getFragment } from "./get-fragment";
15
+ import { isValidFragment } from "./is-valid-fragment";
16
+ import { addQueryArgs } from "./add-query-args";
17
+ import { getQueryArg } from "./get-query-arg";
18
+ import { getQueryArgs } from "./get-query-args";
19
+ import { hasQueryArg } from "./has-query-arg";
20
+ import { removeQueryArgs } from "./remove-query-args";
21
+ import { prependHTTP } from "./prepend-http";
22
+ import { safeDecodeURI } from "./safe-decode-uri";
23
+ import { safeDecodeURIComponent } from "./safe-decode-uri-component";
24
+ import { filterURLForDisplay } from "./filter-url-for-display";
25
+ import { cleanForSlug } from "./clean-for-slug";
26
+ import { getFilename } from "./get-filename";
27
+ import { normalizePath } from "./normalize-path";
28
+ import { prependHTTPS } from "./prepend-https";
29
+ export {
30
+ addQueryArgs,
31
+ buildQueryString,
32
+ cleanForSlug,
33
+ filterURLForDisplay,
34
+ getAuthority,
35
+ getFilename,
36
+ getFragment,
37
+ getPath,
38
+ getPathAndQueryString,
39
+ getProtocol,
40
+ getQueryArg,
41
+ getQueryArgs,
42
+ getQueryString,
43
+ hasQueryArg,
44
+ isEmail,
45
+ isPhoneNumber,
46
+ isURL,
47
+ isValidAuthority,
48
+ isValidFragment,
49
+ isValidPath,
50
+ isValidProtocol,
51
+ isValidQueryString,
52
+ normalizePath,
53
+ prependHTTP,
54
+ prependHTTPS,
55
+ removeQueryArgs,
56
+ safeDecodeURI,
57
+ safeDecodeURIComponent
58
+ };
59
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isURL","isEmail","isPhoneNumber","getProtocol","isValidProtocol","getAuthority","isValidAuthority","getPath","isValidPath","getQueryString","buildQueryString","isValidQueryString","getPathAndQueryString","getFragment","isValidFragment","addQueryArgs","getQueryArg","getQueryArgs","hasQueryArg","removeQueryArgs","prependHTTP","safeDecodeURI","safeDecodeURIComponent","filterURLForDisplay","cleanForSlug","getFilename","normalizePath","prependHTTPS"],"sources":["@wordpress/url/src/index.ts"],"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"],"mappings":"AAAA,SAASA,KAAK,QAAQ,UAAU;AAChC,SAASC,OAAO,QAAQ,YAAY;AACpC,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,OAAO,QAAQ,YAAY;AACpC,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,sBAAsB,QAAQ,6BAA6B;AACpE,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,YAAY,QAAQ,iBAAiB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
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;",
6
+ "names": []
7
+ }
@@ -1,18 +1,8 @@
1
1
  const EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i;
2
-
3
- /**
4
- * Determines whether the given string looks like an email.
5
- *
6
- * @param email The string to scrutinise.
7
- *
8
- * @example
9
- * ```js
10
- * const isEmail = isEmail( 'hello@wordpress.org' ); // true
11
- * ```
12
- *
13
- * @return Whether or not it looks like an email.
14
- */
15
- export function isEmail(email) {
2
+ function isEmail(email) {
16
3
  return EMAIL_REGEXP.test(email);
17
4
  }
18
- //# sourceMappingURL=is-email.js.map
5
+ export {
6
+ isEmail
7
+ };
8
+ //# sourceMappingURL=is-email.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["EMAIL_REGEXP","isEmail","email","test"],"sources":["@wordpress/url/src/is-email.ts"],"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"],"mappings":"AAAA,MAAMA,YAAY,GACjB,8DAA8D;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CAAEC,KAAa,EAAY;EACjD,OAAOF,YAAY,CAACG,IAAI,CAAED,KAAM,CAAC;AAClC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/is-email.ts"],
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;",
6
+ "names": []
7
+ }
@@ -1,20 +1,9 @@
1
1
  const PHONE_REGEXP = /^(tel:)?(\+)?\d{6,15}$/;
2
-
3
- /**
4
- * Determines whether the given string looks like a phone number.
5
- *
6
- * @param phoneNumber The string to scrutinize.
7
- *
8
- * @example
9
- * ```js
10
- * const isPhoneNumber = isPhoneNumber('+1 (555) 123-4567'); // true
11
- * ```
12
- *
13
- * @return Whether or not it looks like a phone number.
14
- */
15
- export function isPhoneNumber(phoneNumber) {
16
- // Remove any separator from phone number.
17
- phoneNumber = phoneNumber.replace(/[-.() ]/g, '');
2
+ function isPhoneNumber(phoneNumber) {
3
+ phoneNumber = phoneNumber.replace(/[-.() ]/g, "");
18
4
  return PHONE_REGEXP.test(phoneNumber);
19
5
  }
20
- //# sourceMappingURL=is-phone-number.js.map
6
+ export {
7
+ isPhoneNumber
8
+ };
9
+ //# sourceMappingURL=is-phone-number.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["PHONE_REGEXP","isPhoneNumber","phoneNumber","replace","test"],"sources":["@wordpress/url/src/is-phone-number.ts"],"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"],"mappings":"AAAA,MAAMA,YAAY,GAAG,wBAAwB;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAEC,WAAmB,EAAY;EAC7D;EACAA,WAAW,GAAGA,WAAW,CAACC,OAAO,CAAE,UAAU,EAAE,EAAG,CAAC;EACnD,OAAOH,YAAY,CAACI,IAAI,CAAEF,WAAY,CAAC;AACxC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/is-phone-number.ts"],
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;",
6
+ "names": []
7
+ }
@@ -1,22 +1,4 @@
1
- /* wp:polyfill */
2
- /**
3
- * Determines whether the given string looks like a URL.
4
- *
5
- * @param url The string to scrutinise.
6
- *
7
- * @example
8
- * ```js
9
- * const isURL = isURL( 'https://wordpress.org' ); // true
10
- * ```
11
- *
12
- * @see https://url.spec.whatwg.org/
13
- * @see https://url.spec.whatwg.org/#valid-url-string
14
- *
15
- * @return Whether or not it looks like a URL.
16
- */
17
- export function isURL(url) {
18
- // A URL can be considered value if the `URL` constructor is able to parse
19
- // it. The constructor throws an error for an invalid URL.
1
+ function isURL(url) {
20
2
  try {
21
3
  new URL(url);
22
4
  return true;
@@ -24,4 +6,7 @@ export function isURL(url) {
24
6
  return false;
25
7
  }
26
8
  }
27
- //# sourceMappingURL=is-url.js.map
9
+ export {
10
+ isURL
11
+ };
12
+ //# sourceMappingURL=is-url.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isURL","url","URL"],"sources":["@wordpress/url/src/is-url.ts"],"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"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,KAAKA,CAAEC,GAAW,EAAY;EAC7C;EACA;EACA,IAAI;IACH,IAAIC,GAAG,CAAED,GAAI,CAAC;IACd,OAAO,IAAI;EACZ,CAAC,CAAC,MAAM;IACP,OAAO,KAAK;EACb;AACD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/is-url.ts"],
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;",
6
+ "names": []
7
+ }
@@ -1,20 +1,10 @@
1
- /**
2
- * Checks for invalid characters within the provided authority.
3
- *
4
- * @param authority A string containing the URL authority.
5
- *
6
- * @example
7
- * ```js
8
- * const isValid = isValidAuthority( 'wordpress.org' ); // true
9
- * const isNotValid = isValidAuthority( 'wordpress#org' ); // false
10
- * ```
11
- *
12
- * @return True if the argument contains a valid authority.
13
- */
14
- export function isValidAuthority(authority) {
1
+ function isValidAuthority(authority) {
15
2
  if (!authority) {
16
3
  return false;
17
4
  }
18
5
  return /^[^\s#?]+$/.test(authority);
19
6
  }
20
- //# sourceMappingURL=is-valid-authority.js.map
7
+ export {
8
+ isValidAuthority
9
+ };
10
+ //# sourceMappingURL=is-valid-authority.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isValidAuthority","authority","test"],"sources":["@wordpress/url/src/is-valid-authority.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,gBAAgBA,CAAEC,SAAiB,EAAY;EAC9D,IAAK,CAAEA,SAAS,EAAG;IAClB,OAAO,KAAK;EACb;EACA,OAAO,YAAY,CAACC,IAAI,CAAED,SAAU,CAAC;AACtC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/is-valid-authority.ts"],
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;",
6
+ "names": []
7
+ }
@@ -1,20 +1,10 @@
1
- /**
2
- * Checks for invalid characters within the provided fragment.
3
- *
4
- * @param fragment The url fragment.
5
- *
6
- * @example
7
- * ```js
8
- * const isValid = isValidFragment( '#valid-fragment' ); // true
9
- * const isNotValid = isValidFragment( '#invalid-#fragment' ); // false
10
- * ```
11
- *
12
- * @return True if the argument contains a valid fragment.
13
- */
14
- export function isValidFragment(fragment) {
1
+ function isValidFragment(fragment) {
15
2
  if (!fragment) {
16
3
  return false;
17
4
  }
18
5
  return /^#[^\s#?\/]*$/.test(fragment);
19
6
  }
20
- //# sourceMappingURL=is-valid-fragment.js.map
7
+ export {
8
+ isValidFragment
9
+ };
10
+ //# sourceMappingURL=is-valid-fragment.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isValidFragment","fragment","test"],"sources":["@wordpress/url/src/is-valid-fragment.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,eAAeA,CAAEC,QAAgB,EAAY;EAC5D,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA,OAAO,eAAe,CAACC,IAAI,CAAED,QAAS,CAAC;AACxC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/is-valid-fragment.ts"],
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;",
6
+ "names": []
7
+ }