@lmvz-ds/components 0.17.3 → 0.18.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.
- package/CHANGELOG.md +18 -0
- package/README.md +3 -0
- package/cjs/{aria-loader-W9Zvc9e-.js → aria-loader-CfFuAbJn.js} +2 -2
- package/cjs/icons-swqMn6s2.js +163 -0
- package/cjs/{index-BNm4PQrX.js → index--7IqZZqn.js} +12179 -516
- package/cjs/index.cjs.js +6 -85
- package/cjs/lmvz-action.cjs.entry.js +1 -1
- package/cjs/lmvz-button.cjs.entry.js +4 -4
- package/cjs/lmvz-card.cjs.entry.js +24 -4
- package/cjs/lmvz-chip.cjs.entry.js +1 -1
- package/cjs/lmvz-components.cjs.js +1 -1
- package/cjs/lmvz-header_2.cjs.entry.js +5 -5
- package/cjs/lmvz-icon.cjs.entry.js +24 -13
- package/cjs/lmvz-input.cjs.entry.js +5 -5
- package/cjs/lmvz-menuitem.cjs.entry.js +4 -4
- package/cjs/lmvz-select.cjs.entry.js +4 -4
- package/cjs/loader.cjs.js +1 -1
- package/cjs/logger-Bn2yoZGP.js +7189 -0
- package/cjs/{reactive-controller-host-B_davRfI.js → reactive-controller-host-CtaVAiYJ.js} +27 -23
- package/collection/api/ds.constants.js +0 -66
- package/collection/collection-manifest.json +1 -1
- package/collection/components/lmvz-action/lmvz-action.js +1 -1
- package/collection/components/lmvz-button/lmvz-button.css +2 -2
- package/collection/components/lmvz-button/lmvz-button.js +5 -5
- package/collection/components/lmvz-card/lmvz-card.css +5 -5
- package/collection/components/lmvz-card/lmvz-card.js +1 -1
- package/collection/components/lmvz-chip/lmvz-chip.js +1 -1
- package/collection/components/lmvz-header/lmvz-header.js +2 -2
- package/collection/components/lmvz-icon/lmvz-icon.css +13 -13
- package/collection/components/lmvz-icon/lmvz-icon.js +49 -18
- package/collection/components/lmvz-input/lmvz-input.css +1 -1
- package/collection/components/lmvz-input/lmvz-input.js +6 -6
- package/collection/components/lmvz-menuitem/lmvz-menuitem.css +2 -2
- package/collection/components/lmvz-menuitem/lmvz-menuitem.js +1 -1
- package/collection/components/lmvz-select/lmvz-select.css +3 -3
- package/collection/components/lmvz-select/lmvz-select.js +1 -1
- package/collection/index.js +1 -2
- package/collection/integration/header-integration/header-integration.js +51 -0
- package/collection/utils/aria/aria-validation-controller.js +27 -23
- package/collection/utils/http.js +10 -13
- package/collection/utils/icons/icons-registry.js +34 -0
- package/collection/utils/icons/icons.js +49 -0
- package/collection/utils/icons/icons.unit.js +73 -0
- package/collection/utils/icons/public.js +2 -0
- package/collection/utils/public.js +1 -1
- package/components/index.d.ts +9 -9
- package/components/index.d.ts.bak +10 -10
- package/components/index.js +1 -1
- package/components/lmvz-action.d.ts +1 -1
- package/components/lmvz-action.d.ts.bak +11 -0
- package/components/lmvz-action.js +1 -1
- package/components/lmvz-button.d.ts +1 -1
- package/components/lmvz-button.d.ts.bak +11 -0
- package/components/lmvz-button.js +1 -1
- package/components/lmvz-card.d.ts +1 -1
- package/components/lmvz-card.d.ts.bak +11 -0
- package/components/lmvz-card.js +1 -1
- package/components/lmvz-chip.d.ts +1 -1
- package/components/lmvz-chip.d.ts.bak +11 -0
- package/components/lmvz-chip.js +1 -1
- package/components/lmvz-header.d.ts +1 -1
- package/components/lmvz-header.d.ts.bak +11 -0
- package/components/lmvz-header.js +1 -1
- package/components/lmvz-icon.d.ts +1 -1
- package/components/lmvz-icon.d.ts.bak +11 -0
- package/components/lmvz-icon.js +1 -1
- package/components/lmvz-input.d.ts +1 -1
- package/components/lmvz-input.d.ts.bak +11 -0
- package/components/lmvz-input.js +1 -1
- package/components/lmvz-menuitem.d.ts +1 -1
- package/components/lmvz-menuitem.d.ts.bak +11 -0
- package/components/lmvz-menuitem.js +1 -1
- package/components/lmvz-select.d.ts +1 -1
- package/components/lmvz-select.d.ts.bak +11 -0
- package/components/lmvz-select.js +1 -1
- package/components/{p-Clo63DJF.js → p-CBLAeife.js} +1 -1
- package/components/p-DXOTa5VF.js +12 -0
- package/components/p-fiRXhuXK.js +1 -0
- package/esm/{aria-loader-D9aySMw6.js → aria-loader-BF_AYtbb.js} +2 -2
- package/esm/icons-Ca8oMiRa.js +157 -0
- package/esm/{index-n6jVNpyp.js → index-7Ru1khgk.js} +11972 -309
- package/esm/index.js +4 -80
- package/esm/lmvz-action.entry.js +1 -1
- package/esm/lmvz-button.entry.js +4 -4
- package/esm/lmvz-card.entry.js +23 -4
- package/esm/lmvz-chip.entry.js +1 -1
- package/esm/lmvz-components.js +1 -1
- package/esm/lmvz-header_2.entry.js +5 -5
- package/esm/lmvz-icon.entry.js +24 -13
- package/esm/lmvz-input.entry.js +5 -5
- package/esm/lmvz-menuitem.entry.js +4 -4
- package/esm/lmvz-select.entry.js +4 -4
- package/esm/loader.js +1 -1
- package/esm/logger-fiRXhuXK.js +6990 -0
- package/esm/{reactive-controller-host-ByKmPKq1.js → reactive-controller-host-sR2jJxNG.js} +27 -23
- package/hydrate/index.js +78 -3842
- package/hydrate/index.mjs +78 -3842
- package/lmvz-components/index.esm.js +1 -1
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/p-0f645295.entry.js +1 -0
- package/lmvz-components/{p-986acfd0.entry.js → p-1506fa34.entry.js} +1 -1
- package/lmvz-components/p-658c5c34.entry.js +1 -0
- package/lmvz-components/{p-1bda378c.entry.js → p-80675ee5.entry.js} +1 -1
- package/lmvz-components/p-872e2106.entry.js +1 -0
- package/lmvz-components/p-93038c98.entry.js +1 -0
- package/lmvz-components/{p-CU4XwA2K.js → p-B3dnXEPG.js} +1 -1
- package/lmvz-components/p-Bh2Epkwf.js +1 -0
- package/lmvz-components/{p-DPHHQR5F.js → p-Bkfdgg0T.js} +1 -1
- package/lmvz-components/p-DXOTa5VF.js +12 -0
- package/lmvz-components/p-bbab5471.entry.js +1 -0
- package/lmvz-components/p-c7e368c4.entry.js +1 -0
- package/lmvz-components/{p-b704eca8.entry.js → p-ff6a0267.entry.js} +1 -1
- package/lmvz-components/p-fiRXhuXK.js +1 -0
- package/manifest.json +64 -283
- package/package.json +4 -2
- package/types/api/ds.constants.d.ts +22 -1
- package/types/api/ds.types.d.ts +3 -38
- package/types/api/index.d.ts +0 -1
- package/types/components/lmvz-action/lmvz-action.d.ts +1 -0
- package/types/components/lmvz-button/lmvz-button.d.ts +2 -2
- package/types/components/lmvz-card/lmvz-card.d.ts +1 -0
- package/types/components/lmvz-chip/lmvz-chip.d.ts +1 -0
- package/types/components/lmvz-header/lmvz-header.d.ts +1 -0
- package/types/components/lmvz-icon/lmvz-icon.d.ts +4 -1
- package/types/components/lmvz-input/lmvz-input.d.ts +1 -0
- package/types/components/lmvz-menuitem/lmvz-menuitem.d.ts +1 -0
- package/types/components/lmvz-select/lmvz-select.d.ts +1 -0
- package/types/components.d.ts +747 -931
- package/types/index.d.ts +2 -2
- package/types/utils/aria/aria-validation-controller.d.ts +1 -0
- package/types/utils/aria/element-activation-controller.d.ts +1 -0
- package/types/utils/aria/list-keyboard-controller.d.ts +1 -0
- package/types/utils/assets.d.ts +1 -0
- package/types/utils/component.d.ts +2 -4
- package/types/utils/environment.d.ts +1 -0
- package/types/utils/http.d.ts +11 -8
- package/types/utils/http.unit.d.ts +1 -0
- package/types/utils/icons/icons-registry.d.ts +13 -0
- package/types/utils/icons/icons.d.ts +8 -0
- package/types/utils/icons/icons.unit.d.ts +8 -0
- package/types/utils/icons/public.d.ts +4 -0
- package/types/utils/public.d.ts +2 -1
- package/types/utils/reactive-controller-host.d.ts +1 -0
- package/assets/.DS_Store +0 -0
- package/assets/icons/.DS_Store +0 -0
- package/assets/icons/actions.svg +0 -5
- package/assets/icons/adduser.svg +0 -3
- package/assets/icons/alert.svg +0 -3
- package/assets/icons/apple.svg +0 -3
- package/assets/icons/arrow-down.svg +0 -3
- package/assets/icons/arrow-left.svg +0 -3
- package/assets/icons/arrow-right.svg +0 -3
- package/assets/icons/arrow-up.svg +0 -3
- package/assets/icons/book.svg +0 -3
- package/assets/icons/bookmark.svg +0 -3
- package/assets/icons/checkmark.svg +0 -3
- package/assets/icons/chevron-left.svg +0 -3
- package/assets/icons/chevron-right.svg +0 -3
- package/assets/icons/chevron-up.svg +0 -3
- package/assets/icons/close-l.svg +0 -3
- package/assets/icons/close-sm.svg +0 -3
- package/assets/icons/cog.svg +0 -4
- package/assets/icons/computer.svg +0 -3
- package/assets/icons/dashboard.svg +0 -6
- package/assets/icons/delete.svg +0 -3
- package/assets/icons/download.svg +0 -3
- package/assets/icons/edit.svg +0 -3
- package/assets/icons/external.svg +0 -3
- package/assets/icons/facebook.svg +0 -3
- package/assets/icons/favorite.svg +0 -3
- package/assets/icons/filter.svg +0 -3
- package/assets/icons/group.svg +0 -3
- package/assets/icons/hide.svg +0 -3
- package/assets/icons/home.svg +0 -3
- package/assets/icons/info.svg +0 -3
- package/assets/icons/instagram.svg +0 -3
- package/assets/icons/letter.svg +0 -3
- package/assets/icons/linkedin.svg +0 -5
- package/assets/icons/logout.svg +0 -3
- package/assets/icons/map.svg +0 -3
- package/assets/icons/minus.svg +0 -3
- package/assets/icons/navigation.svg +0 -3
- package/assets/icons/plus.svg +0 -3
- package/assets/icons/qr-scan.svg +0 -3
- package/assets/icons/question.svg +0 -10
- package/assets/icons/reader.svg +0 -3
- package/assets/icons/reset.svg +0 -3
- package/assets/icons/school.svg +0 -3
- package/assets/icons/search.svg +0 -3
- package/assets/icons/send.svg +0 -3
- package/assets/icons/settings.svg +0 -3
- package/assets/icons/share.svg +0 -10
- package/assets/icons/shopping-cart.svg +0 -3
- package/assets/icons/show.svg +0 -3
- package/assets/icons/snapchat.svg +0 -3
- package/assets/icons/sort.svg +0 -3
- package/assets/icons/speech-bubble.svg +0 -3
- package/assets/icons/star.svg +0 -3
- package/assets/icons/student.svg +0 -3
- package/assets/icons/upload.svg +0 -3
- package/assets/icons/user.svg +0 -3
- package/assets/icons/warn-circle.svg +0 -3
- package/assets/icons/warn-triangle.svg +0 -3
- package/assets/icons/whatsapp.svg +0 -4
- package/assets/icons/world.svg +0 -10
- package/assets/icons/x.svg +0 -3
- package/assets/icons/youtube.svg +0 -3
- package/cjs/Effect-YVFLBEfy.js +0 -19037
- package/cjs/assets-DxYhun-q.js +0 -26
- package/cjs/icons-DgYgcKGK.js +0 -653
- package/collection/api/index.js +0 -1
- package/collection/assets/.DS_Store +0 -0
- package/collection/assets/icons/.DS_Store +0 -0
- package/collection/assets/icons/actions.svg +0 -5
- package/collection/assets/icons/adduser.svg +0 -3
- package/collection/assets/icons/alert.svg +0 -3
- package/collection/assets/icons/apple.svg +0 -3
- package/collection/assets/icons/arrow-down.svg +0 -3
- package/collection/assets/icons/arrow-left.svg +0 -3
- package/collection/assets/icons/arrow-right.svg +0 -3
- package/collection/assets/icons/arrow-up.svg +0 -3
- package/collection/assets/icons/book.svg +0 -3
- package/collection/assets/icons/bookmark.svg +0 -3
- package/collection/assets/icons/checkmark.svg +0 -3
- package/collection/assets/icons/chevron-left.svg +0 -3
- package/collection/assets/icons/chevron-right.svg +0 -3
- package/collection/assets/icons/chevron-up.svg +0 -3
- package/collection/assets/icons/close-l.svg +0 -3
- package/collection/assets/icons/close-sm.svg +0 -3
- package/collection/assets/icons/cog.svg +0 -4
- package/collection/assets/icons/computer.svg +0 -3
- package/collection/assets/icons/dashboard.svg +0 -6
- package/collection/assets/icons/delete.svg +0 -3
- package/collection/assets/icons/download.svg +0 -3
- package/collection/assets/icons/edit.svg +0 -3
- package/collection/assets/icons/external.svg +0 -3
- package/collection/assets/icons/facebook.svg +0 -3
- package/collection/assets/icons/favorite.svg +0 -3
- package/collection/assets/icons/filter.svg +0 -3
- package/collection/assets/icons/group.svg +0 -3
- package/collection/assets/icons/hide.svg +0 -3
- package/collection/assets/icons/home.svg +0 -3
- package/collection/assets/icons/info.svg +0 -3
- package/collection/assets/icons/instagram.svg +0 -3
- package/collection/assets/icons/letter.svg +0 -3
- package/collection/assets/icons/linkedin.svg +0 -5
- package/collection/assets/icons/logout.svg +0 -3
- package/collection/assets/icons/map.svg +0 -3
- package/collection/assets/icons/minus.svg +0 -3
- package/collection/assets/icons/navigation.svg +0 -3
- package/collection/assets/icons/plus.svg +0 -3
- package/collection/assets/icons/qr-scan.svg +0 -3
- package/collection/assets/icons/question.svg +0 -10
- package/collection/assets/icons/reader.svg +0 -3
- package/collection/assets/icons/reset.svg +0 -3
- package/collection/assets/icons/school.svg +0 -3
- package/collection/assets/icons/search.svg +0 -3
- package/collection/assets/icons/send.svg +0 -3
- package/collection/assets/icons/settings.svg +0 -3
- package/collection/assets/icons/share.svg +0 -10
- package/collection/assets/icons/shopping-cart.svg +0 -3
- package/collection/assets/icons/show.svg +0 -3
- package/collection/assets/icons/snapchat.svg +0 -3
- package/collection/assets/icons/sort.svg +0 -3
- package/collection/assets/icons/speech-bubble.svg +0 -3
- package/collection/assets/icons/star.svg +0 -3
- package/collection/assets/icons/student.svg +0 -3
- package/collection/assets/icons/upload.svg +0 -3
- package/collection/assets/icons/user.svg +0 -3
- package/collection/assets/icons/warn-circle.svg +0 -3
- package/collection/assets/icons/warn-triangle.svg +0 -3
- package/collection/assets/icons/whatsapp.svg +0 -4
- package/collection/assets/icons/world.svg +0 -10
- package/collection/assets/icons/x.svg +0 -3
- package/collection/assets/icons/youtube.svg +0 -3
- package/collection/components/lmvz-icon/icons.js +0 -36
- package/collection/components/lmvz-icon/public.js +0 -1
- package/collection/components/lmvz-icon/test/icons.unit.js +0 -98
- package/collection/integration/header-integration.js +0 -46
- package/collection/utils/effect.js +0 -6
- package/collection/utils/validation/svg.js +0 -24
- package/components/p-CYcWxAp5.js +0 -1
- package/components/p-DHtXOUVf.js +0 -1
- package/components/p-VkiNs_yz.js +0 -12
- package/esm/Effect-DkwJP3kx.js +0 -18828
- package/esm/assets-_WDisN-f.js +0 -23
- package/esm/icons-Crg18Lio.js +0 -649
- package/lmvz-components/p-121f74d8.entry.js +0 -1
- package/lmvz-components/p-373a9cbf.entry.js +0 -1
- package/lmvz-components/p-43e295ba.entry.js +0 -1
- package/lmvz-components/p-5f150890.entry.js +0 -1
- package/lmvz-components/p-6d5fa8c4.entry.js +0 -1
- package/lmvz-components/p-BT8PQPMJ.js +0 -1
- package/lmvz-components/p-BxiCs9Wn.js +0 -1
- package/lmvz-components/p-CXQcJLbG.js +0 -12
- package/lmvz-components/p-DkwJP3kx.js +0 -1
- package/lmvz-components/p-abbfa6aa.entry.js +0 -1
- package/types/components/lmvz-icon/icons.d.ts +0 -8
- package/types/components/lmvz-icon/public.d.ts +0 -1
- package/types/components/lmvz-icon/test/icons.unit.d.ts +0 -1
- package/types/utils/effect.d.ts +0 -3
- package/types/utils/validation/svg.d.ts +0 -11
package/hydrate/index.js
CHANGED
|
@@ -4153,7 +4153,7 @@ var braceExpand = (pattern, options = {}) => {
|
|
|
4153
4153
|
minimatch.braceExpand = braceExpand;
|
|
4154
4154
|
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
4155
4155
|
minimatch.makeRe = makeRe;
|
|
4156
|
-
var match
|
|
4156
|
+
var match = (list, pattern, options = {}) => {
|
|
4157
4157
|
const mm = new Minimatch(pattern, options);
|
|
4158
4158
|
list = list.filter((f) => mm.match(f));
|
|
4159
4159
|
if (mm.options.nonull && !list.length) {
|
|
@@ -4161,7 +4161,7 @@ var match$1 = (list, pattern, options = {}) => {
|
|
|
4161
4161
|
}
|
|
4162
4162
|
return list;
|
|
4163
4163
|
};
|
|
4164
|
-
minimatch.match = match
|
|
4164
|
+
minimatch.match = match;
|
|
4165
4165
|
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
4166
4166
|
var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
4167
4167
|
var _Minimatch_instances, matchGlobstar_fn, matchGlobStarBodySections_fn, matchOne_fn;
|
|
@@ -5359,7 +5359,7 @@ class LmvzAction {
|
|
|
5359
5359
|
this.actionClick.emit(event);
|
|
5360
5360
|
}
|
|
5361
5361
|
render() {
|
|
5362
|
-
return (hAsync(Host, { key: '
|
|
5362
|
+
return (hAsync(Host, { key: '00da873d80f00dc57e5a0d60f2b58a6c505e41f1', onClick: this._onClick.bind(this) }, hAsync("slot", { key: '7938b5e172ef2b027180aac801b0d9962cd68fa5' })));
|
|
5363
5363
|
}
|
|
5364
5364
|
static get style() { return lmvzActionCss(); }
|
|
5365
5365
|
static get cmpMeta() { return {
|
|
@@ -5483,7 +5483,10 @@ function resolvePossiblyAsyncFunction(func, args = []) {
|
|
|
5483
5483
|
return Promise.resolve(res);
|
|
5484
5484
|
}
|
|
5485
5485
|
|
|
5486
|
-
const
|
|
5486
|
+
const hasProcessStdout = typeof process === "object" && process !== null && typeof process.stdout === "object" && process.stdout !== null;
|
|
5487
|
+
hasProcessStdout && process.stdout.isTTY === true;
|
|
5488
|
+
|
|
5489
|
+
const GLOBAL_STATE_KEY = Symbol('LMVZ__ariaValidationRuntimeState');
|
|
5487
5490
|
const ARIA_VALIDATION_RUNTIME_CHANGED_EVENT = 'lmvz:aria-validation-runtime-changed';
|
|
5488
5491
|
function getRuntimeState() {
|
|
5489
5492
|
const globalState = globalThis;
|
|
@@ -5584,25 +5587,6 @@ class AriaValidationController {
|
|
|
5584
5587
|
this.host.validationSlot?.addEventListener('slotchange', this.enqueueValidation.bind(this));
|
|
5585
5588
|
}
|
|
5586
5589
|
observeVisibilityOnce() {
|
|
5587
|
-
window.setTimeout(() => {
|
|
5588
|
-
if (!this.host.validationEl)
|
|
5589
|
-
return;
|
|
5590
|
-
this.visibilityObserver = new IntersectionObserver((entries) => {
|
|
5591
|
-
for (const entry of entries) {
|
|
5592
|
-
if (entry.target !== this.host.validationEl)
|
|
5593
|
-
continue;
|
|
5594
|
-
if (!entry.isIntersecting)
|
|
5595
|
-
continue;
|
|
5596
|
-
this.checkLazyValidation();
|
|
5597
|
-
this.discardVisibilityObserver();
|
|
5598
|
-
}
|
|
5599
|
-
}, {
|
|
5600
|
-
root: this.host.validationEl?.parentElement,
|
|
5601
|
-
rootMargin: '0px',
|
|
5602
|
-
threshold: 0.01,
|
|
5603
|
-
});
|
|
5604
|
-
this.visibilityObserver.observe(this.host.validationEl);
|
|
5605
|
-
});
|
|
5606
5590
|
}
|
|
5607
5591
|
checkLazyValidation() {
|
|
5608
5592
|
if (!this.elementLoaded)
|
|
@@ -5663,10 +5647,6 @@ class AriaValidationController {
|
|
|
5663
5647
|
});
|
|
5664
5648
|
}
|
|
5665
5649
|
discardVisibilityObserver() {
|
|
5666
|
-
if (!this.visibilityObserver)
|
|
5667
|
-
return;
|
|
5668
|
-
this.visibilityObserver.disconnect();
|
|
5669
|
-
this.visibilityObserver = undefined;
|
|
5670
5650
|
}
|
|
5671
5651
|
}
|
|
5672
5652
|
|
|
@@ -5871,7 +5851,7 @@ class ReactiveControllerHost {
|
|
|
5871
5851
|
}
|
|
5872
5852
|
}
|
|
5873
5853
|
|
|
5874
|
-
const lmvzButtonCss = () => ` @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } } :host { button { --lmvz-button-color: var(--lmvz-component-color, var(--lmvz-semantic-color-int-on-primary, #ffffff)); --lmvz-button-padding-inline: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-padding-block: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); --lmvz-button-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; --lmvz-button-background: var(--lmvz-semantic-color-int-primary, #000000); display: inline-flex; align-items: center; justify-content: center; gap: var(--lmvz-button-gap); padding-block: var(--lmvz-button-padding-block); padding-inline: var(--lmvz-button-padding-inline); border-radius: var(--lmvz-button-radius); border: var(--lmvz-button-border-width) solid var(--lmvz-button-border-color); background-color: var(--lmvz-button-background); color: var(--lmvz-button-color); cursor: pointer; font: var(--lmvz-button-font); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; } button > * { font: inherit; color: inherit; } button:focus-visible { outline: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-status-
|
|
5854
|
+
const lmvzButtonCss = () => ` @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } } :host { button { --lmvz-button-color: var(--lmvz-component-color, var(--lmvz-semantic-color-int-on-primary, #ffffff)); --lmvz-button-padding-inline: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-padding-block: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); --lmvz-button-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; --lmvz-button-background: var(--lmvz-semantic-color-int-primary, #000000); display: inline-flex; align-items: center; justify-content: center; gap: var(--lmvz-button-gap); padding-block: var(--lmvz-button-padding-block); padding-inline: var(--lmvz-button-padding-inline); border-radius: var(--lmvz-button-radius); border: var(--lmvz-button-border-width) solid var(--lmvz-button-border-color); background-color: var(--lmvz-button-background); color: var(--lmvz-button-color); cursor: pointer; font: var(--lmvz-button-font); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; } button > * { font: inherit; color: inherit; } button:focus-visible { outline: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-status-active, #f1f9fe); outline-offset: var(--lmvz-component-input-sm-padding-x, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); } button:is([disabled], .disabled) { cursor: not-allowed; pointer-events: none; opacity: var(--lmvz-component-input-disabled-opacity, 40%); } button:not([disabled]):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-hover, #2e2e2e); } button:not([disabled]):active { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-active, #545454); } button.secondary { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-button-border-width: var(--lmvz-semantic-border-width-default, 1px); --lmvz-button-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); } button.secondary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --lmvz-button-border-color: var(--lmvz-semantic-color-border-hover, #c7c7c7); } button.secondary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-active, #d4d4d4); --lmvz-button-border-color: var(--lmvz-semantic-color-border-active, #0f8acc); } button.tertiary { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); --lmvz-button-color: var(--lmvz-semantic-color-int-on-tertiary, #545454); } button.tertiary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); } button.tertiary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); } button.small { --lmvz-button-padding-inline: var(--lmvz-component-input-sm-padding-x, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-button-padding-block: var(--lmvz-component-input-sm-padding-y, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-button-gap: var(--lmvz-component-input-sm-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } button.large { --lmvz-button-padding-inline: var(--lmvz-component-input-lg-padding-x, clamp(0.88rem, 0.78rem + 0.39vw, 1.25rem)); --lmvz-button-padding-block: var(--lmvz-component-input-lg-padding-y, clamp(0.88rem, 0.78rem + 0.39vw, 1.25rem)); --lmvz-button-gap: var(--lmvz-component-input-lg-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); } display: contents; } ::slotted(*) { --lmvz-component-color: var(--lmvz-button-color); } `;
|
|
5875
5855
|
|
|
5876
5856
|
class LmvzButton extends ReactiveControllerHost {
|
|
5877
5857
|
get el() { return getElement(this); }
|
|
@@ -5928,7 +5908,7 @@ class LmvzButton extends ReactiveControllerHost {
|
|
|
5928
5908
|
};
|
|
5929
5909
|
render() {
|
|
5930
5910
|
this.renderHiddenButton();
|
|
5931
|
-
return (hAsync(Host, { key: '
|
|
5911
|
+
return (hAsync(Host, { key: '1448b16151418790d0a78eda2248b7d61fd8e32b', "aria-disabled": this.disabled ? 'true' : null }, hAsync("button", { key: '2cf7ccc0692179b68aaea534a7a4d11dbcbe27b5', ref: (e) => (this.validationEl = e), disabled: this.disabled, class: classNames(this.variant, { [this.scale ?? '']: !!this.scale, disabled: this.disabled }), ...this.inheritedAttributes }, hAsync("slot", { key: '8fd9f99f8c79657fd3dbeafb2fd88ca667bc0d44' }))));
|
|
5932
5912
|
}
|
|
5933
5913
|
static get delegatesFocus() { return true; }
|
|
5934
5914
|
static get style() { return lmvzButtonCss(); }
|
|
@@ -5969,7 +5949,7 @@ function joinPath(...parts) {
|
|
|
5969
5949
|
return parts.filter(Boolean).join('/').replace('//', '/').replace('/./', '/');
|
|
5970
5950
|
}
|
|
5971
5951
|
|
|
5972
|
-
const lmvzCardCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } } .sc-lmvz-card-h { button { --lmvz-button-color: var(--lmvz-component-color, var(--lmvz-semantic-color-int-on-primary, #ffffff)); --lmvz-button-padding-inline: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-padding-block: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); --lmvz-button-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; --lmvz-button-background: var(--lmvz-semantic-color-int-primary, #000000); display: inline-flex; align-items: center; justify-content: center; gap: var(--lmvz-button-gap); padding-block: var(--lmvz-button-padding-block); padding-inline: var(--lmvz-button-padding-inline); border-radius: var(--lmvz-button-radius); border: var(--lmvz-button-border-width) solid var(--lmvz-button-border-color); background-color: var(--lmvz-button-background); color: var(--lmvz-button-color); cursor: pointer; font: var(--lmvz-button-font); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; } button > * { font: inherit; color: inherit; } button:focus-visible { outline: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-status-
|
|
5952
|
+
const lmvzCardCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } } .sc-lmvz-card-h { button { --lmvz-button-color: var(--lmvz-component-color, var(--lmvz-semantic-color-int-on-primary, #ffffff)); --lmvz-button-padding-inline: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-padding-block: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); --lmvz-button-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; --lmvz-button-background: var(--lmvz-semantic-color-int-primary, #000000); display: inline-flex; align-items: center; justify-content: center; gap: var(--lmvz-button-gap); padding-block: var(--lmvz-button-padding-block); padding-inline: var(--lmvz-button-padding-inline); border-radius: var(--lmvz-button-radius); border: var(--lmvz-button-border-width) solid var(--lmvz-button-border-color); background-color: var(--lmvz-button-background); color: var(--lmvz-button-color); cursor: pointer; font: var(--lmvz-button-font); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; } button > * { font: inherit; color: inherit; } button:focus-visible { outline: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-status-active, #f1f9fe); outline-offset: var(--lmvz-component-input-sm-padding-x, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); } button:is([disabled], .disabled) { cursor: not-allowed; pointer-events: none; opacity: var(--lmvz-component-input-disabled-opacity, 40%); } button:not([disabled]):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-hover, #2e2e2e); } button:not([disabled]):active { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-active, #545454); } button.secondary { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-button-border-width: var(--lmvz-semantic-border-width-default, 1px); --lmvz-button-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); } button.secondary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --lmvz-button-border-color: var(--lmvz-semantic-color-border-hover, #c7c7c7); } button.secondary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-active, #d4d4d4); --lmvz-button-border-color: var(--lmvz-semantic-color-border-active, #0f8acc); } button.tertiary { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); --lmvz-button-color: var(--lmvz-semantic-color-int-on-tertiary, #545454); } button.tertiary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); } button.tertiary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); } button.small { --lmvz-button-padding-inline: var(--lmvz-component-input-sm-padding-x, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-button-padding-block: var(--lmvz-component-input-sm-padding-y, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-button-gap: var(--lmvz-component-input-sm-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } button.large { --lmvz-button-padding-inline: var(--lmvz-component-input-lg-padding-x, clamp(0.88rem, 0.78rem + 0.39vw, 1.25rem)); --lmvz-button-padding-block: var(--lmvz-component-input-lg-padding-y, clamp(0.88rem, 0.78rem + 0.39vw, 1.25rem)); --lmvz-button-gap: var(--lmvz-component-input-lg-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); } display: flex; min-width: var(--lmvz-card-component-card-minwidth, 20.4375rem); max-width: var(--lmvz-card-component-card-maxwidth, 21.6875rem); flex-direction: column; align-items: flex-start; border-radius: var(--lmvz-semantic-border-radius-lg, 14px); border: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-border-default, #e0e0e0); background: var(--lmvz-semantic-color-surface-primary, #ffffff); } *.sc-lmvz-card { color: var(--lmvz-semantic-color-on-surface-primary, #000000); font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } .top.sc-lmvz-card { display: flex; padding: var(--lmvz-dimension-8-12, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); flex-direction: column; justify-content: center; align-items: center; align-self: stretch; } .bottom.sc-lmvz-card { display: flex; min-width: 150px; padding: var(--lmvz-dimension-4-6, clamp(0.25rem, 0.22rem + 0.13vw, 0.38rem)) var(--lmvz-dimension-10-14, clamp(0.63rem, 0.56rem + 0.26vw, 0.88rem)) var(--lmvz-dimension-10-14, clamp(0.63rem, 0.56rem + 0.26vw, 0.88rem)) var(--lmvz-dimension-10-14, clamp(0.63rem, 0.56rem + 0.26vw, 0.88rem)); flex-direction: column; align-items: flex-start; align-self: stretch; } .title.sc-lmvz-card { margin: 0; display: flex; justify-content: center; align-items: center; align-self: stretch; padding-bottom: var(--lmvz-global-s4, 4px); overflow-wrap: break-word; font: var(--lmvz-typography-heading-2xl, 500 clamp(2.25rem, 2.13rem + 0.52vw, 2.75rem) / 1.2 Router); } .description.sc-lmvz-card { display: flex; margin: 0; padding-bottom: var(--lmvz-component-body-sm-padding-bottom, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); align-items: flex-start; align-self: stretch; white-space: pre-line; font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } .image-wrapper.sc-lmvz-card { aspect-ratio: 4 / 3; width: 100%; background-size: cover; background-position: center; flex: 1 0 0; align-self: stretch; border-radius: var(--lmvz-semantic-border-radius-md, 6px); } .actions.sc-lmvz-card { margin-top: var(--lmvz-component-form-wrapper-gap-y, clamp(1.13rem, 0.97rem + 0.65vw, 1.75rem)); display: flex; align-items: center; gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); align-self: stretch; } button.primary.sc-lmvz-card, lmvz-button.primary.sc-lmvz-card { display: flex; justify-content: center; align-items: center; gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); flex: 1 0 0; }`;
|
|
5973
5953
|
|
|
5974
5954
|
class LmvzCard {
|
|
5975
5955
|
constructor(hostRef) {
|
|
@@ -5994,7 +5974,7 @@ class LmvzCard {
|
|
|
5994
5974
|
const imgStyle = {
|
|
5995
5975
|
backgroundImage: `url(${this.imageUrl ?? this.fallbackImage})`,
|
|
5996
5976
|
};
|
|
5997
|
-
return (hAsync(Host, { key: '
|
|
5977
|
+
return (hAsync(Host, { key: 'fceb19eb0d7ad6c6aecfa6fbd5bb6425c7c3e312', role: "article" }, hAsync("div", { key: '4cb516b5dee1f2f84f21984fa350f61fd83c771c', class: "top" }, hAsync("div", { key: '713b2a3245d885a9b99f6c7d54a35053699c1be8', class: "image-wrapper", style: imgStyle }, hAsync("div", { key: 'e8ea65e7f5d11a2335cab950d6bf02208d0b18a1', class: "chip-slot" }, hAsync("slot", { key: 'e9a039742107fdf56216186ddcdf367c4432790b', name: "chip" })))), hAsync("div", { key: '9549e46a1872e0edf298b79435d298aa1ae96a37', class: "bottom" }, hAsync("header", { key: '3bbfb72ecec519d16380ae7e00da4b1ccb6f1cf3' }, hAsync("h2", { key: 'f5a33e498893e61b407c10ab36c9a93b7eecf9f1', class: "title" }, this.cardTitle)), hAsync("p", { key: '19709bb100d014369c836a5a7174772f2d095d2e', class: "description" }, this.description), hAsync("div", { key: '06b5acab3c80cc91865f3aa39da32d42f470348e', class: "actions" }, hAsync("button", { key: '4e954452ac9771359c881aa6b43f11e89e38aecf', class: "primary", onClick: this._onPrimaryClick.bind(this), "data-testid": "primary" }, this.primaryActionLabel), hAsync("button", { key: 'b6a682bf95eb26468c450bed494290565288a515', class: "tertiary", "aria-label": "More actions", onClick: this._onOverflowClick }, hAsync("span", { key: '70a526d1fafd8b7051f6e7107b35d6f594e10d68', class: "icon-placeholder" }, "..."))))));
|
|
5998
5978
|
}
|
|
5999
5979
|
static get assetsDirs() { return ["../../assets"]; }
|
|
6000
5980
|
static get style() { return lmvzCardCss(); }
|
|
@@ -6021,7 +6001,7 @@ class LmvzChip {
|
|
|
6021
6001
|
}
|
|
6022
6002
|
text;
|
|
6023
6003
|
render() {
|
|
6024
|
-
return hAsync(Host, { key: '
|
|
6004
|
+
return hAsync(Host, { key: '134d510fe3a04b989b0005bf31358149a9661cb2' }, this.text);
|
|
6025
6005
|
}
|
|
6026
6006
|
static get style() { return lmvzChipCss(); }
|
|
6027
6007
|
static get cmpMeta() { return {
|
|
@@ -6036,8 +6016,6 @@ class LmvzChip {
|
|
|
6036
6016
|
}; }
|
|
6037
6017
|
}
|
|
6038
6018
|
|
|
6039
|
-
const logoSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDYiIGhlaWdodD0iNzIiIHZpZXdCb3g9IjAgMCA0NiA3MiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzI3Ml80MDUpIj4KPHBhdGggZD0iTTEyLjUgMjAuNjVDMTMuMSAyMC42NSAxNC4yIDIwLjM1IDE0LjcgMjAuMzVDMTYuMSAyMC4zNSAxNy4yIDIxLjQ1IDE3LjIgMjIuODVDMTcuMiAyNC4yNSAxNi4xIDI1LjM1IDE0LjcgMjUuMzVIMi44QzEuMiAyNS4zNSAwIDI0LjE1IDAgMjIuNTVDMCAyMS45NSAwLjIgMjAuNjUgMC4yIDIwLjA1VjUuODQ5OTlDMC4yIDUuMTQ5OTkgMCAzLjk0OTk5IDAgMy4zNDk5OUMwIDEuNzQ5OTkgMS4yIDAuNTQ5OTg4IDIuOCAwLjU0OTk4OEM0LjMgMC41NDk5ODggNS42IDEuNzQ5OTkgNS42IDMuMzQ5OTlDNS42IDMuOTQ5OTkgNS40IDUuMTQ5OTkgNS40IDUuODQ5OTlWMjAuNTVIMTIuNVYyMC42NVpNMjIuMSAyMi43NUMyMi4xIDIyLjE1IDIyLjMgMjAuOTUgMjIuMyAyMC4yNVY1Ljg0OTk5QzIyLjMgNS4xNDk5OSAyMi4xIDMuOTQ5OTkgMjIuMSAzLjQ0OTk5QzIyLjEgMS45NDk5OSAyMy4yIDAuNzQ5OTg4IDI0LjYgMC43NDk5ODhIMjUuMkMyNi40IDAuNzQ5OTg4IDI3LjIgMS41NDk5OSAyNy42IDIuNjQ5OTlMMjggMy40NDk5OUwzMi45IDE0LjA1QzMzLjMgMTQuOTUgMzMuNyAxNi4wNSAzNCAxNi43NUMzNC4zIDE2LjA1IDM0LjcgMTQuOTUgMzUuMSAxNC4wNUw0MCAzLjU0OTk5TDQwLjMgMi41NDk5OUM0MC43IDEuNTQ5OTkgNDEuNSAwLjY0OTk4OCA0Mi42IDAuNjQ5OTg4SDQzLjJDNDQuNyAwLjY0OTk4OCA0NS43IDEuODQ5OTkgNDUuNyAzLjM0OTk5QzQ1LjcgMy45NDk5OSA0NS41IDUuMTQ5OTkgNDUuNSA1Ljc0OTk5VjIwLjE1QzQ1LjUgMjAuODUgNDUuNyAyMi4wNSA0NS43IDIyLjY1QzQ1LjcgMjQuMjUgNDQuNSAyNS40NSA0MyAyNS40NUM0MS40IDI1LjQ1IDQwLjMgMjQuMjUgNDAuMyAyMi42NUM0MC4zIDIxLjk1IDQwLjQgMjAuNzUgNDAuNCAyMC4xNUw0MC42IDE0LjA1QzQwLjYgMTMuMTUgNDAuNyAxMS43NSA0MC43IDEwLjY1TDM3IDE5LjA1QzM2LjcgMTkuNzUgMzYuNiAxOS45NSAzNi40IDIwLjM1QzM2IDIxLjI1IDM1LjMgMjEuODUgMzMuOSAyMS44NUMzMi41IDIxLjg1IDMxLjggMjEuMjUgMzEuNCAyMC40NUMzMS4yIDIwLjA1IDMxLjIgMTkuNzUgMzAuOCAxOS4wNUwyNyAxMC43NUMyNyAxMC43NSAyNy4xIDEzLjE1IDI3LjIgMTQuMDVMMjcuNCAyMC4xNUMyNy40IDIwLjg1IDI3LjUgMjEuOTUgMjcuNSAyMi42NUMyNy41IDI0LjI1IDI2LjQgMjUuNDUgMjQuOCAyNS40NUMyMy4zIDI1LjU1IDIyLjEgMjQuMjUgMjIuMSAyMi43NVpNMjguNyAzMi45NUMyOS4xIDMyLjk1IDMwLjIgMzMuMTUgMzAuNyAzMy4xNUg0MS44QzQyLjMgMzMuMTUgNDMuMiAzMi45NSA0My43IDMyLjk1QzQ0LjkgMzIuOTUgNDUuOCAzMy44NSA0NS44IDM1LjA1QzQ1LjggMzYuMTUgNDQuOSAzNy4xNSA0My43IDM3LjE1QzQzLjMgMzcuMTUgNDIuMyAzNi45NSA0MS44IDM2Ljk1SDMwLjhDMzAuMyAzNi45NSAyOS4yIDM3LjE1IDI4LjggMzcuMTVDMjcuNiAzNy4xNSAyNi43IDM2LjI1IDI2LjcgMzUuMDVDMjYuNiAzMy45NSAyNy41IDMyLjk1IDI4LjcgMzIuOTVaTTIuMSA2Ny4yNUMyLjUgNjcuMjUgMy42IDY3LjQ1IDQuMSA2Ny40NUgxOC41QzE5IDY3LjQ1IDE5LjkgNjcuMjUgMjAuNCA2Ny4yNUMyMS42IDY3LjI1IDIyLjUgNjguMTUgMjIuNSA2OS4zNUMyMi41IDcwLjQ1IDIxLjYgNzEuNDUgMjAuNCA3MS40NUMyMCA3MS40NSAxOSA3MS4yNSAxOC41IDcxLjI1SDQuMUMzLjYgNzEuMjUgMi41IDcxLjQ1IDIuMSA3MS40NUMwLjkgNzEuNDUgMCA3MC41NSAwIDY5LjM1QzAgNjguMjUgMC45IDY3LjI1IDIuMSA2Ny4yNVpNMjEuOSAzNS42NUMyMS45IDM1Ljk1IDIxLjggMzYuMzUgMjEuNiAzNi43NUMyMS4zIDM3LjQ1IDIwLjkgMzguMzUgMjAuNyAzOC44NUwxNC43IDU0LjY1QzE0LjUgNTUuMDUgMTQuNCA1NS41NSAxNC4yIDU2LjM1QzEzLjggNTcuNjUgMTIuNiA1OC4yNSAxMS4yIDU4LjI1SDEwLjhDOS40IDU4LjI1IDguMiA1Ny43NSA3LjggNTYuMzVDNy42IDU1LjU1IDcuNCA1NS4xNSA3LjIgNTQuNjVMMS4yIDM4Ljg1QzEgMzguMzUgMC42IDM3LjU1IDAuMiAzNi44NUMwLjEgMzYuNDUgMCAzNS45NSAwIDM1LjY1QzAgMzQuMTUgMS4yIDMyLjg1IDIuOCAzMi44NUMzLjkgMzIuODUgNSAzMy41NSA1LjMgMzQuNzVDNS41IDM1LjU1IDUuNSAzNi4xNSA2IDM3LjU1TDEwLjIgNDkuNDVDMTAuNSA1MC4zNSAxMC45IDUxLjQ1IDExLjEgNTIuMzVDMTEuMyA1MS40NSAxMS42IDUwLjQ1IDExLjkgNDkuNTVMMTYgMzcuNTVDMTYuNSAzNi4wNSAxNi40IDM1LjY1IDE2LjcgMzQuODVDMTcuMSAzMy42NSAxOC4xIDMyLjg1IDE5LjMgMzIuODVDMjAuOSAzMi44NSAyMS45IDM0LjE1IDIxLjkgMzUuNjVaTTI5LjcgNzEuNDVDMjguMiA3MS40NSAyNy4yIDcwLjQ1IDI3LjIgNjkuMTVDMjcuMiA2OC43NSAyNy4yIDY4LjI1IDI3LjggNjcuNDVMMzcuNCA1My40NUMzNy45IDUyLjc1IDM4LjUgNTIuMDUgMzkuMSA1MS4zNUgzMi4yQzMxLjUgNTEuMzUgMzAuNyA1MS42NSAzMC4xIDUxLjY1QzI4LjcgNTEuNjUgMjcuNiA1MC43NSAyNy42IDQ5LjM1QzI3LjYgNDcuOTUgMjguNyA0Ni45NSAzMC4xIDQ2Ljk1SDQyLjdDNDQuMiA0Ni45NSA0NS4yIDQ3Ljg1IDQ1LjIgNDkuMjVDNDUuMiA0OS42NSA0NSA1MC4zNSA0NC41IDUxLjA1TDM1LjIgNjQuODVDMzQuNyA2NS42NSAzNC4xIDY2LjQ1IDMzLjUgNjcuMDVINDEuMUM0MS45IDY3LjA1IDQyLjcgNjYuNzUgNDMuMyA2Ni43NUM0NC43IDY2Ljc1IDQ1LjcgNjcuNzUgNDUuNyA2OS4wNUM0NS43IDcwLjU1IDQ0LjUgNzEuNTUgNDMuMiA3MS41NUgyOS43VjcxLjQ1WiIgZmlsbD0iYmxhY2siLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8yNzJfNDA1Ij4KPHJlY3Qgd2lkdGg9IjQ2IiBoZWlnaHQ9IjcyIiBmaWxsPSJ3aGl0ZSIvPgo8L2NsaXBQYXRoPgo8L2RlZnM+Cjwvc3ZnPgo=';
|
|
6040
|
-
|
|
6041
6019
|
class ListKeyboardNavigationController {
|
|
6042
6020
|
host;
|
|
6043
6021
|
elements = [];
|
|
@@ -6084,6 +6062,8 @@ class ListKeyboardNavigationController {
|
|
|
6084
6062
|
}
|
|
6085
6063
|
}
|
|
6086
6064
|
|
|
6065
|
+
const logoSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDYiIGhlaWdodD0iNzIiIHZpZXdCb3g9IjAgMCA0NiA3MiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzI3Ml80MDUpIj4KPHBhdGggZD0iTTEyLjUgMjAuNjVDMTMuMSAyMC42NSAxNC4yIDIwLjM1IDE0LjcgMjAuMzVDMTYuMSAyMC4zNSAxNy4yIDIxLjQ1IDE3LjIgMjIuODVDMTcuMiAyNC4yNSAxNi4xIDI1LjM1IDE0LjcgMjUuMzVIMi44QzEuMiAyNS4zNSAwIDI0LjE1IDAgMjIuNTVDMCAyMS45NSAwLjIgMjAuNjUgMC4yIDIwLjA1VjUuODQ5OTlDMC4yIDUuMTQ5OTkgMCAzLjk0OTk5IDAgMy4zNDk5OUMwIDEuNzQ5OTkgMS4yIDAuNTQ5OTg4IDIuOCAwLjU0OTk4OEM0LjMgMC41NDk5ODggNS42IDEuNzQ5OTkgNS42IDMuMzQ5OTlDNS42IDMuOTQ5OTkgNS40IDUuMTQ5OTkgNS40IDUuODQ5OTlWMjAuNTVIMTIuNVYyMC42NVpNMjIuMSAyMi43NUMyMi4xIDIyLjE1IDIyLjMgMjAuOTUgMjIuMyAyMC4yNVY1Ljg0OTk5QzIyLjMgNS4xNDk5OSAyMi4xIDMuOTQ5OTkgMjIuMSAzLjQ0OTk5QzIyLjEgMS45NDk5OSAyMy4yIDAuNzQ5OTg4IDI0LjYgMC43NDk5ODhIMjUuMkMyNi40IDAuNzQ5OTg4IDI3LjIgMS41NDk5OSAyNy42IDIuNjQ5OTlMMjggMy40NDk5OUwzMi45IDE0LjA1QzMzLjMgMTQuOTUgMzMuNyAxNi4wNSAzNCAxNi43NUMzNC4zIDE2LjA1IDM0LjcgMTQuOTUgMzUuMSAxNC4wNUw0MCAzLjU0OTk5TDQwLjMgMi41NDk5OUM0MC43IDEuNTQ5OTkgNDEuNSAwLjY0OTk4OCA0Mi42IDAuNjQ5OTg4SDQzLjJDNDQuNyAwLjY0OTk4OCA0NS43IDEuODQ5OTkgNDUuNyAzLjM0OTk5QzQ1LjcgMy45NDk5OSA0NS41IDUuMTQ5OTkgNDUuNSA1Ljc0OTk5VjIwLjE1QzQ1LjUgMjAuODUgNDUuNyAyMi4wNSA0NS43IDIyLjY1QzQ1LjcgMjQuMjUgNDQuNSAyNS40NSA0MyAyNS40NUM0MS40IDI1LjQ1IDQwLjMgMjQuMjUgNDAuMyAyMi42NUM0MC4zIDIxLjk1IDQwLjQgMjAuNzUgNDAuNCAyMC4xNUw0MC42IDE0LjA1QzQwLjYgMTMuMTUgNDAuNyAxMS43NSA0MC43IDEwLjY1TDM3IDE5LjA1QzM2LjcgMTkuNzUgMzYuNiAxOS45NSAzNi40IDIwLjM1QzM2IDIxLjI1IDM1LjMgMjEuODUgMzMuOSAyMS44NUMzMi41IDIxLjg1IDMxLjggMjEuMjUgMzEuNCAyMC40NUMzMS4yIDIwLjA1IDMxLjIgMTkuNzUgMzAuOCAxOS4wNUwyNyAxMC43NUMyNyAxMC43NSAyNy4xIDEzLjE1IDI3LjIgMTQuMDVMMjcuNCAyMC4xNUMyNy40IDIwLjg1IDI3LjUgMjEuOTUgMjcuNSAyMi42NUMyNy41IDI0LjI1IDI2LjQgMjUuNDUgMjQuOCAyNS40NUMyMy4zIDI1LjU1IDIyLjEgMjQuMjUgMjIuMSAyMi43NVpNMjguNyAzMi45NUMyOS4xIDMyLjk1IDMwLjIgMzMuMTUgMzAuNyAzMy4xNUg0MS44QzQyLjMgMzMuMTUgNDMuMiAzMi45NSA0My43IDMyLjk1QzQ0LjkgMzIuOTUgNDUuOCAzMy44NSA0NS44IDM1LjA1QzQ1LjggMzYuMTUgNDQuOSAzNy4xNSA0My43IDM3LjE1QzQzLjMgMzcuMTUgNDIuMyAzNi45NSA0MS44IDM2Ljk1SDMwLjhDMzAuMyAzNi45NSAyOS4yIDM3LjE1IDI4LjggMzcuMTVDMjcuNiAzNy4xNSAyNi43IDM2LjI1IDI2LjcgMzUuMDVDMjYuNiAzMy45NSAyNy41IDMyLjk1IDI4LjcgMzIuOTVaTTIuMSA2Ny4yNUMyLjUgNjcuMjUgMy42IDY3LjQ1IDQuMSA2Ny40NUgxOC41QzE5IDY3LjQ1IDE5LjkgNjcuMjUgMjAuNCA2Ny4yNUMyMS42IDY3LjI1IDIyLjUgNjguMTUgMjIuNSA2OS4zNUMyMi41IDcwLjQ1IDIxLjYgNzEuNDUgMjAuNCA3MS40NUMyMCA3MS40NSAxOSA3MS4yNSAxOC41IDcxLjI1SDQuMUMzLjYgNzEuMjUgMi41IDcxLjQ1IDIuMSA3MS40NUMwLjkgNzEuNDUgMCA3MC41NSAwIDY5LjM1QzAgNjguMjUgMC45IDY3LjI1IDIuMSA2Ny4yNVpNMjEuOSAzNS42NUMyMS45IDM1Ljk1IDIxLjggMzYuMzUgMjEuNiAzNi43NUMyMS4zIDM3LjQ1IDIwLjkgMzguMzUgMjAuNyAzOC44NUwxNC43IDU0LjY1QzE0LjUgNTUuMDUgMTQuNCA1NS41NSAxNC4yIDU2LjM1QzEzLjggNTcuNjUgMTIuNiA1OC4yNSAxMS4yIDU4LjI1SDEwLjhDOS40IDU4LjI1IDguMiA1Ny43NSA3LjggNTYuMzVDNy42IDU1LjU1IDcuNCA1NS4xNSA3LjIgNTQuNjVMMS4yIDM4Ljg1QzEgMzguMzUgMC42IDM3LjU1IDAuMiAzNi44NUMwLjEgMzYuNDUgMCAzNS45NSAwIDM1LjY1QzAgMzQuMTUgMS4yIDMyLjg1IDIuOCAzMi44NUMzLjkgMzIuODUgNSAzMy41NSA1LjMgMzQuNzVDNS41IDM1LjU1IDUuNSAzNi4xNSA2IDM3LjU1TDEwLjIgNDkuNDVDMTAuNSA1MC4zNSAxMC45IDUxLjQ1IDExLjEgNTIuMzVDMTEuMyA1MS40NSAxMS42IDUwLjQ1IDExLjkgNDkuNTVMMTYgMzcuNTVDMTYuNSAzNi4wNSAxNi40IDM1LjY1IDE2LjcgMzQuODVDMTcuMSAzMy42NSAxOC4xIDMyLjg1IDE5LjMgMzIuODVDMjAuOSAzMi44NSAyMS45IDM0LjE1IDIxLjkgMzUuNjVaTTI5LjcgNzEuNDVDMjguMiA3MS40NSAyNy4yIDcwLjQ1IDI3LjIgNjkuMTVDMjcuMiA2OC43NSAyNy4yIDY4LjI1IDI3LjggNjcuNDVMMzcuNCA1My40NUMzNy45IDUyLjc1IDM4LjUgNTIuMDUgMzkuMSA1MS4zNUgzMi4yQzMxLjUgNTEuMzUgMzAuNyA1MS42NSAzMC4xIDUxLjY1QzI4LjcgNTEuNjUgMjcuNiA1MC43NSAyNy42IDQ5LjM1QzI3LjYgNDcuOTUgMjguNyA0Ni45NSAzMC4xIDQ2Ljk1SDQyLjdDNDQuMiA0Ni45NSA0NS4yIDQ3Ljg1IDQ1LjIgNDkuMjVDNDUuMiA0OS42NSA0NSA1MC4zNSA0NC41IDUxLjA1TDM1LjIgNjQuODVDMzQuNyA2NS42NSAzNC4xIDY2LjQ1IDMzLjUgNjcuMDVINDEuMUM0MS45IDY3LjA1IDQyLjcgNjYuNzUgNDMuMyA2Ni43NUM0NC43IDY2Ljc1IDQ1LjcgNjcuNzUgNDUuNyA2OS4wNUM0NS43IDcwLjU1IDQ0LjUgNzEuNTUgNDMuMiA3MS41NUgyOS43VjcxLjQ1WiIgZmlsbD0iYmxhY2siLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8yNzJfNDA1Ij4KPHJlY3Qgd2lkdGg9IjQ2IiBoZWlnaHQ9IjcyIiBmaWxsPSJ3aGl0ZSIvPgo8L2NsaXBQYXRoPgo8L2RlZnM+Cjwvc3ZnPgo=';
|
|
6066
|
+
|
|
6087
6067
|
const lmvzHeaderCss = () => `:host{display:flex;width:100vw;flex-direction:row;align-items:center;box-sizing:border-box;background-color:var(--lmvz-semantic-color-surface-primary, #ffffff);--lmvz-header-x-spacing-level-1:var(--lmvz-dimension-8-28, clamp(0.5rem, 0.2rem + 1.29vw, 1.75rem));--lmvz-header-x-spacing-level-2:var(--lmvz-component-buttongroup-wrapper-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem));padding:var(--lmvz-dimension-8-16, clamp(0.5rem, 0.38rem + 0.52vw, 1rem)) var(--lmvz-header-x-spacing-level-1);gap:var(--lmvz-header-x-spacing-level-1);.brand{display:inline-flex;justify-content:center;align-items:center}#fallback-logo-lmvz{height:34px;width:auto}nav{flex-grow:1}.primary-menubar{display:flex;flex-direction:row;align-items:center}.secondary-menubar{display:flex;flex-direction:row;align-items:center;margin-left:var(--lmvz-header-x-spacing-level-2);padding-left:var(--lmvz-header-x-spacing-level-2);border-left:1px solid var(--lmvz-semantic-color-border-default, #e0e0e0)}}`;
|
|
6088
6068
|
|
|
6089
6069
|
class LmvzHeader extends ReactiveControllerHost {
|
|
@@ -6168,7 +6148,7 @@ class LmvzHeader extends ReactiveControllerHost {
|
|
|
6168
6148
|
}
|
|
6169
6149
|
}
|
|
6170
6150
|
render() {
|
|
6171
|
-
return (hAsync(Host, { key: '
|
|
6151
|
+
return (hAsync(Host, { key: '58cf99b555112f6209b6d16047bda2cc0bbf5cde', onFocus: this.delegateFocus.bind(this) }, hAsync("div", { key: 'd9bda5c2a6b9abd6e5ea849fb31a0543c8c36bb7', class: "brand" }, hAsync("slot", { key: 'e1c2c2a0bd69875ecd46ef9f7406ccb52409b570', name: "brand" }, hAsync("img", { key: '8dfca875ffc837f2c413527ea106d640a9b9bb97', id: "fallback-logo-lmvz", src: logoSvg, alt: "Lehrmittelverlag Z\u00FCrich" }))), hAsync("nav", { key: '24ceb7f3ef54399ecb9b7b78418d3be9bb547f60', "aria-label": "Hauptnavigation" }, hAsync("div", { key: 'c9fb6b1850330493e0a26bf20ea04013725025f6', role: "menubar", class: "primary-menubar" }, hAsync("slot", { key: '19640032a28d0a9bd7f5396f7c1acd477135f864', name: "nav-primary", ref: (el) => (this.primarySlot = el) }), hAsync("div", { key: 'c11f19e15c0fea300a771060e2e4c77cce76c20f', role: "menu", id: "nav-secondary", class: "secondary-menubar", hidden: !this.lmvzActiveNav, ref: (el) => (this.secondaryNav = el) }, hAsync("slot", { key: '2df2cf852595a78391bcd7c3dd8b8d6db3847aaa', name: this.secondarySlotName, ref: (el) => (this.secondarySlot = el) })))), hAsync("div", { key: 'c256862d4f5ea38c120218372d9ad73ae19efd74', class: "actions" }, hAsync("slot", { key: '91b5eb2d9ab06005384a28cddee3d6c92afd418c', name: "actions" }))));
|
|
6172
6152
|
}
|
|
6173
6153
|
static get watchers() { return {
|
|
6174
6154
|
"lmvzActiveNav": [{
|
|
@@ -6189,3812 +6169,67 @@ class LmvzHeader extends ReactiveControllerHost {
|
|
|
6189
6169
|
}; }
|
|
6190
6170
|
}
|
|
6191
6171
|
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
*
|
|
6225
|
-
* **Example** (Using arity to determine data-first or data-last style)
|
|
6226
|
-
*
|
|
6227
|
-
* ```ts
|
|
6228
|
-
* import { dual, pipe } from "effect/Function"
|
|
6229
|
-
*
|
|
6230
|
-
* const sum = dual<
|
|
6231
|
-
* (that: number) => (self: number) => number,
|
|
6232
|
-
* (self: number, that: number) => number
|
|
6233
|
-
* >(2, (self, that) => self + that)
|
|
6234
|
-
*
|
|
6235
|
-
* console.log(sum(2, 3)) // 5
|
|
6236
|
-
* console.log(pipe(2, sum(3))) // 5
|
|
6237
|
-
* ```
|
|
6238
|
-
*
|
|
6239
|
-
* **Example** (Using call signatures to define the overloads)
|
|
6240
|
-
*
|
|
6241
|
-
* ```ts
|
|
6242
|
-
* import { dual, pipe } from "effect/Function"
|
|
6243
|
-
*
|
|
6244
|
-
* const sum: {
|
|
6245
|
-
* (that: number): (self: number) => number
|
|
6246
|
-
* (self: number, that: number): number
|
|
6247
|
-
* } = dual(2, (self: number, that: number): number => self + that)
|
|
6248
|
-
*
|
|
6249
|
-
* console.log(sum(2, 3)) // 5
|
|
6250
|
-
* console.log(pipe(2, sum(3))) // 5
|
|
6251
|
-
* ```
|
|
6252
|
-
*
|
|
6253
|
-
* **Example** (Using a predicate to determine data-first or data-last style)
|
|
6254
|
-
*
|
|
6255
|
-
* ```ts
|
|
6256
|
-
* import { dual, pipe } from "effect/Function"
|
|
6257
|
-
*
|
|
6258
|
-
* const sum = dual<
|
|
6259
|
-
* (that: number) => (self: number) => number,
|
|
6260
|
-
* (self: number, that: number) => number
|
|
6261
|
-
* >(
|
|
6262
|
-
* (args) => args.length === 2,
|
|
6263
|
-
* (self, that) => self + that
|
|
6264
|
-
* )
|
|
6265
|
-
*
|
|
6266
|
-
* console.log(sum(2, 3)) // 5
|
|
6267
|
-
* console.log(pipe(2, sum(3))) // 5
|
|
6268
|
-
* ```
|
|
6269
|
-
*
|
|
6270
|
-
* @since 2.0.0
|
|
6271
|
-
*/
|
|
6272
|
-
const dual = function (arity, body) {
|
|
6273
|
-
if (typeof arity === "function") {
|
|
6274
|
-
return function () {
|
|
6275
|
-
if (arity(arguments)) {
|
|
6276
|
-
// @ts-expect-error
|
|
6277
|
-
return body.apply(this, arguments);
|
|
6278
|
-
}
|
|
6279
|
-
return self => body(self, ...arguments);
|
|
6280
|
-
};
|
|
6281
|
-
}
|
|
6282
|
-
switch (arity) {
|
|
6283
|
-
case 0:
|
|
6284
|
-
case 1:
|
|
6285
|
-
throw new RangeError(`Invalid arity ${arity}`);
|
|
6286
|
-
case 2:
|
|
6287
|
-
return function (a, b) {
|
|
6288
|
-
if (arguments.length >= 2) {
|
|
6289
|
-
return body(a, b);
|
|
6290
|
-
}
|
|
6291
|
-
return function (self) {
|
|
6292
|
-
return body(self, a);
|
|
6293
|
-
};
|
|
6294
|
-
};
|
|
6295
|
-
case 3:
|
|
6296
|
-
return function (a, b, c) {
|
|
6297
|
-
if (arguments.length >= 3) {
|
|
6298
|
-
return body(a, b, c);
|
|
6299
|
-
}
|
|
6300
|
-
return function (self) {
|
|
6301
|
-
return body(self, a, b);
|
|
6302
|
-
};
|
|
6303
|
-
};
|
|
6304
|
-
case 4:
|
|
6305
|
-
return function (a, b, c, d) {
|
|
6306
|
-
if (arguments.length >= 4) {
|
|
6307
|
-
return body(a, b, c, d);
|
|
6308
|
-
}
|
|
6309
|
-
return function (self) {
|
|
6310
|
-
return body(self, a, b, c);
|
|
6311
|
-
};
|
|
6312
|
-
};
|
|
6313
|
-
case 5:
|
|
6314
|
-
return function (a, b, c, d, e) {
|
|
6315
|
-
if (arguments.length >= 5) {
|
|
6316
|
-
return body(a, b, c, d, e);
|
|
6172
|
+
const lmvzIconCss = () => `.sc-lmvz-icon-h{--lmvz-icon-color:var(--lmvz-component-color, var(--lmvz-semantic-color-on-surface-input-primary, #000000));display:inline-block;line-height:0;svg{display:block}svg path{stroke:var(--lmvz-icon-color);fill:none}}[size='xs'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem));height:var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem))}}[size='sm'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-sm, clamp(0.88rem, 0.84rem + 0.13vw, 1rem));height:var(--lmvz-component-icon-size-sm, clamp(0.88rem, 0.84rem + 0.13vw, 1rem))}}[size='md'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-md, clamp(1rem, 0.94rem + 0.26vw, 1.25rem));height:var(--lmvz-component-icon-size-md, clamp(1rem, 0.94rem + 0.26vw, 1.25rem))}}[size='lg'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-lg, clamp(1.5rem, 1.44rem + 0.26vw, 1.75rem));height:var(--lmvz-component-icon-size-lg, clamp(1.5rem, 1.44rem + 0.26vw, 1.75rem))}}[size='inherit'].sc-lmvz-icon-h{svg{width:inherit;height:inherit}}[weight='light'].sc-lmvz-icon-h{svg path{stroke-width:1}}[weight='medium'].sc-lmvz-icon-h{svg path{stroke-width:1.5}}[weight='bold'].sc-lmvz-icon-h{svg path{stroke-width:2}}[weight='filled'].sc-lmvz-icon-h{svg path{stroke-width:2;fill:var(--lmvz-icon-color)}}`;
|
|
6173
|
+
|
|
6174
|
+
class LmvzIcon extends ReactiveControllerHost {
|
|
6175
|
+
intersectionObserver;
|
|
6176
|
+
ariaValidationController = new AriaValidationController(this);
|
|
6177
|
+
get el() { return getElement(this); }
|
|
6178
|
+
validationEl;
|
|
6179
|
+
icon;
|
|
6180
|
+
weight = 'medium';
|
|
6181
|
+
size = 'md';
|
|
6182
|
+
iconset;
|
|
6183
|
+
iconData;
|
|
6184
|
+
visible = false;
|
|
6185
|
+
ariaLabel;
|
|
6186
|
+
get ariaHidden() {
|
|
6187
|
+
return !this.ariaLabel;
|
|
6188
|
+
}
|
|
6189
|
+
constructor(hostRef) {
|
|
6190
|
+
super();
|
|
6191
|
+
registerInstance(this, hostRef);
|
|
6192
|
+
this.addController(this.ariaValidationController);
|
|
6193
|
+
}
|
|
6194
|
+
connectedCallback() {
|
|
6195
|
+
this.waitUntilVisible(() => {
|
|
6196
|
+
this.visible = true;
|
|
6197
|
+
this.loadIconPathData();
|
|
6198
|
+
});
|
|
6199
|
+
super.connectedCallback();
|
|
6200
|
+
}
|
|
6201
|
+
disconnectedCallback() {
|
|
6202
|
+
if (this.intersectionObserver && typeof this.intersectionObserver.disconnect === 'function') {
|
|
6203
|
+
this.intersectionObserver.disconnect();
|
|
6317
6204
|
}
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
if (arguments.length >= arity) {
|
|
6325
|
-
// @ts-expect-error
|
|
6326
|
-
return body.apply(this, arguments);
|
|
6327
|
-
}
|
|
6328
|
-
const args = arguments;
|
|
6329
|
-
return function (self) {
|
|
6330
|
-
return body(self, ...args);
|
|
6331
|
-
};
|
|
6332
|
-
};
|
|
6333
|
-
}
|
|
6334
|
-
};
|
|
6335
|
-
/**
|
|
6336
|
-
* The identity function, i.e. A function that returns its input argument.
|
|
6337
|
-
*
|
|
6338
|
-
* @example
|
|
6339
|
-
* ```ts
|
|
6340
|
-
* import * as assert from "node:assert"
|
|
6341
|
-
* import { identity } from "effect/Function"
|
|
6342
|
-
*
|
|
6343
|
-
* assert.deepStrictEqual(identity(5), 5)
|
|
6344
|
-
* ```
|
|
6345
|
-
*
|
|
6346
|
-
* @since 2.0.0
|
|
6347
|
-
*/
|
|
6348
|
-
const identity = a => a;
|
|
6349
|
-
/**
|
|
6350
|
-
* Creates a constant value that never changes.
|
|
6351
|
-
*
|
|
6352
|
-
* This is useful when you want to pass a value to a higher-order function (a function that takes another function as its argument)
|
|
6353
|
-
* and want that inner function to always use the same value, no matter how many times it is called.
|
|
6354
|
-
*
|
|
6355
|
-
* @example
|
|
6356
|
-
* ```ts
|
|
6357
|
-
* import * as assert from "node:assert"
|
|
6358
|
-
* import { constant } from "effect/Function"
|
|
6359
|
-
*
|
|
6360
|
-
* const constNull = constant(null)
|
|
6361
|
-
*
|
|
6362
|
-
* assert.deepStrictEqual(constNull(), null)
|
|
6363
|
-
* assert.deepStrictEqual(constNull(), null)
|
|
6364
|
-
* ```
|
|
6365
|
-
*
|
|
6366
|
-
* @since 2.0.0
|
|
6367
|
-
*/
|
|
6368
|
-
const constant = value => () => value;
|
|
6369
|
-
/**
|
|
6370
|
-
* A thunk that returns always `true`.
|
|
6371
|
-
*
|
|
6372
|
-
* @example
|
|
6373
|
-
* ```ts
|
|
6374
|
-
* import * as assert from "node:assert"
|
|
6375
|
-
* import { constTrue } from "effect/Function"
|
|
6376
|
-
*
|
|
6377
|
-
* assert.deepStrictEqual(constTrue(), true)
|
|
6378
|
-
* ```
|
|
6379
|
-
*
|
|
6380
|
-
* @since 2.0.0
|
|
6381
|
-
*/
|
|
6382
|
-
const constTrue = /*#__PURE__*/constant(true);
|
|
6383
|
-
/**
|
|
6384
|
-
* A thunk that returns always `false`.
|
|
6385
|
-
*
|
|
6386
|
-
* @example
|
|
6387
|
-
* ```ts
|
|
6388
|
-
* import * as assert from "node:assert"
|
|
6389
|
-
* import { constFalse } from "effect/Function"
|
|
6390
|
-
*
|
|
6391
|
-
* assert.deepStrictEqual(constFalse(), false)
|
|
6392
|
-
* ```
|
|
6393
|
-
*
|
|
6394
|
-
* @since 2.0.0
|
|
6395
|
-
*/
|
|
6396
|
-
const constFalse = /*#__PURE__*/constant(false);
|
|
6397
|
-
/**
|
|
6398
|
-
* A thunk that returns always `undefined`.
|
|
6399
|
-
*
|
|
6400
|
-
* @example
|
|
6401
|
-
* ```ts
|
|
6402
|
-
* import * as assert from "node:assert"
|
|
6403
|
-
* import { constUndefined } from "effect/Function"
|
|
6404
|
-
*
|
|
6405
|
-
* assert.deepStrictEqual(constUndefined(), undefined)
|
|
6406
|
-
* ```
|
|
6407
|
-
*
|
|
6408
|
-
* @since 2.0.0
|
|
6409
|
-
*/
|
|
6410
|
-
const constUndefined = /*#__PURE__*/constant(undefined);
|
|
6411
|
-
function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
6412
|
-
switch (arguments.length) {
|
|
6413
|
-
case 1:
|
|
6414
|
-
return a;
|
|
6415
|
-
case 2:
|
|
6416
|
-
return ab(a);
|
|
6417
|
-
case 3:
|
|
6418
|
-
return bc(ab(a));
|
|
6419
|
-
case 4:
|
|
6420
|
-
return cd(bc(ab(a)));
|
|
6421
|
-
case 5:
|
|
6422
|
-
return de(cd(bc(ab(a))));
|
|
6423
|
-
case 6:
|
|
6424
|
-
return ef(de(cd(bc(ab(a)))));
|
|
6425
|
-
case 7:
|
|
6426
|
-
return fg(ef(de(cd(bc(ab(a))))));
|
|
6427
|
-
case 8:
|
|
6428
|
-
return gh(fg(ef(de(cd(bc(ab(a)))))));
|
|
6429
|
-
case 9:
|
|
6430
|
-
return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
|
|
6431
|
-
default:
|
|
6432
|
-
{
|
|
6433
|
-
let ret = arguments[0];
|
|
6434
|
-
for (let i = 1; i < arguments.length; i++) {
|
|
6435
|
-
ret = arguments[i](ret);
|
|
6205
|
+
this.intersectionObserver = undefined;
|
|
6206
|
+
super.disconnectedCallback();
|
|
6207
|
+
}
|
|
6208
|
+
async loadIconPathData() {
|
|
6209
|
+
{
|
|
6210
|
+
return;
|
|
6436
6211
|
}
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
* @category constructors
|
|
6451
|
-
* @since 2.0.0
|
|
6452
|
-
*/
|
|
6453
|
-
const make$2 = isEquivalent => (self, that) => self === that || isEquivalent(self, that);
|
|
6454
|
-
|
|
6455
|
-
/**
|
|
6456
|
-
* The `GlobalValue` module ensures that a single instance of a value is created globally,
|
|
6457
|
-
* even when modules are imported multiple times (e.g., due to mixing CommonJS and ESM builds)
|
|
6458
|
-
* or during hot-reloading in development environments like Next.js or Remix.
|
|
6459
|
-
*
|
|
6460
|
-
* It achieves this by using a versioned global store, identified by a unique `Symbol` tied to
|
|
6461
|
-
* the current version of the `effect` library. The store holds values that are keyed by an identifier,
|
|
6462
|
-
* allowing the reuse of previously computed instances across imports or reloads.
|
|
6463
|
-
*
|
|
6464
|
-
* This pattern is particularly useful in scenarios where frequent reloading can cause services or
|
|
6465
|
-
* single-instance objects to be recreated unnecessarily, such as in development environments with hot-reloading.
|
|
6466
|
-
*
|
|
6467
|
-
* @since 2.0.0
|
|
6468
|
-
*/
|
|
6469
|
-
const globalStoreId = `effect/GlobalValue`;
|
|
6470
|
-
let globalStore;
|
|
6471
|
-
/**
|
|
6472
|
-
* Retrieves or computes a global value associated with the given `id`. If the value for this `id`
|
|
6473
|
-
* has already been computed, it will be returned from the global store. If it does not exist yet,
|
|
6474
|
-
* the provided `compute` function will be executed to compute the value, store it, and then return it.
|
|
6475
|
-
*
|
|
6476
|
-
* This ensures that even in cases where the module is imported multiple times (e.g., in mixed environments
|
|
6477
|
-
* like CommonJS and ESM, or during hot-reloading in development), the value is computed only once and reused
|
|
6478
|
-
* thereafter.
|
|
6479
|
-
*
|
|
6480
|
-
* @example
|
|
6481
|
-
* ```ts
|
|
6482
|
-
* import { globalValue } from "effect/GlobalValue"
|
|
6483
|
-
*
|
|
6484
|
-
* // This cache will persist as long as the module is running,
|
|
6485
|
-
* // even if reloaded or imported elsewhere
|
|
6486
|
-
* const myCache = globalValue(
|
|
6487
|
-
* Symbol.for("myCache"),
|
|
6488
|
-
* () => new WeakMap<object, number>()
|
|
6489
|
-
* )
|
|
6490
|
-
* ```
|
|
6491
|
-
*
|
|
6492
|
-
* @since 2.0.0
|
|
6493
|
-
*/
|
|
6494
|
-
const globalValue = (id, compute) => {
|
|
6495
|
-
if (!globalStore) {
|
|
6496
|
-
// @ts-expect-error
|
|
6497
|
-
globalThis[globalStoreId] ??= new Map();
|
|
6498
|
-
// @ts-expect-error
|
|
6499
|
-
globalStore = globalThis[globalStoreId];
|
|
6500
|
-
}
|
|
6501
|
-
if (!globalStore.has(id)) {
|
|
6502
|
-
globalStore.set(id, compute());
|
|
6503
|
-
}
|
|
6504
|
-
return globalStore.get(id);
|
|
6505
|
-
};
|
|
6506
|
-
|
|
6507
|
-
/**
|
|
6508
|
-
* This module provides a collection of functions for working with predicates and refinements.
|
|
6509
|
-
*
|
|
6510
|
-
* A `Predicate<A>` is a function that takes a value of type `A` and returns a boolean.
|
|
6511
|
-
* It is used to check if a value satisfies a certain condition.
|
|
6512
|
-
*
|
|
6513
|
-
* A `Refinement<A, B>` is a special type of predicate that not only checks a condition
|
|
6514
|
-
* but also provides a type guard, allowing TypeScript to narrow the type of the input
|
|
6515
|
-
* value from `A` to a more specific type `B` within a conditional block.
|
|
6516
|
-
*
|
|
6517
|
-
* The module includes:
|
|
6518
|
-
* - Basic predicates and refinements for common types (e.g., `isString`, `isNumber`).
|
|
6519
|
-
* - Combinators to create new predicates from existing ones (e.g., `and`, `or`, `not`).
|
|
6520
|
-
* - Advanced combinators for working with data structures (e.g., `tuple`, `struct`).
|
|
6521
|
-
* - Type-level utilities for inspecting predicate and refinement types.
|
|
6522
|
-
*
|
|
6523
|
-
* @since 2.0.0
|
|
6524
|
-
*/
|
|
6525
|
-
/**
|
|
6526
|
-
* A refinement that checks if a value is a `Function`.
|
|
6527
|
-
*
|
|
6528
|
-
* @example
|
|
6529
|
-
* ```ts
|
|
6530
|
-
* import * as assert from "node:assert"
|
|
6531
|
-
* import { isFunction } from "effect/Predicate"
|
|
6532
|
-
*
|
|
6533
|
-
* assert.strictEqual(isFunction(() => {}), true)
|
|
6534
|
-
* assert.strictEqual(isFunction(isFunction), true)
|
|
6535
|
-
*
|
|
6536
|
-
* assert.strictEqual(isFunction("function"), false)
|
|
6537
|
-
* ```
|
|
6538
|
-
*
|
|
6539
|
-
* @category guards
|
|
6540
|
-
* @since 2.0.0
|
|
6541
|
-
*/
|
|
6542
|
-
const isFunction = isFunction$1;
|
|
6543
|
-
/**
|
|
6544
|
-
* Checks if the input is an object or an array.
|
|
6545
|
-
* @internal
|
|
6546
|
-
*/
|
|
6547
|
-
const isRecordOrArray = input => typeof input === "object" && input !== null;
|
|
6548
|
-
/**
|
|
6549
|
-
* A refinement that checks if a value is an `object`. Note that in JavaScript,
|
|
6550
|
-
* arrays and functions are also considered objects.
|
|
6551
|
-
*
|
|
6552
|
-
* @example
|
|
6553
|
-
* ```ts
|
|
6554
|
-
* import * as assert from "node:assert"
|
|
6555
|
-
* import { isObject } from "effect/Predicate"
|
|
6556
|
-
*
|
|
6557
|
-
* assert.strictEqual(isObject({}), true)
|
|
6558
|
-
* assert.strictEqual(isObject([]), true)
|
|
6559
|
-
* assert.strictEqual(isObject(() => {}), true)
|
|
6560
|
-
*
|
|
6561
|
-
* assert.strictEqual(isObject(null), false)
|
|
6562
|
-
* assert.strictEqual(isObject("hello"), false)
|
|
6563
|
-
* ```
|
|
6564
|
-
*
|
|
6565
|
-
* @category guards
|
|
6566
|
-
* @since 2.0.0
|
|
6567
|
-
* @see isRecord to check for plain objects (excluding arrays and functions).
|
|
6568
|
-
*/
|
|
6569
|
-
const isObject = input => isRecordOrArray(input) || isFunction(input);
|
|
6570
|
-
/**
|
|
6571
|
-
* A refinement that checks if a value is an object-like value and has a specific property key.
|
|
6572
|
-
*
|
|
6573
|
-
* @example
|
|
6574
|
-
* ```ts
|
|
6575
|
-
* import * as assert from "node:assert"
|
|
6576
|
-
* import { hasProperty } from "effect/Predicate"
|
|
6577
|
-
*
|
|
6578
|
-
* assert.strictEqual(hasProperty({ a: 1 }, "a"), true)
|
|
6579
|
-
* assert.strictEqual(hasProperty({ a: 1 }, "b"), false)
|
|
6580
|
-
*
|
|
6581
|
-
* const value: unknown = { name: "Alice" };
|
|
6582
|
-
* if (hasProperty(value, "name")) {
|
|
6583
|
-
* // The type of `value` is narrowed to `{ name: unknown }`
|
|
6584
|
-
* // and we can safely access `value.name`
|
|
6585
|
-
* console.log(value.name)
|
|
6586
|
-
* }
|
|
6587
|
-
* ```
|
|
6588
|
-
*
|
|
6589
|
-
* @category guards
|
|
6590
|
-
* @since 2.0.0
|
|
6591
|
-
*/
|
|
6592
|
-
const hasProperty = /*#__PURE__*/dual(2, (self, property) => isObject(self) && property in self);
|
|
6593
|
-
/**
|
|
6594
|
-
* A refinement that checks if a value is an object with a `_tag` property
|
|
6595
|
-
* that matches the given tag. This is a powerful tool for working with
|
|
6596
|
-
* discriminated union types.
|
|
6597
|
-
*
|
|
6598
|
-
* @example
|
|
6599
|
-
* ```ts
|
|
6600
|
-
* import * as assert from "node:assert"
|
|
6601
|
-
* import { isTagged } from "effect/Predicate"
|
|
6602
|
-
*
|
|
6603
|
-
* type Shape = { _tag: "circle"; radius: number } | { _tag: "square"; side: number }
|
|
6604
|
-
*
|
|
6605
|
-
* const isCircle = isTagged("circle")
|
|
6606
|
-
*
|
|
6607
|
-
* const shape1: Shape = { _tag: "circle", radius: 10 }
|
|
6608
|
-
* const shape2: Shape = { _tag: "square", side: 5 }
|
|
6609
|
-
*
|
|
6610
|
-
* assert.strictEqual(isCircle(shape1), true)
|
|
6611
|
-
* assert.strictEqual(isCircle(shape2), false)
|
|
6612
|
-
*
|
|
6613
|
-
* if (isCircle(shape1)) {
|
|
6614
|
-
* // shape1 is now narrowed to { _tag: "circle"; radius: number }
|
|
6615
|
-
* assert.strictEqual(shape1.radius, 10)
|
|
6616
|
-
* }
|
|
6617
|
-
* ```
|
|
6618
|
-
*
|
|
6619
|
-
* @category guards
|
|
6620
|
-
* @since 2.0.0
|
|
6621
|
-
*/
|
|
6622
|
-
const isTagged = /*#__PURE__*/dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
|
|
6623
|
-
|
|
6624
|
-
/**
|
|
6625
|
-
* @since 2.0.0
|
|
6626
|
-
*/
|
|
6627
|
-
/** @internal */
|
|
6628
|
-
const getBugErrorMessage = message => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
|
|
6629
|
-
|
|
6630
|
-
/**
|
|
6631
|
-
* @since 2.0.0
|
|
6632
|
-
*/
|
|
6633
|
-
/**
|
|
6634
|
-
* @category constructors
|
|
6635
|
-
* @since 2.0.0
|
|
6636
|
-
*/
|
|
6637
|
-
let SingleShotGen$1 = class SingleShotGen {
|
|
6638
|
-
self;
|
|
6639
|
-
called = false;
|
|
6640
|
-
constructor(self) {
|
|
6641
|
-
this.self = self;
|
|
6642
|
-
}
|
|
6643
|
-
/**
|
|
6644
|
-
* @since 2.0.0
|
|
6645
|
-
*/
|
|
6646
|
-
next(a) {
|
|
6647
|
-
return this.called ? {
|
|
6648
|
-
value: a,
|
|
6649
|
-
done: true
|
|
6650
|
-
} : (this.called = true, {
|
|
6651
|
-
value: this.self,
|
|
6652
|
-
done: false
|
|
6653
|
-
});
|
|
6654
|
-
}
|
|
6655
|
-
/**
|
|
6656
|
-
* @since 2.0.0
|
|
6657
|
-
*/
|
|
6658
|
-
return(a) {
|
|
6659
|
-
return {
|
|
6660
|
-
value: a,
|
|
6661
|
-
done: true
|
|
6662
|
-
};
|
|
6663
|
-
}
|
|
6664
|
-
/**
|
|
6665
|
-
* @since 2.0.0
|
|
6666
|
-
*/
|
|
6667
|
-
throw(e) {
|
|
6668
|
-
throw e;
|
|
6669
|
-
}
|
|
6670
|
-
/**
|
|
6671
|
-
* @since 2.0.0
|
|
6672
|
-
*/
|
|
6673
|
-
[Symbol.iterator]() {
|
|
6674
|
-
return new SingleShotGen(this.self);
|
|
6675
|
-
}
|
|
6676
|
-
};
|
|
6677
|
-
/**
|
|
6678
|
-
* @since 3.0.6
|
|
6679
|
-
*/
|
|
6680
|
-
const YieldWrapTypeId = /*#__PURE__*/Symbol.for("effect/Utils/YieldWrap");
|
|
6681
|
-
/**
|
|
6682
|
-
* @since 3.0.6
|
|
6683
|
-
*/
|
|
6684
|
-
class YieldWrap {
|
|
6685
|
-
/**
|
|
6686
|
-
* @since 3.0.6
|
|
6687
|
-
*/
|
|
6688
|
-
#value;
|
|
6689
|
-
constructor(value) {
|
|
6690
|
-
this.#value = value;
|
|
6691
|
-
}
|
|
6692
|
-
/**
|
|
6693
|
-
* @since 3.0.6
|
|
6694
|
-
*/
|
|
6695
|
-
[YieldWrapTypeId]() {
|
|
6696
|
-
return this.#value;
|
|
6697
|
-
}
|
|
6698
|
-
}
|
|
6699
|
-
/**
|
|
6700
|
-
* Note: this is an experimental feature made available to allow custom matchers in tests, not to be directly used yet in user code
|
|
6701
|
-
*
|
|
6702
|
-
* @since 3.1.1
|
|
6703
|
-
* @status experimental
|
|
6704
|
-
* @category modifiers
|
|
6705
|
-
*/
|
|
6706
|
-
const structuralRegionState = /*#__PURE__*/globalValue("effect/Utils/isStructuralRegion", () => ({
|
|
6707
|
-
enabled: false,
|
|
6708
|
-
tester: undefined
|
|
6709
|
-
}));
|
|
6710
|
-
|
|
6711
|
-
/**
|
|
6712
|
-
* @since 2.0.0
|
|
6713
|
-
*/
|
|
6714
|
-
/** @internal */
|
|
6715
|
-
const randomHashCache = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Hash/randomHashCache"), () => new WeakMap());
|
|
6716
|
-
/**
|
|
6717
|
-
* @since 2.0.0
|
|
6718
|
-
* @category symbols
|
|
6719
|
-
*/
|
|
6720
|
-
const symbol$1 = /*#__PURE__*/Symbol.for("effect/Hash");
|
|
6721
|
-
/**
|
|
6722
|
-
* @since 2.0.0
|
|
6723
|
-
* @category hashing
|
|
6724
|
-
*/
|
|
6725
|
-
const hash = self => {
|
|
6726
|
-
if (structuralRegionState.enabled === true) {
|
|
6727
|
-
return 0;
|
|
6728
|
-
}
|
|
6729
|
-
switch (typeof self) {
|
|
6730
|
-
case "number":
|
|
6731
|
-
return number(self);
|
|
6732
|
-
case "bigint":
|
|
6733
|
-
return string(self.toString(10));
|
|
6734
|
-
case "boolean":
|
|
6735
|
-
return string(String(self));
|
|
6736
|
-
case "symbol":
|
|
6737
|
-
return string(String(self));
|
|
6738
|
-
case "string":
|
|
6739
|
-
return string(self);
|
|
6740
|
-
case "undefined":
|
|
6741
|
-
return string("undefined");
|
|
6742
|
-
case "function":
|
|
6743
|
-
case "object":
|
|
6744
|
-
{
|
|
6745
|
-
if (self === null) {
|
|
6746
|
-
return string("null");
|
|
6747
|
-
} else if (self instanceof Date) {
|
|
6748
|
-
if (Number.isNaN(self.getTime())) {
|
|
6749
|
-
return string("Invalid Date");
|
|
6750
|
-
}
|
|
6751
|
-
return hash(self.toISOString());
|
|
6752
|
-
} else if (self instanceof URL) {
|
|
6753
|
-
return hash(self.href);
|
|
6754
|
-
} else if (isHash(self)) {
|
|
6755
|
-
return self[symbol$1]();
|
|
6756
|
-
} else {
|
|
6757
|
-
return random(self);
|
|
6212
|
+
}
|
|
6213
|
+
componentDidRender() {
|
|
6214
|
+
this.validationEl = this.el.querySelector('svg');
|
|
6215
|
+
this.ariaValidationController.revalidateAria();
|
|
6216
|
+
super.componentDidRender();
|
|
6217
|
+
}
|
|
6218
|
+
render() {
|
|
6219
|
+
return hAsync(Host, { key: 'b36586af32709b492336fe4ec1fe1fe1fe7a9e4b', role: "img", "aria-hidden": `${this.ariaHidden}`, innerHTML: this.iconData });
|
|
6220
|
+
}
|
|
6221
|
+
waitUntilVisible(callback, rootMargin = 50) {
|
|
6222
|
+
{
|
|
6223
|
+
callback();
|
|
6224
|
+
return;
|
|
6758
6225
|
}
|
|
6759
|
-
}
|
|
6760
|
-
default:
|
|
6761
|
-
throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`);
|
|
6762
|
-
}
|
|
6763
|
-
};
|
|
6764
|
-
/**
|
|
6765
|
-
* @since 2.0.0
|
|
6766
|
-
* @category hashing
|
|
6767
|
-
*/
|
|
6768
|
-
const random = self => {
|
|
6769
|
-
if (!randomHashCache.has(self)) {
|
|
6770
|
-
randomHashCache.set(self, number(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)));
|
|
6771
|
-
}
|
|
6772
|
-
return randomHashCache.get(self);
|
|
6773
|
-
};
|
|
6774
|
-
/**
|
|
6775
|
-
* @since 2.0.0
|
|
6776
|
-
* @category hashing
|
|
6777
|
-
*/
|
|
6778
|
-
const combine = b => self => self * 53 ^ b;
|
|
6779
|
-
/**
|
|
6780
|
-
* @since 2.0.0
|
|
6781
|
-
* @category hashing
|
|
6782
|
-
*/
|
|
6783
|
-
const optimize = n => n & 0xbfffffff | n >>> 1 & 0x40000000;
|
|
6784
|
-
/**
|
|
6785
|
-
* @since 2.0.0
|
|
6786
|
-
* @category guards
|
|
6787
|
-
*/
|
|
6788
|
-
const isHash = u => hasProperty(u, symbol$1);
|
|
6789
|
-
/**
|
|
6790
|
-
* @since 2.0.0
|
|
6791
|
-
* @category hashing
|
|
6792
|
-
*/
|
|
6793
|
-
const number = n => {
|
|
6794
|
-
if (n !== n || n === Infinity) {
|
|
6795
|
-
return 0;
|
|
6796
|
-
}
|
|
6797
|
-
let h = n | 0;
|
|
6798
|
-
if (h !== n) {
|
|
6799
|
-
h ^= n * 0xffffffff;
|
|
6800
|
-
}
|
|
6801
|
-
while (n > 0xffffffff) {
|
|
6802
|
-
h ^= n /= 0xffffffff;
|
|
6803
|
-
}
|
|
6804
|
-
return optimize(h);
|
|
6805
|
-
};
|
|
6806
|
-
/**
|
|
6807
|
-
* @since 2.0.0
|
|
6808
|
-
* @category hashing
|
|
6809
|
-
*/
|
|
6810
|
-
const string = str => {
|
|
6811
|
-
let h = 5381,
|
|
6812
|
-
i = str.length;
|
|
6813
|
-
while (i) {
|
|
6814
|
-
h = h * 33 ^ str.charCodeAt(--i);
|
|
6815
|
-
}
|
|
6816
|
-
return optimize(h);
|
|
6817
|
-
};
|
|
6818
|
-
/**
|
|
6819
|
-
* @since 2.0.0
|
|
6820
|
-
* @category hashing
|
|
6821
|
-
*/
|
|
6822
|
-
const structureKeys = (o, keys) => {
|
|
6823
|
-
let h = 12289;
|
|
6824
|
-
for (let i = 0; i < keys.length; i++) {
|
|
6825
|
-
h ^= pipe(string(keys[i]), combine(hash(o[keys[i]])));
|
|
6826
|
-
}
|
|
6827
|
-
return optimize(h);
|
|
6828
|
-
};
|
|
6829
|
-
/**
|
|
6830
|
-
* @since 2.0.0
|
|
6831
|
-
* @category hashing
|
|
6832
|
-
*/
|
|
6833
|
-
const structure = o => structureKeys(o, Object.keys(o));
|
|
6834
|
-
/**
|
|
6835
|
-
* @since 2.0.0
|
|
6836
|
-
* @category hashing
|
|
6837
|
-
*/
|
|
6838
|
-
const array = arr => {
|
|
6839
|
-
let h = 6151;
|
|
6840
|
-
for (let i = 0; i < arr.length; i++) {
|
|
6841
|
-
h = pipe(h, combine(hash(arr[i])));
|
|
6842
|
-
}
|
|
6843
|
-
return optimize(h);
|
|
6844
|
-
};
|
|
6845
|
-
/**
|
|
6846
|
-
* @since 2.0.0
|
|
6847
|
-
* @category hashing
|
|
6848
|
-
*/
|
|
6849
|
-
const cached = function () {
|
|
6850
|
-
if (arguments.length === 1) {
|
|
6851
|
-
const self = arguments[0];
|
|
6852
|
-
return function (hash) {
|
|
6853
|
-
Object.defineProperty(self, symbol$1, {
|
|
6854
|
-
value() {
|
|
6855
|
-
return hash;
|
|
6856
|
-
},
|
|
6857
|
-
enumerable: false
|
|
6858
|
-
});
|
|
6859
|
-
return hash;
|
|
6860
|
-
};
|
|
6861
|
-
}
|
|
6862
|
-
const self = arguments[0];
|
|
6863
|
-
const hash = arguments[1];
|
|
6864
|
-
Object.defineProperty(self, symbol$1, {
|
|
6865
|
-
value() {
|
|
6866
|
-
return hash;
|
|
6867
|
-
},
|
|
6868
|
-
enumerable: false
|
|
6869
|
-
});
|
|
6870
|
-
return hash;
|
|
6871
|
-
};
|
|
6872
|
-
|
|
6873
|
-
/**
|
|
6874
|
-
* @since 2.0.0
|
|
6875
|
-
* @category symbols
|
|
6876
|
-
*/
|
|
6877
|
-
const symbol = /*#__PURE__*/Symbol.for("effect/Equal");
|
|
6878
|
-
function equals() {
|
|
6879
|
-
if (arguments.length === 1) {
|
|
6880
|
-
return self => compareBoth(self, arguments[0]);
|
|
6881
|
-
}
|
|
6882
|
-
return compareBoth(arguments[0], arguments[1]);
|
|
6883
|
-
}
|
|
6884
|
-
function compareBoth(self, that) {
|
|
6885
|
-
if (self === that) {
|
|
6886
|
-
return true;
|
|
6887
|
-
}
|
|
6888
|
-
const selfType = typeof self;
|
|
6889
|
-
if (selfType !== typeof that) {
|
|
6890
|
-
return false;
|
|
6891
|
-
}
|
|
6892
|
-
if (selfType === "object" || selfType === "function") {
|
|
6893
|
-
if (self !== null && that !== null) {
|
|
6894
|
-
if (isEqual(self) && isEqual(that)) {
|
|
6895
|
-
if (hash(self) === hash(that) && self[symbol](that)) {
|
|
6896
|
-
return true;
|
|
6897
|
-
} else {
|
|
6898
|
-
return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
|
|
6899
|
-
}
|
|
6900
|
-
} else if (self instanceof Date && that instanceof Date) {
|
|
6901
|
-
const t1 = self.getTime();
|
|
6902
|
-
const t2 = that.getTime();
|
|
6903
|
-
return t1 === t2 || Number.isNaN(t1) && Number.isNaN(t2);
|
|
6904
|
-
} else if (self instanceof URL && that instanceof URL) {
|
|
6905
|
-
return self.href === that.href;
|
|
6906
|
-
}
|
|
6907
|
-
}
|
|
6908
|
-
if (structuralRegionState.enabled) {
|
|
6909
|
-
if (self === null || that === null) {
|
|
6910
|
-
return false;
|
|
6911
|
-
}
|
|
6912
|
-
if (Array.isArray(self) && Array.isArray(that)) {
|
|
6913
|
-
return self.length === that.length && self.every((v, i) => compareBoth(v, that[i]));
|
|
6914
|
-
}
|
|
6915
|
-
if (Object.getPrototypeOf(self) === Object.prototype && Object.getPrototypeOf(that) === Object.prototype) {
|
|
6916
|
-
const keysSelf = Object.keys(self);
|
|
6917
|
-
const keysThat = Object.keys(that);
|
|
6918
|
-
if (keysSelf.length === keysThat.length) {
|
|
6919
|
-
for (const key of keysSelf) {
|
|
6920
|
-
// @ts-expect-error
|
|
6921
|
-
if (!(key in that && compareBoth(self[key], that[key]))) {
|
|
6922
|
-
return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
|
|
6923
|
-
}
|
|
6924
|
-
}
|
|
6925
|
-
return true;
|
|
6926
|
-
}
|
|
6927
|
-
}
|
|
6928
|
-
return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
|
|
6929
|
-
}
|
|
6930
|
-
}
|
|
6931
|
-
return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
|
|
6932
|
-
}
|
|
6933
|
-
/**
|
|
6934
|
-
* @since 2.0.0
|
|
6935
|
-
* @category guards
|
|
6936
|
-
*/
|
|
6937
|
-
const isEqual = u => hasProperty(u, symbol);
|
|
6938
|
-
|
|
6939
|
-
/**
|
|
6940
|
-
* @since 2.0.0
|
|
6941
|
-
* @category symbols
|
|
6942
|
-
*/
|
|
6943
|
-
const NodeInspectSymbol = /*#__PURE__*/Symbol.for("nodejs.util.inspect.custom");
|
|
6944
|
-
/**
|
|
6945
|
-
* @since 2.0.0
|
|
6946
|
-
*/
|
|
6947
|
-
const toJSON = x => {
|
|
6948
|
-
try {
|
|
6949
|
-
if (hasProperty(x, "toJSON") && isFunction(x["toJSON"]) && x["toJSON"].length === 0) {
|
|
6950
|
-
return x.toJSON();
|
|
6951
|
-
} else if (Array.isArray(x)) {
|
|
6952
|
-
return x.map(toJSON);
|
|
6953
|
-
}
|
|
6954
|
-
} catch {
|
|
6955
|
-
return {};
|
|
6956
|
-
}
|
|
6957
|
-
return redact(x);
|
|
6958
|
-
};
|
|
6959
|
-
/**
|
|
6960
|
-
* @since 2.0.0
|
|
6961
|
-
*/
|
|
6962
|
-
const format = x => JSON.stringify(x, null, 2);
|
|
6963
|
-
/**
|
|
6964
|
-
* @since 2.0.0
|
|
6965
|
-
*/
|
|
6966
|
-
const stringifyCircular = (obj, whitespace) => {
|
|
6967
|
-
let cache = [];
|
|
6968
|
-
const retVal = JSON.stringify(obj, (_key, value) => typeof value === "object" && value !== null ? cache.includes(value) ? undefined // circular reference
|
|
6969
|
-
: cache.push(value) && (redactableState.fiberRefs !== undefined && isRedactable(value) ? value[symbolRedactable](redactableState.fiberRefs) : value) : value, whitespace);
|
|
6970
|
-
cache = undefined;
|
|
6971
|
-
return retVal;
|
|
6972
|
-
};
|
|
6973
|
-
/**
|
|
6974
|
-
* @since 3.10.0
|
|
6975
|
-
* @category redactable
|
|
6976
|
-
*/
|
|
6977
|
-
const symbolRedactable = /*#__PURE__*/Symbol.for("effect/Inspectable/Redactable");
|
|
6978
|
-
/**
|
|
6979
|
-
* @since 3.10.0
|
|
6980
|
-
* @category redactable
|
|
6981
|
-
*/
|
|
6982
|
-
const isRedactable = u => typeof u === "object" && u !== null && symbolRedactable in u;
|
|
6983
|
-
const redactableState = /*#__PURE__*/globalValue("effect/Inspectable/redactableState", () => ({
|
|
6984
|
-
fiberRefs: undefined
|
|
6985
|
-
}));
|
|
6986
|
-
/**
|
|
6987
|
-
* @since 3.10.0
|
|
6988
|
-
* @category redactable
|
|
6989
|
-
*/
|
|
6990
|
-
const redact = u => {
|
|
6991
|
-
if (isRedactable(u) && redactableState.fiberRefs !== undefined) {
|
|
6992
|
-
return u[symbolRedactable](redactableState.fiberRefs);
|
|
6993
|
-
}
|
|
6994
|
-
return u;
|
|
6995
|
-
};
|
|
6996
|
-
|
|
6997
|
-
/**
|
|
6998
|
-
* @since 2.0.0
|
|
6999
|
-
*/
|
|
7000
|
-
/**
|
|
7001
|
-
* @since 2.0.0
|
|
7002
|
-
*/
|
|
7003
|
-
const pipeArguments = (self, args) => {
|
|
7004
|
-
switch (args.length) {
|
|
7005
|
-
case 0:
|
|
7006
|
-
return self;
|
|
7007
|
-
case 1:
|
|
7008
|
-
return args[0](self);
|
|
7009
|
-
case 2:
|
|
7010
|
-
return args[1](args[0](self));
|
|
7011
|
-
case 3:
|
|
7012
|
-
return args[2](args[1](args[0](self)));
|
|
7013
|
-
case 4:
|
|
7014
|
-
return args[3](args[2](args[1](args[0](self))));
|
|
7015
|
-
case 5:
|
|
7016
|
-
return args[4](args[3](args[2](args[1](args[0](self)))));
|
|
7017
|
-
case 6:
|
|
7018
|
-
return args[5](args[4](args[3](args[2](args[1](args[0](self))))));
|
|
7019
|
-
case 7:
|
|
7020
|
-
return args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))));
|
|
7021
|
-
case 8:
|
|
7022
|
-
return args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self))))))));
|
|
7023
|
-
case 9:
|
|
7024
|
-
return args[8](args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))))));
|
|
7025
|
-
default:
|
|
7026
|
-
{
|
|
7027
|
-
let ret = self;
|
|
7028
|
-
for (let i = 0, len = args.length; i < len; i++) {
|
|
7029
|
-
ret = args[i](ret);
|
|
7030
|
-
}
|
|
7031
|
-
return ret;
|
|
7032
|
-
}
|
|
7033
|
-
}
|
|
7034
|
-
};
|
|
7035
|
-
|
|
7036
|
-
/** @internal */
|
|
7037
|
-
/** @internal */
|
|
7038
|
-
const OP_COMMIT = "Commit";
|
|
7039
|
-
/** @internal */
|
|
7040
|
-
const OP_FAILURE = "Failure";
|
|
7041
|
-
/** @internal */
|
|
7042
|
-
const OP_WITH_RUNTIME = "WithRuntime";
|
|
7043
|
-
|
|
7044
|
-
let moduleVersion = "3.21.1";
|
|
7045
|
-
const getCurrentVersion = () => moduleVersion;
|
|
7046
|
-
|
|
7047
|
-
/** @internal */
|
|
7048
|
-
const EffectTypeId$1 = /*#__PURE__*/Symbol.for("effect/Effect");
|
|
7049
|
-
/** @internal */
|
|
7050
|
-
const StreamTypeId = /*#__PURE__*/Symbol.for("effect/Stream");
|
|
7051
|
-
/** @internal */
|
|
7052
|
-
const SinkTypeId = /*#__PURE__*/Symbol.for("effect/Sink");
|
|
7053
|
-
/** @internal */
|
|
7054
|
-
const ChannelTypeId = /*#__PURE__*/Symbol.for("effect/Channel");
|
|
7055
|
-
/** @internal */
|
|
7056
|
-
const effectVariance = {
|
|
7057
|
-
/* c8 ignore next */
|
|
7058
|
-
_R: _ => _,
|
|
7059
|
-
/* c8 ignore next */
|
|
7060
|
-
_E: _ => _,
|
|
7061
|
-
/* c8 ignore next */
|
|
7062
|
-
_A: _ => _,
|
|
7063
|
-
_V: /*#__PURE__*/getCurrentVersion()
|
|
7064
|
-
};
|
|
7065
|
-
const sinkVariance = {
|
|
7066
|
-
/* c8 ignore next */
|
|
7067
|
-
_A: _ => _,
|
|
7068
|
-
/* c8 ignore next */
|
|
7069
|
-
_In: _ => _,
|
|
7070
|
-
/* c8 ignore next */
|
|
7071
|
-
_L: _ => _,
|
|
7072
|
-
/* c8 ignore next */
|
|
7073
|
-
_E: _ => _,
|
|
7074
|
-
/* c8 ignore next */
|
|
7075
|
-
_R: _ => _
|
|
7076
|
-
};
|
|
7077
|
-
const channelVariance = {
|
|
7078
|
-
/* c8 ignore next */
|
|
7079
|
-
_Env: _ => _,
|
|
7080
|
-
/* c8 ignore next */
|
|
7081
|
-
_InErr: _ => _,
|
|
7082
|
-
/* c8 ignore next */
|
|
7083
|
-
_InElem: _ => _,
|
|
7084
|
-
/* c8 ignore next */
|
|
7085
|
-
_InDone: _ => _,
|
|
7086
|
-
/* c8 ignore next */
|
|
7087
|
-
_OutErr: _ => _,
|
|
7088
|
-
/* c8 ignore next */
|
|
7089
|
-
_OutElem: _ => _,
|
|
7090
|
-
/* c8 ignore next */
|
|
7091
|
-
_OutDone: _ => _
|
|
7092
|
-
};
|
|
7093
|
-
/** @internal */
|
|
7094
|
-
const EffectPrototype = {
|
|
7095
|
-
[EffectTypeId$1]: effectVariance,
|
|
7096
|
-
[StreamTypeId]: effectVariance,
|
|
7097
|
-
[SinkTypeId]: sinkVariance,
|
|
7098
|
-
[ChannelTypeId]: channelVariance,
|
|
7099
|
-
[symbol](that) {
|
|
7100
|
-
return this === that;
|
|
7101
|
-
},
|
|
7102
|
-
[symbol$1]() {
|
|
7103
|
-
return cached(this, random(this));
|
|
7104
|
-
},
|
|
7105
|
-
[Symbol.iterator]() {
|
|
7106
|
-
return new SingleShotGen$1(new YieldWrap(this));
|
|
7107
|
-
},
|
|
7108
|
-
pipe() {
|
|
7109
|
-
return pipeArguments(this, arguments);
|
|
7110
|
-
}
|
|
7111
|
-
};
|
|
7112
|
-
/** @internal */
|
|
7113
|
-
const StructuralPrototype = {
|
|
7114
|
-
[symbol$1]() {
|
|
7115
|
-
return cached(this, structure(this));
|
|
7116
|
-
},
|
|
7117
|
-
[symbol](that) {
|
|
7118
|
-
const selfKeys = Object.keys(this);
|
|
7119
|
-
const thatKeys = Object.keys(that);
|
|
7120
|
-
if (selfKeys.length !== thatKeys.length) {
|
|
7121
|
-
return false;
|
|
7122
|
-
}
|
|
7123
|
-
for (const key of selfKeys) {
|
|
7124
|
-
if (!(key in that && equals(this[key], that[key]))) {
|
|
7125
|
-
return false;
|
|
7126
|
-
}
|
|
7127
|
-
}
|
|
7128
|
-
return true;
|
|
7129
|
-
}
|
|
7130
|
-
};
|
|
7131
|
-
/** @internal */
|
|
7132
|
-
const CommitPrototype = {
|
|
7133
|
-
...EffectPrototype,
|
|
7134
|
-
_op: OP_COMMIT
|
|
7135
|
-
};
|
|
7136
|
-
/** @internal */
|
|
7137
|
-
const StructuralCommitPrototype = {
|
|
7138
|
-
...CommitPrototype,
|
|
7139
|
-
...StructuralPrototype
|
|
7140
|
-
};
|
|
7141
|
-
|
|
7142
|
-
/**
|
|
7143
|
-
* @since 2.0.0
|
|
7144
|
-
*/
|
|
7145
|
-
const TypeId$2 = /*#__PURE__*/Symbol.for("effect/Option");
|
|
7146
|
-
const CommonProto$1 = {
|
|
7147
|
-
...EffectPrototype,
|
|
7148
|
-
[TypeId$2]: {
|
|
7149
|
-
_A: _ => _
|
|
7150
|
-
},
|
|
7151
|
-
[NodeInspectSymbol]() {
|
|
7152
|
-
return this.toJSON();
|
|
7153
|
-
},
|
|
7154
|
-
toString() {
|
|
7155
|
-
return format(this.toJSON());
|
|
7156
|
-
}
|
|
7157
|
-
};
|
|
7158
|
-
const SomeProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonProto$1), {
|
|
7159
|
-
_tag: "Some",
|
|
7160
|
-
_op: "Some",
|
|
7161
|
-
[symbol](that) {
|
|
7162
|
-
return isOption(that) && isSome$1(that) && equals(this.value, that.value);
|
|
7163
|
-
},
|
|
7164
|
-
[symbol$1]() {
|
|
7165
|
-
return cached(this, combine(hash(this._tag))(hash(this.value)));
|
|
7166
|
-
},
|
|
7167
|
-
toJSON() {
|
|
7168
|
-
return {
|
|
7169
|
-
_id: "Option",
|
|
7170
|
-
_tag: this._tag,
|
|
7171
|
-
value: toJSON(this.value)
|
|
7172
|
-
};
|
|
7173
|
-
}
|
|
7174
|
-
});
|
|
7175
|
-
const NoneHash = /*#__PURE__*/hash("None");
|
|
7176
|
-
const NoneProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonProto$1), {
|
|
7177
|
-
_tag: "None",
|
|
7178
|
-
_op: "None",
|
|
7179
|
-
[symbol](that) {
|
|
7180
|
-
return isOption(that) && isNone$1(that);
|
|
7181
|
-
},
|
|
7182
|
-
[symbol$1]() {
|
|
7183
|
-
return NoneHash;
|
|
7184
|
-
},
|
|
7185
|
-
toJSON() {
|
|
7186
|
-
return {
|
|
7187
|
-
_id: "Option",
|
|
7188
|
-
_tag: this._tag
|
|
7189
|
-
};
|
|
7190
|
-
}
|
|
7191
|
-
});
|
|
7192
|
-
/** @internal */
|
|
7193
|
-
const isOption = input => hasProperty(input, TypeId$2);
|
|
7194
|
-
/** @internal */
|
|
7195
|
-
const isNone$1 = fa => fa._tag === "None";
|
|
7196
|
-
/** @internal */
|
|
7197
|
-
const isSome$1 = fa => fa._tag === "Some";
|
|
7198
|
-
/** @internal */
|
|
7199
|
-
const none$1 = /*#__PURE__*/Object.create(NoneProto);
|
|
7200
|
-
/** @internal */
|
|
7201
|
-
const some$1 = value => {
|
|
7202
|
-
const a = Object.create(SomeProto);
|
|
7203
|
-
a.value = value;
|
|
7204
|
-
return a;
|
|
7205
|
-
};
|
|
7206
|
-
|
|
7207
|
-
/**
|
|
7208
|
-
* @since 2.0.0
|
|
7209
|
-
*/
|
|
7210
|
-
/**
|
|
7211
|
-
* @internal
|
|
7212
|
-
*/
|
|
7213
|
-
const TypeId$1 = /*#__PURE__*/Symbol.for("effect/Either");
|
|
7214
|
-
const CommonProto = {
|
|
7215
|
-
...EffectPrototype,
|
|
7216
|
-
[TypeId$1]: {
|
|
7217
|
-
_R: _ => _
|
|
7218
|
-
},
|
|
7219
|
-
[NodeInspectSymbol]() {
|
|
7220
|
-
return this.toJSON();
|
|
7221
|
-
},
|
|
7222
|
-
toString() {
|
|
7223
|
-
return format(this.toJSON());
|
|
7224
|
-
}
|
|
7225
|
-
};
|
|
7226
|
-
const RightProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonProto), {
|
|
7227
|
-
_tag: "Right",
|
|
7228
|
-
_op: "Right",
|
|
7229
|
-
[symbol](that) {
|
|
7230
|
-
return isEither(that) && isRight$1(that) && equals(this.right, that.right);
|
|
7231
|
-
},
|
|
7232
|
-
[symbol$1]() {
|
|
7233
|
-
return combine(hash(this._tag))(hash(this.right));
|
|
7234
|
-
},
|
|
7235
|
-
toJSON() {
|
|
7236
|
-
return {
|
|
7237
|
-
_id: "Either",
|
|
7238
|
-
_tag: this._tag,
|
|
7239
|
-
right: toJSON(this.right)
|
|
7240
|
-
};
|
|
7241
|
-
}
|
|
7242
|
-
});
|
|
7243
|
-
const LeftProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonProto), {
|
|
7244
|
-
_tag: "Left",
|
|
7245
|
-
_op: "Left",
|
|
7246
|
-
[symbol](that) {
|
|
7247
|
-
return isEither(that) && isLeft(that) && equals(this.left, that.left);
|
|
7248
|
-
},
|
|
7249
|
-
[symbol$1]() {
|
|
7250
|
-
return combine(hash(this._tag))(hash(this.left));
|
|
7251
|
-
},
|
|
7252
|
-
toJSON() {
|
|
7253
|
-
return {
|
|
7254
|
-
_id: "Either",
|
|
7255
|
-
_tag: this._tag,
|
|
7256
|
-
left: toJSON(this.left)
|
|
7257
|
-
};
|
|
7258
|
-
}
|
|
7259
|
-
});
|
|
7260
|
-
/** @internal */
|
|
7261
|
-
const isEither = input => hasProperty(input, TypeId$1);
|
|
7262
|
-
/** @internal */
|
|
7263
|
-
const isLeft = ma => ma._tag === "Left";
|
|
7264
|
-
/** @internal */
|
|
7265
|
-
const isRight$1 = ma => ma._tag === "Right";
|
|
7266
|
-
/** @internal */
|
|
7267
|
-
const left$1 = left => {
|
|
7268
|
-
const a = Object.create(LeftProto);
|
|
7269
|
-
a.left = left;
|
|
7270
|
-
return a;
|
|
7271
|
-
};
|
|
7272
|
-
/** @internal */
|
|
7273
|
-
const right$1 = right => {
|
|
7274
|
-
const a = Object.create(RightProto);
|
|
7275
|
-
a.right = right;
|
|
7276
|
-
return a;
|
|
7277
|
-
};
|
|
7278
|
-
/** @internal */
|
|
7279
|
-
const getRight$1 = self => isLeft(self) ? none$1 : some$1(self.right);
|
|
7280
|
-
|
|
7281
|
-
/**
|
|
7282
|
-
* @since 2.0.0
|
|
7283
|
-
*/
|
|
7284
|
-
/**
|
|
7285
|
-
* Constructs a new `Either` holding a `Right` value. This usually represents a successful value due to the right bias
|
|
7286
|
-
* of this structure.
|
|
7287
|
-
*
|
|
7288
|
-
* @category constructors
|
|
7289
|
-
* @since 2.0.0
|
|
7290
|
-
*/
|
|
7291
|
-
const right = right$1;
|
|
7292
|
-
/**
|
|
7293
|
-
* Constructs a new `Either` holding a `Left` value. This usually represents a failure, due to the right-bias of this
|
|
7294
|
-
* structure.
|
|
7295
|
-
*
|
|
7296
|
-
* @category constructors
|
|
7297
|
-
* @since 2.0.0
|
|
7298
|
-
*/
|
|
7299
|
-
const left = left$1;
|
|
7300
|
-
/**
|
|
7301
|
-
* Determine if a `Either` is a `Right`.
|
|
7302
|
-
*
|
|
7303
|
-
* @example
|
|
7304
|
-
* ```ts
|
|
7305
|
-
* import * as assert from "node:assert"
|
|
7306
|
-
* import { Either } from "effect"
|
|
7307
|
-
*
|
|
7308
|
-
* assert.deepStrictEqual(Either.isRight(Either.right(1)), true)
|
|
7309
|
-
* assert.deepStrictEqual(Either.isRight(Either.left("a")), false)
|
|
7310
|
-
* ```
|
|
7311
|
-
*
|
|
7312
|
-
* @category guards
|
|
7313
|
-
* @since 2.0.0
|
|
7314
|
-
*/
|
|
7315
|
-
const isRight = isRight$1;
|
|
7316
|
-
/**
|
|
7317
|
-
* Extracts the value of an `Either` or throws if the `Either` is `Left`.
|
|
7318
|
-
*
|
|
7319
|
-
* If a default error is sufficient for your use case and you don't need to configure the thrown error, see {@link getOrThrow}.
|
|
7320
|
-
*
|
|
7321
|
-
* @example
|
|
7322
|
-
* ```ts
|
|
7323
|
-
* import * as assert from "node:assert"
|
|
7324
|
-
* import { Either } from "effect"
|
|
7325
|
-
*
|
|
7326
|
-
* assert.deepStrictEqual(
|
|
7327
|
-
* Either.getOrThrowWith(Either.right(1), () => new Error('Unexpected Left')),
|
|
7328
|
-
* 1
|
|
7329
|
-
* )
|
|
7330
|
-
* assert.throws(() => Either.getOrThrowWith(Either.left("error"), () => new Error('Unexpected Left')))
|
|
7331
|
-
* ```
|
|
7332
|
-
*
|
|
7333
|
-
* @category getters
|
|
7334
|
-
* @since 2.0.0
|
|
7335
|
-
*/
|
|
7336
|
-
const getOrThrowWith = /*#__PURE__*/dual(2, (self, onLeft) => {
|
|
7337
|
-
if (isRight(self)) {
|
|
7338
|
-
return self.right;
|
|
7339
|
-
}
|
|
7340
|
-
throw onLeft(self.left);
|
|
7341
|
-
});
|
|
7342
|
-
|
|
7343
|
-
/**
|
|
7344
|
-
* Represents the absence of a value by creating an empty `Option`.
|
|
7345
|
-
*
|
|
7346
|
-
* `Option.none` returns an `Option<never>`, which is a subtype of `Option<A>`.
|
|
7347
|
-
* This means you can use it in place of any `Option<A>` regardless of the type
|
|
7348
|
-
* `A`.
|
|
7349
|
-
*
|
|
7350
|
-
* **Example** (Creating an Option with No Value)
|
|
7351
|
-
*
|
|
7352
|
-
* ```ts
|
|
7353
|
-
* import { Option } from "effect"
|
|
7354
|
-
*
|
|
7355
|
-
* // An Option holding no value
|
|
7356
|
-
* //
|
|
7357
|
-
* // ┌─── Option<never>
|
|
7358
|
-
* // ▼
|
|
7359
|
-
* const noValue = Option.none()
|
|
7360
|
-
*
|
|
7361
|
-
* console.log(noValue)
|
|
7362
|
-
* // Output: { _id: 'Option', _tag: 'None' }
|
|
7363
|
-
* ```
|
|
7364
|
-
*
|
|
7365
|
-
* @see {@link some} for the opposite operation.
|
|
7366
|
-
*
|
|
7367
|
-
* @category Constructors
|
|
7368
|
-
* @since 2.0.0
|
|
7369
|
-
*/
|
|
7370
|
-
const none = () => none$1;
|
|
7371
|
-
/**
|
|
7372
|
-
* Wraps the given value into an `Option` to represent its presence.
|
|
7373
|
-
*
|
|
7374
|
-
* **Example** (Creating an Option with a Value)
|
|
7375
|
-
*
|
|
7376
|
-
* ```ts
|
|
7377
|
-
* import { Option } from "effect"
|
|
7378
|
-
*
|
|
7379
|
-
* // An Option holding the number 1
|
|
7380
|
-
* //
|
|
7381
|
-
* // ┌─── Option<number>
|
|
7382
|
-
* // ▼
|
|
7383
|
-
* const value = Option.some(1)
|
|
7384
|
-
*
|
|
7385
|
-
* console.log(value)
|
|
7386
|
-
* // Output: { _id: 'Option', _tag: 'Some', value: 1 }
|
|
7387
|
-
* ```
|
|
7388
|
-
*
|
|
7389
|
-
* @see {@link none} for the opposite operation.
|
|
7390
|
-
*
|
|
7391
|
-
* @category Constructors
|
|
7392
|
-
* @since 2.0.0
|
|
7393
|
-
*/
|
|
7394
|
-
const some = some$1;
|
|
7395
|
-
/**
|
|
7396
|
-
* Checks whether an `Option` represents the absence of a value (`None`).
|
|
7397
|
-
*
|
|
7398
|
-
* @example
|
|
7399
|
-
* ```ts
|
|
7400
|
-
* import { Option } from "effect"
|
|
7401
|
-
*
|
|
7402
|
-
* console.log(Option.isNone(Option.some(1)))
|
|
7403
|
-
* // Output: false
|
|
7404
|
-
*
|
|
7405
|
-
* console.log(Option.isNone(Option.none()))
|
|
7406
|
-
* // Output: true
|
|
7407
|
-
* ```
|
|
7408
|
-
*
|
|
7409
|
-
* @see {@link isSome} for the opposite check.
|
|
7410
|
-
*
|
|
7411
|
-
* @category Guards
|
|
7412
|
-
* @since 2.0.0
|
|
7413
|
-
*/
|
|
7414
|
-
const isNone = isNone$1;
|
|
7415
|
-
/**
|
|
7416
|
-
* Checks whether an `Option` contains a value (`Some`).
|
|
7417
|
-
*
|
|
7418
|
-
* @example
|
|
7419
|
-
* ```ts
|
|
7420
|
-
* import { Option } from "effect"
|
|
7421
|
-
*
|
|
7422
|
-
* console.log(Option.isSome(Option.some(1)))
|
|
7423
|
-
* // Output: true
|
|
7424
|
-
*
|
|
7425
|
-
* console.log(Option.isSome(Option.none()))
|
|
7426
|
-
* // Output: false
|
|
7427
|
-
* ```
|
|
7428
|
-
*
|
|
7429
|
-
* @see {@link isNone} for the opposite check.
|
|
7430
|
-
*
|
|
7431
|
-
* @category Guards
|
|
7432
|
-
* @since 2.0.0
|
|
7433
|
-
*/
|
|
7434
|
-
const isSome = isSome$1;
|
|
7435
|
-
/**
|
|
7436
|
-
* Performs pattern matching on an `Option` to handle both `Some` and `None`
|
|
7437
|
-
* cases.
|
|
7438
|
-
*
|
|
7439
|
-
* **Details**
|
|
7440
|
-
*
|
|
7441
|
-
* This function allows you to match against an `Option` and handle both
|
|
7442
|
-
* scenarios: when the `Option` is `None` (i.e., contains no value), and when
|
|
7443
|
-
* the `Option` is `Some` (i.e., contains a value). It executes one of the
|
|
7444
|
-
* provided functions based on the case:
|
|
7445
|
-
*
|
|
7446
|
-
* - If the `Option` is `None`, the `onNone` function is executed and its result
|
|
7447
|
-
* is returned.
|
|
7448
|
-
* - If the `Option` is `Some`, the `onSome` function is executed with the
|
|
7449
|
-
* contained value, and its result is returned.
|
|
7450
|
-
*
|
|
7451
|
-
* This function provides a concise and functional way to handle optional values
|
|
7452
|
-
* without resorting to `if` or manual checks, making your code more declarative
|
|
7453
|
-
* and readable.
|
|
7454
|
-
*
|
|
7455
|
-
* **Example** (Pattern Matching with Option)
|
|
7456
|
-
*
|
|
7457
|
-
* ```ts
|
|
7458
|
-
* import { Option } from "effect"
|
|
7459
|
-
*
|
|
7460
|
-
* const foo = Option.some(1)
|
|
7461
|
-
*
|
|
7462
|
-
* const message = Option.match(foo, {
|
|
7463
|
-
* onNone: () => "Option is empty",
|
|
7464
|
-
* onSome: (value) => `Option has a value: ${value}`
|
|
7465
|
-
* })
|
|
7466
|
-
*
|
|
7467
|
-
* console.log(message)
|
|
7468
|
-
* // Output: "Option has a value: 1"
|
|
7469
|
-
* ```
|
|
7470
|
-
*
|
|
7471
|
-
* @category Pattern matching
|
|
7472
|
-
* @since 2.0.0
|
|
7473
|
-
*/
|
|
7474
|
-
const match = /*#__PURE__*/dual(2, (self, {
|
|
7475
|
-
onNone,
|
|
7476
|
-
onSome
|
|
7477
|
-
}) => isNone(self) ? onNone() : onSome(self.value));
|
|
7478
|
-
/**
|
|
7479
|
-
* Converts an `Either` into an `Option` by discarding the error and extracting
|
|
7480
|
-
* the right value.
|
|
7481
|
-
*
|
|
7482
|
-
* **Details**
|
|
7483
|
-
*
|
|
7484
|
-
* This function takes an `Either` and returns an `Option` based on its value:
|
|
7485
|
-
*
|
|
7486
|
-
* - If the `Either` is a `Right`, its value is wrapped in a `Some` and
|
|
7487
|
-
* returned.
|
|
7488
|
-
* - If the `Either` is a `Left`, the error is discarded, and `None` is
|
|
7489
|
-
* returned.
|
|
7490
|
-
*
|
|
7491
|
-
* This is particularly useful when you only care about the success case
|
|
7492
|
-
* (`Right`) of an `Either` and want to handle the result using `Option`. By
|
|
7493
|
-
* using this function, you can convert `Either` into a simpler structure for
|
|
7494
|
-
* cases where error handling is not required.
|
|
7495
|
-
*
|
|
7496
|
-
* @example
|
|
7497
|
-
* ```ts
|
|
7498
|
-
* import { Either, Option } from "effect"
|
|
7499
|
-
*
|
|
7500
|
-
* console.log(Option.getRight(Either.right("ok")))
|
|
7501
|
-
* // Output: { _id: 'Option', _tag: 'Some', value: 'ok' }
|
|
7502
|
-
*
|
|
7503
|
-
* console.log(Option.getRight(Either.left("err")))
|
|
7504
|
-
* // Output: { _id: 'Option', _tag: 'None' }
|
|
7505
|
-
* ```
|
|
7506
|
-
*
|
|
7507
|
-
* @see {@link getLeft} for the opposite operation.
|
|
7508
|
-
*
|
|
7509
|
-
* @category Conversions
|
|
7510
|
-
* @since 2.0.0
|
|
7511
|
-
*/
|
|
7512
|
-
const getRight = getRight$1;
|
|
7513
|
-
/**
|
|
7514
|
-
* Returns the value contained in the `Option` if it is `Some`, otherwise
|
|
7515
|
-
* evaluates and returns the result of `onNone`.
|
|
7516
|
-
*
|
|
7517
|
-
* **Details**
|
|
7518
|
-
*
|
|
7519
|
-
* This function allows you to provide a fallback value or computation for when
|
|
7520
|
-
* an `Option` is `None`. If the `Option` contains a value (`Some`), that value
|
|
7521
|
-
* is returned. If it is empty (`None`), the `onNone` function is executed, and
|
|
7522
|
-
* its result is returned instead.
|
|
7523
|
-
*
|
|
7524
|
-
* This utility is helpful for safely handling `Option` values by ensuring you
|
|
7525
|
-
* always receive a meaningful result, whether or not the `Option` contains a
|
|
7526
|
-
* value. It is particularly useful for providing default values or alternative
|
|
7527
|
-
* logic when working with optional values.
|
|
7528
|
-
*
|
|
7529
|
-
* @example
|
|
7530
|
-
* ```ts
|
|
7531
|
-
* import { Option } from "effect"
|
|
7532
|
-
*
|
|
7533
|
-
* console.log(Option.some(1).pipe(Option.getOrElse(() => 0)))
|
|
7534
|
-
* // Output: 1
|
|
7535
|
-
*
|
|
7536
|
-
* console.log(Option.none().pipe(Option.getOrElse(() => 0)))
|
|
7537
|
-
* // Output: 0
|
|
7538
|
-
* ```
|
|
7539
|
-
*
|
|
7540
|
-
* @see {@link getOrNull} for a version that returns `null` instead of executing a function.
|
|
7541
|
-
* @see {@link getOrUndefined} for a version that returns `undefined` instead of executing a function.
|
|
7542
|
-
*
|
|
7543
|
-
* @category Getters
|
|
7544
|
-
* @since 2.0.0
|
|
7545
|
-
*/
|
|
7546
|
-
const getOrElse = /*#__PURE__*/dual(2, (self, onNone) => isNone(self) ? onNone() : self.value);
|
|
7547
|
-
/**
|
|
7548
|
-
* Returns the value contained in the `Option` if it is `Some`; otherwise,
|
|
7549
|
-
* returns `undefined`.
|
|
7550
|
-
*
|
|
7551
|
-
* **Details**
|
|
7552
|
-
*
|
|
7553
|
-
* This function provides a way to extract the value of an `Option` while
|
|
7554
|
-
* falling back to `undefined` if the `Option` is `None`.
|
|
7555
|
-
*
|
|
7556
|
-
* It is particularly useful in scenarios where `undefined` is an acceptable
|
|
7557
|
-
* placeholder for the absence of a value, such as when interacting with APIs or
|
|
7558
|
-
* systems that use `undefined` as a default for missing values.
|
|
7559
|
-
*
|
|
7560
|
-
* @example
|
|
7561
|
-
* ```ts
|
|
7562
|
-
* import { Option } from "effect"
|
|
7563
|
-
*
|
|
7564
|
-
* console.log(Option.getOrUndefined(Option.some(1)))
|
|
7565
|
-
* // Output: 1
|
|
7566
|
-
*
|
|
7567
|
-
* console.log(Option.getOrUndefined(Option.none()))
|
|
7568
|
-
* // Output: undefined
|
|
7569
|
-
* ```
|
|
7570
|
-
*
|
|
7571
|
-
* @category Getters
|
|
7572
|
-
* @since 2.0.0
|
|
7573
|
-
*/
|
|
7574
|
-
const getOrUndefined = /*#__PURE__*/getOrElse(constUndefined);
|
|
7575
|
-
|
|
7576
|
-
/**
|
|
7577
|
-
* This module provides utility functions for working with arrays in TypeScript.
|
|
7578
|
-
*
|
|
7579
|
-
* @since 2.0.0
|
|
7580
|
-
*/
|
|
7581
|
-
/**
|
|
7582
|
-
* Creates a new `Array` from an iterable collection of values.
|
|
7583
|
-
* If the input is already an array, it returns the input as-is.
|
|
7584
|
-
* Otherwise, it converts the iterable collection to an array.
|
|
7585
|
-
*
|
|
7586
|
-
* **Example**
|
|
7587
|
-
*
|
|
7588
|
-
* ```ts
|
|
7589
|
-
* import { Array } from "effect"
|
|
7590
|
-
*
|
|
7591
|
-
* const result = Array.fromIterable(new Set([1, 2, 3]))
|
|
7592
|
-
* console.log(result) // [1, 2, 3]
|
|
7593
|
-
* ```
|
|
7594
|
-
*
|
|
7595
|
-
* @category constructors
|
|
7596
|
-
* @since 2.0.0
|
|
7597
|
-
*/
|
|
7598
|
-
const fromIterable = collection => Array.isArray(collection) ? collection : Array.from(collection);
|
|
7599
|
-
/**
|
|
7600
|
-
* Reverse an `Iterable`, creating a new `Array`.
|
|
7601
|
-
*
|
|
7602
|
-
* **Example**
|
|
7603
|
-
*
|
|
7604
|
-
* ```ts
|
|
7605
|
-
* import { Array } from "effect"
|
|
7606
|
-
*
|
|
7607
|
-
* const result = Array.reverse([1, 2, 3, 4])
|
|
7608
|
-
* console.log(result) // [4, 3, 2, 1]
|
|
7609
|
-
* ```
|
|
7610
|
-
*
|
|
7611
|
-
* @category elements
|
|
7612
|
-
* @since 2.0.0
|
|
7613
|
-
*/
|
|
7614
|
-
const reverse$1 = self => Array.from(self).reverse();
|
|
7615
|
-
/**
|
|
7616
|
-
* Reduces an array from the left.
|
|
7617
|
-
*
|
|
7618
|
-
* **Example**
|
|
7619
|
-
*
|
|
7620
|
-
* ```ts
|
|
7621
|
-
* import { Array } from "effect"
|
|
7622
|
-
*
|
|
7623
|
-
* const result = Array.reduce([1, 2, 3], 0, (acc, n) => acc + n)
|
|
7624
|
-
* console.log(result) // 6
|
|
7625
|
-
* ```
|
|
7626
|
-
*
|
|
7627
|
-
* @category folding
|
|
7628
|
-
* @since 2.0.0
|
|
7629
|
-
*/
|
|
7630
|
-
const reduce$2 = /*#__PURE__*/dual(3, (self, b, f) => fromIterable(self).reduce((b, a, i) => f(b, a, i), b));
|
|
7631
|
-
|
|
7632
|
-
/**
|
|
7633
|
-
* This module provides types and utility functions to create and work with branded types,
|
|
7634
|
-
* which are TypeScript types with an added type tag to prevent accidental usage of a value in the wrong context.
|
|
7635
|
-
*
|
|
7636
|
-
* The `refined` and `nominal` functions are both used to create branded types in TypeScript.
|
|
7637
|
-
* The main difference between them is that `refined` allows for validation of the data, while `nominal` does not.
|
|
7638
|
-
*
|
|
7639
|
-
* 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.
|
|
7640
|
-
* This is useful when you want to distinguish between two values of the same type that have different meanings.
|
|
7641
|
-
* The `nominal` function does not perform any validation of the input data.
|
|
7642
|
-
*
|
|
7643
|
-
* On the other hand, the `refined` function is used to create a new branded type that has the same underlying type as the input,
|
|
7644
|
-
* but with a different name, and it also allows for validation of the input data.
|
|
7645
|
-
* The `refined` function takes a predicate that is used to validate the input data.
|
|
7646
|
-
* If the input data fails the validation, a `BrandErrors` is returned, which provides information about the specific validation failure.
|
|
7647
|
-
*
|
|
7648
|
-
* @since 2.0.0
|
|
7649
|
-
*/
|
|
7650
|
-
/**
|
|
7651
|
-
* @since 2.0.0
|
|
7652
|
-
* @category symbols
|
|
7653
|
-
*/
|
|
7654
|
-
const RefinedConstructorsTypeId = /*#__PURE__*/Symbol.for("effect/Brand/Refined");
|
|
7655
|
-
/**
|
|
7656
|
-
* Returns a `BrandErrors` that contains a single `RefinementError`.
|
|
7657
|
-
*
|
|
7658
|
-
* @since 2.0.0
|
|
7659
|
-
* @category constructors
|
|
7660
|
-
*/
|
|
7661
|
-
const error = (message, meta) => [{
|
|
7662
|
-
message,
|
|
7663
|
-
meta
|
|
7664
|
-
}];
|
|
7665
|
-
function refined(...args) {
|
|
7666
|
-
const either = args.length === 2 ? unbranded => args[0](unbranded) ? right(unbranded) : left(args[1](unbranded)) : unbranded => {
|
|
7667
|
-
return match(args[0](unbranded), {
|
|
7668
|
-
onNone: () => right(unbranded),
|
|
7669
|
-
onSome: left
|
|
7670
|
-
});
|
|
7671
|
-
};
|
|
7672
|
-
return Object.assign(unbranded => getOrThrowWith(either(unbranded), identity), {
|
|
7673
|
-
[RefinedConstructorsTypeId]: RefinedConstructorsTypeId,
|
|
7674
|
-
option: args => getRight(either(args)),
|
|
7675
|
-
either,
|
|
7676
|
-
is: args => isRight(either(args))
|
|
7677
|
-
});
|
|
7678
|
-
}
|
|
7679
|
-
|
|
7680
|
-
/**
|
|
7681
|
-
* @since 2.0.0
|
|
7682
|
-
*/
|
|
7683
|
-
const TypeId = /*#__PURE__*/Symbol.for("effect/Chunk");
|
|
7684
|
-
function copy(src, srcPos, dest, destPos, len) {
|
|
7685
|
-
for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
|
|
7686
|
-
dest[destPos + i - srcPos] = src[i];
|
|
7687
|
-
}
|
|
7688
|
-
return dest;
|
|
7689
|
-
}
|
|
7690
|
-
const emptyArray = [];
|
|
7691
|
-
/**
|
|
7692
|
-
* Compares the two chunks of equal length using the specified function
|
|
7693
|
-
*
|
|
7694
|
-
* @category equivalence
|
|
7695
|
-
* @since 2.0.0
|
|
7696
|
-
*/
|
|
7697
|
-
const getEquivalence = isEquivalent => make$2((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet(that, i))));
|
|
7698
|
-
const _equivalence = /*#__PURE__*/getEquivalence(equals);
|
|
7699
|
-
const ChunkProto = {
|
|
7700
|
-
[TypeId]: {
|
|
7701
|
-
_A: _ => _
|
|
7702
|
-
},
|
|
7703
|
-
toString() {
|
|
7704
|
-
return format(this.toJSON());
|
|
7705
|
-
},
|
|
7706
|
-
toJSON() {
|
|
7707
|
-
return {
|
|
7708
|
-
_id: "Chunk",
|
|
7709
|
-
values: toReadonlyArray(this).map(toJSON)
|
|
7710
|
-
};
|
|
7711
|
-
},
|
|
7712
|
-
[NodeInspectSymbol]() {
|
|
7713
|
-
return this.toJSON();
|
|
7714
|
-
},
|
|
7715
|
-
[symbol](that) {
|
|
7716
|
-
return isChunk(that) && _equivalence(this, that);
|
|
7717
|
-
},
|
|
7718
|
-
[symbol$1]() {
|
|
7719
|
-
return cached(this, array(toReadonlyArray(this)));
|
|
7720
|
-
},
|
|
7721
|
-
[Symbol.iterator]() {
|
|
7722
|
-
switch (this.backing._tag) {
|
|
7723
|
-
case "IArray":
|
|
7724
|
-
{
|
|
7725
|
-
return this.backing.array[Symbol.iterator]();
|
|
7726
|
-
}
|
|
7727
|
-
case "IEmpty":
|
|
7728
|
-
{
|
|
7729
|
-
return emptyArray[Symbol.iterator]();
|
|
7730
|
-
}
|
|
7731
|
-
default:
|
|
7732
|
-
{
|
|
7733
|
-
return toReadonlyArray(this)[Symbol.iterator]();
|
|
7734
|
-
}
|
|
7735
|
-
}
|
|
7736
|
-
},
|
|
7737
|
-
pipe() {
|
|
7738
|
-
return pipeArguments(this, arguments);
|
|
7739
|
-
}
|
|
7740
|
-
};
|
|
7741
|
-
const makeChunk = backing => {
|
|
7742
|
-
const chunk = Object.create(ChunkProto);
|
|
7743
|
-
chunk.backing = backing;
|
|
7744
|
-
switch (backing._tag) {
|
|
7745
|
-
case "IEmpty":
|
|
7746
|
-
{
|
|
7747
|
-
chunk.length = 0;
|
|
7748
|
-
chunk.depth = 0;
|
|
7749
|
-
chunk.left = chunk;
|
|
7750
|
-
chunk.right = chunk;
|
|
7751
|
-
break;
|
|
7752
|
-
}
|
|
7753
|
-
case "IConcat":
|
|
7754
|
-
{
|
|
7755
|
-
chunk.length = backing.left.length + backing.right.length;
|
|
7756
|
-
chunk.depth = 1 + Math.max(backing.left.depth, backing.right.depth);
|
|
7757
|
-
chunk.left = backing.left;
|
|
7758
|
-
chunk.right = backing.right;
|
|
7759
|
-
break;
|
|
7760
|
-
}
|
|
7761
|
-
case "IArray":
|
|
7762
|
-
{
|
|
7763
|
-
chunk.length = backing.array.length;
|
|
7764
|
-
chunk.depth = 0;
|
|
7765
|
-
chunk.left = _empty$2;
|
|
7766
|
-
chunk.right = _empty$2;
|
|
7767
|
-
break;
|
|
7768
|
-
}
|
|
7769
|
-
case "ISingleton":
|
|
7770
|
-
{
|
|
7771
|
-
chunk.length = 1;
|
|
7772
|
-
chunk.depth = 0;
|
|
7773
|
-
chunk.left = _empty$2;
|
|
7774
|
-
chunk.right = _empty$2;
|
|
7775
|
-
break;
|
|
7776
|
-
}
|
|
7777
|
-
case "ISlice":
|
|
7778
|
-
{
|
|
7779
|
-
chunk.length = backing.length;
|
|
7780
|
-
chunk.depth = backing.chunk.depth + 1;
|
|
7781
|
-
chunk.left = _empty$2;
|
|
7782
|
-
chunk.right = _empty$2;
|
|
7783
|
-
break;
|
|
7784
|
-
}
|
|
7785
|
-
}
|
|
7786
|
-
return chunk;
|
|
7787
|
-
};
|
|
7788
|
-
/**
|
|
7789
|
-
* Checks if `u` is a `Chunk<unknown>`
|
|
7790
|
-
*
|
|
7791
|
-
* @category constructors
|
|
7792
|
-
* @since 2.0.0
|
|
7793
|
-
*/
|
|
7794
|
-
const isChunk = u => hasProperty(u, TypeId);
|
|
7795
|
-
const _empty$2 = /*#__PURE__*/makeChunk({
|
|
7796
|
-
_tag: "IEmpty"
|
|
7797
|
-
});
|
|
7798
|
-
/**
|
|
7799
|
-
* @category constructors
|
|
7800
|
-
* @since 2.0.0
|
|
7801
|
-
*/
|
|
7802
|
-
const empty$3 = () => _empty$2;
|
|
7803
|
-
/**
|
|
7804
|
-
* Builds a `NonEmptyChunk` from an non-empty collection of elements.
|
|
7805
|
-
*
|
|
7806
|
-
* @category constructors
|
|
7807
|
-
* @since 2.0.0
|
|
7808
|
-
*/
|
|
7809
|
-
const make$1 = (...as) => unsafeFromNonEmptyArray(as);
|
|
7810
|
-
/**
|
|
7811
|
-
* Builds a `NonEmptyChunk` from a single element.
|
|
7812
|
-
*
|
|
7813
|
-
* @category constructors
|
|
7814
|
-
* @since 2.0.0
|
|
7815
|
-
*/
|
|
7816
|
-
const of = a => makeChunk({
|
|
7817
|
-
_tag: "ISingleton",
|
|
7818
|
-
a
|
|
7819
|
-
});
|
|
7820
|
-
const copyToArray = (self, array, initial) => {
|
|
7821
|
-
switch (self.backing._tag) {
|
|
7822
|
-
case "IArray":
|
|
7823
|
-
{
|
|
7824
|
-
copy(self.backing.array, 0, array, initial, self.length);
|
|
7825
|
-
break;
|
|
7826
|
-
}
|
|
7827
|
-
case "IConcat":
|
|
7828
|
-
{
|
|
7829
|
-
copyToArray(self.left, array, initial);
|
|
7830
|
-
copyToArray(self.right, array, initial + self.left.length);
|
|
7831
|
-
break;
|
|
7832
|
-
}
|
|
7833
|
-
case "ISingleton":
|
|
7834
|
-
{
|
|
7835
|
-
array[initial] = self.backing.a;
|
|
7836
|
-
break;
|
|
7837
|
-
}
|
|
7838
|
-
case "ISlice":
|
|
7839
|
-
{
|
|
7840
|
-
let i = 0;
|
|
7841
|
-
let j = initial;
|
|
7842
|
-
while (i < self.length) {
|
|
7843
|
-
array[j] = unsafeGet(self, i);
|
|
7844
|
-
i += 1;
|
|
7845
|
-
j += 1;
|
|
7846
|
-
}
|
|
7847
|
-
break;
|
|
7848
|
-
}
|
|
7849
|
-
}
|
|
7850
|
-
};
|
|
7851
|
-
const toReadonlyArray_ = self => {
|
|
7852
|
-
switch (self.backing._tag) {
|
|
7853
|
-
case "IEmpty":
|
|
7854
|
-
{
|
|
7855
|
-
return emptyArray;
|
|
7856
|
-
}
|
|
7857
|
-
case "IArray":
|
|
7858
|
-
{
|
|
7859
|
-
return self.backing.array;
|
|
7860
|
-
}
|
|
7861
|
-
default:
|
|
7862
|
-
{
|
|
7863
|
-
const arr = new Array(self.length);
|
|
7864
|
-
copyToArray(self, arr, 0);
|
|
7865
|
-
self.backing = {
|
|
7866
|
-
_tag: "IArray",
|
|
7867
|
-
array: arr
|
|
7868
|
-
};
|
|
7869
|
-
self.left = _empty$2;
|
|
7870
|
-
self.right = _empty$2;
|
|
7871
|
-
self.depth = 0;
|
|
7872
|
-
return arr;
|
|
7873
|
-
}
|
|
7874
|
-
}
|
|
7875
|
-
};
|
|
7876
|
-
/**
|
|
7877
|
-
* Converts a `Chunk` into a `ReadonlyArray`. If the provided `Chunk` is
|
|
7878
|
-
* non-empty (`NonEmptyChunk`), the function will return a
|
|
7879
|
-
* `NonEmptyReadonlyArray`, ensuring the non-empty property is preserved.
|
|
7880
|
-
*
|
|
7881
|
-
* @category conversions
|
|
7882
|
-
* @since 2.0.0
|
|
7883
|
-
*/
|
|
7884
|
-
const toReadonlyArray = toReadonlyArray_;
|
|
7885
|
-
const reverseChunk = self => {
|
|
7886
|
-
switch (self.backing._tag) {
|
|
7887
|
-
case "IEmpty":
|
|
7888
|
-
case "ISingleton":
|
|
7889
|
-
return self;
|
|
7890
|
-
case "IArray":
|
|
7891
|
-
{
|
|
7892
|
-
return makeChunk({
|
|
7893
|
-
_tag: "IArray",
|
|
7894
|
-
array: reverse$1(self.backing.array)
|
|
7895
|
-
});
|
|
7896
|
-
}
|
|
7897
|
-
case "IConcat":
|
|
7898
|
-
{
|
|
7899
|
-
return makeChunk({
|
|
7900
|
-
_tag: "IConcat",
|
|
7901
|
-
left: reverse(self.backing.right),
|
|
7902
|
-
right: reverse(self.backing.left)
|
|
7903
|
-
});
|
|
7904
|
-
}
|
|
7905
|
-
case "ISlice":
|
|
7906
|
-
return unsafeFromArray(reverse$1(toReadonlyArray(self)));
|
|
7907
|
-
}
|
|
7908
|
-
};
|
|
7909
|
-
/**
|
|
7910
|
-
* Reverses the order of elements in a `Chunk`.
|
|
7911
|
-
* Importantly, if the input chunk is a `NonEmptyChunk`, the reversed chunk will also be a `NonEmptyChunk`.
|
|
7912
|
-
*
|
|
7913
|
-
* **Example**
|
|
7914
|
-
*
|
|
7915
|
-
* ```ts
|
|
7916
|
-
* import { Chunk } from "effect"
|
|
7917
|
-
*
|
|
7918
|
-
* const chunk = Chunk.make(1, 2, 3)
|
|
7919
|
-
* const result = Chunk.reverse(chunk)
|
|
7920
|
-
*
|
|
7921
|
-
* console.log(result)
|
|
7922
|
-
* // { _id: 'Chunk', values: [ 3, 2, 1 ] }
|
|
7923
|
-
* ```
|
|
7924
|
-
*
|
|
7925
|
-
* @since 2.0.0
|
|
7926
|
-
* @category elements
|
|
7927
|
-
*/
|
|
7928
|
-
const reverse = reverseChunk;
|
|
7929
|
-
/**
|
|
7930
|
-
* Wraps an array into a chunk without copying, unsafe on mutable arrays
|
|
7931
|
-
*
|
|
7932
|
-
* @since 2.0.0
|
|
7933
|
-
* @category unsafe
|
|
7934
|
-
*/
|
|
7935
|
-
const unsafeFromArray = self => self.length === 0 ? empty$3() : self.length === 1 ? of(self[0]) : makeChunk({
|
|
7936
|
-
_tag: "IArray",
|
|
7937
|
-
array: self
|
|
7938
|
-
});
|
|
7939
|
-
/**
|
|
7940
|
-
* Wraps an array into a chunk without copying, unsafe on mutable arrays
|
|
7941
|
-
*
|
|
7942
|
-
* @since 2.0.0
|
|
7943
|
-
* @category unsafe
|
|
7944
|
-
*/
|
|
7945
|
-
const unsafeFromNonEmptyArray = self => unsafeFromArray(self);
|
|
7946
|
-
/**
|
|
7947
|
-
* Gets an element unsafely, will throw on out of bounds
|
|
7948
|
-
*
|
|
7949
|
-
* @since 2.0.0
|
|
7950
|
-
* @category unsafe
|
|
7951
|
-
*/
|
|
7952
|
-
const unsafeGet = /*#__PURE__*/dual(2, (self, index) => {
|
|
7953
|
-
switch (self.backing._tag) {
|
|
7954
|
-
case "IEmpty":
|
|
7955
|
-
{
|
|
7956
|
-
throw new Error(`Index out of bounds`);
|
|
7957
|
-
}
|
|
7958
|
-
case "ISingleton":
|
|
7959
|
-
{
|
|
7960
|
-
if (index !== 0) {
|
|
7961
|
-
throw new Error(`Index out of bounds`);
|
|
7962
|
-
}
|
|
7963
|
-
return self.backing.a;
|
|
7964
|
-
}
|
|
7965
|
-
case "IArray":
|
|
7966
|
-
{
|
|
7967
|
-
if (index >= self.length || index < 0) {
|
|
7968
|
-
throw new Error(`Index out of bounds`);
|
|
7969
|
-
}
|
|
7970
|
-
return self.backing.array[index];
|
|
7971
|
-
}
|
|
7972
|
-
case "IConcat":
|
|
7973
|
-
{
|
|
7974
|
-
return index < self.left.length ? unsafeGet(self.left, index) : unsafeGet(self.right, index - self.left.length);
|
|
7975
|
-
}
|
|
7976
|
-
case "ISlice":
|
|
7977
|
-
{
|
|
7978
|
-
return unsafeGet(self.backing.chunk, index + self.backing.offset);
|
|
7979
|
-
}
|
|
7980
|
-
}
|
|
7981
|
-
});
|
|
7982
|
-
/**
|
|
7983
|
-
* Prepend an element to the front of a `Chunk`, creating a new `NonEmptyChunk`.
|
|
7984
|
-
*
|
|
7985
|
-
* @category concatenating
|
|
7986
|
-
* @since 2.0.0
|
|
7987
|
-
*/
|
|
7988
|
-
const prepend = /*#__PURE__*/dual(2, (self, elem) => appendAll(of(elem), self));
|
|
7989
|
-
/**
|
|
7990
|
-
* Concatenates two chunks, combining their elements.
|
|
7991
|
-
* If either chunk is non-empty, the result is also a non-empty chunk.
|
|
7992
|
-
*
|
|
7993
|
-
* **Example**
|
|
7994
|
-
*
|
|
7995
|
-
* ```ts
|
|
7996
|
-
* import { Chunk } from "effect"
|
|
7997
|
-
*
|
|
7998
|
-
* const result = Chunk.make(1, 2).pipe(Chunk.appendAll(Chunk.make("a", "b")), Chunk.toArray)
|
|
7999
|
-
*
|
|
8000
|
-
* console.log(result)
|
|
8001
|
-
* // [ 1, 2, "a", "b" ]
|
|
8002
|
-
* ```
|
|
8003
|
-
*
|
|
8004
|
-
* @category concatenating
|
|
8005
|
-
* @since 2.0.0
|
|
8006
|
-
*/
|
|
8007
|
-
const appendAll = /*#__PURE__*/dual(2, (self, that) => {
|
|
8008
|
-
if (self.backing._tag === "IEmpty") {
|
|
8009
|
-
return that;
|
|
8010
|
-
}
|
|
8011
|
-
if (that.backing._tag === "IEmpty") {
|
|
8012
|
-
return self;
|
|
8013
|
-
}
|
|
8014
|
-
const diff = that.depth - self.depth;
|
|
8015
|
-
if (Math.abs(diff) <= 1) {
|
|
8016
|
-
return makeChunk({
|
|
8017
|
-
_tag: "IConcat",
|
|
8018
|
-
left: self,
|
|
8019
|
-
right: that
|
|
8020
|
-
});
|
|
8021
|
-
} else if (diff < -1) {
|
|
8022
|
-
if (self.left.depth >= self.right.depth) {
|
|
8023
|
-
const nr = appendAll(self.right, that);
|
|
8024
|
-
return makeChunk({
|
|
8025
|
-
_tag: "IConcat",
|
|
8026
|
-
left: self.left,
|
|
8027
|
-
right: nr
|
|
8028
|
-
});
|
|
8029
|
-
} else {
|
|
8030
|
-
const nrr = appendAll(self.right.right, that);
|
|
8031
|
-
if (nrr.depth === self.depth - 3) {
|
|
8032
|
-
const nr = makeChunk({
|
|
8033
|
-
_tag: "IConcat",
|
|
8034
|
-
left: self.right.left,
|
|
8035
|
-
right: nrr
|
|
8036
|
-
});
|
|
8037
|
-
return makeChunk({
|
|
8038
|
-
_tag: "IConcat",
|
|
8039
|
-
left: self.left,
|
|
8040
|
-
right: nr
|
|
8041
|
-
});
|
|
8042
|
-
} else {
|
|
8043
|
-
const nl = makeChunk({
|
|
8044
|
-
_tag: "IConcat",
|
|
8045
|
-
left: self.left,
|
|
8046
|
-
right: self.right.left
|
|
8047
|
-
});
|
|
8048
|
-
return makeChunk({
|
|
8049
|
-
_tag: "IConcat",
|
|
8050
|
-
left: nl,
|
|
8051
|
-
right: nrr
|
|
8052
|
-
});
|
|
8053
|
-
}
|
|
8054
|
-
}
|
|
8055
|
-
} else {
|
|
8056
|
-
if (that.right.depth >= that.left.depth) {
|
|
8057
|
-
const nl = appendAll(self, that.left);
|
|
8058
|
-
return makeChunk({
|
|
8059
|
-
_tag: "IConcat",
|
|
8060
|
-
left: nl,
|
|
8061
|
-
right: that.right
|
|
8062
|
-
});
|
|
8063
|
-
} else {
|
|
8064
|
-
const nll = appendAll(self, that.left.left);
|
|
8065
|
-
if (nll.depth === that.depth - 3) {
|
|
8066
|
-
const nl = makeChunk({
|
|
8067
|
-
_tag: "IConcat",
|
|
8068
|
-
left: nll,
|
|
8069
|
-
right: that.left.right
|
|
8070
|
-
});
|
|
8071
|
-
return makeChunk({
|
|
8072
|
-
_tag: "IConcat",
|
|
8073
|
-
left: nl,
|
|
8074
|
-
right: that.right
|
|
8075
|
-
});
|
|
8076
|
-
} else {
|
|
8077
|
-
const nr = makeChunk({
|
|
8078
|
-
_tag: "IConcat",
|
|
8079
|
-
left: that.left.right,
|
|
8080
|
-
right: that.right
|
|
8081
|
-
});
|
|
8082
|
-
return makeChunk({
|
|
8083
|
-
_tag: "IConcat",
|
|
8084
|
-
left: nll,
|
|
8085
|
-
right: nr
|
|
8086
|
-
});
|
|
8087
|
-
}
|
|
8088
|
-
}
|
|
8089
|
-
}
|
|
8090
|
-
});
|
|
8091
|
-
/**
|
|
8092
|
-
* Determines if the chunk is empty.
|
|
8093
|
-
*
|
|
8094
|
-
* @since 2.0.0
|
|
8095
|
-
* @category elements
|
|
8096
|
-
*/
|
|
8097
|
-
const isEmpty = self => self.length === 0;
|
|
8098
|
-
/**
|
|
8099
|
-
* Determines if the chunk is not empty.
|
|
8100
|
-
*
|
|
8101
|
-
* @since 2.0.0
|
|
8102
|
-
* @category elements
|
|
8103
|
-
*/
|
|
8104
|
-
const isNonEmpty = self => self.length > 0;
|
|
8105
|
-
/**
|
|
8106
|
-
* Returns the first element of this chunk.
|
|
8107
|
-
*
|
|
8108
|
-
* It will throw an error if the chunk is empty.
|
|
8109
|
-
*
|
|
8110
|
-
* @since 2.0.0
|
|
8111
|
-
* @category unsafe
|
|
8112
|
-
*/
|
|
8113
|
-
const unsafeHead = self => unsafeGet(self, 0);
|
|
8114
|
-
/**
|
|
8115
|
-
* Returns the first element of this non empty chunk.
|
|
8116
|
-
*
|
|
8117
|
-
* @since 2.0.0
|
|
8118
|
-
* @category elements
|
|
8119
|
-
*/
|
|
8120
|
-
const headNonEmpty = unsafeHead;
|
|
8121
|
-
|
|
8122
|
-
/** @internal */
|
|
8123
|
-
const SIZE = 5;
|
|
8124
|
-
/** @internal */
|
|
8125
|
-
const BUCKET_SIZE = /*#__PURE__*/Math.pow(2, SIZE);
|
|
8126
|
-
/** @internal */
|
|
8127
|
-
const MASK = BUCKET_SIZE - 1;
|
|
8128
|
-
/** @internal */
|
|
8129
|
-
const MAX_INDEX_NODE = BUCKET_SIZE / 2;
|
|
8130
|
-
/** @internal */
|
|
8131
|
-
const MIN_ARRAY_NODE = BUCKET_SIZE / 4;
|
|
8132
|
-
|
|
8133
|
-
/**
|
|
8134
|
-
* Hamming weight.
|
|
8135
|
-
*
|
|
8136
|
-
* Taken from: http://jsperf.com/hamming-weight
|
|
8137
|
-
*
|
|
8138
|
-
* @internal
|
|
8139
|
-
*/
|
|
8140
|
-
function popcount(x) {
|
|
8141
|
-
x -= x >> 1 & 0x55555555;
|
|
8142
|
-
x = (x & 0x33333333) + (x >> 2 & 0x33333333);
|
|
8143
|
-
x = x + (x >> 4) & 0x0f0f0f0f;
|
|
8144
|
-
x += x >> 8;
|
|
8145
|
-
x += x >> 16;
|
|
8146
|
-
return x & 0x7f;
|
|
8147
|
-
}
|
|
8148
|
-
/** @internal */
|
|
8149
|
-
function hashFragment(shift, h) {
|
|
8150
|
-
return h >>> shift & MASK;
|
|
8151
|
-
}
|
|
8152
|
-
/** @internal */
|
|
8153
|
-
function toBitmap(x) {
|
|
8154
|
-
return 1 << x;
|
|
8155
|
-
}
|
|
8156
|
-
/** @internal */
|
|
8157
|
-
function fromBitmap(bitmap, bit) {
|
|
8158
|
-
return popcount(bitmap & bit - 1);
|
|
8159
|
-
}
|
|
8160
|
-
|
|
8161
|
-
const make = (value, previous) => ({
|
|
8162
|
-
value,
|
|
8163
|
-
previous
|
|
8164
|
-
});
|
|
8165
|
-
|
|
8166
|
-
/** @internal */
|
|
8167
|
-
function arrayUpdate(mutate, at, v, arr) {
|
|
8168
|
-
let out = arr;
|
|
8169
|
-
if (!mutate) {
|
|
8170
|
-
const len = arr.length;
|
|
8171
|
-
out = new Array(len);
|
|
8172
|
-
for (let i = 0; i < len; ++i) out[i] = arr[i];
|
|
8173
|
-
}
|
|
8174
|
-
out[at] = v;
|
|
8175
|
-
return out;
|
|
8176
|
-
}
|
|
8177
|
-
/** @internal */
|
|
8178
|
-
function arraySpliceOut(mutate, at, arr) {
|
|
8179
|
-
const newLen = arr.length - 1;
|
|
8180
|
-
let i = 0;
|
|
8181
|
-
let g = 0;
|
|
8182
|
-
let out = arr;
|
|
8183
|
-
if (mutate) {
|
|
8184
|
-
i = g = at;
|
|
8185
|
-
} else {
|
|
8186
|
-
out = new Array(newLen);
|
|
8187
|
-
while (i < at) out[g++] = arr[i++];
|
|
8188
|
-
}
|
|
8189
|
-
++i;
|
|
8190
|
-
while (i <= newLen) out[g++] = arr[i++];
|
|
8191
|
-
if (mutate) {
|
|
8192
|
-
out.length = newLen;
|
|
8193
|
-
}
|
|
8194
|
-
return out;
|
|
8195
|
-
}
|
|
8196
|
-
/** @internal */
|
|
8197
|
-
function arraySpliceIn(mutate, at, v, arr) {
|
|
8198
|
-
const len = arr.length;
|
|
8199
|
-
if (mutate) {
|
|
8200
|
-
let i = len;
|
|
8201
|
-
while (i >= at) arr[i--] = arr[i];
|
|
8202
|
-
arr[at] = v;
|
|
8203
|
-
return arr;
|
|
8204
|
-
}
|
|
8205
|
-
let i = 0,
|
|
8206
|
-
g = 0;
|
|
8207
|
-
const out = new Array(len + 1);
|
|
8208
|
-
while (i < at) out[g++] = arr[i++];
|
|
8209
|
-
out[at] = v;
|
|
8210
|
-
while (i < len) out[++g] = arr[i++];
|
|
8211
|
-
return out;
|
|
8212
|
-
}
|
|
8213
|
-
|
|
8214
|
-
/** @internal */
|
|
8215
|
-
class EmptyNode {
|
|
8216
|
-
_tag = "EmptyNode";
|
|
8217
|
-
modify(edit, _shift, f, hash, key, size) {
|
|
8218
|
-
const v = f(none());
|
|
8219
|
-
if (isNone(v)) return new EmptyNode();
|
|
8220
|
-
++size.value;
|
|
8221
|
-
return new LeafNode(edit, hash, key, v);
|
|
8222
|
-
}
|
|
8223
|
-
}
|
|
8224
|
-
/** @internal */
|
|
8225
|
-
function isEmptyNode(a) {
|
|
8226
|
-
return isTagged(a, "EmptyNode");
|
|
8227
|
-
}
|
|
8228
|
-
/** @internal */
|
|
8229
|
-
function isLeafNode(node) {
|
|
8230
|
-
return isEmptyNode(node) || node._tag === "LeafNode" || node._tag === "CollisionNode";
|
|
8231
|
-
}
|
|
8232
|
-
/** @internal */
|
|
8233
|
-
function canEditNode(node, edit) {
|
|
8234
|
-
return isEmptyNode(node) ? false : edit === node.edit;
|
|
8235
|
-
}
|
|
8236
|
-
/** @internal */
|
|
8237
|
-
class LeafNode {
|
|
8238
|
-
edit;
|
|
8239
|
-
hash;
|
|
8240
|
-
key;
|
|
8241
|
-
value;
|
|
8242
|
-
_tag = "LeafNode";
|
|
8243
|
-
constructor(edit, hash, key, value) {
|
|
8244
|
-
this.edit = edit;
|
|
8245
|
-
this.hash = hash;
|
|
8246
|
-
this.key = key;
|
|
8247
|
-
this.value = value;
|
|
8248
|
-
}
|
|
8249
|
-
modify(edit, shift, f, hash, key, size) {
|
|
8250
|
-
if (equals(key, this.key)) {
|
|
8251
|
-
const v = f(this.value);
|
|
8252
|
-
if (v === this.value) return this;else if (isNone(v)) {
|
|
8253
|
-
--size.value;
|
|
8254
|
-
return new EmptyNode();
|
|
8255
|
-
}
|
|
8256
|
-
if (canEditNode(this, edit)) {
|
|
8257
|
-
this.value = v;
|
|
8258
|
-
return this;
|
|
8259
|
-
}
|
|
8260
|
-
return new LeafNode(edit, hash, key, v);
|
|
8261
|
-
}
|
|
8262
|
-
const v = f(none());
|
|
8263
|
-
if (isNone(v)) return this;
|
|
8264
|
-
++size.value;
|
|
8265
|
-
return mergeLeaves(edit, shift, this.hash, this, hash, new LeafNode(edit, hash, key, v));
|
|
8266
|
-
}
|
|
8267
|
-
}
|
|
8268
|
-
/** @internal */
|
|
8269
|
-
class CollisionNode {
|
|
8270
|
-
edit;
|
|
8271
|
-
hash;
|
|
8272
|
-
children;
|
|
8273
|
-
_tag = "CollisionNode";
|
|
8274
|
-
constructor(edit, hash, children) {
|
|
8275
|
-
this.edit = edit;
|
|
8276
|
-
this.hash = hash;
|
|
8277
|
-
this.children = children;
|
|
8278
|
-
}
|
|
8279
|
-
modify(edit, shift, f, hash, key, size) {
|
|
8280
|
-
if (hash === this.hash) {
|
|
8281
|
-
const canEdit = canEditNode(this, edit);
|
|
8282
|
-
const list = this.updateCollisionList(canEdit, edit, this.hash, this.children, f, key, size);
|
|
8283
|
-
if (list === this.children) return this;
|
|
8284
|
-
return list.length > 1 ? new CollisionNode(edit, this.hash, list) : list[0]; // collapse single element collision list
|
|
8285
|
-
}
|
|
8286
|
-
const v = f(none());
|
|
8287
|
-
if (isNone(v)) return this;
|
|
8288
|
-
++size.value;
|
|
8289
|
-
return mergeLeaves(edit, shift, this.hash, this, hash, new LeafNode(edit, hash, key, v));
|
|
8290
|
-
}
|
|
8291
|
-
updateCollisionList(mutate, edit, hash, list, f, key, size) {
|
|
8292
|
-
const len = list.length;
|
|
8293
|
-
for (let i = 0; i < len; ++i) {
|
|
8294
|
-
const child = list[i];
|
|
8295
|
-
if ("key" in child && equals(key, child.key)) {
|
|
8296
|
-
const value = child.value;
|
|
8297
|
-
const newValue = f(value);
|
|
8298
|
-
if (newValue === value) return list;
|
|
8299
|
-
if (isNone(newValue)) {
|
|
8300
|
-
--size.value;
|
|
8301
|
-
return arraySpliceOut(mutate, i, list);
|
|
8302
|
-
}
|
|
8303
|
-
return arrayUpdate(mutate, i, new LeafNode(edit, hash, key, newValue), list);
|
|
8304
|
-
}
|
|
8305
|
-
}
|
|
8306
|
-
const newValue = f(none());
|
|
8307
|
-
if (isNone(newValue)) return list;
|
|
8308
|
-
++size.value;
|
|
8309
|
-
return arrayUpdate(mutate, len, new LeafNode(edit, hash, key, newValue), list);
|
|
8310
|
-
}
|
|
8311
|
-
}
|
|
8312
|
-
/** @internal */
|
|
8313
|
-
class IndexedNode {
|
|
8314
|
-
edit;
|
|
8315
|
-
mask;
|
|
8316
|
-
children;
|
|
8317
|
-
_tag = "IndexedNode";
|
|
8318
|
-
constructor(edit, mask, children) {
|
|
8319
|
-
this.edit = edit;
|
|
8320
|
-
this.mask = mask;
|
|
8321
|
-
this.children = children;
|
|
8322
|
-
}
|
|
8323
|
-
modify(edit, shift, f, hash, key, size) {
|
|
8324
|
-
const mask = this.mask;
|
|
8325
|
-
const children = this.children;
|
|
8326
|
-
const frag = hashFragment(shift, hash);
|
|
8327
|
-
const bit = toBitmap(frag);
|
|
8328
|
-
const indx = fromBitmap(mask, bit);
|
|
8329
|
-
const exists = mask & bit;
|
|
8330
|
-
const canEdit = canEditNode(this, edit);
|
|
8331
|
-
if (!exists) {
|
|
8332
|
-
const _newChild = new EmptyNode().modify(edit, shift + SIZE, f, hash, key, size);
|
|
8333
|
-
if (!_newChild) return this;
|
|
8334
|
-
return children.length >= MAX_INDEX_NODE ? expand(edit, frag, _newChild, mask, children) : new IndexedNode(edit, mask | bit, arraySpliceIn(canEdit, indx, _newChild, children));
|
|
8335
|
-
}
|
|
8336
|
-
const current = children[indx];
|
|
8337
|
-
const child = current.modify(edit, shift + SIZE, f, hash, key, size);
|
|
8338
|
-
if (current === child) return this;
|
|
8339
|
-
let bitmap = mask;
|
|
8340
|
-
let newChildren;
|
|
8341
|
-
if (isEmptyNode(child)) {
|
|
8342
|
-
// remove
|
|
8343
|
-
bitmap &= ~bit;
|
|
8344
|
-
if (!bitmap) return new EmptyNode();
|
|
8345
|
-
if (children.length <= 2 && isLeafNode(children[indx ^ 1])) {
|
|
8346
|
-
return children[indx ^ 1]; // collapse
|
|
8347
|
-
}
|
|
8348
|
-
newChildren = arraySpliceOut(canEdit, indx, children);
|
|
8349
|
-
} else {
|
|
8350
|
-
// modify
|
|
8351
|
-
newChildren = arrayUpdate(canEdit, indx, child, children);
|
|
8352
|
-
}
|
|
8353
|
-
if (canEdit) {
|
|
8354
|
-
this.mask = bitmap;
|
|
8355
|
-
this.children = newChildren;
|
|
8356
|
-
return this;
|
|
8357
|
-
}
|
|
8358
|
-
return new IndexedNode(edit, bitmap, newChildren);
|
|
8359
|
-
}
|
|
8360
|
-
}
|
|
8361
|
-
/** @internal */
|
|
8362
|
-
class ArrayNode {
|
|
8363
|
-
edit;
|
|
8364
|
-
size;
|
|
8365
|
-
children;
|
|
8366
|
-
_tag = "ArrayNode";
|
|
8367
|
-
constructor(edit, size, children) {
|
|
8368
|
-
this.edit = edit;
|
|
8369
|
-
this.size = size;
|
|
8370
|
-
this.children = children;
|
|
8371
|
-
}
|
|
8372
|
-
modify(edit, shift, f, hash, key, size) {
|
|
8373
|
-
let count = this.size;
|
|
8374
|
-
const children = this.children;
|
|
8375
|
-
const frag = hashFragment(shift, hash);
|
|
8376
|
-
const child = children[frag];
|
|
8377
|
-
const newChild = (child || new EmptyNode()).modify(edit, shift + SIZE, f, hash, key, size);
|
|
8378
|
-
if (child === newChild) return this;
|
|
8379
|
-
const canEdit = canEditNode(this, edit);
|
|
8380
|
-
let newChildren;
|
|
8381
|
-
if (isEmptyNode(child) && !isEmptyNode(newChild)) {
|
|
8382
|
-
// add
|
|
8383
|
-
++count;
|
|
8384
|
-
newChildren = arrayUpdate(canEdit, frag, newChild, children);
|
|
8385
|
-
} else if (!isEmptyNode(child) && isEmptyNode(newChild)) {
|
|
8386
|
-
// remove
|
|
8387
|
-
--count;
|
|
8388
|
-
if (count <= MIN_ARRAY_NODE) {
|
|
8389
|
-
return pack(edit, count, frag, children);
|
|
8390
|
-
}
|
|
8391
|
-
newChildren = arrayUpdate(canEdit, frag, new EmptyNode(), children);
|
|
8392
|
-
} else {
|
|
8393
|
-
// modify
|
|
8394
|
-
newChildren = arrayUpdate(canEdit, frag, newChild, children);
|
|
8395
|
-
}
|
|
8396
|
-
if (canEdit) {
|
|
8397
|
-
this.size = count;
|
|
8398
|
-
this.children = newChildren;
|
|
8399
|
-
return this;
|
|
8400
|
-
}
|
|
8401
|
-
return new ArrayNode(edit, count, newChildren);
|
|
8402
|
-
}
|
|
8403
|
-
}
|
|
8404
|
-
function pack(edit, count, removed, elements) {
|
|
8405
|
-
const children = new Array(count - 1);
|
|
8406
|
-
let g = 0;
|
|
8407
|
-
let bitmap = 0;
|
|
8408
|
-
for (let i = 0, len = elements.length; i < len; ++i) {
|
|
8409
|
-
if (i !== removed) {
|
|
8410
|
-
const elem = elements[i];
|
|
8411
|
-
if (elem && !isEmptyNode(elem)) {
|
|
8412
|
-
children[g++] = elem;
|
|
8413
|
-
bitmap |= 1 << i;
|
|
8414
|
-
}
|
|
8415
|
-
}
|
|
8416
|
-
}
|
|
8417
|
-
return new IndexedNode(edit, bitmap, children);
|
|
8418
|
-
}
|
|
8419
|
-
function expand(edit, frag, child, bitmap, subNodes) {
|
|
8420
|
-
const arr = [];
|
|
8421
|
-
let bit = bitmap;
|
|
8422
|
-
let count = 0;
|
|
8423
|
-
for (let i = 0; bit; ++i) {
|
|
8424
|
-
if (bit & 1) arr[i] = subNodes[count++];
|
|
8425
|
-
bit >>>= 1;
|
|
8426
|
-
}
|
|
8427
|
-
arr[frag] = child;
|
|
8428
|
-
return new ArrayNode(edit, count + 1, arr);
|
|
8429
|
-
}
|
|
8430
|
-
function mergeLeavesInner(edit, shift, h1, n1, h2, n2) {
|
|
8431
|
-
if (h1 === h2) return new CollisionNode(edit, h1, [n2, n1]);
|
|
8432
|
-
const subH1 = hashFragment(shift, h1);
|
|
8433
|
-
const subH2 = hashFragment(shift, h2);
|
|
8434
|
-
if (subH1 === subH2) {
|
|
8435
|
-
return child => new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), [child]);
|
|
8436
|
-
} else {
|
|
8437
|
-
const children = subH1 < subH2 ? [n1, n2] : [n2, n1];
|
|
8438
|
-
return new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), children);
|
|
8439
|
-
}
|
|
8440
|
-
}
|
|
8441
|
-
function mergeLeaves(edit, shift, h1, n1, h2, n2) {
|
|
8442
|
-
let stack = undefined;
|
|
8443
|
-
let currentShift = shift;
|
|
8444
|
-
while (true) {
|
|
8445
|
-
const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2);
|
|
8446
|
-
if (typeof res === "function") {
|
|
8447
|
-
stack = make(res, stack);
|
|
8448
|
-
currentShift = currentShift + SIZE;
|
|
8449
|
-
} else {
|
|
8450
|
-
let final = res;
|
|
8451
|
-
while (stack != null) {
|
|
8452
|
-
final = stack.value(final);
|
|
8453
|
-
stack = stack.previous;
|
|
8454
|
-
}
|
|
8455
|
-
return final;
|
|
8456
|
-
}
|
|
8457
|
-
}
|
|
8458
|
-
}
|
|
8459
|
-
|
|
8460
|
-
const HashMapSymbolKey = "effect/HashMap";
|
|
8461
|
-
/** @internal */
|
|
8462
|
-
const HashMapTypeId = /*#__PURE__*/Symbol.for(HashMapSymbolKey);
|
|
8463
|
-
const HashMapProto = {
|
|
8464
|
-
[HashMapTypeId]: HashMapTypeId,
|
|
8465
|
-
[Symbol.iterator]() {
|
|
8466
|
-
return new HashMapIterator(this, (k, v) => [k, v]);
|
|
8467
|
-
},
|
|
8468
|
-
[symbol$1]() {
|
|
8469
|
-
let hash$1 = hash(HashMapSymbolKey);
|
|
8470
|
-
for (const item of this) {
|
|
8471
|
-
hash$1 ^= pipe(hash(item[0]), combine(hash(item[1])));
|
|
8472
|
-
}
|
|
8473
|
-
return cached(this, hash$1);
|
|
8474
|
-
},
|
|
8475
|
-
[symbol](that) {
|
|
8476
|
-
if (isHashMap(that)) {
|
|
8477
|
-
if (that._size !== this._size) {
|
|
8478
|
-
return false;
|
|
8479
|
-
}
|
|
8480
|
-
for (const item of this) {
|
|
8481
|
-
const elem = pipe(that, getHash(item[0], hash(item[0])));
|
|
8482
|
-
if (isNone(elem)) {
|
|
8483
|
-
return false;
|
|
8484
|
-
} else {
|
|
8485
|
-
if (!equals(item[1], elem.value)) {
|
|
8486
|
-
return false;
|
|
8487
|
-
}
|
|
8488
|
-
}
|
|
8489
|
-
}
|
|
8490
|
-
return true;
|
|
8491
|
-
}
|
|
8492
|
-
return false;
|
|
8493
|
-
},
|
|
8494
|
-
toString() {
|
|
8495
|
-
return format(this.toJSON());
|
|
8496
|
-
},
|
|
8497
|
-
toJSON() {
|
|
8498
|
-
return {
|
|
8499
|
-
_id: "HashMap",
|
|
8500
|
-
values: Array.from(this).map(toJSON)
|
|
8501
|
-
};
|
|
8502
|
-
},
|
|
8503
|
-
[NodeInspectSymbol]() {
|
|
8504
|
-
return this.toJSON();
|
|
8505
|
-
},
|
|
8506
|
-
pipe() {
|
|
8507
|
-
return pipeArguments(this, arguments);
|
|
8508
|
-
}
|
|
8509
|
-
};
|
|
8510
|
-
const makeImpl$1 = (editable, edit, root, size) => {
|
|
8511
|
-
const map = Object.create(HashMapProto);
|
|
8512
|
-
map._editable = editable;
|
|
8513
|
-
map._edit = edit;
|
|
8514
|
-
map._root = root;
|
|
8515
|
-
map._size = size;
|
|
8516
|
-
return map;
|
|
8517
|
-
};
|
|
8518
|
-
class HashMapIterator {
|
|
8519
|
-
map;
|
|
8520
|
-
f;
|
|
8521
|
-
v;
|
|
8522
|
-
constructor(map, f) {
|
|
8523
|
-
this.map = map;
|
|
8524
|
-
this.f = f;
|
|
8525
|
-
this.v = visitLazy(this.map._root, this.f, undefined);
|
|
8526
|
-
}
|
|
8527
|
-
next() {
|
|
8528
|
-
if (isNone(this.v)) {
|
|
8529
|
-
return {
|
|
8530
|
-
done: true,
|
|
8531
|
-
value: undefined
|
|
8532
|
-
};
|
|
8533
|
-
}
|
|
8534
|
-
const v0 = this.v.value;
|
|
8535
|
-
this.v = applyCont(v0.cont);
|
|
8536
|
-
return {
|
|
8537
|
-
done: false,
|
|
8538
|
-
value: v0.value
|
|
8539
|
-
};
|
|
8540
|
-
}
|
|
8541
|
-
[Symbol.iterator]() {
|
|
8542
|
-
return new HashMapIterator(this.map, this.f);
|
|
8543
|
-
}
|
|
8544
|
-
}
|
|
8545
|
-
const applyCont = cont => cont ? visitLazyChildren(cont[0], cont[1], cont[2], cont[3], cont[4]) : none();
|
|
8546
|
-
const visitLazy = (node, f, cont = undefined) => {
|
|
8547
|
-
switch (node._tag) {
|
|
8548
|
-
case "LeafNode":
|
|
8549
|
-
{
|
|
8550
|
-
if (isSome(node.value)) {
|
|
8551
|
-
return some({
|
|
8552
|
-
value: f(node.key, node.value.value),
|
|
8553
|
-
cont
|
|
8554
|
-
});
|
|
8555
|
-
}
|
|
8556
|
-
return applyCont(cont);
|
|
8557
|
-
}
|
|
8558
|
-
case "CollisionNode":
|
|
8559
|
-
case "ArrayNode":
|
|
8560
|
-
case "IndexedNode":
|
|
8561
|
-
{
|
|
8562
|
-
const children = node.children;
|
|
8563
|
-
return visitLazyChildren(children.length, children, 0, f, cont);
|
|
8564
|
-
}
|
|
8565
|
-
default:
|
|
8566
|
-
{
|
|
8567
|
-
return applyCont(cont);
|
|
8568
|
-
}
|
|
8569
|
-
}
|
|
8570
|
-
};
|
|
8571
|
-
const visitLazyChildren = (len, children, i, f, cont) => {
|
|
8572
|
-
while (i < len) {
|
|
8573
|
-
const child = children[i++];
|
|
8574
|
-
if (child && !isEmptyNode(child)) {
|
|
8575
|
-
return visitLazy(child, f, [len, children, i, f, cont]);
|
|
8576
|
-
}
|
|
8577
|
-
}
|
|
8578
|
-
return applyCont(cont);
|
|
8579
|
-
};
|
|
8580
|
-
const _empty$1 = /*#__PURE__*/makeImpl$1(false, 0, /*#__PURE__*/new EmptyNode(), 0);
|
|
8581
|
-
/** @internal */
|
|
8582
|
-
const empty$2 = () => _empty$1;
|
|
8583
|
-
/** @internal */
|
|
8584
|
-
const isHashMap = u => hasProperty(u, HashMapTypeId);
|
|
8585
|
-
/** @internal */
|
|
8586
|
-
const getHash = /*#__PURE__*/dual(3, (self, key, hash) => {
|
|
8587
|
-
let node = self._root;
|
|
8588
|
-
let shift = 0;
|
|
8589
|
-
while (true) {
|
|
8590
|
-
switch (node._tag) {
|
|
8591
|
-
case "LeafNode":
|
|
8592
|
-
{
|
|
8593
|
-
return equals(key, node.key) ? node.value : none();
|
|
8594
|
-
}
|
|
8595
|
-
case "CollisionNode":
|
|
8596
|
-
{
|
|
8597
|
-
if (hash === node.hash) {
|
|
8598
|
-
const children = node.children;
|
|
8599
|
-
for (let i = 0, len = children.length; i < len; ++i) {
|
|
8600
|
-
const child = children[i];
|
|
8601
|
-
if ("key" in child && equals(key, child.key)) {
|
|
8602
|
-
return child.value;
|
|
8603
|
-
}
|
|
8604
|
-
}
|
|
8605
|
-
}
|
|
8606
|
-
return none();
|
|
8607
|
-
}
|
|
8608
|
-
case "IndexedNode":
|
|
8609
|
-
{
|
|
8610
|
-
const frag = hashFragment(shift, hash);
|
|
8611
|
-
const bit = toBitmap(frag);
|
|
8612
|
-
if (node.mask & bit) {
|
|
8613
|
-
node = node.children[fromBitmap(node.mask, bit)];
|
|
8614
|
-
shift += SIZE;
|
|
8615
|
-
break;
|
|
8616
|
-
}
|
|
8617
|
-
return none();
|
|
8618
|
-
}
|
|
8619
|
-
case "ArrayNode":
|
|
8620
|
-
{
|
|
8621
|
-
node = node.children[hashFragment(shift, hash)];
|
|
8622
|
-
if (node) {
|
|
8623
|
-
shift += SIZE;
|
|
8624
|
-
break;
|
|
8625
|
-
}
|
|
8626
|
-
return none();
|
|
8627
|
-
}
|
|
8628
|
-
default:
|
|
8629
|
-
return none();
|
|
8630
|
-
}
|
|
8631
|
-
}
|
|
8632
|
-
});
|
|
8633
|
-
/** @internal */
|
|
8634
|
-
const set = /*#__PURE__*/dual(3, (self, key, value) => modifyAt(self, key, () => some(value)));
|
|
8635
|
-
/** @internal */
|
|
8636
|
-
const setTree = /*#__PURE__*/dual(3, (self, newRoot, newSize) => {
|
|
8637
|
-
if (self._editable) {
|
|
8638
|
-
self._root = newRoot;
|
|
8639
|
-
self._size = newSize;
|
|
8640
|
-
return self;
|
|
8641
|
-
}
|
|
8642
|
-
return newRoot === self._root ? self : makeImpl$1(self._editable, self._edit, newRoot, newSize);
|
|
8643
|
-
});
|
|
8644
|
-
/** @internal */
|
|
8645
|
-
const keys = self => new HashMapIterator(self, key => key);
|
|
8646
|
-
/** @internal */
|
|
8647
|
-
const size$2 = self => self._size;
|
|
8648
|
-
/** @internal */
|
|
8649
|
-
const beginMutation$1 = self => makeImpl$1(true, self._edit + 1, self._root, self._size);
|
|
8650
|
-
/** @internal */
|
|
8651
|
-
const modifyAt = /*#__PURE__*/dual(3, (self, key, f) => modifyHash(self, key, hash(key), f));
|
|
8652
|
-
/** @internal */
|
|
8653
|
-
const modifyHash = /*#__PURE__*/dual(4, (self, key, hash, f) => {
|
|
8654
|
-
const size = {
|
|
8655
|
-
value: self._size
|
|
8656
|
-
};
|
|
8657
|
-
const newRoot = self._root.modify(self._editable ? self._edit : NaN, 0, f, hash, key, size);
|
|
8658
|
-
return pipe(self, setTree(newRoot, size.value));
|
|
8659
|
-
});
|
|
8660
|
-
/** @internal */
|
|
8661
|
-
const forEach$1 = /*#__PURE__*/dual(2, (self, f) => reduce$1(self, void 0, (_, value, key) => f(value, key)));
|
|
8662
|
-
/** @internal */
|
|
8663
|
-
const reduce$1 = /*#__PURE__*/dual(3, (self, zero, f) => {
|
|
8664
|
-
const root = self._root;
|
|
8665
|
-
if (root._tag === "LeafNode") {
|
|
8666
|
-
return isSome(root.value) ? f(zero, root.value.value, root.key) : zero;
|
|
8667
|
-
}
|
|
8668
|
-
if (root._tag === "EmptyNode") {
|
|
8669
|
-
return zero;
|
|
8670
|
-
}
|
|
8671
|
-
const toVisit = [root.children];
|
|
8672
|
-
let children;
|
|
8673
|
-
while (children = toVisit.pop()) {
|
|
8674
|
-
for (let i = 0, len = children.length; i < len;) {
|
|
8675
|
-
const child = children[i++];
|
|
8676
|
-
if (child && !isEmptyNode(child)) {
|
|
8677
|
-
if (child._tag === "LeafNode") {
|
|
8678
|
-
if (isSome(child.value)) {
|
|
8679
|
-
zero = f(zero, child.value.value, child.key);
|
|
8680
|
-
}
|
|
8681
|
-
} else {
|
|
8682
|
-
toVisit.push(child.children);
|
|
8683
|
-
}
|
|
8684
|
-
}
|
|
8685
|
-
}
|
|
8686
|
-
}
|
|
8687
|
-
return zero;
|
|
8688
|
-
});
|
|
8689
|
-
|
|
8690
|
-
const HashSetSymbolKey = "effect/HashSet";
|
|
8691
|
-
/** @internal */
|
|
8692
|
-
const HashSetTypeId = /*#__PURE__*/Symbol.for(HashSetSymbolKey);
|
|
8693
|
-
const HashSetProto = {
|
|
8694
|
-
[HashSetTypeId]: HashSetTypeId,
|
|
8695
|
-
[Symbol.iterator]() {
|
|
8696
|
-
return keys(this._keyMap);
|
|
8697
|
-
},
|
|
8698
|
-
[symbol$1]() {
|
|
8699
|
-
return cached(this, combine(hash(this._keyMap))(hash(HashSetSymbolKey)));
|
|
8700
|
-
},
|
|
8701
|
-
[symbol](that) {
|
|
8702
|
-
if (isHashSet(that)) {
|
|
8703
|
-
return size$2(this._keyMap) === size$2(that._keyMap) && equals(this._keyMap, that._keyMap);
|
|
8704
|
-
}
|
|
8705
|
-
return false;
|
|
8706
|
-
},
|
|
8707
|
-
toString() {
|
|
8708
|
-
return format(this.toJSON());
|
|
8709
|
-
},
|
|
8710
|
-
toJSON() {
|
|
8711
|
-
return {
|
|
8712
|
-
_id: "HashSet",
|
|
8713
|
-
values: Array.from(this).map(toJSON)
|
|
8714
|
-
};
|
|
8715
|
-
},
|
|
8716
|
-
[NodeInspectSymbol]() {
|
|
8717
|
-
return this.toJSON();
|
|
8718
|
-
},
|
|
8719
|
-
pipe() {
|
|
8720
|
-
return pipeArguments(this, arguments);
|
|
8721
|
-
}
|
|
8722
|
-
};
|
|
8723
|
-
/** @internal */
|
|
8724
|
-
const makeImpl = keyMap => {
|
|
8725
|
-
const set = Object.create(HashSetProto);
|
|
8726
|
-
set._keyMap = keyMap;
|
|
8727
|
-
return set;
|
|
8728
|
-
};
|
|
8729
|
-
/** @internal */
|
|
8730
|
-
const isHashSet = u => hasProperty(u, HashSetTypeId);
|
|
8731
|
-
const _empty = /*#__PURE__*/makeImpl(/*#__PURE__*/empty$2());
|
|
8732
|
-
/** @internal */
|
|
8733
|
-
const empty$1 = () => _empty;
|
|
8734
|
-
/** @internal */
|
|
8735
|
-
const size$1 = self => size$2(self._keyMap);
|
|
8736
|
-
/** @internal */
|
|
8737
|
-
const beginMutation = self => makeImpl(beginMutation$1(self._keyMap));
|
|
8738
|
-
/** @internal */
|
|
8739
|
-
const endMutation = self => {
|
|
8740
|
-
self._keyMap._editable = false;
|
|
8741
|
-
return self;
|
|
8742
|
-
};
|
|
8743
|
-
/** @internal */
|
|
8744
|
-
const mutate = /*#__PURE__*/dual(2, (self, f) => {
|
|
8745
|
-
const transient = beginMutation(self);
|
|
8746
|
-
f(transient);
|
|
8747
|
-
return endMutation(transient);
|
|
8748
|
-
});
|
|
8749
|
-
/** @internal */
|
|
8750
|
-
const add$1 = /*#__PURE__*/dual(2, (self, value) => self._keyMap._editable ? (set(value, true)(self._keyMap), self) : makeImpl(set(value, true)(self._keyMap)));
|
|
8751
|
-
/** @internal */
|
|
8752
|
-
const union$1 = /*#__PURE__*/dual(2, (self, that) => mutate(empty$1(), set => {
|
|
8753
|
-
forEach(self, value => add$1(set, value));
|
|
8754
|
-
for (const value of that) {
|
|
8755
|
-
add$1(set, value);
|
|
8756
|
-
}
|
|
8757
|
-
}));
|
|
8758
|
-
/** @internal */
|
|
8759
|
-
const forEach = /*#__PURE__*/dual(2, (self, f) => forEach$1(self._keyMap, (_, k) => f(k)));
|
|
8760
|
-
|
|
8761
|
-
/**
|
|
8762
|
-
* # HashSet
|
|
8763
|
-
*
|
|
8764
|
-
* An immutable `HashSet` provides a collection of unique values with efficient
|
|
8765
|
-
* lookup, insertion and removal. Once created, a `HashSet` cannot be modified;
|
|
8766
|
-
* any operation that would alter the set instead returns a new `HashSet` with
|
|
8767
|
-
* the changes. This immutability offers benefits like predictable state
|
|
8768
|
-
* management and easier reasoning about your code.
|
|
8769
|
-
*
|
|
8770
|
-
* ## What Problem Does It Solve?
|
|
8771
|
-
*
|
|
8772
|
-
* `HashSet` solves the problem of maintaining an unsorted collection where each
|
|
8773
|
-
* value appears exactly once, with fast operations for checking membership and
|
|
8774
|
-
* adding/removing values.
|
|
8775
|
-
*
|
|
8776
|
-
* ## When to Use
|
|
8777
|
-
*
|
|
8778
|
-
* Use `HashSet` when you need:
|
|
8779
|
-
*
|
|
8780
|
-
* - A collection with no duplicate values
|
|
8781
|
-
* - Efficient membership testing (**`O(1)`** average complexity)
|
|
8782
|
-
* - Set operations like union, intersection, and difference
|
|
8783
|
-
* - An immutable data structure that preserves functional programming patterns
|
|
8784
|
-
*
|
|
8785
|
-
* ## Advanced Features
|
|
8786
|
-
*
|
|
8787
|
-
* HashSet provides operations for:
|
|
8788
|
-
*
|
|
8789
|
-
* - Transforming sets with map and flatMap
|
|
8790
|
-
* - Filtering elements with filter
|
|
8791
|
-
* - Combining sets with union, intersection and difference
|
|
8792
|
-
* - Performance optimizations via mutable operations in controlled contexts
|
|
8793
|
-
*
|
|
8794
|
-
* ## Performance Characteristics
|
|
8795
|
-
*
|
|
8796
|
-
* - **Lookup** operations ({@link module:HashSet.has}): **`O(1)`** average time
|
|
8797
|
-
* complexity
|
|
8798
|
-
* - **Insertion** operations ({@link module:HashSet.add}): **`O(1)`** average time
|
|
8799
|
-
* complexity
|
|
8800
|
-
* - **Removal** operations ({@link module:HashSet.remove}): **`O(1)`** average
|
|
8801
|
-
* time complexity
|
|
8802
|
-
* - **Set** operations ({@link module:HashSet.union},
|
|
8803
|
-
* {@link module:HashSet.intersection}): **`O(n)`** where n is the size of the
|
|
8804
|
-
* smaller set
|
|
8805
|
-
* - **Iteration**: **`O(n)`** where n is the size of the set
|
|
8806
|
-
*
|
|
8807
|
-
* The HashSet data structure implements the following traits:
|
|
8808
|
-
*
|
|
8809
|
-
* - {@link Iterable}: allows iterating over the values in the set
|
|
8810
|
-
* - {@link Equal}: allows comparing two sets for value-based equality
|
|
8811
|
-
* - {@link Pipeable}: allows chaining operations with the pipe operator
|
|
8812
|
-
* - {@link Inspectable}: allows inspecting the contents of the set
|
|
8813
|
-
*
|
|
8814
|
-
* ## Operations Reference
|
|
8815
|
-
*
|
|
8816
|
-
* | Category | Operation | Description | Complexity |
|
|
8817
|
-
* | ------------ | ----------------------------------- | ------------------------------------------- | ---------- |
|
|
8818
|
-
* | constructors | {@link module:HashSet.empty} | Creates an empty HashSet | O(1) |
|
|
8819
|
-
* | constructors | {@link module:HashSet.fromIterable} | Creates a HashSet from an iterable | O(n) |
|
|
8820
|
-
* | constructors | {@link module:HashSet.make} | Creates a HashSet from multiple values | O(n) |
|
|
8821
|
-
* | | | | |
|
|
8822
|
-
* | elements | {@link module:HashSet.has} | Checks if a value exists in the set | O(1) avg |
|
|
8823
|
-
* | elements | {@link module:HashSet.some} | Checks if any element satisfies a predicate | O(n) |
|
|
8824
|
-
* | elements | {@link module:HashSet.every} | Checks if all elements satisfy a predicate | O(n) |
|
|
8825
|
-
* | elements | {@link module:HashSet.isSubset} | Checks if a set is a subset of another | O(n) |
|
|
8826
|
-
* | | | | |
|
|
8827
|
-
* | getters | {@link module:HashSet.values} | Gets an iterator of all values | O(1) |
|
|
8828
|
-
* | getters | {@link module:HashSet.toValues} | Gets an array of all values | O(n) |
|
|
8829
|
-
* | getters | {@link module:HashSet.size} | Gets the number of elements | O(1) |
|
|
8830
|
-
* | | | | |
|
|
8831
|
-
* | mutations | {@link module:HashSet.add} | Adds a value to the set | O(1) avg |
|
|
8832
|
-
* | mutations | {@link module:HashSet.remove} | Removes a value from the set | O(1) avg |
|
|
8833
|
-
* | mutations | {@link module:HashSet.toggle} | Toggles a value's presence | O(1) avg |
|
|
8834
|
-
* | | | | |
|
|
8835
|
-
* | operations | {@link module:HashSet.difference} | Computes set difference (A - B) | O(n) |
|
|
8836
|
-
* | operations | {@link module:HashSet.intersection} | Computes set intersection (A ∩ B) | O(n) |
|
|
8837
|
-
* | operations | {@link module:HashSet.union} | Computes set union (A ∪ B) | O(n) |
|
|
8838
|
-
* | | | | |
|
|
8839
|
-
* | mapping | {@link module:HashSet.map} | Transforms each element | O(n) |
|
|
8840
|
-
* | | | | |
|
|
8841
|
-
* | sequencing | {@link module:HashSet.flatMap} | Transforms and flattens elements | O(n) |
|
|
8842
|
-
* | | | | |
|
|
8843
|
-
* | traversing | {@link module:HashSet.forEach} | Applies a function to each element | O(n) |
|
|
8844
|
-
* | | | | |
|
|
8845
|
-
* | folding | {@link module:HashSet.reduce} | Reduces the set to a single value | O(n) |
|
|
8846
|
-
* | | | | |
|
|
8847
|
-
* | filtering | {@link module:HashSet.filter} | Keeps elements that satisfy a predicate | O(n) |
|
|
8848
|
-
* | | | | |
|
|
8849
|
-
* | partitioning | {@link module:HashSet.partition} | Splits into two sets by a predicate | O(n) |
|
|
8850
|
-
*
|
|
8851
|
-
* ## Notes
|
|
8852
|
-
*
|
|
8853
|
-
* ### Composability with the Effect Ecosystem:
|
|
8854
|
-
*
|
|
8855
|
-
* This `HashSet` is designed to work seamlessly within the Effect ecosystem. It
|
|
8856
|
-
* implements the {@link Iterable}, {@link Equal}, {@link Pipeable}, and
|
|
8857
|
-
* {@link Inspectable} traits from Effect. This ensures compatibility with other
|
|
8858
|
-
* Effect data structures and functionalities. For example, you can easily use
|
|
8859
|
-
* Effect's `pipe` method to chain operations on the `HashSet`.
|
|
8860
|
-
*
|
|
8861
|
-
* **Equality of Elements with Effect's {@link Equal `Equal`} Trait:**
|
|
8862
|
-
*
|
|
8863
|
-
* This `HashSet` relies on Effect's {@link Equal} trait to determine the
|
|
8864
|
-
* uniqueness of elements within the set. The way equality is checked depends on
|
|
8865
|
-
* the type of the elements:
|
|
8866
|
-
*
|
|
8867
|
-
* - **Primitive Values:** For primitive JavaScript values like strings, numbers,
|
|
8868
|
-
* booleans, `null`, and `undefined`, equality is determined by their value
|
|
8869
|
-
* (similar to the `===` operator).
|
|
8870
|
-
* - **Objects and Custom Types:** For objects and other custom types, equality is
|
|
8871
|
-
* determined by whether those types implement the {@link Equal} interface
|
|
8872
|
-
* themselves. If an element type implements `Equal`, the `HashSet` will
|
|
8873
|
-
* delegate to that implementation to perform the equality check. This allows
|
|
8874
|
-
* you to define custom logic for determining when two instances of your
|
|
8875
|
-
* objects should be considered equal based on their properties, rather than
|
|
8876
|
-
* just their object identity.
|
|
8877
|
-
*
|
|
8878
|
-
* ```ts
|
|
8879
|
-
* import { Equal, Hash, HashSet } from "effect"
|
|
8880
|
-
*
|
|
8881
|
-
* class Person implements Equal.Equal {
|
|
8882
|
-
* constructor(
|
|
8883
|
-
* readonly id: number, // Unique identifier
|
|
8884
|
-
* readonly name: string,
|
|
8885
|
-
* readonly age: number
|
|
8886
|
-
* ) {}
|
|
8887
|
-
*
|
|
8888
|
-
* // Define equality based on id, name, and age
|
|
8889
|
-
* [Equal.symbol](that: Equal.Equal): boolean {
|
|
8890
|
-
* if (that instanceof Person) {
|
|
8891
|
-
* return (
|
|
8892
|
-
* Equal.equals(this.id, that.id) &&
|
|
8893
|
-
* Equal.equals(this.name, that.name) &&
|
|
8894
|
-
* Equal.equals(this.age, that.age)
|
|
8895
|
-
* )
|
|
8896
|
-
* }
|
|
8897
|
-
* return false
|
|
8898
|
-
* }
|
|
8899
|
-
*
|
|
8900
|
-
* // Generate a hash code based on the unique id
|
|
8901
|
-
* [Hash.symbol](): number {
|
|
8902
|
-
* return Hash.hash(this.id)
|
|
8903
|
-
* }
|
|
8904
|
-
* }
|
|
8905
|
-
*
|
|
8906
|
-
* // Creating a HashSet with objects that implement the Equal interface
|
|
8907
|
-
* const set = HashSet.empty().pipe(
|
|
8908
|
-
* HashSet.add(new Person(1, "Alice", 30)),
|
|
8909
|
-
* HashSet.add(new Person(1, "Alice", 30))
|
|
8910
|
-
* )
|
|
8911
|
-
*
|
|
8912
|
-
* // HashSet recognizes them as equal, so only one element is stored
|
|
8913
|
-
* console.log(HashSet.size(set))
|
|
8914
|
-
* // Output: 1
|
|
8915
|
-
* ```
|
|
8916
|
-
*
|
|
8917
|
-
* **Simplifying Equality and Hashing with `Data` and `Schema`:**
|
|
8918
|
-
*
|
|
8919
|
-
* Effect's {@link Data} and {@link Schema `Schema.Data`} modules offer powerful
|
|
8920
|
-
* ways to automatically handle the implementation of both the {@link Equal} and
|
|
8921
|
-
* {@link Hash} traits for your custom data structures.
|
|
8922
|
-
*
|
|
8923
|
-
* - **`Data` Module:** By using constructors like `Data.struct`, `Data.tuple`,
|
|
8924
|
-
* `Data.array`, or `Data.case` to define your data types, Effect
|
|
8925
|
-
* automatically generates the necessary implementations for value-based
|
|
8926
|
-
* equality and consistent hashing. This significantly reduces boilerplate and
|
|
8927
|
-
* ensures correctness.
|
|
8928
|
-
*
|
|
8929
|
-
* ```ts
|
|
8930
|
-
* import { HashSet, Data, Equal } from "effect"
|
|
8931
|
-
* import assert from "node:assert/strict"
|
|
8932
|
-
*
|
|
8933
|
-
* // Data.* implements the `Equal` traits for us
|
|
8934
|
-
* const person1 = Data.struct({ id: 1, name: "Alice", age: 30 })
|
|
8935
|
-
* const person2 = Data.struct({ id: 1, name: "Alice", age: 30 })
|
|
8936
|
-
*
|
|
8937
|
-
* assert(Equal.equals(person1, person2))
|
|
8938
|
-
*
|
|
8939
|
-
* const set = HashSet.empty().pipe(
|
|
8940
|
-
* HashSet.add(person1),
|
|
8941
|
-
* HashSet.add(person2)
|
|
8942
|
-
* )
|
|
8943
|
-
*
|
|
8944
|
-
* // HashSet recognizes them as equal, so only one element is stored
|
|
8945
|
-
* console.log(HashSet.size(set)) // Output: 1
|
|
8946
|
-
* ```
|
|
8947
|
-
*
|
|
8948
|
-
* - **`Schema` Module:** When defining data schemas using the {@link Schema}
|
|
8949
|
-
* module, you can use `Schema.Data` to automatically include the `Equal` and
|
|
8950
|
-
* `Hash` traits in the decoded objects. This is particularly important when
|
|
8951
|
-
* working with `HashSet`. **For decoded objects to be correctly recognized as
|
|
8952
|
-
* equal within a `HashSet`, ensure that the schema for those objects is
|
|
8953
|
-
* defined using `Schema.Data`.**
|
|
8954
|
-
*
|
|
8955
|
-
* ```ts
|
|
8956
|
-
* import { Equal, HashSet, Schema } from "effect"
|
|
8957
|
-
* import assert from "node:assert/strict"
|
|
8958
|
-
*
|
|
8959
|
-
* // Schema.Data implements the `Equal` traits for us
|
|
8960
|
-
* const PersonSchema = Schema.Data(
|
|
8961
|
-
* Schema.Struct({
|
|
8962
|
-
* id: Schema.Number,
|
|
8963
|
-
* name: Schema.String,
|
|
8964
|
-
* age: Schema.Number
|
|
8965
|
-
* })
|
|
8966
|
-
* )
|
|
8967
|
-
*
|
|
8968
|
-
* const Person = Schema.decode(PersonSchema)
|
|
8969
|
-
*
|
|
8970
|
-
* const person1 = Person({ id: 1, name: "Alice", age: 30 })
|
|
8971
|
-
* const person2 = Person({ id: 1, name: "Alice", age: 30 })
|
|
8972
|
-
*
|
|
8973
|
-
* assert(Equal.equals(person1, person2)) // Output: true
|
|
8974
|
-
*
|
|
8975
|
-
* const set = HashSet.empty().pipe(
|
|
8976
|
-
* HashSet.add(person1),
|
|
8977
|
-
* HashSet.add(person2)
|
|
8978
|
-
* )
|
|
8979
|
-
*
|
|
8980
|
-
* // HashSet thanks to Schema.Data implementation of the `Equal` trait, recognizes the two Person as equal, so only one element is stored
|
|
8981
|
-
* console.log(HashSet.size(set)) // Output: 1
|
|
8982
|
-
* ```
|
|
8983
|
-
*
|
|
8984
|
-
* ### Interoperability with the JavaScript Runtime:
|
|
8985
|
-
*
|
|
8986
|
-
* To interoperate with the regular JavaScript runtime, Effect's `HashSet`
|
|
8987
|
-
* provides methods to access its elements in formats readily usable by
|
|
8988
|
-
* JavaScript APIs: {@link values `HashSet.values`},
|
|
8989
|
-
* {@link toValues `HashSet.toValues`}
|
|
8990
|
-
*
|
|
8991
|
-
* ```ts
|
|
8992
|
-
* import { HashSet } from "effect"
|
|
8993
|
-
*
|
|
8994
|
-
* const hashSet: HashSet.HashSet<number> = HashSet.make(1, 2, 3)
|
|
8995
|
-
*
|
|
8996
|
-
* // Using HashSet.values to convert HashSet.HashSet<A> to IterableIterator<A>
|
|
8997
|
-
* const iterable: IterableIterator<number> = HashSet.values(hashSet)
|
|
8998
|
-
*
|
|
8999
|
-
* console.log(...iterable) // Logs: 1 2 3
|
|
9000
|
-
*
|
|
9001
|
-
* // Using HashSet.toValues to convert HashSet.HashSet<A> to Array<A>
|
|
9002
|
-
* const array: Array<number> = HashSet.toValues(hashSet)
|
|
9003
|
-
*
|
|
9004
|
-
* console.log(array) // Logs: [ 1, 2, 3 ]
|
|
9005
|
-
* ```
|
|
9006
|
-
*
|
|
9007
|
-
* Be mindful of performance implications (both time and space complexity) when
|
|
9008
|
-
* frequently converting between Effect's immutable HashSet and mutable
|
|
9009
|
-
* JavaScript data structures, especially for large collections.
|
|
9010
|
-
*
|
|
9011
|
-
* @module HashSet
|
|
9012
|
-
* @since 2.0.0
|
|
9013
|
-
*/
|
|
9014
|
-
/**
|
|
9015
|
-
* Creates an empty `HashSet`.
|
|
9016
|
-
*
|
|
9017
|
-
* Time complexity: **`O(1)`**
|
|
9018
|
-
*
|
|
9019
|
-
* @memberof HashSet
|
|
9020
|
-
* @since 2.0.0
|
|
9021
|
-
* @category constructors
|
|
9022
|
-
* @example
|
|
9023
|
-
*
|
|
9024
|
-
* ```ts
|
|
9025
|
-
* import { HashSet, pipe } from "effect"
|
|
9026
|
-
*
|
|
9027
|
-
* console.log(
|
|
9028
|
-
* pipe(
|
|
9029
|
-
* // Provide a type argument to create a HashSet of a specific type
|
|
9030
|
-
* HashSet.empty<number>(),
|
|
9031
|
-
* HashSet.add(1),
|
|
9032
|
-
* HashSet.add(1), // Notice the duplicate
|
|
9033
|
-
* HashSet.add(2),
|
|
9034
|
-
* HashSet.toValues
|
|
9035
|
-
* )
|
|
9036
|
-
* ) // Output: [1, 2]
|
|
9037
|
-
* ```
|
|
9038
|
-
*
|
|
9039
|
-
* @see Other `HashSet` constructors are {@link module:HashSet.make} {@link module:HashSet.fromIterable}
|
|
9040
|
-
*/
|
|
9041
|
-
const empty = empty$1;
|
|
9042
|
-
/**
|
|
9043
|
-
* Calculates the number of values in the `HashSet`.
|
|
9044
|
-
*
|
|
9045
|
-
* Time complexity: **`O(1)`**
|
|
9046
|
-
*
|
|
9047
|
-
* @memberof HashSet
|
|
9048
|
-
* @since 2.0.0
|
|
9049
|
-
* @category getters
|
|
9050
|
-
* @example
|
|
9051
|
-
*
|
|
9052
|
-
* ```ts
|
|
9053
|
-
* import { HashSet, pipe } from "effect"
|
|
9054
|
-
* import assert from "node:assert/strict"
|
|
9055
|
-
*
|
|
9056
|
-
* assert.deepStrictEqual(pipe(HashSet.empty(), HashSet.size), 0)
|
|
9057
|
-
*
|
|
9058
|
-
* assert.deepStrictEqual(
|
|
9059
|
-
* pipe(HashSet.make(1, 2, 2, 3, 4, 3), HashSet.size),
|
|
9060
|
-
* 4
|
|
9061
|
-
* )
|
|
9062
|
-
* ```
|
|
9063
|
-
*
|
|
9064
|
-
* @see Other `HashSet` getters are {@link module:HashSet.values} {@link module:HashSet.toValues}
|
|
9065
|
-
*/
|
|
9066
|
-
const size = size$1;
|
|
9067
|
-
/**
|
|
9068
|
-
* Adds a value to the `HashSet`.
|
|
9069
|
-
*
|
|
9070
|
-
* Time complexity: **`O(1)`** average
|
|
9071
|
-
*
|
|
9072
|
-
* @remarks
|
|
9073
|
-
* Remember that a `HashSet` is a collection of unique values, so adding a value
|
|
9074
|
-
* that already exists in the `HashSet` will not add a duplicate.
|
|
9075
|
-
*
|
|
9076
|
-
* Remember that HashSet is an immutable data structure, so the `add` function,
|
|
9077
|
-
* like all other functions that modify the HashSet, will return a new HashSet
|
|
9078
|
-
* with the added value.
|
|
9079
|
-
* @memberof HashSet
|
|
9080
|
-
* @since 2.0.0
|
|
9081
|
-
* @example
|
|
9082
|
-
*
|
|
9083
|
-
* ```ts
|
|
9084
|
-
* // Syntax
|
|
9085
|
-
* import { HashSet, pipe } from "effect"
|
|
9086
|
-
*
|
|
9087
|
-
* // with data-last, a.k.a. pipeable API
|
|
9088
|
-
* pipe(HashSet.empty(), HashSet.add(0), HashSet.add(0))
|
|
9089
|
-
*
|
|
9090
|
-
* // or piped with the pipe function
|
|
9091
|
-
* HashSet.empty().pipe(HashSet.add(0))
|
|
9092
|
-
*
|
|
9093
|
-
* // or with data-first API
|
|
9094
|
-
* HashSet.add(HashSet.empty(), 0)
|
|
9095
|
-
* ```
|
|
9096
|
-
*
|
|
9097
|
-
* @see Other `HashSet` mutations are {@link module:HashSet.remove} {@link module:HashSet.toggle} {@link module:HashSet.beginMutation} {@link module:HashSet.endMutation} {@link module:HashSet.mutate}
|
|
9098
|
-
*/
|
|
9099
|
-
const add = add$1;
|
|
9100
|
-
/**
|
|
9101
|
-
* Computes the set union `( self ∪ that )` between this `HashSet` and the
|
|
9102
|
-
* specified `Iterable<A>`.
|
|
9103
|
-
*
|
|
9104
|
-
* Time complexity: **`O(n)`** where n is the number of elements in the set
|
|
9105
|
-
*
|
|
9106
|
-
* **NOTE**: the hash and equal of the values in both the set and the iterable
|
|
9107
|
-
* must be the same.
|
|
9108
|
-
*
|
|
9109
|
-
* @memberof HashSet
|
|
9110
|
-
* @since 2.0.0
|
|
9111
|
-
* @example
|
|
9112
|
-
*
|
|
9113
|
-
* ```ts
|
|
9114
|
-
* // Syntax
|
|
9115
|
-
* import { HashSet, pipe } from "effect"
|
|
9116
|
-
*
|
|
9117
|
-
* // with data-last, a.k.a. pipeable API
|
|
9118
|
-
* pipe(HashSet.make(1, 2, 3), HashSet.union(HashSet.make(3, 4, 5)))
|
|
9119
|
-
*
|
|
9120
|
-
* // or piped with the pipe function
|
|
9121
|
-
* HashSet.make(1, 2, 3).pipe(HashSet.union(HashSet.make(3, 4, 5)))
|
|
9122
|
-
*
|
|
9123
|
-
* // or with data-first API
|
|
9124
|
-
* HashSet.union(HashSet.make(1, 2, 3), HashSet.make(3, 4, 5))
|
|
9125
|
-
* ```
|
|
9126
|
-
*
|
|
9127
|
-
* @see Other `HashSet` operations are {@link module:HashSet.difference} {@link module:HashSet.intersection}
|
|
9128
|
-
*/
|
|
9129
|
-
const union = union$1;
|
|
9130
|
-
|
|
9131
|
-
/** @internal */
|
|
9132
|
-
const OP_DIE = "Die";
|
|
9133
|
-
/** @internal */
|
|
9134
|
-
const OP_EMPTY = "Empty";
|
|
9135
|
-
/** @internal */
|
|
9136
|
-
const OP_FAIL = "Fail";
|
|
9137
|
-
/** @internal */
|
|
9138
|
-
const OP_INTERRUPT = "Interrupt";
|
|
9139
|
-
/** @internal */
|
|
9140
|
-
const OP_PARALLEL = "Parallel";
|
|
9141
|
-
/** @internal */
|
|
9142
|
-
const OP_SEQUENTIAL = "Sequential";
|
|
9143
|
-
|
|
9144
|
-
// -----------------------------------------------------------------------------
|
|
9145
|
-
// Models
|
|
9146
|
-
// -----------------------------------------------------------------------------
|
|
9147
|
-
/** @internal */
|
|
9148
|
-
const CauseSymbolKey = "effect/Cause";
|
|
9149
|
-
/** @internal */
|
|
9150
|
-
const CauseTypeId = /*#__PURE__*/Symbol.for(CauseSymbolKey);
|
|
9151
|
-
const variance = {
|
|
9152
|
-
/* c8 ignore next */
|
|
9153
|
-
_E: _ => _
|
|
9154
|
-
};
|
|
9155
|
-
/** @internal */
|
|
9156
|
-
const proto = {
|
|
9157
|
-
[CauseTypeId]: variance,
|
|
9158
|
-
[symbol$1]() {
|
|
9159
|
-
return pipe(hash(CauseSymbolKey), combine(hash(flattenCause(this))), cached(this));
|
|
9160
|
-
},
|
|
9161
|
-
[symbol](that) {
|
|
9162
|
-
return isCause(that) && causeEquals(this, that);
|
|
9163
|
-
},
|
|
9164
|
-
pipe() {
|
|
9165
|
-
return pipeArguments(this, arguments);
|
|
9166
|
-
},
|
|
9167
|
-
toJSON() {
|
|
9168
|
-
switch (this._tag) {
|
|
9169
|
-
case "Empty":
|
|
9170
|
-
return {
|
|
9171
|
-
_id: "Cause",
|
|
9172
|
-
_tag: this._tag
|
|
9173
|
-
};
|
|
9174
|
-
case "Die":
|
|
9175
|
-
return {
|
|
9176
|
-
_id: "Cause",
|
|
9177
|
-
_tag: this._tag,
|
|
9178
|
-
defect: toJSON(this.defect)
|
|
9179
|
-
};
|
|
9180
|
-
case "Interrupt":
|
|
9181
|
-
return {
|
|
9182
|
-
_id: "Cause",
|
|
9183
|
-
_tag: this._tag,
|
|
9184
|
-
fiberId: this.fiberId.toJSON()
|
|
9185
|
-
};
|
|
9186
|
-
case "Fail":
|
|
9187
|
-
return {
|
|
9188
|
-
_id: "Cause",
|
|
9189
|
-
_tag: this._tag,
|
|
9190
|
-
failure: toJSON(this.error)
|
|
9191
|
-
};
|
|
9192
|
-
case "Sequential":
|
|
9193
|
-
case "Parallel":
|
|
9194
|
-
return {
|
|
9195
|
-
_id: "Cause",
|
|
9196
|
-
_tag: this._tag,
|
|
9197
|
-
left: toJSON(this.left),
|
|
9198
|
-
right: toJSON(this.right)
|
|
9199
|
-
};
|
|
9200
|
-
}
|
|
9201
|
-
},
|
|
9202
|
-
toString() {
|
|
9203
|
-
return pretty(this);
|
|
9204
|
-
},
|
|
9205
|
-
[NodeInspectSymbol]() {
|
|
9206
|
-
return this.toJSON();
|
|
9207
|
-
}
|
|
9208
|
-
};
|
|
9209
|
-
/** @internal */
|
|
9210
|
-
const fail$1 = error => {
|
|
9211
|
-
const o = Object.create(proto);
|
|
9212
|
-
o._tag = OP_FAIL;
|
|
9213
|
-
o.error = error;
|
|
9214
|
-
return o;
|
|
9215
|
-
};
|
|
9216
|
-
/** @internal */
|
|
9217
|
-
const parallel = (left, right) => {
|
|
9218
|
-
const o = Object.create(proto);
|
|
9219
|
-
o._tag = OP_PARALLEL;
|
|
9220
|
-
o.left = left;
|
|
9221
|
-
o.right = right;
|
|
9222
|
-
return o;
|
|
9223
|
-
};
|
|
9224
|
-
/** @internal */
|
|
9225
|
-
const sequential = (left, right) => {
|
|
9226
|
-
const o = Object.create(proto);
|
|
9227
|
-
o._tag = OP_SEQUENTIAL;
|
|
9228
|
-
o.left = left;
|
|
9229
|
-
o.right = right;
|
|
9230
|
-
return o;
|
|
9231
|
-
};
|
|
9232
|
-
// -----------------------------------------------------------------------------
|
|
9233
|
-
// Refinements
|
|
9234
|
-
// -----------------------------------------------------------------------------
|
|
9235
|
-
/** @internal */
|
|
9236
|
-
const isCause = u => hasProperty(u, CauseTypeId);
|
|
9237
|
-
/** @internal */
|
|
9238
|
-
const isInterruptedOnly = self => reduceWithContext(undefined, IsInterruptedOnlyCauseReducer)(self);
|
|
9239
|
-
/** @internal */
|
|
9240
|
-
const causeEquals = (left, right) => {
|
|
9241
|
-
let leftStack = of(left);
|
|
9242
|
-
let rightStack = of(right);
|
|
9243
|
-
while (isNonEmpty(leftStack) && isNonEmpty(rightStack)) {
|
|
9244
|
-
const [leftParallel, leftSequential] = pipe(headNonEmpty(leftStack), reduce([empty(), empty$3()], ([parallel, sequential], cause) => {
|
|
9245
|
-
const [par, seq] = evaluateCause(cause);
|
|
9246
|
-
return some([pipe(parallel, union(par)), pipe(sequential, appendAll(seq))]);
|
|
9247
|
-
}));
|
|
9248
|
-
const [rightParallel, rightSequential] = pipe(headNonEmpty(rightStack), reduce([empty(), empty$3()], ([parallel, sequential], cause) => {
|
|
9249
|
-
const [par, seq] = evaluateCause(cause);
|
|
9250
|
-
return some([pipe(parallel, union(par)), pipe(sequential, appendAll(seq))]);
|
|
9251
|
-
}));
|
|
9252
|
-
if (!equals(leftParallel, rightParallel)) {
|
|
9253
|
-
return false;
|
|
9254
|
-
}
|
|
9255
|
-
leftStack = leftSequential;
|
|
9256
|
-
rightStack = rightSequential;
|
|
9257
|
-
}
|
|
9258
|
-
return true;
|
|
9259
|
-
};
|
|
9260
|
-
// -----------------------------------------------------------------------------
|
|
9261
|
-
// Flattening
|
|
9262
|
-
// -----------------------------------------------------------------------------
|
|
9263
|
-
/**
|
|
9264
|
-
* Flattens a cause to a sequence of sets of causes, where each set represents
|
|
9265
|
-
* causes that fail in parallel and sequential sets represent causes that fail
|
|
9266
|
-
* after each other.
|
|
9267
|
-
*
|
|
9268
|
-
* @internal
|
|
9269
|
-
*/
|
|
9270
|
-
const flattenCause = cause => {
|
|
9271
|
-
return flattenCauseLoop(of(cause), empty$3());
|
|
9272
|
-
};
|
|
9273
|
-
/** @internal */
|
|
9274
|
-
const flattenCauseLoop = (causes, flattened) => {
|
|
9275
|
-
// eslint-disable-next-line no-constant-condition
|
|
9276
|
-
while (1) {
|
|
9277
|
-
const [parallel, sequential] = pipe(causes, reduce$2([empty(), empty$3()], ([parallel, sequential], cause) => {
|
|
9278
|
-
const [par, seq] = evaluateCause(cause);
|
|
9279
|
-
return [pipe(parallel, union(par)), pipe(sequential, appendAll(seq))];
|
|
9280
|
-
}));
|
|
9281
|
-
const updated = size(parallel) > 0 ? pipe(flattened, prepend(parallel)) : flattened;
|
|
9282
|
-
if (isEmpty(sequential)) {
|
|
9283
|
-
return reverse(updated);
|
|
9284
|
-
}
|
|
9285
|
-
causes = sequential;
|
|
9286
|
-
flattened = updated;
|
|
9287
|
-
}
|
|
9288
|
-
throw new Error(getBugErrorMessage("Cause.flattenCauseLoop"));
|
|
9289
|
-
};
|
|
9290
|
-
// -----------------------------------------------------------------------------
|
|
9291
|
-
// Evaluation
|
|
9292
|
-
// -----------------------------------------------------------------------------
|
|
9293
|
-
/**
|
|
9294
|
-
* Takes one step in evaluating a cause, returning a set of causes that fail
|
|
9295
|
-
* in parallel and a list of causes that fail sequentially after those causes.
|
|
9296
|
-
*
|
|
9297
|
-
* @internal
|
|
9298
|
-
*/
|
|
9299
|
-
const evaluateCause = self => {
|
|
9300
|
-
let cause = self;
|
|
9301
|
-
const stack = [];
|
|
9302
|
-
let _parallel = empty();
|
|
9303
|
-
let _sequential = empty$3();
|
|
9304
|
-
while (cause !== undefined) {
|
|
9305
|
-
switch (cause._tag) {
|
|
9306
|
-
case OP_EMPTY:
|
|
9307
|
-
{
|
|
9308
|
-
if (stack.length === 0) {
|
|
9309
|
-
return [_parallel, _sequential];
|
|
9310
|
-
}
|
|
9311
|
-
cause = stack.pop();
|
|
9312
|
-
break;
|
|
9313
|
-
}
|
|
9314
|
-
case OP_FAIL:
|
|
9315
|
-
{
|
|
9316
|
-
_parallel = add(_parallel, make$1(cause._tag, cause.error));
|
|
9317
|
-
if (stack.length === 0) {
|
|
9318
|
-
return [_parallel, _sequential];
|
|
9319
|
-
}
|
|
9320
|
-
cause = stack.pop();
|
|
9321
|
-
break;
|
|
9322
|
-
}
|
|
9323
|
-
case OP_DIE:
|
|
9324
|
-
{
|
|
9325
|
-
_parallel = add(_parallel, make$1(cause._tag, cause.defect));
|
|
9326
|
-
if (stack.length === 0) {
|
|
9327
|
-
return [_parallel, _sequential];
|
|
9328
|
-
}
|
|
9329
|
-
cause = stack.pop();
|
|
9330
|
-
break;
|
|
9331
|
-
}
|
|
9332
|
-
case OP_INTERRUPT:
|
|
9333
|
-
{
|
|
9334
|
-
_parallel = add(_parallel, make$1(cause._tag, cause.fiberId));
|
|
9335
|
-
if (stack.length === 0) {
|
|
9336
|
-
return [_parallel, _sequential];
|
|
9337
|
-
}
|
|
9338
|
-
cause = stack.pop();
|
|
9339
|
-
break;
|
|
9340
|
-
}
|
|
9341
|
-
case OP_SEQUENTIAL:
|
|
9342
|
-
{
|
|
9343
|
-
switch (cause.left._tag) {
|
|
9344
|
-
case OP_EMPTY:
|
|
9345
|
-
{
|
|
9346
|
-
cause = cause.right;
|
|
9347
|
-
break;
|
|
9348
|
-
}
|
|
9349
|
-
case OP_SEQUENTIAL:
|
|
9350
|
-
{
|
|
9351
|
-
cause = sequential(cause.left.left, sequential(cause.left.right, cause.right));
|
|
9352
|
-
break;
|
|
9353
|
-
}
|
|
9354
|
-
case OP_PARALLEL:
|
|
9355
|
-
{
|
|
9356
|
-
cause = parallel(sequential(cause.left.left, cause.right), sequential(cause.left.right, cause.right));
|
|
9357
|
-
break;
|
|
9358
|
-
}
|
|
9359
|
-
default:
|
|
9360
|
-
{
|
|
9361
|
-
_sequential = prepend(_sequential, cause.right);
|
|
9362
|
-
cause = cause.left;
|
|
9363
|
-
break;
|
|
9364
|
-
}
|
|
9365
|
-
}
|
|
9366
|
-
break;
|
|
9367
|
-
}
|
|
9368
|
-
case OP_PARALLEL:
|
|
9369
|
-
{
|
|
9370
|
-
stack.push(cause.right);
|
|
9371
|
-
cause = cause.left;
|
|
9372
|
-
break;
|
|
9373
|
-
}
|
|
9374
|
-
}
|
|
9375
|
-
}
|
|
9376
|
-
throw new Error(getBugErrorMessage("Cause.evaluateCauseLoop"));
|
|
9377
|
-
};
|
|
9378
|
-
/** @internal */
|
|
9379
|
-
const IsInterruptedOnlyCauseReducer = {
|
|
9380
|
-
emptyCase: constTrue,
|
|
9381
|
-
failCase: constFalse,
|
|
9382
|
-
dieCase: constFalse,
|
|
9383
|
-
interruptCase: constTrue,
|
|
9384
|
-
sequentialCase: (_, left, right) => left && right,
|
|
9385
|
-
parallelCase: (_, left, right) => left && right
|
|
9386
|
-
};
|
|
9387
|
-
const OP_SEQUENTIAL_CASE = "SequentialCase";
|
|
9388
|
-
const OP_PARALLEL_CASE = "ParallelCase";
|
|
9389
|
-
/** @internal */
|
|
9390
|
-
const reduce = /*#__PURE__*/dual(3, (self, zero, pf) => {
|
|
9391
|
-
let accumulator = zero;
|
|
9392
|
-
let cause = self;
|
|
9393
|
-
const causes = [];
|
|
9394
|
-
while (cause !== undefined) {
|
|
9395
|
-
const option = pf(accumulator, cause);
|
|
9396
|
-
accumulator = isSome(option) ? option.value : accumulator;
|
|
9397
|
-
switch (cause._tag) {
|
|
9398
|
-
case OP_SEQUENTIAL:
|
|
9399
|
-
{
|
|
9400
|
-
causes.push(cause.right);
|
|
9401
|
-
cause = cause.left;
|
|
9402
|
-
break;
|
|
9403
|
-
}
|
|
9404
|
-
case OP_PARALLEL:
|
|
9405
|
-
{
|
|
9406
|
-
causes.push(cause.right);
|
|
9407
|
-
cause = cause.left;
|
|
9408
|
-
break;
|
|
9409
|
-
}
|
|
9410
|
-
default:
|
|
9411
|
-
{
|
|
9412
|
-
cause = undefined;
|
|
9413
|
-
break;
|
|
9414
|
-
}
|
|
9415
|
-
}
|
|
9416
|
-
if (cause === undefined && causes.length > 0) {
|
|
9417
|
-
cause = causes.pop();
|
|
9418
|
-
}
|
|
9419
|
-
}
|
|
9420
|
-
return accumulator;
|
|
9421
|
-
});
|
|
9422
|
-
/** @internal */
|
|
9423
|
-
const reduceWithContext = /*#__PURE__*/dual(3, (self, context, reducer) => {
|
|
9424
|
-
const input = [self];
|
|
9425
|
-
const output = [];
|
|
9426
|
-
while (input.length > 0) {
|
|
9427
|
-
const cause = input.pop();
|
|
9428
|
-
switch (cause._tag) {
|
|
9429
|
-
case OP_EMPTY:
|
|
9430
|
-
{
|
|
9431
|
-
output.push(right(reducer.emptyCase(context)));
|
|
9432
|
-
break;
|
|
9433
|
-
}
|
|
9434
|
-
case OP_FAIL:
|
|
9435
|
-
{
|
|
9436
|
-
output.push(right(reducer.failCase(context, cause.error)));
|
|
9437
|
-
break;
|
|
9438
|
-
}
|
|
9439
|
-
case OP_DIE:
|
|
9440
|
-
{
|
|
9441
|
-
output.push(right(reducer.dieCase(context, cause.defect)));
|
|
9442
|
-
break;
|
|
9443
|
-
}
|
|
9444
|
-
case OP_INTERRUPT:
|
|
9445
|
-
{
|
|
9446
|
-
output.push(right(reducer.interruptCase(context, cause.fiberId)));
|
|
9447
|
-
break;
|
|
9448
|
-
}
|
|
9449
|
-
case OP_SEQUENTIAL:
|
|
9450
|
-
{
|
|
9451
|
-
input.push(cause.right);
|
|
9452
|
-
input.push(cause.left);
|
|
9453
|
-
output.push(left({
|
|
9454
|
-
_tag: OP_SEQUENTIAL_CASE
|
|
9455
|
-
}));
|
|
9456
|
-
break;
|
|
9457
|
-
}
|
|
9458
|
-
case OP_PARALLEL:
|
|
9459
|
-
{
|
|
9460
|
-
input.push(cause.right);
|
|
9461
|
-
input.push(cause.left);
|
|
9462
|
-
output.push(left({
|
|
9463
|
-
_tag: OP_PARALLEL_CASE
|
|
9464
|
-
}));
|
|
9465
|
-
break;
|
|
9466
|
-
}
|
|
9467
|
-
}
|
|
9468
|
-
}
|
|
9469
|
-
const accumulator = [];
|
|
9470
|
-
while (output.length > 0) {
|
|
9471
|
-
const either = output.pop();
|
|
9472
|
-
switch (either._tag) {
|
|
9473
|
-
case "Left":
|
|
9474
|
-
{
|
|
9475
|
-
switch (either.left._tag) {
|
|
9476
|
-
case OP_SEQUENTIAL_CASE:
|
|
9477
|
-
{
|
|
9478
|
-
const left = accumulator.pop();
|
|
9479
|
-
const right = accumulator.pop();
|
|
9480
|
-
const value = reducer.sequentialCase(context, left, right);
|
|
9481
|
-
accumulator.push(value);
|
|
9482
|
-
break;
|
|
9483
|
-
}
|
|
9484
|
-
case OP_PARALLEL_CASE:
|
|
9485
|
-
{
|
|
9486
|
-
const left = accumulator.pop();
|
|
9487
|
-
const right = accumulator.pop();
|
|
9488
|
-
const value = reducer.parallelCase(context, left, right);
|
|
9489
|
-
accumulator.push(value);
|
|
9490
|
-
break;
|
|
9491
|
-
}
|
|
9492
|
-
}
|
|
9493
|
-
break;
|
|
9494
|
-
}
|
|
9495
|
-
case "Right":
|
|
9496
|
-
{
|
|
9497
|
-
accumulator.push(either.right);
|
|
9498
|
-
break;
|
|
9499
|
-
}
|
|
9500
|
-
}
|
|
9501
|
-
}
|
|
9502
|
-
if (accumulator.length === 0) {
|
|
9503
|
-
throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");
|
|
9504
|
-
}
|
|
9505
|
-
return accumulator.pop();
|
|
9506
|
-
});
|
|
9507
|
-
// -----------------------------------------------------------------------------
|
|
9508
|
-
// Pretty Printing
|
|
9509
|
-
// -----------------------------------------------------------------------------
|
|
9510
|
-
/** @internal */
|
|
9511
|
-
const pretty = (cause, options) => {
|
|
9512
|
-
if (isInterruptedOnly(cause)) {
|
|
9513
|
-
return "All fibers interrupted without errors.";
|
|
9514
|
-
}
|
|
9515
|
-
return prettyErrors(cause).map(function (e) {
|
|
9516
|
-
if (options?.renderErrorCause !== true || e.cause === undefined) {
|
|
9517
|
-
return e.stack;
|
|
9518
|
-
}
|
|
9519
|
-
return `${e.stack} {\n${renderErrorCause(e.cause, " ")}\n}`;
|
|
9520
|
-
}).join("\n");
|
|
9521
|
-
};
|
|
9522
|
-
const renderErrorCause = (cause, prefix) => {
|
|
9523
|
-
const lines = cause.stack.split("\n");
|
|
9524
|
-
let stack = `${prefix}[cause]: ${lines[0]}`;
|
|
9525
|
-
for (let i = 1, len = lines.length; i < len; i++) {
|
|
9526
|
-
stack += `\n${prefix}${lines[i]}`;
|
|
9527
|
-
}
|
|
9528
|
-
if (cause.cause) {
|
|
9529
|
-
stack += ` {\n${renderErrorCause(cause.cause, `${prefix} `)}\n${prefix}}`;
|
|
9530
|
-
}
|
|
9531
|
-
return stack;
|
|
9532
|
-
};
|
|
9533
|
-
/** @internal */
|
|
9534
|
-
const makePrettyError = originalError => {
|
|
9535
|
-
const originalErrorIsObject = typeof originalError === "object" && originalError !== null;
|
|
9536
|
-
const prevLimit = Error.stackTraceLimit;
|
|
9537
|
-
Error.stackTraceLimit = 1;
|
|
9538
|
-
const error = new Error(prettyErrorMessage(originalError), originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined" ? {
|
|
9539
|
-
cause: makePrettyError(originalError.cause)
|
|
9540
|
-
} : undefined);
|
|
9541
|
-
Error.stackTraceLimit = prevLimit;
|
|
9542
|
-
if (error.message === "") {
|
|
9543
|
-
error.message = "An error has occurred";
|
|
9544
|
-
}
|
|
9545
|
-
Error.stackTraceLimit = prevLimit;
|
|
9546
|
-
error.name = originalError instanceof Error ? originalError.name : "Error";
|
|
9547
|
-
if (originalErrorIsObject) {
|
|
9548
|
-
if (spanSymbol in originalError) {
|
|
9549
|
-
error.span = originalError[spanSymbol];
|
|
9550
|
-
}
|
|
9551
|
-
Object.keys(originalError).forEach(key => {
|
|
9552
|
-
if (!(key in error)) {
|
|
9553
|
-
// @ts-expect-error
|
|
9554
|
-
error[key] = originalError[key];
|
|
9555
|
-
}
|
|
9556
|
-
});
|
|
9557
|
-
}
|
|
9558
|
-
error.stack = prettyErrorStack(`${error.name}: ${error.message}`, originalError instanceof Error && originalError.stack ? originalError.stack : "", error.span);
|
|
9559
|
-
return error;
|
|
9560
|
-
};
|
|
9561
|
-
/**
|
|
9562
|
-
* A utility function for generating human-readable error messages from a generic error of type `unknown`.
|
|
9563
|
-
*
|
|
9564
|
-
* Rules:
|
|
9565
|
-
*
|
|
9566
|
-
* 1) If the input `u` is already a string, it's considered a message.
|
|
9567
|
-
* 2) If `u` is an Error instance with a message defined, it uses the message.
|
|
9568
|
-
* 3) If `u` has a user-defined `toString()` method, it uses that method.
|
|
9569
|
-
* 4) Otherwise, it uses `Inspectable.stringifyCircular` to produce a string representation and uses it as the error message,
|
|
9570
|
-
* with "Error" added as a prefix.
|
|
9571
|
-
*
|
|
9572
|
-
* @internal
|
|
9573
|
-
*/
|
|
9574
|
-
const prettyErrorMessage = u => {
|
|
9575
|
-
// 1)
|
|
9576
|
-
if (typeof u === "string") {
|
|
9577
|
-
return u;
|
|
9578
|
-
}
|
|
9579
|
-
// 2)
|
|
9580
|
-
if (typeof u === "object" && u !== null && u instanceof Error) {
|
|
9581
|
-
return u.message;
|
|
9582
|
-
}
|
|
9583
|
-
// 3)
|
|
9584
|
-
try {
|
|
9585
|
-
if (hasProperty(u, "toString") && isFunction(u["toString"]) && u["toString"] !== Object.prototype.toString && u["toString"] !== globalThis.Array.prototype.toString) {
|
|
9586
|
-
return u["toString"]();
|
|
9587
|
-
}
|
|
9588
|
-
} catch {
|
|
9589
|
-
// something's off, rollback to json
|
|
9590
|
-
}
|
|
9591
|
-
// 4)
|
|
9592
|
-
return stringifyCircular(u);
|
|
9593
|
-
};
|
|
9594
|
-
const locationRegex = /\((.*)\)/g;
|
|
9595
|
-
/** @internal */
|
|
9596
|
-
const spanToTrace = /*#__PURE__*/globalValue("effect/Tracer/spanToTrace", () => new WeakMap());
|
|
9597
|
-
const prettyErrorStack = (message, stack, span) => {
|
|
9598
|
-
const out = [message];
|
|
9599
|
-
const lines = stack.startsWith(message) ? stack.slice(message.length).split("\n") : stack.split("\n");
|
|
9600
|
-
for (let i = 1; i < lines.length; i++) {
|
|
9601
|
-
if (lines[i].includes(" at new BaseEffectError") || lines[i].includes(" at new YieldableError")) {
|
|
9602
|
-
i++;
|
|
9603
|
-
continue;
|
|
9604
|
-
}
|
|
9605
|
-
if (lines[i].includes("Generator.next")) {
|
|
9606
|
-
break;
|
|
9607
|
-
}
|
|
9608
|
-
if (lines[i].includes("effect_internal_function")) {
|
|
9609
|
-
break;
|
|
9610
|
-
}
|
|
9611
|
-
out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>"));
|
|
9612
|
-
}
|
|
9613
|
-
if (span) {
|
|
9614
|
-
let current = span;
|
|
9615
|
-
let i = 0;
|
|
9616
|
-
while (current && current._tag === "Span" && i < 10) {
|
|
9617
|
-
const stackFn = spanToTrace.get(current);
|
|
9618
|
-
if (typeof stackFn === "function") {
|
|
9619
|
-
const stack = stackFn();
|
|
9620
|
-
if (typeof stack === "string") {
|
|
9621
|
-
const locationMatchAll = stack.matchAll(locationRegex);
|
|
9622
|
-
let match = false;
|
|
9623
|
-
for (const [, location] of locationMatchAll) {
|
|
9624
|
-
match = true;
|
|
9625
|
-
out.push(` at ${current.name} (${location})`);
|
|
9626
|
-
}
|
|
9627
|
-
if (!match) {
|
|
9628
|
-
out.push(` at ${current.name} (${stack.replace(/^at /, "")})`);
|
|
9629
|
-
}
|
|
9630
|
-
} else {
|
|
9631
|
-
out.push(` at ${current.name}`);
|
|
9632
|
-
}
|
|
9633
|
-
} else {
|
|
9634
|
-
out.push(` at ${current.name}`);
|
|
9635
|
-
}
|
|
9636
|
-
current = getOrUndefined(current.parent);
|
|
9637
|
-
i++;
|
|
9638
|
-
}
|
|
9639
|
-
}
|
|
9640
|
-
return out.join("\n");
|
|
9641
|
-
};
|
|
9642
|
-
/** @internal */
|
|
9643
|
-
const spanSymbol = /*#__PURE__*/Symbol.for("effect/SpanAnnotation");
|
|
9644
|
-
/** @internal */
|
|
9645
|
-
const prettyErrors = cause => reduceWithContext(cause, void 0, {
|
|
9646
|
-
emptyCase: () => [],
|
|
9647
|
-
dieCase: (_, unknownError) => {
|
|
9648
|
-
return [makePrettyError(unknownError)];
|
|
9649
|
-
},
|
|
9650
|
-
failCase: (_, error) => {
|
|
9651
|
-
return [makePrettyError(error)];
|
|
9652
|
-
},
|
|
9653
|
-
interruptCase: () => [],
|
|
9654
|
-
parallelCase: (_, l, r) => [...l, ...r],
|
|
9655
|
-
sequentialCase: (_, l, r) => [...l, ...r]
|
|
9656
|
-
});
|
|
9657
|
-
|
|
9658
|
-
/** @internal */
|
|
9659
|
-
class SingleShotGen {
|
|
9660
|
-
self;
|
|
9661
|
-
called = false;
|
|
9662
|
-
constructor(self) {
|
|
9663
|
-
this.self = self;
|
|
9664
|
-
}
|
|
9665
|
-
next(a) {
|
|
9666
|
-
return this.called ? {
|
|
9667
|
-
value: a,
|
|
9668
|
-
done: true
|
|
9669
|
-
} : (this.called = true, {
|
|
9670
|
-
value: this.self,
|
|
9671
|
-
done: false
|
|
9672
|
-
});
|
|
9673
|
-
}
|
|
9674
|
-
return(a) {
|
|
9675
|
-
return {
|
|
9676
|
-
value: a,
|
|
9677
|
-
done: true
|
|
9678
|
-
};
|
|
9679
|
-
}
|
|
9680
|
-
throw(e) {
|
|
9681
|
-
throw e;
|
|
9682
|
-
}
|
|
9683
|
-
[Symbol.iterator]() {
|
|
9684
|
-
return new SingleShotGen(this.self);
|
|
9685
|
-
}
|
|
9686
|
-
}
|
|
9687
|
-
|
|
9688
|
-
/** @internal */
|
|
9689
|
-
const EffectTypeId = /*#__PURE__*/Symbol.for("effect/Effect");
|
|
9690
|
-
class EffectPrimitive {
|
|
9691
|
-
_op;
|
|
9692
|
-
effect_instruction_i0 = undefined;
|
|
9693
|
-
effect_instruction_i1 = undefined;
|
|
9694
|
-
effect_instruction_i2 = undefined;
|
|
9695
|
-
trace = undefined;
|
|
9696
|
-
[EffectTypeId] = effectVariance;
|
|
9697
|
-
constructor(_op) {
|
|
9698
|
-
this._op = _op;
|
|
9699
|
-
}
|
|
9700
|
-
[symbol](that) {
|
|
9701
|
-
return this === that;
|
|
9702
|
-
}
|
|
9703
|
-
[symbol$1]() {
|
|
9704
|
-
return cached(this, random(this));
|
|
9705
|
-
}
|
|
9706
|
-
pipe() {
|
|
9707
|
-
return pipeArguments(this, arguments);
|
|
9708
|
-
}
|
|
9709
|
-
toJSON() {
|
|
9710
|
-
return {
|
|
9711
|
-
_id: "Effect",
|
|
9712
|
-
_op: this._op,
|
|
9713
|
-
effect_instruction_i0: toJSON(this.effect_instruction_i0),
|
|
9714
|
-
effect_instruction_i1: toJSON(this.effect_instruction_i1),
|
|
9715
|
-
effect_instruction_i2: toJSON(this.effect_instruction_i2)
|
|
9716
|
-
};
|
|
9717
|
-
}
|
|
9718
|
-
toString() {
|
|
9719
|
-
return format(this.toJSON());
|
|
9720
|
-
}
|
|
9721
|
-
[NodeInspectSymbol]() {
|
|
9722
|
-
return this.toJSON();
|
|
9723
|
-
}
|
|
9724
|
-
[Symbol.iterator]() {
|
|
9725
|
-
return new SingleShotGen(new YieldWrap(this));
|
|
9726
|
-
}
|
|
9727
|
-
}
|
|
9728
|
-
/** @internal */
|
|
9729
|
-
class EffectPrimitiveFailure {
|
|
9730
|
-
_op;
|
|
9731
|
-
effect_instruction_i0 = undefined;
|
|
9732
|
-
effect_instruction_i1 = undefined;
|
|
9733
|
-
effect_instruction_i2 = undefined;
|
|
9734
|
-
trace = undefined;
|
|
9735
|
-
[EffectTypeId] = effectVariance;
|
|
9736
|
-
constructor(_op) {
|
|
9737
|
-
this._op = _op;
|
|
9738
|
-
// @ts-expect-error
|
|
9739
|
-
this._tag = _op;
|
|
9740
|
-
}
|
|
9741
|
-
[symbol](that) {
|
|
9742
|
-
return exitIsExit(that) && that._op === "Failure" &&
|
|
9743
|
-
// @ts-expect-error
|
|
9744
|
-
equals(this.effect_instruction_i0, that.effect_instruction_i0);
|
|
9745
|
-
}
|
|
9746
|
-
[symbol$1]() {
|
|
9747
|
-
return pipe(
|
|
9748
|
-
// @ts-expect-error
|
|
9749
|
-
string(this._tag),
|
|
9750
|
-
// @ts-expect-error
|
|
9751
|
-
combine(hash(this.effect_instruction_i0)), cached(this));
|
|
9752
|
-
}
|
|
9753
|
-
get cause() {
|
|
9754
|
-
return this.effect_instruction_i0;
|
|
9755
|
-
}
|
|
9756
|
-
pipe() {
|
|
9757
|
-
return pipeArguments(this, arguments);
|
|
9758
|
-
}
|
|
9759
|
-
toJSON() {
|
|
9760
|
-
return {
|
|
9761
|
-
_id: "Exit",
|
|
9762
|
-
_tag: this._op,
|
|
9763
|
-
cause: this.cause.toJSON()
|
|
9764
|
-
};
|
|
9765
|
-
}
|
|
9766
|
-
toString() {
|
|
9767
|
-
return format(this.toJSON());
|
|
9768
|
-
}
|
|
9769
|
-
[NodeInspectSymbol]() {
|
|
9770
|
-
return this.toJSON();
|
|
9771
|
-
}
|
|
9772
|
-
[Symbol.iterator]() {
|
|
9773
|
-
return new SingleShotGen(new YieldWrap(this));
|
|
9774
|
-
}
|
|
9775
|
-
}
|
|
9776
|
-
/** @internal */
|
|
9777
|
-
const isEffect = u => hasProperty(u, EffectTypeId);
|
|
9778
|
-
/* @internal */
|
|
9779
|
-
const withFiberRuntime = withRuntime => {
|
|
9780
|
-
const effect = new EffectPrimitive(OP_WITH_RUNTIME);
|
|
9781
|
-
effect.effect_instruction_i0 = withRuntime;
|
|
9782
|
-
return effect;
|
|
9783
|
-
};
|
|
9784
|
-
const originalSymbol = /*#__PURE__*/Symbol.for("effect/OriginalAnnotation");
|
|
9785
|
-
/* @internal */
|
|
9786
|
-
const capture = (obj, span) => {
|
|
9787
|
-
if (isSome(span)) {
|
|
9788
|
-
return new Proxy(obj, {
|
|
9789
|
-
has(target, p) {
|
|
9790
|
-
return p === spanSymbol || p === originalSymbol || p in target;
|
|
9791
|
-
},
|
|
9792
|
-
get(target, p) {
|
|
9793
|
-
if (p === spanSymbol) {
|
|
9794
|
-
return span.value;
|
|
9795
|
-
}
|
|
9796
|
-
if (p === originalSymbol) {
|
|
9797
|
-
return obj;
|
|
9798
|
-
}
|
|
9799
|
-
// @ts-expect-error
|
|
9800
|
-
return target[p];
|
|
9801
|
-
}
|
|
9802
|
-
});
|
|
9803
|
-
}
|
|
9804
|
-
return obj;
|
|
9805
|
-
};
|
|
9806
|
-
/* @internal */
|
|
9807
|
-
const fail = error => isObject(error) && !(spanSymbol in error) ? withFiberRuntime(fiber => failCause(fail$1(capture(error, currentSpanFromFiber(fiber))))) : failCause(fail$1(error));
|
|
9808
|
-
/* @internal */
|
|
9809
|
-
const failCause = cause => {
|
|
9810
|
-
const effect = new EffectPrimitiveFailure(OP_FAILURE);
|
|
9811
|
-
effect.effect_instruction_i0 = cause;
|
|
9812
|
-
return effect;
|
|
9813
|
-
};
|
|
9814
|
-
// -----------------------------------------------------------------------------
|
|
9815
|
-
// Errors
|
|
9816
|
-
// -----------------------------------------------------------------------------
|
|
9817
|
-
/** @internal */
|
|
9818
|
-
const YieldableError = /*#__PURE__*/function () {
|
|
9819
|
-
class YieldableError extends globalThis.Error {
|
|
9820
|
-
commit() {
|
|
9821
|
-
return fail(this);
|
|
9822
|
-
}
|
|
9823
|
-
toJSON() {
|
|
9824
|
-
const obj = {
|
|
9825
|
-
...this
|
|
9826
|
-
};
|
|
9827
|
-
if (this.message) obj.message = this.message;
|
|
9828
|
-
if (this.cause) obj.cause = this.cause;
|
|
9829
|
-
return obj;
|
|
9830
|
-
}
|
|
9831
|
-
[NodeInspectSymbol]() {
|
|
9832
|
-
if (this.toString !== globalThis.Error.prototype.toString) {
|
|
9833
|
-
return this.stack ? `${this.toString()}\n${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
9834
|
-
} else if ("Bun" in globalThis) {
|
|
9835
|
-
return pretty(fail$1(this), {
|
|
9836
|
-
renderErrorCause: true
|
|
9837
|
-
});
|
|
9838
|
-
}
|
|
9839
|
-
return this;
|
|
9840
|
-
}
|
|
9841
|
-
}
|
|
9842
|
-
// @effect-diagnostics-next-line floatingEffect:off
|
|
9843
|
-
Object.assign(YieldableError.prototype, StructuralCommitPrototype);
|
|
9844
|
-
return YieldableError;
|
|
9845
|
-
}();
|
|
9846
|
-
// -----------------------------------------------------------------------------
|
|
9847
|
-
// Exit
|
|
9848
|
-
// -----------------------------------------------------------------------------
|
|
9849
|
-
/** @internal */
|
|
9850
|
-
const exitIsExit = u => isEffect(u) && "_tag" in u && (u._tag === "Success" || u._tag === "Failure");
|
|
9851
|
-
// -----------------------------------------------------------------------------
|
|
9852
|
-
// Tracing
|
|
9853
|
-
// -----------------------------------------------------------------------------
|
|
9854
|
-
/** @internal */
|
|
9855
|
-
const currentSpanFromFiber = fiber => {
|
|
9856
|
-
const span = fiber.currentSpan;
|
|
9857
|
-
return span !== undefined && span._tag === "Span" ? some(span) : none();
|
|
9858
|
-
};
|
|
9859
|
-
|
|
9860
|
-
const hasProcessStdout = typeof process === "object" && process !== null && typeof process.stdout === "object" && process.stdout !== null;
|
|
9861
|
-
hasProcessStdout && process.stdout.isTTY === true;
|
|
9862
|
-
|
|
9863
|
-
/**
|
|
9864
|
-
* Provides a constructor for a Case Class.
|
|
9865
|
-
*
|
|
9866
|
-
* @since 2.0.0
|
|
9867
|
-
* @category constructors
|
|
9868
|
-
*/
|
|
9869
|
-
const Error$1 = /*#__PURE__*/function () {
|
|
9870
|
-
const plainArgsSymbol = /*#__PURE__*/Symbol.for("effect/Data/Error/plainArgs");
|
|
9871
|
-
const O = {
|
|
9872
|
-
BaseEffectError: class extends YieldableError {
|
|
9873
|
-
constructor(args) {
|
|
9874
|
-
super(args?.message, args?.cause ? {
|
|
9875
|
-
cause: args.cause
|
|
9876
|
-
} : undefined);
|
|
9877
|
-
if (args) {
|
|
9878
|
-
Object.assign(this, args);
|
|
9879
|
-
// @effect-diagnostics-next-line floatingEffect:off
|
|
9880
|
-
Object.defineProperty(this, plainArgsSymbol, {
|
|
9881
|
-
value: args,
|
|
9882
|
-
enumerable: false
|
|
9883
|
-
});
|
|
9884
|
-
}
|
|
9885
|
-
}
|
|
9886
|
-
toJSON() {
|
|
9887
|
-
return {
|
|
9888
|
-
...this[plainArgsSymbol],
|
|
9889
|
-
...this
|
|
9890
|
-
};
|
|
9891
|
-
}
|
|
9892
|
-
}
|
|
9893
|
-
};
|
|
9894
|
-
return O.BaseEffectError;
|
|
9895
|
-
}();
|
|
9896
|
-
/**
|
|
9897
|
-
* @since 2.0.0
|
|
9898
|
-
* @category constructors
|
|
9899
|
-
*/
|
|
9900
|
-
const TaggedError = tag => {
|
|
9901
|
-
const O = {
|
|
9902
|
-
BaseEffectError: class extends Error$1 {
|
|
9903
|
-
_tag = tag;
|
|
9904
|
-
}
|
|
9905
|
-
};
|
|
9906
|
-
O.BaseEffectError.prototype.name = tag;
|
|
9907
|
-
return O.BaseEffectError;
|
|
9908
|
-
};
|
|
9909
|
-
|
|
9910
|
-
class FetchError extends TaggedError('FetchError') {
|
|
9911
|
-
}
|
|
9912
|
-
class NotFoundError extends TaggedError('NotFoundError') {
|
|
9913
|
-
}
|
|
9914
|
-
class ResponseTextError extends TaggedError('ResponseTextError') {
|
|
9915
|
-
constructor(error) {
|
|
9916
|
-
super(new Error(`Failed to read response text`, { cause: error }));
|
|
9917
|
-
}
|
|
9918
|
-
}
|
|
9919
|
-
|
|
9920
|
-
refined(isValidSVG, () => error('SVG data is malformed'));
|
|
9921
|
-
class BrandValidationError extends TaggedError('BrandValidationError') {
|
|
9922
|
-
constructor(error, type) {
|
|
9923
|
-
super(new Error(`Brand validation failed for type ${type}.`, { cause: error }));
|
|
9924
|
-
}
|
|
9925
|
-
}
|
|
9926
|
-
function isValidSVG(svg) {
|
|
9927
|
-
if (typeof svg !== 'string') {
|
|
9928
|
-
return false;
|
|
9929
|
-
}
|
|
9930
|
-
try {
|
|
9931
|
-
const parser = new DOMParser();
|
|
9932
|
-
const doc = parser.parseFromString(svg, 'image/svg+xml');
|
|
9933
|
-
return doc.documentElement.nodeName === 'svg';
|
|
9934
|
-
}
|
|
9935
|
-
catch {
|
|
9936
|
-
return false;
|
|
9937
|
-
}
|
|
9938
|
-
}
|
|
9939
|
-
|
|
9940
|
-
const lmvzIconCss = () => `.sc-lmvz-icon-h{--lmvz-icon-color:var(--lmvz-component-color, var(--lmvz-semantic-color-on-surface-input-primary, #000000));display:inline-block;line-height:0;svg{display:block}svg>path{stroke:var(--lmvz-icon-color);fill:none}}[size='xs'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.69rem + 0.26vw, 1rem));height:var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))}}[size='sm'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-sm, clamp(0.88rem, 0.81rem + 0.26vw, 1.13rem));height:var(--lmvz-component-icon-size-sm, clamp(0.88rem, 0.81rem + 0.26vw, 1.13rem))}}[size='md'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-md, clamp(1rem, 0.88rem + 0.52vw, 1.5rem));height:var(--lmvz-component-icon-size-md, clamp(1rem, 0.88rem + 0.52vw, 1.5rem))}}[size='lg'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-lg, clamp(1.5rem, 1.38rem + 0.52vw, 2rem));height:var(--lmvz-component-icon-size-lg, clamp(1.5rem, 1.38rem + 0.52vw, 2rem))}}[size='inherit'].sc-lmvz-icon-h{svg{width:inherit;height:inherit}}[weight='light'].sc-lmvz-icon-h{svg>path{stroke-width:1}}[weight='medium'].sc-lmvz-icon-h{svg>path{stroke-width:1.5}}[weight='bold'].sc-lmvz-icon-h{svg>path{stroke-width:2}}[weight='filled'].sc-lmvz-icon-h{svg>path{stroke-width:2;fill:var(--lmvz-icon-color)}}`;
|
|
9941
|
-
|
|
9942
|
-
class LmvzIcon extends ReactiveControllerHost {
|
|
9943
|
-
intersectionObserver;
|
|
9944
|
-
ariaValidationController = new AriaValidationController(this);
|
|
9945
|
-
get el() { return getElement(this); }
|
|
9946
|
-
validationEl;
|
|
9947
|
-
icon;
|
|
9948
|
-
weight = 'medium';
|
|
9949
|
-
size = 'md';
|
|
9950
|
-
iconData;
|
|
9951
|
-
visible = false;
|
|
9952
|
-
ariaLabel;
|
|
9953
|
-
get ariaHidden() {
|
|
9954
|
-
return !this.ariaLabel;
|
|
9955
|
-
}
|
|
9956
|
-
constructor(hostRef) {
|
|
9957
|
-
super();
|
|
9958
|
-
registerInstance(this, hostRef);
|
|
9959
|
-
this.addController(this.ariaValidationController);
|
|
9960
6226
|
}
|
|
9961
|
-
connectedCallback() {
|
|
9962
|
-
this.waitUntilVisible(() => {
|
|
9963
|
-
this.visible = true;
|
|
9964
|
-
this.loadIconPathData();
|
|
9965
|
-
});
|
|
9966
|
-
super.connectedCallback();
|
|
9967
|
-
}
|
|
9968
|
-
disconnectedCallback() {
|
|
9969
|
-
if (this.intersectionObserver) {
|
|
9970
|
-
this.intersectionObserver.disconnect();
|
|
9971
|
-
this.intersectionObserver = undefined;
|
|
9972
|
-
}
|
|
9973
|
-
super.disconnectedCallback();
|
|
9974
|
-
}
|
|
9975
|
-
async loadIconPathData() {
|
|
9976
|
-
{
|
|
9977
|
-
return;
|
|
9978
|
-
}
|
|
9979
|
-
}
|
|
9980
|
-
componentDidRender() {
|
|
9981
|
-
this.validationEl = this.el.querySelector('svg');
|
|
9982
|
-
this.ariaValidationController.revalidateAria();
|
|
9983
|
-
super.componentDidRender();
|
|
9984
|
-
}
|
|
9985
|
-
render() {
|
|
9986
|
-
return hAsync(Host, { key: 'f5c2f8025d0e9598d903e72770ebca6cad01961c', role: "img", "aria-hidden": `${this.ariaHidden}`, innerHTML: this.iconData });
|
|
9987
|
-
}
|
|
9988
|
-
waitUntilVisible(callback, rootMargin = 50) {
|
|
9989
|
-
{
|
|
9990
|
-
callback();
|
|
9991
|
-
return;
|
|
9992
|
-
}
|
|
9993
|
-
}
|
|
9994
|
-
static get assetsDirs() { return ["../../assets/icons"]; }
|
|
9995
6227
|
static get watchers() { return {
|
|
9996
6228
|
"icon": [{
|
|
9997
6229
|
"loadIconPathData": 0
|
|
6230
|
+
}],
|
|
6231
|
+
"iconset": [{
|
|
6232
|
+
"loadIconPathData": 0
|
|
9998
6233
|
}]
|
|
9999
6234
|
}; }
|
|
10000
6235
|
static get style() { return lmvzIconCss(); }
|
|
@@ -10005,17 +6240,18 @@ class LmvzIcon extends ReactiveControllerHost {
|
|
|
10005
6240
|
"icon": [513],
|
|
10006
6241
|
"weight": [513],
|
|
10007
6242
|
"size": [513],
|
|
6243
|
+
"iconset": [513],
|
|
10008
6244
|
"ariaLabel": [513, "aria-label"],
|
|
10009
6245
|
"iconData": [32],
|
|
10010
6246
|
"visible": [32]
|
|
10011
6247
|
},
|
|
10012
6248
|
"$listeners$": undefined,
|
|
10013
6249
|
"$lazyBundleId$": "-",
|
|
10014
|
-
"$attrsToReflect$": [["icon", "icon"], ["weight", "weight"], ["size", "size"], ["ariaLabel", "aria-label"]]
|
|
6250
|
+
"$attrsToReflect$": [["icon", "icon"], ["weight", "weight"], ["size", "size"], ["iconset", "iconset"], ["ariaLabel", "aria-label"]]
|
|
10015
6251
|
}; }
|
|
10016
6252
|
}
|
|
10017
6253
|
|
|
10018
|
-
const lmvzInputCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-input-h { display: block; font-family: var(--lmvz-global-font-family-default, Router); --input-radius: var(--lmvz-component-input-radius-default, 999px); --input-bg: var(--lmvz-semantic-color-surface-input-primary, #ffffff); --input-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); --input-border-color-hover: var(--lmvz-semantic-color-border-hover, #c7c7c7); --input-border-color-focus: var(--lmvz-semantic-color-status-on-
|
|
6254
|
+
const lmvzInputCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-input-h { display: block; font-family: var(--lmvz-global-font-family-default, Router); --input-radius: var(--lmvz-component-input-radius-default, 999px); --input-bg: var(--lmvz-semantic-color-surface-input-primary, #ffffff); --input-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); --input-border-color-hover: var(--lmvz-semantic-color-border-hover, #c7c7c7); --input-border-color-focus: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --input-border-width: var(--lmvz-semantic-border-width-default, 1px); --input-height: 48px; --input-padding-x: 16px; --label-color: var(--lmvz-semantic-color-on-surface-input-secondary, #7a7a7a); --input-text-color: var(--lmvz-semantic-color-on-surface-input-primary, #000000); --helper-text-color: var(--lmvz-semantic-color-on-surface-input-secondary, #7a7a7a); --error-text-color: var(--lmvz-semantic-color-status-on-danger, #e52a31); --label-floating-scale: 0.85; --label-minimized-top: -6px; --label-minimized-bg: var(--input-bg); --label-minimized-padding-x: 4px; --input-disabled-opacity: var(--lmvz-component-input-disabled-opacity, 40%); } .input-container.sc-lmvz-input { display: flex; flex-direction: column; position: relative; width: 100%; } .input-wrapper.sc-lmvz-input { background-color: var(--input-bg); border: var(--input-border-width) solid var(--input-border-color); border-radius: var(--input-radius); display: flex; align-items: center; height: var(--input-height); padding: 0 var(--input-padding-x); position: relative; transition: border-color 0.2s ease; gap: 8px; } [disabled].sc-lmvz-input-h .input-wrapper.sc-lmvz-input { opacity: var(--input-disabled-opacity); cursor: not-allowed; pointer-events: none; } .input-container.sc-lmvz-input:focus-within .input-wrapper.sc-lmvz-input { border-color: var(--input-border-color-focus); outline: 2px solid var(--input-border-color-focus); outline-offset: 2px; } .input-container.sc-lmvz-input:has(input:focus-visible) .input-wrapper.sc-lmvz-input { box-shadow: 0 0 0 3px rgb(0 86 214 / 20%); } [error].sc-lmvz-input-h .input-wrapper.sc-lmvz-input { border-color: var(--error-text-color); } [error].sc-lmvz-input-h:focus-within .input-wrapper.sc-lmvz-input { border-color: var(--error-text-color); outline-color: var(--error-text-color); } .sc-lmvz-input-h:not([disabled]) .input-wrapper.sc-lmvz-input:hover { border-color: var(--input-border-color-hover); } .label-input-group.sc-lmvz-input { position: relative; flex-grow: 1; display: flex; align-items: center; height: 100%; } label.sc-lmvz-input { position: absolute; left: 0; top: 50%; transform: translateY(-50%); color: var(--label-color); font-size: 14px; font-family: Router, sans-serif; font-weight: 400; pointer-events: none; transition: all 0.2s ease-out; background-color: transparent; padding: 0; margin: 0; line-height: normal; white-space: nowrap; } label.floating.sc-lmvz-input { top: 0; transform: translateY(-50%) scale(0.85); transform-origin: left top; background-color: var(--label-minimized-bg); padding: 0 var(--label-minimized-padding-x); left: -2px; color: var(--input-text-color); font-weight: 500; } .required-indicator.sc-lmvz-input { color: var(--error-text-color); margin-left: 2px; } input.sc-lmvz-input { border: none; background: transparent; width: 100%; height: 100%; color: var(--input-text-color); font-family: inherit; font-size: 14px; outline: none; padding: 0; margin: 0; font-weight: 400; } input.sc-lmvz-input::placeholder { color: var(--label-color); } div.sc-lmvz-input:empty { display: none; } [role='status'].sc-lmvz-input { padding-top: 8px; padding-left: 12px; font-size: 12px; color: var(--helper-text-color); font-family: Router, sans-serif; font-weight: 500; } [role='alert'].sc-lmvz-input { padding-top: 8px; padding-left: 12px; font-size: 12px; color: var(--error-text-color); font-family: Router, sans-serif; font-weight: 500; } .sc-lmvz-input-s > lmvz-button { --lmvz-button-padding: 4px; }`;
|
|
10019
6255
|
|
|
10020
6256
|
let inputIdCounter = 0;
|
|
10021
6257
|
class LmvzInput extends ReactiveControllerHost {
|
|
@@ -10173,9 +6409,9 @@ class LmvzInput extends ReactiveControllerHost {
|
|
|
10173
6409
|
render() {
|
|
10174
6410
|
const hasValue = Boolean(this.value);
|
|
10175
6411
|
const shouldFloatLabel = hasValue || Boolean(this.placeholder);
|
|
10176
|
-
return (hAsync("div", { key: '
|
|
6412
|
+
return (hAsync("div", { key: '9de2e4dd202edc937e96ff6ebdc8d0270851c4ca', class: classNames('input-container', {
|
|
10177
6413
|
'interaction-filled': hasValue,
|
|
10178
|
-
}) }, hAsync("div", { key: '
|
|
6414
|
+
}) }, hAsync("div", { key: '0c9f92778e1c52dca13ed9175a09d757fc6eedc9', class: "input-wrapper" }, hAsync("slot", { key: '9cf29c45afdb127917a68ed6752faf3d50004c7d', name: "before-input" }), hAsync("div", { key: 'e7e6c54b6ee6db108ac3f8ddb676bb9fcf10517e', class: "label-input-group" }, hAsync("label", { key: '68eb29e585741971aae58c7693d011ba587f1c1b', htmlFor: this.inputId, class: classNames({ floating: shouldFloatLabel }) }, this.label, this.required && (hAsync("span", { key: '274d992a43c2de45af7172608fb1581c6ee771d2', class: "required-indicator", "aria-hidden": "true" }, ' ', "*"))), hAsync("input", { key: 'a26b95dee9781e0e13db16d6e09681e36cab0230', id: this.inputId, ref: (el) => (this.nativeInputElement = el), type: this.type, min: this.min, max: this.max, step: this.step, value: this.value, name: this.name, placeholder: this.placeholder, disabled: this.disabled, readOnly: this.readonly, required: this.required, form: this.form, autocomplete: this.autocomplete, inputmode: this.inputmode, autocorrect: this.autocorrect, autocapitalize: this.autocapitalize, spellcheck: this.spellcheck, autofocus: this.autofocus, minlength: this.minlength, maxlength: this.maxlength, pattern: this.pattern, "aria-invalid": this.error ? 'true' : 'false', "aria-required": this.required ? 'true' : 'false', "aria-describedby": this.describedBy, "aria-errormessage": this.errorId, onInput: this.handleInput, onChange: this.handleChange, onFocus: this.handleFocus, onBlur: this.handleBlur })), hAsync("slot", { key: '5b77b87ba1da3b8e71c7f6825eecf2216a93e4f9', name: "after-input" })), hAsync("div", { key: 'cac334a1e88d4136e923ef1355196997bfe97099', id: this.helperId, role: "status" }, this.helperText || null), hAsync("div", { key: 'b3ea662fa0a57ed0d8c3f35e36aad6b2513af8ab', id: this.errorId, role: "alert" }, (this.showErrorMessage && this.errorMessage) || null)));
|
|
10179
6415
|
}
|
|
10180
6416
|
static get formAssociated() { return true; }
|
|
10181
6417
|
static get watchers() { return {
|
|
@@ -10230,7 +6466,7 @@ class LmvzInput extends ReactiveControllerHost {
|
|
|
10230
6466
|
}; }
|
|
10231
6467
|
}
|
|
10232
6468
|
|
|
10233
|
-
const lmvzMenuitemCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-menuitem-h { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); border-radius: var(--lmvz-semantic-border-radius-lg, 14px); font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); padding: var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)) var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); cursor: pointer; --lmvz-menuitem-color: var(--lmvz-semantic-color-int-on-tertiary, #545454); --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); background: var(--lmvz-menuitem-background); color: var(--lmvz-menuitem-color); } .sc-lmvz-menuitem-h:hover { --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); } .sc-lmvz-menuitem-h:active { --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); } .sc-lmvz-menuitem-h:focus-visible { z-index: 1; } [aria-expanded='true'].sc-lmvz-menuitem-h { --lmvz-menuitem-background: var(--lmvz-semantic-color-status-
|
|
6469
|
+
const lmvzMenuitemCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-menuitem-h { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); border-radius: var(--lmvz-semantic-border-radius-lg, 14px); font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); padding: var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)) var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); cursor: pointer; --lmvz-menuitem-color: var(--lmvz-semantic-color-int-on-tertiary, #545454); --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); background: var(--lmvz-menuitem-background); color: var(--lmvz-menuitem-color); } .sc-lmvz-menuitem-h:hover { --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); } .sc-lmvz-menuitem-h:active { --lmvz-menuitem-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); } .sc-lmvz-menuitem-h:focus-visible { z-index: 1; } [aria-expanded='true'].sc-lmvz-menuitem-h { --lmvz-menuitem-background: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --lmvz-menuitem-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); }`;
|
|
10234
6470
|
|
|
10235
6471
|
class LmvzMenuItem extends ReactiveControllerHost {
|
|
10236
6472
|
get el() { return getElement(this); }
|
|
@@ -10253,7 +6489,7 @@ class LmvzMenuItem extends ReactiveControllerHost {
|
|
|
10253
6489
|
this.addController(new ElementActivationController(this));
|
|
10254
6490
|
}
|
|
10255
6491
|
render() {
|
|
10256
|
-
return (hAsync(Host, { key: '
|
|
6492
|
+
return (hAsync(Host, { key: '510ac59b18468ce9c65b866ae2767185f1b3da92' }, hAsync("slot", { key: '7e032e0dab83f9bfbaa96ad2b78d8a5a58f978ab', ref: (e) => (this.validationSlot = e) })));
|
|
10257
6493
|
}
|
|
10258
6494
|
static get style() { return lmvzMenuitemCss(); }
|
|
10259
6495
|
static get cmpMeta() { return {
|
|
@@ -10271,7 +6507,7 @@ class LmvzMenuItem extends ReactiveControllerHost {
|
|
|
10271
6507
|
|
|
10272
6508
|
const chevronDownSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIwLjMzMzQgOC42NjY2M0wxMi4wMDAxIDE3TDMuNjY2NzUgOC42NjY2MyIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo=';
|
|
10273
6509
|
|
|
10274
|
-
const lmvzSelectCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-select-h { display: block; font-family: var(--lmvz-global-font-family-default, Router); --lmvz-internal-select-floating-label-top-offset: 0.375rem; padding-top: var(--lmvz-internal-select-floating-label-top-offset); --lmvz-select-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-select-bg: var(--lmvz-semantic-color-int-secondary, #f0f0f0); --lmvz-select-bg-hover: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --lmvz-select-text-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-select-label-color: var(--lmvz-semantic-color-on-surface-input-primary, #000000); --lmvz-select-padding-x: var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); --lmvz-select-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-select-height: 40px; --lmvz-select-label-font-size: var(--lmvz-component-component-typography-body-sm-font-size, 0.75rem); --lmvz-select-label-top-offset: calc(var(--lmvz-internal-select-floating-label-top-offset) * -1); --lmvz-select-label-minimized-padding-x: 4px; --lmvz-select-disabled-opacity: var(--lmvz-component-input-disabled-opacity, 40%); --lmvz-select-helper-color: var(--lmvz-semantic-color-on-surface-input-secondary, #7a7a7a); --lmvz-select-focus-color: var(--lmvz-semantic-color-status-on-
|
|
6510
|
+
const lmvzSelectCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-select-h { display: block; font-family: var(--lmvz-global-font-family-default, Router); --lmvz-internal-select-floating-label-top-offset: 0.375rem; padding-top: var(--lmvz-internal-select-floating-label-top-offset); --lmvz-select-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-select-bg: var(--lmvz-semantic-color-int-secondary, #f0f0f0); --lmvz-select-bg-hover: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --lmvz-select-text-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-select-label-color: var(--lmvz-semantic-color-on-surface-input-primary, #000000); --lmvz-select-padding-x: var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); --lmvz-select-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-select-height: 40px; --lmvz-select-label-font-size: var(--lmvz-component-component-typography-body-sm-font-size, 0.75rem); --lmvz-select-label-top-offset: calc(var(--lmvz-internal-select-floating-label-top-offset) * -1); --lmvz-select-label-minimized-padding-x: 4px; --lmvz-select-disabled-opacity: var(--lmvz-component-input-disabled-opacity, 40%); --lmvz-select-helper-color: var(--lmvz-semantic-color-on-surface-input-secondary, #7a7a7a); --lmvz-select-focus-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --lmvz-select-error-color: var(--lmvz-semantic-color-status-on-danger, #e52a31); } .select-wrapper.sc-lmvz-select { position: relative; height: var(--lmvz-select-height); } label.sc-lmvz-select { position: absolute; top: 50%; left: var(--lmvz-select-padding-x); font-size: var(--lmvz-select-label-font-size); color: var(--lmvz-select-label-color); line-height: normal; white-space: nowrap; pointer-events: none; z-index: 2; transform: translateY(-50%); transform-origin: left top; transition: top 0.2s ease-out, transform 0.2s ease-out, opacity 0.2s ease-out, padding 0.2s ease-out; } label.assistive-label.sc-lmvz-select { opacity: 0; padding: 0; } label.floating-label.sc-lmvz-select { top: var(--lmvz-select-label-top-offset); transform: translateY(0) scale(0.85); left: calc(var(--lmvz-select-padding-x) - 2px); background-color: var(--lmvz-select-bg); padding: 0 var(--lmvz-select-label-minimized-padding-x); opacity: 1; font-weight: 500; } label.sc-lmvz-select > span[aria-hidden='true'].sc-lmvz-select, div[aria-hidden='true'].sc-lmvz-select > span.sc-lmvz-select:first-child > span[aria-hidden='true'].sc-lmvz-select { color: var(--lmvz-select-error-color); margin-left: 2px; display: inline-block; line-height: 0; vertical-align: middle; } div[aria-hidden].sc-lmvz-select { display: flex; align-items: center; gap: var(--lmvz-select-gap); height: 100%; padding: 0 var(--lmvz-select-padding-x); border-radius: var(--lmvz-select-radius); background-color: var(--lmvz-select-bg); cursor: pointer; position: relative; z-index: 1; transition: background-color 0.15s ease; } .sc-lmvz-select-h:not([disabled]) .select-wrapper.sc-lmvz-select:hover div[aria-hidden].sc-lmvz-select { background-color: var(--lmvz-select-bg-hover); } .select-wrapper.sc-lmvz-select:focus-within div[aria-hidden].sc-lmvz-select { outline: 2px solid var(--lmvz-select-focus-color); outline-offset: 2px; } div[aria-hidden].sc-lmvz-select > span.sc-lmvz-select:first-child { flex: 1 0 0; font-size: var(--lmvz-component-component-typography-body-md-font-size, 0.875rem); font-weight: var(--lmvz-global-font-weight-500, 500); color: var(--lmvz-select-text-color); line-height: 1.4; letter-spacing: var(--lmvz-component-body-md-letter-spacing, 0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } div[aria-hidden].sc-lmvz-select > span.sc-lmvz-select:last-child { flex-shrink: 0; display: flex; align-items: center; justify-content: center; } img.sc-lmvz-select { display: block; width: var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); height: var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); } select.sc-lmvz-select { appearance: none; position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; border: none; background: transparent; margin: 0; padding: 0; } [disabled].sc-lmvz-select-h .select-wrapper.sc-lmvz-select { opacity: var(--lmvz-select-disabled-opacity); pointer-events: none; cursor: not-allowed; } [role='status'].sc-lmvz-select { margin-top: 4px; padding-left: var(--lmvz-select-padding-x); font-size: var(--lmvz-select-label-font-size); color: var(--lmvz-select-helper-color); line-height: normal; }`;
|
|
10275
6511
|
|
|
10276
6512
|
let selectIdCounter = 0;
|
|
10277
6513
|
class LmvzSelect extends ReactiveControllerHost {
|
|
@@ -10323,7 +6559,7 @@ class LmvzSelect extends ReactiveControllerHost {
|
|
|
10323
6559
|
render() {
|
|
10324
6560
|
const hasValue = this.hasValue;
|
|
10325
6561
|
const shouldShowLabel = hasValue;
|
|
10326
|
-
return (hAsync(Host, { key: '
|
|
6562
|
+
return (hAsync(Host, { key: '7f4650d5971bb93dba48385df734e6b7a0b4f7eb' }, hAsync("div", { key: '79d6234cd15f64c8bff787d715107e7e86145333', class: "select-wrapper" }, hAsync("label", { key: '14d93469c6d309b68427ff7bfc2bd531c8f0ecf6', htmlFor: this.selectId, class: shouldShowLabel ? 'floating-label' : 'assistive-label' }, this.label, this.required && shouldShowLabel && hAsync("span", { key: 'c8be809e09d768d6f73ccccdfbf0bf495869ac72', "aria-hidden": "true" }, " *")), hAsync("div", { key: '1db5d44b44100342a4ca5feff648b61a0bdadb1a', "aria-hidden": "true" }, hAsync("span", { key: '3fdc95aab9997a10f4ba42dabc3758aea0797a22' }, hasValue ? this.selectedLabel : this.label, this.required && !hasValue && hAsync("span", { key: '11aef8194551059130b6be5351587219a1e80f00', "aria-hidden": "true" }, " *")), hAsync("span", { key: '8fc52ff3e46d7b52d8d5069a74ebf7bb0d981081' }, hAsync("img", { key: '129dd4038772eba9313e1e322866c70408f4e2ad', src: chevronDownSvg, alt: "" }))), hAsync("select", { key: '6eb6cf496e60b3c1bd9556e596cbef34d4da5a09', id: this.selectId, ref: (el) => (this.nativeSelectEl = el), name: this.name, disabled: this.disabled, required: this.required, "aria-label": this.label, onChange: this.handleChange }, !hasValue && hAsync("option", { key: '70d660e0bc7e4c127234ce77decf35d6fea7fe8d', value: "", disabled: true, selected: true, hidden: true }), hAsync("slot", { key: 'e6cbc238c9c0cf8e8c31d0347a1f621272a94ca6' }))), this.helperText && hAsync("div", { key: '432d405ee7338da46509ff207599b882a19ea44e', role: "status" }, this.helperText)));
|
|
10327
6563
|
}
|
|
10328
6564
|
static get watchers() { return {
|
|
10329
6565
|
"value": [{
|