generaltranslation 8.2.13 → 8.2.15

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 (133) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/dist/{ApiError-IYfaOR30.mjs → ApiError-0DxxIHLp.mjs} +1 -1
  3. package/dist/{ApiError-CZ45tkW6.cjs.map → ApiError-0DxxIHLp.mjs.map} +1 -1
  4. package/dist/{ApiError-CZ45tkW6.cjs → ApiError-D-IBuHj6.cjs} +1 -1
  5. package/dist/{ApiError-IYfaOR30.mjs.map → ApiError-D-IBuHj6.cjs.map} +1 -1
  6. package/dist/LocaleConfig.d.ts +1 -59
  7. package/dist/LocaleConfig.js +1 -225
  8. package/dist/{base64-2fu94Klt.cjs → base64-YBGAXkqy.cjs} +74 -1
  9. package/dist/base64-YBGAXkqy.cjs.map +1 -0
  10. package/dist/{base64-DH0STixb.mjs → base64-r7YWJYWt.mjs} +51 -2
  11. package/dist/base64-r7YWJYWt.mjs.map +1 -0
  12. package/dist/core.cjs +9 -8
  13. package/dist/core.d.cts +1 -2
  14. package/dist/core.d.mts +1 -2
  15. package/dist/core.d.ts +1 -128
  16. package/dist/core.js +1 -137
  17. package/dist/core.mjs +2 -2
  18. package/dist/derive/indexVars.d.ts +1 -1
  19. package/dist/errors.cjs +1 -1
  20. package/dist/errors.mjs +1 -1
  21. package/dist/id/types.d.ts +1 -1
  22. package/dist/{id-CyiXsQrY.cjs → id-C2orn1MA.cjs} +2 -2
  23. package/dist/{id-CyiXsQrY.cjs.map → id-C2orn1MA.cjs.map} +1 -1
  24. package/dist/{id-DbD7K-HL.mjs → id-DEaFhGqX.mjs} +2 -2
  25. package/dist/{id-DbD7K-HL.mjs.map → id-DEaFhGqX.mjs.map} +1 -1
  26. package/dist/id.cjs +1 -1
  27. package/dist/id.d.cts +1 -1
  28. package/dist/id.d.mts +1 -1
  29. package/dist/id.mjs +1 -1
  30. package/dist/index.cjs +431 -396
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +4 -242
  33. package/dist/index.d.mts +4 -242
  34. package/dist/index.d.ts +5 -238
  35. package/dist/index.js +3 -322
  36. package/dist/index.mjs +278 -363
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/internal.cjs +8 -6
  39. package/dist/internal.cjs.map +1 -1
  40. package/dist/internal.d.cts +37 -6
  41. package/dist/internal.d.mts +37 -6
  42. package/dist/internal.d.ts +2 -0
  43. package/dist/internal.js +1 -0
  44. package/dist/internal.mjs +5 -5
  45. package/dist/internal.mjs.map +1 -1
  46. package/dist/{isVariable-B08mggBy.cjs → isVariable-Ba1gLXdB.cjs} +1 -1
  47. package/dist/{isVariable-B08mggBy.cjs.map → isVariable-Ba1gLXdB.cjs.map} +1 -1
  48. package/dist/{isVariable-CYsKFHvR.mjs → isVariable-fAKEB7gF.mjs} +1 -1
  49. package/dist/{isVariable-CYsKFHvR.mjs.map → isVariable-fAKEB7gF.mjs.map} +1 -1
  50. package/dist/locales/getPluralForm.js +2 -2
  51. package/dist/logging/diagnostics.d.ts +18 -0
  52. package/dist/logging/diagnostics.js +64 -0
  53. package/dist/logging/errors.d.ts +1 -1
  54. package/dist/logging/errors.js +64 -11
  55. package/dist/logging/logger.d.ts +0 -3
  56. package/dist/logging/logger.js +0 -3
  57. package/dist/{types-AHtYZIP-.d.mts → types-CdRgQtET.d.cts} +6 -106
  58. package/dist/{types-Bf8_Apq_.d.cts → types-Db2Dn3oN.d.mts} +6 -106
  59. package/dist/types-dir/api/enqueueEntries.d.ts +1 -1
  60. package/dist/types-dir/api/enqueueFiles.d.ts +1 -1
  61. package/dist/types-dir/api/fetchTranslations.d.ts +1 -1
  62. package/dist/types-dir/api/file.d.ts +1 -1
  63. package/dist/types-dir/api/translate.d.ts +1 -1
  64. package/dist/types-dir/api/uploadFiles.d.ts +1 -1
  65. package/dist/types.cjs +7 -16
  66. package/dist/types.d.cts +2 -2
  67. package/dist/types.d.mts +2 -2
  68. package/dist/types.d.ts +10 -13
  69. package/dist/types.js +1 -2
  70. package/dist/types.mjs +1 -15
  71. package/package.json +3 -2
  72. package/dist/IntlCache-CAW8tKhd.cjs +0 -212
  73. package/dist/IntlCache-CAW8tKhd.cjs.map +0 -1
  74. package/dist/IntlCache-WZk0rKvj.mjs +0 -195
  75. package/dist/IntlCache-WZk0rKvj.mjs.map +0 -1
  76. package/dist/base64-2fu94Klt.cjs.map +0 -1
  77. package/dist/base64-DH0STixb.mjs.map +0 -1
  78. package/dist/cache/IntlCache.d.ts +0 -26
  79. package/dist/cache/IntlCache.js +0 -84
  80. package/dist/cache/types.d.ts +0 -32
  81. package/dist/cache/types.js +0 -1
  82. package/dist/core-7RP541eY.cjs +0 -1677
  83. package/dist/core-7RP541eY.cjs.map +0 -1
  84. package/dist/core-I9pWGafA.d.mts +0 -209
  85. package/dist/core-TLJoDpJP.d.cts +0 -209
  86. package/dist/core-isLphYAZ.mjs +0 -1498
  87. package/dist/core-isLphYAZ.mjs.map +0 -1
  88. package/dist/errors/formattingErrors.d.ts +0 -1
  89. package/dist/errors/formattingErrors.js +0 -3
  90. package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.d.ts +0 -59
  91. package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.js +0 -147
  92. package/dist/formatting/custom-formats/CutoffFormat/constants.d.ts +0 -4
  93. package/dist/formatting/custom-formats/CutoffFormat/constants.js +0 -30
  94. package/dist/formatting/custom-formats/CutoffFormat/types.d.ts +0 -48
  95. package/dist/formatting/custom-formats/CutoffFormat/types.js +0 -2
  96. package/dist/formatting/format.d.ts +0 -1
  97. package/dist/formatting/format.js +0 -257
  98. package/dist/locales/customLocaleMapping.d.ts +0 -11
  99. package/dist/locales/customLocaleMapping.js +0 -23
  100. package/dist/locales/determineLocale.d.ts +0 -1
  101. package/dist/locales/determineLocale.js +0 -72
  102. package/dist/locales/getLocaleDirection.d.ts +0 -1
  103. package/dist/locales/getLocaleDirection.js +0 -89
  104. package/dist/locales/getLocaleEmoji.d.ts +0 -2
  105. package/dist/locales/getLocaleEmoji.js +0 -319
  106. package/dist/locales/getLocaleName.d.ts +0 -1
  107. package/dist/locales/getLocaleName.js +0 -45
  108. package/dist/locales/getLocaleProperties.d.ts +0 -32
  109. package/dist/locales/getLocaleProperties.js +0 -220
  110. package/dist/locales/getRegionProperties.d.ts +0 -7
  111. package/dist/locales/getRegionProperties.js +0 -61
  112. package/dist/locales/isSameDialect.d.ts +0 -1
  113. package/dist/locales/isSameDialect.js +0 -41
  114. package/dist/locales/isSameLanguage.d.ts +0 -1
  115. package/dist/locales/isSameLanguage.js +0 -20
  116. package/dist/locales/isSupersetLocale.d.ts +0 -1
  117. package/dist/locales/isSupersetLocale.js +0 -22
  118. package/dist/locales/isValidLocale.d.ts +0 -1
  119. package/dist/locales/isValidLocale.js +0 -75
  120. package/dist/locales/requiresTranslation.d.ts +0 -1
  121. package/dist/locales/requiresTranslation.js +0 -32
  122. package/dist/locales/resolveAliasLocale.d.ts +0 -8
  123. package/dist/locales/resolveAliasLocale.js +0 -21
  124. package/dist/locales/resolveCanonicalLocale.d.ts +0 -8
  125. package/dist/locales/resolveCanonicalLocale.js +0 -13
  126. package/dist/logging/warnings.d.ts +0 -2
  127. package/dist/logging/warnings.js +0 -2
  128. package/dist/types-dir/jsx/content.d.ts +0 -61
  129. package/dist/types-dir/jsx/content.js +0 -11
  130. package/dist/types-dir/jsx/variables.d.ts +0 -9
  131. package/dist/types-dir/jsx/variables.js +0 -1
  132. package/dist/types.cjs.map +0 -1
  133. package/dist/types.mjs.map +0 -1
package/dist/core.d.ts CHANGED
@@ -1,128 +1 @@
1
- import type { CutoffFormatOptions } from './formatting/custom-formats/CutoffFormat/types';
2
- import type { CustomMapping, FormatVariables } from './types';
3
- import type { StringFormat } from './types-dir/jsx/content';
4
- export { LocaleConfig, type LocaleConfigConstructorParams, } from './LocaleConfig';
5
- /**
6
- * Core formatting and locale helpers.
7
- *
8
- * This entry point exposes deterministic locale and formatting primitives. It
9
- * does not export the GT service client, project credentials, network
10
- * translation methods, file APIs, or other server/service concerns from the
11
- * root `generaltranslation` facade.
12
- *
13
- * This entry point is intended for framework and shared packages that need
14
- * locale metadata or formatting behavior without pulling in the full
15
- * translation API surface.
16
- */
17
- /**
18
- * Formats a string with cutoff behavior, applying a terminator when the string exceeds the maximum character limit.
19
- *
20
- * This standalone function provides cutoff formatting functionality without requiring a GT instance.
21
- * The locales parameter is required for proper terminator selection based on the target language.
22
- *
23
- * @param {string} value - The string value to format with cutoff behavior.
24
- * @param {Object} [options] - Configuration options for cutoff formatting.
25
- * @param {string | string[]} [options.locales] - The locales to use for terminator selection.
26
- * @param {number} [options.maxChars] - The maximum number of characters to display.
27
- * - Undefined values are treated as no cutoff.
28
- * - Negative values follow .slice() behavior and terminator will be added before the value.
29
- * - 0 will result in an empty string.
30
- * - If cutoff results in an empty string, no terminator is added.
31
- * @param {CutoffFormatStyle} [options.style='ellipsis'] - The style of the terminator.
32
- * @param {string} [options.terminator] - Optional override the terminator to use.
33
- * @param {string} [options.separator] - Optional override the separator to use between the terminator and the value.
34
- * - If no terminator is provided, then separator is ignored.
35
- * @returns {string} The formatted string with terminator applied if cutoff occurs.
36
- *
37
- * @example
38
- * formatCutoff('Hello, world!', { locales: 'en-US', maxChars: 8 });
39
- * // Returns: 'Hello, …'
40
- *
41
- * @example
42
- * formatCutoff('Hello, world!', { locales: 'en-US', maxChars: -3 });
43
- * // Returns: '…d!'
44
- *
45
- * @example
46
- * formatCutoff('Very long text that needs cutting', {
47
- * locales: 'en-US',
48
- * maxChars: 15,
49
- * style: 'ellipsis',
50
- * separator: ' '
51
- * });
52
- * // Returns: 'Very long tex …'
53
- */
54
- export declare function formatCutoff(value: string, options?: {
55
- locales?: string | string[];
56
- } & CutoffFormatOptions): string;
57
- /**
58
- * Formats a message according to the specified locales and options.
59
- *
60
- * @param {string} message - The message to format.
61
- * @param {Object} [options] - Configuration options for message formatting.
62
- * @param {string | string[]} [options.locales] - The locales to use for formatting.
63
- * @param {FormatVariables} [options.variables] - The variables to use for formatting.
64
- * @param {StringFormat} [options.dataFormat='ICU'] - The format of the message. When STRING, the message is returned as is.
65
- * @returns {string} The formatted message.
66
- *
67
- * @example
68
- * formatMessage('Hello {name}', { variables: { name: 'John' } });
69
- * // Returns: "Hello John"
70
- *
71
- * @example
72
- * formatMessage('Hello {name}', {
73
- * locales: ['fr'],
74
- * variables: { name: 'John' }
75
- * });
76
- */
77
- export declare function formatMessage(message: string, options?: {
78
- locales?: string | string[];
79
- variables?: FormatVariables;
80
- dataFormat?: StringFormat;
81
- }): string;
82
- /**
83
- * Checks if a given BCP 47 locale code is valid.
84
- *
85
- * @param {string} locale - The BCP 47 locale code to validate.
86
- * @param {CustomMapping} [customMapping] - The custom mapping to use for validation.
87
- * @returns {boolean} True if the BCP 47 code is valid, false otherwise.
88
- *
89
- * @example
90
- * isValidLocale('en-US');
91
- * // Returns: true
92
- *
93
- * @example
94
- * isValidLocale('en_US');
95
- * // Returns: false
96
- */
97
- export declare function isValidLocale(locale: string, customMapping?: CustomMapping): boolean;
98
- /**
99
- * Resolves the canonical locale for a given locale.
100
- *
101
- * @param {string} locale - The locale to resolve the canonical locale for.
102
- * @param {CustomMapping} [customMapping] - The custom mapping to use for resolving the canonical locale.
103
- * @returns {string} The canonical locale, or the input locale when no canonical mapping exists.
104
- *
105
- * @example
106
- * resolveCanonicalLocale('en-US');
107
- * // Returns: 'en-US'
108
- *
109
- * @example
110
- * resolveCanonicalLocale('en', { en: 'en-US' });
111
- * // Returns: 'en-US'
112
- */
113
- export declare function resolveCanonicalLocale(locale: string, customMapping?: CustomMapping): string;
114
- /**
115
- * Standardizes a BCP 47 locale code to ensure correct formatting.
116
- *
117
- * @param {string} locale - The BCP 47 locale code to standardize.
118
- * @returns {string} The standardized BCP 47 locale code, or the input string if it cannot be standardized.
119
- *
120
- * @example
121
- * standardizeLocale('en-us');
122
- * // Returns: 'en-US'
123
- *
124
- * @example
125
- * standardizeLocale('not a locale');
126
- * // Returns: 'not a locale'
127
- */
128
- export declare function standardizeLocale(locale: string): string;
1
+ export * from '@generaltranslation/format';
package/dist/core.js CHANGED
@@ -1,137 +1 @@
1
- import { _formatCutoff, _formatMessageICU, _formatMessageString, } from './formatting/format';
2
- import { _isValidLocale, _standardizeLocale } from './locales/isValidLocale';
3
- import { _resolveCanonicalLocale } from './locales/resolveCanonicalLocale';
4
- export { LocaleConfig, } from './LocaleConfig';
5
- /**
6
- * Core formatting and locale helpers.
7
- *
8
- * This entry point exposes deterministic locale and formatting primitives. It
9
- * does not export the GT service client, project credentials, network
10
- * translation methods, file APIs, or other server/service concerns from the
11
- * root `generaltranslation` facade.
12
- *
13
- * This entry point is intended for framework and shared packages that need
14
- * locale metadata or formatting behavior without pulling in the full
15
- * translation API surface.
16
- */
17
- /**
18
- * Formats a string with cutoff behavior, applying a terminator when the string exceeds the maximum character limit.
19
- *
20
- * This standalone function provides cutoff formatting functionality without requiring a GT instance.
21
- * The locales parameter is required for proper terminator selection based on the target language.
22
- *
23
- * @param {string} value - The string value to format with cutoff behavior.
24
- * @param {Object} [options] - Configuration options for cutoff formatting.
25
- * @param {string | string[]} [options.locales] - The locales to use for terminator selection.
26
- * @param {number} [options.maxChars] - The maximum number of characters to display.
27
- * - Undefined values are treated as no cutoff.
28
- * - Negative values follow .slice() behavior and terminator will be added before the value.
29
- * - 0 will result in an empty string.
30
- * - If cutoff results in an empty string, no terminator is added.
31
- * @param {CutoffFormatStyle} [options.style='ellipsis'] - The style of the terminator.
32
- * @param {string} [options.terminator] - Optional override the terminator to use.
33
- * @param {string} [options.separator] - Optional override the separator to use between the terminator and the value.
34
- * - If no terminator is provided, then separator is ignored.
35
- * @returns {string} The formatted string with terminator applied if cutoff occurs.
36
- *
37
- * @example
38
- * formatCutoff('Hello, world!', { locales: 'en-US', maxChars: 8 });
39
- * // Returns: 'Hello, …'
40
- *
41
- * @example
42
- * formatCutoff('Hello, world!', { locales: 'en-US', maxChars: -3 });
43
- * // Returns: '…d!'
44
- *
45
- * @example
46
- * formatCutoff('Very long text that needs cutting', {
47
- * locales: 'en-US',
48
- * maxChars: 15,
49
- * style: 'ellipsis',
50
- * separator: ' '
51
- * });
52
- * // Returns: 'Very long tex …'
53
- */
54
- export function formatCutoff(value, options) {
55
- return _formatCutoff({ value: value, locales: options === null || options === void 0 ? void 0 : options.locales, options: options });
56
- }
57
- /**
58
- * Formats a message according to the specified locales and options.
59
- *
60
- * @param {string} message - The message to format.
61
- * @param {Object} [options] - Configuration options for message formatting.
62
- * @param {string | string[]} [options.locales] - The locales to use for formatting.
63
- * @param {FormatVariables} [options.variables] - The variables to use for formatting.
64
- * @param {StringFormat} [options.dataFormat='ICU'] - The format of the message. When STRING, the message is returned as is.
65
- * @returns {string} The formatted message.
66
- *
67
- * @example
68
- * formatMessage('Hello {name}', { variables: { name: 'John' } });
69
- * // Returns: "Hello John"
70
- *
71
- * @example
72
- * formatMessage('Hello {name}', {
73
- * locales: ['fr'],
74
- * variables: { name: 'John' }
75
- * });
76
- */
77
- export function formatMessage(message, options) {
78
- switch (options === null || options === void 0 ? void 0 : options.dataFormat) {
79
- case 'STRING':
80
- return _formatMessageString(message);
81
- default:
82
- return _formatMessageICU(message, options === null || options === void 0 ? void 0 : options.locales, options === null || options === void 0 ? void 0 : options.variables);
83
- }
84
- }
85
- /**
86
- * Checks if a given BCP 47 locale code is valid.
87
- *
88
- * @param {string} locale - The BCP 47 locale code to validate.
89
- * @param {CustomMapping} [customMapping] - The custom mapping to use for validation.
90
- * @returns {boolean} True if the BCP 47 code is valid, false otherwise.
91
- *
92
- * @example
93
- * isValidLocale('en-US');
94
- * // Returns: true
95
- *
96
- * @example
97
- * isValidLocale('en_US');
98
- * // Returns: false
99
- */
100
- export function isValidLocale(locale, customMapping) {
101
- return _isValidLocale(locale, customMapping);
102
- }
103
- /**
104
- * Resolves the canonical locale for a given locale.
105
- *
106
- * @param {string} locale - The locale to resolve the canonical locale for.
107
- * @param {CustomMapping} [customMapping] - The custom mapping to use for resolving the canonical locale.
108
- * @returns {string} The canonical locale, or the input locale when no canonical mapping exists.
109
- *
110
- * @example
111
- * resolveCanonicalLocale('en-US');
112
- * // Returns: 'en-US'
113
- *
114
- * @example
115
- * resolveCanonicalLocale('en', { en: 'en-US' });
116
- * // Returns: 'en-US'
117
- */
118
- export function resolveCanonicalLocale(locale, customMapping) {
119
- return _resolveCanonicalLocale(locale, customMapping);
120
- }
121
- /**
122
- * Standardizes a BCP 47 locale code to ensure correct formatting.
123
- *
124
- * @param {string} locale - The BCP 47 locale code to standardize.
125
- * @returns {string} The standardized BCP 47 locale code, or the input string if it cannot be standardized.
126
- *
127
- * @example
128
- * standardizeLocale('en-us');
129
- * // Returns: 'en-US'
130
- *
131
- * @example
132
- * standardizeLocale('not a locale');
133
- * // Returns: 'not a locale'
134
- */
135
- export function standardizeLocale(locale) {
136
- return _standardizeLocale(locale);
137
- }
1
+ export * from '@generaltranslation/format';
package/dist/core.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as standardizeLocale, i as resolveCanonicalLocale, n as formatMessage, o as LocaleConfig, r as isValidLocale, t as formatCutoff } from "./core-isLphYAZ.mjs";
2
- export { LocaleConfig, formatCutoff, formatMessage, isValidLocale, resolveCanonicalLocale, standardizeLocale };
1
+ export * from "@generaltranslation/format";
2
+ export {};
@@ -1,4 +1,4 @@
1
- import { IcuMessage } from '../types-dir/jsx/content';
1
+ import type { IcuMessage } from '@generaltranslation/format/types';
2
2
  /**
3
3
  * Given an ICU string adds identifiers to each _gt_ placeholder
4
4
  * indexVars('Hello {_gt_} {_gt_} World') => 'Hello {_gt_1_} {_gt_2_} World'
package/dist/errors.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_ApiError = require("./ApiError-CZ45tkW6.cjs");
2
+ const require_ApiError = require("./ApiError-D-IBuHj6.cjs");
3
3
  exports.ApiError = require_ApiError.ApiError;
package/dist/errors.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as ApiError } from "./ApiError-IYfaOR30.mjs";
1
+ import { t as ApiError } from "./ApiError-0DxxIHLp.mjs";
2
2
  export { ApiError };
@@ -1,4 +1,4 @@
1
- import { DataFormat } from '../types-dir/jsx/content';
1
+ import type { DataFormat } from '@generaltranslation/format/types';
2
2
  export type HashMetadata = {
3
3
  context?: string;
4
4
  id?: string;
@@ -1,4 +1,4 @@
1
- const require_isVariable = require("./isVariable-B08mggBy.cjs");
1
+ const require_isVariable = require("./isVariable-Ba1gLXdB.cjs");
2
2
  //#region src/id/hashSource.ts
3
3
  /**
4
4
  * Calculates a unique hash for a given string using SHA-256.
@@ -86,4 +86,4 @@ Object.defineProperty(exports, "hashTemplate", {
86
86
  }
87
87
  });
88
88
 
89
- //# sourceMappingURL=id-CyiXsQrY.cjs.map
89
+ //# sourceMappingURL=id-C2orn1MA.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"id-CyiXsQrY.cjs","names":["bytesToHex","sha256","utf8ToBytes","stringify","isVariable","stringify"],"sources":["../src/id/hashSource.ts","../src/id/hashTemplate.ts"],"sourcesContent":["// Functions provided to other GT libraries\n\nimport { JsxChild, JsxChildren, Variable } from '../types';\nimport { stableStringify as stringify } from '../utils/stableStringify';\nimport { sha256 } from '@noble/hashes/sha2.js';\nimport { bytesToHex, utf8ToBytes } from '@noble/hashes/utils.js';\nimport isVariable from '../utils/isVariable';\nimport { HashMetadata } from './types';\n\n// ----- FUNCTIONS ----- //\n/**\n * Calculates a unique hash for a given string using SHA-256.\n *\n * First 16 characters of hash, hex encoded.\n *\n * @param {string} string - The string to be hashed.\n * @returns {string} The resulting hash as a hexadecimal string.\n */\nexport function hashString(string: string): string {\n return bytesToHex(sha256(utf8ToBytes(string))).slice(0, 16);\n}\n\n/**\n * Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.\n *\n * @param {any} childrenAsObjects - The children objects to be hashed.\n * @param {string} [context] - The context for the children.\n * @param {string} [id] - The ID for the JSX children object.\n * @param {number} [maxChars] - The maxChars limit for the JSX children object.\n * @param {string} [dataFormat] - The data format of the sources.\n * @param {function} [hashFunction] - Custom hash function.\n * @returns {string} - The unique hash of the children.\n */\nexport function hashSource(\n {\n source,\n context,\n id,\n maxChars,\n dataFormat,\n }: {\n source: JsxChildren | string;\n } & HashMetadata,\n hashFunction: (string: string) => string = hashString\n): string {\n let sanitizedSource: SanitizedChildren | string;\n if (dataFormat === 'JSX') {\n sanitizedSource = sanitizeJsxChildren(source);\n } else {\n sanitizedSource = source as string;\n }\n const sanitizedData: {\n source?: SanitizedChildren;\n } & HashMetadata = {\n source: sanitizedSource,\n ...(id && { id }),\n ...(context && { context }),\n ...(maxChars != null && { maxChars: Math.abs(maxChars) }),\n ...(dataFormat && { dataFormat }),\n };\n const stringifiedData = stringify(sanitizedData);\n return hashFunction(stringifiedData);\n}\n\ntype SanitizedVariable = Omit<Variable, 'i'>;\n\ntype SanitizedElement = {\n b?: {\n [k: string]: SanitizedChildren; // Branches\n };\n c?: SanitizedChildren; // Children\n t?: string; // Branch Transformation\n};\ntype SanitizedChild = SanitizedElement | SanitizedVariable | string;\ntype SanitizedChildren = SanitizedChild | SanitizedChild[];\n\n/**\n * Sanitizes a child object by removing the data-_gt attribute and its branches.\n *\n * @param child - The child object to sanitize.\n * @returns The sanitized child object.\n *\n */\nconst sanitizeChild = (child: JsxChild): SanitizedChild => {\n if (child && typeof child === 'object') {\n const newChild: SanitizedChild = {};\n if ('c' in child && child.c) {\n newChild.c = sanitizeJsxChildren(child.c);\n }\n if ('d' in child) {\n const generaltranslation = child?.d;\n if (generaltranslation?.b) {\n // The only thing that prevents sanitizeJsx from being stable is\n // the order of the keys in the branches object.\n // We don't sort them because stable-stringify sorts them anyways\n newChild.b = Object.fromEntries(\n Object.entries(generaltranslation.b).map(([key, value]) => [\n key,\n sanitizeJsxChildren(value as JsxChildren),\n ])\n );\n }\n if (generaltranslation?.t) {\n newChild.t = generaltranslation.t;\n }\n }\n if (isVariable(child)) {\n return {\n k: child.k,\n ...(child.v && {\n v: child.v,\n }),\n };\n }\n return newChild;\n }\n return child;\n};\n\nfunction sanitizeJsxChildren(\n childrenAsObjects: JsxChildren\n): SanitizedChildren {\n return Array.isArray(childrenAsObjects)\n ? childrenAsObjects.map(sanitizeChild)\n : sanitizeChild(childrenAsObjects);\n}\n","import { hashString } from './hashSource';\nimport { stableStringify as stringify } from '../utils/stableStringify';\n\nexport default function hashTemplate(\n template: {\n [key: string]: string;\n },\n hashFunction = hashString\n): string {\n return hashFunction(stringify(template));\n}\n"],"mappings":";;;;;;;;;;AAkBA,SAAgB,WAAW,QAAwB;AACjD,QAAOA,mBAAAA,WAAWC,mBAAAA,OAAOC,mBAAAA,YAAY,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG;;;;;;;;;;;;;AAc7D,SAAgB,WACd,EACE,QACA,SACA,IACA,UACA,cAIF,eAA2C,YACnC;CACR,IAAI;AACJ,KAAI,eAAe,MACjB,mBAAkB,oBAAoB,OAAO;KAE7C,mBAAkB;AAYpB,QAAO,aADiBC,mBAAAA,gBAAU;EANhC,QAAQ;EACR,GAAI,MAAM,EAAE,IAAI;EAChB,GAAI,WAAW,EAAE,SAAS;EAC1B,GAAI,YAAY,QAAQ,EAAE,UAAU,KAAK,IAAI,SAAS,EAAE;EACxD,GAAI,cAAc,EAAE,YAAY;EAEa,CACZ,CAAC;;;;;;;;;AAsBtC,MAAM,iBAAiB,UAAoC;AACzD,KAAI,SAAS,OAAO,UAAU,UAAU;EACtC,MAAM,WAA2B,EAAE;AACnC,MAAI,OAAO,SAAS,MAAM,EACxB,UAAS,IAAI,oBAAoB,MAAM,EAAE;AAE3C,MAAI,OAAO,OAAO;GAChB,MAAM,qBAAqB,OAAO;AAClC,OAAI,oBAAoB,EAItB,UAAS,IAAI,OAAO,YAClB,OAAO,QAAQ,mBAAmB,EAAE,CAAC,KAAK,CAAC,KAAK,WAAW,CACzD,KACA,oBAAoB,MAAqB,CAC1C,CAAC,CACH;AAEH,OAAI,oBAAoB,EACtB,UAAS,IAAI,mBAAmB;;AAGpC,MAAIC,mBAAAA,WAAW,MAAM,CACnB,QAAO;GACL,GAAG,MAAM;GACT,GAAI,MAAM,KAAK,EACb,GAAG,MAAM,GACV;GACF;AAEH,SAAO;;AAET,QAAO;;AAGT,SAAS,oBACP,mBACmB;AACnB,QAAO,MAAM,QAAQ,kBAAkB,GACnC,kBAAkB,IAAI,cAAc,GACpC,cAAc,kBAAkB;;;;ACzHtC,SAAwB,aACtB,UAGA,eAAe,YACP;AACR,QAAO,aAAaC,mBAAAA,gBAAU,SAAS,CAAC"}
1
+ {"version":3,"file":"id-C2orn1MA.cjs","names":["bytesToHex","sha256","utf8ToBytes","stringify","isVariable","stringify"],"sources":["../src/id/hashSource.ts","../src/id/hashTemplate.ts"],"sourcesContent":["// Functions provided to other GT libraries\n\nimport { JsxChild, JsxChildren, Variable } from '../types';\nimport { stableStringify as stringify } from '../utils/stableStringify';\nimport { sha256 } from '@noble/hashes/sha2.js';\nimport { bytesToHex, utf8ToBytes } from '@noble/hashes/utils.js';\nimport isVariable from '../utils/isVariable';\nimport { HashMetadata } from './types';\n\n// ----- FUNCTIONS ----- //\n/**\n * Calculates a unique hash for a given string using SHA-256.\n *\n * First 16 characters of hash, hex encoded.\n *\n * @param {string} string - The string to be hashed.\n * @returns {string} The resulting hash as a hexadecimal string.\n */\nexport function hashString(string: string): string {\n return bytesToHex(sha256(utf8ToBytes(string))).slice(0, 16);\n}\n\n/**\n * Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.\n *\n * @param {any} childrenAsObjects - The children objects to be hashed.\n * @param {string} [context] - The context for the children.\n * @param {string} [id] - The ID for the JSX children object.\n * @param {number} [maxChars] - The maxChars limit for the JSX children object.\n * @param {string} [dataFormat] - The data format of the sources.\n * @param {function} [hashFunction] - Custom hash function.\n * @returns {string} - The unique hash of the children.\n */\nexport function hashSource(\n {\n source,\n context,\n id,\n maxChars,\n dataFormat,\n }: {\n source: JsxChildren | string;\n } & HashMetadata,\n hashFunction: (string: string) => string = hashString\n): string {\n let sanitizedSource: SanitizedChildren | string;\n if (dataFormat === 'JSX') {\n sanitizedSource = sanitizeJsxChildren(source);\n } else {\n sanitizedSource = source as string;\n }\n const sanitizedData: {\n source?: SanitizedChildren;\n } & HashMetadata = {\n source: sanitizedSource,\n ...(id && { id }),\n ...(context && { context }),\n ...(maxChars != null && { maxChars: Math.abs(maxChars) }),\n ...(dataFormat && { dataFormat }),\n };\n const stringifiedData = stringify(sanitizedData);\n return hashFunction(stringifiedData);\n}\n\ntype SanitizedVariable = Omit<Variable, 'i'>;\n\ntype SanitizedElement = {\n b?: {\n [k: string]: SanitizedChildren; // Branches\n };\n c?: SanitizedChildren; // Children\n t?: string; // Branch Transformation\n};\ntype SanitizedChild = SanitizedElement | SanitizedVariable | string;\ntype SanitizedChildren = SanitizedChild | SanitizedChild[];\n\n/**\n * Sanitizes a child object by removing the data-_gt attribute and its branches.\n *\n * @param child - The child object to sanitize.\n * @returns The sanitized child object.\n *\n */\nconst sanitizeChild = (child: JsxChild): SanitizedChild => {\n if (child && typeof child === 'object') {\n const newChild: SanitizedChild = {};\n if ('c' in child && child.c) {\n newChild.c = sanitizeJsxChildren(child.c);\n }\n if ('d' in child) {\n const generaltranslation = child?.d;\n if (generaltranslation?.b) {\n // The only thing that prevents sanitizeJsx from being stable is\n // the order of the keys in the branches object.\n // We don't sort them because stable-stringify sorts them anyways\n newChild.b = Object.fromEntries(\n Object.entries(generaltranslation.b).map(([key, value]) => [\n key,\n sanitizeJsxChildren(value as JsxChildren),\n ])\n );\n }\n if (generaltranslation?.t) {\n newChild.t = generaltranslation.t;\n }\n }\n if (isVariable(child)) {\n return {\n k: child.k,\n ...(child.v && {\n v: child.v,\n }),\n };\n }\n return newChild;\n }\n return child;\n};\n\nfunction sanitizeJsxChildren(\n childrenAsObjects: JsxChildren\n): SanitizedChildren {\n return Array.isArray(childrenAsObjects)\n ? childrenAsObjects.map(sanitizeChild)\n : sanitizeChild(childrenAsObjects);\n}\n","import { hashString } from './hashSource';\nimport { stableStringify as stringify } from '../utils/stableStringify';\n\nexport default function hashTemplate(\n template: {\n [key: string]: string;\n },\n hashFunction = hashString\n): string {\n return hashFunction(stringify(template));\n}\n"],"mappings":";;;;;;;;;;AAkBA,SAAgB,WAAW,QAAwB;AACjD,QAAOA,mBAAAA,WAAWC,mBAAAA,OAAOC,mBAAAA,YAAY,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG;;;;;;;;;;;;;AAc7D,SAAgB,WACd,EACE,QACA,SACA,IACA,UACA,cAIF,eAA2C,YACnC;CACR,IAAI;AACJ,KAAI,eAAe,MACjB,mBAAkB,oBAAoB,OAAO;KAE7C,mBAAkB;AAYpB,QAAO,aADiBC,mBAAAA,gBAAU;EANhC,QAAQ;EACR,GAAI,MAAM,EAAE,IAAI;EAChB,GAAI,WAAW,EAAE,SAAS;EAC1B,GAAI,YAAY,QAAQ,EAAE,UAAU,KAAK,IAAI,SAAS,EAAE;EACxD,GAAI,cAAc,EAAE,YAAY;EAEa,CACZ,CAAC;;;;;;;;;AAsBtC,MAAM,iBAAiB,UAAoC;AACzD,KAAI,SAAS,OAAO,UAAU,UAAU;EACtC,MAAM,WAA2B,EAAE;AACnC,MAAI,OAAO,SAAS,MAAM,EACxB,UAAS,IAAI,oBAAoB,MAAM,EAAE;AAE3C,MAAI,OAAO,OAAO;GAChB,MAAM,qBAAqB,OAAO;AAClC,OAAI,oBAAoB,EAItB,UAAS,IAAI,OAAO,YAClB,OAAO,QAAQ,mBAAmB,EAAE,CAAC,KAAK,CAAC,KAAK,WAAW,CACzD,KACA,oBAAoB,MAAqB,CAC1C,CAAC,CACH;AAEH,OAAI,oBAAoB,EACtB,UAAS,IAAI,mBAAmB;;AAGpC,MAAIC,mBAAAA,WAAW,MAAM,CACnB,QAAO;GACL,GAAG,MAAM;GACT,GAAI,MAAM,KAAK,EACb,GAAG,MAAM,GACV;GACF;AAEH,SAAO;;AAET,QAAO;;AAGT,SAAS,oBACP,mBACmB;AACnB,QAAO,MAAM,QAAQ,kBAAkB,GACnC,kBAAkB,IAAI,cAAc,GACpC,cAAc,kBAAkB;;;;ACzHtC,SAAwB,aACtB,UAGA,eAAe,YACP;AACR,QAAO,aAAaC,mBAAAA,gBAAU,SAAS,CAAC"}
@@ -1,4 +1,4 @@
1
- import { n as stableStringify, t as isVariable } from "./isVariable-CYsKFHvR.mjs";
1
+ import { n as stableStringify, t as isVariable } from "./isVariable-fAKEB7gF.mjs";
2
2
  import { sha256 } from "@noble/hashes/sha2.js";
3
3
  import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
4
4
  //#region src/id/hashSource.ts
@@ -71,4 +71,4 @@ function hashTemplate(template, hashFunction = hashString) {
71
71
  //#endregion
72
72
  export { hashSource as n, hashString as r, hashTemplate as t };
73
73
 
74
- //# sourceMappingURL=id-DbD7K-HL.mjs.map
74
+ //# sourceMappingURL=id-DEaFhGqX.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"id-DbD7K-HL.mjs","names":["stringify","stringify"],"sources":["../src/id/hashSource.ts","../src/id/hashTemplate.ts"],"sourcesContent":["// Functions provided to other GT libraries\n\nimport { JsxChild, JsxChildren, Variable } from '../types';\nimport { stableStringify as stringify } from '../utils/stableStringify';\nimport { sha256 } from '@noble/hashes/sha2.js';\nimport { bytesToHex, utf8ToBytes } from '@noble/hashes/utils.js';\nimport isVariable from '../utils/isVariable';\nimport { HashMetadata } from './types';\n\n// ----- FUNCTIONS ----- //\n/**\n * Calculates a unique hash for a given string using SHA-256.\n *\n * First 16 characters of hash, hex encoded.\n *\n * @param {string} string - The string to be hashed.\n * @returns {string} The resulting hash as a hexadecimal string.\n */\nexport function hashString(string: string): string {\n return bytesToHex(sha256(utf8ToBytes(string))).slice(0, 16);\n}\n\n/**\n * Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.\n *\n * @param {any} childrenAsObjects - The children objects to be hashed.\n * @param {string} [context] - The context for the children.\n * @param {string} [id] - The ID for the JSX children object.\n * @param {number} [maxChars] - The maxChars limit for the JSX children object.\n * @param {string} [dataFormat] - The data format of the sources.\n * @param {function} [hashFunction] - Custom hash function.\n * @returns {string} - The unique hash of the children.\n */\nexport function hashSource(\n {\n source,\n context,\n id,\n maxChars,\n dataFormat,\n }: {\n source: JsxChildren | string;\n } & HashMetadata,\n hashFunction: (string: string) => string = hashString\n): string {\n let sanitizedSource: SanitizedChildren | string;\n if (dataFormat === 'JSX') {\n sanitizedSource = sanitizeJsxChildren(source);\n } else {\n sanitizedSource = source as string;\n }\n const sanitizedData: {\n source?: SanitizedChildren;\n } & HashMetadata = {\n source: sanitizedSource,\n ...(id && { id }),\n ...(context && { context }),\n ...(maxChars != null && { maxChars: Math.abs(maxChars) }),\n ...(dataFormat && { dataFormat }),\n };\n const stringifiedData = stringify(sanitizedData);\n return hashFunction(stringifiedData);\n}\n\ntype SanitizedVariable = Omit<Variable, 'i'>;\n\ntype SanitizedElement = {\n b?: {\n [k: string]: SanitizedChildren; // Branches\n };\n c?: SanitizedChildren; // Children\n t?: string; // Branch Transformation\n};\ntype SanitizedChild = SanitizedElement | SanitizedVariable | string;\ntype SanitizedChildren = SanitizedChild | SanitizedChild[];\n\n/**\n * Sanitizes a child object by removing the data-_gt attribute and its branches.\n *\n * @param child - The child object to sanitize.\n * @returns The sanitized child object.\n *\n */\nconst sanitizeChild = (child: JsxChild): SanitizedChild => {\n if (child && typeof child === 'object') {\n const newChild: SanitizedChild = {};\n if ('c' in child && child.c) {\n newChild.c = sanitizeJsxChildren(child.c);\n }\n if ('d' in child) {\n const generaltranslation = child?.d;\n if (generaltranslation?.b) {\n // The only thing that prevents sanitizeJsx from being stable is\n // the order of the keys in the branches object.\n // We don't sort them because stable-stringify sorts them anyways\n newChild.b = Object.fromEntries(\n Object.entries(generaltranslation.b).map(([key, value]) => [\n key,\n sanitizeJsxChildren(value as JsxChildren),\n ])\n );\n }\n if (generaltranslation?.t) {\n newChild.t = generaltranslation.t;\n }\n }\n if (isVariable(child)) {\n return {\n k: child.k,\n ...(child.v && {\n v: child.v,\n }),\n };\n }\n return newChild;\n }\n return child;\n};\n\nfunction sanitizeJsxChildren(\n childrenAsObjects: JsxChildren\n): SanitizedChildren {\n return Array.isArray(childrenAsObjects)\n ? childrenAsObjects.map(sanitizeChild)\n : sanitizeChild(childrenAsObjects);\n}\n","import { hashString } from './hashSource';\nimport { stableStringify as stringify } from '../utils/stableStringify';\n\nexport default function hashTemplate(\n template: {\n [key: string]: string;\n },\n hashFunction = hashString\n): string {\n return hashFunction(stringify(template));\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,SAAgB,WAAW,QAAwB;AACjD,QAAO,WAAW,OAAO,YAAY,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG;;;;;;;;;;;;;AAc7D,SAAgB,WACd,EACE,QACA,SACA,IACA,UACA,cAIF,eAA2C,YACnC;CACR,IAAI;AACJ,KAAI,eAAe,MACjB,mBAAkB,oBAAoB,OAAO;KAE7C,mBAAkB;AAYpB,QAAO,aADiBA,gBAAU;EANhC,QAAQ;EACR,GAAI,MAAM,EAAE,IAAI;EAChB,GAAI,WAAW,EAAE,SAAS;EAC1B,GAAI,YAAY,QAAQ,EAAE,UAAU,KAAK,IAAI,SAAS,EAAE;EACxD,GAAI,cAAc,EAAE,YAAY;EAEa,CACZ,CAAC;;;;;;;;;AAsBtC,MAAM,iBAAiB,UAAoC;AACzD,KAAI,SAAS,OAAO,UAAU,UAAU;EACtC,MAAM,WAA2B,EAAE;AACnC,MAAI,OAAO,SAAS,MAAM,EACxB,UAAS,IAAI,oBAAoB,MAAM,EAAE;AAE3C,MAAI,OAAO,OAAO;GAChB,MAAM,qBAAqB,OAAO;AAClC,OAAI,oBAAoB,EAItB,UAAS,IAAI,OAAO,YAClB,OAAO,QAAQ,mBAAmB,EAAE,CAAC,KAAK,CAAC,KAAK,WAAW,CACzD,KACA,oBAAoB,MAAqB,CAC1C,CAAC,CACH;AAEH,OAAI,oBAAoB,EACtB,UAAS,IAAI,mBAAmB;;AAGpC,MAAI,WAAW,MAAM,CACnB,QAAO;GACL,GAAG,MAAM;GACT,GAAI,MAAM,KAAK,EACb,GAAG,MAAM,GACV;GACF;AAEH,SAAO;;AAET,QAAO;;AAGT,SAAS,oBACP,mBACmB;AACnB,QAAO,MAAM,QAAQ,kBAAkB,GACnC,kBAAkB,IAAI,cAAc,GACpC,cAAc,kBAAkB;;;;ACzHtC,SAAwB,aACtB,UAGA,eAAe,YACP;AACR,QAAO,aAAaC,gBAAU,SAAS,CAAC"}
1
+ {"version":3,"file":"id-DEaFhGqX.mjs","names":["stringify","stringify"],"sources":["../src/id/hashSource.ts","../src/id/hashTemplate.ts"],"sourcesContent":["// Functions provided to other GT libraries\n\nimport { JsxChild, JsxChildren, Variable } from '../types';\nimport { stableStringify as stringify } from '../utils/stableStringify';\nimport { sha256 } from '@noble/hashes/sha2.js';\nimport { bytesToHex, utf8ToBytes } from '@noble/hashes/utils.js';\nimport isVariable from '../utils/isVariable';\nimport { HashMetadata } from './types';\n\n// ----- FUNCTIONS ----- //\n/**\n * Calculates a unique hash for a given string using SHA-256.\n *\n * First 16 characters of hash, hex encoded.\n *\n * @param {string} string - The string to be hashed.\n * @returns {string} The resulting hash as a hexadecimal string.\n */\nexport function hashString(string: string): string {\n return bytesToHex(sha256(utf8ToBytes(string))).slice(0, 16);\n}\n\n/**\n * Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.\n *\n * @param {any} childrenAsObjects - The children objects to be hashed.\n * @param {string} [context] - The context for the children.\n * @param {string} [id] - The ID for the JSX children object.\n * @param {number} [maxChars] - The maxChars limit for the JSX children object.\n * @param {string} [dataFormat] - The data format of the sources.\n * @param {function} [hashFunction] - Custom hash function.\n * @returns {string} - The unique hash of the children.\n */\nexport function hashSource(\n {\n source,\n context,\n id,\n maxChars,\n dataFormat,\n }: {\n source: JsxChildren | string;\n } & HashMetadata,\n hashFunction: (string: string) => string = hashString\n): string {\n let sanitizedSource: SanitizedChildren | string;\n if (dataFormat === 'JSX') {\n sanitizedSource = sanitizeJsxChildren(source);\n } else {\n sanitizedSource = source as string;\n }\n const sanitizedData: {\n source?: SanitizedChildren;\n } & HashMetadata = {\n source: sanitizedSource,\n ...(id && { id }),\n ...(context && { context }),\n ...(maxChars != null && { maxChars: Math.abs(maxChars) }),\n ...(dataFormat && { dataFormat }),\n };\n const stringifiedData = stringify(sanitizedData);\n return hashFunction(stringifiedData);\n}\n\ntype SanitizedVariable = Omit<Variable, 'i'>;\n\ntype SanitizedElement = {\n b?: {\n [k: string]: SanitizedChildren; // Branches\n };\n c?: SanitizedChildren; // Children\n t?: string; // Branch Transformation\n};\ntype SanitizedChild = SanitizedElement | SanitizedVariable | string;\ntype SanitizedChildren = SanitizedChild | SanitizedChild[];\n\n/**\n * Sanitizes a child object by removing the data-_gt attribute and its branches.\n *\n * @param child - The child object to sanitize.\n * @returns The sanitized child object.\n *\n */\nconst sanitizeChild = (child: JsxChild): SanitizedChild => {\n if (child && typeof child === 'object') {\n const newChild: SanitizedChild = {};\n if ('c' in child && child.c) {\n newChild.c = sanitizeJsxChildren(child.c);\n }\n if ('d' in child) {\n const generaltranslation = child?.d;\n if (generaltranslation?.b) {\n // The only thing that prevents sanitizeJsx from being stable is\n // the order of the keys in the branches object.\n // We don't sort them because stable-stringify sorts them anyways\n newChild.b = Object.fromEntries(\n Object.entries(generaltranslation.b).map(([key, value]) => [\n key,\n sanitizeJsxChildren(value as JsxChildren),\n ])\n );\n }\n if (generaltranslation?.t) {\n newChild.t = generaltranslation.t;\n }\n }\n if (isVariable(child)) {\n return {\n k: child.k,\n ...(child.v && {\n v: child.v,\n }),\n };\n }\n return newChild;\n }\n return child;\n};\n\nfunction sanitizeJsxChildren(\n childrenAsObjects: JsxChildren\n): SanitizedChildren {\n return Array.isArray(childrenAsObjects)\n ? childrenAsObjects.map(sanitizeChild)\n : sanitizeChild(childrenAsObjects);\n}\n","import { hashString } from './hashSource';\nimport { stableStringify as stringify } from '../utils/stableStringify';\n\nexport default function hashTemplate(\n template: {\n [key: string]: string;\n },\n hashFunction = hashString\n): string {\n return hashFunction(stringify(template));\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,SAAgB,WAAW,QAAwB;AACjD,QAAO,WAAW,OAAO,YAAY,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG;;;;;;;;;;;;;AAc7D,SAAgB,WACd,EACE,QACA,SACA,IACA,UACA,cAIF,eAA2C,YACnC;CACR,IAAI;AACJ,KAAI,eAAe,MACjB,mBAAkB,oBAAoB,OAAO;KAE7C,mBAAkB;AAYpB,QAAO,aADiBA,gBAAU;EANhC,QAAQ;EACR,GAAI,MAAM,EAAE,IAAI;EAChB,GAAI,WAAW,EAAE,SAAS;EAC1B,GAAI,YAAY,QAAQ,EAAE,UAAU,KAAK,IAAI,SAAS,EAAE;EACxD,GAAI,cAAc,EAAE,YAAY;EAEa,CACZ,CAAC;;;;;;;;;AAsBtC,MAAM,iBAAiB,UAAoC;AACzD,KAAI,SAAS,OAAO,UAAU,UAAU;EACtC,MAAM,WAA2B,EAAE;AACnC,MAAI,OAAO,SAAS,MAAM,EACxB,UAAS,IAAI,oBAAoB,MAAM,EAAE;AAE3C,MAAI,OAAO,OAAO;GAChB,MAAM,qBAAqB,OAAO;AAClC,OAAI,oBAAoB,EAItB,UAAS,IAAI,OAAO,YAClB,OAAO,QAAQ,mBAAmB,EAAE,CAAC,KAAK,CAAC,KAAK,WAAW,CACzD,KACA,oBAAoB,MAAqB,CAC1C,CAAC,CACH;AAEH,OAAI,oBAAoB,EACtB,UAAS,IAAI,mBAAmB;;AAGpC,MAAI,WAAW,MAAM,CACnB,QAAO;GACL,GAAG,MAAM;GACT,GAAI,MAAM,KAAK,EACb,GAAG,MAAM,GACV;GACF;AAEH,SAAO;;AAET,QAAO;;AAGT,SAAS,oBACP,mBACmB;AACnB,QAAO,MAAM,QAAQ,kBAAkB,GACnC,kBAAkB,IAAI,cAAc,GACpC,cAAc,kBAAkB;;;;ACzHtC,SAAwB,aACtB,UAGA,eAAe,YACP;AACR,QAAO,aAAaC,gBAAU,SAAS,CAAC"}
package/dist/id.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_id = require("./id-CyiXsQrY.cjs");
2
+ const require_id = require("./id-C2orn1MA.cjs");
3
3
  exports.hashSource = require_id.hashSource;
4
4
  exports.hashString = require_id.hashString;
5
5
  exports.hashTemplate = require_id.hashTemplate;
package/dist/id.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Ot as JsxChildren, pt as HashMetadata } from "./types-Bf8_Apq_.cjs";
1
+ import { Nt as HashMetadata, g as JsxChildren } from "./types-CdRgQtET.cjs";
2
2
 
3
3
  //#region src/id/hashSource.d.ts
4
4
  /**
package/dist/id.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Ot as JsxChildren, pt as HashMetadata } from "./types-AHtYZIP-.mjs";
1
+ import { Nt as HashMetadata, g as JsxChildren } from "./types-Db2Dn3oN.mjs";
2
2
 
3
3
  //#region src/id/hashSource.d.ts
4
4
  /**
package/dist/id.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as hashSource, r as hashString, t as hashTemplate } from "./id-DbD7K-HL.mjs";
1
+ import { n as hashSource, r as hashString, t as hashTemplate } from "./id-DEaFhGqX.mjs";
2
2
  export { hashSource, hashString, hashTemplate };