@lmvz-ds/components 0.12.5-alpha.1 → 0.12.5-alpha.5

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 (123) hide show
  1. package/dist/manifest.json +1 -1
  2. package/package.json +4 -4
  3. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
  4. package/dist/cjs/assets-Cswkqk_c.js +0 -18971
  5. package/dist/cjs/assets-Cswkqk_c.js.map +0 -1
  6. package/dist/cjs/axe-C2rxi-K2.js +0 -32837
  7. package/dist/cjs/axe-C2rxi-K2.js.map +0 -1
  8. package/dist/cjs/header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-BTL_B6qg.js +0 -3665
  9. package/dist/cjs/header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-BTL_B6qg.js.map +0 -1
  10. package/dist/cjs/header-integration_6.cjs.entry.js +0 -18
  11. package/dist/cjs/header-integration_6.cjs.entry.js.map +0 -1
  12. package/dist/cjs/icons-jn_Uak9B.js +0 -1063
  13. package/dist/cjs/icons-jn_Uak9B.js.map +0 -1
  14. package/dist/cjs/index-DpBPf1cE.js +0 -2112
  15. package/dist/cjs/index-DpBPf1cE.js.map +0 -1
  16. package/dist/cjs/index.cjs.js.map +0 -1
  17. package/dist/cjs/lmvz-action.cjs.entry.js.map +0 -1
  18. package/dist/cjs/lmvz-card.cjs.entry.js.map +0 -1
  19. package/dist/cjs/lmvz-chip.cjs.entry.js.map +0 -1
  20. package/dist/cjs/lmvz-components.cjs.js.map +0 -1
  21. package/dist/cjs/loader.cjs.js.map +0 -1
  22. package/dist/collection/api/ds.constants.js.map +0 -1
  23. package/dist/collection/api/index.js.map +0 -1
  24. package/dist/collection/components/lmvz-action/lmvz-action.js.map +0 -1
  25. package/dist/collection/components/lmvz-button/lmvz-button.js.map +0 -1
  26. package/dist/collection/components/lmvz-card/lmvz-card.js.map +0 -1
  27. package/dist/collection/components/lmvz-chip/lmvz-chip.js.map +0 -1
  28. package/dist/collection/components/lmvz-header/lmvz-header.js.map +0 -1
  29. package/dist/collection/components/lmvz-icon/icons.js.map +0 -1
  30. package/dist/collection/components/lmvz-icon/lmvz-icon.js.map +0 -1
  31. package/dist/collection/components/lmvz-icon/public.js.map +0 -1
  32. package/dist/collection/components/lmvz-icon/test/icons.unit.js.map +0 -1
  33. package/dist/collection/components/lmvz-input/lmvz-input.js.map +0 -1
  34. package/dist/collection/components/lmvz-menuitem/lmvz-menuitem.js.map +0 -1
  35. package/dist/collection/index.js.map +0 -1
  36. package/dist/collection/integration/header-integration.js.map +0 -1
  37. package/dist/collection/utils/assets.js.map +0 -1
  38. package/dist/collection/utils/component.js.map +0 -1
  39. package/dist/collection/utils/effect.js.map +0 -1
  40. package/dist/collection/utils/element-activation-controller.js.map +0 -1
  41. package/dist/collection/utils/environment.js.map +0 -1
  42. package/dist/collection/utils/http.js.map +0 -1
  43. package/dist/collection/utils/http.test.js.map +0 -1
  44. package/dist/collection/utils/list-keyboard-controller.js.map +0 -1
  45. package/dist/collection/utils/public.js.map +0 -1
  46. package/dist/collection/utils/reactive-controller-host.js.map +0 -1
  47. package/dist/collection/utils/typing.js.map +0 -1
  48. package/dist/collection/utils/validation/aria-validation-controller.js.map +0 -1
  49. package/dist/collection/utils/validation/svg.js.map +0 -1
  50. package/dist/components/header-integration.d.ts +0 -11
  51. package/dist/components/header-integration.js +0 -2
  52. package/dist/components/header-integration.js.map +0 -1
  53. package/dist/components/index.js.map +0 -1
  54. package/dist/components/lmvz-action.js.map +0 -1
  55. package/dist/components/lmvz-button.js.map +0 -1
  56. package/dist/components/lmvz-card.js.map +0 -1
  57. package/dist/components/lmvz-chip.js.map +0 -1
  58. package/dist/components/lmvz-header.js.map +0 -1
  59. package/dist/components/lmvz-icon.js.map +0 -1
  60. package/dist/components/lmvz-input.js.map +0 -1
  61. package/dist/components/lmvz-menuitem.js.map +0 -1
  62. package/dist/components/p-B3JVFwO1.js.map +0 -1
  63. package/dist/components/p-B85MJLTf.js.map +0 -1
  64. package/dist/components/p-CN0JX9-m.js.map +0 -1
  65. package/dist/components/p-Cd4nH2vx.js +0 -2
  66. package/dist/components/p-Cd4nH2vx.js.map +0 -1
  67. package/dist/components/p-CdofjRtQ.js.map +0 -1
  68. package/dist/components/p-CkTUjPwD.js +0 -2
  69. package/dist/components/p-CkTUjPwD.js.map +0 -1
  70. package/dist/components/p-CpI4KFOu.js +0 -2
  71. package/dist/components/p-CpI4KFOu.js.map +0 -1
  72. package/dist/components/p-D1HbKFuh.js.map +0 -1
  73. package/dist/components/p-D7xthqTT.js +0 -2
  74. package/dist/components/p-D7xthqTT.js.map +0 -1
  75. package/dist/components/p-DBeynNeU.js +0 -2
  76. package/dist/components/p-DBeynNeU.js.map +0 -1
  77. package/dist/components/p-DMLRPGid.js.map +0 -1
  78. package/dist/components/p-UiqQVZhU.js +0 -2
  79. package/dist/components/p-UiqQVZhU.js.map +0 -1
  80. package/dist/components/p-Xq267cFM.js +0 -2
  81. package/dist/components/p-Xq267cFM.js.map +0 -1
  82. package/dist/components/p-glDDybgu.js +0 -2
  83. package/dist/components/p-glDDybgu.js.map +0 -1
  84. package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
  85. package/dist/esm/assets-K2FHD9qn.js +0 -18770
  86. package/dist/esm/assets-K2FHD9qn.js.map +0 -1
  87. package/dist/esm/axe-CZ0Rtkog.js +0 -32835
  88. package/dist/esm/axe-CZ0Rtkog.js.map +0 -1
  89. package/dist/esm/header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-CW3FGLZC.js +0 -3657
  90. package/dist/esm/header-integration.lmvz-button.lmvz-header.lmvz-icon.lmvz-input.lmvz-menuitem-CW3FGLZC.js.map +0 -1
  91. package/dist/esm/header-integration_6.entry.js +0 -7
  92. package/dist/esm/header-integration_6.entry.js.map +0 -1
  93. package/dist/esm/icons-BITzEzmq.js +0 -1032
  94. package/dist/esm/icons-BITzEzmq.js.map +0 -1
  95. package/dist/esm/index-D2eyw7iv.js +0 -2101
  96. package/dist/esm/index-D2eyw7iv.js.map +0 -1
  97. package/dist/esm/index.js.map +0 -1
  98. package/dist/esm/lmvz-action.entry.js.map +0 -1
  99. package/dist/esm/lmvz-card.entry.js.map +0 -1
  100. package/dist/esm/lmvz-chip.entry.js.map +0 -1
  101. package/dist/esm/lmvz-components.js.map +0 -1
  102. package/dist/esm/loader.js.map +0 -1
  103. package/dist/lmvz-components/index.esm.js.map +0 -1
  104. package/dist/lmvz-components/lmvz-components.esm.js.map +0 -1
  105. package/dist/lmvz-components/p-366a01f8.entry.js +0 -2
  106. package/dist/lmvz-components/p-366a01f8.entry.js.map +0 -1
  107. package/dist/lmvz-components/p-84ee7919.entry.js +0 -2
  108. package/dist/lmvz-components/p-84ee7919.entry.js.map +0 -1
  109. package/dist/lmvz-components/p-BLwPC3DQ.js +0 -2
  110. package/dist/lmvz-components/p-BLwPC3DQ.js.map +0 -1
  111. package/dist/lmvz-components/p-D2eyw7iv.js +0 -3
  112. package/dist/lmvz-components/p-D2eyw7iv.js.map +0 -1
  113. package/dist/lmvz-components/p-DANVVVBd.js +0 -7
  114. package/dist/lmvz-components/p-DANVVVBd.js.map +0 -1
  115. package/dist/lmvz-components/p-DQuL1Twl.js.map +0 -1
  116. package/dist/lmvz-components/p-DlDurXvX.js +0 -2
  117. package/dist/lmvz-components/p-DlDurXvX.js.map +0 -1
  118. package/dist/lmvz-components/p-Hc4uxoTU.js +0 -13
  119. package/dist/lmvz-components/p-Hc4uxoTU.js.map +0 -1
  120. package/dist/lmvz-components/p-a4200b26.entry.js +0 -2
  121. package/dist/lmvz-components/p-a4200b26.entry.js.map +0 -1
  122. package/dist/lmvz-components/p-d3243bae.entry.js +0 -2
  123. package/dist/lmvz-components/p-d3243bae.entry.js.map +0 -1
@@ -1,1063 +0,0 @@
1
- 'use strict';
2
-
3
- var assets = require('./assets-Cswkqk_c.js');
4
-
5
- /**
6
- * This module provides types and utility functions to create and work with branded types,
7
- * which are TypeScript types with an added type tag to prevent accidental usage of a value in the wrong context.
8
- *
9
- * The `refined` and `nominal` functions are both used to create branded types in TypeScript.
10
- * The main difference between them is that `refined` allows for validation of the data, while `nominal` does not.
11
- *
12
- * The `nominal` function is used to create a new branded type that has the same underlying type as the input, but with a different name.
13
- * This is useful when you want to distinguish between two values of the same type that have different meanings.
14
- * The `nominal` function does not perform any validation of the input data.
15
- *
16
- * On the other hand, the `refined` function is used to create a new branded type that has the same underlying type as the input,
17
- * but with a different name, and it also allows for validation of the input data.
18
- * The `refined` function takes a predicate that is used to validate the input data.
19
- * If the input data fails the validation, a `BrandErrors` is returned, which provides information about the specific validation failure.
20
- *
21
- * @since 2.0.0
22
- */
23
- /**
24
- * @since 2.0.0
25
- * @category symbols
26
- */
27
- const RefinedConstructorsTypeId = /*#__PURE__*/Symbol.for("effect/Brand/Refined");
28
- /**
29
- * Returns a `BrandErrors` that contains a single `RefinementError`.
30
- *
31
- * @since 2.0.0
32
- * @category constructors
33
- */
34
- const error = (message, meta) => [{
35
- message,
36
- meta
37
- }];
38
- function refined(...args) {
39
- const either = args.length === 2 ? unbranded => args[0](unbranded) ? assets.right(unbranded) : assets.left(args[1](unbranded)) : unbranded => {
40
- return assets.match$1(args[0](unbranded), {
41
- onNone: () => assets.right(unbranded),
42
- onSome: assets.left
43
- });
44
- };
45
- return Object.assign(unbranded => assets.getOrThrowWith(either(unbranded), assets.identity), {
46
- [RefinedConstructorsTypeId]: RefinedConstructorsTypeId,
47
- option: args => assets.getRight(either(args)),
48
- either,
49
- is: args => assets.isRight(either(args))
50
- });
51
- }
52
-
53
- /**
54
- * Creates a new `Deferred`.
55
- *
56
- * @since 2.0.0
57
- * @category constructors
58
- */
59
- const make$3 = assets.deferredMake;
60
- const _await = assets.deferredAwait;
61
- /**
62
- * Exits the `Deferred` with the specified `Exit` value, which will be
63
- * propagated to all fibers waiting on the value of the `Deferred`.
64
- *
65
- * @since 2.0.0
66
- * @category utils
67
- */
68
- const done = assets.deferredDone;
69
- /**
70
- * Fails the `Deferred` with the specified `Cause`, which will be propagated to
71
- * all fibers waiting on the value of the `Deferred`.
72
- *
73
- * @since 2.0.0
74
- * @category utils
75
- */
76
- const failCause$1 = assets.deferredFailCause;
77
- /**
78
- * Completes the `Deferred` with interruption. This will interrupt all fibers
79
- * waiting on the value of the `Deferred` with the `FiberId` of the fiber
80
- * calling this method.
81
- *
82
- * @since 2.0.0
83
- * @category utils
84
- */
85
- const interrupt = assets.deferredInterrupt;
86
- /**
87
- * Returns `true` if this `Deferred` has already been completed with a value or
88
- * an error, `false` otherwise.
89
- *
90
- * @since 2.0.0
91
- * @category getters
92
- */
93
- const isDone = assets.deferredIsDone;
94
- /**
95
- * Completes the `Deferred` with the specified value.
96
- *
97
- * @since 2.0.0
98
- * @category utils
99
- */
100
- const succeed$1 = assets.deferredSucceed;
101
- /**
102
- * Unsafely creates a new `Deferred` from the specified `FiberId`.
103
- *
104
- * @since 2.0.0
105
- * @category unsafe
106
- */
107
- const unsafeMake = assets.deferredUnsafeMake;
108
-
109
- /**
110
- * Returns `true` if the specified `Exit` is a `Failure`, `false` otherwise.
111
- *
112
- * @since 2.0.0
113
- * @category refinements
114
- */
115
- const isFailure = assets.exitIsFailure;
116
- /**
117
- * Returns `true` if the specified `Exit` is a `Success`, `false` otherwise.
118
- *
119
- * @since 2.0.0
120
- * @category refinements
121
- */
122
- const isSuccess = assets.exitIsSuccess;
123
- /**
124
- * Collects all of the specified exit values into a `Some<Exit<List<A>, E>>`. If
125
- * the provided iterable contains no elements, `None` will be returned.
126
- *
127
- * @since 2.0.0
128
- * @category constructors
129
- */
130
- const all = assets.exitCollectAll;
131
- /**
132
- * Constructs a new `Exit.Failure` from the specified unrecoverable defect.
133
- *
134
- * @since 2.0.0
135
- * @category constructors
136
- */
137
- const die = assets.exitDie;
138
- /**
139
- * Constructs a new `Exit.Failure` from the specified recoverable error of type
140
- * `E`.
141
- *
142
- * @since 2.0.0
143
- * @category constructors
144
- */
145
- const fail = assets.exitFail;
146
- /**
147
- * Constructs a new `Exit.Failure` from the specified `Cause` of type `E`.
148
- *
149
- * @since 2.0.0
150
- * @category constructors
151
- */
152
- const failCause = assets.exitFailCause;
153
- /**
154
- * Maps over the `Success` value of the specified exit using the provided
155
- * function.
156
- *
157
- * @since 2.0.0
158
- * @category mapping
159
- */
160
- const map = assets.exitMap;
161
- /**
162
- * @since 2.0.0
163
- * @category folding
164
- */
165
- const match = assets.exitMatch;
166
- /**
167
- * Constructs a new `Exit.Success` containing the specified value of type `A`.
168
- *
169
- * @since 2.0.0
170
- * @category constructors
171
- */
172
- const succeed = assets.exitSucceed;
173
- const void_ = assets.exitVoid;
174
- /**
175
- * Sequentially zips the this result with the specified result or else returns
176
- * the failed `Cause<E | E2>`.
177
- *
178
- * @since 2.0.0
179
- * @category zipping
180
- */
181
- const zip = assets.exitZip;
182
- /**
183
- * Sequentially zips the this result with the specified result discarding the
184
- * first element of the tuple or else returns the failed `Cause<E | E2>`.
185
- *
186
- * @since 2.0.0
187
- * @category zipping
188
- */
189
- const zipRight = assets.exitZipRight;
190
-
191
- /**
192
- * @since 2.0.0
193
- */
194
- const TypeId$1 = /*#__PURE__*/Symbol.for("effect/MutableList");
195
- const MutableListProto = {
196
- [TypeId$1]: TypeId$1,
197
- [Symbol.iterator]() {
198
- let done = false;
199
- let head = this.head;
200
- return {
201
- next() {
202
- if (done) {
203
- return this.return();
204
- }
205
- if (head == null) {
206
- done = true;
207
- return this.return();
208
- }
209
- const value = head.value;
210
- head = head.next;
211
- return {
212
- done,
213
- value
214
- };
215
- },
216
- return(value) {
217
- if (!done) {
218
- done = true;
219
- }
220
- return {
221
- done: true,
222
- value
223
- };
224
- }
225
- };
226
- },
227
- toString() {
228
- return assets.format(this.toJSON());
229
- },
230
- toJSON() {
231
- return {
232
- _id: "MutableList",
233
- values: Array.from(this).map(assets.toJSON)
234
- };
235
- },
236
- [assets.NodeInspectSymbol]() {
237
- return this.toJSON();
238
- },
239
- pipe() {
240
- return assets.pipeArguments(this, arguments);
241
- }
242
- };
243
- /** @internal */
244
- const makeNode = value => ({
245
- value,
246
- removed: false,
247
- prev: undefined,
248
- next: undefined
249
- });
250
- /**
251
- * Creates an empty `MutableList`.
252
- *
253
- * @since 2.0.0
254
- * @category constructors
255
- */
256
- const empty = () => {
257
- const list = Object.create(MutableListProto);
258
- list.head = undefined;
259
- list.tail = undefined;
260
- list._length = 0;
261
- return list;
262
- };
263
- /**
264
- * Returns `true` if the list contains zero elements, `false`, otherwise.
265
- *
266
- * @since 2.0.0
267
- * @category getters
268
- */
269
- const isEmpty$1 = self => length$1(self) === 0;
270
- /**
271
- * Returns the length of the list.
272
- *
273
- * @since 2.0.0
274
- * @category getters
275
- */
276
- const length$1 = self => self._length;
277
- /**
278
- * Appends the specified element to the end of the `MutableList`.
279
- *
280
- * @category concatenating
281
- * @since 2.0.0
282
- */
283
- const append = /*#__PURE__*/assets.dual(2, (self, value) => {
284
- const node = makeNode(value);
285
- if (self.head === undefined) {
286
- self.head = node;
287
- }
288
- if (self.tail === undefined) {
289
- self.tail = node;
290
- } else {
291
- self.tail.next = node;
292
- node.prev = self.tail;
293
- self.tail = node;
294
- }
295
- self._length += 1;
296
- return self;
297
- });
298
- /**
299
- * Removes the first value from the list and returns it, if it exists.
300
- *
301
- * @since 0.0.1
302
- */
303
- const shift = self => {
304
- const head = self.head;
305
- if (head !== undefined) {
306
- remove(self, head);
307
- return head.value;
308
- }
309
- return undefined;
310
- };
311
- const remove = (self, node) => {
312
- if (node.removed) {
313
- return;
314
- }
315
- node.removed = true;
316
- if (node.prev !== undefined && node.next !== undefined) {
317
- node.prev.next = node.next;
318
- node.next.prev = node.prev;
319
- } else if (node.prev !== undefined) {
320
- self.tail = node.prev;
321
- node.prev.next = undefined;
322
- } else if (node.next !== undefined) {
323
- self.head = node.next;
324
- node.next.prev = undefined;
325
- } else {
326
- self.tail = undefined;
327
- self.head = undefined;
328
- }
329
- if (self._length > 0) {
330
- self._length -= 1;
331
- }
332
- };
333
-
334
- /**
335
- * @since 2.0.0
336
- */
337
- const TypeId = /*#__PURE__*/Symbol.for("effect/MutableQueue");
338
- /**
339
- * @since 2.0.0
340
- * @category symbol
341
- */
342
- const EmptyMutableQueue = /*#__PURE__*/Symbol.for("effect/mutable/MutableQueue/Empty");
343
- const MutableQueueProto = {
344
- [TypeId]: TypeId,
345
- [Symbol.iterator]() {
346
- return Array.from(this.queue)[Symbol.iterator]();
347
- },
348
- toString() {
349
- return assets.format(this.toJSON());
350
- },
351
- toJSON() {
352
- return {
353
- _id: "MutableQueue",
354
- values: Array.from(this).map(assets.toJSON)
355
- };
356
- },
357
- [assets.NodeInspectSymbol]() {
358
- return this.toJSON();
359
- },
360
- pipe() {
361
- return assets.pipeArguments(this, arguments);
362
- }
363
- };
364
- const make$2 = capacity => {
365
- const queue = Object.create(MutableQueueProto);
366
- queue.queue = empty();
367
- queue.capacity = capacity;
368
- return queue;
369
- };
370
- /**
371
- * Creates a new bounded `MutableQueue`.
372
- *
373
- * @since 2.0.0
374
- * @category constructors
375
- */
376
- const bounded = capacity => make$2(capacity);
377
- /**
378
- * Creates a new unbounded `MutableQueue`.
379
- *
380
- * @since 2.0.0
381
- * @category constructors
382
- */
383
- const unbounded = () => make$2(undefined);
384
- /**
385
- * Returns the current number of elements in the queue.
386
- *
387
- * @since 2.0.0
388
- * @category getters
389
- */
390
- const length = self => length$1(self.queue);
391
- /**
392
- * Returns `true` if the queue is empty, `false` otherwise.
393
- *
394
- * @since 2.0.0
395
- * @category getters
396
- */
397
- const isEmpty = self => isEmpty$1(self.queue);
398
- /**
399
- * The **maximum** number of elements that a queue can hold.
400
- *
401
- * **Note**: unbounded queues can still implement this interface with
402
- * `capacity = Infinity`.
403
- *
404
- * @since 2.0.0
405
- * @category getters
406
- */
407
- const capacity = self => self.capacity === undefined ? Infinity : self.capacity;
408
- /**
409
- * Offers an element to the queue.
410
- *
411
- * Returns whether the enqueue was successful or not.
412
- *
413
- * @since 2.0.0
414
- */
415
- const offer = /*#__PURE__*/assets.dual(2, (self, value) => {
416
- const queueLength = length$1(self.queue);
417
- if (self.capacity !== undefined && queueLength === self.capacity) {
418
- return false;
419
- }
420
- append(value)(self.queue);
421
- return true;
422
- });
423
- /**
424
- * Enqueues a collection of values into the queue.
425
- *
426
- * Returns a `Chunk` of the values that were **not** able to be enqueued.
427
- *
428
- * @since 2.0.0
429
- */
430
- const offerAll = /*#__PURE__*/assets.dual(2, (self, values) => {
431
- const iterator = values[Symbol.iterator]();
432
- let next;
433
- let remainder = assets.empty$1();
434
- let offering = true;
435
- while (offering && (next = iterator.next()) && !next.done) {
436
- offering = offer(next.value)(self);
437
- }
438
- while (next != null && !next.done) {
439
- remainder = assets.prepend(next.value)(remainder);
440
- next = iterator.next();
441
- }
442
- return assets.reverse(remainder);
443
- });
444
- /**
445
- * Dequeues an element from the queue.
446
- *
447
- * Returns either an element from the queue, or the `def` param.
448
- *
449
- * **Note**: if there is no meaningful default for your type, you can always
450
- * use `poll(MutableQueue.EmptyMutableQueue)`.
451
- *
452
- * @since 2.0.0
453
- */
454
- const poll = /*#__PURE__*/assets.dual(2, (self, def) => {
455
- if (isEmpty$1(self.queue)) {
456
- return def;
457
- }
458
- return shift(self.queue);
459
- });
460
- /**
461
- * Dequeues up to `n` elements from the queue.
462
- *
463
- * Returns a `List` of up to `n` elements.
464
- *
465
- * @since 2.0.0
466
- */
467
- const pollUpTo = /*#__PURE__*/assets.dual(2, (self, n) => {
468
- let result = assets.empty$1();
469
- let count = 0;
470
- while (count < n) {
471
- const element = poll(EmptyMutableQueue)(self);
472
- if (element === EmptyMutableQueue) {
473
- break;
474
- }
475
- result = assets.prepend(element)(result);
476
- count += 1;
477
- }
478
- return assets.reverse(result);
479
- });
480
-
481
- /** @internal */
482
- const complete = (key, exit, entryStats, timeToLiveMillis) => assets.struct({
483
- _tag: "Complete",
484
- key,
485
- exit,
486
- entryStats,
487
- timeToLiveMillis
488
- });
489
- /** @internal */
490
- const pending = (key, deferred) => assets.struct({
491
- _tag: "Pending",
492
- key,
493
- deferred
494
- });
495
- /** @internal */
496
- const refreshing = (deferred, complete) => assets.struct({
497
- _tag: "Refreshing",
498
- deferred,
499
- complete
500
- });
501
- /** @internal */
502
- const MapKeyTypeId = /*#__PURE__*/Symbol.for("effect/Cache/MapKey");
503
- class MapKeyImpl {
504
- current;
505
- [MapKeyTypeId] = MapKeyTypeId;
506
- previous = undefined;
507
- next = undefined;
508
- constructor(current) {
509
- this.current = current;
510
- }
511
- [assets.symbol]() {
512
- return assets.pipe(assets.hash(this.current), assets.combine(assets.hash(this.previous)), assets.combine(assets.hash(this.next)), assets.cached(this));
513
- }
514
- [assets.symbol$1](that) {
515
- if (this === that) {
516
- return true;
517
- }
518
- return isMapKey(that) && assets.equals(this.current, that.current) && assets.equals(this.previous, that.previous) && assets.equals(this.next, that.next);
519
- }
520
- }
521
- /** @internal */
522
- const makeMapKey = current => new MapKeyImpl(current);
523
- /** @internal */
524
- const isMapKey = u => assets.hasProperty(u, MapKeyTypeId);
525
- class KeySetImpl {
526
- head = undefined;
527
- tail = undefined;
528
- add(key) {
529
- if (key !== this.tail) {
530
- if (this.tail === undefined) {
531
- this.head = key;
532
- this.tail = key;
533
- } else {
534
- const previous = key.previous;
535
- const next = key.next;
536
- if (next !== undefined) {
537
- key.next = undefined;
538
- if (previous !== undefined) {
539
- previous.next = next;
540
- next.previous = previous;
541
- } else {
542
- this.head = next;
543
- this.head.previous = undefined;
544
- }
545
- }
546
- this.tail.next = key;
547
- key.previous = this.tail;
548
- this.tail = key;
549
- }
550
- }
551
- }
552
- remove() {
553
- const key = this.head;
554
- if (key !== undefined) {
555
- const next = key.next;
556
- if (next !== undefined) {
557
- key.next = undefined;
558
- this.head = next;
559
- this.head.previous = undefined;
560
- } else {
561
- this.head = undefined;
562
- this.tail = undefined;
563
- }
564
- }
565
- return key;
566
- }
567
- }
568
- /** @internal */
569
- const makeKeySet = () => new KeySetImpl();
570
- /**
571
- * Constructs a new `CacheState` from the specified values.
572
- *
573
- * @internal
574
- */
575
- const makeCacheState = (map, keys, accesses, updating, hits, misses) => ({
576
- map,
577
- keys,
578
- accesses,
579
- updating,
580
- hits,
581
- misses
582
- });
583
- /**
584
- * Constructs an initial cache state.
585
- *
586
- * @internal
587
- */
588
- const initialCacheState = () => makeCacheState(assets.empty$2(), makeKeySet(), unbounded(), assets.make$1(false), 0, 0);
589
- /** @internal */
590
- const CacheSymbolKey = "effect/Cache";
591
- /** @internal */
592
- const CacheTypeId = /*#__PURE__*/Symbol.for(CacheSymbolKey);
593
- const cacheVariance = {
594
- /* c8 ignore next */
595
- _Key: _ => _,
596
- /* c8 ignore next */
597
- _Error: _ => _,
598
- /* c8 ignore next */
599
- _Value: _ => _
600
- };
601
- /** @internal */
602
- const ConsumerCacheSymbolKey = "effect/ConsumerCache";
603
- /** @internal */
604
- const ConsumerCacheTypeId = /*#__PURE__*/Symbol.for(ConsumerCacheSymbolKey);
605
- const consumerCacheVariance = {
606
- /* c8 ignore next */
607
- _Key: _ => _,
608
- /* c8 ignore next */
609
- _Error: _ => _,
610
- /* c8 ignore next */
611
- _Value: _ => _
612
- };
613
- /** @internal */
614
- const makeCacheStats = options => options;
615
- /** @internal */
616
- const makeEntryStats = loadedMillis => ({
617
- loadedMillis
618
- });
619
- class CacheImpl {
620
- capacity;
621
- context;
622
- fiberId;
623
- lookup;
624
- timeToLive;
625
- [CacheTypeId] = cacheVariance;
626
- [ConsumerCacheTypeId] = consumerCacheVariance;
627
- cacheState;
628
- constructor(capacity, context, fiberId, lookup, timeToLive) {
629
- this.capacity = capacity;
630
- this.context = context;
631
- this.fiberId = fiberId;
632
- this.lookup = lookup;
633
- this.timeToLive = timeToLive;
634
- this.cacheState = initialCacheState();
635
- }
636
- get(key) {
637
- return assets.map$1(this.getEither(key), assets.merge);
638
- }
639
- get cacheStats() {
640
- return assets.sync(() => makeCacheStats({
641
- hits: this.cacheState.hits,
642
- misses: this.cacheState.misses,
643
- size: assets.size$1(this.cacheState.map)
644
- }));
645
- }
646
- getOption(key) {
647
- return assets.suspend(() => assets.match$1(assets.get$2(this.cacheState.map, key), {
648
- onNone: () => {
649
- const mapKey = makeMapKey(key);
650
- this.trackAccess(mapKey);
651
- this.trackMiss();
652
- return assets.succeed(assets.none());
653
- },
654
- onSome: value => this.resolveMapValue(value)
655
- }));
656
- }
657
- getOptionComplete(key) {
658
- return assets.suspend(() => assets.match$1(assets.get$2(this.cacheState.map, key), {
659
- onNone: () => {
660
- const mapKey = makeMapKey(key);
661
- this.trackAccess(mapKey);
662
- this.trackMiss();
663
- return assets.succeed(assets.none());
664
- },
665
- onSome: value => this.resolveMapValue(value, true)
666
- }));
667
- }
668
- contains(key) {
669
- return assets.sync(() => assets.has(this.cacheState.map, key));
670
- }
671
- entryStats(key) {
672
- return assets.sync(() => {
673
- const option = assets.get$2(this.cacheState.map, key);
674
- if (assets.isSome(option)) {
675
- switch (option.value._tag) {
676
- case "Complete":
677
- {
678
- const loaded = option.value.entryStats.loadedMillis;
679
- return assets.some(makeEntryStats(loaded));
680
- }
681
- case "Pending":
682
- {
683
- return assets.none();
684
- }
685
- case "Refreshing":
686
- {
687
- const loaded = option.value.complete.entryStats.loadedMillis;
688
- return assets.some(makeEntryStats(loaded));
689
- }
690
- }
691
- }
692
- return assets.none();
693
- });
694
- }
695
- getEither(key) {
696
- return assets.suspend(() => {
697
- const k = key;
698
- let mapKey = undefined;
699
- let deferred = undefined;
700
- let value = assets.getOrUndefined(assets.get$2(this.cacheState.map, k));
701
- if (value === undefined) {
702
- deferred = unsafeMake(this.fiberId);
703
- mapKey = makeMapKey(k);
704
- if (assets.has(this.cacheState.map, k)) {
705
- value = assets.getOrUndefined(assets.get$2(this.cacheState.map, k));
706
- } else {
707
- assets.set$1(this.cacheState.map, k, pending(mapKey, deferred));
708
- }
709
- }
710
- if (value === undefined) {
711
- this.trackAccess(mapKey);
712
- this.trackMiss();
713
- return assets.map$1(this.lookupValueOf(key, deferred), assets.right);
714
- } else {
715
- return assets.flatMap(this.resolveMapValue(value), assets.match$1({
716
- onNone: () => this.getEither(key),
717
- onSome: value => assets.succeed(assets.left(value))
718
- }));
719
- }
720
- });
721
- }
722
- invalidate(key) {
723
- return assets.sync(() => {
724
- assets.remove(this.cacheState.map, key);
725
- });
726
- }
727
- invalidateWhen(key, when) {
728
- return assets.sync(() => {
729
- const value = assets.get$2(this.cacheState.map, key);
730
- if (assets.isSome(value) && value.value._tag === "Complete") {
731
- if (value.value.exit._tag === "Success") {
732
- if (when(value.value.exit.value)) {
733
- assets.remove(this.cacheState.map, key);
734
- }
735
- }
736
- }
737
- });
738
- }
739
- get invalidateAll() {
740
- return assets.sync(() => {
741
- this.cacheState.map = assets.empty$2();
742
- });
743
- }
744
- refresh(key) {
745
- return assets.clockWith(clock => assets.suspend(() => {
746
- const k = key;
747
- const deferred = unsafeMake(this.fiberId);
748
- let value = assets.getOrUndefined(assets.get$2(this.cacheState.map, k));
749
- if (value === undefined) {
750
- if (assets.has(this.cacheState.map, k)) {
751
- value = assets.getOrUndefined(assets.get$2(this.cacheState.map, k));
752
- } else {
753
- assets.set$1(this.cacheState.map, k, pending(makeMapKey(k), deferred));
754
- }
755
- }
756
- if (value === undefined) {
757
- return assets.asVoid(this.lookupValueOf(key, deferred));
758
- } else {
759
- switch (value._tag) {
760
- case "Complete":
761
- {
762
- if (this.hasExpired(clock, value.timeToLiveMillis)) {
763
- const found = assets.getOrUndefined(assets.get$2(this.cacheState.map, k));
764
- if (assets.equals(found, value)) {
765
- assets.remove(this.cacheState.map, k);
766
- }
767
- return assets.asVoid(this.get(key));
768
- }
769
- // Only trigger the lookup if we're still the current value, `completedResult`
770
- return assets.pipe(this.lookupValueOf(key, deferred), assets.when$1(() => {
771
- const current = assets.getOrUndefined(assets.get$2(this.cacheState.map, k));
772
- if (assets.equals(current, value)) {
773
- const mapValue = refreshing(deferred, value);
774
- assets.set$1(this.cacheState.map, k, mapValue);
775
- return true;
776
- }
777
- return false;
778
- }), assets.asVoid);
779
- }
780
- case "Pending":
781
- {
782
- return _await(value.deferred);
783
- }
784
- case "Refreshing":
785
- {
786
- return _await(value.deferred);
787
- }
788
- }
789
- }
790
- }));
791
- }
792
- set(key, value) {
793
- return assets.clockWith(clock => assets.sync(() => {
794
- const now = clock.unsafeCurrentTimeMillis();
795
- const k = key;
796
- const lookupResult = succeed(value);
797
- const mapValue = complete(makeMapKey(k), lookupResult, makeEntryStats(now), now + assets.toMillis(assets.decode(this.timeToLive(lookupResult))));
798
- assets.set$1(this.cacheState.map, k, mapValue);
799
- }));
800
- }
801
- get size() {
802
- return assets.sync(() => {
803
- return assets.size$1(this.cacheState.map);
804
- });
805
- }
806
- get values() {
807
- return assets.sync(() => {
808
- const values = [];
809
- for (const entry of this.cacheState.map) {
810
- if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
811
- values.push(entry[1].exit.value);
812
- }
813
- }
814
- return values;
815
- });
816
- }
817
- get entries() {
818
- return assets.sync(() => {
819
- const values = [];
820
- for (const entry of this.cacheState.map) {
821
- if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
822
- values.push([entry[0], entry[1].exit.value]);
823
- }
824
- }
825
- return values;
826
- });
827
- }
828
- get keys() {
829
- return assets.sync(() => {
830
- const keys = [];
831
- for (const entry of this.cacheState.map) {
832
- if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
833
- keys.push(entry[0]);
834
- }
835
- }
836
- return keys;
837
- });
838
- }
839
- resolveMapValue(value, ignorePending = false) {
840
- return assets.clockWith(clock => {
841
- switch (value._tag) {
842
- case "Complete":
843
- {
844
- this.trackAccess(value.key);
845
- if (this.hasExpired(clock, value.timeToLiveMillis)) {
846
- assets.remove(this.cacheState.map, value.key.current);
847
- return assets.succeed(assets.none());
848
- }
849
- this.trackHit();
850
- return assets.map$1(value.exit, assets.some);
851
- }
852
- case "Pending":
853
- {
854
- this.trackAccess(value.key);
855
- this.trackHit();
856
- if (ignorePending) {
857
- return assets.succeed(assets.none());
858
- }
859
- return assets.map$1(_await(value.deferred), assets.some);
860
- }
861
- case "Refreshing":
862
- {
863
- this.trackAccess(value.complete.key);
864
- this.trackHit();
865
- if (this.hasExpired(clock, value.complete.timeToLiveMillis)) {
866
- if (ignorePending) {
867
- return assets.succeed(assets.none());
868
- }
869
- return assets.map$1(_await(value.deferred), assets.some);
870
- }
871
- return assets.map$1(value.complete.exit, assets.some);
872
- }
873
- }
874
- });
875
- }
876
- trackHit() {
877
- this.cacheState.hits = this.cacheState.hits + 1;
878
- }
879
- trackMiss() {
880
- this.cacheState.misses = this.cacheState.misses + 1;
881
- }
882
- trackAccess(key) {
883
- offer(this.cacheState.accesses, key);
884
- if (assets.compareAndSet(this.cacheState.updating, false, true)) {
885
- let loop = true;
886
- while (loop) {
887
- const key = poll(this.cacheState.accesses, EmptyMutableQueue);
888
- if (key === EmptyMutableQueue) {
889
- loop = false;
890
- } else {
891
- this.cacheState.keys.add(key);
892
- }
893
- }
894
- let size = assets.size$1(this.cacheState.map);
895
- loop = size > this.capacity;
896
- while (loop) {
897
- const key = this.cacheState.keys.remove();
898
- if (key !== undefined) {
899
- if (assets.has(this.cacheState.map, key.current)) {
900
- assets.remove(this.cacheState.map, key.current);
901
- size = size - 1;
902
- loop = size > this.capacity;
903
- }
904
- } else {
905
- loop = false;
906
- }
907
- }
908
- assets.set(this.cacheState.updating, false);
909
- }
910
- }
911
- hasExpired(clock, timeToLiveMillis) {
912
- return clock.unsafeCurrentTimeMillis() > timeToLiveMillis;
913
- }
914
- lookupValueOf(input, deferred) {
915
- return assets.clockWith(clock => assets.suspend(() => {
916
- const key = input;
917
- return assets.pipe(this.lookup(input), assets.provideContext(this.context), assets.exit$1, assets.flatMap(exit => {
918
- const now = clock.unsafeCurrentTimeMillis();
919
- const stats = makeEntryStats(now);
920
- const value = complete(makeMapKey(key), exit, stats, now + assets.toMillis(assets.decode(this.timeToLive(exit))));
921
- assets.set$1(this.cacheState.map, key, value);
922
- return assets.zipRight(done(deferred, exit), exit);
923
- }), assets.onInterrupt(() => assets.zipRight(interrupt(deferred), assets.sync(() => {
924
- assets.remove(this.cacheState.map, key);
925
- }))));
926
- }));
927
- }
928
- }
929
- /** @internal */
930
- const make$1 = options => {
931
- const timeToLive = assets.decode(options.timeToLive);
932
- return makeWith({
933
- capacity: options.capacity,
934
- lookup: options.lookup,
935
- timeToLive: () => timeToLive
936
- });
937
- };
938
- /** @internal */
939
- const makeWith = options => assets.map$1(assets.all$1([assets.context(), assets.fiberId]), ([context, fiberId]) => new CacheImpl(options.capacity, context, fiberId, options.lookup, exit => assets.decode(options.timeToLive(exit))));
940
-
941
- /**
942
- * Constructs a new cache with the specified capacity, time to live, and
943
- * lookup function.
944
- *
945
- * @since 2.0.0
946
- * @category constructors
947
- */
948
- const make = make$1;
949
-
950
- class FetchError extends assets.TaggedError('FetchError') {
951
- }
952
- class NotFoundError extends assets.TaggedError('NotFoundError') {
953
- }
954
- const httpClient = (input, init) => assets.gen(function* () {
955
- const response = yield* assets.tryPromise({
956
- try: () => fetch(input, init),
957
- catch: error => new FetchError({ cause: error }),
958
- });
959
- if (response.status === 404) {
960
- return yield* new NotFoundError({ url: response.url });
961
- }
962
- return response;
963
- });
964
- class ResponseTextError extends assets.TaggedError('ResponseTextError') {
965
- constructor(error) {
966
- super(new Error(`Failed to read response text`, { cause: error }));
967
- }
968
- }
969
- const responseAsText = (res) => assets.tryPromise({
970
- try: () => res.text(),
971
- catch: error => new ResponseTextError(error),
972
- });
973
-
974
- const SVGString = refined(isValidSVG, () => error('SVG data is malformed'));
975
- class BrandValidationError extends assets.TaggedError('BrandValidationError') {
976
- constructor(error, type) {
977
- super(new Error(`Brand validation failed for type ${type}.`, { cause: error }));
978
- }
979
- }
980
- const createValidSVGString = (svg) => assets.try_({
981
- try: () => SVGString(svg),
982
- catch: error => new BrandValidationError(error, 'SVGString'),
983
- });
984
- function isValidSVG(svg) {
985
- if (typeof svg !== 'string') {
986
- return false;
987
- }
988
- try {
989
- const parser = new DOMParser();
990
- const doc = parser.parseFromString(svg, 'image/svg+xml');
991
- return doc.documentElement.nodeName === 'svg';
992
- }
993
- catch {
994
- return false;
995
- }
996
- }
997
-
998
- const emptyDefaultSvg = () => SVGString(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"></svg>`);
999
- const createIconCache = () => make({
1000
- capacity: 200,
1001
- timeToLive: assets.infinity,
1002
- lookup: (key) => assets.gen(function* () {
1003
- const name = key;
1004
- const assetPath = yield* assets.syncCreateAssetUrlSafely(`${name}.svg`, 'icons');
1005
- const res = yield* httpClient(assetPath);
1006
- const responseString = yield* responseAsText(res);
1007
- return yield* createValidSVGString(responseString);
1008
- }),
1009
- });
1010
- let cacheInstance = null;
1011
- function fetchIconSvg(name) {
1012
- const key = name;
1013
- return assets.gen(function* () {
1014
- if (!cacheInstance) {
1015
- cacheInstance = yield* createIconCache();
1016
- }
1017
- return yield* cacheInstance.get(key);
1018
- });
1019
- }
1020
- function clearIconCache() {
1021
- return assets.gen(function* () {
1022
- if (cacheInstance) {
1023
- yield* cacheInstance.invalidateAll;
1024
- }
1025
- else {
1026
- assets.logWarning('Attempted to clear icon cache before it was initialized');
1027
- }
1028
- });
1029
- }
1030
-
1031
- exports.EmptyMutableQueue = EmptyMutableQueue;
1032
- exports._await = _await;
1033
- exports.all = all;
1034
- exports.bounded = bounded;
1035
- exports.capacity = capacity;
1036
- exports.clearIconCache = clearIconCache;
1037
- exports.die = die;
1038
- exports.emptyDefaultSvg = emptyDefaultSvg;
1039
- exports.fail = fail;
1040
- exports.failCause = failCause;
1041
- exports.failCause$1 = failCause$1;
1042
- exports.fetchIconSvg = fetchIconSvg;
1043
- exports.isDone = isDone;
1044
- exports.isEmpty = isEmpty;
1045
- exports.isFailure = isFailure;
1046
- exports.isSuccess = isSuccess;
1047
- exports.length = length;
1048
- exports.make = make$3;
1049
- exports.map = map;
1050
- exports.match = match;
1051
- exports.offer = offer;
1052
- exports.offerAll = offerAll;
1053
- exports.poll = poll;
1054
- exports.pollUpTo = pollUpTo;
1055
- exports.succeed = succeed;
1056
- exports.succeed$1 = succeed$1;
1057
- exports.unbounded = unbounded;
1058
- exports.void_ = void_;
1059
- exports.zip = zip;
1060
- exports.zipRight = zipRight;
1061
- //# sourceMappingURL=icons-jn_Uak9B.js.map
1062
-
1063
- //# sourceMappingURL=icons-jn_Uak9B.js.map