pixedi 1.2.0 → 1.3.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 +10 -0
- package/dist/lib/index.js +1224 -1005
- package/dist/lib/index.umd.js +3 -3
- package/dist/widget/pixedi-widget.js +6 -6
- package/package.json +2 -1
package/dist/lib/index.js
CHANGED
|
@@ -1,21 +1,43 @@
|
|
|
1
|
-
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`._button_snd36_1{cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;box-sizing:border-box;background-color:#0000;border:1px solid #0000;border-radius:4px;justify-content:center;align-items:center;gap:8px;height:32px;padding:0 8px;font-family:inherit;font-size:14px;font-weight:500;transition:background-color .2s,border-color .2s,opacity .2s;display:inline-flex}._button_snd36_1:disabled{pointer-events:none;opacity:.5}._button_snd36_1 svg{flex-shrink:0;width:16px;height:16px}._default_snd36_32{background-color:var(--primary);color:var(--primary-foreground)}._default_snd36_32:hover{opacity:.9}._outline_snd36_39{border-color:var(--border);background-color:var(--background);color:var(--foreground)}._outline_snd36_39:hover{background-color:var(--secondary)}._ghost_snd36_47{color:var(--foreground);padding:0 8px}._ghost_snd36_47:hover{background-color:var(--secondary)}._rect_snd36_54{width:32px;height:32px}:host{height:100%;display:block}:host *{box-sizing:border-box}._root_kw2xl_8{width:100%;height:100%;font-size:16px;font-family:var(--font-sans);--font-sans:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, Helvetica, Arial, sans-serif;--color-white:#fff;--color-white-fade:color-mix(in srgb, var(--color-white) 30%, transparent);--color-black:#000;--color-transparent:transparent;--color-red:oklch(63.7% .237 25.331);--color-green:oklch(76.8% .188 151.716);--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(75.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--accent-blue:oklch(60.9% .221 251.687);--accent-blue-light:oklch(96% .02 250);--accent-blue-fade:color-mix(in srgb, var(--accent-blue) 60%, transparent);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 50%, transparent);--overlay-bg-white:color-mix(in srgb, var(--color-white) 80%, transparent);position:relative}._root_kw2xl_8[data-theme=dark]{--background:oklch(24.5% 0 0);--foreground:oklch(78.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(24.5% 0 0);--muted-foreground:oklch(50% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--accent-blue-light:oklch(25% .06 250);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 75%, transparent)}._root_kw2xl_8 h1,._root_kw2xl_8 h2,._root_kw2xl_8 h3,._root_kw2xl_8 h4,._root_kw2xl_8 h5,._root_kw2xl_8 h6{color:var(--foreground);margin:0;font-weight:600}._textRed_kw2xl_73{color:var(--color-red)}._bgRed_kw2xl_76{background-color:var(--color-red)}._bgGreen_kw2xl_79{background-color:var(--color-green)}._textGreen_kw2xl_82{color:var(--color-green)}._mask_kw2xl_85{background-color:var(--overlay-bg)}._semibold_kw2xl_88{letter-spacing:.4px;font-weight:600}._bold_kw2xl_92{letter-spacing:.4px;font-weight:700}._system_kw2xl_96{color:var(--muted-foreground);background-color:var(--background);justify-content:center;align-items:center;display:flex;position:absolute;inset:0}._wrapper_kw2xl_105{width:100%;height:100%;min-height:480px;position:relative}._main_kw2xl_111{background-color:var(--background);grid-template-rows:auto 1fr;display:grid;position:absolute;inset:0;overflow:hidden}._grid_kw2xl_119{grid-template-columns:1fr auto;min-height:0;display:grid;position:relative;overflow:hidden}._button_gf7m5_1{border:1px solid var(--border);background-color:var(--background);color:var(--foreground);cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;border-radius:4px;flex-direction:column;justify-content:center;align-items:center;gap:8px;padding:12px;font-family:inherit;font-size:12px;transition:all .2s;display:inline-flex}._button_gf7m5_1:hover:not([aria-pressed=true]){background-color:var(--secondary)}._button_gf7m5_1[aria-pressed=true]{border-color:var(--accent-blue);background-color:var(--accent-blue-light);color:var(--foreground)}._button_gf7m5_1 svg{flex-shrink:0;width:20px;height:20px}._button_gf7m5_1 span{white-space:nowrap}._separator_rqskq_1{background-color:var(--border);box-sizing:border-box;border:none;flex-shrink:0;display:block}._separator_rqskq_1[data-orientation=horizontal]{width:100%;height:1px}._separator_rqskq_1[data-orientation=vertical]{align-self:stretch;width:1px;height:100%;margin:0}._wrapper_12rgt_1{box-sizing:border-box;width:100%;position:relative}._trigger_12rgt_6{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--border);cursor:pointer;box-sizing:border-box;-webkit-user-select:none;user-select:none;border-radius:4px;outline:none;justify-content:space-between;align-items:center;padding:0 8px 0 10px;font-family:inherit;font-size:14px;transition:border-color .2s;display:flex}._trigger_12rgt_6:hover,._trigger_12rgt_6:focus{border-color:var(--muted-foreground)}._triggerArrow_12rgt_29{width:16px;height:16px;color:var(--muted-foreground);transition:transform .2s}._wrapper_12rgt_1[data-state=open] ._triggerArrow_12rgt_29{transform:rotate(180deg)}._content_12rgt_38{background-color:var(--background);border:1px solid var(--border);z-index:50;box-sizing:border-box;border-radius:4px;width:100%;max-height:282px;padding:4px;position:absolute;top:calc(100% + 4px);left:0;overflow-y:auto;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}._content_12rgt_38::-webkit-scrollbar{width:4px}._content_12rgt_38::-webkit-scrollbar-track{background:0 0}._content_12rgt_38::-webkit-scrollbar-thumb{background-color:var(--border);border-radius:10px}._wrapper_12rgt_1[data-state=closed] ._content_12rgt_38{display:none}._groupLabel_12rgt_68{color:var(--muted-foreground);-webkit-user-select:none;user-select:none;padding:8px 10px;font-size:12px;font-weight:500}._item_12rgt_75{width:100%;color:var(--foreground);cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;background:0 0;border-radius:4px;justify-content:space-between;align-items:center;padding:4px 10px;display:flex}._item_12rgt_75:hover{background-color:var(--secondary)}._itemLeft_12rgt_91{font-size:14px;font-weight:400}._itemAddon_12rgt_95{align-items:center;gap:8px;display:flex}._itemAddon_12rgt_95>span{color:var(--muted-foreground);font-size:12px}._itemAddon_12rgt_95>svg{font-size:14px}._itemAddon_12rgt_95>b{flex-shrink:0;width:16px;height:16px}._itemRightContainer_12rgt_112{align-items:center;gap:8px;display:flex}._itemRight_12rgt_112{color:var(--muted-foreground);font-size:14px}._itemCheck_12rgt_121{width:16px;height:16px;color:var(--foreground);flex-shrink:0}._input_j55nq_1{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--input);box-sizing:border-box;border-radius:4px;outline:none;padding:0 8px;font-family:inherit;font-size:14px;line-height:normal;transition:border-color .2s,box-shadow .2s;display:block}._input_j55nq_1:hover:not(:disabled):not(:focus){border-color:var(--muted-foreground)}._input_j55nq_1:focus{box-shadow:0 0 0 1px var(--ring)}._input_j55nq_1:disabled{cursor:not-allowed;opacity:.5;background-color:var(--secondary)}._input_j55nq_1::placeholder{color:var(--muted-foreground);opacity:1}._numberClean_j55nq_34::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._numberClean_j55nq_34::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}._numberClean_j55nq_34[type=number]{-moz-appearance:textfield}._container_14vsv_1{position:relative}._legend_14vsv_4{color:var(--muted-foreground);background:var(--background);margin-left:8px;padding:0 4px;font-size:12px;position:absolute;top:-9px}._suffix_14vsv_13{color:var(--muted-foreground);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:14px;position:absolute;bottom:2px;right:8px}._group_qpue1_1{margin-left:4px;display:flex}._group_qpue1_1 ._save_qpue1_6{width:36px;color:var(--color-green);border-top-right-radius:0;border-bottom-right-radius:0}._group_qpue1_1 ._close_qpue1_13{width:36px;color:var(--color-red);border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}._sliderContainer_1ntcm_1{cursor:pointer;touch-action:none;--slider-progress:0%;align-items:center;width:100%;height:24px;display:flex;position:relative}._sliderContainer_1ntcm_1._disabled_1ntcm_12{pointer-events:none;cursor:not-allowed;opacity:.5}._sliderTrack_1ntcm_18{background-color:color-mix(in oklch, var(--muted-foreground) 65%, transparent);border-radius:2px;width:100%;height:2px;position:relative}._sliderRange_1ntcm_30{background-color:var(--primary);height:100%;width:var(--slider-progress);border-radius:2px;position:absolute}._sliderThumb_1ntcm_38{background-color:var(--background);border:2px solid var(--primary);pointer-events:none;border-radius:50%;width:12px;height:13px;transition:transform .1s,box-shadow .1s;position:absolute;top:50%;transform:translate(-50%,-50%)}._hiddenInput_1ntcm_53{opacity:0;cursor:pointer;z-index:1;width:100%;height:100%;margin:0;position:absolute;top:0;left:0}._sliderContainer_1ntcm_1:not(._disabled_1ntcm_12):hover ._sliderThumb_1ntcm_38{transform:translate(-50%,-50%)scale(1.1)}._header_msw8l_1{box-sizing:border-box;background-color:var(--background);border-bottom:1px solid var(--border);justify-content:space-between;align-items:center;height:48px;padding:0 8px;display:flex}._tools_msw8l_11{gap:8px;display:flex}._history_msw8l_15{align-items:center;gap:8px;display:flex}._historyText_msw8l_20{color:var(--muted-foreground);font-size:14px}._resize_11cwi_1{background-color:var(--background);border-radius:4px;flex-direction:column;gap:2px;padding:8px;display:flex;position:absolute;bottom:24px;left:50%;transform:translate(-50%);box-shadow:0 2px 8px #0000001a}._slider_11cwi_14{width:80%;margin:0 auto -4px}._border_11cwi_18{border-bottom:1px solid var(--border);width:60px;margin:12px auto 4px;display:inline-block}._tools_11cwi_24{align-items:center;gap:6px;margin-top:16px;display:flex}._toolsLock_11cwi_30{width:12px;height:12px;color:var(--muted-foreground)}._preview_dvanl_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._rotate_dvanl_12{box-sizing:border-box;width:100%;height:100%;transition:all .2s linear;position:absolute;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}._flip_dvanl_24{box-sizing:border-box;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._image_dvanl_32{max-width:none;max-height:none;transition:all .2s linear;display:block;position:absolute}._wrapper_13nh3_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;position:absolute;inset:0}._box_13nh3_9{cursor:move;box-sizing:border-box;-webkit-user-select:none;user-select:none;touch-action:none;border:1px solid var(--color-white-fade);position:absolute}._tools_13nh3_18{background-color:var(--background);box-sizing:border-box;border:1px solid var(--border);border-radius:4px;align-items:center;padding:4px 4px 4px 8px;display:flex;position:absolute;bottom:24px;left:50%;transform:translate(-50%);box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}._toolsInfo_13nh3_34{-webkit-user-select:none;user-select:none;min-width:54px;margin-top:-2px;display:inline-block}._toolsInfoLabel_13nh3_41{color:var(--muted-foreground);font-size:12px;line-height:12px}._toolsInfoValue_13nh3_46{color:var(--foreground);font-size:14px;line-height:14px}._linesBox_13nh3_51{pointer-events:none;position:absolute;inset:2px}._line_13nh3_51{border:1px dashed var(--color-white);opacity:.5;position:absolute}._lineV_13nh3_61{border-top:0;border-bottom:0;width:33%;height:100%;top:0;left:33%}._lineH_13nh3_69{border-left:0;border-right:0;width:100%;height:33%;top:33%;left:0}._pointer_13nh3_77{box-sizing:border-box;width:14px;height:14px;position:absolute}._pointerTopLeft_13nh3_83{border-top:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nwse-resize;top:-6px;left:-6px}._pointerTopRight_13nh3_90{border-top:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nesw-resize;top:-6px;right:-6px}._pointerBottomRight_13nh3_97{border-bottom:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nwse-resize;bottom:-6px;right:-6px}._pointerBottomLeft_13nh3_104{border-bottom:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nesw-resize;bottom:-6px;left:-6px}._mobileBorder_13nh3_111{box-sizing:border-box;border:2px solid var(--accent-blue);position:absolute;inset:0}._mobilePointer_13nh3_117{background-color:var(--overlay-bg-white);border:3px solid var(--accent-blue);box-sizing:border-box;border-radius:50%;width:32px;height:32px;position:absolute;bottom:-16px;right:-16px}._flip_17ic5_1{background-color:var(--background);border-radius:4px;gap:4px;padding:4px;display:flex;position:absolute;bottom:24px;left:50%;transform:translate(-50%);box-shadow:0 2px 8px #0000001a}._btnH_17ic5_14{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._btnV_17ic5_20{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._rotate_gkt07_1{background-color:var(--background);border-radius:4px;gap:4px;padding:4px;display:flex;position:absolute;bottom:24px;left:50%;transform:translate(-50%);box-shadow:0 2px 8px #0000001a}._btnH_gkt07_14{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._btnV_gkt07_20{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._frame_xffug_1{box-sizing:border-box;width:100%;height:100%;margin:0 auto;padding:16px;position:relative}._sidebar_8qtha_1{z-index:10;width:0;transition:transform .15s ease-out;position:relative}@media (width>=768px){._sidebar_8qtha_1{width:320px;transition:none}}._settings_8qtha_11{border-radius:50%;width:40px;height:40px;position:absolute;top:8px;right:8px;box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a}@media (width>=768px){._settings_8qtha_11{display:none}}._container_8qtha_25{box-sizing:border-box;border-left:1px solid var(--border);position:absolute;inset:0}._content_8qtha_31{background-color:var(--background);box-sizing:border-box;flex-direction:column;width:320px;height:100%;padding:16px;display:flex;position:absolute;top:0;left:0;overflow-y:auto}@media (width<=767px){._content_8qtha_31{padding-top:48px}}._closeBtn_8qtha_47{position:absolute;top:8px;right:8px}._separator_8qtha_52{margin-top:20px;margin-bottom:12px}._resize_8qtha_56{justify-content:space-between;align-items:center;display:flex}._resizeIcon_8qtha_61{align-items:center;gap:8px;display:flex}._resizeSize_8qtha_66{color:var(--muted-foreground);font-size:14px}._crop_8qtha_70{flex-direction:column;gap:8px;display:flex}._ratio_8qtha_75{grid-template-columns:repeat(3,1fr);gap:8px;display:grid}._sidebarPreset_8qtha_80{flex-direction:column;gap:8px;display:flex}._flipRotate_8qtha_85{grid-template-columns:repeat(2,1fr);gap:8px;display:grid}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
2
|
-
import { createContext as e, forwardRef as t,
|
|
1
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`._button_1vpzl_1{cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;box-sizing:border-box;background-color:#0000;border:1px solid #0000;border-radius:4px;justify-content:center;align-items:center;gap:8px;height:32px;padding:0 8px;font-family:inherit;font-size:14px;font-weight:500;transition:background-color .2s,border-color .2s,opacity .2s;display:inline-flex}._button_1vpzl_1:disabled{pointer-events:none;opacity:.5}._button_1vpzl_1 svg{flex-shrink:0;width:16px;height:16px}._default_1vpzl_35{background-color:var(--primary);color:var(--primary-foreground)}._default_1vpzl_35:hover{opacity:.9}._outline_1vpzl_44{border-color:var(--border);background-color:var(--background);color:var(--foreground)}._outline_1vpzl_44:hover{background-color:var(--secondary)}._ghost_1vpzl_54{color:var(--foreground);padding:0 8px}._ghost_1vpzl_54:hover{background-color:var(--secondary)}._rect_1vpzl_63{width:32px;height:32px}._separator_gp8ff_1{background-color:var(--border);box-sizing:border-box;border:none;flex-shrink:0;display:block}._separator_gp8ff_1[data-orientation=horizontal]{width:100%;height:1px}._separator_gp8ff_1[data-orientation=vertical]{align-self:stretch;width:1px;height:100%;margin:0}._wrapper_1aw0m_1{box-sizing:border-box;width:100%;position:relative}._trigger_1aw0m_6{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--border);cursor:pointer;box-sizing:border-box;-webkit-user-select:none;user-select:none;border-radius:4px;outline:none;justify-content:space-between;align-items:center;padding:0 8px 0 10px;font-family:inherit;font-size:14px;transition:border-color .2s;display:flex}._trigger_1aw0m_6:hover,._trigger_1aw0m_6:focus{border-color:var(--muted-foreground)}._triggerArrow_1aw0m_31{width:16px;height:16px;color:var(--muted-foreground);transition:transform .2s}._wrapper_1aw0m_1[data-state=open] ._triggerArrow_1aw0m_31{transform:rotate(180deg)}._content_1aw0m_40{background-color:var(--background);border:1px solid var(--border);z-index:50;box-sizing:border-box;border-radius:4px;width:100%;max-height:282px;padding:4px;position:absolute;top:calc(100% + 4px);left:0;overflow-y:auto;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}._content_1aw0m_40::-webkit-scrollbar{width:4px}._content_1aw0m_40::-webkit-scrollbar-track{background:0 0}._content_1aw0m_40::-webkit-scrollbar-thumb{background-color:var(--border);border-radius:10px}._wrapper_1aw0m_1[data-state=closed] ._content_1aw0m_40{display:none}._groupLabel_1aw0m_74{color:var(--muted-foreground);-webkit-user-select:none;user-select:none;padding:8px 10px;font-size:12px;font-weight:500}._item_1aw0m_81{width:100%;color:var(--foreground);cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;background:0 0;border-radius:4px;justify-content:space-between;align-items:center;padding:4px 10px;display:flex}._item_1aw0m_81:hover{background-color:var(--secondary)}._itemLeft_1aw0m_98{font-size:14px;font-weight:400}._itemAddon_1aw0m_102{align-items:center;gap:8px;display:flex}._itemAddon_1aw0m_102 span{color:var(--muted-foreground);font-size:12px}._itemAddon_1aw0m_102 svg{font-size:14px}._itemAddon_1aw0m_102 b{flex-shrink:0;width:16px;height:16px}._itemRightContainer_1aw0m_122{align-items:center;gap:8px;display:flex}._itemRight_1aw0m_122{color:var(--muted-foreground);font-size:14px}._itemCheck_1aw0m_131{width:16px;height:16px;color:var(--foreground);flex-shrink:0}:host{height:100%;display:block}:host *{box-sizing:border-box}._root_c6gk7_8{width:100%;height:100%;font-size:16px;font-family:var(--font-sans);--font-sans:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, Helvetica, Arial, sans-serif;--font-mono:"Courier New", Courier, monospace;--color-white:#fff;--color-white-fade:color-mix(in srgb, var(--color-white) 40%, transparent);--color-black:#000;--color-red:oklch(63.7% .237 25.331);--color-green:oklch(76.8% .188 151.716);--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(75.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--accent-blue:oklch(60.9% .221 251.687);--accent-blue-light:oklch(96% .02 250);--accent-blue-fade:color-mix(in srgb, var(--accent-blue) 60%, transparent);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 50%, transparent);--overlay-bg-white:color-mix(in srgb, var(--color-white) 80%, transparent);position:relative}._root_c6gk7_8[data-theme=dark]{--background:oklch(24.5% 0 0);--foreground:oklch(78.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(24.5% 0 0);--muted-foreground:oklch(50% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--accent-blue-light:oklch(25% .06 250);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 75%, transparent)}._root_c6gk7_8 h1,._root_c6gk7_8 h2,._root_c6gk7_8 h3,._root_c6gk7_8 h4,._root_c6gk7_8 h5,._root_c6gk7_8 h6{color:var(--foreground);margin:0;font-weight:600}._textRed_c6gk7_73{color:var(--color-red)}._bgRed_c6gk7_76{background-color:var(--color-red)}._bgGreen_c6gk7_79{background-color:var(--color-green)}._textGreen_c6gk7_82{color:var(--color-green)}._mask_c6gk7_85{background-color:var(--overlay-bg)}._semibold_c6gk7_88{letter-spacing:.4px;font-weight:600}._bold_c6gk7_92{letter-spacing:.4px;font-weight:700}._system_c6gk7_96{color:var(--muted-foreground);background-color:var(--background);justify-content:center;align-items:center;display:flex;position:absolute;inset:0}._wrapper_c6gk7_106{width:100%;height:100%;min-height:480px;position:relative;overflow:hidden}._grid_c6gk7_113{grid-template:"header header"48px"sidebar frame"minmax(0,1fr)"sidebar infobar"32px/48px 1fr;height:100%;display:grid;position:relative}._grid_c6gk7_113._mobile_c6gk7_124{grid-template-columns:0 1fr}._gridNoInfobar_c6gk7_128{grid-template:"header header"48px"sidebar frame"1fr/48px 1fr;height:100%;display:grid;position:relative}._gridNoInfobar_c6gk7_128._mobile_c6gk7_124{grid-template-columns:0 1fr}._input_kyavx_1{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--input);box-sizing:border-box;border-radius:4px;outline:none;padding:0 8px;font-family:inherit;font-size:14px;line-height:normal;transition:border-color .2s,box-shadow .2s;display:block}._input_kyavx_1:hover:not(:disabled):not(:focus){border-color:var(--muted-foreground)}._input_kyavx_1:focus{box-shadow:0 0 0 1px var(--ring)}._input_kyavx_1:disabled{cursor:not-allowed;opacity:.5;background-color:var(--secondary)}._input_kyavx_1::placeholder{color:var(--muted-foreground);opacity:1}._numberClean_kyavx_39::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39[type=number]{-moz-appearance:textfield}._container_14vsv_1{position:relative}._legend_14vsv_4{color:var(--muted-foreground);background:var(--background);margin-left:8px;padding:0 4px;font-size:12px;position:absolute;top:-9px}._suffix_14vsv_13{color:var(--muted-foreground);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:14px;position:absolute;bottom:2px;right:8px}._group_1e7jm_1{margin-left:4px;display:flex}._save_1e7jm_6{width:36px;color:var(--color-green);border-top-right-radius:0;border-bottom-right-radius:0}._close_1e7jm_13{width:36px;color:var(--color-red);border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}._header_25ynx_1{box-sizing:border-box;background-color:var(--background);border-bottom:1px solid var(--border);grid-area:header;justify-content:space-between;align-items:center;height:48px;padding:0 8px;display:flex}._left_25ynx_12{align-items:center;gap:0;display:flex}._sidebarToggle_25ynx_17{border-right:solid 1px var(--border);cursor:pointer;justify-content:center;align-items:center;width:48px;height:48px;transition:all .2s;display:none;position:relative;left:-8px}._sidebarToggle_25ynx_17._mobile_25ynx_29{display:flex}._sidebarIcon_25ynx_33{stroke-width:1.6px;width:18px;height:18px}._tools_25ynx_38{gap:8px;display:flex}._history_25ynx_42{align-items:center;gap:4px;display:flex}._historyText_25ynx_47{color:var(--muted-foreground);font-size:14px;font-family:var(--font-mono)}._sidebar_16gr5_1{background:var(--background);border-right:1px solid var(--border);z-index:10;grid-area:sidebar;width:48px;position:relative;overflow:hidden}._sidebar_16gr5_1._mobile_16gr5_10{transition:transform .2s ease-out;transform:translate(-110%);box-shadow:0 4px 6px #0000001a}._sidebar_16gr5_1._mobile_16gr5_10._open_16gr5_15{transform:translate(0%)}._item_16gr5_20{cursor:pointer;justify-content:center;align-items:center;height:48px;transition:all .2s;display:flex;position:relative}._item_16gr5_20 svg{width:16px;height:16px}._item_16gr5_20:hover{background-color:var(--accent)}._item_16gr5_20._selected_16gr5_38{color:var(--accent-blue);background-color:var(--accent)}._item_16gr5_20._selected_16gr5_38:before{content:"";background-color:var(--accent-blue);width:2px;position:absolute;top:0;bottom:0;left:0}._infobar_ofe91_1{background:var(--muted);font-family:var(--font-mono);grid-area:infobar;justify-content:space-between;align-items:center;padding:0 16px;font-size:14px;display:flex}._resize_s127g_1{background-color:var(--background);border-radius:4px;align-items:center;gap:6px;padding:15px 8px 8px;display:flex;position:absolute;bottom:24px;left:50%;overflow:hidden;transform:translate(-50%);box-shadow:0 2px 8px #0000001a}._toolsLock_s127g_15{width:12px;height:12px;color:var(--muted-foreground)}._indicatorWrapper_s127g_20{justify-content:center;width:100%;height:1px;display:flex;position:absolute;top:0;left:0}._indicator_s127g_20{background:var(--accent-blue);opacity:.6;border-radius:2px;width:30%;height:100%;transition:width .2s}._preview_dvanl_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._rotate_dvanl_12{box-sizing:border-box;width:100%;height:100%;transition:all .2s linear;position:absolute;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}._flip_dvanl_24{box-sizing:border-box;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._image_dvanl_32{max-width:none;max-height:none;transition:all .2s linear;display:block;position:absolute}._wrapper_1yhyo_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;position:absolute;inset:0}._box_1yhyo_9{cursor:move;box-sizing:border-box;-webkit-user-select:none;user-select:none;touch-action:none;border:1px solid var(--color-white-fade);position:absolute}._tools_1yhyo_18{background-color:var(--background);box-sizing:border-box;border:1px solid var(--border);border-radius:4px;align-items:center;gap:6px;padding:4px;display:flex;position:absolute;bottom:24px;left:50%;transform:translate(-50%);box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}._toolsInfo_1yhyo_35{-webkit-user-select:none;user-select:none;min-width:54px;margin-top:-2px;display:inline-block}._toolsInfoLabel_1yhyo_42{color:var(--muted-foreground);font-size:12px;line-height:12px}._toolsInfoValue_1yhyo_47{color:var(--foreground);font-size:14px;line-height:14px}._linesBox_1yhyo_52{pointer-events:none;position:absolute;inset:1px}._line_1yhyo_52{border:1px dashed var(--color-white);opacity:.5;position:absolute}._lineV_1yhyo_62{border-top:0;border-bottom:0;width:33%;height:100%;top:0;left:33%}._lineH_1yhyo_70{border-left:0;border-right:0;width:100%;height:33%;top:33%;left:0}._pointer_1yhyo_78{box-sizing:border-box;width:14px;height:14px;position:absolute}._pointerTopLeft_1yhyo_84{border-top:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nwse-resize;top:-6px;left:-6px}._pointerTopRight_1yhyo_91{border-top:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nesw-resize;top:-6px;right:-6px}._pointerBottomRight_1yhyo_98{border-bottom:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nwse-resize;bottom:-6px;right:-6px}._pointerBottomLeft_1yhyo_105{border-bottom:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nesw-resize;bottom:-6px;left:-6px}._mobileBorder_1yhyo_112{box-sizing:border-box;border:2px solid var(--accent-blue);position:absolute;inset:0}._mobilePointer_1yhyo_118{background-color:var(--overlay-bg-white);border:3px solid var(--accent-blue);box-sizing:border-box;border-radius:50%;width:32px;height:32px;position:absolute;bottom:-16px;right:-16px}._info_1yhyo_129{height:16px;font-family:var(--font-mono);color:#000;background-color:var(--color-white-fade);box-sizing:border-box;align-items:center;padding:0 6px;font-size:12px;display:flex;position:absolute}._info_1yhyo_129 b{font-weight:600;transform:translateY(1px)}._infoX_1yhyo_146{border-left:solid 2px var(--accent-blue);top:-12px;left:16px}._infoY_1yhyo_151{transform-origin:100%;border-right:solid 2px var(--accent-blue);top:8px;right:calc(100% + 4px);transform:rotate(-90deg)}._infoW_1yhyo_158{border-right:solid 2px var(--accent-blue);bottom:-12px;right:16px}._infoH_1yhyo_163{transform-origin:0%;border-left:solid 2px var(--accent-blue);bottom:8px;left:calc(100% + 4px);transform:rotate(-90deg)}._group_1yhyo_170{flex-shrink:0;width:max-content;display:flex}._group_1yhyo_170 button{color:var(--foreground);border-radius:0}._group_1yhyo_170 button._active_1yhyo_179{color:var(--accent-blue);background:var(--muted)}._group_1yhyo_170 button:not(:first-child){margin-left:-1px}._group_1yhyo_170 button:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px}._group_1yhyo_170 button:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px}._preset_1rbuc_1{background-color:var(--background);border-radius:4px;gap:4px;padding:4px;display:flex;position:absolute;bottom:24px;left:50%;transform:translate(-50%);box-shadow:0 2px 8px #0000001a}._select_1rbuc_14{width:210px}._flip_17ic5_1{background-color:var(--background);border-radius:4px;gap:4px;padding:4px;display:flex;position:absolute;bottom:24px;left:50%;transform:translate(-50%);box-shadow:0 2px 8px #0000001a}._btnH_17ic5_14{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._btnV_17ic5_20{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._rotate_gkt07_1{background-color:var(--background);border-radius:4px;gap:4px;padding:4px;display:flex;position:absolute;bottom:24px;left:50%;transform:translate(-50%);box-shadow:0 2px 8px #0000001a}._btnH_gkt07_14{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._btnV_gkt07_20{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._frame_15mog_1{box-sizing:border-box;grid-area:frame;width:100%;height:100%;margin:0 auto;position:relative;overflow:hidden}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
2
|
+
import { createContext as e, forwardRef as t, useCallback as n, useContext as r, useEffect as i, useLayoutEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
3
3
|
//#region \0rolldown/runtime.js
|
|
4
|
-
var
|
|
4
|
+
var l = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), u = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
5
5
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
6
6
|
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
7
|
-
}),
|
|
7
|
+
}), d = {
|
|
8
|
+
sm: 480,
|
|
9
|
+
md: 768,
|
|
10
|
+
lg: 1024,
|
|
11
|
+
xl: 1280
|
|
12
|
+
}, f = {
|
|
13
|
+
INITIAL: "initial",
|
|
14
|
+
RESIZE: "resize",
|
|
15
|
+
CROP: "crop",
|
|
16
|
+
PRESET_CROP: "presetCrop",
|
|
17
|
+
FLIP: "flip",
|
|
18
|
+
ROTATE: "rotate",
|
|
19
|
+
FILTERS: "filters"
|
|
20
|
+
}, p = {
|
|
21
|
+
tools: [
|
|
22
|
+
"resize",
|
|
23
|
+
"crop",
|
|
24
|
+
"presetCrop",
|
|
25
|
+
"flip",
|
|
26
|
+
"rotate",
|
|
27
|
+
"filters"
|
|
28
|
+
],
|
|
29
|
+
infobar: !0,
|
|
8
30
|
quality: .85,
|
|
9
31
|
saveAsWEBP: !1,
|
|
10
32
|
exportAs: "blob"
|
|
11
|
-
},
|
|
33
|
+
}, m = (e, t, n, r, i, a, o) => ({
|
|
12
34
|
history: {
|
|
13
35
|
pointer: 0,
|
|
14
36
|
items: [{
|
|
15
37
|
width: t,
|
|
16
38
|
height: n,
|
|
17
39
|
action: {
|
|
18
|
-
name:
|
|
40
|
+
name: f.INITIAL,
|
|
19
41
|
args: null
|
|
20
42
|
}
|
|
21
43
|
}]
|
|
@@ -27,7 +49,7 @@ var c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
27
49
|
sidebar: !1,
|
|
28
50
|
settings: o,
|
|
29
51
|
isAlpha: a
|
|
30
|
-
}),
|
|
52
|
+
}), h = e(void 0), g = /* @__PURE__ */ l(((e) => {
|
|
31
53
|
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
32
54
|
function r(e, n, r) {
|
|
33
55
|
var i = null;
|
|
@@ -42,19 +64,19 @@ var c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
42
64
|
};
|
|
43
65
|
}
|
|
44
66
|
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
45
|
-
})),
|
|
67
|
+
})), _ = /* @__PURE__ */ l(((e) => {
|
|
46
68
|
process.env.NODE_ENV !== "production" && (function() {
|
|
47
69
|
function t(e) {
|
|
48
70
|
if (e == null) return null;
|
|
49
|
-
if (typeof e == "function") return e.$$typeof ===
|
|
71
|
+
if (typeof e == "function") return e.$$typeof === te ? null : e.displayName || e.name || null;
|
|
50
72
|
if (typeof e == "string") return e;
|
|
51
73
|
switch (e) {
|
|
52
74
|
case v: return "Fragment";
|
|
53
75
|
case b: return "Profiler";
|
|
54
76
|
case y: return "StrictMode";
|
|
55
|
-
case
|
|
56
|
-
case
|
|
57
|
-
case
|
|
77
|
+
case ee: return "Suspense";
|
|
78
|
+
case w: return "SuspenseList";
|
|
79
|
+
case D: return "Activity";
|
|
58
80
|
}
|
|
59
81
|
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
60
82
|
case _: return "Portal";
|
|
@@ -99,14 +121,14 @@ var c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
99
121
|
}
|
|
100
122
|
}
|
|
101
123
|
function a() {
|
|
102
|
-
var e =
|
|
124
|
+
var e = O.A;
|
|
103
125
|
return e === null ? null : e.getOwner();
|
|
104
126
|
}
|
|
105
127
|
function o() {
|
|
106
128
|
return Error("react-stack-top-frame");
|
|
107
129
|
}
|
|
108
130
|
function s(e) {
|
|
109
|
-
if (
|
|
131
|
+
if (k.call(e, "key")) {
|
|
110
132
|
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
111
133
|
if (t && t.isReactWarning) return !1;
|
|
112
134
|
}
|
|
@@ -114,16 +136,16 @@ var c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
114
136
|
}
|
|
115
137
|
function c(e, t) {
|
|
116
138
|
function n() {
|
|
117
|
-
|
|
139
|
+
re || (re = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
118
140
|
}
|
|
119
141
|
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
120
142
|
get: n,
|
|
121
143
|
configurable: !0
|
|
122
144
|
});
|
|
123
145
|
}
|
|
124
|
-
function
|
|
146
|
+
function l() {
|
|
125
147
|
var e = t(this.type);
|
|
126
|
-
return
|
|
148
|
+
return j[e] || (j[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
127
149
|
}
|
|
128
150
|
function d(e, t, n, r, i, a) {
|
|
129
151
|
var o = n.ref;
|
|
@@ -138,7 +160,7 @@ var c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
138
160
|
value: null
|
|
139
161
|
}) : Object.defineProperty(e, "ref", {
|
|
140
162
|
enumerable: !1,
|
|
141
|
-
get:
|
|
163
|
+
get: l
|
|
142
164
|
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
143
165
|
configurable: !1,
|
|
144
166
|
enumerable: !1,
|
|
@@ -163,17 +185,17 @@ var c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
163
185
|
}
|
|
164
186
|
function f(e, n, i, o, l, u) {
|
|
165
187
|
var f = n.children;
|
|
166
|
-
if (f !== void 0) if (o) if (
|
|
188
|
+
if (f !== void 0) if (o) if (ne(f)) {
|
|
167
189
|
for (o = 0; o < f.length; o++) p(f[o]);
|
|
168
190
|
Object.freeze && Object.freeze(f);
|
|
169
191
|
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
170
192
|
else p(f);
|
|
171
|
-
if (
|
|
193
|
+
if (k.call(n, "key")) {
|
|
172
194
|
f = t(e);
|
|
173
195
|
var m = Object.keys(n).filter(function(e) {
|
|
174
196
|
return e !== "key";
|
|
175
197
|
});
|
|
176
|
-
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}",
|
|
198
|
+
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", N[f + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, f, m, f), N[f + o] = !0);
|
|
177
199
|
}
|
|
178
200
|
if (f = null, i !== void 0 && (r(i), f = "" + i), s(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
179
201
|
else i = n;
|
|
@@ -185,32 +207,32 @@ var c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
185
207
|
function m(e) {
|
|
186
208
|
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
187
209
|
}
|
|
188
|
-
var h =
|
|
210
|
+
var h = u("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), ee = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), D = Symbol.for("react.activity"), te = Symbol.for("react.client.reference"), O = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, k = Object.prototype.hasOwnProperty, ne = Array.isArray, A = console.createTask ? console.createTask : function() {
|
|
189
211
|
return null;
|
|
190
212
|
};
|
|
191
213
|
h = { react_stack_bottom_frame: function(e) {
|
|
192
214
|
return e();
|
|
193
215
|
} };
|
|
194
|
-
var
|
|
216
|
+
var re, j = {}, ie = h.react_stack_bottom_frame.bind(h, o)(), M = A(i(o)), N = {};
|
|
195
217
|
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
196
|
-
var r = 1e4 >
|
|
197
|
-
return f(e, t, n, !1, r ? Error("react-stack-top-frame") :
|
|
218
|
+
var r = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
219
|
+
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : ie, r ? A(i(e)) : M);
|
|
198
220
|
}, e.jsxs = function(e, t, n) {
|
|
199
|
-
var r = 1e4 >
|
|
200
|
-
return f(e, t, n, !0, r ? Error("react-stack-top-frame") :
|
|
221
|
+
var r = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
222
|
+
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : ie, r ? A(i(e)) : M);
|
|
201
223
|
};
|
|
202
224
|
})();
|
|
203
|
-
})),
|
|
204
|
-
process.env.NODE_ENV === "production" ? t.exports =
|
|
205
|
-
})))(),
|
|
206
|
-
let [
|
|
207
|
-
|
|
225
|
+
})), v = (/* @__PURE__ */ l(((e, t) => {
|
|
226
|
+
process.env.NODE_ENV === "production" ? t.exports = g() : t.exports = _();
|
|
227
|
+
})))(), y = ({ children: e, mimeType: t, width: n, height: r, originalBlob: a, previewUrl: l, isAlpha: u, settings: d }) => {
|
|
228
|
+
let [p, g] = c(m(t, n, r, a, l, u, d)), _ = s(null);
|
|
229
|
+
i(() => () => {
|
|
208
230
|
_.current &&= (URL.revokeObjectURL(_.current), null);
|
|
209
231
|
}, []);
|
|
210
|
-
let
|
|
232
|
+
let y = (e) => g((t) => ({
|
|
211
233
|
...t,
|
|
212
234
|
currentAction: e
|
|
213
|
-
})),
|
|
235
|
+
})), b = (e) => g((t) => {
|
|
214
236
|
let n = t.history.pointer + 1, r = [...t.history.items.slice(0, n), e];
|
|
215
237
|
return {
|
|
216
238
|
...t,
|
|
@@ -220,28 +242,28 @@ var c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
220
242
|
pointer: n
|
|
221
243
|
}
|
|
222
244
|
};
|
|
223
|
-
}),
|
|
224
|
-
let { items: e, pointer: t } =
|
|
245
|
+
}), x = () => {
|
|
246
|
+
let { items: e, pointer: t } = p.history;
|
|
225
247
|
return e.at(t) ?? e.at(0) ?? {
|
|
226
248
|
width: 0,
|
|
227
249
|
height: 0,
|
|
228
250
|
action: {
|
|
229
|
-
name:
|
|
251
|
+
name: f.INITIAL,
|
|
230
252
|
args: null
|
|
231
253
|
}
|
|
232
254
|
};
|
|
233
|
-
},
|
|
234
|
-
let { items: e, pointer: t } =
|
|
255
|
+
}, S = () => {
|
|
256
|
+
let { items: e, pointer: t } = p.history;
|
|
235
257
|
if (e.length === 0 || t < 0) return 0;
|
|
236
|
-
let n = e.slice(0, t + 1).findLast((e) => e.action.name ===
|
|
237
|
-
return n?.action.name ===
|
|
238
|
-
},
|
|
258
|
+
let n = e.slice(0, t + 1).findLast((e) => e.action.name === f.ROTATE);
|
|
259
|
+
return n?.action.name === f.ROTATE ? n.action.args.degrees : 0;
|
|
260
|
+
}, C = () => g((e) => ({
|
|
239
261
|
...e,
|
|
240
262
|
history: {
|
|
241
263
|
items: [e.history.items[0]],
|
|
242
264
|
pointer: 0
|
|
243
265
|
}
|
|
244
|
-
})),
|
|
266
|
+
})), ee = () => g((e) => e.history.pointer <= 0 ? e : {
|
|
245
267
|
...e,
|
|
246
268
|
history: {
|
|
247
269
|
...e.history,
|
|
@@ -253,46 +275,46 @@ var c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
253
275
|
...e.history,
|
|
254
276
|
pointer: e.history.pointer + 1
|
|
255
277
|
}
|
|
256
|
-
}),
|
|
278
|
+
}), T = (e) => g((t) => ({
|
|
257
279
|
...t,
|
|
258
280
|
sidebar: e
|
|
259
|
-
})),
|
|
260
|
-
_.current && URL.revokeObjectURL(_.current), _.current = URL.createObjectURL(e.previewBlob), g(
|
|
281
|
+
})), E = o(() => new EventTarget(), []), D = (e) => {
|
|
282
|
+
_.current && URL.revokeObjectURL(_.current), _.current = URL.createObjectURL(e.previewBlob), g(m(e.mimeType, e.width, e.height, e.newBlob, _.current, e.isAlpha, d));
|
|
261
283
|
};
|
|
262
|
-
return /* @__PURE__ */ (0,
|
|
284
|
+
return /* @__PURE__ */ (0, v.jsx)(h, {
|
|
263
285
|
value: {
|
|
264
|
-
...
|
|
265
|
-
setImage:
|
|
266
|
-
setCurrentAction:
|
|
267
|
-
getLastHistoryItem:
|
|
268
|
-
getLastRotation:
|
|
269
|
-
addToHistory:
|
|
270
|
-
resetHistory:
|
|
271
|
-
undo:
|
|
286
|
+
...p,
|
|
287
|
+
setImage: D,
|
|
288
|
+
setCurrentAction: y,
|
|
289
|
+
getLastHistoryItem: x,
|
|
290
|
+
getLastRotation: S,
|
|
291
|
+
addToHistory: b,
|
|
292
|
+
resetHistory: C,
|
|
293
|
+
undo: ee,
|
|
272
294
|
redo: w,
|
|
273
|
-
setSidebar:
|
|
274
|
-
eventBus:
|
|
295
|
+
setSidebar: T,
|
|
296
|
+
eventBus: E
|
|
275
297
|
},
|
|
276
298
|
children: e
|
|
277
299
|
});
|
|
278
|
-
},
|
|
279
|
-
function
|
|
300
|
+
}, b = "(function(){let e=async e=>{let{width:t,height:n}=e,r=Math.min(1,1920/Math.max(t,n)),i=Math.round(t*r),a=Math.round(n*r),o=new OffscreenCanvas(i,a),s=o.getContext(`2d`);if(!s)throw Error(`Failed to get 2D context for preview canvas`);return s.drawImage(e,0,0,i,a),o.convertToBlob({type:`image/webp`,quality:.85})};function t(e){let t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d`);if(!n)throw Error(`Failed to create 2D context for canvas.`);n.drawImage(e,0,0);try{let e=n.getImageData(0,0,t.width,t.height).data;for(let t=3;t<e.length;t+=4)if(e[t]<255)return!0;return!1}catch(e){throw Error(`Error reading pixels: ${e}`,{cause:e})}}self.onmessage=async n=>{let r=``;try{let i;if(n.data instanceof Blob)i=n.data;else{let e=n.data.trim();!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&!e.startsWith(`blob:`)&&!e.startsWith(`data:`)&&(r=`image/png`,e=`data:${r};base64,${e}`);let t=await fetch(e);if(!t.ok)throw Error(`HTTP error! Status: ${t.status}`);i=await t.blob()}let a=i.type||r||`image/unknown`,o=await createImageBitmap(i),{width:s,height:c}=o,l=await e(o),u=t(o);o.close(),self.postMessage({success:!0,originalBlob:i,previewBlob:l,mimeType:a,width:s,height:c,isAlpha:u})}catch(e){self.postMessage({success:!1,error:e instanceof Error?e.message:`An error occurred during image loader worker execution.`})}}})();", x = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", b], { type: "text/javascript;charset=utf-8" });
|
|
301
|
+
function S(e) {
|
|
280
302
|
let t;
|
|
281
303
|
try {
|
|
282
|
-
if (t =
|
|
304
|
+
if (t = x && (self.URL || self.webkitURL).createObjectURL(x), !t) throw "";
|
|
283
305
|
let n = new Worker(t, { name: e?.name });
|
|
284
306
|
return n.addEventListener("error", () => {
|
|
285
307
|
(self.URL || self.webkitURL).revokeObjectURL(t);
|
|
286
308
|
}), n;
|
|
287
309
|
} catch {
|
|
288
|
-
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
310
|
+
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(b), { name: e?.name });
|
|
289
311
|
}
|
|
290
312
|
}
|
|
291
313
|
//#endregion
|
|
292
314
|
//#region src/shared/components/Pixedi/hooks/useImageLoader.tsx
|
|
293
|
-
var
|
|
294
|
-
let [
|
|
295
|
-
loading: !
|
|
315
|
+
var C = ({ src: e, skip: t = !1 }) => {
|
|
316
|
+
let [n, r] = c({
|
|
317
|
+
loading: !t,
|
|
296
318
|
error: "",
|
|
297
319
|
width: 0,
|
|
298
320
|
height: 0,
|
|
@@ -300,65 +322,53 @@ var b = (e) => {
|
|
|
300
322
|
originalBlob: null,
|
|
301
323
|
previewUrl: "",
|
|
302
324
|
isAlpha: !1
|
|
303
|
-
}),
|
|
304
|
-
return
|
|
305
|
-
if (!e) return;
|
|
306
|
-
let
|
|
307
|
-
return
|
|
325
|
+
}), a = s(null);
|
|
326
|
+
return i(() => {
|
|
327
|
+
if (!e || t) return;
|
|
328
|
+
let n = new S();
|
|
329
|
+
return n.postMessage(e), n.onmessage = (e) => {
|
|
308
330
|
let t = e.data;
|
|
309
|
-
t.success ? (
|
|
331
|
+
t.success ? (a.current && URL.revokeObjectURL(a.current), a.current = URL.createObjectURL(t.previewBlob), r({
|
|
310
332
|
loading: !1,
|
|
311
333
|
error: "",
|
|
312
334
|
mimeType: t.mimeType,
|
|
313
335
|
width: t.width,
|
|
314
336
|
height: t.height,
|
|
315
337
|
originalBlob: t.originalBlob,
|
|
316
|
-
previewUrl:
|
|
338
|
+
previewUrl: a.current,
|
|
317
339
|
isAlpha: t.isAlpha
|
|
318
|
-
})) :
|
|
340
|
+
})) : r((e) => ({
|
|
319
341
|
...e,
|
|
320
342
|
loading: !1,
|
|
321
343
|
error: t.error || "Error processing image."
|
|
322
344
|
}));
|
|
323
345
|
}, () => {
|
|
324
|
-
|
|
346
|
+
n.terminate(), a.current &&= (URL.revokeObjectURL(a.current), null);
|
|
325
347
|
};
|
|
326
|
-
}, [e]),
|
|
327
|
-
},
|
|
348
|
+
}, [t, e]), n;
|
|
349
|
+
}, ee = () => {
|
|
328
350
|
if (typeof window > "u" || !window.navigator) return null;
|
|
329
351
|
let e = window.navigator.userAgent.toLowerCase();
|
|
330
352
|
return /android/.test(e) ? "android" : /iphone|ipad|ipod/.test(e) ? "ios" : /windows phone/.test(e) ? "windows-phone" : /blackberry|bb10/.test(e) ? "blackberry" : /opera mini/.test(e) ? "opera-mini" : /mobile/.test(e) ? "mobile" : null;
|
|
331
|
-
},
|
|
332
|
-
let [e] =
|
|
353
|
+
}, w = () => {
|
|
354
|
+
let [e] = c(() => ee());
|
|
333
355
|
return e;
|
|
334
|
-
}, C = {
|
|
335
|
-
sm: 640,
|
|
336
|
-
md: 768,
|
|
337
|
-
lg: 1024,
|
|
338
|
-
xl: 1280
|
|
339
|
-
}, w = {
|
|
340
|
-
INITIAL: "initial",
|
|
341
|
-
RESIZE: "resize",
|
|
342
|
-
CROP: "crop",
|
|
343
|
-
PRESET_CROP: "presetCrop",
|
|
344
|
-
FLIP: "flip",
|
|
345
|
-
ROTATE: "rotate",
|
|
346
|
-
FILTERS: "filters"
|
|
347
356
|
};
|
|
348
357
|
//#endregion
|
|
349
358
|
//#region src/shared/components/Pixedi/hooks/useBellow.tsx
|
|
350
|
-
function
|
|
351
|
-
let [
|
|
352
|
-
return
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
359
|
+
function T(e, t) {
|
|
360
|
+
let [n, r] = c(!0);
|
|
361
|
+
return i(() => {
|
|
362
|
+
if (!t) return;
|
|
363
|
+
let n = new ResizeObserver(([t]) => {
|
|
364
|
+
t && r(t.contentRect.width < d[e]);
|
|
365
|
+
});
|
|
366
|
+
return n.observe(t), () => n.disconnect();
|
|
367
|
+
}, [e, t]), n;
|
|
358
368
|
}
|
|
359
369
|
//#endregion
|
|
360
370
|
//#region src/shared/components/Pixedi/assets/icons.tsx
|
|
361
|
-
var
|
|
371
|
+
var E = {
|
|
362
372
|
xmlns: "http://w3.org",
|
|
363
373
|
width: "24",
|
|
364
374
|
height: "24",
|
|
@@ -368,58 +378,50 @@ var T = {
|
|
|
368
378
|
strokeWidth: "2",
|
|
369
379
|
strokeLinecap: "round",
|
|
370
380
|
strokeLinejoin: "round"
|
|
371
|
-
},
|
|
372
|
-
...
|
|
381
|
+
}, D = (e) => /* @__PURE__ */ (0, v.jsx)("svg", {
|
|
382
|
+
...E,
|
|
373
383
|
...e,
|
|
374
|
-
children: /* @__PURE__ */ (0,
|
|
375
|
-
}), te = (e) => /* @__PURE__ */ (0,
|
|
376
|
-
...
|
|
384
|
+
children: /* @__PURE__ */ (0, v.jsx)("path", { d: "M20 6 9 17l-5-5" })
|
|
385
|
+
}), te = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
386
|
+
...E,
|
|
377
387
|
...e,
|
|
378
|
-
children: [/* @__PURE__ */ (0,
|
|
379
|
-
}),
|
|
380
|
-
...
|
|
388
|
+
children: [/* @__PURE__ */ (0, v.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, v.jsx)("path", { d: "m6 6 12 12" })]
|
|
389
|
+
}), O = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
390
|
+
...E,
|
|
381
391
|
...e,
|
|
382
|
-
children: [/* @__PURE__ */ (0,
|
|
392
|
+
children: [/* @__PURE__ */ (0, v.jsx)("rect", {
|
|
383
393
|
width: "18",
|
|
384
394
|
height: "11",
|
|
385
395
|
x: "3",
|
|
386
396
|
y: "11",
|
|
387
397
|
rx: "2",
|
|
388
398
|
ry: "2"
|
|
389
|
-
}), /* @__PURE__ */ (0,
|
|
390
|
-
}),
|
|
391
|
-
...
|
|
399
|
+
}), /* @__PURE__ */ (0, v.jsx)("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })]
|
|
400
|
+
}), k = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
401
|
+
...E,
|
|
392
402
|
...e,
|
|
393
|
-
children: [/* @__PURE__ */ (0,
|
|
394
|
-
}),
|
|
395
|
-
...
|
|
403
|
+
children: [/* @__PURE__ */ (0, v.jsx)("path", { d: "m12 19-7-7 7-7" }), /* @__PURE__ */ (0, v.jsx)("path", { d: "M19 12H5" })]
|
|
404
|
+
}), ne = (e) => /* @__PURE__ */ (0, v.jsx)("svg", {
|
|
405
|
+
...E,
|
|
396
406
|
...e,
|
|
397
|
-
children: /* @__PURE__ */ (0,
|
|
398
|
-
}),
|
|
399
|
-
...
|
|
407
|
+
children: /* @__PURE__ */ (0, v.jsx)("path", { d: "m6 9 6 6 6-6" })
|
|
408
|
+
}), A = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
409
|
+
...E,
|
|
400
410
|
...e,
|
|
401
|
-
children: [/* @__PURE__ */ (0,
|
|
402
|
-
}),
|
|
403
|
-
...
|
|
411
|
+
children: [/* @__PURE__ */ (0, v.jsx)("path", { d: "M3 7v6h6" }), /* @__PURE__ */ (0, v.jsx)("path", { d: "M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13" })]
|
|
412
|
+
}), re = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
413
|
+
...E,
|
|
404
414
|
...e,
|
|
405
|
-
children: [/* @__PURE__ */ (0,
|
|
406
|
-
}),
|
|
407
|
-
...
|
|
415
|
+
children: [/* @__PURE__ */ (0, v.jsx)("path", { d: "M21 7v6h-6" }), /* @__PURE__ */ (0, v.jsx)("path", { d: "M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7" })]
|
|
416
|
+
}), j = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
417
|
+
...E,
|
|
408
418
|
...e,
|
|
409
|
-
children: [/* @__PURE__ */ (0,
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
r: "3"
|
|
413
|
-
})]
|
|
414
|
-
}), oe = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
|
|
415
|
-
...T,
|
|
416
|
-
...e,
|
|
417
|
-
children: [/* @__PURE__ */ (0, h.jsx)("path", { d: "M6 2v14a2 2 0 0 0 2 2h14" }), /* @__PURE__ */ (0, h.jsx)("path", { d: "M18 22V8a2 2 0 0 0-2-2H2" })]
|
|
418
|
-
}), se = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
|
|
419
|
-
...T,
|
|
419
|
+
children: [/* @__PURE__ */ (0, v.jsx)("path", { d: "M6 2v14a2 2 0 0 0 2 2h14" }), /* @__PURE__ */ (0, v.jsx)("path", { d: "M18 22V8a2 2 0 0 0-2-2H2" })]
|
|
420
|
+
}), ie = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
421
|
+
...E,
|
|
420
422
|
...e,
|
|
421
423
|
children: [
|
|
422
|
-
/* @__PURE__ */ (0,
|
|
424
|
+
/* @__PURE__ */ (0, v.jsx)("rect", {
|
|
423
425
|
width: "18",
|
|
424
426
|
height: "18",
|
|
425
427
|
x: "3",
|
|
@@ -427,32 +429,52 @@ var T = {
|
|
|
427
429
|
rx: "2",
|
|
428
430
|
ry: "2"
|
|
429
431
|
}),
|
|
430
|
-
/* @__PURE__ */ (0,
|
|
432
|
+
/* @__PURE__ */ (0, v.jsx)("circle", {
|
|
431
433
|
cx: "9",
|
|
432
434
|
cy: "9",
|
|
433
435
|
r: "2"
|
|
434
436
|
}),
|
|
435
|
-
/* @__PURE__ */ (0,
|
|
437
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
|
|
436
438
|
]
|
|
437
|
-
}),
|
|
438
|
-
...
|
|
439
|
+
}), M = (e) => /* @__PURE__ */ (0, v.jsx)("svg", {
|
|
440
|
+
...E,
|
|
439
441
|
...e,
|
|
440
|
-
children: /* @__PURE__ */ (0,
|
|
442
|
+
children: /* @__PURE__ */ (0, v.jsx)("rect", {
|
|
441
443
|
width: "18",
|
|
442
444
|
height: "18",
|
|
443
445
|
x: "3",
|
|
444
446
|
y: "3",
|
|
445
447
|
rx: "2"
|
|
446
448
|
})
|
|
447
|
-
}),
|
|
448
|
-
...
|
|
449
|
+
}), N = (e) => /* @__PURE__ */ (0, v.jsx)("svg", {
|
|
450
|
+
...E,
|
|
451
|
+
...e,
|
|
452
|
+
children: /* @__PURE__ */ (0, v.jsx)("rect", {
|
|
453
|
+
width: "20",
|
|
454
|
+
height: "12",
|
|
455
|
+
x: "2",
|
|
456
|
+
y: "6",
|
|
457
|
+
rx: "2"
|
|
458
|
+
})
|
|
459
|
+
}), ae = (e) => /* @__PURE__ */ (0, v.jsx)("svg", {
|
|
460
|
+
...E,
|
|
461
|
+
...e,
|
|
462
|
+
children: /* @__PURE__ */ (0, v.jsx)("rect", {
|
|
463
|
+
width: "20",
|
|
464
|
+
height: "15",
|
|
465
|
+
x: "2",
|
|
466
|
+
y: "4.5",
|
|
467
|
+
rx: "2"
|
|
468
|
+
})
|
|
469
|
+
}), oe = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
470
|
+
...E,
|
|
449
471
|
...e,
|
|
450
472
|
children: [
|
|
451
|
-
/* @__PURE__ */ (0,
|
|
452
|
-
/* @__PURE__ */ (0,
|
|
453
|
-
/* @__PURE__ */ (0,
|
|
454
|
-
/* @__PURE__ */ (0,
|
|
455
|
-
/* @__PURE__ */ (0,
|
|
473
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M3 7V5a2 2 0 0 1 2-2h2" }),
|
|
474
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M17 3h2a2 2 0 0 1 2 2v2" }),
|
|
475
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M21 17v2a2 2 0 0 1-2 2h-2" }),
|
|
476
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M7 21H5a2 2 0 0 1-2-2v-2" }),
|
|
477
|
+
/* @__PURE__ */ (0, v.jsx)("rect", {
|
|
456
478
|
width: "10",
|
|
457
479
|
height: "8",
|
|
458
480
|
x: "7",
|
|
@@ -460,42 +482,93 @@ var T = {
|
|
|
460
482
|
rx: "1"
|
|
461
483
|
})
|
|
462
484
|
]
|
|
463
|
-
}),
|
|
464
|
-
...
|
|
485
|
+
}), se = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
486
|
+
...E,
|
|
465
487
|
...e,
|
|
466
488
|
children: [
|
|
467
|
-
/* @__PURE__ */ (0,
|
|
468
|
-
/* @__PURE__ */ (0,
|
|
469
|
-
/* @__PURE__ */ (0,
|
|
470
|
-
/* @__PURE__ */ (0,
|
|
471
|
-
/* @__PURE__ */ (0,
|
|
472
|
-
/* @__PURE__ */ (0,
|
|
489
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3" }),
|
|
490
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3" }),
|
|
491
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M12 20v2" }),
|
|
492
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M12 14v2" }),
|
|
493
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M12 8v2" }),
|
|
494
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M12 2v2" })
|
|
473
495
|
]
|
|
474
|
-
}),
|
|
475
|
-
...
|
|
496
|
+
}), ce = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
497
|
+
...E,
|
|
476
498
|
...e,
|
|
477
499
|
children: [
|
|
478
|
-
/* @__PURE__ */ (0,
|
|
479
|
-
/* @__PURE__ */ (0,
|
|
480
|
-
/* @__PURE__ */ (0,
|
|
481
|
-
/* @__PURE__ */ (0,
|
|
482
|
-
/* @__PURE__ */ (0,
|
|
483
|
-
/* @__PURE__ */ (0,
|
|
500
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3" }),
|
|
501
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3" }),
|
|
502
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M4 12H2" }),
|
|
503
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M10 12H8" }),
|
|
504
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M16 12h-2" }),
|
|
505
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M22 12h-2" })
|
|
484
506
|
]
|
|
485
|
-
}),
|
|
486
|
-
...
|
|
507
|
+
}), le = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
508
|
+
...E,
|
|
487
509
|
...e,
|
|
488
|
-
children: [/* @__PURE__ */ (0,
|
|
489
|
-
}),
|
|
490
|
-
...
|
|
510
|
+
children: [/* @__PURE__ */ (0, v.jsx)("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }), /* @__PURE__ */ (0, v.jsx)("path", { d: "M21 3v5h-5" })]
|
|
511
|
+
}), ue = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
512
|
+
...E,
|
|
491
513
|
...e,
|
|
492
|
-
children: [/* @__PURE__ */ (0,
|
|
493
|
-
}),
|
|
494
|
-
...
|
|
514
|
+
children: [/* @__PURE__ */ (0, v.jsx)("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), /* @__PURE__ */ (0, v.jsx)("path", { d: "M3 3v5h5" })]
|
|
515
|
+
}), de = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
516
|
+
...E,
|
|
517
|
+
...e,
|
|
518
|
+
children: [
|
|
519
|
+
/* @__PURE__ */ (0, v.jsx)("rect", {
|
|
520
|
+
width: "7",
|
|
521
|
+
height: "7",
|
|
522
|
+
x: "3",
|
|
523
|
+
y: "3",
|
|
524
|
+
rx: "1"
|
|
525
|
+
}),
|
|
526
|
+
/* @__PURE__ */ (0, v.jsx)("rect", {
|
|
527
|
+
width: "7",
|
|
528
|
+
height: "7",
|
|
529
|
+
x: "3",
|
|
530
|
+
y: "14",
|
|
531
|
+
rx: "1"
|
|
532
|
+
}),
|
|
533
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M14 4h7" }),
|
|
534
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M14 9h7" }),
|
|
535
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M14 15h7" }),
|
|
536
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M14 20h7" })
|
|
537
|
+
]
|
|
538
|
+
}), fe = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
539
|
+
...E,
|
|
495
540
|
...e,
|
|
496
|
-
children:
|
|
541
|
+
children: [
|
|
542
|
+
/* @__PURE__ */ (0, v.jsx)("rect", {
|
|
543
|
+
width: "18",
|
|
544
|
+
height: "18",
|
|
545
|
+
x: "3",
|
|
546
|
+
y: "3",
|
|
547
|
+
rx: "2"
|
|
548
|
+
}),
|
|
549
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M9 3v18" }),
|
|
550
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "m14 9 3 3-3 3" })
|
|
551
|
+
]
|
|
552
|
+
}), pe = (e) => /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
553
|
+
...E,
|
|
554
|
+
...e,
|
|
555
|
+
children: [
|
|
556
|
+
/* @__PURE__ */ (0, v.jsx)("rect", {
|
|
557
|
+
width: "18",
|
|
558
|
+
height: "18",
|
|
559
|
+
x: "3",
|
|
560
|
+
y: "3",
|
|
561
|
+
rx: "2"
|
|
562
|
+
}),
|
|
563
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "M9 3v18" }),
|
|
564
|
+
/* @__PURE__ */ (0, v.jsx)("path", { d: "m16 15-3-3 3-3" })
|
|
565
|
+
]
|
|
566
|
+
}), P = (e) => /* @__PURE__ */ (0, v.jsx)("svg", {
|
|
567
|
+
...E,
|
|
568
|
+
...e,
|
|
569
|
+
children: /* @__PURE__ */ (0, v.jsx)("path", {
|
|
497
570
|
d: "M21 12a9 9 0 1 1-6.219-8.56",
|
|
498
|
-
children: /* @__PURE__ */ (0,
|
|
571
|
+
children: /* @__PURE__ */ (0, v.jsx)("animateTransform", {
|
|
499
572
|
attributeType: "xml",
|
|
500
573
|
attributeName: "transform",
|
|
501
574
|
type: "rotate",
|
|
@@ -505,218 +578,186 @@ var T = {
|
|
|
505
578
|
repeatCount: "indefinite"
|
|
506
579
|
})
|
|
507
580
|
})
|
|
508
|
-
}),
|
|
509
|
-
let e =
|
|
581
|
+
}), F = () => {
|
|
582
|
+
let e = r(h);
|
|
510
583
|
if (!e) throw Error("usePixediContext must be used within an PixediProvider");
|
|
511
584
|
return e;
|
|
512
|
-
},
|
|
513
|
-
button: "
|
|
514
|
-
default: "
|
|
515
|
-
outline: "
|
|
516
|
-
ghost: "
|
|
517
|
-
rect: "
|
|
518
|
-
},
|
|
585
|
+
}, I = {
|
|
586
|
+
button: "_button_1vpzl_1",
|
|
587
|
+
default: "_default_1vpzl_35",
|
|
588
|
+
outline: "_outline_1vpzl_44",
|
|
589
|
+
ghost: "_ghost_1vpzl_54",
|
|
590
|
+
rect: "_rect_1vpzl_63"
|
|
591
|
+
}, L = ({ className: e = "", variant: t = "default", children: n, ref: r, ...i }) => /* @__PURE__ */ (0, v.jsx)("button", {
|
|
519
592
|
ref: r,
|
|
520
|
-
className: `${
|
|
593
|
+
className: `${I.button} ${I[t]} ${e}`.trim(),
|
|
521
594
|
...i,
|
|
522
595
|
children: n
|
|
523
|
-
}),
|
|
524
|
-
root: "_root_kw2xl_8",
|
|
525
|
-
textRed: "_textRed_kw2xl_73",
|
|
526
|
-
bgRed: "_bgRed_kw2xl_76",
|
|
527
|
-
bgGreen: "_bgGreen_kw2xl_79",
|
|
528
|
-
textGreen: "_textGreen_kw2xl_82",
|
|
529
|
-
mask: "_mask_kw2xl_85",
|
|
530
|
-
semibold: "_semibold_kw2xl_88",
|
|
531
|
-
bold: "_bold_kw2xl_92",
|
|
532
|
-
system: "_system_kw2xl_96",
|
|
533
|
-
wrapper: "_wrapper_kw2xl_105",
|
|
534
|
-
main: "_main_kw2xl_111",
|
|
535
|
-
grid: "_grid_kw2xl_119"
|
|
536
|
-
}, pe = { button: "_button_gf7m5_1" }, me = ({ className: e = "", active: t = !1, icon: n, label: r, ref: i, ...a }) => /* @__PURE__ */ (0, h.jsxs)("button", {
|
|
537
|
-
ref: i,
|
|
538
|
-
type: "button",
|
|
539
|
-
"aria-pressed": t,
|
|
540
|
-
className: `${pe.button} ${e}`.trim(),
|
|
541
|
-
...a,
|
|
542
|
-
children: [n, /* @__PURE__ */ (0, h.jsx)("span", {
|
|
543
|
-
className: P.semibold,
|
|
544
|
-
children: r
|
|
545
|
-
})]
|
|
546
|
-
}), he = { separator: "_separator_rqskq_1" }, F = t(({ className: e = "", orientation: t = "horizontal", ...n }, r) => /* @__PURE__ */ (0, h.jsx)("hr", {
|
|
596
|
+
}), me = { separator: "_separator_gp8ff_1" }, he = t(({ className: e = "", orientation: t = "horizontal", ...n }, r) => /* @__PURE__ */ (0, v.jsx)("hr", {
|
|
547
597
|
ref: r,
|
|
548
598
|
role: "separator",
|
|
549
599
|
"aria-orientation": t,
|
|
550
600
|
"data-orientation": t,
|
|
551
|
-
className: `${
|
|
601
|
+
className: `${me.separator} ${e}`.trim(),
|
|
552
602
|
...n
|
|
553
603
|
}));
|
|
554
|
-
|
|
555
|
-
var
|
|
556
|
-
wrapper: "
|
|
557
|
-
trigger: "
|
|
558
|
-
triggerArrow: "
|
|
559
|
-
content: "
|
|
560
|
-
groupLabel: "
|
|
561
|
-
item: "
|
|
562
|
-
itemLeft: "
|
|
563
|
-
itemAddon: "
|
|
564
|
-
itemRightContainer: "
|
|
565
|
-
itemRight: "
|
|
566
|
-
itemCheck: "
|
|
567
|
-
},
|
|
568
|
-
|
|
604
|
+
he.displayName = "Separator";
|
|
605
|
+
var R = {
|
|
606
|
+
wrapper: "_wrapper_1aw0m_1",
|
|
607
|
+
trigger: "_trigger_1aw0m_6",
|
|
608
|
+
triggerArrow: "_triggerArrow_1aw0m_31",
|
|
609
|
+
content: "_content_1aw0m_40",
|
|
610
|
+
groupLabel: "_groupLabel_1aw0m_74",
|
|
611
|
+
item: "_item_1aw0m_81",
|
|
612
|
+
itemLeft: "_itemLeft_1aw0m_98",
|
|
613
|
+
itemAddon: "_itemAddon_1aw0m_102",
|
|
614
|
+
itemRightContainer: "_itemRightContainer_1aw0m_122",
|
|
615
|
+
itemRight: "_itemRight_1aw0m_122",
|
|
616
|
+
itemCheck: "_itemCheck_1aw0m_131"
|
|
617
|
+
}, z = {
|
|
618
|
+
root: "_root_c6gk7_8",
|
|
619
|
+
textRed: "_textRed_c6gk7_73",
|
|
620
|
+
bgRed: "_bgRed_c6gk7_76",
|
|
621
|
+
bgGreen: "_bgGreen_c6gk7_79",
|
|
622
|
+
textGreen: "_textGreen_c6gk7_82",
|
|
623
|
+
mask: "_mask_c6gk7_85",
|
|
624
|
+
semibold: "_semibold_c6gk7_88",
|
|
625
|
+
bold: "_bold_c6gk7_92",
|
|
626
|
+
system: "_system_c6gk7_96",
|
|
627
|
+
wrapper: "_wrapper_c6gk7_106",
|
|
628
|
+
grid: "_grid_c6gk7_113",
|
|
629
|
+
mobile: "_mobile_c6gk7_124",
|
|
630
|
+
gridNoInfobar: "_gridNoInfobar_c6gk7_128"
|
|
631
|
+
}, ge = (e) => {
|
|
632
|
+
let t = 0, n = window.innerHeight;
|
|
633
|
+
for (let r = e.parentElement; r; r = r.parentElement) {
|
|
634
|
+
let { overflow: e, overflowY: i } = getComputedStyle(r);
|
|
635
|
+
if (e === "visible" && i === "visible") continue;
|
|
636
|
+
let a = r.getBoundingClientRect();
|
|
637
|
+
t = Math.max(t, a.top), n = Math.min(n, a.bottom);
|
|
638
|
+
}
|
|
639
|
+
return {
|
|
640
|
+
top: t,
|
|
641
|
+
bottom: n
|
|
642
|
+
};
|
|
643
|
+
}, _e = ({ items: e, value: t, onChange: n, placeholder: r = "Select an option", className: l = "", renderOption: u }) => {
|
|
644
|
+
let [d, f] = c(!1), p = s(null), m = s(null), h = s(null), g = o(() => {
|
|
569
645
|
let t = (e) => e.reduce((e, n) => n.options ? [...e, ...t(n.options.map((e) => ({
|
|
570
646
|
...e,
|
|
571
647
|
fullName: `${n.label} ${e.label}`
|
|
572
648
|
})))] : [...e, n], []);
|
|
573
649
|
return t(e);
|
|
574
650
|
}, [e]).find((e) => e.value === t);
|
|
575
|
-
|
|
651
|
+
i(() => {
|
|
576
652
|
let e = (e) => {
|
|
577
653
|
p.current && !e.composedPath().includes(p.current) && f(!1);
|
|
578
654
|
};
|
|
579
655
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
580
|
-
}, []),
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
656
|
+
}, []), a(() => {
|
|
657
|
+
let e = p.current, t = m.current, n = h.current;
|
|
658
|
+
if (!d || !e || !t || !n) return;
|
|
659
|
+
n.style.removeProperty("top"), n.style.removeProperty("max-height");
|
|
660
|
+
let { top: r, bottom: i } = ge(e), a = e.getBoundingClientRect().top, o = t.getBoundingClientRect(), s = n.offsetHeight, c = i - 8 - o.bottom - 4, l = o.top - 4 - r - 8, u = o.bottom + 4, f = 0;
|
|
661
|
+
s > c && (s <= l ? u = o.top - 4 - s : l > c ? (f = Math.max(l, 0), u = o.top - 4 - f) : f = Math.max(c, 0)), f && (n.style.maxHeight = `${f}px`), n.style.top = `${u - a}px`;
|
|
584
662
|
}, [d, e]);
|
|
585
|
-
let
|
|
663
|
+
let _ = (e) => {
|
|
586
664
|
n(e), f(!1);
|
|
587
665
|
};
|
|
588
|
-
return /* @__PURE__ */ (0,
|
|
666
|
+
return /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
589
667
|
ref: p,
|
|
590
|
-
className: `${
|
|
668
|
+
className: `${R.wrapper} ${l}`.trim(),
|
|
591
669
|
"data-state": d ? "open" : "closed",
|
|
592
|
-
children: [/* @__PURE__ */ (0,
|
|
670
|
+
children: [/* @__PURE__ */ (0, v.jsxs)("button", {
|
|
593
671
|
ref: m,
|
|
594
672
|
type: "button",
|
|
595
|
-
className:
|
|
673
|
+
className: R.trigger,
|
|
596
674
|
onClick: () => f(!d),
|
|
597
|
-
children: [/* @__PURE__ */ (0,
|
|
598
|
-
}), /* @__PURE__ */ (0,
|
|
599
|
-
ref:
|
|
600
|
-
className:
|
|
601
|
-
children: e.map((e, n) => e.options ? /* @__PURE__ */ (0,
|
|
602
|
-
className: `${
|
|
675
|
+
children: [/* @__PURE__ */ (0, v.jsx)("span", { children: g ? g.fullName : r }), /* @__PURE__ */ (0, v.jsx)(ne, { className: R.triggerArrow })]
|
|
676
|
+
}), /* @__PURE__ */ (0, v.jsx)("div", {
|
|
677
|
+
ref: h,
|
|
678
|
+
className: R.content,
|
|
679
|
+
children: e.map((e, n) => e.options ? /* @__PURE__ */ (0, v.jsxs)("div", { children: [/* @__PURE__ */ (0, v.jsx)("div", {
|
|
680
|
+
className: `${R.groupLabel} ${z.semibold}`,
|
|
603
681
|
children: e.label
|
|
604
|
-
}), e.options.map((e) => /* @__PURE__ */ (0,
|
|
605
|
-
className:
|
|
606
|
-
onClick: () =>
|
|
607
|
-
children: [u ? u(e) : /* @__PURE__ */ (0,
|
|
608
|
-
className:
|
|
682
|
+
}), e.options.map((e) => /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
683
|
+
className: R.item,
|
|
684
|
+
onClick: () => _(e.value),
|
|
685
|
+
children: [u ? u(e) : /* @__PURE__ */ (0, v.jsx)("span", {
|
|
686
|
+
className: R.itemLeft,
|
|
609
687
|
children: e.label
|
|
610
|
-
}), /* @__PURE__ */ (0,
|
|
611
|
-
className:
|
|
688
|
+
}), /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
689
|
+
className: R.itemAddon,
|
|
612
690
|
children: [
|
|
613
|
-
e.rightLabel && /* @__PURE__ */ (0,
|
|
614
|
-
t === e.value && /* @__PURE__ */ (0,
|
|
615
|
-
t !== e.value && /* @__PURE__ */ (0,
|
|
691
|
+
e.rightLabel && /* @__PURE__ */ (0, v.jsx)("span", { children: e.rightLabel }),
|
|
692
|
+
t === e.value && /* @__PURE__ */ (0, v.jsx)(D, { className: R.itemCheck }),
|
|
693
|
+
t !== e.value && /* @__PURE__ */ (0, v.jsx)("b", {})
|
|
616
694
|
]
|
|
617
695
|
})]
|
|
618
|
-
}, e.value))] }, `group-${n}`) : /* @__PURE__ */ (0,
|
|
619
|
-
className:
|
|
620
|
-
onClick: () =>
|
|
621
|
-
children: [u ? u(e) : /* @__PURE__ */ (0,
|
|
622
|
-
className:
|
|
696
|
+
}, e.value))] }, `group-${n}`) : /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
697
|
+
className: R.item,
|
|
698
|
+
onClick: () => _(e.value),
|
|
699
|
+
children: [u ? u(e) : /* @__PURE__ */ (0, v.jsx)("span", {
|
|
700
|
+
className: R.itemLeft,
|
|
623
701
|
children: e.label
|
|
624
|
-
}), t === e.value && /* @__PURE__ */ (0,
|
|
702
|
+
}), t === e.value && /* @__PURE__ */ (0, v.jsx)(D, { className: R.itemCheck })]
|
|
625
703
|
}, e.value))
|
|
626
704
|
})]
|
|
627
705
|
});
|
|
628
|
-
},
|
|
629
|
-
input: "
|
|
630
|
-
numberClean: "
|
|
631
|
-
},
|
|
632
|
-
let a = t === "number" && n ?
|
|
633
|
-
return /* @__PURE__ */ (0,
|
|
706
|
+
}, ve = {
|
|
707
|
+
input: "_input_kyavx_1",
|
|
708
|
+
numberClean: "_numberClean_kyavx_39"
|
|
709
|
+
}, ye = ({ className: e = "", type: t = "text", hideArrows: n = !0, ref: r, ...i }) => {
|
|
710
|
+
let a = t === "number" && n ? ve.numberClean : "";
|
|
711
|
+
return /* @__PURE__ */ (0, v.jsx)("input", {
|
|
634
712
|
ref: r,
|
|
635
713
|
type: t,
|
|
636
|
-
className: `${
|
|
714
|
+
className: `${ve.input} ${a} ${e}`.trim(),
|
|
637
715
|
...i
|
|
638
716
|
});
|
|
639
|
-
},
|
|
717
|
+
}, be = {
|
|
640
718
|
container: "_container_14vsv_1",
|
|
641
719
|
legend: "_legend_14vsv_4",
|
|
642
720
|
suffix: "_suffix_14vsv_13"
|
|
643
|
-
},
|
|
644
|
-
className: `${
|
|
721
|
+
}, xe = ({ label: e, className: t = "", style: n, ref: r, ...i }) => /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
722
|
+
className: `${be.container} ${t}`.trim(),
|
|
645
723
|
style: n,
|
|
646
724
|
children: [
|
|
647
|
-
/* @__PURE__ */ (0,
|
|
648
|
-
className:
|
|
725
|
+
/* @__PURE__ */ (0, v.jsx)("span", {
|
|
726
|
+
className: be.legend,
|
|
649
727
|
children: e
|
|
650
728
|
}),
|
|
651
|
-
/* @__PURE__ */ (0,
|
|
729
|
+
/* @__PURE__ */ (0, v.jsx)(ye, {
|
|
652
730
|
ref: r,
|
|
653
731
|
type: "number",
|
|
654
732
|
...i
|
|
655
733
|
}),
|
|
656
|
-
/* @__PURE__ */ (0,
|
|
657
|
-
className:
|
|
734
|
+
/* @__PURE__ */ (0, v.jsx)("span", {
|
|
735
|
+
className: be.suffix,
|
|
658
736
|
children: "px"
|
|
659
737
|
})
|
|
660
738
|
]
|
|
661
|
-
}),
|
|
662
|
-
group: "
|
|
663
|
-
save: "
|
|
664
|
-
close: "
|
|
665
|
-
},
|
|
666
|
-
className:
|
|
667
|
-
children: [/* @__PURE__ */ (0,
|
|
739
|
+
}), B = {
|
|
740
|
+
group: "_group_1e7jm_1",
|
|
741
|
+
save: "_save_1e7jm_6",
|
|
742
|
+
close: "_close_1e7jm_13"
|
|
743
|
+
}, V = ({ onSave: e, onClose: t, saving: n = !1, disabled: r = !1 }) => /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
744
|
+
className: B.group,
|
|
745
|
+
children: [/* @__PURE__ */ (0, v.jsx)(L, {
|
|
668
746
|
variant: "outline",
|
|
669
|
-
className:
|
|
747
|
+
className: B.save,
|
|
748
|
+
"aria-label": "Save",
|
|
670
749
|
disabled: r || n,
|
|
671
750
|
onClick: e,
|
|
672
|
-
children: n ? /* @__PURE__ */ (0,
|
|
673
|
-
}), /* @__PURE__ */ (0,
|
|
751
|
+
children: n ? /* @__PURE__ */ (0, v.jsx)(P, {}) : /* @__PURE__ */ (0, v.jsx)(D, {})
|
|
752
|
+
}), /* @__PURE__ */ (0, v.jsx)(L, {
|
|
674
753
|
variant: "outline",
|
|
675
|
-
className:
|
|
754
|
+
className: B.close,
|
|
755
|
+
"aria-label": "Close",
|
|
676
756
|
disabled: n,
|
|
677
757
|
onClick: t,
|
|
678
|
-
children: /* @__PURE__ */ (0,
|
|
758
|
+
children: /* @__PURE__ */ (0, v.jsx)(te, {})
|
|
679
759
|
})]
|
|
680
|
-
}),
|
|
681
|
-
sliderContainer: "_sliderContainer_1ntcm_1",
|
|
682
|
-
disabled: "_disabled_1ntcm_12",
|
|
683
|
-
sliderTrack: "_sliderTrack_1ntcm_18",
|
|
684
|
-
sliderRange: "_sliderRange_1ntcm_30",
|
|
685
|
-
sliderThumb: "_sliderThumb_1ntcm_38",
|
|
686
|
-
hiddenInput: "_hiddenInput_1ntcm_53"
|
|
687
|
-
}, Se = ({ min: e, max: t, value: n, step: r = 1, disabled: i = !1, onChange: o, className: s, ...c }) => {
|
|
688
|
-
let l = a(() => {
|
|
689
|
-
let r = t - e;
|
|
690
|
-
return r <= 0 ? 0 : (n - e) / r * 100;
|
|
691
|
-
}, [
|
|
692
|
-
n,
|
|
693
|
-
e,
|
|
694
|
-
t
|
|
695
|
-
]);
|
|
696
|
-
return /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
697
|
-
className: `${R.sliderContainer} ${i ? R.disabled : ""} ${s || ""}`,
|
|
698
|
-
style: { "--slider-progress": `${l}%` },
|
|
699
|
-
children: [/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
700
|
-
className: R.sliderTrack,
|
|
701
|
-
children: [/* @__PURE__ */ (0, h.jsx)("div", { className: R.sliderRange }), /* @__PURE__ */ (0, h.jsx)("div", {
|
|
702
|
-
className: R.sliderThumb,
|
|
703
|
-
style: { left: `${l}%` }
|
|
704
|
-
})]
|
|
705
|
-
}), /* @__PURE__ */ (0, h.jsx)("input", {
|
|
706
|
-
type: "range",
|
|
707
|
-
min: e,
|
|
708
|
-
max: t,
|
|
709
|
-
step: r,
|
|
710
|
-
value: n,
|
|
711
|
-
disabled: i,
|
|
712
|
-
onChange: (e) => {
|
|
713
|
-
i || o(Number(e.target.value));
|
|
714
|
-
},
|
|
715
|
-
className: R.hiddenInput,
|
|
716
|
-
...c
|
|
717
|
-
})]
|
|
718
|
-
});
|
|
719
|
-
}, Ce = 1920, we = .85, Te = [
|
|
760
|
+
}), Se = 1920, Ce = .85, we = [
|
|
720
761
|
{
|
|
721
762
|
label: "Facebook",
|
|
722
763
|
value: "facebook",
|
|
@@ -819,13 +860,13 @@ var I = {
|
|
|
819
860
|
}
|
|
820
861
|
]
|
|
821
862
|
}
|
|
822
|
-
],
|
|
863
|
+
], H = 32, Te = (e, t, n, r, i, a, o, s, c, l) => {
|
|
823
864
|
let { x: u, y: d, w: f, h: p } = c;
|
|
824
865
|
if (e) {
|
|
825
866
|
let e = o - c.w - c.x;
|
|
826
|
-
u += i - n, u < 0 && (u = 0), f = o - u - e, f <
|
|
867
|
+
u += i - n, u < 0 && (u = 0), f = o - u - e, f < H && (f = H, u = o - e - H);
|
|
827
868
|
let t = s - p - d;
|
|
828
|
-
d += a - r, d < 0 && (d = 0), p = s - d - t, p <
|
|
869
|
+
d += a - r, d < 0 && (d = 0), p = s - d - t, p < H && (p = H, d = s - t - H);
|
|
829
870
|
} else {
|
|
830
871
|
if (t >= 1) {
|
|
831
872
|
let e = i - n, r = Math.round(e / t);
|
|
@@ -834,7 +875,7 @@ var I = {
|
|
|
834
875
|
let e = a - r, n = Math.round(e * t);
|
|
835
876
|
f -= n, p -= e, u += n, d += e;
|
|
836
877
|
}
|
|
837
|
-
if (u < 0 || d < 0 || f <
|
|
878
|
+
if (u < 0 || d < 0 || f < H || p < H) return l;
|
|
838
879
|
}
|
|
839
880
|
return {
|
|
840
881
|
x: u,
|
|
@@ -842,12 +883,12 @@ var I = {
|
|
|
842
883
|
w: f,
|
|
843
884
|
h: p
|
|
844
885
|
};
|
|
845
|
-
},
|
|
886
|
+
}, Ee = (e, t, n, r, i, a, o, s, c, l) => {
|
|
846
887
|
let { x: u } = c, { y: d, w: f, h: p } = c;
|
|
847
888
|
if (e) {
|
|
848
|
-
f += i - n, f + u > o && (f = o - u), f <
|
|
889
|
+
f += i - n, f + u > o && (f = o - u), f < H && (f = H);
|
|
849
890
|
let e = s - p - d;
|
|
850
|
-
d += a - r, d < 0 && (d = 0), p = s - d - e, p <
|
|
891
|
+
d += a - r, d < 0 && (d = 0), p = s - d - e, p < H && (p = H, d = s - e - H);
|
|
851
892
|
} else {
|
|
852
893
|
if (t > 1) {
|
|
853
894
|
let e = i - n, r = Math.round(e / t);
|
|
@@ -856,7 +897,7 @@ var I = {
|
|
|
856
897
|
let e = a - r, n = Math.round(e * t);
|
|
857
898
|
f -= n, p -= e, d += e;
|
|
858
899
|
}
|
|
859
|
-
if (f + u > o || d < 0 || f <
|
|
900
|
+
if (f + u > o || d < 0 || f < H || p < H) return l;
|
|
860
901
|
}
|
|
861
902
|
return {
|
|
862
903
|
x: u,
|
|
@@ -864,12 +905,12 @@ var I = {
|
|
|
864
905
|
w: f,
|
|
865
906
|
h: p
|
|
866
907
|
};
|
|
867
|
-
},
|
|
908
|
+
}, De = (e, t, n, r, i, a, o, s, c, l) => {
|
|
868
909
|
let { y: u } = c, { x: d, w: f, h: p } = c;
|
|
869
910
|
if (e) {
|
|
870
|
-
p += a - r, p + u > s && (p = s - u), p <
|
|
911
|
+
p += a - r, p + u > s && (p = s - u), p < H && (p = H);
|
|
871
912
|
let e = o - c.w - c.x;
|
|
872
|
-
d += i - n, d < 0 && (d = 0), f = o - d - e, f <
|
|
913
|
+
d += i - n, d < 0 && (d = 0), f = o - d - e, f < H && (f = H, d = o - e - H);
|
|
873
914
|
} else {
|
|
874
915
|
if (t >= 1) {
|
|
875
916
|
let e = i - n, r = Math.round(e / t);
|
|
@@ -878,7 +919,7 @@ var I = {
|
|
|
878
919
|
let e = a - r, n = Math.round(e * t);
|
|
879
920
|
f += n, p += e, d -= n;
|
|
880
921
|
}
|
|
881
|
-
if (p + u > s || d < 0 || f <
|
|
922
|
+
if (p + u > s || d < 0 || f < H || p < H) return l;
|
|
882
923
|
}
|
|
883
924
|
return {
|
|
884
925
|
x: d,
|
|
@@ -886,9 +927,9 @@ var I = {
|
|
|
886
927
|
w: f,
|
|
887
928
|
h: p
|
|
888
929
|
};
|
|
889
|
-
},
|
|
930
|
+
}, Oe = (e, t, n, r, i, a, o, s, c, l) => {
|
|
890
931
|
let { x: u, y: d } = c, { w: f, h: p } = c;
|
|
891
|
-
if (e) f += i - n, f + u > o && (f = o - u), f <
|
|
932
|
+
if (e) f += i - n, f + u > o && (f = o - u), f < H && (f = H), p += a - r, p + d > s && (p = s - d), p < H && (p = H);
|
|
892
933
|
else {
|
|
893
934
|
if (t >= 1) {
|
|
894
935
|
let e = i - n, r = Math.round(e / t);
|
|
@@ -897,7 +938,7 @@ var I = {
|
|
|
897
938
|
let e = a - r, n = Math.round(e * t);
|
|
898
939
|
f += n, p += e;
|
|
899
940
|
}
|
|
900
|
-
if (p + d > s || f + u > o || f <
|
|
941
|
+
if (p + d > s || f + u > o || f < H || p < H) return l;
|
|
901
942
|
}
|
|
902
943
|
return {
|
|
903
944
|
x: u,
|
|
@@ -905,22 +946,34 @@ var I = {
|
|
|
905
946
|
w: f,
|
|
906
947
|
h: p
|
|
907
948
|
};
|
|
908
|
-
},
|
|
949
|
+
}, ke = (e, t, n, r, i, a, o, s, c) => {
|
|
950
|
+
let l = e === "tl" || e === "bl", u = e === "tl" || e === "tr", d = c.x + c.w, f = c.y + c.h, p = i - n, m = a - r, h = t >= 1 ? c.w + (l ? -p : p) : (c.h + (u ? -m : m)) * t, g = l ? d : o - c.x, _ = u ? f : s - c.y, v = Math.min(g, _ * t), y = Math.max(H, H * t), b = Math.min(Math.max(h, y), v), x = b / t;
|
|
951
|
+
return {
|
|
952
|
+
x: l ? d - b : c.x,
|
|
953
|
+
y: u ? f - x : c.y,
|
|
954
|
+
w: b,
|
|
955
|
+
h: x
|
|
956
|
+
};
|
|
957
|
+
}, Ae = (e, t, n, r, i, a, o, s, c, l, u) => t ? e === "tl" ? Te(t, n, r, i, a, o, s, c, l, u) : e === "tr" ? Ee(t, n, r, i, a, o, s, c, l, u) : e === "bl" ? De(t, n, r, i, a, o, s, c, l, u) : e === "br" ? Oe(t, n, r, i, a, o, s, c, l, u) : {
|
|
909
958
|
x: 0,
|
|
910
959
|
y: 0,
|
|
911
960
|
w: 0,
|
|
912
961
|
h: 0
|
|
913
|
-
},
|
|
962
|
+
} : ke(e, n, r, i, a, o, s, c, l), U = (e, t, n) => {
|
|
914
963
|
let r = .12, i = t / n, a = 0, o = 0;
|
|
915
964
|
e === 1 && (a = (i > 1 ? n : t) * (1 - r * 2), o = a), e > 1 && (i > e ? (o = n * (1 - r * 2), a = o * e) : (a = t * (1 - r * 2), o = a / e)), e < 1 && (i > e ? (o = n * (1 - r * 2), a = o * e) : (a = t * (1 - r * 2), o = a / e));
|
|
916
|
-
let s = a / t * 100, c = o / n * 100;
|
|
965
|
+
let s = a / t * 100, c = o / n * 100, l = (t - a) / 2 / t * 100, u = (n - o) / 2 / n * 100;
|
|
917
966
|
return {
|
|
918
|
-
x:
|
|
919
|
-
y:
|
|
967
|
+
x: l,
|
|
968
|
+
y: u,
|
|
920
969
|
w: s,
|
|
921
|
-
h: c
|
|
970
|
+
h: c,
|
|
971
|
+
xP: Math.round(l / 100 * t),
|
|
972
|
+
yP: Math.round(u / 100 * n),
|
|
973
|
+
wP: Math.round(s / 100 * t),
|
|
974
|
+
hP: Math.round(c / 100 * n)
|
|
922
975
|
};
|
|
923
|
-
},
|
|
976
|
+
}, je = (e, t, n, r) => {
|
|
924
977
|
let i = e.w / 100 * n, a = e.h / 100 * r;
|
|
925
978
|
t >= 1 ? a = i / t : i = a * t;
|
|
926
979
|
let o = i / n * 100, s = a / r * 100, c = Math.max(o / (100 - e.x), s / (100 - e.y), 1);
|
|
@@ -929,21 +982,21 @@ var I = {
|
|
|
929
982
|
w: o,
|
|
930
983
|
h: s
|
|
931
984
|
};
|
|
932
|
-
},
|
|
985
|
+
}, W = (e) => Math.abs(Math.round(e / 90)) % 2 == 1, Me = (e, t, n, r) => W(n) === W(r) ? {
|
|
933
986
|
width: e,
|
|
934
987
|
height: t
|
|
935
988
|
} : {
|
|
936
989
|
width: t,
|
|
937
990
|
height: e
|
|
938
|
-
},
|
|
939
|
-
let { width: t, height: n } = e, r = Math.min(1,
|
|
991
|
+
}, Ne = async (e) => {
|
|
992
|
+
let { width: t, height: n } = e, r = Math.min(1, Se / Math.max(t, n)), i = Math.round(t * r), a = Math.round(n * r), o = new OffscreenCanvas(i, a), s = o.getContext("2d");
|
|
940
993
|
if (!s) throw Error("Failed to get 2D context for preview canvas");
|
|
941
994
|
return s.drawImage(e, 0, 0, i, a), o.convertToBlob({
|
|
942
995
|
type: "image/webp",
|
|
943
|
-
quality:
|
|
996
|
+
quality: Ce
|
|
944
997
|
});
|
|
945
998
|
};
|
|
946
|
-
function
|
|
999
|
+
function Pe(e) {
|
|
947
1000
|
let t = new OffscreenCanvas(e.width, e.height), n = t.getContext("2d");
|
|
948
1001
|
if (!n) throw Error("Failed to create 2D context for canvas.");
|
|
949
1002
|
n.drawImage(e, 0, 0);
|
|
@@ -957,14 +1010,14 @@ function Fe(e) {
|
|
|
957
1010
|
}
|
|
958
1011
|
//#endregion
|
|
959
1012
|
//#region src/shared/components/Pixedi/utils/imageProcessor.ts
|
|
960
|
-
var
|
|
1013
|
+
var Fe = (e) => new Promise((t, n) => {
|
|
961
1014
|
let r = new FileReader();
|
|
962
1015
|
r.onloadend = () => {
|
|
963
1016
|
let e = r.result;
|
|
964
1017
|
typeof e == "string" ? t(e) : n(/* @__PURE__ */ Error("Failed to read blob as base64"));
|
|
965
1018
|
}, r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("FileReader error")), r.readAsDataURL(e);
|
|
966
1019
|
});
|
|
967
|
-
async function
|
|
1020
|
+
async function Ie(e) {
|
|
968
1021
|
let t = await createImageBitmap(e), n = e.type || "image/png", r = n === "image/gif" ? "image/png" : n, i = document.createElement("canvas"), a = i.getContext("2d", { alpha: !0 });
|
|
969
1022
|
i.width = t.width, i.height = t.height, a?.drawImage(t, 0, 0), t.close();
|
|
970
1023
|
let o = () => {
|
|
@@ -999,7 +1052,7 @@ async function Le(e) {
|
|
|
999
1052
|
}, a, t) : i.toBlob((t) => {
|
|
1000
1053
|
t ? e(t) : o(/* @__PURE__ */ Error("Failed to encode image as image/png"));
|
|
1001
1054
|
}, "image/png");
|
|
1002
|
-
}), s = await createImageBitmap(o), c = await
|
|
1055
|
+
}), s = await createImageBitmap(o), c = await Ne(s), { width: l, height: u } = s, d = Pe(s);
|
|
1003
1056
|
return s.close(), {
|
|
1004
1057
|
newBlob: o,
|
|
1005
1058
|
previewBlob: c,
|
|
@@ -1013,17 +1066,17 @@ async function Le(e) {
|
|
|
1013
1066
|
}
|
|
1014
1067
|
//#endregion
|
|
1015
1068
|
//#region src/shared/components/Pixedi/utils/preview.ts
|
|
1016
|
-
var
|
|
1017
|
-
switch (
|
|
1069
|
+
var G = (e, t, n) => Math.max(t, Math.min(n, e)), Le = (e, t) => [[e[0][0] * t[0][0] + e[0][1] * t[1][0], e[0][0] * t[0][1] + e[0][1] * t[1][1]], [e[1][0] * t[0][0] + e[1][1] * t[1][0], e[1][0] * t[0][1] + e[1][1] * t[1][1]]], Re = (e) => (Math.round(e / 90) % 4 + 4) % 4 * 90, ze = (e) => {
|
|
1070
|
+
switch (Re(e)) {
|
|
1018
1071
|
case 90: return [[0, -1], [1, 0]];
|
|
1019
1072
|
case 180: return [[-1, 0], [0, -1]];
|
|
1020
1073
|
case 270: return [[0, 1], [-1, 0]];
|
|
1021
1074
|
default: return [[1, 0], [0, 1]];
|
|
1022
1075
|
}
|
|
1023
|
-
},
|
|
1024
|
-
let r =
|
|
1076
|
+
}, Be = (e, t) => [[e ? -1 : 1, 0], [0, t ? -1 : 1]], Ve = (e, t, n) => Le(Be(t, n), ze(-e)), He = (e) => [+(e[0][0] < 0 || e[0][1] < 0), +(e[1][0] < 0 || e[1][1] < 0)], K = (e, t, n) => {
|
|
1077
|
+
let r = He(e);
|
|
1025
1078
|
return [e[0][0] * t + e[0][1] * n + r[0], e[1][0] * t + e[1][1] * n + r[1]];
|
|
1026
|
-
},
|
|
1079
|
+
}, Ue = (e) => {
|
|
1027
1080
|
let t = 1, n = 1, r = {
|
|
1028
1081
|
x: 0,
|
|
1029
1082
|
y: 0,
|
|
@@ -1032,18 +1085,18 @@ var V = (e, t, n) => Math.max(t, Math.min(n, e)), Re = (e, t) => [[e[0][0] * t[0
|
|
|
1032
1085
|
}, i = 0, a = !1, o = !1;
|
|
1033
1086
|
for (let s = 0; s < e.length; s++) {
|
|
1034
1087
|
let c = e[s];
|
|
1035
|
-
if (c.action.name ===
|
|
1088
|
+
if (c.action.name === f.INITIAL) t = c.width, n = c.height, r = {
|
|
1036
1089
|
x: 0,
|
|
1037
1090
|
y: 0,
|
|
1038
1091
|
w: 1,
|
|
1039
1092
|
h: 1
|
|
1040
1093
|
}, i = 0, a = !1, o = !1;
|
|
1041
|
-
else if (c.action.name ===
|
|
1042
|
-
let e = (c.action.args.x ?? 0) / 100, t = (c.action.args.y ?? 0) / 100, n = (c.action.args.w ?? 100) / 100, s = (c.action.args.h ?? 100) / 100, l =
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1094
|
+
else if (c.action.name === f.CROP) {
|
|
1095
|
+
let e = (c.action.args.x ?? 0) / 100, t = (c.action.args.y ?? 0) / 100, n = (c.action.args.w ?? 100) / 100, s = (c.action.args.h ?? 100) / 100, l = Ve(i, a, o), u = [
|
|
1096
|
+
K(l, e, t),
|
|
1097
|
+
K(l, e + n, t),
|
|
1098
|
+
K(l, e, t + s),
|
|
1099
|
+
K(l, e + n, t + s)
|
|
1047
1100
|
], d = Math.min(...u.map((e) => e[0])), f = Math.max(...u.map((e) => e[0])), p = Math.min(...u.map((e) => e[1])), m = Math.max(...u.map((e) => e[1]));
|
|
1048
1101
|
r = {
|
|
1049
1102
|
x: r.x + d * r.w,
|
|
@@ -1052,17 +1105,17 @@ var V = (e, t, n) => Math.max(t, Math.min(n, e)), Re = (e, t) => [[e[0][0] * t[0
|
|
|
1052
1105
|
h: r.h * (m - p)
|
|
1053
1106
|
};
|
|
1054
1107
|
} else if (c.action.name === "flip") {
|
|
1055
|
-
let e =
|
|
1108
|
+
let e = W(i), t = e ? c.action.args.vertical : c.action.args.horizontal, n = e ? c.action.args.horizontal : c.action.args.vertical;
|
|
1056
1109
|
t && (a = !a), n && (o = !o);
|
|
1057
1110
|
} else c.action.name === "rotate" && (i = c.action.args.degrees);
|
|
1058
1111
|
}
|
|
1059
|
-
let s = r.w * t, c = r.h * n, l =
|
|
1112
|
+
let s = r.w * t, c = r.h * n, l = W(i), u = l ? c : s, d = l ? s : c, p = e.at(-1)?.width || 0, m = e.at(-1)?.height || 0;
|
|
1060
1113
|
return {
|
|
1061
1114
|
box: r,
|
|
1062
1115
|
boxWidth: s,
|
|
1063
1116
|
boxHeight: c,
|
|
1064
|
-
newWidth:
|
|
1065
|
-
newHeight:
|
|
1117
|
+
newWidth: p,
|
|
1118
|
+
newHeight: m,
|
|
1066
1119
|
initWidth: t,
|
|
1067
1120
|
initHeight: n,
|
|
1068
1121
|
viewWidth: u,
|
|
@@ -1071,13 +1124,13 @@ var V = (e, t, n) => Math.max(t, Math.min(n, e)), Re = (e, t) => [[e[0][0] * t[0
|
|
|
1071
1124
|
flipH: a,
|
|
1072
1125
|
flipV: o
|
|
1073
1126
|
};
|
|
1074
|
-
},
|
|
1075
|
-
let { box: t, flipH: n, flipV: r, rotation: i, newWidth: a, newHeight: o, initWidth: s, initHeight: c, viewWidth: l, viewHeight: u } =
|
|
1127
|
+
}, We = (e) => {
|
|
1128
|
+
let { box: t, flipH: n, flipV: r, rotation: i, newWidth: a, newHeight: o, initWidth: s, initHeight: c, viewWidth: l, viewHeight: u } = Ue(e), d = G(t.x, 0, 1), f = G(t.y, 0, 1), p = {
|
|
1076
1129
|
x: d,
|
|
1077
1130
|
y: f,
|
|
1078
|
-
w:
|
|
1079
|
-
h:
|
|
1080
|
-
}, m =
|
|
1131
|
+
w: G(t.w, 0, 1 - d),
|
|
1132
|
+
h: G(t.h, 0, 1 - f)
|
|
1133
|
+
}, m = Re(i);
|
|
1081
1134
|
return {
|
|
1082
1135
|
...p.x === 0 && p.y === 0 && p.w === 1 && p.h === 1 ? {} : { crop: {
|
|
1083
1136
|
x: Math.round(s * t.x),
|
|
@@ -1095,18 +1148,18 @@ var V = (e, t, n) => Math.max(t, Math.min(n, e)), Re = (e, t) => [[e[0][0] * t[0
|
|
|
1095
1148
|
height: o
|
|
1096
1149
|
} } : {}
|
|
1097
1150
|
};
|
|
1098
|
-
},
|
|
1099
|
-
let [t, n] =
|
|
1151
|
+
}, Ge = (e) => {
|
|
1152
|
+
let [t, n] = c(!1), { setImage: r, settings: i, history: a, originalBlob: o, setCurrentAction: s, resetHistory: l } = F();
|
|
1100
1153
|
return {
|
|
1101
1154
|
save: async () => {
|
|
1102
1155
|
if (!o) return;
|
|
1103
1156
|
n(!0);
|
|
1104
|
-
let t =
|
|
1157
|
+
let t = We(a.items.slice(0, a.pointer + 1));
|
|
1105
1158
|
try {
|
|
1106
|
-
let n = await
|
|
1159
|
+
let n = await Ie(o);
|
|
1107
1160
|
t.crop && n.crop(t.crop.x, t.crop.y, t.crop.w, t.crop.h), t.flip && n.flip(t.flip.horizontal, t.flip.vertical), t.rotate && n.rotate(t.rotate.degrees), t.resize && n.resize(t.resize.width, t.resize.height);
|
|
1108
1161
|
let { newBlob: a, previewBlob: s, mimeType: c, width: l, height: u, isAlpha: d } = await n.get(i), f = "";
|
|
1109
|
-
i.exportAs === "base64" && (f = await
|
|
1162
|
+
i.exportAs === "base64" && (f = await Fe(a)), await e(f || a), r({
|
|
1110
1163
|
newBlob: a,
|
|
1111
1164
|
previewBlob: s,
|
|
1112
1165
|
mimeType: c,
|
|
@@ -1121,188 +1174,353 @@ var V = (e, t, n) => Math.max(t, Math.min(n, e)), Re = (e, t) => [[e[0][0] * t[0
|
|
|
1121
1174
|
}
|
|
1122
1175
|
},
|
|
1123
1176
|
reset: () => {
|
|
1124
|
-
|
|
1177
|
+
s(null), l();
|
|
1125
1178
|
},
|
|
1126
1179
|
isSaving: t
|
|
1127
1180
|
};
|
|
1128
|
-
},
|
|
1129
|
-
header: "
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1181
|
+
}, q = {
|
|
1182
|
+
header: "_header_25ynx_1",
|
|
1183
|
+
left: "_left_25ynx_12",
|
|
1184
|
+
sidebarToggle: "_sidebarToggle_25ynx_17",
|
|
1185
|
+
mobile: "_mobile_25ynx_29",
|
|
1186
|
+
sidebarIcon: "_sidebarIcon_25ynx_33",
|
|
1187
|
+
tools: "_tools_25ynx_38",
|
|
1188
|
+
history: "_history_25ynx_42",
|
|
1189
|
+
historyText: "_historyText_25ynx_47"
|
|
1190
|
+
}, Ke = ({ onBack: e, onSave: t, isMobile: n }) => {
|
|
1191
|
+
let { save: r, reset: i, isSaving: a } = Ge(t), { sidebar: o, history: s, undo: c, redo: l, setSidebar: u } = F(), d = s.items.length > 1 && !a, f = s.pointer === 0, p = s.pointer === s.items.length - 1, m = s.items.length < 2 || a, h = m || s.pointer === 0;
|
|
1192
|
+
return /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1193
|
+
className: q.header,
|
|
1194
|
+
children: [/* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1195
|
+
className: q.left,
|
|
1196
|
+
children: [/* @__PURE__ */ (0, v.jsx)("div", {
|
|
1197
|
+
className: `${q.sidebarToggle} ${n ? q.mobile : ""}`,
|
|
1198
|
+
onClick: () => {
|
|
1199
|
+
u(!o);
|
|
1200
|
+
},
|
|
1201
|
+
children: o ? /* @__PURE__ */ (0, v.jsx)(pe, { className: q.sidebarIcon }) : /* @__PURE__ */ (0, v.jsx)(fe, { className: q.sidebarIcon })
|
|
1202
|
+
}), /* @__PURE__ */ (0, v.jsx)(L, {
|
|
1203
|
+
variant: "ghost",
|
|
1204
|
+
className: I.rect,
|
|
1205
|
+
onClick: e,
|
|
1206
|
+
children: /* @__PURE__ */ (0, v.jsx)(k, {})
|
|
1207
|
+
})]
|
|
1208
|
+
}), /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1209
|
+
className: q.tools,
|
|
1144
1210
|
children: [
|
|
1145
|
-
|
|
1146
|
-
className:
|
|
1211
|
+
d && /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1212
|
+
className: q.history,
|
|
1147
1213
|
children: [
|
|
1148
|
-
/* @__PURE__ */ (0,
|
|
1214
|
+
/* @__PURE__ */ (0, v.jsx)(L, {
|
|
1149
1215
|
variant: "outline",
|
|
1150
|
-
disabled:
|
|
1151
|
-
className:
|
|
1152
|
-
onClick:
|
|
1153
|
-
children: /* @__PURE__ */ (0,
|
|
1216
|
+
disabled: f,
|
|
1217
|
+
className: I.rect,
|
|
1218
|
+
onClick: c,
|
|
1219
|
+
children: /* @__PURE__ */ (0, v.jsx)(A, {})
|
|
1154
1220
|
}),
|
|
1155
|
-
/* @__PURE__ */ (0,
|
|
1156
|
-
className:
|
|
1221
|
+
/* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1222
|
+
className: q.historyText,
|
|
1157
1223
|
children: [
|
|
1158
|
-
|
|
1224
|
+
s.pointer + 1,
|
|
1159
1225
|
"/",
|
|
1160
|
-
|
|
1226
|
+
s.items.length
|
|
1161
1227
|
]
|
|
1162
1228
|
}),
|
|
1163
|
-
/* @__PURE__ */ (0,
|
|
1229
|
+
/* @__PURE__ */ (0, v.jsx)(L, {
|
|
1164
1230
|
variant: "outline",
|
|
1165
|
-
disabled:
|
|
1166
|
-
className:
|
|
1167
|
-
onClick:
|
|
1168
|
-
children: /* @__PURE__ */ (0,
|
|
1231
|
+
disabled: p,
|
|
1232
|
+
className: I.rect,
|
|
1233
|
+
onClick: l,
|
|
1234
|
+
children: /* @__PURE__ */ (0, v.jsx)(re, {})
|
|
1169
1235
|
})
|
|
1170
1236
|
]
|
|
1171
1237
|
}),
|
|
1172
|
-
/* @__PURE__ */ (0,
|
|
1238
|
+
/* @__PURE__ */ (0, v.jsx)(L, {
|
|
1173
1239
|
variant: "outline",
|
|
1174
|
-
disabled:
|
|
1175
|
-
onClick:
|
|
1240
|
+
disabled: m,
|
|
1241
|
+
onClick: i,
|
|
1176
1242
|
children: "Reset"
|
|
1177
1243
|
}),
|
|
1178
|
-
/* @__PURE__ */ (0,
|
|
1179
|
-
disabled:
|
|
1180
|
-
onClick:
|
|
1181
|
-
children: [
|
|
1244
|
+
/* @__PURE__ */ (0, v.jsxs)(L, {
|
|
1245
|
+
disabled: h,
|
|
1246
|
+
onClick: r,
|
|
1247
|
+
children: [a ? /* @__PURE__ */ (0, v.jsx)(P, {}) : /* @__PURE__ */ (0, v.jsx)(D, {}), "Save"]
|
|
1182
1248
|
})
|
|
1183
1249
|
]
|
|
1184
1250
|
})]
|
|
1185
1251
|
});
|
|
1186
|
-
},
|
|
1252
|
+
}, J = {
|
|
1253
|
+
sidebar: "_sidebar_16gr5_1",
|
|
1254
|
+
mobile: "_mobile_16gr5_10",
|
|
1255
|
+
open: "_open_16gr5_15",
|
|
1256
|
+
item: "_item_16gr5_20",
|
|
1257
|
+
selected: "_selected_16gr5_38"
|
|
1258
|
+
}, qe = (e) => {
|
|
1259
|
+
switch (e) {
|
|
1260
|
+
case f.RESIZE: return {
|
|
1261
|
+
icon: /* @__PURE__ */ (0, v.jsx)(oe, {}),
|
|
1262
|
+
label: "Resize"
|
|
1263
|
+
};
|
|
1264
|
+
case f.CROP: return {
|
|
1265
|
+
icon: /* @__PURE__ */ (0, v.jsx)(j, {}),
|
|
1266
|
+
label: "Crop"
|
|
1267
|
+
};
|
|
1268
|
+
case f.PRESET_CROP: return {
|
|
1269
|
+
icon: /* @__PURE__ */ (0, v.jsx)(de, {}),
|
|
1270
|
+
label: "Presets"
|
|
1271
|
+
};
|
|
1272
|
+
case f.FLIP: return {
|
|
1273
|
+
icon: /* @__PURE__ */ (0, v.jsx)(se, {}),
|
|
1274
|
+
label: "Flip"
|
|
1275
|
+
};
|
|
1276
|
+
case f.ROTATE: return {
|
|
1277
|
+
icon: /* @__PURE__ */ (0, v.jsx)(le, {}),
|
|
1278
|
+
label: "Rotate"
|
|
1279
|
+
};
|
|
1280
|
+
default: return null;
|
|
1281
|
+
}
|
|
1282
|
+
}, Je = ({ isMobile: e }) => {
|
|
1283
|
+
let { settings: t, sidebar: n, currentAction: r, getLastRotation: i, getLastHistoryItem: a, setCurrentAction: o, setSidebar: s } = F(), c = t?.tools || [], l = r?.name, { width: u, height: d } = a(), p = (e) => {
|
|
1284
|
+
if (c.includes(e) && l === e) {
|
|
1285
|
+
o(null);
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
switch (e) {
|
|
1289
|
+
case f.RESIZE:
|
|
1290
|
+
o({
|
|
1291
|
+
name: f.RESIZE,
|
|
1292
|
+
args: {
|
|
1293
|
+
width: u,
|
|
1294
|
+
height: d
|
|
1295
|
+
}
|
|
1296
|
+
});
|
|
1297
|
+
break;
|
|
1298
|
+
case f.CROP:
|
|
1299
|
+
o({
|
|
1300
|
+
name: f.CROP,
|
|
1301
|
+
args: {
|
|
1302
|
+
id: "freeform",
|
|
1303
|
+
ratio: u / d,
|
|
1304
|
+
isFree: !0
|
|
1305
|
+
}
|
|
1306
|
+
});
|
|
1307
|
+
break;
|
|
1308
|
+
case f.PRESET_CROP:
|
|
1309
|
+
o({
|
|
1310
|
+
name: f.PRESET_CROP,
|
|
1311
|
+
args: {
|
|
1312
|
+
id: "facebook-post",
|
|
1313
|
+
ratio: 1200 / 630,
|
|
1314
|
+
isFree: !1,
|
|
1315
|
+
preset: {
|
|
1316
|
+
width: 1200,
|
|
1317
|
+
height: 630
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1321
|
+
break;
|
|
1322
|
+
case f.FLIP:
|
|
1323
|
+
o({
|
|
1324
|
+
name: f.FLIP,
|
|
1325
|
+
args: {
|
|
1326
|
+
horizontal: !1,
|
|
1327
|
+
vertical: !1
|
|
1328
|
+
}
|
|
1329
|
+
});
|
|
1330
|
+
break;
|
|
1331
|
+
case f.ROTATE:
|
|
1332
|
+
o({
|
|
1333
|
+
name: f.ROTATE,
|
|
1334
|
+
args: { degrees: i() }
|
|
1335
|
+
});
|
|
1336
|
+
break;
|
|
1337
|
+
}
|
|
1338
|
+
s(!1);
|
|
1339
|
+
};
|
|
1340
|
+
return /* @__PURE__ */ (0, v.jsx)("nav", {
|
|
1341
|
+
className: `${J.sidebar} ${e ? J.mobile : ""} ${e && n ? J.open : ""}`,
|
|
1342
|
+
children: c.map((e) => {
|
|
1343
|
+
let t = qe(e);
|
|
1344
|
+
if (!t) return null;
|
|
1345
|
+
let { icon: n, label: r } = t;
|
|
1346
|
+
return /* @__PURE__ */ (0, v.jsx)("div", {
|
|
1347
|
+
className: `${J.item} ${l === e ? J.selected : ""}`,
|
|
1348
|
+
onClick: () => p(e),
|
|
1349
|
+
title: r,
|
|
1350
|
+
children: n
|
|
1351
|
+
}, e);
|
|
1352
|
+
})
|
|
1353
|
+
});
|
|
1354
|
+
}, Ye = { infobar: "_infobar_ofe91_1" }, Xe = (e) => e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(2)} KB` : `${(e / 1024 / 1024).toFixed(2)} MB`, Ze = () => {
|
|
1355
|
+
let { originalBlob: e, getLastHistoryItem: t } = F(), { width: n, height: r } = t();
|
|
1356
|
+
return /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1357
|
+
className: Ye.infobar,
|
|
1358
|
+
children: [/* @__PURE__ */ (0, v.jsx)("div", {
|
|
1359
|
+
className: Ye.filesize,
|
|
1360
|
+
children: e ? Xe(e.size) : "0 B"
|
|
1361
|
+
}), /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1362
|
+
className: Ye.sizes,
|
|
1363
|
+
children: [
|
|
1364
|
+
n,
|
|
1365
|
+
" / ",
|
|
1366
|
+
r
|
|
1367
|
+
]
|
|
1368
|
+
})]
|
|
1369
|
+
});
|
|
1370
|
+
}, Qe = (e, t) => {
|
|
1187
1371
|
let n = new CustomEvent("crop-update", { detail: t });
|
|
1188
1372
|
e.dispatchEvent(n);
|
|
1189
|
-
},
|
|
1373
|
+
}, $e = (e, t) => {
|
|
1190
1374
|
let n = new CustomEvent("clip-path-update", { detail: t });
|
|
1191
1375
|
e.dispatchEvent(n);
|
|
1192
|
-
},
|
|
1376
|
+
}, et = (e, t) => {
|
|
1193
1377
|
let n = new CustomEvent("resize-update", { detail: t });
|
|
1194
1378
|
e.dispatchEvent(n);
|
|
1195
|
-
},
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
}, K = 10, q = 200, J = (e, t, n) => (e < K && (e = K), e > q && (e = q), {
|
|
1202
|
-
updatedScale: e,
|
|
1203
|
-
updatedWidth: Math.round(e / 100 * t),
|
|
1204
|
-
updatedHeight: Math.round(e / 100 * n)
|
|
1205
|
-
}), Xe = () => {
|
|
1206
|
-
let { getLastHistoryItem: e, setCurrentAction: t, addToHistory: n, setSidebar: i, eventBus: a } = j(), { width: c, height: l } = e(), [u, d] = s(c), [f, p] = s(l), [m, g] = s(100), _ = o(0), v = S(), y = (e) => {
|
|
1207
|
-
let { updatedScale: t, updatedWidth: n, updatedHeight: r } = J(e, c, l);
|
|
1208
|
-
d(n), p(r), g(t), W(a, t);
|
|
1209
|
-
}, b = (e) => {
|
|
1210
|
-
let { updatedScale: t, updatedWidth: n, updatedHeight: r } = J(parseInt(e.target?.value ?? "1") / c * 100, c, l);
|
|
1211
|
-
d(n), p(r), g(t), W(a, t);
|
|
1212
|
-
}, x = (e) => {
|
|
1213
|
-
let { updatedScale: t, updatedWidth: n, updatedHeight: r } = J(parseInt(e.target.value) / l * 100, c, l);
|
|
1214
|
-
p(r), d(n), g(t), W(a, t);
|
|
1215
|
-
}, C = () => {
|
|
1216
|
-
W(a, 100), t(null), i(!0);
|
|
1217
|
-
}, w = () => {
|
|
1218
|
-
n({
|
|
1219
|
-
width: u,
|
|
1220
|
-
height: f,
|
|
1221
|
-
action: {
|
|
1222
|
-
name: "resize",
|
|
1223
|
-
args: {
|
|
1224
|
-
width: u,
|
|
1225
|
-
height: f
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
}), W(a, 100), i(!0);
|
|
1379
|
+
}, tt = 15, nt = 200, rt = 2, it = (e, t, n) => {
|
|
1380
|
+
let r = Math.min(nt, Math.max(tt, e));
|
|
1381
|
+
return {
|
|
1382
|
+
scale: r,
|
|
1383
|
+
width: Math.round(r / 100 * t),
|
|
1384
|
+
height: Math.round(r / 100 * n)
|
|
1229
1385
|
};
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
}, n = (n) => {
|
|
1235
|
-
let r = Math.sign(n.deltaY);
|
|
1236
|
-
e -= r * 2, e <= K && (e = K), e >= q && (e = q), t(e);
|
|
1237
|
-
}, r = (e) => {
|
|
1238
|
-
_.current = e.touches[0].clientY;
|
|
1239
|
-
}, i = (n) => {
|
|
1240
|
-
let r = n.touches[0].clientY, i = _.current - r;
|
|
1241
|
-
Math.abs(i) < 10 || (e += Math.sign(i) * 2, e <= K && (e = K), e >= q && (e = q), t(e), _.current = r);
|
|
1242
|
-
}, o = new AbortController(), { signal: s } = o;
|
|
1243
|
-
return window.addEventListener("wheel", n, { signal: s }), window.addEventListener("touchstart", r, { signal: s }), window.addEventListener("touchmove", i, { signal: s }), () => o.abort();
|
|
1386
|
+
}, at = () => {
|
|
1387
|
+
let { getLastHistoryItem: e, setCurrentAction: t, addToHistory: r, setSidebar: a, eventBus: o } = F(), { width: l, height: u } = e(), [d, p] = c(l), [m, h] = c(u), [g, _] = c(100), v = s(g), y = s(0), b = s(null), x = n((e) => {
|
|
1388
|
+
let t = it(e, l, u);
|
|
1389
|
+
p(t.width), h(t.height), _(t.scale), v.current = t.scale, et(o, t.scale);
|
|
1244
1390
|
}, [
|
|
1245
|
-
l,
|
|
1246
|
-
c,
|
|
1247
|
-
v,
|
|
1248
1391
|
u,
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1392
|
+
l,
|
|
1393
|
+
o
|
|
1394
|
+
]), S = (e, t) => {
|
|
1395
|
+
let n = Number.parseInt(e, 10);
|
|
1396
|
+
if (!Number.isFinite(n)) {
|
|
1397
|
+
x(100);
|
|
1398
|
+
return;
|
|
1399
|
+
}
|
|
1400
|
+
x(n / t * 100);
|
|
1401
|
+
};
|
|
1402
|
+
return i(() => {
|
|
1403
|
+
let e = (e) => {
|
|
1404
|
+
let t = b.current?.parentElement;
|
|
1405
|
+
return e.target instanceof Node && !!t?.contains(e.target);
|
|
1406
|
+
}, t = (t) => {
|
|
1407
|
+
e(t) && x(v.current - Math.sign(t.deltaY) * rt);
|
|
1408
|
+
}, n = (t) => {
|
|
1409
|
+
e(t) && (y.current = t.touches[0].clientY);
|
|
1410
|
+
}, r = (t) => {
|
|
1411
|
+
if (!e(t)) return;
|
|
1412
|
+
let n = t.touches[0].clientY, r = y.current - n;
|
|
1413
|
+
Math.abs(r) < 10 || (x(v.current + Math.sign(r) * rt), y.current = n);
|
|
1414
|
+
}, i = new AbortController(), { signal: a } = i;
|
|
1415
|
+
return window.addEventListener("wheel", t, { signal: a }), window.addEventListener("touchstart", n, { signal: a }), window.addEventListener("touchmove", r, { signal: a }), () => i.abort();
|
|
1416
|
+
}, [x]), {
|
|
1417
|
+
resizeRef: b,
|
|
1418
|
+
width: d,
|
|
1419
|
+
height: m,
|
|
1420
|
+
scale: g,
|
|
1421
|
+
currentWidth: l,
|
|
1422
|
+
currentHeight: u,
|
|
1423
|
+
setWidth: p,
|
|
1424
|
+
setHeight: h,
|
|
1425
|
+
handleWidthBlur: (e) => {
|
|
1426
|
+
S(e.target.value, l);
|
|
1427
|
+
},
|
|
1428
|
+
handleHeightBlur: (e) => {
|
|
1429
|
+
S(e.target.value, u);
|
|
1430
|
+
},
|
|
1431
|
+
save: () => {
|
|
1432
|
+
r({
|
|
1433
|
+
width: d,
|
|
1434
|
+
height: m,
|
|
1435
|
+
action: {
|
|
1436
|
+
name: f.RESIZE,
|
|
1437
|
+
args: {
|
|
1438
|
+
width: d,
|
|
1439
|
+
height: m
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
}), et(o, 100), a(!0);
|
|
1443
|
+
},
|
|
1444
|
+
close: () => {
|
|
1445
|
+
et(o, 100), t(null), a(!0);
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1448
|
+
}, Y = {
|
|
1449
|
+
resize: "_resize_s127g_1",
|
|
1450
|
+
toolsLock: "_toolsLock_s127g_15",
|
|
1451
|
+
indicatorWrapper: "_indicatorWrapper_s127g_20",
|
|
1452
|
+
indicator: "_indicator_s127g_20"
|
|
1453
|
+
}, ot = () => {
|
|
1454
|
+
let { resizeRef: e, width: t, height: n, scale: r, currentWidth: i, currentHeight: a, setWidth: o, setHeight: s, handleWidthBlur: c, handleHeightBlur: l, save: u, close: d } = at();
|
|
1455
|
+
return /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1456
|
+
ref: e,
|
|
1457
|
+
className: Y.resize,
|
|
1458
|
+
children: [
|
|
1459
|
+
/* @__PURE__ */ (0, v.jsx)("div", {
|
|
1460
|
+
className: Y.indicatorWrapper,
|
|
1461
|
+
children: /* @__PURE__ */ (0, v.jsx)("div", {
|
|
1462
|
+
className: Y.indicator,
|
|
1463
|
+
style: { width: `${r / 2}%` }
|
|
1282
1464
|
})
|
|
1283
|
-
|
|
1284
|
-
|
|
1465
|
+
}),
|
|
1466
|
+
/* @__PURE__ */ (0, v.jsx)(xe, {
|
|
1467
|
+
value: t,
|
|
1468
|
+
name: "width",
|
|
1469
|
+
label: "Width",
|
|
1470
|
+
style: { width: "88px" },
|
|
1471
|
+
onChange: (e) => o(Number(e.target.value)),
|
|
1472
|
+
onBlur: c
|
|
1473
|
+
}),
|
|
1474
|
+
/* @__PURE__ */ (0, v.jsx)(O, { className: Y.toolsLock }),
|
|
1475
|
+
/* @__PURE__ */ (0, v.jsx)(xe, {
|
|
1476
|
+
value: n,
|
|
1477
|
+
name: "height",
|
|
1478
|
+
label: "Height",
|
|
1479
|
+
style: { width: "88px" },
|
|
1480
|
+
onChange: (e) => s(Number(e.target.value)),
|
|
1481
|
+
onBlur: l
|
|
1482
|
+
}),
|
|
1483
|
+
/* @__PURE__ */ (0, v.jsx)(V, {
|
|
1484
|
+
onSave: u,
|
|
1485
|
+
onClose: d,
|
|
1486
|
+
disabled: t === i && n === a
|
|
1487
|
+
})
|
|
1488
|
+
]
|
|
1285
1489
|
});
|
|
1286
|
-
},
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1490
|
+
}, st = ({ isClipped: e }) => {
|
|
1491
|
+
let { history: t, previewUrl: n, currentAction: r, getLastRotation: o, eventBus: c } = F(), l = s(null), u = s(r?.name), d = s(n);
|
|
1492
|
+
a(() => {
|
|
1493
|
+
let e = u.current, t = r?.name, i = d.current !== n;
|
|
1494
|
+
if (u.current = t, d.current = n, !(e && t && e !== t) && !i) return;
|
|
1495
|
+
let a = l.current;
|
|
1496
|
+
if (!a) return;
|
|
1497
|
+
let o = [a, ...a.querySelectorAll("*")];
|
|
1498
|
+
o.forEach((e) => {
|
|
1499
|
+
e.style.transition = "none";
|
|
1500
|
+
}), a.getBoundingClientRect();
|
|
1501
|
+
let s = () => {
|
|
1502
|
+
o.forEach((e) => {
|
|
1503
|
+
e.style.removeProperty("transition");
|
|
1504
|
+
});
|
|
1505
|
+
}, c = requestAnimationFrame(s);
|
|
1506
|
+
return () => {
|
|
1507
|
+
cancelAnimationFrame(c), s();
|
|
1508
|
+
};
|
|
1509
|
+
}, [r?.name, n]);
|
|
1510
|
+
let p = t.items.slice(0, t.pointer + 1);
|
|
1511
|
+
if (r) {
|
|
1512
|
+
let { width: e, height: n } = t.items.at(t.pointer);
|
|
1513
|
+
p.push({
|
|
1514
|
+
...r.name === f.ROTATE ? Me(e, n, o(), r.args.degrees) : {
|
|
1297
1515
|
width: e,
|
|
1298
|
-
height:
|
|
1516
|
+
height: n
|
|
1299
1517
|
},
|
|
1300
|
-
action:
|
|
1518
|
+
action: r
|
|
1301
1519
|
});
|
|
1302
1520
|
}
|
|
1303
|
-
let
|
|
1304
|
-
return
|
|
1305
|
-
e && l.current && (l.current.style.transition = "none");
|
|
1521
|
+
let m = Ue(p);
|
|
1522
|
+
return i(() => {
|
|
1523
|
+
e && l.current && (l.current.style.transition = "none"), r?.name !== f.RESIZE && l.current && (l.current.style.transform = "scale(1)");
|
|
1306
1524
|
let t = (e) => {
|
|
1307
1525
|
let t = e.detail;
|
|
1308
1526
|
l.current && (l.current.style.transform = `scale(${t / 100})`);
|
|
@@ -1314,202 +1532,234 @@ var V = (e, t, n) => Math.max(t, Math.min(n, e)), Re = (e, t) => [[e[0][0] * t[0
|
|
|
1314
1532
|
return c.addEventListener("resize-update", t), c.addEventListener("clip-path-update", n), () => {
|
|
1315
1533
|
c.removeEventListener("resize-update", t), c.removeEventListener("clip-path-update", n);
|
|
1316
1534
|
};
|
|
1317
|
-
}, [
|
|
1318
|
-
|
|
1319
|
-
|
|
1535
|
+
}, [
|
|
1536
|
+
e,
|
|
1537
|
+
r?.name,
|
|
1538
|
+
c
|
|
1539
|
+
]), {
|
|
1540
|
+
previewRef: l,
|
|
1541
|
+
previewUrl: n,
|
|
1542
|
+
...m
|
|
1543
|
+
};
|
|
1544
|
+
}, X = {
|
|
1545
|
+
preview: "_preview_dvanl_1",
|
|
1546
|
+
rotate: "_rotate_dvanl_12",
|
|
1547
|
+
flip: "_flip_dvanl_24",
|
|
1548
|
+
image: "_image_dvanl_32"
|
|
1549
|
+
}, ct = ({ isClipped: e, style: t = {} }) => {
|
|
1550
|
+
let { previewRef: n, previewUrl: r, box: i, boxWidth: a, boxHeight: o, viewWidth: s, viewHeight: c, rotation: l, flipH: u, flipV: d } = st({ isClipped: e });
|
|
1551
|
+
return /* @__PURE__ */ (0, v.jsx)("div", {
|
|
1552
|
+
ref: n,
|
|
1553
|
+
className: X.preview,
|
|
1320
1554
|
style: {
|
|
1321
|
-
aspectRatio: `${
|
|
1555
|
+
aspectRatio: `${s} / ${c}`,
|
|
1322
1556
|
...t
|
|
1323
1557
|
},
|
|
1324
|
-
children: /* @__PURE__ */ (0,
|
|
1325
|
-
className:
|
|
1558
|
+
children: /* @__PURE__ */ (0, v.jsx)("div", {
|
|
1559
|
+
className: X.rotate,
|
|
1326
1560
|
style: {
|
|
1327
|
-
width: `${
|
|
1328
|
-
height: `${
|
|
1329
|
-
transform: `translate(-50%, -50%) rotate(${
|
|
1561
|
+
width: `${a / s * 100}%`,
|
|
1562
|
+
height: `${o / c * 100}%`,
|
|
1563
|
+
transform: `translate(-50%, -50%) rotate(${l}deg)`
|
|
1330
1564
|
},
|
|
1331
|
-
children: /* @__PURE__ */ (0,
|
|
1332
|
-
className:
|
|
1333
|
-
style: { transform: `scale(${
|
|
1334
|
-
children: /* @__PURE__ */ (0,
|
|
1335
|
-
className:
|
|
1336
|
-
src:
|
|
1565
|
+
children: /* @__PURE__ */ (0, v.jsx)("div", {
|
|
1566
|
+
className: X.flip,
|
|
1567
|
+
style: { transform: `scale(${u ? -1 : 1}, ${d ? -1 : 1})` },
|
|
1568
|
+
children: /* @__PURE__ */ (0, v.jsx)("img", {
|
|
1569
|
+
className: X.image,
|
|
1570
|
+
src: r,
|
|
1337
1571
|
alt: "Preview Image",
|
|
1338
1572
|
style: {
|
|
1339
|
-
width: `${1 /
|
|
1340
|
-
height: `${1 /
|
|
1341
|
-
left: `${-(
|
|
1342
|
-
top: `${-(
|
|
1573
|
+
width: `${1 / i.w * 100}%`,
|
|
1574
|
+
height: `${1 / i.h * 100}%`,
|
|
1575
|
+
left: `${-(i.x / i.w) * 100}%`,
|
|
1576
|
+
top: `${-(i.y / i.h) * 100}%`
|
|
1343
1577
|
}
|
|
1344
1578
|
})
|
|
1345
1579
|
})
|
|
1346
1580
|
})
|
|
1347
1581
|
});
|
|
1348
|
-
},
|
|
1349
|
-
wrapper: "
|
|
1350
|
-
box: "
|
|
1351
|
-
tools: "
|
|
1352
|
-
toolsInfo: "
|
|
1353
|
-
toolsInfoLabel: "
|
|
1354
|
-
toolsInfoValue: "
|
|
1355
|
-
linesBox: "
|
|
1356
|
-
line: "
|
|
1357
|
-
lineV: "
|
|
1358
|
-
lineH: "
|
|
1359
|
-
pointer: "
|
|
1360
|
-
pointerTopLeft: "
|
|
1361
|
-
pointerTopRight: "
|
|
1362
|
-
pointerBottomRight: "
|
|
1363
|
-
pointerBottomLeft: "
|
|
1364
|
-
mobileBorder: "
|
|
1365
|
-
mobilePointer: "
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1582
|
+
}, Z = {
|
|
1583
|
+
wrapper: "_wrapper_1yhyo_1",
|
|
1584
|
+
box: "_box_1yhyo_9",
|
|
1585
|
+
tools: "_tools_1yhyo_18",
|
|
1586
|
+
toolsInfo: "_toolsInfo_1yhyo_35",
|
|
1587
|
+
toolsInfoLabel: "_toolsInfoLabel_1yhyo_42",
|
|
1588
|
+
toolsInfoValue: "_toolsInfoValue_1yhyo_47",
|
|
1589
|
+
linesBox: "_linesBox_1yhyo_52",
|
|
1590
|
+
line: "_line_1yhyo_52",
|
|
1591
|
+
lineV: "_lineV_1yhyo_62",
|
|
1592
|
+
lineH: "_lineH_1yhyo_70",
|
|
1593
|
+
pointer: "_pointer_1yhyo_78",
|
|
1594
|
+
pointerTopLeft: "_pointerTopLeft_1yhyo_84",
|
|
1595
|
+
pointerTopRight: "_pointerTopRight_1yhyo_91",
|
|
1596
|
+
pointerBottomRight: "_pointerBottomRight_1yhyo_98",
|
|
1597
|
+
pointerBottomLeft: "_pointerBottomLeft_1yhyo_105",
|
|
1598
|
+
mobileBorder: "_mobileBorder_1yhyo_112",
|
|
1599
|
+
mobilePointer: "_mobilePointer_1yhyo_118",
|
|
1600
|
+
info: "_info_1yhyo_129",
|
|
1601
|
+
infoX: "_infoX_1yhyo_146",
|
|
1602
|
+
infoY: "_infoY_1yhyo_151",
|
|
1603
|
+
infoW: "_infoW_1yhyo_158",
|
|
1604
|
+
infoH: "_infoH_1yhyo_163",
|
|
1605
|
+
group: "_group_1yhyo_170",
|
|
1606
|
+
active: "_active_1yhyo_179"
|
|
1607
|
+
}, lt = () => {
|
|
1608
|
+
let { getLastHistoryItem: e } = F(), t = w(), n = s(null), { handleCropStart: r, initialCrop: i } = bt({ boxRef: n }), { width: a, height: o } = e(), { x: c, y: l, w: u, h: d } = i;
|
|
1609
|
+
return /* @__PURE__ */ (0, v.jsxs)(v.Fragment, { children: [/* @__PURE__ */ (0, v.jsx)(ct, {
|
|
1369
1610
|
isClipped: !0,
|
|
1370
1611
|
style: { clipPath: `xywh(${c}% ${l}% ${u}% ${d}%)` }
|
|
1371
|
-
}), /* @__PURE__ */ (0,
|
|
1372
|
-
className:
|
|
1373
|
-
style: { aspectRatio: `${a} / ${
|
|
1374
|
-
children: /* @__PURE__ */ (0,
|
|
1612
|
+
}), /* @__PURE__ */ (0, v.jsx)("div", {
|
|
1613
|
+
className: Z.wrapper,
|
|
1614
|
+
style: { aspectRatio: `${a} / ${o}` },
|
|
1615
|
+
children: /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1375
1616
|
ref: n,
|
|
1376
|
-
className:
|
|
1617
|
+
className: Z.box,
|
|
1377
1618
|
style: {
|
|
1378
1619
|
width: `${u}%`,
|
|
1379
1620
|
height: `${d}%`,
|
|
1380
1621
|
top: `${l}%`,
|
|
1381
1622
|
left: `${c}%`
|
|
1382
1623
|
},
|
|
1383
|
-
children: [/* @__PURE__ */ (0,
|
|
1624
|
+
children: [/* @__PURE__ */ (0, v.jsx)(pt, {}), t ? /* @__PURE__ */ (0, v.jsx)(xt, { onMouseDown: r }) : /* @__PURE__ */ (0, v.jsxs)(v.Fragment, { children: [/* @__PURE__ */ (0, v.jsx)(mt, { onMouseDown: r }), /* @__PURE__ */ (0, v.jsx)(St, {})] })]
|
|
1384
1625
|
})
|
|
1385
1626
|
})] });
|
|
1386
|
-
},
|
|
1387
|
-
|
|
1627
|
+
}, ut = ({ value: e, onChange: t }) => /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1628
|
+
className: Z.group,
|
|
1629
|
+
children: [
|
|
1630
|
+
/* @__PURE__ */ (0, v.jsx)(L, {
|
|
1631
|
+
variant: "outline",
|
|
1632
|
+
className: `${Z.groupBtn} ${e === "freeform" ? Z.active : ""}`,
|
|
1633
|
+
onClick: () => t("freeform"),
|
|
1634
|
+
children: /* @__PURE__ */ (0, v.jsx)(j, {})
|
|
1635
|
+
}),
|
|
1636
|
+
/* @__PURE__ */ (0, v.jsx)(L, {
|
|
1637
|
+
variant: "outline",
|
|
1638
|
+
className: `${Z.groupBtn} ${e === "origin" ? Z.active : ""}`,
|
|
1639
|
+
onClick: () => t("origin"),
|
|
1640
|
+
children: /* @__PURE__ */ (0, v.jsx)(ie, {})
|
|
1641
|
+
}),
|
|
1642
|
+
/* @__PURE__ */ (0, v.jsx)(L, {
|
|
1643
|
+
variant: "outline",
|
|
1644
|
+
className: `${Z.groupBtn} ${e === "1:1" ? Z.active : ""}`,
|
|
1645
|
+
onClick: () => t("1:1"),
|
|
1646
|
+
children: /* @__PURE__ */ (0, v.jsx)(M, {})
|
|
1647
|
+
}),
|
|
1648
|
+
/* @__PURE__ */ (0, v.jsx)(L, {
|
|
1649
|
+
variant: "outline",
|
|
1650
|
+
className: `${Z.groupBtn} ${e === "4:3" ? Z.active : ""}`,
|
|
1651
|
+
onClick: () => t("4:3"),
|
|
1652
|
+
children: /* @__PURE__ */ (0, v.jsx)(ae, {})
|
|
1653
|
+
}),
|
|
1654
|
+
/* @__PURE__ */ (0, v.jsx)(L, {
|
|
1655
|
+
variant: "outline",
|
|
1656
|
+
className: `${Z.groupBtn} ${e === "16:9" ? Z.active : ""}`,
|
|
1657
|
+
onClick: () => t("16:9"),
|
|
1658
|
+
children: /* @__PURE__ */ (0, v.jsx)(N, {})
|
|
1659
|
+
})
|
|
1660
|
+
]
|
|
1661
|
+
}), dt = () => {
|
|
1662
|
+
let { setCurrentAction: e, currentAction: t, getLastHistoryItem: n, addToHistory: r, setSidebar: a, eventBus: o } = F(), { width: c, height: l } = n(), { name: u, args: d } = t || {}, p = u === f.CROP ? d?.id : "", m = c / l, h = s({
|
|
1388
1663
|
x: 0,
|
|
1389
1664
|
y: 0,
|
|
1390
1665
|
w: 0,
|
|
1391
1666
|
h: 0
|
|
1392
1667
|
});
|
|
1393
|
-
return
|
|
1394
|
-
if (t?.name !==
|
|
1395
|
-
let e =
|
|
1396
|
-
|
|
1397
|
-
let
|
|
1398
|
-
|
|
1399
|
-
u.current && (u.current.textContent = t.toString()), d.current && (d.current.textContent = n.toString()), f.current && (f.current.textContent = r.toString()), p.current && (p.current.textContent = i.toString());
|
|
1400
|
-
}, y = (e) => {
|
|
1401
|
-
m.current = e.detail;
|
|
1668
|
+
return i(() => {
|
|
1669
|
+
if (t?.name !== f.CROP) return;
|
|
1670
|
+
let e = U(t.args.ratio, c, l);
|
|
1671
|
+
h.current = e;
|
|
1672
|
+
let n = (e) => {
|
|
1673
|
+
h.current = e.detail;
|
|
1402
1674
|
};
|
|
1403
|
-
return
|
|
1404
|
-
|
|
1675
|
+
return o.addEventListener("clip-path-update", n), () => {
|
|
1676
|
+
o.removeEventListener("clip-path-update", n);
|
|
1405
1677
|
};
|
|
1406
1678
|
}, [
|
|
1407
1679
|
t,
|
|
1408
1680
|
c,
|
|
1409
1681
|
l,
|
|
1410
|
-
|
|
1411
|
-
]),
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
className: `${X.toolsInfoValue} ${P.semibold}`,
|
|
1421
|
-
ref: u
|
|
1422
|
-
})]
|
|
1423
|
-
}),
|
|
1424
|
-
/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1425
|
-
className: X.toolsInfo,
|
|
1426
|
-
children: [/* @__PURE__ */ (0, h.jsx)("div", {
|
|
1427
|
-
className: X.toolsInfoLabel,
|
|
1428
|
-
children: "top"
|
|
1429
|
-
}), /* @__PURE__ */ (0, h.jsx)("div", {
|
|
1430
|
-
className: `${X.toolsInfoValue} ${P.semibold}`,
|
|
1431
|
-
ref: d
|
|
1432
|
-
})]
|
|
1433
|
-
}),
|
|
1434
|
-
/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1435
|
-
className: X.toolsInfo,
|
|
1436
|
-
children: [/* @__PURE__ */ (0, h.jsx)("div", {
|
|
1437
|
-
className: X.toolsInfoLabel,
|
|
1438
|
-
children: "width"
|
|
1439
|
-
}), /* @__PURE__ */ (0, h.jsx)("div", {
|
|
1440
|
-
className: `${X.toolsInfoValue} ${P.semibold}`,
|
|
1441
|
-
ref: f
|
|
1442
|
-
})]
|
|
1443
|
-
}),
|
|
1444
|
-
/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1445
|
-
className: X.toolsInfo,
|
|
1446
|
-
children: [/* @__PURE__ */ (0, h.jsx)("div", {
|
|
1447
|
-
className: X.toolsInfoLabel,
|
|
1448
|
-
children: "height"
|
|
1449
|
-
}), /* @__PURE__ */ (0, h.jsx)("div", {
|
|
1450
|
-
className: `${X.toolsInfoValue} ${P.semibold}`,
|
|
1451
|
-
ref: p
|
|
1452
|
-
})]
|
|
1453
|
-
}),
|
|
1454
|
-
/* @__PURE__ */ (0, h.jsx)(L, {
|
|
1455
|
-
onSave: async () => {
|
|
1456
|
-
if (!t || t.name !== w.CROP) return;
|
|
1457
|
-
let e = t.args?.preset?.width || Math.round(c * m.current.w / 100), n = t.args?.preset?.height || Math.round(l * m.current.h / 100);
|
|
1458
|
-
i({
|
|
1459
|
-
width: e,
|
|
1460
|
-
height: n,
|
|
1461
|
-
action: {
|
|
1462
|
-
name: "crop",
|
|
1463
|
-
args: {
|
|
1464
|
-
...t.args,
|
|
1465
|
-
...m.current
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
}), a(!0);
|
|
1469
|
-
},
|
|
1470
|
-
onClose: () => {
|
|
1471
|
-
e(null), a(!0);
|
|
1682
|
+
o
|
|
1683
|
+
]), {
|
|
1684
|
+
currentValue: p,
|
|
1685
|
+
handleChange: (t) => {
|
|
1686
|
+
t !== p && (e({
|
|
1687
|
+
name: f.CROP,
|
|
1688
|
+
args: {
|
|
1689
|
+
id: t,
|
|
1690
|
+
ratio: /^\d+:\d+$/.test(t) ? t.split(":").map(Number).reduce((e, t) => e / t) : m,
|
|
1691
|
+
isFree: t === "freeform"
|
|
1472
1692
|
}
|
|
1473
|
-
})
|
|
1474
|
-
|
|
1693
|
+
}), a(!0));
|
|
1694
|
+
},
|
|
1695
|
+
handleSave: () => {
|
|
1696
|
+
if (!t || t.name !== f.CROP) return;
|
|
1697
|
+
let e = t.args?.preset?.width || Math.round(c * h.current.w / 100), n = t.args?.preset?.height || Math.round(l * h.current.h / 100);
|
|
1698
|
+
r({
|
|
1699
|
+
width: e,
|
|
1700
|
+
height: n,
|
|
1701
|
+
action: {
|
|
1702
|
+
name: f.CROP,
|
|
1703
|
+
args: {
|
|
1704
|
+
...t.args,
|
|
1705
|
+
...h.current
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
}), a(!0);
|
|
1709
|
+
},
|
|
1710
|
+
handleClose: () => {
|
|
1711
|
+
e(null), a(!0);
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
}, ft = () => {
|
|
1715
|
+
let { currentValue: e, handleChange: t, handleSave: n, handleClose: r } = dt();
|
|
1716
|
+
return /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1717
|
+
className: Z.tools,
|
|
1718
|
+
children: [/* @__PURE__ */ (0, v.jsx)(ut, {
|
|
1719
|
+
value: e,
|
|
1720
|
+
onChange: t
|
|
1721
|
+
}), /* @__PURE__ */ (0, v.jsx)(V, {
|
|
1722
|
+
onSave: n,
|
|
1723
|
+
onClose: r
|
|
1724
|
+
})]
|
|
1475
1725
|
});
|
|
1476
|
-
},
|
|
1477
|
-
className:
|
|
1478
|
-
children: [/* @__PURE__ */ (0,
|
|
1479
|
-
}),
|
|
1480
|
-
/* @__PURE__ */ (0,
|
|
1481
|
-
className: `${
|
|
1726
|
+
}, pt = () => /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1727
|
+
className: Z.linesBox,
|
|
1728
|
+
children: [/* @__PURE__ */ (0, v.jsx)("span", { className: `${Z.line} ${Z.lineV}` }), /* @__PURE__ */ (0, v.jsx)("span", { className: `${Z.line} ${Z.lineH}` })]
|
|
1729
|
+
}), mt = ({ onMouseDown: e }) => /* @__PURE__ */ (0, v.jsxs)(v.Fragment, { children: [
|
|
1730
|
+
/* @__PURE__ */ (0, v.jsx)("div", {
|
|
1731
|
+
className: `${Z.pointer} ${Z.pointerTopLeft}`,
|
|
1482
1732
|
onMouseDown: (t) => e(t, "tl", "nwse")
|
|
1483
1733
|
}),
|
|
1484
|
-
/* @__PURE__ */ (0,
|
|
1485
|
-
className: `${
|
|
1734
|
+
/* @__PURE__ */ (0, v.jsx)("div", {
|
|
1735
|
+
className: `${Z.pointer} ${Z.pointerTopRight}`,
|
|
1486
1736
|
onMouseDown: (t) => e(t, "tr", "nesw")
|
|
1487
1737
|
}),
|
|
1488
|
-
/* @__PURE__ */ (0,
|
|
1489
|
-
className: `${
|
|
1738
|
+
/* @__PURE__ */ (0, v.jsx)("div", {
|
|
1739
|
+
className: `${Z.pointer} ${Z.pointerBottomRight}`,
|
|
1490
1740
|
onMouseDown: (t) => e(t, "br", "nwse")
|
|
1491
1741
|
}),
|
|
1492
|
-
/* @__PURE__ */ (0,
|
|
1493
|
-
className: `${
|
|
1742
|
+
/* @__PURE__ */ (0, v.jsx)("div", {
|
|
1743
|
+
className: `${Z.pointer} ${Z.pointerBottomLeft}`,
|
|
1494
1744
|
onMouseDown: (t) => e(t, "bl", "nesw")
|
|
1495
1745
|
})
|
|
1496
1746
|
] });
|
|
1497
1747
|
//#endregion
|
|
1498
1748
|
//#region src/shared/components/Pixedi/crop/useCropInteraction.ts
|
|
1499
|
-
function
|
|
1749
|
+
function ht(e, t, n) {
|
|
1500
1750
|
return Math.min(Math.max(e, t), n);
|
|
1501
1751
|
}
|
|
1502
|
-
function
|
|
1752
|
+
function gt(e, { x: t, y: n, w: r, h: i }) {
|
|
1503
1753
|
e.style.left = `${t}%`, e.style.top = `${n}%`, e.style.width = `${r}%`, e.style.height = `${i}%`;
|
|
1504
1754
|
}
|
|
1505
|
-
function
|
|
1755
|
+
function _t(e) {
|
|
1506
1756
|
let { width: t, height: n } = e.getBoundingClientRect();
|
|
1507
1757
|
return {
|
|
1508
1758
|
frameW: t,
|
|
1509
1759
|
frameH: n
|
|
1510
1760
|
};
|
|
1511
1761
|
}
|
|
1512
|
-
function
|
|
1762
|
+
function vt({ x: e, y: t, w: n, h: r }, i, a) {
|
|
1513
1763
|
return {
|
|
1514
1764
|
x: e / 100 * i,
|
|
1515
1765
|
y: t / 100 * a,
|
|
@@ -1517,7 +1767,7 @@ function at({ x: e, y: t, w: n, h: r }, i, a) {
|
|
|
1517
1767
|
h: r / 100 * a
|
|
1518
1768
|
};
|
|
1519
1769
|
}
|
|
1520
|
-
function
|
|
1770
|
+
function yt({ x: e, y: t, w: n, h: r }, i, a) {
|
|
1521
1771
|
return {
|
|
1522
1772
|
x: e / i * 100,
|
|
1523
1773
|
y: t / a * 100,
|
|
@@ -1525,427 +1775,396 @@ function ot({ x: e, y: t, w: n, h: r }, i, a) {
|
|
|
1525
1775
|
h: r / a * 100
|
|
1526
1776
|
};
|
|
1527
1777
|
}
|
|
1528
|
-
var
|
|
1529
|
-
let { currentAction: t, getLastHistoryItem: n, eventBus:
|
|
1778
|
+
var bt = ({ boxRef: e }) => {
|
|
1779
|
+
let { currentAction: t, getLastHistoryItem: n, eventBus: r } = F(), a = w(), { width: c, height: l } = n(), u = t?.name === f.CROP || t?.name === f.PRESET_CROP, d = u ? t.args.ratio : 1, p = !u || t.args.isFree, m = o(() => U(d, c, l), [
|
|
1530
1780
|
d,
|
|
1531
1781
|
c,
|
|
1532
1782
|
l
|
|
1533
|
-
]),
|
|
1534
|
-
return
|
|
1535
|
-
|
|
1536
|
-
}, [
|
|
1783
|
+
]), h = s(null), g = s(""), _ = s(m), v = s(m);
|
|
1784
|
+
return i(() => {
|
|
1785
|
+
_.current = m, $e(r, m);
|
|
1786
|
+
}, [m, r]), i(() => {
|
|
1537
1787
|
let t = (e, t) => {
|
|
1538
|
-
|
|
1788
|
+
_.current = t, gt(e, t), Qe(r, {
|
|
1539
1789
|
x: Math.round(t.x / 100 * c),
|
|
1540
1790
|
y: Math.round(t.y / 100 * l),
|
|
1541
1791
|
w: Math.round(t.w / 100 * c),
|
|
1542
1792
|
h: Math.round(t.h / 100 * l)
|
|
1543
|
-
}),
|
|
1793
|
+
}), $e(r, t);
|
|
1544
1794
|
}, n = (e) => {
|
|
1545
|
-
e.preventDefault(),
|
|
1795
|
+
e.preventDefault(), v.current = _.current;
|
|
1546
1796
|
let t = "clientX" in e ? e.clientX : e.touches[0].clientX, n = "clientY" in e ? e.clientY : e.touches[0].clientY;
|
|
1547
|
-
|
|
1797
|
+
h.current = {
|
|
1548
1798
|
x: t,
|
|
1549
1799
|
y: n
|
|
1550
1800
|
}, document.body.style.cursor = "move";
|
|
1551
|
-
},
|
|
1552
|
-
if (!e.current || !
|
|
1801
|
+
}, i = (t) => {
|
|
1802
|
+
if (!e.current || !h.current) return;
|
|
1553
1803
|
t.preventDefault();
|
|
1554
1804
|
let n = e.current, r = n.parentElement;
|
|
1555
1805
|
if (!r) return;
|
|
1556
|
-
let { frameW: i, frameH: s } =
|
|
1557
|
-
if (
|
|
1806
|
+
let { frameW: i, frameH: s } = _t(r);
|
|
1807
|
+
if (g.current) {
|
|
1558
1808
|
a(t, n, i, s);
|
|
1559
1809
|
return;
|
|
1560
1810
|
}
|
|
1561
1811
|
o(t, n, i, s);
|
|
1562
1812
|
}, a = (e, n, r, i) => {
|
|
1563
|
-
if (!
|
|
1564
|
-
let a = "clientX" in e ? e.clientX : e.touches[0].clientX, o = "clientY" in e ? e.clientY : e.touches[0].clientY, s =
|
|
1565
|
-
t(n,
|
|
1813
|
+
if (!h.current) return;
|
|
1814
|
+
let a = "clientX" in e ? e.clientX : e.touches[0].clientX, o = "clientY" in e ? e.clientY : e.touches[0].clientY, s = yt(Ae(g.current, p, d, h.current.x, h.current.y, a, o, r, i, vt(v.current, r, i), vt(_.current, r, i)), r, i);
|
|
1815
|
+
t(n, p ? s : je(s, d, c, l));
|
|
1566
1816
|
}, o = (e, n, r, i) => {
|
|
1567
|
-
if (!
|
|
1568
|
-
let { x: a, y: o, w: s, h: c } =
|
|
1817
|
+
if (!h.current) return;
|
|
1818
|
+
let { x: a, y: o, w: s, h: c } = v.current, l = "clientX" in e ? e.clientX : e.touches[0].clientX, u = "clientY" in e ? e.clientY : e.touches[0].clientY, d = (l - h.current.x) / r * 100, f = (u - h.current.y) / i * 100;
|
|
1569
1819
|
t(n, {
|
|
1570
|
-
x:
|
|
1571
|
-
y:
|
|
1820
|
+
x: ht(a + d, 0, Math.max(0, 100 - s)),
|
|
1821
|
+
y: ht(o + f, 0, Math.max(0, 100 - c)),
|
|
1572
1822
|
w: s,
|
|
1573
1823
|
h: c
|
|
1574
1824
|
});
|
|
1575
1825
|
}, s = () => {
|
|
1576
|
-
e.current && (
|
|
1826
|
+
e.current && (h.current = null, g.current = "", e.current.style.cursor = "move", document.body.style.cursor = "auto");
|
|
1577
1827
|
};
|
|
1578
1828
|
if (!e.current) return;
|
|
1579
|
-
let u = new AbortController(), { signal:
|
|
1580
|
-
return e.current.addEventListener("mousedown", n, { signal:
|
|
1581
|
-
signal:
|
|
1829
|
+
let u = new AbortController(), { signal: f } = u;
|
|
1830
|
+
return e.current.addEventListener("mousedown", n, { signal: f }), e.current.addEventListener("touchstart", n, {
|
|
1831
|
+
signal: f,
|
|
1582
1832
|
passive: !1
|
|
1583
|
-
}), document.addEventListener("mousemove",
|
|
1584
|
-
signal:
|
|
1833
|
+
}), document.addEventListener("mousemove", i, { signal: f }), document.addEventListener("touchmove", i, {
|
|
1834
|
+
signal: f,
|
|
1585
1835
|
passive: !1
|
|
1586
|
-
}), document.addEventListener("mouseup", s, { signal:
|
|
1836
|
+
}), document.addEventListener("mouseup", s, { signal: f }), document.addEventListener("touchend", s, { signal: f }), () => u.abort();
|
|
1587
1837
|
}, [
|
|
1588
|
-
|
|
1838
|
+
p,
|
|
1589
1839
|
d,
|
|
1590
1840
|
c,
|
|
1591
1841
|
l,
|
|
1592
1842
|
e,
|
|
1593
|
-
|
|
1843
|
+
r
|
|
1594
1844
|
]), {
|
|
1595
1845
|
handleCropStart: (t, n, r) => {
|
|
1596
1846
|
if (!e.current) return;
|
|
1597
|
-
t.stopPropagation(), t.preventDefault(),
|
|
1598
|
-
let i = "clientX" in t ? t.clientX : t.touches[0].clientX,
|
|
1599
|
-
|
|
1847
|
+
t.stopPropagation(), t.preventDefault(), v.current = _.current;
|
|
1848
|
+
let i = "clientX" in t ? t.clientX : t.touches[0].clientX, o = "clientY" in t ? t.clientY : t.touches[0].clientY;
|
|
1849
|
+
h.current = {
|
|
1600
1850
|
x: i,
|
|
1601
|
-
y:
|
|
1602
|
-
},
|
|
1851
|
+
y: o
|
|
1852
|
+
}, g.current = n, a || (e.current.style.cursor = `${r}-resize`, document.body.style.cursor = `${r}-resize`);
|
|
1603
1853
|
},
|
|
1604
|
-
initialCrop:
|
|
1854
|
+
initialCrop: m
|
|
1605
1855
|
};
|
|
1606
|
-
},
|
|
1607
|
-
className:
|
|
1608
|
-
children: /* @__PURE__ */ (0,
|
|
1609
|
-
className:
|
|
1856
|
+
}, xt = ({ onMouseDown: e }) => /* @__PURE__ */ (0, v.jsx)("div", {
|
|
1857
|
+
className: Z.mobileBorder,
|
|
1858
|
+
children: /* @__PURE__ */ (0, v.jsx)("div", {
|
|
1859
|
+
className: Z.mobilePointer,
|
|
1610
1860
|
onTouchStart: (t) => e(t, "br", "nwse")
|
|
1611
1861
|
})
|
|
1612
|
-
}),
|
|
1862
|
+
}), St = () => {
|
|
1863
|
+
let e = s(null), t = s(null), n = s(null), r = s(null), { currentAction: a, getLastHistoryItem: o, eventBus: c } = F(), { width: l, height: u } = o();
|
|
1864
|
+
return i(() => {
|
|
1865
|
+
if (!(a?.name === f.CROP || a?.name === f.PRESET_CROP)) return;
|
|
1866
|
+
let { xP: i, yP: o, wP: s, hP: d } = U(a.args.ratio, l, u);
|
|
1867
|
+
e.current && (e.current.textContent = i.toString()), t.current && (t.current.textContent = o.toString()), n.current && (n.current.textContent = s.toString()), r.current && (r.current.textContent = d.toString());
|
|
1868
|
+
let p = (i) => {
|
|
1869
|
+
let { x: a, y: o, w: s, h: c } = i.detail;
|
|
1870
|
+
e.current && (e.current.textContent = a.toString()), t.current && (t.current.textContent = o.toString()), n.current && (n.current.textContent = s.toString()), r.current && (r.current.textContent = c.toString());
|
|
1871
|
+
};
|
|
1872
|
+
return c.addEventListener("crop-update", p), () => {
|
|
1873
|
+
c.removeEventListener("crop-update", p);
|
|
1874
|
+
};
|
|
1875
|
+
}, [
|
|
1876
|
+
a,
|
|
1877
|
+
u,
|
|
1878
|
+
l,
|
|
1879
|
+
c
|
|
1880
|
+
]), /* @__PURE__ */ (0, v.jsxs)(v.Fragment, { children: [
|
|
1881
|
+
/* @__PURE__ */ (0, v.jsx)("div", {
|
|
1882
|
+
className: `${Z.info} ${Z.infoX}`,
|
|
1883
|
+
children: /* @__PURE__ */ (0, v.jsx)("b", { ref: e })
|
|
1884
|
+
}),
|
|
1885
|
+
/* @__PURE__ */ (0, v.jsx)("div", {
|
|
1886
|
+
className: `${Z.info} ${Z.infoY}`,
|
|
1887
|
+
children: /* @__PURE__ */ (0, v.jsx)("b", { ref: t })
|
|
1888
|
+
}),
|
|
1889
|
+
/* @__PURE__ */ (0, v.jsx)("div", {
|
|
1890
|
+
className: `${Z.info} ${Z.infoW}`,
|
|
1891
|
+
children: /* @__PURE__ */ (0, v.jsx)("b", { ref: n })
|
|
1892
|
+
}),
|
|
1893
|
+
/* @__PURE__ */ (0, v.jsx)("div", {
|
|
1894
|
+
className: `${Z.info} ${Z.infoH}`,
|
|
1895
|
+
children: /* @__PURE__ */ (0, v.jsx)("b", { ref: r })
|
|
1896
|
+
})
|
|
1897
|
+
] });
|
|
1898
|
+
}, Ct = we.map((e) => e.options).flat(), wt = () => Ct, Tt = () => {
|
|
1899
|
+
let { currentAction: e, getLastHistoryItem: t, addToHistory: n, setSidebar: r, setCurrentAction: a, eventBus: o } = F(), { width: c, height: l } = t(), u = e?.name === f.PRESET_CROP && Ct.some((t) => t.value === e.args.id) ? e.args.id : "", d = s({
|
|
1900
|
+
x: 0,
|
|
1901
|
+
y: 0,
|
|
1902
|
+
w: 0,
|
|
1903
|
+
h: 0
|
|
1904
|
+
});
|
|
1905
|
+
return i(() => {
|
|
1906
|
+
if (e?.name !== f.PRESET_CROP) return;
|
|
1907
|
+
let t = U(e.args.ratio, c, l);
|
|
1908
|
+
d.current = t;
|
|
1909
|
+
let n = (e) => {
|
|
1910
|
+
d.current = e.detail;
|
|
1911
|
+
};
|
|
1912
|
+
return o.addEventListener("clip-path-update", n), () => {
|
|
1913
|
+
o.removeEventListener("clip-path-update", n);
|
|
1914
|
+
};
|
|
1915
|
+
}, [
|
|
1916
|
+
e,
|
|
1917
|
+
c,
|
|
1918
|
+
l,
|
|
1919
|
+
o
|
|
1920
|
+
]), {
|
|
1921
|
+
currentValue: u,
|
|
1922
|
+
presetsData: we,
|
|
1923
|
+
handleChange: (e) => {
|
|
1924
|
+
if (!e) return;
|
|
1925
|
+
let t = wt().find((t) => t.value === e);
|
|
1926
|
+
if (!t) return;
|
|
1927
|
+
let n = {
|
|
1928
|
+
id: e,
|
|
1929
|
+
ratio: t.w / t.h,
|
|
1930
|
+
isFree: !1,
|
|
1931
|
+
preset: {
|
|
1932
|
+
width: t.w,
|
|
1933
|
+
height: t.h
|
|
1934
|
+
}
|
|
1935
|
+
};
|
|
1936
|
+
a({
|
|
1937
|
+
name: f.PRESET_CROP,
|
|
1938
|
+
args: n
|
|
1939
|
+
});
|
|
1940
|
+
},
|
|
1941
|
+
handleSave: () => {
|
|
1942
|
+
!e || e.name !== f.PRESET_CROP || (n({
|
|
1943
|
+
width: e.args?.preset?.width || 0,
|
|
1944
|
+
height: e.args?.preset?.height || 0,
|
|
1945
|
+
action: {
|
|
1946
|
+
name: f.CROP,
|
|
1947
|
+
args: {
|
|
1948
|
+
...e.args,
|
|
1949
|
+
...d.current
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
}), r(!0));
|
|
1953
|
+
},
|
|
1954
|
+
handleClose: () => {
|
|
1955
|
+
a(null), r(!0);
|
|
1956
|
+
}
|
|
1957
|
+
};
|
|
1958
|
+
}, Et = {
|
|
1959
|
+
preset: "_preset_1rbuc_1",
|
|
1960
|
+
select: "_select_1rbuc_14"
|
|
1961
|
+
}, Dt = () => {
|
|
1962
|
+
let { currentValue: e, presetsData: t, handleChange: n, handleSave: r, handleClose: i } = Tt();
|
|
1963
|
+
return /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
1964
|
+
className: Et.preset,
|
|
1965
|
+
children: [/* @__PURE__ */ (0, v.jsx)(_e, {
|
|
1966
|
+
value: e,
|
|
1967
|
+
placeholder: "Select a preset",
|
|
1968
|
+
onChange: n,
|
|
1969
|
+
items: t,
|
|
1970
|
+
className: Et.select
|
|
1971
|
+
}), /* @__PURE__ */ (0, v.jsx)(V, {
|
|
1972
|
+
onSave: r,
|
|
1973
|
+
onClose: i
|
|
1974
|
+
})]
|
|
1975
|
+
});
|
|
1976
|
+
}, Ot = () => {
|
|
1977
|
+
let { getLastHistoryItem: e, setCurrentAction: t, addToHistory: n, setSidebar: r } = F(), { width: i, height: a } = e(), [o, s] = c(!1), [l, u] = c(!1), d = (e, n) => {
|
|
1978
|
+
t({
|
|
1979
|
+
name: f.FLIP,
|
|
1980
|
+
args: {
|
|
1981
|
+
horizontal: e,
|
|
1982
|
+
vertical: n
|
|
1983
|
+
}
|
|
1984
|
+
});
|
|
1985
|
+
};
|
|
1986
|
+
return {
|
|
1987
|
+
flipHorizontal: o,
|
|
1988
|
+
flipVertical: l,
|
|
1989
|
+
handleFlipHorizontal: () => {
|
|
1990
|
+
let e = !o;
|
|
1991
|
+
s(e), d(e, l);
|
|
1992
|
+
},
|
|
1993
|
+
handleFlipVertical: () => {
|
|
1994
|
+
let e = !l;
|
|
1995
|
+
u(e), d(o, e);
|
|
1996
|
+
},
|
|
1997
|
+
handleSave: () => {
|
|
1998
|
+
n({
|
|
1999
|
+
width: i,
|
|
2000
|
+
height: a,
|
|
2001
|
+
action: {
|
|
2002
|
+
name: f.FLIP,
|
|
2003
|
+
args: {
|
|
2004
|
+
horizontal: o,
|
|
2005
|
+
vertical: l
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
}), r(!0);
|
|
2009
|
+
},
|
|
2010
|
+
handleClose: () => {
|
|
2011
|
+
t(null), r(!0);
|
|
2012
|
+
}
|
|
2013
|
+
};
|
|
2014
|
+
}, Q = {
|
|
1613
2015
|
flip: "_flip_17ic5_1",
|
|
1614
2016
|
btnH: "_btnH_17ic5_14",
|
|
1615
2017
|
btnV: "_btnV_17ic5_20"
|
|
1616
|
-
},
|
|
1617
|
-
let {
|
|
1618
|
-
return /* @__PURE__ */ (0,
|
|
1619
|
-
className:
|
|
1620
|
-
children: [/* @__PURE__ */ (0,
|
|
1621
|
-
className:
|
|
1622
|
-
children: [/* @__PURE__ */ (0,
|
|
2018
|
+
}, kt = () => {
|
|
2019
|
+
let { flipHorizontal: e, flipVertical: t, handleFlipHorizontal: n, handleFlipVertical: r, handleSave: i, handleClose: a } = Ot();
|
|
2020
|
+
return /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
2021
|
+
className: Q.flip,
|
|
2022
|
+
children: [/* @__PURE__ */ (0, v.jsxs)("div", {
|
|
2023
|
+
className: Q.scGroup,
|
|
2024
|
+
children: [/* @__PURE__ */ (0, v.jsx)(L, {
|
|
1623
2025
|
variant: "outline",
|
|
1624
|
-
className:
|
|
1625
|
-
onClick:
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
args: {
|
|
1629
|
-
horizontal: !i,
|
|
1630
|
-
vertical: o
|
|
1631
|
-
}
|
|
1632
|
-
});
|
|
1633
|
-
},
|
|
1634
|
-
children: /* @__PURE__ */ (0, h.jsx)(le, { style: { color: i ? "var(--accent-blue)" : "var(--foreground)" } })
|
|
1635
|
-
}), /* @__PURE__ */ (0, h.jsx)(N, {
|
|
2026
|
+
className: Q.btnH,
|
|
2027
|
+
onClick: n,
|
|
2028
|
+
children: /* @__PURE__ */ (0, v.jsx)(se, { style: { color: e ? "var(--accent-blue)" : "var(--foreground)" } })
|
|
2029
|
+
}), /* @__PURE__ */ (0, v.jsx)(L, {
|
|
1636
2030
|
variant: "outline",
|
|
1637
|
-
className:
|
|
1638
|
-
onClick:
|
|
1639
|
-
|
|
1640
|
-
name: w.FLIP,
|
|
1641
|
-
args: {
|
|
1642
|
-
horizontal: i,
|
|
1643
|
-
vertical: !o
|
|
1644
|
-
}
|
|
1645
|
-
});
|
|
1646
|
-
},
|
|
1647
|
-
children: /* @__PURE__ */ (0, h.jsx)(ue, { style: { color: o ? "var(--accent-blue)" : "var(--foreground)" } })
|
|
2031
|
+
className: Q.btnV,
|
|
2032
|
+
onClick: r,
|
|
2033
|
+
children: /* @__PURE__ */ (0, v.jsx)(ce, { style: { color: t ? "var(--accent-blue)" : "var(--foreground)" } })
|
|
1648
2034
|
})]
|
|
1649
|
-
}), /* @__PURE__ */ (0,
|
|
1650
|
-
disabled: !
|
|
1651
|
-
onSave:
|
|
1652
|
-
|
|
1653
|
-
width: l,
|
|
1654
|
-
height: u,
|
|
1655
|
-
action: {
|
|
1656
|
-
name: w.FLIP,
|
|
1657
|
-
args: {
|
|
1658
|
-
horizontal: i,
|
|
1659
|
-
vertical: o
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
}), r(!0);
|
|
1663
|
-
},
|
|
1664
|
-
onClose: () => {
|
|
1665
|
-
t(null), r(!0);
|
|
1666
|
-
}
|
|
2035
|
+
}), /* @__PURE__ */ (0, v.jsx)(V, {
|
|
2036
|
+
disabled: !e && !t,
|
|
2037
|
+
onSave: i,
|
|
2038
|
+
onClose: a
|
|
1667
2039
|
})]
|
|
1668
2040
|
});
|
|
1669
|
-
},
|
|
2041
|
+
}, At = () => {
|
|
2042
|
+
let { getLastRotation: e, getLastHistoryItem: t, addToHistory: n, setSidebar: r, setCurrentAction: i } = F(), { width: a, height: o } = t(), c = e(), l = s(c), u = s(c);
|
|
2043
|
+
return {
|
|
2044
|
+
handleRotate: (e) => {
|
|
2045
|
+
u.current += e, i({
|
|
2046
|
+
name: f.ROTATE,
|
|
2047
|
+
args: { degrees: u.current }
|
|
2048
|
+
});
|
|
2049
|
+
},
|
|
2050
|
+
handleSave: () => {
|
|
2051
|
+
n({
|
|
2052
|
+
...Me(a, o, l.current, u.current),
|
|
2053
|
+
action: {
|
|
2054
|
+
name: f.ROTATE,
|
|
2055
|
+
args: { degrees: u.current }
|
|
2056
|
+
}
|
|
2057
|
+
}), r(!0);
|
|
2058
|
+
},
|
|
2059
|
+
handleClose: () => {
|
|
2060
|
+
i(null), r(!0);
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
}, $ = {
|
|
1670
2064
|
rotate: "_rotate_gkt07_1",
|
|
1671
2065
|
btnH: "_btnH_gkt07_14",
|
|
1672
2066
|
btnV: "_btnV_gkt07_20"
|
|
1673
|
-
},
|
|
1674
|
-
let {
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
return /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1681
|
-
className: Q.rotate,
|
|
1682
|
-
children: [/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1683
|
-
className: Q.scGroup,
|
|
1684
|
-
children: [/* @__PURE__ */ (0, h.jsx)(N, {
|
|
2067
|
+
}, jt = () => {
|
|
2068
|
+
let { handleRotate: e, handleSave: t, handleClose: n } = At();
|
|
2069
|
+
return /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
2070
|
+
className: $.rotate,
|
|
2071
|
+
children: [/* @__PURE__ */ (0, v.jsxs)("div", {
|
|
2072
|
+
className: $.scGroup,
|
|
2073
|
+
children: [/* @__PURE__ */ (0, v.jsx)(L, {
|
|
1685
2074
|
variant: "outline",
|
|
1686
|
-
className:
|
|
1687
|
-
onClick: () =>
|
|
1688
|
-
children: /* @__PURE__ */ (0,
|
|
1689
|
-
}), /* @__PURE__ */ (0,
|
|
2075
|
+
className: $.btnH,
|
|
2076
|
+
onClick: () => e(90),
|
|
2077
|
+
children: /* @__PURE__ */ (0, v.jsx)(le, {})
|
|
2078
|
+
}), /* @__PURE__ */ (0, v.jsx)(L, {
|
|
1690
2079
|
variant: "outline",
|
|
1691
|
-
className:
|
|
1692
|
-
onClick: () =>
|
|
1693
|
-
children: /* @__PURE__ */ (0,
|
|
2080
|
+
className: $.btnV,
|
|
2081
|
+
onClick: () => e(-90),
|
|
2082
|
+
children: /* @__PURE__ */ (0, v.jsx)(ue, {})
|
|
1694
2083
|
})]
|
|
1695
|
-
}), /* @__PURE__ */ (0,
|
|
1696
|
-
onSave:
|
|
1697
|
-
|
|
1698
|
-
...Ne(a, s, l.current, u.current),
|
|
1699
|
-
action: {
|
|
1700
|
-
name: "rotate",
|
|
1701
|
-
args: { degrees: u.current }
|
|
1702
|
-
}
|
|
1703
|
-
}), r(!0);
|
|
1704
|
-
},
|
|
1705
|
-
onClose: () => {
|
|
1706
|
-
i(null), r(!0);
|
|
1707
|
-
}
|
|
2084
|
+
}), /* @__PURE__ */ (0, v.jsx)(V, {
|
|
2085
|
+
onSave: t,
|
|
2086
|
+
onClose: n
|
|
1708
2087
|
})]
|
|
1709
2088
|
});
|
|
1710
|
-
},
|
|
1711
|
-
let { currentAction: e } =
|
|
1712
|
-
return /* @__PURE__ */ (0,
|
|
1713
|
-
className: `${
|
|
2089
|
+
}, Mt = { frame: "_frame_15mog_1" }, Nt = () => {
|
|
2090
|
+
let { currentAction: e } = F(), t = e?.name === f.RESIZE, n = e?.name === f.CROP, r = e?.name === f.PRESET_CROP, i = e?.name === f.FLIP, a = e?.name === f.ROTATE, o = n || r;
|
|
2091
|
+
return /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
2092
|
+
className: `${Mt.frame} ${o ? z.mask : ""}`,
|
|
1714
2093
|
children: [
|
|
1715
|
-
/* @__PURE__ */ (0,
|
|
1716
|
-
t && /* @__PURE__ */ (0,
|
|
1717
|
-
n && /* @__PURE__ */ (0,
|
|
1718
|
-
|
|
1719
|
-
r && /* @__PURE__ */ (0,
|
|
1720
|
-
i && /* @__PURE__ */ (0,
|
|
2094
|
+
/* @__PURE__ */ (0, v.jsx)(ct, { style: o ? { opacity: .4 } : {} }),
|
|
2095
|
+
t && /* @__PURE__ */ (0, v.jsx)(ot, {}),
|
|
2096
|
+
(n || r) && /* @__PURE__ */ (0, v.jsx)(lt, {}, e?.args?.id),
|
|
2097
|
+
n && /* @__PURE__ */ (0, v.jsx)(ft, {}),
|
|
2098
|
+
r && /* @__PURE__ */ (0, v.jsx)(Dt, {}),
|
|
2099
|
+
i && /* @__PURE__ */ (0, v.jsx)(kt, {}),
|
|
2100
|
+
a && /* @__PURE__ */ (0, v.jsx)(jt, {})
|
|
1721
2101
|
]
|
|
1722
2102
|
});
|
|
1723
|
-
},
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
resize: "_resize_8qtha_56",
|
|
1731
|
-
resizeIcon: "_resizeIcon_8qtha_61",
|
|
1732
|
-
resizeSize: "_resizeSize_8qtha_66",
|
|
1733
|
-
crop: "_crop_8qtha_70",
|
|
1734
|
-
ratio: "_ratio_8qtha_75",
|
|
1735
|
-
sidebarPreset: "_sidebarPreset_8qtha_80",
|
|
1736
|
-
flipRotate: "_flipRotate_8qtha_85"
|
|
1737
|
-
}, pt = () => {
|
|
1738
|
-
let { getLastHistoryItem: e, setCurrentAction: t, setSidebar: n } = j(), { width: r, height: i } = e() ?? {
|
|
1739
|
-
width: 0,
|
|
1740
|
-
height: 0
|
|
1741
|
-
};
|
|
1742
|
-
return /* @__PURE__ */ (0, h.jsxs)(N, {
|
|
1743
|
-
variant: "outline",
|
|
1744
|
-
className: $.resize,
|
|
1745
|
-
onClick: () => {
|
|
1746
|
-
t({
|
|
1747
|
-
name: w.RESIZE,
|
|
1748
|
-
args: {
|
|
1749
|
-
width: r,
|
|
1750
|
-
height: i
|
|
1751
|
-
}
|
|
1752
|
-
}), n(!1);
|
|
1753
|
-
},
|
|
1754
|
-
children: [/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1755
|
-
className: $.resizeIcon,
|
|
1756
|
-
children: [/* @__PURE__ */ (0, h.jsx)(k, {}), "Resize"]
|
|
1757
|
-
}), /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1758
|
-
className: $.resizeSize,
|
|
1759
|
-
children: [
|
|
1760
|
-
r,
|
|
1761
|
-
" x ",
|
|
1762
|
-
i
|
|
1763
|
-
]
|
|
1764
|
-
})]
|
|
1765
|
-
});
|
|
1766
|
-
}, mt = () => {
|
|
1767
|
-
let { currentAction: e, setCurrentAction: t, getLastHistoryItem: n, setSidebar: r } = j(), { name: i, args: a } = e || {}, o = i === "crop" ? a?.id : "", { width: s, height: c } = n(), l = s / c, u = (e) => {
|
|
1768
|
-
e !== o && (t({
|
|
1769
|
-
name: "crop",
|
|
1770
|
-
args: {
|
|
1771
|
-
id: e,
|
|
1772
|
-
ratio: e === "1:1" ? 1 : l,
|
|
1773
|
-
isFree: e === "freeform"
|
|
1774
|
-
}
|
|
1775
|
-
}), r(!1));
|
|
1776
|
-
};
|
|
1777
|
-
return /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1778
|
-
className: $.crop,
|
|
1779
|
-
children: [/* @__PURE__ */ (0, h.jsx)("h4", { children: "Crop" }), /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1780
|
-
className: $.ratio,
|
|
1781
|
-
children: [
|
|
1782
|
-
/* @__PURE__ */ (0, h.jsx)(me, {
|
|
1783
|
-
label: "Freeform",
|
|
1784
|
-
icon: /* @__PURE__ */ (0, h.jsx)(oe, {}),
|
|
1785
|
-
active: o === "freeform",
|
|
1786
|
-
onClick: () => u("freeform")
|
|
1787
|
-
}),
|
|
1788
|
-
/* @__PURE__ */ (0, h.jsx)(me, {
|
|
1789
|
-
label: "Original",
|
|
1790
|
-
icon: /* @__PURE__ */ (0, h.jsx)(se, {}),
|
|
1791
|
-
active: o === "original",
|
|
1792
|
-
onClick: () => u("original")
|
|
1793
|
-
}),
|
|
1794
|
-
/* @__PURE__ */ (0, h.jsx)(me, {
|
|
1795
|
-
label: "1:1",
|
|
1796
|
-
icon: /* @__PURE__ */ (0, h.jsx)(ce, {}),
|
|
1797
|
-
active: o === "1:1",
|
|
1798
|
-
onClick: () => u("1:1")
|
|
1799
|
-
})
|
|
1800
|
-
]
|
|
1801
|
-
})]
|
|
1802
|
-
});
|
|
1803
|
-
}, ht = Te.map((e) => e.options).flat(), gt = () => {
|
|
1804
|
-
let { setCurrentAction: e, currentAction: t, setSidebar: n } = j(), r = t?.name === "crop" && ht.some((e) => e.value === t.args.id) ? t.args.id : "";
|
|
1805
|
-
return /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1806
|
-
className: $.sidebarPreset,
|
|
1807
|
-
children: [/* @__PURE__ */ (0, h.jsx)("h4", { children: "Presets" }), /* @__PURE__ */ (0, h.jsx)("div", { children: /* @__PURE__ */ (0, h.jsx)(ge, {
|
|
1808
|
-
value: r,
|
|
1809
|
-
placeholder: "Select a preset",
|
|
1810
|
-
onChange: (t) => {
|
|
1811
|
-
if (!t) return;
|
|
1812
|
-
let r = Te.map((e) => e.options).flat().find((e) => e.value === t);
|
|
1813
|
-
if (!r) return;
|
|
1814
|
-
let i = {
|
|
1815
|
-
id: t,
|
|
1816
|
-
ratio: r.w / r.h,
|
|
1817
|
-
isFree: !1,
|
|
1818
|
-
preset: {
|
|
1819
|
-
width: r.w,
|
|
1820
|
-
height: r.h
|
|
1821
|
-
}
|
|
1822
|
-
};
|
|
1823
|
-
e({
|
|
1824
|
-
name: "crop",
|
|
1825
|
-
args: i
|
|
1826
|
-
}), n(!1);
|
|
1827
|
-
},
|
|
1828
|
-
items: Te
|
|
1829
|
-
}) })]
|
|
1830
|
-
});
|
|
1831
|
-
}, _t = () => {
|
|
1832
|
-
let { setCurrentAction: e, setSidebar: t } = j();
|
|
1833
|
-
return /* @__PURE__ */ (0, h.jsx)(N, {
|
|
1834
|
-
variant: "outline",
|
|
1835
|
-
className: $.resize,
|
|
1836
|
-
onClick: () => {
|
|
1837
|
-
e({
|
|
1838
|
-
name: w.FLIP,
|
|
1839
|
-
args: {
|
|
1840
|
-
horizontal: !1,
|
|
1841
|
-
vertical: !1
|
|
1842
|
-
}
|
|
1843
|
-
}), t(!1);
|
|
1844
|
-
},
|
|
1845
|
-
children: /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1846
|
-
className: $.resizeIcon,
|
|
1847
|
-
children: [/* @__PURE__ */ (0, h.jsx)(le, {}), "Flip"]
|
|
1848
|
-
})
|
|
1849
|
-
});
|
|
1850
|
-
}, vt = () => {
|
|
1851
|
-
let { getLastRotation: e, setCurrentAction: t, setSidebar: n } = j();
|
|
1852
|
-
return /* @__PURE__ */ (0, h.jsx)(N, {
|
|
1853
|
-
variant: "outline",
|
|
1854
|
-
className: $.resize,
|
|
1855
|
-
onClick: () => {
|
|
1856
|
-
t({
|
|
1857
|
-
name: "rotate",
|
|
1858
|
-
args: { degrees: e() }
|
|
1859
|
-
}), n(!1);
|
|
1860
|
-
},
|
|
1861
|
-
children: /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1862
|
-
className: $.resizeIcon,
|
|
1863
|
-
children: [/* @__PURE__ */ (0, h.jsx)(de, {}), "Rotate"]
|
|
1864
|
-
})
|
|
2103
|
+
}, Pt = ({ image: e, onSave: t, onBack: n, theme: r = "light", settings: i = p }) => {
|
|
2104
|
+
let [a, o] = c(null), s = T("sm", a), l = {
|
|
2105
|
+
...p,
|
|
2106
|
+
...i
|
|
2107
|
+
}, { loading: u, error: d, mimeType: f, width: m, height: h, originalBlob: g, previewUrl: _, isAlpha: b } = C({
|
|
2108
|
+
src: e,
|
|
2109
|
+
skip: l?.tools?.length === 0
|
|
1865
2110
|
});
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
className: $.sidebar,
|
|
1875
|
-
style: { transform: n && e ? "translateX(-320px)" : "translateX(0%)" },
|
|
1876
|
-
children: /* @__PURE__ */ (0, h.jsx)("div", {
|
|
1877
|
-
className: $.container,
|
|
1878
|
-
children: /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1879
|
-
className: $.content,
|
|
1880
|
-
children: [
|
|
1881
|
-
n && /* @__PURE__ */ (0, h.jsx)(N, {
|
|
1882
|
-
variant: "ghost",
|
|
1883
|
-
className: `${$.closeBtn} ${M.rect}`,
|
|
1884
|
-
onClick: () => t(!1),
|
|
1885
|
-
children: /* @__PURE__ */ (0, h.jsx)(te, {})
|
|
1886
|
-
}),
|
|
1887
|
-
/* @__PURE__ */ (0, h.jsx)(pt, {}),
|
|
1888
|
-
/* @__PURE__ */ (0, h.jsx)(F, { className: $.separator }),
|
|
1889
|
-
/* @__PURE__ */ (0, h.jsx)(mt, {}),
|
|
1890
|
-
/* @__PURE__ */ (0, h.jsx)(F, { className: $.separator }),
|
|
1891
|
-
/* @__PURE__ */ (0, h.jsx)(gt, {}),
|
|
1892
|
-
/* @__PURE__ */ (0, h.jsx)(F, { className: $.separator }),
|
|
1893
|
-
/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
1894
|
-
className: $.flipRotate,
|
|
1895
|
-
children: [/* @__PURE__ */ (0, h.jsx)(_t, {}), /* @__PURE__ */ (0, h.jsx)(vt, {})]
|
|
1896
|
-
})
|
|
1897
|
-
]
|
|
2111
|
+
return l?.tools?.length === 0 ? /* @__PURE__ */ (0, v.jsx)("div", {
|
|
2112
|
+
className: `${z.root} ${z.wrapper}`,
|
|
2113
|
+
"data-theme": r,
|
|
2114
|
+
children: /* @__PURE__ */ (0, v.jsx)("div", {
|
|
2115
|
+
className: z.system,
|
|
2116
|
+
children: /* @__PURE__ */ (0, v.jsx)("div", {
|
|
2117
|
+
className: z.textRed,
|
|
2118
|
+
children: "No tools selected."
|
|
1898
2119
|
})
|
|
1899
2120
|
})
|
|
1900
|
-
})
|
|
1901
|
-
|
|
1902
|
-
let { loading: a, error: o, mimeType: s, width: c, height: l, originalBlob: d, previewUrl: f, isAlpha: p } = b(e);
|
|
1903
|
-
return a || o || !d || !s ? /* @__PURE__ */ (0, h.jsx)("div", {
|
|
1904
|
-
className: `${P.root} ${P.wrapper}`,
|
|
2121
|
+
}) : u || d || !g || !f ? /* @__PURE__ */ (0, v.jsx)("div", {
|
|
2122
|
+
className: `${z.root} ${z.wrapper}`,
|
|
1905
2123
|
"data-theme": r,
|
|
1906
|
-
children: /* @__PURE__ */ (0,
|
|
1907
|
-
className:
|
|
2124
|
+
children: /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
2125
|
+
className: z.system,
|
|
1908
2126
|
children: [
|
|
1909
|
-
|
|
2127
|
+
u && /* @__PURE__ */ (0, v.jsx)(P, { style: {
|
|
1910
2128
|
width: 48,
|
|
1911
2129
|
height: 48
|
|
1912
2130
|
} }),
|
|
1913
|
-
|
|
1914
|
-
className:
|
|
1915
|
-
children:
|
|
2131
|
+
d && /* @__PURE__ */ (0, v.jsx)("div", {
|
|
2132
|
+
className: z.textRed,
|
|
2133
|
+
children: d
|
|
1916
2134
|
}),
|
|
1917
|
-
!
|
|
1918
|
-
className:
|
|
2135
|
+
!u && !d && (!g || !f) && /* @__PURE__ */ (0, v.jsx)("div", {
|
|
2136
|
+
className: z.textRed,
|
|
1919
2137
|
children: "Failed to load image."
|
|
1920
2138
|
})
|
|
1921
2139
|
]
|
|
1922
2140
|
})
|
|
1923
|
-
}) : /* @__PURE__ */ (0,
|
|
1924
|
-
mimeType:
|
|
1925
|
-
width:
|
|
1926
|
-
height:
|
|
1927
|
-
originalBlob:
|
|
1928
|
-
previewUrl:
|
|
1929
|
-
isAlpha:
|
|
1930
|
-
settings:
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
children: /* @__PURE__ */ (0, h.jsx)("div", {
|
|
1935
|
-
className: `${P.root} ${P.wrapper}`,
|
|
2141
|
+
}) : /* @__PURE__ */ (0, v.jsx)(y, {
|
|
2142
|
+
mimeType: f,
|
|
2143
|
+
width: m,
|
|
2144
|
+
height: h,
|
|
2145
|
+
originalBlob: g,
|
|
2146
|
+
previewUrl: _,
|
|
2147
|
+
isAlpha: b,
|
|
2148
|
+
settings: l,
|
|
2149
|
+
children: /* @__PURE__ */ (0, v.jsx)("div", {
|
|
2150
|
+
ref: o,
|
|
2151
|
+
className: `${z.root} ${z.wrapper}`,
|
|
1936
2152
|
"data-theme": r,
|
|
1937
|
-
children: /* @__PURE__ */ (0,
|
|
1938
|
-
className:
|
|
1939
|
-
children: [
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
2153
|
+
children: /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
2154
|
+
className: `${l?.infobar ? z.grid : z.gridNoInfobar} ${s ? z.mobile : ""}`,
|
|
2155
|
+
children: [
|
|
2156
|
+
/* @__PURE__ */ (0, v.jsx)(Ke, {
|
|
2157
|
+
onSave: t,
|
|
2158
|
+
onBack: n,
|
|
2159
|
+
isMobile: s
|
|
2160
|
+
}),
|
|
2161
|
+
/* @__PURE__ */ (0, v.jsx)(Je, { isMobile: s }),
|
|
2162
|
+
l?.infobar && /* @__PURE__ */ (0, v.jsx)(Ze, {}),
|
|
2163
|
+
/* @__PURE__ */ (0, v.jsx)(Nt, {})
|
|
2164
|
+
]
|
|
1946
2165
|
})
|
|
1947
2166
|
})
|
|
1948
2167
|
});
|
|
1949
2168
|
};
|
|
1950
2169
|
//#endregion
|
|
1951
|
-
export {
|
|
2170
|
+
export { Pt as Pixedi };
|