diff --git a/.gitignore b/.gitignore index 09e67d56..93a1b6a6 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ database.db src/lang/source-use.json /data +/build/ diff --git a/electron/lib/env-main.ts b/electron/lib/env-main.ts index e9d4d1fa..7371010e 100644 --- a/electron/lib/env-main.ts +++ b/electron/lib/env-main.ts @@ -15,7 +15,7 @@ process.env.VITE_PUBLIC = VITE_DEV_SERVER_URL ? path.join(process.env.APP_ROOT, 'public') : RENDERER_DIST -export const preloadDefault = path.join(MAIN_DIST, 'preload/index.mjs') +export const preloadDefault = path.join(MAIN_DIST, 'preload/index.cjs') export const rendererLoadPath = (window: BrowserWindow | BrowserView, fileName: string) => { if (!isPackaged && process.env.VITE_DEV_SERVER_URL) { diff --git a/electron/lib/util.ts b/electron/lib/util.ts index c6dd7a94..52b9c5f9 100644 --- a/electron/lib/util.ts +++ b/electron/lib/util.ts @@ -5,7 +5,7 @@ import fs from "node:fs"; import Showdown from "showdown" import iconvLite from "iconv-lite"; import chardet from "chardet"; -import {Iconv} from "iconv" +// import {Iconv} from "iconv" export const EncodeUtil = { base64Encode(str: string) { @@ -39,10 +39,10 @@ export const IconvUtil = { }, bufferToUtf8(buffer: Buffer) { const encoding = chardet.detect(buffer) - if ('ISO-2022-CN' === encoding) { - const iconvInstance = new Iconv('ISO-2022-CN', 'UTF-8//TRANSLIT//IGNORE'); - return iconvInstance.convert(buffer).toString() - } + // if ('ISO-2022-CN' === encoding) { + // const iconvInstance = new Iconv('ISO-2022-CN', 'UTF-8//TRANSLIT//IGNORE'); + // return iconvInstance.convert(buffer).toString() + // } return iconvLite.decode(buffer, encoding).toString() }, detect(buffer: Uint8Array) { diff --git a/electron/mapi/keys/main.ts b/electron/mapi/keys/main.ts index 9dbd8af3..46c4c503 100644 --- a/electron/mapi/keys/main.ts +++ b/electron/mapi/keys/main.ts @@ -70,7 +70,7 @@ const register = () => { } else { focusedWindow.webContents.openDevTools({ mode: 'detach', - activate: false, + activate: true, title: 'FocusedWindow', }); } diff --git a/electron/page/thirdPartyImageBeautifier.ts b/electron/page/thirdPartyImageBeautifier.ts index f7679c00..052e99e1 100644 --- a/electron/page/thirdPartyImageBeautifier.ts +++ b/electron/page/thirdPartyImageBeautifier.ts @@ -1,4 +1,4 @@ -import {preloadDefault, rendererLoadPath} from "../lib/env-main"; +import {preloadDefault} from "../lib/env-main"; import {AppRuntime} from "../mapi/env"; import {BrowserWindow} from "electron"; import {Page} from "./index"; diff --git a/package.json b/package.json index 129c0524..d463a830 100644 --- a/package.json +++ b/package.json @@ -58,15 +58,18 @@ "@devicefarmer/adbkit": "^3.2.6", "@electron-toolkit/preload": "^3.0.1", "@electron-toolkit/utils": "^3.0.0", + "@electron/remote": "^2.1.2", "@types/showdown": "^2.0.6", "@xterm/addon-fit": "^0.10.0", "@xterm/xterm": "^5.5.0", "axios": "^1.7.2", + "chardet": "^2.0.0", "date-and-time": "^3.4.1", "dayjs": "^1.11.12", "electron-context-menu": "^4.0.4", "ffmpeg-static": "^5.2.0", "fix-path": "^4.0.0", + "iconv": "^3.0.1", "iconv-lite": "^0.6.3", "js-base64": "^3.7.7", "lodash-es": "^4.17.21", @@ -79,5 +82,8 @@ "vue-command": "^35.2.1", "vue-i18n": "^9.13.1", "vue-router": "^4.4.0" + }, + "optionalDependencies": { + "node-mac-permissions": "^2.4.0" } } diff --git a/public/third-party/image-beautifier/assets/index-CRsOhn0p.js b/public/third-party/image-beautifier/assets/index-SmyfLWDC.js similarity index 99% rename from public/third-party/image-beautifier/assets/index-CRsOhn0p.js rename to public/third-party/image-beautifier/assets/index-SmyfLWDC.js index ef48d402..5d78b2c5 100644 --- a/public/third-party/image-beautifier/assets/index-CRsOhn0p.js +++ b/public/third-party/image-beautifier/assets/index-SmyfLWDC.js @@ -8625,4 +8625,4 @@ ${U9} * * Date: 2024-04-21T07:43:05.335Z */function IA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function aV(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,i=new Array(t);n
',$Ge=Number.isNaN||cl.isNaN;function gn(e){return typeof e=="number"&&!$Ge(e)}var UA=function(t){return t>0&&t<1/0};function i5(e){return typeof e>"u"}function Lu(e){return Z_(e)==="object"&&e!==null}var OGe=Object.prototype.hasOwnProperty;function l1(e){if(!Lu(e))return!1;try{var t=e.constructor,n=t.prototype;return t&&n&&OGe.call(n,"isPrototypeOf")}catch{return!1}}function ya(e){return typeof e=="function"}var RGe=Array.prototype.slice;function vV(e){return Array.from?Array.from(e):RGe.call(e)}function tr(e,t){return e&&ya(t)&&(Array.isArray(e)||gn(e.length)?vV(e).forEach(function(n,i){t.call(e,n,i,e)}):Lu(e)&&Object.keys(e).forEach(function(n){t.call(e,e[n],n,e)})),e}var _i=Object.assign||function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r0&&i.forEach(function(a){Lu(a)&&Object.keys(a).forEach(function(o){t[o]=a[o]})}),t},PGe=/\.\d*(?:0|9){12}\d*$/;function S1(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return PGe.test(e)?Math.round(e*t)/t:e}var AGe=/^width|height|left|top|marginLeft|marginTop$/;function Jc(e,t){var n=e.style;tr(t,function(i,r){AGe.test(r)&&gn(i)&&(i="".concat(i,"px")),n[r]=i})}function IGe(e,t){return e.classList?e.classList.contains(t):e.className.indexOf(t)>-1}function mr(e,t){if(t){if(gn(e.length)){tr(e,function(i){mr(i,t)});return}if(e.classList){e.classList.add(t);return}var n=e.className.trim();n?n.indexOf(t)<0&&(e.className="".concat(n," ").concat(t)):e.className=t}}function sl(e,t){if(t){if(gn(e.length)){tr(e,function(n){sl(n,t)});return}if(e.classList){e.classList.remove(t);return}e.className.indexOf(t)>=0&&(e.className=e.className.replace(t,""))}}function c1(e,t,n){if(t){if(gn(e.length)){tr(e,function(i){c1(i,t,n)});return}n?mr(e,t):sl(e,t)}}var TGe=/([a-z\d])([A-Z])/g;function r7(e){return e.replace(TGe,"$1-$2").toLowerCase()}function ax(e,t){return Lu(e[t])?e[t]:e.dataset?e.dataset[t]:e.getAttribute("data-".concat(r7(t)))}function J2(e,t,n){Lu(n)?e[t]=n:e.dataset?e.dataset[t]=n:e.setAttribute("data-".concat(r7(t)),n)}function jGe(e,t){if(Lu(e[t]))try{delete e[t]}catch{e[t]=void 0}else if(e.dataset)try{delete e.dataset[t]}catch{e.dataset[t]=void 0}else e.removeAttribute("data-".concat(r7(t)))}var gV=/\s\s*/,mV=function(){var e=!1;if(nb){var t=!1,n=function(){},i=Object.defineProperty({},"once",{get:function(){return e=!0,t},set:function(a){t=a}});cl.addEventListener("test",n,i),cl.removeEventListener("test",n,i)}return e}();function is(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},r=n;t.trim().split(gV).forEach(function(a){if(!mV){var o=e.listeners;o&&o[a]&&o[a][n]&&(r=o[a][n],delete o[a][n],Object.keys(o[a]).length===0&&delete o[a],Object.keys(o).length===0&&delete e.listeners)}e.removeEventListener(a,r,i)})}function So(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},r=n;t.trim().split(gV).forEach(function(a){if(i.once&&!mV){var o=e.listeners,s=o===void 0?{}:o;r=function(){delete s[a][n],e.removeEventListener(a,r,i);for(var c=arguments.length,u=new Array(c),h=0;hMath.abs(n)&&(n=g)})}),n}function Bg(e,t){var n=e.pageX,i=e.pageY,r={endX:n,endY:i};return t?r:aV({startX:n,startY:i},r)}function BGe(e){var t=0,n=0,i=0;return tr(e,function(r){var a=r.startX,o=r.startY;t+=a,n+=o,i+=1}),t/=i,n/=i,{pageX:t,pageY:n}}function ed(e){var t=e.aspectRatio,n=e.height,i=e.width,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",a=UA(i),o=UA(n);if(a&&o){var s=n*t;r==="contain"&&s>i||r==="cover"&&s90?{width:l,height:s}:{width:s,height:l}}function HGe(e,t,n,i){var r=t.aspectRatio,a=t.naturalWidth,o=t.naturalHeight,s=t.rotate,l=s===void 0?0:s,c=t.scaleX,u=c===void 0?1:c,h=t.scaleY,g=h===void 0?1:h,m=n.aspectRatio,y=n.naturalWidth,k=n.naturalHeight,w=i.fillColor,_=w===void 0?"transparent":w,b=i.imageSmoothingEnabled,M=b===void 0?!0:b,C=i.imageSmoothingQuality,E=C===void 0?"low":C,S=i.maxWidth,$=S===void 0?1/0:S,R=i.maxHeight,P=R===void 0?1/0:R,A=i.minWidth,I=A===void 0?0:A,T=i.minHeight,H=T===void 0?0:T,L=document.createElement("canvas"),G=L.getContext("2d"),D=ed({aspectRatio:m,width:$,height:P}),B=ed({aspectRatio:m,width:I,height:H},"cover"),z=Math.min(D.width,Math.max(B.width,y)),V=Math.min(D.height,Math.max(B.height,k)),W=ed({aspectRatio:r,width:$,height:P}),F=ed({aspectRatio:r,width:I,height:H},"cover"),X=Math.min(W.width,Math.max(F.width,a)),J=Math.min(W.height,Math.max(F.height,o)),Z=[-X/2,-J/2,X,J];return L.width=S1(z),L.height=S1(V),G.fillStyle=_,G.fillRect(0,0,z,V),G.save(),G.translate(z/2,V/2),G.rotate(l*Math.PI/180),G.scale(u,g),G.imageSmoothingEnabled=M,G.imageSmoothingQuality=E,G.drawImage.apply(G,[e].concat(sV(Z.map(function(ee){return Math.floor(S1(ee))})))),G.restore(),L}var kV=String.fromCharCode;function NGe(e,t,n){var i="";n+=t;for(var r=t;r0;)n.push(kV.apply(null,vV(r.subarray(0,i)))),r=r.subarray(i);return"data:".concat(t,";base64,").concat(btoa(n.join("")))}function WGe(e){var t=new DataView(e),n;try{var i,r,a;if(t.getUint8(0)===255&&t.getUint8(1)===216)for(var o=t.byteLength,s=2;s+1=8&&(a=c+h)}}}if(a){var g=t.getUint16(a,i),m,y;for(y=0;y=0?a:hV),height:Math.max(i.offsetHeight,o>=0?o:pV)};this.containerData=s,Jc(r,{width:s.width,height:s.height}),mr(t,ka),sl(r,ka)},initCanvas:function(){var t=this.containerData,n=this.imageData,i=this.options.viewMode,r=Math.abs(n.rotate)%180===90,a=r?n.naturalHeight:n.naturalWidth,o=r?n.naturalWidth:n.naturalHeight,s=a/o,l=t.width,c=t.height;t.height*s>t.width?i===3?l=t.height*s:c=t.width/s:i===3?c=t.width/s:l=t.height*s;var u={aspectRatio:s,naturalWidth:a,naturalHeight:o,width:l,height:c};this.canvasData=u,this.limited=i===1||i===2,this.limitCanvas(!0,!0),u.width=Math.min(Math.max(u.width,u.minWidth),u.maxWidth),u.height=Math.min(Math.max(u.height,u.minHeight),u.maxHeight),u.left=(t.width-u.width)/2,u.top=(t.height-u.height)/2,u.oldLeft=u.left,u.oldTop=u.top,this.initialCanvasData=_i({},u)},limitCanvas:function(t,n){var i=this.options,r=this.containerData,a=this.canvasData,o=this.cropBoxData,s=i.viewMode,l=a.aspectRatio,c=this.cropped&&o;if(t){var u=Number(i.minCanvasWidth)||0,h=Number(i.minCanvasHeight)||0;s>1?(u=Math.max(u,r.width),h=Math.max(h,r.height),s===3&&(h*l>u?u=h*l:h=u/l)):s>0&&(u?u=Math.max(u,c?o.width:0):h?h=Math.max(h,c?o.height:0):c&&(u=o.width,h=o.height,h*l>u?u=h*l:h=u/l));var g=ed({aspectRatio:l,width:u,height:h});u=g.width,h=g.height,a.minWidth=u,a.minHeight=h,a.maxWidth=1/0,a.maxHeight=1/0}if(n)if(s>(c?0:1)){var m=r.width-a.width,y=r.height-a.height;a.minLeft=Math.min(0,m),a.minTop=Math.min(0,y),a.maxLeft=Math.max(0,m),a.maxTop=Math.max(0,y),c&&this.limited&&(a.minLeft=Math.min(o.left,o.left+(o.width-a.width)),a.minTop=Math.min(o.top,o.top+(o.height-a.height)),a.maxLeft=o.left,a.maxTop=o.top,s===2&&(a.width>=r.width&&(a.minLeft=Math.min(0,m),a.maxLeft=Math.max(0,m)),a.height>=r.height&&(a.minTop=Math.min(0,y),a.maxTop=Math.max(0,y))))}else a.minLeft=-a.width,a.minTop=-a.height,a.maxLeft=r.width,a.maxTop=r.height},renderCanvas:function(t,n){var i=this.canvasData,r=this.imageData;if(n){var a=DGe({width:r.naturalWidth*Math.abs(r.scaleX||1),height:r.naturalHeight*Math.abs(r.scaleY||1),degree:r.rotate||0}),o=a.width,s=a.height,l=i.width*(o/i.naturalWidth),c=i.height*(s/i.naturalHeight);i.left-=(l-i.width)/2,i.top-=(c-i.height)/2,i.width=l,i.height=c,i.aspectRatio=o/s,i.naturalWidth=o,i.naturalHeight=s,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.widthi.maxHeight||i.heightn.width?a.height=a.width/i:a.width=a.height*i),this.cropBoxData=a,this.limitCropBox(!0,!0),a.width=Math.min(Math.max(a.width,a.minWidth),a.maxWidth),a.height=Math.min(Math.max(a.height,a.minHeight),a.maxHeight),a.width=Math.max(a.minWidth,a.width*r),a.height=Math.max(a.minHeight,a.height*r),a.left=n.left+(n.width-a.width)/2,a.top=n.top+(n.height-a.height)/2,a.oldLeft=a.left,a.oldTop=a.top,this.initialCropBoxData=_i({},a)},limitCropBox:function(t,n){var i=this.options,r=this.containerData,a=this.canvasData,o=this.cropBoxData,s=this.limited,l=i.aspectRatio;if(t){var c=Number(i.minCropBoxWidth)||0,u=Number(i.minCropBoxHeight)||0,h=s?Math.min(r.width,a.width,a.width+a.left,r.width-a.left):r.width,g=s?Math.min(r.height,a.height,a.height+a.top,r.height-a.top):r.height;c=Math.min(c,r.width),u=Math.min(u,r.height),l&&(c&&u?u*l>c?u=c/l:c=u*l:c?u=c/l:u&&(c=u*l),g*l>h?g=h/l:h=g*l),o.minWidth=Math.min(c,h),o.minHeight=Math.min(u,g),o.maxWidth=h,o.maxHeight=g}n&&(s?(o.minLeft=Math.max(0,a.left),o.minTop=Math.max(0,a.top),o.maxLeft=Math.min(r.width,a.left+a.width)-o.width,o.maxTop=Math.min(r.height,a.top+a.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=r.width-o.width,o.maxTop=r.height-o.height))},renderCropBox:function(){var t=this.options,n=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.widthi.maxHeight||i.height=n.width&&i.height>=n.height?cV:n7),Jc(this.cropBox,_i({width:i.width,height:i.height},d2({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),E1(this.element,ex,this.getData())}},KGe={initPreview:function(){var t=this.element,n=this.crossOrigin,i=this.options.preview,r=n?this.crossOriginUrl:this.url,a=t.alt||"The image to preview",o=document.createElement("img");if(n&&(o.crossOrigin=n),o.src=r,o.alt=a,this.viewBox.appendChild(o),this.viewBoxImage=o,!!i){var s=i;typeof i=="string"?s=t.ownerDocument.querySelectorAll(i):i.querySelector&&(s=[i]),this.previews=s,tr(s,function(l){var c=document.createElement("img");J2(l,Lg,{width:l.offsetWidth,height:l.offsetHeight,html:l.innerHTML}),n&&(c.crossOrigin=n),c.src=r,c.alt=a,c.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',l.innerHTML="",l.appendChild(c)})}},resetPreview:function(){tr(this.previews,function(t){var n=ax(t,Lg);Jc(t,{width:n.width,height:n.height}),t.innerHTML=n.html,jGe(t,Lg)})},preview:function(){var t=this.imageData,n=this.canvasData,i=this.cropBoxData,r=i.width,a=i.height,o=t.width,s=t.height,l=i.left-n.left-t.left,c=i.top-n.top-t.top;!this.cropped||this.disabled||(Jc(this.viewBoxImage,_i({width:o,height:s},d2(_i({translateX:-l,translateY:-c},t)))),tr(this.previews,function(u){var h=ax(u,Lg),g=h.width,m=h.height,y=g,k=m,w=1;r&&(w=g/r,k=a*w),a&&k>m&&(w=m/a,y=r*w,k=m),Jc(u,{width:y,height:k}),Jc(u.getElementsByTagName("img")[0],_i({width:o*w,height:s*w},d2(_i({translateX:-l*w,translateY:-c*w},t))))}))}},XGe={bind:function(){var t=this.element,n=this.options,i=this.cropper;ya(n.cropstart)&&So(t,ix,n.cropstart),ya(n.cropmove)&&So(t,nx,n.cropmove),ya(n.cropend)&&So(t,tx,n.cropend),ya(n.crop)&&So(t,ex,n.crop),ya(n.zoom)&&So(t,rx,n.zoom),So(i,BA,this.onCropStart=this.cropStart.bind(this)),n.zoomable&&n.zoomOnWheel&&So(i,VA,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),n.toggleDragModeOnDblclick&&So(i,LA,this.onDblclick=this.dblclick.bind(this)),So(t.ownerDocument,DA,this.onCropMove=this.cropMove.bind(this)),So(t.ownerDocument,HA,this.onCropEnd=this.cropEnd.bind(this)),n.responsive&&So(window,FA,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,n=this.options,i=this.cropper;ya(n.cropstart)&&is(t,ix,n.cropstart),ya(n.cropmove)&&is(t,nx,n.cropmove),ya(n.cropend)&&is(t,tx,n.cropend),ya(n.crop)&&is(t,ex,n.crop),ya(n.zoom)&&is(t,rx,n.zoom),is(i,BA,this.onCropStart),n.zoomable&&n.zoomOnWheel&&is(i,VA,this.onWheel,{passive:!1,capture:!0}),n.toggleDragModeOnDblclick&&is(i,LA,this.onDblclick),is(t.ownerDocument,DA,this.onCropMove),is(t.ownerDocument,HA,this.onCropEnd),n.responsive&&is(window,FA,this.onResize)}},ZGe={resize:function(){if(!this.disabled){var t=this.options,n=this.container,i=this.containerData,r=n.offsetWidth/i.width,a=n.offsetHeight/i.height,o=Math.abs(r-1)>Math.abs(a-1)?r:a;if(o!==1){var s,l;t.restore&&(s=this.getCanvasData(),l=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(tr(s,function(c,u){s[u]=c*o})),this.setCropBoxData(tr(l,function(c,u){l[u]=c*o})))}}},dblclick:function(){this.disabled||this.options.dragMode===fV||this.setDragMode(IGe(this.dragBox,Q_)?uV:i7)},wheel:function(t){var n=this,i=Number(this.options.wheelZoomRatio)||.1,r=1;this.disabled||(t.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){n.wheeling=!1},50),t.deltaY?r=t.deltaY>0?1:-1:t.wheelDelta?r=-t.wheelDelta/120:t.detail&&(r=t.detail>0?1:-1),this.zoom(-r*i,t)))},cropStart:function(t){var n=t.buttons,i=t.button;if(!(this.disabled||(t.type==="mousedown"||t.type==="pointerdown"&&t.pointerType==="mouse")&&(gn(n)&&n!==1||gn(i)&&i!==0||t.ctrlKey))){var r=this.options,a=this.pointers,o;t.changedTouches?tr(t.changedTouches,function(s){a[s.identifier]=Bg(s)}):a[t.pointerId||0]=Bg(t),Object.keys(a).length>1&&r.zoomable&&r.zoomOnTouch?o=dV:o=ax(t.target,Q2),xGe.test(o)&&E1(this.element,ix,{originalEvent:t,action:o})!==!1&&(t.preventDefault(),this.action=o,this.cropping=!1,o===lV&&(this.cropping=!0,mr(this.dragBox,jy)))}},cropMove:function(t){var n=this.action;if(!(this.disabled||!n)){var i=this.pointers;t.preventDefault(),E1(this.element,nx,{originalEvent:t,action:n})!==!1&&(t.changedTouches?tr(t.changedTouches,function(r){_i(i[r.identifier]||{},Bg(r,!0))}):_i(i[t.pointerId||0]||{},Bg(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var n=this.action,i=this.pointers;t.changedTouches?tr(t.changedTouches,function(r){delete i[r.identifier]}):delete i[t.pointerId||0],n&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,c1(this.dragBox,jy,this.cropped&&this.options.modal)),E1(this.element,tx,{originalEvent:t,action:n}))}}},YGe={change:function(t){var n=this.options,i=this.canvasData,r=this.containerData,a=this.cropBoxData,o=this.pointers,s=this.action,l=n.aspectRatio,c=a.left,u=a.top,h=a.width,g=a.height,m=c+h,y=u+g,k=0,w=0,_=r.width,b=r.height,M=!0,C;!l&&t.shiftKey&&(l=h&&g?h/g:1),this.limited&&(k=a.minLeft,w=a.minTop,_=k+Math.min(r.width,i.width,i.left+i.width),b=w+Math.min(r.height,i.height,i.top+i.height));var E=o[Object.keys(o)[0]],S={x:E.endX-E.startX,y:E.endY-E.startY},$=function(P){switch(P){case Gd:m+S.x>_&&(S.x=_-m);break;case Kd:c+S.xb&&(S.y=b-y);break}};switch(s){case n7:c+=S.x,u+=S.y;break;case Gd:if(S.x>=0&&(m>=_||l&&(u<=w||y>=b))){M=!1;break}$(Gd),h+=S.x,h<0&&(s=Kd,h=-h,c-=h),l&&(g=h/l,u+=(a.height-g)/2);break;case Lc:if(S.y<=0&&(u<=w||l&&(c<=k||m>=_))){M=!1;break}$(Lc),g-=S.y,u+=S.y,g<0&&(s=Bf,g=-g,u-=g),l&&(h=g*l,c+=(a.width-h)/2);break;case Kd:if(S.x<=0&&(c<=k||l&&(u<=w||y>=b))){M=!1;break}$(Kd),h-=S.x,c+=S.x,h<0&&(s=Gd,h=-h,c-=h),l&&(g=h/l,u+=(a.height-g)/2);break;case Bf:if(S.y>=0&&(y>=b||l&&(c<=k||m>=_))){M=!1;break}$(Bf),g+=S.y,g<0&&(s=Lc,g=-g,u-=g),l&&(h=g*l,c+=(a.width-h)/2);break;case E0:if(l){if(S.y<=0&&(u<=w||m>=_)){M=!1;break}$(Lc),g-=S.y,u+=S.y,h=g*l}else $(Lc),$(Gd),S.x>=0?m<_?h+=S.x:S.y<=0&&u<=w&&(M=!1):h+=S.x,S.y<=0?u>w&&(g-=S.y,u+=S.y):(g-=S.y,u+=S.y);h<0&&g<0?(s=R0,g=-g,h=-h,u-=g,c-=h):h<0?(s=$0,h=-h,c-=h):g<0&&(s=O0,g=-g,u-=g);break;case $0:if(l){if(S.y<=0&&(u<=w||c<=k)){M=!1;break}$(Lc),g-=S.y,u+=S.y,h=g*l,c+=a.width-h}else $(Lc),$(Kd),S.x<=0?c>k?(h-=S.x,c+=S.x):S.y<=0&&u<=w&&(M=!1):(h-=S.x,c+=S.x),S.y<=0?u>w&&(g-=S.y,u+=S.y):(g-=S.y,u+=S.y);h<0&&g<0?(s=O0,g=-g,h=-h,u-=g,c-=h):h<0?(s=E0,h=-h,c-=h):g<0&&(s=R0,g=-g,u-=g);break;case R0:if(l){if(S.x<=0&&(c<=k||y>=b)){M=!1;break}$(Kd),h-=S.x,c+=S.x,g=h/l}else $(Bf),$(Kd),S.x<=0?c>k?(h-=S.x,c+=S.x):S.y>=0&&y>=b&&(M=!1):(h-=S.x,c+=S.x),S.y>=0?y=0&&(m>=_||y>=b)){M=!1;break}$(Gd),h+=S.x,g=h/l}else $(Bf),$(Gd),S.x>=0?m<_?h+=S.x:S.y>=0&&y>=b&&(M=!1):h+=S.x,S.y>=0?y0?s=S.y>0?O0:E0:S.x<0&&(c-=h,s=S.y>0?R0:$0),S.y<0&&(u-=g),this.cropped||(sl(this.cropBox,ka),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}M&&(a.width=h,a.height=g,a.left=c,a.top=u,this.action=s,this.renderCropBox()),tr(o,function(R){R.startX=R.endX,R.startY=R.endY})}},QGe={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&mr(this.dragBox,jy),sl(this.cropBox,ka),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=_i({},this.initialImageData),this.canvasData=_i({},this.initialCanvasData),this.cropBoxData=_i({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(_i(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),sl(this.dragBox,jy),mr(this.cropBox,ka)),this},replace:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&t&&(this.isImg&&(this.element.src=t),n?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,tr(this.previews,function(i){i.getElementsByTagName("img")[0].src=t}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,sl(this.cropper,jA)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,mr(this.cropper,jA)),this},destroy:function(){var t=this.element;return t[wi]?(t[wi]=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.canvasData,r=i.left,a=i.top;return this.moveTo(i5(t)?t:r+Number(t),i5(n)?n:a+Number(n))},moveTo:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.canvasData,r=!1;return t=Number(t),n=Number(n),this.ready&&!this.disabled&&this.options.movable&&(gn(t)&&(i.left=t,r=!0),gn(n)&&(i.top=n,r=!0),r&&this.renderCanvas(!0)),this},zoom:function(t,n){var i=this.canvasData;return t=Number(t),t<0?t=1/(1-t):t=1+t,this.zoomTo(i.width*t/i.naturalWidth,null,n)},zoomTo:function(t,n,i){var r=this.options,a=this.canvasData,o=a.width,s=a.height,l=a.naturalWidth,c=a.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&r.zoomable){var u=l*t,h=c*t;if(E1(this.element,rx,{ratio:t,oldRatio:o/l,originalEvent:i})===!1)return this;if(i){var g=this.pointers,m=yV(this.cropper),y=g&&Object.keys(g).length?BGe(g):{pageX:i.pageX,pageY:i.pageY};a.left-=(u-o)*((y.pageX-m.left-a.left)/o),a.top-=(h-s)*((y.pageY-m.top-a.top)/s)}else l1(n)&&gn(n.x)&&gn(n.y)?(a.left-=(u-o)*((n.x-a.left)/o),a.top-=(h-s)*((n.y-a.top)/s)):(a.left-=(u-o)/2,a.top-=(h-s)/2);a.width=u,a.height=h,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return t=Number(t),gn(t)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var n=this.imageData.scaleY;return this.scale(t,gn(n)?n:1)},scaleY:function(t){var n=this.imageData.scaleX;return this.scale(gn(n)?n:1,t)},scale:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.imageData,r=!1;return t=Number(t),n=Number(n),this.ready&&!this.disabled&&this.options.scalable&&(gn(t)&&(i.scaleX=t,r=!0),gn(n)&&(i.scaleY=n,r=!0),r&&this.renderCanvas(!0,!0)),this},getData:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=this.options,i=this.imageData,r=this.canvasData,a=this.cropBoxData,o;if(this.ready&&this.cropped){o={x:a.left-r.left,y:a.top-r.top,width:a.width,height:a.height};var s=i.width/i.naturalWidth;if(tr(o,function(u,h){o[h]=u/s}),t){var l=Math.round(o.y+o.height),c=Math.round(o.x+o.width);o.x=Math.round(o.x),o.y=Math.round(o.y),o.width=c-o.x,o.height=l-o.y}}else o={x:0,y:0,width:0,height:0};return n.rotatable&&(o.rotate=i.rotate||0),n.scalable&&(o.scaleX=i.scaleX||1,o.scaleY=i.scaleY||1),o},setData:function(t){var n=this.options,i=this.imageData,r=this.canvasData,a={};if(this.ready&&!this.disabled&&l1(t)){var o=!1;n.rotatable&&gn(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,o=!0),n.scalable&&(gn(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,o=!0),gn(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var s=i.width/i.naturalWidth;gn(t.x)&&(a.left=t.x*s+r.left),gn(t.y)&&(a.top=t.y*s+r.top),gn(t.width)&&(a.width=t.width*s),gn(t.height)&&(a.height=t.height*s),this.setCropBoxData(a)}return this},getContainerData:function(){return this.ready?_i({},this.containerData):{}},getImageData:function(){return this.sized?_i({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,n={};return this.ready&&tr(["left","top","width","height","naturalWidth","naturalHeight"],function(i){n[i]=t[i]}),n},setCanvasData:function(t){var n=this.canvasData,i=n.aspectRatio;return this.ready&&!this.disabled&&l1(t)&&(gn(t.left)&&(n.left=t.left),gn(t.top)&&(n.top=t.top),gn(t.width)?(n.width=t.width,n.height=t.width/i):gn(t.height)&&(n.height=t.height,n.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t=this.cropBoxData,n;return this.ready&&this.cropped&&(n={left:t.left,top:t.top,width:t.width,height:t.height}),n||{}},setCropBoxData:function(t){var n=this.cropBoxData,i=this.options.aspectRatio,r,a;return this.ready&&this.cropped&&!this.disabled&&l1(t)&&(gn(t.left)&&(n.left=t.left),gn(t.top)&&(n.top=t.top),gn(t.width)&&t.width!==n.width&&(r=!0,n.width=t.width),gn(t.height)&&t.height!==n.height&&(a=!0,n.height=t.height),i&&(r?n.height=n.width/i:a&&(n.width=n.height*i)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var n=this.canvasData,i=HGe(this.image,this.imageData,n,t);if(!this.cropped)return i;var r=this.getData(t.rounded),a=r.x,o=r.y,s=r.width,l=r.height,c=i.width/Math.floor(n.naturalWidth);c!==1&&(a*=c,o*=c,s*=c,l*=c);var u=s/l,h=ed({aspectRatio:u,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),g=ed({aspectRatio:u,width:t.minWidth||0,height:t.minHeight||0},"cover"),m=ed({aspectRatio:u,width:t.width||(c!==1?i.width:s),height:t.height||(c!==1?i.height:l)}),y=m.width,k=m.height;y=Math.min(h.width,Math.max(g.width,y)),k=Math.min(h.height,Math.max(g.height,k));var w=document.createElement("canvas"),_=w.getContext("2d");w.width=S1(y),w.height=S1(k),_.fillStyle=t.fillColor||"transparent",_.fillRect(0,0,y,k);var b=t.imageSmoothingEnabled,M=b===void 0?!0:b,C=t.imageSmoothingQuality;_.imageSmoothingEnabled=M,C&&(_.imageSmoothingQuality=C);var E=i.width,S=i.height,$=a,R=o,P,A,I,T,H,L;$<=-s||$>E?($=0,P=0,I=0,H=0):$<=0?(I=-$,$=0,P=Math.min(E,s+$),H=P):$<=E&&(I=0,P=Math.min(s,E-$),H=P),P<=0||R<=-l||R>S?(R=0,A=0,T=0,L=0):R<=0?(T=-R,R=0,A=Math.min(S,l+R),L=A):R<=S&&(T=0,A=Math.min(l,S-R),L=A);var G=[$,R,P,A];if(H>0&&L>0){var D=y/s;G.push(I*D,T*D,H*D,L*D)}return _.drawImage.apply(_,[i].concat(sV(G.map(function(B){return Math.floor(S1(B))})))),w},setAspectRatio:function(t){var n=this.options;return!this.disabled&&!i5(t)&&(n.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var n=this.options,i=this.dragBox,r=this.face;if(this.ready&&!this.disabled){var a=t===i7,o=n.movable&&t===uV;t=a||o?t:fV,n.dragMode=t,J2(i,Q2,t),c1(i,Q_,a),c1(i,J_,o),n.cropBoxMovable||(J2(r,Q2,t),c1(r,Q_,a),c1(r,J_,o))}return this}},JGe=cl.Cropper,bV=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(fGe(this,e),!t||!SGe.test(t.tagName))throw new Error("The first argument is required and must be an or element.");this.element=t,this.options=_i({},WA,l1(n)&&n),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return hGe(e,[{key:"init",value:function(){var n=this.element,i=n.tagName.toLowerCase(),r;if(!n[wi]){if(n[wi]=this,i==="img"){if(this.isImg=!0,r=n.getAttribute("src")||"",this.originalUrl=r,!r)return;r=n.src}else i==="canvas"&&window.HTMLCanvasElement&&(r=n.toDataURL());this.load(r)}}},{key:"load",value:function(n){var i=this;if(n){this.url=n,this.imageData={};var r=this.element,a=this.options;if(!a.rotatable&&!a.scalable&&(a.checkOrientation=!1),!a.checkOrientation||!window.ArrayBuffer){this.clone();return}if(MGe.test(n)){CGe.test(n)?this.read(VGe(n)):this.clone();return}var o=new XMLHttpRequest,s=this.clone.bind(this);this.reloading=!0,this.xhr=o,o.onabort=s,o.onerror=s,o.ontimeout=s,o.onprogress=function(){o.getResponseHeader("content-type")!==qA&&o.abort()},o.onload=function(){i.read(o.response)},o.onloadend=function(){i.reloading=!1,i.xhr=null},a.checkCrossOrigin&&GA(n)&&r.crossOrigin&&(n=KA(n)),o.open("GET",n,!0),o.responseType="arraybuffer",o.withCredentials=r.crossOrigin==="use-credentials",o.send()}}},{key:"read",value:function(n){var i=this.options,r=this.imageData,a=WGe(n),o=0,s=1,l=1;if(a>1){this.url=qGe(n,qA);var c=UGe(a);o=c.rotate,s=c.scaleX,l=c.scaleY}i.rotatable&&(r.rotate=o),i.scalable&&(r.scaleX=s,r.scaleY=l),this.clone()}},{key:"clone",value:function(){var n=this.element,i=this.url,r=n.crossOrigin,a=i;this.options.checkCrossOrigin&&GA(i)&&(r||(r="anonymous"),a=KA(i)),this.crossOrigin=r,this.crossOriginUrl=a;var o=document.createElement("img");r&&(o.crossOrigin=r),o.src=a||i,o.alt=n.alt||"The image to crop",this.image=o,o.onload=this.start.bind(this),o.onerror=this.stop.bind(this),mr(o,zA),n.parentNode.insertBefore(o,n.nextSibling)}},{key:"start",value:function(){var n=this,i=this.image;i.onload=null,i.onerror=null,this.sizing=!0;var r=cl.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(cl.navigator.userAgent),a=function(c,u){_i(n.imageData,{naturalWidth:c,naturalHeight:u,aspectRatio:c/u}),n.initialImageData=_i({},n.imageData),n.sizing=!1,n.sized=!0,n.build()};if(i.naturalWidth&&!r){a(i.naturalWidth,i.naturalHeight);return}var o=document.createElement("img"),s=document.body||document.documentElement;this.sizingImage=o,o.onload=function(){a(o.width,o.height),r||s.removeChild(o)},o.src=i.src,r||(o.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",s.appendChild(o))}},{key:"stop",value:function(){var n=this.image;n.onload=null,n.onerror=null,n.parentNode.removeChild(n),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var n=this.element,i=this.options,r=this.image,a=n.parentNode,o=document.createElement("div");o.innerHTML=EGe;var s=o.querySelector(".".concat(wi,"-container")),l=s.querySelector(".".concat(wi,"-canvas")),c=s.querySelector(".".concat(wi,"-drag-box")),u=s.querySelector(".".concat(wi,"-crop-box")),h=u.querySelector(".".concat(wi,"-face"));this.container=a,this.cropper=s,this.canvas=l,this.dragBox=c,this.cropBox=u,this.viewBox=s.querySelector(".".concat(wi,"-view-box")),this.face=h,l.appendChild(r),mr(n,ka),a.insertBefore(s,n.nextSibling),sl(r,zA),this.initPreview(),this.bind(),i.initialAspectRatio=Math.max(0,i.initialAspectRatio)||NaN,i.aspectRatio=Math.max(0,i.aspectRatio)||NaN,i.viewMode=Math.max(0,Math.min(3,Math.round(i.viewMode)))||0,mr(u,ka),i.guides||mr(u.getElementsByClassName("".concat(wi,"-dashed")),ka),i.center||mr(u.getElementsByClassName("".concat(wi,"-center")),ka),i.background&&mr(s,"".concat(wi,"-bg")),i.highlight||mr(h,kGe),i.cropBoxMovable&&(mr(h,J_),J2(h,Q2,n7)),i.cropBoxResizable||(mr(u.getElementsByClassName("".concat(wi,"-line")),ka),mr(u.getElementsByClassName("".concat(wi,"-point")),ka)),this.render(),this.ready=!0,this.setDragMode(i.dragMode),i.autoCrop&&this.crop(),this.setData(i.data),ya(i.ready)&&So(n,NA,i.ready,{once:!0}),E1(n,NA)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var n=this.cropper.parentNode;n&&n.removeChild(this.cropper),sl(this.element,ka)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=JGe,e}},{key:"setDefaults",value:function(n){_i(WA,l1(n)&&n)}}])}();_i(bV.prototype,GGe,KGe,XGe,ZGe,YGe,QGe);var iu=function(){return iu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0&&R.zoomTo(B)}($.currentTarget.cropper,M),w&&w($)}}));_&&_(S)}return function(){var $,R;(R=($=C.current)===null||$===void 0?void 0:$.cropper)===null||R===void 0||R.destroy()}},[C]);var E=function(S){return eKe.reduce(function($,R){var P=$,A=R;return P[A],a5(P,[typeof A=="symbol"?A:A+""])},S)}(iu(iu({},b),{crossOrigin:l,src:a,alt:k}));return Y.createElement("div",{style:o,className:s},Y.createElement("img",iu({},E,{style:tKe,ref:C})))});const iKe=Ar(()=>{const e=f.useRef(null),[t,n]=f.useState(!1),i=()=>{n(!0)},r=()=>{var o,s;if(typeof((o=e.current)==null?void 0:o.cropper)<"u"){const l=(s=e.current)==null?void 0:s.cropper.getCroppedCanvas();if(l){const{width:c,height:u}=l,h=l.toDataURL();if(ie.editor.setImg(Object.assign({},ie.editor.img,{src:h,width:c,height:u})),ie.option.size.type==="auto"){const g=Vk(c,u);ie.option.setFrameSize(c+g,u+g)}}}n(!1)},a=()=>{n(!1)};return N.jsxs(N.Fragment,{children:[N.jsx(_a,{title:"Crop Image",children:N.jsx(an,{type:"text",shape:"circle",icon:N.jsx(Cn.Crop,{size:18}),onClick:i})}),N.jsx(js,{title:"Cropper",open:t,onOk:r,onCancel:a,destroyOnClose:!0,children:N.jsx(nKe,{ref:e,style:{height:400,width:"100%"},zoomTo:.5,initialAspectRatio:ie.editor.img.width/ie.editor.img.height,src:ie.editor.img.src,dragMode:"move",viewMode:1,minCropBoxHeight:10,minCropBoxWidth:10,background:!1,responsive:!0,autoCropArea:1,checkOrientation:!1,guides:!0})})]})}),rKe=["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"],aKe=Ar(()=>{const[e,t]=f.useState(!1),n=a=>{t(a)},i=a=>{ie.option.setAlign(a)},r=N.jsx("div",{className:No("flex flex-wrap w-24 position-block",ie.option.align),children:rKe.map(a=>N.jsx("div",{className:"w-8 h-8 border border-[var(--c-br)] rounded-sm hover:bg-[var(--c-wb)] cursor-pointer",onClick:()=>i(a)},a))});return N.jsx(Fu,{content:r,trigger:"click",arrow:!1,placement:"bottomRight",overlayClassName:No("shoteasy-components",ie.editor.isDark&&"dark-mode"),open:e,onOpenChange:n,children:N.jsx(an,{type:"text",shape:"circle",className:No(e&&"shadow-md"),icon:N.jsx(Cn.LayoutGrid,{size:18})})})}),oKe=Ar(()=>{const[e,t]=f.useState(!1),[n,i]=f.useState("Watermark"),[r,a]=f.useState("#00000030"),[o,s]=f.useState(45),l=c=>{a(typeof c=="string"?c:c.toRgbString())};return f.useEffect(()=>{if(e&&n.trim()){const c=kze({text:n,color:r,angleDegrees:o});ie.option.setWaterImg(c)}else ie.option.setWaterImg(null)},[e,n,r,o]),N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm flex gap-4 items-center justify-between",children:[N.jsx("label",{children:"Watermark"}),N.jsx(a_,{defaultChecked:e,onChange:t,size:"small",className:"bg-slate-200"})]}),e&&N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-xs grid gap-3 pl-2 pt-2",children:[N.jsx(Vu,{defaultValue:n,placeholder:"Watermark content",onChange:c=>i(c.target.value)}),N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsx("label",{children:"Color"}),N.jsx(Fk,{value:r,onChange:l,size:"small"})]}),N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsx("label",{children:"Direction"}),N.jsx("div",{children:N.jsxs(Tn.Group,{defaultValue:o,onChange:c=>s(c.target.value),size:"small",children:[N.jsx(Tn.Button,{value:-45,children:N.jsx(Cn.ArrowUpRight,{size:16,className:"mt-[3px]"})}),N.jsx(Tn.Button,{value:45,children:N.jsx(Cn.ArrowDownRight,{size:16,className:"mt-[3px]"})})]})})]}),N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsx("label",{children:"Only Background"}),N.jsx(a_,{size:"small",onChange:c=>ie.option.setWaterIndex(c?-1:1),className:"bg-slate-200"})]})]})]})});function sKe(e,t,n){const i=f.useRef(e),r=f.useRef(t);f.useEffect(()=>{i.current=e,r.current=t},[...n]),f.useEffect(()=>{const a=rV(window,{"$mod+KeyS":o=>{o.preventDefault(),i.current&&i.current()},"$mod+KeyC":o=>{o.preventDefault(),r&&r.current()}});return()=>{a()}},[window])}const lKe=Ar(()=>{var m;const[e,t]=f.useState(!1),[n,i]=f.useState(!1),[r,a]=f.useState("png"),[o,s]=f.useState(1),l=y=>{i(y)},c=async()=>{if(!ie.editor.isEditing||e)return;const y={pixelRatio:o};["jpg","webp"].includes(r)&&(y.quality=.9,y.fill="#ffffff");const k=ky();t(!0),ie.editor.message.open({key:k,type:"loading",content:"Downloading..."}),await ie.editor.app.tree.export(r,y).then(w=>{let _=`Image_${Date.now()}`;o>1&&(_+=`@${o}`),window.imageCompression?imageCompression.getFilefromDataUrl(w.data,`image.${r}`).then(b=>{imageCompression(b,{initialQuality:.5,maxWidthOrHeight:2e3,useWebWorker:!1}).then(M=>{imageCompression.getDataUrlFromFile(M).then(C=>{HO(C,`${_}.${r}`),ie.editor.message.open({key:k,type:"success",content:"Download Success!"})})})}):(HO(w.data,`${_}.${r}`),ie.editor.message.open({key:k,type:"success",content:"Download Success!"}))}).catch(()=>{ie.editor.message.open({key:k,type:"error",content:"Download failed!"})}),t(!1)},u=async()=>{if(!ie.editor.isEditing||e)return;const y=ky();t(!0),ie.editor.message.open({key:y,type:"loading",content:"Copying..."}),await ie.editor.app.tree.export("png",{blob:!0,pixelRatio:o}).then(async k=>{const{data:w}=k;await navigator.clipboard.write([new ClipboardItem({[w.type]:w})]),ie.editor.message.open({key:y,type:"success",content:"Copy Success!"})}).catch(()=>{ie.editor.message.open({key:y,type:"error",content:"Copy failed!"})}),t(!1)},h=()=>{ie.editor.destroy(),ie.editor.clearImg(),ie.editor.clearFun&&ie.editor.clearFun()};sKe(()=>c(),()=>u(),[c,u]);const g=N.jsx("div",{children:N.jsxs("div",{className:"p-2 [&_.ant-segmented]:w-full [&_.ant-segmented-item]:w-[33%]",children:[N.jsx("div",{className:"text-xs text-gray-400 mb-2",children:"Format"}),N.jsx(t_,{options:["png","jpg","webp"],size:"middle",onChange:a}),N.jsx("div",{className:"text-xs text-gray-400 mt-2 mb-2",children:"Pixel Ratio"}),N.jsx(t_,{options:[{value:1,icon:"1x"},{value:2,icon:"2x"},{value:3,icon:"3x"}],size:"middle",onChange:s}),ie.option.frameConf.width&&N.jsxs("div",{className:"text-xs p-3 mt-4 flex justify-between bg-black/5 rounded-md",children:[N.jsx("span",{className:"text-gray-400",children:"Download Size"}),N.jsxs("span",{className:"text-gray-700",children:[ie.option.frameConf.width*o," x ",ie.option.frameConf.height*o]})]})]})});return N.jsxs("div",{className:"shrink-0 py-4 px-6 flex gap-2 justify-center items-center",children:[N.jsx(Ko,{theme:{components:{Button:{colorPrimary:ie.editor.isDark?"#2b4acb":"#000",algorithm:!0}}},children:N.jsxs("div",{className:"ant-space-compact flex flex-1",children:[N.jsx(_a,{placement:"top",title:N.jsxs("span",{children:["Download ",DO," + S"]}),children:N.jsx(an,{type:"primary",size:"large",loading:e,icon:N.jsx(Cn.ImageDown,{size:18}),className:"rounded-se-none flex-1 rounded-ee-none me-[-1px] hover:z-[1] border-r-white/30",onClick:c,children:N.jsxs("div",{className:"leading-4 px-2",children:[N.jsx("div",{className:"text-sm leading-4 font-semibold",children:"Download"}),N.jsxs("div",{className:"text-xs",children:[o,"x as ",r.toLocaleUpperCase()]})]})})}),N.jsx(_a,{placement:"top",title:N.jsxs("span",{children:["Copy ",DO," + C"]}),children:N.jsx(an,{type:"primary",size:"large",icon:N.jsx(Cn.Copy,{size:18}),loading:e,className:"rounded-ss-none rounded-es-none border-l-white/30",onClick:u})})]})}),N.jsxs("div",{className:"flex items-center gap-1",children:[N.jsx(Fu,{content:g,trigger:"click",arrow:!1,placement:"topRight",open:n,overlayStyle:{width:"320px"},onOpenChange:l,children:N.jsx(an,{size:"large",icon:N.jsx(Cn.Settings2,{size:18})})}),((m=ie.editor.img)==null?void 0:m.src)&&N.jsx(mD,{title:"Delete the screenshot",description:"Are you sure to delete this screenshot?",placement:"topRight",onConfirm:h,okText:"Yes",cancelText:"No",children:N.jsx(an,{size:"large",icon:N.jsx(Cn.Trash2,{size:18})})})]})]})}),cKe="data:image/svg+xml,%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%3e%3cpath%20d='M311.296%20428.544V40.96C186.368%2094.208%2087.552%20195.072%2036.864%20321.024l274.432%20274.432V428.544z'%20fill='%2337C15C'%3e%3c/path%3e%3cpath%20d='M428.544%20311.296l274.432-274.432C642.048%2012.288%20577.536%200%20512%200%20440.832%200%20372.736%2014.848%20311.296%2040.96v387.584l117.248-117.248z'%20fill='%23A9E247'%3e%3c/path%3e%3cpath%20d='M983.04%20311.296h-387.584l117.248%20117.248%20274.432%20274.432c24.576-60.416%2036.864-125.44%2036.864-190.976%200-71.168-14.848-139.264-40.96-200.704z'%20fill='%23FF7D12'%3e%3c/path%3e%3cpath%20d='M712.704%20595.456V983.04c124.928-53.248%20223.744-154.112%20274.432-280.064l-274.432-274.432v166.912z'%20fill='%23F93B21'%3e%3c/path%3e%3cpath%20d='M595.456%20712.704l-274.432%20274.432c60.928%2024.576%20125.44%2036.864%20190.976%2036.864%2071.168%200%20139.264-14.848%20200.704-40.96v-387.584l-117.248%20117.248z'%20fill='%23846FEF'%3e%3c/path%3e%3cpath%20d='M428.544%20712.704H40.96c53.248%20124.928%20154.112%20223.744%20280.064%20274.432l274.432-274.432H428.544z'%20fill='%231E95FF'%3e%3c/path%3e%3cpath%20d='M311.296%20595.456L36.864%20321.024C12.288%20381.952%200%20446.464%200%20512c0%2071.168%2014.848%20139.264%2040.96%20200.704h387.584l-117.248-117.248z'%20fill='%2314EFEF'%3e%3c/path%3e%3cpath%20d='M595.456%20311.296H983.04c-53.248-124.928-154.112-223.744-280.064-274.432L428.544%20311.296h166.912z'%20fill='%23FFC931'%3e%3c/path%3e%3c/svg%3e",XA=["cosmic","desktop"],Dg=({type:e,options:t,onChange:n,value:i})=>{let r=[];if(t&&t.length)r=t;else{const a=[];Object.keys(w1).map(o=>{o.includes(e)&&a.push({key:o,value:w1[o]})}),r=a}return N.jsx(Tn.Group,{onChange:a=>n(a.target.value),value:i,rootClassName:No("grid [&_span]:ps-0",XA.includes(e)?"grid-cols-5 gap-y-1.5":"grid-cols-7 gap-y-3"),children:r.map((a,o)=>N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:p-0 mr-0",value:a.key,children:XA.includes(e)?N.jsx("div",{className:No("w-12 h-8 rounded-md overflow-hidden"),children:N.jsx("img",{src:`${a.value.class}&w=48`,className:"w-full h-full object-cover object-center"})}):N.jsx("div",{className:No("w-8 h-8 rounded-full overflow-hidden",a.value.class)})},o))})},dKe=Ar(({showMore:e,onChange:t})=>{const n=()=>{t(!1)},i=a=>{const o=a.toHexString();ie.option.frameConf.background={type:"solid",color:o}},r=a=>{ie.option.setBackground(a)};return N.jsx(c9,{title:"",placement:"right",closable:!1,mask:!1,onClose:n,open:e,getContainer:!1,width:"100%",className:"[&_.ant-drawer-body]:p-0",children:N.jsxs("div",{className:"flex flex-col gap-2 h-full overflow-hidden",children:[N.jsx("div",{className:"shrink-0 pt-4 px-4",children:N.jsx(an,{type:"text",size:"small",className:"text-xs flex items-center opacity-80 m-0",icon:N.jsx(Cn.ChevronRight,{size:16}),iconPosition:"end",onClick:()=>t(!1),children:"Back"})}),N.jsxs("div",{className:"h-0 flex-1 overflow-y-auto px-4 py-2",children:[N.jsx("h4",{className:"text-sm font-bold py-2",children:"Custom"}),N.jsx("div",{className:"py-1",children:N.jsx(Fk,{onChange:i,children:N.jsx(an,{type:"default",size:"small",shape:"circle",icon:N.jsx("img",{src:cKe,width:18})})})}),N.jsx("h4",{className:"text-sm font-bold py-2",children:"Solid Colors"}),N.jsx(Dg,{type:"solid",onChange:r,value:ie.option.background}),N.jsx("h4",{className:"text-sm font-bold py-2",children:"Gradients"}),N.jsx(Dg,{type:"gradient",onChange:r,value:ie.option.background}),N.jsx("h4",{className:"text-sm font-bold py-2",children:"Cosmic Gradients"}),N.jsx(Dg,{type:"cosmic",onChange:r,value:ie.option.background}),N.jsx("h4",{className:"text-sm font-bold py-2",children:"Desktop"}),N.jsx(Dg,{type:"desktop",onChange:r,value:ie.option.background})]})]})})}),uKe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABLCAMAAACxxtKFAAAAYFBMVEVHcEyqqqoGBgjm5uW0tbZeXl9wcHKDhIUmJiYAAAAmJycUFBQiAywSBB9LBDY1AzNiBTZERUV8AjaNjo60s7GbCSj4HgjW1df8q1X/bh9nbWudn5/KBA++YlL83Z9i8PL4oNrpAAAACnRSTlMABv//KalYmwEECNoBKQAAAuhJREFUWMPt2NtypCAQBuAEJ5mMKCfFA6OT93/LbUAFPMwq1lbthX/lwspEv3Q3GOPHx5UrV6788/ycyk6D4zdBCL37GPN9yh3Z5HnGOqWPcGpjDUhGKSWEMFYl8xT3owiRrTl0CMbwbcimUh5GqKj4HMEGsQpbKscR6FezUkruKaI9g+S56VeFl6UEDeubeCQ3CGVd6ZVil1c+UyKRfEhGoZQFgsKGhWPZjeQTkhFRPb1VbBU3FlOK6COQ3EOgX+1qKb5SnUH0ZaBfaoGMyspYjiLmdyXCX8UzZBxLF4FkXiiT3obE60p/DqG6XxuluIYJdRYRXYsXSFgKJ2cR6Fc5reIJCRTOzyD6CswvxSHeCqNclfEINc0QXVX4/fKQQVElP4r4hFk8MHq/FITmDesTHIFQF2L6xTcQq7AIhAaGRtwqxisK719cnUCIuW3Iqk1XkFGRzesXRyOEDEg3reIAsWNRsmmSOIRMYbpf4704RLSCcdU2CVLHEO/61mAC+vV0/QoQLOHD5qXwCYQxg7jRhwjCPTLIbzzC2IS0ag0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P12hNqHaMgkKTImNC9jRNk3EODBKD9FMhLS9GUTuWGlAKMSc71N305uYIWSSW8N4wp/YyT4OjBRCkyHjhumtj7MZpYMSMBowI6V07D3byB4pPTMimg17txA8UHuQsDMwRaXGsEcNIXoKnba0ngeSsI1799PSLQoOIExB0a+Uifd63WSnOESHFILoeZWlh3yejMJ0gXmCYkm7HUpXCg0h1abhSsvWoE8UDMvMSj2Y0Skp+SEa9W5aVOFaaUWDBEDqEa0a3MAdka1LFERD8/zDuiupnopOHq1iR8vLJEAG/YIYL2TVeEi4hOJEkZv07kKQMxYibQIXsGi7Ju/kQUEjBsZ0g79UYxxXmyU4MIikRyLzqFcYc9QaRlKiRVRh6guFPLgR5R0qMIcLckl6hNiOKS6PlFGH3pJwSXMgwAh/LOL/AqIl5EqmRN4aeX2uIRMjjnWSkakLAwB6Rn9nJmCFC+jvGMm6vtWYkifhNa8P/G7GahuZUSmUm/oyka129Y+Qu5caEoLDcexuLw4KRaBFzcq4fGWveGy6LxByQj9+8xupAFBsAmiYiJLz5cO16bUfbUCFuMJZ0vemwLDl5nTFEyKqxWsoNiDErraSZEGUIwmzEMcbAJkIQrHC7aaRkeSVbXvO6cCHNEFs+bhbxAYNMSDOEHnh15HwmQ+IoKVnzaRwTNiuJEDlT8zBx3BJ0iDa4ugjjgpz5kO341hDG2TUQxOr68RrHMa+no11EOFe0QWlPtpfsVjFgp+NswqLHJxMfn9M63tQOhIYLFUx8Sf8x3oN/V+W+1p9e/tTpS1/6T/QTZi2BJxZ/18MAAAAASUVORK5CYII=",gKe=Ar(()=>{const[e,t]=f.useState(!1),n=i=>{const{value:r}=i.target;ie.option.setFrame(r),r==="macbookpro16"&&ie.option.setPaddingBg("#000000")};return N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm",children:[N.jsxs("div",{className:"flex justify-between items-center",children:[N.jsx("label",{children:"Frame"}),N.jsxs(an,{type:"text",size:"small",className:"text-xs flex items-center opacity-80 m-0",onClick:()=>t(!0),children:["More ",N.jsx(Cn.ChevronRight,{size:16})]})]}),N.jsx("div",{className:"py-3 [&_.ant-radio-wrapper_span]:p-0 [&_.ant-radio-wrapper_span]:px-1",children:N.jsxs(Tn.Group,{rootClassName:"grid grid-cols-5",onChange:n,value:ie.option.frame,children:[N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"none",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-8 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 h-7 w-[85%] rounded-md shadow-md -mt-1 -ml-1"})})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"light",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-8 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 border-2 border-white/80 h-7 w-[85%] rounded-md shadow-md -mt-1 -ml-1"})})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"dark",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-8 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 border-2 border-black/40 h-7 w-[85%] rounded-md shadow-md -mt-1 -ml-1"})})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"macosBarLight",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-8 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 h-7 w-[85%] rounded-sm shadow-md mt-2 ml-3 overflow-hidden",children:N.jsx("div",{className:"h-1.5 bg-white/90 px-0.5 flex items-center gap-[1px] before:block before:rounded-full before:w-0.5 before:h-0.5 before:bg-red-500 after:w-0.5 after:h-0.5 after:bg-green-500",children:N.jsx("i",{className:"block w-0.5 h-0.5 bg-yellow-500"})})})})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"macosBarDark",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-8 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 h-7 w-[85%] rounded-sm shadow-md mt-2 ml-3 overflow-hidden",children:N.jsx("div",{className:"h-1.5 bg-black/90 px-0.5 flex items-center gap-[1px] before:block before:rounded-full before:w-0.5 before:h-0.5 before:bg-red-500 after:w-0.5 after:h-0.5 after:bg-green-500",children:N.jsx("i",{className:"block w-0.5 h-0.5 bg-yellow-500"})})})})})]})})]}),N.jsx(c9,{title:"",placement:"right",closable:!1,mask:!1,onClose:t,open:e,getContainer:!1,width:"100%",className:"[&_.ant-drawer-body]:p-0",children:N.jsxs("div",{className:"flex flex-col gap-2 h-full overflow-hidden",children:[N.jsx("div",{className:"shrink-0 pt-4 px-4",children:N.jsx(an,{type:"text",size:"small",className:"text-xs flex items-center opacity-80 m-0",icon:N.jsx(Cn.ChevronRight,{size:16}),iconPosition:"end",onClick:()=>t(!1),children:"Back"})}),N.jsxs("div",{className:"h-0 flex-1 overflow-y-auto px-4 py-2",children:[N.jsx("h4",{className:"text-sm font-bold py-2",children:"Browser"}),N.jsx("div",{className:"py-3 [&_.ant-radio-wrapper_span]:p-0 [&_.ant-radio-wrapper_span]:px-1",children:N.jsxs(Tn.Group,{rootClassName:"grid grid-cols-3",onChange:n,value:ie.option.frame,children:[N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"windowsBarLight",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 h-12 w-[85%] rounded-sm shadow-md mt-2 ml-3 overflow-hidden",children:N.jsx("div",{className:"bg-white/90 px-0.5",children:N.jsx("div",{className:"h-2.5 bg-no-repeat bg-[right_center] bg-[auto_100%]",style:{backgroundImage:`url(${WF})`}})})})})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"windowsBarDark",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 h-12 w-[85%] rounded-sm shadow-md mt-2 ml-3 overflow-hidden",children:N.jsx("div",{className:"bg-black/90 px-0.5",children:N.jsx("div",{className:"h-2.5 bg-no-repeat bg-[right_center] bg-[auto_100%]",style:{backgroundImage:`url(${qF})`}})})})})})]})}),N.jsxs("div",{className:"flex justify-between items-center py-2",children:[N.jsx("h4",{className:"text-sm font-bold",children:"Devices"}),N.jsxs(Tn.Group,{value:ie.option.frameMode,onChange:i=>ie.option.setFrameMode(i.target.value),size:"small",children:[N.jsx(Tn.Button,{value:"cover",children:"Cover"}),N.jsx(Tn.Button,{value:"fit",children:"Contain"}),N.jsx(Tn.Button,{value:"strench",children:"Stretch"})]})]}),N.jsx("div",{className:"py-3 [&_.ant-radio-wrapper_span]:p-0 [&_.ant-radio-wrapper_span]:px-1",children:N.jsxs(Tn.Group,{rootClassName:"grid grid-cols-3",onChange:n,value:ie.option.frame,children:[N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"macbookpro16",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden bg-no-repeat bg-[10px_-5px] bg-[100px_auto]",style:{backgroundImage:`url(${uKe})`}})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"macbookair",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden bg-no-repeat bg-[13px_-6px] bg-[92px_auto]",style:{backgroundImage:`url(${fKe})`}})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"imacpro",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden bg-no-repeat bg-[13px_top] bg-[90px_auto]",style:{backgroundImage:`url(${hKe})`}})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"ipadpro",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden bg-no-repeat bg-[center_top] bg-[100px_auto]",style:{backgroundImage:`url(${pKe})`}})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"iphonepro",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden bg-no-repeat bg-[center_top] bg-[100px_auto]",style:{backgroundImage:`url(${vKe})`}})})]})})]})]})})]})}),mKe=Ar(()=>{const[e,t]=f.useState(!1),n=i=>{const r=i.target.value;ie.option.setBackground(r)};return N.jsxs("div",{className:"bg-white dark:bg-black flex flex-col md:w-[340px] border-l border-l-gray-50 dark:border-l-gray-700 dark:text-gray-400 shadow-lg relative z-10 select-none",children:[N.jsxs("div",{className:"flex-1 flex-col gap-2 p-4 overflow-y-auto overflow-x-hidden",children:[N.jsx(dGe,{}),N.jsxs("div",{className:"[&_label]:font-semibold pt-2 [&_label]:text-sm",children:[N.jsx("label",{children:"Quick"}),N.jsxs("div",{className:"flex gap-4 items-center py-2",children:[N.jsx(iKe,{}),N.jsx(an,{type:"text",shape:"circle",onClick:()=>ie.option.toggleFlip("x"),icon:N.jsx(Cn.FlipHorizontal2,{size:18})}),N.jsx(an,{type:"text",shape:"circle",onClick:()=>ie.option.toggleFlip("y"),icon:N.jsx(Cn.FlipVertical2,{size:18})}),N.jsx(aKe,{})]})]}),N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm",children:[N.jsx("label",{children:"Scale"}),N.jsx(B0,{min:.1,max:3,step:.1,onChange:i=>ie.option.setScale(i),value:typeof ie.option.scale=="number"?ie.option.scale:1})]}),N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm",children:[N.jsxs("div",{className:"flex justify-between",children:[N.jsx("label",{children:"Padding"}),N.jsx(Fk,{value:ie.option.paddingBg,onChange:i=>ie.option.setPaddingBg(i.toRgbString()),size:"small"})]}),N.jsx(B0,{min:0,max:60,onChange:i=>ie.option.setPadding(i),value:typeof ie.option.padding=="number"?ie.option.padding:0})]}),N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm",children:[N.jsx("label",{children:"Rounded"}),N.jsx(B0,{min:0,max:20,onChange:i=>ie.option.setRound(i),value:typeof ie.option.round=="number"?ie.option.round:0})]}),N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm",children:[N.jsx("label",{children:"Shadow"}),N.jsx(B0,{min:0,max:6,onChange:i=>ie.option.setShadow(i),value:typeof ie.option.shadow=="number"?ie.option.shadow:0})]}),N.jsx(gKe,{}),N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm",children:[N.jsxs("div",{className:"flex justify-between items-center",children:[N.jsx("label",{children:"Background"}),N.jsxs(an,{type:"text",size:"small",className:"text-xs flex items-center opacity-80 m-0",onClick:()=>t(!0),children:["More ",N.jsx(Cn.ChevronRight,{size:16})]})]}),N.jsx("div",{className:"py-3",children:N.jsxs(Tn.Group,{onChange:n,value:ie.option.background,rootClassName:"grid grid-cols-7 [&_span]:ps-0",children:[N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:p-0 mr-0",value:"default_1",children:N.jsx("div",{className:No("w-8 h-8 rounded-full",w1.default_1.class)})}),Object.keys(w1).map(i=>{if(i.includes("default")&&i!=="default_1")return N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:p-0 mr-0",value:i,children:N.jsx("div",{className:No("w-8 h-8 rounded-full",w1[i].class)})},i)})]})})]}),N.jsx(oKe,{})]}),N.jsx(lKe,{}),N.jsx(dKe,{showMore:e,onChange:t})]})}),yKe=(e,t=[])=>{f.useEffect(()=>{const n=async i=>{const r=i.clipboardData;if(!r||!r.items)return;const a=Array.from(r.items).filter(s=>fN.includes(s.type));if(!a.length)return;const o=a[0].getAsFile();e&&e(o)};return document.addEventListener("paste",n,!1),()=>{document.removeEventListener("paste",n)}},[...t])},wV=e=>async(n,i="blob")=>{const r=window.URL||window.webkitURL||window,a=i==="blob"?r.createObjectURL(n):n,o=await gze(a),s=Math.round(o.width),l=Math.round(o.height);if(e.editor.setImg({src:a,width:s,height:l,type:i==="blob"?n.type:"image/png",name:i==="blob"?n.name:`Image_${Date.now()}.png`}),e.option.size.type==="auto"){const c=Vk(s,l);e.option.setFrameSize(s+c,l+c)}},kKe=async()=>{try{const e=await navigator.mediaDevices.getDisplayMedia(),t=document.createElement("video");t.srcObject=e,t.play(),await new Promise(a=>t.onplaying=a);const n=document.createElement("canvas");n.width=t.videoWidth,n.height=t.videoHeight,n.getContext("2d").drawImage(t,0,0);const r=n.toDataURL("image/png");return t.srcObject.getTracks().forEach(a=>a.stop()),r}catch(e){console.log("Error capturing screen:",e)}},ZA=""+new URL("demo-CN-KDTod.png",import.meta.url).href,{Dragger:bKe}=u9,wKe=Ar(()=>{const e=wV(ie),t=async a=>(await e(a),Promise.reject()),n=async()=>{const a=await kKe();a&&e(a,"dataURL")},i=()=>{ie.editor.message.info("Developing, Coming soon!")},r=()=>{e(ZA,"dataURL")};return yKe(a=>{e(a)}),N.jsx("div",{className:"md:w-0 md:flex-1 flex flex-col justify-center items-center overflow-hidden select-none relative",children:N.jsxs("div",{className:No("max-w-[600px]",ie.editor.invalid&&"invalid"),children:[N.jsx(bKe,{accept:fN.join(","),name:"file",showUploadList:!1,beforeUpload:t,rootClassName:"p-4 rounded-md bg-white dark:bg-black dark:text-gray-400 block shadow-sm",children:N.jsxs("div",{className:"text-center p-10",children:[N.jsx("p",{className:"text-2xl my-2 opacity-60",children:N.jsx(Cn.ImagePlus,{className:"mx-auto",size:36})}),N.jsxs("p",{className:"text-sm px-4",children:["Click or Drag image to this area",N.jsx("br",{}),"or Paste image"]})]})}),N.jsxs("div",{className:"flex justify-between mt-2 py-4 px-6 rounded-md bg-white dark:bg-black shadow-sm",children:[N.jsx(_a,{placement:"top",arrow:!1,title:"Take a screenshot of desktop windows",children:N.jsx(an,{shape:"round",type:"default",size:"large",icon:N.jsx(Cn.Camera,{size:20}),onClick:n})}),N.jsx(_a,{placement:"top",arrow:!1,title:"Beautify text",children:N.jsx(an,{shape:"round",type:"default",size:"large",icon:N.jsx(Cn.Type,{size:20}),onClick:i})}),N.jsx(_a,{placement:"top",arrow:!1,title:"Beautify Code",children:N.jsx(an,{shape:"round",type:"default",size:"large",icon:N.jsx(Cn.CodeXml,{size:20,onClick:i})})}),N.jsx(_a,{placement:"top",arrow:!1,title:"Create gif animate",children:N.jsx(an,{shape:"round",type:"default",size:"large",icon:N.jsx(Cn.ImagePlay,{size:20,onClick:i})})})]}),N.jsxs("button",{className:"w-full mt-1 rounded-md bg-white dark:bg-black border border-dotted dark:border-gray-700 shadow-sm flex justify-between items-center p-1 hover:bg-slate-50 dark:hover:bg-gray-900 hover:px-1.5",onClick:r,children:[N.jsx("div",{className:"overflow-hidden rounded-sm w-8",children:N.jsx("img",{src:ZA,className:"w-full"})}),N.jsx("div",{className:"text-xs text-gray-500",children:"Give it a try ✨"})]})]})})});let YA=!1;const _Ke=Ar(({defaultImg:e,headLeft:t,headRight:n,isDark:i,boxClassName:r="",onClear:a})=>{var u;const o=wV(ie),s=(u=ie.editor.img)!=null&&u.src?N.jsx(sGe,{}):N.jsx(wKe,{}),[l,c]=hD.useMessage();return ie.editor.setMessage(l),ie.editor.setClearFun(a),f.useMemo(()=>{const h=i||localStorage.getItem("SHOTEASY_BEAUTIFIER_THEME")==="dark"?"dark":"light";ie.editor.setTheme(h)},[i]),f.useEffect(()=>{e&&o(e,"dataURL")},[e]),YA||(YA=!0,window.__thirdParty=window.__thirdParty||{},window.__thirdParty.events=window.__thirdParty.events||{},window.__thirdParty.events.doSetImage=function(h,g,m){o(m,"base64"),h("ok")},postMessage({payload:"removeLoading"},"*")),N.jsx(OJ,{children:N.jsxs(Ko,{theme:{algorithm:ie.editor.isDark?hO.darkAlgorithm:hO.defaultAlgorithm},children:[c,N.jsxs("div",{id:"shoteasy-container",className:No("polka flex flex-col overflow-hidden antialiased w-full h-[100vh] dark:bg-black",r),"data-mode":ie.editor.isDark?"dark":"light",children:[N.jsx(wLe,{headLeft:t,headRight:n}),N.jsxs("div",{className:"flex flex-col flex-1 h-0 md:flex-row md:items-stretch",children:[s,N.jsx(mKe,{})]})]})]})})});o5.createRoot(document.getElementById("root")).render(N.jsx(Y.StrictMode,{children:N.jsx(_Ke,{})})); +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var nb=typeof window<"u"&&typeof window.document<"u",cl=nb?window:{},e7=nb&&cl.document.documentElement?"ontouchstart"in cl.document.documentElement:!1,t7=nb?"PointerEvent"in cl:!1,wi="cropper",n7="all",lV="crop",cV="move",dV="zoom",Gd="e",Kd="w",Bf="s",Lc="n",E0="ne",$0="nw",O0="se",R0="sw",Q_="".concat(wi,"-crop"),jA="".concat(wi,"-disabled"),ka="".concat(wi,"-hidden"),zA="".concat(wi,"-hide"),kGe="".concat(wi,"-invisible"),jy="".concat(wi,"-modal"),J_="".concat(wi,"-move"),Q2="".concat(wi,"Action"),Lg="".concat(wi,"Preview"),i7="crop",uV="move",fV="none",ex="crop",tx="cropend",nx="cropmove",ix="cropstart",LA="dblclick",bGe=e7?"touchstart":"mousedown",wGe=e7?"touchmove":"mousemove",_Ge=e7?"touchend touchcancel":"mouseup",BA=t7?"pointerdown":bGe,DA=t7?"pointermove":wGe,HA=t7?"pointerup pointercancel":_Ge,NA="ready",FA="resize",VA="wheel",rx="zoom",qA="image/jpeg",xGe=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,MGe=/^data:/,CGe=/^data:image\/jpeg;base64,/,SGe=/^img|canvas$/i,hV=200,pV=100,WA={viewMode:0,dragMode:i7,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:hV,minContainerHeight:pV,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},EGe='
',$Ge=Number.isNaN||cl.isNaN;function gn(e){return typeof e=="number"&&!$Ge(e)}var UA=function(t){return t>0&&t<1/0};function i5(e){return typeof e>"u"}function Lu(e){return Z_(e)==="object"&&e!==null}var OGe=Object.prototype.hasOwnProperty;function l1(e){if(!Lu(e))return!1;try{var t=e.constructor,n=t.prototype;return t&&n&&OGe.call(n,"isPrototypeOf")}catch{return!1}}function ya(e){return typeof e=="function"}var RGe=Array.prototype.slice;function vV(e){return Array.from?Array.from(e):RGe.call(e)}function tr(e,t){return e&&ya(t)&&(Array.isArray(e)||gn(e.length)?vV(e).forEach(function(n,i){t.call(e,n,i,e)}):Lu(e)&&Object.keys(e).forEach(function(n){t.call(e,e[n],n,e)})),e}var _i=Object.assign||function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r0&&i.forEach(function(a){Lu(a)&&Object.keys(a).forEach(function(o){t[o]=a[o]})}),t},PGe=/\.\d*(?:0|9){12}\d*$/;function S1(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return PGe.test(e)?Math.round(e*t)/t:e}var AGe=/^width|height|left|top|marginLeft|marginTop$/;function Jc(e,t){var n=e.style;tr(t,function(i,r){AGe.test(r)&&gn(i)&&(i="".concat(i,"px")),n[r]=i})}function IGe(e,t){return e.classList?e.classList.contains(t):e.className.indexOf(t)>-1}function mr(e,t){if(t){if(gn(e.length)){tr(e,function(i){mr(i,t)});return}if(e.classList){e.classList.add(t);return}var n=e.className.trim();n?n.indexOf(t)<0&&(e.className="".concat(n," ").concat(t)):e.className=t}}function sl(e,t){if(t){if(gn(e.length)){tr(e,function(n){sl(n,t)});return}if(e.classList){e.classList.remove(t);return}e.className.indexOf(t)>=0&&(e.className=e.className.replace(t,""))}}function c1(e,t,n){if(t){if(gn(e.length)){tr(e,function(i){c1(i,t,n)});return}n?mr(e,t):sl(e,t)}}var TGe=/([a-z\d])([A-Z])/g;function r7(e){return e.replace(TGe,"$1-$2").toLowerCase()}function ax(e,t){return Lu(e[t])?e[t]:e.dataset?e.dataset[t]:e.getAttribute("data-".concat(r7(t)))}function J2(e,t,n){Lu(n)?e[t]=n:e.dataset?e.dataset[t]=n:e.setAttribute("data-".concat(r7(t)),n)}function jGe(e,t){if(Lu(e[t]))try{delete e[t]}catch{e[t]=void 0}else if(e.dataset)try{delete e.dataset[t]}catch{e.dataset[t]=void 0}else e.removeAttribute("data-".concat(r7(t)))}var gV=/\s\s*/,mV=function(){var e=!1;if(nb){var t=!1,n=function(){},i=Object.defineProperty({},"once",{get:function(){return e=!0,t},set:function(a){t=a}});cl.addEventListener("test",n,i),cl.removeEventListener("test",n,i)}return e}();function is(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},r=n;t.trim().split(gV).forEach(function(a){if(!mV){var o=e.listeners;o&&o[a]&&o[a][n]&&(r=o[a][n],delete o[a][n],Object.keys(o[a]).length===0&&delete o[a],Object.keys(o).length===0&&delete e.listeners)}e.removeEventListener(a,r,i)})}function So(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},r=n;t.trim().split(gV).forEach(function(a){if(i.once&&!mV){var o=e.listeners,s=o===void 0?{}:o;r=function(){delete s[a][n],e.removeEventListener(a,r,i);for(var c=arguments.length,u=new Array(c),h=0;hMath.abs(n)&&(n=g)})}),n}function Bg(e,t){var n=e.pageX,i=e.pageY,r={endX:n,endY:i};return t?r:aV({startX:n,startY:i},r)}function BGe(e){var t=0,n=0,i=0;return tr(e,function(r){var a=r.startX,o=r.startY;t+=a,n+=o,i+=1}),t/=i,n/=i,{pageX:t,pageY:n}}function ed(e){var t=e.aspectRatio,n=e.height,i=e.width,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",a=UA(i),o=UA(n);if(a&&o){var s=n*t;r==="contain"&&s>i||r==="cover"&&s90?{width:l,height:s}:{width:s,height:l}}function HGe(e,t,n,i){var r=t.aspectRatio,a=t.naturalWidth,o=t.naturalHeight,s=t.rotate,l=s===void 0?0:s,c=t.scaleX,u=c===void 0?1:c,h=t.scaleY,g=h===void 0?1:h,m=n.aspectRatio,y=n.naturalWidth,k=n.naturalHeight,w=i.fillColor,_=w===void 0?"transparent":w,b=i.imageSmoothingEnabled,M=b===void 0?!0:b,C=i.imageSmoothingQuality,E=C===void 0?"low":C,S=i.maxWidth,$=S===void 0?1/0:S,R=i.maxHeight,P=R===void 0?1/0:R,A=i.minWidth,I=A===void 0?0:A,T=i.minHeight,H=T===void 0?0:T,L=document.createElement("canvas"),G=L.getContext("2d"),D=ed({aspectRatio:m,width:$,height:P}),B=ed({aspectRatio:m,width:I,height:H},"cover"),z=Math.min(D.width,Math.max(B.width,y)),V=Math.min(D.height,Math.max(B.height,k)),W=ed({aspectRatio:r,width:$,height:P}),F=ed({aspectRatio:r,width:I,height:H},"cover"),X=Math.min(W.width,Math.max(F.width,a)),J=Math.min(W.height,Math.max(F.height,o)),Z=[-X/2,-J/2,X,J];return L.width=S1(z),L.height=S1(V),G.fillStyle=_,G.fillRect(0,0,z,V),G.save(),G.translate(z/2,V/2),G.rotate(l*Math.PI/180),G.scale(u,g),G.imageSmoothingEnabled=M,G.imageSmoothingQuality=E,G.drawImage.apply(G,[e].concat(sV(Z.map(function(ee){return Math.floor(S1(ee))})))),G.restore(),L}var kV=String.fromCharCode;function NGe(e,t,n){var i="";n+=t;for(var r=t;r0;)n.push(kV.apply(null,vV(r.subarray(0,i)))),r=r.subarray(i);return"data:".concat(t,";base64,").concat(btoa(n.join("")))}function WGe(e){var t=new DataView(e),n;try{var i,r,a;if(t.getUint8(0)===255&&t.getUint8(1)===216)for(var o=t.byteLength,s=2;s+1=8&&(a=c+h)}}}if(a){var g=t.getUint16(a,i),m,y;for(y=0;y=0?a:hV),height:Math.max(i.offsetHeight,o>=0?o:pV)};this.containerData=s,Jc(r,{width:s.width,height:s.height}),mr(t,ka),sl(r,ka)},initCanvas:function(){var t=this.containerData,n=this.imageData,i=this.options.viewMode,r=Math.abs(n.rotate)%180===90,a=r?n.naturalHeight:n.naturalWidth,o=r?n.naturalWidth:n.naturalHeight,s=a/o,l=t.width,c=t.height;t.height*s>t.width?i===3?l=t.height*s:c=t.width/s:i===3?c=t.width/s:l=t.height*s;var u={aspectRatio:s,naturalWidth:a,naturalHeight:o,width:l,height:c};this.canvasData=u,this.limited=i===1||i===2,this.limitCanvas(!0,!0),u.width=Math.min(Math.max(u.width,u.minWidth),u.maxWidth),u.height=Math.min(Math.max(u.height,u.minHeight),u.maxHeight),u.left=(t.width-u.width)/2,u.top=(t.height-u.height)/2,u.oldLeft=u.left,u.oldTop=u.top,this.initialCanvasData=_i({},u)},limitCanvas:function(t,n){var i=this.options,r=this.containerData,a=this.canvasData,o=this.cropBoxData,s=i.viewMode,l=a.aspectRatio,c=this.cropped&&o;if(t){var u=Number(i.minCanvasWidth)||0,h=Number(i.minCanvasHeight)||0;s>1?(u=Math.max(u,r.width),h=Math.max(h,r.height),s===3&&(h*l>u?u=h*l:h=u/l)):s>0&&(u?u=Math.max(u,c?o.width:0):h?h=Math.max(h,c?o.height:0):c&&(u=o.width,h=o.height,h*l>u?u=h*l:h=u/l));var g=ed({aspectRatio:l,width:u,height:h});u=g.width,h=g.height,a.minWidth=u,a.minHeight=h,a.maxWidth=1/0,a.maxHeight=1/0}if(n)if(s>(c?0:1)){var m=r.width-a.width,y=r.height-a.height;a.minLeft=Math.min(0,m),a.minTop=Math.min(0,y),a.maxLeft=Math.max(0,m),a.maxTop=Math.max(0,y),c&&this.limited&&(a.minLeft=Math.min(o.left,o.left+(o.width-a.width)),a.minTop=Math.min(o.top,o.top+(o.height-a.height)),a.maxLeft=o.left,a.maxTop=o.top,s===2&&(a.width>=r.width&&(a.minLeft=Math.min(0,m),a.maxLeft=Math.max(0,m)),a.height>=r.height&&(a.minTop=Math.min(0,y),a.maxTop=Math.max(0,y))))}else a.minLeft=-a.width,a.minTop=-a.height,a.maxLeft=r.width,a.maxTop=r.height},renderCanvas:function(t,n){var i=this.canvasData,r=this.imageData;if(n){var a=DGe({width:r.naturalWidth*Math.abs(r.scaleX||1),height:r.naturalHeight*Math.abs(r.scaleY||1),degree:r.rotate||0}),o=a.width,s=a.height,l=i.width*(o/i.naturalWidth),c=i.height*(s/i.naturalHeight);i.left-=(l-i.width)/2,i.top-=(c-i.height)/2,i.width=l,i.height=c,i.aspectRatio=o/s,i.naturalWidth=o,i.naturalHeight=s,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.widthi.maxHeight||i.heightn.width?a.height=a.width/i:a.width=a.height*i),this.cropBoxData=a,this.limitCropBox(!0,!0),a.width=Math.min(Math.max(a.width,a.minWidth),a.maxWidth),a.height=Math.min(Math.max(a.height,a.minHeight),a.maxHeight),a.width=Math.max(a.minWidth,a.width*r),a.height=Math.max(a.minHeight,a.height*r),a.left=n.left+(n.width-a.width)/2,a.top=n.top+(n.height-a.height)/2,a.oldLeft=a.left,a.oldTop=a.top,this.initialCropBoxData=_i({},a)},limitCropBox:function(t,n){var i=this.options,r=this.containerData,a=this.canvasData,o=this.cropBoxData,s=this.limited,l=i.aspectRatio;if(t){var c=Number(i.minCropBoxWidth)||0,u=Number(i.minCropBoxHeight)||0,h=s?Math.min(r.width,a.width,a.width+a.left,r.width-a.left):r.width,g=s?Math.min(r.height,a.height,a.height+a.top,r.height-a.top):r.height;c=Math.min(c,r.width),u=Math.min(u,r.height),l&&(c&&u?u*l>c?u=c/l:c=u*l:c?u=c/l:u&&(c=u*l),g*l>h?g=h/l:h=g*l),o.minWidth=Math.min(c,h),o.minHeight=Math.min(u,g),o.maxWidth=h,o.maxHeight=g}n&&(s?(o.minLeft=Math.max(0,a.left),o.minTop=Math.max(0,a.top),o.maxLeft=Math.min(r.width,a.left+a.width)-o.width,o.maxTop=Math.min(r.height,a.top+a.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=r.width-o.width,o.maxTop=r.height-o.height))},renderCropBox:function(){var t=this.options,n=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.widthi.maxHeight||i.height=n.width&&i.height>=n.height?cV:n7),Jc(this.cropBox,_i({width:i.width,height:i.height},d2({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),E1(this.element,ex,this.getData())}},KGe={initPreview:function(){var t=this.element,n=this.crossOrigin,i=this.options.preview,r=n?this.crossOriginUrl:this.url,a=t.alt||"The image to preview",o=document.createElement("img");if(n&&(o.crossOrigin=n),o.src=r,o.alt=a,this.viewBox.appendChild(o),this.viewBoxImage=o,!!i){var s=i;typeof i=="string"?s=t.ownerDocument.querySelectorAll(i):i.querySelector&&(s=[i]),this.previews=s,tr(s,function(l){var c=document.createElement("img");J2(l,Lg,{width:l.offsetWidth,height:l.offsetHeight,html:l.innerHTML}),n&&(c.crossOrigin=n),c.src=r,c.alt=a,c.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',l.innerHTML="",l.appendChild(c)})}},resetPreview:function(){tr(this.previews,function(t){var n=ax(t,Lg);Jc(t,{width:n.width,height:n.height}),t.innerHTML=n.html,jGe(t,Lg)})},preview:function(){var t=this.imageData,n=this.canvasData,i=this.cropBoxData,r=i.width,a=i.height,o=t.width,s=t.height,l=i.left-n.left-t.left,c=i.top-n.top-t.top;!this.cropped||this.disabled||(Jc(this.viewBoxImage,_i({width:o,height:s},d2(_i({translateX:-l,translateY:-c},t)))),tr(this.previews,function(u){var h=ax(u,Lg),g=h.width,m=h.height,y=g,k=m,w=1;r&&(w=g/r,k=a*w),a&&k>m&&(w=m/a,y=r*w,k=m),Jc(u,{width:y,height:k}),Jc(u.getElementsByTagName("img")[0],_i({width:o*w,height:s*w},d2(_i({translateX:-l*w,translateY:-c*w},t))))}))}},XGe={bind:function(){var t=this.element,n=this.options,i=this.cropper;ya(n.cropstart)&&So(t,ix,n.cropstart),ya(n.cropmove)&&So(t,nx,n.cropmove),ya(n.cropend)&&So(t,tx,n.cropend),ya(n.crop)&&So(t,ex,n.crop),ya(n.zoom)&&So(t,rx,n.zoom),So(i,BA,this.onCropStart=this.cropStart.bind(this)),n.zoomable&&n.zoomOnWheel&&So(i,VA,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),n.toggleDragModeOnDblclick&&So(i,LA,this.onDblclick=this.dblclick.bind(this)),So(t.ownerDocument,DA,this.onCropMove=this.cropMove.bind(this)),So(t.ownerDocument,HA,this.onCropEnd=this.cropEnd.bind(this)),n.responsive&&So(window,FA,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,n=this.options,i=this.cropper;ya(n.cropstart)&&is(t,ix,n.cropstart),ya(n.cropmove)&&is(t,nx,n.cropmove),ya(n.cropend)&&is(t,tx,n.cropend),ya(n.crop)&&is(t,ex,n.crop),ya(n.zoom)&&is(t,rx,n.zoom),is(i,BA,this.onCropStart),n.zoomable&&n.zoomOnWheel&&is(i,VA,this.onWheel,{passive:!1,capture:!0}),n.toggleDragModeOnDblclick&&is(i,LA,this.onDblclick),is(t.ownerDocument,DA,this.onCropMove),is(t.ownerDocument,HA,this.onCropEnd),n.responsive&&is(window,FA,this.onResize)}},ZGe={resize:function(){if(!this.disabled){var t=this.options,n=this.container,i=this.containerData,r=n.offsetWidth/i.width,a=n.offsetHeight/i.height,o=Math.abs(r-1)>Math.abs(a-1)?r:a;if(o!==1){var s,l;t.restore&&(s=this.getCanvasData(),l=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(tr(s,function(c,u){s[u]=c*o})),this.setCropBoxData(tr(l,function(c,u){l[u]=c*o})))}}},dblclick:function(){this.disabled||this.options.dragMode===fV||this.setDragMode(IGe(this.dragBox,Q_)?uV:i7)},wheel:function(t){var n=this,i=Number(this.options.wheelZoomRatio)||.1,r=1;this.disabled||(t.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){n.wheeling=!1},50),t.deltaY?r=t.deltaY>0?1:-1:t.wheelDelta?r=-t.wheelDelta/120:t.detail&&(r=t.detail>0?1:-1),this.zoom(-r*i,t)))},cropStart:function(t){var n=t.buttons,i=t.button;if(!(this.disabled||(t.type==="mousedown"||t.type==="pointerdown"&&t.pointerType==="mouse")&&(gn(n)&&n!==1||gn(i)&&i!==0||t.ctrlKey))){var r=this.options,a=this.pointers,o;t.changedTouches?tr(t.changedTouches,function(s){a[s.identifier]=Bg(s)}):a[t.pointerId||0]=Bg(t),Object.keys(a).length>1&&r.zoomable&&r.zoomOnTouch?o=dV:o=ax(t.target,Q2),xGe.test(o)&&E1(this.element,ix,{originalEvent:t,action:o})!==!1&&(t.preventDefault(),this.action=o,this.cropping=!1,o===lV&&(this.cropping=!0,mr(this.dragBox,jy)))}},cropMove:function(t){var n=this.action;if(!(this.disabled||!n)){var i=this.pointers;t.preventDefault(),E1(this.element,nx,{originalEvent:t,action:n})!==!1&&(t.changedTouches?tr(t.changedTouches,function(r){_i(i[r.identifier]||{},Bg(r,!0))}):_i(i[t.pointerId||0]||{},Bg(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var n=this.action,i=this.pointers;t.changedTouches?tr(t.changedTouches,function(r){delete i[r.identifier]}):delete i[t.pointerId||0],n&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,c1(this.dragBox,jy,this.cropped&&this.options.modal)),E1(this.element,tx,{originalEvent:t,action:n}))}}},YGe={change:function(t){var n=this.options,i=this.canvasData,r=this.containerData,a=this.cropBoxData,o=this.pointers,s=this.action,l=n.aspectRatio,c=a.left,u=a.top,h=a.width,g=a.height,m=c+h,y=u+g,k=0,w=0,_=r.width,b=r.height,M=!0,C;!l&&t.shiftKey&&(l=h&&g?h/g:1),this.limited&&(k=a.minLeft,w=a.minTop,_=k+Math.min(r.width,i.width,i.left+i.width),b=w+Math.min(r.height,i.height,i.top+i.height));var E=o[Object.keys(o)[0]],S={x:E.endX-E.startX,y:E.endY-E.startY},$=function(P){switch(P){case Gd:m+S.x>_&&(S.x=_-m);break;case Kd:c+S.xb&&(S.y=b-y);break}};switch(s){case n7:c+=S.x,u+=S.y;break;case Gd:if(S.x>=0&&(m>=_||l&&(u<=w||y>=b))){M=!1;break}$(Gd),h+=S.x,h<0&&(s=Kd,h=-h,c-=h),l&&(g=h/l,u+=(a.height-g)/2);break;case Lc:if(S.y<=0&&(u<=w||l&&(c<=k||m>=_))){M=!1;break}$(Lc),g-=S.y,u+=S.y,g<0&&(s=Bf,g=-g,u-=g),l&&(h=g*l,c+=(a.width-h)/2);break;case Kd:if(S.x<=0&&(c<=k||l&&(u<=w||y>=b))){M=!1;break}$(Kd),h-=S.x,c+=S.x,h<0&&(s=Gd,h=-h,c-=h),l&&(g=h/l,u+=(a.height-g)/2);break;case Bf:if(S.y>=0&&(y>=b||l&&(c<=k||m>=_))){M=!1;break}$(Bf),g+=S.y,g<0&&(s=Lc,g=-g,u-=g),l&&(h=g*l,c+=(a.width-h)/2);break;case E0:if(l){if(S.y<=0&&(u<=w||m>=_)){M=!1;break}$(Lc),g-=S.y,u+=S.y,h=g*l}else $(Lc),$(Gd),S.x>=0?m<_?h+=S.x:S.y<=0&&u<=w&&(M=!1):h+=S.x,S.y<=0?u>w&&(g-=S.y,u+=S.y):(g-=S.y,u+=S.y);h<0&&g<0?(s=R0,g=-g,h=-h,u-=g,c-=h):h<0?(s=$0,h=-h,c-=h):g<0&&(s=O0,g=-g,u-=g);break;case $0:if(l){if(S.y<=0&&(u<=w||c<=k)){M=!1;break}$(Lc),g-=S.y,u+=S.y,h=g*l,c+=a.width-h}else $(Lc),$(Kd),S.x<=0?c>k?(h-=S.x,c+=S.x):S.y<=0&&u<=w&&(M=!1):(h-=S.x,c+=S.x),S.y<=0?u>w&&(g-=S.y,u+=S.y):(g-=S.y,u+=S.y);h<0&&g<0?(s=O0,g=-g,h=-h,u-=g,c-=h):h<0?(s=E0,h=-h,c-=h):g<0&&(s=R0,g=-g,u-=g);break;case R0:if(l){if(S.x<=0&&(c<=k||y>=b)){M=!1;break}$(Kd),h-=S.x,c+=S.x,g=h/l}else $(Bf),$(Kd),S.x<=0?c>k?(h-=S.x,c+=S.x):S.y>=0&&y>=b&&(M=!1):(h-=S.x,c+=S.x),S.y>=0?y=0&&(m>=_||y>=b)){M=!1;break}$(Gd),h+=S.x,g=h/l}else $(Bf),$(Gd),S.x>=0?m<_?h+=S.x:S.y>=0&&y>=b&&(M=!1):h+=S.x,S.y>=0?y0?s=S.y>0?O0:E0:S.x<0&&(c-=h,s=S.y>0?R0:$0),S.y<0&&(u-=g),this.cropped||(sl(this.cropBox,ka),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}M&&(a.width=h,a.height=g,a.left=c,a.top=u,this.action=s,this.renderCropBox()),tr(o,function(R){R.startX=R.endX,R.startY=R.endY})}},QGe={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&mr(this.dragBox,jy),sl(this.cropBox,ka),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=_i({},this.initialImageData),this.canvasData=_i({},this.initialCanvasData),this.cropBoxData=_i({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(_i(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),sl(this.dragBox,jy),mr(this.cropBox,ka)),this},replace:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&t&&(this.isImg&&(this.element.src=t),n?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,tr(this.previews,function(i){i.getElementsByTagName("img")[0].src=t}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,sl(this.cropper,jA)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,mr(this.cropper,jA)),this},destroy:function(){var t=this.element;return t[wi]?(t[wi]=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.canvasData,r=i.left,a=i.top;return this.moveTo(i5(t)?t:r+Number(t),i5(n)?n:a+Number(n))},moveTo:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.canvasData,r=!1;return t=Number(t),n=Number(n),this.ready&&!this.disabled&&this.options.movable&&(gn(t)&&(i.left=t,r=!0),gn(n)&&(i.top=n,r=!0),r&&this.renderCanvas(!0)),this},zoom:function(t,n){var i=this.canvasData;return t=Number(t),t<0?t=1/(1-t):t=1+t,this.zoomTo(i.width*t/i.naturalWidth,null,n)},zoomTo:function(t,n,i){var r=this.options,a=this.canvasData,o=a.width,s=a.height,l=a.naturalWidth,c=a.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&r.zoomable){var u=l*t,h=c*t;if(E1(this.element,rx,{ratio:t,oldRatio:o/l,originalEvent:i})===!1)return this;if(i){var g=this.pointers,m=yV(this.cropper),y=g&&Object.keys(g).length?BGe(g):{pageX:i.pageX,pageY:i.pageY};a.left-=(u-o)*((y.pageX-m.left-a.left)/o),a.top-=(h-s)*((y.pageY-m.top-a.top)/s)}else l1(n)&&gn(n.x)&&gn(n.y)?(a.left-=(u-o)*((n.x-a.left)/o),a.top-=(h-s)*((n.y-a.top)/s)):(a.left-=(u-o)/2,a.top-=(h-s)/2);a.width=u,a.height=h,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return t=Number(t),gn(t)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var n=this.imageData.scaleY;return this.scale(t,gn(n)?n:1)},scaleY:function(t){var n=this.imageData.scaleX;return this.scale(gn(n)?n:1,t)},scale:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.imageData,r=!1;return t=Number(t),n=Number(n),this.ready&&!this.disabled&&this.options.scalable&&(gn(t)&&(i.scaleX=t,r=!0),gn(n)&&(i.scaleY=n,r=!0),r&&this.renderCanvas(!0,!0)),this},getData:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=this.options,i=this.imageData,r=this.canvasData,a=this.cropBoxData,o;if(this.ready&&this.cropped){o={x:a.left-r.left,y:a.top-r.top,width:a.width,height:a.height};var s=i.width/i.naturalWidth;if(tr(o,function(u,h){o[h]=u/s}),t){var l=Math.round(o.y+o.height),c=Math.round(o.x+o.width);o.x=Math.round(o.x),o.y=Math.round(o.y),o.width=c-o.x,o.height=l-o.y}}else o={x:0,y:0,width:0,height:0};return n.rotatable&&(o.rotate=i.rotate||0),n.scalable&&(o.scaleX=i.scaleX||1,o.scaleY=i.scaleY||1),o},setData:function(t){var n=this.options,i=this.imageData,r=this.canvasData,a={};if(this.ready&&!this.disabled&&l1(t)){var o=!1;n.rotatable&&gn(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,o=!0),n.scalable&&(gn(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,o=!0),gn(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var s=i.width/i.naturalWidth;gn(t.x)&&(a.left=t.x*s+r.left),gn(t.y)&&(a.top=t.y*s+r.top),gn(t.width)&&(a.width=t.width*s),gn(t.height)&&(a.height=t.height*s),this.setCropBoxData(a)}return this},getContainerData:function(){return this.ready?_i({},this.containerData):{}},getImageData:function(){return this.sized?_i({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,n={};return this.ready&&tr(["left","top","width","height","naturalWidth","naturalHeight"],function(i){n[i]=t[i]}),n},setCanvasData:function(t){var n=this.canvasData,i=n.aspectRatio;return this.ready&&!this.disabled&&l1(t)&&(gn(t.left)&&(n.left=t.left),gn(t.top)&&(n.top=t.top),gn(t.width)?(n.width=t.width,n.height=t.width/i):gn(t.height)&&(n.height=t.height,n.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t=this.cropBoxData,n;return this.ready&&this.cropped&&(n={left:t.left,top:t.top,width:t.width,height:t.height}),n||{}},setCropBoxData:function(t){var n=this.cropBoxData,i=this.options.aspectRatio,r,a;return this.ready&&this.cropped&&!this.disabled&&l1(t)&&(gn(t.left)&&(n.left=t.left),gn(t.top)&&(n.top=t.top),gn(t.width)&&t.width!==n.width&&(r=!0,n.width=t.width),gn(t.height)&&t.height!==n.height&&(a=!0,n.height=t.height),i&&(r?n.height=n.width/i:a&&(n.width=n.height*i)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var n=this.canvasData,i=HGe(this.image,this.imageData,n,t);if(!this.cropped)return i;var r=this.getData(t.rounded),a=r.x,o=r.y,s=r.width,l=r.height,c=i.width/Math.floor(n.naturalWidth);c!==1&&(a*=c,o*=c,s*=c,l*=c);var u=s/l,h=ed({aspectRatio:u,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),g=ed({aspectRatio:u,width:t.minWidth||0,height:t.minHeight||0},"cover"),m=ed({aspectRatio:u,width:t.width||(c!==1?i.width:s),height:t.height||(c!==1?i.height:l)}),y=m.width,k=m.height;y=Math.min(h.width,Math.max(g.width,y)),k=Math.min(h.height,Math.max(g.height,k));var w=document.createElement("canvas"),_=w.getContext("2d");w.width=S1(y),w.height=S1(k),_.fillStyle=t.fillColor||"transparent",_.fillRect(0,0,y,k);var b=t.imageSmoothingEnabled,M=b===void 0?!0:b,C=t.imageSmoothingQuality;_.imageSmoothingEnabled=M,C&&(_.imageSmoothingQuality=C);var E=i.width,S=i.height,$=a,R=o,P,A,I,T,H,L;$<=-s||$>E?($=0,P=0,I=0,H=0):$<=0?(I=-$,$=0,P=Math.min(E,s+$),H=P):$<=E&&(I=0,P=Math.min(s,E-$),H=P),P<=0||R<=-l||R>S?(R=0,A=0,T=0,L=0):R<=0?(T=-R,R=0,A=Math.min(S,l+R),L=A):R<=S&&(T=0,A=Math.min(l,S-R),L=A);var G=[$,R,P,A];if(H>0&&L>0){var D=y/s;G.push(I*D,T*D,H*D,L*D)}return _.drawImage.apply(_,[i].concat(sV(G.map(function(B){return Math.floor(S1(B))})))),w},setAspectRatio:function(t){var n=this.options;return!this.disabled&&!i5(t)&&(n.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var n=this.options,i=this.dragBox,r=this.face;if(this.ready&&!this.disabled){var a=t===i7,o=n.movable&&t===uV;t=a||o?t:fV,n.dragMode=t,J2(i,Q2,t),c1(i,Q_,a),c1(i,J_,o),n.cropBoxMovable||(J2(r,Q2,t),c1(r,Q_,a),c1(r,J_,o))}return this}},JGe=cl.Cropper,bV=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(fGe(this,e),!t||!SGe.test(t.tagName))throw new Error("The first argument is required and must be an or element.");this.element=t,this.options=_i({},WA,l1(n)&&n),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return hGe(e,[{key:"init",value:function(){var n=this.element,i=n.tagName.toLowerCase(),r;if(!n[wi]){if(n[wi]=this,i==="img"){if(this.isImg=!0,r=n.getAttribute("src")||"",this.originalUrl=r,!r)return;r=n.src}else i==="canvas"&&window.HTMLCanvasElement&&(r=n.toDataURL());this.load(r)}}},{key:"load",value:function(n){var i=this;if(n){this.url=n,this.imageData={};var r=this.element,a=this.options;if(!a.rotatable&&!a.scalable&&(a.checkOrientation=!1),!a.checkOrientation||!window.ArrayBuffer){this.clone();return}if(MGe.test(n)){CGe.test(n)?this.read(VGe(n)):this.clone();return}var o=new XMLHttpRequest,s=this.clone.bind(this);this.reloading=!0,this.xhr=o,o.onabort=s,o.onerror=s,o.ontimeout=s,o.onprogress=function(){o.getResponseHeader("content-type")!==qA&&o.abort()},o.onload=function(){i.read(o.response)},o.onloadend=function(){i.reloading=!1,i.xhr=null},a.checkCrossOrigin&&GA(n)&&r.crossOrigin&&(n=KA(n)),o.open("GET",n,!0),o.responseType="arraybuffer",o.withCredentials=r.crossOrigin==="use-credentials",o.send()}}},{key:"read",value:function(n){var i=this.options,r=this.imageData,a=WGe(n),o=0,s=1,l=1;if(a>1){this.url=qGe(n,qA);var c=UGe(a);o=c.rotate,s=c.scaleX,l=c.scaleY}i.rotatable&&(r.rotate=o),i.scalable&&(r.scaleX=s,r.scaleY=l),this.clone()}},{key:"clone",value:function(){var n=this.element,i=this.url,r=n.crossOrigin,a=i;this.options.checkCrossOrigin&&GA(i)&&(r||(r="anonymous"),a=KA(i)),this.crossOrigin=r,this.crossOriginUrl=a;var o=document.createElement("img");r&&(o.crossOrigin=r),o.src=a||i,o.alt=n.alt||"The image to crop",this.image=o,o.onload=this.start.bind(this),o.onerror=this.stop.bind(this),mr(o,zA),n.parentNode.insertBefore(o,n.nextSibling)}},{key:"start",value:function(){var n=this,i=this.image;i.onload=null,i.onerror=null,this.sizing=!0;var r=cl.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(cl.navigator.userAgent),a=function(c,u){_i(n.imageData,{naturalWidth:c,naturalHeight:u,aspectRatio:c/u}),n.initialImageData=_i({},n.imageData),n.sizing=!1,n.sized=!0,n.build()};if(i.naturalWidth&&!r){a(i.naturalWidth,i.naturalHeight);return}var o=document.createElement("img"),s=document.body||document.documentElement;this.sizingImage=o,o.onload=function(){a(o.width,o.height),r||s.removeChild(o)},o.src=i.src,r||(o.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",s.appendChild(o))}},{key:"stop",value:function(){var n=this.image;n.onload=null,n.onerror=null,n.parentNode.removeChild(n),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var n=this.element,i=this.options,r=this.image,a=n.parentNode,o=document.createElement("div");o.innerHTML=EGe;var s=o.querySelector(".".concat(wi,"-container")),l=s.querySelector(".".concat(wi,"-canvas")),c=s.querySelector(".".concat(wi,"-drag-box")),u=s.querySelector(".".concat(wi,"-crop-box")),h=u.querySelector(".".concat(wi,"-face"));this.container=a,this.cropper=s,this.canvas=l,this.dragBox=c,this.cropBox=u,this.viewBox=s.querySelector(".".concat(wi,"-view-box")),this.face=h,l.appendChild(r),mr(n,ka),a.insertBefore(s,n.nextSibling),sl(r,zA),this.initPreview(),this.bind(),i.initialAspectRatio=Math.max(0,i.initialAspectRatio)||NaN,i.aspectRatio=Math.max(0,i.aspectRatio)||NaN,i.viewMode=Math.max(0,Math.min(3,Math.round(i.viewMode)))||0,mr(u,ka),i.guides||mr(u.getElementsByClassName("".concat(wi,"-dashed")),ka),i.center||mr(u.getElementsByClassName("".concat(wi,"-center")),ka),i.background&&mr(s,"".concat(wi,"-bg")),i.highlight||mr(h,kGe),i.cropBoxMovable&&(mr(h,J_),J2(h,Q2,n7)),i.cropBoxResizable||(mr(u.getElementsByClassName("".concat(wi,"-line")),ka),mr(u.getElementsByClassName("".concat(wi,"-point")),ka)),this.render(),this.ready=!0,this.setDragMode(i.dragMode),i.autoCrop&&this.crop(),this.setData(i.data),ya(i.ready)&&So(n,NA,i.ready,{once:!0}),E1(n,NA)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var n=this.cropper.parentNode;n&&n.removeChild(this.cropper),sl(this.element,ka)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=JGe,e}},{key:"setDefaults",value:function(n){_i(WA,l1(n)&&n)}}])}();_i(bV.prototype,GGe,KGe,XGe,ZGe,YGe,QGe);var iu=function(){return iu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0&&R.zoomTo(B)}($.currentTarget.cropper,M),w&&w($)}}));_&&_(S)}return function(){var $,R;(R=($=C.current)===null||$===void 0?void 0:$.cropper)===null||R===void 0||R.destroy()}},[C]);var E=function(S){return eKe.reduce(function($,R){var P=$,A=R;return P[A],a5(P,[typeof A=="symbol"?A:A+""])},S)}(iu(iu({},b),{crossOrigin:l,src:a,alt:k}));return Y.createElement("div",{style:o,className:s},Y.createElement("img",iu({},E,{style:tKe,ref:C})))});const iKe=Ar(()=>{const e=f.useRef(null),[t,n]=f.useState(!1),i=()=>{n(!0)},r=()=>{var o,s;if(typeof((o=e.current)==null?void 0:o.cropper)<"u"){const l=(s=e.current)==null?void 0:s.cropper.getCroppedCanvas();if(l){const{width:c,height:u}=l,h=l.toDataURL();if(ie.editor.setImg(Object.assign({},ie.editor.img,{src:h,width:c,height:u})),ie.option.size.type==="auto"){const g=Vk(c,u);ie.option.setFrameSize(c+g,u+g)}}}n(!1)},a=()=>{n(!1)};return N.jsxs(N.Fragment,{children:[N.jsx(_a,{title:"Crop Image",children:N.jsx(an,{type:"text",shape:"circle",icon:N.jsx(Cn.Crop,{size:18}),onClick:i})}),N.jsx(js,{title:"Cropper",open:t,onOk:r,onCancel:a,destroyOnClose:!0,children:N.jsx(nKe,{ref:e,style:{height:400,width:"100%"},zoomTo:.5,initialAspectRatio:ie.editor.img.width/ie.editor.img.height,src:ie.editor.img.src,dragMode:"move",viewMode:1,minCropBoxHeight:10,minCropBoxWidth:10,background:!1,responsive:!0,autoCropArea:1,checkOrientation:!1,guides:!0})})]})}),rKe=["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"],aKe=Ar(()=>{const[e,t]=f.useState(!1),n=a=>{t(a)},i=a=>{ie.option.setAlign(a)},r=N.jsx("div",{className:No("flex flex-wrap w-24 position-block",ie.option.align),children:rKe.map(a=>N.jsx("div",{className:"w-8 h-8 border border-[var(--c-br)] rounded-sm hover:bg-[var(--c-wb)] cursor-pointer",onClick:()=>i(a)},a))});return N.jsx(Fu,{content:r,trigger:"click",arrow:!1,placement:"bottomRight",overlayClassName:No("shoteasy-components",ie.editor.isDark&&"dark-mode"),open:e,onOpenChange:n,children:N.jsx(an,{type:"text",shape:"circle",className:No(e&&"shadow-md"),icon:N.jsx(Cn.LayoutGrid,{size:18})})})}),oKe=Ar(()=>{const[e,t]=f.useState(!1),[n,i]=f.useState("Watermark"),[r,a]=f.useState("#00000030"),[o,s]=f.useState(45),l=c=>{a(typeof c=="string"?c:c.toRgbString())};return f.useEffect(()=>{if(e&&n.trim()){const c=kze({text:n,color:r,angleDegrees:o});ie.option.setWaterImg(c)}else ie.option.setWaterImg(null)},[e,n,r,o]),N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm flex gap-4 items-center justify-between",children:[N.jsx("label",{children:"Watermark"}),N.jsx(a_,{defaultChecked:e,onChange:t,size:"small",className:"bg-slate-200"})]}),e&&N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-xs grid gap-3 pl-2 pt-2",children:[N.jsx(Vu,{defaultValue:n,placeholder:"Watermark content",onChange:c=>i(c.target.value)}),N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsx("label",{children:"Color"}),N.jsx(Fk,{value:r,onChange:l,size:"small"})]}),N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsx("label",{children:"Direction"}),N.jsx("div",{children:N.jsxs(Tn.Group,{defaultValue:o,onChange:c=>s(c.target.value),size:"small",children:[N.jsx(Tn.Button,{value:-45,children:N.jsx(Cn.ArrowUpRight,{size:16,className:"mt-[3px]"})}),N.jsx(Tn.Button,{value:45,children:N.jsx(Cn.ArrowDownRight,{size:16,className:"mt-[3px]"})})]})})]}),N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsx("label",{children:"Only Background"}),N.jsx(a_,{size:"small",onChange:c=>ie.option.setWaterIndex(c?-1:1),className:"bg-slate-200"})]})]})]})});function sKe(e,t,n){const i=f.useRef(e),r=f.useRef(t);f.useEffect(()=>{i.current=e,r.current=t},[...n]),f.useEffect(()=>{const a=rV(window,{"$mod+KeyS":o=>{o.preventDefault(),i.current&&i.current()},"$mod+KeyC":o=>{o.preventDefault(),r&&r.current()}});return()=>{a()}},[window])}const lKe=Ar(()=>{var m;const[e,t]=f.useState(!1),[n,i]=f.useState(!1),[r,a]=f.useState("png"),[o,s]=f.useState(1),l=y=>{i(y)},c=async()=>{if(!ie.editor.isEditing||e)return;const y={pixelRatio:o};["jpg","webp"].includes(r)&&(y.quality=.9,y.fill="#ffffff");const k=ky();t(!0),ie.editor.message.open({key:k,type:"loading",content:"Downloading..."}),await ie.editor.app.tree.export(r,y).then(w=>{let _=`Image_${Date.now()}`;o>1&&(_+=`@${o}`),window.imageCompression?imageCompression.getFilefromDataUrl(w.data,`image.${r}`).then(b=>{imageCompression(b,{initialQuality:.5,maxWidthOrHeight:2e3,useWebWorker:!1}).then(M=>{imageCompression.getDataUrlFromFile(M).then(C=>{HO(C,`${_}.${r}`),ie.editor.message.open({key:k,type:"success",content:"Download Success!"})})})}):(HO(w.data,`${_}.${r}`),ie.editor.message.open({key:k,type:"success",content:"Download Success!"}))}).catch(()=>{ie.editor.message.open({key:k,type:"error",content:"Download failed!"})}),t(!1)},u=async()=>{if(!ie.editor.isEditing||e)return;const y=ky();t(!0),ie.editor.message.open({key:y,type:"loading",content:"Copying..."}),await ie.editor.app.tree.export("png",{blob:!0,pixelRatio:o}).then(async k=>{const{data:w}=k;await navigator.clipboard.write([new ClipboardItem({[w.type]:w})]),ie.editor.message.open({key:y,type:"success",content:"Copy Success!"})}).catch(()=>{ie.editor.message.open({key:y,type:"error",content:"Copy failed!"})}),t(!1)},h=()=>{ie.editor.destroy(),ie.editor.clearImg(),ie.editor.clearFun&&ie.editor.clearFun()};sKe(()=>c(),()=>u(),[c,u]);const g=N.jsx("div",{children:N.jsxs("div",{className:"p-2 [&_.ant-segmented]:w-full [&_.ant-segmented-item]:w-[33%]",children:[N.jsx("div",{className:"text-xs text-gray-400 mb-2",children:"Format"}),N.jsx(t_,{options:["png","jpg","webp"],size:"middle",onChange:a}),N.jsx("div",{className:"text-xs text-gray-400 mt-2 mb-2",children:"Pixel Ratio"}),N.jsx(t_,{options:[{value:1,icon:"1x"},{value:2,icon:"2x"},{value:3,icon:"3x"}],size:"middle",onChange:s}),ie.option.frameConf.width&&N.jsxs("div",{className:"text-xs p-3 mt-4 flex justify-between bg-black/5 rounded-md",children:[N.jsx("span",{className:"text-gray-400",children:"Download Size"}),N.jsxs("span",{className:"text-gray-700",children:[ie.option.frameConf.width*o," x ",ie.option.frameConf.height*o]})]})]})});return N.jsxs("div",{className:"shrink-0 py-4 px-6 flex gap-2 justify-center items-center",children:[N.jsx(Ko,{theme:{components:{Button:{colorPrimary:ie.editor.isDark?"#2b4acb":"#000",algorithm:!0}}},children:N.jsxs("div",{className:"ant-space-compact flex flex-1",children:[N.jsx(_a,{placement:"top",title:N.jsxs("span",{children:["Download ",DO," + S"]}),children:N.jsx(an,{type:"primary",size:"large",loading:e,icon:N.jsx(Cn.ImageDown,{size:18}),className:"rounded-se-none flex-1 rounded-ee-none me-[-1px] hover:z-[1] border-r-white/30",onClick:c,children:N.jsxs("div",{className:"leading-4 px-2",children:[N.jsx("div",{className:"text-sm leading-4 font-semibold",children:"Download"}),N.jsxs("div",{className:"text-xs",children:[o,"x as ",r.toLocaleUpperCase()]})]})})}),N.jsx(_a,{placement:"top",title:N.jsxs("span",{children:["Copy ",DO," + C"]}),children:N.jsx(an,{type:"primary",size:"large",icon:N.jsx(Cn.Copy,{size:18}),loading:e,className:"rounded-ss-none rounded-es-none border-l-white/30",onClick:u})})]})}),N.jsxs("div",{className:"flex items-center gap-1",children:[N.jsx(Fu,{content:g,trigger:"click",arrow:!1,placement:"topRight",open:n,overlayStyle:{width:"320px"},onOpenChange:l,children:N.jsx(an,{size:"large",icon:N.jsx(Cn.Settings2,{size:18})})}),((m=ie.editor.img)==null?void 0:m.src)&&N.jsx(mD,{title:"Delete the screenshot",description:"Are you sure to delete this screenshot?",placement:"topRight",onConfirm:h,okText:"Yes",cancelText:"No",children:N.jsx(an,{size:"large",icon:N.jsx(Cn.Trash2,{size:18})})})]})]})}),cKe="data:image/svg+xml,%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%3e%3cpath%20d='M311.296%20428.544V40.96C186.368%2094.208%2087.552%20195.072%2036.864%20321.024l274.432%20274.432V428.544z'%20fill='%2337C15C'%3e%3c/path%3e%3cpath%20d='M428.544%20311.296l274.432-274.432C642.048%2012.288%20577.536%200%20512%200%20440.832%200%20372.736%2014.848%20311.296%2040.96v387.584l117.248-117.248z'%20fill='%23A9E247'%3e%3c/path%3e%3cpath%20d='M983.04%20311.296h-387.584l117.248%20117.248%20274.432%20274.432c24.576-60.416%2036.864-125.44%2036.864-190.976%200-71.168-14.848-139.264-40.96-200.704z'%20fill='%23FF7D12'%3e%3c/path%3e%3cpath%20d='M712.704%20595.456V983.04c124.928-53.248%20223.744-154.112%20274.432-280.064l-274.432-274.432v166.912z'%20fill='%23F93B21'%3e%3c/path%3e%3cpath%20d='M595.456%20712.704l-274.432%20274.432c60.928%2024.576%20125.44%2036.864%20190.976%2036.864%2071.168%200%20139.264-14.848%20200.704-40.96v-387.584l-117.248%20117.248z'%20fill='%23846FEF'%3e%3c/path%3e%3cpath%20d='M428.544%20712.704H40.96c53.248%20124.928%20154.112%20223.744%20280.064%20274.432l274.432-274.432H428.544z'%20fill='%231E95FF'%3e%3c/path%3e%3cpath%20d='M311.296%20595.456L36.864%20321.024C12.288%20381.952%200%20446.464%200%20512c0%2071.168%2014.848%20139.264%2040.96%20200.704h387.584l-117.248-117.248z'%20fill='%2314EFEF'%3e%3c/path%3e%3cpath%20d='M595.456%20311.296H983.04c-53.248-124.928-154.112-223.744-280.064-274.432L428.544%20311.296h166.912z'%20fill='%23FFC931'%3e%3c/path%3e%3c/svg%3e",XA=["cosmic","desktop"],Dg=({type:e,options:t,onChange:n,value:i})=>{let r=[];if(t&&t.length)r=t;else{const a=[];Object.keys(w1).map(o=>{o.includes(e)&&a.push({key:o,value:w1[o]})}),r=a}return N.jsx(Tn.Group,{onChange:a=>n(a.target.value),value:i,rootClassName:No("grid [&_span]:ps-0",XA.includes(e)?"grid-cols-5 gap-y-1.5":"grid-cols-7 gap-y-3"),children:r.map((a,o)=>N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:p-0 mr-0",value:a.key,children:XA.includes(e)?N.jsx("div",{className:No("w-12 h-8 rounded-md overflow-hidden"),children:N.jsx("img",{src:`${a.value.class}&w=48`,className:"w-full h-full object-cover object-center"})}):N.jsx("div",{className:No("w-8 h-8 rounded-full overflow-hidden",a.value.class)})},o))})},dKe=Ar(({showMore:e,onChange:t})=>{const n=()=>{t(!1)},i=a=>{const o=a.toHexString();ie.option.frameConf.background={type:"solid",color:o}},r=a=>{ie.option.setBackground(a)};return N.jsx(c9,{title:"",placement:"right",closable:!1,mask:!1,onClose:n,open:e,getContainer:!1,width:"100%",className:"[&_.ant-drawer-body]:p-0",children:N.jsxs("div",{className:"flex flex-col gap-2 h-full overflow-hidden",children:[N.jsx("div",{className:"shrink-0 pt-4 px-4",children:N.jsx(an,{type:"text",size:"small",className:"text-xs flex items-center opacity-80 m-0",icon:N.jsx(Cn.ChevronRight,{size:16}),iconPosition:"end",onClick:()=>t(!1),children:"Back"})}),N.jsxs("div",{className:"h-0 flex-1 overflow-y-auto px-4 py-2",children:[N.jsx("h4",{className:"text-sm font-bold py-2",children:"Custom"}),N.jsx("div",{className:"py-1",children:N.jsx(Fk,{onChange:i,children:N.jsx(an,{type:"default",size:"small",shape:"circle",icon:N.jsx("img",{src:cKe,width:18})})})}),N.jsx("h4",{className:"text-sm font-bold py-2",children:"Solid Colors"}),N.jsx(Dg,{type:"solid",onChange:r,value:ie.option.background}),N.jsx("h4",{className:"text-sm font-bold py-2",children:"Gradients"}),N.jsx(Dg,{type:"gradient",onChange:r,value:ie.option.background}),N.jsx("h4",{className:"text-sm font-bold py-2",children:"Cosmic Gradients"}),N.jsx(Dg,{type:"cosmic",onChange:r,value:ie.option.background}),N.jsx("h4",{className:"text-sm font-bold py-2",children:"Desktop"}),N.jsx(Dg,{type:"desktop",onChange:r,value:ie.option.background})]})]})})}),uKe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABLCAMAAACxxtKFAAAAYFBMVEVHcEyqqqoGBgjm5uW0tbZeXl9wcHKDhIUmJiYAAAAmJycUFBQiAywSBB9LBDY1AzNiBTZERUV8AjaNjo60s7GbCSj4HgjW1df8q1X/bh9nbWudn5/KBA++YlL83Z9i8PL4oNrpAAAACnRSTlMABv//KalYmwEECNoBKQAAAuhJREFUWMPt2NtypCAQBuAEJ5mMKCfFA6OT93/LbUAFPMwq1lbthX/lwspEv3Q3GOPHx5UrV6788/ycyk6D4zdBCL37GPN9yh3Z5HnGOqWPcGpjDUhGKSWEMFYl8xT3owiRrTl0CMbwbcimUh5GqKj4HMEGsQpbKscR6FezUkruKaI9g+S56VeFl6UEDeubeCQ3CGVd6ZVil1c+UyKRfEhGoZQFgsKGhWPZjeQTkhFRPb1VbBU3FlOK6COQ3EOgX+1qKb5SnUH0ZaBfaoGMyspYjiLmdyXCX8UzZBxLF4FkXiiT3obE60p/DqG6XxuluIYJdRYRXYsXSFgKJ2cR6Fc5reIJCRTOzyD6CswvxSHeCqNclfEINc0QXVX4/fKQQVElP4r4hFk8MHq/FITmDesTHIFQF2L6xTcQq7A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1TRtW2+97a0XFuTp1acaoRwXo+QN6uJnoUHO3qdUwan4xJyzmBJI6xceJEDgCElY4BSBNC7EOSccUarpoEjmaZA7t4qUdEQuW8R4kAc/Q8axuEnMNDFESJvRHAYSO+ImalHznOwP12hNqHaMgkKTImNC9jRNk3EODBKD9FMhLS9GUTuWGlAKMSc71N305uYIWSSW8N4wp/YyT4OjBRCkyHjhumtj7MZpYMSMBowI6V07D3byB4pPTMimg17txA8UHuQsDMwRaXGsEcNIXoKnba0ngeSsI1799PSLQoOIExB0a+Uifd63WSnOESHFILoeZWlh3yejMJ0gXmCYkm7HUpXCg0h1abhSsvWoE8UDMvMSj2Y0Skp+SEa9W5aVOFaaUWDBEDqEa0a3MAdka1LFERD8/zDuiupnopOHq1iR8vLJEAG/YIYL2TVeEi4hOJEkZv07kKQMxYibQIXsGi7Ju/kQUEjBsZ0g79UYxxXmyU4MIikRyLzqFcYc9QaRlKiRVRh6guFPLgR5R0qMIcLckl6hNiOKS6PlFGH3pJwSXMgwAh/LOL/AqIl5EqmRN4aeX2uIRMjjnWSkakLAwB6Rn9nJmCFC+jvGMm6vtWYkifhNa8P/G7GahuZUSmUm/oyka129Y+Qu5caEoLDcexuLw4KRaBFzcq4fGWveGy6LxByQj9+8xupAFBsAmiYiJLz5cO16bUfbUCFuMJZ0vemwLDl5nTFEyKqxWsoNiDErraSZEGUIwmzEMcbAJkIQrHC7aaRkeSVbXvO6cCHNEFs+bhbxAYNMSDOEHnh15HwmQ+IoKVnzaRwTNiuJEDlT8zBx3BJ0iDa4ugjjgpz5kO341hDG2TUQxOr68RrHMa+no11EOFe0QWlPtpfsVjFgp+NswqLHJxMfn9M63tQOhIYLFUx8Sf8x3oN/V+W+1p9e/tTpS1/6T/QTZi2BJxZ/18MAAAAASUVORK5CYII=",gKe=Ar(()=>{const[e,t]=f.useState(!1),n=i=>{const{value:r}=i.target;ie.option.setFrame(r),r==="macbookpro16"&&ie.option.setPaddingBg("#000000")};return N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm",children:[N.jsxs("div",{className:"flex justify-between items-center",children:[N.jsx("label",{children:"Frame"}),N.jsxs(an,{type:"text",size:"small",className:"text-xs flex items-center opacity-80 m-0",onClick:()=>t(!0),children:["More ",N.jsx(Cn.ChevronRight,{size:16})]})]}),N.jsx("div",{className:"py-3 [&_.ant-radio-wrapper_span]:p-0 [&_.ant-radio-wrapper_span]:px-1",children:N.jsxs(Tn.Group,{rootClassName:"grid grid-cols-5",onChange:n,value:ie.option.frame,children:[N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"none",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-8 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 h-7 w-[85%] rounded-md shadow-md -mt-1 -ml-1"})})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"light",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-8 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 border-2 border-white/80 h-7 w-[85%] rounded-md shadow-md -mt-1 -ml-1"})})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"dark",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-8 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 border-2 border-black/40 h-7 w-[85%] rounded-md shadow-md -mt-1 -ml-1"})})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"macosBarLight",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-8 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 h-7 w-[85%] rounded-sm shadow-md mt-2 ml-3 overflow-hidden",children:N.jsx("div",{className:"h-1.5 bg-white/90 px-0.5 flex items-center gap-[1px] before:block before:rounded-full before:w-0.5 before:h-0.5 before:bg-red-500 after:w-0.5 after:h-0.5 after:bg-green-500",children:N.jsx("i",{className:"block w-0.5 h-0.5 bg-yellow-500"})})})})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"macosBarDark",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-8 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 h-7 w-[85%] rounded-sm shadow-md mt-2 ml-3 overflow-hidden",children:N.jsx("div",{className:"h-1.5 bg-black/90 px-0.5 flex items-center gap-[1px] before:block before:rounded-full before:w-0.5 before:h-0.5 before:bg-red-500 after:w-0.5 after:h-0.5 after:bg-green-500",children:N.jsx("i",{className:"block w-0.5 h-0.5 bg-yellow-500"})})})})})]})})]}),N.jsx(c9,{title:"",placement:"right",closable:!1,mask:!1,onClose:t,open:e,getContainer:!1,width:"100%",className:"[&_.ant-drawer-body]:p-0",children:N.jsxs("div",{className:"flex flex-col gap-2 h-full overflow-hidden",children:[N.jsx("div",{className:"shrink-0 pt-4 px-4",children:N.jsx(an,{type:"text",size:"small",className:"text-xs flex items-center opacity-80 m-0",icon:N.jsx(Cn.ChevronRight,{size:16}),iconPosition:"end",onClick:()=>t(!1),children:"Back"})}),N.jsxs("div",{className:"h-0 flex-1 overflow-y-auto px-4 py-2",children:[N.jsx("h4",{className:"text-sm font-bold py-2",children:"Browser"}),N.jsx("div",{className:"py-3 [&_.ant-radio-wrapper_span]:p-0 [&_.ant-radio-wrapper_span]:px-1",children:N.jsxs(Tn.Group,{rootClassName:"grid grid-cols-3",onChange:n,value:ie.option.frame,children:[N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"windowsBarLight",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 h-12 w-[85%] rounded-sm shadow-md mt-2 ml-3 overflow-hidden",children:N.jsx("div",{className:"bg-white/90 px-0.5",children:N.jsx("div",{className:"h-2.5 bg-no-repeat bg-[right_center] bg-[auto_100%]",style:{backgroundImage:`url(${WF})`}})})})})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"windowsBarDark",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden",children:N.jsx("div",{className:"bg-slate-300/40 h-12 w-[85%] rounded-sm shadow-md mt-2 ml-3 overflow-hidden",children:N.jsx("div",{className:"bg-black/90 px-0.5",children:N.jsx("div",{className:"h-2.5 bg-no-repeat bg-[right_center] bg-[auto_100%]",style:{backgroundImage:`url(${qF})`}})})})})})]})}),N.jsxs("div",{className:"flex justify-between items-center py-2",children:[N.jsx("h4",{className:"text-sm font-bold",children:"Devices"}),N.jsxs(Tn.Group,{value:ie.option.frameMode,onChange:i=>ie.option.setFrameMode(i.target.value),size:"small",children:[N.jsx(Tn.Button,{value:"cover",children:"Cover"}),N.jsx(Tn.Button,{value:"fit",children:"Contain"}),N.jsx(Tn.Button,{value:"strench",children:"Stretch"})]})]}),N.jsx("div",{className:"py-3 [&_.ant-radio-wrapper_span]:p-0 [&_.ant-radio-wrapper_span]:px-1",children:N.jsxs(Tn.Group,{rootClassName:"grid grid-cols-3",onChange:n,value:ie.option.frame,children:[N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"macbookpro16",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden bg-no-repeat bg-[10px_-5px] bg-[100px_auto]",style:{backgroundImage:`url(${uKe})`}})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"macbookair",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden bg-no-repeat bg-[13px_-6px] bg-[92px_auto]",style:{backgroundImage:`url(${fKe})`}})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"imacpro",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden bg-no-repeat bg-[13px_top] bg-[90px_auto]",style:{backgroundImage:`url(${hKe})`}})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"ipadpro",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden bg-no-repeat bg-[center_top] bg-[100px_auto]",style:{backgroundImage:`url(${pKe})`}})}),N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:mr-0 [&_span]:block [&_span]:w-full",value:"iphonepro",children:N.jsx("div",{className:"bg-gray-300/30 rounded-md h-14 overflow-hidden bg-no-repeat bg-[center_top] bg-[100px_auto]",style:{backgroundImage:`url(${vKe})`}})})]})})]})]})})]})}),mKe=Ar(()=>{const[e,t]=f.useState(!1),n=i=>{const r=i.target.value;ie.option.setBackground(r)};return N.jsxs("div",{className:"bg-white dark:bg-black flex flex-col md:w-[340px] border-l border-l-gray-50 dark:border-l-gray-700 dark:text-gray-400 shadow-lg relative z-10 select-none",children:[N.jsxs("div",{className:"flex-1 flex-col gap-2 p-4 overflow-y-auto overflow-x-hidden",children:[N.jsx(dGe,{}),N.jsxs("div",{className:"[&_label]:font-semibold pt-2 [&_label]:text-sm",children:[N.jsx("label",{children:"Quick"}),N.jsxs("div",{className:"flex gap-4 items-center py-2",children:[N.jsx(iKe,{}),N.jsx(an,{type:"text",shape:"circle",onClick:()=>ie.option.toggleFlip("x"),icon:N.jsx(Cn.FlipHorizontal2,{size:18})}),N.jsx(an,{type:"text",shape:"circle",onClick:()=>ie.option.toggleFlip("y"),icon:N.jsx(Cn.FlipVertical2,{size:18})}),N.jsx(aKe,{})]})]}),N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm",children:[N.jsx("label",{children:"Scale"}),N.jsx(B0,{min:.1,max:3,step:.1,onChange:i=>ie.option.setScale(i),value:typeof ie.option.scale=="number"?ie.option.scale:1})]}),N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm",children:[N.jsxs("div",{className:"flex justify-between",children:[N.jsx("label",{children:"Padding"}),N.jsx(Fk,{value:ie.option.paddingBg,onChange:i=>ie.option.setPaddingBg(i.toRgbString()),size:"small"})]}),N.jsx(B0,{min:0,max:60,onChange:i=>ie.option.setPadding(i),value:typeof ie.option.padding=="number"?ie.option.padding:0})]}),N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm",children:[N.jsx("label",{children:"Rounded"}),N.jsx(B0,{min:0,max:20,onChange:i=>ie.option.setRound(i),value:typeof ie.option.round=="number"?ie.option.round:0})]}),N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm",children:[N.jsx("label",{children:"Shadow"}),N.jsx(B0,{min:0,max:6,onChange:i=>ie.option.setShadow(i),value:typeof ie.option.shadow=="number"?ie.option.shadow:0})]}),N.jsx(gKe,{}),N.jsxs("div",{className:"[&_label]:font-semibold [&_label]:text-sm",children:[N.jsxs("div",{className:"flex justify-between items-center",children:[N.jsx("label",{children:"Background"}),N.jsxs(an,{type:"text",size:"small",className:"text-xs flex items-center opacity-80 m-0",onClick:()=>t(!0),children:["More ",N.jsx(Cn.ChevronRight,{size:16})]})]}),N.jsx("div",{className:"py-3",children:N.jsxs(Tn.Group,{onChange:n,value:ie.option.background,rootClassName:"grid grid-cols-7 [&_span]:ps-0",children:[N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:p-0 mr-0",value:"default_1",children:N.jsx("div",{className:No("w-8 h-8 rounded-full",w1.default_1.class)})}),Object.keys(w1).map(i=>{if(i.includes("default")&&i!=="default_1")return N.jsx(Tn,{className:"[&_.ant-radio]:hidden [&_span]:p-0 mr-0",value:i,children:N.jsx("div",{className:No("w-8 h-8 rounded-full",w1[i].class)})},i)})]})})]}),N.jsx(oKe,{})]}),N.jsx(lKe,{}),N.jsx(dKe,{showMore:e,onChange:t})]})}),yKe=(e,t=[])=>{f.useEffect(()=>{const n=async i=>{const r=i.clipboardData;if(!r||!r.items)return;const a=Array.from(r.items).filter(s=>fN.includes(s.type));if(!a.length)return;const o=a[0].getAsFile();e&&e(o)};return document.addEventListener("paste",n,!1),()=>{document.removeEventListener("paste",n)}},[...t])},wV=e=>async(n,i="blob")=>{const r=window.URL||window.webkitURL||window,a=i==="blob"?r.createObjectURL(n):n,o=await gze(a),s=Math.round(o.width),l=Math.round(o.height);if(e.editor.setImg({src:a,width:s,height:l,type:i==="blob"?n.type:"image/png",name:i==="blob"?n.name:`Image_${Date.now()}.png`}),e.option.size.type==="auto"){const c=Vk(s,l);e.option.setFrameSize(s+c,l+c)}},kKe=async()=>{try{const e=await navigator.mediaDevices.getDisplayMedia(),t=document.createElement("video");t.srcObject=e,t.play(),await new Promise(a=>t.onplaying=a);const n=document.createElement("canvas");n.width=t.videoWidth,n.height=t.videoHeight,n.getContext("2d").drawImage(t,0,0);const r=n.toDataURL("image/png");return t.srcObject.getTracks().forEach(a=>a.stop()),r}catch(e){console.log("Error capturing screen:",e)}},ZA=""+new URL("demo-CN-KDTod.png",import.meta.url).href,{Dragger:bKe}=u9,wKe=Ar(()=>{const e=wV(ie),t=async a=>(await e(a),Promise.reject()),n=async()=>{const a=await kKe();a&&e(a,"dataURL")},i=()=>{ie.editor.message.info("Developing, Coming soon!")},r=()=>{e(ZA,"dataURL")};return yKe(a=>{e(a)}),N.jsx("div",{className:"md:w-0 md:flex-1 flex flex-col justify-center items-center overflow-hidden select-none relative",children:N.jsxs("div",{className:No("max-w-[600px]",ie.editor.invalid&&"invalid"),children:[N.jsx(bKe,{accept:fN.join(","),name:"file",showUploadList:!1,beforeUpload:t,rootClassName:"p-4 rounded-md bg-white dark:bg-black dark:text-gray-400 block shadow-sm",children:N.jsxs("div",{className:"text-center p-10",children:[N.jsx("p",{className:"text-2xl my-2 opacity-60",children:N.jsx(Cn.ImagePlus,{className:"mx-auto",size:36})}),N.jsxs("p",{className:"text-sm px-4",children:["Click or Drag image to this area",N.jsx("br",{}),"or Paste image"]})]})}),N.jsxs("div",{className:"flex justify-between mt-2 py-4 px-6 rounded-md bg-white dark:bg-black shadow-sm",children:[N.jsx(_a,{placement:"top",arrow:!1,title:"Take a screenshot of desktop windows",children:N.jsx(an,{shape:"round",type:"default",size:"large",icon:N.jsx(Cn.Camera,{size:20}),onClick:n})}),N.jsx(_a,{placement:"top",arrow:!1,title:"Beautify text",children:N.jsx(an,{shape:"round",type:"default",size:"large",icon:N.jsx(Cn.Type,{size:20}),onClick:i})}),N.jsx(_a,{placement:"top",arrow:!1,title:"Beautify Code",children:N.jsx(an,{shape:"round",type:"default",size:"large",icon:N.jsx(Cn.CodeXml,{size:20,onClick:i})})}),N.jsx(_a,{placement:"top",arrow:!1,title:"Create gif animate",children:N.jsx(an,{shape:"round",type:"default",size:"large",icon:N.jsx(Cn.ImagePlay,{size:20,onClick:i})})})]}),N.jsxs("button",{className:"w-full mt-1 rounded-md bg-white dark:bg-black border border-dotted dark:border-gray-700 shadow-sm flex justify-between items-center p-1 hover:bg-slate-50 dark:hover:bg-gray-900 hover:px-1.5",onClick:r,children:[N.jsx("div",{className:"overflow-hidden rounded-sm w-8",children:N.jsx("img",{src:ZA,className:"w-full"})}),N.jsx("div",{className:"text-xs text-gray-500",children:"Give it a try ✨"})]})]})})});let YA=!1;const _Ke=Ar(({defaultImg:e,headLeft:t,headRight:n,isDark:i,boxClassName:r="",onClear:a})=>{var u;const o=wV(ie),s=(u=ie.editor.img)!=null&&u.src?N.jsx(sGe,{}):N.jsx(wKe,{}),[l,c]=hD.useMessage();return ie.editor.setMessage(l),ie.editor.setClearFun(a),f.useMemo(()=>{const h=i||localStorage.getItem("SHOTEASY_BEAUTIFIER_THEME")==="dark"?"dark":"light";ie.editor.setTheme(h)},[i]),f.useEffect(()=>{e&&o(e,"dataURL")},[e]),YA||(YA=!0,window.__page.registerCallPage("doSetImage",function(h,g,m){o(m,"base64"),h("ok")}),postMessage({payload:"removeLoading"},"*")),N.jsx(OJ,{children:N.jsxs(Ko,{theme:{algorithm:ie.editor.isDark?hO.darkAlgorithm:hO.defaultAlgorithm},children:[c,N.jsxs("div",{id:"shoteasy-container",className:No("polka flex flex-col overflow-hidden antialiased w-full h-[100vh] dark:bg-black",r),"data-mode":ie.editor.isDark?"dark":"light",children:[N.jsx(wLe,{headLeft:t,headRight:n}),N.jsxs("div",{className:"flex flex-col flex-1 h-0 md:flex-row md:items-stretch",children:[s,N.jsx(mKe,{})]})]})]})})});o5.createRoot(document.getElementById("root")).render(N.jsx(Y.StrictMode,{children:N.jsx(_Ke,{})})); diff --git a/public/third-party/image-beautifier/index.html b/public/third-party/image-beautifier/index.html index 90a1a4ed..e22ff5f4 100644 --- a/public/third-party/image-beautifier/index.html +++ b/public/third-party/image-beautifier/index.html @@ -4,7 +4,7 @@ - + diff --git a/src/components/Device/DeviceActionScreenshot.vue b/src/components/Device/DeviceActionScreenshot.vue index dee69c17..d61ff78e 100644 --- a/src/components/Device/DeviceActionScreenshot.vue +++ b/src/components/Device/DeviceActionScreenshot.vue @@ -17,7 +17,7 @@ const doScreenshot = async () => { const image = await window.$mapi.adb.screencap(props.device.id) const base64 = 'data:image/png;base64,' + image await window.$mapi.page.open('thirdPartyImageBeautifier') - await window.$mapi.event.callThirdParty('thirdPartyImageBeautifier', 'doSetImage', base64) + await window.$mapi.event.callPage('thirdPartyImageBeautifier', 'doSetImage', base64) } catch (error) { Dialog.tipError(mapError(error)) } diff --git a/vite.config.ts b/vite.config.ts index 5a97b0ee..21a8ea3e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,8 @@ import fs from 'node:fs' import {defineConfig} from 'vite' import vue from '@vitejs/plugin-vue' -import electron from 'vite-plugin-electron/simple' +import electron from 'vite-plugin-electron' +import renderer from 'vite-plugin-electron-renderer' import pkg from './package.json' import path from "node:path"; import {AppConfig} from "./src/config"; @@ -53,8 +54,8 @@ export default defineConfig(({command}) => { }, }, - electron({ - main: { + electron([ + { // Shortcut of `build.lib.entry` entry: 'electron/main/index.ts', onstart({startup}) { @@ -79,26 +80,37 @@ export default defineConfig(({command}) => { }, }, }, - preload: { + { // Shortcut of `build.rollupOptions.input`. // Preload scripts may contain Web assets, so use the `build.rollupOptions.input` instead `build.lib.entry`. - input: 'electron/preload/index.ts', + entry: 'electron/preload/index.ts', + onstart({reload}) { + // Notify the Renderer process to reload the page when the Preload scripts build is complete, + // instead of restarting the entire Electron App. + reload() + }, vite: { build: { - sourcemap: sourcemap ? 'inline' : undefined, // #332 + target: 'es2015', + sourcemap: undefined, // #332 minify: minify, outDir: 'dist-electron/preload', + lib: { + formats: ['cjs'], + }, rollupOptions: { external: externalPackages, + output: { + format: 'cjs', + entryFileNames: '[name].cjs', + compact: false, + }, }, }, }, }, - // Ployfill the Electron and Node.js API for Renderer process. - // If you want use Node.js in Renderer process, the `nodeIntegration` needs to be enabled in the Main process. - // See 👉 https://github.com/electron-vite/vite-plugin-electron-renderer - renderer: {}, - }), + ]), + renderer(), ], build: { sourcemap: sourcemap,