mira-app-server
Version:
Mira Server - standalone server application using mira-app-core
26 lines • 214 kB
JavaScript
import{aJ as te,cM as ao,de as En,bZ as v,at as H,dq as M,cc as me,cB as U,br as An,cO as io,bB as We,bM as Wo,b7 as Ho,aA as St,a1 as be,c6 as Go,ak as ro,E as Bn,aH as C,bL as le,cN as Vn,ax as L,c8 as B,bb as je,aP as _e,bE as pe,c5 as _t,cx as lo,cw as ht,bV as He,bX as Le,d4 as Rn,as as p,bN as Pe,av as O,aD as On,al as E,dl as ee,bJ as Se,cU as Wt,cR as kt,bQ as so,cz as Kt,t as zn,p as Nn,o as qn,n as Un,l as jn,j as Wn,B as Ko,aG as Q,cr as P,d1 as Hn,d7 as Pt,cL as It,b4 as Gn,x as ge,cb as xe,a$ as Kn,b3 as Xn,cs as Xo,cf as Yn,dr as Ae,dt as De,d3 as bt,di as Ve,X as Ut,b0 as Yo,cW as Jo,cg as Jn,cS as ko,b8 as Nt,aY as ut,U as Zn,dm as Ye,be as Qn,c2 as $n,af as Zo,ct as ea,h as ta,aj as oa,dn as na,bz as aa,aO as Qo,cl as ia,c7 as ra,aZ as la,bW as sa,cI as da,cX as ua,dc as ca,db as ma,d as fa,c as ga,f as ha,e as pa,b as va,a as ya}from"./index-OOzZz4T6.js";import{l as ba,j as wa,k as xa,u as $o,s as at,n as Ma,g as en,c as Ca,b as _a,a as Sa,d as ka,C as Pa,p as Ia,M as Ta,h as Da,i as La,H as Fa,t as uo,V as Ea,S as co,f as Aa,e as Ba,E as Va,r as Po,o as Io,B as Ra,m as Oa,T as za,D as tn,F as Na}from"./index-D_-NigwL.js";import{C as qa,b as Ua,a as ja,P as Wa}from"./PopoverTrigger-xdplOlgm.js";import{S as mo}from"./StatusImage-ijC2Qank.js";import{c as Ha,b as Ga,e as Ka,a as Xa,d as Ya,T as Ja}from"./TableHeader-B9xaXLo9.js";import{C as fo}from"./Checkbox-BfEXYDtx.js";import{u as Za,i as Qa,o as $a,j as To,s as ei,l as ti,m as oi,h as ni,k as ai}from"./TooltipTrigger-BN8IaDgz.js";import{I as ii}from"./Input-CZG1tOaA.js";import{a as ri,R as li}from"./RadioGroupItem-nNNjlV9J.js";import{L as si}from"./Label-bwL3QO2u.js";import{A as di,a as ui}from"./FileUpload-DAQxSw5N.js";import"./plyr-BSkcSigr.js";import"./SelectValue-BTic8Ggd.js";import"./Collection-xoV-DHwv.js";import"./usePrimitiveElement-CCN0lZVt.js";import"./useArrowNavigation-D-pctMGk.js";import"./TabsTrigger-BT8zVtVt.js";import"./viewHistory-C1myXHNJ.js";import"./Switch-QckDRkQW.js";import"./Slider-IdZsXzZo.js";import"./MultiTabFileUpload.vue_vue_type_style_index_0_scoped_d6c008b6_lang-7H6xCDli.js";import"./createLucideIcon-DGRAKu_b.js";var ci=te({__name:"ContextMenuSub",props:{defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0}},emits:["update:open"],setup(o,{emit:t}){const n=o,e=t;ao();const i=En(n,"open",e,{defaultValue:n.defaultOpen,passive:n.open===void 0});return(l,a)=>(v(),H(U(ba),{open:U(i),"onUpdate:open":a[0]||(a[0]=d=>An(i)?i.value=d:null)},{default:M(()=>[me(l.$slots,"default",{open:U(i)})]),_:3},8,["open"]))}}),mi=ci,fi=te({__name:"ContextMenuSubContent",props:{forceMount:{type:Boolean,required:!1},loop:{type:Boolean,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","entryFocus","openAutoFocus","closeAutoFocus"],setup(o,{emit:t}){const i=io(o,t);return ao(),(l,a)=>(v(),H(U(wa),We(U(i),{style:{"--reka-context-menu-content-transform-origin":"var(--reka-popper-transform-origin)","--reka-context-menu-content-available-width":"var(--reka-popper-available-width)","--reka-context-menu-content-available-height":"var(--reka-popper-available-height)","--reka-context-menu-trigger-width":"var(--reka-popper-anchor-width)","--reka-context-menu-trigger-height":"var(--reka-popper-anchor-height)"}}),{default:M(()=>[me(l.$slots,"default")]),_:3},16))}}),gi=fi,hi=te({__name:"ContextMenuSubTrigger",props:{disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(o){const t=o;return ao(),(n,e)=>(v(),H(U(xa),Wo(Ho(t)),{default:M(()=>[me(n.$slots,"default")]),_:3},16))}}),pi=hi;/**
* @license @lucide/vue v1.17.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vi=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],yi=St("image-plus",vi);/**
* @license @lucide/vue v1.17.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bi=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],wi=St("rotate-ccw",bi);/**
* @license @lucide/vue v1.17.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xi=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Mi=St("rotate-cw",xi);/**
* @license @lucide/vue v1.17.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ci=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],_i=St("zoom-in",Ci);/**
* @license @lucide/vue v1.17.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Si=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ki=St("zoom-out",Si),Pi=te({__name:"ContextMenuSub",props:{defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1}},emits:["update:open"],setup(o,{expose:t,emit:n}){t();const e=o,i=n,l=io(e,i),a={props:e,emits:i,forwarded:l,get ContextMenuSub(){return mi}};return Object.defineProperty(a,"__isScriptSetup",{enumerable:!1,value:!0}),a}});function Ii(o,t,n,e,i,l){return v(),H(e.ContextMenuSub,We({"data-slot":"context-menu-sub"},e.forwarded),{default:M(()=>[me(o.$slots,"default")]),_:3},16)}const Ti=be(Pi,[["render",Ii],["__file","D:/mira_typescript/packages/mira-client/src/components/ui/context-menu/ContextMenuSub.vue"]]),Di=te({__name:"ContextMenuSubContent",props:{forceMount:{type:Boolean,required:!1},loop:{type:Boolean,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},class:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","entryFocus","openAutoFocus","closeAutoFocus"],setup(o,{expose:t,emit:n}){t();const e=o,i=n,l=Go(e,"class"),a=io(l,i),d={props:e,emits:i,delegatedProps:l,forwarded:a,get ContextMenuSubContent(){return gi},get Motion(){return Bn},get cn(){return ro}};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}});function Li(o,t,n,e,i,l){return v(),H(e.ContextMenuSubContent,We(e.forwarded,{"as-child":""}),{default:M(()=>[C(e.Motion,{as:"div","data-slot":"context-menu-sub-content",initial:{opacity:0,transform:"translate3d(-8px, 0, 0) scale(0.95)"},animate:{opacity:1,transform:"translate3d(0, 0, 0) scale(1)"},transition:{duration:.2,ease:[.23,1,.32,1]},class:le(e.cn("bg-popover text-popover-foreground data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 z-50 min-w-[8rem] origin-(--reka-context-menu-content-transform-origin) overflow-visible rounded-md border p-1",e.props.class))},{default:M(()=>[me(o.$slots,"default")]),_:3},8,["class"])]),_:3},16)}const Fi=be(Di,[["render",Li],["__file","D:/mira_typescript/packages/mira-client/src/components/ui/context-menu/ContextMenuSubContent.vue"]]),Ei=te({__name:"ContextMenuSubTrigger",props:{disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},class:{type:null,required:!1},inset:{type:Boolean,required:!1}},setup(o,{expose:t}){t();const n=o,e=Go(n,"class"),i=Vn(e),l={props:n,delegatedProps:e,forwardedProps:i,get ChevronRight(){return qa},get ContextMenuSubTrigger(){return pi},get cn(){return ro}};return Object.defineProperty(l,"__isScriptSetup",{enumerable:!1,value:!0}),l}});function Ai(o,t,n,e,i,l){return v(),H(e.ContextMenuSubTrigger,We({"data-slot":"context-menu-sub-trigger","data-inset":n.inset?"":void 0},e.forwardedProps,{class:e.cn("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e.props.class)}),{default:M(()=>[me(o.$slots,"default"),C(e.ChevronRight,{class:"ml-auto"})]),_:3},16,["data-inset","class"])}const Bi=be(Ei,[["render",Ai],["__file","D:/mira_typescript/packages/mira-client/src/components/ui/context-menu/ContextMenuSubTrigger.vue"]]),Vi=te({__name:"EmptyDescription",props:{class:{type:null,required:!1}},setup(o,{expose:t}){t();const n={get cn(){return ro}};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}});function Ri(o,t,n,e,i,l){return v(),L("p",{"data-slot":"empty-description",class:le(e.cn("text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4",o.$attrs.class??""))},[me(o.$slots,"default")],2)}const Oi=be(Vi,[["render",Ri],["__file","D:/mira_typescript/packages/mira-client/src/components/ui/empty/EmptyDescription.vue"]]);function zi(o={}){const{hoverDelay:t=300,enabled:n=!0}=o,e=B(!1),i=B(0),l=B(0),a=B(),d=B(null);let r;return{showPreview:e,currentTime:i,duration:l,videoRef:a,handleMouseEnter:h=>{!n||!h.url||(r&&clearTimeout(r),r=setTimeout(()=>{d.value=h,e.value=!0},t))},handleMouseLeave:()=>{r&&(clearTimeout(r),r=void 0),a.value&&(a.value.pause(),a.value.currentTime=0),e.value=!1,i.value=0,d.value=null},handleMouseMove:h=>{if(!e.value||!a.value||l.value===0)return;const f=h.currentTarget;if(!f){console.warn("handleMouseMove: currentTarget is null");return}try{const b=f.getBoundingClientRect(),_=(h.clientX-b.left)/b.width*l.value;a.value.currentTime=Math.max(0,Math.min(_,l.value)),i.value=_}catch(b){console.error("Error in handleMouseMove:",b)}},handleVideoLoaded:()=>{a.value&&(l.value=a.value.duration,a.value.currentTime=0)},currentVideoItem:d}}function Ni(){const o=$o(),t=B(null),n=B(!1);return{selectedMediaItem:t,showDetailSidebar:n,handleMediaClick:c=>{t.value=c,o&&o.handleMediaClick&&o.handleMediaClick(c)},handleMediaInfo:c=>{console.log("显示文件信息:",c),t.value=c,n.value=!0},handleMediaSetFolder:c=>{console.log("设置文件夹:",c),t.value=c,n.value=!0},handleMediaSetTags:c=>{console.log("设置标签:",c),t.value=c,n.value=!0},handleMediaDelete:c=>{console.log("删除文件:",c)},toggleDetailSidebar:()=>{n.value=!n.value}}}function qi(){const o=B([{id:"folders",type:"folders",label:je.global.t("composables.useFilters.filterFolders"),icon:"folder",selectedValues:[]},{id:"tags",type:"tags",label:je.global.t("composables.useFilters.filterTags"),icon:"label",selectedValues:[]},{id:"category",type:"category",label:je.global.t("composables.useFilters.filterCategory"),icon:"filter_list",selectedCategory:""},{id:"urls",type:"urls",label:je.global.t("composables.useFilters.filterUrls"),icon:"link",value:""},{id:"title",type:"title",label:je.global.t("composables.useFilters.filterTitle"),icon:"title",value:""},{id:"size",type:"size",label:je.global.t("composables.useFilters.filterSize"),icon:"aspect_ratio",selectedPreset:""},{id:"metadata",type:"metadata",label:je.global.t("composables.useFilters.filterMetadata"),icon:"photo_size_select_large",metaField:"dimension",selectedMetaPreset:""}]),t=r=>r.map(c=>({id:c.id,label:c.title||c.label||c.name,icon:"folder",iconColor:"#3B82F6",count:c.fileCount||c.count||0,children:c.children?.map(s=>({id:s.id,label:s.title||s.label||s.name,icon:"folder",iconColor:"#6B7280",count:s.fileCount||s.count||0}))||[]})),n=r=>r.map(c=>({id:c.id,label:c.title||c.label||c.name,icon:"label",iconColor:"#10B981",count:c.fileCount||c.count||0})),e=(r,c,s,u)=>{if(console.log("筛选器变化:",r),s){const m=c();if(m){const h=m.filters||{};h[r.id]=r,s(m.id,h)}}u.handleFilterChange(r.type,r)},i=(r,c,s,u)=>{if(console.log("清除筛选器:",r),s){const m=c();m&&s(m.id,r.id)}u.handleFilterClear(r.type)},l=(r,c)=>{r.filters?(c.applyFiltersToTab(r.id,r.filters),a(r)):(c.filterConditions.value={folders:[],tags:[],urls:"",sizeMin:void 0,sizeMax:void 0,sizePreset:""},d())},a=r=>{r.filters&&o.value.forEach(c=>{const s=r.filters[c.id];s&&(c.selectedValues=s.selectedValues||[],c.value=s.value||"",c.selectedPreset=s.selectedPreset||"",c.customMin=s.customMin,c.customMax=s.customMax,c.selectedCategory=s.selectedCategory||"",c.metaField=s.metaField||"dimension",c.selectedMetaPreset=s.selectedMetaPreset||"",c.metaDimMin=s.metaDimMin,c.metaDimMax=s.metaDimMax,c.metaDurMin=s.metaDurMin,c.metaDurMax=s.metaDurMax,c.customDimMin=s.customDimMin,c.customDimMax=s.customDimMax,c.customDurMin=s.customDurMin,c.customDurMax=s.customDurMax,c.active=s.active||!1)})},d=()=>{o.value.forEach(r=>{r.selectedValues=[],r.value="",r.selectedPreset="",r.customMin=void 0,r.customMax=void 0,r.selectedCategory="",r.metaField="dimension",r.selectedMetaPreset="",r.metaDimMin=void 0,r.metaDimMax=void 0,r.metaDurMin=void 0,r.metaDurMax=void 0,r.customDimMin=void 0,r.customDimMax=void 0,r.customDurMin=void 0,r.customDurMax=void 0,r.active=!1})};return{filterRules:o,createFolderTreeItems:t,createTagTreeItems:n,handleFilterChange:e,handleFilterClear:i,applyFiltersToTab:l,syncFilterBarWithTab:a,resetFilterBar:d}}class Ui{get isElectron(){return _e.isElectron()}get platform(){return _e.getPlatform()}async connect(t){return await pe.connect(t)}async disconnect(){return await pe.disconnect()}async testConnection(){return await pe.testConnection()}get isConnected(){return pe.isClientConnected()}async login(t){return(await pe.login(t)).user}async register(t){return await pe.register(t)}async logout(){return await pe.logout()}async getCurrentUser(){return await pe.getCurrentUser()}async listFiles(t,n){if(!t)throw new Error("Library ID is required");return await pe.listFiles(t,n)}async uploadFile(t,n,e){return await pe.uploadFile(t,n,e)}async downloadFile(t,n){return await pe.downloadFile(t,n)}async writeFile(t,n,e,i){return await pe.writeFile(t,n,e,i)}async deleteFile(t,n,e=!0){return await pe.deleteFile(t,n,e)}async restoreFile(t,n){return await pe.restoreFile(t,n)}async getLibraries(){return await pe.getLibraries()}async createLibrary(t,n){return await pe.createLibrary(t,n)}async addToLibrary(t,n){return console.warn("addToLibrary not implemented yet",{fileId:t,libraryId:n}),{success:!1,message:"Not implemented"}}async getPlugins(){return console.warn("getPlugins not implemented yet"),[]}async installPlugin(t){return console.warn("installPlugin not implemented yet",{pluginId:t}),{success:!1,message:"Not implemented"}}async uninstallPlugin(t){return console.warn("uninstallPlugin not implemented yet",{pluginId:t}),{success:!1,message:"Not implemented"}}async executePlugin(t,n){return console.warn("executePlugin not implemented yet",{pluginId:t,args:n}),{success:!1,message:"Not implemented"}}async getSystemInfo(){return await pe.getSystemInfo()}async getSystemHealth(){return await pe.getSystemHealth()}async writeToClipboard(t){return await _e.writeToClipboard(t)}async readFromClipboard(){return await _e.readFromClipboard()}async showOpenDialog(t){return await _e.showOpenDialog(t)}async showSaveDialog(t){return await _e.showSaveDialog(t)}async minimizeWindow(){return await _e.minimizeWindow()}async maximizeWindow(){return await _e.maximizeWindow()}async closeWindow(){return await _e.closeWindow()}async setFullScreen(t){return await _e.setFullScreen(t)}async quitApp(){return await _e.quitApp()}async getAppVersion(){return await _e.getAppVersion()}on(t,n){_e.on(t,n)}removeAllListeners(t){_e.removeAllListeners(t)}send(t,...n){_e.send(t,...n)}async invoke(t,...n){return await _e.invoke(t,...n)}}const it=new Ui;function ji(){const o=[{value:"grid",label:je.global.t("composables.useViewModeConfig.gridView"),icon:"grid_view"},{value:"list",label:je.global.t("composables.useViewModeConfig.listView"),icon:"view_list"},{value:"waterfall",label:je.global.t("composables.useViewModeConfig.waterfallView"),icon:"view_quilt"}];return{viewModes:o,getViewModeIcon:e=>o.find(l=>l.value===e)?.icon||"grid_view",getViewModeTitle:e=>o.find(l=>l.value===e)?.label||je.global.t("composables.useViewModeConfig.gridView")}}let qt=!1;const go=.2,Wi=.4,Hi=180;let Mt=go,eo="",Ct=null,pt=null;const Gi=typeof navigator<"u"&&navigator.userAgent.indexOf("Firefox")>-1,on=typeof window<"u"&&(!!window.ActiveXObject||"ActiveXObject"in window),nn=()=>{qt=!1,Mt=go,eo="",Ct!==null&&(clearTimeout(Ct),Ct=null),pt!==null&&(clearTimeout(pt),pt=null)},Ki=(o,t,n)=>{let e=o.deltaY||o.wheelDelta,i=t;Gi&&(e=e*30),on&&(e=-e);const l=e<0?"add":"reduce";l!==eo&&(eo=l,Mt=go);const a=Mt/n.width*e;return a<0&&(i+=Math.abs(a)),a>0&&t>Math.abs(a)&&(i-=Math.abs(a)),qt||(qt=!0,Ct=window.setTimeout(()=>{qt=!1,Mt=Math.min(Wi,Mt+.01),Ct=null},100)),pt!==null&&clearTimeout(pt),pt=window.setTimeout(nn,Hi),i},Xi=(o,t)=>o*t,Yi=typeof document<"u"&&"onwheel"in document.createElement("div")?"wheel":"mousewheel",Do=.2,to=100,Ji=te({name:"cropper-loading",props:{isVisible:{type:Boolean,default:!1}},render(){const{$slots:o}=this;return this.isVisible?C("section",{class:"cropper-loading"},[o.default?o.default():C("p",{class:"cropper-loading-spin"},[C("i",null,[C("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"loading",width:"1.5em",height:"1.5em",fill:"currentColor","aria-hidden":"true"},[C("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 0 0-94.3-139.9 437.71 437.71 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"},null)])]),C("span",null,null)])]):""}}),Lo=(o,t=0)=>{if(typeof o=="number")return o;const n=o.trim();if(n.endsWith("%")){const i=Number.parseFloat(n);return!Number.isFinite(i)||t<=0?0:t*i/100}const e=Number.parseFloat(n);return Number.isFinite(e)?e:0},Fo=o=>typeof o=="number"?`${o}px`:o,ho=o=>{if(!Number.isFinite(o))return 0;const t=(o%360+360)%360;return Object.is(t,-0)?0:t},Zi=o=>{const{props:t,cropperRef:n,layoutContainer:e,imgs:i,cropping:l}=o,a=E(()=>({...t.wrapper,width:Fo(t.wrapper.width),height:Fo(t.wrapper.height)})),d=B({...t.cropLayout}),r=E(()=>({width:Lo(d.value.width,e.wrapLayout.width),height:Lo(d.value.height,e.wrapLayout.height)})),c=()=>{if(!n.value)return;const h=Number.parseFloat((window.getComputedStyle(n.value).width||"").replace("px","")),f=Number.parseFloat((window.getComputedStyle(n.value).height||"").replace("px",""));Number.isFinite(h)&&Number.isFinite(f)&&(e.wrapLayout={width:h,height:f})},s=E(()=>{const h=e.wrapLayout.width,f=e.wrapLayout.height,b=r.value.width,y=r.value.height;return{width:h>0?Math.min(b,h):b,height:f>0?Math.min(y,f):y}}),u=E(()=>{const h=e.wrapLayout.width,f=e.wrapLayout.height;return h<=0||f<=0?!0:s.value.width<h||s.value.height<f}),m=E(()=>!!i.value&&l.value&&!u.value);return{wrapperStyle:a,innerCropLayout:d,cropLayoutStyle:r,effectiveCropLayoutStyle:s,shouldShowCropBox:u,isFullCropMode:m,updateWrapLayoutFromDom:c}},an={};an.getData=o=>new Promise((t,n)=>{let e={};Qi(o).then(i=>{e.arrayBuffer=i,e.orientation=or(i),t(e)}).catch(i=>{n(i)})});function Qi(o){let t=null;return new Promise((n,e)=>{if(o.src)if(/^data\:/i.test(o.src))t=er(o.src),n(t);else if(/^blob\:/i.test(o.src)){var i=new FileReader;i.onload=function(a){t=a.target?.result??null,n(t)},$i(o.src,function(a){i.readAsArrayBuffer(a)})}else{var l=new XMLHttpRequest;l.onload=function(){if(this.status==200||this.status===0)t=l.response,n(t);else throw"Could not load image";l=null},l.open("GET",o.src,!0),l.responseType="arraybuffer",l.send(null)}else e("img error")})}function $i(o,t){var n=new XMLHttpRequest;n.open("GET",o,!0),n.responseType="blob",n.onload=function(){(this.status==200||this.status===0)&&t(this.response)},n.send()}function er(o){o=o.replace(/^data\:([^\;]+)\;base64,/gim,"");for(var t=atob(o),n=t.length,e=new ArrayBuffer(n),i=new Uint8Array(e),l=0;l<n;l++)i[l]=t.charCodeAt(l);return e}function tr(o,t,n){var e="",i;for(i=t,n+=t;i<n;i++)e+=String.fromCharCode(o.getUint8(i));return e}function or(o){var t=new DataView(o),n=t.byteLength,e,i,l,a,d,r,c,s,u,m;if(t.getUint8(0)===255&&t.getUint8(1)===216)for(u=2;u<n;){if(t.getUint8(u)===255&&t.getUint8(u+1)===225){c=u;break}u++}if(c&&(i=c+4,l=c+10,tr(t,i,4)==="Exif"&&(r=t.getUint16(l),d=r===18761,(d||r===19789)&&t.getUint16(l+2,d)===42&&(a=t.getUint32(l+4,d),a>=8&&(s=l+a)))),s){for(n=t.getUint16(s,d),m=0;m<n;m++)if(u=s+m*12+2,t.getUint16(u,d)===274){u+=8,e=t.getUint16(u,d);break}}return e}class nr{ctx;img;handle;constructor(){this.ctx=null,this.img=null,this.handle={1:t=>(t&&this.ctx&&this.img&&(t.width=this.img.width,t.height=this.img.height),t),2:t=>(t&&this.ctx&&this.img&&(t.width=this.img.width,t.height=this.img.height,this.ctx.translate(this.img.width,0),this.ctx.scale(-1,1)),t),3:t=>(t&&this.ctx&&this.img&&(t.width=this.img.width,t.height=this.img.height,this.ctx.translate(this.img.width/2,this.img.height/2),this.ctx.rotate(180*Math.PI/180),this.ctx.translate(-this.img.width/2,-this.img.height/2)),t),4:t=>(t&&this.ctx&&this.img&&(t.width=this.img.width,t.height=this.img.height,this.ctx.translate(0,this.img.height),this.ctx.scale(1,-1)),t),5:t=>(t&&this.ctx&&this.img&&(t.width=this.img.height,t.height=this.img.width,this.ctx.rotate(.5*Math.PI),this.ctx.scale(1,-1)),t),6:t=>(t&&this.ctx&&this.img&&(t.width=this.img.height,t.height=this.img.width,this.ctx.translate(this.img.height/2,this.img.width/2),this.ctx.rotate(90*Math.PI/180),this.ctx.translate(-this.img.width/2,-this.img.height/2)),t),7:t=>(t&&this.ctx&&this.img&&(t.width=this.img.height,t.height=this.img.width,this.ctx.rotate(.5*Math.PI),this.ctx.translate(this.img.width,-this.img.height),this.ctx.scale(-1,1)),t),8:t=>(t&&this.ctx&&this.img&&(t.width=this.img.height,t.height=this.img.width,this.ctx.translate(this.img.height/2,this.img.width/2),this.ctx.rotate(-90*Math.PI/180),this.ctx.translate(-this.img.width/2,-this.img.height/2)),t)}}render(t,n,e){if(this.ctx=n.getContext("2d"),this.img=t,this.handle[e]){const i=this.handle[e](n);return this.ctx=i.getContext("2d"),this.ctx.drawImage(this.img,0,0,this.img.width,this.img.height),this.ctx.restore(),i}else return n.width=t.width,n.height=t.height,this.ctx.drawImage(this.img,0,0,this.img.width,this.img.height),n}}const ar=(o,t,n)=>{let e="default";for(const l of Object.keys(Eo))if(l===n){e=n;break}const i=Eo[e];return i(o,t,n)},Eo={contain:(o,t)=>{let n=1;const{width:e,height:i}={...o},l=t.width,a=t.height;return e>l&&(n=l/e),i*n>a&&(n=a/i),n},cover:(o,t)=>{let n=1;const{width:e,height:i}={...o},l=t.width,a=t.height;return n=l/e,i*n<a&&(n=a/i),n},default:(o,t,n)=>{let e=1;if(n==="original")return e;let{width:i,height:l}={...o};const a=t.width,d=t.height,r=n.split(" ");try{let c=r[0];if(c.search("px")!==-1&&(c=c.replace("px",""),i=parseFloat(c),e=i/o.width),c.search("%")!==-1&&(c=c.replace("%",""),i=parseFloat(c)/100*a,e=i/o.width),r.length===2&&c==="auto"){let s=r[1];s.search("px")!==-1&&(s=s.replace("px",""),l=parseFloat(s),e=l/o.height),s.search("%")!==-1&&(s=s.replace("%",""),l=parseFloat(s)/100*d,e=l/o.height)}}catch(c){console.error(c),e=1}return e}},ir=new nr,rn=async o=>new Promise((t,n)=>{const e=new Image;e.onload=()=>t(e),e.onerror=n,e.src=o,o.substr(0,4)!=="data"&&(e.crossOrigin="")}),rr=o=>an.getData(o),lr=(o,t,n)=>t&&ir.render(o,t,n),At=o=>{if(typeof navigator>"u")return["0","0","0"];const t=navigator.userAgent.split(" ");let n="",e=["0","0","0"];const i=new RegExp(o,"i");for(let l=0;l<t.length;l++)i.test(t[l])&&(n=t[l]);return n&&(e=n.split("/")[1].split(".")),e},sr=o=>{if(Number(At("chrome")[0])>=81)return-1;if(Number(At("safari")[0])>=605){const n=At("version");if(Number(n[0])>13&&Number(n[1])>1)return-1}const t=typeof navigator<"u"?navigator.userAgent.toLowerCase().match(/cpu iphone os (.*?) like mac os/):null;if(t){const n=t[1].split("_").map(e=>Number(e));return n[0]>13||n[0]>=13&&n[1]>=4||Number(At("Firefox")[0])>=97?-1:o}return o},dr=(o,t,n)=>ar(o,t,n),jt=(o,t)=>{const{scale:n,imgStyle:e,layoutStyle:i,rotate:l}=o,a={width:n*e.width,height:n*e.height};let d=(i.width-a.width)/2,r=(i.height-a.height)/2;t&&(d=t.x,r=t.y);const c=((a.width-e.width)/2+d)/n,s=((a.height-e.height)/2+r)/n;return{imgExhibitionStyle:{width:`${e.width}px`,height:`${e.height}px`,transform:`scale(${n}, ${n}) translate3d(${c}px, ${s}px, 0px) rotateZ(${l}deg)`},imgAxis:{x:d,y:r,scale:n,rotate:l}}},ur=(o,t,n)=>new Promise((e,i)=>{o.toBlob(l=>{if(l){e(l);return}i(new Error("canvas toBlob failed"))},`image/${t}`,n)}),cr=async o=>o?/\.(gif|jpg|jpeg|png|bmp|GIF|JPG|PNG|WEBP|webp)$/.test(o.name)?new Promise((t,n)=>{const e=new FileReader;e.onload=i=>{let l="";const a=i.target;typeof a.result=="object"&&a.result?l=window.URL.createObjectURL(new Blob([a.result])):l=a.result,t(l)},e.onerror=n,e.readAsArrayBuffer(o)}):(alert("图片类型必须是.gif,jpeg,jpg,png,bmp,webp中的一种"),""):"",mr=(o,t,n=0,e=1)=>{const i=document.createElement("canvas"),l=i.getContext("2d");let{width:a,height:d}=t,r=0,c=0,s=0;return a=a*e,d=d*e,i.width=a,i.height=d,n&&(s=Math.ceil(Math.sqrt(a*a+d*d)),i.width=s,i.height=s,l.translate(s/2,s/2),l.rotate(n*Math.PI/180),r=-s/2+(s-a)/2,c=-s/2+(s-d)/2),l.drawImage(o,r,c,a,d),l.restore(),i},fr=async o=>{const{type:t="base64",url:n,sourceCanvas:e,imgLayout:i,imgAxis:l,cropAxis:a,cropLayout:d,outputType:r,outputSize:c=1,full:s=!0,original:u=!1,maxSideLength:m,cropping:h}=o,f=document.createElement("canvas"),b=f.getContext("2d");let y=null;if(!e){if(!n)throw new Error("getCropImgData: either `sourceCanvas` or `url` must be provided");try{y=await rn(n)}catch(_){console.log(_),y=new Image}}return new Promise((_,k)=>{try{const S=Number.isFinite(m)?m:3e3,V=Number.isFinite(l.scale)&&l.scale>0?l.scale:1,I=u?1/V:1,R=u?1:Math.max(1,V),q=u?1:V/R,X={x:a.x*I,y:a.y*I},G={width:d.width*I,height:d.height*I},w={...l,x:l.x*I,y:l.y*I};let T;e?!l.rotate&&R===1?T=e:T=gr(e,i,l.rotate,R):T=mr(y,i,l.rotate,R);let F=w.x-X.x,j=w.y-X.y,N=G.width,g=G.height;if(h||(N=T.width*q,g=T.height*q,F=0,j=0),l.rotate&&h){const $=i.width*(u?1:V),ue=i.height*(u?1:V);F-=(T.width*q-$)/2,j-=(T.height*q-ue)/2}let W=s&&typeof window<"u"?Math.max(1,window.devicePixelRatio||1):1;if(S>0){const $=Math.max(N*W,g*W);$>S&&(W*=S/$)}if(f.width=Math.max(1,Math.round(N*W)),f.height=Math.max(1,Math.round(g*W)),b.scale(W,W),b.imageSmoothingEnabled=!0,"imageSmoothingQuality"in b&&(b.imageSmoothingQuality="high"),b.drawImage(T,F,j,T.width*q,T.height*q),b.restore(),t==="blob"){ur(f,r,c).then(_).catch(k);return}const oe=f.toDataURL(`image/${r}`,c);_(oe)}catch(S){k(S)}})},gr=(o,t,n=0,e=1)=>{const i=document.createElement("canvas"),l=i.getContext("2d");let{width:a,height:d}=t,r=0,c=0,s=0;return a=a*e,d=d*e,i.width=a,i.height=d,n&&(s=Math.ceil(Math.sqrt(a*a+d*d)),i.width=s,i.height=s,l.translate(s/2,s/2),l.rotate(n*Math.PI/180),r=-s/2+(s-a)/2,c=-s/2+(s-d)/2),l.drawImage(o,r,c,a,d),l.restore(),i},hr=(o,t,n,e)=>{const i={left:0,right:0,top:0,bottom:0,scale:1},l=n.rotate*Math.PI/180,a=[{x:o.x,y:o.y},{x:o.x+t.width,y:o.y},{x:o.x+t.width,y:o.y+t.height},{x:o.x,y:o.y+t.height}].map(q=>Xt(q,-l)),d=Math.max(...a.map(q=>q.x))-Math.min(...a.map(q=>q.x)),r=Math.max(...a.map(q=>q.y))-Math.min(...a.map(q=>q.y)),c=Math.max(n.scale,d/e.width,r/e.height),s=e.width*c,u=e.height*c,m=s/2,h=u/2,f=e.width*n.scale/2,b=e.height*n.scale/2,y=Math.max(...a.map(q=>q.x-m)),_=Math.min(...a.map(q=>q.x+m)),k=Math.max(...a.map(q=>q.y-h)),S=Math.min(...a.map(q=>q.y+h)),V={x:n.x+f,y:n.y+b},I=Xt(V,-l),R=Xt({x:Ao(I.x,y,_),y:Ao(I.y,k,S)},l);return i.scale=c,i.left=R.x-m,i.right=R.x-m,i.top=R.y-h,i.bottom=R.y-h,i},Ao=(o,t,n)=>Math.min(Math.max(o,t),n),Xt=(o,t)=>({x:o.x*Math.cos(t)-o.y*Math.sin(t),y:o.x*Math.sin(t)+o.y*Math.cos(t)}),Bt=(o,t,n,e)=>{let i="",l="";const a=hr(o,t,n,e),d=a.scale,r=.5;return n.x>a.left+r?i="left":n.x<a.right-r&&(i="right"),n.y>a.top+r?l="top":n.y<a.bottom-r&&(l="bottom"),{landscape:i,portrait:l,scale:d,boundary:a,imgAxis:n}},pr={easeInOut:(o,t,n,e)=>(o=o/e*2,o<1?n/2*o*o+t:-n/2*(--o*(o-2)-1)+t)},xt=(o,t,n,e)=>{if(n<=0||o===t)return e&&e(t),()=>0;let i=0;const l=Math.max(1,Math.ceil(n/17));let a=0;const d=()=>{const r=pr.easeInOut(i,o,t-o,l);i++,i<=l?(e&&e(r),a=requestAnimationFrame(d)):e&&e(t)};return d(),()=>a};class vr{handlers;constructor(){this.handlers=new Map}addHandler(t,n){const e=this.handlers.get(t);let i=[];e&&(i=[...e]),i.push(n),this.handlers.set(t,i)}fire(t){const n=this.handlers.get(t.type);n&&n.forEach(e=>{e(t)})}removeHandler(t,n){const e=this.handlers.get(t);if(!e)return;let i=0;for(const l=e.length;i<l&&e[i]!==n;i++);e.splice(i,1),this.handlers.set(t,e)}}const Bo=typeof window<"u"&&"ontouchstart"in window,Vo=typeof window<"u"&&"onmouseup"in window;let Ro=class{element;pre;watcher;touches;constructor(t){this.element=t,this.touches=null,this.pre={x:0,y:0},this.watcher=new vr}fire(t){this.watcher.fire(t)}getAxis(t){return{x:t.clientX,y:t.clientY}}getTouchPair(t){return t.length<2?null:[t[0],t[1]]}start(t){t.preventDefault(),t.which===1&&(this.pre=this.getAxis(t),this.fire({type:"down",event:t}),window.addEventListener("mousemove",this.move),window.addEventListener("mouseup",this.stop))}startTouch(t){const n=t.touches[0];if(!n)return;this.pre={x:n.clientX,y:n.clientY},this.fire({type:"down",event:t});const e=this.getTouchPair(t.touches);e?(this.touches=e,window.addEventListener("touchmove",this.scaleTouch,{passive:!1}),window.removeEventListener("touchmove",this.moveTouch)):(window.addEventListener("touchmove",this.moveTouch,{passive:!1}),window.removeEventListener("touchmove",this.scaleTouch)),window.addEventListener("touchend",this.stopTouch)}move(t){t.preventDefault();const n=this.getAxis(t);this.fire({type:"down-to-move",event:t,change:{x:n.x-this.pre.x,y:n.y-this.pre.y}}),this.pre=n}moveTouch(t){t.preventDefault();const n=t.touches[0];n&&(this.fire({type:"down-to-move",event:t,change:{x:n.clientX-this.pre.x,y:n.clientY-this.pre.y}}),this.pre={x:n.clientX,y:n.clientY})}getLen(t){return Math.sqrt(t.x*t.x+t.y*t.y)}getScale(t,n){const e={x:t[1].clientX-t[0].clientX,y:t[1].clientY-t[0].clientY},i={x:n[1].clientX-n[0].clientX,y:n[1].clientY-n[0].clientY};return this.getLen(e)/this.getLen(i)}scaleTouch(t){t.preventDefault();const n=this.getTouchPair(t.touches);!n||!this.touches||(this.fire({type:"down-to-scale",event:t,scale:this.getScale(n,this.touches)}),this.touches=n)}stop(t){this.fire({type:"up",event:t}),window.removeEventListener("mousemove",this.move),window.removeEventListener("mouseup",this.stop)}stopTouch(t){this.fire({type:"up",event:t}),this.touches=null,window.removeEventListener("touchmove",this.moveTouch),window.removeEventListener("touchmove",this.scaleTouch),window.removeEventListener("touchend",this.stopTouch)}on(t,n){this.watcher.addHandler(t,n),!(t!=="down-to-move"&&t!=="down-to-scale"&&t!=="up")&&(Vo&&(this.start=this.start.bind(this),this.move=this.move.bind(this),this.stop=this.stop.bind(this),this.element.addEventListener("mousedown",this.start)),Bo&&(this.startTouch=this.startTouch.bind(this),this.moveTouch=this.moveTouch.bind(this),this.scaleTouch=this.scaleTouch.bind(this),this.stopTouch=this.stopTouch.bind(this),this.element.addEventListener("touchstart",this.startTouch,{passive:!1})))}off(t,n){this.watcher.removeHandler(t,n),!(t!=="down-to-move"&&t!=="down-to-scale"&&t!=="up")&&(Vo&&(this.element.removeEventListener("mousedown",this.start),window.removeEventListener("mousemove",this.move),window.removeEventListener("mouseup",this.stop)),Bo&&(this.element.removeEventListener("touchstart",this.startTouch),window.removeEventListener("touchmove",this.moveTouch),window.removeEventListener("touchmove",this.scaleTouch),window.removeEventListener("touchend",this.stopTouch)))}};const yr=o=>{const{cropperImg:t,cropperBox:n,layout:e,cropping:i,centerBox:l,centerWrapper:a,effectiveCropLayoutStyle:d,getBoundaryDuration:r,queueRealTimeEmit:c}=o,s=B(null),u=B(!1);let m=null,h=null;const f=w=>{const T=jt({scale:e.imgAxis.scale,imgStyle:{...e.imgLayout},layoutStyle:{...e.wrapLayout},rotate:e.imgAxis.rotate},w);e.imgExhibitionStyle=T.imgExhibitionStyle,e.imgAxis=T.imgAxis,c()},b=()=>{if(u.value=!1,!l.value&&!a.value)return;const w=r();let T;l.value?T=Bt({...e.cropAxis},{...d.value},{...e.imgAxis},{...e.imgLayout}):T=Bt({x:0,y:0},{...e.wrapLayout},{...e.imgAxis},{...e.imgLayout}),e.imgAxis.scale<T.scale&&xt(e.imgAxis.scale,T.scale,w,F=>{y(F,!0)}),T.landscape==="left"&&xt(e.imgAxis.x,T.boundary.left,w,F=>{f({x:F,y:e.imgAxis.y})}),T.landscape==="right"&&xt(e.imgAxis.x,T.boundary.right,w,F=>{f({x:F,y:e.imgAxis.y})}),T.portrait==="top"&&xt(e.imgAxis.y,T.boundary.top,w,F=>{f({x:e.imgAxis.x,y:F})}),T.portrait==="bottom"&&xt(e.imgAxis.y,T.boundary.bottom,w,F=>{f({x:e.imgAxis.x,y:F})}),c()},y=(w,T=!1)=>{const F={x:e.imgAxis.x,y:e.imgAxis.y};T||(F.x-=e.imgLayout.width*(w-e.imgAxis.scale)/2,F.y-=e.imgLayout.height*(w-e.imgAxis.scale)/2);const j=jt({scale:w,imgStyle:{...e.imgLayout},layoutStyle:{...e.wrapLayout},rotate:e.imgAxis.rotate},F);e.imgExhibitionStyle=j.imgExhibitionStyle,e.imgAxis=j.imgAxis,c(),s.value!==null&&clearTimeout(s.value);const N=r();s.value=setTimeout(()=>{b()},N)},_=w=>{const T=d.value.width,F=d.value.height,j=e.wrapLayout.width-T,N=e.wrapLayout.height-F;w.x<0&&(w.x=0),w.y<0&&(w.y=0),w.x>j&&(w.x=j),w.y>N&&(w.y=N),e.cropAxis=w,i.value=!0,c()},k=()=>{e.cropAxis={x:0,y:0},i.value=!1},S=w=>{if(!w.change)return;const T={x:w.change.x+e.imgAxis.x,y:w.change.y+e.imgAxis.y};if(l.value||a.value){const F=l.value?Bt({...e.cropAxis},{...d.value},{...e.imgAxis},{...e.imgLayout}):Bt({x:0,y:0},{...e.wrapLayout},{...e.imgAxis},{...e.imgLayout});(F.landscape!==""||F.portrait!=="")&&(T.x=e.imgAxis.x+w.change.x*Do,T.y=e.imgAxis.y+w.change.y*Do)}f(T)},V=w=>{if(u.value=!0,w.scale){const T=Xi(w.scale,e.imgAxis.scale);y(T)}},I=w=>{if(!u.value&&w.change){const T={x:w.change.x+e.cropAxis.x,y:w.change.y+e.cropAxis.y};_(T)}},R=()=>{q();const w=t.value;w&&(m=new Ro(w),m.on("down-to-move",S),m.on("down-to-scale",V),m.on("up",b))},q=()=>{m&&(m.off("down-to-move",S),m.off("up",b),m.off("down-to-scale",V),m=null)},X=()=>{G();const w=n.value;w&&(h=new Ro(w),h.on("down-to-move",I),h.on("down-to-scale",V),h.on("up",b))},G=()=>{h&&(h.off("down-to-move",I),h.off("down-to-scale",V),h.off("up",b),h=null)};return{bindMoveImg:R,unbindMoveImg:q,bindMoveCrop:X,unbindMoveCrop:G,setScale:y,setImgAxis:f,reboundImg:b,checkedCrop:_,clearCrop:k}},br=o=>{const{imgs:t,cropping:n,effectiveCropLayoutStyle:e,layout:i,emit:l}=o;let a=0;const d=()=>{if(!t.value||!n.value)return null;const s=i.imgAxis.scale,u=(i.imgLayout.width*(s-1)/2+(i.imgAxis.x-i.cropAxis.x))/s,m=(i.imgLayout.height*(s-1)/2+(i.imgAxis.y-i.cropAxis.y))/s,h=`scale(${s}, ${s}) translate3d(${u}px, ${m}px, 0) rotateZ(${i.imgAxis.rotate}deg)`,f=e.value.width,b=e.value.height;return{w:f,h:b,url:t.value,img:{width:`${i.imgLayout.width}px`,height:`${i.imgLayout.height}px`,transform:h},html:`<div class="show-preview" style="width: ${f}px; height: ${b}px; overflow: hidden"><div style="width: ${f}px; height: ${b}px"><img src="${t.value}" style="width: ${i.imgLayout.width}px; height: ${i.imgLayout.height}px; transform: ${h}"></div></div>`}},r=()=>{const s=d();s&&(l("real-time",s),l("realTime",s))},c=()=>{a&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{a=0,r()})};return Le(()=>{a&&(cancelAnimationFrame(a),a=0)}),{queueRealTimeEmit:c,getRealTimePreview:d}},wr=o=>{const{layout:t,imgs:n,cropping:e,cropLayoutStyle:i,effectiveCropLayoutStyle:l,shouldShowCropBox:a,checkedCrop:d,queueRealTimeEmit:r}=o,c=f=>{const{width:b,height:y}=t.wrapLayout;let _=i.value.width,k=i.value.height;b>0&&(_=Math.min(_,b)),y>0&&(k=Math.min(k,y));const S={x:(b-_)/2,y:(y-k)/2};d(f?{...f}:S)},s=()=>{const f=["cropper-drag-box"];return e.value&&a.value&&f.push("cropper-modal"),f.join(" ")},u=()=>{const f={width:`${l.value.width}px`,height:`${l.value.height}px`,transform:`translate3d(${t.cropAxis.x}px, ${t.cropAxis.y}px, 0)`};return t.cropExhibitionStyle.div=f,f},m=()=>{const f=t.imgAxis.scale,b=(t.imgLayout.width*(f-1)/2+(t.imgAxis.x-t.cropAxis.x))/f,y=(t.imgLayout.height*(f-1)/2+(t.imgAxis.y-t.cropAxis.y))/f,_={width:`${t.imgLayout.width}px`,height:`${t.imgLayout.height}px`,transform:`scale(${f}, ${f}) translate3d(${b}px, ${y}px, 0) rotateZ(${t.imgAxis.rotate}deg)`};return t.cropExhibitionStyle.img=_,_},h=E(()=>!!n.value&&e.value&&!a.value);return{renderCrop:c,computedClassDrag:s,getCropBoxStyle:u,getCropImgStyle:m,isFullCropMode:h,onCropAxisChanged:()=>{r()}}},xr=o=>{const{canvas:t,outputType:n,outputSize:e,full:i,original:l,maxSideLength:a,cropLayout:d,cropping:r,url:c}=o,s=h=>typeof h?.value<"u"?h.value:h,u=()=>{if(c)return typeof c?.value<"u"?c.value:c},m=(h="base64")=>t.value?fr({type:h,outputType:n.value,outputSize:e.value,full:i.value,original:l.value,maxSideLength:a.value,sourceCanvas:t.value,url:u(),imgAxis:{...s(o.imgAxis)},imgLayout:{...s(o.imgLayout)},cropLayout:{...d.value},cropAxis:{...s(o.cropAxis)},cropping:r.value}):Promise.reject(new Error("No image canvas available"));return{getCropData:m,getCropBlob:()=>m("blob")}},Vt=o=>{typeof o=="string"&&o.startsWith("blob:")&&URL.revokeObjectURL(o)},Mr=async o=>{try{const t=new Image;if(t.src=o,typeof t.decode=="function"){await t.decode();return}await new Promise(n=>{t.onload=()=>n(),t.onerror=()=>n()})}catch{}},Cr=()=>new Promise(o=>{requestAnimationFrame(()=>o())}),_r=o=>{if(typeof window>"u")return 1;const t=(o?o():window.devicePixelRatio)||1;return Math.min(Math.max(1,t),2)},Sr=async(o,t)=>{const{previewMaxSide:n,getWrapLayout:e,getDevicePixelRatio:i}=t,l=Number(n),a=Number.isFinite(l)&&l>0?l:Number.POSITIVE_INFINITY,d=e(),r=Math.max(1,Math.max(d.width||0,d.height||0)*_r(i)),c=Math.max(o.width,o.height),s=Math.min(a,r),u=Math.min(1,s/Math.max(1,c));let m=o;if(u<1){const h=Math.max(1,Math.round(o.width*u)),f=Math.max(1,Math.round(o.height*u)),b=document.createElement("canvas");b.width=h,b.height=f;const y=b.getContext("2d");y.imageSmoothingEnabled=!0,"imageSmoothingQuality"in y&&(y.imageSmoothingQuality="high"),y.drawImage(o,0,0,h,f),m=b}return new Promise((h,f)=>{m.toBlob(async b=>{if(!b){f(new Error("Failed to create preview blob"));return}const y=URL.createObjectURL(b);await Mr(y),h(y)},"image/png",1)})},kr=o=>{const{canvas:t,imgs:n,imgLoading:e,cropping:i,filter:l,mode:a,defaultRotate:d,layout:r,updateWrapLayoutFromDom:c,createPreviewUrl:s,imgLoadEmit:u,renderCrop:m,reboundImg:h,queueRealTimeEmit:f}=o;let b=0,y=!1;const _=I=>{if(t.value){if(l.value){let R=t.value;R=l.value(R)??R,t.value=R}k(I)}},k=I=>{if(t.value)try{c(),r.imgLayout={width:t.value.width,height:t.value.height};const R=dr({...r.imgLayout},{...r.wrapLayout},a.value),q=jt({scale:R,imgStyle:{...r.imgLayout},layoutStyle:{...r.wrapLayout},rotate:ho(d.value)});r.imgExhibitionStyle=q.imgExhibitionStyle,r.imgAxis=q.imgAxis;const X=n.value;s(t.value).then(async G=>{if(y||I!==b){Vt(G);return}n.value=G,Vt(X),i.value&&m(),h(),f(),await Se(),await Cr(),e.value=!1}).catch(G=>{y||I!==b||(console.error(G),n.value="",e.value=!1)})}catch(R){console.error(R),e.value=!1}},S=async I=>{const R=++b;e.value=!0;const q=n.value;n.value="",Vt(q),t.value=null;let X;try{X=await rn(I),u({type:"success",message:"图片加载成功"})}catch(F){return u({type:"error",message:`图片加载失败${F}`}),e.value=!1,!1}let G={orientation:-1};try{G=await rr(X)}catch{G.orientation=1}let w=G.orientation||-1;w=sr(w);let T=document.createElement("canvas");try{T=lr(X,T,w)??T}catch(F){console.error(F)}return y||R!==b?(e.value=!1,!1):(t.value=T,_(R),!0)},V=()=>{y=!0,b+=1,Vt(n.value)};return Le(()=>{V()}),{checkedImg:S,markUnmounted:V}},Pr=o=>{const{cropperRef:t,isDrag:n,onUpload:e}=o,i=d=>{d.preventDefault();const r=d.dataTransfer;n.value=!1,cr(r.files[0]).then(c=>{c&&e(c)})},l=d=>{d.preventDefault(),n.value=!0},a=d=>{d.preventDefault(),n.value=!1};return He(()=>{const d=t.value;d&&(d.addEventListener("dragover",l,!1),d.addEventListener("dragend",a,!1),d.addEventListener("drop",i,!1))}),Le(()=>{t.value?.removeEventListener("drop",i,!1),t.value?.removeEventListener("dragover",l,!1),t.value?.removeEventListener("dragend",a,!1)}),{drop:i,dragover:l,dragend:a}},Ir=o=>{const{isIE:t,supportWheel:n,changeImgSize:e,setScale:i}=o,l=c=>typeof c?.value<"u"?c.value:c,a=c=>{c.preventDefault();const s=l(o.imgAxis),u=l(o.imgLayout),m=e(c,s.scale,u);i(m)},d=()=>{typeof window>"u"||(t?window.addEventListener(n,a):window.addEventListener(n,a,{passive:!1}))},r=()=>{typeof window>"u"||(window.removeEventListener(n,a),nn())};return Le(()=>{r()}),{mouseInCropper:d,mouseOutCropper:r}},Tr=o=>{const{img:t,imgs:n,imgLoading:e,cropping:i,filter:l,mode:a,defaultRotate:d,cropLayout:r,wrapperStyle:c,cropLayoutStyle:s,shouldShowCropBox:u,centerBox:m,centerWrapper:h,innerCropLayout:f,layout:b,checkedImg:y,bindMoveImg:_,bindMoveCrop:k,unbindMoveCrop:S,renderCrop:V,setImgAxis:I,reboundImg:R,updateWrapLayoutFromDom:q,normalizeRotate:X,setRotate:G}=o;ee(t,w=>{w&&w!==n.value&&y(w)}),ee(n,w=>{w&&(Se(()=>{_()}),i.value&&u.value&&Se(()=>{k()}))}),ee(i,w=>{w&&u.value&&Se(()=>{k()})}),ee(l,()=>{e.value=!0,y(t.value)}),ee(a,()=>{e.value=!0,y(t.value)}),ee(d,w=>{G(X(w))}),ee(r,w=>{f.value={...w}},{deep:!0}),ee(c,async()=>{await Se(),q(),n.value&&(i.value&&V({...b.cropAxis}),I({x:b.imgAxis.x,y:b.imgAxis.y}),R())},{deep:!0,flush:"post"}),ee(s,()=>{n.value&&(i.value&&V({...b.cropAxis}),R())},{deep:!0}),ee(u,w=>{if(n.value){if(w&&i.value){Se(()=>{k()});return}S()}},{flush:"post"}),ee(m,w=>{w&&R()}),ee(h,w=>{w&&R()})},Dr=o=>{const{imgs:t,img:n,imgLoading:e,layout:i,innerCropLayout:l,checkedImg:a,updateWrapLayoutFromDom:d,renderCrop:r,checkedCrop:c,reboundImg:s,setScale:u,queueRealTimeEmit:m}=o,h=.01,f=.1,b=(G=f)=>{const w=Math.abs(Number(G));return Number.isFinite(w)&&w>0?w:f},y=(G,w=!0)=>{const{x:T,y:F,scale:j}=i.imgAxis,N={x:T,y:F},g=jt({scale:j,imgStyle:{...i.imgLayout},layoutStyle:{...i.wrapLayout},rotate:G},N);i.imgExhibitionStyle=g.imgExhibitionStyle,i.imgAxis=g.imgAxis,m(),w&&t.value&&s()},_=()=>{y(i.imgAxis.rotate-90)},k=()=>{y(i.imgAxis.rotate+90)},S=()=>{y(0)},V=()=>n.value?a(n.value):(t.value="",e.value=!1,!1),I=G=>{y(ho(G))},R=G=>{l.value={...G},t.value&&(d(),r(),s())},q=G=>{t.value&&(d(),c({...G}),s())},X=(G=f)=>{if(!t.value)return;d();const w=Math.max(h,i.imgAxis.scale+Number(G));u(Number.isFinite(w)?w:i.imgAxis.scale)};return{setRotate:y,rotateLeft:_,rotateRight:k,rotateClear:S,reload:V,setRotateAngle:I,setCropLayout:R,setCropAxis:q,changeScale:X,zoomIn:(G=f)=>{X(i.imgAxis.scale*b(G))},zoomOut:(G=f)=>{X(-i.imgAxis.scale*b(G))}}},Lr=()=>({imgLayout:{width:0,height:0},wrapLayout:{width:0,height:0},imgAxis:{x:0,y:0,scale:0,rotate:0},imgExhibitionStyle:{width:"",height:"",transform:""},cropAxis:{x:0,y:0},cropExhibitionStyle:{div:{},img:{}}}),Fr=o=>{const{centerBox:t,centerWrapper:n,centerBoxDelay:e,centerWrapperDelay:i}=o;return{getBoundaryDuration:()=>t.value?Math.max(0,e.value):n.value?Math.max(0,i.value):to}},Er=o=>{const{previewMaxSide:t,getWrapLayout:n}=o;return{createPreviewUrl:e=>Sr(e,{previewMaxSide:t.value,getWrapLayout:n})}},Ar=o=>({imgLoadEmit:t=>{o("img-load",t)},imgUploadEmit:t=>{o("img-upload",t)},emitRealTime:(t,n)=>{if(t==="real-time"){o("real-time",n);return}o("realTime",n)}}),Br=["onMouseover","onMouseout"],Vr={key:0,class:"cropper-box cropper-fade-in"},Rr=["src"],Or=["src"],zr={key:2,class:"cropper-full-mask cropper-fade-in"},Nr={key:3,class:"drag"},qr=te({__name:"vue-cropper",props:{img:{default:""},wrapper:{default:()=>({width:300,height:300})},cropLayout:{default:()=>({width:200,height:200})},color:{default:"#fff"},filter:{type:[Function,null],default:null},outputType:{default:"png"},outputSize:{default:1},full:{type:Boolean,default:!0},original:{type:Boolean,default:!1},maxSideLength:{default:3e3},previewMaxSide:{default:2048},mode:{default:"cover"},cropColor:{default:"#fff"},defaultRotate:{default:0},centerBox:{type:Boolean,default:!1},centerWrapper:{type:Boolean,default:!1},centerBoxDelay:{default:to},centerWrapperDelay:{default:to}},emits:["img-load","img-upload","real-time","realTime"],setup(o,{expose:t,emit:n}){const e=o,i=B(),l=B(),a=B(),d=n,r=B(!1),c=B(""),s=B(null),u=_t(Lr()),m=B(!1),h=B(!0),{img:f,filter:b,mode:y,defaultRotate:_,outputType:k,outputSize:S,full:V,original:I,maxSideLength:R,previewMaxSide:q,centerBox:X,cropLayout:G,centerWrapper:w,centerBoxDelay:T,centerWrapperDelay:F}=lo(e),{wrapperStyle:j,innerCropLayout:N,cropLayoutStyle:g,effectiveCropLayoutStyle:W,shouldShowCropBox:oe,isFullCropMode:$,updateWrapLayoutFromDom:ue}=Zi({props:e,cropperRef:i,layoutContainer:u,imgs:c,cropping:h}),{getBoundaryDuration:Ge}=Fr({centerBox:X,centerWrapper:w,centerBoxDelay:T,centerWrapperDelay:F}),{imgLoadEmit:Ie,imgUploadEmit:Re,emitRealTime:Oe}=Ar(d),{queueRealTimeEmit:Te}=br({imgs:c,cropping:h,effectiveCropLayoutStyle:W,layout:u,emit:Oe}),{bindMoveImg:ze,unbindMoveImg:Ne,bindMoveCrop:ke,unbindMoveCrop:Je,setScale:Fe,setImgAxis:z,reboundImg:ae,checkedCrop:se}=yr({cropperImg:l,cropperBox:a,layout:u,cropping:h,centerBox:X,centerWrapper:w,effectiveCropLayoutStyle:W,getBoundaryDuration:Ge,queueRealTimeEmit:Te});Pr({cropperRef:i,isDrag:m,onUpload:Re});const{renderCrop:ce,computedClassDrag:Ee,getCropBoxStyle:qe,getCropImgStyle:we}=wr({layout:u,imgs:c,cropping:h,cropLayoutStyle:g,effectiveCropLayoutStyle:W,shouldShowCropBox:oe,checkedCrop:se,queueRealTimeEmit:Te}),Qe=ht(u,"imgAxis"),Ke=ht(u,"imgLayout"),ye=ht(u,"cropAxis"),{getCropData:Ue,getCropBlob:$e}=xr({canvas:s,outputType:k,outputSize:S,full:V,original:I,maxSideLength:R,imgAxis:Qe,imgLayout:Ke,cropAxis:ye,cropLayout:W,cropping:h,url:f}),{createPreviewUrl:wt}=Er({previewMaxSide:q,getWrapLayout:()=>(ue(),{...u.wrapLayout})}),{checkedImg:st}=kr({canvas:s,imgs:c,imgLoading:r,cropping:h,filter:b,mode:y,defaultRotate:_,layout:u,updateWrapLayoutFromDom:ue,createPreviewUrl:wt,imgLoadEmit:Ie,renderCrop:()=>ce(),reboundImg:ae,queueRealTimeEmit:Te}),{mouseInCropper:ct,mouseOutCropper:A}=Ir({isIE:on,supportWheel:Yi,changeImgSize:Ki,imgAxis:Qe,imgLayout:Ke,setScale:Fe});Tr({img:f,imgs:c,imgLoading:r,cropping:h,filter:b,mode:y,defaultRotate:_,cropLayout:G,wrapperStyle:j,cropLayoutStyle:g,shouldShowCropBox:oe,centerBox:X,centerWrapper:w,innerCropLayout:N,layout:u,checkedImg:st,bindMoveImg:ze,bindMoveCrop:ke,unbindMoveCrop:Je,renderCrop:ce,setImgAxis:z,reboundImg:ae,updateWrapLayoutFromDom:ue,normalizeRotate:ho,setRotate:tt=>Y(tt)});const{setRotate:Y,rotateLeft:Z,rotateRight:re,rotateClear:ne,reload:fe,setRotateAngle:Me,setCropLayout:Be,setCropAxis:Xe,changeScale:dt,zoomIn:et,zoomOut:mt}=Dr({imgs:c,img:f,imgLoading:r,layout:u,innerCropLayout:N,checkedImg:st,updateWrapLayoutFromDom:ue,renderCrop:ce,checkedCrop:se,reboundImg:ae,setScale:Fe,queueRealTimeEmit:Te});He(()=>{e.img?st(e.img):c.value=""}),Le(()=>{Ne(),Je()});const ft=Rn();return t({getCropData:Ue,getCropBlob:$e,rotateLeft:Z,rotateRight:re,rotateClear:ne,reload:fe,setRotateAngle:Me,setCropLayout:Be,setCropAxis:Xe,changeScale:dt,zoomIn:et,zoomOut:mt}),(tt,Lt)=>(v(),L("section",{class:"vue-cropper",style:Pe(U(j)),ref_key:"cropperRef",ref:i,onMouseover:U(ct),onMouseout:U(A)},[c.value?(v(),L("section",Vr,[p("section",{class:"cropper-box-canvas",style:Pe(u.imgExhibitionStyle)},[p("img",{src:c.value,alt:"cropper-next-vue"},null,8,Rr)],4),p("section",{class:le(U(Ee)()),ref_key:"cropperImg",ref:l},null,2)])):O("",!0),h.value&&c.value&&U(oe)?(v(),L("section",{key:1,class:"cropper-crop-box cropper-fade-in",style:Pe(U(qe)())},[p("span",{class:"cropper-view-box",style:Pe({outlineColor:o.cropColor})},[U(f)?(v(),L("img",{key:0,src:c.value,style:Pe(U(we)()),alt:"cropper-img"},null,12,Or)):O("",!0)],4),p("span",{class:"cropper-face cropper-move",ref_key:"cropperBox",ref:a},null,512)],4)):O("",!0),U($)?(v(),L("section",zr)):O("",!0),m.value?(v(),L("section",Nr,[me(tt.$slots,"drag",{},()=>[Lt[0]||(Lt[0]=p("p",null,"拖动图片到此",-1))])])):O("",!0),C(U(Ji),{"is-visible":r.value},On({_:2},[U(ft).loading?{name:"default",fn:M(()=>[me(tt.$slots,"loading")]),key:"0"}:void 0]),1032,["is-visible"])],44,Br))}});typeof window<"u"&&(window.requestAnimationFrame||(window.requestAnimationFrame=o=>window.setTimeout(o,17)),window.cancelAnimationFrame||(window.cancelAnimationFrame=o=>{window.clearTimeout(o)}));const Ur=te({__name:"CoverCropDialog",props:{open:{type:Boolean,required:!0},item:{type:[Object,null],required:!0}},emits:["u