@wordpress/url 4.26.0 → 4.27.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 (207) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +12 -12
  3. package/build/add-query-args.js +4 -4
  4. package/build/add-query-args.js.map +1 -1
  5. package/build/build-query-string.js +3 -3
  6. package/build/build-query-string.js.map +1 -1
  7. package/build/clean-for-slug.js +2 -2
  8. package/build/clean-for-slug.js.map +1 -1
  9. package/build/filter-url-for-display.js +3 -3
  10. package/build/filter-url-for-display.js.map +1 -1
  11. package/build/get-authority.js +2 -2
  12. package/build/get-authority.js.map +1 -1
  13. package/build/get-filename.js +2 -2
  14. package/build/get-filename.js.map +1 -1
  15. package/build/get-fragment.js +2 -2
  16. package/build/get-fragment.js.map +1 -1
  17. package/build/get-path-and-query-string.js +2 -2
  18. package/build/get-path-and-query-string.js.map +1 -1
  19. package/build/get-path.js +2 -2
  20. package/build/get-path.js.map +1 -1
  21. package/build/get-protocol.js +2 -2
  22. package/build/get-protocol.js.map +1 -1
  23. package/build/get-query-arg.js +3 -11
  24. package/build/get-query-arg.js.map +1 -1
  25. package/build/get-query-args.js +5 -11
  26. package/build/get-query-args.js.map +1 -1
  27. package/build/get-query-string.js +2 -2
  28. package/build/get-query-string.js.map +1 -1
  29. package/build/has-query-arg.js +3 -3
  30. package/build/has-query-arg.js.map +1 -1
  31. package/build/index.js.map +1 -1
  32. package/build/is-email.js +2 -2
  33. package/build/is-email.js.map +1 -1
  34. package/build/is-phone-number.js +2 -2
  35. package/build/is-phone-number.js.map +1 -1
  36. package/build/is-url.js +2 -2
  37. package/build/is-url.js.map +1 -1
  38. package/build/is-valid-authority.js +2 -2
  39. package/build/is-valid-authority.js.map +1 -1
  40. package/build/is-valid-fragment.js +2 -2
  41. package/build/is-valid-fragment.js.map +1 -1
  42. package/build/is-valid-path.js +2 -2
  43. package/build/is-valid-path.js.map +1 -1
  44. package/build/is-valid-protocol.js +2 -2
  45. package/build/is-valid-protocol.js.map +1 -1
  46. package/build/is-valid-query-string.js +2 -2
  47. package/build/is-valid-query-string.js.map +1 -1
  48. package/build/normalize-path.js +2 -2
  49. package/build/normalize-path.js.map +1 -1
  50. package/build/prepend-http.js +2 -2
  51. package/build/prepend-http.js.map +1 -1
  52. package/build/prepend-https.js +2 -2
  53. package/build/prepend-https.js.map +1 -1
  54. package/build/remove-query-args.js +3 -3
  55. package/build/remove-query-args.js.map +1 -1
  56. package/build/safe-decode-uri-component.js +2 -2
  57. package/build/safe-decode-uri-component.js.map +1 -1
  58. package/build/safe-decode-uri.js +2 -2
  59. package/build/safe-decode-uri.js.map +1 -1
  60. package/build-module/add-query-args.js +4 -4
  61. package/build-module/add-query-args.js.map +1 -1
  62. package/build-module/build-query-string.js +3 -3
  63. package/build-module/build-query-string.js.map +1 -1
  64. package/build-module/clean-for-slug.js +2 -2
  65. package/build-module/clean-for-slug.js.map +1 -1
  66. package/build-module/filter-url-for-display.js +3 -3
  67. package/build-module/filter-url-for-display.js.map +1 -1
  68. package/build-module/get-authority.js +2 -2
  69. package/build-module/get-authority.js.map +1 -1
  70. package/build-module/get-filename.js +2 -2
  71. package/build-module/get-filename.js.map +1 -1
  72. package/build-module/get-fragment.js +2 -2
  73. package/build-module/get-fragment.js.map +1 -1
  74. package/build-module/get-path-and-query-string.js +2 -2
  75. package/build-module/get-path-and-query-string.js.map +1 -1
  76. package/build-module/get-path.js +2 -2
  77. package/build-module/get-path.js.map +1 -1
  78. package/build-module/get-protocol.js +2 -2
  79. package/build-module/get-protocol.js.map +1 -1
  80. package/build-module/get-query-arg.js +3 -12
  81. package/build-module/get-query-arg.js.map +1 -1
  82. package/build-module/get-query-args.js +5 -12
  83. package/build-module/get-query-args.js.map +1 -1
  84. package/build-module/get-query-string.js +2 -2
  85. package/build-module/get-query-string.js.map +1 -1
  86. package/build-module/has-query-arg.js +3 -3
  87. package/build-module/has-query-arg.js.map +1 -1
  88. package/build-module/index.js.map +1 -1
  89. package/build-module/is-email.js +2 -2
  90. package/build-module/is-email.js.map +1 -1
  91. package/build-module/is-phone-number.js +2 -2
  92. package/build-module/is-phone-number.js.map +1 -1
  93. package/build-module/is-url.js +2 -2
  94. package/build-module/is-url.js.map +1 -1
  95. package/build-module/is-valid-authority.js +2 -2
  96. package/build-module/is-valid-authority.js.map +1 -1
  97. package/build-module/is-valid-fragment.js +2 -2
  98. package/build-module/is-valid-fragment.js.map +1 -1
  99. package/build-module/is-valid-path.js +2 -2
  100. package/build-module/is-valid-path.js.map +1 -1
  101. package/build-module/is-valid-protocol.js +2 -2
  102. package/build-module/is-valid-protocol.js.map +1 -1
  103. package/build-module/is-valid-query-string.js +2 -2
  104. package/build-module/is-valid-query-string.js.map +1 -1
  105. package/build-module/normalize-path.js +2 -2
  106. package/build-module/normalize-path.js.map +1 -1
  107. package/build-module/prepend-http.js +2 -2
  108. package/build-module/prepend-http.js.map +1 -1
  109. package/build-module/prepend-https.js +2 -2
  110. package/build-module/prepend-https.js.map +1 -1
  111. package/build-module/remove-query-args.js +3 -3
  112. package/build-module/remove-query-args.js.map +1 -1
  113. package/build-module/safe-decode-uri-component.js +2 -2
  114. package/build-module/safe-decode-uri-component.js.map +1 -1
  115. package/build-module/safe-decode-uri.js +2 -2
  116. package/build-module/safe-decode-uri.js.map +1 -1
  117. package/build-types/add-query-args.d.ts +5 -5
  118. package/build-types/add-query-args.d.ts.map +1 -1
  119. package/build-types/build-query-string.d.ts +3 -3
  120. package/build-types/build-query-string.d.ts.map +1 -1
  121. package/build-types/clean-for-slug.d.ts +3 -3
  122. package/build-types/clean-for-slug.d.ts.map +1 -1
  123. package/build-types/filter-url-for-display.d.ts +4 -4
  124. package/build-types/filter-url-for-display.d.ts.map +1 -1
  125. package/build-types/get-authority.d.ts +3 -3
  126. package/build-types/get-authority.d.ts.map +1 -1
  127. package/build-types/get-filename.d.ts +3 -3
  128. package/build-types/get-filename.d.ts.map +1 -1
  129. package/build-types/get-fragment.d.ts +3 -3
  130. package/build-types/get-fragment.d.ts.map +1 -1
  131. package/build-types/get-path-and-query-string.d.ts +3 -3
  132. package/build-types/get-path-and-query-string.d.ts.map +1 -1
  133. package/build-types/get-path.d.ts +3 -3
  134. package/build-types/get-path.d.ts.map +1 -1
  135. package/build-types/get-protocol.d.ts +3 -3
  136. package/build-types/get-protocol.d.ts.map +1 -1
  137. package/build-types/get-query-arg.d.ts +8 -14
  138. package/build-types/get-query-arg.d.ts.map +1 -1
  139. package/build-types/get-query-args.d.ts +6 -5
  140. package/build-types/get-query-args.d.ts.map +1 -1
  141. package/build-types/get-query-string.d.ts +3 -3
  142. package/build-types/get-query-string.d.ts.map +1 -1
  143. package/build-types/has-query-arg.d.ts +4 -4
  144. package/build-types/has-query-arg.d.ts.map +1 -1
  145. package/build-types/index.d.ts +28 -28
  146. package/build-types/index.d.ts.map +1 -1
  147. package/build-types/is-email.d.ts +3 -3
  148. package/build-types/is-email.d.ts.map +1 -1
  149. package/build-types/is-phone-number.d.ts +3 -3
  150. package/build-types/is-phone-number.d.ts.map +1 -1
  151. package/build-types/is-url.d.ts +3 -3
  152. package/build-types/is-url.d.ts.map +1 -1
  153. package/build-types/is-valid-authority.d.ts +3 -3
  154. package/build-types/is-valid-authority.d.ts.map +1 -1
  155. package/build-types/is-valid-fragment.d.ts +3 -3
  156. package/build-types/is-valid-fragment.d.ts.map +1 -1
  157. package/build-types/is-valid-path.d.ts +3 -3
  158. package/build-types/is-valid-path.d.ts.map +1 -1
  159. package/build-types/is-valid-protocol.d.ts +3 -3
  160. package/build-types/is-valid-protocol.d.ts.map +1 -1
  161. package/build-types/is-valid-query-string.d.ts +3 -3
  162. package/build-types/is-valid-query-string.d.ts.map +1 -1
  163. package/build-types/normalize-path.d.ts +3 -3
  164. package/build-types/normalize-path.d.ts.map +1 -1
  165. package/build-types/prepend-http.d.ts +3 -3
  166. package/build-types/prepend-http.d.ts.map +1 -1
  167. package/build-types/prepend-https.d.ts +3 -3
  168. package/build-types/prepend-https.d.ts.map +1 -1
  169. package/build-types/remove-query-args.d.ts +4 -4
  170. package/build-types/remove-query-args.d.ts.map +1 -1
  171. package/build-types/safe-decode-uri-component.d.ts +3 -3
  172. package/build-types/safe-decode-uri-component.d.ts.map +1 -1
  173. package/build-types/safe-decode-uri.d.ts +3 -3
  174. package/build-types/safe-decode-uri.d.ts.map +1 -1
  175. package/package.json +2 -2
  176. package/src/{add-query-args.js → add-query-args.ts} +8 -5
  177. package/src/{build-query-string.js → build-query-string.ts} +7 -6
  178. package/src/{clean-for-slug.js → clean-for-slug.ts} +3 -3
  179. package/src/{filter-url-for-display.js → filter-url-for-display.ts} +7 -4
  180. package/src/{get-authority.js → get-authority.ts} +3 -3
  181. package/src/{get-filename.js → get-filename.ts} +3 -3
  182. package/src/{get-fragment.js → get-fragment.ts} +3 -3
  183. package/src/{get-path-and-query-string.js → get-path-and-query-string.ts} +3 -3
  184. package/src/{get-path.js → get-path.ts} +3 -3
  185. package/src/{get-protocol.js → get-protocol.ts} +3 -3
  186. package/src/get-query-arg.ts +30 -0
  187. package/src/{get-query-args.js → get-query-args.ts} +9 -12
  188. package/src/{get-query-string.js → get-query-string.ts} +3 -3
  189. package/src/{has-query-arg.js → has-query-arg.ts} +4 -4
  190. package/src/{is-email.js → is-email.ts} +3 -3
  191. package/src/{is-phone-number.js → is-phone-number.ts} +3 -3
  192. package/src/{is-url.js → is-url.ts} +3 -3
  193. package/src/{is-valid-authority.js → is-valid-authority.ts} +3 -3
  194. package/src/{is-valid-fragment.js → is-valid-fragment.ts} +3 -3
  195. package/src/{is-valid-path.js → is-valid-path.ts} +3 -3
  196. package/src/{is-valid-protocol.js → is-valid-protocol.ts} +3 -3
  197. package/src/{is-valid-query-string.js → is-valid-query-string.ts} +3 -3
  198. package/src/{normalize-path.js → normalize-path.ts} +3 -3
  199. package/src/{prepend-http.js → prepend-http.ts} +3 -3
  200. package/src/{prepend-https.js → prepend-https.ts} +3 -3
  201. package/src/{remove-query-args.js → remove-query-args.ts} +4 -4
  202. package/src/{safe-decode-uri-component.js → safe-decode-uri-component.ts} +3 -3
  203. package/src/{safe-decode-uri.js → safe-decode-uri.ts} +3 -3
  204. package/src/test/index.js +2 -2
  205. package/tsconfig.tsbuildinfo +1 -1
  206. package/src/get-query-arg.js +0 -29
  207. /package/src/{index.js → index.ts} +0 -0
package/build/is-email.js CHANGED
@@ -9,14 +9,14 @@ const EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}
9
9
  /**
10
10
  * Determines whether the given string looks like an email.
11
11
  *
12
- * @param {string} email The string to scrutinise.
12
+ * @param email The string to scrutinise.
13
13
  *
14
14
  * @example
15
15
  * ```js
16
16
  * const isEmail = isEmail( 'hello@wordpress.org' ); // true
17
17
  * ```
18
18
  *
19
- * @return {boolean} Whether or not it looks like an email.
19
+ * @return Whether or not it looks like an email.
20
20
  */
21
21
  function isEmail(email) {
22
22
  return EMAIL_REGEXP.test(email);
@@ -1 +1 @@
1
- {"version":3,"names":["EMAIL_REGEXP","isEmail","email","test"],"sources":["@wordpress/url/src/is-email.js"],"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 {string} email The string to scrutinise.\n *\n * @example\n * ```js\n * const isEmail = isEmail( 'hello@wordpress.org' ); // true\n * ```\n *\n * @return {boolean} Whether or not it looks like an email.\n */\nexport function isEmail( email ) {\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;AACO,SAASC,OAAOA,CAAEC,KAAK,EAAG;EAChC,OAAOF,YAAY,CAACG,IAAI,CAAED,KAAM,CAAC;AAClC","ignoreList":[]}
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;AACO,SAASC,OAAOA,CAAEC,KAAa,EAAY;EACjD,OAAOF,YAAY,CAACG,IAAI,CAAED,KAAM,CAAC;AAClC","ignoreList":[]}
@@ -9,14 +9,14 @@ const PHONE_REGEXP = /^(tel:)?(\+)?\d{6,15}$/;
9
9
  /**
10
10
  * Determines whether the given string looks like a phone number.
11
11
  *
12
- * @param {string} phoneNumber The string to scrutinize.
12
+ * @param phoneNumber The string to scrutinize.
13
13
  *
14
14
  * @example
15
15
  * ```js
16
16
  * const isPhoneNumber = isPhoneNumber('+1 (555) 123-4567'); // true
17
17
  * ```
18
18
  *
19
- * @return {boolean} Whether or not it looks like a phone number.
19
+ * @return Whether or not it looks like a phone number.
20
20
  */
21
21
  function isPhoneNumber(phoneNumber) {
22
22
  // Remove any separator from phone number.
@@ -1 +1 @@
1
- {"version":3,"names":["PHONE_REGEXP","isPhoneNumber","phoneNumber","replace","test"],"sources":["@wordpress/url/src/is-phone-number.js"],"sourcesContent":["const PHONE_REGEXP = /^(tel:)?(\\+)?\\d{6,15}$/;\n\n/**\n * Determines whether the given string looks like a phone number.\n *\n * @param {string} phoneNumber The string to scrutinize.\n *\n * @example\n * ```js\n * const isPhoneNumber = isPhoneNumber('+1 (555) 123-4567'); // true\n * ```\n *\n * @return {boolean} Whether or not it looks like a phone number.\n */\nexport function isPhoneNumber( phoneNumber ) {\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;AACO,SAASC,aAAaA,CAAEC,WAAW,EAAG;EAC5C;EACAA,WAAW,GAAGA,WAAW,CAACC,OAAO,CAAE,UAAU,EAAE,EAAG,CAAC;EACnD,OAAOH,YAAY,CAACI,IAAI,CAAEF,WAAY,CAAC;AACxC","ignoreList":[]}
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;AACO,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":[]}
package/build/is-url.js CHANGED
@@ -8,7 +8,7 @@ exports.isURL = isURL;
8
8
  /**
9
9
  * Determines whether the given string looks like a URL.
10
10
  *
11
- * @param {string} url The string to scrutinise.
11
+ * @param url The string to scrutinise.
12
12
  *
13
13
  * @example
14
14
  * ```js
@@ -18,7 +18,7 @@ exports.isURL = isURL;
18
18
  * @see https://url.spec.whatwg.org/
19
19
  * @see https://url.spec.whatwg.org/#valid-url-string
20
20
  *
21
- * @return {boolean} Whether or not it looks like a URL.
21
+ * @return Whether or not it looks like a URL.
22
22
  */
23
23
  function isURL(url) {
24
24
  // A URL can be considered value if the `URL` constructor is able to parse
@@ -1 +1 @@
1
- {"version":3,"names":["isURL","url","URL"],"sources":["@wordpress/url/src/is-url.js"],"sourcesContent":["/**\n * Determines whether the given string looks like a URL.\n *\n * @param {string} 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 {boolean} Whether or not it looks like a URL.\n */\nexport function isURL( url ) {\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;AACO,SAASA,KAAKA,CAAEC,GAAG,EAAG;EAC5B;EACA;EACA,IAAI;IACH,IAAIC,GAAG,CAAED,GAAI,CAAC;IACd,OAAO,IAAI;EACZ,CAAC,CAAC,MAAM;IACP,OAAO,KAAK;EACb;AACD","ignoreList":[]}
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;AACO,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":[]}
@@ -7,7 +7,7 @@ exports.isValidAuthority = isValidAuthority;
7
7
  /**
8
8
  * Checks for invalid characters within the provided authority.
9
9
  *
10
- * @param {string} authority A string containing the URL authority.
10
+ * @param authority A string containing the URL authority.
11
11
  *
12
12
  * @example
13
13
  * ```js
@@ -15,7 +15,7 @@ exports.isValidAuthority = isValidAuthority;
15
15
  * const isNotValid = isValidAuthority( 'wordpress#org' ); // false
16
16
  * ```
17
17
  *
18
- * @return {boolean} True if the argument contains a valid authority.
18
+ * @return True if the argument contains a valid authority.
19
19
  */
20
20
  function isValidAuthority(authority) {
21
21
  if (!authority) {
@@ -1 +1 @@
1
- {"version":3,"names":["isValidAuthority","authority","test"],"sources":["@wordpress/url/src/is-valid-authority.js"],"sourcesContent":["/**\n * Checks for invalid characters within the provided authority.\n *\n * @param {string} 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 {boolean} True if the argument contains a valid authority.\n */\nexport function isValidAuthority( authority ) {\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;AACO,SAASA,gBAAgBA,CAAEC,SAAS,EAAG;EAC7C,IAAK,CAAEA,SAAS,EAAG;IAClB,OAAO,KAAK;EACb;EACA,OAAO,YAAY,CAACC,IAAI,CAAED,SAAU,CAAC;AACtC","ignoreList":[]}
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;AACO,SAASA,gBAAgBA,CAAEC,SAAiB,EAAY;EAC9D,IAAK,CAAEA,SAAS,EAAG;IAClB,OAAO,KAAK;EACb;EACA,OAAO,YAAY,CAACC,IAAI,CAAED,SAAU,CAAC;AACtC","ignoreList":[]}
@@ -7,7 +7,7 @@ exports.isValidFragment = isValidFragment;
7
7
  /**
8
8
  * Checks for invalid characters within the provided fragment.
9
9
  *
10
- * @param {string} fragment The url fragment.
10
+ * @param fragment The url fragment.
11
11
  *
12
12
  * @example
13
13
  * ```js
@@ -15,7 +15,7 @@ exports.isValidFragment = isValidFragment;
15
15
  * const isNotValid = isValidFragment( '#invalid-#fragment' ); // false
16
16
  * ```
17
17
  *
18
- * @return {boolean} True if the argument contains a valid fragment.
18
+ * @return True if the argument contains a valid fragment.
19
19
  */
20
20
  function isValidFragment(fragment) {
21
21
  if (!fragment) {
@@ -1 +1 @@
1
- {"version":3,"names":["isValidFragment","fragment","test"],"sources":["@wordpress/url/src/is-valid-fragment.js"],"sourcesContent":["/**\n * Checks for invalid characters within the provided fragment.\n *\n * @param {string} 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 {boolean} True if the argument contains a valid fragment.\n */\nexport function isValidFragment( fragment ) {\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;AACO,SAASA,eAAeA,CAAEC,QAAQ,EAAG;EAC3C,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA,OAAO,eAAe,CAACC,IAAI,CAAED,QAAS,CAAC;AACxC","ignoreList":[]}
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;AACO,SAASA,eAAeA,CAAEC,QAAgB,EAAY;EAC5D,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA,OAAO,eAAe,CAACC,IAAI,CAAED,QAAS,CAAC;AACxC","ignoreList":[]}
@@ -7,7 +7,7 @@ exports.isValidPath = isValidPath;
7
7
  /**
8
8
  * Checks for invalid characters within the provided path.
9
9
  *
10
- * @param {string} path The URL path.
10
+ * @param path The URL path.
11
11
  *
12
12
  * @example
13
13
  * ```js
@@ -15,7 +15,7 @@ exports.isValidPath = isValidPath;
15
15
  * const isNotValid = isValidPath( '/invalid?test/path/' ); // false
16
16
  * ```
17
17
  *
18
- * @return {boolean} True if the argument contains a valid path
18
+ * @return True if the argument contains a valid path
19
19
  */
20
20
  function isValidPath(path) {
21
21
  if (!path) {
@@ -1 +1 @@
1
- {"version":3,"names":["isValidPath","path","test"],"sources":["@wordpress/url/src/is-valid-path.js"],"sourcesContent":["/**\n * Checks for invalid characters within the provided path.\n *\n * @param {string} 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 {boolean} True if the argument contains a valid path\n */\nexport function isValidPath( path ) {\n\tif ( ! path ) {\n\t\treturn false;\n\t}\n\treturn /^[^\\s#?]+$/.test( path );\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAEC,IAAI,EAAG;EACnC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAO,KAAK;EACb;EACA,OAAO,YAAY,CAACC,IAAI,CAAED,IAAK,CAAC;AACjC","ignoreList":[]}
1
+ {"version":3,"names":["isValidPath","path","test"],"sources":["@wordpress/url/src/is-valid-path.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAEC,IAAY,EAAY;EACpD,IAAK,CAAEA,IAAI,EAAG;IACb,OAAO,KAAK;EACb;EACA,OAAO,YAAY,CAACC,IAAI,CAAED,IAAK,CAAC;AACjC","ignoreList":[]}
@@ -7,7 +7,7 @@ exports.isValidProtocol = isValidProtocol;
7
7
  /**
8
8
  * Tests if a url protocol is valid.
9
9
  *
10
- * @param {string} protocol The url protocol.
10
+ * @param protocol The url protocol.
11
11
  *
12
12
  * @example
13
13
  * ```js
@@ -15,7 +15,7 @@ exports.isValidProtocol = isValidProtocol;
15
15
  * const isNotValid = isValidProtocol( 'https :' ); // false
16
16
  * ```
17
17
  *
18
- * @return {boolean} True if the argument is a valid protocol (e.g. http:, tel:).
18
+ * @return True if the argument is a valid protocol (e.g. http:, tel:).
19
19
  */
20
20
  function isValidProtocol(protocol) {
21
21
  if (!protocol) {
@@ -1 +1 @@
1
- {"version":3,"names":["isValidProtocol","protocol","test"],"sources":["@wordpress/url/src/is-valid-protocol.js"],"sourcesContent":["/**\n * Tests if a url protocol is valid.\n *\n * @param {string} 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 {boolean} True if the argument is a valid protocol (e.g. http:, tel:).\n */\nexport function isValidProtocol( protocol ) {\n\tif ( ! protocol ) {\n\t\treturn false;\n\t}\n\treturn /^[a-z\\-.\\+]+[0-9]*:$/i.test( protocol );\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAeA,CAAEC,QAAQ,EAAG;EAC3C,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA,OAAO,uBAAuB,CAACC,IAAI,CAAED,QAAS,CAAC;AAChD","ignoreList":[]}
1
+ {"version":3,"names":["isValidProtocol","protocol","test"],"sources":["@wordpress/url/src/is-valid-protocol.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAeA,CAAEC,QAAgB,EAAY;EAC5D,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA,OAAO,uBAAuB,CAACC,IAAI,CAAED,QAAS,CAAC;AAChD","ignoreList":[]}
@@ -7,7 +7,7 @@ exports.isValidQueryString = isValidQueryString;
7
7
  /**
8
8
  * Checks for invalid characters within the provided query string.
9
9
  *
10
- * @param {string} queryString The query string.
10
+ * @param queryString The query string.
11
11
  *
12
12
  * @example
13
13
  * ```js
@@ -15,7 +15,7 @@ exports.isValidQueryString = isValidQueryString;
15
15
  * const isNotValid = isValidQueryString( 'query=true?another=false' ); // false
16
16
  * ```
17
17
  *
18
- * @return {boolean} True if the argument contains a valid query string.
18
+ * @return True if the argument contains a valid query string.
19
19
  */
20
20
  function isValidQueryString(queryString) {
21
21
  if (!queryString) {
@@ -1 +1 @@
1
- {"version":3,"names":["isValidQueryString","queryString","test"],"sources":["@wordpress/url/src/is-valid-query-string.js"],"sourcesContent":["/**\n * Checks for invalid characters within the provided query string.\n *\n * @param {string} 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 {boolean} True if the argument contains a valid query string.\n */\nexport function isValidQueryString( queryString ) {\n\tif ( ! queryString ) {\n\t\treturn false;\n\t}\n\treturn /^[^\\s#?\\/]+$/.test( queryString );\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAkBA,CAAEC,WAAW,EAAG;EACjD,IAAK,CAAEA,WAAW,EAAG;IACpB,OAAO,KAAK;EACb;EACA,OAAO,cAAc,CAACC,IAAI,CAAED,WAAY,CAAC;AAC1C","ignoreList":[]}
1
+ {"version":3,"names":["isValidQueryString","queryString","test"],"sources":["@wordpress/url/src/is-valid-query-string.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAkBA,CAAEC,WAAmB,EAAY;EAClE,IAAK,CAAEA,WAAW,EAAG;IACpB,OAAO,KAAK;EACb;EACA,OAAO,cAAc,CAACC,IAAI,CAAED,WAAY,CAAC;AAC1C","ignoreList":[]}
@@ -9,9 +9,9 @@ exports.normalizePath = normalizePath;
9
9
  * will be treated as identical, regardless of order they appear in the original
10
10
  * text.
11
11
  *
12
- * @param {string} path Original path.
12
+ * @param path Original path.
13
13
  *
14
- * @return {string} Normalized path.
14
+ * @return Normalized path.
15
15
  */
16
16
  function normalizePath(path) {
17
17
  const split = path.split('?');
@@ -1 +1 @@
1
- {"version":3,"names":["normalizePath","path","split","query","base","map","entry","pair","decodeURIComponent","sort","a","b","localeCompare","encodeURIComponent","join"],"sources":["@wordpress/url/src/normalize-path.js"],"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 {string} path Original path.\n *\n * @return {string} Normalized path.\n */\nexport function normalizePath( path ) {\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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAAEC,IAAI,EAAG;EACrC,MAAMC,KAAK,GAAGD,IAAI,CAACC,KAAK,CAAE,GAAI,CAAC;EAC/B,MAAMC,KAAK,GAAGD,KAAK,CAAE,CAAC,CAAE;EACxB,MAAME,IAAI,GAAGF,KAAK,CAAE,CAAC,CAAE;EACvB,IAAK,CAAEC,KAAK,EAAG;IACd,OAAOC,IAAI;EACZ;;EAEA;EACA,OACCA,IAAI,GACJ,GAAG,GACHD;EACC;EAAA,CACCD,KAAK,CAAE,GAAI;EACZ;EAAA,CACCG,GAAG,CAAIC,KAAK,IAAMA,KAAK,CAACJ,KAAK,CAAE,GAAI,CAAE;EACtC;EAAA,CACCG,GAAG,CAAIE,IAAI,IAAMA,IAAI,CAACF,GAAG,CAAEG,kBAAmB,CAAE;EACjD;EAAA,CACCC,IAAI,CAAE,CAAEC,CAAC,EAAEC,CAAC,KAAMD,CAAC,CAAE,CAAC,CAAE,CAACE,aAAa,CAAED,CAAC,CAAE,CAAC,CAAG,CAAE;EAClD;EAAA,CACCN,GAAG,CAAIE,IAAI,IAAMA,IAAI,CAACF,GAAG,CAAEQ,kBAAmB,CAAE;EACjD;EAAA,CACCR,GAAG,CAAIE,IAAI,IAAMA,IAAI,CAACO,IAAI,CAAE,GAAI,CAAE;EACnC;EAAA,CACCA,IAAI,CAAE,GAAI,CAAC;AAEf","ignoreList":[]}
1
+ {"version":3,"names":["normalizePath","path","split","query","base","map","entry","pair","decodeURIComponent","sort","a","b","localeCompare","encodeURIComponent","join"],"sources":["@wordpress/url/src/normalize-path.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAAEC,IAAY,EAAW;EACrD,MAAMC,KAAK,GAAGD,IAAI,CAACC,KAAK,CAAE,GAAI,CAAC;EAC/B,MAAMC,KAAK,GAAGD,KAAK,CAAE,CAAC,CAAE;EACxB,MAAME,IAAI,GAAGF,KAAK,CAAE,CAAC,CAAE;EACvB,IAAK,CAAEC,KAAK,EAAG;IACd,OAAOC,IAAI;EACZ;;EAEA;EACA,OACCA,IAAI,GACJ,GAAG,GACHD;EACC;EAAA,CACCD,KAAK,CAAE,GAAI;EACZ;EAAA,CACCG,GAAG,CAAIC,KAAK,IAAMA,KAAK,CAACJ,KAAK,CAAE,GAAI,CAAE;EACtC;EAAA,CACCG,GAAG,CAAIE,IAAI,IAAMA,IAAI,CAACF,GAAG,CAAEG,kBAAmB,CAAE;EACjD;EAAA,CACCC,IAAI,CAAE,CAAEC,CAAC,EAAEC,CAAC,KAAMD,CAAC,CAAE,CAAC,CAAE,CAACE,aAAa,CAAED,CAAC,CAAE,CAAC,CAAG,CAAE;EAClD;EAAA,CACCN,GAAG,CAAIE,IAAI,IAAMA,IAAI,CAACF,GAAG,CAAEQ,kBAAmB,CAAE;EACjD;EAAA,CACCR,GAAG,CAAIE,IAAI,IAAMA,IAAI,CAACO,IAAI,CAAE,GAAI,CAAE;EACnC;EAAA,CACCA,IAAI,CAAE,GAAI,CAAC;AAEf","ignoreList":[]}
@@ -14,14 +14,14 @@ const USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i;
14
14
  /**
15
15
  * Prepends "http://" to a url, if it looks like something that is meant to be a TLD.
16
16
  *
17
- * @param {string} url The URL to test.
17
+ * @param url The URL to test.
18
18
  *
19
19
  * @example
20
20
  * ```js
21
21
  * const actualURL = prependHTTP( 'wordpress.org' ); // http://wordpress.org
22
22
  * ```
23
23
  *
24
- * @return {string} The updated URL.
24
+ * @return The updated URL.
25
25
  */
26
26
  function prependHTTP(url) {
27
27
  if (!url) {
@@ -1 +1 @@
1
- {"version":3,"names":["_isEmail","require","USABLE_HREF_REGEXP","prependHTTP","url","trim","test","isEmail"],"sources":["@wordpress/url/src/prepend-http.js"],"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 {string} url The URL to test.\n *\n * @example\n * ```js\n * const actualURL = prependHTTP( 'wordpress.org' ); // http://wordpress.org\n * ```\n *\n * @return {string} The updated URL.\n */\nexport function prependHTTP( url ) {\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"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,kBAAkB,GAAG,0BAA0B;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAEC,GAAG,EAAG;EAClC,IAAK,CAAEA,GAAG,EAAG;IACZ,OAAOA,GAAG;EACX;EAEAA,GAAG,GAAGA,GAAG,CAACC,IAAI,CAAC,CAAC;EAChB,IAAK,CAAEH,kBAAkB,CAACI,IAAI,CAAEF,GAAI,CAAC,IAAI,CAAE,IAAAG,gBAAO,EAAEH,GAAI,CAAC,EAAG;IAC3D,OAAO,SAAS,GAAGA,GAAG;EACvB;EAEA,OAAOA,GAAG;AACX","ignoreList":[]}
1
+ {"version":3,"names":["_isEmail","require","USABLE_HREF_REGEXP","prependHTTP","url","trim","test","isEmail"],"sources":["@wordpress/url/src/prepend-http.ts"],"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"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,kBAAkB,GAAG,0BAA0B;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAEC,GAAW,EAAW;EAClD,IAAK,CAAEA,GAAG,EAAG;IACZ,OAAOA,GAAG;EACX;EAEAA,GAAG,GAAGA,GAAG,CAACC,IAAI,CAAC,CAAC;EAChB,IAAK,CAAEH,kBAAkB,CAACI,IAAI,CAAEF,GAAI,CAAC,IAAI,CAAE,IAAAG,gBAAO,EAAEH,GAAI,CAAC,EAAG;IAC3D,OAAO,SAAS,GAAGA,GAAG;EACvB;EAEA,OAAOA,GAAG;AACX","ignoreList":[]}
@@ -14,14 +14,14 @@ var _prependHttp = require("./prepend-http");
14
14
  *
15
15
  * Note: this will not replace "http://" with "https://".
16
16
  *
17
- * @param {string} url The URL to test.
17
+ * @param url The URL to test.
18
18
  *
19
19
  * @example
20
20
  * ```js
21
21
  * const actualURL = prependHTTPS( 'wordpress.org' ); // https://wordpress.org
22
22
  * ```
23
23
  *
24
- * @return {string} The updated URL.
24
+ * @return The updated URL.
25
25
  */
26
26
  function prependHTTPS(url) {
27
27
  if (!url) {
@@ -1 +1 @@
1
- {"version":3,"names":["_prependHttp","require","prependHTTPS","url","startsWith","prependHTTP","replace"],"sources":["@wordpress/url/src/prepend-https.js"],"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 {string} url The URL to test.\n *\n * @example\n * ```js\n * const actualURL = prependHTTPS( 'wordpress.org' ); // https://wordpress.org\n * ```\n *\n * @return {string} The updated URL.\n */\nexport function prependHTTPS( url ) {\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"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAAEC,GAAG,EAAG;EACnC,IAAK,CAAEA,GAAG,EAAG;IACZ,OAAOA,GAAG;EACX;;EAEA;EACA,IAAKA,GAAG,CAACC,UAAU,CAAE,SAAU,CAAC,EAAG;IAClC,OAAOD,GAAG;EACX;EAEAA,GAAG,GAAG,IAAAE,wBAAW,EAAEF,GAAI,CAAC;EAExB,OAAOA,GAAG,CAACG,OAAO,CAAE,QAAQ,EAAE,QAAS,CAAC;AACzC","ignoreList":[]}
1
+ {"version":3,"names":["_prependHttp","require","prependHTTPS","url","startsWith","prependHTTP","replace"],"sources":["@wordpress/url/src/prepend-https.ts"],"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"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAAEC,GAAW,EAAW;EACnD,IAAK,CAAEA,GAAG,EAAG;IACZ,OAAOA,GAAG;EACX;;EAEA;EACA,IAAKA,GAAG,CAACC,UAAU,CAAE,SAAU,CAAC,EAAG;IAClC,OAAOD,GAAG;EACX;EAEAA,GAAG,GAAG,IAAAE,wBAAW,EAAEF,GAAI,CAAC;EAExB,OAAOA,GAAG,CAACG,OAAO,CAAE,QAAQ,EAAE,QAAS,CAAC;AACzC","ignoreList":[]}
@@ -13,15 +13,15 @@ var _buildQueryString = require("./build-query-string");
13
13
  /**
14
14
  * Removes arguments from the query string of the url
15
15
  *
16
- * @param {string} url URL.
17
- * @param {...string} args Query Args.
16
+ * @param url URL.
17
+ * @param args Query Args.
18
18
  *
19
19
  * @example
20
20
  * ```js
21
21
  * const newUrl = removeQueryArgs( 'https://wordpress.org?foo=bar&bar=baz&baz=foobar', 'foo', 'bar' ); // https://wordpress.org?baz=foobar
22
22
  * ```
23
23
  *
24
- * @return {string} Updated URL.
24
+ * @return Updated URL.
25
25
  */
26
26
  function removeQueryArgs(url, ...args) {
27
27
  const fragment = url.replace(/^[^#]*/, '');
@@ -1 +1 @@
1
- {"version":3,"names":["_getQueryArgs","require","_buildQueryString","removeQueryArgs","url","args","fragment","replace","queryStringIndex","indexOf","query","getQueryArgs","baseURL","substr","forEach","arg","queryString","buildQueryString","updatedUrl"],"sources":["@wordpress/url/src/remove-query-args.js"],"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 {string} url URL.\n * @param {...string} 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 {string} Updated URL.\n */\nexport function removeQueryArgs( url, ...args ) {\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"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,eAAeA,CAAEC,GAAG,EAAE,GAAGC,IAAI,EAAG;EAC/C,MAAMC,QAAQ,GAAGF,GAAG,CAACG,OAAO,CAAE,QAAQ,EAAE,EAAG,CAAC;EAC5CH,GAAG,GAAGA,GAAG,CAACG,OAAO,CAAE,KAAK,EAAE,EAAG,CAAC;EAE9B,MAAMC,gBAAgB,GAAGJ,GAAG,CAACK,OAAO,CAAE,GAAI,CAAC;EAC3C,IAAKD,gBAAgB,KAAK,CAAC,CAAC,EAAG;IAC9B,OAAOJ,GAAG,GAAGE,QAAQ;EACtB;EAEA,MAAMI,KAAK,GAAG,IAAAC,0BAAY,EAAEP,GAAI,CAAC;EACjC,MAAMQ,OAAO,GAAGR,GAAG,CAACS,MAAM,CAAE,CAAC,EAAEL,gBAAiB,CAAC;EACjDH,IAAI,CAACS,OAAO,CAAIC,GAAG,IAAM,OAAOL,KAAK,CAAEK,GAAG,CAAG,CAAC;EAC9C,MAAMC,WAAW,GAAG,IAAAC,kCAAgB,EAAEP,KAAM,CAAC;EAC7C,MAAMQ,UAAU,GAAGF,WAAW,GAAGJ,OAAO,GAAG,GAAG,GAAGI,WAAW,GAAGJ,OAAO;EACtE,OAAOM,UAAU,GAAGZ,QAAQ;AAC7B","ignoreList":[]}
1
+ {"version":3,"names":["_getQueryArgs","require","_buildQueryString","removeQueryArgs","url","args","fragment","replace","queryStringIndex","indexOf","query","getQueryArgs","baseURL","substr","forEach","arg","queryString","buildQueryString","updatedUrl"],"sources":["@wordpress/url/src/remove-query-args.ts"],"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"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,eAAeA,CAAEC,GAAW,EAAE,GAAGC,IAAc,EAAW;EACzE,MAAMC,QAAQ,GAAGF,GAAG,CAACG,OAAO,CAAE,QAAQ,EAAE,EAAG,CAAC;EAC5CH,GAAG,GAAGA,GAAG,CAACG,OAAO,CAAE,KAAK,EAAE,EAAG,CAAC;EAE9B,MAAMC,gBAAgB,GAAGJ,GAAG,CAACK,OAAO,CAAE,GAAI,CAAC;EAC3C,IAAKD,gBAAgB,KAAK,CAAC,CAAC,EAAG;IAC9B,OAAOJ,GAAG,GAAGE,QAAQ;EACtB;EAEA,MAAMI,KAAK,GAAG,IAAAC,0BAAY,EAAEP,GAAI,CAAC;EACjC,MAAMQ,OAAO,GAAGR,GAAG,CAACS,MAAM,CAAE,CAAC,EAAEL,gBAAiB,CAAC;EACjDH,IAAI,CAACS,OAAO,CAAIC,GAAG,IAAM,OAAOL,KAAK,CAAEK,GAAG,CAAG,CAAC;EAC9C,MAAMC,WAAW,GAAG,IAAAC,kCAAgB,EAAEP,KAAM,CAAC;EAC7C,MAAMQ,UAAU,GAAGF,WAAW,GAAGJ,OAAO,GAAG,GAAG,GAAGI,WAAW,GAAGJ,OAAO;EACtE,OAAOM,UAAU,GAAGZ,QAAQ;AAC7B","ignoreList":[]}
@@ -8,9 +8,9 @@ exports.safeDecodeURIComponent = safeDecodeURIComponent;
8
8
  * Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if
9
9
  * `decodeURIComponent` throws an error.
10
10
  *
11
- * @param {string} uriComponent URI component to decode.
11
+ * @param uriComponent URI component to decode.
12
12
  *
13
- * @return {string} Decoded URI component if possible.
13
+ * @return Decoded URI component if possible.
14
14
  */
15
15
  function safeDecodeURIComponent(uriComponent) {
16
16
  try {
@@ -1 +1 @@
1
- {"version":3,"names":["safeDecodeURIComponent","uriComponent","decodeURIComponent","uriComponentError"],"sources":["@wordpress/url/src/safe-decode-uri-component.js"],"sourcesContent":["/**\n * Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if\n * `decodeURIComponent` throws an error.\n *\n * @param {string} uriComponent URI component to decode.\n *\n * @return {string} Decoded URI component if possible.\n */\nexport function safeDecodeURIComponent( uriComponent ) {\n\ttry {\n\t\treturn decodeURIComponent( uriComponent );\n\t} catch ( uriComponentError ) {\n\t\treturn uriComponent;\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAsBA,CAAEC,YAAY,EAAG;EACtD,IAAI;IACH,OAAOC,kBAAkB,CAAED,YAAa,CAAC;EAC1C,CAAC,CAAC,OAAQE,iBAAiB,EAAG;IAC7B,OAAOF,YAAY;EACpB;AACD","ignoreList":[]}
1
+ {"version":3,"names":["safeDecodeURIComponent","uriComponent","decodeURIComponent","uriComponentError"],"sources":["@wordpress/url/src/safe-decode-uri-component.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAsBA,CAAEC,YAAoB,EAAW;EACtE,IAAI;IACH,OAAOC,kBAAkB,CAAED,YAAa,CAAC;EAC1C,CAAC,CAAC,OAAQE,iBAAiB,EAAG;IAC7B,OAAOF,YAAY;EACpB;AACD","ignoreList":[]}
@@ -8,14 +8,14 @@ exports.safeDecodeURI = safeDecodeURI;
8
8
  * Safely decodes a URI with `decodeURI`. Returns the URI unmodified if
9
9
  * `decodeURI` throws an error.
10
10
  *
11
- * @param {string} uri URI to decode.
11
+ * @param uri URI to decode.
12
12
  *
13
13
  * @example
14
14
  * ```js
15
15
  * const badUri = safeDecodeURI( '%z' ); // does not throw an Error, simply returns '%z'
16
16
  * ```
17
17
  *
18
- * @return {string} Decoded URI if possible.
18
+ * @return Decoded URI if possible.
19
19
  */
20
20
  function safeDecodeURI(uri) {
21
21
  try {
@@ -1 +1 @@
1
- {"version":3,"names":["safeDecodeURI","uri","decodeURI","uriError"],"sources":["@wordpress/url/src/safe-decode-uri.js"],"sourcesContent":["/**\n * Safely decodes a URI with `decodeURI`. Returns the URI unmodified if\n * `decodeURI` throws an error.\n *\n * @param {string} 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 {string} Decoded URI if possible.\n */\nexport function safeDecodeURI( uri ) {\n\ttry {\n\t\treturn decodeURI( uri );\n\t} catch ( uriError ) {\n\t\treturn uri;\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAAEC,GAAG,EAAG;EACpC,IAAI;IACH,OAAOC,SAAS,CAAED,GAAI,CAAC;EACxB,CAAC,CAAC,OAAQE,QAAQ,EAAG;IACpB,OAAOF,GAAG;EACX;AACD","ignoreList":[]}
1
+ {"version":3,"names":["safeDecodeURI","uri","decodeURI","uriError"],"sources":["@wordpress/url/src/safe-decode-uri.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAAEC,GAAW,EAAW;EACpD,IAAI;IACH,OAAOC,SAAS,CAAED,GAAI,CAAC;EACxB,CAAC,CAAC,OAAQE,QAAQ,EAAG;IACpB,OAAOF,GAAG;EACX;AACD","ignoreList":[]}
@@ -10,16 +10,16 @@ import { getFragment } from './get-fragment';
10
10
  * includes query arguments, the arguments are merged with (and take precedent
11
11
  * over) the existing set.
12
12
  *
13
- * @param {string} [url=''] URL to which arguments should be appended. If omitted,
14
- * only the resulting querystring is returned.
15
- * @param {Object} [args] Query arguments to apply to URL.
13
+ * @param url URL to which arguments should be appended. If omitted,
14
+ * only the resulting querystring is returned.
15
+ * @param args Query arguments to apply to URL.
16
16
  *
17
17
  * @example
18
18
  * ```js
19
19
  * const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://google.com/?q=test
20
20
  * ```
21
21
  *
22
- * @return {string} URL with arguments applied.
22
+ * @return URL with arguments applied.
23
23
  */
24
24
  export function addQueryArgs(url = '', args) {
25
25
  // If no arguments are to be appended, return original URL.
@@ -1 +1 @@
1
- {"version":3,"names":["getQueryArgs","buildQueryString","getFragment","addQueryArgs","url","args","Object","keys","length","fragment","baseUrl","replace","queryStringIndex","indexOf","assign","substr"],"sources":["@wordpress/url/src/add-query-args.js"],"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 {string} [url=''] URL to which arguments should be appended. If omitted,\n * only the resulting querystring is returned.\n * @param {Object} [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 {string} URL with arguments applied.\n */\nexport function addQueryArgs( url = '', args ) {\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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,WAAW,QAAQ,gBAAgB;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,GAAG,GAAG,EAAE,EAAEC,IAAI,EAAG;EAC9C;EACA,IAAK,CAAEA,IAAI,IAAI,CAAEC,MAAM,CAACC,IAAI,CAAEF,IAAK,CAAC,CAACG,MAAM,EAAG;IAC7C,OAAOJ,GAAG;EACX;EAEA,MAAMK,QAAQ,GAAGP,WAAW,CAAEE,GAAI,CAAC,IAAI,EAAE;EACzC,IAAIM,OAAO,GAAGN,GAAG,CAACO,OAAO,CAAEF,QAAQ,EAAE,EAAG,CAAC;;EAEzC;EACA,MAAMG,gBAAgB,GAAGR,GAAG,CAACS,OAAO,CAAE,GAAI,CAAC;EAC3C,IAAKD,gBAAgB,KAAK,CAAC,CAAC,EAAG;IAC9B;IACAP,IAAI,GAAGC,MAAM,CAACQ,MAAM,CAAEd,YAAY,CAAEI,GAAI,CAAC,EAAEC,IAAK,CAAC;;IAEjD;IACAK,OAAO,GAAGA,OAAO,CAACK,MAAM,CAAE,CAAC,EAAEH,gBAAiB,CAAC;EAChD;EAEA,OAAOF,OAAO,GAAG,GAAG,GAAGT,gBAAgB,CAAEI,IAAK,CAAC,GAAGI,QAAQ;AAC3D","ignoreList":[]}
1
+ {"version":3,"names":["getQueryArgs","buildQueryString","getFragment","addQueryArgs","url","args","Object","keys","length","fragment","baseUrl","replace","queryStringIndex","indexOf","assign","substr"],"sources":["@wordpress/url/src/add-query-args.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,WAAW,QAAQ,gBAAgB;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAC3BC,GAAW,GAAG,EAAE,EAChBC,IAAgC,EACvB;EACT;EACA,IAAK,CAAEA,IAAI,IAAI,CAAEC,MAAM,CAACC,IAAI,CAAEF,IAAK,CAAC,CAACG,MAAM,EAAG;IAC7C,OAAOJ,GAAG;EACX;EAEA,MAAMK,QAAQ,GAAGP,WAAW,CAAEE,GAAI,CAAC,IAAI,EAAE;EACzC,IAAIM,OAAO,GAAGN,GAAG,CAACO,OAAO,CAAEF,QAAQ,EAAE,EAAG,CAAC;;EAEzC;EACA,MAAMG,gBAAgB,GAAGR,GAAG,CAACS,OAAO,CAAE,GAAI,CAAC;EAC3C,IAAKD,gBAAgB,KAAK,CAAC,CAAC,EAAG;IAC9B;IACAP,IAAI,GAAGC,MAAM,CAACQ,MAAM,CAAEd,YAAY,CAAEI,GAAI,CAAC,EAAEC,IAAK,CAAC;;IAEjD;IACAK,OAAO,GAAGA,OAAO,CAACK,MAAM,CAAE,CAAC,EAAEH,gBAAiB,CAAC;EAChD;EAEA,OAAOF,OAAO,GAAG,GAAG,GAAGT,gBAAgB,CAAEI,IAAK,CAAC,GAAGI,QAAQ;AAC3D","ignoreList":[]}
@@ -18,9 +18,9 @@
18
18
  * // "simple=is%20ok&arrays%5B0%5D=are&arrays%5B1%5D=fine&arrays%5B2%5D=too&objects%5BevenNested%5D%5Bok%5D=yes"
19
19
  * ```
20
20
  *
21
- * @param {Record<string,*>} data Data to encode.
21
+ * @param data Data to encode.
22
22
  *
23
- * @return {string} Query string.
23
+ * @return Query string.
24
24
  */
25
25
  export function buildQueryString(data) {
26
26
  let string = '';
@@ -44,7 +44,7 @@ export function buildQueryString(data) {
44
44
  if (value === null) {
45
45
  value = '';
46
46
  }
47
- string += '&' + [key, value].map(encodeURIComponent).join('=');
47
+ string += '&' + [key, String(value)].map(encodeURIComponent).join('=');
48
48
  }
49
49
  }
50
50
 
@@ -1 +1 @@
1
- {"version":3,"names":["buildQueryString","data","string","stack","Object","entries","pair","shift","key","value","hasNestedData","Array","isArray","constructor","valuePairs","reverse","member","memberValue","unshift","undefined","map","encodeURIComponent","join","substr"],"sources":["@wordpress/url/src/build-query-string.js"],"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 {Record<string,*>} data Data to encode.\n *\n * @return {string} Query string.\n */\nexport function buildQueryString( data ) {\n\tlet string = '';\n\n\tconst stack = 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 ).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'&' + [ key, 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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,gBAAgBA,CAAEC,IAAI,EAAG;EACxC,IAAIC,MAAM,GAAG,EAAE;EAEf,MAAMC,KAAK,GAAGC,MAAM,CAACC,OAAO,CAAEJ,IAAK,CAAC;EAEpC,IAAIK,IAAI;EACR,OAAUA,IAAI,GAAGH,KAAK,CAACI,KAAK,CAAC,CAAC,EAAK;IAClC,IAAI,CAAEC,GAAG,EAAEC,KAAK,CAAE,GAAGH,IAAI;;IAEzB;IACA,MAAMI,aAAa,GAClBC,KAAK,CAACC,OAAO,CAAEH,KAAM,CAAC,IAAMA,KAAK,IAAIA,KAAK,CAACI,WAAW,KAAKT,MAAQ;IAEpE,IAAKM,aAAa,EAAG;MACpB;MACA;MACA;MACA,MAAMI,UAAU,GAAGV,MAAM,CAACC,OAAO,CAAEI,KAAM,CAAC,CAACM,OAAO,CAAC,CAAC;MACpD,KAAM,MAAM,CAAEC,MAAM,EAAEC,WAAW,CAAE,IAAIH,UAAU,EAAG;QACnDX,KAAK,CAACe,OAAO,CAAE,CAAE,GAAIV,GAAG,IAAMQ,MAAM,GAAI,EAAEC,WAAW,CAAG,CAAC;MAC1D;IACD,CAAC,MAAM,IAAKR,KAAK,KAAKU,SAAS,EAAG;MACjC;MACA,IAAKV,KAAK,KAAK,IAAI,EAAG;QACrBA,KAAK,GAAG,EAAE;MACX;MAEAP,MAAM,IACL,GAAG,GAAG,CAAEM,GAAG,EAAEC,KAAK,CAAE,CAACW,GAAG,CAAEC,kBAAmB,CAAC,CAACC,IAAI,CAAE,GAAI,CAAC;IAC5D;EACD;;EAEA;EACA;EACA;EACA,OAAOpB,MAAM,CAACqB,MAAM,CAAE,CAAE,CAAC;AAC1B","ignoreList":[]}
1
+ {"version":3,"names":["buildQueryString","data","string","stack","Object","entries","pair","shift","key","value","hasNestedData","Array","isArray","constructor","valuePairs","reverse","member","memberValue","unshift","undefined","String","map","encodeURIComponent","join","substr"],"sources":["@wordpress/url/src/build-query-string.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,gBAAgBA,CAAEC,IAA+B,EAAW;EAC3E,IAAIC,MAAM,GAAG,EAAE;EAEf,MAAMC,KAAmC,GAAGC,MAAM,CAACC,OAAO,CAAEJ,IAAK,CAAC;EAElE,IAAIK,IAAI;EACR,OAAUA,IAAI,GAAGH,KAAK,CAACI,KAAK,CAAC,CAAC,EAAK;IAClC,IAAI,CAAEC,GAAG,EAAEC,KAAK,CAAE,GAAGH,IAAI;;IAEzB;IACA,MAAMI,aAAa,GAClBC,KAAK,CAACC,OAAO,CAAEH,KAAM,CAAC,IAAMA,KAAK,IAAIA,KAAK,CAACI,WAAW,KAAKT,MAAQ;IAEpE,IAAKM,aAAa,EAAG;MACpB;MACA;MACA;MACA,MAAMI,UAAU,GAAGV,MAAM,CAACC,OAAO,CAAEI,KAAgB,CAAC,CAACM,OAAO,CAAC,CAAC;MAC9D,KAAM,MAAM,CAAEC,MAAM,EAAEC,WAAW,CAAE,IAAIH,UAAU,EAAG;QACnDX,KAAK,CAACe,OAAO,CAAE,CAAE,GAAIV,GAAG,IAAMQ,MAAM,GAAI,EAAEC,WAAW,CAAG,CAAC;MAC1D;IACD,CAAC,MAAM,IAAKR,KAAK,KAAKU,SAAS,EAAG;MACjC;MACA,IAAKV,KAAK,KAAK,IAAI,EAAG;QACrBA,KAAK,GAAG,EAAE;MACX;MAEAP,MAAM,IACL,GAAG,GACH,CAAEM,GAAG,EAAEY,MAAM,CAAEX,KAAM,CAAC,CAAE,CAACY,GAAG,CAAEC,kBAAmB,CAAC,CAACC,IAAI,CAAE,GAAI,CAAC;IAChE;EACD;;EAEA;EACA;EACA;EACA,OAAOrB,MAAM,CAACsB,MAAM,CAAE,CAAE,CAAC;AAC1B","ignoreList":[]}
@@ -15,9 +15,9 @@ import removeAccents from 'remove-accents';
15
15
  * except hyphens. Converts remaining string to lowercase. It does not account
16
16
  * for octets, HTML entities, or other encoded characters.
17
17
  *
18
- * @param {string} string Title or slug to be processed.
18
+ * @param string Title or slug to be processed.
19
19
  *
20
- * @return {string} Processed string.
20
+ * @return Processed string.
21
21
  */
22
22
  export function cleanForSlug(string) {
23
23
  if (!string) {
@@ -1 +1 @@
1
- {"version":3,"names":["removeAccents","cleanForSlug","string","replace","toLowerCase"],"sources":["@wordpress/url/src/clean-for-slug.js"],"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} string Title or slug to be processed.\n *\n * @return {string} Processed string.\n */\nexport function cleanForSlug( 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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,gBAAgB;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,MAAM,EAAG;EACtC,IAAK,CAAEA,MAAM,EAAG;IACf,OAAO,EAAE;EACV;EACA,OACCF,aAAa,CAAEE,MAAO;EACrB;EAAA,CACCC,OAAO,CAAE,2BAA2B,EAAE,GAAI;EAC3C;EAAA,CACCA,OAAO,CAAE,WAAW,EAAE,GAAI;EAC3B;EAAA,CACCA,OAAO,CAAE,SAAS,EAAE,EAAG;EACxB;EAAA,CACCA,OAAO,CAAE,oBAAoB,EAAE,EAAG;EACnC;EAAA,CACCC,WAAW,CAAC;EACb;EAAA,CACCD,OAAO,CAAE,KAAK,EAAE,GAAI;EACrB;EAAA,CACCA,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;AAEjC","ignoreList":[]}
1
+ {"version":3,"names":["removeAccents","cleanForSlug","string","replace","toLowerCase"],"sources":["@wordpress/url/src/clean-for-slug.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,gBAAgB;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,MAAc,EAAW;EACtD,IAAK,CAAEA,MAAM,EAAG;IACf,OAAO,EAAE;EACV;EACA,OACCF,aAAa,CAAEE,MAAO;EACrB;EAAA,CACCC,OAAO,CAAE,2BAA2B,EAAE,GAAI;EAC3C;EAAA,CACCA,OAAO,CAAE,WAAW,EAAE,GAAI;EAC3B;EAAA,CACCA,OAAO,CAAE,SAAS,EAAE,EAAG;EACxB;EAAA,CACCA,OAAO,CAAE,oBAAoB,EAAE,EAAG;EACnC;EAAA,CACCC,WAAW,CAAC;EACb;EAAA,CACCD,OAAO,CAAE,KAAK,EAAE,GAAI;EACrB;EAAA,CACCA,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;AAEjC","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Returns a URL for display.
3
3
  *
4
- * @param {string} url Original URL.
5
- * @param {number|null} maxLength URL length.
4
+ * @param url Original URL.
5
+ * @param maxLength URL length.
6
6
  *
7
7
  * @example
8
8
  * ```js
@@ -10,7 +10,7 @@
10
10
  * const imageUrl = filterURLForDisplay( 'https://www.wordpress.org/wp-content/uploads/img.png', 20 ); // …ent/uploads/img.png
11
11
  * ```
12
12
  *
13
- * @return {string} Displayed URL.
13
+ * @return Displayed URL.
14
14
  */
15
15
  export function filterURLForDisplay(url, maxLength = null) {
16
16
  if (!url) {
@@ -1 +1 @@
1
- {"version":3,"names":["filterURLForDisplay","url","maxLength","filteredURL","replace","match","fileRegexp","length","split","urlPieces","file","slice","index","lastIndexOf","fileName","extension","truncatedFile"],"sources":["@wordpress/url/src/filter-url-for-display.js"],"sourcesContent":["/**\n * Returns a URL for display.\n *\n * @param {string} url Original URL.\n * @param {number|null} 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 ); // …ent/uploads/img.png\n * ```\n *\n * @return {string} Displayed URL.\n */\nexport function filterURLForDisplay( url, maxLength = null ) {\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 '…' + 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'…' +\n\t\ttruncatedFile\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAmBA,CAAEC,GAAG,EAAEC,SAAS,GAAG,IAAI,EAAG;EAC5D,IAAK,CAAED,GAAG,EAAG;IACZ,OAAO,EAAE;EACV;;EAEA;EACA,IAAIE,WAAW,GAAGF,GAAG,CACnBG,OAAO,CAAE,6BAA6B,EAAE,EAAG,CAAC,CAC5CA,OAAO,CAAE,SAAS,EAAE,EAAG,CAAC;;EAE1B;EACA,IAAKD,WAAW,CAACE,KAAK,CAAE,YAAa,CAAC,EAAG;IACxCF,WAAW,GAAGA,WAAW,CAACC,OAAO,CAAE,GAAG,EAAE,EAAG,CAAC;EAC7C;;EAEA;EACA,MAAME,UAAU,GAAG,gCAAgC;EAEnD,IACC,CAAEJ,SAAS,IACXC,WAAW,CAACI,MAAM,IAAIL,SAAS,IAC/B,CAAEC,WAAW,CAACE,KAAK,CAAEC,UAAW,CAAC,EAChC;IACD,OAAOH,WAAW;EACnB;;EAEA;EACAA,WAAW,GAAGA,WAAW,CAACK,KAAK,CAAE,GAAI,CAAC,CAAE,CAAC,CAAE;EAC3C,MAAMC,SAAS,GAAGN,WAAW,CAACK,KAAK,CAAE,GAAI,CAAC;EAC1C,MAAME,IAAI,GAAGD,SAAS,CAAEA,SAAS,CAACF,MAAM,GAAG,CAAC,CAAE;EAC9C,IAAKG,IAAI,CAACH,MAAM,IAAIL,SAAS,EAAG;IAC/B,OAAO,GAAG,GAAGC,WAAW,CAACQ,KAAK,CAAE,CAACT,SAAU,CAAC;EAC7C;;EAEA;EACA,MAAMU,KAAK,GAAGF,IAAI,CAACG,WAAW,CAAE,GAAI,CAAC;EACrC,MAAM,CAAEC,QAAQ,EAAEC,SAAS,CAAE,GAAG,CAC/BL,IAAI,CAACC,KAAK,CAAE,CAAC,EAAEC,KAAM,CAAC,EACtBF,IAAI,CAACC,KAAK,CAAEC,KAAK,GAAG,CAAE,CAAC,CACvB;EACD,MAAMI,aAAa,GAAGF,QAAQ,CAACH,KAAK,CAAE,CAAC,CAAE,CAAC,GAAG,GAAG,GAAGI,SAAS;EAC5D,OACCL,IAAI,CAACC,KAAK,CAAE,CAAC,EAAET,SAAS,GAAGc,aAAa,CAACT,MAAM,GAAG,CAAE,CAAC,GACrD,GAAG,GACHS,aAAa;AAEf","ignoreList":[]}
1
+ {"version":3,"names":["filterURLForDisplay","url","maxLength","filteredURL","replace","match","fileRegexp","length","split","urlPieces","file","slice","index","lastIndexOf","fileName","extension","truncatedFile"],"sources":["@wordpress/url/src/filter-url-for-display.ts"],"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 ); // …ent/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 '…' + 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'…' +\n\t\ttruncatedFile\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAmBA,CAClCC,GAAW,EACXC,SAAwB,GAAG,IAAI,EACtB;EACT,IAAK,CAAED,GAAG,EAAG;IACZ,OAAO,EAAE;EACV;;EAEA;EACA,IAAIE,WAAW,GAAGF,GAAG,CACnBG,OAAO,CAAE,6BAA6B,EAAE,EAAG,CAAC,CAC5CA,OAAO,CAAE,SAAS,EAAE,EAAG,CAAC;;EAE1B;EACA,IAAKD,WAAW,CAACE,KAAK,CAAE,YAAa,CAAC,EAAG;IACxCF,WAAW,GAAGA,WAAW,CAACC,OAAO,CAAE,GAAG,EAAE,EAAG,CAAC;EAC7C;;EAEA;EACA,MAAME,UAAU,GAAG,gCAAgC;EAEnD,IACC,CAAEJ,SAAS,IACXC,WAAW,CAACI,MAAM,IAAIL,SAAS,IAC/B,CAAEC,WAAW,CAACE,KAAK,CAAEC,UAAW,CAAC,EAChC;IACD,OAAOH,WAAW;EACnB;;EAEA;EACAA,WAAW,GAAGA,WAAW,CAACK,KAAK,CAAE,GAAI,CAAC,CAAE,CAAC,CAAE;EAC3C,MAAMC,SAAS,GAAGN,WAAW,CAACK,KAAK,CAAE,GAAI,CAAC;EAC1C,MAAME,IAAI,GAAGD,SAAS,CAAEA,SAAS,CAACF,MAAM,GAAG,CAAC,CAAE;EAC9C,IAAKG,IAAI,CAACH,MAAM,IAAIL,SAAS,EAAG;IAC/B,OAAO,GAAG,GAAGC,WAAW,CAACQ,KAAK,CAAE,CAACT,SAAU,CAAC;EAC7C;;EAEA;EACA,MAAMU,KAAK,GAAGF,IAAI,CAACG,WAAW,CAAE,GAAI,CAAC;EACrC,MAAM,CAAEC,QAAQ,EAAEC,SAAS,CAAE,GAAG,CAC/BL,IAAI,CAACC,KAAK,CAAE,CAAC,EAAEC,KAAM,CAAC,EACtBF,IAAI,CAACC,KAAK,CAAEC,KAAK,GAAG,CAAE,CAAC,CACvB;EACD,MAAMI,aAAa,GAAGF,QAAQ,CAACH,KAAK,CAAE,CAAC,CAAE,CAAC,GAAG,GAAG,GAAGI,SAAS;EAC5D,OACCL,IAAI,CAACC,KAAK,CAAE,CAAC,EAAET,SAAS,GAAGc,aAAa,CAACT,MAAM,GAAG,CAAE,CAAC,GACrD,GAAG,GACHS,aAAa;AAEf","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Returns the authority part of the URL.
3
3
  *
4
- * @param {string} url The full URL.
4
+ * @param url The full URL.
5
5
  *
6
6
  * @example
7
7
  * ```js
@@ -9,7 +9,7 @@
9
9
  * const authority2 = getAuthority( 'https://localhost:8080/test/' ); // 'localhost:8080'
10
10
  * ```
11
11
  *
12
- * @return {string|void} The authority part of the URL.
12
+ * @return The authority part of the URL.
13
13
  */
14
14
  export function getAuthority(url) {
15
15
  const matches = /^[^\/\s:]+:(?:\/\/)?\/?([^\/\s#?]+)[\/#?]{0,1}\S*$/.exec(url);
@@ -1 +1 @@
1
- {"version":3,"names":["getAuthority","url","matches","exec"],"sources":["@wordpress/url/src/get-authority.js"],"sourcesContent":["/**\n * Returns the authority part of the URL.\n *\n * @param {string} 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 {string|void} The authority part of the URL.\n */\nexport function getAuthority( url ) {\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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,YAAYA,CAAEC,GAAG,EAAG;EACnC,MAAMC,OAAO,GAAG,oDAAoD,CAACC,IAAI,CACxEF,GACD,CAAC;EACD,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
1
+ {"version":3,"names":["getAuthority","url","matches","exec"],"sources":["@wordpress/url/src/get-authority.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,YAAYA,CAAEC,GAAW,EAAkB;EAC1D,MAAMC,OAAO,GAAG,oDAAoD,CAACC,IAAI,CACxEF,GACD,CAAC;EACD,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Returns the filename part of the URL.
4
4
  *
5
- * @param {string} url The full URL.
5
+ * @param url The full URL.
6
6
  *
7
7
  * @example
8
8
  * ```js
@@ -10,7 +10,7 @@
10
10
  * const filename2 = getFilename( '/this/is/a/test.png' ); // 'test.png'
11
11
  * ```
12
12
  *
13
- * @return {string|void} The filename part of the URL.
13
+ * @return The filename part of the URL.
14
14
  */
15
15
  export function getFilename(url) {
16
16
  let filename;
@@ -1 +1 @@
1
- {"version":3,"names":["getFilename","url","filename","URL","pathname","split","pop","error"],"sources":["@wordpress/url/src/get-filename.js"],"sourcesContent":["/**\n * Returns the filename part of the URL.\n *\n * @param {string} 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 {string|void} The filename part of the URL.\n */\nexport function getFilename( url ) {\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"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,WAAWA,CAAEC,GAAG,EAAG;EAClC,IAAIC,QAAQ;EAEZ,IAAK,CAAED,GAAG,EAAG;IACZ;EACD;EAEA,IAAI;IACHC,QAAQ,GAAG,IAAIC,GAAG,CAAEF,GAAG,EAAE,oBAAqB,CAAC,CAACG,QAAQ,CACtDC,KAAK,CAAE,GAAI,CAAC,CACZC,GAAG,CAAC,CAAC;EACR,CAAC,CAAC,OAAQC,KAAK,EAAG,CAAC;EAEnB,IAAKL,QAAQ,EAAG;IACf,OAAOA,QAAQ;EAChB;AACD","ignoreList":[]}
1
+ {"version":3,"names":["getFilename","url","filename","URL","pathname","split","pop","error"],"sources":["@wordpress/url/src/get-filename.ts"],"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"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,WAAWA,CAAEC,GAAW,EAAkB;EACzD,IAAIC,QAAQ;EAEZ,IAAK,CAAED,GAAG,EAAG;IACZ;EACD;EAEA,IAAI;IACHC,QAAQ,GAAG,IAAIC,GAAG,CAAEF,GAAG,EAAE,oBAAqB,CAAC,CAACG,QAAQ,CACtDC,KAAK,CAAE,GAAI,CAAC,CACZC,GAAG,CAAC,CAAC;EACR,CAAC,CAAC,OAAQC,KAAK,EAAG,CAAC;EAEnB,IAAKL,QAAQ,EAAG;IACf,OAAOA,QAAQ;EAChB;AACD","ignoreList":[]}