pixedi 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 1.5.1
6
+
7
+ - Replace tooltip prop `orientation` with `position`.
8
+
5
9
  ## 1.5.0
6
10
 
7
11
  - Add SurfaceTool component.
package/dist/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`._button_1vpzl_1{cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;box-sizing:border-box;background-color:#0000;border:1px solid #0000;border-radius:4px;justify-content:center;align-items:center;gap:8px;height:32px;padding:0 8px;font-family:inherit;font-size:14px;font-weight:500;transition:background-color .2s,border-color .2s,opacity .2s;display:inline-flex}._button_1vpzl_1:disabled{pointer-events:none;opacity:.5}._button_1vpzl_1 svg{flex-shrink:0;width:16px;height:16px}._default_1vpzl_35{background-color:var(--primary);color:var(--primary-foreground)}._default_1vpzl_35:hover{opacity:.9}._outline_1vpzl_44{border-color:var(--border);background-color:var(--background);color:var(--foreground)}._outline_1vpzl_44:hover{background-color:var(--secondary)}._ghost_1vpzl_54{color:var(--foreground);padding:0 8px}._ghost_1vpzl_54:hover{background-color:var(--secondary)}._rect_1vpzl_63{width:32px;height:32px}._separator_gp8ff_1{background-color:var(--border);box-sizing:border-box;border:none;flex-shrink:0;display:block}._separator_gp8ff_1[data-orientation=horizontal]{width:100%;height:1px}._separator_gp8ff_1[data-orientation=vertical]{align-self:stretch;width:1px;height:100%;margin:0}._wrapper_1aw0m_1{box-sizing:border-box;width:100%;position:relative}._trigger_1aw0m_6{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--border);cursor:pointer;box-sizing:border-box;-webkit-user-select:none;user-select:none;border-radius:4px;outline:none;justify-content:space-between;align-items:center;padding:0 8px 0 10px;font-family:inherit;font-size:14px;transition:border-color .2s;display:flex}._trigger_1aw0m_6:hover,._trigger_1aw0m_6:focus{border-color:var(--muted-foreground)}._triggerArrow_1aw0m_31{width:16px;height:16px;color:var(--muted-foreground);transition:transform .2s}._wrapper_1aw0m_1[data-state=open] ._triggerArrow_1aw0m_31{transform:rotate(180deg)}._content_1aw0m_40{background-color:var(--background);border:1px solid var(--border);z-index:50;box-sizing:border-box;border-radius:4px;width:100%;max-height:282px;padding:4px;position:absolute;top:calc(100% + 4px);left:0;overflow-y:auto;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}._content_1aw0m_40::-webkit-scrollbar{width:4px}._content_1aw0m_40::-webkit-scrollbar-track{background:0 0}._content_1aw0m_40::-webkit-scrollbar-thumb{background-color:var(--border);border-radius:10px}._wrapper_1aw0m_1[data-state=closed] ._content_1aw0m_40{display:none}._groupLabel_1aw0m_74{color:var(--muted-foreground);-webkit-user-select:none;user-select:none;padding:8px 10px;font-size:12px;font-weight:500}._item_1aw0m_81{width:100%;color:var(--foreground);cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;background:0 0;border-radius:4px;justify-content:space-between;align-items:center;padding:4px 10px;display:flex}._item_1aw0m_81:hover{background-color:var(--secondary)}._itemLeft_1aw0m_98{font-size:14px;font-weight:400}._itemAddon_1aw0m_102{align-items:center;gap:8px;display:flex}._itemAddon_1aw0m_102 span{color:var(--muted-foreground);font-size:12px}._itemAddon_1aw0m_102 svg{font-size:14px}._itemAddon_1aw0m_102 b{flex-shrink:0;width:16px;height:16px}._itemRightContainer_1aw0m_122{align-items:center;gap:8px;display:flex}._itemRight_1aw0m_122{color:var(--muted-foreground);font-size:14px}._itemCheck_1aw0m_131{width:16px;height:16px;color:var(--foreground);flex-shrink:0}:host{height:100%;display:block}:host *{box-sizing:border-box}._root_c6gk7_8{width:100%;height:100%;font-size:16px;font-family:var(--font-sans);--font-sans:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, Helvetica, Arial, sans-serif;--font-mono:"Courier New", Courier, monospace;--color-white:#fff;--color-white-fade:color-mix(in srgb, var(--color-white) 40%, transparent);--color-black:#000;--color-red:oklch(63.7% .237 25.331);--color-green:oklch(76.8% .188 151.716);--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(75.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--accent-blue:oklch(60.9% .221 251.687);--accent-blue-light:oklch(96% .02 250);--accent-blue-fade:color-mix(in srgb, var(--accent-blue) 60%, transparent);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 50%, transparent);--overlay-bg-white:color-mix(in srgb, var(--color-white) 80%, transparent);position:relative}._root_c6gk7_8[data-theme=dark]{--background:oklch(24.5% 0 0);--foreground:oklch(78.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(24.5% 0 0);--muted-foreground:oklch(50% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--accent-blue-light:oklch(25% .06 250);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 75%, transparent)}._root_c6gk7_8 h1,._root_c6gk7_8 h2,._root_c6gk7_8 h3,._root_c6gk7_8 h4,._root_c6gk7_8 h5,._root_c6gk7_8 h6{color:var(--foreground);margin:0;font-weight:600}._textRed_c6gk7_73{color:var(--color-red)}._bgRed_c6gk7_76{background-color:var(--color-red)}._bgGreen_c6gk7_79{background-color:var(--color-green)}._textGreen_c6gk7_82{color:var(--color-green)}._mask_c6gk7_85{background-color:var(--overlay-bg)}._semibold_c6gk7_88{letter-spacing:.4px;font-weight:600}._bold_c6gk7_92{letter-spacing:.4px;font-weight:700}._system_c6gk7_96{color:var(--muted-foreground);background-color:var(--background);justify-content:center;align-items:center;display:flex;position:absolute;inset:0}._wrapper_c6gk7_106{width:100%;height:100%;min-height:480px;position:relative;overflow:hidden}._grid_c6gk7_113{grid-template:"header header"48px"sidebar frame"minmax(0,1fr)"sidebar infobar"32px/48px 1fr;height:100%;display:grid;position:relative}._grid_c6gk7_113._mobile_c6gk7_124{grid-template-columns:0 1fr}._gridNoInfobar_c6gk7_128{grid-template:"header header"48px"sidebar frame"1fr/48px 1fr;height:100%;display:grid;position:relative}._gridNoInfobar_c6gk7_128._mobile_c6gk7_124{grid-template-columns:0 1fr}._input_kyavx_1{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--input);box-sizing:border-box;border-radius:4px;outline:none;padding:0 8px;font-family:inherit;font-size:14px;line-height:normal;transition:border-color .2s,box-shadow .2s;display:block}._input_kyavx_1:hover:not(:disabled):not(:focus){border-color:var(--muted-foreground)}._input_kyavx_1:focus{box-shadow:0 0 0 1px var(--ring)}._input_kyavx_1:disabled{cursor:not-allowed;opacity:.5;background-color:var(--secondary)}._input_kyavx_1::placeholder{color:var(--muted-foreground);opacity:1}._numberClean_kyavx_39::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39[type=number]{-moz-appearance:textfield}._container_14vsv_1{position:relative}._legend_14vsv_4{color:var(--muted-foreground);background:var(--background);margin-left:8px;padding:0 4px;font-size:12px;position:absolute;top:-9px}._suffix_14vsv_13{color:var(--muted-foreground);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:14px;position:absolute;bottom:2px;right:8px}._group_1e7jm_1{margin-left:4px;display:flex}._save_1e7jm_6{width:36px;color:var(--color-green);border-top-right-radius:0;border-bottom-right-radius:0}._close_1e7jm_13{width:36px;color:var(--color-red);border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}._tooltip_gohf2_1{position:relative}._container_gohf2_5{gap:0;display:flex}._container_gohf2_5[data-orientation=vertical]{flex-direction:column}._container_gohf2_5 [data-tooltip]{pointer-events:auto}._popup_gohf2_18{top:var(--tooltip-y,0px);left:var(--tooltip-x,0px);background-color:var(--foreground);color:var(--background);z-index:999;pointer-events:none;opacity:var(--tooltip-opacity,0);width:var(--tooltip-w,auto);height:var(--tooltip-h,auto);transition:opacity var(--tooltip-fade,.2s);border-radius:4px;font-size:14px;position:absolute;transform:translate(-50%,-100%);box-shadow:0 2px 8px #0000001a}._popup_gohf2_18:before{content:"";background-color:inherit;width:10px;height:10px;position:absolute;bottom:-3px;left:50%;transform:translate(-50%)rotate(45deg)}._popup_gohf2_18[data-orientation=vertical]{transform:translateY(-50%)}._popup_gohf2_18[data-orientation=vertical]:before{content:"";background-color:inherit;width:10px;height:10px;position:absolute;top:50%;left:-3px;transform:translateY(-50%)rotate(45deg)}._popup_gohf2_18._animated_gohf2_62{transition:left var(--tooltip-slide,.4s), top var(--tooltip-slide,.4s), width var(--tooltip-slide,.4s), height var(--tooltip-slide,.4s), opacity var(--tooltip-fade,.2s)}._mask_gohf2_71{border-radius:inherit;width:100%;height:100%;overflow:hidden}._track_gohf2_78{width:max-content;height:max-content;transform:translateX(calc(-1 * var(--tooltip-offset,0px)));display:flex}._track_gohf2_78[data-orientation=vertical]{transform:translateY(calc(-1 * var(--tooltip-offset,0px)));flex-direction:column}._animated_gohf2_62 ._track_gohf2_78{transition:transform var(--tooltip-slide,.4s)}._title_gohf2_94{min-width:var(--tooltip-item-w,auto);max-width:var(--tooltip-item-w,none);min-height:var(--tooltip-item-h,32px);max-height:var(--tooltip-item-h,none);white-space:nowrap;box-sizing:border-box;flex:none;justify-content:center;align-items:center;padding:0 10px;display:flex}._surfaceTool_h38e6_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}._header_1yueu_1{box-sizing:border-box;background-color:var(--background);border-bottom:1px solid var(--border);grid-area:header;justify-content:space-between;align-items:center;height:48px;padding:0 8px;display:flex}._left_1yueu_12{align-items:center;gap:0;display:flex}._sidebarToggle_1yueu_17{border-right:solid 1px var(--border);cursor:pointer;justify-content:center;align-items:center;width:48px;height:48px;transition:all .2s;display:none;position:relative;left:-8px}._sidebarToggle_1yueu_17._mobile_1yueu_29{display:flex}._sidebarIcon_1yueu_33{stroke-width:1.6px;width:18px;height:18px}._tools_1yueu_38{gap:8px;display:flex}._history_1yueu_42{align-items:center;gap:6px;display:flex}._historyText_1yueu_47{color:var(--muted-foreground);font-size:14px;font-family:var(--font-mono)}._sidebar_1j9gh_1{background:var(--background);border-right:1px solid var(--border);z-index:10;grid-area:sidebar;width:48px;position:relative}._sidebar_1j9gh_1._mobile_1j9gh_9{transition:transform .2s ease-out;transform:translate(-110%);box-shadow:0 2px 8px #0000001a}._sidebar_1j9gh_1._mobile_1j9gh_9._open_1j9gh_14{transform:translate(0%)}._wrapper_1j9gh_19{flex-direction:column;display:flex}._item_1j9gh_23{cursor:pointer;justify-content:center;align-items:center;height:48px;transition:all .2s;display:flex;position:relative}._item_1j9gh_23 svg{width:16px;height:16px}._item_1j9gh_23:hover{background-color:var(--accent)}._item_1j9gh_23._selected_1j9gh_41{color:var(--accent-blue);background-color:var(--accent)}._item_1j9gh_23._selected_1j9gh_41:before{content:"";background-color:var(--accent-blue);width:2px;position:absolute;top:0;bottom:0;left:0}._infobar_ofe91_1{background:var(--muted);font-family:var(--font-mono);grid-area:infobar;justify-content:space-between;align-items:center;padding:0 16px;font-size:14px;display:flex}._resize_1sbig_1{align-items:center;padding-top:16px}._toolsLock_1sbig_5{width:12px;height:12px;color:var(--muted-foreground)}._indicatorWrapper_1sbig_10{justify-content:center;width:100%;height:2px;display:flex;position:absolute;top:0;left:0}._indicator_1sbig_10{background:var(--accent-blue);opacity:.6;border-radius:2px;width:30%;height:100%;transition:width .2s}._preview_dvanl_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._rotate_dvanl_12{box-sizing:border-box;width:100%;height:100%;transition:all .2s linear;position:absolute;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}._flip_dvanl_24{box-sizing:border-box;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._image_dvanl_32{max-width:none;max-height:none;transition:all .2s linear;display:block;position:absolute}._wrapper_1co2u_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;position:absolute;inset:0}._box_1co2u_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}._toolsInfo_1co2u_18{-webkit-user-select:none;user-select:none;min-width:54px;margin-top:-2px;display:inline-block}._toolsInfoLabel_1co2u_25{color:var(--muted-foreground);font-size:12px;line-height:12px}._toolsInfoValue_1co2u_30{color:var(--foreground);font-size:14px;line-height:14px}._linesBox_1co2u_35{pointer-events:none;position:absolute;inset:1px}._line_1co2u_35{border:1px dashed var(--color-white);opacity:.5;position:absolute}._lineV_1co2u_45{border-top:0;border-bottom:0;width:33%;height:100%;top:0;left:33%}._lineH_1co2u_53{border-left:0;border-right:0;width:100%;height:33%;top:33%;left:0}._pointer_1co2u_61{box-sizing:border-box;width:14px;height:14px;position:absolute}._pointerTopLeft_1co2u_67{border-top:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nwse-resize;top:-6px;left:-6px}._pointerTopRight_1co2u_74{border-top:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nesw-resize;top:-6px;right:-6px}._pointerBottomRight_1co2u_81{border-bottom:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nwse-resize;bottom:-6px;right:-6px}._pointerBottomLeft_1co2u_88{border-bottom:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nesw-resize;bottom:-6px;left:-6px}._mobileBorder_1co2u_95{box-sizing:border-box;border:2px solid var(--accent-blue);position:absolute;inset:0}._mobilePointer_1co2u_101{background-color:var(--overlay-bg-white);border:3px solid var(--accent-blue);box-sizing:border-box;border-radius:50%;width:32px;height:32px;position:absolute;bottom:-16px;right:-16px}._info_1co2u_112{height:16px;font-family:var(--font-mono);color:#000;background-color:var(--color-white-fade);box-sizing:border-box;align-items:center;padding:0 6px;font-size:12px;display:flex;position:absolute}._info_1co2u_112 b{font-weight:600;transform:translateY(1px)}._infoX_1co2u_129{border-left:solid 2px var(--accent-blue);top:-12px;left:16px}._infoY_1co2u_134{transform-origin:100%;border-right:solid 2px var(--accent-blue);top:8px;right:calc(100% + 4px);transform:rotate(-90deg)}._infoW_1co2u_141{border-right:solid 2px var(--accent-blue);bottom:-12px;right:16px}._infoH_1co2u_146{transform-origin:0%;border-left:solid 2px var(--accent-blue);bottom:8px;left:calc(100% + 4px);transform:rotate(-90deg)}._group_1co2u_153{flex-shrink:0;width:max-content;display:flex}._group_1co2u_153 button{color:var(--foreground);border-radius:0}._group_1co2u_153 button._active_1co2u_162{color:var(--accent-blue);background:var(--muted)}._group_1co2u_153 button:not(:first-child){margin-left:-1px}._group_1co2u_153 button:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px}._group_1co2u_153 button:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px}._select_1ip4k_1{width:210px}._btnH_15adi_1{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._btnV_15adi_7{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._frame_15mog_1{box-sizing:border-box;grid-area:frame;width:100%;height:100%;margin:0 auto;position:relative;overflow:hidden}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
1
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`._button_1vpzl_1{cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;box-sizing:border-box;background-color:#0000;border:1px solid #0000;border-radius:4px;justify-content:center;align-items:center;gap:8px;height:32px;padding:0 8px;font-family:inherit;font-size:14px;font-weight:500;transition:background-color .2s,border-color .2s,opacity .2s;display:inline-flex}._button_1vpzl_1:disabled{pointer-events:none;opacity:.5}._button_1vpzl_1 svg{flex-shrink:0;width:16px;height:16px}._default_1vpzl_35{background-color:var(--primary);color:var(--primary-foreground)}._default_1vpzl_35:hover{opacity:.9}._outline_1vpzl_44{border-color:var(--border);background-color:var(--background);color:var(--foreground)}._outline_1vpzl_44:hover{background-color:var(--secondary)}._ghost_1vpzl_54{color:var(--foreground);padding:0 8px}._ghost_1vpzl_54:hover{background-color:var(--secondary)}._rect_1vpzl_63{width:32px;height:32px}._separator_gp8ff_1{background-color:var(--border);box-sizing:border-box;border:none;flex-shrink:0;display:block}._separator_gp8ff_1[data-orientation=horizontal]{width:100%;height:1px}._separator_gp8ff_1[data-orientation=vertical]{align-self:stretch;width:1px;height:100%;margin:0}._wrapper_1aw0m_1{box-sizing:border-box;width:100%;position:relative}._trigger_1aw0m_6{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--border);cursor:pointer;box-sizing:border-box;-webkit-user-select:none;user-select:none;border-radius:4px;outline:none;justify-content:space-between;align-items:center;padding:0 8px 0 10px;font-family:inherit;font-size:14px;transition:border-color .2s;display:flex}._trigger_1aw0m_6:hover,._trigger_1aw0m_6:focus{border-color:var(--muted-foreground)}._triggerArrow_1aw0m_31{width:16px;height:16px;color:var(--muted-foreground);transition:transform .2s}._wrapper_1aw0m_1[data-state=open] ._triggerArrow_1aw0m_31{transform:rotate(180deg)}._content_1aw0m_40{background-color:var(--background);border:1px solid var(--border);z-index:50;box-sizing:border-box;border-radius:4px;width:100%;max-height:282px;padding:4px;position:absolute;top:calc(100% + 4px);left:0;overflow-y:auto;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}._content_1aw0m_40::-webkit-scrollbar{width:4px}._content_1aw0m_40::-webkit-scrollbar-track{background:0 0}._content_1aw0m_40::-webkit-scrollbar-thumb{background-color:var(--border);border-radius:10px}._wrapper_1aw0m_1[data-state=closed] ._content_1aw0m_40{display:none}._groupLabel_1aw0m_74{color:var(--muted-foreground);-webkit-user-select:none;user-select:none;padding:8px 10px;font-size:12px;font-weight:500}._item_1aw0m_81{width:100%;color:var(--foreground);cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;background:0 0;border-radius:4px;justify-content:space-between;align-items:center;padding:4px 10px;display:flex}._item_1aw0m_81:hover{background-color:var(--secondary)}._itemLeft_1aw0m_98{font-size:14px;font-weight:400}._itemAddon_1aw0m_102{align-items:center;gap:8px;display:flex}._itemAddon_1aw0m_102 span{color:var(--muted-foreground);font-size:12px}._itemAddon_1aw0m_102 svg{font-size:14px}._itemAddon_1aw0m_102 b{flex-shrink:0;width:16px;height:16px}._itemRightContainer_1aw0m_122{align-items:center;gap:8px;display:flex}._itemRight_1aw0m_122{color:var(--muted-foreground);font-size:14px}._itemCheck_1aw0m_131{width:16px;height:16px;color:var(--foreground);flex-shrink:0}:host{height:100%;display:block}:host *{box-sizing:border-box}._root_c6gk7_8{width:100%;height:100%;font-size:16px;font-family:var(--font-sans);--font-sans:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, Helvetica, Arial, sans-serif;--font-mono:"Courier New", Courier, monospace;--color-white:#fff;--color-white-fade:color-mix(in srgb, var(--color-white) 40%, transparent);--color-black:#000;--color-red:oklch(63.7% .237 25.331);--color-green:oklch(76.8% .188 151.716);--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(75.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--accent-blue:oklch(60.9% .221 251.687);--accent-blue-light:oklch(96% .02 250);--accent-blue-fade:color-mix(in srgb, var(--accent-blue) 60%, transparent);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 50%, transparent);--overlay-bg-white:color-mix(in srgb, var(--color-white) 80%, transparent);position:relative}._root_c6gk7_8[data-theme=dark]{--background:oklch(24.5% 0 0);--foreground:oklch(78.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(24.5% 0 0);--muted-foreground:oklch(50% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--accent-blue-light:oklch(25% .06 250);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 75%, transparent)}._root_c6gk7_8 h1,._root_c6gk7_8 h2,._root_c6gk7_8 h3,._root_c6gk7_8 h4,._root_c6gk7_8 h5,._root_c6gk7_8 h6{color:var(--foreground);margin:0;font-weight:600}._textRed_c6gk7_73{color:var(--color-red)}._bgRed_c6gk7_76{background-color:var(--color-red)}._bgGreen_c6gk7_79{background-color:var(--color-green)}._textGreen_c6gk7_82{color:var(--color-green)}._mask_c6gk7_85{background-color:var(--overlay-bg)}._semibold_c6gk7_88{letter-spacing:.4px;font-weight:600}._bold_c6gk7_92{letter-spacing:.4px;font-weight:700}._system_c6gk7_96{color:var(--muted-foreground);background-color:var(--background);justify-content:center;align-items:center;display:flex;position:absolute;inset:0}._wrapper_c6gk7_106{width:100%;height:100%;min-height:480px;position:relative;overflow:hidden}._grid_c6gk7_113{grid-template:"header header"48px"sidebar frame"minmax(0,1fr)"sidebar infobar"32px/48px 1fr;height:100%;display:grid;position:relative}._grid_c6gk7_113._mobile_c6gk7_124{grid-template-columns:0 1fr}._gridNoInfobar_c6gk7_128{grid-template:"header header"48px"sidebar frame"1fr/48px 1fr;height:100%;display:grid;position:relative}._gridNoInfobar_c6gk7_128._mobile_c6gk7_124{grid-template-columns:0 1fr}._input_kyavx_1{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--input);box-sizing:border-box;border-radius:4px;outline:none;padding:0 8px;font-family:inherit;font-size:14px;line-height:normal;transition:border-color .2s,box-shadow .2s;display:block}._input_kyavx_1:hover:not(:disabled):not(:focus){border-color:var(--muted-foreground)}._input_kyavx_1:focus{box-shadow:0 0 0 1px var(--ring)}._input_kyavx_1:disabled{cursor:not-allowed;opacity:.5;background-color:var(--secondary)}._input_kyavx_1::placeholder{color:var(--muted-foreground);opacity:1}._numberClean_kyavx_39::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39[type=number]{-moz-appearance:textfield}._container_14vsv_1{position:relative}._legend_14vsv_4{color:var(--muted-foreground);background:var(--background);margin-left:8px;padding:0 4px;font-size:12px;position:absolute;top:-9px}._suffix_14vsv_13{color:var(--muted-foreground);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:14px;position:absolute;bottom:2px;right:8px}._group_1e7jm_1{margin-left:4px;display:flex}._save_1e7jm_6{width:36px;color:var(--color-green);border-top-right-radius:0;border-bottom-right-radius:0}._close_1e7jm_13{width:36px;color:var(--color-red);border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}._tooltip_1dl6s_1{position:relative}._container_1dl6s_5{gap:0;display:flex}._container_1dl6s_5[data-position=left],._container_1dl6s_5[data-position=right]{flex-direction:column}._container_1dl6s_5 [data-tooltip]{pointer-events:auto}._popup_1dl6s_19{top:var(--tooltip-y,0px);left:var(--tooltip-x,0px);background-color:var(--foreground);color:var(--background);z-index:999;pointer-events:none;opacity:var(--tooltip-opacity,0);width:var(--tooltip-w,auto);height:var(--tooltip-h,auto);transition:opacity var(--tooltip-fade,.2s);border-radius:4px;font-size:14px;position:absolute;transform:translate(-50%,-100%);box-shadow:0 2px 8px #0000001a}._popup_1dl6s_19:before{content:"";background-color:inherit;width:10px;height:10px;position:absolute;bottom:-3px;left:50%;transform:translate(-50%)rotate(45deg)}._popup_1dl6s_19[data-position=top]{transform:translate(-50%,-100%)}._popup_1dl6s_19[data-position=top]:before{top:auto;bottom:-3px;left:50%;transform:translate(-50%)rotate(45deg)}._popup_1dl6s_19[data-position=bottom]{transform:translate(-50%)}._popup_1dl6s_19[data-position=bottom]:before{top:-3px;bottom:auto;left:50%;transform:translate(-50%)rotate(45deg)}._popup_1dl6s_19[data-position=left]{transform:translate(-100%,-50%)}._popup_1dl6s_19[data-position=left]:before{top:50%;left:auto;right:-3px;transform:translateY(-50%)rotate(45deg)}._popup_1dl6s_19[data-position=right]{transform:translateY(-50%)}._popup_1dl6s_19[data-position=right]:before{top:50%;left:-3px;right:auto;transform:translateY(-50%)rotate(45deg)}._popup_1dl6s_19._animated_1dl6s_92{transition:left var(--tooltip-slide,.4s), top var(--tooltip-slide,.4s), width var(--tooltip-slide,.4s), height var(--tooltip-slide,.4s), opacity var(--tooltip-fade,.2s)}._mask_1dl6s_101{border-radius:inherit;width:100%;height:100%;overflow:hidden}._track_1dl6s_108{width:max-content;height:max-content;transform:translateX(calc(-1 * var(--tooltip-offset,0px)));display:flex}._track_1dl6s_108[data-position=left],._track_1dl6s_108[data-position=right]{transform:translateY(calc(-1 * var(--tooltip-offset,0px)));flex-direction:column}._animated_1dl6s_92 ._track_1dl6s_108{transition:transform var(--tooltip-slide,.4s)}._title_1dl6s_125{min-width:var(--tooltip-item-w,auto);max-width:var(--tooltip-item-w,none);min-height:var(--tooltip-item-h,32px);max-height:var(--tooltip-item-h,none);white-space:nowrap;box-sizing:border-box;flex:none;justify-content:center;align-items:center;padding:0 10px;display:flex}._surfaceTool_h38e6_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}._header_1yueu_1{box-sizing:border-box;background-color:var(--background);border-bottom:1px solid var(--border);grid-area:header;justify-content:space-between;align-items:center;height:48px;padding:0 8px;display:flex}._left_1yueu_12{align-items:center;gap:0;display:flex}._sidebarToggle_1yueu_17{border-right:solid 1px var(--border);cursor:pointer;justify-content:center;align-items:center;width:48px;height:48px;transition:all .2s;display:none;position:relative;left:-8px}._sidebarToggle_1yueu_17._mobile_1yueu_29{display:flex}._sidebarIcon_1yueu_33{stroke-width:1.6px;width:18px;height:18px}._tools_1yueu_38{gap:8px;display:flex}._history_1yueu_42{align-items:center;gap:6px;display:flex}._historyText_1yueu_47{color:var(--muted-foreground);font-size:14px;font-family:var(--font-mono)}._sidebar_1j9gh_1{background:var(--background);border-right:1px solid var(--border);z-index:10;grid-area:sidebar;width:48px;position:relative}._sidebar_1j9gh_1._mobile_1j9gh_9{transition:transform .2s ease-out;transform:translate(-110%);box-shadow:0 2px 8px #0000001a}._sidebar_1j9gh_1._mobile_1j9gh_9._open_1j9gh_14{transform:translate(0%)}._wrapper_1j9gh_19{flex-direction:column;display:flex}._item_1j9gh_23{cursor:pointer;justify-content:center;align-items:center;height:48px;transition:all .2s;display:flex;position:relative}._item_1j9gh_23 svg{width:16px;height:16px}._item_1j9gh_23:hover{background-color:var(--accent)}._item_1j9gh_23._selected_1j9gh_41{color:var(--accent-blue);background-color:var(--accent)}._item_1j9gh_23._selected_1j9gh_41:before{content:"";background-color:var(--accent-blue);width:2px;position:absolute;top:0;bottom:0;left:0}._infobar_ofe91_1{background:var(--muted);font-family:var(--font-mono);grid-area:infobar;justify-content:space-between;align-items:center;padding:0 16px;font-size:14px;display:flex}._resize_1sbig_1{align-items:center;padding-top:16px}._toolsLock_1sbig_5{width:12px;height:12px;color:var(--muted-foreground)}._indicatorWrapper_1sbig_10{justify-content:center;width:100%;height:2px;display:flex;position:absolute;top:0;left:0}._indicator_1sbig_10{background:var(--accent-blue);opacity:.6;border-radius:2px;width:30%;height:100%;transition:width .2s}._preview_dvanl_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._rotate_dvanl_12{box-sizing:border-box;width:100%;height:100%;transition:all .2s linear;position:absolute;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}._flip_dvanl_24{box-sizing:border-box;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._image_dvanl_32{max-width:none;max-height:none;transition:all .2s linear;display:block;position:absolute}._wrapper_1co2u_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;position:absolute;inset:0}._box_1co2u_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}._toolsInfo_1co2u_18{-webkit-user-select:none;user-select:none;min-width:54px;margin-top:-2px;display:inline-block}._toolsInfoLabel_1co2u_25{color:var(--muted-foreground);font-size:12px;line-height:12px}._toolsInfoValue_1co2u_30{color:var(--foreground);font-size:14px;line-height:14px}._linesBox_1co2u_35{pointer-events:none;position:absolute;inset:1px}._line_1co2u_35{border:1px dashed var(--color-white);opacity:.5;position:absolute}._lineV_1co2u_45{border-top:0;border-bottom:0;width:33%;height:100%;top:0;left:33%}._lineH_1co2u_53{border-left:0;border-right:0;width:100%;height:33%;top:33%;left:0}._pointer_1co2u_61{box-sizing:border-box;width:14px;height:14px;position:absolute}._pointerTopLeft_1co2u_67{border-top:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nwse-resize;top:-6px;left:-6px}._pointerTopRight_1co2u_74{border-top:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nesw-resize;top:-6px;right:-6px}._pointerBottomRight_1co2u_81{border-bottom:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nwse-resize;bottom:-6px;right:-6px}._pointerBottomLeft_1co2u_88{border-bottom:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nesw-resize;bottom:-6px;left:-6px}._mobileBorder_1co2u_95{box-sizing:border-box;border:2px solid var(--accent-blue);position:absolute;inset:0}._mobilePointer_1co2u_101{background-color:var(--overlay-bg-white);border:3px solid var(--accent-blue);box-sizing:border-box;border-radius:50%;width:32px;height:32px;position:absolute;bottom:-16px;right:-16px}._info_1co2u_112{height:16px;font-family:var(--font-mono);color:#000;background-color:var(--color-white-fade);box-sizing:border-box;align-items:center;padding:0 6px;font-size:12px;display:flex;position:absolute}._info_1co2u_112 b{font-weight:600;transform:translateY(1px)}._infoX_1co2u_129{border-left:solid 2px var(--accent-blue);top:-12px;left:16px}._infoY_1co2u_134{transform-origin:100%;border-right:solid 2px var(--accent-blue);top:8px;right:calc(100% + 4px);transform:rotate(-90deg)}._infoW_1co2u_141{border-right:solid 2px var(--accent-blue);bottom:-12px;right:16px}._infoH_1co2u_146{transform-origin:0%;border-left:solid 2px var(--accent-blue);bottom:8px;left:calc(100% + 4px);transform:rotate(-90deg)}._group_1co2u_153{flex-shrink:0;width:max-content;display:flex}._group_1co2u_153 button{color:var(--foreground);border-radius:0}._group_1co2u_153 button._active_1co2u_162{color:var(--accent-blue);background:var(--muted)}._group_1co2u_153 button:not(:first-child){margin-left:-1px}._group_1co2u_153 button:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px}._group_1co2u_153 button:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px}._select_1ip4k_1{width:210px}._btnH_15adi_1{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._btnV_15adi_7{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._frame_15mog_1{box-sizing:border-box;grid-area:frame;width:100%;height:100%;margin:0 auto;position:relative;overflow:hidden}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
2
2
  import { Children as e, createContext as t, forwardRef as n, isValidElement as r, useCallback as i, useContext as a, useEffect as o, useLayoutEffect as s, useMemo as c, useRef as l, useState as u } from "react";
3
3
  //#region \0rolldown/runtime.js
4
4
  var d = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), f = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
@@ -758,15 +758,15 @@ var I = {
758
758
  children: /* @__PURE__ */ (0, b.jsx)(ee, {})
759
759
  })]
760
760
  }), z = {
761
- tooltip: "_tooltip_gohf2_1",
762
- container: "_container_gohf2_5",
763
- popup: "_popup_gohf2_18",
764
- animated: "_animated_gohf2_62",
765
- mask: "_mask_gohf2_71",
766
- track: "_track_gohf2_78",
767
- title: "_title_gohf2_94"
768
- }, De = (t, n = "horizontal") => {
769
- let [i, a] = u(null), [d, f] = u(null), [p, m] = u(!1), [h, g] = u(!1), [_, v] = u([]), y = l(null), b = l(null), x = l([]), S = n === "vertical", C = c(() => {
761
+ tooltip: "_tooltip_1dl6s_1",
762
+ container: "_container_1dl6s_5",
763
+ popup: "_popup_1dl6s_19",
764
+ animated: "_animated_1dl6s_92",
765
+ mask: "_mask_1dl6s_101",
766
+ track: "_track_1dl6s_108",
767
+ title: "_title_1dl6s_125"
768
+ }, De = (t, n = "top") => {
769
+ let [i, a] = u(null), [d, f] = u(null), [p, m] = u(!1), [h, g] = u(!1), [_, v] = u([]), y = l(null), b = l(null), x = l([]), S = n === "left" || n === "right", C = c(() => {
770
770
  let n = [];
771
771
  return e.forEach(t, (e) => {
772
772
  if (r(e)) {
@@ -803,27 +803,27 @@ var I = {
803
803
  m(!1);
804
804
  return;
805
805
  }
806
- let n = t.parentElement;
807
- if (!n) return;
808
- let r = Array.from(n.children).indexOf(t);
809
- if (r === -1 || p && r === i) return;
810
- let o = y.current?.getBoundingClientRect();
811
- if (!o) return;
812
- let s = t.getBoundingClientRect(), c = S ? {
813
- x: s.right - o.left + 4,
814
- y: s.top - o.top + s.height / 2
806
+ let r = t.parentElement;
807
+ if (!r) return;
808
+ let o = Array.from(r.children).indexOf(t);
809
+ if (o === -1 || p && o === i) return;
810
+ let s = y.current?.getBoundingClientRect();
811
+ if (!s) return;
812
+ let c = t.getBoundingClientRect(), l = S ? {
813
+ x: n === "left" ? c.left - s.left - 4 : c.right - s.left + 4,
814
+ y: c.top - s.top + c.height / 2
815
815
  } : {
816
- x: s.left - o.left + s.width / 2,
817
- y: s.top - o.top - 8
816
+ x: c.left - s.left + c.width / 2,
817
+ y: n === "top" ? c.top - s.top - 8 : c.bottom - s.top + 8
818
818
  };
819
- p || g(!1), f(c), a(r), m(!0);
819
+ p || g(!1), f(l), a(o), m(!0);
820
820
  }, D = () => m(!1), O = i ?? 0, k = _[O], A = _.slice(0, O).reduce((e, t) => e + (S ? t.h : t.w), 0);
821
821
  return {
822
822
  containerRef: y,
823
823
  trackRef: b,
824
824
  titleRefs: x,
825
825
  titles: C,
826
- isVertical: S,
826
+ position: n,
827
827
  isVisible: p,
828
828
  isAnimated: h,
829
829
  cssVars: {
@@ -837,28 +837,28 @@ var I = {
837
837
  handleMouseMove: E,
838
838
  handleMouseLeave: D
839
839
  };
840
- }, B = ({ children: e, orientation: t = "horizontal", className: n = "", classNameTitle: r = "" }) => {
841
- let { containerRef: i, trackRef: a, titleRefs: o, titles: s, isVertical: c, isAnimated: l, cssVars: u, handleMouseMove: d, handleMouseLeave: f } = De(e, t);
840
+ }, B = ({ children: e, position: t = "top", className: n = "", classNameTitle: r = "" }) => {
841
+ let { containerRef: i, trackRef: a, titleRefs: o, titles: s, isAnimated: c, cssVars: l, handleMouseMove: u, handleMouseLeave: d } = De(e, t);
842
842
  return /* @__PURE__ */ (0, b.jsxs)("div", {
843
843
  ref: i,
844
- onMouseMove: d,
845
- onMouseLeave: f,
846
- onBlur: f,
844
+ onMouseMove: u,
845
+ onMouseLeave: d,
846
+ onBlur: d,
847
847
  className: z.tooltip,
848
- style: u,
848
+ style: l,
849
849
  children: [/* @__PURE__ */ (0, b.jsx)("div", {
850
- "data-orientation": c ? "vertical" : "horizontal",
850
+ "data-position": t,
851
851
  className: z.container,
852
852
  children: e
853
853
  }), /* @__PURE__ */ (0, b.jsx)("div", {
854
854
  "aria-hidden": "true",
855
- "data-orientation": c ? "vertical" : "horizontal",
856
- className: `${z.popup} ${l ? z.animated : ""} ${n}`,
855
+ "data-position": t,
856
+ className: `${z.popup} ${c ? z.animated : ""} ${n}`,
857
857
  children: /* @__PURE__ */ (0, b.jsx)("div", {
858
858
  className: z.mask,
859
859
  children: /* @__PURE__ */ (0, b.jsx)("div", {
860
860
  ref: a,
861
- "data-orientation": c ? "vertical" : "horizontal",
861
+ "data-position": t,
862
862
  className: z.track,
863
863
  children: s.map((e, t) => /* @__PURE__ */ (0, b.jsx)("div", {
864
864
  ref: (e) => {
@@ -1463,7 +1463,7 @@ var G = (e, t, n) => Math.max(t, Math.min(n, e)), We = (e, t) => [[e[0][0] * t[0
1463
1463
  return /* @__PURE__ */ (0, b.jsx)("nav", {
1464
1464
  className: `${J.sidebar} ${e ? J.mobile : ""} ${e && n ? J.open : ""}`,
1465
1465
  children: /* @__PURE__ */ (0, b.jsx)(B, {
1466
- orientation: "vertical",
1466
+ position: "right",
1467
1467
  className: J.tooltip,
1468
1468
  children: i.map((e) => {
1469
1469
  let t = tt(e);
@@ -1780,7 +1780,7 @@ var G = (e, t, n) => Math.max(t, Math.min(n, e)), We = (e, t) => [[e[0][0] * t[0
1780
1780
  ], bt = ({ value: e, onChange: t }) => /* @__PURE__ */ (0, b.jsx)("div", {
1781
1781
  className: Z.group,
1782
1782
  children: /* @__PURE__ */ (0, b.jsx)(B, {
1783
- orientation: "horizontal",
1783
+ position: "top",
1784
1784
  className: Z.tooltip,
1785
1785
  children: yt.map((n) => /* @__PURE__ */ (0, b.jsx)(F, {
1786
1786
  variant: "outline",
@@ -2143,7 +2143,7 @@ var At = ({ boxRef: e }) => {
2143
2143
  return /* @__PURE__ */ (0, b.jsxs)(V, { children: [/* @__PURE__ */ (0, b.jsx)("div", {
2144
2144
  className: Q.scGroup,
2145
2145
  children: /* @__PURE__ */ (0, b.jsxs)(B, {
2146
- orientation: "horizontal",
2146
+ position: "top",
2147
2147
  className: Q.tooltip,
2148
2148
  children: [/* @__PURE__ */ (0, b.jsx)(F, {
2149
2149
  variant: "outline",
@@ -2196,7 +2196,7 @@ var At = ({ boxRef: e }) => {
2196
2196
  return /* @__PURE__ */ (0, b.jsxs)(V, { children: [/* @__PURE__ */ (0, b.jsx)("div", {
2197
2197
  className: $.scGroup,
2198
2198
  children: /* @__PURE__ */ (0, b.jsxs)(B, {
2199
- orientation: "horizontal",
2199
+ position: "top",
2200
2200
  className: $.tooltip,
2201
2201
  children: [/* @__PURE__ */ (0, b.jsx)(F, {
2202
2202
  variant: "outline",
@@ -1,7 +1,7 @@
1
- (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`._button_1vpzl_1{cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;box-sizing:border-box;background-color:#0000;border:1px solid #0000;border-radius:4px;justify-content:center;align-items:center;gap:8px;height:32px;padding:0 8px;font-family:inherit;font-size:14px;font-weight:500;transition:background-color .2s,border-color .2s,opacity .2s;display:inline-flex}._button_1vpzl_1:disabled{pointer-events:none;opacity:.5}._button_1vpzl_1 svg{flex-shrink:0;width:16px;height:16px}._default_1vpzl_35{background-color:var(--primary);color:var(--primary-foreground)}._default_1vpzl_35:hover{opacity:.9}._outline_1vpzl_44{border-color:var(--border);background-color:var(--background);color:var(--foreground)}._outline_1vpzl_44:hover{background-color:var(--secondary)}._ghost_1vpzl_54{color:var(--foreground);padding:0 8px}._ghost_1vpzl_54:hover{background-color:var(--secondary)}._rect_1vpzl_63{width:32px;height:32px}._separator_gp8ff_1{background-color:var(--border);box-sizing:border-box;border:none;flex-shrink:0;display:block}._separator_gp8ff_1[data-orientation=horizontal]{width:100%;height:1px}._separator_gp8ff_1[data-orientation=vertical]{align-self:stretch;width:1px;height:100%;margin:0}._wrapper_1aw0m_1{box-sizing:border-box;width:100%;position:relative}._trigger_1aw0m_6{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--border);cursor:pointer;box-sizing:border-box;-webkit-user-select:none;user-select:none;border-radius:4px;outline:none;justify-content:space-between;align-items:center;padding:0 8px 0 10px;font-family:inherit;font-size:14px;transition:border-color .2s;display:flex}._trigger_1aw0m_6:hover,._trigger_1aw0m_6:focus{border-color:var(--muted-foreground)}._triggerArrow_1aw0m_31{width:16px;height:16px;color:var(--muted-foreground);transition:transform .2s}._wrapper_1aw0m_1[data-state=open] ._triggerArrow_1aw0m_31{transform:rotate(180deg)}._content_1aw0m_40{background-color:var(--background);border:1px solid var(--border);z-index:50;box-sizing:border-box;border-radius:4px;width:100%;max-height:282px;padding:4px;position:absolute;top:calc(100% + 4px);left:0;overflow-y:auto;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}._content_1aw0m_40::-webkit-scrollbar{width:4px}._content_1aw0m_40::-webkit-scrollbar-track{background:0 0}._content_1aw0m_40::-webkit-scrollbar-thumb{background-color:var(--border);border-radius:10px}._wrapper_1aw0m_1[data-state=closed] ._content_1aw0m_40{display:none}._groupLabel_1aw0m_74{color:var(--muted-foreground);-webkit-user-select:none;user-select:none;padding:8px 10px;font-size:12px;font-weight:500}._item_1aw0m_81{width:100%;color:var(--foreground);cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;background:0 0;border-radius:4px;justify-content:space-between;align-items:center;padding:4px 10px;display:flex}._item_1aw0m_81:hover{background-color:var(--secondary)}._itemLeft_1aw0m_98{font-size:14px;font-weight:400}._itemAddon_1aw0m_102{align-items:center;gap:8px;display:flex}._itemAddon_1aw0m_102 span{color:var(--muted-foreground);font-size:12px}._itemAddon_1aw0m_102 svg{font-size:14px}._itemAddon_1aw0m_102 b{flex-shrink:0;width:16px;height:16px}._itemRightContainer_1aw0m_122{align-items:center;gap:8px;display:flex}._itemRight_1aw0m_122{color:var(--muted-foreground);font-size:14px}._itemCheck_1aw0m_131{width:16px;height:16px;color:var(--foreground);flex-shrink:0}:host{height:100%;display:block}:host *{box-sizing:border-box}._root_c6gk7_8{width:100%;height:100%;font-size:16px;font-family:var(--font-sans);--font-sans:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, Helvetica, Arial, sans-serif;--font-mono:"Courier New", Courier, monospace;--color-white:#fff;--color-white-fade:color-mix(in srgb, var(--color-white) 40%, transparent);--color-black:#000;--color-red:oklch(63.7% .237 25.331);--color-green:oklch(76.8% .188 151.716);--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(75.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--accent-blue:oklch(60.9% .221 251.687);--accent-blue-light:oklch(96% .02 250);--accent-blue-fade:color-mix(in srgb, var(--accent-blue) 60%, transparent);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 50%, transparent);--overlay-bg-white:color-mix(in srgb, var(--color-white) 80%, transparent);position:relative}._root_c6gk7_8[data-theme=dark]{--background:oklch(24.5% 0 0);--foreground:oklch(78.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(24.5% 0 0);--muted-foreground:oklch(50% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--accent-blue-light:oklch(25% .06 250);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 75%, transparent)}._root_c6gk7_8 h1,._root_c6gk7_8 h2,._root_c6gk7_8 h3,._root_c6gk7_8 h4,._root_c6gk7_8 h5,._root_c6gk7_8 h6{color:var(--foreground);margin:0;font-weight:600}._textRed_c6gk7_73{color:var(--color-red)}._bgRed_c6gk7_76{background-color:var(--color-red)}._bgGreen_c6gk7_79{background-color:var(--color-green)}._textGreen_c6gk7_82{color:var(--color-green)}._mask_c6gk7_85{background-color:var(--overlay-bg)}._semibold_c6gk7_88{letter-spacing:.4px;font-weight:600}._bold_c6gk7_92{letter-spacing:.4px;font-weight:700}._system_c6gk7_96{color:var(--muted-foreground);background-color:var(--background);justify-content:center;align-items:center;display:flex;position:absolute;inset:0}._wrapper_c6gk7_106{width:100%;height:100%;min-height:480px;position:relative;overflow:hidden}._grid_c6gk7_113{grid-template:"header header"48px"sidebar frame"minmax(0,1fr)"sidebar infobar"32px/48px 1fr;height:100%;display:grid;position:relative}._grid_c6gk7_113._mobile_c6gk7_124{grid-template-columns:0 1fr}._gridNoInfobar_c6gk7_128{grid-template:"header header"48px"sidebar frame"1fr/48px 1fr;height:100%;display:grid;position:relative}._gridNoInfobar_c6gk7_128._mobile_c6gk7_124{grid-template-columns:0 1fr}._input_kyavx_1{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--input);box-sizing:border-box;border-radius:4px;outline:none;padding:0 8px;font-family:inherit;font-size:14px;line-height:normal;transition:border-color .2s,box-shadow .2s;display:block}._input_kyavx_1:hover:not(:disabled):not(:focus){border-color:var(--muted-foreground)}._input_kyavx_1:focus{box-shadow:0 0 0 1px var(--ring)}._input_kyavx_1:disabled{cursor:not-allowed;opacity:.5;background-color:var(--secondary)}._input_kyavx_1::placeholder{color:var(--muted-foreground);opacity:1}._numberClean_kyavx_39::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39[type=number]{-moz-appearance:textfield}._container_14vsv_1{position:relative}._legend_14vsv_4{color:var(--muted-foreground);background:var(--background);margin-left:8px;padding:0 4px;font-size:12px;position:absolute;top:-9px}._suffix_14vsv_13{color:var(--muted-foreground);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:14px;position:absolute;bottom:2px;right:8px}._group_1e7jm_1{margin-left:4px;display:flex}._save_1e7jm_6{width:36px;color:var(--color-green);border-top-right-radius:0;border-bottom-right-radius:0}._close_1e7jm_13{width:36px;color:var(--color-red);border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}._tooltip_gohf2_1{position:relative}._container_gohf2_5{gap:0;display:flex}._container_gohf2_5[data-orientation=vertical]{flex-direction:column}._container_gohf2_5 [data-tooltip]{pointer-events:auto}._popup_gohf2_18{top:var(--tooltip-y,0px);left:var(--tooltip-x,0px);background-color:var(--foreground);color:var(--background);z-index:999;pointer-events:none;opacity:var(--tooltip-opacity,0);width:var(--tooltip-w,auto);height:var(--tooltip-h,auto);transition:opacity var(--tooltip-fade,.2s);border-radius:4px;font-size:14px;position:absolute;transform:translate(-50%,-100%);box-shadow:0 2px 8px #0000001a}._popup_gohf2_18:before{content:"";background-color:inherit;width:10px;height:10px;position:absolute;bottom:-3px;left:50%;transform:translate(-50%)rotate(45deg)}._popup_gohf2_18[data-orientation=vertical]{transform:translateY(-50%)}._popup_gohf2_18[data-orientation=vertical]:before{content:"";background-color:inherit;width:10px;height:10px;position:absolute;top:50%;left:-3px;transform:translateY(-50%)rotate(45deg)}._popup_gohf2_18._animated_gohf2_62{transition:left var(--tooltip-slide,.4s), top var(--tooltip-slide,.4s), width var(--tooltip-slide,.4s), height var(--tooltip-slide,.4s), opacity var(--tooltip-fade,.2s)}._mask_gohf2_71{border-radius:inherit;width:100%;height:100%;overflow:hidden}._track_gohf2_78{width:max-content;height:max-content;transform:translateX(calc(-1 * var(--tooltip-offset,0px)));display:flex}._track_gohf2_78[data-orientation=vertical]{transform:translateY(calc(-1 * var(--tooltip-offset,0px)));flex-direction:column}._animated_gohf2_62 ._track_gohf2_78{transition:transform var(--tooltip-slide,.4s)}._title_gohf2_94{min-width:var(--tooltip-item-w,auto);max-width:var(--tooltip-item-w,none);min-height:var(--tooltip-item-h,32px);max-height:var(--tooltip-item-h,none);white-space:nowrap;box-sizing:border-box;flex:none;justify-content:center;align-items:center;padding:0 10px;display:flex}._surfaceTool_h38e6_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}._header_1yueu_1{box-sizing:border-box;background-color:var(--background);border-bottom:1px solid var(--border);grid-area:header;justify-content:space-between;align-items:center;height:48px;padding:0 8px;display:flex}._left_1yueu_12{align-items:center;gap:0;display:flex}._sidebarToggle_1yueu_17{border-right:solid 1px var(--border);cursor:pointer;justify-content:center;align-items:center;width:48px;height:48px;transition:all .2s;display:none;position:relative;left:-8px}._sidebarToggle_1yueu_17._mobile_1yueu_29{display:flex}._sidebarIcon_1yueu_33{stroke-width:1.6px;width:18px;height:18px}._tools_1yueu_38{gap:8px;display:flex}._history_1yueu_42{align-items:center;gap:6px;display:flex}._historyText_1yueu_47{color:var(--muted-foreground);font-size:14px;font-family:var(--font-mono)}._sidebar_1j9gh_1{background:var(--background);border-right:1px solid var(--border);z-index:10;grid-area:sidebar;width:48px;position:relative}._sidebar_1j9gh_1._mobile_1j9gh_9{transition:transform .2s ease-out;transform:translate(-110%);box-shadow:0 2px 8px #0000001a}._sidebar_1j9gh_1._mobile_1j9gh_9._open_1j9gh_14{transform:translate(0%)}._wrapper_1j9gh_19{flex-direction:column;display:flex}._item_1j9gh_23{cursor:pointer;justify-content:center;align-items:center;height:48px;transition:all .2s;display:flex;position:relative}._item_1j9gh_23 svg{width:16px;height:16px}._item_1j9gh_23:hover{background-color:var(--accent)}._item_1j9gh_23._selected_1j9gh_41{color:var(--accent-blue);background-color:var(--accent)}._item_1j9gh_23._selected_1j9gh_41:before{content:"";background-color:var(--accent-blue);width:2px;position:absolute;top:0;bottom:0;left:0}._infobar_ofe91_1{background:var(--muted);font-family:var(--font-mono);grid-area:infobar;justify-content:space-between;align-items:center;padding:0 16px;font-size:14px;display:flex}._resize_1sbig_1{align-items:center;padding-top:16px}._toolsLock_1sbig_5{width:12px;height:12px;color:var(--muted-foreground)}._indicatorWrapper_1sbig_10{justify-content:center;width:100%;height:2px;display:flex;position:absolute;top:0;left:0}._indicator_1sbig_10{background:var(--accent-blue);opacity:.6;border-radius:2px;width:30%;height:100%;transition:width .2s}._preview_dvanl_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._rotate_dvanl_12{box-sizing:border-box;width:100%;height:100%;transition:all .2s linear;position:absolute;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}._flip_dvanl_24{box-sizing:border-box;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._image_dvanl_32{max-width:none;max-height:none;transition:all .2s linear;display:block;position:absolute}._wrapper_1co2u_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;position:absolute;inset:0}._box_1co2u_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}._toolsInfo_1co2u_18{-webkit-user-select:none;user-select:none;min-width:54px;margin-top:-2px;display:inline-block}._toolsInfoLabel_1co2u_25{color:var(--muted-foreground);font-size:12px;line-height:12px}._toolsInfoValue_1co2u_30{color:var(--foreground);font-size:14px;line-height:14px}._linesBox_1co2u_35{pointer-events:none;position:absolute;inset:1px}._line_1co2u_35{border:1px dashed var(--color-white);opacity:.5;position:absolute}._lineV_1co2u_45{border-top:0;border-bottom:0;width:33%;height:100%;top:0;left:33%}._lineH_1co2u_53{border-left:0;border-right:0;width:100%;height:33%;top:33%;left:0}._pointer_1co2u_61{box-sizing:border-box;width:14px;height:14px;position:absolute}._pointerTopLeft_1co2u_67{border-top:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nwse-resize;top:-6px;left:-6px}._pointerTopRight_1co2u_74{border-top:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nesw-resize;top:-6px;right:-6px}._pointerBottomRight_1co2u_81{border-bottom:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nwse-resize;bottom:-6px;right:-6px}._pointerBottomLeft_1co2u_88{border-bottom:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nesw-resize;bottom:-6px;left:-6px}._mobileBorder_1co2u_95{box-sizing:border-box;border:2px solid var(--accent-blue);position:absolute;inset:0}._mobilePointer_1co2u_101{background-color:var(--overlay-bg-white);border:3px solid var(--accent-blue);box-sizing:border-box;border-radius:50%;width:32px;height:32px;position:absolute;bottom:-16px;right:-16px}._info_1co2u_112{height:16px;font-family:var(--font-mono);color:#000;background-color:var(--color-white-fade);box-sizing:border-box;align-items:center;padding:0 6px;font-size:12px;display:flex;position:absolute}._info_1co2u_112 b{font-weight:600;transform:translateY(1px)}._infoX_1co2u_129{border-left:solid 2px var(--accent-blue);top:-12px;left:16px}._infoY_1co2u_134{transform-origin:100%;border-right:solid 2px var(--accent-blue);top:8px;right:calc(100% + 4px);transform:rotate(-90deg)}._infoW_1co2u_141{border-right:solid 2px var(--accent-blue);bottom:-12px;right:16px}._infoH_1co2u_146{transform-origin:0%;border-left:solid 2px var(--accent-blue);bottom:8px;left:calc(100% + 4px);transform:rotate(-90deg)}._group_1co2u_153{flex-shrink:0;width:max-content;display:flex}._group_1co2u_153 button{color:var(--foreground);border-radius:0}._group_1co2u_153 button._active_1co2u_162{color:var(--accent-blue);background:var(--muted)}._group_1co2u_153 button:not(:first-child){margin-left:-1px}._group_1co2u_153 button:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px}._group_1co2u_153 button:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px}._select_1ip4k_1{width:210px}._btnH_15adi_1{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._btnV_15adi_7{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._frame_15mog_1{box-sizing:border-box;grid-area:frame;width:100%;height:100%;margin:0 auto;position:relative;overflow:hidden}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
1
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`._button_1vpzl_1{cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;box-sizing:border-box;background-color:#0000;border:1px solid #0000;border-radius:4px;justify-content:center;align-items:center;gap:8px;height:32px;padding:0 8px;font-family:inherit;font-size:14px;font-weight:500;transition:background-color .2s,border-color .2s,opacity .2s;display:inline-flex}._button_1vpzl_1:disabled{pointer-events:none;opacity:.5}._button_1vpzl_1 svg{flex-shrink:0;width:16px;height:16px}._default_1vpzl_35{background-color:var(--primary);color:var(--primary-foreground)}._default_1vpzl_35:hover{opacity:.9}._outline_1vpzl_44{border-color:var(--border);background-color:var(--background);color:var(--foreground)}._outline_1vpzl_44:hover{background-color:var(--secondary)}._ghost_1vpzl_54{color:var(--foreground);padding:0 8px}._ghost_1vpzl_54:hover{background-color:var(--secondary)}._rect_1vpzl_63{width:32px;height:32px}._separator_gp8ff_1{background-color:var(--border);box-sizing:border-box;border:none;flex-shrink:0;display:block}._separator_gp8ff_1[data-orientation=horizontal]{width:100%;height:1px}._separator_gp8ff_1[data-orientation=vertical]{align-self:stretch;width:1px;height:100%;margin:0}._wrapper_1aw0m_1{box-sizing:border-box;width:100%;position:relative}._trigger_1aw0m_6{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--border);cursor:pointer;box-sizing:border-box;-webkit-user-select:none;user-select:none;border-radius:4px;outline:none;justify-content:space-between;align-items:center;padding:0 8px 0 10px;font-family:inherit;font-size:14px;transition:border-color .2s;display:flex}._trigger_1aw0m_6:hover,._trigger_1aw0m_6:focus{border-color:var(--muted-foreground)}._triggerArrow_1aw0m_31{width:16px;height:16px;color:var(--muted-foreground);transition:transform .2s}._wrapper_1aw0m_1[data-state=open] ._triggerArrow_1aw0m_31{transform:rotate(180deg)}._content_1aw0m_40{background-color:var(--background);border:1px solid var(--border);z-index:50;box-sizing:border-box;border-radius:4px;width:100%;max-height:282px;padding:4px;position:absolute;top:calc(100% + 4px);left:0;overflow-y:auto;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}._content_1aw0m_40::-webkit-scrollbar{width:4px}._content_1aw0m_40::-webkit-scrollbar-track{background:0 0}._content_1aw0m_40::-webkit-scrollbar-thumb{background-color:var(--border);border-radius:10px}._wrapper_1aw0m_1[data-state=closed] ._content_1aw0m_40{display:none}._groupLabel_1aw0m_74{color:var(--muted-foreground);-webkit-user-select:none;user-select:none;padding:8px 10px;font-size:12px;font-weight:500}._item_1aw0m_81{width:100%;color:var(--foreground);cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;background:0 0;border-radius:4px;justify-content:space-between;align-items:center;padding:4px 10px;display:flex}._item_1aw0m_81:hover{background-color:var(--secondary)}._itemLeft_1aw0m_98{font-size:14px;font-weight:400}._itemAddon_1aw0m_102{align-items:center;gap:8px;display:flex}._itemAddon_1aw0m_102 span{color:var(--muted-foreground);font-size:12px}._itemAddon_1aw0m_102 svg{font-size:14px}._itemAddon_1aw0m_102 b{flex-shrink:0;width:16px;height:16px}._itemRightContainer_1aw0m_122{align-items:center;gap:8px;display:flex}._itemRight_1aw0m_122{color:var(--muted-foreground);font-size:14px}._itemCheck_1aw0m_131{width:16px;height:16px;color:var(--foreground);flex-shrink:0}:host{height:100%;display:block}:host *{box-sizing:border-box}._root_c6gk7_8{width:100%;height:100%;font-size:16px;font-family:var(--font-sans);--font-sans:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, Helvetica, Arial, sans-serif;--font-mono:"Courier New", Courier, monospace;--color-white:#fff;--color-white-fade:color-mix(in srgb, var(--color-white) 40%, transparent);--color-black:#000;--color-red:oklch(63.7% .237 25.331);--color-green:oklch(76.8% .188 151.716);--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(75.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--accent-blue:oklch(60.9% .221 251.687);--accent-blue-light:oklch(96% .02 250);--accent-blue-fade:color-mix(in srgb, var(--accent-blue) 60%, transparent);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 50%, transparent);--overlay-bg-white:color-mix(in srgb, var(--color-white) 80%, transparent);position:relative}._root_c6gk7_8[data-theme=dark]{--background:oklch(24.5% 0 0);--foreground:oklch(78.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(24.5% 0 0);--muted-foreground:oklch(50% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--accent-blue-light:oklch(25% .06 250);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 75%, transparent)}._root_c6gk7_8 h1,._root_c6gk7_8 h2,._root_c6gk7_8 h3,._root_c6gk7_8 h4,._root_c6gk7_8 h5,._root_c6gk7_8 h6{color:var(--foreground);margin:0;font-weight:600}._textRed_c6gk7_73{color:var(--color-red)}._bgRed_c6gk7_76{background-color:var(--color-red)}._bgGreen_c6gk7_79{background-color:var(--color-green)}._textGreen_c6gk7_82{color:var(--color-green)}._mask_c6gk7_85{background-color:var(--overlay-bg)}._semibold_c6gk7_88{letter-spacing:.4px;font-weight:600}._bold_c6gk7_92{letter-spacing:.4px;font-weight:700}._system_c6gk7_96{color:var(--muted-foreground);background-color:var(--background);justify-content:center;align-items:center;display:flex;position:absolute;inset:0}._wrapper_c6gk7_106{width:100%;height:100%;min-height:480px;position:relative;overflow:hidden}._grid_c6gk7_113{grid-template:"header header"48px"sidebar frame"minmax(0,1fr)"sidebar infobar"32px/48px 1fr;height:100%;display:grid;position:relative}._grid_c6gk7_113._mobile_c6gk7_124{grid-template-columns:0 1fr}._gridNoInfobar_c6gk7_128{grid-template:"header header"48px"sidebar frame"1fr/48px 1fr;height:100%;display:grid;position:relative}._gridNoInfobar_c6gk7_128._mobile_c6gk7_124{grid-template-columns:0 1fr}._input_kyavx_1{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--input);box-sizing:border-box;border-radius:4px;outline:none;padding:0 8px;font-family:inherit;font-size:14px;line-height:normal;transition:border-color .2s,box-shadow .2s;display:block}._input_kyavx_1:hover:not(:disabled):not(:focus){border-color:var(--muted-foreground)}._input_kyavx_1:focus{box-shadow:0 0 0 1px var(--ring)}._input_kyavx_1:disabled{cursor:not-allowed;opacity:.5;background-color:var(--secondary)}._input_kyavx_1::placeholder{color:var(--muted-foreground);opacity:1}._numberClean_kyavx_39::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39[type=number]{-moz-appearance:textfield}._container_14vsv_1{position:relative}._legend_14vsv_4{color:var(--muted-foreground);background:var(--background);margin-left:8px;padding:0 4px;font-size:12px;position:absolute;top:-9px}._suffix_14vsv_13{color:var(--muted-foreground);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:14px;position:absolute;bottom:2px;right:8px}._group_1e7jm_1{margin-left:4px;display:flex}._save_1e7jm_6{width:36px;color:var(--color-green);border-top-right-radius:0;border-bottom-right-radius:0}._close_1e7jm_13{width:36px;color:var(--color-red);border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}._tooltip_1dl6s_1{position:relative}._container_1dl6s_5{gap:0;display:flex}._container_1dl6s_5[data-position=left],._container_1dl6s_5[data-position=right]{flex-direction:column}._container_1dl6s_5 [data-tooltip]{pointer-events:auto}._popup_1dl6s_19{top:var(--tooltip-y,0px);left:var(--tooltip-x,0px);background-color:var(--foreground);color:var(--background);z-index:999;pointer-events:none;opacity:var(--tooltip-opacity,0);width:var(--tooltip-w,auto);height:var(--tooltip-h,auto);transition:opacity var(--tooltip-fade,.2s);border-radius:4px;font-size:14px;position:absolute;transform:translate(-50%,-100%);box-shadow:0 2px 8px #0000001a}._popup_1dl6s_19:before{content:"";background-color:inherit;width:10px;height:10px;position:absolute;bottom:-3px;left:50%;transform:translate(-50%)rotate(45deg)}._popup_1dl6s_19[data-position=top]{transform:translate(-50%,-100%)}._popup_1dl6s_19[data-position=top]:before{top:auto;bottom:-3px;left:50%;transform:translate(-50%)rotate(45deg)}._popup_1dl6s_19[data-position=bottom]{transform:translate(-50%)}._popup_1dl6s_19[data-position=bottom]:before{top:-3px;bottom:auto;left:50%;transform:translate(-50%)rotate(45deg)}._popup_1dl6s_19[data-position=left]{transform:translate(-100%,-50%)}._popup_1dl6s_19[data-position=left]:before{top:50%;left:auto;right:-3px;transform:translateY(-50%)rotate(45deg)}._popup_1dl6s_19[data-position=right]{transform:translateY(-50%)}._popup_1dl6s_19[data-position=right]:before{top:50%;left:-3px;right:auto;transform:translateY(-50%)rotate(45deg)}._popup_1dl6s_19._animated_1dl6s_92{transition:left var(--tooltip-slide,.4s), top var(--tooltip-slide,.4s), width var(--tooltip-slide,.4s), height var(--tooltip-slide,.4s), opacity var(--tooltip-fade,.2s)}._mask_1dl6s_101{border-radius:inherit;width:100%;height:100%;overflow:hidden}._track_1dl6s_108{width:max-content;height:max-content;transform:translateX(calc(-1 * var(--tooltip-offset,0px)));display:flex}._track_1dl6s_108[data-position=left],._track_1dl6s_108[data-position=right]{transform:translateY(calc(-1 * var(--tooltip-offset,0px)));flex-direction:column}._animated_1dl6s_92 ._track_1dl6s_108{transition:transform var(--tooltip-slide,.4s)}._title_1dl6s_125{min-width:var(--tooltip-item-w,auto);max-width:var(--tooltip-item-w,none);min-height:var(--tooltip-item-h,32px);max-height:var(--tooltip-item-h,none);white-space:nowrap;box-sizing:border-box;flex:none;justify-content:center;align-items:center;padding:0 10px;display:flex}._surfaceTool_h38e6_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}._header_1yueu_1{box-sizing:border-box;background-color:var(--background);border-bottom:1px solid var(--border);grid-area:header;justify-content:space-between;align-items:center;height:48px;padding:0 8px;display:flex}._left_1yueu_12{align-items:center;gap:0;display:flex}._sidebarToggle_1yueu_17{border-right:solid 1px var(--border);cursor:pointer;justify-content:center;align-items:center;width:48px;height:48px;transition:all .2s;display:none;position:relative;left:-8px}._sidebarToggle_1yueu_17._mobile_1yueu_29{display:flex}._sidebarIcon_1yueu_33{stroke-width:1.6px;width:18px;height:18px}._tools_1yueu_38{gap:8px;display:flex}._history_1yueu_42{align-items:center;gap:6px;display:flex}._historyText_1yueu_47{color:var(--muted-foreground);font-size:14px;font-family:var(--font-mono)}._sidebar_1j9gh_1{background:var(--background);border-right:1px solid var(--border);z-index:10;grid-area:sidebar;width:48px;position:relative}._sidebar_1j9gh_1._mobile_1j9gh_9{transition:transform .2s ease-out;transform:translate(-110%);box-shadow:0 2px 8px #0000001a}._sidebar_1j9gh_1._mobile_1j9gh_9._open_1j9gh_14{transform:translate(0%)}._wrapper_1j9gh_19{flex-direction:column;display:flex}._item_1j9gh_23{cursor:pointer;justify-content:center;align-items:center;height:48px;transition:all .2s;display:flex;position:relative}._item_1j9gh_23 svg{width:16px;height:16px}._item_1j9gh_23:hover{background-color:var(--accent)}._item_1j9gh_23._selected_1j9gh_41{color:var(--accent-blue);background-color:var(--accent)}._item_1j9gh_23._selected_1j9gh_41:before{content:"";background-color:var(--accent-blue);width:2px;position:absolute;top:0;bottom:0;left:0}._infobar_ofe91_1{background:var(--muted);font-family:var(--font-mono);grid-area:infobar;justify-content:space-between;align-items:center;padding:0 16px;font-size:14px;display:flex}._resize_1sbig_1{align-items:center;padding-top:16px}._toolsLock_1sbig_5{width:12px;height:12px;color:var(--muted-foreground)}._indicatorWrapper_1sbig_10{justify-content:center;width:100%;height:2px;display:flex;position:absolute;top:0;left:0}._indicator_1sbig_10{background:var(--accent-blue);opacity:.6;border-radius:2px;width:30%;height:100%;transition:width .2s}._preview_dvanl_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._rotate_dvanl_12{box-sizing:border-box;width:100%;height:100%;transition:all .2s linear;position:absolute;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}._flip_dvanl_24{box-sizing:border-box;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._image_dvanl_32{max-width:none;max-height:none;transition:all .2s linear;display:block;position:absolute}._wrapper_1co2u_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;position:absolute;inset:0}._box_1co2u_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}._toolsInfo_1co2u_18{-webkit-user-select:none;user-select:none;min-width:54px;margin-top:-2px;display:inline-block}._toolsInfoLabel_1co2u_25{color:var(--muted-foreground);font-size:12px;line-height:12px}._toolsInfoValue_1co2u_30{color:var(--foreground);font-size:14px;line-height:14px}._linesBox_1co2u_35{pointer-events:none;position:absolute;inset:1px}._line_1co2u_35{border:1px dashed var(--color-white);opacity:.5;position:absolute}._lineV_1co2u_45{border-top:0;border-bottom:0;width:33%;height:100%;top:0;left:33%}._lineH_1co2u_53{border-left:0;border-right:0;width:100%;height:33%;top:33%;left:0}._pointer_1co2u_61{box-sizing:border-box;width:14px;height:14px;position:absolute}._pointerTopLeft_1co2u_67{border-top:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nwse-resize;top:-6px;left:-6px}._pointerTopRight_1co2u_74{border-top:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nesw-resize;top:-6px;right:-6px}._pointerBottomRight_1co2u_81{border-bottom:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nwse-resize;bottom:-6px;right:-6px}._pointerBottomLeft_1co2u_88{border-bottom:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nesw-resize;bottom:-6px;left:-6px}._mobileBorder_1co2u_95{box-sizing:border-box;border:2px solid var(--accent-blue);position:absolute;inset:0}._mobilePointer_1co2u_101{background-color:var(--overlay-bg-white);border:3px solid var(--accent-blue);box-sizing:border-box;border-radius:50%;width:32px;height:32px;position:absolute;bottom:-16px;right:-16px}._info_1co2u_112{height:16px;font-family:var(--font-mono);color:#000;background-color:var(--color-white-fade);box-sizing:border-box;align-items:center;padding:0 6px;font-size:12px;display:flex;position:absolute}._info_1co2u_112 b{font-weight:600;transform:translateY(1px)}._infoX_1co2u_129{border-left:solid 2px var(--accent-blue);top:-12px;left:16px}._infoY_1co2u_134{transform-origin:100%;border-right:solid 2px var(--accent-blue);top:8px;right:calc(100% + 4px);transform:rotate(-90deg)}._infoW_1co2u_141{border-right:solid 2px var(--accent-blue);bottom:-12px;right:16px}._infoH_1co2u_146{transform-origin:0%;border-left:solid 2px var(--accent-blue);bottom:8px;left:calc(100% + 4px);transform:rotate(-90deg)}._group_1co2u_153{flex-shrink:0;width:max-content;display:flex}._group_1co2u_153 button{color:var(--foreground);border-radius:0}._group_1co2u_153 button._active_1co2u_162{color:var(--accent-blue);background:var(--muted)}._group_1co2u_153 button:not(:first-child){margin-left:-1px}._group_1co2u_153 button:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px}._group_1co2u_153 button:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px}._select_1ip4k_1{width:210px}._btnH_15adi_1{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._btnV_15adi_7{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._frame_15mog_1{box-sizing:border-box;grid-area:frame;width:100%;height:100%;margin:0 auto;position:relative;overflow:hidden}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
2
2
  (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react")):typeof define==`function`&&define.amd?define([`exports`,`react`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Pixedi={},e.React))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t,1);var u={sm:480,md:768,lg:1024,xl:1280},d={INITIAL:`initial`,RESIZE:`resize`,CROP:`crop`,PRESET_CROP:`presetCrop`,FLIP:`flip`,ROTATE:`rotate`,FILTERS:`filters`},f={tools:[`resize`,`crop`,`presetCrop`,`flip`,`rotate`,`filters`],infobar:!0,quality:.85,saveAsWEBP:!1,exportAs:`blob`},p=(e,t,n,r,i,a,o)=>({history:{pointer:0,items:[{width:t,height:n,action:{name:d.INITIAL,args:null}}]},currentAction:null,previewUrl:i,originalBlob:r,mimeType:e,sidebar:!1,settings:o,isAlpha:a}),m=(0,t.createContext)(void 0),h=c((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),g=c((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case E:return`Activity`}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){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ee:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case T:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===T)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=D.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(ne.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){k||(k=!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))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function l(){var e=t(this.type);return A[e]||(A[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}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,"ref",{enumerable:!1,value:null}):Object.defineProperty(e,"ref",{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(re(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}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.`);else f(p);if(ne.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,oe[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
3
3
  let props = %s;
4
4
  <%s {...props} />
5
5
  React keys must be passed directly to JSX without using spread:
6
6
  let props = %s;
7
- <%s key={someKey} {...props} />`,o,p,m,p),oe[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===T&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),ee=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),te=Symbol.for(`react.client.reference`),D=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=Object.prototype.hasOwnProperty,re=Array.isArray,O=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var k,A={},ie=m.react_stack_bottom_frame.bind(m,o)(),ae=O(i(o)),oe={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>D.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):ie,r?O(i(e)):ae)},e.jsxs=function(e,t,n){var r=1e4>D.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):ie,r?O(i(e)):ae)}})()})),_=c(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=h():t.exports=g()}))(),v=({children:e,mimeType:n,width:r,height:i,originalBlob:a,previewUrl:o,isAlpha:s,settings:c})=>{let[l,u]=(0,t.useState)(p(n,r,i,a,o,s,c)),f=(0,t.useRef)(null);(0,t.useEffect)(()=>()=>{f.current&&=(URL.revokeObjectURL(f.current),null)},[]);let h=e=>u(t=>({...t,currentAction:e})),g=e=>u(t=>{let n=t.history.pointer+1,r=[...t.history.items.slice(0,n),e];return{...t,currentAction:null,history:{items:r,pointer:n}}}),v=()=>{let{items:e,pointer:t}=l.history;return e.at(t)??e.at(0)??{width:0,height:0,action:{name:d.INITIAL,args:null}}},y=()=>{let{items:e,pointer:t}=l.history;if(e.length===0||t<0)return 0;let n=e.slice(0,t+1).findLast(e=>e.action.name===d.ROTATE);return n?.action.name===d.ROTATE?n.action.args.degrees:0},b=()=>u(e=>({...e,history:{items:[e.history.items[0]],pointer:0}})),x=()=>u(e=>e.history.pointer<=0?e:{...e,history:{...e.history,pointer:e.history.pointer-1}}),S=()=>u(e=>e.history.pointer>=e.history.items.length-1?e:{...e,history:{...e.history,pointer:e.history.pointer+1}}),C=e=>u(t=>({...t,sidebar:e})),w=(0,t.useMemo)(()=>new EventTarget,[]),ee=e=>{f.current&&URL.revokeObjectURL(f.current),f.current=URL.createObjectURL(e.previewBlob),u(p(e.mimeType,e.width,e.height,e.newBlob,f.current,e.isAlpha,c))};return(0,_.jsx)(m,{value:{...l,setImage:ee,setCurrentAction:h,getLastHistoryItem:v,getLastRotation:y,addToHistory:g,resetHistory:b,undo:x,redo:S,setSidebar:C,eventBus:w},children:e})},y="(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.`})}}})();",b=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,y],{type:`text/javascript;charset=utf-8`});function x(e){let t;try{if(t=b&&(self.URL||self.webkitURL).createObjectURL(b),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(y),{name:e?.name})}}var S=({src:e,skip:n=!1})=>{let[r,i]=(0,t.useState)({loading:!n,error:``,width:0,height:0,mimeType:``,originalBlob:null,previewUrl:``,isAlpha:!1}),a=(0,t.useRef)(null);return(0,t.useEffect)(()=>{if(!e||n)return;let t=new x;return t.postMessage(e),t.onmessage=e=>{let t=e.data;t.success?(a.current&&URL.revokeObjectURL(a.current),a.current=URL.createObjectURL(t.previewBlob),i({loading:!1,error:``,mimeType:t.mimeType,width:t.width,height:t.height,originalBlob:t.originalBlob,previewUrl:a.current,isAlpha:t.isAlpha})):i(e=>({...e,loading:!1,error:t.error||`Error processing image.`}))},()=>{t.terminate(),a.current&&=(URL.revokeObjectURL(a.current),null)}},[n,e]),r},C=()=>{if(typeof window>`u`||!window.navigator)return null;let e=window.navigator.userAgent.toLowerCase();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},w=()=>{let[e]=(0,t.useState)(()=>C());return e};function ee(e,n){let[r,i]=(0,t.useState)(!0);return(0,t.useEffect)(()=>{if(!n)return;let t=new ResizeObserver(([t])=>{t&&i(t.contentRect.width<u[e])});return t.observe(n),()=>t.disconnect()},[e,n]),r}var T={xmlns:`http://w3.org`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},E=e=>(0,_.jsx)(`svg`,{...T,...e,children:(0,_.jsx)(`path`,{d:`M20 6 9 17l-5-5`})}),te=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M18 6 6 18`}),(0,_.jsx)(`path`,{d:`m6 6 12 12`})]}),D=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}),(0,_.jsx)(`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`})]}),ne=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`m12 19-7-7 7-7`}),(0,_.jsx)(`path`,{d:`M19 12H5`})]}),re=e=>(0,_.jsx)(`svg`,{...T,...e,children:(0,_.jsx)(`path`,{d:`m6 9 6 6 6-6`})}),O=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M3 7v6h6`}),(0,_.jsx)(`path`,{d:`M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13`})]}),k=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M21 7v6h-6`}),(0,_.jsx)(`path`,{d:`M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7`})]}),A=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M6 2v14a2 2 0 0 0 2 2h14`}),(0,_.jsx)(`path`,{d:`M18 22V8a2 2 0 0 0-2-2H2`})]}),ie=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}),(0,_.jsx)(`circle`,{cx:`9`,cy:`9`,r:`2`}),(0,_.jsx)(`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`})]}),ae=e=>(0,_.jsx)(`svg`,{...T,...e,children:(0,_.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`})}),oe=e=>(0,_.jsx)(`svg`,{...T,...e,children:(0,_.jsx)(`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`2`})}),se=e=>(0,_.jsx)(`svg`,{...T,...e,children:(0,_.jsx)(`rect`,{width:`20`,height:`15`,x:`2`,y:`4.5`,rx:`2`})}),ce=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`}),(0,_.jsx)(`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`}),(0,_.jsx)(`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`}),(0,_.jsx)(`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`}),(0,_.jsx)(`rect`,{width:`10`,height:`8`,x:`7`,y:`8`,rx:`1`})]}),le=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3`}),(0,_.jsx)(`path`,{d:`M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3`}),(0,_.jsx)(`path`,{d:`M12 20v2`}),(0,_.jsx)(`path`,{d:`M12 14v2`}),(0,_.jsx)(`path`,{d:`M12 8v2`}),(0,_.jsx)(`path`,{d:`M12 2v2`})]}),ue=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3`}),(0,_.jsx)(`path`,{d:`M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3`}),(0,_.jsx)(`path`,{d:`M4 12H2`}),(0,_.jsx)(`path`,{d:`M10 12H8`}),(0,_.jsx)(`path`,{d:`M16 12h-2`}),(0,_.jsx)(`path`,{d:`M22 12h-2`})]}),de=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`}),(0,_.jsx)(`path`,{d:`M21 3v5h-5`})]}),fe=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,_.jsx)(`path`,{d:`M3 3v5h5`})]}),pe=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`}),(0,_.jsx)(`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`}),(0,_.jsx)(`path`,{d:`M14 4h7`}),(0,_.jsx)(`path`,{d:`M14 9h7`}),(0,_.jsx)(`path`,{d:`M14 15h7`}),(0,_.jsx)(`path`,{d:`M14 20h7`})]}),me=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}),(0,_.jsx)(`path`,{d:`M9 3v18`}),(0,_.jsx)(`path`,{d:`m14 9 3 3-3 3`})]}),he=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}),(0,_.jsx)(`path`,{d:`M9 3v18`}),(0,_.jsx)(`path`,{d:`m16 15-3-3 3-3`})]}),j=e=>(0,_.jsx)(`svg`,{...T,...e,children:(0,_.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,children:(0,_.jsx)(`animateTransform`,{attributeType:`xml`,attributeName:`transform`,type:`rotate`,from:`0 12 12`,to:`360 12 12`,dur:`0.8s`,repeatCount:`indefinite`})})}),M=()=>{let e=(0,t.useContext)(m);if(!e)throw Error(`usePixediContext must be used within an PixediProvider`);return e},N={button:`_button_1vpzl_1`,default:`_default_1vpzl_35`,outline:`_outline_1vpzl_44`,ghost:`_ghost_1vpzl_54`,rect:`_rect_1vpzl_63`},P=({className:e=``,variant:t=`default`,children:n,ref:r,...i})=>(0,_.jsx)(`button`,{ref:r,className:`${N.button} ${N[t]} ${e}`.trim(),...i,children:n}),ge={separator:`_separator_gp8ff_1`},_e=(0,t.forwardRef)(({className:e=``,orientation:t=`horizontal`,...n},r)=>(0,_.jsx)(`hr`,{ref:r,role:`separator`,"aria-orientation":t,"data-orientation":t,className:`${ge.separator} ${e}`.trim(),...n}));_e.displayName=`Separator`;var F={wrapper:`_wrapper_1aw0m_1`,trigger:`_trigger_1aw0m_6`,triggerArrow:`_triggerArrow_1aw0m_31`,content:`_content_1aw0m_40`,groupLabel:`_groupLabel_1aw0m_74`,item:`_item_1aw0m_81`,itemLeft:`_itemLeft_1aw0m_98`,itemAddon:`_itemAddon_1aw0m_102`,itemRightContainer:`_itemRightContainer_1aw0m_122`,itemRight:`_itemRight_1aw0m_122`,itemCheck:`_itemCheck_1aw0m_131`},I={root:`_root_c6gk7_8`,textRed:`_textRed_c6gk7_73`,bgRed:`_bgRed_c6gk7_76`,bgGreen:`_bgGreen_c6gk7_79`,textGreen:`_textGreen_c6gk7_82`,mask:`_mask_c6gk7_85`,semibold:`_semibold_c6gk7_88`,bold:`_bold_c6gk7_92`,system:`_system_c6gk7_96`,wrapper:`_wrapper_c6gk7_106`,grid:`_grid_c6gk7_113`,mobile:`_mobile_c6gk7_124`,gridNoInfobar:`_gridNoInfobar_c6gk7_128`},ve=e=>{let t=0,n=window.innerHeight;for(let r=e.parentElement;r;r=r.parentElement){let{overflow:e,overflowY:i}=getComputedStyle(r);if(e===`visible`&&i===`visible`)continue;let a=r.getBoundingClientRect();t=Math.max(t,a.top),n=Math.min(n,a.bottom)}return{top:t,bottom:n}},ye=({items:e,value:n,onChange:r,placeholder:i=`Select an option`,className:a=``,renderOption:o})=>{let[s,c]=(0,t.useState)(!1),l=(0,t.useRef)(null),u=(0,t.useRef)(null),d=(0,t.useRef)(null),f=(0,t.useMemo)(()=>{let t=e=>e.reduce((e,n)=>n.options?[...e,...t(n.options.map(e=>({...e,fullName:`${n.label} ${e.label}`})))]:[...e,n],[]);return t(e)},[e]).find(e=>e.value===n);(0,t.useEffect)(()=>{let e=e=>{l.current&&!e.composedPath().includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,t.useLayoutEffect)(()=>{let e=l.current,t=u.current,n=d.current;if(!s||!e||!t||!n)return;n.style.removeProperty(`top`),n.style.removeProperty(`max-height`);let{top:r,bottom:i}=ve(e),a=e.getBoundingClientRect().top,o=t.getBoundingClientRect(),c=n.offsetHeight,f=i-8-o.bottom-4,p=o.top-4-r-8,m=o.bottom+4,h=0;c>f&&(c<=p?m=o.top-4-c:p>f?(h=Math.max(p,0),m=o.top-4-h):h=Math.max(f,0)),h&&(n.style.maxHeight=`${h}px`),n.style.top=`${m-a}px`},[s,e]);let p=e=>{r(e),c(!1)};return(0,_.jsxs)(`div`,{ref:l,className:`${F.wrapper} ${a}`.trim(),"data-state":s?`open`:`closed`,children:[(0,_.jsxs)(`button`,{ref:u,type:`button`,className:F.trigger,onClick:()=>c(!s),children:[(0,_.jsx)(`span`,{children:f?f.fullName:i}),(0,_.jsx)(re,{className:F.triggerArrow})]}),(0,_.jsx)(`div`,{ref:d,className:F.content,children:e.map((e,t)=>e.options?(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`div`,{className:`${F.groupLabel} ${I.semibold}`,children:e.label}),e.options.map(e=>(0,_.jsxs)(`div`,{className:F.item,onClick:()=>p(e.value),children:[o?o(e):(0,_.jsx)(`span`,{className:F.itemLeft,children:e.label}),(0,_.jsxs)(`div`,{className:F.itemAddon,children:[e.rightLabel&&(0,_.jsx)(`span`,{children:e.rightLabel}),n===e.value&&(0,_.jsx)(E,{className:F.itemCheck}),n!==e.value&&(0,_.jsx)(`b`,{})]})]},e.value))]},`group-${t}`):(0,_.jsxs)(`div`,{className:F.item,onClick:()=>p(e.value),children:[o?o(e):(0,_.jsx)(`span`,{className:F.itemLeft,children:e.label}),n===e.value&&(0,_.jsx)(E,{className:F.itemCheck})]},e.value))})]})},be={input:`_input_kyavx_1`,numberClean:`_numberClean_kyavx_39`},xe=({className:e=``,type:t=`text`,hideArrows:n=!0,ref:r,...i})=>{let a=t===`number`&&n?be.numberClean:``;return(0,_.jsx)(`input`,{ref:r,type:t,className:`${be.input} ${a} ${e}`.trim(),...i})},Se={container:`_container_14vsv_1`,legend:`_legend_14vsv_4`,suffix:`_suffix_14vsv_13`},Ce=({label:e,className:t=``,style:n,ref:r,...i})=>(0,_.jsxs)(`div`,{className:`${Se.container} ${t}`.trim(),style:n,children:[(0,_.jsx)(`span`,{className:Se.legend,children:e}),(0,_.jsx)(xe,{ref:r,type:`number`,...i}),(0,_.jsx)(`span`,{className:Se.suffix,children:`px`})]}),we={group:`_group_1e7jm_1`,save:`_save_1e7jm_6`,close:`_close_1e7jm_13`},L=({onSave:e,onClose:t,saving:n=!1,disabled:r=!1})=>(0,_.jsxs)(`div`,{className:we.group,children:[(0,_.jsx)(P,{variant:`outline`,className:we.save,"aria-label":`Save`,disabled:r||n,onClick:e,children:n?(0,_.jsx)(j,{}):(0,_.jsx)(E,{})}),(0,_.jsx)(P,{variant:`outline`,className:we.close,"aria-label":`Close`,disabled:n,onClick:t,children:(0,_.jsx)(te,{})})]}),R={tooltip:`_tooltip_gohf2_1`,container:`_container_gohf2_5`,popup:`_popup_gohf2_18`,animated:`_animated_gohf2_62`,mask:`_mask_gohf2_71`,track:`_track_gohf2_78`,title:`_title_gohf2_94`},Te=(e,n=`horizontal`)=>{let[r,i]=(0,t.useState)(null),[a,o]=(0,t.useState)(null),[s,c]=(0,t.useState)(!1),[l,u]=(0,t.useState)(!1),[d,f]=(0,t.useState)([]),p=(0,t.useRef)(null),m=(0,t.useRef)(null),h=(0,t.useRef)([]),g=n===`vertical`,_=(0,t.useMemo)(()=>{let n=[];return t.Children.forEach(e,e=>{if((0,t.isValidElement)(e)){let{"data-tooltip":t}=e.props;t&&n.push(t)}}),n},[e]),v=_.join(`\0`),y=_.length;(0,t.useLayoutEffect)(()=>{let e=()=>{let e=h.current.slice(0,y).map(e=>({w:e?.offsetWidth??0,h:e?.offsetHeight??0}));f(t=>t.length===e.length&&t.every((t,n)=>t.w===e[n].w&&t.h===e[n].h)?t:e)};e();let t=m.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e);return n.observe(t),()=>n.disconnect()},[v,y]),(0,t.useEffect)(()=>{if(!s||l)return;let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>u(!0))});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}},[s,l]);let b=e=>{let t=e.target.closest(`[data-tooltip]`);if(!t){c(!1);return}let n=t.parentElement;if(!n)return;let a=Array.from(n.children).indexOf(t);if(a===-1||s&&a===r)return;let l=p.current?.getBoundingClientRect();if(!l)return;let d=t.getBoundingClientRect(),f=g?{x:d.right-l.left+4,y:d.top-l.top+d.height/2}:{x:d.left-l.left+d.width/2,y:d.top-l.top-8};s||u(!1),o(f),i(a),c(!0)},x=()=>c(!1),S=r??0,C=d[S],w=d.slice(0,S).reduce((e,t)=>e+(g?t.h:t.w),0);return{containerRef:p,trackRef:m,titleRefs:h,titles:_,isVertical:g,isVisible:s,isAnimated:l,cssVars:{"--tooltip-x":a?`${a.x}px`:`0px`,"--tooltip-y":a?`${a.y}px`:`0px`,"--tooltip-opacity":s?`1`:`0`,"--tooltip-w":C?.w?`${C.w}px`:`auto`,"--tooltip-h":C?.h?`${C.h}px`:`auto`,"--tooltip-offset":`${w}px`},handleMouseMove:b,handleMouseLeave:x}},z=({children:e,orientation:t=`horizontal`,className:n=``,classNameTitle:r=``})=>{let{containerRef:i,trackRef:a,titleRefs:o,titles:s,isVertical:c,isAnimated:l,cssVars:u,handleMouseMove:d,handleMouseLeave:f}=Te(e,t);return(0,_.jsxs)(`div`,{ref:i,onMouseMove:d,onMouseLeave:f,onBlur:f,className:R.tooltip,style:u,children:[(0,_.jsx)(`div`,{"data-orientation":c?`vertical`:`horizontal`,className:R.container,children:e}),(0,_.jsx)(`div`,{"aria-hidden":`true`,"data-orientation":c?`vertical`:`horizontal`,className:`${R.popup} ${l?R.animated:``} ${n}`,children:(0,_.jsx)(`div`,{className:R.mask,children:(0,_.jsx)(`div`,{ref:a,"data-orientation":c?`vertical`:`horizontal`,className:R.track,children:s.map((e,t)=>(0,_.jsx)(`div`,{ref:e=>{o.current[t]=e},className:`${R.title} ${r}`,children:e},t))})})})]})},Ee={surfaceTool:`_surfaceTool_h38e6_1`},B=({children:e,className:t=``,ref:n})=>(0,_.jsx)(`div`,{ref:n,className:`${Ee.surfaceTool} ${t}`,children:e}),De=1920,Oe=.85,ke=[{label:`Facebook`,value:`facebook`,options:[{value:`facebook-post`,label:`Post`,w:1200,h:630,rightLabel:`1200 x 630`},{value:`facebook-cover`,label:`Cover`,w:851,h:315,rightLabel:`851 x 315`},{value:`facebook-profile`,label:`Profile`,w:170,h:170,rightLabel:`170 x 170`},{value:`facebook-story`,label:`Story`,w:1080,h:1920,rightLabel:`1080 x 1920`}]},{label:`Instagram`,value:`instagram`,options:[{value:`instagram-landscape`,label:`Landscape`,w:1080,h:566,rightLabel:`1080 x 566`},{value:`instagram-portait`,label:`Portait`,w:1080,h:1350,rightLabel:`1080 x 1350`},{value:`instagram-square`,label:`Square`,w:1080,h:1080,rightLabel:`1080 x 1080`},{value:`instagram-story`,label:`Story`,w:1080,h:1920,rightLabel:`1080 x 1920`},{value:`instagram-thumbnail`,label:`Thumbnail`,w:161,h:161,rightLabel:`161 x 161`}]},{label:`LinkedIn`,value:`linkedin`,options:[{value:`linkedin-blog-post`,label:`Blog Post`,w:1200,h:627,rightLabel:`1200 x 627`},{value:`linkedin-cover`,label:`Cover`,w:1128,h:191,rightLabel:`1128 x 191`},{value:`linkedin-profile`,label:`Profile`,w:400,h:400,rightLabel:`400 x 400`}]}],V=32,Ae=(e,t,n,r,i,a,o,s,c,l)=>{let{x:u,y:d,w:f,h:p}=c;if(e){let e=o-c.w-c.x;u+=i-n,u<0&&(u=0),f=o-u-e,f<V&&(f=V,u=o-e-V);let t=s-p-d;d+=a-r,d<0&&(d=0),p=s-d-t,p<V&&(p=V,d=s-t-V)}else{if(t>=1){let e=i-n,r=Math.round(e/t);f-=e,p-=r,u+=e,d+=r}else{let e=a-r,n=Math.round(e*t);f-=n,p-=e,u+=n,d+=e}if(u<0||d<0||f<V||p<V)return l}return{x:u,y:d,w:f,h:p}},je=(e,t,n,r,i,a,o,s,c,l)=>{let{x:u}=c,{y:d,w:f,h:p}=c;if(e){f+=i-n,f+u>o&&(f=o-u),f<V&&(f=V);let e=s-p-d;d+=a-r,d<0&&(d=0),p=s-d-e,p<V&&(p=V,d=s-e-V)}else{if(t>1){let e=i-n,r=Math.round(e/t);f+=e,p+=r,d-=r}else{let e=a-r,n=Math.round(e*t);f-=n,p-=e,d+=e}if(f+u>o||d<0||f<V||p<V)return l}return{x:u,y:d,w:f,h:p}},Me=(e,t,n,r,i,a,o,s,c,l)=>{let{y:u}=c,{x:d,w:f,h:p}=c;if(e){p+=a-r,p+u>s&&(p=s-u),p<V&&(p=V);let e=o-c.w-c.x;d+=i-n,d<0&&(d=0),f=o-d-e,f<V&&(f=V,d=o-e-V)}else{if(t>=1){let e=i-n,r=Math.round(e/t);f-=e,p-=r,d+=e}else{let e=a-r,n=Math.round(e*t);f+=n,p+=e,d-=n}if(p+u>s||d<0||f<V||p<V)return l}return{x:d,y:u,w:f,h:p}},Ne=(e,t,n,r,i,a,o,s,c,l)=>{let{x:u,y:d}=c,{w:f,h:p}=c;if(e)f+=i-n,f+u>o&&(f=o-u),f<V&&(f=V),p+=a-r,p+d>s&&(p=s-d),p<V&&(p=V);else{if(t>=1){let e=i-n,r=Math.round(e/t);f+=e,p+=r}else{let e=a-r,n=Math.round(e*t);f+=n,p+=e}if(p+d>s||f+u>o||f<V||p<V)return l}return{x:u,y:d,w:f,h:p}},Pe=(e,t,n,r,i,a,o,s,c)=>{let l=e===`tl`||e===`bl`,u=e===`tl`||e===`tr`,d=c.x+c.w,f=c.y+c.h,p=i-n,m=a-r,h=t>=1?c.w+(l?-p:p):(c.h+(u?-m:m))*t,g=l?d:o-c.x,_=u?f:s-c.y,v=Math.min(g,_*t),y=Math.max(V,V*t),b=Math.min(Math.max(h,y),v),x=b/t;return{x:l?d-b:c.x,y:u?f-x:c.y,w:b,h:x}},Fe=(e,t,n,r,i,a,o,s,c,l,u)=>t?e===`tl`?Ae(t,n,r,i,a,o,s,c,l,u):e===`tr`?je(t,n,r,i,a,o,s,c,l,u):e===`bl`?Me(t,n,r,i,a,o,s,c,l,u):e===`br`?Ne(t,n,r,i,a,o,s,c,l,u):{x:0,y:0,w:0,h:0}:Pe(e,n,r,i,a,o,s,c,l),H=(e,t,n)=>{let r=.12,i=t/n,a=0,o=0;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));let s=a/t*100,c=o/n*100,l=(t-a)/2/t*100,u=(n-o)/2/n*100;return{x:l,y:u,w:s,h:c,xP:Math.round(l/100*t),yP:Math.round(u/100*n),wP:Math.round(s/100*t),hP:Math.round(c/100*n)}},Ie=(e,t,n,r)=>{let i=e.w/100*n,a=e.h/100*r;t>=1?a=i/t:i=a*t;let o=i/n*100,s=a/r*100,c=Math.max(o/(100-e.x),s/(100-e.y),1);return o/=c,s/=c,{...e,w:o,h:s}},U=e=>Math.abs(Math.round(e/90))%2==1,Le=(e,t,n,r)=>U(n)===U(r)?{width:e,height:t}:{width:t,height:e},Re=async e=>{let{width:t,height:n}=e,r=Math.min(1,De/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:Oe})};function ze(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})}}var Be=e=>new Promise((t,n)=>{let r=new FileReader;r.onloadend=()=>{let e=r.result;typeof e==`string`?t(e):n(Error(`Failed to read blob as base64`))},r.onerror=()=>n(r.error??Error(`FileReader error`)),r.readAsDataURL(e)});async function Ve(e){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});i.width=t.width,i.height=t.height,a?.drawImage(t,0,0),t.close();let o=()=>{let e=document.createElement(`canvas`);return e.width=i.width,e.height=i.height,e.getContext(`2d`,{alpha:!0})?.drawImage(i,0,0),e};return{crop:(e,t,n,r)=>{if(!a)return;let s=o();i.width=n,i.height=r,a.clearRect(0,0,n,r),a.drawImage(s,e,t,n,r,0,0,n,r)},flip:(e,t)=>{if(!a)return;let n=o();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()},rotate:e=>{if(!a)return;let t=o(),n=e*Math.PI/180,r=Math.abs(Math.sin(n)),s=Math.abs(Math.cos(n));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()},resize:(e,t)=>{if(!a)return;let n=o();i.width=e,i.height=t,a.clearRect(0,0,e,t),a.drawImage(n,0,0,e,t)},get:async e=>{let{quality:t=.85,saveAsWEBP:n=!1}=e,a=n?`image/webp`:r,o=await new Promise((e,o)=>{r===`image/jpeg`||r===`image/webp`||n?i.toBlob(t=>{t?e(t):o(Error(`Failed to encode image as ${a}`))},a,t):i.toBlob(t=>{t?e(t):o(Error(`Failed to encode image as image/png`))},`image/png`)}),s=await createImageBitmap(o),c=await Re(s),{width:l,height:u}=s,d=ze(s);return s.close(),{newBlob:o,previewBlob:c,mimeType:a,width:l,height:u,isAlpha:d}}}}var W=(e,t,n)=>Math.max(t,Math.min(n,e)),He=(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]]],Ue=e=>(Math.round(e/90)%4+4)%4*90,We=e=>{switch(Ue(e)){case 90:return[[0,-1],[1,0]];case 180:return[[-1,0],[0,-1]];case 270:return[[0,1],[-1,0]];default:return[[1,0],[0,1]]}},Ge=(e,t)=>[[e?-1:1,0],[0,t?-1:1]],Ke=(e,t,n)=>He(Ge(t,n),We(-e)),qe=e=>[+(e[0][0]<0||e[0][1]<0),+(e[1][0]<0||e[1][1]<0)],G=(e,t,n)=>{let r=qe(e);return[e[0][0]*t+e[0][1]*n+r[0],e[1][0]*t+e[1][1]*n+r[1]]},Je=e=>{let t=1,n=1,r={x:0,y:0,w:1,h:1},i=0,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e[s];if(c.action.name===d.INITIAL)t=c.width,n=c.height,r={x:0,y:0,w:1,h:1},i=0,a=!1,o=!1;else if(c.action.name===d.CROP){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=Ke(i,a,o),u=[G(l,e,t),G(l,e+n,t),G(l,e,t+s),G(l,e+n,t+s)],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]));r={x:r.x+d*r.w,y:r.y+p*r.h,w:r.w*(f-d),h:r.h*(m-p)}}else if(c.action.name===`flip`){let e=U(i),t=e?c.action.args.vertical:c.action.args.horizontal,n=e?c.action.args.horizontal:c.action.args.vertical;t&&(a=!a),n&&(o=!o)}else c.action.name===`rotate`&&(i=c.action.args.degrees)}let s=r.w*t,c=r.h*n,l=U(i),u=l?c:s,f=l?s:c,p=e.at(-1)?.width||0,m=e.at(-1)?.height||0;return{box:r,boxWidth:s,boxHeight:c,newWidth:p,newHeight:m,initWidth:t,initHeight:n,viewWidth:u,viewHeight:f,rotation:i,flipH:a,flipV:o}},Ye=e=>{let{box:t,flipH:n,flipV:r,rotation:i,newWidth:a,newHeight:o,initWidth:s,initHeight:c,viewWidth:l,viewHeight:u}=Je(e),d=W(t.x,0,1),f=W(t.y,0,1),p={x:d,y:f,w:W(t.w,0,1-d),h:W(t.h,0,1-f)},m=Ue(i);return{...p.x===0&&p.y===0&&p.w===1&&p.h===1?{}:{crop:{x:Math.round(s*t.x),y:Math.round(c*t.y),w:Math.round(s*t.w),h:Math.round(c*t.h)}},...m===0?{}:{rotate:{degrees:m}},...n||r?{flip:{horizontal:n,vertical:r}}:{},...Math.round(l)!==a||Math.round(u)!==o?{resize:{width:a,height:o}}:{}}},Xe=e=>{let[n,r]=(0,t.useState)(!1),{setImage:i,settings:a,history:o,originalBlob:s,setCurrentAction:c,resetHistory:l}=M();return{save:async()=>{if(!s)return;r(!0);let t=Ye(o.items.slice(0,o.pointer+1));try{let n=await Ve(s);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);let{newBlob:r,previewBlob:o,mimeType:c,width:l,height:u,isAlpha:d}=await n.get(a),f=``;a.exportAs===`base64`&&(f=await Be(r)),await e(f||r),i({newBlob:r,previewBlob:o,mimeType:c,width:l,height:u,isAlpha:d})}catch(e){throw Error(`Error saving image: ${e}`,{cause:e})}finally{r(!1)}},reset:()=>{c(null),l()},isSaving:n}},K={header:`_header_1yueu_1`,left:`_left_1yueu_12`,sidebarToggle:`_sidebarToggle_1yueu_17`,mobile:`_mobile_1yueu_29`,sidebarIcon:`_sidebarIcon_1yueu_33`,tools:`_tools_1yueu_38`,history:`_history_1yueu_42`,historyText:`_historyText_1yueu_47`},Ze=({onBack:e,onSave:t,isMobile:n})=>{let{save:r,reset:i,isSaving:a}=Xe(t),{sidebar:o,history:s,undo:c,redo:l,setSidebar:u,setCurrentAction:d}=M(),f=s.items.length>1&&!a,p=s.pointer===0,m=s.pointer===s.items.length-1,h=s.items.length<2||a,g=h||s.pointer===0;return(0,_.jsxs)(`div`,{className:K.header,children:[(0,_.jsxs)(`div`,{className:K.left,children:[(0,_.jsx)(`div`,{className:`${K.sidebarToggle} ${n?K.mobile:``}`,onClick:()=>{u(!o)},children:o?(0,_.jsx)(he,{className:K.sidebarIcon}):(0,_.jsx)(me,{className:K.sidebarIcon})}),(0,_.jsx)(P,{variant:`ghost`,className:N.rect,onClick:e,children:(0,_.jsx)(ne,{})})]}),(0,_.jsxs)(`div`,{className:K.tools,children:[f&&(0,_.jsxs)(`div`,{className:K.history,children:[(0,_.jsx)(P,{variant:`outline`,disabled:p,className:N.rect,onClick:()=>{c(),d(null)},children:(0,_.jsx)(O,{})}),(0,_.jsxs)(`div`,{className:K.historyText,children:[s.pointer+1,`/`,s.items.length]}),(0,_.jsx)(P,{variant:`outline`,disabled:m,className:N.rect,onClick:()=>{l(),d(null)},children:(0,_.jsx)(k,{})})]}),(0,_.jsx)(P,{variant:`outline`,disabled:h,onClick:i,children:`Reset`}),(0,_.jsxs)(P,{disabled:g,onClick:r,children:[a?(0,_.jsx)(j,{}):(0,_.jsx)(E,{}),`Save`]})]})]})},Qe={[d.RESIZE]:{icon:(0,_.jsx)(ce,{}),label:`Resize`},[d.CROP]:{icon:(0,_.jsx)(A,{}),label:`Crop`},[d.PRESET_CROP]:{icon:(0,_.jsx)(pe,{}),label:`Presets`},[d.FLIP]:{icon:(0,_.jsx)(le,{}),label:`Flip`},[d.ROTATE]:{icon:(0,_.jsx)(de,{}),label:`Rotate`}},$e=e=>Qe[e]??null,et=()=>{let{settings:e,currentAction:t,getLastRotation:n,getLastHistoryItem:r,setCurrentAction:i,setSidebar:a}=M(),o=e?.tools||[],s=t?.name,{width:c,height:l}=r();return{click:e=>{if(o.includes(e)&&s===e){i(null);return}switch(e){case d.RESIZE:i({name:d.RESIZE,args:{width:c,height:l}});break;case d.CROP:i({name:d.CROP,args:{id:`freeform`,ratio:c/l,isFree:!0}});break;case d.PRESET_CROP:i({name:d.PRESET_CROP,args:{id:`facebook-post`,ratio:1200/630,isFree:!1,preset:{width:1200,height:630}}});break;case d.FLIP:i({name:d.FLIP,args:{horizontal:!1,vertical:!1}});break;case d.ROTATE:i({name:d.ROTATE,args:{degrees:n()}});break}a(!1)}}},q={sidebar:`_sidebar_1j9gh_1`,mobile:`_mobile_1j9gh_9`,open:`_open_1j9gh_14`,wrapper:`_wrapper_1j9gh_19`,item:`_item_1j9gh_23`,selected:`_selected_1j9gh_41`},tt=({isMobile:e})=>{let{settings:t,sidebar:n,currentAction:r}=M(),i=t?.tools||[],a=r?.name,{click:o}=et();return(0,_.jsx)(`nav`,{className:`${q.sidebar} ${e?q.mobile:``} ${e&&n?q.open:``}`,children:(0,_.jsx)(z,{orientation:`vertical`,className:q.tooltip,children:i.map(e=>{let t=$e(e);if(!t)return null;let{icon:n,label:r}=t;return(0,_.jsx)(`div`,{className:`${q.item} ${a===e?q.selected:``}`,onClick:()=>o(e),"data-tooltip":r,"aria-label":r,children:n},e)})})})},nt={infobar:`_infobar_ofe91_1`},rt=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(2)} KB`:`${(e/1024/1024).toFixed(2)} MB`,it=()=>{let{originalBlob:e,getLastHistoryItem:t}=M(),{width:n,height:r}=t();return(0,_.jsxs)(`div`,{className:nt.infobar,children:[(0,_.jsx)(`div`,{className:nt.filesize,children:e?rt(e.size):`0 B`}),(0,_.jsxs)(`div`,{className:nt.sizes,children:[n,` / `,r]})]})},at=(e,t)=>{let n=new CustomEvent(`crop-update`,{detail:t});e.dispatchEvent(n)},ot=(e,t)=>{let n=new CustomEvent(`clip-path-update`,{detail:t});e.dispatchEvent(n)},J=(e,t)=>{let n=new CustomEvent(`resize-update`,{detail:t});e.dispatchEvent(n)},st=15,ct=200,lt=2,ut=(e,t,n)=>{let r=Math.min(ct,Math.max(st,e));return{scale:r,width:Math.round(r/100*t),height:Math.round(r/100*n)}},dt=()=>{let{getLastHistoryItem:e,setCurrentAction:n,addToHistory:r,setSidebar:i,eventBus:a}=M(),{width:o,height:s}=e(),[c,l]=(0,t.useState)(o),[u,f]=(0,t.useState)(s),[p,m]=(0,t.useState)(100),h=(0,t.useRef)(p),g=(0,t.useRef)(0),_=(0,t.useRef)(null),v=(0,t.useCallback)(e=>{let t=ut(e,o,s);l(t.width),f(t.height),m(t.scale),h.current=t.scale,J(a,t.scale)},[s,o,a]),y=(e,t)=>{let n=Number.parseInt(e,10);if(!Number.isFinite(n)){v(100);return}v(n/t*100)};return(0,t.useEffect)(()=>{let e=e=>{let t=_.current?.parentElement;return e.target instanceof Node&&!!t?.contains(e.target)},t=t=>{e(t)&&v(h.current-Math.sign(t.deltaY)*lt)},n=t=>{e(t)&&(g.current=t.touches[0].clientY)},r=t=>{if(!e(t))return;let n=t.touches[0].clientY,r=g.current-n;Math.abs(r)<10||(v(h.current+Math.sign(r)*lt),g.current=n)},i=new AbortController,{signal:a}=i;return window.addEventListener(`wheel`,t,{signal:a}),window.addEventListener(`touchstart`,n,{signal:a}),window.addEventListener(`touchmove`,r,{signal:a}),()=>i.abort()},[v]),{resizeRef:_,width:c,height:u,scale:p,currentWidth:o,currentHeight:s,setWidth:l,setHeight:f,handleWidthBlur:e=>{y(e.target.value,o)},handleHeightBlur:e=>{y(e.target.value,s)},save:()=>{r({width:c,height:u,action:{name:d.RESIZE,args:{width:c,height:u}}}),J(a,100),i(!0)},close:()=>{J(a,100),n(null),i(!0)}}},Y={resize:`_resize_1sbig_1`,toolsLock:`_toolsLock_1sbig_5`,indicatorWrapper:`_indicatorWrapper_1sbig_10`,indicator:`_indicator_1sbig_10`},ft=()=>{let{resizeRef:e,width:t,height:n,scale:r,currentWidth:i,currentHeight:a,setWidth:o,setHeight:s,handleWidthBlur:c,handleHeightBlur:l,save:u,close:d}=dt();return(0,_.jsxs)(B,{ref:e,className:Y.resize,children:[(0,_.jsx)(`div`,{className:Y.indicatorWrapper,children:(0,_.jsx)(`div`,{className:Y.indicator,style:{width:`${r/2}%`}})}),(0,_.jsx)(Ce,{value:t,name:`width`,label:`Width`,style:{width:`88px`},onChange:e=>o(Number(e.target.value)),onBlur:c}),(0,_.jsx)(D,{className:Y.toolsLock}),(0,_.jsx)(Ce,{value:n,name:`height`,label:`Height`,style:{width:`88px`},onChange:e=>s(Number(e.target.value)),onBlur:l}),(0,_.jsx)(L,{onSave:u,onClose:d,disabled:t===i&&n===a})]})},pt=({isClipped:e})=>{let{history:n,previewUrl:r,currentAction:i,getLastRotation:a,eventBus:o}=M(),s=(0,t.useRef)(null),c=(0,t.useRef)(i?.name),l=(0,t.useRef)(r);(0,t.useLayoutEffect)(()=>{let e=c.current,t=i?.name,n=l.current!==r;if(c.current=t,l.current=r,!(e&&t&&e!==t)&&!n)return;let a=s.current;if(!a)return;let o=[a,...a.querySelectorAll(`*`)];o.forEach(e=>{e.style.transition=`none`}),a.getBoundingClientRect();let u=()=>{o.forEach(e=>{e.style.removeProperty(`transition`)})},d=requestAnimationFrame(u);return()=>{cancelAnimationFrame(d),u()}},[i?.name,r]);let u=n.items.slice(0,n.pointer+1);if(i){let{width:e,height:t}=n.items.at(n.pointer);u.push({...i.name===d.ROTATE?Le(e,t,a(),i.args.degrees):{width:e,height:t},action:i})}let f=Je(u);return(0,t.useEffect)(()=>{e&&s.current&&(s.current.style.transition=`none`),i?.name!==d.RESIZE&&s.current&&(s.current.style.transform=`scale(1)`);let t=e=>{let t=e.detail;s.current&&(s.current.style.transform=`scale(${t/100})`)},n=t=>{if(!e)return;let{x:n,y:r,w:i,h:a}=t.detail;s.current&&(s.current.style.clipPath=`xywh(${n}% ${r}% ${i}% ${a}%)`)};return o.addEventListener(`resize-update`,t),o.addEventListener(`clip-path-update`,n),()=>{o.removeEventListener(`resize-update`,t),o.removeEventListener(`clip-path-update`,n)}},[e,i?.name,o]),{previewRef:s,previewUrl:r,...f}},X={preview:`_preview_dvanl_1`,rotate:`_rotate_dvanl_12`,flip:`_flip_dvanl_24`,image:`_image_dvanl_32`},mt=({isClipped:e,style:t={}})=>{let{previewRef:n,previewUrl:r,box:i,boxWidth:a,boxHeight:o,viewWidth:s,viewHeight:c,rotation:l,flipH:u,flipV:d}=pt({isClipped:e});return(0,_.jsx)(`div`,{ref:n,className:X.preview,style:{aspectRatio:`${s} / ${c}`,...t},children:(0,_.jsx)(`div`,{className:X.rotate,style:{width:`${a/s*100}%`,height:`${o/c*100}%`,transform:`translate(-50%, -50%) rotate(${l}deg)`},children:(0,_.jsx)(`div`,{className:X.flip,style:{transform:`scale(${u?-1:1}, ${d?-1:1})`},children:(0,_.jsx)(`img`,{className:X.image,src:r,alt:`Preview Image`,style:{width:`${1/i.w*100}%`,height:`${1/i.h*100}%`,left:`${-(i.x/i.w)*100}%`,top:`${-(i.y/i.h)*100}%`}})})})})},Z={wrapper:`_wrapper_1co2u_1`,box:`_box_1co2u_9`,toolsInfo:`_toolsInfo_1co2u_18`,toolsInfoLabel:`_toolsInfoLabel_1co2u_25`,toolsInfoValue:`_toolsInfoValue_1co2u_30`,linesBox:`_linesBox_1co2u_35`,line:`_line_1co2u_35`,lineV:`_lineV_1co2u_45`,lineH:`_lineH_1co2u_53`,pointer:`_pointer_1co2u_61`,pointerTopLeft:`_pointerTopLeft_1co2u_67`,pointerTopRight:`_pointerTopRight_1co2u_74`,pointerBottomRight:`_pointerBottomRight_1co2u_81`,pointerBottomLeft:`_pointerBottomLeft_1co2u_88`,mobileBorder:`_mobileBorder_1co2u_95`,mobilePointer:`_mobilePointer_1co2u_101`,info:`_info_1co2u_112`,infoX:`_infoX_1co2u_129`,infoY:`_infoY_1co2u_134`,infoW:`_infoW_1co2u_141`,infoH:`_infoH_1co2u_146`,group:`_group_1co2u_153`,active:`_active_1co2u_162`},ht=()=>{let{getLastHistoryItem:e}=M(),n=w(),r=(0,t.useRef)(null),{handleCropStart:i,initialCrop:a}=Dt({boxRef:r}),{width:o,height:s}=e(),{x:c,y:l,w:u,h:d}=a;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(mt,{isClipped:!0,style:{clipPath:`xywh(${c}% ${l}% ${u}% ${d}%)`}}),(0,_.jsx)(`div`,{className:Z.wrapper,style:{aspectRatio:`${o} / ${s}`},children:(0,_.jsxs)(`div`,{ref:r,className:Z.box,style:{width:`${u}%`,height:`${d}%`,top:`${l}%`,left:`${c}%`},children:[(0,_.jsx)(bt,{}),n?(0,_.jsx)(Ot,{onMouseDown:i}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(xt,{onMouseDown:i}),(0,_.jsx)(kt,{})]})]})})]})},gt=[{id:`freeform`,icon:(0,_.jsx)(A,{}),label:`Freeform`},{id:`origin`,icon:(0,_.jsx)(ie,{}),label:`Original`},{id:`1:1`,icon:(0,_.jsx)(ae,{}),label:`1 : 1`},{id:`4:3`,icon:(0,_.jsx)(se,{}),label:`4 : 3`},{id:`16:9`,icon:(0,_.jsx)(oe,{}),label:`16 : 9`}],_t=({value:e,onChange:t})=>(0,_.jsx)(`div`,{className:Z.group,children:(0,_.jsx)(z,{orientation:`horizontal`,className:Z.tooltip,children:gt.map(n=>(0,_.jsx)(P,{variant:`outline`,className:`${Z.groupBtn} ${e===n.id?Z.active:``}`,onClick:()=>t(n.id),"aria-label":n.label,"data-tooltip":n.label,children:n.icon},n.id))})}),vt=()=>{let{setCurrentAction:e,currentAction:n,getLastHistoryItem:r,addToHistory:i,setSidebar:a,eventBus:o}=M(),{width:s,height:c}=r(),{name:l,args:u}=n||{},f=l===d.CROP?u?.id:``,p=s/c,m=(0,t.useRef)({x:0,y:0,w:0,h:0});return(0,t.useEffect)(()=>{if(n?.name!==d.CROP)return;let e=H(n.args.ratio,s,c);m.current=e;let t=e=>{m.current=e.detail};return o.addEventListener(`clip-path-update`,t),()=>{o.removeEventListener(`clip-path-update`,t)}},[n,s,c,o]),{currentValue:f,handleChange:t=>{t!==f&&(e({name:d.CROP,args:{id:t,ratio:/^\d+:\d+$/.test(t)?t.split(`:`).map(Number).reduce((e,t)=>e/t):p,isFree:t===`freeform`}}),a(!0))},handleSave:()=>{if(!n||n.name!==d.CROP)return;let e=n.args?.preset?.width||Math.round(s*m.current.w/100),t=n.args?.preset?.height||Math.round(c*m.current.h/100);i({width:e,height:t,action:{name:d.CROP,args:{...n.args,...m.current}}}),a(!0)},handleClose:()=>{e(null),a(!0)}}},yt=()=>{let{currentValue:e,handleChange:t,handleSave:n,handleClose:r}=vt();return(0,_.jsxs)(B,{children:[(0,_.jsx)(_t,{value:e,onChange:t}),(0,_.jsx)(L,{onSave:n,onClose:r})]})},bt=()=>(0,_.jsxs)(`div`,{className:Z.linesBox,children:[(0,_.jsx)(`span`,{className:`${Z.line} ${Z.lineV}`}),(0,_.jsx)(`span`,{className:`${Z.line} ${Z.lineH}`})]}),xt=({onMouseDown:e})=>(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`${Z.pointer} ${Z.pointerTopLeft}`,onMouseDown:t=>e(t,`tl`,`nwse`)}),(0,_.jsx)(`div`,{className:`${Z.pointer} ${Z.pointerTopRight}`,onMouseDown:t=>e(t,`tr`,`nesw`)}),(0,_.jsx)(`div`,{className:`${Z.pointer} ${Z.pointerBottomRight}`,onMouseDown:t=>e(t,`br`,`nwse`)}),(0,_.jsx)(`div`,{className:`${Z.pointer} ${Z.pointerBottomLeft}`,onMouseDown:t=>e(t,`bl`,`nesw`)})]});function St(e,t,n){return Math.min(Math.max(e,t),n)}function Ct(e,{x:t,y:n,w:r,h:i}){e.style.left=`${t}%`,e.style.top=`${n}%`,e.style.width=`${r}%`,e.style.height=`${i}%`}function wt(e){let{width:t,height:n}=e.getBoundingClientRect();return{frameW:t,frameH:n}}function Tt({x:e,y:t,w:n,h:r},i,a){return{x:e/100*i,y:t/100*a,w:n/100*i,h:r/100*a}}function Et({x:e,y:t,w:n,h:r},i,a){return{x:e/i*100,y:t/a*100,w:n/i*100,h:r/a*100}}var Dt=({boxRef:e})=>{let{currentAction:n,getLastHistoryItem:r,eventBus:i}=M(),a=w(),{width:o,height:s}=r(),c=n?.name===d.CROP||n?.name===d.PRESET_CROP,l=c?n.args.ratio:1,u=!c||n.args.isFree,f=(0,t.useMemo)(()=>H(l,o,s),[l,o,s]),p=(0,t.useRef)(null),m=(0,t.useRef)(``),h=(0,t.useRef)(f),g=(0,t.useRef)(f);return(0,t.useEffect)(()=>{h.current=f,ot(i,f)},[f,i]),(0,t.useEffect)(()=>{let t=(e,t)=>{h.current=t,Ct(e,t),at(i,{x:Math.round(t.x/100*o),y:Math.round(t.y/100*s),w:Math.round(t.w/100*o),h:Math.round(t.h/100*s)}),ot(i,t)},n=e=>{e.preventDefault(),g.current=h.current;let t=`clientX`in e?e.clientX:e.touches[0].clientX,n=`clientY`in e?e.clientY:e.touches[0].clientY;p.current={x:t,y:n},document.body.style.cursor=`move`},r=t=>{if(!e.current||!p.current)return;t.preventDefault();let n=e.current,r=n.parentElement;if(!r)return;let{frameW:i,frameH:o}=wt(r);if(m.current){a(t,n,i,o);return}c(t,n,i,o)},a=(e,n,r,i)=>{if(!p.current)return;let a=`clientX`in e?e.clientX:e.touches[0].clientX,c=`clientY`in e?e.clientY:e.touches[0].clientY,d=Et(Fe(m.current,u,l,p.current.x,p.current.y,a,c,r,i,Tt(g.current,r,i),Tt(h.current,r,i)),r,i);t(n,u?d:Ie(d,l,o,s))},c=(e,n,r,i)=>{if(!p.current)return;let{x:a,y:o,w:s,h:c}=g.current,l=`clientX`in e?e.clientX:e.touches[0].clientX,u=`clientY`in e?e.clientY:e.touches[0].clientY,d=(l-p.current.x)/r*100,f=(u-p.current.y)/i*100;t(n,{x:St(a+d,0,Math.max(0,100-s)),y:St(o+f,0,Math.max(0,100-c)),w:s,h:c})},d=()=>{e.current&&(p.current=null,m.current=``,e.current.style.cursor=`move`,document.body.style.cursor=`auto`)};if(!e.current)return;let f=new AbortController,{signal:_}=f;return e.current.addEventListener(`mousedown`,n,{signal:_}),e.current.addEventListener(`touchstart`,n,{signal:_,passive:!1}),document.addEventListener(`mousemove`,r,{signal:_}),document.addEventListener(`touchmove`,r,{signal:_,passive:!1}),document.addEventListener(`mouseup`,d,{signal:_}),document.addEventListener(`touchend`,d,{signal:_}),()=>f.abort()},[u,l,o,s,e,i]),{handleCropStart:(t,n,r)=>{if(!e.current)return;t.stopPropagation(),t.preventDefault(),g.current=h.current;let i=`clientX`in t?t.clientX:t.touches[0].clientX,o=`clientY`in t?t.clientY:t.touches[0].clientY;p.current={x:i,y:o},m.current=n,a||(e.current.style.cursor=`${r}-resize`,document.body.style.cursor=`${r}-resize`)},initialCrop:f}},Ot=({onMouseDown:e})=>(0,_.jsx)(`div`,{className:Z.mobileBorder,children:(0,_.jsx)(`div`,{className:Z.mobilePointer,onTouchStart:t=>e(t,`br`,`nwse`)})}),kt=()=>{let e=(0,t.useRef)(null),n=(0,t.useRef)(null),r=(0,t.useRef)(null),i=(0,t.useRef)(null),{currentAction:a,getLastHistoryItem:o,eventBus:s}=M(),{width:c,height:l}=o();return(0,t.useEffect)(()=>{if(!(a?.name===d.CROP||a?.name===d.PRESET_CROP))return;let{xP:t,yP:o,wP:u,hP:f}=H(a.args.ratio,c,l);e.current&&(e.current.textContent=t.toString()),n.current&&(n.current.textContent=o.toString()),r.current&&(r.current.textContent=u.toString()),i.current&&(i.current.textContent=f.toString());let p=t=>{let{x:a,y:o,w:s,h:c}=t.detail;e.current&&(e.current.textContent=a.toString()),n.current&&(n.current.textContent=o.toString()),r.current&&(r.current.textContent=s.toString()),i.current&&(i.current.textContent=c.toString())};return s.addEventListener(`crop-update`,p),()=>{s.removeEventListener(`crop-update`,p)}},[a,l,c,s]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`${Z.info} ${Z.infoX}`,children:(0,_.jsx)(`b`,{ref:e})}),(0,_.jsx)(`div`,{className:`${Z.info} ${Z.infoY}`,children:(0,_.jsx)(`b`,{ref:n})}),(0,_.jsx)(`div`,{className:`${Z.info} ${Z.infoW}`,children:(0,_.jsx)(`b`,{ref:r})}),(0,_.jsx)(`div`,{className:`${Z.info} ${Z.infoH}`,children:(0,_.jsx)(`b`,{ref:i})})]})},At=ke.map(e=>e.options).flat(),jt=()=>At,Mt=()=>{let{currentAction:e,getLastHistoryItem:n,addToHistory:r,setSidebar:i,setCurrentAction:a,eventBus:o}=M(),{width:s,height:c}=n(),l=e?.name===d.PRESET_CROP&&At.some(t=>t.value===e.args.id)?e.args.id:``,u=(0,t.useRef)({x:0,y:0,w:0,h:0});return(0,t.useEffect)(()=>{if(e?.name!==d.PRESET_CROP)return;let t=H(e.args.ratio,s,c);u.current=t;let n=e=>{u.current=e.detail};return o.addEventListener(`clip-path-update`,n),()=>{o.removeEventListener(`clip-path-update`,n)}},[e,s,c,o]),{currentValue:l,presetsData:ke,handleChange:e=>{if(!e)return;let t=jt().find(t=>t.value===e);if(!t)return;let n={id:e,ratio:t.w/t.h,isFree:!1,preset:{width:t.w,height:t.h}};a({name:d.PRESET_CROP,args:n})},handleSave:()=>{!e||e.name!==d.PRESET_CROP||(r({width:e.args?.preset?.width||0,height:e.args?.preset?.height||0,action:{name:d.CROP,args:{...e.args,...u.current}}}),i(!0))},handleClose:()=>{a(null),i(!0)}}},Nt={select:`_select_1ip4k_1`},Pt=()=>{let{currentValue:e,presetsData:t,handleChange:n,handleSave:r,handleClose:i}=Mt();return(0,_.jsxs)(B,{children:[(0,_.jsx)(ye,{value:e,placeholder:`Select a preset`,onChange:n,items:t,className:Nt.select}),(0,_.jsx)(L,{onSave:r,onClose:i})]})},Ft=()=>{let{getLastHistoryItem:e,setCurrentAction:n,addToHistory:r,setSidebar:i}=M(),{width:a,height:o}=e(),[s,c]=(0,t.useState)(!1),[l,u]=(0,t.useState)(!1),f=(e,t)=>{n({name:d.FLIP,args:{horizontal:e,vertical:t}})};return{flipHorizontal:s,flipVertical:l,handleFlipHorizontal:()=>{let e=!s;c(e),f(e,l)},handleFlipVertical:()=>{let e=!l;u(e),f(s,e)},handleSave:()=>{r({width:a,height:o,action:{name:d.FLIP,args:{horizontal:s,vertical:l}}}),i(!0)},handleClose:()=>{n(null),i(!0)}}},Q={btnH:`_btnH_15adi_1`,btnV:`_btnV_15adi_7`},It=()=>{let{flipHorizontal:e,flipVertical:t,handleFlipHorizontal:n,handleFlipVertical:r,handleSave:i,handleClose:a}=Ft();return(0,_.jsxs)(B,{children:[(0,_.jsx)(`div`,{className:Q.scGroup,children:(0,_.jsxs)(z,{orientation:`horizontal`,className:Q.tooltip,children:[(0,_.jsx)(P,{variant:`outline`,className:Q.btnH,onClick:n,"aria-label":`Horizontal`,"data-tooltip":`Horizontal`,children:(0,_.jsx)(le,{style:{color:e?`var(--accent-blue)`:`var(--foreground)`}})}),(0,_.jsx)(P,{variant:`outline`,className:Q.btnV,onClick:r,"aria-label":`Vertical`,"data-tooltip":`Vertical`,children:(0,_.jsx)(ue,{style:{color:t?`var(--accent-blue)`:`var(--foreground)`}})})]})}),(0,_.jsx)(L,{disabled:!e&&!t,onSave:i,onClose:a})]})},Lt=()=>{let{getLastRotation:e,getLastHistoryItem:n,addToHistory:r,setSidebar:i,setCurrentAction:a}=M(),{width:o,height:s}=n(),c=e(),l=(0,t.useRef)(c),u=(0,t.useRef)(c);return{handleRotate:e=>{u.current+=e,a({name:d.ROTATE,args:{degrees:u.current}})},handleSave:()=>{r({...Le(o,s,l.current,u.current),action:{name:d.ROTATE,args:{degrees:u.current}}}),i(!0)},handleClose:()=>{a(null),i(!0)}}},$={btnH:`_btnH_15adi_1`,btnV:`_btnV_15adi_7`},Rt=()=>{let{handleRotate:e,handleSave:t,handleClose:n}=Lt();return(0,_.jsxs)(B,{children:[(0,_.jsx)(`div`,{className:$.scGroup,children:(0,_.jsxs)(z,{orientation:`horizontal`,className:$.tooltip,children:[(0,_.jsx)(P,{variant:`outline`,className:$.btnH,onClick:()=>e(90),"aria-label":`+90°`,"data-tooltip":`+90°`,children:(0,_.jsx)(de,{})}),(0,_.jsx)(P,{variant:`outline`,className:$.btnV,onClick:()=>e(-90),"aria-label":`-90°`,"data-tooltip":`-90°`,children:(0,_.jsx)(fe,{})})]})}),(0,_.jsx)(L,{onSave:t,onClose:n})]})},zt={frame:`_frame_15mog_1`},Bt=()=>{let{currentAction:e}=M(),t=e?.name===d.RESIZE,n=e?.name===d.CROP,r=e?.name===d.PRESET_CROP,i=e?.name===d.FLIP,a=e?.name===d.ROTATE,o=n||r;return(0,_.jsxs)(`div`,{className:`${zt.frame} ${o?I.mask:``}`,children:[(0,_.jsx)(mt,{style:o?{opacity:.4}:{}}),t&&(0,_.jsx)(ft,{}),(n||r)&&(0,_.jsx)(ht,{},e?.args?.id),n&&(0,_.jsx)(yt,{}),r&&(0,_.jsx)(Pt,{}),i&&(0,_.jsx)(It,{}),a&&(0,_.jsx)(Rt,{})]})};e.Pixedi=({image:e,onSave:n,onBack:r,theme:i=`light`,settings:a=f})=>{let[o,s]=(0,t.useState)(null),c=ee(`sm`,o),l={...f,...a},{loading:u,error:d,mimeType:p,width:m,height:h,originalBlob:g,previewUrl:y,isAlpha:b}=S({src:e,skip:l?.tools?.length===0});return l?.tools?.length===0?(0,_.jsx)(`div`,{className:`${I.root} ${I.wrapper}`,"data-theme":i,children:(0,_.jsx)(`div`,{className:I.system,children:(0,_.jsx)(`div`,{className:I.textRed,children:`No tools selected.`})})}):u||d||!g||!p?(0,_.jsx)(`div`,{className:`${I.root} ${I.wrapper}`,"data-theme":i,children:(0,_.jsxs)(`div`,{className:I.system,children:[u&&(0,_.jsx)(j,{style:{width:48,height:48}}),d&&(0,_.jsx)(`div`,{className:I.textRed,children:d}),!u&&!d&&(!g||!p)&&(0,_.jsx)(`div`,{className:I.textRed,children:`Failed to load image.`})]})}):(0,_.jsx)(v,{mimeType:p,width:m,height:h,originalBlob:g,previewUrl:y,isAlpha:b,settings:l,children:(0,_.jsx)(`div`,{ref:s,className:`${I.root} ${I.wrapper}`,"data-theme":i,children:(0,_.jsxs)(`div`,{className:`${l?.infobar?I.grid:I.gridNoInfobar} ${c?I.mobile:``}`,children:[(0,_.jsx)(Ze,{onSave:n,onBack:r,isMobile:c}),(0,_.jsx)(tt,{isMobile:c}),l?.infobar&&(0,_.jsx)(it,{}),(0,_.jsx)(Bt,{})]})})})}});
7
+ <%s key={someKey} {...props} />`,o,p,m,p),oe[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===T&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),ee=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),te=Symbol.for(`react.client.reference`),D=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=Object.prototype.hasOwnProperty,re=Array.isArray,O=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var k,A={},ie=m.react_stack_bottom_frame.bind(m,o)(),ae=O(i(o)),oe={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>D.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):ie,r?O(i(e)):ae)},e.jsxs=function(e,t,n){var r=1e4>D.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):ie,r?O(i(e)):ae)}})()})),_=c(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=h():t.exports=g()}))(),v=({children:e,mimeType:n,width:r,height:i,originalBlob:a,previewUrl:o,isAlpha:s,settings:c})=>{let[l,u]=(0,t.useState)(p(n,r,i,a,o,s,c)),f=(0,t.useRef)(null);(0,t.useEffect)(()=>()=>{f.current&&=(URL.revokeObjectURL(f.current),null)},[]);let h=e=>u(t=>({...t,currentAction:e})),g=e=>u(t=>{let n=t.history.pointer+1,r=[...t.history.items.slice(0,n),e];return{...t,currentAction:null,history:{items:r,pointer:n}}}),v=()=>{let{items:e,pointer:t}=l.history;return e.at(t)??e.at(0)??{width:0,height:0,action:{name:d.INITIAL,args:null}}},y=()=>{let{items:e,pointer:t}=l.history;if(e.length===0||t<0)return 0;let n=e.slice(0,t+1).findLast(e=>e.action.name===d.ROTATE);return n?.action.name===d.ROTATE?n.action.args.degrees:0},b=()=>u(e=>({...e,history:{items:[e.history.items[0]],pointer:0}})),x=()=>u(e=>e.history.pointer<=0?e:{...e,history:{...e.history,pointer:e.history.pointer-1}}),S=()=>u(e=>e.history.pointer>=e.history.items.length-1?e:{...e,history:{...e.history,pointer:e.history.pointer+1}}),C=e=>u(t=>({...t,sidebar:e})),w=(0,t.useMemo)(()=>new EventTarget,[]),ee=e=>{f.current&&URL.revokeObjectURL(f.current),f.current=URL.createObjectURL(e.previewBlob),u(p(e.mimeType,e.width,e.height,e.newBlob,f.current,e.isAlpha,c))};return(0,_.jsx)(m,{value:{...l,setImage:ee,setCurrentAction:h,getLastHistoryItem:v,getLastRotation:y,addToHistory:g,resetHistory:b,undo:x,redo:S,setSidebar:C,eventBus:w},children:e})},y="(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.`})}}})();",b=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,y],{type:`text/javascript;charset=utf-8`});function x(e){let t;try{if(t=b&&(self.URL||self.webkitURL).createObjectURL(b),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(y),{name:e?.name})}}var S=({src:e,skip:n=!1})=>{let[r,i]=(0,t.useState)({loading:!n,error:``,width:0,height:0,mimeType:``,originalBlob:null,previewUrl:``,isAlpha:!1}),a=(0,t.useRef)(null);return(0,t.useEffect)(()=>{if(!e||n)return;let t=new x;return t.postMessage(e),t.onmessage=e=>{let t=e.data;t.success?(a.current&&URL.revokeObjectURL(a.current),a.current=URL.createObjectURL(t.previewBlob),i({loading:!1,error:``,mimeType:t.mimeType,width:t.width,height:t.height,originalBlob:t.originalBlob,previewUrl:a.current,isAlpha:t.isAlpha})):i(e=>({...e,loading:!1,error:t.error||`Error processing image.`}))},()=>{t.terminate(),a.current&&=(URL.revokeObjectURL(a.current),null)}},[n,e]),r},C=()=>{if(typeof window>`u`||!window.navigator)return null;let e=window.navigator.userAgent.toLowerCase();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},w=()=>{let[e]=(0,t.useState)(()=>C());return e};function ee(e,n){let[r,i]=(0,t.useState)(!0);return(0,t.useEffect)(()=>{if(!n)return;let t=new ResizeObserver(([t])=>{t&&i(t.contentRect.width<u[e])});return t.observe(n),()=>t.disconnect()},[e,n]),r}var T={xmlns:`http://w3.org`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},E=e=>(0,_.jsx)(`svg`,{...T,...e,children:(0,_.jsx)(`path`,{d:`M20 6 9 17l-5-5`})}),te=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M18 6 6 18`}),(0,_.jsx)(`path`,{d:`m6 6 12 12`})]}),D=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}),(0,_.jsx)(`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`})]}),ne=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`m12 19-7-7 7-7`}),(0,_.jsx)(`path`,{d:`M19 12H5`})]}),re=e=>(0,_.jsx)(`svg`,{...T,...e,children:(0,_.jsx)(`path`,{d:`m6 9 6 6 6-6`})}),O=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M3 7v6h6`}),(0,_.jsx)(`path`,{d:`M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13`})]}),k=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M21 7v6h-6`}),(0,_.jsx)(`path`,{d:`M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7`})]}),A=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M6 2v14a2 2 0 0 0 2 2h14`}),(0,_.jsx)(`path`,{d:`M18 22V8a2 2 0 0 0-2-2H2`})]}),ie=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}),(0,_.jsx)(`circle`,{cx:`9`,cy:`9`,r:`2`}),(0,_.jsx)(`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`})]}),ae=e=>(0,_.jsx)(`svg`,{...T,...e,children:(0,_.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`})}),oe=e=>(0,_.jsx)(`svg`,{...T,...e,children:(0,_.jsx)(`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`2`})}),se=e=>(0,_.jsx)(`svg`,{...T,...e,children:(0,_.jsx)(`rect`,{width:`20`,height:`15`,x:`2`,y:`4.5`,rx:`2`})}),ce=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`}),(0,_.jsx)(`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`}),(0,_.jsx)(`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`}),(0,_.jsx)(`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`}),(0,_.jsx)(`rect`,{width:`10`,height:`8`,x:`7`,y:`8`,rx:`1`})]}),le=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3`}),(0,_.jsx)(`path`,{d:`M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3`}),(0,_.jsx)(`path`,{d:`M12 20v2`}),(0,_.jsx)(`path`,{d:`M12 14v2`}),(0,_.jsx)(`path`,{d:`M12 8v2`}),(0,_.jsx)(`path`,{d:`M12 2v2`})]}),ue=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3`}),(0,_.jsx)(`path`,{d:`M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3`}),(0,_.jsx)(`path`,{d:`M4 12H2`}),(0,_.jsx)(`path`,{d:`M10 12H8`}),(0,_.jsx)(`path`,{d:`M16 12h-2`}),(0,_.jsx)(`path`,{d:`M22 12h-2`})]}),de=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`}),(0,_.jsx)(`path`,{d:`M21 3v5h-5`})]}),fe=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,_.jsx)(`path`,{d:`M3 3v5h5`})]}),pe=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`}),(0,_.jsx)(`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`}),(0,_.jsx)(`path`,{d:`M14 4h7`}),(0,_.jsx)(`path`,{d:`M14 9h7`}),(0,_.jsx)(`path`,{d:`M14 15h7`}),(0,_.jsx)(`path`,{d:`M14 20h7`})]}),me=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}),(0,_.jsx)(`path`,{d:`M9 3v18`}),(0,_.jsx)(`path`,{d:`m14 9 3 3-3 3`})]}),he=e=>(0,_.jsxs)(`svg`,{...T,...e,children:[(0,_.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}),(0,_.jsx)(`path`,{d:`M9 3v18`}),(0,_.jsx)(`path`,{d:`m16 15-3-3 3-3`})]}),j=e=>(0,_.jsx)(`svg`,{...T,...e,children:(0,_.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,children:(0,_.jsx)(`animateTransform`,{attributeType:`xml`,attributeName:`transform`,type:`rotate`,from:`0 12 12`,to:`360 12 12`,dur:`0.8s`,repeatCount:`indefinite`})})}),M=()=>{let e=(0,t.useContext)(m);if(!e)throw Error(`usePixediContext must be used within an PixediProvider`);return e},N={button:`_button_1vpzl_1`,default:`_default_1vpzl_35`,outline:`_outline_1vpzl_44`,ghost:`_ghost_1vpzl_54`,rect:`_rect_1vpzl_63`},P=({className:e=``,variant:t=`default`,children:n,ref:r,...i})=>(0,_.jsx)(`button`,{ref:r,className:`${N.button} ${N[t]} ${e}`.trim(),...i,children:n}),ge={separator:`_separator_gp8ff_1`},_e=(0,t.forwardRef)(({className:e=``,orientation:t=`horizontal`,...n},r)=>(0,_.jsx)(`hr`,{ref:r,role:`separator`,"aria-orientation":t,"data-orientation":t,className:`${ge.separator} ${e}`.trim(),...n}));_e.displayName=`Separator`;var F={wrapper:`_wrapper_1aw0m_1`,trigger:`_trigger_1aw0m_6`,triggerArrow:`_triggerArrow_1aw0m_31`,content:`_content_1aw0m_40`,groupLabel:`_groupLabel_1aw0m_74`,item:`_item_1aw0m_81`,itemLeft:`_itemLeft_1aw0m_98`,itemAddon:`_itemAddon_1aw0m_102`,itemRightContainer:`_itemRightContainer_1aw0m_122`,itemRight:`_itemRight_1aw0m_122`,itemCheck:`_itemCheck_1aw0m_131`},I={root:`_root_c6gk7_8`,textRed:`_textRed_c6gk7_73`,bgRed:`_bgRed_c6gk7_76`,bgGreen:`_bgGreen_c6gk7_79`,textGreen:`_textGreen_c6gk7_82`,mask:`_mask_c6gk7_85`,semibold:`_semibold_c6gk7_88`,bold:`_bold_c6gk7_92`,system:`_system_c6gk7_96`,wrapper:`_wrapper_c6gk7_106`,grid:`_grid_c6gk7_113`,mobile:`_mobile_c6gk7_124`,gridNoInfobar:`_gridNoInfobar_c6gk7_128`},ve=e=>{let t=0,n=window.innerHeight;for(let r=e.parentElement;r;r=r.parentElement){let{overflow:e,overflowY:i}=getComputedStyle(r);if(e===`visible`&&i===`visible`)continue;let a=r.getBoundingClientRect();t=Math.max(t,a.top),n=Math.min(n,a.bottom)}return{top:t,bottom:n}},ye=({items:e,value:n,onChange:r,placeholder:i=`Select an option`,className:a=``,renderOption:o})=>{let[s,c]=(0,t.useState)(!1),l=(0,t.useRef)(null),u=(0,t.useRef)(null),d=(0,t.useRef)(null),f=(0,t.useMemo)(()=>{let t=e=>e.reduce((e,n)=>n.options?[...e,...t(n.options.map(e=>({...e,fullName:`${n.label} ${e.label}`})))]:[...e,n],[]);return t(e)},[e]).find(e=>e.value===n);(0,t.useEffect)(()=>{let e=e=>{l.current&&!e.composedPath().includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,t.useLayoutEffect)(()=>{let e=l.current,t=u.current,n=d.current;if(!s||!e||!t||!n)return;n.style.removeProperty(`top`),n.style.removeProperty(`max-height`);let{top:r,bottom:i}=ve(e),a=e.getBoundingClientRect().top,o=t.getBoundingClientRect(),c=n.offsetHeight,f=i-8-o.bottom-4,p=o.top-4-r-8,m=o.bottom+4,h=0;c>f&&(c<=p?m=o.top-4-c:p>f?(h=Math.max(p,0),m=o.top-4-h):h=Math.max(f,0)),h&&(n.style.maxHeight=`${h}px`),n.style.top=`${m-a}px`},[s,e]);let p=e=>{r(e),c(!1)};return(0,_.jsxs)(`div`,{ref:l,className:`${F.wrapper} ${a}`.trim(),"data-state":s?`open`:`closed`,children:[(0,_.jsxs)(`button`,{ref:u,type:`button`,className:F.trigger,onClick:()=>c(!s),children:[(0,_.jsx)(`span`,{children:f?f.fullName:i}),(0,_.jsx)(re,{className:F.triggerArrow})]}),(0,_.jsx)(`div`,{ref:d,className:F.content,children:e.map((e,t)=>e.options?(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`div`,{className:`${F.groupLabel} ${I.semibold}`,children:e.label}),e.options.map(e=>(0,_.jsxs)(`div`,{className:F.item,onClick:()=>p(e.value),children:[o?o(e):(0,_.jsx)(`span`,{className:F.itemLeft,children:e.label}),(0,_.jsxs)(`div`,{className:F.itemAddon,children:[e.rightLabel&&(0,_.jsx)(`span`,{children:e.rightLabel}),n===e.value&&(0,_.jsx)(E,{className:F.itemCheck}),n!==e.value&&(0,_.jsx)(`b`,{})]})]},e.value))]},`group-${t}`):(0,_.jsxs)(`div`,{className:F.item,onClick:()=>p(e.value),children:[o?o(e):(0,_.jsx)(`span`,{className:F.itemLeft,children:e.label}),n===e.value&&(0,_.jsx)(E,{className:F.itemCheck})]},e.value))})]})},be={input:`_input_kyavx_1`,numberClean:`_numberClean_kyavx_39`},xe=({className:e=``,type:t=`text`,hideArrows:n=!0,ref:r,...i})=>{let a=t===`number`&&n?be.numberClean:``;return(0,_.jsx)(`input`,{ref:r,type:t,className:`${be.input} ${a} ${e}`.trim(),...i})},Se={container:`_container_14vsv_1`,legend:`_legend_14vsv_4`,suffix:`_suffix_14vsv_13`},Ce=({label:e,className:t=``,style:n,ref:r,...i})=>(0,_.jsxs)(`div`,{className:`${Se.container} ${t}`.trim(),style:n,children:[(0,_.jsx)(`span`,{className:Se.legend,children:e}),(0,_.jsx)(xe,{ref:r,type:`number`,...i}),(0,_.jsx)(`span`,{className:Se.suffix,children:`px`})]}),we={group:`_group_1e7jm_1`,save:`_save_1e7jm_6`,close:`_close_1e7jm_13`},L=({onSave:e,onClose:t,saving:n=!1,disabled:r=!1})=>(0,_.jsxs)(`div`,{className:we.group,children:[(0,_.jsx)(P,{variant:`outline`,className:we.save,"aria-label":`Save`,disabled:r||n,onClick:e,children:n?(0,_.jsx)(j,{}):(0,_.jsx)(E,{})}),(0,_.jsx)(P,{variant:`outline`,className:we.close,"aria-label":`Close`,disabled:n,onClick:t,children:(0,_.jsx)(te,{})})]}),R={tooltip:`_tooltip_1dl6s_1`,container:`_container_1dl6s_5`,popup:`_popup_1dl6s_19`,animated:`_animated_1dl6s_92`,mask:`_mask_1dl6s_101`,track:`_track_1dl6s_108`,title:`_title_1dl6s_125`},Te=(e,n=`top`)=>{let[r,i]=(0,t.useState)(null),[a,o]=(0,t.useState)(null),[s,c]=(0,t.useState)(!1),[l,u]=(0,t.useState)(!1),[d,f]=(0,t.useState)([]),p=(0,t.useRef)(null),m=(0,t.useRef)(null),h=(0,t.useRef)([]),g=n===`left`||n===`right`,_=(0,t.useMemo)(()=>{let n=[];return t.Children.forEach(e,e=>{if((0,t.isValidElement)(e)){let{"data-tooltip":t}=e.props;t&&n.push(t)}}),n},[e]),v=_.join(`\0`),y=_.length;(0,t.useLayoutEffect)(()=>{let e=()=>{let e=h.current.slice(0,y).map(e=>({w:e?.offsetWidth??0,h:e?.offsetHeight??0}));f(t=>t.length===e.length&&t.every((t,n)=>t.w===e[n].w&&t.h===e[n].h)?t:e)};e();let t=m.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e);return n.observe(t),()=>n.disconnect()},[v,y]),(0,t.useEffect)(()=>{if(!s||l)return;let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>u(!0))});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}},[s,l]);let b=e=>{let t=e.target.closest(`[data-tooltip]`);if(!t){c(!1);return}let a=t.parentElement;if(!a)return;let l=Array.from(a.children).indexOf(t);if(l===-1||s&&l===r)return;let d=p.current?.getBoundingClientRect();if(!d)return;let f=t.getBoundingClientRect(),m=g?{x:n===`left`?f.left-d.left-4:f.right-d.left+4,y:f.top-d.top+f.height/2}:{x:f.left-d.left+f.width/2,y:n===`top`?f.top-d.top-8:f.bottom-d.top+8};s||u(!1),o(m),i(l),c(!0)},x=()=>c(!1),S=r??0,C=d[S],w=d.slice(0,S).reduce((e,t)=>e+(g?t.h:t.w),0);return{containerRef:p,trackRef:m,titleRefs:h,titles:_,position:n,isVisible:s,isAnimated:l,cssVars:{"--tooltip-x":a?`${a.x}px`:`0px`,"--tooltip-y":a?`${a.y}px`:`0px`,"--tooltip-opacity":s?`1`:`0`,"--tooltip-w":C?.w?`${C.w}px`:`auto`,"--tooltip-h":C?.h?`${C.h}px`:`auto`,"--tooltip-offset":`${w}px`},handleMouseMove:b,handleMouseLeave:x}},z=({children:e,position:t=`top`,className:n=``,classNameTitle:r=``})=>{let{containerRef:i,trackRef:a,titleRefs:o,titles:s,isAnimated:c,cssVars:l,handleMouseMove:u,handleMouseLeave:d}=Te(e,t);return(0,_.jsxs)(`div`,{ref:i,onMouseMove:u,onMouseLeave:d,onBlur:d,className:R.tooltip,style:l,children:[(0,_.jsx)(`div`,{"data-position":t,className:R.container,children:e}),(0,_.jsx)(`div`,{"aria-hidden":`true`,"data-position":t,className:`${R.popup} ${c?R.animated:``} ${n}`,children:(0,_.jsx)(`div`,{className:R.mask,children:(0,_.jsx)(`div`,{ref:a,"data-position":t,className:R.track,children:s.map((e,t)=>(0,_.jsx)(`div`,{ref:e=>{o.current[t]=e},className:`${R.title} ${r}`,children:e},t))})})})]})},Ee={surfaceTool:`_surfaceTool_h38e6_1`},B=({children:e,className:t=``,ref:n})=>(0,_.jsx)(`div`,{ref:n,className:`${Ee.surfaceTool} ${t}`,children:e}),De=1920,Oe=.85,ke=[{label:`Facebook`,value:`facebook`,options:[{value:`facebook-post`,label:`Post`,w:1200,h:630,rightLabel:`1200 x 630`},{value:`facebook-cover`,label:`Cover`,w:851,h:315,rightLabel:`851 x 315`},{value:`facebook-profile`,label:`Profile`,w:170,h:170,rightLabel:`170 x 170`},{value:`facebook-story`,label:`Story`,w:1080,h:1920,rightLabel:`1080 x 1920`}]},{label:`Instagram`,value:`instagram`,options:[{value:`instagram-landscape`,label:`Landscape`,w:1080,h:566,rightLabel:`1080 x 566`},{value:`instagram-portait`,label:`Portait`,w:1080,h:1350,rightLabel:`1080 x 1350`},{value:`instagram-square`,label:`Square`,w:1080,h:1080,rightLabel:`1080 x 1080`},{value:`instagram-story`,label:`Story`,w:1080,h:1920,rightLabel:`1080 x 1920`},{value:`instagram-thumbnail`,label:`Thumbnail`,w:161,h:161,rightLabel:`161 x 161`}]},{label:`LinkedIn`,value:`linkedin`,options:[{value:`linkedin-blog-post`,label:`Blog Post`,w:1200,h:627,rightLabel:`1200 x 627`},{value:`linkedin-cover`,label:`Cover`,w:1128,h:191,rightLabel:`1128 x 191`},{value:`linkedin-profile`,label:`Profile`,w:400,h:400,rightLabel:`400 x 400`}]}],V=32,Ae=(e,t,n,r,i,a,o,s,c,l)=>{let{x:u,y:d,w:f,h:p}=c;if(e){let e=o-c.w-c.x;u+=i-n,u<0&&(u=0),f=o-u-e,f<V&&(f=V,u=o-e-V);let t=s-p-d;d+=a-r,d<0&&(d=0),p=s-d-t,p<V&&(p=V,d=s-t-V)}else{if(t>=1){let e=i-n,r=Math.round(e/t);f-=e,p-=r,u+=e,d+=r}else{let e=a-r,n=Math.round(e*t);f-=n,p-=e,u+=n,d+=e}if(u<0||d<0||f<V||p<V)return l}return{x:u,y:d,w:f,h:p}},je=(e,t,n,r,i,a,o,s,c,l)=>{let{x:u}=c,{y:d,w:f,h:p}=c;if(e){f+=i-n,f+u>o&&(f=o-u),f<V&&(f=V);let e=s-p-d;d+=a-r,d<0&&(d=0),p=s-d-e,p<V&&(p=V,d=s-e-V)}else{if(t>1){let e=i-n,r=Math.round(e/t);f+=e,p+=r,d-=r}else{let e=a-r,n=Math.round(e*t);f-=n,p-=e,d+=e}if(f+u>o||d<0||f<V||p<V)return l}return{x:u,y:d,w:f,h:p}},Me=(e,t,n,r,i,a,o,s,c,l)=>{let{y:u}=c,{x:d,w:f,h:p}=c;if(e){p+=a-r,p+u>s&&(p=s-u),p<V&&(p=V);let e=o-c.w-c.x;d+=i-n,d<0&&(d=0),f=o-d-e,f<V&&(f=V,d=o-e-V)}else{if(t>=1){let e=i-n,r=Math.round(e/t);f-=e,p-=r,d+=e}else{let e=a-r,n=Math.round(e*t);f+=n,p+=e,d-=n}if(p+u>s||d<0||f<V||p<V)return l}return{x:d,y:u,w:f,h:p}},Ne=(e,t,n,r,i,a,o,s,c,l)=>{let{x:u,y:d}=c,{w:f,h:p}=c;if(e)f+=i-n,f+u>o&&(f=o-u),f<V&&(f=V),p+=a-r,p+d>s&&(p=s-d),p<V&&(p=V);else{if(t>=1){let e=i-n,r=Math.round(e/t);f+=e,p+=r}else{let e=a-r,n=Math.round(e*t);f+=n,p+=e}if(p+d>s||f+u>o||f<V||p<V)return l}return{x:u,y:d,w:f,h:p}},Pe=(e,t,n,r,i,a,o,s,c)=>{let l=e===`tl`||e===`bl`,u=e===`tl`||e===`tr`,d=c.x+c.w,f=c.y+c.h,p=i-n,m=a-r,h=t>=1?c.w+(l?-p:p):(c.h+(u?-m:m))*t,g=l?d:o-c.x,_=u?f:s-c.y,v=Math.min(g,_*t),y=Math.max(V,V*t),b=Math.min(Math.max(h,y),v),x=b/t;return{x:l?d-b:c.x,y:u?f-x:c.y,w:b,h:x}},Fe=(e,t,n,r,i,a,o,s,c,l,u)=>t?e===`tl`?Ae(t,n,r,i,a,o,s,c,l,u):e===`tr`?je(t,n,r,i,a,o,s,c,l,u):e===`bl`?Me(t,n,r,i,a,o,s,c,l,u):e===`br`?Ne(t,n,r,i,a,o,s,c,l,u):{x:0,y:0,w:0,h:0}:Pe(e,n,r,i,a,o,s,c,l),H=(e,t,n)=>{let r=.12,i=t/n,a=0,o=0;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));let s=a/t*100,c=o/n*100,l=(t-a)/2/t*100,u=(n-o)/2/n*100;return{x:l,y:u,w:s,h:c,xP:Math.round(l/100*t),yP:Math.round(u/100*n),wP:Math.round(s/100*t),hP:Math.round(c/100*n)}},Ie=(e,t,n,r)=>{let i=e.w/100*n,a=e.h/100*r;t>=1?a=i/t:i=a*t;let o=i/n*100,s=a/r*100,c=Math.max(o/(100-e.x),s/(100-e.y),1);return o/=c,s/=c,{...e,w:o,h:s}},U=e=>Math.abs(Math.round(e/90))%2==1,Le=(e,t,n,r)=>U(n)===U(r)?{width:e,height:t}:{width:t,height:e},Re=async e=>{let{width:t,height:n}=e,r=Math.min(1,De/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:Oe})};function ze(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})}}var Be=e=>new Promise((t,n)=>{let r=new FileReader;r.onloadend=()=>{let e=r.result;typeof e==`string`?t(e):n(Error(`Failed to read blob as base64`))},r.onerror=()=>n(r.error??Error(`FileReader error`)),r.readAsDataURL(e)});async function Ve(e){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});i.width=t.width,i.height=t.height,a?.drawImage(t,0,0),t.close();let o=()=>{let e=document.createElement(`canvas`);return e.width=i.width,e.height=i.height,e.getContext(`2d`,{alpha:!0})?.drawImage(i,0,0),e};return{crop:(e,t,n,r)=>{if(!a)return;let s=o();i.width=n,i.height=r,a.clearRect(0,0,n,r),a.drawImage(s,e,t,n,r,0,0,n,r)},flip:(e,t)=>{if(!a)return;let n=o();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()},rotate:e=>{if(!a)return;let t=o(),n=e*Math.PI/180,r=Math.abs(Math.sin(n)),s=Math.abs(Math.cos(n));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()},resize:(e,t)=>{if(!a)return;let n=o();i.width=e,i.height=t,a.clearRect(0,0,e,t),a.drawImage(n,0,0,e,t)},get:async e=>{let{quality:t=.85,saveAsWEBP:n=!1}=e,a=n?`image/webp`:r,o=await new Promise((e,o)=>{r===`image/jpeg`||r===`image/webp`||n?i.toBlob(t=>{t?e(t):o(Error(`Failed to encode image as ${a}`))},a,t):i.toBlob(t=>{t?e(t):o(Error(`Failed to encode image as image/png`))},`image/png`)}),s=await createImageBitmap(o),c=await Re(s),{width:l,height:u}=s,d=ze(s);return s.close(),{newBlob:o,previewBlob:c,mimeType:a,width:l,height:u,isAlpha:d}}}}var W=(e,t,n)=>Math.max(t,Math.min(n,e)),He=(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]]],Ue=e=>(Math.round(e/90)%4+4)%4*90,We=e=>{switch(Ue(e)){case 90:return[[0,-1],[1,0]];case 180:return[[-1,0],[0,-1]];case 270:return[[0,1],[-1,0]];default:return[[1,0],[0,1]]}},Ge=(e,t)=>[[e?-1:1,0],[0,t?-1:1]],Ke=(e,t,n)=>He(Ge(t,n),We(-e)),qe=e=>[+(e[0][0]<0||e[0][1]<0),+(e[1][0]<0||e[1][1]<0)],G=(e,t,n)=>{let r=qe(e);return[e[0][0]*t+e[0][1]*n+r[0],e[1][0]*t+e[1][1]*n+r[1]]},Je=e=>{let t=1,n=1,r={x:0,y:0,w:1,h:1},i=0,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e[s];if(c.action.name===d.INITIAL)t=c.width,n=c.height,r={x:0,y:0,w:1,h:1},i=0,a=!1,o=!1;else if(c.action.name===d.CROP){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=Ke(i,a,o),u=[G(l,e,t),G(l,e+n,t),G(l,e,t+s),G(l,e+n,t+s)],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]));r={x:r.x+d*r.w,y:r.y+p*r.h,w:r.w*(f-d),h:r.h*(m-p)}}else if(c.action.name===`flip`){let e=U(i),t=e?c.action.args.vertical:c.action.args.horizontal,n=e?c.action.args.horizontal:c.action.args.vertical;t&&(a=!a),n&&(o=!o)}else c.action.name===`rotate`&&(i=c.action.args.degrees)}let s=r.w*t,c=r.h*n,l=U(i),u=l?c:s,f=l?s:c,p=e.at(-1)?.width||0,m=e.at(-1)?.height||0;return{box:r,boxWidth:s,boxHeight:c,newWidth:p,newHeight:m,initWidth:t,initHeight:n,viewWidth:u,viewHeight:f,rotation:i,flipH:a,flipV:o}},Ye=e=>{let{box:t,flipH:n,flipV:r,rotation:i,newWidth:a,newHeight:o,initWidth:s,initHeight:c,viewWidth:l,viewHeight:u}=Je(e),d=W(t.x,0,1),f=W(t.y,0,1),p={x:d,y:f,w:W(t.w,0,1-d),h:W(t.h,0,1-f)},m=Ue(i);return{...p.x===0&&p.y===0&&p.w===1&&p.h===1?{}:{crop:{x:Math.round(s*t.x),y:Math.round(c*t.y),w:Math.round(s*t.w),h:Math.round(c*t.h)}},...m===0?{}:{rotate:{degrees:m}},...n||r?{flip:{horizontal:n,vertical:r}}:{},...Math.round(l)!==a||Math.round(u)!==o?{resize:{width:a,height:o}}:{}}},Xe=e=>{let[n,r]=(0,t.useState)(!1),{setImage:i,settings:a,history:o,originalBlob:s,setCurrentAction:c,resetHistory:l}=M();return{save:async()=>{if(!s)return;r(!0);let t=Ye(o.items.slice(0,o.pointer+1));try{let n=await Ve(s);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);let{newBlob:r,previewBlob:o,mimeType:c,width:l,height:u,isAlpha:d}=await n.get(a),f=``;a.exportAs===`base64`&&(f=await Be(r)),await e(f||r),i({newBlob:r,previewBlob:o,mimeType:c,width:l,height:u,isAlpha:d})}catch(e){throw Error(`Error saving image: ${e}`,{cause:e})}finally{r(!1)}},reset:()=>{c(null),l()},isSaving:n}},K={header:`_header_1yueu_1`,left:`_left_1yueu_12`,sidebarToggle:`_sidebarToggle_1yueu_17`,mobile:`_mobile_1yueu_29`,sidebarIcon:`_sidebarIcon_1yueu_33`,tools:`_tools_1yueu_38`,history:`_history_1yueu_42`,historyText:`_historyText_1yueu_47`},Ze=({onBack:e,onSave:t,isMobile:n})=>{let{save:r,reset:i,isSaving:a}=Xe(t),{sidebar:o,history:s,undo:c,redo:l,setSidebar:u,setCurrentAction:d}=M(),f=s.items.length>1&&!a,p=s.pointer===0,m=s.pointer===s.items.length-1,h=s.items.length<2||a,g=h||s.pointer===0;return(0,_.jsxs)(`div`,{className:K.header,children:[(0,_.jsxs)(`div`,{className:K.left,children:[(0,_.jsx)(`div`,{className:`${K.sidebarToggle} ${n?K.mobile:``}`,onClick:()=>{u(!o)},children:o?(0,_.jsx)(he,{className:K.sidebarIcon}):(0,_.jsx)(me,{className:K.sidebarIcon})}),(0,_.jsx)(P,{variant:`ghost`,className:N.rect,onClick:e,children:(0,_.jsx)(ne,{})})]}),(0,_.jsxs)(`div`,{className:K.tools,children:[f&&(0,_.jsxs)(`div`,{className:K.history,children:[(0,_.jsx)(P,{variant:`outline`,disabled:p,className:N.rect,onClick:()=>{c(),d(null)},children:(0,_.jsx)(O,{})}),(0,_.jsxs)(`div`,{className:K.historyText,children:[s.pointer+1,`/`,s.items.length]}),(0,_.jsx)(P,{variant:`outline`,disabled:m,className:N.rect,onClick:()=>{l(),d(null)},children:(0,_.jsx)(k,{})})]}),(0,_.jsx)(P,{variant:`outline`,disabled:h,onClick:i,children:`Reset`}),(0,_.jsxs)(P,{disabled:g,onClick:r,children:[a?(0,_.jsx)(j,{}):(0,_.jsx)(E,{}),`Save`]})]})]})},Qe={[d.RESIZE]:{icon:(0,_.jsx)(ce,{}),label:`Resize`},[d.CROP]:{icon:(0,_.jsx)(A,{}),label:`Crop`},[d.PRESET_CROP]:{icon:(0,_.jsx)(pe,{}),label:`Presets`},[d.FLIP]:{icon:(0,_.jsx)(le,{}),label:`Flip`},[d.ROTATE]:{icon:(0,_.jsx)(de,{}),label:`Rotate`}},$e=e=>Qe[e]??null,et=()=>{let{settings:e,currentAction:t,getLastRotation:n,getLastHistoryItem:r,setCurrentAction:i,setSidebar:a}=M(),o=e?.tools||[],s=t?.name,{width:c,height:l}=r();return{click:e=>{if(o.includes(e)&&s===e){i(null);return}switch(e){case d.RESIZE:i({name:d.RESIZE,args:{width:c,height:l}});break;case d.CROP:i({name:d.CROP,args:{id:`freeform`,ratio:c/l,isFree:!0}});break;case d.PRESET_CROP:i({name:d.PRESET_CROP,args:{id:`facebook-post`,ratio:1200/630,isFree:!1,preset:{width:1200,height:630}}});break;case d.FLIP:i({name:d.FLIP,args:{horizontal:!1,vertical:!1}});break;case d.ROTATE:i({name:d.ROTATE,args:{degrees:n()}});break}a(!1)}}},q={sidebar:`_sidebar_1j9gh_1`,mobile:`_mobile_1j9gh_9`,open:`_open_1j9gh_14`,wrapper:`_wrapper_1j9gh_19`,item:`_item_1j9gh_23`,selected:`_selected_1j9gh_41`},tt=({isMobile:e})=>{let{settings:t,sidebar:n,currentAction:r}=M(),i=t?.tools||[],a=r?.name,{click:o}=et();return(0,_.jsx)(`nav`,{className:`${q.sidebar} ${e?q.mobile:``} ${e&&n?q.open:``}`,children:(0,_.jsx)(z,{position:`right`,className:q.tooltip,children:i.map(e=>{let t=$e(e);if(!t)return null;let{icon:n,label:r}=t;return(0,_.jsx)(`div`,{className:`${q.item} ${a===e?q.selected:``}`,onClick:()=>o(e),"data-tooltip":r,"aria-label":r,children:n},e)})})})},nt={infobar:`_infobar_ofe91_1`},rt=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(2)} KB`:`${(e/1024/1024).toFixed(2)} MB`,it=()=>{let{originalBlob:e,getLastHistoryItem:t}=M(),{width:n,height:r}=t();return(0,_.jsxs)(`div`,{className:nt.infobar,children:[(0,_.jsx)(`div`,{className:nt.filesize,children:e?rt(e.size):`0 B`}),(0,_.jsxs)(`div`,{className:nt.sizes,children:[n,` / `,r]})]})},at=(e,t)=>{let n=new CustomEvent(`crop-update`,{detail:t});e.dispatchEvent(n)},ot=(e,t)=>{let n=new CustomEvent(`clip-path-update`,{detail:t});e.dispatchEvent(n)},J=(e,t)=>{let n=new CustomEvent(`resize-update`,{detail:t});e.dispatchEvent(n)},st=15,ct=200,lt=2,ut=(e,t,n)=>{let r=Math.min(ct,Math.max(st,e));return{scale:r,width:Math.round(r/100*t),height:Math.round(r/100*n)}},dt=()=>{let{getLastHistoryItem:e,setCurrentAction:n,addToHistory:r,setSidebar:i,eventBus:a}=M(),{width:o,height:s}=e(),[c,l]=(0,t.useState)(o),[u,f]=(0,t.useState)(s),[p,m]=(0,t.useState)(100),h=(0,t.useRef)(p),g=(0,t.useRef)(0),_=(0,t.useRef)(null),v=(0,t.useCallback)(e=>{let t=ut(e,o,s);l(t.width),f(t.height),m(t.scale),h.current=t.scale,J(a,t.scale)},[s,o,a]),y=(e,t)=>{let n=Number.parseInt(e,10);if(!Number.isFinite(n)){v(100);return}v(n/t*100)};return(0,t.useEffect)(()=>{let e=e=>{let t=_.current?.parentElement;return e.target instanceof Node&&!!t?.contains(e.target)},t=t=>{e(t)&&v(h.current-Math.sign(t.deltaY)*lt)},n=t=>{e(t)&&(g.current=t.touches[0].clientY)},r=t=>{if(!e(t))return;let n=t.touches[0].clientY,r=g.current-n;Math.abs(r)<10||(v(h.current+Math.sign(r)*lt),g.current=n)},i=new AbortController,{signal:a}=i;return window.addEventListener(`wheel`,t,{signal:a}),window.addEventListener(`touchstart`,n,{signal:a}),window.addEventListener(`touchmove`,r,{signal:a}),()=>i.abort()},[v]),{resizeRef:_,width:c,height:u,scale:p,currentWidth:o,currentHeight:s,setWidth:l,setHeight:f,handleWidthBlur:e=>{y(e.target.value,o)},handleHeightBlur:e=>{y(e.target.value,s)},save:()=>{r({width:c,height:u,action:{name:d.RESIZE,args:{width:c,height:u}}}),J(a,100),i(!0)},close:()=>{J(a,100),n(null),i(!0)}}},Y={resize:`_resize_1sbig_1`,toolsLock:`_toolsLock_1sbig_5`,indicatorWrapper:`_indicatorWrapper_1sbig_10`,indicator:`_indicator_1sbig_10`},ft=()=>{let{resizeRef:e,width:t,height:n,scale:r,currentWidth:i,currentHeight:a,setWidth:o,setHeight:s,handleWidthBlur:c,handleHeightBlur:l,save:u,close:d}=dt();return(0,_.jsxs)(B,{ref:e,className:Y.resize,children:[(0,_.jsx)(`div`,{className:Y.indicatorWrapper,children:(0,_.jsx)(`div`,{className:Y.indicator,style:{width:`${r/2}%`}})}),(0,_.jsx)(Ce,{value:t,name:`width`,label:`Width`,style:{width:`88px`},onChange:e=>o(Number(e.target.value)),onBlur:c}),(0,_.jsx)(D,{className:Y.toolsLock}),(0,_.jsx)(Ce,{value:n,name:`height`,label:`Height`,style:{width:`88px`},onChange:e=>s(Number(e.target.value)),onBlur:l}),(0,_.jsx)(L,{onSave:u,onClose:d,disabled:t===i&&n===a})]})},pt=({isClipped:e})=>{let{history:n,previewUrl:r,currentAction:i,getLastRotation:a,eventBus:o}=M(),s=(0,t.useRef)(null),c=(0,t.useRef)(i?.name),l=(0,t.useRef)(r);(0,t.useLayoutEffect)(()=>{let e=c.current,t=i?.name,n=l.current!==r;if(c.current=t,l.current=r,!(e&&t&&e!==t)&&!n)return;let a=s.current;if(!a)return;let o=[a,...a.querySelectorAll(`*`)];o.forEach(e=>{e.style.transition=`none`}),a.getBoundingClientRect();let u=()=>{o.forEach(e=>{e.style.removeProperty(`transition`)})},d=requestAnimationFrame(u);return()=>{cancelAnimationFrame(d),u()}},[i?.name,r]);let u=n.items.slice(0,n.pointer+1);if(i){let{width:e,height:t}=n.items.at(n.pointer);u.push({...i.name===d.ROTATE?Le(e,t,a(),i.args.degrees):{width:e,height:t},action:i})}let f=Je(u);return(0,t.useEffect)(()=>{e&&s.current&&(s.current.style.transition=`none`),i?.name!==d.RESIZE&&s.current&&(s.current.style.transform=`scale(1)`);let t=e=>{let t=e.detail;s.current&&(s.current.style.transform=`scale(${t/100})`)},n=t=>{if(!e)return;let{x:n,y:r,w:i,h:a}=t.detail;s.current&&(s.current.style.clipPath=`xywh(${n}% ${r}% ${i}% ${a}%)`)};return o.addEventListener(`resize-update`,t),o.addEventListener(`clip-path-update`,n),()=>{o.removeEventListener(`resize-update`,t),o.removeEventListener(`clip-path-update`,n)}},[e,i?.name,o]),{previewRef:s,previewUrl:r,...f}},X={preview:`_preview_dvanl_1`,rotate:`_rotate_dvanl_12`,flip:`_flip_dvanl_24`,image:`_image_dvanl_32`},mt=({isClipped:e,style:t={}})=>{let{previewRef:n,previewUrl:r,box:i,boxWidth:a,boxHeight:o,viewWidth:s,viewHeight:c,rotation:l,flipH:u,flipV:d}=pt({isClipped:e});return(0,_.jsx)(`div`,{ref:n,className:X.preview,style:{aspectRatio:`${s} / ${c}`,...t},children:(0,_.jsx)(`div`,{className:X.rotate,style:{width:`${a/s*100}%`,height:`${o/c*100}%`,transform:`translate(-50%, -50%) rotate(${l}deg)`},children:(0,_.jsx)(`div`,{className:X.flip,style:{transform:`scale(${u?-1:1}, ${d?-1:1})`},children:(0,_.jsx)(`img`,{className:X.image,src:r,alt:`Preview Image`,style:{width:`${1/i.w*100}%`,height:`${1/i.h*100}%`,left:`${-(i.x/i.w)*100}%`,top:`${-(i.y/i.h)*100}%`}})})})})},Z={wrapper:`_wrapper_1co2u_1`,box:`_box_1co2u_9`,toolsInfo:`_toolsInfo_1co2u_18`,toolsInfoLabel:`_toolsInfoLabel_1co2u_25`,toolsInfoValue:`_toolsInfoValue_1co2u_30`,linesBox:`_linesBox_1co2u_35`,line:`_line_1co2u_35`,lineV:`_lineV_1co2u_45`,lineH:`_lineH_1co2u_53`,pointer:`_pointer_1co2u_61`,pointerTopLeft:`_pointerTopLeft_1co2u_67`,pointerTopRight:`_pointerTopRight_1co2u_74`,pointerBottomRight:`_pointerBottomRight_1co2u_81`,pointerBottomLeft:`_pointerBottomLeft_1co2u_88`,mobileBorder:`_mobileBorder_1co2u_95`,mobilePointer:`_mobilePointer_1co2u_101`,info:`_info_1co2u_112`,infoX:`_infoX_1co2u_129`,infoY:`_infoY_1co2u_134`,infoW:`_infoW_1co2u_141`,infoH:`_infoH_1co2u_146`,group:`_group_1co2u_153`,active:`_active_1co2u_162`},ht=()=>{let{getLastHistoryItem:e}=M(),n=w(),r=(0,t.useRef)(null),{handleCropStart:i,initialCrop:a}=Dt({boxRef:r}),{width:o,height:s}=e(),{x:c,y:l,w:u,h:d}=a;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(mt,{isClipped:!0,style:{clipPath:`xywh(${c}% ${l}% ${u}% ${d}%)`}}),(0,_.jsx)(`div`,{className:Z.wrapper,style:{aspectRatio:`${o} / ${s}`},children:(0,_.jsxs)(`div`,{ref:r,className:Z.box,style:{width:`${u}%`,height:`${d}%`,top:`${l}%`,left:`${c}%`},children:[(0,_.jsx)(bt,{}),n?(0,_.jsx)(Ot,{onMouseDown:i}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(xt,{onMouseDown:i}),(0,_.jsx)(kt,{})]})]})})]})},gt=[{id:`freeform`,icon:(0,_.jsx)(A,{}),label:`Freeform`},{id:`origin`,icon:(0,_.jsx)(ie,{}),label:`Original`},{id:`1:1`,icon:(0,_.jsx)(ae,{}),label:`1 : 1`},{id:`4:3`,icon:(0,_.jsx)(se,{}),label:`4 : 3`},{id:`16:9`,icon:(0,_.jsx)(oe,{}),label:`16 : 9`}],_t=({value:e,onChange:t})=>(0,_.jsx)(`div`,{className:Z.group,children:(0,_.jsx)(z,{position:`top`,className:Z.tooltip,children:gt.map(n=>(0,_.jsx)(P,{variant:`outline`,className:`${Z.groupBtn} ${e===n.id?Z.active:``}`,onClick:()=>t(n.id),"aria-label":n.label,"data-tooltip":n.label,children:n.icon},n.id))})}),vt=()=>{let{setCurrentAction:e,currentAction:n,getLastHistoryItem:r,addToHistory:i,setSidebar:a,eventBus:o}=M(),{width:s,height:c}=r(),{name:l,args:u}=n||{},f=l===d.CROP?u?.id:``,p=s/c,m=(0,t.useRef)({x:0,y:0,w:0,h:0});return(0,t.useEffect)(()=>{if(n?.name!==d.CROP)return;let e=H(n.args.ratio,s,c);m.current=e;let t=e=>{m.current=e.detail};return o.addEventListener(`clip-path-update`,t),()=>{o.removeEventListener(`clip-path-update`,t)}},[n,s,c,o]),{currentValue:f,handleChange:t=>{t!==f&&(e({name:d.CROP,args:{id:t,ratio:/^\d+:\d+$/.test(t)?t.split(`:`).map(Number).reduce((e,t)=>e/t):p,isFree:t===`freeform`}}),a(!0))},handleSave:()=>{if(!n||n.name!==d.CROP)return;let e=n.args?.preset?.width||Math.round(s*m.current.w/100),t=n.args?.preset?.height||Math.round(c*m.current.h/100);i({width:e,height:t,action:{name:d.CROP,args:{...n.args,...m.current}}}),a(!0)},handleClose:()=>{e(null),a(!0)}}},yt=()=>{let{currentValue:e,handleChange:t,handleSave:n,handleClose:r}=vt();return(0,_.jsxs)(B,{children:[(0,_.jsx)(_t,{value:e,onChange:t}),(0,_.jsx)(L,{onSave:n,onClose:r})]})},bt=()=>(0,_.jsxs)(`div`,{className:Z.linesBox,children:[(0,_.jsx)(`span`,{className:`${Z.line} ${Z.lineV}`}),(0,_.jsx)(`span`,{className:`${Z.line} ${Z.lineH}`})]}),xt=({onMouseDown:e})=>(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`${Z.pointer} ${Z.pointerTopLeft}`,onMouseDown:t=>e(t,`tl`,`nwse`)}),(0,_.jsx)(`div`,{className:`${Z.pointer} ${Z.pointerTopRight}`,onMouseDown:t=>e(t,`tr`,`nesw`)}),(0,_.jsx)(`div`,{className:`${Z.pointer} ${Z.pointerBottomRight}`,onMouseDown:t=>e(t,`br`,`nwse`)}),(0,_.jsx)(`div`,{className:`${Z.pointer} ${Z.pointerBottomLeft}`,onMouseDown:t=>e(t,`bl`,`nesw`)})]});function St(e,t,n){return Math.min(Math.max(e,t),n)}function Ct(e,{x:t,y:n,w:r,h:i}){e.style.left=`${t}%`,e.style.top=`${n}%`,e.style.width=`${r}%`,e.style.height=`${i}%`}function wt(e){let{width:t,height:n}=e.getBoundingClientRect();return{frameW:t,frameH:n}}function Tt({x:e,y:t,w:n,h:r},i,a){return{x:e/100*i,y:t/100*a,w:n/100*i,h:r/100*a}}function Et({x:e,y:t,w:n,h:r},i,a){return{x:e/i*100,y:t/a*100,w:n/i*100,h:r/a*100}}var Dt=({boxRef:e})=>{let{currentAction:n,getLastHistoryItem:r,eventBus:i}=M(),a=w(),{width:o,height:s}=r(),c=n?.name===d.CROP||n?.name===d.PRESET_CROP,l=c?n.args.ratio:1,u=!c||n.args.isFree,f=(0,t.useMemo)(()=>H(l,o,s),[l,o,s]),p=(0,t.useRef)(null),m=(0,t.useRef)(``),h=(0,t.useRef)(f),g=(0,t.useRef)(f);return(0,t.useEffect)(()=>{h.current=f,ot(i,f)},[f,i]),(0,t.useEffect)(()=>{let t=(e,t)=>{h.current=t,Ct(e,t),at(i,{x:Math.round(t.x/100*o),y:Math.round(t.y/100*s),w:Math.round(t.w/100*o),h:Math.round(t.h/100*s)}),ot(i,t)},n=e=>{e.preventDefault(),g.current=h.current;let t=`clientX`in e?e.clientX:e.touches[0].clientX,n=`clientY`in e?e.clientY:e.touches[0].clientY;p.current={x:t,y:n},document.body.style.cursor=`move`},r=t=>{if(!e.current||!p.current)return;t.preventDefault();let n=e.current,r=n.parentElement;if(!r)return;let{frameW:i,frameH:o}=wt(r);if(m.current){a(t,n,i,o);return}c(t,n,i,o)},a=(e,n,r,i)=>{if(!p.current)return;let a=`clientX`in e?e.clientX:e.touches[0].clientX,c=`clientY`in e?e.clientY:e.touches[0].clientY,d=Et(Fe(m.current,u,l,p.current.x,p.current.y,a,c,r,i,Tt(g.current,r,i),Tt(h.current,r,i)),r,i);t(n,u?d:Ie(d,l,o,s))},c=(e,n,r,i)=>{if(!p.current)return;let{x:a,y:o,w:s,h:c}=g.current,l=`clientX`in e?e.clientX:e.touches[0].clientX,u=`clientY`in e?e.clientY:e.touches[0].clientY,d=(l-p.current.x)/r*100,f=(u-p.current.y)/i*100;t(n,{x:St(a+d,0,Math.max(0,100-s)),y:St(o+f,0,Math.max(0,100-c)),w:s,h:c})},d=()=>{e.current&&(p.current=null,m.current=``,e.current.style.cursor=`move`,document.body.style.cursor=`auto`)};if(!e.current)return;let f=new AbortController,{signal:_}=f;return e.current.addEventListener(`mousedown`,n,{signal:_}),e.current.addEventListener(`touchstart`,n,{signal:_,passive:!1}),document.addEventListener(`mousemove`,r,{signal:_}),document.addEventListener(`touchmove`,r,{signal:_,passive:!1}),document.addEventListener(`mouseup`,d,{signal:_}),document.addEventListener(`touchend`,d,{signal:_}),()=>f.abort()},[u,l,o,s,e,i]),{handleCropStart:(t,n,r)=>{if(!e.current)return;t.stopPropagation(),t.preventDefault(),g.current=h.current;let i=`clientX`in t?t.clientX:t.touches[0].clientX,o=`clientY`in t?t.clientY:t.touches[0].clientY;p.current={x:i,y:o},m.current=n,a||(e.current.style.cursor=`${r}-resize`,document.body.style.cursor=`${r}-resize`)},initialCrop:f}},Ot=({onMouseDown:e})=>(0,_.jsx)(`div`,{className:Z.mobileBorder,children:(0,_.jsx)(`div`,{className:Z.mobilePointer,onTouchStart:t=>e(t,`br`,`nwse`)})}),kt=()=>{let e=(0,t.useRef)(null),n=(0,t.useRef)(null),r=(0,t.useRef)(null),i=(0,t.useRef)(null),{currentAction:a,getLastHistoryItem:o,eventBus:s}=M(),{width:c,height:l}=o();return(0,t.useEffect)(()=>{if(!(a?.name===d.CROP||a?.name===d.PRESET_CROP))return;let{xP:t,yP:o,wP:u,hP:f}=H(a.args.ratio,c,l);e.current&&(e.current.textContent=t.toString()),n.current&&(n.current.textContent=o.toString()),r.current&&(r.current.textContent=u.toString()),i.current&&(i.current.textContent=f.toString());let p=t=>{let{x:a,y:o,w:s,h:c}=t.detail;e.current&&(e.current.textContent=a.toString()),n.current&&(n.current.textContent=o.toString()),r.current&&(r.current.textContent=s.toString()),i.current&&(i.current.textContent=c.toString())};return s.addEventListener(`crop-update`,p),()=>{s.removeEventListener(`crop-update`,p)}},[a,l,c,s]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`${Z.info} ${Z.infoX}`,children:(0,_.jsx)(`b`,{ref:e})}),(0,_.jsx)(`div`,{className:`${Z.info} ${Z.infoY}`,children:(0,_.jsx)(`b`,{ref:n})}),(0,_.jsx)(`div`,{className:`${Z.info} ${Z.infoW}`,children:(0,_.jsx)(`b`,{ref:r})}),(0,_.jsx)(`div`,{className:`${Z.info} ${Z.infoH}`,children:(0,_.jsx)(`b`,{ref:i})})]})},At=ke.map(e=>e.options).flat(),jt=()=>At,Mt=()=>{let{currentAction:e,getLastHistoryItem:n,addToHistory:r,setSidebar:i,setCurrentAction:a,eventBus:o}=M(),{width:s,height:c}=n(),l=e?.name===d.PRESET_CROP&&At.some(t=>t.value===e.args.id)?e.args.id:``,u=(0,t.useRef)({x:0,y:0,w:0,h:0});return(0,t.useEffect)(()=>{if(e?.name!==d.PRESET_CROP)return;let t=H(e.args.ratio,s,c);u.current=t;let n=e=>{u.current=e.detail};return o.addEventListener(`clip-path-update`,n),()=>{o.removeEventListener(`clip-path-update`,n)}},[e,s,c,o]),{currentValue:l,presetsData:ke,handleChange:e=>{if(!e)return;let t=jt().find(t=>t.value===e);if(!t)return;let n={id:e,ratio:t.w/t.h,isFree:!1,preset:{width:t.w,height:t.h}};a({name:d.PRESET_CROP,args:n})},handleSave:()=>{!e||e.name!==d.PRESET_CROP||(r({width:e.args?.preset?.width||0,height:e.args?.preset?.height||0,action:{name:d.CROP,args:{...e.args,...u.current}}}),i(!0))},handleClose:()=>{a(null),i(!0)}}},Nt={select:`_select_1ip4k_1`},Pt=()=>{let{currentValue:e,presetsData:t,handleChange:n,handleSave:r,handleClose:i}=Mt();return(0,_.jsxs)(B,{children:[(0,_.jsx)(ye,{value:e,placeholder:`Select a preset`,onChange:n,items:t,className:Nt.select}),(0,_.jsx)(L,{onSave:r,onClose:i})]})},Ft=()=>{let{getLastHistoryItem:e,setCurrentAction:n,addToHistory:r,setSidebar:i}=M(),{width:a,height:o}=e(),[s,c]=(0,t.useState)(!1),[l,u]=(0,t.useState)(!1),f=(e,t)=>{n({name:d.FLIP,args:{horizontal:e,vertical:t}})};return{flipHorizontal:s,flipVertical:l,handleFlipHorizontal:()=>{let e=!s;c(e),f(e,l)},handleFlipVertical:()=>{let e=!l;u(e),f(s,e)},handleSave:()=>{r({width:a,height:o,action:{name:d.FLIP,args:{horizontal:s,vertical:l}}}),i(!0)},handleClose:()=>{n(null),i(!0)}}},Q={btnH:`_btnH_15adi_1`,btnV:`_btnV_15adi_7`},It=()=>{let{flipHorizontal:e,flipVertical:t,handleFlipHorizontal:n,handleFlipVertical:r,handleSave:i,handleClose:a}=Ft();return(0,_.jsxs)(B,{children:[(0,_.jsx)(`div`,{className:Q.scGroup,children:(0,_.jsxs)(z,{position:`top`,className:Q.tooltip,children:[(0,_.jsx)(P,{variant:`outline`,className:Q.btnH,onClick:n,"aria-label":`Horizontal`,"data-tooltip":`Horizontal`,children:(0,_.jsx)(le,{style:{color:e?`var(--accent-blue)`:`var(--foreground)`}})}),(0,_.jsx)(P,{variant:`outline`,className:Q.btnV,onClick:r,"aria-label":`Vertical`,"data-tooltip":`Vertical`,children:(0,_.jsx)(ue,{style:{color:t?`var(--accent-blue)`:`var(--foreground)`}})})]})}),(0,_.jsx)(L,{disabled:!e&&!t,onSave:i,onClose:a})]})},Lt=()=>{let{getLastRotation:e,getLastHistoryItem:n,addToHistory:r,setSidebar:i,setCurrentAction:a}=M(),{width:o,height:s}=n(),c=e(),l=(0,t.useRef)(c),u=(0,t.useRef)(c);return{handleRotate:e=>{u.current+=e,a({name:d.ROTATE,args:{degrees:u.current}})},handleSave:()=>{r({...Le(o,s,l.current,u.current),action:{name:d.ROTATE,args:{degrees:u.current}}}),i(!0)},handleClose:()=>{a(null),i(!0)}}},$={btnH:`_btnH_15adi_1`,btnV:`_btnV_15adi_7`},Rt=()=>{let{handleRotate:e,handleSave:t,handleClose:n}=Lt();return(0,_.jsxs)(B,{children:[(0,_.jsx)(`div`,{className:$.scGroup,children:(0,_.jsxs)(z,{position:`top`,className:$.tooltip,children:[(0,_.jsx)(P,{variant:`outline`,className:$.btnH,onClick:()=>e(90),"aria-label":`+90°`,"data-tooltip":`+90°`,children:(0,_.jsx)(de,{})}),(0,_.jsx)(P,{variant:`outline`,className:$.btnV,onClick:()=>e(-90),"aria-label":`-90°`,"data-tooltip":`-90°`,children:(0,_.jsx)(fe,{})})]})}),(0,_.jsx)(L,{onSave:t,onClose:n})]})},zt={frame:`_frame_15mog_1`},Bt=()=>{let{currentAction:e}=M(),t=e?.name===d.RESIZE,n=e?.name===d.CROP,r=e?.name===d.PRESET_CROP,i=e?.name===d.FLIP,a=e?.name===d.ROTATE,o=n||r;return(0,_.jsxs)(`div`,{className:`${zt.frame} ${o?I.mask:``}`,children:[(0,_.jsx)(mt,{style:o?{opacity:.4}:{}}),t&&(0,_.jsx)(ft,{}),(n||r)&&(0,_.jsx)(ht,{},e?.args?.id),n&&(0,_.jsx)(yt,{}),r&&(0,_.jsx)(Pt,{}),i&&(0,_.jsx)(It,{}),a&&(0,_.jsx)(Rt,{})]})};e.Pixedi=({image:e,onSave:n,onBack:r,theme:i=`light`,settings:a=f})=>{let[o,s]=(0,t.useState)(null),c=ee(`sm`,o),l={...f,...a},{loading:u,error:d,mimeType:p,width:m,height:h,originalBlob:g,previewUrl:y,isAlpha:b}=S({src:e,skip:l?.tools?.length===0});return l?.tools?.length===0?(0,_.jsx)(`div`,{className:`${I.root} ${I.wrapper}`,"data-theme":i,children:(0,_.jsx)(`div`,{className:I.system,children:(0,_.jsx)(`div`,{className:I.textRed,children:`No tools selected.`})})}):u||d||!g||!p?(0,_.jsx)(`div`,{className:`${I.root} ${I.wrapper}`,"data-theme":i,children:(0,_.jsxs)(`div`,{className:I.system,children:[u&&(0,_.jsx)(j,{style:{width:48,height:48}}),d&&(0,_.jsx)(`div`,{className:I.textRed,children:d}),!u&&!d&&(!g||!p)&&(0,_.jsx)(`div`,{className:I.textRed,children:`Failed to load image.`})]})}):(0,_.jsx)(v,{mimeType:p,width:m,height:h,originalBlob:g,previewUrl:y,isAlpha:b,settings:l,children:(0,_.jsx)(`div`,{ref:s,className:`${I.root} ${I.wrapper}`,"data-theme":i,children:(0,_.jsxs)(`div`,{className:`${l?.infobar?I.grid:I.gridNoInfobar} ${c?I.mobile:``}`,children:[(0,_.jsx)(Ze,{onSave:n,onBack:r,isMobile:c}),(0,_.jsx)(tt,{isMobile:c}),l?.infobar&&(0,_.jsx)(it,{}),(0,_.jsx)(Bt,{})]})})})}});