@softistx/material 3.248.0 → 3.250.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/CHANGELOG.md +34 -0
- package/README.md +8 -4
- package/dist/adopt-styles-C3MfGnxE.js +20 -0
- package/dist/{async-slice-C5HfFq1M.js → async-slice-DdEr7vFx.js} +1 -1
- package/dist/{audio-player-2kKst8lH.js → audio-player-DMYszRGT.js} +3 -3
- package/dist/{audio-player-viewer-D9DsYBcy.js → audio-player-viewer-z13yCjo4.js} +2 -2
- package/dist/{autocomplete-JuRCjl48.js → autocomplete-Bgf_AJ6U.js} +11 -11
- package/dist/{avatar-CvvdaBu4.js → avatar-WvTropuJ.js} +1 -1
- package/dist/blank-placeholder-DZIFJ0DG.js +17 -0
- package/dist/{breadcrumb-DacRqg91.js → breadcrumb-DYa6pVsq.js} +5 -5
- package/dist/{button-CpUMPIdk.js → button-RsWgka2v.js} +1 -1
- package/dist/{calculator-BYgFgWHL.js → calculator-DPHCuAZy.js} +11 -11
- package/dist/calculator-field.js +6 -6
- package/dist/{calculator-segment-DCHWZy6b.js → calculator-segment-Ckn9Fua9.js} +1 -1
- package/dist/calculator.js +1 -1
- package/dist/canvas-BShNj4yp.js +144 -0
- package/dist/capture-outputs-qcYUPW6K.js +174 -0
- package/dist/capture-toolbar.css +2 -0
- package/dist/capture-toolbar.js +858 -0
- package/dist/capture.js +53 -139
- package/dist/charts.js +3 -3
- package/dist/{chip-CjJPmAYO.js → chip-tyDM0lpO.js} +2 -2
- package/dist/{code-editor-nNcxtslA.js → code-editor-gHHXEwF-.js} +6 -6
- package/dist/code-editor.js +6 -6
- package/dist/{code-file-viewer-CcESl49v.js → code-file-viewer-CYQcskvt.js} +4 -4
- package/dist/{code-language-items-CW8_Si05.js → code-language-items-DDFuDf_E.js} +2 -2
- package/dist/{components-BdMaUeOm.js → components-DUvKQIBi.js} +16714 -20832
- package/dist/components.js +83 -79
- package/dist/{confirm-dialog-B2eonW2X.js → confirm-dialog-IHvPA3O2.js} +4 -4
- package/dist/{conversion-variant-DZm_xgUK.js → conversion-variant-MWTjnFnG.js} +5 -5
- package/dist/{currency-field-UIkYAlvP.js → currency-field-Bd9od1Ee.js} +5 -5
- package/dist/{detail-panel-header-CL2_tUG0.js → detail-panel-header-D2a63Sk3.js} +1 -1
- package/dist/{details-content-CPzj3vUr.js → details-content-CnN_ukTA.js} +6 -6
- package/dist/{details-header-band-D-CyB_Xx.js → details-header-band-wcgmC7qC.js} +5 -5
- package/dist/{details-host-BvYgFIWx.js → details-host-DKEaGH4P.js} +1 -1
- package/dist/{details-sheet-D4PTV_jR.js → details-sheet-CtNM4oDU.js} +2 -2
- package/dist/{details-shell-D4XoPRBu.js → details-shell-DZ80h6mN.js} +1 -1
- package/dist/{dialog-CleLsHkZ.js → dialog-DwUxG2-o.js} +1 -1
- package/dist/{dialog-app-bar-CLC990e6.js → dialog-app-bar-BsJ4UwKb.js} +2 -2
- package/dist/dist-Cb17ixQs.js +16 -0
- package/dist/dist-CyqFzDZ6.js +11 -0
- package/dist/dnd.js +1 -1
- package/dist/draw.js +1 -1
- package/dist/{drop-overlay-BTkVfscF.js → drop-overlay-B26hx0-T.js} +2 -2
- package/dist/{dropdown-menu-BoJC2DEH.js → dropdown-menu-D-PRbHaP.js} +1 -1
- package/dist/{editable-section-CTRGfbLJ.js → editable-section-DPmF1flG.js} +3 -3
- package/dist/editor.js +14 -14
- package/dist/embed-chunks/{avatar-GlGqPU7B.js → avatar-CSDtFCum.js} +1 -1
- package/dist/embed-chunks/{dist-BrYZYfsJ.js → dist-BVPJSDov.js} +2 -2
- package/dist/embed-chunks/{emoji-picker-BSYBi_C8.js → emoji-picker-CrIXB9pF.js} +23 -23
- package/dist/embed-chunks/{mention-list-NW43QcRq.js → mention-list-9hwOYNND.js} +3 -3
- package/dist/embed-chunks/{nxgt-theme-provider-B1aeqDja.js → nxgt-theme-provider-Cjl7Eb8v.js} +703 -592
- package/dist/embed-chunks/switch-control-BrwJRN_V.js +207 -0
- package/dist/embed-chunks/{tabs-root-CY-uLp1C.js → tabs-root-BvPc1aaV.js} +6 -6
- package/dist/embed-chunks/{use-shape-morph-NrJQMv7i.js → use-shape-morph-D1MOoQ4T.js} +110 -2
- package/dist/embed-chunks/{useLatest-B57qw3XH.js → useLatest-CbcU5ozz.js} +323 -323
- package/dist/embed.css +2 -2
- package/dist/embed.js +1280 -741
- package/dist/{emoji-picker-DZbTd3Fr.js → emoji-picker-DabgsEVQ.js} +7 -7
- package/dist/{empty-state-DBSJDLKL.js → empty-state-BylD7RYH.js} +1 -1
- package/dist/{error-state-kauz4If4.js → error-state-BTe_NzTC.js} +2 -2
- package/dist/fab-DUnGwNE7.js +41 -0
- package/dist/fab-dock-By2pLVh7.js +49 -0
- package/dist/{feature-popup-CcXMGFES.js → feature-popup-CW7VS2fx.js} +1 -1
- package/dist/{blank-placeholder-DeDn5Xor.js → field-box-BXN-uyrv.js} +1 -16
- package/dist/{field-group-BpV74Ttu.js → field-group-B2Ozd5Jn.js} +1 -1
- package/dist/{file-dialogs-CbdvmY__.js → file-dialogs-CgEXaCev.js} +7 -7
- package/dist/{file-manager-shell-DLaJ5Z_L.js → file-manager-shell-Tqduf5lh.js} +21 -21
- package/dist/{file-preview-host-RhZvGGqC.js → file-preview-host-CM4pV3ZD.js} +2367 -2384
- package/dist/{file-viewer-body-DM3RkXGn.js → file-viewer-body-DrWFmnp4.js} +3 -3
- package/dist/{file-viewer-dialog-impl-ei5EYj8k.js → file-viewer-dialog-impl-DZpuZZ7x.js} +2 -2
- package/dist/files-drop.js +1 -1
- package/dist/files-picker.js +8 -8
- package/dist/files.js +3 -3
- package/dist/{financial-variant-BNdOqzA5.js → financial-variant-ljdP0JL4.js} +5 -5
- package/dist/{flow-diagram-BBB6r8--.js → flow-diagram-DwUnyl0u.js} +1 -1
- package/dist/{gallery-CIIJHpmj.js → gallery-DfN2KE4Y.js} +11 -11
- package/dist/{gallery-file-viewer-DkshswFr.js → gallery-file-viewer-BfFWfLIF.js} +3 -3
- package/dist/{gl-markers-abqcNuYT.js → gl-markers-CBNFeWIk.js} +3 -3
- package/dist/{hooks-D6lOSXA5.js → hooks-DiAhgchz.js} +3 -3
- package/dist/hooks.js +3 -3
- package/dist/i18n.js +3 -3
- package/dist/{icon-button-GKYj7uC4.js → icon-button-D-gi4Plg.js} +1 -1
- package/dist/image-editor-mmhbsqs-.js +4423 -0
- package/dist/image-editor.css +1 -1
- package/dist/image-editor.js +1157 -996
- package/dist/image-markup-editor-D-QkZWKf.js +24 -0
- package/dist/input-CWf3Apid.js +18 -0
- package/dist/input-box-moFuoMt0.js +15 -0
- package/dist/{input-group-CKO68Pyi.js → input-group-Bb8sAFRF.js} +3 -2
- package/dist/{item-details-l_-rk3Hj.js → item-details-BWdHMfsS.js} +7 -7
- package/dist/keypad.js +2 -2
- package/dist/lib/capture/engine/canvas.d.ts +17 -0
- package/dist/lib/capture/engine/capture.d.ts +19 -0
- package/dist/lib/capture/engine/filters.d.ts +27 -0
- package/dist/lib/capture/engine/rect.d.ts +26 -0
- package/dist/lib/capture/engine/types.d.ts +66 -0
- package/dist/lib/capture/index.d.ts +16 -0
- package/dist/lib/capture/modes/capture-mode.d.ts +24 -0
- package/dist/lib/capture/modes/countdown.d.ts +16 -0
- package/dist/lib/capture/modes/full-page.d.ts +14 -0
- package/dist/lib/capture/modes/pick-element.d.ts +22 -0
- package/dist/lib/capture/modes/scroller.d.ts +13 -0
- package/dist/lib/capture/modes/visible.d.ts +3 -0
- package/dist/lib/capture-toolbar/index.d.ts +25 -0
- package/dist/lib/capture-toolbar/lazy-capture-outputs.d.ts +2 -0
- package/dist/lib/capture-toolbar/outputs-encode.d.ts +25 -0
- package/dist/lib/capture-toolbar/outputs.d.ts +38 -0
- package/dist/lib/capture-toolbar/partials/capture-editor.d.ts +11 -0
- package/dist/lib/capture-toolbar/partials/capture-outputs.d.ts +16 -0
- package/dist/lib/capture-toolbar/region-overlay.d.ts +15 -0
- package/dist/lib/capture-toolbar/screen-capture-toolbar.d.ts +31 -0
- package/dist/lib/capture-toolbar/types.d.ts +117 -0
- package/dist/lib/capture-toolbar/use-screen-capture.d.ts +16 -0
- package/dist/lib/components/ui/layout/account-frame/account-frame.d.ts +2 -2
- package/dist/lib/components/ui/media/attachment-list/attachment-list.d.ts +2 -2
- package/dist/lib/components/ui/media/image-editor/image-markup-editor.d.ts +11 -3
- package/dist/lib/components/ui/media/image-editor/types-edits.d.ts +7 -0
- package/dist/lib/components/ui/media/image-editor/types-session.d.ts +1 -1
- package/dist/lib/components/ui/media/image-editor/types.d.ts +8 -0
- package/dist/lib/embed/index.d.ts +6 -1
- package/dist/lib/i18n/resources/resources.d.ts +108 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib/image-editor/index.d.ts +1 -1
- package/dist/lib.js +38 -56
- package/dist/{list-sheet-D22J9I-K.js → list-sheet-CejfrKJr.js} +1 -1
- package/dist/{loading-indicator-sDzxZg8f.js → loading-indicator-BBjOF25N.js} +1 -1
- package/dist/main.js +103 -98
- package/dist/{map-draw-DfbfT0eJ.js → map-draw-DyRy9SSV.js} +2 -2
- package/dist/map-draw.js +5 -5
- package/dist/map-static.js +1 -1
- package/dist/{map-view-DAx2zvV-.js → map-view-YfuYD3zS.js} +9 -9
- package/dist/map-zone-events.js +1 -1
- package/dist/map-zone-field.js +7 -7
- package/dist/map.js +10 -10
- package/dist/{marker-button-D7hEvEZD.js → marker-button-CXBaToHp.js} +1 -1
- package/dist/{marker-count-image-CWS3G-k8.js → marker-count-image-DHuzSev9.js} +1 -1
- package/dist/material.css +1 -1
- package/dist/{measure-manual-Bfvu8B_R.js → measure-manual-CcESmV1d.js} +3 -3
- package/dist/{measurement-B-OeWv7j.js → measurement-D2or6yM_.js} +1 -1
- package/dist/{media-player-DGXmWK7W.js → media-player-qW9RXFuO.js} +451 -567
- package/dist/{media-player-viewer-C3vXYcd8.js → media-player-viewer-DozPiF6T.js} +2 -2
- package/dist/{media-surface-BySonDjv.js → media-surface-BJsdNynm.js} +6 -6
- package/dist/{mention-list-BpoZHwO6.js → mention-list-z1wnlJgs.js} +2 -2
- package/dist/{native-select-Dg4bc7aC.js → native-select-BnDOVnER.js} +1 -1
- package/dist/{nxgt-theme-Ob-uFqU_.js → nxgt-theme-EYZ5aFHi.js} +6 -15
- package/dist/nxgt-theme-provider-BPXd3h82.js +40 -0
- package/dist/outputs-DF-aVqUO.js +81 -0
- package/dist/passkey.js +1 -1
- package/dist/{pdf-form-filler-DgH52W2Q.js → pdf-form-filler-Ct4eexhZ.js} +34 -34
- package/dist/pdf-form.js +2 -2
- package/dist/{pdf-reader-Bilz5foK.js → pdf-reader-khpMMEjU.js} +16 -16
- package/dist/{pdf-reader-viewer-DwQP2IpV.js → pdf-reader-viewer-B3_TdFOn.js} +2 -2
- package/dist/pdf-reader.js +2 -2
- package/dist/{percent-field-Ldc7K2wC.js → percent-field-Bu-PmCNR.js} +2 -2
- package/dist/{picker-surface-DZQbBgvA.js → picker-surface-THexE1OU.js} +3 -3
- package/dist/{popover-DwsaHFrK.js → popover-osl5duoA.js} +1 -1
- package/dist/portal-container-provider-fZFUk-ZB.js +11 -0
- package/dist/{pos-types-CKDG7pZA.js → pos-types-BPPae99i.js} +1 -1
- package/dist/{pos-variant-9nhz-ZzW.js → pos-variant-D6bDUqwV.js} +4 -4
- package/dist/print.js +1 -1
- package/dist/{programmer-variant-BzwfeMGC.js → programmer-variant-CDlFE24o.js} +2 -2
- package/dist/{progress-BBfp7sMi.js → progress-DjHnanxA.js} +2 -2
- package/dist/{progress-linear-BOJbHnzd.js → progress-linear-CTJ_U6kY.js} +1 -1
- package/dist/{public-I8nb8pCC.js → public-u9u2Osmx.js} +6 -6
- package/dist/{rendition-stage-A1nHXYrA.js → rendition-stage-BXjQpfKK.js} +2 -2
- package/dist/{rich-code-block-BJERY3N3.js → rich-code-block-DWSzyQRw.js} +5 -5
- package/dist/{scientific-variant-st2NBm1K.js → scientific-variant-DCgApH87.js} +2 -2
- package/dist/{scroll-area-B3XstZU2.js → scroll-area-BxKiT4Dn.js} +155 -164
- package/dist/{search-field-D3AOJr7s.js → search-field-Cgqa2bQf.js} +2 -2
- package/dist/{select-DhfzCkun.js → select-BGhRlBh4.js} +166 -179
- package/dist/{sheet-B8cO1T5K.js → sheet-BvNVroog.js} +1 -1
- package/dist/{signature-dialog-BNLMPgao.js → signature-dialog-x--_QWRB.js} +5 -5
- package/dist/signature.js +1 -1
- package/dist/{site-footer-cta-Cx7zsvkq.js → site-footer-cta-B3Kfqpep.js} +4 -4
- package/dist/{site-footer-link-Di8IMIw0.js → site-footer-link-SFHrO4ld.js} +1 -1
- package/dist/{size-slot-D1cKqb09.js → size-slot-Cb-W2Zm4.js} +1 -1
- package/dist/{sortable-provider-DrLnoygf.js → sortable-provider-KRScvvYx.js} +2 -2
- package/dist/{spinner-BpH9tE8R.js → spinner-DpB6XvJJ.js} +1 -1
- package/dist/switch-c_6OtXzW.js +125 -0
- package/dist/{tabs-root-BUnIfDah.js → tabs-root-C2n3K_Yv.js} +1 -1
- package/dist/{tags-form-BwqR4UVj.js → tags-form-BKB9fP03.js} +5 -5
- package/dist/{text-field-CFCHo07X.js → text-field-Dl7xTxZe.js} +2 -2
- package/dist/{textarea-B_iMDYgM.js → textarea-C3BGZELU.js} +1 -1
- package/dist/{textarea-field-DIOGxyUd.js → textarea-field-mqWhhbis.js} +2 -2
- package/dist/theme-picker.js +5 -4
- package/dist/{theme-toggle-CsBe64lm.js → theme-toggle-K-n5eq0T.js} +3 -3
- package/dist/theme-value-CD2nDrj_.js +12 -0
- package/dist/themes.js +15 -48
- package/dist/{toasts-McZnLRHP.js → toasts-DFLecXh0.js} +5 -5
- package/dist/{toggle-group-DKN1XLBS.js → toggle-group-DMDjNJWx.js} +1 -1
- package/dist/{toolbar-group-BmzGP_JO.js → toolbar-group-bttMdvg4.js} +1 -1
- package/dist/{toolbar-item-slot-BnqQLkVd.js → toolbar-item-slot-CBn3YjeE.js} +1 -1
- package/dist/{toolbar-items-C9uasXZ2.js → toolbar-items-zL5TYLf2.js} +4 -4
- package/dist/{toolbar-keep-focus-Vc5V-dX2.js → toolbar-keep-focus-C6bnzvpE.js} +2 -2
- package/dist/{tracked-layer-CjCXB_O6.js → tracked-layer-CYdLWRK-.js} +4 -4
- package/dist/{translate-material-C-qVvGLn.js → translate-material-DZNgWjYu.js} +1 -1
- package/dist/{translator-BrzI307E.js → translator-CrIFDzAz.js} +110 -2
- package/dist/{tree-DOAs456A.js → tree-CFXDccIe.js} +1 -1
- package/dist/{upload-host-ZpSSql8v.js → upload-host-DDktVohu.js} +9 -8
- package/dist/{use-calculator-keyboard-Ss25SRoM.js → use-calculator-keyboard-BWkYuIw5.js} +1 -1
- package/dist/{use-chat-composer-DopDN-zP.js → use-chat-composer-C1Qlnw2i.js} +20 -20
- package/dist/{use-file-meta-DyJX0JVs.js → use-file-meta-DcfQCh52.js} +1 -1
- package/dist/{use-heading-spy-CA2IAqMe.js → use-heading-spy-B9xEMHbZ.js} +2 -2
- package/dist/use-image-preview-BNq_RQm5.js +20 -0
- package/dist/{use-item-entries-CYbS5otl.js → use-item-entries-BKQHcWFx.js} +1 -1
- package/dist/{use-material-translation-eYySryw3.js → use-material-translation-ZEUtduro.js} +1 -1
- package/dist/{use-media-viewer-DoNdrzhN.js → use-media-viewer-DViJNx75.js} +1 -1
- package/dist/{use-text-preview-BQE4U9cT.js → use-text-preview-Ci97JKKo.js} +2 -2
- package/dist/{use-unsaved-guard-CSfDvdxd.js → use-unsaved-guard-CWlHEvjN.js} +2 -2
- package/dist/{viewer-CXF1dAv0.js → viewer-DDPJOxBt.js} +5 -5
- package/dist/{viewer-stage-class-CpyA8o-M.js → viewer-stage-class-DJ1uod4l.js} +4 -4
- package/dist/{viewer-states-BXyCdNhE.js → viewer-states-DkaPBkK4.js} +3 -3
- package/dist/{virtual-layer-rows-DHy8vAup.js → virtual-layer-rows-DKejQ_Jd.js} +1 -1
- package/dist/visible-B-IFZ4Nv.js +475 -0
- package/docs/components/media-and-files.md +1 -1
- package/docs/components/navigation-and-layout.md +2 -2
- package/docs/guides/capture.md +248 -0
- package/docs/guides/csp.md +1 -1
- package/docs/guides/embed.md +94 -2
- package/docs/roadmap.md +2 -1
- package/docs/troubleshooting.md +56 -0
- package/package.json +18 -1
- package/dist/embed-chunks/bubble-input-yXAeW84_.js +0 -29
- package/dist/embed-chunks/switch-control-ChcowM3u.js +0 -181
- package/dist/fab-dock-DqwbI-5n.js +0 -86
- package/dist/input-BaBE_MR_.js +0 -27
- /package/dist/{dist-B1qFabLJ.js → dist-B1qFabLJ2.js} +0 -0
package/dist/image-editor.js
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
import { _ as e, b as t, c as n, f as r, i, m as a, n as o, p as s,
|
|
2
|
-
import { V as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
1
|
+
import { _ as e, b as t, c as n, f as r, i, m as a, n as o, p as s, u as c } from "./embed-chunks/use-shape-morph-D1MOoQ4T.js";
|
|
2
|
+
import { V as l, W as u, p as d, r as f, t as p } from "./embed-chunks/useLatest-CbcU5ozz.js";
|
|
3
|
+
import { D as m, a as h, b as g, c as _, d as v, f as y, g as b, i as x, j as ee, k as te, l as S, m as ne, n as re, o as C, p as ie, r as ae, s as oe, t as se, u as ce, y as le } from "./embed-chunks/nxgt-theme-provider-Cjl7Eb8v.js";
|
|
4
|
+
import { r as w } from "./embed-chunks/switch-control-BrwJRN_V.js";
|
|
5
|
+
import { n as ue, t as de } from "./embed-chunks/dist-BVPJSDov.js";
|
|
6
6
|
import { n as T } from "./embed-chunks/is-production-Cx8oURag.js";
|
|
7
|
-
import { n as ge } from "./embed-chunks/bubble-input-yXAeW84_.js";
|
|
8
7
|
import * as E from "react";
|
|
9
|
-
import { Fragment as
|
|
8
|
+
import { Fragment as fe, createContext as pe, useCallback as D, useContext as me, useEffect as O, useId as k, useLayoutEffect as he, useMemo as A, useReducer as ge, useRef as j, useState as M, useSyncExternalStore as _e } from "react";
|
|
10
9
|
import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
11
|
-
import { ArrowUpRight as
|
|
12
|
-
import { createSlice as
|
|
13
|
-
import { tickValues as
|
|
10
|
+
import { ArrowUpRight as ve, BringToFront as ye, Check as be, ChevronsLeftRight as xe, Circle as Se, Columns2 as Ce, Copy as we, Crop as Te, Download as Ee, Eraser as De, Eye as Oe, FlipHorizontal2 as ke, FlipVertical2 as Ae, Highlighter as je, ImageOff as Me, Keyboard as Ne, MousePointer2 as Pe, Pen as Fe, PencilLine as Ie, Pin as Le, Plus as Re, Redo2 as ze, RotateCcw as Be, RotateCw as Ve, Settings2 as He, Slash as Ue, SlidersHorizontal as We, Sparkles as Ge, Square as Ke, SquareAsterisk as qe, Trash2 as Je, Type as Ye, Undo2 as Xe, WandSparkles as Ze, X as Qe, ZoomIn as $e, ZoomOut as et } from "lucide-react";
|
|
11
|
+
import { createSlice as tt, current as nt, isDraft as rt } from "@reduxjs/toolkit";
|
|
12
|
+
import { tickValues as it } from "@softistx/material-core/slider-ticks";
|
|
14
13
|
//#region ../../node_modules/@radix-ui/react-use-previous/dist/index.mjs
|
|
15
|
-
var
|
|
14
|
+
var at = Object.defineProperty, ot = (e, t) => at(e, "name", {
|
|
16
15
|
value: t,
|
|
17
16
|
configurable: !0
|
|
18
17
|
});
|
|
19
|
-
function
|
|
18
|
+
function st(e) {
|
|
20
19
|
let t = E.useRef({
|
|
21
20
|
value: e,
|
|
22
21
|
previous: e
|
|
23
22
|
});
|
|
24
23
|
return E.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
|
|
25
24
|
}
|
|
26
|
-
|
|
25
|
+
ot(st, "usePrevious");
|
|
27
26
|
//#endregion
|
|
28
27
|
//#region ../../node_modules/@radix-ui/react-separator/dist/index.mjs
|
|
29
|
-
var
|
|
28
|
+
var ct = Object.defineProperty, lt = (e, t) => ct(e, "name", {
|
|
30
29
|
value: t,
|
|
31
30
|
configurable: !0
|
|
32
|
-
}),
|
|
33
|
-
let { decorative: n, orientation: r =
|
|
31
|
+
}), ut = "horizontal", dt = ["horizontal", "vertical"], ft = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ lt(function(e, t) {
|
|
32
|
+
let { decorative: n, orientation: r = ut, ...i } = e, o = pt(r) ? r : ut, s = n ? { role: "none" } : {
|
|
34
33
|
"aria-orientation": o === "vertical" ? o : void 0,
|
|
35
34
|
role: "separator"
|
|
36
35
|
};
|
|
@@ -41,19 +40,19 @@ var ft = Object.defineProperty, pt = (e, t) => ft(e, "name", {
|
|
|
41
40
|
ref: t
|
|
42
41
|
});
|
|
43
42
|
}, "Separator"));
|
|
44
|
-
function
|
|
45
|
-
return
|
|
43
|
+
function pt(e) {
|
|
44
|
+
return dt.includes(e);
|
|
46
45
|
}
|
|
47
|
-
pt
|
|
48
|
-
var
|
|
46
|
+
lt(pt, "isValidOrientation");
|
|
47
|
+
var mt = ft, ht = Object.defineProperty, I = (e, t) => ht(e, "name", {
|
|
49
48
|
value: t,
|
|
50
49
|
configurable: !0
|
|
51
|
-
}),
|
|
50
|
+
}), gt = ["PageUp", "PageDown"], _t = [
|
|
52
51
|
"ArrowUp",
|
|
53
52
|
"ArrowDown",
|
|
54
53
|
"ArrowLeft",
|
|
55
54
|
"ArrowRight"
|
|
56
|
-
],
|
|
55
|
+
], vt = {
|
|
57
56
|
"from-left": [
|
|
58
57
|
"Home",
|
|
59
58
|
"PageDown",
|
|
@@ -78,34 +77,34 @@ var vt = gt, yt = Object.defineProperty, I = (e, t) => yt(e, "name", {
|
|
|
78
77
|
"ArrowUp",
|
|
79
78
|
"ArrowLeft"
|
|
80
79
|
]
|
|
81
|
-
},
|
|
82
|
-
let { name: i, min: a = 0, max: o = 100, step: s = 1, orientation:
|
|
80
|
+
}, yt = "Slider", [bt, xt, St] = u(yt), [Ct, wt] = s(yt, [St]), [Tt, Et] = Ct(yt), Dt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, n) {
|
|
81
|
+
let { name: i, min: a = 0, max: o = 100, step: s = 1, orientation: l = "horizontal", disabled: u = !1, minStepsBetweenThumbs: d = 0, defaultValue: f = [a], value: p, onValueChange: m = /* @__PURE__ */ I(() => {}, "onValueChange"), onValueCommit: h = /* @__PURE__ */ I(() => {}, "onValueCommit"), inverted: g = !1, form: _, ...v } = e, y = E.useRef(/* @__PURE__ */ new Set()), b = E.useRef(0), x = E.useRef(!1), te = l === "horizontal" ? At : jt, [S, ne] = E.useState(null), re = t(n, ne), [C = [], ie] = c({
|
|
83
82
|
prop: p,
|
|
84
83
|
defaultProp: f,
|
|
85
84
|
onChange: /* @__PURE__ */ I((e) => {
|
|
86
|
-
[...
|
|
85
|
+
[...y.current][b.current]?.focus({
|
|
87
86
|
preventScroll: !0,
|
|
88
|
-
focusVisible:
|
|
89
|
-
}),
|
|
87
|
+
focusVisible: x.current
|
|
88
|
+
}), x.current = !1, m(e);
|
|
90
89
|
}, "onChange")
|
|
91
90
|
}), ae = E.useRef(C), oe = E.useRef(C);
|
|
92
91
|
E.useEffect(() => {
|
|
93
|
-
let e = _ ?
|
|
92
|
+
let e = _ ? S?.ownerDocument.getElementById(_) : S?.closest("form");
|
|
94
93
|
if (e instanceof HTMLFormElement) {
|
|
95
94
|
let t = /* @__PURE__ */ I(() => ie(oe.current), "reset");
|
|
96
95
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
97
96
|
}
|
|
98
97
|
}, [
|
|
99
|
-
|
|
98
|
+
S,
|
|
100
99
|
_,
|
|
101
100
|
ie
|
|
102
101
|
]);
|
|
103
102
|
function se(e) {
|
|
104
|
-
w(e,
|
|
103
|
+
w(e, Yt(C, e));
|
|
105
104
|
}
|
|
106
105
|
I(se, "handleSlideStart");
|
|
107
106
|
function ce(e) {
|
|
108
|
-
w(e,
|
|
107
|
+
w(e, b.current);
|
|
109
108
|
}
|
|
110
109
|
I(ce, "handleSlideMove");
|
|
111
110
|
function le() {
|
|
@@ -113,38 +112,38 @@ var vt = gt, yt = Object.defineProperty, I = (e, t) => yt(e, "name", {
|
|
|
113
112
|
}
|
|
114
113
|
I(le, "handleSlideEnd");
|
|
115
114
|
function w(e, t, { commit: n } = { commit: !1 }) {
|
|
116
|
-
let r =
|
|
115
|
+
let r = en(s), i = ee(L(Math.round((e - a) / s) * s + a, r), [a, o]);
|
|
117
116
|
ie((e = []) => {
|
|
118
|
-
let r =
|
|
119
|
-
if (
|
|
120
|
-
|
|
117
|
+
let r = Kt(e, i, t);
|
|
118
|
+
if (Qt(r, d * s)) {
|
|
119
|
+
b.current = r.indexOf(i);
|
|
121
120
|
let t = String(r) !== String(e);
|
|
122
121
|
return t && n && h(r), t ? r : e;
|
|
123
122
|
} else return e;
|
|
124
123
|
});
|
|
125
124
|
}
|
|
126
|
-
return I(w, "updateValues"), /* @__PURE__ */ P(
|
|
125
|
+
return I(w, "updateValues"), /* @__PURE__ */ P(Tt, {
|
|
127
126
|
scope: e.__scopeSlider,
|
|
128
127
|
name: i,
|
|
129
128
|
disabled: u,
|
|
130
129
|
min: a,
|
|
131
130
|
max: o,
|
|
132
|
-
valueIndexToChangeRef:
|
|
133
|
-
thumbs:
|
|
131
|
+
valueIndexToChangeRef: b,
|
|
132
|
+
thumbs: y.current,
|
|
134
133
|
values: C,
|
|
135
|
-
orientation:
|
|
134
|
+
orientation: l,
|
|
136
135
|
form: _,
|
|
137
|
-
children: /* @__PURE__ */ P(
|
|
136
|
+
children: /* @__PURE__ */ P(bt.Provider, {
|
|
138
137
|
scope: e.__scopeSlider,
|
|
139
|
-
children: /* @__PURE__ */ P(
|
|
138
|
+
children: /* @__PURE__ */ P(bt.Slot, {
|
|
140
139
|
scope: e.__scopeSlider,
|
|
141
|
-
children: /* @__PURE__ */ P(
|
|
140
|
+
children: /* @__PURE__ */ P(te, {
|
|
142
141
|
"aria-disabled": u,
|
|
143
142
|
"data-disabled": u ? "" : void 0,
|
|
144
|
-
...
|
|
143
|
+
...v,
|
|
145
144
|
ref: re,
|
|
146
|
-
onPointerDown: r(
|
|
147
|
-
u || (ae.current = C,
|
|
145
|
+
onPointerDown: r(v.onPointerDown, () => {
|
|
146
|
+
u || (ae.current = C, x.current = !1);
|
|
148
147
|
}),
|
|
149
148
|
min: a,
|
|
150
149
|
max: o,
|
|
@@ -153,16 +152,16 @@ var vt = gt, yt = Object.defineProperty, I = (e, t) => yt(e, "name", {
|
|
|
153
152
|
onSlideMove: u ? void 0 : ce,
|
|
154
153
|
onSlideEnd: u ? void 0 : le,
|
|
155
154
|
onHomeKeyDown: () => {
|
|
156
|
-
u || (
|
|
155
|
+
u || (x.current = !0, w(a, 0, { commit: !0 }));
|
|
157
156
|
},
|
|
158
157
|
onEndKeyDown: () => {
|
|
159
|
-
u || (
|
|
158
|
+
u || (x.current = !0, w(o, C.length - 1, { commit: !0 }));
|
|
160
159
|
},
|
|
161
160
|
onStepKeyDown: ({ event: e, direction: t }) => {
|
|
162
161
|
if (!u) {
|
|
163
|
-
|
|
164
|
-
let n =
|
|
165
|
-
w(
|
|
162
|
+
x.current = !0;
|
|
163
|
+
let n = gt.includes(e.key) || e.shiftKey && _t.includes(e.key) ? 10 : 1, r = b.current, i = C[r];
|
|
164
|
+
w(tn(i, {
|
|
166
165
|
min: a,
|
|
167
166
|
step: s,
|
|
168
167
|
direction: t,
|
|
@@ -174,24 +173,24 @@ var vt = gt, yt = Object.defineProperty, I = (e, t) => yt(e, "name", {
|
|
|
174
173
|
})
|
|
175
174
|
})
|
|
176
175
|
});
|
|
177
|
-
}, "Slider")), [
|
|
176
|
+
}, "Slider")), [Ot, kt] = Ct(yt, {
|
|
178
177
|
startEdge: "left",
|
|
179
178
|
endEdge: "right",
|
|
180
179
|
size: "width",
|
|
181
180
|
direction: 1
|
|
182
|
-
}),
|
|
183
|
-
let { min: r, max: i, dir: a, inverted: o, onSlideStart: s, onSlideMove: c, onSlideEnd:
|
|
181
|
+
}), At = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, n) {
|
|
182
|
+
let { min: r, max: i, dir: a, inverted: o, onSlideStart: s, onSlideMove: c, onSlideEnd: u, onStepKeyDown: d, ...f } = e, [p, m] = E.useState(null), h = t(n, m), g = E.useRef(void 0), _ = l(a), v = _ === "ltr", y = v && !o || !v && o;
|
|
184
183
|
function b(e) {
|
|
185
|
-
let t = g.current || p.getBoundingClientRect(), n =
|
|
184
|
+
let t = g.current || p.getBoundingClientRect(), n = $t([0, t.width], y ? [r, i] : [i, r]);
|
|
186
185
|
return g.current = t, n(e - t.left);
|
|
187
186
|
}
|
|
188
|
-
return I(b, "getValueFromPointer"), /* @__PURE__ */ P(
|
|
187
|
+
return I(b, "getValueFromPointer"), /* @__PURE__ */ P(Ot, {
|
|
189
188
|
scope: e.__scopeSlider,
|
|
190
189
|
startEdge: y ? "left" : "right",
|
|
191
190
|
endEdge: y ? "right" : "left",
|
|
192
191
|
direction: y ? 1 : -1,
|
|
193
192
|
size: "width",
|
|
194
|
-
children: /* @__PURE__ */ P(
|
|
193
|
+
children: /* @__PURE__ */ P(Mt, {
|
|
195
194
|
dir: _,
|
|
196
195
|
"data-orientation": "horizontal",
|
|
197
196
|
...f,
|
|
@@ -209,10 +208,10 @@ var vt = gt, yt = Object.defineProperty, I = (e, t) => yt(e, "name", {
|
|
|
209
208
|
c?.(t);
|
|
210
209
|
},
|
|
211
210
|
onSlideEnd: () => {
|
|
212
|
-
g.current = void 0,
|
|
211
|
+
g.current = void 0, u?.();
|
|
213
212
|
},
|
|
214
213
|
onStepKeyDown: (e) => {
|
|
215
|
-
let t =
|
|
214
|
+
let t = vt[y ? "from-left" : "from-right"].includes(e.key);
|
|
216
215
|
d?.({
|
|
217
216
|
event: e,
|
|
218
217
|
direction: t ? -1 : 1
|
|
@@ -220,19 +219,19 @@ var vt = gt, yt = Object.defineProperty, I = (e, t) => yt(e, "name", {
|
|
|
220
219
|
}
|
|
221
220
|
})
|
|
222
221
|
});
|
|
223
|
-
}, "SliderHorizontal")),
|
|
222
|
+
}, "SliderHorizontal")), jt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, n) {
|
|
224
223
|
let { min: r, max: i, inverted: a, onSlideStart: o, onSlideMove: s, onSlideEnd: c, onStepKeyDown: l, ...u } = e, d = E.useRef(null), f = t(n, d), p = E.useRef(void 0), m = !a;
|
|
225
224
|
function h(e) {
|
|
226
|
-
let t = p.current || d.current.getBoundingClientRect(), n =
|
|
225
|
+
let t = p.current || d.current.getBoundingClientRect(), n = $t([0, t.height], m ? [i, r] : [r, i]);
|
|
227
226
|
return p.current = t, n(e - t.top);
|
|
228
227
|
}
|
|
229
|
-
return I(h, "getValueFromPointer"), /* @__PURE__ */ P(
|
|
228
|
+
return I(h, "getValueFromPointer"), /* @__PURE__ */ P(Ot, {
|
|
230
229
|
scope: e.__scopeSlider,
|
|
231
230
|
startEdge: m ? "bottom" : "top",
|
|
232
231
|
endEdge: m ? "top" : "bottom",
|
|
233
232
|
size: "height",
|
|
234
233
|
direction: m ? 1 : -1,
|
|
235
|
-
children: /* @__PURE__ */ P(
|
|
234
|
+
children: /* @__PURE__ */ P(Mt, {
|
|
236
235
|
"data-orientation": "vertical",
|
|
237
236
|
...u,
|
|
238
237
|
ref: f,
|
|
@@ -252,7 +251,7 @@ var vt = gt, yt = Object.defineProperty, I = (e, t) => yt(e, "name", {
|
|
|
252
251
|
p.current = void 0, c?.();
|
|
253
252
|
},
|
|
254
253
|
onStepKeyDown: (e) => {
|
|
255
|
-
let t =
|
|
254
|
+
let t = vt[m ? "from-bottom" : "from-top"].includes(e.key);
|
|
256
255
|
l?.({
|
|
257
256
|
event: e,
|
|
258
257
|
direction: t ? -1 : 1
|
|
@@ -260,13 +259,13 @@ var vt = gt, yt = Object.defineProperty, I = (e, t) => yt(e, "name", {
|
|
|
260
259
|
}
|
|
261
260
|
})
|
|
262
261
|
});
|
|
263
|
-
}, "SliderVertical")),
|
|
264
|
-
let { __scopeSlider: n, onSlideStart: i, onSlideMove: o, onSlideEnd: s, onHomeKeyDown: c, onEndKeyDown: l, onStepKeyDown: u, ...d } = e, f =
|
|
262
|
+
}, "SliderVertical")), Mt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, t) {
|
|
263
|
+
let { __scopeSlider: n, onSlideStart: i, onSlideMove: o, onSlideEnd: s, onHomeKeyDown: c, onEndKeyDown: l, onStepKeyDown: u, ...d } = e, f = Et(yt, n);
|
|
265
264
|
return /* @__PURE__ */ P(a.span, {
|
|
266
265
|
...d,
|
|
267
266
|
ref: t,
|
|
268
267
|
onKeyDown: r(e.onKeyDown, (e) => {
|
|
269
|
-
e.key === "Home" ? (c(e), e.preventDefault()) : e.key === "End" ? (l(e), e.preventDefault()) :
|
|
268
|
+
e.key === "Home" ? (c(e), e.preventDefault()) : e.key === "End" ? (l(e), e.preventDefault()) : gt.concat(_t).includes(e.key) && (u(e), e.preventDefault());
|
|
270
269
|
}),
|
|
271
270
|
onPointerDown: r(e.onPointerDown, (e) => {
|
|
272
271
|
let t = e.target;
|
|
@@ -283,16 +282,16 @@ var vt = gt, yt = Object.defineProperty, I = (e, t) => yt(e, "name", {
|
|
|
283
282
|
t.hasPointerCapture(e.pointerId) && (t.releasePointerCapture(e.pointerId), s(e));
|
|
284
283
|
})
|
|
285
284
|
});
|
|
286
|
-
}, "SliderImpl")),
|
|
287
|
-
let { __scopeSlider: n, ...r } = e, i =
|
|
285
|
+
}, "SliderImpl")), Nt = "SliderTrack", Pt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, t) {
|
|
286
|
+
let { __scopeSlider: n, ...r } = e, i = Et(Nt, n);
|
|
288
287
|
return /* @__PURE__ */ P(a.span, {
|
|
289
288
|
"data-disabled": i.disabled ? "" : void 0,
|
|
290
289
|
"data-orientation": i.orientation,
|
|
291
290
|
...r,
|
|
292
291
|
ref: t
|
|
293
292
|
});
|
|
294
|
-
}, "SliderTrack")),
|
|
295
|
-
let { __scopeSlider: r, ...i } = e, o =
|
|
293
|
+
}, "SliderTrack")), Ft = "SliderRange", It = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, n) {
|
|
294
|
+
let { __scopeSlider: r, ...i } = e, o = Et(Ft, r), s = kt(Ft, r), c = t(n, E.useRef(null)), l = o.values.length, u = o.values.map((e) => qt(e, o.min, o.max)), d = l > 1 ? Math.min(...u) : 0, f = 100 - Math.max(...u);
|
|
296
295
|
return /* @__PURE__ */ P(a.span, {
|
|
297
296
|
"data-orientation": o.orientation,
|
|
298
297
|
"data-disabled": o.disabled ? "" : void 0,
|
|
@@ -304,9 +303,9 @@ var vt = gt, yt = Object.defineProperty, I = (e, t) => yt(e, "name", {
|
|
|
304
303
|
[s.endEdge]: f + "%"
|
|
305
304
|
}
|
|
306
305
|
});
|
|
307
|
-
}, "SliderRange")), [
|
|
308
|
-
function
|
|
309
|
-
let { __scopeSlider: t, name: r, children: i, internal_do_not_use_render: a } = e, o =
|
|
306
|
+
}, "SliderRange")), [Lt, Rt] = Ct("SliderThumb"), zt = "SliderThumbProvider";
|
|
307
|
+
function Bt(e) {
|
|
308
|
+
let { __scopeSlider: t, name: r, children: i, internal_do_not_use_render: a } = e, o = Et(zt, t), s = xt(t), [c, l] = E.useState(null), u = E.useMemo(() => c ? s().findIndex((e) => e.ref.current === c) : -1, [s, c]), d = n(c), f = !c || !!o.form || !!c.closest("form"), p = o.values[u], m = r ?? (o.name ? o.name + (o.values.length > 1 ? "[]" : "") : void 0), h = p === void 0 ? 0 : qt(p, o.min, o.max);
|
|
310
309
|
E.useEffect(() => {
|
|
311
310
|
if (c) return o.thumbs.add(c), () => {
|
|
312
311
|
o.thumbs.delete(c);
|
|
@@ -323,22 +322,22 @@ function Wt(e) {
|
|
|
323
322
|
percent: h,
|
|
324
323
|
size: d
|
|
325
324
|
};
|
|
326
|
-
return /* @__PURE__ */ P(
|
|
325
|
+
return /* @__PURE__ */ P(Lt, {
|
|
327
326
|
scope: t,
|
|
328
327
|
...g,
|
|
329
|
-
children:
|
|
328
|
+
children: nn(a) ? a(g) : i
|
|
330
329
|
});
|
|
331
330
|
}
|
|
332
|
-
I(
|
|
333
|
-
var
|
|
334
|
-
let { __scopeSlider: i, ...o } = e, s =
|
|
331
|
+
I(Bt, "SliderThumbProvider");
|
|
332
|
+
var Vt = "SliderThumbTrigger", Ht = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, n) {
|
|
333
|
+
let { __scopeSlider: i, ...o } = e, s = Et(Vt, i), c = kt(Vt, i), { index: l, value: u, percent: d, size: f, onThumbChange: p } = Rt(Vt, i), m = t(n, p), h = Jt(l, s.values.length), g = f?.[c.size], _ = g ? Xt(g, d, c.direction) : 0;
|
|
335
334
|
return /* @__PURE__ */ P("span", {
|
|
336
335
|
style: {
|
|
337
336
|
transform: "var(--radix-slider-thumb-transform)",
|
|
338
337
|
position: "absolute",
|
|
339
338
|
[c.startEdge]: `calc(${d}% + ${_}px)`
|
|
340
339
|
},
|
|
341
|
-
children: /* @__PURE__ */ P(
|
|
340
|
+
children: /* @__PURE__ */ P(bt.ItemSlot, {
|
|
342
341
|
scope: i,
|
|
343
342
|
children: /* @__PURE__ */ P(a.span, {
|
|
344
343
|
role: "slider",
|
|
@@ -359,19 +358,19 @@ var Gt = "SliderThumbTrigger", Kt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */
|
|
|
359
358
|
})
|
|
360
359
|
})
|
|
361
360
|
});
|
|
362
|
-
}, "SliderThumbTrigger")),
|
|
361
|
+
}, "SliderThumbTrigger")), Ut = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, t) {
|
|
363
362
|
let { __scopeSlider: n, name: r, ...i } = e;
|
|
364
|
-
return /* @__PURE__ */ P(
|
|
363
|
+
return /* @__PURE__ */ P(Bt, {
|
|
365
364
|
__scopeSlider: n,
|
|
366
365
|
name: r,
|
|
367
|
-
internal_do_not_use_render: ({ index: e, isFormControl: r }) => /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
366
|
+
internal_do_not_use_render: ({ index: e, isFormControl: r }) => /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(Ht, {
|
|
368
367
|
...i,
|
|
369
368
|
ref: t,
|
|
370
369
|
__scopeSlider: n
|
|
371
|
-
}), r ? /* @__PURE__ */ P(
|
|
370
|
+
}), r ? /* @__PURE__ */ P(Gt, { __scopeSlider: n }, e) : null] })
|
|
372
371
|
});
|
|
373
|
-
}, "SliderThumb")),
|
|
374
|
-
let { value: i, name: o, form: s } =
|
|
372
|
+
}, "SliderThumb")), Wt = "SliderBubbleInput", Gt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function({ __scopeSlider: e, ...n }, r) {
|
|
373
|
+
let { value: i, name: o, form: s } = Rt(Wt, e), c = E.useRef(null), l = t(c, r), u = st(i);
|
|
375
374
|
return E.useEffect(() => {
|
|
376
375
|
let e = c.current;
|
|
377
376
|
if (!e) return;
|
|
@@ -389,52 +388,52 @@ var Gt = "SliderThumbTrigger", Kt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */
|
|
|
389
388
|
defaultValue: i
|
|
390
389
|
});
|
|
391
390
|
}, "SliderBubbleInput"));
|
|
392
|
-
function
|
|
391
|
+
function Kt(e = [], t, n) {
|
|
393
392
|
let r = [...e];
|
|
394
393
|
return r[n] = t, r.sort((e, t) => e - t);
|
|
395
394
|
}
|
|
396
|
-
I(
|
|
397
|
-
function
|
|
398
|
-
return
|
|
395
|
+
I(Kt, "getNextSortedValues");
|
|
396
|
+
function qt(e, t, n) {
|
|
397
|
+
return ee(100 / (n - t) * (e - t), [0, 100]);
|
|
399
398
|
}
|
|
400
|
-
I(
|
|
401
|
-
function
|
|
399
|
+
I(qt, "convertValueToPercentage");
|
|
400
|
+
function Jt(e, t) {
|
|
402
401
|
if (t > 2) return `Value ${e + 1} of ${t}`;
|
|
403
402
|
if (t === 2) return ["Minimum", "Maximum"][e];
|
|
404
403
|
}
|
|
405
|
-
I(
|
|
406
|
-
function
|
|
404
|
+
I(Jt, "getLabel");
|
|
405
|
+
function Yt(e, t) {
|
|
407
406
|
if (e.length === 1) return 0;
|
|
408
407
|
let n = e.map((e) => Math.abs(e - t)), r = Math.min(...n);
|
|
409
408
|
return n.indexOf(r);
|
|
410
409
|
}
|
|
411
|
-
I(
|
|
412
|
-
function
|
|
410
|
+
I(Yt, "getClosestValueIndex");
|
|
411
|
+
function Xt(e, t, n) {
|
|
413
412
|
let r = e / 2;
|
|
414
|
-
return (r -
|
|
413
|
+
return (r - $t([0, 50], [0, r])(t) * n) * n;
|
|
415
414
|
}
|
|
416
|
-
I(
|
|
417
|
-
function
|
|
415
|
+
I(Xt, "getThumbInBoundsOffset");
|
|
416
|
+
function Zt(e) {
|
|
418
417
|
return e.slice(0, -1).map((t, n) => e[n + 1] - t);
|
|
419
418
|
}
|
|
420
|
-
I(
|
|
421
|
-
function
|
|
419
|
+
I(Zt, "getStepsBetweenValues");
|
|
420
|
+
function Qt(e, t) {
|
|
422
421
|
if (t > 0) {
|
|
423
|
-
let n =
|
|
422
|
+
let n = Zt(e);
|
|
424
423
|
return Math.min(...n) >= t;
|
|
425
424
|
}
|
|
426
425
|
return !0;
|
|
427
426
|
}
|
|
428
|
-
I(
|
|
429
|
-
function
|
|
427
|
+
I(Qt, "hasMinStepsBetweenValues");
|
|
428
|
+
function $t(e, t) {
|
|
430
429
|
return (n) => {
|
|
431
430
|
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
432
431
|
let r = (t[1] - t[0]) / (e[1] - e[0]);
|
|
433
432
|
return t[0] + r * (n - e[0]);
|
|
434
433
|
};
|
|
435
434
|
}
|
|
436
|
-
I(
|
|
437
|
-
function
|
|
435
|
+
I($t, "linearScale");
|
|
436
|
+
function en(e) {
|
|
438
437
|
if (!Number.isFinite(e)) return 0;
|
|
439
438
|
let t = e.toString();
|
|
440
439
|
if (t.includes("e")) {
|
|
@@ -444,64 +443,64 @@ function an(e) {
|
|
|
444
443
|
let n = t.split(".")[1];
|
|
445
444
|
return n ? n.length : 0;
|
|
446
445
|
}
|
|
447
|
-
I(
|
|
448
|
-
function
|
|
446
|
+
I(en, "getDecimalCount");
|
|
447
|
+
function L(e, t) {
|
|
449
448
|
let n = 10 ** t;
|
|
450
449
|
return Math.round(e * n) / n;
|
|
451
450
|
}
|
|
452
|
-
I(
|
|
453
|
-
function
|
|
454
|
-
let a =
|
|
455
|
-
return l = c ? s + i * r : r > 0 ? Math.ceil(o) : Math.floor(o),
|
|
451
|
+
I(L, "roundValue");
|
|
452
|
+
function tn(e, { min: t, step: n, direction: r, multiplier: i }) {
|
|
453
|
+
let a = en(n), o = (e - t) / n, s = Math.round(o), c = L(s * n + t, a) === L(e, a), l;
|
|
454
|
+
return l = c ? s + i * r : r > 0 ? Math.ceil(o) : Math.floor(o), L(l * n + t, a);
|
|
456
455
|
}
|
|
457
|
-
I(
|
|
458
|
-
function
|
|
456
|
+
I(tn, "getNextStepValue");
|
|
457
|
+
function nn(e) {
|
|
459
458
|
return typeof e == "function";
|
|
460
459
|
}
|
|
461
|
-
I(
|
|
460
|
+
I(nn, "isFunction");
|
|
462
461
|
//#endregion
|
|
463
462
|
//#region ../../node_modules/react-use/esm/useFirstMountState.js
|
|
464
|
-
function
|
|
463
|
+
function rn() {
|
|
465
464
|
var e = j(!0);
|
|
466
465
|
return e.current ? (e.current = !1, !0) : e.current;
|
|
467
466
|
}
|
|
468
467
|
//#endregion
|
|
469
468
|
//#region ../../node_modules/react-use/esm/useUpdateEffect.js
|
|
470
|
-
var
|
|
471
|
-
var n =
|
|
469
|
+
var an = function(e, t) {
|
|
470
|
+
var n = rn();
|
|
472
471
|
O(function() {
|
|
473
472
|
if (!n) return e();
|
|
474
473
|
}, t);
|
|
475
|
-
},
|
|
476
|
-
function
|
|
477
|
-
return /* @__PURE__ */ P(
|
|
474
|
+
}, on = pe(null);
|
|
475
|
+
function sn({ value: e, children: t }) {
|
|
476
|
+
return /* @__PURE__ */ P(on.Provider, {
|
|
478
477
|
value: e,
|
|
479
478
|
children: t
|
|
480
479
|
});
|
|
481
480
|
}
|
|
482
|
-
function
|
|
483
|
-
let e =
|
|
481
|
+
function R() {
|
|
482
|
+
let e = me(on);
|
|
484
483
|
if (!e) throw Error("ImageEditor parts must be used inside <ImageEditor>");
|
|
485
484
|
return e;
|
|
486
485
|
}
|
|
487
|
-
var
|
|
488
|
-
function
|
|
486
|
+
var cn = (e, t, n) => .2126 * e + .7152 * t + .0722 * n;
|
|
487
|
+
function ln(e, t = 64) {
|
|
489
488
|
let n = Array(t).fill(0), { data: r } = e;
|
|
490
489
|
for (let e = 0; e < r.length; e += 4) {
|
|
491
490
|
if ((r[e + 3] ?? 0) < 8) continue;
|
|
492
|
-
let i =
|
|
491
|
+
let i = cn(r[e] ?? 0, r[e + 1] ?? 0, r[e + 2] ?? 0), a = Math.min(t - 1, Math.floor(i / 256 * t));
|
|
493
492
|
n[a] = (n[a] ?? 0) + 1;
|
|
494
493
|
}
|
|
495
494
|
return n;
|
|
496
495
|
}
|
|
497
|
-
function
|
|
496
|
+
function un(e, t) {
|
|
498
497
|
let n = e.reduce((e, t) => e + t, 0);
|
|
499
498
|
if (n === 0) return .5;
|
|
500
499
|
let r = 0;
|
|
501
500
|
for (let i = 0; i < e.length; i++) if (r += e[i] ?? 0, r / n >= t) return (i + .5) / e.length;
|
|
502
501
|
return 1;
|
|
503
502
|
}
|
|
504
|
-
function
|
|
503
|
+
function dn(e) {
|
|
505
504
|
let { data: t } = e, n = 0, r = 0;
|
|
506
505
|
for (let e = 0; e < t.length; e += 4) {
|
|
507
506
|
let i = t[e] ?? 0, a = t[e + 1] ?? 0, o = t[e + 2] ?? 0, s = Math.max(i, a, o);
|
|
@@ -509,23 +508,23 @@ function gn(e) {
|
|
|
509
508
|
}
|
|
510
509
|
return r ? n / r : 0;
|
|
511
510
|
}
|
|
512
|
-
var
|
|
513
|
-
function
|
|
514
|
-
let t =
|
|
511
|
+
var z = (e, t, n) => Math.round(Math.min(n, Math.max(t, e)));
|
|
512
|
+
function fn(e) {
|
|
513
|
+
let t = ln(e, 128), n = un(t, .02), r = un(t, .98), i = un(t, .5), a = {}, o = z((.5 - i) * 110, -40, 40);
|
|
515
514
|
Math.abs(o) >= 4 && (a.exposure = o);
|
|
516
515
|
let s = r - n;
|
|
517
|
-
s < .88 && (a.contrast =
|
|
518
|
-
let c =
|
|
519
|
-
return c < .35 && (a.vibrance =
|
|
516
|
+
s < .88 && (a.contrast = z((.92 - s) * 90, 0, 35)), r > .97 && (a.highlights = -z((r - .94) * 500, 0, 30)), n < .03 && (a.shadows = z((.06 - n) * 400, 0, 30));
|
|
517
|
+
let c = dn(e);
|
|
518
|
+
return c < .35 && (a.vibrance = z((.4 - c) * 90, 0, 35)), a;
|
|
520
519
|
}
|
|
521
520
|
//#endregion
|
|
522
521
|
//#region lib/components/ui/media/image-editor/image-editor.consts.ts
|
|
523
|
-
var
|
|
522
|
+
var pn = [
|
|
524
523
|
"adjust",
|
|
525
524
|
"filters",
|
|
526
525
|
"crop",
|
|
527
526
|
"markup"
|
|
528
|
-
],
|
|
527
|
+
], B = {
|
|
529
528
|
exposure: 0,
|
|
530
529
|
brightness: 0,
|
|
531
530
|
contrast: 0,
|
|
@@ -541,36 +540,36 @@ var vn = [
|
|
|
541
540
|
vignette: 0,
|
|
542
541
|
grain: 0,
|
|
543
542
|
blur: 0
|
|
544
|
-
},
|
|
543
|
+
}, V = (e, t) => ({
|
|
545
544
|
key: e,
|
|
546
545
|
min: -100,
|
|
547
546
|
max: 100,
|
|
548
547
|
label: t
|
|
549
|
-
}),
|
|
548
|
+
}), mn = (e, t) => ({
|
|
550
549
|
key: e,
|
|
551
550
|
min: 0,
|
|
552
551
|
max: 100,
|
|
553
552
|
label: t
|
|
554
|
-
}),
|
|
553
|
+
}), hn = [
|
|
555
554
|
{
|
|
556
555
|
id: "light",
|
|
557
556
|
label: "Light",
|
|
558
557
|
items: [
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
558
|
+
V("exposure", "Exposure"),
|
|
559
|
+
V("brightness", "Brightness"),
|
|
560
|
+
V("contrast", "Contrast"),
|
|
561
|
+
V("highlights", "Highlights"),
|
|
562
|
+
V("shadows", "Shadows")
|
|
564
563
|
]
|
|
565
564
|
},
|
|
566
565
|
{
|
|
567
566
|
id: "color",
|
|
568
567
|
label: "Colour",
|
|
569
568
|
items: [
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
569
|
+
V("saturation", "Saturation"),
|
|
570
|
+
V("vibrance", "Vibrance"),
|
|
571
|
+
V("warmth", "Warmth"),
|
|
572
|
+
V("tint", "Tint"),
|
|
574
573
|
{
|
|
575
574
|
key: "hue",
|
|
576
575
|
min: -180,
|
|
@@ -583,22 +582,22 @@ var vn = [
|
|
|
583
582
|
id: "effects",
|
|
584
583
|
label: "Effects",
|
|
585
584
|
items: [
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
585
|
+
mn("fade", "Fade"),
|
|
586
|
+
mn("sepia", "Sepia"),
|
|
587
|
+
mn("vignette", "Vignette"),
|
|
588
|
+
mn("grain", "Grain"),
|
|
589
|
+
mn("blur", "Blur")
|
|
591
590
|
]
|
|
592
591
|
}
|
|
593
592
|
];
|
|
594
|
-
|
|
593
|
+
hn.flatMap((e) => e.items);
|
|
595
594
|
var H = {
|
|
596
595
|
x: 0,
|
|
597
596
|
y: 0,
|
|
598
597
|
w: 1,
|
|
599
598
|
h: 1
|
|
600
599
|
}, U = {
|
|
601
|
-
adjustments:
|
|
600
|
+
adjustments: B,
|
|
602
601
|
filter: "none",
|
|
603
602
|
filterIntensity: 100,
|
|
604
603
|
transform: {
|
|
@@ -609,7 +608,7 @@ var H = {
|
|
|
609
608
|
},
|
|
610
609
|
crop: H,
|
|
611
610
|
annotations: []
|
|
612
|
-
},
|
|
611
|
+
}, gn = [
|
|
613
612
|
{
|
|
614
613
|
id: "free",
|
|
615
614
|
label: "Free",
|
|
@@ -650,7 +649,7 @@ var H = {
|
|
|
650
649
|
label: "9:16",
|
|
651
650
|
value: 9 / 16
|
|
652
651
|
}
|
|
653
|
-
],
|
|
652
|
+
], _n = [
|
|
654
653
|
"#ffffff",
|
|
655
654
|
"#111827",
|
|
656
655
|
"#ef4444",
|
|
@@ -661,17 +660,17 @@ var H = {
|
|
|
661
660
|
"#3b82f6",
|
|
662
661
|
"#8b5cf6",
|
|
663
662
|
"#ec4899"
|
|
664
|
-
],
|
|
663
|
+
], vn = {
|
|
665
664
|
color: "#ef4444",
|
|
666
665
|
size: .012,
|
|
667
666
|
fill: !1,
|
|
668
667
|
background: !0,
|
|
669
668
|
redactMode: "solid"
|
|
670
|
-
},
|
|
669
|
+
}, yn = .002, bn = .06, xn = {
|
|
671
670
|
format: "image/png",
|
|
672
671
|
quality: .92,
|
|
673
672
|
scale: 1
|
|
674
|
-
},
|
|
673
|
+
}, Sn = .1, Cn = [
|
|
675
674
|
.1,
|
|
676
675
|
.25,
|
|
677
676
|
.5,
|
|
@@ -683,20 +682,20 @@ var H = {
|
|
|
683
682
|
4,
|
|
684
683
|
6,
|
|
685
684
|
8
|
|
686
|
-
],
|
|
685
|
+
], wn = 1600, W = .04, Tn = (e) => rt(e) ? nt(e) : e;
|
|
687
686
|
function G(e, t, n) {
|
|
688
|
-
(t === null || t !== e.historyGroup) && (e.past.push(
|
|
687
|
+
(t === null || t !== e.historyGroup) && (e.past.push(Tn(e.edits)), e.past.length > 60 && e.past.shift(), e.future = []), e.historyGroup = t, n(e.edits);
|
|
689
688
|
}
|
|
690
|
-
function
|
|
689
|
+
function En(e) {
|
|
691
690
|
e.selectedId && !e.edits.annotations.some((t) => t.id === e.selectedId) && (e.selectedId = null);
|
|
692
691
|
}
|
|
693
|
-
function
|
|
692
|
+
function Dn(e) {
|
|
694
693
|
let t = e.past.pop();
|
|
695
|
-
t && (e.future.unshift(
|
|
694
|
+
t && (e.future.unshift(Tn(e.edits)), e.edits = t, e.historyGroup = null, En(e));
|
|
696
695
|
}
|
|
697
|
-
function
|
|
696
|
+
function On(e) {
|
|
698
697
|
let t = e.future.shift();
|
|
699
|
-
t && (e.past.push(
|
|
698
|
+
t && (e.past.push(Tn(e.edits)), e.edits = t, e.historyGroup = null, En(e));
|
|
700
699
|
}
|
|
701
700
|
//#endregion
|
|
702
701
|
//#region lib/components/ui/media/image-editor/image-editor.geometry.ts
|
|
@@ -709,18 +708,18 @@ function K(e, t) {
|
|
|
709
708
|
height: e.width
|
|
710
709
|
};
|
|
711
710
|
}
|
|
712
|
-
function
|
|
711
|
+
function kn(e, t, n) {
|
|
713
712
|
let r = Math.abs(n * Math.PI / 180), i = Math.cos(r), a = Math.sin(r);
|
|
714
713
|
return Math.max((e * i + t * a) / e, (e * a + t * i) / t);
|
|
715
714
|
}
|
|
716
|
-
function
|
|
715
|
+
function An(e, t, n) {
|
|
717
716
|
return n === 1 ? [1 - t, e] : [t, 1 - e];
|
|
718
717
|
}
|
|
719
|
-
function
|
|
720
|
-
let [n, r] =
|
|
721
|
-
return
|
|
718
|
+
function jn(e, t) {
|
|
719
|
+
let [n, r] = An(e.x, e.y, t), [i, a] = An(e.x + e.w, e.y + e.h, t);
|
|
720
|
+
return Nn(n, r, i, a);
|
|
722
721
|
}
|
|
723
|
-
function
|
|
722
|
+
function Mn(e, t) {
|
|
724
723
|
return t === "x" ? {
|
|
725
724
|
...e,
|
|
726
725
|
x: 1 - e.x - e.w
|
|
@@ -729,7 +728,7 @@ function In(e, t) {
|
|
|
729
728
|
y: 1 - e.y - e.h
|
|
730
729
|
};
|
|
731
730
|
}
|
|
732
|
-
function
|
|
731
|
+
function Nn(e, t, n, r) {
|
|
733
732
|
return {
|
|
734
733
|
x: Math.min(e, n),
|
|
735
734
|
y: Math.min(t, r),
|
|
@@ -737,63 +736,72 @@ function q(e, t, n, r) {
|
|
|
737
736
|
h: Math.abs(r - t)
|
|
738
737
|
};
|
|
739
738
|
}
|
|
740
|
-
var
|
|
741
|
-
function
|
|
742
|
-
let t =
|
|
739
|
+
var q = (e, t, n) => Math.min(n, Math.max(t, e));
|
|
740
|
+
function Pn(e) {
|
|
741
|
+
let t = q(e.w, W, 1), n = q(e.h, W, 1);
|
|
743
742
|
return {
|
|
744
|
-
x:
|
|
745
|
-
y:
|
|
743
|
+
x: q(e.x, 0, 1 - t),
|
|
744
|
+
y: q(e.y, 0, 1 - n),
|
|
746
745
|
w: t,
|
|
747
746
|
h: n
|
|
748
747
|
};
|
|
749
748
|
}
|
|
750
|
-
function
|
|
749
|
+
function Fn(e, t, n) {
|
|
751
750
|
let r = t / (n.width / n.height), i = Math.max(e.w, W), a = i / r;
|
|
752
751
|
a > 1 && (a = 1, i = a * r), i > 1 && (i = 1, a = i / r);
|
|
753
752
|
let o = e.x + e.w / 2, s = e.y + e.h / 2;
|
|
754
753
|
return {
|
|
755
|
-
x:
|
|
756
|
-
y:
|
|
754
|
+
x: q(o - i / 2, 0, 1 - i),
|
|
755
|
+
y: q(s - a / 2, 0, 1 - a),
|
|
757
756
|
w: i,
|
|
758
757
|
h: a
|
|
759
758
|
};
|
|
760
759
|
}
|
|
761
|
-
function
|
|
760
|
+
function In(e, t, n) {
|
|
762
761
|
return {
|
|
763
762
|
...e,
|
|
764
|
-
x:
|
|
765
|
-
y:
|
|
763
|
+
x: q(e.x + t, 0, 1 - e.w),
|
|
764
|
+
y: q(e.y + n, 0, 1 - e.h)
|
|
766
765
|
};
|
|
767
766
|
}
|
|
768
|
-
function
|
|
769
|
-
if (t === "move") return
|
|
767
|
+
function Ln(e, t, n, r, i, a) {
|
|
768
|
+
if (t === "move") return In(e, n, r);
|
|
770
769
|
let o = e.x, s = e.y, c = e.x + e.w, l = e.y + e.h;
|
|
771
|
-
t.includes("w") && (o =
|
|
770
|
+
t.includes("w") && (o = q(o + n, 0, c - W)), t.includes("e") && (c = q(c + n, o + W, 1)), t.includes("n") && (s = q(s + r, 0, l - W)), t.includes("s") && (l = q(l + r, s + W, 1));
|
|
772
771
|
let u = {
|
|
773
772
|
x: o,
|
|
774
773
|
y: s,
|
|
775
774
|
w: c - o,
|
|
776
775
|
h: l - s
|
|
777
776
|
};
|
|
778
|
-
return i ?
|
|
777
|
+
return i ? Rn(u, t, i, a) : u;
|
|
779
778
|
}
|
|
780
|
-
function
|
|
779
|
+
function Rn(e, t, n, r) {
|
|
781
780
|
let i = n / (r.width / r.height), a = t === "n" || t === "s", o = a ? e.h * i : e.w, s = a ? e.h : e.w / i, c = e.x + e.w, l = e.y + e.h, u = t.includes("w") ? c : 1 - e.x, d = t.includes("n") ? l : 1 - e.y, f = Math.min(1, u / o, d / s);
|
|
782
781
|
o *= f, s *= f;
|
|
783
782
|
let p = t.includes("w") ? c - o : a ? e.x + (e.w - o) / 2 : e.x, m = t.includes("n") ? l - s : e.y;
|
|
784
783
|
return {
|
|
785
|
-
x:
|
|
786
|
-
y:
|
|
784
|
+
x: q(p, 0, 1 - o),
|
|
785
|
+
y: q(m, 0, 1 - s),
|
|
787
786
|
w: o,
|
|
788
787
|
h: s
|
|
789
788
|
};
|
|
790
789
|
}
|
|
791
|
-
function
|
|
790
|
+
function zn(e) {
|
|
792
791
|
return e.quarterTurns === 0 && !e.flipX && !e.flipY && e.straighten === 0;
|
|
793
792
|
}
|
|
794
793
|
//#endregion
|
|
794
|
+
//#region lib/components/ui/media/image-editor/image-editor.steps.ts
|
|
795
|
+
var Bn = (e, t) => Math.max(22, t.stepFloor ?? 0, e * Math.min(t.width, t.height) * 5);
|
|
796
|
+
function Vn(e) {
|
|
797
|
+
let t = e.flatMap((e) => e.kind === "step" ? [e] : []);
|
|
798
|
+
t.sort((e, t) => e.n - t.n), t.forEach((e, t) => {
|
|
799
|
+
e.n = t + 1;
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
//#endregion
|
|
795
803
|
//#region lib/components/ui/media/image-editor/image-editor.annotations.ts
|
|
796
|
-
function
|
|
804
|
+
function J(e, t) {
|
|
797
805
|
switch (e.kind) {
|
|
798
806
|
case "pen":
|
|
799
807
|
case "highlighter": {
|
|
@@ -815,7 +823,8 @@ function Y(e, t) {
|
|
|
815
823
|
y2: a
|
|
816
824
|
};
|
|
817
825
|
}
|
|
818
|
-
case "text":
|
|
826
|
+
case "text":
|
|
827
|
+
case "step": {
|
|
819
828
|
let [n, r] = t(e.x, e.y);
|
|
820
829
|
return {
|
|
821
830
|
...e,
|
|
@@ -827,26 +836,35 @@ function Y(e, t) {
|
|
|
827
836
|
let [n, r] = t(e.x, e.y), [i, a] = t(e.x + e.w, e.y + e.h);
|
|
828
837
|
return {
|
|
829
838
|
...e,
|
|
830
|
-
...
|
|
839
|
+
...Nn(n, r, i, a)
|
|
831
840
|
};
|
|
832
841
|
}
|
|
833
842
|
}
|
|
834
843
|
}
|
|
835
|
-
function
|
|
836
|
-
return
|
|
844
|
+
function Hn(e, t, n) {
|
|
845
|
+
return J(e, (e, r) => [e + t, r + n]);
|
|
837
846
|
}
|
|
838
|
-
var
|
|
839
|
-
function
|
|
847
|
+
var Un = (e, t) => Math.max(8, e * Math.min(t.width, t.height) * 3.2);
|
|
848
|
+
function Wn(e, t) {
|
|
840
849
|
switch (e.kind) {
|
|
841
850
|
case "pen":
|
|
842
851
|
case "highlighter": {
|
|
843
852
|
let t = e.points.filter((e, t) => t % 2 == 0), n = e.points.filter((e, t) => t % 2 == 1);
|
|
844
|
-
return
|
|
853
|
+
return Nn(Math.min(...t), Math.min(...n), Math.max(...t), Math.max(...n));
|
|
845
854
|
}
|
|
846
855
|
case "line":
|
|
847
|
-
case "arrow": return
|
|
856
|
+
case "arrow": return Nn(e.x1, e.y1, e.x2, e.y2);
|
|
857
|
+
case "step": {
|
|
858
|
+
let n = Bn(e.size, t), r = n / t.width, i = n / t.height;
|
|
859
|
+
return {
|
|
860
|
+
x: e.x - r / 2,
|
|
861
|
+
y: e.y - i / 2,
|
|
862
|
+
w: r,
|
|
863
|
+
h: i
|
|
864
|
+
};
|
|
865
|
+
}
|
|
848
866
|
case "text": {
|
|
849
|
-
let n =
|
|
867
|
+
let n = Un(e.size, t), r = e.text.split("\n"), i = (Math.max(...r.map((e) => e.length), 1) * n * .56 + n * .8) / t.width, a = (r.length * n * 1.25 + n * .4) / t.height;
|
|
850
868
|
return {
|
|
851
869
|
x: e.x,
|
|
852
870
|
y: e.y,
|
|
@@ -862,50 +880,55 @@ function Gn(e, t) {
|
|
|
862
880
|
};
|
|
863
881
|
}
|
|
864
882
|
}
|
|
865
|
-
function
|
|
883
|
+
function Gn(e, t, n, r, i, a) {
|
|
866
884
|
let o = i - n, s = a - r, c = o * o + s * s, l = c === 0 ? 0 : Math.max(0, Math.min(1, ((e - n) * o + (t - r) * s) / c));
|
|
867
885
|
return Math.hypot(e - (n + l * o), t - (r + l * s));
|
|
868
886
|
}
|
|
869
|
-
function
|
|
887
|
+
function Kn(e, t, n, r, i = 6) {
|
|
870
888
|
let a = t * r.width, o = n * r.height, s = e.size * Math.min(r.width, r.height) / 2 + i, c = (e, t) => [e * r.width, t * r.height];
|
|
871
889
|
if (e.kind === "pen" || e.kind === "highlighter") {
|
|
872
890
|
let t = Math.floor(e.points.length / 2);
|
|
873
891
|
for (let n = 0; n < Math.max(1, t - 1); n++) {
|
|
874
892
|
let r = Math.min(n + 1, t - 1), [i, l] = c(e.points[n * 2] ?? 0, e.points[n * 2 + 1] ?? 0), [u, d] = c(e.points[r * 2] ?? 0, e.points[r * 2 + 1] ?? 0);
|
|
875
|
-
if (
|
|
893
|
+
if (Gn(a, o, i, l, u, d) <= s) return !0;
|
|
876
894
|
}
|
|
877
895
|
return !1;
|
|
878
896
|
}
|
|
879
897
|
if (e.kind === "line" || e.kind === "arrow") {
|
|
880
898
|
let [t, n] = c(e.x1, e.y1), [r, i] = c(e.x2, e.y2);
|
|
881
|
-
return
|
|
899
|
+
return Gn(a, o, t, n, r, i) <= s;
|
|
882
900
|
}
|
|
883
|
-
|
|
901
|
+
if (e.kind === "step") {
|
|
902
|
+
let t = Bn(e.size, r) / 2 + i;
|
|
903
|
+
return Math.hypot(a - e.x * r.width, o - e.y * r.height) <= t;
|
|
904
|
+
}
|
|
905
|
+
let l = Wn(e, r), u = i / Math.min(r.width, r.height);
|
|
884
906
|
return t >= l.x - u && t <= l.x + l.w + u && n >= l.y - u && n <= l.y + l.h + u;
|
|
885
907
|
}
|
|
886
|
-
function
|
|
908
|
+
function Y(e, t, n, r) {
|
|
887
909
|
for (let i = e.length - 1; i >= 0; i--) {
|
|
888
910
|
let a = e[i];
|
|
889
|
-
if (a &&
|
|
911
|
+
if (a && Kn(a, t, n, r)) return a;
|
|
890
912
|
}
|
|
891
913
|
}
|
|
892
|
-
var
|
|
893
|
-
function
|
|
894
|
-
return
|
|
914
|
+
var qn = 0;
|
|
915
|
+
function Jn() {
|
|
916
|
+
return qn += 1, `mark-${Date.now().toString(36)}-${qn.toString(36)}`;
|
|
895
917
|
}
|
|
896
|
-
function
|
|
918
|
+
function Yn(e, t) {
|
|
897
919
|
return t ? e.filter((e) => e.id !== t) : e;
|
|
898
920
|
}
|
|
899
921
|
//#endregion
|
|
900
922
|
//#region lib/components/ui/media/image-editor/image-editor.markup-reducers.ts
|
|
901
923
|
var X = (e, t) => e.edits.annotations.findIndex((e) => e.id === t);
|
|
902
|
-
function
|
|
924
|
+
function Xn(e, t) {
|
|
903
925
|
t.color !== void 0 && (e.color = t.color), t.size !== void 0 && (e.size = t.size), t.fill !== void 0 && (e.kind === "rect" || e.kind === "ellipse") && (e.fill = t.fill), t.redactMode !== void 0 && e.kind === "redact" && (e.mode = t.redactMode), t.background !== void 0 && e.kind === "text" && (e.background = t.background);
|
|
904
926
|
}
|
|
905
|
-
var
|
|
927
|
+
var Zn = {
|
|
906
928
|
addAnnotation: (e, t) => {
|
|
907
|
-
|
|
908
|
-
|
|
929
|
+
let n = { ...t.payload };
|
|
930
|
+
G(e, null, (t) => {
|
|
931
|
+
n.kind === "step" && (n.n = t.annotations.filter((e) => e.kind === "step").length + 1, e.selectedId = n.id), t.annotations.push(n);
|
|
909
932
|
});
|
|
910
933
|
},
|
|
911
934
|
updateAnnotation: (e, t) => {
|
|
@@ -917,24 +940,24 @@ var $n = {
|
|
|
917
940
|
moveAnnotation: (e, t) => {
|
|
918
941
|
let { id: n, dx: r, dy: i, gesture: a } = t.payload, o = X(e, n), s = e.edits.annotations[o];
|
|
919
942
|
s && G(e, a, (e) => {
|
|
920
|
-
e.annotations[o] =
|
|
943
|
+
e.annotations[o] = Hn(s, r, i);
|
|
921
944
|
});
|
|
922
945
|
},
|
|
923
946
|
removeAnnotation: (e, t) => {
|
|
924
947
|
let n = X(e, t.payload);
|
|
925
948
|
n < 0 || (G(e, null, (e) => {
|
|
926
|
-
e.annotations.splice(n, 1);
|
|
949
|
+
e.annotations.splice(n, 1), Vn(e.annotations);
|
|
927
950
|
}), e.selectedId === t.payload && (e.selectedId = null));
|
|
928
951
|
},
|
|
929
952
|
duplicateAnnotation: (e, t) => {
|
|
930
953
|
let n = e.edits.annotations[X(e, t.payload)];
|
|
931
954
|
if (!n) return;
|
|
932
955
|
let r = {
|
|
933
|
-
...
|
|
934
|
-
id:
|
|
956
|
+
...Hn(n, .03, .03),
|
|
957
|
+
id: Jn()
|
|
935
958
|
};
|
|
936
959
|
G(e, null, (e) => {
|
|
937
|
-
e.annotations.push(r);
|
|
960
|
+
r.kind === "step" && (r.n = e.annotations.filter((e) => e.kind === "step").length + 1), e.annotations.push(r);
|
|
938
961
|
}), e.selectedId = r.id;
|
|
939
962
|
},
|
|
940
963
|
bringToFront: (e, t) => {
|
|
@@ -957,21 +980,21 @@ var $n = {
|
|
|
957
980
|
let n = e.selectedId ? X(e, e.selectedId) : -1;
|
|
958
981
|
n < 0 || G(e, `style:${e.selectedId}`, (e) => {
|
|
959
982
|
let r = e.annotations[n];
|
|
960
|
-
r &&
|
|
983
|
+
r && Xn(r, t.payload);
|
|
961
984
|
});
|
|
962
985
|
}
|
|
963
|
-
},
|
|
986
|
+
}, Qn = {
|
|
964
987
|
turn: (e, t) => {
|
|
965
988
|
let n = t.payload;
|
|
966
989
|
G(e, null, (e) => {
|
|
967
990
|
let { transform: t } = e, r = t.flipX === t.flipY ? n : -n;
|
|
968
|
-
t.quarterTurns = ((t.quarterTurns + r) % 4 + 4) % 4, e.crop =
|
|
991
|
+
t.quarterTurns = ((t.quarterTurns + r) % 4 + 4) % 4, e.crop = jn(e.crop, n), e.annotations = e.annotations.map((e) => J(e, (e, t) => An(e, t, n)));
|
|
969
992
|
}), e.aspect !== null && e.aspect !== "original" && (e.aspect = 1 / e.aspect);
|
|
970
993
|
},
|
|
971
994
|
flip: (e, t) => {
|
|
972
995
|
let n = t.payload;
|
|
973
996
|
G(e, null, (e) => {
|
|
974
|
-
n === "x" ? e.transform.flipX = !e.transform.flipX : e.transform.flipY = !e.transform.flipY, e.crop =
|
|
997
|
+
n === "x" ? e.transform.flipX = !e.transform.flipX : e.transform.flipY = !e.transform.flipY, e.crop = Mn(e.crop, n), e.annotations = e.annotations.map((e) => J(e, (e, t) => n === "x" ? [1 - e, t] : [e, 1 - t]));
|
|
975
998
|
});
|
|
976
999
|
},
|
|
977
1000
|
setStraighten: (e, t) => {
|
|
@@ -981,7 +1004,7 @@ var $n = {
|
|
|
981
1004
|
});
|
|
982
1005
|
},
|
|
983
1006
|
setCrop: (e, t) => {
|
|
984
|
-
let n =
|
|
1007
|
+
let n = Pn(t.payload.rect);
|
|
985
1008
|
G(e, t.payload.gesture ?? null, (e) => {
|
|
986
1009
|
e.crop = n;
|
|
987
1010
|
});
|
|
@@ -989,24 +1012,24 @@ var $n = {
|
|
|
989
1012
|
resetTransform: (e) => {
|
|
990
1013
|
let { transform: t } = e.edits, n = t.quarterTurns === 0 && !t.flipX && !t.flipY && t.straighten === 0, r = e.edits.crop;
|
|
991
1014
|
n && r.x === 0 && r.y === 0 && r.w === 1 && r.h === 1 || (G(e, null, (e) => {
|
|
992
|
-
e.annotations = e.annotations.map((t) =>
|
|
1015
|
+
e.annotations = e.annotations.map((t) => $n(t, e.transform)), e.transform = U.transform, e.crop = U.crop;
|
|
993
1016
|
}), e.aspect = null);
|
|
994
1017
|
}
|
|
995
1018
|
};
|
|
996
|
-
function
|
|
1019
|
+
function $n(e, t) {
|
|
997
1020
|
let n = e;
|
|
998
|
-
t.flipX && (n =
|
|
999
|
-
for (let e = 0; e < t.quarterTurns; e++) n =
|
|
1021
|
+
t.flipX && (n = J(n, (e, t) => [1 - e, t])), t.flipY && (n = J(n, (e, t) => [e, 1 - t]));
|
|
1022
|
+
for (let e = 0; e < t.quarterTurns; e++) n = J(n, (e, t) => An(e, t, -1));
|
|
1000
1023
|
return n;
|
|
1001
1024
|
}
|
|
1002
1025
|
//#endregion
|
|
1003
1026
|
//#region lib/components/ui/media/image-editor/image-editor.slice.ts
|
|
1004
|
-
function
|
|
1027
|
+
function er(e) {
|
|
1005
1028
|
return {
|
|
1006
1029
|
...U,
|
|
1007
1030
|
...e,
|
|
1008
1031
|
adjustments: {
|
|
1009
|
-
...
|
|
1032
|
+
...B,
|
|
1010
1033
|
...e?.adjustments
|
|
1011
1034
|
},
|
|
1012
1035
|
transform: {
|
|
@@ -1020,7 +1043,7 @@ function nr(e) {
|
|
|
1020
1043
|
annotations: e?.annotations ?? []
|
|
1021
1044
|
};
|
|
1022
1045
|
}
|
|
1023
|
-
var
|
|
1046
|
+
var tr = tt({
|
|
1024
1047
|
name: "imageEditor",
|
|
1025
1048
|
initialState: ((e) => ({
|
|
1026
1049
|
edits: U,
|
|
@@ -1029,13 +1052,13 @@ var rr = at({
|
|
|
1029
1052
|
historyGroup: null,
|
|
1030
1053
|
tool: "adjust",
|
|
1031
1054
|
markupTool: "pen",
|
|
1032
|
-
brush:
|
|
1055
|
+
brush: vn,
|
|
1033
1056
|
selectedId: null,
|
|
1034
1057
|
zoom: null,
|
|
1035
1058
|
comparing: !1,
|
|
1036
1059
|
split: !1,
|
|
1037
1060
|
aspect: null,
|
|
1038
|
-
exportOptions:
|
|
1061
|
+
exportOptions: xn,
|
|
1039
1062
|
editingId: null,
|
|
1040
1063
|
shortcutsOpen: !1,
|
|
1041
1064
|
...e
|
|
@@ -1060,7 +1083,7 @@ var rr = at({
|
|
|
1060
1083
|
},
|
|
1061
1084
|
resetAdjustments: (e) => {
|
|
1062
1085
|
G(e, null, (e) => {
|
|
1063
|
-
e.adjustments =
|
|
1086
|
+
e.adjustments = B;
|
|
1064
1087
|
});
|
|
1065
1088
|
},
|
|
1066
1089
|
setFilter: (e, t) => {
|
|
@@ -1076,21 +1099,21 @@ var rr = at({
|
|
|
1076
1099
|
setAspect: (e, t) => {
|
|
1077
1100
|
e.aspect = t.payload;
|
|
1078
1101
|
},
|
|
1079
|
-
...
|
|
1080
|
-
|
|
1102
|
+
...Qn,
|
|
1103
|
+
...Zn,
|
|
1081
1104
|
resetAll: (e) => {
|
|
1082
1105
|
G(e, null, (e) => Object.assign(e, U)), e.selectedId = null;
|
|
1083
1106
|
},
|
|
1084
1107
|
endGesture: (e) => {
|
|
1085
1108
|
e.historyGroup = null;
|
|
1086
1109
|
},
|
|
1087
|
-
undo:
|
|
1088
|
-
redo:
|
|
1110
|
+
undo: Dn,
|
|
1111
|
+
redo: On,
|
|
1089
1112
|
clearHistory: (e) => {
|
|
1090
1113
|
e.past = [], e.future = [], e.historyGroup = null;
|
|
1091
1114
|
},
|
|
1092
1115
|
setZoom: (e, t) => {
|
|
1093
|
-
e.zoom = t.payload === null ? null : Math.min(8, Math.max(
|
|
1116
|
+
e.zoom = t.payload === null ? null : Math.min(8, Math.max(Sn, t.payload));
|
|
1094
1117
|
},
|
|
1095
1118
|
setComparing: (e, t) => {
|
|
1096
1119
|
e.comparing = t.payload;
|
|
@@ -1109,36 +1132,36 @@ var rr = at({
|
|
|
1109
1132
|
}
|
|
1110
1133
|
}
|
|
1111
1134
|
});
|
|
1112
|
-
|
|
1113
|
-
var
|
|
1135
|
+
tr.actions;
|
|
1136
|
+
var nr = {
|
|
1114
1137
|
selectCanUndo: (e) => e.past.length > 0,
|
|
1115
1138
|
selectCanRedo: (e) => e.future.length > 0,
|
|
1116
1139
|
selectSelected: (e) => e.edits.annotations.find((t) => t.id === e.selectedId),
|
|
1117
1140
|
selectIsDirty: (e) => e.past.length > 0,
|
|
1118
1141
|
selectAdjustedCount: (e) => Object.values(e.edits.adjustments).filter((e) => e !== 0).length
|
|
1119
|
-
},
|
|
1120
|
-
function
|
|
1121
|
-
let t =
|
|
1122
|
-
return t.length ? t :
|
|
1142
|
+
}, rr = ["solid", "pixelate"];
|
|
1143
|
+
function ir(e) {
|
|
1144
|
+
let t = rr.filter((t) => e?.includes(t));
|
|
1145
|
+
return t.length ? t : rr;
|
|
1123
1146
|
}
|
|
1124
|
-
function
|
|
1125
|
-
let n =
|
|
1147
|
+
function ar(e, t) {
|
|
1148
|
+
let n = ir(e);
|
|
1126
1149
|
return t && n.includes(t) ? t : n.includes("solid") ? "solid" : n[0] ?? "solid";
|
|
1127
1150
|
}
|
|
1128
|
-
function
|
|
1129
|
-
let n =
|
|
1151
|
+
function or(e, t) {
|
|
1152
|
+
let n = ir(t), r = (e) => e.kind === "redact" && !n.includes(e.mode ?? "solid");
|
|
1130
1153
|
return e.annotations.some(r) ? {
|
|
1131
1154
|
...e,
|
|
1132
1155
|
annotations: e.annotations.map((e) => e.kind === "redact" && r(e) ? {
|
|
1133
1156
|
...e,
|
|
1134
|
-
mode:
|
|
1157
|
+
mode: ar(n, e.mode)
|
|
1135
1158
|
} : e)
|
|
1136
1159
|
} : e;
|
|
1137
1160
|
}
|
|
1138
|
-
function
|
|
1161
|
+
function sr(e) {
|
|
1139
1162
|
return /^#[0-9a-f]{6}$/i.test(e) || /^#[0-9a-f]{3}$/i.test(e) ? e : "#000000";
|
|
1140
1163
|
}
|
|
1141
|
-
function
|
|
1164
|
+
function cr(e, t, n) {
|
|
1142
1165
|
let r = e.getTransform(), i = r.transformPoint({
|
|
1143
1166
|
x: t.x * n.width,
|
|
1144
1167
|
y: t.y * n.height
|
|
@@ -1148,7 +1171,7 @@ function ur(e, t, n) {
|
|
|
1148
1171
|
}), o = Math.min(i.x, a.x), s = Math.min(i.y, a.y), c = Math.max(i.x, a.x), l = Math.max(i.y, a.y), u = t.mode !== "pixelate", [d, f] = u ? [Math.floor, Math.ceil] : [Math.round, Math.round], p = d(o), m = d(s), h = f(c) - p, g = f(l) - m;
|
|
1149
1172
|
if (h < 1 || g < 1) return;
|
|
1150
1173
|
if (u) {
|
|
1151
|
-
e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.globalAlpha = 1, e.globalCompositeOperation = "source-over", e.fillStyle =
|
|
1174
|
+
e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.globalAlpha = 1, e.globalCompositeOperation = "source-over", e.fillStyle = sr(t.color), e.fillRect(p, m, h, g), e.restore();
|
|
1152
1175
|
return;
|
|
1153
1176
|
}
|
|
1154
1177
|
let _ = Math.max(6, Math.round(Math.min(e.canvas.width, e.canvas.height) / 48)), v = document.createElement("canvas");
|
|
@@ -1156,14 +1179,14 @@ function ur(e, t, n) {
|
|
|
1156
1179
|
}
|
|
1157
1180
|
//#endregion
|
|
1158
1181
|
//#region lib/components/ui/media/image-editor/image-editor.draw.ts
|
|
1159
|
-
var
|
|
1160
|
-
function
|
|
1182
|
+
var lr = "600 {size}px Inter, \"Segoe UI\", system-ui, sans-serif";
|
|
1183
|
+
function ur(e) {
|
|
1161
1184
|
let t = e.replace("#", ""), n = t.length === 3 ? t.replace(/./g, (e) => e + e) : t, r = Number.parseInt(n.slice(0, 6), 16);
|
|
1162
1185
|
if (Number.isNaN(r)) return !1;
|
|
1163
1186
|
let i = r >> 16 & 255, a = r >> 8 & 255, o = r & 255;
|
|
1164
1187
|
return .299 * i + .587 * a + .114 * o > 160;
|
|
1165
1188
|
}
|
|
1166
|
-
function
|
|
1189
|
+
function dr(e, t, n) {
|
|
1167
1190
|
let r = (e) => [(t[e * 2] ?? 0) * n.width, (t[e * 2 + 1] ?? 0) * n.height], i = Math.floor(t.length / 2), [a, o] = r(0);
|
|
1168
1191
|
e.beginPath(), e.moveTo(a, o), i === 1 && e.lineTo(a + .01, o);
|
|
1169
1192
|
for (let t = 1; t < i - 1; t++) {
|
|
@@ -1172,24 +1195,28 @@ function pr(e, t, n) {
|
|
|
1172
1195
|
}
|
|
1173
1196
|
i > 1 && e.lineTo(...r(i - 1)), e.stroke();
|
|
1174
1197
|
}
|
|
1175
|
-
function
|
|
1198
|
+
function fr(e, t, n, r, i, a) {
|
|
1176
1199
|
let o = Math.atan2(i - n, r - t), s = Math.max(a * 3.6, 12);
|
|
1177
1200
|
e.beginPath(), e.moveTo(r, i), e.lineTo(r - s * Math.cos(o - .45), i - s * Math.sin(o - .45)), e.lineTo(r - s * Math.cos(o + .45), i - s * Math.sin(o + .45)), e.closePath(), e.fill();
|
|
1178
1201
|
}
|
|
1179
|
-
function
|
|
1180
|
-
let r =
|
|
1181
|
-
e.font =
|
|
1202
|
+
function pr(e, t, n) {
|
|
1203
|
+
let r = Un(t.size, n), i = Wn(t, n), a = t.x * n.width, o = t.y * n.height;
|
|
1204
|
+
e.font = lr.replace("{size}", String(r)), e.textBaseline = "top", t.background && (e.fillStyle = ur(t.color) ? "rgba(17,24,39,0.82)" : "rgba(255,255,255,0.9)", e.beginPath(), e.roundRect(a, o, i.w * n.width, i.h * n.height, r * .3), e.fill()), e.fillStyle = t.color, t.text.split("\n").forEach((t, n) => {
|
|
1182
1205
|
e.fillText(t, a + r * .4, o + r * .2 + n * r * 1.25);
|
|
1183
1206
|
});
|
|
1184
1207
|
}
|
|
1185
|
-
function
|
|
1208
|
+
function mr(e, t, n) {
|
|
1209
|
+
let r = Bn(t.size, n), i = ur(t.color), a = t.x * n.width, o = t.y * n.height;
|
|
1210
|
+
e.beginPath(), e.arc(a, o, r / 2, 0, Math.PI * 2), e.fillStyle = t.color, e.fill(), e.lineWidth = Math.max(1.5, r * .07), e.strokeStyle = i ? "rgba(17,24,39,0.85)" : "rgba(255,255,255,0.95)", e.stroke(), e.font = lr.replace("{size}", String(r * (t.n > 9 ? .45 : .55))), e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = i ? "#111827" : "#ffffff", e.fillText(String(t.n), a, o + r * .03);
|
|
1211
|
+
}
|
|
1212
|
+
function hr(e, t, n) {
|
|
1186
1213
|
let r = t.size * Math.min(n.width, n.height);
|
|
1187
1214
|
switch (e.save(), e.lineCap = "round", e.lineJoin = "round", e.strokeStyle = t.color, e.fillStyle = t.color, e.lineWidth = r, t.kind) {
|
|
1188
1215
|
case "pen":
|
|
1189
|
-
|
|
1216
|
+
dr(e, t.points, n);
|
|
1190
1217
|
break;
|
|
1191
1218
|
case "highlighter":
|
|
1192
|
-
e.globalAlpha = .42, e.lineCap = "square", e.lineWidth = r * 2.6,
|
|
1219
|
+
e.globalAlpha = .42, e.lineCap = "square", e.lineWidth = r * 2.6, dr(e, t.points, n);
|
|
1193
1220
|
break;
|
|
1194
1221
|
case "line":
|
|
1195
1222
|
case "arrow": {
|
|
@@ -1199,7 +1226,7 @@ function gr(e, t, n) {
|
|
|
1199
1226
|
t.x2 * n.width,
|
|
1200
1227
|
t.y2 * n.height
|
|
1201
1228
|
];
|
|
1202
|
-
e.beginPath(), e.moveTo(i, a), e.lineTo(o, s), e.stroke(), t.kind === "arrow" &&
|
|
1229
|
+
e.beginPath(), e.moveTo(i, a), e.lineTo(o, s), e.stroke(), t.kind === "arrow" && fr(e, i, a, o, s, r);
|
|
1203
1230
|
break;
|
|
1204
1231
|
}
|
|
1205
1232
|
case "rect":
|
|
@@ -1214,17 +1241,20 @@ function gr(e, t, n) {
|
|
|
1214
1241
|
break;
|
|
1215
1242
|
}
|
|
1216
1243
|
case "text":
|
|
1217
|
-
|
|
1244
|
+
pr(e, t, n);
|
|
1245
|
+
break;
|
|
1246
|
+
case "step":
|
|
1247
|
+
mr(e, t, n);
|
|
1218
1248
|
break;
|
|
1219
1249
|
case "redact":
|
|
1220
|
-
|
|
1250
|
+
cr(e, t, n);
|
|
1221
1251
|
break;
|
|
1222
1252
|
}
|
|
1223
1253
|
e.restore();
|
|
1224
1254
|
}
|
|
1225
1255
|
//#endregion
|
|
1226
1256
|
//#region lib/components/ui/media/image-editor/image-editor.filters.ts
|
|
1227
|
-
var
|
|
1257
|
+
var gr = [
|
|
1228
1258
|
{
|
|
1229
1259
|
id: "none",
|
|
1230
1260
|
label: "Original",
|
|
@@ -1355,7 +1385,7 @@ var _r = [
|
|
|
1355
1385
|
highlights: 10
|
|
1356
1386
|
}
|
|
1357
1387
|
}
|
|
1358
|
-
],
|
|
1388
|
+
], _r = {
|
|
1359
1389
|
hue: [-180, 180],
|
|
1360
1390
|
fade: [0, 100],
|
|
1361
1391
|
sepia: [0, 100],
|
|
@@ -1363,33 +1393,33 @@ var _r = [
|
|
|
1363
1393
|
grain: [0, 100],
|
|
1364
1394
|
blur: [0, 100]
|
|
1365
1395
|
};
|
|
1366
|
-
function
|
|
1367
|
-
let [n, r] =
|
|
1396
|
+
function vr(e, t) {
|
|
1397
|
+
let [n, r] = _r[e] ?? [-100, 100];
|
|
1368
1398
|
return Math.min(r, Math.max(n, t));
|
|
1369
1399
|
}
|
|
1370
|
-
function
|
|
1371
|
-
return
|
|
1400
|
+
function yr(e) {
|
|
1401
|
+
return gr.find((t) => t.id === e);
|
|
1372
1402
|
}
|
|
1373
|
-
function
|
|
1374
|
-
let n =
|
|
1375
|
-
for (let t of Object.keys(i)) i[t] =
|
|
1403
|
+
function br(e, t = e.filter) {
|
|
1404
|
+
let n = yr(t)?.adjustments ?? {}, r = Math.min(1, Math.max(0, e.filterIntensity / 100)), i = { ...B };
|
|
1405
|
+
for (let t of Object.keys(i)) i[t] = vr(t, e.adjustments[t] + (n[t] ?? 0) * r);
|
|
1376
1406
|
return i;
|
|
1377
1407
|
}
|
|
1378
|
-
function
|
|
1408
|
+
function xr(e) {
|
|
1379
1409
|
return Object.values(e).every((e) => e === 0);
|
|
1380
1410
|
}
|
|
1381
1411
|
//#endregion
|
|
1382
1412
|
//#region lib/components/ui/media/image-editor/image-editor.pixels.ts
|
|
1383
|
-
var
|
|
1384
|
-
function
|
|
1413
|
+
var Sr = (e) => e < 0 ? 0 : e > 255 ? 255 : e;
|
|
1414
|
+
function Cr(e) {
|
|
1385
1415
|
let t = /* @__PURE__ */ new Uint8ClampedArray(256), n = 2 ** (e.exposure / 100), r = e.brightness / 100 * 96, i = e.contrast * 2.55, a = 259 * (i + 255) / (255 * (259 - i)), o = e.fade / 100 * .32;
|
|
1386
1416
|
for (let e = 0; e < 256; e++) {
|
|
1387
1417
|
let i = e * n + r;
|
|
1388
|
-
i = a * (i - 128) + 128, i = i * (1 - o) + 255 * o * .42, t[e] =
|
|
1418
|
+
i = a * (i - 128) + 128, i = i * (1 - o) + 255 * o * .42, t[e] = Sr(i);
|
|
1389
1419
|
}
|
|
1390
1420
|
return t;
|
|
1391
1421
|
}
|
|
1392
|
-
function
|
|
1422
|
+
function wr(e) {
|
|
1393
1423
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
1394
1424
|
return [
|
|
1395
1425
|
.213 + n * .787 - r * .213,
|
|
@@ -1403,100 +1433,103 @@ function Tr(e) {
|
|
|
1403
1433
|
.072 + n * .928 + r * .072
|
|
1404
1434
|
];
|
|
1405
1435
|
}
|
|
1406
|
-
function
|
|
1436
|
+
function Tr(e) {
|
|
1407
1437
|
let t = e + 2654435769 | 0;
|
|
1408
1438
|
return t = Math.imul(t ^ t >>> 16, 2246822507), t = Math.imul(t ^ t >>> 13, 3266489909), t ^= t >>> 16, (t >>> 0) / 4294967296 - .5;
|
|
1409
1439
|
}
|
|
1410
|
-
var
|
|
1411
|
-
function
|
|
1440
|
+
var Er = (e, t, n) => .2126 * e + .7152 * t + .0722 * n;
|
|
1441
|
+
function Dr(e, t, n) {
|
|
1412
1442
|
if (t === 0 && n === 0) return;
|
|
1413
|
-
let r =
|
|
1443
|
+
let r = Er(e[0], e[1], e[2]) / 255, i = n / 100 * 110 * (1 - r) ** 2 + t / 100 * 110 * r ** 2;
|
|
1414
1444
|
e[0] += i, e[1] += i, e[2] += i;
|
|
1415
1445
|
}
|
|
1416
|
-
function
|
|
1446
|
+
function Or(e, t, n) {
|
|
1417
1447
|
if (t.warmth !== 0 && (e[0] += t.warmth / 100 * 38, e[1] += t.warmth / 100 * 8, e[2] -= t.warmth / 100 * 38), t.tint !== 0 && (e[0] += t.tint / 100 * 18, e[1] -= t.tint / 100 * 32, e[2] += t.tint / 100 * 18), n) {
|
|
1418
1448
|
let [t, r, i] = e;
|
|
1419
1449
|
e[0] = n[0] * t + n[1] * r + n[2] * i, e[1] = n[3] * t + n[4] * r + n[5] * i, e[2] = n[6] * t + n[7] * r + n[8] * i;
|
|
1420
1450
|
}
|
|
1421
1451
|
}
|
|
1422
|
-
function
|
|
1452
|
+
function kr(e, t) {
|
|
1423
1453
|
if (t.saturation === 0 && t.vibrance === 0) return;
|
|
1424
|
-
let n =
|
|
1454
|
+
let n = Er(e[0], e[1], e[2]), r = Math.max(e[0], e[1], e[2]), i = Math.min(e[0], e[1], e[2]), a = r <= 0 ? 0 : (r - i) / Math.max(r, 1), o = t.vibrance / 100 * (1 - a) * 1.4, s = Math.max(0, 1 + t.saturation / 100 + o);
|
|
1425
1455
|
e[0] = n + (e[0] - n) * s, e[1] = n + (e[1] - n) * s, e[2] = n + (e[2] - n) * s;
|
|
1426
1456
|
}
|
|
1427
|
-
function
|
|
1457
|
+
function Ar(e, t) {
|
|
1428
1458
|
if (t === 0) return;
|
|
1429
1459
|
let n = t / 100, [r, i, a] = e;
|
|
1430
1460
|
e[0] = r * (1 - n) + n * (.393 * r + .769 * i + .189 * a), e[1] = i * (1 - n) + n * (.349 * r + .686 * i + .168 * a), e[2] = a * (1 - n) + n * (.272 * r + .534 * i + .131 * a);
|
|
1431
1461
|
}
|
|
1432
|
-
function
|
|
1462
|
+
function jr(e, t, n, r, i) {
|
|
1433
1463
|
let a = ((e + .5) / n - .5) * 2, o = ((t + .5) / r - .5) * 2, s = Math.sqrt(a * a + o * o) / Math.SQRT2, c = Math.min(1, Math.max(0, (s - .3) / .75));
|
|
1434
1464
|
return 1 - i / 100 * .85 * c * c * (3 - 2 * c);
|
|
1435
1465
|
}
|
|
1436
|
-
function
|
|
1437
|
-
let { data: n, width: r, height: i } = e, a =
|
|
1466
|
+
function Mr(e, t) {
|
|
1467
|
+
let { data: n, width: r, height: i } = e, a = Cr(t), o = t.hue === 0 ? null : wr(t.hue), s = t.grain / 100 * 70, c = [
|
|
1438
1468
|
0,
|
|
1439
1469
|
0,
|
|
1440
1470
|
0
|
|
1441
1471
|
];
|
|
1442
1472
|
for (let e = 0, l = 0; l < n.length; l += 4, e++) {
|
|
1443
|
-
c[0] = a[n[l] ?? 0] ?? 0, c[1] = a[n[l + 1] ?? 0] ?? 0, c[2] = a[n[l + 2] ?? 0] ?? 0,
|
|
1473
|
+
c[0] = a[n[l] ?? 0] ?? 0, c[1] = a[n[l + 1] ?? 0] ?? 0, c[2] = a[n[l + 2] ?? 0] ?? 0, Dr(c, t.highlights, t.shadows), Or(c, t, o), kr(c, t), Ar(c, t.sepia);
|
|
1444
1474
|
let u = 1;
|
|
1445
|
-
t.vignette > 0 && (u =
|
|
1446
|
-
let d = s > 0 ?
|
|
1447
|
-
n[l] =
|
|
1475
|
+
t.vignette > 0 && (u = jr(e % r, Math.floor(e / r), r, i, t.vignette));
|
|
1476
|
+
let d = s > 0 ? Tr(e) * s : 0;
|
|
1477
|
+
n[l] = Sr(c[0] * u + d), n[l + 1] = Sr(c[1] * u + d), n[l + 2] = Sr(c[2] * u + d);
|
|
1448
1478
|
}
|
|
1449
1479
|
}
|
|
1450
1480
|
//#endregion
|
|
1451
1481
|
//#region lib/components/ui/media/image-editor/image-editor.render.ts
|
|
1452
|
-
function
|
|
1453
|
-
let r = K(t, n.quarterTurns), i =
|
|
1482
|
+
function Nr(e, t, n) {
|
|
1483
|
+
let r = K(t, n.quarterTurns), i = kn(r.width, r.height, n.straighten);
|
|
1454
1484
|
e.translate(r.width / 2, r.height / 2), e.rotate(n.straighten * Math.PI / 180), e.scale(i * (n.flipX ? -1 : 1), i * (n.flipY ? -1 : 1)), e.rotate(n.quarterTurns * Math.PI / 2), e.drawImage(t.image, -t.width / 2, -t.height / 2, t.width, t.height);
|
|
1455
1485
|
}
|
|
1456
|
-
var
|
|
1486
|
+
var Pr = {
|
|
1457
1487
|
x: 0,
|
|
1458
1488
|
y: 0,
|
|
1459
1489
|
w: 1,
|
|
1460
1490
|
h: 1
|
|
1461
1491
|
};
|
|
1462
|
-
function
|
|
1463
|
-
let r = K(e, t.transform.quarterTurns), i = n.region === "crop" ? t.crop :
|
|
1492
|
+
function Fr(e, t, n) {
|
|
1493
|
+
let r = K(e, t.transform.quarterTurns), i = n.region === "crop" ? t.crop : Pr;
|
|
1464
1494
|
return {
|
|
1465
1495
|
width: Math.max(1, Math.round(i.w * r.width * n.scale)),
|
|
1466
1496
|
height: Math.max(1, Math.round(i.h * r.height * n.scale))
|
|
1467
1497
|
};
|
|
1468
1498
|
}
|
|
1469
|
-
function
|
|
1499
|
+
function Ir(e, t) {
|
|
1470
1500
|
let { width: n, height: r } = e.canvas, i = e.getImageData(0, 0, n, r);
|
|
1471
|
-
|
|
1501
|
+
Mr(i, t), e.putImageData(i, 0, 0);
|
|
1472
1502
|
}
|
|
1473
|
-
function
|
|
1474
|
-
let i = K(t, n.transform.quarterTurns), a = r.region === "crop" ? n.crop :
|
|
1503
|
+
function Lr(e, t, n, r) {
|
|
1504
|
+
let i = K(t, n.transform.quarterTurns), a = r.region === "crop" ? n.crop : Pr;
|
|
1475
1505
|
return e.setTransform(r.scale, 0, 0, r.scale, 0, 0), e.translate(-a.x * i.width, -a.y * i.height), i;
|
|
1476
1506
|
}
|
|
1477
|
-
function
|
|
1507
|
+
function Rr(e, t, n, r) {
|
|
1478
1508
|
if (n.annotations.length === 0) return;
|
|
1479
1509
|
e.save();
|
|
1480
|
-
let i =
|
|
1481
|
-
|
|
1510
|
+
let i = {
|
|
1511
|
+
...Lr(e, t, n, r),
|
|
1512
|
+
stepFloor: r.stepFloor
|
|
1513
|
+
};
|
|
1514
|
+
for (let t of n.annotations) hr(e, t, i);
|
|
1482
1515
|
e.restore();
|
|
1483
1516
|
}
|
|
1484
|
-
function
|
|
1485
|
-
let r = n.edited ?? !0, i =
|
|
1517
|
+
function zr(e, t, n) {
|
|
1518
|
+
let r = n.edited ?? !0, i = Fr(e, t, n), a = n.target ?? document.createElement("canvas");
|
|
1486
1519
|
a.width = i.width, a.height = i.height;
|
|
1487
1520
|
let o = a.getContext("2d", { willReadFrequently: !0 });
|
|
1488
1521
|
if (!o) return a;
|
|
1489
|
-
let s =
|
|
1490
|
-
if (o.save(), o.imageSmoothingQuality = "high",
|
|
1522
|
+
let s = br(t, n.filter);
|
|
1523
|
+
if (o.save(), o.imageSmoothingQuality = "high", Lr(o, e, t, n), r && s.blur > 0 && "filter" in o) {
|
|
1491
1524
|
let e = Math.min(i.width, i.height);
|
|
1492
1525
|
o.filter = `blur(${(s.blur / 100 * .012 * e).toFixed(2)}px)`;
|
|
1493
1526
|
}
|
|
1494
|
-
return
|
|
1527
|
+
return Nr(o, e, t.transform), o.restore(), r && !xr({
|
|
1495
1528
|
...s,
|
|
1496
1529
|
blur: 0
|
|
1497
|
-
}) &&
|
|
1530
|
+
}) && Ir(o, s), r && (n.marks ?? !0) && Rr(o, e, t, n), a;
|
|
1498
1531
|
}
|
|
1499
|
-
function
|
|
1532
|
+
function Br(e, t) {
|
|
1500
1533
|
let n = Math.min(1, t / Math.max(e.width, e.height));
|
|
1501
1534
|
if (n === 1) return e;
|
|
1502
1535
|
let r = document.createElement("canvas");
|
|
@@ -1508,7 +1541,7 @@ function Vr(e, t) {
|
|
|
1508
1541
|
height: r.height
|
|
1509
1542
|
};
|
|
1510
1543
|
}
|
|
1511
|
-
function
|
|
1544
|
+
function Vr(e) {
|
|
1512
1545
|
try {
|
|
1513
1546
|
let t = document.createElement("canvas");
|
|
1514
1547
|
t.width = 1, t.height = 1;
|
|
@@ -1520,12 +1553,12 @@ function Hr(e) {
|
|
|
1520
1553
|
}
|
|
1521
1554
|
//#endregion
|
|
1522
1555
|
//#region lib/components/ui/media/image-editor/use-sample-pixels.ts
|
|
1523
|
-
var
|
|
1524
|
-
function
|
|
1525
|
-
return A(() => e ?
|
|
1556
|
+
var Hr = 200;
|
|
1557
|
+
function Ur(e) {
|
|
1558
|
+
return A(() => e ? Br(e, Hr) : null, [e]);
|
|
1526
1559
|
}
|
|
1527
|
-
function
|
|
1528
|
-
let r =
|
|
1560
|
+
function Wr(e, t, n = !0) {
|
|
1561
|
+
let r = zr(e, t, {
|
|
1529
1562
|
scale: 1,
|
|
1530
1563
|
region: "crop",
|
|
1531
1564
|
edited: n,
|
|
@@ -1533,17 +1566,17 @@ function Gr(e, t, n = !0) {
|
|
|
1533
1566
|
}), i = r.getContext("2d", { willReadFrequently: !0 });
|
|
1534
1567
|
return i ? i.getImageData(0, 0, r.width, r.height) : null;
|
|
1535
1568
|
}
|
|
1536
|
-
function
|
|
1569
|
+
function Gr(e, t) {
|
|
1537
1570
|
let [n, r] = M(null);
|
|
1538
1571
|
return O(() => {
|
|
1539
1572
|
if (!e) return;
|
|
1540
|
-
let n = requestAnimationFrame(() => r(
|
|
1573
|
+
let n = requestAnimationFrame(() => r(Wr(e, t)));
|
|
1541
1574
|
return () => cancelAnimationFrame(n);
|
|
1542
1575
|
}, [e, t]), n;
|
|
1543
1576
|
}
|
|
1544
1577
|
//#endregion
|
|
1545
1578
|
//#region lib/components/ui/media/image-editor/partials/adjust-tracks.ts
|
|
1546
|
-
var Z = "[&>[data-slot=slider-range]]:hidden",
|
|
1579
|
+
var Z = "[&>[data-slot=slider-range]]:hidden", Kr = {
|
|
1547
1580
|
exposure: `bg-linear-to-r from-zinc-900 via-zinc-500 to-zinc-50 ${Z}`,
|
|
1548
1581
|
brightness: `bg-linear-to-r from-zinc-800 via-zinc-500 to-zinc-100 ${Z}`,
|
|
1549
1582
|
warmth: `bg-linear-to-r from-sky-500 via-zinc-300 to-amber-400 ${Z}`,
|
|
@@ -1554,14 +1587,14 @@ var Z = "[&>[data-slot=slider-range]]:hidden", qr = {
|
|
|
1554
1587
|
};
|
|
1555
1588
|
//#endregion
|
|
1556
1589
|
//#region lib/components/ui/fields/slider/slider-math.ts
|
|
1557
|
-
function
|
|
1590
|
+
function qr(e, t, n) {
|
|
1558
1591
|
let r = n - t || 1;
|
|
1559
1592
|
return Math.min(100, Math.max(0, (e - t) / r * 100));
|
|
1560
1593
|
}
|
|
1561
|
-
function
|
|
1594
|
+
function Jr(e, t) {
|
|
1562
1595
|
return Array.isArray(e) ? e : [t];
|
|
1563
1596
|
}
|
|
1564
|
-
function
|
|
1597
|
+
function Yr({ thumbs: e, min: t, origin: n, vertical: r }) {
|
|
1565
1598
|
let i = e[0] ?? t, a = e[e.length - 1] ?? t, o = n !== void 0 && e.length === 1 && !r, [s, c] = o ? [Math.min(n, i), Math.max(n, i)] : [e.length > 1 ? i : t, a];
|
|
1566
1599
|
return {
|
|
1567
1600
|
fromOrigin: o,
|
|
@@ -1569,13 +1602,13 @@ function Xr({ thumbs: e, min: t, origin: n, vertical: r }) {
|
|
|
1569
1602
|
to: c
|
|
1570
1603
|
};
|
|
1571
1604
|
}
|
|
1572
|
-
function
|
|
1605
|
+
function Xr(e, t) {
|
|
1573
1606
|
return t ? 100 - e : e;
|
|
1574
1607
|
}
|
|
1575
1608
|
//#endregion
|
|
1576
1609
|
//#region lib/components/ui/fields/slider/slider-thumb.tsx
|
|
1577
|
-
function
|
|
1578
|
-
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
1610
|
+
function Zr({ index: e, bubble: t, ...n }) {
|
|
1611
|
+
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(Ut, {
|
|
1579
1612
|
"data-slot": "slider-thumb",
|
|
1580
1613
|
"data-index": e,
|
|
1581
1614
|
"data-nxgt-state-layer": "",
|
|
@@ -1589,12 +1622,12 @@ function Qr({ index: e, bubble: t, ...n }) {
|
|
|
1589
1622
|
}
|
|
1590
1623
|
//#endregion
|
|
1591
1624
|
//#region lib/components/ui/fields/slider/slider-thumbs.tsx
|
|
1592
|
-
var
|
|
1593
|
-
function
|
|
1594
|
-
return e.map((p, m) => /* @__PURE__ */ P(
|
|
1625
|
+
var Qr = "block shrink-0 cursor-pointer forced-colors:focus-visible:outline-solid forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-offset-2 forced-colors:focus-visible:outline-[Highlight]";
|
|
1626
|
+
function $r({ thumbs: e, min: t, max: n, inverted: r, shown: i, valueBubble: a, formatValue: o, thumbId: s, nameIds: c, name: l, required: u, invalid: d, describedBy: f }) {
|
|
1627
|
+
return e.map((p, m) => /* @__PURE__ */ P(Zr, {
|
|
1595
1628
|
index: m,
|
|
1596
1629
|
bubble: a && i === m ? {
|
|
1597
|
-
at:
|
|
1630
|
+
at: Xr(qr(p, t, n), r),
|
|
1598
1631
|
text: o(p)
|
|
1599
1632
|
} : null,
|
|
1600
1633
|
id: `${s}-${m}`,
|
|
@@ -1603,12 +1636,12 @@ function ei({ thumbs: e, min: t, max: n, inverted: r, shown: i, valueBubble: a,
|
|
|
1603
1636
|
"aria-invalid": d || void 0,
|
|
1604
1637
|
"aria-describedby": f,
|
|
1605
1638
|
"data-pw": l ? `${l}-thumb-${m}` : "slider-thumb",
|
|
1606
|
-
className:
|
|
1639
|
+
className: Qr
|
|
1607
1640
|
}, `item-${m.toString()}`));
|
|
1608
1641
|
}
|
|
1609
1642
|
//#endregion
|
|
1610
1643
|
//#region lib/components/ui/fields/slider/slider-icon.tsx
|
|
1611
|
-
function
|
|
1644
|
+
function ei({ children: e }) {
|
|
1612
1645
|
return /* @__PURE__ */ P("span", {
|
|
1613
1646
|
"data-slot": "slider-icon-area",
|
|
1614
1647
|
"aria-hidden": "true",
|
|
@@ -1620,8 +1653,8 @@ function ti({ children: e }) {
|
|
|
1620
1653
|
}
|
|
1621
1654
|
//#endregion
|
|
1622
1655
|
//#region lib/components/ui/fields/slider/slider-origin-range.tsx
|
|
1623
|
-
function
|
|
1624
|
-
return /* @__PURE__ */ P(
|
|
1656
|
+
function ti({ from: e, to: t }) {
|
|
1657
|
+
return /* @__PURE__ */ P(w, {
|
|
1625
1658
|
reason: "The origin range is placed by an inline style",
|
|
1626
1659
|
children: /* @__PURE__ */ P("span", {
|
|
1627
1660
|
"data-slot": "slider-range",
|
|
@@ -1636,7 +1669,7 @@ function ni({ from: e, to: t }) {
|
|
|
1636
1669
|
}
|
|
1637
1670
|
//#endregion
|
|
1638
1671
|
//#region lib/components/ui/fields/slider/slider-stops.tsx
|
|
1639
|
-
function
|
|
1672
|
+
function ni({ marks: e, isOn: t }) {
|
|
1640
1673
|
return /* @__PURE__ */ P("span", {
|
|
1641
1674
|
"data-slot": "slider-stops",
|
|
1642
1675
|
"aria-hidden": "true",
|
|
@@ -1648,22 +1681,22 @@ function ri({ marks: e, isOn: t }) {
|
|
|
1648
1681
|
}
|
|
1649
1682
|
//#endregion
|
|
1650
1683
|
//#region lib/components/ui/fields/slider/slider-track.tsx
|
|
1651
|
-
function
|
|
1684
|
+
function ri({ className: e, min: t, max: n, fill: r, marks: i, icon: a }) {
|
|
1652
1685
|
let { fromOrigin: o, from: s, to: c } = r;
|
|
1653
|
-
return /* @__PURE__ */ F(
|
|
1686
|
+
return /* @__PURE__ */ F(Pt, {
|
|
1654
1687
|
"data-slot": "slider-track",
|
|
1655
1688
|
className: T("relative grow cursor-pointer", e),
|
|
1656
1689
|
children: [
|
|
1657
|
-
/* @__PURE__ */ P(
|
|
1690
|
+
/* @__PURE__ */ P(It, {
|
|
1658
1691
|
"data-slot": "slider-range",
|
|
1659
1692
|
className: T("absolute", o && "hidden")
|
|
1660
1693
|
}),
|
|
1661
|
-
o && /* @__PURE__ */ P(
|
|
1662
|
-
from:
|
|
1663
|
-
to:
|
|
1694
|
+
o && /* @__PURE__ */ P(ti, {
|
|
1695
|
+
from: qr(s, t, n),
|
|
1696
|
+
to: qr(c, t, n)
|
|
1664
1697
|
}),
|
|
1665
|
-
a != null && /* @__PURE__ */ P(
|
|
1666
|
-
i.length > 0 && /* @__PURE__ */ P(
|
|
1698
|
+
a != null && /* @__PURE__ */ P(ei, { children: a }),
|
|
1699
|
+
i.length > 0 && /* @__PURE__ */ P(ni, {
|
|
1667
1700
|
marks: i,
|
|
1668
1701
|
isOn: (e) => e >= s && e <= c
|
|
1669
1702
|
})
|
|
@@ -1672,7 +1705,7 @@ function ii({ className: e, min: t, max: n, fill: r, marks: i, icon: a }) {
|
|
|
1672
1705
|
}
|
|
1673
1706
|
//#endregion
|
|
1674
1707
|
//#region lib/components/ui/fields/slider/slider-thumb-names.ts
|
|
1675
|
-
function
|
|
1708
|
+
function ii({ thumbId: e, labelId: t, ariaLabel: n, ariaLabelledBy: r, hiddenLabel: i }) {
|
|
1676
1709
|
let a = r ? void 0 : n || i, o = a ? `${e}-name` : void 0;
|
|
1677
1710
|
return {
|
|
1678
1711
|
nameIds: r || o || t,
|
|
@@ -1682,7 +1715,7 @@ function ai({ thumbId: e, labelId: t, ariaLabel: n, ariaLabelledBy: r, hiddenLab
|
|
|
1682
1715
|
}
|
|
1683
1716
|
//#endregion
|
|
1684
1717
|
//#region lib/components/ui/fields/slider/split-slider-props.ts
|
|
1685
|
-
function
|
|
1718
|
+
function ai({ defaultValue: e, value: t, min: n = 0, max: r = 100, step: i, ticks: a = !1, required: o, labelId: s, hiddenLabel: c, origin: l, trackClassName: u, formatValue: d = String, valueBubble: f = !0, size: p = "default", icon: m, inverted: h = !1, onValueChange: g, className: _, "aria-label": v, "aria-labelledby": y, "aria-invalid": b, "aria-describedby": x, onPointerDown: ee, onFocus: te, onBlur: S, ...ne }) {
|
|
1686
1719
|
return {
|
|
1687
1720
|
own: {
|
|
1688
1721
|
defaultValue: e,
|
|
@@ -1711,18 +1744,18 @@ function oi({ defaultValue: e, value: t, min: n = 0, max: r = 100, step: i, tick
|
|
|
1711
1744
|
describedBy: x
|
|
1712
1745
|
},
|
|
1713
1746
|
handlers: {
|
|
1714
|
-
onPointerDown:
|
|
1715
|
-
onFocus:
|
|
1716
|
-
onBlur:
|
|
1747
|
+
onPointerDown: ee,
|
|
1748
|
+
onFocus: te,
|
|
1749
|
+
onBlur: S
|
|
1717
1750
|
},
|
|
1718
1751
|
rest: ne
|
|
1719
1752
|
};
|
|
1720
1753
|
}
|
|
1721
1754
|
//#endregion
|
|
1722
1755
|
//#region lib/components/ui/fields/slider/use-slider-chrome.ts
|
|
1723
|
-
function
|
|
1756
|
+
function oi({ percents: e, disabled: t, handlers: n }) {
|
|
1724
1757
|
let r = j(null), [i, a] = M(!1), [o, s] = M(null), c = e.join(",");
|
|
1725
|
-
|
|
1758
|
+
he(() => {
|
|
1726
1759
|
let e = r.current;
|
|
1727
1760
|
if (!e) return;
|
|
1728
1761
|
let t = c.split(",").map(Number), n = (t, n) => n === void 0 ? e.style.removeProperty(t) : e.style.setProperty(t, String(n));
|
|
@@ -1759,17 +1792,17 @@ function si({ percents: e, disabled: t, handlers: n }) {
|
|
|
1759
1792
|
}
|
|
1760
1793
|
//#endregion
|
|
1761
1794
|
//#region lib/components/ui/fields/slider/use-slider-model.ts
|
|
1762
|
-
function
|
|
1763
|
-
let [d, f] = M(() =>
|
|
1795
|
+
function si({ defaultValue: e, value: t, min: n, max: r, step: i, ticks: a, origin: o, vertical: s, disabled: c, handlers: l, onValueChange: u }) {
|
|
1796
|
+
let [d, f] = M(() => Jr(e, n)), p = Array.isArray(t) ? t : d;
|
|
1764
1797
|
return {
|
|
1765
1798
|
thumbs: p,
|
|
1766
|
-
chrome:
|
|
1767
|
-
percents: p.map((e) =>
|
|
1799
|
+
chrome: oi({
|
|
1800
|
+
percents: p.map((e) => qr(e, n, r)),
|
|
1768
1801
|
disabled: c,
|
|
1769
1802
|
handlers: l
|
|
1770
1803
|
}),
|
|
1771
|
-
marks:
|
|
1772
|
-
fill:
|
|
1804
|
+
marks: it(n, r, a, i),
|
|
1805
|
+
fill: Yr({
|
|
1773
1806
|
thumbs: p,
|
|
1774
1807
|
min: n,
|
|
1775
1808
|
origin: o,
|
|
@@ -1782,14 +1815,14 @@ function ci({ defaultValue: e, value: t, min: n, max: r, step: i, ticks: a, orig
|
|
|
1782
1815
|
}
|
|
1783
1816
|
//#endregion
|
|
1784
1817
|
//#region lib/components/ui/fields/slider/use-slider-control.ts
|
|
1785
|
-
function
|
|
1786
|
-
let { own: t, aria: n, handlers: r, rest: i } =
|
|
1818
|
+
function ci(e) {
|
|
1819
|
+
let { own: t, aria: n, handlers: r, rest: i } = ai(e), { min: a, max: o, inverted: s } = t, c = k(), l = ii({
|
|
1787
1820
|
thumbId: c,
|
|
1788
1821
|
labelId: t.labelId,
|
|
1789
1822
|
ariaLabel: n.label,
|
|
1790
1823
|
ariaLabelledBy: n.labelledBy,
|
|
1791
1824
|
hiddenLabel: t.hiddenLabel
|
|
1792
|
-
}), u =
|
|
1825
|
+
}), u = si({
|
|
1793
1826
|
...t,
|
|
1794
1827
|
step: typeof t.step == "number" ? t.step : void 0,
|
|
1795
1828
|
vertical: i.orientation === "vertical",
|
|
@@ -1843,18 +1876,18 @@ function li(e) {
|
|
|
1843
1876
|
}
|
|
1844
1877
|
//#endregion
|
|
1845
1878
|
//#region lib/components/ui/fields/slider/slider-control.tsx
|
|
1846
|
-
var
|
|
1847
|
-
function
|
|
1848
|
-
let { wrap: t, nameText: n, nameTextId: r, rootProps: i, trackProps: a, thumbsProps: o } =
|
|
1879
|
+
var li = "relative flex w-full touch-none select-none items-center data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col";
|
|
1880
|
+
function ui(e) {
|
|
1881
|
+
let { wrap: t, nameText: n, nameTextId: r, rootProps: i, trackProps: a, thumbsProps: o } = ci(e), { className: s, ...c } = i;
|
|
1849
1882
|
return /* @__PURE__ */ F("div", {
|
|
1850
1883
|
ref: t,
|
|
1851
1884
|
className: "grid w-full gap-1",
|
|
1852
1885
|
"data-slot": "slider-wrap",
|
|
1853
|
-
children: [/* @__PURE__ */ F(
|
|
1886
|
+
children: [/* @__PURE__ */ F(Dt, {
|
|
1854
1887
|
"data-slot": "slider",
|
|
1855
|
-
className: T(
|
|
1888
|
+
className: T(li, s),
|
|
1856
1889
|
...c,
|
|
1857
|
-
children: [/* @__PURE__ */ P(
|
|
1890
|
+
children: [/* @__PURE__ */ P(ri, { ...a }), /* @__PURE__ */ P($r, { ...o })]
|
|
1858
1891
|
}), n && /* @__PURE__ */ P("span", {
|
|
1859
1892
|
id: r,
|
|
1860
1893
|
hidden: !0,
|
|
@@ -1864,7 +1897,7 @@ function di(e) {
|
|
|
1864
1897
|
}
|
|
1865
1898
|
//#endregion
|
|
1866
1899
|
//#region lib/components/ui/media/image-editor/partials/editor-slider.tsx
|
|
1867
|
-
function
|
|
1900
|
+
function di({ label: e, value: t, min: n, max: r, step: i = 1, origin: a = n, format: o = String, trackClassName: s, onChange: c, onCommit: l, onReset: u, ...d }) {
|
|
1868
1901
|
let f = k(), p = t !== a;
|
|
1869
1902
|
return /* @__PURE__ */ F("div", {
|
|
1870
1903
|
"data-slot": d["data-slot"] ?? "image-editor-slider",
|
|
@@ -1882,7 +1915,7 @@ function fi({ label: e, value: t, min: n, max: r, step: i = 1, origin: a = n, fo
|
|
|
1882
1915
|
className: T("min-w-9 rounded-full px-2 py-0.5 text-right text-xs tabular-nums transition-colors", p ? "bg-primary/15 font-semibold text-primary-text" : "text-muted-foreground"),
|
|
1883
1916
|
children: o(t)
|
|
1884
1917
|
})]
|
|
1885
|
-
}), /* @__PURE__ */ P(
|
|
1918
|
+
}), /* @__PURE__ */ P(ui, {
|
|
1886
1919
|
labelId: f,
|
|
1887
1920
|
min: n,
|
|
1888
1921
|
max: r,
|
|
@@ -1895,20 +1928,20 @@ function fi({ label: e, value: t, min: n, max: r, step: i = 1, origin: a = n, fo
|
|
|
1895
1928
|
})]
|
|
1896
1929
|
});
|
|
1897
1930
|
}
|
|
1898
|
-
var
|
|
1931
|
+
var fi = (e) => e > 0 ? `+${e}` : String(e);
|
|
1899
1932
|
//#endregion
|
|
1900
1933
|
//#region lib/components/ui/media/image-editor/partials/editor-adjust-row.tsx
|
|
1901
|
-
function
|
|
1902
|
-
let { state: t, actions: n } =
|
|
1903
|
-
return /* @__PURE__ */ P(
|
|
1934
|
+
function pi({ spec: e }) {
|
|
1935
|
+
let { state: t, actions: n } = R(), { t: r } = i(), a = e.min < 0 ? 0 : e.min;
|
|
1936
|
+
return /* @__PURE__ */ P(di, {
|
|
1904
1937
|
"data-slot": "image-editor-adjust-row",
|
|
1905
1938
|
label: r(`material.image-editor.adjust.${e.key}`, e.label),
|
|
1906
1939
|
value: t.edits.adjustments[e.key],
|
|
1907
1940
|
min: e.min,
|
|
1908
1941
|
max: e.max,
|
|
1909
1942
|
origin: a,
|
|
1910
|
-
format:
|
|
1911
|
-
trackClassName:
|
|
1943
|
+
format: fi,
|
|
1944
|
+
trackClassName: Kr[e.key],
|
|
1912
1945
|
onChange: (t) => n.setAdjustment({
|
|
1913
1946
|
key: e.key,
|
|
1914
1947
|
value: t
|
|
@@ -1924,23 +1957,23 @@ function mi({ spec: e }) {
|
|
|
1924
1957
|
}
|
|
1925
1958
|
//#endregion
|
|
1926
1959
|
//#region lib/components/ui/media/image-editor/partials/editor-histogram.tsx
|
|
1927
|
-
var
|
|
1928
|
-
function
|
|
1929
|
-
let t = Math.sqrt(Math.max(1, ...e)), n =
|
|
1960
|
+
var mi = 256, Q = 64;
|
|
1961
|
+
function hi(e) {
|
|
1962
|
+
let t = Math.sqrt(Math.max(1, ...e)), n = mi / Math.max(1, e.length - 1);
|
|
1930
1963
|
return `M0,${Q} L${e.map((e, r) => {
|
|
1931
1964
|
let i = Q - Math.sqrt(e) / t * (Q - 4);
|
|
1932
1965
|
return `${(r * n).toFixed(1)},${i.toFixed(1)}`;
|
|
1933
|
-
}).join(" L")} L${
|
|
1966
|
+
}).join(" L")} L${mi},${Q} Z`;
|
|
1934
1967
|
}
|
|
1935
|
-
function
|
|
1936
|
-
let { t } = i(), n = k(), r = A(() => e ?
|
|
1968
|
+
function gi({ pixels: e }) {
|
|
1969
|
+
let { t } = i(), n = k(), r = A(() => e ? hi(ln(e)) : null, [e]);
|
|
1937
1970
|
return /* @__PURE__ */ P("div", {
|
|
1938
1971
|
"data-slot": "image-editor-histogram",
|
|
1939
1972
|
className: "relative overflow-hidden rounded-xl border bg-linear-to-b from-muted/40 to-muted/10 p-2",
|
|
1940
1973
|
children: /* @__PURE__ */ F("svg", {
|
|
1941
1974
|
role: "img",
|
|
1942
1975
|
"aria-label": t("material.image-editor.adjust.histogram", "Histogram"),
|
|
1943
|
-
viewBox: `0 0 ${
|
|
1976
|
+
viewBox: `0 0 ${mi} ${Q}`,
|
|
1944
1977
|
preserveAspectRatio: "none",
|
|
1945
1978
|
className: "block h-16 w-full",
|
|
1946
1979
|
children: [
|
|
@@ -1965,8 +1998,8 @@ function _i({ pixels: e }) {
|
|
|
1965
1998
|
.5,
|
|
1966
1999
|
.75
|
|
1967
2000
|
].map((e) => /* @__PURE__ */ P("line", {
|
|
1968
|
-
x1: e *
|
|
1969
|
-
x2: e *
|
|
2001
|
+
x1: e * mi,
|
|
2002
|
+
x2: e * mi,
|
|
1970
2003
|
y1: 0,
|
|
1971
2004
|
y2: Q,
|
|
1972
2005
|
stroke: "currentColor",
|
|
@@ -1986,13 +2019,13 @@ function _i({ pixels: e }) {
|
|
|
1986
2019
|
}
|
|
1987
2020
|
//#endregion
|
|
1988
2021
|
//#region lib/components/ui/media/image-editor/partials/editor-adjust-panel.tsx
|
|
1989
|
-
function
|
|
1990
|
-
let { state: e, actions: t, source: n } =
|
|
2022
|
+
function _i() {
|
|
2023
|
+
let { state: e, actions: t, source: n } = R(), { t: r } = i(), a = Ur(n.status === "ready" ? n.preview : null), o = Gr(a, e.edits), s = nr.selectAdjustedCount(e) > 0;
|
|
1991
2024
|
return /* @__PURE__ */ F(N, { children: [
|
|
1992
|
-
/* @__PURE__ */ P(
|
|
2025
|
+
/* @__PURE__ */ P(gi, { pixels: o }),
|
|
1993
2026
|
/* @__PURE__ */ F("div", {
|
|
1994
2027
|
className: "flex gap-2",
|
|
1995
|
-
children: [/* @__PURE__ */ F(
|
|
2028
|
+
children: [/* @__PURE__ */ F(m, {
|
|
1996
2029
|
variant: "tonal",
|
|
1997
2030
|
color: "primary",
|
|
1998
2031
|
size: "sm",
|
|
@@ -2000,39 +2033,39 @@ function vi() {
|
|
|
2000
2033
|
disabled: !a,
|
|
2001
2034
|
onClick: () => {
|
|
2002
2035
|
if (!a) return;
|
|
2003
|
-
let n =
|
|
2036
|
+
let n = Wr(a, e.edits, !1);
|
|
2004
2037
|
n && (t.endGesture(), t.applyAdjustments({
|
|
2005
2038
|
exposure: 0,
|
|
2006
2039
|
contrast: 0,
|
|
2007
2040
|
highlights: 0,
|
|
2008
2041
|
shadows: 0,
|
|
2009
2042
|
vibrance: 0,
|
|
2010
|
-
...
|
|
2043
|
+
...fn(n)
|
|
2011
2044
|
}));
|
|
2012
2045
|
},
|
|
2013
|
-
children: [/* @__PURE__ */ P(
|
|
2014
|
-
}), /* @__PURE__ */ F(
|
|
2046
|
+
children: [/* @__PURE__ */ P(Ze, { "aria-hidden": "true" }), r("material.image-editor.adjust.auto", "Auto")]
|
|
2047
|
+
}), /* @__PURE__ */ F(m, {
|
|
2015
2048
|
variant: "ghost",
|
|
2016
2049
|
color: "default",
|
|
2017
2050
|
size: "sm",
|
|
2018
2051
|
disabled: !s,
|
|
2019
2052
|
onClick: () => t.resetAdjustments(),
|
|
2020
|
-
children: [/* @__PURE__ */ P(
|
|
2053
|
+
children: [/* @__PURE__ */ P(Be, { "aria-hidden": "true" }), r("material.image-editor.adjust.reset", "Reset")]
|
|
2021
2054
|
})]
|
|
2022
2055
|
}),
|
|
2023
|
-
|
|
2056
|
+
hn.map((e) => /* @__PURE__ */ P(Zi, {
|
|
2024
2057
|
title: r(`material.image-editor.adjust.group.${e.id}`, e.label),
|
|
2025
2058
|
children: /* @__PURE__ */ P("div", {
|
|
2026
2059
|
className: "grid gap-1",
|
|
2027
|
-
children: e.items.map((e) => /* @__PURE__ */ P(
|
|
2060
|
+
children: e.items.map((e) => /* @__PURE__ */ P(pi, { spec: e }, e.key))
|
|
2028
2061
|
})
|
|
2029
2062
|
}, e.id))
|
|
2030
2063
|
] });
|
|
2031
2064
|
}
|
|
2032
2065
|
//#endregion
|
|
2033
2066
|
//#region lib/components/ui/primitives/separator/separator.tsx
|
|
2034
|
-
function
|
|
2035
|
-
return /* @__PURE__ */ P(
|
|
2067
|
+
function vi({ className: e, orientation: t = "horizontal", decorative: n = !0, ...r }) {
|
|
2068
|
+
return /* @__PURE__ */ P(mt, {
|
|
2036
2069
|
"data-slot": "separator",
|
|
2037
2070
|
decorative: n,
|
|
2038
2071
|
orientation: t,
|
|
@@ -2042,20 +2075,20 @@ function yi({ className: e, orientation: t = "horizontal", decorative: n = !0, .
|
|
|
2042
2075
|
}
|
|
2043
2076
|
//#endregion
|
|
2044
2077
|
//#region lib/components/ui/primitives/toggle-group/toggle-group.variants.ts
|
|
2045
|
-
function
|
|
2078
|
+
function yi(e) {
|
|
2046
2079
|
return e === "outlined" ? "separate" : e === "segmented" || e === "separate" ? e : "connected";
|
|
2047
2080
|
}
|
|
2048
|
-
function
|
|
2081
|
+
function bi(e) {
|
|
2049
2082
|
return e === "sm" || e === "lg" ? e : "md";
|
|
2050
2083
|
}
|
|
2051
2084
|
//#endregion
|
|
2052
2085
|
//#region lib/components/ui/primitives/toggle-group/toggle-group.tsx
|
|
2053
|
-
function
|
|
2054
|
-
let o =
|
|
2055
|
-
return /* @__PURE__ */ F(
|
|
2086
|
+
function xi({ className: e, variant: t, size: n, orientation: r, children: i, ...a }) {
|
|
2087
|
+
let o = yi(t);
|
|
2088
|
+
return /* @__PURE__ */ F(de, {
|
|
2056
2089
|
"data-slot": "toggle-group",
|
|
2057
2090
|
"data-variant": o,
|
|
2058
|
-
"data-size":
|
|
2091
|
+
"data-size": bi(n),
|
|
2059
2092
|
"data-orientation": r ?? "horizontal",
|
|
2060
2093
|
"data-type": a.type,
|
|
2061
2094
|
"data-pw": "toggle-group",
|
|
@@ -2068,9 +2101,9 @@ function Si({ className: e, variant: t, size: n, orientation: r, children: i, ..
|
|
|
2068
2101
|
}) : null]
|
|
2069
2102
|
});
|
|
2070
2103
|
}
|
|
2071
|
-
function
|
|
2072
|
-
let o = !
|
|
2073
|
-
return /* @__PURE__ */ F(
|
|
2104
|
+
function Si({ className: t, children: n, variant: r, size: i, ...a }) {
|
|
2105
|
+
let o = !te(n) && !!(a["aria-label"] || a["aria-labelledby"]);
|
|
2106
|
+
return /* @__PURE__ */ F(ue, {
|
|
2074
2107
|
"data-slot": "toggle-group-item",
|
|
2075
2108
|
"data-pw": a.value ? `toggle-group-item-${a.value}` : "toggle-group-item",
|
|
2076
2109
|
"data-icon-only": o ? "" : void 0,
|
|
@@ -2079,15 +2112,15 @@ function Ci({ className: t, children: n, variant: r, size: i, ...a }) {
|
|
|
2079
2112
|
children: [/* @__PURE__ */ P("span", {
|
|
2080
2113
|
"data-slot": "toggle-group-check",
|
|
2081
2114
|
"aria-hidden": "true",
|
|
2082
|
-
children: /* @__PURE__ */ P(
|
|
2115
|
+
children: /* @__PURE__ */ P(be, { strokeWidth: 2.75 })
|
|
2083
2116
|
}), /* @__PURE__ */ P(e, { children: n })]
|
|
2084
2117
|
});
|
|
2085
2118
|
}
|
|
2086
2119
|
//#endregion
|
|
2087
2120
|
//#region lib/components/ui/media/image-editor/partials/aspect-glyph.tsx
|
|
2088
|
-
var
|
|
2089
|
-
function
|
|
2090
|
-
let n = e === null, r = n ? 1 : e, i = r >= 1 ?
|
|
2121
|
+
var Ci = 14;
|
|
2122
|
+
function wi({ ratio: e, className: t }) {
|
|
2123
|
+
let n = e === null, r = n ? 1 : e, i = r >= 1 ? Ci : Ci * r, a = r >= 1 ? Ci / r : Ci;
|
|
2091
2124
|
return /* @__PURE__ */ P("span", {
|
|
2092
2125
|
"aria-hidden": "true",
|
|
2093
2126
|
"data-slot": "image-editor-aspect-glyph",
|
|
@@ -2100,90 +2133,98 @@ function Ti({ ratio: e, className: t }) {
|
|
|
2100
2133
|
}
|
|
2101
2134
|
//#endregion
|
|
2102
2135
|
//#region lib/components/ui/media/image-editor/partials/markup-tools.ts
|
|
2103
|
-
var
|
|
2136
|
+
var Ti = [
|
|
2104
2137
|
{
|
|
2105
2138
|
tool: "select",
|
|
2106
|
-
icon:
|
|
2139
|
+
icon: Pe,
|
|
2107
2140
|
label: "Select"
|
|
2108
2141
|
},
|
|
2109
2142
|
{
|
|
2110
2143
|
tool: "pen",
|
|
2111
|
-
icon:
|
|
2144
|
+
icon: Fe,
|
|
2112
2145
|
label: "Pen"
|
|
2113
2146
|
},
|
|
2114
2147
|
{
|
|
2115
2148
|
tool: "highlighter",
|
|
2116
|
-
icon:
|
|
2149
|
+
icon: je,
|
|
2117
2150
|
label: "Highlighter"
|
|
2118
2151
|
},
|
|
2119
2152
|
{
|
|
2120
2153
|
tool: "eraser",
|
|
2121
|
-
icon:
|
|
2154
|
+
icon: De,
|
|
2122
2155
|
label: "Eraser"
|
|
2123
2156
|
},
|
|
2124
2157
|
{
|
|
2125
2158
|
tool: "text",
|
|
2126
|
-
icon:
|
|
2159
|
+
icon: Ye,
|
|
2127
2160
|
label: "Text"
|
|
2128
2161
|
},
|
|
2162
|
+
{
|
|
2163
|
+
tool: "step",
|
|
2164
|
+
icon: Le,
|
|
2165
|
+
label: "Step marker"
|
|
2166
|
+
},
|
|
2129
2167
|
{
|
|
2130
2168
|
tool: "line",
|
|
2131
|
-
icon:
|
|
2169
|
+
icon: Ue,
|
|
2132
2170
|
label: "Line"
|
|
2133
2171
|
},
|
|
2134
2172
|
{
|
|
2135
2173
|
tool: "arrow",
|
|
2136
|
-
icon:
|
|
2174
|
+
icon: ve,
|
|
2137
2175
|
label: "Arrow"
|
|
2138
2176
|
},
|
|
2139
2177
|
{
|
|
2140
2178
|
tool: "rect",
|
|
2141
|
-
icon:
|
|
2179
|
+
icon: Ke,
|
|
2142
2180
|
label: "Rectangle"
|
|
2143
2181
|
},
|
|
2144
2182
|
{
|
|
2145
2183
|
tool: "ellipse",
|
|
2146
|
-
icon:
|
|
2184
|
+
icon: Se,
|
|
2147
2185
|
label: "Ellipse"
|
|
2148
2186
|
},
|
|
2149
2187
|
{
|
|
2150
2188
|
tool: "redact",
|
|
2151
|
-
icon:
|
|
2189
|
+
icon: qe,
|
|
2152
2190
|
label: "Redact"
|
|
2153
2191
|
}
|
|
2154
|
-
],
|
|
2192
|
+
], Ei = "before:hidden data-[state=on]:bg-primary data-[state=on]:text-primary-foreground data-[state=on]:hover:bg-primary/90";
|
|
2155
2193
|
//#endregion
|
|
2156
2194
|
//#region lib/components/ui/media/image-editor/partials/crop-aspect-picker.tsx
|
|
2157
|
-
function
|
|
2158
|
-
let { state:
|
|
2159
|
-
let
|
|
2160
|
-
if (!
|
|
2161
|
-
let
|
|
2162
|
-
|
|
2163
|
-
let o =
|
|
2164
|
-
o &&
|
|
2195
|
+
function Di({ compact: e = !1 }) {
|
|
2196
|
+
let { state: t, actions: n, base: r, aspectPresets: a, lockedAspect: o } = R(), { t: s } = i(), c = t.edits.crop, l = a.find((e) => e.value === t.aspect)?.id ?? "", u = (e) => {
|
|
2197
|
+
let t = a.find((t) => t.id === e);
|
|
2198
|
+
if (!t || !r) return;
|
|
2199
|
+
let i = t.value;
|
|
2200
|
+
n.setAspect(i);
|
|
2201
|
+
let o = i === "original" ? r.width / r.height : i;
|
|
2202
|
+
o && n.setCrop({ rect: Fn(c, o, r) });
|
|
2165
2203
|
};
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2204
|
+
if (o !== void 0 || a.length === 0) return null;
|
|
2205
|
+
let d = /* @__PURE__ */ P(xi, {
|
|
2206
|
+
type: "single",
|
|
2207
|
+
variant: "separate",
|
|
2208
|
+
size: "sm",
|
|
2209
|
+
value: l,
|
|
2210
|
+
onValueChange: (e) => e && u(e),
|
|
2211
|
+
"aria-label": s("material.image-editor.crop.aspect", "Aspect ratio"),
|
|
2212
|
+
className: T("justify-start", e ? "flex-nowrap overflow-x-auto" : "flex-wrap"),
|
|
2213
|
+
children: a.map((e) => /* @__PURE__ */ F(Si, {
|
|
2214
|
+
value: e.id,
|
|
2215
|
+
className: T(Ei, "gap-1.5"),
|
|
2216
|
+
children: [/* @__PURE__ */ P(wi, { ratio: e.value === "original" ? r ? r.width / r.height : 4 / 3 : e.value }), e.id === "free" || e.id === "original" ? s(`material.image-editor.crop.aspect-${e.id}`, e.label) : e.label]
|
|
2217
|
+
}, e.id))
|
|
2218
|
+
});
|
|
2219
|
+
return e ? d : /* @__PURE__ */ P(Zi, {
|
|
2220
|
+
title: s("material.image-editor.crop.aspect", "Aspect ratio"),
|
|
2221
|
+
children: d
|
|
2181
2222
|
});
|
|
2182
2223
|
}
|
|
2183
2224
|
//#endregion
|
|
2184
2225
|
//#region lib/components/ui/media/image-editor/partials/crop-orientation.tsx
|
|
2185
|
-
function
|
|
2186
|
-
return /* @__PURE__ */ P(
|
|
2226
|
+
function Oi(e, t, n) {
|
|
2227
|
+
return /* @__PURE__ */ P(f, {
|
|
2187
2228
|
variant: "tonal",
|
|
2188
2229
|
color: "default",
|
|
2189
2230
|
tooltip: e,
|
|
@@ -2191,42 +2232,45 @@ function ki(e, t, n) {
|
|
|
2191
2232
|
children: t
|
|
2192
2233
|
});
|
|
2193
2234
|
}
|
|
2194
|
-
function
|
|
2195
|
-
let { state:
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2235
|
+
function ki({ compact: e = !1 }) {
|
|
2236
|
+
let { state: t, actions: n } = R(), { t: r } = i(), { transform: a } = t.edits, o = /* @__PURE__ */ F("div", {
|
|
2237
|
+
className: "flex flex-wrap gap-2",
|
|
2238
|
+
children: [
|
|
2239
|
+
Oi(r("material.image-editor.crop.rotate-left", "Rotate left"), /* @__PURE__ */ P(Be, {}), () => n.turn(-1)),
|
|
2240
|
+
Oi(r("material.image-editor.crop.rotate-right", "Rotate right"), /* @__PURE__ */ P(Ve, {}), () => n.turn(1)),
|
|
2241
|
+
Oi(r("material.image-editor.crop.flip-horizontal", "Flip horizontally"), /* @__PURE__ */ P(ke, {}), () => n.flip("x")),
|
|
2242
|
+
Oi(r("material.image-editor.crop.flip-vertical", "Flip vertically"), /* @__PURE__ */ P(Ae, {}), () => n.flip("y"))
|
|
2243
|
+
]
|
|
2244
|
+
}), s = /* @__PURE__ */ P(di, {
|
|
2245
|
+
label: r("material.image-editor.crop.straighten", "Straighten"),
|
|
2246
|
+
min: -45,
|
|
2247
|
+
max: 45,
|
|
2248
|
+
step: .5,
|
|
2249
|
+
origin: 0,
|
|
2250
|
+
value: a.straighten,
|
|
2251
|
+
format: (e) => `${e > 0 ? "+" : ""}${e}°`,
|
|
2252
|
+
onChange: (e) => n.setStraighten(e),
|
|
2253
|
+
onCommit: () => n.endGesture(),
|
|
2254
|
+
onReset: () => {
|
|
2255
|
+
n.endGesture(), n.setStraighten(0), n.endGesture();
|
|
2256
|
+
}
|
|
2257
|
+
});
|
|
2258
|
+
return e ? /* @__PURE__ */ F(N, { children: [o, /* @__PURE__ */ P("div", {
|
|
2259
|
+
className: "min-w-40 flex-1",
|
|
2260
|
+
children: s
|
|
2261
|
+
})] }) : /* @__PURE__ */ F(Zi, {
|
|
2262
|
+
title: r("material.image-editor.crop.orientation", "Rotate & flip"),
|
|
2263
|
+
children: [o, s]
|
|
2220
2264
|
});
|
|
2221
2265
|
}
|
|
2222
2266
|
//#endregion
|
|
2223
2267
|
//#region lib/components/ui/media/image-editor/partials/editor-crop-panel.tsx
|
|
2224
|
-
function
|
|
2225
|
-
let { state: e, actions: t } =
|
|
2268
|
+
function Ai() {
|
|
2269
|
+
let { state: e, actions: t } = R(), { t: n } = i(), { transform: r, crop: a } = e.edits, o = a.x === H.x && a.y === H.y && a.w === H.w && a.h === H.h, s = zn(r) && o;
|
|
2226
2270
|
return /* @__PURE__ */ F(N, { children: [
|
|
2227
|
-
/* @__PURE__ */ P(
|
|
2228
|
-
/* @__PURE__ */ P(
|
|
2229
|
-
/* @__PURE__ */ P(
|
|
2271
|
+
/* @__PURE__ */ P(ki, {}),
|
|
2272
|
+
/* @__PURE__ */ P(Di, {}),
|
|
2273
|
+
/* @__PURE__ */ P(m, {
|
|
2230
2274
|
variant: "tonal",
|
|
2231
2275
|
color: "default",
|
|
2232
2276
|
size: "sm",
|
|
@@ -2239,8 +2283,8 @@ function ji() {
|
|
|
2239
2283
|
}
|
|
2240
2284
|
//#endregion
|
|
2241
2285
|
//#region lib/components/ui/media/image-editor/partials/editor-filters-panel.tsx
|
|
2242
|
-
function
|
|
2243
|
-
let { state: e, actions: t, source: n } =
|
|
2286
|
+
function ji() {
|
|
2287
|
+
let { state: e, actions: t, source: n } = R(), { t: r } = i(), a = n.status === "ready" ? n.preview : null, o = A(() => a ? Br(a, 224) : null, [a]), { filter: s, filterIntensity: c } = e.edits, l = A(() => ({
|
|
2244
2288
|
...e.edits,
|
|
2245
2289
|
filterIntensity: 100,
|
|
2246
2290
|
annotations: []
|
|
@@ -2249,7 +2293,7 @@ function Mi() {
|
|
|
2249
2293
|
role: "group",
|
|
2250
2294
|
"aria-label": r("material.image-editor.panel.filters", "Filters"),
|
|
2251
2295
|
className: "-mx-4 flex snap-x gap-2 overflow-x-auto px-4 pb-1 [scrollbar-width:none] @3xl/image-editor:mx-0 @3xl/image-editor:grid @3xl/image-editor:grid-cols-2 @3xl/image-editor:overflow-visible @3xl/image-editor:px-0",
|
|
2252
|
-
children:
|
|
2296
|
+
children: gr.map((e) => /* @__PURE__ */ P(Mi, {
|
|
2253
2297
|
preset: e,
|
|
2254
2298
|
source: o,
|
|
2255
2299
|
edits: l,
|
|
@@ -2257,7 +2301,7 @@ function Mi() {
|
|
|
2257
2301
|
label: r(`material.image-editor.filter.${e.id}`, e.label),
|
|
2258
2302
|
onSelect: () => t.setFilter(e.id)
|
|
2259
2303
|
}, e.id))
|
|
2260
|
-
}), s !== "none" && /* @__PURE__ */ P(
|
|
2304
|
+
}), s !== "none" && /* @__PURE__ */ P(di, {
|
|
2261
2305
|
label: r("material.image-editor.filter-intensity", "Intensity"),
|
|
2262
2306
|
min: 0,
|
|
2263
2307
|
max: 100,
|
|
@@ -2269,13 +2313,13 @@ function Mi() {
|
|
|
2269
2313
|
onReset: () => t.setFilterIntensity(100)
|
|
2270
2314
|
})] });
|
|
2271
2315
|
}
|
|
2272
|
-
function
|
|
2316
|
+
function Mi({ preset: e, source: t, edits: n, checked: r, label: i, onSelect: a }) {
|
|
2273
2317
|
let o = j(null);
|
|
2274
2318
|
return O(() => {
|
|
2275
2319
|
let r = o.current;
|
|
2276
2320
|
if (!t || !r) return;
|
|
2277
2321
|
let i = requestAnimationFrame(() => {
|
|
2278
|
-
|
|
2322
|
+
zr(t, n, {
|
|
2279
2323
|
scale: 1,
|
|
2280
2324
|
region: "crop",
|
|
2281
2325
|
filter: e.id,
|
|
@@ -2307,206 +2351,92 @@ function Ni({ preset: e, source: t, edits: n, checked: r, label: i, onSelect: a
|
|
|
2307
2351
|
}
|
|
2308
2352
|
//#endregion
|
|
2309
2353
|
//#region lib/components/ui/media/image-editor/partials/editor-markup-selection.tsx
|
|
2310
|
-
function
|
|
2311
|
-
let { selected: e, actions: t } =
|
|
2354
|
+
function Ni() {
|
|
2355
|
+
let { selected: e, actions: t } = R(), { t: n } = i();
|
|
2312
2356
|
if (!e) return null;
|
|
2313
2357
|
let r = e.id;
|
|
2314
|
-
return /* @__PURE__ */ P(
|
|
2358
|
+
return /* @__PURE__ */ P(Zi, {
|
|
2315
2359
|
title: n("material.image-editor.markup.selection", "Selected mark"),
|
|
2316
2360
|
children: /* @__PURE__ */ F("div", {
|
|
2317
2361
|
className: "flex gap-2",
|
|
2318
2362
|
children: [
|
|
2319
|
-
/* @__PURE__ */ P(
|
|
2363
|
+
/* @__PURE__ */ P(f, {
|
|
2320
2364
|
variant: "tonal",
|
|
2321
2365
|
color: "default",
|
|
2322
2366
|
tooltip: n("material.image-editor.markup.duplicate", "Duplicate"),
|
|
2323
2367
|
onClick: () => t.duplicateAnnotation(r),
|
|
2324
|
-
children: /* @__PURE__ */ P(
|
|
2368
|
+
children: /* @__PURE__ */ P(we, {})
|
|
2325
2369
|
}),
|
|
2326
|
-
/* @__PURE__ */ P(
|
|
2370
|
+
/* @__PURE__ */ P(f, {
|
|
2327
2371
|
variant: "tonal",
|
|
2328
2372
|
color: "default",
|
|
2329
2373
|
tooltip: n("material.image-editor.markup.to-front", "Bring to front"),
|
|
2330
2374
|
onClick: () => t.bringToFront(r),
|
|
2331
|
-
children: /* @__PURE__ */ P(
|
|
2375
|
+
children: /* @__PURE__ */ P(ye, {})
|
|
2332
2376
|
}),
|
|
2333
|
-
/* @__PURE__ */ P(
|
|
2377
|
+
/* @__PURE__ */ P(f, {
|
|
2334
2378
|
variant: "tonal",
|
|
2335
2379
|
color: "error",
|
|
2336
2380
|
tooltip: n("material.image-editor.markup.delete", "Delete"),
|
|
2337
2381
|
onClick: () => t.removeAnnotation(r),
|
|
2338
|
-
children: /* @__PURE__ */ P(
|
|
2382
|
+
children: /* @__PURE__ */ P(Je, {})
|
|
2339
2383
|
})
|
|
2340
2384
|
]
|
|
2341
2385
|
})
|
|
2342
2386
|
});
|
|
2343
2387
|
}
|
|
2344
2388
|
//#endregion
|
|
2345
|
-
//#region lib/components/ui/fields/switch/partials/switch-row.tsx
|
|
2346
|
-
function Fi({ id: e, rowTextId: t, text: n, isChecked: r, error: i, variant: a = "box", className: o, readOnly: s, children: l }) {
|
|
2347
|
-
return /* @__PURE__ */ F("div", {
|
|
2348
|
-
"data-checked": r,
|
|
2349
|
-
"data-filled": r,
|
|
2350
|
-
"data-invalid": i || void 0,
|
|
2351
|
-
className: T(a === "plain" ? "flex w-full min-w-0 items-start gap-2 min-h-11 py-[5px]" : b, a !== "plain" && "h-auto min-h-11 items-start py-[5px]", o),
|
|
2352
|
-
children: [/* @__PURE__ */ P("label", {
|
|
2353
|
-
id: t,
|
|
2354
|
-
htmlFor: e,
|
|
2355
|
-
className: T(c(), "my-1.5 min-w-0 flex-1 break-words", s ? "cursor-default" : "cursor-pointer", "pointer-coarse:py-3 pointer-coarse:-my-1.5", { "text-primary-text": r }),
|
|
2356
|
-
children: n
|
|
2357
|
-
}), l]
|
|
2358
|
-
});
|
|
2359
|
-
}
|
|
2360
|
-
//#endregion
|
|
2361
|
-
//#region lib/components/ui/fields/switch/switch.utils.ts
|
|
2362
|
-
function Ii({ id: e, label: t, placeholder: n, helperText: r, props: i }) {
|
|
2363
|
-
let a = `${e}-label`, o = r ? `${e}-helper` : void 0, s = !!(t && n), c = s ? `${e}-text` : void 0, l = [
|
|
2364
|
-
c,
|
|
2365
|
-
o,
|
|
2366
|
-
i["aria-describedby"]
|
|
2367
|
-
].filter(Boolean).join(" ") || void 0, u = !!(i["aria-label"] || i["aria-labelledby"]);
|
|
2368
|
-
return {
|
|
2369
|
-
labelId: a,
|
|
2370
|
-
rowTextId: c,
|
|
2371
|
-
helperId: o,
|
|
2372
|
-
nameProps: {
|
|
2373
|
-
...s && !u ? { "aria-labelledby": a } : {},
|
|
2374
|
-
...l ? { "aria-describedby": l } : {}
|
|
2375
|
-
}
|
|
2376
|
-
};
|
|
2377
|
-
}
|
|
2378
|
-
//#endregion
|
|
2379
|
-
//#region lib/components/ui/fields/switch/use-switch-checked.ts
|
|
2380
|
-
function Li(e) {
|
|
2381
|
-
let [t, n] = M(e.defaultChecked ?? !1);
|
|
2382
|
-
return {
|
|
2383
|
-
isChecked: e.checked ?? t,
|
|
2384
|
-
onCheckedChange: (t) => {
|
|
2385
|
-
e.checked === void 0 && n(t), e.onCheckedChange?.(t);
|
|
2386
|
-
}
|
|
2387
|
-
};
|
|
2388
|
-
}
|
|
2389
|
-
//#endregion
|
|
2390
|
-
//#region lib/components/ui/fields/switch/use-switch-state.ts
|
|
2391
|
-
function Ri({ label: e, placeholder: t, helperText: n, props: r }) {
|
|
2392
|
-
let i = de(), a = !!(t || e), o = k(), s = r.id ?? o, c = Ii({
|
|
2393
|
-
id: s,
|
|
2394
|
-
label: e,
|
|
2395
|
-
placeholder: t,
|
|
2396
|
-
helperText: n,
|
|
2397
|
-
props: r
|
|
2398
|
-
}), { isChecked: l, onCheckedChange: u } = Li(r);
|
|
2399
|
-
return {
|
|
2400
|
-
blurRoot: i,
|
|
2401
|
-
hasRow: a,
|
|
2402
|
-
id: s,
|
|
2403
|
-
...c,
|
|
2404
|
-
isChecked: l,
|
|
2405
|
-
onCheckedChange: u
|
|
2406
|
-
};
|
|
2407
|
-
}
|
|
2408
|
-
//#endregion
|
|
2409
|
-
//#region lib/components/ui/fields/switch/switch.tsx
|
|
2410
|
-
function zi({ error: e, helperText: t, label: n, placeholder: r, variant: i = "box", className: a, ...o }) {
|
|
2411
|
-
let s = Ri({
|
|
2412
|
-
label: n,
|
|
2413
|
-
placeholder: r,
|
|
2414
|
-
helperText: t,
|
|
2415
|
-
props: o
|
|
2416
|
-
}), { id: c } = s, l = !(r || t), u = l ? a : void 0, d = s.hasRow && l && i === "box", p = {
|
|
2417
|
-
"aria-invalid": e || void 0,
|
|
2418
|
-
...o,
|
|
2419
|
-
...s.nameProps,
|
|
2420
|
-
id: c,
|
|
2421
|
-
onCheckedChange: s.onCheckedChange
|
|
2422
|
-
}, h = s.hasRow ? /* @__PURE__ */ P(Fi, {
|
|
2423
|
-
className: T(d && "self-end", u),
|
|
2424
|
-
id: c,
|
|
2425
|
-
rowTextId: s.rowTextId,
|
|
2426
|
-
text: r || n,
|
|
2427
|
-
isChecked: s.isChecked,
|
|
2428
|
-
error: e,
|
|
2429
|
-
variant: i,
|
|
2430
|
-
readOnly: o.readOnly,
|
|
2431
|
-
children: /* @__PURE__ */ P(pe, {
|
|
2432
|
-
...p,
|
|
2433
|
-
className: "cursor-pointer"
|
|
2434
|
-
})
|
|
2435
|
-
}) : /* @__PURE__ */ P(pe, {
|
|
2436
|
-
...p,
|
|
2437
|
-
className: T("cursor-pointer", u)
|
|
2438
|
-
});
|
|
2439
|
-
return /* @__PURE__ */ F("div", {
|
|
2440
|
-
ref: s.blurRoot,
|
|
2441
|
-
"data-slot": "switch-field",
|
|
2442
|
-
className: l ? "contents" : T("grid min-w-0 content-start gap-1.5", s.hasRow && "w-full", a),
|
|
2443
|
-
children: [n && r && /* @__PURE__ */ P(m, {
|
|
2444
|
-
id: s.labelId,
|
|
2445
|
-
htmlFor: c,
|
|
2446
|
-
withAsterisk: o.required,
|
|
2447
|
-
children: n
|
|
2448
|
-
}), /* @__PURE__ */ F("div", {
|
|
2449
|
-
className: l ? "contents" : "flex min-w-0 flex-col gap-0.5",
|
|
2450
|
-
children: [h, t ? /* @__PURE__ */ P(f, {
|
|
2451
|
-
id: s.helperId,
|
|
2452
|
-
error: e,
|
|
2453
|
-
children: t
|
|
2454
|
-
}) : null]
|
|
2455
|
-
})]
|
|
2456
|
-
});
|
|
2457
|
-
}
|
|
2458
|
-
//#endregion
|
|
2459
2389
|
//#region lib/components/ui/selection/color-swatches/color-swatches.utils.ts
|
|
2460
|
-
function
|
|
2390
|
+
function Pi(e) {
|
|
2461
2391
|
let t = e.trim().replace("#", ""), n = t.length === 3 ? t.replace(/./g, (e) => e + e) : t;
|
|
2462
2392
|
if (!/^[0-9a-f]{6}/i.test(n)) return !1;
|
|
2463
2393
|
let r = Number.parseInt(n.slice(0, 6), 16), i = r >> 16 & 255, a = r >> 8 & 255, o = r & 255;
|
|
2464
2394
|
return .299 * i + .587 * a + .114 * o > 160;
|
|
2465
2395
|
}
|
|
2466
|
-
function
|
|
2396
|
+
function Fi(e) {
|
|
2467
2397
|
return e.label ?? e.value;
|
|
2468
2398
|
}
|
|
2469
|
-
function
|
|
2399
|
+
function Ii(e, t) {
|
|
2470
2400
|
return !!(e && t && e.toLowerCase() === t.toLowerCase());
|
|
2471
2401
|
}
|
|
2472
|
-
function
|
|
2402
|
+
function Li(e) {
|
|
2473
2403
|
return e && /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000";
|
|
2474
2404
|
}
|
|
2475
2405
|
//#endregion
|
|
2476
2406
|
//#region lib/components/ui/selection/color-swatches/partials/color-swatch-styles.ts
|
|
2477
|
-
var
|
|
2407
|
+
var Ri = {
|
|
2478
2408
|
xs: "size-5 [&_svg]:size-3",
|
|
2479
2409
|
sm: "size-7 [&_svg]:size-3.5",
|
|
2480
2410
|
md: "size-9 [&_svg]:size-4",
|
|
2481
2411
|
lg: "size-11 [&_svg]:size-5"
|
|
2482
|
-
},
|
|
2412
|
+
}, zi = "relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full border border-foreground/15 bg-(--swatch) shadow-xs outline-none transition-[box-shadow,transform] duration-200 hover:scale-110 focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none motion-reduce:hover:scale-100";
|
|
2483
2413
|
//#endregion
|
|
2484
2414
|
//#region lib/components/ui/selection/color-swatches/partials/color-swatch-button.tsx
|
|
2485
|
-
function
|
|
2415
|
+
function Bi({ item: e, size: t, pressed: n, onChoose: r }) {
|
|
2486
2416
|
return /* @__PURE__ */ P("button", {
|
|
2487
2417
|
type: "button",
|
|
2488
2418
|
"aria-pressed": n,
|
|
2489
|
-
"aria-label":
|
|
2490
|
-
title:
|
|
2419
|
+
"aria-label": Fi(e),
|
|
2420
|
+
title: Fi(e),
|
|
2491
2421
|
"data-color": e.value,
|
|
2492
2422
|
ref: (t) => t?.style.setProperty("--swatch", e.value),
|
|
2493
2423
|
onClick: () => r(e.value),
|
|
2494
|
-
className: T(
|
|
2495
|
-
children: n && /* @__PURE__ */ P(
|
|
2424
|
+
className: T(zi, Ri[t], n && "ring-2 ring-foreground/80 ring-offset-2 ring-offset-background"),
|
|
2425
|
+
children: n && /* @__PURE__ */ P(be, {
|
|
2496
2426
|
"aria-hidden": "true",
|
|
2497
2427
|
strokeWidth: 3,
|
|
2498
|
-
className:
|
|
2428
|
+
className: Pi(e.value) ? "text-black/80" : "text-white"
|
|
2499
2429
|
})
|
|
2500
2430
|
});
|
|
2501
2431
|
}
|
|
2502
2432
|
//#endregion
|
|
2503
2433
|
//#region lib/components/ui/selection/color-swatches/partials/custom-color-swatch.tsx
|
|
2504
|
-
function
|
|
2434
|
+
function Vi({ size: e, current: t, listed: n, onChoose: r }) {
|
|
2505
2435
|
let { t: a } = i();
|
|
2506
2436
|
return /* @__PURE__ */ F("label", {
|
|
2507
2437
|
title: a("material.color-swatches.custom", "Custom colour"),
|
|
2508
|
-
className: T(
|
|
2509
|
-
children: [/* @__PURE__ */ P(
|
|
2438
|
+
className: T(zi, Ri[e], "bg-[conic-gradient(from_90deg,#ef4444,#facc15,#22c55e,#06b6d4,#3b82f6,#8b5cf6,#ec4899,#ef4444)] has-focus-visible:ring-[3px] has-focus-visible:ring-ring/50", t && !n && "ring-2 ring-foreground/80 ring-offset-2 ring-offset-background"),
|
|
2439
|
+
children: [/* @__PURE__ */ P(Re, {
|
|
2510
2440
|
"aria-hidden": "true",
|
|
2511
2441
|
strokeWidth: 3,
|
|
2512
2442
|
className: "text-white drop-shadow"
|
|
@@ -2514,17 +2444,17 @@ function qi({ size: e, current: t, listed: n, onChoose: r }) {
|
|
|
2514
2444
|
type: "color",
|
|
2515
2445
|
className: "sr-only",
|
|
2516
2446
|
"aria-label": a("material.color-swatches.custom", "Custom colour"),
|
|
2517
|
-
value:
|
|
2447
|
+
value: Li(t),
|
|
2518
2448
|
onChange: (e) => r(e.target.value)
|
|
2519
2449
|
})]
|
|
2520
2450
|
});
|
|
2521
2451
|
}
|
|
2522
2452
|
//#endregion
|
|
2523
2453
|
//#region lib/components/ui/selection/color-swatches/color-swatches.tsx
|
|
2524
|
-
function
|
|
2454
|
+
function Hi({ colors: e, value: t, defaultValue: n, onChange: r, label: a, showLabel: o = !1, size: s = "md", custom: c = !1, disabled: l, className: u }) {
|
|
2525
2455
|
let { t: d } = i(), [f, p] = M(n), m = t ?? f, h = (e) => {
|
|
2526
2456
|
t === void 0 && p(e), r?.(e);
|
|
2527
|
-
}, g = e.map((e) => typeof e == "string" ? { value: e } : e), _ = g.some((e) =>
|
|
2457
|
+
}, g = e.map((e) => typeof e == "string" ? { value: e } : e), _ = g.some((e) => Ii(e.value, m));
|
|
2528
2458
|
return /* @__PURE__ */ F("fieldset", {
|
|
2529
2459
|
"data-slot": "color-swatches",
|
|
2530
2460
|
"data-size": s,
|
|
@@ -2535,12 +2465,12 @@ function Ji({ colors: e, value: t, defaultValue: n, onChange: r, label: a, showL
|
|
|
2535
2465
|
children: a ?? d("material.color-swatches.label", "Colour")
|
|
2536
2466
|
}), /* @__PURE__ */ F("div", {
|
|
2537
2467
|
className: "flex flex-wrap gap-2",
|
|
2538
|
-
children: [g.map((e) => /* @__PURE__ */ P(
|
|
2468
|
+
children: [g.map((e) => /* @__PURE__ */ P(Bi, {
|
|
2539
2469
|
item: e,
|
|
2540
2470
|
size: s,
|
|
2541
|
-
pressed:
|
|
2471
|
+
pressed: Ii(e.value, m),
|
|
2542
2472
|
onChoose: h
|
|
2543
|
-
}, e.value)), c && /* @__PURE__ */ P(
|
|
2473
|
+
}, e.value)), c && /* @__PURE__ */ P(Vi, {
|
|
2544
2474
|
size: s,
|
|
2545
2475
|
current: m,
|
|
2546
2476
|
listed: _,
|
|
@@ -2551,13 +2481,13 @@ function Ji({ colors: e, value: t, defaultValue: n, onChange: r, label: a, showL
|
|
|
2551
2481
|
}
|
|
2552
2482
|
//#endregion
|
|
2553
2483
|
//#region lib/components/ui/media/image-editor/partials/markup-brush-section.tsx
|
|
2554
|
-
var
|
|
2555
|
-
function
|
|
2556
|
-
let { state: e, actions: t, colors: n, selected: r, redactModes: a } =
|
|
2557
|
-
return /* @__PURE__ */ F(
|
|
2484
|
+
var Ui = (e) => Math.round((e - yn) / (bn - yn) * 99 + 1), Wi = (e) => yn + (e - 1) / 99 * (bn - yn);
|
|
2485
|
+
function Gi() {
|
|
2486
|
+
let { state: e, actions: t, colors: n, selected: r, redactModes: a } = R(), { t: o } = i(), { brush: s, markupTool: c } = e, l = r?.kind ?? c, u = l === "rect" || l === "ellipse";
|
|
2487
|
+
return /* @__PURE__ */ F(Zi, {
|
|
2558
2488
|
title: o("material.image-editor.markup.color", "Colour"),
|
|
2559
2489
|
children: [
|
|
2560
|
-
/* @__PURE__ */ P(
|
|
2490
|
+
/* @__PURE__ */ P(Hi, {
|
|
2561
2491
|
colors: n,
|
|
2562
2492
|
size: "sm",
|
|
2563
2493
|
custom: !0,
|
|
@@ -2565,25 +2495,25 @@ function Zi() {
|
|
|
2565
2495
|
value: s.color,
|
|
2566
2496
|
onChange: (e) => t.setBrush({ color: e })
|
|
2567
2497
|
}),
|
|
2568
|
-
/* @__PURE__ */ P(
|
|
2498
|
+
/* @__PURE__ */ P(di, {
|
|
2569
2499
|
label: o("material.image-editor.markup.size", "Size"),
|
|
2570
2500
|
min: 1,
|
|
2571
2501
|
max: 100,
|
|
2572
|
-
value:
|
|
2573
|
-
onChange: (e) => t.setBrush({ size:
|
|
2502
|
+
value: Ui(s.size),
|
|
2503
|
+
onChange: (e) => t.setBrush({ size: Wi(e) }),
|
|
2574
2504
|
onCommit: () => t.endGesture()
|
|
2575
2505
|
}),
|
|
2576
|
-
u && /* @__PURE__ */ P(
|
|
2506
|
+
u && /* @__PURE__ */ P(g, {
|
|
2577
2507
|
label: o("material.image-editor.markup.fill", "Filled"),
|
|
2578
2508
|
checked: s.fill,
|
|
2579
2509
|
onCheckedChange: (e) => t.setBrush({ fill: e })
|
|
2580
2510
|
}),
|
|
2581
|
-
l === "redact" && a.length > 1 && /* @__PURE__ */ P(
|
|
2511
|
+
l === "redact" && a.length > 1 && /* @__PURE__ */ P(g, {
|
|
2582
2512
|
label: o("material.image-editor.markup.pixelate", "Pixelate (less safe)"),
|
|
2583
2513
|
checked: s.redactMode === "pixelate",
|
|
2584
2514
|
onCheckedChange: (e) => t.setBrush({ redactMode: e ? "pixelate" : "solid" })
|
|
2585
2515
|
}),
|
|
2586
|
-
l === "text" && /* @__PURE__ */ P(
|
|
2516
|
+
l === "text" && /* @__PURE__ */ P(g, {
|
|
2587
2517
|
label: o("material.image-editor.markup.background", "Background"),
|
|
2588
2518
|
checked: s.background,
|
|
2589
2519
|
onCheckedChange: (e) => t.setBrush({ background: e })
|
|
@@ -2593,33 +2523,33 @@ function Zi() {
|
|
|
2593
2523
|
}
|
|
2594
2524
|
//#endregion
|
|
2595
2525
|
//#region lib/components/ui/media/image-editor/partials/markup-tool-picker.tsx
|
|
2596
|
-
function
|
|
2597
|
-
let { state: e, actions: t, markupTools: n } =
|
|
2598
|
-
return /* @__PURE__ */ P(
|
|
2526
|
+
function Ki() {
|
|
2527
|
+
let { state: e, actions: t, markupTools: n } = R(), { t: r } = i(), { markupTool: a } = e, o = (e, t) => r(`material.image-editor.markup.tool.${e}`, t), s = n ? n.flatMap((e) => Ti.filter((t) => t.tool === e)) : Ti;
|
|
2528
|
+
return /* @__PURE__ */ P(xi, {
|
|
2599
2529
|
type: "single",
|
|
2600
2530
|
variant: "separate",
|
|
2601
2531
|
"aria-label": r("material.image-editor.markup.tools", "Drawing tools"),
|
|
2602
2532
|
value: a,
|
|
2603
2533
|
onValueChange: (e) => e && t.setMarkupTool(e),
|
|
2604
2534
|
className: "grid grid-cols-5 gap-1",
|
|
2605
|
-
children: s.map(({ tool: e, icon: t, label: n }) => /* @__PURE__ */ P(
|
|
2535
|
+
children: s.map(({ tool: e, icon: t, label: n }) => /* @__PURE__ */ P(Si, {
|
|
2606
2536
|
value: e,
|
|
2607
2537
|
"aria-label": o(e, n),
|
|
2608
2538
|
title: o(e, n),
|
|
2609
|
-
className:
|
|
2539
|
+
className: Ei,
|
|
2610
2540
|
children: /* @__PURE__ */ P(t, { "aria-hidden": "true" })
|
|
2611
2541
|
}, e))
|
|
2612
2542
|
});
|
|
2613
2543
|
}
|
|
2614
2544
|
//#endregion
|
|
2615
2545
|
//#region lib/components/ui/media/image-editor/partials/editor-markup-panel.tsx
|
|
2616
|
-
function
|
|
2617
|
-
let { state: e, actions: t } =
|
|
2546
|
+
function qi() {
|
|
2547
|
+
let { state: e, actions: t } = R(), { t: n } = i();
|
|
2618
2548
|
return /* @__PURE__ */ F(N, { children: [
|
|
2619
|
-
/* @__PURE__ */ P(
|
|
2620
|
-
/* @__PURE__ */ P(
|
|
2621
|
-
/* @__PURE__ */ P(
|
|
2622
|
-
/* @__PURE__ */ P(
|
|
2549
|
+
/* @__PURE__ */ P(Ki, {}),
|
|
2550
|
+
/* @__PURE__ */ P(Gi, {}),
|
|
2551
|
+
/* @__PURE__ */ P(Ni, {}),
|
|
2552
|
+
/* @__PURE__ */ P(m, {
|
|
2623
2553
|
variant: "tonal",
|
|
2624
2554
|
color: "error",
|
|
2625
2555
|
size: "sm",
|
|
@@ -2632,21 +2562,21 @@ function $i() {
|
|
|
2632
2562
|
}
|
|
2633
2563
|
//#endregion
|
|
2634
2564
|
//#region lib/components/ui/media/image-editor/partials/editor-panel.tsx
|
|
2635
|
-
var
|
|
2565
|
+
var Ji = {
|
|
2636
2566
|
adjust: "Adjust",
|
|
2637
2567
|
filters: "Filters",
|
|
2638
2568
|
crop: "Crop & rotate",
|
|
2639
2569
|
markup: "Markup"
|
|
2640
|
-
},
|
|
2641
|
-
adjust:
|
|
2642
|
-
filters:
|
|
2643
|
-
crop:
|
|
2644
|
-
markup:
|
|
2570
|
+
}, Yi = {
|
|
2571
|
+
adjust: _i,
|
|
2572
|
+
filters: ji,
|
|
2573
|
+
crop: Ai,
|
|
2574
|
+
markup: qi
|
|
2645
2575
|
};
|
|
2646
|
-
function
|
|
2647
|
-
let { state: e, source: t } =
|
|
2576
|
+
function Xi() {
|
|
2577
|
+
let { state: e, source: t } = R(), { t: n } = i(), r = k();
|
|
2648
2578
|
if (t.status !== "ready") return null;
|
|
2649
|
-
let a =
|
|
2579
|
+
let a = Yi[e.tool];
|
|
2650
2580
|
return /* @__PURE__ */ F("section", {
|
|
2651
2581
|
"aria-labelledby": r,
|
|
2652
2582
|
"data-slot": "image-editor-panel",
|
|
@@ -2656,14 +2586,14 @@ function na() {
|
|
|
2656
2586
|
id: r,
|
|
2657
2587
|
variant: "title-small",
|
|
2658
2588
|
className: "sticky top-0 z-10 bg-card px-4 pt-3 pb-2",
|
|
2659
|
-
children: n(`material.image-editor.panel.${e.tool}`,
|
|
2589
|
+
children: n(`material.image-editor.panel.${e.tool}`, Ji[e.tool])
|
|
2660
2590
|
}), /* @__PURE__ */ P("div", {
|
|
2661
2591
|
className: "flex flex-col gap-5 px-4 pb-4",
|
|
2662
2592
|
children: /* @__PURE__ */ P(a, {})
|
|
2663
2593
|
})]
|
|
2664
2594
|
});
|
|
2665
2595
|
}
|
|
2666
|
-
function
|
|
2596
|
+
function Zi({ title: e, action: t, children: n }) {
|
|
2667
2597
|
let r = k();
|
|
2668
2598
|
return /* @__PURE__ */ F("section", {
|
|
2669
2599
|
"aria-labelledby": r,
|
|
@@ -2681,7 +2611,7 @@ function ra({ title: e, action: t, children: n }) {
|
|
|
2681
2611
|
}
|
|
2682
2612
|
//#endregion
|
|
2683
2613
|
//#region lib/components/ui/media/compare-slider/partials/compare-slider-handle.tsx
|
|
2684
|
-
function
|
|
2614
|
+
function Qi({ current: e, onKeyDown: t }) {
|
|
2685
2615
|
let { t: n } = i();
|
|
2686
2616
|
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("div", {
|
|
2687
2617
|
"aria-hidden": "true",
|
|
@@ -2698,7 +2628,7 @@ function ia({ current: e, onKeyDown: t }) {
|
|
|
2698
2628
|
"data-slot": "compare-slider-handle",
|
|
2699
2629
|
onKeyDown: t,
|
|
2700
2630
|
className: "absolute top-1/2 left-(--compare-at) flex size-10 -translate-x-1/2 -translate-y-1/2 cursor-ew-resize items-center justify-center rounded-full border border-white/70 bg-white/85 text-black shadow-lg outline-none backdrop-blur-md transition-transform hover:scale-110 focus-visible:ring-[3px] focus-visible:ring-ring/70 motion-reduce:transition-none",
|
|
2701
|
-
children: /* @__PURE__ */ P(
|
|
2631
|
+
children: /* @__PURE__ */ P(xe, {
|
|
2702
2632
|
className: "size-5",
|
|
2703
2633
|
"aria-hidden": "true"
|
|
2704
2634
|
})
|
|
@@ -2709,7 +2639,7 @@ function ia({ current: e, onKeyDown: t }) {
|
|
|
2709
2639
|
function $(e) {
|
|
2710
2640
|
return Number.isNaN(e) ? 50 : Math.min(100, Math.max(0, e));
|
|
2711
2641
|
}
|
|
2712
|
-
function
|
|
2642
|
+
function $i(e, t, n) {
|
|
2713
2643
|
let r = n ? 10 : 1;
|
|
2714
2644
|
switch (e) {
|
|
2715
2645
|
case "ArrowLeft":
|
|
@@ -2725,9 +2655,9 @@ function aa(e, t, n) {
|
|
|
2725
2655
|
}
|
|
2726
2656
|
//#endregion
|
|
2727
2657
|
//#region lib/components/ui/media/compare-slider/use-compare-slider.ts
|
|
2728
|
-
function
|
|
2658
|
+
function ea({ position: e, defaultPosition: t, onPositionChange: n }) {
|
|
2729
2659
|
let r = j(null), i = j(!1), [a, o] = M(t), s = $(e ?? a);
|
|
2730
|
-
|
|
2660
|
+
he(() => {
|
|
2731
2661
|
r.current?.style.setProperty("--compare-at", `${s}%`);
|
|
2732
2662
|
}, [s]);
|
|
2733
2663
|
let c = (t) => {
|
|
@@ -2741,7 +2671,7 @@ function oa({ position: e, defaultPosition: t, onPositionChange: n }) {
|
|
|
2741
2671
|
rootRef: r,
|
|
2742
2672
|
current: s,
|
|
2743
2673
|
onKeyDown: (e) => {
|
|
2744
|
-
let t =
|
|
2674
|
+
let t = $i(e.key, s, e.shiftKey);
|
|
2745
2675
|
t !== null && (e.preventDefault(), c(t));
|
|
2746
2676
|
},
|
|
2747
2677
|
rootHandlers: {
|
|
@@ -2762,9 +2692,9 @@ function oa({ position: e, defaultPosition: t, onPositionChange: n }) {
|
|
|
2762
2692
|
}
|
|
2763
2693
|
//#endregion
|
|
2764
2694
|
//#region lib/components/ui/media/compare-slider/compare-slider.tsx
|
|
2765
|
-
var
|
|
2766
|
-
function
|
|
2767
|
-
let { t: u } = i(), { rootRef: d, current: f, onKeyDown: p, rootHandlers: m } =
|
|
2695
|
+
var ta = "pointer-events-none absolute top-3 rounded-full bg-black/55 px-2.5 py-1 font-medium text-white text-xs backdrop-blur-md";
|
|
2696
|
+
function na({ before: e, after: t, position: n, defaultPosition: r = 50, onPositionChange: a, beforeLabel: o, afterLabel: s, showLabels: c = !0, className: l }) {
|
|
2697
|
+
let { t: u } = i(), { rootRef: d, current: f, onKeyDown: p, rootHandlers: m } = ea({
|
|
2768
2698
|
position: n,
|
|
2769
2699
|
defaultPosition: r,
|
|
2770
2700
|
onPositionChange: a
|
|
@@ -2786,13 +2716,13 @@ function ca({ before: e, after: t, position: n, defaultPosition: r = 50, onPosit
|
|
|
2786
2716
|
children: e
|
|
2787
2717
|
}),
|
|
2788
2718
|
c && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("span", {
|
|
2789
|
-
className: T(
|
|
2719
|
+
className: T(ta, "left-3"),
|
|
2790
2720
|
children: o ?? u("material.compare-slider.before", "Before")
|
|
2791
2721
|
}), /* @__PURE__ */ P("span", {
|
|
2792
|
-
className: T(
|
|
2722
|
+
className: T(ta, "right-3"),
|
|
2793
2723
|
children: s ?? u("material.compare-slider.after", "After")
|
|
2794
2724
|
})] }),
|
|
2795
|
-
/* @__PURE__ */ P(
|
|
2725
|
+
/* @__PURE__ */ P(Qi, {
|
|
2796
2726
|
current: f,
|
|
2797
2727
|
onKeyDown: p
|
|
2798
2728
|
})
|
|
@@ -2801,73 +2731,84 @@ function ca({ before: e, after: t, position: n, defaultPosition: r = 50, onPosit
|
|
|
2801
2731
|
}
|
|
2802
2732
|
//#endregion
|
|
2803
2733
|
//#region lib/components/ui/media/image-editor/use-stage-fit.ts
|
|
2804
|
-
var
|
|
2734
|
+
var ra = (e) => e === "crop" ? "full" : "crop", ia = {
|
|
2805
2735
|
x: 0,
|
|
2806
2736
|
y: 0,
|
|
2807
2737
|
w: 1,
|
|
2808
2738
|
h: 1
|
|
2809
|
-
},
|
|
2810
|
-
function
|
|
2811
|
-
let [
|
|
2739
|
+
}, aa = (e, t) => ra(e) === "crop" ? t : ia, oa = 24, sa = 80, ca = 216, la = 2;
|
|
2740
|
+
function ua(e, t, n, r, i = !1) {
|
|
2741
|
+
let [a, o] = M(null);
|
|
2812
2742
|
O(() => {
|
|
2813
2743
|
let t = e.current;
|
|
2814
2744
|
if (!t) return;
|
|
2815
|
-
let n =
|
|
2816
|
-
|
|
2817
|
-
|
|
2745
|
+
let n = i ? ca : sa;
|
|
2746
|
+
t.style.setProperty("--stage-dock", `${n}px`);
|
|
2747
|
+
let r = () => o({
|
|
2748
|
+
width: Math.max(1, t.clientWidth - oa * 2),
|
|
2749
|
+
height: Math.max(1, t.clientHeight - oa - n)
|
|
2818
2750
|
});
|
|
2819
|
-
|
|
2820
|
-
let
|
|
2821
|
-
return
|
|
2822
|
-
}, [e]);
|
|
2823
|
-
let
|
|
2824
|
-
r.fitRef.current =
|
|
2825
|
-
let
|
|
2751
|
+
r();
|
|
2752
|
+
let a = new ResizeObserver(r);
|
|
2753
|
+
return a.observe(t), () => a.disconnect();
|
|
2754
|
+
}, [e, i]);
|
|
2755
|
+
let s = a && t && t.width > 0 && t.height > 0 ? Math.min(la, a.width / t.width, a.height / t.height) : 1;
|
|
2756
|
+
r.fitRef.current = s;
|
|
2757
|
+
let c = p(r.zoomBy);
|
|
2826
2758
|
return O(() => {
|
|
2827
2759
|
let t = e.current;
|
|
2828
2760
|
if (!t) return;
|
|
2829
2761
|
let n = (e) => {
|
|
2830
|
-
!e.ctrlKey && !e.metaKey || (e.preventDefault(),
|
|
2762
|
+
!e.ctrlKey && !e.metaKey || (e.preventDefault(), c.current(Math.exp(-e.deltaY * .01)));
|
|
2831
2763
|
};
|
|
2832
2764
|
return t.addEventListener("wheel", n, { passive: !1 }), () => t.removeEventListener("wheel", n);
|
|
2833
|
-
}, [e,
|
|
2765
|
+
}, [e, c]), n ?? s;
|
|
2834
2766
|
}
|
|
2835
2767
|
//#endregion
|
|
2836
2768
|
//#region lib/components/ui/media/image-editor/image-editor.stage-paint.ts
|
|
2837
|
-
var
|
|
2838
|
-
function
|
|
2769
|
+
var da = 4096;
|
|
2770
|
+
function fa(e, t, n, r) {
|
|
2839
2771
|
let i = K(e, t.transform.quarterTurns), a = n === "crop" ? t.crop : {
|
|
2840
2772
|
w: 1,
|
|
2841
2773
|
h: 1
|
|
2842
2774
|
}, o = a.w * i.width, s = Math.max(o, a.h * i.height), c = r * (typeof window > "u" ? 1 : window.devicePixelRatio || 1) / o;
|
|
2843
|
-
return Math.max(.01, Math.min(1, c,
|
|
2775
|
+
return Math.max(.01, Math.min(1, c, da / s));
|
|
2776
|
+
}
|
|
2777
|
+
function pa(e, t, n, r) {
|
|
2778
|
+
if (r <= 0) return 0;
|
|
2779
|
+
let i = K(e, t.transform.quarterTurns);
|
|
2780
|
+
return 24 * ((n === "crop" ? t.crop.w : 1) * i.width) / r;
|
|
2844
2781
|
}
|
|
2845
|
-
function
|
|
2846
|
-
let r =
|
|
2782
|
+
function ma(e, t, n) {
|
|
2783
|
+
let r = Wn(t, n), i = 6 / e.getTransform().a;
|
|
2847
2784
|
e.save(), e.lineWidth = 1.5 / e.getTransform().a, e.setLineDash([6 / e.getTransform().a, 4 / e.getTransform().a]), e.strokeStyle = "#ffffff", e.shadowColor = "rgba(0,0,0,0.6)", e.shadowBlur = 3, e.strokeRect(r.x * n.width - i, r.y * n.height - i, r.w * n.width + i * 2, r.h * n.height + i * 2), e.restore();
|
|
2848
2785
|
}
|
|
2849
|
-
function
|
|
2850
|
-
let { source: a, edits: o, region: s, scale: c, comparing: l, hiddenId: u, selectedId: d } = r;
|
|
2786
|
+
function ha(e, t, n, r, i) {
|
|
2787
|
+
let { source: a, edits: o, region: s, scale: c, comparing: l, hiddenId: u, selectedId: d, stepFloor: f } = r;
|
|
2851
2788
|
if (e.width !== t.width && (e.width = t.width), e.height !== t.height && (e.height = t.height), n.setTransform(1, 0, 0, 1, 0, 0), n.clearRect(0, 0, e.width, e.height), n.drawImage(t, 0, 0), l) return;
|
|
2852
|
-
let
|
|
2853
|
-
|
|
2789
|
+
let p = Yn(o.annotations, u), m = i ? [...p.filter((e) => e.id !== i.id), i] : p;
|
|
2790
|
+
Rr(n, a, {
|
|
2854
2791
|
...o,
|
|
2855
|
-
annotations:
|
|
2792
|
+
annotations: m
|
|
2856
2793
|
}, {
|
|
2857
2794
|
scale: c,
|
|
2858
|
-
region: s
|
|
2795
|
+
region: s,
|
|
2796
|
+
stepFloor: f
|
|
2859
2797
|
});
|
|
2860
|
-
let
|
|
2861
|
-
if (!
|
|
2862
|
-
let
|
|
2798
|
+
let h = p.find((e) => e.id === d);
|
|
2799
|
+
if (!h) return;
|
|
2800
|
+
let g = {
|
|
2801
|
+
...K(a, o.transform.quarterTurns),
|
|
2802
|
+
stepFloor: f
|
|
2803
|
+
}, _ = s === "crop" ? o.crop : {
|
|
2863
2804
|
x: 0,
|
|
2864
2805
|
y: 0
|
|
2865
2806
|
};
|
|
2866
|
-
n.setTransform(c, 0, 0, c, -
|
|
2807
|
+
n.setTransform(c, 0, 0, c, -_.x * g.width * c, -_.y * g.height * c), ma(n, h, g);
|
|
2867
2808
|
}
|
|
2868
2809
|
//#endregion
|
|
2869
2810
|
//#region lib/components/ui/media/image-editor/use-stage-layer-key.ts
|
|
2870
|
-
function
|
|
2811
|
+
function ga(e, t, n, r) {
|
|
2871
2812
|
let { adjustments: i, filter: a, filterIntensity: o, transform: s, crop: c } = e;
|
|
2872
2813
|
return A(() => JSON.stringify([
|
|
2873
2814
|
i,
|
|
@@ -2891,22 +2832,24 @@ function ba(e, t, n, r) {
|
|
|
2891
2832
|
}
|
|
2892
2833
|
//#endregion
|
|
2893
2834
|
//#region lib/components/ui/media/image-editor/use-stage-render.ts
|
|
2894
|
-
function
|
|
2895
|
-
let u = j(null), d = j(0), f =
|
|
2835
|
+
function _a({ canvasRef: e, source: t, edits: n, region: r, displayWidth: i, comparing: a, selectedId: o, hiddenId: s = null, active: c = !0, mountKey: l }) {
|
|
2836
|
+
let u = j(null), d = j(0), f = fa(t, n, r, i), p = pa(t, n, r, i), m = ga(n, r, f, a), h = D((i) => {
|
|
2896
2837
|
let c = e.current, l = u.current, d = c?.getContext("2d");
|
|
2897
|
-
!c || !l || !d ||
|
|
2838
|
+
!c || !l || !d || ha(c, l, d, {
|
|
2898
2839
|
source: t,
|
|
2899
2840
|
edits: n,
|
|
2900
2841
|
region: r,
|
|
2901
2842
|
scale: f,
|
|
2902
2843
|
comparing: a,
|
|
2903
2844
|
hiddenId: s,
|
|
2904
|
-
selectedId: o
|
|
2845
|
+
selectedId: o,
|
|
2846
|
+
stepFloor: p
|
|
2905
2847
|
}, i);
|
|
2906
2848
|
}, [
|
|
2907
2849
|
e,
|
|
2908
2850
|
a,
|
|
2909
2851
|
n,
|
|
2852
|
+
p,
|
|
2910
2853
|
s,
|
|
2911
2854
|
r,
|
|
2912
2855
|
f,
|
|
@@ -2915,32 +2858,32 @@ function xa({ canvasRef: e, source: t, edits: n, region: r, displayWidth: i, com
|
|
|
2915
2858
|
]);
|
|
2916
2859
|
return O(() => {
|
|
2917
2860
|
if (cancelAnimationFrame(d.current), c) return d.current = requestAnimationFrame(() => {
|
|
2918
|
-
u.current =
|
|
2861
|
+
u.current = zr(t, n, {
|
|
2919
2862
|
scale: f,
|
|
2920
2863
|
region: r,
|
|
2921
2864
|
edited: !a,
|
|
2922
2865
|
marks: !1,
|
|
2923
2866
|
target: u.current ?? void 0
|
|
2924
|
-
}),
|
|
2867
|
+
}), h();
|
|
2925
2868
|
}), () => cancelAnimationFrame(d.current);
|
|
2926
2869
|
}, [
|
|
2927
|
-
|
|
2870
|
+
m,
|
|
2928
2871
|
t,
|
|
2929
2872
|
c
|
|
2930
2873
|
]), O(() => {
|
|
2931
|
-
c &&
|
|
2874
|
+
c && h();
|
|
2932
2875
|
}, [
|
|
2933
|
-
|
|
2876
|
+
h,
|
|
2934
2877
|
c,
|
|
2935
2878
|
l
|
|
2936
2879
|
]), {
|
|
2937
|
-
paint:
|
|
2880
|
+
paint: h,
|
|
2938
2881
|
scale: f
|
|
2939
2882
|
};
|
|
2940
2883
|
}
|
|
2941
2884
|
//#endregion
|
|
2942
2885
|
//#region lib/components/ui/media/image-editor/use-crop-frame.ts
|
|
2943
|
-
function
|
|
2886
|
+
function va({ crop: e, base: t, ratio: n, actions: r }) {
|
|
2944
2887
|
let i = j(null), a = j(null), [o, s] = M(!1), [c, l] = M(!1), u = j(void 0);
|
|
2945
2888
|
return O(() => () => clearTimeout(u.current), []), {
|
|
2946
2889
|
layerRef: i,
|
|
@@ -2959,7 +2902,7 @@ function Sa({ crop: e, base: t, ratio: n, actions: r }) {
|
|
|
2959
2902
|
onPointerMove: (e) => {
|
|
2960
2903
|
let o = a.current, s = i.current?.getBoundingClientRect();
|
|
2961
2904
|
if (!o || !s) return;
|
|
2962
|
-
let c = (e.clientX - o.x) / Math.max(1, s.width), l = (e.clientY - o.y) / Math.max(1, s.height), u =
|
|
2905
|
+
let c = (e.clientX - o.x) / Math.max(1, s.width), l = (e.clientY - o.y) / Math.max(1, s.height), u = Ln(o.crop, o.handle, c, l, n, t);
|
|
2963
2906
|
r.setCrop({
|
|
2964
2907
|
rect: u,
|
|
2965
2908
|
gesture: o.gesture
|
|
@@ -2977,7 +2920,7 @@ function Sa({ crop: e, base: t, ratio: n, actions: r }) {
|
|
|
2977
2920
|
}[i.key];
|
|
2978
2921
|
if (!o) return;
|
|
2979
2922
|
i.preventDefault(), l(!0), clearTimeout(u.current), u.current = setTimeout(() => l(!1), 800);
|
|
2980
|
-
let s = i.shiftKey ? "se" : "move", c =
|
|
2923
|
+
let s = i.shiftKey ? "se" : "move", c = Ln(e, s, o[0], o[1], n, t);
|
|
2981
2924
|
r.setCrop({
|
|
2982
2925
|
rect: c,
|
|
2983
2926
|
gesture: `crop-key:${s}`
|
|
@@ -2987,7 +2930,7 @@ function Sa({ crop: e, base: t, ratio: n, actions: r }) {
|
|
|
2987
2930
|
}
|
|
2988
2931
|
//#endregion
|
|
2989
2932
|
//#region lib/components/ui/media/image-editor/partials/crop-handles.ts
|
|
2990
|
-
var
|
|
2933
|
+
var ya = [
|
|
2991
2934
|
{
|
|
2992
2935
|
handle: "nw",
|
|
2993
2936
|
className: "top-0 left-0 cursor-nwse-resize rounded-tl-[3px] border-t-[3px] border-l-[3px]"
|
|
@@ -3023,7 +2966,7 @@ var Ca = [
|
|
|
3023
2966
|
];
|
|
3024
2967
|
//#endregion
|
|
3025
2968
|
//#region lib/components/ui/media/image-editor/partials/crop-readout.tsx
|
|
3026
|
-
function
|
|
2969
|
+
function ba({ crop: e, base: t, polite: n }) {
|
|
3027
2970
|
return /* @__PURE__ */ F("output", {
|
|
3028
2971
|
"data-slot": "image-editor-crop-readout",
|
|
3029
2972
|
"aria-live": n ? "polite" : "off",
|
|
@@ -3037,13 +2980,13 @@ function wa({ crop: e, base: t, polite: n }) {
|
|
|
3037
2980
|
}
|
|
3038
2981
|
//#endregion
|
|
3039
2982
|
//#region lib/components/ui/media/image-editor/partials/editor-crop-overlay.tsx
|
|
3040
|
-
var
|
|
3041
|
-
function
|
|
3042
|
-
let { base: e } =
|
|
3043
|
-
return e ? /* @__PURE__ */ P(
|
|
2983
|
+
var xa = (e) => `${e * 100}%`;
|
|
2984
|
+
function Sa() {
|
|
2985
|
+
let { base: e } = R();
|
|
2986
|
+
return e ? /* @__PURE__ */ P(Ca, { base: e }) : null;
|
|
3044
2987
|
}
|
|
3045
|
-
function
|
|
3046
|
-
let { state: t, actions: n, lockedAspect: r } =
|
|
2988
|
+
function Ca({ base: e }) {
|
|
2989
|
+
let { state: t, actions: n, lockedAspect: r } = R(), { t: a } = i(), o = k(), s = t.edits.crop, c = r ?? t.aspect, { layerRef: l, dragging: u, keying: d, setKeying: f, begin: p, onPointerMove: m, end: h, onKeyDown: g } = va({
|
|
3047
2990
|
crop: s,
|
|
3048
2991
|
base: e,
|
|
3049
2992
|
ratio: c === "original" ? e.width / e.height : c ?? null,
|
|
@@ -3065,10 +3008,10 @@ function Da({ base: e }) {
|
|
|
3065
3008
|
"data-dragging": u || void 0,
|
|
3066
3009
|
className: "nxgt-image-editor-crop absolute cursor-move outline-offset-2 focus-visible:outline-[3px] focus-visible:outline-ring/60",
|
|
3067
3010
|
style: {
|
|
3068
|
-
left:
|
|
3069
|
-
top:
|
|
3070
|
-
width:
|
|
3071
|
-
height:
|
|
3011
|
+
left: xa(s.x),
|
|
3012
|
+
top: xa(s.y),
|
|
3013
|
+
width: xa(s.w),
|
|
3014
|
+
height: xa(s.h)
|
|
3072
3015
|
},
|
|
3073
3016
|
onPointerDown: p("move"),
|
|
3074
3017
|
onKeyDown: g,
|
|
@@ -3083,12 +3026,12 @@ function Da({ base: e }) {
|
|
|
3083
3026
|
children: a("material.image-editor.crop.frame-hint", "Arrows move it, Shift + arrows resize it")
|
|
3084
3027
|
}),
|
|
3085
3028
|
/* @__PURE__ */ P("div", { className: "nxgt-image-editor-crop-grid pointer-events-none absolute inset-0" }),
|
|
3086
|
-
(u || d) && /* @__PURE__ */ P(
|
|
3029
|
+
(u || d) && /* @__PURE__ */ P(ba, {
|
|
3087
3030
|
crop: s,
|
|
3088
3031
|
base: e,
|
|
3089
3032
|
polite: d && !u
|
|
3090
3033
|
}),
|
|
3091
|
-
|
|
3034
|
+
ya.map(({ handle: e, className: t }) => /* @__PURE__ */ P("span", {
|
|
3092
3035
|
"aria-hidden": "true",
|
|
3093
3036
|
"data-handle": e,
|
|
3094
3037
|
onPointerDown: p(e),
|
|
@@ -3099,9 +3042,159 @@ function Da({ base: e }) {
|
|
|
3099
3042
|
});
|
|
3100
3043
|
}
|
|
3101
3044
|
//#endregion
|
|
3045
|
+
//#region lib/components/ui/media/image-editor/partials/editor-crop-strip.tsx
|
|
3046
|
+
function wa() {
|
|
3047
|
+
let { state: e, actions: t, lockedAspect: n, aspectPresets: r } = R(), { t: a } = i(), { transform: o, crop: s } = e.edits, c = s.x === H.x && s.y === H.y && s.w === H.w && s.h === H.h, l = n === void 0 && r.length > 0;
|
|
3048
|
+
return /* @__PURE__ */ F("section", {
|
|
3049
|
+
"aria-label": a("material.image-editor.panel.crop", "Crop & rotate"),
|
|
3050
|
+
"data-slot": "image-editor-crop-card",
|
|
3051
|
+
className: "pointer-events-auto flex w-full max-w-3xl flex-col gap-2 rounded-2xl border bg-card p-2 shadow-lg",
|
|
3052
|
+
children: [/* @__PURE__ */ F("div", {
|
|
3053
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-1",
|
|
3054
|
+
children: [/* @__PURE__ */ P(ki, { compact: !0 }), /* @__PURE__ */ P(f, {
|
|
3055
|
+
variant: "tonal",
|
|
3056
|
+
color: "default",
|
|
3057
|
+
tooltip: a("material.image-editor.crop.reset", "Reset crop & rotation"),
|
|
3058
|
+
disabled: zn(o) && c,
|
|
3059
|
+
onClick: () => t.resetTransform(),
|
|
3060
|
+
children: /* @__PURE__ */ P(Be, {})
|
|
3061
|
+
})]
|
|
3062
|
+
}), l && /* @__PURE__ */ P("div", {
|
|
3063
|
+
className: "hidden @md:block",
|
|
3064
|
+
children: /* @__PURE__ */ P(Di, { compact: !0 })
|
|
3065
|
+
})]
|
|
3066
|
+
});
|
|
3067
|
+
}
|
|
3068
|
+
//#endregion
|
|
3069
|
+
//#region lib/components/ui/media/image-editor/partials/use-scroll-edges.ts
|
|
3070
|
+
function Ta(e) {
|
|
3071
|
+
let [t, n] = M({
|
|
3072
|
+
start: !1,
|
|
3073
|
+
end: !1
|
|
3074
|
+
});
|
|
3075
|
+
return O(() => {
|
|
3076
|
+
let t = e.current;
|
|
3077
|
+
if (!t) return;
|
|
3078
|
+
let r = () => {
|
|
3079
|
+
let e = t.scrollLeft > 1, r = t.scrollLeft + t.clientWidth < t.scrollWidth - 1;
|
|
3080
|
+
n((t) => t.start === e && t.end === r ? t : {
|
|
3081
|
+
start: e,
|
|
3082
|
+
end: r
|
|
3083
|
+
});
|
|
3084
|
+
};
|
|
3085
|
+
r(), t.addEventListener("scroll", r, { passive: !0 });
|
|
3086
|
+
let i = new ResizeObserver(r);
|
|
3087
|
+
i.observe(t);
|
|
3088
|
+
for (let e of Array.from(t.children)) i.observe(e);
|
|
3089
|
+
return () => {
|
|
3090
|
+
t.removeEventListener("scroll", r), i.disconnect();
|
|
3091
|
+
};
|
|
3092
|
+
}, [e]), t;
|
|
3093
|
+
}
|
|
3094
|
+
function Ea({ start: e, end: t }) {
|
|
3095
|
+
if (!e && !t) return;
|
|
3096
|
+
let n = `linear-gradient(to right, ${e ? "transparent" : "#000"}, #000 28px, #000 calc(100% - 28px), ${t ? "transparent" : "#000"})`;
|
|
3097
|
+
return {
|
|
3098
|
+
maskImage: n,
|
|
3099
|
+
WebkitMaskImage: n
|
|
3100
|
+
};
|
|
3101
|
+
}
|
|
3102
|
+
//#endregion
|
|
3103
|
+
//#region lib/components/ui/media/image-editor/partials/editor-floating-toolbar.tsx
|
|
3104
|
+
function Da({ label: e, icon: t, showLabel: n, className: r, ...i }) {
|
|
3105
|
+
return /* @__PURE__ */ F("button", {
|
|
3106
|
+
type: "button",
|
|
3107
|
+
"aria-label": e,
|
|
3108
|
+
title: e,
|
|
3109
|
+
className: T("inline-flex h-10 min-w-10 shrink-0 cursor-pointer items-center justify-center gap-2 rounded-full text-white/85 outline-none transition-[background-color,color,padding] hover:bg-white/10 hover:text-white focus-visible:ring-[3px] focus-visible:ring-white/50 disabled:pointer-events-none disabled:opacity-40 aria-pressed:bg-primary aria-pressed:text-primary-foreground [&_svg]:size-[18px]", n ? "px-4" : "px-0", r),
|
|
3110
|
+
...i,
|
|
3111
|
+
children: [t, n && /* @__PURE__ */ P("span", {
|
|
3112
|
+
"aria-hidden": "true",
|
|
3113
|
+
className: "font-medium text-sm",
|
|
3114
|
+
children: e
|
|
3115
|
+
})]
|
|
3116
|
+
});
|
|
3117
|
+
}
|
|
3118
|
+
var Oa = () => /* @__PURE__ */ P("span", {
|
|
3119
|
+
"aria-hidden": "true",
|
|
3120
|
+
className: "mx-1 h-5 w-px shrink-0 bg-white/15"
|
|
3121
|
+
});
|
|
3122
|
+
function ka() {
|
|
3123
|
+
let { state: e, actions: t, tools: n, markupTools: r } = R(), { t: a } = i(), o = r ? r.flatMap((e) => Ti.filter((t) => t.tool === e)) : Ti;
|
|
3124
|
+
return /* @__PURE__ */ F(N, { children: [n.includes("crop") && /* @__PURE__ */ P(Da, {
|
|
3125
|
+
label: a("material.image-editor.tool.crop", "Crop"),
|
|
3126
|
+
icon: /* @__PURE__ */ P(Te, { "aria-hidden": "true" }),
|
|
3127
|
+
showLabel: e.tool === "crop",
|
|
3128
|
+
"aria-pressed": e.tool === "crop",
|
|
3129
|
+
onClick: () => t.setTool("crop")
|
|
3130
|
+
}), n.includes("markup") && o.map(({ tool: n, icon: r, label: i }) => {
|
|
3131
|
+
let o = e.tool === "markup" && e.markupTool === n;
|
|
3132
|
+
return /* @__PURE__ */ P(Da, {
|
|
3133
|
+
label: a(`material.image-editor.markup.tool.${n}`, i),
|
|
3134
|
+
icon: /* @__PURE__ */ P(r, { "aria-hidden": "true" }),
|
|
3135
|
+
showLabel: o,
|
|
3136
|
+
"aria-pressed": o,
|
|
3137
|
+
onClick: () => {
|
|
3138
|
+
t.setTool("markup"), t.setMarkupTool(n);
|
|
3139
|
+
}
|
|
3140
|
+
}, n);
|
|
3141
|
+
})] });
|
|
3142
|
+
}
|
|
3143
|
+
function Aa() {
|
|
3144
|
+
let { actions: e, selected: t, canUndo: n, canRedo: r } = R(), { t: a } = i();
|
|
3145
|
+
return /* @__PURE__ */ F(N, { children: [
|
|
3146
|
+
t && /* @__PURE__ */ P(Da, {
|
|
3147
|
+
label: a("material.image-editor.markup.delete", "Delete"),
|
|
3148
|
+
icon: /* @__PURE__ */ P(Je, { "aria-hidden": "true" }),
|
|
3149
|
+
onClick: () => e.removeAnnotation(t.id)
|
|
3150
|
+
}),
|
|
3151
|
+
/* @__PURE__ */ P(Da, {
|
|
3152
|
+
label: a("material.image-editor.undo", "Undo"),
|
|
3153
|
+
icon: /* @__PURE__ */ P(Xe, { "aria-hidden": "true" }),
|
|
3154
|
+
disabled: !n,
|
|
3155
|
+
onClick: () => e.undo()
|
|
3156
|
+
}),
|
|
3157
|
+
/* @__PURE__ */ P(Da, {
|
|
3158
|
+
label: a("material.image-editor.redo", "Redo"),
|
|
3159
|
+
icon: /* @__PURE__ */ P(ze, { "aria-hidden": "true" }),
|
|
3160
|
+
disabled: !r,
|
|
3161
|
+
onClick: () => e.redo()
|
|
3162
|
+
})
|
|
3163
|
+
] });
|
|
3164
|
+
}
|
|
3165
|
+
function ja() {
|
|
3166
|
+
let { source: e } = R();
|
|
3167
|
+
return e.status === "ready" ? /* @__PURE__ */ P(Ma, {}) : null;
|
|
3168
|
+
}
|
|
3169
|
+
function Ma() {
|
|
3170
|
+
let { state: e, actions: t, tools: n, colors: r } = R(), { t: a } = i(), o = j(null), s = Ta(o);
|
|
3171
|
+
return /* @__PURE__ */ F("div", {
|
|
3172
|
+
ref: o,
|
|
3173
|
+
role: "toolbar",
|
|
3174
|
+
"aria-label": a("material.image-editor.floating-tools", "Editing tools"),
|
|
3175
|
+
style: Ea(s),
|
|
3176
|
+
"data-slot": "image-editor-floating-toolbar",
|
|
3177
|
+
className: "nxgt-image-editor-glass dark pointer-events-auto flex max-w-full items-center gap-1 overflow-x-auto rounded-full p-1.5",
|
|
3178
|
+
children: [
|
|
3179
|
+
/* @__PURE__ */ P(ka, {}),
|
|
3180
|
+
n.includes("markup") && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(Oa, {}), /* @__PURE__ */ P(Hi, {
|
|
3181
|
+
colors: r.slice(0, 5),
|
|
3182
|
+
size: "xs",
|
|
3183
|
+
custom: !0,
|
|
3184
|
+
className: "shrink-0 px-1",
|
|
3185
|
+
label: a("material.image-editor.markup.color", "Colour"),
|
|
3186
|
+
value: e.brush.color,
|
|
3187
|
+
onChange: (e) => t.setBrush({ color: e })
|
|
3188
|
+
})] }),
|
|
3189
|
+
/* @__PURE__ */ P(Oa, {}),
|
|
3190
|
+
/* @__PURE__ */ P(Aa, {})
|
|
3191
|
+
]
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
//#endregion
|
|
3102
3195
|
//#region lib/components/ui/media/image-editor/use-markup-text.ts
|
|
3103
|
-
function
|
|
3104
|
-
let { state: e, actions: t } =
|
|
3196
|
+
function Na() {
|
|
3197
|
+
let { state: e, actions: t } = R(), [n, r] = M(null), { brush: i, edits: a } = e, o = n?.id ?? null, { setEditingId: s } = t;
|
|
3105
3198
|
return O(() => (s(o), () => s(null)), [o, s]), {
|
|
3106
3199
|
draft: n,
|
|
3107
3200
|
setDraft: r,
|
|
@@ -3113,7 +3206,7 @@ function Oa() {
|
|
|
3113
3206
|
...s,
|
|
3114
3207
|
text: e
|
|
3115
3208
|
} }) : t.addAnnotation({
|
|
3116
|
-
id:
|
|
3209
|
+
id: Jn(),
|
|
3117
3210
|
kind: "text",
|
|
3118
3211
|
x: o.x,
|
|
3119
3212
|
y: o.y,
|
|
@@ -3127,9 +3220,9 @@ function Oa() {
|
|
|
3127
3220
|
}
|
|
3128
3221
|
//#endregion
|
|
3129
3222
|
//#region lib/components/ui/media/image-editor/image-editor.stage-gestures.ts
|
|
3130
|
-
function
|
|
3223
|
+
function Pa(e, t, n) {
|
|
3131
3224
|
let r = {
|
|
3132
|
-
id:
|
|
3225
|
+
id: Jn(),
|
|
3133
3226
|
color: n.color,
|
|
3134
3227
|
size: n.size
|
|
3135
3228
|
};
|
|
@@ -3163,7 +3256,18 @@ function ka(e, t, n) {
|
|
|
3163
3256
|
h: 0
|
|
3164
3257
|
} : null;
|
|
3165
3258
|
}
|
|
3166
|
-
function
|
|
3259
|
+
function Fa(e, t) {
|
|
3260
|
+
return {
|
|
3261
|
+
id: Jn(),
|
|
3262
|
+
kind: "step",
|
|
3263
|
+
color: t.color,
|
|
3264
|
+
size: t.size,
|
|
3265
|
+
x: e.x,
|
|
3266
|
+
y: e.y,
|
|
3267
|
+
n: 0
|
|
3268
|
+
};
|
|
3269
|
+
}
|
|
3270
|
+
function Ia(e, t, n) {
|
|
3167
3271
|
switch (e.kind) {
|
|
3168
3272
|
case "pen":
|
|
3169
3273
|
case "highlighter": return {
|
|
@@ -3184,17 +3288,17 @@ function Aa(e, t, n) {
|
|
|
3184
3288
|
case "ellipse":
|
|
3185
3289
|
case "redact": return {
|
|
3186
3290
|
...e,
|
|
3187
|
-
...
|
|
3291
|
+
...Nn(t.x, t.y, n.x, n.y)
|
|
3188
3292
|
};
|
|
3189
3293
|
default: return e;
|
|
3190
3294
|
}
|
|
3191
3295
|
}
|
|
3192
|
-
function
|
|
3296
|
+
function La(e) {
|
|
3193
3297
|
return e.kind === "line" || e.kind === "arrow" ? Math.hypot(e.x2 - e.x1, e.y2 - e.y1) > .005 : e.kind === "rect" || e.kind === "ellipse" || e.kind === "redact" ? e.w > .005 && e.h > .005 : !0;
|
|
3194
3298
|
}
|
|
3195
|
-
function
|
|
3299
|
+
function Ra(e, t) {
|
|
3196
3300
|
if (e.tool === "select") {
|
|
3197
|
-
let n =
|
|
3301
|
+
let n = Y(e.annotations, t.x, t.y, e.base);
|
|
3198
3302
|
return e.select(n?.id ?? null), n ? {
|
|
3199
3303
|
kind: "move",
|
|
3200
3304
|
id: n.id,
|
|
@@ -3203,18 +3307,27 @@ function Ma(e, t) {
|
|
|
3203
3307
|
} : null;
|
|
3204
3308
|
}
|
|
3205
3309
|
if (e.tool === "eraser") {
|
|
3206
|
-
let n =
|
|
3310
|
+
let n = Y(e.annotations, t.x, t.y, e.base);
|
|
3207
3311
|
return n && e.remove(n.id), { kind: "erase" };
|
|
3208
3312
|
}
|
|
3209
3313
|
if (e.tool === "text") {
|
|
3210
|
-
let n =
|
|
3314
|
+
let n = Y(e.annotations, t.x, t.y, e.base);
|
|
3211
3315
|
return {
|
|
3212
3316
|
kind: "text",
|
|
3213
3317
|
at: t,
|
|
3214
3318
|
mark: n?.kind === "text" ? n : void 0
|
|
3215
3319
|
};
|
|
3216
3320
|
}
|
|
3217
|
-
|
|
3321
|
+
if (e.tool === "step") {
|
|
3322
|
+
let n = Y(e.annotations, t.x, t.y, e.base);
|
|
3323
|
+
return n?.kind === "step" ? (e.select(n.id), {
|
|
3324
|
+
kind: "move",
|
|
3325
|
+
id: n.id,
|
|
3326
|
+
last: t,
|
|
3327
|
+
gesture: `move:${n.id}:${Date.now()}`
|
|
3328
|
+
}) : (e.add(Fa(t, e.brush)), { kind: "place" });
|
|
3329
|
+
}
|
|
3330
|
+
let n = Pa(e.tool, t, e.brush);
|
|
3218
3331
|
return n ? {
|
|
3219
3332
|
kind: "draw",
|
|
3220
3333
|
mark: n,
|
|
@@ -3223,7 +3336,7 @@ function Ma(e, t) {
|
|
|
3223
3336
|
}
|
|
3224
3337
|
//#endregion
|
|
3225
3338
|
//#region lib/components/ui/media/image-editor/use-stage-pointer.ts
|
|
3226
|
-
function
|
|
3339
|
+
function za(e) {
|
|
3227
3340
|
let t = j(null), n = e, r = (e) => {
|
|
3228
3341
|
let t = e.currentTarget.getBoundingClientRect(), r = (e.clientX - t.left) / Math.max(1, t.width), i = (e.clientY - t.top) / Math.max(1, t.height);
|
|
3229
3342
|
return {
|
|
@@ -3231,20 +3344,20 @@ function Na(e) {
|
|
|
3231
3344
|
y: n.view.y + i * n.view.h
|
|
3232
3345
|
};
|
|
3233
3346
|
}, i = (e) => {
|
|
3234
|
-
let t =
|
|
3347
|
+
let t = Y(n.annotations, e.x, e.y, n.base);
|
|
3235
3348
|
t && n.remove(t.id);
|
|
3236
3349
|
}, a = (e) => {
|
|
3237
3350
|
if (e.button !== 0) return;
|
|
3238
3351
|
let i = r(e);
|
|
3239
|
-
e.currentTarget.setPointerCapture?.(e.pointerId), t.current =
|
|
3352
|
+
e.currentTarget.setPointerCapture?.(e.pointerId), t.current = Ra(n, i);
|
|
3240
3353
|
}, o = (e) => {
|
|
3241
3354
|
let a = t.current;
|
|
3242
|
-
if (!a || a.kind === "text") return;
|
|
3355
|
+
if (!a || a.kind === "text" || a.kind === "place") return;
|
|
3243
3356
|
let o = r(e);
|
|
3244
|
-
a.kind === "erase" ? i(o) : a.kind === "move" ? (n.move(a.id, o.x - a.last.x, o.y - a.last.y, a.gesture), a.last = o) : (a.mark =
|
|
3357
|
+
a.kind === "erase" ? i(o) : a.kind === "move" ? (n.move(a.id, o.x - a.last.x, o.y - a.last.y, a.gesture), a.last = o) : (a.mark = Ia(a.mark, a.start, o), n.paint(a.mark));
|
|
3245
3358
|
}, s = (e) => {
|
|
3246
3359
|
let r = t.current;
|
|
3247
|
-
t.current = null, r?.kind === "text" && e.type === "pointerup" && n.editText(r.at, r.mark), r?.kind === "draw" &&
|
|
3360
|
+
t.current = null, r?.kind === "text" && e.type === "pointerup" && n.editText(r.at, r.mark), r?.kind === "draw" && La(r.mark) ? n.add(r.mark) : r?.kind === "draw" && n.paint(), r?.kind === "move" && n.endGesture();
|
|
3248
3361
|
};
|
|
3249
3362
|
return {
|
|
3250
3363
|
onPointerDown: a,
|
|
@@ -3253,7 +3366,7 @@ function Na(e) {
|
|
|
3253
3366
|
onPointerCancel: s,
|
|
3254
3367
|
onDoubleClick: (e) => {
|
|
3255
3368
|
if (n.tool !== "select") return;
|
|
3256
|
-
let t = r(e), i =
|
|
3369
|
+
let t = r(e), i = Y(n.annotations, t.x, t.y, n.base);
|
|
3257
3370
|
i?.kind === "text" && n.editText({
|
|
3258
3371
|
x: i.x,
|
|
3259
3372
|
y: i.y
|
|
@@ -3263,9 +3376,9 @@ function Na(e) {
|
|
|
3263
3376
|
}
|
|
3264
3377
|
//#endregion
|
|
3265
3378
|
//#region lib/components/ui/media/image-editor/partials/editor-text-box.tsx
|
|
3266
|
-
var
|
|
3267
|
-
function
|
|
3268
|
-
let { t: s } = i(), [c, l] = M(e.text), u = j(null), d = j(!1), f =
|
|
3379
|
+
var Ba = (e) => `${e * 100}%`;
|
|
3380
|
+
function Va({ draft: e, view: t, base: n, scale: r, onCommit: a, onCancel: o }) {
|
|
3381
|
+
let { t: s } = i(), [c, l] = M(e.text), u = j(null), d = j(!1), f = Un(e.size, n) * r, p = c.split("\n");
|
|
3269
3382
|
O(() => {
|
|
3270
3383
|
u.current?.focus();
|
|
3271
3384
|
}, []);
|
|
@@ -3285,10 +3398,10 @@ function Fa({ draft: e, view: t, base: n, scale: r, onCommit: a, onCancel: o })
|
|
|
3285
3398
|
onKeyDown: (e) => {
|
|
3286
3399
|
e.stopPropagation(), e.key === "Escape" ? (d.current = !0, o()) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), m());
|
|
3287
3400
|
},
|
|
3288
|
-
className: T("absolute z-10 resize-none overflow-hidden rounded-sm border border-white/80 border-dashed p-0 font-semibold leading-tight outline-none ring-2 ring-black/40",
|
|
3401
|
+
className: T("absolute z-10 resize-none overflow-hidden rounded-sm border border-white/80 border-dashed p-0 font-semibold leading-tight outline-none ring-2 ring-black/40", ur(e.color) ? "bg-black/55" : "bg-white/85"),
|
|
3289
3402
|
style: {
|
|
3290
|
-
left:
|
|
3291
|
-
top:
|
|
3403
|
+
left: Ba((e.x - t.x) / t.w),
|
|
3404
|
+
top: Ba((e.y - t.y) / t.h),
|
|
3292
3405
|
color: e.color,
|
|
3293
3406
|
fontSize: f,
|
|
3294
3407
|
fontFamily: "Inter, \"Segoe UI\", system-ui, sans-serif"
|
|
@@ -3297,7 +3410,7 @@ function Fa({ draft: e, view: t, base: n, scale: r, onCommit: a, onCancel: o })
|
|
|
3297
3410
|
}
|
|
3298
3411
|
//#endregion
|
|
3299
3412
|
//#region lib/components/ui/media/image-editor/partials/editor-markup-layer.tsx
|
|
3300
|
-
var
|
|
3413
|
+
var Ha = {
|
|
3301
3414
|
select: "cursor-default",
|
|
3302
3415
|
pen: "cursor-crosshair",
|
|
3303
3416
|
highlighter: "cursor-crosshair",
|
|
@@ -3307,15 +3420,19 @@ var Ia = {
|
|
|
3307
3420
|
rect: "cursor-crosshair",
|
|
3308
3421
|
ellipse: "cursor-crosshair",
|
|
3309
3422
|
text: "cursor-text",
|
|
3423
|
+
step: "cursor-crosshair",
|
|
3310
3424
|
redact: "cursor-crosshair"
|
|
3311
|
-
},
|
|
3312
|
-
function
|
|
3313
|
-
let { state: t, actions: n, base: r, view: i, scale: a } =
|
|
3425
|
+
}, Ua = "[data-slot=\"image-editor-text-box\"]";
|
|
3426
|
+
function Wa({ paint: e }) {
|
|
3427
|
+
let { state: t, actions: n, base: r, view: i, scale: a } = R(), { draft: o, setDraft: s, commitText: c } = Na(), l = j(null), { brush: u, markupTool: d, edits: f } = t, p = za({
|
|
3314
3428
|
tool: d,
|
|
3315
3429
|
brush: u,
|
|
3316
|
-
base:
|
|
3317
|
-
|
|
3318
|
-
|
|
3430
|
+
base: {
|
|
3431
|
+
...r ?? {
|
|
3432
|
+
width: 1,
|
|
3433
|
+
height: 1
|
|
3434
|
+
},
|
|
3435
|
+
stepFloor: 24 / a
|
|
3319
3436
|
},
|
|
3320
3437
|
view: i,
|
|
3321
3438
|
annotations: f.annotations,
|
|
@@ -3344,15 +3461,15 @@ function Ra({ paint: e }) {
|
|
|
3344
3461
|
ref: l,
|
|
3345
3462
|
"data-slot": "image-editor-markup-layer",
|
|
3346
3463
|
"data-tool": d,
|
|
3347
|
-
className: T("absolute inset-0 touch-none",
|
|
3464
|
+
className: T("absolute inset-0 touch-none", Ha[d]),
|
|
3348
3465
|
...p,
|
|
3349
3466
|
onPointerDown: (e) => {
|
|
3350
|
-
o && e.target === e.currentTarget && l.current?.querySelector(
|
|
3467
|
+
o && e.target === e.currentTarget && l.current?.querySelector(Ua)?.blur(), p.onPointerDown(e);
|
|
3351
3468
|
},
|
|
3352
3469
|
onMouseDown: (e) => {
|
|
3353
3470
|
d === "text" && e.target === e.currentTarget && e.preventDefault();
|
|
3354
3471
|
},
|
|
3355
|
-
children: o && /* @__PURE__ */ P(
|
|
3472
|
+
children: o && /* @__PURE__ */ P(Va, {
|
|
3356
3473
|
draft: o,
|
|
3357
3474
|
view: i,
|
|
3358
3475
|
base: r,
|
|
@@ -3364,7 +3481,7 @@ function Ra({ paint: e }) {
|
|
|
3364
3481
|
}
|
|
3365
3482
|
//#endregion
|
|
3366
3483
|
//#region lib/components/ui/media/image-editor/partials/editor-stage-dock.tsx
|
|
3367
|
-
function
|
|
3484
|
+
function Ga({ label: e, children: t, className: n, ...r }) {
|
|
3368
3485
|
return /* @__PURE__ */ P("button", {
|
|
3369
3486
|
type: "button",
|
|
3370
3487
|
"aria-label": e,
|
|
@@ -3374,8 +3491,8 @@ function za({ label: e, children: t, className: n, ...r }) {
|
|
|
3374
3491
|
children: t
|
|
3375
3492
|
});
|
|
3376
3493
|
}
|
|
3377
|
-
function
|
|
3378
|
-
let { state: e, actions: t, zoom: n, scale: r, source: a, canUndo: o } =
|
|
3494
|
+
function Ka() {
|
|
3495
|
+
let { state: e, actions: t, zoom: n, scale: r, source: a, canUndo: o } = R(), { t: s } = i();
|
|
3379
3496
|
if (a.status !== "ready") return null;
|
|
3380
3497
|
let c = Math.round(r * 100), l = e.zoom === null, u = () => t.setComparing(!1);
|
|
3381
3498
|
return /* @__PURE__ */ F("div", {
|
|
@@ -3384,11 +3501,11 @@ function Ba() {
|
|
|
3384
3501
|
"data-slot": "image-editor-dock",
|
|
3385
3502
|
className: "nxgt-image-editor-glass pointer-events-auto flex items-center gap-0.5 rounded-full p-1",
|
|
3386
3503
|
children: [
|
|
3387
|
-
/* @__PURE__ */ P(
|
|
3504
|
+
/* @__PURE__ */ P(Ga, {
|
|
3388
3505
|
label: s("material.image-editor.zoom-out", "Zoom out"),
|
|
3389
|
-
disabled: r <=
|
|
3506
|
+
disabled: r <= Sn,
|
|
3390
3507
|
onClick: () => n.zoomOut(),
|
|
3391
|
-
children: /* @__PURE__ */ P(
|
|
3508
|
+
children: /* @__PURE__ */ P(et, { "aria-hidden": "true" })
|
|
3392
3509
|
}),
|
|
3393
3510
|
/* @__PURE__ */ P("button", {
|
|
3394
3511
|
type: "button",
|
|
@@ -3400,24 +3517,24 @@ function Ba() {
|
|
|
3400
3517
|
children: [c, "%"]
|
|
3401
3518
|
})
|
|
3402
3519
|
}),
|
|
3403
|
-
/* @__PURE__ */ P(
|
|
3520
|
+
/* @__PURE__ */ P(Ga, {
|
|
3404
3521
|
label: s("material.image-editor.zoom-in", "Zoom in"),
|
|
3405
3522
|
disabled: r >= 8,
|
|
3406
3523
|
onClick: () => n.zoomIn(),
|
|
3407
|
-
children: /* @__PURE__ */ P(
|
|
3524
|
+
children: /* @__PURE__ */ P($e, { "aria-hidden": "true" })
|
|
3408
3525
|
}),
|
|
3409
3526
|
/* @__PURE__ */ P("span", {
|
|
3410
3527
|
"aria-hidden": "true",
|
|
3411
3528
|
className: "mx-1 h-5 w-px bg-white/15"
|
|
3412
3529
|
}),
|
|
3413
|
-
/* @__PURE__ */ P(
|
|
3530
|
+
/* @__PURE__ */ P(Ga, {
|
|
3414
3531
|
label: s("material.image-editor.split", "Before and after"),
|
|
3415
3532
|
"aria-pressed": e.split,
|
|
3416
3533
|
disabled: !o && !e.split,
|
|
3417
3534
|
onClick: () => t.setSplit(!e.split),
|
|
3418
|
-
children: /* @__PURE__ */ P(
|
|
3535
|
+
children: /* @__PURE__ */ P(Ce, { "aria-hidden": "true" })
|
|
3419
3536
|
}),
|
|
3420
|
-
/* @__PURE__ */ P(
|
|
3537
|
+
/* @__PURE__ */ P(Ga, {
|
|
3421
3538
|
label: s("material.image-editor.compare", "Hold to compare"),
|
|
3422
3539
|
"aria-pressed": e.comparing,
|
|
3423
3540
|
disabled: !o || e.split,
|
|
@@ -3429,49 +3546,49 @@ function Ba() {
|
|
|
3429
3546
|
},
|
|
3430
3547
|
onKeyUp: u,
|
|
3431
3548
|
onBlur: u,
|
|
3432
|
-
children: /* @__PURE__ */ P(
|
|
3549
|
+
children: /* @__PURE__ */ P(Oe, { "aria-hidden": "true" })
|
|
3433
3550
|
})
|
|
3434
3551
|
]
|
|
3435
3552
|
});
|
|
3436
3553
|
}
|
|
3437
3554
|
//#endregion
|
|
3438
3555
|
//#region lib/components/ui/media/image-editor/partials/editor-stage.tsx
|
|
3439
|
-
function
|
|
3440
|
-
let { source: e, stageRef: t, state: n } =
|
|
3556
|
+
function qa() {
|
|
3557
|
+
let { source: e, stageRef: t, state: n, toolbar: r } = R(), a = r === "floating", { t: o } = i();
|
|
3441
3558
|
return /* @__PURE__ */ F("div", {
|
|
3442
3559
|
className: "relative flex min-h-48 min-w-0 flex-1 flex-col",
|
|
3443
3560
|
children: [/* @__PURE__ */ P("section", {
|
|
3444
3561
|
ref: t,
|
|
3445
3562
|
tabIndex: 0,
|
|
3446
|
-
"aria-label":
|
|
3563
|
+
"aria-label": o("material.image-editor.stage", "Image"),
|
|
3447
3564
|
"aria-busy": e.status === "loading" || void 0,
|
|
3448
3565
|
"data-slot": "image-editor-stage",
|
|
3449
3566
|
"data-tool": n.tool,
|
|
3450
3567
|
className: "nxgt-image-editor-stage relative min-h-0 flex-1 overflow-auto outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:ring-inset",
|
|
3451
|
-
children: e.status === "ready" ? /* @__PURE__ */ P(
|
|
3568
|
+
children: e.status === "ready" ? /* @__PURE__ */ P(Ja, { preview: e.preview }) : /* @__PURE__ */ P("div", {
|
|
3452
3569
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-3 p-6 text-center text-sm text-white/70",
|
|
3453
|
-
children: e.status === "loading" ? /* @__PURE__ */ P(
|
|
3570
|
+
children: e.status === "loading" ? /* @__PURE__ */ P(d, { "aria-label": o("material.image-editor.loading", "Loading the image") }) : /* @__PURE__ */ F("div", {
|
|
3454
3571
|
role: "alert",
|
|
3455
3572
|
className: "flex max-w-sm flex-col items-center gap-2",
|
|
3456
|
-
children: [/* @__PURE__ */ P(
|
|
3573
|
+
children: [/* @__PURE__ */ P(Me, {
|
|
3457
3574
|
className: "size-8",
|
|
3458
3575
|
"aria-hidden": "true"
|
|
3459
|
-
}),
|
|
3576
|
+
}), o("material.image-editor.error", "This image cannot be edited. It may be missing, or served from another site without CORS.")]
|
|
3460
3577
|
})
|
|
3461
3578
|
})
|
|
3462
|
-
}), /* @__PURE__ */
|
|
3463
|
-
className: "pointer-events-none absolute inset-x-0 bottom-3 flex
|
|
3464
|
-
children: /* @__PURE__ */ P(
|
|
3579
|
+
}), /* @__PURE__ */ F("div", {
|
|
3580
|
+
className: "@container pointer-events-none absolute inset-x-0 bottom-3 flex flex-col items-center gap-2 px-3",
|
|
3581
|
+
children: [a && n.tool === "crop" && e.status === "ready" && /* @__PURE__ */ P(wa, {}), P(a ? ja : Ka, {})]
|
|
3465
3582
|
})]
|
|
3466
3583
|
});
|
|
3467
3584
|
}
|
|
3468
|
-
function
|
|
3469
|
-
let { state: t, base: n, view: r, scale: a } =
|
|
3585
|
+
function Ja({ preview: e }) {
|
|
3586
|
+
let { state: t, base: n, view: r, scale: a } = R(), { t: o } = i(), s = j(null), c = j(null), { tool: l, edits: u, comparing: d, selectedId: f, split: p } = t, m = n ? r.w * n.width * a : 0, h = n ? r.h * n.height * a : 0, g = {
|
|
3470
3587
|
source: e,
|
|
3471
3588
|
edits: u,
|
|
3472
|
-
region:
|
|
3589
|
+
region: ra(l),
|
|
3473
3590
|
displayWidth: m
|
|
3474
|
-
}, { paint: _ } =
|
|
3591
|
+
}, { paint: _ } = _a({
|
|
3475
3592
|
...g,
|
|
3476
3593
|
canvasRef: s,
|
|
3477
3594
|
comparing: d,
|
|
@@ -3479,7 +3596,7 @@ function Ha({ preview: e }) {
|
|
|
3479
3596
|
hiddenId: t.editingId,
|
|
3480
3597
|
mountKey: p
|
|
3481
3598
|
});
|
|
3482
|
-
|
|
3599
|
+
_a({
|
|
3483
3600
|
...g,
|
|
3484
3601
|
canvasRef: c,
|
|
3485
3602
|
comparing: !0,
|
|
@@ -3494,7 +3611,7 @@ function Ha({ preview: e }) {
|
|
|
3494
3611
|
"aria-hidden": "true"
|
|
3495
3612
|
});
|
|
3496
3613
|
return /* @__PURE__ */ P("div", {
|
|
3497
|
-
className: "flex min-h-full w-max min-w-full items-center justify-center px-6 pt-6 pb-
|
|
3614
|
+
className: "flex min-h-full w-max min-w-full items-center justify-center px-6 pt-6 pb-[var(--stage-dock,5rem)]",
|
|
3498
3615
|
children: /* @__PURE__ */ F("div", {
|
|
3499
3616
|
"data-slot": "image-editor-canvas",
|
|
3500
3617
|
className: "nxgt-image-editor-checker relative shrink-0",
|
|
@@ -3503,57 +3620,57 @@ function Ha({ preview: e }) {
|
|
|
3503
3620
|
height: h
|
|
3504
3621
|
},
|
|
3505
3622
|
children: [
|
|
3506
|
-
p ? /* @__PURE__ */ P(
|
|
3623
|
+
p ? /* @__PURE__ */ P(na, {
|
|
3507
3624
|
className: "size-full",
|
|
3508
3625
|
before: v(c),
|
|
3509
3626
|
after: v(s),
|
|
3510
3627
|
beforeLabel: o("material.image-editor.before", "Original"),
|
|
3511
3628
|
afterLabel: o("material.image-editor.after", "Edited")
|
|
3512
3629
|
}) : v(s),
|
|
3513
|
-
l === "crop" && !p && /* @__PURE__ */ P(
|
|
3514
|
-
l === "markup" && !d && !p && /* @__PURE__ */ P(
|
|
3630
|
+
l === "crop" && !p && /* @__PURE__ */ P(Sa, {}),
|
|
3631
|
+
l === "markup" && !d && !p && /* @__PURE__ */ P(Wa, { paint: _ })
|
|
3515
3632
|
]
|
|
3516
3633
|
})
|
|
3517
3634
|
});
|
|
3518
3635
|
}
|
|
3519
3636
|
//#endregion
|
|
3520
3637
|
//#region lib/components/ui/media/image-editor/image-editor.changes.ts
|
|
3521
|
-
function
|
|
3638
|
+
function Ya(e) {
|
|
3522
3639
|
let t = /* @__PURE__ */ new Set(), { adjustments: n, crop: r } = e;
|
|
3523
|
-
return Object.keys(
|
|
3640
|
+
return Object.keys(B).some((e) => n[e] !== B[e]) && t.add("adjust"), e.filter !== "none" && t.add("filters"), (!(r.x === H.x && r.y === H.y && r.w === H.w && r.h === H.h) || !zn(e.transform)) && t.add("crop"), e.annotations.length > 0 && t.add("markup"), t;
|
|
3524
3641
|
}
|
|
3525
3642
|
//#endregion
|
|
3526
3643
|
//#region lib/components/ui/media/image-editor/partials/editor-tool-rail.tsx
|
|
3527
|
-
var
|
|
3644
|
+
var Xa = {
|
|
3528
3645
|
adjust: {
|
|
3529
|
-
icon:
|
|
3646
|
+
icon: We,
|
|
3530
3647
|
label: "Adjust"
|
|
3531
3648
|
},
|
|
3532
3649
|
filters: {
|
|
3533
|
-
icon:
|
|
3650
|
+
icon: Ge,
|
|
3534
3651
|
label: "Filters"
|
|
3535
3652
|
},
|
|
3536
3653
|
crop: {
|
|
3537
|
-
icon:
|
|
3654
|
+
icon: Te,
|
|
3538
3655
|
label: "Crop"
|
|
3539
3656
|
},
|
|
3540
3657
|
markup: {
|
|
3541
|
-
icon:
|
|
3658
|
+
icon: Ie,
|
|
3542
3659
|
label: "Markup"
|
|
3543
3660
|
}
|
|
3544
3661
|
};
|
|
3545
|
-
function
|
|
3546
|
-
let { tools: e, state: t, actions: n, source: r } =
|
|
3662
|
+
function Za() {
|
|
3663
|
+
let { tools: e, state: t, actions: n, source: r } = R(), { t: a } = i(), o = k();
|
|
3547
3664
|
if (e.length < 2) return null;
|
|
3548
|
-
let s =
|
|
3665
|
+
let s = Ya(t.edits);
|
|
3549
3666
|
return /* @__PURE__ */ P("div", {
|
|
3550
3667
|
role: "toolbar",
|
|
3551
3668
|
"aria-label": a("material.image-editor.tools", "Tools"),
|
|
3552
3669
|
"data-slot": "image-editor-tool-rail",
|
|
3553
3670
|
className: "flex shrink-0 justify-around gap-1 border-t bg-card px-2 py-1.5 @3xl/image-editor:order-first @3xl/image-editor:flex-col @3xl/image-editor:justify-start @3xl/image-editor:gap-2 @3xl/image-editor:border-t-0 @3xl/image-editor:border-r @3xl/image-editor:px-1.5 @3xl/image-editor:py-3",
|
|
3554
3671
|
children: e.map((e) => {
|
|
3555
|
-
let { icon: i, label: c } =
|
|
3556
|
-
return /* @__PURE__ */ F(
|
|
3672
|
+
let { icon: i, label: c } = Xa[e], l = t.tool === e, u = s.has(e);
|
|
3673
|
+
return /* @__PURE__ */ F(fe, { children: [/* @__PURE__ */ F("button", {
|
|
3557
3674
|
type: "button",
|
|
3558
3675
|
"aria-pressed": l,
|
|
3559
3676
|
disabled: r.status !== "ready",
|
|
@@ -3586,7 +3703,7 @@ function Ga() {
|
|
|
3586
3703
|
}
|
|
3587
3704
|
//#endregion
|
|
3588
3705
|
//#region lib/components/ui/media/image-editor/partials/editor-export-options.tsx
|
|
3589
|
-
var
|
|
3706
|
+
var Qa = [
|
|
3590
3707
|
{
|
|
3591
3708
|
value: "image/png",
|
|
3592
3709
|
label: "PNG"
|
|
@@ -3599,7 +3716,7 @@ var Ka = [
|
|
|
3599
3716
|
value: "image/webp",
|
|
3600
3717
|
label: "WebP"
|
|
3601
3718
|
}
|
|
3602
|
-
],
|
|
3719
|
+
], $a = [
|
|
3603
3720
|
{
|
|
3604
3721
|
value: .92,
|
|
3605
3722
|
id: "high",
|
|
@@ -3615,42 +3732,42 @@ var Ka = [
|
|
|
3615
3732
|
id: "low",
|
|
3616
3733
|
label: "Low"
|
|
3617
3734
|
}
|
|
3618
|
-
],
|
|
3735
|
+
], eo = [
|
|
3619
3736
|
1,
|
|
3620
3737
|
.75,
|
|
3621
3738
|
.5,
|
|
3622
3739
|
.25
|
|
3623
3740
|
];
|
|
3624
|
-
function
|
|
3625
|
-
let { state: e, actions: t } =
|
|
3741
|
+
function to() {
|
|
3742
|
+
let { state: e, actions: t } = R(), { t: n } = i(), r = e.exportOptions, a = r.format !== "image/png";
|
|
3626
3743
|
return /* @__PURE__ */ F(N, { children: [
|
|
3627
|
-
/* @__PURE__ */ P(
|
|
3628
|
-
/* @__PURE__ */ P(
|
|
3744
|
+
/* @__PURE__ */ P(h, { children: n("material.image-editor.export.format", "Format") }),
|
|
3745
|
+
/* @__PURE__ */ P(S, {
|
|
3629
3746
|
value: r.format,
|
|
3630
3747
|
onValueChange: (e) => t.setExportOptions({ format: e }),
|
|
3631
|
-
children:
|
|
3748
|
+
children: Qa.map((e) => /* @__PURE__ */ P(ce, {
|
|
3632
3749
|
value: e.value,
|
|
3633
3750
|
children: e.label
|
|
3634
3751
|
}, e.value))
|
|
3635
3752
|
}),
|
|
3636
3753
|
a && /* @__PURE__ */ F(N, { children: [
|
|
3637
|
-
/* @__PURE__ */ P(
|
|
3638
|
-
/* @__PURE__ */ P(
|
|
3639
|
-
/* @__PURE__ */ P(
|
|
3754
|
+
/* @__PURE__ */ P(C, {}),
|
|
3755
|
+
/* @__PURE__ */ P(h, { children: n("material.image-editor.export.quality", "Quality") }),
|
|
3756
|
+
/* @__PURE__ */ P(S, {
|
|
3640
3757
|
value: String(r.quality),
|
|
3641
3758
|
onValueChange: (e) => t.setExportOptions({ quality: Number(e) }),
|
|
3642
|
-
children:
|
|
3759
|
+
children: $a.map((e) => /* @__PURE__ */ P(ce, {
|
|
3643
3760
|
value: String(e.value),
|
|
3644
3761
|
children: n(`material.image-editor.export.quality-${e.id}`, e.label)
|
|
3645
3762
|
}, e.id))
|
|
3646
3763
|
})
|
|
3647
3764
|
] }),
|
|
3648
|
-
/* @__PURE__ */ P(
|
|
3649
|
-
/* @__PURE__ */ P(
|
|
3650
|
-
/* @__PURE__ */ P(
|
|
3765
|
+
/* @__PURE__ */ P(C, {}),
|
|
3766
|
+
/* @__PURE__ */ P(h, { children: n("material.image-editor.export.size", "Size") }),
|
|
3767
|
+
/* @__PURE__ */ P(S, {
|
|
3651
3768
|
value: String(r.scale),
|
|
3652
3769
|
onValueChange: (e) => t.setExportOptions({ scale: Number(e) }),
|
|
3653
|
-
children:
|
|
3770
|
+
children: eo.map((e) => /* @__PURE__ */ P(ce, {
|
|
3654
3771
|
value: String(e),
|
|
3655
3772
|
children: `${e * 100}%`
|
|
3656
3773
|
}, e))
|
|
@@ -3659,31 +3776,31 @@ function Ya() {
|
|
|
3659
3776
|
}
|
|
3660
3777
|
//#endregion
|
|
3661
3778
|
//#region lib/components/ui/media/image-editor/partials/editor-export-menu.tsx
|
|
3662
|
-
function
|
|
3663
|
-
let { source: e, exporting: t, hideDownload: n, onSave: r } =
|
|
3664
|
-
return n && !r ? null : /* @__PURE__ */ F(
|
|
3779
|
+
function no() {
|
|
3780
|
+
let { source: e, exporting: t, hideDownload: n, onSave: r } = R(), { t: a } = i();
|
|
3781
|
+
return n && !r ? null : /* @__PURE__ */ F(ae, { children: [/* @__PURE__ */ P(oe, {
|
|
3665
3782
|
asChild: !0,
|
|
3666
|
-
children: /* @__PURE__ */ P(
|
|
3783
|
+
children: /* @__PURE__ */ P(f, {
|
|
3667
3784
|
variant: "ghost",
|
|
3668
3785
|
color: "default",
|
|
3669
3786
|
"aria-label": a("material.image-editor.export.label", "Export"),
|
|
3670
3787
|
disabled: e.status !== "ready" || t.busy !== null,
|
|
3671
3788
|
"data-slot": "image-editor-export",
|
|
3672
|
-
children: P(n ?
|
|
3789
|
+
children: P(n ? He : Ee, {})
|
|
3673
3790
|
})
|
|
3674
|
-
}), /* @__PURE__ */ F(
|
|
3791
|
+
}), /* @__PURE__ */ F(x, {
|
|
3675
3792
|
align: "end",
|
|
3676
3793
|
className: "min-w-52",
|
|
3677
|
-
children: [/* @__PURE__ */ P(
|
|
3794
|
+
children: [/* @__PURE__ */ P(to, {}), !n && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(C, {}), /* @__PURE__ */ F(_, {
|
|
3678
3795
|
onSelect: () => void t.download(),
|
|
3679
|
-
children: [/* @__PURE__ */ P(
|
|
3796
|
+
children: [/* @__PURE__ */ P(Ee, { "aria-hidden": "true" }), a("material.image-editor.export.download", "Download")]
|
|
3680
3797
|
})] })]
|
|
3681
3798
|
})] });
|
|
3682
3799
|
}
|
|
3683
3800
|
//#endregion
|
|
3684
3801
|
//#region lib/components/ui/media/image-editor/partials/editor-file-info.tsx
|
|
3685
|
-
function
|
|
3686
|
-
let { source: e, fileName: t } =
|
|
3802
|
+
function ro() {
|
|
3803
|
+
let { source: e, fileName: t } = R(), { t: n } = i();
|
|
3687
3804
|
return /* @__PURE__ */ P("div", {
|
|
3688
3805
|
className: "flex min-w-0 flex-1 justify-center",
|
|
3689
3806
|
children: e.status === "ready" && /* @__PURE__ */ F("span", {
|
|
@@ -3709,61 +3826,62 @@ function Za() {
|
|
|
3709
3826
|
}
|
|
3710
3827
|
//#endregion
|
|
3711
3828
|
//#region lib/components/ui/media/image-editor/partials/editor-history-buttons.tsx
|
|
3712
|
-
function
|
|
3713
|
-
let { actions: e, canUndo: t, canRedo: n } =
|
|
3829
|
+
function io() {
|
|
3830
|
+
let { actions: e, canUndo: t, canRedo: n } = R(), { t: r } = i();
|
|
3714
3831
|
return /* @__PURE__ */ F(N, { children: [
|
|
3715
|
-
/* @__PURE__ */ P(
|
|
3832
|
+
/* @__PURE__ */ P(f, {
|
|
3716
3833
|
variant: "ghost",
|
|
3717
3834
|
color: "default",
|
|
3718
3835
|
tooltip: r("material.image-editor.undo", "Undo"),
|
|
3719
3836
|
disabled: !t,
|
|
3720
3837
|
onClick: () => e.undo(),
|
|
3721
|
-
children: /* @__PURE__ */ P(
|
|
3838
|
+
children: /* @__PURE__ */ P(Xe, {})
|
|
3722
3839
|
}),
|
|
3723
|
-
/* @__PURE__ */ P(
|
|
3840
|
+
/* @__PURE__ */ P(f, {
|
|
3724
3841
|
variant: "ghost",
|
|
3725
3842
|
color: "default",
|
|
3726
3843
|
tooltip: r("material.image-editor.redo", "Redo"),
|
|
3727
3844
|
disabled: !n,
|
|
3728
3845
|
onClick: () => e.redo(),
|
|
3729
|
-
children: /* @__PURE__ */ P(
|
|
3846
|
+
children: /* @__PURE__ */ P(ze, {})
|
|
3730
3847
|
}),
|
|
3731
|
-
/* @__PURE__ */ P(
|
|
3848
|
+
/* @__PURE__ */ P(f, {
|
|
3732
3849
|
variant: "ghost",
|
|
3733
3850
|
color: "default",
|
|
3734
3851
|
tooltip: r("material.image-editor.reset", "Reset all"),
|
|
3735
3852
|
disabled: !t,
|
|
3736
3853
|
onClick: () => e.resetAll(),
|
|
3737
|
-
children: /* @__PURE__ */ P(
|
|
3854
|
+
children: /* @__PURE__ */ P(Be, {})
|
|
3738
3855
|
})
|
|
3739
3856
|
] });
|
|
3740
3857
|
}
|
|
3741
3858
|
//#endregion
|
|
3742
3859
|
//#region lib/components/ui/media/image-editor/image-editor.shortcuts.ts
|
|
3743
|
-
var
|
|
3860
|
+
var ao = {
|
|
3744
3861
|
ctrl: "Ctrl/⌘",
|
|
3745
3862
|
shift: "Shift",
|
|
3746
3863
|
delete: "Delete",
|
|
3747
|
-
esc: "Esc"
|
|
3748
|
-
|
|
3864
|
+
esc: "Esc",
|
|
3865
|
+
enter: "Enter"
|
|
3866
|
+
}, oo = "ctrl", so = [
|
|
3749
3867
|
"←",
|
|
3750
3868
|
"↑",
|
|
3751
3869
|
"→",
|
|
3752
3870
|
"↓"
|
|
3753
|
-
],
|
|
3871
|
+
], co = [
|
|
3754
3872
|
{
|
|
3755
3873
|
id: "general",
|
|
3756
3874
|
label: "Editing",
|
|
3757
3875
|
items: [
|
|
3758
3876
|
{
|
|
3759
3877
|
id: "undo",
|
|
3760
|
-
keys: [
|
|
3878
|
+
keys: [oo, "Z"],
|
|
3761
3879
|
label: "Undo"
|
|
3762
3880
|
},
|
|
3763
3881
|
{
|
|
3764
3882
|
id: "redo",
|
|
3765
3883
|
keys: [
|
|
3766
|
-
|
|
3884
|
+
oo,
|
|
3767
3885
|
"shift",
|
|
3768
3886
|
"Z"
|
|
3769
3887
|
],
|
|
@@ -3813,23 +3931,28 @@ var $a = {
|
|
|
3813
3931
|
},
|
|
3814
3932
|
{
|
|
3815
3933
|
id: "mark-duplicate",
|
|
3816
|
-
keys: [
|
|
3934
|
+
keys: [oo, "D"],
|
|
3817
3935
|
label: "Duplicate the mark"
|
|
3818
3936
|
},
|
|
3819
3937
|
{
|
|
3820
3938
|
id: "mark-nudge",
|
|
3821
|
-
keys:
|
|
3939
|
+
keys: so,
|
|
3822
3940
|
label: "Nudge the mark"
|
|
3823
3941
|
},
|
|
3824
3942
|
{
|
|
3825
3943
|
id: "mark-move",
|
|
3826
|
-
keys: ["shift", ...
|
|
3944
|
+
keys: ["shift", ...so],
|
|
3827
3945
|
label: "Nudge it further"
|
|
3828
3946
|
},
|
|
3829
3947
|
{
|
|
3830
3948
|
id: "mark-drop",
|
|
3831
3949
|
keys: ["esc"],
|
|
3832
3950
|
label: "Deselect"
|
|
3951
|
+
},
|
|
3952
|
+
{
|
|
3953
|
+
id: "mark-step",
|
|
3954
|
+
keys: ["enter"],
|
|
3955
|
+
label: "Place a step marker (Step tool)"
|
|
3833
3956
|
}
|
|
3834
3957
|
]
|
|
3835
3958
|
},
|
|
@@ -3838,40 +3961,40 @@ var $a = {
|
|
|
3838
3961
|
label: "Crop frame",
|
|
3839
3962
|
items: [{
|
|
3840
3963
|
id: "crop-move",
|
|
3841
|
-
keys:
|
|
3964
|
+
keys: so,
|
|
3842
3965
|
label: "Move the frame"
|
|
3843
3966
|
}, {
|
|
3844
3967
|
id: "crop-resize",
|
|
3845
|
-
keys: ["shift", ...
|
|
3968
|
+
keys: ["shift", ...so],
|
|
3846
3969
|
label: "Resize the frame"
|
|
3847
3970
|
}]
|
|
3848
3971
|
}
|
|
3849
3972
|
];
|
|
3850
3973
|
//#endregion
|
|
3851
3974
|
//#region lib/components/ui/media/image-editor/partials/editor-shortcuts.tsx
|
|
3852
|
-
function
|
|
3853
|
-
let { state: e, actions: t } =
|
|
3854
|
-
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
3975
|
+
function lo() {
|
|
3976
|
+
let { state: e, actions: t } = R(), { t: n } = i(), r = n("material.image-editor.shortcuts.title", "Keyboard shortcuts");
|
|
3977
|
+
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(f, {
|
|
3855
3978
|
variant: "ghost",
|
|
3856
3979
|
color: "default",
|
|
3857
3980
|
tooltip: r,
|
|
3858
3981
|
"aria-keyshortcuts": "?",
|
|
3859
3982
|
onClick: () => t.setShortcutsOpen(!0),
|
|
3860
|
-
children: /* @__PURE__ */ P(
|
|
3861
|
-
}), /* @__PURE__ */ P(
|
|
3983
|
+
children: /* @__PURE__ */ P(Ne, {})
|
|
3984
|
+
}), /* @__PURE__ */ P(y, {
|
|
3862
3985
|
open: e.shortcutsOpen,
|
|
3863
3986
|
onOpenChange: t.setShortcutsOpen,
|
|
3864
|
-
children: /* @__PURE__ */ F(
|
|
3987
|
+
children: /* @__PURE__ */ F(ne, {
|
|
3865
3988
|
"data-slot": "image-editor-shortcuts",
|
|
3866
3989
|
className: "max-h-[calc(100dvh-2rem)] gap-4 overflow-y-auto sm:max-w-md",
|
|
3867
3990
|
children: [
|
|
3868
|
-
/* @__PURE__ */ P(
|
|
3869
|
-
/* @__PURE__ */ P(
|
|
3991
|
+
/* @__PURE__ */ P(ie, {}),
|
|
3992
|
+
/* @__PURE__ */ P(le, {
|
|
3870
3993
|
className: "text-lg/6",
|
|
3871
3994
|
children: r
|
|
3872
3995
|
}),
|
|
3873
|
-
/* @__PURE__ */ P(
|
|
3874
|
-
|
|
3996
|
+
/* @__PURE__ */ P(b, { children: n("material.image-editor.shortcuts.description", "Keys work while the image or a panel has focus.") }),
|
|
3997
|
+
co.map((e) => /* @__PURE__ */ F("section", {
|
|
3875
3998
|
className: "flex flex-col gap-1.5",
|
|
3876
3999
|
children: [/* @__PURE__ */ P("h3", {
|
|
3877
4000
|
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
@@ -3887,7 +4010,7 @@ function ro() {
|
|
|
3887
4010
|
className: "flex shrink-0 gap-1",
|
|
3888
4011
|
children: e.keys.map((e) => /* @__PURE__ */ P("kbd", {
|
|
3889
4012
|
className: "min-w-6 rounded-md border bg-muted/60 px-1.5 py-0.5 text-center font-sans font-medium text-muted-foreground text-xs",
|
|
3890
|
-
children:
|
|
4013
|
+
children: ao[e] ? n(`material.image-editor.shortcuts.key.${e}`, ao[e]) : e
|
|
3891
4014
|
}, e))
|
|
3892
4015
|
})]
|
|
3893
4016
|
}, e.id))
|
|
@@ -3899,27 +4022,35 @@ function ro() {
|
|
|
3899
4022
|
}
|
|
3900
4023
|
//#endregion
|
|
3901
4024
|
//#region lib/components/ui/media/image-editor/partials/editor-top-bar.tsx
|
|
3902
|
-
function
|
|
3903
|
-
let e =
|
|
4025
|
+
function uo() {
|
|
4026
|
+
let e = R(), { source: t, exporting: n } = e, { t: r } = i(), a = t.status === "ready", o = e.toolbar === "floating";
|
|
3904
4027
|
return /* @__PURE__ */ F("div", {
|
|
3905
4028
|
"data-slot": "image-editor-top-bar",
|
|
3906
4029
|
className: "flex shrink-0 items-center gap-1 border-b bg-card px-2 py-1.5 sm:gap-2 sm:px-3",
|
|
3907
4030
|
children: [
|
|
3908
|
-
e.onCancel && /* @__PURE__ */
|
|
4031
|
+
o && e.onCancel && /* @__PURE__ */ P(m, {
|
|
4032
|
+
variant: "tonal",
|
|
4033
|
+
color: "default",
|
|
4034
|
+
size: "sm",
|
|
4035
|
+
className: "px-4",
|
|
4036
|
+
onClick: e.onCancel,
|
|
4037
|
+
children: r("material.image-editor.cancel", "Cancel")
|
|
4038
|
+
}),
|
|
4039
|
+
!o && e.onCancel && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(f, {
|
|
3909
4040
|
variant: "ghost",
|
|
3910
4041
|
color: "default",
|
|
3911
4042
|
tooltip: r("material.image-editor.cancel", "Cancel"),
|
|
3912
4043
|
onClick: e.onCancel,
|
|
3913
|
-
children: /* @__PURE__ */ P(
|
|
3914
|
-
}), /* @__PURE__ */ P(
|
|
4044
|
+
children: /* @__PURE__ */ P(Qe, {})
|
|
4045
|
+
}), /* @__PURE__ */ P(vi, {
|
|
3915
4046
|
orientation: "vertical",
|
|
3916
4047
|
className: "h-6!"
|
|
3917
4048
|
})] }),
|
|
3918
|
-
/* @__PURE__ */ P(
|
|
3919
|
-
/* @__PURE__ */ P(Za, {}),
|
|
4049
|
+
!o && /* @__PURE__ */ P(io, {}),
|
|
3920
4050
|
/* @__PURE__ */ P(ro, {}),
|
|
3921
|
-
/* @__PURE__ */ P(
|
|
3922
|
-
|
|
4051
|
+
/* @__PURE__ */ P(lo, {}),
|
|
4052
|
+
/* @__PURE__ */ P(no, {}),
|
|
4053
|
+
e.onSave && /* @__PURE__ */ P(m, {
|
|
3923
4054
|
variant: "filled",
|
|
3924
4055
|
color: "primary",
|
|
3925
4056
|
size: "sm",
|
|
@@ -3927,14 +4058,14 @@ function io() {
|
|
|
3927
4058
|
disabled: !a || n.busy !== null,
|
|
3928
4059
|
loading: n.busy === "save",
|
|
3929
4060
|
onClick: () => void n.save(),
|
|
3930
|
-
children: e.saveLabel ?? r("material.image-editor.save", "Save")
|
|
4061
|
+
children: e.saveLabel ?? (o ? r("material.image-editor.done", "Done") : r("material.image-editor.save", "Save"))
|
|
3931
4062
|
})
|
|
3932
4063
|
]
|
|
3933
4064
|
});
|
|
3934
4065
|
}
|
|
3935
4066
|
//#endregion
|
|
3936
4067
|
//#region lib/lib/redux/bind-slice-actions.ts
|
|
3937
|
-
function
|
|
4068
|
+
function fo(e, t) {
|
|
3938
4069
|
let n = {};
|
|
3939
4070
|
for (let r of Object.keys(e)) {
|
|
3940
4071
|
let i = e[r];
|
|
@@ -3944,56 +4075,56 @@ function ao(e, t) {
|
|
|
3944
4075
|
}
|
|
3945
4076
|
//#endregion
|
|
3946
4077
|
//#region lib/lib/redux/slice-server-state.ts
|
|
3947
|
-
var
|
|
3948
|
-
function
|
|
3949
|
-
return
|
|
4078
|
+
var po = /* @__PURE__ */ new WeakMap();
|
|
4079
|
+
function mo(e) {
|
|
4080
|
+
return po.get(e);
|
|
3950
4081
|
}
|
|
3951
4082
|
//#endregion
|
|
3952
4083
|
//#region lib/lib/redux/use-slice-reducer.ts
|
|
3953
|
-
function
|
|
4084
|
+
function ho(e, t) {
|
|
3954
4085
|
return t ? {
|
|
3955
4086
|
...e,
|
|
3956
4087
|
...t
|
|
3957
4088
|
} : e;
|
|
3958
4089
|
}
|
|
3959
|
-
var
|
|
3960
|
-
function
|
|
3961
|
-
return (t, n) => n.type ===
|
|
4090
|
+
var go = "nxgt/useSliceReducer/restore", _o = () => () => {}, vo = () => !1;
|
|
4091
|
+
function yo(e) {
|
|
4092
|
+
return (t, n) => n.type === go ? n.payload : e(t, n);
|
|
3962
4093
|
}
|
|
3963
|
-
function
|
|
3964
|
-
let n =
|
|
4094
|
+
function bo(e, t) {
|
|
4095
|
+
let n = mo(e), r = _e(_o, vo, () => n !== void 0), [i] = M(r), [a, o] = ge(A(() => yo(e.reducer), [e.reducer]), t, (t) => ho(r && n ? n() : e.getInitialState(), t));
|
|
3965
4096
|
return O(() => {
|
|
3966
4097
|
i && o({
|
|
3967
|
-
type:
|
|
3968
|
-
payload:
|
|
4098
|
+
type: go,
|
|
4099
|
+
payload: ho(e.getInitialState(), t)
|
|
3969
4100
|
});
|
|
3970
|
-
}, []), [a, A(() =>
|
|
4101
|
+
}, []), [a, A(() => fo(e.actions, o), [e.actions])];
|
|
3971
4102
|
}
|
|
3972
4103
|
//#endregion
|
|
3973
4104
|
//#region lib/components/ui/media/image-editor/image-editor.export.ts
|
|
3974
|
-
var
|
|
4105
|
+
var xo = {
|
|
3975
4106
|
"image/png": "png",
|
|
3976
4107
|
"image/jpeg": "jpg",
|
|
3977
4108
|
"image/webp": "webp"
|
|
3978
4109
|
};
|
|
3979
|
-
function
|
|
3980
|
-
return `${e.replace(/\.(png|jpe?g|webp|gif|avif|bmp)$/i, "").replace(/[/\\?%*:|"<>]/g, "-").trim() || "image"}.${
|
|
4110
|
+
function So(e, t) {
|
|
4111
|
+
return `${e.replace(/\.(png|jpe?g|webp|gif|avif|bmp)$/i, "").replace(/[/\\?%*:|"<>]/g, "-").trim() || "image"}.${xo[t]}`;
|
|
3981
4112
|
}
|
|
3982
|
-
function
|
|
3983
|
-
let i =
|
|
4113
|
+
function Co(e, t, n, r) {
|
|
4114
|
+
let i = Fr(e, t, {
|
|
3984
4115
|
scale: n.scale,
|
|
3985
4116
|
region: "crop"
|
|
3986
4117
|
}), a = Math.max(i.width, i.height), o = r && a > r ? r / a : 1;
|
|
3987
4118
|
return n.scale * o;
|
|
3988
4119
|
}
|
|
3989
|
-
function
|
|
4120
|
+
function wo(e, t, n) {
|
|
3990
4121
|
return new Promise((r, i) => {
|
|
3991
4122
|
e.toBlob((e) => e ? r(e) : i(/* @__PURE__ */ Error("Could not encode the image")), t, n);
|
|
3992
4123
|
});
|
|
3993
4124
|
}
|
|
3994
|
-
async function
|
|
3995
|
-
let a =
|
|
3996
|
-
scale:
|
|
4125
|
+
async function To(e, t, n, { fileName: r, maxSize: i }) {
|
|
4126
|
+
let a = zr(e, t, {
|
|
4127
|
+
scale: Co(e, t, n, i),
|
|
3997
4128
|
region: "crop"
|
|
3998
4129
|
});
|
|
3999
4130
|
if (n.format === "image/jpeg") {
|
|
@@ -4002,27 +4133,27 @@ async function yo(e, t, n, { fileName: r, maxSize: i }) {
|
|
|
4002
4133
|
let t = e.getContext("2d");
|
|
4003
4134
|
t && (t.fillStyle = "#ffffff", t.fillRect(0, 0, e.width, e.height), t.drawImage(a, 0, 0), a = e);
|
|
4004
4135
|
}
|
|
4005
|
-
let o = await
|
|
4136
|
+
let o = await wo(a, n.format, n.quality);
|
|
4006
4137
|
return {
|
|
4007
4138
|
blob: o,
|
|
4008
|
-
file: new File([o],
|
|
4139
|
+
file: new File([o], So(r, n.format), { type: o.type || n.format }),
|
|
4009
4140
|
width: a.width,
|
|
4010
4141
|
height: a.height,
|
|
4011
4142
|
edits: t
|
|
4012
4143
|
};
|
|
4013
4144
|
}
|
|
4014
|
-
function
|
|
4145
|
+
function Eo(e) {
|
|
4015
4146
|
let t = URL.createObjectURL(e), n = document.createElement("a");
|
|
4016
4147
|
n.href = t, n.download = e.name, n.rel = "noopener", n.click(), setTimeout(() => URL.revokeObjectURL(t), 1e3);
|
|
4017
4148
|
}
|
|
4018
4149
|
//#endregion
|
|
4019
4150
|
//#region lib/components/ui/media/image-editor/use-image-editor-export.ts
|
|
4020
|
-
function
|
|
4151
|
+
function Do({ source: e, edits: t, options: n, fileName: r, maxSize: i, onSave: a }) {
|
|
4021
4152
|
let [o, s] = M(null), [c, l] = M(!1), u = D(async (a, o) => {
|
|
4022
4153
|
if (e.status === "ready") {
|
|
4023
4154
|
s(a), l(!1);
|
|
4024
4155
|
try {
|
|
4025
|
-
await new Promise((e) => setTimeout(e, 16)), await o(await
|
|
4156
|
+
await new Promise((e) => setTimeout(e, 16)), await o(await To(e.original, t, n, {
|
|
4026
4157
|
fileName: r,
|
|
4027
4158
|
maxSize: i
|
|
4028
4159
|
}));
|
|
@@ -4043,25 +4174,51 @@ function xo({ source: e, edits: t, options: n, fileName: r, maxSize: i, onSave:
|
|
|
4043
4174
|
busy: o,
|
|
4044
4175
|
failed: c,
|
|
4045
4176
|
save: D(() => u("save", (e) => a?.(e)), [a, u]),
|
|
4046
|
-
download: D(() => u("download", (e) =>
|
|
4177
|
+
download: D(() => u("download", (e) => Eo(e.file)), [u])
|
|
4178
|
+
};
|
|
4179
|
+
}
|
|
4180
|
+
//#endregion
|
|
4181
|
+
//#region lib/components/ui/media/image-editor/use-image-editor-init.ts
|
|
4182
|
+
function Oo(e, t, n) {
|
|
4183
|
+
return {
|
|
4184
|
+
brush: {
|
|
4185
|
+
...vn,
|
|
4186
|
+
redactMode: ar(n, vn.redactMode)
|
|
4187
|
+
},
|
|
4188
|
+
markupTool: e.markupTools?.[0] ?? "pen",
|
|
4189
|
+
tool: e.defaultTool && t.includes(e.defaultTool) ? e.defaultTool : t[0],
|
|
4190
|
+
edits: or(er(e.defaultEdits), n),
|
|
4191
|
+
aspect: e.aspect ?? null,
|
|
4192
|
+
exportOptions: {
|
|
4193
|
+
...xn,
|
|
4194
|
+
...e.defaultExportOptions
|
|
4195
|
+
}
|
|
4047
4196
|
};
|
|
4048
4197
|
}
|
|
4198
|
+
function ko(e) {
|
|
4199
|
+
let t = e.tools?.length ? e.tools : pn;
|
|
4200
|
+
if (e.toolbar !== "floating") return t;
|
|
4201
|
+
let n = t.filter((e) => e === "markup" || e === "crop");
|
|
4202
|
+
return n.length ? n : ["markup"];
|
|
4203
|
+
}
|
|
4049
4204
|
//#endregion
|
|
4050
4205
|
//#region lib/components/ui/media/image-editor/image-editor.keyboard.ts
|
|
4051
|
-
function
|
|
4206
|
+
function Ao(e, t) {
|
|
4052
4207
|
let n = e;
|
|
4053
4208
|
return typeof n?.closest == "function" && !!n.closest(t);
|
|
4054
4209
|
}
|
|
4055
|
-
var
|
|
4210
|
+
var jo = "input, textarea, select, [contenteditable=\"true\"], [role=\"slider\"], [role=\"radio\"], [role=\"menuitem\"], [role=\"option\"]", Mo = {
|
|
4056
4211
|
ArrowLeft: [-1, 0],
|
|
4057
4212
|
ArrowRight: [1, 0],
|
|
4058
4213
|
ArrowUp: [0, -1],
|
|
4059
4214
|
ArrowDown: [0, 1]
|
|
4060
4215
|
};
|
|
4061
|
-
function
|
|
4216
|
+
function No(e, t) {
|
|
4062
4217
|
let n = t.selection;
|
|
4063
|
-
if (!
|
|
4064
|
-
|
|
4218
|
+
if (!Ao(e.target, "[data-slot=\"image-editor-stage\"]")) return !1;
|
|
4219
|
+
if (e.key === "Enter" && t.placeStep) return t.placeStep(), !0;
|
|
4220
|
+
if (!n) return !1;
|
|
4221
|
+
let r = e.ctrlKey || e.metaKey, i = Mo[e.key];
|
|
4065
4222
|
if (e.key === "Delete" || e.key === "Backspace") n.remove();
|
|
4066
4223
|
else if (e.key === "Escape") n.deselect();
|
|
4067
4224
|
else if (r && e.key.toLowerCase() === "d") n.duplicate();
|
|
@@ -4071,7 +4228,7 @@ function To(e, t) {
|
|
|
4071
4228
|
} else return !1;
|
|
4072
4229
|
return !0;
|
|
4073
4230
|
}
|
|
4074
|
-
function
|
|
4231
|
+
function Po(e, t) {
|
|
4075
4232
|
let n = e.ctrlKey || e.metaKey, r = e.key.toLowerCase();
|
|
4076
4233
|
if (n && r === "z") (e.shiftKey ? t.redo : t.undo)();
|
|
4077
4234
|
else if (n && r === "y") t.redo();
|
|
@@ -4084,54 +4241,56 @@ function Eo(e, t) {
|
|
|
4084
4241
|
else return !1;
|
|
4085
4242
|
return !0;
|
|
4086
4243
|
}
|
|
4087
|
-
function
|
|
4088
|
-
if (
|
|
4089
|
-
let n =
|
|
4244
|
+
function Fo(e, t) {
|
|
4245
|
+
if (Ao(e.target, `${jo}, [data-slot="image-editor-shortcuts"]`)) return !1;
|
|
4246
|
+
let n = No(e, t) || Po(e, t);
|
|
4090
4247
|
return n && e.preventDefault(), n;
|
|
4091
4248
|
}
|
|
4092
4249
|
//#endregion
|
|
4093
4250
|
//#region lib/components/ui/media/image-editor/use-image-editor-keys.ts
|
|
4094
|
-
function
|
|
4095
|
-
return D((
|
|
4096
|
-
let
|
|
4097
|
-
|
|
4251
|
+
function Io(e, t, n, r) {
|
|
4252
|
+
return D((i) => {
|
|
4253
|
+
let a = t?.id;
|
|
4254
|
+
Fo(i, {
|
|
4098
4255
|
undo: e.undo,
|
|
4099
4256
|
redo: e.redo,
|
|
4100
4257
|
...n,
|
|
4258
|
+
placeStep: r,
|
|
4101
4259
|
showShortcuts: () => e.setShortcutsOpen(!0),
|
|
4102
|
-
selection:
|
|
4103
|
-
remove: () => e.removeAnnotation(
|
|
4104
|
-
duplicate: () => e.duplicateAnnotation(
|
|
4260
|
+
selection: a ? {
|
|
4261
|
+
remove: () => e.removeAnnotation(a),
|
|
4262
|
+
duplicate: () => e.duplicateAnnotation(a),
|
|
4105
4263
|
deselect: () => e.selectAnnotation(null),
|
|
4106
4264
|
nudge: (t, n) => e.moveAnnotation({
|
|
4107
|
-
id:
|
|
4265
|
+
id: a,
|
|
4108
4266
|
dx: t,
|
|
4109
4267
|
dy: n,
|
|
4110
|
-
gesture: `nudge:${
|
|
4268
|
+
gesture: `nudge:${a}`
|
|
4111
4269
|
})
|
|
4112
4270
|
} : void 0
|
|
4113
4271
|
});
|
|
4114
4272
|
}, [
|
|
4115
4273
|
e,
|
|
4116
4274
|
t?.id,
|
|
4117
|
-
n
|
|
4275
|
+
n,
|
|
4276
|
+
r
|
|
4118
4277
|
]);
|
|
4119
4278
|
}
|
|
4120
4279
|
//#endregion
|
|
4121
4280
|
//#region lib/components/ui/media/image-editor/use-image-editor-zoom.ts
|
|
4122
|
-
function
|
|
4123
|
-
let n = t === 1 ?
|
|
4281
|
+
function Lo(e, t) {
|
|
4282
|
+
let n = t === 1 ? Cn : [...Cn].reverse();
|
|
4124
4283
|
return n.find((n) => t === 1 ? n > e * 1.01 : n < e * .99) ?? n[n.length - 1];
|
|
4125
4284
|
}
|
|
4126
|
-
function
|
|
4285
|
+
function Ro(e, t) {
|
|
4127
4286
|
let n = j(1), r = D((e) => e ?? n.current, []);
|
|
4128
4287
|
return A(() => {
|
|
4129
4288
|
let i = () => e ?? n.current;
|
|
4130
4289
|
return {
|
|
4131
4290
|
fitRef: n,
|
|
4132
4291
|
scaleOf: r,
|
|
4133
|
-
zoomIn: () => t(
|
|
4134
|
-
zoomOut: () => t(
|
|
4292
|
+
zoomIn: () => t(Lo(i(), 1)),
|
|
4293
|
+
zoomOut: () => t(Lo(i(), -1)),
|
|
4135
4294
|
zoomToFit: () => t(null),
|
|
4136
4295
|
zoomToActual: () => t(1),
|
|
4137
4296
|
zoomBy: (e) => t(i() * e)
|
|
@@ -4144,7 +4303,7 @@ function Ao(e, t) {
|
|
|
4144
4303
|
}
|
|
4145
4304
|
//#endregion
|
|
4146
4305
|
//#region lib/components/ui/media/image-cropper/crop-image.ts
|
|
4147
|
-
function
|
|
4306
|
+
function zo(e) {
|
|
4148
4307
|
return new Promise((t, n) => {
|
|
4149
4308
|
let r = new Image();
|
|
4150
4309
|
r.addEventListener("load", () => t(r)), r.addEventListener("error", () => n(/* @__PURE__ */ Error("Could not load image"))), r.crossOrigin = "anonymous", r.src = e;
|
|
@@ -4152,7 +4311,7 @@ function jo(e) {
|
|
|
4152
4311
|
}
|
|
4153
4312
|
//#endregion
|
|
4154
4313
|
//#region lib/components/ui/media/upload/network-upload-field/use-image-preview.ts
|
|
4155
|
-
function
|
|
4314
|
+
function Bo(e) {
|
|
4156
4315
|
let [t, n] = M();
|
|
4157
4316
|
return O(() => {
|
|
4158
4317
|
if (!e) return;
|
|
@@ -4167,7 +4326,7 @@ function Mo(e) {
|
|
|
4167
4326
|
}
|
|
4168
4327
|
//#endregion
|
|
4169
4328
|
//#region lib/components/ui/media/image-editor/use-image-source.ts
|
|
4170
|
-
async function
|
|
4329
|
+
async function Vo(e) {
|
|
4171
4330
|
let t = e;
|
|
4172
4331
|
if (typeof e == "string") {
|
|
4173
4332
|
let n = await fetch(e);
|
|
@@ -4176,42 +4335,61 @@ async function No(e) {
|
|
|
4176
4335
|
}
|
|
4177
4336
|
return createImageBitmap(t);
|
|
4178
4337
|
}
|
|
4179
|
-
function
|
|
4338
|
+
function Ho(e) {
|
|
4180
4339
|
e && "close" in e && e.close();
|
|
4181
4340
|
}
|
|
4182
|
-
function
|
|
4183
|
-
let n = t === "bitmap", r =
|
|
4341
|
+
function Uo(e, t = "image") {
|
|
4342
|
+
let n = t === "bitmap", r = Bo(typeof e == "string" || n ? void 0 : e), i = typeof e == "string" ? e : r, [a, o] = M({ status: "loading" }), s = n ? e : i;
|
|
4184
4343
|
return O(() => {
|
|
4185
4344
|
if (!s) return;
|
|
4186
4345
|
let e = !0, t;
|
|
4187
|
-
return o({ status: "loading" }), (n ?
|
|
4188
|
-
if (t = n, !e) return
|
|
4346
|
+
return o({ status: "loading" }), (n ? Vo(s) : zo(s)).then((n) => {
|
|
4347
|
+
if (t = n, !e) return Ho(t);
|
|
4189
4348
|
let r = {
|
|
4190
4349
|
image: n,
|
|
4191
4350
|
width: "naturalWidth" in n ? n.naturalWidth : n.width,
|
|
4192
4351
|
height: "naturalHeight" in n ? n.naturalHeight : n.height
|
|
4193
4352
|
};
|
|
4194
|
-
if (!(r.width > 0 && r.height > 0) || !
|
|
4353
|
+
if (!(r.width > 0 && r.height > 0) || !Vr(r)) throw Error("The image cannot be edited");
|
|
4195
4354
|
o({
|
|
4196
4355
|
status: "ready",
|
|
4197
4356
|
original: r,
|
|
4198
|
-
preview:
|
|
4357
|
+
preview: Br(r, wn)
|
|
4199
4358
|
});
|
|
4200
4359
|
}).catch(() => {
|
|
4201
4360
|
e && o({ status: "error" });
|
|
4202
4361
|
}), () => {
|
|
4203
|
-
e = !1,
|
|
4362
|
+
e = !1, Ho(t);
|
|
4204
4363
|
};
|
|
4205
4364
|
}, [s, n]), a;
|
|
4206
4365
|
}
|
|
4207
4366
|
//#endregion
|
|
4367
|
+
//#region lib/components/ui/media/image-editor/use-place-step.ts
|
|
4368
|
+
var Wo = (e, t, n) => Math.min(n, Math.max(t, e));
|
|
4369
|
+
function Go(e, t) {
|
|
4370
|
+
let n = t % 6 * .03;
|
|
4371
|
+
return {
|
|
4372
|
+
x: Wo(e.x + e.w / 2 + n, Math.max(0, e.x), Math.min(1, e.x + e.w)),
|
|
4373
|
+
y: Wo(e.y + e.h / 2 + n, Math.max(0, e.y), Math.min(1, e.y + e.h))
|
|
4374
|
+
};
|
|
4375
|
+
}
|
|
4376
|
+
function Ko(e, t, n, r) {
|
|
4377
|
+
let i = e.tool === "markup" && e.markupTool === "step" && r !== null, a = e.edits.annotations.filter((e) => e.kind === "step").length, o = e.brush, { addAnnotation: s } = t, c = D(() => s(Fa(Go(n, a), o)), [
|
|
4378
|
+
s,
|
|
4379
|
+
n,
|
|
4380
|
+
a,
|
|
4381
|
+
o
|
|
4382
|
+
]);
|
|
4383
|
+
return i ? c : void 0;
|
|
4384
|
+
}
|
|
4385
|
+
//#endregion
|
|
4208
4386
|
//#region lib/components/ui/media/image-editor/use-redact-modes.ts
|
|
4209
|
-
function
|
|
4210
|
-
return A(() =>
|
|
4387
|
+
function qo(e) {
|
|
4388
|
+
return A(() => ir(e), [ir(e).join()]);
|
|
4211
4389
|
}
|
|
4212
|
-
function
|
|
4390
|
+
function Jo(e, t) {
|
|
4213
4391
|
return A(() => {
|
|
4214
|
-
let n = (e) =>
|
|
4392
|
+
let n = (e) => ar(t, e), r = (e) => e.kind === "redact" ? {
|
|
4215
4393
|
...e,
|
|
4216
4394
|
mode: n(e.mode ?? "solid")
|
|
4217
4395
|
} : e;
|
|
@@ -4231,72 +4409,57 @@ function Lo(e, t) {
|
|
|
4231
4409
|
}
|
|
4232
4410
|
//#endregion
|
|
4233
4411
|
//#region lib/components/ui/media/image-editor/use-image-editor.ts
|
|
4234
|
-
var
|
|
4235
|
-
function
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
...Sn,
|
|
4239
|
-
redactMode: sr(n, Sn.redactMode)
|
|
4240
|
-
},
|
|
4241
|
-
markupTool: e.markupTools?.[0] ?? "pen",
|
|
4242
|
-
tool: e.defaultTool && t.includes(e.defaultTool) ? e.defaultTool : t[0],
|
|
4243
|
-
edits: cr(nr(e.defaultEdits), n),
|
|
4244
|
-
aspect: e.aspect ?? null,
|
|
4245
|
-
exportOptions: {
|
|
4246
|
-
...Tn,
|
|
4247
|
-
...e.defaultExportOptions
|
|
4248
|
-
}
|
|
4249
|
-
};
|
|
4250
|
-
}
|
|
4251
|
-
function Bo(e) {
|
|
4252
|
-
let t = e.tools?.length ? e.tools : vn, n = Io(e.redactModes), [r, i] = Ro(zo(e, t, n)), a = Lo(i, n), o = Fo(e.src, e.decode), s = o.status === "ready" ? K(o.original, r.edits.transform.quarterTurns) : null, c = h(e.onEditsChange);
|
|
4253
|
-
un(() => {
|
|
4412
|
+
var Yo = (e) => bo(tr, e);
|
|
4413
|
+
function Xo(e) {
|
|
4414
|
+
let t = ko(e), n = qo(e.redactModes), [r, i] = Yo(Oo(e, t, n)), a = Jo(i, n), o = Uo(e.src, e.decode), s = o.status === "ready" ? K(o.original, r.edits.transform.quarterTurns) : null, c = p(e.onEditsChange);
|
|
4415
|
+
an(() => {
|
|
4254
4416
|
c.current?.(r.edits);
|
|
4255
|
-
}, [r.edits]),
|
|
4256
|
-
let l =
|
|
4417
|
+
}, [r.edits]), Zo(e.defaultEdits?.crop ? void 0 : e.aspect, o.status === "ready" ? o.original : null, e.defaultEdits?.transform?.quarterTurns ?? 0, a);
|
|
4418
|
+
let l = Ro(r.zoom, a.setZoom), u = j(null), d = aa(r.tool, r.edits.crop), f = ua(u, s && {
|
|
4257
4419
|
width: d.w * s.width,
|
|
4258
4420
|
height: d.h * s.height
|
|
4259
|
-
}, r.zoom, l),
|
|
4421
|
+
}, r.zoom, l, e.toolbar === "floating" && r.tool === "crop"), m = Do({
|
|
4260
4422
|
source: o,
|
|
4261
4423
|
edits: r.edits,
|
|
4262
4424
|
options: r.exportOptions,
|
|
4263
4425
|
fileName: e.fileName ?? "image",
|
|
4264
4426
|
maxSize: e.maxExportSize,
|
|
4265
4427
|
onSave: e.onSave
|
|
4266
|
-
}),
|
|
4428
|
+
}), h = nr.selectSelected(r), g = Io(a, h, l, Ko(r, a, d, s));
|
|
4267
4429
|
return {
|
|
4268
4430
|
state: r,
|
|
4269
4431
|
actions: a,
|
|
4270
4432
|
source: o,
|
|
4271
4433
|
base: s,
|
|
4272
4434
|
tools: t,
|
|
4273
|
-
colors: e.colors?.length ? e.colors :
|
|
4435
|
+
colors: e.colors?.length ? e.colors : _n,
|
|
4274
4436
|
markupTools: e.markupTools?.length ? e.markupTools : void 0,
|
|
4275
4437
|
redactModes: n,
|
|
4276
|
-
aspectPresets: e.aspectPresets ??
|
|
4438
|
+
aspectPresets: e.aspectPresets ?? gn,
|
|
4277
4439
|
lockedAspect: e.aspect,
|
|
4278
|
-
canUndo:
|
|
4279
|
-
canRedo:
|
|
4280
|
-
selected:
|
|
4440
|
+
canUndo: nr.selectCanUndo(r),
|
|
4441
|
+
canRedo: nr.selectCanRedo(r),
|
|
4442
|
+
selected: h,
|
|
4281
4443
|
zoom: l,
|
|
4282
4444
|
stageRef: u,
|
|
4283
4445
|
view: d,
|
|
4284
4446
|
scale: f,
|
|
4285
|
-
exporting:
|
|
4447
|
+
exporting: m,
|
|
4286
4448
|
onSave: e.onSave,
|
|
4287
4449
|
onCancel: e.onCancel,
|
|
4288
4450
|
saveLabel: e.saveLabel,
|
|
4289
4451
|
hideDownload: e.hideDownload ?? !1,
|
|
4452
|
+
toolbar: e.toolbar ?? "panel",
|
|
4290
4453
|
fileName: e.fileName,
|
|
4291
4454
|
onKeyDown: g
|
|
4292
4455
|
};
|
|
4293
4456
|
}
|
|
4294
|
-
function
|
|
4295
|
-
let i =
|
|
4457
|
+
function Zo(e, t, n, r) {
|
|
4458
|
+
let i = p(n);
|
|
4296
4459
|
O(() => {
|
|
4297
4460
|
if (!e || !t) return;
|
|
4298
4461
|
let n = K(t, i.current);
|
|
4299
|
-
r.setCrop({ rect:
|
|
4462
|
+
r.setCrop({ rect: Fn({
|
|
4300
4463
|
x: 0,
|
|
4301
4464
|
y: 0,
|
|
4302
4465
|
w: 1,
|
|
@@ -4311,16 +4474,16 @@ function Vo(e, t, n, r) {
|
|
|
4311
4474
|
}
|
|
4312
4475
|
//#endregion
|
|
4313
4476
|
//#region lib/components/ui/media/image-editor/image-editor.tsx
|
|
4314
|
-
function
|
|
4315
|
-
let t =
|
|
4316
|
-
return /* @__PURE__ */ P(
|
|
4477
|
+
function Qo(e) {
|
|
4478
|
+
let t = Xo(e), { t: n } = i();
|
|
4479
|
+
return /* @__PURE__ */ P(sn, {
|
|
4317
4480
|
value: t,
|
|
4318
4481
|
children: /* @__PURE__ */ F("div", {
|
|
4319
4482
|
"data-slot": "image-editor",
|
|
4320
4483
|
className: T("@container/image-editor flex h-[600px] min-h-0 flex-col overflow-hidden rounded-xl border bg-background text-foreground", e.className),
|
|
4321
4484
|
onKeyDown: t.onKeyDown,
|
|
4322
4485
|
children: [
|
|
4323
|
-
/* @__PURE__ */ P(
|
|
4486
|
+
/* @__PURE__ */ P(uo, {}),
|
|
4324
4487
|
t.exporting.failed && /* @__PURE__ */ P("div", {
|
|
4325
4488
|
role: "alert",
|
|
4326
4489
|
className: "shrink-0 bg-error/10 px-4 py-2 text-error-text text-sm",
|
|
@@ -4328,11 +4491,7 @@ function Ho(e) {
|
|
|
4328
4491
|
}),
|
|
4329
4492
|
/* @__PURE__ */ F("div", {
|
|
4330
4493
|
className: "flex min-h-0 flex-1 flex-col @3xl/image-editor:flex-row",
|
|
4331
|
-
children: [
|
|
4332
|
-
/* @__PURE__ */ P(Va, {}),
|
|
4333
|
-
/* @__PURE__ */ P(na, {}),
|
|
4334
|
-
/* @__PURE__ */ P(Ga, {})
|
|
4335
|
-
]
|
|
4494
|
+
children: [/* @__PURE__ */ P(qa, {}), t.toolbar === "panel" && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(Xi, {}), /* @__PURE__ */ P(Za, {})] })]
|
|
4336
4495
|
})
|
|
4337
4496
|
]
|
|
4338
4497
|
})
|
|
@@ -4340,22 +4499,24 @@ function Ho(e) {
|
|
|
4340
4499
|
}
|
|
4341
4500
|
//#endregion
|
|
4342
4501
|
//#region lib/components/ui/media/image-editor/image-markup-editor.tsx
|
|
4343
|
-
var
|
|
4502
|
+
var $o = [
|
|
4344
4503
|
"pen",
|
|
4345
4504
|
"highlighter",
|
|
4346
4505
|
"arrow",
|
|
4347
4506
|
"rect",
|
|
4348
4507
|
"text",
|
|
4508
|
+
"step",
|
|
4349
4509
|
"redact"
|
|
4350
4510
|
];
|
|
4351
|
-
function
|
|
4352
|
-
return /* @__PURE__ */ P(
|
|
4353
|
-
...
|
|
4354
|
-
tools: ["markup"],
|
|
4511
|
+
function es({ markupTools: e = $o, decode: t = "bitmap", crop: n = !1, ...r }) {
|
|
4512
|
+
return /* @__PURE__ */ P(Qo, {
|
|
4513
|
+
...r,
|
|
4514
|
+
tools: n ? ["markup", "crop"] : ["markup"],
|
|
4515
|
+
defaultTool: "markup",
|
|
4355
4516
|
markupTools: e,
|
|
4356
4517
|
decode: t,
|
|
4357
4518
|
hideDownload: !0
|
|
4358
4519
|
});
|
|
4359
4520
|
}
|
|
4360
4521
|
//#endregion
|
|
4361
|
-
export {
|
|
4522
|
+
export { $o as EMBED_MARKUP_TOOLS, Qo as ImageEditor, es as ImageMarkupEditor, se as NxgtThemeProvider, v as PortalContainerProvider, re as adoptStyles };
|