重新编译

This commit is contained in:
Chen committed 2025-12-07 10:17:17 +08:00
1 parent 8ac08c41a7
commit b606190e0c
25 files changed
+3679 -29

No files matched your search

-1
View File
@@ -46,7 +46,6 @@ Knowledge base/
# 构建输出
dist/
flypic/
flypic.zip
# 测试数据
+2
View File
@@ -8,12 +8,14 @@
"start": "node --expose-gc server.js"
},
"dependencies": {
"bcrypt": "^5.1.1",
"better-sqlite3": "^9.2.2",
"chokidar": "^3.6.0",
"cors": "^2.8.5",
"crypto": "^1.0.1",
"express": "^4.18.2",
"glob": "^10.3.10",
"jsonwebtoken": "^9.0.2",
"multer": "^2.0.0-rc.4",
"p-limit": "^7.2.0",
"sharp": "^0.33.0",
+30
View File
@@ -67,6 +67,27 @@ class LibraryDatabase {
// 列已存在,忽略错误
}
// 添加 rating 列(如果不存在)
try {
this.db.exec(`ALTER TABLE images ADD COLUMN rating INTEGER DEFAULT 0`);
} catch (e) {
// 列已存在,忽略错误
}
// 添加 favorite 列(如果不存在)
try {
this.db.exec(`ALTER TABLE images ADD COLUMN favorite INTEGER DEFAULT 0`);
} catch (e) {
// 列已存在,忽略错误
}
// 添加 tags 列(如果不存在)
try {
this.db.exec(`ALTER TABLE images ADD COLUMN tags TEXT DEFAULT ''`);
} catch (e) {
// 列已存在,忽略错误
}
// Folders table
this.db.exec(`
CREATE TABLE IF NOT EXISTS folders (
@@ -89,6 +110,9 @@ class LibraryDatabase {
CREATE INDEX IF NOT EXISTS idx_folder_parent ON folders(parent_path);
-- 复合索引:优化文件夹+时间排序查询
CREATE INDEX IF NOT EXISTS idx_folder_created ON images(folder, created_at DESC);
-- 评分和收藏索引:优化筛选查询
CREATE INDEX IF NOT EXISTS idx_rating ON images(rating DESC);
CREATE INDEX IF NOT EXISTS idx_favorite ON images(favorite DESC);
`);
// Metadata table for tracking database modifications
@@ -171,6 +195,12 @@ class LibraryDatabase {
return stmt.get(imagePath);
}
getImagesByFolderPrefix(folderPath) {
// 获取文件夹内所有图片记录(包括子文件夹)
const stmt = this.db.prepare('SELECT * FROM images WHERE folder = ? OR folder LIKE ?');
return stmt.all(folderPath, `${folderPath}/%`);
}
getAllImages() {
// ⚠️ 警告:此方法会加载所有图片到内存,仅用于调试!
// 生产环境请使用 searchImages() 或流式查询
+1285 -6
View File
File diff suppressed because it is too large. Load diff
+5 -1
View File
@@ -8,15 +8,19 @@
"start": "node --expose-gc server.js"
},
"dependencies": {
"bcrypt": "^5.1.1",
"better-sqlite3": "^9.2.2",
"chokidar": "^3.6.0",
"cors": "^2.8.5",
"crypto": "^1.0.1",
"express": "^4.18.2",
"glob": "^10.3.10",
"jsonwebtoken": "^9.0.2",
"multer": "^2.0.0-rc.4",
"p-limit": "^7.2.0",
"sharp": "^0.33.0",
"socket.io": "^4.6.0"
"socket.io": "^4.6.0",
"trash": "^8.1.1"
},
"devDependencies": {
"cross-env": "^7.0.3",
Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

@@ -0,0 +1,292 @@
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Pi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Su(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Df={exports:{}},Qo={},Mf={exports:{}},Ke={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var _i=Symbol.for("react.element"),e0=Symbol.for("react.portal"),t0=Symbol.for("react.fragment"),n0=Symbol.for("react.strict_mode"),r0=Symbol.for("react.profiler"),s0=Symbol.for("react.provider"),i0=Symbol.for("react.context"),o0=Symbol.for("react.forward_ref"),a0=Symbol.for("react.suspense"),l0=Symbol.for("react.memo"),u0=Symbol.for("react.lazy"),Ic=Symbol.iterator;function c0(e){return e===null||typeof e!="object"?null:(e=Ic&&e[Ic]||e["@@iterator"],typeof e=="function"?e:null)}var Bf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Uf=Object.assign,$f={};function Cs(e,t,n){this.props=e,this.context=t,this.refs=$f,this.updater=n||Bf}Cs.prototype.isReactComponent={};Cs.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Cs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Wf(){}Wf.prototype=Cs.prototype;function Cu(e,t,n){this.props=e,this.context=t,this.refs=$f,this.updater=n||Bf}var Eu=Cu.prototype=new Wf;Eu.constructor=Cu;Uf(Eu,Cs.prototype);Eu.isPureReactComponent=!0;var Ac=Array.isArray,Hf=Object.prototype.hasOwnProperty,Nu={current:null},Vf={key:!0,ref:!0,__self:!0,__source:!0};function qf(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)Hf.call(t,r)&&!Vf.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1<a){for(var l=Array(a),d=0;d<a;d++)l[d]=arguments[d+2];s.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)s[r]===void 0&&(s[r]=a[r]);return{$$typeof:_i,type:e,key:i,ref:o,props:s,_owner:Nu.current}}function d0(e,t){return{$$typeof:_i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ju(e){return typeof e=="object"&&e!==null&&e.$$typeof===_i}function f0(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Pc=/\/+/g;function _a(e,t){return typeof e=="object"&&e!==null&&e.key!=null?f0(""+e.key):t.toString(36)}function io(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case _i:case e0:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+_a(o,0):r,Ac(s)?(n="",e!=null&&(n=e.replace(Pc,"$&/")+"/"),io(s,t,n,"",function(d){return d})):s!=null&&(ju(s)&&(s=d0(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(Pc,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",Ac(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+_a(i,a);o+=io(i,t,n,l,s)}else if(l=c0(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+_a(i,a++),o+=io(i,t,n,l,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Li(e,t,n){if(e==null)return e;var r=[],s=0;return io(e,r,"","",function(i){return t.call(n,i,s++)}),r}function h0(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Vt={current:null},oo={transition:null},p0={ReactCurrentDispatcher:Vt,ReactCurrentBatchConfig:oo,ReactCurrentOwner:Nu};function Kf(){throw Error("act(...) is not supported in production builds of React.")}Ke.Children={map:Li,forEach:function(e,t,n){Li(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Li(e,function(){t++}),t},toArray:function(e){return Li(e,function(t){return t})||[]},only:function(e){if(!ju(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ke.Component=Cs;Ke.Fragment=t0;Ke.Profiler=r0;Ke.PureComponent=Cu;Ke.StrictMode=n0;Ke.Suspense=a0;Ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=p0;Ke.act=Kf;Ke.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Uf({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Nu.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)Hf.call(t,l)&&!Vf.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var d=0;d<l;d++)a[d]=arguments[d+2];r.children=a}return{$$typeof:_i,type:e.type,key:s,ref:i,props:r,_owner:o}};Ke.createContext=function(e){return e={$$typeof:i0,_currentValue:e,_currentValue2:e,_threadCountLine truncated
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var m0=F,g0=Symbol.for("react.element"),y0=Symbol.for("react.fragment"),v0=Object.prototype.hasOwnProperty,x0=m0.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,w0={key:!0,ref:!0,__self:!0,__source:!0};function Zf(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)v0.call(t,r)&&!w0.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:g0,type:e,key:i,ref:o,props:s,_owner:x0.current}}Qo.Fragment=y0;Qo.jsx=Zf;Qo.jsxs=Zf;Df.exports=Qo;var u=Df.exports,ul={},Xf={exports:{}},ln={},Yf={exports:{}},Gf={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(e){function t(B,M){var te=B.length;B.push(M);e:for(;0<te;){var P=te-1>>>1,A=B[P];if(0<s(A,M))B[P]=M,B[te]=A,te=P;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var M=B[0],te=B.pop();if(te!==M){B[0]=te;e:for(var P=0,A=B.length,ie=A>>>1;P<ie;){var J=2*(P+1)-1,oe=B[J],_e=J+1,ae=B[_e];if(0>s(oe,te))_e<A&&0>s(ae,oe)?(B[P]=ae,B[_e]=te,P=_e):(B[P]=oe,B[J]=te,P=J);else if(_e<A&&0>s(ae,te))B[P]=ae,B[_e]=te,P=_e;else break e}}return M}function s(B,M){var te=B.sortIndex-M.sortIndex;return te!==0?te:B.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],d=[],p=1,v=null,x=3,y=!1,g=!1,c=!1,w=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(B){for(var M=n(d);M!==null;){if(M.callback===null)r(d);else if(M.startTime<=B)r(d),M.sortIndex=M.expirationTime,t(l,M);else break;M=n(d)}}function _(B){if(c=!1,b(B),!g)if(n(l)!==null)g=!0,re(S);else{var M=n(d);M!==null&&Y(_,M.startTime-B)}}function S(B,M){g=!1,c&&(c=!1,f(L),L=-1),y=!0;var te=x;try{for(b(M),v=n(l);v!==null&&(!(v.expirationTime>M)||B&&!le());){var P=v.callback;if(typeof P=="function"){v.callback=null,x=v.priorityLevel;var A=P(v.expirationTime<=M);M=e.unstable_now(),typeof A=="function"?v.callback=A:v===n(l)&&r(l),b(M)}else r(l);v=n(l)}if(v!==null)var ie=!0;else{var J=n(d);J!==null&&Y(_,J.startTime-M),ie=!1}return ie}finally{v=null,x=te,y=!1}}var T=!1,j=null,L=-1,O=5,D=-1;function le(){return!(e.unstable_now()-D<O)}function R(){if(j!==null){var B=e.unstable_now();D=B;var M=!0;try{M=j(!0,B)}finally{M?Z():(T=!1,j=null)}}else T=!1}var Z;if(typeof h=="function")Z=function(){h(R)};else if(typeof MessageChannel<"u"){var k=new MessageChannel,U=k.port2;k.port1.onmessage=R,Z=function(){U.postMessage(null)}}else Z=function(){w(R,0)};function re(B){j=B,T||(T=!0,Z())}function Y(B,M){L=w(function(){B(e.unstable_now())},M)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(B){B.callback=null},e.unstable_continueExecution=function(){g||y||(g=!0,re(S))},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(B){switch(x){case 1:case 2:case 3:var M=3;break;default:M=x}var te=x;x=M;try{return B()}finally{x=te}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(B,M){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var te=x;x=B;try{return M()}finally{x=te}},e.unstable_scheduleCallback=function(B,M,te){var P=e.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?P+te:P):te=P,B){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=te+A,B={id:p++,callback:M,priorityLevel:B,startTime:te,expirationTime:A,sortIndex:-1},te>P?(B.sortIndex=te,t(d,B),n(l)===null&&B===n(d)&&(c?(f(L),L=-1):c=!0,Y(_,te-P))):(B.sortIndex=A,t(l,B),g||y||(g=!0,re(S))),B},e.unstable_shouldYield=le,e.unstable_wrapCallback=function(B){var M=x;return function(){var te=x;x=M;try{return B.apply(this,arguments)}finally{x=te}}}})(Gf);Yf.exports=Gf;var b0=Yf.exports;/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var k0=F,an=b0;function me(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Qf=new Set,si={};function Wr(e,t){gs(e,t),gs(e+"Capture",t)}function gs(e,t){for(si[e]=t,e=0;e<t.length;e++)Qf.add(t[e])}var Qn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cl=Object.prototype.hasOwnProperty,_0=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Lc={},zc={};function S0(e){return cl.call(zc,e)?!0:cl.call(Lc,e)?!1:_0.test(e)?zc[e]=!0:(Lc[e]=!0,!1)}function C0(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function E0(e,t,n,r){if(t===null||typeof t>"u"||C0(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function qt(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var It={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){It[e]=new qt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];It[t]=new qt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){It[e]=new qt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){It[e]=new qt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){It[e]=new qt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){It[e]=new qt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){It[e]=new qt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){It[e]=new qt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){It[e]=new qt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ru=/[\-:]([a-z])/g;function Tu(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Ru,Tu);It[t]=new qt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Ru,Tu);It[t]=new qt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Ru,Tu);It[t]=new qt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){It[e]=new qt(e,1,!1,e.toLowerCase(),null,!1,!1)});It.xlinkHref=new qt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){It[e]=new qt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ou(e,t,n,r){var s=It.hasOwnProperty(t)?It[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!== Line truncated
`+Sa+e}var Ca=!1;function Ea(e,t){if(!e||Ca)return"";Ca=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}catch(d){if(d&&r&&typeof d.stack=="string"){for(var s=d.stack.split(`
`),i=r.stack.split(`
`),o=s.length-1,a=i.length-1;1<=o&&0<=a&&s[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||s[o]!==i[a]){var l=`
`+s[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{Ca=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Hs(e):""}function N0(e){switch(e.tag){case 5:return Hs(e.type);case 16:return Hs("Lazy");case 13:return Hs("Suspense");case 19:return Hs("SuspenseList");case 0:case 2:case 15:return e=Ea(e.type,!1),e;case 11:return e=Ea(e.type.render,!1),e;case 1:return e=Ea(e.type,!0),e;default:return""}}function pl(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Gr:return"Fragment";case Yr:return"Portal";case dl:return"Profiler";case Iu:return"StrictMode";case fl:return"Suspense";case hl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case eh:return(e.displayName||"Context")+".Consumer";case Jf:return(e._context.displayName||"Context")+".Provider";case Au:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Pu:return t=e.displayName||null,t!==null?t:pl(e.type)||"Memo";case sr:t=e._payload,e=e._init;try{return pl(e(t))}catch{}}return null}function j0(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return pl(t);case 8:return t===Iu?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function kr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function nh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function R0(e){var t=nh(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Fi(e){e._valueTracker||(e._valueTracker=R0(e))}function rh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=nh(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Eo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ml(e,t){var n=t.checked;return mt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Dc(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=kr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function sh(e,t){t=t.checked,t!=null&&Ou(e,"checked",t,!1)}function gl(e,t){sh(e,t);var n=kr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?yl(e,t.type,n):t.hasOwnProperty("defaultValue")&&yl(e,t.type,kr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Mc(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function yl(e,t,n){(t!=="number"||Eo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Vs=Array.isArray;function us(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+kr(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function vl(e,t){if(t.dan Line truncated
`).replace(Mg,"")}function Vi(e,t,n){if(t=ld(t),ld(e)!==t&&n)throw Error(me(425))}function Po(){}var Ol=null,Il=null;function Al(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Pl=typeof setTimeout=="function"?setTimeout:void 0,Bg=typeof clearTimeout=="function"?clearTimeout:void 0,ud=typeof Promise=="function"?Promise:void 0,Ug=typeof queueMicrotask=="function"?queueMicrotask:typeof ud<"u"?function(e){return ud.resolve(null).then(e).catch($g)}:Pl;function $g(e){setTimeout(function(){throw e})}function Ma(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),ui(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);ui(t)}function mr(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function cd(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Ns=Math.random().toString(36).slice(2),Mn="__reactFiber$"+Ns,pi="__reactProps$"+Ns,Jn="__reactContainer$"+Ns,Ll="__reactEvents$"+Ns,Wg="__reactListeners$"+Ns,Hg="__reactHandles$"+Ns;function Tr(e){var t=e[Mn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Jn]||n[Mn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=cd(e);e!==null;){if(n=e[Mn])return n;e=cd(e)}return t}e=n,n=e.parentNode}return null}function Ei(e){return e=e[Mn]||e[Jn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ts(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(me(33))}function ra(e){return e[pi]||null}var zl=[],ns=-1;function Cr(e){return{current:e}}function ut(e){0>ns||(e.current=zl[ns],zl[ns]=null,ns--)}function it(e,t){ns++,zl[ns]=e.current,e.current=t}var _r={},Dt=Cr(_r),Yt=Cr(!1),Fr=_r;function ys(e,t){var n=e.type.contextTypes;if(!n)return _r;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Gt(e){return e=e.childContextTypes,e!=null}function Lo(){ut(Yt),ut(Dt)}function dd(e,t,n){if(Dt.current!==_r)throw Error(me(168));it(Dt,t),it(Yt,n)}function qh(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(me(108,j0(e)||"Unknown",s));return mt({},n,r)}function zo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_r,Fr=Dt.current,it(Dt,e),it(Yt,Yt.current),!0}function fd(e,t,n){var r=e.stateNode;if(!r)throw Error(me(169));n?(e=qh(e,t,Fr),r.__reactInternalMemoizedMergedChildContext=e,ut(Yt),ut(Dt),it(Dt,e)):ut(Yt),it(Yt,n)}var Kn=null,sa=!1,Ba=!1;function Kh(e){Kn===null?Kn=[e]:Kn.push(e)}function Vg(e){sa=!0,Kh(e)}function Er(){if(!Ba&&Kn!==null){Ba=!0;var e=0,t=rt;try{var n=Kn;for(rt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Kn=null,sa=!1}catch(s){throw Kn!==null&&(Kn=Kn.slice(e+1)),vh(zu,Er),s}finally{rt=t,Ba=!1}}return null}var rs=[],ss=0,Fo=null,Do=0,pn=[],mn=0,Dr=null,Zn=1,Xn="";function Nr(e,t){rs[ss++]=Do,rs[ss++]=Fo,Fo=e,Do=t}function Zh(e,t,n){pn[mn++]=Zn,pn[mn++]=Xn,pn[mn++]=Dr,Dr=e;var r=Zn;e=Xn;var s=32-Tn(r)-1;r&=~(1<<s),n+=1;var i=32-Tn(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,Zn=1<<32-Tn(t)+s|n<<s|r,Xn=i+e}else Zn=1<<i|n<<s|r,Xn=e}function Vu(e){e.return!==null&&(Nr(e,1),Zh(e,1,0))}function qu(e){for(;e===Fo;)Fo=rs[--ss],rs[ss]=null,Do=rs[--ss],rs[ss]=null;for(;e===Dr;)Dr=pn[--mn],pn[mn]=null,Xn=pn[--mn],pn[mn]=null,Zn=pn[--mn],pn[mn]=null}var on=null,sn=null,dt=!1,jn=null;function Xh(e,t){var n=vn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function hd(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,on=e,sn=mr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,on=e,sn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Dr!==null?{id:Zn,overflow:Xn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=vn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,on=e,sn=null,!0):!1;default:return!1}}function Fl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Dl(e){if(dt){var t=sn;if(t){var n=t;if(!hd(e,t)){if(Fl(e))throw Error(me(418));t=mr(n.nextSibling);var r=on;t&&hd(e,t)?Xh(r,n):(e.flags=e.flags&-4097|2,dt=!1,on=e)}}else{if(Fl(e))throw Error(me(418));e.flags=e.flags&-4097|2,dt=!1,on=e}}}function pd(e){ Line truncated
Error generating stack: `+i.message+`
`+i.stack}return{value:e,source:t,stack:s,digest:null}}function Va(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function $l(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var ey=typeof WeakMap=="function"?WeakMap:Map;function kp(e,t,n){n=Gn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){qo||(qo=!0,Ql=r),$l(e,t)},n}function _p(e,t,n){n=Gn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){$l(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){$l(e,t),typeof r!="function"&&(yr===null?yr=new Set([this]):yr.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function kd(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ey;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=py.bind(null,e,t,n),t.then(e,e))}function _d(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Sd(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Gn(-1,1),t.tag=2,gr(n,t,1))),n.lanes|=1),e)}var ty=nr.ReactCurrentOwner,Xt=!1;function $t(e,t,n,r){t.child=e===null?Qh(t,null,n,r):xs(t,e.child,n,r)}function Cd(e,t,n,r,s){n=n.render;var i=t.ref;return hs(t,s),r=rc(e,t,n,r,i,s),n=sc(),e!==null&&!Xt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,tr(e,t,s)):(dt&&n&&Vu(t),t.flags|=1,$t(e,t,r,s),t.child)}function Ed(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!pc(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Sp(e,t,i,r,s)):(e=yo(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:di,n(o,r)&&e.ref===t.ref)return tr(e,t,s)}return t.flags|=1,e=xr(i,r),e.ref=t.ref,e.return=t,t.child=e}function Sp(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(di(i,r)&&e.ref===t.ref)if(Xt=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Xt=!0);else return t.lanes=e.lanes,tr(e,t,s)}return Wl(e,t,n,r,s)}function Cp(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},it(as,rn),rn|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,it(as,rn),rn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,it(as,rn),rn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,it(as,rn),rn|=r;return $t(e,t,s,n),t.child}function Ep(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Wl(e,t,n,r,s){var i=Gt(n)?Fr:Dt.current;return i=ys(t,i),hs(t,s),n=rc(e,t,n,r,i,s),r=sc(),e!==null&&!Xt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,tr(e,t,s)):(dt&&r&&Vu(t),t.flags|=1,$t(e,t,n,s),t.child)}function Nd(e,t,n,r,s){if(Gt(n)){var i=!0;zo(t)}else i=!1;if(hs(t,s),t.stateNode===null)po(e,t),bp(t,n,r),Ul(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,d=n.contextType;typeof d=="object"&&d!==null?d=wn(d):(d=Gt(n)?Fr:Dt.current,d=ys(t,d));var p=n.getDerivedStateFromProps,v=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function";v||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==d)&&bd(t,o,r,d),ir=!1;var x=t.memoizedState;o.state=x,Uo(t,r,o,s),l=t.memoizedState,a!==r||x!==l||Yt.current||ir?(typeof p=="function"&&(Bl(t,n,p,r),l=t.memoizedState),(a=ir||wd(t,n,a,r,x,l,d))?(v||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),o.props=r,o.state=l,o.context=d,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,ep(e,t),a=t.memoizedProps,d=t.type===t.elementType?a:Cn(t.type,a),o.props=d,v=t.pendingProps,x=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=wn(l):(l=Gt(n)?Fr:Dt.current,l=ys(t,l));var y=n.getDerivedStateFromProps;(p=typeof y=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==v||x!==l)&&bd(t,o,r,l),ir=!1,x=t.memoizedState,o.state=x,Uo(t,r,o,s);var g=t.memoizedS Line truncated
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var _s=F;function wv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var bv=typeof Object.is=="function"?Object.is:wv,kv=_s.useState,_v=_s.useEffect,Sv=_s.useLayoutEffect,Cv=_s.useDebugValue;function Ev(e,t){var n=t(),r=kv({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return Sv(function(){s.value=n,s.getSnapshot=t,Qa(s)&&i({inst:s})},[e,n,t]),_v(function(){return Qa(s)&&i({inst:s}),e(function(){Qa(s)&&i({inst:s})})},[e]),Cv(n),n}function Qa(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!bv(e,n)}catch{return!0}}function Nv(e,t){return t()}var jv=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Nv:Ev;hm.useSyncExternalStore=_s.useSyncExternalStore!==void 0?_s.useSyncExternalStore:jv;fm.exports=hm;var Rv=fm.exports;/**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var ga=F,Tv=Rv;function Ov(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Iv=typeof Object.is=="function"?Object.is:Ov,Av=Tv.useSyncExternalStore,Pv=ga.useRef,Lv=ga.useEffect,zv=ga.useMemo,Fv=ga.useDebugValue;dm.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=Pv(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=zv(function(){function l(y){if(!d){if(d=!0,p=y,y=r(y),s!==void 0&&o.hasValue){var g=o.value;if(s(g,y))return v=g}return v=y}if(g=v,Iv(p,y))return g;var c=r(y);return s!==void 0&&s(g,c)?(p=y,g):(p=y,v=c)}var d=!1,p,v,x=n===void 0?null:n;return[function(){return l(t())},x===null?void 0:function(){return l(x())}]},[t,n,r,s]);var a=Av(e,i[0],i[1]);return Lv(function(){o.hasValue=!0,o.value=a},[a]),Fv(a),a};cm.exports=dm;var Dv=cm.exports;const Mv=Su(Dv),pm={},{useDebugValue:Bv}=Ve,{useSyncExternalStoreWithSelector:Uv}=Mv;let Kd=!1;const $v=e=>e;function Wv(e,t=$v,n){(pm?"production":void 0)!=="production"&&n&&!Kd&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Kd=!0);const r=Uv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Bv(r),r}const Zd=e=>{(pm?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?xv(e):e,n=(r,s)=>Wv(t,r,s);return Object.assign(n,t),n},Rs=e=>e?Zd(e):Zd,Wt=Rs(e=>({theme:"light",mobileView:"main",thumbnailHeight:200,isResizingPanels:!1,resizingSide:null,setTheme:t=>e({theme:t}),toggleTheme:()=>e(t=>({theme:t.theme==="light"?"dark":"light"})),setMobileView:t=>e({mobileView:t}),setThumbnailHeight:t=>e({thumbnailHeight:t}),setIsResizingPanels:t=>e({isResizingPanels:t}),setResizingSide:t=>e({resizingSide:t})})),Rn=Rs((e,t)=>({libraries:[],currentLibraryId:null,showAddLibraryForm:!1,expandLibrarySelector:!1,setLibraries:n=>e({libraries:n}),setCurrentLibrary:n=>e({currentLibraryId:n}),setShowAddLibraryForm:n=>e({showAddLibraryForm:n}),triggerExpandLibrarySelector:()=>e({expandLibrarySelector:!0}),resetExpandLibrarySelector:()=>e({expandLibrarySelector:!1}),addLibrary:n=>e(r=>({libraries:[...r.libraries,n]})),removeLibrary:n=>e(r=>({libraries:r.libraries.filter(s=>s.id!==n),currentLibraryId:r.currentLibraryId===n?null:r.currentLibraryId})),updateLibrary:(n,r)=>e(s=>({libraries:s.libraries.map(i=>i.id===n?{...i,...r}:i)})),getCurrentLibrary:()=>{const{libraries:n,currentLibraryId:r}=t();return n.find(s=>s.id===r)}})),Ee=Rs((e,t)=>({images:[],selectedImage:null,selectedImages:[],totalImageCount:0,totalSize:0,folders:[],selectedFolder:null,selectedFolderItem:null,searchKeywords:"",filters:{formats:[],sizes:[],orientations:[],ratings:[]},originalImages:[],imageLoadingState:{isLoading:!1,loadedCount:0,totalCount:0,hasMore:!1},renamingImage:null,setImages:n=>e({images:n}),setOriginalImages:n=>e({originalImages:n}),appendImages:n=>e(r=>({images:[...r.images,...n],originalImages:[...r.originalImages,...n]})),clearImages:()=>e({images:[],originalImages:[]}),setSelectedImage:n=>e({selectedImage:n}),setSelectedImages:n=>e({selectedImages:n}),toggleImageSelection:n=>e(r=>({selectedImages:r.selectedImages.some(i=>i.path===n.path)?r.selectedImages.filter(i=>i.path!==n.path):[...r.selectedImages,n]})),clearSelection:()=>e({selectedImages:[],selectedImage:null,selectedFolderItem:null}),setFolders:n=>e({folders:n}),setSelectedFolder:n=>e({selectedFolder:n}),setSelectedFolderItem:n=>e({selectedFolderItem:n}),setSearchKeywords:n=>e({searchKeywords:n}),setFilters:n=>e(r=>({filters:{...r.filters,...n}})),resetFilters:()=>e({searchKeywords:"",filters:{formats:[],sizes:[],orientations:[],ratings:[]}}),setTotalImageCount:n=>e({totalImageCount:n}),setTotalSize:n=>e({totalSize:n}),setImageLoadingState:n=>e(r=>({imageLoadingState:{...r.imageLoadingState,...n}})),setRenamingImage:n=>e({renamingImage:n}),updateImage:(n,r)=>e(s=>{var i;return{images:s.images.map(o=>o.path===n?{...o,...r}:o),selectedImage:((i=s.selectedImage)==null?void 0:i.path)===n?{...s.selectedImage,...r}:s.selectedImage}})})),or=Rs((e,t)=>({scanProgress:null,scanStartTime:null,setScanProgress:n=>e(r=>n&&!r.scanStartTime&&n.current>0?{scanProgress:n,scanStartTime:Date.now()}:n?{scanProgress:n}:{scanProgress:null,scanStartTime:null}),clearScanProgress:()=>e({scanProgress:null,scanStartTime:null}),getEstimatedTimeLeft:()=>{const{scanProgress:n,scanStartTime:r}=t();if(!n||!r||n.current===0)return null;const s=Date.now()-r,i=n.current/s,o=n.total-n.current;return Math.ceil(o/i/1e3)},isScanning:()=>{const{scanProgress:n}=t();return n&&n.status!=="preparing"}})),Hv="/api";class Ja extends Error{constructor(t,n,r){super(t),this.name="APIError",this.status=n,this.data=r}}function Sc(){return localStorage.getItem("flypiLine truncated
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&b1[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Jd=Symbol("internals");function Ws(e){return e&&String(e).trim().toLowerCase()}function _o(e){return e===!1||e==null?e:Q.isArray(e)?e.map(_o):String(e)}function _1(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const S1=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function el(e,t,n,r,s){if(Q.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!Q.isString(t)){if(Q.isString(r))return t.indexOf(r)!==-1;if(Q.isRegExp(r))return r.test(t)}}function C1(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function E1(e,t){const n=Q.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let en=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,l,d){const p=Ws(l);if(!p)throw new Error("header name must be a non-empty string");const v=Q.findKey(s,p);(!v||s[v]===void 0||d===!0||d===void 0&&s[v]!==!1)&&(s[v||l]=_o(a))}const o=(a,l)=>Q.forEach(a,(d,p)=>i(d,p,l));if(Q.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(Q.isString(t)&&(t=t.trim())&&!S1(t))o(k1(t),n);else if(Q.isObject(t)&&Q.isIterable(t)){let a={},l,d;for(const p of t){if(!Q.isArray(p))throw TypeError("Object iterator must return a key-value pair");a[d=p[0]]=(l=a[d])?Q.isArray(l)?[...l,p[1]]:[l,p[1]]:p[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Ws(t),t){const r=Q.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return _1(s);if(Q.isFunction(n))return n.call(this,s,r);if(Q.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Ws(t),t){const r=Q.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||el(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Ws(o),o){const a=Q.findKey(r,o);a&&(!n||el(r,r[a],a,n))&&(delete r[a],s=!0)}}return Q.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||el(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return Q.forEach(this,(s,i)=>{const o=Q.findKey(r,i);if(o){n[o]=_o(s),delete n[i];return}const a=t?C1(i):String(i).trim();a!==i&&delete n[i],n[a]=_o(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return Q.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&Q.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Jd]=this[Jd]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Ws(o);r[a]||(E1(s,o),r[a]=!0)}return Q.isArray(t)?t.forEach(i):i(t),this}};en.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Q.reduceDescriptors(en.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});Q.freezeMethods(en);function tl(e,t){const n=this||Ii,r=t||n,s=en.from(r.headers);let i=r.data;return Q.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Im(e){return!!(e&&e.__CANCEL__)}function Os(e,t,n){We.call(this,e??"canceled",We.ERR_CANCELED,t,n),this.name="CanceledError"}Q.inherits(Os,We,{__CANCEL__:!0});function Am(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new We("Request failed with status code "+n.status,[We.ERR_BAD_REQUEST,We.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function N1(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function j1(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),p=r[i];o||(o=d),n[s]=l,r[s]=d;let v=i,x=0;for(;v!==s;)x+=n[v++],v=v%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const y=p&&d-p;return y?Math.round(x*1e3/y):void 0}}function R1(e,t){let n=0,r=1e3/t,s,i;const o=(d,p=Date.now())=>{n=p,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const p=Date.now(),v=p-n;v>=r?o(d,p):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-v)))},()=>s&&o(s)]}const Yo=(e,t,n=3)=>{let r=0;const s=j1(50,250);return R1(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-r,d=s(l),p=o<=a;r=o;const v={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:d||void 0,estimated:d&&a&&p?(a-o)/d:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(v)},n)},ef=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},tf=e=>(...t)=>Q.asap(()=>e(...t)),T1=Ft.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ft.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ft.origin),Ft.navigator&&/(msie|trident)/i.test(Ft.navigator.userAgent)):()=>!0,O1=Ft.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];Q.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Q.isString(r)&&a.push(`path=${r}`),Q.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),Q.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function I1(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function A1(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Pm(e,t,n){let r=!I1(t);return e&&(r||n==!1)?A1(e,t):t}const nf=e=>e instanceof en?{...e}:e;function $r(e,t){t=t||{};const n={};function r(d,p,v,x){return Q.isPlainObject(d)&&Q.isPlainObject(p)?Q.merge.call({caseless:x},d,p):Q.isPlainObject(p)?Q.merge({},p):Q.isArray(p)?p.slice():p}function s(d,p,v,x){if(Q.isUndefined(p)){if(!Q.isUndefined(d))return r(void 0,d,v,x)}else return r(d,p,v,x)}function i(d,p){if(!Q.isUndefined(p))return r(void 0,p)}function o(d,p){if(Q.isUndefined(p)){if(!Q.isUndefined(d))return r(void 0,d)}else return r(void 0,p)}function a(d,p,v){if(v in t)return r(d,p);if(v in e)return r(void 0,d)}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(d,p,v)=>s(nf(d),nf(p),v,!0)};return Q.forEach(Object.keys({...e,...t}),function(p){const v=l[p]||s,x=v(e[p],t[p],p);Q.isUndefined(x)&&v!==a||(n[p]=x)}),n}const Lm=e=>{const t=$r({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=en.from(o),t.url=Rm(Pm(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Q.isFormData(n)){if(Ft.hasStandardBrowserEnv||Ft.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Q.isFunction(n.getHeaders)){const l=n.getHeaders(),d=["content-type","content-length"];Object.entries(l).forEach(([p,v])=>{d.inclu Line truncated
`+o.map(uf).join(`
`):" "+uf(o[0]):"as no adapter specified";throw new We("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const Fm={getAdapter:H1,adapters:jc};function nl(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Os(null,e)}function cf(e){return nl(e),e.headers=en.from(e.headers),e.data=tl.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Fm.getAdapter(e.adapter||Ii.adapter,e)(e).then(function(r){return nl(e),r.data=tl.call(e,e.transformResponse,r),r.headers=en.from(r.headers),r},function(r){return Im(r)||(nl(e),r&&r.response&&(r.response.data=tl.call(e,e.transformResponse,r.response),r.response.headers=en.from(r.response.headers))),Promise.reject(r)})}const Dm="1.13.2",ba={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ba[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const df={};ba.transitional=function(t,n,r){function s(i,o){return"[Axios v"+Dm+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new We(s(o," has been removed"+(n?" in "+n:"")),We.ERR_DEPRECATED);return n&&!df[o]&&(df[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,a):!0}};ba.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function V1(e,t,n){if(typeof e!="object")throw new We("options must be an object",We.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const a=e[i],l=a===void 0||o(a,i,e);if(l!==!0)throw new We("option "+i+" must be "+l,We.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new We("Unknown option "+i,We.ERR_BAD_OPTION)}}const So={assertOptions:V1,validators:ba},zn=So.validators;let zr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Qd,response:new Qd}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=$r(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&So.assertOptions(r,{silentJSONParsing:zn.transitional(zn.boolean),forcedJSONParsing:zn.transitional(zn.boolean),clarifyTimeoutError:zn.transitional(zn.boolean)},!1),s!=null&&(Q.isFunction(s)?n.paramsSerializer={serialize:s}:So.assertOptions(s,{encode:zn.function,serialize:zn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),So.assertOptions(n,{baseUrl:zn.spelling("baseURL"),withXsrfToken:zn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&Q.merge(i.common,i[n.method]);i&&Q.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),n.headers=en.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(c){typeof c.runWhen=="function"&&c.runWhen(n)===!1||(l=l&&c.synchronous,a.unshift(c.fulfilled,c.rejected))});const d=[];this.interceptors.response.forEach(function(c){d.push(c.fulfilled,c.rejected)});let p,v=0,x;if(!l){const g=[cf.bind(this),void 0];for(g.unshift(...a),g.push(...d),x=g.length,p=Promise.resolve(n);v<x;)p=p.then(g[v++],g[v++]);return p}x=a.length;let y=n;for(;v<x;){const g=a[v++],c=a[v++];try{y=g(y)}catch(w){c.call(this,w);break}}try{p=cf.call(this,y)}catch(g){return Promise.reject(g)}for(v=0,x=d.length;v<x;)p=p.then(d[v++],d[v++]);return p}getUri(t){t=$r(this.defaults,t);const n=Pm(t.baseURL,t.url,t.allowAbsoluteUrls);return Rm(n,t.params,t.paramsSerializer)}};Q.forEach(["delete","get","head","options"],function(t){zr.prototype[t]=function(n,r){return this.request($r(r||{},{method:t,url:n,data:(r||{}).data}))}});Q.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,a){return this.request($r(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}zr.prototype[t]=n(),zr.prototype[t+"Form"]=n(!0)});let q1=class Mm{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,a){r.reason||(r.reason=new Os(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Mm(function(s){t=s}),cancel:t}}};function K1(e){return function(n){return e.apply(null,n)}}function Z1(e){return Q.isObject(e)&&e.isAxiosError===!0}const du={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(du).forEach(([e,t])=>{du[t]=e});function Bm(e){const t=new zr(e),n=ym(zr.prototype.request,t);return Q.extend(n,zr.prototype,t,{allOwnKeys:!0}),Q.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Bm($r(e,s))},n}const xt=Bm(Ii);xt.Axios=zr;xt.CanceledError=Os;xt.CancelToken=q1;xt.isCancel=Im;xt.VERSION=Dm;xt.toFormData=wa;xt.AxiosError=We;xt.Cancel=xt.CanceledError;xt.all=function(t){return Promise.all(t)};xt.spread=K1;xt.isAxiosError=Z1;xt.mergeConfig=$r;xt.AxiosH Line truncated
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var G1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Q1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Ye=(e,t)=>{const n=F.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:a="",children:l,...d},p)=>F.createElement("svg",{ref:p,...G1,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:["lucide",`lucide-${Q1(e)}`,a].join(" "),...d},[...t.map(([v,x])=>F.createElement(v,x)),...Array.isArray(l)?l:[l]]));return n.displayName=`${e}`,n};/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $m=Ye("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ff=Ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rl=Ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hu=Ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wm=Ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const J1=Ye("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ew=Ye("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Co=Ye("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tw=Ye("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nw=Ye("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rw=Ye("FileText",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["line",{x1:"16",x2:"8",y1:"13",y2:"13",key:"14keom"}],["line",{x1:"16",x2:"8",y1:"17",y2:"17",key:"17nazh"}],["line",{x1:"10",x2:"8",y1:"9",y2:"9",key:"1a5vjj"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sw=Ye("File",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hf=Ye("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pf=Ye("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const iw=Ye("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mf=Ye("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yn=Ye("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ow=Ye("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const aw=Ye("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const lw=Ye("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gf=Ye("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const uw=Ye("Move",[["polyline",{points:"5 9 2 12 5 15",key:"1r5uj5"}],["polyline",{points:"9 5 12 2 15 5",key:"5v383o"}],["polyline",{points:"15 19 12 22 9 19",key:"g7qi8m"}],["polyline",{points:"19 9 22 12 19 15",key:"tpp73q"}],["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cw=Ye("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dw=Ye("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",key:"1xcu5"}],["circle",{cx:"17.5",cy:"10.5",r:".5",key:"736e4u"}],["circle",{cx:"8.5",cy:"7.5",r:".5",key:"clrty"}],["circle",{cx:"6.5",cy:"12.5",r:".5",key:"1s4xz9"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fw=Ye("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hw=Ye("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pw=Ye("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pu=Ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mw=Ye("RotateCcw",[["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"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mu=Ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yf=Ye("Sliders",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/**
* @license lucide-react v0.300.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=Ye("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vf=Ye("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hm=Ye("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
* @license lucide-react v0.300.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ai=Ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ki={LIBRARY:"library",FOLDER:"folder",IMAGES:"images"};let xf=0;const gw=()=>(xf+=1,`req_${Date.now()}_${xf}`);class yw{constructor(){this.activeRequests=new Map,this.requestContexts=new Map}createRequest(t){const n=gw(),r=new AbortController,s={id:n,type:t,createdAt:Date.now(),abortController:r,signal:r.signal,status:"pending",isActive:!0,cancel:()=>{if(s.isActive){s.isActive=!1,s.status="cancelled",r.abort(),this.requestContexts.delete(n);const i=this.activeRequests.get(t);i&&i.delete(n)}}};return this.requestContexts.set(n,s),this.activeRequests.has(t)||this.activeRequests.set(t,new Map),this.activeRequests.get(t).set(n,s),s}cancelAll(t){const n=this.activeRequests.get(t);if(n){for(const r of n.values())r.cancel();n.clear()}}cancelAllRequests(){for(const t of Object.values(ki))this.cancelAll(t)}isValid(t){const n=this.requestContexts.get(t);return n?n.isActive:!1}complete(t){const n=this.requestContexts.get(t);if(n&&n.isActive){n.status="completed",n.isActive=!1,this.requestContexts.delete(t);const r=this.activeRequests.get(n.type);r&&r.delete(t)}}error(t){const n=this.requestContexts.get(t);if(n&&n.isActive){n.status="error",n.isActive=!1,this.requestContexts.delete(t);const r=this.activeRequests.get(n.type);r&&r.delete(t)}}getActiveCount(t){const n=this.activeRequests.get(t);return n?n.size:0}hasActiveRequests(t){return this.getActiveCount(t)>0}}const yn=new yw;function gu(){yn.cancelAll(ki.IMAGES)}function vw(e){e&&setTimeout(()=>{},300)}function yu({isOpen:e,libraryName:t,libraryPath:n,status:r,onRescan:s,onOpenOther:i,onCreateNew:o}){if(!e)return null;const a=r==="missing_index",l=a?"素材库索引丢失":"打开资源库失败";return u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:u.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-xl shadow-2xl max-w-lg w-full mx-4 overflow-hidden",children:u.jsxs("div",{className:"flex",children:[u.jsxs("div",{className:"flex-1 p-6",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[u.jsx($m,{className:"w-6 h-6 text-yellow-500"}),u.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:l})]}),u.jsx("div",{className:"text-gray-600 dark:text-gray-300 mb-6 space-y-2",children:a?u.jsxs(u.Fragment,{children:[u.jsxs("p",{children:["素材库 ",u.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:t})," 的索引数据已丢失。"]}),u.jsxs("p",{children:["路径: ",u.jsx("span",{className:"text-blue-500 break-all",children:n})]}),u.jsx("p",{className:"text-sm text-gray-500",children:"图片文件夹仍然存在,您可以重新扫描来重建索引。"})]}):u.jsxs(u.Fragment,{children:[u.jsxs("p",{children:["在这个位置的资源库(",u.jsx("span",{className:"text-blue-500 break-all",children:n}),") 打开失败,可能是因为路径已经变化,或者资源库链接错误。"]}),u.jsxs("p",{children:["如果您更改过资源库位置,可以"," ",u.jsx("button",{onClick:i,className:"text-blue-500 hover:text-blue-600 hover:underline",children:"重新选择路径"})," ","打开"]})]})}),u.jsx("div",{className:"text-gray-500 dark:text-gray-400 mb-4",children:a?"请选择操作:":"您也可以:"}),u.jsxs("div",{className:"flex flex-wrap gap-3",children:[a&&u.jsxs("button",{onClick:s,className:"flex items-center gap-2 px-4 py-2.5 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors",children:[u.jsx(pu,{className:"w-4 h-4"}),"重新扫描"]}),u.jsxs("button",{onClick:i,className:"flex items-center gap-2 px-4 py-2.5 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[u.jsx(iw,{className:"w-4 h-4"}),"打开其他资源库"]}),u.jsxs("button",{onClick:o,className:`flex items-center gap-2 px-4 py-2.5 rounded-lg transition-colors ${a?"border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700":"bg-blue-500 text-white hover:bg-blue-600"}`,children:[u.jsx(pw,{className:"w-4 h-4"}),"创建新资源库"]})]})]}),u.jsx("div",{className:"hidden md:flex items-center justify-center w-48 bg-gradient-to-br from-blue-50 to-blue-100 dark:from-gray-700 dark:to-gray-600",children:u.jsx("div",{className:"relative",children:u.jsxs("svg",{className:"w-32 h-32",viewBox:"0 0 128 128",fill:"none",children:[u.jsx("path",{d:"M64 20L20 55V108H108V55L64 20Z",className:"fill-blue-200 dark:fill-blue-900"}),u.jsx("path",{d:"M64 20L20 55V108H108V55L64 20Z",className:"stroke-blue-400 dark:stroke-blue-600",strokeWidth:"3",fill:"none"}),u.jsx("rect",{x:"52",y:"70",width:"24",height:"38",className:"fill-blue-300 dark:fill-blue-800"}),u.jsx("rect",{x:"30",y:"65",width:"16",height:"16",className:"fill-yellow-200 dark:fill-yellow-900"}),u.jsx("rect",{x:"82",y:"65",width:"16",height:"16",Line truncated
w-full flex items-center gap-3 px-4 py-2 text-left text-sm
${d.disabled?"opacity-50 cursor-not-allowed":"hover:bg-gray-100 dark:hover:bg-gray-700"}
${d.danger?"text-red-600 dark:text-red-400":"text-gray-700 dark:text-gray-300"}
`,children:[d.icon,u.jsx("span",{className:"flex-1",children:d.label}),d.shortcut&&u.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:d.shortcut})]})},p))})}const Dn={delete:e=>({icon:u.jsx(Hm,{size:16}),label:"移入回收站",shortcut:"Del",danger:!1,action:e}),rename:e=>({icon:u.jsx(fw,{size:16}),label:"重命名",shortcut:"F2",action:e}),move:e=>({icon:u.jsx(uw,{size:16}),label:"移动到",action:e}),copy:e=>({icon:u.jsx(Co,{size:16}),label:"复制",shortcut:"Ctrl+C",action:e}),newSiblingFolder:e=>({icon:u.jsx(mf,{size:16}),label:"新建同级文件夹",action:e}),newSubFolder:e=>({icon:u.jsx(mf,{size:16}),label:"新建子文件夹",action:e}),divider:()=>({divider:!0})};function qm({isVisible:e,message:t,onUndo:n,onClose:r,duration:s=3e3}){return F.useEffect(()=>{if(!e)return;const i=setTimeout(()=>{r()},s);return()=>clearTimeout(i)},[e,t,s,r]),e?u.jsx("div",{className:"fixed bottom-20 left-1/2 transform -translate-x-1/2 z-50 animate-slide-up",children:u.jsxs("div",{className:"bg-gray-900 dark:bg-gray-800 text-white rounded-lg shadow-2xl px-4 py-3 flex items-center gap-4 min-w-[300px]",children:[u.jsx("span",{className:"flex-1 text-sm",children:t}),u.jsxs("button",{onClick:n,className:"flex items-center gap-1 px-3 py-1 bg-blue-600 hover:bg-blue-700 rounded transition-colors text-sm font-medium",children:[u.jsx(mw,{size:14}),"撤销"]}),u.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white transition-colors",children:u.jsx(Ai,{size:18})})]})}):null}function Km({folders:e,currentFolder:t,onSelect:n,onClose:r}){const[s,i]=F.useState(new Set),[o,a]=F.useState(t||null),l=F.useRef(null),d=F.useRef(null);F.useEffect(()=>{if(t&&t!==""){const c=new Set,w=t.split("/");for(let f=0;f<w.length-1;f++){const h=w.slice(0,f+1).join("/");c.add(h)}console.log("📂 自动展开路径:",Array.from(c)),console.log(`📍 当前选中: ${t}`),i(c)}},[t]),F.useEffect(()=>{if(l.current&&d.current){const c=l.current,w=d.current;if(c&&w){const f=c.getBoundingClientRect(),h=w.getBoundingClientRect(),b=c.offsetTop-w.offsetTop-h.height/2+f.height/2;w.scrollTop=b,console.log(`📍 立即定位到选中文件夹: ${t}`)}}},[s,t]);const p=c=>{i(w=>{const f=new Set(w);return f.has(c)?f.delete(c):f.add(c),f})},v=c=>{const w=c.children&&c.children.length>0;o!==c.path?a(c.path):w&&p(c.path)},x=(c,w)=>{c.stopPropagation(),p(w)},y=()=>{o!==null&&n(o)},g=(c,w=0)=>c.map(f=>{const h=s.has(f.path),b=f.children&&f.children.length>0,_=o===f.path,S=t===f.path,T=S;return u.jsxs("div",{children:[u.jsxs("div",{ref:S?l:null,className:`flex items-center px-3 py-2 cursor-pointer rounded-md transition-colors ${T?"opacity-50 cursor-not-allowed bg-gray-100 dark:bg-gray-700":_?"bg-blue-500 dark:bg-blue-600":"hover:bg-blue-50 dark:hover:bg-gray-700"}`,style:{paddingLeft:`${w*16+12}px`},onClick:()=>!T&&v(f),children:[b?u.jsx("div",{className:"flex items-center justify-center w-5 h-5 mr-1 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 rounded",onClick:j=>x(j,f.path),children:h?u.jsx(hu,{className:"w-4 h-4"}):u.jsx(Wm,{className:"w-4 h-4"})}):u.jsx("div",{className:"w-5 mr-1"}),u.jsx(Yn,{className:`w-4 h-4 mr-2 flex-shrink-0 ${_?"text-white":"text-yellow-500 dark:text-yellow-400"}`}),u.jsx("span",{className:`text-sm truncate flex-1 font-medium ${_?"text-white":"text-gray-900 dark:text-gray-100"}`,children:f.name}),S&&u.jsx("span",{className:`text-xs ml-2 ${_?"text-blue-100":"text-gray-500 dark:text-gray-400"}`,children:"(当前)"})]}),b&&h&&u.jsx("div",{children:g(f.children,w+1)})]},f.path)});return u.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:u.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-[500px] max-h-[600px] flex flex-col",children:[u.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[u.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"选择目标文件夹"}),u.jsx("button",{onClick:r,className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",children:u.jsx(Ai,{className:"w-5 h-5"})})]}),u.jsxs("div",{ref:d,className:"flex-1 overflow-y-auto p-4",children:[u.jsxs("div",{className:`flex items-center px-3 py-2 cursor-pointer rounded-md transition-colors mb-2 ${o===""?"bg-blue-500 dark:bg-blue-600":"hover:bg-blue-50 dark:hover:bg-gray-700"}`,onClick:()=>a(""),children:[u.jsx(aw,{className:`w-4 h-4 mr-2 ${o===""?"text-white":"text-blue-500 dark:text-blue-400"}`}),u.jsx("span",{className:`text-sm font-medium ${o===""?"text-white":"text-gray-900 dark:text-gray-100"}`,children:"根目录"})]}),e&&e.length>0?g(e):u.jsx("div",{className:"text-center text-gray-500 py-8",children:"暂无文件夹"})]}),u.jsxs("div",{className:"flex items-center justify-end gap-2 p-4 border-t border-gray-200 dark:border-gray-700",children:[u.jsx("button",{onClick:r,className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hov Line truncated
提示:超过5分钟的文件已移入系统回收站,请手动从回收站恢复。`)}else H(X.folders)}).catch(W=>{console.error("撤销失败:",W),J(ie),De.getFolders(t).then(X=>{const{setFolders:H}=Ee.getState();H(X.folders)}),alert("撤销失败: "+(W.message||"未知错误"))})},Fe=async(G,ye)=>{if(G.preventDefault(),G.stopPropagation(),_e(null),!!t)try{const E=JSON.parse(G.dataTransfer.getData("application/json")),{items:I}=E;if(!I||I.length===0)return;const W=I.some(ve=>ve.type==="folder");if(!W){const{images:ve,setImages:xe}=Ee.getState(),Ne=new Set(I.map(Ze=>Ze.path)),Me=ve.filter(Ze=>!Ne.has(Ze.path));xe(Me)}const[X,H]=await Promise.all([Kt.move(t,I,ye.path),De.getFolders(t)]);X.failed&&X.failed.length>0?alert(`移动失败: ${X.failed[0].error}`):console.log(`✅ 已移动 ${I.length} 个${W?"文件夹":"文件"}到: ${ye.path}`);const{setFolders:ue}=Ee.getState();ue(H.folders)}catch(E){console.error("拖拽移动失败:",E)}},ot=(G,ye)=>{G.preventDefault(),G.stopPropagation(),_e(ye.path)},wt=G=>{G.preventDefault(),G.stopPropagation(),_e(null)},nt=G=>{Te(G),ce(!0),te({isOpen:!1,position:null,folder:null})},Rt=async G=>{if(!t||!be)return;ce(!1);const ye=be.split("/").pop(),E=G?`${G}/${ye}`:ye;try{const I=[{type:"folder",path:be}],[W,X]=await Promise.all([Kt.move(t,I,G),De.getFolders(t)]);W.failed&&W.failed.length>0?alert(`移动失败: ${W.failed[0].error}`):(x(E),console.log(`✅ 已移动文件夹: ${be} -> ${E}`));const{setFolders:H}=Ee.getState();H(X.folders)}catch(I){console.error("移动文件夹失败:",I),alert("移动失败: "+(I.message||"未知错误")),De.getFolders(t).then(W=>{const{setFolders:X}=Ee.getState();X(W.folders)})}finally{Te(null)}},$e=G=>{G&&(He(G),m(G.name),te({isOpen:!1,position:null,folder:null}),setTimeout(()=>{se.current&&(se.current.focus(),se.current.select())},50))},q=async()=>{if(!Ce||!Be.trim()){He(null),m("");return}const G=Ce.name,ye=Be.trim();if(ye===G){He(null),m("");return}const E=Ce.path,I=p===E;try{const X=(await Kt.rename(t,E,ye)).newPath;console.log(`✅ 文件夹重命名成功: ${G} → ${ye}, 路径: ${E} → ${X}`);const{setImages:H,setFolders:ue,setSelectedFolder:ve}=Ee.getState();H([]);const xe=await De.getFolders(t);console.log("📁 重命名后最新文件夹列表:",xe.folders),ue(xe.folders),I&&(console.log(`📂 重命名当前文件夹: ${E} → ${X}`),ve(null),setTimeout(()=>{ve(X),console.log("✅ 已切换到新文件夹, selectedFolder =",X)},50))}catch(W){console.error("文件夹重命名失败:",W),alert("重命名失败: "+(W.message||"未知错误"))}finally{He(null),m("")}},we=()=>{He(null),m("")},fe=(G,ye)=>{const E=G==="sibling"?ye.includes("/")?ye.substring(0,ye.lastIndexOf("/")):"":ye;V({type:G,parentPath:E,basePath:ye}),C("新建文件夹"),te({isOpen:!1,position:null,folder:null}),setTimeout(()=>{$.current&&($.current.focus(),$.current.select())},50)},je=async()=>{if(!K||!N.trim()){V(null),C("");return}const G=N.trim(),{parentPath:ye}=K,E=ye?`${ye}/${G}`:G;try{await Kt.createFolder(t,E),console.log(`✅ 文件夹创建成功: ${E}`);const I=await De.getFolders(t),{setFolders:W}=Ee.getState();W(I.folders),ye&&D(X=>new Set([...X,ye]))}catch(I){console.error("创建文件夹失败:",I),alert("创建文件夹失败: "+(I.message||"未知错误"))}finally{V(null),C("")}},Oe=()=>{V(null),C("")},Pe=async()=>{var G,ye;if(g()){alert("扫描进行中,请稍后再试或暂停扫描");return}if(!f.trim()){alert("请输入素材库名称");return}if(!b.trim()){alert("请输入文件夹路径");return}R(!0);try{console.log("📝 添加素材库...");const E=await Lt.add(f.trim(),b.trim()),I=E.id,W=E.hasExistingIndex;if(r({id:I,name:f.trim(),path:b.trim()}),h(""),_(""),w(!1),R(!1),console.log("🔄 切换到新素材库..."),await Lt.setCurrent(I),n(I),x(null),Ee.getState().setImages([]),Ee.getState().setFolders([]),Ee.getState().setSelectedImage(null),Ee.getState().setTotalImageCount(0),or.getState().setScanProgress({libraryId:I,current:0,total:0,percent:0,status:"preparing"}),W){console.log("检测到已有索引,先加载现有数据...");try{const[X,H]=await Promise.all([De.getFolders(I),De.getCount(I)]);Ee.getState().setFolders(X.folders),Ee.getState().setTotalImageCount(H.count),console.log("✅ 已加载现有数据")}catch(X){console.warn("⚠️ 加载现有数据失败:",X)}}console.log("🔍 开始异步扫描..."),W?(console.log("执行增量同步,检测变化..."),br.sync(I,!1)):(console.log("首次添加,执行全量扫描..."),br.fullScan(I,!1)),console.log("✅ 扫描已启动,请等待进度显示...")}catch(E){console.error("❌ Error adding library:",E);let I=E.message||"未知错误";(ye=(G=E.response)==null?void 0:G.data)!=null&&ye.message&&(I=E.response.data.message),I.includes("无法访问")||I.includes("权限")||I.includes("数据共享")?alert(`⚠️ 文件夹权限不足
`+I+`
操作步骤:
1. 应用中心找到 FlyPic 应用
2. 点击 应用设置
3. 将该文件夹添加到 FlyPic 应用的读写权限`):alert("添加素材库失败: "+I),or.getState().setScanProgress(null),R(!1)}},he=async G=>{if(G!==t){if(g()){alert("扫描进行中,请稍后再试或暂停扫描");return}k(!0);try{const ye=await Lt.validate(G),E=ye.data||ye;if(E.status!=="ok"){re({id:G,name:E.name,path:E.path,status:E.status}),k(!1);return}gu(),yn.cancelAllRequests(),or.getState().setScanProgress(null),Ee.getState().setSelectedImage(null),Ee.getState().setImages([]),Ee.getState().setFolders([]),Ee.getState().setImageLoadingState({isLoading:!1,loadedCount:0,totalCount:0}),x(null),await Lt.setCurrent(G);const[I,W]=await Promise.all([De.getFolders(G),De.getCount(G)]);Ee.getState().setFolders(I.folders),Ee.getState().setTotalImageCount(W.count),n(G),xw(G).then(X=>{X&&X.status==="scanning"&&or.getState().setScanProgress(X.progress)}).catch(()=>{})}catch(ye){console.error("Error setting current library:",ye),alert("切换素材库失败: "+ye.message),Ee.getState().setImageLoadingState({isLoading:!1})}finally{k(!1)}}},Ie=async()=>{if(!t)return;if(g()){alert("扫描进行中,请稍后再试或暂停扫描");return}const G=e.find(E=>E.id===t);if(!(!G||!confirm(`确定要删除素材库"${G.name}"吗?
路径: ${G.path}
⚠️ 注意:
• 将删除索引数据并释放数据库连接
• 不会删除原始图片文件
• .flypic 文件夹将保留,您可以手动删除`)))try{await Lt.remove(t),s(t),Ee.getState().setImages([]),Ee.getState().setFolders([]),Ee.getState().setSelectedImage(null),Ee.getState().setSelectedFolder(null);const E=e.filter(I=>I.id!==t);if(E.length>0){const I=E[0];await Lt.setCurrent(I.id),n(I.id)}console.log(`✅ 素材库已删除: ${G.name}`),console.log(`数据库连接已释放,可手动删除: ${G.path}\\.flypic`)}catch(E){console.error("Error deleting library:",E),alert("删除素材库失败: "+E.message)}},Le=G=>{const ye=new Set(O);ye.has(G)?ye.delete(G):ye.add(G),D(ye)},Ae=G=>{const ye=[],E=I=>{I.forEach(W=>{W.children&&W.children.length>0&&(ye.push(W.path),E(W.children))})};return E(G),ye},ne=()=>{const G=Ae(qe.length>0?qe:d);D(new Set(G))},Se=()=>{D(new Set)},ze=()=>{const G=Ae(qe.length>0?qe:d);return G.length>0&&G.every(ye=>O.has(ye))},qe=F.useMemo(()=>{if(!S)return d;const G=S.trim().toLowerCase().split(/\s+/).filter(W=>W.length>0);if(G.length===0)return d;const ye=[],E=W=>W.reduce((X,H)=>{const ue=H.name.toLowerCase(),ve=H.path.toLowerCase(),xe=G.every(Ze=>ue.includes(Ze)),Ne=G.every(Ze=>ve.includes(Ze));let Me=[];return H.children&&H.children.length>0&&(Me=E(H.children)),(xe||Ne||Me.length>0)&&(X.push({...H,children:Me}),Me.length>0&&ye.push(H.path)),X},[]),I=E(d);return ye.length>0&&setTimeout(()=>{D(W=>{const X=new Set(W);return ye.forEach(H=>X.add(H)),X})},0),I},[d,S]),Je=(G,ye)=>{G.stopPropagation(),Le(ye)},st=G=>{const ye=G.children&&G.children.length>0;if(p!==G.path){gu(),x(G.path);const{clearSelection:E,setSelectedFolderItem:I}=Ee.getState();E(),I(G)}else ye&&Le(G.path)},ct=(G,ye=0)=>G.map(E=>{const I=O.has(E.path),W=E.children&&E.children.length>0,X=p===E.path;return u.jsxs("div",{children:[u.jsxs("div",{className:`flex items-center px-3 py-2 rounded-md cursor-pointer transition-colors ${X?"bg-blue-50 dark:bg-blue-900":oe===E.path?"bg-green-100 dark:bg-green-900":"hover:bg-gray-100 dark:hover:bg-gray-700"}`,style:{paddingLeft:`${ye*16+12}px`},onClick:()=>st(E),onContextMenu:H=>{H.preventDefault(),te({isOpen:!0,position:{x:H.clientX,y:H.clientY},folder:E})},draggable:!0,onDragStart:H=>{const ue=[{type:"folder",path:E.path}];H.dataTransfer.setData("application/json",JSON.stringify({items:ue})),H.dataTransfer.effectAllowed="move"},onDrop:H=>Fe(H,E),onDragOver:H=>ot(H,E),onDragLeave:wt,children:[W?u.jsx("div",{className:"flex items-center justify-center w-5 h-5 mr-1 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 rounded",onClick:H=>Je(H,E.path),children:I?u.jsx(hu,{className:"w-4 h-4 text-gray-500"}):u.jsx(Wm,{className:"w-4 h-4 text-gray-500"})}):u.jsx("div",{className:"w-5 mr-1"}),u.jsx(Yn,{className:"w-4 h-4 mr-2 text-gray-500 flex-shrink-0"}),(Ce==null?void 0:Ce.path)===E.path?u.jsx("input",{ref:se,type:"text",value:Be,onChange:H=>m(H.target.value),onKeyDown:H=>{H.key==="Enter"?(H.preventDefault(),q()):H.key==="Escape"&&(H.preventDefault(),we())},onBlur:q,onClick:H=>H.stopPropagation(),className:"flex-1 text-sm text-gray-700 dark:text-gray-300 truncate bg-transparent border-none outline-none focus:outline-none underline decoration-2 decoration-blue-500 underline-offset-2",style:{padding:0,margin:0}}):u.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate flex-1",children:E.name}),u.jsx("span",{className:"text-xs text-gray-400 ml-2 flex-shrink-0",children:E.imageCount})]}),K&&K.type==="child"&&K.basePath===E.path&&I&&u.jsxs("div",{className:"flex items-center py-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",style:{paddingLeft:`${(ye+1)*16+12}px`},children:[u.jsx("div",{className:"w-5 mr-1"}),u.jsx(Yn,{className:"w-4 h-4 mr-2 text-gray-500 flex-shrink-0"}),u.jsx("input",{ref:$,type:"text",value:N,onChange:H=>C(H.target.value),onKeyDown:H=>{H.key==="Enter"?(H.preventDefault(),je()):H.key==="Escape"&&(H.preventDefault(),Oe())},onBlur:je,onClick:H=>H.stopPropagation(),className:"flex-1 text-sm text-gray-700 dark:text-gray-300 bg-transparent border-none outline-none focus:outline-none underline decoration-2 decoration-green-500 underline-offset-2"})]}),W&&I&&ct(E.children,ye+1),K&&K.type==="sibling"&&K.basePath===E.path&&u.jsxs("div",{className:"flex items-center py-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",style:{paddingLeft:`${ye*16+12}px`},children:[u.jsx("div",{className:"w-5 mr-1"}),u.jsx(Yn,{className:"w-4 h-4 mr-2 text-gray-500 flex-shrink-0"}),u.jsx("input",{ref:$,type:"text",value:N,onChange:H=>C(H.target.value),onKeyDown:H=>{H.key==="Enter"?(H.preventDefault(),je()):H.key==="Escape"&&(H.preventDefault(),Oe())},onBlur:je,onClick:H=>H.stopPropagation(),className:"flex-1 text-sm text-gray-700 dark:text-gray-300 bg-transparent border-none outline-none focus:outline-none underline decoration-2 decoration-green-500 underline-offset-2"})]})]},E.path)}),gt=async()=>{if(!U)return;const G=U.id;re(null);try{or.getState().setScanProgress(null),Ee.getState().setSelectedImage(null),Ee.getState().setImages([]),Ee.get Line truncated
提示:超过5分钟的文件已移入系统回收站,请手动从回收站恢复。`)}else H(xe.folders)}).catch(ve=>{console.error("恢复失败:",ve),_e(oe),W===d&&c(t),De.getFolders(e).then(xe=>{H(xe.folders)}),alert("恢复失败: "+(ve.message||"未知错误"))})},je=async E=>{const I=s.length>0?s:n?[n]:[];if(I.length!==0)try{const W=I.map(H=>H.path);await De.updateRating(e,W,E);const X=t.map(H=>W.includes(H.path)?{...H,rating:E}:H);if(c(X),n&&W.includes(n.path)&&Ee.getState().setSelectedImage({...n,rating:E}),s.length>0){const H=s.map(ue=>W.includes(ue.path)?{...ue,rating:E}:ue);Ee.getState().setSelectedImages(H)}ce({isVisible:!0,rating:E,count:I.length}),console.log(`⭐ 已将 ${I.length} 张图片评为 ${E} 星`)}catch(W){console.error("评分失败:",W),alert("评分失败: "+(W.message||"未知错误"))}},Oe=async()=>{const E=s.length>0?s.map(xe=>({type:"file",path:xe.path})):n?[{type:"file",path:n.path}]:[];if(E.length===0)return;const I=new Set(E.map(xe=>xe.path)),W=t.filter(xe=>I.has(xe.path)),X=t.filter(xe=>!I.has(xe.path));c(X),a();const{folders:H,setFolders:ue}=Ee.getState();if(H&&H.length>0){const xe=H.map(Ne=>{const Me=W.filter(Ze=>{var Ge;return Ze.folder===Ne.path||((Ge=Ze.folder)==null?void 0:Ge.startsWith(Ne.path+"/"))}).length;return Me>0?{...Ne,count:Math.max(0,(Ne.count||0)-Me)}:Ne});ue(xe)}const ve=[...oe,{images:W,paths:Array.from(I),items:E}];_e(ve),J({isVisible:!0,message:`已将 ${E.length} 个文件移入临时文件夹(Ctrl+Z撤销 · ${ve.length}次)`,count:E.length}),Promise.all([Kt.delete(e,E),De.getFolders(e)]).then(([xe,Ne])=>{xe.failed.length>0?(console.warn(`⚠️ 删除失败: ${xe.failed.length} 个文件`,xe.failed),c(t),_e(oe),J({isVisible:!1,message:"",count:0}),ue(Ne.folders),alert("删除失败: 部分文件无法删除")):ue(Ne.folders)}).catch(xe=>{console.error("删除失败:",xe),c(t),_e(oe),J({isVisible:!1,message:"",count:0}),De.getFolders(e).then(Ne=>{ue(Ne.folders)}),alert("删除失败: "+(xe.message||"未知错误"))})},Pe=F.useCallback(()=>{const E=s.length>0?s.map(I=>({type:"file",path:I.path})):n?[{type:"file",path:n.path}]:[];E.length!==0&&(He(E),Te(!0),A({isOpen:!1,position:null,image:null}))},[s,n]),he=F.useCallback(async E=>{if(!e||Ce.length===0)return;Te(!1);const I=new Set(Ce.map(X=>X.path)),W=t.filter(X=>!I.has(X.path));c(W),a();try{const[X,H]=await Promise.all([Kt.move(e,Ce,E),De.getFolders(e)]);X.failed&&X.failed.length>0?(alert(`移动失败: ${X.failed[0].error}`),c(t)):console.log(`✅ 已移动 ${Ce.length} 个文件到: ${E||"根目录"}`),f(H.folders)}catch(X){console.error("移动失败:",X),alert("移动失败: "+(X.message||"未知错误")),c(t)}finally{He([])}},[e,Ce,t,c,a,f]),Ie=async E=>{try{if(typeof ClipboardItem>"u"||!navigator.clipboard||typeof navigator.clipboard.write!="function")return console.warn("系统剪贴板 API 不可用"),!1;if(E.length===0)return!1;if(E.length===1)try{const I=E[0],W=`/api/image/original/${e}/${I.path}`,H=await(await fetch(W)).blob(),ue=document.createElement("canvas"),ve=new Image;await new Promise((Me,Ze)=>{ve.onload=Me,ve.onerror=Ze,ve.src=URL.createObjectURL(H)}),ue.width=ve.width,ue.height=ve.height,ue.getContext("2d").drawImage(ve,0,0),URL.revokeObjectURL(ve.src);const Ne=await new Promise(Me=>{ue.toBlob(Me,"image/png")});return await navigator.clipboard.write([new ClipboardItem({"image/png":Ne})]),!0}catch(I){return console.warn("单图复制失败:",I),!1}try{const W=(await Promise.all(E.map(async H=>{const ue=`/api/image/original/${e}/${H.path}`,xe=await(await fetch(ue)).blob();return new Promise(Ne=>{const Me=new FileReader;Me.onloadend=()=>{Ne({dataUrl:Me.result,filename:H.filename})},Me.readAsDataURL(xe)})}))).map(({dataUrl:H,filename:ue})=>`<span><img src="${H}" alt="${ue}"></span>`).join(""),X=E.map(H=>H.filename).join(`
`);return await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([W],{type:"text/html"}),"text/plain":new Blob([X],{type:"text/plain"})})]),!0}catch(I){return console.warn("多图复制失败:",I),!1}}catch(I){return console.warn("写入系统剪贴板失败:",I),!1}},Le=F.useCallback(()=>{const E=s.length>0?s:n?[n]:[];if(E.length===0)return;const I=E.map(W=>({type:"file",path:W.path,data:W}));$(I,"copy"),console.log(`📋 已复制 ${I.length} 个文件到应用内剪贴板`),J({isVisible:!0,message:`已复制 ${I.length} 个文件`,count:I.length}),setTimeout(()=>{J({isVisible:!1,message:"",count:0})},3e3),Ie(E).then(W=>{W&&console.log("✅ 已写入系统剪贴板,可粘贴到外部应用")})},[s,n,$,e]),Ae=F.useCallback(async()=>{if(!e||!d)return;const{items:E}=de();if(!E||E.length===0)return;const I=t.filter(X=>X.folder===d),W=[];for(const X of E){const H=X.path.split("/").pop(),ue=X.path.substring(0,X.path.lastIndexOf("/"));I.some(xe=>xe.filename===H)&&W.push({path:X.path,name:H,isSameLocation:ue===d})}W.length>0?N({isOpen:!0,conflicts:W,pendingPaste:{items:E,targetFolder:d}}):await ne(E,d,"rename")},[e,d,de,t]),ne=F.useCallback(async(E,I,W)=>{if(!e)return;console.log(`📋 开始粘贴 ${E.length} 个文件到: ${I}`);const{folders:X,setFolders:H}=Ee.getState(),ue=X;if(X&&X.length>0){const ve=X.map(xe=>xe.path===I||I.startsWith(xe.path+"/")?{...xe,count:(xe.count||0)+E.length}:xe);H(ve)}J({isVisible:!0,message:`已粘贴 ${E.length} 个文件`,count:E.length}),setTimeout(()=>{J({isVisible:!1,message:"",count:0})},3e3),(async()=>{var ve,xe;try{const Ne=await Kt.copy(e,E,I,W),Me=((ve=Ne.success)==null?void 0:ve.length)||0,Ze=((xe=Ne.failed)==null?void 0:xe.length)||0;if(Ze>0&&(J({isVisible:!0,message:Me>0?`已粘贴 ${Me} 个文件,${Ze} 个失败`:`粘贴失败: ${Ne.failed[0].error}`,count:Me}),setTimeout(()=>{J({isVisible:!1,message:"",count:0})},3e3)),d===I){const ft={folder:d},at=await De.search(e,ft);c(at.images)}const Ge=await De.getFolders(e);H(Ge.folders)}catch(Ne){console.error("粘贴失败:",Ne),H(ue),J({isVisible:!1,message:"",count:0}),alert("粘贴失败: "+(Ne.message||"未知错误"))}})()},[e,d,c]),Se=F.useCallback(async E=>{var X,H,ue,ve;const{pendingPaste:I,pendingUpload:W}=V;if(N({isOpen:!1,conflicts:[],pendingPaste:null,pendingUpload:null}),I)await ne(I.items,I.targetFolder,E);else if(W){if(console.log(`处理上传冲突: ${E}`),E==="skip"){console.log("用户选择跳过上传");return}se({isUploading:!0,percent:0,current:0,total:W.files.length});try{const xe=await Kt.upload(e,W.targetFolder,W.files,Ge=>{const ft=Math.round(Ge.loaded*100/Ge.total);se(at=>({...at,percent:ft}))},E);se({isUploading:!1,percent:100,current:xe.success.length,total:W.files.length});const Ne=((X=xe.success)==null?void 0:X.length)||0,Me=((H=xe.failed)==null?void 0:H.length)||0;let Ze=`上传完成: 成功 ${Ne} 个`;if(Me>0&&(Ze+=`, 失败 ${Me} 个`),J({isVisible:!0,message:Ze,count:Ne}),setTimeout(()=>{J({isVisible:!1,message:"",count:0}),se({isUploading:!1,percent:0,current:0,total:0})},3e3),Ne>0){const Ge={folder:d||""},ft=await De.search(e,Ge);c(ft.images);const at=await De.getFolders(e);f(at.folders),setTimeout(async()=>{try{const _t=await De.search(e,Ge);c(_t.images),console.log("✅ 缩略图刷新完成")}catch(_t){console.error("刷新缩略图失败:",_t)}},2e3)}}catch(xe){console.error("上传失败:",xe),se({isUploading:!1,percent:0,current:0,total:0}),alert("上传失败: "+(((ve=(ue=xe.response)==null?void 0:ue.data)==null?void 0:ve.error)||xe.message||"未知错误"))}}},[V,ne,e,d,c,f]),ze=F.useCallback(()=>{N({isOpen:!1,conflicts:[],pendingPaste:null,pendingUpload:null})},[]),qe=F.useCallback(E=>{E.preventDefault(),E.stopPropagation();const I=E.dataTransfer.types,W=I.includes("Files"),X=I.includes("application/json");W&&!X&&z(!0)},[]),Je=F.useCallback(E=>{E.preventDefault(),E.stopPropagation();const I=E.dataTransfer.types,W=I.includes("Files"),X=I.includes("application/json");W&&!X?E.dataTransfer.dropEffect="copy":E.dataTransfer.dropEffect="none"},[]),st=F.useCallback(E=>{var W;E.preventDefault(),E.stopPropagation();const I=(W=O.current)==null?void 0:W.getBoundingClientRect();if(I){const X=E.clientX,H=E.clientY;(X<I.left||X>I.right||H<I.top||H>I.bottom)&&z(!1)}},[]),ct=F.useCallback(async E=>{var W,X,H,ue;if(E.preventDefault(),E.stopPropagation(),z(!1),!e){alert("请先选择素材库");return}const I=Array.from(E.dataTransfer.files);if(I.length!==0){console.log(`📤 准备上传 ${I.length} 个文件到: ${d||"根目录"}`),se({isUploading:!0,percent:0,current:0,total:I.length});try{const ve=await Kt.upload(e,d||"",I,Ge=>{const ft=Math.round(Ge.loaded*100/Ge.total);se(at=>({...at,percent:ft}))});se({isUploading:!1,percent:100,current:ve.success.length,total:I.length});const xe=ve.conflicts||[];if(xe.length>0){console.log(`⚠️ 检测到 ${xe.length} 个文件冲突`),N({isOpen:!0,conflicts:xe,pendingUpload:{files:I.filter(Ge=>{const ft=Ge.name;return xe.some(at Line truncated
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
<http://stuartk.com/jszip>
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/main/LICENSE
*/(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,s,i){function o(d,p){if(!s[d]){if(!r[d]){var v=typeof so=="function"&&so;if(!p&&v)return v(d,!0);if(a)return a(d,!0);var x=new Error("Cannot find module '"+d+"'");throw x.code="MODULE_NOT_FOUND",x}var y=s[d]={exports:{}};r[d][0].call(y.exports,function(g){var c=r[d][1][g];return o(c||g)},y,y.exports,n,r,s,i)}return s[d].exports}for(var a=typeof so=="function"&&so,l=0;l<i.length;l++)o(i[l]);return o}({1:[function(n,r,s){var i=n("./utils"),o=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(l){for(var d,p,v,x,y,g,c,w=[],f=0,h=l.length,b=h,_=i.getTypeOf(l)!=="string";f<l.length;)b=h-f,v=_?(d=l[f++],p=f<h?l[f++]:0,f<h?l[f++]:0):(d=l.charCodeAt(f++),p=f<h?l.charCodeAt(f++):0,f<h?l.charCodeAt(f++):0),x=d>>2,y=(3&d)<<4|p>>4,g=1<b?(15&p)<<2|v>>6:64,c=2<b?63&v:64,w.push(a.charAt(x)+a.charAt(y)+a.charAt(g)+a.charAt(c));return w.join("")},s.decode=function(l){var d,p,v,x,y,g,c=0,w=0,f="data:";if(l.substr(0,f.length)===f)throw new Error("Invalid base64 input, it looks like a data url.");var h,b=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&b--,l.charAt(l.length-2)===a.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=o.uint8array?new Uint8Array(0|b):new Array(0|b);c<l.length;)d=a.indexOf(l.charAt(c++))<<2|(x=a.indexOf(l.charAt(c++)))>>4,p=(15&x)<<4|(y=a.indexOf(l.charAt(c++)))>>2,v=(3&y)<<6|(g=a.indexOf(l.charAt(c++))),h[w++]=d,y!==64&&(h[w++]=p),g!==64&&(h[w++]=v);return h}},{"./support":30,"./utils":32}],2:[function(n,r,s){var i=n("./external"),o=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function d(p,v,x,y,g){this.compressedSize=p,this.uncompressedSize=v,this.crc32=x,this.compression=y,this.compressedContent=g}d.prototype={getContentWorker:function(){var p=new o(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),v=this;return p.on("end",function(){if(this.streamInfo.data_length!==v.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),p},getCompressedWorker:function(){return new o(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(p,v,x){return p.pipe(new a).pipe(new l("uncompressedSize")).pipe(v.compressWorker(x)).pipe(new l("compressedSize")).withStreamInfo("compression",v)},r.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,s){var i=n("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},s.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,s){var i=n("./utils"),o=function(){for(var a,l=[],d=0;d<256;d++){a=d;for(var p=0;p<8;p++)a=1&a?3988292384^a>>>1:a>>>1;l[d]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?function(d,p,v,x){var y=o,g=x+v;d^=-1;for(var c=x;c<g;c++)d=d>>>8^y[255&(d^p[c])];return-1^d}(0|l,a,a.length,0):function(d,p,v,x){var y=o,g=x+v;d^=-1;for(var c=x;c<g;c++)d=d>>>8^y[255&(d^p.charCodeAt(c))];return-1^d}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(n,r,s){var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),d=i?"uint8array":"array";function p(v,x){l.call(this,"FlateWorker/"+v),this._pako=null,this._pakoAction=v,this._pakoOptions=x,this.meta={}}s.magic="\b\0",a.inherits(p,l),p.prototype.processChunk=function(v){this.meta=v.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(d,v.data),!1)},p.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},p.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},p.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var v=this;this._pako.onData=function(x){v.push({data:x,meta:v.meta})}},s.compressWorker=function(v){return new p("Deflate",v)},s.uncompressWorker=function(){return new p("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,s){function i(y,g){var c,w="";for(c=0;c<g;c++)w+=String.fromCharCode(255&y),y>>>=8;return w}function o(y,g,c,w,f,h){var b,_,S=y.file,T=y.compression,j=h!==d.Line truncated
\0`,J+=i(P,2),J+=T.magic,J+=i(b,2),J+=i(_,2),J+=i(te.crc32,4),J+=i(te.compressedSize,4),J+=i(te.uncompressedSize,4),J+=i(L.length,2),J+=i(U.length,2),{fileRecord:v.LOCAL_FILE_HEADER+J+L+U,dirRecord:v.CENTRAL_FILE_HEADER+i(ie,2)+J+i(le.length,2)+"\0\0\0\0"+i(A,4)+i(w,4)+L+U+le}}var a=n("../utils"),l=n("../stream/GenericWorker"),d=n("../utf8"),p=n("../crc32"),v=n("../signature");function x(y,g,c,w){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=c,this.encodeFileName=w,this.streamFiles=y,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(x,l),x.prototype.push=function(y){var g=y.meta.percent||0,c=this.entriesCount,w=this._sources.length;this.accumulate?this.contentBuffer.push(y):(this.bytesWritten+=y.data.length,l.prototype.push.call(this,{data:y.data,meta:{currentFile:this.currentFile,percent:c?(g+100*(c-w-1))/c:100}}))},x.prototype.openedSource=function(y){this.currentSourceOffset=this.bytesWritten,this.currentFile=y.file.name;var g=this.streamFiles&&!y.file.dir;if(g){var c=o(y,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:c.fileRecord,meta:{percent:0}})}else this.accumulate=!0},x.prototype.closedSource=function(y){this.accumulate=!1;var g=this.streamFiles&&!y.file.dir,c=o(y,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(c.dirRecord),g)this.push({data:function(w){return v.DATA_DESCRIPTOR+i(w.crc32,4)+i(w.compressedSize,4)+i(w.uncompressedSize,4)}(y),meta:{percent:100}});else for(this.push({data:c.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},x.prototype.flush=function(){for(var y=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var c=this.bytesWritten-y,w=function(f,h,b,_,S){var T=a.transformTo("string",S(_));return v.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(f,2)+i(f,2)+i(h,4)+i(b,4)+i(T.length,2)+T}(this.dirRecords.length,c,y,this.zipComment,this.encodeFileName);this.push({data:w,meta:{percent:100}})},x.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},x.prototype.registerPrevious=function(y){this._sources.push(y);var g=this;return y.on("data",function(c){g.processChunk(c)}),y.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),y.on("error",function(c){g.error(c)}),this},x.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},x.prototype.error=function(y){var g=this._sources;if(!l.prototype.error.call(this,y))return!1;for(var c=0;c<g.length;c++)try{g[c].error(y)}catch{}return!0},x.prototype.lock=function(){l.prototype.lock.call(this);for(var y=this._sources,g=0;g<y.length;g++)y[g].lock()},r.exports=x},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,s){var i=n("../compressions"),o=n("./ZipFileWorker");s.generateWorker=function(a,l,d){var p=new o(l.streamFiles,d,l.platform,l.encodeFileName),v=0;try{a.forEach(function(x,y){v++;var g=function(h,b){var _=h||b,S=i[_];if(!S)throw new Error(_+" is not a valid compression method !");return S}(y.options.compression,l.compression),c=y.options.compressionOptions||l.compressionOptions||{},w=y.dir,f=y.date;y._compressWorker(g,c).withStreamInfo("file",{name:x,dir:w,date:f,comment:y.comment||"",unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions}).pipe(p)}),p.entriesCount=v}catch(x){p.error(x)}return p}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,s){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new i;for(var a in this)typeof this[a]!="function"&&(o[a]=this[a]);return o}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(o,a){return new i().loadAsync(o,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,s){var i=n("./utils"),o=n("./external"),a=n("./utf8"),l=n("./zipEntries"),d=n("./stream/Crc32Probe"),p=n("./nodejsUtils");function v(x){return new o.Promise(function(y,g){var c=x.decompressed.getContentWorker().pipe(new d);c.on("error",function(w){g(w)}).on("end",function(){c.streamInfo.crc32!==x.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):y()}).resume()})}r.exports=function(x,y){var g= Line truncated
transition-all duration-150
${r?"cursor-not-allowed opacity-50":"cursor-pointer hover:scale-110"}
${p?"animate-pulse":""}
`,onMouseEnter:()=>!r&&i(l),onClick:()=>a(l),title:`${l} 星`,children:u.jsx(bi,{size:n,className:`
transition-colors duration-150
${d?"fill-yellow-400 text-yellow-400":"fill-none text-gray-300 dark:text-gray-600"}
${p?"drop-shadow-lg":""}
`})},l)}),o>0&&u.jsxs("span",{className:"ml-2 text-sm text-gray-600 dark:text-gray-400",children:[o," 星"]})]})}function Lf(){const{currentLibraryId:e}=Rn(),{selectedImage:t,selectedImages:n,selectedFolder:r,selectedFolderItem:s,images:i,setSelectedImage:o,setSelectedImages:a,updateImage:l}=Ee(),{setMobileView:d,isResizingPanels:p,resizingSide:v}=Wt(),{copyToClipboard:x}=Ym(),[y,g]=F.useState(!1),[c,w]=F.useState(""),[f,h]=F.useState(!1),[b,_]=F.useState(!1),[S,T]=F.useState(!1),[j,L]=F.useState(0),[O,D]=F.useState(!1),[le,R]=F.useState(0),[Z,k]=F.useState(!1),[U,re]=F.useState(!1),[Y,B]=F.useState(""),M=F.useRef(null),[te,P]=F.useState(!1),A=n.length>0?t&&!n.some(q=>q.id===t.id)?n.length+1:n.length:t?1:0,ie=A>1,J=n.length>0?n[0]:t,{getCurrentLibrary:oe}=Rn(),_e=oe(),ae=()=>{const q=navigator.platform.toLowerCase(),we=navigator.userAgent.toLowerCase();return q.includes("win")||we.includes("windows")?"\\":"/"},ce=q=>{if(!q)return"";const we=ae();return q.replace(/[\\/]+/g,we)},be=q=>{if(!(_e!=null&&_e.path)||!q)return q||"";const we=ae(),fe=_e.path.replace(/[\\/]+$/,""),je=q.replace(/^[\\/]+/,""),Oe=`${fe}${we}${je}`;return ce(Oe)},Te=q=>{if(!q||q.length===0)return"";if(q.length===1)return be(q[0].path);const we=ae(),je=q.map(he=>be(he.path)).map(he=>he.split(/[\\/]/)),Oe=[],Pe=Math.min(...je.map(he=>he.length-1));for(let he=0;he<Pe;he++){const Ie=je[0][he];if(je.every(Le=>Le[he]===Ie))Oe.push(Ie);else break}return Oe.length>0?Oe.join(we):ce((_e==null?void 0:_e.path)||"")},Ce=async q=>{try{navigator.clipboard&&navigator.clipboard.writeText?await navigator.clipboard.writeText(q):de(q),k(!0),setTimeout(()=>k(!1),2e3)}catch(we){console.error("复制路径失败:",we),alert("复制失败,请重试")}},He=()=>{if(!t||ie)return;const q=t.filename.substring(0,t.filename.lastIndexOf("."))||t.filename;B(q),re(!0),setTimeout(()=>{M.current&&(M.current.focus(),M.current.select())},50)},Be=async()=>{if(!t||!Y.trim()){re(!1),B("");return}const q=t.filename,we=q.substring(q.lastIndexOf(".")),fe=Y.trim()+we;if(fe===q){re(!1),B("");return}try{const je=await Kt.rename(e,t.path,fe),Oe=je.data.newPath,Pe=je.data.newName;l(t.path,{path:Oe,filename:Pe}),console.log(`✅ 重命名成功: ${q} → ${Pe}`)}catch(je){console.error("重命名失败:",je),alert("重命名失败: "+(je.message||"未知错误"))}finally{re(!1),B("")}},m=()=>{re(!1),B("")},K=async q=>{const we=ge();if(we.length!==0){P(!0);try{const fe=we.map(je=>je.path);if(await De.updateRating(e,fe,q),we.forEach(je=>{l(je.path,{rating:q})}),t&&fe.includes(t.path)&&o({...t,rating:q}),n.length>0){const je=n.map(Oe=>fe.includes(Oe.path)?{...Oe,rating:q}:Oe);a(je)}console.log(`✅ 已更新 ${fe.length} 张图片的评分为 ${q} 星`)}catch(fe){console.error("更新评分失败:",fe),alert("更新评分失败: "+(fe.message||"未知错误"))}finally{P(!1)}}};F.useEffect(()=>{const q=()=>{g(window.innerWidth<768)};return q(),window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]),F.useEffect(()=>{if(!t||!e){w("");return}const q=C();if(w(q),h(!0),p){h(!1);return}const we=z(),fe=new Image;return fe.onload=()=>{w(we),h(!1)},fe.onerror=()=>{console.error("Failed to load original image"),h(!1)},fe.src=we,()=>{fe.onload=null,fe.onerror=null}},[t,e,p,v]);const V=s&&!t&&n.length===0,N=!V&&(t||n.length>0);if(!V&&!N)return u.jsx("div",{className:"w-full border-l border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex items-center justify-center",children:u.jsx("p",{className:"text-gray-400 dark:text-gray-500 text-sm",children:"选择文件或文件夹查看详情"})});const C=()=>{if(!e||!(t!=null&&t.thumbnail_path))return"";const q=t.thumbnail_path.replace(/\\/g,"/").split("/").pop();return De.getThumbnailUrl(e,q)},z=()=>!e||!(t!=null&&t.path)?"":De.getOriginalUrl(e,t.path),ee=()=>typeof ClipboardItem<"u"&&navigator.clipboard&&typeof navigator.clipboard.write=="function",se=async q=>new Promise(we=>{const fe=document.createElement("div");fe.setAttribute("contenteditable","true"),fe.style.position="fixed",fe.style.left="-9999px",fe.style.top="-9999px",fe.style.opacity="0",document.body.appendChild(fe);const je=document.createElement("img");je.crossOrigin="anonymous",je.onload=()=>{fe.appendChild(je);const Oe=document.createRange();Oe.selectNodeContents(fe);const Pe=window.getSelection();Pe.removeAllRanges(),Pe.addRange(Oe);let he=!1;try{he=document.execCommand("copy")}catch(Ie){console.error("execCommand copy 失败:",Ie)}Pe.removeAllRanges(),document.body.removeChild(fe),we(he)},je.onerror=()=>{document.body.removeChild(fe),we(!1)},je.src=q}),$=async q=>new Promise(async we=>{try{const je=await(await fetch(q)).blob(),Oe=new Image;Oe.crossOrigin="anonymous";const Pe=new Promise((Je,st)=>{Oe.onload=Je,Oe.onerror=st});Oe.src=URL.createObjectURL(je),await Pe;const he=document.createElement("canvas");he.width=Oe.width,he.height=Oe.height,he.getContext("2d").drawImage(Oe,0,0),URL.revokeObjectURL(Oe.src);const Le=he.toDataURL("imag Line truncated
(当前浏览器环境限制,无法直接复制图片)`)):alert(`复制失败,请手动复制图片链接:
`+we)}catch(q){console.error("复制图片失败:",q),alert("复制图片失败,请重试")}},pe=async q=>new Promise(async we=>{try{const fe=document.createElement("div");fe.setAttribute("contenteditable","true"),fe.style.position="fixed",fe.style.left="-9999px",fe.style.top="-9999px",fe.style.opacity="0",document.body.appendChild(fe);for(const{url:he,filename:Ie}of q)try{const Ae=await(await fetch(he)).blob(),ne=new Image;ne.crossOrigin="anonymous",await new Promise((st,ct)=>{ne.onload=st,ne.onerror=ct,ne.src=URL.createObjectURL(Ae)});const Se=document.createElement("canvas");Se.width=ne.width,Se.height=ne.height,Se.getContext("2d").drawImage(ne,0,0),URL.revokeObjectURL(ne.src);const qe=Se.toDataURL("image/png"),Je=document.createElement("img");Je.src=qe,Je.alt=Ie,Je.style.display="block",Je.style.marginBottom="10px",fe.appendChild(Je)}catch(Le){console.error(`加载图片失败: ${Ie}`,Le)}await new Promise(he=>setTimeout(he,100));const je=document.createRange();je.selectNodeContents(fe);const Oe=window.getSelection();Oe.removeAllRanges(),Oe.addRange(je);let Pe=!1;try{Pe=document.execCommand("copy")}catch(he){console.error("execCommand copy 失败:",he)}Oe.removeAllRanges(),document.body.removeChild(fe),we(Pe)}catch(fe){console.error("批量复制图片失败:",fe),we(!1)}}),ge=()=>n.length>0?t&&!n.some(q=>q.id===t.id)?[t,...n]:n:t?[t]:[],Ue=async()=>{try{const q=ge(),we=q.map(he=>({type:"file",path:he.path,data:he}));if(x(we,"copy"),console.log(`📋 已复制 ${we.length} 个文件到应用内剪贴板`),q.length===1){await ke();return}const fe=q.map(he=>({url:De.getOriginalUrl(e,he.path),filename:he.filename})),je=q.map(he=>he.filename).join(`
`);if(ee())try{const Ie=(await Promise.all(q.map(async Le=>{const Ae=De.getOriginalUrl(e,Le.path),Se=await(await fetch(Ae)).blob();return new Promise(ze=>{const qe=new FileReader;qe.onloadend=()=>{ze({dataUrl:qe.result,filename:Le.filename})},qe.readAsDataURL(Se)})}))).map(({dataUrl:Le,filename:Ae})=>`<span><img src="${Le}" alt="${Ae}"></span>`).join("");await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([Ie],{type:"text/html"}),"text/plain":new Blob([je],{type:"text/plain"})})]),_(!0),setTimeout(()=>_(!1),2e3);return}catch(he){console.warn("Clipboard API 失败,尝试备用方案:",he)}if(console.log("尝试 contenteditable 批量复制方案..."),await pe(fe)){_(!0),setTimeout(()=>_(!1),2e3);return}console.warn("批量图片复制失败,降级为复制文件名"),de(je)?(_(!0),setTimeout(()=>_(!1),2e3),alert(`已复制 ${q.length} 个文件名到剪贴板
(当前环境限制,建议使用"导出"功能)`)):alert('复制失败,请使用"导出"功能下载图片')}catch(q){console.error("复制图片失败:",q),alert("复制图片失败,请重试")}},Fe=async()=>{T(!0);try{const q=ge();if(q.length===1){const we=De.getOriginalUrl(e,q[0].path),fe=document.createElement("a");fe.href=we,fe.download=q[0].filename,fe.target="_blank",document.body.appendChild(fe),fe.click(),document.body.removeChild(fe)}else{const we=new Af,fe=we.folder("images");L(0);for(let Pe=0;Pe<q.length;Pe++){const he=q[Pe],Ie=De.getOriginalUrl(e,he.path);try{const Ae=await(await fetch(Ie)).blob();fe.file(he.filename,Ae);const ne=Math.round((Pe+1)/q.length*90);L(ne),console.log(`已添加: ${he.filename} (${Pe+1}/${q.length})`)}catch(Le){console.error(`下载失败: ${he.filename}`,Le)}}L(95),console.log("正在生成 ZIP 文件...");const je=await we.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}});L(100);const Oe=document.createElement("a");Oe.href=URL.createObjectURL(je),Oe.download=`FlyPic_导出_${q.length}张_${Date.now()}.zip`,document.body.appendChild(Oe),Oe.click(),document.body.removeChild(Oe),URL.revokeObjectURL(Oe.href),console.log("导出完成!")}}catch(q){console.error("导出失败:",q),alert("导出失败,请重试")}finally{T(!1)}},ot=async()=>{if(!r){alert("请先选择一个文件夹");return}D(!0),R(0);try{const q=i.filter(he=>he.folder&&he.folder.startsWith(r));if(q.length===0){alert("当前文件夹没有图片");return}const we=new Af,fe=r.split("/").pop()||"images",je=we.folder(fe);for(let he=0;he<q.length;he++){const Ie=q[he],Le=De.getOriginalUrl(e,Ie.path);try{const ne=await(await fetch(Le)).blob(),Se=Ie.folder.replace(r,"").replace(/^\//,""),ze=Se?`${Se}/${Ie.filename}`:Ie.filename;je.file(ze,ne);const qe=Math.round((he+1)/q.length*90);R(qe),console.log(`已添加: ${ze} (${he+1}/${q.length})`)}catch(Ae){console.error(`下载失败: ${Ie.filename}`,Ae)}}R(95),console.log("正在生成 ZIP 文件...");const Oe=await we.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}});R(100);const Pe=document.createElement("a");Pe.href=URL.createObjectURL(Oe),Pe.download=`${fe}_${q.length}张_${Date.now()}.zip`,document.body.appendChild(Pe),Pe.click(),document.body.removeChild(Pe),URL.revokeObjectURL(Pe.href),console.log("文件夹导出完成!")}catch(q){console.error("导出文件夹失败:",q),alert("导出文件夹失败,请重试")}finally{D(!1)}},wt=q=>q<1024?q+" B":q<1024*1024?(q/1024).toFixed(2)+" KB":(q/(1024*1024)).toFixed(2)+" MB",nt=q=>{if(!q)return"无数据";const we=new Date(q);return isNaN(we.getTime())?"无效日期":we.toLocaleString("zh-CN")},Rt=()=>{const q=ge();if(q.length===0)return null;const we=q.reduce((et,tn)=>et+(tn.size||0),0),fe=q.map(et=>et.width).filter(Boolean),je=q.map(et=>et.height).filter(Boolean),Oe=fe.length>0?Math.min(...fe):0,Pe=fe.length>0?Math.max(...fe):0,he=je.length>0?Math.min(...je):0,Ie=je.length>0?Math.max(...je):0,Le=[...new Set(q.map(et=>et.format).filter(Boolean))],Ae=q.map(et=>et.createdAt||et.created_at).filter(Boolean),ne=Ae.length>0?Math.min(...Ae):null,Se=Ae.length>0?Math.max(...Ae):null,ze=q.map(et=>et.modifiedAt||et.modified_at).filter(Boolean),qe=ze.length>0?Math.min(...ze):null,Je=ze.length>0?Math.max(...ze):null,st=q.map(et=>et.size).filter(Boolean),ct=st.length>0?Math.min(...st):0,gt=st.length>0?Math.max(...st):0;return{count:q.length,totalSize:we,sizeRange:{min:ct,max:gt},dimensionRange:{minWidth:Oe,maxWidth:Pe,minHeight:he,maxHeight:Ie},formats:Le,timeRange:{min:ne,max:Se},modifiedTimeRange:{min:qe,max:Je}}},$e=q=>{const we=i.filter(Oe=>{const Pe=Oe.folder||"";return Pe===q||Pe.startsWith(q+"/")}),fe=we.length,je=we.reduce((Oe,Pe)=>Oe+(Pe.size||0),0);return{totalCount:fe,totalSize:je}};if(V){const q=s.path,we=s.name,{totalCount:fe,totalSize:je}=$e(q),Oe=_e!=null&&_e.path?ce(`${_e.path}${ae()}${q}`):q;return u.jsxs("div",{className:"w-full border-l border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex flex-col h-full",children:[y&&u.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex items-center",children:u.jsxs("button",{onClick:()=>d("main"),className:"flex items-center gap-2 text-gray-700 dark:text-gray-300 hover:text-blue-500",children:[u.jsx(ff,{className:"w-5 h-5"}),u.jsx("span",{className:"text-sm font-medium",children:"返回"})]})}),u.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:u.jsx("div",{className:"w-full aspect-square bg-gradient-to-br from-blue-50 to-blue-100 dark:from-blue-900 dark:to-blue-800 border border-gray-200 dark:border-gray-600 rounded-lg overflow-hidden relative flex items-center justify-center",children:u.jsx(Yn,{className:"w-32 h-32 text-blue-500 dark:text-blue-300"})})}),u.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-0",children:u.jsxs("div",{children:[u.jsx("h3",{className:"text-sm font-semibold text-gray-7 Line truncated
@@ -0,0 +1 @@
.PhotoView-Portal{direction:ltr;height:100%;left:0;overflow:hidden;position:fixed;top:0;touch-action:none;width:100%;z-index:2000}@keyframes PhotoView__rotate{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes PhotoView__delayIn{0%,50%{opacity:0}to{opacity:1}}.PhotoView__Spinner{animation:PhotoView__delayIn .4s linear both}.PhotoView__Spinner svg{animation:PhotoView__rotate .6s linear infinite}.PhotoView__Photo{cursor:grab;max-width:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.PhotoView__Photo:active{cursor:grabbing}.PhotoView__icon{display:inline-block;left:0;position:absolute;top:0;transform:translate(-50%,-50%)}.PhotoView__PhotoBox,.PhotoView__PhotoWrap{bottom:0;direction:ltr;left:0;position:absolute;right:0;top:0;touch-action:none;width:100%}.PhotoView__PhotoWrap{overflow:hidden;z-index:10}.PhotoView__PhotoBox{transform-origin:left top}@keyframes PhotoView__fade{0%{opacity:0}to{opacity:1}}.PhotoView-Slider__clean .PhotoView-Slider__ArrowLeft,.PhotoView-Slider__clean .PhotoView-Slider__ArrowRight,.PhotoView-Slider__clean .PhotoView-Slider__BannerWrap,.PhotoView-Slider__clean .PhotoView-Slider__Overlay,.PhotoView-Slider__willClose .PhotoView-Slider__BannerWrap:hover{opacity:0}.PhotoView-Slider__Backdrop{background:#000;height:100%;left:0;position:absolute;top:0;transition-property:background-color;width:100%;z-index:-1}.PhotoView-Slider__fadeIn{animation:PhotoView__fade linear both;opacity:0}.PhotoView-Slider__fadeOut{animation:PhotoView__fade linear reverse both;opacity:0}.PhotoView-Slider__BannerWrap{align-items:center;background-color:#00000080;color:#fff;display:flex;height:44px;justify-content:space-between;left:0;position:absolute;top:0;transition:opacity .2s ease-out;width:100%;z-index:20}.PhotoView-Slider__BannerWrap:hover{opacity:1}.PhotoView-Slider__Counter{font-size:14px;opacity:.75;padding:0 10px}.PhotoView-Slider__BannerRight{align-items:center;display:flex;height:100%}.PhotoView-Slider__toolbarIcon{fill:#fff;box-sizing:border-box;cursor:pointer;opacity:.75;padding:10px;transition:opacity .2s linear}.PhotoView-Slider__toolbarIcon:hover{opacity:1}.PhotoView-Slider__ArrowLeft,.PhotoView-Slider__ArrowRight{align-items:center;bottom:0;cursor:pointer;display:flex;height:100px;justify-content:center;margin:auto;opacity:.75;position:absolute;top:0;transition:opacity .2s linear;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:70px;z-index:20}.PhotoView-Slider__ArrowLeft:hover,.PhotoView-Slider__ArrowRight:hover{opacity:1}.PhotoView-Slider__ArrowLeft svg,.PhotoView-Slider__ArrowRight svg{fill:#fff;background:#0000004d;box-sizing:content-box;height:24px;padding:10px;width:24px}.PhotoView-Slider__ArrowLeft{left:0}.PhotoView-Slider__ArrowRight{right:0}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-painLine truncated
+2 -2
View File
@@ -5,8 +5,8 @@
<link rel="icon" type="image/png" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>FlyPic 飞图 - 图片素材库管理</title>
<script type="module" crossorigin src="/assets/index-DHmcK1E-.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-KC1uux7K.css">
<script type="module" crossorigin src="/assets/index-BOz4q9XG.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BZhnqNDZ.css">
</head>
<body>
<div id="root"></div>␍
+23
View File
@@ -62,8 +62,11 @@ const io = new Server(server, {
// 准备依赖注入
// 包装 config 函数为对象接口
const configManager = {
// 兼容两种命名风格
load: () => config.loadConfig(),
save: (data) => config.saveConfig(data),
loadConfig: () => config.loadConfig(),
saveConfig: (data) => config.saveConfig(data),
addLibrary: (name, path) => config.addLibrary(name, path),
removeLibrary: (id) => config.removeLibrary(id),
updateLibrary: (id, updates) => config.updateLibrary(id, updates),
@@ -118,6 +121,26 @@ server.listen(PORT, () => {
try {
const currentConfig = config.loadConfig();
// 启动定时清理任务(每分钟检查一次过期临时文件)
const fileService = app.get('fileService');
setInterval(async () => {
if (currentConfig.libraries && currentConfig.libraries.length > 0) {
for (const library of currentConfig.libraries) {
try {
const result = await fileService.cleanExpiredTempFiles(library.id);
if (result.cleaned > 0 || result.thumbnailsCleaned > 0) {
const parts = [];
if (result.cleaned > 0) parts.push(`${result.cleaned} 个过期文件`);
if (result.thumbnailsCleaned > 0) parts.push(`${result.thumbnailsCleaned} 个缩略图`);
console.log(`🧹 已清理: ${parts.join('、')}`);
}
} catch (error) {
// 忽略错误
}
}
}
}, 60 * 1000); // 每分钟执行一次
// 恢复所有素材库的扫描状态
if (currentConfig.libraries && currentConfig.libraries.length > 0) {
scanManager.restoreAllStates(currentConfig.libraries);
+24 -1
View File
@@ -7,11 +7,14 @@ const express = require('express');
const cors = require('cors');
const path = require('path');
const { errorHandler } = require('./middleware/errorHandler');
const { createAuthMiddleware } = require('./middleware/authMiddleware');
// 导入服务
const LibraryService = require('./services/LibraryService');
const ImageService = require('./services/ImageService');
const ScanService = require('./services/ScanService');
const FileService = require('./services/FileService');
const AuthService = require('./services/AuthService');
/**
* 创建 Express 应用
@@ -33,6 +36,8 @@ function createApp(dependencies) {
app.use(express.json());
// 初始化服务
const authService = new AuthService(configManager);
const libraryService = new LibraryService(
configManager,
dbPool,
@@ -54,19 +59,37 @@ function createApp(dependencies) {
io
);
// 将服务注入到 app 中,供路由使用
const fileService = new FileService(dbPool, configManager);
// 将服务和依赖注入到 app 中,供路由使用
app.set('configManager', configManager);
app.set('dbPool', dbPool);
app.set('authService', authService);
app.set('libraryService', libraryService);
app.set('imageService', imageService);
app.set('scanService', scanService);
app.set('fileService', fileService);
// 认证中间件(仅作用于 /api 路由,避免拦截前端静态页面)
app.use('/api', createAuthMiddleware(
() => authService.getPasswordHash(),
() => authService.getJwtSecret()
));
// API 路由
const authRouter = require('./routes/auth');
const libraryRouter = require('./routes/library');
const imageRouter = require('./routes/image');
const scanRouter = require('./routes/scan');
const fileRouter = require('./routes/file');
const uploadRouter = require('./routes/upload');
app.use('/api/auth', authRouter);
app.use('/api/library', libraryRouter);
app.use('/api/image', imageRouter);
app.use('/api/scan', scanRouter);
app.use('/api/file', fileRouter);
app.use('/api/upload', uploadRouter);
// 健康检查
app.get('/api/health', (req, res) => {
@@ -0,0 +1,106 @@
/**
* 认证中间件
* 轻量级访问密码验证
*/
const jwt = require('jsonwebtoken');
const TOKEN_EXPIRY = '30d'; // Token 有效期 30 天
/**
* 生成 JWT Token
* @param {string} jwtSecret - JWT 密钥(从配置文件读取)
*/
function generateToken(jwtSecret) {
if (!jwtSecret) {
throw new Error('JWT_SECRET is required');
}
return jwt.sign(
{ app: 'flypic', timestamp: Date.now() },
jwtSecret,
{ expiresIn: TOKEN_EXPIRY }
);
}
/**
* 验证 JWT Token
* @param {string} token - JWT Token
* @param {string} jwtSecret - JWT 密钥(从配置文件读取)
*/
function verifyToken(token, jwtSecret) {
if (!jwtSecret) {
return false;
}
try {
jwt.verify(token, jwtSecret);
return true;
} catch (error) {
return false;
}
}
/**
* 认证中间件工厂
* @param {Function} getPasswordHash - 获取密码哈希的函数
* @param {Function} getJwtSecret - 获取 JWT 密钥的函数
*/
function createAuthMiddleware(getPasswordHash, getJwtSecret) {
return (req, res, next) => {
// 如果没有设置密码,直接放行
const passwordHash = getPasswordHash();
if (!passwordHash) {
return next();
}
// 公开接口(登录相关 / 健康检查 / 图片资源)
// 使用 req.originalUrl 获取完整路径(包含 /api 前缀,去除查询字符串)
const fullPath = req.originalUrl.split('?')[0];
// 精确匹配的公开路径
const publicPaths = [
'/api/auth/status',
'/api/auth/login',
'/api/auth/setup',
'/api/health'
];
// 前缀匹配的公开路径(缩略图 & 原图资源)
const publicPrefixes = [
'/api/image/thumbnail/', // 缩略图
'/api/image/original/' // 原图
];
if (
publicPaths.includes(fullPath) ||
publicPrefixes.some(prefix => fullPath.startsWith(prefix))
) {
return next();
}
// 检查 Authorization header
const authHeader = req.headers.authorization;
if (!authHeader || !authHeader.startsWith('Bearer ')) {
return res.status(401).json({
success: false,
error: { message: '未授权访问,请先登录' }
});
}
const token = authHeader.substring(7);
const jwtSecret = getJwtSecret();
if (!verifyToken(token, jwtSecret)) {
return res.status(401).json({
success: false,
error: { message: 'Token 无效或已过期,请重新登录' }
});
}
next();
};
}
module.exports = {
createAuthMiddleware,
generateToken,
verifyToken
};
@@ -60,7 +60,9 @@ const errorHandler = (err, req, res, next) => {
error: {
code: err.code,
message: err.message,
...(err.field && { field: err.field })
...(err.field && { field: err.field }),
...(err.remainingAttempts !== undefined && { remainingAttempts: err.remainingAttempts }),
...(err.currentAttempts !== undefined && { currentAttempts: err.currentAttempts })
}
});
}
+112
View File
@@ -0,0 +1,112 @@
/**
* 认证路由
*/
const express = require('express');
const router = express.Router();
/**
* GET /api/auth/status
* 获取认证状态
*/
router.get('/status', async (req, res, next) => {
try {
const authService = req.app.get('authService');
const status = authService.getStatus();
res.json({
success: true,
data: status
});
} catch (error) {
next(error);
}
});
/**
* POST /api/auth/setup
* 首次设置密码
* Body: { password: string }
*/
router.post('/setup', async (req, res, next) => {
try {
const authService = req.app.get('authService');
const { password } = req.body;
if (!password) {
return res.status(400).json({
success: false,
error: { message: '密码不能为空' }
});
}
const result = await authService.setupPassword(password);
res.json({
success: true,
data: result
});
} catch (error) {
next(error);
}
});
/**
* POST /api/auth/login
* 登录验证
* Body: { password: string }
*/
router.post('/login', async (req, res, next) => {
try {
const authService = req.app.get('authService');
const { password } = req.body;
if (!password) {
return res.status(400).json({
success: false,
error: { message: '密码不能为空' }
});
}
// 获取客户端 IP(用于防暴力破解)
const clientIP = req.ip || req.connection.remoteAddress || 'unknown';
const result = await authService.login(password, clientIP);
res.json({
success: true,
data: result
});
} catch (error) {
next(error);
}
});
/**
* POST /api/auth/change-password
* 修改密码(需要认证)
* Body: { oldPassword: string, newPassword: string }
*/
router.post('/change-password', async (req, res, next) => {
try {
const authService = req.app.get('authService');
const { oldPassword, newPassword } = req.body;
if (!oldPassword || !newPassword) {
return res.status(400).json({
success: false,
error: { message: '原密码和新密码不能为空' }
});
}
const result = await authService.changePassword(oldPassword, newPassword);
res.json({
success: true,
data: result
});
} catch (error) {
next(error);
}
});
module.exports = router;
+181
View File
@@ -0,0 +1,181 @@
/**
* 文件操作路由
* 提供删除、重命名、移动、复制等文件操作接口
*/
const express = require('express');
const router = express.Router();
const { asyncHandler } = require('../middleware/errorHandler');
// 服务实例(从 app 中获取)
let fileService;
router.use((req, res, next) => {
if (!fileService) {
fileService = req.app.get('fileService');
}
next();
});
/**
* 删除文件或文件夹(移到临时文件夹,5分钟内可撤销)
* DELETE /api/file/delete
* Body: { libraryId, items: [{type, path}] }
*/
router.delete('/delete', asyncHandler(async (req, res) => {
const { libraryId, items } = req.body;
if (!libraryId || !items || !Array.isArray(items)) {
return res.status(400).json({
success: false,
error: '缺少必要参数'
});
}
const results = await fileService.deleteItems(libraryId, items);
res.json({
success: true,
data: results
});
}));
/**
* 重命名文件或文件夹
* PATCH /api/file/rename
* Body: { libraryId, path, newName }
*/
router.patch('/rename', asyncHandler(async (req, res) => {
const { libraryId, path, newName } = req.body;
if (!libraryId || !path || !newName) {
return res.status(400).json({
success: false,
error: '缺少必要参数'
});
}
const result = await fileService.renameItem(libraryId, path, newName);
res.json({
success: true,
data: result
});
}));
/**
* 移动文件或文件夹
* POST /api/file/move
* Body: { libraryId, items: [{type, path}], targetFolder }
*/
router.post('/move', asyncHandler(async (req, res) => {
const { libraryId, items, targetFolder } = req.body;
if (!libraryId || !items || !Array.isArray(items) || targetFolder === undefined) {
return res.status(400).json({
success: false,
error: '缺少必要参数'
});
}
const results = await fileService.moveItems(libraryId, items, targetFolder);
res.json({
success: true,
data: results
});
}));
/**
* 复制文件或文件夹
* POST /api/file/copy
* Body: { libraryId, items: [{type, path}], targetFolder, conflictAction?: 'skip'|'replace'|'rename' }
*/
router.post('/copy', asyncHandler(async (req, res) => {
const { libraryId, items, targetFolder, conflictAction } = req.body;
if (!libraryId || !items || !Array.isArray(items) || targetFolder === undefined) {
return res.status(400).json({
success: false,
error: '缺少必要参数'
});
}
const results = await fileService.copyItems(libraryId, items, targetFolder, conflictAction);
res.json({
success: true,
data: results
});
}));
/**
* 更新文件元数据(评分、收藏、标签)
* PATCH /api/file/metadata
* Body: { libraryId, path, rating?, favorite?, tags? }
*/
router.patch('/metadata', asyncHandler(async (req, res) => {
const { libraryId, path, ...metadata } = req.body;
if (!libraryId || !path) {
return res.status(400).json({
success: false,
error: '缺少必要参数'
});
}
const result = await fileService.updateMetadata(libraryId, path, metadata);
res.json({
success: true,
data: result
});
}));
/**
* 恢复文件
*/
router.post('/restore', asyncHandler(async (req, res) => {
const { libraryId, items } = req.body;
if (!libraryId) {
throw new ValidationError('libraryId');
}
if (!Array.isArray(items) || items.length === 0) {
throw new ValidationError('items');
}
const fileService = req.app.get('fileService');
const result = await fileService.restoreItems(libraryId, items);
res.json({
success: true,
data: result
});
}));
/**
* 创建空文件夹
* POST /api/file/create-folder
* Body: { libraryId, folderPath }
*/
router.post('/create-folder', asyncHandler(async (req, res) => {
const { libraryId, folderPath } = req.body;
if (!libraryId || !folderPath) {
return res.status(400).json({
success: false,
error: '缺少必需参数'
});
}
const result = await fileService.createFolder(libraryId, folderPath);
res.json({
success: true,
data: result
});
}));
module.exports = router;
+26
View File
@@ -167,4 +167,30 @@ router.get('/original/:libraryId/*', (req, res) => {
}
});
/**
* 更新图片评分
* PUT /api/image/rating
* Body: { libraryId, paths: [string], rating: number }
*/
router.put('/rating', asyncHandler(async (req, res) => {
const { libraryId, paths, rating } = req.body;
if (!libraryId || !paths || !Array.isArray(paths) || paths.length === 0) {
return res.status(400).json({
success: false,
message: '缺少必要参数: libraryId, paths'
});
}
if (typeof rating !== 'number' || rating < 0 || rating > 5) {
return res.status(400).json({
success: false,
message: '评分必须是 0-5 之间的整数'
});
}
const result = await imageService.updateRating(libraryId, paths, rating);
res.json({ success: true, data: result });
}));
module.exports = router;
+231
View File
@@ -0,0 +1,231 @@
/**
* 文件上传路由
* 支持拖拽上传图片到指定文件夹
*/
const express = require('express');
const router = express.Router();
const multer = require('multer');
const path = require('path');
const fs = require('fs');
const { asyncHandler } = require('../middleware/errorHandler');
const { processImage } = require('../../utils/scanner');
// 配置 multer 使用内存存储
const storage = multer.memoryStorage();
const upload = multer({
storage: storage,
limits: {
fileSize: 100 * 1024 * 1024, // 100MB
}
// 移除文件格式限制,让扫描逻辑自动处理
});
/**
* 上传图片到指定文件夹
* POST /api/upload
* FormData: { libraryId, targetFolder, files[], conflictAction? }
* conflictAction: 'skip' | 'replace' | 'rename'
*/
router.post('/', upload.array('files', 50), asyncHandler(async (req, res) => {
console.log('📤 收到上传请求');
console.log(' libraryId:', req.body.libraryId);
console.log(' targetFolder:', req.body.targetFolder);
console.log(' conflictAction:', req.body.conflictAction);
console.log(' 文件数量:', req.files?.length);
const { libraryId, targetFolder, conflictAction } = req.body;
const files = req.files;
if (!libraryId) {
console.error('❌ 缺少 libraryId 参数');
return res.status(400).json({
success: false,
error: '缺少 libraryId 参数'
});
}
if (!files || files.length === 0) {
console.error('❌ 没有上传文件');
return res.status(400).json({
success: false,
error: '没有上传文件'
});
}
// 获取依赖
const dbPool = req.app.get('dbPool');
const configManager = req.app.get('configManager');
if (!dbPool || !configManager) {
console.error('❌ 服务未初始化');
return res.status(500).json({
success: false,
error: '服务未初始化'
});
}
// 获取素材库配置
const config = configManager.load();
const library = config.libraries.find(lib => lib.id === libraryId);
if (!library) {
console.error('❌ 素材库不存在:', libraryId);
return res.status(404).json({
success: false,
error: '素材库不存在'
});
}
// 获取数据库实例
const db = dbPool.acquire(library.path);
const libraryPath = library.path;
const targetPath = targetFolder
? path.join(libraryPath, targetFolder)
: libraryPath;
// 确保目标文件夹存在
if (!fs.existsSync(targetPath)) {
fs.mkdirSync(targetPath, { recursive: true });
}
const results = {
success: [],
failed: [],
conflicts: [] // 改为 conflicts,与粘贴逻辑一致
};
// 用于后台处理的文件列表
const filesToProcess = [];
// 第一阶段:保存文件(根据 conflictAction 处理冲突)
for (const file of files) {
try {
// 修复中文文件名乱码:multer 默认使用 latin1 编码,需要转换为 utf8
let filename = Buffer.from(file.originalname, 'latin1').toString('utf8');
let filePath = path.join(targetPath, filename);
// 检查文件是否已存在
if (fs.existsSync(filePath)) {
// 如果没有指定冲突处理方式,收集冲突信息返回给前端
if (!conflictAction) {
const relativePath = targetFolder
? path.join(targetFolder, filename).replace(/\\/g, '/')
: filename;
results.conflicts.push({
name: filename,
path: relativePath
});
console.log(`⚠️ 冲突: ${filename} (文件已存在)`);
continue;
}
// 根据 conflictAction 处理冲突
if (conflictAction === 'skip') {
console.log(`⏭️ 跳过: ${filename} (文件已存在)`);
continue;
} else if (conflictAction === 'replace') {
// 覆盖:删除旧文件
console.log(`🔄 覆盖: ${filename}`);
fs.unlinkSync(filePath);
} else if (conflictAction === 'rename') {
// 重命名:生成新文件名
const ext = path.extname(filename);
const nameWithoutExt = filename.substring(0, filename.length - ext.length);
let counter = 1;
let newFilename = filename;
let newFilePath = filePath;
while (fs.existsSync(newFilePath)) {
newFilename = `${nameWithoutExt} (${counter})${ext}`;
newFilePath = path.join(targetPath, newFilename);
counter++;
}
filename = newFilename;
filePath = newFilePath;
console.log(`📝 重命名: ${file.originalname} → ${filename}`);
}
}
// 写入文件(同步,快速)
fs.writeFileSync(filePath, file.buffer);
console.log(`📥 已保存: ${filename} (${(file.size / 1024).toFixed(2)} KB)`);
// 计算相对路径(使用最终的文件名)
const relativePath = targetFolder
? path.join(targetFolder, filename).replace(/\\/g, '/')
: filename;
results.success.push({
filename,
path: relativePath,
size: file.size
});
// 添加到待处理列表(只处理图片文件)
const ext = path.extname(filename).toLowerCase();
const imageExts = ['.jpg', '.jpeg', '.png', '.webp', '.gif', '.bmp', '.tiff', '.svg'];
if (imageExts.includes(ext)) {
filesToProcess.push({ filePath, filename });
}
} catch (error) {
console.error(`❌ 保存失败: ${file.originalname}`, error);
results.failed.push({
filename: file.originalname,
error: error.message
});
}
}
// 第二阶段:后台异步处理图片(生成缩略图、提取元数据)
// 不阻塞响应,让前端可以立即刷新
if (filesToProcess.length > 0) {
setImmediate(async () => {
console.log(`🔄 开始后台处理 ${filesToProcess.length} 个图片...`);
for (const { filePath, filename } of filesToProcess) {
try {
await processImage(filePath, libraryPath, db.db);
console.log(`✅ 已处理: ${filename}`);
} catch (processError) {
console.error(`❌ 处理图片失败: ${filename}`, processError.message);
}
}
console.log(`✅ 后台处理完成`);
});
}
// 更新文件夹图片计数
if (targetFolder && results.success.length > 0) {
try {
console.log(`📊 更新文件夹计数: ${targetFolder}`);
const updateStmt = db.db.prepare(`
UPDATE folders
SET image_count = (
SELECT COUNT(*) FROM images WHERE folder = ? OR folder LIKE ?
),
last_scan = ?
WHERE path = ?
`);
updateStmt.run(
targetFolder,
targetFolder + '/%',
Date.now(),
targetFolder
);
console.log(`✅ 文件夹计数已更新`);
} catch (error) {
console.error('❌ 更新文件夹计数失败:', error);
console.error(' 错误详情:', error.stack);
}
}
console.log(`📋 上传结果: 成功 ${results.success.length}, 失败 ${results.failed.length}, 冲突 ${results.conflicts.length}`);
res.json({
success: true,
data: results
});
}));
module.exports = router;
@@ -0,0 +1,203 @@
/**
* 认证服务
* 处理密码设置、验证、修改
*/
const bcrypt = require('bcrypt');
const crypto = require('crypto');
const { generateToken } = require('../middleware/authMiddleware');
const { AppError } = require('../middleware/errorHandler');
const SALT_ROUNDS = 10;
const MAX_LOGIN_ATTEMPTS = 30; // 最大登录尝试次数
const ATTEMPT_WINDOW = 5 * 60 * 1000; // 5分钟窗口期
class AuthService {
constructor(configManager) {
this.configManager = configManager;
// 登录失败记录:IP → { count, firstAttempt, lastAttempt }
this.loginAttempts = new Map();
// 定期清理过期的登录尝试记录(每10分钟)
setInterval(() => {
const now = Date.now();
for (const [ip, data] of this.loginAttempts.entries()) {
if (now - data.lastAttempt > ATTEMPT_WINDOW) {
this.loginAttempts.delete(ip);
}
}
}, 10 * 60 * 1000);
}
/**
* 检查是否已设置密码
*/
hasPassword() {
const config = this.configManager.loadConfig();
return !!config.passwordHash;
}
/**
* 获取密码哈希
*/
getPasswordHash() {
const config = this.configManager.loadConfig();
return config.passwordHash || null;
}
/**
* 获取 JWT 密钥
*/
getJwtSecret() {
const config = this.configManager.loadConfig();
return config.jwtSecret || null;
}
/**
* 设置密码(首次设置)
*/
async setupPassword(password) {
if (this.hasPassword()) {
// 已设置密码,属于业务错误
throw new AppError('密码已设置,请使用修改密码功能', 400, 'PASSWORD_ALREADY_SET');
}
if (!password || password.length < 4) {
throw new AppError('密码长度至少为 4 位', 400, 'INVALID_PASSWORD');
}
const passwordHash = await bcrypt.hash(password, SALT_ROUNDS);
const config = this.configManager.loadConfig();
// 生成随机 JWT 密钥(首次设置时)
if (!config.jwtSecret) {
config.jwtSecret = crypto.randomBytes(32).toString('hex');
console.log('🔐 已生成随机 JWT 密钥');
}
config.passwordHash = passwordHash;
this.configManager.saveConfig(config);
return { token: generateToken(config.jwtSecret) };
}
/**
* 验证密码并登录
* @param {string} password - 密码
* @param {string} clientIP - 客户端IP(用于防暴力破解)
*/
async login(password, clientIP = 'unknown') {
if (!this.hasPassword()) {
// 未设置密码,提示先设置
throw new AppError('未设置密码,请先设置密码', 400, 'PASSWORD_NOT_SET');
}
// 检查登录尝试次数(防暴力破解)
const now = Date.now();
const attempts = this.loginAttempts.get(clientIP);
if (attempts) {
// 检查是否在窗口期内
if (now - attempts.firstAttempt < ATTEMPT_WINDOW) {
// 仍在窗口期内
if (attempts.count >= MAX_LOGIN_ATTEMPTS) {
const remainingTime = Math.ceil((ATTEMPT_WINDOW - (now - attempts.firstAttempt)) / 1000);
throw new AppError(
`登录尝试次数过多,请 ${remainingTime} 秒后再试`,
429,
'TOO_MANY_ATTEMPTS'
);
}
} else {
// 超过窗口期,重置计数
this.loginAttempts.delete(clientIP);
}
}
const passwordHash = this.getPasswordHash();
const jwtSecret = this.getJwtSecret();
if (!jwtSecret) {
throw new AppError('系统配置错误,请重新设置密码', 500, 'MISSING_JWT_SECRET');
}
const isValid = await bcrypt.compare(password, passwordHash);
if (!isValid) {
// 记录失败尝试
if (attempts) {
attempts.count++;
attempts.lastAttempt = now;
} else {
this.loginAttempts.set(clientIP, {
count: 1,
firstAttempt: now,
lastAttempt: now
});
}
// 密码错误:返回 401 未授权,并附带剩余尝试次数
const currentAttempts = attempts ? attempts.count : 1;
const remainingAttempts = MAX_LOGIN_ATTEMPTS - currentAttempts;
console.log(`⚠️ 登录失败 [${clientIP}]: 已尝试 ${currentAttempts} 次,剩余 ${remainingAttempts} 次`);
// 创建错误并附带额外信息
const error = new AppError('密码错误', 401, 'INVALID_PASSWORD');
error.remainingAttempts = remainingAttempts;
error.currentAttempts = currentAttempts;
throw error;
}
// 登录成功,清除尝试记录
this.loginAttempts.delete(clientIP);
console.log(`✅ 登录成功 [${clientIP}]`);
return { token: generateToken(jwtSecret) };
}
/**
* 修改密码
*/
async changePassword(oldPassword, newPassword) {
if (!this.hasPassword()) {
throw new AppError('未设置密码', 400, 'PASSWORD_NOT_SET');
}
if (!newPassword || newPassword.length < 4) {
throw new AppError('新密码长度至少为 4 位', 400, 'INVALID_NEW_PASSWORD');
}
// 验证旧密码
const passwordHash = this.getPasswordHash();
const isValid = await bcrypt.compare(oldPassword, passwordHash);
if (!isValid) {
throw new AppError('原密码错误', 401, 'INVALID_OLD_PASSWORD');
}
// 设置新密码
const newPasswordHash = await bcrypt.hash(newPassword, SALT_ROUNDS);
const config = this.configManager.loadConfig();
config.passwordHash = newPasswordHash;
this.configManager.saveConfig(config);
const jwtSecret = this.getJwtSecret();
if (!jwtSecret) {
throw new AppError('系统配置错误', 500, 'MISSING_JWT_SECRET');
}
return { token: generateToken(jwtSecret) };
}
/**
* 获取认证状态
*/
getStatus() {
return {
hasPassword: this.hasPassword(),
requireAuth: this.hasPassword()
};
}
}
module.exports = AuthService;
File diff suppressed because it is too large. Load diff
@@ -162,6 +162,52 @@ class ImageService {
}
}
/**
* 批量更新图片评分
*/
async updateRating(libraryId, paths, rating) {
const library = this._getLibrary(libraryId);
const db = this.dbPool.acquire(library.path);
try {
const imageModel = new ImageModel(db.db);
const results = {
success: [],
failed: []
};
// 批量更新
for (const imagePath of paths) {
try {
const stmt = db.db.prepare('UPDATE images SET rating = ? WHERE path = ?');
const result = stmt.run(rating, imagePath);
if (result.changes > 0) {
results.success.push(imagePath);
} else {
results.failed.push({ path: imagePath, error: '图片不存在' });
}
} catch (error) {
results.failed.push({ path: imagePath, error: error.message });
}
}
// 更新数据库修改时间
if (results.success.length > 0) {
db.updateLastModified();
}
return {
updated: results.success.length,
failed: results.failed.length,
success: results.success,
failed: results.failed
};
} finally {
this.dbPool.release(library.path);
}
}
/**
* 获取素材库对象
* @private
@@ -180,13 +180,14 @@ class LightweightWatcher {
try {
// 获取数据库中这些文件夹的文件列表
// 🔥 关键修复:只查询文件夹直接包含的文件,不包含子文件夹
// 因为 _scanFolder 不递归扫描,如果这里包含子文件夹,会误删子文件夹的记录
const dbFiles = new Set();
for (const folder of changedFolders) {
const relativePath = path.relative(libraryPath, folder).replace(/\\/g, '/');
// 使用正确的 SQL 模式匹配
const pattern = relativePath ? `${relativePath}/%` : '%';
const stmt = db.db.prepare('SELECT path FROM images WHERE folder = ? OR folder LIKE ?');
const rows = stmt.all(relativePath, pattern);
// 只查询 folder = ? 的记录,不包含子文件夹(去掉 OR folder LIKE ?/%)
const stmt = db.db.prepare('SELECT path FROM images WHERE folder = ?');
const rows = stmt.all(relativePath);
rows.forEach(row => dbFiles.add(row.path));
}
+25
View File
@@ -1,2 +1,27 @@
#!/bin/bash
# FlyPic 卸载后清理脚本
# 清理应用配置文件(包括密码、JWT密钥等)
# 不清理素材库中的 .flypic 数据(缩略图、数据库等)
echo "🧹 FlyPic 卸载清理..."
# 清理应用配置文件
if [ -n "$TRIM_PKGVAR" ]; then
CONFIG_FILE="$TRIM_PKGVAR/config.json"
if [ -f "$CONFIG_FILE" ]; then
echo "清理配置文件: $CONFIG_FILE"
rm -f "$CONFIG_FILE"
echo "✅ 配置文件已清理"
else
echo "📝 未找到配置文件,跳过"
fi
else
echo "⚠️ 未检测到飞牛环境变量"
fi
echo "✨ 卸载清理完成"
echo "💡 素材库中的 .flypic 数据已保留"
exit 0
+1 -1
View File
@@ -1,5 +1,5 @@
appname=flypic
version=1.0.5
version=1.2.0
desc=飞图 - 专为飞牛 fnOS 设计的轻量、快速、稳定的图像素材检索浏览应用,支持数十万级别图片流畅浏览,非侵入式设计,100% 开源免费
arch=x86_64
display_name=FlyPic
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "flypic-frontend",
"version": "1.0.5",
"version": "1.2.0",
"private": true,
"type": "module",
"scripts": {
+11 -11
View File
@@ -38,7 +38,7 @@
},
"frontend": {
"name": "flypic-frontend",
"version": "1.0.5",
"version": "1.2.0",
"dependencies": {
"axios": "^1.6.2",
"jszip": "^3.10.1",
@@ -859,8 +859,8 @@
}
},
"node_modules/@img/sharp-libvips-linux-arm": {
"version": "1.0.5",
"resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz",
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.2.0.tgz",
"integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==",
"cpu": [
"arm"
@@ -973,7 +973,7 @@
"url": "https://opencollective.com/libvips"
},
"optionalDependencies": {
"@img/sharp-libvips-linux-arm": "1.0.5"
"@img/sharp-libvips-linux-arm": "1.2.0"
}
},
"node_modules/@img/sharp-linux-arm64": {
@@ -2199,7 +2199,7 @@
"license": "MIT",
"dependencies": {
"bytes": "3.1.2",
"content-type": "~1.0.5",
"content-type": "~1.2.0",
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
@@ -2587,8 +2587,8 @@
}
},
"node_modules/content-type": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.2.0.tgz",
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
"license": "MIT",
"engines": {
@@ -3954,7 +3954,7 @@
"lie": "~3.3.0",
"pako": "~1.0.2",
"readable-stream": "~2.3.6",
"setimmediate": "^1.0.5"
"setimmediate": "^1.2.0"
}
},
"node_modules/jszip/node_modules/readable-stream": {
@@ -5524,8 +5524,8 @@
}
},
"node_modules/setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmmirror.com/setimmediate/-/setimmediate-1.0.5.tgz",
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/setimmediate/-/setimmediate-1.2.0.tgz",
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==",
"license": "MIT"
},
@@ -5557,7 +5557,7 @@
"@img/sharp-darwin-x64": "0.33.5",
"@img/sharp-libvips-darwin-arm64": "1.0.4",
"@img/sharp-libvips-darwin-x64": "1.0.4",
"@img/sharp-libvips-linux-arm": "1.0.5",
"@img/sharp-libvips-linux-arm": "1.2.0",
"@img/sharp-libvips-linux-arm64": "1.0.4",
"@img/sharp-libvips-linux-s390x": "1.0.4",
"@img/sharp-libvips-linux-x64": "1.0.4",