@ht-sdks/events-sdk-js-browser 1.0.4

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 (689) hide show
  1. package/LICENSE.MD +45 -0
  2. package/README.md +227 -0
  3. package/dist/cjs/browser/browser-umd.js +21 -0
  4. package/dist/cjs/browser/browser-umd.js.map +1 -0
  5. package/dist/cjs/browser/index.js +351 -0
  6. package/dist/cjs/browser/index.js.map +1 -0
  7. package/dist/cjs/browser/standalone-analytics.js +62 -0
  8. package/dist/cjs/browser/standalone-analytics.js.map +1 -0
  9. package/dist/cjs/browser/standalone-interface.js +3 -0
  10. package/dist/cjs/browser/standalone-interface.js.map +1 -0
  11. package/dist/cjs/browser/standalone.js +95 -0
  12. package/dist/cjs/browser/standalone.js.map +1 -0
  13. package/dist/cjs/core/analytics/index.js +589 -0
  14. package/dist/cjs/core/analytics/index.js.map +1 -0
  15. package/dist/cjs/core/analytics/interfaces.js +3 -0
  16. package/dist/cjs/core/analytics/interfaces.js.map +1 -0
  17. package/dist/cjs/core/arguments-resolver/index.js +134 -0
  18. package/dist/cjs/core/arguments-resolver/index.js.map +1 -0
  19. package/dist/cjs/core/auto-track.js +108 -0
  20. package/dist/cjs/core/auto-track.js.map +1 -0
  21. package/dist/cjs/core/buffer/index.js +303 -0
  22. package/dist/cjs/core/buffer/index.js.map +1 -0
  23. package/dist/cjs/core/callback/index.js +7 -0
  24. package/dist/cjs/core/callback/index.js.map +1 -0
  25. package/dist/cjs/core/connection/index.js +16 -0
  26. package/dist/cjs/core/connection/index.js.map +1 -0
  27. package/dist/cjs/core/constants/index.js +5 -0
  28. package/dist/cjs/core/constants/index.js.map +1 -0
  29. package/dist/cjs/core/context/index.js +19 -0
  30. package/dist/cjs/core/context/index.js.map +1 -0
  31. package/dist/cjs/core/environment/index.js +12 -0
  32. package/dist/cjs/core/environment/index.js.map +1 -0
  33. package/dist/cjs/core/events/index.js +138 -0
  34. package/dist/cjs/core/events/index.js.map +1 -0
  35. package/dist/cjs/core/events/interfaces.js +3 -0
  36. package/dist/cjs/core/events/interfaces.js.map +1 -0
  37. package/dist/cjs/core/inspector/index.js +14 -0
  38. package/dist/cjs/core/inspector/index.js.map +1 -0
  39. package/dist/cjs/core/page/add-page-context.js +25 -0
  40. package/dist/cjs/core/page/add-page-context.js.map +1 -0
  41. package/dist/cjs/core/page/get-page-context.js +92 -0
  42. package/dist/cjs/core/page/get-page-context.js.map +1 -0
  43. package/dist/cjs/core/page/index.js +6 -0
  44. package/dist/cjs/core/page/index.js.map +1 -0
  45. package/dist/cjs/core/plugin/index.js +3 -0
  46. package/dist/cjs/core/plugin/index.js.map +1 -0
  47. package/dist/cjs/core/query-string/gracefulDecodeURIComponent.js +20 -0
  48. package/dist/cjs/core/query-string/gracefulDecodeURIComponent.js.map +1 -0
  49. package/dist/cjs/core/query-string/index.js +48 -0
  50. package/dist/cjs/core/query-string/index.js.map +1 -0
  51. package/dist/cjs/core/query-string/pickPrefix.js +20 -0
  52. package/dist/cjs/core/query-string/pickPrefix.js.map +1 -0
  53. package/dist/cjs/core/queue/event-queue.js +27 -0
  54. package/dist/cjs/core/queue/event-queue.js.map +1 -0
  55. package/dist/cjs/core/session/index.js +71 -0
  56. package/dist/cjs/core/session/index.js.map +1 -0
  57. package/dist/cjs/core/stats/index.js +23 -0
  58. package/dist/cjs/core/stats/index.js.map +1 -0
  59. package/dist/cjs/core/stats/remote-metrics.js +111 -0
  60. package/dist/cjs/core/stats/remote-metrics.js.map +1 -0
  61. package/dist/cjs/core/storage/cookieStorage.js +72 -0
  62. package/dist/cjs/core/storage/cookieStorage.js.map +1 -0
  63. package/dist/cjs/core/storage/index.js +64 -0
  64. package/dist/cjs/core/storage/index.js.map +1 -0
  65. package/dist/cjs/core/storage/localStorage.js +51 -0
  66. package/dist/cjs/core/storage/localStorage.js.map +1 -0
  67. package/dist/cjs/core/storage/memoryStorage.js +24 -0
  68. package/dist/cjs/core/storage/memoryStorage.js.map +1 -0
  69. package/dist/cjs/core/storage/settings.js +16 -0
  70. package/dist/cjs/core/storage/settings.js.map +1 -0
  71. package/dist/cjs/core/storage/types.js +9 -0
  72. package/dist/cjs/core/storage/types.js.map +1 -0
  73. package/dist/cjs/core/storage/universalStorage.js +66 -0
  74. package/dist/cjs/core/storage/universalStorage.js.map +1 -0
  75. package/dist/cjs/core/user/index.js +273 -0
  76. package/dist/cjs/core/user/index.js.map +1 -0
  77. package/dist/cjs/core/user/migrate.js +114 -0
  78. package/dist/cjs/core/user/migrate.js.map +1 -0
  79. package/dist/cjs/core/user/tld.js +64 -0
  80. package/dist/cjs/core/user/tld.js.map +1 -0
  81. package/dist/cjs/core/user/vendor/crypto-es/lib/aes.js +248 -0
  82. package/dist/cjs/core/user/vendor/crypto-es/lib/aes.js.map +1 -0
  83. package/dist/cjs/core/user/vendor/crypto-es/lib/cipher-core.js +841 -0
  84. package/dist/cjs/core/user/vendor/crypto-es/lib/cipher-core.js.map +1 -0
  85. package/dist/cjs/core/user/vendor/crypto-es/lib/core.js +747 -0
  86. package/dist/cjs/core/user/vendor/crypto-es/lib/core.js.map +1 -0
  87. package/dist/cjs/core/user/vendor/crypto-es/lib/enc-base64.js +102 -0
  88. package/dist/cjs/core/user/vendor/crypto-es/lib/enc-base64.js.map +1 -0
  89. package/dist/cjs/core/user/vendor/crypto-es/lib/evpkdf.js +105 -0
  90. package/dist/cjs/core/user/vendor/crypto-es/lib/evpkdf.js.map +1 -0
  91. package/dist/cjs/core/user/vendor/crypto-es/lib/md5.js +217 -0
  92. package/dist/cjs/core/user/vendor/crypto-es/lib/md5.js.map +1 -0
  93. package/dist/cjs/generated/version.js +6 -0
  94. package/dist/cjs/generated/version.js.map +1 -0
  95. package/dist/cjs/index.js +16 -0
  96. package/dist/cjs/index.js.map +1 -0
  97. package/dist/cjs/lib/bind-all.js +17 -0
  98. package/dist/cjs/lib/bind-all.js.map +1 -0
  99. package/dist/cjs/lib/browser-polyfill.js +22 -0
  100. package/dist/cjs/lib/browser-polyfill.js.map +1 -0
  101. package/dist/cjs/lib/client-hints/index.js +21 -0
  102. package/dist/cjs/lib/client-hints/index.js.map +1 -0
  103. package/dist/cjs/lib/client-hints/interfaces.js +3 -0
  104. package/dist/cjs/lib/client-hints/interfaces.js.map +1 -0
  105. package/dist/cjs/lib/create-deferred.js +21 -0
  106. package/dist/cjs/lib/create-deferred.js.map +1 -0
  107. package/dist/cjs/lib/csp-detection.js +8 -0
  108. package/dist/cjs/lib/csp-detection.js.map +1 -0
  109. package/dist/cjs/lib/embedded-write-key.js +22 -0
  110. package/dist/cjs/lib/embedded-write-key.js.map +1 -0
  111. package/dist/cjs/lib/fetch.js +19 -0
  112. package/dist/cjs/lib/fetch.js.map +1 -0
  113. package/dist/cjs/lib/get-global.js +21 -0
  114. package/dist/cjs/lib/get-global.js.map +1 -0
  115. package/dist/cjs/lib/get-process-env.js +15 -0
  116. package/dist/cjs/lib/get-process-env.js.map +1 -0
  117. package/dist/cjs/lib/global-analytics-helper.js +34 -0
  118. package/dist/cjs/lib/global-analytics-helper.js.map +1 -0
  119. package/dist/cjs/lib/group-by.js +28 -0
  120. package/dist/cjs/lib/group-by.js.map +1 -0
  121. package/dist/cjs/lib/is-plan-event-enabled.js +20 -0
  122. package/dist/cjs/lib/is-plan-event-enabled.js.map +1 -0
  123. package/dist/cjs/lib/is-thenable.js +15 -0
  124. package/dist/cjs/lib/is-thenable.js.map +1 -0
  125. package/dist/cjs/lib/load-script.js +56 -0
  126. package/dist/cjs/lib/load-script.js.map +1 -0
  127. package/dist/cjs/lib/merged-options.js +31 -0
  128. package/dist/cjs/lib/merged-options.js.map +1 -0
  129. package/dist/cjs/lib/on-page-change.js +35 -0
  130. package/dist/cjs/lib/on-page-change.js.map +1 -0
  131. package/dist/cjs/lib/p-while.js +25 -0
  132. package/dist/cjs/lib/p-while.js.map +1 -0
  133. package/dist/cjs/lib/parse-cdn.js +55 -0
  134. package/dist/cjs/lib/parse-cdn.js.map +1 -0
  135. package/dist/cjs/lib/pick.js +19 -0
  136. package/dist/cjs/lib/pick.js.map +1 -0
  137. package/dist/cjs/lib/priority-queue/backoff.js +10 -0
  138. package/dist/cjs/lib/priority-queue/backoff.js.map +1 -0
  139. package/dist/cjs/lib/priority-queue/index.js +7 -0
  140. package/dist/cjs/lib/priority-queue/index.js.map +1 -0
  141. package/dist/cjs/lib/priority-queue/persisted.js +108 -0
  142. package/dist/cjs/lib/priority-queue/persisted.js.map +1 -0
  143. package/dist/cjs/lib/sleep.js +10 -0
  144. package/dist/cjs/lib/sleep.js.map +1 -0
  145. package/dist/cjs/lib/to-facade.js +32 -0
  146. package/dist/cjs/lib/to-facade.js.map +1 -0
  147. package/dist/cjs/lib/version-type.js +14 -0
  148. package/dist/cjs/lib/version-type.js.map +1 -0
  149. package/dist/cjs/node/index.js +43 -0
  150. package/dist/cjs/node/index.js.map +1 -0
  151. package/dist/cjs/node/node.browser.js +13 -0
  152. package/dist/cjs/node/node.browser.js.map +1 -0
  153. package/dist/cjs/plugins/ajs-destination/index.js +345 -0
  154. package/dist/cjs/plugins/ajs-destination/index.js.map +1 -0
  155. package/dist/cjs/plugins/ajs-destination/loader.js +110 -0
  156. package/dist/cjs/plugins/ajs-destination/loader.js.map +1 -0
  157. package/dist/cjs/plugins/ajs-destination/types.js +3 -0
  158. package/dist/cjs/plugins/ajs-destination/types.js.map +1 -0
  159. package/dist/cjs/plugins/ajs-destination/utils.js +23 -0
  160. package/dist/cjs/plugins/ajs-destination/utils.js.map +1 -0
  161. package/dist/cjs/plugins/analytics-node/index.js +65 -0
  162. package/dist/cjs/plugins/analytics-node/index.js.map +1 -0
  163. package/dist/cjs/plugins/env-enrichment/index.js +181 -0
  164. package/dist/cjs/plugins/env-enrichment/index.js.map +1 -0
  165. package/dist/cjs/plugins/hightouchio/batched-dispatcher.js +113 -0
  166. package/dist/cjs/plugins/hightouchio/batched-dispatcher.js.map +1 -0
  167. package/dist/cjs/plugins/hightouchio/fetch-dispatcher.js +21 -0
  168. package/dist/cjs/plugins/hightouchio/fetch-dispatcher.js.map +1 -0
  169. package/dist/cjs/plugins/hightouchio/index.js +100 -0
  170. package/dist/cjs/plugins/hightouchio/index.js.map +1 -0
  171. package/dist/cjs/plugins/hightouchio/normalize.js +54 -0
  172. package/dist/cjs/plugins/hightouchio/normalize.js.map +1 -0
  173. package/dist/cjs/plugins/hightouchio/schedule-flush.js +76 -0
  174. package/dist/cjs/plugins/hightouchio/schedule-flush.js.map +1 -0
  175. package/dist/cjs/plugins/legacy-video-plugins/index.js +25 -0
  176. package/dist/cjs/plugins/legacy-video-plugins/index.js.map +1 -0
  177. package/dist/cjs/plugins/middleware/index.js +124 -0
  178. package/dist/cjs/plugins/middleware/index.js.map +1 -0
  179. package/dist/cjs/plugins/remote-loader/index.js +236 -0
  180. package/dist/cjs/plugins/remote-loader/index.js.map +1 -0
  181. package/dist/cjs/plugins/remote-middleware/index.js +70 -0
  182. package/dist/cjs/plugins/remote-middleware/index.js.map +1 -0
  183. package/dist/cjs/plugins/routing-middleware/index.js +26 -0
  184. package/dist/cjs/plugins/routing-middleware/index.js.map +1 -0
  185. package/dist/cjs/plugins/schema-filter/index.js +67 -0
  186. package/dist/cjs/plugins/schema-filter/index.js.map +1 -0
  187. package/dist/cjs/plugins/validation/index.js +33 -0
  188. package/dist/cjs/plugins/validation/index.js.map +1 -0
  189. package/dist/pkg/browser/browser-umd.js +18 -0
  190. package/dist/pkg/browser/browser-umd.js.map +1 -0
  191. package/dist/pkg/browser/index.js +347 -0
  192. package/dist/pkg/browser/index.js.map +1 -0
  193. package/dist/pkg/browser/standalone-analytics.js +58 -0
  194. package/dist/pkg/browser/standalone-analytics.js.map +1 -0
  195. package/dist/pkg/browser/standalone-interface.js +2 -0
  196. package/dist/pkg/browser/standalone-interface.js.map +1 -0
  197. package/dist/pkg/browser/standalone.js +93 -0
  198. package/dist/pkg/browser/standalone.js.map +1 -0
  199. package/dist/pkg/core/analytics/index.js +586 -0
  200. package/dist/pkg/core/analytics/index.js.map +1 -0
  201. package/dist/pkg/core/analytics/interfaces.js +2 -0
  202. package/dist/pkg/core/analytics/interfaces.js.map +1 -0
  203. package/dist/pkg/core/arguments-resolver/index.js +127 -0
  204. package/dist/pkg/core/arguments-resolver/index.js.map +1 -0
  205. package/dist/pkg/core/auto-track.js +103 -0
  206. package/dist/pkg/core/auto-track.js.map +1 -0
  207. package/dist/pkg/core/buffer/index.js +295 -0
  208. package/dist/pkg/core/buffer/index.js.map +1 -0
  209. package/dist/pkg/core/callback/index.js +2 -0
  210. package/dist/pkg/core/callback/index.js.map +1 -0
  211. package/dist/pkg/core/connection/index.js +11 -0
  212. package/dist/pkg/core/connection/index.js.map +1 -0
  213. package/dist/pkg/core/constants/index.js +2 -0
  214. package/dist/pkg/core/constants/index.js.map +1 -0
  215. package/dist/pkg/core/context/index.js +16 -0
  216. package/dist/pkg/core/context/index.js.map +1 -0
  217. package/dist/pkg/core/environment/index.js +7 -0
  218. package/dist/pkg/core/environment/index.js.map +1 -0
  219. package/dist/pkg/core/events/index.js +135 -0
  220. package/dist/pkg/core/events/index.js.map +1 -0
  221. package/dist/pkg/core/events/interfaces.js +2 -0
  222. package/dist/pkg/core/events/interfaces.js.map +1 -0
  223. package/dist/pkg/core/inspector/index.js +10 -0
  224. package/dist/pkg/core/inspector/index.js.map +1 -0
  225. package/dist/pkg/core/page/add-page-context.js +21 -0
  226. package/dist/pkg/core/page/add-page-context.js.map +1 -0
  227. package/dist/pkg/core/page/get-page-context.js +84 -0
  228. package/dist/pkg/core/page/get-page-context.js.map +1 -0
  229. package/dist/pkg/core/page/index.js +3 -0
  230. package/dist/pkg/core/page/index.js.map +1 -0
  231. package/dist/pkg/core/plugin/index.js +2 -0
  232. package/dist/pkg/core/plugin/index.js.map +1 -0
  233. package/dist/pkg/core/query-string/gracefulDecodeURIComponent.js +16 -0
  234. package/dist/pkg/core/query-string/gracefulDecodeURIComponent.js.map +1 -0
  235. package/dist/pkg/core/query-string/index.js +44 -0
  236. package/dist/pkg/core/query-string/index.js.map +1 -0
  237. package/dist/pkg/core/query-string/pickPrefix.js +16 -0
  238. package/dist/pkg/core/query-string/pickPrefix.js.map +1 -0
  239. package/dist/pkg/core/queue/event-queue.js +24 -0
  240. package/dist/pkg/core/queue/event-queue.js.map +1 -0
  241. package/dist/pkg/core/session/index.js +63 -0
  242. package/dist/pkg/core/session/index.js.map +1 -0
  243. package/dist/pkg/core/stats/index.js +20 -0
  244. package/dist/pkg/core/stats/index.js.map +1 -0
  245. package/dist/pkg/core/stats/remote-metrics.js +108 -0
  246. package/dist/pkg/core/stats/remote-metrics.js.map +1 -0
  247. package/dist/pkg/core/storage/cookieStorage.js +69 -0
  248. package/dist/pkg/core/storage/cookieStorage.js.map +1 -0
  249. package/dist/pkg/core/storage/index.js +58 -0
  250. package/dist/pkg/core/storage/index.js.map +1 -0
  251. package/dist/pkg/core/storage/localStorage.js +48 -0
  252. package/dist/pkg/core/storage/localStorage.js.map +1 -0
  253. package/dist/pkg/core/storage/memoryStorage.js +21 -0
  254. package/dist/pkg/core/storage/memoryStorage.js.map +1 -0
  255. package/dist/pkg/core/storage/settings.js +11 -0
  256. package/dist/pkg/core/storage/settings.js.map +1 -0
  257. package/dist/pkg/core/storage/types.js +6 -0
  258. package/dist/pkg/core/storage/types.js.map +1 -0
  259. package/dist/pkg/core/storage/universalStorage.js +63 -0
  260. package/dist/pkg/core/storage/universalStorage.js.map +1 -0
  261. package/dist/pkg/core/user/index.js +270 -0
  262. package/dist/pkg/core/user/index.js.map +1 -0
  263. package/dist/pkg/core/user/migrate.js +109 -0
  264. package/dist/pkg/core/user/migrate.js.map +1 -0
  265. package/dist/pkg/core/user/tld.js +59 -0
  266. package/dist/pkg/core/user/tld.js.map +1 -0
  267. package/dist/pkg/core/user/vendor/crypto-es/lib/aes.js +245 -0
  268. package/dist/pkg/core/user/vendor/crypto-es/lib/aes.js.map +1 -0
  269. package/dist/pkg/core/user/vendor/crypto-es/lib/cipher-core.js +838 -0
  270. package/dist/pkg/core/user/vendor/crypto-es/lib/cipher-core.js.map +1 -0
  271. package/dist/pkg/core/user/vendor/crypto-es/lib/core.js +744 -0
  272. package/dist/pkg/core/user/vendor/crypto-es/lib/core.js.map +1 -0
  273. package/dist/pkg/core/user/vendor/crypto-es/lib/enc-base64.js +98 -0
  274. package/dist/pkg/core/user/vendor/crypto-es/lib/enc-base64.js.map +1 -0
  275. package/dist/pkg/core/user/vendor/crypto-es/lib/evpkdf.js +101 -0
  276. package/dist/pkg/core/user/vendor/crypto-es/lib/evpkdf.js.map +1 -0
  277. package/dist/pkg/core/user/vendor/crypto-es/lib/md5.js +214 -0
  278. package/dist/pkg/core/user/vendor/crypto-es/lib/md5.js.map +1 -0
  279. package/dist/pkg/generated/version.js +3 -0
  280. package/dist/pkg/generated/version.js.map +1 -0
  281. package/dist/pkg/index.js +10 -0
  282. package/dist/pkg/index.js.map +1 -0
  283. package/dist/pkg/lib/bind-all.js +14 -0
  284. package/dist/pkg/lib/bind-all.js.map +1 -0
  285. package/dist/pkg/lib/browser-polyfill.js +18 -0
  286. package/dist/pkg/lib/browser-polyfill.js.map +1 -0
  287. package/dist/pkg/lib/client-hints/index.js +17 -0
  288. package/dist/pkg/lib/client-hints/index.js.map +1 -0
  289. package/dist/pkg/lib/client-hints/interfaces.js +2 -0
  290. package/dist/pkg/lib/client-hints/interfaces.js.map +1 -0
  291. package/dist/pkg/lib/create-deferred.js +17 -0
  292. package/dist/pkg/lib/create-deferred.js.map +1 -0
  293. package/dist/pkg/lib/csp-detection.js +4 -0
  294. package/dist/pkg/lib/csp-detection.js.map +1 -0
  295. package/dist/pkg/lib/embedded-write-key.js +18 -0
  296. package/dist/pkg/lib/embedded-write-key.js.map +1 -0
  297. package/dist/pkg/lib/fetch.js +14 -0
  298. package/dist/pkg/lib/fetch.js.map +1 -0
  299. package/dist/pkg/lib/get-global.js +17 -0
  300. package/dist/pkg/lib/get-global.js.map +1 -0
  301. package/dist/pkg/lib/get-process-env.js +11 -0
  302. package/dist/pkg/lib/get-process-env.js.map +1 -0
  303. package/dist/pkg/lib/global-analytics-helper.js +28 -0
  304. package/dist/pkg/lib/global-analytics-helper.js.map +1 -0
  305. package/dist/pkg/lib/group-by.js +24 -0
  306. package/dist/pkg/lib/group-by.js.map +1 -0
  307. package/dist/pkg/lib/is-plan-event-enabled.js +16 -0
  308. package/dist/pkg/lib/is-plan-event-enabled.js.map +1 -0
  309. package/dist/pkg/lib/is-thenable.js +11 -0
  310. package/dist/pkg/lib/is-thenable.js.map +1 -0
  311. package/dist/pkg/lib/load-script.js +51 -0
  312. package/dist/pkg/lib/load-script.js.map +1 -0
  313. package/dist/pkg/lib/merged-options.js +27 -0
  314. package/dist/pkg/lib/merged-options.js.map +1 -0
  315. package/dist/pkg/lib/on-page-change.js +31 -0
  316. package/dist/pkg/lib/on-page-change.js.map +1 -0
  317. package/dist/pkg/lib/p-while.js +21 -0
  318. package/dist/pkg/lib/p-while.js.map +1 -0
  319. package/dist/pkg/lib/parse-cdn.js +49 -0
  320. package/dist/pkg/lib/parse-cdn.js.map +1 -0
  321. package/dist/pkg/lib/pick.js +15 -0
  322. package/dist/pkg/lib/pick.js.map +1 -0
  323. package/dist/pkg/lib/priority-queue/backoff.js +6 -0
  324. package/dist/pkg/lib/priority-queue/backoff.js.map +1 -0
  325. package/dist/pkg/lib/priority-queue/index.js +3 -0
  326. package/dist/pkg/lib/priority-queue/index.js.map +1 -0
  327. package/dist/pkg/lib/priority-queue/persisted.js +105 -0
  328. package/dist/pkg/lib/priority-queue/persisted.js.map +1 -0
  329. package/dist/pkg/lib/sleep.js +6 -0
  330. package/dist/pkg/lib/sleep.js.map +1 -0
  331. package/dist/pkg/lib/to-facade.js +28 -0
  332. package/dist/pkg/lib/to-facade.js.map +1 -0
  333. package/dist/pkg/lib/version-type.js +9 -0
  334. package/dist/pkg/lib/version-type.js.map +1 -0
  335. package/dist/pkg/node/index.js +40 -0
  336. package/dist/pkg/node/index.js.map +1 -0
  337. package/dist/pkg/node/node.browser.js +10 -0
  338. package/dist/pkg/node/node.browser.js.map +1 -0
  339. package/dist/pkg/plugins/ajs-destination/index.js +341 -0
  340. package/dist/pkg/plugins/ajs-destination/index.js.map +1 -0
  341. package/dist/pkg/plugins/ajs-destination/loader.js +102 -0
  342. package/dist/pkg/plugins/ajs-destination/loader.js.map +1 -0
  343. package/dist/pkg/plugins/ajs-destination/types.js +2 -0
  344. package/dist/pkg/plugins/ajs-destination/types.js.map +1 -0
  345. package/dist/pkg/plugins/ajs-destination/utils.js +18 -0
  346. package/dist/pkg/plugins/ajs-destination/utils.js.map +1 -0
  347. package/dist/pkg/plugins/analytics-node/index.js +60 -0
  348. package/dist/pkg/plugins/analytics-node/index.js.map +1 -0
  349. package/dist/pkg/plugins/env-enrichment/index.js +176 -0
  350. package/dist/pkg/plugins/env-enrichment/index.js.map +1 -0
  351. package/dist/pkg/plugins/hightouchio/batched-dispatcher.js +110 -0
  352. package/dist/pkg/plugins/hightouchio/batched-dispatcher.js.map +1 -0
  353. package/dist/pkg/plugins/hightouchio/fetch-dispatcher.js +18 -0
  354. package/dist/pkg/plugins/hightouchio/fetch-dispatcher.js.map +1 -0
  355. package/dist/pkg/plugins/hightouchio/index.js +96 -0
  356. package/dist/pkg/plugins/hightouchio/index.js.map +1 -0
  357. package/dist/pkg/plugins/hightouchio/normalize.js +50 -0
  358. package/dist/pkg/plugins/hightouchio/normalize.js.map +1 -0
  359. package/dist/pkg/plugins/hightouchio/schedule-flush.js +72 -0
  360. package/dist/pkg/plugins/hightouchio/schedule-flush.js.map +1 -0
  361. package/dist/pkg/plugins/legacy-video-plugins/index.js +25 -0
  362. package/dist/pkg/plugins/legacy-video-plugins/index.js.map +1 -0
  363. package/dist/pkg/plugins/middleware/index.js +119 -0
  364. package/dist/pkg/plugins/middleware/index.js.map +1 -0
  365. package/dist/pkg/plugins/remote-loader/index.js +232 -0
  366. package/dist/pkg/plugins/remote-loader/index.js.map +1 -0
  367. package/dist/pkg/plugins/remote-middleware/index.js +66 -0
  368. package/dist/pkg/plugins/remote-middleware/index.js.map +1 -0
  369. package/dist/pkg/plugins/routing-middleware/index.js +21 -0
  370. package/dist/pkg/plugins/routing-middleware/index.js.map +1 -0
  371. package/dist/pkg/plugins/schema-filter/index.js +63 -0
  372. package/dist/pkg/plugins/schema-filter/index.js.map +1 -0
  373. package/dist/pkg/plugins/validation/index.js +30 -0
  374. package/dist/pkg/plugins/validation/index.js.map +1 -0
  375. package/dist/types/browser/browser-umd.d.ts +2 -0
  376. package/dist/types/browser/browser-umd.d.ts.map +1 -0
  377. package/dist/types/browser/index.d.ts +109 -0
  378. package/dist/types/browser/index.d.ts.map +1 -0
  379. package/dist/types/browser/standalone-analytics.d.ts +2 -0
  380. package/dist/types/browser/standalone-analytics.d.ts.map +1 -0
  381. package/dist/types/browser/standalone-interface.d.ts +10 -0
  382. package/dist/types/browser/standalone-interface.d.ts.map +1 -0
  383. package/dist/types/browser/standalone.d.ts +2 -0
  384. package/dist/types/browser/standalone.d.ts.map +1 -0
  385. package/dist/types/core/analytics/index.d.ts +149 -0
  386. package/dist/types/core/analytics/index.d.ts.map +1 -0
  387. package/dist/types/core/analytics/interfaces.d.ts +77 -0
  388. package/dist/types/core/analytics/interfaces.d.ts.map +1 -0
  389. package/dist/types/core/arguments-resolver/index.d.ts +34 -0
  390. package/dist/types/core/arguments-resolver/index.d.ts.map +1 -0
  391. package/dist/types/core/auto-track.d.ts +10 -0
  392. package/dist/types/core/auto-track.d.ts.map +1 -0
  393. package/dist/types/core/buffer/index.d.ts +102 -0
  394. package/dist/types/core/buffer/index.d.ts.map +1 -0
  395. package/dist/types/core/callback/index.d.ts +2 -0
  396. package/dist/types/core/callback/index.d.ts.map +1 -0
  397. package/dist/types/core/connection/index.d.ts +3 -0
  398. package/dist/types/core/connection/index.d.ts.map +1 -0
  399. package/dist/types/core/constants/index.d.ts +2 -0
  400. package/dist/types/core/constants/index.d.ts.map +1 -0
  401. package/dist/types/core/context/index.d.ts +9 -0
  402. package/dist/types/core/context/index.d.ts.map +1 -0
  403. package/dist/types/core/environment/index.d.ts +3 -0
  404. package/dist/types/core/environment/index.d.ts.map +1 -0
  405. package/dist/types/core/events/index.d.ts +22 -0
  406. package/dist/types/core/events/index.d.ts.map +1 -0
  407. package/dist/types/core/events/interfaces.d.ts +9 -0
  408. package/dist/types/core/events/interfaces.d.ts.map +1 -0
  409. package/dist/types/core/inspector/index.d.ts +3 -0
  410. package/dist/types/core/inspector/index.d.ts.map +1 -0
  411. package/dist/types/core/page/add-page-context.d.ts +9 -0
  412. package/dist/types/core/page/add-page-context.d.ts.map +1 -0
  413. package/dist/types/core/page/get-page-context.d.ts +45 -0
  414. package/dist/types/core/page/get-page-context.d.ts.map +1 -0
  415. package/dist/types/core/page/index.d.ts +3 -0
  416. package/dist/types/core/page/index.d.ts.map +1 -0
  417. package/dist/types/core/plugin/index.d.ts +11 -0
  418. package/dist/types/core/plugin/index.d.ts.map +1 -0
  419. package/dist/types/core/query-string/gracefulDecodeURIComponent.d.ts +9 -0
  420. package/dist/types/core/query-string/gracefulDecodeURIComponent.d.ts.map +1 -0
  421. package/dist/types/core/query-string/index.d.ts +7 -0
  422. package/dist/types/core/query-string/index.d.ts.map +1 -0
  423. package/dist/types/core/query-string/pickPrefix.d.ts +9 -0
  424. package/dist/types/core/query-string/pickPrefix.d.ts.map +1 -0
  425. package/dist/types/core/queue/event-queue.d.ts +10 -0
  426. package/dist/types/core/queue/event-queue.d.ts.map +1 -0
  427. package/dist/types/core/session/index.d.ts +32 -0
  428. package/dist/types/core/session/index.d.ts.map +1 -0
  429. package/dist/types/core/stats/index.d.ts +7 -0
  430. package/dist/types/core/stats/index.d.ts.map +1 -0
  431. package/dist/types/core/stats/remote-metrics.d.ts +32 -0
  432. package/dist/types/core/stats/remote-metrics.d.ts.map +1 -0
  433. package/dist/types/core/storage/cookieStorage.d.ts +21 -0
  434. package/dist/types/core/storage/cookieStorage.d.ts.map +1 -0
  435. package/dist/types/core/storage/index.d.ts +22 -0
  436. package/dist/types/core/storage/index.d.ts.map +1 -0
  437. package/dist/types/core/storage/localStorage.d.ts +11 -0
  438. package/dist/types/core/storage/localStorage.d.ts.map +1 -0
  439. package/dist/types/core/storage/memoryStorage.d.ts +11 -0
  440. package/dist/types/core/storage/memoryStorage.d.ts.map +1 -0
  441. package/dist/types/core/storage/settings.d.ts +8 -0
  442. package/dist/types/core/storage/settings.d.ts.map +1 -0
  443. package/dist/types/core/storage/types.d.ts +43 -0
  444. package/dist/types/core/storage/types.d.ts.map +1 -0
  445. package/dist/types/core/storage/universalStorage.d.ts +13 -0
  446. package/dist/types/core/storage/universalStorage.d.ts.map +1 -0
  447. package/dist/types/core/user/index.d.ts +81 -0
  448. package/dist/types/core/user/index.d.ts.map +1 -0
  449. package/dist/types/core/user/migrate.d.ts +11 -0
  450. package/dist/types/core/user/migrate.d.ts.map +1 -0
  451. package/dist/types/core/user/tld.d.ts +2 -0
  452. package/dist/types/core/user/tld.d.ts.map +1 -0
  453. package/dist/types/core/user/vendor/crypto-es/lib/aes.d.ts +23 -0
  454. package/dist/types/core/user/vendor/crypto-es/lib/aes.d.ts.map +1 -0
  455. package/dist/types/core/user/vendor/crypto-es/lib/cipher-core.d.ts +436 -0
  456. package/dist/types/core/user/vendor/crypto-es/lib/cipher-core.d.ts.map +1 -0
  457. package/dist/types/core/user/vendor/crypto-es/lib/core.d.ts +432 -0
  458. package/dist/types/core/user/vendor/crypto-es/lib/core.d.ts.map +1 -0
  459. package/dist/types/core/user/vendor/crypto-es/lib/enc-base64.d.ts +36 -0
  460. package/dist/types/core/user/vendor/crypto-es/lib/enc-base64.d.ts.map +1 -0
  461. package/dist/types/core/user/vendor/crypto-es/lib/evpkdf.d.ts +51 -0
  462. package/dist/types/core/user/vendor/crypto-es/lib/evpkdf.d.ts.map +1 -0
  463. package/dist/types/core/user/vendor/crypto-es/lib/md5.d.ts +41 -0
  464. package/dist/types/core/user/vendor/crypto-es/lib/md5.d.ts.map +1 -0
  465. package/dist/types/generated/version.d.ts +2 -0
  466. package/dist/types/generated/version.d.ts.map +1 -0
  467. package/dist/types/index.d.ts +12 -0
  468. package/dist/types/index.d.ts.map +1 -0
  469. package/dist/types/lib/bind-all.d.ts +4 -0
  470. package/dist/types/lib/bind-all.d.ts.map +1 -0
  471. package/dist/types/lib/browser-polyfill.d.ts +2 -0
  472. package/dist/types/lib/browser-polyfill.d.ts.map +1 -0
  473. package/dist/types/lib/client-hints/index.d.ts +3 -0
  474. package/dist/types/lib/client-hints/index.d.ts.map +1 -0
  475. package/dist/types/lib/client-hints/interfaces.d.ts +28 -0
  476. package/dist/types/lib/client-hints/interfaces.d.ts.map +1 -0
  477. package/dist/types/lib/create-deferred.d.ts +9 -0
  478. package/dist/types/lib/create-deferred.d.ts.map +1 -0
  479. package/dist/types/lib/csp-detection.d.ts +6 -0
  480. package/dist/types/lib/csp-detection.d.ts.map +1 -0
  481. package/dist/types/lib/embedded-write-key.d.ts +7 -0
  482. package/dist/types/lib/embedded-write-key.d.ts.map +1 -0
  483. package/dist/types/lib/fetch.d.ts +5 -0
  484. package/dist/types/lib/fetch.d.ts.map +1 -0
  485. package/dist/types/lib/get-global.d.ts +2 -0
  486. package/dist/types/lib/get-global.d.ts.map +1 -0
  487. package/dist/types/lib/get-process-env.d.ts +8 -0
  488. package/dist/types/lib/get-process-env.d.ts.map +1 -0
  489. package/dist/types/lib/global-analytics-helper.d.ts +18 -0
  490. package/dist/types/lib/global-analytics-helper.d.ts.map +1 -0
  491. package/dist/types/lib/group-by.d.ts +4 -0
  492. package/dist/types/lib/group-by.d.ts.map +1 -0
  493. package/dist/types/lib/is-plan-event-enabled.d.ts +9 -0
  494. package/dist/types/lib/is-plan-event-enabled.d.ts.map +1 -0
  495. package/dist/types/lib/is-thenable.d.ts +6 -0
  496. package/dist/types/lib/is-thenable.d.ts.map +1 -0
  497. package/dist/types/lib/load-script.d.ts +3 -0
  498. package/dist/types/lib/load-script.d.ts.map +1 -0
  499. package/dist/types/lib/merged-options.d.ts +13 -0
  500. package/dist/types/lib/merged-options.d.ts.map +1 -0
  501. package/dist/types/lib/on-page-change.d.ts +11 -0
  502. package/dist/types/lib/on-page-change.d.ts.map +1 -0
  503. package/dist/types/lib/p-while.d.ts +2 -0
  504. package/dist/types/lib/p-while.d.ts.map +1 -0
  505. package/dist/types/lib/parse-cdn.d.ts +4 -0
  506. package/dist/types/lib/parse-cdn.d.ts.map +1 -0
  507. package/dist/types/lib/pick.d.ts +3 -0
  508. package/dist/types/lib/pick.d.ts.map +1 -0
  509. package/dist/types/lib/priority-queue/backoff.d.ts +13 -0
  510. package/dist/types/lib/priority-queue/backoff.d.ts.map +1 -0
  511. package/dist/types/lib/priority-queue/index.d.ts +3 -0
  512. package/dist/types/lib/priority-queue/index.d.ts.map +1 -0
  513. package/dist/types/lib/priority-queue/persisted.d.ts +6 -0
  514. package/dist/types/lib/priority-queue/persisted.d.ts.map +1 -0
  515. package/dist/types/lib/sleep.d.ts +2 -0
  516. package/dist/types/lib/sleep.d.ts.map +1 -0
  517. package/dist/types/lib/to-facade.d.ts +7 -0
  518. package/dist/types/lib/to-facade.d.ts.map +1 -0
  519. package/dist/types/lib/version-type.d.ts +5 -0
  520. package/dist/types/lib/version-type.d.ts.map +1 -0
  521. package/dist/types/node/index.d.ts +8 -0
  522. package/dist/types/node/index.d.ts.map +1 -0
  523. package/dist/types/node/node.browser.d.ts +4 -0
  524. package/dist/types/node/node.browser.d.ts.map +1 -0
  525. package/dist/types/plugins/ajs-destination/index.d.ts +42 -0
  526. package/dist/types/plugins/ajs-destination/index.d.ts.map +1 -0
  527. package/dist/types/plugins/ajs-destination/loader.d.ts +12 -0
  528. package/dist/types/plugins/ajs-destination/loader.d.ts.map +1 -0
  529. package/dist/types/plugins/ajs-destination/types.d.ts +36 -0
  530. package/dist/types/plugins/ajs-destination/types.d.ts.map +1 -0
  531. package/dist/types/plugins/ajs-destination/utils.d.ts +5 -0
  532. package/dist/types/plugins/ajs-destination/utils.d.ts.map +1 -0
  533. package/dist/types/plugins/analytics-node/index.d.ts +12 -0
  534. package/dist/types/plugins/analytics-node/index.d.ts.map +1 -0
  535. package/dist/types/plugins/env-enrichment/index.d.ts +25 -0
  536. package/dist/types/plugins/env-enrichment/index.d.ts.map +1 -0
  537. package/dist/types/plugins/hightouchio/batched-dispatcher.d.ts +8 -0
  538. package/dist/types/plugins/hightouchio/batched-dispatcher.d.ts.map +1 -0
  539. package/dist/types/plugins/hightouchio/fetch-dispatcher.d.ts +8 -0
  540. package/dist/types/plugins/hightouchio/fetch-dispatcher.d.ts.map +1 -0
  541. package/dist/types/plugins/hightouchio/index.d.ts +26 -0
  542. package/dist/types/plugins/hightouchio/index.d.ts.map +1 -0
  543. package/dist/types/plugins/hightouchio/normalize.d.ts +6 -0
  544. package/dist/types/plugins/hightouchio/normalize.d.ts.map +1 -0
  545. package/dist/types/plugins/hightouchio/schedule-flush.d.ts +5 -0
  546. package/dist/types/plugins/hightouchio/schedule-flush.d.ts.map +1 -0
  547. package/dist/types/plugins/legacy-video-plugins/index.d.ts +3 -0
  548. package/dist/types/plugins/legacy-video-plugins/index.d.ts.map +1 -0
  549. package/dist/types/plugins/middleware/index.d.ts +18 -0
  550. package/dist/types/plugins/middleware/index.d.ts.map +1 -0
  551. package/dist/types/plugins/remote-loader/index.d.ts +47 -0
  552. package/dist/types/plugins/remote-loader/index.d.ts.map +1 -0
  553. package/dist/types/plugins/remote-middleware/index.d.ts +5 -0
  554. package/dist/types/plugins/remote-middleware/index.d.ts.map +1 -0
  555. package/dist/types/plugins/routing-middleware/index.d.ts +13 -0
  556. package/dist/types/plugins/routing-middleware/index.d.ts.map +1 -0
  557. package/dist/types/plugins/schema-filter/index.d.ts +5 -0
  558. package/dist/types/plugins/schema-filter/index.d.ts.map +1 -0
  559. package/dist/types/plugins/validation/index.d.ts +3 -0
  560. package/dist/types/plugins/validation/index.d.ts.map +1 -0
  561. package/dist/umd/799.bundle.cf7e55682bfd23cde904.js +2 -0
  562. package/dist/umd/799.bundle.cf7e55682bfd23cde904.js.map +1 -0
  563. package/dist/umd/870.bundle.6d7307379da86a3bf277.js +2 -0
  564. package/dist/umd/870.bundle.6d7307379da86a3bf277.js.map +1 -0
  565. package/dist/umd/ajs-destination.bundle.5a985a542b0de08e3e49.js +2 -0
  566. package/dist/umd/ajs-destination.bundle.5a985a542b0de08e3e49.js.map +1 -0
  567. package/dist/umd/auto-track.bundle.08c0e0f63bb92f96f8b5.js +2 -0
  568. package/dist/umd/auto-track.bundle.08c0e0f63bb92f96f8b5.js.map +1 -0
  569. package/dist/umd/events.min.js +2 -0
  570. package/dist/umd/events.min.js.map +1 -0
  571. package/dist/umd/index.js +2 -0
  572. package/dist/umd/index.js.map +1 -0
  573. package/dist/umd/legacyVideos.bundle.6250709892bb05b68333.js +2 -0
  574. package/dist/umd/legacyVideos.bundle.6250709892bb05b68333.js.map +1 -0
  575. package/dist/umd/queryString.bundle.e47b8db88c102418c8c2.js +2 -0
  576. package/dist/umd/queryString.bundle.e47b8db88c102418c8c2.js.map +1 -0
  577. package/dist/umd/remoteMiddleware.bundle.4da71e934f9fcee73678.js +2 -0
  578. package/dist/umd/remoteMiddleware.bundle.4da71e934f9fcee73678.js.map +1 -0
  579. package/dist/umd/schemaFilter.bundle.a17fd62888b293279f4b.js +2 -0
  580. package/dist/umd/schemaFilter.bundle.a17fd62888b293279f4b.js.map +1 -0
  581. package/dist/umd/tsub-middleware.bundle.a9604b3195f6189e429b.js +2 -0
  582. package/dist/umd/tsub-middleware.bundle.a9604b3195f6189e429b.js.map +1 -0
  583. package/package.json +106 -0
  584. package/src/browser/browser-umd.ts +19 -0
  585. package/src/browser/index.ts +486 -0
  586. package/src/browser/standalone-analytics.ts +62 -0
  587. package/src/browser/standalone-interface.ts +11 -0
  588. package/src/browser/standalone.ts +92 -0
  589. package/src/core/analytics/index.ts +672 -0
  590. package/src/core/analytics/interfaces.ts +100 -0
  591. package/src/core/arguments-resolver/index.ts +200 -0
  592. package/src/core/auto-track.ts +152 -0
  593. package/src/core/buffer/index.ts +371 -0
  594. package/src/core/callback/index.ts +1 -0
  595. package/src/core/connection/index.ts +13 -0
  596. package/src/core/constants/index.ts +1 -0
  597. package/src/core/context/index.ts +21 -0
  598. package/src/core/environment/index.ts +7 -0
  599. package/src/core/events/index.ts +277 -0
  600. package/src/core/events/interfaces.ts +36 -0
  601. package/src/core/inspector/index.ts +14 -0
  602. package/src/core/page/add-page-context.ts +33 -0
  603. package/src/core/page/get-page-context.ts +140 -0
  604. package/src/core/page/index.ts +2 -0
  605. package/src/core/plugin/index.ts +12 -0
  606. package/src/core/query-string/gracefulDecodeURIComponent.ts +16 -0
  607. package/src/core/query-string/index.ts +64 -0
  608. package/src/core/query-string/pickPrefix.ts +20 -0
  609. package/src/core/queue/event-queue.ts +22 -0
  610. package/src/core/session/index.ts +107 -0
  611. package/src/core/stats/index.ts +15 -0
  612. package/src/core/stats/remote-metrics.ts +144 -0
  613. package/src/core/storage/cookieStorage.ts +80 -0
  614. package/src/core/storage/index.ts +64 -0
  615. package/src/core/storage/localStorage.ts +45 -0
  616. package/src/core/storage/memoryStorage.ts +22 -0
  617. package/src/core/storage/settings.ts +23 -0
  618. package/src/core/storage/types.ts +49 -0
  619. package/src/core/storage/universalStorage.ts +78 -0
  620. package/src/core/user/index.ts +399 -0
  621. package/src/core/user/migrate.ts +126 -0
  622. package/src/core/user/tld.ts +65 -0
  623. package/src/core/user/vendor/crypto-es/LICENSE +53 -0
  624. package/src/core/user/vendor/crypto-es/lib/aes.ts +302 -0
  625. package/src/core/user/vendor/crypto-es/lib/cipher-core.ts +922 -0
  626. package/src/core/user/vendor/crypto-es/lib/core.ts +806 -0
  627. package/src/core/user/vendor/crypto-es/lib/enc-base64.ts +110 -0
  628. package/src/core/user/vendor/crypto-es/lib/evpkdf.ts +110 -0
  629. package/src/core/user/vendor/crypto-es/lib/md5.ts +238 -0
  630. package/src/core/user/vendor/readme.md +7 -0
  631. package/src/generated/version.ts +2 -0
  632. package/src/index.ts +13 -0
  633. package/src/lib/bind-all.ts +19 -0
  634. package/src/lib/browser-polyfill.ts +23 -0
  635. package/src/lib/client-hints/index.ts +16 -0
  636. package/src/lib/client-hints/interfaces.ts +42 -0
  637. package/src/lib/create-deferred.ts +16 -0
  638. package/src/lib/csp-detection.ts +8 -0
  639. package/src/lib/embedded-write-key.ts +24 -0
  640. package/src/lib/fetch.ts +10 -0
  641. package/src/lib/get-global.ts +16 -0
  642. package/src/lib/get-process-env.ts +11 -0
  643. package/src/lib/global-analytics-helper.ts +31 -0
  644. package/src/lib/group-by.ts +30 -0
  645. package/src/lib/is-plan-event-enabled.ts +20 -0
  646. package/src/lib/is-thenable.ts +9 -0
  647. package/src/lib/load-script.ts +66 -0
  648. package/src/lib/merged-options.ts +46 -0
  649. package/src/lib/on-page-change.ts +29 -0
  650. package/src/lib/p-while.ts +12 -0
  651. package/src/lib/parse-cdn.ts +56 -0
  652. package/src/lib/pick.ts +28 -0
  653. package/src/lib/priority-queue/backoff.ts +24 -0
  654. package/src/lib/priority-queue/index.ts +6 -0
  655. package/src/lib/priority-queue/persisted.ts +127 -0
  656. package/src/lib/sleep.ts +4 -0
  657. package/src/lib/to-facade.ts +50 -0
  658. package/src/lib/version-type.ts +10 -0
  659. package/src/node/index.ts +36 -0
  660. package/src/node/node.browser.ts +7 -0
  661. package/src/plugins/ajs-destination/index.ts +392 -0
  662. package/src/plugins/ajs-destination/loader.ts +129 -0
  663. package/src/plugins/ajs-destination/types.ts +44 -0
  664. package/src/plugins/ajs-destination/utils.ts +32 -0
  665. package/src/plugins/analytics-node/index.ts +67 -0
  666. package/src/plugins/env-enrichment/index.ts +208 -0
  667. package/src/plugins/hightouchio/batched-dispatcher.ts +127 -0
  668. package/src/plugins/hightouchio/fetch-dispatcher.ts +27 -0
  669. package/src/plugins/hightouchio/index.ts +147 -0
  670. package/src/plugins/hightouchio/normalize.ts +71 -0
  671. package/src/plugins/hightouchio/schedule-flush.ts +58 -0
  672. package/src/plugins/legacy-video-plugins/index.ts +16 -0
  673. package/src/plugins/middleware/index.ts +131 -0
  674. package/src/plugins/remote-loader/index.ts +256 -0
  675. package/src/plugins/remote-middleware/index.ts +44 -0
  676. package/src/plugins/routing-middleware/index.ts +37 -0
  677. package/src/plugins/schema-filter/index.ts +90 -0
  678. package/src/plugins/validation/index.ts +44 -0
  679. package/src/test-helpers/browser-storage.ts +75 -0
  680. package/src/test-helpers/factories.ts +18 -0
  681. package/src/test-helpers/fetch-parse.ts +8 -0
  682. package/src/test-helpers/fixtures/cdn-settings.ts +301 -0
  683. package/src/test-helpers/fixtures/classic-destination.ts +25 -0
  684. package/src/test-helpers/fixtures/client-hints.ts +28 -0
  685. package/src/test-helpers/fixtures/create-fetch-method.ts +30 -0
  686. package/src/test-helpers/fixtures/index.ts +4 -0
  687. package/src/test-helpers/fixtures/page-context.ts +11 -0
  688. package/src/test-helpers/test-writekeys.ts +5 -0
  689. package/src/test-helpers/type-assertions.ts +11 -0
@@ -0,0 +1,838 @@
1
+ //@ts-nocheck
2
+ /* eslint-disable no-use-before-define */
3
+ import { __extends } from "tslib";
4
+ import { Base, WordArray, BufferedBlockAlgorithm } from './core';
5
+ import { Base64 } from './enc-base64';
6
+ import { EvpKDFAlgo } from './evpkdf';
7
+ /**
8
+ * Abstract base cipher template.
9
+ *
10
+ * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
11
+ * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
12
+ * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
13
+ * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
14
+ */
15
+ var Cipher = /** @class */ (function (_super) {
16
+ __extends(Cipher, _super);
17
+ /**
18
+ * Initializes a newly created cipher.
19
+ *
20
+ * @param {number} xformMode Either the encryption or decryption transormation mode constant.
21
+ * @param {WordArray} key The key.
22
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
23
+ *
24
+ * @example
25
+ *
26
+ * const cipher = CryptoJS.algo.AES.create(
27
+ * CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }
28
+ * );
29
+ */
30
+ function Cipher(xformMode, key, cfg) {
31
+ var _this = _super.call(this) || this;
32
+ /**
33
+ * Configuration options.
34
+ *
35
+ * @property {WordArray} iv The IV to use for this operation.
36
+ */
37
+ _this.cfg = Object.assign(new Base(), cfg);
38
+ // Store transform mode and key
39
+ _this._xformMode = xformMode;
40
+ _this._key = key;
41
+ // Set initial values
42
+ _this.reset();
43
+ return _this;
44
+ }
45
+ /**
46
+ * Creates this cipher in encryption mode.
47
+ *
48
+ * @param {WordArray} key The key.
49
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
50
+ *
51
+ * @return {Cipher} A cipher instance.
52
+ *
53
+ * @static
54
+ *
55
+ * @example
56
+ *
57
+ * const cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
58
+ */
59
+ Cipher.createEncryptor = function (key, cfg) {
60
+ return this.create(this._ENC_XFORM_MODE, key, cfg);
61
+ };
62
+ /**
63
+ * Creates this cipher in decryption mode.
64
+ *
65
+ * @param {WordArray} key The key.
66
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
67
+ *
68
+ * @return {Cipher} A cipher instance.
69
+ *
70
+ * @static
71
+ *
72
+ * @example
73
+ *
74
+ * const cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
75
+ */
76
+ Cipher.createDecryptor = function (key, cfg) {
77
+ return this.create(this._DEC_XFORM_MODE, key, cfg);
78
+ };
79
+ /**
80
+ * Creates shortcut functions to a cipher's object interface.
81
+ *
82
+ * @param {Cipher} cipher The cipher to create a helper for.
83
+ *
84
+ * @return {Object} An object with encrypt and decrypt shortcut functions.
85
+ *
86
+ * @static
87
+ *
88
+ * @example
89
+ *
90
+ * const AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
91
+ */
92
+ Cipher._createHelper = function (SubCipher) {
93
+ var selectCipherStrategy = function (key) {
94
+ if (typeof key === 'string') {
95
+ return PasswordBasedCipher;
96
+ }
97
+ return SerializableCipher;
98
+ };
99
+ return {
100
+ encrypt: function (message, key, cfg) {
101
+ return selectCipherStrategy(key).encrypt(SubCipher, message, key, cfg);
102
+ },
103
+ decrypt: function (ciphertext, key, cfg) {
104
+ return selectCipherStrategy(key).decrypt(SubCipher, ciphertext, key, cfg);
105
+ },
106
+ };
107
+ };
108
+ /**
109
+ * Resets this cipher to its initial state.
110
+ *
111
+ * @example
112
+ *
113
+ * cipher.reset();
114
+ */
115
+ Cipher.prototype.reset = function () {
116
+ // Reset data buffer
117
+ _super.prototype.reset.call(this);
118
+ // Perform concrete-cipher logic
119
+ this._doReset();
120
+ };
121
+ /**
122
+ * Adds data to be encrypted or decrypted.
123
+ *
124
+ * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
125
+ *
126
+ * @return {WordArray} The data after processing.
127
+ *
128
+ * @example
129
+ *
130
+ * const encrypted = cipher.process('data');
131
+ * const encrypted = cipher.process(wordArray);
132
+ */
133
+ Cipher.prototype.process = function (dataUpdate) {
134
+ // Append
135
+ this._append(dataUpdate);
136
+ // Process available blocks
137
+ return this._process();
138
+ };
139
+ /**
140
+ * Finalizes the encryption or decryption process.
141
+ * Note that the finalize operation is effectively a destructive, read-once operation.
142
+ *
143
+ * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
144
+ *
145
+ * @return {WordArray} The data after final processing.
146
+ *
147
+ * @example
148
+ *
149
+ * const encrypted = cipher.finalize();
150
+ * const encrypted = cipher.finalize('data');
151
+ * const encrypted = cipher.finalize(wordArray);
152
+ */
153
+ Cipher.prototype.finalize = function (dataUpdate) {
154
+ // Final data update
155
+ if (dataUpdate) {
156
+ this._append(dataUpdate);
157
+ }
158
+ // Perform concrete-cipher logic
159
+ var finalProcessedData = this._doFinalize();
160
+ return finalProcessedData;
161
+ };
162
+ return Cipher;
163
+ }(BufferedBlockAlgorithm));
164
+ export { Cipher };
165
+ Cipher._ENC_XFORM_MODE = 1;
166
+ Cipher._DEC_XFORM_MODE = 2;
167
+ Cipher.keySize = 128 / 32;
168
+ Cipher.ivSize = 128 / 32;
169
+ /**
170
+ * Abstract base stream cipher template.
171
+ *
172
+ * @property {number} blockSize
173
+ *
174
+ * The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
175
+ */
176
+ var StreamCipher = /** @class */ (function (_super) {
177
+ __extends(StreamCipher, _super);
178
+ function StreamCipher() {
179
+ var args = [];
180
+ for (var _i = 0; _i < arguments.length; _i++) {
181
+ args[_i] = arguments[_i];
182
+ }
183
+ var _this = _super.apply(this, args) || this;
184
+ _this.blockSize = 1;
185
+ return _this;
186
+ }
187
+ StreamCipher.prototype._doFinalize = function () {
188
+ // Process partial blocks
189
+ var finalProcessedBlocks = this._process(!!'flush');
190
+ return finalProcessedBlocks;
191
+ };
192
+ return StreamCipher;
193
+ }(Cipher));
194
+ export { StreamCipher };
195
+ /**
196
+ * Abstract base block cipher mode template.
197
+ */
198
+ var BlockCipherMode = /** @class */ (function (_super) {
199
+ __extends(BlockCipherMode, _super);
200
+ /**
201
+ * Initializes a newly created mode.
202
+ *
203
+ * @param {Cipher} cipher A block cipher instance.
204
+ * @param {Array} iv The IV words.
205
+ *
206
+ * @example
207
+ *
208
+ * const mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
209
+ */
210
+ function BlockCipherMode(cipher, iv) {
211
+ var _this = _super.call(this) || this;
212
+ _this._cipher = cipher;
213
+ _this._iv = iv;
214
+ return _this;
215
+ }
216
+ /**
217
+ * Creates this mode for encryption.
218
+ *
219
+ * @param {Cipher} cipher A block cipher instance.
220
+ * @param {Array} iv The IV words.
221
+ *
222
+ * @static
223
+ *
224
+ * @example
225
+ *
226
+ * const mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
227
+ */
228
+ BlockCipherMode.createEncryptor = function (cipher, iv) {
229
+ return this.Encryptor.create(cipher, iv);
230
+ };
231
+ /**
232
+ * Creates this mode for decryption.
233
+ *
234
+ * @param {Cipher} cipher A block cipher instance.
235
+ * @param {Array} iv The IV words.
236
+ *
237
+ * @static
238
+ *
239
+ * @example
240
+ *
241
+ * const mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
242
+ */
243
+ BlockCipherMode.createDecryptor = function (cipher, iv) {
244
+ return this.Decryptor.create(cipher, iv);
245
+ };
246
+ return BlockCipherMode;
247
+ }(Base));
248
+ export { BlockCipherMode };
249
+ function xorBlock(words, offset, blockSize) {
250
+ var _words = words;
251
+ var block;
252
+ // Shortcut
253
+ var iv = this._iv;
254
+ // Choose mixing block
255
+ if (iv) {
256
+ block = iv;
257
+ // Remove IV for subsequent blocks
258
+ this._iv = undefined;
259
+ }
260
+ else {
261
+ block = this._prevBlock;
262
+ }
263
+ // XOR blocks
264
+ for (var i = 0; i < blockSize; i += 1) {
265
+ _words[offset + i] ^= block[i];
266
+ }
267
+ }
268
+ /**
269
+ * Cipher Block Chaining mode.
270
+ */
271
+ /**
272
+ * Abstract base CBC mode.
273
+ */
274
+ var CBC = /** @class */ (function (_super) {
275
+ __extends(CBC, _super);
276
+ function CBC() {
277
+ return _super !== null && _super.apply(this, arguments) || this;
278
+ }
279
+ return CBC;
280
+ }(BlockCipherMode));
281
+ export { CBC };
282
+ /**
283
+ * CBC encryptor.
284
+ */
285
+ CBC.Encryptor = /** @class */ (function (_super) {
286
+ __extends(Encryptor, _super);
287
+ function Encryptor() {
288
+ return _super !== null && _super.apply(this, arguments) || this;
289
+ }
290
+ /**
291
+ * Processes the data block at offset.
292
+ *
293
+ * @param {Array} words The data words to operate on.
294
+ * @param {number} offset The offset where the block starts.
295
+ *
296
+ * @example
297
+ *
298
+ * mode.processBlock(data.words, offset);
299
+ */
300
+ Encryptor.prototype.processBlock = function (words, offset) {
301
+ // Shortcuts
302
+ var cipher = this._cipher;
303
+ var blockSize = cipher.blockSize;
304
+ // XOR and encrypt
305
+ xorBlock.call(this, words, offset, blockSize);
306
+ cipher.encryptBlock(words, offset);
307
+ // Remember this block to use with next block
308
+ this._prevBlock = words.slice(offset, offset + blockSize);
309
+ };
310
+ return Encryptor;
311
+ }(CBC));
312
+ /**
313
+ * CBC decryptor.
314
+ */
315
+ CBC.Decryptor = /** @class */ (function (_super) {
316
+ __extends(Decryptor, _super);
317
+ function Decryptor() {
318
+ return _super !== null && _super.apply(this, arguments) || this;
319
+ }
320
+ /**
321
+ * Processes the data block at offset.
322
+ *
323
+ * @param {Array} words The data words to operate on.
324
+ * @param {number} offset The offset where the block starts.
325
+ *
326
+ * @example
327
+ *
328
+ * mode.processBlock(data.words, offset);
329
+ */
330
+ Decryptor.prototype.processBlock = function (words, offset) {
331
+ // Shortcuts
332
+ var cipher = this._cipher;
333
+ var blockSize = cipher.blockSize;
334
+ // Remember this block to use with next block
335
+ var thisBlock = words.slice(offset, offset + blockSize);
336
+ // Decrypt and XOR
337
+ cipher.decryptBlock(words, offset);
338
+ xorBlock.call(this, words, offset, blockSize);
339
+ // This block becomes the previous block
340
+ this._prevBlock = thisBlock;
341
+ };
342
+ return Decryptor;
343
+ }(CBC));
344
+ /**
345
+ * PKCS #5/7 padding strategy.
346
+ */
347
+ export var Pkcs7 = {
348
+ /**
349
+ * Pads data using the algorithm defined in PKCS #5/7.
350
+ *
351
+ * @param {WordArray} data The data to pad.
352
+ * @param {number} blockSize The multiple that the data should be padded to.
353
+ *
354
+ * @static
355
+ *
356
+ * @example
357
+ *
358
+ * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
359
+ */
360
+ pad: function (data, blockSize) {
361
+ // Shortcut
362
+ var blockSizeBytes = blockSize * 4;
363
+ // Count padding bytes
364
+ var nPaddingBytes = blockSizeBytes - (data.sigBytes % blockSizeBytes);
365
+ // Create padding word
366
+ var paddingWord = (nPaddingBytes << 24) |
367
+ (nPaddingBytes << 16) |
368
+ (nPaddingBytes << 8) |
369
+ nPaddingBytes;
370
+ // Create padding
371
+ var paddingWords = [];
372
+ for (var i = 0; i < nPaddingBytes; i += 4) {
373
+ paddingWords.push(paddingWord);
374
+ }
375
+ var padding = WordArray.create(paddingWords, nPaddingBytes);
376
+ // Add padding
377
+ data.concat(padding);
378
+ },
379
+ /**
380
+ * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
381
+ *
382
+ * @param {WordArray} data The data to unpad.
383
+ *
384
+ * @static
385
+ *
386
+ * @example
387
+ *
388
+ * CryptoJS.pad.Pkcs7.unpad(wordArray);
389
+ */
390
+ unpad: function (data) {
391
+ var _data = data;
392
+ // Get number of padding bytes from last byte
393
+ var nPaddingBytes = _data.words[(_data.sigBytes - 1) >>> 2] & 0xff;
394
+ // Remove padding
395
+ _data.sigBytes -= nPaddingBytes;
396
+ },
397
+ };
398
+ /**
399
+ * Abstract base block cipher template.
400
+ *
401
+ * @property {number} blockSize
402
+ *
403
+ * The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
404
+ */
405
+ var BlockCipher = /** @class */ (function (_super) {
406
+ __extends(BlockCipher, _super);
407
+ function BlockCipher(xformMode, key, cfg) {
408
+ var _this =
409
+ /**
410
+ * Configuration options.
411
+ *
412
+ * @property {Mode} mode The block mode to use. Default: CBC
413
+ * @property {Padding} padding The padding strategy to use. Default: Pkcs7
414
+ */
415
+ _super.call(this, xformMode, key, Object.assign({
416
+ mode: CBC,
417
+ padding: Pkcs7,
418
+ }, cfg)) || this;
419
+ _this.blockSize = 128 / 32;
420
+ return _this;
421
+ }
422
+ BlockCipher.prototype.reset = function () {
423
+ var modeCreator;
424
+ // Reset cipher
425
+ _super.prototype.reset.call(this);
426
+ // Shortcuts
427
+ var cfg = this.cfg;
428
+ var iv = cfg.iv, mode = cfg.mode;
429
+ // Reset block mode
430
+ if (this._xformMode === this.constructor._ENC_XFORM_MODE) {
431
+ modeCreator = mode.createEncryptor;
432
+ } /* if (this._xformMode == this._DEC_XFORM_MODE) */
433
+ else {
434
+ modeCreator = mode.createDecryptor;
435
+ // Keep at least one block in the buffer for unpadding
436
+ this._minBufferSize = 1;
437
+ }
438
+ this._mode = modeCreator.call(mode, this, iv && iv.words);
439
+ this._mode.__creator = modeCreator;
440
+ };
441
+ BlockCipher.prototype._doProcessBlock = function (words, offset) {
442
+ this._mode.processBlock(words, offset);
443
+ };
444
+ BlockCipher.prototype._doFinalize = function () {
445
+ var finalProcessedBlocks;
446
+ // Shortcut
447
+ var padding = this.cfg.padding;
448
+ // Finalize
449
+ if (this._xformMode === this.constructor._ENC_XFORM_MODE) {
450
+ // Pad data
451
+ padding.pad(this._data, this.blockSize);
452
+ // Process final blocks
453
+ finalProcessedBlocks = this._process(!!'flush');
454
+ } /* if (this._xformMode == this._DEC_XFORM_MODE) */
455
+ else {
456
+ // Process final blocks
457
+ finalProcessedBlocks = this._process(!!'flush');
458
+ // Unpad data
459
+ padding.unpad(finalProcessedBlocks);
460
+ }
461
+ return finalProcessedBlocks;
462
+ };
463
+ return BlockCipher;
464
+ }(Cipher));
465
+ export { BlockCipher };
466
+ /**
467
+ * A collection of cipher parameters.
468
+ *
469
+ * @property {WordArray} ciphertext The raw ciphertext.
470
+ * @property {WordArray} key The key to this ciphertext.
471
+ * @property {WordArray} iv The IV used in the ciphering operation.
472
+ * @property {WordArray} salt The salt used with a key derivation function.
473
+ * @property {Cipher} algorithm The cipher algorithm.
474
+ * @property {Mode} mode The block mode used in the ciphering operation.
475
+ * @property {Padding} padding The padding scheme used in the ciphering operation.
476
+ * @property {number} blockSize The block size of the cipher.
477
+ * @property {Format} formatter
478
+ * The default formatting strategy to convert this cipher params object to a string.
479
+ */
480
+ var CipherParams = /** @class */ (function (_super) {
481
+ __extends(CipherParams, _super);
482
+ /**
483
+ * Initializes a newly created cipher params object.
484
+ *
485
+ * @param {Object} cipherParams An object with any of the possible cipher parameters.
486
+ *
487
+ * @example
488
+ *
489
+ * var cipherParams = CryptoJS.lib.CipherParams.create({
490
+ * ciphertext: ciphertextWordArray,
491
+ * key: keyWordArray,
492
+ * iv: ivWordArray,
493
+ * salt: saltWordArray,
494
+ * algorithm: CryptoJS.algo.AES,
495
+ * mode: CryptoJS.mode.CBC,
496
+ * padding: CryptoJS.pad.PKCS7,
497
+ * blockSize: 4,
498
+ * formatter: CryptoJS.format.OpenSSL
499
+ * });
500
+ */
501
+ function CipherParams(cipherParams) {
502
+ var _this = _super.call(this) || this;
503
+ _this.mixIn(cipherParams);
504
+ return _this;
505
+ }
506
+ /**
507
+ * Converts this cipher params object to a string.
508
+ *
509
+ * @param {Format} formatter (Optional) The formatting strategy to use.
510
+ *
511
+ * @return {string} The stringified cipher params.
512
+ *
513
+ * @throws Error If neither the formatter nor the default formatter is set.
514
+ *
515
+ * @example
516
+ *
517
+ * var string = cipherParams + '';
518
+ * var string = cipherParams.toString();
519
+ * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
520
+ */
521
+ CipherParams.prototype.toString = function (formatter) {
522
+ return (formatter || this.formatter).stringify(this);
523
+ };
524
+ return CipherParams;
525
+ }(Base));
526
+ export { CipherParams };
527
+ /**
528
+ * OpenSSL formatting strategy.
529
+ */
530
+ export var OpenSSLFormatter = {
531
+ /**
532
+ * Converts a cipher params object to an OpenSSL-compatible string.
533
+ *
534
+ * @param {CipherParams} cipherParams The cipher params object.
535
+ *
536
+ * @return {string} The OpenSSL-compatible string.
537
+ *
538
+ * @static
539
+ *
540
+ * @example
541
+ *
542
+ * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
543
+ */
544
+ stringify: function (cipherParams) {
545
+ var wordArray;
546
+ // Shortcuts
547
+ var ciphertext = cipherParams.ciphertext, salt = cipherParams.salt;
548
+ // Format
549
+ if (salt) {
550
+ wordArray = WordArray.create([0x53616c74, 0x65645f5f])
551
+ .concat(salt)
552
+ .concat(ciphertext);
553
+ }
554
+ else {
555
+ wordArray = ciphertext;
556
+ }
557
+ return wordArray.toString(Base64);
558
+ },
559
+ /**
560
+ * Converts an OpenSSL-compatible string to a cipher params object.
561
+ *
562
+ * @param {string} openSSLStr The OpenSSL-compatible string.
563
+ *
564
+ * @return {CipherParams} The cipher params object.
565
+ *
566
+ * @static
567
+ *
568
+ * @example
569
+ *
570
+ * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
571
+ */
572
+ parse: function (openSSLStr) {
573
+ var salt;
574
+ // Parse base64
575
+ var ciphertext = Base64.parse(openSSLStr);
576
+ // Shortcut
577
+ var ciphertextWords = ciphertext.words;
578
+ // Test for salt
579
+ if (ciphertextWords[0] === 0x53616c74 &&
580
+ ciphertextWords[1] === 0x65645f5f) {
581
+ // Extract salt
582
+ salt = WordArray.create(ciphertextWords.slice(2, 4));
583
+ // Remove salt from ciphertext
584
+ ciphertextWords.splice(0, 4);
585
+ ciphertext.sigBytes -= 16;
586
+ }
587
+ return CipherParams.create({ ciphertext: ciphertext, salt: salt });
588
+ },
589
+ };
590
+ /**
591
+ * A cipher wrapper that returns ciphertext as a serializable cipher params object.
592
+ */
593
+ var SerializableCipher = /** @class */ (function (_super) {
594
+ __extends(SerializableCipher, _super);
595
+ function SerializableCipher() {
596
+ return _super !== null && _super.apply(this, arguments) || this;
597
+ }
598
+ /**
599
+ * Encrypts a message.
600
+ *
601
+ * @param {Cipher} cipher The cipher algorithm to use.
602
+ * @param {WordArray|string} message The message to encrypt.
603
+ * @param {WordArray} key The key.
604
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
605
+ *
606
+ * @return {CipherParams} A cipher params object.
607
+ *
608
+ * @static
609
+ *
610
+ * @example
611
+ *
612
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher
613
+ * .encrypt(CryptoJS.algo.AES, message, key);
614
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher
615
+ * .encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
616
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher
617
+ * .encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
618
+ */
619
+ SerializableCipher.encrypt = function (cipher, message, key, cfg) {
620
+ // Apply config defaults
621
+ var _cfg = Object.assign(new Base(), this.cfg, cfg);
622
+ // Encrypt
623
+ var encryptor = cipher.createEncryptor(key, _cfg);
624
+ var ciphertext = encryptor.finalize(message);
625
+ // Shortcut
626
+ var cipherCfg = encryptor.cfg;
627
+ // Create and return serializable cipher params
628
+ return CipherParams.create({
629
+ ciphertext: ciphertext,
630
+ key: key,
631
+ iv: cipherCfg.iv,
632
+ algorithm: cipher,
633
+ mode: cipherCfg.mode,
634
+ padding: cipherCfg.padding,
635
+ blockSize: encryptor.blockSize,
636
+ formatter: _cfg.format,
637
+ });
638
+ };
639
+ /**
640
+ * Decrypts serialized ciphertext.
641
+ *
642
+ * @param {Cipher} cipher The cipher algorithm to use.
643
+ * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
644
+ * @param {WordArray} key The key.
645
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
646
+ *
647
+ * @return {WordArray} The plaintext.
648
+ *
649
+ * @static
650
+ *
651
+ * @example
652
+ *
653
+ * var plaintext = CryptoJS.lib.SerializableCipher
654
+ * .decrypt(CryptoJS.algo.AES, formattedCiphertext, key,
655
+ * { iv: iv, format: CryptoJS.format.OpenSSL });
656
+ * var plaintext = CryptoJS.lib.SerializableCipher
657
+ * .decrypt(CryptoJS.algo.AES, ciphertextParams, key,
658
+ * { iv: iv, format: CryptoJS.format.OpenSSL });
659
+ */
660
+ SerializableCipher.decrypt = function (cipher, ciphertext, key, cfg) {
661
+ var _ciphertext = ciphertext;
662
+ // Apply config defaults
663
+ var _cfg = Object.assign(new Base(), this.cfg, cfg);
664
+ // Convert string to CipherParams
665
+ _ciphertext = this._parse(_ciphertext, _cfg.format);
666
+ // Decrypt
667
+ var plaintext = cipher
668
+ .createDecryptor(key, _cfg)
669
+ .finalize(_ciphertext.ciphertext);
670
+ return plaintext;
671
+ };
672
+ /**
673
+ * Converts serialized ciphertext to CipherParams,
674
+ * else assumed CipherParams already and returns ciphertext unchanged.
675
+ *
676
+ * @param {CipherParams|string} ciphertext The ciphertext.
677
+ * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
678
+ *
679
+ * @return {CipherParams} The unserialized ciphertext.
680
+ *
681
+ * @static
682
+ *
683
+ * @example
684
+ *
685
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher
686
+ * ._parse(ciphertextStringOrParams, format);
687
+ */
688
+ SerializableCipher._parse = function (ciphertext, format) {
689
+ if (typeof ciphertext === 'string') {
690
+ return format.parse(ciphertext, this);
691
+ }
692
+ return ciphertext;
693
+ };
694
+ return SerializableCipher;
695
+ }(Base));
696
+ export { SerializableCipher };
697
+ /**
698
+ * Configuration options.
699
+ *
700
+ * @property {Formatter} format
701
+ *
702
+ * The formatting strategy to convert cipher param objects to and from a string.
703
+ * Default: OpenSSL
704
+ */
705
+ SerializableCipher.cfg = Object.assign(new Base(), { format: OpenSSLFormatter });
706
+ /**
707
+ * OpenSSL key derivation function.
708
+ */
709
+ export var OpenSSLKdf = {
710
+ /**
711
+ * Derives a key and IV from a password.
712
+ *
713
+ * @param {string} password The password to derive from.
714
+ * @param {number} keySize The size in words of the key to generate.
715
+ * @param {number} ivSize The size in words of the IV to generate.
716
+ * @param {WordArray|string} salt
717
+ * (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
718
+ *
719
+ * @return {CipherParams} A cipher params object with the key, IV, and salt.
720
+ *
721
+ * @static
722
+ *
723
+ * @example
724
+ *
725
+ * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
726
+ * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
727
+ */
728
+ execute: function (password, keySize, ivSize, salt, hasher) {
729
+ var _salt = salt;
730
+ // Generate random salt
731
+ if (!_salt) {
732
+ _salt = WordArray.random(64 / 8);
733
+ }
734
+ // Derive key and IV
735
+ var key;
736
+ if (!hasher) {
737
+ key = EvpKDFAlgo.create({ keySize: keySize + ivSize }).compute(password, _salt);
738
+ }
739
+ else {
740
+ key = EvpKDFAlgo.create({ keySize: keySize + ivSize, hasher: hasher }).compute(password, _salt);
741
+ }
742
+ // Separate key and IV
743
+ var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
744
+ key.sigBytes = keySize * 4;
745
+ // Return params
746
+ return CipherParams.create({ key: key, iv: iv, salt: _salt });
747
+ },
748
+ };
749
+ /**
750
+ * A serializable cipher wrapper that derives the key from a password,
751
+ * and returns ciphertext as a serializable cipher params object.
752
+ */
753
+ var PasswordBasedCipher = /** @class */ (function (_super) {
754
+ __extends(PasswordBasedCipher, _super);
755
+ function PasswordBasedCipher() {
756
+ return _super !== null && _super.apply(this, arguments) || this;
757
+ }
758
+ /**
759
+ * Encrypts a message using a password.
760
+ *
761
+ * @param {Cipher} cipher The cipher algorithm to use.
762
+ * @param {WordArray|string} message The message to encrypt.
763
+ * @param {string} password The password.
764
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
765
+ *
766
+ * @return {CipherParams} A cipher params object.
767
+ *
768
+ * @static
769
+ *
770
+ * @example
771
+ *
772
+ * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher
773
+ * .encrypt(CryptoJS.algo.AES, message, 'password');
774
+ * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher
775
+ * .encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
776
+ */
777
+ PasswordBasedCipher.encrypt = function (cipher, message, password, cfg) {
778
+ // Apply config defaults
779
+ var _cfg = Object.assign(new Base(), this.cfg, cfg);
780
+ // Derive key and other params
781
+ var derivedParams = _cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, _cfg.salt, _cfg.hasher);
782
+ // Add IV to config
783
+ _cfg.iv = derivedParams.iv;
784
+ // Encrypt
785
+ var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, _cfg);
786
+ // Mix in derived params
787
+ ciphertext.mixIn(derivedParams);
788
+ return ciphertext;
789
+ };
790
+ /**
791
+ * Decrypts serialized ciphertext using a password.
792
+ *
793
+ * @param {Cipher} cipher The cipher algorithm to use.
794
+ * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
795
+ * @param {string} password The password.
796
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
797
+ *
798
+ * @return {WordArray} The plaintext.
799
+ *
800
+ * @static
801
+ *
802
+ * @example
803
+ *
804
+ * var plaintext = CryptoJS.lib.PasswordBasedCipher
805
+ * .decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password',
806
+ * { format: CryptoJS.format.OpenSSL });
807
+ * var plaintext = CryptoJS.lib.PasswordBasedCipher
808
+ * .decrypt(CryptoJS.algo.AES, ciphertextParams, 'password',
809
+ * { format: CryptoJS.format.OpenSSL });
810
+ */
811
+ PasswordBasedCipher.decrypt = function (cipher, ciphertext, password, cfg) {
812
+ var _ciphertext = ciphertext;
813
+ // Apply config defaults
814
+ var _cfg = Object.assign(new Base(), this.cfg, cfg);
815
+ // Convert string to CipherParams
816
+ _ciphertext = this._parse(_ciphertext, _cfg.format);
817
+ // Derive key and other params
818
+ var derivedParams = _cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, _ciphertext.salt, _cfg.hasher);
819
+ // Add IV to config
820
+ _cfg.iv = derivedParams.iv;
821
+ // Decrypt
822
+ var plaintext = SerializableCipher.decrypt.call(this, cipher, _ciphertext, derivedParams.key, _cfg);
823
+ return plaintext;
824
+ };
825
+ return PasswordBasedCipher;
826
+ }(SerializableCipher));
827
+ export { PasswordBasedCipher };
828
+ /**
829
+ * Configuration options.
830
+ *
831
+ * @property {KDF} kdf
832
+ * The key derivation function to use to generate a key and IV from a password.
833
+ * Default: OpenSSL
834
+ */
835
+ PasswordBasedCipher.cfg = Object.assign(SerializableCipher.cfg, {
836
+ kdf: OpenSSLKdf,
837
+ });
838
+ //# sourceMappingURL=cipher-core.js.map