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