nolo-cli 0.210.0-alpha.2 → 0.212.0-alpha.1

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 (158) hide show
  1. package/{_executeModel-VVQEOY3D.js → _executeModel-KE6MBNUJ.js} +51 -48
  2. package/{action-U235TV4P.js → action-DF5UYSJF.js} +4 -4
  3. package/{addContentAction-7C76J7ST.js → addContentAction-N2YC5IL3.js} +8 -8
  4. package/{addDialogAgentAction-KTYANUEC.js → addDialogAgentAction-3NKVQCEC.js} +15 -12
  5. package/{agentDeleteCommand-WHRU6VDJ.js → agentDeleteCommand-NWK7VU4N.js} +71 -67
  6. package/{agentEmailCommands-ALLHXPW3.js → agentEmailCommands-UZ4DHEX2.js} +77 -72
  7. package/{agentListCommands-POKMEKMS.js → agentListCommands-HE7L2A6L.js} +190 -77
  8. package/{agentMachineCommands-WJLZLBPI.js → agentMachineCommands-6TE4MBMP.js} +30 -29
  9. package/{agentProviderCommands-MN3ABDME.js → agentProviderCommands-Q5O33MED.js} +33 -4
  10. package/{agentRecordCommands-OULZW3KM.js → agentRecordCommands-L3QQ7HZ4.js} +66 -61
  11. package/{agentRunCommand-ZNG4LGNQ.js → agentRunCommand-2IFGQHCO.js} +68 -64
  12. package/{agentRunControl-AF7BMR22.js → agentRunControl-OI3LOENH.js} +7 -6
  13. package/{agentRuntimeLocal-YMUHFV5M.js → agentRuntimeLocal-HL526DNQ.js} +28 -25
  14. package/{agentSlice-WNGUIMQZ.js → agentSlice-TMYP2UEA.js} +12 -12
  15. package/{appDeleteCommands-6MXPLAVF.js → appDeleteCommands-ZERW4AXY.js} +30 -29
  16. package/{appDeployCommands-ERRSVASW.js → appDeployCommands-DUWSMYHL.js} +30 -29
  17. package/{appDeployStatusCommands-ULICISLI.js → appDeployStatusCommands-N2KIE4BF.js} +30 -29
  18. package/{appGetCommands-WYYYWROF.js → appGetCommands-YVR4NPVY.js} +30 -29
  19. package/{appListCommands-DFCUCRCV.js → appListCommands-JS6HOHZS.js} +30 -29
  20. package/{authCommand-ZJMWXFMA.js → authCommand-FE2C3ZUM.js} +14 -14
  21. package/{authCommands-WK6E42L2.js → authCommands-HV3EAU3V.js} +2 -2
  22. package/{builtinSkillRegistry-HH75G5J3.js → builtinSkillRegistry-3YOIGEF6.js} +5 -4
  23. package/{chunk-JKW6LERJ.js → chunk-22CIEBYO.js} +14 -14
  24. package/{chunk-6HVBI6TI.js → chunk-25JZEIXN.js} +1 -218
  25. package/{chunk-TRZP7JZ7.js → chunk-2QHFH3DR.js} +1 -0
  26. package/{chunk-4LEGTOSR.js → chunk-3AKFVZ2I.js} +1 -1
  27. package/{chunk-XE4Q46FF.js → chunk-3CGG2PAL.js} +1 -1
  28. package/{chunk-25M2K6OA.js → chunk-3FOQHGHN.js} +3 -3
  29. package/{chunk-BSISWVB4.js → chunk-4I7ERB7F.js} +1 -1
  30. package/{chunk-TCTSYFDM.js → chunk-4KH4J3G5.js} +19 -6
  31. package/{chunk-NEZGPBL7.js → chunk-5AQR3DGV.js} +2 -2
  32. package/{chunk-YLTLB5A7.js → chunk-5RYBGBQH.js} +7 -6
  33. package/{chunk-RIALQUSF.js → chunk-6NSSLV67.js} +5 -5
  34. package/{chunk-RXCCWVA2.js → chunk-6OQUPIQF.js} +3 -3
  35. package/chunk-6VLJ6YA7.js +11751 -0
  36. package/{chunk-27E2CBBY.js → chunk-7OCO4TDT.js} +1 -1
  37. package/chunk-7RFNTILS.js +2213 -0
  38. package/{chunk-4WCEC56C.js → chunk-AVTVGMDY.js} +1 -1
  39. package/{chunk-3J3U3KXB.js → chunk-B7NJ3T4A.js} +4 -4
  40. package/{chunk-UMEGDH6A.js → chunk-BFM34N54.js} +7 -7
  41. package/chunk-CJEIOP3E.js +0 -0
  42. package/{chunk-YXOBCDNW.js → chunk-CJRONOYL.js} +5 -5
  43. package/{chunk-LT3EAHJY.js → chunk-CQ46IRNN.js} +38 -36
  44. package/{chunk-NTSRCTUX.js → chunk-CTPXME7U.js} +2 -2
  45. package/{chunk-M4NTDZG3.js → chunk-D5RCRX4A.js} +134 -141
  46. package/{chunk-25OB36GU.js → chunk-DM6UMOEL.js} +4 -4
  47. package/{chunk-TPCDYNJK.js → chunk-EYUBHHFB.js} +1 -1
  48. package/{chunk-Y6M7KJOA.js → chunk-EZFQ6XRV.js} +2 -2
  49. package/{chunk-ZOO3WJIE.js → chunk-FHU44LN3.js} +711 -40
  50. package/chunk-FY7F4Q6X.js +127 -0
  51. package/chunk-G7MLNNEX.js +84 -0
  52. package/{chunk-RYWO5AKN.js → chunk-GNDJKC4B.js} +10 -10
  53. package/{chunk-V3M6IXQI.js → chunk-GPO7FCEZ.js} +187 -36
  54. package/{chunk-RQ22OZD7.js → chunk-H2TJUNCH.js} +1 -1
  55. package/{chunk-C2XZM3K4.js → chunk-HIRC32DV.js} +5 -24
  56. package/{chunk-QQM464AL.js → chunk-HPFCI4SK.js} +3 -3
  57. package/chunk-HRMJUN5J.js +26 -0
  58. package/{chunk-HD3WR3TD.js → chunk-IAPCBNEE.js} +1 -1
  59. package/{chunk-XDMGY5IU.js → chunk-IF45XG7K.js} +220 -9
  60. package/{chunk-NLT32XBZ.js → chunk-IIQ6JGRI.js} +2 -2
  61. package/{chunk-OP7PTBAJ.js → chunk-IJXYFTV7.js} +8 -8
  62. package/{chunk-IIHY4ZAI.js → chunk-INSBKSBB.js} +8 -4
  63. package/{chunk-PAFTGNWA.js → chunk-JIT6FSXJ.js} +1 -1
  64. package/{chunk-WTKYP6QO.js → chunk-JTDORD5P.js} +5 -5
  65. package/{chunk-ECX3NKRD.js → chunk-JY5NGFFH.js} +11 -0
  66. package/chunk-KC4XDTT3.js +227 -0
  67. package/{chunk-PLYWH7XM.js → chunk-KIM6CLW5.js} +7 -7
  68. package/{chunk-SCYQJPGA.js → chunk-M6RL5JCD.js} +147 -20
  69. package/chunk-MMA3LZ3W.js +105 -0
  70. package/{chunk-I5PBXF7O.js → chunk-MMNYUVLW.js} +1 -1
  71. package/{chunk-NHQKWPLP.js → chunk-NJR3WKVP.js} +24 -22
  72. package/{chunk-W5VC7F7V.js → chunk-NOMIGOST.js} +59 -60
  73. package/{chunk-WI6OGHXJ.js → chunk-NRFKLKRU.js} +5 -5
  74. package/{chunk-NXCGNS4N.js → chunk-OHNELDTO.js} +1 -1
  75. package/{chunk-7IYBN7IA.js → chunk-OOF4UPC5.js} +22 -13
  76. package/{chunk-UIOEHFF6.js → chunk-OQHIVPG4.js} +1 -0
  77. package/{chunk-X4F26D5K.js → chunk-P5L7CXOC.js} +58 -33
  78. package/{chunk-5ORJGHTL.js → chunk-PDGKOTO7.js} +5 -5
  79. package/{chunk-UCPAVEQB.js → chunk-PYRUW7XN.js} +1 -1
  80. package/{chunk-SU3QL7YG.js → chunk-QT6PKHYJ.js} +1 -1
  81. package/{chunk-SN5XE6GQ.js → chunk-RPQXPZZF.js} +4 -4
  82. package/{chunk-ZN5AH4BY.js → chunk-RU4SD66C.js} +6 -6
  83. package/{chunk-YKFP6UGT.js → chunk-SOHTHFV2.js} +14 -14
  84. package/{chunk-CKOO42G5.js → chunk-UHJGXRJ4.js} +4 -4
  85. package/{chunk-CVCRAO6Q.js → chunk-UTV2AYEG.js} +9 -7
  86. package/{chunk-DQLB4NQ3.js → chunk-VPAZOH2D.js} +2 -2
  87. package/{chunk-MBS6CTZB.js → chunk-VZKUKCA6.js} +236 -1993
  88. package/{chunk-LNYHAKBP.js → chunk-W4S457LU.js} +1 -1
  89. package/chunk-WPORQFYN.js +74 -0
  90. package/{chunk-ET2CWLIJ.js → chunk-WXYLV624.js} +3 -3
  91. package/chunk-XFYFMTOM.js +92 -0
  92. package/{chunk-NV572QM3.js → chunk-YJMRHHGY.js} +15 -15
  93. package/{chunk-JBOUVTZX.js → chunk-YOIW77S2.js} +13 -2
  94. package/{chunk-ADBWFYJD.js → chunk-YPD3VJZW.js} +9 -9
  95. package/{chunk-DA7CTWT4.js → chunk-YWSEPJ7C.js} +5 -5
  96. package/{chunk-3V2QMRNN.js → chunk-ZL5RAEEB.js} +3 -3
  97. package/cliAgentConfigHelpers-WJBZQTLW.js +41 -0
  98. package/{commandRegistry-FI2IOQ3U.js → commandRegistry-VVMTPFAX.js} +85 -81
  99. package/{contentThunks-5LKNNDGY.js → contentThunks-N52O67MI.js} +25 -24
  100. package/{createAgentAutomationAction-TI4QG4CY.js → createAgentAutomationAction-ZC57YRSV.js} +25 -24
  101. package/{createDialogAction-TJ3JKLO4.js → createDialogAction-VQW5WDYX.js} +27 -26
  102. package/{createPageAction-GKXT6WEH.js → createPageAction-M5VDA7SC.js} +26 -25
  103. package/{dbSlice-LPMZ2DGJ.js → dbSlice-HP7G4LX3.js} +7 -7
  104. package/{deleteFile-EPUQHKPA.js → deleteFile-7VQGLK2V.js} +3 -3
  105. package/{dialogCommands-IWPXIZ5P.js → dialogCommands-JHMR2N2Y.js} +32 -30
  106. package/{dialogSlice-ZWNNS7GZ.js → dialogSlice-GRSVGDTF.js} +23 -22
  107. package/{dialogUsageCommand-ZCPPHPJ5.js → dialogUsageCommand-7KCPYGHG.js} +1 -1
  108. package/{docCreateCommands-HFSPKJSI.js → docCreateCommands-F2K3UPSQ.js} +28 -27
  109. package/{docDeleteCommands-CRL62POH.js → docDeleteCommands-XGXB5RFT.js} +29 -28
  110. package/{docReadCommands-QOTOX3XW.js → docReadCommands-7HWZZV6J.js} +28 -27
  111. package/{docStore-WYLRB7ED.js → docStore-KNZK6Y2G.js} +10 -10
  112. package/{docUpdateCommands-7BMH4MCA.js → docUpdateCommands-OZZ7NQII.js} +28 -27
  113. package/{fetchMessages-YY4SATNR.js → fetchMessages-M3QU7ZCQ.js} +1 -1
  114. package/{getPricing-OQXBJ6VZ.js → getPricing-2MNMXEVG.js} +3 -3
  115. package/{handleSendMessageAction-P27YP2DQ.js → handleSendMessageAction-SHIH74GJ.js} +46 -44
  116. package/hostCredentialCreate-X64WK4JD.js +357 -0
  117. package/index.js +5 -5
  118. package/{keys-P4ZDOVJW.js → keys-BEGDOTRL.js} +3 -1
  119. package/{localDialogRead-5VCMQQZF.js → localDialogRead-XRLAH4CZ.js} +1 -1
  120. package/{localRuntimeAdapter-GP6ZSSO3.js → localRuntimeAdapter-A7K3ABA6.js} +73 -66
  121. package/{machineCommands-6Z6H4BFX.js → machineCommands-DE3MR7CJ.js} +65 -60
  122. package/{machineWsRunDispatch-F2ZIXMYM.js → machineWsRunDispatch-R26P5V36.js} +65 -60
  123. package/{memberThunks-YSEFJF47.js → memberThunks-7WJAY5V6.js} +8 -8
  124. package/package.json +1 -1
  125. package/{projectArchive-PIGEOX3D.js → projectArchive-GGL5HLMD.js} +26 -25
  126. package/{providerPresetApply-ZYMLQA46.js → providerPresetApply-YXGV6NXB.js} +4 -4
  127. package/{providerRegistry-E34XWDLJ.js → providerRegistry-S6UL6UNA.js} +4 -4
  128. package/{read-DIIQBOOO.js → read-4VZQODSN.js} +3 -3
  129. package/{readDocTool-HXYGOEA7.js → readDocTool-AVD32RUJ.js} +1 -1
  130. package/{readlineWorkspace-UG25G7KC.js → readlineWorkspace-XKYKNL2I.js} +157 -100
  131. package/{removeDialogAgentAction-ALJDUJ2E.js → removeDialogAgentAction-FKL4BYMR.js} +17 -14
  132. package/{runAgentClientLoop-IO5F7TCZ.js → runAgentClientLoop-V7E2WBVM.js} +49 -46
  133. package/{runtimeDoctorCommands-PGAA47G5.js → runtimeDoctorCommands-QAI3MBKQ.js} +6 -6
  134. package/{secretCommands-ZCZ4KVET.js → secretCommands-4QS3HCA2.js} +3 -3
  135. package/{setDialogExtraReferencesAction-O3SVMD5A.js → setDialogExtraReferencesAction-TLIOLWWI.js} +10 -10
  136. package/{setPrimaryDialogAgentAction-HE7RVFFF.js → setPrimaryDialogAgentAction-2OLWRFYR.js} +18 -15
  137. package/{settingThunks-BWWJQG4L.js → settingThunks-UGBPCNYF.js} +12 -11
  138. package/{spaceCommands-UAELIFEI.js → spaceCommands-4KSLKVNF.js} +28 -27
  139. package/{streamAgentChatTurn-VUKZQYJR.js → streamAgentChatTurn-7FR7X2NU.js} +57 -54
  140. package/{switchDialogAgentAction-3VZS7SOS.js → switchDialogAgentAction-UZSAG2N5.js} +15 -12
  141. package/{tools-VRXJAVYI.js → tools-ZLKCC25W.js} +43 -40
  142. package/{tuiSummaryLlmCaller-TGCHZLSW.js → tuiSummaryLlmCaller-WC54MVGP.js} +10 -10
  143. package/{updateCommands-Q6CYAEYJ.js → updateCommands-4744PL3P.js} +3 -1
  144. package/{updateDialogTitleAction-MULWCJCW.js → updateDialogTitleAction-U53ZT7PJ.js} +38 -70
  145. package/usageCommand-F4IPVMIZ.js +32 -0
  146. package/usageRebuildCommand-HAW2AD5N.js +626 -0
  147. package/chunk-4LCOCOR5.js +0 -50
  148. package/chunk-7AUQ3WCW.js +0 -51
  149. package/chunk-ZRAU6T47.js +0 -56
  150. package/{agentFavoriteCommands-GAFEXKKP.js → agentFavoriteCommands-EDK743YA.js} +1 -1
  151. package/{agentGrantCommands-V5FOQKFD.js → agentGrantCommands-RQWK2TEV.js} +1 -1
  152. package/{agentPullCommand-2JMJP5BS.js → agentPullCommand-6EM3URVK.js} +1 -1
  153. package/{chunk-BTYQAODF.js → chunk-CZM5YTZ7.js} +3 -3
  154. package/{chunk-A2ZMIRLN.js → chunk-INN4LTAJ.js} +5 -5
  155. package/{chunk-XPHZK3PJ.js → chunk-JNKSDZFS.js} +3 -3
  156. package/{chunk-PV6JJAUB.js → chunk-TCZHTTUU.js} +8 -8
  157. package/{chunk-AKE53VMW.js → chunk-ZCWRMUWT.js} +0 -0
  158. package/{tableCommands-D7WR4QSM.js → tableCommands-MP6VFSVT.js} +3 -3
@@ -1,6 +1,10 @@
1
1
  import {
2
2
  LOCAL_USER_ID
3
3
  } from "./chunk-TZXPT53C.js";
4
+ import {
5
+ applyTokenUsageToDayStats,
6
+ require_format
7
+ } from "./chunk-7RFNTILS.js";
4
8
  import {
5
9
  buildDialogAttachmentPlan,
6
10
  extractFileContentIds
@@ -11,30 +15,24 @@ import {
11
15
  } from "./chunk-523DITKR.js";
12
16
  import {
13
17
  runLlm
14
- } from "./chunk-ADBWFYJD.js";
18
+ } from "./chunk-YPD3VJZW.js";
15
19
  import {
16
20
  isMediaToolConfirmation
17
21
  } from "./chunk-QYPE3TS3.js";
18
22
  import {
19
23
  cleanupCliSessionForDialog
20
- } from "./chunk-NLT32XBZ.js";
24
+ } from "./chunk-IIQ6JGRI.js";
21
25
  import {
22
26
  getApproxPricePerImage
23
27
  } from "./chunk-4JH2UMJR.js";
24
28
  import {
25
29
  addContentAction
26
- } from "./chunk-DQLB4NQ3.js";
30
+ } from "./chunk-VPAZOH2D.js";
27
31
  import {
28
32
  getActiveDialogAgentId,
29
33
  getDialogAgentIds,
30
34
  getPrimaryDialogAgentId
31
35
  } from "./chunk-5RGU3J7P.js";
32
- import {
33
- _typeof,
34
- addLeadingZeros,
35
- requiredArgs,
36
- toDate
37
- } from "./chunk-4LCOCOR5.js";
38
36
  import {
39
37
  abortActiveControllers,
40
38
  addPageReferenceToRuntime,
@@ -61,19 +59,19 @@ import {
61
59
  selectById,
62
60
  upload,
63
61
  write
64
- } from "./chunk-UMEGDH6A.js";
62
+ } from "./chunk-BFM34N54.js";
65
63
  import {
66
64
  getRuntimeServerContext,
67
65
  parseOwnerUserIdFromDbKey,
68
66
  scheduleDeleteReplication
69
- } from "./chunk-UCPAVEQB.js";
67
+ } from "./chunk-PYRUW7XN.js";
70
68
  import {
71
69
  asyncThunkCreator,
72
70
  buildCreateSlice,
73
71
  createAsyncThunk,
74
72
  createEntityAdapter,
75
73
  createSelector
76
- } from "./chunk-X4F26D5K.js";
74
+ } from "./chunk-P5L7CXOC.js";
77
75
  import {
78
76
  createClientLogger
79
77
  } from "./chunk-QQ56R7KS.js";
@@ -106,10 +104,7 @@ import {
106
104
  extractReferenceKeysFromMessage,
107
105
  normalizeUsage,
108
106
  resolveAutoExecutionProfile
109
- } from "./chunk-WTKYP6QO.js";
110
- import {
111
- isDevinOAuthAgent
112
- } from "./chunk-5ZUL4CUO.js";
107
+ } from "./chunk-JTDORD5P.js";
113
108
  import {
114
109
  COMPACTION_SUMMARY_SYSTEM_PROMPT,
115
110
  DEFAULT_CONTEXT_WINDOW,
@@ -123,7 +118,10 @@ import {
123
118
  getModelInfo,
124
119
  planCompression,
125
120
  serializeMessageContent
126
- } from "./chunk-BTYQAODF.js";
121
+ } from "./chunk-CZM5YTZ7.js";
122
+ import {
123
+ isDevinOAuthAgent
124
+ } from "./chunk-5ZUL4CUO.js";
127
125
  import {
128
126
  isOAuthApiKeyRef
129
127
  } from "./chunk-UKZX3NHN.js";
@@ -158,6 +156,27 @@ import {
158
156
  import {
159
157
  isRecord
160
158
  } from "./chunk-KUG52IAP.js";
159
+ import {
160
+ PLATFORM_HOSTED_CLAUDE_FABLE_5_MODEL,
161
+ PLATFORM_HOSTED_CLAUDE_FABLE_5_PRICE,
162
+ PLATFORM_HOSTED_CLAUDE_OPUS_5_MODEL,
163
+ PLATFORM_HOSTED_CLAUDE_OPUS_5_PRICE,
164
+ PLATFORM_HOSTED_CLAUDE_SONNET_5_MODEL,
165
+ PLATFORM_HOSTED_CLAUDE_SONNET_5_PRICE,
166
+ PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
167
+ PLATFORM_HOSTED_DEEPSEEK_PRO_MODEL,
168
+ PLATFORM_HOSTED_GLM_53_FLASH_BASETEN_PRICE,
169
+ getPlatformHostedDeepSeekV4Price,
170
+ isPlatformHostedDeepSeekV4Model,
171
+ isPlatformHostedImageModel,
172
+ isPlatformHostedOpenAIImageModel,
173
+ isPlatformManagedProvider,
174
+ resolvePlatformEffectiveModel,
175
+ resolvePlatformHostedRouting
176
+ } from "./chunk-GOO6G4PY.js";
177
+ import {
178
+ asTrimmedLowercaseString
179
+ } from "./chunk-QSJ3HFEF.js";
161
180
  import {
162
181
  API_ENDPOINTS
163
182
  } from "./chunk-LCBAMY2M.js";
@@ -169,7 +188,7 @@ import {
169
188
  createKey,
170
189
  createTokenKey,
171
190
  createTokenStatsKey
172
- } from "./chunk-ECX3NKRD.js";
191
+ } from "./chunk-JY5NGFFH.js";
173
192
  import {
174
193
  createDialogMessageKeyAndId,
175
194
  dialogMessageKey
@@ -183,27 +202,6 @@ import {
183
202
  import {
184
203
  asOptionalTrimmedString
185
204
  } from "./chunk-G3SUCT4W.js";
186
- import {
187
- PLATFORM_HOSTED_CLAUDE_FABLE_5_MODEL,
188
- PLATFORM_HOSTED_CLAUDE_FABLE_5_PRICE,
189
- PLATFORM_HOSTED_CLAUDE_OPUS_5_MODEL,
190
- PLATFORM_HOSTED_CLAUDE_OPUS_5_PRICE,
191
- PLATFORM_HOSTED_CLAUDE_SONNET_5_MODEL,
192
- PLATFORM_HOSTED_CLAUDE_SONNET_5_PRICE,
193
- PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
194
- PLATFORM_HOSTED_DEEPSEEK_PRO_MODEL,
195
- PLATFORM_HOSTED_GLM_53_FLASH_BASETEN_PRICE,
196
- getPlatformHostedDeepSeekV4Price,
197
- isPlatformHostedDeepSeekV4Model,
198
- isPlatformHostedImageModel,
199
- isPlatformHostedOpenAIImageModel,
200
- isPlatformManagedProvider,
201
- resolvePlatformEffectiveModel,
202
- resolvePlatformHostedRouting
203
- } from "./chunk-GOO6G4PY.js";
204
- import {
205
- asTrimmedLowercaseString
206
- } from "./chunk-QSJ3HFEF.js";
207
205
  import {
208
206
  __toESM
209
207
  } from "./chunk-4VNS5WPM.js";
@@ -234,7 +232,7 @@ var addReferenceKeysAction = createAsyncThunk(
234
232
  const dialogConfig = selectById(state, dialogKey);
235
233
  if (!dialogConfig) return;
236
234
  const existingKeys = new Set(dialogConfig.referenceKeys || []);
237
- const keysToAdd = newKeys.filter((k2) => !existingKeys.has(k2));
235
+ const keysToAdd = newKeys.filter((k) => !existingKeys.has(k));
238
236
  if (keysToAdd.length === 0) return;
239
237
  const updatedKeys = [...Array.from(existingKeys), ...keysToAdd];
240
238
  await dispatch(
@@ -292,7 +290,7 @@ function planDeleteMessageCascade(msg, entities) {
292
290
  const parent = entities[msg.parentMessageId];
293
291
  if (parent && parent.role === "assistant" && isAssistantToolStub(parent)) {
294
292
  const hasOtherToolMsgs = Object.values(entities).some(
295
- (m3) => m3 && m3.role === "tool" && m3.parentMessageId === msg.parentMessageId && m3.dbKey !== msg.dbKey
293
+ (m) => m && m.role === "tool" && m.parentMessageId === msg.parentMessageId && m.dbKey !== msg.dbKey
296
294
  );
297
295
  if (!hasOtherToolMsgs) {
298
296
  extraRemoveId = parent.id;
@@ -536,20 +534,20 @@ function swallowNonAbortError(promise, fallback, signal) {
536
534
  }
537
535
 
538
536
  // packages/chat/messages/fetchAndCacheMessages.ts
539
- var sortByCreatedAtDesc = (a3, b2) => {
540
- const aCreated = a3 && typeof a3 === "object" && "createdAt" in a3 ? a3.createdAt : void 0;
541
- const bCreated = b2 && typeof b2 === "object" && "createdAt" in b2 ? b2.createdAt : void 0;
537
+ var sortByCreatedAtDesc = (a, b) => {
538
+ const aCreated = a && typeof a === "object" && "createdAt" in a ? a.createdAt : void 0;
539
+ const bCreated = b && typeof b === "object" && "createdAt" in b ? b.createdAt : void 0;
542
540
  const tA = new Date(aCreated || 0).getTime();
543
541
  const tB = new Date(bCreated || 0).getTime();
544
542
  return tB - tA;
545
543
  };
546
544
  var mergeVisibleRecords = (seed, incoming) => {
547
545
  const byId = /* @__PURE__ */ new Map();
548
- const put = (m3) => {
549
- if (!m3 || !m3.id) return;
550
- const existing = byId.get(m3.id);
551
- if (existing && !shouldReplaceWithNextRecord(m3, existing)) return;
552
- byId.set(m3.id, m3);
546
+ const put = (m) => {
547
+ if (!m || !m.id) return;
548
+ const existing = byId.get(m.id);
549
+ if (existing && !shouldReplaceWithNextRecord(m, existing)) return;
550
+ byId.set(m.id, m);
553
551
  };
554
552
  seed.forEach(put);
555
553
  incoming.forEach(put);
@@ -636,16 +634,16 @@ var fetchAndCacheMessagesLocalFirst = async ({
636
634
  }).catch(() => []);
637
635
  const uniqueMap = /* @__PURE__ */ new Map();
638
636
  const changedMessagesToCache = /* @__PURE__ */ new Map();
639
- const put = (m3, trackChange = false) => {
640
- if (!m3 || !m3.id) return;
641
- const existing = uniqueMap.get(m3.id);
642
- if (existing && !shouldReplaceWithNextRecord(m3, existing)) return;
643
- uniqueMap.set(m3.id, m3);
644
- if (trackChange) changedMessagesToCache.set(m3.id, m3);
637
+ const put = (m, trackChange = false) => {
638
+ if (!m || !m.id) return;
639
+ const existing = uniqueMap.get(m.id);
640
+ if (existing && !shouldReplaceWithNextRecord(m, existing)) return;
641
+ uniqueMap.set(m.id, m);
642
+ if (trackChange) changedMessagesToCache.set(m.id, m);
645
643
  };
646
- localMsgs.forEach((m3) => put(m3));
647
- freshLocalMsgs.forEach((m3) => put(m3));
648
- remoteMsgs.forEach((m3) => put(m3, true));
644
+ localMsgs.forEach((m) => put(m));
645
+ freshLocalMsgs.forEach((m) => put(m));
646
+ remoteMsgs.forEach((m) => put(m, true));
649
647
  for (const [recordId, record] of uniqueMap) {
650
648
  if (isTombstoneRecord(record)) finalTombstonesById.set(recordId, record);
651
649
  }
@@ -782,32 +780,32 @@ function resolveBuiltinAgentRuntimeFields(agentKey) {
782
780
  }
783
781
 
784
782
  // packages/agent-runtime/builtinPlatformAgentConfigs.ts
785
- function buildConfig(e2) {
786
- const key = publicAgentKey(e2.id);
783
+ function buildConfig(e) {
784
+ const key = publicAgentKey(e.id);
787
785
  const rawRecord = {
788
786
  dbKey: key,
789
787
  isPublic: true,
790
- provider: e2.provider,
791
- model: e2.model,
792
- apiSource: e2.apiSource ?? "platform",
793
- useServerProxy: e2.useServerProxy ?? true
788
+ provider: e.provider,
789
+ model: e.model,
790
+ apiSource: e.apiSource ?? "platform",
791
+ useServerProxy: e.useServerProxy ?? true
794
792
  };
795
- if (e2.hasImageOutput) rawRecord.hasImageOutput = true;
796
- if (e2.imageModel) rawRecord.imageModel = e2.imageModel;
797
- if (e2.imageWorkflow) rawRecord.imageWorkflow = e2.imageWorkflow;
798
- if (e2.imageConfig) rawRecord.imageConfig = e2.imageConfig;
793
+ if (e.hasImageOutput) rawRecord.hasImageOutput = true;
794
+ if (e.imageModel) rawRecord.imageModel = e.imageModel;
795
+ if (e.imageWorkflow) rawRecord.imageWorkflow = e.imageWorkflow;
796
+ if (e.imageConfig) rawRecord.imageConfig = e.imageConfig;
799
797
  return {
800
798
  key,
801
- name: e2.name,
802
- provider: e2.provider,
803
- model: e2.model,
804
- apiSource: e2.apiSource ?? "platform",
805
- useServerProxy: e2.useServerProxy ?? true,
799
+ name: e.name,
800
+ provider: e.provider,
801
+ model: e.model,
802
+ apiSource: e.apiSource ?? "platform",
803
+ useServerProxy: e.useServerProxy ?? true,
806
804
  rawRecord
807
805
  };
808
806
  }
809
807
  var BUILTIN_PLATFORM_AGENT_CONFIGS = Object.fromEntries(
810
- builtinRuntimeFallbackEntries().map((e2) => [publicAgentKey(e2.id), buildConfig(e2)])
808
+ builtinRuntimeFallbackEntries().map((e) => [publicAgentKey(e.id), buildConfig(e)])
811
809
  );
812
810
  function resolveBuiltinPlatformAgentConfig(agentRef) {
813
811
  return BUILTIN_PLATFORM_AGENT_CONFIGS[agentRef] ?? null;
@@ -872,14 +870,14 @@ var ToastStore = class {
872
870
  getSnapshot = () => this.toasts;
873
871
  add(item) {
874
872
  const id = item.id ?? `toast-${++this.nextId}`;
875
- const filtered = this.toasts.filter((t3) => t3.id !== id);
873
+ const filtered = this.toasts.filter((t2) => t2.id !== id);
876
874
  const entry = { ...item, id, phase: "entering" };
877
875
  this.toasts = [...filtered, entry];
878
876
  this.notify();
879
877
  raf(
880
878
  () => raf(() => {
881
879
  this.toasts = this.toasts.map(
882
- (t3) => t3.id === id ? { ...t3, phase: "visible" } : t3
880
+ (t2) => t2.id === id ? { ...t2, phase: "visible" } : t2
883
881
  );
884
882
  this.notify();
885
883
  })
@@ -891,16 +889,16 @@ var ToastStore = class {
891
889
  }
892
890
  close(id) {
893
891
  if (id) {
894
- if (!this.toasts.some((t3) => t3.id === id)) return;
892
+ if (!this.toasts.some((t2) => t2.id === id)) return;
895
893
  this.toasts = this.toasts.map(
896
- (t3) => t3.id === id ? { ...t3, phase: "exiting" } : t3
894
+ (t2) => t2.id === id ? { ...t2, phase: "exiting" } : t2
897
895
  );
898
896
  } else {
899
- this.toasts = this.toasts.map((t3) => ({ ...t3, phase: "exiting" }));
897
+ this.toasts = this.toasts.map((t2) => ({ ...t2, phase: "exiting" }));
900
898
  }
901
899
  this.notify();
902
900
  setTimeout(() => {
903
- this.toasts = id ? this.toasts.filter((t3) => t3.id !== id) : [];
901
+ this.toasts = id ? this.toasts.filter((t2) => t2.id !== id) : [];
904
902
  this.notify();
905
903
  }, EXIT_MS);
906
904
  }
@@ -954,9 +952,9 @@ var makeString = (object) => {
954
952
  if (object == null) return "";
955
953
  return "" + object;
956
954
  };
957
- var copy = (a3, s3, t3) => {
958
- a3.forEach((m3) => {
959
- if (s3[m3]) t3[m3] = s3[m3];
955
+ var copy = (a, s, t2) => {
956
+ a.forEach((m) => {
957
+ if (s[m]) t2[m] = s[m];
960
958
  });
961
959
  };
962
960
  var lastOfPathSeparatorRegExp = /###/g;
@@ -985,40 +983,40 @@ var getLastOfPath = (object, path, Empty) => {
985
983
  var setPath = (object, path, newValue) => {
986
984
  const {
987
985
  obj,
988
- k: k2
986
+ k
989
987
  } = getLastOfPath(object, path, Object);
990
988
  if (obj !== void 0 || path.length === 1) {
991
- obj[k2] = newValue;
989
+ obj[k] = newValue;
992
990
  return;
993
991
  }
994
- let e2 = path[path.length - 1];
992
+ let e = path[path.length - 1];
995
993
  let p = path.slice(0, path.length - 1);
996
994
  let last = getLastOfPath(object, p, Object);
997
995
  while (last.obj === void 0 && p.length) {
998
- e2 = `${p[p.length - 1]}.${e2}`;
996
+ e = `${p[p.length - 1]}.${e}`;
999
997
  p = p.slice(0, p.length - 1);
1000
998
  last = getLastOfPath(object, p, Object);
1001
- if (last && last.obj && typeof last.obj[`${last.k}.${e2}`] !== "undefined") {
999
+ if (last && last.obj && typeof last.obj[`${last.k}.${e}`] !== "undefined") {
1002
1000
  last.obj = void 0;
1003
1001
  }
1004
1002
  }
1005
- last.obj[`${last.k}.${e2}`] = newValue;
1003
+ last.obj[`${last.k}.${e}`] = newValue;
1006
1004
  };
1007
1005
  var pushPath = (object, path, newValue, concat) => {
1008
1006
  const {
1009
1007
  obj,
1010
- k: k2
1008
+ k
1011
1009
  } = getLastOfPath(object, path, Object);
1012
- obj[k2] = obj[k2] || [];
1013
- obj[k2].push(newValue);
1010
+ obj[k] = obj[k] || [];
1011
+ obj[k].push(newValue);
1014
1012
  };
1015
1013
  var getPath = (object, path) => {
1016
1014
  const {
1017
1015
  obj,
1018
- k: k2
1016
+ k
1019
1017
  } = getLastOfPath(object, path);
1020
1018
  if (!obj) return void 0;
1021
- return obj[k2];
1019
+ return obj[k];
1022
1020
  };
1023
1021
  var getPathWithDefaults = (data, defaultData, key) => {
1024
1022
  const value = getPath(data, key);
@@ -1054,7 +1052,7 @@ var _entityMap = {
1054
1052
  };
1055
1053
  var escape = (data) => {
1056
1054
  if (isString(data)) {
1057
- return data.replace(/[&<>"'\/]/g, (s3) => _entityMap[s3]);
1055
+ return data.replace(/[&<>"'\/]/g, (s) => _entityMap[s]);
1058
1056
  }
1059
1057
  return data;
1060
1058
  };
@@ -1083,9 +1081,9 @@ var looksLikeObjectPathRegExpCache = new RegExpCache(20);
1083
1081
  var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
1084
1082
  nsSeparator = nsSeparator || "";
1085
1083
  keySeparator = keySeparator || "";
1086
- const possibleChars = chars.filter((c2) => nsSeparator.indexOf(c2) < 0 && keySeparator.indexOf(c2) < 0);
1084
+ const possibleChars = chars.filter((c) => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
1087
1085
  if (possibleChars.length === 0) return true;
1088
- const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c2) => c2 === "?" ? "\\?" : c2).join("|")})`);
1086
+ const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c) => c === "?" ? "\\?" : c).join("|")})`);
1089
1087
  let matched = !r.test(key);
1090
1088
  if (!matched) {
1091
1089
  const ki = key.indexOf(keySeparator);
@@ -1101,14 +1099,14 @@ var deepFind = function(obj, path) {
1101
1099
  if (obj[path]) return obj[path];
1102
1100
  const tokens = path.split(keySeparator);
1103
1101
  let current = obj;
1104
- for (let i2 = 0; i2 < tokens.length; ) {
1102
+ for (let i = 0; i < tokens.length; ) {
1105
1103
  if (!current || typeof current !== "object") {
1106
1104
  return void 0;
1107
1105
  }
1108
1106
  let next;
1109
1107
  let nextPath = "";
1110
- for (let j = i2; j < tokens.length; ++j) {
1111
- if (j !== i2) {
1108
+ for (let j = i; j < tokens.length; ++j) {
1109
+ if (j !== i) {
1112
1110
  nextPath += keySeparator;
1113
1111
  }
1114
1112
  nextPath += tokens[j];
@@ -1117,7 +1115,7 @@ var deepFind = function(obj, path) {
1117
1115
  if (["string", "number", "boolean"].indexOf(typeof next) > -1 && j < tokens.length - 1) {
1118
1116
  continue;
1119
1117
  }
1120
- i2 += j - i2 + 1;
1118
+ i += j - i + 1;
1121
1119
  break;
1122
1120
  }
1123
1121
  }
@@ -1225,7 +1223,7 @@ var EventEmitter = class {
1225
1223
  const cloned = Array.from(this.observers[event].entries());
1226
1224
  cloned.forEach((_ref) => {
1227
1225
  let [observer, numTimesAdded] = _ref;
1228
- for (let i2 = 0; i2 < numTimesAdded; i2++) {
1226
+ for (let i = 0; i < numTimesAdded; i++) {
1229
1227
  observer(...args);
1230
1228
  }
1231
1229
  });
@@ -1234,7 +1232,7 @@ var EventEmitter = class {
1234
1232
  const cloned = Array.from(this.observers["*"].entries());
1235
1233
  cloned.forEach((_ref2) => {
1236
1234
  let [observer, numTimesAdded] = _ref2;
1237
- for (let i2 = 0; i2 < numTimesAdded; i2++) {
1235
+ for (let i = 0; i < numTimesAdded; i++) {
1238
1236
  observer.apply(observer, [event, ...args]);
1239
1237
  }
1240
1238
  });
@@ -1316,8 +1314,8 @@ var ResourceStore = class extends EventEmitter {
1316
1314
  let options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
1317
1315
  silent: false
1318
1316
  };
1319
- for (const m3 in resources) {
1320
- if (isString(resources[m3]) || Array.isArray(resources[m3])) this.addResource(lng, ns, m3, resources[m3], {
1317
+ for (const m in resources) {
1318
+ if (isString(resources[m]) || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], {
1321
1319
  silent: true
1322
1320
  });
1323
1321
  }
@@ -1424,8 +1422,8 @@ var Translator = class _Translator extends EventEmitter {
1424
1422
  const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
1425
1423
  const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
1426
1424
  if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
1427
- const m3 = key.match(this.interpolator.nestingRegexp);
1428
- if (m3 && m3.length > 0) {
1425
+ const m = key.match(this.interpolator.nestingRegexp);
1426
+ if (m && m.length > 0) {
1429
1427
  return {
1430
1428
  key,
1431
1429
  namespaces: isString(namespaces) ? [namespaces] : namespaces
@@ -1515,17 +1513,17 @@ var Translator = class _Translator extends EventEmitter {
1515
1513
  const resTypeIsArray = Array.isArray(res);
1516
1514
  const copy2 = resTypeIsArray ? [] : {};
1517
1515
  const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
1518
- for (const m3 in res) {
1519
- if (Object.prototype.hasOwnProperty.call(res, m3)) {
1520
- const deepKey = `${newKeyToUse}${keySeparator}${m3}`;
1521
- copy2[m3] = this.translate(deepKey, {
1516
+ for (const m in res) {
1517
+ if (Object.prototype.hasOwnProperty.call(res, m)) {
1518
+ const deepKey = `${newKeyToUse}${keySeparator}${m}`;
1519
+ copy2[m] = this.translate(deepKey, {
1522
1520
  ...options,
1523
1521
  ...{
1524
1522
  joinArrays: false,
1525
1523
  ns: namespaces
1526
1524
  }
1527
1525
  });
1528
- if (copy2[m3] === deepKey) copy2[m3] = res[m3];
1526
+ if (copy2[m] === deepKey) copy2[m] = res[m];
1529
1527
  }
1530
1528
  }
1531
1529
  res = copy2;
@@ -1567,22 +1565,22 @@ var Translator = class _Translator extends EventEmitter {
1567
1565
  let lngs = [];
1568
1566
  const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
1569
1567
  if (this.options.saveMissingTo === "fallback" && fallbackLngs && fallbackLngs[0]) {
1570
- for (let i2 = 0; i2 < fallbackLngs.length; i2++) {
1571
- lngs.push(fallbackLngs[i2]);
1568
+ for (let i = 0; i < fallbackLngs.length; i++) {
1569
+ lngs.push(fallbackLngs[i]);
1572
1570
  }
1573
1571
  } else if (this.options.saveMissingTo === "all") {
1574
1572
  lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
1575
1573
  } else {
1576
1574
  lngs.push(options.lng || this.language);
1577
1575
  }
1578
- const send = (l, k2, specificDefaultValue) => {
1576
+ const send = (l, k, specificDefaultValue) => {
1579
1577
  const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
1580
1578
  if (this.options.missingKeyHandler) {
1581
- this.options.missingKeyHandler(l, namespace, k2, defaultForMissing, updateMissing, options);
1579
+ this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
1582
1580
  } else if (this.backendConnector && this.backendConnector.saveMissing) {
1583
- this.backendConnector.saveMissing(l, namespace, k2, defaultForMissing, updateMissing, options);
1581
+ this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
1584
1582
  }
1585
- this.emit("missingKey", l, namespace, k2, res);
1583
+ this.emit("missingKey", l, namespace, k, res);
1586
1584
  };
1587
1585
  if (this.options.saveMissing) {
1588
1586
  if (this.options.saveMissingPlurals && needsPluralHandling) {
@@ -1687,9 +1685,9 @@ var Translator = class _Translator extends EventEmitter {
1687
1685
  let usedLng;
1688
1686
  let usedNS;
1689
1687
  if (isString(keys)) keys = [keys];
1690
- keys.forEach((k2) => {
1688
+ keys.forEach((k) => {
1691
1689
  if (this.isValidLookup(found)) return;
1692
- const extracted = this.extractFromKey(k2, options);
1690
+ const extracted = this.extractFromKey(k, options);
1693
1691
  const key = extracted.key;
1694
1692
  usedKey = key;
1695
1693
  let namespaces = extracted.namespaces;
@@ -1830,7 +1828,7 @@ var LanguageUtil = class {
1830
1828
  formattedCode = formattedCode.toLowerCase();
1831
1829
  }
1832
1830
  if (formattedCode) return formattedCode;
1833
- } catch (e2) {
1831
+ } catch (e) {
1834
1832
  }
1835
1833
  }
1836
1834
  const specialCases = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"];
@@ -1898,12 +1896,12 @@ var LanguageUtil = class {
1898
1896
  toResolveHierarchy(code, fallbackCode) {
1899
1897
  const fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
1900
1898
  const codes = [];
1901
- const addCode = (c2) => {
1902
- if (!c2) return;
1903
- if (this.isSupportedCode(c2)) {
1904
- codes.push(c2);
1899
+ const addCode = (c) => {
1900
+ if (!c) return;
1901
+ if (this.isSupportedCode(c)) {
1902
+ codes.push(c);
1905
1903
  } else {
1906
- this.logger.warn(`rejecting language code not found in supportedLngs: ${c2}`);
1904
+ this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
1907
1905
  }
1908
1906
  };
1909
1907
  if (isString(code) && (code.indexOf("-") > -1 || code.indexOf("_") > -1)) {
@@ -2239,7 +2237,7 @@ var Interpolator = class {
2239
2237
  this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
2240
2238
  }
2241
2239
  interpolate(str, data, lng, options) {
2242
- let match2;
2240
+ let match;
2243
2241
  let value;
2244
2242
  let replaces;
2245
2243
  const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
@@ -2253,12 +2251,12 @@ var Interpolator = class {
2253
2251
  }) : path;
2254
2252
  }
2255
2253
  const p = key.split(this.formatSeparator);
2256
- const k2 = p.shift().trim();
2254
+ const k = p.shift().trim();
2257
2255
  const f = p.join(this.formatSeparator).trim();
2258
- return this.format(deepFindWithDefaults(data, defaultData, k2, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
2256
+ return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
2259
2257
  ...options,
2260
2258
  ...data,
2261
- interpolationkey: k2
2259
+ interpolationkey: k
2262
2260
  });
2263
2261
  };
2264
2262
  this.resetRegExp();
@@ -2273,17 +2271,17 @@ var Interpolator = class {
2273
2271
  }];
2274
2272
  todos.forEach((todo) => {
2275
2273
  replaces = 0;
2276
- while (match2 = todo.regex.exec(str)) {
2277
- const matchedVar = match2[1].trim();
2274
+ while (match = todo.regex.exec(str)) {
2275
+ const matchedVar = match[1].trim();
2278
2276
  value = handleFormat(matchedVar);
2279
2277
  if (value === void 0) {
2280
2278
  if (typeof missingInterpolationHandler === "function") {
2281
- const temp = missingInterpolationHandler(str, match2, options);
2279
+ const temp = missingInterpolationHandler(str, match, options);
2282
2280
  value = isString(temp) ? temp : "";
2283
2281
  } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
2284
2282
  value = "";
2285
2283
  } else if (skipOnVariables) {
2286
- value = match2[0];
2284
+ value = match[0];
2287
2285
  continue;
2288
2286
  } else {
2289
2287
  this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
@@ -2293,10 +2291,10 @@ var Interpolator = class {
2293
2291
  value = makeString(value);
2294
2292
  }
2295
2293
  const safeValue = todo.safeValue(value);
2296
- str = str.replace(match2[0], safeValue);
2294
+ str = str.replace(match[0], safeValue);
2297
2295
  if (skipOnVariables) {
2298
2296
  todo.regex.lastIndex += value.length;
2299
- todo.regex.lastIndex -= match2[0].length;
2297
+ todo.regex.lastIndex -= match[0].length;
2300
2298
  } else {
2301
2299
  todo.regex.lastIndex = 0;
2302
2300
  }
@@ -2310,15 +2308,15 @@ var Interpolator = class {
2310
2308
  }
2311
2309
  nest(str, fc) {
2312
2310
  let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2313
- let match2;
2311
+ let match;
2314
2312
  let value;
2315
2313
  let clonedOptions;
2316
2314
  const handleHasOptions = (key, inheritedOptions) => {
2317
2315
  const sep = this.nestingOptionsSeparator;
2318
2316
  if (key.indexOf(sep) < 0) return key;
2319
- const c2 = key.split(new RegExp(`${sep}[ ]*{`));
2320
- let optionsString = `{${c2[1]}`;
2321
- key = c2[0];
2317
+ const c = key.split(new RegExp(`${sep}[ ]*{`));
2318
+ let optionsString = `{${c[1]}`;
2319
+ key = c[0];
2322
2320
  optionsString = this.interpolate(optionsString, clonedOptions);
2323
2321
  const matchedSingleQuotes = optionsString.match(/'/g);
2324
2322
  const matchedDoubleQuotes = optionsString.match(/"/g);
@@ -2331,15 +2329,15 @@ var Interpolator = class {
2331
2329
  ...inheritedOptions,
2332
2330
  ...clonedOptions
2333
2331
  };
2334
- } catch (e2) {
2335
- this.logger.warn(`failed parsing options string in nesting for key ${key}`, e2);
2332
+ } catch (e) {
2333
+ this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
2336
2334
  return `${key}${sep}${optionsString}`;
2337
2335
  }
2338
2336
  if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
2339
2337
  return key;
2340
2338
  };
2341
- while (match2 = this.nestingRegexp.exec(str)) {
2342
- let formatters3 = [];
2339
+ while (match = this.nestingRegexp.exec(str)) {
2340
+ let formatters = [];
2343
2341
  clonedOptions = {
2344
2342
  ...options
2345
2343
  };
@@ -2347,26 +2345,26 @@ var Interpolator = class {
2347
2345
  clonedOptions.applyPostProcessor = false;
2348
2346
  delete clonedOptions.defaultValue;
2349
2347
  let doReduce = false;
2350
- if (match2[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match2[1])) {
2351
- const r = match2[1].split(this.formatSeparator).map((elem) => elem.trim());
2352
- match2[1] = r.shift();
2353
- formatters3 = r;
2348
+ if (match[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match[1])) {
2349
+ const r = match[1].split(this.formatSeparator).map((elem) => elem.trim());
2350
+ match[1] = r.shift();
2351
+ formatters = r;
2354
2352
  doReduce = true;
2355
2353
  }
2356
- value = fc(handleHasOptions.call(this, match2[1].trim(), clonedOptions), clonedOptions);
2357
- if (value && match2[0] === str && !isString(value)) return value;
2354
+ value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
2355
+ if (value && match[0] === str && !isString(value)) return value;
2358
2356
  if (!isString(value)) value = makeString(value);
2359
2357
  if (!value) {
2360
- this.logger.warn(`missed to resolve ${match2[1]} for nesting ${str}`);
2358
+ this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
2361
2359
  value = "";
2362
2360
  }
2363
2361
  if (doReduce) {
2364
- value = formatters3.reduce((v, f) => this.format(v, f, options.lng, {
2362
+ value = formatters.reduce((v, f) => this.format(v, f, options.lng, {
2365
2363
  ...options,
2366
- interpolationkey: match2[1].trim()
2364
+ interpolationkey: match[1].trim()
2367
2365
  }), value.trim());
2368
2366
  }
2369
- str = str.replace(match2[0], value);
2367
+ str = str.replace(match[0], value);
2370
2368
  this.regexp.lastIndex = 0;
2371
2369
  }
2372
2370
  return str;
@@ -2508,10 +2506,10 @@ var Formatter = class {
2508
2506
  return result;
2509
2507
  }
2510
2508
  };
2511
- var removePending = (q2, name) => {
2512
- if (q2.pending[name] !== void 0) {
2513
- delete q2.pending[name];
2514
- q2.pendingCount--;
2509
+ var removePending = (q, name) => {
2510
+ if (q.pending[name] !== void 0) {
2511
+ delete q.pending[name];
2512
+ q.pendingCount--;
2515
2513
  }
2516
2514
  };
2517
2515
  var Connector = class extends EventEmitter {
@@ -2576,9 +2574,9 @@ var Connector = class extends EventEmitter {
2576
2574
  };
2577
2575
  }
2578
2576
  loaded(name, err, data) {
2579
- const s3 = name.split("|");
2580
- const lng = s3[0];
2581
- const ns = s3[1];
2577
+ const s = name.split("|");
2578
+ const lng = s[0];
2579
+ const ns = s[1];
2582
2580
  if (err) this.emit("failedLoading", lng, ns, err);
2583
2581
  if (!err && data) {
2584
2582
  this.store.addResourceBundle(lng, ns, data, void 0, void 0, {
@@ -2588,30 +2586,30 @@ var Connector = class extends EventEmitter {
2588
2586
  this.state[name] = err ? -1 : 2;
2589
2587
  if (err && data) this.state[name] = 0;
2590
2588
  const loaded = {};
2591
- this.queue.forEach((q2) => {
2592
- pushPath(q2.loaded, [lng], ns);
2593
- removePending(q2, name);
2594
- if (err) q2.errors.push(err);
2595
- if (q2.pendingCount === 0 && !q2.done) {
2596
- Object.keys(q2.loaded).forEach((l) => {
2589
+ this.queue.forEach((q) => {
2590
+ pushPath(q.loaded, [lng], ns);
2591
+ removePending(q, name);
2592
+ if (err) q.errors.push(err);
2593
+ if (q.pendingCount === 0 && !q.done) {
2594
+ Object.keys(q.loaded).forEach((l) => {
2597
2595
  if (!loaded[l]) loaded[l] = {};
2598
- const loadedKeys = q2.loaded[l];
2596
+ const loadedKeys = q.loaded[l];
2599
2597
  if (loadedKeys.length) {
2600
2598
  loadedKeys.forEach((n) => {
2601
2599
  if (loaded[l][n] === void 0) loaded[l][n] = true;
2602
2600
  });
2603
2601
  }
2604
2602
  });
2605
- q2.done = true;
2606
- if (q2.errors.length) {
2607
- q2.callback(q2.errors);
2603
+ q.done = true;
2604
+ if (q.errors.length) {
2605
+ q.callback(q.errors);
2608
2606
  } else {
2609
- q2.callback();
2607
+ q.callback();
2610
2608
  }
2611
2609
  }
2612
2610
  });
2613
2611
  this.emit("loaded", loaded);
2614
- this.queue = this.queue.filter((q2) => !q2.done);
2612
+ this.queue = this.queue.filter((q) => !q.done);
2615
2613
  }
2616
2614
  read(lng, ns, fcName) {
2617
2615
  let tried = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
@@ -2688,9 +2686,9 @@ var Connector = class extends EventEmitter {
2688
2686
  }
2689
2687
  loadOne(name) {
2690
2688
  let prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
2691
- const s3 = name.split("|");
2692
- const lng = s3[0];
2693
- const ns = s3[1];
2689
+ const s = name.split("|");
2690
+ const lng = s[0];
2691
+ const ns = s[1];
2694
2692
  this.read(lng, ns, "read", void 0, void 0, (err, data) => {
2695
2693
  if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
2696
2694
  if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
@@ -2890,38 +2888,38 @@ var I18n = class _I18n extends EventEmitter {
2890
2888
  }
2891
2889
  const lu = new LanguageUtil(this.options);
2892
2890
  this.store = new ResourceStore(this.options.resources, this.options);
2893
- const s3 = this.services;
2894
- s3.logger = baseLogger;
2895
- s3.resourceStore = this.store;
2896
- s3.languageUtils = lu;
2897
- s3.pluralResolver = new PluralResolver(lu, {
2891
+ const s = this.services;
2892
+ s.logger = baseLogger;
2893
+ s.resourceStore = this.store;
2894
+ s.languageUtils = lu;
2895
+ s.pluralResolver = new PluralResolver(lu, {
2898
2896
  prepend: this.options.pluralSeparator,
2899
2897
  compatibilityJSON: this.options.compatibilityJSON,
2900
2898
  simplifyPluralSuffix: this.options.simplifyPluralSuffix
2901
2899
  });
2902
2900
  if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
2903
- s3.formatter = createClassOnDemand(formatter);
2904
- s3.formatter.init(s3, this.options);
2905
- this.options.interpolation.format = s3.formatter.format.bind(s3.formatter);
2901
+ s.formatter = createClassOnDemand(formatter);
2902
+ s.formatter.init(s, this.options);
2903
+ this.options.interpolation.format = s.formatter.format.bind(s.formatter);
2906
2904
  }
2907
- s3.interpolator = new Interpolator(this.options);
2908
- s3.utils = {
2905
+ s.interpolator = new Interpolator(this.options);
2906
+ s.utils = {
2909
2907
  hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
2910
2908
  };
2911
- s3.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s3.resourceStore, s3, this.options);
2912
- s3.backendConnector.on("*", function(event) {
2909
+ s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
2910
+ s.backendConnector.on("*", function(event) {
2913
2911
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2914
2912
  args[_key - 1] = arguments[_key];
2915
2913
  }
2916
2914
  _this.emit(event, ...args);
2917
2915
  });
2918
2916
  if (this.modules.languageDetector) {
2919
- s3.languageDetector = createClassOnDemand(this.modules.languageDetector);
2920
- if (s3.languageDetector.init) s3.languageDetector.init(s3, this.options.detection, this.options);
2917
+ s.languageDetector = createClassOnDemand(this.modules.languageDetector);
2918
+ if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
2921
2919
  }
2922
2920
  if (this.modules.i18nFormat) {
2923
- s3.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
2924
- if (s3.i18nFormat.init) s3.i18nFormat.init(this);
2921
+ s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
2922
+ if (s.i18nFormat.init) s.i18nFormat.init(this);
2925
2923
  }
2926
2924
  this.translator = new Translator(this.services, this.options);
2927
2925
  this.translator.on("*", function(event) {
@@ -2930,8 +2928,8 @@ var I18n = class _I18n extends EventEmitter {
2930
2928
  }
2931
2929
  _this.emit(event, ...args);
2932
2930
  });
2933
- this.modules.external.forEach((m3) => {
2934
- if (m3.init) m3.init(this);
2931
+ this.modules.external.forEach((m) => {
2932
+ if (m.init) m.init(this);
2935
2933
  });
2936
2934
  }
2937
2935
  this.format = this.options.interpolation.format;
@@ -2958,14 +2956,14 @@ var I18n = class _I18n extends EventEmitter {
2958
2956
  });
2959
2957
  const deferred = defer();
2960
2958
  const load = () => {
2961
- const finish = (err, t3) => {
2959
+ const finish = (err, t2) => {
2962
2960
  this.isInitializing = false;
2963
2961
  if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn("init: i18next is already initialized. You should call init just once!");
2964
2962
  this.isInitialized = true;
2965
2963
  if (!this.options.isClone) this.logger.log("initialized", this.options);
2966
2964
  this.emit("initialized", this.options);
2967
- deferred.resolve(t3);
2968
- callback(err, t3);
2965
+ deferred.resolve(t2);
2966
+ callback(err, t2);
2969
2967
  };
2970
2968
  if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return finish(null, this.t.bind(this));
2971
2969
  this.changeLanguage(this.options.lng, finish);
@@ -3003,9 +3001,9 @@ var I18n = class _I18n extends EventEmitter {
3003
3001
  if (this.options.preload) {
3004
3002
  this.options.preload.forEach((l) => append(l));
3005
3003
  }
3006
- this.services.backendConnector.load(toLoad, this.options.ns, (e2) => {
3007
- if (!e2 && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
3008
- usedCallback(e2);
3004
+ this.services.backendConnector.load(toLoad, this.options.ns, (e) => {
3005
+ if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
3006
+ usedCallback(e);
3009
3007
  });
3010
3008
  } else {
3011
3009
  usedCallback(null);
@@ -3144,7 +3142,7 @@ var I18n = class _I18n extends EventEmitter {
3144
3142
  const keySeparator = _this3.options.keySeparator || ".";
3145
3143
  let resultKey;
3146
3144
  if (options.keyPrefix && Array.isArray(key)) {
3147
- resultKey = key.map((k2) => `${options.keyPrefix}${keySeparator}${k2}`);
3145
+ resultKey = key.map((k) => `${options.keyPrefix}${keySeparator}${k}`);
3148
3146
  } else {
3149
3147
  resultKey = options.keyPrefix ? `${options.keyPrefix}${keySeparator}${key}` : key;
3150
3148
  }
@@ -3256,8 +3254,8 @@ var I18n = class _I18n extends EventEmitter {
3256
3254
  clone.logger = clone.logger.clone(options);
3257
3255
  }
3258
3256
  const membersToCopy = ["store", "services", "language"];
3259
- membersToCopy.forEach((m3) => {
3260
- clone[m3] = this[m3];
3257
+ membersToCopy.forEach((m) => {
3258
+ clone[m] = this[m];
3261
3259
  });
3262
3260
  clone.services = {
3263
3261
  ...this.services
@@ -8397,8 +8395,8 @@ var space_locale_default = {
8397
8395
 
8398
8396
  // packages/app/i18n/runtime.ts
8399
8397
  var RUNTIME_SLIM_MARKER = "__noloRuntimeSlimI18n";
8400
- function pick(locale2, lng) {
8401
- return (locale2[lng] ?? locale2["en" /* EN */]).translation;
8398
+ function pick(locale, lng) {
8399
+ return (locale[lng] ?? locale["en" /* EN */]).translation;
8402
8400
  }
8403
8401
  if (!instance.isInitialized) {
8404
8402
  const resources = {};
@@ -8583,8 +8581,8 @@ var updateDialogSummaryAction = async (args, thunkApi) => {
8583
8581
  // packages/ai/context/realContextUsage.ts
8584
8582
  var lastInputTokensFromRecords = (records) => {
8585
8583
  if (!Array.isArray(records) || records.length === 0) return void 0;
8586
- for (let i2 = records.length - 1; i2 >= 0; i2--) {
8587
- const usage = records[i2]?.usage;
8584
+ for (let i = records.length - 1; i >= 0; i--) {
8585
+ const usage = records[i]?.usage;
8588
8586
  if (!usage) continue;
8589
8587
  const inputTokens = normalizeUsage(usage).input_tokens;
8590
8588
  if (typeof inputTokens === "number" && Number.isFinite(inputTokens) && inputTokens > 0) {
@@ -8624,8 +8622,8 @@ function dataURLtoFile(dataUrl, filename) {
8624
8622
  const binaryString = atob(base64);
8625
8623
  const length = binaryString.length;
8626
8624
  const u8arr = new Uint8Array(length);
8627
- for (let i2 = 0; i2 < length; i2++) {
8628
- u8arr[i2] = binaryString.charCodeAt(i2);
8625
+ for (let i = 0; i < length; i++) {
8626
+ u8arr[i] = binaryString.charCodeAt(i);
8629
8627
  }
8630
8628
  return new File([u8arr], filename, { type: mime });
8631
8629
  } catch (error) {
@@ -8835,11 +8833,11 @@ function separateThinkContent(contentBuffer) {
8835
8833
  let thinkContent = "";
8836
8834
  let normalContent = "";
8837
8835
  const combinedText = contentBuffer.flatMap(
8838
- (c2) => c2.type === "text" && "text" in c2 && c2.text ? [c2.text] : []
8836
+ (c) => c.type === "text" && "text" in c && c.text ? [c.text] : []
8839
8837
  ).join("");
8840
8838
  const thinkMatches = combinedText.match(/<think\b[^>]*>(.*?)<\/think>/gis);
8841
8839
  if (thinkMatches) {
8842
- thinkContent = thinkMatches.map((m3) => m3.replace(/<think\b[^>]*>|<\/think>/gi, "")).join("\n\n");
8840
+ thinkContent = thinkMatches.map((m) => m.replace(/<think\b[^>]*>|<\/think>/gi, "")).join("\n\n");
8843
8841
  normalContent = combinedText.replace(/<think\b[^>]*>.*?<\/think>/gis, "").trim();
8844
8842
  } else {
8845
8843
  normalContent = combinedText;
@@ -9069,7 +9067,7 @@ async function uiAskChoiceFunc(args, _thunkApi) {
9069
9067
  blocking,
9070
9068
  questions: args.questions
9071
9069
  },
9072
- displayData: args.questions.map((q2) => q2.question).join(" / ")
9070
+ displayData: args.questions.map((q) => q.question).join(" / ")
9073
9071
  };
9074
9072
  }
9075
9073
  const question = String(args?.question ?? "").trim();
@@ -9452,8 +9450,8 @@ var SHELL_COMMAND_CLASSIFIERS = [
9452
9450
  {
9453
9451
  pattern: /\b(rg|grep)\b/,
9454
9452
  label: (cmd) => {
9455
- const match2 = cmd.match(/(?:rg|grep)\s+(?:-[^\s]*\s+)*['"]?([^\s'"]+)['"]?/);
9456
- return match2 ? `\u641C\u7D22 "${match2[1]}"` : "\u641C\u7D22\u4EE3\u7801";
9453
+ const match = cmd.match(/(?:rg|grep)\s+(?:-[^\s]*\s+)*['"]?([^\s'"]+)['"]?/);
9454
+ return match ? `\u641C\u7D22 "${match[1]}"` : "\u641C\u7D22\u4EE3\u7801";
9457
9455
  }
9458
9456
  },
9459
9457
  {
@@ -9475,8 +9473,8 @@ var SHELL_COMMAND_CLASSIFIERS = [
9475
9473
  {
9476
9474
  pattern: /\bcurl\b/,
9477
9475
  label: (cmd) => {
9478
- const match2 = cmd.match(/curl\s+(?:-[^\s]*\s+)*(https?:\/\/[^\s'"]+)/);
9479
- return match2 ? `\u8BF7\u6C42 ${match2[1]}` : "\u53D1\u9001 HTTP \u8BF7\u6C42";
9476
+ const match = cmd.match(/curl\s+(?:-[^\s]*\s+)*(https?:\/\/[^\s'"]+)/);
9477
+ return match ? `\u8BF7\u6C42 ${match[1]}` : "\u53D1\u9001 HTTP \u8BF7\u6C42";
9480
9478
  }
9481
9479
  },
9482
9480
  {
@@ -10206,7 +10204,7 @@ var createSliceWithThunks = buildCreateSlice({
10206
10204
  });
10207
10205
  var messagesAdapter = createEntityAdapter({
10208
10206
  selectId: (message) => message.id,
10209
- sortComparer: (a3, b2) => a3.id.localeCompare(b2.id)
10207
+ sortComparer: (a, b) => a.id.localeCompare(b.id)
10210
10208
  });
10211
10209
  var createEmptyMessageDialogState = () => ({
10212
10210
  msgs: messagesAdapter.getInitialState()
@@ -10366,7 +10364,7 @@ var messageSlice = createSliceWithThunks({
10366
10364
  getMessageDialogState(state, action2.payload?.dialogId, action2.payload?.dialogKey)
10367
10365
  ]];
10368
10366
  targetStates.forEach(([dialogId, dialogState]) => {
10369
- const updates = Object.values(dialogState.msgs.entities).filter((m3) => m3?.isStreaming).map((m3) => ({ id: m3.id, changes: { isStreaming: false } }));
10367
+ const updates = Object.values(dialogState.msgs.entities).filter((m) => m?.isStreaming).map((m) => ({ id: m.id, changes: { isStreaming: false } }));
10370
10368
  if (updates.length > 0) {
10371
10369
  updateManyMessages(dialogState, updates);
10372
10370
  }
@@ -10986,7 +10984,7 @@ var messageSlice = createSliceWithThunks({
10986
10984
  const dialogId = findDialogIdByMessageDbKey(state.message, dbKey);
10987
10985
  const dialogState = dialogId ? state.message.dialogStateById[dialogId] : void 0;
10988
10986
  const entities = dialogState?.msgs.entities ?? {};
10989
- const msg = Object.values(entities).find((m3) => m3?.dbKey === dbKey);
10987
+ const msg = Object.values(entities).find((m) => m?.dbKey === dbKey);
10990
10988
  const { id: msgId, extraRemoveId, extraRemoveDbKey } = planDeleteMessageCascade(msg, entities);
10991
10989
  await dispatch(remove(dbKey));
10992
10990
  if (extraRemoveDbKey) {
@@ -11068,7 +11066,7 @@ var messageSlice = createSliceWithThunks({
11068
11066
  ).unwrap();
11069
11067
  await Promise.all(
11070
11068
  trailingMessages.map(
11071
- (m3) => m3?.dbKey ? dispatch(remove(m3.dbKey)).unwrap() : Promise.resolve()
11069
+ (m) => m?.dbKey ? dispatch(remove(m.dbKey)).unwrap() : Promise.resolve()
11072
11070
  )
11073
11071
  );
11074
11072
  const { agentKeyToUse, agentConfigToUse, effectiveRuntimeOptions } = resolveHandleSendMessageContext({
@@ -11077,7 +11075,7 @@ var messageSlice = createSliceWithThunks({
11077
11075
  runtimeOptions: args.runtimeOptions
11078
11076
  });
11079
11077
  if (agentKeyToUse) {
11080
- const { streamAgentChatTurn } = await import("./agentSlice-WNGUIMQZ.js");
11078
+ const { streamAgentChatTurn } = await import("./agentSlice-TMYP2UEA.js");
11081
11079
  await dispatch(
11082
11080
  streamAgentChatTurn({
11083
11081
  agentKey: agentKeyToUse,
@@ -11139,1618 +11137,9 @@ var {
11139
11137
  var messageSlice_default = messageSlice.reducer;
11140
11138
 
11141
11139
  // packages/chat/dialog/actions/updateTokensAction.ts
11140
+ var import_format = __toESM(require_format());
11142
11141
  import { ulid } from "ulid";
11143
11142
 
11144
- // node_modules/date-fns/esm/isDate/index.js
11145
- function isDate(value) {
11146
- requiredArgs(1, arguments);
11147
- return value instanceof Date || _typeof(value) === "object" && Object.prototype.toString.call(value) === "[object Date]";
11148
- }
11149
-
11150
- // node_modules/date-fns/esm/isValid/index.js
11151
- function isValid(dirtyDate) {
11152
- requiredArgs(1, arguments);
11153
- if (!isDate(dirtyDate) && typeof dirtyDate !== "number") {
11154
- return false;
11155
- }
11156
- var date = toDate(dirtyDate);
11157
- return !isNaN(Number(date));
11158
- }
11159
-
11160
- // node_modules/date-fns/esm/_lib/toInteger/index.js
11161
- function toInteger(dirtyNumber) {
11162
- if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
11163
- return NaN;
11164
- }
11165
- var number = Number(dirtyNumber);
11166
- if (isNaN(number)) {
11167
- return number;
11168
- }
11169
- return number < 0 ? Math.ceil(number) : Math.floor(number);
11170
- }
11171
-
11172
- // node_modules/date-fns/esm/addMilliseconds/index.js
11173
- function addMilliseconds(dirtyDate, dirtyAmount) {
11174
- requiredArgs(2, arguments);
11175
- var timestamp = toDate(dirtyDate).getTime();
11176
- var amount = toInteger(dirtyAmount);
11177
- return new Date(timestamp + amount);
11178
- }
11179
-
11180
- // node_modules/date-fns/esm/subMilliseconds/index.js
11181
- function subMilliseconds(dirtyDate, dirtyAmount) {
11182
- requiredArgs(2, arguments);
11183
- var amount = toInteger(dirtyAmount);
11184
- return addMilliseconds(dirtyDate, -amount);
11185
- }
11186
-
11187
- // node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js
11188
- var MILLISECONDS_IN_DAY = 864e5;
11189
- function getUTCDayOfYear(dirtyDate) {
11190
- requiredArgs(1, arguments);
11191
- var date = toDate(dirtyDate);
11192
- var timestamp = date.getTime();
11193
- date.setUTCMonth(0, 1);
11194
- date.setUTCHours(0, 0, 0, 0);
11195
- var startOfYearTimestamp = date.getTime();
11196
- var difference = timestamp - startOfYearTimestamp;
11197
- return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
11198
- }
11199
-
11200
- // node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js
11201
- function startOfUTCISOWeek(dirtyDate) {
11202
- requiredArgs(1, arguments);
11203
- var weekStartsOn = 1;
11204
- var date = toDate(dirtyDate);
11205
- var day = date.getUTCDay();
11206
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
11207
- date.setUTCDate(date.getUTCDate() - diff);
11208
- date.setUTCHours(0, 0, 0, 0);
11209
- return date;
11210
- }
11211
-
11212
- // node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js
11213
- function getUTCISOWeekYear(dirtyDate) {
11214
- requiredArgs(1, arguments);
11215
- var date = toDate(dirtyDate);
11216
- var year = date.getUTCFullYear();
11217
- var fourthOfJanuaryOfNextYear = /* @__PURE__ */ new Date(0);
11218
- fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
11219
- fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
11220
- var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
11221
- var fourthOfJanuaryOfThisYear = /* @__PURE__ */ new Date(0);
11222
- fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
11223
- fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
11224
- var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
11225
- if (date.getTime() >= startOfNextYear.getTime()) {
11226
- return year + 1;
11227
- } else if (date.getTime() >= startOfThisYear.getTime()) {
11228
- return year;
11229
- } else {
11230
- return year - 1;
11231
- }
11232
- }
11233
-
11234
- // node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js
11235
- function startOfUTCISOWeekYear(dirtyDate) {
11236
- requiredArgs(1, arguments);
11237
- var year = getUTCISOWeekYear(dirtyDate);
11238
- var fourthOfJanuary = /* @__PURE__ */ new Date(0);
11239
- fourthOfJanuary.setUTCFullYear(year, 0, 4);
11240
- fourthOfJanuary.setUTCHours(0, 0, 0, 0);
11241
- var date = startOfUTCISOWeek(fourthOfJanuary);
11242
- return date;
11243
- }
11244
-
11245
- // node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js
11246
- var MILLISECONDS_IN_WEEK = 6048e5;
11247
- function getUTCISOWeek(dirtyDate) {
11248
- requiredArgs(1, arguments);
11249
- var date = toDate(dirtyDate);
11250
- var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
11251
- return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
11252
- }
11253
-
11254
- // node_modules/date-fns/esm/_lib/defaultOptions/index.js
11255
- var defaultOptions = {};
11256
- function getDefaultOptions() {
11257
- return defaultOptions;
11258
- }
11259
-
11260
- // node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js
11261
- function startOfUTCWeek(dirtyDate, options) {
11262
- var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11263
- requiredArgs(1, arguments);
11264
- var defaultOptions2 = getDefaultOptions();
11265
- var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions2.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
11266
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
11267
- throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
11268
- }
11269
- var date = toDate(dirtyDate);
11270
- var day = date.getUTCDay();
11271
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
11272
- date.setUTCDate(date.getUTCDate() - diff);
11273
- date.setUTCHours(0, 0, 0, 0);
11274
- return date;
11275
- }
11276
-
11277
- // node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js
11278
- function getUTCWeekYear(dirtyDate, options) {
11279
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11280
- requiredArgs(1, arguments);
11281
- var date = toDate(dirtyDate);
11282
- var year = date.getUTCFullYear();
11283
- var defaultOptions2 = getDefaultOptions();
11284
- var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
11285
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
11286
- throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
11287
- }
11288
- var firstWeekOfNextYear = /* @__PURE__ */ new Date(0);
11289
- firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
11290
- firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
11291
- var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
11292
- var firstWeekOfThisYear = /* @__PURE__ */ new Date(0);
11293
- firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
11294
- firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
11295
- var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
11296
- if (date.getTime() >= startOfNextYear.getTime()) {
11297
- return year + 1;
11298
- } else if (date.getTime() >= startOfThisYear.getTime()) {
11299
- return year;
11300
- } else {
11301
- return year - 1;
11302
- }
11303
- }
11304
-
11305
- // node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js
11306
- function startOfUTCWeekYear(dirtyDate, options) {
11307
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11308
- requiredArgs(1, arguments);
11309
- var defaultOptions2 = getDefaultOptions();
11310
- var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
11311
- var year = getUTCWeekYear(dirtyDate, options);
11312
- var firstWeek = /* @__PURE__ */ new Date(0);
11313
- firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
11314
- firstWeek.setUTCHours(0, 0, 0, 0);
11315
- var date = startOfUTCWeek(firstWeek, options);
11316
- return date;
11317
- }
11318
-
11319
- // node_modules/date-fns/esm/_lib/getUTCWeek/index.js
11320
- var MILLISECONDS_IN_WEEK2 = 6048e5;
11321
- function getUTCWeek(dirtyDate, options) {
11322
- requiredArgs(1, arguments);
11323
- var date = toDate(dirtyDate);
11324
- var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
11325
- return Math.round(diff / MILLISECONDS_IN_WEEK2) + 1;
11326
- }
11327
-
11328
- // node_modules/date-fns/esm/_lib/format/lightFormatters/index.js
11329
- var formatters = {
11330
- // Year
11331
- y: function y(date, token) {
11332
- var signedYear = date.getUTCFullYear();
11333
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
11334
- return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
11335
- },
11336
- // Month
11337
- M: function M(date, token) {
11338
- var month = date.getUTCMonth();
11339
- return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
11340
- },
11341
- // Day of the month
11342
- d: function d(date, token) {
11343
- return addLeadingZeros(date.getUTCDate(), token.length);
11344
- },
11345
- // AM or PM
11346
- a: function a(date, token) {
11347
- var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? "pm" : "am";
11348
- switch (token) {
11349
- case "a":
11350
- case "aa":
11351
- return dayPeriodEnumValue.toUpperCase();
11352
- case "aaa":
11353
- return dayPeriodEnumValue;
11354
- case "aaaaa":
11355
- return dayPeriodEnumValue[0];
11356
- case "aaaa":
11357
- default:
11358
- return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
11359
- }
11360
- },
11361
- // Hour [1-12]
11362
- h: function h(date, token) {
11363
- return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
11364
- },
11365
- // Hour [0-23]
11366
- H: function H(date, token) {
11367
- return addLeadingZeros(date.getUTCHours(), token.length);
11368
- },
11369
- // Minute
11370
- m: function m(date, token) {
11371
- return addLeadingZeros(date.getUTCMinutes(), token.length);
11372
- },
11373
- // Second
11374
- s: function s(date, token) {
11375
- return addLeadingZeros(date.getUTCSeconds(), token.length);
11376
- },
11377
- // Fraction of second
11378
- S: function S(date, token) {
11379
- var numberOfDigits = token.length;
11380
- var milliseconds = date.getUTCMilliseconds();
11381
- var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
11382
- return addLeadingZeros(fractionalSeconds, token.length);
11383
- }
11384
- };
11385
- var lightFormatters_default = formatters;
11386
-
11387
- // node_modules/date-fns/esm/_lib/format/formatters/index.js
11388
- var dayPeriodEnum = {
11389
- am: "am",
11390
- pm: "pm",
11391
- midnight: "midnight",
11392
- noon: "noon",
11393
- morning: "morning",
11394
- afternoon: "afternoon",
11395
- evening: "evening",
11396
- night: "night"
11397
- };
11398
- var formatters2 = {
11399
- // Era
11400
- G: function G(date, token, localize2) {
11401
- var era = date.getUTCFullYear() > 0 ? 1 : 0;
11402
- switch (token) {
11403
- // AD, BC
11404
- case "G":
11405
- case "GG":
11406
- case "GGG":
11407
- return localize2.era(era, {
11408
- width: "abbreviated"
11409
- });
11410
- // A, B
11411
- case "GGGGG":
11412
- return localize2.era(era, {
11413
- width: "narrow"
11414
- });
11415
- // Anno Domini, Before Christ
11416
- case "GGGG":
11417
- default:
11418
- return localize2.era(era, {
11419
- width: "wide"
11420
- });
11421
- }
11422
- },
11423
- // Year
11424
- y: function y2(date, token, localize2) {
11425
- if (token === "yo") {
11426
- var signedYear = date.getUTCFullYear();
11427
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
11428
- return localize2.ordinalNumber(year, {
11429
- unit: "year"
11430
- });
11431
- }
11432
- return lightFormatters_default.y(date, token);
11433
- },
11434
- // Local week-numbering year
11435
- Y: function Y(date, token, localize2, options) {
11436
- var signedWeekYear = getUTCWeekYear(date, options);
11437
- var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
11438
- if (token === "YY") {
11439
- var twoDigitYear = weekYear % 100;
11440
- return addLeadingZeros(twoDigitYear, 2);
11441
- }
11442
- if (token === "Yo") {
11443
- return localize2.ordinalNumber(weekYear, {
11444
- unit: "year"
11445
- });
11446
- }
11447
- return addLeadingZeros(weekYear, token.length);
11448
- },
11449
- // ISO week-numbering year
11450
- R: function R(date, token) {
11451
- var isoWeekYear = getUTCISOWeekYear(date);
11452
- return addLeadingZeros(isoWeekYear, token.length);
11453
- },
11454
- // Extended year. This is a single number designating the year of this calendar system.
11455
- // The main difference between `y` and `u` localizers are B.C. years:
11456
- // | Year | `y` | `u` |
11457
- // |------|-----|-----|
11458
- // | AC 1 | 1 | 1 |
11459
- // | BC 1 | 1 | 0 |
11460
- // | BC 2 | 2 | -1 |
11461
- // Also `yy` always returns the last two digits of a year,
11462
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
11463
- u: function u(date, token) {
11464
- var year = date.getUTCFullYear();
11465
- return addLeadingZeros(year, token.length);
11466
- },
11467
- // Quarter
11468
- Q: function Q(date, token, localize2) {
11469
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
11470
- switch (token) {
11471
- // 1, 2, 3, 4
11472
- case "Q":
11473
- return String(quarter);
11474
- // 01, 02, 03, 04
11475
- case "QQ":
11476
- return addLeadingZeros(quarter, 2);
11477
- // 1st, 2nd, 3rd, 4th
11478
- case "Qo":
11479
- return localize2.ordinalNumber(quarter, {
11480
- unit: "quarter"
11481
- });
11482
- // Q1, Q2, Q3, Q4
11483
- case "QQQ":
11484
- return localize2.quarter(quarter, {
11485
- width: "abbreviated",
11486
- context: "formatting"
11487
- });
11488
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
11489
- case "QQQQQ":
11490
- return localize2.quarter(quarter, {
11491
- width: "narrow",
11492
- context: "formatting"
11493
- });
11494
- // 1st quarter, 2nd quarter, ...
11495
- case "QQQQ":
11496
- default:
11497
- return localize2.quarter(quarter, {
11498
- width: "wide",
11499
- context: "formatting"
11500
- });
11501
- }
11502
- },
11503
- // Stand-alone quarter
11504
- q: function q(date, token, localize2) {
11505
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
11506
- switch (token) {
11507
- // 1, 2, 3, 4
11508
- case "q":
11509
- return String(quarter);
11510
- // 01, 02, 03, 04
11511
- case "qq":
11512
- return addLeadingZeros(quarter, 2);
11513
- // 1st, 2nd, 3rd, 4th
11514
- case "qo":
11515
- return localize2.ordinalNumber(quarter, {
11516
- unit: "quarter"
11517
- });
11518
- // Q1, Q2, Q3, Q4
11519
- case "qqq":
11520
- return localize2.quarter(quarter, {
11521
- width: "abbreviated",
11522
- context: "standalone"
11523
- });
11524
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
11525
- case "qqqqq":
11526
- return localize2.quarter(quarter, {
11527
- width: "narrow",
11528
- context: "standalone"
11529
- });
11530
- // 1st quarter, 2nd quarter, ...
11531
- case "qqqq":
11532
- default:
11533
- return localize2.quarter(quarter, {
11534
- width: "wide",
11535
- context: "standalone"
11536
- });
11537
- }
11538
- },
11539
- // Month
11540
- M: function M2(date, token, localize2) {
11541
- var month = date.getUTCMonth();
11542
- switch (token) {
11543
- case "M":
11544
- case "MM":
11545
- return lightFormatters_default.M(date, token);
11546
- // 1st, 2nd, ..., 12th
11547
- case "Mo":
11548
- return localize2.ordinalNumber(month + 1, {
11549
- unit: "month"
11550
- });
11551
- // Jan, Feb, ..., Dec
11552
- case "MMM":
11553
- return localize2.month(month, {
11554
- width: "abbreviated",
11555
- context: "formatting"
11556
- });
11557
- // J, F, ..., D
11558
- case "MMMMM":
11559
- return localize2.month(month, {
11560
- width: "narrow",
11561
- context: "formatting"
11562
- });
11563
- // January, February, ..., December
11564
- case "MMMM":
11565
- default:
11566
- return localize2.month(month, {
11567
- width: "wide",
11568
- context: "formatting"
11569
- });
11570
- }
11571
- },
11572
- // Stand-alone month
11573
- L: function L(date, token, localize2) {
11574
- var month = date.getUTCMonth();
11575
- switch (token) {
11576
- // 1, 2, ..., 12
11577
- case "L":
11578
- return String(month + 1);
11579
- // 01, 02, ..., 12
11580
- case "LL":
11581
- return addLeadingZeros(month + 1, 2);
11582
- // 1st, 2nd, ..., 12th
11583
- case "Lo":
11584
- return localize2.ordinalNumber(month + 1, {
11585
- unit: "month"
11586
- });
11587
- // Jan, Feb, ..., Dec
11588
- case "LLL":
11589
- return localize2.month(month, {
11590
- width: "abbreviated",
11591
- context: "standalone"
11592
- });
11593
- // J, F, ..., D
11594
- case "LLLLL":
11595
- return localize2.month(month, {
11596
- width: "narrow",
11597
- context: "standalone"
11598
- });
11599
- // January, February, ..., December
11600
- case "LLLL":
11601
- default:
11602
- return localize2.month(month, {
11603
- width: "wide",
11604
- context: "standalone"
11605
- });
11606
- }
11607
- },
11608
- // Local week of year
11609
- w: function w(date, token, localize2, options) {
11610
- var week = getUTCWeek(date, options);
11611
- if (token === "wo") {
11612
- return localize2.ordinalNumber(week, {
11613
- unit: "week"
11614
- });
11615
- }
11616
- return addLeadingZeros(week, token.length);
11617
- },
11618
- // ISO week of year
11619
- I: function I(date, token, localize2) {
11620
- var isoWeek = getUTCISOWeek(date);
11621
- if (token === "Io") {
11622
- return localize2.ordinalNumber(isoWeek, {
11623
- unit: "week"
11624
- });
11625
- }
11626
- return addLeadingZeros(isoWeek, token.length);
11627
- },
11628
- // Day of the month
11629
- d: function d2(date, token, localize2) {
11630
- if (token === "do") {
11631
- return localize2.ordinalNumber(date.getUTCDate(), {
11632
- unit: "date"
11633
- });
11634
- }
11635
- return lightFormatters_default.d(date, token);
11636
- },
11637
- // Day of year
11638
- D: function D(date, token, localize2) {
11639
- var dayOfYear = getUTCDayOfYear(date);
11640
- if (token === "Do") {
11641
- return localize2.ordinalNumber(dayOfYear, {
11642
- unit: "dayOfYear"
11643
- });
11644
- }
11645
- return addLeadingZeros(dayOfYear, token.length);
11646
- },
11647
- // Day of week
11648
- E: function E(date, token, localize2) {
11649
- var dayOfWeek = date.getUTCDay();
11650
- switch (token) {
11651
- // Tue
11652
- case "E":
11653
- case "EE":
11654
- case "EEE":
11655
- return localize2.day(dayOfWeek, {
11656
- width: "abbreviated",
11657
- context: "formatting"
11658
- });
11659
- // T
11660
- case "EEEEE":
11661
- return localize2.day(dayOfWeek, {
11662
- width: "narrow",
11663
- context: "formatting"
11664
- });
11665
- // Tu
11666
- case "EEEEEE":
11667
- return localize2.day(dayOfWeek, {
11668
- width: "short",
11669
- context: "formatting"
11670
- });
11671
- // Tuesday
11672
- case "EEEE":
11673
- default:
11674
- return localize2.day(dayOfWeek, {
11675
- width: "wide",
11676
- context: "formatting"
11677
- });
11678
- }
11679
- },
11680
- // Local day of week
11681
- e: function e(date, token, localize2, options) {
11682
- var dayOfWeek = date.getUTCDay();
11683
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
11684
- switch (token) {
11685
- // Numerical value (Nth day of week with current locale or weekStartsOn)
11686
- case "e":
11687
- return String(localDayOfWeek);
11688
- // Padded numerical value
11689
- case "ee":
11690
- return addLeadingZeros(localDayOfWeek, 2);
11691
- // 1st, 2nd, ..., 7th
11692
- case "eo":
11693
- return localize2.ordinalNumber(localDayOfWeek, {
11694
- unit: "day"
11695
- });
11696
- case "eee":
11697
- return localize2.day(dayOfWeek, {
11698
- width: "abbreviated",
11699
- context: "formatting"
11700
- });
11701
- // T
11702
- case "eeeee":
11703
- return localize2.day(dayOfWeek, {
11704
- width: "narrow",
11705
- context: "formatting"
11706
- });
11707
- // Tu
11708
- case "eeeeee":
11709
- return localize2.day(dayOfWeek, {
11710
- width: "short",
11711
- context: "formatting"
11712
- });
11713
- // Tuesday
11714
- case "eeee":
11715
- default:
11716
- return localize2.day(dayOfWeek, {
11717
- width: "wide",
11718
- context: "formatting"
11719
- });
11720
- }
11721
- },
11722
- // Stand-alone local day of week
11723
- c: function c(date, token, localize2, options) {
11724
- var dayOfWeek = date.getUTCDay();
11725
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
11726
- switch (token) {
11727
- // Numerical value (same as in `e`)
11728
- case "c":
11729
- return String(localDayOfWeek);
11730
- // Padded numerical value
11731
- case "cc":
11732
- return addLeadingZeros(localDayOfWeek, token.length);
11733
- // 1st, 2nd, ..., 7th
11734
- case "co":
11735
- return localize2.ordinalNumber(localDayOfWeek, {
11736
- unit: "day"
11737
- });
11738
- case "ccc":
11739
- return localize2.day(dayOfWeek, {
11740
- width: "abbreviated",
11741
- context: "standalone"
11742
- });
11743
- // T
11744
- case "ccccc":
11745
- return localize2.day(dayOfWeek, {
11746
- width: "narrow",
11747
- context: "standalone"
11748
- });
11749
- // Tu
11750
- case "cccccc":
11751
- return localize2.day(dayOfWeek, {
11752
- width: "short",
11753
- context: "standalone"
11754
- });
11755
- // Tuesday
11756
- case "cccc":
11757
- default:
11758
- return localize2.day(dayOfWeek, {
11759
- width: "wide",
11760
- context: "standalone"
11761
- });
11762
- }
11763
- },
11764
- // ISO day of week
11765
- i: function i(date, token, localize2) {
11766
- var dayOfWeek = date.getUTCDay();
11767
- var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
11768
- switch (token) {
11769
- // 2
11770
- case "i":
11771
- return String(isoDayOfWeek);
11772
- // 02
11773
- case "ii":
11774
- return addLeadingZeros(isoDayOfWeek, token.length);
11775
- // 2nd
11776
- case "io":
11777
- return localize2.ordinalNumber(isoDayOfWeek, {
11778
- unit: "day"
11779
- });
11780
- // Tue
11781
- case "iii":
11782
- return localize2.day(dayOfWeek, {
11783
- width: "abbreviated",
11784
- context: "formatting"
11785
- });
11786
- // T
11787
- case "iiiii":
11788
- return localize2.day(dayOfWeek, {
11789
- width: "narrow",
11790
- context: "formatting"
11791
- });
11792
- // Tu
11793
- case "iiiiii":
11794
- return localize2.day(dayOfWeek, {
11795
- width: "short",
11796
- context: "formatting"
11797
- });
11798
- // Tuesday
11799
- case "iiii":
11800
- default:
11801
- return localize2.day(dayOfWeek, {
11802
- width: "wide",
11803
- context: "formatting"
11804
- });
11805
- }
11806
- },
11807
- // AM or PM
11808
- a: function a2(date, token, localize2) {
11809
- var hours = date.getUTCHours();
11810
- var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
11811
- switch (token) {
11812
- case "a":
11813
- case "aa":
11814
- return localize2.dayPeriod(dayPeriodEnumValue, {
11815
- width: "abbreviated",
11816
- context: "formatting"
11817
- });
11818
- case "aaa":
11819
- return localize2.dayPeriod(dayPeriodEnumValue, {
11820
- width: "abbreviated",
11821
- context: "formatting"
11822
- }).toLowerCase();
11823
- case "aaaaa":
11824
- return localize2.dayPeriod(dayPeriodEnumValue, {
11825
- width: "narrow",
11826
- context: "formatting"
11827
- });
11828
- case "aaaa":
11829
- default:
11830
- return localize2.dayPeriod(dayPeriodEnumValue, {
11831
- width: "wide",
11832
- context: "formatting"
11833
- });
11834
- }
11835
- },
11836
- // AM, PM, midnight, noon
11837
- b: function b(date, token, localize2) {
11838
- var hours = date.getUTCHours();
11839
- var dayPeriodEnumValue;
11840
- if (hours === 12) {
11841
- dayPeriodEnumValue = dayPeriodEnum.noon;
11842
- } else if (hours === 0) {
11843
- dayPeriodEnumValue = dayPeriodEnum.midnight;
11844
- } else {
11845
- dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
11846
- }
11847
- switch (token) {
11848
- case "b":
11849
- case "bb":
11850
- return localize2.dayPeriod(dayPeriodEnumValue, {
11851
- width: "abbreviated",
11852
- context: "formatting"
11853
- });
11854
- case "bbb":
11855
- return localize2.dayPeriod(dayPeriodEnumValue, {
11856
- width: "abbreviated",
11857
- context: "formatting"
11858
- }).toLowerCase();
11859
- case "bbbbb":
11860
- return localize2.dayPeriod(dayPeriodEnumValue, {
11861
- width: "narrow",
11862
- context: "formatting"
11863
- });
11864
- case "bbbb":
11865
- default:
11866
- return localize2.dayPeriod(dayPeriodEnumValue, {
11867
- width: "wide",
11868
- context: "formatting"
11869
- });
11870
- }
11871
- },
11872
- // in the morning, in the afternoon, in the evening, at night
11873
- B: function B(date, token, localize2) {
11874
- var hours = date.getUTCHours();
11875
- var dayPeriodEnumValue;
11876
- if (hours >= 17) {
11877
- dayPeriodEnumValue = dayPeriodEnum.evening;
11878
- } else if (hours >= 12) {
11879
- dayPeriodEnumValue = dayPeriodEnum.afternoon;
11880
- } else if (hours >= 4) {
11881
- dayPeriodEnumValue = dayPeriodEnum.morning;
11882
- } else {
11883
- dayPeriodEnumValue = dayPeriodEnum.night;
11884
- }
11885
- switch (token) {
11886
- case "B":
11887
- case "BB":
11888
- case "BBB":
11889
- return localize2.dayPeriod(dayPeriodEnumValue, {
11890
- width: "abbreviated",
11891
- context: "formatting"
11892
- });
11893
- case "BBBBB":
11894
- return localize2.dayPeriod(dayPeriodEnumValue, {
11895
- width: "narrow",
11896
- context: "formatting"
11897
- });
11898
- case "BBBB":
11899
- default:
11900
- return localize2.dayPeriod(dayPeriodEnumValue, {
11901
- width: "wide",
11902
- context: "formatting"
11903
- });
11904
- }
11905
- },
11906
- // Hour [1-12]
11907
- h: function h2(date, token, localize2) {
11908
- if (token === "ho") {
11909
- var hours = date.getUTCHours() % 12;
11910
- if (hours === 0) hours = 12;
11911
- return localize2.ordinalNumber(hours, {
11912
- unit: "hour"
11913
- });
11914
- }
11915
- return lightFormatters_default.h(date, token);
11916
- },
11917
- // Hour [0-23]
11918
- H: function H2(date, token, localize2) {
11919
- if (token === "Ho") {
11920
- return localize2.ordinalNumber(date.getUTCHours(), {
11921
- unit: "hour"
11922
- });
11923
- }
11924
- return lightFormatters_default.H(date, token);
11925
- },
11926
- // Hour [0-11]
11927
- K: function K(date, token, localize2) {
11928
- var hours = date.getUTCHours() % 12;
11929
- if (token === "Ko") {
11930
- return localize2.ordinalNumber(hours, {
11931
- unit: "hour"
11932
- });
11933
- }
11934
- return addLeadingZeros(hours, token.length);
11935
- },
11936
- // Hour [1-24]
11937
- k: function k(date, token, localize2) {
11938
- var hours = date.getUTCHours();
11939
- if (hours === 0) hours = 24;
11940
- if (token === "ko") {
11941
- return localize2.ordinalNumber(hours, {
11942
- unit: "hour"
11943
- });
11944
- }
11945
- return addLeadingZeros(hours, token.length);
11946
- },
11947
- // Minute
11948
- m: function m2(date, token, localize2) {
11949
- if (token === "mo") {
11950
- return localize2.ordinalNumber(date.getUTCMinutes(), {
11951
- unit: "minute"
11952
- });
11953
- }
11954
- return lightFormatters_default.m(date, token);
11955
- },
11956
- // Second
11957
- s: function s2(date, token, localize2) {
11958
- if (token === "so") {
11959
- return localize2.ordinalNumber(date.getUTCSeconds(), {
11960
- unit: "second"
11961
- });
11962
- }
11963
- return lightFormatters_default.s(date, token);
11964
- },
11965
- // Fraction of second
11966
- S: function S2(date, token) {
11967
- return lightFormatters_default.S(date, token);
11968
- },
11969
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
11970
- X: function X(date, token, _localize, options) {
11971
- var originalDate = options._originalDate || date;
11972
- var timezoneOffset = originalDate.getTimezoneOffset();
11973
- if (timezoneOffset === 0) {
11974
- return "Z";
11975
- }
11976
- switch (token) {
11977
- // Hours and optional minutes
11978
- case "X":
11979
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
11980
- // Hours, minutes and optional seconds without `:` delimiter
11981
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
11982
- // so this token always has the same output as `XX`
11983
- case "XXXX":
11984
- case "XX":
11985
- return formatTimezone(timezoneOffset);
11986
- // Hours, minutes and optional seconds with `:` delimiter
11987
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
11988
- // so this token always has the same output as `XXX`
11989
- case "XXXXX":
11990
- case "XXX":
11991
- // Hours and minutes with `:` delimiter
11992
- default:
11993
- return formatTimezone(timezoneOffset, ":");
11994
- }
11995
- },
11996
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
11997
- x: function x(date, token, _localize, options) {
11998
- var originalDate = options._originalDate || date;
11999
- var timezoneOffset = originalDate.getTimezoneOffset();
12000
- switch (token) {
12001
- // Hours and optional minutes
12002
- case "x":
12003
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
12004
- // Hours, minutes and optional seconds without `:` delimiter
12005
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12006
- // so this token always has the same output as `xx`
12007
- case "xxxx":
12008
- case "xx":
12009
- return formatTimezone(timezoneOffset);
12010
- // Hours, minutes and optional seconds with `:` delimiter
12011
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12012
- // so this token always has the same output as `xxx`
12013
- case "xxxxx":
12014
- case "xxx":
12015
- // Hours and minutes with `:` delimiter
12016
- default:
12017
- return formatTimezone(timezoneOffset, ":");
12018
- }
12019
- },
12020
- // Timezone (GMT)
12021
- O: function O(date, token, _localize, options) {
12022
- var originalDate = options._originalDate || date;
12023
- var timezoneOffset = originalDate.getTimezoneOffset();
12024
- switch (token) {
12025
- // Short
12026
- case "O":
12027
- case "OO":
12028
- case "OOO":
12029
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
12030
- // Long
12031
- case "OOOO":
12032
- default:
12033
- return "GMT" + formatTimezone(timezoneOffset, ":");
12034
- }
12035
- },
12036
- // Timezone (specific non-location)
12037
- z: function z(date, token, _localize, options) {
12038
- var originalDate = options._originalDate || date;
12039
- var timezoneOffset = originalDate.getTimezoneOffset();
12040
- switch (token) {
12041
- // Short
12042
- case "z":
12043
- case "zz":
12044
- case "zzz":
12045
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
12046
- // Long
12047
- case "zzzz":
12048
- default:
12049
- return "GMT" + formatTimezone(timezoneOffset, ":");
12050
- }
12051
- },
12052
- // Seconds timestamp
12053
- t: function t2(date, token, _localize, options) {
12054
- var originalDate = options._originalDate || date;
12055
- var timestamp = Math.floor(originalDate.getTime() / 1e3);
12056
- return addLeadingZeros(timestamp, token.length);
12057
- },
12058
- // Milliseconds timestamp
12059
- T: function T(date, token, _localize, options) {
12060
- var originalDate = options._originalDate || date;
12061
- var timestamp = originalDate.getTime();
12062
- return addLeadingZeros(timestamp, token.length);
12063
- }
12064
- };
12065
- function formatTimezoneShort(offset, dirtyDelimiter) {
12066
- var sign = offset > 0 ? "-" : "+";
12067
- var absOffset = Math.abs(offset);
12068
- var hours = Math.floor(absOffset / 60);
12069
- var minutes = absOffset % 60;
12070
- if (minutes === 0) {
12071
- return sign + String(hours);
12072
- }
12073
- var delimiter = dirtyDelimiter || "";
12074
- return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
12075
- }
12076
- function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
12077
- if (offset % 60 === 0) {
12078
- var sign = offset > 0 ? "-" : "+";
12079
- return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
12080
- }
12081
- return formatTimezone(offset, dirtyDelimiter);
12082
- }
12083
- function formatTimezone(offset, dirtyDelimiter) {
12084
- var delimiter = dirtyDelimiter || "";
12085
- var sign = offset > 0 ? "-" : "+";
12086
- var absOffset = Math.abs(offset);
12087
- var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
12088
- var minutes = addLeadingZeros(absOffset % 60, 2);
12089
- return sign + hours + delimiter + minutes;
12090
- }
12091
- var formatters_default = formatters2;
12092
-
12093
- // node_modules/date-fns/esm/_lib/format/longFormatters/index.js
12094
- var dateLongFormatter = function dateLongFormatter2(pattern, formatLong2) {
12095
- switch (pattern) {
12096
- case "P":
12097
- return formatLong2.date({
12098
- width: "short"
12099
- });
12100
- case "PP":
12101
- return formatLong2.date({
12102
- width: "medium"
12103
- });
12104
- case "PPP":
12105
- return formatLong2.date({
12106
- width: "long"
12107
- });
12108
- case "PPPP":
12109
- default:
12110
- return formatLong2.date({
12111
- width: "full"
12112
- });
12113
- }
12114
- };
12115
- var timeLongFormatter = function timeLongFormatter2(pattern, formatLong2) {
12116
- switch (pattern) {
12117
- case "p":
12118
- return formatLong2.time({
12119
- width: "short"
12120
- });
12121
- case "pp":
12122
- return formatLong2.time({
12123
- width: "medium"
12124
- });
12125
- case "ppp":
12126
- return formatLong2.time({
12127
- width: "long"
12128
- });
12129
- case "pppp":
12130
- default:
12131
- return formatLong2.time({
12132
- width: "full"
12133
- });
12134
- }
12135
- };
12136
- var dateTimeLongFormatter = function dateTimeLongFormatter2(pattern, formatLong2) {
12137
- var matchResult = pattern.match(/(P+)(p+)?/) || [];
12138
- var datePattern = matchResult[1];
12139
- var timePattern = matchResult[2];
12140
- if (!timePattern) {
12141
- return dateLongFormatter(pattern, formatLong2);
12142
- }
12143
- var dateTimeFormat;
12144
- switch (datePattern) {
12145
- case "P":
12146
- dateTimeFormat = formatLong2.dateTime({
12147
- width: "short"
12148
- });
12149
- break;
12150
- case "PP":
12151
- dateTimeFormat = formatLong2.dateTime({
12152
- width: "medium"
12153
- });
12154
- break;
12155
- case "PPP":
12156
- dateTimeFormat = formatLong2.dateTime({
12157
- width: "long"
12158
- });
12159
- break;
12160
- case "PPPP":
12161
- default:
12162
- dateTimeFormat = formatLong2.dateTime({
12163
- width: "full"
12164
- });
12165
- break;
12166
- }
12167
- return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
12168
- };
12169
- var longFormatters = {
12170
- p: timeLongFormatter,
12171
- P: dateTimeLongFormatter
12172
- };
12173
- var longFormatters_default = longFormatters;
12174
-
12175
- // node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js
12176
- function getTimezoneOffsetInMilliseconds(date) {
12177
- var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
12178
- utcDate.setUTCFullYear(date.getFullYear());
12179
- return date.getTime() - utcDate.getTime();
12180
- }
12181
-
12182
- // node_modules/date-fns/esm/_lib/protectedTokens/index.js
12183
- var protectedDayOfYearTokens = ["D", "DD"];
12184
- var protectedWeekYearTokens = ["YY", "YYYY"];
12185
- function isProtectedDayOfYearToken(token) {
12186
- return protectedDayOfYearTokens.indexOf(token) !== -1;
12187
- }
12188
- function isProtectedWeekYearToken(token) {
12189
- return protectedWeekYearTokens.indexOf(token) !== -1;
12190
- }
12191
- function throwProtectedError(token, format2, input) {
12192
- if (token === "YYYY") {
12193
- throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
12194
- } else if (token === "YY") {
12195
- throw new RangeError("Use `yy` instead of `YY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
12196
- } else if (token === "D") {
12197
- throw new RangeError("Use `d` instead of `D` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
12198
- } else if (token === "DD") {
12199
- throw new RangeError("Use `dd` instead of `DD` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
12200
- }
12201
- }
12202
-
12203
- // node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js
12204
- var formatDistanceLocale = {
12205
- lessThanXSeconds: {
12206
- one: "less than a second",
12207
- other: "less than {{count}} seconds"
12208
- },
12209
- xSeconds: {
12210
- one: "1 second",
12211
- other: "{{count}} seconds"
12212
- },
12213
- halfAMinute: "half a minute",
12214
- lessThanXMinutes: {
12215
- one: "less than a minute",
12216
- other: "less than {{count}} minutes"
12217
- },
12218
- xMinutes: {
12219
- one: "1 minute",
12220
- other: "{{count}} minutes"
12221
- },
12222
- aboutXHours: {
12223
- one: "about 1 hour",
12224
- other: "about {{count}} hours"
12225
- },
12226
- xHours: {
12227
- one: "1 hour",
12228
- other: "{{count}} hours"
12229
- },
12230
- xDays: {
12231
- one: "1 day",
12232
- other: "{{count}} days"
12233
- },
12234
- aboutXWeeks: {
12235
- one: "about 1 week",
12236
- other: "about {{count}} weeks"
12237
- },
12238
- xWeeks: {
12239
- one: "1 week",
12240
- other: "{{count}} weeks"
12241
- },
12242
- aboutXMonths: {
12243
- one: "about 1 month",
12244
- other: "about {{count}} months"
12245
- },
12246
- xMonths: {
12247
- one: "1 month",
12248
- other: "{{count}} months"
12249
- },
12250
- aboutXYears: {
12251
- one: "about 1 year",
12252
- other: "about {{count}} years"
12253
- },
12254
- xYears: {
12255
- one: "1 year",
12256
- other: "{{count}} years"
12257
- },
12258
- overXYears: {
12259
- one: "over 1 year",
12260
- other: "over {{count}} years"
12261
- },
12262
- almostXYears: {
12263
- one: "almost 1 year",
12264
- other: "almost {{count}} years"
12265
- }
12266
- };
12267
- var formatDistance = function formatDistance2(token, count, options) {
12268
- var result;
12269
- var tokenValue = formatDistanceLocale[token];
12270
- if (typeof tokenValue === "string") {
12271
- result = tokenValue;
12272
- } else if (count === 1) {
12273
- result = tokenValue.one;
12274
- } else {
12275
- result = tokenValue.other.replace("{{count}}", count.toString());
12276
- }
12277
- if (options !== null && options !== void 0 && options.addSuffix) {
12278
- if (options.comparison && options.comparison > 0) {
12279
- return "in " + result;
12280
- } else {
12281
- return result + " ago";
12282
- }
12283
- }
12284
- return result;
12285
- };
12286
- var formatDistance_default = formatDistance;
12287
-
12288
- // node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js
12289
- function buildFormatLongFn(args) {
12290
- return function() {
12291
- var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
12292
- var width = options.width ? String(options.width) : args.defaultWidth;
12293
- var format2 = args.formats[width] || args.formats[args.defaultWidth];
12294
- return format2;
12295
- };
12296
- }
12297
-
12298
- // node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js
12299
- var dateFormats = {
12300
- full: "EEEE, MMMM do, y",
12301
- long: "MMMM do, y",
12302
- medium: "MMM d, y",
12303
- short: "MM/dd/yyyy"
12304
- };
12305
- var timeFormats = {
12306
- full: "h:mm:ss a zzzz",
12307
- long: "h:mm:ss a z",
12308
- medium: "h:mm:ss a",
12309
- short: "h:mm a"
12310
- };
12311
- var dateTimeFormats = {
12312
- full: "{{date}} 'at' {{time}}",
12313
- long: "{{date}} 'at' {{time}}",
12314
- medium: "{{date}}, {{time}}",
12315
- short: "{{date}}, {{time}}"
12316
- };
12317
- var formatLong = {
12318
- date: buildFormatLongFn({
12319
- formats: dateFormats,
12320
- defaultWidth: "full"
12321
- }),
12322
- time: buildFormatLongFn({
12323
- formats: timeFormats,
12324
- defaultWidth: "full"
12325
- }),
12326
- dateTime: buildFormatLongFn({
12327
- formats: dateTimeFormats,
12328
- defaultWidth: "full"
12329
- })
12330
- };
12331
- var formatLong_default = formatLong;
12332
-
12333
- // node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js
12334
- var formatRelativeLocale = {
12335
- lastWeek: "'last' eeee 'at' p",
12336
- yesterday: "'yesterday at' p",
12337
- today: "'today at' p",
12338
- tomorrow: "'tomorrow at' p",
12339
- nextWeek: "eeee 'at' p",
12340
- other: "P"
12341
- };
12342
- var formatRelative = function formatRelative2(token, _date, _baseDate, _options) {
12343
- return formatRelativeLocale[token];
12344
- };
12345
- var formatRelative_default = formatRelative;
12346
-
12347
- // node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js
12348
- function buildLocalizeFn(args) {
12349
- return function(dirtyIndex, options) {
12350
- var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone";
12351
- var valuesArray;
12352
- if (context === "formatting" && args.formattingValues) {
12353
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
12354
- var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
12355
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
12356
- } else {
12357
- var _defaultWidth = args.defaultWidth;
12358
- var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
12359
- valuesArray = args.values[_width] || args.values[_defaultWidth];
12360
- }
12361
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
12362
- return valuesArray[index];
12363
- };
12364
- }
12365
-
12366
- // node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js
12367
- var eraValues = {
12368
- narrow: ["B", "A"],
12369
- abbreviated: ["BC", "AD"],
12370
- wide: ["Before Christ", "Anno Domini"]
12371
- };
12372
- var quarterValues = {
12373
- narrow: ["1", "2", "3", "4"],
12374
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
12375
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
12376
- };
12377
- var monthValues = {
12378
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
12379
- abbreviated: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
12380
- wide: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
12381
- };
12382
- var dayValues = {
12383
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
12384
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
12385
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
12386
- wide: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
12387
- };
12388
- var dayPeriodValues = {
12389
- narrow: {
12390
- am: "a",
12391
- pm: "p",
12392
- midnight: "mi",
12393
- noon: "n",
12394
- morning: "morning",
12395
- afternoon: "afternoon",
12396
- evening: "evening",
12397
- night: "night"
12398
- },
12399
- abbreviated: {
12400
- am: "AM",
12401
- pm: "PM",
12402
- midnight: "midnight",
12403
- noon: "noon",
12404
- morning: "morning",
12405
- afternoon: "afternoon",
12406
- evening: "evening",
12407
- night: "night"
12408
- },
12409
- wide: {
12410
- am: "a.m.",
12411
- pm: "p.m.",
12412
- midnight: "midnight",
12413
- noon: "noon",
12414
- morning: "morning",
12415
- afternoon: "afternoon",
12416
- evening: "evening",
12417
- night: "night"
12418
- }
12419
- };
12420
- var formattingDayPeriodValues = {
12421
- narrow: {
12422
- am: "a",
12423
- pm: "p",
12424
- midnight: "mi",
12425
- noon: "n",
12426
- morning: "in the morning",
12427
- afternoon: "in the afternoon",
12428
- evening: "in the evening",
12429
- night: "at night"
12430
- },
12431
- abbreviated: {
12432
- am: "AM",
12433
- pm: "PM",
12434
- midnight: "midnight",
12435
- noon: "noon",
12436
- morning: "in the morning",
12437
- afternoon: "in the afternoon",
12438
- evening: "in the evening",
12439
- night: "at night"
12440
- },
12441
- wide: {
12442
- am: "a.m.",
12443
- pm: "p.m.",
12444
- midnight: "midnight",
12445
- noon: "noon",
12446
- morning: "in the morning",
12447
- afternoon: "in the afternoon",
12448
- evening: "in the evening",
12449
- night: "at night"
12450
- }
12451
- };
12452
- var ordinalNumber = function ordinalNumber2(dirtyNumber, _options) {
12453
- var number = Number(dirtyNumber);
12454
- var rem100 = number % 100;
12455
- if (rem100 > 20 || rem100 < 10) {
12456
- switch (rem100 % 10) {
12457
- case 1:
12458
- return number + "st";
12459
- case 2:
12460
- return number + "nd";
12461
- case 3:
12462
- return number + "rd";
12463
- }
12464
- }
12465
- return number + "th";
12466
- };
12467
- var localize = {
12468
- ordinalNumber,
12469
- era: buildLocalizeFn({
12470
- values: eraValues,
12471
- defaultWidth: "wide"
12472
- }),
12473
- quarter: buildLocalizeFn({
12474
- values: quarterValues,
12475
- defaultWidth: "wide",
12476
- argumentCallback: function argumentCallback(quarter) {
12477
- return quarter - 1;
12478
- }
12479
- }),
12480
- month: buildLocalizeFn({
12481
- values: monthValues,
12482
- defaultWidth: "wide"
12483
- }),
12484
- day: buildLocalizeFn({
12485
- values: dayValues,
12486
- defaultWidth: "wide"
12487
- }),
12488
- dayPeriod: buildLocalizeFn({
12489
- values: dayPeriodValues,
12490
- defaultWidth: "wide",
12491
- formattingValues: formattingDayPeriodValues,
12492
- defaultFormattingWidth: "wide"
12493
- })
12494
- };
12495
- var localize_default = localize;
12496
-
12497
- // node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js
12498
- function buildMatchFn(args) {
12499
- return function(string) {
12500
- var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
12501
- var width = options.width;
12502
- var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
12503
- var matchResult = string.match(matchPattern);
12504
- if (!matchResult) {
12505
- return null;
12506
- }
12507
- var matchedString = matchResult[0];
12508
- var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
12509
- var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function(pattern) {
12510
- return pattern.test(matchedString);
12511
- }) : findKey(parsePatterns, function(pattern) {
12512
- return pattern.test(matchedString);
12513
- });
12514
- var value;
12515
- value = args.valueCallback ? args.valueCallback(key) : key;
12516
- value = options.valueCallback ? options.valueCallback(value) : value;
12517
- var rest = string.slice(matchedString.length);
12518
- return {
12519
- value,
12520
- rest
12521
- };
12522
- };
12523
- }
12524
- function findKey(object, predicate) {
12525
- for (var key in object) {
12526
- if (object.hasOwnProperty(key) && predicate(object[key])) {
12527
- return key;
12528
- }
12529
- }
12530
- return void 0;
12531
- }
12532
- function findIndex(array, predicate) {
12533
- for (var key = 0; key < array.length; key++) {
12534
- if (predicate(array[key])) {
12535
- return key;
12536
- }
12537
- }
12538
- return void 0;
12539
- }
12540
-
12541
- // node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js
12542
- function buildMatchPatternFn(args) {
12543
- return function(string) {
12544
- var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
12545
- var matchResult = string.match(args.matchPattern);
12546
- if (!matchResult) return null;
12547
- var matchedString = matchResult[0];
12548
- var parseResult = string.match(args.parsePattern);
12549
- if (!parseResult) return null;
12550
- var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
12551
- value = options.valueCallback ? options.valueCallback(value) : value;
12552
- var rest = string.slice(matchedString.length);
12553
- return {
12554
- value,
12555
- rest
12556
- };
12557
- };
12558
- }
12559
-
12560
- // node_modules/date-fns/esm/locale/en-US/_lib/match/index.js
12561
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
12562
- var parseOrdinalNumberPattern = /\d+/i;
12563
- var matchEraPatterns = {
12564
- narrow: /^(b|a)/i,
12565
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
12566
- wide: /^(before christ|before common era|anno domini|common era)/i
12567
- };
12568
- var parseEraPatterns = {
12569
- any: [/^b/i, /^(a|c)/i]
12570
- };
12571
- var matchQuarterPatterns = {
12572
- narrow: /^[1234]/i,
12573
- abbreviated: /^q[1234]/i,
12574
- wide: /^[1234](th|st|nd|rd)? quarter/i
12575
- };
12576
- var parseQuarterPatterns = {
12577
- any: [/1/i, /2/i, /3/i, /4/i]
12578
- };
12579
- var matchMonthPatterns = {
12580
- narrow: /^[jfmasond]/i,
12581
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
12582
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
12583
- };
12584
- var parseMonthPatterns = {
12585
- narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
12586
- any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
12587
- };
12588
- var matchDayPatterns = {
12589
- narrow: /^[smtwf]/i,
12590
- short: /^(su|mo|tu|we|th|fr|sa)/i,
12591
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
12592
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
12593
- };
12594
- var parseDayPatterns = {
12595
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
12596
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
12597
- };
12598
- var matchDayPeriodPatterns = {
12599
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
12600
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
12601
- };
12602
- var parseDayPeriodPatterns = {
12603
- any: {
12604
- am: /^a/i,
12605
- pm: /^p/i,
12606
- midnight: /^mi/i,
12607
- noon: /^no/i,
12608
- morning: /morning/i,
12609
- afternoon: /afternoon/i,
12610
- evening: /evening/i,
12611
- night: /night/i
12612
- }
12613
- };
12614
- var match = {
12615
- ordinalNumber: buildMatchPatternFn({
12616
- matchPattern: matchOrdinalNumberPattern,
12617
- parsePattern: parseOrdinalNumberPattern,
12618
- valueCallback: function valueCallback(value) {
12619
- return parseInt(value, 10);
12620
- }
12621
- }),
12622
- era: buildMatchFn({
12623
- matchPatterns: matchEraPatterns,
12624
- defaultMatchWidth: "wide",
12625
- parsePatterns: parseEraPatterns,
12626
- defaultParseWidth: "any"
12627
- }),
12628
- quarter: buildMatchFn({
12629
- matchPatterns: matchQuarterPatterns,
12630
- defaultMatchWidth: "wide",
12631
- parsePatterns: parseQuarterPatterns,
12632
- defaultParseWidth: "any",
12633
- valueCallback: function valueCallback2(index) {
12634
- return index + 1;
12635
- }
12636
- }),
12637
- month: buildMatchFn({
12638
- matchPatterns: matchMonthPatterns,
12639
- defaultMatchWidth: "wide",
12640
- parsePatterns: parseMonthPatterns,
12641
- defaultParseWidth: "any"
12642
- }),
12643
- day: buildMatchFn({
12644
- matchPatterns: matchDayPatterns,
12645
- defaultMatchWidth: "wide",
12646
- parsePatterns: parseDayPatterns,
12647
- defaultParseWidth: "any"
12648
- }),
12649
- dayPeriod: buildMatchFn({
12650
- matchPatterns: matchDayPeriodPatterns,
12651
- defaultMatchWidth: "any",
12652
- parsePatterns: parseDayPeriodPatterns,
12653
- defaultParseWidth: "any"
12654
- })
12655
- };
12656
- var match_default = match;
12657
-
12658
- // node_modules/date-fns/esm/locale/en-US/index.js
12659
- var locale = {
12660
- code: "en-US",
12661
- formatDistance: formatDistance_default,
12662
- formatLong: formatLong_default,
12663
- formatRelative: formatRelative_default,
12664
- localize: localize_default,
12665
- match: match_default,
12666
- options: {
12667
- weekStartsOn: 0,
12668
- firstWeekContainsDate: 1
12669
- }
12670
- };
12671
- var en_US_default = locale;
12672
-
12673
- // node_modules/date-fns/esm/_lib/defaultLocale/index.js
12674
- var defaultLocale_default = en_US_default;
12675
-
12676
- // node_modules/date-fns/esm/format/index.js
12677
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
12678
- var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
12679
- var escapedStringRegExp = /^'([^]*?)'?$/;
12680
- var doubleQuoteRegExp = /''/g;
12681
- var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12682
- function format(dirtyDate, dirtyFormatStr, options) {
12683
- var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
12684
- requiredArgs(2, arguments);
12685
- var formatStr = String(dirtyFormatStr);
12686
- var defaultOptions2 = getDefaultOptions();
12687
- var locale2 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions2.locale) !== null && _ref !== void 0 ? _ref : defaultLocale_default;
12688
- var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions2.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
12689
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
12690
- throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
12691
- }
12692
- var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions2.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions2.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
12693
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
12694
- throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
12695
- }
12696
- if (!locale2.localize) {
12697
- throw new RangeError("locale must contain localize property");
12698
- }
12699
- if (!locale2.formatLong) {
12700
- throw new RangeError("locale must contain formatLong property");
12701
- }
12702
- var originalDate = toDate(dirtyDate);
12703
- if (!isValid(originalDate)) {
12704
- throw new RangeError("Invalid time value");
12705
- }
12706
- var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
12707
- var utcDate = subMilliseconds(originalDate, timezoneOffset);
12708
- var formatterOptions = {
12709
- firstWeekContainsDate,
12710
- weekStartsOn,
12711
- locale: locale2,
12712
- _originalDate: originalDate
12713
- };
12714
- var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) {
12715
- var firstCharacter = substring[0];
12716
- if (firstCharacter === "p" || firstCharacter === "P") {
12717
- var longFormatter = longFormatters_default[firstCharacter];
12718
- return longFormatter(substring, locale2.formatLong);
12719
- }
12720
- return substring;
12721
- }).join("").match(formattingTokensRegExp).map(function(substring) {
12722
- if (substring === "''") {
12723
- return "'";
12724
- }
12725
- var firstCharacter = substring[0];
12726
- if (firstCharacter === "'") {
12727
- return cleanEscapedString(substring);
12728
- }
12729
- var formatter = formatters_default[firstCharacter];
12730
- if (formatter) {
12731
- if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
12732
- throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
12733
- }
12734
- if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
12735
- throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
12736
- }
12737
- return formatter(utcDate, substring, locale2.localize, formatterOptions);
12738
- }
12739
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
12740
- throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
12741
- }
12742
- return substring;
12743
- }).join("");
12744
- return result;
12745
- }
12746
- function cleanEscapedString(input) {
12747
- var matched = input.match(escapedStringRegExp);
12748
- if (!matched) {
12749
- return input;
12750
- }
12751
- return matched[1].replace(doubleQuoteRegExp, "'");
12752
- }
12753
-
12754
11143
  // packages/ai/token/saveTokenRecord.ts
12755
11144
  var logger = createClientLogger("token-record");
12756
11145
  var createTokenRecord = (data, { cost, inputPrice, outputPrice } = {}) => ({
@@ -12798,7 +11187,7 @@ var resolveModelPrice = (model, usage) => {
12798
11187
  if (model.pricingStrategy?.type === "tiered_context") {
12799
11188
  const contextSize = usage.input_tokens || 0;
12800
11189
  const tiers = model.pricingStrategy.tiers || [];
12801
- const sortedTiers = [...tiers].sort((a3, b2) => a3.minContext - b2.minContext);
11190
+ const sortedTiers = [...tiers].sort((a, b) => a.minContext - b.minContext);
12802
11191
  for (const tier of sortedTiers) {
12803
11192
  if (contextSize >= tier.minContext) {
12804
11193
  activePrice = { ...tier.price };
@@ -13395,150 +11784,6 @@ var prepareTokenUsageData = ({
13395
11784
  };
13396
11785
  };
13397
11786
 
13398
- // packages/ai/token/applyTokenUsageToDayStats.ts
13399
- var ZERO_STATS = {
13400
- count: 0,
13401
- tokens: { input: 0, output: 0, cacheRead: 0, cacheCreation: 0 },
13402
- cost: 0,
13403
- failedCount: 0
13404
- };
13405
- function normalizeStats(s3) {
13406
- if (!s3) return { ...ZERO_STATS };
13407
- const t3 = s3.tokens;
13408
- return {
13409
- count: s3.count ?? 0,
13410
- tokens: {
13411
- input: t3?.input ?? 0,
13412
- output: t3?.output ?? 0,
13413
- cacheRead: t3?.cacheRead ?? t3?.cache_read ?? 0,
13414
- cacheCreation: t3?.cacheCreation ?? t3?.cache_creation ?? 0
13415
- },
13416
- cost: s3.cost ?? 0,
13417
- failedCount: s3.failedCount ?? 0
13418
- };
13419
- }
13420
- function normalizeDayStats(prev, userId, timeKey) {
13421
- if (!prev) {
13422
- return {
13423
- userId,
13424
- period: "day",
13425
- timeKey,
13426
- total: { ...ZERO_STATS },
13427
- models: {},
13428
- providers: {},
13429
- agents: {},
13430
- entryPaths: {},
13431
- categories: {},
13432
- modelCategories: {}
13433
- };
13434
- }
13435
- const normalizeMap = (m3) => {
13436
- if (!m3) return {};
13437
- const out = {};
13438
- for (const [k2, v] of Object.entries(m3)) out[k2] = normalizeStats(v);
13439
- return out;
13440
- };
13441
- const normalizedTotal = normalizeStats(prev.total);
13442
- const normalizedModels = normalizeMap(prev.models);
13443
- const normalizedProviders = normalizeMap(prev.providers);
13444
- const normalizedAgents = normalizeMap(prev.agents);
13445
- const normalizedEntryPaths = normalizeMap(prev.entryPaths);
13446
- let categories = normalizeMap(prev.categories);
13447
- let modelCategories = normalizeMap(prev.modelCategories);
13448
- const hasCategories = Object.keys(categories).length > 0;
13449
- const hasModelCategories = Object.keys(modelCategories).length > 0;
13450
- if (!hasCategories) {
13451
- const hasActivity = normalizedTotal.count > 0 || normalizedTotal.failedCount > 0 || normalizedTotal.cost > 0 || normalizedTotal.tokens.input > 0 || normalizedTotal.tokens.output > 0;
13452
- if (hasActivity) {
13453
- categories = { platform: { ...normalizedTotal } };
13454
- }
13455
- }
13456
- if (!hasModelCategories && Object.keys(normalizedModels).length > 0) {
13457
- const legacyModelCats = {};
13458
- for (const [modelKey, modelStat] of Object.entries(normalizedModels)) {
13459
- legacyModelCats[`${modelKey}:::platform`] = { ...modelStat };
13460
- }
13461
- modelCategories = legacyModelCats;
13462
- }
13463
- return {
13464
- ...prev,
13465
- total: normalizedTotal,
13466
- models: normalizedModels,
13467
- providers: normalizedProviders,
13468
- agents: normalizedAgents,
13469
- entryPaths: normalizedEntryPaths,
13470
- categories,
13471
- modelCategories
13472
- };
13473
- }
13474
- function applyTokenUsageToDayStats(prev, delta) {
13475
- const base = normalizeDayStats(prev, delta.userId, delta.timeKey);
13476
- const modelName = delta.model || "unknown";
13477
- const providerName = delta.provider || "unknown";
13478
- const cacheRead = delta.cache_read_input_tokens ?? 0;
13479
- const cacheCreation = delta.cache_creation_input_tokens ?? 0;
13480
- const isFailed = delta.status === "failed";
13481
- const category = delta.billingCategory || "platform";
13482
- const modelCategoryKey = `${modelName}:::${category}`;
13483
- const inc = (s3) => {
13484
- const n = normalizeStats(s3);
13485
- if (isFailed) {
13486
- return {
13487
- ...n,
13488
- failedCount: n.failedCount + 1
13489
- };
13490
- }
13491
- return {
13492
- count: n.count + 1,
13493
- tokens: {
13494
- input: n.tokens.input + delta.input_tokens,
13495
- output: n.tokens.output + delta.output_tokens,
13496
- cacheRead: n.tokens.cacheRead + cacheRead,
13497
- cacheCreation: n.tokens.cacheCreation + cacheCreation
13498
- },
13499
- // 非计费记录(订阅/OAuth/CLI,billable=false)不向平台积分统计贡献 cost:
13500
- // 订阅已付费、不按 token 计费,若不归零,图表「成本」视图会把订阅用量误显示为积分消耗。
13501
- cost: Number((n.cost + (category === "subscription" ? 0 : delta.cost)).toFixed(6)),
13502
- failedCount: n.failedCount
13503
- };
13504
- };
13505
- const result = {
13506
- ...base,
13507
- total: inc(base.total),
13508
- models: {
13509
- ...base.models,
13510
- [modelName]: inc(base.models[modelName])
13511
- },
13512
- providers: {
13513
- ...base.providers,
13514
- [providerName]: inc(base.providers[providerName])
13515
- },
13516
- categories: {
13517
- ...base.categories,
13518
- [category]: inc(base.categories?.[category])
13519
- },
13520
- modelCategories: {
13521
- ...base.modelCategories,
13522
- [modelCategoryKey]: inc(base.modelCategories?.[modelCategoryKey])
13523
- }
13524
- };
13525
- if (delta.agentId !== void 0) {
13526
- const agentKey = delta.agentId || "unknown";
13527
- result.agents = {
13528
- ...base.agents,
13529
- [agentKey]: inc(base.agents[agentKey])
13530
- };
13531
- }
13532
- if (delta.entry_path !== void 0) {
13533
- const entryKey = delta.entry_path || "unknown";
13534
- result.entryPaths = {
13535
- ...base.entryPaths,
13536
- [entryKey]: inc(base.entryPaths[entryKey])
13537
- };
13538
- }
13539
- return result;
13540
- }
13541
-
13542
11787
  // packages/core/keyedTaskQueue.ts
13543
11788
  var queues = /* @__PURE__ */ new Map();
13544
11789
  async function runKeyed(key, task) {
@@ -13579,7 +11824,7 @@ var queueDialogTokenPatch = async (dialogKey, task) => {
13579
11824
  };
13580
11825
  var updateStats = async (data, existingStats, key, thunkApi) => {
13581
11826
  try {
13582
- const dateKey = format(data.timestamp ?? Date.now(), "yyyy-MM-dd");
11827
+ const dateKey = (0, import_format.default)(data.timestamp ?? Date.now(), "yyyy-MM-dd");
13583
11828
  const newStats = applyTokenUsageToDayStats(existingStats, {
13584
11829
  userId: data.userId ?? "",
13585
11830
  timeKey: dateKey,
@@ -13612,7 +11857,7 @@ var updateStats = async (data, existingStats, key, thunkApi) => {
13612
11857
  }
13613
11858
  };
13614
11859
  var saveTokenUsage = async (data, thunkApi) => {
13615
- const dateKey = format(data.timestamp ?? Date.now(), "yyyy-MM-dd");
11860
+ const dateKey = (0, import_format.default)(data.timestamp ?? Date.now(), "yyyy-MM-dd");
13616
11861
  const tokenDayStatsKey = createTokenStatsKey(data.userId ?? "", dateKey);
13617
11862
  return runKeyed(tokenDayStatsKey, async () => {
13618
11863
  try {
@@ -13693,7 +11938,7 @@ var updateTokensAction = async ({ dialogId, dialogKey, usage: legacyUsage, usage
13693
11938
  ...tokenData,
13694
11939
  type: "token" /* TOKEN */,
13695
11940
  id: ulid(timestamp),
13696
- dateKey: format(timestamp, "yyyy-MM-dd"),
11941
+ dateKey: (0, import_format.default)(timestamp, "yyyy-MM-dd"),
13697
11942
  // Keep the same clock used for id/dateKey so record keys never see
13698
11943
  // undefined when a prepare helper omits timestamp.
13699
11944
  timestamp
@@ -13829,7 +12074,7 @@ var deleteOwnedDialogAttachments = async (args) => {
13829
12074
  metadataReadFailures
13830
12075
  });
13831
12076
  if (!plan.deleteCandidates.length) return plan;
13832
- const { deleteFileAction } = await import("./deleteFile-EPUQHKPA.js");
12077
+ const { deleteFileAction } = await import("./deleteFile-7VQGLK2V.js");
13833
12078
  for (const candidate of plan.deleteCandidates) {
13834
12079
  if (candidate.fileDbKey) {
13835
12080
  await deleteFileAction(candidate.fileDbKey, args.thunkApi);
@@ -13891,7 +12136,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
13891
12136
  }
13892
12137
  if (isCurrentDialog) {
13893
12138
  await thunkApi.dispatch(resetMsgs());
13894
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-ZWNNS7GZ.js");
12139
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-GRSVGDTF.js");
13895
12140
  dispatch(clearPendingAttachments2());
13896
12141
  }
13897
12142
  return { dialogKey, isCurrentDialog, attachmentPlan };
@@ -13899,39 +12144,39 @@ var deleteDialogThunk = async (payload, thunkApi) => {
13899
12144
 
13900
12145
  // packages/chat/dialog/dialogSlice.ts
13901
12146
  var runCreateDialogAction = async (args, thunkApi) => {
13902
- const { createDialogAction } = await import("./createDialogAction-TJ3JKLO4.js");
12147
+ const { createDialogAction } = await import("./createDialogAction-VQW5WDYX.js");
13903
12148
  return createDialogAction(args, thunkApi);
13904
12149
  };
13905
12150
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
13906
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-TI4QG4CY.js");
12151
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-ZC57YRSV.js");
13907
12152
  return createAgentAutomationAction(args, thunkApi);
13908
12153
  };
13909
12154
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
13910
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-MULWCJCW.js");
12155
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-U53ZT7PJ.js");
13911
12156
  return updateDialogTitleAction(args, thunkApi);
13912
12157
  };
13913
12158
  var runAddDialogAgentAction = async (args, thunkApi) => {
13914
- const { addDialogAgentAction } = await import("./addDialogAgentAction-KTYANUEC.js");
12159
+ const { addDialogAgentAction } = await import("./addDialogAgentAction-3NKVQCEC.js");
13915
12160
  return addDialogAgentAction(args, thunkApi);
13916
12161
  };
13917
12162
  var runRemoveDialogAgentAction = async (args, thunkApi) => {
13918
- const { removeDialogAgentAction } = await import("./removeDialogAgentAction-ALJDUJ2E.js");
12163
+ const { removeDialogAgentAction } = await import("./removeDialogAgentAction-FKL4BYMR.js");
13919
12164
  return removeDialogAgentAction(args, thunkApi);
13920
12165
  };
13921
12166
  var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
13922
- const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-HE7RVFFF.js");
12167
+ const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-2OLWRFYR.js");
13923
12168
  return setPrimaryDialogAgentAction(args, thunkApi);
13924
12169
  };
13925
12170
  var runSwitchDialogAgentAction = async (args, thunkApi) => {
13926
- const { switchDialogAgentAction } = await import("./switchDialogAgentAction-3VZS7SOS.js");
12171
+ const { switchDialogAgentAction } = await import("./switchDialogAgentAction-UZSAG2N5.js");
13927
12172
  return switchDialogAgentAction(args, thunkApi);
13928
12173
  };
13929
12174
  var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
13930
- const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-O3SVMD5A.js");
12175
+ const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-TLIOLWWI.js");
13931
12176
  return setDialogExtraReferencesAction(args, thunkApi);
13932
12177
  };
13933
12178
  var runHandleSendMessageAction = async (args, thunkApi) => {
13934
- const { handleSendMessageAction } = await import("./handleSendMessageAction-P27YP2DQ.js");
12179
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-SHIH74GJ.js");
13935
12180
  return handleSendMessageAction(args, thunkApi);
13936
12181
  };
13937
12182
  function clearDialogState() {
@@ -13944,7 +12189,7 @@ var createPageAndAddReference = createAsyncThunk(
13944
12189
  async (payload, { dispatch, getState, rejectWithValue }) => {
13945
12190
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
13946
12191
  try {
13947
- const { createDocState } = await import("./docStore-WYLRB7ED.js");
12192
+ const { createDocState } = await import("./docStore-KNZK6Y2G.js");
13948
12193
  const pageKey = await createDocState(
13949
12194
  { slateData, title },
13950
12195
  { dispatch, getState }
@@ -14153,9 +12398,7 @@ export {
14153
12398
  messageStreamEnd,
14154
12399
  addToolMessage,
14155
12400
  updateToolMessage,
14156
- format,
14157
12401
  prepareTokenUsageData,
14158
- applyTokenUsageToDayStats,
14159
12402
  runKeyed,
14160
12403
  updateTokensAction,
14161
12404
  clearDialogState,