@itssumitrai/fin-charter 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/README.md +96 -0
  2. package/dist/api/chart-api.d.ts +173 -0
  3. package/dist/api/export.d.ts +46 -0
  4. package/dist/api/indicator-api.d.ts +38 -0
  5. package/dist/api/options.d.ts +226 -0
  6. package/dist/api/pane-api.d.ts +28 -0
  7. package/dist/api/series-api.d.ts +115 -0
  8. package/dist/core/accessibility.d.ts +90 -0
  9. package/dist/core/alert-line.d.ts +49 -0
  10. package/dist/core/chart-state.d.ts +39 -0
  11. package/dist/core/chart-sync.d.ts +83 -0
  12. package/dist/core/crosshair.d.ts +28 -0
  13. package/dist/core/css-theme.d.ts +41 -0
  14. package/dist/core/custom-indicator.d.ts +70 -0
  15. package/dist/core/data-feed.d.ts +59 -0
  16. package/dist/core/data-layer.d.ts +38 -0
  17. package/dist/core/invalidation.d.ts +24 -0
  18. package/dist/core/market-session.d.ts +11 -0
  19. package/dist/core/order-line.d.ts +134 -0
  20. package/dist/core/pane-divider.d.ts +22 -0
  21. package/dist/core/pane.d.ts +32 -0
  22. package/dist/core/periodicity.d.ts +6 -0
  23. package/dist/core/plugin.d.ts +90 -0
  24. package/dist/core/price-line.d.ts +17 -0
  25. package/dist/core/price-scale.d.ts +74 -0
  26. package/dist/core/replay.d.ts +73 -0
  27. package/dist/core/rtl.d.ts +22 -0
  28. package/dist/core/segment-tree.d.ts +38 -0
  29. package/dist/core/series-markers.d.ts +18 -0
  30. package/dist/core/storage-adapter.d.ts +50 -0
  31. package/dist/core/streaming-adapter.d.ts +102 -0
  32. package/dist/core/symbol-resolver.d.ts +32 -0
  33. package/dist/core/text-label.d.ts +72 -0
  34. package/dist/core/time-scale.d.ts +109 -0
  35. package/dist/core/types.d.ts +144 -0
  36. package/dist/core/undo-redo.d.ts +46 -0
  37. package/dist/currency/currency.d.ts +8 -0
  38. package/dist/currency/index.d.ts +2 -0
  39. package/dist/drawings/arrow.d.ts +10 -0
  40. package/dist/drawings/base.d.ts +79 -0
  41. package/dist/drawings/channel.d.ts +10 -0
  42. package/dist/drawings/crossline.d.ts +10 -0
  43. package/dist/drawings/ellipse.d.ts +10 -0
  44. package/dist/drawings/fib-arc.d.ts +10 -0
  45. package/dist/drawings/fib-fan.d.ts +12 -0
  46. package/dist/drawings/fib-projection.d.ts +11 -0
  47. package/dist/drawings/fibonacci.d.ts +11 -0
  48. package/dist/drawings/horizontal-line.d.ts +10 -0
  49. package/dist/drawings/index.d.ts +7 -0
  50. package/dist/drawings/measurement.d.ts +11 -0
  51. package/dist/drawings/pitchfork.d.ts +12 -0
  52. package/dist/drawings/ray.d.ts +12 -0
  53. package/dist/drawings/rectangle.d.ts +10 -0
  54. package/dist/drawings/text-annotation.d.ts +11 -0
  55. package/dist/drawings/trendline.d.ts +10 -0
  56. package/dist/drawings/vertical-line.d.ts +10 -0
  57. package/dist/formatting/index.d.ts +5 -0
  58. package/dist/formatting/price-formatter.d.ts +6 -0
  59. package/dist/formatting/time-formatter.d.ts +7 -0
  60. package/dist/formatting/volume-formatter.d.ts +1 -0
  61. package/dist/i18n/i18n.d.ts +6 -0
  62. package/dist/i18n/index.d.ts +3 -0
  63. package/dist/i18n/locales/en.d.ts +3 -0
  64. package/dist/index.d.ts +63 -0
  65. package/dist/index.js +2 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/index10.js +2 -0
  68. package/dist/index10.js.map +1 -0
  69. package/dist/index100.js +2 -0
  70. package/dist/index100.js.map +1 -0
  71. package/dist/index101.js +2 -0
  72. package/dist/index101.js.map +1 -0
  73. package/dist/index102.js +2 -0
  74. package/dist/index102.js.map +1 -0
  75. package/dist/index103.js +2 -0
  76. package/dist/index103.js.map +1 -0
  77. package/dist/index104.js +2 -0
  78. package/dist/index104.js.map +1 -0
  79. package/dist/index105.js +2 -0
  80. package/dist/index105.js.map +1 -0
  81. package/dist/index106.js +2 -0
  82. package/dist/index106.js.map +1 -0
  83. package/dist/index107.js +2 -0
  84. package/dist/index107.js.map +1 -0
  85. package/dist/index108.js +2 -0
  86. package/dist/index108.js.map +1 -0
  87. package/dist/index109.js +2 -0
  88. package/dist/index109.js.map +1 -0
  89. package/dist/index11.js +2 -0
  90. package/dist/index11.js.map +1 -0
  91. package/dist/index110.js +2 -0
  92. package/dist/index110.js.map +1 -0
  93. package/dist/index111.js +2 -0
  94. package/dist/index111.js.map +1 -0
  95. package/dist/index112.js +2 -0
  96. package/dist/index112.js.map +1 -0
  97. package/dist/index113.js +2 -0
  98. package/dist/index113.js.map +1 -0
  99. package/dist/index114.js +2 -0
  100. package/dist/index114.js.map +1 -0
  101. package/dist/index115.js +2 -0
  102. package/dist/index115.js.map +1 -0
  103. package/dist/index116.js +2 -0
  104. package/dist/index116.js.map +1 -0
  105. package/dist/index117.js +2 -0
  106. package/dist/index117.js.map +1 -0
  107. package/dist/index118.js +2 -0
  108. package/dist/index118.js.map +1 -0
  109. package/dist/index119.js +2 -0
  110. package/dist/index119.js.map +1 -0
  111. package/dist/index12.js +2 -0
  112. package/dist/index12.js.map +1 -0
  113. package/dist/index120.js +2 -0
  114. package/dist/index120.js.map +1 -0
  115. package/dist/index121.js +2 -0
  116. package/dist/index121.js.map +1 -0
  117. package/dist/index122.js +2 -0
  118. package/dist/index122.js.map +1 -0
  119. package/dist/index123.js +2 -0
  120. package/dist/index123.js.map +1 -0
  121. package/dist/index124.js +2 -0
  122. package/dist/index124.js.map +1 -0
  123. package/dist/index13.js +2 -0
  124. package/dist/index13.js.map +1 -0
  125. package/dist/index14.js +2 -0
  126. package/dist/index14.js.map +1 -0
  127. package/dist/index15.js +2 -0
  128. package/dist/index15.js.map +1 -0
  129. package/dist/index16.js +2 -0
  130. package/dist/index16.js.map +1 -0
  131. package/dist/index17.js +2 -0
  132. package/dist/index17.js.map +1 -0
  133. package/dist/index18.js +2 -0
  134. package/dist/index18.js.map +1 -0
  135. package/dist/index19.js +2 -0
  136. package/dist/index19.js.map +1 -0
  137. package/dist/index2.js +2 -0
  138. package/dist/index2.js.map +1 -0
  139. package/dist/index20.js +2 -0
  140. package/dist/index20.js.map +1 -0
  141. package/dist/index21.js +2 -0
  142. package/dist/index21.js.map +1 -0
  143. package/dist/index22.js +2 -0
  144. package/dist/index22.js.map +1 -0
  145. package/dist/index23.js +2 -0
  146. package/dist/index23.js.map +1 -0
  147. package/dist/index24.js +2 -0
  148. package/dist/index24.js.map +1 -0
  149. package/dist/index25.js +2 -0
  150. package/dist/index25.js.map +1 -0
  151. package/dist/index26.js +2 -0
  152. package/dist/index26.js.map +1 -0
  153. package/dist/index27.js +2 -0
  154. package/dist/index27.js.map +1 -0
  155. package/dist/index28.js +2 -0
  156. package/dist/index28.js.map +1 -0
  157. package/dist/index29.js +2 -0
  158. package/dist/index29.js.map +1 -0
  159. package/dist/index3.js +2 -0
  160. package/dist/index3.js.map +1 -0
  161. package/dist/index30.js +2 -0
  162. package/dist/index30.js.map +1 -0
  163. package/dist/index31.js +2 -0
  164. package/dist/index31.js.map +1 -0
  165. package/dist/index32.js +2 -0
  166. package/dist/index32.js.map +1 -0
  167. package/dist/index33.js +2 -0
  168. package/dist/index33.js.map +1 -0
  169. package/dist/index34.js +2 -0
  170. package/dist/index34.js.map +1 -0
  171. package/dist/index35.js +2 -0
  172. package/dist/index35.js.map +1 -0
  173. package/dist/index36.js +2 -0
  174. package/dist/index36.js.map +1 -0
  175. package/dist/index37.js +2 -0
  176. package/dist/index37.js.map +1 -0
  177. package/dist/index38.js +2 -0
  178. package/dist/index38.js.map +1 -0
  179. package/dist/index39.js +2 -0
  180. package/dist/index39.js.map +1 -0
  181. package/dist/index4.js +2 -0
  182. package/dist/index4.js.map +1 -0
  183. package/dist/index40.js +2 -0
  184. package/dist/index40.js.map +1 -0
  185. package/dist/index41.js +2 -0
  186. package/dist/index41.js.map +1 -0
  187. package/dist/index42.js +2 -0
  188. package/dist/index42.js.map +1 -0
  189. package/dist/index43.js +2 -0
  190. package/dist/index43.js.map +1 -0
  191. package/dist/index44.js +2 -0
  192. package/dist/index44.js.map +1 -0
  193. package/dist/index45.js +2 -0
  194. package/dist/index45.js.map +1 -0
  195. package/dist/index46.js +2 -0
  196. package/dist/index46.js.map +1 -0
  197. package/dist/index47.js +2 -0
  198. package/dist/index47.js.map +1 -0
  199. package/dist/index48.js +2 -0
  200. package/dist/index48.js.map +1 -0
  201. package/dist/index49.js +2 -0
  202. package/dist/index49.js.map +1 -0
  203. package/dist/index5.js +2 -0
  204. package/dist/index5.js.map +1 -0
  205. package/dist/index50.js +2 -0
  206. package/dist/index50.js.map +1 -0
  207. package/dist/index51.js +2 -0
  208. package/dist/index51.js.map +1 -0
  209. package/dist/index52.js +2 -0
  210. package/dist/index52.js.map +1 -0
  211. package/dist/index53.js +2 -0
  212. package/dist/index53.js.map +1 -0
  213. package/dist/index54.js +2 -0
  214. package/dist/index54.js.map +1 -0
  215. package/dist/index55.js +2 -0
  216. package/dist/index55.js.map +1 -0
  217. package/dist/index56.js +2 -0
  218. package/dist/index56.js.map +1 -0
  219. package/dist/index57.js +2 -0
  220. package/dist/index57.js.map +1 -0
  221. package/dist/index58.js +2 -0
  222. package/dist/index58.js.map +1 -0
  223. package/dist/index59.js +2 -0
  224. package/dist/index59.js.map +1 -0
  225. package/dist/index6.js +2 -0
  226. package/dist/index6.js.map +1 -0
  227. package/dist/index60.js +2 -0
  228. package/dist/index60.js.map +1 -0
  229. package/dist/index61.js +2 -0
  230. package/dist/index61.js.map +1 -0
  231. package/dist/index62.js +2 -0
  232. package/dist/index62.js.map +1 -0
  233. package/dist/index63.js +2 -0
  234. package/dist/index63.js.map +1 -0
  235. package/dist/index64.js +2 -0
  236. package/dist/index64.js.map +1 -0
  237. package/dist/index65.js +3 -0
  238. package/dist/index65.js.map +1 -0
  239. package/dist/index66.js +2 -0
  240. package/dist/index66.js.map +1 -0
  241. package/dist/index67.js +2 -0
  242. package/dist/index67.js.map +1 -0
  243. package/dist/index68.js +2 -0
  244. package/dist/index68.js.map +1 -0
  245. package/dist/index69.js +2 -0
  246. package/dist/index69.js.map +1 -0
  247. package/dist/index7.js +2 -0
  248. package/dist/index7.js.map +1 -0
  249. package/dist/index70.js +2 -0
  250. package/dist/index70.js.map +1 -0
  251. package/dist/index71.js +2 -0
  252. package/dist/index71.js.map +1 -0
  253. package/dist/index72.js +2 -0
  254. package/dist/index72.js.map +1 -0
  255. package/dist/index73.js +2 -0
  256. package/dist/index73.js.map +1 -0
  257. package/dist/index74.js +2 -0
  258. package/dist/index74.js.map +1 -0
  259. package/dist/index75.js +2 -0
  260. package/dist/index75.js.map +1 -0
  261. package/dist/index76.js +2 -0
  262. package/dist/index76.js.map +1 -0
  263. package/dist/index77.js +2 -0
  264. package/dist/index77.js.map +1 -0
  265. package/dist/index78.js +2 -0
  266. package/dist/index78.js.map +1 -0
  267. package/dist/index79.js +2 -0
  268. package/dist/index79.js.map +1 -0
  269. package/dist/index8.js +2 -0
  270. package/dist/index8.js.map +1 -0
  271. package/dist/index80.js +2 -0
  272. package/dist/index80.js.map +1 -0
  273. package/dist/index81.js +2 -0
  274. package/dist/index81.js.map +1 -0
  275. package/dist/index82.js +2 -0
  276. package/dist/index82.js.map +1 -0
  277. package/dist/index83.js +2 -0
  278. package/dist/index83.js.map +1 -0
  279. package/dist/index84.js +2 -0
  280. package/dist/index84.js.map +1 -0
  281. package/dist/index85.js +2 -0
  282. package/dist/index85.js.map +1 -0
  283. package/dist/index86.js +2 -0
  284. package/dist/index86.js.map +1 -0
  285. package/dist/index87.js +2 -0
  286. package/dist/index87.js.map +1 -0
  287. package/dist/index88.js +2 -0
  288. package/dist/index88.js.map +1 -0
  289. package/dist/index89.js +2 -0
  290. package/dist/index89.js.map +1 -0
  291. package/dist/index9.js +2 -0
  292. package/dist/index9.js.map +1 -0
  293. package/dist/index90.js +2 -0
  294. package/dist/index90.js.map +1 -0
  295. package/dist/index91.js +2 -0
  296. package/dist/index91.js.map +1 -0
  297. package/dist/index92.js +2 -0
  298. package/dist/index92.js.map +1 -0
  299. package/dist/index93.js +2 -0
  300. package/dist/index93.js.map +1 -0
  301. package/dist/index94.js +2 -0
  302. package/dist/index94.js.map +1 -0
  303. package/dist/index95.js +2 -0
  304. package/dist/index95.js.map +1 -0
  305. package/dist/index96.js +2 -0
  306. package/dist/index96.js.map +1 -0
  307. package/dist/index97.js +2 -0
  308. package/dist/index97.js.map +1 -0
  309. package/dist/index98.js +2 -0
  310. package/dist/index98.js.map +1 -0
  311. package/dist/index99.js +2 -0
  312. package/dist/index99.js.map +1 -0
  313. package/dist/indicators/adx.d.ts +6 -0
  314. package/dist/indicators/aroon.d.ts +5 -0
  315. package/dist/indicators/atr.d.ts +1 -0
  316. package/dist/indicators/awesome-oscillator.d.ts +1 -0
  317. package/dist/indicators/bollinger.d.ts +6 -0
  318. package/dist/indicators/cci.d.ts +1 -0
  319. package/dist/indicators/chaikin-mf.d.ts +1 -0
  320. package/dist/indicators/choppiness.d.ts +1 -0
  321. package/dist/indicators/coppock.d.ts +1 -0
  322. package/dist/indicators/donchian.d.ts +6 -0
  323. package/dist/indicators/elder-force.d.ts +1 -0
  324. package/dist/indicators/ema.d.ts +1 -0
  325. package/dist/indicators/ichimoku.d.ts +8 -0
  326. package/dist/indicators/index.d.ts +31 -0
  327. package/dist/indicators/keltner.d.ts +6 -0
  328. package/dist/indicators/linear-regression.d.ts +1 -0
  329. package/dist/indicators/macd.d.ts +6 -0
  330. package/dist/indicators/mfi.d.ts +1 -0
  331. package/dist/indicators/obv.d.ts +1 -0
  332. package/dist/indicators/parabolic-sar.d.ts +1 -0
  333. package/dist/indicators/pivot-points.d.ts +10 -0
  334. package/dist/indicators/roc.d.ts +1 -0
  335. package/dist/indicators/rsi.d.ts +1 -0
  336. package/dist/indicators/sma.d.ts +1 -0
  337. package/dist/indicators/stochastic.d.ts +5 -0
  338. package/dist/indicators/supertrend.d.ts +5 -0
  339. package/dist/indicators/trix.d.ts +5 -0
  340. package/dist/indicators/utils.d.ts +20 -0
  341. package/dist/indicators/volume-profile.d.ts +37 -0
  342. package/dist/indicators/volume.d.ts +1 -0
  343. package/dist/indicators/vwap.d.ts +1 -0
  344. package/dist/indicators/vwma.d.ts +1 -0
  345. package/dist/indicators/williams-r.d.ts +1 -0
  346. package/dist/interactions/axis-drag.d.ts +24 -0
  347. package/dist/interactions/context-menu-handler.d.ts +42 -0
  348. package/dist/interactions/crosshair.d.ts +20 -0
  349. package/dist/interactions/drawing-handler.d.ts +39 -0
  350. package/dist/interactions/event-router.d.ts +37 -0
  351. package/dist/interactions/keyboard-nav.d.ts +11 -0
  352. package/dist/interactions/pan-zoom.d.ts +39 -0
  353. package/dist/interactions/range-selection.d.ts +103 -0
  354. package/dist/interactions/touch-gestures.d.ts +36 -0
  355. package/dist/logo.svg +40 -0
  356. package/dist/market/exchange-map.d.ts +3 -0
  357. package/dist/market/index.d.ts +4 -0
  358. package/dist/market/market-calendar.d.ts +4 -0
  359. package/dist/market/market-definition.d.ts +22 -0
  360. package/dist/mockServiceWorker.js +349 -0
  361. package/dist/renderers/area.d.ts +17 -0
  362. package/dist/renderers/bar-ohlc.d.ts +17 -0
  363. package/dist/renderers/baseline-delta-mountain.d.ts +22 -0
  364. package/dist/renderers/baseline.d.ts +19 -0
  365. package/dist/renderers/candlestick.d.ts +21 -0
  366. package/dist/renderers/canvas-renderer.d.ts +28 -0
  367. package/dist/renderers/colored-line.d.ts +15 -0
  368. package/dist/renderers/colored-mountain.d.ts +18 -0
  369. package/dist/renderers/column.d.ts +14 -0
  370. package/dist/renderers/high-low.d.ts +14 -0
  371. package/dist/renderers/histogram.d.ts +16 -0
  372. package/dist/renderers/hlc-area.d.ts +16 -0
  373. package/dist/renderers/hollow-candle.d.ts +18 -0
  374. package/dist/renderers/kagi.d.ts +22 -0
  375. package/dist/renderers/line-break.d.ts +20 -0
  376. package/dist/renderers/line.d.ts +17 -0
  377. package/dist/renderers/point-figure.d.ts +20 -0
  378. package/dist/renderers/renderer.d.ts +59 -0
  379. package/dist/renderers/renko.d.ts +24 -0
  380. package/dist/renderers/step-line.d.ts +14 -0
  381. package/dist/renderers/text-cache.d.ts +23 -0
  382. package/dist/renderers/volume-candle.d.ts +20 -0
  383. package/dist/renderers/webgl/area-webgl.d.ts +28 -0
  384. package/dist/renderers/webgl/candlestick-webgl.d.ts +30 -0
  385. package/dist/renderers/webgl/index.d.ts +7 -0
  386. package/dist/renderers/webgl/line-webgl.d.ts +23 -0
  387. package/dist/renderers/webgl/webgl-utils.d.ts +23 -0
  388. package/dist/timezone/index.d.ts +2 -0
  389. package/dist/timezone/timezone.d.ts +12 -0
  390. package/dist/transforms/aggregate.d.ts +2 -0
  391. package/dist/transforms/heikin-ashi.d.ts +2 -0
  392. package/dist/transforms/index.d.ts +2 -0
  393. package/dist/ui/context-menu.d.ts +14 -0
  394. package/dist/ui/hud.d.ts +43 -0
  395. package/dist/ui/settings-popup.d.ts +15 -0
  396. package/package.json +129 -0
@@ -0,0 +1,349 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+
4
+ /**
5
+ * Mock Service Worker.
6
+ * @see https://github.com/mswjs/msw
7
+ * - Please do NOT modify this file.
8
+ */
9
+
10
+ const PACKAGE_VERSION = '2.12.14'
11
+ const INTEGRITY_CHECKSUM = '4db4a41e972cec1b64cc569c66952d82'
12
+ const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
13
+ const activeClientIds = new Set()
14
+
15
+ addEventListener('install', function () {
16
+ self.skipWaiting()
17
+ })
18
+
19
+ addEventListener('activate', function (event) {
20
+ event.waitUntil(self.clients.claim())
21
+ })
22
+
23
+ addEventListener('message', async function (event) {
24
+ const clientId = Reflect.get(event.source || {}, 'id')
25
+
26
+ if (!clientId || !self.clients) {
27
+ return
28
+ }
29
+
30
+ const client = await self.clients.get(clientId)
31
+
32
+ if (!client) {
33
+ return
34
+ }
35
+
36
+ const allClients = await self.clients.matchAll({
37
+ type: 'window',
38
+ })
39
+
40
+ switch (event.data) {
41
+ case 'KEEPALIVE_REQUEST': {
42
+ sendToClient(client, {
43
+ type: 'KEEPALIVE_RESPONSE',
44
+ })
45
+ break
46
+ }
47
+
48
+ case 'INTEGRITY_CHECK_REQUEST': {
49
+ sendToClient(client, {
50
+ type: 'INTEGRITY_CHECK_RESPONSE',
51
+ payload: {
52
+ packageVersion: PACKAGE_VERSION,
53
+ checksum: INTEGRITY_CHECKSUM,
54
+ },
55
+ })
56
+ break
57
+ }
58
+
59
+ case 'MOCK_ACTIVATE': {
60
+ activeClientIds.add(clientId)
61
+
62
+ sendToClient(client, {
63
+ type: 'MOCKING_ENABLED',
64
+ payload: {
65
+ client: {
66
+ id: client.id,
67
+ frameType: client.frameType,
68
+ },
69
+ },
70
+ })
71
+ break
72
+ }
73
+
74
+ case 'CLIENT_CLOSED': {
75
+ activeClientIds.delete(clientId)
76
+
77
+ const remainingClients = allClients.filter((client) => {
78
+ return client.id !== clientId
79
+ })
80
+
81
+ // Unregister itself when there are no more clients
82
+ if (remainingClients.length === 0) {
83
+ self.registration.unregister()
84
+ }
85
+
86
+ break
87
+ }
88
+ }
89
+ })
90
+
91
+ addEventListener('fetch', function (event) {
92
+ const requestInterceptedAt = Date.now()
93
+
94
+ // Bypass navigation requests.
95
+ if (event.request.mode === 'navigate') {
96
+ return
97
+ }
98
+
99
+ // Opening the DevTools triggers the "only-if-cached" request
100
+ // that cannot be handled by the worker. Bypass such requests.
101
+ if (
102
+ event.request.cache === 'only-if-cached' &&
103
+ event.request.mode !== 'same-origin'
104
+ ) {
105
+ return
106
+ }
107
+
108
+ // Bypass all requests when there are no active clients.
109
+ // Prevents the self-unregistered worked from handling requests
110
+ // after it's been terminated (still remains active until the next reload).
111
+ if (activeClientIds.size === 0) {
112
+ return
113
+ }
114
+
115
+ const requestId = crypto.randomUUID()
116
+ event.respondWith(handleRequest(event, requestId, requestInterceptedAt))
117
+ })
118
+
119
+ /**
120
+ * @param {FetchEvent} event
121
+ * @param {string} requestId
122
+ * @param {number} requestInterceptedAt
123
+ */
124
+ async function handleRequest(event, requestId, requestInterceptedAt) {
125
+ const client = await resolveMainClient(event)
126
+ const requestCloneForEvents = event.request.clone()
127
+ const response = await getResponse(
128
+ event,
129
+ client,
130
+ requestId,
131
+ requestInterceptedAt,
132
+ )
133
+
134
+ // Send back the response clone for the "response:*" life-cycle events.
135
+ // Ensure MSW is active and ready to handle the message, otherwise
136
+ // this message will pend indefinitely.
137
+ if (client && activeClientIds.has(client.id)) {
138
+ const serializedRequest = await serializeRequest(requestCloneForEvents)
139
+
140
+ // Clone the response so both the client and the library could consume it.
141
+ const responseClone = response.clone()
142
+
143
+ sendToClient(
144
+ client,
145
+ {
146
+ type: 'RESPONSE',
147
+ payload: {
148
+ isMockedResponse: IS_MOCKED_RESPONSE in response,
149
+ request: {
150
+ id: requestId,
151
+ ...serializedRequest,
152
+ },
153
+ response: {
154
+ type: responseClone.type,
155
+ status: responseClone.status,
156
+ statusText: responseClone.statusText,
157
+ headers: Object.fromEntries(responseClone.headers.entries()),
158
+ body: responseClone.body,
159
+ },
160
+ },
161
+ },
162
+ responseClone.body ? [serializedRequest.body, responseClone.body] : [],
163
+ )
164
+ }
165
+
166
+ return response
167
+ }
168
+
169
+ /**
170
+ * Resolve the main client for the given event.
171
+ * Client that issues a request doesn't necessarily equal the client
172
+ * that registered the worker. It's with the latter the worker should
173
+ * communicate with during the response resolving phase.
174
+ * @param {FetchEvent} event
175
+ * @returns {Promise<Client | undefined>}
176
+ */
177
+ async function resolveMainClient(event) {
178
+ const client = await self.clients.get(event.clientId)
179
+
180
+ if (activeClientIds.has(event.clientId)) {
181
+ return client
182
+ }
183
+
184
+ if (client?.frameType === 'top-level') {
185
+ return client
186
+ }
187
+
188
+ const allClients = await self.clients.matchAll({
189
+ type: 'window',
190
+ })
191
+
192
+ return allClients
193
+ .filter((client) => {
194
+ // Get only those clients that are currently visible.
195
+ return client.visibilityState === 'visible'
196
+ })
197
+ .find((client) => {
198
+ // Find the client ID that's recorded in the
199
+ // set of clients that have registered the worker.
200
+ return activeClientIds.has(client.id)
201
+ })
202
+ }
203
+
204
+ /**
205
+ * @param {FetchEvent} event
206
+ * @param {Client | undefined} client
207
+ * @param {string} requestId
208
+ * @param {number} requestInterceptedAt
209
+ * @returns {Promise<Response>}
210
+ */
211
+ async function getResponse(event, client, requestId, requestInterceptedAt) {
212
+ // Clone the request because it might've been already used
213
+ // (i.e. its body has been read and sent to the client).
214
+ const requestClone = event.request.clone()
215
+
216
+ function passthrough() {
217
+ // Cast the request headers to a new Headers instance
218
+ // so the headers can be manipulated with.
219
+ const headers = new Headers(requestClone.headers)
220
+
221
+ // Remove the "accept" header value that marked this request as passthrough.
222
+ // This prevents request alteration and also keeps it compliant with the
223
+ // user-defined CORS policies.
224
+ const acceptHeader = headers.get('accept')
225
+ if (acceptHeader) {
226
+ const values = acceptHeader.split(',').map((value) => value.trim())
227
+ const filteredValues = values.filter(
228
+ (value) => value !== 'msw/passthrough',
229
+ )
230
+
231
+ if (filteredValues.length > 0) {
232
+ headers.set('accept', filteredValues.join(', '))
233
+ } else {
234
+ headers.delete('accept')
235
+ }
236
+ }
237
+
238
+ return fetch(requestClone, { headers })
239
+ }
240
+
241
+ // Bypass mocking when the client is not active.
242
+ if (!client) {
243
+ return passthrough()
244
+ }
245
+
246
+ // Bypass initial page load requests (i.e. static assets).
247
+ // The absence of the immediate/parent client in the map of the active clients
248
+ // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
249
+ // and is not ready to handle requests.
250
+ if (!activeClientIds.has(client.id)) {
251
+ return passthrough()
252
+ }
253
+
254
+ // Notify the client that a request has been intercepted.
255
+ const serializedRequest = await serializeRequest(event.request)
256
+ const clientMessage = await sendToClient(
257
+ client,
258
+ {
259
+ type: 'REQUEST',
260
+ payload: {
261
+ id: requestId,
262
+ interceptedAt: requestInterceptedAt,
263
+ ...serializedRequest,
264
+ },
265
+ },
266
+ [serializedRequest.body],
267
+ )
268
+
269
+ switch (clientMessage.type) {
270
+ case 'MOCK_RESPONSE': {
271
+ return respondWithMock(clientMessage.data)
272
+ }
273
+
274
+ case 'PASSTHROUGH': {
275
+ return passthrough()
276
+ }
277
+ }
278
+
279
+ return passthrough()
280
+ }
281
+
282
+ /**
283
+ * @param {Client} client
284
+ * @param {any} message
285
+ * @param {Array<Transferable>} transferrables
286
+ * @returns {Promise<any>}
287
+ */
288
+ function sendToClient(client, message, transferrables = []) {
289
+ return new Promise((resolve, reject) => {
290
+ const channel = new MessageChannel()
291
+
292
+ channel.port1.onmessage = (event) => {
293
+ if (event.data && event.data.error) {
294
+ return reject(event.data.error)
295
+ }
296
+
297
+ resolve(event.data)
298
+ }
299
+
300
+ client.postMessage(message, [
301
+ channel.port2,
302
+ ...transferrables.filter(Boolean),
303
+ ])
304
+ })
305
+ }
306
+
307
+ /**
308
+ * @param {Response} response
309
+ * @returns {Response}
310
+ */
311
+ function respondWithMock(response) {
312
+ // Setting response status code to 0 is a no-op.
313
+ // However, when responding with a "Response.error()", the produced Response
314
+ // instance will have status code set to 0. Since it's not possible to create
315
+ // a Response instance with status code 0, handle that use-case separately.
316
+ if (response.status === 0) {
317
+ return Response.error()
318
+ }
319
+
320
+ const mockedResponse = new Response(response.body, response)
321
+
322
+ Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
323
+ value: true,
324
+ enumerable: true,
325
+ })
326
+
327
+ return mockedResponse
328
+ }
329
+
330
+ /**
331
+ * @param {Request} request
332
+ */
333
+ async function serializeRequest(request) {
334
+ return {
335
+ url: request.url,
336
+ mode: request.mode,
337
+ method: request.method,
338
+ headers: Object.fromEntries(request.headers.entries()),
339
+ cache: request.cache,
340
+ credentials: request.credentials,
341
+ destination: request.destination,
342
+ integrity: request.integrity,
343
+ redirect: request.redirect,
344
+ referrer: request.referrer,
345
+ referrerPolicy: request.referrerPolicy,
346
+ body: await request.arrayBuffer(),
347
+ keepalive: request.keepalive,
348
+ }
349
+ }
@@ -0,0 +1,17 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface AreaRendererOptions {
3
+ lineColor: string;
4
+ lineWidth: number;
5
+ topColor: string;
6
+ bottomColor: string;
7
+ }
8
+ /**
9
+ * AreaRenderer — draws a close-price line with a gradient fill from the line
10
+ * down to the bottom of the pane.
11
+ */
12
+ export declare class AreaRenderer {
13
+ private _options;
14
+ applyOptions(options: Partial<AreaRendererOptions>): void;
15
+ options(): AreaRendererOptions;
16
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number): void;
17
+ }
@@ -0,0 +1,17 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface BarOHLCRendererOptions {
3
+ upColor: string;
4
+ downColor: string;
5
+ lineWidth: number;
6
+ }
7
+ /**
8
+ * BarOHLCRenderer — draws traditional OHLC bar charts:
9
+ * - Vertical line from high to low
10
+ * - Left horizontal tick for open
11
+ * - Right horizontal tick for close
12
+ */
13
+ export declare class BarOHLCRenderer {
14
+ private _options;
15
+ applyOptions(options: Partial<BarOHLCRendererOptions>): void;
16
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number, barWidth: number): void;
17
+ }
@@ -0,0 +1,22 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface BaselineDeltaMountainRendererOptions {
3
+ basePrice: number;
4
+ topLineColor: string;
5
+ topFillColor: string;
6
+ bottomLineColor: string;
7
+ bottomFillColor: string;
8
+ lineWidth: number;
9
+ }
10
+ /**
11
+ * BaselineDeltaMountainRenderer — like BaselineRenderer but with solid gradient
12
+ * fills instead of flat semi-transparent colour.
13
+ *
14
+ * Above baseline: gradient from topFillColor (at the line) fading to transparent
15
+ * at the baseline. Below baseline: gradient from transparent at the baseline
16
+ * fading to bottomFillColor at the line.
17
+ */
18
+ export declare class BaselineDeltaMountainRenderer {
19
+ private _options;
20
+ applyOptions(options: Partial<BaselineDeltaMountainRendererOptions>): void;
21
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number): void;
22
+ }
@@ -0,0 +1,19 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface BaselineRendererOptions {
3
+ basePrice: number;
4
+ topLineColor: string;
5
+ topFillColor: string;
6
+ bottomLineColor: string;
7
+ bottomFillColor: string;
8
+ lineWidth: number;
9
+ }
10
+ /**
11
+ * BaselineRenderer — draws a close-price line coloured above/below a base price,
12
+ * fills each region with a semi-transparent colour, and renders a dashed
13
+ * horizontal baseline.
14
+ */
15
+ export declare class BaselineRenderer {
16
+ private _options;
17
+ applyOptions(options: Partial<BaselineRendererOptions>): void;
18
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number): void;
19
+ }
@@ -0,0 +1,21 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface CandlestickRendererOptions {
3
+ upColor: string;
4
+ downColor: string;
5
+ wickUpColor: string;
6
+ wickDownColor: string;
7
+ borderUpColor: string;
8
+ borderDownColor: string;
9
+ }
10
+ /**
11
+ * CandlestickRenderer — draws OHLC candles with body and wick rectangles.
12
+ *
13
+ * All pixel coordinates are multiplied by `target.pixelRatio` and rounded to
14
+ * integers for crisp HiDPI rendering.
15
+ */
16
+ export declare class CandlestickRenderer {
17
+ private _options;
18
+ applyOptions(options: Partial<CandlestickRendererOptions>): void;
19
+ options(): CandlestickRendererOptions;
20
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number, barWidth: number): void;
21
+ }
@@ -0,0 +1,28 @@
1
+ import { GradientStop, PathCommand } from '../core/types';
2
+ import { DrawStyle, IRenderer } from './renderer';
3
+ /**
4
+ * CanvasRenderer — IRenderer implementation backed by a CanvasRenderingContext2D.
5
+ *
6
+ * Coordinate arguments accepted by public methods are in **logical (CSS) pixels**.
7
+ * The implementation multiplies all coordinates by `pixelRatio` so that the
8
+ * resulting marks are always sharp on HiDPI/Retina displays.
9
+ */
10
+ export declare class CanvasRenderer implements IRenderer {
11
+ private _ctx;
12
+ private _pixelRatio;
13
+ constructor(ctx: CanvasRenderingContext2D, pixelRatio?: number);
14
+ setSize(width: number, height: number, pixelRatio: number): void;
15
+ clear(): void;
16
+ save(): void;
17
+ restore(): void;
18
+ clip(x: number, y: number, width: number, height: number): void;
19
+ setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;
20
+ drawLine(x1: number, y1: number, x2: number, y2: number): void;
21
+ drawRect(x: number, y: number, width: number, height: number): void;
22
+ fillRect(x: number, y: number, width: number, height: number): void;
23
+ drawPath(commands: PathCommand[], fill?: boolean): void;
24
+ fillText(text: string, x: number, y: number): void;
25
+ measureText(text: string): number;
26
+ setStyle(style: DrawStyle): void;
27
+ createGradient(x0: number, y0: number, x1: number, y1: number, stops: GradientStop[]): CanvasGradient;
28
+ }
@@ -0,0 +1,15 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface ColoredLineRendererOptions {
3
+ upColor: string;
4
+ downColor: string;
5
+ lineWidth: number;
6
+ }
7
+ /**
8
+ * ColoredLineRenderer — draws a close-price polyline where each segment is
9
+ * coloured green (upColor) when price rises and red (downColor) when it falls.
10
+ */
11
+ export declare class ColoredLineRenderer {
12
+ private _options;
13
+ applyOptions(options: Partial<ColoredLineRendererOptions>): void;
14
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number): void;
15
+ }
@@ -0,0 +1,18 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface ColoredMountainRendererOptions {
3
+ upColor: string;
4
+ downColor: string;
5
+ upFillColor: string;
6
+ downFillColor: string;
7
+ lineWidth: number;
8
+ }
9
+ /**
10
+ * ColoredMountainRenderer — like AreaRenderer but the line and fill are coloured
11
+ * per-segment based on close-price direction. Up segments use upColor/upFillColor,
12
+ * down segments use downColor/downFillColor.
13
+ */
14
+ export declare class ColoredMountainRenderer {
15
+ private _options;
16
+ applyOptions(options: Partial<ColoredMountainRendererOptions>): void;
17
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number): void;
18
+ }
@@ -0,0 +1,14 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface ColumnRendererOptions {
3
+ upColor: string;
4
+ downColor: string;
5
+ }
6
+ /**
7
+ * ColumnRenderer — draws vertical bars from the chart bottom up to the close
8
+ * price, coloured by whether close >= open.
9
+ */
10
+ export declare class ColumnRenderer {
11
+ private _options;
12
+ applyOptions(options: Partial<ColumnRendererOptions>): void;
13
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number, barWidth?: number): void;
14
+ }
@@ -0,0 +1,14 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface HighLowRendererOptions {
3
+ color: string;
4
+ lineWidth: number;
5
+ }
6
+ /**
7
+ * HighLowRenderer — draws simple vertical lines from high to low for each bar,
8
+ * without open/close tick marks.
9
+ */
10
+ export declare class HighLowRenderer {
11
+ private _options;
12
+ applyOptions(options: Partial<HighLowRendererOptions>): void;
13
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number): void;
14
+ }
@@ -0,0 +1,16 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface HistogramRendererOptions {
3
+ upColor: string;
4
+ downColor: string;
5
+ }
6
+ /**
7
+ * HistogramRenderer — draws vertical bars from the bottom of the pane,
8
+ * coloured by whether close >= open (up) or close < open (down).
9
+ *
10
+ * Typical use-case: volume histogram overlay.
11
+ */
12
+ export declare class HistogramRenderer {
13
+ private _options;
14
+ applyOptions(options: Partial<HistogramRendererOptions>): void;
15
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number, barWidth: number): void;
16
+ }
@@ -0,0 +1,16 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface HLCAreaRendererOptions {
3
+ highLineColor: string;
4
+ lowLineColor: string;
5
+ fillColor: string;
6
+ lineWidth: number;
7
+ }
8
+ /**
9
+ * HLCAreaRenderer — draws two polylines (high and low prices) with a filled
10
+ * area between them.
11
+ */
12
+ export declare class HLCAreaRenderer {
13
+ private _options;
14
+ applyOptions(options: Partial<HLCAreaRendererOptions>): void;
15
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number): void;
16
+ }
@@ -0,0 +1,18 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface HollowCandleRendererOptions {
3
+ upColor: string;
4
+ downColor: string;
5
+ wickColor: string;
6
+ }
7
+ /**
8
+ * HollowCandleRenderer — draws candles where:
9
+ * - Up candles (close >= open) are hollow: only the border is drawn (stroke).
10
+ * - Down candles are filled.
11
+ *
12
+ * The wick is always drawn as a thin filled rectangle.
13
+ */
14
+ export declare class HollowCandleRenderer {
15
+ private _options;
16
+ applyOptions(options: Partial<HollowCandleRendererOptions>): void;
17
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number, barWidth: number): void;
18
+ }
@@ -0,0 +1,22 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface KagiRendererOptions {
3
+ reversalAmount: number;
4
+ yangColor: string;
5
+ yinColor: string;
6
+ yangWidth: number;
7
+ yinWidth: number;
8
+ }
9
+ /**
10
+ * KagiRenderer — draws Kagi chart vertical lines with yang/yin thickness.
11
+ *
12
+ * Kagi charts emphasize trend direction using line thickness:
13
+ * - Yang (thick, green) lines when price exceeds a previous high
14
+ * - Yin (thin, red) lines when price drops below a previous low
15
+ * - Horizontal connectors join segments on direction changes
16
+ */
17
+ export declare class KagiRenderer {
18
+ private _options;
19
+ applyOptions(options: Partial<KagiRendererOptions>): void;
20
+ private _buildSegments;
21
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number, _barWidth: number): void;
22
+ }
@@ -0,0 +1,20 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface LineBreakRendererOptions {
3
+ breakCount: number;
4
+ upColor: string;
5
+ downColor: string;
6
+ }
7
+ /**
8
+ * LineBreakRenderer — draws Three Line Break (or N-Line Break) chart.
9
+ *
10
+ * Each block opens at the previous close and closes at the current close.
11
+ * A new block is only drawn when the current close breaks above the highest
12
+ * high or below the lowest low of the last N blocks. This filters out minor
13
+ * price fluctuations.
14
+ */
15
+ export declare class LineBreakRenderer {
16
+ private _options;
17
+ applyOptions(options: Partial<LineBreakRendererOptions>): void;
18
+ private _buildBlocks;
19
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number, barWidth: number): void;
20
+ }
@@ -0,0 +1,17 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface LineRendererOptions {
3
+ color: string;
4
+ lineWidth: number;
5
+ }
6
+ /**
7
+ * LineRenderer — draws a close-price polyline over the visible bar range.
8
+ *
9
+ * Coordinates are multiplied by `target.pixelRatio` and rounded to integer
10
+ * pixels so the line remains crisp on HiDPI displays.
11
+ */
12
+ export declare class LineRenderer {
13
+ private _options;
14
+ applyOptions(options: Partial<LineRendererOptions>): void;
15
+ options(): LineRendererOptions;
16
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number): void;
17
+ }
@@ -0,0 +1,20 @@
1
+ import { ColumnStore, IRenderTarget, VisibleRange } from '../core/types';
2
+ export interface PointFigureRendererOptions {
3
+ boxSize: number;
4
+ reversalBoxes: number;
5
+ upColor: string;
6
+ downColor: string;
7
+ }
8
+ /**
9
+ * PointFigureRenderer — draws Point & Figure chart with X and O columns.
10
+ *
11
+ * X columns represent rising prices, O columns represent falling prices.
12
+ * A new column starts when price reverses by `reversalBoxes * boxSize`.
13
+ * Each box is drawn as an X (two crossing diagonals) or O (ellipse).
14
+ */
15
+ export declare class PointFigureRenderer {
16
+ private _options;
17
+ applyOptions(options: Partial<PointFigureRendererOptions>): void;
18
+ private _buildColumns;
19
+ draw(target: IRenderTarget, store: ColumnStore, range: VisibleRange, indexToX: (i: number) => number, priceToY: (price: number) => number, barWidth: number): void;
20
+ }