pixedi 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib/index.js CHANGED
@@ -1,11 +1,33 @@
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}._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}:host{height:100%;display:block}:host *{box-sizing:border-box}._root_1kq9x_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-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);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--popover:oklch(100% 0 0);--popover-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(55.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);--destructive:oklch(57.7% .245 27.325);--success:oklch(76.8% .188 151.716);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--radius:4px;--sidebar:oklch(98.5% 0 0);--sidebar-foreground:oklch(14.5% 0 0);--sidebar-primary:oklch(20.5% 0 0);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(97% 0 0);--sidebar-accent-foreground:oklch(20.5% 0 0);--sidebar-border:oklch(92.2% 0 0);--sidebar-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_1kq9x_8[data-theme=dark]{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20.5% 0 0);--popover-foreground:oklch(98.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(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--accent-blue-light:oklch(25% .06 250);--destructive:oklch(70.4% .191 22.216);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(26.9% 0 0);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(100% 0 0/.1);--sidebar-ring:oklch(55.6% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 75%, transparent)}._root_1kq9x_8 h1,._root_1kq9x_8 h2,._root_1kq9x_8 h3,._root_1kq9x_8 h4,._root_1kq9x_8 h5,._root_1kq9x_8 h6{margin:0;font-weight:600}._textRed_1kq9x_97{color:var(--color-red)}._bgRed_1kq9x_100{background-color:var(--color-red)}._bgGreen_1kq9x_103{background-color:var(--color-green)}._textGreen_1kq9x_106{color:var(--color-green)}._mask_1kq9x_109{background-color:var(--overlay-bg)}._semibold_1kq9x_112{letter-spacing:.4px;font-weight:600}._bold_1kq9x_116{letter-spacing:.4px;font-weight:700}._system_1kq9x_120{color:var(--muted-foreground);background-color:var(--background);justify-content:center;align-items:center;display:flex;position:absolute;inset:0}._wrapper_1kq9x_129{width:100%;height:100%;min-height:480px;position:relative}._main_1kq9x_135{background-color:var(--background);grid-template-rows:auto 1fr;display:grid;position:absolute;inset:0;overflow:hidden}._grid_1kq9x_143{grid-template-columns:1fr auto;min-height:0;display:grid;position:relative;overflow:hidden}._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}._scGroup_ih963_1{margin-left:4px;display:flex}._scGroupSave_ih963_6{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._scGroupClose_ih963_12{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._header_1ff13_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}._headerTools_1ff13_11{gap:8px;display:flex}._headerHistory_1ff13_15{align-items:center;gap:8px;display:flex}._headerHistoryText_1ff13_20{color:var(--muted-foreground);font-size:14px}._resize_lyibl_1{background-color:var(--background);border-radius:4px;flex-direction:column;padding:16px;display:flex;position:absolute;bottom:24px;left:50%;transform:translate(-50%);box-shadow:0 2px 8px #0000001a}._resizeText_lyibl_13{text-align:center;color:var(--muted-foreground);font-size:14px}._resizeBorder_lyibl_18{border-bottom:1px solid var(--border);width:60px;margin:12px auto 4px;display:inline-block}._resizeTools_lyibl_24{align-items:center;gap:6px;margin-top:16px;display:flex}._resizeToolsLock_lyibl_30{width:12px;height:12px;color:var(--muted-foreground)}._resizeToolsButtons_lyibl_35{margin-left:4px;display:flex}._resizeToolsSave_lyibl_39{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._resizeToolsClose_lyibl_44{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._cropImage_1m63v_1{width:100%;height:100%;position:absolute;inset:0}._cropBox_1m63v_7{cursor:move;position:absolute}._cropTools_1m63v_11{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}._cropToolsInfo_1m63v_27{min-width:54px;margin-top:-2px;display:inline-block}._cropToolsInfoLabel_1m63v_32{color:var(--muted-foreground);font-size:12px;line-height:12px}._cropToolsInfoValue_1m63v_37{font-size:14px;line-height:14px}._cropBorder_1m63v_41{background-color:var(--accent-blue);position:absolute}._cropBorderTop_1m63v_45{cursor:ns-resize;width:100%;height:2px;top:0;left:0}._cropBorderRight_1m63v_52{cursor:ew-resize;width:2px;height:100%;top:0;right:0}._cropBorderBottom_1m63v_59{cursor:ns-resize;width:100%;height:2px;bottom:0;left:0;transform:translateY(1px)}._cropBorderLeft_1m63v_67{cursor:ew-resize;width:2px;height:100%;top:0;left:-1px;transform:translate(1px)}._cropLinesBox_1m63v_75{pointer-events:none;position:absolute;inset:2px}._cropLine_1m63v_75{border:1px dashed var(--color-white);opacity:.5;position:absolute}._cropLineVertical_1m63v_85{border-top:0;border-bottom:0;width:33%;height:100%;top:0;left:33%}._cropLineHorizontal_1m63v_93{border-left:0;border-right:0;width:100%;height:33%;top:33%;left:0}._cropPointer_1m63v_101{box-sizing:border-box;border:1px solid var(--accent-blue);background-color:var(--overlay-bg-white);border-radius:50%;width:12px;height:12px;position:absolute}._cropPointerTopLeft_1m63v_110{cursor:nwse-resize;top:-5px;left:-5px}._cropPointerTop_1m63v_110{cursor:ns-resize;top:-5px;left:50%;transform:translate(-50%)}._cropPointerTopRight_1m63v_121{cursor:nesw-resize;top:-5px;right:-5px}._cropPointerRight_1m63v_126{cursor:ew-resize;top:50%;right:-5px;transform:translateY(-50%)}._cropPointerBottomRight_1m63v_132{cursor:nwse-resize;bottom:-5px;right:-5px}._cropPointerBottom_1m63v_132{cursor:ns-resize;bottom:-5px;left:50%;transform:translate(-50%)}._cropPointerBottomLeft_1m63v_143{cursor:nesw-resize;bottom:-5px;left:-5px}._cropPointerLeft_1m63v_148{cursor:ew-resize;top:50%;left:-5px;transform:translateY(-50%)}._cropMobileBorder_1m63v_154{box-sizing:border-box;border:2px solid var(--accent-blue);position:absolute;inset:0}._cropMobilePointer_1m63v_160{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_70quv_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}._flipBtnH_70quv_14{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._flipBtnV_70quv_20{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._frame_ihor9_1{box-sizing:border-box;justify-content:center;align-items:center;width:100%;height:100%;min-height:0;padding:16px;display:flex;position:relative;overflow:hidden}._framePreview_ihor9_13{-webkit-user-select:none;user-select:none;flex-shrink:1;width:auto;min-width:0;max-width:100%;height:auto;min-height:0;max-height:100%;display:block;position:relative}._frameImage_ihor9_25{object-fit:contain;width:100%;height:100%}._frameImageFaded_ihor9_30{opacity:.4}._sidebar_1obd8_1{z-index:10;width:0;transition:transform .15s ease-out;position:relative}@media (width>=768px){._sidebar_1obd8_1{width:320px;transition:none}}._sidebarSettings_1obd8_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){._sidebarSettings_1obd8_11{display:none}}._sidebarContainer_1obd8_25{box-sizing:border-box;border-left:1px solid var(--border);position:absolute;inset:0}._sidebarContent_1obd8_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){._sidebarContent_1obd8_31{padding-top:48px}}._sidebarCloseBtn_1obd8_47{position:absolute;top:8px;right:8px}._sidebarSeparator_1obd8_52{margin-top:20px;margin-bottom:12px}._sidebarResize_1obd8_56{justify-content:space-between;align-items:center;display:flex}._sidebarResizeIcon_1obd8_61{align-items:center;gap:8px;display:flex}._sidebarResizeSize_1obd8_66{color:var(--muted-foreground);font-size:14px}._sidebarCrop_1obd8_70{flex-direction:column;gap:8px;display:flex}._sidebarCropRatios_1obd8_75{grid-template-columns:repeat(3,1fr);gap:8px;display:grid}._sidebarPreset_1obd8_80{flex-direction:column;gap:8px;display:flex}/*$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
- import { flushSync as l } from "react-dom";
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, useContext as n, useEffect as r, useLayoutEffect as i, useMemo as a, useRef as o, useState as s } from "react";
4
3
  //#region \0rolldown/runtime.js
5
- var u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), d = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
4
+ var c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), l = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
6
5
  if (typeof require < "u") return require.apply(this, arguments);
7
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.");
8
- }), f = /* @__PURE__ */ u(((e) => {
7
+ }), u = {
8
+ quality: .85,
9
+ saveAsWEBP: !1,
10
+ exportAs: "blob"
11
+ }, d = (e, t, n, r, i, a, o) => ({
12
+ history: {
13
+ pointer: 0,
14
+ items: [{
15
+ width: t,
16
+ height: n,
17
+ action: {
18
+ name: "initial",
19
+ args: null
20
+ }
21
+ }]
22
+ },
23
+ currentAction: null,
24
+ previewUrl: i,
25
+ originalBlob: r,
26
+ mimeType: e,
27
+ sidebar: !1,
28
+ settings: o,
29
+ isAlpha: a
30
+ }), f = e(void 0), p = /* @__PURE__ */ c(((e) => {
9
31
  var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
10
32
  function r(e, n, r) {
11
33
  var i = null;
@@ -20,19 +42,19 @@ var u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
20
42
  };
21
43
  }
22
44
  e.Fragment = n, e.jsx = r, e.jsxs = r;
23
- })), p = /* @__PURE__ */ u(((e) => {
45
+ })), m = /* @__PURE__ */ c(((e) => {
24
46
  process.env.NODE_ENV !== "production" && (function() {
25
47
  function t(e) {
26
48
  if (e == null) return null;
27
- if (typeof e == "function") return e.$$typeof === ee ? null : e.displayName || e.name || null;
49
+ if (typeof e == "function") return e.$$typeof === ne ? null : e.displayName || e.name || null;
28
50
  if (typeof e == "string") return e;
29
51
  switch (e) {
30
52
  case v: return "Fragment";
31
53
  case b: return "Profiler";
32
54
  case y: return "StrictMode";
33
55
  case w: return "Suspense";
34
- case T: return "SuspenseList";
35
- case O: return "Activity";
56
+ case ee: return "SuspenseList";
57
+ case te: return "Activity";
36
58
  }
37
59
  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) {
38
60
  case _: return "Portal";
@@ -41,8 +63,8 @@ var u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
41
63
  case C:
42
64
  var n = e.render;
43
65
  return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
44
- case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
45
- case D:
66
+ case T: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
67
+ case E:
46
68
  n = e._payload, e = e._init;
47
69
  try {
48
70
  return t(e(n));
@@ -68,7 +90,7 @@ var u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
68
90
  }
69
91
  function i(e) {
70
92
  if (e === v) return "<>";
71
- if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
93
+ if (typeof e == "object" && e && e.$$typeof === E) return "<...>";
72
94
  try {
73
95
  var n = t(e);
74
96
  return n ? "<" + n + ">" : "<...>";
@@ -77,14 +99,14 @@ var u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
77
99
  }
78
100
  }
79
101
  function a() {
80
- var e = k.A;
102
+ var e = D.A;
81
103
  return e === null ? null : e.getOwner();
82
104
  }
83
105
  function o() {
84
106
  return Error("react-stack-top-frame");
85
107
  }
86
108
  function s(e) {
87
- if (A.call(e, "key")) {
109
+ if (re.call(e, "key")) {
88
110
  var t = Object.getOwnPropertyDescriptor(e, "key").get;
89
111
  if (t && t.isReactWarning) return !1;
90
112
  }
@@ -92,18 +114,18 @@ var u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
92
114
  }
93
115
  function c(e, t) {
94
116
  function n() {
95
- M || (M = !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));
117
+ ae || (ae = !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));
96
118
  }
97
119
  n.isReactWarning = !0, Object.defineProperty(e, "key", {
98
120
  get: n,
99
121
  configurable: !0
100
122
  });
101
123
  }
102
- function l() {
124
+ function u() {
103
125
  var e = t(this.type);
104
- return ne[e] || (ne[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;
126
+ return oe[e] || (oe[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;
105
127
  }
106
- function u(e, t, n, r, i, a) {
128
+ function d(e, t, n, r, i, a) {
107
129
  var o = n.ref;
108
130
  return e = {
109
131
  $$typeof: g,
@@ -116,7 +138,7 @@ var u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
116
138
  value: null
117
139
  }) : Object.defineProperty(e, "ref", {
118
140
  enumerable: !1,
119
- get: l
141
+ get: u
120
142
  }), e._store = {}, Object.defineProperty(e._store, "validated", {
121
143
  configurable: !1,
122
144
  enumerable: !1,
@@ -139,105 +161,56 @@ var u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
139
161
  value: a
140
162
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
141
163
  }
142
- function f(e, n, i, o, l, d) {
164
+ function f(e, n, i, o, l, u) {
143
165
  var f = n.children;
144
- if (f !== void 0) if (o) if (te(f)) {
166
+ if (f !== void 0) if (o) if (ie(f)) {
145
167
  for (o = 0; o < f.length; o++) p(f[o]);
146
168
  Object.freeze && Object.freeze(f);
147
169
  } 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.");
148
170
  else p(f);
149
- if (A.call(n, "key")) {
171
+ if (re.call(n, "key")) {
150
172
  f = t(e);
151
173
  var m = Object.keys(n).filter(function(e) {
152
174
  return e !== "key";
153
175
  });
154
- o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", ae[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), ae[f + o] = !0);
176
+ o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", k[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), k[f + o] = !0);
155
177
  }
156
178
  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]);
157
179
  else i = n;
158
- return f && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), u(e, f, i, a(), l, d);
180
+ return f && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, i, a(), l, u);
159
181
  }
160
182
  function p(e) {
161
- m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
183
+ m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === E && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
162
184
  }
163
185
  function m(e) {
164
186
  return typeof e == "object" && !!e && e.$$typeof === g;
165
187
  }
166
- var h = d("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"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), ee = Symbol.for("react.client.reference"), k = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, te = Array.isArray, j = console.createTask ? console.createTask : function() {
188
+ var h = l("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"), w = Symbol.for("react.suspense"), ee = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), te = Symbol.for("react.activity"), ne = Symbol.for("react.client.reference"), D = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, re = Object.prototype.hasOwnProperty, ie = Array.isArray, O = console.createTask ? console.createTask : function() {
167
189
  return null;
168
190
  };
169
191
  h = { react_stack_bottom_frame: function(e) {
170
192
  return e();
171
193
  } };
172
- var M, ne = {}, re = h.react_stack_bottom_frame.bind(h, o)(), ie = j(i(o)), ae = {};
194
+ var ae, oe = {}, se = h.react_stack_bottom_frame.bind(h, o)(), ce = O(i(o)), k = {};
173
195
  e.Fragment = v, e.jsx = function(e, t, n) {
174
- var r = 1e4 > k.recentlyCreatedOwnerStacks++;
175
- return f(e, t, n, !1, r ? Error("react-stack-top-frame") : re, r ? j(i(e)) : ie);
196
+ var r = 1e4 > D.recentlyCreatedOwnerStacks++;
197
+ return f(e, t, n, !1, r ? Error("react-stack-top-frame") : se, r ? O(i(e)) : ce);
176
198
  }, e.jsxs = function(e, t, n) {
177
- var r = 1e4 > k.recentlyCreatedOwnerStacks++;
178
- return f(e, t, n, !0, r ? Error("react-stack-top-frame") : re, r ? j(i(e)) : ie);
199
+ var r = 1e4 > D.recentlyCreatedOwnerStacks++;
200
+ return f(e, t, n, !0, r ? Error("react-stack-top-frame") : se, r ? O(i(e)) : ce);
179
201
  };
180
202
  })();
181
- })), m = (/* @__PURE__ */ u(((e, t) => {
182
- process.env.NODE_ENV === "production" ? t.exports = f() : t.exports = p();
183
- })))();
184
- function h({ size: e = 36, className: t, style: n, color: r = "currentColor" }) {
185
- return /* @__PURE__ */ (0, m.jsxs)("svg", {
186
- xmlns: "http://www.w3.org/2000/svg",
187
- x: "0px",
188
- y: "0px",
189
- viewBox: "0 0 80 80",
190
- width: e,
191
- height: e,
192
- fill: r,
193
- className: t,
194
- style: n,
195
- children: [/* @__PURE__ */ (0, m.jsx)("path", {
196
- d: "M10,40c0,0,0-0.4,0-1.1c0-0.3,0-0.8,0-1.3c0-0.3,0-0.5,0-0.8c0-0.3,0.1-0.6,0.1-0.9c0.1-0.6,0.1-1.4,0.2-2.1\n c0.2-0.8,0.3-1.6,0.5-2.5c0.2-0.9,0.6-1.8,0.8-2.8c0.3-1,0.8-1.9,1.2-3c0.5-1,1.1-2,1.7-3.1c0.7-1,1.4-2.1,2.2-3.1\n c1.6-2.1,3.7-3.9,6-5.6c2.3-1.7,5-3,7.9-4.1c0.7-0.2,1.5-0.4,2.2-0.7c0.7-0.3,1.5-0.3,2.3-0.5c0.8-0.2,1.5-0.3,2.3-0.4l1.2-0.1\n l0.6-0.1l0.3,0l0.1,0l0.1,0l0,0c0.1,0-0.1,0,0.1,0c1.5,0,2.9-0.1,4.5,0.2c0.8,0.1,1.6,0.1,2.4,0.3c0.8,0.2,1.5,0.3,2.3,0.5\n c3,0.8,5.9,2,8.5,3.6c2.6,1.6,4.9,3.4,6.8,5.4c1,1,1.8,2.1,2.7,3.1c0.8,1.1,1.5,2.1,2.1,3.2c0.6,1.1,1.2,2.1,1.6,3.1\n c0.4,1,0.9,2,1.2,3c0.3,1,0.6,1.9,0.8,2.7c0.2,0.9,0.3,1.6,0.5,2.4c0.1,0.4,0.1,0.7,0.2,1c0,0.3,0.1,0.6,0.1,0.9\n c0.1,0.6,0.1,1,0.1,1.4C74,39.6,74,40,74,40c0.2,2.2-1.5,4.1-3.7,4.3s-4.1-1.5-4.3-3.7c0-0.1,0-0.2,0-0.3l0-0.4c0,0,0-0.3,0-0.9\n c0-0.3,0-0.7,0-1.1c0-0.2,0-0.5,0-0.7c0-0.2-0.1-0.5-0.1-0.8c-0.1-0.6-0.1-1.2-0.2-1.9c-0.1-0.7-0.3-1.4-0.4-2.2\n c-0.2-0.8-0.5-1.6-0.7-2.4c-0.3-0.8-0.7-1.7-1.1-2.6c-0.5-0.9-0.9-1.8-1.5-2.7c-0.6-0.9-1.2-1.8-1.9-2.7c-1.4-1.8-3.2-3.4-5.2-4.9\n c-2-1.5-4.4-2.7-6.9-3.6c-0.6-0.2-1.3-0.4-1.9-0.6c-0.7-0.2-1.3-0.3-1.9-0.4c-1.2-0.3-2.8-0.4-4.2-0.5l-2,0c-0.7,0-1.4,0.1-2.1,0.1\n c-0.7,0.1-1.4,0.1-2,0.3c-0.7,0.1-1.3,0.3-2,0.4c-2.6,0.7-5.2,1.7-7.5,3.1c-2.2,1.4-4.3,2.9-6,4.7c-0.9,0.8-1.6,1.8-2.4,2.7\n c-0.7,0.9-1.3,1.9-1.9,2.8c-0.5,1-1,1.9-1.4,2.8c-0.4,0.9-0.8,1.8-1,2.6c-0.3,0.9-0.5,1.6-0.7,2.4c-0.2,0.7-0.3,1.4-0.4,2.1\n c-0.1,0.3-0.1,0.6-0.2,0.9c0,0.3-0.1,0.6-0.1,0.8c0,0.5-0.1,0.9-0.1,1.3C10,39.6,10,40,10,40z",
197
- children: /* @__PURE__ */ (0, m.jsx)("animateTransform", {
198
- attributeType: "xml",
199
- attributeName: "transform",
200
- type: "rotate",
201
- from: "0 40 40",
202
- to: "360 40 40",
203
- dur: "0.8s",
204
- repeatCount: "indefinite"
205
- })
206
- }), /* @__PURE__ */ (0, m.jsx)("path", {
207
- fill: "currentColor",
208
- d: "M62,40.1c0,0,0,0.2-0.1,0.7c0,0.2,0,0.5-0.1,0.8c0,0.2,0,0.3,0,0.5c0,0.2-0.1,0.4-0.1,0.7\n c-0.1,0.5-0.2,1-0.3,1.6c-0.2,0.5-0.3,1.1-0.5,1.8c-0.2,0.6-0.5,1.3-0.7,1.9c-0.3,0.7-0.7,1.3-1,2.1c-0.4,0.7-0.9,1.4-1.4,2.1\n c-0.5,0.7-1.1,1.4-1.7,2c-1.2,1.3-2.7,2.5-4.4,3.6c-1.7,1-3.6,1.8-5.5,2.4c-2,0.5-4,0.7-6.2,0.7c-1.9-0.1-4.1-0.4-6-1.1\n c-1.9-0.7-3.7-1.5-5.2-2.6c-1.5-1.1-2.9-2.3-4-3.7c-0.6-0.6-1-1.4-1.5-2c-0.4-0.7-0.8-1.4-1.2-2c-0.3-0.7-0.6-1.3-0.8-2\n c-0.2-0.6-0.4-1.2-0.6-1.8c-0.1-0.6-0.3-1.1-0.4-1.6c-0.1-0.5-0.1-1-0.2-1.4c-0.1-0.9-0.1-1.5-0.1-2c0-0.5,0-0.7,0-0.7\n s0,0.2,0.1,0.7c0.1,0.5,0,1.1,0.2,2c0.1,0.4,0.2,0.9,0.3,1.4c0.1,0.5,0.3,1,0.5,1.6c0.2,0.6,0.4,1.1,0.7,1.8\n c0.3,0.6,0.6,1.2,0.9,1.9c0.4,0.6,0.8,1.3,1.2,1.9c0.5,0.6,1,1.3,1.6,1.8c1.1,1.2,2.5,2.3,4,3.2c1.5,0.9,3.2,1.6,5,2.1\n c1.8,0.5,3.6,0.6,5.6,0.6c1.8-0.1,3.7-0.4,5.4-1c1.7-0.6,3.3-1.4,4.7-2.4c1.4-1,2.6-2.1,3.6-3.3c0.5-0.6,0.9-1.2,1.3-1.8\n c0.4-0.6,0.7-1.2,1-1.8c0.3-0.6,0.6-1.2,0.8-1.8c0.2-0.6,0.4-1.1,0.5-1.7c0.1-0.5,0.2-1,0.3-1.5c0.1-0.4,0.1-0.8,0.1-1.2\n c0-0.2,0-0.4,0.1-0.5c0-0.2,0-0.4,0-0.5c0-0.3,0-0.6,0-0.8c0-0.5,0-0.7,0-0.7c0-1.1,0.9-2,2-2s2,0.9,2,2C62,40,62,40.1,62,40.1z",
209
- children: /* @__PURE__ */ (0, m.jsx)("animateTransform", {
210
- attributeType: "xml",
211
- attributeName: "transform",
212
- type: "rotate",
213
- from: "0 40 40",
214
- to: "-360 40 40",
215
- dur: "0.6s",
216
- repeatCount: "indefinite"
217
- })
218
- })]
219
- });
220
- }
221
- //#endregion
222
- //#region src/shared/components/ImageEditor/provider/initialState.ts
223
- var g = (e, t, n, r) => ({
224
- history: {
225
- pointer: 0,
226
- items: [{
227
- name: "Initial",
228
- base64: r,
229
- width: t,
230
- height: n
231
- }]
232
- },
233
- currentAction: null,
234
- extension: e,
235
- sidebar: !1
236
- }), _ = e(void 0), v = ({ children: e, base64: t, width: n, height: r, ext: i }) => {
237
- let [a, o] = c(g(i, n, r, t)), s = () => a.currentAction, l = (e) => o((t) => ({
203
+ })), h = (/* @__PURE__ */ c(((e, t) => {
204
+ process.env.NODE_ENV === "production" ? t.exports = p() : t.exports = m();
205
+ })))(), g = ({ children: e, mimeType: t, width: n, height: i, originalBlob: c, previewUrl: l, isAlpha: u, settings: p }) => {
206
+ let [m, g] = s(d(t, n, i, c, l, u, p)), _ = o(null);
207
+ r(() => () => {
208
+ _.current &&= (URL.revokeObjectURL(_.current), null);
209
+ }, []);
210
+ let v = (e) => g((t) => ({
238
211
  ...t,
239
212
  currentAction: e
240
- })), u = (e) => o((t) => {
213
+ })), y = (e) => g((t) => {
241
214
  let n = t.history.pointer + 1, r = [...t.history.items.slice(0, n), e];
242
215
  return {
243
216
  ...t,
@@ -247,204 +220,145 @@ var g = (e, t, n, r) => ({
247
220
  pointer: n
248
221
  }
249
222
  };
250
- }), d = () => a.history.items.at(a.history.pointer), f = () => o((e) => ({
251
- ...e,
252
- history: g(i, n, r, t).history
253
- })), p = () => o((e) => {
254
- let t = e.history.items.at(e.history.pointer);
255
- return {
256
- ...e,
257
- history: {
258
- items: [t],
259
- pointer: 0
223
+ }), b = () => {
224
+ let { items: e, pointer: t } = m.history;
225
+ return e.at(t) ?? e.at(0) ?? {
226
+ width: 0,
227
+ height: 0,
228
+ action: {
229
+ name: "initial",
230
+ args: null
260
231
  }
261
232
  };
262
- }), h = () => o((e) => e.history.pointer <= 0 ? e : {
233
+ }, x = () => {
234
+ let { items: e, pointer: t } = m.history;
235
+ if (e.length === 0 || t < 0) return 0;
236
+ let n = e.slice(0, t + 1).findLast((e) => e.action.name === "rotate");
237
+ return n?.action.name === "rotate" ? n.action.args.degrees : 0;
238
+ }, S = () => g((e) => ({
239
+ ...e,
240
+ history: {
241
+ items: [e.history.items[0]],
242
+ pointer: 0
243
+ }
244
+ })), C = () => g((e) => e.history.pointer <= 0 ? e : {
263
245
  ...e,
264
246
  history: {
265
247
  ...e.history,
266
248
  pointer: e.history.pointer - 1
267
249
  }
268
- }), v = () => o((e) => e.history.pointer >= e.history.items.length - 1 ? e : {
250
+ }), w = () => g((e) => e.history.pointer >= e.history.items.length - 1 ? e : {
269
251
  ...e,
270
252
  history: {
271
253
  ...e.history,
272
254
  pointer: e.history.pointer + 1
273
255
  }
274
- }), y = () => a.sidebar, b = (e) => o((t) => ({
256
+ }), ee = (e) => g((t) => ({
275
257
  ...t,
276
258
  sidebar: e
277
- }));
278
- return /* @__PURE__ */ (0, m.jsx)(_, {
259
+ })), T = a(() => new EventTarget(), []), E = (e) => {
260
+ _.current && URL.revokeObjectURL(_.current), _.current = URL.createObjectURL(e.previewBlob), g(d(e.mimeType, e.width, e.height, e.newBlob, _.current, e.isAlpha, p));
261
+ };
262
+ return /* @__PURE__ */ (0, h.jsx)(f, {
279
263
  value: {
280
- ...a,
281
- getCurrentAction: s,
282
- setCurrentAction: l,
283
- addToHistory: u,
284
- resetHistory: f,
285
- resetHistoryAfterSave: p,
286
- undo: h,
287
- redo: v,
288
- getLastHistoryItem: d,
289
- getSidebar: y,
290
- setSidebar: b
264
+ ...m,
265
+ setImage: E,
266
+ setCurrentAction: v,
267
+ getLastHistoryItem: b,
268
+ getLastRotation: x,
269
+ addToHistory: y,
270
+ resetHistory: S,
271
+ undo: C,
272
+ redo: w,
273
+ setSidebar: ee,
274
+ eventBus: T
291
275
  },
292
276
  children: e
293
277
  });
294
- }, y = {
295
- "image/jpeg": "jpg",
296
- "image/jpg": "jpg",
297
- "image/png": "png",
298
- "image/gif": "gif",
299
- "image/webp": "webp"
300
- }, b = (e) => {
301
- let [t, n] = c({
278
+ }, _ = "(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.`})}}})();", v = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", _], { type: "text/javascript;charset=utf-8" });
279
+ function y(e) {
280
+ let t;
281
+ try {
282
+ if (t = v && (self.URL || self.webkitURL).createObjectURL(v), !t) throw "";
283
+ let n = new Worker(t, { name: e?.name });
284
+ return n.addEventListener("error", () => {
285
+ (self.URL || self.webkitURL).revokeObjectURL(t);
286
+ }), n;
287
+ } catch {
288
+ return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(_), { name: e?.name });
289
+ }
290
+ }
291
+ //#endregion
292
+ //#region src/shared/components/Pixedi/hooks/useImageLoader.tsx
293
+ var b = (e) => {
294
+ let [t, n] = s({
302
295
  loading: !0,
303
- error: null,
296
+ error: "",
304
297
  width: 0,
305
298
  height: 0,
306
- extension: null,
307
- base64: null
308
- });
309
- return i(() => {
310
- let t = !0;
311
- return (async () => {
312
- try {
313
- let r = await fetch(e);
314
- if (!r.ok) throw Error(`HTTP error! Status: ${r.status}`);
315
- let i = (r.headers.get("content-type") || "").split(";")[0].toLowerCase().trim(), a = i.startsWith("image/"), o = y[i] || "unknown";
316
- if (!a) {
317
- t && n((e) => ({
318
- ...e,
319
- loading: !1,
320
- error: "The requested resource is not a valid image.",
321
- extension: o
322
- }));
323
- return;
324
- }
325
- let s = await r.blob(), c = await new Promise((e, t) => {
326
- let n = new FileReader();
327
- n.onloadend = () => e(n.result), n.onerror = () => t(/* @__PURE__ */ Error("Failed to read image data stream")), n.readAsDataURL(s);
328
- }), l = await new Promise((e, t) => {
329
- let n = new Image();
330
- n.src = c, n.onload = () => e({
331
- width: n.naturalWidth,
332
- height: n.naturalHeight
333
- }), n.onerror = () => t(/* @__PURE__ */ Error("Failed to parse image dimensions"));
334
- });
335
- t && n({
336
- loading: !1,
337
- error: null,
338
- width: l.width,
339
- height: l.height,
340
- extension: o,
341
- base64: c
342
- });
343
- } catch (e) {
344
- t && n((t) => ({
345
- ...t,
346
- loading: !1,
347
- error: e instanceof Error ? e.message : "An error occurred during extraction."
348
- }));
349
- }
350
- })(), () => {
351
- t = !1;
299
+ mimeType: "",
300
+ originalBlob: null,
301
+ previewUrl: "",
302
+ isAlpha: !1
303
+ }), i = o(null);
304
+ return r(() => {
305
+ if (!e) return;
306
+ let t = new y();
307
+ return t.postMessage(e), t.onmessage = (e) => {
308
+ let t = e.data;
309
+ t.success ? (i.current && URL.revokeObjectURL(i.current), i.current = URL.createObjectURL(t.previewBlob), n({
310
+ loading: !1,
311
+ error: "",
312
+ mimeType: t.mimeType,
313
+ width: t.width,
314
+ height: t.height,
315
+ originalBlob: t.originalBlob,
316
+ previewUrl: i.current,
317
+ isAlpha: t.isAlpha
318
+ })) : n((e) => ({
319
+ ...e,
320
+ loading: !1,
321
+ error: t.error || "Error processing image."
322
+ }));
323
+ }, () => {
324
+ t.terminate(), i.current &&= (URL.revokeObjectURL(i.current), null);
352
325
  };
353
326
  }, [e]), t;
354
327
  }, x = () => {
355
- let e = s(null), t = n((e) => {
356
- let t = e.match(/^data:(image\/[a-zA-Z+.-]+);base64,(.+)$/);
357
- if (!t) throw Error("Invalid Base64 image format");
358
- let n = t[1], r = t[2];
359
- return n === "image/gif" && (n = "image/png"), {
360
- mimeType: n,
361
- rawData: r
362
- };
363
- }, []), r = n(async (e) => {
364
- let { mimeType: n, rawData: r } = t(e), i = atob(r), a = new Uint8Array(i.length);
365
- for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
366
- let o = new Blob([a], { type: n });
367
- return {
368
- bitmap: await createImageBitmap(o),
369
- mimeType: n
370
- };
371
- }, [t]), i = n((t) => {
372
- e.current ||= document.createElement("canvas");
373
- let n = e.current, r = t === "image/png" || t === "image/webp";
374
- return {
375
- canvas: n,
376
- ctx: n.getContext("2d", { alpha: r })
377
- };
378
- }, []), a = n((e, t) => t === "image/jpeg" || t === "image/webp" ? e.toDataURL(t, .85) : e.toDataURL(t), []);
379
- return {
380
- resize: n(async (e, t, n) => {
381
- let { bitmap: o, mimeType: s } = await r(e), { canvas: c, ctx: l } = i(s);
382
- return c.width = t, c.height = n, l && (l.clearRect(0, 0, t, n), l.drawImage(o, 0, 0, t, n)), o.close(), a(c, s);
383
- }, [
384
- r,
385
- i,
386
- a
387
- ]),
388
- crop: n(async (e, t, n, o, s) => {
389
- let { bitmap: c, mimeType: l } = await r(e), { canvas: u, ctx: d } = i(l);
390
- return u.width = o, u.height = s, d && (d.clearRect(0, 0, o, s), d.drawImage(c, t, n, o, s, 0, 0, o, s)), c.close(), a(u, l);
391
- }, [
392
- r,
393
- i,
394
- a
395
- ]),
396
- flip: n(async (e, t, n) => {
397
- let { bitmap: o, mimeType: s } = await r(e), { canvas: c, ctx: l } = i(s);
398
- return c.width = o.width, c.height = o.height, l && (l.clearRect(0, 0, c.width, c.height), l.save(), l.translate(t ? o.width : 0, n ? o.height : 0), l.scale(t ? -1 : 1, n ? -1 : 1), l.drawImage(o, 0, 0), l.restore()), o.close(), a(c, s);
399
- }, [
400
- r,
401
- i,
402
- a
403
- ]),
404
- rotate: n(async (e, t) => {
405
- let { bitmap: n, mimeType: o } = await r(e), { canvas: s, ctx: c } = i(o);
406
- return s.width = n.width, s.height = n.height, c && (c.clearRect(0, 0, s.width, s.height), c.save(), c.translate(n.width / 2, n.height / 2), c.rotate(t * Math.PI / 180), c.drawImage(n, -n.width / 2, -n.height / 2), c.restore()), n.close(), a(s, o);
407
- }, [
408
- r,
409
- i,
410
- a
411
- ]),
412
- filter: n(async (e, t) => {
413
- let { bitmap: n, mimeType: o } = await r(e), { canvas: s, ctx: c } = i(o);
414
- return s.width = n.width, s.height = n.height, c && (c.filter = Object.entries(t).map(([e, t]) => `${e}(${t}%)`).join(" "), c.drawImage(n, 0, 0)), n.close(), a(s, o);
415
- }, [
416
- r,
417
- i,
418
- a
419
- ])
420
- };
421
- }, S = () => {
422
328
  if (typeof window > "u" || !window.navigator) return null;
423
329
  let e = window.navigator.userAgent.toLowerCase();
424
330
  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;
425
- }, C = () => {
426
- let [e] = c(() => S());
331
+ }, S = () => {
332
+ let [e] = s(() => x());
427
333
  return e;
428
- }, w = {
334
+ }, C = {
429
335
  sm: 640,
430
336
  md: 768,
431
337
  lg: 1024,
432
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"
433
347
  };
434
348
  //#endregion
435
- //#region src/shared/components/ImageEditor/hooks/useBellow.tsx
436
- function T(e) {
437
- let [t, n] = c(() => window.innerWidth < w[e]);
438
- return i(() => {
349
+ //#region src/shared/components/Pixedi/hooks/useBellow.tsx
350
+ function ee(e) {
351
+ let [t, n] = s(() => window.innerWidth < C[e]);
352
+ return r(() => {
439
353
  function t() {
440
- n(window.innerWidth < w[e]);
354
+ n(window.innerWidth < C[e]);
441
355
  }
442
356
  return window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
443
357
  }, [e]), t;
444
358
  }
445
359
  //#endregion
446
- //#region src/shared/components/ImageEditor/assets/icons.tsx
447
- var E = {
360
+ //#region src/shared/components/Pixedi/assets/icons.tsx
361
+ var T = {
448
362
  xmlns: "http://w3.org",
449
363
  width: "24",
450
364
  height: "24",
@@ -454,58 +368,58 @@ var E = {
454
368
  strokeWidth: "2",
455
369
  strokeLinecap: "round",
456
370
  strokeLinejoin: "round"
457
- }, D = (e) => /* @__PURE__ */ (0, m.jsx)("svg", {
458
- ...E,
371
+ }, E = (e) => /* @__PURE__ */ (0, h.jsx)("svg", {
372
+ ...T,
459
373
  ...e,
460
- children: /* @__PURE__ */ (0, m.jsx)("path", { d: "M20 6 9 17l-5-5" })
461
- }), O = (e) => /* @__PURE__ */ (0, m.jsxs)("svg", {
462
- ...E,
374
+ children: /* @__PURE__ */ (0, h.jsx)("path", { d: "M20 6 9 17l-5-5" })
375
+ }), te = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
376
+ ...T,
463
377
  ...e,
464
- children: [/* @__PURE__ */ (0, m.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, m.jsx)("path", { d: "m6 6 12 12" })]
465
- }), ee = (e) => /* @__PURE__ */ (0, m.jsxs)("svg", {
466
- ...E,
378
+ children: [/* @__PURE__ */ (0, h.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, h.jsx)("path", { d: "m6 6 12 12" })]
379
+ }), ne = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
380
+ ...T,
467
381
  ...e,
468
- children: [/* @__PURE__ */ (0, m.jsx)("rect", {
382
+ children: [/* @__PURE__ */ (0, h.jsx)("rect", {
469
383
  width: "18",
470
384
  height: "11",
471
385
  x: "3",
472
386
  y: "11",
473
387
  rx: "2",
474
388
  ry: "2"
475
- }), /* @__PURE__ */ (0, m.jsx)("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })]
476
- }), k = (e) => /* @__PURE__ */ (0, m.jsxs)("svg", {
477
- ...E,
389
+ }), /* @__PURE__ */ (0, h.jsx)("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })]
390
+ }), D = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
391
+ ...T,
478
392
  ...e,
479
- children: [/* @__PURE__ */ (0, m.jsx)("path", { d: "m12 19-7-7 7-7" }), /* @__PURE__ */ (0, m.jsx)("path", { d: "M19 12H5" })]
480
- }), A = (e) => /* @__PURE__ */ (0, m.jsx)("svg", {
481
- ...E,
393
+ children: [/* @__PURE__ */ (0, h.jsx)("path", { d: "m12 19-7-7 7-7" }), /* @__PURE__ */ (0, h.jsx)("path", { d: "M19 12H5" })]
394
+ }), re = (e) => /* @__PURE__ */ (0, h.jsx)("svg", {
395
+ ...T,
482
396
  ...e,
483
- children: /* @__PURE__ */ (0, m.jsx)("path", { d: "m6 9 6 6 6-6" })
484
- }), te = (e) => /* @__PURE__ */ (0, m.jsxs)("svg", {
485
- ...E,
397
+ children: /* @__PURE__ */ (0, h.jsx)("path", { d: "m6 9 6 6 6-6" })
398
+ }), ie = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
399
+ ...T,
486
400
  ...e,
487
- children: [/* @__PURE__ */ (0, m.jsx)("path", { d: "M3 7v6h6" }), /* @__PURE__ */ (0, m.jsx)("path", { d: "M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13" })]
488
- }), j = (e) => /* @__PURE__ */ (0, m.jsxs)("svg", {
489
- ...E,
401
+ children: [/* @__PURE__ */ (0, h.jsx)("path", { d: "M3 7v6h6" }), /* @__PURE__ */ (0, h.jsx)("path", { d: "M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13" })]
402
+ }), O = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
403
+ ...T,
490
404
  ...e,
491
- children: [/* @__PURE__ */ (0, m.jsx)("path", { d: "M21 7v6h-6" }), /* @__PURE__ */ (0, m.jsx)("path", { d: "M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7" })]
492
- }), M = (e) => /* @__PURE__ */ (0, m.jsxs)("svg", {
493
- ...E,
405
+ children: [/* @__PURE__ */ (0, h.jsx)("path", { d: "M21 7v6h-6" }), /* @__PURE__ */ (0, h.jsx)("path", { d: "M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7" })]
406
+ }), ae = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
407
+ ...T,
494
408
  ...e,
495
- children: [/* @__PURE__ */ (0, m.jsx)("path", { d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" }), /* @__PURE__ */ (0, m.jsx)("circle", {
409
+ children: [/* @__PURE__ */ (0, h.jsx)("path", { d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" }), /* @__PURE__ */ (0, h.jsx)("circle", {
496
410
  cx: "12",
497
411
  cy: "12",
498
412
  r: "3"
499
413
  })]
500
- }), ne = (e) => /* @__PURE__ */ (0, m.jsxs)("svg", {
501
- ...E,
414
+ }), oe = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
415
+ ...T,
502
416
  ...e,
503
- children: [/* @__PURE__ */ (0, m.jsx)("path", { d: "M6 2v14a2 2 0 0 0 2 2h14" }), /* @__PURE__ */ (0, m.jsx)("path", { d: "M18 22V8a2 2 0 0 0-2-2H2" })]
504
- }), re = (e) => /* @__PURE__ */ (0, m.jsxs)("svg", {
505
- ...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,
506
420
  ...e,
507
421
  children: [
508
- /* @__PURE__ */ (0, m.jsx)("rect", {
422
+ /* @__PURE__ */ (0, h.jsx)("rect", {
509
423
  width: "18",
510
424
  height: "18",
511
425
  x: "3",
@@ -513,32 +427,32 @@ var E = {
513
427
  rx: "2",
514
428
  ry: "2"
515
429
  }),
516
- /* @__PURE__ */ (0, m.jsx)("circle", {
430
+ /* @__PURE__ */ (0, h.jsx)("circle", {
517
431
  cx: "9",
518
432
  cy: "9",
519
433
  r: "2"
520
434
  }),
521
- /* @__PURE__ */ (0, m.jsx)("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
435
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
522
436
  ]
523
- }), ie = (e) => /* @__PURE__ */ (0, m.jsx)("svg", {
524
- ...E,
437
+ }), ce = (e) => /* @__PURE__ */ (0, h.jsx)("svg", {
438
+ ...T,
525
439
  ...e,
526
- children: /* @__PURE__ */ (0, m.jsx)("rect", {
440
+ children: /* @__PURE__ */ (0, h.jsx)("rect", {
527
441
  width: "18",
528
442
  height: "18",
529
443
  x: "3",
530
444
  y: "3",
531
445
  rx: "2"
532
446
  })
533
- }), ae = (e) => /* @__PURE__ */ (0, m.jsxs)("svg", {
534
- ...E,
447
+ }), k = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
448
+ ...T,
535
449
  ...e,
536
450
  children: [
537
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M3 7V5a2 2 0 0 1 2-2h2" }),
538
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M17 3h2a2 2 0 0 1 2 2v2" }),
539
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M21 17v2a2 2 0 0 1-2 2h-2" }),
540
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M7 21H5a2 2 0 0 1-2-2v-2" }),
541
- /* @__PURE__ */ (0, m.jsx)("rect", {
451
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M3 7V5a2 2 0 0 1 2-2h2" }),
452
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M17 3h2a2 2 0 0 1 2 2v2" }),
453
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M21 17v2a2 2 0 0 1-2 2h-2" }),
454
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M7 21H5a2 2 0 0 1-2-2v-2" }),
455
+ /* @__PURE__ */ (0, h.jsx)("rect", {
542
456
  width: "10",
543
457
  height: "8",
544
458
  x: "7",
@@ -546,34 +460,42 @@ var E = {
546
460
  rx: "1"
547
461
  })
548
462
  ]
549
- }), oe = (e) => /* @__PURE__ */ (0, m.jsxs)("svg", {
550
- ...E,
463
+ }), le = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
464
+ ...T,
551
465
  ...e,
552
466
  children: [
553
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3" }),
554
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3" }),
555
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M12 20v2" }),
556
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M12 14v2" }),
557
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M12 8v2" }),
558
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M12 2v2" })
467
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3" }),
468
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3" }),
469
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M12 20v2" }),
470
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M12 14v2" }),
471
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M12 8v2" }),
472
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M12 2v2" })
559
473
  ]
560
- }), se = (e) => /* @__PURE__ */ (0, m.jsxs)("svg", {
561
- ...E,
474
+ }), ue = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
475
+ ...T,
562
476
  ...e,
563
477
  children: [
564
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3" }),
565
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3" }),
566
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M4 12H2" }),
567
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M10 12H8" }),
568
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M16 12h-2" }),
569
- /* @__PURE__ */ (0, m.jsx)("path", { d: "M22 12h-2" })
478
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3" }),
479
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3" }),
480
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M4 12H2" }),
481
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M10 12H8" }),
482
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M16 12h-2" }),
483
+ /* @__PURE__ */ (0, h.jsx)("path", { d: "M22 12h-2" })
570
484
  ]
571
- }), ce = (e) => /* @__PURE__ */ (0, m.jsx)("svg", {
572
- ...E,
485
+ }), de = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
486
+ ...T,
573
487
  ...e,
574
- children: /* @__PURE__ */ (0, m.jsx)("path", {
488
+ children: [/* @__PURE__ */ (0, h.jsx)("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }), /* @__PURE__ */ (0, h.jsx)("path", { d: "M21 3v5h-5" })]
489
+ }), fe = (e) => /* @__PURE__ */ (0, h.jsxs)("svg", {
490
+ ...T,
491
+ ...e,
492
+ children: [/* @__PURE__ */ (0, h.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, h.jsx)("path", { d: "M3 3v5h5" })]
493
+ }), A = (e) => /* @__PURE__ */ (0, h.jsx)("svg", {
494
+ ...T,
495
+ ...e,
496
+ children: /* @__PURE__ */ (0, h.jsx)("path", {
575
497
  d: "M21 12a9 9 0 1 1-6.219-8.56",
576
- children: /* @__PURE__ */ (0, m.jsx)("animateTransform", {
498
+ children: /* @__PURE__ */ (0, h.jsx)("animateTransform", {
577
499
  attributeType: "xml",
578
500
  attributeName: "transform",
579
501
  type: "rotate",
@@ -583,54 +505,54 @@ var E = {
583
505
  repeatCount: "indefinite"
584
506
  })
585
507
  })
586
- }), N = () => {
587
- let e = r(_);
588
- if (!e) throw Error("useImageEditorContext must be used within an ImageEditorProvider");
508
+ }), j = () => {
509
+ let e = n(f);
510
+ if (!e) throw Error("usePixediContext must be used within an PixediProvider");
589
511
  return e;
590
- }, P = {
512
+ }, M = {
591
513
  button: "_button_snd36_1",
592
514
  default: "_default_snd36_32",
593
515
  outline: "_outline_snd36_39",
594
516
  ghost: "_ghost_snd36_47",
595
517
  rect: "_rect_snd36_54"
596
- }, F = ({ className: e = "", variant: t = "default", children: n, ref: r, ...i }) => /* @__PURE__ */ (0, m.jsx)("button", {
518
+ }, N = ({ className: e = "", variant: t = "default", children: n, ref: r, ...i }) => /* @__PURE__ */ (0, h.jsx)("button", {
597
519
  ref: r,
598
- className: `${P.button} ${P[t]} ${e}`.trim(),
520
+ className: `${M.button} ${M[t]} ${e}`.trim(),
599
521
  ...i,
600
522
  children: n
601
- }), le = { button: "_button_gf7m5_1" }, I = {
602
- root: "_root_1kq9x_8",
603
- textRed: "_textRed_1kq9x_97",
604
- bgRed: "_bgRed_1kq9x_100",
605
- bgGreen: "_bgGreen_1kq9x_103",
606
- textGreen: "_textGreen_1kq9x_106",
607
- mask: "_mask_1kq9x_109",
608
- semibold: "_semibold_1kq9x_112",
609
- bold: "_bold_1kq9x_116",
610
- system: "_system_1kq9x_120",
611
- wrapper: "_wrapper_1kq9x_129",
612
- main: "_main_1kq9x_135",
613
- grid: "_grid_1kq9x_143"
614
- }, L = ({ className: e = "", active: t = !1, icon: n, label: r, ref: i, ...a }) => /* @__PURE__ */ (0, m.jsxs)("button", {
523
+ }), P = {
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", {
615
537
  ref: i,
616
538
  type: "button",
617
539
  "aria-pressed": t,
618
- className: `${le.button} ${e}`.trim(),
540
+ className: `${pe.button} ${e}`.trim(),
619
541
  ...a,
620
- children: [n, /* @__PURE__ */ (0, m.jsx)("span", {
621
- className: I.semibold,
542
+ children: [n, /* @__PURE__ */ (0, h.jsx)("span", {
543
+ className: P.semibold,
622
544
  children: r
623
545
  })]
624
- }), ue = { separator: "_separator_rqskq_1" }, R = t(({ className: e = "", orientation: t = "horizontal", ...n }, r) => /* @__PURE__ */ (0, m.jsx)("hr", {
546
+ }), he = { separator: "_separator_rqskq_1" }, F = t(({ className: e = "", orientation: t = "horizontal", ...n }, r) => /* @__PURE__ */ (0, h.jsx)("hr", {
625
547
  ref: r,
626
548
  role: "separator",
627
549
  "aria-orientation": t,
628
550
  "data-orientation": t,
629
- className: `${ue.separator} ${e}`.trim(),
551
+ className: `${he.separator} ${e}`.trim(),
630
552
  ...n
631
553
  }));
632
- R.displayName = "Separator";
633
- var z = {
554
+ F.displayName = "Separator";
555
+ var I = {
634
556
  wrapper: "_wrapper_12rgt_1",
635
557
  trigger: "_trigger_12rgt_6",
636
558
  triggerArrow: "_triggerArrow_12rgt_29",
@@ -642,355 +564,268 @@ var z = {
642
564
  itemRightContainer: "_itemRightContainer_12rgt_112",
643
565
  itemRight: "_itemRight_12rgt_112",
644
566
  itemCheck: "_itemCheck_12rgt_121"
645
- }, de = ({ items: e, value: t, onChange: n, placeholder: r = "Select an option", className: l = "", renderOption: u }) => {
646
- let [d, f] = c(!1), p = s(null), h = s(null), g = s(null), _ = o(() => {
567
+ }, ge = ({ items: e, value: t, onChange: n, placeholder: c = "Select an option", className: l = "", renderOption: u }) => {
568
+ let [d, f] = s(!1), p = o(null), m = o(null), g = o(null), _ = a(() => {
647
569
  let t = (e) => e.reduce((e, n) => n.options ? [...e, ...t(n.options.map((e) => ({
648
570
  ...e,
649
571
  fullName: `${n.label} ${e.label}`
650
572
  })))] : [...e, n], []);
651
573
  return t(e);
652
574
  }, [e]).find((e) => e.value === t);
653
- i(() => {
575
+ r(() => {
654
576
  let e = (e) => {
655
577
  p.current && !e.composedPath().includes(p.current) && f(!1);
656
578
  };
657
579
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
658
- }, []), a(() => {
659
- if (!d || !h.current || !g.current) return;
660
- let e = p.current?.closest(`.${I.main}`)?.getBoundingClientRect(), t = h.current.getBoundingClientRect(), n = g.current.getBoundingClientRect(), r = (e?.bottom ?? window.innerHeight) - 16, i = t.bottom + n.height + 4, a = "calc(100% + 4px)";
580
+ }, []), i(() => {
581
+ if (!d || !m.current || !g.current) return;
582
+ let e = p.current?.closest(`.${P.main}`)?.getBoundingClientRect(), t = m.current.getBoundingClientRect(), n = g.current.getBoundingClientRect(), r = (e?.bottom ?? window.innerHeight) - 16, i = t.bottom + n.height + 4, a = "calc(100% + 4px)";
661
583
  i > r && (a = `calc(100% + 4px - ${i - r}px)`), g.current.style.top = a;
662
584
  }, [d, e]);
663
585
  let v = (e) => {
664
586
  n(e), f(!1);
665
587
  };
666
- return /* @__PURE__ */ (0, m.jsxs)("div", {
588
+ return /* @__PURE__ */ (0, h.jsxs)("div", {
667
589
  ref: p,
668
- className: `${z.wrapper} ${l}`.trim(),
590
+ className: `${I.wrapper} ${l}`.trim(),
669
591
  "data-state": d ? "open" : "closed",
670
- children: [/* @__PURE__ */ (0, m.jsxs)("button", {
671
- ref: h,
592
+ children: [/* @__PURE__ */ (0, h.jsxs)("button", {
593
+ ref: m,
672
594
  type: "button",
673
- className: z.trigger,
595
+ className: I.trigger,
674
596
  onClick: () => f(!d),
675
- children: [/* @__PURE__ */ (0, m.jsx)("span", { children: _ ? _.fullName : r }), /* @__PURE__ */ (0, m.jsx)(A, { className: z.triggerArrow })]
676
- }), /* @__PURE__ */ (0, m.jsx)("div", {
597
+ children: [/* @__PURE__ */ (0, h.jsx)("span", { children: _ ? _.fullName : c }), /* @__PURE__ */ (0, h.jsx)(re, { className: I.triggerArrow })]
598
+ }), /* @__PURE__ */ (0, h.jsx)("div", {
677
599
  ref: g,
678
- className: z.content,
679
- children: e.map((e, n) => e.options ? /* @__PURE__ */ (0, m.jsxs)("div", { children: [/* @__PURE__ */ (0, m.jsx)("div", {
680
- className: `${z.groupLabel} ${I.semibold}`,
600
+ className: I.content,
601
+ children: e.map((e, n) => e.options ? /* @__PURE__ */ (0, h.jsxs)("div", { children: [/* @__PURE__ */ (0, h.jsx)("div", {
602
+ className: `${I.groupLabel} ${P.semibold}`,
681
603
  children: e.label
682
- }), e.options.map((e) => /* @__PURE__ */ (0, m.jsxs)("div", {
683
- className: z.item,
604
+ }), e.options.map((e) => /* @__PURE__ */ (0, h.jsxs)("div", {
605
+ className: I.item,
684
606
  onClick: () => v(e.value),
685
- children: [u ? u(e) : /* @__PURE__ */ (0, m.jsx)("span", {
686
- className: z.itemLeft,
607
+ children: [u ? u(e) : /* @__PURE__ */ (0, h.jsx)("span", {
608
+ className: I.itemLeft,
687
609
  children: e.label
688
- }), /* @__PURE__ */ (0, m.jsxs)("div", {
689
- className: z.itemAddon,
610
+ }), /* @__PURE__ */ (0, h.jsxs)("div", {
611
+ className: I.itemAddon,
690
612
  children: [
691
- e.rightLabel && /* @__PURE__ */ (0, m.jsx)("span", { children: e.rightLabel }),
692
- t === e.value && /* @__PURE__ */ (0, m.jsx)(D, { className: z.itemCheck }),
693
- t !== e.value && /* @__PURE__ */ (0, m.jsx)("b", {})
613
+ e.rightLabel && /* @__PURE__ */ (0, h.jsx)("span", { children: e.rightLabel }),
614
+ t === e.value && /* @__PURE__ */ (0, h.jsx)(E, { className: I.itemCheck }),
615
+ t !== e.value && /* @__PURE__ */ (0, h.jsx)("b", {})
694
616
  ]
695
617
  })]
696
- }, e.value))] }, `group-${n}`) : /* @__PURE__ */ (0, m.jsxs)("div", {
697
- className: z.item,
618
+ }, e.value))] }, `group-${n}`) : /* @__PURE__ */ (0, h.jsxs)("div", {
619
+ className: I.item,
698
620
  onClick: () => v(e.value),
699
- children: [u ? u(e) : /* @__PURE__ */ (0, m.jsx)("span", {
700
- className: z.itemLeft,
621
+ children: [u ? u(e) : /* @__PURE__ */ (0, h.jsx)("span", {
622
+ className: I.itemLeft,
701
623
  children: e.label
702
- }), t === e.value && /* @__PURE__ */ (0, m.jsx)(D, { className: z.itemCheck })]
624
+ }), t === e.value && /* @__PURE__ */ (0, h.jsx)(E, { className: I.itemCheck })]
703
625
  }, e.value))
704
626
  })]
705
627
  });
706
- }, fe = {
628
+ }, _e = {
707
629
  input: "_input_j55nq_1",
708
630
  numberClean: "_numberClean_j55nq_34"
709
- }, pe = ({ className: e = "", type: t = "text", hideArrows: n = !0, ref: r, ...i }) => {
710
- let a = t === "number" && n ? fe.numberClean : "";
711
- return /* @__PURE__ */ (0, m.jsx)("input", {
631
+ }, ve = ({ className: e = "", type: t = "text", hideArrows: n = !0, ref: r, ...i }) => {
632
+ let a = t === "number" && n ? _e.numberClean : "";
633
+ return /* @__PURE__ */ (0, h.jsx)("input", {
712
634
  ref: r,
713
635
  type: t,
714
- className: `${fe.input} ${a} ${e}`.trim(),
636
+ className: `${_e.input} ${a} ${e}`.trim(),
715
637
  ...i
716
638
  });
717
- }, B = {
639
+ }, ye = {
718
640
  container: "_container_14vsv_1",
719
641
  legend: "_legend_14vsv_4",
720
642
  suffix: "_suffix_14vsv_13"
721
- }, me = ({ label: e, className: t = "", style: n, ref: r, ...i }) => /* @__PURE__ */ (0, m.jsxs)("div", {
722
- className: `${B.container} ${t}`.trim(),
643
+ }, be = ({ label: e, className: t = "", style: n, ref: r, ...i }) => /* @__PURE__ */ (0, h.jsxs)("div", {
644
+ className: `${ye.container} ${t}`.trim(),
723
645
  style: n,
724
646
  children: [
725
- /* @__PURE__ */ (0, m.jsx)("span", {
726
- className: B.legend,
647
+ /* @__PURE__ */ (0, h.jsx)("span", {
648
+ className: ye.legend,
727
649
  children: e
728
650
  }),
729
- /* @__PURE__ */ (0, m.jsx)(pe, {
651
+ /* @__PURE__ */ (0, h.jsx)(ve, {
730
652
  ref: r,
731
653
  type: "number",
732
654
  ...i
733
655
  }),
734
- /* @__PURE__ */ (0, m.jsx)("span", {
735
- className: B.suffix,
656
+ /* @__PURE__ */ (0, h.jsx)("span", {
657
+ className: ye.suffix,
736
658
  children: "px"
737
659
  })
738
660
  ]
739
- }), V = {
740
- scGroup: "_scGroup_ih963_1",
741
- scGroupSave: "_scGroupSave_ih963_6",
742
- scGroupClose: "_scGroupClose_ih963_12"
743
- }, H = ({ onSave: e, onClose: t, saving: n = !1, disabled: r = !1 }) => /* @__PURE__ */ (0, m.jsxs)("div", {
744
- className: V.scGroup,
745
- children: [/* @__PURE__ */ (0, m.jsx)(F, {
661
+ }), xe = {
662
+ group: "_group_qpue1_1",
663
+ save: "_save_qpue1_6",
664
+ close: "_close_qpue1_13"
665
+ }, L = ({ onSave: e, onClose: t, saving: n = !1, disabled: r = !1 }) => /* @__PURE__ */ (0, h.jsxs)("div", {
666
+ className: xe.group,
667
+ children: [/* @__PURE__ */ (0, h.jsx)(N, {
746
668
  variant: "outline",
747
- className: `${V.scGroupSave} ${I.textGreen}`,
669
+ className: xe.save,
748
670
  disabled: r || n,
749
671
  onClick: e,
750
- children: n ? /* @__PURE__ */ (0, m.jsx)(ce, {}) : /* @__PURE__ */ (0, m.jsx)(D, {})
751
- }), /* @__PURE__ */ (0, m.jsx)(F, {
672
+ children: n ? /* @__PURE__ */ (0, h.jsx)(A, {}) : /* @__PURE__ */ (0, h.jsx)(E, {})
673
+ }), /* @__PURE__ */ (0, h.jsx)(N, {
752
674
  variant: "outline",
753
- className: `${V.scGroupClose} ${I.textRed}`,
675
+ className: xe.close,
754
676
  disabled: n,
755
677
  onClick: t,
756
- children: /* @__PURE__ */ (0, m.jsx)(O, {})
678
+ children: /* @__PURE__ */ (0, h.jsx)(te, {})
757
679
  })]
758
- }), U = {
759
- header: "_header_1ff13_1",
760
- headerTools: "_headerTools_1ff13_11",
761
- headerHistory: "_headerHistory_1ff13_15",
762
- headerHistoryText: "_headerHistoryText_1ff13_20"
763
- }, he = ({ onBack: e, onSave: t }) => {
764
- let [n, r] = c(!1), { history: i, undo: a, redo: o, resetHistory: s, resetHistoryAfterSave: l, getLastHistoryItem: u, setCurrentAction: d } = N(), { base64: f } = u(), p = i.items.length > 1 && !n, h = i.pointer === 0, g = i.pointer === i.items.length - 1, _ = i.items.length < 2 || n;
765
- return /* @__PURE__ */ (0, m.jsxs)("div", {
766
- className: U.header,
767
- children: [/* @__PURE__ */ (0, m.jsx)(F, {
768
- variant: "ghost",
769
- className: P.rect,
770
- onClick: e,
771
- children: /* @__PURE__ */ (0, m.jsx)(k, {})
772
- }), /* @__PURE__ */ (0, m.jsxs)("div", {
773
- className: U.headerTools,
774
- children: [
775
- p && /* @__PURE__ */ (0, m.jsxs)("div", {
776
- className: U.headerHistory,
777
- children: [
778
- /* @__PURE__ */ (0, m.jsx)(F, {
779
- variant: "outline",
780
- disabled: h,
781
- className: P.rect,
782
- onClick: a,
783
- children: /* @__PURE__ */ (0, m.jsx)(te, {})
784
- }),
785
- /* @__PURE__ */ (0, m.jsxs)("div", {
786
- className: U.headerHistoryText,
787
- children: [
788
- i.pointer + 1,
789
- "/",
790
- i.items.length
791
- ]
792
- }),
793
- /* @__PURE__ */ (0, m.jsx)(F, {
794
- variant: "outline",
795
- disabled: g,
796
- className: P.rect,
797
- onClick: o,
798
- children: /* @__PURE__ */ (0, m.jsx)(j, {})
799
- })
800
- ]
801
- }),
802
- /* @__PURE__ */ (0, m.jsx)(F, {
803
- variant: "outline",
804
- disabled: _,
805
- onClick: () => {
806
- d(null), s();
807
- },
808
- children: "Reset"
809
- }),
810
- /* @__PURE__ */ (0, m.jsxs)(F, {
811
- disabled: _,
812
- onClick: async () => {
813
- if (f) {
814
- r(!0);
815
- try {
816
- await t(f), d(null), l();
817
- } finally {
818
- r(!1);
819
- }
820
- }
821
- },
822
- children: [n ? /* @__PURE__ */ (0, m.jsx)(ce, {}) : /* @__PURE__ */ (0, m.jsx)(D, {}), "Save"]
823
- })
824
- ]
680
+ }), R = {
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
825
717
  })]
826
718
  });
827
- }, W = {
828
- resize: "_resize_lyibl_1",
829
- resizeText: "_resizeText_lyibl_13",
830
- resizeBorder: "_resizeBorder_lyibl_18",
831
- resizeTools: "_resizeTools_lyibl_24",
832
- resizeToolsLock: "_resizeToolsLock_lyibl_30",
833
- resizeToolsButtons: "_resizeToolsButtons_lyibl_35",
834
- resizeToolsSave: "_resizeToolsSave_lyibl_39",
835
- resizeToolsClose: "_resizeToolsClose_lyibl_44"
836
- }, G = 10, K = 200, ge = (e, t, n) => (e < G && (e = G), e > K && (e = K), {
837
- updatedScale: e,
838
- updatedWidth: Math.round(e / 100 * t),
839
- updatedHeight: Math.round(e / 100 * n)
840
- }), _e = ({ frameRef: e }) => {
841
- let { getLastHistoryItem: t, setCurrentAction: r, addToHistory: a, setSidebar: o } = N(), { width: l, height: u, base64: d } = t(), [f, p] = c(!1), [h, g] = c(l), [_, v] = c(u), y = s(0), { resize: b } = x(), S = C(), w = n((t) => {
842
- e.current && (e.current.style.transition = "transform 0.2s ease", e.current.style.transform = `scale(${t / 100})`);
843
- }, [e]), T = (e) => {
844
- let { updatedScale: t, updatedWidth: n, updatedHeight: r } = ge(parseInt(e.target.value) / l * 100, l, u);
845
- g(n), v(r), w(t);
846
- }, E = (e) => {
847
- let { updatedScale: t, updatedWidth: n, updatedHeight: r } = ge(parseInt(e.target.value) / u * 100, l, u);
848
- v(r), g(n), w(t);
849
- }, D = () => {
850
- w(100), r(null), o(!0);
851
- }, O = async () => {
852
- try {
853
- p(!0);
854
- let e = await b(d, h, _);
855
- a({
856
- name: "Resize",
857
- base64: e,
858
- width: h,
859
- height: _
860
- }), w(100), o(!0);
861
- } catch (e) {
862
- console.error("Failed to process image:", e);
863
- } finally {
864
- p(!1);
865
- }
866
- };
867
- return i(() => {
868
- let e = Math.round(h / l * 100), t = (e) => {
869
- let { updatedHeight: t, updatedWidth: n } = ge(e, l, u);
870
- v(t), g(n), w(e);
871
- }, n = (n) => {
872
- if (f) return;
873
- let r = Math.sign(n.deltaY);
874
- e -= r * 2, e <= G && (e = G), e >= K && (e = K), t(e);
875
- }, r = (e) => {
876
- y.current = e.touches[0].clientY;
877
- }, i = (n) => {
878
- if (f) return;
879
- let r = n.touches[0].clientY, i = y.current - r;
880
- Math.abs(i) < 10 || (e += Math.sign(i) * 2, e <= G && (e = G), e >= K && (e = K), t(e), y.current = r);
881
- }, a = new AbortController(), { signal: o } = a;
882
- return window.addEventListener("wheel", n, { signal: o }), window.addEventListener("touchstart", r, { signal: o }), window.addEventListener("touchmove", i, { signal: o }), () => a.abort();
883
- }, [
884
- u,
885
- l,
886
- w,
887
- f,
888
- S,
889
- h
890
- ]), /* @__PURE__ */ (0, m.jsxs)("div", {
891
- className: W.resize,
892
- children: [
893
- /* @__PURE__ */ (0, m.jsx)("div", {
894
- className: W.resizeText,
895
- children: S ? "Slide UP/Down to Resize" : "Scroll UP/Down to Resize"
896
- }),
897
- /* @__PURE__ */ (0, m.jsx)("div", { className: W.resizeBorder }),
898
- /* @__PURE__ */ (0, m.jsxs)("div", {
899
- className: W.resizeTools,
900
- children: [
901
- /* @__PURE__ */ (0, m.jsx)(me, {
902
- value: h,
903
- name: "width",
904
- label: "Width",
905
- disabled: f,
906
- style: { width: "88px" },
907
- onChange: T
908
- }),
909
- /* @__PURE__ */ (0, m.jsx)(ee, { className: W.resizeToolsLock }),
910
- /* @__PURE__ */ (0, m.jsx)(me, {
911
- value: _,
912
- name: "height",
913
- label: "Height",
914
- disabled: f,
915
- style: { width: "88px" },
916
- onChange: E
917
- }),
918
- /* @__PURE__ */ (0, m.jsx)(H, {
919
- onSave: () => O(),
920
- onClose: D,
921
- saving: f,
922
- disabled: h === l || f
923
- })
924
- ]
925
- })
719
+ }, Ce = 1920, we = .85, Te = [
720
+ {
721
+ label: "Facebook",
722
+ value: "facebook",
723
+ options: [
724
+ {
725
+ value: "facebook-post",
726
+ label: "Post",
727
+ w: 1200,
728
+ h: 630,
729
+ rightLabel: "1200 x 630"
730
+ },
731
+ {
732
+ value: "facebook-cover",
733
+ label: "Cover",
734
+ w: 851,
735
+ h: 315,
736
+ rightLabel: "851 x 315"
737
+ },
738
+ {
739
+ value: "facebook-profile",
740
+ label: "Profile",
741
+ w: 170,
742
+ h: 170,
743
+ rightLabel: "170 x 170"
744
+ },
745
+ {
746
+ value: "facebook-story",
747
+ label: "Story",
748
+ w: 1080,
749
+ h: 1920,
750
+ rightLabel: "1080 x 1920"
751
+ }
752
+ ]
753
+ },
754
+ {
755
+ label: "Instagram",
756
+ value: "instagram",
757
+ options: [
758
+ {
759
+ value: "instagram-landscape",
760
+ label: "Landscape",
761
+ w: 1080,
762
+ h: 566,
763
+ rightLabel: "1080 x 566"
764
+ },
765
+ {
766
+ value: "instagram-portait",
767
+ label: "Portait",
768
+ w: 1080,
769
+ h: 1350,
770
+ rightLabel: "1080 x 1350"
771
+ },
772
+ {
773
+ value: "instagram-square",
774
+ label: "Square",
775
+ w: 1080,
776
+ h: 1080,
777
+ rightLabel: "1080 x 1080"
778
+ },
779
+ {
780
+ value: "instagram-story",
781
+ label: "Story",
782
+ w: 1080,
783
+ h: 1920,
784
+ rightLabel: "1080 x 1920"
785
+ },
786
+ {
787
+ value: "instagram-thumbnail",
788
+ label: "Thumbnail",
789
+ w: 161,
790
+ h: 161,
791
+ rightLabel: "161 x 161"
792
+ }
793
+ ]
794
+ },
795
+ {
796
+ label: "LinkedIn",
797
+ value: "linkedin",
798
+ options: [
799
+ {
800
+ value: "linkedin-blog-post",
801
+ label: "Blog Post",
802
+ w: 1200,
803
+ h: 627,
804
+ rightLabel: "1200 x 627"
805
+ },
806
+ {
807
+ value: "linkedin-cover",
808
+ label: "Cover",
809
+ w: 1128,
810
+ h: 191,
811
+ rightLabel: "1128 x 191"
812
+ },
813
+ {
814
+ value: "linkedin-profile",
815
+ label: "Profile",
816
+ w: 400,
817
+ h: 400,
818
+ rightLabel: "400 x 400"
819
+ }
926
820
  ]
927
- });
928
- }, q = 32, J = (e) => ({
929
- x: e.offsetLeft,
930
- y: e.offsetTop,
931
- w: e.offsetWidth,
932
- h: e.offsetHeight
933
- }), ve = (e, t, n, r, i, a, o, s) => {
934
- let { x: c } = o, { y: l, w: u, h: d } = o;
935
- if (e) u += r - n, u + c > i && (u = i - c), u < q && (u = q);
936
- else {
937
- let e = r - n, o = Math.round(e / t);
938
- if (u += e, d += o, l -= o / 2, l < 0 || d + l > a || u + c > i || u < q || d < q) return J(s);
939
- }
940
- return {
941
- x: c,
942
- y: l,
943
- w: u,
944
- h: d
945
- };
946
- }, ye = (e, t, n, r, i, a, o, s) => {
947
- let { x: c, y: l, w: u, h: d } = o;
948
- if (e) {
949
- let e = i - o.w - o.x;
950
- c += r - n, c < 0 && (c = 0), u = i - c - e, u < q && (u = q, c = i - e - q);
951
- } else {
952
- let e = r - n, i = Math.round(e / t);
953
- if (u -= e, d -= i, c += e, l += i / 2, l < 0 || c < 0 || d + l > a || u < q || d < q) return J(s);
954
- }
955
- return {
956
- x: c,
957
- y: l,
958
- w: u,
959
- h: d
960
- };
961
- }, be = (e, t, n, r, i, a, o, s) => {
962
- let { x: c, y: l, w: u, h: d } = o, f = a - d - l;
963
- if (e) l += r - n, l < 0 && (l = 0), d = a - l - f, d < q && (d = q, l = a - f - q);
964
- else {
965
- let e = r - n, a = Math.round(e * t);
966
- if (d -= e, u -= a, c += a / 2, l += e, l < 0 || c < 0 || u + c > i || u < q || d < q) return J(s);
967
- }
968
- return {
969
- x: c,
970
- y: l,
971
- w: u,
972
- h: d
973
- };
974
- }, xe = (e, t, n, r, i, a, o, s) => {
975
- let { y: c } = o, { x: l, w: u, h: d } = o;
976
- if (e) d += r - n, d + c > a && (d = a - c), d < q && (d = q);
977
- else {
978
- let e = r - n, o = Math.round(e * t);
979
- if (d += e, u += o, l -= o / 2, d + c > a || l < 0 || u + l > i || u < q || d < q) return J(s);
980
821
  }
981
- return {
982
- x: l,
983
- y: c,
984
- w: u,
985
- h: d
986
- };
987
- }, Se = (e, t, n, r, i, a, o, s, c, l) => {
822
+ ], z = 32, Ee = (e, t, n, r, i, a, o, s, c, l) => {
988
823
  let { x: u, y: d, w: f, h: p } = c;
989
824
  if (e) {
990
825
  let e = o - c.w - c.x;
991
- u += i - n, u < 0 && (u = 0), f = o - u - e, f < q && (f = q, u = o - e - q);
826
+ u += i - n, u < 0 && (u = 0), f = o - u - e, f < z && (f = z, u = o - e - z);
992
827
  let t = s - p - d;
993
- d += a - r, d < 0 && (d = 0), p = s - d - t, p < q && (p = q, d = s - t - q);
828
+ d += a - r, d < 0 && (d = 0), p = s - d - t, p < z && (p = z, d = s - t - z);
994
829
  } else {
995
830
  if (t >= 1) {
996
831
  let e = i - n, r = Math.round(e / t);
@@ -999,7 +834,7 @@ var z = {
999
834
  let e = a - r, n = Math.round(e * t);
1000
835
  f -= n, p -= e, u += n, d += e;
1001
836
  }
1002
- if (u < 0 || d < 0 || f < q || p < q) return J(l);
837
+ if (u < 0 || d < 0 || f < z || p < z) return l;
1003
838
  }
1004
839
  return {
1005
840
  x: u,
@@ -1007,12 +842,12 @@ var z = {
1007
842
  w: f,
1008
843
  h: p
1009
844
  };
1010
- }, Ce = (e, t, n, r, i, a, o, s, c, l) => {
845
+ }, De = (e, t, n, r, i, a, o, s, c, l) => {
1011
846
  let { x: u } = c, { y: d, w: f, h: p } = c;
1012
847
  if (e) {
1013
- f += i - n, f + u > o && (f = o - u), f < q && (f = q);
848
+ f += i - n, f + u > o && (f = o - u), f < z && (f = z);
1014
849
  let e = s - p - d;
1015
- d += a - r, d < 0 && (d = 0), p = s - d - e, p < q && (p = q, d = s - e - q);
850
+ d += a - r, d < 0 && (d = 0), p = s - d - e, p < z && (p = z, d = s - e - z);
1016
851
  } else {
1017
852
  if (t > 1) {
1018
853
  let e = i - n, r = Math.round(e / t);
@@ -1021,7 +856,7 @@ var z = {
1021
856
  let e = a - r, n = Math.round(e * t);
1022
857
  f -= n, p -= e, d += e;
1023
858
  }
1024
- if (f + u > o || d < 0 || f < q || p < q) return J(l);
859
+ if (f + u > o || d < 0 || f < z || p < z) return l;
1025
860
  }
1026
861
  return {
1027
862
  x: u,
@@ -1029,12 +864,12 @@ var z = {
1029
864
  w: f,
1030
865
  h: p
1031
866
  };
1032
- }, we = (e, t, n, r, i, a, o, s, c, l) => {
867
+ }, Oe = (e, t, n, r, i, a, o, s, c, l) => {
1033
868
  let { y: u } = c, { x: d, w: f, h: p } = c;
1034
869
  if (e) {
1035
- p += a - r, p + u > s && (p = s - u), p < q && (p = q);
870
+ p += a - r, p + u > s && (p = s - u), p < z && (p = z);
1036
871
  let e = o - c.w - c.x;
1037
- d += i - n, d < 0 && (d = 0), f = o - d - e, f < q && (f = q, d = o - e - q);
872
+ d += i - n, d < 0 && (d = 0), f = o - d - e, f < z && (f = z, d = o - e - z);
1038
873
  } else {
1039
874
  if (t >= 1) {
1040
875
  let e = i - n, r = Math.round(e / t);
@@ -1043,7 +878,7 @@ var z = {
1043
878
  let e = a - r, n = Math.round(e * t);
1044
879
  f += n, p += e, d -= n;
1045
880
  }
1046
- if (p + u > s || d < 0 || f < q || p < q) return J(l);
881
+ if (p + u > s || d < 0 || f < z || p < z) return l;
1047
882
  }
1048
883
  return {
1049
884
  x: d,
@@ -1051,9 +886,9 @@ var z = {
1051
886
  w: f,
1052
887
  h: p
1053
888
  };
1054
- }, Te = (e, t, n, r, i, a, o, s, c, l) => {
889
+ }, ke = (e, t, n, r, i, a, o, s, c, l) => {
1055
890
  let { x: u, y: d } = c, { w: f, h: p } = c;
1056
- if (e) f += i - n, f + u > o && (f = o - u), f < q && (f = q), p += a - r, p + d > s && (p = s - d), p < q && (p = q);
891
+ if (e) f += i - n, f + u > o && (f = o - u), f < z && (f = z), p += a - r, p + d > s && (p = s - d), p < z && (p = z);
1057
892
  else {
1058
893
  if (t >= 1) {
1059
894
  let e = i - n, r = Math.round(e / t);
@@ -1062,7 +897,7 @@ var z = {
1062
897
  let e = a - r, n = Math.round(e * t);
1063
898
  f += n, p += e;
1064
899
  }
1065
- if (p + d > s || f + u > o || f < q || p < q) return J(l);
900
+ if (p + d > s || f + u > o || f < z || p < z) return l;
1066
901
  }
1067
902
  return {
1068
903
  x: u,
@@ -1070,165 +905,567 @@ var z = {
1070
905
  w: f,
1071
906
  h: p
1072
907
  };
1073
- }, Ee = (e, t, n, r, i, a, o, s, c, l, u) => e === "r" ? ve(t, n, r, a, s, c, l, u) : e === "l" ? ye(t, n, r, a, s, c, l, u) : e === "t" ? be(t, n, i, o, s, c, l, u) : e === "b" ? xe(t, n, i, o, s, c, l, u) : e === "tl" ? Se(t, n, r, i, a, o, s, c, l, u) : e === "tr" ? Ce(t, n, r, i, a, o, s, c, l, u) : e === "bl" ? we(t, n, r, i, a, o, s, c, l, u) : e === "br" ? Te(t, n, r, i, a, o, s, c, l, u) : {
908
+ }, Ae = (e, t, n, r, i, a, o, s, c, l, u) => e === "tl" ? Ee(t, n, r, i, a, o, s, c, l, u) : e === "tr" ? De(t, n, r, i, a, o, s, c, l, u) : e === "bl" ? Oe(t, n, r, i, a, o, s, c, l, u) : e === "br" ? ke(t, n, r, i, a, o, s, c, l, u) : {
1074
909
  x: 0,
1075
910
  y: 0,
1076
911
  w: 0,
1077
912
  h: 0
1078
- }, De = (e, t, n) => {
1079
- let r = .1, i = t / n, a = 0, o = 0;
913
+ }, je = (e, t, n) => {
914
+ let r = .12, i = t / n, a = 0, o = 0;
1080
915
  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));
1081
916
  let s = a / t * 100, c = o / n * 100;
1082
917
  return {
1083
918
  x: (t - a) / 2 / t * 100,
1084
919
  y: (n - o) / 2 / n * 100,
1085
920
  w: s,
1086
- h: c,
1087
- xPx: Math.round((t - a) / 2),
1088
- yPx: Math.round((n - o) / 2),
1089
- wPx: a,
1090
- hPx: o
921
+ h: c
1091
922
  };
1092
- }, Y = {
1093
- cropImage: "_cropImage_1m63v_1",
1094
- cropBox: "_cropBox_1m63v_7",
1095
- cropTools: "_cropTools_1m63v_11",
1096
- cropToolsInfo: "_cropToolsInfo_1m63v_27",
1097
- cropToolsInfoLabel: "_cropToolsInfoLabel_1m63v_32",
1098
- cropToolsInfoValue: "_cropToolsInfoValue_1m63v_37",
1099
- cropBorder: "_cropBorder_1m63v_41",
1100
- cropBorderTop: "_cropBorderTop_1m63v_45",
1101
- cropBorderRight: "_cropBorderRight_1m63v_52",
1102
- cropBorderBottom: "_cropBorderBottom_1m63v_59",
1103
- cropBorderLeft: "_cropBorderLeft_1m63v_67",
1104
- cropLinesBox: "_cropLinesBox_1m63v_75",
1105
- cropLine: "_cropLine_1m63v_75",
1106
- cropLineVertical: "_cropLineVertical_1m63v_85",
1107
- cropLineHorizontal: "_cropLineHorizontal_1m63v_93",
1108
- cropPointer: "_cropPointer_1m63v_101",
1109
- cropPointerTopLeft: "_cropPointerTopLeft_1m63v_110",
1110
- cropPointerTop: "_cropPointerTop_1m63v_110",
1111
- cropPointerTopRight: "_cropPointerTopRight_1m63v_121",
1112
- cropPointerRight: "_cropPointerRight_1m63v_126",
1113
- cropPointerBottomRight: "_cropPointerBottomRight_1m63v_132",
1114
- cropPointerBottom: "_cropPointerBottom_1m63v_132",
1115
- cropPointerBottomLeft: "_cropPointerBottomLeft_1m63v_143",
1116
- cropPointerLeft: "_cropPointerLeft_1m63v_148",
1117
- cropMobileBorder: "_cropMobileBorder_1m63v_154",
1118
- cropMobilePointer: "_cropMobilePointer_1m63v_160"
1119
- }, Oe = () => {
1120
- let { getCurrentAction: e, getLastHistoryItem: t } = N(), n = e(), r = C(), i = s(null), a = s(null), { handleCropStart: o } = Re({
1121
- imgRef: i,
1122
- cropRef: a
923
+ }, Me = (e, t, n, r) => {
924
+ let i = e.w / 100 * n, a = e.h / 100 * r;
925
+ t >= 1 ? a = i / t : i = a * t;
926
+ let o = i / n * 100, s = a / r * 100, c = Math.max(o / (100 - e.x), s / (100 - e.y), 1);
927
+ return o /= c, s /= c, {
928
+ ...e,
929
+ w: o,
930
+ h: s
931
+ };
932
+ }, B = (e) => Math.abs(Math.round(e / 90)) % 2 == 1, Ne = (e, t, n, r) => B(n) === B(r) ? {
933
+ width: e,
934
+ height: t
935
+ } : {
936
+ width: t,
937
+ height: e
938
+ }, Pe = async (e) => {
939
+ let { width: t, height: n } = e, r = Math.min(1, Ce / Math.max(t, n)), i = Math.round(t * r), a = Math.round(n * r), o = new OffscreenCanvas(i, a), s = o.getContext("2d");
940
+ if (!s) throw Error("Failed to get 2D context for preview canvas");
941
+ return s.drawImage(e, 0, 0, i, a), o.convertToBlob({
942
+ type: "image/webp",
943
+ quality: we
944
+ });
945
+ };
946
+ function Fe(e) {
947
+ let t = new OffscreenCanvas(e.width, e.height), n = t.getContext("2d");
948
+ if (!n) throw Error("Failed to create 2D context for canvas.");
949
+ n.drawImage(e, 0, 0);
950
+ try {
951
+ let e = n.getImageData(0, 0, t.width, t.height).data;
952
+ for (let t = 3; t < e.length; t += 4) if (e[t] < 255) return !0;
953
+ return !1;
954
+ } catch (e) {
955
+ throw Error(`Error reading pixels: ${e}`, { cause: e });
956
+ }
957
+ }
958
+ //#endregion
959
+ //#region src/shared/components/Pixedi/utils/imageProcessor.ts
960
+ var Ie = (e) => new Promise((t, n) => {
961
+ let r = new FileReader();
962
+ r.onloadend = () => {
963
+ let e = r.result;
964
+ typeof e == "string" ? t(e) : n(/* @__PURE__ */ Error("Failed to read blob as base64"));
965
+ }, r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("FileReader error")), r.readAsDataURL(e);
966
+ });
967
+ async function Le(e) {
968
+ 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
+ i.width = t.width, i.height = t.height, a?.drawImage(t, 0, 0), t.close();
970
+ let o = () => {
971
+ let e = document.createElement("canvas");
972
+ return e.width = i.width, e.height = i.height, e.getContext("2d", { alpha: !0 })?.drawImage(i, 0, 0), e;
973
+ };
974
+ return {
975
+ crop: (e, t, n, r) => {
976
+ if (!a) return;
977
+ let s = o();
978
+ i.width = n, i.height = r, a.clearRect(0, 0, n, r), a.drawImage(s, e, t, n, r, 0, 0, n, r);
979
+ },
980
+ flip: (e, t) => {
981
+ if (!a) return;
982
+ let n = o();
983
+ a.clearRect(0, 0, i.width, i.height), a.save(), a.translate(e ? i.width : 0, t ? i.height : 0), a.scale(e ? -1 : 1, t ? -1 : 1), a.drawImage(n, 0, 0), a.restore();
984
+ },
985
+ rotate: (e) => {
986
+ if (!a) return;
987
+ let t = o(), n = e * Math.PI / 180, r = Math.abs(Math.sin(n)), s = Math.abs(Math.cos(n));
988
+ i.width = Math.round(t.width * s + t.height * r), i.height = Math.round(t.width * r + t.height * s), a.clearRect(0, 0, i.width, i.height), a.save(), a.translate(i.width / 2, i.height / 2), a.rotate(n), a.drawImage(t, -t.width / 2, -t.height / 2), a.restore();
989
+ },
990
+ resize: (e, t) => {
991
+ if (!a) return;
992
+ let n = o();
993
+ i.width = e, i.height = t, a.clearRect(0, 0, e, t), a.drawImage(n, 0, 0, e, t);
994
+ },
995
+ get: async (e) => {
996
+ let { quality: t = .85, saveAsWEBP: n = !1 } = e, a = n ? "image/webp" : r, o = await new Promise((e, o) => {
997
+ r === "image/jpeg" || r === "image/webp" || n ? i.toBlob((t) => {
998
+ t ? e(t) : o(/* @__PURE__ */ Error(`Failed to encode image as ${a}`));
999
+ }, a, t) : i.toBlob((t) => {
1000
+ t ? e(t) : o(/* @__PURE__ */ Error("Failed to encode image as image/png"));
1001
+ }, "image/png");
1002
+ }), s = await createImageBitmap(o), c = await Pe(s), { width: l, height: u } = s, d = Fe(s);
1003
+ return s.close(), {
1004
+ newBlob: o,
1005
+ previewBlob: c,
1006
+ mimeType: a,
1007
+ width: l,
1008
+ height: u,
1009
+ isAlpha: d
1010
+ };
1011
+ }
1012
+ };
1013
+ }
1014
+ //#endregion
1015
+ //#region src/shared/components/Pixedi/utils/preview.ts
1016
+ var V = (e, t, n) => Math.max(t, Math.min(n, e)), Re = (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]]], ze = (e) => (Math.round(e / 90) % 4 + 4) % 4 * 90, Be = (e) => {
1017
+ switch (ze(e)) {
1018
+ case 90: return [[0, -1], [1, 0]];
1019
+ case 180: return [[-1, 0], [0, -1]];
1020
+ case 270: return [[0, 1], [-1, 0]];
1021
+ default: return [[1, 0], [0, 1]];
1022
+ }
1023
+ }, Ve = (e, t) => [[e ? -1 : 1, 0], [0, t ? -1 : 1]], He = (e, t, n) => Re(Ve(t, n), Be(-e)), Ue = (e) => [+(e[0][0] < 0 || e[0][1] < 0), +(e[1][0] < 0 || e[1][1] < 0)], H = (e, t, n) => {
1024
+ let r = Ue(e);
1025
+ return [e[0][0] * t + e[0][1] * n + r[0], e[1][0] * t + e[1][1] * n + r[1]];
1026
+ }, We = (e) => {
1027
+ let t = 1, n = 1, r = {
1028
+ x: 0,
1029
+ y: 0,
1030
+ w: 1,
1031
+ h: 1
1032
+ }, i = 0, a = !1, o = !1;
1033
+ for (let s = 0; s < e.length; s++) {
1034
+ let c = e[s];
1035
+ if (c.action.name === "initial") t = c.width, n = c.height, r = {
1036
+ x: 0,
1037
+ y: 0,
1038
+ w: 1,
1039
+ h: 1
1040
+ }, i = 0, a = !1, o = !1;
1041
+ else if (c.action.name === "crop") {
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 = He(i, a, o), u = [
1043
+ H(l, e, t),
1044
+ H(l, e + n, t),
1045
+ H(l, e, t + s),
1046
+ H(l, e + n, t + s)
1047
+ ], 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
+ r = {
1049
+ x: r.x + d * r.w,
1050
+ y: r.y + p * r.h,
1051
+ w: r.w * (f - d),
1052
+ h: r.h * (m - p)
1053
+ };
1054
+ } else if (c.action.name === "flip") {
1055
+ let e = B(i), t = e ? c.action.args.vertical : c.action.args.horizontal, n = e ? c.action.args.horizontal : c.action.args.vertical;
1056
+ t && (a = !a), n && (o = !o);
1057
+ } else c.action.name === "rotate" && (i = c.action.args.degrees);
1058
+ }
1059
+ let s = r.w * t, c = r.h * n, l = B(i), u = l ? c : s, d = l ? s : c, f = e.at(-1)?.width || 0, p = e.at(-1)?.height || 0;
1060
+ return {
1061
+ box: r,
1062
+ boxWidth: s,
1063
+ boxHeight: c,
1064
+ newWidth: f,
1065
+ newHeight: p,
1066
+ initWidth: t,
1067
+ initHeight: n,
1068
+ viewWidth: u,
1069
+ viewHeight: d,
1070
+ rotation: i,
1071
+ flipH: a,
1072
+ flipV: o
1073
+ };
1074
+ }, Ge = (e) => {
1075
+ let { box: t, flipH: n, flipV: r, rotation: i, newWidth: a, newHeight: o, initWidth: s, initHeight: c, viewWidth: l, viewHeight: u } = We(e), d = V(t.x, 0, 1), f = V(t.y, 0, 1), p = {
1076
+ x: d,
1077
+ y: f,
1078
+ w: V(t.w, 0, 1 - d),
1079
+ h: V(t.h, 0, 1 - f)
1080
+ }, m = ze(i);
1081
+ return {
1082
+ ...p.x === 0 && p.y === 0 && p.w === 1 && p.h === 1 ? {} : { crop: {
1083
+ x: Math.round(s * t.x),
1084
+ y: Math.round(c * t.y),
1085
+ w: Math.round(s * t.w),
1086
+ h: Math.round(c * t.h)
1087
+ } },
1088
+ ...m === 0 ? {} : { rotate: { degrees: m } },
1089
+ ...n || r ? { flip: {
1090
+ horizontal: n,
1091
+ vertical: r
1092
+ } } : {},
1093
+ ...Math.round(l) !== a || Math.round(u) !== o ? { resize: {
1094
+ width: a,
1095
+ height: o
1096
+ } } : {}
1097
+ };
1098
+ }, Ke = (e) => {
1099
+ let [t, n] = s(!1), { setImage: r, settings: i, history: a, originalBlob: o, setCurrentAction: c, resetHistory: l } = j();
1100
+ return {
1101
+ save: async () => {
1102
+ if (!o) return;
1103
+ n(!0);
1104
+ let t = Ge(a.items.slice(0, a.pointer + 1));
1105
+ try {
1106
+ let n = await Le(o);
1107
+ 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
+ let { newBlob: a, previewBlob: s, mimeType: c, width: l, height: u, isAlpha: d } = await n.get(i), f = "";
1109
+ i.exportAs === "base64" && (f = await Ie(a)), await e(f || a), r({
1110
+ newBlob: a,
1111
+ previewBlob: s,
1112
+ mimeType: c,
1113
+ width: l,
1114
+ height: u,
1115
+ isAlpha: d
1116
+ });
1117
+ } catch (e) {
1118
+ throw Error(`Error saving image: ${e}`, { cause: e });
1119
+ } finally {
1120
+ n(!1);
1121
+ }
1122
+ },
1123
+ reset: () => {
1124
+ c(null), l();
1125
+ },
1126
+ isSaving: t
1127
+ };
1128
+ }, U = {
1129
+ header: "_header_msw8l_1",
1130
+ tools: "_tools_msw8l_11",
1131
+ history: "_history_msw8l_15",
1132
+ historyText: "_historyText_msw8l_20"
1133
+ }, qe = ({ onBack: e, onSave: t }) => {
1134
+ let { save: n, reset: r, isSaving: i } = Ke(t), { history: a, undo: o, redo: s } = j(), c = a.items.length > 1 && !i, l = a.pointer === 0, u = a.pointer === a.items.length - 1, d = a.items.length < 2 || i, f = d || a.pointer === 0;
1135
+ return /* @__PURE__ */ (0, h.jsxs)("div", {
1136
+ className: U.header,
1137
+ children: [/* @__PURE__ */ (0, h.jsx)(N, {
1138
+ variant: "ghost",
1139
+ className: M.rect,
1140
+ onClick: e,
1141
+ children: /* @__PURE__ */ (0, h.jsx)(D, {})
1142
+ }), /* @__PURE__ */ (0, h.jsxs)("div", {
1143
+ className: U.tools,
1144
+ children: [
1145
+ c && /* @__PURE__ */ (0, h.jsxs)("div", {
1146
+ className: U.history,
1147
+ children: [
1148
+ /* @__PURE__ */ (0, h.jsx)(N, {
1149
+ variant: "outline",
1150
+ disabled: l,
1151
+ className: M.rect,
1152
+ onClick: o,
1153
+ children: /* @__PURE__ */ (0, h.jsx)(ie, {})
1154
+ }),
1155
+ /* @__PURE__ */ (0, h.jsxs)("div", {
1156
+ className: U.historyText,
1157
+ children: [
1158
+ a.pointer + 1,
1159
+ "/",
1160
+ a.items.length
1161
+ ]
1162
+ }),
1163
+ /* @__PURE__ */ (0, h.jsx)(N, {
1164
+ variant: "outline",
1165
+ disabled: u,
1166
+ className: M.rect,
1167
+ onClick: s,
1168
+ children: /* @__PURE__ */ (0, h.jsx)(O, {})
1169
+ })
1170
+ ]
1171
+ }),
1172
+ /* @__PURE__ */ (0, h.jsx)(N, {
1173
+ variant: "outline",
1174
+ disabled: d,
1175
+ onClick: r,
1176
+ children: "Reset"
1177
+ }),
1178
+ /* @__PURE__ */ (0, h.jsxs)(N, {
1179
+ disabled: f,
1180
+ onClick: n,
1181
+ children: [i ? /* @__PURE__ */ (0, h.jsx)(A, {}) : /* @__PURE__ */ (0, h.jsx)(E, {}), "Save"]
1182
+ })
1183
+ ]
1184
+ })]
1123
1185
  });
1124
- if (!n || n.name !== "crop") return null;
1125
- let { width: c, height: l, base64: u } = t(), { x: d, y: f, w: p, h } = De(n.args.ratio, c, l);
1126
- return /* @__PURE__ */ (0, m.jsxs)(m.Fragment, { children: [/* @__PURE__ */ (0, m.jsx)("img", {
1127
- ref: i,
1128
- src: u,
1129
- alt: "Image",
1130
- className: Y.cropImage,
1131
- style: { clipPath: `xywh(${d}% ${f}% ${p}% ${h}%)` }
1132
- }), /* @__PURE__ */ (0, m.jsxs)("div", {
1133
- ref: a,
1134
- className: Y.cropBox,
1186
+ }, Je = (e, t) => {
1187
+ let n = new CustomEvent("crop-update", { detail: t });
1188
+ e.dispatchEvent(n);
1189
+ }, Ye = (e, t) => {
1190
+ let n = new CustomEvent("clip-path-update", { detail: t });
1191
+ e.dispatchEvent(n);
1192
+ }, W = (e, t) => {
1193
+ let n = new CustomEvent("resize-update", { detail: t });
1194
+ e.dispatchEvent(n);
1195
+ }, G = {
1196
+ resize: "_resize_11cwi_1",
1197
+ slider: "_slider_11cwi_14",
1198
+ border: "_border_11cwi_18",
1199
+ tools: "_tools_11cwi_24",
1200
+ toolsLock: "_toolsLock_11cwi_30"
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);
1229
+ };
1230
+ return r(() => {
1231
+ let e = Math.round(u / c * 100), t = (e) => {
1232
+ let { updatedHeight: t, updatedWidth: n } = J(e, c, l);
1233
+ p(t), d(n), g(e), W(a, e);
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();
1244
+ }, [
1245
+ l,
1246
+ c,
1247
+ v,
1248
+ u,
1249
+ a
1250
+ ]), /* @__PURE__ */ (0, h.jsxs)("div", {
1251
+ className: G.resize,
1252
+ children: [/* @__PURE__ */ (0, h.jsx)(Se, {
1253
+ min: K,
1254
+ max: q,
1255
+ value: m,
1256
+ className: G.slider,
1257
+ onChange: y
1258
+ }), /* @__PURE__ */ (0, h.jsxs)("div", {
1259
+ className: G.tools,
1260
+ children: [
1261
+ /* @__PURE__ */ (0, h.jsx)(be, {
1262
+ value: u,
1263
+ name: "width",
1264
+ label: "Width",
1265
+ style: { width: "88px" },
1266
+ onChange: (e) => d(Number(e.target.value)),
1267
+ onBlur: b
1268
+ }),
1269
+ /* @__PURE__ */ (0, h.jsx)(ne, { className: G.toolsLock }),
1270
+ /* @__PURE__ */ (0, h.jsx)(be, {
1271
+ value: f,
1272
+ name: "height",
1273
+ label: "Height",
1274
+ style: { width: "88px" },
1275
+ onChange: (e) => p(Number(e.target.value)),
1276
+ onBlur: x
1277
+ }),
1278
+ /* @__PURE__ */ (0, h.jsx)(L, {
1279
+ onSave: () => w(),
1280
+ onClose: C,
1281
+ disabled: u === c
1282
+ })
1283
+ ]
1284
+ })]
1285
+ });
1286
+ }, Y = {
1287
+ preview: "_preview_dvanl_1",
1288
+ rotate: "_rotate_dvanl_12",
1289
+ flip: "_flip_dvanl_24",
1290
+ image: "_image_dvanl_32"
1291
+ }, Ze = ({ isClipped: e, style: t = {} }) => {
1292
+ let { history: n, previewUrl: i, currentAction: a, getLastRotation: s, eventBus: c } = j(), l = o(null), u = [];
1293
+ if (a) {
1294
+ let { width: e, height: t } = n.items.at(n.pointer);
1295
+ u.push({
1296
+ ...a.name === w.ROTATE ? Ne(e, t, s(), a.args.degrees) : {
1297
+ width: e,
1298
+ height: t
1299
+ },
1300
+ action: a
1301
+ });
1302
+ }
1303
+ let { box: d, boxWidth: f, boxHeight: p, viewWidth: m, viewHeight: g, rotation: _, flipH: v, flipV: y } = We([...n.items.slice(0, n.pointer + 1), ...u]);
1304
+ return r(() => {
1305
+ e && l.current && (l.current.style.transition = "none");
1306
+ let t = (e) => {
1307
+ let t = e.detail;
1308
+ l.current && (l.current.style.transform = `scale(${t / 100})`);
1309
+ }, n = (t) => {
1310
+ if (!e) return;
1311
+ let { x: n, y: r, w: i, h: a } = t.detail;
1312
+ l.current && (l.current.style.clipPath = `xywh(${n}% ${r}% ${i}% ${a}%)`);
1313
+ };
1314
+ return c.addEventListener("resize-update", t), c.addEventListener("clip-path-update", n), () => {
1315
+ c.removeEventListener("resize-update", t), c.removeEventListener("clip-path-update", n);
1316
+ };
1317
+ }, [e, c]), /* @__PURE__ */ (0, h.jsx)("div", {
1318
+ ref: l,
1319
+ className: Y.preview,
1135
1320
  style: {
1136
- width: `${p}%`,
1137
- height: `${h}%`,
1138
- top: `${f}%`,
1139
- left: `${d}%`
1321
+ aspectRatio: `${m} / ${g}`,
1322
+ ...t
1140
1323
  },
1141
- children: [/* @__PURE__ */ (0, m.jsx)(Ne, {}), r ? /* @__PURE__ */ (0, m.jsx)(ze, { onMouseDown: o }) : /* @__PURE__ */ (0, m.jsxs)(m.Fragment, { children: [/* @__PURE__ */ (0, m.jsx)(Me, { onMouseDown: o }), /* @__PURE__ */ (0, m.jsx)(Pe, { onMouseDown: o })] })]
1324
+ children: /* @__PURE__ */ (0, h.jsx)("div", {
1325
+ className: Y.rotate,
1326
+ style: {
1327
+ width: `${f / m * 100}%`,
1328
+ height: `${p / g * 100}%`,
1329
+ transform: `translate(-50%, -50%) rotate(${_}deg)`
1330
+ },
1331
+ children: /* @__PURE__ */ (0, h.jsx)("div", {
1332
+ className: Y.flip,
1333
+ style: { transform: `scale(${v ? -1 : 1}, ${y ? -1 : 1})` },
1334
+ children: /* @__PURE__ */ (0, h.jsx)("img", {
1335
+ className: Y.image,
1336
+ src: i,
1337
+ alt: "Preview Image",
1338
+ style: {
1339
+ width: `${1 / d.w * 100}%`,
1340
+ height: `${1 / d.h * 100}%`,
1341
+ left: `${-(d.x / d.w) * 100}%`,
1342
+ top: `${-(d.y / d.h) * 100}%`
1343
+ }
1344
+ })
1345
+ })
1346
+ })
1347
+ });
1348
+ }, X = {
1349
+ wrapper: "_wrapper_13nh3_1",
1350
+ box: "_box_13nh3_9",
1351
+ tools: "_tools_13nh3_18",
1352
+ toolsInfo: "_toolsInfo_13nh3_34",
1353
+ toolsInfoLabel: "_toolsInfoLabel_13nh3_41",
1354
+ toolsInfoValue: "_toolsInfoValue_13nh3_46",
1355
+ linesBox: "_linesBox_13nh3_51",
1356
+ line: "_line_13nh3_51",
1357
+ lineV: "_lineV_13nh3_61",
1358
+ lineH: "_lineH_13nh3_69",
1359
+ pointer: "_pointer_13nh3_77",
1360
+ pointerTopLeft: "_pointerTopLeft_13nh3_83",
1361
+ pointerTopRight: "_pointerTopRight_13nh3_90",
1362
+ pointerBottomRight: "_pointerBottomRight_13nh3_97",
1363
+ pointerBottomLeft: "_pointerBottomLeft_13nh3_104",
1364
+ mobileBorder: "_mobileBorder_13nh3_111",
1365
+ mobilePointer: "_mobilePointer_13nh3_117"
1366
+ }, Qe = () => {
1367
+ let { getLastHistoryItem: e } = j(), t = S(), n = o(null), { handleCropStart: r, initialCrop: i } = st({ boxRef: n }), { width: a, height: s } = e(), { x: c, y: l, w: u, h: d } = i;
1368
+ return /* @__PURE__ */ (0, h.jsxs)(h.Fragment, { children: [/* @__PURE__ */ (0, h.jsx)(Ze, {
1369
+ isClipped: !0,
1370
+ style: { clipPath: `xywh(${c}% ${l}% ${u}% ${d}%)` }
1371
+ }), /* @__PURE__ */ (0, h.jsx)("div", {
1372
+ className: X.wrapper,
1373
+ style: { aspectRatio: `${a} / ${s}` },
1374
+ children: /* @__PURE__ */ (0, h.jsxs)("div", {
1375
+ ref: n,
1376
+ className: X.box,
1377
+ style: {
1378
+ width: `${u}%`,
1379
+ height: `${d}%`,
1380
+ top: `${l}%`,
1381
+ left: `${c}%`
1382
+ },
1383
+ children: [/* @__PURE__ */ (0, h.jsx)(et, {}), t ? /* @__PURE__ */ (0, h.jsx)(ct, { onMouseDown: r }) : /* @__PURE__ */ (0, h.jsx)(tt, { onMouseDown: r })]
1384
+ })
1142
1385
  })] });
1143
- }, ke = new EventTarget(), Ae = (e) => {
1144
- let t = new CustomEvent("crop-update", { detail: e });
1145
- ke.dispatchEvent(t);
1146
- }, je = () => {
1147
- let { setCurrentAction: e, getCurrentAction: t, getLastHistoryItem: n, addToHistory: r, setSidebar: a } = N(), { crop: o, resize: l } = x(), [u, d] = c(!1), f = t(), { base64: p, width: h, height: g } = n(), _ = s(null), v = s(null), y = s(null), b = s(null), S = s(null);
1148
- return i(() => {
1149
- if (f?.name !== "crop") return;
1150
- let { x: e, y: t, w: n, h: r } = De(f.args.ratio, h, g), i = Math.round(e / 100 * h), a = Math.round(t / 100 * g), o = Math.round(n / 100 * h), s = Math.round(r / 100 * g);
1151
- _.current && (_.current.textContent = i.toString()), v.current && (v.current.textContent = a.toString()), y.current && (y.current.textContent = o.toString()), b.current && (b.current.textContent = s.toString()), S.current = {
1152
- x: i,
1153
- y: a,
1154
- w: o,
1155
- h: s
1156
- };
1157
- let c = (e) => {
1158
- let t = e, { x: n, y: r, w: i, h: a } = t.detail;
1159
- S.current = t.detail, _.current && (_.current.textContent = n.toString()), v.current && (v.current.textContent = r.toString()), y.current && (y.current.textContent = i.toString()), b.current && (b.current.textContent = a.toString());
1386
+ }, $e = () => {
1387
+ let { setCurrentAction: e, currentAction: t, getLastHistoryItem: n, addToHistory: i, setSidebar: a, eventBus: s } = j(), { width: c, height: l } = n(), u = o(null), d = o(null), f = o(null), p = o(null), m = o({
1388
+ x: 0,
1389
+ y: 0,
1390
+ w: 0,
1391
+ h: 0
1392
+ });
1393
+ return r(() => {
1394
+ if (t?.name !== "crop") return;
1395
+ let e = je(t.args.ratio, c, l), { x: n, y: r, w: i, h: a } = e, o = Math.round(n / 100 * c), h = Math.round(r / 100 * l), g = Math.round(i / 100 * c), _ = Math.round(a / 100 * l);
1396
+ m.current = e, u.current && (u.current.textContent = o.toString()), d.current && (d.current.textContent = h.toString()), f.current && (f.current.textContent = g.toString()), p.current && (p.current.textContent = _.toString());
1397
+ let v = (e) => {
1398
+ let { x: t, y: n, w: r, h: i } = e.detail;
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;
1160
1402
  };
1161
- return ke.addEventListener("crop-update", c), () => {
1162
- ke.removeEventListener("crop-update", c);
1403
+ return s.addEventListener("crop-update", v), s.addEventListener("clip-path-update", y), () => {
1404
+ s.removeEventListener("crop-update", v), s.removeEventListener("clip-path-update", y);
1163
1405
  };
1164
1406
  }, [
1165
- f,
1166
- h,
1167
- g
1168
- ]), /* @__PURE__ */ (0, m.jsxs)("div", {
1169
- className: Y.cropTools,
1407
+ t,
1408
+ c,
1409
+ l,
1410
+ s
1411
+ ]), /* @__PURE__ */ (0, h.jsxs)("div", {
1412
+ className: X.tools,
1170
1413
  children: [
1171
- /* @__PURE__ */ (0, m.jsxs)("div", {
1172
- className: Y.cropToolsInfo,
1173
- children: [/* @__PURE__ */ (0, m.jsx)("div", {
1174
- className: Y.cropToolsInfoLabel,
1414
+ /* @__PURE__ */ (0, h.jsxs)("div", {
1415
+ className: X.toolsInfo,
1416
+ children: [/* @__PURE__ */ (0, h.jsx)("div", {
1417
+ className: X.toolsInfoLabel,
1175
1418
  children: "left"
1176
- }), /* @__PURE__ */ (0, m.jsx)("div", {
1177
- className: `${Y.cropToolsInfoValue} ${I.semibold}`,
1178
- ref: _
1419
+ }), /* @__PURE__ */ (0, h.jsx)("div", {
1420
+ className: `${X.toolsInfoValue} ${P.semibold}`,
1421
+ ref: u
1179
1422
  })]
1180
1423
  }),
1181
- /* @__PURE__ */ (0, m.jsxs)("div", {
1182
- className: Y.cropToolsInfo,
1183
- children: [/* @__PURE__ */ (0, m.jsx)("div", {
1184
- className: Y.cropToolsInfoLabel,
1424
+ /* @__PURE__ */ (0, h.jsxs)("div", {
1425
+ className: X.toolsInfo,
1426
+ children: [/* @__PURE__ */ (0, h.jsx)("div", {
1427
+ className: X.toolsInfoLabel,
1185
1428
  children: "top"
1186
- }), /* @__PURE__ */ (0, m.jsx)("div", {
1187
- className: `${Y.cropToolsInfoValue} ${I.semibold}`,
1188
- ref: v
1429
+ }), /* @__PURE__ */ (0, h.jsx)("div", {
1430
+ className: `${X.toolsInfoValue} ${P.semibold}`,
1431
+ ref: d
1189
1432
  })]
1190
1433
  }),
1191
- /* @__PURE__ */ (0, m.jsxs)("div", {
1192
- className: Y.cropToolsInfo,
1193
- children: [/* @__PURE__ */ (0, m.jsx)("div", {
1194
- className: Y.cropToolsInfoLabel,
1434
+ /* @__PURE__ */ (0, h.jsxs)("div", {
1435
+ className: X.toolsInfo,
1436
+ children: [/* @__PURE__ */ (0, h.jsx)("div", {
1437
+ className: X.toolsInfoLabel,
1195
1438
  children: "width"
1196
- }), /* @__PURE__ */ (0, m.jsx)("div", {
1197
- className: `${Y.cropToolsInfoValue} ${I.semibold}`,
1198
- ref: y
1439
+ }), /* @__PURE__ */ (0, h.jsx)("div", {
1440
+ className: `${X.toolsInfoValue} ${P.semibold}`,
1441
+ ref: f
1199
1442
  })]
1200
1443
  }),
1201
- /* @__PURE__ */ (0, m.jsxs)("div", {
1202
- className: Y.cropToolsInfo,
1203
- children: [/* @__PURE__ */ (0, m.jsx)("div", {
1204
- className: Y.cropToolsInfoLabel,
1444
+ /* @__PURE__ */ (0, h.jsxs)("div", {
1445
+ className: X.toolsInfo,
1446
+ children: [/* @__PURE__ */ (0, h.jsx)("div", {
1447
+ className: X.toolsInfoLabel,
1205
1448
  children: "height"
1206
- }), /* @__PURE__ */ (0, m.jsx)("div", {
1207
- className: `${Y.cropToolsInfoValue} ${I.semibold}`,
1208
- ref: b
1449
+ }), /* @__PURE__ */ (0, h.jsx)("div", {
1450
+ className: `${X.toolsInfoValue} ${P.semibold}`,
1451
+ ref: p
1209
1452
  })]
1210
1453
  }),
1211
- /* @__PURE__ */ (0, m.jsx)(H, {
1212
- saving: u,
1454
+ /* @__PURE__ */ (0, h.jsx)(L, {
1213
1455
  onSave: async () => {
1214
- if (!(!f || f.name !== "crop")) try {
1215
- if (d(!0), !S.current) return;
1216
- let { x: e, y: t, w: n, h: i } = S.current, { preset: s } = f.args, c = await o(p, e, t, n, i);
1217
- if (s) {
1218
- let { w: e, h: t } = s;
1219
- c = await l(c, e, t);
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
+ }
1220
1467
  }
1221
- r({
1222
- name: "Crop",
1223
- base64: c,
1224
- width: s ? s.w : S.current.w,
1225
- height: s ? s.h : S.current.h
1226
- }), a(!0);
1227
- } catch (e) {
1228
- console.error("Failed to process image:", e);
1229
- } finally {
1230
- d(!1);
1231
- }
1468
+ }), a(!0);
1232
1469
  },
1233
1470
  onClose: () => {
1234
1471
  e(null), a(!0);
@@ -1236,292 +1473,289 @@ var z = {
1236
1473
  })
1237
1474
  ]
1238
1475
  });
1239
- }, Me = ({ onMouseDown: e }) => /* @__PURE__ */ (0, m.jsxs)(m.Fragment, { children: [
1240
- /* @__PURE__ */ (0, m.jsx)("span", {
1241
- className: `${Y.cropBorder} ${Y.cropBorderTop}`,
1242
- onMouseDown: (t) => e(t, "t", "ns")
1243
- }),
1244
- /* @__PURE__ */ (0, m.jsx)("span", {
1245
- className: `${Y.cropBorder} ${Y.cropBorderRight}`,
1246
- onMouseDown: (t) => e(t, "r", "ew")
1247
- }),
1248
- /* @__PURE__ */ (0, m.jsx)("span", {
1249
- className: `${Y.cropBorder} ${Y.cropBorderBottom}`,
1250
- onMouseDown: (t) => e(t, "b", "ns")
1251
- }),
1252
- /* @__PURE__ */ (0, m.jsx)("span", {
1253
- className: `${Y.cropBorder} ${Y.cropBorderLeft}`,
1254
- onMouseDown: (t) => e(t, "l", "ew")
1255
- })
1256
- ] }), Ne = () => /* @__PURE__ */ (0, m.jsxs)("div", {
1257
- className: Y.cropLinesBox,
1258
- children: [/* @__PURE__ */ (0, m.jsx)("span", { className: `${Y.cropLine} ${Y.cropLineVertical}` }), /* @__PURE__ */ (0, m.jsx)("span", { className: `${Y.cropLine} ${Y.cropLineHorizontal}` })]
1259
- }), Pe = ({ onMouseDown: e }) => /* @__PURE__ */ (0, m.jsxs)(m.Fragment, { children: [
1260
- /* @__PURE__ */ (0, m.jsx)("span", {
1261
- className: `${Y.cropPointer} ${Y.cropPointerTopLeft}`,
1476
+ }, et = () => /* @__PURE__ */ (0, h.jsxs)("div", {
1477
+ className: X.linesBox,
1478
+ children: [/* @__PURE__ */ (0, h.jsx)("span", { className: `${X.line} ${X.lineV}` }), /* @__PURE__ */ (0, h.jsx)("span", { className: `${X.line} ${X.lineH}` })]
1479
+ }), tt = ({ onMouseDown: e }) => /* @__PURE__ */ (0, h.jsxs)(h.Fragment, { children: [
1480
+ /* @__PURE__ */ (0, h.jsx)("div", {
1481
+ className: `${X.pointer} ${X.pointerTopLeft}`,
1262
1482
  onMouseDown: (t) => e(t, "tl", "nwse")
1263
1483
  }),
1264
- /* @__PURE__ */ (0, m.jsx)("span", {
1265
- className: `${Y.cropPointer} ${Y.cropPointerTop}`,
1266
- onMouseDown: (t) => e(t, "t", "ns")
1267
- }),
1268
- /* @__PURE__ */ (0, m.jsx)("span", {
1269
- className: `${Y.cropPointer} ${Y.cropPointerTopRight}`,
1484
+ /* @__PURE__ */ (0, h.jsx)("div", {
1485
+ className: `${X.pointer} ${X.pointerTopRight}`,
1270
1486
  onMouseDown: (t) => e(t, "tr", "nesw")
1271
1487
  }),
1272
- /* @__PURE__ */ (0, m.jsx)("span", {
1273
- className: `${Y.cropPointer} ${Y.cropPointerRight}`,
1274
- onMouseDown: (t) => e(t, "r", "ew")
1275
- }),
1276
- /* @__PURE__ */ (0, m.jsx)("span", {
1277
- className: `${Y.cropPointer} ${Y.cropPointerBottomRight}`,
1488
+ /* @__PURE__ */ (0, h.jsx)("div", {
1489
+ className: `${X.pointer} ${X.pointerBottomRight}`,
1278
1490
  onMouseDown: (t) => e(t, "br", "nwse")
1279
1491
  }),
1280
- /* @__PURE__ */ (0, m.jsx)("span", {
1281
- className: `${Y.cropPointer} ${Y.cropPointerBottom}`,
1282
- onMouseDown: (t) => e(t, "b", "ns")
1283
- }),
1284
- /* @__PURE__ */ (0, m.jsx)("span", {
1285
- className: `${Y.cropPointer} ${Y.cropPointerBottomLeft}`,
1492
+ /* @__PURE__ */ (0, h.jsx)("div", {
1493
+ className: `${X.pointer} ${X.pointerBottomLeft}`,
1286
1494
  onMouseDown: (t) => e(t, "bl", "nesw")
1287
- }),
1288
- /* @__PURE__ */ (0, m.jsx)("span", {
1289
- className: `${Y.cropPointer} ${Y.cropPointerLeft}`,
1290
- onMouseDown: (t) => e(t, "l", "ew")
1291
1495
  })
1292
1496
  ] });
1293
1497
  //#endregion
1294
- //#region src/shared/components/ImageEditor/crop/useCropInteraction.ts
1295
- function Fe(e, t, n) {
1498
+ //#region src/shared/components/Pixedi/crop/useCropInteraction.ts
1499
+ function nt(e, t, n) {
1296
1500
  return Math.min(Math.max(e, t), n);
1297
1501
  }
1298
- function X(e, t) {
1299
- return e / t * 100;
1300
- }
1301
- function Ie(e, t, n, r, i) {
1502
+ function rt(e, { x: t, y: n, w: r, h: i }) {
1302
1503
  e.style.left = `${t}%`, e.style.top = `${n}%`, e.style.width = `${r}%`, e.style.height = `${i}%`;
1303
1504
  }
1304
- function Le(e, t, n, r, i) {
1305
- e.style.clipPath = `xywh(${t}% ${n}% ${r}% ${i}%)`;
1505
+ function it(e) {
1506
+ let { width: t, height: n } = e.getBoundingClientRect();
1507
+ return {
1508
+ frameW: t,
1509
+ frameH: n
1510
+ };
1306
1511
  }
1307
- var Re = ({ imgRef: e, cropRef: t }) => {
1308
- let { getCurrentAction: n, getLastHistoryItem: r } = N(), a = C(), o = s(null), c = s(""), l = s({
1309
- xPct: 0,
1310
- yPct: 0
1311
- }), u = s({
1312
- x: 0,
1313
- y: 0,
1314
- w: 0,
1315
- h: 0
1316
- });
1317
- return i(() => {
1318
- let i = (e) => {
1319
- if (t.current) {
1320
- let e = t.current.parentElement;
1321
- e && (l.current = {
1322
- xPct: X(t.current.offsetLeft, e.offsetWidth),
1323
- yPct: X(t.current.offsetTop, e.offsetHeight)
1324
- });
1325
- }
1326
- let n = "clientX" in e ? e.clientX : e.touches[0].clientX, r = "clientY" in e ? e.clientY : e.touches[0].clientY;
1327
- o.current = {
1328
- x: n,
1329
- y: r
1512
+ function at({ x: e, y: t, w: n, h: r }, i, a) {
1513
+ return {
1514
+ x: e / 100 * i,
1515
+ y: t / 100 * a,
1516
+ w: n / 100 * i,
1517
+ h: r / 100 * a
1518
+ };
1519
+ }
1520
+ function ot({ x: e, y: t, w: n, h: r }, i, a) {
1521
+ return {
1522
+ x: e / i * 100,
1523
+ y: t / a * 100,
1524
+ w: n / i * 100,
1525
+ h: r / a * 100
1526
+ };
1527
+ }
1528
+ var st = ({ boxRef: e }) => {
1529
+ let { currentAction: t, getLastHistoryItem: n, eventBus: i } = j(), s = S(), { width: c, height: l } = n(), u = t?.name === w.CROP, d = u ? t.args.ratio : 1, f = !u || t.args.isFree, p = a(() => je(d, c, l), [
1530
+ d,
1531
+ c,
1532
+ l
1533
+ ]), m = o(null), h = o(""), g = o(p), _ = o(p);
1534
+ return r(() => {
1535
+ g.current = p, Ye(i, p);
1536
+ }, [p, i]), r(() => {
1537
+ let t = (e, t) => {
1538
+ g.current = t, rt(e, t), Je(i, {
1539
+ x: Math.round(t.x / 100 * c),
1540
+ y: Math.round(t.y / 100 * l),
1541
+ w: Math.round(t.w / 100 * c),
1542
+ h: Math.round(t.h / 100 * l)
1543
+ }), Ye(i, t);
1544
+ }, n = (e) => {
1545
+ e.preventDefault(), _.current = g.current;
1546
+ let t = "clientX" in e ? e.clientX : e.touches[0].clientX, n = "clientY" in e ? e.clientY : e.touches[0].clientY;
1547
+ m.current = {
1548
+ x: t,
1549
+ y: n
1330
1550
  }, document.body.style.cursor = "move";
1331
- }, a = (n) => {
1332
- if (!e.current || !t.current || !o.current) return;
1333
- let r = t.current, i = e.current, a = r.parentElement;
1334
- if (!a) return;
1335
- let l = a.offsetWidth, u = a.offsetHeight;
1336
- if (c.current) {
1337
- s(n, r, i, l, u);
1551
+ }, r = (t) => {
1552
+ if (!e.current || !m.current) return;
1553
+ t.preventDefault();
1554
+ let n = e.current, r = n.parentElement;
1555
+ if (!r) return;
1556
+ let { frameW: i, frameH: s } = it(r);
1557
+ if (h.current) {
1558
+ a(t, n, i, s);
1338
1559
  return;
1339
1560
  }
1340
- d(n, r, i, l, u);
1341
- }, s = (e, t, i, a, s) => {
1342
- let l = n();
1343
- if (!l || l.name !== "crop" || !o.current) return;
1344
- let { isFree: d, ratio: f } = l.args, p = "clientX" in e ? e.clientX : e.touches[0].clientX, m = "clientY" in e ? e.clientY : e.touches[0].clientY, { x: h, y: g, w: _, h: v } = Ee(c.current, d, f, o.current.x, o.current.y, p, m, a, s, u.current, t), y = X(h, a), b = X(g, s), x = X(_, a), S = X(v, s);
1345
- Ie(t, y, b, x, S), Le(i, y, b, x, S);
1346
- let C = r();
1347
- if (!C) return;
1348
- let { width: w, height: T } = C;
1349
- Ae({
1350
- x: Math.round(y / 100 * w),
1351
- y: Math.round(b / 100 * T),
1352
- w: Math.round(x / 100 * w),
1353
- h: Math.round(S / 100 * T)
1354
- });
1355
- }, d = (e, t, n, i, a) => {
1356
- if (!o.current) return;
1357
- let s = t.offsetWidth, c = t.offsetHeight, u = "clientX" in e ? e.clientX : e.touches[0].clientX, d = "clientY" in e ? e.clientY : e.touches[0].clientY, f = X(u - o.current.x, i), p = X(d - o.current.y, a);
1358
- o.current = {
1359
- x: u,
1360
- y: d
1361
- };
1362
- let m = X(i - s, i), h = X(a - c, a), g = Fe(l.current.xPct + f, 0, m), _ = Fe(l.current.yPct + p, 0, h), v = X(s, i), y = X(c, a);
1363
- l.current = {
1364
- xPct: g,
1365
- yPct: _
1366
- }, Ie(t, g, _, v, y), Le(n, g, _, v, y);
1367
- let { width: b, height: x } = r();
1368
- Ae({
1369
- x: Math.round(g / 100 * b),
1370
- y: Math.round(_ / 100 * x),
1371
- w: Math.round(v / 100 * b),
1372
- h: Math.round(y / 100 * x)
1561
+ o(t, n, i, s);
1562
+ }, a = (e, n, r, i) => {
1563
+ if (!m.current) return;
1564
+ let a = "clientX" in e ? e.clientX : e.touches[0].clientX, o = "clientY" in e ? e.clientY : e.touches[0].clientY, s = ot(Ae(h.current, f, d, m.current.x, m.current.y, a, o, r, i, at(_.current, r, i), at(g.current, r, i)), r, i);
1565
+ t(n, f ? s : Me(s, d, c, l));
1566
+ }, o = (e, n, r, i) => {
1567
+ if (!m.current) return;
1568
+ let { x: a, y: o, w: s, h: c } = _.current, l = "clientX" in e ? e.clientX : e.touches[0].clientX, u = "clientY" in e ? e.clientY : e.touches[0].clientY, d = (l - m.current.x) / r * 100, f = (u - m.current.y) / i * 100;
1569
+ t(n, {
1570
+ x: nt(a + d, 0, Math.max(0, 100 - s)),
1571
+ y: nt(o + f, 0, Math.max(0, 100 - c)),
1572
+ w: s,
1573
+ h: c
1373
1574
  });
1374
- }, f = () => {
1375
- t.current && (o.current = null, c.current = "", t.current.style.cursor = "move", document.body.style.cursor = "auto");
1575
+ }, s = () => {
1576
+ e.current && (m.current = null, h.current = "", e.current.style.cursor = "move", document.body.style.cursor = "auto");
1376
1577
  };
1377
- if (!t.current) return;
1378
- let p = new AbortController(), { signal: m } = p;
1379
- return t.current.addEventListener("mousedown", i, { signal: m }), t.current.addEventListener("touchstart", i, { signal: m }), document.addEventListener("mousemove", a, { signal: m }), document.addEventListener("touchmove", a, { signal: m }), document.addEventListener("mouseup", f, { signal: m }), document.addEventListener("touchend", f, { signal: m }), () => p.abort();
1578
+ if (!e.current) return;
1579
+ let u = new AbortController(), { signal: p } = u;
1580
+ return e.current.addEventListener("mousedown", n, { signal: p }), e.current.addEventListener("touchstart", n, {
1581
+ signal: p,
1582
+ passive: !1
1583
+ }), document.addEventListener("mousemove", r, { signal: p }), document.addEventListener("touchmove", r, {
1584
+ signal: p,
1585
+ passive: !1
1586
+ }), document.addEventListener("mouseup", s, { signal: p }), document.addEventListener("touchend", s, { signal: p }), () => u.abort();
1380
1587
  }, [
1381
- n,
1382
- r,
1588
+ f,
1589
+ d,
1590
+ c,
1591
+ l,
1383
1592
  e,
1384
- t
1385
- ]), { handleCropStart: (e, n, r) => {
1386
- if (!t.current) return;
1387
- e.stopPropagation(), u.current = {
1388
- x: t.current.offsetLeft,
1389
- y: t.current.offsetTop,
1390
- w: t.current.offsetWidth,
1391
- h: t.current.offsetHeight
1392
- };
1393
- let i = "clientX" in e ? e.clientX : e.touches[0].clientX, s = "clientY" in e ? e.clientY : e.touches[0].clientY;
1394
- o.current = {
1395
- x: i,
1396
- y: s
1397
- }, c.current = n, a || (t.current.style.cursor = `${r}-resize`, document.body.style.cursor = `${r}-resize`);
1398
- } };
1399
- }, ze = ({ onMouseDown: e }) => /* @__PURE__ */ (0, m.jsx)("div", {
1400
- className: Y.cropMobileBorder,
1401
- children: /* @__PURE__ */ (0, m.jsx)("div", {
1402
- className: Y.cropMobilePointer,
1593
+ i
1594
+ ]), {
1595
+ handleCropStart: (t, n, r) => {
1596
+ if (!e.current) return;
1597
+ t.stopPropagation(), t.preventDefault(), _.current = g.current;
1598
+ let i = "clientX" in t ? t.clientX : t.touches[0].clientX, a = "clientY" in t ? t.clientY : t.touches[0].clientY;
1599
+ m.current = {
1600
+ x: i,
1601
+ y: a
1602
+ }, h.current = n, s || (e.current.style.cursor = `${r}-resize`, document.body.style.cursor = `${r}-resize`);
1603
+ },
1604
+ initialCrop: p
1605
+ };
1606
+ }, ct = ({ onMouseDown: e }) => /* @__PURE__ */ (0, h.jsx)("div", {
1607
+ className: X.mobileBorder,
1608
+ children: /* @__PURE__ */ (0, h.jsx)("div", {
1609
+ className: X.mobilePointer,
1403
1610
  onTouchStart: (t) => e(t, "br", "nwse")
1404
1611
  })
1405
1612
  }), Z = {
1406
- flip: "_flip_70quv_1",
1407
- flipBtnH: "_flipBtnH_70quv_14",
1408
- flipBtnV: "_flipBtnV_70quv_20"
1409
- }, Be = ({ frameRef: e }) => {
1410
- let { getLastHistoryItem: t, setCurrentAction: n, addToHistory: r, setSidebar: i } = N(), { flip: a } = x(), [o, s] = c(!1), [u, d] = c(!1), [f, p] = c(!1), { base64: h, width: g, height: _ } = t(), v = () => {
1411
- e.current && (e.current.style.transition = "transform 0.2s ease");
1412
- }, y = () => {
1413
- e.current && (e.current.style.transition = "none");
1414
- }, b = (t = !1, n = !1) => {
1415
- e.current && (e.current.style.transform = `scale(${t ? -1 : 1}, ${n ? -1 : 1})`);
1416
- };
1417
- return /* @__PURE__ */ (0, m.jsxs)("div", {
1613
+ flip: "_flip_17ic5_1",
1614
+ btnH: "_btnH_17ic5_14",
1615
+ btnV: "_btnV_17ic5_20"
1616
+ }, lt = () => {
1617
+ let { getLastHistoryItem: e, setCurrentAction: t, addToHistory: n, setSidebar: r } = j(), [i, a] = s(!1), [o, c] = s(!1), { width: l, height: u } = e();
1618
+ return /* @__PURE__ */ (0, h.jsxs)("div", {
1418
1619
  className: Z.flip,
1419
- children: [/* @__PURE__ */ (0, m.jsxs)("div", {
1620
+ children: [/* @__PURE__ */ (0, h.jsxs)("div", {
1420
1621
  className: Z.scGroup,
1421
- children: [/* @__PURE__ */ (0, m.jsx)(F, {
1622
+ children: [/* @__PURE__ */ (0, h.jsx)(N, {
1422
1623
  variant: "outline",
1423
- className: `${Z.flipBtnH}`,
1424
- disabled: o,
1624
+ className: `${Z.btnH}`,
1425
1625
  onClick: () => {
1426
- d((e) => !e), v(), b(!u, f);
1626
+ a((e) => !e), t({
1627
+ name: w.FLIP,
1628
+ args: {
1629
+ horizontal: !i,
1630
+ vertical: o
1631
+ }
1632
+ });
1427
1633
  },
1428
- children: /* @__PURE__ */ (0, m.jsx)(oe, { style: { color: u ? "var(--accent-blue)" : "var(--foreground)" } })
1429
- }), /* @__PURE__ */ (0, m.jsx)(F, {
1634
+ children: /* @__PURE__ */ (0, h.jsx)(le, { style: { color: i ? "var(--accent-blue)" : "var(--foreground)" } })
1635
+ }), /* @__PURE__ */ (0, h.jsx)(N, {
1430
1636
  variant: "outline",
1431
- className: `${Z.flipBtnV} `,
1432
- disabled: o,
1637
+ className: `${Z.btnV} `,
1433
1638
  onClick: () => {
1434
- p((e) => !e), v(), b(u, !f);
1639
+ c((e) => !e), t({
1640
+ name: w.FLIP,
1641
+ args: {
1642
+ horizontal: i,
1643
+ vertical: !o
1644
+ }
1645
+ });
1435
1646
  },
1436
- children: /* @__PURE__ */ (0, m.jsx)(se, { style: { color: f ? "var(--accent-blue)" : "var(--foreground)" } })
1647
+ children: /* @__PURE__ */ (0, h.jsx)(ue, { style: { color: o ? "var(--accent-blue)" : "var(--foreground)" } })
1437
1648
  })]
1438
- }), /* @__PURE__ */ (0, m.jsx)(H, {
1439
- saving: o,
1440
- disabled: o || !u && !f,
1441
- onSave: async () => {
1442
- try {
1443
- s(!0);
1444
- let e = await a(h, u, f);
1445
- y(), l(() => {
1446
- r({
1447
- name: "Flip",
1448
- base64: e,
1449
- width: g,
1450
- height: _
1451
- });
1452
- }), b(!1, !1), d(!1), p(!1), i(!0);
1453
- } catch (e) {
1454
- console.error("Failed to process image:", e);
1455
- } finally {
1456
- s(!1);
1457
- }
1649
+ }), /* @__PURE__ */ (0, h.jsx)(L, {
1650
+ disabled: !i && !o,
1651
+ onSave: () => {
1652
+ n({
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);
1458
1663
  },
1459
1664
  onClose: () => {
1460
- n(null), v(), b(!1, !1), i(!0);
1665
+ t(null), r(!0);
1461
1666
  }
1462
1667
  })]
1463
1668
  });
1464
1669
  }, Q = {
1465
- frame: "_frame_ihor9_1",
1466
- framePreview: "_framePreview_ihor9_13",
1467
- frameImage: "_frameImage_ihor9_25",
1468
- frameImageFaded: "_frameImageFaded_ihor9_30"
1469
- }, Ve = () => {
1470
- let { getLastHistoryItem: e, currentAction: t } = N(), n = s(null), r = s(null), { width: i, height: a, base64: o } = e(), c = t?.name === "crop", l = t?.name === "resize", u = t?.name === "flip", d = c, f = `${Q.frame} ${d ? I.mask : ""}`, p = `${Q.frameImage} ${d ? Q.frameImageFaded : ""}`;
1471
- return /* @__PURE__ */ (0, m.jsxs)("div", {
1472
- className: f,
1670
+ rotate: "_rotate_gkt07_1",
1671
+ btnH: "_btnH_gkt07_14",
1672
+ btnV: "_btnV_gkt07_20"
1673
+ }, ut = () => {
1674
+ let { getLastRotation: e, getLastHistoryItem: t, addToHistory: n, setSidebar: r, setCurrentAction: i } = j(), { width: a, height: s } = t(), c = e(), l = o(c), u = o(c), d = (e) => {
1675
+ u.current += e, i({
1676
+ name: "rotate",
1677
+ args: { degrees: u.current }
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, {
1685
+ variant: "outline",
1686
+ className: `${Q.btnH}`,
1687
+ onClick: () => d(90),
1688
+ children: /* @__PURE__ */ (0, h.jsx)(de, {})
1689
+ }), /* @__PURE__ */ (0, h.jsx)(N, {
1690
+ variant: "outline",
1691
+ className: `${Q.btnV} `,
1692
+ onClick: () => d(-90),
1693
+ children: /* @__PURE__ */ (0, h.jsx)(fe, {})
1694
+ })]
1695
+ }), /* @__PURE__ */ (0, h.jsx)(L, {
1696
+ onSave: async () => {
1697
+ n({
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
+ }
1708
+ })]
1709
+ });
1710
+ }, dt = { frame: "_frame_xffug_1" }, ft = () => {
1711
+ let { currentAction: e } = j(), t = e?.name === w.CROP, n = e?.name === w.RESIZE, r = e?.name === w.FLIP, i = e?.name === w.ROTATE, a = t;
1712
+ return /* @__PURE__ */ (0, h.jsxs)("div", {
1713
+ className: `${dt.frame} ${a ? P.mask : ""}`,
1473
1714
  children: [
1474
- /* @__PURE__ */ (0, m.jsxs)("div", {
1475
- ref: n,
1476
- style: { aspectRatio: `${i} / ${a}` },
1477
- className: Q.framePreview,
1478
- children: [/* @__PURE__ */ (0, m.jsx)("img", {
1479
- ref: r,
1480
- src: o,
1481
- alt: "Image",
1482
- className: p
1483
- }), c && /* @__PURE__ */ (0, m.jsx)(Oe, {}, t?.args?.id)]
1484
- }),
1485
- l && /* @__PURE__ */ (0, m.jsx)(_e, { frameRef: n }),
1486
- c && /* @__PURE__ */ (0, m.jsx)(je, {}),
1487
- u && /* @__PURE__ */ (0, m.jsx)(Be, { frameRef: n })
1715
+ /* @__PURE__ */ (0, h.jsx)(Ze, { style: t ? { opacity: .4 } : {} }),
1716
+ t && /* @__PURE__ */ (0, h.jsx)(Qe, {}, e?.args?.id),
1717
+ n && /* @__PURE__ */ (0, h.jsx)(Xe, {}),
1718
+ t && /* @__PURE__ */ (0, h.jsx)($e, {}),
1719
+ r && /* @__PURE__ */ (0, h.jsx)(lt, {}),
1720
+ i && /* @__PURE__ */ (0, h.jsx)(ut, {})
1488
1721
  ]
1489
1722
  });
1490
1723
  }, $ = {
1491
- sidebar: "_sidebar_1obd8_1",
1492
- sidebarSettings: "_sidebarSettings_1obd8_11",
1493
- sidebarContainer: "_sidebarContainer_1obd8_25",
1494
- sidebarContent: "_sidebarContent_1obd8_31",
1495
- sidebarCloseBtn: "_sidebarCloseBtn_1obd8_47",
1496
- sidebarSeparator: "_sidebarSeparator_1obd8_52",
1497
- sidebarResize: "_sidebarResize_1obd8_56",
1498
- sidebarResizeIcon: "_sidebarResizeIcon_1obd8_61",
1499
- sidebarResizeSize: "_sidebarResizeSize_1obd8_66",
1500
- sidebarCrop: "_sidebarCrop_1obd8_70",
1501
- sidebarCropRatios: "_sidebarCropRatios_1obd8_75",
1502
- sidebarPreset: "_sidebarPreset_1obd8_80"
1503
- }, He = () => {
1504
- let { getLastHistoryItem: e, setCurrentAction: t, setSidebar: n } = N(), { width: r, height: i } = e() ?? {
1724
+ sidebar: "_sidebar_8qtha_1",
1725
+ settings: "_settings_8qtha_11",
1726
+ container: "_container_8qtha_25",
1727
+ content: "_content_8qtha_31",
1728
+ closeBtn: "_closeBtn_8qtha_47",
1729
+ separator: "_separator_8qtha_52",
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() ?? {
1505
1739
  width: 0,
1506
1740
  height: 0
1507
1741
  };
1508
- return /* @__PURE__ */ (0, m.jsxs)(F, {
1742
+ return /* @__PURE__ */ (0, h.jsxs)(N, {
1509
1743
  variant: "outline",
1510
- className: $.sidebarResize,
1744
+ className: $.resize,
1511
1745
  onClick: () => {
1512
1746
  t({
1513
- name: "resize",
1747
+ name: w.RESIZE,
1514
1748
  args: {
1515
1749
  width: r,
1516
1750
  height: i
1517
1751
  }
1518
1752
  }), n(!1);
1519
1753
  },
1520
- children: [/* @__PURE__ */ (0, m.jsxs)("div", {
1521
- className: $.sidebarResizeIcon,
1522
- children: [/* @__PURE__ */ (0, m.jsx)(ae, {}), "Resize"]
1523
- }), /* @__PURE__ */ (0, m.jsxs)("div", {
1524
- className: $.sidebarResizeSize,
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,
1525
1759
  children: [
1526
1760
  r,
1527
1761
  " x ",
@@ -1529,165 +1763,61 @@ var Re = ({ imgRef: e, cropRef: t }) => {
1529
1763
  ]
1530
1764
  })]
1531
1765
  });
1532
- }, Ue = () => {
1533
- let { currentAction: e, setCurrentAction: t, getLastHistoryItem: n, setSidebar: r } = N(), { name: i, args: a } = e || {}, o = i === "crop" ? a?.id : "", { width: s, height: c } = n(), l = s / c, u = (e) => {
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) => {
1534
1768
  e !== o && (t({
1535
1769
  name: "crop",
1536
1770
  args: {
1537
1771
  id: e,
1538
1772
  ratio: e === "1:1" ? 1 : l,
1539
- isFree: e === "freeform",
1540
- preset: null
1773
+ isFree: e === "freeform"
1541
1774
  }
1542
1775
  }), r(!1));
1543
1776
  };
1544
- return /* @__PURE__ */ (0, m.jsxs)("div", {
1545
- className: $.sidebarCrop,
1546
- children: [/* @__PURE__ */ (0, m.jsx)("h4", { children: "Crop" }), /* @__PURE__ */ (0, m.jsxs)("div", {
1547
- className: $.sidebarCropRatios,
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,
1548
1781
  children: [
1549
- /* @__PURE__ */ (0, m.jsx)(L, {
1782
+ /* @__PURE__ */ (0, h.jsx)(me, {
1550
1783
  label: "Freeform",
1551
- icon: /* @__PURE__ */ (0, m.jsx)(ne, {}),
1784
+ icon: /* @__PURE__ */ (0, h.jsx)(oe, {}),
1552
1785
  active: o === "freeform",
1553
1786
  onClick: () => u("freeform")
1554
1787
  }),
1555
- /* @__PURE__ */ (0, m.jsx)(L, {
1788
+ /* @__PURE__ */ (0, h.jsx)(me, {
1556
1789
  label: "Original",
1557
- icon: /* @__PURE__ */ (0, m.jsx)(re, {}),
1790
+ icon: /* @__PURE__ */ (0, h.jsx)(se, {}),
1558
1791
  active: o === "original",
1559
1792
  onClick: () => u("original")
1560
1793
  }),
1561
- /* @__PURE__ */ (0, m.jsx)(L, {
1794
+ /* @__PURE__ */ (0, h.jsx)(me, {
1562
1795
  label: "1:1",
1563
- icon: /* @__PURE__ */ (0, m.jsx)(ie, {}),
1796
+ icon: /* @__PURE__ */ (0, h.jsx)(ce, {}),
1564
1797
  active: o === "1:1",
1565
1798
  onClick: () => u("1:1")
1566
1799
  })
1567
1800
  ]
1568
1801
  })]
1569
1802
  });
1570
- }, We = [
1571
- {
1572
- label: "Facebook",
1573
- value: "facebook",
1574
- options: [
1575
- {
1576
- value: "facebook-post",
1577
- label: "Post",
1578
- w: 1200,
1579
- h: 630,
1580
- rightLabel: "1200 x 630"
1581
- },
1582
- {
1583
- value: "facebook-cover",
1584
- label: "Cover",
1585
- w: 851,
1586
- h: 315,
1587
- rightLabel: "851 x 315"
1588
- },
1589
- {
1590
- value: "facebook-profile",
1591
- label: "Profile",
1592
- w: 170,
1593
- h: 170,
1594
- rightLabel: "170 x 170"
1595
- },
1596
- {
1597
- value: "facebook-story",
1598
- label: "Story",
1599
- w: 1080,
1600
- h: 1920,
1601
- rightLabel: "1080 x 1920"
1602
- }
1603
- ]
1604
- },
1605
- {
1606
- label: "Instagram",
1607
- value: "instagram",
1608
- options: [
1609
- {
1610
- value: "instagram-landscape",
1611
- label: "Landscape",
1612
- w: 1080,
1613
- h: 566,
1614
- rightLabel: "1080 x 566"
1615
- },
1616
- {
1617
- value: "instagram-portait",
1618
- label: "Portait",
1619
- w: 1080,
1620
- h: 1350,
1621
- rightLabel: "1080 x 1350"
1622
- },
1623
- {
1624
- value: "instagram-square",
1625
- label: "Square",
1626
- w: 1080,
1627
- h: 1080,
1628
- rightLabel: "1080 x 1080"
1629
- },
1630
- {
1631
- value: "instagram-story",
1632
- label: "Story",
1633
- w: 1080,
1634
- h: 1920,
1635
- rightLabel: "1080 x 1920"
1636
- },
1637
- {
1638
- value: "instagram-thumbnail",
1639
- label: "Thumbnail",
1640
- w: 161,
1641
- h: 161,
1642
- rightLabel: "161 x 161"
1643
- }
1644
- ]
1645
- },
1646
- {
1647
- label: "LinkedIn",
1648
- value: "linkedin",
1649
- options: [
1650
- {
1651
- value: "linkedin-blog-post",
1652
- label: "Blog Post",
1653
- w: 1200,
1654
- h: 627,
1655
- rightLabel: "1200 x 627"
1656
- },
1657
- {
1658
- value: "linkedin-cover",
1659
- label: "Cover",
1660
- w: 1128,
1661
- h: 191,
1662
- rightLabel: "1128 x 191"
1663
- },
1664
- {
1665
- value: "linkedin-profile",
1666
- label: "Profile",
1667
- w: 400,
1668
- h: 400,
1669
- rightLabel: "400 x 400"
1670
- }
1671
- ]
1672
- }
1673
- ], Ge = We.map((e) => e.options).flat(), Ke = () => {
1674
- let { setCurrentAction: e, currentAction: t, setSidebar: n } = N(), r = t?.name === "crop" && Ge.some((e) => e.value === t.args.id) ? t.args.id : "";
1675
- return /* @__PURE__ */ (0, m.jsxs)("div", {
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", {
1676
1806
  className: $.sidebarPreset,
1677
- children: [/* @__PURE__ */ (0, m.jsx)("h4", { children: "Presets" }), /* @__PURE__ */ (0, m.jsx)("div", { children: /* @__PURE__ */ (0, m.jsx)(de, {
1807
+ children: [/* @__PURE__ */ (0, h.jsx)("h4", { children: "Presets" }), /* @__PURE__ */ (0, h.jsx)("div", { children: /* @__PURE__ */ (0, h.jsx)(ge, {
1678
1808
  value: r,
1679
1809
  placeholder: "Select a preset",
1680
1810
  onChange: (t) => {
1681
1811
  if (!t) return;
1682
- let r = We.map((e) => e.options).flat().find((e) => e.value === t);
1812
+ let r = Te.map((e) => e.options).flat().find((e) => e.value === t);
1683
1813
  if (!r) return;
1684
1814
  let i = {
1685
1815
  id: t,
1686
1816
  ratio: r.w / r.h,
1687
1817
  isFree: !1,
1688
1818
  preset: {
1689
- w: r.w,
1690
- h: r.h
1819
+ width: r.w,
1820
+ height: r.h
1691
1821
  }
1692
1822
  };
1693
1823
  e({
@@ -1695,96 +1825,127 @@ var Re = ({ imgRef: e, cropRef: t }) => {
1695
1825
  args: i
1696
1826
  }), n(!1);
1697
1827
  },
1698
- items: We
1828
+ items: Te
1699
1829
  }) })]
1700
1830
  });
1701
- }, qe = () => {
1702
- let { setCurrentAction: e, setSidebar: t } = N();
1703
- return /* @__PURE__ */ (0, m.jsx)(F, {
1831
+ }, _t = () => {
1832
+ let { setCurrentAction: e, setSidebar: t } = j();
1833
+ return /* @__PURE__ */ (0, h.jsx)(N, {
1704
1834
  variant: "outline",
1705
- className: $.sidebarResize,
1835
+ className: $.resize,
1706
1836
  onClick: () => {
1707
1837
  e({
1708
- name: "flip",
1709
- args: null
1838
+ name: w.FLIP,
1839
+ args: {
1840
+ horizontal: !1,
1841
+ vertical: !1
1842
+ }
1710
1843
  }), t(!1);
1711
1844
  },
1712
- children: /* @__PURE__ */ (0, m.jsxs)("div", {
1713
- className: $.sidebarResizeIcon,
1714
- children: [/* @__PURE__ */ (0, m.jsx)(oe, {}), "Flip"]
1845
+ children: /* @__PURE__ */ (0, h.jsxs)("div", {
1846
+ className: $.resizeIcon,
1847
+ children: [/* @__PURE__ */ (0, h.jsx)(le, {}), "Flip"]
1715
1848
  })
1716
1849
  });
1717
- }, Je = () => {
1718
- let { getSidebar: e, setSidebar: t } = N(), n = e(), r = T("md");
1719
- return /* @__PURE__ */ (0, m.jsxs)(m.Fragment, { children: [/* @__PURE__ */ (0, m.jsx)(F, {
1850
+ }, vt = () => {
1851
+ let { getLastRotation: e, setCurrentAction: t, setSidebar: n } = j();
1852
+ return /* @__PURE__ */ (0, h.jsx)(N, {
1720
1853
  variant: "outline",
1721
- className: $.sidebarSettings,
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
+ })
1865
+ });
1866
+ }, yt = () => {
1867
+ let { sidebar: e, setSidebar: t } = j(), n = ee("md");
1868
+ return /* @__PURE__ */ (0, h.jsxs)(h.Fragment, { children: [/* @__PURE__ */ (0, h.jsx)(N, {
1869
+ variant: "outline",
1870
+ className: $.settings,
1722
1871
  onClick: () => t(!0),
1723
- children: /* @__PURE__ */ (0, m.jsx)(M, {})
1724
- }), /* @__PURE__ */ (0, m.jsx)("div", {
1872
+ children: /* @__PURE__ */ (0, h.jsx)(ae, {})
1873
+ }), /* @__PURE__ */ (0, h.jsx)("div", {
1725
1874
  className: $.sidebar,
1726
- style: { transform: r && n ? "translateX(-320px)" : "translateX(0%)" },
1727
- children: /* @__PURE__ */ (0, m.jsx)("div", {
1728
- className: $.sidebarContainer,
1729
- children: /* @__PURE__ */ (0, m.jsxs)("div", {
1730
- className: $.sidebarContent,
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,
1731
1880
  children: [
1732
- r && /* @__PURE__ */ (0, m.jsx)(F, {
1881
+ n && /* @__PURE__ */ (0, h.jsx)(N, {
1733
1882
  variant: "ghost",
1734
- className: `${$.sidebarCloseBtn} ${P.rect}`,
1883
+ className: `${$.closeBtn} ${M.rect}`,
1735
1884
  onClick: () => t(!1),
1736
- children: /* @__PURE__ */ (0, m.jsx)(O, {})
1885
+ children: /* @__PURE__ */ (0, h.jsx)(te, {})
1737
1886
  }),
1738
- /* @__PURE__ */ (0, m.jsx)(He, {}),
1739
- /* @__PURE__ */ (0, m.jsx)(R, { className: $.sidebarSeparator }),
1740
- /* @__PURE__ */ (0, m.jsx)(Ue, {}),
1741
- /* @__PURE__ */ (0, m.jsx)(R, { className: $.sidebarSeparator }),
1742
- /* @__PURE__ */ (0, m.jsx)(Ke, {}),
1743
- /* @__PURE__ */ (0, m.jsx)(R, { className: $.sidebarSeparator }),
1744
- /* @__PURE__ */ (0, m.jsx)(qe, {})
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
+ })
1745
1897
  ]
1746
1898
  })
1747
1899
  })
1748
1900
  })] });
1749
- }, Ye = ({ image: e, onSave: t, onBack: n, theme: r = "light" }) => {
1750
- let { loading: i, error: a, width: o, height: s, base64: c, extension: l } = b(e);
1751
- return i || a || !c || !l ? /* @__PURE__ */ (0, m.jsx)("div", {
1752
- className: `${I.root} ${I.wrapper}`,
1901
+ }, bt = ({ image: e, onSave: t, onBack: n, theme: r = "light", settings: i = u }) => {
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}`,
1753
1905
  "data-theme": r,
1754
- children: /* @__PURE__ */ (0, m.jsxs)("div", {
1755
- className: I.system,
1906
+ children: /* @__PURE__ */ (0, h.jsxs)("div", {
1907
+ className: P.system,
1756
1908
  children: [
1757
- i && /* @__PURE__ */ (0, m.jsx)(h, { size: 48 }),
1758
- a && /* @__PURE__ */ (0, m.jsx)("div", {
1759
- className: I.textRed,
1760
- children: a
1909
+ a && /* @__PURE__ */ (0, h.jsx)(A, { style: {
1910
+ width: 48,
1911
+ height: 48
1912
+ } }),
1913
+ o && /* @__PURE__ */ (0, h.jsx)("div", {
1914
+ className: P.textRed,
1915
+ children: o
1761
1916
  }),
1762
- !i && !a && (!c || !l) && /* @__PURE__ */ (0, m.jsx)("div", {
1763
- className: I.textRed,
1917
+ !a && !o && (!d || !s) && /* @__PURE__ */ (0, h.jsx)("div", {
1918
+ className: P.textRed,
1764
1919
  children: "Failed to load image."
1765
1920
  })
1766
1921
  ]
1767
1922
  })
1768
- }) : /* @__PURE__ */ (0, m.jsx)(v, {
1769
- base64: c,
1770
- width: o,
1771
- height: s,
1772
- ext: l,
1773
- children: /* @__PURE__ */ (0, m.jsx)("div", {
1774
- className: `${I.root} ${I.wrapper}`,
1923
+ }) : /* @__PURE__ */ (0, h.jsx)(g, {
1924
+ mimeType: s,
1925
+ width: c,
1926
+ height: l,
1927
+ originalBlob: d,
1928
+ previewUrl: f,
1929
+ isAlpha: p,
1930
+ settings: {
1931
+ ...u,
1932
+ ...i
1933
+ },
1934
+ children: /* @__PURE__ */ (0, h.jsx)("div", {
1935
+ className: `${P.root} ${P.wrapper}`,
1775
1936
  "data-theme": r,
1776
- children: /* @__PURE__ */ (0, m.jsxs)("div", {
1777
- className: I.main,
1778
- children: [/* @__PURE__ */ (0, m.jsx)(he, {
1937
+ children: /* @__PURE__ */ (0, h.jsxs)("div", {
1938
+ className: P.main,
1939
+ children: [/* @__PURE__ */ (0, h.jsx)(qe, {
1779
1940
  onSave: t,
1780
1941
  onBack: n
1781
- }), /* @__PURE__ */ (0, m.jsxs)("div", {
1782
- className: I.grid,
1783
- children: [/* @__PURE__ */ (0, m.jsx)(Ve, {}), /* @__PURE__ */ (0, m.jsx)(Je, {})]
1942
+ }), /* @__PURE__ */ (0, h.jsxs)("div", {
1943
+ className: P.grid,
1944
+ children: [/* @__PURE__ */ (0, h.jsx)(ft, {}), /* @__PURE__ */ (0, h.jsx)(yt, {})]
1784
1945
  })]
1785
1946
  })
1786
1947
  })
1787
1948
  });
1788
1949
  };
1789
1950
  //#endregion
1790
- export { Ye as Pixedi };
1951
+ export { bt as Pixedi };