@eightshift/ui-components 6.3.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button-h6xF_WrP.js +225 -0
- package/dist/Dialog-i5VLQw1o.js +2488 -0
- package/dist/Disclosure-NYWFw9RJ.js +188 -0
- package/dist/FieldError-BWDbP5Db.js +213 -0
- package/dist/FocusScope-CgwbGOBB.js +746 -0
- package/dist/Form-DTMkbrQY.js +5 -0
- package/dist/Heading-Hol-wS_B.js +16 -0
- package/dist/Hidden-8TB37dpK.js +51 -0
- package/dist/Input-BURqyJXW.js +161 -0
- package/dist/Label-DFXXxMKY.js +17 -0
- package/dist/List-CMK5qsNF.js +506 -0
- package/dist/ListBox-B21SgugS.js +601 -0
- package/dist/NumberFormatter-m5VW6MTK.js +122 -0
- package/dist/OverlayArrow-BoloUPQM.js +573 -0
- package/dist/PortalProvider-DinZZCKX.js +14 -0
- package/dist/RSPContexts-C_z0bI8W.js +12 -0
- package/dist/RadioGroup-BwlGtCja.js +329 -0
- package/dist/SearchField-DR_I4_yn.js +765 -0
- package/dist/SelectionIndicator-31L6EI9F.js +13 -0
- package/dist/SelectionManager-B8lLv6Ue.js +2176 -0
- package/dist/Slider-DW1RuMVp.js +827 -0
- package/dist/Text-O6VBBDlP.js +16 -0
- package/dist/VisuallyHidden-CfsnJHZb.js +43 -0
- package/dist/animation-Bd2peown.js +62 -0
- package/dist/assets/style-admin.css +197 -200
- package/dist/assets/style-editor.css +197 -200
- package/dist/assets/style.css +197 -200
- package/dist/build-module-sxK3nxOK.js +855 -0
- package/dist/button-COTeluL8.js +524 -0
- package/dist/checkbox-D0AWkLhp.js +338 -0
- package/dist/clsx-BUU5J41u.js +16 -0
- package/dist/color-swatch-CBYsO_Zs.js +2572 -0
- package/dist/components/animated-visibility/animated-visibility.js +87 -111
- package/dist/components/base-control/base-control.js +73 -86
- package/dist/components/base-control/container.js +199 -227
- package/dist/components/breakpoint-preview/breakpoint-preview.js +162 -158
- package/dist/components/button/button.js +3 -580
- package/dist/components/checkbox/checkbox.js +2 -391
- package/dist/components/color-pickers/color-picker.js +172 -276
- package/dist/components/color-pickers/color-swatch.js +3 -7
- package/dist/components/color-pickers/gradient-editor.js +4 -552
- package/dist/components/color-pickers/solid-color-picker.js +3 -1710
- package/dist/components/component-toggle/component-toggle.js +107 -160
- package/dist/components/container-panel/container-panel.js +94 -151
- package/dist/components/draggable/draggable-context.js +4 -4
- package/dist/components/draggable/draggable-handle.js +27 -43
- package/dist/components/draggable/draggable.js +3 -7638
- package/dist/components/draggable-list/draggable-list-context.js +4 -4
- package/dist/components/draggable-list/draggable-list-item.js +63 -80
- package/dist/components/draggable-list/draggable-list.js +115 -142
- package/dist/components/expandable/expandable.js +105 -407
- package/dist/components/index.js +30 -106
- package/dist/components/input-field/input-field.js +2 -326
- package/dist/components/item-collection/item-collection.js +50 -56
- package/dist/components/layout/hstack.js +27 -29
- package/dist/components/layout/vstack.js +27 -29
- package/dist/components/link-input/link-input.js +3 -1943
- package/dist/components/matrix-align/matrix-align.js +127 -161
- package/dist/components/menu/menu.js +253 -356
- package/dist/components/modal/modal.js +3 -399
- package/dist/components/notice/notice.js +99 -139
- package/dist/components/number-picker/number-picker.js +3 -344
- package/dist/components/option-select/option-select.js +226 -404
- package/dist/components/options-panel/options-panel.js +138 -175
- package/dist/components/placeholders/file-picker-shell.js +91 -141
- package/dist/components/placeholders/file-placeholder.js +41 -53
- package/dist/components/placeholders/image-placeholder.js +65 -96
- package/dist/components/placeholders/media-placeholder.js +65 -68
- package/dist/components/popover/popover.js +147 -221
- package/dist/components/portal-provider/portal-provider.js +23 -21
- package/dist/components/radio/radio.js +246 -294
- package/dist/components/repeater/repeater-context.js +4 -4
- package/dist/components/repeater/repeater-item.js +95 -114
- package/dist/components/repeater/repeater.js +221 -278
- package/dist/components/responsive/mini-responsive.js +403 -495
- package/dist/components/responsive/responsive-legacy.js +271 -336
- package/dist/components/responsive/responsive.js +445 -562
- package/dist/components/responsive-preview/responsive-preview.js +94 -117
- package/dist/components/rich-label/rich-label.js +80 -75
- package/dist/components/select/async-multi-select.js +360 -589
- package/dist/components/select/async-select.js +284 -492
- package/dist/components/select/multi-select.js +340 -552
- package/dist/components/select/shared.js +3 -17
- package/dist/components/select/single-select.js +278 -475
- package/dist/components/select/styles.js +84 -0
- package/dist/components/slider/column-config-slider.js +170 -301
- package/dist/components/slider/slider.js +258 -405
- package/dist/components/slider/utils.js +77 -121
- package/dist/components/smart-image/image-analysis-worker.js +128 -0
- package/dist/components/smart-image/smart-image.js +3 -205
- package/dist/components/smart-image/worker-inline.js +4 -4
- package/dist/components/spacer/spacer.js +80 -94
- package/dist/components/tabs/tabs.js +3 -1051
- package/dist/components/toggle/switch.js +2 -295
- package/dist/components/toggle/toggle.js +54 -64
- package/dist/components/toggle-button/toggle-button.js +2 -451
- package/dist/components/tooltip/tooltip.js +2 -535
- package/dist/context-C-XNeJ_l.js +93 -0
- package/dist/debounce-throttle-DXxSAKpq.js +120 -0
- package/dist/dist-DIK9pFxO.js +55 -0
- package/dist/draggable-CYQyD9gG.js +6961 -0
- package/dist/es-dash-HqXWZZ3_.js +303 -0
- package/dist/filterDOMProps-_2_3GD-K.js +69 -0
- package/dist/general-D-7dwhuF.js +4277 -0
- package/dist/gradient-editor-DbH8NU2p.js +604 -0
- package/dist/icons/block-icon.js +34 -39
- package/dist/icons/generated-icon-loaders.js +759 -0
- package/dist/icons/generic-color-swatch.js +81 -111
- package/dist/icons/icon.js +67 -0
- package/dist/icons/icons.js +218 -3656
- package/dist/icons/index.js +756 -10
- package/dist/icons/internal.js +758 -0
- package/dist/icons/jsx-svg.js +2 -94
- package/dist/icons/spinner.js +16 -18
- package/dist/icons/ui-icons/a11y-warning.js +34 -0
- package/dist/icons/ui-icons/a11y.js +29 -0
- package/dist/icons/ui-icons/accelerometer.js +51 -0
- package/dist/icons/ui-icons/activity-log.js +53 -0
- package/dist/icons/ui-icons/add.js +20 -0
- package/dist/icons/ui-icons/alert.js +31 -0
- package/dist/icons/ui-icons/align-horizontal-vertical-alt.js +37 -0
- package/dist/icons/ui-icons/align-horizontal-vertical-alt2.js +36 -0
- package/dist/icons/ui-icons/align-horizontal-vertical.js +34 -0
- package/dist/icons/ui-icons/alt-text-generic-alt.js +19 -0
- package/dist/icons/ui-icons/alt-text-generic.js +25 -0
- package/dist/icons/ui-icons/alt-text.js +36 -0
- package/dist/icons/ui-icons/anchor-page.js +44 -0
- package/dist/icons/ui-icons/anchor.js +28 -0
- package/dist/icons/ui-icons/angle.js +24 -0
- package/dist/icons/ui-icons/animation-file.js +66 -0
- package/dist/icons/ui-icons/animation-generic.js +36 -0
- package/dist/icons/ui-icons/animation-list-generic.js +41 -0
- package/dist/icons/ui-icons/animation-settings-generic.js +41 -0
- package/dist/icons/ui-icons/animation.js +55 -0
- package/dist/icons/ui-icons/archive-file.js +24 -0
- package/dist/icons/ui-icons/archive.js +39 -0
- package/dist/icons/ui-icons/aria-label.js +42 -0
- package/dist/icons/ui-icons/arrow-down-circle-alt.js +28 -0
- package/dist/icons/ui-icons/arrow-down-circle.js +28 -0
- package/dist/icons/ui-icons/arrow-down-square-alt.js +28 -0
- package/dist/icons/ui-icons/arrow-down-square.js +28 -0
- package/dist/icons/ui-icons/arrow-down.js +20 -0
- package/dist/icons/ui-icons/arrow-left-circle-alt.js +28 -0
- package/dist/icons/ui-icons/arrow-left-circle.js +28 -0
- package/dist/icons/ui-icons/arrow-left-square-alt.js +28 -0
- package/dist/icons/ui-icons/arrow-left-square.js +28 -0
- package/dist/icons/ui-icons/arrow-left.js +20 -0
- package/dist/icons/ui-icons/arrow-right-circle-alt.js +28 -0
- package/dist/icons/ui-icons/arrow-right-circle.js +28 -0
- package/dist/icons/ui-icons/arrow-right-square-alt.js +28 -0
- package/dist/icons/ui-icons/arrow-right-square.js +28 -0
- package/dist/icons/ui-icons/arrow-right.js +20 -0
- package/dist/icons/ui-icons/arrow-up-circle-alt.js +28 -0
- package/dist/icons/ui-icons/arrow-up-circle.js +28 -0
- package/dist/icons/ui-icons/arrow-up-square-alt.js +28 -0
- package/dist/icons/ui-icons/arrow-up-square.js +28 -0
- package/dist/icons/ui-icons/arrow-up.js +20 -0
- package/dist/icons/ui-icons/arrows-down.js +38 -0
- package/dist/icons/ui-icons/arrows-horizontal.js +20 -0
- package/dist/icons/ui-icons/arrows-left-diagonal.js +20 -0
- package/dist/icons/ui-icons/arrows-left.js +38 -0
- package/dist/icons/ui-icons/arrows-right-diagonal.js +20 -0
- package/dist/icons/ui-icons/arrows-right.js +38 -0
- package/dist/icons/ui-icons/arrows-up.js +38 -0
- package/dist/icons/ui-icons/arrows-vertical.js +20 -0
- package/dist/icons/ui-icons/aspect-ratio-auto.js +38 -0
- package/dist/icons/ui-icons/aspect-ratio-nine-sixteen.js +28 -0
- package/dist/icons/ui-icons/aspect-ratio-sixteen-nine.js +28 -0
- package/dist/icons/ui-icons/aspect-ratio-square.js +28 -0
- package/dist/icons/ui-icons/aspect-ratio-three-two.js +28 -0
- package/dist/icons/ui-icons/aspect-ratio-twenty-one-nine.js +28 -0
- package/dist/icons/ui-icons/aspect-ratio.js +27 -0
- package/dist/icons/ui-icons/attachment.js +19 -0
- package/dist/icons/ui-icons/auto-close.js +26 -0
- package/dist/icons/ui-icons/auto-pause-scroll.js +39 -0
- package/dist/icons/ui-icons/auto-pause.js +26 -0
- package/dist/icons/ui-icons/automatic-alt.js +19 -0
- package/dist/icons/ui-icons/automatic.js +20 -0
- package/dist/icons/ui-icons/autoplay-alt.js +34 -0
- package/dist/icons/ui-icons/autoplay-alt2.js +23 -0
- package/dist/icons/ui-icons/autoplay.js +36 -0
- package/dist/icons/ui-icons/award.js +39 -0
- package/dist/icons/ui-icons/background-blur.js +66 -0
- package/dist/icons/ui-icons/background-color-swatch.js +48 -0
- package/dist/icons/ui-icons/background-image.js +41 -0
- package/dist/icons/ui-icons/background-repeat.js +95 -0
- package/dist/icons/ui-icons/background-type-alt.js +38 -0
- package/dist/icons/ui-icons/background-type-alt2.js +27 -0
- package/dist/icons/ui-icons/background-type.js +27 -0
- package/dist/icons/ui-icons/block-parts.js +54 -0
- package/dist/icons/ui-icons/bold.js +21 -0
- package/dist/icons/ui-icons/book.js +40 -0
- package/dist/icons/ui-icons/bookmark.js +18 -0
- package/dist/icons/ui-icons/boolean-exclude.js +24 -0
- package/dist/icons/ui-icons/boolean-intersect.js +31 -0
- package/dist/icons/ui-icons/boolean-subtract.js +27 -0
- package/dist/icons/ui-icons/boolean-union.js +33 -0
- package/dist/icons/ui-icons/border-color.js +79 -0
- package/dist/icons/ui-icons/border.js +60 -0
- package/dist/icons/ui-icons/bot-deny.js +61 -0
- package/dist/icons/ui-icons/bot.js +47 -0
- package/dist/icons/ui-icons/box.js +35 -0
- package/dist/icons/ui-icons/brain.js +20 -0
- package/dist/icons/ui-icons/branch-fork.js +46 -0
- package/dist/icons/ui-icons/branch.js +46 -0
- package/dist/icons/ui-icons/briefcase.js +26 -0
- package/dist/icons/ui-icons/browser.js +60 -0
- package/dist/icons/ui-icons/button-disabled.js +30 -0
- package/dist/icons/ui-icons/button-filled.js +19 -0
- package/dist/icons/ui-icons/button-ghost.js +28 -0
- package/dist/icons/ui-icons/button-outline.js +27 -0
- package/dist/icons/ui-icons/calculator.js +139 -0
- package/dist/icons/ui-icons/calendar-add.js +51 -0
- package/dist/icons/ui-icons/calendar-download.js +62 -0
- package/dist/icons/ui-icons/calendar-remove.js +51 -0
- package/dist/icons/ui-icons/calendar.js +34 -0
- package/dist/icons/ui-icons/caption-generic.js +25 -0
- package/dist/icons/ui-icons/card-featured.js +28 -0
- package/dist/icons/ui-icons/caret-down-fill.js +19 -0
- package/dist/icons/ui-icons/caret-down.js +19 -0
- package/dist/icons/ui-icons/caret-left-fill.js +19 -0
- package/dist/icons/ui-icons/caret-left.js +19 -0
- package/dist/icons/ui-icons/caret-right-fill.js +19 -0
- package/dist/icons/ui-icons/caret-right.js +19 -0
- package/dist/icons/ui-icons/caret-up-fill.js +19 -0
- package/dist/icons/ui-icons/caret-up.js +19 -0
- package/dist/icons/ui-icons/center-point.js +25 -0
- package/dist/icons/ui-icons/chat-bubble-alt.js +25 -0
- package/dist/icons/ui-icons/chat-bubble.js +19 -0
- package/dist/icons/ui-icons/chat.js +25 -0
- package/dist/icons/ui-icons/check-circle-fill-transparent.js +24 -0
- package/dist/icons/ui-icons/check-circle-fill.js +17 -0
- package/dist/icons/ui-icons/check-circle.js +27 -0
- package/dist/icons/ui-icons/check-square.js +28 -0
- package/dist/icons/ui-icons/check.js +20 -0
- package/dist/icons/ui-icons/checks-circle.js +26 -0
- package/dist/icons/ui-icons/checks.js +26 -0
- package/dist/icons/ui-icons/chevron-down.js +20 -0
- package/dist/icons/ui-icons/chevron-left.js +20 -0
- package/dist/icons/ui-icons/chevron-right.js +20 -0
- package/dist/icons/ui-icons/chevron-up.js +20 -0
- package/dist/icons/ui-icons/clear-alt.js +25 -0
- package/dist/icons/ui-icons/clear.js +20 -0
- package/dist/icons/ui-icons/clipboard-plain.js +35 -0
- package/dist/icons/ui-icons/clipboard.js +43 -0
- package/dist/icons/ui-icons/clock.js +26 -0
- package/dist/icons/ui-icons/closed-captions.js +27 -0
- package/dist/icons/ui-icons/code-variable.js +20 -0
- package/dist/icons/ui-icons/code.js +20 -0
- package/dist/icons/ui-icons/color-alt.js +40 -0
- package/dist/icons/ui-icons/color-fill-swatch.js +61 -0
- package/dist/icons/ui-icons/color-picker-fill.js +42 -0
- package/dist/icons/ui-icons/color-picker-list-marker.js +41 -0
- package/dist/icons/ui-icons/color-picker-text-highlight.js +19 -0
- package/dist/icons/ui-icons/color-picker-text.js +20 -0
- package/dist/icons/ui-icons/color-select.js +33 -0
- package/dist/icons/ui-icons/color.js +22 -0
- package/dist/icons/ui-icons/column-gutters-lr.js +54 -0
- package/dist/icons/ui-icons/columns.js +42 -0
- package/dist/icons/ui-icons/columns3366.js +30 -0
- package/dist/icons/ui-icons/columns6633.js +30 -0
- package/dist/icons/ui-icons/component-generic.js +27 -0
- package/dist/icons/ui-icons/component-options.js +36 -0
- package/dist/icons/ui-icons/condition-h.js +20 -0
- package/dist/icons/ui-icons/condition-v.js +20 -0
- package/dist/icons/ui-icons/conditional-visibility.js +26 -0
- package/dist/icons/ui-icons/container-height.js +68 -0
- package/dist/icons/ui-icons/container-spacing-h.js +41 -0
- package/dist/icons/ui-icons/container-spacing.js +41 -0
- package/dist/icons/ui-icons/container-width.js +68 -0
- package/dist/icons/ui-icons/content-bottom-left.js +31 -0
- package/dist/icons/ui-icons/content-bottom-right.js +31 -0
- package/dist/icons/ui-icons/content-center.js +31 -0
- package/dist/icons/ui-icons/content-top-left.js +31 -0
- package/dist/icons/ui-icons/content-top-right.js +31 -0
- package/dist/icons/ui-icons/contrast-alt.js +27 -0
- package/dist/icons/ui-icons/contrast.js +26 -0
- package/dist/icons/ui-icons/cookie-alt.js +124 -0
- package/dist/icons/ui-icons/cookie.js +76 -0
- package/dist/icons/ui-icons/copy.js +26 -0
- package/dist/icons/ui-icons/currency.js +48 -0
- package/dist/icons/ui-icons/current-page.js +42 -0
- package/dist/icons/ui-icons/cursor-disabled.js +35 -0
- package/dist/icons/ui-icons/cursor-move.js +20 -0
- package/dist/icons/ui-icons/dark-mode.js +20 -0
- package/dist/icons/ui-icons/data.js +33 -0
- package/dist/icons/ui-icons/date-time.js +67 -0
- package/dist/icons/ui-icons/defer.js +26 -0
- package/dist/icons/ui-icons/description-link.js +40 -0
- package/dist/icons/ui-icons/design.js +48 -0
- package/dist/icons/ui-icons/dice.js +59 -0
- package/dist/icons/ui-icons/divider-bottom.js +23 -0
- package/dist/icons/ui-icons/divider-side.js +53 -0
- package/dist/icons/ui-icons/divider-status.js +53 -0
- package/dist/icons/ui-icons/divider-top.js +23 -0
- package/dist/icons/ui-icons/divider.js +23 -0
- package/dist/icons/ui-icons/door-in.js +32 -0
- package/dist/icons/ui-icons/door-out.js +32 -0
- package/dist/icons/ui-icons/door.js +27 -0
- package/dist/icons/ui-icons/download.js +20 -0
- package/dist/icons/ui-icons/dropdown-caret-alt.js +17 -0
- package/dist/icons/ui-icons/dropdown-caret.js +20 -0
- package/dist/icons/ui-icons/dropdown-close.js +52 -0
- package/dist/icons/ui-icons/dropdown-open.js +38 -0
- package/dist/icons/ui-icons/dropdown.js +38 -0
- package/dist/icons/ui-icons/dummy-spacer.js +17 -0
- package/dist/icons/ui-icons/edit-options.js +32 -0
- package/dist/icons/ui-icons/edit.js +22 -0
- package/dist/icons/ui-icons/email-remove.js +42 -0
- package/dist/icons/ui-icons/email.js +28 -0
- package/dist/icons/ui-icons/embed.js +28 -0
- package/dist/icons/ui-icons/empty-circle.js +23 -0
- package/dist/icons/ui-icons/empty-rect.js +25 -0
- package/dist/icons/ui-icons/equal-columns.js +25 -0
- package/dist/icons/ui-icons/equal-rows.js +25 -0
- package/dist/icons/ui-icons/equals.js +20 -0
- package/dist/icons/ui-icons/error-circle-fill-transparent.js +23 -0
- package/dist/icons/ui-icons/error-circle-fill.js +17 -0
- package/dist/icons/ui-icons/error-circle.js +24 -0
- package/dist/icons/ui-icons/exclude-item-alt.js +38 -0
- package/dist/icons/ui-icons/exclude-item.js +42 -0
- package/dist/icons/ui-icons/exclude.js +29 -0
- package/dist/icons/ui-icons/expand-xl.js +20 -0
- package/dist/icons/ui-icons/expand.js +20 -0
- package/dist/icons/ui-icons/experiment.js +33 -0
- package/dist/icons/ui-icons/external-link.js +25 -0
- package/dist/icons/ui-icons/extract-alt.js +25 -0
- package/dist/icons/ui-icons/extract.js +25 -0
- package/dist/icons/ui-icons/eyedropper.js +36 -0
- package/dist/icons/ui-icons/fast-forward.js +26 -0
- package/dist/icons/ui-icons/fast-reverse.js +26 -0
- package/dist/icons/ui-icons/field-after-text.js +54 -0
- package/dist/icons/ui-icons/field-before-text.js +46 -0
- package/dist/icons/ui-icons/field-disabled.js +35 -0
- package/dist/icons/ui-icons/field-help.js +46 -0
- package/dist/icons/ui-icons/field-label.js +38 -0
- package/dist/icons/ui-icons/field-name.js +45 -0
- package/dist/icons/ui-icons/field-placeholder.js +49 -0
- package/dist/icons/ui-icons/field-readonly.js +36 -0
- package/dist/icons/ui-icons/field-required.js +37 -0
- package/dist/icons/ui-icons/field-type.js +36 -0
- package/dist/icons/ui-icons/field-value.js +46 -0
- package/dist/icons/ui-icons/field-width.js +27 -0
- package/dist/icons/ui-icons/file-download.js +33 -0
- package/dist/icons/ui-icons/file-error.js +25 -0
- package/dist/icons/ui-icons/file-metadata.js +41 -0
- package/dist/icons/ui-icons/file-pdf.js +34 -0
- package/dist/icons/ui-icons/file-size-max.js +33 -0
- package/dist/icons/ui-icons/file-size-min.js +33 -0
- package/dist/icons/ui-icons/file-size.js +34 -0
- package/dist/icons/ui-icons/file-type.js +42 -0
- package/dist/icons/ui-icons/file-upload.js +33 -0
- package/dist/icons/ui-icons/file.js +24 -0
- package/dist/icons/ui-icons/files.js +34 -0
- package/dist/icons/ui-icons/fill-color.js +49 -0
- package/dist/icons/ui-icons/filter-alt.js +24 -0
- package/dist/icons/ui-icons/filter.js +20 -0
- package/dist/icons/ui-icons/flag-alt.js +24 -0
- package/dist/icons/ui-icons/flag.js +24 -0
- package/dist/icons/ui-icons/flip-h.js +27 -0
- package/dist/icons/ui-icons/flip-v.js +27 -0
- package/dist/icons/ui-icons/focus.js +21 -0
- package/dist/icons/ui-icons/folder-add.js +22 -0
- package/dist/icons/ui-icons/folder-open-solid.js +17 -0
- package/dist/icons/ui-icons/folder-open.js +19 -0
- package/dist/icons/ui-icons/folder-solid.js +17 -0
- package/dist/icons/ui-icons/folder-top-level.js +22 -0
- package/dist/icons/ui-icons/folder.js +19 -0
- package/dist/icons/ui-icons/font-family.js +24 -0
- package/dist/icons/ui-icons/footer.js +23 -0
- package/dist/icons/ui-icons/form-alt.js +71 -0
- package/dist/icons/ui-icons/form.js +53 -0
- package/dist/icons/ui-icons/four-columns.js +38 -0
- package/dist/icons/ui-icons/frame.js +33 -0
- package/dist/icons/ui-icons/full-max-shield.js +26 -0
- package/dist/icons/ui-icons/full-max-text.js +20 -0
- package/dist/icons/ui-icons/full-width-image.js +35 -0
- package/dist/icons/ui-icons/gears-fill.js +19 -0
- package/dist/icons/ui-icons/gears.js +38 -0
- package/dist/icons/ui-icons/generic-color-swatch.js +6 -0
- package/dist/icons/ui-icons/generic-shapes-alt.js +33 -0
- package/dist/icons/ui-icons/generic-shapes.js +38 -0
- package/dist/icons/ui-icons/globe-anchor.js +55 -0
- package/dist/icons/ui-icons/globe-hash.js +40 -0
- package/dist/icons/ui-icons/globe.js +37 -0
- package/dist/icons/ui-icons/google-tag-manager.js +36 -0
- package/dist/icons/ui-icons/gradient-repeat.js +41 -0
- package/dist/icons/ui-icons/gradient-stop.js +36 -0
- package/dist/icons/ui-icons/gradient.js +54 -0
- package/dist/icons/ui-icons/grid-alt.js +19 -0
- package/dist/icons/ui-icons/grid-auto-cols.js +46 -0
- package/dist/icons/ui-icons/grid-auto-rows.js +41 -0
- package/dist/icons/ui-icons/grid-col.js +22 -0
- package/dist/icons/ui-icons/grid-height.js +22 -0
- package/dist/icons/ui-icons/grid-list-toggle.js +48 -0
- package/dist/icons/ui-icons/grid-manual.js +18 -0
- package/dist/icons/ui-icons/grid-row.js +22 -0
- package/dist/icons/ui-icons/grid-width.js +22 -0
- package/dist/icons/ui-icons/group.js +33 -0
- package/dist/icons/ui-icons/gutter.js +28 -0
- package/dist/icons/ui-icons/gyroscope.js +53 -0
- package/dist/icons/ui-icons/h1.js +28 -0
- package/dist/icons/ui-icons/h2.js +28 -0
- package/dist/icons/ui-icons/h3.js +28 -0
- package/dist/icons/ui-icons/h4.js +28 -0
- package/dist/icons/ui-icons/h5.js +28 -0
- package/dist/icons/ui-icons/h6.js +28 -0
- package/dist/icons/ui-icons/hamburger-menu.js +19 -0
- package/dist/icons/ui-icons/hard-drive.js +35 -0
- package/dist/icons/ui-icons/header.js +23 -0
- package/dist/icons/ui-icons/heading-level-alt.js +28 -0
- package/dist/icons/ui-icons/heading-level.js +28 -0
- package/dist/icons/ui-icons/heading.js +20 -0
- package/dist/icons/ui-icons/heart-fill-transparent.js +19 -0
- package/dist/icons/ui-icons/heart-fill.js +18 -0
- package/dist/icons/ui-icons/heart.js +18 -0
- package/dist/icons/ui-icons/height.js +30 -0
- package/dist/icons/ui-icons/help-fill.js +19 -0
- package/dist/icons/ui-icons/help.js +38 -0
- package/dist/icons/ui-icons/hide.js +29 -0
- package/dist/icons/ui-icons/highlighted-checkmark.js +24 -0
- package/dist/icons/ui-icons/highlighted-exclamation-mark.js +33 -0
- package/dist/icons/ui-icons/history.js +26 -0
- package/dist/icons/ui-icons/horizontal-align-alt.js +27 -0
- package/dist/icons/ui-icons/horizontal-align-around.js +37 -0
- package/dist/icons/ui-icons/horizontal-align-between-alt.js +37 -0
- package/dist/icons/ui-icons/horizontal-align-between.js +46 -0
- package/dist/icons/ui-icons/horizontal-align-center.js +41 -0
- package/dist/icons/ui-icons/horizontal-align-evenly.js +37 -0
- package/dist/icons/ui-icons/horizontal-align-left.js +44 -0
- package/dist/icons/ui-icons/horizontal-align-right.js +48 -0
- package/dist/icons/ui-icons/horizontal-align-stretch.js +37 -0
- package/dist/icons/ui-icons/horizontal-align.js +35 -0
- package/dist/icons/ui-icons/hover-background-glow.js +61 -0
- package/dist/icons/ui-icons/hover-background-type.js +34 -0
- package/dist/icons/ui-icons/hover-invert-object.js +42 -0
- package/dist/icons/ui-icons/hover-invert-text.js +32 -0
- package/dist/icons/ui-icons/hover-rotate.js +20 -0
- package/dist/icons/ui-icons/hover-zoom.js +25 -0
- package/dist/icons/ui-icons/hyphenate-alt.js +20 -0
- package/dist/icons/ui-icons/hyphenate-alt2.js +20 -0
- package/dist/icons/ui-icons/hyphenate.js +25 -0
- package/dist/icons/ui-icons/icon-generic.js +23 -0
- package/dist/icons/ui-icons/id-card.js +45 -0
- package/dist/icons/ui-icons/id.js +28 -0
- package/dist/icons/ui-icons/image-blur.js +50 -0
- package/dist/icons/ui-icons/image-caption.js +36 -0
- package/dist/icons/ui-icons/image-error.js +36 -0
- package/dist/icons/ui-icons/image-file.js +40 -0
- package/dist/icons/ui-icons/image-lazy-load.js +52 -0
- package/dist/icons/ui-icons/image-opacity.js +31 -0
- package/dist/icons/ui-icons/image-overlay-alt.js +93 -0
- package/dist/icons/ui-icons/image-overlay-alt2.js +93 -0
- package/dist/icons/ui-icons/image-overlay.js +92 -0
- package/dist/icons/ui-icons/image-remove.js +46 -0
- package/dist/icons/ui-icons/image.js +25 -0
- package/dist/icons/ui-icons/index.js +753 -0
- package/dist/icons/ui-icons/info-circle-fill-transparent.js +21 -0
- package/dist/icons/ui-icons/info-circle-fill.js +17 -0
- package/dist/icons/ui-icons/info-circle.js +24 -0
- package/dist/icons/ui-icons/info.js +17 -0
- package/dist/icons/ui-icons/inherit.js +41 -0
- package/dist/icons/ui-icons/inline-gradient-format.js +62 -0
- package/dist/icons/ui-icons/input-field.js +27 -0
- package/dist/icons/ui-icons/italic.js +20 -0
- package/dist/icons/ui-icons/item-limit.js +35 -0
- package/dist/icons/ui-icons/item-select.js +33 -0
- package/dist/icons/ui-icons/item-wrap.js +60 -0
- package/dist/icons/ui-icons/items-per-page.js +48 -0
- package/dist/icons/ui-icons/items-per-row.js +45 -0
- package/dist/icons/ui-icons/key.js +25 -0
- package/dist/icons/ui-icons/keyboard.js +19 -0
- package/dist/icons/ui-icons/large.js +24 -0
- package/dist/icons/ui-icons/latest-posts.js +44 -0
- package/dist/icons/ui-icons/layer-off.js +20 -0
- package/dist/icons/ui-icons/layer.js +19 -0
- package/dist/icons/ui-icons/layers.js +33 -0
- package/dist/icons/ui-icons/layout-alt.js +19 -0
- package/dist/icons/ui-icons/layout-alt2.js +23 -0
- package/dist/icons/ui-icons/layout-alt3.js +19 -0
- package/dist/icons/ui-icons/layout-alt4.js +19 -0
- package/dist/icons/ui-icons/layout-bento-box.js +19 -0
- package/dist/icons/ui-icons/layout-masonry.js +79 -0
- package/dist/icons/ui-icons/layout.js +43 -0
- package/dist/icons/ui-icons/left-panel-alt.js +25 -0
- package/dist/icons/ui-icons/left-panel.js +22 -0
- package/dist/icons/ui-icons/light-bulb-alt.js +30 -0
- package/dist/icons/ui-icons/light-bulb.js +33 -0
- package/dist/icons/ui-icons/light-mode.js +26 -0
- package/dist/icons/ui-icons/limit-width.js +26 -0
- package/dist/icons/ui-icons/line-break-alt-off.js +26 -0
- package/dist/icons/ui-icons/line-break-alt.js +25 -0
- package/dist/icons/ui-icons/line-break-off-alt.js +35 -0
- package/dist/icons/ui-icons/line-break-off.js +41 -0
- package/dist/icons/ui-icons/line-break.js +29 -0
- package/dist/icons/ui-icons/line-breaks-hyphenation.js +36 -0
- package/dist/icons/ui-icons/link-add.js +41 -0
- package/dist/icons/ui-icons/link-nav.js +59 -0
- package/dist/icons/ui-icons/link-remove.js +41 -0
- package/dist/icons/ui-icons/link.js +19 -0
- package/dist/icons/ui-icons/list-indent.js +26 -0
- package/dist/icons/ui-icons/list-ordered.js +43 -0
- package/dist/icons/ui-icons/list-outdent.js +26 -0
- package/dist/icons/ui-icons/list-unordered.js +43 -0
- package/dist/icons/ui-icons/loader-alt.js +19 -0
- package/dist/icons/ui-icons/loader.js +19 -0
- package/dist/icons/ui-icons/location-add.js +44 -0
- package/dist/icons/ui-icons/location-allow.js +44 -0
- package/dist/icons/ui-icons/location-deny.js +44 -0
- package/dist/icons/ui-icons/location-settings.js +36 -0
- package/dist/icons/ui-icons/location.js +26 -0
- package/dist/icons/ui-icons/lock.js +44 -0
- package/dist/icons/ui-icons/loop-mode.js +20 -0
- package/dist/icons/ui-icons/magic-alt-fill-transparent.js +20 -0
- package/dist/icons/ui-icons/magic-alt-fill.js +19 -0
- package/dist/icons/ui-icons/magic-alt.js +19 -0
- package/dist/icons/ui-icons/magic-fill-transparent.js +20 -0
- package/dist/icons/ui-icons/magic-fill.js +19 -0
- package/dist/icons/ui-icons/magic.js +19 -0
- package/dist/icons/ui-icons/map-layer-json.js +35 -0
- package/dist/icons/ui-icons/map-layer-raster.js +121 -0
- package/dist/icons/ui-icons/map-layer-vector.js +81 -0
- package/dist/icons/ui-icons/map-layer.js +26 -0
- package/dist/icons/ui-icons/map-pin.js +41 -0
- package/dist/icons/ui-icons/matrix-align-control-dot-active.js +23 -0
- package/dist/icons/ui-icons/matrix-align-control-dot-inactive.js +21 -0
- package/dist/icons/ui-icons/media.js +49 -0
- package/dist/icons/ui-icons/medium.js +24 -0
- package/dist/icons/ui-icons/menu-item-check.js +20 -0
- package/dist/icons/ui-icons/menu-item-circle.js +19 -0
- package/dist/icons/ui-icons/microphone.js +23 -0
- package/dist/icons/ui-icons/migration-alt-v.js +20 -0
- package/dist/icons/ui-icons/migration-alt.js +20 -0
- package/dist/icons/ui-icons/migration.js +26 -0
- package/dist/icons/ui-icons/module.js +24 -0
- package/dist/icons/ui-icons/money-paper.js +58 -0
- package/dist/icons/ui-icons/more-h-circle.js +40 -0
- package/dist/icons/ui-icons/more-h.js +33 -0
- package/dist/icons/ui-icons/more-v-circle.js +44 -0
- package/dist/icons/ui-icons/more-v.js +36 -0
- package/dist/icons/ui-icons/mouse-cursor.js +20 -0
- package/dist/icons/ui-icons/mouse-wheel.js +27 -0
- package/dist/icons/ui-icons/multi-item-left-inset-mobile.js +58 -0
- package/dist/icons/ui-icons/multi-item-left-inset.js +39 -0
- package/dist/icons/ui-icons/multi-item-right-inset-mobile.js +55 -0
- package/dist/icons/ui-icons/multi-item-right-inset.js +36 -0
- package/dist/icons/ui-icons/multiple.js +34 -0
- package/dist/icons/ui-icons/music-note.js +40 -0
- package/dist/icons/ui-icons/mute-centered.js +20 -0
- package/dist/icons/ui-icons/mute.js +20 -0
- package/dist/icons/ui-icons/narrow-bottom.js +49 -0
- package/dist/icons/ui-icons/narrow-left.js +49 -0
- package/dist/icons/ui-icons/narrow-right.js +49 -0
- package/dist/icons/ui-icons/narrow-top.js +49 -0
- package/dist/icons/ui-icons/navigation-buttons.js +39 -0
- package/dist/icons/ui-icons/new-tab.js +27 -0
- package/dist/icons/ui-icons/newspaper.js +45 -0
- package/dist/icons/ui-icons/none.js +25 -0
- package/dist/icons/ui-icons/notebook.js +44 -0
- package/dist/icons/ui-icons/num0-circle-alt.js +24 -0
- package/dist/icons/ui-icons/num0-circle.js +24 -0
- package/dist/icons/ui-icons/num0-square-alt.js +26 -0
- package/dist/icons/ui-icons/num0-square.js +26 -0
- package/dist/icons/ui-icons/num1-circle-alt.js +26 -0
- package/dist/icons/ui-icons/num1-circle.js +26 -0
- package/dist/icons/ui-icons/num1-square-alt.js +28 -0
- package/dist/icons/ui-icons/num1-square.js +28 -0
- package/dist/icons/ui-icons/num2-circle-alt.js +26 -0
- package/dist/icons/ui-icons/num2-circle.js +26 -0
- package/dist/icons/ui-icons/num2-square-alt.js +28 -0
- package/dist/icons/ui-icons/num2-square.js +28 -0
- package/dist/icons/ui-icons/num3-circle-alt.js +26 -0
- package/dist/icons/ui-icons/num3-circle.js +26 -0
- package/dist/icons/ui-icons/num3-square-alt.js +28 -0
- package/dist/icons/ui-icons/num3-square.js +28 -0
- package/dist/icons/ui-icons/num4-circle-alt.js +26 -0
- package/dist/icons/ui-icons/num4-circle.js +26 -0
- package/dist/icons/ui-icons/num4-square-alt.js +28 -0
- package/dist/icons/ui-icons/num4-square.js +28 -0
- package/dist/icons/ui-icons/num5-circle-alt.js +26 -0
- package/dist/icons/ui-icons/num5-circle.js +26 -0
- package/dist/icons/ui-icons/num5-square-alt.js +28 -0
- package/dist/icons/ui-icons/num5-square.js +28 -0
- package/dist/icons/ui-icons/num6-circle-alt.js +26 -0
- package/dist/icons/ui-icons/num6-circle.js +26 -0
- package/dist/icons/ui-icons/num6-square-alt.js +28 -0
- package/dist/icons/ui-icons/num6-square.js +28 -0
- package/dist/icons/ui-icons/num7-circle-alt.js +26 -0
- package/dist/icons/ui-icons/num7-circle.js +26 -0
- package/dist/icons/ui-icons/num7-square-alt.js +28 -0
- package/dist/icons/ui-icons/num7-square.js +28 -0
- package/dist/icons/ui-icons/num8-circle-alt.js +24 -0
- package/dist/icons/ui-icons/num8-circle.js +24 -0
- package/dist/icons/ui-icons/num8-square-alt.js +26 -0
- package/dist/icons/ui-icons/num8-square.js +26 -0
- package/dist/icons/ui-icons/num9-circle-alt.js +26 -0
- package/dist/icons/ui-icons/num9-circle.js +26 -0
- package/dist/icons/ui-icons/num9-square-alt.js +28 -0
- package/dist/icons/ui-icons/num9-square.js +28 -0
- package/dist/icons/ui-icons/office-building.js +203 -0
- package/dist/icons/ui-icons/office-buildings.js +256 -0
- package/dist/icons/ui-icons/offset-auto.js +46 -0
- package/dist/icons/ui-icons/offset.js +39 -0
- package/dist/icons/ui-icons/option-list-alt.js +61 -0
- package/dist/icons/ui-icons/option-list.js +63 -0
- package/dist/icons/ui-icons/options.js +24 -0
- package/dist/icons/ui-icons/order.js +49 -0
- package/dist/icons/ui-icons/padding-bottom.js +35 -0
- package/dist/icons/ui-icons/padding-top.js +35 -0
- package/dist/icons/ui-icons/padding.js +34 -0
- package/dist/icons/ui-icons/pagination.js +49 -0
- package/dist/icons/ui-icons/palette-color.js +111 -0
- package/dist/icons/ui-icons/panel-collapse.js +41 -0
- package/dist/icons/ui-icons/panel-expand.js +41 -0
- package/dist/icons/ui-icons/paragraph.js +24 -0
- package/dist/icons/ui-icons/paste.js +52 -0
- package/dist/icons/ui-icons/pause.js +20 -0
- package/dist/icons/ui-icons/people-group.js +57 -0
- package/dist/icons/ui-icons/people.js +43 -0
- package/dist/icons/ui-icons/person.js +26 -0
- package/dist/icons/ui-icons/photo-camera.js +26 -0
- package/dist/icons/ui-icons/picture-in-picture.js +33 -0
- package/dist/icons/ui-icons/play-reverse.js +20 -0
- package/dist/icons/ui-icons/play.js +20 -0
- package/dist/icons/ui-icons/playback-options.js +24 -0
- package/dist/icons/ui-icons/plus-circle-fill-alt.js +23 -0
- package/dist/icons/ui-icons/plus-circle-fill.js +17 -0
- package/dist/icons/ui-icons/plus-circle.js +26 -0
- package/dist/icons/ui-icons/plus-minus-buttons-h.js +25 -0
- package/dist/icons/ui-icons/plus-minus-buttons-v.js +25 -0
- package/dist/icons/ui-icons/plus-square-fill-transparent.js +27 -0
- package/dist/icons/ui-icons/plus-square-fill.js +17 -0
- package/dist/icons/ui-icons/plus-square.js +27 -0
- package/dist/icons/ui-icons/pointer-hand-disabled.js +34 -0
- package/dist/icons/ui-icons/pointer-hand.js +20 -0
- package/dist/icons/ui-icons/position-arrows-h.js +26 -0
- package/dist/icons/ui-icons/position-arrows-inverted-h.js +26 -0
- package/dist/icons/ui-icons/position-arrows-inverted-v.js +26 -0
- package/dist/icons/ui-icons/position-arrows-inverted.js +26 -0
- package/dist/icons/ui-icons/position-arrows-v.js +26 -0
- package/dist/icons/ui-icons/position-arrows.js +26 -0
- package/dist/icons/ui-icons/position-h-center.js +43 -0
- package/dist/icons/ui-icons/position-h-end.js +43 -0
- package/dist/icons/ui-icons/position-h-start.js +43 -0
- package/dist/icons/ui-icons/position-left.js +31 -0
- package/dist/icons/ui-icons/position-right.js +31 -0
- package/dist/icons/ui-icons/position-v-center.js +43 -0
- package/dist/icons/ui-icons/position-v-end.js +43 -0
- package/dist/icons/ui-icons/position-v-start.js +43 -0
- package/dist/icons/ui-icons/position2x2-bottom-left.js +52 -0
- package/dist/icons/ui-icons/position2x2-bottom-right.js +52 -0
- package/dist/icons/ui-icons/position2x2-empty.js +51 -0
- package/dist/icons/ui-icons/position2x2-top-left.js +52 -0
- package/dist/icons/ui-icons/position2x2-top-right.js +52 -0
- package/dist/icons/ui-icons/position3x3-bottom-center.js +97 -0
- package/dist/icons/ui-icons/position3x3-bottom-left.js +97 -0
- package/dist/icons/ui-icons/position3x3-bottom-right.js +97 -0
- package/dist/icons/ui-icons/position3x3-center-center.js +97 -0
- package/dist/icons/ui-icons/position3x3-center-left.js +97 -0
- package/dist/icons/ui-icons/position3x3-center-right.js +97 -0
- package/dist/icons/ui-icons/position3x3-empty.js +96 -0
- package/dist/icons/ui-icons/position3x3-top-center.js +97 -0
- package/dist/icons/ui-icons/position3x3-top-left.js +97 -0
- package/dist/icons/ui-icons/position3x3-top-right.js +97 -0
- package/dist/icons/ui-icons/positioning-guide-alt.js +30 -0
- package/dist/icons/ui-icons/positioning-guide.js +30 -0
- package/dist/icons/ui-icons/positioning-width-guide.js +40 -0
- package/dist/icons/ui-icons/preload.js +44 -0
- package/dist/icons/ui-icons/preview-responsive.js +48 -0
- package/dist/icons/ui-icons/preview.js +35 -0
- package/dist/icons/ui-icons/progressbar-intermittent.js +26 -0
- package/dist/icons/ui-icons/progressbar.js +30 -0
- package/dist/icons/ui-icons/range-max.js +48 -0
- package/dist/icons/ui-icons/range-mid.js +40 -0
- package/dist/icons/ui-icons/range-min.js +48 -0
- package/dist/icons/ui-icons/range.js +61 -0
- package/dist/icons/ui-icons/read-only.js +25 -0
- package/dist/icons/ui-icons/reduce-height-bottom.js +49 -0
- package/dist/icons/ui-icons/reduce-height-top.js +49 -0
- package/dist/icons/ui-icons/regex.js +39 -0
- package/dist/icons/ui-icons/remove.js +20 -0
- package/dist/icons/ui-icons/rename.js +24 -0
- package/dist/icons/ui-icons/reorder-grabber-h.js +51 -0
- package/dist/icons/ui-icons/reorder-grabber-v.js +57 -0
- package/dist/icons/ui-icons/reorder.js +35 -0
- package/dist/icons/ui-icons/required-alt.js +20 -0
- package/dist/icons/ui-icons/required.js +19 -0
- package/dist/icons/ui-icons/reset-to-zero.js +33 -0
- package/dist/icons/ui-icons/reset.js +25 -0
- package/dist/icons/ui-icons/responsive-overrides-alt-fill.js +26 -0
- package/dist/icons/ui-icons/responsive-overrides-alt.js +49 -0
- package/dist/icons/ui-icons/responsive-overrides-alt2-fill.js +34 -0
- package/dist/icons/ui-icons/responsive-overrides-alt2.js +45 -0
- package/dist/icons/ui-icons/responsive-overrides-alt3-fill.js +33 -0
- package/dist/icons/ui-icons/responsive-overrides.js +39 -0
- package/dist/icons/ui-icons/responsive.js +33 -0
- package/dist/icons/ui-icons/right-panel-alt.js +23 -0
- package/dist/icons/ui-icons/right-panel.js +22 -0
- package/dist/icons/ui-icons/rotate-left.js +20 -0
- package/dist/icons/ui-icons/rotate-right.js +20 -0
- package/dist/icons/ui-icons/rounded-corners.js +19 -0
- package/dist/icons/ui-icons/route.js +27 -0
- package/dist/icons/ui-icons/row-add.js +45 -0
- package/dist/icons/ui-icons/row-empty.js +51 -0
- package/dist/icons/ui-icons/row.js +45 -0
- package/dist/icons/ui-icons/rows.js +42 -0
- package/dist/icons/ui-icons/ruler.js +28 -0
- package/dist/icons/ui-icons/save.js +26 -0
- package/dist/icons/ui-icons/screen-desktop.js +32 -0
- package/dist/icons/ui-icons/screen-large.js +23 -0
- package/dist/icons/ui-icons/screen-mobile.js +39 -0
- package/dist/icons/ui-icons/screen-tablet-large.js +36 -0
- package/dist/icons/ui-icons/screen-tablet.js +36 -0
- package/dist/icons/ui-icons/scrollbar-h.js +40 -0
- package/dist/icons/ui-icons/scrollbar-v.js +41 -0
- package/dist/icons/ui-icons/scrollbars.js +55 -0
- package/dist/icons/ui-icons/search-empty.js +37 -0
- package/dist/icons/ui-icons/search.js +25 -0
- package/dist/icons/ui-icons/separator-h.js +41 -0
- package/dist/icons/ui-icons/separator-v.js +39 -0
- package/dist/icons/ui-icons/shadow.js +61 -0
- package/dist/icons/ui-icons/share.js +26 -0
- package/dist/icons/ui-icons/shield-plus-alt.js +27 -0
- package/dist/icons/ui-icons/shield-plus.js +20 -0
- package/dist/icons/ui-icons/shield.js +20 -0
- package/dist/icons/ui-icons/shrink-diagonal-left-xl.js +20 -0
- package/dist/icons/ui-icons/shrink-diagonal-left.js +20 -0
- package/dist/icons/ui-icons/shrink-diagonal-right-xl.js +20 -0
- package/dist/icons/ui-icons/shrink-diagonal-right.js +20 -0
- package/dist/icons/ui-icons/shrink-xl.js +20 -0
- package/dist/icons/ui-icons/shrink.js +20 -0
- package/dist/icons/ui-icons/shuffle.js +20 -0
- package/dist/icons/ui-icons/sidebar-flip.js +22 -0
- package/dist/icons/ui-icons/sidebar.js +22 -0
- package/dist/icons/ui-icons/single-item-left-inset-mobile.js +48 -0
- package/dist/icons/ui-icons/single-item-left-inset.js +23 -0
- package/dist/icons/ui-icons/single-item-right-inset-mobile.js +50 -0
- package/dist/icons/ui-icons/single-item-right-inset.js +23 -0
- package/dist/icons/ui-icons/size-alt.js +33 -0
- package/dist/icons/ui-icons/size.js +29 -0
- package/dist/icons/ui-icons/slider.js +31 -0
- package/dist/icons/ui-icons/sliders.js +68 -0
- package/dist/icons/ui-icons/small.js +24 -0
- package/dist/icons/ui-icons/solid-circle-fill-transparent.js +22 -0
- package/dist/icons/ui-icons/solid-circle-filled.js +21 -0
- package/dist/icons/ui-icons/solid-circle-gradient.js +31 -0
- package/dist/icons/ui-icons/solid-circle.js +21 -0
- package/dist/icons/ui-icons/solid-color.js +19 -0
- package/dist/icons/ui-icons/solid-rect-fill-transparent.js +24 -0
- package/dist/icons/ui-icons/solid-rect-filled.js +23 -0
- package/dist/icons/ui-icons/solid-rect-gradient.js +33 -0
- package/dist/icons/ui-icons/solid-rect.js +23 -0
- package/dist/icons/ui-icons/sort-asc.js +20 -0
- package/dist/icons/ui-icons/sort-desc.js +20 -0
- package/dist/icons/ui-icons/sort-generic.js +25 -0
- package/dist/icons/ui-icons/spacing-bottom-in.js +23 -0
- package/dist/icons/ui-icons/spacing-bottom.js +23 -0
- package/dist/icons/ui-icons/spacing-left-in.js +23 -0
- package/dist/icons/ui-icons/spacing-left.js +23 -0
- package/dist/icons/ui-icons/spacing-right-in.js +23 -0
- package/dist/icons/ui-icons/spacing-right.js +23 -0
- package/dist/icons/ui-icons/spacing-top-in.js +23 -0
- package/dist/icons/ui-icons/spacing-top.js +23 -0
- package/dist/icons/ui-icons/speed.js +25 -0
- package/dist/icons/ui-icons/stagger.js +53 -0
- package/dist/icons/ui-icons/star.js +18 -0
- package/dist/icons/ui-icons/step.js +27 -0
- package/dist/icons/ui-icons/stop.js +20 -0
- package/dist/icons/ui-icons/swap.js +41 -0
- package/dist/icons/ui-icons/tag-alt.js +24 -0
- package/dist/icons/ui-icons/tag.js +26 -0
- package/dist/icons/ui-icons/text-abc.js +40 -0
- package/dist/icons/ui-icons/text-above.js +25 -0
- package/dist/icons/ui-icons/text-align-center.js +20 -0
- package/dist/icons/ui-icons/text-align-generic.js +20 -0
- package/dist/icons/ui-icons/text-align-justify.js +20 -0
- package/dist/icons/ui-icons/text-align-left.js +20 -0
- package/dist/icons/ui-icons/text-align-right.js +20 -0
- package/dist/icons/ui-icons/text-below.js +25 -0
- package/dist/icons/ui-icons/text-box-edit.js +35 -0
- package/dist/icons/ui-icons/text-color-swatch.js +40 -0
- package/dist/icons/ui-icons/text-highlight-color-swatch-alt.js +49 -0
- package/dist/icons/ui-icons/text-highlight-color-swatch.js +48 -0
- package/dist/icons/ui-icons/text-larger.js +23 -0
- package/dist/icons/ui-icons/text-length.js +20 -0
- package/dist/icons/ui-icons/text-size-alt.js +23 -0
- package/dist/icons/ui-icons/text-size.js +20 -0
- package/dist/icons/ui-icons/text-smaller.js +23 -0
- package/dist/icons/ui-icons/text-strikethrough.js +26 -0
- package/dist/icons/ui-icons/text-uppercase.js +25 -0
- package/dist/icons/ui-icons/text-write.js +39 -0
- package/dist/icons/ui-icons/thumbs-down.js +22 -0
- package/dist/icons/ui-icons/thumbs-up.js +22 -0
- package/dist/icons/ui-icons/title-generic.js +25 -0
- package/dist/icons/ui-icons/toggle-off.js +33 -0
- package/dist/icons/ui-icons/toggle-on-alt.js +19 -0
- package/dist/icons/ui-icons/toggle-on.js +31 -0
- package/dist/icons/ui-icons/tools.js +25 -0
- package/dist/icons/ui-icons/total-items.js +45 -0
- package/dist/icons/ui-icons/trash-alt.js +44 -0
- package/dist/icons/ui-icons/trash.js +33 -0
- package/dist/icons/ui-icons/tree-alt.js +62 -0
- package/dist/icons/ui-icons/tree-alt2.js +79 -0
- package/dist/icons/ui-icons/tree.js +70 -0
- package/dist/icons/ui-icons/troubleshoot-alt.js +39 -0
- package/dist/icons/ui-icons/two-cards-left.js +32 -0
- package/dist/icons/ui-icons/two-cards-right.js +32 -0
- package/dist/icons/ui-icons/two-columns.js +30 -0
- package/dist/icons/ui-icons/typography-options.js +77 -0
- package/dist/icons/ui-icons/typography.js +71 -0
- package/dist/icons/ui-icons/underline.js +19 -0
- package/dist/icons/ui-icons/ungroup.js +39 -0
- package/dist/icons/ui-icons/upload.js +20 -0
- package/dist/icons/ui-icons/venn-diagram-alt.js +34 -0
- package/dist/icons/ui-icons/venn-diagram-alt2.js +34 -0
- package/dist/icons/ui-icons/venn-diagram-alt3.js +34 -0
- package/dist/icons/ui-icons/venn-diagram-alt4.js +34 -0
- package/dist/icons/ui-icons/venn-diagram-alt5.js +34 -0
- package/dist/icons/ui-icons/venn-diagram-alt6.js +34 -0
- package/dist/icons/ui-icons/venn-diagram-alt7.js +39 -0
- package/dist/icons/ui-icons/venn-diagram.js +26 -0
- package/dist/icons/ui-icons/vertical-align-alt.js +27 -0
- package/dist/icons/ui-icons/vertical-align-around.js +39 -0
- package/dist/icons/ui-icons/vertical-align-between-alt.js +39 -0
- package/dist/icons/ui-icons/vertical-align-between.js +48 -0
- package/dist/icons/ui-icons/vertical-align-bottom.js +44 -0
- package/dist/icons/ui-icons/vertical-align-center.js +39 -0
- package/dist/icons/ui-icons/vertical-align-evenly.js +39 -0
- package/dist/icons/ui-icons/vertical-align-stretch.js +39 -0
- package/dist/icons/ui-icons/vertical-align-top.js +46 -0
- package/dist/icons/ui-icons/vertical-align.js +35 -0
- package/dist/icons/ui-icons/vertical-spacing.js +28 -0
- package/dist/icons/ui-icons/video-chapters.js +25 -0
- package/dist/icons/ui-icons/video-controls.js +67 -0
- package/dist/icons/ui-icons/video-file.js +40 -0
- package/dist/icons/ui-icons/video-poster-image.js +40 -0
- package/dist/icons/ui-icons/video-subtitle-alt.js +39 -0
- package/dist/icons/ui-icons/video-subtitle.js +27 -0
- package/dist/icons/ui-icons/video.js +36 -0
- package/dist/icons/ui-icons/visibility-alt.js +40 -0
- package/dist/icons/ui-icons/visibility-alt2.js +41 -0
- package/dist/icons/ui-icons/visibility.js +45 -0
- package/dist/icons/ui-icons/visible.js +28 -0
- package/dist/icons/ui-icons/volume.js +25 -0
- package/dist/icons/ui-icons/warning-circle-fill-transparent.js +30 -0
- package/dist/icons/ui-icons/warning-circle-fill.js +17 -0
- package/dist/icons/ui-icons/warning-circle.js +33 -0
- package/dist/icons/ui-icons/warning-fill-transparent.js +30 -0
- package/dist/icons/ui-icons/warning-fill.js +17 -0
- package/dist/icons/ui-icons/warning.js +30 -0
- package/dist/icons/ui-icons/web-video.js +63 -0
- package/dist/icons/ui-icons/wide-bottom.js +49 -0
- package/dist/icons/ui-icons/wide-left.js +49 -0
- package/dist/icons/ui-icons/wide-right.js +49 -0
- package/dist/icons/ui-icons/wide-top.js +49 -0
- package/dist/icons/ui-icons/width.js +29 -0
- package/dist/icons/ui-icons/wordpress.js +17 -0
- package/dist/icons/ui-icons/wrapper-alt.js +71 -0
- package/dist/icons/ui-icons/wrapper-config.js +41 -0
- package/dist/icons/ui-icons/wrapper-off-alt.js +19 -0
- package/dist/icons/ui-icons/wrapper-overflow.js +31 -0
- package/dist/icons/ui-icons/wrapper-simple-alt.js +58 -0
- package/dist/icons/ui-icons/wrapper-simple.js +32 -0
- package/dist/icons/ui-icons/wrapper.js +42 -0
- package/dist/icons/ui-icons/wrench.js +19 -0
- package/dist/icons/ui-icons/zap-fill.js +20 -0
- package/dist/icons/ui-icons/zap.js +19 -0
- package/dist/index.js +32 -108
- package/dist/input-field-UCZL5bqv.js +290 -0
- package/dist/jsx-svg-OBADs_Qs.js +11123 -0
- package/dist/link-input-D7iDRpOM.js +1821 -0
- package/dist/modal-DbVLYMkH.js +318 -0
- package/dist/number-ZZIxJukn.js +40 -0
- package/dist/number-picker-CkA1iJNZ.js +268 -0
- package/dist/proxy-BG7-_Ou3.js +9638 -0
- package/dist/shared-DFDimxvX.js +1038 -0
- package/dist/smart-image-CbSsEASF.js +284 -0
- package/dist/solid-color-picker-DbT-aoVx.js +1415 -0
- package/dist/style-admin.js +1 -1
- package/dist/style-editor.js +1 -1
- package/dist/style.js +1 -1
- package/dist/switch-L8dFSQWQ.js +274 -0
- package/dist/tabs-BrdyBER5.js +975 -0
- package/dist/textSelection-Dv6WPj0Z.js +45 -0
- package/dist/toggle-button-DJ8jNQ-9.js +424 -0
- package/dist/tooltip-BzJzYlcc.js +440 -0
- package/dist/useAsyncList-BNzwKoX4.js +412 -0
- package/dist/useButton-ra1ZSZ4z.js +57 -0
- package/dist/useEvent-DkZVfgsS.js +22 -0
- package/dist/useField-D0WrzR2F.js +32 -0
- package/dist/useFilter-OiMnf6sb.js +44 -0
- package/dist/useFocusRing-DuYL4cdO.js +98 -0
- package/dist/useFormReset-DdkykzAn.js +18 -0
- package/dist/useHover-qaMm3XFO.js +982 -0
- package/dist/useLabel-2EohW5l6.js +27 -0
- package/dist/useLabels-B2p7RXi5.js +16 -0
- package/dist/useListState-CD_5vfyy.js +147 -0
- package/dist/useLocalizedStringFormatter-Dv2diN3k.js +108 -0
- package/dist/useNumberField-2xbi3jRV.js +1318 -0
- package/dist/useNumberFormatter-C2Cm2mNj.js +10 -0
- package/dist/usePress-ZP1TjkFf.js +678 -0
- package/dist/useToggle-ecIirvIM.js +64 -0
- package/dist/useToggleState-IIDbiKPl.js +23 -0
- package/dist/utilities/array-helpers.js +38 -49
- package/dist/utilities/debounce-throttle.js +2 -123
- package/dist/utilities/es-dash.js +2 -400
- package/dist/utilities/general.js +2 -10
- package/dist/utilities/hash.js +31 -35
- package/dist/utilities/index.js +6 -41
- package/dist/utilities/text-helpers.js +96 -129
- package/dist/utilities/web-workers.js +61 -44
- package/dist/utilities-CPFDXC3B.js +7 -0
- package/dist/utils-B_uiqNa4.js +372 -0
- package/dist/workers/image-analysis.worker.js +56 -48
- package/package.json +30 -18
- package/dist/Button-DtRmB6b8.js +0 -243
- package/dist/Dialog-DTIxSDhz.js +0 -2790
- package/dist/FieldError-BPG0hKfB.js +0 -42
- package/dist/FocusScope-CjFQ7cbd.js +0 -832
- package/dist/Form-Cq3fu75_.js +0 -5
- package/dist/Heading-CY-_gt-U.js +0 -16
- package/dist/Hidden-DOH36apC.js +0 -58
- package/dist/Input-BG9DaxYN.js +0 -169
- package/dist/Label-_aSf9-8u.js +0 -18
- package/dist/List-CQFXnN4w.js +0 -590
- package/dist/ListBox-DXFyyj_r.js +0 -695
- package/dist/NumberFormatter-DA8u1Ot7.js +0 -140
- package/dist/OverlayArrow-Fuxj-1QM.js +0 -614
- package/dist/PortalProvider-BQ1X8vGX.js +0 -19
- package/dist/RSPContexts-CJ-HBf0L.js +0 -18
- package/dist/RadioGroup-DCeiLxLK.js +0 -371
- package/dist/SearchField-B_yKFXRk.js +0 -817
- package/dist/SelectionIndicator-D7WMzeAW.js +0 -7
- package/dist/SelectionManager-B02LcxLr.js +0 -2505
- package/dist/SharedElementTransition-CtoWSaF0.js +0 -12
- package/dist/Slider-bR3fAmim.js +0 -897
- package/dist/Text-CjFEHSfr.js +0 -17
- package/dist/VisuallyHidden-DZnWrkn8.js +0 -48
- package/dist/animation-Dfl8uEb3.js +0 -67
- package/dist/clsx-DgYk2OaC.js +0 -16
- package/dist/color-swatch-bUFkK7ox.js +0 -2570
- package/dist/components/smart-image/image-analysis-worker-next.js +0 -144
- package/dist/components/smart-image/smart-image-next.js +0 -294
- package/dist/context-iUFQCK8m.js +0 -95
- package/dist/default-i18n-CnQeC5Pl.js +0 -731
- package/dist/filterDOMProps-eGTqWSTd.js +0 -71
- package/dist/general-BfKmjm56.js +0 -4378
- package/dist/index-BHpUy2Ix.js +0 -44
- package/dist/index-BL5gdWX4.js +0 -28323
- package/dist/number-7sOvrqo0.js +0 -41
- package/dist/proxy-CNEXmkdK.js +0 -7948
- package/dist/react-jsx-parser.min-DAh4myol.js +0 -11736
- package/dist/shared-CNH8QfV9.js +0 -1111
- package/dist/sprintf-DmNrJSYG.js +0 -51
- package/dist/textSelection-DA3VcKpG.js +0 -46
- package/dist/useAsyncList-DsZvQXls.js +0 -453
- package/dist/useButton-DyMX0EVr.js +0 -59
- package/dist/useEvent-Bfy68GHZ.js +0 -22
- package/dist/useFilter-Bg5C34XC.js +0 -50
- package/dist/useFocusRing-B2glEZ25.js +0 -114
- package/dist/useFormReset-BoxsKyJ9.js +0 -20
- package/dist/useFormValidation-BrbMhS2N.js +0 -232
- package/dist/useHover-DkmPQdGE.js +0 -1047
- package/dist/useLabel-DzXzKZZZ.js +0 -27
- package/dist/useLabels-D8O3gOdV.js +0 -23
- package/dist/useListState-BjnzKozj.js +0 -171
- package/dist/useLocalizedStringFormatter-CEDs0LsA.js +0 -121
- package/dist/useNumberField-CsygZKz9.js +0 -1330
- package/dist/useNumberFormatter-CG_IQXp9.js +0 -13
- package/dist/usePress-Ck5xMtDr.js +0 -701
- package/dist/useToggle-Ddc7N8pR.js +0 -72
- package/dist/useToggleState-H_lORSWO.js +0 -23
- package/dist/utils-Cr3pLd9c.js +0 -420
|
@@ -0,0 +1,4277 @@
|
|
|
1
|
+
import { cyrb64Hash } from "./utilities/hash.js";
|
|
2
|
+
//#region node_modules/@thi.ng/pixel/api.js
|
|
3
|
+
var Lane = ((Lane2) => {
|
|
4
|
+
Lane2[Lane2["ALPHA"] = 0] = "ALPHA";
|
|
5
|
+
Lane2[Lane2["BLUE"] = 1] = "BLUE";
|
|
6
|
+
Lane2[Lane2["GREEN"] = 2] = "GREEN";
|
|
7
|
+
Lane2[Lane2["RED"] = 3] = "RED";
|
|
8
|
+
return Lane2;
|
|
9
|
+
})(Lane || {});
|
|
10
|
+
var ROT_IDS = [
|
|
11
|
+
"rotateCW",
|
|
12
|
+
"rotate180",
|
|
13
|
+
"rotateCCW"
|
|
14
|
+
];
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region node_modules/@thi.ng/canvas/index.js
|
|
17
|
+
var adaptiveCanvas2d = (width, height = width, parent, opts = {}) => {
|
|
18
|
+
const canvas = document.createElement("canvas");
|
|
19
|
+
adaptDPI(canvas, width, height, opts.dpr);
|
|
20
|
+
opts.pixelated && (canvas.style.imageRendering = "pixelated");
|
|
21
|
+
parent?.appendChild(canvas);
|
|
22
|
+
return {
|
|
23
|
+
canvas,
|
|
24
|
+
ctx: canvas.getContext("2d", opts.ctx)
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
var canvas2d = (width, height = width, parent, opts) => adaptiveCanvas2d(width, height, parent, {
|
|
28
|
+
dpr: 1,
|
|
29
|
+
...opts
|
|
30
|
+
});
|
|
31
|
+
var adaptDPI = (canvas, width, height, dpr = window.devicePixelRatio || 1) => {
|
|
32
|
+
if (dpr !== 1) {
|
|
33
|
+
canvas.style.width = `${width}px`;
|
|
34
|
+
canvas.style.height = `${height}px`;
|
|
35
|
+
}
|
|
36
|
+
canvas.dataset.origWidth = String(width);
|
|
37
|
+
canvas.dataset.origHeight = String(height);
|
|
38
|
+
canvas.dataset.dpr = String(dpr);
|
|
39
|
+
canvas.width = width * dpr;
|
|
40
|
+
canvas.height = height * dpr;
|
|
41
|
+
return dpr;
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region node_modules/@thi.ng/checks/is-number.js
|
|
45
|
+
var isNumber = (x) => typeof x === "number";
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region node_modules/@thi.ng/pixel/canvas.js
|
|
48
|
+
function canvasPixels(width, height, parent, opts) {
|
|
49
|
+
let canvas;
|
|
50
|
+
let ctx;
|
|
51
|
+
if (isNumber(width)) {
|
|
52
|
+
const c = canvas2d(width, height, parent, opts);
|
|
53
|
+
canvas = c.canvas;
|
|
54
|
+
ctx = c.ctx;
|
|
55
|
+
} else {
|
|
56
|
+
canvas = width;
|
|
57
|
+
ctx = canvas.getContext("2d");
|
|
58
|
+
}
|
|
59
|
+
if (parent && canvas instanceof HTMLCanvasElement) parent.appendChild(canvas);
|
|
60
|
+
const img = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
|
61
|
+
const data = new Uint32Array(img.data.buffer);
|
|
62
|
+
return {
|
|
63
|
+
canvas,
|
|
64
|
+
ctx,
|
|
65
|
+
img,
|
|
66
|
+
data
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region node_modules/@thi.ng/api/decorators/nomixin.js
|
|
71
|
+
var nomixin = (_, __, descriptor) => {
|
|
72
|
+
descriptor.configurable = false;
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region node_modules/@thi.ng/api/mixin.js
|
|
76
|
+
var mixin = (behaviour, sharedBehaviour = {}) => {
|
|
77
|
+
const instanceKeys = Reflect.ownKeys(behaviour);
|
|
78
|
+
const sharedKeys = Reflect.ownKeys(sharedBehaviour);
|
|
79
|
+
const typeTag = Symbol("isa");
|
|
80
|
+
function _mixin(clazz) {
|
|
81
|
+
for (const key of instanceKeys) {
|
|
82
|
+
const existing = Object.getOwnPropertyDescriptor(clazz.prototype, key);
|
|
83
|
+
if (!existing || existing.configurable) Object.defineProperty(clazz.prototype, key, {
|
|
84
|
+
value: behaviour[key],
|
|
85
|
+
writable: true
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
Object.defineProperty(clazz.prototype, typeTag, { value: true });
|
|
89
|
+
return clazz;
|
|
90
|
+
}
|
|
91
|
+
for (const key of sharedKeys) Object.defineProperty(_mixin, key, {
|
|
92
|
+
value: sharedBehaviour[key],
|
|
93
|
+
enumerable: sharedBehaviour.propertyIsEnumerable(key)
|
|
94
|
+
});
|
|
95
|
+
Object.defineProperty(_mixin, Symbol.hasInstance, { value: (x) => !!x[typeTag] });
|
|
96
|
+
return _mixin;
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region node_modules/@thi.ng/api/mixins/igrid.js
|
|
100
|
+
var IGrid1DMixin = mixin({
|
|
101
|
+
order() {
|
|
102
|
+
return [0];
|
|
103
|
+
},
|
|
104
|
+
includes(x) {
|
|
105
|
+
return x >= 0 && x < this.size[0];
|
|
106
|
+
},
|
|
107
|
+
indexAt(x) {
|
|
108
|
+
return this.includes(x) ? this.indexAtUnsafe(x) : -1;
|
|
109
|
+
},
|
|
110
|
+
indexAtUnsafe(x) {
|
|
111
|
+
return this.offset + (x | 0) * this.stride[0];
|
|
112
|
+
},
|
|
113
|
+
getAt(x) {
|
|
114
|
+
return this.includes(x) ? this.data[this.indexAtUnsafe(x)] : 0;
|
|
115
|
+
},
|
|
116
|
+
getAtUnsafe(x) {
|
|
117
|
+
return this.data[this.indexAtUnsafe(x)];
|
|
118
|
+
},
|
|
119
|
+
setAt(x, val) {
|
|
120
|
+
return this.includes(x) ? (this.data[this.indexAtUnsafe(x)] = val, true) : false;
|
|
121
|
+
},
|
|
122
|
+
setAtUnsafe(x, val) {
|
|
123
|
+
this.data[this.indexAtUnsafe(x)] = val;
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
var IGrid2DMixin = mixin({
|
|
128
|
+
order() {
|
|
129
|
+
return Math.abs(this.stride[1]) > Math.abs(this.stride[0]) ? [1, 0] : [0, 1];
|
|
130
|
+
},
|
|
131
|
+
includes(x, y) {
|
|
132
|
+
const size = this.size;
|
|
133
|
+
return x >= 0 && x < size[0] && y >= 0 && y < size[1];
|
|
134
|
+
},
|
|
135
|
+
indexAt(x, y) {
|
|
136
|
+
return this.includes(x, y) ? this.indexAtUnsafe(x, y) : -1;
|
|
137
|
+
},
|
|
138
|
+
indexAtUnsafe(x, y) {
|
|
139
|
+
return this.offset + (x | 0) * this.stride[0] + (y | 0) * this.stride[1];
|
|
140
|
+
},
|
|
141
|
+
getAt(x, y) {
|
|
142
|
+
return this.includes(x, y) ? this.data[this.indexAtUnsafe(x, y)] : 0;
|
|
143
|
+
},
|
|
144
|
+
getAtUnsafe(x, y) {
|
|
145
|
+
return this.data[this.indexAtUnsafe(x, y)];
|
|
146
|
+
},
|
|
147
|
+
setAt(x, y, val) {
|
|
148
|
+
return this.includes(x, y) ? (this.data[this.indexAtUnsafe(x, y)] = val, true) : false;
|
|
149
|
+
},
|
|
150
|
+
setAtUnsafe(x, y, val) {
|
|
151
|
+
this.data[this.indexAtUnsafe(x, y)] = val;
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
var IGrid3DMixin = mixin({
|
|
156
|
+
order() {
|
|
157
|
+
return __strideOrder(this.stride);
|
|
158
|
+
},
|
|
159
|
+
includes(x, y, z) {
|
|
160
|
+
const size = this.size;
|
|
161
|
+
return x >= 0 && x < size[0] && y >= 0 && y < size[1] && z >= 0 && z < size[2];
|
|
162
|
+
},
|
|
163
|
+
indexAt(x, y, z) {
|
|
164
|
+
return this.includes(x, y, z) ? this.indexAtUnsafe(x, y, z) : -1;
|
|
165
|
+
},
|
|
166
|
+
indexAtUnsafe(x, y, z) {
|
|
167
|
+
const stride = this.stride;
|
|
168
|
+
return this.offset + (x | 0) * stride[0] + (y | 0) * stride[1] + (z | 0) * stride[2];
|
|
169
|
+
},
|
|
170
|
+
getAt(x, y, z) {
|
|
171
|
+
return this.includes(x, y, z) ? this.data[this.indexAtUnsafe(x, y, z)] : 0;
|
|
172
|
+
},
|
|
173
|
+
getAtUnsafe(x, y, z) {
|
|
174
|
+
return this.data[this.indexAtUnsafe(x, y, z)];
|
|
175
|
+
},
|
|
176
|
+
setAt(x, y, z, val) {
|
|
177
|
+
return this.includes(x, y, z) ? (this.data[this.indexAtUnsafe(x, y, z)] = val, true) : false;
|
|
178
|
+
},
|
|
179
|
+
setAtUnsafe(x, y, z, val) {
|
|
180
|
+
this.data[this.indexAtUnsafe(x, y, z)] = val;
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
var IGrid4DMixin = mixin({
|
|
185
|
+
order() {
|
|
186
|
+
return __strideOrder(this.stride);
|
|
187
|
+
},
|
|
188
|
+
includes(x, y, z, w) {
|
|
189
|
+
const size = this.size;
|
|
190
|
+
return x >= 0 && x < size[0] && y >= 0 && y < size[1] && z >= 0 && z < size[2] && w >= 0 && w < size[3];
|
|
191
|
+
},
|
|
192
|
+
indexAt(x, y, z, w) {
|
|
193
|
+
return this.includes(x, y, z, w) ? this.indexAtUnsafe(x, y, z, w) : -1;
|
|
194
|
+
},
|
|
195
|
+
indexAtUnsafe(x, y, z, w) {
|
|
196
|
+
const stride = this.stride;
|
|
197
|
+
return this.offset + (x | 0) * stride[0] + (y | 0) * stride[1] + (z | 0) * stride[2] + (w | 0) * stride[3];
|
|
198
|
+
},
|
|
199
|
+
getAt(x, y, z, w) {
|
|
200
|
+
return this.includes(x, y, z, w) ? this.data[this.indexAtUnsafe(x, y, z, w)] : 0;
|
|
201
|
+
},
|
|
202
|
+
getAtUnsafe(x, y, z, w) {
|
|
203
|
+
return this.data[this.indexAtUnsafe(x, y, z, w)];
|
|
204
|
+
},
|
|
205
|
+
setAt(x, y, z, w, val) {
|
|
206
|
+
return this.includes(x, y, z, w) ? (this.data[this.indexAtUnsafe(x, y, z, w)] = val, true) : false;
|
|
207
|
+
},
|
|
208
|
+
setAtUnsafe(x, y, z, w, val) {
|
|
209
|
+
this.data[this.indexAtUnsafe(x, y, z, w)] = val;
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
var __strideOrder = (strides) => [...strides].map((x, i) => [x, i]).sort((a, b) => Math.abs(b[0]) - Math.abs(a[0])).map((x) => x[1]);
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region node_modules/@thi.ng/checks/is-string.js
|
|
216
|
+
var isString = (x) => typeof x === "string";
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region node_modules/@thi.ng/errors/deferror.js
|
|
219
|
+
var defError = (prefix, suffix = (msg) => msg !== void 0 ? ": " + msg : "") => class extends Error {
|
|
220
|
+
origMessage;
|
|
221
|
+
constructor(msg) {
|
|
222
|
+
super(prefix(msg) + suffix(msg));
|
|
223
|
+
this.origMessage = msg !== void 0 ? String(msg) : "";
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region node_modules/@thi.ng/errors/assert.js
|
|
228
|
+
var AssertionError = defError(() => "Assertion failed");
|
|
229
|
+
var assert = (typeof process !== "undefined" && process.env !== void 0 ? process.env.NODE_ENV !== "production" || !!process.env.UMBRELLA_ASSERTS : false) ? (test, msg) => {
|
|
230
|
+
if (typeof test === "function" && !test() || !test) throw new AssertionError(typeof msg === "function" ? msg() : msg);
|
|
231
|
+
} : () => {};
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region node_modules/@thi.ng/math/interval.js
|
|
234
|
+
var clamp$1 = (x, min, max) => x < min ? min : x > max ? max : x;
|
|
235
|
+
var clamp0 = (x) => x > 0 ? x : 0;
|
|
236
|
+
var clamp01 = (x) => x < 0 ? 0 : x > 1 ? 1 : x;
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region node_modules/@thi.ng/porter-duff/utils.js
|
|
239
|
+
var setC4$1 = (out, a, b, c, d) => (out[0] = a, out[1] = b, out[2] = c, out[3] = d, out);
|
|
240
|
+
var setV4 = (out, a) => setC4$1(out, a[0], a[1], a[2], a[3]);
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region node_modules/@thi.ng/porter-duff/premultiply.js
|
|
243
|
+
var premultiply = (out, src) => {
|
|
244
|
+
const a = src[3];
|
|
245
|
+
return setC4$1(out || src, src[0] * a, src[1] * a, src[2] * a, a);
|
|
246
|
+
};
|
|
247
|
+
var premultiplyInt = (src) => {
|
|
248
|
+
const a = (src >>> 24) / 255;
|
|
249
|
+
return src & 4278190080 | (src >>> 16 & 255) * a << 16 | (src >>> 8 & 255) * a << 8 | (src & 255) * a;
|
|
250
|
+
};
|
|
251
|
+
var postmultiply = (out, src) => {
|
|
252
|
+
const a = src[3];
|
|
253
|
+
return a > 0 ? setC4$1(out || src, src[0] / a, src[1] / a, src[2] / a, a) : out && out != src ? setV4(out, src) : src;
|
|
254
|
+
};
|
|
255
|
+
var postmultiplyInt = (src) => {
|
|
256
|
+
const a = (src >>> 24) / 255;
|
|
257
|
+
return a > 0 ? (src & 4278190080 | Math.min(255, (src >>> 16 & 255) / a) << 16 | Math.min(255, (src >>> 8 & 255) / a) << 8 | Math.min(255, (src & 255) / a)) >>> 0 : src;
|
|
258
|
+
};
|
|
259
|
+
var isPremultiplied = (src) => {
|
|
260
|
+
const a = src[3];
|
|
261
|
+
return src[0] <= a && src[1] <= a || src[2] <= a;
|
|
262
|
+
};
|
|
263
|
+
var isPremultipliedInt = (src) => {
|
|
264
|
+
const a = src >>> 24;
|
|
265
|
+
return (src >>> 16 & 255) <= a && (src >>> 8 & 255) <= a && (src & 255) <= a;
|
|
266
|
+
};
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region node_modules/@thi.ng/pixel/checks.js
|
|
269
|
+
var ensureSize = (data, width, height, stride = 1) => assert(data.length >= width * height * stride, "pixel buffer too small");
|
|
270
|
+
var ensureImageData = (data, width, height) => data ? (ensureImageDataSize(data, width, height), data) : new ImageData(width, height);
|
|
271
|
+
var ensureImageDataSize = (data, width, height) => assert(data.width === width && data.height === height, "imagedata has wrong dimensions");
|
|
272
|
+
var ensureChannel = (fmt, id) => {
|
|
273
|
+
const chan = fmt.channels[id];
|
|
274
|
+
assert(chan != null, `invalid channel ID: ${id}`);
|
|
275
|
+
return chan;
|
|
276
|
+
};
|
|
277
|
+
var ensureAlpha = (fmt) => assert(!!fmt.alpha, "missing alpha channel");
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region node_modules/@thi.ng/api/fn.js
|
|
280
|
+
var identity$1 = (x) => x;
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region node_modules/@thi.ng/pixel/internal/utils.js
|
|
283
|
+
var __luminanceABGR = (c) => ((c >>> 16 & 255) * 29 + (c >>> 8 & 255) * 150 + (c & 255) * 76) / 255;
|
|
284
|
+
var __clampRegion = (sx, sy, w, h, maxw, maxh, dx = 0, dy = 0) => {
|
|
285
|
+
sx |= 0;
|
|
286
|
+
sy |= 0;
|
|
287
|
+
w |= 0;
|
|
288
|
+
h |= 0;
|
|
289
|
+
sx < 0 && (w += sx, dx -= sx, sx = 0);
|
|
290
|
+
sy < 0 && (h += sy, dy -= sy, sy = 0);
|
|
291
|
+
return [
|
|
292
|
+
sx,
|
|
293
|
+
sy,
|
|
294
|
+
clamp$1(w, 0, maxw - sx),
|
|
295
|
+
clamp$1(h, 0, maxh - sy),
|
|
296
|
+
dx,
|
|
297
|
+
dy
|
|
298
|
+
];
|
|
299
|
+
};
|
|
300
|
+
var __prepRegions = (src, dest, opts = {}) => {
|
|
301
|
+
const sw = src.width;
|
|
302
|
+
const dw = dest.width;
|
|
303
|
+
let sx, sy;
|
|
304
|
+
let dx, dy;
|
|
305
|
+
let rw, rh;
|
|
306
|
+
[sx, sy, rw, rh] = __clampRegion(opts.sx || 0, opts.sy || 0, opts.w || sw, opts.h || src.height, sw, src.height);
|
|
307
|
+
[dx, dy, rw, rh, sx, sy] = __clampRegion(opts.dx || 0, opts.dy || 0, rw, rh, dw, dest.height, sx, sy);
|
|
308
|
+
return {
|
|
309
|
+
sx,
|
|
310
|
+
sy,
|
|
311
|
+
dx,
|
|
312
|
+
dy,
|
|
313
|
+
rw,
|
|
314
|
+
rh
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
var __setChannelUni = (dbuf, src, set) => {
|
|
318
|
+
for (let i = dbuf.length; i-- > 0;) dbuf[i] = set(dbuf[i], src);
|
|
319
|
+
};
|
|
320
|
+
var __setChannelSame = (dbuf, sbuf, get, set) => {
|
|
321
|
+
for (let i = dbuf.length; i-- > 0;) dbuf[i] = set(dbuf[i], get(sbuf[i]));
|
|
322
|
+
};
|
|
323
|
+
var __setChannelConvert = (dbuf, sbuf, from, sto, mask) => {
|
|
324
|
+
const invMask = ~mask;
|
|
325
|
+
for (let i = dbuf.length; i-- > 0;) dbuf[i] = dbuf[i] & invMask | from(sto(sbuf[i])) & mask;
|
|
326
|
+
};
|
|
327
|
+
var __transformABGR = (pix, format, fn) => {
|
|
328
|
+
const from = format.fromABGR;
|
|
329
|
+
const to = format.toABGR;
|
|
330
|
+
for (let i = pix.length; i-- > 0;) pix[i] = from(fn(to(pix[i])));
|
|
331
|
+
};
|
|
332
|
+
var __blitCanvas = (buf, canvas, opts = {}) => (canvas instanceof HTMLCanvasElement || canvas instanceof OffscreenCanvas ? canvas.getContext("2d") : canvas).putImageData(buf.toImageData(opts.data), opts.x || 0, opts.y || 0);
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region node_modules/@thi.ng/pixel/format/float-format.js
|
|
335
|
+
var defFloatFormat = (fmt) => {
|
|
336
|
+
const chan = fmt.channels;
|
|
337
|
+
const chanShift = chan.reduce((acc, ch) => (acc[ch] = 3 - ch << 3, acc), {});
|
|
338
|
+
const res = {
|
|
339
|
+
...fmt,
|
|
340
|
+
__float: true,
|
|
341
|
+
size: chan.length,
|
|
342
|
+
shift: chanShift,
|
|
343
|
+
range: [0, 1],
|
|
344
|
+
normalized: clamp01,
|
|
345
|
+
fromNormalized: identity$1
|
|
346
|
+
};
|
|
347
|
+
if (fmt.convert) {
|
|
348
|
+
Object.assign(res, fmt.convert);
|
|
349
|
+
return res;
|
|
350
|
+
}
|
|
351
|
+
const to = (col, i) => (clamp01(col[i]) * 255 + .5 | 0) << chanShift[chan[i]];
|
|
352
|
+
const from = (col, i) => (col >>> chanShift[chan[i]] & 255) / 255;
|
|
353
|
+
switch (chan.length) {
|
|
354
|
+
case 1:
|
|
355
|
+
fmt.gray ? __defConvert1Gray(res) : __defConvert1(res, from, to);
|
|
356
|
+
break;
|
|
357
|
+
case 2:
|
|
358
|
+
fmt.gray ? __defConvert2Gray(res, from) : __defConvert2(res, from, to);
|
|
359
|
+
break;
|
|
360
|
+
case 3:
|
|
361
|
+
__defConvert3(res, from, to);
|
|
362
|
+
break;
|
|
363
|
+
case 4:
|
|
364
|
+
__defConvert4(res, from, to);
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
return res;
|
|
368
|
+
};
|
|
369
|
+
var __defConvert1 = (res, from, to) => {
|
|
370
|
+
res.toABGR = (col) => {
|
|
371
|
+
let out = res.alpha ? 0 : 4278190080;
|
|
372
|
+
out |= to(col, 0);
|
|
373
|
+
return out >>> 0;
|
|
374
|
+
};
|
|
375
|
+
res.fromABGR = (col, out = []) => {
|
|
376
|
+
out[0] = from(col, 0);
|
|
377
|
+
return out;
|
|
378
|
+
};
|
|
379
|
+
};
|
|
380
|
+
var __defConvert1Gray = (res) => {
|
|
381
|
+
res.toABGR = (col) => ((clamp01(col[0]) * 255 + .5 | 0) * 65793 | 4278190080) >>> 0;
|
|
382
|
+
res.fromABGR = (col, out = []) => (out[0] = __luminanceABGR(col) / 255, out);
|
|
383
|
+
};
|
|
384
|
+
var __defConvert2 = (res, from, to) => {
|
|
385
|
+
res.toABGR = (col) => {
|
|
386
|
+
let out = res.alpha ? 0 : 4278190080;
|
|
387
|
+
out |= to(col, 0);
|
|
388
|
+
out |= to(col, 1);
|
|
389
|
+
return out >>> 0;
|
|
390
|
+
};
|
|
391
|
+
res.fromABGR = (col, out = []) => {
|
|
392
|
+
out[0] = from(col, 0);
|
|
393
|
+
out[1] = from(col, 1);
|
|
394
|
+
return out;
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
var __defConvert2Gray = (res, from) => {
|
|
398
|
+
const gray = ~~(res.channels[0] === Lane.ALPHA);
|
|
399
|
+
const alpha = gray ^ 1;
|
|
400
|
+
res.toABGR = (col) => {
|
|
401
|
+
let out = (clamp01(col[gray]) * 255 + .5 | 0) * 65793;
|
|
402
|
+
out |= (col[alpha] * 255 + .5 | 0) << 24;
|
|
403
|
+
return out >>> 0;
|
|
404
|
+
};
|
|
405
|
+
res.fromABGR = (col, out = []) => {
|
|
406
|
+
out[gray] = __luminanceABGR(col) / 255;
|
|
407
|
+
out[alpha] = from(col, alpha);
|
|
408
|
+
return out;
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
var __defConvert3 = (res, from, to) => {
|
|
412
|
+
res.toABGR = (col) => {
|
|
413
|
+
let out = res.alpha ? 0 : 4278190080;
|
|
414
|
+
out |= to(col, 0);
|
|
415
|
+
out |= to(col, 1);
|
|
416
|
+
out |= to(col, 2);
|
|
417
|
+
return out >>> 0;
|
|
418
|
+
};
|
|
419
|
+
res.fromABGR = (col, out = []) => {
|
|
420
|
+
out[0] = from(col, 0);
|
|
421
|
+
out[1] = from(col, 1);
|
|
422
|
+
out[2] = from(col, 2);
|
|
423
|
+
return out;
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
var __defConvert4 = (res, from, to) => {
|
|
427
|
+
res.toABGR = (col) => {
|
|
428
|
+
let out = res.alpha ? 0 : 4278190080;
|
|
429
|
+
out |= to(col, 0);
|
|
430
|
+
out |= to(col, 1);
|
|
431
|
+
out |= to(col, 2);
|
|
432
|
+
out |= to(col, 3);
|
|
433
|
+
return out >>> 0;
|
|
434
|
+
};
|
|
435
|
+
res.fromABGR = (col, out = []) => {
|
|
436
|
+
out[0] = from(col, 0);
|
|
437
|
+
out[1] = from(col, 1);
|
|
438
|
+
out[2] = from(col, 2);
|
|
439
|
+
out[3] = from(col, 3);
|
|
440
|
+
return out;
|
|
441
|
+
};
|
|
442
|
+
};
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region node_modules/@thi.ng/pixel/format/float-gray.js
|
|
445
|
+
var FLOAT_GRAY = defFloatFormat({
|
|
446
|
+
gray: true,
|
|
447
|
+
channels: [Lane.RED]
|
|
448
|
+
});
|
|
449
|
+
//#endregion
|
|
450
|
+
//#region node_modules/@thi.ng/api/typedarray.js
|
|
451
|
+
var GL2TYPE = {
|
|
452
|
+
[5120]: "i8",
|
|
453
|
+
[5121]: "u8",
|
|
454
|
+
[5122]: "i16",
|
|
455
|
+
[5123]: "u16",
|
|
456
|
+
[5124]: "i32",
|
|
457
|
+
[5125]: "u32",
|
|
458
|
+
[5126]: "f32"
|
|
459
|
+
};
|
|
460
|
+
var FLOAT_ARRAY_CTORS = {
|
|
461
|
+
f32: Float32Array,
|
|
462
|
+
f64: Float64Array
|
|
463
|
+
};
|
|
464
|
+
var INT_ARRAY_CTORS = {
|
|
465
|
+
i8: Int8Array,
|
|
466
|
+
i16: Int16Array,
|
|
467
|
+
i32: Int32Array
|
|
468
|
+
};
|
|
469
|
+
var UINT_ARRAY_CTORS = {
|
|
470
|
+
u8: Uint8Array,
|
|
471
|
+
u8c: Uint8ClampedArray,
|
|
472
|
+
u16: Uint16Array,
|
|
473
|
+
u32: Uint32Array
|
|
474
|
+
};
|
|
475
|
+
var BIGINT_ARRAY_CTORS = {
|
|
476
|
+
i64: BigInt64Array,
|
|
477
|
+
u64: BigUint64Array
|
|
478
|
+
};
|
|
479
|
+
var TYPEDARRAY_CTORS = {
|
|
480
|
+
...FLOAT_ARRAY_CTORS,
|
|
481
|
+
...INT_ARRAY_CTORS,
|
|
482
|
+
...UINT_ARRAY_CTORS
|
|
483
|
+
};
|
|
484
|
+
var asNativeType = (type) => {
|
|
485
|
+
const t = GL2TYPE[type];
|
|
486
|
+
return t !== void 0 ? t : type;
|
|
487
|
+
};
|
|
488
|
+
function typedArray(type, ...args) {
|
|
489
|
+
return new (BIGINT_ARRAY_CTORS[type] || TYPEDARRAY_CTORS[asNativeType(type)])(...args);
|
|
490
|
+
}
|
|
491
|
+
var uintTypeForBits = (x) => x > 16 ? "u32" : x > 8 ? "u16" : "u8";
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region node_modules/@thi.ng/pixel/internal/codegen.js
|
|
494
|
+
var __compileLShift = (x, shift) => shift > 0 ? `(${x} << ${shift})` : shift < 0 ? `(${x} >>> ${-shift})` : `${x}`;
|
|
495
|
+
var __compileRShift = (x, shift) => __compileLShift(x, -shift);
|
|
496
|
+
var __hex = (x) => `0x${x.toString(16)}`;
|
|
497
|
+
var __compileGrayFromABGR = (size) => {
|
|
498
|
+
const shift = 8 - size;
|
|
499
|
+
const mask = (1 << size) - 1;
|
|
500
|
+
return new Function("luma", `return (x) => ${__compileRShift("luma(x)", shift)} & ${mask};`)(__luminanceABGR);
|
|
501
|
+
};
|
|
502
|
+
var __compileGrayToABGR = (size) => {
|
|
503
|
+
let body;
|
|
504
|
+
if (size !== 8) {
|
|
505
|
+
const mask = (1 << size) - 1;
|
|
506
|
+
body = `(((x & ${mask}) * ${255 / mask}) | 0)`;
|
|
507
|
+
} else body = "x";
|
|
508
|
+
return new Function("x", `return 0xff000000 | (${body} * 0x010101);`);
|
|
509
|
+
};
|
|
510
|
+
var __compileFromABGR = (chans) => new Function("x", "return (" + chans.map((ch) => {
|
|
511
|
+
return `(${__compileRShift("x", ch.abgrShift + (8 - ch.size))} & ${__hex(ch.maskA)})`;
|
|
512
|
+
}).join(" | ") + ") >>> 0;");
|
|
513
|
+
var __compileToABGR = (chans, hasAlpha) => {
|
|
514
|
+
const body = chans.map((ch) => {
|
|
515
|
+
if (ch.size !== 8) {
|
|
516
|
+
const mask = ch.mask0;
|
|
517
|
+
const scale = 255 / mask;
|
|
518
|
+
return __compileLShift(`((${__compileRShift("x", ch.shift)} & ${mask}) * ${scale})`, 24 - ch.lane * 8);
|
|
519
|
+
} else return __compileLShift(`(x & ${__hex(ch.maskA)})`, ch.abgrShift);
|
|
520
|
+
}).join(" | ");
|
|
521
|
+
const alpha = !hasAlpha ? `0xff000000 | ` : "";
|
|
522
|
+
return new Function("x", `return (${alpha}${body}) >>> 0;`);
|
|
523
|
+
};
|
|
524
|
+
//#endregion
|
|
525
|
+
//#region node_modules/@thi.ng/pixel/format/int-format.js
|
|
526
|
+
var __defChannel = (ch, idx, shift) => {
|
|
527
|
+
const num = 1 << ch.size;
|
|
528
|
+
const mask0 = num - 1;
|
|
529
|
+
const maskA = mask0 << shift >>> 0;
|
|
530
|
+
const invMask = ~maskA >>> 0;
|
|
531
|
+
const lane = ch.lane != null ? ch.lane : idx;
|
|
532
|
+
const int = (x) => x >>> shift & mask0;
|
|
533
|
+
const setInt = (src, x) => src & invMask | (x & mask0) << shift;
|
|
534
|
+
return {
|
|
535
|
+
size: ch.size,
|
|
536
|
+
num,
|
|
537
|
+
abgrShift: 24 - lane * 8 - shift,
|
|
538
|
+
lane,
|
|
539
|
+
shift,
|
|
540
|
+
mask0,
|
|
541
|
+
maskA,
|
|
542
|
+
int,
|
|
543
|
+
setInt,
|
|
544
|
+
float: (x) => int(x) / mask0,
|
|
545
|
+
setFloat: (src, x) => setInt(src, clamp01(x) * mask0)
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
var defIntFormat = (fmt) => {
|
|
549
|
+
assert(fmt.channels.length > 0, "no channel specs given");
|
|
550
|
+
const channels = fmt.channels.reduce(([defs, shift], ch, i) => {
|
|
551
|
+
shift -= ch.size;
|
|
552
|
+
defs.push(__defChannel(ch, i, shift));
|
|
553
|
+
return [defs, shift];
|
|
554
|
+
}, [[], fmt.size])[0];
|
|
555
|
+
return {
|
|
556
|
+
__packed: true,
|
|
557
|
+
type: fmt.type,
|
|
558
|
+
size: fmt.size,
|
|
559
|
+
alpha: fmt.alpha || 0,
|
|
560
|
+
channels,
|
|
561
|
+
fromABGR: fmt.fromABGR || __compileFromABGR(channels),
|
|
562
|
+
toABGR: fmt.toABGR || __compileToABGR(channels, !!fmt.alpha)
|
|
563
|
+
};
|
|
564
|
+
};
|
|
565
|
+
//#endregion
|
|
566
|
+
//#region node_modules/@thi.ng/pixel/format/abgr8888.js
|
|
567
|
+
var ABGR8888 = defIntFormat({
|
|
568
|
+
type: "u32",
|
|
569
|
+
size: 32,
|
|
570
|
+
alpha: 8,
|
|
571
|
+
channels: [
|
|
572
|
+
{
|
|
573
|
+
size: 8,
|
|
574
|
+
lane: Lane.ALPHA
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
size: 8,
|
|
578
|
+
lane: Lane.BLUE
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
size: 8,
|
|
582
|
+
lane: Lane.GREEN
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
size: 8,
|
|
586
|
+
lane: Lane.RED
|
|
587
|
+
}
|
|
588
|
+
],
|
|
589
|
+
fromABGR: identity$1,
|
|
590
|
+
toABGR: identity$1
|
|
591
|
+
});
|
|
592
|
+
//#endregion
|
|
593
|
+
//#region node_modules/@thi.ng/math/api.js
|
|
594
|
+
var PI = Math.PI;
|
|
595
|
+
var TAU = PI * 2;
|
|
596
|
+
var HALF_PI = PI / 2;
|
|
597
|
+
var THIRD_PI = PI / 3;
|
|
598
|
+
var QUARTER_PI = PI / 4;
|
|
599
|
+
var SIXTH_PI = PI / 6;
|
|
600
|
+
var INV_PI = 1 / PI;
|
|
601
|
+
var INV_TAU = 1 / TAU;
|
|
602
|
+
var INV_HALF_PI = 1 / HALF_PI;
|
|
603
|
+
var DEG2RAD = PI / 180;
|
|
604
|
+
var RAD2DEG = 180 / PI;
|
|
605
|
+
var PHI = (1 + Math.sqrt(5)) / 2;
|
|
606
|
+
var SQRT2 = Math.SQRT2;
|
|
607
|
+
var SQRT3 = Math.sqrt(3);
|
|
608
|
+
var SQRT2_2 = SQRT2 / 2;
|
|
609
|
+
var SQRT3_2 = SQRT3 / 2;
|
|
610
|
+
var THIRD = 1 / 3;
|
|
611
|
+
var TWO_THIRD = 2 / 3;
|
|
612
|
+
var SIXTH = 1 / 6;
|
|
613
|
+
var EPS$1 = 1e-6;
|
|
614
|
+
//#endregion
|
|
615
|
+
//#region node_modules/@thi.ng/math/mix.js
|
|
616
|
+
var mixBilinear = (a, b, c, d, u, v) => {
|
|
617
|
+
const iu = 1 - u;
|
|
618
|
+
const iv = 1 - v;
|
|
619
|
+
return a * iu * iv + b * u * iv + c * iu * v + d * u * v;
|
|
620
|
+
};
|
|
621
|
+
var mixCubicHermiteFromPoints = (a, b, c, d, t) => {
|
|
622
|
+
d *= .5;
|
|
623
|
+
const aa = -.5 * a + 1.5 * b - 1.5 * c + d;
|
|
624
|
+
const bb = a - 2.5 * b + 2 * c - d;
|
|
625
|
+
const cc = -.5 * a + .5 * c;
|
|
626
|
+
const dd = b;
|
|
627
|
+
const t2 = t * t;
|
|
628
|
+
return t * t2 * aa + t2 * bb + t * cc + dd;
|
|
629
|
+
};
|
|
630
|
+
var mixBicubic = (s00, s01, s02, s03, s10, s11, s12, s13, s20, s21, s22, s23, s30, s31, s32, s33, u, v) => mixCubicHermiteFromPoints(mixCubicHermiteFromPoints(s00, s01, s02, s03, u), mixCubicHermiteFromPoints(s10, s11, s12, s13, u), mixCubicHermiteFromPoints(s20, s21, s22, s23, u), mixCubicHermiteFromPoints(s30, s31, s32, s33, u), v);
|
|
631
|
+
//#endregion
|
|
632
|
+
//#region node_modules/@thi.ng/math/prec.js
|
|
633
|
+
var mod = (a, b) => a - b * Math.floor(a / b);
|
|
634
|
+
var fract = (x) => x - Math.floor(x);
|
|
635
|
+
var roundTo = (x, prec = 1) => Math.round(x / prec) * prec;
|
|
636
|
+
//#endregion
|
|
637
|
+
//#region node_modules/@thi.ng/pixel/sample.js
|
|
638
|
+
function defSampler(src, filter = "linear", wrap = "clamp") {
|
|
639
|
+
const isFloat = !!src.format.__float;
|
|
640
|
+
const suffix = src.format.channels.length === 1 ? "1" : "";
|
|
641
|
+
const id = `${filter[0]}${wrap[0]}${suffix}`;
|
|
642
|
+
const impl = (isFloat ? {
|
|
643
|
+
nc1: __sampleFNC,
|
|
644
|
+
nw1: __sampleFNW,
|
|
645
|
+
nr1: __sampleFNR,
|
|
646
|
+
nc: __sampleFNC,
|
|
647
|
+
nw: __sampleFNW,
|
|
648
|
+
nr: __sampleFNR,
|
|
649
|
+
lc1: (src2) => __bilinearGrayF(__sampleINC(src2)),
|
|
650
|
+
lw1: (src2) => __bilinearGrayF(__sampleINW(src2)),
|
|
651
|
+
lr1: (src2) => __bilinearGrayF(__sampleINR(src2)),
|
|
652
|
+
lc: (src2) => __bilinearFloat(src2, __sampleFNC(src2)),
|
|
653
|
+
lw: (src2) => __bilinearFloat(src2, __sampleFNW(src2)),
|
|
654
|
+
lr: (src2) => __bilinearFloat(src2, __sampleFNR(src2)),
|
|
655
|
+
cc1: (src2) => __bicubicGrayF(__sampleINC(src2)),
|
|
656
|
+
cw1: (src2) => __bicubicGrayF(__sampleINW(src2)),
|
|
657
|
+
cr1: (src2) => __bicubicGrayF(__sampleINR(src2)),
|
|
658
|
+
cc: (src2) => __bicubicFloat(src2, __sampleFNC(src2)),
|
|
659
|
+
cw: (src2) => __bicubicFloat(src2, __sampleFNW(src2)),
|
|
660
|
+
cr: (src2) => __bicubicFloat(src2, __sampleFNR(src2))
|
|
661
|
+
} : {
|
|
662
|
+
nc1: __sampleINC,
|
|
663
|
+
nw1: __sampleINW,
|
|
664
|
+
nr1: __sampleINR,
|
|
665
|
+
nc: __sampleINC,
|
|
666
|
+
nw: __sampleINW,
|
|
667
|
+
nr: __sampleINR,
|
|
668
|
+
lc1: (src2) => __bilinearGray(__sampleINC(src2)),
|
|
669
|
+
lw1: (src2) => __bilinearGray(__sampleINW(src2)),
|
|
670
|
+
lr1: (src2) => __bilinearGray(__sampleINR(src2)),
|
|
671
|
+
lc: (src2) => __bilinearABGR(src2, __sampleINC(src2)),
|
|
672
|
+
lw: (src2) => __bilinearABGR(src2, __sampleINW(src2)),
|
|
673
|
+
lr: (src2) => __bilinearABGR(src2, __sampleINR(src2)),
|
|
674
|
+
cc1: (src2) => __bicubicGrayI(src2, __sampleINC(src2)),
|
|
675
|
+
cw1: (src2) => __bicubicGrayI(src2, __sampleINW(src2)),
|
|
676
|
+
cr1: (src2) => __bicubicGrayI(src2, __sampleINR(src2)),
|
|
677
|
+
cc: (src2) => __bicubicABGR(src2, __sampleINC(src2)),
|
|
678
|
+
cw: (src2) => __bicubicABGR(src2, __sampleINW(src2)),
|
|
679
|
+
cr: (src2) => __bicubicABGR(src2, __sampleINR(src2))
|
|
680
|
+
})[id];
|
|
681
|
+
assert(!!impl, `missing impl for ${id}`);
|
|
682
|
+
return impl(src);
|
|
683
|
+
}
|
|
684
|
+
var __sampleINC = ({ data, width, height }) => (x, y) => x >= 0 && x < width && y >= 0 && y < height ? data[(y | 0) * width + (x | 0)] : 0;
|
|
685
|
+
var __sampleINW = ({ data, width, height }) => (x, y) => data[mod(y | 0, height) * width + mod(x | 0, width)];
|
|
686
|
+
var __sampleINR = ({ data, width, height }) => {
|
|
687
|
+
const w1 = width - 1;
|
|
688
|
+
const h1 = height - 1;
|
|
689
|
+
return (x, y) => data[clamp$1(y | 0, 0, h1) * width + clamp$1(x | 0, 0, w1)];
|
|
690
|
+
};
|
|
691
|
+
var __sampleFNC = ({ data, width, height, stride: [stride, rowStride] }) => (x, y) => {
|
|
692
|
+
let i;
|
|
693
|
+
return x >= 0 && x < width && y >= 0 && y < height ? (i = (y | 0) * rowStride + (x | 0) * stride, data.slice(i, i + stride)) : [0];
|
|
694
|
+
};
|
|
695
|
+
var __sampleFNW = ({ data, width, height, stride: [stride, rowStride] }) => (x, y) => {
|
|
696
|
+
let i = mod(y | 0, height) * rowStride + mod(x | 0, width) * stride;
|
|
697
|
+
return data.slice(i, i + stride);
|
|
698
|
+
};
|
|
699
|
+
var __sampleFNR = ({ data, width, height, stride: [stride, rowStride] }) => {
|
|
700
|
+
const w1 = width - 1;
|
|
701
|
+
const h1 = height - 1;
|
|
702
|
+
return (x, y) => {
|
|
703
|
+
let i = clamp$1(y | 0, 0, h1) * rowStride + clamp$1(x | 0, 0, w1) * stride;
|
|
704
|
+
return data.slice(i, i + stride);
|
|
705
|
+
};
|
|
706
|
+
};
|
|
707
|
+
var __mixBilinearChan = (buf, u, v, i, s = 4) => mixBilinear(buf[i], buf[i + s], buf[i + 2 * s], buf[i + 3 * s], u, v);
|
|
708
|
+
var __bilinearGray = (sample) => (x, y) => {
|
|
709
|
+
x -= .5;
|
|
710
|
+
y -= .5;
|
|
711
|
+
return mixBilinear(sample(x, y), sample(x + 1, y), sample(x, y + 1), sample(x + 1, y + 1), fract(x), fract(y));
|
|
712
|
+
};
|
|
713
|
+
var __bilinearGrayF = (sample) => {
|
|
714
|
+
sample = __bilinearGray(sample);
|
|
715
|
+
return (x, y) => [sample(x, y)];
|
|
716
|
+
};
|
|
717
|
+
var __bilinearABGR = (src, sample1) => {
|
|
718
|
+
const { fromABGR, toABGR } = src.format;
|
|
719
|
+
const u32 = new Uint32Array(4);
|
|
720
|
+
const u8 = new Uint8Array(u32.buffer);
|
|
721
|
+
return (x, y) => {
|
|
722
|
+
x -= .5;
|
|
723
|
+
y -= .5;
|
|
724
|
+
u32[0] = toABGR(sample1(x, y));
|
|
725
|
+
u32[1] = toABGR(sample1(x + 1, y));
|
|
726
|
+
u32[2] = toABGR(sample1(x, y + 1));
|
|
727
|
+
u32[3] = toABGR(sample1(x + 1, y + 1));
|
|
728
|
+
const u = fract(x);
|
|
729
|
+
const v = fract(y);
|
|
730
|
+
return fromABGR(__mixBilinearChan(u8, u, v, 0) | __mixBilinearChan(u8, u, v, 1) << 8 | __mixBilinearChan(u8, u, v, 2) << 16 | __mixBilinearChan(u8, u, v, 3) << 24) >>> 0;
|
|
731
|
+
};
|
|
732
|
+
};
|
|
733
|
+
var __bilinearFloat = ({ stride: [stride] }, sample1) => {
|
|
734
|
+
const f32 = new Float32Array(stride * 4);
|
|
735
|
+
return (x, y) => {
|
|
736
|
+
x -= .5;
|
|
737
|
+
y -= .5;
|
|
738
|
+
f32.set(sample1(x, y), 0);
|
|
739
|
+
f32.set(sample1(x + 1, y), stride);
|
|
740
|
+
f32.set(sample1(x, y + 1), stride * 2);
|
|
741
|
+
f32.set(sample1(x + 1, y + 1), stride * 3);
|
|
742
|
+
const u = fract(x);
|
|
743
|
+
const v = fract(y);
|
|
744
|
+
let res = [];
|
|
745
|
+
for (let i = 0; i < stride; i++) res.push(__mixBilinearChan(f32, u, v, i, stride));
|
|
746
|
+
return res;
|
|
747
|
+
};
|
|
748
|
+
};
|
|
749
|
+
var __bicubicGray = (sample) => (x, y) => {
|
|
750
|
+
x -= .5;
|
|
751
|
+
y -= .5;
|
|
752
|
+
const x1 = x - 1;
|
|
753
|
+
const x2 = x + 1;
|
|
754
|
+
const x3 = x + 2;
|
|
755
|
+
const y1 = y - 1;
|
|
756
|
+
const y2 = y + 1;
|
|
757
|
+
const y3 = y + 2;
|
|
758
|
+
return mixBicubic(sample(x1, y1), sample(x, y1), sample(x2, y1), sample(x3, y1), sample(x1, y), sample(x, y), sample(x2, y), sample(x3, y), sample(x1, y2), sample(x, y2), sample(x2, y2), sample(x3, y2), sample(x1, y3), sample(x, y3), sample(x2, y3), sample(x3, y3), fract(x), fract(y));
|
|
759
|
+
};
|
|
760
|
+
var __bicubicGrayI = (src, sample) => {
|
|
761
|
+
const max = src.format.channels[0].mask0;
|
|
762
|
+
sample = __bicubicGray(sample);
|
|
763
|
+
return (x, y) => clamp$1(sample(x, y), 0, max);
|
|
764
|
+
};
|
|
765
|
+
var __bicubicGrayF = (sample) => {
|
|
766
|
+
sample = __bicubicGray(sample);
|
|
767
|
+
return (x, y) => [sample(x, y)];
|
|
768
|
+
};
|
|
769
|
+
var __mixBicubicChan = (buf, u, v, i, s = 4) => mixBicubic(buf[i], buf[i + s], buf[i + 2 * s], buf[i + 3 * s], buf[i + 4 * s], buf[i + 5 * s], buf[i + 6 * s], buf[i + 7 * s], buf[i + 8 * s], buf[i + 9 * s], buf[i + 10 * s], buf[i + 11 * s], buf[i + 12 * s], buf[i + 13 * s], buf[i + 14 * s], buf[i + 15 * s], u, v);
|
|
770
|
+
var __mixBicubicChanClamped = (buf, u, v, i, s = 4) => clamp$1(__mixBicubicChan(buf, u, v, i, s), 0, 255);
|
|
771
|
+
var __bicubicABGR = (src, sample) => {
|
|
772
|
+
const { fromABGR, toABGR } = src.format;
|
|
773
|
+
const u32 = new Uint32Array(16);
|
|
774
|
+
const u8 = new Uint8Array(u32.buffer);
|
|
775
|
+
return (x, y) => {
|
|
776
|
+
x -= .5;
|
|
777
|
+
y -= .5;
|
|
778
|
+
const x1 = x - 1;
|
|
779
|
+
const x2 = x + 1;
|
|
780
|
+
const x3 = x + 2;
|
|
781
|
+
const y1 = y - 1;
|
|
782
|
+
const y2 = y + 1;
|
|
783
|
+
const y3 = y + 2;
|
|
784
|
+
const u = fract(x);
|
|
785
|
+
const v = fract(y);
|
|
786
|
+
u32[0] = toABGR(sample(x1, y1));
|
|
787
|
+
u32[1] = toABGR(sample(x, y1));
|
|
788
|
+
u32[2] = toABGR(sample(x2, y1));
|
|
789
|
+
u32[3] = toABGR(sample(x3, y1));
|
|
790
|
+
u32[4] = toABGR(sample(x1, y));
|
|
791
|
+
u32[5] = toABGR(sample(x, y));
|
|
792
|
+
u32[6] = toABGR(sample(x2, y));
|
|
793
|
+
u32[7] = toABGR(sample(x3, y));
|
|
794
|
+
u32[8] = toABGR(sample(x1, y2));
|
|
795
|
+
u32[9] = toABGR(sample(x, y2));
|
|
796
|
+
u32[10] = toABGR(sample(x2, y2));
|
|
797
|
+
u32[11] = toABGR(sample(x3, y2));
|
|
798
|
+
u32[12] = toABGR(sample(x1, y3));
|
|
799
|
+
u32[13] = toABGR(sample(x, y3));
|
|
800
|
+
u32[14] = toABGR(sample(x2, y3));
|
|
801
|
+
u32[15] = toABGR(sample(x3, y3));
|
|
802
|
+
return fromABGR(__mixBicubicChanClamped(u8, u, v, 0) | __mixBicubicChanClamped(u8, u, v, 1) << 8 | __mixBicubicChanClamped(u8, u, v, 2) << 16 | __mixBicubicChanClamped(u8, u, v, 3) << 24) >>> 0;
|
|
803
|
+
};
|
|
804
|
+
};
|
|
805
|
+
var __bicubicFloat = ({ stride: [stride] }, sample) => {
|
|
806
|
+
const f32 = new Float32Array(stride * 16);
|
|
807
|
+
return (x, y) => {
|
|
808
|
+
x -= .5;
|
|
809
|
+
y -= .5;
|
|
810
|
+
const x1 = x - 1;
|
|
811
|
+
const x2 = x + 1;
|
|
812
|
+
const x3 = x + 2;
|
|
813
|
+
const y1 = y - 1;
|
|
814
|
+
const y2 = y + 1;
|
|
815
|
+
const y3 = y + 2;
|
|
816
|
+
const u = fract(x);
|
|
817
|
+
const v = fract(y);
|
|
818
|
+
f32.set(sample(x1, y1), 0);
|
|
819
|
+
f32.set(sample(x, y1), stride);
|
|
820
|
+
f32.set(sample(x2, y1), 2 * stride);
|
|
821
|
+
f32.set(sample(x3, y1), 3 * stride);
|
|
822
|
+
f32.set(sample(x1, y), 4 * stride);
|
|
823
|
+
f32.set(sample(x, y), 5 * stride);
|
|
824
|
+
f32.set(sample(x2, y), 6 * stride);
|
|
825
|
+
f32.set(sample(x3, y), 7 * stride);
|
|
826
|
+
f32.set(sample(x1, y2), 8 * stride);
|
|
827
|
+
f32.set(sample(x, y2), 9 * stride);
|
|
828
|
+
f32.set(sample(x2, y2), 10 * stride);
|
|
829
|
+
f32.set(sample(x3, y2), 11 * stride);
|
|
830
|
+
f32.set(sample(x1, y3), 12 * stride);
|
|
831
|
+
f32.set(sample(x, y3), 13 * stride);
|
|
832
|
+
f32.set(sample(x2, y3), 14 * stride);
|
|
833
|
+
f32.set(sample(x3, y3), 15 * stride);
|
|
834
|
+
let res = [];
|
|
835
|
+
for (let i = 0; i < stride; i++) res.push(__mixBicubicChan(f32, u, v, i, stride));
|
|
836
|
+
return res;
|
|
837
|
+
};
|
|
838
|
+
};
|
|
839
|
+
//#endregion
|
|
840
|
+
//#region node_modules/@thi.ng/pixel/int.js
|
|
841
|
+
var __defProp$1 = Object.defineProperty;
|
|
842
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
843
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
844
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
845
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
846
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
847
|
+
return result;
|
|
848
|
+
};
|
|
849
|
+
function intBuffer(...args) {
|
|
850
|
+
return args[0] instanceof IntBuffer ? args[0].as(args[1]) : new IntBuffer(...args);
|
|
851
|
+
}
|
|
852
|
+
var intBufferFromCanvas = (canvas, fmt = ABGR8888) => {
|
|
853
|
+
const { data } = canvasPixels(canvas);
|
|
854
|
+
const w = canvas.width;
|
|
855
|
+
const h = canvas.height;
|
|
856
|
+
let dest;
|
|
857
|
+
if (fmt === ABGR8888) dest = data;
|
|
858
|
+
else {
|
|
859
|
+
dest = typedArray(fmt.type, w * h);
|
|
860
|
+
const src = data;
|
|
861
|
+
const from = fmt.fromABGR;
|
|
862
|
+
for (let i = dest.length; i-- > 0;) dest[i] = from(src[i]);
|
|
863
|
+
}
|
|
864
|
+
return new IntBuffer(w, h, fmt, dest);
|
|
865
|
+
};
|
|
866
|
+
var IntBuffer = class {
|
|
867
|
+
size;
|
|
868
|
+
stride;
|
|
869
|
+
format;
|
|
870
|
+
data;
|
|
871
|
+
constructor(w, h, fmt = ABGR8888, data) {
|
|
872
|
+
this.size = [w, h];
|
|
873
|
+
this.stride = [1, w];
|
|
874
|
+
this.format = fmt.__packed ? fmt : defIntFormat(fmt);
|
|
875
|
+
this.data = data || typedArray(fmt.type, w * h);
|
|
876
|
+
}
|
|
877
|
+
/** @deprecated use `.data` instead */
|
|
878
|
+
get pixels() {
|
|
879
|
+
return this.data;
|
|
880
|
+
}
|
|
881
|
+
get width() {
|
|
882
|
+
return this.size[0];
|
|
883
|
+
}
|
|
884
|
+
get height() {
|
|
885
|
+
return this.size[1];
|
|
886
|
+
}
|
|
887
|
+
get offset() {
|
|
888
|
+
return 0;
|
|
889
|
+
}
|
|
890
|
+
get dim() {
|
|
891
|
+
return 2;
|
|
892
|
+
}
|
|
893
|
+
*[Symbol.iterator]() {
|
|
894
|
+
yield* this.data;
|
|
895
|
+
}
|
|
896
|
+
as(fmt) {
|
|
897
|
+
if (!fmt.__float) return this.getRegion(0, 0, this.width, this.height, fmt);
|
|
898
|
+
const dest = new FloatBuffer(this.width, this.height, fmt);
|
|
899
|
+
const { data: dbuf, format: dfmt, stride: [stride] } = dest;
|
|
900
|
+
const { data: sbuf, format: sfmt } = this;
|
|
901
|
+
for (let i = sbuf.length; i-- > 0;) dbuf.set(dfmt.fromABGR(sfmt.toABGR(sbuf[i])), i * stride);
|
|
902
|
+
return dest;
|
|
903
|
+
}
|
|
904
|
+
copy() {
|
|
905
|
+
const dest = this.empty();
|
|
906
|
+
dest.data.set(this.data);
|
|
907
|
+
return dest;
|
|
908
|
+
}
|
|
909
|
+
empty() {
|
|
910
|
+
return new IntBuffer(this.width, this.height, this.format);
|
|
911
|
+
}
|
|
912
|
+
order() {}
|
|
913
|
+
includes(x, y) {}
|
|
914
|
+
indexAt(x, y) {}
|
|
915
|
+
indexAtUnsafe(x, y) {}
|
|
916
|
+
getAt(x, y) {}
|
|
917
|
+
getAtUnsafe(x, y) {}
|
|
918
|
+
setAt(x, y, col) {}
|
|
919
|
+
setAtUnsafe(x, y, col) {}
|
|
920
|
+
getChannelAt(x, y, id, normalized = false) {
|
|
921
|
+
const chan = ensureChannel(this.format, id);
|
|
922
|
+
const col = this.getAt(x, y);
|
|
923
|
+
return normalized ? chan.float(col) : chan.int(col);
|
|
924
|
+
}
|
|
925
|
+
setChannelAt(x, y, id, col, normalized = false) {
|
|
926
|
+
const chan = ensureChannel(this.format, id);
|
|
927
|
+
const src = this.getAt(x, y);
|
|
928
|
+
normalized ? chan.setFloat(src, col) : chan.setInt(src, col);
|
|
929
|
+
return this;
|
|
930
|
+
}
|
|
931
|
+
blend(op, dest, opts) {
|
|
932
|
+
let sw = this.width;
|
|
933
|
+
let dw = dest.width;
|
|
934
|
+
const { sx, sy, dx, dy, rw, rh } = __prepRegions(this, dest, opts);
|
|
935
|
+
if (rw < 1 || rh < 1) return dest;
|
|
936
|
+
const sbuf = this.data;
|
|
937
|
+
const dbuf = dest.data;
|
|
938
|
+
const sf = this.format.toABGR;
|
|
939
|
+
const df1 = dest.format.toABGR;
|
|
940
|
+
const df2 = dest.format.fromABGR;
|
|
941
|
+
for (let si = (sx | 0) + (sy | 0) * sw, di = (dx | 0) + (dy | 0) * dw, yy = 0; yy < rh; yy++, si += sw, di += dw) for (let xx = 0; xx < rw; xx++) dbuf[di + xx] = df2(op(sf(sbuf[si + xx]), df1(dbuf[di + xx])));
|
|
942
|
+
return dest;
|
|
943
|
+
}
|
|
944
|
+
blit(dest, opts) {
|
|
945
|
+
let sw = this.width;
|
|
946
|
+
let dw = dest.width;
|
|
947
|
+
const { sx, sy, dx, dy, rw, rh } = __prepRegions(this, dest, opts);
|
|
948
|
+
if (rw < 1 || rh < 1) return dest;
|
|
949
|
+
const sbuf = this.data;
|
|
950
|
+
const dbuf = dest.data;
|
|
951
|
+
const sf = this.format.toABGR;
|
|
952
|
+
const df = dest.format.fromABGR;
|
|
953
|
+
const blitRow = this.format !== dest.format ? (si, di) => {
|
|
954
|
+
for (let xx = 0; xx < rw; xx++) dbuf[di + xx] = df(sf(sbuf[si + xx]));
|
|
955
|
+
} : (si, di) => dbuf.set(sbuf.subarray(si, si + rw), di);
|
|
956
|
+
for (let si = (sx | 0) + (sy | 0) * sw, di = (dx | 0) + (dy | 0) * dw, yy = 0; yy < rh; yy++, si += sw, di += dw) blitRow(si, di);
|
|
957
|
+
return dest;
|
|
958
|
+
}
|
|
959
|
+
blitCanvas(canvas, opts = {}) {
|
|
960
|
+
__blitCanvas(this, canvas, opts);
|
|
961
|
+
}
|
|
962
|
+
setImageData(idata) {
|
|
963
|
+
ensureImageDataSize(idata, this.width, this.height);
|
|
964
|
+
const src = new Uint32Array(idata.data.buffer);
|
|
965
|
+
const dest = this.data;
|
|
966
|
+
const fmt = this.format.fromABGR;
|
|
967
|
+
for (let i = src.length; i-- > 0;) dest[i] = fmt(src[i]);
|
|
968
|
+
return this;
|
|
969
|
+
}
|
|
970
|
+
toImageData(idata) {
|
|
971
|
+
idata = ensureImageData(idata, this.width, this.height);
|
|
972
|
+
const dest = new Uint32Array(idata.data.buffer);
|
|
973
|
+
const src = this.data;
|
|
974
|
+
const fmt = this.format.toABGR;
|
|
975
|
+
for (let i = dest.length; i-- > 0;) dest[i] = fmt(src[i]);
|
|
976
|
+
return idata;
|
|
977
|
+
}
|
|
978
|
+
getRegion(x, y, width, height, fmt) {
|
|
979
|
+
const [sx, sy, w, h] = __clampRegion(x, y, width, height, this.width, this.height);
|
|
980
|
+
if (w < 1 || h < 1) return;
|
|
981
|
+
return this.blit(new IntBuffer(w, h, fmt || this.format), {
|
|
982
|
+
sx,
|
|
983
|
+
sy,
|
|
984
|
+
w,
|
|
985
|
+
h
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
getChannel(id) {
|
|
989
|
+
const chan = ensureChannel(this.format, id);
|
|
990
|
+
const buf = new IntBuffer(this.width, this.height, {
|
|
991
|
+
type: uintTypeForBits(chan.size),
|
|
992
|
+
size: chan.size,
|
|
993
|
+
channels: [{
|
|
994
|
+
size: chan.size,
|
|
995
|
+
lane: Lane.RED
|
|
996
|
+
}],
|
|
997
|
+
fromABGR: __compileGrayFromABGR(chan.size),
|
|
998
|
+
toABGR: __compileGrayToABGR(chan.size)
|
|
999
|
+
});
|
|
1000
|
+
const src = this.data;
|
|
1001
|
+
const dest = buf.data;
|
|
1002
|
+
const get = chan.int;
|
|
1003
|
+
for (let i = src.length; i-- > 0;) dest[i] = get(src[i]);
|
|
1004
|
+
return buf;
|
|
1005
|
+
}
|
|
1006
|
+
setChannel(id, src) {
|
|
1007
|
+
const chan = ensureChannel(this.format, id);
|
|
1008
|
+
const dbuf = this.data;
|
|
1009
|
+
const set = chan.setInt;
|
|
1010
|
+
if (isNumber(src)) __setChannelUni(dbuf, src, set);
|
|
1011
|
+
else {
|
|
1012
|
+
const sbuf = src.data;
|
|
1013
|
+
const schan = src.format.channels[0];
|
|
1014
|
+
ensureSize(sbuf, this.width, this.height);
|
|
1015
|
+
if (chan.size === schan.size) __setChannelSame(dbuf, sbuf, schan.int, set);
|
|
1016
|
+
else __setChannelConvert(dbuf, sbuf, this.format.fromABGR, src.format.toABGR, chan.maskA);
|
|
1017
|
+
}
|
|
1018
|
+
return this;
|
|
1019
|
+
}
|
|
1020
|
+
invert() {
|
|
1021
|
+
const { data, format } = this;
|
|
1022
|
+
const mask = Math.pow(2, format.size - format.alpha) - 1;
|
|
1023
|
+
for (let i = data.length; i-- > 0;) data[i] ^= mask;
|
|
1024
|
+
return this;
|
|
1025
|
+
}
|
|
1026
|
+
premultiply() {
|
|
1027
|
+
ensureAlpha(this.format);
|
|
1028
|
+
__transformABGR(this.data, this.format, premultiplyInt);
|
|
1029
|
+
return this;
|
|
1030
|
+
}
|
|
1031
|
+
postmultiply() {
|
|
1032
|
+
__transformABGR(this.data, this.format, postmultiplyInt);
|
|
1033
|
+
return this;
|
|
1034
|
+
}
|
|
1035
|
+
isPremultiplied() {
|
|
1036
|
+
const pix = this.data;
|
|
1037
|
+
const to = this.format.toABGR;
|
|
1038
|
+
for (let i = pix.length; i-- > 0;) if (!isPremultipliedInt(to(pix[i]))) return false;
|
|
1039
|
+
return true;
|
|
1040
|
+
}
|
|
1041
|
+
forEach(f) {
|
|
1042
|
+
const pix = this.data;
|
|
1043
|
+
for (let i = pix.length; i-- > 0;) pix[i] = f(pix[i], i);
|
|
1044
|
+
return this;
|
|
1045
|
+
}
|
|
1046
|
+
fill(x) {
|
|
1047
|
+
this.data.fill(x);
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Flips image horizontally.
|
|
1051
|
+
*/
|
|
1052
|
+
flipX() {
|
|
1053
|
+
const { data, width } = this;
|
|
1054
|
+
for (let i = 0; i < data.length; i += width) data.subarray(i, i + width).reverse();
|
|
1055
|
+
return this;
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Flips image vertically.
|
|
1059
|
+
*/
|
|
1060
|
+
flipY() {
|
|
1061
|
+
const { data, width } = this;
|
|
1062
|
+
const tmp = typedArray(this.format.type, width);
|
|
1063
|
+
for (let i = 0, j = data.length - width; i < j; i += width, j -= width) {
|
|
1064
|
+
tmp.set(data.subarray(i, i + width));
|
|
1065
|
+
data.copyWithin(i, j, j + width);
|
|
1066
|
+
data.set(tmp, j);
|
|
1067
|
+
}
|
|
1068
|
+
return this;
|
|
1069
|
+
}
|
|
1070
|
+
rotateByID(id) {
|
|
1071
|
+
return id > 0 ? this[ROT_IDS[id - 1]]() : this;
|
|
1072
|
+
}
|
|
1073
|
+
rotateCW() {
|
|
1074
|
+
const { width, height } = this;
|
|
1075
|
+
const h1 = height - 1;
|
|
1076
|
+
this._rotate((x, y) => x * height + h1 - y);
|
|
1077
|
+
this.size[0] = height;
|
|
1078
|
+
this.size[1] = width;
|
|
1079
|
+
return this;
|
|
1080
|
+
}
|
|
1081
|
+
rotateCCW() {
|
|
1082
|
+
const { width, height } = this;
|
|
1083
|
+
const w1 = width - 1;
|
|
1084
|
+
this._rotate((x, y) => (w1 - x) * height + y);
|
|
1085
|
+
this.size[0] = height;
|
|
1086
|
+
this.size[1] = width;
|
|
1087
|
+
return this;
|
|
1088
|
+
}
|
|
1089
|
+
rotate180() {
|
|
1090
|
+
const { width, height } = this;
|
|
1091
|
+
const w1 = width - 1;
|
|
1092
|
+
const h1 = height - 1;
|
|
1093
|
+
this._rotate((x, y) => (h1 - y) * width + w1 - x);
|
|
1094
|
+
return this;
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Returns scaled version of this buffer using given sampler or filter
|
|
1098
|
+
* (default: `"linear"`) for interpolation. Syntax sugar for
|
|
1099
|
+
* {@link IntBuffer.resize}.
|
|
1100
|
+
*
|
|
1101
|
+
* @param scale -
|
|
1102
|
+
*/
|
|
1103
|
+
scale(scale, sampler = "linear") {
|
|
1104
|
+
assert(scale > 0, `scale must be > 0`);
|
|
1105
|
+
return this.resize(this.width * scale, this.height * scale, sampler);
|
|
1106
|
+
}
|
|
1107
|
+
resize(w, h, sampler = "linear") {
|
|
1108
|
+
w |= 0;
|
|
1109
|
+
h |= 0;
|
|
1110
|
+
assert(w > 0 && h > 0, `target width & height must be > 0`);
|
|
1111
|
+
const dest = intBuffer(w, h, this.format);
|
|
1112
|
+
const dpix = dest.data;
|
|
1113
|
+
const scaleX = w > 0 ? this.width / w : 0;
|
|
1114
|
+
const scaleY = h > 0 ? this.height / h : 0;
|
|
1115
|
+
sampler = isString(sampler) ? defSampler(this, sampler, "repeat") : sampler;
|
|
1116
|
+
for (let y = 0, i = 0; y < h; y++) {
|
|
1117
|
+
const yy = y * scaleY;
|
|
1118
|
+
for (let x = 0; x < w; x++, i++) dpix[i] = sampler(x * scaleX, yy);
|
|
1119
|
+
}
|
|
1120
|
+
return dest;
|
|
1121
|
+
}
|
|
1122
|
+
upsize() {
|
|
1123
|
+
const { width, height, data } = this;
|
|
1124
|
+
const dest = new IntBuffer(width * 2, height * 2, this.format);
|
|
1125
|
+
const dpix = dest.data;
|
|
1126
|
+
for (let y = 0, si = 0; y < height; y++) for (let x = 0, di = y * width * 4; x < width; x++, si++, di += 2) dpix[di] = data[si];
|
|
1127
|
+
return dest;
|
|
1128
|
+
}
|
|
1129
|
+
_rotate(idxFn) {
|
|
1130
|
+
const { data, format, width, height } = this;
|
|
1131
|
+
const tmp = typedArray(format.type, width * height);
|
|
1132
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) tmp[idxFn(x, y)] = data[y * width + x];
|
|
1133
|
+
this.data = tmp;
|
|
1134
|
+
}
|
|
1135
|
+
};
|
|
1136
|
+
IntBuffer = __decorateClass$1([IGrid2DMixin], IntBuffer);
|
|
1137
|
+
//#endregion
|
|
1138
|
+
//#region node_modules/@thi.ng/pixel/float.js
|
|
1139
|
+
var __defProp = Object.defineProperty;
|
|
1140
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1141
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
1142
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
1143
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1144
|
+
if (kind && result) __defProp(target, key, result);
|
|
1145
|
+
return result;
|
|
1146
|
+
};
|
|
1147
|
+
function floatBuffer(...args) {
|
|
1148
|
+
return args[0] instanceof IntBuffer ? floatBufferFromInt(...args) : new FloatBuffer(...args);
|
|
1149
|
+
}
|
|
1150
|
+
var floatBufferFromInt = (src, fmt) => {
|
|
1151
|
+
const dest = new FloatBuffer(src.width, src.height, fmt);
|
|
1152
|
+
const { data: dbuf, format: dfmt, stride: [stride] } = dest;
|
|
1153
|
+
const { data: sbuf, format: sfmt } = src;
|
|
1154
|
+
for (let i = sbuf.length; i-- > 0;) dbuf.set(dfmt.fromABGR(sfmt.toABGR(sbuf[i])), i * stride);
|
|
1155
|
+
return dest;
|
|
1156
|
+
};
|
|
1157
|
+
var floatBufferFromCanvas = (canvas, fmt = FLOAT_RGBA) => intBufferFromCanvas(canvas).as(fmt);
|
|
1158
|
+
var FloatBuffer = class {
|
|
1159
|
+
size;
|
|
1160
|
+
stride;
|
|
1161
|
+
format;
|
|
1162
|
+
data;
|
|
1163
|
+
__empty;
|
|
1164
|
+
constructor(w, h, fmt = FLOAT_RGBA, data) {
|
|
1165
|
+
this.size = [w, h];
|
|
1166
|
+
this.format = fmt.__float ? fmt : defFloatFormat(fmt);
|
|
1167
|
+
const stride = this.format.channels.length;
|
|
1168
|
+
this.stride = [stride, w * stride];
|
|
1169
|
+
this.data = data || new Float32Array(w * h * stride);
|
|
1170
|
+
this.__empty = Object.freeze(new Array(stride).fill(0));
|
|
1171
|
+
}
|
|
1172
|
+
/** @deprecated use `.data` instead */
|
|
1173
|
+
get pixels() {
|
|
1174
|
+
return this.data;
|
|
1175
|
+
}
|
|
1176
|
+
get width() {
|
|
1177
|
+
return this.size[0];
|
|
1178
|
+
}
|
|
1179
|
+
get height() {
|
|
1180
|
+
return this.size[1];
|
|
1181
|
+
}
|
|
1182
|
+
get offset() {
|
|
1183
|
+
return 0;
|
|
1184
|
+
}
|
|
1185
|
+
get dim() {
|
|
1186
|
+
return 2;
|
|
1187
|
+
}
|
|
1188
|
+
*[Symbol.iterator]() {
|
|
1189
|
+
const { data, stride: [stride] } = this;
|
|
1190
|
+
for (let i = 0, n = data.length; i < n; i += stride) yield data.subarray(i, i + stride);
|
|
1191
|
+
}
|
|
1192
|
+
as(fmt) {
|
|
1193
|
+
const { width, height, stride: [stride], data, format: { size, normalized: getNormalized, toABGR } } = this;
|
|
1194
|
+
let i = 0, j = 0, n = data.length;
|
|
1195
|
+
if (fmt.__float) {
|
|
1196
|
+
const $fmt = fmt;
|
|
1197
|
+
const dest = new FloatBuffer(width, height, $fmt);
|
|
1198
|
+
const { data: dpixels, stride: [dstride] } = dest;
|
|
1199
|
+
if (size === 1 && $fmt.channels.length === 1) {
|
|
1200
|
+
const setNormalized = $fmt.fromNormalized;
|
|
1201
|
+
for (; i < n; i += stride, j += dstride) dpixels[j] = setNormalized(getNormalized(data[i]));
|
|
1202
|
+
} else for (; i < n; i += stride, j += dstride) dpixels.set($fmt.fromABGR(toABGR(data.subarray(i, i + stride))), j);
|
|
1203
|
+
return dest;
|
|
1204
|
+
} else {
|
|
1205
|
+
const $fmt = fmt;
|
|
1206
|
+
const dest = new IntBuffer(width, height, $fmt);
|
|
1207
|
+
const dpixels = dest.data;
|
|
1208
|
+
if (size === 1 && $fmt.channels.length === 1) {
|
|
1209
|
+
const setFloat = $fmt.channels[0].setFloat;
|
|
1210
|
+
for (; i < n; i += stride, j++) dpixels[j] = setFloat(0, getNormalized(data[i]));
|
|
1211
|
+
} else for (; i < n; i += stride, j++) dpixels[j] = $fmt.fromABGR(toABGR(data.subarray(i, i + stride)));
|
|
1212
|
+
return dest;
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
copy() {
|
|
1216
|
+
const dest = this.empty();
|
|
1217
|
+
dest.data.set(this.data);
|
|
1218
|
+
return dest;
|
|
1219
|
+
}
|
|
1220
|
+
empty() {
|
|
1221
|
+
return new FloatBuffer(this.width, this.height, this.format);
|
|
1222
|
+
}
|
|
1223
|
+
order() {}
|
|
1224
|
+
includes(x, y) {}
|
|
1225
|
+
indexAt(x, y) {}
|
|
1226
|
+
indexAtUnsafe(x, y) {}
|
|
1227
|
+
getAt(x, y) {
|
|
1228
|
+
return this.includes(x, y) ? this.getAtUnsafe(x, y) : this.__empty;
|
|
1229
|
+
}
|
|
1230
|
+
getAtUnsafe(x, y) {
|
|
1231
|
+
const idx = this.indexAtUnsafe(x, y);
|
|
1232
|
+
return this.data.subarray(idx, idx + this.stride[0]);
|
|
1233
|
+
}
|
|
1234
|
+
setAt(x, y, col) {
|
|
1235
|
+
return this.includes(x, y) ? (this.data.set(col, this.indexAtUnsafe(x, y)), true) : false;
|
|
1236
|
+
}
|
|
1237
|
+
setAtUnsafe(x, y, col) {
|
|
1238
|
+
this.data.set(col, this.indexAtUnsafe(x, y));
|
|
1239
|
+
return true;
|
|
1240
|
+
}
|
|
1241
|
+
getChannelAt(x, y, id) {
|
|
1242
|
+
ensureChannel(this.format, id);
|
|
1243
|
+
return this.includes(x, y) ? this.data[this.indexAtUnsafe(x, y) + id] : void 0;
|
|
1244
|
+
}
|
|
1245
|
+
setChannelAt(x, y, id, col) {
|
|
1246
|
+
ensureChannel(this.format, id);
|
|
1247
|
+
this.includes(x, y) && (this.data[this.indexAtUnsafe(x, y) + id] = col);
|
|
1248
|
+
return this;
|
|
1249
|
+
}
|
|
1250
|
+
getChannel(id) {
|
|
1251
|
+
ensureChannel(this.format, id);
|
|
1252
|
+
const { data, stride: [stride] } = this;
|
|
1253
|
+
const [min, max] = this.format.range;
|
|
1254
|
+
const dest = new Float32Array(this.width * this.height);
|
|
1255
|
+
for (let i = id, j = 0, n = data.length; i < n; i += stride, j++) dest[j] = clamp$1(data[i], min, max);
|
|
1256
|
+
return new FloatBuffer(this.width, this.height, FLOAT_GRAY, dest);
|
|
1257
|
+
}
|
|
1258
|
+
setChannel(id, src) {
|
|
1259
|
+
ensureChannel(this.format, id);
|
|
1260
|
+
const { data: dest, stride: [stride] } = this;
|
|
1261
|
+
if (isNumber(src)) for (let i = id, n = dest.length; i < n; i += stride) dest[i] = src;
|
|
1262
|
+
else {
|
|
1263
|
+
const { data: sbuf, stride: [sstride] } = src;
|
|
1264
|
+
ensureSize(sbuf, this.width, this.height, sstride);
|
|
1265
|
+
for (let i = id, j = 0, n = dest.length; i < n; i += stride, j += sstride) dest[i] = sbuf[j];
|
|
1266
|
+
}
|
|
1267
|
+
return this;
|
|
1268
|
+
}
|
|
1269
|
+
blend(op, dest, opts) {
|
|
1270
|
+
this.ensureFormat(dest);
|
|
1271
|
+
const { sx, sy, dx, dy, rw, rh } = __prepRegions(this, dest, opts);
|
|
1272
|
+
if (rw < 1 || rh < 1) return dest;
|
|
1273
|
+
const sbuf = this.data;
|
|
1274
|
+
const dbuf = dest.data;
|
|
1275
|
+
const [stride, sw] = this.stride;
|
|
1276
|
+
const dw = dest.stride[1];
|
|
1277
|
+
for (let si = (sx | 0) * stride + (sy | 0) * sw, di = (dx | 0) * stride + (dy | 0) * dw, yy = 0; yy < rh; yy++, si += sw, di += dw) for (let xx = rw, sii = si, dii = di; xx-- > 0; sii += stride, dii += stride) {
|
|
1278
|
+
const out = dbuf.subarray(dii, dii + stride);
|
|
1279
|
+
op(out, sbuf.subarray(sii, sii + stride), out);
|
|
1280
|
+
}
|
|
1281
|
+
return dest;
|
|
1282
|
+
}
|
|
1283
|
+
blit(dest, opts) {
|
|
1284
|
+
this.ensureFormat(dest);
|
|
1285
|
+
const { sx, sy, dx, dy, rw, rh } = __prepRegions(this, dest, opts);
|
|
1286
|
+
if (rw < 1 || rh < 1) return dest;
|
|
1287
|
+
const sbuf = this.data;
|
|
1288
|
+
const dbuf = dest.data;
|
|
1289
|
+
const [stride, sw] = this.stride;
|
|
1290
|
+
const dw = dest.stride[1];
|
|
1291
|
+
const rww = rw * stride;
|
|
1292
|
+
for (let si = (sx | 0) * stride + (sy | 0) * sw, di = (dx | 0) * stride + (dy | 0) * dw, yy = 0; yy < rh; yy++, si += sw, di += dw) dbuf.set(sbuf.subarray(si, si + rww), di);
|
|
1293
|
+
return dest;
|
|
1294
|
+
}
|
|
1295
|
+
blitCanvas(canvas, opts = {}) {
|
|
1296
|
+
__blitCanvas(this, canvas, opts);
|
|
1297
|
+
}
|
|
1298
|
+
setImageData(idata) {
|
|
1299
|
+
ensureImageDataSize(idata, this.width, this.height);
|
|
1300
|
+
const src = new Uint32Array(idata.data.buffer);
|
|
1301
|
+
const { data: dest, format: { fromABGR }, stride: [stride] } = this;
|
|
1302
|
+
const tmp = [];
|
|
1303
|
+
for (let i = src.length; i-- > 0;) dest.set(fromABGR(src[i], tmp), i * stride);
|
|
1304
|
+
return this;
|
|
1305
|
+
}
|
|
1306
|
+
toImageData(idata) {
|
|
1307
|
+
idata = ensureImageData(idata, this.width, this.height);
|
|
1308
|
+
const dest = new Uint32Array(idata.data.buffer);
|
|
1309
|
+
const { stride: [stride], data, format } = this;
|
|
1310
|
+
for (let i = 0, j = 0, n = data.length; i < n; i += stride, j++) dest[j] = format.toABGR(data.subarray(i, i + stride));
|
|
1311
|
+
return idata;
|
|
1312
|
+
}
|
|
1313
|
+
getRegion(x, y, width, height) {
|
|
1314
|
+
const [sx, sy, w, h] = __clampRegion(x, y, width, height, this.width, this.height);
|
|
1315
|
+
if (w < 1 || h < 1) return;
|
|
1316
|
+
return this.blit(new FloatBuffer(w, h, this.format), {
|
|
1317
|
+
sx,
|
|
1318
|
+
sy,
|
|
1319
|
+
w,
|
|
1320
|
+
h
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
forEach(f) {
|
|
1324
|
+
const { data, stride: [stride] } = this;
|
|
1325
|
+
for (let i = 0, j = 0, n = data.length; i < n; i += stride, j++) data.set(f(data.subarray(i, i + stride), j), i);
|
|
1326
|
+
return this;
|
|
1327
|
+
}
|
|
1328
|
+
fill(x) {
|
|
1329
|
+
assert(x.length <= this.format.channels.length, `fill value has too many channels`);
|
|
1330
|
+
const { data, stride: [stride] } = this;
|
|
1331
|
+
for (let i = 0, n = data.length; i < n; i += stride) data.set(x, i);
|
|
1332
|
+
}
|
|
1333
|
+
premultiply() {
|
|
1334
|
+
this.ensureRGBA();
|
|
1335
|
+
const { data, stride: [stride] } = this;
|
|
1336
|
+
for (let i = 0, n = data.length; i < n; i += stride) premultiply(null, data.subarray(i, i + stride));
|
|
1337
|
+
return this;
|
|
1338
|
+
}
|
|
1339
|
+
postmultiply() {
|
|
1340
|
+
this.ensureRGBA();
|
|
1341
|
+
const { data, stride: [stride] } = this;
|
|
1342
|
+
for (let i = 0, n = data.length; i < n; i += stride) postmultiply(null, data.subarray(i, i + stride));
|
|
1343
|
+
return this;
|
|
1344
|
+
}
|
|
1345
|
+
isPremultiplied() {
|
|
1346
|
+
this.ensureRGBA();
|
|
1347
|
+
const { data, stride: [stride] } = this;
|
|
1348
|
+
for (let i = 0, n = data.length; i < n; i += stride) if (!isPremultiplied(data.subarray(i, i + stride))) return false;
|
|
1349
|
+
return true;
|
|
1350
|
+
}
|
|
1351
|
+
clamp() {
|
|
1352
|
+
const data = this.data;
|
|
1353
|
+
const [min, max] = this.format.range;
|
|
1354
|
+
for (let i = data.length; i-- > 0;) data[i] = clamp$1(data[i], min, max);
|
|
1355
|
+
return this;
|
|
1356
|
+
}
|
|
1357
|
+
clampChannel(id) {
|
|
1358
|
+
ensureChannel(this.format, id);
|
|
1359
|
+
const { data, stride: [stride] } = this;
|
|
1360
|
+
const [min, max] = this.format.range;
|
|
1361
|
+
for (let i = id, n = data.length; i < n; i += stride) data[i] = clamp$1(data[i], min, max);
|
|
1362
|
+
}
|
|
1363
|
+
flipX() {
|
|
1364
|
+
const { data, width, height, stride: [sx, sy] } = this;
|
|
1365
|
+
const tmp = new Float32Array(sx);
|
|
1366
|
+
const w1 = width - 1;
|
|
1367
|
+
const w2 = width >>> 1;
|
|
1368
|
+
for (let y = 0; y < height; y++) for (let x = 0, i = y * sy, j = i + w1 * sx; x < w2; x++, i += sx, j -= sx) {
|
|
1369
|
+
tmp.set(data.subarray(i, i + sx));
|
|
1370
|
+
data.copyWithin(i, j, j + sx);
|
|
1371
|
+
data.set(tmp, j);
|
|
1372
|
+
}
|
|
1373
|
+
return this;
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Flips image vertically.
|
|
1377
|
+
*/
|
|
1378
|
+
flipY() {
|
|
1379
|
+
const data = this.data;
|
|
1380
|
+
const rowStride = this.stride[1];
|
|
1381
|
+
const tmp = new Float32Array(rowStride);
|
|
1382
|
+
for (let i = 0, j = data.length - rowStride; i < j; i += rowStride, j -= rowStride) {
|
|
1383
|
+
tmp.set(data.subarray(i, i + rowStride));
|
|
1384
|
+
data.copyWithin(i, j, j + rowStride);
|
|
1385
|
+
data.set(tmp, j);
|
|
1386
|
+
}
|
|
1387
|
+
return this;
|
|
1388
|
+
}
|
|
1389
|
+
rotateByID(id) {
|
|
1390
|
+
return id > 0 ? this[ROT_IDS[id - 1]]() : this;
|
|
1391
|
+
}
|
|
1392
|
+
rotateCW() {
|
|
1393
|
+
const { width, height } = this;
|
|
1394
|
+
const h1 = height - 1;
|
|
1395
|
+
this._rotate((x, y) => x * height + h1 - y);
|
|
1396
|
+
this.size[0] = height;
|
|
1397
|
+
this.size[1] = width;
|
|
1398
|
+
return this;
|
|
1399
|
+
}
|
|
1400
|
+
rotateCCW() {
|
|
1401
|
+
const { width, height } = this;
|
|
1402
|
+
const w1 = width - 1;
|
|
1403
|
+
this._rotate((x, y) => (w1 - x) * height + y);
|
|
1404
|
+
this.size[0] = height;
|
|
1405
|
+
this.size[1] = width;
|
|
1406
|
+
return this;
|
|
1407
|
+
}
|
|
1408
|
+
rotate180() {
|
|
1409
|
+
const { width, height } = this;
|
|
1410
|
+
const w1 = width - 1;
|
|
1411
|
+
const h1 = height - 1;
|
|
1412
|
+
this._rotate((x, y) => (h1 - y) * width + w1 - x);
|
|
1413
|
+
return this;
|
|
1414
|
+
}
|
|
1415
|
+
invert() {
|
|
1416
|
+
const { data, format, stride: [stride] } = this;
|
|
1417
|
+
for (let i = 0, n = data.length, m = format.alpha ? stride - 1 : stride; i < n; i += stride) for (let j = 0; j < m; j++) data[i + j] = 1 - data[i + j];
|
|
1418
|
+
return this;
|
|
1419
|
+
}
|
|
1420
|
+
scale(scale, sampler) {
|
|
1421
|
+
assert(scale > 0, `scale must be > 0`);
|
|
1422
|
+
return this.resize(this.width * scale, this.height * scale, sampler);
|
|
1423
|
+
}
|
|
1424
|
+
resize(w, h, sampler = "linear") {
|
|
1425
|
+
w |= 0;
|
|
1426
|
+
h |= 0;
|
|
1427
|
+
assert(w > 0 && h > 0, `target width & height must be > 0`);
|
|
1428
|
+
const dest = floatBuffer(w, h, this.format);
|
|
1429
|
+
const dpix = dest.data;
|
|
1430
|
+
const scaleX = w > 0 ? this.width / w : 0;
|
|
1431
|
+
const scaleY = h > 0 ? this.height / h : 0;
|
|
1432
|
+
const stride = this.stride[0];
|
|
1433
|
+
sampler = isString(sampler) ? defSampler(this, sampler, "repeat") : sampler;
|
|
1434
|
+
for (let y = 0, i = 0; y < h; y++) {
|
|
1435
|
+
const yy = y * scaleY;
|
|
1436
|
+
for (let x = 0; x < w; x++, i += stride) dpix.set(sampler(x * scaleX, yy), i);
|
|
1437
|
+
}
|
|
1438
|
+
return dest;
|
|
1439
|
+
}
|
|
1440
|
+
upsize() {
|
|
1441
|
+
const { width, height, data, stride: [stride, rowStride] } = this;
|
|
1442
|
+
const stride2x = stride * 2;
|
|
1443
|
+
const dest = floatBuffer(width * 2, height * 2, this.format);
|
|
1444
|
+
const dpix = dest.data;
|
|
1445
|
+
for (let y = 0, si = 0; y < height; y++) for (let x = 0, di = y * rowStride * 4; x < width; x++, si += stride, di += stride2x) dpix.set(data.subarray(si, si + stride), di);
|
|
1446
|
+
return dest;
|
|
1447
|
+
}
|
|
1448
|
+
_rotate(idxFn) {
|
|
1449
|
+
const { data, width, height, stride: [stride] } = this;
|
|
1450
|
+
const tmp = new Float32Array(width * height * stride);
|
|
1451
|
+
for (let y = 0, i = 0; y < height; y++) for (let x = 0; x < width; x++, i += stride) tmp.set(data.subarray(i, i + stride), idxFn(x, y) * stride);
|
|
1452
|
+
this.data = tmp;
|
|
1453
|
+
}
|
|
1454
|
+
ensureFormat(dest) {
|
|
1455
|
+
assert(dest.format === this.format, `dest buffer format must be same as src`);
|
|
1456
|
+
}
|
|
1457
|
+
ensureRGBA() {
|
|
1458
|
+
assert(this.format === FLOAT_RGBA, "require FLOAT_RGBA format");
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
__decorateClass([nomixin], FloatBuffer.prototype, "getAt", 1);
|
|
1462
|
+
__decorateClass([nomixin], FloatBuffer.prototype, "getAtUnsafe", 1);
|
|
1463
|
+
__decorateClass([nomixin], FloatBuffer.prototype, "setAt", 1);
|
|
1464
|
+
__decorateClass([nomixin], FloatBuffer.prototype, "setAtUnsafe", 1);
|
|
1465
|
+
FloatBuffer = __decorateClass([IGrid2DMixin], FloatBuffer);
|
|
1466
|
+
//#endregion
|
|
1467
|
+
//#region node_modules/@thi.ng/math/fit.js
|
|
1468
|
+
var norm = (x, a, b) => b !== a ? (x - a) / (b - a) : 0;
|
|
1469
|
+
var fit = (x, a, b, c, d) => c + (d - c) * norm(x, a, b);
|
|
1470
|
+
//#endregion
|
|
1471
|
+
//#region node_modules/@thi.ng/pixel/format/float-hsva.js
|
|
1472
|
+
var abs$1 = Math.abs;
|
|
1473
|
+
var min = Math.min;
|
|
1474
|
+
var FLOAT_HSVA = defFloatFormat({
|
|
1475
|
+
alpha: true,
|
|
1476
|
+
channels: [
|
|
1477
|
+
Lane.RED,
|
|
1478
|
+
Lane.GREEN,
|
|
1479
|
+
Lane.BLUE,
|
|
1480
|
+
Lane.ALPHA
|
|
1481
|
+
],
|
|
1482
|
+
convert: {
|
|
1483
|
+
fromABGR: (x, out = []) => {
|
|
1484
|
+
const a = (x >>> 24 & 255) / 255;
|
|
1485
|
+
const b = (x >>> 16 & 255) / 255;
|
|
1486
|
+
const g = (x >>> 8 & 255) / 255;
|
|
1487
|
+
const r = (x & 255) / 255;
|
|
1488
|
+
let p0, p1, p2, p3;
|
|
1489
|
+
let q0, q1, q2, q3;
|
|
1490
|
+
if (g < b) {
|
|
1491
|
+
p0 = b;
|
|
1492
|
+
p1 = g;
|
|
1493
|
+
p2 = -1;
|
|
1494
|
+
p3 = 2 / 3;
|
|
1495
|
+
} else {
|
|
1496
|
+
p0 = g;
|
|
1497
|
+
p1 = b;
|
|
1498
|
+
p2 = 0;
|
|
1499
|
+
p3 = -1 / 3;
|
|
1500
|
+
}
|
|
1501
|
+
if (r < p0) {
|
|
1502
|
+
q0 = p0;
|
|
1503
|
+
q1 = p1;
|
|
1504
|
+
q2 = p3;
|
|
1505
|
+
q3 = r;
|
|
1506
|
+
} else {
|
|
1507
|
+
q0 = r;
|
|
1508
|
+
q1 = p1;
|
|
1509
|
+
q2 = p2;
|
|
1510
|
+
q3 = p0;
|
|
1511
|
+
}
|
|
1512
|
+
const c = q0 - min(q1, q3);
|
|
1513
|
+
q0 = clamp01(q0);
|
|
1514
|
+
out[0] = clamp01(abs$1((q3 - q1) / (6 * c + EPS$1) + q2));
|
|
1515
|
+
out[1] = clamp01(c / (q0 + EPS$1));
|
|
1516
|
+
out[2] = q0;
|
|
1517
|
+
out[3] = a;
|
|
1518
|
+
return out;
|
|
1519
|
+
},
|
|
1520
|
+
toABGR: (x) => {
|
|
1521
|
+
const h = x[0] * 6;
|
|
1522
|
+
const s = x[1];
|
|
1523
|
+
const v = x[2] * 255;
|
|
1524
|
+
const a = x[3] * 255;
|
|
1525
|
+
const r = ((clamp01(abs$1(h - 3) - 1) - 1) * s + 1) * v;
|
|
1526
|
+
const g = ((clamp01(2 - abs$1(h - 2)) - 1) * s + 1) * v;
|
|
1527
|
+
const b = ((clamp01(2 - abs$1(h - 4)) - 1) * s + 1) * v;
|
|
1528
|
+
return (a << 24 | b << 16 | g << 8 | r) >>> 0;
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
});
|
|
1532
|
+
//#endregion
|
|
1533
|
+
//#region node_modules/@thi.ng/pixel/format/float-rgba.js
|
|
1534
|
+
var FLOAT_RGBA = defFloatFormat({
|
|
1535
|
+
alpha: true,
|
|
1536
|
+
channels: [
|
|
1537
|
+
Lane.RED,
|
|
1538
|
+
Lane.GREEN,
|
|
1539
|
+
Lane.BLUE,
|
|
1540
|
+
Lane.ALPHA
|
|
1541
|
+
]
|
|
1542
|
+
});
|
|
1543
|
+
//#endregion
|
|
1544
|
+
//#region node_modules/@thi.ng/errors/unsupported.js
|
|
1545
|
+
var UnsupportedOperationError = defError(() => "unsupported operation");
|
|
1546
|
+
var unsupportedOp = (msg) => {
|
|
1547
|
+
throw new UnsupportedOperationError(msg);
|
|
1548
|
+
};
|
|
1549
|
+
var UnsupportedFeatureError = defError(() => "unsupported feature");
|
|
1550
|
+
//#endregion
|
|
1551
|
+
//#region node_modules/@thi.ng/vectors/vop.js
|
|
1552
|
+
var vop = (dispatch = 1, fallback, ...optimized) => {
|
|
1553
|
+
const impls = [, ,].concat(optimized);
|
|
1554
|
+
const fn = (...args) => {
|
|
1555
|
+
const g = impls[args[dispatch].length] || fallback;
|
|
1556
|
+
return g ? g(...args) : unsupportedOp(`no impl for vec size ${args[dispatch].length}`);
|
|
1557
|
+
};
|
|
1558
|
+
fn.add = (dim, fn2) => impls[dim] = fn2;
|
|
1559
|
+
fn.default = (fn2) => fallback = fn2;
|
|
1560
|
+
fn.impl = (dim) => dim != null ? impls[dim] || fallback : fallback;
|
|
1561
|
+
return fn;
|
|
1562
|
+
};
|
|
1563
|
+
//#endregion
|
|
1564
|
+
//#region node_modules/@thi.ng/vectors/dot.js
|
|
1565
|
+
var dot2 = (a, b) => a[0] * b[0] + a[1] * b[1];
|
|
1566
|
+
var dot3 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
1567
|
+
var dot4 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
|
|
1568
|
+
var dot = vop(0, (a, b) => {
|
|
1569
|
+
let sum = 0;
|
|
1570
|
+
for (let i = a.length; i-- > 0;) sum += a[i] * b[i];
|
|
1571
|
+
return sum;
|
|
1572
|
+
}, dot2, dot3, dot4);
|
|
1573
|
+
//#endregion
|
|
1574
|
+
//#region node_modules/@thi.ng/memoize/memoizej.js
|
|
1575
|
+
function memoizeJ(fn, cache = Object.create(null)) {
|
|
1576
|
+
return (...args) => {
|
|
1577
|
+
const key = JSON.stringify(args);
|
|
1578
|
+
if (key !== void 0) return key in cache ? cache[key] : cache[key] = fn.apply(null, args);
|
|
1579
|
+
return fn.apply(null, args);
|
|
1580
|
+
};
|
|
1581
|
+
}
|
|
1582
|
+
//#endregion
|
|
1583
|
+
//#region node_modules/@thi.ng/memoize/memoizeo.js
|
|
1584
|
+
function memoizeO(fn, cache = Object.create(null)) {
|
|
1585
|
+
return (...xs) => {
|
|
1586
|
+
const key = xs.join("-");
|
|
1587
|
+
return key in cache ? cache[key] : cache[key] = fn(...xs);
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1590
|
+
//#endregion
|
|
1591
|
+
//#region node_modules/@thi.ng/strings/repeat.js
|
|
1592
|
+
var repeat$1 = memoizeO((ch, n) => ch.repeat(n));
|
|
1593
|
+
//#endregion
|
|
1594
|
+
//#region node_modules/@thi.ng/strings/pad-left.js
|
|
1595
|
+
var padLeft = memoizeO((n, ch = " ") => {
|
|
1596
|
+
const buf = repeat$1(String(ch), n);
|
|
1597
|
+
return (x, len) => {
|
|
1598
|
+
if (x == null) return buf;
|
|
1599
|
+
x = x.toString();
|
|
1600
|
+
len = len !== void 0 ? len : x.length;
|
|
1601
|
+
return len < n ? buf.substring(len) + x : x;
|
|
1602
|
+
};
|
|
1603
|
+
});
|
|
1604
|
+
var Z2 = padLeft(2, "0");
|
|
1605
|
+
var Z3$1 = padLeft(3, "0");
|
|
1606
|
+
var Z4$1 = padLeft(4, "0");
|
|
1607
|
+
//#endregion
|
|
1608
|
+
//#region node_modules/@thi.ng/strings/float.js
|
|
1609
|
+
var float = memoizeJ((prec, special = false) => special ? (x) => __nanOrInf(x) || x.toFixed(prec) : (x) => x.toFixed(prec));
|
|
1610
|
+
var floatFixedWidth = memoizeJ((width, prec = 3) => {
|
|
1611
|
+
const l = width - prec - 1;
|
|
1612
|
+
const pl = Math.pow(10, l);
|
|
1613
|
+
const pln = -Math.pow(10, l - 1);
|
|
1614
|
+
const pr = Math.pow(10, -(prec - 1));
|
|
1615
|
+
const pad = padLeft(width);
|
|
1616
|
+
return (x) => {
|
|
1617
|
+
const ax = Math.abs(x);
|
|
1618
|
+
return pad(__nanOrInf(x) || (x === 0 ? "0" : ax < pr || ax >= pl ? __exp(x, width) : x.toFixed(prec - (x < pln ? 1 : 0))));
|
|
1619
|
+
};
|
|
1620
|
+
});
|
|
1621
|
+
var __exp = (x, w) => x.toExponential(Math.max(w - 4 - (Math.log(Math.abs(x)) / Math.LN10 >= 10 ? 2 : 1) - (x < 0 ? 1 : 0), 0));
|
|
1622
|
+
var __nanOrInf = (x) => isNaN(x) ? "NaN" : x === Infinity ? "+∞" : x === -Infinity ? "-∞" : void 0;
|
|
1623
|
+
//#endregion
|
|
1624
|
+
//#region node_modules/@thi.ng/strings/percent.js
|
|
1625
|
+
var percent = (prec = 0) => (x) => (x * 100).toFixed(prec) + "%";
|
|
1626
|
+
//#endregion
|
|
1627
|
+
//#region node_modules/@thi.ng/color/api/constants.js
|
|
1628
|
+
var BLACK = Object.freeze([
|
|
1629
|
+
0,
|
|
1630
|
+
0,
|
|
1631
|
+
0,
|
|
1632
|
+
1
|
|
1633
|
+
]);
|
|
1634
|
+
var WHITE = Object.freeze([
|
|
1635
|
+
1,
|
|
1636
|
+
1,
|
|
1637
|
+
1,
|
|
1638
|
+
1
|
|
1639
|
+
]);
|
|
1640
|
+
var RED = Object.freeze([
|
|
1641
|
+
1,
|
|
1642
|
+
0,
|
|
1643
|
+
0,
|
|
1644
|
+
1
|
|
1645
|
+
]);
|
|
1646
|
+
var GREEN = Object.freeze([
|
|
1647
|
+
0,
|
|
1648
|
+
1,
|
|
1649
|
+
0,
|
|
1650
|
+
1
|
|
1651
|
+
]);
|
|
1652
|
+
var BLUE = Object.freeze([
|
|
1653
|
+
0,
|
|
1654
|
+
0,
|
|
1655
|
+
1,
|
|
1656
|
+
1
|
|
1657
|
+
]);
|
|
1658
|
+
var CYAN = Object.freeze([
|
|
1659
|
+
0,
|
|
1660
|
+
1,
|
|
1661
|
+
1,
|
|
1662
|
+
1
|
|
1663
|
+
]);
|
|
1664
|
+
var MAGENTA = Object.freeze([
|
|
1665
|
+
1,
|
|
1666
|
+
0,
|
|
1667
|
+
1,
|
|
1668
|
+
1
|
|
1669
|
+
]);
|
|
1670
|
+
var YELLOW = Object.freeze([
|
|
1671
|
+
1,
|
|
1672
|
+
1,
|
|
1673
|
+
0,
|
|
1674
|
+
1
|
|
1675
|
+
]);
|
|
1676
|
+
var RGB_LUMINANCE_REC601 = [
|
|
1677
|
+
.299,
|
|
1678
|
+
.587,
|
|
1679
|
+
.114
|
|
1680
|
+
];
|
|
1681
|
+
var RGB_LUMINANCE_REC709 = [
|
|
1682
|
+
.2126,
|
|
1683
|
+
.7152,
|
|
1684
|
+
.0722
|
|
1685
|
+
];
|
|
1686
|
+
var XYZ_RGB_D50 = [
|
|
1687
|
+
3.1338561,
|
|
1688
|
+
-.9787684,
|
|
1689
|
+
.0719453,
|
|
1690
|
+
-1.6168667,
|
|
1691
|
+
1.9161415,
|
|
1692
|
+
-.2289914,
|
|
1693
|
+
-.4906146,
|
|
1694
|
+
.033454,
|
|
1695
|
+
1.4052427
|
|
1696
|
+
];
|
|
1697
|
+
var XYZ_RGB_D65 = [
|
|
1698
|
+
3.2404542,
|
|
1699
|
+
-.969266,
|
|
1700
|
+
.0556434,
|
|
1701
|
+
-1.5371385,
|
|
1702
|
+
1.8760108,
|
|
1703
|
+
-.2040259,
|
|
1704
|
+
-.4985314,
|
|
1705
|
+
.041556,
|
|
1706
|
+
1.0572252
|
|
1707
|
+
];
|
|
1708
|
+
var BRADFORD_D65_D50 = [
|
|
1709
|
+
1.0478112,
|
|
1710
|
+
.0295424,
|
|
1711
|
+
-.0092345,
|
|
1712
|
+
.0228866,
|
|
1713
|
+
.9904844,
|
|
1714
|
+
.0150436,
|
|
1715
|
+
-.050127,
|
|
1716
|
+
-.0170491,
|
|
1717
|
+
.7521316
|
|
1718
|
+
];
|
|
1719
|
+
var D50 = [
|
|
1720
|
+
.96422,
|
|
1721
|
+
1,
|
|
1722
|
+
.82521
|
|
1723
|
+
];
|
|
1724
|
+
var D65 = [
|
|
1725
|
+
.95047,
|
|
1726
|
+
1,
|
|
1727
|
+
1.08883
|
|
1728
|
+
];
|
|
1729
|
+
var OKLAB_M2 = [
|
|
1730
|
+
.2104542553,
|
|
1731
|
+
1.9779984951,
|
|
1732
|
+
.0259040371,
|
|
1733
|
+
.793617785,
|
|
1734
|
+
-2.428592205,
|
|
1735
|
+
.7827717662,
|
|
1736
|
+
-.0040720468,
|
|
1737
|
+
.4505937099,
|
|
1738
|
+
-.808675766
|
|
1739
|
+
];
|
|
1740
|
+
var FF = float(3);
|
|
1741
|
+
var PC = percent(3);
|
|
1742
|
+
var INV8BIT = 1 / 255;
|
|
1743
|
+
var EPS = 1 / 256;
|
|
1744
|
+
//#endregion
|
|
1745
|
+
//#region node_modules/@thi.ng/color/luminance-rgb.js
|
|
1746
|
+
var luminanceRgb = (rgb, weights = RGB_LUMINANCE_REC709) => dot3(rgb, weights);
|
|
1747
|
+
var luminanceSrgb = (rgb) => dot3(rgb, RGB_LUMINANCE_REC601);
|
|
1748
|
+
//#endregion
|
|
1749
|
+
//#region node_modules/@thi.ng/vectors/set.js
|
|
1750
|
+
var set2 = (o, a) => {
|
|
1751
|
+
!o && (o = []);
|
|
1752
|
+
o[0] = a[0];
|
|
1753
|
+
o[1] = a[1];
|
|
1754
|
+
return o;
|
|
1755
|
+
};
|
|
1756
|
+
var set3 = (o, a) => {
|
|
1757
|
+
!o && (o = []);
|
|
1758
|
+
o[0] = a[0];
|
|
1759
|
+
o[1] = a[1];
|
|
1760
|
+
o[2] = a[2];
|
|
1761
|
+
return o;
|
|
1762
|
+
};
|
|
1763
|
+
var set4 = (o, a) => {
|
|
1764
|
+
!o && (o = []);
|
|
1765
|
+
o[0] = a[0];
|
|
1766
|
+
o[1] = a[1];
|
|
1767
|
+
o[2] = a[2];
|
|
1768
|
+
o[3] = a[3];
|
|
1769
|
+
return o;
|
|
1770
|
+
};
|
|
1771
|
+
var set = vop(1, (o, a) => {
|
|
1772
|
+
!o && (o = []);
|
|
1773
|
+
for (let i = a.length; i-- > 0;) o[i] = a[i];
|
|
1774
|
+
return o;
|
|
1775
|
+
}, set2, set3, set4);
|
|
1776
|
+
//#endregion
|
|
1777
|
+
//#region node_modules/@thi.ng/checks/implements-function.js
|
|
1778
|
+
var implementsFunction = (x, fn) => typeof x?.[fn] === "function";
|
|
1779
|
+
//#endregion
|
|
1780
|
+
//#region node_modules/@thi.ng/checks/is-arraylike.js
|
|
1781
|
+
var isArrayLike = (x) => x != null && typeof x !== "function" && x.length !== void 0;
|
|
1782
|
+
//#endregion
|
|
1783
|
+
//#region node_modules/@thi.ng/errors/illegal-arguments.js
|
|
1784
|
+
var IllegalArgumentError = defError(() => "illegal argument(s)");
|
|
1785
|
+
var illegalArgs = (msg) => {
|
|
1786
|
+
throw new IllegalArgumentError(msg);
|
|
1787
|
+
};
|
|
1788
|
+
//#endregion
|
|
1789
|
+
//#region node_modules/@thi.ng/strings/vector.js
|
|
1790
|
+
var vector = memoizeJ((size, prec = 3, d = ",", pre = "[", post = "]") => {
|
|
1791
|
+
const f = typeof prec === "number" ? float(prec) : prec;
|
|
1792
|
+
switch (size) {
|
|
1793
|
+
case 1: return (v) => `${pre}${f(v[0])}${post}`;
|
|
1794
|
+
case 2: return (v) => `${pre}${f(v[0])}${d}${f(v[1])}${post}`;
|
|
1795
|
+
case 3: return (v) => `${pre}${f(v[0])}${d}${f(v[1])}${d}${f(v[2])}${post}`;
|
|
1796
|
+
case 4: return (v) => `${pre}${f(v[0])}${d}${f(v[1])}${d}${f(v[2])}${d}${f(v[3])}${post}`;
|
|
1797
|
+
default: return (v) => {
|
|
1798
|
+
const res = [];
|
|
1799
|
+
for (let i = 0; i < v.length; i++) res.push(f(v[i]));
|
|
1800
|
+
return `${pre}${res.join(d)}${post}`;
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1803
|
+
});
|
|
1804
|
+
//#endregion
|
|
1805
|
+
//#region node_modules/@thi.ng/vectors/buffer.js
|
|
1806
|
+
var mapStridedBuffer = (ctor, buf, num, start, cstride, estride) => {
|
|
1807
|
+
const res = [];
|
|
1808
|
+
while (num-- > 0) {
|
|
1809
|
+
res.push(new ctor(buf, start, cstride));
|
|
1810
|
+
start += estride;
|
|
1811
|
+
}
|
|
1812
|
+
return res;
|
|
1813
|
+
};
|
|
1814
|
+
//#endregion
|
|
1815
|
+
//#region node_modules/@thi.ng/vectors/defopvvv.js
|
|
1816
|
+
var defOpVVV = (op, dispatch = 1, outA = true) => {
|
|
1817
|
+
const a = outA ? (o, a2, b2, c2) => {
|
|
1818
|
+
!o && (o = a2);
|
|
1819
|
+
for (let i = a2.length; i-- > 0;) o[i] = op(a2[i], b2[i], c2[i]);
|
|
1820
|
+
return o;
|
|
1821
|
+
} : (o, a2, b2, c2) => {
|
|
1822
|
+
!o && (o = c2);
|
|
1823
|
+
for (let i = a2.length; i-- > 0;) o[i] = op(a2[i], b2[i], c2[i]);
|
|
1824
|
+
return o;
|
|
1825
|
+
};
|
|
1826
|
+
const b = outA ? (o, a2, b2, c2) => {
|
|
1827
|
+
!o && (o = a2);
|
|
1828
|
+
o[0] = op(a2[0], b2[0], c2[0]);
|
|
1829
|
+
o[1] = op(a2[1], b2[1], c2[1]);
|
|
1830
|
+
return o;
|
|
1831
|
+
} : (o, a2, b2, c2) => {
|
|
1832
|
+
!o && (o = c2);
|
|
1833
|
+
o[0] = op(a2[0], b2[0], c2[0]);
|
|
1834
|
+
o[1] = op(a2[1], b2[1], c2[1]);
|
|
1835
|
+
return o;
|
|
1836
|
+
};
|
|
1837
|
+
const c = outA ? (o, a2, b2, c2) => {
|
|
1838
|
+
!o && (o = a2);
|
|
1839
|
+
o[0] = op(a2[0], b2[0], c2[0]);
|
|
1840
|
+
o[1] = op(a2[1], b2[1], c2[1]);
|
|
1841
|
+
o[2] = op(a2[2], b2[2], c2[2]);
|
|
1842
|
+
return o;
|
|
1843
|
+
} : (o, a2, b2, c2) => {
|
|
1844
|
+
!o && (o = c2);
|
|
1845
|
+
o[0] = op(a2[0], b2[0], c2[0]);
|
|
1846
|
+
o[1] = op(a2[1], b2[1], c2[1]);
|
|
1847
|
+
o[2] = op(a2[2], b2[2], c2[2]);
|
|
1848
|
+
return o;
|
|
1849
|
+
};
|
|
1850
|
+
const d = outA ? (o, a2, b2, c2) => {
|
|
1851
|
+
!o && (o = a2);
|
|
1852
|
+
o[0] = op(a2[0], b2[0], c2[0]);
|
|
1853
|
+
o[1] = op(a2[1], b2[1], c2[1]);
|
|
1854
|
+
o[2] = op(a2[2], b2[2], c2[2]);
|
|
1855
|
+
o[3] = op(a2[3], b2[3], c2[3]);
|
|
1856
|
+
return o;
|
|
1857
|
+
} : (o, a2, b2, c2) => {
|
|
1858
|
+
!o && (o = c2);
|
|
1859
|
+
o[0] = op(a2[0], b2[0], c2[0]);
|
|
1860
|
+
o[1] = op(a2[1], b2[1], c2[1]);
|
|
1861
|
+
o[2] = op(a2[2], b2[2], c2[2]);
|
|
1862
|
+
o[3] = op(a2[3], b2[3], c2[3]);
|
|
1863
|
+
return o;
|
|
1864
|
+
};
|
|
1865
|
+
return [
|
|
1866
|
+
vop(dispatch, a, b, c, d),
|
|
1867
|
+
b,
|
|
1868
|
+
c,
|
|
1869
|
+
d
|
|
1870
|
+
];
|
|
1871
|
+
};
|
|
1872
|
+
//#endregion
|
|
1873
|
+
//#region node_modules/@thi.ng/vectors/clamp.js
|
|
1874
|
+
var [a$7, b$7, c$7, d$7] = defOpVVV(clamp$1);
|
|
1875
|
+
var clamp4 = d$7;
|
|
1876
|
+
//#endregion
|
|
1877
|
+
//#region node_modules/@thi.ng/vectors/accessors.js
|
|
1878
|
+
var declareIndex = (proto, id, idx, strided = true, defNumeric = true) => {
|
|
1879
|
+
const get = idx > 0 ? strided ? function() {
|
|
1880
|
+
return this.buf[this.offset + idx * this.stride];
|
|
1881
|
+
} : function() {
|
|
1882
|
+
return this.buf[this.offset + idx];
|
|
1883
|
+
} : function() {
|
|
1884
|
+
return this.buf[this.offset];
|
|
1885
|
+
};
|
|
1886
|
+
const set = idx > 0 ? strided ? function(n) {
|
|
1887
|
+
this.buf[this.offset + idx * this.stride] = n;
|
|
1888
|
+
} : function(n) {
|
|
1889
|
+
this.buf[this.offset + idx] = n;
|
|
1890
|
+
} : function(n) {
|
|
1891
|
+
this.buf[this.offset] = n;
|
|
1892
|
+
};
|
|
1893
|
+
defNumeric && Object.defineProperty(proto, idx, {
|
|
1894
|
+
get,
|
|
1895
|
+
set,
|
|
1896
|
+
enumerable: true
|
|
1897
|
+
});
|
|
1898
|
+
Object.defineProperty(proto, id, {
|
|
1899
|
+
get,
|
|
1900
|
+
set,
|
|
1901
|
+
enumerable: true
|
|
1902
|
+
});
|
|
1903
|
+
};
|
|
1904
|
+
var declareIndices = (proto, props, strided, defNumeric) => props.forEach((id, i) => declareIndex(proto, id, i, strided, defNumeric));
|
|
1905
|
+
//#endregion
|
|
1906
|
+
//#region node_modules/@thi.ng/math/eqdelta.js
|
|
1907
|
+
var abs = Math.abs;
|
|
1908
|
+
var eqDelta$1 = (a, b, eps = EPS$1) => abs(a - b) <= eps;
|
|
1909
|
+
//#endregion
|
|
1910
|
+
//#region node_modules/@thi.ng/vectors/eqdelta.js
|
|
1911
|
+
var eqDelta2 = (a, b, eps = EPS$1) => {
|
|
1912
|
+
return a.length === b.length && eqDelta$1(a[0], b[0], eps) && eqDelta$1(a[1], b[1], eps);
|
|
1913
|
+
};
|
|
1914
|
+
var eqDelta3 = (a, b, eps = EPS$1) => {
|
|
1915
|
+
return a.length === b.length && eqDelta$1(a[0], b[0], eps) && eqDelta$1(a[1], b[1], eps) && eqDelta$1(a[2], b[2], eps);
|
|
1916
|
+
};
|
|
1917
|
+
var eqDelta4 = (a, b, eps = EPS$1) => {
|
|
1918
|
+
return a.length === b.length && eqDelta$1(a[0], b[0], eps) && eqDelta$1(a[1], b[1], eps) && eqDelta$1(a[2], b[2], eps) && eqDelta$1(a[3], b[3], eps);
|
|
1919
|
+
};
|
|
1920
|
+
var eqDelta = vop(0, (v1, v2, eps = EPS$1) => {
|
|
1921
|
+
if (implementsFunction(v1, "eqDelta")) return v1.eqDelta(v2, eps);
|
|
1922
|
+
if (implementsFunction(v2, "eqDelta")) return v2.eqDelta(v1, eps);
|
|
1923
|
+
return eqDeltaS(v1, v2, v1.length, eps);
|
|
1924
|
+
}, eqDelta2, eqDelta3, eqDelta4);
|
|
1925
|
+
var eqDeltaS = (a, b, n, eps = EPS$1, ia = 0, ib = 0, sa = 1, sb = 1) => {
|
|
1926
|
+
for (; n > 0; n--, ia += sa, ib += sb) if (!eqDelta$1(a[ia], b[ib], eps)) return false;
|
|
1927
|
+
return true;
|
|
1928
|
+
};
|
|
1929
|
+
//#endregion
|
|
1930
|
+
//#region node_modules/@thi.ng/vectors/iterator.js
|
|
1931
|
+
function* stridedValues(buf, num, start, stride) {
|
|
1932
|
+
while (num-- > 0) {
|
|
1933
|
+
yield buf[start];
|
|
1934
|
+
start += stride;
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
//#endregion
|
|
1938
|
+
//#region node_modules/@thi.ng/random/arandom.js
|
|
1939
|
+
var INV_MAX = 1 / 2 ** 32;
|
|
1940
|
+
var ARandom = class {
|
|
1941
|
+
float(norm = 1) {
|
|
1942
|
+
return this.int() * INV_MAX * norm;
|
|
1943
|
+
}
|
|
1944
|
+
probability(p) {
|
|
1945
|
+
return this.float() < p;
|
|
1946
|
+
}
|
|
1947
|
+
norm(norm = 1) {
|
|
1948
|
+
return (this.int() * INV_MAX - .5) * 2 * norm;
|
|
1949
|
+
}
|
|
1950
|
+
normMinMax(min, max) {
|
|
1951
|
+
const x = this.minmax(min, max);
|
|
1952
|
+
return this.float() < .5 ? x : -x;
|
|
1953
|
+
}
|
|
1954
|
+
minmax(min, max) {
|
|
1955
|
+
return this.float() * (max - min) + min;
|
|
1956
|
+
}
|
|
1957
|
+
minmaxInt(min, max) {
|
|
1958
|
+
min |= 0;
|
|
1959
|
+
const range = (max | 0) - min;
|
|
1960
|
+
return range ? min + this.int() % range : min;
|
|
1961
|
+
}
|
|
1962
|
+
minmaxUint(min, max) {
|
|
1963
|
+
min >>>= 0;
|
|
1964
|
+
const range = (max >>> 0) - min;
|
|
1965
|
+
return range ? min + this.int() % range : min;
|
|
1966
|
+
}
|
|
1967
|
+
};
|
|
1968
|
+
//#endregion
|
|
1969
|
+
//#region node_modules/@thi.ng/random/wrapped.js
|
|
1970
|
+
var WrappedRandom = class extends ARandom {
|
|
1971
|
+
constructor(rnd) {
|
|
1972
|
+
super();
|
|
1973
|
+
this.rnd = rnd;
|
|
1974
|
+
}
|
|
1975
|
+
float(norm = 1) {
|
|
1976
|
+
return this.rnd() * norm;
|
|
1977
|
+
}
|
|
1978
|
+
norm(norm = 1) {
|
|
1979
|
+
return (this.rnd() - .5) * 2 * norm;
|
|
1980
|
+
}
|
|
1981
|
+
int() {
|
|
1982
|
+
return this.rnd() * 4294967296 >>> 0;
|
|
1983
|
+
}
|
|
1984
|
+
};
|
|
1985
|
+
//#endregion
|
|
1986
|
+
//#region node_modules/@thi.ng/random/system.js
|
|
1987
|
+
var SYSTEM = new WrappedRandom(Math.random);
|
|
1988
|
+
//#endregion
|
|
1989
|
+
//#region node_modules/@thi.ng/random/weighted-random.js
|
|
1990
|
+
var weightedRandom = (choices, weights, rnd = SYSTEM) => {
|
|
1991
|
+
const n = choices.length;
|
|
1992
|
+
assert(n > 0, "no choices given");
|
|
1993
|
+
const opts = weights ? choices.map((x, i) => [weights[i] || 0, x]).sort((a, b) => b[0] - a[0]) : choices.map((x) => [1, x]);
|
|
1994
|
+
const total = opts.reduce((acc, o) => acc + o[0], 0);
|
|
1995
|
+
total <= 0 && console.warn("total weights <= 0");
|
|
1996
|
+
return () => {
|
|
1997
|
+
const r = rnd.float(total);
|
|
1998
|
+
let sum = total;
|
|
1999
|
+
for (let i = 0; i < n; i++) {
|
|
2000
|
+
sum -= opts[i][0];
|
|
2001
|
+
if (sum <= r) return opts[i][1];
|
|
2002
|
+
}
|
|
2003
|
+
};
|
|
2004
|
+
};
|
|
2005
|
+
//#endregion
|
|
2006
|
+
//#region node_modules/@thi.ng/vectors/rand-minmax.js
|
|
2007
|
+
var randMinMax = vop(1, (o, a, b, rnd = SYSTEM) => {
|
|
2008
|
+
!o && (o = a);
|
|
2009
|
+
for (let i = a.length; i-- > 0;) o[i] = rnd.minmax(a[i], b[i]);
|
|
2010
|
+
return o;
|
|
2011
|
+
});
|
|
2012
|
+
//#endregion
|
|
2013
|
+
//#region node_modules/@thi.ng/checks/is-array.js
|
|
2014
|
+
var isArray = Array.isArray;
|
|
2015
|
+
//#endregion
|
|
2016
|
+
//#region node_modules/@thi.ng/color/convert.js
|
|
2017
|
+
var CONVERSIONS = {};
|
|
2018
|
+
var defConversions = (mode, spec) => {
|
|
2019
|
+
for (const id in spec) {
|
|
2020
|
+
const val = spec[id];
|
|
2021
|
+
if (isArray(val)) {
|
|
2022
|
+
const [a, b, c, d] = val;
|
|
2023
|
+
spec[id] = val.length === 2 ? (out, src) => b(out, a(out, src)) : val.length === 3 ? (out, src) => c(out, b(out, a(out, src))) : (out, src) => d(out, c(out, b(out, a(out, src))));
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
CONVERSIONS[mode] = {
|
|
2027
|
+
...CONVERSIONS[mode],
|
|
2028
|
+
...spec
|
|
2029
|
+
};
|
|
2030
|
+
};
|
|
2031
|
+
var convert = (res, src, destMode, srcMode) => {
|
|
2032
|
+
const spec = CONVERSIONS[destMode];
|
|
2033
|
+
assert(!!spec, `no conversions available for ${destMode}`);
|
|
2034
|
+
let $convert = spec[srcMode];
|
|
2035
|
+
return $convert ? $convert(res, src) : CONVERSIONS.rgb[srcMode] ? spec.rgb(res, CONVERSIONS.rgb[srcMode]([], src)) : unsupportedOp(`can't convert: ${srcMode} -> ${destMode}`);
|
|
2036
|
+
};
|
|
2037
|
+
//#endregion
|
|
2038
|
+
//#region node_modules/@thi.ng/binary/rotate.js
|
|
2039
|
+
var rotateRight = (x, n) => (x >>> n | x << 32 - n) >>> 0;
|
|
2040
|
+
//#endregion
|
|
2041
|
+
//#region node_modules/@thi.ng/binary/splat.js
|
|
2042
|
+
var interleave4_12_24 = (x) => (x & 3840) * 4352 | (x & 240) * 272 | (x & 15) * 17;
|
|
2043
|
+
var interleave4_16_32 = (x) => ((x & 61440) * 69632 | (x & 3840) * 4352 | (x & 240) * 272 | (x & 15) * 17) >>> 0;
|
|
2044
|
+
//#endregion
|
|
2045
|
+
//#region node_modules/@thi.ng/color/api.js
|
|
2046
|
+
var ParsedColor = class {
|
|
2047
|
+
constructor(mode, value) {
|
|
2048
|
+
this.mode = mode;
|
|
2049
|
+
this.value = value;
|
|
2050
|
+
}
|
|
2051
|
+
deref() {
|
|
2052
|
+
return this.value;
|
|
2053
|
+
}
|
|
2054
|
+
};
|
|
2055
|
+
//#endregion
|
|
2056
|
+
//#region node_modules/@thi.ng/color/api/names.js
|
|
2057
|
+
var CSS_NAMES = {
|
|
2058
|
+
aliceblue: "f0f8ff",
|
|
2059
|
+
antiquewhite: "faebd7",
|
|
2060
|
+
aqua: "0ff",
|
|
2061
|
+
aquamarine: "7fffd4",
|
|
2062
|
+
azure: "f0ffff",
|
|
2063
|
+
beige: "f5f5dc",
|
|
2064
|
+
bisque: "ffe4c4",
|
|
2065
|
+
black: "000",
|
|
2066
|
+
blanchedalmond: "ffebcd",
|
|
2067
|
+
blue: "00f",
|
|
2068
|
+
blueviolet: "8a2be2",
|
|
2069
|
+
brown: "a52a2a",
|
|
2070
|
+
burlywood: "deb887",
|
|
2071
|
+
cadetblue: "5f9ea0",
|
|
2072
|
+
chartreuse: "7fff00",
|
|
2073
|
+
chocolate: "d2691e",
|
|
2074
|
+
coral: "ff7f50",
|
|
2075
|
+
cornflowerblue: "6495ed",
|
|
2076
|
+
cornsilk: "fff8dc",
|
|
2077
|
+
crimson: "dc143c",
|
|
2078
|
+
cyan: "0ff",
|
|
2079
|
+
darkblue: "00008b",
|
|
2080
|
+
darkcyan: "008b8b",
|
|
2081
|
+
darkgoldenrod: "b8860b",
|
|
2082
|
+
darkgray: "a9a9a9",
|
|
2083
|
+
darkgreen: "006400",
|
|
2084
|
+
darkgrey: "a9a9a9",
|
|
2085
|
+
darkkhaki: "bdb76b",
|
|
2086
|
+
darkmagenta: "8b008b",
|
|
2087
|
+
darkolivegreen: "556b2f",
|
|
2088
|
+
darkorange: "ff8c00",
|
|
2089
|
+
darkorchid: "9932cc",
|
|
2090
|
+
darkred: "8b0000",
|
|
2091
|
+
darksalmon: "e9967a",
|
|
2092
|
+
darkseagreen: "8fbc8f",
|
|
2093
|
+
darkslateblue: "483d8b",
|
|
2094
|
+
darkslategray: "2f4f4f",
|
|
2095
|
+
darkslategrey: "2f4f4f",
|
|
2096
|
+
darkturquoise: "00ced1",
|
|
2097
|
+
darkviolet: "9400d3",
|
|
2098
|
+
deeppink: "ff1493",
|
|
2099
|
+
deepskyblue: "00bfff",
|
|
2100
|
+
dimgray: "696969",
|
|
2101
|
+
dimgrey: "696969",
|
|
2102
|
+
dodgerblue: "1e90ff",
|
|
2103
|
+
firebrick: "b22222",
|
|
2104
|
+
floralwhite: "fffaf0",
|
|
2105
|
+
forestgreen: "228b22",
|
|
2106
|
+
fuchsia: "f0f",
|
|
2107
|
+
gainsboro: "dcdcdc",
|
|
2108
|
+
ghostwhite: "f8f8ff",
|
|
2109
|
+
gold: "ffd700",
|
|
2110
|
+
goldenrod: "daa520",
|
|
2111
|
+
gray: "808080",
|
|
2112
|
+
grey: "808080",
|
|
2113
|
+
green: "008000",
|
|
2114
|
+
greenyellow: "adff2f",
|
|
2115
|
+
honeydew: "f0fff0",
|
|
2116
|
+
hotpink: "ff69b4",
|
|
2117
|
+
indianred: "cd5c5c",
|
|
2118
|
+
indigo: "4b0082",
|
|
2119
|
+
ivory: "fffff0",
|
|
2120
|
+
khaki: "f0e68c",
|
|
2121
|
+
lavender: "e6e6fa",
|
|
2122
|
+
lavenderblush: "fff0f5",
|
|
2123
|
+
lawngreen: "7cfc00",
|
|
2124
|
+
lemonchiffon: "fffacd",
|
|
2125
|
+
lightblue: "add8e6",
|
|
2126
|
+
lightcoral: "f08080",
|
|
2127
|
+
lightcyan: "e0ffff",
|
|
2128
|
+
lightgoldenrodyellow: "fafad2",
|
|
2129
|
+
lightgray: "d3d3d3",
|
|
2130
|
+
lightgreen: "90ee90",
|
|
2131
|
+
lightgrey: "d3d3d3",
|
|
2132
|
+
lightpink: "ffb6c1",
|
|
2133
|
+
lightsalmon: "ffa07a",
|
|
2134
|
+
lightseagreen: "20b2aa",
|
|
2135
|
+
lightskyblue: "87cefa",
|
|
2136
|
+
lightslategray: "789",
|
|
2137
|
+
lightslategrey: "789",
|
|
2138
|
+
lightsteelblue: "b0c4de",
|
|
2139
|
+
lightyellow: "ffffe0",
|
|
2140
|
+
lime: "0f0",
|
|
2141
|
+
limegreen: "32cd32",
|
|
2142
|
+
linen: "faf0e6",
|
|
2143
|
+
magenta: "f0f",
|
|
2144
|
+
maroon: "800000",
|
|
2145
|
+
mediumaquamarine: "66cdaa",
|
|
2146
|
+
mediumblue: "0000cd",
|
|
2147
|
+
mediumorchid: "ba55d3",
|
|
2148
|
+
mediumpurple: "9370db",
|
|
2149
|
+
mediumseagreen: "3cb371",
|
|
2150
|
+
mediumslateblue: "7b68ee",
|
|
2151
|
+
mediumspringgreen: "00fa9a",
|
|
2152
|
+
mediumturquoise: "48d1cc",
|
|
2153
|
+
mediumvioletred: "c71585",
|
|
2154
|
+
midnightblue: "191970",
|
|
2155
|
+
mintcream: "f5fffa",
|
|
2156
|
+
mistyrose: "ffe4e1",
|
|
2157
|
+
moccasin: "ffe4b5",
|
|
2158
|
+
navajowhite: "ffdead",
|
|
2159
|
+
navy: "000080",
|
|
2160
|
+
oldlace: "fdf5e6",
|
|
2161
|
+
olive: "808000",
|
|
2162
|
+
olivedrab: "6b8e23",
|
|
2163
|
+
orange: "ffa500",
|
|
2164
|
+
orangered: "ff4500",
|
|
2165
|
+
orchid: "da70d6",
|
|
2166
|
+
palegoldenrod: "eee8aa",
|
|
2167
|
+
palegreen: "98fb98",
|
|
2168
|
+
paleturquoise: "afeeee",
|
|
2169
|
+
palevioletred: "db7093",
|
|
2170
|
+
papayawhip: "ffefd5",
|
|
2171
|
+
peachpuff: "ffdab9",
|
|
2172
|
+
peru: "cd853f",
|
|
2173
|
+
pink: "ffc0cb",
|
|
2174
|
+
plum: "dda0dd",
|
|
2175
|
+
powderblue: "b0e0e6",
|
|
2176
|
+
purple: "800080",
|
|
2177
|
+
red: "f00",
|
|
2178
|
+
rosybrown: "bc8f8f",
|
|
2179
|
+
royalblue: "4169e1",
|
|
2180
|
+
saddlebrown: "8b4513",
|
|
2181
|
+
salmon: "fa8072",
|
|
2182
|
+
sandybrown: "f4a460",
|
|
2183
|
+
seagreen: "2e8b57",
|
|
2184
|
+
seashell: "fff5ee",
|
|
2185
|
+
sienna: "a0522d",
|
|
2186
|
+
silver: "c0c0c0",
|
|
2187
|
+
skyblue: "87ceeb",
|
|
2188
|
+
slateblue: "6a5acd",
|
|
2189
|
+
slategray: "708090",
|
|
2190
|
+
slategrey: "708090",
|
|
2191
|
+
snow: "fffafa",
|
|
2192
|
+
springgreen: "00ff7f",
|
|
2193
|
+
steelblue: "4682b4",
|
|
2194
|
+
tan: "d2b48c",
|
|
2195
|
+
teal: "008080",
|
|
2196
|
+
thistle: "d8bfd8",
|
|
2197
|
+
tomato: "ff6347",
|
|
2198
|
+
turquoise: "40e0d0",
|
|
2199
|
+
violet: "ee82ee",
|
|
2200
|
+
wheat: "f5deb3",
|
|
2201
|
+
white: "fff",
|
|
2202
|
+
whitesmoke: "f5f5f5",
|
|
2203
|
+
yellow: "ff0",
|
|
2204
|
+
yellowgreen: "9acd32",
|
|
2205
|
+
transparent: "0000",
|
|
2206
|
+
rebeccapurple: "639"
|
|
2207
|
+
};
|
|
2208
|
+
//#endregion
|
|
2209
|
+
//#region node_modules/@thi.ng/color/api/system.js
|
|
2210
|
+
var CSS_SYSTEM_COLORS = {
|
|
2211
|
+
canvas: "fff",
|
|
2212
|
+
canvastext: "000",
|
|
2213
|
+
linktext: "001ee4",
|
|
2214
|
+
visitedtext: "4e2386",
|
|
2215
|
+
activetext: "eb3323",
|
|
2216
|
+
buttonface: "ddd",
|
|
2217
|
+
buttontext: "000",
|
|
2218
|
+
buttonborder: "000",
|
|
2219
|
+
field: "fff",
|
|
2220
|
+
fieldtext: "000",
|
|
2221
|
+
highlight: "bbd5fb",
|
|
2222
|
+
highlighttext: "000",
|
|
2223
|
+
mark: "000",
|
|
2224
|
+
marktext: "fff",
|
|
2225
|
+
graytext: "808080"
|
|
2226
|
+
};
|
|
2227
|
+
//#endregion
|
|
2228
|
+
//#region node_modules/@thi.ng/vectors/setc.js
|
|
2229
|
+
var setC3 = (out, x, y, z) => {
|
|
2230
|
+
!out && (out = []);
|
|
2231
|
+
out[0] = x;
|
|
2232
|
+
out[1] = y;
|
|
2233
|
+
out[2] = z;
|
|
2234
|
+
return out;
|
|
2235
|
+
};
|
|
2236
|
+
var setC4 = (out, x, y, z, w) => {
|
|
2237
|
+
!out && (out = []);
|
|
2238
|
+
out[0] = x;
|
|
2239
|
+
out[1] = y;
|
|
2240
|
+
out[2] = z;
|
|
2241
|
+
out[3] = w;
|
|
2242
|
+
return out;
|
|
2243
|
+
};
|
|
2244
|
+
//#endregion
|
|
2245
|
+
//#region node_modules/@thi.ng/color/int/int-srgb.js
|
|
2246
|
+
var intArgb32Srgb = (out, src) => setC4(out || [], (src >>> 16 & 255) * INV8BIT, (src >>> 8 & 255) * INV8BIT, (src & 255) * INV8BIT, (src >>> 24) * INV8BIT);
|
|
2247
|
+
var intAbgr32Srgb = (out, src) => setC4(out || [], (src & 255) * INV8BIT, (src >>> 8 & 255) * INV8BIT, (src >>> 16 & 255) * INV8BIT, (src >>> 24) * INV8BIT);
|
|
2248
|
+
//#endregion
|
|
2249
|
+
//#region node_modules/@thi.ng/color/css/parse-css.js
|
|
2250
|
+
var parseCss = (src) => {
|
|
2251
|
+
src = (isString(src) ? src : src.deref()).toLowerCase();
|
|
2252
|
+
const named = CSS_NAMES[src] || CSS_SYSTEM_COLORS[src];
|
|
2253
|
+
if (named || src[0] === "#") return new ParsedColor("srgb", intArgb32Srgb([], parseHex(named || src)));
|
|
2254
|
+
const parts = src.split(/[(),/ ]+/);
|
|
2255
|
+
const [mode, a, b, c, d] = parts;
|
|
2256
|
+
assert(parts.length === 5 || parts.length === 6, `invalid color: ${src}`);
|
|
2257
|
+
switch (mode) {
|
|
2258
|
+
case "rgb":
|
|
2259
|
+
case "rgba": return new ParsedColor("srgb", [
|
|
2260
|
+
__numOrPercent(a, 1, INV8BIT, true),
|
|
2261
|
+
__numOrPercent(b, 1, INV8BIT, true),
|
|
2262
|
+
__numOrPercent(c, 1, INV8BIT, true),
|
|
2263
|
+
__alpha(d)
|
|
2264
|
+
]);
|
|
2265
|
+
case "hsl":
|
|
2266
|
+
case "hsla": return new ParsedColor("hsl", [
|
|
2267
|
+
__hue(a),
|
|
2268
|
+
__percent(b),
|
|
2269
|
+
__percent(c),
|
|
2270
|
+
__alpha(d)
|
|
2271
|
+
]);
|
|
2272
|
+
case "lab": return new ParsedColor("lab50", [
|
|
2273
|
+
__numOrPercent(a),
|
|
2274
|
+
__numOrPercent(b, 1.25),
|
|
2275
|
+
__numOrPercent(c, 1.25),
|
|
2276
|
+
__alpha(d)
|
|
2277
|
+
]);
|
|
2278
|
+
case "lch": return new ParsedColor(mode, [
|
|
2279
|
+
__numOrPercent(a),
|
|
2280
|
+
__numOrPercent(b, 1.5),
|
|
2281
|
+
__hue(c),
|
|
2282
|
+
__alpha(d)
|
|
2283
|
+
]);
|
|
2284
|
+
case "oklab": return new ParsedColor(mode, [
|
|
2285
|
+
__numOrPercent(a, 1, 1),
|
|
2286
|
+
__numOrPercent(b, .4, 1),
|
|
2287
|
+
__numOrPercent(c, .4, 1),
|
|
2288
|
+
__alpha(d)
|
|
2289
|
+
]);
|
|
2290
|
+
case "oklch": return new ParsedColor(mode, [
|
|
2291
|
+
__numOrPercent(a, 1, 1),
|
|
2292
|
+
__numOrPercent(b, .4, 1),
|
|
2293
|
+
__hue(c),
|
|
2294
|
+
__alpha(d)
|
|
2295
|
+
]);
|
|
2296
|
+
default: unsupportedOp(`color mode: ${mode}`);
|
|
2297
|
+
}
|
|
2298
|
+
};
|
|
2299
|
+
var HUE_NORMS = {
|
|
2300
|
+
rad: TAU,
|
|
2301
|
+
grad: 400,
|
|
2302
|
+
turn: 1,
|
|
2303
|
+
deg: 360
|
|
2304
|
+
};
|
|
2305
|
+
var __hue = (x) => {
|
|
2306
|
+
const match = /^(-?[0-9.]+)(deg|rad|grad|turn)?$/.exec(x);
|
|
2307
|
+
assert(!!match, `expected hue, got: ${x}`);
|
|
2308
|
+
return fract(parseFloat(match[1]) / (HUE_NORMS[match[2]] || 360));
|
|
2309
|
+
};
|
|
2310
|
+
var __alpha = (x) => x ? __numOrPercent(x, 1, 1, true) : 1;
|
|
2311
|
+
var __percent = (x, clamp = true) => {
|
|
2312
|
+
assert(/^([0-9.]+)%$/.test(x), `expected percentage, got: ${x}`);
|
|
2313
|
+
const res = parseFloat(x) / 100;
|
|
2314
|
+
return clamp ? clamp01(res) : res;
|
|
2315
|
+
};
|
|
2316
|
+
var __numOrPercent = (x, scalePerc = 1, scale = .01, clamp = false) => {
|
|
2317
|
+
assert(/^-?[0-9.]+%?$/.test(x), `expected number or percentage, got: ${x}`);
|
|
2318
|
+
const res = parseFloat(x) * (x.endsWith("%") ? .01 * scalePerc : scale);
|
|
2319
|
+
return clamp ? clamp01(res) : res;
|
|
2320
|
+
};
|
|
2321
|
+
var parseHex = (src) => {
|
|
2322
|
+
const match = /^#?([0-9a-f]{3,8})$/i.exec(src);
|
|
2323
|
+
if (match) {
|
|
2324
|
+
const hex = match[1];
|
|
2325
|
+
const val = parseInt(hex, 16);
|
|
2326
|
+
switch (hex.length) {
|
|
2327
|
+
case 3: return (interleave4_12_24(val) | 4278190080) >>> 0;
|
|
2328
|
+
case 4: return rotateRight(interleave4_16_32(val), 8);
|
|
2329
|
+
case 6: return (val | 4278190080) >>> 0;
|
|
2330
|
+
case 8: return rotateRight(val, 8);
|
|
2331
|
+
default:
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
return illegalArgs(`invalid hex color: "${src}"`);
|
|
2335
|
+
};
|
|
2336
|
+
//#endregion
|
|
2337
|
+
//#region node_modules/@thi.ng/color/internal/ensure.js
|
|
2338
|
+
var __ensureAlpha = (x, def = 1) => x != void 0 ? clamp01(x) : def;
|
|
2339
|
+
var __ensureArgs = (args) => {
|
|
2340
|
+
if (typeof args[0] === "number") switch (args.length) {
|
|
2341
|
+
case 1: return args.push(0, 0, 1), [args];
|
|
2342
|
+
case 2: return args.push(0, 1), [args];
|
|
2343
|
+
case 3: return args.push(1), [args];
|
|
2344
|
+
default: return [args];
|
|
2345
|
+
}
|
|
2346
|
+
return args;
|
|
2347
|
+
};
|
|
2348
|
+
//#endregion
|
|
2349
|
+
//#region node_modules/@thi.ng/color/defcolor.js
|
|
2350
|
+
var defColor = (spec) => {
|
|
2351
|
+
const channels = spec.channels || {};
|
|
2352
|
+
const order = spec.order;
|
|
2353
|
+
const numChannels = order.length;
|
|
2354
|
+
order.reduce((acc, id) => {
|
|
2355
|
+
acc[id] = {
|
|
2356
|
+
range: [0, 1],
|
|
2357
|
+
...channels[id]
|
|
2358
|
+
};
|
|
2359
|
+
return acc;
|
|
2360
|
+
}, channels);
|
|
2361
|
+
const min = Object.freeze(order.map((id) => channels[id].range[0]));
|
|
2362
|
+
const max = Object.freeze(order.map((id) => channels[id].range[1]));
|
|
2363
|
+
const minR = set4([], min);
|
|
2364
|
+
const maxR = set4([], max);
|
|
2365
|
+
minR[numChannels - 1] = 1;
|
|
2366
|
+
const hueChanID = order.findIndex((id) => !!channels[id].hue);
|
|
2367
|
+
const $Color = class {
|
|
2368
|
+
constructor(buf, offset = 0, stride = 1) {
|
|
2369
|
+
this.offset = offset;
|
|
2370
|
+
this.stride = stride;
|
|
2371
|
+
this.buf = buf || [
|
|
2372
|
+
0,
|
|
2373
|
+
0,
|
|
2374
|
+
0,
|
|
2375
|
+
0
|
|
2376
|
+
];
|
|
2377
|
+
this.offset = offset;
|
|
2378
|
+
this.stride = stride;
|
|
2379
|
+
}
|
|
2380
|
+
buf;
|
|
2381
|
+
get mode() {
|
|
2382
|
+
return spec.mode;
|
|
2383
|
+
}
|
|
2384
|
+
get length() {
|
|
2385
|
+
return numChannels;
|
|
2386
|
+
}
|
|
2387
|
+
get range() {
|
|
2388
|
+
return [min, max];
|
|
2389
|
+
}
|
|
2390
|
+
get [Symbol.toStringTag]() {
|
|
2391
|
+
return spec.mode;
|
|
2392
|
+
}
|
|
2393
|
+
get xyz() {
|
|
2394
|
+
return [
|
|
2395
|
+
this[0],
|
|
2396
|
+
this[1],
|
|
2397
|
+
this[2]
|
|
2398
|
+
];
|
|
2399
|
+
}
|
|
2400
|
+
[Symbol.iterator]() {
|
|
2401
|
+
return stridedValues(this.buf, this.length, this.offset, this.stride);
|
|
2402
|
+
}
|
|
2403
|
+
copy() {
|
|
2404
|
+
return new $Color(this.deref());
|
|
2405
|
+
}
|
|
2406
|
+
copyView() {
|
|
2407
|
+
return new $Color(this.buf, this.offset, this.stride);
|
|
2408
|
+
}
|
|
2409
|
+
empty() {
|
|
2410
|
+
return new $Color();
|
|
2411
|
+
}
|
|
2412
|
+
deref() {
|
|
2413
|
+
return [
|
|
2414
|
+
this[0],
|
|
2415
|
+
this[1],
|
|
2416
|
+
this[2],
|
|
2417
|
+
this[3]
|
|
2418
|
+
];
|
|
2419
|
+
}
|
|
2420
|
+
set(src) {
|
|
2421
|
+
return set4(this, src);
|
|
2422
|
+
}
|
|
2423
|
+
clamp() {
|
|
2424
|
+
hueChanID >= 0 && (this[hueChanID] = fract(this[hueChanID]));
|
|
2425
|
+
clamp4(null, this, min, max);
|
|
2426
|
+
return this;
|
|
2427
|
+
}
|
|
2428
|
+
eqDelta(o, eps = EPS$1) {
|
|
2429
|
+
return eqDelta4(this, o, eps);
|
|
2430
|
+
}
|
|
2431
|
+
randomize(rnd) {
|
|
2432
|
+
return randMinMax(this, minR, maxR, rnd);
|
|
2433
|
+
}
|
|
2434
|
+
toJSON() {
|
|
2435
|
+
return this.deref();
|
|
2436
|
+
}
|
|
2437
|
+
toString() {
|
|
2438
|
+
return vector(4, 4)(this);
|
|
2439
|
+
}
|
|
2440
|
+
};
|
|
2441
|
+
declareIndices($Color.prototype, order);
|
|
2442
|
+
defConversions(spec.mode, spec.from);
|
|
2443
|
+
defConversions("rgb", { [spec.mode]: spec.toRgb });
|
|
2444
|
+
const fromColor = (src, mode, args) => {
|
|
2445
|
+
const res = new $Color(...args);
|
|
2446
|
+
return mode !== spec.mode ? convert(res, src, spec.mode, mode) : res.set(src);
|
|
2447
|
+
};
|
|
2448
|
+
const factory = (src, ...args) => src == null ? new $Color() : isString(src) ? factory(parseCss(src), ...args) : isArrayLike(src) ? isString(src.mode) ? fromColor(src, src.mode, args) : new $Color(src, ...args) : implementsFunction(src, "deref") ? fromColor(src.deref(), src.mode, args) : isNumber(src) ? args.length && args.every(isNumber) ? new $Color(...__ensureArgs([src, ...args])) : fromColor(intArgb32Srgb([], src), "srgb", args) : illegalArgs(`can't create a ${spec.mode} color from: ${src}`);
|
|
2449
|
+
factory.class = $Color;
|
|
2450
|
+
factory.range = [min, max];
|
|
2451
|
+
factory.random = (rnd, buf, idx, stride) => new $Color(buf, idx, stride).randomize(rnd);
|
|
2452
|
+
factory.mapBuffer = (buf, num = buf.length / numChannels | 0, start = 0, cstride = 1, estride = numChannels) => mapStridedBuffer($Color, buf, num, start, cstride, estride);
|
|
2453
|
+
return factory;
|
|
2454
|
+
};
|
|
2455
|
+
//#endregion
|
|
2456
|
+
//#region node_modules/@thi.ng/color/rgb/hue-rgb.js
|
|
2457
|
+
var hueRgb = (out, hue, alpha = 1) => {
|
|
2458
|
+
hue = fract(hue) * 6;
|
|
2459
|
+
return setC4(out || [], clamp01(Math.abs(hue - 3) - 1), clamp01(2 - Math.abs(hue - 2)), clamp01(2 - Math.abs(hue - 4)), alpha);
|
|
2460
|
+
};
|
|
2461
|
+
//#endregion
|
|
2462
|
+
//#region node_modules/@thi.ng/color/hcy/hcy-rgb.js
|
|
2463
|
+
var hcyRgb = (out, src) => {
|
|
2464
|
+
const h = src[0];
|
|
2465
|
+
let c = src[1];
|
|
2466
|
+
const y = src[2];
|
|
2467
|
+
const rgb = hueRgb(out || src, h, __ensureAlpha(src[3]));
|
|
2468
|
+
const lum = luminanceRgb(rgb);
|
|
2469
|
+
if (y < lum) c *= y / lum;
|
|
2470
|
+
else if (lum < 1) c *= (1 - y) / (1 - lum);
|
|
2471
|
+
return setC3(rgb, clamp01((rgb[0] - lum) * c + y), clamp01((rgb[1] - lum) * c + y), clamp01((rgb[2] - lum) * c + y));
|
|
2472
|
+
};
|
|
2473
|
+
//#endregion
|
|
2474
|
+
//#region node_modules/@thi.ng/color/clamp.js
|
|
2475
|
+
var clamp = (out, src, alpha = 1) => setC4(out || src, clamp01(src[0]), clamp01(src[1]), clamp01(src[2]), __ensureAlpha(src[3], alpha));
|
|
2476
|
+
var clampH = (out, src, alpha = 1) => setC4(out || src, fract(src[0]), clamp01(src[1]), clamp01(src[2]), __ensureAlpha(src[3], alpha));
|
|
2477
|
+
//#endregion
|
|
2478
|
+
//#region node_modules/@thi.ng/color/hsi/hsi-rgb.js
|
|
2479
|
+
var hsiRgb = (out, src) => {
|
|
2480
|
+
out = clampH(out || src, src);
|
|
2481
|
+
const s = out[1];
|
|
2482
|
+
const i = out[2];
|
|
2483
|
+
if (s < 1e-6) return setC3(out, i, i, i);
|
|
2484
|
+
const h = out[0] * 6 % 6;
|
|
2485
|
+
const m = i * (1 - s);
|
|
2486
|
+
const z = 1 - Math.abs(h % 2 - 1);
|
|
2487
|
+
let c = 3 * i * s / (1 + z);
|
|
2488
|
+
const x = c * z + m;
|
|
2489
|
+
c += m;
|
|
2490
|
+
switch (h | 0) {
|
|
2491
|
+
case 0: return setC3(out, c, x, m);
|
|
2492
|
+
case 1: return setC3(out, x, c, m);
|
|
2493
|
+
case 2: return setC3(out, m, c, x);
|
|
2494
|
+
case 3: return setC3(out, m, x, c);
|
|
2495
|
+
case 4: return setC3(out, x, m, c);
|
|
2496
|
+
case 5: return setC3(out, c, m, x);
|
|
2497
|
+
default: return setC3(out, m, m, m);
|
|
2498
|
+
}
|
|
2499
|
+
};
|
|
2500
|
+
//#endregion
|
|
2501
|
+
//#region node_modules/@thi.ng/color/hsl/hsl-rgb.js
|
|
2502
|
+
var hslRgb = (out, src) => {
|
|
2503
|
+
const s = clamp01(src[1]);
|
|
2504
|
+
const l = clamp01(src[2]);
|
|
2505
|
+
out = hueRgb(out || src, src[0], __ensureAlpha(src[3]));
|
|
2506
|
+
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
2507
|
+
return setC3(out, (out[0] - .5) * c + l, (out[1] - .5) * c + l, (out[2] - .5) * c + l);
|
|
2508
|
+
};
|
|
2509
|
+
//#endregion
|
|
2510
|
+
//#region node_modules/@thi.ng/color/hsv/hsv-rgb.js
|
|
2511
|
+
var hsvRgb = (out, src) => {
|
|
2512
|
+
out = clampH(out || src, src);
|
|
2513
|
+
const s = out[1];
|
|
2514
|
+
const v = out[2];
|
|
2515
|
+
hueRgb(out, src[0], out[3]);
|
|
2516
|
+
return setC3(out, ((out[0] - 1) * s + 1) * v, ((out[1] - 1) * s + 1) * v, ((out[2] - 1) * s + 1) * v);
|
|
2517
|
+
};
|
|
2518
|
+
//#endregion
|
|
2519
|
+
//#region node_modules/@thi.ng/color/linear.js
|
|
2520
|
+
var linearSrgb = (x) => x <= .0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - .055;
|
|
2521
|
+
var srgbLinear = (x) => x <= .04045 ? x / 12.92 : Math.pow((x + .055) / 1.055, 2.4);
|
|
2522
|
+
//#endregion
|
|
2523
|
+
//#region node_modules/@thi.ng/color/srgb/srgb-rgb.js
|
|
2524
|
+
var srgbRgb = (out, src) => setC4(out || src, srgbLinear(src[0]), srgbLinear(src[1]), srgbLinear(src[2]), __ensureAlpha(src[3]));
|
|
2525
|
+
//#endregion
|
|
2526
|
+
//#region node_modules/@thi.ng/color/int/int-rgb.js
|
|
2527
|
+
var intArgb32Rgb = (out, src) => srgbRgb(null, intArgb32Srgb(out, src));
|
|
2528
|
+
var intAbgr32Rgb = (out, src) => srgbRgb(null, intAbgr32Srgb(out, src));
|
|
2529
|
+
//#endregion
|
|
2530
|
+
//#region node_modules/@thi.ng/math/angle.js
|
|
2531
|
+
var cossin = (theta, n = 1) => [Math.cos(theta) * n, Math.sin(theta) * n];
|
|
2532
|
+
var absTheta = (theta) => (theta %= TAU, theta < 0 ? TAU + theta : theta);
|
|
2533
|
+
var atan2Abs = (y, x) => absTheta(Math.atan2(y, x));
|
|
2534
|
+
//#endregion
|
|
2535
|
+
//#region node_modules/@thi.ng/color/lab/lab-lch.js
|
|
2536
|
+
var lchLab = (out, src) => {
|
|
2537
|
+
let { 1: c, 2: h } = src;
|
|
2538
|
+
h *= TAU;
|
|
2539
|
+
const a = __ensureAlpha(src[3]);
|
|
2540
|
+
return c > 0 ? setC4(out || src, src[0], Math.cos(h) * c, Math.sin(h) * c, a) : setC4(out || src, src[0], 0, 0, a);
|
|
2541
|
+
};
|
|
2542
|
+
//#endregion
|
|
2543
|
+
//#region node_modules/@thi.ng/color/lab/lab-xyz.js
|
|
2544
|
+
var __transform$1 = (x) => {
|
|
2545
|
+
const y = x ** 3;
|
|
2546
|
+
return y > .008856 ? y : (x - 16 / 116) / 7.787;
|
|
2547
|
+
};
|
|
2548
|
+
var labXyz = (out, src, white = D50) => {
|
|
2549
|
+
const y = (src[0] + .16) / 1.16;
|
|
2550
|
+
return setC4(out || src, __transform$1(src[1] / 5 + y) * white[0], __transform$1(y) * white[1], __transform$1(y - src[2] / 2) * white[2], __ensureAlpha(src[3]));
|
|
2551
|
+
};
|
|
2552
|
+
var labXyzD65 = (out, src) => labXyz(out, src, D65);
|
|
2553
|
+
//#endregion
|
|
2554
|
+
//#region node_modules/@thi.ng/vectors/dots.js
|
|
2555
|
+
var dotS3 = (a, b, ia = 0, ib = 0, sa = 1, sb = 1) => a[ia] * b[ib] + a[ia + sa] * b[ib + sb] + a[ia + 2 * sa] * b[ib + 2 * sb];
|
|
2556
|
+
//#endregion
|
|
2557
|
+
//#region node_modules/@thi.ng/color/internal/matrix-ops.js
|
|
2558
|
+
var __mulV33 = (out, mat, src, clampOut = false) => {
|
|
2559
|
+
const x = dotS3(mat, src, 0, 0, 3);
|
|
2560
|
+
const y = dotS3(mat, src, 1, 0, 3);
|
|
2561
|
+
const z = dotS3(mat, src, 2, 0, 3);
|
|
2562
|
+
const a = __ensureAlpha(src[3]);
|
|
2563
|
+
return clampOut ? setC4(out || src, clamp01(x), clamp01(y), clamp01(z), a) : setC4(out || src, x, y, z, a);
|
|
2564
|
+
};
|
|
2565
|
+
//#endregion
|
|
2566
|
+
//#region node_modules/@thi.ng/color/xyz/xyz-rgb.js
|
|
2567
|
+
var xyzRgb = (out, src, mat = XYZ_RGB_D50) => __mulV33(out, mat, src);
|
|
2568
|
+
var xyzRgbD65 = (out, src) => xyzRgb(out, src, XYZ_RGB_D65);
|
|
2569
|
+
//#endregion
|
|
2570
|
+
//#region node_modules/@thi.ng/color/lab/lab-rgb.js
|
|
2571
|
+
var labRgb = (out, src) => xyzRgb(null, labXyz(out, src));
|
|
2572
|
+
var labRgbD65 = (out, src) => xyzRgbD65(null, labXyzD65(out, src));
|
|
2573
|
+
//#endregion
|
|
2574
|
+
//#region node_modules/@thi.ng/color/oklab/oklab-rgb.js
|
|
2575
|
+
var LMS_CONE = [
|
|
2576
|
+
4.0767416621,
|
|
2577
|
+
-1.2684380046,
|
|
2578
|
+
-.0041960863,
|
|
2579
|
+
-3.307711591,
|
|
2580
|
+
2.6097574011,
|
|
2581
|
+
-.7034186147,
|
|
2582
|
+
.2309699292,
|
|
2583
|
+
-.3413193965,
|
|
2584
|
+
1.707614701
|
|
2585
|
+
];
|
|
2586
|
+
var oklabRgb = (out, { 0: l, 1: a, 2: b, 3: alpha }) => __mulV33(out, LMS_CONE, [
|
|
2587
|
+
(l + .3963377774 * a + .2158037573 * b) ** 3,
|
|
2588
|
+
(l - .1055613458 * a - .0638541728 * b) ** 3,
|
|
2589
|
+
(l - .0894841775 * a - 1.291485548 * b) ** 3,
|
|
2590
|
+
alpha
|
|
2591
|
+
]);
|
|
2592
|
+
//#endregion
|
|
2593
|
+
//#region node_modules/@thi.ng/math/safe-div.js
|
|
2594
|
+
var safeDiv = (a, b) => b !== 0 ? a / b : 0;
|
|
2595
|
+
//#endregion
|
|
2596
|
+
//#region node_modules/@thi.ng/color/xyy/xyy-xyz.js
|
|
2597
|
+
var xyyXyz = (out, src) => {
|
|
2598
|
+
const { 0: x, 1: y, 2: Y } = src;
|
|
2599
|
+
return setC4(out || src, safeDiv(Y * x, y), Y, safeDiv(Y * (1 - x - y), y), __ensureAlpha(src[3]));
|
|
2600
|
+
};
|
|
2601
|
+
//#endregion
|
|
2602
|
+
//#region node_modules/@thi.ng/color/ycc/ycc-rgb.js
|
|
2603
|
+
var yccRgb = (out, src, luma = RGB_LUMINANCE_REC709) => {
|
|
2604
|
+
const y = src[0];
|
|
2605
|
+
const bb = (2 - 2 * luma[2]) * src[1];
|
|
2606
|
+
const rr = (2 - 2 * luma[0]) * src[2];
|
|
2607
|
+
return setC4(out || src, y + rr, y - luma[2] / luma[1] * bb - luma[0] / luma[1] * rr, y + bb, __ensureAlpha(src[3]));
|
|
2608
|
+
};
|
|
2609
|
+
//#endregion
|
|
2610
|
+
//#region node_modules/@thi.ng/color/rgb/rgb.js
|
|
2611
|
+
var rgb = defColor({
|
|
2612
|
+
mode: "rgb",
|
|
2613
|
+
order: [
|
|
2614
|
+
"r",
|
|
2615
|
+
"g",
|
|
2616
|
+
"b",
|
|
2617
|
+
"alpha"
|
|
2618
|
+
],
|
|
2619
|
+
from: {
|
|
2620
|
+
abgr32: (out, src) => intAbgr32Rgb(out, src[0]),
|
|
2621
|
+
argb32: (out, src) => intArgb32Rgb(out, src[0]),
|
|
2622
|
+
hcy: hcyRgb,
|
|
2623
|
+
hsi: hsiRgb,
|
|
2624
|
+
hsl: hslRgb,
|
|
2625
|
+
hsv: hsvRgb,
|
|
2626
|
+
lab50: labRgb,
|
|
2627
|
+
lab65: labRgbD65,
|
|
2628
|
+
lch: [lchLab, labRgb],
|
|
2629
|
+
oklab: oklabRgb,
|
|
2630
|
+
rgb: set4,
|
|
2631
|
+
srgb: srgbRgb,
|
|
2632
|
+
xyy: [xyyXyz, xyzRgbD65],
|
|
2633
|
+
xyz50: xyzRgb,
|
|
2634
|
+
xyz65: xyzRgbD65,
|
|
2635
|
+
ycc: yccRgb
|
|
2636
|
+
},
|
|
2637
|
+
toRgb: set4
|
|
2638
|
+
});
|
|
2639
|
+
//#endregion
|
|
2640
|
+
//#region node_modules/@thi.ng/color/contrast.js
|
|
2641
|
+
var contrast = (a, b) => {
|
|
2642
|
+
const lumA = luminanceRgb(rgb(a)) + .05;
|
|
2643
|
+
const lumB = luminanceRgb(rgb(b)) + .05;
|
|
2644
|
+
return lumA > lumB ? lumA / lumB : lumB / lumA;
|
|
2645
|
+
};
|
|
2646
|
+
//#endregion
|
|
2647
|
+
//#region node_modules/@thi.ng/arrays/ensure-iterable.js
|
|
2648
|
+
var ensureIterable = (x) => {
|
|
2649
|
+
(x == null || !x[Symbol.iterator]) && illegalArgs(`value is not iterable: ${x}`);
|
|
2650
|
+
return x;
|
|
2651
|
+
};
|
|
2652
|
+
//#endregion
|
|
2653
|
+
//#region node_modules/@thi.ng/arrays/ensure-array.js
|
|
2654
|
+
var ensureArray = (x) => isArray(x) ? x : [...ensureIterable(x)];
|
|
2655
|
+
var ensureArrayLike = (x) => isArrayLike(x) ? x : [...ensureIterable(x)];
|
|
2656
|
+
//#endregion
|
|
2657
|
+
//#region node_modules/@thi.ng/color/hsl/hsl-css.js
|
|
2658
|
+
var hslCss = (src) => {
|
|
2659
|
+
const h = FF(fract(src[0]) * 360);
|
|
2660
|
+
const s = PC(clamp01(src[1]));
|
|
2661
|
+
const l = PC(clamp01(src[2]));
|
|
2662
|
+
const a = __ensureAlpha(src[3]);
|
|
2663
|
+
return a < 1 ? `hsla(${h},${s},${l},${FF(a)})` : `hsl(${h},${s},${l})`;
|
|
2664
|
+
};
|
|
2665
|
+
//#endregion
|
|
2666
|
+
//#region node_modules/@thi.ng/color/hsv/hsv-hsl.js
|
|
2667
|
+
var hsvHsl = (out, src) => {
|
|
2668
|
+
out = clampH(out || src, src);
|
|
2669
|
+
const s = out[1];
|
|
2670
|
+
const v = out[2];
|
|
2671
|
+
const l = (2 - s) * v / 2;
|
|
2672
|
+
out[2] = l;
|
|
2673
|
+
out[1] = l && l < 1 ? s * v / (l < .5 ? l * 2 : 2 - l * 2) : s;
|
|
2674
|
+
return out;
|
|
2675
|
+
};
|
|
2676
|
+
//#endregion
|
|
2677
|
+
//#region node_modules/@thi.ng/color/hsv/hsv-css.js
|
|
2678
|
+
var hsvCss = (src) => hslCss(hsvHsl([], src));
|
|
2679
|
+
//#endregion
|
|
2680
|
+
//#region node_modules/@thi.ng/hex/index.js
|
|
2681
|
+
var HEX = "0123456789abcdef";
|
|
2682
|
+
var U8 = (x) => HEX[x >>> 4 & 15] + HEX[x & 15];
|
|
2683
|
+
var U16 = (x) => U8(x >>> 8) + U8(x & 255);
|
|
2684
|
+
var U24$1 = (x) => U8(x >>> 16) + U16(x);
|
|
2685
|
+
//#endregion
|
|
2686
|
+
//#region node_modules/@thi.ng/strings/radix.js
|
|
2687
|
+
var radix = memoizeO((radix2, n, prefix = "") => {
|
|
2688
|
+
const buf = repeat$1("0", n);
|
|
2689
|
+
return (x) => {
|
|
2690
|
+
x = (x >>> 0).toString(radix2);
|
|
2691
|
+
return prefix + (x.length < n ? buf.substring(x.length) + x : x);
|
|
2692
|
+
};
|
|
2693
|
+
});
|
|
2694
|
+
var B8 = radix(2, 8);
|
|
2695
|
+
var B16 = radix(2, 16);
|
|
2696
|
+
var B32 = radix(2, 32);
|
|
2697
|
+
var U24 = U24$1;
|
|
2698
|
+
//#endregion
|
|
2699
|
+
//#region node_modules/@thi.ng/color/int/int-css.js
|
|
2700
|
+
var intArgb32Css = (src) => {
|
|
2701
|
+
const a = src >>> 24;
|
|
2702
|
+
return a < 255 ? `rgba(${src >> 16 & 255},${src >> 8 & 255},${src & 255},${FF(a * INV8BIT)})` : `#${U24(src & 16777215)}`;
|
|
2703
|
+
};
|
|
2704
|
+
//#endregion
|
|
2705
|
+
//#region node_modules/@thi.ng/binary/swizzle.js
|
|
2706
|
+
var swapLane13 = (x) => (x & 255) << 16 | x >> 16 & 255 | x & 4278255360;
|
|
2707
|
+
//#endregion
|
|
2708
|
+
//#region node_modules/@thi.ng/color/int/int-int.js
|
|
2709
|
+
var intAbgr32Argb32 = swapLane13;
|
|
2710
|
+
//#endregion
|
|
2711
|
+
//#region node_modules/@thi.ng/color/internal/css.js
|
|
2712
|
+
var __labCss = (mode, src, scale) => {
|
|
2713
|
+
return __css(mode, PC(clamp0(src[0])), FF(src[1] * scale), FF(src[2] * scale), __ensureAlpha(src[3]));
|
|
2714
|
+
};
|
|
2715
|
+
var __lchCss = (mode, src, scaleC) => {
|
|
2716
|
+
return __css(mode, PC(clamp0(src[0])), FF(clamp0(src[1]) * scaleC), FF(fract(src[2]) * 360), __ensureAlpha(src[3]));
|
|
2717
|
+
};
|
|
2718
|
+
var __css = (mode, x, y, z, a) => `${mode}(${x} ${y} ${z}` + (a < 1 ? `/${FF(a)})` : ")");
|
|
2719
|
+
//#endregion
|
|
2720
|
+
//#region node_modules/@thi.ng/color/lab/lab-css.js
|
|
2721
|
+
var labCss = (src) => __labCss("lab", src, 100);
|
|
2722
|
+
//#endregion
|
|
2723
|
+
//#region node_modules/@thi.ng/color/xyz/xyz-lab.js
|
|
2724
|
+
var __transform = (x) => x > .00885645 ? Math.cbrt(x) : 7.787037 * x + 16 / 116;
|
|
2725
|
+
var xyzLab = (out, src, white = D50) => {
|
|
2726
|
+
const x = __transform(src[0] / white[0]);
|
|
2727
|
+
const y = __transform(src[1] / white[1]);
|
|
2728
|
+
const z = __transform(src[2] / white[2]);
|
|
2729
|
+
return setC4(out || src, 1.16 * y - .16, 5 * (x - y), 2 * (y - z), __ensureAlpha(src[3]));
|
|
2730
|
+
};
|
|
2731
|
+
//#endregion
|
|
2732
|
+
//#region node_modules/@thi.ng/color/xyz/xyz-xyz.js
|
|
2733
|
+
var xyzXyzD65_50 = (out, src) => __mulV33(out, BRADFORD_D65_D50, src);
|
|
2734
|
+
//#endregion
|
|
2735
|
+
//#region node_modules/@thi.ng/color/lab/lab-lab.js
|
|
2736
|
+
var labLabD65_50 = (out, src) => xyzLab(out, xyzXyzD65_50(out, labXyzD65(out, src)));
|
|
2737
|
+
//#endregion
|
|
2738
|
+
//#region node_modules/@thi.ng/color/lch/lch-css.js
|
|
2739
|
+
var lchCss = (src) => __lchCss("lch", src, 100);
|
|
2740
|
+
//#endregion
|
|
2741
|
+
//#region node_modules/@thi.ng/color/oklab/oklab-css.js
|
|
2742
|
+
var oklabCss = (src) => __labCss("oklab", src, 1);
|
|
2743
|
+
//#endregion
|
|
2744
|
+
//#region node_modules/@thi.ng/color/oklch/oklch-css.js
|
|
2745
|
+
var oklchCss = (src) => __lchCss("oklch", src, 1);
|
|
2746
|
+
//#endregion
|
|
2747
|
+
//#region node_modules/@thi.ng/color/rgb/rgb-srgb.js
|
|
2748
|
+
var rgbSrgb = (out, src) => setC4(out || src, linearSrgb(src[0]), linearSrgb(src[1]), linearSrgb(src[2]), __ensureAlpha(src[3]));
|
|
2749
|
+
var GAMMA = 1 / 2.2;
|
|
2750
|
+
//#endregion
|
|
2751
|
+
//#region node_modules/@thi.ng/color/internal/scale.js
|
|
2752
|
+
var __scale8bit = (x, shift = 0) => (x < 0 ? 0 : x > 1 ? 1 : x) * 255 + .5 << shift;
|
|
2753
|
+
//#endregion
|
|
2754
|
+
//#region node_modules/@thi.ng/color/srgb/srgb-css.js
|
|
2755
|
+
var srgbCss = (src) => {
|
|
2756
|
+
const r = __scale8bit(src[0]);
|
|
2757
|
+
const g = __scale8bit(src[1]);
|
|
2758
|
+
const b = __scale8bit(src[2]);
|
|
2759
|
+
const a = __ensureAlpha(src[3]);
|
|
2760
|
+
return a < 1 ? `rgba(${r},${g},${b},${FF(a)})` : `#${U24(r << 16 | g << 8 | b)}`;
|
|
2761
|
+
};
|
|
2762
|
+
//#endregion
|
|
2763
|
+
//#region node_modules/@thi.ng/color/rgb/rgb-css.js
|
|
2764
|
+
var rgbCss = (src) => srgbCss(rgbSrgb([], src));
|
|
2765
|
+
//#endregion
|
|
2766
|
+
//#region node_modules/@thi.ng/color/css/css.js
|
|
2767
|
+
var CSS_LEVEL3 = {
|
|
2768
|
+
abgr32: (x) => intArgb32Css(intAbgr32Argb32(x[0])),
|
|
2769
|
+
argb32: (x) => intArgb32Css(x[0]),
|
|
2770
|
+
hsl: hslCss,
|
|
2771
|
+
hsv: hsvCss,
|
|
2772
|
+
lab50: (src) => srgbCss(rgbSrgb(null, labRgb([], src))),
|
|
2773
|
+
lab65: (src) => srgbCss(rgbSrgb(null, labRgbD65([], src))),
|
|
2774
|
+
lch: (src) => srgbCss(rgbSrgb(null, labRgb(null, lchLab([], src)))),
|
|
2775
|
+
rgb: rgbCss,
|
|
2776
|
+
srgb: srgbCss
|
|
2777
|
+
};
|
|
2778
|
+
var CSS_LEVEL4 = {
|
|
2779
|
+
...CSS_LEVEL3,
|
|
2780
|
+
lab50: labCss,
|
|
2781
|
+
lab65: (x) => labCss(labLabD65_50([], x)),
|
|
2782
|
+
lch: lchCss,
|
|
2783
|
+
oklab: oklabCss,
|
|
2784
|
+
oklch: oklchCss
|
|
2785
|
+
};
|
|
2786
|
+
var CSS_DEFAULT = CSS_LEVEL3;
|
|
2787
|
+
var css = (src, cssTarget = CSS_DEFAULT) => {
|
|
2788
|
+
let asCss;
|
|
2789
|
+
return isString(src) ? src : isNumber(src) ? intArgb32Css(src) : src.mode ? (asCss = cssTarget[src.mode]) ? asCss(src) : cssTarget.rgb(convert([], src, "rgb", src.mode)) : srgbCss(src);
|
|
2790
|
+
};
|
|
2791
|
+
//#endregion
|
|
2792
|
+
//#region node_modules/@thi.ng/color/hsl/hsl-hsv.js
|
|
2793
|
+
var hslHsv = (out, src) => {
|
|
2794
|
+
out = clampH(out || src, src);
|
|
2795
|
+
const s = out[1];
|
|
2796
|
+
const l = out[2];
|
|
2797
|
+
const l2 = 2 * l;
|
|
2798
|
+
const v = (l2 + s * (1 - Math.abs(l2 - 1))) * .5;
|
|
2799
|
+
out[1] = 2 * (v - l) / v;
|
|
2800
|
+
out[2] = v;
|
|
2801
|
+
return out;
|
|
2802
|
+
};
|
|
2803
|
+
//#endregion
|
|
2804
|
+
//#region node_modules/@thi.ng/color/rgb/rgb-hcv.js
|
|
2805
|
+
var rgbHcv = (out, src) => {
|
|
2806
|
+
out = clamp(out || src, src);
|
|
2807
|
+
const p = out[1] < out[2] ? [
|
|
2808
|
+
out[2],
|
|
2809
|
+
out[1],
|
|
2810
|
+
-1,
|
|
2811
|
+
2 / 3
|
|
2812
|
+
] : [
|
|
2813
|
+
out[1],
|
|
2814
|
+
out[2],
|
|
2815
|
+
0,
|
|
2816
|
+
-1 / 3
|
|
2817
|
+
];
|
|
2818
|
+
const q = out[0] < p[0] ? [
|
|
2819
|
+
p[0],
|
|
2820
|
+
p[1],
|
|
2821
|
+
p[3],
|
|
2822
|
+
out[0]
|
|
2823
|
+
] : [
|
|
2824
|
+
out[0],
|
|
2825
|
+
p[1],
|
|
2826
|
+
p[2],
|
|
2827
|
+
p[0]
|
|
2828
|
+
];
|
|
2829
|
+
const c = q[0] - Math.min(q[1], q[3]);
|
|
2830
|
+
return setC3(out, clamp01(Math.abs((q[3] - q[1]) / (6 * c + EPS$1) + q[2])), clamp01(c), clamp01(q[0]));
|
|
2831
|
+
};
|
|
2832
|
+
//#endregion
|
|
2833
|
+
//#region node_modules/@thi.ng/color/rgb/rgb-hsv.js
|
|
2834
|
+
var rgbHsv = (out, src) => {
|
|
2835
|
+
out = rgbHcv(out, src);
|
|
2836
|
+
out[1] /= out[2] + EPS$1;
|
|
2837
|
+
return out;
|
|
2838
|
+
};
|
|
2839
|
+
//#endregion
|
|
2840
|
+
//#region node_modules/@thi.ng/color/hsv/hsv.js
|
|
2841
|
+
var hsv = defColor({
|
|
2842
|
+
mode: "hsv",
|
|
2843
|
+
channels: { h: { hue: true } },
|
|
2844
|
+
order: [
|
|
2845
|
+
"h",
|
|
2846
|
+
"s",
|
|
2847
|
+
"v",
|
|
2848
|
+
"alpha"
|
|
2849
|
+
],
|
|
2850
|
+
from: {
|
|
2851
|
+
rgb: rgbHsv,
|
|
2852
|
+
srgb: rgbHsv,
|
|
2853
|
+
hsl: hslHsv,
|
|
2854
|
+
lch: [
|
|
2855
|
+
lchLab,
|
|
2856
|
+
labRgb,
|
|
2857
|
+
rgbSrgb,
|
|
2858
|
+
rgbHsv
|
|
2859
|
+
]
|
|
2860
|
+
},
|
|
2861
|
+
toRgb: hsvRgb
|
|
2862
|
+
});
|
|
2863
|
+
//#endregion
|
|
2864
|
+
//#region node_modules/@thi.ng/vectors/defopvn.js
|
|
2865
|
+
var defOpVN = (op, dispatch = 1) => {
|
|
2866
|
+
const a = (o, a2, n) => {
|
|
2867
|
+
!o && (o = a2);
|
|
2868
|
+
for (let i = a2.length; i-- > 0;) o[i] = op(a2[i], n);
|
|
2869
|
+
return o;
|
|
2870
|
+
};
|
|
2871
|
+
const b = (o, a2, n) => {
|
|
2872
|
+
!o && (o = a2);
|
|
2873
|
+
o[0] = op(a2[0], n);
|
|
2874
|
+
o[1] = op(a2[1], n);
|
|
2875
|
+
return o;
|
|
2876
|
+
};
|
|
2877
|
+
const c = (o, a2, n) => {
|
|
2878
|
+
!o && (o = a2);
|
|
2879
|
+
o[0] = op(a2[0], n);
|
|
2880
|
+
o[1] = op(a2[1], n);
|
|
2881
|
+
o[2] = op(a2[2], n);
|
|
2882
|
+
return o;
|
|
2883
|
+
};
|
|
2884
|
+
const d = (o, a2, n) => {
|
|
2885
|
+
!o && (o = a2);
|
|
2886
|
+
o[0] = op(a2[0], n);
|
|
2887
|
+
o[1] = op(a2[1], n);
|
|
2888
|
+
o[2] = op(a2[2], n);
|
|
2889
|
+
o[3] = op(a2[3], n);
|
|
2890
|
+
return o;
|
|
2891
|
+
};
|
|
2892
|
+
return [
|
|
2893
|
+
vop(dispatch, a, b, c, d),
|
|
2894
|
+
b,
|
|
2895
|
+
c,
|
|
2896
|
+
d
|
|
2897
|
+
];
|
|
2898
|
+
};
|
|
2899
|
+
//#endregion
|
|
2900
|
+
//#region node_modules/@thi.ng/vectors/pown.js
|
|
2901
|
+
var [a$6, b$6, c$6, d$6] = defOpVN(Math.pow);
|
|
2902
|
+
var powN3 = c$6;
|
|
2903
|
+
//#endregion
|
|
2904
|
+
//#region node_modules/@thi.ng/color/rgb/rgb-oklab.js
|
|
2905
|
+
var CONE_LMS = [
|
|
2906
|
+
.4122214708,
|
|
2907
|
+
.2119034982,
|
|
2908
|
+
.0883024619,
|
|
2909
|
+
.5363325363,
|
|
2910
|
+
.6806995451,
|
|
2911
|
+
.2817188376,
|
|
2912
|
+
.0514459929,
|
|
2913
|
+
.1073969566,
|
|
2914
|
+
.6299787005
|
|
2915
|
+
];
|
|
2916
|
+
var rgbOklab = (out, src) => __mulV33(null, OKLAB_M2, powN3(null, __mulV33(out, CONE_LMS, src), 1 / 3));
|
|
2917
|
+
//#endregion
|
|
2918
|
+
//#region node_modules/@thi.ng/color/oklch/oklab-oklch.js
|
|
2919
|
+
var oklabOklch = (out, src) => setC4(out || src, src[0], Math.hypot(src[1], src[2]), atan2Abs(src[2], src[1]) * INV_TAU, __ensureAlpha(src[3]));
|
|
2920
|
+
//#endregion
|
|
2921
|
+
//#region node_modules/@thi.ng/color/oklch/oklch-oklab.js
|
|
2922
|
+
var oklchOklab = (out, src) => setC4(out || src, src[0], ...cossin(src[2] * TAU, src[1]), __ensureAlpha(src[3]));
|
|
2923
|
+
//#endregion
|
|
2924
|
+
//#region node_modules/@thi.ng/color/oklch/oklch.js
|
|
2925
|
+
var oklch = defColor({
|
|
2926
|
+
mode: "oklch",
|
|
2927
|
+
channels: { c: { range: [0, .3225] } },
|
|
2928
|
+
order: [
|
|
2929
|
+
"l",
|
|
2930
|
+
"c",
|
|
2931
|
+
"h",
|
|
2932
|
+
"alpha"
|
|
2933
|
+
],
|
|
2934
|
+
from: {
|
|
2935
|
+
oklab: oklabOklch,
|
|
2936
|
+
rgb: (out, src) => oklabOklch(null, rgbOklab(out, src))
|
|
2937
|
+
},
|
|
2938
|
+
toRgb: [oklchOklab, oklabRgb]
|
|
2939
|
+
});
|
|
2940
|
+
//#endregion
|
|
2941
|
+
//#region node_modules/@thi.ng/color/srgb/srgb.js
|
|
2942
|
+
var srgb = defColor({
|
|
2943
|
+
mode: "srgb",
|
|
2944
|
+
order: [
|
|
2945
|
+
"r",
|
|
2946
|
+
"g",
|
|
2947
|
+
"b",
|
|
2948
|
+
"alpha"
|
|
2949
|
+
],
|
|
2950
|
+
from: {
|
|
2951
|
+
abgr32: (out, src) => intAbgr32Srgb(out, src[0]),
|
|
2952
|
+
argb32: (out, src) => intArgb32Srgb(out, src[0]),
|
|
2953
|
+
hcy: hcyRgb,
|
|
2954
|
+
hsi: hsiRgb,
|
|
2955
|
+
hsl: hslRgb,
|
|
2956
|
+
hsv: hsvRgb,
|
|
2957
|
+
rgb: rgbSrgb
|
|
2958
|
+
},
|
|
2959
|
+
toRgb: srgbRgb
|
|
2960
|
+
});
|
|
2961
|
+
//#endregion
|
|
2962
|
+
//#region node_modules/@thi.ng/compare/compare.js
|
|
2963
|
+
var compare = (a, b) => {
|
|
2964
|
+
if (a === b) return 0;
|
|
2965
|
+
if (a == null) return b == null ? 0 : -1;
|
|
2966
|
+
if (b == null) return a == null ? 0 : 1;
|
|
2967
|
+
if (typeof a.compare === "function") return a.compare(b);
|
|
2968
|
+
if (typeof b.compare === "function") return -b.compare(a);
|
|
2969
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
2970
|
+
};
|
|
2971
|
+
//#endregion
|
|
2972
|
+
//#region node_modules/@thi.ng/compare/keys.js
|
|
2973
|
+
var __key = (k) => typeof k === "function" ? k : (x) => x[k];
|
|
2974
|
+
function compareByKey(key, cmp = compare) {
|
|
2975
|
+
const kfn = __key(key);
|
|
2976
|
+
return (x, y) => cmp(kfn(x), kfn(y));
|
|
2977
|
+
}
|
|
2978
|
+
//#endregion
|
|
2979
|
+
//#region node_modules/@thi.ng/compare/numeric.js
|
|
2980
|
+
var compareNumDesc = (a, b) => b - a;
|
|
2981
|
+
//#endregion
|
|
2982
|
+
//#region node_modules/@thi.ng/vectors/defopvv.js
|
|
2983
|
+
var defOpVV = (op, dispatch = 1, outA = true) => {
|
|
2984
|
+
const a = outA ? (o, a2, b2) => {
|
|
2985
|
+
!o && (o = a2);
|
|
2986
|
+
for (let i = a2.length; i-- > 0;) o[i] = op(a2[i], b2[i]);
|
|
2987
|
+
return o;
|
|
2988
|
+
} : (o, a2, b2) => {
|
|
2989
|
+
!o && (o = b2);
|
|
2990
|
+
for (let i = a2.length; i-- > 0;) o[i] = op(a2[i], b2[i]);
|
|
2991
|
+
return o;
|
|
2992
|
+
};
|
|
2993
|
+
const b = outA ? (o, a2, b2) => {
|
|
2994
|
+
!o && (o = a2);
|
|
2995
|
+
o[0] = op(a2[0], b2[0]);
|
|
2996
|
+
o[1] = op(a2[1], b2[1]);
|
|
2997
|
+
return o;
|
|
2998
|
+
} : (o, a2, b2) => {
|
|
2999
|
+
!o && (o = b2);
|
|
3000
|
+
o[0] = op(a2[0], b2[0]);
|
|
3001
|
+
o[1] = op(a2[1], b2[1]);
|
|
3002
|
+
return o;
|
|
3003
|
+
};
|
|
3004
|
+
const c = outA ? (o, a2, b2) => {
|
|
3005
|
+
!o && (o = a2);
|
|
3006
|
+
o[0] = op(a2[0], b2[0]);
|
|
3007
|
+
o[1] = op(a2[1], b2[1]);
|
|
3008
|
+
o[2] = op(a2[2], b2[2]);
|
|
3009
|
+
return o;
|
|
3010
|
+
} : (o, a2, b2) => {
|
|
3011
|
+
!o && (o = b2);
|
|
3012
|
+
o[0] = op(a2[0], b2[0]);
|
|
3013
|
+
o[1] = op(a2[1], b2[1]);
|
|
3014
|
+
o[2] = op(a2[2], b2[2]);
|
|
3015
|
+
return o;
|
|
3016
|
+
};
|
|
3017
|
+
const d = outA ? (o, a2, b2) => {
|
|
3018
|
+
!o && (o = a2);
|
|
3019
|
+
o[0] = op(a2[0], b2[0]);
|
|
3020
|
+
o[1] = op(a2[1], b2[1]);
|
|
3021
|
+
o[2] = op(a2[2], b2[2]);
|
|
3022
|
+
o[3] = op(a2[3], b2[3]);
|
|
3023
|
+
return o;
|
|
3024
|
+
} : (o, a2, b2) => {
|
|
3025
|
+
!o && (o = b2);
|
|
3026
|
+
o[0] = op(a2[0], b2[0]);
|
|
3027
|
+
o[1] = op(a2[1], b2[1]);
|
|
3028
|
+
o[2] = op(a2[2], b2[2]);
|
|
3029
|
+
o[3] = op(a2[3], b2[3]);
|
|
3030
|
+
return o;
|
|
3031
|
+
};
|
|
3032
|
+
return [
|
|
3033
|
+
vop(dispatch, a, b, c, d),
|
|
3034
|
+
b,
|
|
3035
|
+
c,
|
|
3036
|
+
d
|
|
3037
|
+
];
|
|
3038
|
+
};
|
|
3039
|
+
//#endregion
|
|
3040
|
+
//#region node_modules/@thi.ng/vectors/ops.js
|
|
3041
|
+
var $add = (a, b) => a + b;
|
|
3042
|
+
var $mul = (a, b) => a * b;
|
|
3043
|
+
var $sub = (a, b) => a - b;
|
|
3044
|
+
//#endregion
|
|
3045
|
+
//#region node_modules/@thi.ng/vectors/add.js
|
|
3046
|
+
var [a$5, b$5, c$5, d$5] = defOpVV($add);
|
|
3047
|
+
var add = a$5;
|
|
3048
|
+
var add2 = b$5;
|
|
3049
|
+
//#endregion
|
|
3050
|
+
//#region node_modules/@thi.ng/vectors/api.js
|
|
3051
|
+
var mi = -Infinity;
|
|
3052
|
+
var mx = Infinity;
|
|
3053
|
+
var MIN2 = Object.freeze([mi, mi]);
|
|
3054
|
+
var MAX2 = Object.freeze([mx, mx]);
|
|
3055
|
+
var ONE2 = Object.freeze([1, 1]);
|
|
3056
|
+
var ZERO2 = Object.freeze([0, 0]);
|
|
3057
|
+
var X2 = Object.freeze([1, 0]);
|
|
3058
|
+
var Y2 = Object.freeze([0, 1]);
|
|
3059
|
+
var MIN3 = Object.freeze([
|
|
3060
|
+
mi,
|
|
3061
|
+
mi,
|
|
3062
|
+
mi
|
|
3063
|
+
]);
|
|
3064
|
+
var MAX3 = Object.freeze([
|
|
3065
|
+
mx,
|
|
3066
|
+
mx,
|
|
3067
|
+
mx
|
|
3068
|
+
]);
|
|
3069
|
+
var ONE3 = Object.freeze([
|
|
3070
|
+
1,
|
|
3071
|
+
1,
|
|
3072
|
+
1
|
|
3073
|
+
]);
|
|
3074
|
+
var ZERO3 = Object.freeze([
|
|
3075
|
+
0,
|
|
3076
|
+
0,
|
|
3077
|
+
0
|
|
3078
|
+
]);
|
|
3079
|
+
var X3 = Object.freeze([
|
|
3080
|
+
1,
|
|
3081
|
+
0,
|
|
3082
|
+
0
|
|
3083
|
+
]);
|
|
3084
|
+
var Y3 = Object.freeze([
|
|
3085
|
+
0,
|
|
3086
|
+
1,
|
|
3087
|
+
0
|
|
3088
|
+
]);
|
|
3089
|
+
var Z3 = Object.freeze([
|
|
3090
|
+
0,
|
|
3091
|
+
0,
|
|
3092
|
+
1
|
|
3093
|
+
]);
|
|
3094
|
+
var MIN4 = Object.freeze([
|
|
3095
|
+
mi,
|
|
3096
|
+
mi,
|
|
3097
|
+
mi,
|
|
3098
|
+
mi
|
|
3099
|
+
]);
|
|
3100
|
+
var MAX4 = Object.freeze([
|
|
3101
|
+
mx,
|
|
3102
|
+
mx,
|
|
3103
|
+
mx,
|
|
3104
|
+
mx
|
|
3105
|
+
]);
|
|
3106
|
+
var ONE4 = Object.freeze([
|
|
3107
|
+
1,
|
|
3108
|
+
1,
|
|
3109
|
+
1,
|
|
3110
|
+
1
|
|
3111
|
+
]);
|
|
3112
|
+
var ZERO4 = Object.freeze([
|
|
3113
|
+
0,
|
|
3114
|
+
0,
|
|
3115
|
+
0,
|
|
3116
|
+
0
|
|
3117
|
+
]);
|
|
3118
|
+
var X4 = Object.freeze([
|
|
3119
|
+
1,
|
|
3120
|
+
0,
|
|
3121
|
+
0,
|
|
3122
|
+
0
|
|
3123
|
+
]);
|
|
3124
|
+
var Y4 = Object.freeze([
|
|
3125
|
+
0,
|
|
3126
|
+
1,
|
|
3127
|
+
0,
|
|
3128
|
+
0
|
|
3129
|
+
]);
|
|
3130
|
+
var Z4 = Object.freeze([
|
|
3131
|
+
0,
|
|
3132
|
+
0,
|
|
3133
|
+
1,
|
|
3134
|
+
0
|
|
3135
|
+
]);
|
|
3136
|
+
var W4 = Object.freeze([
|
|
3137
|
+
0,
|
|
3138
|
+
0,
|
|
3139
|
+
0,
|
|
3140
|
+
1
|
|
3141
|
+
]);
|
|
3142
|
+
//#endregion
|
|
3143
|
+
//#region node_modules/@thi.ng/vectors/cartesian.js
|
|
3144
|
+
var cos = Math.cos;
|
|
3145
|
+
var sin = Math.sin;
|
|
3146
|
+
var cartesian = vop(1);
|
|
3147
|
+
var cartesian2 = cartesian.add(2, (out, v, offset = ZERO2) => add2(out || v, cossin(v[1], v[0]), offset));
|
|
3148
|
+
var cartesian3 = cartesian.add(3, (out, v, offset = ZERO3) => {
|
|
3149
|
+
const r = v[0];
|
|
3150
|
+
const theta = v[1];
|
|
3151
|
+
const phi = v[2];
|
|
3152
|
+
const ct = cos(theta);
|
|
3153
|
+
return setC3(out || v, r * ct * cos(phi) + offset[0], r * ct * sin(phi) + offset[1], r * sin(theta) + offset[2]);
|
|
3154
|
+
});
|
|
3155
|
+
var cartesian2FromAngles = (angles, n) => {
|
|
3156
|
+
const polar = [];
|
|
3157
|
+
for (const x of angles) polar.push(cossin(x, n));
|
|
3158
|
+
return polar;
|
|
3159
|
+
};
|
|
3160
|
+
//#endregion
|
|
3161
|
+
//#region node_modules/@thi.ng/vectors/ensure.js
|
|
3162
|
+
var __ensureInputs = (src) => assert(src.length > 0, `no inputs given`);
|
|
3163
|
+
//#endregion
|
|
3164
|
+
//#region node_modules/@thi.ng/vectors/muln.js
|
|
3165
|
+
var [a$4, b$4, c$4, d$4] = defOpVN($mul);
|
|
3166
|
+
var mulN = a$4;
|
|
3167
|
+
//#endregion
|
|
3168
|
+
//#region node_modules/@thi.ng/vectors/sum.js
|
|
3169
|
+
var sum2 = (a) => a[0] + a[1];
|
|
3170
|
+
var sum3 = (a) => a[0] + a[1] + a[2];
|
|
3171
|
+
var sum4 = (a) => a[0] + a[1] + a[2] + a[3];
|
|
3172
|
+
var sum = vop(0, (v) => {
|
|
3173
|
+
let res = 0;
|
|
3174
|
+
for (let i = v.length; i-- > 0;) res += v[i];
|
|
3175
|
+
return res;
|
|
3176
|
+
}, sum2, sum3, sum4);
|
|
3177
|
+
//#endregion
|
|
3178
|
+
//#region node_modules/@thi.ng/vectors/mean.js
|
|
3179
|
+
var mean = (out, src) => {
|
|
3180
|
+
__ensureInputs(src);
|
|
3181
|
+
out = set(out || [], src[0]);
|
|
3182
|
+
for (let i = src.length; i-- > 1;) add(out, out, src[i]);
|
|
3183
|
+
return mulN(out, out, 1 / src.length);
|
|
3184
|
+
};
|
|
3185
|
+
var vmean = (a) => a.length > 0 ? sum(a) / a.length : 0;
|
|
3186
|
+
//#endregion
|
|
3187
|
+
//#region node_modules/@thi.ng/vectors/subn.js
|
|
3188
|
+
var [a$3, b$3, c$3, d$3] = defOpVN($sub);
|
|
3189
|
+
var subN = a$3;
|
|
3190
|
+
//#endregion
|
|
3191
|
+
//#region node_modules/@thi.ng/vectors/center.js
|
|
3192
|
+
var center = (out, a) => subN(out, a, vmean(a));
|
|
3193
|
+
//#endregion
|
|
3194
|
+
//#region node_modules/@thi.ng/vectors/heading.js
|
|
3195
|
+
var headingXY = (a) => atan2Abs(a[1], a[0]);
|
|
3196
|
+
//#endregion
|
|
3197
|
+
//#region node_modules/@thi.ng/vectors/magsq.js
|
|
3198
|
+
var magSq2 = (a) => a[0] * a[0] + a[1] * a[1];
|
|
3199
|
+
var magSq3 = (a) => a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
|
|
3200
|
+
var magSq4 = (a) => a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3];
|
|
3201
|
+
var magSq = vop(0, (a) => {
|
|
3202
|
+
let sum = 0;
|
|
3203
|
+
for (let i = a.length; i-- > 0;) sum += a[i] * a[i];
|
|
3204
|
+
return sum;
|
|
3205
|
+
}, magSq2, magSq3, magSq4);
|
|
3206
|
+
//#endregion
|
|
3207
|
+
//#region node_modules/@thi.ng/vectors/variance.js
|
|
3208
|
+
var variance = (a, isCentered = false, corrected = false) => {
|
|
3209
|
+
const k = ~~corrected;
|
|
3210
|
+
return a.length > k ? magSq(isCentered ? a : center([], a)) / (a.length - k) : 0;
|
|
3211
|
+
};
|
|
3212
|
+
var sd = (a, isCentered = false, corrected = false) => Math.sqrt(variance(a, isCentered, corrected));
|
|
3213
|
+
//#endregion
|
|
3214
|
+
//#region node_modules/@thi.ng/vectors/circular.js
|
|
3215
|
+
var circularMean = (angles) => headingXY(mean([], cartesian2FromAngles(angles)));
|
|
3216
|
+
var centerCircular = (out, angles) => {
|
|
3217
|
+
const mean2 = circularMean(angles);
|
|
3218
|
+
!out && (out = []);
|
|
3219
|
+
for (let i = 0, n = angles.length; i < n; i++) out[i] = (angles[i] - mean2 + PI) % TAU;
|
|
3220
|
+
return center(null, out);
|
|
3221
|
+
};
|
|
3222
|
+
var circularSD = (angles, corrected) => sd(centerCircular([], angles), true, corrected);
|
|
3223
|
+
//#endregion
|
|
3224
|
+
//#region node_modules/@thi.ng/vectors/max.js
|
|
3225
|
+
var [a$2, b$2, c$2, d$2] = defOpVV(Math.max);
|
|
3226
|
+
var vmax = (v) => {
|
|
3227
|
+
let max5 = -Infinity;
|
|
3228
|
+
for (let i = v.length; i-- > 0;) max5 = Math.max(max5, v[i]);
|
|
3229
|
+
return max5;
|
|
3230
|
+
};
|
|
3231
|
+
//#endregion
|
|
3232
|
+
//#region node_modules/@thi.ng/vectors/median.js
|
|
3233
|
+
var vmedian = (a) => {
|
|
3234
|
+
if (!a.length) return 0;
|
|
3235
|
+
const n = a.length;
|
|
3236
|
+
const m = n >> 1;
|
|
3237
|
+
a = [...a].sort((a2, b) => a2 - b);
|
|
3238
|
+
return n & 1 ? a[m] : (a[m - 1] + a[m]) * .5;
|
|
3239
|
+
};
|
|
3240
|
+
//#endregion
|
|
3241
|
+
//#region node_modules/@thi.ng/vectors/min.js
|
|
3242
|
+
var [a$1, b$1, c$1, d$1] = defOpVV(Math.min);
|
|
3243
|
+
var vmin = (v) => {
|
|
3244
|
+
let min5 = Infinity;
|
|
3245
|
+
for (let i = v.length; i-- > 0;) min5 = Math.min(min5, v[i]);
|
|
3246
|
+
return min5;
|
|
3247
|
+
};
|
|
3248
|
+
//#endregion
|
|
3249
|
+
//#region node_modules/@thi.ng/metrics/metrics.js
|
|
3250
|
+
var defMetric = (values) => {
|
|
3251
|
+
const [min, max] = valueRange(values);
|
|
3252
|
+
return {
|
|
3253
|
+
min,
|
|
3254
|
+
max,
|
|
3255
|
+
mean: vmean(values),
|
|
3256
|
+
median: vmedian(values),
|
|
3257
|
+
sd: sd(values)
|
|
3258
|
+
};
|
|
3259
|
+
};
|
|
3260
|
+
var defWeightedMetric = (values, weights) => {
|
|
3261
|
+
const [min, max] = valueRange(values);
|
|
3262
|
+
return {
|
|
3263
|
+
min,
|
|
3264
|
+
max,
|
|
3265
|
+
mean: vmean(values),
|
|
3266
|
+
median: vmedian(values),
|
|
3267
|
+
sd: sd(values),
|
|
3268
|
+
weighted: dot(values, weights)
|
|
3269
|
+
};
|
|
3270
|
+
};
|
|
3271
|
+
var defCircularMetric = (values) => {
|
|
3272
|
+
const scaledValues = values.map((x) => x * TAU);
|
|
3273
|
+
const mean = fract(circularMean(scaledValues) / TAU);
|
|
3274
|
+
const [min, max] = circularRange(values, mean);
|
|
3275
|
+
return {
|
|
3276
|
+
min,
|
|
3277
|
+
max,
|
|
3278
|
+
mean,
|
|
3279
|
+
median: __circularMedian(values, min, max),
|
|
3280
|
+
sd: circularSD(scaledValues) / TAU
|
|
3281
|
+
};
|
|
3282
|
+
};
|
|
3283
|
+
var valueRange = (values) => [vmin(values), vmax(values)];
|
|
3284
|
+
var circularRange = (values, mean) => {
|
|
3285
|
+
const range = valueRange(values);
|
|
3286
|
+
const [min, max] = range;
|
|
3287
|
+
if (mean < min || mean > max) return [values.reduce((acc, x) => {
|
|
3288
|
+
const d = fract(mean - x);
|
|
3289
|
+
return d < .5 && d > acc[1] ? [x, d] : acc;
|
|
3290
|
+
}, [max, fract(mean - max)])[0], values.reduce((acc, x) => {
|
|
3291
|
+
const d = fract(x - mean);
|
|
3292
|
+
return d < .5 && d > acc[1] ? [x, d] : acc;
|
|
3293
|
+
}, [min, fract(min - mean)])[0]];
|
|
3294
|
+
return range;
|
|
3295
|
+
};
|
|
3296
|
+
var __circularMedian = (values, min, max) => {
|
|
3297
|
+
if (min <= max) return vmedian(values);
|
|
3298
|
+
const n = values.length;
|
|
3299
|
+
const m = n >> 1;
|
|
3300
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
3301
|
+
const split = sorted.findIndex((x) => x === min);
|
|
3302
|
+
const reordered = sorted.slice(split).concat(sorted.slice(0, split));
|
|
3303
|
+
return n & 1 ? reordered[m] : (reordered[m - 1] + reordered[m]) * .5;
|
|
3304
|
+
};
|
|
3305
|
+
//#endregion
|
|
3306
|
+
//#region node_modules/@thi.ng/checks/is-function.js
|
|
3307
|
+
var isFunction = (x) => typeof x === "function";
|
|
3308
|
+
//#endregion
|
|
3309
|
+
//#region node_modules/@thi.ng/vectors/distsq.js
|
|
3310
|
+
var distSq2 = (a, b) => {
|
|
3311
|
+
const dx = a[0] - b[0];
|
|
3312
|
+
const dy = a[1] - b[1];
|
|
3313
|
+
return dx * dx + dy * dy;
|
|
3314
|
+
};
|
|
3315
|
+
var distSq3 = (a, b) => {
|
|
3316
|
+
const dx = a[0] - b[0];
|
|
3317
|
+
const dy = a[1] - b[1];
|
|
3318
|
+
const dz = a[2] - b[2];
|
|
3319
|
+
return dx * dx + dy * dy + dz * dz;
|
|
3320
|
+
};
|
|
3321
|
+
var distSq4 = (a, b) => {
|
|
3322
|
+
const dx = a[0] - b[0];
|
|
3323
|
+
const dy = a[1] - b[1];
|
|
3324
|
+
const dz = a[2] - b[2];
|
|
3325
|
+
const dw = a[3] - b[3];
|
|
3326
|
+
return dx * dx + dy * dy + dz * dz + dw * dw;
|
|
3327
|
+
};
|
|
3328
|
+
var distSq = vop(0, (a, b) => {
|
|
3329
|
+
let sum = 0;
|
|
3330
|
+
for (let i = a.length; i-- > 0;) {
|
|
3331
|
+
const d = a[i] - b[i];
|
|
3332
|
+
sum += d * d;
|
|
3333
|
+
}
|
|
3334
|
+
return sum;
|
|
3335
|
+
}, distSq2, distSq3, distSq4);
|
|
3336
|
+
//#endregion
|
|
3337
|
+
//#region node_modules/@thi.ng/distance/squared.js
|
|
3338
|
+
var Squared = class {
|
|
3339
|
+
constructor(metric) {
|
|
3340
|
+
this.metric = metric;
|
|
3341
|
+
}
|
|
3342
|
+
to(x) {
|
|
3343
|
+
return x * x;
|
|
3344
|
+
}
|
|
3345
|
+
from(x) {
|
|
3346
|
+
return Math.sqrt(x);
|
|
3347
|
+
}
|
|
3348
|
+
};
|
|
3349
|
+
var DIST_SQ = new Squared(distSq);
|
|
3350
|
+
var DIST_SQ1 = new Squared((a, b) => (a - b) ** 2);
|
|
3351
|
+
var DIST_SQ2 = new Squared(distSq2);
|
|
3352
|
+
var DIST_SQ3 = new Squared(distSq3);
|
|
3353
|
+
//#endregion
|
|
3354
|
+
//#region node_modules/@thi.ng/distance/argmin.js
|
|
3355
|
+
var argmin = (p, samples, dist = DIST_SQ) => {
|
|
3356
|
+
const distFn = isFunction(dist) ? dist : dist.metric;
|
|
3357
|
+
let minD = Infinity;
|
|
3358
|
+
let minArg = -1;
|
|
3359
|
+
for (let i = 0, n = samples.length; i < n; i++) {
|
|
3360
|
+
const d = distFn(p, samples[i]);
|
|
3361
|
+
if (d < minD) {
|
|
3362
|
+
minD = d;
|
|
3363
|
+
minArg = i;
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
return minArg;
|
|
3367
|
+
};
|
|
3368
|
+
//#endregion
|
|
3369
|
+
//#region node_modules/@thi.ng/vectors/setn.js
|
|
3370
|
+
var setN2 = (a, n) => {
|
|
3371
|
+
a[0] = n;
|
|
3372
|
+
a[1] = n;
|
|
3373
|
+
return a;
|
|
3374
|
+
};
|
|
3375
|
+
var setN3 = (a, n) => {
|
|
3376
|
+
a[0] = n;
|
|
3377
|
+
a[1] = n;
|
|
3378
|
+
a[2] = n;
|
|
3379
|
+
return a;
|
|
3380
|
+
};
|
|
3381
|
+
var setN4 = (a, n) => {
|
|
3382
|
+
a[0] = n;
|
|
3383
|
+
a[1] = n;
|
|
3384
|
+
a[2] = n;
|
|
3385
|
+
a[3] = n;
|
|
3386
|
+
return a;
|
|
3387
|
+
};
|
|
3388
|
+
var setN = vop(0, (a, n) => {
|
|
3389
|
+
for (let i = a.length; i-- > 0;) a[i] = n;
|
|
3390
|
+
return a;
|
|
3391
|
+
}, setN2, setN3, setN4);
|
|
3392
|
+
var zeroes = (n) => Array(n).fill(0);
|
|
3393
|
+
var ones = (n) => Array(n).fill(1);
|
|
3394
|
+
//#endregion
|
|
3395
|
+
//#region node_modules/@thi.ng/k-means/kmeans.js
|
|
3396
|
+
var kmeans = (k, samples, opts = {}) => {
|
|
3397
|
+
let { dim = samples[0].length, dist = DIST_SQ, maxIter = 32, strategy = means, exponent, initial, rnd } = opts;
|
|
3398
|
+
const num = samples.length;
|
|
3399
|
+
const centroids = Array.isArray(initial) ? initial : initial ? initial(k, samples, dist, rnd) : kmeansPlusPlus(k, samples, dist, rnd, exponent);
|
|
3400
|
+
assert(centroids.length > 0, `missing initial centroids`);
|
|
3401
|
+
k = centroids.length;
|
|
3402
|
+
const clusters = new Uint32Array(num).fill(k);
|
|
3403
|
+
let update = true;
|
|
3404
|
+
while (update && maxIter-- > 0) {
|
|
3405
|
+
update = __assign(samples, centroids, clusters, dist);
|
|
3406
|
+
if (!update) break;
|
|
3407
|
+
for (let i = 0; i < k; i++) {
|
|
3408
|
+
const impl = strategy(dim);
|
|
3409
|
+
for (let j = 0; j < num; j++) i === clusters[j] && impl.update(samples[j]);
|
|
3410
|
+
const centroid = impl.finish();
|
|
3411
|
+
if (centroid) centroids[i] = centroid;
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
return __buildClusters(centroids, clusters);
|
|
3415
|
+
};
|
|
3416
|
+
var kmeansPlusPlus = (k, samples, dist = DIST_SQ, rnd = SYSTEM, exponent = 2) => {
|
|
3417
|
+
const num = samples.length;
|
|
3418
|
+
assert(num > 0, `missing samples`);
|
|
3419
|
+
k = Math.min(k, num);
|
|
3420
|
+
const centroidIDs = [rnd.int() % num];
|
|
3421
|
+
const centroids = [samples[centroidIDs[0]]];
|
|
3422
|
+
const indices = new Array(num).fill(0).map((_, i) => i);
|
|
3423
|
+
const metric = dist.metric;
|
|
3424
|
+
while (centroidIDs.length < k) {
|
|
3425
|
+
let psum = 0;
|
|
3426
|
+
const probs = samples.map((p) => {
|
|
3427
|
+
const d = dist.from(metric(p, centroids[argmin(p, centroids, dist)])) ** exponent;
|
|
3428
|
+
psum += d;
|
|
3429
|
+
return d;
|
|
3430
|
+
});
|
|
3431
|
+
if (!psum) break;
|
|
3432
|
+
let id;
|
|
3433
|
+
do
|
|
3434
|
+
id = weightedRandom(indices, probs, rnd)();
|
|
3435
|
+
while (centroidIDs.includes(id));
|
|
3436
|
+
centroidIDs.push(id);
|
|
3437
|
+
centroids.push(samples[id]);
|
|
3438
|
+
}
|
|
3439
|
+
return centroids;
|
|
3440
|
+
};
|
|
3441
|
+
var __assign = (samples, centroids, assignments, dist) => {
|
|
3442
|
+
let update = false;
|
|
3443
|
+
for (let i = samples.length; i-- > 0;) {
|
|
3444
|
+
const id = argmin(samples[i], centroids, dist);
|
|
3445
|
+
if (id !== assignments[i]) {
|
|
3446
|
+
assignments[i] = id;
|
|
3447
|
+
update = true;
|
|
3448
|
+
}
|
|
3449
|
+
}
|
|
3450
|
+
return update;
|
|
3451
|
+
};
|
|
3452
|
+
var __buildClusters = (centroids, assignments) => {
|
|
3453
|
+
const clusters = [];
|
|
3454
|
+
for (let i = 0, n = assignments.length; i < n; i++) {
|
|
3455
|
+
const id = assignments[i];
|
|
3456
|
+
(clusters[id] || (clusters[id] = {
|
|
3457
|
+
id,
|
|
3458
|
+
centroid: centroids[id],
|
|
3459
|
+
items: []
|
|
3460
|
+
})).items.push(i);
|
|
3461
|
+
}
|
|
3462
|
+
return clusters.filter((x) => !!x);
|
|
3463
|
+
};
|
|
3464
|
+
var means = (dim) => {
|
|
3465
|
+
const acc = zeroes(dim);
|
|
3466
|
+
let n = 0;
|
|
3467
|
+
return {
|
|
3468
|
+
update: (p) => {
|
|
3469
|
+
add(acc, acc, p);
|
|
3470
|
+
n++;
|
|
3471
|
+
},
|
|
3472
|
+
finish: () => n ? mulN(acc, acc, 1 / n) : void 0
|
|
3473
|
+
};
|
|
3474
|
+
};
|
|
3475
|
+
//#endregion
|
|
3476
|
+
//#region node_modules/@thi.ng/pixel-dominant-colors/utils.js
|
|
3477
|
+
var filterSamples = (pred, img) => {
|
|
3478
|
+
const samples = [];
|
|
3479
|
+
let i = 0;
|
|
3480
|
+
for (const p of img) {
|
|
3481
|
+
if (pred(p, i)) samples.push(p);
|
|
3482
|
+
i++;
|
|
3483
|
+
}
|
|
3484
|
+
return samples;
|
|
3485
|
+
};
|
|
3486
|
+
//#endregion
|
|
3487
|
+
//#region node_modules/@thi.ng/pixel-dominant-colors/kmeans.js
|
|
3488
|
+
var dominantColorsKmeans = (img, num, opts) => {
|
|
3489
|
+
const samples = opts?.filter ? filterSamples(opts.filter, img) : Array.isArray(img) ? img : [...img];
|
|
3490
|
+
return samples.length ? kmeans(Math.min(num, samples.length), samples, opts).sort((a, b) => b.items.length - a.items.length).map((c) => ({
|
|
3491
|
+
color: [...c.centroid],
|
|
3492
|
+
area: c.items.length / samples.length,
|
|
3493
|
+
ids: c.items
|
|
3494
|
+
})) : [];
|
|
3495
|
+
};
|
|
3496
|
+
//#endregion
|
|
3497
|
+
//#region node_modules/@thi.ng/checks/is-iterable.js
|
|
3498
|
+
var isIterable = (x) => typeof x?.[Symbol.iterator] === "function";
|
|
3499
|
+
//#endregion
|
|
3500
|
+
//#region node_modules/@thi.ng/transducers/compr.js
|
|
3501
|
+
var compR = (rfn, fn) => [
|
|
3502
|
+
rfn[0],
|
|
3503
|
+
rfn[1],
|
|
3504
|
+
fn
|
|
3505
|
+
];
|
|
3506
|
+
//#endregion
|
|
3507
|
+
//#region node_modules/@thi.ng/api/api.js
|
|
3508
|
+
var SEMAPHORE = Symbol();
|
|
3509
|
+
var NO_OP = () => {};
|
|
3510
|
+
//#endregion
|
|
3511
|
+
//#region node_modules/@thi.ng/transducers/ensure.js
|
|
3512
|
+
var ensureTransducer = (x) => implementsFunction(x, "xform") ? x.xform() : x;
|
|
3513
|
+
//#endregion
|
|
3514
|
+
//#region node_modules/@thi.ng/errors/illegal-arity.js
|
|
3515
|
+
var IllegalArityError = defError(() => "illegal arity");
|
|
3516
|
+
var illegalArity = (n) => {
|
|
3517
|
+
throw new IllegalArityError(n);
|
|
3518
|
+
};
|
|
3519
|
+
//#endregion
|
|
3520
|
+
//#region node_modules/@thi.ng/transducers/reduced.js
|
|
3521
|
+
var Reduced = class {
|
|
3522
|
+
value;
|
|
3523
|
+
constructor(val) {
|
|
3524
|
+
this.value = val;
|
|
3525
|
+
}
|
|
3526
|
+
deref() {
|
|
3527
|
+
return this.value;
|
|
3528
|
+
}
|
|
3529
|
+
};
|
|
3530
|
+
var isReduced = (x) => x instanceof Reduced;
|
|
3531
|
+
var ensureReduced = (x) => x instanceof Reduced ? x : new Reduced(x);
|
|
3532
|
+
var unreduced = (x) => x instanceof Reduced ? x.deref() : x;
|
|
3533
|
+
//#endregion
|
|
3534
|
+
//#region node_modules/@thi.ng/transducers/reduce.js
|
|
3535
|
+
var __parseArgs = (args) => args.length === 2 ? [void 0, args[1]] : args.length === 3 ? [args[1], args[2]] : illegalArity(args.length);
|
|
3536
|
+
function reduce(...args) {
|
|
3537
|
+
const rfn = args[0];
|
|
3538
|
+
const init = rfn[0];
|
|
3539
|
+
const complete = rfn[1];
|
|
3540
|
+
const reduce2 = rfn[2];
|
|
3541
|
+
args = __parseArgs(args);
|
|
3542
|
+
const acc = args[0] == null ? init() : args[0];
|
|
3543
|
+
const src = args[1];
|
|
3544
|
+
return unreduced(complete(implementsFunction(src, "$reduce") ? src.$reduce(reduce2, acc) : isArrayLike(src) ? __reduceArray(reduce2, acc, src) : __reduceIterable(reduce2, acc, src)));
|
|
3545
|
+
}
|
|
3546
|
+
var __reduceArray = (rfn, acc, src) => {
|
|
3547
|
+
for (let i = 0, n = src.length; i < n; i++) {
|
|
3548
|
+
acc = rfn(acc, src[i]);
|
|
3549
|
+
if (isReduced(acc)) {
|
|
3550
|
+
acc = acc.deref();
|
|
3551
|
+
break;
|
|
3552
|
+
}
|
|
3553
|
+
}
|
|
3554
|
+
return acc;
|
|
3555
|
+
};
|
|
3556
|
+
var __reduceIterable = (rfn, acc, src) => {
|
|
3557
|
+
for (const x of src) {
|
|
3558
|
+
acc = rfn(acc, x);
|
|
3559
|
+
if (isReduced(acc)) {
|
|
3560
|
+
acc = acc.deref();
|
|
3561
|
+
break;
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
return acc;
|
|
3565
|
+
};
|
|
3566
|
+
var reducer = (init, rfn) => [
|
|
3567
|
+
init,
|
|
3568
|
+
identity$1,
|
|
3569
|
+
rfn
|
|
3570
|
+
];
|
|
3571
|
+
var $$reduce = (rfn, args) => {
|
|
3572
|
+
const n = args.length - 1;
|
|
3573
|
+
return isIterable(args[n]) ? args.length > 1 ? reduce(rfn.apply(null, args.slice(0, n)), args[n]) : reduce(rfn(), args[0]) : void 0;
|
|
3574
|
+
};
|
|
3575
|
+
//#endregion
|
|
3576
|
+
//#region node_modules/@thi.ng/transducers/push.js
|
|
3577
|
+
function push(src) {
|
|
3578
|
+
return src ? [...src] : reducer(() => [], (acc, x) => (acc.push(x), acc));
|
|
3579
|
+
}
|
|
3580
|
+
//#endregion
|
|
3581
|
+
//#region node_modules/@thi.ng/transducers/iterator.js
|
|
3582
|
+
function* iterator(xform, src) {
|
|
3583
|
+
const rfn = ensureTransducer(xform)(push());
|
|
3584
|
+
const complete = rfn[1];
|
|
3585
|
+
const reduce = rfn[2];
|
|
3586
|
+
for (const x of src) {
|
|
3587
|
+
const y = reduce([], x);
|
|
3588
|
+
if (isReduced(y)) {
|
|
3589
|
+
yield* unreduced(complete(y.deref()));
|
|
3590
|
+
return;
|
|
3591
|
+
}
|
|
3592
|
+
if (y.length) yield* y;
|
|
3593
|
+
}
|
|
3594
|
+
yield* unreduced(complete([]));
|
|
3595
|
+
}
|
|
3596
|
+
function* iterator1(xform, src) {
|
|
3597
|
+
const reduce = ensureTransducer(xform)([
|
|
3598
|
+
NO_OP,
|
|
3599
|
+
NO_OP,
|
|
3600
|
+
(_, x) => x
|
|
3601
|
+
])[2];
|
|
3602
|
+
for (const x of src) {
|
|
3603
|
+
let y = reduce(SEMAPHORE, x);
|
|
3604
|
+
if (isReduced(y)) {
|
|
3605
|
+
y = unreduced(y.deref());
|
|
3606
|
+
if (y !== SEMAPHORE) yield y;
|
|
3607
|
+
return;
|
|
3608
|
+
}
|
|
3609
|
+
if (y !== SEMAPHORE) yield y;
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
//#endregion
|
|
3613
|
+
//#region node_modules/@thi.ng/transducers/map.js
|
|
3614
|
+
function map(fn, src) {
|
|
3615
|
+
return isIterable(src) ? iterator1(map(fn), src) : (rfn) => {
|
|
3616
|
+
const r = rfn[2];
|
|
3617
|
+
return compR(rfn, (acc, x) => r(acc, fn(x)));
|
|
3618
|
+
};
|
|
3619
|
+
}
|
|
3620
|
+
//#endregion
|
|
3621
|
+
//#region node_modules/@thi.ng/transducers/max.js
|
|
3622
|
+
function max(src) {
|
|
3623
|
+
return src ? reduce(max(), src) : reducer(() => -Infinity, (acc, x) => Math.max(acc, x));
|
|
3624
|
+
}
|
|
3625
|
+
//#endregion
|
|
3626
|
+
//#region node_modules/@thi.ng/transducers/permutations.js
|
|
3627
|
+
function* permutations(...src) {
|
|
3628
|
+
const n = src.length - 1;
|
|
3629
|
+
if (n < 0) return;
|
|
3630
|
+
const step = new Array(n + 1).fill(0);
|
|
3631
|
+
const realized = src.map(ensureArrayLike);
|
|
3632
|
+
const total = realized.reduce((acc, x) => acc * x.length, 1);
|
|
3633
|
+
for (let i = 0; i < total; i++) {
|
|
3634
|
+
const tuple = [];
|
|
3635
|
+
for (let j = n; j >= 0; j--) {
|
|
3636
|
+
const r = realized[j];
|
|
3637
|
+
let s = step[j];
|
|
3638
|
+
if (s === r.length) {
|
|
3639
|
+
step[j] = s = 0;
|
|
3640
|
+
j > 0 && step[j - 1]++;
|
|
3641
|
+
}
|
|
3642
|
+
tuple[j] = r[s];
|
|
3643
|
+
}
|
|
3644
|
+
step[n]++;
|
|
3645
|
+
yield tuple;
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
//#endregion
|
|
3649
|
+
//#region node_modules/@thi.ng/transducers/transduce.js
|
|
3650
|
+
function transduce(...args) {
|
|
3651
|
+
return $transduce(transduce, reduce, args);
|
|
3652
|
+
}
|
|
3653
|
+
var $transduce = (tfn, rfn, args) => {
|
|
3654
|
+
let acc, src;
|
|
3655
|
+
switch (args.length) {
|
|
3656
|
+
case 4:
|
|
3657
|
+
src = args[3];
|
|
3658
|
+
acc = args[2];
|
|
3659
|
+
break;
|
|
3660
|
+
case 3:
|
|
3661
|
+
src = args[2];
|
|
3662
|
+
break;
|
|
3663
|
+
case 2: return map((x) => tfn(args[0], args[1], x));
|
|
3664
|
+
default: illegalArity(args.length);
|
|
3665
|
+
}
|
|
3666
|
+
return rfn(ensureTransducer(args[0])(args[1]), acc, src);
|
|
3667
|
+
};
|
|
3668
|
+
//#endregion
|
|
3669
|
+
//#region node_modules/@thi.ng/vectors/roundn.js
|
|
3670
|
+
var [a, b, c, d] = defOpVN(roundTo);
|
|
3671
|
+
var roundN = a;
|
|
3672
|
+
//#endregion
|
|
3673
|
+
//#region node_modules/@thi.ng/math/step.js
|
|
3674
|
+
var smoothStep = (edge, edge2, x) => smoothStep01(clamp01((x - edge) / (edge2 - edge)));
|
|
3675
|
+
var smoothStep01 = (x) => x * x * (3 - 2 * x);
|
|
3676
|
+
//#endregion
|
|
3677
|
+
//#region node_modules/@thi.ng/compose/comp.js
|
|
3678
|
+
function comp$1(...fns) {
|
|
3679
|
+
let [a, b, c, d, e, f, g, h, i, j] = fns;
|
|
3680
|
+
switch (fns.length) {
|
|
3681
|
+
case 0: illegalArity(0);
|
|
3682
|
+
case 1: return a;
|
|
3683
|
+
case 2: return (...args) => a(b(...args));
|
|
3684
|
+
case 3: return (...args) => a(b(c(...args)));
|
|
3685
|
+
case 4: return (...args) => a(b(c(d(...args))));
|
|
3686
|
+
case 5: return (...args) => a(b(c(d(e(...args)))));
|
|
3687
|
+
case 6: return (...args) => a(b(c(d(e(f(...args))))));
|
|
3688
|
+
case 7: return (...args) => a(b(c(d(e(f(g(...args)))))));
|
|
3689
|
+
case 8: return (...args) => a(b(c(d(e(f(g(h(...args))))))));
|
|
3690
|
+
case 9: return (...args) => a(b(c(d(e(f(g(h(i(...args)))))))));
|
|
3691
|
+
default:
|
|
3692
|
+
const fn = (...args) => a(b(c(d(e(f(g(h(i(j(...args))))))))));
|
|
3693
|
+
return fns.length === 10 ? fn : comp$1(fn, ...fns.slice(10));
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
//#endregion
|
|
3697
|
+
//#region node_modules/@thi.ng/transducers/comp.js
|
|
3698
|
+
function comp(...fns) {
|
|
3699
|
+
fns = fns.map(ensureTransducer);
|
|
3700
|
+
return comp$1.apply(null, fns);
|
|
3701
|
+
}
|
|
3702
|
+
//#endregion
|
|
3703
|
+
//#region node_modules/@thi.ng/transducers/count.js
|
|
3704
|
+
function count(...args) {
|
|
3705
|
+
const res = $$reduce(count, args);
|
|
3706
|
+
if (res !== void 0) return res;
|
|
3707
|
+
const [offset = 0, step = 1] = args;
|
|
3708
|
+
return reducer(() => offset, (acc, _) => acc + step);
|
|
3709
|
+
}
|
|
3710
|
+
//#endregion
|
|
3711
|
+
//#region node_modules/@thi.ng/compose/identity.js
|
|
3712
|
+
var identity = (x) => x;
|
|
3713
|
+
//#endregion
|
|
3714
|
+
//#region node_modules/@thi.ng/transducers/internal/group-opts.js
|
|
3715
|
+
var __groupByOpts = (opts) => ({
|
|
3716
|
+
key: (x) => x,
|
|
3717
|
+
group: push(),
|
|
3718
|
+
...opts
|
|
3719
|
+
});
|
|
3720
|
+
//#endregion
|
|
3721
|
+
//#region node_modules/@thi.ng/transducers/group-by-map.js
|
|
3722
|
+
function groupByMap(...args) {
|
|
3723
|
+
const res = $$reduce(groupByMap, args);
|
|
3724
|
+
if (res !== void 0) return res;
|
|
3725
|
+
const opts = __groupByOpts(args[0]);
|
|
3726
|
+
const [init, complete, reduce] = opts.group;
|
|
3727
|
+
return [
|
|
3728
|
+
() => new Map(),
|
|
3729
|
+
(acc) => {
|
|
3730
|
+
for (const k of acc.keys()) acc.set(k, complete(acc.get(k)));
|
|
3731
|
+
return acc;
|
|
3732
|
+
},
|
|
3733
|
+
(acc, x) => {
|
|
3734
|
+
const k = opts.key(x);
|
|
3735
|
+
return acc.set(k, acc.has(k) ? reduce(acc.get(k), x) : reduce(init(), x));
|
|
3736
|
+
}
|
|
3737
|
+
];
|
|
3738
|
+
}
|
|
3739
|
+
//#endregion
|
|
3740
|
+
//#region node_modules/@thi.ng/transducers/frequencies.js
|
|
3741
|
+
function frequencies(...args) {
|
|
3742
|
+
return $$reduce(frequencies, args) || groupByMap({
|
|
3743
|
+
key: args[0] || identity,
|
|
3744
|
+
group: count()
|
|
3745
|
+
});
|
|
3746
|
+
}
|
|
3747
|
+
//#endregion
|
|
3748
|
+
//#region node_modules/@thi.ng/transducers/norm-frequencies-auto.js
|
|
3749
|
+
function normFrequenciesAuto(...args) {
|
|
3750
|
+
const res = $$reduce(normFrequenciesAuto, args);
|
|
3751
|
+
if (res !== void 0) return res;
|
|
3752
|
+
const [init, complete, reduce] = frequencies(...args);
|
|
3753
|
+
let norm = 0;
|
|
3754
|
+
return [
|
|
3755
|
+
init,
|
|
3756
|
+
(acc) => {
|
|
3757
|
+
acc = complete(acc);
|
|
3758
|
+
for (const p of acc) acc.set(p[0], p[1] / norm);
|
|
3759
|
+
return acc;
|
|
3760
|
+
},
|
|
3761
|
+
(acc, x) => (norm++, reduce(acc, x))
|
|
3762
|
+
];
|
|
3763
|
+
}
|
|
3764
|
+
//#endregion
|
|
3765
|
+
//#region node_modules/@thi.ng/transducers/cat.js
|
|
3766
|
+
var cat = () => (rfn) => {
|
|
3767
|
+
const r = rfn[2];
|
|
3768
|
+
return compR(rfn, (acc, x) => {
|
|
3769
|
+
if (x) for (const y of unreduced(x) || []) {
|
|
3770
|
+
acc = r(acc, y);
|
|
3771
|
+
if (isReduced(acc)) break;
|
|
3772
|
+
}
|
|
3773
|
+
return isReduced(x) ? ensureReduced(acc) : acc;
|
|
3774
|
+
});
|
|
3775
|
+
};
|
|
3776
|
+
//#endregion
|
|
3777
|
+
//#region node_modules/@thi.ng/transducers/mapcat.js
|
|
3778
|
+
function mapcat(fn, src) {
|
|
3779
|
+
return isIterable(src) ? iterator(mapcat(fn), src) : comp(map(fn), cat());
|
|
3780
|
+
}
|
|
3781
|
+
//#endregion
|
|
3782
|
+
//#region node_modules/@thi.ng/transducers/repeat.js
|
|
3783
|
+
function* repeat(x, n = Infinity) {
|
|
3784
|
+
while (n-- > 0) yield x;
|
|
3785
|
+
}
|
|
3786
|
+
//#endregion
|
|
3787
|
+
//#region node_modules/@thi.ng/pixel-analysis/hues.js
|
|
3788
|
+
var temperature = (colors, minSat = .2, coeffs) => {
|
|
3789
|
+
const $colors = ensureArray(colors);
|
|
3790
|
+
const filtered = $colors.filter((x) => x[1] >= minSat);
|
|
3791
|
+
const area = filtered.length / $colors.length;
|
|
3792
|
+
const hues = [...transduce(map((x) => roundTo(x[0], 1 / 12) % 1), normFrequenciesAuto(), filtered)].sort(compareByKey(0));
|
|
3793
|
+
const angles = [...mapcat(([hue, num]) => {
|
|
3794
|
+
num *= 50;
|
|
3795
|
+
return num >= 1 ? repeat(hue * TAU, num) : null;
|
|
3796
|
+
}, hues)];
|
|
3797
|
+
if (!angles.length) return {
|
|
3798
|
+
hues,
|
|
3799
|
+
meanHue: 0,
|
|
3800
|
+
temp: 0,
|
|
3801
|
+
areaTemp: 0,
|
|
3802
|
+
area: 0
|
|
3803
|
+
};
|
|
3804
|
+
const meanHue = circularMean(angles) / TAU;
|
|
3805
|
+
const temp = hueTemperature(meanHue, coeffs);
|
|
3806
|
+
return {
|
|
3807
|
+
hues,
|
|
3808
|
+
meanHue,
|
|
3809
|
+
temp,
|
|
3810
|
+
areaTemp: temp * area,
|
|
3811
|
+
area
|
|
3812
|
+
};
|
|
3813
|
+
};
|
|
3814
|
+
var DEFAULT_TEMPERATURE_COEFFS = [
|
|
3815
|
+
.1,
|
|
3816
|
+
.6,
|
|
3817
|
+
.72,
|
|
3818
|
+
.92
|
|
3819
|
+
];
|
|
3820
|
+
var hueTemperature = (hue, [a, b, c, d] = DEFAULT_TEMPERATURE_COEFFS) => 2 * (hue < 2 / 3 ? smoothStep(b, a, hue) : smoothStep(c, d, hue)) - 1;
|
|
3821
|
+
//#endregion
|
|
3822
|
+
//#region node_modules/@thi.ng/pixel-analysis/analyze-colors.js
|
|
3823
|
+
var analyzeColors = (img, opts) => {
|
|
3824
|
+
let $img = img.format !== FLOAT_RGBA ? img.as(FLOAT_RGBA) : img;
|
|
3825
|
+
if (opts?.size) $img = __resize($img, opts.size);
|
|
3826
|
+
const imgGray = $img.as(FLOAT_GRAY);
|
|
3827
|
+
const imgHsv = $img.as(FLOAT_HSVA);
|
|
3828
|
+
const colors = __dominantColors($img, opts);
|
|
3829
|
+
const colorAreas = colors.map((x) => x.area);
|
|
3830
|
+
const derived = deriveColorResults(colors.map((x) => x.color), colorAreas, opts?.minSat, opts?.tempCoeffs);
|
|
3831
|
+
const lumImg = defMetric(imgGray.data);
|
|
3832
|
+
return {
|
|
3833
|
+
...derived,
|
|
3834
|
+
img: $img,
|
|
3835
|
+
imgGray,
|
|
3836
|
+
imgHsv,
|
|
3837
|
+
lumImg,
|
|
3838
|
+
temperature: temperature(imgHsv, opts?.minSat, opts?.tempCoeffs),
|
|
3839
|
+
contrastImg: lumImg.max - lumImg.min
|
|
3840
|
+
};
|
|
3841
|
+
};
|
|
3842
|
+
var deriveColorResults = (colors, areas = ones(colors.length), minSat, tempCoeffs) => {
|
|
3843
|
+
const dominantLuma = colors.map((x) => luminanceSrgb(x));
|
|
3844
|
+
const dominantSrgb = colors.map((x) => srgb(x));
|
|
3845
|
+
const dominantHsv = dominantSrgb.map((x) => hsv(x));
|
|
3846
|
+
const dominantOklch = dominantSrgb.map((x) => oklch(x));
|
|
3847
|
+
const dominantCss = dominantSrgb.map((x) => css(x));
|
|
3848
|
+
const hues = dominantHsv.map((x) => x[0]);
|
|
3849
|
+
const sats = dominantHsv.map((x) => x[1]);
|
|
3850
|
+
const lum = defWeightedMetric(dominantLuma, areas);
|
|
3851
|
+
return {
|
|
3852
|
+
css: dominantCss,
|
|
3853
|
+
srgb: dominantSrgb,
|
|
3854
|
+
hsv: dominantHsv,
|
|
3855
|
+
oklch: dominantOklch,
|
|
3856
|
+
hue: defCircularMetric(hues),
|
|
3857
|
+
sat: defWeightedMetric(sats, areas),
|
|
3858
|
+
chroma: defWeightedMetric(dominantOklch.map((x) => x[1]), areas),
|
|
3859
|
+
lum,
|
|
3860
|
+
areas,
|
|
3861
|
+
contrast: lum.max - lum.min,
|
|
3862
|
+
colorContrast: fit(transduce(map((pair) => contrast(...pair)), max(), permutations(dominantSrgb, dominantSrgb)), 1, 21, 0, 1),
|
|
3863
|
+
temperature: temperature(dominantHsv, minSat, tempCoeffs)
|
|
3864
|
+
};
|
|
3865
|
+
};
|
|
3866
|
+
var __dominantColors = (img, { dominantFn = dominantColorsKmeans, numColors = 4, prec = .001 } = {}) => dominantFn(img, numColors).sort(compareByKey("area", compareNumDesc)).map((x) => (roundN(null, x.color, prec), x));
|
|
3867
|
+
var __resize = ($img, size) => {
|
|
3868
|
+
size = ~~size;
|
|
3869
|
+
let w = $img.width;
|
|
3870
|
+
let h = $img.height;
|
|
3871
|
+
[w, h] = w > h ? [size, ~~Math.max(1, h / w * size)] : [~~Math.max(1, w / h * size), size];
|
|
3872
|
+
return $img.resize(w, h);
|
|
3873
|
+
};
|
|
3874
|
+
//#endregion
|
|
3875
|
+
//#region lib/utilities/general.js
|
|
3876
|
+
/**
|
|
3877
|
+
* Options for extracting colors / evaluating lightness from an image.
|
|
3878
|
+
* @property {boolean} isDark - Whether the image is considered dark overall.
|
|
3879
|
+
* @property {boolean} isTransparent - Whether the image has any transparency.
|
|
3880
|
+
* @property {{ any: boolean, left: boolean, right: boolean, top: boolean, bottom: boolean }} transparencyInfo - More detailed transparency info.
|
|
3881
|
+
* @property {Array<{ color: string, area: number, isDark: boolean }>} dominantColors - Dominant colors extracted from the image.
|
|
3882
|
+
* @property {Array} dominantColors.<index>.color - The color value.
|
|
3883
|
+
* @property {Array} dominantColors.<index>.area - The area occupied by this color (0 - 1).
|
|
3884
|
+
* @property {Array} dominantColors.<index>.isDark - Whether this color is considered dark.
|
|
3885
|
+
*/
|
|
3886
|
+
/**
|
|
3887
|
+
* Options for extracting colors / evaluating lightness from an image.
|
|
3888
|
+
* @property {number} [numColors=2] - Number of dominant colors to return.
|
|
3889
|
+
* @property {number} [lightnessThreshold=0.5] - Threshold (0.0 - 1.0) used to decide if a color is considered "light".
|
|
3890
|
+
* @property {number} [yFrom=0.0] - Minimum Y (luminance) value (0.0 - 1.0) to include when evaluating lightness.
|
|
3891
|
+
* @property {number} [yTo=1.0] - Maximum Y (luminance) value (0.0 - 1.0) to include when evaluating lightness.
|
|
3892
|
+
* @property {number} [maxSize=320] - Maximum width/height to scale down the image to before analysis, for performance.
|
|
3893
|
+
* @property {number} [alphaThreshold=30] - Threhold (0-255) below which a pixel is considered "transparent" for the purposes of analysis.
|
|
3894
|
+
*/
|
|
3895
|
+
var defaultAnalysisSettings = {
|
|
3896
|
+
numColors: 3,
|
|
3897
|
+
lightnessThreshold: .5,
|
|
3898
|
+
yFrom: 0,
|
|
3899
|
+
yTo: 1,
|
|
3900
|
+
maxSize: 320,
|
|
3901
|
+
alphaThreshold: 30
|
|
3902
|
+
};
|
|
3903
|
+
/**
|
|
3904
|
+
* Analyze an image element to determine overall luminance, dominant colors and transparency.
|
|
3905
|
+
* @param {ImageAnalysisSettings} [settings] - Optional settings to customize the analysis.
|
|
3906
|
+
* Returns an object on success:
|
|
3907
|
+
* - isDark: true if the computed mean image luminance is below 0.5.
|
|
3908
|
+
* - dominantColors: an array of up to the requested number of dominant colors. Each entry contains:
|
|
3909
|
+
* - color: CSS color string (as produced by the analyzer).
|
|
3910
|
+
* - area: the relative area (weight) of that color.
|
|
3911
|
+
* - isDark: boolean indicating whether the color's lightness (oklch.l) is < 0.5.
|
|
3912
|
+
* - isTransparent: true if any inspected pixel has alpha < 255.
|
|
3913
|
+
* Returns false if an error occurred during analysis.
|
|
3914
|
+
*/
|
|
3915
|
+
var analyzeImage = (image, rawSettings) => {
|
|
3916
|
+
const settings = {
|
|
3917
|
+
...defaultAnalysisSettings,
|
|
3918
|
+
...rawSettings
|
|
3919
|
+
};
|
|
3920
|
+
const { yFrom, yTo, maxSize } = settings;
|
|
3921
|
+
const cacheKey = `es-uic-img-analysis-${cyrb64Hash(image.src)}`;
|
|
3922
|
+
if (localStorage?.getItem(cacheKey)) return JSON.parse(localStorage.getItem(cacheKey));
|
|
3923
|
+
try {
|
|
3924
|
+
const fileExtension = getFileExtension(image.src);
|
|
3925
|
+
let skipTransparencyCheck = false;
|
|
3926
|
+
if (fileExtension) skipTransparencyCheck = ![
|
|
3927
|
+
"png",
|
|
3928
|
+
"webp",
|
|
3929
|
+
"gif",
|
|
3930
|
+
"tiff",
|
|
3931
|
+
"svg",
|
|
3932
|
+
"avif"
|
|
3933
|
+
].includes(fileExtension);
|
|
3934
|
+
let imageWidth = image.naturalWidth || image.width;
|
|
3935
|
+
let imageHeight = image.naturalHeight || image.height;
|
|
3936
|
+
if (!image.complete) throw new Error("Image not fully loaded");
|
|
3937
|
+
if (!imageWidth || !imageHeight) return false;
|
|
3938
|
+
let imageScale = 1;
|
|
3939
|
+
if (imageWidth > maxSize || imageHeight > maxSize) imageScale = Math.min(maxSize / imageWidth, maxSize / imageHeight);
|
|
3940
|
+
const imageWidthScaled = Math.floor(imageWidth * imageScale);
|
|
3941
|
+
const imageHeightScaled = Math.floor(imageHeight * imageScale);
|
|
3942
|
+
const srcX = 0;
|
|
3943
|
+
const srcY = Math.floor(yFrom * imageHeight);
|
|
3944
|
+
const srcW = Math.max(1, imageWidth);
|
|
3945
|
+
const srcH = Math.max(1, Math.ceil((yTo - yFrom) * imageHeight));
|
|
3946
|
+
const destW = Math.max(1, imageWidthScaled);
|
|
3947
|
+
const destH = Math.max(1, Math.ceil((yTo - yFrom) * imageHeightScaled));
|
|
3948
|
+
const colorCanvas = document.createElement("canvas");
|
|
3949
|
+
colorCanvas.width = destW;
|
|
3950
|
+
colorCanvas.height = destH;
|
|
3951
|
+
colorCanvas.getContext("2d").drawImage(image, srcX, srcY, srcW, srcH, 0, 0, destW, destH);
|
|
3952
|
+
const buffer = floatBufferFromCanvas(colorCanvas, FLOAT_RGBA);
|
|
3953
|
+
let imageData = null;
|
|
3954
|
+
if (!skipTransparencyCheck) {
|
|
3955
|
+
const transparencyCanvas = document.createElement("canvas");
|
|
3956
|
+
transparencyCanvas.width = imageWidthScaled;
|
|
3957
|
+
transparencyCanvas.height = imageHeightScaled;
|
|
3958
|
+
const transparencyContext = transparencyCanvas.getContext("2d", { willReadFrequently: true });
|
|
3959
|
+
transparencyContext.drawImage(image, 0, 0, imageWidth, imageHeight, 0, 0, imageWidthScaled, imageHeightScaled);
|
|
3960
|
+
imageData = transparencyContext.getImageData(0, 0, imageWidthScaled, imageHeightScaled).data;
|
|
3961
|
+
}
|
|
3962
|
+
const result = analyzeImageData({
|
|
3963
|
+
buffer,
|
|
3964
|
+
imageData,
|
|
3965
|
+
width: imageWidthScaled,
|
|
3966
|
+
height: imageHeightScaled,
|
|
3967
|
+
settings,
|
|
3968
|
+
skipTransparencyCheck,
|
|
3969
|
+
fileName: image.src
|
|
3970
|
+
});
|
|
3971
|
+
localStorage?.setItem(cacheKey, JSON.stringify(result));
|
|
3972
|
+
return result;
|
|
3973
|
+
} catch (error) {
|
|
3974
|
+
console.error("Error analyzing image:", error);
|
|
3975
|
+
return false;
|
|
3976
|
+
}
|
|
3977
|
+
};
|
|
3978
|
+
/**
|
|
3979
|
+
* Async version of analyzeImage for use in web workers or off-main-thread contexts.
|
|
3980
|
+
* Accepts image data as ArrayBuffer, Blob, or ImageBitmap, and uses OffscreenCanvas.
|
|
3981
|
+
* @param {ImageAnalysisSettings} [settings] - Optional settings to customize the analysis.
|
|
3982
|
+
* Returns a promise resolving to the analysis result object, or false if an error occurred.
|
|
3983
|
+
*/
|
|
3984
|
+
var analyzeImageAsync = async (imageSource, rawSettings, fbfc, fr, ac, dck, srgbFn, cssFn) => {
|
|
3985
|
+
const settings = Object.assign({}, {
|
|
3986
|
+
numColors: 3,
|
|
3987
|
+
lightnessThreshold: .5,
|
|
3988
|
+
yFrom: 0,
|
|
3989
|
+
yTo: 1,
|
|
3990
|
+
maxSize: 600,
|
|
3991
|
+
alphaThreshold: 50
|
|
3992
|
+
}, rawSettings);
|
|
3993
|
+
const numColors = settings.numColors;
|
|
3994
|
+
const lightnessThreshold = settings.lightnessThreshold;
|
|
3995
|
+
const yFrom = settings.yFrom;
|
|
3996
|
+
const yTo = settings.yTo;
|
|
3997
|
+
const maxSize = settings.maxSize;
|
|
3998
|
+
const alphaThreshold = settings.alphaThreshold;
|
|
3999
|
+
const getFileExt = (input) => {
|
|
4000
|
+
try {
|
|
4001
|
+
const match = new URL(input).pathname.match(/\.([a-zA-Z0-9]+)(?:\?|#|$)/);
|
|
4002
|
+
return match ? match[1].toLowerCase() : null;
|
|
4003
|
+
} catch {
|
|
4004
|
+
return null;
|
|
4005
|
+
}
|
|
4006
|
+
};
|
|
4007
|
+
const isColorDark = (r, g, b, threshold) => {
|
|
4008
|
+
return (.299 * r + .587 * g + .114 * b) / 255 < threshold;
|
|
4009
|
+
};
|
|
4010
|
+
const checkTransparency = (imageData, w, h) => {
|
|
4011
|
+
const transparency = {
|
|
4012
|
+
any: true,
|
|
4013
|
+
left: true,
|
|
4014
|
+
right: true,
|
|
4015
|
+
top: true,
|
|
4016
|
+
bottom: true
|
|
4017
|
+
};
|
|
4018
|
+
let counts = {
|
|
4019
|
+
any: 0,
|
|
4020
|
+
left: 0,
|
|
4021
|
+
right: 0,
|
|
4022
|
+
top: 0,
|
|
4023
|
+
bottom: 0
|
|
4024
|
+
};
|
|
4025
|
+
const perimeterThresholdW = Math.floor(.15 * w);
|
|
4026
|
+
const perimeterThresholdH = Math.floor((h > 100 ? .075 : .75) * h);
|
|
4027
|
+
const innerThreshold = Math.floor(w * h * .001);
|
|
4028
|
+
if (w > 0 && h > 0) {
|
|
4029
|
+
for (let x = 0; x < w; x++) if (imageData[(0 * w + x) * 4 + 3] > alphaThreshold) {
|
|
4030
|
+
counts.top++;
|
|
4031
|
+
if (counts.top >= perimeterThresholdW) {
|
|
4032
|
+
transparency.top = false;
|
|
4033
|
+
break;
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4036
|
+
for (let x = 0; x < w; x++) if (imageData[((h - 1) * w + x) * 4 + 3] > alphaThreshold) {
|
|
4037
|
+
counts.bottom++;
|
|
4038
|
+
if (counts.bottom >= perimeterThresholdW) {
|
|
4039
|
+
transparency.bottom = false;
|
|
4040
|
+
break;
|
|
4041
|
+
}
|
|
4042
|
+
}
|
|
4043
|
+
for (let y = 0; y < h; y++) if (imageData[(y * w + 0) * 4 + 3] > alphaThreshold) {
|
|
4044
|
+
counts.left++;
|
|
4045
|
+
if (counts.left >= perimeterThresholdH) {
|
|
4046
|
+
transparency.left = false;
|
|
4047
|
+
break;
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4050
|
+
for (let y = 0; y < h; y++) if (imageData[(y * w + (w - 1)) * 4 + 3] > alphaThreshold) {
|
|
4051
|
+
counts.right++;
|
|
4052
|
+
if (counts.right >= perimeterThresholdH) {
|
|
4053
|
+
transparency.right = false;
|
|
4054
|
+
break;
|
|
4055
|
+
}
|
|
4056
|
+
}
|
|
4057
|
+
if (!transparency.top && !transparency.bottom && !transparency.left && !transparency.right) {
|
|
4058
|
+
for (let i = 3; i < imageData.length; i += 4) if (imageData[i] > alphaThreshold) {
|
|
4059
|
+
counts.any++;
|
|
4060
|
+
if (counts.any >= innerThreshold) {
|
|
4061
|
+
transparency.any = false;
|
|
4062
|
+
break;
|
|
4063
|
+
}
|
|
4064
|
+
}
|
|
4065
|
+
} else transparency.any = true;
|
|
4066
|
+
}
|
|
4067
|
+
return transparency;
|
|
4068
|
+
};
|
|
4069
|
+
try {
|
|
4070
|
+
let imageBitmap;
|
|
4071
|
+
if (typeof imageSource === "string") imageBitmap = await createImageBitmap(await (await fetch(imageSource)).blob());
|
|
4072
|
+
else if (imageSource instanceof Blob) imageBitmap = await createImageBitmap(imageSource);
|
|
4073
|
+
else if (imageSource instanceof ArrayBuffer) imageBitmap = await createImageBitmap(new Blob([imageSource]));
|
|
4074
|
+
else if (imageSource instanceof ImageBitmap) imageBitmap = imageSource;
|
|
4075
|
+
else throw new Error("Unsupported imageSource type");
|
|
4076
|
+
const imageWidth = imageBitmap.width;
|
|
4077
|
+
const imageHeight = imageBitmap.height;
|
|
4078
|
+
if (!imageWidth || !imageHeight) return false;
|
|
4079
|
+
let imageScale = 1;
|
|
4080
|
+
if (imageWidth > maxSize || imageHeight > maxSize) imageScale = Math.min(maxSize / imageWidth, maxSize / imageHeight);
|
|
4081
|
+
const imageWidthScaled = Math.floor(imageWidth * imageScale);
|
|
4082
|
+
const imageHeightScaled = Math.floor(imageHeight * imageScale);
|
|
4083
|
+
const srcX = 0;
|
|
4084
|
+
const srcY = Math.floor(yFrom * imageHeight);
|
|
4085
|
+
const srcW = Math.max(1, imageWidth);
|
|
4086
|
+
const srcH = Math.max(1, Math.ceil((yTo - yFrom) * imageHeight));
|
|
4087
|
+
const destW = Math.max(1, imageWidthScaled);
|
|
4088
|
+
const destH = Math.max(1, Math.ceil((yTo - yFrom) * imageHeightScaled));
|
|
4089
|
+
const colorCanvas = typeof OffscreenCanvas !== "undefined" ? new OffscreenCanvas(destW, destH) : (() => {
|
|
4090
|
+
const c = document.createElement("canvas");
|
|
4091
|
+
c.width = destW;
|
|
4092
|
+
c.height = destH;
|
|
4093
|
+
return c;
|
|
4094
|
+
})();
|
|
4095
|
+
colorCanvas.getContext("2d").drawImage(imageBitmap, srcX, srcY, srcW, srcH, 0, 0, destW, destH);
|
|
4096
|
+
const data = ac(fbfc(colorCanvas, fr), {
|
|
4097
|
+
numColors,
|
|
4098
|
+
dominantFn: (pixels, num) => dck(pixels, num, { filter: (p) => {
|
|
4099
|
+
const { alpha } = srgbFn(p);
|
|
4100
|
+
return alpha > 0;
|
|
4101
|
+
} }),
|
|
4102
|
+
prec: .01
|
|
4103
|
+
});
|
|
4104
|
+
const { lumImg, srgb: srgbData, areas: colorAreas } = data;
|
|
4105
|
+
if (!Array.isArray(srgbData)) {
|
|
4106
|
+
console.error("srgbData is not an array:", srgbData, "Full data:", data);
|
|
4107
|
+
return false;
|
|
4108
|
+
}
|
|
4109
|
+
let transparencyInfo = false;
|
|
4110
|
+
let skipTransparencyCheck = false;
|
|
4111
|
+
if (typeof imageSource === "string") {
|
|
4112
|
+
const fileExtension = getFileExt(imageSource);
|
|
4113
|
+
if (fileExtension) skipTransparencyCheck = ![
|
|
4114
|
+
"png",
|
|
4115
|
+
"webp",
|
|
4116
|
+
"gif",
|
|
4117
|
+
"tiff",
|
|
4118
|
+
"svg",
|
|
4119
|
+
"avif"
|
|
4120
|
+
].includes(fileExtension);
|
|
4121
|
+
}
|
|
4122
|
+
if (!skipTransparencyCheck) {
|
|
4123
|
+
const transparencyContext = (typeof OffscreenCanvas !== "undefined" ? new OffscreenCanvas(imageWidthScaled, imageHeightScaled) : (() => {
|
|
4124
|
+
const c = document.createElement("canvas");
|
|
4125
|
+
c.width = imageWidthScaled;
|
|
4126
|
+
c.height = imageHeightScaled;
|
|
4127
|
+
return c;
|
|
4128
|
+
})()).getContext("2d");
|
|
4129
|
+
transparencyContext.drawImage(imageBitmap, 0, 0, imageWidth, imageHeight, 0, 0, imageWidthScaled, imageHeightScaled);
|
|
4130
|
+
const imageData = transparencyContext.getImageData(0, 0, imageWidthScaled, imageHeightScaled).data;
|
|
4131
|
+
transparencyInfo = checkTransparency(imageData, imageWidthScaled, imageHeightScaled);
|
|
4132
|
+
}
|
|
4133
|
+
return {
|
|
4134
|
+
isDark: lumImg.mean < lightnessThreshold,
|
|
4135
|
+
isTransparent: skipTransparencyCheck ? false : transparencyInfo?.any,
|
|
4136
|
+
transparencyInfo: skipTransparencyCheck ? null : transparencyInfo,
|
|
4137
|
+
dominantColors: srgbData.map(({ r, g, b }, index) => ({
|
|
4138
|
+
color: cssFn([
|
|
4139
|
+
r,
|
|
4140
|
+
g,
|
|
4141
|
+
b
|
|
4142
|
+
]),
|
|
4143
|
+
area: colorAreas?.[index],
|
|
4144
|
+
isDark: isColorDark(r * 255, g * 255, b * 255, lightnessThreshold)
|
|
4145
|
+
}))
|
|
4146
|
+
};
|
|
4147
|
+
} catch (error) {
|
|
4148
|
+
console.error("Error analyzing image (async):", error);
|
|
4149
|
+
return false;
|
|
4150
|
+
}
|
|
4151
|
+
};
|
|
4152
|
+
/**
|
|
4153
|
+
* Check image transparency by analyzing pixel alpha values.
|
|
4154
|
+
* @param {number} w - The width of the image.
|
|
4155
|
+
* @param {number} h - The height of the image.
|
|
4156
|
+
* @param {ImageAnalysisSettings} [settings] - Optional settings to customize the transparency check.
|
|
4157
|
+
*/
|
|
4158
|
+
var checkTransparency = (imageData, w, h, settings = {}) => {
|
|
4159
|
+
const { alphaThreshold } = {
|
|
4160
|
+
...defaultAnalysisSettings,
|
|
4161
|
+
...settings
|
|
4162
|
+
};
|
|
4163
|
+
const transparency = {
|
|
4164
|
+
any: true,
|
|
4165
|
+
left: true,
|
|
4166
|
+
right: true,
|
|
4167
|
+
top: true,
|
|
4168
|
+
bottom: true
|
|
4169
|
+
};
|
|
4170
|
+
let counts = {
|
|
4171
|
+
any: 0,
|
|
4172
|
+
left: 0,
|
|
4173
|
+
right: 0,
|
|
4174
|
+
top: 0,
|
|
4175
|
+
bottom: 0
|
|
4176
|
+
};
|
|
4177
|
+
const perimeterThresholdW = Math.floor(.15 * w);
|
|
4178
|
+
const perimeterThresholdH = Math.floor((h > 100 ? .05 : .5) * h);
|
|
4179
|
+
const innerThreshold = Math.floor(w * h * .001);
|
|
4180
|
+
if (w > 0 && h > 0) {
|
|
4181
|
+
for (let x = 0; x < w; x++) if (imageData[(0 * w + x) * 4 + 3] > alphaThreshold) {
|
|
4182
|
+
counts.top++;
|
|
4183
|
+
if (counts.top >= perimeterThresholdW) {
|
|
4184
|
+
transparency.top = false;
|
|
4185
|
+
break;
|
|
4186
|
+
}
|
|
4187
|
+
}
|
|
4188
|
+
for (let x = 0; x < w; x++) if (imageData[((h - 1) * w + x) * 4 + 3] > alphaThreshold) {
|
|
4189
|
+
counts.bottom++;
|
|
4190
|
+
if (counts.bottom >= perimeterThresholdW) {
|
|
4191
|
+
transparency.bottom = false;
|
|
4192
|
+
break;
|
|
4193
|
+
}
|
|
4194
|
+
}
|
|
4195
|
+
for (let y = 0; y < h; y++) if (imageData[(y * w + 0) * 4 + 3] > alphaThreshold) {
|
|
4196
|
+
counts.left++;
|
|
4197
|
+
if (counts.left >= perimeterThresholdH) {
|
|
4198
|
+
transparency.left = false;
|
|
4199
|
+
break;
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
for (let y = 0; y < h; y++) if (imageData[(y * w + (w - 1)) * 4 + 3] > alphaThreshold) {
|
|
4203
|
+
counts.right++;
|
|
4204
|
+
if (counts.right >= perimeterThresholdH) {
|
|
4205
|
+
transparency.right = false;
|
|
4206
|
+
break;
|
|
4207
|
+
}
|
|
4208
|
+
}
|
|
4209
|
+
if (!transparency.top && !transparency.bottom && !transparency.left && !transparency.right) {
|
|
4210
|
+
for (let i = 3; i < imageData.length; i += 4) if (imageData[i] > alphaThreshold) {
|
|
4211
|
+
counts.any++;
|
|
4212
|
+
if (counts.any >= innerThreshold) {
|
|
4213
|
+
transparency.any = false;
|
|
4214
|
+
break;
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4217
|
+
} else transparency.any = true;
|
|
4218
|
+
}
|
|
4219
|
+
return transparency;
|
|
4220
|
+
};
|
|
4221
|
+
/**
|
|
4222
|
+
* Get file extension from a URL string.
|
|
4223
|
+
* getFileExtension('https://example.com/image.png'); // 'png'
|
|
4224
|
+
* getFileExtension('https://example.com/archive.tar.gz'); // 'gz'
|
|
4225
|
+
* getFileExtension('https://example.com/no-extension'); // null
|
|
4226
|
+
*/
|
|
4227
|
+
var getFileExtension = (input) => {
|
|
4228
|
+
const match = new URL(input).pathname.match(/\.([a-zA-Z0-9]+)(?:\?|#|$)/);
|
|
4229
|
+
return match ? match[1].toLowerCase() : null;
|
|
4230
|
+
};
|
|
4231
|
+
/**
|
|
4232
|
+
* Determine if a color is considered "dark" based on its RGB values and a lightness threshold.
|
|
4233
|
+
* @param {number} g - Green component (0-255).
|
|
4234
|
+
* @param {number} b - Blue component (0-255).
|
|
4235
|
+
* @param {number} [threshold=0.5] - Lightness threshold (0.0 - 1.0) below which the color is considered dark.
|
|
4236
|
+
* isColorDark(0, 0, 0); // true (black)
|
|
4237
|
+
* isColorDark(255, 255, 255); // false (white)
|
|
4238
|
+
* isColorDark(100, 100, 100, 0.4); // false (gray with higher threshold)
|
|
4239
|
+
*/
|
|
4240
|
+
var isColorDark = (r, g, b, threshold = .5) => {
|
|
4241
|
+
return (.299 * r + .587 * g + .114 * b) / 255 < threshold;
|
|
4242
|
+
};
|
|
4243
|
+
/**
|
|
4244
|
+
* Core analysis logic shared by both main thread and worker.
|
|
4245
|
+
* @prop {Float32Array} buffer - Float32Array RGBA buffer (from floatBufferFromCanvas)
|
|
4246
|
+
* @prop {Uint8ClampedArray} imageData - Uint8ClampedArray (from getImageData)
|
|
4247
|
+
* @prop {number} width - Image width
|
|
4248
|
+
* @prop {number} height - Image height
|
|
4249
|
+
* @prop {ImageAnalysisSettings} settings - Analysis settings
|
|
4250
|
+
* @prop {boolean} skipTransparencyCheck - Boolean to skip transparency check
|
|
4251
|
+
*/
|
|
4252
|
+
var analyzeImageData = ({ buffer, imageData, width, height, settings, skipTransparencyCheck = false }) => {
|
|
4253
|
+
const { numColors, lightnessThreshold } = settings;
|
|
4254
|
+
const { lumImg, srgb: srgbData, areas: colorAreas } = analyzeColors(buffer, {
|
|
4255
|
+
numColors,
|
|
4256
|
+
dominantFn: (pixels, num) => dominantColorsKmeans(pixels, num, { filter: (p) => srgb(p).alpha > 0 }),
|
|
4257
|
+
prec: .01
|
|
4258
|
+
});
|
|
4259
|
+
let transparencyInfo = false;
|
|
4260
|
+
if (!skipTransparencyCheck && imageData) transparencyInfo = checkTransparency(imageData, width, height, settings);
|
|
4261
|
+
return {
|
|
4262
|
+
isDark: lumImg.mean < lightnessThreshold,
|
|
4263
|
+
isTransparent: skipTransparencyCheck ? false : transparencyInfo?.any,
|
|
4264
|
+
transparencyInfo: skipTransparencyCheck ? null : transparencyInfo,
|
|
4265
|
+
dominantColors: srgbData.map(({ r, g, b }, index) => ({
|
|
4266
|
+
color: css([
|
|
4267
|
+
r,
|
|
4268
|
+
g,
|
|
4269
|
+
b
|
|
4270
|
+
]),
|
|
4271
|
+
area: colorAreas?.[index],
|
|
4272
|
+
isDark: isColorDark(r * 255, g * 255, b * 255, lightnessThreshold)
|
|
4273
|
+
}))
|
|
4274
|
+
};
|
|
4275
|
+
};
|
|
4276
|
+
//#endregion
|
|
4277
|
+
export { getFileExtension as a, FLOAT_RGBA as c, checkTransparency as i, floatBufferFromCanvas as l, analyzeImageAsync as n, isColorDark as o, analyzeImageData as r, srgb as s, analyzeImage as t };
|