From 22bb29f433f56522273738a51541a104a83c5014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=8B=A5?= Date: Mon, 9 Mar 2026 05:49:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=86=85=E5=AE=B9=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=B7=B1=E5=BA=A6=E4=BC=98=E5=8C=96=20(03-07~03-09)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 排名算法权重可配置,排行榜显示点击量/付款数/热度 - 富文本编辑器升级(TipTap),支持@提及/#链接标签/图片/表格 - 「主人公」Tab → 「链接AI」Tab,AI列表+链接标签管理 - 链接标签新增存客宝(ckb)类型,存客宝绑定配置面板 - 人物ID改为可选,名称必填 - 排行榜操作改为「编辑文章」,付款记录移入编辑弹窗 - 章节ID修改支持(originalId/newId机制) - 付款记录用户ID/订单ID可点击跳转 - 项目推进表补充14-15节(03-07~09改动记录+存客宝技术方案) Made-with: Cursor --- soul-admin/dist/assets/index-DALKpE2i.js | 774 ++ soul-admin/dist/assets/index-jScXDwzJ.css | 1 - soul-admin/dist/assets/index-kWgz5G0L.js | 521 -- soul-admin/dist/assets/index-z9Ciz_la.css | 1 + soul-admin/dist/index.html | 4 +- soul-admin/src/components/RichEditor.css | 196 + soul-admin/src/components/RichEditor.tsx | 335 + .../modules/user/UserDetailModal.tsx | 153 +- soul-admin/src/pages/content/ContentPage.tsx | 330 +- .../src/pages/dashboard/DashboardPage.tsx | 54 +- soul-admin/src/pages/users/UsersPage.tsx | 54 +- soul-admin/tsconfig.tsbuildinfo | 2 +- soul-api/internal/database/database.go | 9 + soul-api/internal/handler/db_book.go | 4 + soul-api/internal/handler/db_person.go | 130 + soul-api/internal/model/person.go | 28 + soul-api/internal/router/router.go | 6 + soul-api/wechat/info.log | 6240 +++++++++++++++++ 开发文档/10、项目管理/项目落地推进表.md | 86 + 开发文档/1、需求/修改/20260308内容管理3.md | 14 + 开发文档/1、需求/修改/20260308内容管理4.md | 10 + 开发文档/1、需求/修改/_模板_需求文档.md | 39 - .../1、需求/修改/images/2026-03-09-05-18-28.png | Bin 0 -> 324327 bytes .../1、需求/修改/images/2026-03-09-05-22-19.png | Bin 0 -> 414048 bytes .../1、需求/修改/images/2026-03-09-05-23-53.png | Bin 0 -> 245146 bytes .../1、需求/修改/images/2026-03-09-05-24-19.png | Bin 0 -> 263471 bytes .../1、需求/修改/images/2026-03-09-05-25-52.png | Bin 0 -> 258795 bytes .../1、需求/修改/images/2026-03-09-05-35-24.png | Bin 0 -> 269688 bytes .../1、需求/修改/images/2026-03-09-05-36-51.png | Bin 0 -> 275684 bytes 29 files changed, 8283 insertions(+), 708 deletions(-) create mode 100644 soul-admin/dist/assets/index-DALKpE2i.js delete mode 100644 soul-admin/dist/assets/index-jScXDwzJ.css delete mode 100644 soul-admin/dist/assets/index-kWgz5G0L.js create mode 100644 soul-admin/dist/assets/index-z9Ciz_la.css create mode 100644 soul-admin/src/components/RichEditor.css create mode 100644 soul-admin/src/components/RichEditor.tsx create mode 100644 soul-api/internal/handler/db_person.go create mode 100644 soul-api/internal/model/person.go create mode 100644 开发文档/1、需求/修改/20260308内容管理3.md create mode 100644 开发文档/1、需求/修改/20260308内容管理4.md delete mode 100644 开发文档/1、需求/修改/_模板_需求文档.md create mode 100644 开发文档/1、需求/修改/images/2026-03-09-05-18-28.png create mode 100644 开发文档/1、需求/修改/images/2026-03-09-05-22-19.png create mode 100644 开发文档/1、需求/修改/images/2026-03-09-05-23-53.png create mode 100644 开发文档/1、需求/修改/images/2026-03-09-05-24-19.png create mode 100644 开发文档/1、需求/修改/images/2026-03-09-05-25-52.png create mode 100644 开发文档/1、需求/修改/images/2026-03-09-05-35-24.png create mode 100644 开发文档/1、需求/修改/images/2026-03-09-05-36-51.png diff --git a/soul-admin/dist/assets/index-DALKpE2i.js b/soul-admin/dist/assets/index-DALKpE2i.js new file mode 100644 index 00000000..5a5632da --- /dev/null +++ b/soul-admin/dist/assets/index-DALKpE2i.js @@ -0,0 +1,774 @@ +function n3(t,e){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();function xN(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var im={exports:{}},Gl={},am={exports:{}},lt={};/** + * @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 ob;function r3(){if(ob)return lt;ob=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function g(L){return L===null||typeof L!="object"?null:(L=m&&L[m]||L["@@iterator"],typeof L=="function"?L:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,j={};function w(L,H,ue){this.props=L,this.context=H,this.refs=j,this.updater=ue||y}w.prototype.isReactComponent={},w.prototype.setState=function(L,H){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,H,"setState")},w.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function k(){}k.prototype=w.prototype;function E(L,H,ue){this.props=L,this.context=H,this.refs=j,this.updater=ue||y}var C=E.prototype=new k;C.constructor=E,v(C,w.prototype),C.isPureReactComponent=!0;var M=Array.isArray,D=Object.prototype.hasOwnProperty,F={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function I(L,H,ue){var U,he={},Q=null,ee=null;if(H!=null)for(U in H.ref!==void 0&&(ee=H.ref),H.key!==void 0&&(Q=""+H.key),H)D.call(H,U)&&!R.hasOwnProperty(U)&&(he[U]=H[U]);var de=arguments.length-2;if(de===1)he.children=ue;else if(1>>1,H=V[L];if(0>>1;Ls(he,Y))Qs(ee,he)?(V[L]=ee,V[Q]=Y,L=Q):(V[L]=he,V[U]=Y,L=U);else if(Qs(ee,Y))V[L]=ee,V[Q]=Y,L=Q;else break e}}return ae}function s(V,ae){var Y=V.sortIndex-ae.sortIndex;return Y!==0?Y:V.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,m=null,g=3,y=!1,v=!1,j=!1,w=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(V){for(var ae=n(h);ae!==null;){if(ae.callback===null)r(h);else if(ae.startTime<=V)r(h),ae.sortIndex=ae.expirationTime,e(u,ae);else break;ae=n(h)}}function M(V){if(j=!1,C(V),!v)if(n(u)!==null)v=!0,$(D);else{var ae=n(h);ae!==null&&oe(M,ae.startTime-V)}}function D(V,ae){v=!1,j&&(j=!1,k(I),I=-1),y=!0;var Y=g;try{for(C(ae),m=n(u);m!==null&&(!(m.expirationTime>ae)||V&&!W());){var L=m.callback;if(typeof L=="function"){m.callback=null,g=m.priorityLevel;var H=L(m.expirationTime<=ae);ae=t.unstable_now(),typeof H=="function"?m.callback=H:m===n(u)&&r(u),C(ae)}else r(u);m=n(u)}if(m!==null)var ue=!0;else{var U=n(h);U!==null&&oe(M,U.startTime-ae),ue=!1}return ue}finally{m=null,g=Y,y=!1}}var F=!1,R=null,I=-1,A=5,O=-1;function W(){return!(t.unstable_now()-OV||125L?(V.sortIndex=Y,e(h,V),n(u)===null&&V===n(h)&&(j?(k(I),I=-1):j=!0,oe(M,Y-L))):(V.sortIndex=H,e(u,V),v||y||(v=!0,$(D))),V},t.unstable_shouldYield=W,t.unstable_wrapCallback=function(V){var ae=g;return function(){var Y=g;g=ae;try{return V.apply(this,arguments)}finally{g=Y}}}})(cm)),cm}var hb;function o3(){return hb||(hb=1,lm.exports=a3()),lm.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 fb;function l3(){if(fb)return cr;fb=1;var t=$c(),e=o3();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[: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]*$/,f={},m={};function g(l){return u.call(m,l)?!0:u.call(f,l)?!1:h.test(l)?m[l]=!0:(f[l]=!0,!1)}function y(l,d,p,x){if(p!==null&&p.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return x?!1:p!==null?!p.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function v(l,d,p,x){if(d===null||typeof d>"u"||y(l,d,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function j(l,d,p,x,N,S,T){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=N,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=T}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){w[l]=new j(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];w[d]=new j(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){w[l]=new j(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){w[l]=new j(l,2,!1,l,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(l){w[l]=new j(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){w[l]=new j(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){w[l]=new j(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){w[l]=new j(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){w[l]=new j(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(l){return l[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(l){var d=l.replace(k,E);w[d]=new j(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,E);w[d]=new j(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,E);w[d]=new j(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){w[l]=new j(l,1,!1,l.toLowerCase(),null,!1,!1)}),w.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){w[l]=new j(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,p,x){var N=w.hasOwnProperty(d)?w[d]:null;(N!==null?N.type!==0:x||!(2z||N[T]!==S[z]){var K=` +`+N[T].replace(" at new "," at ");return l.displayName&&K.includes("")&&(K=K.replace("",l.displayName)),K}while(1<=T&&0<=z);break}}}finally{ue=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?H(l):""}function he(l){switch(l.tag){case 5:return H(l.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return l=U(l.type,!1),l;case 11:return l=U(l.type.render,!1),l;case 1:return l=U(l.type,!0),l;default:return""}}function Q(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case R:return"Fragment";case F:return"Portal";case A:return"Profiler";case I:return"StrictMode";case q:return"Suspense";case Z:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case W:return(l.displayName||"Context")+".Consumer";case O:return(l._context.displayName||"Context")+".Provider";case X:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case _:return d=l.displayName||null,d!==null?d:Q(l.type)||"Memo";case $:d=l._payload,l=l._init;try{return Q(l(d))}catch{}}return null}function ee(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Q(d);case 8:return d===I?"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 d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function de(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function Ce(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function B(l){var d=Ce(l)?"checked":"value",p=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),x=""+l[d];if(!l.hasOwnProperty(d)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var N=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return N.call(this)},set:function(T){x=""+T,S.call(this,T)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(T){x=""+T},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function me(l){l._valueTracker||(l._valueTracker=B(l))}function Se(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=Ce(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function rt(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function Ye(l,d){var p=d.checked;return Y({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function st(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=de(d.value!=null?d.value:p),l._wrapperState={initialChecked:x,initialValue:p,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function Qe(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function Xe(l,d){Qe(l,d);var p=de(d.value),x=d.type;if(p!=null)x==="number"?(p===0&&l.value===""||l.value!=p)&&(l.value=""+p):l.value!==""+p&&(l.value=""+p);else if(x==="submit"||x==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Pt(l,d.type,p):d.hasOwnProperty("defaultValue")&&Pt(l,d.type,de(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function ft(l,d,p){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var x=d.type;if(!(x!=="submit"&&x!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,p||d===l.value||(l.value=d),l.defaultValue=d}p=l.name,p!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,p!==""&&(l.name=p)}function Pt(l,d,p){(d!=="number"||rt(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Jt=Array.isArray;function Kn(l,d,p,x){if(l=l.options,d){d={};for(var N=0;N"+d.valueOf().toString()+"",d=pn.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function Br(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var Gn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fe=["Webkit","ms","Moz","O"];Object.keys(Gn).forEach(function(l){fe.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),Gn[d]=Gn[l]})});function ge(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||Gn.hasOwnProperty(l)&&Gn[l]?(""+d).trim():d+"px"}function Sn(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,N=ge(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,N):l[p]=N}}var ri=Y({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Es(l,d){if(d){if(ri[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function ua(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Jn=null;function as(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var jt=null,Cn=null,Yn=null;function Dn(l){if(l=Pl(l)){if(typeof jt!="function")throw Error(n(280));var d=l.stateNode;d&&(d=yd(d),jt(l.stateNode,l.type,d))}}function ha(l){Cn?Yn?Yn.push(l):Yn=[l]:Cn=l}function si(){if(Cn){var l=Cn,d=Yn;if(Yn=Cn=null,Dn(l),d)for(l=0;l>>=0,l===0?32:31-(P(l)/ie|0)|0}var Re=64,Ot=4194304;function Vt(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Ln(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,N=l.suspendedLanes,S=l.pingedLanes,T=p&268435455;if(T!==0){var z=T&~N;z!==0?x=Vt(z):(S&=T,S!==0&&(x=Vt(S)))}else T=p&~N,T!==0?x=Vt(T):S!==0&&(x=Vt(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&N)===0&&(N=x&-x,S=d&-d,N>=S||N===16&&(S&4194240)!==0))return d;if((x&4)!==0&&(x|=p&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=x;0p;p++)d.push(l);return d}function li(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-rr(d),l[d]=p}function jE(l,d){var p=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0=kl),ey=" ",ty=!1;function ny(l,d){switch(l){case"keyup":return QE.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ry(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var lo=!1;function ZE(l,d){switch(l){case"compositionend":return ry(d);case"keypress":return d.which!==32?null:(ty=!0,ey);case"textInput":return l=d.data,l===ey&&ty?null:l;default:return null}}function e4(l,d){if(lo)return l==="compositionend"||!$f&&ny(l,d)?(l=G0(),od=Pf=fi=null,lo=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-l};l=x}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=dy(p)}}function hy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?hy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function fy(){for(var l=window,d=rt();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=rt(l.document)}return d}function Vf(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function c4(l){var d=fy(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&hy(p.ownerDocument.documentElement,p)){if(x!==null&&Vf(p)){if(d=x.start,l=x.end,l===void 0&&(l=d),"selectionStart"in p)p.selectionStart=d,p.selectionEnd=Math.min(l,p.value.length);else if(l=(d=p.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var N=p.textContent.length,S=Math.min(x.start,N);x=x.end===void 0?S:Math.min(x.end,N),!l.extend&&S>x&&(N=x,x=S,S=N),N=uy(p,S);var T=uy(p,x);N&&T&&(l.rangeCount!==1||l.anchorNode!==N.node||l.anchorOffset!==N.offset||l.focusNode!==T.node||l.focusOffset!==T.offset)&&(d=d.createRange(),d.setStart(N.node,N.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(T.node,T.offset)):(d.setEnd(T.node,T.offset),l.addRange(d)))}}for(d=[],l=p;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p=document.documentMode,co=null,Hf=null,Tl=null,Wf=!1;function py(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Wf||co==null||co!==rt(x)||(x=co,"selectionStart"in x&&Vf(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),Tl&&El(Tl,x)||(Tl=x,x=md(Hf,"onSelect"),0mo||(l.current=np[mo],np[mo]=null,mo--)}function kt(l,d){mo++,np[mo]=l.current,l.current=d}var xi={},_n=gi(xi),sr=gi(!1),ga=xi;function go(l,d){var p=l.type.contextTypes;if(!p)return xi;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var N={},S;for(S in p)N[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=N),N}function ir(l){return l=l.childContextTypes,l!=null}function vd(){Tt(sr),Tt(_n)}function My(l,d,p){if(_n.current!==xi)throw Error(n(168));kt(_n,d),kt(sr,p)}function Ay(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var N in x)if(!(N in d))throw Error(n(108,ee(l)||"Unknown",N));return Y({},p,x)}function bd(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||xi,ga=_n.current,kt(_n,l),kt(sr,sr.current),!0}function Ry(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Ay(l,d,ga),x.__reactInternalMemoizedMergedChildContext=l,Tt(sr),Tt(_n),kt(_n,l)):Tt(sr),kt(sr,p)}var As=null,wd=!1,rp=!1;function Iy(l){As===null?As=[l]:As.push(l)}function w4(l){wd=!0,Iy(l)}function yi(){if(!rp&&As!==null){rp=!0;var l=0,d=xt;try{var p=As;for(xt=1;l>=T,N-=T,Rs=1<<32-rr(d)+N|p<Je?(yn=Ue,Ue=null):yn=Ue.sibling;var ut=xe(ne,Ue,se[Je],Ne);if(ut===null){Ue===null&&(Ue=yn);break}l&&Ue&&ut.alternate===null&&d(ne,Ue),J=S(ut,J,Je),We===null?ze=ut:We.sibling=ut,We=ut,Ue=yn}if(Je===se.length)return p(ne,Ue),Dt&&ya(ne,Je),ze;if(Ue===null){for(;JeJe?(yn=Ue,Ue=null):yn=Ue.sibling;var Ei=xe(ne,Ue,ut.value,Ne);if(Ei===null){Ue===null&&(Ue=yn);break}l&&Ue&&Ei.alternate===null&&d(ne,Ue),J=S(Ei,J,Je),We===null?ze=Ei:We.sibling=Ei,We=Ei,Ue=yn}if(ut.done)return p(ne,Ue),Dt&&ya(ne,Je),ze;if(Ue===null){for(;!ut.done;Je++,ut=se.next())ut=be(ne,ut.value,Ne),ut!==null&&(J=S(ut,J,Je),We===null?ze=ut:We.sibling=ut,We=ut);return Dt&&ya(ne,Je),ze}for(Ue=x(ne,Ue);!ut.done;Je++,ut=se.next())ut=Ie(Ue,ne,Je,ut.value,Ne),ut!==null&&(l&&ut.alternate!==null&&Ue.delete(ut.key===null?Je:ut.key),J=S(ut,J,Je),We===null?ze=ut:We.sibling=ut,We=ut);return l&&Ue.forEach(function(t3){return d(ne,t3)}),Dt&&ya(ne,Je),ze}function Yt(ne,J,se,Ne){if(typeof se=="object"&&se!==null&&se.type===R&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case D:e:{for(var ze=se.key,We=J;We!==null;){if(We.key===ze){if(ze=se.type,ze===R){if(We.tag===7){p(ne,We.sibling),J=N(We,se.props.children),J.return=ne,ne=J;break e}}else if(We.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===$&&zy(ze)===We.type){p(ne,We.sibling),J=N(We,se.props),J.ref=Ol(ne,We,se),J.return=ne,ne=J;break e}p(ne,We);break}else d(ne,We);We=We.sibling}se.type===R?(J=Ca(se.props.children,ne.mode,Ne,se.key),J.return=ne,ne=J):(Ne=Jd(se.type,se.key,se.props,null,ne.mode,Ne),Ne.ref=Ol(ne,J,se),Ne.return=ne,ne=Ne)}return T(ne);case F:e:{for(We=se.key;J!==null;){if(J.key===We)if(J.tag===4&&J.stateNode.containerInfo===se.containerInfo&&J.stateNode.implementation===se.implementation){p(ne,J.sibling),J=N(J,se.children||[]),J.return=ne,ne=J;break e}else{p(ne,J);break}else d(ne,J);J=J.sibling}J=em(se,ne.mode,Ne),J.return=ne,ne=J}return T(ne);case $:return We=se._init,Yt(ne,J,We(se._payload),Ne)}if(Jt(se))return Oe(ne,J,se,Ne);if(ae(se))return _e(ne,J,se,Ne);Sd(ne,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,J!==null&&J.tag===6?(p(ne,J.sibling),J=N(J,se),J.return=ne,ne=J):(p(ne,J),J=Zp(se,ne.mode,Ne),J.return=ne,ne=J),T(ne)):p(ne,J)}return Yt}var bo=$y(!0),Fy=$y(!1),Cd=gi(null),Ed=null,wo=null,cp=null;function dp(){cp=wo=Ed=null}function up(l){var d=Cd.current;Tt(Cd),l._currentValue=d}function hp(l,d,p){for(;l!==null;){var x=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),l===p)break;l=l.return}}function No(l,d){Ed=l,cp=wo=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(ar=!0),l.firstContext=null)}function Ar(l){var d=l._currentValue;if(cp!==l)if(l={context:l,memoizedValue:d,next:null},wo===null){if(Ed===null)throw Error(n(308));wo=l,Ed.dependencies={lanes:0,firstContext:l}}else wo=wo.next=l;return d}var va=null;function fp(l){va===null?va=[l]:va.push(l)}function By(l,d,p,x){var N=d.interleaved;return N===null?(p.next=p,fp(d)):(p.next=N.next,N.next=p),d.interleaved=p,Ps(l,x)}function Ps(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var vi=!1;function pp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vy(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function Os(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function bi(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(dt&2)!==0){var N=x.pending;return N===null?d.next=d:(d.next=N.next,N.next=d),x.pending=d,Ps(l,p)}return N=x.interleaved,N===null?(d.next=d,fp(x)):(d.next=N.next,N.next=d),x.interleaved=d,Ps(l,p)}function Td(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Tf(l,p)}}function Hy(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var N=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var T={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?N=S=T:S=S.next=T,p=p.next}while(p!==null);S===null?N=S=d:S=S.next=d}else N=S=d;p={baseState:x.baseState,firstBaseUpdate:N,lastBaseUpdate:S,shared:x.shared,effects:x.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function Md(l,d,p,x){var N=l.updateQueue;vi=!1;var S=N.firstBaseUpdate,T=N.lastBaseUpdate,z=N.shared.pending;if(z!==null){N.shared.pending=null;var K=z,le=K.next;K.next=null,T===null?S=le:T.next=le,T=K;var ye=l.alternate;ye!==null&&(ye=ye.updateQueue,z=ye.lastBaseUpdate,z!==T&&(z===null?ye.firstBaseUpdate=le:z.next=le,ye.lastBaseUpdate=K))}if(S!==null){var be=N.baseState;T=0,ye=le=K=null,z=S;do{var xe=z.lane,Ie=z.eventTime;if((x&xe)===xe){ye!==null&&(ye=ye.next={eventTime:Ie,lane:0,tag:z.tag,payload:z.payload,callback:z.callback,next:null});e:{var Oe=l,_e=z;switch(xe=d,Ie=p,_e.tag){case 1:if(Oe=_e.payload,typeof Oe=="function"){be=Oe.call(Ie,be,xe);break e}be=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=_e.payload,xe=typeof Oe=="function"?Oe.call(Ie,be,xe):Oe,xe==null)break e;be=Y({},be,xe);break e;case 2:vi=!0}}z.callback!==null&&z.lane!==0&&(l.flags|=64,xe=N.effects,xe===null?N.effects=[z]:xe.push(z))}else Ie={eventTime:Ie,lane:xe,tag:z.tag,payload:z.payload,callback:z.callback,next:null},ye===null?(le=ye=Ie,K=be):ye=ye.next=Ie,T|=xe;if(z=z.next,z===null){if(z=N.shared.pending,z===null)break;xe=z,z=xe.next,xe.next=null,N.lastBaseUpdate=xe,N.shared.pending=null}}while(!0);if(ye===null&&(K=be),N.baseState=K,N.firstBaseUpdate=le,N.lastBaseUpdate=ye,d=N.shared.interleaved,d!==null){N=d;do T|=N.lane,N=N.next;while(N!==d)}else S===null&&(N.shared.lanes=0);Na|=T,l.lanes=T,l.memoizedState=be}}function Wy(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=vp.transition;vp.transition={};try{l(!1),d()}finally{xt=p,vp.transition=x}}function cv(){return Rr().memoizedState}function S4(l,d,p){var x=ki(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},dv(l))uv(d,p);else if(p=By(l,d,p,x),p!==null){var N=Xn();Gr(p,l,x,N),hv(p,d,x)}}function C4(l,d,p){var x=ki(l),N={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(dv(l))uv(d,N);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var T=d.lastRenderedState,z=S(T,p);if(N.hasEagerState=!0,N.eagerState=z,Hr(z,T)){var K=d.interleaved;K===null?(N.next=N,fp(d)):(N.next=K.next,K.next=N),d.interleaved=N;return}}catch{}finally{}p=By(l,d,N,x),p!==null&&(N=Xn(),Gr(p,l,x,N),hv(p,d,x))}}function dv(l){var d=l.alternate;return l===Bt||d!==null&&d===Bt}function uv(l,d){zl=Id=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function hv(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Tf(l,p)}}var Dd={readContext:Ar,useCallback:zn,useContext:zn,useEffect:zn,useImperativeHandle:zn,useInsertionEffect:zn,useLayoutEffect:zn,useMemo:zn,useReducer:zn,useRef:zn,useState:zn,useDebugValue:zn,useDeferredValue:zn,useTransition:zn,useMutableSource:zn,useSyncExternalStore:zn,useId:zn,unstable_isNewReconciler:!1},E4={readContext:Ar,useCallback:function(l,d){return ms().memoizedState=[l,d===void 0?null:d],l},useContext:Ar,useEffect:tv,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Pd(4194308,4,sv.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Pd(4194308,4,l,d)},useInsertionEffect:function(l,d){return Pd(4,2,l,d)},useMemo:function(l,d){var p=ms();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=ms();return d=p!==void 0?p(d):d,x.memoizedState=x.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},x.queue=l,l=l.dispatch=S4.bind(null,Bt,l),[x.memoizedState,l]},useRef:function(l){var d=ms();return l={current:l},d.memoizedState=l},useState:Zy,useDebugValue:Cp,useDeferredValue:function(l){return ms().memoizedState=l},useTransition:function(){var l=Zy(!1),d=l[0];return l=k4.bind(null,l[1]),ms().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=Bt,N=ms();if(Dt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),xn===null)throw Error(n(349));(wa&30)!==0||Gy(x,d,p)}N.memoizedState=p;var S={value:p,getSnapshot:d};return N.queue=S,tv(Yy.bind(null,x,S,l),[l]),x.flags|=2048,Bl(9,Jy.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=ms(),d=xn.identifierPrefix;if(Dt){var p=Is,x=Rs;p=(x&~(1<<32-rr(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=$l++,0<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=T.createElement(p,{is:x.is}):(l=T.createElement(p),p==="select"&&(T=l,x.multiple?T.multiple=!0:x.size&&(T.size=x.size))):l=T.createElementNS(l,p),l[fs]=d,l[Il]=x,Iv(l,d,!1,!1),d.stateNode=l;e:{switch(T=ua(p,x),p){case"dialog":Et("cancel",l),Et("close",l),N=x;break;case"iframe":case"object":case"embed":Et("load",l),N=x;break;case"video":case"audio":for(N=0;NEo&&(d.flags|=128,x=!0,Vl(S,!1),d.lanes=4194304)}else{if(!x)if(l=Ad(T),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Vl(S,!0),S.tail===null&&S.tailMode==="hidden"&&!T.alternate&&!Dt)return $n(d),null}else 2*$t()-S.renderingStartTime>Eo&&p!==1073741824&&(d.flags|=128,x=!0,Vl(S,!1),d.lanes=4194304);S.isBackwards?(T.sibling=d.child,d.child=T):(p=S.last,p!==null?p.sibling=T:d.child=T,S.last=T)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=$t(),d.sibling=null,p=Ft.current,kt(Ft,x?p&1|2:p&1),d):($n(d),null);case 22:case 23:return Yp(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(br&1073741824)!==0&&($n(d),d.subtreeFlags&6&&(d.flags|=8192)):$n(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function D4(l,d){switch(ip(d),d.tag){case 1:return ir(d.type)&&vd(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return jo(),Tt(sr),Tt(_n),yp(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return gp(d),null;case 13:if(Tt(Ft),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));vo()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return Tt(Ft),null;case 4:return jo(),null;case 10:return up(d.type._context),null;case 22:case 23:return Yp(),null;case 24:return null;default:return null}}var $d=!1,Fn=!1,L4=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function So(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){Ht(l,d,x)}else p.current=null}function zp(l,d,p){try{p()}catch(x){Ht(l,d,x)}}var Dv=!1;function _4(l,d){if(Yf=id,l=fy(),Vf(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var N=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var T=0,z=-1,K=-1,le=0,ye=0,be=l,xe=null;t:for(;;){for(var Ie;be!==p||N!==0&&be.nodeType!==3||(z=T+N),be!==S||x!==0&&be.nodeType!==3||(K=T+x),be.nodeType===3&&(T+=be.nodeValue.length),(Ie=be.firstChild)!==null;)xe=be,be=Ie;for(;;){if(be===l)break t;if(xe===p&&++le===N&&(z=T),xe===S&&++ye===x&&(K=T),(Ie=be.nextSibling)!==null)break;be=xe,xe=be.parentNode}be=Ie}p=z===-1||K===-1?null:{start:z,end:K}}else p=null}p=p||{start:0,end:0}}else p=null;for(Qf={focusedElem:l,selectionRange:p},id=!1,Pe=d;Pe!==null;)if(d=Pe,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Pe=l;else for(;Pe!==null;){d=Pe;try{var Oe=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Oe!==null){var _e=Oe.memoizedProps,Yt=Oe.memoizedState,ne=d.stateNode,J=ne.getSnapshotBeforeUpdate(d.elementType===d.type?_e:Ur(d.type,_e),Yt);ne.__reactInternalSnapshotBeforeUpdate=J}break;case 3:var se=d.stateNode.containerInfo;se.nodeType===1?se.textContent="":se.nodeType===9&&se.documentElement&&se.removeChild(se.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ne){Ht(d,d.return,Ne)}if(l=d.sibling,l!==null){l.return=d.return,Pe=l;break}Pe=d.return}return Oe=Dv,Dv=!1,Oe}function Hl(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var N=x=x.next;do{if((N.tag&l)===l){var S=N.destroy;N.destroy=void 0,S!==void 0&&zp(d,p,S)}N=N.next}while(N!==x)}}function Fd(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var p=d=d.next;do{if((p.tag&l)===l){var x=p.create;p.destroy=x()}p=p.next}while(p!==d)}}function $p(l){var d=l.ref;if(d!==null){var p=l.stateNode;switch(l.tag){case 5:l=p;break;default:l=p}typeof d=="function"?d(l):d.current=l}}function Lv(l){var d=l.alternate;d!==null&&(l.alternate=null,Lv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[fs],delete d[Il],delete d[tp],delete d[v4],delete d[b4])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function _v(l){return l.tag===5||l.tag===3||l.tag===4}function zv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||_v(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Fp(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=xd));else if(x!==4&&(l=l.child,l!==null))for(Fp(l,d,p),l=l.sibling;l!==null;)Fp(l,d,p),l=l.sibling}function Bp(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(x!==4&&(l=l.child,l!==null))for(Bp(l,d,p),l=l.sibling;l!==null;)Bp(l,d,p),l=l.sibling}var Tn=null,Kr=!1;function wi(l,d,p){for(p=p.child;p!==null;)$v(l,d,p),p=p.sibling}function $v(l,d,p){if(gr&&typeof gr.onCommitFiberUnmount=="function")try{gr.onCommitFiberUnmount(pa,p)}catch{}switch(p.tag){case 5:Fn||So(p,d);case 6:var x=Tn,N=Kr;Tn=null,wi(l,d,p),Tn=x,Kr=N,Tn!==null&&(Kr?(l=Tn,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):Tn.removeChild(p.stateNode));break;case 18:Tn!==null&&(Kr?(l=Tn,p=p.stateNode,l.nodeType===8?ep(l.parentNode,p):l.nodeType===1&&ep(l,p),wl(l)):ep(Tn,p.stateNode));break;case 4:x=Tn,N=Kr,Tn=p.stateNode.containerInfo,Kr=!0,wi(l,d,p),Tn=x,Kr=N;break;case 0:case 11:case 14:case 15:if(!Fn&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){N=x=x.next;do{var S=N,T=S.destroy;S=S.tag,T!==void 0&&((S&2)!==0||(S&4)!==0)&&zp(p,d,T),N=N.next}while(N!==x)}wi(l,d,p);break;case 1:if(!Fn&&(So(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(z){Ht(p,d,z)}wi(l,d,p);break;case 21:wi(l,d,p);break;case 22:p.mode&1?(Fn=(x=Fn)||p.memoizedState!==null,wi(l,d,p),Fn=x):wi(l,d,p);break;default:wi(l,d,p)}}function Fv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new L4),d.forEach(function(x){var N=K4.bind(null,l,x);p.has(x)||(p.add(x),x.then(N,N))})}}function qr(l,d){var p=d.deletions;if(p!==null)for(var x=0;xN&&(N=T),x&=~S}if(x=N,x=$t()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*$4(x/1960))-x,10l?16:l,ji===null)var x=!1;else{if(l=ji,ji=null,Ud=0,(dt&6)!==0)throw Error(n(331));var N=dt;for(dt|=4,Pe=l.current;Pe!==null;){var S=Pe,T=S.child;if((Pe.flags&16)!==0){var z=S.deletions;if(z!==null){for(var K=0;K$t()-Wp?ka(l,0):Hp|=p),lr(l,d)}function Zv(l,d){d===0&&((l.mode&1)===0?d=1:(d=Ot,Ot<<=1,(Ot&130023424)===0&&(Ot=4194304)));var p=Xn();l=Ps(l,d),l!==null&&(li(l,d,p),lr(l,p))}function U4(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),Zv(l,p)}function K4(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,N=l.memoizedState;N!==null&&(p=N.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),Zv(l,p)}var eb;eb=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||sr.current)ar=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return ar=!1,P4(l,d,p);ar=(l.flags&131072)!==0}else ar=!1,Dt&&(d.flags&1048576)!==0&&Py(d,jd,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;zd(l,d),l=d.pendingProps;var N=go(d,_n.current);No(d,p),N=wp(null,d,x,l,N,p);var S=Np();return d.flags|=1,typeof N=="object"&&N!==null&&typeof N.render=="function"&&N.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,ir(x)?(S=!0,bd(d)):S=!1,d.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,pp(d),N.updater=Ld,d.stateNode=N,N._reactInternals=d,Tp(d,x,l,p),d=Ip(null,d,x,!0,S,p)):(d.tag=0,Dt&&S&&sp(d),Qn(null,d,N,p),d=d.child),d;case 16:x=d.elementType;e:{switch(zd(l,d),l=d.pendingProps,N=x._init,x=N(x._payload),d.type=x,N=d.tag=G4(x),l=Ur(x,l),N){case 0:d=Rp(null,d,x,l,p);break e;case 1:d=Cv(null,d,x,l,p);break e;case 11:d=wv(null,d,x,l,p);break e;case 14:d=Nv(null,d,x,Ur(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ur(x,N),Rp(l,d,x,N,p);case 1:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ur(x,N),Cv(l,d,x,N,p);case 3:e:{if(Ev(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,N=S.element,Vy(l,d),Md(d,x,null,p);var T=d.memoizedState;if(x=T.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){N=ko(Error(n(423)),d),d=Tv(l,d,x,p,N);break e}else if(x!==N){N=ko(Error(n(424)),d),d=Tv(l,d,x,p,N);break e}else for(vr=mi(d.stateNode.containerInfo.firstChild),yr=d,Dt=!0,Wr=null,p=Fy(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(vo(),x===N){d=Ds(l,d,p);break e}Qn(l,d,x,p)}d=d.child}return d;case 5:return Uy(d),l===null&&op(d),x=d.type,N=d.pendingProps,S=l!==null?l.memoizedProps:null,T=N.children,Xf(x,N)?T=null:S!==null&&Xf(x,S)&&(d.flags|=32),Sv(l,d),Qn(l,d,T,p),d.child;case 6:return l===null&&op(d),null;case 13:return Mv(l,d,p);case 4:return mp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=bo(d,null,x,p):Qn(l,d,x,p),d.child;case 11:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ur(x,N),wv(l,d,x,N,p);case 7:return Qn(l,d,d.pendingProps,p),d.child;case 8:return Qn(l,d,d.pendingProps.children,p),d.child;case 12:return Qn(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,N=d.pendingProps,S=d.memoizedProps,T=N.value,kt(Cd,x._currentValue),x._currentValue=T,S!==null)if(Hr(S.value,T)){if(S.children===N.children&&!sr.current){d=Ds(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var z=S.dependencies;if(z!==null){T=S.child;for(var K=z.firstContext;K!==null;){if(K.context===x){if(S.tag===1){K=Os(-1,p&-p),K.tag=2;var le=S.updateQueue;if(le!==null){le=le.shared;var ye=le.pending;ye===null?K.next=K:(K.next=ye.next,ye.next=K),le.pending=K}}S.lanes|=p,K=S.alternate,K!==null&&(K.lanes|=p),hp(S.return,p,d),z.lanes|=p;break}K=K.next}}else if(S.tag===10)T=S.type===d.type?null:S.child;else if(S.tag===18){if(T=S.return,T===null)throw Error(n(341));T.lanes|=p,z=T.alternate,z!==null&&(z.lanes|=p),hp(T,p,d),T=S.sibling}else T=S.child;if(T!==null)T.return=S;else for(T=S;T!==null;){if(T===d){T=null;break}if(S=T.sibling,S!==null){S.return=T.return,T=S;break}T=T.return}S=T}Qn(l,d,N.children,p),d=d.child}return d;case 9:return N=d.type,x=d.pendingProps.children,No(d,p),N=Ar(N),x=x(N),d.flags|=1,Qn(l,d,x,p),d.child;case 14:return x=d.type,N=Ur(x,d.pendingProps),N=Ur(x.type,N),Nv(l,d,x,N,p);case 15:return jv(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ur(x,N),zd(l,d),d.tag=1,ir(x)?(l=!0,bd(d)):l=!1,No(d,p),pv(d,x,N),Tp(d,x,N,p),Ip(null,d,x,!0,l,p);case 19:return Rv(l,d,p);case 22:return kv(l,d,p)}throw Error(n(156,d.tag))};function tb(l,d){return Xc(l,d)}function q4(l,d,p,x){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pr(l,d,p,x){return new q4(l,d,p,x)}function Xp(l){return l=l.prototype,!(!l||!l.isReactComponent)}function G4(l){if(typeof l=="function")return Xp(l)?1:0;if(l!=null){if(l=l.$$typeof,l===X)return 11;if(l===_)return 14}return 2}function Ci(l,d){var p=l.alternate;return p===null?(p=Pr(l.tag,d,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=d,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&14680064,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,d=l.dependencies,p.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p}function Jd(l,d,p,x,N,S){var T=2;if(x=l,typeof l=="function")Xp(l)&&(T=1);else if(typeof l=="string")T=5;else e:switch(l){case R:return Ca(p.children,N,S,d);case I:T=8,N|=8;break;case A:return l=Pr(12,p,d,N|2),l.elementType=A,l.lanes=S,l;case q:return l=Pr(13,p,d,N),l.elementType=q,l.lanes=S,l;case Z:return l=Pr(19,p,d,N),l.elementType=Z,l.lanes=S,l;case oe:return Yd(p,N,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case O:T=10;break e;case W:T=9;break e;case X:T=11;break e;case _:T=14;break e;case $:T=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Pr(T,p,d,N),d.elementType=l,d.type=x,d.lanes=S,d}function Ca(l,d,p,x){return l=Pr(7,l,x,d),l.lanes=p,l}function Yd(l,d,p,x){return l=Pr(22,l,x,d),l.elementType=oe,l.lanes=p,l.stateNode={isHidden:!1},l}function Zp(l,d,p){return l=Pr(6,l,null,d),l.lanes=p,l}function em(l,d,p){return d=Pr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function J4(l,d,p,x,N){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sn(0),this.expirationTimes=sn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sn(0),this.identifierPrefix=x,this.onRecoverableError=N,this.mutableSourceEagerHydrationData=null}function tm(l,d,p,x,N,S,T,z,K){return l=new J4(l,d,p,z,K),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Pr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},pp(S),l}function Y4(l,d,p){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),om.exports=l3(),om.exports}var mb;function c3(){if(mb)return ru;mb=1;var t=yN();return ru.createRoot=t.createRoot,ru.hydrateRoot=t.hydrateRoot,ru}var d3=c3(),Fc=yN();const vN=xN(Fc);/** + * @remix-run/router v1.23.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function wc(){return wc=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function xx(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function h3(){return Math.random().toString(36).substr(2,8)}function xb(t,e){return{usr:t.state,key:t.key,idx:e}}function og(t,e,n,r){return n===void 0&&(n=null),wc({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?il(e):e,{state:n,key:e&&e.key||r||h3()})}function Fu(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function il(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function f3(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:a=!1}=r,o=s.history,c=$i.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(wc({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=$i.Pop;let w=f(),k=w==null?null:w-h;h=w,u&&u({action:c,location:j.location,delta:k})}function g(w,k){c=$i.Push;let E=og(j.location,w,k);h=f()+1;let C=xb(E,h),M=j.createHref(E);try{o.pushState(C,"",M)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;s.location.assign(M)}a&&u&&u({action:c,location:j.location,delta:1})}function y(w,k){c=$i.Replace;let E=og(j.location,w,k);h=f();let C=xb(E,h),M=j.createHref(E);o.replaceState(C,"",M),a&&u&&u({action:c,location:j.location,delta:0})}function v(w){let k=s.location.origin!=="null"?s.location.origin:s.location.href,E=typeof w=="string"?w:Fu(w);return E=E.replace(/ $/,"%20"),nn(k,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,k)}let j={get action(){return c},get location(){return t(s,o)},listen(w){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(gb,m),u=w,()=>{s.removeEventListener(gb,m),u=null}},createHref(w){return e(s,w)},createURL:v,encodeLocation(w){let k=v(w);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(w){return o.go(w)}};return j}var yb;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(yb||(yb={}));function p3(t,e,n){return n===void 0&&(n="/"),m3(t,e,n)}function m3(t,e,n,r){let s=typeof e=="string"?il(e):e,a=yx(s.pathname||"/",n);if(a==null)return null;let o=bN(t);g3(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};u.relativePath.startsWith("/")&&(nn(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let h=Wi([r,u.relativePath]),f=n.concat(u);a.children&&a.children.length>0&&(nn(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),bN(a.children,e,f,h)),!(a.path==null&&!a.index)&&e.push({path:h,score:j3(h,a.index),routesMeta:f})};return t.forEach((a,o)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))s(a,o);else for(let u of wN(a.path))s(a,o,u)}),e}function wN(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return s?[a,""]:[a];let o=wN(r.join("/")),c=[];return c.push(...o.map(u=>u===""?a:[a,u].join("/"))),s&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function g3(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:k3(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const x3=/^:[\w-]+$/,y3=3,v3=2,b3=1,w3=10,N3=-2,vb=t=>t==="*";function j3(t,e){let n=t.split("/"),r=n.length;return n.some(vb)&&(r+=N3),e&&(r+=v3),n.filter(s=>!vb(s)).reduce((s,a)=>s+(x3.test(a)?y3:a===""?b3:w3),r)}function k3(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function S3(t,e,n){let{routesMeta:r}=t,s={},a="/",o=[];for(let c=0;c{let{paramName:g,isOptional:y}=f;if(g==="*"){let j=c[m]||"";o=a.slice(0,a.length-j.length).replace(/(.)\/+$/,"$1")}const v=c[m];return y&&!v?h[g]=void 0:h[g]=(v||"").replace(/%2F/g,"/"),h},{}),pathname:a,pathnameBase:o,pattern:t}}function E3(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),xx(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function T3(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return xx(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function yx(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const M3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,A3=t=>M3.test(t);function R3(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?il(t):t,a;if(n)if(A3(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),xx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=bb(n.substring(1),"/"):a=bb(n,e)}else a=e;return{pathname:a,search:O3(r),hash:D3(s)}}function bb(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function dm(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function I3(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function vx(t,e){let n=I3(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function bx(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=il(t):(s=wc({},t),nn(!s.pathname||!s.pathname.includes("?"),dm("?","pathname","search",s)),nn(!s.pathname||!s.pathname.includes("#"),dm("#","pathname","hash",s)),nn(!s.search||!s.search.includes("#"),dm("#","search","hash",s)));let a=t===""||s.pathname==="",o=a?"/":s.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;s.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=R3(s,c),h=o&&o!=="/"&&o.endsWith("/"),f=(a||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const Wi=t=>t.join("/").replace(/\/\/+/g,"/"),P3=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),O3=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,D3=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function L3(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const NN=["post","put","patch","delete"];new Set(NN);const _3=["get",...NN];new Set(_3);/** + * React Router v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Nc(){return Nc=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),b.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=bx(h,JSON.parse(o),a,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:Wi([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,a,t])}const B3=b.createContext(null);function V3(t){let e=b.useContext(ti).outlet;return e&&b.createElement(B3.Provider,{value:t},e)}function SN(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(na),{matches:s}=b.useContext(ti),{pathname:a}=ra(),o=JSON.stringify(vx(s,r.v7_relativeSplatPath));return b.useMemo(()=>bx(t,JSON.parse(o),a,n==="path"),[t,o,a,n])}function H3(t,e){return W3(t,e)}function W3(t,e,n,r){al()||nn(!1);let{navigator:s}=b.useContext(na),{matches:a}=b.useContext(ti),o=a[a.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=ra(),f;if(e){var m;let w=typeof e=="string"?il(e):e;u==="/"||(m=w.pathname)!=null&&m.startsWith(u)||nn(!1),f=w}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let w=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(w.length).join("/")}let v=p3(t,{pathname:y}),j=J3(v&&v.map(w=>Object.assign({},w,{params:Object.assign({},c,w.params),pathname:Wi([u,s.encodeLocation?s.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?u:Wi([u,s.encodeLocation?s.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),a,n,r);return e&&j?b.createElement(Hh.Provider,{value:{location:Nc({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:$i.Pop}},j):j}function U3(){let t=Z3(),e=L3(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),n?b.createElement("pre",{style:s},n):null,null)}const K3=b.createElement(U3,null);class q3 extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?b.createElement(ti.Provider,{value:this.props.routeContext},b.createElement(jN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function G3(t){let{routeContext:e,match:n,children:r}=t,s=b.useContext(wx);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(ti.Provider,{value:e},r)}function J3(t,e,n,r){var s;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var a;if(!n)return null;if(n.errors)t=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(s=n)==null?void 0:s.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||nn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,g)=>{let y,v=!1,j=null,w=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,j=m.route.errorElement||K3,u&&(h<0&&g===0?(tT("route-fallback"),v=!0,w=null):h===g&&(v=!0,w=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),E=()=>{let C;return y?C=j:v?C=w:m.route.Component?C=b.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,b.createElement(G3,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?b.createElement(q3,{location:n.location,revalidation:n.revalidation,component:j,error:y,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):E()},null)}var CN=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(CN||{}),EN=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(EN||{});function Y3(t){let e=b.useContext(wx);return e||nn(!1),e}function Q3(t){let e=b.useContext(z3);return e||nn(!1),e}function X3(t){let e=b.useContext(ti);return e||nn(!1),e}function TN(t){let e=X3(),n=e.matches[e.matches.length-1];return n.route.id||nn(!1),n.route.id}function Z3(){var t;let e=b.useContext(jN),n=Q3(),r=TN();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function eT(){let{router:t}=Y3(CN.UseNavigateStable),e=TN(EN.UseNavigateStable),n=b.useRef(!1);return kN(()=>{n.current=!0}),b.useCallback(function(s,a){a===void 0&&(a={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,Nc({fromRouteId:e},a)))},[t,e])}const wb={};function tT(t,e,n){wb[t]||(wb[t]=!0)}function nT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function um(t){let{to:e,replace:n,state:r,relative:s}=t;al()||nn(!1);let{future:a,static:o}=b.useContext(na),{matches:c}=b.useContext(ti),{pathname:u}=ra(),h=sa(),f=bx(e,vx(c,a.v7_relativeSplatPath),u,s==="path"),m=JSON.stringify(f);return b.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:s}),[h,m,s,n,r]),null}function rT(t){return V3(t.context)}function Mt(t){nn(!1)}function sT(t){let{basename:e="/",children:n=null,location:r,navigationType:s=$i.Pop,navigator:a,static:o=!1,future:c}=t;al()&&nn(!1);let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:a,static:o,future:Nc({v7_relativeSplatPath:!1},c)}),[u,c,a,o]);typeof r=="string"&&(r=il(r));let{pathname:f="/",search:m="",hash:g="",state:y=null,key:v="default"}=r,j=b.useMemo(()=>{let w=yx(f,u);return w==null?null:{location:{pathname:w,search:m,hash:g,state:y,key:v},navigationType:s}},[u,f,m,g,y,v,s]);return j==null?null:b.createElement(na.Provider,{value:h},b.createElement(Hh.Provider,{children:n,value:j}))}function iT(t){let{children:e,location:n}=t;return H3(lg(e),n)}new Promise(()=>{});function lg(t,e){e===void 0&&(e=[]);let n=[];return b.Children.forEach(t,(r,s)=>{if(!b.isValidElement(r))return;let a=[...e,s];if(r.type===b.Fragment){n.push.apply(n,lg(r.props.children,a));return}r.type!==Mt&&nn(!1),!r.props.index||!r.props.children||nn(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=lg(r.props.children,a)),n.push(o)}),n}/** + * React Router DOM v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function cg(){return cg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[s]=t[s]);return n}function oT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function lT(t,e){return t.button===0&&(!e||e==="_self")&&!oT(t)}function dg(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function cT(t,e){let n=dg(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(a=>{n.append(s,a)})}),n}const dT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],uT="6";try{window.__reactRouterVersion=uT}catch{}const hT="startTransition",Nb=Vh[hT];function fT(t){let{basename:e,children:n,future:r,window:s}=t,a=b.useRef();a.current==null&&(a.current=u3({window:s,v5Compat:!0}));let o=a.current,[c,u]=b.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=b.useCallback(m=>{h&&Nb?Nb(()=>u(m)):u(m)},[u,h]);return b.useLayoutEffect(()=>o.listen(f),[o,f]),b.useEffect(()=>nT(r),[r]),b.createElement(sT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const pT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",mT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ug=b.forwardRef(function(e,n){let{onClick:r,relative:s,reloadDocument:a,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=aT(e,dT),{basename:y}=b.useContext(na),v,j=!1;if(typeof h=="string"&&mT.test(h)&&(v=h,pT))try{let C=new URL(window.location.href),M=h.startsWith("//")?new URL(C.protocol+h):new URL(h),D=yx(M.pathname,y);M.origin===C.origin&&D!=null?h=D+M.search+M.hash:j=!0}catch{}let w=$3(h,{relative:s}),k=gT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:s,viewTransition:m});function E(C){r&&r(C),C.defaultPrevented||k(C)}return b.createElement("a",cg({},g,{href:v||w,onClick:j||a?r:E,ref:n,target:u}))});var jb;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(jb||(jb={}));var kb;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(kb||(kb={}));function gT(t,e){let{target:n,replace:r,state:s,preventScrollReset:a,relative:o,viewTransition:c}=e===void 0?{}:e,u=sa(),h=ra(),f=SN(t,{relative:o});return b.useCallback(m=>{if(lT(m,n)){m.preventDefault();let g=r!==void 0?r:Fu(h)===Fu(f);u(t,{replace:g,state:s,preventScrollReset:a,relative:o,viewTransition:c})}},[h,u,f,r,s,n,t,a,o,c])}function MN(t){let e=b.useRef(dg(t)),n=b.useRef(!1),r=ra(),s=b.useMemo(()=>cT(r.search,n.current?null:e.current),[r.search]),a=sa(),o=b.useCallback((c,u)=>{const h=dg(typeof c=="function"?c(s):c);n.current=!0,a("?"+h,u)},[a,s]);return[s,o]}/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),yT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Sb=t=>{const e=yT(t);return e.charAt(0).toUpperCase()+e.slice(1)},AN=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),vT=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var bT={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.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wT=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:o,...c},u)=>b.createElement("svg",{ref:u,...bT,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:AN("lucide",s),...!a&&!vT(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>b.createElement(h,f)),...Array.isArray(a)?a:[a]]));/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const je=(t,e)=>{const n=b.forwardRef(({className:r,...s},a)=>b.createElement(wT,{ref:a,iconNode:e,className:AN(`lucide-${xT(Sb(t))}`,`lucide-${t}`,r),...s}));return n.displayName=Sb(t),n};/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NT=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],jT=je("arrow-up-down",NT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kT=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],Cb=je("bitcoin",kT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ST=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],CT=je("bold",ST);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ET=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],zr=je("book-open",ET);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TT=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Bu=je("calendar",TT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MT=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],AT=je("chart-column",MT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Wh=je("check",RT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],jc=je("chevron-down",IT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PT=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],OT=je("chevron-left",PT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Fo=je("chevron-right",DT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LT=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],RN=je("chevron-up",LT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],zT=je("circle-alert",_T);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $T=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Eb=je("circle-check-big",$T);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],hg=je("circle-check",FT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],IN=je("circle-question-mark",BT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],hm=je("circle-user",VT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],PN=je("circle-x",HT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WT=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],fg=je("clock",WT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UT=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],KT=je("code",UT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qT=[["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"}]],ON=je("copy",qT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const GT=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Tb=je("credit-card",GT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JT=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],Aa=je("crown",JT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const YT=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Vu=je("dollar-sign",YT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QT=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],XT=je("download",QT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZT=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Xs=je("external-link",ZT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eM=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],pg=je("eye",eM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tM=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],nM=je("file-text",tM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rM=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],DN=je("funnel",rM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sM=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],iM=je("gift",sM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aM=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],oM=je("git-merge",aM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],mg=je("globe",lM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cM=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],dM=je("graduation-cap",cM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uM=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],_s=je("grip-vertical",uM);/** + * @license lucide-react v0.562.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=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],fM=je("handshake",hM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pM=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],mM=je("hash",pM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],xM=je("heading-1",gM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],vM=je("heading-2",yM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],wM=je("heading-3",bM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NM=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],jM=je("house",NM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kM=[["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"}]],LN=je("image",kM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],su=je("info",SM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CM=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],EM=je("italic",CM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TM=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],MM=je("key",TM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],RM=je("layout-dashboard",AM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IM=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Gs=je("link-2",IM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PM=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],gg=je("link",PM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OM=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],DM=je("list-ordered",OM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],_M=je("list",LM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],$M=je("lock",zM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],BM=je("log-out",FM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VM=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],_N=je("map-pin",VM);/** + * @license lucide-react v0.562.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=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],WM=je("menu",HM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UM=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],KM=je("message-circle",UM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qM=[["path",{d:"M5 12h14",key:"1ays0h"}]],GM=je("minus",qM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],Bo=je("navigation",JM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const YM=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],QM=je("palette",YM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XM=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],bt=je("pen-line",XM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZM=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],eA=je("percent",ZM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tA=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],nA=je("phone",tA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rA=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],sA=je("pin",rA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Lt=je("plus",iA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aA=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],Mb=je("qr-code",aA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oA=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],lA=je("quote",oA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cA=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],dA=je("redo",cA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uA=[["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"}]],qe=je("refresh-cw",uA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hA=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],rn=je("save",hA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ui=je("search",fA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pA=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],mA=je("send",pA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gA=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Da=je("settings",gA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xA=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],fm=je("settings-2",xA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yA=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Nx=je("shield-check",yA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vA=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],xg=je("shopping-bag",vA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],kc=je("smartphone",bA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wA=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Vo=je("star",wA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NA=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],jA=je("strikethrough",NA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kA=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],SA=je("table",kA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CA=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],pm=je("tag",CA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EA=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],vn=je("trash-2",EA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],cc=je("trending-up",TA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MA=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],Ab=je("trophy",MA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AA=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],zN=je("undo-2",AA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RA=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],IA=je("undo",RA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PA=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Hu=je("upload",PA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OA=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],yg=je("user-plus",OA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DA=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Wo=je("user",DA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LA=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Nn=je("users",LA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _A=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],Jo=je("wallet",_A);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],er=je("x",zA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $A=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Fi=je("zap",$A),jx="admin_token";function kx(){try{return localStorage.getItem(jx)}catch{return null}}function FA(t){try{localStorage.setItem(jx,t)}catch{}}function BA(){try{localStorage.removeItem(jx)}catch{}}const VA="https://soulapi.quwanzhi.com",HA=15e3,WA=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):VA};function Yo(t){const e=WA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function Uh(t,e={}){const{data:n,...r}=e,s=Yo(t),a=new Headers(r.headers),o=kx();o&&a.set("Authorization",`Bearer ${o}`),n!=null&&!a.has("Content-Type")&&a.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=new AbortController,h=setTimeout(()=>u.abort(),HA),f=await fetch(s,{...r,headers:a,body:c,credentials:"include",signal:u.signal}).finally(()=>clearTimeout(h)),g=(f.headers.get("Content-Type")||"").includes("application/json")?await f.json():f;if(!f.ok){const y=new Error((g==null?void 0:g.error)||`HTTP ${f.status}`);throw y.status=f.status,y.data=g,y}return g}function Be(t,e){return Uh(t,{...e,method:"GET"})}function ht(t,e,n){return Uh(t,{...n,method:"POST",data:e})}function Rt(t,e,n){return Uh(t,{...n,method:"PUT",data:e})}function Yr(t,e){return Uh(t,{...e,method:"DELETE"})}const UA=[{icon:RM,label:"数据概览",href:"/dashboard"},{icon:zr,label:"内容管理",href:"/content"},{icon:Nn,label:"用户管理",href:"/users"},{icon:oM,label:"找伙伴",href:"/find-partner"},{icon:Jo,label:"推广中心",href:"/distribution"}];function KA(){const t=ra(),e=sa(),[n,r]=b.useState(!1),[s,a]=b.useState(!1);b.useEffect(()=>{r(!0)},[]),b.useEffect(()=>{if(!n)return;a(!1);let c=!1;return Be("/api/admin").then(u=>{c||(u&&u.success!==!1?a(!0):e("/login",{replace:!0}))}).catch(()=>{c||e("/login",{replace:!0})}),()=>{c=!0}},[n,e]);const o=async()=>{BA();try{await ht("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!s?i.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[i.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):i.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[i.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[i.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[i.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),i.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),i.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[UA.map(c=>{const u=t.pathname===c.href;return i.jsxs(ug,{to:c.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${u?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[i.jsx(c.icon,{className:"w-5 h-5 shrink-0"}),i.jsx("span",{className:"text-sm",children:c.label})]},c.href)}),i.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:i.jsxs(ug,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${t.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[i.jsx(Da,{className:"w-5 h-5 shrink-0"}),i.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),i.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:i.jsxs("button",{type:"button",onClick:o,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white rounded-lg hover:bg-gray-700/50 transition-colors",children:[i.jsx(BM,{className:"w-5 h-5"}),i.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),i.jsx("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0",children:i.jsx("div",{className:"w-full min-w-[1024px] min-h-full",children:i.jsx(rT,{})})})]})}function Rb(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Sx(...t){return e=>{let n=!1;const r=t.map(s=>{const a=Rb(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s{let{children:a,...o}=r;$N(a)&&typeof Wu=="function"&&(a=Wu(a._payload));const c=b.Children.toArray(a),u=c.find(QA);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return i.jsx(e,{...o,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return i.jsx(e,{...o,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}var BN=FN("Slot");function JA(t){const e=b.forwardRef((n,r)=>{let{children:s,...a}=n;if($N(s)&&typeof Wu=="function"&&(s=Wu(s._payload)),b.isValidElement(s)){const o=ZA(s),c=XA(a,s.props);return s.type!==b.Fragment&&(c.ref=r?Sx(r,o):o),b.cloneElement(s,c)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var YA=Symbol("radix.slottable");function QA(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===YA}function XA(t,e){const n={...e};for(const r in e){const s=t[r],a=e[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...c)=>{const u=a(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function ZA(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function VN(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Pb=HN,WN=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Pb(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:a}=e,o=Object.keys(s).map(h=>{const f=n==null?void 0:n[h],m=a==null?void 0:a[h];if(f===null)return null;const g=Ib(f)||Ib(m);return s[h][g]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...y}=f;return Object.entries(y).every(v=>{let[j,w]=v;return Array.isArray(w)?w.includes({...a,...c}[j]):{...a,...c}[j]===w})?[...h,m,g]:h},[]);return Pb(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},eR=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),UN=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Uu="-",Ob=[],nR="arbitrary..",rR=t=>{const e=iR(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return sR(o);const c=o.split(Uu),u=c[0]===""&&c.length>1?1:0;return KN(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?eR(h,u):u:h||Ob}return n[o]||Ob}}},KN=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],a=n.nextPart.get(s);if(a){const h=KN(t,e+1,a);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(Uu):t.slice(e).join(Uu),u=o.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?nR+r:void 0})(),iR=t=>{const{theme:e,classGroups:n}=t;return aR(n,e)},aR=(t,e)=>{const n=UN();for(const r in t){const s=t[r];Cx(s,n,r,e)}return n},Cx=(t,e,n,r)=>{const s=t.length;for(let a=0;a{if(typeof t=="string"){lR(t,e,n);return}if(typeof t=="function"){cR(t,e,n,r);return}dR(t,e,n,r)},lR=(t,e,n)=>{const r=t===""?e:qN(e,t);r.classGroupId=n},cR=(t,e,n,r)=>{if(uR(t)){Cx(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(tR(n,t))},dR=(t,e,n,r)=>{const s=Object.entries(t),a=s.length;for(let o=0;o{let n=t;const r=e.split(Uu),s=r.length;for(let a=0;a"isThemeGetter"in t&&t.isThemeGetter===!0,hR=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(a,o)=>{n[a]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(a){let o=n[a];if(o!==void 0)return o;if((o=r[a])!==void 0)return s(a,o),o},set(a,o){a in n?n[a]=o:s(a,o)}}},vg="!",Db=":",fR=[],Lb=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),pR=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const a=[];let o=0,c=0,u=0,h;const f=s.length;for(let j=0;ju?h-u:void 0;return Lb(a,y,g,v)};if(e){const s=e+Db,a=r;r=o=>o.startsWith(s)?a(o.slice(s.length)):Lb(fR,!1,o,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},mR=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},gR=t=>({cache:hR(t.cacheSize),parseClassName:pR(t),sortModifiers:mR(t),...rR(t)}),xR=/\s+/,yR=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=e,o=[],c=t.trim().split(xR);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:j}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let w=!!j,k=r(w?v.substring(0,j):v);if(!k){if(!w){u=f+(u.length>0?" "+u:u);continue}if(k=r(v),!k){u=f+(u.length>0?" "+u:u);continue}w=!1}const E=g.length===0?"":g.length===1?g[0]:a(g).join(":"),C=y?E+vg:E,M=C+k;if(o.indexOf(M)>-1)continue;o.push(M);const D=s(k,w);for(let F=0;F0?" "+u:u)}return u},vR=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,a;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=gR(h),r=n.cache.get,s=n.cache.set,a=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=yR(u,n);return s(u,f),f};return a=o,(...u)=>a(vR(...u))},wR=[],un=t=>{const e=n=>n[t]||wR;return e.isThemeGetter=!0,e},JN=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,YN=/^\((?:(\w[\w-]*):)?(.+)\)$/i,NR=/^\d+\/\d+$/,jR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kR=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,SR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,CR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ER=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mo=t=>NR.test(t),at=t=>!!t&&!Number.isNaN(Number(t)),Ti=t=>!!t&&Number.isInteger(Number(t)),mm=t=>t.endsWith("%")&&at(t.slice(0,-1)),zs=t=>jR.test(t),TR=()=>!0,MR=t=>kR.test(t)&&!SR.test(t),QN=()=>!1,AR=t=>CR.test(t),RR=t=>ER.test(t),IR=t=>!De(t)&&!Le(t),PR=t=>ol(t,ej,QN),De=t=>JN.test(t),Ea=t=>ol(t,tj,MR),gm=t=>ol(t,zR,at),_b=t=>ol(t,XN,QN),OR=t=>ol(t,ZN,RR),iu=t=>ol(t,nj,AR),Le=t=>YN.test(t),Jl=t=>ll(t,tj),DR=t=>ll(t,$R),zb=t=>ll(t,XN),LR=t=>ll(t,ej),_R=t=>ll(t,ZN),au=t=>ll(t,nj,!0),ol=(t,e,n)=>{const r=JN.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},ll=(t,e,n=!1)=>{const r=YN.exec(t);return r?r[1]?e(r[1]):n:!1},XN=t=>t==="position"||t==="percentage",ZN=t=>t==="image"||t==="url",ej=t=>t==="length"||t==="size"||t==="bg-size",tj=t=>t==="length",zR=t=>t==="number",$R=t=>t==="family-name",nj=t=>t==="shadow",FR=()=>{const t=un("color"),e=un("font"),n=un("text"),r=un("font-weight"),s=un("tracking"),a=un("leading"),o=un("breakpoint"),c=un("container"),u=un("spacing"),h=un("radius"),f=un("shadow"),m=un("inset-shadow"),g=un("text-shadow"),y=un("drop-shadow"),v=un("blur"),j=un("perspective"),w=un("aspect"),k=un("ease"),E=un("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...M(),Le,De],F=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],I=()=>[Le,De,u],A=()=>[Mo,"full","auto",...I()],O=()=>[Ti,"none","subgrid",Le,De],W=()=>["auto",{span:["full",Ti,Le,De]},Ti,Le,De],X=()=>[Ti,"auto",Le,De],q=()=>["auto","min","max","fr",Le,De],Z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],_=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...I()],oe=()=>[Mo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],V=()=>[t,Le,De],ae=()=>[...M(),zb,_b,{position:[Le,De]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",LR,PR,{size:[Le,De]}],H=()=>[mm,Jl,Ea],ue=()=>["","none","full",h,Le,De],U=()=>["",at,Jl,Ea],he=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>[at,mm,zb,_b],de=()=>["","none",v,Le,De],Ce=()=>["none",at,Le,De],B=()=>["none",at,Le,De],me=()=>[at,Le,De],Se=()=>[Mo,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[zs],breakpoint:[zs],color:[TR],container:[zs],"drop-shadow":[zs],ease:["in","out","in-out"],font:[IR],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[zs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[zs],shadow:[zs],spacing:["px",at],text:[zs],"text-shadow":[zs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Mo,De,Le,w]}],container:["container"],columns:[{columns:[at,De,Le,c]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:D()}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Ti,"auto",Le,De]}],basis:[{basis:[Mo,"full","auto",c,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[at,Mo,"auto","initial","none",De]}],grow:[{grow:["",at,Le,De]}],shrink:[{shrink:["",at,Le,De]}],order:[{order:[Ti,"first","last","none",Le,De]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:W()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:W()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":q()}],"auto-rows":[{"auto-rows":q()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...Z(),"normal"]}],"justify-items":[{"justify-items":[..._(),"normal"]}],"justify-self":[{"justify-self":["auto",..._()]}],"align-content":[{content:["normal",...Z()]}],"align-items":[{items:[..._(),{baseline:["","last"]}]}],"align-self":[{self:["auto",..._(),{baseline:["","last"]}]}],"place-content":[{"place-content":Z()}],"place-items":[{"place-items":[..._(),"baseline"]}],"place-self":[{"place-self":["auto",..._()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:oe()}],w:[{w:[c,"screen",...oe()]}],"min-w":[{"min-w":[c,"screen","none",...oe()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...oe()]}],h:[{h:["screen","lh",...oe()]}],"min-h":[{"min-h":["screen","lh","none",...oe()]}],"max-h":[{"max-h":["screen","lh",...oe()]}],"font-size":[{text:["base",n,Jl,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Le,gm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",mm,De]}],"font-family":[{font:[DR,De,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Le,De]}],"line-clamp":[{"line-clamp":[at,"none",Le,gm]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",Le,De]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Le,De]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[at,"from-font","auto",Le,Ea]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[at,"auto",Le,De]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Le,De]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Le,De]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ae()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ti,Le,De],radial:["",Le,De],conic:[Ti,Le,De]},_R,OR]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[at,Le,De]}],"outline-w":[{outline:["",at,Jl,Ea]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",f,au,iu]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",m,au,iu]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[at,Ea]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",g,au,iu]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[at,Le,De]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[at]}],"mask-image-linear-from-pos":[{"mask-linear-from":ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":ee()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":ee()}],"mask-image-t-to-pos":[{"mask-t-to":ee()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":ee()}],"mask-image-r-to-pos":[{"mask-r-to":ee()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":ee()}],"mask-image-b-to-pos":[{"mask-b-to":ee()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":ee()}],"mask-image-l-to-pos":[{"mask-l-to":ee()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":ee()}],"mask-image-x-to-pos":[{"mask-x-to":ee()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":ee()}],"mask-image-y-to-pos":[{"mask-y-to":ee()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[Le,De]}],"mask-image-radial-from-pos":[{"mask-radial-from":ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":ee()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[at]}],"mask-image-conic-from-pos":[{"mask-conic-from":ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":ee()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ae()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Le,De]}],filter:[{filter:["","none",Le,De]}],blur:[{blur:de()}],brightness:[{brightness:[at,Le,De]}],contrast:[{contrast:[at,Le,De]}],"drop-shadow":[{"drop-shadow":["","none",y,au,iu]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",at,Le,De]}],"hue-rotate":[{"hue-rotate":[at,Le,De]}],invert:[{invert:["",at,Le,De]}],saturate:[{saturate:[at,Le,De]}],sepia:[{sepia:["",at,Le,De]}],"backdrop-filter":[{"backdrop-filter":["","none",Le,De]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[at,Le,De]}],"backdrop-contrast":[{"backdrop-contrast":[at,Le,De]}],"backdrop-grayscale":[{"backdrop-grayscale":["",at,Le,De]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[at,Le,De]}],"backdrop-invert":[{"backdrop-invert":["",at,Le,De]}],"backdrop-opacity":[{"backdrop-opacity":[at,Le,De]}],"backdrop-saturate":[{"backdrop-saturate":[at,Le,De]}],"backdrop-sepia":[{"backdrop-sepia":["",at,Le,De]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Le,De]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[at,"initial",Le,De]}],ease:[{ease:["linear","initial",k,Le,De]}],delay:[{delay:[at,Le,De]}],animate:[{animate:["none",E,Le,De]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Le,De]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:Ce()}],"rotate-x":[{"rotate-x":Ce()}],"rotate-y":[{"rotate-y":Ce()}],"rotate-z":[{"rotate-z":Ce()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[Le,De,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Le,De]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Le,De]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[at,Jl,Ea,gm]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},BR=bR(FR);function gt(...t){return BR(HN(t))}const VR=WN("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function re({className:t,variant:e,size:n,asChild:r=!1,...s}){const a=r?BN:"button";return i.jsx(a,{"data-slot":"button",className:gt(VR({variant:e,size:n,className:t})),...s})}function ce({className:t,type:e,...n}){return i.jsx("input",{type:e,"data-slot":"input",className:gt("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 md:text-sm focus-visible:ring-2 focus-visible:ring-ring",t),...n})}function HR(){const t=sa(),[e,n]=b.useState(""),[r,s]=b.useState(""),[a,o]=b.useState(""),[c,u]=b.useState(!1),h=async()=>{o(""),u(!0);try{const f=await ht("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){FA(f.token),t("/dashboard",{replace:!0});return}o(f.error||"用户名或密码错误")}catch(f){const m=f;o(m.status===401?"用户名或密码错误":(m==null?void 0:m.message)||"网络错误,请重试")}finally{u(!1)}};return i.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[i.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[i.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),i.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),i.jsxs("div",{className:"w-full max-w-md relative z-10",children:[i.jsxs("div",{className:"text-center mb-8",children:[i.jsx("div",{className:"w-16 h-16 bg-[#38bdac]/20 rounded-2xl flex items-center justify-center mx-auto mb-4 border border-[#38bdac]/30",children:i.jsx(Nx,{className:"w-8 h-8 text-[#38bdac]"})}),i.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),i.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),i.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[i.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),i.jsxs("div",{className:"relative",children:[i.jsx(Wo,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),i.jsx(ce,{type:"text",value:e,onChange:f=>n(f.target.value),placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),i.jsxs("div",{className:"relative",children:[i.jsx($M,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),i.jsx(ce,{type:"password",value:r,onChange:f=>s(f.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),a&&i.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:a}),i.jsx(re,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),i.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Ee=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:gt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Ee.displayName="Card";const et=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:gt("flex flex-col space-y-1.5 p-6",t),...e}));et.displayName="CardHeader";const tt=b.forwardRef(({className:t,...e},n)=>i.jsx("h3",{ref:n,className:gt("font-semibold leading-none tracking-tight",t),...e}));tt.displayName="CardTitle";const It=b.forwardRef(({className:t,...e},n)=>i.jsx("p",{ref:n,className:gt("text-sm text-muted-foreground",t),...e}));It.displayName="CardDescription";const Te=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:gt("p-6 pt-0",t),...e}));Te.displayName="CardContent";const WR=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:gt("flex items-center p-6 pt-0",t),...e}));WR.displayName="CardFooter";function nt(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t==null||t(s),n===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function UR(t,e){const n=b.createContext(e),r=a=>{const{children:o,...c}=a,u=b.useMemo(()=>c,Object.values(c));return i.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function s(a){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[r,s]}function ia(t,e=[]){let n=[];function r(a,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...v}=m,j=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,w=b.useMemo(()=>v,Object.values(v));return i.jsx(j.Provider,{value:w,children:y})};h.displayName=a+"Provider";function f(m,g){var j;const y=((j=g==null?void 0:g[t])==null?void 0:j[u])||c,v=b.useContext(y);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[h,f]}const s=()=>{const a=n.map(o=>b.createContext(o));return function(c){const u=(c==null?void 0:c[t])||a;return b.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return s.scopeName=t,[r,KR(s,...e)]}function KR(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(a)[`__scope${h}`];return{...c,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Vn=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},qR=Vh[" useId ".trim().toString()]||(()=>{}),GR=0;function Ki(t){const[e,n]=b.useState(qR());return Vn(()=>{n(r=>r??String(GR++))},[t]),e?`radix-${e}`:""}var JR=Vh[" useInsertionEffect ".trim().toString()]||Vn;function Ba({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[s,a,o]=YR({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:s;{const f=b.useRef(t!==void 0);b.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const h=b.useCallback(f=>{var m;if(c){const g=QR(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else a(f)},[c,t,a,o]);return[u,h]}function YR({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),s=b.useRef(n),a=b.useRef(e);return JR(()=>{a.current=e},[e]),b.useEffect(()=>{var o;s.current!==n&&((o=a.current)==null||o.call(a,n),s.current=n)},[n,s]),[n,r,a]}function QR(t){return typeof t=="function"}function Sc(t){const e=XR(t),n=b.forwardRef((r,s)=>{const{children:a,...o}=r,c=b.Children.toArray(a),u=c.find(e5);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return i.jsx(e,{...o,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return i.jsx(e,{...o,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}function XR(t){const e=b.forwardRef((n,r)=>{const{children:s,...a}=n;if(b.isValidElement(s)){const o=n5(s),c=t5(a,s.props);return s.type!==b.Fragment&&(c.ref=r?Sx(r,o):o),b.cloneElement(s,c)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var ZR=Symbol("radix.slottable");function e5(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===ZR}function t5(t,e){const n={...e};for(const r in e){const s=t[r],a=e[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...c)=>{const u=a(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function n5(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var r5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ot=r5.reduce((t,e)=>{const n=Sc(`Primitive.${e}`),r=b.forwardRef((s,a)=>{const{asChild:o,...c}=s,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function s5(t,e){t&&Fc.flushSync(()=>t.dispatchEvent(e))}function Qi(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function i5(t,e=globalThis==null?void 0:globalThis.document){const n=Qi(t);b.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var a5="DismissableLayer",bg="dismissableLayer.update",o5="dismissableLayer.pointerDownOutside",l5="dismissableLayer.focusOutside",$b,rj=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ex=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(rj),[f,m]=b.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),v=mt(e,R=>m(R)),j=Array.from(h.layers),[w]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(w),E=f?j.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,M=E>=k,D=u5(R=>{const I=R.target,A=[...h.branches].some(O=>O.contains(I));!M||A||(s==null||s(R),o==null||o(R),R.defaultPrevented||c==null||c())},g),F=h5(R=>{const I=R.target;[...h.branches].some(O=>O.contains(I))||(a==null||a(R),o==null||o(R),R.defaultPrevented||c==null||c())},g);return i5(R=>{E===h.layers.size-1&&(r==null||r(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))},g),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&($b=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),Fb(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=$b)}},[f,g,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),Fb())},[f,h]),b.useEffect(()=>{const R=()=>y({});return document.addEventListener(bg,R),()=>document.removeEventListener(bg,R)},[]),i.jsx(ot.div,{...u,ref:v,style:{pointerEvents:C?M?"auto":"none":void 0,...t.style},onFocusCapture:nt(t.onFocusCapture,F.onFocusCapture),onBlurCapture:nt(t.onBlurCapture,F.onBlurCapture),onPointerDownCapture:nt(t.onPointerDownCapture,D.onPointerDownCapture)})});Ex.displayName=a5;var c5="DismissableLayerBranch",d5=b.forwardRef((t,e)=>{const n=b.useContext(rj),r=b.useRef(null),s=mt(e,r);return b.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),i.jsx(ot.div,{...t,ref:s})});d5.displayName=c5;function u5(t,e=globalThis==null?void 0:globalThis.document){const n=Qi(t),r=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const a=c=>{if(c.target&&!r.current){let u=function(){sj(o5,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=u,e.addEventListener("click",s.current,{once:!0})):u()}else e.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function h5(t,e=globalThis==null?void 0:globalThis.document){const n=Qi(t),r=b.useRef(!1);return b.useEffect(()=>{const s=a=>{a.target&&!r.current&&sj(l5,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Fb(){const t=new CustomEvent(bg);document.dispatchEvent(t)}function sj(t,e,n,{discrete:r}){const s=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?s5(s,a):s.dispatchEvent(a)}var xm="focusScope.autoFocusOnMount",ym="focusScope.autoFocusOnUnmount",Bb={bubbles:!1,cancelable:!0},f5="FocusScope",Tx=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=t,[c,u]=b.useState(null),h=Qi(s),f=Qi(a),m=b.useRef(null),g=mt(e,j=>u(j)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let j=function(C){if(y.paused||!c)return;const M=C.target;c.contains(M)?m.current=M:Ri(m.current,{select:!0})},w=function(C){if(y.paused||!c)return;const M=C.relatedTarget;M!==null&&(c.contains(M)||Ri(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const D of C)D.removedNodes.length>0&&Ri(c)};document.addEventListener("focusin",j),document.addEventListener("focusout",w);const E=new MutationObserver(k);return c&&E.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",w),E.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){Hb.add(y);const j=document.activeElement;if(!c.contains(j)){const k=new CustomEvent(xm,Bb);c.addEventListener(xm,h),c.dispatchEvent(k),k.defaultPrevented||(p5(v5(ij(c)),{select:!0}),document.activeElement===j&&Ri(c))}return()=>{c.removeEventListener(xm,h),setTimeout(()=>{const k=new CustomEvent(ym,Bb);c.addEventListener(ym,f),c.dispatchEvent(k),k.defaultPrevented||Ri(j??document.body,{select:!0}),c.removeEventListener(ym,f),Hb.remove(y)},0)}}},[c,h,f,y]);const v=b.useCallback(j=>{if(!n&&!r||y.paused)return;const w=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(w&&k){const E=j.currentTarget,[C,M]=m5(E);C&&M?!j.shiftKey&&k===M?(j.preventDefault(),n&&Ri(C,{select:!0})):j.shiftKey&&k===C&&(j.preventDefault(),n&&Ri(M,{select:!0})):k===E&&j.preventDefault()}},[n,r,y.paused]);return i.jsx(ot.div,{tabIndex:-1,...o,ref:g,onKeyDown:v})});Tx.displayName=f5;function p5(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Ri(r,{select:e}),document.activeElement!==n)return}function m5(t){const e=ij(t),n=Vb(e,t),r=Vb(e.reverse(),t);return[n,r]}function ij(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Vb(t,e){for(const n of t)if(!g5(n,{upTo:e}))return n}function g5(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function x5(t){return t instanceof HTMLInputElement&&"select"in t}function Ri(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&x5(t)&&e&&t.select()}}var Hb=y5();function y5(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Wb(t,e),t.unshift(e)},remove(e){var n;t=Wb(t,e),(n=t[0])==null||n.resume()}}}function Wb(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function v5(t){return t.filter(e=>e.tagName!=="A")}var b5="Portal",Mx=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[s,a]=b.useState(!1);Vn(()=>a(!0),[]);const o=n||s&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?vN.createPortal(i.jsx(ot.div,{...r,ref:e}),o):null});Mx.displayName=b5;function w5(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var Bc=t=>{const{present:e,children:n}=t,r=N5(e),s=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),a=mt(r.ref,j5(s));return typeof n=="function"||r.isPresent?b.cloneElement(s,{ref:a}):null};Bc.displayName="Presence";function N5(t){const[e,n]=b.useState(),r=b.useRef(null),s=b.useRef(t),a=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=w5(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=ou(r.current);a.current=c==="mounted"?h:"none"},[c]),Vn(()=>{const h=r.current,f=s.current;if(f!==t){const g=a.current,y=ou(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,u]),Vn(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const j=ou(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&j&&(u("ANIMATION_END"),!s.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},g=y=>{y.target===e&&(a.current=ou(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:b.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function ou(t){return(t==null?void 0:t.animationName)||"none"}function j5(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var vm=0;function aj(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Ub()),document.body.insertAdjacentElement("beforeend",t[1]??Ub()),vm++,()=>{vm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),vm--}},[])}function Ub(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var vs=function(){return vs=Object.assign||function(e){for(var n,r=1,s=arguments.length;r"u")return F5;var e=B5(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},H5=dj(),Uo="data-scroll-locked",W5=function(t,e,n,r){var s=t.left,a=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` + .`.concat(S5,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(c,"px ").concat(r,`; + } + body[`).concat(Uo,`] { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(s,`px; + padding-top: `).concat(a,`px; + padding-right: `).concat(o,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(c,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(Au,` { + right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(Ru,` { + margin-right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(Au," .").concat(Au,` { + right: 0 `).concat(r,`; + } + + .`).concat(Ru," .").concat(Ru,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(Uo,`] { + `).concat(C5,": ").concat(c,`px; + } +`)},qb=function(){var t=parseInt(document.body.getAttribute(Uo)||"0",10);return isFinite(t)?t:0},U5=function(){b.useEffect(function(){return document.body.setAttribute(Uo,(qb()+1).toString()),function(){var t=qb()-1;t<=0?document.body.removeAttribute(Uo):document.body.setAttribute(Uo,t.toString())}},[])},K5=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;U5();var a=b.useMemo(function(){return V5(s)},[s]);return b.createElement(H5,{styles:W5(a,!e,s,n?"":"!important")})},wg=!1;if(typeof window<"u")try{var lu=Object.defineProperty({},"passive",{get:function(){return wg=!0,!0}});window.addEventListener("test",lu,lu),window.removeEventListener("test",lu,lu)}catch{wg=!1}var Ao=wg?{passive:!1}:!1,q5=function(t){return t.tagName==="TEXTAREA"},uj=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!q5(t)&&n[e]==="visible")},G5=function(t){return uj(t,"overflowY")},J5=function(t){return uj(t,"overflowX")},Gb=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=hj(t,r);if(s){var a=fj(t,r),o=a[1],c=a[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Y5=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Q5=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},hj=function(t,e){return t==="v"?G5(e):J5(e)},fj=function(t,e){return t==="v"?Y5(e):Q5(e)},X5=function(t,e){return t==="h"&&e==="rtl"?-1:1},Z5=function(t,e,n,r,s){var a=X5(t,window.getComputedStyle(e).direction),o=a*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var y=fj(t,c),v=y[0],j=y[1],w=y[2],k=j-w-a*v;(v||k)&&hj(t,c)&&(m+=k,g+=v);var E=c.parentNode;c=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(h=!0),h},cu=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Jb=function(t){return[t.deltaX,t.deltaY]},Yb=function(t){return t&&"current"in t?t.current:t},eI=function(t,e){return t[0]===e[0]&&t[1]===e[1]},tI=function(t){return` + .block-interactivity-`.concat(t,` {pointer-events: none;} + .allow-interactivity-`).concat(t,` {pointer-events: all;} +`)},nI=0,Ro=[];function rI(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),s=b.useState(nI++)[0],a=b.useState(dj)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var j=k5([t.lockRef.current],(t.shards||[]).map(Yb),!0).filter(Boolean);return j.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),j.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(j,w){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!o.current.allowPinchZoom;var k=cu(j),E=n.current,C="deltaX"in j?j.deltaX:E[0]-k[0],M="deltaY"in j?j.deltaY:E[1]-k[1],D,F=j.target,R=Math.abs(C)>Math.abs(M)?"h":"v";if("touches"in j&&R==="h"&&F.type==="range")return!1;var I=window.getSelection(),A=I&&I.anchorNode,O=A?A===F||A.contains(F):!1;if(O)return!1;var W=Gb(R,F);if(!W)return!0;if(W?D=R:(D=R==="v"?"h":"v",W=Gb(R,F)),!W)return!1;if(!r.current&&"changedTouches"in j&&(C||M)&&(r.current=D),!D)return!0;var X=r.current||D;return Z5(X,w,j,X==="h"?C:M)},[]),u=b.useCallback(function(j){var w=j;if(!(!Ro.length||Ro[Ro.length-1]!==a)){var k="deltaY"in w?Jb(w):cu(w),E=e.current.filter(function(D){return D.name===w.type&&(D.target===w.target||w.target===D.shadowParent)&&eI(D.delta,k)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var C=(o.current.shards||[]).map(Yb).filter(Boolean).filter(function(D){return D.contains(w.target)}),M=C.length>0?c(w,C[0]):!o.current.noIsolation;M&&w.cancelable&&w.preventDefault()}}},[]),h=b.useCallback(function(j,w,k,E){var C={name:j,delta:w,target:k,should:E,shadowParent:sI(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(M){return M!==C})},1)},[]),f=b.useCallback(function(j){n.current=cu(j),r.current=void 0},[]),m=b.useCallback(function(j){h(j.type,Jb(j),j.target,c(j,t.lockRef.current))},[]),g=b.useCallback(function(j){h(j.type,cu(j),j.target,c(j,t.lockRef.current))},[]);b.useEffect(function(){return Ro.push(a),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Ao),document.addEventListener("touchmove",u,Ao),document.addEventListener("touchstart",f,Ao),function(){Ro=Ro.filter(function(j){return j!==a}),document.removeEventListener("wheel",u,Ao),document.removeEventListener("touchmove",u,Ao),document.removeEventListener("touchstart",f,Ao)}},[]);var y=t.removeScrollBar,v=t.inert;return b.createElement(b.Fragment,null,v?b.createElement(a,{styles:tI(s)}):null,y?b.createElement(K5,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function sI(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const iI=P5(cj,rI);var Ax=b.forwardRef(function(t,e){return b.createElement(Kh,vs({},t,{ref:e,sideCar:iI}))});Ax.classNames=Kh.classNames;var aI=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Io=new WeakMap,du=new WeakMap,uu={},jm=0,pj=function(t){return t&&(t.host||pj(t.parentNode))},oI=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=pj(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},lI=function(t,e,n,r){var s=oI(e,Array.isArray(t)?t:[t]);uu[n]||(uu[n]=new WeakMap);var a=uu[n],o=[],c=new Set,u=new Set(s),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};s.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))f(g);else try{var y=g.getAttribute(r),v=y!==null&&y!=="false",j=(Io.get(g)||0)+1,w=(a.get(g)||0)+1;Io.set(g,j),a.set(g,w),o.push(g),j===1&&v&&du.set(g,!0),w===1&&g.setAttribute(n,"true"),v||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),jm++,function(){o.forEach(function(m){var g=Io.get(m)-1,y=a.get(m)-1;Io.set(m,g),a.set(m,y),g||(du.has(m)||m.removeAttribute(r),du.delete(m)),y||m.removeAttribute(n)}),jm--,jm||(Io=new WeakMap,Io=new WeakMap,du=new WeakMap,uu={})}},mj=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=aI(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),lI(r,s,n,"aria-hidden")):function(){return null}},qh="Dialog",[gj]=ia(qh),[cI,ns]=gj(qh),xj=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:o=!0}=t,c=b.useRef(null),u=b.useRef(null),[h,f]=Ba({prop:r,defaultProp:s??!1,onChange:a,caller:qh});return i.jsx(cI,{scope:e,triggerRef:c,contentRef:u,contentId:Ki(),titleId:Ki(),descriptionId:Ki(),open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};xj.displayName=qh;var yj="DialogTrigger",dI=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(yj,n),a=mt(e,s.triggerRef);return i.jsx(ot.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Px(s.open),...r,ref:a,onClick:nt(t.onClick,s.onOpenToggle)})});dI.displayName=yj;var Rx="DialogPortal",[uI,vj]=gj(Rx,{forceMount:void 0}),bj=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,a=ns(Rx,e);return i.jsx(uI,{scope:e,forceMount:n,children:b.Children.map(r,o=>i.jsx(Bc,{present:n||a.open,children:i.jsx(Mx,{asChild:!0,container:s,children:o})}))})};bj.displayName=Rx;var Ku="DialogOverlay",wj=b.forwardRef((t,e)=>{const n=vj(Ku,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,a=ns(Ku,t.__scopeDialog);return a.modal?i.jsx(Bc,{present:r||a.open,children:i.jsx(fI,{...s,ref:e})}):null});wj.displayName=Ku;var hI=Sc("DialogOverlay.RemoveScroll"),fI=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(Ku,n);return i.jsx(Ax,{as:hI,allowPinchZoom:!0,shards:[s.contentRef],children:i.jsx(ot.div,{"data-state":Px(s.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Va="DialogContent",Nj=b.forwardRef((t,e)=>{const n=vj(Va,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,a=ns(Va,t.__scopeDialog);return i.jsx(Bc,{present:r||a.open,children:a.modal?i.jsx(pI,{...s,ref:e}):i.jsx(mI,{...s,ref:e})})});Nj.displayName=Va;var pI=b.forwardRef((t,e)=>{const n=ns(Va,t.__scopeDialog),r=b.useRef(null),s=mt(e,n.contentRef,r);return b.useEffect(()=>{const a=r.current;if(a)return mj(a)},[]),i.jsx(jj,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nt(t.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:nt(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&a.preventDefault()}),onFocusOutside:nt(t.onFocusOutside,a=>a.preventDefault())})}),mI=b.forwardRef((t,e)=>{const n=ns(Va,t.__scopeDialog),r=b.useRef(!1),s=b.useRef(!1);return i.jsx(jj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,a),a.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=a.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),jj=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,...o}=t,c=ns(Va,n),u=b.useRef(null),h=mt(e,u);return aj(),i.jsxs(i.Fragment,{children:[i.jsx(Tx,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:i.jsx(Ex,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Px(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(gI,{titleId:c.titleId}),i.jsx(yI,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Ix="DialogTitle",kj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(Ix,n);return i.jsx(ot.h2,{id:s.titleId,...r,ref:e})});kj.displayName=Ix;var Sj="DialogDescription",Cj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(Sj,n);return i.jsx(ot.p,{id:s.descriptionId,...r,ref:e})});Cj.displayName=Sj;var Ej="DialogClose",Tj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(Ej,n);return i.jsx(ot.button,{type:"button",...r,ref:e,onClick:nt(t.onClick,()=>s.onOpenChange(!1))})});Tj.displayName=Ej;function Px(t){return t?"open":"closed"}var Mj="DialogTitleWarning",[SV,Aj]=UR(Mj,{contentName:Va,titleName:Ix,docsSlug:"dialog"}),gI=({titleId:t})=>{const e=Aj(Mj),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},xI="DialogDescriptionWarning",yI=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Aj(xI).contentName}}.`;return b.useEffect(()=>{var a;const s=(a=t.current)==null?void 0:a.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},vI=xj,bI=bj,wI=wj,NI=Nj,jI=kj,kI=Cj,SI=Tj;function Qt(t){return i.jsx(vI,{"data-slot":"dialog",...t})}function CI(t){return i.jsx(bI,{...t})}const Rj=b.forwardRef(({className:t,...e},n)=>i.jsx(wI,{ref:n,className:gt("fixed inset-0 z-50 bg-black/50",t),...e}));Rj.displayName="DialogOverlay";const Ut=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},s)=>i.jsxs(CI,{children:[i.jsx(Rj,{}),i.jsxs(NI,{ref:s,"aria-describedby":void 0,className:gt("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg sm:max-w-lg",t),...r,children:[e,n&&i.jsxs(SI,{className:"absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[i.jsx(er,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ut.displayName="DialogContent";function Xt({className:t,...e}){return i.jsx("div",{className:gt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function bn({className:t,...e}){return i.jsx("div",{className:gt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Zt(t){return i.jsx(jI,{className:"text-lg font-semibold leading-none",...t})}function EI(t){return i.jsx(kI,{className:"text-sm text-muted-foreground",...t})}const TI=WN("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Fe({className:t,variant:e,asChild:n=!1,...r}){const s=n?BN:"span";return i.jsx(s,{className:gt(TI({variant:e}),t),...r})}var MI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],AI=MI.reduce((t,e)=>{const n=FN(`Primitive.${e}`),r=b.forwardRef((s,a)=>{const{asChild:o,...c}=s,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),RI="Label",Ij=b.forwardRef((t,e)=>i.jsx(AI.label,{...t,ref:e,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Ij.displayName=RI;var Pj=Ij;const te=b.forwardRef(({className:t,...e},n)=>i.jsx(Pj,{ref:n,className:gt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));te.displayName=Pj.displayName;function Ox(t){const e=t+"CollectionProvider",[n,r]=ia(e),[s,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=j=>{const{scope:w,children:k}=j,E=Zn.useRef(null),C=Zn.useRef(new Map).current;return i.jsx(s,{scope:w,itemMap:C,collectionRef:E,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=Sc(c),h=Zn.forwardRef((j,w)=>{const{scope:k,children:E}=j,C=a(c,k),M=mt(w,C.collectionRef);return i.jsx(u,{ref:M,children:E})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=Sc(f),y=Zn.forwardRef((j,w)=>{const{scope:k,children:E,...C}=j,M=Zn.useRef(null),D=mt(w,M),F=a(f,k);return Zn.useEffect(()=>(F.itemMap.set(M,{ref:M,...C}),()=>void F.itemMap.delete(M))),i.jsx(g,{[m]:"",ref:D,children:E})});y.displayName=f;function v(j){const w=a(t+"CollectionConsumer",j);return Zn.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const C=Array.from(E.querySelectorAll(`[${m}]`));return Array.from(w.itemMap.values()).sort((F,R)=>C.indexOf(F.ref.current)-C.indexOf(R.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},v,r]}var II=b.createContext(void 0);function Gh(t){const e=b.useContext(II);return t||e||"ltr"}var km="rovingFocusGroup.onEntryFocus",PI={bubbles:!1,cancelable:!0},Vc="RovingFocusGroup",[Ng,Oj,OI]=Ox(Vc),[DI,Dj]=ia(Vc,[OI]),[LI,_I]=DI(Vc),Lj=b.forwardRef((t,e)=>i.jsx(Ng.Provider,{scope:t.__scopeRovingFocusGroup,children:i.jsx(Ng.Slot,{scope:t.__scopeRovingFocusGroup,children:i.jsx(zI,{...t,ref:e})})}));Lj.displayName=Vc;var zI=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),y=mt(e,g),v=Gh(a),[j,w]=Ba({prop:o,defaultProp:c??null,onChange:u,caller:Vc}),[k,E]=b.useState(!1),C=Qi(h),M=Oj(n),D=b.useRef(!1),[F,R]=b.useState(0);return b.useEffect(()=>{const I=g.current;if(I)return I.addEventListener(km,C),()=>I.removeEventListener(km,C)},[C]),i.jsx(LI,{scope:n,orientation:r,dir:v,loop:s,currentTabStopId:j,onItemFocus:b.useCallback(I=>w(I),[w]),onItemShiftTab:b.useCallback(()=>E(!0),[]),onFocusableItemAdd:b.useCallback(()=>R(I=>I+1),[]),onFocusableItemRemove:b.useCallback(()=>R(I=>I-1),[]),children:i.jsx(ot.div,{tabIndex:k||F===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:nt(t.onMouseDown,()=>{D.current=!0}),onFocus:nt(t.onFocus,I=>{const A=!D.current;if(I.target===I.currentTarget&&A&&!k){const O=new CustomEvent(km,PI);if(I.currentTarget.dispatchEvent(O),!O.defaultPrevented){const W=M().filter($=>$.focusable),X=W.find($=>$.active),q=W.find($=>$.id===j),_=[X,q,...W].filter(Boolean).map($=>$.ref.current);$j(_,f)}}D.current=!1}),onBlur:nt(t.onBlur,()=>E(!1))})})}),_j="RovingFocusGroupItem",zj=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:a,children:o,...c}=t,u=Ki(),h=a||u,f=_I(_j,n),m=f.currentTabStopId===h,g=Oj(n),{onFocusableItemAdd:y,onFocusableItemRemove:v,currentTabStopId:j}=f;return b.useEffect(()=>{if(r)return y(),()=>v()},[r,y,v]),i.jsx(Ng.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:i.jsx(ot.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:nt(t.onMouseDown,w=>{r?f.onItemFocus(h):w.preventDefault()}),onFocus:nt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:nt(t.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const k=BI(w,f.orientation,f.dir);if(k!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let C=g().filter(M=>M.focusable).map(M=>M.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const M=C.indexOf(w.currentTarget);C=f.loop?VI(C,M+1):C.slice(M+1)}setTimeout(()=>$j(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:j!=null}):o})})});zj.displayName=_j;var $I={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function FI(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function BI(t,e,n){const r=FI(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return $I[r]}function $j(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function VI(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var HI=Lj,WI=zj,Jh="Tabs",[UI]=ia(Jh,[Dj]),Fj=Dj(),[KI,Dx]=UI(Jh),Bj=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:a,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=Gh(c),[m,g]=Ba({prop:r,onChange:s,defaultProp:a??"",caller:Jh});return i.jsx(KI,{scope:n,baseId:Ki(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:i.jsx(ot.div,{dir:f,"data-orientation":o,...h,ref:e})})});Bj.displayName=Jh;var Vj="TabsList",Hj=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,a=Dx(Vj,n),o=Fj(n);return i.jsx(HI,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:i.jsx(ot.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:e})})});Hj.displayName=Vj;var Wj="TabsTrigger",Uj=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...a}=t,o=Dx(Wj,n),c=Fj(n),u=Gj(o.baseId,r),h=Jj(o.baseId,r),f=r===o.value;return i.jsx(WI,{asChild:!0,...c,focusable:!s,active:f,children:i.jsx(ot.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:u,...a,ref:e,onMouseDown:nt(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:nt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:nt(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!s&&m&&o.onValueChange(r)})})})});Uj.displayName=Wj;var Kj="TabsContent",qj=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:a,...o}=t,c=Dx(Kj,n),u=Gj(c.baseId,r),h=Jj(c.baseId,r),f=r===c.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),i.jsx(Bc,{present:s||f,children:({present:g})=>i.jsx(ot.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&a})})});qj.displayName=Kj;function Gj(t,e){return`${t}-trigger-${e}`}function Jj(t,e){return`${t}-content-${e}`}var qI=Bj,Yj=Hj,Qj=Uj,Xj=qj;const Hc=qI,cl=b.forwardRef(({className:t,...e},n)=>i.jsx(Yj,{ref:n,className:gt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));cl.displayName=Yj.displayName;const en=b.forwardRef(({className:t,...e},n)=>i.jsx(Qj,{ref:n,className:gt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));en.displayName=Qj.displayName;const tn=b.forwardRef(({className:t,...e},n)=>i.jsx(Xj,{ref:n,className:gt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));tn.displayName=Xj.displayName;function Lx(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function _x(t){const[e,n]=b.useState(void 0);return Vn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let o,c;if("borderBoxSize"in a){const u=a.borderBoxSize,h=Array.isArray(u)?u[0]:u;o=h.inlineSize,c=h.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var Yh="Switch",[GI]=ia(Yh),[JI,YI]=GI(Yh),Zj=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:a,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=b.useState(null),v=mt(e,C=>y(C)),j=b.useRef(!1),w=g?f||!!g.closest("form"):!0,[k,E]=Ba({prop:s,defaultProp:a??!1,onChange:h,caller:Yh});return i.jsxs(JI,{scope:n,checked:k,disabled:c,children:[i.jsx(ot.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":rk(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:v,onClick:nt(t.onClick,C=>{E(M=>!M),w&&(j.current=C.isPropagationStopped(),j.current||C.stopPropagation())})}),w&&i.jsx(nk,{control:g,bubbles:!j.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});Zj.displayName=Yh;var ek="SwitchThumb",tk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=YI(ek,n);return i.jsx(ot.span,{"data-state":rk(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});tk.displayName=ek;var QI="SwitchBubbleInput",nk=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},a)=>{const o=b.useRef(null),c=mt(o,a),u=Lx(n),h=_x(e);return b.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const v=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(v)}},[u,n,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});nk.displayName=QI;function rk(t){return t?"checked":"unchecked"}var sk=Zj,XI=tk;const yt=b.forwardRef(({className:t,...e},n)=>i.jsx(sk,{className:gt("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 focus-visible:ring-offset-[#0a1628] disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-gray-600 data-[state=checked]:bg-[#38bdac]",t),...e,ref:n,children:i.jsx(XI,{className:gt("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));yt.displayName=sk.displayName;function zx({open:t,onClose:e,userId:n,onUserUpdated:r}){var Gn;const[s,a]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,j]=b.useState(!1),[w,k]=b.useState("info"),[E,C]=b.useState(""),[M,D]=b.useState(""),[F,R]=b.useState([]),[I,A]=b.useState(""),[O,W]=b.useState(""),[X,q]=b.useState(""),[Z,_]=b.useState(!1),[$,oe]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[V,ae]=b.useState([]),[Y,L]=b.useState(!1),[H,ue]=b.useState(!1),[U,he]=b.useState(null),[Q,ee]=b.useState(null),[de,Ce]=b.useState(""),[B,me]=b.useState(""),[Se,rt]=b.useState(""),[Ye,st]=b.useState(!1),[Qe,Xe]=b.useState(null),[ft,Pt]=b.useState("");b.useEffect(()=>{t&&n&&(k("info"),he(null),ee(null),Xe(null),Pt(""),W(""),q(""),Jt(),Be("/api/db/vip-roles").then(fe=>{fe!=null&&fe.success&&fe.data&&ae(fe.data)}).catch(()=>{}))},[t,n]);async function Jt(){if(n){m(!0);try{const fe=await Be(`/api/db/users?id=${encodeURIComponent(n)}`);if(fe!=null&&fe.success&&fe.user){const ge=fe.user;a(ge),C(ge.phone||""),D(ge.nickname||""),Ce(ge.phone||""),me(ge.wechatId||""),rt(ge.openId||"");try{R(typeof ge.tags=="string"?JSON.parse(ge.tags||"[]"):[])}catch{R([])}oe({isVip:!!(ge.isVip??!1),vipExpireDate:ge.vipExpireDate?String(ge.vipExpireDate).slice(0,10):"",vipRole:String(ge.vipRole??""),vipName:String(ge.vipName??""),vipProject:String(ge.vipProject??""),vipContact:String(ge.vipContact??""),vipBio:String(ge.vipBio??"")})}try{const ge=await Be(`/api/user/track?userId=${encodeURIComponent(n)}&limit=50`);ge!=null&&ge.success&&ge.tracks&&c(ge.tracks)}catch{c([])}try{const ge=await Be(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ge!=null&&ge.success&&ge.referrals&&h(ge.referrals)}catch{h([])}}catch(fe){console.error("Load user detail error:",fe)}finally{m(!1)}}}async function Kn(){if(!(s!=null&&s.phone)){alert("用户未绑定手机号,无法同步");return}y(!0);try{const fe=await ht("/api/ckb/sync",{action:"full_sync",phone:s.phone,userId:s.id});fe!=null&&fe.success?(alert("同步成功"),Jt()):alert("同步失败: "+(fe==null?void 0:fe.error))}catch(fe){console.error("Sync CKB error:",fe),alert("同步失败")}finally{y(!1)}}async function qn(){if(s){j(!0);try{const fe={id:s.id,phone:E||void 0,nickname:M||void 0,tags:JSON.stringify(F)},ge=await Rt("/api/db/users",fe);ge!=null&&ge.success?(alert("保存成功"),Jt(),r==null||r()):alert("保存失败: "+(ge==null?void 0:ge.error))}catch(fe){console.error("Save user error:",fe),alert("保存失败")}finally{j(!1)}}}const ss=()=>{I&&!F.includes(I)&&(R([...F,I]),A(""))},zt=fe=>R(F.filter(ge=>ge!==fe));async function Cr(){if(s){if(!O){alert("请输入新密码");return}if(O!==X){alert("两次密码不一致");return}if(O.length<6){alert("密码至少 6 位");return}_(!0);try{const fe=await Rt("/api/db/users",{id:s.id,password:O});fe!=null&&fe.success?(alert("修改成功"),W(""),q("")):alert("修改失败: "+((fe==null?void 0:fe.error)||""))}catch{alert("修改失败")}finally{_(!1)}}}async function is(){if(s){if($.isVip&&!$.vipExpireDate.trim()){alert("开启 VIP 请填写有效到期日");return}L(!0);try{const fe={id:s.id,isVip:$.isVip,vipExpireDate:$.isVip?$.vipExpireDate:void 0,vipRole:$.vipRole||void 0,vipName:$.vipName||void 0,vipProject:$.vipProject||void 0,vipContact:$.vipContact||void 0,vipBio:$.vipBio||void 0},ge=await Rt("/api/db/users",fe);ge!=null&&ge.success?(alert("VIP 设置已保存"),Jt(),r==null||r()):alert("保存失败: "+((ge==null?void 0:ge.error)||""))}catch{alert("保存失败")}finally{L(!1)}}}async function On(){if(!de&&!Se&&!B){ee("请至少输入手机号、微信号或 OpenID 中的一项");return}ue(!0),ee(null),he(null);try{const fe=new URLSearchParams;de&&fe.set("phone",de),Se&&fe.set("openId",Se),B&&fe.set("wechatId",B);const ge=await Be(`/api/admin/shensheshou/query?${fe}`);ge!=null&&ge.success&&ge.data?(he(ge.data),s&&await pn(ge.data)):ee((ge==null?void 0:ge.error)||"未查询到数据,该用户可能未在神射手收录")}catch(fe){console.error("SSS query error:",fe),ee("请求失败,请检查神射手接口配置")}finally{ue(!1)}}async function pn(fe){if(s)try{await ht("/api/admin/shensheshou/enrich",{userId:s.id,phone:de||s.phone||"",openId:Se||s.openId||"",wechatId:B||s.wechatId||""}),Jt()}catch(ge){console.error("SSS enrich error:",ge)}}async function mr(){if(s){st(!0),Xe(null);try{const fe={users:[{phone:s.phone||"",name:s.nickname||"",openId:s.openId||"",tags:F}]},ge=await ht("/api/admin/shensheshou/ingest",fe);ge!=null&&ge.success&&ge.data?Xe(ge.data):Xe({error:(ge==null?void 0:ge.error)||"推送失败"})}catch(fe){console.error("SSS ingest error:",fe),Xe({error:"请求失败"})}finally{st(!1)}}}const Br=fe=>{const Sn={view_chapter:zr,purchase:xg,match:Nn,login:Wo,register:Wo,share:Gs,bind_phone:nA,bind_wechat:KM,fill_profile:pm,visit_page:Bo}[fe]||fg;return i.jsx(Sn,{className:"w-4 h-4"})};return t?i.jsx(Qt,{open:t,onOpenChange:()=>e(),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Wo,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(s==null?void 0:s.phone)&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(s==null?void 0:s.isVip)&&i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),f?i.jsxs("div",{className:"flex items-center justify-center py-20",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s?i.jsxs("div",{className:"flex flex-col h-[75vh]",children:[i.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-3",children:[i.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac] shrink-0",children:s.avatar?i.jsx("img",{src:s.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Gn=s.nickname)==null?void 0:Gn.charAt(0))||"?"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsx("h3",{className:"text-lg font-bold text-white",children:s.nickname}),s.isAdmin&&i.jsx(Fe,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),s.hasFullBook&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),s.vipRole&&i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 border-0",children:s.vipRole})]}),i.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[s.phone?`📱 ${s.phone}`:"未绑定手机",s.wechatId&&` · 💬 ${s.wechatId}`,s.mbti&&` · ${s.mbti}`]}),i.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[i.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",s.id.slice(0,16),"…"]}),s.referralCode&&i.jsxs("p",{className:"text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"推广码:"}),i.jsx("code",{className:"text-[#38bdac] bg-[#38bdac]/10 px-1.5 py-0.5 rounded",children:s.referralCode})]})]})]}),i.jsxs("div",{className:"text-right shrink-0",children:[i.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(s.earnings||0).toFixed(2)]}),i.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),i.jsxs(Hc,{value:w,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[i.jsxs(cl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[i.jsx(en,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),i.jsx(en,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),i.jsxs(en,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[i.jsx(Bo,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),i.jsx(en,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),i.jsxs(en,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[i.jsx(Fi,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),i.jsxs(tn,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"手机号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:E,onChange:fe=>C(fe.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"昵称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:M,onChange:fe=>D(fe.target.value)})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.openId&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"微信 OpenID"}),i.jsx("p",{className:"text-gray-300 font-mono text-xs break-all",children:s.openId})]}),s.region&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[i.jsx(_N,{className:"w-4 h-4 text-gray-500"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-500 text-xs",children:"地区"}),i.jsx("p",{className:"text-white",children:s.region})]})]}),s.industry&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"行业"}),i.jsx("p",{className:"text-white",children:s.industry})]}),s.position&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"职位"}),i.jsx("p",{className:"text-white",children:s.position})]})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),i.jsx("p",{className:"text-2xl font-bold text-white",children:s.referralCount??0})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),i.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(s.pendingEarnings??0).toFixed(2)]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),i.jsx("p",{className:"text-sm text-white",children:s.createdAt?new Date(s.createdAt).toLocaleDateString():"-"})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(MM,{className:"w-4 h-4 text-yellow-400"}),i.jsx("span",{className:"text-white font-medium",children:"修改密码"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:O,onChange:fe=>W(fe.target.value)}),i.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:X,onChange:fe=>q(fe.target.value)}),i.jsx(re,{size:"sm",onClick:Cr,disabled:Z||!O||!X,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:Z?"保存中...":"确认修改"})]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Aa,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-white font-medium",children:"设成超级个体"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(te,{className:"text-gray-400 text-sm",children:"VIP 会员"}),i.jsx(yt,{checked:$.isVip,onCheckedChange:fe=>oe(ge=>({...ge,isVip:fe}))})]}),$.isVip&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"到期日"}),i.jsx(ce,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:$.vipExpireDate,onChange:fe=>oe(ge=>({...ge,vipExpireDate:fe.target.value}))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"角色"}),i.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-2 py-1.5 text-sm",value:$.vipRole,onChange:fe=>oe(ge=>({...ge,vipRole:fe.target.value})),children:[i.jsx("option",{value:"",children:"请选择"}),V.map(fe=>i.jsx("option",{value:fe.name,children:fe.name},fe.id))]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"展示名"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:$.vipName,onChange:fe=>oe(ge=>({...ge,vipName:fe.target.value}))})]}),i.jsx(re,{size:"sm",onClick:is,disabled:Y,className:"bg-amber-500/20 hover:bg-amber-500/30 text-amber-400 border border-amber-500/40",children:Y?"保存中...":"保存 VIP"})]})]})]}),s.isVip&&i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Aa,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:s.vipRole||"VIP"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.vipName&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"展示名:"}),i.jsx("span",{className:"text-white",children:s.vipName})]}),s.vipProject&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"项目:"}),i.jsx("span",{className:"text-white",children:s.vipProject})]}),s.vipContact&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"联系方式:"}),i.jsx("span",{className:"text-white",children:s.vipContact})]}),s.vipExpireDate&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"到期时间:"}),i.jsx("span",{className:"text-white",children:new Date(s.vipExpireDate).toLocaleDateString()})]})]}),s.vipBio&&i.jsx("p",{className:"text-gray-400 text-sm mt-2",children:s.vipBio})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-purple-500/20",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(kc,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"微信归属"}),i.jsx("span",{className:"text-gray-500 text-xs",children:"该用户归属在哪个微信号下"})]}),i.jsxs("div",{className:"flex gap-2 items-center",children:[i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:ft,onChange:fe=>Pt(fe.target.value)}),i.jsxs(re,{size:"sm",onClick:async()=>{if(!(!ft||!s))try{await Rt("/api/db/users",{id:s.id,wechatId:ft}),alert("已保存微信归属"),Jt()}catch{alert("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[i.jsx(rn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),s.wechatId&&i.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",i.jsx("span",{className:"text-purple-400",children:s.wechatId})]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Gs,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),i.jsx(re,{size:"sm",onClick:Kn,disabled:g||!s.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"同步状态:"}),s.ckbSyncedAt?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"最后同步:"}),i.jsx("span",{className:"text-gray-300 ml-1",children:s.ckbSyncedAt?new Date(s.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),i.jsxs(tn,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(pm,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx("span",{className:"text-white font-medium",children:"用户标签"}),i.jsx("span",{className:"text-gray-500 text-xs",children:"基于《一场 Soul 的创业实验》维度打标"})]}),i.jsxs("div",{className:"mb-3 p-2.5 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-center gap-2 text-xs text-gray-400",children:[i.jsx(hg,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),"命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消"]}),i.jsx("div",{className:"mb-4 space-y-3",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(fe=>i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:fe.category}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:fe.tags.map(ge=>i.jsxs("button",{type:"button",onClick:()=>{F.includes(ge)?zt(ge):R([...F,ge])},className:`px-2 py-0.5 rounded text-xs border transition-all ${F.includes(ge)?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-transparent border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300"}`,children:[F.includes(ge)?"✓ ":"",ge]},ge))})]},fe.category))}),i.jsxs("div",{className:"border-t border-gray-700/50 pt-3",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"已选标签"}),i.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 min-h-[32px]",children:[F.map((fe,ge)=>i.jsxs(Fe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[fe,i.jsx("button",{type:"button",onClick:()=>zt(fe),className:"ml-1 hover:text-red-400",children:i.jsx(er,{className:"w-3 h-3"})})]},ge)),F.length===0&&i.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:I,onChange:fe=>A(fe.target.value),onKeyDown:fe=>fe.key==="Enter"&&ss()}),i.jsx(re,{onClick:ss,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),s.ckbTags&&i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(pm,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"存客宝标签"})]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:(typeof s.ckbTags=="string"?s.ckbTags.split(","):[]).map((fe,ge)=>i.jsx(Fe,{className:"bg-purple-500/20 text-purple-400 border-0",children:fe.trim()},ge))})]})]}),i.jsxs(tn,{value:"journey",className:"flex-1 overflow-auto",children:[i.jsxs("div",{className:"mb-3 p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[i.jsx(Bo,{className:"w-4 h-4 text-[#38bdac]"}),i.jsxs("span",{className:"text-gray-400 text-sm",children:["记录用户从注册到付费的完整行动路径,共 ",o.length," 条记录"]})]}),i.jsx("div",{className:"space-y-2",children:o.length>0?o.map((fe,ge)=>i.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex flex-col items-center",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:Br(fe.action)}),ge0?u.map((fe,ge)=>{var ri;const Sn=fe;return i.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((ri=Sn.nickname)==null?void 0:ri.charAt(0))||"?"}),i.jsx("span",{className:"text-white text-sm",children:Sn.nickname})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[Sn.status==="vip"&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),i.jsx("span",{className:"text-gray-500 text-xs",children:Sn.createdAt?new Date(Sn.createdAt).toLocaleDateString():""})]})]},Sn.id||ge)}):i.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),i.jsxs(tn,{value:"shensheshou",className:"flex-1 overflow-auto space-y-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Fi,{className:"w-5 h-5 text-[#38bdac]"}),i.jsx("span",{className:"text-white font-medium",children:"用户资料完善"}),i.jsx("span",{className:"text-gray-500 text-xs",children:"通过多维度查询神射手数据,自动回填用户基础信息"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[i.jsxs("div",{children:[i.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:de,onChange:fe=>Ce(fe.target.value)})]}),i.jsxs("div",{children:[i.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:B,onChange:fe=>me(fe.target.value)})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:Se,onChange:fe=>rt(fe.target.value)})]})]}),i.jsx(re,{onClick:On,disabled:H,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:H?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Ui,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),i.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),Q&&i.jsx("div",{className:"mt-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400 text-sm",children:Q}),U&&i.jsxs("div",{className:"mt-3 space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"神射手 RFM 分"}),i.jsx("p",{className:"text-2xl font-bold text-[#38bdac]",children:U.rfm_score??"-"})]}),i.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"用户等级"}),i.jsx("p",{className:"text-2xl font-bold text-white",children:U.user_level??"-"})]})]}),U.tags&&U.tags.length>0&&i.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"神射手标签"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:U.tags.map((fe,ge)=>i.jsx(Fe,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:fe},ge))})]}),U.last_active&&i.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",U.last_active]})]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(Fi,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"推送用户数据到神射手"})]}),i.jsx("p",{className:"text-gray-500 text-xs",children:"将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像"})]}),i.jsx(re,{onClick:mr,disabled:Ye||!s.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:Ye?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):i.jsxs(i.Fragment,{children:[i.jsx(Fi,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!s.phone&&i.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),Qe&&i.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:Qe.error?i.jsx("p",{className:"text-red-400",children:String(Qe.error)}):i.jsxs("div",{className:"space-y-1",children:[i.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[i.jsx(hg,{className:"w-4 h-4"})," 推送成功"]}),Qe.enriched!==void 0&&i.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(Qe.new_tags_added??0)]})]})})]})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3",children:[i.jsxs(re,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"关闭"]}),i.jsxs(re,{onClick:qn,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存修改"]})]})]}):i.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}function ZI(){const t=sa(),[e,n]=b.useState(!0),[r,s]=b.useState([]),[a,o]=b.useState([]),[c,u]=b.useState(0),[h,f]=b.useState(0),[m,g]=b.useState(0),[y,v]=b.useState(0),[j,w]=b.useState(null),[k,E]=b.useState(null),[C,M]=b.useState(!1);async function D(){var A;n(!0),w(null);try{try{const ae=await Be("/api/admin/dashboard/overview");if(ae!=null&&ae.success){u(ae.totalUsers??0),f(ae.paidOrderCount??0),g(ae.totalRevenue??0),v(ae.conversionRate??0),o(ae.recentOrders??[]),s(ae.newUsers??[]);return}}catch(ae){console.error("数据概览接口失败,尝试降级拉取",ae)}const[O,W]=await Promise.all([Be("/api/db/users?page=1&pageSize=10"),Be("/api/orders?page=1&pageSize=20&status=paid")]),X=typeof(O==null?void 0:O.total)=="number"?O.total:((A=O==null?void 0:O.users)==null?void 0:A.length)??0,q=(W==null?void 0:W.orders)??[],Z=typeof(W==null?void 0:W.total)=="number"?W.total:q.length,_=q.filter(ae=>ae.status==="paid"||ae.status==="completed"||ae.status==="success"),$=_.reduce((ae,Y)=>ae+Number(Y.amount||0),0),oe=new Set(_.map(ae=>ae.userId).filter(Boolean)),V=X>0&&oe.size>0?oe.size/X*100:0;u(X),f(Z),g($),v(V),o(q.slice(0,5)),s((O==null?void 0:O.users)??[])}catch(O){console.error("降级拉取失败",O);const W=O;(W==null?void 0:W.status)===401?w("登录已过期,请重新登录"):(W==null?void 0:W.name)==="AbortError"?w("请求超时,请检查网络后点击重试"):w("加载失败,请检查网络或联系管理员")}finally{n(!1)}}if(b.useEffect(()=>{D();const A=setInterval(D,3e4);return()=>clearInterval(A)},[]),e)return i.jsxs("div",{className:"p-8 w-full",children:[i.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),i.jsxs("div",{className:"flex flex-col items-center justify-center py-24",children:[i.jsx(qe,{className:"w-12 h-12 text-[#38bdac] animate-spin mb-4"}),i.jsx("span",{className:"text-gray-400",children:"加载中..."})]})]});const F=c,R=A=>{const O=A.productType||"",W=A.description||"";if(W){if(O==="section"&&W.includes("章节")){if(W.includes("-")){const X=W.split("-");if(X.length>=3)return{title:`第${X[1]}章 第${X[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:W,subtitle:"章节购买"}}return O==="fullbook"||W.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:O==="match"||W.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:W,subtitle:O==="section"?"单章":O==="fullbook"?"全书":"其他"}}return O==="section"?{title:`章节 ${A.productId||""}`,subtitle:"单章购买"}:O==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:O==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:O||"其他"}},I=[{title:"总用户数",value:F,icon:Nn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:`¥${(m??0).toFixed(2)}`,icon:cc,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:h,icon:xg,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:`${typeof y=="number"?y.toFixed(1):0}%`,icon:zr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"}];return i.jsxs("div",{className:"p-8 w-full",children:[i.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),j&&i.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[i.jsx("span",{children:j}),i.jsx("button",{type:"button",onClick:()=>D(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:I.map((A,O)=>i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>A.link&&t(A.link),children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsx(tt,{className:"text-sm font-medium text-gray-400",children:A.title}),i.jsx("div",{className:`p-2 rounded-lg ${A.bg}`,children:i.jsx(A.icon,{className:`w-4 h-4 ${A.color}`})})]}),i.jsx(Te,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-2xl font-bold text-white",children:A.value}),i.jsx(Fo,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},O))}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between",children:[i.jsx(tt,{className:"text-white",children:"最近订单"}),i.jsxs("button",{type:"button",onClick:()=>D(),className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1",title:"刷新",children:[i.jsx(qe,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),i.jsx(Te,{children:i.jsxs("div",{className:"space-y-3",children:[a.slice(0,5).map(A=>{var Z;const O=A.referrerId?r.find(_=>_.id===A.referrerId):void 0,W=A.referralCode||(O==null?void 0:O.referralCode)||(O==null?void 0:O.nickname)||(A.referrerId?String(A.referrerId).slice(0,8):""),X=R(A),q=A.userNickname||((Z=r.find(_=>_.id===A.userId))==null?void 0:Z.nickname)||"匿名用户";return i.jsxs("div",{className:"flex items-start justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30 hover:border-[#38bdac]/30 transition-colors",children:[i.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[A.userAvatar?i.jsx("img",{src:A.userAvatar,alt:q,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:_=>{_.currentTarget.style.display="none";const $=_.currentTarget.nextElementSibling;$&&$.classList.remove("hidden")}}):null,i.jsx("div",{className:`w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 mt-0.5 ${A.userAvatar?"hidden":""}`,children:q.charAt(0)}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("button",{type:"button",onClick:()=>{A.userId&&(E(A.userId),M(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:q}),i.jsx("span",{className:"text-gray-600",children:"·"}),i.jsx("span",{className:"text-sm font-medium text-white truncate",children:X.title})]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[X.subtitle&&X.subtitle!=="章节购买"&&i.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:X.subtitle}),i.jsx("span",{children:new Date(A.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),W&&i.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",W]})]})]}),i.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[i.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(A.amount).toFixed(2)]}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:A.paymentMethod||"微信"})]})]},A.id)}),a.length===0&&i.jsxs("div",{className:"text-center py-12",children:[i.jsx(xg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),i.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"新注册用户"})}),i.jsx(Te,{children:i.jsxs("div",{className:"space-y-3",children:[r.slice(0,5).map(A=>{var O;return i.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((O=A.nickname)==null?void 0:O.charAt(0))||"?"}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>{E(A.id),M(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:A.nickname||"匿名用户"}),i.jsx("p",{className:"text-xs text-gray-500",children:A.phone||"-"})]})]}),i.jsx("p",{className:"text-xs text-gray-400",children:A.createdAt?new Date(A.createdAt).toLocaleDateString():"-"})]},A.id)}),r.length===0&&i.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})]})]}),i.jsx(zx,{open:C,onClose:()=>{M(!1),E(null)},userId:k,onUserUpdated:D})]})}const hr=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{className:"relative w-full overflow-auto",children:i.jsx("table",{ref:n,className:gt("w-full caption-bottom text-sm",t),...e})}));hr.displayName="Table";const fr=b.forwardRef(({className:t,...e},n)=>i.jsx("thead",{ref:n,className:gt("[&_tr]:border-b",t),...e}));fr.displayName="TableHeader";const pr=b.forwardRef(({className:t,...e},n)=>i.jsx("tbody",{ref:n,className:gt("[&_tr:last-child]:border-0",t),...e}));pr.displayName="TableBody";const ct=b.forwardRef(({className:t,...e},n)=>i.jsx("tr",{ref:n,className:gt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));ct.displayName="TableRow";const ke=b.forwardRef(({className:t,...e},n)=>i.jsx("th",{ref:n,className:gt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));ke.displayName="TableHead";const ve=b.forwardRef(({className:t,...e},n)=>i.jsx("td",{ref:n,className:gt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));ve.displayName="TableCell";function $x(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const s=setTimeout(()=>r(t),e);return()=>clearTimeout(s)},[t,e]),n}function Zr({page:t,totalPages:e,total:n,pageSize:r,onPageChange:s,onPageSizeChange:a,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!a?null:i.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[i.jsxs("span",{children:["共 ",n," 条"]}),a&&i.jsx("select",{value:r,onChange:c=>a(Number(c.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:o.map(c=>i.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>s(1),disabled:t<=1,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"首页"}),i.jsx("button",{type:"button",onClick:()=>s(t-1),disabled:t<=1,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"上一页"}),i.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),i.jsx("button",{type:"button",onClick:()=>s(t+1),disabled:t>=e,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),i.jsx("button",{type:"button",onClick:()=>s(e),disabled:t>=e,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"末页"})]})]})}function eP(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[s,a]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,j]=b.useState(""),w=$x(v,300),[k,E]=b.useState("all"),[C,M]=b.useState(!0),[D,F]=b.useState(null),[R,I]=b.useState(null),[A,O]=b.useState(""),[W,X]=b.useState(!1);async function q(){M(!0),F(null);try{const Y=k==="all"?"":k==="completed"?"completed":k,L=new URLSearchParams({page:String(f),pageSize:String(g),...Y&&{status:Y},...w&&{search:w}}),[H,ue]=await Promise.all([Be(`/api/orders?${L}`),Be("/api/db/users?page=1&pageSize=500")]);H!=null&&H.success&&(e(H.orders||[]),a(H.total??0),c(H.totalRevenue??0),h(H.todayRevenue??0)),ue!=null&&ue.success&&ue.users&&r(ue.users)}catch(Y){console.error("加载订单失败",Y),F("加载订单失败,请检查网络后重试")}finally{M(!1)}}b.useEffect(()=>{m(1)},[w,k]),b.useEffect(()=>{q()},[f,g,w,k]);const Z=Y=>{var L;return Y.userNickname||((L=n.find(H=>H.id===Y.userId))==null?void 0:L.nickname)||"匿名用户"},_=Y=>{var L;return((L=n.find(H=>H.id===Y))==null?void 0:L.phone)||"-"},$=Y=>{const L=Y.productType||Y.type||"",H=Y.description||"";if(H){if(L==="section"&&H.includes("章节")){if(H.includes("-")){const ue=H.split("-");if(ue.length>=3)return{name:`第${ue[1]}章 第${ue[2]}节`,type:"《一场Soul的创业实验》"}}return{name:H,type:"章节购买"}}return L==="fullbook"||H.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:L==="vip"||H.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:L==="match"||H.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:H,type:"其他"}}return L==="section"?{name:`章节 ${Y.productId||Y.sectionId||""}`,type:"单章"}:L==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:L==="vip"?{name:"VIP年度会员",type:"VIP"}:L==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:L||"其他"}},oe=Math.ceil(s/g)||1;async function V(){var Y;if(!(!(R!=null&&R.orderSn)&&!(R!=null&&R.id))){X(!0),F(null);try{const L=await Rt("/api/admin/orders/refund",{orderSn:R.orderSn||R.id,reason:A||void 0});L!=null&&L.success?(I(null),O(""),q()):F((L==null?void 0:L.error)||"退款失败")}catch(L){const H=L;F(((Y=H==null?void 0:H.data)==null?void 0:Y.error)||"退款失败,请检查网络后重试")}finally{X(!1)}}}function ae(){if(t.length===0){alert("暂无数据可导出");return}const Y=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],L=t.map(Q=>{const ee=$(Q);return[Q.orderSn||Q.id||"",Z(Q),_(Q.userId),ee.name,Number(Q.amount||0).toFixed(2),Q.paymentMethod==="wechat"?"微信支付":Q.paymentMethod==="alipay"?"支付宝":Q.paymentMethod||"微信支付",Q.status==="refunded"?"已退款":Q.status==="paid"||Q.status==="completed"?"已完成":Q.status==="pending"||Q.status==="created"?"待支付":"已失败",Q.status==="refunded"&&Q.refundReason?Q.refundReason:"-",Q.referrerEarnings?Number(Q.referrerEarnings).toFixed(2):"-",Q.createdAt?new Date(Q.createdAt).toLocaleString("zh-CN"):""].join(",")}),H="\uFEFF"+[Y.join(","),...L].join(` +`),ue=new Blob([H],{type:"text/csv;charset=utf-8"}),U=URL.createObjectURL(ue),he=document.createElement("a");he.href=U,he.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,he.click(),URL.revokeObjectURL(U)}return i.jsxs("div",{className:"p-8 w-full",children:[D&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:D}),i.jsx("button",{type:"button",onClick:()=>F(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),i.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs(re,{variant:"outline",onClick:q,disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${C?"animate-spin":""}`}),"刷新"]}),i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("span",{className:"text-gray-400",children:"总收入:"}),i.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),i.jsx("span",{className:"text-gray-600",children:"|"}),i.jsx("span",{className:"text-gray-400",children:"今日:"}),i.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),i.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(Ui,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),i.jsx(ce,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:v,onChange:Y=>j(Y.target.value)})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(DN,{className:"w-4 h-4 text-gray-400"}),i.jsxs("select",{value:k,onChange:Y=>E(Y.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"pending",children:"待支付"}),i.jsx("option",{value:"created",children:"已创建"}),i.jsx("option",{value:"failed",children:"已失败"}),i.jsx("option",{value:"refunded",children:"已退款"})]})]}),i.jsxs(re,{variant:"outline",onClick:ae,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(XT,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:C?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs("div",{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"订单号"}),i.jsx(ke,{className:"text-gray-400",children:"用户"}),i.jsx(ke,{className:"text-gray-400",children:"商品"}),i.jsx(ke,{className:"text-gray-400",children:"金额"}),i.jsx(ke,{className:"text-gray-400",children:"支付方式"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-gray-400",children:"退款原因"}),i.jsx(ke,{className:"text-gray-400",children:"分销佣金"}),i.jsx(ke,{className:"text-gray-400",children:"下单时间"}),i.jsx(ke,{className:"text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[t.map(Y=>{const L=$(Y);return i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsxs(ve,{className:"font-mono text-xs text-gray-400",children:[(Y.orderSn||Y.id||"").slice(0,12),"..."]}),i.jsx(ve,{children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm",children:Z(Y)}),i.jsx("p",{className:"text-gray-500 text-xs",children:_(Y.userId)})]})}),i.jsx(ve,{children:i.jsxs("div",{children:[i.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[L.name,(Y.productType||Y.type)==="vip"&&i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),i.jsx("p",{className:"text-gray-500 text-xs",children:L.type})]})}),i.jsxs(ve,{className:"text-[#38bdac] font-bold",children:["¥",Number(Y.amount||0).toFixed(2)]}),i.jsx(ve,{className:"text-gray-300",children:Y.paymentMethod==="wechat"?"微信支付":Y.paymentMethod==="alipay"?"支付宝":Y.paymentMethod||"微信支付"}),i.jsx(ve,{children:Y.status==="refunded"?i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):Y.status==="paid"||Y.status==="completed"?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):Y.status==="pending"||Y.status==="created"?i.jsx(Fe,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):i.jsx(Fe,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),i.jsx(ve,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:Y.refundReason,children:Y.status==="refunded"&&Y.refundReason?Y.refundReason:"-"}),i.jsx(ve,{className:"text-[#FFD700]",children:Y.referrerEarnings?`¥${Number(Y.referrerEarnings).toFixed(2)}`:"-"}),i.jsx(ve,{className:"text-gray-400 text-sm",children:new Date(Y.createdAt).toLocaleString("zh-CN")}),i.jsx(ve,{children:(Y.status==="paid"||Y.status==="completed")&&i.jsxs(re,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{I(Y),O("")},children:[i.jsx(zN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},Y.id)}),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),i.jsx(Zr,{page:f,totalPages:oe,total:s,pageSize:g,onPageChange:m,onPageSizeChange:Y=>{y(Y),m(1)}})]})})}),i.jsx(Qt,{open:!!R,onOpenChange:Y=>!Y&&I(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:"订单退款"})}),R&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",R.orderSn||R.id]}),i.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(R.amount||0).toFixed(2)]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),i.jsx("div",{className:"form-input",children:i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:A,onChange:Y=>O(Y.target.value)})})]}),i.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>I(null),disabled:W,children:"取消"}),i.jsx(re,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:V,disabled:W,children:W?"退款中...":"确认退款"})]})]})})]})}const dl=b.forwardRef(({className:t,...e},n)=>i.jsx("textarea",{className:gt("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));dl.displayName="Textarea";const hu=[{id:"register",label:"注册/登录",icon:"👤",color:"bg-blue-500/20 border-blue-500/40 text-blue-400",desc:"微信授权登录或手机号注册"},{id:"browse",label:"浏览章节",icon:"📖",color:"bg-purple-500/20 border-purple-500/40 text-purple-400",desc:"点击免费/付费章节预览"},{id:"bind_phone",label:"绑定手机",icon:"📱",color:"bg-cyan-500/20 border-cyan-500/40 text-cyan-400",desc:"触发付费章节后绑定手机"},{id:"first_pay",label:"首次付款",icon:"💳",color:"bg-green-500/20 border-green-500/40 text-green-400",desc:"购买单章或全书"},{id:"fill_profile",label:"完善资料",icon:"✍️",color:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400",desc:"填写头像、MBTI、行业等"},{id:"match",label:"派对房匹配",icon:"🤝",color:"bg-orange-500/20 border-orange-500/40 text-orange-400",desc:"参与 Soul 派对房"},{id:"vip",label:"升级 VIP",icon:"👑",color:"bg-amber-500/20 border-amber-500/40 text-amber-400",desc:"付款 ¥1980 购买全书"},{id:"distribution",label:"开启分销",icon:"🔗",color:"bg-[#38bdac]/20 border-[#38bdac]/40 text-[#38bdac]",desc:"生成推广码并推荐好友"}];function tP(){var ls,oi,cs,fa,ds;const[t,e]=MN(),n=t.get("pool"),[r,s]=b.useState([]),[a,o]=b.useState(0),[c,u]=b.useState(1),[h,f]=b.useState(10),[m,g]=b.useState(""),y=$x(m,300),v=n==="vip"?"vip":n==="complete"?"complete":"all",[j,w]=b.useState(v),[k,E]=b.useState(!0),[C,M]=b.useState(null),[D,F]=b.useState(!1),[R,I]=b.useState("desc");b.useEffect(()=>{n==="vip"?w("vip"):n==="complete"?w("complete"):n==="all"&&w("all")},[n]);const[A,O]=b.useState(!1),[W,X]=b.useState(null),[q,Z]=b.useState(!1),[_,$]=b.useState(!1),[oe,V]=b.useState({referrals:[],stats:{}}),[ae,Y]=b.useState(!1),[L,H]=b.useState(null),[ue,U]=b.useState(!1),[he,Q]=b.useState(null),[ee,de]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Ce,B]=b.useState([]),[me,Se]=b.useState(!1),[rt,Ye]=b.useState(!1),[st,Qe]=b.useState(null),[Xe,ft]=b.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[Pt,Jt]=b.useState([]),[Kn,qn]=b.useState(!1),[ss,zt]=b.useState(!1),[Cr,is]=b.useState(null),[On,pn]=b.useState({name:"",sort:0}),[mr,Br]=b.useState({}),[Gn,fe]=b.useState(!1);async function ge(){var G;E(!0),M(null);try{if(D){const Ke=new URLSearchParams({search:y,limit:String(h*5)}),Ze=await Be(`/api/db/users/rfm?${Ke}`);if(Ze!=null&&Ze.success){let En=Ze.users||[];R==="asc"&&(En=[...En].reverse());const Vr=(c-1)*h;s(En.slice(Vr,Vr+h)),o(((G=Ze.users)==null?void 0:G.length)??0),En.length===0&&(F(!1),M("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else F(!1),M((Ze==null?void 0:Ze.error)||"RFM 加载失败,已切回普通模式")}else{const Ke=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...j==="vip"&&{vip:"true"},...j==="complete"&&{pool:"complete"}}),Ze=await Be(`/api/db/users?${Ke}`);Ze!=null&&Ze.success?(s(Ze.users||[]),o(Ze.total??0)):M((Ze==null?void 0:Ze.error)||"加载失败")}}catch(Ke){console.error("Load users error:",Ke),M("网络错误")}finally{E(!1)}}b.useEffect(()=>{u(1)},[y,j,D]),b.useEffect(()=>{ge()},[c,h,y,j,D,R]);const Sn=Math.ceil(a/h)||1,ri=()=>{D?R==="desc"?I("asc"):(F(!1),I("desc")):(F(!0),I("desc"))},Es=G=>({S:"bg-amber-500/20 text-amber-400",A:"bg-green-500/20 text-green-400",B:"bg-blue-500/20 text-blue-400",C:"bg-gray-500/20 text-gray-400",D:"bg-red-500/20 text-red-400"})[G||""]||"bg-gray-500/20 text-gray-400";async function ua(G){if(confirm("确定要删除这个用户吗?"))try{const Ke=await Yr(`/api/db/users?id=${encodeURIComponent(G)}`);Ke!=null&&Ke.success?ge():alert("删除失败: "+((Ke==null?void 0:Ke.error)||""))}catch{alert("删除失败")}}const Jn=G=>{X(G),de({phone:G.phone||"",nickname:G.nickname||"",password:"",isAdmin:!!(G.isAdmin??!1),hasFullBook:!!(G.hasFullBook??!1)}),O(!0)},as=()=>{X(null),de({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),O(!0)};async function jt(){if(!ee.phone||!ee.nickname){alert("请填写手机号和昵称");return}Z(!0);try{if(W){const G=await Rt("/api/db/users",{id:W.id,nickname:ee.nickname,isAdmin:ee.isAdmin,hasFullBook:ee.hasFullBook,...ee.password&&{password:ee.password}});if(!(G!=null&&G.success)){alert("更新失败: "+((G==null?void 0:G.error)||""));return}}else{const G=await ht("/api/db/users",{phone:ee.phone,nickname:ee.nickname,password:ee.password,isAdmin:ee.isAdmin});if(!(G!=null&&G.success)){alert("创建失败: "+((G==null?void 0:G.error)||""));return}}O(!1),ge()}catch{alert("保存失败")}finally{Z(!1)}}async function Cn(G){H(G),$(!0),Y(!0);try{const Ke=await Be(`/api/db/users/referrals?userId=${encodeURIComponent(G.id)}`);Ke!=null&&Ke.success?V({referrals:Ke.referrals||[],stats:Ke.stats||{}}):V({referrals:[],stats:{}})}catch{V({referrals:[],stats:{}})}finally{Y(!1)}}const Yn=b.useCallback(async()=>{Se(!0);try{const G=await Be("/api/db/user-rules");G!=null&&G.success&&B(G.rules||[])}catch{}finally{Se(!1)}},[]);async function Dn(){if(!Xe.title){alert("请填写规则标题");return}Z(!0);try{if(st){const G=await Rt("/api/db/user-rules",{id:st.id,...Xe});if(!(G!=null&&G.success)){alert("更新失败: "+((G==null?void 0:G.error)||""));return}}else{const G=await ht("/api/db/user-rules",Xe);if(!(G!=null&&G.success)){alert("创建失败: "+((G==null?void 0:G.error)||""));return}}Ye(!1),Yn()}catch{alert("保存失败")}finally{Z(!1)}}async function ha(G){if(confirm("确定删除?"))try{const Ke=await Yr(`/api/db/user-rules?id=${G}`);Ke!=null&&Ke.success&&Yn()}catch{}}async function si(G){try{await Rt("/api/db/user-rules",{id:G.id,enabled:!G.enabled}),Yn()}catch{}}const Er=b.useCallback(async()=>{qn(!0);try{const G=await Be("/api/db/vip-roles");G!=null&&G.success&&Jt(G.roles||[])}catch{}finally{qn(!1)}},[]);async function ii(){if(!On.name){alert("请填写角色名称");return}Z(!0);try{if(Cr){const G=await Rt("/api/db/vip-roles",{id:Cr.id,...On});if(!(G!=null&&G.success)){alert("更新失败");return}}else{const G=await ht("/api/db/vip-roles",On);if(!(G!=null&&G.success)){alert("创建失败");return}}zt(!1),Er()}catch{alert("保存失败")}finally{Z(!1)}}async function ai(G){if(confirm("确定删除?"))try{const Ke=await Yr(`/api/db/vip-roles?id=${G}`);Ke!=null&&Ke.success&&Er()}catch{}}const mn=b.useCallback(async()=>{fe(!0);try{const G=await Be("/api/db/users/journey-stats");G!=null&&G.success&&G.stats&&Br(G.stats)}catch{}finally{fe(!1)}},[]);return i.jsxs("div",{className:"p-8 w-full",children:[C&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:C}),i.jsx("button",{type:"button",onClick:()=>M(null),children:"×"})]}),i.jsx("div",{className:"flex justify-between items-center mb-6",children:i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),i.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",a," 位注册用户",D&&" · RFM 排序中"]})]})}),i.jsxs(Hc,{defaultValue:"users",className:"w-full",children:[i.jsxs(cl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[i.jsxs(en,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[i.jsx(Nn,{className:"w-4 h-4"})," 用户列表"]}),i.jsxs(en,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:mn,children:[i.jsx(Bo,{className:"w-4 h-4"})," 用户旅程总览"]}),i.jsxs(en,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Yn,children:[i.jsx(Da,{className:"w-4 h-4"})," 规则配置"]}),i.jsxs(en,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Er,children:[i.jsx(Aa,{className:"w-4 h-4"})," VIP 角色"]})]}),i.jsxs(tn,{value:"users",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[i.jsxs(re,{variant:"outline",onClick:ge,disabled:k,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${k?"animate-spin":""}`})," 刷新"]}),i.jsxs("select",{value:j,onChange:G=>{const Ke=G.target.value;w(Ke),u(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:D,children:[i.jsx("option",{value:"all",children:"全部用户"}),i.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),i.jsx("option",{value:"complete",children:"完善资料用户"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Ui,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),i.jsx(ce,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:G=>g(G.target.value)})]}),i.jsxs(re,{onClick:as,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(yg,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:k?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs("div",{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"用户信息"}),i.jsx(ke,{className:"text-gray-400",children:"绑定信息"}),i.jsx(ke,{className:"text-gray-400",children:"购买状态"}),i.jsx(ke,{className:"text-gray-400",children:"分销收益"}),i.jsxs(ke,{className:"text-gray-400 cursor-pointer select-none",onClick:ri,children:[i.jsxs("div",{className:"flex items-center gap-1 group",children:[i.jsx(cc,{className:"w-3.5 h-3.5"}),i.jsx("span",{children:"RFM分值"}),D?R==="desc"?i.jsx(jc,{className:"w-3.5 h-3.5 text-[#38bdac]"}):i.jsx(RN,{className:"w-3.5 h-3.5 text-[#38bdac]"}):i.jsx(jT,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),D&&i.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),i.jsx(ke,{className:"text-gray-400",children:"注册时间"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[r.map(G=>{var Ke,Ze,En;return i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:G.avatar?i.jsx("img",{src:G.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Ke=G.nickname)==null?void 0:Ke.charAt(0))||"?"}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("button",{type:"button",onClick:()=>{Q(G.id),U(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:G.nickname}),G.isAdmin&&i.jsx(Fe,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),G.openId&&!((Ze=G.id)!=null&&Ze.startsWith("user_"))&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),i.jsx("p",{className:"text-xs text-gray-500 font-mono",children:G.openId?G.openId.slice(0,12)+"...":(En=G.id)==null?void 0:En.slice(0,12)})]})]})}),i.jsx(ve,{children:i.jsxs("div",{className:"space-y-1",children:[G.phone&&i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"📱"}),i.jsx("span",{className:"text-gray-300",children:G.phone})]}),G.wechatId&&i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"💬"}),i.jsx("span",{className:"text-gray-300",children:G.wechatId})]}),G.openId&&i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"🔗"}),i.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:G.openId,children:[G.openId.slice(0,12),"..."]})]}),!G.phone&&!G.wechatId&&!G.openId&&i.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),i.jsx(ve,{children:G.hasFullBook?i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):i.jsx(Fe,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),i.jsx(ve,{children:i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(G.earnings||0)).toFixed(2)]}),parseFloat(String(G.pendingEarnings||0))>0&&i.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(G.pendingEarnings||0)).toFixed(2)]}),i.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>Cn(G),role:"button",tabIndex:0,onKeyDown:Vr=>Vr.key==="Enter"&&Cn(G),children:[i.jsx(Nn,{className:"w-3 h-3"})," 绑定",G.referralCount||0,"人"]})]})}),i.jsx(ve,{children:G.rfmScore!==void 0?i.jsx("div",{className:"flex flex-col gap-1",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-white font-bold text-base",children:G.rfmScore}),i.jsx(Fe,{className:`border-0 text-xs ${Es(G.rfmLevel)}`,children:G.rfmLevel})]})}):i.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",i.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),i.jsx(ve,{className:"text-gray-400",children:G.createdAt?new Date(G.createdAt).toLocaleDateString():"-"}),i.jsx(ve,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>{Q(G.id),U(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:i.jsx(pg,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Jn(G),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:i.jsx(bt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>ua(G.id),title:"删除",children:i.jsx(vn,{className:"w-4 h-4"})})]})})]},G.id)}),r.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),i.jsx(Zr,{page:c,totalPages:Sn,total:a,pageSize:h,onPageChange:u,onPageSizeChange:G=>{f(G),u(1)}})]})})})]}),i.jsxs(tn,{value:"journey",children:[i.jsxs("div",{className:"flex items-center justify-between mb-5",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),i.jsxs(re,{variant:"outline",onClick:mn,disabled:Gn,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${Gn?"animate-spin":""}`})," 刷新数据"]})]}),i.jsxs("div",{className:"relative mb-8",children:[i.jsx("div",{className:"absolute top-16 left-0 right-0 h-0.5 bg-gradient-to-r from-blue-500/20 via-[#38bdac]/30 to-amber-500/20 mx-20"}),i.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:hu.map((G,Ke)=>i.jsxs("div",{className:"relative flex flex-col items-center",children:[i.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${G.color} text-center cursor-default`,children:[i.jsx("div",{className:"text-2xl mb-1",children:G.icon}),i.jsx("div",{className:`text-xs font-medium ${G.color.split(" ").find(Ze=>Ze.startsWith("text-"))}`,children:G.label}),mr[G.id]!==void 0&&i.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[i.jsx("span",{className:"font-bold text-white",children:mr[G.id]})," 人"]}),i.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:Ke+1})]}),Kei.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[i.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:G.step}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-300",children:G.action}),i.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",G.next]})]})]},G.step))})]}),i.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(zr,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),i.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),Gn?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(qe,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(mr).length>0?i.jsx("div",{className:"space-y-2",children:hu.map(G=>{const Ke=mr[G.id]||0,Ze=Math.max(...hu.map(Vr=>mr[Vr.id]||0),1),En=Math.round(Ke/Ze*100);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[G.icon," ",G.label]}),i.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${En}%`}})}),i.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:Ke})]},G.id)})}):i.jsx("div",{className:"text-center py-8",children:i.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),i.jsxs(tn,{value:"rules",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程引导规则,定义各行为节点的触发条件与引导内容"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(re,{variant:"outline",onClick:Yn,disabled:me,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${me?"animate-spin":""}`})," 刷新"]}),i.jsxs(re,{onClick:()=>{Qe(null),ft({title:"",description:"",trigger:"",sort:0,enabled:!0}),Ye(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),me?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Ce.length===0?i.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[i.jsx(zr,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),i.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),i.jsxs(re,{onClick:Yn,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(qe,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):i.jsx("div",{className:"space-y-2",children:Ce.map(G=>i.jsx("div",{className:`p-4 rounded-lg border transition-all ${G.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[i.jsx(bt,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),i.jsx("span",{className:"text-white font-medium",children:G.title}),G.trigger&&i.jsxs(Fe,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",G.trigger]}),i.jsx(Fe,{className:`text-xs border-0 ${G.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:G.enabled?"启用":"禁用"})]}),G.description&&i.jsx("p",{className:"text-gray-400 text-sm ml-6",children:G.description})]}),i.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[i.jsx(yt,{checked:G.enabled,onCheckedChange:()=>si(G)}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>{Qe(G),ft({title:G.title,description:G.description,trigger:G.trigger,sort:G.sort,enabled:G.enabled}),Ye(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(bt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>ha(G.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(vn,{className:"w-4 h-4"})})]})]})},G.id))})]}),i.jsxs(tn,{value:"vip-roles",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"管理用户 VIP 角色分类,这些角色将在用户详情和会员展示中使用"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(re,{variant:"outline",onClick:Er,disabled:Kn,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${Kn?"animate-spin":""}`})," 刷新"]}),i.jsxs(re,{onClick:()=>{is(null),pn({name:"",sort:0}),zt(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"})," 添加角色"]})]})]}),Kn?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Pt.length===0?i.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[i.jsx(Aa,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),i.jsx("p",{className:"text-gray-400 mb-4",children:"暂无 VIP 角色"}),i.jsxs(re,{onClick:()=>{is(null),pn({name:"",sort:0}),zt(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"})," 添加第一个角色"]})]}):i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:Pt.map(G=>i.jsxs("div",{className:"p-4 bg-[#0f2137] border border-amber-500/20 rounded-xl hover:border-amber-500/40 transition-all group",children:[i.jsxs("div",{className:"flex items-start justify-between mb-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Aa,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-white font-medium",children:G.name})]}),i.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx("button",{type:"button",onClick:()=>{is(G),pn({name:G.name,sort:G.sort}),zt(!0)},className:"text-gray-500 hover:text-[#38bdac]",children:i.jsx(bt,{className:"w-3.5 h-3.5"})}),i.jsx("button",{type:"button",onClick:()=>ai(G.id),className:"text-gray-500 hover:text-red-400",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]}),i.jsxs("p",{className:"text-gray-600 text-xs",children:["排序: ",G.sort]})]},G.id))})]})]}),i.jsx(Qt,{open:A,onOpenChange:O,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[W?i.jsx(bt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(yg,{className:"w-5 h-5 text-[#38bdac]"}),W?"编辑用户":"添加用户"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"手机号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:ee.phone,onChange:G=>de({...ee,phone:G.target.value}),disabled:!!W})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"昵称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:ee.nickname,onChange:G=>de({...ee,nickname:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:W?"新密码 (留空则不修改)":"密码"}),i.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:W?"留空则不修改":"请输入密码",value:ee.password,onChange:G=>de({...ee,password:G.target.value})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(te,{className:"text-gray-300",children:"管理员权限"}),i.jsx(yt,{checked:ee.isAdmin,onCheckedChange:G=>de({...ee,isAdmin:G})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(te,{className:"text-gray-300",children:"已购全书"}),i.jsx(yt,{checked:ee.hasFullBook,onCheckedChange:G=>de({...ee,hasFullBook:G})})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>O(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:jt,disabled:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),q?"保存中...":"保存"]})]})]})}),i.jsx(Qt,{open:rt,onOpenChange:Ye,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(bt,{className:"w-5 h-5 text-[#38bdac]"}),st?"编辑规则":"添加规则"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"规则标题 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Xe.title,onChange:G=>ft({...Xe,title:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"规则描述"}),i.jsx(dl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:Xe.description,onChange:G=>ft({...Xe,description:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"触发条件"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:Xe.trigger,onChange:G=>ft({...Xe,trigger:G.target.value})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{children:i.jsx(te,{className:"text-gray-300",children:"启用状态"})}),i.jsx(yt,{checked:Xe.enabled,onCheckedChange:G=>ft({...Xe,enabled:G})})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>Ye(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:Dn,disabled:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),q?"保存中...":"保存"]})]})]})}),i.jsx(Qt,{open:ss,onOpenChange:zt,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Aa,{className:"w-5 h-5 text-amber-400"}),Cr?"编辑 VIP 角色":"添加 VIP 角色"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"角色名称 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:创业者、资源整合者、技术咖",value:On.name,onChange:G=>pn({...On,name:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"排序(越小越前)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:On.sort,onChange:G=>pn({...On,sort:parseInt(G.target.value)||0})})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>zt(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:ii,disabled:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),q?"保存中...":"保存"]})]})]})}),i.jsx(Qt,{open:_,onOpenChange:$,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Nn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",L==null?void 0:L.nickname]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((ls=oe.stats)==null?void 0:ls.total)||0}),i.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsx("div",{className:"text-2xl font-bold text-green-400",children:((oi=oe.stats)==null?void 0:oi.purchased)||0}),i.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((cs=oe.stats)==null?void 0:cs.earnings)||0).toFixed(2)]}),i.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((fa=oe.stats)==null?void 0:fa.pendingEarnings)||0).toFixed(2)]}),i.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),ae?i.jsxs("div",{className:"flex items-center justify-center py-8",children:[i.jsx(qe,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((ds=oe.referrals)==null?void 0:ds.length)??0)>0?i.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(oe.referrals??[]).map((G,Ke)=>{var En;const Ze=G;return i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((En=Ze.nickname)==null?void 0:En.charAt(0))||"?"}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white text-sm",children:Ze.nickname}),i.jsx("div",{className:"text-xs text-gray-500",children:Ze.phone||(Ze.hasOpenId?"微信用户":"未绑定")})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[Ze.status==="vip"&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Ze.status==="paid"&&i.jsxs(Fe,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Ze.purchasedSections,"章"]}),Ze.status==="free"&&i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),i.jsx("span",{className:"text-xs text-gray-500",children:Ze.createdAt?new Date(Ze.createdAt).toLocaleDateString():""})]})]},Ze.id||Ke)})}):i.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),i.jsx(bn,{children:i.jsx(re,{variant:"outline",onClick:()=>$(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),i.jsx(zx,{open:ue,onClose:()=>U(!1),userId:he,onUserUpdated:ge})]})}function qu(t,[e,n]){return Math.min(n,Math.max(e,t))}var ik=["PageUp","PageDown"],ak=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ok={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},ul="Slider",[jg,nP,rP]=Ox(ul),[lk]=ia(ul,[rP]),[sP,Qh]=lk(ul),ck=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:a=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,form:v,...j}=t,w=b.useRef(new Set),k=b.useRef(0),C=o==="horizontal"?iP:aP,[M=[],D]=Ba({prop:f,defaultProp:h,onChange:W=>{var q;(q=[...w.current][k.current])==null||q.focus(),m(W)}}),F=b.useRef(M);function R(W){const X=uP(M,W);O(W,X)}function I(W){O(W,k.current)}function A(){const W=F.current[k.current];M[k.current]!==W&&g(M)}function O(W,X,{commit:q}={commit:!1}){const Z=mP(a),_=gP(Math.round((W-r)/a)*a+r,Z),$=qu(_,[r,s]);D((oe=[])=>{const V=cP(oe,$,X);if(pP(V,u*a)){k.current=V.indexOf($);const ae=String(V)!==String(oe);return ae&&q&&g(V),ae?V:oe}else return oe})}return i.jsx(sP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:k,thumbs:w.current,values:M,orientation:o,form:v,children:i.jsx(jg.Provider,{scope:t.__scopeSlider,children:i.jsx(jg.Slot,{scope:t.__scopeSlider,children:i.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...j,ref:e,onPointerDown:nt(j.onPointerDown,()=>{c||(F.current=M)}),min:r,max:s,inverted:y,onSlideStart:c?void 0:R,onSlideMove:c?void 0:I,onSlideEnd:c?void 0:A,onHomeKeyDown:()=>!c&&O(r,0,{commit:!0}),onEndKeyDown:()=>!c&&O(s,M.length-1,{commit:!0}),onStepKeyDown:({event:W,direction:X})=>{if(!c){const _=ik.includes(W.key)||W.shiftKey&&ak.includes(W.key)?10:1,$=k.current,oe=M[$],V=a*_*X;O(oe+V,$,{commit:!0})}}})})})})});ck.displayName=ul;var[dk,uk]=lk(ul,{startEdge:"left",endEdge:"right",size:"width",direction:1}),iP=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:a,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),y=mt(e,C=>g(C)),v=b.useRef(void 0),j=Gh(s),w=j==="ltr",k=w&&!a||!w&&a;function E(C){const M=v.current||m.getBoundingClientRect(),D=[0,M.width],R=Fx(D,k?[n,r]:[r,n]);return v.current=M,R(C-M.left)}return i.jsx(dk,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:i.jsx(hk,{dir:j,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const M=E(C.clientX);o==null||o(M)},onSlideMove:C=>{const M=E(C.clientX);c==null||c(M)},onSlideEnd:()=>{v.current=void 0,u==null||u()},onStepKeyDown:C=>{const D=ok[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:D?-1:1})}})})}),aP=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:a,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=mt(e,f),g=b.useRef(void 0),y=!s;function v(j){const w=g.current||f.current.getBoundingClientRect(),k=[0,w.height],C=Fx(k,y?[r,n]:[n,r]);return g.current=w,C(j-w.top)}return i.jsx(dk,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:i.jsx(hk,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:j=>{const w=v(j.clientY);a==null||a(w)},onSlideMove:j=>{const w=v(j.clientY);o==null||o(w)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:j=>{const k=ok[y?"from-bottom":"from-top"].includes(j.key);u==null||u({event:j,direction:k?-1:1})}})})}),hk=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=Qh(ul,n);return i.jsx(ot.span,{...h,ref:e,onKeyDown:nt(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):ik.concat(ak).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:nt(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:nt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:nt(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),a(m))})})}),fk="SliderTrack",pk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=Qh(fk,n);return i.jsx(ot.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});pk.displayName=fk;var kg="SliderRange",mk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=Qh(kg,n),a=uk(kg,n),o=b.useRef(null),c=mt(e,o),u=s.values.length,h=s.values.map(g=>yk(g,s.min,s.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return i.jsx(ot.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...t.style,[a.startEdge]:f+"%",[a.endEdge]:m+"%"}})});mk.displayName=kg;var Sg="SliderThumb",gk=b.forwardRef((t,e)=>{const n=nP(t.__scopeSlider),[r,s]=b.useState(null),a=mt(e,c=>s(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return i.jsx(oP,{...t,ref:a,index:o})}),oP=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...a}=t,o=Qh(Sg,n),c=uk(Sg,n),[u,h]=b.useState(null),f=mt(e,E=>h(E)),m=u?o.form||!!u.closest("form"):!0,g=_x(u),y=o.values[r],v=y===void 0?0:yk(y,o.min,o.max),j=dP(r,o.values.length),w=g==null?void 0:g[c.size],k=w?hP(w,v,c.direction):0;return b.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),i.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${v}% + ${k}px)`},children:[i.jsx(jg.ItemSlot,{scope:t.__scopeSlider,children:i.jsx(ot.span,{role:"slider","aria-label":t["aria-label"]||j,"aria-valuemin":o.min,"aria-valuenow":y,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...a,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:nt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&i.jsx(xk,{name:s??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});gk.displayName=Sg;var lP="RadioBubbleInput",xk=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),a=mt(s,r),o=Lx(e);return b.useEffect(()=>{const c=s.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),i.jsx(ot.input,{style:{display:"none"},...n,ref:a,defaultValue:e})});xk.displayName=lP;function cP(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,a)=>s-a)}function yk(t,e,n){const a=100/(n-e)*(t-e);return qu(a,[0,100])}function dP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function uP(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function hP(t,e,n){const r=t/2,a=Fx([0,50],[0,r]);return(r-a(e)*n)*n}function fP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function pP(t,e){if(e>0){const n=fP(t);return Math.min(...n)>=e}return!0}function Fx(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function mP(t){return(String(t).split(".")[1]||"").length}function gP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var xP=ck,yP=pk,vP=mk,bP=gk;function wP({className:t,defaultValue:e,value:n,min:r=0,max:s=100,...a}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,s],[n,e,r,s]);return i.jsxs(xP,{defaultValue:e,value:n,min:r,max:s,className:gt("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...a,children:[i.jsx(yP,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:i.jsx(vP,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>i.jsx(bP,{className:"block size-4 shrink-0 rounded-full border-2 border-[#38bdac] bg-white shadow-sm focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},u))]})}const NP={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function vk({embedded:t=!1}){const[e,n]=b.useState(NP),[r,s]=b.useState(!0),[a,o]=b.useState(!1);b.useEffect(()=>{Be("/api/admin/referral-settings").then(h=>{const f=h==null?void 0:h.data;f&&typeof f=="object"&&n({distributorShare:f.distributorShare??90,minWithdrawAmount:f.minWithdrawAmount??10,bindingDays:f.bindingDays??30,userDiscount:f.userDiscount??5,enableAutoWithdraw:f.enableAutoWithdraw??!1,vipOrderShareVip:f.vipOrderShareVip??20,vipOrderShareNonVip:f.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>s(!1))},[]);const c=async()=>{o(!0);try{const h={distributorShare:Number(e.distributorShare)||0,minWithdrawAmount:Number(e.minWithdrawAmount)||0,bindingDays:Number(e.bindingDays)||0,userDiscount:Number(e.userDiscount)||0,enableAutoWithdraw:!!e.enableAutoWithdraw,vipOrderShareVip:Number(e.vipOrderShareVip)||20,vipOrderShareNonVip:Number(e.vipOrderShareNonVip)||10},f=await ht("/api/admin/referral-settings",h);if(!f||f.success===!1){alert("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}alert(`✅ 分销配置已保存成功! + +• 小程序与网站的推广规则会一起生效 +• 绑定关系会使用新的天数配置 +• 佣金比例会立即应用到新订单 + +如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),alert("保存失败: "+(h instanceof Error?h.message:String(h)))}finally{o(!1)}},u=h=>f=>{const m=parseFloat(f.target.value||"0");n(g=>({...g,[h]:isNaN(m)?0:m}))};return r?i.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Jo,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),i.jsxs(re,{onClick:c,disabled:a||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"flex items-center gap-2 text-white",children:[i.jsx(eA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),i.jsx(It,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),i.jsx(Te,{className:"space-y-6",children:i.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(su,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.userDiscount,onChange:u("userDiscount")}),i.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(Nn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(wP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),i.jsx(ce,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:e.distributorShare,onChange:u("distributorShare")})]}),i.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",i.jsxs("span",{className:"text-[#38bdac] font-mono",children:[e.distributorShare,"%"]}),";会员订单见下方。"]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(su,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareVip,onChange:u("vipOrderShareVip")}),i.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(su,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareNonVip,onChange:u("vipOrderShareNonVip")}),i.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(Nn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),i.jsx(ce,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:e.bindingDays,onChange:u("bindingDays")}),i.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"flex items-center gap-2 text-white",children:[i.jsx(Jo,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),i.jsx(It,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),i.jsx(Te,{className:"space-y-6",children:i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最低提现金额(元)"}),i.jsx(ce,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:e.minWithdrawAmount,onChange:u("minWithdrawAmount")}),i.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",i.jsx(Fe,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),i.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[i.jsx(yt,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),i.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(et,{children:i.jsxs(tt,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[i.jsx(su,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),i.jsxs(Te,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[i.jsxs("p",{children:["1. 以上配置会写入"," ",i.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),i.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),i.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function jP(){var Ce;const[t,e]=b.useState("overview"),[n,r]=b.useState([]),[s,a]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState([]),[g,y]=b.useState(!0),[v,j]=b.useState(null),[w,k]=b.useState(""),[E,C]=b.useState("all"),[M,D]=b.useState(1),[F,R]=b.useState(10),[I,A]=b.useState(0),[O,W]=b.useState(new Set),[X,q]=b.useState(null),[Z,_]=b.useState(""),[$,oe]=b.useState(!1);b.useEffect(()=>{V()},[]),b.useEffect(()=>{D(1)},[t,E]),b.useEffect(()=>{ae(t)},[t]),b.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&ae(t,!0)},[M,F,E,w]);async function V(){j(null);try{const B=await Be("/api/admin/distribution/overview");B!=null&&B.success&&B.overview&&a(B.overview)}catch(B){console.error("[Admin] 概览接口异常:",B),j("加载概览失败")}try{const B=await Be("/api/db/users");m((B==null?void 0:B.users)||[])}catch(B){console.error("[Admin] 用户数据加载失败:",B)}}async function ae(B,me=!1){var Se;if(!(!me&&O.has(B))){y(!0);try{const rt=f;switch(B){case"overview":break;case"orders":{try{const Ye=new URLSearchParams({page:String(M),pageSize:String(F),...E!=="all"&&{status:E},...w&&{search:w}}),st=await Be(`/api/orders?${Ye}`);if(st!=null&&st.success&&st.orders){const Qe=st.orders.map(Xe=>{const ft=rt.find(Jt=>Jt.id===Xe.userId),Pt=Xe.referrerId?rt.find(Jt=>Jt.id===Xe.referrerId):null;return{...Xe,amount:parseFloat(String(Xe.amount))||0,userNickname:(ft==null?void 0:ft.nickname)||Xe.userNickname||"未知用户",userPhone:(ft==null?void 0:ft.phone)||Xe.userPhone||"-",referrerNickname:(Pt==null?void 0:Pt.nickname)||null,referrerCode:(Pt==null?void 0:Pt.referralCode)??null,type:Xe.productType||Xe.type}});r(Qe),A(st.total??Qe.length)}else r([]),A(0)}catch(Ye){console.error(Ye),j("加载订单失败"),r([])}break}case"bindings":{try{const Ye=new URLSearchParams({page:String(M),pageSize:String(F),...E!=="all"&&{status:E}}),st=await Be(`/api/db/distribution?${Ye}`);c((st==null?void 0:st.bindings)||[]),A((st==null?void 0:st.total)??((Se=st==null?void 0:st.bindings)==null?void 0:Se.length)??0)}catch(Ye){console.error(Ye),j("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const Ye=E==="completed"?"success":E==="rejected"?"failed":E,st=new URLSearchParams({...Ye&&Ye!=="all"&&{status:Ye},page:String(M),pageSize:String(F)}),Qe=await Be(`/api/admin/withdrawals?${st}`);if(Qe!=null&&Qe.success&&Qe.withdrawals){const Xe=Qe.withdrawals.map(ft=>({...ft,account:ft.account??"未绑定微信号",status:ft.status==="success"?"completed":ft.status==="failed"?"rejected":ft.status}));h(Xe),A((Qe==null?void 0:Qe.total)??Xe.length)}else Qe!=null&&Qe.success||j(`获取提现记录失败: ${(Qe==null?void 0:Qe.error)||"未知错误"}`),h([])}catch(Ye){console.error(Ye),j("加载提现数据失败"),h([])}break}}W(Ye=>new Set(Ye).add(B))}catch(rt){console.error(rt)}finally{y(!1)}}}async function Y(){j(null),W(B=>{const me=new Set(B);return me.delete(t),me}),t==="overview"&&V(),await ae(t,!0)}async function L(B){if(confirm("确认审核通过并打款?"))try{const me=await Rt("/api/admin/withdrawals",{id:B,action:"approve"});if(!(me!=null&&me.success)){const Se=(me==null?void 0:me.message)||(me==null?void 0:me.error)||"操作失败";alert(Se);return}await Y()}catch(me){console.error(me),alert("操作失败")}}async function H(B){const me=prompt("请输入拒绝原因:");if(me)try{const Se=await Rt("/api/admin/withdrawals",{id:B,action:"reject",errorMessage:me});if(!(Se!=null&&Se.success)){alert((Se==null?void 0:Se.error)||"操作失败");return}await Y()}catch(Se){console.error(Se),alert("操作失败")}}async function ue(){var B;if(!(!(X!=null&&X.orderSn)&&!(X!=null&&X.id))){oe(!0),j(null);try{const me=await Rt("/api/admin/orders/refund",{orderSn:X.orderSn||X.id,reason:Z||void 0});me!=null&&me.success?(q(null),_(""),await ae("orders",!0)):j((me==null?void 0:me.error)||"退款失败")}catch(me){const Se=me;j(((B=Se==null?void 0:Se.data)==null?void 0:B.error)||"退款失败,请检查网络后重试")}finally{oe(!1)}}}function U(B){const me={active:"bg-green-500/20 text-green-400",converted:"bg-blue-500/20 text-blue-400",expired:"bg-gray-500/20 text-gray-400",cancelled:"bg-red-500/20 text-red-400",pending:"bg-orange-500/20 text-orange-400",pending_confirm:"bg-orange-500/20 text-orange-400",processing:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",rejected:"bg-red-500/20 text-red-400"},Se={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return i.jsx(Fe,{className:`${me[B]||"bg-gray-500/20 text-gray-400"} border-0`,children:Se[B]||B})}const he=Math.ceil(I/F)||1,Q=n,ee=o.filter(B=>{var Se,rt,Ye,st;if(!w)return!0;const me=w.toLowerCase();return((Se=B.refereeNickname)==null?void 0:Se.toLowerCase().includes(me))||((rt=B.refereePhone)==null?void 0:rt.includes(me))||((Ye=B.referrerName)==null?void 0:Ye.toLowerCase().includes(me))||((st=B.referrerCode)==null?void 0:st.toLowerCase().includes(me))}),de=u.filter(B=>{var Se;if(!w)return!0;const me=w.toLowerCase();return((Se=B.userName)==null?void 0:Se.toLowerCase().includes(me))||B.account&&B.account.toLowerCase().includes(me)});return i.jsxs("div",{className:"p-8 w-full",children:[v&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:v}),i.jsx("button",{type:"button",onClick:()=>j(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:"推广中心"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),i.jsxs(re,{onClick:Y,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),"刷新数据"]})]}),i.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4 flex-wrap",children:[{key:"overview",label:"数据概览",icon:cc},{key:"orders",label:"订单管理",icon:Vu},{key:"bindings",label:"绑定管理",icon:Gs},{key:"withdrawals",label:"提现审核",icon:Jo},{key:"settings",label:"推广设置",icon:Da}].map(B=>i.jsxs("button",{type:"button",onClick:()=>{e(B.key),C("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===B.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[i.jsx(B.icon,{className:"w-4 h-4"}),B.label]},B.key))}),g?i.jsxs("div",{className:"flex items-center justify-center py-20",children:[i.jsx(qe,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[t==="overview"&&s&&i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayClicks}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"总点击次数(实时)"})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:i.jsx(pg,{className:"w-6 h-6 text-blue-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日独立用户"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayUniqueVisitors??0}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"去重访客数(实时)"})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/20 flex items-center justify-center",children:i.jsx(Nn,{className:"w-6 h-6 text-cyan-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日总文章点击率"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(s.todayClickRate??0).toFixed(2)}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"人均点击(总点击/独立用户)"})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-500/20 flex items-center justify-center",children:i.jsx(cc,{className:"w-6 h-6 text-amber-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayBindings})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:i.jsx(Gs,{className:"w-6 h-6 text-green-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayConversions})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:i.jsx(Eb,{className:"w-6 h-6 text-purple-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),i.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",s.todayEarnings.toFixed(2)]})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:i.jsx(Vu,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((Ce=s.todayClicksByPage)==null?void 0:Ce.length)??0)>0&&i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(pg,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),i.jsx(Te,{children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[i.jsx("th",{className:"pb-3 pr-4",children:"来源页/文章"}),i.jsx("th",{className:"pb-3 pr-4 text-right",children:"今日点击"}),i.jsx("th",{className:"pb-3 text-right",children:"占比"})]})}),i.jsx("tbody",{children:[...s.todayClicksByPage??[]].sort((B,me)=>me.clicks-B.clicks).map((B,me)=>i.jsxs("tr",{className:"border-b border-gray-700/50",children:[i.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:B.page||"(未区分)"}),i.jsx("td",{className:"py-2 pr-4 text-right text-white",children:B.clicks}),i.jsxs("td",{className:"py-2 text-right text-gray-400",children:[s.todayClicks>0?(B.clicks/s.todayClicks*100).toFixed(1):0,"%"]})]},me))})]})})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Ee,{className:"bg-orange-500/10 border-orange-500/30",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:i.jsx(fg,{className:"w-6 h-6 text-orange-400"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),i.jsxs("p",{className:"text-2xl font-bold text-white",children:[s.expiringBindings," 个"]}),i.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),i.jsx(Ee,{className:"bg-blue-500/10 border-blue-500/30",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:i.jsx(Jo,{className:"w-6 h-6 text-blue-400"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),i.jsxs("p",{className:"text-2xl font-bold text-white",children:[s.pendingWithdrawals," 笔"]}),i.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",s.pendingWithdrawAmount.toFixed(2)]})]}),i.jsx(re,{onClick:()=>e("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(et,{children:i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Bu,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),i.jsx(Te,{children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.monthClicks})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.monthBindings})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.monthConversions})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),i.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",s.monthEarnings.toFixed(2)]})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(et,{children:i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(cc,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),i.jsxs(Te,{children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.totalClicks.toLocaleString()})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.totalBindings.toLocaleString()})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.totalConversions})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),i.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",s.totalEarnings.toFixed(2)]})]})]}),i.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[i.jsx("span",{className:"text-gray-300",children:"点击转化率"}),i.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[s.conversionRate,"%"]})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(et,{children:i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Nn,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),i.jsx(Te,{children:i.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-white",children:s.totalDistributors}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-green-400",children:s.activeDistributors}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),t==="orders"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ui,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),i.jsx(ce,{value:w,onChange:B=>k(B.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),i.jsxs("select",{value:E,onChange:B=>C(B.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"pending",children:"待支付"}),i.jsx("option",{value:"failed",children:"已失败"}),i.jsx("option",{value:"refunded",children:"已退款"})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-0",children:[n.length===0?i.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Q.map(B=>{var me,Se;return i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(me=B.id)==null?void 0:me.slice(0,12),"..."]}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm",children:B.userNickname}),i.jsx("p",{className:"text-gray-500 text-xs",children:B.userPhone})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm",children:(()=>{const rt=B.productType||B.type;return rt==="fullbook"?`${B.bookName||"《底层逻辑》"} - 全本`:rt==="match"?"匹配次数购买":`${B.bookName||"《底层逻辑》"} - ${B.sectionTitle||B.chapterTitle||`章节${B.productId||B.sectionId||""}`}`})()}),i.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const rt=B.productType||B.type;return rt==="fullbook"?"全书解锁":rt==="match"?"功能权益":B.chapterTitle||"单章购买"})()})]})}),i.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof B.amount=="number"?B.amount.toFixed(2):parseFloat(String(B.amount||"0")).toFixed(2)]}),i.jsx("td",{className:"p-4 text-gray-300",children:B.paymentMethod==="wechat"?"微信支付":B.paymentMethod==="alipay"?"支付宝":B.paymentMethod||"微信支付"}),i.jsx("td",{className:"p-4",children:B.status==="refunded"?i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):B.status==="completed"||B.status==="paid"?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):B.status==="pending"||B.status==="created"?i.jsx(Fe,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):i.jsx(Fe,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),i.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:B.refundReason,children:B.status==="refunded"&&B.refundReason?B.refundReason:"-"}),i.jsx("td",{className:"p-4 text-gray-300 text-sm",children:B.referrerId||B.referralCode?i.jsxs("span",{title:B.referralCode||B.referrerCode||B.referrerId||"",children:[B.referrerNickname||B.referralCode||B.referrerCode||((Se=B.referrerId)==null?void 0:Se.slice(0,8)),(B.referralCode||B.referrerCode)&&` (${B.referralCode||B.referrerCode})`]}):"-"}),i.jsx("td",{className:"p-4 text-[#FFD700]",children:B.referrerEarnings?`¥${(typeof B.referrerEarnings=="number"?B.referrerEarnings:parseFloat(String(B.referrerEarnings))).toFixed(2)}`:"-"}),i.jsx("td",{className:"p-4 text-gray-400 text-sm",children:B.createdAt?new Date(B.createdAt).toLocaleString("zh-CN"):"-"}),i.jsx("td",{className:"p-4",children:(B.status==="paid"||B.status==="completed")&&i.jsxs(re,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{q(B),_("")},children:[i.jsx(zN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},B.id)})})]})}),t==="orders"&&i.jsx(Zr,{page:M,totalPages:he,total:I,pageSize:F,onPageChange:D,onPageSizeChange:B=>{R(B),D(1)}})]})})]}),t==="bindings"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ui,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),i.jsx(ce,{value:w,onChange:B=>k(B.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),i.jsxs("select",{value:E,onChange:B=>C(B.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"active",children:"有效"}),i.jsx("option",{value:"converted",children:"已转化"}),i.jsx("option",{value:"expired",children:"已过期"})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-0",children:[ee.length===0?i.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:ee.map(B=>i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-medium",children:B.refereeNickname||"匿名用户"}),i.jsx("p",{className:"text-gray-500 text-xs",children:B.refereePhone})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:B.referrerName||"-"}),i.jsx("p",{className:"text-gray-500 text-xs font-mono",children:B.referrerCode})]})}),i.jsx("td",{className:"p-4 text-gray-400",children:B.boundAt?new Date(B.boundAt).toLocaleDateString("zh-CN"):"-"}),i.jsx("td",{className:"p-4 text-gray-400",children:B.expiresAt?new Date(B.expiresAt).toLocaleDateString("zh-CN"):"-"}),i.jsx("td",{className:"p-4",children:U(B.status)}),i.jsx("td",{className:"p-4",children:B.commission?i.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",B.commission.toFixed(2)]}):i.jsx("span",{className:"text-gray-500",children:"-"})})]},B.id))})]})}),t==="bindings"&&i.jsx(Zr,{page:M,totalPages:he,total:I,pageSize:F,onPageChange:D,onPageSizeChange:B=>{R(B),D(1)}})]})})]}),t==="withdrawals"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ui,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),i.jsx(ce,{value:w,onChange:B=>k(B.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),i.jsxs("select",{value:E,onChange:B=>C(B.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"pending",children:"待审核"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-0",children:[de.length===0?i.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:de.map(B=>i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsx("td",{className:"p-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[B.userAvatar?i.jsx("img",{src:B.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):i.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(B.userName||B.name||"?").slice(0,1)}),i.jsx("p",{className:"text-white font-medium",children:B.userName||B.name})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",B.amount.toFixed(2)]})}),i.jsx("td",{className:"p-4",children:i.jsx(Fe,{className:B.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:B.method==="wechat"?"微信":"支付宝"})}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-mono text-xs",children:B.account}),i.jsx("p",{className:"text-gray-500 text-xs",children:B.name})]})}),i.jsx("td",{className:"p-4 text-gray-400",children:B.createdAt?new Date(B.createdAt).toLocaleString("zh-CN"):"-"}),i.jsx("td",{className:"p-4",children:U(B.status)}),i.jsx("td",{className:"p-4 text-right",children:B.status==="pending"&&i.jsxs("div",{className:"flex gap-2 justify-end",children:[i.jsxs(re,{size:"sm",onClick:()=>L(B.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Eb,{className:"w-4 h-4 mr-1"}),"通过"]}),i.jsxs(re,{size:"sm",variant:"outline",onClick:()=>H(B.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[i.jsx(PN,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},B.id))})]})}),t==="withdrawals"&&i.jsx(Zr,{page:M,totalPages:he,total:I,pageSize:F,onPageChange:D,onPageSizeChange:B=>{R(B),D(1)}})]})})]})]}),i.jsx(Qt,{open:!!X,onOpenChange:B=>!B&&q(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:"订单退款"})}),X&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",X.orderSn||X.id]}),i.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof X.amount=="number"?X.amount.toFixed(2):parseFloat(String(X.amount||"0")).toFixed(2)]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),i.jsx("div",{className:"form-input",children:i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:Z,onChange:B=>_(B.target.value)})})]}),i.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>q(null),disabled:$,children:"取消"}),i.jsx(re,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:ue,disabled:$,children:$?"退款中...":"确认退款"})]})]})}),t==="settings"&&i.jsx("div",{className:"-mx-8 -mt-6",children:i.jsx(vk,{embedded:!0})})]})}function kP(){const[t,e]=b.useState([]),[n,r]=b.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[s,a]=b.useState(!0),[o,c]=b.useState(null),[u,h]=b.useState("all"),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,j]=b.useState(0),[w,k]=b.useState(null);async function E(){var R,I,A,O,W,X,q;a(!0),c(null);try{const Z=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),_=await Be(`/api/admin/withdrawals?${Z}`);if(_!=null&&_.success){const $=_.withdrawals||[];e($),j(_.total??((R=_.stats)==null?void 0:R.total)??$.length),r({total:((I=_.stats)==null?void 0:I.total)??_.total??$.length,pendingCount:((A=_.stats)==null?void 0:A.pendingCount)??0,pendingAmount:((O=_.stats)==null?void 0:O.pendingAmount)??0,successCount:((W=_.stats)==null?void 0:W.successCount)??0,successAmount:((X=_.stats)==null?void 0:X.successAmount)??0,failedCount:((q=_.stats)==null?void 0:q.failedCount)??0})}else c("加载提现记录失败")}catch(Z){console.error("Load withdrawals error:",Z),c("加载失败,请检查网络后重试")}finally{a(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{E()},[u,f,g]);const C=Math.ceil(v/g)||1;async function M(R){const I=t.find(A=>A.id===R);if(I!=null&&I.userCommissionInfo&&I.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${I.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 + +确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(R);try{const A=await Rt("/api/admin/withdrawals",{id:R,action:"approve"});A!=null&&A.success?E():alert("操作失败: "+((A==null?void 0:A.error)??""))}catch{alert("操作失败")}finally{k(null)}}async function D(R){const I=prompt("请输入拒绝原因(将返还用户余额):");if(I){k(R);try{const A=await Rt("/api/admin/withdrawals",{id:R,action:"reject",errorMessage:I});A!=null&&A.success?E():alert("操作失败: "+((A==null?void 0:A.error)??""))}catch{alert("操作失败")}finally{k(null)}}}function F(R){switch(R){case"pending":return i.jsx(Fe,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return i.jsx(Fe,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return i.jsx(Fe,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return i.jsx(Fe,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 border-0",children:R})}}return i.jsxs("div",{className:"p-8 w-full",children:[o&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:o}),i.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-start mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),i.jsxs(re,{variant:"outline",onClick:E,disabled:s,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})]}),i.jsx(Ee,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:i.jsx(Te,{className:"p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(Vu,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),i.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",i.jsx("span",{className:"text-white font-medium",children:"90%"})]}),i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),i.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),i.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),i.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),i.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),i.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),i.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),i.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),i.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(R=>i.jsx(re,{variant:u===R?"default":"outline",size:"sm",onClick:()=>h(R),className:u===R?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:R==="all"?"全部":R==="pending"?"待处理":R==="success"?"已完成":"已拒绝"},R))}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:s?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?i.jsxs("div",{className:"text-center py-12",children:[i.jsx(Jo,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),i.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),i.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:t.map(R=>i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsx("td",{className:"p-4 text-gray-400",children:new Date(R.createdAt??"").toLocaleString()}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[R.userAvatar?i.jsx("img",{src:R.userAvatar,alt:R.userName??"",className:"w-8 h-8 rounded-full object-cover"}):i.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(R.userName??"?").charAt(0)}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-white",children:R.userName??"未知"}),i.jsx("p",{className:"text-xs text-gray-500",children:R.userPhone??R.referralCode??(R.userId??"").slice(0,10)})]})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(R.amount).toFixed(2)]})}),i.jsx("td",{className:"p-4",children:R.userCommissionInfo?i.jsxs("div",{className:"text-xs space-y-1",children:[i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),i.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",R.userCommissionInfo.totalCommission.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"已提现:"}),i.jsxs("span",{className:"text-gray-400",children:["¥",R.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"待审核:"}),i.jsxs("span",{className:"text-orange-400",children:["¥",R.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[i.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),i.jsxs("span",{className:R.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",R.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):i.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),i.jsxs("td",{className:"p-4",children:[F(R.status),R.errorMessage&&i.jsx("p",{className:"text-xs text-red-400 mt-1",children:R.errorMessage})]}),i.jsx("td",{className:"p-4 text-gray-400",children:R.processedAt?new Date(R.processedAt).toLocaleString():"-"}),i.jsx("td",{className:"p-4 text-gray-400",children:R.userConfirmedAt?i.jsxs("span",{className:"text-green-400",title:R.userConfirmedAt,children:["已确认 ",new Date(R.userConfirmedAt).toLocaleString()]}):"-"}),i.jsxs("td",{className:"p-4 text-right",children:[(R.status==="pending"||R.status==="pending_confirm")&&i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsxs(re,{size:"sm",onClick:()=>M(R.id),disabled:w===R.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[i.jsx(Wh,{className:"w-4 h-4 mr-1"}),"批准"]}),i.jsxs(re,{size:"sm",variant:"outline",onClick:()=>D(R.id),disabled:w===R.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(R.status==="success"||R.status==="completed")&&R.transactionId&&i.jsx("span",{className:"text-xs text-gray-500 font-mono",children:R.transactionId})]})]},R.id))})]})}),i.jsx(Zr,{page:f,totalPages:C,total:v,pageSize:g,onPageChange:m,onPageSizeChange:R=>{y(R),m(1)}})]})})})]})}var Sm={exports:{}},Cm={};/** + * @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 Qb;function SP(){if(Qb)return Cm;Qb=1;var t=$c();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var y=g(),v=r({inst:{value:y,getSnapshot:g}}),j=v[0].inst,w=v[1];return a(function(){j.value=y,j.getSnapshot=g,u(j)&&w({inst:j})},[m,y,g]),s(function(){return u(j)&&w({inst:j}),m(function(){u(j)&&w({inst:j})})},[m]),o(y),y}function u(m){var g=m.getSnapshot;m=m.value;try{var y=g();return!n(m,y)}catch{return!0}}function h(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Cm.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Cm}var Xb;function bk(){return Xb||(Xb=1,Sm.exports=SP()),Sm.exports}var wk=bk();function An(t){this.content=t}An.prototype={constructor:An,find:function(t){for(var e=0;e>1}};An.from=function(t){if(t instanceof An)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new An(e)};function Nk(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),a=e.child(r);if(s==a){n+=s.nodeSize;continue}if(!s.sameMarkup(a))return n;if(s.isText&&s.text!=a.text){for(let o=0;s.text[o]==a.text[o];o++)n++;return n}if(s.content.size||a.content.size){let o=Nk(s.content,a.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function jk(t,e,n,r){for(let s=t.childCount,a=e.childCount;;){if(s==0||a==0)return s==a?null:{a:n,b:r};let o=t.child(--s),c=e.child(--a),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,s+c,a||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,s+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let a="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?s?typeof s=="function"?s(c):s:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:a+=r),a+=h},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),a=1);ae)for(let a=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),s+=c.nodeSize),o=u}return new pe(r,s)}cutByIndex(e,n){return e==n?pe.empty:e==0&&n==this.content.length?this:new pe(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new pe(s,a)}addToStart(e){return new pe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new pe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),a=r+s.nodeSize;if(a>=e)return a==e?fu(n+1,a):fu(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return pe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new pe(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return pe.empty;let n,r=0;for(let s=0;sthis.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-s.type.rank),n}};Nt.none=[];class Ju extends Error{}class Me{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Sk(this.content,e+this.openStart,n);return r&&new Me(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Me(kk(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Me.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Me(pe.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)s++;return new Me(e,r,s)}}Me.empty=new Me(pe.empty,0,0);function kk(t,e,n){let{index:r,offset:s}=t.findIndex(e),a=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(s==e||a.isText){if(c!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(kk(a.content,e-s-1,n-s-1)))}function Sk(t,e,n,r){let{index:s,offset:a}=t.findIndex(e),o=t.maybeChild(s);if(a==e||o.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Sk(o.content,e-a-1,n,o);return c&&t.replaceChild(s,o.copy(c))}function CP(t,e,n){if(n.openStart>t.depth)throw new Ju("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ju("Inconsistent open depths");return Ck(t,e,n,0)}function Ck(t,e,n,r){let s=t.index(r),a=t.node(r);if(s==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function dc(t,e,n,r){let s=(e||t).node(n),a=0,o=e?e.index(n):s.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(La(t.nodeAfter,r),a++));for(let c=a;cs&&Eg(t,e,s+1),o=r.depth>s&&Eg(n,r,s+1),c=[];return dc(null,t,s,c),a&&o&&e.index(s)==n.index(s)?(Ek(a,o),La(_a(a,Tk(t,e,n,r,s+1)),c)):(a&&La(_a(a,Yu(t,e,s+1)),c),dc(e,n,s,c),o&&La(_a(o,Yu(n,r,s+1)),c)),dc(r,null,s,c),new pe(c)}function Yu(t,e,n){let r=[];if(dc(null,t,n,r),t.depth>n){let s=Eg(t,e,n+1);La(_a(s,Yu(t,e,n+1)),r)}return dc(e,null,n,r),new pe(r)}function EP(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)s=e.node(a).copy(pe.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class Cc{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let a=0;a0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Qu(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,a=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(a),h=a-u;if(r.push(o,c,s+u),!h||(o=o.child(c),o.isText))break;a=h-1,s+=u+1}return new Cc(n,r,a)}static resolveCached(e,n){let r=Zb.get(e);if(r)for(let a=0;ae&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Mk(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=pe.empty,s=0,a=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,a),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=s;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=pe.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,s,r);return a.type.checkAttrs(a.attrs),a}};Js.prototype.text=void 0;class Xu extends Js{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Mk(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Xu(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Xu(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Mk(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ha{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new RP(e,n);if(r.next==null)return Ha.empty;let s=Ak(r);r.next&&r.err("Unexpected trailing text");let a=zP(_P(s));return $P(a,r),a}matchType(e){for(let n=0;nh.createAndFill()));for(let h=0;h=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s{let a=s+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return a}).join(` +`)}}Ha.empty=new Ha(!0);class RP{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Ak(t){let e=[];do e.push(IP(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function IP(t){let e=[];do e.push(PP(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function PP(t){let e=LP(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=OP(t,e);else break;return e}function e1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function OP(t,e){let n=e1(t),r=n;return t.eat(",")&&(t.next!="}"?r=e1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function DP(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let a in n){let o=n[a];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function LP(t){if(t.eat("(")){let e=Ak(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=DP(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function _P(t){let e=[[]];return s(a(t,0),n()),e;function n(){return e.push([])-1}function r(o,c,u){let h={term:u,to:c};return e[o].push(h),h}function s(o,c){o.forEach(u=>u.to=c)}function a(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(a(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=a(o.exprs[u],c);if(u==o.exprs.length-1)return h;s(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),s(a(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return s(a(o.expr,c),u),s(a(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(a(o.expr,c));if(o.type=="range"){let u=c;for(let h=0;h{t[o].forEach(({term:c,to:u})=>{if(!c)return;let h;for(let f=0;f{h||s.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let a=e[r.join(",")]=new Ha(r.indexOf(t.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Pk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Js(this,this.computeAttrs(e),pe.from(n),Nt.setFrom(r))}createChecked(e=null,n,r){return n=pe.from(n),this.checkContent(n),new Js(this,this.computeAttrs(e),n,Nt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=pe.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),a=s&&s.fillBefore(pe.empty,!0);return a?new Js(this,e,n.append(a),Nt.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[a]=new Lk(a,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function FP(t,e,n){let r=n.split("|");return s=>{let a=s===null?"null":typeof s;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class BP{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?FP(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Xh{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=Dk(e,s.attrs),this.excluded=null;let a=Ik(this.attrs);this.instance=a?new Nt(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Nt(this,Pk(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((a,o)=>r[a]=new Xh(a,s++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class _k{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=An.from(e.nodes),n.marks=An.from(e.marks||{}),this.nodes=n1.compile(this.spec.nodes,this),this.marks=Xh.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let a=this.nodes[s],o=a.spec.content||"",c=a.spec.marks;if(a.contentMatch=r[o]||(r[o]=Ha.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=c=="_"?null:c?r1(this,c.split(" ")):c==""||!a.inlineContent?[]:null}for(let s in this.marks){let a=this.marks[s],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:r1(this,o.split(" "))}this.nodeFromJSON=s=>Js.fromJSON(this,s),this.markFromJSON=s=>Nt.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof n1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new Xu(r,r.defaultAttrs,e,Nt.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function r1(t,e){let n=[];for(let r=0;r-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function VP(t){return t.tag!=null}function HP(t){return t.style!=null}class qi{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(VP(s))this.tags.push(s);else if(HP(s)){let a=/[^=]*/.exec(s.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let a=e.nodes[s.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new i1(this,n,!1);return r.addAll(e,Nt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new i1(this,n,!0);return r.addAll(e,Nt.none,n.from,n.to),Me.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;se.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let a=s.priority==null?50:s.priority,o=0;for(;o{r(o=a1(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let a=e.nodes[s].spec.parseDOM;a&&a.forEach(o=>{r(o=a1(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new qi(e,qi.schemaRules(e)))}}const zk={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},WP={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},$k={ol:!0,ul:!0},Ec=1,Mg=2,uc=4;function s1(t,e,n){return e!=null?(e?Ec:0)|(e==="full"?Mg:0):t&&t.whitespace=="pre"?Ec|Mg:n&~uc}class pu{constructor(e,n,r,s,a,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=Nt.none,this.match=a||(o&uc?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(pe.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ec)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-s[0].length))}}let n=pe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(pe.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!zk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class i1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,a,o=s1(null,n.preserveWhitespace,0)|(r?uc:0);s?a=new pu(s.type,s.attrs,Nt.none,!0,n.topMatch||s.type.contentMatch,o):r?a=new pu(null,null,Nt.none,!0,null,o):a=new pu(e.schema.topNodeType,null,Nt.none,!0,null,o),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,a=s.options&Mg?"full":this.localPreserveWS||(s.options&Ec)>0,{schema:o}=this.parser;if(a==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,` +`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(h)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,s){let a,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(a=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}a&&this.sync(c)&&this.open--}addAll(e,n,r,s){let a=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=s==null?null:e.childNodes[s];o!=c;o=o.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(o,n);this.findAtPoint(e,a)}findPlace(e,n,r){let s,a;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!s||s.length>h.length+c)&&(s=h,a=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!s)return null;this.sync(a);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):o1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new pu(e,n,u,s,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Ec)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(s?0:1),o=(c,u)=>{for(;c>=0;c--){let h=n[c];if(h==""){if(c==n.length-1||c==0)continue;for(;u>=a;u--)if(o(c-1,u))return!0;return!1}else{let f=u>0||u==0&&s?this.nodes[u].type:r&&u>=a?r.node(u-a).type:null;if(!f||f.name!=h&&!f.isInGroup(h))return!1;u--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function UP(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&$k.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function KP(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function a1(t){let e={};for(let n in t)e[n]=t[n];return e}function o1(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let a=[],o=c=>{a.push(c);for(let u=0;u{if(a.length||o.marks.length){let c=0,u=0;for(;c=0;s--){let a=this.serializeMark(e.marks[s],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&Iu(Tm(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return Iu(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Za(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=l1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return l1(e.marks)}}function l1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Tm(t){return t.document||window.document}const c1=new WeakMap;function qP(t){let e=c1.get(t);return e===void 0&&c1.set(t,e=GP(t)),e}function GP(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let c,u=n?t.createElementNS(n,s):t.createElement(s),h=e[1],f=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){f=2;for(let m in h)if(h[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=f;mf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:y,contentDOM:v}=Iu(t,g,n,r);if(u.appendChild(y),v){if(c)throw new RangeError("Multiple content holes");c=v}}}return{dom:u,contentDOM:c}}const Fk=65535,Bk=Math.pow(2,16);function JP(t,e){return t+e*Bk}function d1(t){return t&Fk}function YP(t){return(t-(t&Fk))/Bk}const Vk=1,Hk=2,Pu=4,Wk=8;class Ag{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Wk)>0}get deletedBefore(){return(this.delInfo&(Vk|Pu))>0}get deletedAfter(){return(this.delInfo&(Hk|Pu))>0}get deletedAcross(){return(this.delInfo&Pu)>0}}class Nr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Nr.empty)return Nr.empty}recover(e){let n=0,r=d1(e);if(!this.inverted)for(let s=0;se)break;let h=this.ranges[c+a],f=this.ranges[c+o],m=u+h;if(e<=m){let g=h?e==u?-1:e==m?1:n:n,y=u+s+(g<0?0:f);if(r)return y;let v=e==(n<0?u:m)?null:JP(c/3,e-u),j=e==u?Hk:e==m?Vk:Pu;return(n<0?e!=u:e!=m)&&(j|=Wk),new Ag(y,j,v)}s+=f-h}return r?e+s:new Ag(e+s,0,null)}touches(e,n){let r=0,s=d1(n),a=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;ce)break;let h=this.ranges[c+a],f=u+h;if(e<=f&&c==s*3)return!0;r+=this.ranges[c+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,a=0;s=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Tc;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ra&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return on.fromReplace(e,this.from,this.to,a)}invert(){return new Xr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Bi(n.pos,r.pos,this.mark)}merge(e){return e instanceof Bi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Bi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Bi(n.from,n.to,e.markFromJSON(n.mark))}}Un.jsonID("addMark",Bi);class Xr extends Un{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Me(Bx(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return on.fromReplace(e,this.from,this.to,r)}invert(){return new Bi(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Xr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Xr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Xr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Xr(n.from,n.to,e.markFromJSON(n.mark))}}Un.jsonID("removeMark",Xr);class Vi extends Un{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return on.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return on.fromReplace(e,this.pos,this.pos+1,new Me(pe.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;sr.pos?null:new jn(n.pos,r.pos,s,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new jn(n.from,n.to,n.gapFrom,n.gapTo,Me.fromJSON(e,n.slice),n.insert,!!n.structure)}}Un.jsonID("replaceAround",jn);function Rg(t,e,n){let r=t.resolve(e),s=n-e,a=r.depth;for(;s>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,s--;if(s>0){let o=r.node(a).maybeChild(r.indexAfter(a));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function QP(t,e,n,r){let s=[],a=[],o,c;t.doc.nodesBetween(e,n,(u,h,f)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&f.type.allowsMarkType(r.type)){let g=Math.max(h,e),y=Math.min(h+u.nodeSize,n),v=r.addToSet(m);for(let j=0;jt.step(u)),a.forEach(u=>t.step(u))}function XP(t,e,n,r){let s=[],a=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;a++;let u=null;if(r instanceof Xh){let h=o.marks,f;for(;f=r.isInSet(h);)(u||(u=[])).push(f),h=f.removeFromSet(h)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let h=Math.min(c+o.nodeSize,n);for(let f=0;ft.step(new Xr(o.from,o.to,o.style)))}function Vx(t,e,n,r=n.contentMatch,s=!0){let a=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function ZP(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function hl(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,a=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+s,u=t.$to.indexAfter(r)-a;if(rn;v--)j||r.index(v)>0?(j=!0,f=pe.from(r.node(v).copy(f)),m++):u--;let g=pe.empty,y=0;for(let v=a,j=!1;v>n;v--)j||s.after(v+1)=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=pe.from(n[o].type.create(n[o].attrs,r))}let s=e.start,a=e.end;t.step(new jn(s,a,s,a,new Me(r,0,0),n.length,!0))}function sO(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(o,c)=>{let u=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,u)&&iO(t.doc,t.mapping.slice(a).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!v?h=!1:!y&&v&&(h=!0)}h===!1&&Kk(t,o,c,a),Vx(t,t.mapping.slice(a).map(c,1),r,void 0,h===null);let f=t.mapping.slice(a),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new jn(m,g,m+1,g-1,new Me(pe.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&Uk(t,o,c,a),!1}})}function Uk(t,e,n,r){e.forEach((s,a)=>{if(s.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(s.text);){let u=t.mapping.slice(r).map(n+1+a+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function Kk(t,e,n,r){e.forEach((s,a)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+a);t.replaceWith(o,o+1,e.type.schema.text(` +`))}})}function iO(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function aO(t,e,n,r,s){let a=t.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");n||(n=a.type);let o=n.create(r,null,s||a.marks);if(a.isLeaf)return t.replaceWith(e,e+a.nodeSize,o);if(!n.validContent(a.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new jn(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new Me(pe.from(o),0,0),1,!0))}function Ys(t,e,n=1,r){let s=t.resolve(e),a=s.depth-n,o=r&&r[r.length-1]||s.parent;if(a<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let h=s.depth-1,f=n-2;h>a;h--,f--){let m=s.node(h),g=s.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),v=r&&r[f+1];v&&(y=y.replaceChild(0,v.type.create(v.attrs)));let j=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!j.type.validContent(y))return!1}let c=s.indexAfter(a),u=r&&r[0];return s.node(a).canReplaceWith(c,c,u?u.type:s.node(a+1).type)}function oO(t,e,n=1,r){let s=t.doc.resolve(e),a=pe.empty,o=pe.empty;for(let c=s.depth,u=s.depth-n,h=n-1;c>u;c--,h--){a=pe.from(s.node(c).copy(a));let f=r&&r[h];o=pe.from(f?f.type.create(f.attrs,o):s.node(c).copy(o))}t.step(new wn(e,e,new Me(a.append(o),n,n),!0))}function aa(t,e){let n=t.resolve(e),r=n.index();return qk(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function lO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s0?(a=r.node(s+1),c++,o=r.node(s).maybeChild(c)):(a=r.node(s).maybeChild(c-1),o=r.node(s+1)),a&&!a.isTextblock&&qk(a,o)&&r.node(s).canReplace(c,c+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function cO(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,a=t.doc.resolve(e-n),o=a.node().type;if(s&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(s);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);Kk(t,f.node(),f.before(),c)}o.inlineContent&&Vx(t,e+n-1,o,a.node().contentMatchAt(a.index()),r==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new wn(h,u.map(e+n,-1),Me.empty,!0)),r===!0){let f=t.doc.resolve(h);Uk(t,f.node(),f.before(),t.steps.length)}return t}function dO(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let a=r.index(s);if(r.node(s).canReplaceWith(a,a,n))return r.before(s+1);if(a>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a=0;o--){let c=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(c>0?1:0),h=r.node(o),f=!1;if(a==1)f=h.canReplace(u,u,s);else{let m=h.contentMatchAt(u).findWrapping(s.firstChild.type);f=m&&h.canReplaceWith(u,u,m[0])}if(f)return c==0?r.pos:c<0?r.before(o+1):r.after(o+1)}return null}function ef(t,e,n=e,r=Me.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),a=t.resolve(n);return Jk(s,a,r)?new wn(e,n,r):new uO(s,a,r).fit()}function Jk(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class uO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=pe.empty;for(let s=0;s<=e.depth;s++){let a=e.node(s);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=pe.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let a=this.placed,o=r.depth,c=s.depth;for(;o&&c&&a.childCount==1;)a=a.firstChild.content,o--,c--;let u=new Me(a,o,c);return e>-1?new jn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new wn(r.pos,s.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r1&&(s=0),a.type.spec.isolating&&s<=r){e=r;break}n=a.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,a=null;r?(a=Am(this.unplaced.content,r-1).firstChild,s=a.content):s=this.unplaced.content;let o=s.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:h}=this.frontier[c],f,m=null;if(n==1&&(o?h.matchType(o.type)||(m=h.fillBefore(pe.from(o),!1)):a&&u.compatibleContent(a.type)))return{sliceDepth:r,frontierDepth:c,parent:a,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:a,wrap:f};if(a&&h.matchType(a.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Am(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new Me(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Am(e,n);if(s.childCount<=1&&n>0){let a=e.size-n<=n+s.size;this.unplaced=new Me(nc(e,n-1,1),n-1,a?n-1:r)}else this.unplaced=new Me(nc(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:a}){for(;this.depth>n;)this.closeFrontierNode();if(a)for(let j=0;j1||u==0||j.content.size)&&(m=w,f.push(Yk(j.mark(g.allowedMarks(j.marks)),h==1?u:0,h==c.childCount?y:-1)))}let v=h==c.childCount;v||(y=-1),this.placed=rc(this.placed,n,pe.from(f)),this.frontier[n].match=m,v&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let j=0,w=c;j1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],a=n=0;c--){let{match:u,type:h}=this.frontier[c],f=Rm(e,c,h,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:o,move:a?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=rc(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),a=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,a)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=rc(this.placed,this.depth,pe.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(pe.empty,!0);n.childCount&&(this.placed=rc(this.placed,this.frontier.length,n))}}function nc(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(nc(t.firstChild.content,e-1,n)))}function rc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(rc(t.lastChild.content,e-1,n)))}function Am(t,e){for(let n=0;n1&&(r=r.replaceChild(0,Yk(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(pe.empty,!0)))),t.copy(r)}function Rm(t,e,n,r,s){let a=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let c=r.fillBefore(a.content,!0,o);return c&&!hO(n,a.content,o)?c:null}function hO(t,e,n){for(let r=n;r0;g--,y--){let v=s.node(g).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(g)>-1?c=g:s.before(g)==y&&o.splice(1,0,-g)}let u=o.indexOf(c),h=[],f=r.openStart;for(let g=r.content,y=0;;y++){let v=g.firstChild;if(h.push(v),y==r.openStart)break;g=v.content}for(let g=f-1;g>=0;g--){let y=h[g],v=fO(y.type);if(v&&!y.sameMarkup(s.node(Math.abs(c)-1)))f=g;else if(v||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+f+1)%(r.openStart+1),v=h[y];if(v)for(let j=0;j=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=o[g];y<0||(e=s.before(y),n=a.after(y))}}function Qk(t,e,n,r,s){if(er){let a=s.contentMatchAt(0),o=a.fillBefore(t).append(t);t=o.append(a.matchFragment(o).fillBefore(pe.empty,!0))}return t}function mO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=dO(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new Me(pe.from(r),0,0))}function gO(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n),a=Xk(r,s);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),s.indexAfter(c-1))))return t.delete(r.before(c),s.after(c))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function Xk(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let a=t.start(s);if(ae.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(a==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==a-1)&&n.push(s)}return n}class Ko extends Un{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return on.fail("No node at attribute step's position");let r=Object.create(null);for(let a in n.attrs)r[a]=n.attrs[a];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return on.fromReplace(e,this.pos,this.pos+1,new Me(pe.from(s),0,n.isLeaf?0:1))}getMap(){return Nr.empty}invert(e){return new Ko(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ko(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ko(n.pos,n.attr,n.value)}}Un.jsonID("attr",Ko);class Mc extends Un{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return on.ok(r)}getMap(){return Nr.empty}invert(e){return new Mc(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Mc(n.attr,n.value)}}Un.jsonID("docAttr",Mc);let Qo=class extends Error{};Qo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Qo.prototype=Object.create(Error.prototype);Qo.prototype.constructor=Qo;Qo.prototype.name="TransformError";class Wx{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Tc}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Qo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r{e=Math.min(e,c),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Me.empty){let s=ef(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new Me(pe.from(r),0,0))}delete(e,n){return this.replace(e,n,Me.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return pO(this,e,n,r),this}replaceRangeWith(e,n,r){return mO(this,e,n,r),this}deleteRange(e,n){return gO(this,e,n),this}lift(e,n){return eO(this,e,n),this}join(e,n=1){return cO(this,e,n),this}wrap(e,n){return rO(this,e,n),this}setBlockType(e,n=e,r,s=null){return sO(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return aO(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Ko(e,n,r)),this}setDocAttribute(e,n){return this.step(new Mc(e,n)),this}addNodeMark(e,n){return this.step(new Vi(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Nt)n.isInSet(r.marks)&&this.step(new Wa(e,n));else{let s=r.marks,a,o=[];for(;a=n.isInSet(s);)o.push(new Wa(e,a)),s=a.removeFromSet(s);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return oO(this,e,n,r),this}addMark(e,n,r){return QP(this,e,n,r),this}removeMark(e,n,r){return XP(this,e,n,r),this}clearIncompatible(e,n,r){return Vx(this,e,n,r),this}}const Im=Object.create(null);class Ge{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Zk(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;a--){let o=n<0?Do(e.node(0),e.node(a),e.before(a+1),e.index(a),n,r):Do(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new kr(e.node(0))}static atStart(e){return Do(e,e,0,0,1)||new kr(e)}static atEnd(e){return Do(e,e,e.content.size,e.childCount,-1)||new kr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Im[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Im)throw new RangeError("Duplicate use of selection JSON ID "+e);return Im[e]=n,n.prototype.jsonID=e,n}getBookmark(){return He.between(this.$anchor,this.$head).getBookmark()}}Ge.prototype.visible=!0;class Zk{constructor(e,n){this.$from=e,this.$to=n}}let h1=!1;function f1(t){!h1&&!t.parent.inlineContent&&(h1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class He extends Ge{constructor(e,n=e){f1(e),f1(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ge.near(r);let s=e.resolve(n.map(this.anchor));return new He(s.parent.inlineContent?s:r,r)}replace(e,n=Me.empty){if(super.replace(e,n),n==Me.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof He&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new tf(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new He(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let a=Ge.findFrom(n,r,!0)||Ge.findFrom(n,-r,!0);if(a)n=a.$head;else return Ge.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(Ge.findFrom(e,-r,!0)||Ge.findFrom(e,r,!0)).$anchor,e.pos0?0:1);s>0?o=0;o+=s){let c=e.child(o);if(c.isAtom){if(!a&&Ve.isSelectable(c))return Ve.create(t,n-(s<0?c.nodeSize:0))}else{let u=Do(t,c,n+s,s<0?c.childCount:0,s,a);if(u)return u}n+=c.nodeSize*s}return null}function p1(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(Ge.near(t.doc.resolve(o),n))}const m1=1,mu=2,g1=4;class yO extends Wx{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=mu,this}ensureMarks(e){return Nt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&mu)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~mu,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Nt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let a=this.storedMarks;if(!a){let o=this.doc.resolve(n);a=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,a)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Ge.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=g1,this}get scrolledIntoView(){return(this.updated&g1)>0}}function x1(t,e){return!e||!t?t:t.bind(e)}class sc{constructor(e,n,r){this.name=e,this.init=x1(n.init,r),this.apply=x1(n.apply,r)}}const vO=[new sc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new sc("selection",{init(t,e){return t.selection||Ge.atStart(e.doc)},apply(t){return t.selection}}),new sc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new sc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Pm{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=vO.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new sc(r.key,r.spec.state,r))})}}class Ho{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],a=s.spec.state;a&&a.toJSON&&(n[r]=a.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new Pm(e.schema,e.plugins),a=new Ho(s);return s.fields.forEach(o=>{if(o.name=="doc")a.doc=Js.fromJSON(e.schema,n.doc);else if(o.name=="selection")a.selection=Ge.fromJSON(a.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(a.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],h=u.spec.state;if(u.key==o.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){a[o.name]=h.fromJSON.call(u,e,n[c],a);return}}a[o.name]=o.init(e,a)}}),a}}function eS(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=eS(s,e,{})),n[r]=s}return n}class Ct{constructor(e){this.spec=e,this.props={},e.props&&eS(e.props,this,this.props),this.key=e.key?e.key.key:tS("plugin")}getState(e){return e[this.key]}}const Om=Object.create(null);function tS(t){return t in Om?t+"$"+ ++Om[t]:(Om[t]=0,t+"$")}class _t{constructor(e="key"){this.key=tS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Kx=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function nS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const rS=(t,e,n)=>{let r=nS(t,n);if(!r)return!1;let s=qx(r);if(!s){let o=r.blockRange(),c=o&&hl(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let a=s.nodeBefore;if(hS(t,s,e,-1))return!0;if(r.parent.content.size==0&&(Xo(a,"end")||Ve.isSelectable(a)))for(let o=r.depth;;o--){let c=ef(t.doc,r.before(o),r.after(o),Me.empty);if(c&&c.slice.size1)break}return a.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-a.nodeSize,s.pos).scrollIntoView()),!0):!1},bO=(t,e,n)=>{let r=nS(t,n);if(!r)return!1;let s=qx(r);return s?sS(t,s,e):!1},wO=(t,e,n)=>{let r=aS(t,n);if(!r)return!1;let s=Gx(r);return s?sS(t,s,e):!1};function sS(t,e,n){let r=e.nodeBefore,s=r,a=e.pos-1;for(;!s.isTextblock;a--){if(s.type.spec.isolating)return!1;let f=s.lastChild;if(!f)return!1;s=f}let o=e.nodeAfter,c=o,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let f=c.firstChild;if(!f)return!1;c=f}let h=ef(t.doc,a,u,Me.empty);if(!h||h.from!=a||h instanceof wn&&h.slice.size>=u-a)return!1;if(n){let f=t.tr.step(h);f.setSelection(He.create(f.doc,a)),n(f.scrollIntoView())}return!0}function Xo(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const iS=(t,e,n)=>{let{$head:r,empty:s}=t.selection,a=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;a=qx(r)}let o=a&&a.nodeBefore;return!o||!Ve.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ve.create(t.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function qx(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function aS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=aS(t,n);if(!r)return!1;let s=Gx(r);if(!s)return!1;let a=s.nodeAfter;if(hS(t,s,e,1))return!0;if(r.parent.content.size==0&&(Xo(a,"start")||Ve.isSelectable(a))){let o=ef(t.doc,r.before(),r.after(),Me.empty);if(o&&o.slice.size{let{$head:r,empty:s}=t.selection,a=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof Ve,s;if(r){if(n.node.isTextblock||!aa(t.doc,n.from))return!1;s=n.from}else if(s=Zh(t.doc,n.from,-1),s==null)return!1;if(e){let a=t.tr.join(s);r&&a.setSelection(Ve.create(a.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},jO=(t,e)=>{let n=t.selection,r;if(n instanceof Ve){if(n.node.isTextblock||!aa(t.doc,n.to))return!1;r=n.to}else if(r=Zh(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},kO=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),a=s&&hl(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)},cS=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` +`).scrollIntoView()),!0)};function Jx(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),a=n.indexAfter(-1),o=Jx(s.contentMatchAt(a));if(!o||!s.canReplaceWith(a,a,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(Ge.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},dS=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof kr||r.parent.inlineContent||s.parent.inlineContent)return!1;let a=Jx(s.parent.contentMatchAt(s.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let a=n.before();if(Ys(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let r=n.blockRange(),s=r&&hl(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function CO(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof Ve&&e.selection.node.isBlock)return!r.parentOffset||!Ys(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,c,u=!1,h=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){u=r.end(y)==r.pos+(r.depth-y),h=r.start(y)==r.pos-(r.depth-y),c=Jx(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),a.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;a.unshift(null)}let f=e.tr;(e.selection instanceof He||e.selection instanceof kr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=Ys(f.doc,m,a.length,a);if(g||(a[0]=c?{type:c}:null,g=Ys(f.doc,m,a.length,a)),!g)return!1;if(f.split(m,a.length,a),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),v=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(v.index(),v.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const EO=CO(),TO=(t,e)=>{let{$from:n,to:r}=t.selection,s,a=n.sharedDepth(r);return a==0?!1:(s=n.before(a),e&&e(t.tr.setSelection(Ve.create(t.doc,s))),!0)};function MO(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,a=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(a-1,a)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(a,a+1)||!(s.isTextblock||aa(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function hS(t,e,n,r){let s=e.nodeBefore,a=e.nodeAfter,o,c,u=s.type.spec.isolating||a.type.spec.isolating;if(!u&&MO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&c.matchType(o[0]||a.type).validEnd){if(n){let y=e.pos+a.nodeSize,v=pe.empty;for(let k=o.length-1;k>=0;k--)v=pe.from(o[k].create(null,v));v=pe.from(s.copy(v));let j=t.tr.step(new jn(e.pos-1,y,e.pos,y,new Me(v,1,0),o.length,!0)),w=j.doc.resolve(y+2*o.length);w.nodeAfter&&w.nodeAfter.type==s.type&&aa(j.doc,w.pos)&&j.join(w.pos),n(j.scrollIntoView())}return!0}let f=a.type.spec.isolating||r>0&&u?null:Ge.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&hl(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&Xo(a,"start",!0)&&Xo(s,"end")){let y=s,v=[];for(;v.push(y),!y.isTextblock;)y=y.lastChild;let j=a,w=1;for(;!j.isTextblock;j=j.firstChild)w++;if(y.canReplace(y.childCount,y.childCount,j.content)){if(n){let k=pe.empty;for(let C=v.length-1;C>=0;C--)k=pe.from(v[C].copy(k));let E=t.tr.step(new jn(e.pos-v.length,e.pos+a.nodeSize,e.pos+w,e.pos+a.nodeSize-w,new Me(k,v.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function fS(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,a=s.depth;for(;s.node(a).isInline;){if(!a)return!1;a--}return s.node(a).isTextblock?(n&&n(e.tr.setSelection(He.create(e.doc,t<0?s.start(a):s.end(a)))),!0):!1}}const AO=fS(-1),RO=fS(1);function IO(t,e=null){return function(n,r){let{$from:s,$to:a}=n.selection,o=s.blockRange(a),c=o&&Hx(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function y1(t,e=null){return function(n,r){let s=!1;for(let a=0;a{if(s)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)s=!0;else{let f=n.doc.resolve(h),m=f.index();s=f.parent.canReplaceWith(m,m+1,t)}})}if(!s)return!1;if(r){let a=n.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);a=new Qu(u,u,e.depth),e.endIndex=0;f--)a=pe.from(n[f].type.create(n[f].attrs,a));t.step(new jn(e.start-(r?2:0),e.end,e.start,e.end,new Me(a,0,0),n.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==t);return a?n?r.node(a.depth-1).type==t?_O(e,n,t,a):zO(e,n,a):!0:!1}}function _O(t,e,n,r){let s=t.tr,a=r.end,o=r.$to.end(r.depth);aj;v--)y-=s.child(v).nodeSize,r.delete(y-1,y+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==s.childCount,h=a.node(-1),f=a.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?pe.empty:pe.from(s))))return!1;let m=a.pos,g=m+o.nodeSize;return r.step(new jn(m-(c?1:0),g+(u?1:0),m+1,g-1,new Me((c?pe.empty:pe.from(s.copy(pe.empty))).append(u?pe.empty:pe.from(s.copy(pe.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function $O(t){return function(e,n){let{$from:r,$to:s}=e.selection,a=r.blockRange(s,h=>h.childCount>0&&h.firstChild.type==t);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let c=a.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=pe.from(h?t.create():null),m=new Me(pe.from(t.create(null,pe.from(c.type.create(null,f)))),h?3:1,0),g=a.start,y=a.end;n(e.tr.step(new jn(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const Rn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Zo=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Ig=null;const Us=function(t,e,n){let r=Ig||(Ig=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},FO=function(){Ig=null},Ua=function(t,e,n,r){return n&&(v1(t,e,n,r,-1)||v1(t,e,n,r,1))},BO=/^(img|br|input|textarea|hr)$/i;function v1(t,e,n,r,s){for(var a;;){if(t==n&&e==r)return!0;if(e==(s<0?0:_r(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Wc(t)||BO.test(t.nodeName)||t.contentEditable=="false")return!1;e=Rn(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((a=o.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?_r(t):0}else return!1}}function _r(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function VO(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=_r(t)}else if(t.parentNode&&!Wc(t))e=Rn(t),t=t.parentNode;else return null}}function HO(t,e){for(;;){if(t.nodeType==3&&e2),Lr=el||(Ns?/Mac/.test(Ns.platform):!1),gS=Ns?/Win/.test(Ns.platform):!1,qs=/Android \d/.test(oa),Uc=!!b1&&"webkitFontSmoothing"in b1.documentElement.style,qO=Uc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function GO(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function $s(t,e){return typeof t=="number"?t:t[e]}function JO(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function w1(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Zo(o);continue}let c=o,u=c==a.body,h=u?GO(a):JO(c),f=0,m=0;if(e.toph.bottom-$s(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+$s(s,"top")-h.top:e.bottom-h.bottom+$s(s,"bottom")),e.lefth.right-$s(r,"right")&&(f=e.right-h.right+$s(s,"right")),f||m)if(u)a.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let j=c.scrollLeft-y,w=c.scrollTop-v;e={left:e.left-j,top:e.top-w,right:e.right-j,bottom:e.bottom-w}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:Zo(o)}}function YO(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let a=(e.left+e.right)/2,o=n+1;o=n-20){r=c,s=u.top;break}}return{refDOM:r,refTop:s,stack:xS(t.dom)}}function xS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Zo(r));return e}function QO({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;yS(n,r==0?0:r-e)}function yS(t,e){for(let n=0;n=c){o=Math.max(v.bottom,o),c=Math.min(v.top,c);let j=v.left>e.left?v.left-e.left:v.right=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!u&&v.left<=e.left&&v.right>=e.left&&(u=f,h={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(a=m+1)}}return!n&&u&&(n=u,s=h,r=0),n&&n.nodeType==3?ZO(n,s):!n||r&&n.nodeType==1?{node:t,offset:a}:vS(n,s)}function ZO(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let a=0;a=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function Qx(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function eD(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,a)}function nD(t,e,n,r){let s=-1;for(let a=e,o=!1;a!=t.dom;){let c=t.docView.nearestDesc(a,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?s=c.posBefore:(!o&&u.right-1?s:t.docView.posFromDOM(e,n,-1)}function bS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&s++}let h;Uc&&s&&r.nodeType==1&&(h=r.childNodes[s-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(c=nD(t,r,s,e))}c==null&&(c=tD(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function N1(t){return t.top=0&&s==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Yl(Ii(Us(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&s&&(n<0||s==_r(r))){let u=r.childNodes[s-1];if(u.nodeType==1)return Dm(u.getBoundingClientRect(),!1)}if(a==null&&s<_r(r)){let u=r.childNodes[s];if(u.nodeType==1)return Dm(u.getBoundingClientRect(),!0)}return Dm(r.getBoundingClientRect(),n>=0)}if(a==null&&s&&(n<0||s==_r(r))){let u=r.childNodes[s-1],h=u.nodeType==3?Us(u,_r(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Yl(Ii(h,1),!1)}if(a==null&&s<_r(r)){let u=r.childNodes[s];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let h=u?u.nodeType==3?Us(u,0,o?0:1):u.nodeType==1?u:null:null;if(h)return Yl(Ii(h,-1),!0)}return Yl(Ii(r.nodeType==3?Us(r):r,-n),n>=0)}function Yl(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Dm(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function NS(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function iD(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return NS(t,e,()=>{let{node:a}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(a,!0);if(!c)break;if(c.node.isBlock){a=c.contentDOM||c.dom;break}a=c.dom.parentNode}let o=wS(t,s.pos,1);for(let c=a.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=Us(c,0,c.nodeValue.length).getClientRects();else continue;for(let h=0;hf.top+1&&(n=="up"?o.top-f.top>(f.bottom-o.top)*2:f.bottom-o.bottom>(o.bottom-f.top)*2))return!1}}return!0})}const aD=/[\u0590-\u08ac]/;function oD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,a=!s,o=s==r.parent.content.size,c=t.domSelection();return c?!aD.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?a:o:NS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:j}=t.domSelectionRange(),w=v&&!y.contains(v.nodeType==1?v:v.parentNode)||u==v&&h==j;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),w}):r.pos==r.start()||r.pos==r.end()}let j1=null,k1=null,S1=!1;function lD(t,e,n){return j1==e&&k1==n?S1:(j1=e,k1=n,S1=n=="up"||n=="down"?iD(t,e,n):oD(t,e,n))}const Fr=0,C1=1,Ra=2,js=3;class Kc{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Fr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nRn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let a=e;;a=a.parentNode){if(a==this.dom){s=!1;break}if(a.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){s=!0;break}if(a.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let a=this.getDesc(s),o;if(a&&(!n||a.node))if(r&&(o=a.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return a}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let a=this.getDesc(s);if(a)return a.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof kS){s=e-a;break}a=c}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let a;r&&!(a=this.children[r-1]).size&&a instanceof jS&&a.side>=0;r--);if(n<=0){let a,o=!0;for(;a=r?this.children[r-1]:null,!(!a||a.dom.parentNode==this.contentDOM);r--,o=!1);return a&&n&&o&&!a.border&&!a.domAtom?a.domFromPos(a.size,n):{node:this.contentDOM,offset:a?Rn(a.dom)+1:0}}else{let a,o=!0;for(;a=r=f&&n<=h-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=o;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){s=Rn(g.dom)+1;break}e-=g.size}s==-1&&(s=0)}if(s>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fv&&on){let v=c;c=u,u=v}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s=r:er){let c=r+a.border,u=o-a.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?Ra:C1,e==c&&n==u&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=js:a.markDirty(e-c,n-c);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Ra:js}r=o}this.dirty=Ra}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ra:C1;n.dirty{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)})),!n.type.spec.raw){if(o.nodeType!=1){let c=document.createElement("span");c.appendChild(o),o=c}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,a=this}matchesWidget(e){return this.dirty==Fr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class cD extends Kc{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ka extends Kc{constructor(e,n,r,s,a){super(e,[],r,s),this.mark=n,this.spec=a}static create(e,n,r,s){let a=s.nodeViews[n.type.name],o=a&&a(n,s,r);return(!o||!o.dom)&&(o=Za.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ka(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&js||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=js&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Fr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(a=_g(a,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,s),f=h&&h.dom,m=h&&h.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:m}=Za.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let g=f;return f=ES(f,r,n),h?u=new dD(e,n,r,s,f,m||null,g,h,a,o+1):n.isText?new rf(e,n,r,s,f,g,a):new Ji(e,n,r,s,f,m||null,g,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>pe.empty)}return e}matchesNode(e,n,r){return this.dirty==Fr&&e.eq(this.node)&&Zu(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,a=e.composing?this.localCompositionInfo(e,n):null,o=a&&a.pos>-1?a:null,c=a&&a.pos<0,u=new hD(this,o&&o.node,e);mD(this.node,this.innerDeco,(h,f,m)=>{h.spec.marks?u.syncToMarks(h.spec.marks,r,e,f):h.type.side>=0&&!m&&u.syncToMarks(f==this.node.childCount?Nt.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,s)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>s&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,s)||u.addNode(h,f,m,e,s),s+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Ra)&&(o&&this.protectLocalComposition(e,o),SS(this.contentDOM,this.children,e),el&&gD(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof He)||rn+this.node.content.size)return null;let a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let o=a.nodeValue,c=xD(this.node.content,o,r-n,s-n);return c<0?null:{node:a,pos:c,text:o}}else return{node:a,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let a=n;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let o=new cD(this,a,n,s);e.input.compositionNodes.push(o),this.children=_g(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==js||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Fr}updateOuterDeco(e){if(Zu(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=CS(this.dom,this.nodeDOM,Lg(this.outerDeco,this.node,n),Lg(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function E1(t,e,n,r,s){ES(r,e,t);let a=new Ji(void 0,t,e,n,r,r,r,s,0);return a.contentDOM&&a.updateChildren(s,0),a}class rf extends Ji{constructor(e,n,r,s,a,o,c){super(e,n,r,s,a,null,o,c,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==js||this.dirty!=Fr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Fr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Fr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),a=document.createTextNode(s.text);return new rf(this.parent,s,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=js)}get domAtom(){return!1}isText(e){return this.node.text==e}}class kS extends Kc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Fr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class dD extends Ji{constructor(e,n,r,s,a,o,c,u,h,f){super(e,n,r,s,a,o,c,h,f),this.spec=u}update(e,n,r,s){if(this.dirty==js)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let a=this.spec.update(e,n,r);return a&&this.updateInner(e,n,r,s),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function SS(t,e,n){let r=t.firstChild,s=!1;for(let a=0;a>1,c=Math.min(o,e.length);for(;a-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let f=Ka.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,f),this.top=f,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let a=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))a=this.top.children.indexOf(o,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c0;){let c;for(;;)if(r){let h=n.children[r-1];if(h instanceof Ka)n=h,r=h.children.length;else{c=h,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(s-1))break;--s,a.set(c,s),o.push(c)}}return{index:s,matched:a,matches:o.reverse()}}function pD(t,e){return t.type.side-e.type.side}function mD(t,e,n,r){let s=e.locals(t),a=0;if(s.length==0){for(let h=0;ha;)c.push(s[o++]);let v=a+g.nodeSize;if(g.isText){let w=v;o!w.inline):c.slice();r(g,j,e.forChild(a,g),y),a=v}}function gD(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function xD(t,e,n,r){for(let s=0,a=0;s=n){if(a>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let h=c=0&&h+e.length+c>=n)return c+h;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function _g(t,e,n,r,s){let a=[];for(let o=0,c=0;o=n||f<=e?a.push(u):(hn&&a.push(u.slice(n-h,u.size,r)))}return a}function Xx(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),a=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(nf(n)){for(u=o;s&&!s.node;)s=s.parent;let m=s.node;if(s&&m.isAtom&&Ve.isSelectable(m)&&s.parent&&!(m.isInline&&WO(n.focusNode,n.focusOffset,s.dom))){let g=s.posBefore;h=new Ve(o==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let y=0;y{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!TS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function vD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Rn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ur&&Gi<=11&&(n.disabled=!0,n.disabled=!1)}function MS(t,e){if(e instanceof Ve){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(I1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else I1(t)}function I1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Zx(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||He.between(e,n,r)}function P1(t){return t.editable&&!t.hasFocus()?!1:AS(t)}function AS(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function bD(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ua(e.node,e.offset,n.anchorNode,n.anchorOffset)}function zg(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),a=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return a&&Ge.findFrom(a,e)}function Pi(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function O1(t,e,n){let r=t.state.selection;if(r instanceof He)if(n.indexOf("s")>-1){let{$head:s}=r,a=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+a.nodeSize*(e<0?-1:1));return Pi(t,new He(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=zg(t.state,e);return s&&s instanceof Ve?Pi(t,s):!1}else if(!(Lr&&n.indexOf("m")>-1)){let s=r.$head,a=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!a||a.isText)return!1;let c=e<0?s.pos-a.nodeSize:s.pos;return a.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?Ve.isSelectable(a)?Pi(t,new Ve(e<0?t.state.doc.resolve(s.pos-a.nodeSize):s)):Uc?Pi(t,new He(t.state.doc.resolve(e<0?c:c+a.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ve&&r.node.isInline)return Pi(t,new He(e>0?r.$to:r.$from));{let s=zg(t.state,e);return s?Pi(t,s):!1}}}function eh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fc(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Oo(t,e){return e<0?wD(t):ND(t)}function wD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,a,o=!1;for($r&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(fc(c,-1))s=n,a=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(RS(n))break;{let c=n.previousSibling;for(;c&&fc(c,-1);)s=n.parentNode,a=Rn(c),c=c.previousSibling;if(c)n=c,r=eh(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?$g(t,n,r):s&&$g(t,s,a)}function ND(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=eh(n),a,o;for(;;)if(r{t.state==s&&Qs(t)},50)}function D1(t,e){let n=t.state.doc.resolve(e);if(!(Pn||gS)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let a=t.coordsAtPos(e-1),o=(a.top+a.bottom)/2;if(o>s.top&&o1)return a.lefts.top&&o1)return a.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function L1(t,e,n){let r=t.state.selection;if(r instanceof He&&!r.empty||n.indexOf("s")>-1||Lr&&n.indexOf("m")>-1)return!1;let{$from:s,$to:a}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=zg(t.state,e);if(o&&o instanceof Ve)return Pi(t,o)}if(!s.parent.inlineContent){let o=e<0?s:a,c=r instanceof kr?Ge.near(o,e):Ge.findFrom(o,e);return c?Pi(t,c):!1}return!1}function _1(t,e){if(!(t.state.selection instanceof He))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let o=t.state.tr;return e<0?o.delete(n.pos-a.nodeSize,n.pos):o.delete(n.pos,n.pos+a.nodeSize),t.dispatch(o),!0}return!1}function z1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function SD(t){if(!Hn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;z1(t,r,"true"),setTimeout(()=>z1(t,r,"false"),20)}return!1}function CD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function ED(t,e){let n=e.keyCode,r=CD(e);if(n==8||Lr&&n==72&&r=="c")return _1(t,-1)||Oo(t,-1);if(n==46&&!e.shiftKey||Lr&&n==68&&r=="c")return _1(t,1)||Oo(t,1);if(n==13||n==27)return!0;if(n==37||Lr&&n==66&&r=="c"){let s=n==37?D1(t,t.state.selection.from)=="ltr"?-1:1:-1;return O1(t,s,r)||Oo(t,s)}else if(n==39||Lr&&n==70&&r=="c"){let s=n==39?D1(t,t.state.selection.from)=="ltr"?1:-1:1;return O1(t,s,r)||Oo(t,s)}else{if(n==38||Lr&&n==80&&r=="c")return L1(t,-1,r)||Oo(t,-1);if(n==40||Lr&&n==78&&r=="c")return SD(t)||L1(t,1,r)||Oo(t,1);if(r==(Lr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function e0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:s,openEnd:a}=e;for(;s>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,a--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let o=t.someProp("clipboardSerializer")||Za.fromSchema(t.state.schema),c=_S(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=LS[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let v=c.createElement(f[y]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${s} ${a}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,` + +`);return{dom:u,text:g,slice:e}}function IS(t,e,n,r,s){let a=s.parent.type.spec.code,o,c;if(!n&&!e)return null;let u=!!e&&(r||a||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,a||r,t)}),a)return c=new Me(pe.from(t.state.schema.text(e.replace(/\r\n?/g,` +`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,s,r,t));if(m)c=m;else{let g=s.marks(),{schema:y}=t.state,v=Za.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(j=>{let w=o.appendChild(document.createElement("p"));j&&w.appendChild(v.serializeNode(y.text(j,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=RD(n),Uc&&ID(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||qi.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:s,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!TD.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=PD($1(c,+f[1],+f[2]),f[4]);else if(c=Me.maxOpen(MD(c.content,s),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const TD=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function MD(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),a,o=[];if(t.forEach(c=>{if(!o)return;let u=s.findWrapping(c.type),h;if(!u)return o=null;if(h=o.length&&a.length&&OS(u,a,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=DS(o[o.length-1],a.length));let f=PS(c,u);o.push(f),s=s.matchType(f.type),a=u}}),o)return pe.from(o)}return t}function PS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,pe.from(t));return t}function OS(t,e,n,r,s){if(s1&&(a=0),s=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,a<=s).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(pe.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function $1(t,e,n){return en})),_m.createHTML(t)):t}function RD(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=_S().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&LS[r[1].toLowerCase()])&&(t=s.map(a=>"<"+a+">").join("")+t+s.map(a=>"").reverse().join("")),n.innerHTML=AD(t),s)for(let a=0;a=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;s=pe.from(u.create(r[c+1],s)),a++,o++}return new Me(s,a,o)}const tr={},nr={},OD={touchstart:!0,touchmove:!0};class DD{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function LD(t){for(let e in tr){let n=tr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{zD(t,r)&&!t0(t,r)&&(t.editable||!(r.type in nr))&&n(t,r)},OD[e]?{passive:!0}:void 0)}Hn&&t.dom.addEventListener("input",()=>null),Bg(t)}function Hi(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function _D(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Bg(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>t0(t,r))})}function t0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function zD(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function $D(t,e){!t0(t,e)&&tr[e.type]&&(t.editable||!(e.type in nr))&&tr[e.type](t,e)}nr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!$S(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(qs&&Pn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),el&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,Ma(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||ED(t,n)?n.preventDefault():Hi(t,"key")};nr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};nr.keypress=(t,e)=>{let n=e;if($S(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Lr&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof He)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),a=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,a))&&t.dispatch(a()),n.preventDefault()}};function sf(t){return{left:t.clientX,top:t.clientY}}function FD(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function n0(t,e,n,r,s){if(r==-1)return!1;let a=t.state.doc.resolve(r);for(let o=a.depth+1;o>0;o--)if(t.someProp(e,c=>o>a.depth?c(t,n,a.nodeAfter,a.before(o),s,!0):c(t,n,a.node(o),a.before(o),s,!1)))return!0;return!1}function qo(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function BD(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ve.isSelectable(r)?(qo(t,new Ve(n)),!0):!1}function VD(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof Ve&&(r=n.node);let a=t.state.doc.resolve(e);for(let o=a.depth+1;o>0;o--){let c=o>a.depth?a.nodeAfter:a.node(o);if(Ve.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?s=a.before(n.$from.depth):s=a.before(o);break}}return s!=null?(qo(t,Ve.create(t.state.doc,s)),!0):!1}function HD(t,e,n,r,s){return n0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",a=>a(t,e,r))||(s?VD(t,n):BD(t,n))}function WD(t,e,n,r){return n0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function UD(t,e,n,r){return n0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||KD(t,n,r)}function KD(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(qo(t,He.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let a=s.depth+1;a>0;a--){let o=a>s.depth?s.nodeAfter:s.node(a),c=s.before(a);if(o.inlineContent)qo(t,He.create(r,c+1,c+1+o.content.size));else if(Ve.isSelectable(o))qo(t,Ve.create(r,c));else continue;return!0}}function r0(t){return th(t)}const zS=Lr?"metaKey":"ctrlKey";tr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=r0(t),s=Date.now(),a="singleClick";s-t.input.lastClick.time<500&&FD(n,t.input.lastClick)&&!n[zS]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=t.posAtCoords(sf(n));o&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new qD(t,o,n,!!r)):(a=="doubleClick"?WD:UD)(t,o.pos,o.inside,n)?n.preventDefault():Hi(t,"pointer"))};class qD{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[zS],this.allowDefault=r.shiftKey;let a,o;if(n.inside>-1)a=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);a=f.parent,o=f.depth?f.before():0}const c=s?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&a.type.spec.draggable&&a.type.spec.selectable!==!1||h instanceof Ve&&h.from<=o&&h.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&$r&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Hi(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Qs(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(sf(e))),this.updateAllowDefault(e),this.allowDefault||!n?Hi(this.view,"pointer"):HD(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Hn&&this.mightDrag&&!this.mightDrag.node.isAtom||Pn&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(qo(this.view,Ge.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Hi(this.view,"pointer")}move(e){this.updateAllowDefault(e),Hi(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}tr.touchstart=t=>{t.input.lastTouch=Date.now(),r0(t),Hi(t,"pointer")};tr.touchmove=t=>{t.input.lastTouch=Date.now(),Hi(t,"pointer")};tr.contextmenu=t=>r0(t);function $S(t,e){return t.composing?!0:Hn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const GD=qs?5e3:-1;nr.compositionstart=nr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof He&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Pn&&gS&&JD(t)))t.markCursor=t.state.storedMarks||n.marks(),th(t,!0),t.markCursor=null;else if(th(t,!e.selection.empty),$r&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,a=r.focusOffset;s&&s.nodeType==1&&a!=0;){let o=a<0?s.lastChild:s.childNodes[a-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else s=o,a=-1}}t.input.composing=!0}FS(t,GD)};function JD(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}nr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,FS(t,20))};function FS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>th(t),e))}function BS(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=QD());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function YD(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=VO(e.focusNode,e.focusOffset),r=HO(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,a=t.domObserver.lastChangedTextNode;if(n==a||r==a)return a;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function QD(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function th(t,e=!1){if(!(qs&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),BS(t),e||t.docView&&t.docView.dirty){let n=Xx(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function XD(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Ac=ur&&Gi<15||el&&qO<604;tr.copy=nr.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let a=Ac?null:n.clipboardData,o=r.content(),{dom:c,text:u}=e0(t,o);a?(n.preventDefault(),a.clearData(),a.setData("text/html",c.innerHTML),a.setData("text/plain",u)):XD(t,c),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ZD(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function eL(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Rc(t,r.value,null,s,e):Rc(t,r.textContent,r.innerHTML,s,e)},50)}function Rc(t,e,n,r,s){let a=IS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,s,a||Me.empty)))return!0;if(!a)return!1;let o=ZD(a),c=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(a);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function VS(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}nr.paste=(t,e)=>{let n=e;if(t.composing&&!qs)return;let r=Ac?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Rc(t,VS(r),r.getData("text/html"),s,n)?n.preventDefault():eL(t,n)};class HS{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const tL=Lr?"altKey":"ctrlKey";function WS(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[tL]}tr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,a=s.empty?null:t.posAtCoords(sf(n)),o;if(!(a&&a.pos>=s.from&&a.pos<=(s instanceof Ve?s.to-1:s.to))){if(r&&r.mightDrag)o=Ve.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=Ve.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=e0(t,c);(!n.dataTransfer.files.length||!Pn||mS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Ac?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Ac||n.dataTransfer.setData("text/plain",h),t.dragging=new HS(f,WS(t,n),o)};tr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};nr.dragover=nr.dragenter=(t,e)=>e.preventDefault();nr.drop=(t,e)=>{try{nL(t,e,t.dragging)}finally{t.dragging=null}};function nL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(sf(e));if(!r)return;let s=t.state.doc.resolve(r.pos),a=n&&n.slice;a?t.someProp("transformPasted",y=>{a=y(a,t,!1)}):a=IS(t,VS(e.dataTransfer),Ac?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&WS(t,e));if(t.someProp("handleDrop",y=>y(t,e,a||Me.empty,o))){e.preventDefault();return}if(!a)return;e.preventDefault();let c=a?Gk(t.state.doc,s.pos,a):s.pos;c==null&&(c=s.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,a.content.firstChild):u.replaceRange(h,h,a),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&Ve.isSelectable(a.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(a.content.firstChild))u.setSelection(new Ve(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,j,w,k)=>y=k),u.setSelection(Zx(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}tr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Qs(t)},20))};tr.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};tr.beforeinput=(t,e)=>{if(Pn&&qs&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",a=>a(t,Ma(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in nr)tr[t]=nr[t];function Ic(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class nh{constructor(e,n){this.toDOM=e,this.spec=n||za,this.side=this.spec.side||0}map(e,n,r,s){let{pos:a,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new hn(a-r,a-r,this)}valid(){return!0}eq(e){return this==e||e instanceof nh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ic(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Yi{constructor(e,n){this.attrs=e,this.spec=n||za}map(e,n,r,s){let a=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return a>=o?null:new hn(a,o,this)}valid(e,n){return n.from=e&&(!a||a(c.spec))&&r.push(c.copy(c.from+s,c.to+s))}for(let o=0;oe){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,s+c,a)}}map(e,n,r){return this==Bn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||za)}mapInner(e,n,r,s,a){let o;for(let c=0;c{let h=u+r,f;if(f=KS(n,c,h)){for(s||(s=this.children.slice());ac&&m.to=e){this.children[c]==e&&(r=this.children[c+2]);break}let a=e+1,o=a+n.content.size;for(let c=0;ca&&u.type instanceof Yi){let h=Math.max(a,u.from)-a,f=Math.min(o,u.to)-a;hs.map(e,n,za));return Li.from(r)}forChild(e,n){if(n.isLeaf)return wt.empty;let r=[];for(let s=0;sn instanceof wt)?e:e.reduce((n,r)=>n.concat(r instanceof wt?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let w=j-v-(y-g);for(let k=0;kE+f-m)continue;let C=c[k]+f-m;y>=C?c[k+1]=g<=C?-2:-1:g>=f&&w&&(c[k]+=w,c[k+1]+=w)}m+=w}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let g=n.map(t[h+1]+a,-1),y=g-s,{index:v,offset:j}=r.content.findIndex(m),w=r.maybeChild(v);if(w&&j==m&&j+w.nodeSize==y){let k=c[h+2].mapInner(n,w,f+1,t[h]+a+1,o);k!=Bn?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=sL(c,t,e,n,s,a,o),f=rh(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=KS(t,c,u+n);if(h){a=!0;let f=rh(h,c,n+u+1,r);f!=Bn&&s.push(u,u+c.nodeSize,f)}});let o=US(a?qS(t):t,-n).sort($a);for(let c=0;c0;)e++;t.splice(e,0,n)}function zm(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Bn&&e.push(r)}),t.cursorWrapper&&e.push(wt.create(t.state.doc,[t.cursorWrapper.deco])),Li.from(e)}const iL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},aL=ur&&Gi<=11;class oL{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class lL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new oL,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;ss.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Hn&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),aL&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,iL)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(P1(this.view)){if(this.suppressingSelectionUpdates)return Qs(this.view);if(ur&&Gi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ua(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let a=e.focusNode;a;a=Zo(a))n.add(a);for(let a=e.anchorNode;a;a=Zo(a))if(n.has(a)){r=a;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&P1(e)&&!this.ignoreSelectionChange(r),a=-1,o=-1,c=!1,u=[];if(e.editable)for(let f=0;ff.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let m=f.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&f.parentNode.removeChild(f)}}else if($r&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||uL(e,m)!=y)&&g.remove()}}}let h=null;a<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||s)&&(a>-1&&(e.docView.markDirty(a,o),cL(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,hL(e,u)),this.handleDOMChange(a,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Qs(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fs;w--){let k=r.childNodes[w-1],E=k.pmViewDesc;if(k.nodeName=="BR"&&!E){a=w;break}if(!E||E.size)break}let m=t.state.doc,g=t.someProp("domParser")||qi.fromSchema(t.state.schema),y=m.resolve(o),v=null,j=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:s,to:a,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:pL,context:y});if(h&&h[0].pos!=null){let w=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=w),v={anchor:w+o,head:k+o}}return{doc:j,sel:v,from:o,to:c}}function pL(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Hn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Hn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const mL=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function gL(t,e,n,r,s){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let R=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,I=Xx(t,R);if(I&&!t.state.selection.eq(I)){if(Pn&&qs&&t.input.lastKeyCode===13&&Date.now()-100O(t,Ma(13,"Enter"))))return;let A=t.state.tr.setSelection(I);R=="pointer"?A.setMeta("pointer",!0):R=="key"&&A.scrollIntoView(),a&&A.setMeta("composition",a),t.dispatch(A)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=fL(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,y;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||qs)&&s.some(R=>R.nodeType==1&&!mL.test(R.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",R=>R(t,Ma(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof He&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let R=U1(t,t.state.doc,h.sel);if(R&&!R.eq(t.state.selection)){let I=t.state.tr.setSelection(R);a&&I.setMeta("composition",a),t.dispatch(I)}}return}t.state.selection.fromt.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?v.start=t.state.selection.from:v.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),ur&&Gi<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>h.from&&h.doc.textBetween(v.start-h.from-1,v.start-h.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let j=h.doc.resolveNoCache(v.start-h.from),w=h.doc.resolveNoCache(v.endB-h.from),k=f.resolve(v.start),E=j.sameParent(w)&&j.parent.inlineContent&&k.end()>=v.endA;if((el&&t.input.lastIOSEnter>Date.now()-225&&(!E||s.some(R=>R.nodeName=="DIV"||R.nodeName=="P"))||!E&&j.posR(t,Ma(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&yL(f,v.start,v.endA,j,w)&&t.someProp("handleKeyDown",R=>R(t,Ma(8,"Backspace")))){qs&&Pn&&t.domObserver.suppressSelectionUpdates();return}Pn&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),qs&&!E&&j.start()!=w.start()&&w.parentOffset==0&&j.depth==w.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==v.endA&&(v.endB-=2,w=h.doc.resolveNoCache(v.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(R){return R(t,Ma(13,"Enter"))})},20));let C=v.start,M=v.endA,D=R=>{let I=R||t.state.tr.replace(C,M,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let A=U1(t,I.doc,h.sel);A&&!(Pn&&t.composing&&A.empty&&(v.start!=v.endB||t.input.lastChromeDeleteQs(t),20));let R=D(t.state.tr.delete(C,M)),I=f.resolve(v.start).marksAcross(f.resolve(v.endA));I&&R.ensureMarks(I),t.dispatch(R)}else if(v.endA==v.endB&&(F=xL(j.parent.content.cut(j.parentOffset,w.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start())))){let R=D(t.state.tr);F.type=="add"?R.addMark(C,M,F.mark):R.removeMark(C,M,F.mark),t.dispatch(R)}else if(j.parent.child(j.index()).isText&&j.index()==w.index()-(w.textOffset?0:1)){let R=j.parent.textBetween(j.parentOffset,w.parentOffset),I=()=>D(t.state.tr.insertText(R,C,M));t.someProp("handleTextInput",A=>A(t,C,M,R,I))||t.dispatch(I())}else t.dispatch(D());else t.dispatch(D())}function U1(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Zx(t,e.resolve(n.anchor),e.resolve(n.head))}function xL(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,a=r,o,c,u;for(let f=0;ff.mark(c.addToSet(f.marks));else if(s.length==0&&a.length==1)c=a[0],o="remove",u=f=>f.mark(c.removeFromSet(f.marks));else return null;let h=[];for(let f=0;fn||$m(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let a=t.node(r).maybeChild(t.indexAfter(r));for(;a&&!a.isLeaf;)a=a.firstChild,s++}return s}function vL(t,e,n,r,s){let a=t.findDiffStart(e,n);if(a==null)return null;let{a:o,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let u=Math.max(0,a-Math.min(o,c));r-=o+u-a}if(o=o?a-r:0;a-=u,a&&a=c?a-r:0;a-=u,a&&a=56320&&e<=57343&&n>=55296&&n<=56319}class GS{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new DD,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Q1),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=J1(this),G1(this),this.nodeViews=Y1(this),this.docView=E1(this.state.doc,q1(this),zm(this),this.dom,this),this.domObserver=new lL(this,(r,s,a,o)=>gL(this,r,s,a,o)),this.domObserver.start(),LD(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Bg(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Q1),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,a=!1,o=!1;e.storedMarks&&this.composing&&(BS(this),o=!0),this.state=e;let c=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=Y1(this);wL(y,this.nodeViews)&&(this.nodeViews=y,a=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Bg(this),this.editable=J1(this),G1(this);let u=zm(this),h=q1(this),f=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",m=a||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(s.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&YO(this);if(o){this.domObserver.stop();let y=m&&(ur||Pn)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&bL(s.selection,e.selection);if(m){let v=Pn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=YD(this)),(a||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=E1(e.doc,h,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&bD(this))?Qs(this,y):(MS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&QO(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ve){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&w1(this,n.getBoundingClientRect(),e)}else w1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(a))==r.node&&(s=a)}this.dragging=new HS(e.slice,e.move,s<0?void 0:Ve.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return rD(this,e)}coordsAtPos(e,n=1){return wS(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return lD(this,n||this.state,e)}pasteHTML(e,n){return Rc(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Rc(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return e0(this,e)}destroy(){this.docView&&(_D(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],zm(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,FO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return $D(this,e)}domSelectionRange(){let e=this.domSelection();return e?Hn&&this.root.nodeType===11&&UO(this.dom.ownerDocument)==this.dom&&dL(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}GS.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function q1(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[hn.node(0,t.state.doc.content.size,e)]}function G1(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:hn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function J1(t){return!t.someProp("editable",e=>e(t.state)===!1)}function bL(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Y1(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function wL(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function Q1(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Xi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},sh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},NL=typeof navigator<"u"&&/Mac/.test(navigator.platform),jL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var In=0;In<10;In++)Xi[48+In]=Xi[96+In]=String(In);for(var In=1;In<=24;In++)Xi[In+111]="F"+In;for(var In=65;In<=90;In++)Xi[In]=String.fromCharCode(In+32),sh[In]=String.fromCharCode(In);for(var Fm in Xi)sh.hasOwnProperty(Fm)||(sh[Fm]=Xi[Fm]);function kL(t){var e=NL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||jL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?sh:Xi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const SL=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),CL=typeof navigator<"u"&&/Win/.test(navigator.platform);function EL(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,a,o;for(let c=0;c{for(var n in e)AL(t,n,{get:e[n],enumerable:!0})};function af(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:a}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return a},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,a=n.storedMarks,n}}}var of=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,a=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(a);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:a}=r,o=[],c=!!t,u=t||s.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...v)=>{const j=this.buildProps(u,e),w=g(...v)(j);return o.push(w),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,a=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...a,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:a}=r,o={tr:t,editor:r,view:a,state:af({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...h)=>u(...h)(o)]))}};return o}},JS={};o0(JS,{blur:()=>RL,clearContent:()=>IL,clearNodes:()=>PL,command:()=>OL,createParagraphNear:()=>DL,cut:()=>LL,deleteCurrentNode:()=>_L,deleteNode:()=>zL,deleteRange:()=>$L,deleteSelection:()=>FL,enter:()=>BL,exitCode:()=>VL,extendMarkRange:()=>HL,first:()=>WL,focus:()=>KL,forEach:()=>qL,insertContent:()=>GL,insertContentAt:()=>QL,joinBackward:()=>e8,joinDown:()=>ZL,joinForward:()=>t8,joinItemBackward:()=>n8,joinItemForward:()=>r8,joinTextblockBackward:()=>s8,joinTextblockForward:()=>i8,joinUp:()=>XL,keyboardShortcut:()=>o8,lift:()=>l8,liftEmptyBlock:()=>c8,liftListItem:()=>d8,newlineInCode:()=>u8,resetAttributes:()=>h8,scrollIntoView:()=>f8,selectAll:()=>p8,selectNodeBackward:()=>m8,selectNodeForward:()=>g8,selectParentNode:()=>x8,selectTextblockEnd:()=>y8,selectTextblockStart:()=>v8,setContent:()=>b8,setMark:()=>F8,setMeta:()=>B8,setNode:()=>V8,setNodeSelection:()=>H8,setTextDirection:()=>W8,setTextSelection:()=>U8,sinkListItem:()=>K8,splitBlock:()=>q8,splitListItem:()=>G8,toggleList:()=>J8,toggleMark:()=>Y8,toggleNode:()=>Q8,toggleWrap:()=>X8,undoInputRule:()=>Z8,unsetAllMarks:()=>e6,unsetMark:()=>t6,unsetTextDirection:()=>n6,updateAttributes:()=>r6,wrapIn:()=>s6,wrapInList:()=>i6});var RL=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),IL=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),PL=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:a,$to:o})=>{t.doc.nodesBetween(a.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const v=hl(y);if(c.type.isTextblock){const{defaultType:j}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,j)}(v||v===0)&&e.lift(y,v)})}),!0},OL=t=>e=>t(e),DL=()=>({state:t,dispatch:e})=>dS(t,e),LL=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,a=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,a.content),r.setSelection(new He(r.doc.resolve(Math.max(o-1,0)))),!0},_L=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let a=s.depth;a>0;a-=1)if(s.node(a).type===r.type){if(e){const c=s.before(a),u=s.after(a);t.delete(c,u).scrollIntoView()}return!0}return!1};function ln(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var zL=t=>({tr:e,state:n,dispatch:r})=>{const s=ln(t,n.schema),a=e.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===s){if(r){const u=a.before(o),h=a.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},$L=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},FL=()=>({state:t,dispatch:e})=>Kx(t,e),BL=()=>({commands:t})=>t.keyboardShortcut("Enter"),VL=()=>({state:t,dispatch:e})=>SO(t,e);function l0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ih(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:l0(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function YS(t,e,n={}){return t.find(r=>r.type===e&&ih(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function X1(t,e,n={}){return!!YS(t,e,n)}function c0(t,e,n){var r;if(!t||!e)return;let s=t.parent.childAfter(t.parentOffset);if((!s.node||!s.node.marks.some(f=>f.type===e))&&(s=t.parent.childBefore(t.parentOffset)),!s.node||!s.node.marks.some(f=>f.type===e)||(n=n||((r=s.node.marks[0])==null?void 0:r.attrs),!YS([...s.node.marks],e,n)))return;let o=s.index,c=t.start()+s.offset,u=o+1,h=c+s.node.nodeSize;for(;o>0&&X1([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:r,dispatch:s})=>{const a=ni(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(s){const m=c0(u,a,e);if(m&&m.from<=h&&m.to>=f){const g=He.create(o,m.from,m.to);n.setSelection(g)}}return!0},WL=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:s,dispatch:a})=>{e={scrollIntoView:!0,...e};const o=()=>{(ah()||Z1())&&r.dom.focus(),UL()&&!ah()&&!Z1()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(a&&t===null&&!QS(n.state.selection))return o(),!0;const c=XS(s.doc,t)||n.state.selection,u=n.state.selection.eq(c);return a&&(u||s.setSelection(c),u&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},qL=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),GL=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),ZS=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&ZS(r)}return t};function gu(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return ZS(n)}function Pc(t,e,n){if(t instanceof Js||t instanceof pe)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return pe.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(a){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",a),Pc("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,c="";const u=new _k({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(o=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(n.slice?qi.fromSchema(u).parseSlice(gu(t),n.parseOptions):qi.fromSchema(u).parse(gu(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const a=qi.fromSchema(e);return n.slice?a.parseSlice(gu(t),n.parseOptions).content:a.parse(gu(t),n.parseOptions)}return Pc("",e,n)}function JL(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(Ge.near(t.doc.resolve(o),n))}var YL=t=>!("type"in t),QL=(t,e,n)=>({tr:r,dispatch:s,editor:a})=>{var o;if(s){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=w=>{a.emit("contentError",{editor:a,error:w,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{Pc(e,a.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(w){u(w)}try{c=Pc(e,a.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:a.options.enableContentCheck})}catch(w){return u(w),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((YL(c)?c:[c]).forEach(w=>{w.check(),g=g?w.isText&&w.marks.length===0:!1,y=y?w.isBlock:!1}),f===m&&y){const{parent:w}=r.doc.resolve(f);w.isTextblock&&!w.type.spec.code&&!w.childCount&&(f-=1,m+=1)}let j;if(g){if(Array.isArray(e))j=e.map(w=>w.text||"").join("");else if(e instanceof pe){let w="";e.forEach(k=>{k.text&&(w+=k.text)}),j=w}else typeof e=="object"&&e&&e.text?j=e.text:j=e;r.insertText(j,f,m)}else{j=c;const w=r.doc.resolve(f),k=w.node(),E=w.parentOffset===0,C=k.isText||k.isTextblock,M=k.content.size>0;E&&C&&M&&(f=Math.max(0,f-1)),r.replaceWith(f,m,j)}n.updateSelection&&JL(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:j}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:j})}return!0},XL=()=>({state:t,dispatch:e})=>NO(t,e),ZL=()=>({state:t,dispatch:e})=>jO(t,e),e8=()=>({state:t,dispatch:e})=>rS(t,e),t8=()=>({state:t,dispatch:e})=>oS(t,e),n8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Zh(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},r8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Zh(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},s8=()=>({state:t,dispatch:e})=>bO(t,e),i8=()=>({state:t,dispatch:e})=>wO(t,e);function eC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function a8(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,a,o;for(let c=0;c({editor:e,view:n,tr:r,dispatch:s})=>{const a=a8(t).split(/-(?!$)/),o=a.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",h=>h(n,c))});return u==null||u.steps.forEach(h=>{const f=h.map(r.mapping);f&&s&&r.maybeStep(f)}),!0};function Zi(t,e,n={}){const{from:r,to:s,empty:a}=t.selection,o=e?ln(e,t.schema):null,c=[];t.doc.nodesBetween(r,s,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),v=Math.min(s,g+m.nodeSize);c.push({node:m,from:y,to:v})});const u=s-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>ih(m.node.attrs,n,{strict:!1}));return a?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var l8=(t,e={})=>({state:n,dispatch:r})=>{const s=ln(t,n.schema);return Zi(n,s,e)?kO(n,r):!1},c8=()=>({state:t,dispatch:e})=>uS(t,e),d8=t=>({state:e,dispatch:n})=>{const r=ln(t,e.schema);return LO(r)(e,n)},u8=()=>({state:t,dispatch:e})=>cS(t,e);function lf(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ew(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var h8=(t,e)=>({tr:n,state:r,dispatch:s})=>{let a=null,o=null;const c=lf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(a=ln(t,r.schema)),c==="mark"&&(o=ni(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{r.doc.nodesBetween(h.$from.pos,h.$to.pos,(f,m)=>{a&&a===f.type&&(u=!0,s&&n.setNodeMarkup(m,void 0,ew(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,s&&n.addMark(m,m+f.nodeSize,o.create(ew(g.attrs,e))))})})}),u},f8=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),p8=()=>({tr:t,dispatch:e})=>{if(e){const n=new kr(t.doc);t.setSelection(n)}return!0},m8=()=>({state:t,dispatch:e})=>iS(t,e),g8=()=>({state:t,dispatch:e})=>lS(t,e),x8=()=>({state:t,dispatch:e})=>TO(t,e),y8=()=>({state:t,dispatch:e})=>RO(t,e),v8=()=>({state:t,dispatch:e})=>AO(t,e);function Vg(t,e,n={},r={}){return Pc(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var b8=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:a,dispatch:o,commands:c})=>{const{doc:u}=a;if(r.preserveWhitespace!=="full"){const h=Vg(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&a.replaceWith(0,u.content.size,h).setMeta("preventUpdate",!n),!0}return o&&a.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function tC(t,e){const n=ni(e,t.schema),{from:r,to:s,empty:a}=t.selection,o=[];a?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function nC(t,e){const n=new Wx(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function w8(t){for(let e=0;e{n(s)&&r.push({node:s,pos:a})}),r}function rC(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function cf(t){return e=>rC(e.$from,t)}function $e(t,e,n){return t.config[e]===void 0&&t.parent?$e(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?$e(t.parent,e,n):null}):t.config[e]}function d0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=$e(e,"addExtensions",n);return r?[e,...d0(r())]:e}).flat(10)}function u0(t,e){const n=Za.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function sC(t){return typeof t=="function"}function pt(t,e=void 0,...n){return sC(t)?e?t.bind(e)(...n):t(...n):t}function j8(t={}){return Object.keys(t).length===0&&t.constructor===Object}function tl(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function iC(t){const e=[],{nodeExtensions:n,markExtensions:r}=tl(t),s=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(h=>h.name!=="text").map(h=>h.name),c=r.map(h=>h.name),u=[...o,...c];return t.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage,extensions:s},m=$e(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let v;Array.isArray(y.types)?v=y.types:y.types==="*"?v=u:y.types==="nodes"?v=o:y.types==="marks"?v=c:v=[],v.forEach(j=>{Object.entries(y.attributes).forEach(([w,k])=>{e.push({type:j,name:w,attribute:{...a,...k}})})})})}),s.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=$e(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([y,v])=>{const j={...a,...v};typeof(j==null?void 0:j.default)=="function"&&(j.default=j.default()),j!=null&&j.isRequired&&(j==null?void 0:j.default)===void 0&&delete j.default,e.push({type:h.name,name:y,attribute:j})})}),e}function k8(t){const e=[];let n="",r=!1,s=!1,a=0;const o=t.length;for(let c=0;c0){a-=1,n+=u;continue}if(u===";"&&a===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function tw(t){const e=[],n=k8(t||""),r=n.length;for(let s=0;s!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,a])=>{if(!r[s]){r[s]=a;return}if(s==="class"){const c=a?String(a).split(" "):[],u=r[s]?r[s].split(" "):[],h=c.filter(f=>!u.includes(f));r[s]=[...u,...h].join(" ")}else if(s==="style"){const c=new Map([...tw(r[s]),...tw(a)]);r[s]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[s]=a}),r},{})}function Oc(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>vt(n,r),{})}function S8(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function nw(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((a,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):S8(n.getAttribute(o.name));return c==null?a:{...a,[o.name]:c}},{});return{...r,...s}}}}function rw(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&j8(n)?!1:n!=null))}function sw(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function C8(t,e){var n;const r=iC(t),{nodeExtensions:s,markExtensions:a}=tl(t),o=(n=s.find(h=>$e(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(s.map(h=>{const f=r.filter(k=>k.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((k,E)=>{const C=$e(E,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),y=rw({...g,content:pt($e(h,"content",m)),marks:pt($e(h,"marks",m)),group:pt($e(h,"group",m)),inline:pt($e(h,"inline",m)),atom:pt($e(h,"atom",m)),selectable:pt($e(h,"selectable",m)),draggable:pt($e(h,"draggable",m)),code:pt($e(h,"code",m)),whitespace:pt($e(h,"whitespace",m)),linebreakReplacement:pt($e(h,"linebreakReplacement",m)),defining:pt($e(h,"defining",m)),isolating:pt($e(h,"isolating",m)),attrs:Object.fromEntries(f.map(sw))}),v=pt($e(h,"parseHTML",m));v&&(y.parseDOM=v.map(k=>nw(k,f)));const j=$e(h,"renderHTML",m);j&&(y.toDOM=k=>j({node:k,HTMLAttributes:Oc(k,f)}));const w=$e(h,"renderText",m);return w&&(y.toText=w),[h.name,y]})),u=Object.fromEntries(a.map(h=>{const f=r.filter(w=>w.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((w,k)=>{const E=$e(k,"extendMarkSchema",m);return{...w,...E?E(h):{}}},{}),y=rw({...g,inclusive:pt($e(h,"inclusive",m)),excludes:pt($e(h,"excludes",m)),group:pt($e(h,"group",m)),spanning:pt($e(h,"spanning",m)),code:pt($e(h,"code",m)),attrs:Object.fromEntries(f.map(sw))}),v=pt($e(h,"parseHTML",m));v&&(y.parseDOM=v.map(w=>nw(w,f)));const j=$e(h,"renderHTML",m);return j&&(y.toDOM=w=>j({mark:w,HTMLAttributes:Oc(w,f)})),[h.name,y]}));return new _k({topNode:o,nodes:c,marks:u})}function E8(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function pc(t){return t.sort((n,r)=>{const s=$e(n,"priority")||100,a=$e(r,"priority")||100;return s>a?-1:sr.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function oC(t,e,n){const{from:r,to:s}=e,{blockSeparator:a=` + +`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,s,(u,h,f,m)=>{var g;u.isBlock&&h>r&&(c+=a);const y=o==null?void 0:o[u.type.name];if(y)return f&&(c+=y({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(r,h)-h,s-h))}),c}function T8(t,e){const n={from:0,to:t.content.size};return oC(t,n,e)}function lC(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function M8(t,e){const n=ln(e,t.schema),{from:r,to:s}=t.selection,a=[];t.doc.nodesBetween(r,s,c=>{a.push(c)});const o=a.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function cC(t,e){const n=lf(typeof e=="string"?e:e.name,t.schema);return n==="node"?M8(t,e):n==="mark"?tC(t,e):{}}function A8(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function R8(t){const e=A8(t);return e.length===1?e:e.filter((n,r)=>!e.filter((a,o)=>o!==r).some(a=>n.oldRange.from>=a.oldRange.from&&n.oldRange.to<=a.oldRange.to&&n.newRange.from>=a.newRange.from&&n.newRange.to<=a.newRange.to))}function dC(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,a)=>{const o=[];if(s.ranges.length)s.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[a];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const h=e.slice(a).map(c,-1),f=e.slice(a).map(u),m=e.invert().map(h,-1),g=e.invert().map(f);r.push({oldRange:{from:m,to:g},newRange:{from:h,to:f}})})}),R8(r)}function h0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const a=n.resolve(t),o=c0(a,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,a)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:a,to:a+s.nodeSize,mark:o})))}),r}var I8=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let a=r,o=null;for(;a>0&&o===null;){const c=s.node(a);(c==null?void 0:c.type.name)===e?o=c:a-=1}return[o,a]};function Ql(t,e){return e.nodes[t]||e.marks[t]||null}function Ou(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(a=>a.type===e&&a.name===r);return s?s.attribute.keepOnSplit:!1}))}var P8=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,a,o,c)=>{var u,h;const f=((h=(u=s.type.spec).toText)==null?void 0:h.call(u,{node:s,pos:a,parent:o,index:c}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?f:f.slice(0,Math.max(0,r-a))}),n};function Hg(t,e,n={}){const{empty:r,ranges:s}=t.selection,a=e?ni(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>a?a.name===m.type.name:!0).find(m=>ih(m.attrs,n,{strict:!1}));let o=0;const c=[];if(s.forEach(({$from:m,$to:g})=>{const y=m.pos,v=g.pos;t.doc.nodesBetween(y,v,(j,w)=>{if(a&&j.inlineContent&&!j.type.allowsMarkType(a))return!1;if(!j.isText&&!j.marks.length)return;const k=Math.max(y,w),E=Math.min(v,w+j.nodeSize),C=E-k;o+=C,c.push(...j.marks.map(M=>({mark:M,from:k,to:E})))})}),o===0)return!1;const u=c.filter(m=>a?a.name===m.mark.type.name:!0).filter(m=>ih(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),h=c.filter(m=>a?m.mark.type!==a&&m.mark.type.excludes(a):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+h:u)>=o}function O8(t,e,n={}){if(!e)return Zi(t,null,n)||Hg(t,null,n);const r=lf(e,t.schema);return r==="node"?Zi(t,e,n):r==="mark"?Hg(t,e,n):!1}var D8=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const a=cf(c=>c.type.name===e)(t.selection);if(!a)return!1;const o=t.doc.resolve(a.pos+1);return s.pos+1===o.end()}return!(r.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function iw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function aw(t,e){const{nodeExtensions:n}=tl(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},a=pt($e(r,"group",s));return typeof a!="string"?!1:a.split(" ").includes("list")}function df(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(a=>{s!==!1&&(df(a,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function uC(t){return t instanceof Ve}var hC=class fC{constructor(e){this.position=e}static fromJSON(e){return new fC(e.position)}toJSON(){return{position:this.position}}};function _8(t,e){const n=e.mapping.mapResult(t.position);return{position:new hC(n.pos),mapResult:n}}function z8(t){return new hC(t)}function $8(t,e,n){var r;const{selection:s}=e;let a=null;if(QS(s)&&(a=s.$cursor),a){const c=(r=t.storedMarks)!=null?r:a.marks();return a.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(h=>h.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:c,$to:u})=>{let h=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(f,m,g)=>{if(h)return!1;if(f.isInline){const y=!g||g.type.allowsMarkType(n),v=!!n.isInSet(f.marks)||!f.marks.some(j=>j.type.excludes(n));h=y&&v}return!h}),h})}var F8=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:a}=n,{empty:o,ranges:c}=a,u=ni(t,r.schema);if(s)if(o){const h=tC(r,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(f,m,(g,y)=>{const v=Math.max(y,f),j=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(v,j,u.create({...k.attrs,...e}))}):n.addMark(v,j,u.create(e))})});return $8(r,n,u)},B8=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),V8=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const a=ln(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?s().command(({commands:c})=>y1(a,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>y1(a,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},H8=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=Pa(t,0,r.content.size),a=Ve.create(r,s);e.setSelection(a)}return!0},W8=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:a}=r;let o,c;return typeof e=="number"?(o=e,c=e):e&&"from"in e&&"to"in e?(o=e.from,c=e.to):(o=a.from,c=a.to),s&&n.doc.nodesBetween(o,c,(u,h)=>{u.isText||n.setNodeMarkup(h,void 0,{...u.attrs,dir:t})}),!0},U8=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:a}=typeof t=="number"?{from:t,to:t}:t,o=He.atStart(r).from,c=He.atEnd(r).to,u=Pa(s,o,c),h=Pa(a,o,c),f=He.create(r,u,h);e.setSelection(f)}return!0},K8=t=>({state:e,dispatch:n})=>{const r=ln(t,e.schema);return $O(r)(e,n)};function ow(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var q8=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:a,doc:o}=e,{$from:c,$to:u}=a,h=s.extensionManager.attributes,f=Ou(h,c.node().type.name,c.node().attrs);if(a instanceof Ve&&a.node.isBlock)return!c.parentOffset||!Ys(o,c.pos)?!1:(r&&(t&&ow(n,s.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:w8(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:f}]:void 0,v=Ys(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!v&&Ys(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(v=!0,y=g?[{type:g,attrs:f}]:void 0),r){if(v&&(a instanceof He&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const j=e.mapping.map(c.before()),w=e.doc.resolve(j);c.node(-1).canReplaceWith(w.index(),w.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&ow(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return v},G8=(t,e={})=>({tr:n,state:r,dispatch:s,editor:a})=>{var o;const c=ln(t,r.schema),{$from:u,$to:h}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=a.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(s){let k=pe.empty;const E=u.index(-1)?1:u.index(-2)?2:3;for(let I=u.depth-E;I>=u.depth-3;I-=1)k=pe.from(u.node(I).copy(k));const C=u.indexAfter(-1){if(R>-1)return!1;I.isTextblock&&I.content.size===0&&(R=A+1)}),R>-1&&n.setSelection(He.near(n.doc.resolve(R))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={...Ou(g,m.type.name,m.attrs),...e},j={...Ou(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const w=y?[{type:c,attrs:v},{type:y,attrs:j}]:[{type:c,attrs:v}];if(!Ys(n.doc,u.pos,2))return!1;if(s){const{selection:k,storedMarks:E}=r,{splittableMarks:C}=a.extensionManager,M=E||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,w).scrollIntoView(),!M||!s)return!0;const D=M.filter(F=>C.includes(F.type.name));n.ensureMarks(D)}return!0},Vm=(t,e)=>{const n=cf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&aa(t.doc,n.pos)&&t.join(n.pos),!0},Hm=(t,e)=>{const n=cf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&aa(t.doc,r)&&t.join(r),!0},J8=(t,e,n,r={})=>({editor:s,tr:a,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=s.extensionManager,y=ln(t,o.schema),v=ln(e,o.schema),{selection:j,storedMarks:w}=o,{$from:k,$to:E}=j,C=k.blockRange(E),M=w||j.$to.parentOffset&&j.$from.marks();if(!C)return!1;const D=cf(F=>aw(F.type.name,m))(j);if(C.depth>=1&&D&&C.depth-D.depth<=1){if(D.node.type===y)return h.liftListItem(v);if(aw(D.node.type.name,m)&&y.validContent(D.node.content)&&c)return u().command(()=>(a.setNodeMarkup(D.pos,y),!0)).command(()=>Vm(a,y)).command(()=>Hm(a,y)).run()}return!n||!M||!c?u().command(()=>f().wrapInList(y,r)?!0:h.clearNodes()).wrapInList(y,r).command(()=>Vm(a,y)).command(()=>Hm(a,y)).run():u().command(()=>{const F=f().wrapInList(y,r),R=M.filter(I=>g.includes(I.type.name));return a.ensureMarks(R),F?!0:h.clearNodes()}).wrapInList(y,r).command(()=>Vm(a,y)).command(()=>Hm(a,y)).run()},Y8=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:a=!1}=n,o=ni(t,r.schema);return Hg(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:a}):s.setMark(o,e)},Q8=(t,e,n={})=>({state:r,commands:s})=>{const a=ln(t,r.schema),o=ln(e,r.schema),c=Zi(r,a,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?s.setNode(o,u):s.setNode(a,{...u,...n})},X8=(t,e={})=>({state:n,commands:r})=>{const s=ln(t,n.schema);return Zi(n,s,e)?r.lift(s):r.wrapIn(s,e)},Z8=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r=0;u-=1)o.step(c.steps[u].invert(c.docs[u]));if(a.text){const u=o.doc.resolve(a.from).marks();o.replaceWith(a.from,a.to,t.schema.text(a.text,u))}else o.delete(a.from,a.to)}return!0}}return!1},e6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:s}=n;return r||e&&s.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},t6=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var a;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=ni(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!s)return!0;if(f&&o){let{from:g,to:y}=c;const v=(a=h.marks().find(w=>w.type===u))==null?void 0:a.attrs,j=c0(h,u,v);j&&(g=j.from,y=j.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},n6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let a,o;return typeof t=="number"?(a=t,o=t):t&&"from"in t&&"to"in t?(a=t.from,o=t.to):(a=s.from,o=s.to),r&&e.doc.nodesBetween(a,o,(c,u)=>{if(c.isText)return;const h={...c.attrs};delete h.dir,e.setNodeMarkup(u,void 0,h)}),!0},r6=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let a=null,o=null;const c=lf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(a=ln(t,r.schema)),c==="mark"&&(o=ni(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,y,v,j;n.selection.empty?r.doc.nodesBetween(f,m,(w,k)=>{a&&a===w.type&&(u=!0,v=Math.max(k,f),j=Math.min(k+w.nodeSize,m),g=k,y=w)}):r.doc.nodesBetween(f,m,(w,k)=>{k=f&&k<=m&&(a&&a===w.type&&(u=!0,s&&n.setNodeMarkup(k,void 0,{...w.attrs,...e})),o&&w.marks.length&&w.marks.forEach(E=>{if(o===E.type&&(u=!0,s)){const C=Math.max(k,f),M=Math.min(k+w.nodeSize,m);n.addMark(C,M,o.create({...E.attrs,...e}))}}))}),y&&(g!==void 0&&s&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(w=>{o===w.type&&s&&n.addMark(v,j,o.create({...w.attrs,...e}))}))}),u},s6=(t,e={})=>({state:n,dispatch:r})=>{const s=ln(t,n.schema);return IO(s,e)(n,r)},i6=(t,e={})=>({state:n,dispatch:r})=>{const s=ln(t,n.schema);return PO(s,e)(n,r)},a6=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},uf=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},o6=(t,e)=>{if(l0(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function xu(t){var e;const{editor:n,from:r,to:s,text:a,rules:o,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let f=!1;const m=P8(h)+a;return o.forEach(g=>{if(f)return;const y=o6(m,g.find);if(!y)return;const v=u.state.tr,j=af({state:u.state,transaction:v}),w={from:r-(y[0].length-a.length),to:s},{commands:k,chain:E,can:C}=new of({editor:n,state:j});g.handler({state:j,range:w,match:y,commands:k,chain:E,can:C})===null||!v.steps.length||(g.undoable&&v.setMeta(c,{transform:v,from:r,to:s,text:a}),u.dispatch(v),f=!0)}),f}function l6(t){const{editor:e,rules:n}=t,r=new Ct({state:{init(){return null},apply(s,a,o){const c=s.getMeta(r);if(c)return c;const u=s.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=u0(pe.from(f),o.schema);const{from:m}=u,g=m+f.length;xu({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:a}},props:{handleTextInput(s,a,o,c){return xu({editor:e,from:a,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:a}=s.state.selection;a&&xu({editor:e,from:a.pos,to:a.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,a){if(a.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?xu({editor:e,from:o.pos,to:o.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function c6(t){return Object.prototype.toString.call(t).slice(8,-1)}function yu(t){return c6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function pC(t,e){const n={...t};return yu(t)&&yu(e)&&Object.keys(e).forEach(r=>{yu(e[r])&&yu(t[r])?n[r]=pC(t[r],e[r]):n[r]=e[r]}),n}var f0=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...pt($e(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...pt($e(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>pC(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},eo=class mC extends f0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new mC(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(h=>(h==null?void 0:h.type.name)===n.name))return!1;const u=o.find(h=>(h==null?void 0:h.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function d6(t){return typeof t=="number"}var u6=class{constructor(t){this.find=t.find,this.handler=t.handler}},h6=(t,e,n)=>{if(l0(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const a=[s.text];return a.index=s.index,a.input=t,a.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(s.replaceWith)),a}):[]};function f6(t){const{editor:e,state:n,from:r,to:s,rule:a,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new of({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,s,(y,v)=>{var j,w,k,E,C;if((w=(j=y.type)==null?void 0:j.spec)!=null&&w.code||!(y.isText||y.isTextblock||y.isInline))return;const M=(C=(E=(k=y.content)==null?void 0:k.size)!=null?E:y.nodeSize)!=null?C:0,D=Math.max(r,v),F=Math.min(s,v+M);if(D>=F)return;const R=y.isText?y.text||"":y.textBetween(D-v,F-v,void 0,"");h6(R,a.find,o).forEach(A=>{if(A.index===void 0)return;const O=D+A.index+1,W=O+A[0].length,X={from:n.tr.mapping.map(O),to:n.tr.mapping.map(W)},q=a.handler({state:n,range:X,match:A,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(q)})}),m.every(y=>y!==null)}var vu=null,p6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function m6(t){const{editor:e,rules:n}=t;let r=null,s=!1,a=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:m,to:g,rule:y,pasteEvt:v})=>{const j=f.tr,w=af({state:f,transaction:j});if(!(!f6({editor:e,state:w,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:v,dropEvent:c})||!j.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,j}};return n.map(f=>new Ct({view(m){const g=v=>{var j;r=(j=m.dom.parentElement)!=null&&j.contains(v.target)?m.dom.parentElement:null,r&&(vu=e)},y=()=>{vu&&(vu=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(a=r===m.dom.parentElement,c=g,!a){const y=vu;y!=null&&y.isEditable&&setTimeout(()=>{const v=y.state.selection;v&&y.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,g)=>{var y;const v=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,s=!!(v!=null&&v.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,y)=>{const v=m[0],j=v.getMeta("uiEvent")==="paste"&&!s,w=v.getMeta("uiEvent")==="drop"&&!a,k=v.getMeta("applyPasteRules"),E=!!k;if(!j&&!w&&!E)return;if(E){let{text:D}=k;typeof D=="string"?D=D:D=u0(pe.from(D),y.schema);const{from:F}=k,R=F+D.length,I=p6(D);return u({rule:f,state:y,from:F,to:{b:R},pasteEvt:I})}const C=g.doc.content.findDiffStart(y.doc.content),M=g.doc.content.findDiffEnd(y.doc.content);if(!(!d6(C)||!M||C===M.b))return u({rule:f,state:y,from:C,to:M,pasteEvt:o})}}))}var hf=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=aC(t),this.schema=C8(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ql(e.name,this.schema)},r=$e(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return pc([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Ql(r.name,this.schema)},a=[],o=$e(r,"addKeyboardShortcuts",s);let c={};if(r.type==="mark"&&$e(r,"exitable",s)&&(c.ArrowRight=()=>eo.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,v])=>[y,()=>v({editor:t})]));c={...c,...g}}const u=ML(c);a.push(u);const h=$e(r,"addInputRules",s);if(iw(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const y=l6({editor:t,rules:g}),v=Array.isArray(y)?y:[y];a.push(...v)}}const f=$e(r,"addPasteRules",s);if(iw(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const y=m6({editor:t,rules:g});a.push(...y)}}const m=$e(r,"addProseMirrorPlugins",s);if(m){const g=m();a.push(...g)}return a})}get attributes(){return iC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=tl(this.extensions);return Object.fromEntries(e.filter(n=>!!$e(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ln(n.name,this.schema)},a=$e(n,"addNodeView",s);if(!a)return[];const o=a();if(!o)return[];const c=(u,h,f,m,g)=>{const y=Oc(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return pc([...this.extensions].reverse()).reduceRight((r,s)=>{const a={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Ql(s.name,this.schema)},o=$e(s,"dispatchTransaction",a);return o?c=>{o.call(a,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return pc([...this.extensions]).reduce((r,s)=>{const a={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Ql(s.name,this.schema)},o=$e(s,"transformPastedHTML",a);return o?(c,u)=>{const h=r(c,u);return o.call(a,h)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=tl(this.extensions);return Object.fromEntries(e.filter(n=>!!$e(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ni(n.name,this.schema)},a=$e(n,"addMarkView",s);if(!a)return[];const o=(c,u,h)=>{const f=Oc(c,r);return a()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{A6(c,t,m)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ql(e.name,this.schema)};e.type==="mark"&&((n=pt($e(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const s=$e(e,"onBeforeCreate",r),a=$e(e,"onCreate",r),o=$e(e,"onUpdate",r),c=$e(e,"onSelectionUpdate",r),u=$e(e,"onTransaction",r),h=$e(e,"onFocus",r),f=$e(e,"onBlur",r),m=$e(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),a&&this.editor.on("create",a),o&&this.editor.on("update",o),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),f&&this.editor.on("blur",f),m&&this.editor.on("destroy",m)})}};hf.resolve=aC;hf.sort=pc;hf.flatten=d0;var g6={};o0(g6,{ClipboardTextSerializer:()=>xC,Commands:()=>yC,Delete:()=>vC,Drop:()=>bC,Editable:()=>wC,FocusEvents:()=>jC,Keymap:()=>kC,Paste:()=>SC,Tabindex:()=>CC,TextDirection:()=>EC,focusEventsPluginKey:()=>NC});var Gt=class gC extends f0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new gC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},xC=Gt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ct({key:new _t("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,{ranges:a}=s,o=Math.min(...a.map(f=>f.$from.pos)),c=Math.max(...a.map(f=>f.$to.pos)),u=lC(n);return oC(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),yC=Gt.create({name:"commands",addCommands(){return{...JS}}}),vC=Gt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const a=()=>{var o,c,u,h;if((h=(u=(c=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?h:t.getMeta("y-sync$"))return;const f=nC(t.before,[t,...e]);dC(f).forEach(y=>{f.mapping.mapResult(y.oldRange.from).deletedAfter&&f.mapping.mapResult(y.oldRange.to).deletedBefore&&f.before.nodesBetween(y.oldRange.from,y.oldRange.to,(v,j)=>{const w=j+v.nodeSize-2,k=y.oldRange.from<=j&&w<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:v,from:j,to:w,newFrom:f.mapping.map(j),newTo:f.mapping.map(w),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((y,v)=>{var j,w;if(y instanceof Xr){const k=g.slice(v).map(y.from,-1),E=g.slice(v).map(y.to),C=g.invert().map(k,-1),M=g.invert().map(E),D=(j=f.doc.nodeAt(k-1))==null?void 0:j.marks.some(R=>R.eq(y.mark)),F=(w=f.doc.nodeAt(E))==null?void 0:w.marks.some(R=>R.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:C,to:M},newRange:{from:k,to:E},partial:!!(F||D),editor:this.editor,transaction:t,combinedTransform:f})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(a,0):a()}}),bC=Gt.create({name:"drop",addProseMirrorPlugins(){return[new Ct({key:new _t("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),wC=Gt.create({name:"editable",addProseMirrorPlugins(){return[new Ct({key:new _t("editable"),props:{editable:()=>this.editor.options.editable}})]}}),NC=new _t("focusEvents"),jC=Gt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ct({key:NC,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),kC=Gt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:f,$anchor:m}=u,{pos:g,parent:y}=m,v=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,j=v.parent.type.spec.isolating,w=m.pos-m.parentOffset,k=j&&v.parent.childCount===1?w===m.pos:Ge.atStart(h).from===g;return!f||!y.type.isTextblock||y.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},a={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ah()||eC()?a:s},addProseMirrorPlugins(){return[new Ct({key:new _t("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(j=>j.getMeta("composition")))return;const r=t.some(j=>j.docChanged)&&!e.doc.eq(n.doc),s=t.some(j=>j.getMeta("preventClearDocument"));if(!r||s)return;const{empty:a,from:o,to:c}=e.selection,u=Ge.atStart(e.doc).from,h=Ge.atEnd(e.doc).to;if(a||!(o===u&&c===h)||!df(n.doc))return;const g=n.tr,y=af({state:n,transaction:g}),{commands:v}=new of({editor:this.editor,state:y});if(v.clearNodes(),!!g.steps.length)return g}})]}}),SC=Gt.create({name:"paste",addProseMirrorPlugins(){return[new Ct({key:new _t("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),CC=Gt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ct({key:new _t("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),EC=Gt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=tl(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ct({key:new _t("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),x6=class ic{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new ic(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ic(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ic(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,c=this.pos+r+(a?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!s&&!o&&u.depth<=this.depth)return;const h=new ic(u,this.editor,s,s||o?n:null);s&&(h.actualDepth=this.depth+1),e.push(h)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const a=s.node.attrs,o=Object.keys(n);for(let c=0;c{r&&s.length>0||(o.node.type.name===e&&a.every(u=>n[u]===o.node.attrs[u])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},y6=`.ProseMirror { + position: relative; +} + +.ProseMirror { + word-wrap: break-word; + white-space: pre-wrap; + white-space: break-spaces; + -webkit-font-variant-ligatures: none; + font-variant-ligatures: none; + font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ +} + +.ProseMirror [contenteditable="false"] { + white-space: normal; +} + +.ProseMirror [contenteditable="false"] [contenteditable="true"] { + white-space: pre-wrap; +} + +.ProseMirror pre { + white-space: pre-wrap; +} + +img.ProseMirror-separator { + display: inline !important; + border: none !important; + margin: 0 !important; + width: 0 !important; + height: 0 !important; +} + +.ProseMirror-gapcursor { + display: none; + pointer-events: none; + position: absolute; + margin: 0; +} + +.ProseMirror-gapcursor:after { + content: ""; + display: block; + position: absolute; + top: -2px; + width: 20px; + border-top: 1px solid black; + animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; +} + +@keyframes ProseMirror-cursor-blink { + to { + visibility: hidden; + } +} + +.ProseMirror-hideselection *::selection { + background: transparent; +} + +.ProseMirror-hideselection *::-moz-selection { + background: transparent; +} + +.ProseMirror-hideselection * { + caret-color: transparent; +} + +.ProseMirror-focused .ProseMirror-gapcursor { + display: block; +}`;function v6(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var b6=class extends a6{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:_8,createMappablePosition:z8},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:a})=>this.options.onDrop(r,s,a)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=XS(e,this.options.autofocus);this.editorState=Ho.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=v6(y6,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=sC(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const a=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(a))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[wC,xC.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),yC,jC,kC,CC,bC,SC,vC,EC.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new hf(r,this)}createCommandManager(){this.commandManager=new of({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Vg(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Vg(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,a=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new GS(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(h=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(h)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),a=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(h=>h.getMeta("focus")||h.getMeta("blur")),c=o==null?void 0:o.getMeta("focus"),u=o==null?void 0:o.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(h=>h.docChanged)||a.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return cC(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return O8(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return u0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` + +`,textSerializers:n={}}=t||{};return T8(this.state.doc,{blockSeparator:e,textSerializers:{...lC(this.schema),...n}})}get isEmpty(){return df(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new x6(e,this)}get $doc(){return this.$pos(0)}};function nl(t){return new uf({find:t.find,handler:({state:e,range:n,match:r})=>{const s=pt(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:a}=e,o=r[r.length-1],c=r[0];if(o){const u=c.search(/\S/),h=n.from+c.indexOf(o),f=h+o.length;if(h0(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(j=>j===t.type&&j!==y.mark.type)).filter(y=>y.to>h).length)return null;fn.from&&a.delete(n.from+u,h);const g=n.from+u+o.length;a.addMark(n.from+u,g,t.type.create(s||{})),a.removeStoredMark(t.type)}},undoable:t.undoable})}function TC(t){return new uf({find:t.find,handler:({state:e,range:n,match:r})=>{const s=pt(t.getAttributes,void 0,r)||{},{tr:a}=e,o=n.from;let c=n.to;const u=t.type.create(s);if(r[1]){const h=r[0].lastIndexOf(r[1]);let f=o+h;f>c?f=c:c=f+r[1].length;const m=r[0][r[0].length-1];a.insertText(m,o+r[0].length-1),a.replaceWith(f,c,u)}else if(r[0]){const h=t.type.isInline?o:o-1;a.insert(h,t.type.create(s)).delete(a.mapping.map(o),a.mapping.map(c))}a.scrollIntoView()},undoable:t.undoable})}function Wg(t){return new uf({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),a=pt(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,a)},undoable:t.undoable})}function rl(t){return new uf({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const a=pt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&Hx(u,t.type,a);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:y}=t.editor.extensionManager,v=g||m.$to.parentOffset&&m.$from.marks();if(v){const j=v.filter(w=>y.includes(w.type.name));o.ensureMarks(j)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(m,a).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&aa(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var w6=t=>"touches"in t,N6=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,h=c.clientY-this.startY;this.handleResize(u,h)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.touches[0];if(!u)return;const h=u.clientX-this.startX,f=u.clientY-this.startY;this.handleResize(h,f)},this.handleMouseUp=()=>{if(!this.isResizing)return;const c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,u),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,s,a,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(s=t.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(a=t.options)!=null&&a.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),a=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),a&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,w6(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),a=this.applyConstraints(r,s,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const a=t.includes("right"),o=t.includes("left"),c=t.includes("bottom"),u=t.includes("top");return a?r=this.startWidth+e:o&&(r=this.startWidth-e),c?s=this.startHeight+n:u&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(a?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s,a,o;if(!n){let h=Math.max(this.minSize.width,t),f=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(h=Math.min(this.maxSize.width,h)),(s=this.maxSize)!=null&&s.height&&(f=Math.min(this.maxSize.height,f)),{width:h,height:f}}let c=t,u=e;return cthis.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function j6(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ve){const a=r.index();return r.parent.canReplaceWith(a,a+1,e)}let s=r.depth;for(;s>=0;){const a=r.index(s);if(r.node(s).contentMatchAt(a).matchType(e))return!0;s-=1}return!1}function k6(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var S6={};o0(S6,{createAtomBlockMarkdownSpec:()=>C6,createBlockMarkdownSpec:()=>E6,createInlineMarkdownSpec:()=>MC,parseAttributes:()=>p0,parseIndentedBlocks:()=>Ug,renderNestedMarkdownContent:()=>g0,serializeAttributes:()=>m0});function p0(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const h=s.map(f=>f.trim().slice(1));e.class=h.join(" ")}const a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(e.id=a[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,h,f])=>{var m;const g=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),y=n[g];y&&(e[h]=y.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function m0(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function C6(t){const{nodeName:e,name:n,parseAttributes:r=p0,serializeAttributes:s=m0,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{const g={...a,...f.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),y=(m=f.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,m,g){const y=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),v=f.match(y);if(!v)return;const j=v[1]||"",w=r(j);if(!o.find(E=>!(E in w)))return{type:e,raw:v[0],attributes:w}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=s(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function E6(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=p0,serializeAttributes:a=m0,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const g={};return u.forEach(y=>{y in m&&(g[y]=m[y])}),g};return{parseMarkdown:(m,g)=>{let y;if(r){const j=r(m);y=typeof j=="string"?[{type:"text",text:j}]:j}else c==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const v={...o,...m.attributes};return g.createNode(e,v,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${h}`,"m"),v=(g=m.match(y))==null?void 0:g.index;return v!==void 0?v:-1},tokenize(m,g,y){var v;const j=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),w=m.match(j);if(!w)return;const[k,E=""]=w,C=s(E);let M=1;const D=k.length;let F="";const R=/^:::([\w-]*)(\s.*)?/gm,I=m.slice(D);for(R.lastIndex=0;;){const A=R.exec(I);if(A===null)break;const O=A.index,W=A[1];if(!((v=A[2])!=null&&v.endsWith(":::"))){if(W)M+=1;else if(M-=1,M===0){const X=I.slice(0,O);F=X.trim();const q=m.slice(0,D+O+A[0].length);let Z=[];if(F)if(c==="block")for(Z=y.blockTokens(X),Z.forEach(_=>{_.text&&(!_.tokens||_.tokens.length===0)&&(_.tokens=y.inlineTokens(_.text))});Z.length>0;){const _=Z[Z.length-1];if(_.type==="paragraph"&&(!_.text||_.text.trim()===""))Z.pop();else break}else Z=y.inlineTokens(F);return{type:e,raw:q,attributes:C,content:F,tokens:Z}}}}}},renderMarkdown:(m,g)=>{const y=f(m.attrs||{}),v=a(y),j=v?` {${v}}`:"",w=g.renderChildren(m.content||[],` + +`);return`:::${h}${j} + +${w} + +:::`}}}function T6(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,a,o]=r;e[s]=a||o,r=n.exec(t)}return e}function M6(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function MC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=T6,serializeAttributes:a=M6,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const y={};return u.forEach(v=>{const j=typeof v=="string"?v:v.name,w=typeof v=="string"?void 0:v.skipIfDefault;if(j in g){const k=g[j];if(w!==void 0&&k===w)return;y[j]=k}}),y},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const v={...o,...g.attributes};if(c)return y.createNode(e,v);const j=r?r(g):g.content||"";return j?y.createNode(e,v,[y.createTextNode(j)]):y.createNode(e,v,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),v=g.match(y),j=v==null?void 0:v.index;return j!==void 0?j:-1},tokenize(g,y,v){const j=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),w=g.match(j);if(!w)return;let k="",E="";if(c){const[,M]=w;E=M}else{const[,M,D]=w;E=M,k=D||""}const C=s(E.trim());return{type:e,raw:w[0],content:k.trim(),attributes:C}}},renderMarkdown:g=>{let y="";r?y=r(g):g.content&&g.content.length>0&&(y=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const v=f(g.attrs||{}),j=a(v),w=j?` ${j}`:"";return c?`[${h}${w}]`:`[${h}${w}]${y}[/${h}]`}}}function Ug(t,e,n){var r,s,a,o;const c=t.split(` +`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(g.trim()===""){f+=1,h=`${h}${g} +`;continue}else return}const v=e.extractItemData(y),{indentLevel:j,mainContent:w}=v;h=`${h}${g} +`;const k=[w];for(f+=1;fO.trim()!=="");if(R===-1)break;if((((s=(r=c[f+1+R].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>j){k.push(D),h=`${h}${D} +`,f+=1;continue}else break}if((((o=(a=D.match(/^(\s*)/))==null?void 0:a[1])==null?void 0:o.length)||0)>j)k.push(D),h=`${h}${D} +`,f+=1;else break}let E;const C=k.slice(1);if(C.length>0){const D=C.map(F=>F.slice(j+m)).join(` +`);D.trim()&&(e.customNestedParser?E=e.customNestedParser(D):E=n.blockTokens(D))}const M=e.createToken(v,E);u.push(M)}if(u.length!==0)return{items:u,raw:h}}function g0(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[a,...o]=t.content,c=e.renderChildren([a]),u=[`${s}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` +`).map(g=>g?e.indent(g):"").join(` +`);u.push(m)}}),u.join(` +`)}function A6(t,e,n={}){const{state:r}=e,{doc:s,tr:a}=r,o=t;s.descendants((c,u)=>{const h=a.mapping.map(u),f=a.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(y=>{if(y!==o)return!1;m=y}),!m)return;let g=!1;if(Object.keys(n).forEach(y=>{n[y]!==m.attrs[y]&&(g=!0)}),g){const y=t.type.create({...t.attrs,...n});a.removeMark(h,f,t.type),a.addMark(h,f,y)}}),a.docChanged&&e.view.dispatch(a)}var fn=class AC extends f0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new AC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function qa(t){return new u6({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const a=pt(t.getAttributes,void 0,r,s);if(a===!1||a===null)return null;const{tr:o}=e,c=r[r.length-1],u=r[0];let h=n.to;if(c){const f=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(h0(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(w=>w===t.type&&w!==v.mark.type)).filter(v=>v.to>m).length)return null;gn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(a||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:R6,getOwnPropertySymbols:I6}=Object,{hasOwnProperty:P6}=Object.prototype;function Wm(t,e){return function(r,s,a){return t(r,s,a)&&e(r,s,a)}}function bu(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:a}=s,o=a.get(n),c=a.get(r);if(o&&c)return o===r&&c===n;a.set(n,r),a.set(r,n);const u=t(n,r,s);return a.delete(n),a.delete(r),u}}function O6(t){return t!=null?t[Symbol.toStringTag]:void 0}function lw(t){return R6(t).concat(I6(t))}const D6=Object.hasOwn||((t,e)=>P6.call(t,e));function to(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const L6="__v",_6="__o",z6="_owner",{getOwnPropertyDescriptor:cw,keys:dw}=Object;function $6(t,e){return t.byteLength===e.byteLength&&oh(new Uint8Array(t),new Uint8Array(e))}function F6(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function B6(t,e){return t.byteLength===e.byteLength&&oh(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function V6(t,e){return to(t.getTime(),e.getTime())}function H6(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function W6(t,e){return t===e}function uw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),a=t.entries();let o,c,u=0;for(;(o=a.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(s[m]){m++;continue}const g=o.value,y=c.value;if(n.equals(g[0],y[0],u,m,t,e,n)&&n.equals(g[1],y[1],g[0],y[0],t,e,n)){f=s[m]=!0;break}m++}if(!f)return!1;u++}return!0}const U6=to;function K6(t,e,n){const r=dw(t);let s=r.length;if(dw(e).length!==s)return!1;for(;s-- >0;)if(!RC(t,e,n,r[s]))return!1;return!0}function Xl(t,e,n){const r=lw(t);let s=r.length;if(lw(e).length!==s)return!1;let a,o,c;for(;s-- >0;)if(a=r[s],!RC(t,e,n,a)||(o=cw(t,a),c=cw(e,a),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function q6(t,e){return to(t.valueOf(),e.valueOf())}function G6(t,e){return t.source===e.source&&t.flags===e.flags}function hw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),a=t.values();let o,c;for(;(o=a.next())&&!o.done;){const u=e.values();let h=!1,f=0;for(;(c=u.next())&&!c.done;){if(!s[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=s[f]=!0;break}f++}if(!h)return!1}return!0}function oh(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function J6(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function RC(t,e,n,r){return(r===z6||r===_6||r===L6)&&(t.$$typeof||e.$$typeof)?!0:D6(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const Y6="[object ArrayBuffer]",Q6="[object Arguments]",X6="[object Boolean]",Z6="[object DataView]",e_="[object Date]",t_="[object Error]",n_="[object Map]",r_="[object Number]",s_="[object Object]",i_="[object RegExp]",a_="[object Set]",o_="[object String]",l_={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},c_="[object URL]",d_=Object.prototype.toString;function u_({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:v}){return function(w,k,E){if(w===k)return!0;if(w==null||k==null)return!1;const C=typeof w;if(C!==typeof k)return!1;if(C!=="object")return C==="number"?c(w,k,E):C==="function"?a(w,k,E):!1;const M=w.constructor;if(M!==k.constructor)return!1;if(M===Object)return u(w,k,E);if(Array.isArray(w))return e(w,k,E);if(M===Date)return r(w,k,E);if(M===RegExp)return f(w,k,E);if(M===Map)return o(w,k,E);if(M===Set)return m(w,k,E);const D=d_.call(w);if(D===e_)return r(w,k,E);if(D===i_)return f(w,k,E);if(D===n_)return o(w,k,E);if(D===a_)return m(w,k,E);if(D===s_)return typeof w.then!="function"&&typeof k.then!="function"&&u(w,k,E);if(D===c_)return y(w,k,E);if(D===t_)return s(w,k,E);if(D===Q6)return u(w,k,E);if(l_[D])return g(w,k,E);if(D===Y6)return t(w,k,E);if(D===Z6)return n(w,k,E);if(D===X6||D===r_||D===o_)return h(w,k,E);if(v){let F=v[D];if(!F){const R=O6(w);R&&(F=v[R])}if(F)return F(w,k,E)}return!1}}function h_({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:$6,areArraysEqual:n?Xl:F6,areDataViewsEqual:B6,areDatesEqual:V6,areErrorsEqual:H6,areFunctionsEqual:W6,areMapsEqual:n?Wm(uw,Xl):uw,areNumbersEqual:U6,areObjectsEqual:n?Xl:K6,arePrimitiveWrappersEqual:q6,areRegExpsEqual:G6,areSetsEqual:n?Wm(hw,Xl):hw,areTypedArraysEqual:n?Wm(oh,Xl):oh,areUrlsEqual:J6,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=bu(r.areArraysEqual),a=bu(r.areMapsEqual),o=bu(r.areObjectsEqual),c=bu(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:c})}return r}function f_(t){return function(e,n,r,s,a,o,c){return t(e,n,c)}}function p_({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(c,u){const{cache:h=t?new WeakMap:void 0,meta:f}=n();return e(c,u,{cache:h,equals:r,meta:f,strict:s})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const a={cache:void 0,equals:r,meta:void 0,strict:s};return function(c,u){return e(c,u,a)}}const m_=la();la({strict:!0});la({circular:!0});la({circular:!0,strict:!0});la({createInternalComparator:()=>to});la({strict:!0,createInternalComparator:()=>to});la({circular:!0,createInternalComparator:()=>to});la({circular:!0,createInternalComparator:()=>to,strict:!0});function la(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,a=h_(t),o=u_(a),c=n?n(o):f_(o);return p_({circular:e,comparator:o,createState:r,equals:c,strict:s})}var Um={exports:{}},Km={};/** + * @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 fw;function g_(){if(fw)return Km;fw=1;var t=$c(),e=bk();function n(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,a=t.useRef,o=t.useEffect,c=t.useMemo,u=t.useDebugValue;return Km.useSyncExternalStoreWithSelector=function(h,f,m,g,y){var v=a(null);if(v.current===null){var j={hasValue:!1,value:null};v.current=j}else j=v.current;v=c(function(){function k(F){if(!E){if(E=!0,C=F,F=g(F),y!==void 0&&j.hasValue){var R=j.value;if(y(R,F))return M=R}return M=F}if(R=M,r(C,F))return R;var I=g(F);return y!==void 0&&y(R,I)?(C=F,R):(C=F,M=I)}var E=!1,C,M,D=m===void 0?null:m;return[function(){return k(f())},D===null?void 0:function(){return k(D())}]},[f,m,g,y]);var w=s(h,v[0],v[1]);return o(function(){j.hasValue=!0,j.value=w},[w]),u(w),w},Km}var pw;function x_(){return pw||(pw=1,Um.exports=g_()),Um.exports}var y_=x_(),v_=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},b_=({contentComponent:t})=>{const e=wk.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return i.jsx(i.Fragment,{children:Object.values(e)})};function w_(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:vN.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var N_=class extends Zn.Component{constructor(t){var e;super(t),this.editorContentRef=Zn.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=w_(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:v_(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&i.jsx(b_,{contentComponent:t.contentComponent})]})}},j_=b.forwardRef((t,e)=>{const n=Zn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Zn.createElement(N_,{key:n,innerRef:e,...t})}),IC=Zn.memo(j_),k_=typeof window<"u"?b.useLayoutEffect:b.useEffect,S_=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function C_(t){var e;const[n]=b.useState(()=>new S_(t.editor)),r=y_.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:m_);return k_(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(r),r}var E_=!1,Kg=typeof window>"u",T_=Kg||!!(typeof window<"u"&&window.next),M_=class PC{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Kg||T_?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,a;return(a=(s=this.options.current).onBeforeCreate)==null?void 0:a.call(s,...r)},onBlur:(...r)=>{var s,a;return(a=(s=this.options.current).onBlur)==null?void 0:a.call(s,...r)},onCreate:(...r)=>{var s,a;return(a=(s=this.options.current).onCreate)==null?void 0:a.call(s,...r)},onDestroy:(...r)=>{var s,a;return(a=(s=this.options.current).onDestroy)==null?void 0:a.call(s,...r)},onFocus:(...r)=>{var s,a;return(a=(s=this.options.current).onFocus)==null?void 0:a.call(s,...r)},onSelectionUpdate:(...r)=>{var s,a;return(a=(s=this.options.current).onSelectionUpdate)==null?void 0:a.call(s,...r)},onTransaction:(...r)=>{var s,a;return(a=(s=this.options.current).onTransaction)==null?void 0:a.call(s,...r)},onUpdate:(...r)=>{var s,a;return(a=(s=this.options.current).onUpdate)==null?void 0:a.call(s,...r)},onContentError:(...r)=>{var s,a;return(a=(s=this.options.current).onContentError)==null?void 0:a.call(s,...r)},onDrop:(...r)=>{var s,a;return(a=(s=this.options.current).onDrop)==null?void 0:a.call(s,...r)},onPaste:(...r)=>{var s,a;return(a=(s=this.options.current).onPaste)==null?void 0:a.call(s,...r)},onDelete:(...r)=>{var s,a;return(a=(s=this.options.current).onDelete)==null?void 0:a.call(s,...r)}};return new b6(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,a)=>{var o;return s===((o=n.extensions)==null?void 0:o[a])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?PC.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function A_(t={},e=[]){const n=b.useRef(t);n.current=t;const[r]=b.useState(()=>new M_(n)),s=wk.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(s),b.useEffect(r.onRender(e)),C_({editor:s,selector:({transactionNumber:a})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&a===0?0:a+1}),s}var OC=b.createContext({editor:null});OC.Consumer;var R_=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),I_=()=>b.useContext(R_);Zn.forwardRef((t,e)=>{const{onDragStart:n}=I_(),r=t.as||"div";return i.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Zn.createContext({markViewContentRef:()=>{}});var x0=b.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});x0.displayName="TiptapContext";var P_=()=>b.useContext(x0);function DC({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const s=b.useMemo(()=>({editor:r}),[r]),a=b.useMemo(()=>({editor:r}),[r]);return i.jsx(OC.Provider,{value:a,children:i.jsx(x0.Provider,{value:s,children:n})})}DC.displayName="Tiptap";function LC({...t}){const{editor:e}=P_();return i.jsx(IC,{editor:e,...t})}LC.displayName="Tiptap.Content";Object.assign(DC,{Content:LC});var lh=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},O_=/^\s*>\s$/,D_=fn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return lh("blockquote",{...vt(this.options.HTMLAttributes,t),children:lh("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(s=>{const c=e.renderChildren([s]).split(` +`).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(c.join(` +`))}),r.join(` +${n} +`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[rl({find:O_,type:this.type})]}}),L_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,__=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,z_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,$_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,F_=eo.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return lh("strong",{...vt(this.options.HTMLAttributes,t),children:lh("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[nl({find:L_,type:this.type}),nl({find:z_,type:this.type})]},addPasteRules(){return[qa({find:__,type:this.type}),qa({find:$_,type:this.type})]}}),B_=/(^|[^`])`([^`]+)`(?!`)$/,V_=/(^|[^`])`([^`]+)`(?!`)/g,H_=eo.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",vt(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[nl({find:B_,type:this.type})]},addPasteRules(){return[qa({find:V_,type:this.type})]}}),qm=4,W_=/^```([a-z]+)?[\s\n]$/,U_=/^~~~([a-z]+)?[\s\n]$/,K_=fn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:qm,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const a=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return a||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",vt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(` +`):r=`\`\`\`${s} + +\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:qm,{state:r}=t,{selection:s}=r,{$from:a,empty:o}=s;if(a.parent.type!==this.type)return!1;const c=" ".repeat(n);return o?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:h,to:f}=s,y=r.doc.textBetween(h,f,` +`,` +`).split(` +`).map(v=>c+v).join(` +`);return u.replaceWith(h,f,r.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:qm,{state:r}=t,{selection:s}=r,{$from:a,empty:o}=s;return a.parent.type!==this.type?!1:o?t.commands.command(({tr:c})=>{var u;const{pos:h}=a,f=a.start(),m=a.end(),y=r.doc.textBetween(f,m,` +`,` +`).split(` +`);let v=0,j=0;const w=h-f;for(let F=0;F=w){v=F;break}j+=y[F].length+1}const E=((u=y[v].match(/^ */))==null?void 0:u[0])||"",C=Math.min(E.length,n);if(C===0)return!0;let M=f;for(let F=0;F{const{from:u,to:h}=s,g=r.doc.textBetween(u,h,` +`,` +`).split(` +`).map(y=>{var v;const j=((v=y.match(/^ */))==null?void 0:v[0])||"",w=Math.min(j.length,n);return y.slice(w)}).join(` +`);return c.replaceWith(u,h,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` + +`);return!a||!o?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:a}=n;if(!a||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const c=s.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(Ge.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Wg({find:W_,type:this.type,getAttributes:t=>({language:t[1]})}),Wg({find:U_,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ct({key:new _t("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,a=s==null?void 0:s.mode;if(!n||!a)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,` +`));return o.replaceSelectionWith(this.type.create({language:a},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(He.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),q_=fn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` + +`):""}),G_=fn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",vt(this.options.HTMLAttributes,t)]},renderText(){return` +`},renderMarkdown:()=>` +`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:a}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=a||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),J_=fn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,vt(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Wg({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),Y_=fn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",vt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!j6(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return uC(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:a,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(He.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(Ve.create(o.doc,u.pos)):o.setSelection(He.create(o.doc,u.pos));else{const f=a.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(He.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[TC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Q_=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,X_=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Z_=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,ez=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,tz=eo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",vt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[nl({find:Q_,type:this.type}),nl({find:Z_,type:this.type})]},addPasteRules(){return[qa({find:X_,type:this.type}),qa({find:ez,type:this.type})]}});const nz="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",rz="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",qg="numeric",Gg="ascii",Jg="alpha",mc="asciinumeric",ac="alphanumeric",Yg="domain",_C="emoji",sz="scheme",iz="slashscheme",Gm="whitespace";function az(t,e){return t in e||(e[t]=[]),e[t]}function Oa(t,e,n){e[qg]&&(e[mc]=!0,e[ac]=!0),e[Gg]&&(e[mc]=!0,e[Jg]=!0),e[mc]&&(e[ac]=!0),e[Jg]&&(e[ac]=!0),e[ac]&&(e[Yg]=!0),e[_C]&&(e[Yg]=!0);for(const r in e){const s=az(r,n);s.indexOf(t)<0&&s.push(t)}}function oz(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function dr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}dr.groups={};dr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,s),Wt=(t,e,n,r,s)=>t.tr(e,n,r,s),mw=(t,e,n,r,s)=>t.ts(e,n,r,s),we=(t,e,n,r,s)=>t.tt(e,n,r,s),Vs="WORD",Qg="UWORD",zC="ASCIINUMERICAL",$C="ALPHANUMERICAL",Dc="LOCALHOST",Xg="TLD",Zg="UTLD",Du="SCHEME",_o="SLASH_SCHEME",y0="NUM",ex="WS",v0="NL",gc="OPENBRACE",xc="CLOSEBRACE",ch="OPENBRACKET",dh="CLOSEBRACKET",uh="OPENPAREN",hh="CLOSEPAREN",fh="OPENANGLEBRACKET",ph="CLOSEANGLEBRACKET",mh="FULLWIDTHLEFTPAREN",gh="FULLWIDTHRIGHTPAREN",xh="LEFTCORNERBRACKET",yh="RIGHTCORNERBRACKET",vh="LEFTWHITECORNERBRACKET",bh="RIGHTWHITECORNERBRACKET",wh="FULLWIDTHLESSTHAN",Nh="FULLWIDTHGREATERTHAN",jh="AMPERSAND",kh="APOSTROPHE",Sh="ASTERISK",Oi="AT",Ch="BACKSLASH",Eh="BACKTICK",Th="CARET",_i="COLON",b0="COMMA",Mh="DOLLAR",xs="DOT",Ah="EQUALS",w0="EXCLAMATION",Dr="HYPHEN",yc="PERCENT",Rh="PIPE",Ih="PLUS",Ph="POUND",vc="QUERY",N0="QUOTE",FC="FULLWIDTHMIDDLEDOT",j0="SEMI",ys="SLASH",bc="TILDE",Oh="UNDERSCORE",BC="EMOJI",Dh="SYM";var VC=Object.freeze({__proto__:null,ALPHANUMERICAL:$C,AMPERSAND:jh,APOSTROPHE:kh,ASCIINUMERICAL:zC,ASTERISK:Sh,AT:Oi,BACKSLASH:Ch,BACKTICK:Eh,CARET:Th,CLOSEANGLEBRACKET:ph,CLOSEBRACE:xc,CLOSEBRACKET:dh,CLOSEPAREN:hh,COLON:_i,COMMA:b0,DOLLAR:Mh,DOT:xs,EMOJI:BC,EQUALS:Ah,EXCLAMATION:w0,FULLWIDTHGREATERTHAN:Nh,FULLWIDTHLEFTPAREN:mh,FULLWIDTHLESSTHAN:wh,FULLWIDTHMIDDLEDOT:FC,FULLWIDTHRIGHTPAREN:gh,HYPHEN:Dr,LEFTCORNERBRACKET:xh,LEFTWHITECORNERBRACKET:vh,LOCALHOST:Dc,NL:v0,NUM:y0,OPENANGLEBRACKET:fh,OPENBRACE:gc,OPENBRACKET:ch,OPENPAREN:uh,PERCENT:yc,PIPE:Rh,PLUS:Ih,POUND:Ph,QUERY:vc,QUOTE:N0,RIGHTCORNERBRACKET:yh,RIGHTWHITECORNERBRACKET:bh,SCHEME:Du,SEMI:j0,SLASH:ys,SLASH_SCHEME:_o,SYM:Dh,TILDE:bc,TLD:Xg,UNDERSCORE:Oh,UTLD:Zg,UWORD:Qg,WORD:Vs,WS:ex});const Fs=/[a-z]/,Zl=new RegExp("\\p{L}","u"),Jm=new RegExp("\\p{Emoji}","u"),Bs=/\d/,Ym=/\s/,gw="\r",Qm=` +`,lz="️",cz="‍",Xm="";let wu=null,Nu=null;function dz(t=[]){const e={};dr.groups=e;const n=new dr;wu==null&&(wu=xw(nz)),Nu==null&&(Nu=xw(rz)),we(n,"'",kh),we(n,"{",gc),we(n,"}",xc),we(n,"[",ch),we(n,"]",dh),we(n,"(",uh),we(n,")",hh),we(n,"<",fh),we(n,">",ph),we(n,"(",mh),we(n,")",gh),we(n,"「",xh),we(n,"」",yh),we(n,"『",vh),we(n,"』",bh),we(n,"<",wh),we(n,">",Nh),we(n,"&",jh),we(n,"*",Sh),we(n,"@",Oi),we(n,"`",Eh),we(n,"^",Th),we(n,":",_i),we(n,",",b0),we(n,"$",Mh),we(n,".",xs),we(n,"=",Ah),we(n,"!",w0),we(n,"-",Dr),we(n,"%",yc),we(n,"|",Rh),we(n,"+",Ih),we(n,"#",Ph),we(n,"?",vc),we(n,'"',N0),we(n,"/",ys),we(n,";",j0),we(n,"~",bc),we(n,"_",Oh),we(n,"\\",Ch),we(n,"・",FC);const r=Wt(n,Bs,y0,{[qg]:!0});Wt(r,Bs,r);const s=Wt(r,Fs,zC,{[mc]:!0}),a=Wt(r,Zl,$C,{[ac]:!0}),o=Wt(n,Fs,Vs,{[Gg]:!0});Wt(o,Bs,s),Wt(o,Fs,o),Wt(s,Bs,s),Wt(s,Fs,s);const c=Wt(n,Zl,Qg,{[Jg]:!0});Wt(c,Fs),Wt(c,Bs,a),Wt(c,Zl,c),Wt(a,Bs,a),Wt(a,Fs),Wt(a,Zl,a);const u=we(n,Qm,v0,{[Gm]:!0}),h=we(n,gw,ex,{[Gm]:!0}),f=Wt(n,Ym,ex,{[Gm]:!0});we(n,Xm,f),we(h,Qm,u),we(h,Xm,f),Wt(h,Ym,f),we(f,gw),we(f,Qm),Wt(f,Ym,f),we(f,Xm,f);const m=Wt(n,Jm,BC,{[_C]:!0});we(m,"#"),Wt(m,Jm,m),we(m,lz,m);const g=we(m,cz);we(g,"#"),Wt(g,Jm,m);const y=[[Fs,o],[Bs,s]],v=[[Fs,null],[Zl,c],[Bs,a]];for(let j=0;jj[0]>w[0]?1:-1);for(let j=0;j=0?E[Yg]=!0:Fs.test(w)?Bs.test(w)?E[mc]=!0:E[Gg]=!0:E[qg]=!0,mw(n,w,w,E)}return mw(n,"localhost",Dc,{ascii:!0}),n.jd=new dr(Dh),{start:n,tokens:Object.assign({groups:e},VC)}}function HC(t,e){const n=uz(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,s=[];let a=0,o=0;for(;o=0&&(m+=n[o].length,g++),h+=n[o].length,a+=n[o].length,o++;a-=m,o-=g,h-=m,s.push({t:f.t,v:e.slice(a-h,a),s:a-h,e:a})}return s}function uz(t){const e=[],n=t.length;let r=0;for(;r56319||r+1===n||(a=t.charCodeAt(r+1))<56320||a>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Mi(t,e,n,r,s){let a;const o=e.length;for(let c=0;c=0;)a++;if(a>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+a),10);o>0;o--)n.pop();r+=a}else n.push(t[r]),r++}return e}const Lc={defaultProtocol:"http",events:null,format:yw,formatHref:yw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function k0(t,e=null){let n=Object.assign({},Lc);t&&(n=Object.assign(n,t instanceof k0?t.o:t));const r=n.ignoreTags,s=[];for(let a=0;an?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Lc.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),a=this.toFormattedString(t),o={},c=t.get("className",n,e),u=t.get("target",n,e),h=t.get("rel",n,e),f=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,c&&(o.class=c),u&&(o.target=u),h&&(o.rel=h),f&&Object.assign(o,f),{tagName:s,attributes:o,content:a,eventListeners:m}}};function ff(t,e){class n extends WC{constructor(s,a){super(s,a),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const vw=ff("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),bw=ff("text"),hz=ff("nl"),ju=ff("url",{isLink:!0,toHref(t=Lc.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Dc&&t[1].t===_i}}),Or=t=>new dr(t);function fz({groups:t}){const e=t.domain.concat([jh,Sh,Oi,Ch,Eh,Th,Mh,Ah,Dr,y0,yc,Rh,Ih,Ph,ys,Dh,bc,Oh]),n=[kh,_i,b0,xs,w0,yc,vc,N0,j0,fh,ph,gc,xc,dh,ch,uh,hh,mh,gh,xh,yh,vh,bh,wh,Nh],r=[jh,kh,Sh,Ch,Eh,Th,Mh,Ah,Dr,gc,xc,yc,Rh,Ih,Ph,vc,ys,Dh,bc,Oh],s=Or(),a=we(s,bc);it(a,r,a),it(a,t.domain,a);const o=Or(),c=Or(),u=Or();it(s,t.domain,o),it(s,t.scheme,c),it(s,t.slashscheme,u),it(o,r,a),it(o,t.domain,o);const h=we(o,Oi);we(a,Oi,h),we(c,Oi,h),we(u,Oi,h);const f=we(a,xs);it(f,r,a),it(f,t.domain,a);const m=Or();it(h,t.domain,m),it(m,t.domain,m);const g=we(m,xs);it(g,t.domain,m);const y=Or(vw);it(g,t.tld,y),it(g,t.utld,y),we(h,Dc,y);const v=we(m,Dr);we(v,Dr,v),it(v,t.domain,m),it(y,t.domain,m),we(y,xs,g),we(y,Dr,v);const j=we(y,_i);it(j,t.numeric,vw);const w=we(o,Dr),k=we(o,xs);we(w,Dr,w),it(w,t.domain,o),it(k,r,a),it(k,t.domain,o);const E=Or(ju);it(k,t.tld,E),it(k,t.utld,E),it(E,t.domain,o),it(E,r,a),we(E,xs,k),we(E,Dr,w),we(E,Oi,h);const C=we(E,_i),M=Or(ju);it(C,t.numeric,M);const D=Or(ju),F=Or();it(D,e,D),it(D,n,F),it(F,e,D),it(F,n,F),we(E,ys,D),we(M,ys,D);const R=we(c,_i),I=we(u,_i),A=we(I,ys),O=we(A,ys);it(c,t.domain,o),we(c,xs,k),we(c,Dr,w),it(u,t.domain,o),we(u,xs,k),we(u,Dr,w),it(R,t.domain,D),we(R,ys,D),we(R,vc,D),it(O,t.domain,D),it(O,e,D),we(O,ys,D);const W=[[gc,xc],[ch,dh],[uh,hh],[fh,ph],[mh,gh],[xh,yh],[vh,bh],[wh,Nh]];for(let X=0;X=0&&g++,s++,f++;if(g<0)s-=f,s0&&(a.push(Zm(bw,e,o)),o=[]),s-=g,f-=g;const y=m.t,v=n.slice(s-f,s);a.push(Zm(y,e,v))}}return o.length>0&&a.push(Zm(bw,e,o)),a}function Zm(t,e,n){const r=n[0].s,s=n[n.length-1].e,a=e.slice(r,s);return new t(a,n)}const mz=typeof console<"u"&&console&&console.warn||(()=>{}),gz="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",At={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function xz(){return dr.groups={},At.scanner=null,At.parser=null,At.tokenQueue=[],At.pluginQueue=[],At.customSchemes=[],At.initialized=!1,At}function ww(t,e=!1){if(At.initialized&&mz(`linkifyjs: already initialized - will not register custom scheme "${t}" ${gz}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. +1. Must only contain digits, lowercase ASCII letters or "-" +2. Cannot start or end with "-" +3. "-" cannot repeat`);At.customSchemes.push([t,e])}function yz(){At.scanner=dz(At.customSchemes);for(let t=0;t{const s=e.some(h=>h.docChanged)&&!n.doc.eq(r.doc),a=e.some(h=>h.getMeta("preventAutolink"));if(!s||a)return;const{tr:o}=r,c=nC(n.doc,[...e]);if(dC(c).forEach(({newRange:h})=>{const f=N8(r.doc,h,y=>y.isTextblock);let m,g;if(f.length>1)m=f[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(h.from,h.to," "," ");if(!bz.test(y))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const y=g.split(vz).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],j=m.pos+g.lastIndexOf(v);if(!v)return!1;const w=S0(v).map(k=>k.toObject(t.defaultProtocol));if(!Nz(w))return!1;w.filter(k=>k.isLink).map(k=>({...k,from:j+k.start+1,to:j+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{h0(k.from,k.to,r.doc).some(E=>E.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function kz(t){return new Ct({key:new _t("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,a;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const u=r.target;if(!u)return!1;const h=t.editor.view.dom;o=u.closest("a"),o&&!h.contains(o)&&(o=null)}if(!o)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=cC(e.state,t.type.name),h=(s=o.href)!=null?s:u.href,f=(a=o.target)!=null?a:u.target;h&&(window.open(h,f),c=!0)}return c}}})}function Sz(t){return new Ct({key:new _t("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:a}=e,{selection:o}=a,{empty:c}=o;if(c)return!1;let u="";r.content.forEach(f=>{u+=f.textContent});const h=UC(u,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===u);return!u||!h||s!==void 0&&!s(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function Ta(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(wz,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var KC=eo.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){ww(t);return}ww(t.scheme,t.optionalSlashes)})},onDestroy(){xz()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Ta(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Ta(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Ta(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",vt(this.options.HTMLAttributes,t),0]:["a",vt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,a;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(a=(s=t.attrs)==null?void 0:s.title)!=null?a:"",u=e.renderChildren(t);return c?`[${u}](${o} "${c}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ta(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Ta(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[qa({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,s=UC(t).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:o=>!!Ta(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(a=>{this.options.shouldAutoLink(a.value)&&e.push({text:a.value,data:{href:a.href},index:a.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(jz({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Ta(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(kz({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Sz({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Cz=KC,Ez=Object.defineProperty,Tz=(t,e)=>{for(var n in e)Ez(t,n,{get:e[n],enumerable:!0})},Mz="listItem",Nw="textStyle",jw=/^\s*([-+*])\s$/,qC=fn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",vt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Mz,this.editor.getAttributes(Nw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=rl({find:jw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=rl({find:jw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Nw),editor:this.editor})),[t]}}),GC=fn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",vt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(s=>s.type==="paragraph"))n=e.parseChildren(t.tokens);else{const s=t.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),c=e.parseChildren(o);n.push(...c)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>g0(t,e,r=>{var s,a;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((a=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:a.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Az={};Tz(Az,{findListItemPos:()=>qc,getNextListDepth:()=>E0,handleBackspace:()=>tx,handleDelete:()=>nx,hasListBefore:()=>JC,hasListItemAfter:()=>Rz,hasListItemBefore:()=>YC,listItemHasSubList:()=>QC,nextListIsDeeper:()=>XC,nextListIsHigher:()=>ZC});var qc=(t,e)=>{const{$from:n}=e.selection,r=ln(t,e.schema);let s=null,a=n.depth,o=n.pos,c=null;for(;a>0&&c===null;)s=n.node(a),s.type===r?c=a:(a-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},E0=(t,e)=>{const n=qc(t,e);if(!n)return!1;const[,r]=I8(e,t,n.$pos.pos+4);return r},JC=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),a=t.doc.resolve(s).node();return!(!a||!n.includes(a.type.name))},YC=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},QC=(t,e,n)=>{if(!n)return!1;const r=ln(t,e.schema);let s=!1;return n.descendants(a=>{a.type===r&&(s=!0)}),s},tx=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Zi(t.state,e)&&JC(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((g,y)=>{g.type.name===e&&h.push({node:g,pos:y})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!Zi(t.state,e)||!L8(t.state))return!1;const r=qc(e,t.state);if(!r)return!1;const a=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=QC(e,t.state,a);return YC(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},XC=(t,e)=>{const n=E0(t,e),r=qc(t,e);return!r||!n?!1:n>r.depth},ZC=(t,e)=>{const n=E0(t,e),r=qc(t,e);return!r||!n?!1:n{if(!Zi(t.state,e)||!D8(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:XC(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():ZC(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Rz=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},e2=Gt.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&nx(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&nx(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&tx(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&tx(t,n,r)&&(e=!0)}),e}}}}),kw=/^(\s*)(\d+)\.\s+(.*)$/,Iz=/^\s/;function Pz(t){const e=[];let n=0,r=0;for(;ne;)g.push(t[m]),m+=1;if(g.length>0){const y=Math.min(...g.map(j=>j.indent)),v=t2(g,y,n);h.push({type:"list",ordered:!0,start:g[0].number,items:v,raw:g.map(j=>j.raw).join(` +`)})}s.push({type:"list_item",raw:o.raw,tokens:h}),a=m}else a+=1}return s}function Oz(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const a=e.parseChildren([s]);r.push({type:"paragraph",content:a})}else{const a=e.parseChildren([s]);a.length>0&&r.push(...a)}}),{type:"listItem",content:r}})}var Dz="listItem",Sw="textStyle",Cw=/^(\d+)\.\s$/,n2=fn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",vt(this.options.HTMLAttributes,n),0]:["ol",vt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?Oz(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const s=t.split(` +`),[a,o]=Pz(s);if(a.length===0)return;const c=t2(a,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=a[0])==null?void 0:r.number)||1,items:c,raw:s.slice(0,o).join(` +`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Dz,this.editor.getAttributes(Sw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=rl({find:Cw,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=rl({find:Cw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Sw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Lz=/^\s*(\[([( |x])?\])\s$/,_z=fn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",vt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return g0(t,e,s)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),a=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var g,y;c.ariaLabel=((y=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:y.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),a.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const v=n();if(typeof v!="number")return!1;const j=y.doc.nodeAt(v);return y.setNodeMarkup(v,void 0,{...j==null?void 0:j.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{s.setAttribute(m,g)}),s.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,a.append(c,o),s.append(a,u),Object.entries(e).forEach(([m,g])=>{s.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:s,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;s.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,y=Oc(m,g),v=new Set(Object.keys(y)),j=this.options.HTMLAttributes;return f.forEach(w=>{v.has(w)||(w in j?s.setAttribute(w,j[w]):s.removeAttribute(w))}),Object.entries(y).forEach(([w,k])=>{k==null?w in j?s.setAttribute(w,j[w]):s.removeAttribute(w):s.setAttribute(w,k)}),f=v,!0}}}},addInputRules(){return[rl({find:Lz,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),zz=fn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",vt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=a=>{const o=Ug(a,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(a)},s=Ug(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,o)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Gt.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(qC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(GC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(e2.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(n2.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(_z.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(zz.configure(this.options.taskList)),t}});var Ew=" ",$z=" ",Fz=fn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",vt(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===Ew||r[0].text===$z)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?Ew:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Bz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Vz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Hz=eo.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",vt(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[nl({find:Bz,type:this.type})]},addPasteRules(){return[qa({find:Vz,type:this.type})]}}),Wz=fn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Uz=eo.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",vt(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const a=s[2].trim();return{type:"underline",raw:s[0],text:a,tokens:n.inlineTokens(a)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Kz(t={}){return new Ct({view(e){return new qz(e,t)}})}class qz{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let a=o=>{this[s](o)};return e.dom.addEventListener(s,a),{name:s,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,a=s.getBoundingClientRect(),o=a.width/s.offsetWidth,c=a.height/s.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let y=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(y){let v=y.getBoundingClientRect(),j=m?v.bottom:v.top;m&&g&&(j=(j+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let w=this.width/2*c;r={left:v.left,right:v.right,top:j-w,bottom:j+w}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,y=m.height/u.offsetHeight;h=m.left-u.scrollLeft*g,f=m.top-u.scrollTop*y}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,a=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!a){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=Gk(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Kt extends Ge{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Kt.valid(r)?new Kt(r):Ge.near(r)}content(){return Me.empty}eq(e){return e instanceof Kt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Kt(e.resolve(n.pos))}getBookmark(){return new T0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Gz(e)||!Jz(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Kt.valid(e))return e;let s=e.pos,a=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)0){a=c.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let u=e.doc.resolve(s);if(Kt.valid(u))return u}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!Ve.isSelectable(a)){e=e.doc.resolve(s+a.nodeSize*n),r=!1;continue e}break}a=o,s+=n;let c=e.doc.resolve(s);if(Kt.valid(c))return c}return null}}}Kt.prototype.visible=!1;Kt.findFrom=Kt.findGapCursorFrom;Ge.jsonID("gapcursor",Kt);class T0{constructor(e){this.pos=e}map(e){return new T0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Kt.valid(n)?new Kt(n):Ge.near(n)}}function r2(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Gz(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||r2(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Jz(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||r2(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Yz(){return new Ct({props:{decorations:e7,createSelectionBetween(t,e,n){return e.pos==n.pos&&Kt.valid(n)?new Kt(n):null},handleClick:Xz,handleKeyDown:Qz,handleDOMEvents:{beforeinput:Zz}}})}const Qz=a0({ArrowLeft:ku("horiz",-1),ArrowRight:ku("horiz",1),ArrowUp:ku("vert",-1),ArrowDown:ku("vert",1)});function ku(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,a){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof He){if(!a.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=Kt.findGapCursorFrom(c,e,u);return h?(s&&s(r.tr.setSelection(new Kt(h))),!0):!1}}function Xz(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Kt.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&Ve.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Kt(r))),!0)}function Zz(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Kt))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=pe.empty;for(let o=r.length-1;o>=0;o--)s=pe.from(r[o].createAndFill(null,s));let a=t.state.tr.replace(n.pos,n.pos,new Me(s,0,0));return a.setSelection(He.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function e7(t){if(!(t.selection instanceof Kt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",wt.create(t.doc,[hn.widget(t.selection.head,e,{key:"gapcursor"})])}var Lh=200,kn=function(){};kn.prototype.append=function(e){return e.length?(e=kn.from(e),!this.length&&e||e.length=n?kn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};kn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};kn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};kn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(a,o){return s.push(e(a,o))},n,r),s};kn.from=function(e){return e instanceof kn?e:e&&e.length?new s2(e):kn.empty};var s2=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,a){return s==0&&a==this.length?this:new e(this.values.slice(s,a))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,a,o,c){for(var u=a;u=o;u--)if(s(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Lh)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Lh)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(kn);kn.empty=new s2([]);var t7=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rc&&this.right.forEachInner(r,Math.max(s-c,0),Math.min(this.length,a)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,a,o){var c=this.left.length;if(s>c&&this.right.forEachInvertedInner(r,s-c,Math.max(a,c)-c,o+c)===!1||a=a?this.right.slice(r-a,s-a):this.left.slice(r,a).append(this.right.slice(0,s-a))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(kn);const n7=500;class Qr{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,a;n&&(s=this.remapping(r,this.items.length),a=s.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){s||(s=this.remapping(r,g+1),a=s.maps.length),a--,f.push(m);return}if(s){f.push(new Ai(m.map));let y=m.step.map(s.slice(a)),v;y&&o.maybeStep(y).doc&&(v=o.mapping.maps[o.mapping.maps.length-1],h.push(new Ai(v,void 0,void 0,h.length+f.length))),a--,v&&s.appendMap(v,a)}else o.maybeStep(m.step);if(m.selection)return c=s?m.selection.map(s.slice(a)):m.selection,u=new Qr(this.items.slice(0,r).append(f.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:c}}addTransform(e,n,r,s){let a=[],o=this.eventCount,c=this.items,u=!s&&c.length?c.get(c.length-1):null;for(let f=0;fs7&&(c=r7(c,h),o-=h),new Qr(c.append(a),o)}remapping(e,n){let r=new Tc;return this.items.forEach((s,a)=>{let o=s.mirrorOffset!=null&&a-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Qr(this.items.append(e.map(n=>new Ai(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),a=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},s);let u=n;this.items.forEach(g=>{let y=a.getMirror(--u);if(y==null)return;o=Math.min(o,y);let v=a.maps[y];if(g.step){let j=e.steps[y].invert(e.docs[y]),w=g.selection&&g.selection.map(a.slice(u+1,y));w&&c++,r.push(new Ai(v,j,w))}else r.push(new Ai(v))},s);let h=[];for(let g=n;gn7&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],a=0;return this.items.forEach((o,c)=>{if(c>=e)s.push(o),o.selection&&a++;else if(o.step){let u=o.step.map(n.slice(r)),h=u&&u.getMap();if(r--,h&&n.appendMap(h,r),u){let f=o.selection&&o.selection.map(n.slice(r));f&&a++;let m=new Ai(h.invert(),u,f),g,y=s.length-1;(g=s.length&&s[y].merge(m))?s[y]=g:s.push(m)}}else o.map&&r--},this.items.length,0),new Qr(kn.from(s.reverse()),a)}}Qr.empty=new Qr(kn.empty,0);function r7(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}let Ai=class i2{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new i2(n.getMap().invert(),n,this.selection)}}};class Di{constructor(e,n,r,s,a){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=a}}const s7=20;function i7(t,e,n,r){let s=n.getMeta(Fa),a;if(s)return s.historyState;n.getMeta(l7)&&(t=new Di(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Fa))return o.getMeta(Fa).redo?new Di(t.done.addTransform(n,void 0,r,Lu(e)),t.undone,Tw(n.mapping.maps),t.prevTime,t.prevComposition):new Di(t.done,t.undone.addTransform(n,void 0,r,Lu(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!a7(n,t.prevRanges)),h=o?eg(t.prevRanges,n.mapping):Tw(n.mapping.maps);return new Di(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Lu(e)),Qr.empty,h,n.time,c??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Di(t.done.rebased(n,a),t.undone.rebased(n,a),eg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Di(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),eg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function a7(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let a=0;a=e[a]&&(n=!0)}),n}function Tw(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,a,o)=>e.push(a,o));return e}function eg(t,e){if(!t)return null;let n=[];for(let r=0;r{let s=Fa.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let a=o7(s,n,t);a&&r(e?a.scrollIntoView():a)}return!0}}const o2=a2(!1,!0),l2=a2(!0,!0);Gt.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Ct({key:new _t("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const a=this.storage.characters({node:r.doc});if(a>s){const o=a-s,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(c,u);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),a=this.storage.characters({node:e.doc});if(a<=r||s>r&&a>r&&a<=s)return!0;if(s>r&&a>r&&a>s||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=a-r,h=c-u,f=c;return e.deleteRange(h,f),!(this.storage.characters({node:e.doc})>r)}})]}});var d7=Gt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Kz(this.options)]}});Gt.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ct({key:new _t("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,a=[];if(!n||!r)return wt.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(s>=h&&s<=h+u.nodeSize-1))return!1;o+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(s>=h&&s<=h+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&o-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";a.push(hn.node(h,h+u.nodeSize,{class:this.options.className}))}),wt.create(t,a)}}})]}});var u7=Gt.create({name:"gapCursor",addProseMirrorPlugins(){return[Yz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=pt($e(t,"allowGapCursor",n)))!=null?e:null}}}),Aw="placeholder";function h7(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var f7=Gt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Aw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${h7(this.options.dataAttribute)}`:`data-${Aw}`;return[new Ct({key:new _t("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=n,a=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((c,u)=>{const h=s>=u&&s<=u+c.nodeSize,f=!c.isLeaf&&df(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=hn.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});a.push(g)}return this.options.includeChildren}),wt.create(e,a)}}})]}});Gt.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Ct({key:new _t("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||uC(n.selection)||t.view.dragging?null:wt.create(n.doc,[hn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Rw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var p7=Gt.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new _t(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new Ct({key:e,appendTransaction:(s,a,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,g=h.nodes[n];if(f)return u.insert(m,g.create())},state:{init:(s,a)=>{const o=a.tr.doc.lastChild;return!Rw({node:o,types:r})},apply:(s,a)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return a;const o=s.doc.lastChild;return!Rw({node:o,types:r})}}})]}}),m7=Gt.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>o2(t,e),redo:()=>({state:t,dispatch:e})=>l2(t,e)}},addProseMirrorPlugins(){return[c7(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),g7=Gt.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(F_.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(D_.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(qC.configure(this.options.bulletList)),this.options.code!==!1&&s.push(H_.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(K_.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(q_.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(d7.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(u7.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(G_.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(J_.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(m7.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(Y_.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(tz.configure(this.options.italic)),this.options.listItem!==!1&&s.push(GC.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(e2.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(KC.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(n2.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(Fz.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(Hz.configure(this.options.strike)),this.options.text!==!1&&s.push(Wz.configure(this.options.text)),this.options.underline!==!1&&s.push(Uz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(p7.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),x7=g7,y7=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,v7=fn.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",vt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,a,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(s=(r=t.attrs)==null?void 0:r.alt)!=null?s:"",h=(o=(a=t.attrs)==null?void 0:a.title)!=null?o:"";return h?`![${u}](${c} "${h}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:a,HTMLAttributes:o,editor:c})=>{const u=document.createElement("img");Object.entries(o).forEach(([m,g])=>{if(g!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,g);break}}),u.src=o.src;const h=new N6({element:u,editor:c,node:s,getPos:a,onResize:(m,g)=>{u.style.width=`${m}px`,u.style.height=`${g}px`},onCommit:(m,g)=>{const y=a();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:m,height:g}).run()},onUpdate:(m,g,y)=>m.type===s.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),f=h.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",u.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[TC({find:y7,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),b7=v7;function w7(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:a,startOfLine:o,$position:c}=t,u=r&&!s,h=k6(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=s?"":h,y=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),v=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!v)return null;const j=c.pos-v.length,w=Array.from(v.matchAll(y)).pop();if(!w||w.input===void 0||w.index===void 0)return null;const k=w.input.slice(Math.max(0,w.index-1),w.index),E=new RegExp(`^[${a==null?void 0:a.join("")}\0]?$`).test(k);if(a!==null&&!E)return null;const C=j+w.index;let M=C+w[0].length;return u&&f.test(v.slice(M-1,M+1))&&(w[0]+=" ",M+=1),C=c.pos?{range:{from:C,to:M},query:w[0].slice(n.length),text:w[0]}:null}var N7=new _t("suggestion");function j7({pluginKey:t=N7,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:a=[" "],startOfLine:o=!1,decorationTag:c="span",decorationClass:u="suggestion",decorationContent:h="",decorationEmptyClass:f="is-empty",command:m=()=>null,items:g=()=>[],render:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:j=w7,shouldShow:w}){let k;const E=y==null?void 0:y(),C=()=>{const R=e.state.selection.$anchor.pos,I=e.view.coordsAtPos(R),{top:A,right:O,bottom:W,left:X}=I;try{return new DOMRect(X,A,O-X,W-A)}catch{return null}},M=(R,I)=>I?()=>{const A=t.getState(e.state),O=A==null?void 0:A.decorationId,W=R.dom.querySelector(`[data-decoration-id="${O}"]`);return(W==null?void 0:W.getBoundingClientRect())||null}:C;function D(R,I){var A;try{const W=t.getState(R.state),X=W!=null&&W.decorationId?R.dom.querySelector(`[data-decoration-id="${W.decorationId}"]`):null,q={editor:e,range:(W==null?void 0:W.range)||{from:0,to:0},query:(W==null?void 0:W.query)||null,text:(W==null?void 0:W.text)||null,items:[],command:Z=>m({editor:e,range:(W==null?void 0:W.range)||{from:0,to:0},props:Z}),decorationNode:X,clientRect:M(R,X)};(A=E==null?void 0:E.onExit)==null||A.call(E,q)}catch{}const O=R.state.tr.setMeta(I,{exit:!0});R.dispatch(O)}const F=new Ct({key:t,view(){return{update:async(R,I)=>{var A,O,W,X,q,Z,_;const $=(A=this.key)==null?void 0:A.getState(I),oe=(O=this.key)==null?void 0:O.getState(R.state),V=$.active&&oe.active&&$.range.from!==oe.range.from,ae=!$.active&&oe.active,Y=$.active&&!oe.active,L=!ae&&!Y&&$.query!==oe.query,H=ae||V&&L,ue=L||V,U=Y||V&&L;if(!H&&!ue&&!U)return;const he=U&&!H?$:oe,Q=R.dom.querySelector(`[data-decoration-id="${he.decorationId}"]`);k={editor:e,range:he.range,query:he.query,text:he.text,items:[],command:ee=>m({editor:e,range:he.range,props:ee}),decorationNode:Q,clientRect:M(R,Q)},H&&((W=E==null?void 0:E.onBeforeStart)==null||W.call(E,k)),ue&&((X=E==null?void 0:E.onBeforeUpdate)==null||X.call(E,k)),(ue||H)&&(k.items=await g({editor:e,query:he.query})),U&&((q=E==null?void 0:E.onExit)==null||q.call(E,k)),ue&&((Z=E==null?void 0:E.onUpdate)==null||Z.call(E,k)),H&&((_=E==null?void 0:E.onStart)==null||_.call(E,k))},destroy:()=>{var R;k&&((R=E==null?void 0:E.onExit)==null||R.call(E,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(R,I,A,O){const{isEditable:W}=e,{composing:X}=e.view,{selection:q}=R,{empty:Z,from:_}=q,$={...I},oe=R.getMeta(t);if(oe&&oe.exit)return $.active=!1,$.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null,$;if($.composing=X,W&&(Z||e.view.composing)){(_I.range.to)&&!X&&!I.composing&&($.active=!1);const V=j({char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:a,startOfLine:o,$position:q.$from}),ae=`id_${Math.floor(Math.random()*4294967295)}`;V&&v({editor:e,state:O,range:V.range,isActive:I.active})&&(!w||w({editor:e,range:V.range,query:V.query,text:V.text,transaction:R}))?($.active=!0,$.decorationId=I.decorationId?I.decorationId:ae,$.range=V.range,$.query=V.query,$.text=V.text):$.active=!1}else $.active=!1;return $.active||($.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null),$}},props:{handleKeyDown(R,I){var A,O,W,X;const{active:q,range:Z}=F.getState(R.state);if(!q)return!1;if(I.key==="Escape"||I.key==="Esc"){const $=F.getState(R.state),oe=(A=k==null?void 0:k.decorationNode)!=null?A:null,V=oe??($!=null&&$.decorationId?R.dom.querySelector(`[data-decoration-id="${$.decorationId}"]`):null);if(((O=E==null?void 0:E.onKeyDown)==null?void 0:O.call(E,{view:R,event:I,range:$.range}))||!1)return!0;const Y={editor:e,range:$.range,query:$.query,text:$.text,items:[],command:L=>m({editor:e,range:$.range,props:L}),decorationNode:V,clientRect:V?()=>V.getBoundingClientRect()||null:null};return(W=E==null?void 0:E.onExit)==null||W.call(E,Y),D(R,t),!0}return((X=E==null?void 0:E.onKeyDown)==null?void 0:X.call(E,{view:R,event:I,range:Z}))||!1},decorations(R){const{active:I,range:A,decorationId:O,query:W}=F.getState(R);if(!I)return null;const X=!(W!=null&&W.length),q=[u];return X&&q.push(f),wt.create(R.doc,[hn.inline(A.from,A.to,{nodeName:c,class:q.join(" "),"data-decoration-id":O,"data-decoration-content":h})])}}});return F}function k7({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const s=new _t;return{editor:t,char:r,pluginKey:s,command:({editor:a,range:o,props:c})=>{var u,h,f;const m=a.view.state.selection.$to.nodeAfter;((u=m==null?void 0:m.text)==null?void 0:u.startsWith(" "))&&(o.to+=1),a.chain().focus().insertContentAt(o,[{type:n,attrs:{...c,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(h=a.view.dom.ownerDocument.defaultView)==null?void 0:h.getSelection())==null||f.collapseToEnd()},allow:({state:a,range:o})=>{const c=a.doc.resolve(o.from),u=a.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(u)},...e}}function c2(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>k7({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Iw(t,e){const n=c2(t),r=n.find(s=>s.char===e);return r||(n.length?n[0]:null)}var S7=fn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,s;return["span",vt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(s=e.attrs.label)!=null?s:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=Iw(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",vt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=vt({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof s=="string"?["span",vt({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...MC({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,a,o]=r,c=a??o;e[s==="char"?"mentionSuggestionChar":s]=c,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:Iw(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:s,anchor:a}=r;if(!s)return!1;let o=new Js,c=0;return e.doc.nodesBetween(a-1,a,(u,h)=>{if(u.type.name===this.name)return n=!0,o=u,c=h,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,c,c+o.nodeSize),n})}},addProseMirrorPlugins(){return c2(this).map(j7)}}),C7=S7,E7=f7;let rx,sx;if(typeof WeakMap<"u"){let t=new WeakMap;rx=e=>t.get(e),sx=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;rx=r=>{for(let s=0;s(n==10&&(n=0),t[n++]=r,t[n++]=s)}var qt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(a||(a=[])).push({type:"overlong_rowspan",pos:f,n:k-C});break}const M=s+C*e;for(let D=0;Dr&&(a+=h.attrs.colspan)}}for(let o=0;o1&&(n=!0)}e==-1?e=a:e!=a&&(e=Math.max(e,a))}return e}function A7(t,e,n){t.problems||(t.problems=[]);const r={};for(let s=0;s0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function I7(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function rs(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function pf(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Ga(e.$head)||P7(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function P7(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function ix(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function O7(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function M0(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function d2(t,e,n){const r=t.node(-1),s=qt.get(r),a=t.start(-1),o=s.nextCell(t.pos-a,e,n);return o==null?null:t.node(0).resolve(a+o)}function Ja(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function u2(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;sf!=n.pos-a);u.unshift(n.pos-a);const h=u.map(f=>{const m=r.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=a+f+1;return new Zk(c.resolve(g),c.resolve(g+m.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),s=e.resolve(n.map(this.$headCell.pos));if(ix(r)&&ix(s)&&M0(r,s)){const a=this.$anchorCell.node(-1)!=r.node(-1);return a&&this.isRowSelection()?Hs.rowSelection(r,s):a&&this.isColSelection()?Hs.colSelection(r,s):new Hs(r,s)}return He.between(r,s)}content(){const e=this.$anchorCell.node(-1),n=qt.get(e),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),a={},o=[];for(let u=s.top;u0||w>0){let k=v.attrs;if(j>0&&(k=Ja(k,0,j)),w>0&&(k=Ja(k,k.colspan-w,w)),y.lefts.bottom){const k={...v.attrs,rowspan:Math.min(y.bottom,s.bottom)-Math.max(y.top,s.top)};y.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),s=qt.get(r),a=e.start(-1),o=s.findCell(e.pos-a),c=s.findCell(n.pos-a),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(a+s.map[o.left])),c.bottom0&&(n=u.resolve(a+s.map[c.left])),o.bottom0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,c=a+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof Hs&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),s=qt.get(r),a=e.start(-1),o=s.findCell(e.pos-a),c=s.findCell(n.pos-a),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(a+s.map[o.top*s.width])),c.right0&&(n=u.resolve(a+s.map[c.top*s.width])),o.right{e.push(hn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),wt.create(t.doc,e)}function z7({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(s+1)=0&&!(e.before(a+1)>e.start(a));a--,r--);return n==r&&/row|table/.test(t.node(s).type.spec.tableRole)}function $7({$from:t,$to:e}){let n,r;for(let s=t.depth;s>0;s--){const a=t.node(s);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){n=a;break}}for(let s=e.depth;s>0;s--){const a=e.node(s);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){r=a;break}}return n!==r&&e.parentOffset===0}function F7(t,e,n){const r=(e||t).selection,s=(e||t).doc;let a,o;if(r instanceof Ve&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")a=St.create(s,r.from);else if(o=="row"){const c=s.resolve(r.from+1);a=St.rowSelection(c,c)}else if(!n){const c=qt.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];a=St.create(s,u+1,h)}}else r instanceof He&&z7(r)?a=He.create(s,r.from):r instanceof He&&$7(r)&&(a=He.create(s,r.$from.start(),r.$from.end()));return a&&(e||(e=t.tr)).setSelection(a),e}const B7=new _t("fix-tables");function f2(t,e,n,r){const s=t.childCount,a=e.childCount;e:for(let o=0,c=0;o{s.type.spec.tableRole=="table"&&(n=V7(t,s,a,n))};return e?e.doc!=t.doc&&f2(e.doc,t.doc,0,r):t.doc.descendants(r),n}function V7(t,e,n,r){const s=qt.get(e);if(!s.problems)return r;r||(r=t.tr);const a=[];for(let u=0;u0){let y="cell";f.firstChild&&(y=f.firstChild.type.spec.tableRole);const v=[];for(let w=0;w0?-1:0;D7(e,r,s+a)&&(a=s==0||s==e.width?null:0);for(let o=0;o0&&s0&&e.map[c-1]==u||s0?-1:0;q7(e,r,s+c)&&(c=s==0||s==e.height?null:0);for(let h=0,f=e.width*s;h0&&s0&&m==e.map[f-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),h+=g.colspan-1}else if(s0&&n[a]==n[a-1]||r.right0&&n[s]==n[s-t]||r.bottom0){const f=u+1+h.content.size,m=Pw(h)?u+1:f;a.replaceWith(m+r.tableStart,f+r.tableStart,c)}a.setSelection(new St(a.doc.resolve(u+r.tableStart))),e(a)}return!0}function Dw(t,e){const n=Wn(t.schema);return Z7(({node:r})=>n[r.type.spec.tableRole])(t,e)}function Z7(t){return(e,n)=>{const r=e.selection;let s,a;if(r instanceof St){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{var o;if(s=I7(r.$from),!s)return!1;a=(o=Ga(r.$from))===null||o===void 0?void 0:o.pos}if(s==null||a==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let c=s.attrs;const u=[],h=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const f=Ss(e),m=e.tr;for(let y=0;y{o.attrs[t]!==e&&a.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):a.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[t]:e}),r(a)}return!0}}function t$(t){return function(e,n){if(!rs(e))return!1;if(n){const r=Wn(e.schema),s=Ss(e),a=e.tr,o=s.map.cellsInRect(t=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:t=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),c=o.map(u=>s.table.nodeAt(u));for(let u=0;u{const y=g+a.tableStart,v=o.doc.nodeAt(y);v&&o.setNodeMarkup(y,m,v.attrs)}),r(o)}return!0}}_c("row",{useDeprecatedLogic:!0});_c("column",{useDeprecatedLogic:!0});const n$=_c("cell",{useDeprecatedLogic:!0});function r$(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,s=t.before();r>=0;r--){const a=t.node(-1).child(r),o=a.lastChild;if(o)return s-1-o.nodeSize;s-=a.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Su(t,e){const n=t.selection;if(!(n instanceof St))return!1;if(e){const r=t.tr,s=Wn(t.schema).cell.createAndFill().content;n.forEachCell((a,o)=>{a.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+a.nodeSize-1),new Me(s,0,0))}),r.docChanged&&e(r)}return!0}function i$(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const s=e.child(0),a=s.type.spec.tableRole,o=s.type.schema,c=[];if(a=="row")for(let u=0;u=0;o--){const{rowspan:c,colspan:u}=a.child(o).attrs;for(let h=s;h=e.length&&e.push(pe.empty),n[s]r&&(g=g.type.createChecked(Ja(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let y=1;ys&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,s-m.attrs.rowspan)},m.content)),u.push(m)}a.push(pe.from(u))}n=a,e=s}return{width:t,height:e,rows:n}}function l$(t,e,n,r,s,a,o){const c=t.doc.type.schema,u=Wn(c);let h,f;if(s>e.width)for(let m=0,g=0;me.height){const m=[];for(let v=0,j=(e.height-1)*e.width;v=e.width?!1:n.nodeAt(e.map[j+v]).type==u.header_cell;m.push(w?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,pe.from(m)),y=[];for(let v=e.height;v{if(!s)return!1;const a=n.selection;if(a instanceof St)return _u(n,r,Ge.near(a.$headCell,e));if(t!="horiz"&&!a.empty)return!1;const o=x2(s,t,e);if(o==null)return!1;if(t=="horiz")return _u(n,r,Ge.near(n.doc.resolve(a.head+e),e));{const c=n.doc.resolve(o),u=d2(c,t,e);let h;return u?h=Ge.near(u,1):e<0?h=Ge.near(n.doc.resolve(c.before(-1)),-1):h=Ge.near(n.doc.resolve(c.after(-1)),1),_u(n,r,h)}}}function Eu(t,e){return(n,r,s)=>{if(!s)return!1;const a=n.selection;let o;if(a instanceof St)o=a;else{const u=x2(s,t,e);if(u==null)return!1;o=new St(n.doc.resolve(u))}const c=d2(o.$headCell,t,e);return c?_u(n,r,new St(o.$anchorCell,c)):!1}}function d$(t,e){const n=t.state.doc,r=Ga(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new St(r))),!0):!1}function u$(t,e,n){if(!rs(t.state))return!1;let r=i$(n);const s=t.state.selection;if(s instanceof St){r||(r={width:1,height:1,rows:[pe.from(ax(Wn(t.state.schema).cell,n))]});const a=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),c=qt.get(a).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=o$(r,c.right-c.left,c.bottom-c.top),Fw(t.state,t.dispatch,o,c,r),!0}else if(r){const a=pf(t.state),o=a.start(-1);return Fw(t.state,t.dispatch,o,qt.get(a.node(-1)).findCell(a.pos-o),r),!0}else return!1}function h$(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Bw(t,e.target);let s;if(e.shiftKey&&t.state.selection instanceof St)a(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(s=Ga(t.state.selection.$anchor))!=null&&((n=ng(t,e))===null||n===void 0?void 0:n.pos)!=s.pos)a(s,e),e.preventDefault();else if(!r)return;function a(u,h){let f=ng(t,h);const m=zi.getState(t.state)==null;if(!f||!M0(u,f))if(m)f=u;else return;const g=new St(u,f);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(zi,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),zi.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(zi,-1))}function c(u){const h=u,f=zi.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(Bw(t,h.target)!=r&&(m=ng(t,e),!m))return o();m&&a(m,h)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",c)}function x2(t,e,n){if(!(t.state.selection instanceof He))return null;const{$head:r}=t.state.selection;for(let s=r.depth-1;s>=0;s--){const a=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole=="cell"||a.type.spec.tableRole=="header_cell"){const o=r.before(s),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function Bw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ng(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:s}=n;return r>=0&&Ga(t.state.doc.resolve(r))||Ga(t.state.doc.resolve(s))}var f$=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ox(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ox(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ox(t,e,n,r,s,a){let o=0,c=!0,u=e.firstChild;const h=t.firstChild;if(h){for(let m=0,g=0;mnew r(m,n,g)),new m$(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=jr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{g$(o,c,t,s)},mouseleave:o=>{x$(o)},mousedown:(o,c)=>{y$(o,c,e,n)}},decorations:o=>{const c=jr.getState(o);if(c&&c.activeHandle>-1)return j$(o,c.activeHandle)},nodeViews:{}}});return a}var m$=class zu{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(jr);if(r&&r.setHandle!=null)return new zu(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new zu(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let s=e.mapping.map(n.activeHandle,-1);return ix(e.doc.resolve(s))||(s=-1),new zu(s,n.dragging)}return n}};function g$(t,e,n,r){if(!t.editable)return;const s=jr.getState(t.state);if(s&&!s.dragging){const a=b$(e.target);let o=-1;if(a){const{left:c,right:u}=a.getBoundingClientRect();e.clientX-c<=n?o=Vw(t,e,"left",n):u-e.clientX<=n&&(o=Vw(t,e,"right",n))}if(o!=s.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=qt.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}y2(t,o)}}}function x$(t){if(!t.editable)return;const e=jr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&y2(t,-1)}function y$(t,e,n,r){var s;if(!t.editable)return!1;const a=(s=t.dom.ownerDocument.defaultView)!==null&&s!==void 0?s:window,o=jr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=v$(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(jr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){a.removeEventListener("mouseup",h),a.removeEventListener("mousemove",f);const g=jr.getState(t.state);g!=null&&g.dragging&&(w$(t,g.activeHandle,Hw(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(jr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=jr.getState(t.state);if(g&&g.dragging){const y=Hw(g.dragging,m,n);Ww(t,g.activeHandle,y,r)}}return Ww(t,o.activeHandle,u,r),a.addEventListener("mouseup",h),a.addEventListener("mousemove",f),e.preventDefault(),!0}function v$(t,e,{colspan:n,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const a=t.domAtPos(e);let o=a.node.childNodes[a.offset].offsetWidth,c=n;if(r)for(let u=0;u{var e,n;const r=t.getAttribute("colwidth"),s=r?r.split(",").map(a=>parseInt(a,10)):null;if(!s){const a=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&a&&a[o]){const c=a[o].getAttribute("width");return c?[parseInt(c,10)]:null}}return s}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",vt(this.options.HTMLAttributes,t),0]}}),b2=fn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",vt(this.options.HTMLAttributes,t),0]}}),w2=fn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",vt(this.options.HTMLAttributes,t),0]}});function lx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Uw(t,e,n,r,s,a){var o;let c=0,u=!0,h=e.firstChild;const f=t.firstChild;if(f!==null)for(let g=0,y=0;g{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function T$(t,e,n,r,s){const a=E$(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!M$(e))return!1;let n=0;const r=rC(e.ranges[0].$from,a=>a.type.name==="table");return r==null||r.node.descendants(a=>{if(a.type.name==="table")return!1;["tableCell","tableHeader"].includes(a.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},A$="";function R$(t){return(t||"").replace(/\s+/g," ").trim()}function I$(t,e,n={}){var r;const s=(r=n.cellLineSeparator)!=null?r:A$;if(!t||!t.content||t.content.length===0)return"";const a=[];t.content.forEach(v=>{const j=[];v.content&&v.content.forEach(w=>{let k="";w.content&&Array.isArray(w.content)&&w.content.length>1?k=w.content.map(D=>e.renderChildren(D)).join(s):k=w.content?e.renderChildren(w.content):"";const E=R$(k),C=w.type==="tableHeader";j.push({text:E,isHeader:C})}),a.push(j)});const o=a.reduce((v,j)=>Math.max(v,j.length),0);if(o===0)return"";const c=new Array(o).fill(0);a.forEach(v=>{var j;for(let w=0;wc[w]&&(c[w]=E),c[w]<3&&(c[w]=3)}});const u=(v,j)=>v+" ".repeat(Math.max(0,j-v.length)),h=a[0],f=h.some(v=>v.isHeader);let m=` +`;const g=new Array(o).fill(0).map((v,j)=>f&&h[j]&&h[j].text||"");return m+=`| ${g.map((v,j)=>u(v,c[j])).join(" | ")} | +`,m+=`| ${c.map(v=>"-".repeat(Math.max(3,v))).join(" | ")} | +`,(f?a.slice(1):a).forEach(v=>{m+=`| ${new Array(o).fill(0).map((j,w)=>u(v[w]&&v[w].text||"",c[w])).join(" | ")} | +`}),m}var P$=I$,N2=fn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:S$,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=C$(t,this.options.cellMinWidth),a=e.style;function o(){return a||(r?`width: ${r}`:`min-width: ${s}`)}const c=["table",vt(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},c]:c},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(s=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const s=[];r.forEach(a=>{s.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>P$(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:a})=>{const o=T$(a.schema,t,e,n);if(s){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(He.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>H7(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>W7(t,e),deleteColumn:()=>({state:t,dispatch:e})=>K7(t,e),addRowBefore:()=>({state:t,dispatch:e})=>G7(t,e),addRowAfter:()=>({state:t,dispatch:e})=>J7(t,e),deleteRow:()=>({state:t,dispatch:e})=>Q7(t,e),deleteTable:()=>({state:t,dispatch:e})=>s$(t,e),mergeCells:()=>({state:t,dispatch:e})=>Ow(t,e),splitCell:()=>({state:t,dispatch:e})=>Dw(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>_c("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>_c("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>n$(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Ow(t,e)?!0:Dw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>e$(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>_w(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>_w(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&p2(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=St.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Tu,"Mod-Backspace":Tu,Delete:Tu,"Mod-Delete":Tu}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[p$({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],k$({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:pt($e(t,"tableRole",e))}}});Gt.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(N2.configure(this.options.table)),this.options.tableCell!==!1&&t.push(v2.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(b2.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(w2.configure(this.options.tableRow)),t}});function O$(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 + +`),e=e.replace(/]*>(.*?)<\/h2>/gi,`## $1 + +`),e=e.replace(/]*>(.*?)<\/h3>/gi,`### $1 + +`),e=e.replace(/]*>(.*?)<\/strong>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/b>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/em>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/i>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/s>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/del>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/code>/gi,"`$1`"),e=e.replace(/]*>(.*?)<\/blockquote>/gi,`> $1 + +`),e=e.replace(/]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi,"![$2]($1)"),e=e.replace(/]*src="([^"]*)"[^>]*>/gi,"![]($1)"),e=e.replace(/]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi,"[$2]($1)"),e=e.replace(/]*>(.*?)<\/li>/gi,`- $1 +`),e=e.replace(/<\/?[uo]l[^>]*>/gi,` +`),e=e.replace(//gi,` +`),e=e.replace(/]*>(.*?)<\/p>/gi,`$1 + +`),e=e.replace(//gi,`--- + +`),e=e.replace(/]*data-type="mention"[^>]*data-id="([^"]*)"[^>]*>@([^<]*)<\/span>/gi,"@$2"),e=e.replace(/]*data-type="linkTag"[^>]*data-url="([^"]*)"[^>]*>#([^<]*)<\/span>/gi,"#[$2]($1)"),e=e.replace(/<[^>]+>/g,""),e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"),e=e.replace(/\n{3,}/g,` + +`),e.trim()}function qw(t){if(!t)return"";if(t.startsWith("<")&&t.includes("$1"),e=e.replace(/^## (.+)$/gm,"

$1

"),e=e.replace(/^# (.+)$/gm,"

$1

"),e=e.replace(/\*\*(.+?)\*\*/g,"$1"),e=e.replace(/\*(.+?)\*/g,"$1"),e=e.replace(/~~(.+?)~~/g,"$1"),e=e.replace(/`([^`]+)`/g,"$1"),e=e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'$1'),e=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'$1'),e=e.replace(/^> (.+)$/gm,"

$1

"),e=e.replace(/^---$/gm,"
"),e=e.replace(/^- (.+)$/gm,"
  • $1
  • ");const n=e.split(` +`),r=[];for(const s of n){const a=s.trim();a&&(/^<(?:h[1-6]|blockquote|hr|li|ul|ol|table|img)/.test(a)?r.push(a):r.push(`

    ${a}

    `))}return r.join("")}const D$=t=>({items:({query:e})=>t.filter(n=>n.name.toLowerCase().includes(e.toLowerCase())||n.id.includes(e)).slice(0,8),render:()=>{let e=null,n=0,r=[],s=null;const a=()=>{e&&(e.innerHTML=r.map((o,c)=>`
    + @${o.name} + ${o.label||o.id} +
    `).join(""),e.querySelectorAll(".mention-item").forEach(o=>{o.addEventListener("click",()=>{const c=parseInt(o.getAttribute("data-index")||"0");s&&r[c]&&s({id:r[c].id,label:r[c].name})})}))};return{onStart:o=>{if(e=document.createElement("div"),e.className="mention-popup",document.body.appendChild(e),r=o.items,s=o.command,n=0,a(),o.clientRect){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onUpdate:o=>{if(r=o.items,s=o.command,n=0,a(),o.clientRect&&e){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onKeyDown:o=>o.event.key==="ArrowUp"?(n=Math.max(0,n-1),a(),!0):o.event.key==="ArrowDown"?(n=Math.min(r.length-1,n+1),a(),!0):o.event.key==="Enter"?(s&&r[n]&&s({id:r[n].id,label:r[n].name}),!0):o.event.key==="Escape"?(e==null||e.remove(),e=null,!0):!1,onExit:()=>{e==null||e.remove(),e=null}}}}),j2=b.forwardRef(({content:t,onChange:e,onImageUpload:n,persons:r=[],linkTags:s=[],placeholder:a="开始编辑内容...",className:o},c)=>{const u=b.useRef(null),[h,f]=b.useState(""),[m,g]=b.useState(!1),y=b.useRef(qw(t)),v=A_({extensions:[x7,b7.configure({inline:!0,allowBase64:!0}),Cz.configure({openOnClick:!1,HTMLAttributes:{class:"rich-link"}}),C7.configure({HTMLAttributes:{class:"mention-tag"},suggestion:D$(r)}),E7.configure({placeholder:a}),N2.configure({resizable:!0}),w2,v2,b2],content:y.current,onUpdate:({editor:E})=>{e(E.getHTML())},editorProps:{attributes:{class:"rich-editor-content"}}});b.useImperativeHandle(c,()=>({getHTML:()=>(v==null?void 0:v.getHTML())||"",getMarkdown:()=>O$((v==null?void 0:v.getHTML())||"")})),b.useEffect(()=>{if(v&&t!==v.getHTML()){const E=qw(t);E!==v.getHTML()&&v.commands.setContent(E)}},[t]);const j=b.useCallback(async E=>{var M;const C=(M=E.target.files)==null?void 0:M[0];if(!(!C||!v)){if(n){const D=await n(C);D&&v.chain().focus().setImage({src:D}).run()}else{const D=new FileReader;D.onload=()=>{typeof D.result=="string"&&v.chain().focus().setImage({src:D.result}).run()},D.readAsDataURL(C)}E.target.value=""}},[v,n]),w=b.useCallback(E=>{v&&v.chain().focus().insertContent({type:"text",marks:[{type:"link",attrs:{href:E.url,target:"_blank"}}],text:`#${E.label}`}).run()},[v]),k=b.useCallback(()=>{!v||!h||(v.chain().focus().setLink({href:h}).run(),f(""),g(!1))},[v,h]);return v?i.jsxs("div",{className:`rich-editor-wrapper ${o||""}`,children:[i.jsxs("div",{className:"rich-editor-toolbar",children:[i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().toggleBold().run(),className:v.isActive("bold")?"is-active":"",type:"button",children:i.jsx(CT,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleItalic().run(),className:v.isActive("italic")?"is-active":"",type:"button",children:i.jsx(EM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleStrike().run(),className:v.isActive("strike")?"is-active":"",type:"button",children:i.jsx(jA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleCode().run(),className:v.isActive("code")?"is-active":"",type:"button",children:i.jsx(KT,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),className:v.isActive("heading",{level:1})?"is-active":"",type:"button",children:i.jsx(xM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),className:v.isActive("heading",{level:2})?"is-active":"",type:"button",children:i.jsx(vM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),className:v.isActive("heading",{level:3})?"is-active":"",type:"button",children:i.jsx(wM,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().toggleBulletList().run(),className:v.isActive("bulletList")?"is-active":"",type:"button",children:i.jsx(_M,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleOrderedList().run(),className:v.isActive("orderedList")?"is-active":"",type:"button",children:i.jsx(DM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleBlockquote().run(),className:v.isActive("blockquote")?"is-active":"",type:"button",children:i.jsx(lA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().setHorizontalRule().run(),type:"button",children:i.jsx(GM,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:j,className:"hidden"}),i.jsx("button",{onClick:()=>{var E;return(E=u.current)==null?void 0:E.click()},type:"button",children:i.jsx(LN,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>g(!m),className:v.isActive("link")?"is-active":"",type:"button",children:i.jsx(gg,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",children:i.jsx(SA,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().undo().run(),disabled:!v.can().undo(),type:"button",children:i.jsx(IA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().redo().run(),disabled:!v.can().redo(),type:"button",children:i.jsx(dA,{className:"w-4 h-4"})})]}),s.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"toolbar-divider"}),i.jsx("div",{className:"toolbar-group",children:i.jsxs("select",{className:"link-tag-select",onChange:E=>{const C=s.find(M=>M.id===E.target.value);C&&w(C),E.target.value=""},defaultValue:"",children:[i.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),s.map(E=>i.jsx("option",{value:E.id,children:E.label},E.id))]})})]})]}),m&&i.jsxs("div",{className:"link-input-bar",children:[i.jsx("input",{type:"url",placeholder:"输入链接地址...",value:h,onChange:E=>f(E.target.value),onKeyDown:E=>E.key==="Enter"&&k(),className:"link-input"}),i.jsx("button",{onClick:k,className:"link-confirm",type:"button",children:"确定"}),i.jsx("button",{onClick:()=>{v.chain().focus().unsetLink().run(),g(!1)},className:"link-remove",type:"button",children:"移除"})]}),i.jsx(IC,{editor:v})]}):null});j2.displayName="RichEditor";const L$=["top","right","bottom","left"],ea=Math.min,wr=Math.max,_h=Math.round,Mu=Math.floor,ws=t=>({x:t,y:t}),_$={left:"right",right:"left",bottom:"top",top:"bottom"},z$={start:"end",end:"start"};function cx(t,e,n){return wr(t,ea(e,n))}function Zs(t,e){return typeof t=="function"?t(e):t}function ei(t){return t.split("-")[0]}function fl(t){return t.split("-")[1]}function A0(t){return t==="x"?"y":"x"}function R0(t){return t==="y"?"height":"width"}const $$=new Set(["top","bottom"]);function bs(t){return $$.has(ei(t))?"y":"x"}function I0(t){return A0(bs(t))}function F$(t,e,n){n===void 0&&(n=!1);const r=fl(t),s=I0(t),a=R0(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=zh(o)),[o,zh(o)]}function B$(t){const e=zh(t);return[dx(t),e,dx(e)]}function dx(t){return t.replace(/start|end/g,e=>z$[e])}const Gw=["left","right"],Jw=["right","left"],V$=["top","bottom"],H$=["bottom","top"];function W$(t,e,n){switch(t){case"top":case"bottom":return n?e?Jw:Gw:e?Gw:Jw;case"left":case"right":return e?V$:H$;default:return[]}}function U$(t,e,n,r){const s=fl(t);let a=W$(ei(t),n==="start",r);return s&&(a=a.map(o=>o+"-"+s),e&&(a=a.concat(a.map(dx)))),a}function zh(t){return t.replace(/left|right|bottom|top/g,e=>_$[e])}function K$(t){return{top:0,right:0,bottom:0,left:0,...t}}function k2(t){return typeof t!="number"?K$(t):{top:t,right:t,bottom:t,left:t}}function $h(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function Yw(t,e,n){let{reference:r,floating:s}=t;const a=bs(e),o=I0(e),c=R0(o),u=ei(e),h=a==="y",f=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,g=r[c]/2-s[c]/2;let y;switch(u){case"top":y={x:f,y:r.y-s.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-s.width,y:m};break;default:y={x:r.x,y:r.y}}switch(fl(e)){case"start":y[o]-=g*(n&&h?-1:1);break;case"end":y[o]+=g*(n&&h?-1:1);break}return y}async function q$(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:a,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=Zs(e,t),v=k2(y),w=c[g?m==="floating"?"reference":"floating":m],k=$h(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(w)))==null||n?w:w.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),E=m==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),M=await(a.isElement==null?void 0:a.isElement(C))?await(a.getScale==null?void 0:a.getScale(C))||{x:1,y:1}:{x:1,y:1},D=$h(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:C,strategy:u}):E);return{top:(k.top-D.top+v.top)/M.y,bottom:(D.bottom-k.bottom+v.bottom)/M.y,left:(k.left-D.left+v.left)/M.x,right:(D.right-k.right+v.right)/M.x}}const G$=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:o}=n,c=a.filter(Boolean),u=await(o.isRTL==null?void 0:o.isRTL(e));let h=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:f,y:m}=Yw(h,r,u),g=r,y={},v=0;for(let w=0;w({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:a,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=Zs(t,e)||{};if(h==null)return{};const m=k2(f),g={x:n,y:r},y=I0(s),v=R0(y),j=await o.getDimensions(h),w=y==="y",k=w?"top":"left",E=w?"bottom":"right",C=w?"clientHeight":"clientWidth",M=a.reference[v]+a.reference[y]-g[y]-a.floating[v],D=g[y]-a.reference[y],F=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let R=F?F[C]:0;(!R||!await(o.isElement==null?void 0:o.isElement(F)))&&(R=c.floating[C]||a.floating[v]);const I=M/2-D/2,A=R/2-j[v]/2-1,O=ea(m[k],A),W=ea(m[E],A),X=O,q=R-j[v]-W,Z=R/2-j[v]/2+I,_=cx(X,Z,q),$=!u.arrow&&fl(s)!=null&&Z!==_&&a.reference[v]/2-(ZZ<=0)){var W,X;const Z=(((W=a.flip)==null?void 0:W.index)||0)+1,_=R[Z];if(_&&(!(m==="alignment"?E!==bs(_):!1)||O.every(V=>bs(V.placement)===E?V.overflows[0]>0:!0)))return{data:{index:Z,overflows:O},reset:{placement:_}};let $=(X=O.filter(oe=>oe.overflows[0]<=0).sort((oe,V)=>oe.overflows[1]-V.overflows[1])[0])==null?void 0:X.placement;if(!$)switch(y){case"bestFit":{var q;const oe=(q=O.filter(V=>{if(F){const ae=bs(V.placement);return ae===E||ae==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(ae=>ae>0).reduce((ae,Y)=>ae+Y,0)]).sort((V,ae)=>V[1]-ae[1])[0])==null?void 0:q[0];oe&&($=oe);break}case"initialPlacement":$=c;break}if(s!==$)return{reset:{placement:$}}}return{}}}};function Qw(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Xw(t){return L$.some(e=>t[e]>=0)}const Q$=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...a}=Zs(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...a,elementContext:"reference"}),c=Qw(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Xw(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...a,altBoundary:!0}),c=Qw(o,n.floating);return{data:{escapedOffsets:c,escaped:Xw(c)}}}default:return{}}}}},S2=new Set(["left","top"]);async function X$(t,e){const{placement:n,platform:r,elements:s}=t,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=ei(n),c=fl(n),u=bs(n)==="y",h=S2.has(o)?-1:1,f=a&&u?-1:1,m=Zs(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof v=="number"&&(y=c==="end"?v*-1:v),u?{x:y*f,y:g*h}:{x:g*h,y:y*f}}const Z$=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:a,placement:o,middlewareData:c}=e,u=await X$(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:s+u.x,y:a+u.y,data:{...u,placement:o}}}}},eF=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:a}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:E,y:C}=k;return{x:E,y:C}}},...h}=Zs(t,e),f={x:n,y:r},m=await a.detectOverflow(e,h),g=bs(ei(s)),y=A0(g);let v=f[y],j=f[g];if(o){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",C=v+m[k],M=v-m[E];v=cx(C,v,M)}if(c){const k=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=j+m[k],M=j-m[E];j=cx(C,j,M)}const w=u.fn({...e,[y]:v,[g]:j});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[y]:o,[g]:c}}}}}},tF=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:a,middlewareData:o}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=Zs(t,e),f={x:n,y:r},m=bs(s),g=A0(m);let y=f[g],v=f[m];const j=Zs(c,e),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(u){const C=g==="y"?"height":"width",M=a.reference[g]-a.floating[C]+w.mainAxis,D=a.reference[g]+a.reference[C]-w.mainAxis;yD&&(y=D)}if(h){var k,E;const C=g==="y"?"width":"height",M=S2.has(ei(s)),D=a.reference[m]-a.floating[C]+(M&&((k=o.offset)==null?void 0:k[m])||0)+(M?0:w.crossAxis),F=a.reference[m]+a.reference[C]+(M?0:((E=o.offset)==null?void 0:E[m])||0)-(M?w.crossAxis:0);vF&&(v=F)}return{[g]:y,[m]:v}}}},nF=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:a,platform:o,elements:c}=e,{apply:u=()=>{},...h}=Zs(t,e),f=await o.detectOverflow(e,h),m=ei(s),g=fl(s),y=bs(s)==="y",{width:v,height:j}=a.floating;let w,k;m==="top"||m==="bottom"?(w=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,w=g==="end"?"top":"bottom");const E=j-f.top-f.bottom,C=v-f.left-f.right,M=ea(j-f[w],E),D=ea(v-f[k],C),F=!e.middlewareData.shift;let R=M,I=D;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(I=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(R=E),F&&!g){const O=wr(f.left,0),W=wr(f.right,0),X=wr(f.top,0),q=wr(f.bottom,0);y?I=v-2*(O!==0||W!==0?O+W:wr(f.left,f.right)):R=j-2*(X!==0||q!==0?X+q:wr(f.top,f.bottom))}await u({...e,availableWidth:I,availableHeight:R});const A=await o.getDimensions(c.floating);return v!==A.width||j!==A.height?{reset:{rects:!0}}:{}}}};function mf(){return typeof window<"u"}function pl(t){return C2(t)?(t.nodeName||"").toLowerCase():"#document"}function Sr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Cs(t){var e;return(e=(C2(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function C2(t){return mf()?t instanceof Node||t instanceof Sr(t).Node:!1}function es(t){return mf()?t instanceof Element||t instanceof Sr(t).Element:!1}function ks(t){return mf()?t instanceof HTMLElement||t instanceof Sr(t).HTMLElement:!1}function Zw(t){return!mf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Sr(t).ShadowRoot}const rF=new Set(["inline","contents"]);function Gc(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=ts(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!rF.has(s)}const sF=new Set(["table","td","th"]);function iF(t){return sF.has(pl(t))}const aF=[":popover-open",":modal"];function gf(t){return aF.some(e=>{try{return t.matches(e)}catch{return!1}})}const oF=["transform","translate","scale","rotate","perspective"],lF=["transform","translate","scale","rotate","perspective","filter"],cF=["paint","layout","strict","content"];function P0(t){const e=O0(),n=es(t)?ts(t):t;return oF.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||lF.some(r=>(n.willChange||"").includes(r))||cF.some(r=>(n.contain||"").includes(r))}function dF(t){let e=ta(t);for(;ks(e)&&!sl(e);){if(P0(e))return e;if(gf(e))return null;e=ta(e)}return null}function O0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const uF=new Set(["html","body","#document"]);function sl(t){return uF.has(pl(t))}function ts(t){return Sr(t).getComputedStyle(t)}function xf(t){return es(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ta(t){if(pl(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Zw(t)&&t.host||Cs(t);return Zw(e)?e.host:e}function E2(t){const e=ta(t);return sl(e)?t.ownerDocument?t.ownerDocument.body:t.body:ks(e)&&Gc(e)?e:E2(e)}function zc(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=E2(t),a=s===((r=t.ownerDocument)==null?void 0:r.body),o=Sr(s);if(a){const c=ux(o);return e.concat(o,o.visualViewport||[],Gc(s)?s:[],c&&n?zc(c):[])}return e.concat(s,zc(s,[],n))}function ux(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function T2(t){const e=ts(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=ks(t),a=s?t.offsetWidth:n,o=s?t.offsetHeight:r,c=_h(n)!==a||_h(r)!==o;return c&&(n=a,r=o),{width:n,height:r,$:c}}function D0(t){return es(t)?t:t.contextElement}function Go(t){const e=D0(t);if(!ks(e))return ws(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:a}=T2(e);let o=(a?_h(n.width):n.width)/r,c=(a?_h(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const hF=ws(0);function M2(t){const e=Sr(t);return!O0()||!e.visualViewport?hF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function fF(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Sr(t)?!1:e}function Ya(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=D0(t);let o=ws(1);e&&(r?es(r)&&(o=Go(r)):o=Go(t));const c=fF(a,n,r)?M2(a):ws(0);let u=(s.left+c.x)/o.x,h=(s.top+c.y)/o.y,f=s.width/o.x,m=s.height/o.y;if(a){const g=Sr(a),y=r&&es(r)?Sr(r):r;let v=g,j=ux(v);for(;j&&r&&y!==v;){const w=Go(j),k=j.getBoundingClientRect(),E=ts(j),C=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*w.x,M=k.top+(j.clientTop+parseFloat(E.paddingTop))*w.y;u*=w.x,h*=w.y,f*=w.x,m*=w.y,u+=C,h+=M,v=Sr(j),j=ux(v)}}return $h({width:f,height:m,x:u,y:h})}function yf(t,e){const n=xf(t).scrollLeft;return e?e.left+n:Ya(Cs(t)).left+n}function A2(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-yf(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function pF(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const a=s==="fixed",o=Cs(r),c=e?gf(e.floating):!1;if(r===o||c&&a)return n;let u={scrollLeft:0,scrollTop:0},h=ws(1);const f=ws(0),m=ks(r);if((m||!m&&!a)&&((pl(r)!=="body"||Gc(o))&&(u=xf(r)),ks(r))){const y=Ya(r);h=Go(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=o&&!m&&!a?A2(o,u):ws(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+g.x,y:n.y*h.y-u.scrollTop*h.y+f.y+g.y}}function mF(t){return Array.from(t.getClientRects())}function gF(t){const e=Cs(t),n=xf(t),r=t.ownerDocument.body,s=wr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=wr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+yf(t);const c=-n.scrollTop;return ts(r).direction==="rtl"&&(o+=wr(e.clientWidth,r.clientWidth)-s),{width:s,height:a,x:o,y:c}}const eN=25;function xF(t,e){const n=Sr(t),r=Cs(t),s=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,c=0,u=0;if(s){a=s.width,o=s.height;const f=O0();(!f||f&&e==="fixed")&&(c=s.offsetLeft,u=s.offsetTop)}const h=yf(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),y=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-y);v<=eN&&(a-=v)}else h<=eN&&(a+=h);return{width:a,height:o,x:c,y:u}}const yF=new Set(["absolute","fixed"]);function vF(t,e){const n=Ya(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,a=ks(t)?Go(t):ws(1),o=t.clientWidth*a.x,c=t.clientHeight*a.y,u=s*a.x,h=r*a.y;return{width:o,height:c,x:u,y:h}}function tN(t,e,n){let r;if(e==="viewport")r=xF(t,n);else if(e==="document")r=gF(Cs(t));else if(es(e))r=vF(e,n);else{const s=M2(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return $h(r)}function R2(t,e){const n=ta(t);return n===e||!es(n)||sl(n)?!1:ts(n).position==="fixed"||R2(n,e)}function bF(t,e){const n=e.get(t);if(n)return n;let r=zc(t,[],!1).filter(c=>es(c)&&pl(c)!=="body"),s=null;const a=ts(t).position==="fixed";let o=a?ta(t):t;for(;es(o)&&!sl(o);){const c=ts(o),u=P0(o);!u&&c.position==="fixed"&&(s=null),(a?!u&&!s:!u&&c.position==="static"&&!!s&&yF.has(s.position)||Gc(o)&&!u&&R2(t,o))?r=r.filter(f=>f!==o):s=c,o=ta(o)}return e.set(t,r),r}function wF(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?gf(e)?[]:bF(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=tN(e,f,s);return h.top=wr(m.top,h.top),h.right=ea(m.right,h.right),h.bottom=ea(m.bottom,h.bottom),h.left=wr(m.left,h.left),h},tN(e,c,s));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function NF(t){const{width:e,height:n}=T2(t);return{width:e,height:n}}function jF(t,e,n){const r=ks(e),s=Cs(e),a=n==="fixed",o=Ya(t,!0,a,e);let c={scrollLeft:0,scrollTop:0};const u=ws(0);function h(){u.x=yf(s)}if(r||!r&&!a)if((pl(e)!=="body"||Gc(s))&&(c=xf(e)),r){const y=Ya(e,!0,a,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else s&&h();a&&!r&&s&&h();const f=s&&!r&&!a?A2(s,c):ws(0),m=o.left+c.scrollLeft-u.x-f.x,g=o.top+c.scrollTop-u.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function rg(t){return ts(t).position==="static"}function nN(t,e){if(!ks(t)||ts(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Cs(t)===n&&(n=n.ownerDocument.body),n}function I2(t,e){const n=Sr(t);if(gf(t))return n;if(!ks(t)){let s=ta(t);for(;s&&!sl(s);){if(es(s)&&!rg(s))return s;s=ta(s)}return n}let r=nN(t,e);for(;r&&iF(r)&&rg(r);)r=nN(r,e);return r&&sl(r)&&rg(r)&&!P0(r)?n:r||dF(t)||n}const kF=async function(t){const e=this.getOffsetParent||I2,n=this.getDimensions,r=await n(t.floating);return{reference:jF(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function SF(t){return ts(t).direction==="rtl"}const CF={convertOffsetParentRelativeRectToViewportRelativeRect:pF,getDocumentElement:Cs,getClippingRect:wF,getOffsetParent:I2,getElementRects:kF,getClientRects:mF,getDimensions:NF,getScale:Go,isElement:es,isRTL:SF};function P2(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function EF(t,e){let n=null,r;const s=Cs(t);function a(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),a();const h=t.getBoundingClientRect(),{left:f,top:m,width:g,height:y}=h;if(c||e(),!g||!y)return;const v=Mu(m),j=Mu(s.clientWidth-(f+g)),w=Mu(s.clientHeight-(m+y)),k=Mu(f),C={rootMargin:-v+"px "+-j+"px "+-w+"px "+-k+"px",threshold:wr(0,ea(1,u))||1};let M=!0;function D(F){const R=F[0].intersectionRatio;if(R!==u){if(!M)return o();R?o(!1,R):r=setTimeout(()=>{o(!1,1e-7)},1e3)}R===1&&!P2(h,t.getBoundingClientRect())&&o(),M=!1}try{n=new IntersectionObserver(D,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(D,C)}n.observe(t)}return o(!0),a}function TF(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=D0(t),f=s||a?[...h?zc(h):[],...zc(e)]:[];f.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),a&&k.addEventListener("resize",n)});const m=h&&c?EF(h,n):null;let g=-1,y=null;o&&(y=new ResizeObserver(k=>{let[E]=k;E&&E.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=y)==null||C.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let v,j=u?Ya(t):null;u&&w();function w(){const k=Ya(t);j&&!P2(j,k)&&n(),j=k,v=requestAnimationFrame(w)}return n(),()=>{var k;f.forEach(E=>{s&&E.removeEventListener("scroll",n),a&&E.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(v)}}const MF=Z$,AF=eF,RF=Y$,IF=nF,PF=Q$,rN=J$,OF=tF,DF=(t,e,n)=>{const r=new Map,s={platform:CF,...n},a={...s.platform,_c:r};return G$(t,e,{...s,platform:a})};var LF=typeof document<"u",_F=function(){},$u=LF?b.useLayoutEffect:_F;function Fh(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Fh(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(!(a==="_owner"&&t.$$typeof)&&!Fh(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function O2(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function sN(t,e){const n=O2(t);return Math.round(e*n)/n}function sg(t){const e=b.useRef(t);return $u(()=>{e.current=t}),e}function zF(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=b.useState(r);Fh(g,r)||y(r);const[v,j]=b.useState(null),[w,k]=b.useState(null),E=b.useCallback(V=>{V!==F.current&&(F.current=V,j(V))},[]),C=b.useCallback(V=>{V!==R.current&&(R.current=V,k(V))},[]),M=a||v,D=o||w,F=b.useRef(null),R=b.useRef(null),I=b.useRef(f),A=u!=null,O=sg(u),W=sg(s),X=sg(h),q=b.useCallback(()=>{if(!F.current||!R.current)return;const V={placement:e,strategy:n,middleware:g};W.current&&(V.platform=W.current),DF(F.current,R.current,V).then(ae=>{const Y={...ae,isPositioned:X.current!==!1};Z.current&&!Fh(I.current,Y)&&(I.current=Y,Fc.flushSync(()=>{m(Y)}))})},[g,e,n,W,X]);$u(()=>{h===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,m(V=>({...V,isPositioned:!1})))},[h]);const Z=b.useRef(!1);$u(()=>(Z.current=!0,()=>{Z.current=!1}),[]),$u(()=>{if(M&&(F.current=M),D&&(R.current=D),M&&D){if(O.current)return O.current(M,D,q);q()}},[M,D,q,O,A]);const _=b.useMemo(()=>({reference:F,floating:R,setReference:E,setFloating:C}),[E,C]),$=b.useMemo(()=>({reference:M,floating:D}),[M,D]),oe=b.useMemo(()=>{const V={position:n,left:0,top:0};if(!$.floating)return V;const ae=sN($.floating,f.x),Y=sN($.floating,f.y);return c?{...V,transform:"translate("+ae+"px, "+Y+"px)",...O2($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ae,top:Y}},[n,c,$.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:q,refs:_,elements:$,floatingStyles:oe}),[f,q,_,$,oe])}const $F=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?rN({element:r.current,padding:s}).fn(n):{}:r?rN({element:r,padding:s}).fn(n):{}}}},FF=(t,e)=>({...MF(t),options:[t,e]}),BF=(t,e)=>({...AF(t),options:[t,e]}),VF=(t,e)=>({...OF(t),options:[t,e]}),HF=(t,e)=>({...RF(t),options:[t,e]}),WF=(t,e)=>({...IF(t),options:[t,e]}),UF=(t,e)=>({...PF(t),options:[t,e]}),KF=(t,e)=>({...$F(t),options:[t,e]});var qF="Arrow",D2=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...a}=t;return i.jsx(ot.svg,{...a,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});D2.displayName=qF;var GF=D2,L0="Popper",[L2,_2]=ia(L0),[JF,z2]=L2(L0),$2=t=>{const{__scopePopper:e,children:n}=t,[r,s]=b.useState(null);return i.jsx(JF,{scope:e,anchor:r,onAnchorChange:s,children:n})};$2.displayName=L0;var F2="PopperAnchor",B2=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,a=z2(F2,n),o=b.useRef(null),c=mt(e,o),u=b.useRef(null);return b.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&a.onAnchorChange(u.current)}),r?null:i.jsx(ot.div,{...s,ref:c})});B2.displayName=F2;var _0="PopperContent",[YF,QF]=L2(_0),V2=b.forwardRef((t,e)=>{var ee,de,Ce,B,me,Se;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:a="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:v,...j}=t,w=z2(_0,n),[k,E]=b.useState(null),C=mt(e,rt=>E(rt)),[M,D]=b.useState(null),F=_x(M),R=(F==null?void 0:F.width)??0,I=(F==null?void 0:F.height)??0,A=r+(a!=="center"?"-"+a:""),O=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},W=Array.isArray(h)?h:[h],X=W.length>0,q={padding:O,boundary:W.filter(ZF),altBoundary:X},{refs:Z,floatingStyles:_,placement:$,isPositioned:oe,middlewareData:V}=zF({strategy:"fixed",placement:A,whileElementsMounted:(...rt)=>TF(...rt,{animationFrame:y==="always"}),elements:{reference:w.anchor},middleware:[FF({mainAxis:s+I,alignmentAxis:o}),u&&BF({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?VF():void 0,...q}),u&&HF({...q}),WF({...q,apply:({elements:rt,rects:Ye,availableWidth:st,availableHeight:Qe})=>{const{width:Xe,height:ft}=Ye.reference,Pt=rt.floating.style;Pt.setProperty("--radix-popper-available-width",`${st}px`),Pt.setProperty("--radix-popper-available-height",`${Qe}px`),Pt.setProperty("--radix-popper-anchor-width",`${Xe}px`),Pt.setProperty("--radix-popper-anchor-height",`${ft}px`)}}),M&&KF({element:M,padding:c}),eB({arrowWidth:R,arrowHeight:I}),g&&UF({strategy:"referenceHidden",...q})]}),[ae,Y]=U2($),L=Qi(v);Vn(()=>{oe&&(L==null||L())},[oe,L]);const H=(ee=V.arrow)==null?void 0:ee.x,ue=(de=V.arrow)==null?void 0:de.y,U=((Ce=V.arrow)==null?void 0:Ce.centerOffset)!==0,[he,Q]=b.useState();return Vn(()=>{k&&Q(window.getComputedStyle(k).zIndex)},[k]),i.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{..._,transform:oe?_.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(B=V.transformOrigin)==null?void 0:B.x,(me=V.transformOrigin)==null?void 0:me.y].join(" "),...((Se=V.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i.jsx(YF,{scope:n,placedSide:ae,onArrowChange:D,arrowX:H,arrowY:ue,shouldHideArrow:U,children:i.jsx(ot.div,{"data-side":ae,"data-align":Y,...j,ref:C,style:{...j.style,animation:oe?void 0:"none"}})})})});V2.displayName=_0;var H2="PopperArrow",XF={top:"bottom",right:"left",bottom:"top",left:"right"},W2=b.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,a=QF(H2,r),o=XF[a.placedSide];return i.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:i.jsx(GF,{...s,ref:n,style:{...s.style,display:"block"}})})});W2.displayName=H2;function ZF(t){return t!==null}var eB=t=>({name:"transformOrigin",options:t,fn(e){var w,k,E;const{placement:n,rects:r,middlewareData:s}=e,o=((w=s.arrow)==null?void 0:w.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=U2(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=s.arrow)==null?void 0:k.x)??0)+c/2,y=(((E=s.arrow)==null?void 0:E.y)??0)+u/2;let v="",j="";return h==="bottom"?(v=o?m:`${g}px`,j=`${-u}px`):h==="top"?(v=o?m:`${g}px`,j=`${r.floating.height+u}px`):h==="right"?(v=`${-u}px`,j=o?m:`${y}px`):h==="left"&&(v=`${r.floating.width+u}px`,j=o?m:`${y}px`),{data:{x:v,y:j}}}});function U2(t){const[e,n="center"]=t.split("-");return[e,n]}var tB=$2,nB=B2,rB=V2,sB=W2,K2=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),iB="VisuallyHidden",aB=b.forwardRef((t,e)=>i.jsx(ot.span,{...t,ref:e,style:{...K2,...t.style}}));aB.displayName=iB;var oB=[" ","Enter","ArrowUp","ArrowDown"],lB=[" ","Enter"],Qa="Select",[vf,bf,cB]=Ox(Qa),[ml]=ia(Qa,[cB,_2]),wf=_2(),[dB,ca]=ml(Qa),[uB,hB]=ml(Qa),q2=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:a,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:y,form:v}=t,j=wf(e),[w,k]=b.useState(null),[E,C]=b.useState(null),[M,D]=b.useState(!1),F=Gh(h),[R,I]=Ba({prop:r,defaultProp:s??!1,onChange:a,caller:Qa}),[A,O]=Ba({prop:o,defaultProp:c,onChange:u,caller:Qa}),W=b.useRef(null),X=w?v||!!w.closest("form"):!0,[q,Z]=b.useState(new Set),_=Array.from(q).map($=>$.props.value).join(";");return i.jsx(tB,{...j,children:i.jsxs(dB,{required:y,scope:e,trigger:w,onTriggerChange:k,valueNode:E,onValueNodeChange:C,valueNodeHasChildren:M,onValueNodeHasChildrenChange:D,contentId:Ki(),value:A,onValueChange:O,open:R,onOpenChange:I,dir:F,triggerPointerDownPosRef:W,disabled:g,children:[i.jsx(vf.Provider,{scope:e,children:i.jsx(uB,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback($=>{Z(oe=>new Set(oe).add($))},[]),onNativeOptionRemove:b.useCallback($=>{Z(oe=>{const V=new Set(oe);return V.delete($),V})},[]),children:n})}),X?i.jsxs(mE,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:A,onChange:$=>O($.target.value),disabled:g,form:v,children:[A===void 0?i.jsx("option",{value:""}):null,Array.from(q)]},_):null]})})};q2.displayName=Qa;var G2="SelectTrigger",J2=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,a=wf(n),o=ca(G2,n),c=o.disabled||r,u=mt(e,o.onTriggerChange),h=bf(n),f=b.useRef("touch"),[m,g,y]=xE(j=>{const w=h().filter(C=>!C.disabled),k=w.find(C=>C.value===o.value),E=yE(w,j,k);E!==void 0&&o.onValueChange(E.value)}),v=j=>{c||(o.onOpenChange(!0),y()),j&&(o.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return i.jsx(nB,{asChild:!0,...a,children:i.jsx(ot.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":gE(o.value)?"":void 0,...s,ref:u,onClick:nt(s.onClick,j=>{j.currentTarget.focus(),f.current!=="mouse"&&v(j)}),onPointerDown:nt(s.onPointerDown,j=>{f.current=j.pointerType;const w=j.target;w.hasPointerCapture(j.pointerId)&&w.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(v(j),j.preventDefault())}),onKeyDown:nt(s.onKeyDown,j=>{const w=m.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&g(j.key),!(w&&j.key===" ")&&oB.includes(j.key)&&(v(),j.preventDefault())})})})});J2.displayName=G2;var Y2="SelectValue",Q2=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:a,placeholder:o="",...c}=t,u=ca(Y2,n),{onValueNodeHasChildrenChange:h}=u,f=a!==void 0,m=mt(e,u.onValueNodeChange);return Vn(()=>{h(f)},[h,f]),i.jsx(ot.span,{...c,ref:m,style:{pointerEvents:"none"},children:gE(u.value)?i.jsx(i.Fragment,{children:o}):a})});Q2.displayName=Y2;var fB="SelectIcon",X2=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return i.jsx(ot.span,{"aria-hidden":!0,...s,ref:e,children:r||"▼"})});X2.displayName=fB;var pB="SelectPortal",Z2=t=>i.jsx(Mx,{asChild:!0,...t});Z2.displayName=pB;var Xa="SelectContent",eE=b.forwardRef((t,e)=>{const n=ca(Xa,t.__scopeSelect),[r,s]=b.useState();if(Vn(()=>{s(new DocumentFragment)},[]),!n.open){const a=r;return a?Fc.createPortal(i.jsx(tE,{scope:t.__scopeSelect,children:i.jsx(vf.Slot,{scope:t.__scopeSelect,children:i.jsx("div",{children:t.children})})}),a):null}return i.jsx(nE,{...t,ref:e})});eE.displayName=Xa;var Jr=10,[tE,da]=ml(Xa),mB="SelectContentImpl",gB=Sc("SelectContent.RemoveScroll"),nE=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:j,avoidCollisions:w,...k}=t,E=ca(Xa,n),[C,M]=b.useState(null),[D,F]=b.useState(null),R=mt(e,ee=>M(ee)),[I,A]=b.useState(null),[O,W]=b.useState(null),X=bf(n),[q,Z]=b.useState(!1),_=b.useRef(!1);b.useEffect(()=>{if(C)return mj(C)},[C]),aj();const $=b.useCallback(ee=>{const[de,...Ce]=X().map(Se=>Se.ref.current),[B]=Ce.slice(-1),me=document.activeElement;for(const Se of ee)if(Se===me||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===de&&D&&(D.scrollTop=0),Se===B&&D&&(D.scrollTop=D.scrollHeight),Se==null||Se.focus(),document.activeElement!==me))return},[X,D]),oe=b.useCallback(()=>$([I,C]),[$,I,C]);b.useEffect(()=>{q&&oe()},[q,oe]);const{onOpenChange:V,triggerPointerDownPosRef:ae}=E;b.useEffect(()=>{if(C){let ee={x:0,y:0};const de=B=>{var me,Se;ee={x:Math.abs(Math.round(B.pageX)-(((me=ae.current)==null?void 0:me.x)??0)),y:Math.abs(Math.round(B.pageY)-(((Se=ae.current)==null?void 0:Se.y)??0))}},Ce=B=>{ee.x<=10&&ee.y<=10?B.preventDefault():C.contains(B.target)||V(!1),document.removeEventListener("pointermove",de),ae.current=null};return ae.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",Ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",Ce,{capture:!0})}}},[C,V,ae]),b.useEffect(()=>{const ee=()=>V(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[V]);const[Y,L]=xE(ee=>{const de=X().filter(me=>!me.disabled),Ce=de.find(me=>me.ref.current===document.activeElement),B=yE(de,ee,Ce);B&&setTimeout(()=>B.ref.current.focus())}),H=b.useCallback((ee,de,Ce)=>{const B=!_.current&&!Ce;(E.value!==void 0&&E.value===de||B)&&(A(ee),B&&(_.current=!0))},[E.value]),ue=b.useCallback(()=>C==null?void 0:C.focus(),[C]),U=b.useCallback((ee,de,Ce)=>{const B=!_.current&&!Ce;(E.value!==void 0&&E.value===de||B)&&W(ee)},[E.value]),he=r==="popper"?hx:rE,Q=he===hx?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:j,avoidCollisions:w}:{};return i.jsx(tE,{scope:n,content:C,viewport:D,onViewportChange:F,itemRefCallback:H,selectedItem:I,onItemLeave:ue,itemTextRefCallback:U,focusSelectedItem:oe,selectedItemText:O,position:r,isPositioned:q,searchRef:Y,children:i.jsx(Ax,{as:gB,allowPinchZoom:!0,children:i.jsx(Tx,{asChild:!0,trapped:E.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:nt(s,ee=>{var de;(de=E.trigger)==null||de.focus({preventScroll:!0}),ee.preventDefault()}),children:i.jsx(Ex,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:i.jsx(he,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:ee=>ee.preventDefault(),...k,...Q,onPlaced:()=>Z(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:nt(k.onKeyDown,ee=>{const de=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!de&&ee.key.length===1&&L(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let B=X().filter(me=>!me.disabled).map(me=>me.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(B=B.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const me=ee.target,Se=B.indexOf(me);B=B.slice(Se+1)}setTimeout(()=>$(B)),ee.preventDefault()}})})})})})})});nE.displayName=mB;var xB="SelectItemAlignedPosition",rE=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,a=ca(Xa,n),o=da(Xa,n),[c,u]=b.useState(null),[h,f]=b.useState(null),m=mt(e,R=>f(R)),g=bf(n),y=b.useRef(!1),v=b.useRef(!0),{viewport:j,selectedItem:w,selectedItemText:k,focusSelectedItem:E}=o,C=b.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&h&&j&&w&&k){const R=a.trigger.getBoundingClientRect(),I=h.getBoundingClientRect(),A=a.valueNode.getBoundingClientRect(),O=k.getBoundingClientRect();if(a.dir!=="rtl"){const me=O.left-I.left,Se=A.left-me,rt=R.left-Se,Ye=R.width+rt,st=Math.max(Ye,I.width),Qe=window.innerWidth-Jr,Xe=qu(Se,[Jr,Math.max(Jr,Qe-st)]);c.style.minWidth=Ye+"px",c.style.left=Xe+"px"}else{const me=I.right-O.right,Se=window.innerWidth-A.right-me,rt=window.innerWidth-R.right-Se,Ye=R.width+rt,st=Math.max(Ye,I.width),Qe=window.innerWidth-Jr,Xe=qu(Se,[Jr,Math.max(Jr,Qe-st)]);c.style.minWidth=Ye+"px",c.style.right=Xe+"px"}const W=g(),X=window.innerHeight-Jr*2,q=j.scrollHeight,Z=window.getComputedStyle(h),_=parseInt(Z.borderTopWidth,10),$=parseInt(Z.paddingTop,10),oe=parseInt(Z.borderBottomWidth,10),V=parseInt(Z.paddingBottom,10),ae=_+$+q+V+oe,Y=Math.min(w.offsetHeight*5,ae),L=window.getComputedStyle(j),H=parseInt(L.paddingTop,10),ue=parseInt(L.paddingBottom,10),U=R.top+R.height/2-Jr,he=X-U,Q=w.offsetHeight/2,ee=w.offsetTop+Q,de=_+$+ee,Ce=ae-de;if(de<=U){const me=W.length>0&&w===W[W.length-1].ref.current;c.style.bottom="0px";const Se=h.clientHeight-j.offsetTop-j.offsetHeight,rt=Math.max(he,Q+(me?ue:0)+Se+oe),Ye=de+rt;c.style.height=Ye+"px"}else{const me=W.length>0&&w===W[0].ref.current;c.style.top="0px";const rt=Math.max(U,_+j.offsetTop+(me?H:0)+Q)+Ce;c.style.height=rt+"px",j.scrollTop=de-U+j.offsetTop}c.style.margin=`${Jr}px 0`,c.style.minHeight=Y+"px",c.style.maxHeight=X+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,a.trigger,a.valueNode,c,h,j,w,k,a.dir,r]);Vn(()=>C(),[C]);const[M,D]=b.useState();Vn(()=>{h&&D(window.getComputedStyle(h).zIndex)},[h]);const F=b.useCallback(R=>{R&&v.current===!0&&(C(),E==null||E(),v.current=!1)},[C,E]);return i.jsx(vB,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:F,children:i.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:i.jsx(ot.div,{...s,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});rE.displayName=xB;var yB="SelectPopperPosition",hx=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Jr,...a}=t,o=wf(n);return i.jsx(rB,{...o,...a,ref:e,align:r,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});hx.displayName=yB;var[vB,z0]=ml(Xa,{}),fx="SelectViewport",sE=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,a=da(fx,n),o=z0(fx,n),c=mt(e,a.onViewportChange),u=b.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),i.jsx(vf.Slot,{scope:n,children:i.jsx(ot.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:nt(s.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const y=Math.abs(u.current-f.scrollTop);if(y>0){const v=window.innerHeight-Jr*2,j=parseFloat(m.style.minHeight),w=parseFloat(m.style.height),k=Math.max(j,w);if(k0?M:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});sE.displayName=fx;var iE="SelectGroup",[bB,wB]=ml(iE),NB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Ki();return i.jsx(bB,{scope:n,id:s,children:i.jsx(ot.div,{role:"group","aria-labelledby":s,...r,ref:e})})});NB.displayName=iE;var aE="SelectLabel",jB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=wB(aE,n);return i.jsx(ot.div,{id:s.id,...r,ref:e})});jB.displayName=aE;var Bh="SelectItem",[kB,oE]=ml(Bh),lE=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:a,...o}=t,c=ca(Bh,n),u=da(Bh,n),h=c.value===r,[f,m]=b.useState(a??""),[g,y]=b.useState(!1),v=mt(e,E=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,E,r,s)}),j=Ki(),w=b.useRef("touch"),k=()=>{s||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(kB,{scope:n,value:r,disabled:s,textId:j,isSelected:h,onItemTextChange:b.useCallback(E=>{m(C=>C||((E==null?void 0:E.textContent)??"").trim())},[]),children:i.jsx(vf.ItemSlot,{scope:n,value:r,disabled:s,textValue:f,children:i.jsx(ot.div,{role:"option","aria-labelledby":j,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:v,onFocus:nt(o.onFocus,()=>y(!0)),onBlur:nt(o.onBlur,()=>y(!1)),onClick:nt(o.onClick,()=>{w.current!=="mouse"&&k()}),onPointerUp:nt(o.onPointerUp,()=>{w.current==="mouse"&&k()}),onPointerDown:nt(o.onPointerDown,E=>{w.current=E.pointerType}),onPointerMove:nt(o.onPointerMove,E=>{var C;w.current=E.pointerType,s?(C=u.onItemLeave)==null||C.call(u):w.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:nt(o.onPointerLeave,E=>{var C;E.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:nt(o.onKeyDown,E=>{var M;((M=u.searchRef)==null?void 0:M.current)!==""&&E.key===" "||(lB.includes(E.key)&&k(),E.key===" "&&E.preventDefault())})})})})});lE.displayName=Bh;var oc="SelectItemText",cE=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...a}=t,o=ca(oc,n),c=da(oc,n),u=oE(oc,n),h=hB(oc,n),[f,m]=b.useState(null),g=mt(e,k=>m(k),u.onItemTextChange,k=>{var E;return(E=c.itemTextRefCallback)==null?void 0:E.call(c,k,u.value,u.disabled)}),y=f==null?void 0:f.textContent,v=b.useMemo(()=>i.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:j,onNativeOptionRemove:w}=h;return Vn(()=>(j(v),()=>w(v)),[j,w,v]),i.jsxs(i.Fragment,{children:[i.jsx(ot.span,{id:u.textId,...a,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Fc.createPortal(a.children,o.valueNode):null]})});cE.displayName=oc;var dE="SelectItemIndicator",uE=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return oE(dE,n).isSelected?i.jsx(ot.span,{"aria-hidden":!0,...r,ref:e}):null});uE.displayName=dE;var px="SelectScrollUpButton",hE=b.forwardRef((t,e)=>{const n=da(px,t.__scopeSelect),r=z0(px,t.__scopeSelect),[s,a]=b.useState(!1),o=mt(e,r.onScrollButtonChange);return Vn(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollTop>0;a(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?i.jsx(pE,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});hE.displayName=px;var mx="SelectScrollDownButton",fE=b.forwardRef((t,e)=>{const n=da(mx,t.__scopeSelect),r=z0(mx,t.__scopeSelect),[s,a]=b.useState(!1),o=mt(e,r.onScrollButtonChange);return Vn(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?i.jsx(pE,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});fE.displayName=mx;var pE=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,a=da("SelectScrollButton",n),o=b.useRef(null),c=bf(n),u=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>u(),[u]),Vn(()=>{var f;const h=c().find(m=>m.ref.current===document.activeElement);(f=h==null?void 0:h.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),i.jsx(ot.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:nt(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:nt(s.onPointerMove,()=>{var h;(h=a.onItemLeave)==null||h.call(a),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:nt(s.onPointerLeave,()=>{u()})})}),SB="SelectSeparator",CB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return i.jsx(ot.div,{"aria-hidden":!0,...r,ref:e})});CB.displayName=SB;var gx="SelectArrow",EB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=wf(n),a=ca(gx,n),o=da(gx,n);return a.open&&o.position==="popper"?i.jsx(sB,{...s,...r,ref:e}):null});EB.displayName=gx;var TB="SelectBubbleInput",mE=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const s=b.useRef(null),a=mt(r,s),o=Lx(e);return b.useEffect(()=>{const c=s.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),i.jsx(ot.select,{...n,style:{...K2,...n.style},ref:a,defaultValue:e})});mE.displayName=TB;function gE(t){return t===""||t===void 0}function xE(t){const e=Qi(t),n=b.useRef(""),r=b.useRef(0),s=b.useCallback(o=>{const c=n.current+o;e(c),(function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[e]),a=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,a]}function yE(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,a=n?t.indexOf(n):-1;let o=MB(t,Math.max(a,0));s.length===1&&(o=o.filter(h=>h!==n));const u=o.find(h=>h.textValue.toLowerCase().startsWith(s.toLowerCase()));return u!==n?u:void 0}function MB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var AB=q2,vE=J2,RB=Q2,IB=X2,PB=Z2,bE=eE,OB=sE,wE=lE,DB=cE,LB=uE,_B=hE,zB=fE;const ec=AB,tc=RB,zo=b.forwardRef(({className:t,children:e,...n},r)=>i.jsxs(vE,{ref:r,className:gt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,i.jsx(IB,{asChild:!0,children:i.jsx(jc,{className:"h-4 w-4 opacity-50"})})]}));zo.displayName=vE.displayName;const $o=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>i.jsx(PB,{children:i.jsxs(bE,{ref:s,className:gt("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1",t),position:n,...r,children:[i.jsx(_B,{className:"flex cursor-default items-center justify-center py-1",children:i.jsx(RN,{className:"h-4 w-4"})}),i.jsx(OB,{className:"p-1",children:e}),i.jsx(zB,{className:"flex cursor-default items-center justify-center py-1",children:i.jsx(jc,{className:"h-4 w-4"})})]})}));$o.displayName=bE.displayName;const Ws=b.forwardRef(({className:t,children:e,...n},r)=>i.jsxs(wE,{ref:r,className:gt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(LB,{children:i.jsx(Wh,{className:"h-4 w-4"})})}),i.jsx(DB,{children:e})]}));Ws.displayName=wE.displayName;const $B=["一","二","三","四","五","六","七","八","九","十"];function ig(t){return t.startsWith("part:")?{type:"part",id:t.slice(5)}:t.startsWith("chapter:")?{type:"chapter",id:t.slice(8)}:t.startsWith("section:")?{type:"section",id:t.slice(8)}:null}function FB({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:s,onDeleteSection:a,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:y,onShowSectionOrders:v,pinnedSectionIds:j=[]}){const[w,k]=b.useState(null),[E,C]=b.useState(null),M=(O,W)=>(w==null?void 0:w.type)===O&&(w==null?void 0:w.id)===W,D=(O,W)=>(E==null?void 0:E.type)===O&&(E==null?void 0:E.id)===W,F=b.useCallback(()=>{const O=[];for(const W of t)for(const X of W.chapters)for(const q of X.sections)O.push({id:q.id,partId:W.id,partTitle:W.title,chapterId:X.id,chapterTitle:X.title});return O},[t]),R=b.useCallback(async(O,W,X,q)=>{var V;O.preventDefault(),O.stopPropagation();const Z=O.dataTransfer.getData("text/plain"),_=ig(Z);if(!_||_.type===W&&_.id===X)return;const $=F(),oe=new Map($.map(ae=>[ae.id,ae]));if(_.type==="part"&&W==="part"){const ae=t.map(U=>U.id),Y=ae.indexOf(_.id),L=ae.indexOf(X);if(Y===-1||L===-1)return;const H=[...ae];H.splice(Y,1),H.splice(YQ.id===U);if(he)for(const Q of he.chapters)for(const ee of Q.sections){const de=oe.get(ee.id);de&&ue.push(de)}}await r(ue);return}if(_.type==="chapter"&&(W==="chapter"||W==="section"||W==="part")){const ae=t.find(de=>de.chapters.some(Ce=>Ce.id===_.id)),Y=ae==null?void 0:ae.chapters.find(de=>de.id===_.id);if(!ae||!Y)return;let L,H,ue=null;if(W==="section"){const de=oe.get(X);if(!de)return;L=de.partId,H=de.partTitle,ue=X}else if(W==="chapter"){const de=t.find(me=>me.chapters.some(Se=>Se.id===X)),Ce=de==null?void 0:de.chapters.find(me=>me.id===X);if(!de||!Ce)return;L=de.id,H=de.title;const B=$.filter(me=>me.chapterId===X).pop();ue=(B==null?void 0:B.id)??null}else{const de=t.find(B=>B.id===X);if(!de||!de.chapters[0])return;L=de.id,H=de.title;const Ce=$.filter(B=>B.partId===de.id&&B.chapterId===de.chapters[0].id);ue=((V=Ce[Ce.length-1])==null?void 0:V.id)??null}const U=Y.sections.map(de=>de.id),he=$.filter(de=>!U.includes(de.id));let Q=he.length;if(ue){const de=he.findIndex(Ce=>Ce.id===ue);de>=0&&(Q=de+1)}const ee=U.map(de=>({...oe.get(de),partId:L,partTitle:H,chapterId:Y.id,chapterTitle:Y.title}));await r([...he.slice(0,Q),...ee,...he.slice(Q)]);return}if(_.type==="section"&&(W==="section"||W==="chapter"||W==="part")){if(!q)return;const{partId:ae,partTitle:Y,chapterId:L,chapterTitle:H}=q;let ue;if(W==="section")ue=$.findIndex(Ce=>Ce.id===X);else if(W==="chapter"){const Ce=$.filter(B=>B.chapterId===X).pop();ue=Ce?$.findIndex(B=>B.id===Ce.id)+1:$.length}else{const Ce=t.find(Se=>Se.id===X);if(!(Ce!=null&&Ce.chapters[0]))return;const B=$.filter(Se=>Se.partId===Ce.id&&Se.chapterId===Ce.chapters[0].id),me=B[B.length-1];ue=me?$.findIndex(Se=>Se.id===me.id)+1:0}const U=$.findIndex(Ce=>Ce.id===_.id);if(U===-1)return;const he=$.filter(Ce=>Ce.id!==_.id),Q=U({onDragEnter:q=>{q.preventDefault(),q.stopPropagation(),q.dataTransfer.dropEffect="move",C({type:O,id:W})},onDragOver:q=>{q.preventDefault(),q.stopPropagation(),q.dataTransfer.dropEffect="move",C({type:O,id:W})},onDragLeave:()=>C(null),onDrop:q=>{C(null);const Z=ig(q.dataTransfer.getData("text/plain"));if(Z&&!(O==="section"&&Z.type==="section"&&Z.id===W))if(O==="part")if(Z.type==="part")R(q,"part",W);else{const _=t.find(oe=>oe.id===W);(_==null?void 0:_.chapters[0])&&X&&R(q,"part",W,X)}else O==="chapter"&&X?(Z.type==="section"||Z.type==="chapter")&&R(q,"chapter",W,X):O==="section"&&X&&R(q,"section",W,X)}}),A=O=>$B[O]??String(O+1);return i.jsx("div",{className:"space-y-3",children:t.map((O,W)=>{var Y,L,H,ue;const X=O.title==="序言"||O.title.includes("序言"),q=O.title==="尾声"||O.title.includes("尾声"),Z=O.title==="附录"||O.title.includes("附录"),_=D("part",O.id),$=e.includes(O.id),oe=O.chapters.length,V=O.chapters.reduce((U,he)=>U+he.sections.length,0);if(X&&O.chapters.length===1&&O.chapters[0].sections.length===1){const U=O.chapters[0].sections[0],he=D("section",U.id),Q={partId:O.id,partTitle:O.title,chapterId:O.chapters[0].id,chapterTitle:O.chapters[0].title};return i.jsxs("div",{draggable:!0,onDragStart:ee=>{ee.stopPropagation(),ee.dataTransfer.setData("text/plain","section:"+U.id),ee.dataTransfer.effectAllowed="move",k({type:"section",id:U.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${he?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${M("section",U.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",U.id,Q),children:[i.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[i.jsx(_s,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ee=>ee.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(U.id),onChange:()=>y(U.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:i.jsx(zr,{className:"w-4 h-4 text-gray-400"})}),i.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[O.chapters[0].title," | ",U.title]}),j.includes(U.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Vo,{className:"w-3.5 h-3.5 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:ee=>ee.stopPropagation(),onClick:ee=>ee.stopPropagation(),children:[U.price===0||U.isFree?i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):i.jsxs("span",{className:"text-xs text-gray-500",children:["¥",U.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",U.clickCount??0," · 付款 ",U.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(U.hotScore??0).toFixed(1)," · 第",U.hotRank&&U.hotRank>0?U.hotRank:"-","名"]}),v&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(U),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(bt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(U),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]})]},O.id)}if(O.title==="2026每日派对干货"||O.title.includes("2026每日派对干货")){const U=D("part",O.id);return i.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${U?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...I("part",O.id,{partId:O.id,partTitle:O.title,chapterId:((Y=O.chapters[0])==null?void 0:Y.id)??"",chapterTitle:((L=O.chapters[0])==null?void 0:L.title)??""}),children:[i.jsxs("div",{draggable:!0,onDragStart:he=>{he.stopPropagation(),he.dataTransfer.setData("text/plain","part:"+O.id),he.dataTransfer.effectAllowed="move",k({type:"part",id:O.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${M("part",O.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>n(O.id),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx(_s,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),i.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-white text-base",children:O.title}),i.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",V," 节"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:he=>he.stopPropagation(),onClick:he=>he.stopPropagation(),children:[o&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:i.jsx(Lt,{className:"w-3.5 h-3.5"})}),h&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:i.jsx(bt,{className:"w-3.5 h-3.5"})}),f&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(O),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:i.jsx(vn,{className:"w-3.5 h-3.5"})}),i.jsxs("span",{className:"text-xs text-gray-500",children:[oe,"章"]}),$?i.jsx(jc,{className:"w-5 h-5 text-gray-500"}):i.jsx(Fo,{className:"w-5 h-5 text-gray-500"})]})]}),$&&O.chapters.length>0&&i.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:O.chapters.map(he=>i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 w-full",children:[i.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:he.title}),i.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:Q=>Q.stopPropagation(),children:[m&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>m(O,he),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:i.jsx(bt,{className:"w-3.5 h-3.5"})}),c&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>c(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:i.jsx(Lt,{className:"w-3.5 h-3.5"})}),u&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>u(O,he),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx("div",{className:"space-y-1 pl-2",children:he.sections.map(Q=>{const ee=D("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+Q.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:Q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${ee?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${M("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",Q.id,{partId:O.id,partTitle:O.title,chapterId:he.id,chapterTitle:he.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx(_s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(Q.id),onChange:()=>y(Q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[Q.id," ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Vo,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",Q.clickCount??0," · 付款 ",Q.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Q.hotScore??0).toFixed(1)," · 第",Q.hotRank&&Q.hotRank>0?Q.hotRank:"-","名"]}),v&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(bt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]},Q.id)})})]},he.id))})]},O.id)}if(Z)return i.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),i.jsx("div",{className:"space-y-3",children:O.chapters.map((U,he)=>U.sections.length>0?U.sections.map(Q=>{const ee=D("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+Q.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:Q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${ee?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${M("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",Q.id,{partId:O.id,partTitle:O.title,chapterId:U.id,chapterTitle:U.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx(_s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(Q.id),onChange:()=>y(Q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",he+1," | ",U.title," | ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Vo,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",Q.clickCount??0," · 付款 ",Q.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Q.hotScore??0).toFixed(1)," · 第",Q.hotRank&&Q.hotRank>0?Q.hotRank:"-","名"]}),v&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(bt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx(Fo,{className:"w-4 h-4 text-gray-500 shrink-0"})]},Q.id)}):i.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[i.jsxs("span",{className:"text-sm text-gray-500",children:["附录",he+1," | ",U.title,"(空)"]}),i.jsx(Fo,{className:"w-4 h-4 text-gray-500 shrink-0"})]},U.id))})]},O.id);if(q&&O.chapters.length===1&&O.chapters[0].sections.length===1){const U=O.chapters[0].sections[0],he=D("section",U.id),Q={partId:O.id,partTitle:O.title,chapterId:O.chapters[0].id,chapterTitle:O.chapters[0].title};return i.jsxs("div",{draggable:!0,onDragStart:ee=>{ee.stopPropagation(),ee.dataTransfer.setData("text/plain","section:"+U.id),ee.dataTransfer.effectAllowed="move",k({type:"section",id:U.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${he?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${M("section",U.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",U.id,Q),children:[i.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[i.jsx(_s,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ee=>ee.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(U.id),onChange:()=>y(U.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:i.jsx(zr,{className:"w-4 h-4 text-gray-400"})}),i.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[O.chapters[0].title," | ",U.title]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:ee=>ee.stopPropagation(),onClick:ee=>ee.stopPropagation(),children:[U.price===0||U.isFree?i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):i.jsxs("span",{className:"text-xs text-gray-500",children:["¥",U.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",U.clickCount??0," · 付款 ",U.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(U.hotScore??0).toFixed(1)," · 第",U.hotRank&&U.hotRank>0?U.hotRank:"-","名"]}),v&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(U),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(bt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(U),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]})]},O.id)}return q?i.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),i.jsx("div",{className:"space-y-3",children:O.chapters.map(U=>U.sections.map(he=>{const Q=D("section",he.id);return i.jsxs("div",{draggable:!0,onDragStart:ee=>{ee.stopPropagation(),ee.dataTransfer.setData("text/plain","section:"+he.id),ee.dataTransfer.effectAllowed="move",k({type:"section",id:he.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${Q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${M("section",he.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",he.id,{partId:O.id,partTitle:O.title,chapterId:U.id,chapterTitle:U.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx(_s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ee=>ee.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(he.id),onChange:()=>y(he.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsxs("span",{className:"text-sm text-gray-300",children:[U.title," | ",he.title]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",he.clickCount??0," · 付款 ",he.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(he.hotScore??0).toFixed(1)," · 第",he.hotRank&&he.hotRank>0?he.hotRank:"-","名"]}),v&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(he),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(he),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(bt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(he),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]})]},he.id)}))})]},O.id):i.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${_?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...I("part",O.id,{partId:O.id,partTitle:O.title,chapterId:((H=O.chapters[0])==null?void 0:H.id)??"",chapterTitle:((ue=O.chapters[0])==null?void 0:ue.title)??""}),children:[i.jsxs("div",{draggable:!0,onDragStart:U=>{U.stopPropagation(),U.dataTransfer.setData("text/plain","part:"+O.id),U.dataTransfer.effectAllowed="move",k({type:"part",id:O.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${M("part",O.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>n(O.id),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx(_s,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),i.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:A(W)}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-white text-base",children:O.title}),i.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",V," 节"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:U=>U.stopPropagation(),onClick:U=>U.stopPropagation(),children:[o&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:i.jsx(Lt,{className:"w-3.5 h-3.5"})}),h&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:i.jsx(bt,{className:"w-3.5 h-3.5"})}),f&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(O),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:i.jsx(vn,{className:"w-3.5 h-3.5"})}),i.jsxs("span",{className:"text-xs text-gray-500",children:[oe,"章"]}),$?i.jsx(jc,{className:"w-5 h-5 text-gray-500"}):i.jsx(Fo,{className:"w-5 h-5 text-gray-500"})]})]}),$&&i.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:O.chapters.map(U=>{const he=D("chapter",U.id);return i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 w-full",children:[i.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","chapter:"+U.id),Q.dataTransfer.effectAllowed="move",k({type:"chapter",id:U.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:Q=>{Q.preventDefault(),Q.stopPropagation(),Q.dataTransfer.dropEffect="move",C({type:"chapter",id:U.id})},onDragOver:Q=>{Q.preventDefault(),Q.stopPropagation(),Q.dataTransfer.dropEffect="move",C({type:"chapter",id:U.id})},onDragLeave:()=>C(null),onDrop:Q=>{C(null);const ee=ig(Q.dataTransfer.getData("text/plain"));if(!ee)return;const de={partId:O.id,partTitle:O.title,chapterId:U.id,chapterTitle:U.title};(ee.type==="section"||ee.type==="chapter")&&R(Q,"chapter",U.id,de)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${he?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${M("chapter",U.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[i.jsx(_s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),i.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:U.title})]}),i.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:Q=>Q.stopPropagation(),children:[m&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>m(O,U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:i.jsx(bt,{className:"w-3.5 h-3.5"})}),c&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>c(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:i.jsx(Lt,{className:"w-3.5 h-3.5"})}),u&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>u(O,U),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx("div",{className:"space-y-1 pl-2",children:U.sections.map(Q=>{const ee=D("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+Q.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:Q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${ee?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${M("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...I("section",Q.id,{partId:O.id,partTitle:O.title,chapterId:U.id,chapterTitle:U.title}),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(Q.id),onChange:()=>y(Q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsx(_s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),i.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${Q.price===0||Q.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),i.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[Q.id," ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Vo,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:de=>de.stopPropagation(),onClick:de=>de.stopPropagation(),children:[Q.isNew&&i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),Q.price===0||Q.isFree?i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):i.jsxs("span",{className:"text-xs text-gray-500",children:["¥",Q.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",Q.clickCount??0," · 付款 ",Q.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Q.hotScore??0).toFixed(1)," · 第",Q.hotRank&&Q.hotRank>0?Q.hotRank:"-","名"]}),v&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),i.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(bt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]})]},Q.id)})})]},U.id)})})]},O.id)})})}function BB(t){const e=new Map;for(const c of t){const u=c.partId||"part-1",h=c.partTitle||"未分类",f=c.chapterId||"chapter-1",m=c.chapterTitle||"未分类";e.has(u)||e.set(u,{id:u,title:h,chapters:new Map});const g=e.get(u);g.chapters.has(f)||g.chapters.set(f,{id:f,title:m,sections:[]}),g.chapters.get(f).sections.push({id:c.id,title:c.title,price:c.price??1,filePath:c.filePath,isFree:c.isFree,isNew:c.isNew,clickCount:c.clickCount??0,payCount:c.payCount??0,hotScore:c.hotScore??0,hotRank:c.hotRank??0})}const n="part-2026-daily",r="2026每日派对干货";Array.from(e.values()).some(c=>c.title===r||c.title.includes(r))||e.set(n,{id:n,title:r,chapters:new Map([["chapter-2026-daily",{id:"chapter-2026-daily",title:r,sections:[]}]])});const a=Array.from(e.values()).map(c=>({...c,chapters:Array.from(c.chapters.values())})),o=c=>c.includes("序言")?0:c.includes(r)?1.5:c.includes("附录")?2:c.includes("尾声")?3:1;return a.sort((c,u)=>{const h=o(c.title),f=o(u.title);return h!==f?h-f:0})}function VB(){var gr,nd,rr;const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState([]),[o,c]=b.useState(null),[u,h]=b.useState(!1),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,j]=b.useState(""),[w,k]=b.useState([]),[E,C]=b.useState(!1),[M,D]=b.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),[F,R]=b.useState(null),[I,A]=b.useState(!1),[O,W]=b.useState(!1),[X,q]=b.useState(null),[Z,_]=b.useState(!1),[$,oe]=b.useState([]),[V,ae]=b.useState(!1),[Y,L]=b.useState(""),[H,ue]=b.useState(""),[U,he]=b.useState(!1),[Q,ee]=b.useState(""),[de,Ce]=b.useState(!1),[B,me]=b.useState(null),[Se,rt]=b.useState(!1),[Ye,st]=b.useState(!1),[Qe,Xe]=b.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[ft,Pt]=b.useState(!1),[Jt,Kn]=b.useState(!1),[qn,ss]=b.useState(1),[zt,Cr]=b.useState([]),[is,On]=b.useState(!1),[pn,mr]=b.useState(20),[Br,Gn]=b.useState(!1),[fe,ge]=b.useState(!1),[Sn,ri]=b.useState([]),[Es,ua]=b.useState([]),[Jn,as]=b.useState({personId:"",name:"",label:""}),[jt,Cn]=b.useState({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),Yn=b.useRef(null),Dn=BB(t),ha=t.length,si=[...t].sort((P,ie)=>(ie.hotScore??0)-(P.hotScore??0)),Er=10,ii=Math.max(1,Math.ceil(si.length/Er)),ai=si.slice((qn-1)*Er,qn*Er),mn=async()=>{r(!0);try{const P=await Be("/api/db/book?action=list",{cache:"no-store"});e(Array.isArray(P==null?void 0:P.sections)?P.sections:[])}catch(P){console.error(P),e([])}finally{r(!1)}};b.useEffect(()=>{mn()},[]);const ls=P=>{a(ie=>ie.includes(P)?ie.filter(Ae=>Ae!==P):[...ie,P])},oi=b.useCallback(P=>{const ie=t,Ae=P.flatMap(Re=>{const Ot=ie.find(Vt=>Vt.id===Re.id);return Ot?[{...Ot,partId:Re.partId,partTitle:Re.partTitle,chapterId:Re.chapterId,chapterTitle:Re.chapterTitle}]:[]});return e(Ae),Rt("/api/db/book",{action:"reorder",items:P}).then(Re=>{Re&&Re.success===!1&&(e(ie),alert("排序失败: "+(Re&&typeof Re=="object"&&"error"in Re?Re.error:"未知错误")))}).catch(Re=>{e(ie),console.error("排序失败:",Re),alert("排序失败: "+(Re instanceof Error?Re.message:"网络或服务异常"))}),Promise.resolve()},[t]),cs=async P=>{if(confirm(`确定要删除章节「${P.title}」吗?此操作不可恢复。`))try{const ie=await Yr(`/api/db/book?id=${encodeURIComponent(P.id)}`);ie&&ie.success!==!1?(alert("已删除"),mn()):alert("删除失败: "+(ie&&typeof ie=="object"&&"error"in ie?ie.error:"未知错误"))}catch(ie){console.error(ie),alert("删除失败")}},fa=b.useCallback(async()=>{Pt(!0);try{const P=await Be("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),ie=P&&P.data;ie&&typeof ie.readWeight=="number"&&typeof ie.recencyWeight=="number"&&typeof ie.payWeight=="number"&&Xe({readWeight:Math.max(0,Math.min(1,ie.readWeight)),recencyWeight:Math.max(0,Math.min(1,ie.recencyWeight)),payWeight:Math.max(0,Math.min(1,ie.payWeight))})}catch{}finally{Pt(!1)}},[]);b.useEffect(()=>{Ye&&fa()},[Ye,fa]);const ds=async()=>{const{readWeight:P,recencyWeight:ie,payWeight:Ae}=Qe,Re=P+ie+Ae;if(Math.abs(Re-1)>.001){alert("三个权重之和必须等于 1");return}Kn(!0);try{const Ot=await ht("/api/db/config",{key:"article_ranking_weights",value:{readWeight:P,recencyWeight:ie,payWeight:Ae},description:"文章排名算法权重"});Ot&&Ot.success!==!1?(alert("已保存"),mn()):alert("保存失败: "+(Ot&&typeof Ot=="object"&&"error"in Ot?Ot.error:""))}catch(Ot){console.error(Ot),alert("保存失败")}finally{Kn(!1)}},G=b.useCallback(async()=>{On(!0);try{const P=await Be("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),ie=P&&P.data;Array.isArray(ie)&&Cr(ie)}catch{}finally{On(!1)}},[]),Ke=b.useCallback(async()=>{try{const P=await Be("/api/db/persons");P!=null&&P.success&&P.persons&&ri(P.persons.map(ie=>({id:ie.personId,name:ie.name,label:ie.label})))}catch{}},[]),Ze=b.useCallback(async()=>{try{const P=await Be("/api/db/link-tags");P!=null&&P.success&&P.linkTags&&ua(P.linkTags.map(ie=>({id:ie.tagId,label:ie.label,url:ie.url,type:ie.type,appId:ie.appId,pagePath:ie.pagePath})))}catch{}},[]),En=async P=>{const ie=zt.includes(P)?zt.filter(Ae=>Ae!==P):[...zt,P];Cr(ie);try{await ht("/api/db/config",{key:"pinned_section_ids",value:ie,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{Cr(zt)}},Vr=b.useCallback(async()=>{Gn(!0);try{const P=await Be("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),ie=P&&P.data;typeof ie=="number"&&ie>0&&ie<=100&&mr(ie)}catch{}finally{Gn(!1)}},[]),Nf=async()=>{if(pn<1||pn>100){alert("预览比例需在 1~100 之间");return}ge(!0);try{const P=await ht("/api/db/config",{key:"unpaid_preview_percent",value:pn,description:"小程序未付费内容默认预览比例(%)"});P&&P.success!==!1?alert("已保存"):alert("保存失败: "+(P.error||""))}catch{alert("保存失败")}finally{ge(!1)}};b.useEffect(()=>{G(),Vr(),Ke(),Ze()},[G,Vr,Ke,Ze]);const us=async P=>{me({section:P,orders:[]}),rt(!0);try{const ie=await Be(`/api/db/book?action=section-orders&id=${encodeURIComponent(P.id)}`),Ae=ie!=null&&ie.success&&Array.isArray(ie.orders)?ie.orders:[];me(Re=>Re?{...Re,orders:Ae}:null)}catch(ie){console.error(ie),me(Ae=>Ae?{...Ae,orders:[]}:null)}finally{rt(!1)}},no=async P=>{m(!0);try{const ie=await Be(`/api/db/book?action=read&id=${encodeURIComponent(P.id)}`);if(ie!=null&&ie.success&&ie.section){const Ae=ie.section;c({id:P.id,originalId:P.id,title:ie.section.title??P.title,price:ie.section.price??P.price,content:ie.section.content??"",filePath:P.filePath,isFree:P.isFree||P.price===0,isNew:Ae.isNew??P.isNew,isPinned:zt.includes(P.id),hotScore:P.hotScore??0})}else c({id:P.id,originalId:P.id,title:P.title,price:P.price,content:"",filePath:P.filePath,isFree:P.isFree,isNew:P.isNew,isPinned:zt.includes(P.id),hotScore:P.hotScore??0}),ie&&!ie.success&&alert("无法读取文件内容: "+(ie.error||"未知错误"))}catch(ie){console.error(ie),c({id:P.id,title:P.title,price:P.price,content:"",filePath:P.filePath,isFree:P.isFree})}finally{m(!1)}},Jc=async()=>{var P;if(o){y(!0);try{let ie=o.content||"";const Ae=[new RegExp(`^#+\\s*${o.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${o.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(P=o.title)==null?void 0:P.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const hs of Ae)ie=ie.replace(hs,"");ie=ie.replace(/^\s*\n+/,"").trim();const Re=o.originalId||o.id,Ot=o.id!==Re,Vt=await Rt("/api/db/book",{id:Re,...Ot?{newId:o.id}:{},title:o.title,price:o.isFree?0:o.price,content:ie,isFree:o.isFree||o.price===0,isNew:o.isNew,hotScore:o.hotScore,saveToFile:!0}),Ln=Ot?o.id:Re;o.isPinned!==zt.includes(Ln)&&await En(Ln),Vt&&Vt.success!==!1?(alert(`已保存章节: ${o.title}`),c(null),mn()):alert("保存失败: "+(Vt&&typeof Vt=="object"&&"error"in Vt?Vt.error:"未知错误"))}catch(ie){console.error(ie),alert("保存失败")}finally{y(!1)}}},jf=async()=>{if(!M.id||!M.title){alert("请填写章节ID和标题");return}y(!0);try{const P=await Rt("/api/db/book",{id:M.id,title:M.title,price:M.price,content:M.content,partId:M.partId,chapterId:M.chapterId,saveToFile:!1});P&&P.success!==!1?(alert(`章节创建成功: ${M.title}`),h(!1),D({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),mn()):alert("创建失败: "+(P&&typeof P=="object"&&"error"in P?P.error:"未知错误"))}catch(P){console.error(P),alert("创建失败")}finally{y(!1)}},Yc=P=>{D(ie=>{var Ae;return{...ie,partId:P.id,chapterId:((Ae=P.chapters[0])==null?void 0:Ae.id)??"chapter-1"}}),h(!0)},Qc=P=>{R({id:P.id,title:P.title})},Xc=async()=>{var P;if((P=F==null?void 0:F.title)!=null&&P.trim()){A(!0);try{const ie=t.map(Re=>({id:Re.id,partId:Re.partId||"part-1",partTitle:Re.partId===F.id?F.title.trim():Re.partTitle||"",chapterId:Re.chapterId||"chapter-1",chapterTitle:Re.chapterTitle||""})),Ae=await Rt("/api/db/book",{action:"reorder",items:ie});Ae&&Ae.success!==!1?(R(null),mn()):alert("更新篇名失败: "+(Ae&&typeof Ae=="object"&&"error"in Ae?Ae.error:"未知错误"))}catch(ie){console.error(ie),alert("更新篇名失败")}finally{A(!1)}}},Zc=P=>{const ie=P.chapters.length+1,Ae=`chapter-${P.id}-${ie}-${Date.now()}`;D({id:`${ie}.1`,title:"新章节",price:1,partId:P.id,chapterId:Ae,content:""}),h(!0)},kf=(P,ie)=>{q({part:P,chapter:ie,title:ie.title})},Sf=async()=>{var P;if((P=X==null?void 0:X.title)!=null&&P.trim()){_(!0);try{const ie=t.map(Re=>({id:Re.id,partId:Re.partId||X.part.id,partTitle:Re.partId===X.part.id?X.part.title:Re.partTitle||"",chapterId:Re.chapterId||X.chapter.id,chapterTitle:Re.partId===X.part.id&&Re.chapterId===X.chapter.id?X.title.trim():Re.chapterTitle||""})),Ae=await Rt("/api/db/book",{action:"reorder",items:ie});Ae&&Ae.success!==!1?(q(null),mn()):alert("保存失败: "+(Ae&&typeof Ae=="object"&&"error"in Ae?Ae.error:"未知错误"))}catch(ie){console.error(ie),alert("保存失败")}finally{_(!1)}}},$t=async(P,ie)=>{const Ae=ie.sections.map(Re=>Re.id);if(Ae.length===0){alert("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${P.chapters.indexOf(ie)+1}章 | ${ie.title}」吗?将删除共 ${Ae.length} 节,此操作不可恢复。`))try{for(const Re of Ae)await Yr(`/api/db/book?id=${encodeURIComponent(Re)}`);mn()}catch(Re){console.error(Re),alert("删除失败")}},Cf=async()=>{if(!Q.trim()){alert("请输入篇名");return}Ce(!0);try{const P=`part-new-${Date.now()}`,ie="chapter-1",Ae=`part-placeholder-${Date.now()}`,Re=await Rt("/api/db/book",{id:Ae,title:"占位节(可编辑)",price:0,content:"",partId:P,partTitle:Q.trim(),chapterId:ie,chapterTitle:"第1章 | 待编辑",saveToFile:!1});Re&&Re.success!==!1?(alert(`篇「${Q}」创建成功,请编辑占位节`),W(!1),ee(""),mn()):alert("创建失败: "+(Re&&typeof Re=="object"&&"error"in Re?Re.error:"未知错误"))}catch(P){console.error(P),alert("创建失败")}finally{Ce(!1)}},gl=async()=>{if($.length===0){alert("请先勾选要移动的章节");return}const P=Dn.find(Ae=>Ae.id===Y),ie=P==null?void 0:P.chapters.find(Ae=>Ae.id===H);if(!P||!ie||!Y||!H){alert("请选择目标篇和章");return}he(!0);try{const Ae=()=>{const Ln=new Set($),hs=t.map(sn=>({id:sn.id,partId:sn.partId||"",partTitle:sn.partTitle||"",chapterId:sn.chapterId||"",chapterTitle:sn.chapterTitle||""})),Ef=hs.filter(sn=>Ln.has(sn.id)).map(sn=>({...sn,partId:Y,partTitle:P.title||Y,chapterId:H,chapterTitle:ie.title||H})),Ts=hs.filter(sn=>!Ln.has(sn.id));let io=Ts.length;for(let sn=Ts.length-1;sn>=0;sn-=1){const li=Ts[sn];if(li.partId===Y&&li.chapterId===H){io=sn+1;break}}return[...Ts.slice(0,io),...Ef,...Ts.slice(io)]},Re=async()=>{const Ln=Ae(),hs=await Rt("/api/db/book",{action:"reorder",items:Ln});return hs&&hs.success!==!1?(alert(`已移动 ${$.length} 节到「${P.title}」-「${ie.title}」`),ae(!1),oe([]),await mn(),!0):!1},Ot={action:"move-sections",sectionIds:$,targetPartId:Y,targetChapterId:H,targetPartTitle:P.title||Y,targetChapterTitle:ie.title||H},Vt=await Rt("/api/db/book",Ot);if(Vt&&Vt.success!==!1)alert(`已移动 ${Vt.count??$.length} 节到「${P.title}」-「${ie.title}」`),ae(!1),oe([]),await mn();else{const Ln=Vt&&typeof Vt=="object"&&"error"in Vt?Vt.error||"":"未知错误";if((Ln.includes("缺少 id")||Ln.includes("无效的 action"))&&await Re())return;alert("移动失败: "+Ln)}}catch(Ae){console.error(Ae),alert("移动失败: "+(Ae instanceof Error?Ae.message:"网络或服务异常"))}finally{he(!1)}},ed=P=>{oe(ie=>ie.includes(P)?ie.filter(Ae=>Ae!==P):[...ie,P])},ro=async P=>{const ie=t.filter(Ae=>Ae.partId===P.id).map(Ae=>Ae.id);if(ie.length===0){alert("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${P.title}」整篇吗?将删除共 ${ie.length} 节内容,此操作不可恢复。`))try{for(const Ae of ie)await Yr(`/api/db/book?id=${encodeURIComponent(Ae)}`);mn()}catch(Ae){console.error(Ae),alert("删除失败")}},td=async()=>{var P;if(v.trim()){C(!0);try{const ie=await Be(`/api/search?q=${encodeURIComponent(v)}`);ie!=null&&ie.success&&((P=ie.data)!=null&&P.results)?k(ie.data.results):(k([]),ie&&!ie.success&&alert("搜索失败: "+ie.error))}catch(ie){console.error(ie),k([]),alert("搜索失败")}finally{C(!1)}}},so=Dn.find(P=>P.id===M.partId),pa=(so==null?void 0:so.chapters)??[];return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),i.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",Dn.length," 篇 · ",ha," 节内容"]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(re,{onClick:()=>st(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[i.jsx(fm,{className:"w-4 h-4 mr-2"}),"排名算法"]}),i.jsxs(re,{onClick:()=>{const P=typeof window<"u"?`${window.location.origin}/api-doc`:"";P&&window.open(P,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(Gs,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),i.jsx(Qt,{open:u,onOpenChange:h,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Lt,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节ID *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:M.id,onChange:P=>D({...M,id:P.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:M.price,onChange:P=>D({...M,price:Number(P.target.value)})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节标题 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:M.title,onChange:P=>D({...M,title:P.target.value})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"所属篇"}),i.jsxs(ec,{value:M.partId,onValueChange:P=>D({...M,partId:P,chapterId:"chapter-1"}),children:[i.jsx(zo,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(tc,{})}),i.jsxs($o,{className:"bg-[#0f2137] border-gray-700",children:[Dn.map(P=>i.jsx(Ws,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id)),Dn.length===0&&i.jsx(Ws,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"所属章"}),i.jsxs(ec,{value:M.chapterId,onValueChange:P=>D({...M,chapterId:P}),children:[i.jsx(zo,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(tc,{})}),i.jsxs($o,{className:"bg-[#0f2137] border-gray-700",children:[pa.map(P=>i.jsx(Ws,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id)),pa.length===0&&i.jsx(Ws,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"内容 (Markdown格式)"}),i.jsx(dl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[300px] font-mono text-sm placeholder:text-gray-500",placeholder:"输入章节内容...",value:M.content,onChange:P=>D({...M,content:P.target.value})})]})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>h(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:jf,disabled:g||!M.id||!M.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),i.jsx(Qt,{open:!!F,onOpenChange:P=>!P&&R(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(bt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),F&&i.jsx("div",{className:"space-y-4 py-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"篇名"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:F.title,onChange:P=>R({...F,title:P.target.value}),placeholder:"输入篇名"})]})}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>R(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:Xc,disabled:I||!((gr=F==null?void 0:F.title)!=null&&gr.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:I?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),i.jsx(Qt,{open:!!X,onOpenChange:P=>!P&&q(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(bt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),X&&i.jsx("div",{className:"space-y-4 py-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:X.title,onChange:P=>q({...X,title:P.target.value}),placeholder:"输入章节名称"})]})}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>q(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:Sf,disabled:Z||!((nd=X==null?void 0:X.title)!=null&&nd.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Z?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),i.jsx(Qt,{open:V,onOpenChange:P=>{var ie;if(ae(P),P&&Dn.length>0){const Ae=Dn[0];L(Ae.id),ue(((ie=Ae.chapters[0])==null?void 0:ie.id)??"")}},children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:"批量移动至指定目录"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",i.jsx("span",{className:"text-[#38bdac] font-medium",children:$.length})," 节,请选择目标篇与章。"]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目标篇"}),i.jsxs(ec,{value:Y,onValueChange:P=>{var Ae;L(P);const ie=Dn.find(Re=>Re.id===P);ue(((Ae=ie==null?void 0:ie.chapters[0])==null?void 0:Ae.id)??"")},children:[i.jsx(zo,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(tc,{placeholder:"选择篇"})}),i.jsx($o,{className:"bg-[#0f2137] border-gray-700",children:Dn.map(P=>i.jsx(Ws,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目标章"}),i.jsxs(ec,{value:H,onValueChange:ue,children:[i.jsx(zo,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(tc,{placeholder:"选择章"})}),i.jsx($o,{className:"bg-[#0f2137] border-gray-700",children:(((rr=Dn.find(P=>P.id===Y))==null?void 0:rr.chapters)??[]).map(P=>i.jsx(Ws,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id))})]})]})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>ae(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:gl,disabled:U||$.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:U?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),i.jsx(Qt,{open:!!B,onOpenChange:P=>!P&&me(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white",children:["付款记录 — ",(B==null?void 0:B.section.title)??""]})}),i.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Se?i.jsxs("div",{className:"flex items-center justify-center py-8",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):B&&B.orders.length===0?i.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):B?i.jsxs("table",{className:"w-full text-sm border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[i.jsx("th",{className:"py-2 pr-2",children:"订单号"}),i.jsx("th",{className:"py-2 pr-2",children:"用户ID"}),i.jsx("th",{className:"py-2 pr-2",children:"金额"}),i.jsx("th",{className:"py-2 pr-2",children:"状态"}),i.jsx("th",{className:"py-2 pr-2",children:"支付时间"})]})}),i.jsx("tbody",{children:B.orders.map(P=>i.jsxs("tr",{className:"border-b border-gray-700/50",children:[i.jsx("td",{className:"py-2 pr-2",children:i.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${P.orderSn}`,onClick:()=>window.open(`/orders?search=${P.orderSn??P.id??""}`,"_blank"),children:P.orderSn?P.orderSn.length>16?P.orderSn.slice(0,8)+"..."+P.orderSn.slice(-6):P.orderSn:"-"})}),i.jsx("td",{className:"py-2 pr-2",children:i.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${P.userId??P.openId??""}`,onClick:()=>window.open(`/users?search=${P.userId??P.openId??""}`,"_blank"),children:(()=>{const ie=P.userId??P.openId??"-";return ie.length>12?ie.slice(0,6)+"..."+ie.slice(-4):ie})()})}),i.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",P.amount??0]}),i.jsx("td",{className:"py-2 pr-2 text-gray-300",children:P.status??"-"}),i.jsx("td",{className:"py-2 pr-2 text-gray-500",children:P.payTime??P.createdAt??"-"})]},P.id??P.orderSn??""))})]}):null})]})}),i.jsx(Qt,{open:Ye,onOpenChange:st,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(fm,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),i.jsxs("div",{className:"space-y-4 py-2",children:[i.jsx("p",{className:"text-sm text-gray-400",children:"热度积分 = 阅读权重×阅读排名分 + 新度权重×新度排名分 + 付款权重×付款排名分(三权重之和须为 1)"}),ft?i.jsx("p",{className:"text-gray-500",children:"加载中..."}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"阅读权重"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Qe.readWeight,onChange:P=>Xe(ie=>({...ie,readWeight:Math.max(0,Math.min(1,parseFloat(P.target.value)||0))}))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"新度权重"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Qe.recencyWeight,onChange:P=>Xe(ie=>({...ie,recencyWeight:Math.max(0,Math.min(1,parseFloat(P.target.value)||0))}))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"付款权重"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Qe.payWeight,onChange:P=>Xe(ie=>({...ie,payWeight:Math.max(0,Math.min(1,parseFloat(P.target.value)||0))}))})]})]}),i.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(Qe.readWeight+Qe.recencyWeight+Qe.payWeight).toFixed(1)]}),i.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[i.jsx("li",{children:"阅读量前 20 名:第1名=20分、第2名=19分...第20名=1分"}),i.jsx("li",{children:"最近更新前 30 篇:第1名=30分、第2名=29分...第30名=1分"}),i.jsx("li",{children:"付款数前 20 名:第1名=20分、第2名=19分...第20名=1分"}),i.jsx("li",{children:"热度分可在编辑章节中手动覆盖"})]}),i.jsx(re,{onClick:ds,disabled:Jt||Math.abs(Qe.readWeight+Qe.recencyWeight+Qe.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Jt?"保存中...":"保存权重"})]})]})]})}),i.jsx(Qt,{open:O,onOpenChange:W,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Lt,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),i.jsx("div",{className:"space-y-4 py-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:Q,onChange:P=>ee(P.target.value),placeholder:"输入篇名"})]})}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>{W(!1),ee("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:Cf,disabled:de||!Q.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:de?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),i.jsx(Qt,{open:!!o,onOpenChange:()=>c(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[i.jsx(Xt,{className:"shrink-0 px-6 pt-6 pb-2",children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(bt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),o&&i.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.id,onChange:P=>c({...o,id:P.target.value}),placeholder:"如: 9.15"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.isFree?0:o.price,onChange:P=>c({...o,price:Number(P.target.value),isFree:Number(P.target.value)===0}),disabled:o.isFree})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"免费"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:o.isFree||o.price===0,onChange:P=>c({...o,isFree:P.target.checked,price:P.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最新新增"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:o.isNew??!1,onChange:P=>c({...o,isNew:P.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"小程序直推"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:o.isPinned??!1,onChange:P=>c({...o,isPinned:P.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"热度分"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:o.hotScore??0,onChange:P=>c({...o,hotScore:Math.max(0,parseFloat(P.target.value)||0)})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.title,onChange:P=>c({...o,title:P.target.value})})]}),o.filePath&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"文件路径"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:o.filePath,disabled:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @提及主人公 和 #链接标签)"}),f?i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsx(j2,{ref:Yn,content:o.content||"",onChange:P=>c({...o,content:P}),onImageUpload:async P=>{var Ot;const ie=new FormData;ie.append("file",P),ie.append("folder","book-images");const Re=await(await fetch(Yo("/api/upload"),{method:"POST",body:ie,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((Ot=Re==null?void 0:Re.data)==null?void 0:Ot.url)||(Re==null?void 0:Re.url)||""},persons:Sn,linkTags:Es,placeholder:"开始编辑内容... 输入 @ 可提及主人公,工具栏可插入 #链接标签"})]})]}),i.jsxs(bn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[o&&i.jsxs(re,{variant:"outline",onClick:()=>us({id:o.id,title:o.title,price:o.price}),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent mr-auto",children:[i.jsx(zr,{className:"w-4 h-4 mr-2"}),"付款记录"]}),i.jsxs(re,{variant:"outline",onClick:()=>c(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsx(re,{onClick:Jc,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),i.jsxs(Hc,{defaultValue:"chapters",className:"space-y-6",children:[i.jsxs(cl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[i.jsxs(en,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[i.jsx(zr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),i.jsxs(en,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[i.jsx(Ab,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),i.jsxs(en,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[i.jsx(Ui,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),i.jsxs(en,{value:"protagonists",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[i.jsx(Nn,{className:"w-4 h-4 mr-2"}),"主人公"]})]}),i.jsxs(tn,{value:"chapters",className:"space-y-4",children:[i.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:i.jsx(zr,{className:"w-6 h-6"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),i.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),i.jsxs("div",{className:"text-center shrink-0",children:[i.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:ha}),i.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsxs(re,{onClick:()=>h(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"新建章节"]}),i.jsxs(re,{onClick:()=>W(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"新建篇"]}),i.jsxs(re,{variant:"outline",onClick:()=>ae(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",$.length," 节)"]})]}),n?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsx(FB,{parts:Dn,expandedParts:s,onTogglePart:ls,onReorder:oi,onReadSection:no,onDeleteSection:cs,onAddSectionInPart:Yc,onAddChapterInPart:Zc,onDeleteChapter:$t,onEditPart:Qc,onDeletePart:ro,onEditChapter:kf,selectedSectionIds:$,onToggleSectionSelect:ed,onShowSectionOrders:us,pinnedSectionIds:zt})]}),i.jsx(tn,{value:"search",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"内容搜索"})}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:v,onChange:P=>j(P.target.value),onKeyDown:P=>P.key==="Enter"&&td()}),i.jsx(re,{onClick:td,disabled:E||!v.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?i.jsx(qe,{className:"w-4 h-4 animate-spin"}):i.jsx(Ui,{className:"w-4 h-4"})})]}),w.length>0&&i.jsxs("div",{className:"space-y-2 mt-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",w.length," 个结果"]}),w.map(P=>i.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>no({id:P.id,title:P.title,price:P.price??1,filePath:""}),children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:P.id}),i.jsx("span",{className:"text-white",children:P.title}),zt.includes(P.id)&&i.jsx(Vo,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),i.jsx(Fe,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:P.matchType==="title"?"标题匹配":"内容匹配"})]}),P.snippet&&i.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:P.snippet}),(P.partTitle||P.chapterTitle)&&i.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[P.partTitle," · ",P.chapterTitle]})]},P.id))]})]})]})}),i.jsxs(tn,{value:"ranking",className:"space-y-4",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{className:"pb-3",children:i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(fm,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),i.jsx(Te,{children:i.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(te,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),i.jsx(ce,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:pn,onChange:P=>mr(Math.max(1,Math.min(100,Number(P.target.value)||20))),disabled:Br}),i.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),i.jsx(re,{size:"sm",onClick:Nf,disabled:fe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:fe?"保存中...":"保存"}),i.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",pn,"% 内容"]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{className:"pb-3",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(Ab,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",i.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",si.length," 节"]})]}),i.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[i.jsx(re,{variant:"ghost",size:"sm",disabled:qn<=1,onClick:()=>ss(P=>Math.max(1,P-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:i.jsx(OT,{className:"w-4 h-4"})}),i.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[qn," / ",ii]}),i.jsx(re,{variant:"ghost",size:"sm",disabled:qn>=ii,onClick:()=>ss(P=>Math.min(ii,P+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:i.jsx(Fo,{className:"w-4 h-4"})})]})]})}),i.jsx(Te,{children:i.jsxs("div",{className:"space-y-0",children:[i.jsxs("div",{className:"grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2 text-xs text-gray-500 border-b border-gray-700/50",children:[i.jsx("span",{children:"排名"}),i.jsx("span",{children:"置顶"}),i.jsx("span",{children:"标题"}),i.jsx("span",{className:"text-right",children:"点击量"}),i.jsx("span",{className:"text-right",children:"付款数"}),i.jsx("span",{className:"text-right",children:"热度"}),i.jsx("span",{className:"text-right",children:"编辑"})]}),ai.map((P,ie)=>{const Ae=(qn-1)*Er+ie+1,Re=zt.includes(P.id);return i.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${Re?"bg-amber-500/5":""}`,children:[i.jsx("span",{className:`text-sm font-bold ${Ae<=3?"text-amber-400":"text-gray-500"}`,children:Ae<=3?["🥇","🥈","🥉"][Ae-1]:`#${Ae}`}),i.jsx(re,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${Re?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>En(P.id),disabled:is,title:Re?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:Re?i.jsx(Vo,{className:"w-3.5 h-3.5 fill-current"}):i.jsx(sA,{className:"w-3.5 h-3.5"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{className:"text-white text-sm truncate block",children:P.title}),i.jsxs("span",{className:"text-gray-600 text-xs",children:[P.partTitle," · ",P.chapterTitle]})]}),i.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:P.clickCount??0}),i.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:P.payCount??0}),i.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(P.hotScore??0).toFixed(1)}),i.jsx("div",{className:"text-right",children:i.jsx(re,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>no({id:P.id,title:P.title,price:P.price,filePath:""}),title:"编辑文章",children:i.jsx(bt,{className:"w-3 h-3"})})})]},P.id)}),ai.length===0&&i.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),i.jsxs(tn,{value:"protagonists",className:"space-y-4",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{className:"pb-3",children:i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"主人公列表(编辑器内输入 @ 可提及)"]})}),i.jsxs(Te,{className:"space-y-3",children:[i.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"人物ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 karuo",value:Jn.personId,onChange:P=>as({...Jn,personId:P.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 卡若",value:Jn.name,onChange:P=>as({...Jn,name:P.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"如 超级个体",value:Jn.label,onChange:P=>as({...Jn,label:P.target.value})})]}),i.jsxs(re,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8",onClick:async()=>{if(!Jn.personId||!Jn.name)return alert("人物ID和名称必填");await ht("/api/db/persons",Jn),as({personId:"",name:"",label:""}),Ke()},children:[i.jsx(Lt,{className:"w-3 h-3 mr-1"}),"添加"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[Sn.map(P=>i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsxs("span",{className:"text-[#38bdac] font-bold text-base",children:["@",P.name]}),i.jsxs("span",{className:"text-gray-500 text-xs",children:["ID: ",P.id]}),P.label&&i.jsx(Fe,{variant:"secondary",className:"bg-purple-500/20 text-purple-300 border-purple-500/30 text-[10px]",children:P.label})]}),i.jsx(re,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await Yr(`/api/db/persons?personId=${P.id}`),Ke()},children:i.jsx(er,{className:"w-3 h-3"})})]},P.id)),Sn.length===0&&i.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无主人公,添加后可在编辑器中 @提及"})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{className:"pb-3",children:i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(mM,{className:"w-4 h-4 text-amber-400"}),"链接标签(编辑器内 #标签 可跳转链接/小程序)"]})}),i.jsxs(Te,{className:"space-y-3",children:[i.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"标签ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",placeholder:"如 team01",value:jt.tagId,onChange:P=>Cn({...jt,tagId:P.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"显示文字"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 神仙团队",value:jt.label,onChange:P=>Cn({...jt,label:P.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"类型"}),i.jsxs(ec,{value:jt.type,onValueChange:P=>Cn({...jt,type:P}),children:[i.jsx(zo,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",children:i.jsx(tc,{})}),i.jsxs($o,{children:[i.jsx(Ws,{value:"url",children:"网页链接"}),i.jsx(Ws,{value:"miniprogram",children:"小程序"})]})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:jt.type==="url"?"URL地址":"小程序AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-40",placeholder:jt.type==="url"?"https://...":"wx...",value:jt.type==="url"?jt.url:jt.appId,onChange:P=>{jt.type==="url"?Cn({...jt,url:P.target.value}):Cn({...jt,appId:P.target.value})}})]}),jt.type==="miniprogram"&&i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"页面路径"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"pages/index/index",value:jt.pagePath,onChange:P=>Cn({...jt,pagePath:P.target.value})})]}),i.jsxs(re,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:async()=>{if(!jt.tagId||!jt.label)return alert("标签ID和显示文字必填");const P={...jt};P.type==="miniprogram"&&P.appId&&(P.url=`weixin://dl/business/?appid=${P.appId}&path=${P.pagePath}`),await ht("/api/db/link-tags",P),Cn({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),Ze()},children:[i.jsx(Lt,{className:"w-3 h-3 mr-1"}),"添加"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[Es.map(P=>i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsxs("span",{className:"text-amber-400 font-bold text-base",children:["#",P.label]}),i.jsx(Fe,{variant:"secondary",className:"bg-gray-700 text-gray-300 text-[10px]",children:P.type==="url"?"网页":"小程序"}),i.jsxs("a",{href:P.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[250px] hover:underline flex items-center gap-1",children:[P.url," ",i.jsx(Xs,{className:"w-3 h-3 shrink-0"})]})]}),i.jsx(re,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await Yr(`/api/db/link-tags?tagId=${P.id}`),Ze()},children:i.jsx(er,{className:"w-3 h-3"})})]},P.id)),Es.length===0&&i.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})]})]})]})]})]})]})}const Ks={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function iN(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&"label"in e&&"value"in e?{label:String(e.label),value:String(e.value)}:{label:"",value:""}).filter(e=>e.label||e.value):Ks.stats}function aN(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):Ks.highlights}function HB(){const[t,e]=b.useState(Ks),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{Be("/api/admin/author-settings").then(k=>{const E=k==null?void 0:k.data;E&&typeof E=="object"&&e({name:String(E.name??Ks.name),avatar:String(E.avatar??Ks.avatar),avatarImg:String(E.avatarImg??""),title:String(E.title??Ks.title),bio:String(E.bio??Ks.bio),stats:iN(E.stats).length?iN(E.stats):Ks.stats,highlights:aN(E.highlights).length?aN(E.highlights):Ks.highlights})}).catch(console.error).finally(()=>r(!1))},[]);const h=async()=>{a(!0);try{const k={name:t.name,avatar:t.avatar||"K",avatarImg:t.avatarImg,title:t.title,bio:t.bio,stats:t.stats.filter(M=>M.label||M.value),highlights:t.highlights.filter(Boolean)},E=await ht("/api/admin/author-settings",k);if(!E||E.success===!1){alert("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.error:""));return}a(!1);const C=document.createElement("div");C.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",C.textContent="作者设置已保存",document.body.appendChild(C),setTimeout(()=>C.remove(),2e3)}catch(k){console.error(k),alert("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{a(!1)}},f=async k=>{var C;const E=(C=k.target.files)==null?void 0:C[0];if(E){c(!0);try{const M=new FormData;M.append("file",E),M.append("folder","avatars");const D=kx(),F={};D&&(F.Authorization=`Bearer ${D}`);const I=await(await fetch(Yo("/api/upload"),{method:"POST",body:M,credentials:"include",headers:F})).json();I!=null&&I.success&&(I!=null&&I.url)?e(A=>({...A,avatarImg:I.url})):alert("上传失败: "+((I==null?void 0:I.error)||"未知错误"))}catch(M){console.error(M),alert("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(E=>({...E,stats:E.stats.filter((C,M)=>M!==k)})),y=(k,E,C)=>e(M=>({...M,stats:M.stats.map((D,F)=>F===k?{...D,[E]:C}:D)})),v=()=>e(k=>({...k,highlights:[...k.highlights,""]})),j=k=>e(E=>({...E,highlights:E.highlights.filter((C,M)=>M!==k)})),w=(k,E)=>e(C=>({...C,highlights:C.highlights.map((M,D)=>D===k?E:M)}));return n?i.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Wo,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),i.jsxs(re,{onClick:h,disabled:s||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),s?"保存中...":"保存"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"flex items-center gap-2 text-white",children:[i.jsx(Wo,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),i.jsx(It,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"姓名"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(E=>({...E,name:k.target.value})),placeholder:"卡若"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(E=>({...E,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(LN,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(E=>({...E,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),i.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),i.jsxs(re,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:o,onClick:()=>{var k;return(k=u.current)==null?void 0:k.click()},children:[i.jsx(Hu,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&i.jsx("div",{className:"mt-2",children:i.jsx("img",{src:t.avatarImg.startsWith("http")?t.avatarImg:Yo(t.avatarImg),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"头衔"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(E=>({...E,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"个人简介"}),i.jsx(dl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(E=>({...E,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsx(tt,{className:"text-white",children:"统计数据"}),i.jsx(It,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),i.jsxs(Te,{className:"space-y-3",children:[t.stats.map((k,E)=>i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:C=>y(E,"label",C.target.value),placeholder:"标签"}),i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>y(E,"value",C.target.value),placeholder:"数值"}),i.jsx(re,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(E),children:i.jsx(er,{className:"w-4 h-4"})})]},E)),i.jsxs(re,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsx(tt,{className:"text-white",children:"亮点标签"}),i.jsx(It,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),i.jsxs(Te,{className:"space-y-3",children:[t.highlights.map((k,E)=>i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:C=>w(E,C.target.value),placeholder:"5年私域运营经验"}),i.jsx(re,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>j(E),children:i.jsx(er,{className:"w-4 h-4"})})]},E)),i.jsxs(re,{variant:"outline",size:"sm",onClick:v,className:"border-gray-600 text-gray-400",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function WB(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o]=b.useState(10),[c,u]=b.useState(0),[h,f]=b.useState(""),m=$x(h,300),[g,y]=b.useState(!0),[v,j]=b.useState(null),[w,k]=b.useState(!1),[E,C]=b.useState(null),[M,D]=b.useState(""),[F,R]=b.useState(""),[I,A]=b.useState(""),[O,W]=b.useState("admin"),[X,q]=b.useState("active"),[Z,_]=b.useState(!1);async function $(){var H;y(!0),j(null);try{const ue=new URLSearchParams({page:String(s),pageSize:String(o)});m.trim()&&ue.set("search",m.trim());const U=await Be(`/api/admin/users?${ue}`);U!=null&&U.success?(e(U.records||[]),r(U.total??0),u(U.totalPages??0)):j(U.error||"加载失败")}catch(ue){const U=ue;j(U.status===403?"无权限访问":((H=U==null?void 0:U.data)==null?void 0:H.error)||"加载失败"),e([])}finally{y(!1)}}b.useEffect(()=>{$()},[s,o,m]);const oe=()=>{C(null),D(""),R(""),A(""),W("admin"),q("active"),k(!0)},V=H=>{C(H),D(H.username),R(""),A(H.name||""),W(H.role==="super_admin"?"super_admin":"admin"),q(H.status==="disabled"?"disabled":"active"),k(!0)},ae=async()=>{var H;if(!M.trim()){j("用户名不能为空");return}if(!E&&!F){j("新建时密码必填,至少 6 位");return}if(F&&F.length<6){j("密码至少 6 位");return}j(null),_(!0);try{if(E){const ue=await Rt("/api/admin/users",{id:E.id,password:F||void 0,name:I.trim(),role:O,status:X});ue!=null&&ue.success?(k(!1),$()):j((ue==null?void 0:ue.error)||"保存失败")}else{const ue=await ht("/api/admin/users",{username:M.trim(),password:F,name:I.trim(),role:O});ue!=null&&ue.success?(k(!1),$()):j((ue==null?void 0:ue.error)||"保存失败")}}catch(ue){const U=ue;j(((H=U==null?void 0:U.data)==null?void 0:H.error)||"保存失败")}finally{_(!1)}},Y=async H=>{var ue;if(confirm("确定删除该管理员?"))try{const U=await Yr(`/api/admin/users?id=${H}`);U!=null&&U.success?$():j((U==null?void 0:U.error)||"删除失败")}catch(U){const he=U;j(((ue=he==null?void 0:he.data)==null?void 0:ue.error)||"删除失败")}},L=H=>{if(!H)return"-";try{const ue=new Date(H);return isNaN(ue.getTime())?H:ue.toLocaleString("zh-CN")}catch{return H}};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Nx,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ce,{placeholder:"搜索用户名/昵称",value:h,onChange:H=>f(H.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),i.jsx(re,{variant:"outline",size:"sm",onClick:$,disabled:g,className:"border-gray-600 text-gray-300",children:i.jsx(qe,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),i.jsxs(re,{onClick:oe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),v&&i.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[i.jsx("span",{children:v}),i.jsx("button",{type:"button",onClick:()=>j(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:g?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(i.Fragment,{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"用户名"}),i.jsx(ke,{className:"text-gray-400",children:"昵称"}),i.jsx(ke,{className:"text-gray-400",children:"角色"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-gray-400",children:"创建时间"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[t.map(H=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:H.id}),i.jsx(ve,{className:"text-white font-medium",children:H.username}),i.jsx(ve,{className:"text-gray-400",children:H.name||"-"}),i.jsx(ve,{children:i.jsx(Fe,{variant:"outline",className:H.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:H.role==="super_admin"?"超级管理员":"管理员"})}),i.jsx(ve,{children:i.jsx(Fe,{variant:"outline",className:H.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:H.status==="active"?"正常":"已禁用"})}),i.jsx(ve,{className:"text-gray-500 text-sm",children:L(H.createdAt)}),i.jsxs(ve,{className:"text-right",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>V(H),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(bt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Y(H.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(vn,{className:"w-4 h-4"})})]})]},H.id)),t.length===0&&!g&&i.jsx(ct,{children:i.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:v==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&i.jsx("div",{className:"p-4 border-t border-gray-700/50",children:i.jsx(Zr,{page:s,pageSize:o,total:n,totalPages:c,onPageChange:a})})]})})}),i.jsx(Qt,{open:w,onOpenChange:k,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:E?"编辑管理员":"新增管理员"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"用户名"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:M,onChange:H=>D(H.target.value),disabled:!!E}),E&&i.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:E?"新密码(留空不改)":"密码"}),i.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:E?"留空表示不修改":"至少 6 位",value:F,onChange:H=>R(H.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"昵称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:I,onChange:H=>A(H.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"角色"}),i.jsxs("select",{value:O,onChange:H=>W(H.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[i.jsx("option",{value:"admin",children:"管理员"}),i.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),E&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"状态"}),i.jsxs("select",{value:X,onChange:H=>q(H.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[i.jsx("option",{value:"active",children:"正常"}),i.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:ae,disabled:Z,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),Z?"保存中...":"保存"]})]})]})})]})}const UB={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},KB={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},qB={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...KB}},GB={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},JB=["system","author","admin"];function YB(){const[t,e]=MN(),n=t.get("tab")??"system",r=JB.includes(n)?n:"system",[s,a]=b.useState(qB),[o,c]=b.useState(GB),[u,h]=b.useState(UB),[f,m]=b.useState(!1),[g,y]=b.useState(!0),[v,j]=b.useState(!1),[w,k]=b.useState(""),[E,C]=b.useState(""),[M,D]=b.useState(!1),[F,R]=b.useState(!1),I=(q,Z,_=!1)=>{k(q),C(Z),D(_),j(!0)};b.useEffect(()=>{(async()=>{try{const Z=await Be("/api/admin/settings");if(!Z||Z.success===!1)return;if(Z.featureConfig&&Object.keys(Z.featureConfig).length&&c(_=>({..._,...Z.featureConfig})),Z.mpConfig&&typeof Z.mpConfig=="object"&&h(_=>({..._,...Z.mpConfig})),Z.siteSettings&&typeof Z.siteSettings=="object"){const _=Z.siteSettings;a($=>({...$,...typeof _.sectionPrice=="number"&&{sectionPrice:_.sectionPrice},...typeof _.baseBookPrice=="number"&&{baseBookPrice:_.baseBookPrice},...typeof _.distributorShare=="number"&&{distributorShare:_.distributorShare},..._.authorInfo&&typeof _.authorInfo=="object"&&{authorInfo:{...$.authorInfo,..._.authorInfo}}}))}}catch(Z){console.error("Load settings error:",Z)}finally{y(!1)}})()},[]);const A=async(q,Z)=>{R(!0);try{const _=await ht("/api/admin/settings",{featureConfig:q});if(!_||_.success===!1){Z(),I("保存失败",(_==null?void 0:_.error)??"未知错误",!0);return}I("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(_){console.error("Save feature config error:",_),Z(),I("保存失败",_ instanceof Error?_.message:String(_),!0)}finally{R(!1)}},O=(q,Z)=>{const _=o,$={..._,[q]:Z};c($),A($,()=>c(_))},W=async()=>{m(!0);try{const q=await ht("/api/admin/settings",{featureConfig:o,siteSettings:{sectionPrice:s.sectionPrice,baseBookPrice:s.baseBookPrice,distributorShare:s.distributorShare,authorInfo:s.authorInfo},mpConfig:{...u,appId:u.appId||"",withdrawSubscribeTmplId:u.withdrawSubscribeTmplId||"",mchId:u.mchId||"",minWithdraw:typeof u.minWithdraw=="number"?u.minWithdraw:10}});if(!q||q.success===!1){I("保存失败",(q==null?void 0:q.error)??"未知错误",!0);return}I("已保存","设置已保存成功。")}catch(q){console.error("Save settings error:",q),I("保存失败",q instanceof Error?q.message:String(q),!0)}finally{m(!1)}},X=q=>{e(q==="system"?{}:{tab:q})};return g?i.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-6",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),r==="system"&&i.jsxs(re,{onClick:W,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),f?"保存中...":"保存设置"]})]}),i.jsxs(Hc,{value:r,onValueChange:X,className:"w-full",children:[i.jsxs(cl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[i.jsxs(en,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[i.jsx(Da,{className:"w-4 h-4 mr-2"}),"系统设置"]}),i.jsxs(en,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[i.jsx(hm,{className:"w-4 h-4 mr-2"}),"作者详情"]}),i.jsxs(en,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[i.jsx(Nx,{className:"w-4 h-4 mr-2"}),"管理员"]})]}),i.jsx(tn,{value:"system",className:"mt-0",children:i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(hm,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),i.jsx(It,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(hm,{className:"w-3 h-3"}),"主理人名称"]}),i.jsx(ce,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:s.authorInfo.name??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,name:q.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(Bu,{className:"w-3 h-3"}),"开播日期"]}),i.jsx(ce,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:s.authorInfo.startDate??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,startDate:q.target.value}}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(Bu,{className:"w-3 h-3"}),"直播时间"]}),i.jsx(ce,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:s.authorInfo.liveTime??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,liveTime:q.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(_N,{className:"w-3 h-3"}),"直播平台"]}),i.jsx(ce,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:s.authorInfo.platform??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,platform:q.target.value}}))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(zr,{className:"w-3 h-3"}),"简介描述"]}),i.jsx(ce,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:s.authorInfo.description??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,description:q.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),i.jsx(dl,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:s.authorInfo.bio??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,bio:q.target.value}}))})]}),i.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[i.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(s.authorInfo.name??"K").charAt(0)}),i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-semibold",children:s.authorInfo.name}),i.jsx("p",{className:"text-gray-400 text-xs",children:s.authorInfo.description}),i.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",s.authorInfo.liveTime," · ",s.authorInfo.platform]})]})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Vu,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),i.jsx(It,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),i.jsx(Te,{className:"space-y-4",children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"单节价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:s.sectionPrice,onChange:q=>a(Z=>({...Z,sectionPrice:Number.parseFloat(q.target.value)||1}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"整本价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:s.baseBookPrice,onChange:q=>a(Z=>({...Z,baseBookPrice:Number.parseFloat(q.target.value)||9.9}))})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(kc,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),i.jsx(It,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),i.jsx(Te,{className:"space-y-4",children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"小程序 AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:u.appId??"",onChange:q=>h(Z=>({...Z,appId:q.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"提现订阅模板 ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:u.withdrawSubscribeTmplId??"",onChange:q=>h(Z=>({...Z,withdrawSubscribeTmplId:q.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"微信支付商户号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:u.mchId??"",onChange:q=>h(Z=>({...Z,mchId:q.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最低提现金额 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:u.minWithdraw??10,onChange:q=>h(Z=>({...Z,minWithdraw:Number.parseFloat(q.target.value)||10}))})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Da,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),i.jsx(It,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Nn,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),i.jsx(yt,{id:"match-enabled",checked:o.matchEnabled,disabled:F,onCheckedChange:q=>O("matchEnabled",q)})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(iM,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),i.jsx(yt,{id:"referral-enabled",checked:o.referralEnabled,disabled:F,onCheckedChange:q=>O("referralEnabled",q)})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(zr,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),i.jsx(yt,{id:"search-enabled",checked:o.searchEnabled,disabled:F,onCheckedChange:q=>O("searchEnabled",q)})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Da,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),i.jsx(yt,{id:"about-enabled",checked:o.aboutEnabled,disabled:F,onCheckedChange:q=>O("aboutEnabled",q)})]})]}),i.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:i.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]})}),i.jsx(tn,{value:"author",className:"mt-0",children:i.jsx(HB,{})}),i.jsx(tn,{value:"admin",className:"mt-0",children:i.jsx(WB,{})})]}),i.jsx(Qt,{open:v,onOpenChange:j,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[i.jsxs(Xt,{children:[i.jsx(Zt,{className:M?"text-red-400":"text-[#38bdac]",children:w}),i.jsx(EI,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:E})]}),i.jsx(bn,{className:"mt-4",children:i.jsx(re,{onClick:()=>j(!1),className:M?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const oN={wechat:{enabled:!0,qrCode:"/images/wechat-pay.png",account:"卡若",websiteAppId:"",merchantId:"",groupQrCode:"/images/party-group-qr.png"},alipay:{enabled:!0,qrCode:"/images/alipay.png",account:"卡若",partnerId:"",securityKey:""},usdt:{enabled:!1,network:"TRC20",address:"",exchangeRate:7.2},paypal:{enabled:!1,email:"",exchangeRate:7.2}};function QB(){const[t,e]=b.useState(!1),[n,r]=b.useState(oN),[s,a]=b.useState(""),o=async()=>{e(!0);try{const k=await Be("/api/config");k!=null&&k.paymentMethods&&r({...oN,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};b.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await ht("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),alert("配置已保存!")}catch(k){console.error("保存失败:",k),alert("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,E)=>{navigator.clipboard.writeText(k),a(E),setTimeout(()=>a(""),2e3)},h=(k,E)=>{r(C=>({...C,wechat:{...C.wechat,[k]:E}}))},f=(k,E)=>{r(C=>({...C,alipay:{...C.alipay,[k]:E}}))},m=(k,E)=>{r(C=>({...C,usdt:{...C.usdt,[k]:E}}))},g=(k,E)=>{r(C=>({...C,paypal:{...C.paypal,[k]:E}}))},y=n.wechat,v=n.alipay,j=n.usdt,w=n.paypal;return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),i.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(re,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),i.jsxs(re,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),i.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(IN,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),i.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[i.jsx("li",{children:"打开微信,进入目标微信群"}),i.jsx("li",{children:'点击右上角"..." → "群二维码"'}),i.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),i.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),i.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),i.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),i.jsxs(Hc,{defaultValue:"wechat",className:"space-y-6",children:[i.jsxs(cl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[i.jsxs(en,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[i.jsx(kc,{className:"w-4 h-4 mr-2"}),"微信"]}),i.jsxs(en,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[i.jsx(Tb,{className:"w-4 h-4 mr-2"}),"支付宝"]}),i.jsxs(en,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[i.jsx(Cb,{className:"w-4 h-4 mr-2"}),"USDT"]}),i.jsxs(en,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[i.jsx(mg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),i.jsx(tn,{value:"wechat",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(tt,{className:"text-[#07C160] flex items-center gap-2",children:[i.jsx(kc,{className:"w-5 h-5"}),"微信支付配置"]}),i.jsx(It,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),i.jsx(yt,{checked:!!y.enabled,onCheckedChange:k=>h("enabled",k)})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"网站AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"商户号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),i.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[i.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[i.jsx(Xs,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"微信收款码/支付链接"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(y.qrCode??""),onChange:k=>h("qrCode",k.target.value)}),i.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),i.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[i.jsx(te,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),i.jsx(ce,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(y.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),i.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),i.jsx(tn,{value:"alipay",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(tt,{className:"text-[#1677FF] flex items-center gap-2",children:[i.jsx(Tb,{className:"w-5 h-5"}),"支付宝配置"]}),i.jsx(It,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),i.jsx(yt,{checked:!!v.enabled,onCheckedChange:k=>f("enabled",k)})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"合作者身份 (PID)"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),i.jsx(re,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(v.partnerId??""),"pid"),children:s==="pid"?i.jsx(Wh,{className:"w-4 h-4 text-green-500"}):i.jsx(ON,{className:"w-4 h-4 text-gray-400"})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"安全校验码 (Key)"}),i.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),i.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[i.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[i.jsx(Xs,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(v.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),i.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),i.jsx(tn,{value:"usdt",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(tt,{className:"text-[#26A17B] flex items-center gap-2",children:[i.jsx(Cb,{className:"w-5 h-5"}),"USDT配置"]}),i.jsx(It,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),i.jsx(yt,{checked:!!j.enabled,onCheckedChange:k=>m("enabled",k)})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"网络类型"}),i.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(j.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[i.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),i.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),i.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"收款地址"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(j.address??""),onChange:k=>m("address",k.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),i.jsx(tn,{value:"paypal",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(tt,{className:"text-[#169BD7] flex items-center gap-2",children:[i.jsx(mg,{className:"w-5 h-5"}),"PayPal配置"]}),i.jsx(It,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),i.jsx(yt,{checked:!!w.enabled,onCheckedChange:k=>g("enabled",k)})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"PayPal邮箱"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(w.email??""),onChange:k=>g("email",k.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(w.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const XB={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},ZB={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},eV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function tV(){const[t,e]=b.useState({siteConfig:{...XB},menuConfig:{...ZB},pageConfig:{...eV}}),[n,r]=b.useState(!1),[s,a]=b.useState(!1);b.useEffect(()=>{Be("/api/config").then(f=>{f!=null&&f.siteConfig&&e(m=>({...m,siteConfig:{...m.siteConfig,...f.siteConfig}})),f!=null&&f.menuConfig&&e(m=>({...m,menuConfig:{...m.menuConfig,...f.menuConfig}})),f!=null&&f.pageConfig&&e(m=>({...m,pageConfig:{...m.pageConfig,...f.pageConfig}}))}).catch(console.error)},[]);const o=async()=>{a(!0);try{await ht("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await ht("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await ht("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),alert("配置已保存")}catch(f){console.error(f),alert("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{a(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),i.jsxs(re,{onClick:o,disabled:s,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),s?"保存中...":n?"已保存":"保存设置"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(mg,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),i.jsx(It,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),i.jsx(ce,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteName??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteName:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),i.jsx(ce,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteTitle??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteTitle:f.target.value}}))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),i.jsx(ce,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteDescription??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteDescription:f.target.value}}))})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),i.jsx(ce,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:c.logo??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,logo:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),i.jsx(ce,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:c.favicon??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,favicon:f.target.value}}))})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(QM,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),i.jsx(It,{className:"text-gray-400",children:"配置网站主题色"})]}),i.jsx(Te,{children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"space-y-2 flex-1",children:[i.jsx(te,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(ce,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))})]})]}),i.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:c.primaryColor??"#00CED1"},children:"预览"})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(WM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),i.jsx(It,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),i.jsx(Te,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>i.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[i.jsx(yt,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,enabled:g}}}))}),i.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,label:g.target.value}}}))})]}),i.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(nM,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),i.jsx(It,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"首页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeTitle:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"首页副标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeSubtitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeSubtitle:f.target.value}}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目录页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.chaptersTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,chaptersTitle:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"匹配页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.matchTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,matchTitle:f.target.value}}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"我的页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.myTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,myTitle:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"关于作者标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function nV(){const[t,e]=b.useState(""),[n,r]=b.useState(""),[s,a]=b.useState(""),[o,c]=b.useState({}),u=async()=>{var y,v,j,w;try{const k=await Be("/api/config"),E=(v=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:v.urls;Array.isArray(E)&&e(E.join(` +`));const C=(w=(j=k==null?void 0:k.paymentMethods)==null?void 0:j.wechat)==null?void 0:w.groupQrCode;C&&r(C),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};b.useEffect(()=>{u()},[]);const h=(y,v)=>{navigator.clipboard.writeText(y),a(v),setTimeout(()=>a(""),2e3)},f=async()=>{try{const y=t.split(` +`).map(j=>j.trim()).filter(Boolean),v=[...o.liveQRCodes||[]];v[0]?v[0].urls=y:v.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await ht("/api/db/config",{key:"live_qr_codes",value:v,description:"群活码配置"}),alert("群活码配置已保存!"),await u()}catch(y){console.error(y),alert("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await ht("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),alert("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(v){console.error(v),alert("保存失败: "+(v instanceof Error?v.message:String(v)))}},g=()=>{n?window.open(n,"_blank"):alert("请先配置微信群链接")};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"mb-8",children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),i.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(IN,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),i.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[i.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),i.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[i.jsx("li",{children:"访问草料二维码创建活码"}),i.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),i.jsx("li",{children:"复制生成的短链接填入下方配置"}),i.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),i.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),i.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[i.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),i.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),i.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),i.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-[#07C160] flex items-center gap-2",children:[i.jsx(Mb,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),i.jsx(It,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(gg,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:n,onChange:y=>r(y.target.value)}),i.jsx(re,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:s==="group"?i.jsx(Wh,{className:"w-4 h-4 text-green-500"}):i.jsx(ON,{className:"w-4 h-4 text-gray-400"})})]}),i.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[i.jsx(Xs,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(re,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[i.jsx(Hu,{className:"w-4 h-4 mr-2"}),"保存配置"]}),i.jsxs(re,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[i.jsx(Xs,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Mb,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),i.jsx(It,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(gg,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),i.jsx(dl,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:y=>e(y.target.value)}),i.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),i.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[i.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),i.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` +`).filter(Boolean).length," 个"]})]}),i.jsxs(re,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Hu,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),i.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[i.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),i.jsxs("div",{className:"space-y-3 text-sm",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),i.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),i.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const lN={matchTypes:[{id:"partner",label:"创业合伙",matchLabel:"创业伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10}},rV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function sV(){const[t,e]=b.useState(lN),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(!1),[u,h]=b.useState(null),[f,m]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const C=await Be("/api/db/config/full?key=match_config"),M=(C==null?void 0:C.data)??(C==null?void 0:C.config);M&&e({...lN,...M})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};b.useEffect(()=>{g()},[]);const y=async()=>{a(!0);try{const C=await ht("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?alert("配置保存成功!"):alert("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),alert("保存失败")}finally{a(!1)}},v=C=>{h(C),m({id:C.id,label:C.label,matchLabel:C.matchLabel,icon:C.icon,matchFromDB:C.matchFromDB,showJoinAfterMatch:C.showJoinAfterMatch,price:C.price,enabled:C.enabled}),c(!0)},j=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},w=()=>{if(!f.id||!f.label){alert("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const M=C.findIndex(D=>D.id===u.id);M!==-1&&(C[M]={...f})}else{if(C.some(M=>M.id===f.id)){alert("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(M=>M.id!==C)})},E=C=>{e({...t,matchTypes:t.matchTypes.map(M=>M.id===C?{...M,enabled:!M.enabled}:M)})};return i.jsxs("div",{className:"p-8 w-full space-y-6",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Da,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(re,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),i.jsxs(re,{onClick:y,disabled:s,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),s?"保存中...":"保存配置"]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Fi,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),i.jsx(It,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),i.jsxs(Te,{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日免费匹配次数"}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:C=>e({...t,freeMatchLimit:parseInt(C.target.value,10)||0})}),i.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:C=>e({...t,matchPrice:parseFloat(C.target.value)||1})}),i.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),i.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:C=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(C.target.value,10)||10}})}),i.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),i.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(yt,{checked:t.settings.enableFreeMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enableFreeMatches:C}})}),i.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(yt,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),i.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Nn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),i.jsx(It,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),i.jsxs(re,{onClick:j,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),i.jsx(Te,{children:i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"图标"}),i.jsx(ke,{className:"text-gray-400",children:"类型ID"}),i.jsx(ke,{className:"text-gray-400",children:"显示名称"}),i.jsx(ke,{className:"text-gray-400",children:"匹配标签"}),i.jsx(ke,{className:"text-gray-400",children:"价格"}),i.jsx(ke,{className:"text-gray-400",children:"数据库匹配"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsx(pr,{children:t.matchTypes.map(C=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsx("span",{className:"text-2xl",children:C.icon})}),i.jsx(ve,{className:"font-mono text-gray-300",children:C.id}),i.jsx(ve,{className:"text-white font-medium",children:C.label}),i.jsx(ve,{className:"text-gray-300",children:C.matchLabel}),i.jsx(ve,{children:i.jsxs(Fe,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),i.jsx(ve,{children:C.matchFromDB?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):i.jsx(Fe,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),i.jsx(ve,{children:i.jsx(yt,{checked:C.enabled,onCheckedChange:()=>E(C.id)})}),i.jsx(ve,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(bt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>k(C.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(vn,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),i.jsx(Qt,{open:o,onOpenChange:c,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[u?i.jsx(bt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(Lt,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:C=>m({...f,id:C.target.value}),disabled:!!u})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"图标"}),i.jsx("div",{className:"flex gap-1 flex-wrap",children:rV.map(C=>i.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===C?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:C}),children:C},C))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"显示名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:C=>m({...f,label:C.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"匹配标签"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:C=>m({...f,matchLabel:C.target.value})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:C=>m({...f,price:parseFloat(C.target.value)||1})})]}),i.jsxs("div",{className:"flex gap-6 pt-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(yt,{checked:f.matchFromDB,onCheckedChange:C=>m({...f,matchFromDB:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(yt,{checked:f.showJoinAfterMatch,onCheckedChange:C=>m({...f,showJoinAfterMatch:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(yt,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsxs(re,{onClick:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const cN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function iV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null);async function v(){m(!0),y(null);try{const w=new URLSearchParams({page:String(s),pageSize:String(o)});u&&w.set("matchType",u);const k=await Be(`/api/db/match-records?${w}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(w){console.error("加载匹配记录失败",w),y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{v()},[s,u]);const j=Math.ceil(n/o)||1;return i.jsxs("div",{className:"p-8 w-full",children:[g&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:g}),i.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),i.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",n," 条记录"]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("select",{value:u,onChange:w=>{h(w.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[i.jsx("option",{value:"",children:"全部类型"}),Object.entries(cN).map(([w,k])=>i.jsx("option",{value:w,children:k},w))]}),i.jsxs("button",{type:"button",onClick:v,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[i.jsx(qe,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:f?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"发起人"}),i.jsx(ke,{className:"text-gray-400",children:"匹配到"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"联系方式"}),i.jsx(ke,{className:"text-gray-400",children:"匹配时间"})]})}),i.jsxs(pr,{children:[t.map(w=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[w.userAvatar?i.jsx("img",{src:w.userAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,i.jsx("span",{className:w.userAvatar?"hidden":"",children:(w.userNickname||w.userId||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white",children:w.userNickname||w.userId}),i.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.userId.slice(0,16),"..."]})]})]})}),i.jsx(ve,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[w.matchedUserAvatar?i.jsx("img",{src:w.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,i.jsx("span",{className:w.matchedUserAvatar?"hidden":"",children:(w.matchedNickname||w.matchedUserId||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white",children:w.matchedNickname||w.matchedUserId}),i.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.matchedUserId.slice(0,16),"..."]})]})]})}),i.jsx(ve,{children:i.jsx(Fe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:cN[w.matchType]||w.matchType})}),i.jsxs(ve,{className:"text-gray-400 text-sm",children:[w.phone&&i.jsxs("div",{children:["📱 ",w.phone]}),w.wechatId&&i.jsxs("div",{children:["💬 ",w.wechatId]}),!w.phone&&!w.wechatId&&"-"]}),i.jsx(ve,{className:"text-gray-400",children:w.createdAt?new Date(w.createdAt).toLocaleString():"-"})]},w.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),i.jsx(Zr,{page:s,totalPages:j,total:n,pageSize:o,onPageChange:a,onPageSizeChange:w=>{c(w),a(1)}})]})})})]})}function aV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(null),[u,h]=b.useState(""),[f,m]=b.useState(0),[g,y]=b.useState(!1);async function v(){r(!0);try{const C=await Be("/api/db/vip-roles");C!=null&&C.success&&C.data&&e(C.data)}catch(C){console.error("Load roles error:",C)}finally{r(!1)}}b.useEffect(()=>{v()},[]);const j=()=>{c(null),h(""),m(t.length>0?Math.max(...t.map(C=>C.sort))+1:0),a(!0)},w=C=>{c(C),h(C.name),m(C.sort),a(!0)},k=async()=>{if(!u.trim()){alert("角色名称不能为空");return}y(!0);try{if(o){const C=await Rt("/api/db/vip-roles",{id:o.id,name:u.trim(),sort:f});C!=null&&C.success?(a(!1),v()):alert("更新失败: "+(C==null?void 0:C.error))}else{const C=await ht("/api/db/vip-roles",{name:u.trim(),sort:f});C!=null&&C.success?(a(!1),v()):alert("新增失败: "+(C==null?void 0:C.error))}}catch(C){console.error("Save error:",C),alert("保存失败")}finally{y(!1)}},E=async C=>{if(confirm("确定删除该角色?已设置该角色的 VIP 用户将保留角色名称。"))try{const M=await Yr(`/api/db/vip-roles?id=${C}`);M!=null&&M.success?v():alert("删除失败: "+(M==null?void 0:M.error))}catch(M){console.error("Delete error:",M),alert("删除失败")}};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Aa,{className:"w-5 h-5 text-amber-400"}),"VIP 角色管理"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"超级个体固定角色,在「设置 VIP」时可选择或手动填写"})]}),i.jsxs(re,{onClick:j,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"新增角色"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"角色名称"}),i.jsx(ke,{className:"text-gray-400",children:"排序"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[t.map(C=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:C.id}),i.jsx(ve,{className:"text-white",children:C.name}),i.jsx(ve,{className:"text-gray-400",children:C.sort}),i.jsxs(ve,{className:"text-right",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>w(C),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(bt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>E(C.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(vn,{className:"w-4 h-4"})})]})]},C.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无角色,点击「新增角色」添加"})})]})]})})}),i.jsx(Qt,{open:s,onOpenChange:a,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:o?"编辑角色":"新增角色"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"角色名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创始人、投资人",value:u,onChange:C=>h(C.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"排序(下拉展示顺序,越小越前)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f,onChange:C=>m(parseInt(C.target.value,10)||0)})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>a(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:k,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存"]})]})]})})]})}function NE({embedded:t=!1}){const[e,n]=b.useState([]),[r,s]=b.useState(!0),[a,o]=b.useState(!1),[c,u]=b.useState(null),[h,f]=b.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[m,g]=b.useState(!1),[y,v]=b.useState(!1),j=b.useRef(null),w=async I=>{var O;const A=(O=I.target.files)==null?void 0:O[0];if(A){v(!0);try{const W=new FormData;W.append("file",A),W.append("folder","mentors");const X=kx(),q={};X&&(q.Authorization=`Bearer ${X}`);const _=await(await fetch(Yo("/api/upload"),{method:"POST",body:W,credentials:"include",headers:q})).json();_!=null&&_.success&&(_!=null&&_.url)?f($=>({...$,avatar:_.url})):alert("上传失败: "+((_==null?void 0:_.error)||"未知错误"))}catch(W){console.error(W),alert("上传失败")}finally{v(!1),j.current&&(j.current.value="")}}};async function k(){s(!0);try{const I=await Be("/api/db/mentors");I!=null&&I.success&&I.data&&n(I.data)}catch(I){console.error("Load mentors error:",I)}finally{s(!1)}}b.useEffect(()=>{k()},[]);const E=()=>{f({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:e.length>0?Math.max(...e.map(I=>I.sort))+1:0,enabled:!0})},C=()=>{u(null),E(),o(!0)},M=I=>{u(I),f({name:I.name,avatar:I.avatar||"",intro:I.intro||"",tags:I.tags||"",priceSingle:I.priceSingle!=null?String(I.priceSingle):"",priceHalfYear:I.priceHalfYear!=null?String(I.priceHalfYear):"",priceYear:I.priceYear!=null?String(I.priceYear):"",quote:I.quote||"",whyFind:I.whyFind||"",offering:I.offering||"",judgmentStyle:I.judgmentStyle||"",sort:I.sort,enabled:I.enabled??!0}),o(!0)},D=async()=>{if(!h.name.trim()){alert("导师姓名不能为空");return}g(!0);try{const I=O=>O===""?void 0:parseFloat(O),A={name:h.name.trim(),avatar:h.avatar.trim()||void 0,intro:h.intro.trim()||void 0,tags:h.tags.trim()||void 0,priceSingle:I(h.priceSingle),priceHalfYear:I(h.priceHalfYear),priceYear:I(h.priceYear),quote:h.quote.trim()||void 0,whyFind:h.whyFind.trim()||void 0,offering:h.offering.trim()||void 0,judgmentStyle:h.judgmentStyle.trim()||void 0,sort:h.sort,enabled:h.enabled};if(c){const O=await Rt("/api/db/mentors",{id:c.id,...A});O!=null&&O.success?(o(!1),k()):alert("更新失败: "+(O==null?void 0:O.error))}else{const O=await ht("/api/db/mentors",A);O!=null&&O.success?(o(!1),k()):alert("新增失败: "+(O==null?void 0:O.error))}}catch(I){console.error("Save error:",I),alert("保存失败")}finally{g(!1)}},F=async I=>{if(confirm("确定删除该导师?"))try{const A=await Yr(`/api/db/mentors?id=${I}`);A!=null&&A.success?k():alert("删除失败: "+(A==null?void 0:A.error))}catch(A){console.error("Delete error:",A),alert("删除失败")}},R=I=>I!=null?`¥${I}`:"-";return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Nn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),i.jsxs(re,{onClick:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:r?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"姓名"}),i.jsx(ke,{className:"text-gray-400",children:"简介"}),i.jsx(ke,{className:"text-gray-400",children:"单次"}),i.jsx(ke,{className:"text-gray-400",children:"半年"}),i.jsx(ke,{className:"text-gray-400",children:"年度"}),i.jsx(ke,{className:"text-gray-400",children:"排序"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[e.map(I=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:I.id}),i.jsx(ve,{className:"text-white",children:I.name}),i.jsx(ve,{className:"text-gray-400 max-w-[200px] truncate",children:I.intro||"-"}),i.jsx(ve,{className:"text-gray-400",children:R(I.priceSingle)}),i.jsx(ve,{className:"text-gray-400",children:R(I.priceHalfYear)}),i.jsx(ve,{className:"text-gray-400",children:R(I.priceYear)}),i.jsx(ve,{className:"text-gray-400",children:I.sort}),i.jsxs(ve,{className:"text-right",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>M(I),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(bt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>F(I.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(vn,{className:"w-4 h-4"})})]})]},I.id)),e.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),i.jsx(Qt,{open:a,onOpenChange:o,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:c?"编辑导师":"新增导师"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"姓名 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:h.name,onChange:I=>f(A=>({...A,name:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"排序"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:h.sort,onChange:I=>f(A=>({...A,sort:parseInt(I.target.value,10)||0}))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"头像"}),i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:h.avatar,onChange:I=>f(A=>({...A,avatar:I.target.value})),placeholder:"点击上传或粘贴图片地址"}),i.jsx("input",{ref:j,type:"file",accept:"image/*",className:"hidden",onChange:w}),i.jsxs(re,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:y,onClick:()=>{var I;return(I=j.current)==null?void 0:I.click()},children:[i.jsx(Hu,{className:"w-4 h-4 mr-2"}),y?"上传中...":"上传"]})]}),h.avatar&&i.jsx("div",{className:"mt-2",children:i.jsx("img",{src:h.avatar.startsWith("http")?h.avatar:Yo(h.avatar),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"简介"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:h.intro,onChange:I=>f(A=>({...A,intro:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:h.tags,onChange:I=>f(A=>({...A,tags:I.target.value}))})]}),i.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[i.jsx(te,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),i.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:h.priceSingle,onChange:I=>f(A=>({...A,priceSingle:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),i.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:h.priceHalfYear,onChange:I=>f(A=>({...A,priceHalfYear:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),i.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:h.priceYear,onChange:I=>f(A=>({...A,priceYear:I.target.value}))})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"引言"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:h.quote,onChange:I=>f(A=>({...A,quote:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"为什么找(文本)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.whyFind,onChange:I=>f(A=>({...A,whyFind:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"提供什么(文本)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.offering,onChange:I=>f(A=>({...A,offering:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:h.judgmentStyle,onChange:I=>f(A=>({...A,judgmentStyle:I.target.value}))})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"checkbox",id:"enabled",checked:h.enabled,onChange:I=>f(A=>({...A,enabled:I.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),i.jsx(te,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>o(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:D,disabled:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),m?"保存中...":"保存"]})]})]})})]})}function oV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState("");async function o(){r(!0);try{const h=s?`/api/db/mentor-consultations?status=${s}`:"/api/db/mentor-consultations",f=await Be(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}b.useEffect(()=>{o()},[s]);const c={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},u={single:"单次",half_year:"半年",year:"年度"};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Bu,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("select",{value:s,onChange:h=>a(h.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[i.jsx("option",{value:"",children:"全部状态"}),Object.entries(c).map(([h,f])=>i.jsx("option",{value:h,children:f},h))]}),i.jsxs(re,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"用户ID"}),i.jsx(ke,{className:"text-gray-400",children:"导师ID"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"金额"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-gray-400",children:"创建时间"})]})}),i.jsxs(pr,{children:[t.map(h=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:h.id}),i.jsx(ve,{className:"text-gray-400",children:h.userId}),i.jsx(ve,{className:"text-gray-400",children:h.mentorId}),i.jsx(ve,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),i.jsxs(ve,{className:"text-white",children:["¥",h.amount]}),i.jsx(ve,{className:"text-gray-400",children:c[h.status]||h.status}),i.jsx(ve,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const lc={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},dN={matchTypes:[{id:"partner",label:"找伙伴",matchLabel:"找伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10},poolSettings:lc},lV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function cV(){const t=sa(),[e,n]=b.useState(dN),[r,s]=b.useState(!0),[a,o]=b.useState(!1),[c,u]=b.useState(!1),[h,f]=b.useState(null),[m,g]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[y,v]=b.useState(null),[j,w]=b.useState(!1),k=async()=>{w(!0);try{const A=await Be("/api/db/match-pool-counts");A!=null&&A.success&&A.data&&v(A.data)}catch(A){console.error("加载池子人数失败:",A)}finally{w(!1)}},E=async()=>{s(!0);try{const A=await Be("/api/db/config/full?key=match_config"),O=(A==null?void 0:A.data)??(A==null?void 0:A.config);if(O){let W=O.poolSettings??lc;W.poolSource&&!Array.isArray(W.poolSource)&&(W={...W,poolSource:[W.poolSource]}),n({...dN,...O,poolSettings:W})}}catch(A){console.error("加载匹配配置失败:",A)}finally{s(!1)}};b.useEffect(()=>{E(),k()},[]);const C=async()=>{o(!0);try{const A=await ht("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});alert((A==null?void 0:A.success)!==!1?"配置保存成功!":"保存失败: "+((A==null?void 0:A.error)||"未知错误"))}catch(A){console.error(A),alert("保存失败")}finally{o(!1)}},M=A=>{f(A),g({...A}),u(!0)},D=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},F=()=>{if(!m.id||!m.label){alert("请填写类型ID和名称");return}const A=[...e.matchTypes];if(h){const O=A.findIndex(W=>W.id===h.id);O!==-1&&(A[O]={...m})}else{if(A.some(O=>O.id===m.id)){alert("类型ID已存在");return}A.push({...m})}n({...e,matchTypes:A}),u(!1)},R=A=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(O=>O.id!==A)})},I=A=>{n({...e,matchTypes:e.matchTypes.map(O=>O.id===A?{...O,enabled:!O.enabled}:O)})};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex justify-end gap-3",children:[i.jsxs(re,{variant:"outline",onClick:E,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),i.jsxs(re,{onClick:C,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"})," ",a?"保存中...":"保存配置"]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(DN,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),i.jsx(It,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),i.jsxs(Te,{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx(te,{className:"text-gray-300",children:"匹配来源池"}),i.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(A=>{const O=e.poolSettings??lc,X=(Array.isArray(O.poolSource)?O.poolSource:[O.poolSource]).includes(A.value),q=y==null?void 0:y[A.countKey],Z=()=>{const _=Array.isArray(O.poolSource)?[...O.poolSource]:[O.poolSource],$=X?_.filter(oe=>oe!==A.value):[..._,A.value];$.length===0&&$.push(A.value),n({...e,poolSettings:{...O,poolSource:$}})};return i.jsxs("button",{type:"button",onClick:Z,className:`p-4 rounded-lg border text-left transition-all ${X?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${X?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:X&&"✓"}),i.jsx("span",{className:"text-xl",children:A.icon}),i.jsx("span",{className:`text-sm font-medium ${X?"text-[#38bdac]":"text-gray-300"}`,children:A.label})]}),i.jsxs("span",{className:"text-lg font-bold text-white",children:[j?"...":q??"-",i.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),i.jsx("p",{className:"text-gray-500 text-xs mt-2",children:A.desc}),i.jsx("span",{role:"link",tabIndex:0,onClick:_=>{_.stopPropagation(),t(`/users?pool=${A.value}`)},onKeyDown:_=>{_.key==="Enter"&&(_.stopPropagation(),t(`/users?pool=${A.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},A.value)})})]}),i.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[i.jsx(te,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(A=>{const W=(e.poolSettings??lc)[A.key];return i.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[i.jsx(yt,{checked:W,onCheckedChange:X=>n({...e,poolSettings:{...e.poolSettings??lc,[A.key]:X}})}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{children:A.icon}),i.jsx(te,{className:"text-gray-300 text-sm",children:A.label})]})]},A.key)})})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Fi,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),i.jsx(It,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),i.jsxs(Te,{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日免费匹配次数"}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:A=>n({...e,freeMatchLimit:parseInt(A.target.value,10)||0})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:A=>n({...e,matchPrice:parseFloat(A.target.value)||1})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),i.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:A=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(A.target.value,10)||10}})})]})]}),i.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(yt,{checked:e.settings.enableFreeMatches,onCheckedChange:A=>n({...e,settings:{...e.settings,enableFreeMatches:A}})}),i.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(yt,{checked:e.settings.enablePaidMatches,onCheckedChange:A=>n({...e,settings:{...e.settings,enablePaidMatches:A}})}),i.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Nn,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),i.jsx(It,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),i.jsxs(re,{onClick:D,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),i.jsx(Te,{children:i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"图标"}),i.jsx(ke,{className:"text-gray-400",children:"类型ID"}),i.jsx(ke,{className:"text-gray-400",children:"显示名称"}),i.jsx(ke,{className:"text-gray-400",children:"匹配标签"}),i.jsx(ke,{className:"text-gray-400",children:"价格"}),i.jsx(ke,{className:"text-gray-400",children:"数据库匹配"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsx(pr,{children:e.matchTypes.map(A=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsx("span",{className:"text-2xl",children:A.icon})}),i.jsx(ve,{className:"font-mono text-gray-300",children:A.id}),i.jsx(ve,{className:"text-white font-medium",children:A.label}),i.jsx(ve,{className:"text-gray-300",children:A.matchLabel}),i.jsx(ve,{children:i.jsxs(Fe,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",A.price]})}),i.jsx(ve,{children:A.matchFromDB?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):i.jsx(Fe,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),i.jsx(ve,{children:i.jsx(yt,{checked:A.enabled,onCheckedChange:()=>I(A.id)})}),i.jsx(ve,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>M(A),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(bt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>R(A.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(vn,{className:"w-4 h-4"})})]})})]},A.id))})]})})]}),i.jsx(Qt,{open:c,onOpenChange:u,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[h?i.jsx(bt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(Lt,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:A=>g({...m,id:A.target.value}),disabled:!!h})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"图标"}),i.jsx("div",{className:"flex gap-1 flex-wrap",children:lV.map(A=>i.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===A?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:A}),children:A},A))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"显示名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:A=>g({...m,label:A.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"匹配标签"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:A=>g({...m,matchLabel:A.target.value})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:A=>g({...m,price:parseFloat(A.target.value)||1})})]}),i.jsxs("div",{className:"flex gap-6 pt-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(yt,{checked:m.matchFromDB,onCheckedChange:A=>g({...m,matchFromDB:A})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(yt,{checked:m.showJoinAfterMatch,onCheckedChange:A=>g({...m,showJoinAfterMatch:A})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(yt,{checked:m.enabled,onCheckedChange:A=>g({...m,enabled:A})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsxs(re,{onClick:F,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const uN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function dV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null),[v,j]=b.useState(null);async function w(){m(!0),y(null);try{const C=new URLSearchParams({page:String(s),pageSize:String(o)});u&&C.set("matchType",u);const M=await Be(`/api/db/match-records?${C}`);M!=null&&M.success?(e(M.records||[]),r(M.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{w()},[s,u]);const k=Math.ceil(n/o)||1,E=({userId:C,nickname:M,avatar:D})=>i.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>j(C),children:[i.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[D?i.jsx("img",{src:D,alt:"",className:"w-full h-full object-cover",onError:F=>{F.currentTarget.style.display="none"}}):null,i.jsx("span",{className:D?"hidden":"",children:(M||C||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:M||C}),i.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[C==null?void 0:C.slice(0,16),(C==null?void 0:C.length)>16?"...":""]})]})]});return i.jsxs("div",{children:[g&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:g}),i.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("select",{value:u,onChange:C=>{h(C.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[i.jsx("option",{value:"",children:"全部类型"}),Object.entries(uN).map(([C,M])=>i.jsx("option",{value:C,children:M},C))]}),i.jsxs("button",{type:"button",onClick:w,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[i.jsx(qe,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:f?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"发起人"}),i.jsx(ke,{className:"text-gray-400",children:"匹配到"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"联系方式"}),i.jsx(ke,{className:"text-gray-400",children:"匹配时间"})]})}),i.jsxs(pr,{children:[t.map(C=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsx(E,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),i.jsx(ve,{children:C.matchedUserId?i.jsx(E,{userId:C.matchedUserId,nickname:C.matchedNickname,avatar:C.matchedUserAvatar}):i.jsx("span",{className:"text-gray-500",children:"—"})}),i.jsx(ve,{children:i.jsx(Fe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:uN[C.matchType]||C.matchType})}),i.jsxs(ve,{className:"text-sm",children:[C.phone&&i.jsxs("div",{className:"text-green-400",children:["📱 ",C.phone]}),C.wechatId&&i.jsxs("div",{className:"text-blue-400",children:["💬 ",C.wechatId]}),!C.phone&&!C.wechatId&&i.jsx("span",{className:"text-gray-600",children:"-"})]}),i.jsx(ve,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),i.jsx(Zr,{page:s,totalPages:k,total:n,pageSize:o,onPageChange:a,onPageSizeChange:C=>{c(C),a(1)}})]})})}),i.jsx(zx,{open:!!v,onClose:()=>j(null),userId:v,onUserUpdated:w})]})}function uV(){const[t,e]=b.useState("records");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{type:"button",onClick:()=>e("records"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="records"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配记录"}),i.jsx("button",{type:"button",onClick:()=>e("pool"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="pool"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配池设置"})]}),t==="records"&&i.jsx(dV,{}),t==="pool"&&i.jsx(cV,{})]})}const hN={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function hV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0),[f,m]=b.useState("investor"),[g,y]=b.useState(null);async function v(){h(!0);try{const E=new URLSearchParams({page:String(s),pageSize:String(o),matchType:f}),C=await Be(`/api/db/match-records?${E}`);C!=null&&C.success&&(e(C.records||[]),r(C.total??0))}catch(E){console.error(E)}finally{h(!1)}}b.useEffect(()=>{v()},[s,f]);const j=async E=>{if(!E.phone&&!E.wechatId){alert("该记录无联系方式,无法推送到存客宝");return}y(E.id);try{const C=await ht("/api/ckb/join",{type:E.matchType||"investor",phone:E.phone||"",wechat:E.wechatId||"",userId:E.userId,name:E.userNickname||""});alert((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){alert("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{y(null)}},w=Math.ceil(n/o)||1,k=E=>!!(E.phone||E.wechatId);return i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),i.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("select",{value:f,onChange:E=>{m(E.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(hN).map(([E,C])=>i.jsx("option",{value:E,children:C},E))}),i.jsxs(re,{onClick:v,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:u?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"发起人"}),i.jsx(ke,{className:"text-gray-400",children:"匹配到"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"联系方式"}),i.jsx(ke,{className:"text-gray-400",children:"时间"}),i.jsx(ke,{className:"text-gray-400 text-right",children:"操作"})]})}),i.jsxs(pr,{children:[t.map(E=>{var C,M;return i.jsxs(ct,{className:`border-gray-700/50 ${k(E)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[i.jsx(ve,{className:"text-white",children:E.userNickname||((C=E.userId)==null?void 0:C.slice(0,12))}),i.jsx(ve,{className:"text-white",children:E.matchedNickname||((M=E.matchedUserId)==null?void 0:M.slice(0,12))}),i.jsx(ve,{children:i.jsx(Fe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:hN[E.matchType]||E.matchType})}),i.jsxs(ve,{className:"text-sm",children:[E.phone&&i.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&i.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&i.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),i.jsx(ve,{className:"text-gray-400 text-sm",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"}),i.jsx(ve,{className:"text-right",children:k(E)?i.jsxs(re,{size:"sm",onClick:()=>j(E),disabled:g===E.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[i.jsx(mA,{className:"w-3 h-3 mr-1"}),g===E.id?"推送中...":"推送CKB"]}):i.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},E.id)}),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),i.jsx(Zr,{page:s,totalPages:w,total:n,pageSize:o,onPageChange:a,onPageSizeChange:E=>{c(E),a(1)}})]})})})]})}const fN={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},fV={single:"单次",half_year:"半年",year:"年度"};function pV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState("");async function o(){r(!0);try{const c=s?`/api/db/mentor-consultations?status=${s}`:"/api/db/mentor-consultations",u=await Be(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return b.useEffect(()=>{o()},[s]),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("select",{value:s,onChange:c=>a(c.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[i.jsx("option",{value:"",children:"全部状态"}),Object.entries(fN).map(([c,u])=>i.jsx("option",{value:c,children:u},c))]}),i.jsxs(re,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"用户ID"}),i.jsx(ke,{className:"text-gray-400",children:"导师ID"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"金额"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-gray-400",children:"创建时间"})]})}),i.jsxs(pr,{children:[t.map(c=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:c.id}),i.jsx(ve,{className:"text-gray-400",children:c.userId}),i.jsx(ve,{className:"text-gray-400",children:c.mentorId}),i.jsx(ve,{className:"text-gray-400",children:fV[c.consultationType]||c.consultationType}),i.jsxs(ve,{className:"text-white",children:["¥",c.amount]}),i.jsx(ve,{className:"text-gray-400",children:fN[c.status]||c.status}),i.jsx(ve,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function mV(){const[t,e]=b.useState("booking");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{type:"button",onClick:()=>e("booking"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="booking"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"预约记录"}),i.jsx("button",{type:"button",onClick:()=>e("manage"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="manage"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"导师管理"})]}),t==="booking"&&i.jsx(pV,{}),t==="manage"&&i.jsx("div",{className:"-mx-8",children:i.jsx(NE,{embedded:!0})})]})}function gV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(s),pageSize:String(o),matchType:"team"}),y=await Be(`/api/db/match-records?${g}`);y!=null&&y.success&&(e(y.records||[]),r(y.total??0))}catch(g){console.error(g)}finally{h(!1)}}b.useEffect(()=>{f()},[s]);const m=Math.ceil(n/o)||1;return i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("div",{children:[i.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),i.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),i.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[i.jsx(qe,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:u?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"发起人"}),i.jsx(ke,{className:"text-gray-400",children:"匹配到"}),i.jsx(ke,{className:"text-gray-400",children:"联系方式"}),i.jsx(ke,{className:"text-gray-400",children:"时间"})]})}),i.jsxs(pr,{children:[t.map(g=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{className:"text-white",children:g.userNickname||g.userId}),i.jsx(ve,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),i.jsxs(ve,{className:"text-gray-400 text-sm",children:[g.phone&&i.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&i.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),i.jsx(ve,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),i.jsx(Zr,{page:s,totalPages:m,total:n,pageSize:o,onPageChange:a,onPageSizeChange:g=>{c(g),a(1)}})]})})})]})}const pN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"},mN={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮"};function xV({onSwitchTab:t,onOpenCKB:e}={}){const n=sa(),[r,s]=b.useState(null),[a,o]=b.useState(null),[c,u]=b.useState(!0),h=b.useCallback(async()=>{var m,g;u(!0);try{const[y,v]=await Promise.allSettled([Be("/api/db/match-records?stats=true"),Be("/api/db/ckb-plan-stats")]);if(y.status==="fulfilled"&&((m=y.value)!=null&&m.success)&&y.value.data){let j=y.value.data;if(j.totalMatches>0&&(!j.uniqueUsers||j.uniqueUsers===0))try{const w=await Be("/api/db/match-records?page=1&pageSize=200");if(w!=null&&w.success&&w.records){const k=new Set(w.records.map(E=>E.userId).filter(Boolean));j={...j,uniqueUsers:k.size}}}catch{}s(j)}v.status==="fulfilled"&&((g=v.value)!=null&&g.success)&&v.value.data&&o(v.value.data)}catch(y){console.error("加载统计失败:",y)}finally{u(!1)}},[]);b.useEffect(()=>{h()},[h]);const f=m=>c?"—":String(m??0);return i.jsxs("div",{className:"space-y-8",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[i.jsx(Nn,{className:"w-5 h-5 text-[#38bdac]"})," 找伙伴数据"]}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",children:[i.jsx(Ee,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-[#38bdac]/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"总匹配次数"}),i.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.totalMatches)}),i.jsxs("p",{className:"text-[#38bdac] text-xs mt-3 flex items-center gap-1",children:[i.jsx(Xs,{className:"w-3 h-3"})," 查看匹配记录"]})]})}),i.jsx(Ee,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-yellow-500/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"今日匹配"}),i.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.todayMatches)}),i.jsxs("p",{className:"text-yellow-400/60 text-xs mt-3 flex items-center gap-1",children:[i.jsx(Fi,{className:"w-3 h-3"})," 今日实时"]})]})}),i.jsx(Ee,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-blue-500/60 transition-all",onClick:()=>n("/users"),children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"匹配用户数"}),i.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.uniqueUsers)}),i.jsxs("p",{className:"text-blue-400/60 text-xs mt-3 flex items-center gap-1",children:[i.jsx(Xs,{className:"w-3 h-3"})," 查看用户管理"]})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/40",children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"人均匹配"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":r!=null&&r.uniqueUsers?(r.totalMatches/r.uniqueUsers).toFixed(1):"0"})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/40",children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"付费匹配次数"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:f(r==null?void 0:r.paidMatchCount)})]})})]})]}),(r==null?void 0:r.byType)&&r.byType.length>0&&i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"各类型匹配分布"}),i.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:r.byType.map(m=>{const g=r.totalMatches>0?m.count/r.totalMatches*100:0;return i.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/40 rounded-xl p-5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("span",{className:"text-2xl",children:mN[m.matchType]||"📊"}),i.jsx("span",{className:"text-gray-300 font-medium",children:pN[m.matchType]||m.matchType})]}),i.jsx("p",{className:"text-3xl font-bold text-white mb-2",children:m.count}),i.jsx("div",{className:"w-full h-2 bg-gray-700/50 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-[#38bdac] rounded-full transition-all",style:{width:`${Math.min(g,100)}%`}})}),i.jsxs("p",{className:"text-gray-500 text-xs mt-1.5",children:[g.toFixed(1),"%"]})]},m.matchType)})})]}),i.jsxs("div",{children:[i.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[i.jsx(Gs,{className:"w-5 h-5 text-orange-400"})," AI 获客数据"]}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5 mb-6",children:[i.jsx(Ee,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("submitted"),children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"已提交线索"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(a==null?void 0:a.ckbTotal)??0}),i.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("contact"),children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"有联系方式"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(a==null?void 0:a.withContact)??0}),i.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("test"),children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"AI 添加进度"}),i.jsx("p",{className:"text-xl font-bold text-orange-400",children:"查看详情 →"}),i.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"添加成功率 · 回复率 · API 文档"})]})})]}),(a==null?void 0:a.byType)&&a.byType.length>0&&i.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:a.byType.map(m=>i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsx("span",{className:"text-xl",children:mN[m.matchType]||"📋"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-xs",children:pN[m.matchType]||m.matchType}),i.jsx("p",{className:"text-xl font-bold text-white",children:m.total})]})]},m.matchType))})]})]})}const yV=["partner","investor","mentor","team"],ag=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],gN=`# 场景获客接口摘要 +- 地址:POST /v1/api/scenarios +- 必填:apiKey、sign、timestamp +- 主标识:phone 或 wechatId 至少一项 +- 可选:name、source、remark、tags、siteTags、portrait +- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 +- 成功:code=200,message=新增成功 或 已存在`;function vV({initialTab:t="overview"}){const[e,n]=b.useState(t),[r,s]=b.useState("13800000000"),[a,o]=b.useState(""),[c,u]=b.useState(""),[h,f]=b.useState(gN),[m,g]=b.useState(!1),[y,v]=b.useState(!1),[j,w]=b.useState([]),[k,E]=b.useState([]),[C,M]=b.useState({}),[D,F]=b.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),R=b.useMemo(()=>{const _={};return ag.forEach($=>{_[$.key]=C[$.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),_},[C]),I=_=>{const $=r.trim(),oe=a.trim();return _<=3?{type:yV[_],phone:$||void 0,wechat:oe||void 0,userId:"admin_test",name:"后台测试"}:_===4?{matchType:"partner",phone:$||void 0,wechat:oe||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:_===5?{phone:$||void 0,wechatId:oe||void 0,userId:"admin_test",name:"后台测试"}:{}};async function A(){v(!0);try{const[_,$,oe]=await Promise.all([Be("/api/db/config/full?key=ckb_config"),Be("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Be("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),V=_==null?void 0:_.data;V!=null&&V.routes&&M(V.routes),V!=null&&V.docNotes&&u(V.docNotes),V!=null&&V.docContent&&f(V.docContent),$!=null&&$.success&&w($.records||[]),oe!=null&&oe.success&&E(oe.records||[])}finally{v(!1)}}b.useEffect(()=>{n(t)},[t]),b.useEffect(()=>{A()},[]);async function O(){g(!0);try{const _=await ht("/api/db/config",{key:"ckb_config",value:{routes:R,docNotes:c,docContent:h},description:"存客宝接口配置"});alert((_==null?void 0:_.success)!==!1?"存客宝配置已保存":`保存失败: ${(_==null?void 0:_.error)||"未知错误"}`)}catch(_){alert(`保存失败: ${_ instanceof Error?_.message:"网络错误"}`)}finally{g(!1)}}const W=(_,$)=>{M(oe=>({...oe,[_]:{...R[_],...$}}))},X=async _=>{const $=D[_];if($.method==="POST"&&!r.trim()&&!a.trim()){alert("请填写测试手机号");return}const oe=[...D];oe[_]={...$,status:"testing",message:void 0,responseTime:void 0},F(oe);const V=performance.now();try{const ae=$.method==="GET"?await Be($.endpoint):await ht($.endpoint,I(_)),Y=Math.round(performance.now()-V),L=(ae==null?void 0:ae.message)||"",H=(ae==null?void 0:ae.success)===!0||L.includes("已存在")||L.includes("已加入")||L.includes("已提交"),ue=[...D];ue[_]={...$,status:H?"success":"error",message:L||(H?"正常":"异常"),responseTime:Y},F(ue),await A()}catch(ae){const Y=Math.round(performance.now()-V),L=[...D];L[_]={...$,status:"error",message:ae instanceof Error?ae.message:"失败",responseTime:Y},F(L)}},q=async()=>{if(!r.trim()&&!a.trim()){alert("请填写测试手机号");return}for(let _=0;_i.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:i.jsxs("tr",{children:[i.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),i.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),i.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),i.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),i.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),i.jsx("tbody",{children:_.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:$})}):_.map(oe=>i.jsxs("tr",{className:"border-t border-gray-700/30",children:[i.jsx("td",{className:"px-4 py-3 text-white",children:oe.userNickname||oe.userId}),i.jsx("td",{className:"px-4 py-3 text-gray-300",children:oe.matchType}),i.jsx("td",{className:"px-4 py-3 text-green-400",children:oe.phone||"—"}),i.jsx("td",{className:"px-4 py-3 text-blue-400",children:oe.wechatId||"—"}),i.jsx("td",{className:"px-4 py-3 text-gray-400",children:oe.createdAt?new Date(oe.createdAt).toLocaleString():"—"})]},oe.id))})]})});return i.jsx(Ee,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:i.jsxs(Te,{className:"p-5",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),i.jsx(Fe,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),i.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[i.jsx(Xs,{className:"w-3 h-3"})," API 文档"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(re,{onClick:()=>A(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-3.5 h-3.5 mr-1 ${y?"animate-spin":""}`})," 刷新"]}),i.jsxs(re,{onClick:O,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-3.5 h-3.5 mr-1"})," ",m?"保存中...":"保存配置"]})]})]}),i.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","已提交线索"],["contact","有联系方式"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([_,$])=>i.jsx("button",{type:"button",onClick:()=>n(_),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===_?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:$},_))}),e==="overview"&&i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"已提交线索"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:j.length})]}),i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"有联系方式"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:k.length})]}),i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"场景配置数"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:ag.length})]}),i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),i.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&Z(j,"暂无已提交线索"),e==="contact"&&Z(k,"暂无有联系方式线索"),e==="config"&&i.jsx("div",{className:"space-y-4",children:ag.map(_=>i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h4",{className:"text-white font-medium",children:_.label}),i.jsx(Fe,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:_.key})]}),i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"API 地址"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[_.key].apiUrl,onChange:$=>W(_.key,{apiUrl:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"API Key"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[_.key].apiKey,onChange:$=>W(_.key,{apiKey:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"Source"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[_.key].source,onChange:$=>W(_.key,{source:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"Tags"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[_.key].tags,onChange:$=>W(_.key,{tags:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"SiteTags"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[_.key].siteTags,onChange:$=>W(_.key,{siteTags:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"说明备注"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[_.key].notes,onChange:$=>W(_.key,{notes:$.target.value})})]})]})]},_.key))}),e==="test"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex gap-3 mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[i.jsx(kc,{className:"w-4 h-4 text-gray-500 shrink-0"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"测试手机号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:_=>s(_.target.value)})]})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[i.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:a,onChange:_=>o(_.target.value)})]})]}),i.jsx("div",{className:"flex items-end",children:i.jsxs(re,{onClick:q,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[i.jsx(Fi,{className:"w-3.5 h-3.5 mr-1"})," 全部测试"]})})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:D.map((_,$)=>i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[_.status==="idle"&&i.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),_.status==="testing"&&i.jsx(qe,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),_.status==="success"&&i.jsx(hg,{className:"w-3 h-3 text-green-400 shrink-0"}),_.status==="error"&&i.jsx(PN,{className:"w-3 h-3 text-red-400 shrink-0"}),i.jsx("span",{className:"text-white text-xs truncate",children:_.label})]}),i.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[_.responseTime!==void 0&&i.jsxs("span",{className:"text-gray-600 text-[10px]",children:[_.responseTime,"ms"]}),i.jsx("button",{type:"button",onClick:()=>X($),disabled:_.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${_.endpoint}-${$}`))})]}),e==="doc"&&i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h4",{className:"text-white text-sm font-medium",children:"场景获客 API 摘要"}),i.jsxs("a",{href:"https://ckbapi.quwanzhi.com/v1/api/scenarios",target:"_blank",rel:"noreferrer",className:"text-orange-400/70 hover:text-orange-400 text-xs flex items-center gap-1",children:[i.jsx(Xs,{className:"w-3 h-3"})," 打开外链"]})]}),i.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||gN})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[i.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"说明备注(可编辑)"}),i.jsx("textarea",{className:"w-full min-h-[260px] bg-[#0f2137] border border-gray-700 rounded-md text-sm text-gray-300 p-3 outline-none focus:border-orange-500/50 resize-y",value:c,onChange:_=>u(_.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const bV=[{id:"stats",label:"数据统计",icon:AT},{id:"partner",label:"找伙伴",icon:Nn},{id:"resource",label:"资源对接",icon:fM},{id:"mentor",label:"导师预约",icon:dM},{id:"team",label:"团队招募",icon:yg}];function wV(){const[t,e]=b.useState("stats"),[n,r]=b.useState(!1),[s,a]=b.useState("overview");return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Nn,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),i.jsxs(re,{type:"button",variant:"outline",onClick:()=>r(o=>!o),className:"border-orange-500/40 text-orange-300 hover:bg-orange-500/10 bg-transparent",children:[i.jsx(Gs,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),n&&i.jsx(vV,{initialTab:s}),i.jsx("div",{className:"flex flex-wrap gap-1 mb-6 bg-[#0f2137] rounded-lg p-1 border border-gray-700/50",children:bV.map(o=>{const c=t===o.id;return i.jsxs("button",{type:"button",onClick:()=>e(o.id),className:`flex items-center gap-2 px-5 py-2.5 rounded-md text-sm font-medium transition-all ${c?"bg-[#38bdac] text-white shadow-lg":"text-gray-400 hover:text-white hover:bg-gray-700/50"}`,children:[i.jsx(o.icon,{className:"w-4 h-4"}),o.label]},o.id)})}),t==="stats"&&i.jsx(xV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{a(o||"overview"),r(!0)}}),t==="partner"&&i.jsx(uV,{}),t==="resource"&&i.jsx(hV,{}),t==="mentor"&&i.jsx(mV,{}),t==="team"&&i.jsx(gV,{})]})}function NV(){return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[i.jsx(Gs,{className:"w-8 h-8 text-[#38bdac]"}),i.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),i.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"1. 接口总览"})}),i.jsxs(Te,{className:"space-y-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),i.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[i.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),i.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),i.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),i.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),i.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),i.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),i.jsx("li",{children:"/api/config — 配置系统"})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),i.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),i.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"2. 书籍内容"})}),i.jsxs(Te,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),i.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),i.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"3. 支付"})}),i.jsxs(Te,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"POST /api/payment/create-order — 创建订单"}),i.jsx("p",{children:"POST /api/payment/alipay/notify — 支付宝回调"}),i.jsx("p",{children:"POST /api/payment/wechat/notify — 微信回调"})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"4. 分销与用户"})}),i.jsxs(Te,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"/api/referral/* — 邀请码、收益查询、提现"}),i.jsx("p",{children:"/api/user/* — 登录、注册、信息更新"}),i.jsx("p",{children:"/api/match/* — 匹配、匹配历史"})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"5. 管理后台"})}),i.jsxs(Te,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"GET/POST /api/admin/referral-settings — 推广/分销设置(含 VIP 配置)"}),i.jsx("p",{children:"GET /api/db/users、/api/db/book — 用户与章节数据"}),i.jsx("p",{children:"GET /api/orders — 订单列表"})]})]}),i.jsx("p",{className:"text-gray-500 text-xs",children:"完整说明见项目内 开发文档/5、接口/API接口完整文档.md"})]})}function jV(){const t=ra();return i.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:i.jsxs("div",{className:"text-center max-w-md",children:[i.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500/20 text-red-400 mb-6",children:i.jsx(zT,{className:"w-10 h-10"})}),i.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),i.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),i.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:t.pathname}),i.jsx(re,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:i.jsxs(ug,{to:"/",children:[i.jsx(jM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function kV(){return i.jsxs(iT,{children:[i.jsx(Mt,{path:"/login",element:i.jsx(HR,{})}),i.jsxs(Mt,{path:"/",element:i.jsx(KA,{}),children:[i.jsx(Mt,{index:!0,element:i.jsx(um,{to:"/dashboard",replace:!0})}),i.jsx(Mt,{path:"dashboard",element:i.jsx(ZI,{})}),i.jsx(Mt,{path:"orders",element:i.jsx(eP,{})}),i.jsx(Mt,{path:"users",element:i.jsx(tP,{})}),i.jsx(Mt,{path:"distribution",element:i.jsx(jP,{})}),i.jsx(Mt,{path:"withdrawals",element:i.jsx(kP,{})}),i.jsx(Mt,{path:"content",element:i.jsx(VB,{})}),i.jsx(Mt,{path:"referral-settings",element:i.jsx(vk,{})}),i.jsx(Mt,{path:"author-settings",element:i.jsx(um,{to:"/settings?tab=author",replace:!0})}),i.jsx(Mt,{path:"admin-users",element:i.jsx(um,{to:"/settings?tab=admin",replace:!0})}),i.jsx(Mt,{path:"vip-roles",element:i.jsx(aV,{})}),i.jsx(Mt,{path:"mentors",element:i.jsx(NE,{})}),i.jsx(Mt,{path:"mentor-consultations",element:i.jsx(oV,{})}),i.jsx(Mt,{path:"settings",element:i.jsx(YB,{})}),i.jsx(Mt,{path:"payment",element:i.jsx(QB,{})}),i.jsx(Mt,{path:"site",element:i.jsx(tV,{})}),i.jsx(Mt,{path:"qrcodes",element:i.jsx(nV,{})}),i.jsx(Mt,{path:"find-partner",element:i.jsx(wV,{})}),i.jsx(Mt,{path:"match",element:i.jsx(sV,{})}),i.jsx(Mt,{path:"match-records",element:i.jsx(iV,{})}),i.jsx(Mt,{path:"api-doc",element:i.jsx(NV,{})})]}),i.jsx(Mt,{path:"*",element:i.jsx(jV,{})})]})}d3.createRoot(document.getElementById("root")).render(i.jsx(b.StrictMode,{children:i.jsx(fT,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:i.jsx(kV,{})})})); diff --git a/soul-admin/dist/assets/index-jScXDwzJ.css b/soul-admin/dist/assets/index-jScXDwzJ.css deleted file mode 100644 index 7a0ab602..00000000 --- a/soul-admin/dist/assets/index-jScXDwzJ.css +++ /dev/null @@ -1 +0,0 @@ -/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-pink-400:oklch(71.8% .202 349.761);--color-pink-500:oklch(65.6% .241 354.308);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2\.5{top:calc(var(--spacing)*-2.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.-left-2\.5{left:calc(var(--spacing)*-2.5)}.left-0{left:calc(var(--spacing)*0)}.left-1\/4{left:25%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-8{margin-inline:calc(var(--spacing)*-8)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-96{height:calc(var(--spacing)*96)}.h-\[75vh\]{height:75vh}.h-auto{height:auto}.h-full{height:100%}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[32px\]{min-height:32px}.min-h-\[40px\]{min-height:40px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[80px\]{min-height:80px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[260px\]{min-height:260px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-48{width:calc(var(--spacing)*48)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[200px\]{max-width:200px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[1024px\]{min-width:1024px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}:where(.divide-gray-700\/50>:not(:last-child)){border-color:#36415380}@supports (color:color-mix(in lab,red,red)){:where(.divide-gray-700\/50>:not(:last-child)){border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}:where(.divide-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-\[\#07C160\]{border-color:#07c160}.border-\[\#07C160\]\/20{border-color:#07c16033}.border-\[\#07C160\]\/30{border-color:#07c1604d}.border-\[\#38bdac\]{border-color:#38bdac}.border-\[\#38bdac\]\/20{border-color:#38bdac33}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.border-cyan-500\/40{border-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/40{border-color:color-mix(in oklab,var(--color-cyan-500)40%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-700\/30{border-color:#3641534d}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/30{border-color:color-mix(in oklab,var(--color-gray-700)30%,transparent)}}.border-gray-700\/40{border-color:#36415366}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/40{border-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.border-gray-700\/50{border-color:#36415380}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/50{border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-orange-500\/20{border-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/20{border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.border-orange-500\/50{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/50{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.border-purple-500\/20{border-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/20{border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.border-purple-500\/40{border-color:#ac4bff66}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/40{border-color:color-mix(in oklab,var(--color-purple-500)40%,transparent)}}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-transparent{border-color:#0000}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.bg-\[\#0a1628\]{background-color:#0a1628}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#07C160\]{background-color:#07c160}.bg-\[\#07C160\]\/5{background-color:#07c1600d}.bg-\[\#07C160\]\/10{background-color:#07c1601a}.bg-\[\#38bdac\]{background-color:#38bdac}.bg-\[\#38bdac\]\/5{background-color:#38bdac0d}.bg-\[\#38bdac\]\/10{background-color:#38bdac1a}.bg-\[\#38bdac\]\/15{background-color:#38bdac26}.bg-\[\#38bdac\]\/20{background-color:#38bdac33}.bg-\[\#38bdac\]\/30{background-color:#38bdac4d}.bg-\[\#38bdac\]\/60{background-color:#38bdac99}.bg-\[\#38bdac\]\/80{background-color:#38bdaccc}.bg-\[\#162840\]{background-color:#162840}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-600\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-pink-500\/20{background-color:#f6339a33}@supports (color:color-mix(in lab,red,red)){.bg-pink-500\/20{background-color:color-mix(in oklab,var(--color-pink-500)20%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#0f2137\]{--tw-gradient-from:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#162d4a\]{--tw-gradient-to:#162d4a;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.py-24{padding-block:calc(var(--spacing)*24)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-6{padding-top:calc(var(--spacing)*6)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-4{padding-right:calc(var(--spacing)*4)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.text-wrap{text-wrap:wrap}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#00CED1\]{color:#00ced1}.text-\[\#07C160\]{color:#07c160}.text-\[\#07C160\]\/60{color:#07c16099}.text-\[\#07C160\]\/70{color:#07c160b3}.text-\[\#07C160\]\/80{color:#07c160cc}.text-\[\#26A17B\]{color:#26a17b}.text-\[\#38bdac\]{color:#38bdac}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#169BD7\]{color:#169bd7}.text-\[\#1677FF\]{color:#1677ff}.text-\[\#FFD700\]{color:gold}.text-amber-200{color:var(--color-amber-200)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/30{color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/30{color:color-mix(in oklab,var(--color-amber-400)30%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-blue-300\/60{color:#90c5ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/60{color:color-mix(in oklab,var(--color-blue-300)60%,transparent)}}.text-blue-400{color:var(--color-blue-400)}.text-blue-400\/60{color:#54a2ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-400\/60{color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/60{color:#ffb96d99}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/60{color:color-mix(in oklab,var(--color-orange-300)60%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-pink-400{color:var(--color-pink-400)}.text-purple-400{color:var(--color-purple-400)}.text-red-400{color:var(--color-red-400)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-400\/60{color:#fac80099}@supports (color:color-mix(in lab,red,red)){.text-yellow-400\/60{color:color-mix(in oklab,var(--color-yellow-400)60%,transparent)}}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[\#38bdac\]\/20{--tw-shadow-color:#38bdac33}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/20{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.2) var(--tw-shadow-alpha),transparent)}}.shadow-\[\#38bdac\]\/30{--tw-shadow-color:#38bdac4d}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/30{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.3) var(--tw-shadow-alpha),transparent)}}.ring-\[\#38bdac\]{--tw-ring-color:#38bdac}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-\[\#38bdac\]:is(:where(.group):hover *){color:#38bdac}.group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.placeholder\:text-gray-500::placeholder{color:var(--color-gray-500)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-\[\#38bdac\]\/30:hover{border-color:#38bdac4d}.hover\:border-\[\#38bdac\]\/50:hover{border-color:#38bdac80}.hover\:border-\[\#38bdac\]\/60:hover{border-color:#38bdac99}.hover\:border-amber-500\/40:hover{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.hover\:border-amber-500\/40:hover{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.hover\:border-blue-500\/60:hover{border-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-500\/60:hover{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.hover\:border-gray-500:hover{border-color:var(--color-gray-500)}.hover\:border-gray-600:hover{border-color:var(--color-gray-600)}.hover\:border-orange-500\/50:hover{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.hover\:border-orange-500\/50:hover{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.hover\:border-yellow-500\/60:hover{border-color:#edb20099}@supports (color:color-mix(in lab,red,red)){.hover\:border-yellow-500\/60:hover{border-color:color-mix(in oklab,var(--color-yellow-500)60%,transparent)}}.hover\:bg-\[\#0a1628\]:hover{background-color:#0a1628}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-400\/10:hover{background-color:#fcbb001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-400\/10:hover{background-color:color-mix(in oklab,var(--color-amber-400)10%,transparent)}}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-blue-400\/10:hover{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-400\/10:hover{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.hover\:bg-blue-500\/20:hover{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/20:hover{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-gray-500\/20:hover{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-500\/20:hover{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-yellow-400\/10:hover{background-color:#fac8001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-400\/10:hover{background-color:color-mix(in oklab,var(--color-yellow-400)10%,transparent)}}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-300:hover{color:var(--color-amber-300)}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-white:hover{color:var(--color-white)}.hover\:text-yellow-400:hover{color:var(--color-yellow-400)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.focus\:border-orange-500\/50:focus{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.focus\:border-orange-500\/50:focus{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.focus\:bg-\[\#38bdac\]\/20:focus{background-color:#38bdac33}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[\#38bdac\]:focus{--tw-ring-color:#38bdac}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[\#38bdac\]:focus-visible{--tw-ring-color:#38bdac}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-\[\#0a1628\]:focus-visible{--tw-ring-offset-color:#0a1628}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-\[\#07C160\]\/20[data-state=active]{background-color:#07c16033}.data-\[state\=active\]\:bg-\[\#26A17B\]\/20[data-state=active]{background-color:#26a17b33}.data-\[state\=active\]\:bg-\[\#38bdac\]\/20[data-state=active]{background-color:#38bdac33}.data-\[state\=active\]\:bg-\[\#1677FF\]\/20[data-state=active]{background-color:#1677ff33}.data-\[state\=active\]\:bg-\[\#003087\]\/20[data-state=active]{background-color:#00308733}.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.data-\[state\=active\]\:font-medium[data-state=active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[state\=active\]\:text-\[\#07C160\][data-state=active]{color:#07c160}.data-\[state\=active\]\:text-\[\#26A17B\][data-state=active]{color:#26a17b}.data-\[state\=active\]\:text-\[\#38bdac\][data-state=active]{color:#38bdac}.data-\[state\=active\]\:text-\[\#169BD7\][data-state=active]{color:#169bd7}.data-\[state\=active\]\:text-\[\#1677FF\][data-state=active]{color:#1677ff}.data-\[state\=active\]\:text-amber-400[data-state=active]{color:var(--color-amber-400)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:bg-\[\#38bdac\][data-state=checked]{background-color:#38bdac}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-gray-600[data-state=unchecked]{background-color:var(--color-gray-600)}@media(min-width:40rem){.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/soul-admin/dist/assets/index-kWgz5G0L.js b/soul-admin/dist/assets/index-kWgz5G0L.js deleted file mode 100644 index b35b79f0..00000000 --- a/soul-admin/dist/assets/index-kWgz5G0L.js +++ /dev/null @@ -1,521 +0,0 @@ -function wv(r,a){for(var l=0;li[c]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))i(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const m of d.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function l(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function i(c){if(c.ep)return;c.ep=!0;const d=l(c);fetch(c.href,d)}})();function $x(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Cd={exports:{}},Ml={},kd={exports:{}},Ze={};/** - * @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 Cf;function Sv(){if(Cf)return Ze;Cf=1;var r=Symbol.for("react.element"),a=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),m=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.iterator;function k(A){return A===null||typeof A!="object"?null:(A=v&&A[v]||A["@@iterator"],typeof A=="function"?A:null)}var P={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,N={};function j(A,$,z){this.props=A,this.context=$,this.refs=N,this.updater=z||P}j.prototype.isReactComponent={},j.prototype.setState=function(A,$){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,$,"setState")},j.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function C(){}C.prototype=j.prototype;function E(A,$,z){this.props=A,this.context=$,this.refs=N,this.updater=z||P}var b=E.prototype=new C;b.constructor=E,T(b,j.prototype),b.isPureReactComponent=!0;var R=Array.isArray,G=Object.prototype.hasOwnProperty,X={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function I(A,$,z){var ee,K={},de=null,q=null;if($!=null)for(ee in $.ref!==void 0&&(q=$.ref),$.key!==void 0&&(de=""+$.key),$)G.call($,ee)&&!L.hasOwnProperty(ee)&&(K[ee]=$[ee]);var ye=arguments.length-2;if(ye===1)K.children=z;else if(1>>1,$=O[A];if(0>>1;Ac(K,H))de<$&&0>c(q,K)?(O[A]=q,O[de]=H,A=de):(O[A]=K,O[ee]=H,A=ee);else if(de<$&&0>c(q,H))O[A]=q,O[de]=H,A=de;else break e}}return re}function c(O,re){var H=O.sortIndex-re.sortIndex;return H!==0?H:O.id-re.id}if(typeof performance=="object"&&typeof performance.now=="function"){var d=performance;r.unstable_now=function(){return d.now()}}else{var m=Date,f=m.now();r.unstable_now=function(){return m.now()-f}}var p=[],y=[],g=1,v=null,k=3,P=!1,T=!1,N=!1,j=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=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(O){for(var re=l(y);re!==null;){if(re.callback===null)i(y);else if(re.startTime<=O)i(y),re.sortIndex=re.expirationTime,a(p,re);else break;re=l(y)}}function R(O){if(N=!1,b(O),!T)if(l(p)!==null)T=!0,Q(G);else{var re=l(y);re!==null&&ue(R,re.startTime-O)}}function G(O,re){T=!1,N&&(N=!1,C(I),I=-1),P=!0;var H=k;try{for(b(re),v=l(p);v!==null&&(!(v.expirationTime>re)||O&&!te());){var A=v.callback;if(typeof A=="function"){v.callback=null,k=v.priorityLevel;var $=A(v.expirationTime<=re);re=r.unstable_now(),typeof $=="function"?v.callback=$:v===l(p)&&i(p),b(re)}else i(p);v=l(p)}if(v!==null)var z=!0;else{var ee=l(y);ee!==null&&ue(R,ee.startTime-re),z=!1}return z}finally{v=null,k=H,P=!1}}var X=!1,L=null,I=-1,w=5,V=-1;function te(){return!(r.unstable_now()-VO||125A?(O.sortIndex=H,a(y,O),l(p)===null&&O===l(y)&&(N?(C(I),I=-1):N=!0,ue(R,H-A))):(O.sortIndex=$,a(p,O),T||P||(T=!0,Q(G))),O},r.unstable_shouldYield=te,r.unstable_wrapCallback=function(O){var re=k;return function(){var H=k;k=re;try{return O.apply(this,arguments)}finally{k=H}}}})(Td)),Td}var Rf;function Pv(){return Rf||(Rf=1,Pd.exports=Ev()),Pd.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 If;function Tv(){if(If)return fs;If=1;var r=Nu(),a=Pv();function l(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,y=/^[: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]*$/,g={},v={};function k(t){return p.call(v,t)?!0:p.call(g,t)?!1:y.test(t)?v[t]=!0:(g[t]=!0,!1)}function P(t,s,n,o){if(n!==null&&n.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return o?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function T(t,s,n,o){if(s===null||typeof s>"u"||P(t,s,n,o))return!0;if(o)return!1;if(n!==null)switch(n.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function N(t,s,n,o,h,x,S){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=o,this.attributeNamespace=h,this.mustUseProperty=n,this.propertyName=t,this.type=s,this.sanitizeURL=x,this.removeEmptyString=S}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){j[t]=new N(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];j[s]=new N(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){j[t]=new N(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){j[t]=new N(t,2,!1,t,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(t){j[t]=new N(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){j[t]=new N(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){j[t]=new N(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){j[t]=new N(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){j[t]=new N(t,5,!1,t.toLowerCase(),null,!1,!1)});var C=/[\-:]([a-z])/g;function E(t){return t[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(t){var s=t.replace(C,E);j[s]=new N(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(C,E);j[s]=new N(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(C,E);j[s]=new N(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){j[t]=new N(t,1,!1,t.toLowerCase(),null,!1,!1)}),j.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){j[t]=new N(t,1,!1,t.toLowerCase(),null,!0,!0)});function b(t,s,n,o){var h=j.hasOwnProperty(s)?j[s]:null;(h!==null?h.type!==0:o||!(2M||h[S]!==x[M]){var B=` -`+h[S].replace(" at new "," at ");return t.displayName&&B.includes("")&&(B=B.replace("",t.displayName)),B}while(1<=S&&0<=M);break}}}finally{z=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?$(t):""}function K(t){switch(t.tag){case 5:return $(t.type);case 16:return $("Lazy");case 13:return $("Suspense");case 19:return $("SuspenseList");case 0:case 2:case 15:return t=ee(t.type,!1),t;case 11:return t=ee(t.type.render,!1),t;case 1:return t=ee(t.type,!0),t;default:return""}}function de(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case L:return"Fragment";case X:return"Portal";case w:return"Profiler";case I:return"StrictMode";case Y:return"Suspense";case ne:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case te:return(t.displayName||"Context")+".Consumer";case V:return(t._context.displayName||"Context")+".Provider";case ie:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case _:return s=t.displayName||null,s!==null?s:de(t.type)||"Memo";case Q:s=t._payload,t=t._init;try{return de(t(s))}catch{}}return null}function q(t){var s=t.type;switch(t.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return de(s);case 8:return s===I?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function ye(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ce(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function F(t){var s=Ce(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),o=""+t[s];if(!t.hasOwnProperty(s)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var h=n.get,x=n.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return h.call(this)},set:function(S){o=""+S,x.call(this,S)}}),Object.defineProperty(t,s,{enumerable:n.enumerable}),{getValue:function(){return o},setValue:function(S){o=""+S},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function xe(t){t._valueTracker||(t._valueTracker=F(t))}function Pe(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var n=s.getValue(),o="";return t&&(o=Ce(t)?t.checked?"true":"false":t.value),t=o,t!==n?(s.setValue(t),!0):!1}function Ve(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function He(t,s){var n=s.checked;return H({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Ke(t,s){var n=s.defaultValue==null?"":s.defaultValue,o=s.checked!=null?s.checked:s.defaultChecked;n=ye(s.value!=null?s.value:n),t._wrapperState={initialChecked:o,initialValue:n,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function tt(t,s){s=s.checked,s!=null&&b(t,"checked",s,!1)}function $e(t,s){tt(t,s);var n=ye(s.value),o=s.type;if(n!=null)o==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(o==="submit"||o==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?pe(t,s.type,n):s.hasOwnProperty("defaultValue")&&pe(t,s.type,ye(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function me(t,s,n){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var o=s.type;if(!(o!=="submit"&&o!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+t._wrapperState.initialValue,n||s===t.value||(t.value=s),t.defaultValue=s}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function pe(t,s,n){(s!=="number"||Ve(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var ft=Array.isArray;function ss(t,s,n,o){if(t=t.options,s){s={};for(var h=0;h"+s.valueOf().toString()+"",s=rs.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function Xs(t,s){if(s){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=s;return}}t.textContent=s}var ns={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Sn=["Webkit","ms","Moz","O"];Object.keys(ns).forEach(function(t){Sn.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),ns[s]=ns[t]})});function ta(t,s,n){return s==null||typeof s=="boolean"||s===""?"":n||typeof s!="number"||s===0||ns.hasOwnProperty(t)&&ns[t]?(""+s).trim():s+"px"}function Es(t,s){t=t.style;for(var n in s)if(s.hasOwnProperty(n)){var o=n.indexOf("--")===0,h=ta(n,s[n],o);n==="float"&&(n="cssFloat"),o?t.setProperty(n,h):t[n]=h}}var Rr=H({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Js(t,s){if(s){if(Rr[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(l(137,t));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(l(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(l(61))}if(s.style!=null&&typeof s.style!="object")throw Error(l(62))}}function Nt(t,s){if(t.indexOf("-")===-1)return typeof s.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ps=null;function bs(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Zs=null,os=null,Ts=null;function Pt(t){if(t=yl(t)){if(typeof Zs!="function")throw Error(l(280));var s=t.stateNode;s&&(s=mi(s),Zs(t.stateNode,t.type,s))}}function sa(t){os?Ts?Ts.push(t):Ts=[t]:os=t}function ra(){if(os){var t=os,s=Ts;if(Ts=os=null,Pt(t),s)for(t=0;t>>=0,t===0?32:31-(tr(t)/Ho|0)|0}var Dr=64,Mt=4194304;function Lr(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Xl(t,s){var n=t.pendingLanes;if(n===0)return 0;var o=0,h=t.suspendedLanes,x=t.pingedLanes,S=n&268435455;if(S!==0){var M=S&~h;M!==0?o=Lr(M):(x&=S,x!==0&&(o=Lr(x)))}else S=n&~h,S!==0?o=Lr(S):x!==0&&(o=Lr(x));if(o===0)return 0;if(s!==0&&s!==o&&(s&h)===0&&(h=o&-o,x=s&-s,h>=x||h===16&&(x&4194240)!==0))return s;if((o&4)!==0&&(o|=n&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=o;0n;n++)s.push(t);return s}function tl(t,s,n){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-nt(s),t[s]=n}function Wg(t,s){var n=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var o=t.eventTimes;for(t=t.expirationTimes;0=cl),gh=" ",yh=!1;function vh(t,s){switch(t){case"keyup":return yy.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bh(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var da=!1;function by(t,s){switch(t){case"compositionend":return bh(s);case"keypress":return s.which!==32?null:(yh=!0,gh);case"textInput":return t=s.data,t===gh&&yh?null:t;default:return null}}function jy(t,s){if(da)return t==="compositionend"||!ac&&vh(t,s)?(t=uh(),si=Zo=Br=null,da=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:n,offset:s-t};t=o}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Eh(n)}}function Th(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Th(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Rh(){for(var t=window,s=Ve();s instanceof t.HTMLIFrameElement;){try{var n=typeof s.contentWindow.location.href=="string"}catch{n=!1}if(n)t=s.contentWindow;else break;s=Ve(t.document)}return s}function oc(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function Ry(t){var s=Rh(),n=t.focusedElem,o=t.selectionRange;if(s!==n&&n&&n.ownerDocument&&Th(n.ownerDocument.documentElement,n)){if(o!==null&&oc(n)){if(s=o.start,t=o.end,t===void 0&&(t=s),"selectionStart"in n)n.selectionStart=s,n.selectionEnd=Math.min(t,n.value.length);else if(t=(s=n.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var h=n.textContent.length,x=Math.min(o.start,h);o=o.end===void 0?x:Math.min(o.end,h),!t.extend&&x>o&&(h=o,o=x,x=h),h=Ph(n,x);var S=Ph(n,o);h&&S&&(t.rangeCount!==1||t.anchorNode!==h.node||t.anchorOffset!==h.offset||t.focusNode!==S.node||t.focusOffset!==S.offset)&&(s=s.createRange(),s.setStart(h.node,h.offset),t.removeAllRanges(),x>o?(t.addRange(s),t.extend(S.node,S.offset)):(s.setEnd(S.node,S.offset),t.addRange(s)))}}for(s=[],t=n;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,ua=null,cc=null,ml=null,dc=!1;function Ih(t,s,n){var o=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;dc||ua==null||ua!==Ve(o)||(o=ua,"selectionStart"in o&&oc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),ml&&hl(ml,o)||(ml=o,o=di(cc,"onSelect"),0pa||(t.current=Nc[pa],Nc[pa]=null,pa--)}function ht(t,s){pa++,Nc[pa]=t.current,t.current=s}var Hr={},Xt=Wr(Hr),cs=Wr(!1),Dn=Hr;function ga(t,s){var n=t.type.contextTypes;if(!n)return Hr;var o=t.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===s)return o.__reactInternalMemoizedMaskedChildContext;var h={},x;for(x in n)h[x]=s[x];return o&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=h),h}function ds(t){return t=t.childContextTypes,t!=null}function fi(){pt(cs),pt(Xt)}function Kh(t,s,n){if(Xt.current!==Hr)throw Error(l(168));ht(Xt,s),ht(cs,n)}function Gh(t,s,n){var o=t.stateNode;if(s=s.childContextTypes,typeof o.getChildContext!="function")return n;o=o.getChildContext();for(var h in o)if(!(h in s))throw Error(l(108,q(t)||"Unknown",h));return H({},n,o)}function xi(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Hr,Dn=Xt.current,ht(Xt,t),ht(cs,cs.current),!0}function Yh(t,s,n){var o=t.stateNode;if(!o)throw Error(l(169));n?(t=Gh(t,s,Dn),o.__reactInternalMemoizedMergedChildContext=t,pt(cs),pt(Xt),ht(Xt,t)):pt(cs),ht(cs,n)}var fr=null,pi=!1,wc=!1;function Qh(t){fr===null?fr=[t]:fr.push(t)}function Uy(t){pi=!0,Qh(t)}function Kr(){if(!wc&&fr!==null){wc=!0;var t=0,s=ct;try{var n=fr;for(ct=1;t>=S,h-=S,xr=1<<32-nt(s)+h|n<Ue?(Kt=ze,ze=null):Kt=ze.sibling;var at=he(J,ze,ae[Ue],be);if(at===null){ze===null&&(ze=Kt);break}t&&ze&&at.alternate===null&&s(J,ze),W=x(at,W,Ue),Fe===null?De=at:Fe.sibling=at,Fe=at,ze=Kt}if(Ue===ae.length)return n(J,ze),bt&&On(J,Ue),De;if(ze===null){for(;UeUe?(Kt=ze,ze=null):Kt=ze.sibling;var tn=he(J,ze,at.value,be);if(tn===null){ze===null&&(ze=Kt);break}t&&ze&&tn.alternate===null&&s(J,ze),W=x(tn,W,Ue),Fe===null?De=tn:Fe.sibling=tn,Fe=tn,ze=Kt}if(at.done)return n(J,ze),bt&&On(J,Ue),De;if(ze===null){for(;!at.done;Ue++,at=ae.next())at=ve(J,at.value,be),at!==null&&(W=x(at,W,Ue),Fe===null?De=at:Fe.sibling=at,Fe=at);return bt&&On(J,Ue),De}for(ze=o(J,ze);!at.done;Ue++,at=ae.next())at=Te(ze,J,Ue,at.value,be),at!==null&&(t&&at.alternate!==null&&ze.delete(at.key===null?Ue:at.key),W=x(at,W,Ue),Fe===null?De=at:Fe.sibling=at,Fe=at);return t&&ze.forEach(function(Nv){return s(J,Nv)}),bt&&On(J,Ue),De}function At(J,W,ae,be){if(typeof ae=="object"&&ae!==null&&ae.type===L&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case G:e:{for(var De=ae.key,Fe=W;Fe!==null;){if(Fe.key===De){if(De=ae.type,De===L){if(Fe.tag===7){n(J,Fe.sibling),W=h(Fe,ae.props.children),W.return=J,J=W;break e}}else if(Fe.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===Q&&tm(De)===Fe.type){n(J,Fe.sibling),W=h(Fe,ae.props),W.ref=vl(J,Fe,ae),W.return=J,J=W;break e}n(J,Fe);break}else s(J,Fe);Fe=Fe.sibling}ae.type===L?(W=Hn(ae.props.children,J.mode,be,ae.key),W.return=J,J=W):(be=Wi(ae.type,ae.key,ae.props,null,J.mode,be),be.ref=vl(J,W,ae),be.return=J,J=be)}return S(J);case X:e:{for(Fe=ae.key;W!==null;){if(W.key===Fe)if(W.tag===4&&W.stateNode.containerInfo===ae.containerInfo&&W.stateNode.implementation===ae.implementation){n(J,W.sibling),W=h(W,ae.children||[]),W.return=J,J=W;break e}else{n(J,W);break}else s(J,W);W=W.sibling}W=bd(ae,J.mode,be),W.return=J,J=W}return S(J);case Q:return Fe=ae._init,At(J,W,Fe(ae._payload),be)}if(ft(ae))return Ie(J,W,ae,be);if(re(ae))return Ae(J,W,ae,be);bi(J,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"?(ae=""+ae,W!==null&&W.tag===6?(n(J,W.sibling),W=h(W,ae),W.return=J,J=W):(n(J,W),W=vd(ae,J.mode,be),W.return=J,J=W),S(J)):n(J,W)}return At}var ja=sm(!0),rm=sm(!1),ji=Wr(null),Ni=null,Na=null,Tc=null;function Rc(){Tc=Na=Ni=null}function Ic(t){var s=ji.current;pt(ji),t._currentValue=s}function _c(t,s,n){for(;t!==null;){var o=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,o!==null&&(o.childLanes|=s)):o!==null&&(o.childLanes&s)!==s&&(o.childLanes|=s),t===n)break;t=t.return}}function wa(t,s){Ni=t,Tc=Na=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(us=!0),t.firstContext=null)}function As(t){var s=t._currentValue;if(Tc!==t)if(t={context:t,memoizedValue:s,next:null},Na===null){if(Ni===null)throw Error(l(308));Na=t,Ni.dependencies={lanes:0,firstContext:t}}else Na=Na.next=t;return s}var Fn=null;function Mc(t){Fn===null?Fn=[t]:Fn.push(t)}function nm(t,s,n,o){var h=s.interleaved;return h===null?(n.next=n,Mc(s)):(n.next=h.next,h.next=n),s.interleaved=n,gr(t,o)}function gr(t,s){t.lanes|=s;var n=t.alternate;for(n!==null&&(n.lanes|=s),n=t,t=t.return;t!==null;)t.childLanes|=s,n=t.alternate,n!==null&&(n.childLanes|=s),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Gr=!1;function Ac(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function am(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function yr(t,s){return{eventTime:t,lane:s,tag:0,payload:null,callback:null,next:null}}function Yr(t,s,n){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(st&2)!==0){var h=o.pending;return h===null?s.next=s:(s.next=h.next,h.next=s),o.pending=s,gr(t,n)}return h=o.interleaved,h===null?(s.next=s,Mc(o)):(s.next=h.next,h.next=s),o.interleaved=s,gr(t,n)}function wi(t,s,n){if(s=s.updateQueue,s!==null&&(s=s.shared,(n&4194240)!==0)){var o=s.lanes;o&=t.pendingLanes,n|=o,s.lanes=n,Yo(t,n)}}function lm(t,s){var n=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,n===o)){var h=null,x=null;if(n=n.firstBaseUpdate,n!==null){do{var S={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};x===null?h=x=S:x=x.next=S,n=n.next}while(n!==null);x===null?h=x=s:x=x.next=s}else h=x=s;n={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:x,shared:o.shared,effects:o.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=s:t.next=s,n.lastBaseUpdate=s}function Si(t,s,n,o){var h=t.updateQueue;Gr=!1;var x=h.firstBaseUpdate,S=h.lastBaseUpdate,M=h.shared.pending;if(M!==null){h.shared.pending=null;var B=M,le=B.next;B.next=null,S===null?x=le:S.next=le,S=B;var fe=t.alternate;fe!==null&&(fe=fe.updateQueue,M=fe.lastBaseUpdate,M!==S&&(M===null?fe.firstBaseUpdate=le:M.next=le,fe.lastBaseUpdate=B))}if(x!==null){var ve=h.baseState;S=0,fe=le=B=null,M=x;do{var he=M.lane,Te=M.eventTime;if((o&he)===he){fe!==null&&(fe=fe.next={eventTime:Te,lane:0,tag:M.tag,payload:M.payload,callback:M.callback,next:null});e:{var Ie=t,Ae=M;switch(he=s,Te=n,Ae.tag){case 1:if(Ie=Ae.payload,typeof Ie=="function"){ve=Ie.call(Te,ve,he);break e}ve=Ie;break e;case 3:Ie.flags=Ie.flags&-65537|128;case 0:if(Ie=Ae.payload,he=typeof Ie=="function"?Ie.call(Te,ve,he):Ie,he==null)break e;ve=H({},ve,he);break e;case 2:Gr=!0}}M.callback!==null&&M.lane!==0&&(t.flags|=64,he=h.effects,he===null?h.effects=[M]:he.push(M))}else Te={eventTime:Te,lane:he,tag:M.tag,payload:M.payload,callback:M.callback,next:null},fe===null?(le=fe=Te,B=ve):fe=fe.next=Te,S|=he;if(M=M.next,M===null){if(M=h.shared.pending,M===null)break;he=M,M=he.next,he.next=null,h.lastBaseUpdate=he,h.shared.pending=null}}while(!0);if(fe===null&&(B=ve),h.baseState=B,h.firstBaseUpdate=le,h.lastBaseUpdate=fe,s=h.shared.interleaved,s!==null){h=s;do S|=h.lane,h=h.next;while(h!==s)}else x===null&&(h.shared.lanes=0);Bn|=S,t.lanes=S,t.memoizedState=ve}}function im(t,s,n){if(t=s.effects,s.effects=null,t!==null)for(s=0;sn?n:4,t(!0);var o=zc.transition;zc.transition={};try{t(!1),s()}finally{ct=n,zc.transition=o}}function km(){return Ds().memoizedState}function Ky(t,s,n){var o=Jr(t);if(n={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null},Em(t))Pm(s,n);else if(n=nm(t,s,n,o),n!==null){var h=is();Hs(n,t,o,h),Tm(n,s,o)}}function Gy(t,s,n){var o=Jr(t),h={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null};if(Em(t))Pm(s,h);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var S=s.lastRenderedState,M=x(S,n);if(h.hasEagerState=!0,h.eagerState=M,$s(M,S)){var B=s.interleaved;B===null?(h.next=h,Mc(s)):(h.next=B.next,B.next=h),s.interleaved=h;return}}catch{}finally{}n=nm(t,s,h,o),n!==null&&(h=is(),Hs(n,t,o,h),Tm(n,s,o))}}function Em(t){var s=t.alternate;return t===St||s!==null&&s===St}function Pm(t,s){wl=Ei=!0;var n=t.pending;n===null?s.next=s:(s.next=n.next,n.next=s),t.pending=s}function Tm(t,s,n){if((n&4194240)!==0){var o=s.lanes;o&=t.pendingLanes,n|=o,s.lanes=n,Yo(t,n)}}var Ri={readContext:As,useCallback:Jt,useContext:Jt,useEffect:Jt,useImperativeHandle:Jt,useInsertionEffect:Jt,useLayoutEffect:Jt,useMemo:Jt,useReducer:Jt,useRef:Jt,useState:Jt,useDebugValue:Jt,useDeferredValue:Jt,useTransition:Jt,useMutableSource:Jt,useSyncExternalStore:Jt,useId:Jt,unstable_isNewReconciler:!1},Yy={readContext:As,useCallback:function(t,s){return nr().memoizedState=[t,s===void 0?null:s],t},useContext:As,useEffect:ym,useImperativeHandle:function(t,s,n){return n=n!=null?n.concat([t]):null,Pi(4194308,4,jm.bind(null,s,t),n)},useLayoutEffect:function(t,s){return Pi(4194308,4,t,s)},useInsertionEffect:function(t,s){return Pi(4,2,t,s)},useMemo:function(t,s){var n=nr();return s=s===void 0?null:s,t=t(),n.memoizedState=[t,s],t},useReducer:function(t,s,n){var o=nr();return s=n!==void 0?n(s):s,o.memoizedState=o.baseState=s,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:s},o.queue=t,t=t.dispatch=Ky.bind(null,St,t),[o.memoizedState,t]},useRef:function(t){var s=nr();return t={current:t},s.memoizedState=t},useState:pm,useDebugValue:Kc,useDeferredValue:function(t){return nr().memoizedState=t},useTransition:function(){var t=pm(!1),s=t[0];return t=Hy.bind(null,t[1]),nr().memoizedState=t,[s,t]},useMutableSource:function(){},useSyncExternalStore:function(t,s,n){var o=St,h=nr();if(bt){if(n===void 0)throw Error(l(407));n=n()}else{if(n=s(),Ht===null)throw Error(l(349));($n&30)!==0||um(o,s,n)}h.memoizedState=n;var x={value:n,getSnapshot:s};return h.queue=x,ym(mm.bind(null,o,x,t),[t]),o.flags|=2048,kl(9,hm.bind(null,o,x,n,s),void 0,null),n},useId:function(){var t=nr(),s=Ht.identifierPrefix;if(bt){var n=pr,o=xr;n=(o&~(1<<32-nt(o)-1)).toString(32)+n,s=":"+s+"R"+n,n=Sl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof o.is=="string"?t=S.createElement(n,{is:o.is}):(t=S.createElement(n),n==="select"&&(S=t,o.multiple?S.multiple=!0:o.size&&(S.size=o.size))):t=S.createElementNS(t,n),t[sr]=s,t[gl]=o,Qm(t,s,!1,!1),s.stateNode=t;e:{switch(S=Nt(n,o),n){case"dialog":xt("cancel",t),xt("close",t),h=o;break;case"iframe":case"object":case"embed":xt("load",t),h=o;break;case"video":case"audio":for(h=0;hPa&&(s.flags|=128,o=!0,El(x,!1),s.lanes=4194304)}else{if(!o)if(t=Ci(S),t!==null){if(s.flags|=128,o=!0,n=t.updateQueue,n!==null&&(s.updateQueue=n,s.flags|=4),El(x,!0),x.tail===null&&x.tailMode==="hidden"&&!S.alternate&&!bt)return Zt(s),null}else 2*lt()-x.renderingStartTime>Pa&&n!==1073741824&&(s.flags|=128,o=!0,El(x,!1),s.lanes=4194304);x.isBackwards?(S.sibling=s.child,s.child=S):(n=x.last,n!==null?n.sibling=S:s.child=S,x.last=S)}return x.tail!==null?(s=x.tail,x.rendering=s,x.tail=s.sibling,x.renderingStartTime=lt(),s.sibling=null,n=wt.current,ht(wt,o?n&1|2:n&1),s):(Zt(s),null);case 22:case 23:return pd(),o=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==o&&(s.flags|=8192),o&&(s.mode&1)!==0?(Ss&1073741824)!==0&&(Zt(s),s.subtreeFlags&6&&(s.flags|=8192)):Zt(s),null;case 24:return null;case 25:return null}throw Error(l(156,s.tag))}function sv(t,s){switch(Cc(s),s.tag){case 1:return ds(s.type)&&fi(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return Sa(),pt(cs),pt(Xt),Fc(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return Lc(s),null;case 13:if(pt(wt),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(l(340));ba()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return pt(wt),null;case 4:return Sa(),null;case 10:return Ic(s.type._context),null;case 22:case 23:return pd(),null;case 24:return null;default:return null}}var Ai=!1,es=!1,rv=typeof WeakSet=="function"?WeakSet:Set,Re=null;function ka(t,s){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(o){Tt(t,s,o)}else n.current=null}function nd(t,s,n){try{n()}catch(o){Tt(t,s,o)}}var Jm=!1;function nv(t,s){if(pc=ei,t=Rh(),oc(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var o=n.getSelection&&n.getSelection();if(o&&o.rangeCount!==0){n=o.anchorNode;var h=o.anchorOffset,x=o.focusNode;o=o.focusOffset;try{n.nodeType,x.nodeType}catch{n=null;break e}var S=0,M=-1,B=-1,le=0,fe=0,ve=t,he=null;t:for(;;){for(var Te;ve!==n||h!==0&&ve.nodeType!==3||(M=S+h),ve!==x||o!==0&&ve.nodeType!==3||(B=S+o),ve.nodeType===3&&(S+=ve.nodeValue.length),(Te=ve.firstChild)!==null;)he=ve,ve=Te;for(;;){if(ve===t)break t;if(he===n&&++le===h&&(M=S),he===x&&++fe===o&&(B=S),(Te=ve.nextSibling)!==null)break;ve=he,he=ve.parentNode}ve=Te}n=M===-1||B===-1?null:{start:M,end:B}}else n=null}n=n||{start:0,end:0}}else n=null;for(gc={focusedElem:t,selectionRange:n},ei=!1,Re=s;Re!==null;)if(s=Re,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,Re=t;else for(;Re!==null;){s=Re;try{var Ie=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ie!==null){var Ae=Ie.memoizedProps,At=Ie.memoizedState,J=s.stateNode,W=J.getSnapshotBeforeUpdate(s.elementType===s.type?Ae:Us(s.type,Ae),At);J.__reactInternalSnapshotBeforeUpdate=W}break;case 3:var ae=s.stateNode.containerInfo;ae.nodeType===1?ae.textContent="":ae.nodeType===9&&ae.documentElement&&ae.removeChild(ae.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(l(163))}}catch(be){Tt(s,s.return,be)}if(t=s.sibling,t!==null){t.return=s.return,Re=t;break}Re=s.return}return Ie=Jm,Jm=!1,Ie}function Pl(t,s,n){var o=s.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var h=o=o.next;do{if((h.tag&t)===t){var x=h.destroy;h.destroy=void 0,x!==void 0&&nd(s,n,x)}h=h.next}while(h!==o)}}function Di(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var n=s=s.next;do{if((n.tag&t)===t){var o=n.create;n.destroy=o()}n=n.next}while(n!==s)}}function ad(t){var s=t.ref;if(s!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof s=="function"?s(t):s.current=t}}function Zm(t){var s=t.alternate;s!==null&&(t.alternate=null,Zm(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[sr],delete s[gl],delete s[jc],delete s[$y],delete s[By])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function ef(t){return t.tag===5||t.tag===3||t.tag===4}function tf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||ef(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ld(t,s,n){var o=t.tag;if(o===5||o===6)t=t.stateNode,s?n.nodeType===8?n.parentNode.insertBefore(t,s):n.insertBefore(t,s):(n.nodeType===8?(s=n.parentNode,s.insertBefore(t,n)):(s=n,s.appendChild(t)),n=n._reactRootContainer,n!=null||s.onclick!==null||(s.onclick=hi));else if(o!==4&&(t=t.child,t!==null))for(ld(t,s,n),t=t.sibling;t!==null;)ld(t,s,n),t=t.sibling}function id(t,s,n){var o=t.tag;if(o===5||o===6)t=t.stateNode,s?n.insertBefore(t,s):n.appendChild(t);else if(o!==4&&(t=t.child,t!==null))for(id(t,s,n),t=t.sibling;t!==null;)id(t,s,n),t=t.sibling}var Qt=null,Vs=!1;function Qr(t,s,n){for(n=n.child;n!==null;)sf(t,s,n),n=n.sibling}function sf(t,s,n){if(rt&&typeof rt.onCommitFiberUnmount=="function")try{rt.onCommitFiberUnmount(ke,n)}catch{}switch(n.tag){case 5:es||ka(n,s);case 6:var o=Qt,h=Vs;Qt=null,Qr(t,s,n),Qt=o,Vs=h,Qt!==null&&(Vs?(t=Qt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Qt.removeChild(n.stateNode));break;case 18:Qt!==null&&(Vs?(t=Qt,n=n.stateNode,t.nodeType===8?bc(t.parentNode,n):t.nodeType===1&&bc(t,n),ll(t)):bc(Qt,n.stateNode));break;case 4:o=Qt,h=Vs,Qt=n.stateNode.containerInfo,Vs=!0,Qr(t,s,n),Qt=o,Vs=h;break;case 0:case 11:case 14:case 15:if(!es&&(o=n.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){h=o=o.next;do{var x=h,S=x.destroy;x=x.tag,S!==void 0&&((x&2)!==0||(x&4)!==0)&&nd(n,s,S),h=h.next}while(h!==o)}Qr(t,s,n);break;case 1:if(!es&&(ka(n,s),o=n.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=n.memoizedProps,o.state=n.memoizedState,o.componentWillUnmount()}catch(M){Tt(n,s,M)}Qr(t,s,n);break;case 21:Qr(t,s,n);break;case 22:n.mode&1?(es=(o=es)||n.memoizedState!==null,Qr(t,s,n),es=o):Qr(t,s,n);break;default:Qr(t,s,n)}}function rf(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new rv),s.forEach(function(o){var h=mv.bind(null,t,o);n.has(o)||(n.add(o),o.then(h,h))})}}function Ws(t,s){var n=s.deletions;if(n!==null)for(var o=0;oh&&(h=S),o&=~x}if(o=h,o=lt()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*lv(o/1960))-o,10t?16:t,Xr===null)var o=!1;else{if(t=Xr,Xr=null,$i=0,(st&6)!==0)throw Error(l(331));var h=st;for(st|=4,Re=t.current;Re!==null;){var x=Re,S=x.child;if((Re.flags&16)!==0){var M=x.deletions;if(M!==null){for(var B=0;Blt()-dd?Vn(t,0):cd|=n),ms(t,s)}function gf(t,s){s===0&&((t.mode&1)===0?s=1:(s=Mt,Mt<<=1,(Mt&130023424)===0&&(Mt=4194304)));var n=is();t=gr(t,s),t!==null&&(tl(t,s,n),ms(t,n))}function hv(t){var s=t.memoizedState,n=0;s!==null&&(n=s.retryLane),gf(t,n)}function mv(t,s){var n=0;switch(t.tag){case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(n=h.retryLane);break;case 19:o=t.stateNode;break;default:throw Error(l(314))}o!==null&&o.delete(s),gf(t,n)}var yf;yf=function(t,s,n){if(t!==null)if(t.memoizedProps!==s.pendingProps||cs.current)us=!0;else{if((t.lanes&n)===0&&(s.flags&128)===0)return us=!1,ev(t,s,n);us=(t.flags&131072)!==0}else us=!1,bt&&(s.flags&1048576)!==0&&qh(s,yi,s.index);switch(s.lanes=0,s.tag){case 2:var o=s.type;Mi(t,s),t=s.pendingProps;var h=ga(s,Xt.current);wa(s,n),h=Bc(null,s,o,t,h,n);var x=Uc();return s.flags|=1,typeof h=="object"&&h!==null&&typeof h.render=="function"&&h.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,ds(o)?(x=!0,xi(s)):x=!1,s.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,Ac(s),h.updater=Ii,s.stateNode=h,h._reactInternals=s,Yc(s,o,t,n),s=Jc(null,s,o,!0,x,n)):(s.tag=0,bt&&x&&Sc(s),ls(null,s,h,n),s=s.child),s;case 16:o=s.elementType;e:{switch(Mi(t,s),t=s.pendingProps,h=o._init,o=h(o._payload),s.type=o,h=s.tag=xv(o),t=Us(o,t),h){case 0:s=Xc(null,s,o,t,n);break e;case 1:s=Vm(null,s,o,t,n);break e;case 11:s=Fm(null,s,o,t,n);break e;case 14:s=zm(null,s,o,Us(o.type,t),n);break e}throw Error(l(306,o,""))}return s;case 0:return o=s.type,h=s.pendingProps,h=s.elementType===o?h:Us(o,h),Xc(t,s,o,h,n);case 1:return o=s.type,h=s.pendingProps,h=s.elementType===o?h:Us(o,h),Vm(t,s,o,h,n);case 3:e:{if(Wm(s),t===null)throw Error(l(387));o=s.pendingProps,x=s.memoizedState,h=x.element,am(t,s),Si(s,o,null,n);var S=s.memoizedState;if(o=S.element,x.isDehydrated)if(x={element:o,isDehydrated:!1,cache:S.cache,pendingSuspenseBoundaries:S.pendingSuspenseBoundaries,transitions:S.transitions},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){h=Ca(Error(l(423)),s),s=Hm(t,s,o,n,h);break e}else if(o!==h){h=Ca(Error(l(424)),s),s=Hm(t,s,o,n,h);break e}else for(ws=Vr(s.stateNode.containerInfo.firstChild),Ns=s,bt=!0,Bs=null,n=rm(s,null,o,n),s.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ba(),o===h){s=vr(t,s,n);break e}ls(t,s,o,n)}s=s.child}return s;case 5:return om(s),t===null&&Ec(s),o=s.type,h=s.pendingProps,x=t!==null?t.memoizedProps:null,S=h.children,yc(o,h)?S=null:x!==null&&yc(o,x)&&(s.flags|=32),Um(t,s),ls(t,s,S,n),s.child;case 6:return t===null&&Ec(s),null;case 13:return Km(t,s,n);case 4:return Dc(s,s.stateNode.containerInfo),o=s.pendingProps,t===null?s.child=ja(s,null,o,n):ls(t,s,o,n),s.child;case 11:return o=s.type,h=s.pendingProps,h=s.elementType===o?h:Us(o,h),Fm(t,s,o,h,n);case 7:return ls(t,s,s.pendingProps,n),s.child;case 8:return ls(t,s,s.pendingProps.children,n),s.child;case 12:return ls(t,s,s.pendingProps.children,n),s.child;case 10:e:{if(o=s.type._context,h=s.pendingProps,x=s.memoizedProps,S=h.value,ht(ji,o._currentValue),o._currentValue=S,x!==null)if($s(x.value,S)){if(x.children===h.children&&!cs.current){s=vr(t,s,n);break e}}else for(x=s.child,x!==null&&(x.return=s);x!==null;){var M=x.dependencies;if(M!==null){S=x.child;for(var B=M.firstContext;B!==null;){if(B.context===o){if(x.tag===1){B=yr(-1,n&-n),B.tag=2;var le=x.updateQueue;if(le!==null){le=le.shared;var fe=le.pending;fe===null?B.next=B:(B.next=fe.next,fe.next=B),le.pending=B}}x.lanes|=n,B=x.alternate,B!==null&&(B.lanes|=n),_c(x.return,n,s),M.lanes|=n;break}B=B.next}}else if(x.tag===10)S=x.type===s.type?null:x.child;else if(x.tag===18){if(S=x.return,S===null)throw Error(l(341));S.lanes|=n,M=S.alternate,M!==null&&(M.lanes|=n),_c(S,n,s),S=x.sibling}else S=x.child;if(S!==null)S.return=x;else for(S=x;S!==null;){if(S===s){S=null;break}if(x=S.sibling,x!==null){x.return=S.return,S=x;break}S=S.return}x=S}ls(t,s,h.children,n),s=s.child}return s;case 9:return h=s.type,o=s.pendingProps.children,wa(s,n),h=As(h),o=o(h),s.flags|=1,ls(t,s,o,n),s.child;case 14:return o=s.type,h=Us(o,s.pendingProps),h=Us(o.type,h),zm(t,s,o,h,n);case 15:return $m(t,s,s.type,s.pendingProps,n);case 17:return o=s.type,h=s.pendingProps,h=s.elementType===o?h:Us(o,h),Mi(t,s),s.tag=1,ds(o)?(t=!0,xi(s)):t=!1,wa(s,n),Im(s,o,h),Yc(s,o,h,n),Jc(null,s,o,!0,t,n);case 19:return Ym(t,s,n);case 22:return Bm(t,s,n)}throw Error(l(156,s.tag))};function vf(t,s){return U(t,s)}function fv(t,s,n,o){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Os(t,s,n,o){return new fv(t,s,n,o)}function yd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function xv(t){if(typeof t=="function")return yd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===ie)return 11;if(t===_)return 14}return 2}function en(t,s){var n=t.alternate;return n===null?(n=Os(t.tag,s,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=s,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,s=t.dependencies,n.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Wi(t,s,n,o,h,x){var S=2;if(o=t,typeof t=="function")yd(t)&&(S=1);else if(typeof t=="string")S=5;else e:switch(t){case L:return Hn(n.children,h,x,s);case I:S=8,h|=8;break;case w:return t=Os(12,n,s,h|2),t.elementType=w,t.lanes=x,t;case Y:return t=Os(13,n,s,h),t.elementType=Y,t.lanes=x,t;case ne:return t=Os(19,n,s,h),t.elementType=ne,t.lanes=x,t;case ue:return Hi(n,h,x,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case V:S=10;break e;case te:S=9;break e;case ie:S=11;break e;case _:S=14;break e;case Q:S=16,o=null;break e}throw Error(l(130,t==null?t:typeof t,""))}return s=Os(S,n,s,h),s.elementType=t,s.type=o,s.lanes=x,s}function Hn(t,s,n,o){return t=Os(7,t,o,s),t.lanes=n,t}function Hi(t,s,n,o){return t=Os(22,t,o,s),t.elementType=ue,t.lanes=n,t.stateNode={isHidden:!1},t}function vd(t,s,n){return t=Os(6,t,null,s),t.lanes=n,t}function bd(t,s,n){return s=Os(4,t.children!==null?t.children:[],t.key,s),s.lanes=n,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function pv(t,s,n,o,h){this.tag=s,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Go(0),this.expirationTimes=Go(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Go(0),this.identifierPrefix=o,this.onRecoverableError=h,this.mutableSourceEagerHydrationData=null}function jd(t,s,n,o,h,x,S,M,B){return t=new pv(t,s,n,M,B),s===1?(s=1,x===!0&&(s|=8)):s=0,x=Os(3,null,null,s),t.current=x,x.stateNode=t,x.memoizedState={element:o,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ac(x),t}function gv(t,s,n){var o=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(a){console.error(a)}}return r(),Ed.exports=Tv(),Ed.exports}var Mf;function Rv(){if(Mf)return Ji;Mf=1;var r=Bx();return Ji.createRoot=r.createRoot,Ji.hydrateRoot=r.hydrateRoot,Ji}var Iv=Rv(),Hl=Bx();const _v=$x(Hl);/** - * @remix-run/router v1.23.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function zl(){return zl=Object.assign?Object.assign.bind():function(r){for(var a=1;a"u")throw new Error(a)}function wu(r,a){if(!r){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function Av(){return Math.random().toString(36).substr(2,8)}function Df(r,a){return{usr:r.state,key:r.key,idx:a}}function qd(r,a,l,i){return l===void 0&&(l=null),zl({pathname:typeof r=="string"?r:r.pathname,search:"",hash:""},typeof a=="string"?Va(a):a,{state:l,key:a&&a.key||i||Av()})}function xo(r){let{pathname:a="/",search:l="",hash:i=""}=r;return l&&l!=="?"&&(a+=l.charAt(0)==="?"?l:"?"+l),i&&i!=="#"&&(a+=i.charAt(0)==="#"?i:"#"+i),a}function Va(r){let a={};if(r){let l=r.indexOf("#");l>=0&&(a.hash=r.substr(l),r=r.substr(0,l));let i=r.indexOf("?");i>=0&&(a.search=r.substr(i),r=r.substr(0,i)),r&&(a.pathname=r)}return a}function Dv(r,a,l,i){i===void 0&&(i={});let{window:c=document.defaultView,v5Compat:d=!1}=i,m=c.history,f=ln.Pop,p=null,y=g();y==null&&(y=0,m.replaceState(zl({},m.state,{idx:y}),""));function g(){return(m.state||{idx:null}).idx}function v(){f=ln.Pop;let j=g(),C=j==null?null:j-y;y=j,p&&p({action:f,location:N.location,delta:C})}function k(j,C){f=ln.Push;let E=qd(N.location,j,C);y=g()+1;let b=Df(E,y),R=N.createHref(E);try{m.pushState(b,"",R)}catch(G){if(G instanceof DOMException&&G.name==="DataCloneError")throw G;c.location.assign(R)}d&&p&&p({action:f,location:N.location,delta:1})}function P(j,C){f=ln.Replace;let E=qd(N.location,j,C);y=g();let b=Df(E,y),R=N.createHref(E);m.replaceState(b,"",R),d&&p&&p({action:f,location:N.location,delta:0})}function T(j){let C=c.location.origin!=="null"?c.location.origin:c.location.href,E=typeof j=="string"?j:xo(j);return E=E.replace(/ $/,"%20"),Dt(C,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,C)}let N={get action(){return f},get location(){return r(c,m)},listen(j){if(p)throw new Error("A history only accepts one active listener");return c.addEventListener(Af,v),p=j,()=>{c.removeEventListener(Af,v),p=null}},createHref(j){return a(c,j)},createURL:T,encodeLocation(j){let C=T(j);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:k,replace:P,go(j){return m.go(j)}};return N}var Lf;(function(r){r.data="data",r.deferred="deferred",r.redirect="redirect",r.error="error"})(Lf||(Lf={}));function Lv(r,a,l){return l===void 0&&(l="/"),Ov(r,a,l)}function Ov(r,a,l,i){let c=typeof a=="string"?Va(a):a,d=Su(c.pathname||"/",l);if(d==null)return null;let m=Ux(r);Fv(m);let f=null;for(let p=0;f==null&&p{let p={relativePath:f===void 0?d.path||"":f,caseSensitive:d.caseSensitive===!0,childrenIndex:m,route:d};p.relativePath.startsWith("/")&&(Dt(p.relativePath.startsWith(i),'Absolute route path "'+p.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),p.relativePath=p.relativePath.slice(i.length));let y=cn([i,p.relativePath]),g=l.concat(p);d.children&&d.children.length>0&&(Dt(d.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+y+'".')),Ux(d.children,a,g,y)),!(d.path==null&&!d.index)&&a.push({path:y,score:Hv(y,d.index),routesMeta:g})};return r.forEach((d,m)=>{var f;if(d.path===""||!((f=d.path)!=null&&f.includes("?")))c(d,m);else for(let p of Vx(d.path))c(d,m,p)}),a}function Vx(r){let a=r.split("/");if(a.length===0)return[];let[l,...i]=a,c=l.endsWith("?"),d=l.replace(/\?$/,"");if(i.length===0)return c?[d,""]:[d];let m=Vx(i.join("/")),f=[];return f.push(...m.map(p=>p===""?d:[d,p].join("/"))),c&&f.push(...m),f.map(p=>r.startsWith("/")&&p===""?"/":p)}function Fv(r){r.sort((a,l)=>a.score!==l.score?l.score-a.score:Kv(a.routesMeta.map(i=>i.childrenIndex),l.routesMeta.map(i=>i.childrenIndex)))}const zv=/^:[\w-]+$/,$v=3,Bv=2,Uv=1,Vv=10,Wv=-2,Of=r=>r==="*";function Hv(r,a){let l=r.split("/"),i=l.length;return l.some(Of)&&(i+=Wv),a&&(i+=Bv),l.filter(c=>!Of(c)).reduce((c,d)=>c+(zv.test(d)?$v:d===""?Uv:Vv),i)}function Kv(r,a){return r.length===a.length&&r.slice(0,-1).every((i,c)=>i===a[c])?r[r.length-1]-a[a.length-1]:0}function Gv(r,a,l){let{routesMeta:i}=r,c={},d="/",m=[];for(let f=0;f{let{paramName:k,isOptional:P}=g;if(k==="*"){let N=f[v]||"";m=d.slice(0,d.length-N.length).replace(/(.)\/+$/,"$1")}const T=f[v];return P&&!T?y[k]=void 0:y[k]=(T||"").replace(/%2F/g,"/"),y},{}),pathname:d,pathnameBase:m,pattern:r}}function Qv(r,a,l){a===void 0&&(a=!1),l===void 0&&(l=!0),wu(r==="*"||!r.endsWith("*")||r.endsWith("/*"),'Route path "'+r+'" will be treated as if it were '+('"'+r.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+r.replace(/\*$/,"/*")+'".'));let i=[],c="^"+r.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(m,f,p)=>(i.push({paramName:f,isOptional:p!=null}),p?"/?([^\\/]+)?":"/([^\\/]+)"));return r.endsWith("*")?(i.push({paramName:"*"}),c+=r==="*"||r==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):l?c+="\\/*$":r!==""&&r!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,a?void 0:"i"),i]}function qv(r){try{return r.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return wu(!1,'The URL path "'+r+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),r}}function Su(r,a){if(a==="/")return r;if(!r.toLowerCase().startsWith(a.toLowerCase()))return null;let l=a.endsWith("/")?a.length-1:a.length,i=r.charAt(l);return i&&i!=="/"?null:r.slice(l)||"/"}const Xv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Jv=r=>Xv.test(r);function Zv(r,a){a===void 0&&(a="/");let{pathname:l,search:i="",hash:c=""}=typeof r=="string"?Va(r):r,d;if(l)if(Jv(l))d=l;else{if(l.includes("//")){let m=l;l=l.replace(/\/\/+/g,"/"),wu(!1,"Pathnames cannot have embedded double slashes - normalizing "+(m+" -> "+l))}l.startsWith("/")?d=Ff(l.substring(1),"/"):d=Ff(l,a)}else d=a;return{pathname:d,search:sb(i),hash:rb(c)}}function Ff(r,a){let l=a.replace(/\/+$/,"").split("/");return r.split("/").forEach(c=>{c===".."?l.length>1&&l.pop():c!=="."&&l.push(c)}),l.length>1?l.join("/"):"/"}function Rd(r,a,l,i){return"Cannot include a '"+r+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+l+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function eb(r){return r.filter((a,l)=>l===0||a.route.path&&a.route.path.length>0)}function Cu(r,a){let l=eb(r);return a?l.map((i,c)=>c===l.length-1?i.pathname:i.pathnameBase):l.map(i=>i.pathnameBase)}function ku(r,a,l,i){i===void 0&&(i=!1);let c;typeof r=="string"?c=Va(r):(c=zl({},r),Dt(!c.pathname||!c.pathname.includes("?"),Rd("?","pathname","search",c)),Dt(!c.pathname||!c.pathname.includes("#"),Rd("#","pathname","hash",c)),Dt(!c.search||!c.search.includes("#"),Rd("#","search","hash",c)));let d=r===""||c.pathname==="",m=d?"/":c.pathname,f;if(m==null)f=l;else{let v=a.length-1;if(!i&&m.startsWith("..")){let k=m.split("/");for(;k[0]==="..";)k.shift(),v-=1;c.pathname=k.join("/")}f=v>=0?a[v]:"/"}let p=Zv(c,f),y=m&&m!=="/"&&m.endsWith("/"),g=(d||m===".")&&l.endsWith("/");return!p.pathname.endsWith("/")&&(y||g)&&(p.pathname+="/"),p}const cn=r=>r.join("/").replace(/\/\/+/g,"/"),tb=r=>r.replace(/\/+$/,"").replace(/^\/*/,"/"),sb=r=>!r||r==="?"?"":r.startsWith("?")?r:"?"+r,rb=r=>!r||r==="#"?"":r.startsWith("#")?r:"#"+r;function nb(r){return r!=null&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.internal=="boolean"&&"data"in r}const Wx=["post","put","patch","delete"];new Set(Wx);const ab=["get",...Wx];new Set(ab);/** - * React Router v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function $l(){return $l=Object.assign?Object.assign.bind():function(r){for(var a=1;a{f.current=!0}),u.useCallback(function(y,g){if(g===void 0&&(g={}),!f.current)return;if(typeof y=="number"){i.go(y);return}let v=ku(y,JSON.parse(m),d,g.relative==="path");r==null&&a!=="/"&&(v.pathname=v.pathname==="/"?a:cn([a,v.pathname])),(g.replace?i.replace:i.push)(v,g.state,g)},[a,i,m,d,r])}const cb=u.createContext(null);function db(r){let a=u.useContext(Pr).outlet;return a&&u.createElement(cb.Provider,{value:r},a)}function Gx(r,a){let{relative:l}=a===void 0?{}:a,{future:i}=u.useContext(pn),{matches:c}=u.useContext(Pr),{pathname:d}=gn(),m=JSON.stringify(Cu(c,i.v7_relativeSplatPath));return u.useMemo(()=>ku(r,JSON.parse(m),d,l==="path"),[r,m,d,l])}function ub(r,a){return hb(r,a)}function hb(r,a,l,i){Wa()||Dt(!1);let{navigator:c}=u.useContext(pn),{matches:d}=u.useContext(Pr),m=d[d.length-1],f=m?m.params:{};m&&m.pathname;let p=m?m.pathnameBase:"/";m&&m.route;let y=gn(),g;if(a){var v;let j=typeof a=="string"?Va(a):a;p==="/"||(v=j.pathname)!=null&&v.startsWith(p)||Dt(!1),g=j}else g=y;let k=g.pathname||"/",P=k;if(p!=="/"){let j=p.replace(/^\//,"").split("/");P="/"+k.replace(/^\//,"").split("/").slice(j.length).join("/")}let T=Lv(r,{pathname:P}),N=gb(T&&T.map(j=>Object.assign({},j,{params:Object.assign({},f,j.params),pathname:cn([p,c.encodeLocation?c.encodeLocation(j.pathname).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?p:cn([p,c.encodeLocation?c.encodeLocation(j.pathnameBase).pathname:j.pathnameBase])})),d,l,i);return a&&N?u.createElement(To.Provider,{value:{location:$l({pathname:"/",search:"",hash:"",state:null,key:"default"},g),navigationType:ln.Pop}},N):N}function mb(){let r=jb(),a=nb(r)?r.status+" "+r.statusText:r instanceof Error?r.message:JSON.stringify(r),l=r instanceof Error?r.stack:null,c={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return u.createElement(u.Fragment,null,u.createElement("h2",null,"Unexpected Application Error!"),u.createElement("h3",{style:{fontStyle:"italic"}},a),l?u.createElement("pre",{style:c},l):null,null)}const fb=u.createElement(mb,null);class xb extends u.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,l){return l.location!==a.location||l.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:l.error,location:l.location,revalidation:a.revalidation||l.revalidation}}componentDidCatch(a,l){console.error("React Router caught the following error during render",a,l)}render(){return this.state.error!==void 0?u.createElement(Pr.Provider,{value:this.props.routeContext},u.createElement(Hx.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function pb(r){let{routeContext:a,match:l,children:i}=r,c=u.useContext(Eu);return c&&c.static&&c.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=l.route.id),u.createElement(Pr.Provider,{value:a},i)}function gb(r,a,l,i){var c;if(a===void 0&&(a=[]),l===void 0&&(l=null),i===void 0&&(i=null),r==null){var d;if(!l)return null;if(l.errors)r=l.matches;else if((d=i)!=null&&d.v7_partialHydration&&a.length===0&&!l.initialized&&l.matches.length>0)r=l.matches;else return null}let m=r,f=(c=l)==null?void 0:c.errors;if(f!=null){let g=m.findIndex(v=>v.route.id&&(f==null?void 0:f[v.route.id])!==void 0);g>=0||Dt(!1),m=m.slice(0,Math.min(m.length,g+1))}let p=!1,y=-1;if(l&&i&&i.v7_partialHydration)for(let g=0;g=0?m=m.slice(0,y+1):m=[m[0]];break}}}return m.reduceRight((g,v,k)=>{let P,T=!1,N=null,j=null;l&&(P=f&&v.route.id?f[v.route.id]:void 0,N=v.route.errorElement||fb,p&&(y<0&&k===0?(wb("route-fallback"),T=!0,j=null):y===k&&(T=!0,j=v.route.hydrateFallbackElement||null)));let C=a.concat(m.slice(0,k+1)),E=()=>{let b;return P?b=N:T?b=j:v.route.Component?b=u.createElement(v.route.Component,null):v.route.element?b=v.route.element:b=g,u.createElement(pb,{match:v,routeContext:{outlet:g,matches:C,isDataRoute:l!=null},children:b})};return l&&(v.route.ErrorBoundary||v.route.errorElement||k===0)?u.createElement(xb,{location:l.location,revalidation:l.revalidation,component:N,error:P,children:E(),routeContext:{outlet:null,matches:C,isDataRoute:!0}}):E()},null)}var Yx=(function(r){return r.UseBlocker="useBlocker",r.UseRevalidator="useRevalidator",r.UseNavigateStable="useNavigate",r})(Yx||{}),Qx=(function(r){return r.UseBlocker="useBlocker",r.UseLoaderData="useLoaderData",r.UseActionData="useActionData",r.UseRouteError="useRouteError",r.UseNavigation="useNavigation",r.UseRouteLoaderData="useRouteLoaderData",r.UseMatches="useMatches",r.UseRevalidator="useRevalidator",r.UseNavigateStable="useNavigate",r.UseRouteId="useRouteId",r})(Qx||{});function yb(r){let a=u.useContext(Eu);return a||Dt(!1),a}function vb(r){let a=u.useContext(lb);return a||Dt(!1),a}function bb(r){let a=u.useContext(Pr);return a||Dt(!1),a}function qx(r){let a=bb(),l=a.matches[a.matches.length-1];return l.route.id||Dt(!1),l.route.id}function jb(){var r;let a=u.useContext(Hx),l=vb(),i=qx();return a!==void 0?a:(r=l.errors)==null?void 0:r[i]}function Nb(){let{router:r}=yb(Yx.UseNavigateStable),a=qx(Qx.UseNavigateStable),l=u.useRef(!1);return Kx(()=>{l.current=!0}),u.useCallback(function(c,d){d===void 0&&(d={}),l.current&&(typeof c=="number"?r.navigate(c):r.navigate(c,$l({fromRouteId:a},d)))},[r,a])}const zf={};function wb(r,a,l){zf[r]||(zf[r]=!0)}function Sb(r,a){r==null||r.v7_startTransition,r==null||r.v7_relativeSplatPath}function Id(r){let{to:a,replace:l,state:i,relative:c}=r;Wa()||Dt(!1);let{future:d,static:m}=u.useContext(pn),{matches:f}=u.useContext(Pr),{pathname:p}=gn(),y=yn(),g=ku(a,Cu(f,d.v7_relativeSplatPath),p,c==="path"),v=JSON.stringify(g);return u.useEffect(()=>y(JSON.parse(v),{replace:l,state:i,relative:c}),[y,v,c,l,i]),null}function Cb(r){return db(r.context)}function gt(r){Dt(!1)}function kb(r){let{basename:a="/",children:l=null,location:i,navigationType:c=ln.Pop,navigator:d,static:m=!1,future:f}=r;Wa()&&Dt(!1);let p=a.replace(/^\/*/,"/"),y=u.useMemo(()=>({basename:p,navigator:d,static:m,future:$l({v7_relativeSplatPath:!1},f)}),[p,f,d,m]);typeof i=="string"&&(i=Va(i));let{pathname:g="/",search:v="",hash:k="",state:P=null,key:T="default"}=i,N=u.useMemo(()=>{let j=Su(g,p);return j==null?null:{location:{pathname:j,search:v,hash:k,state:P,key:T},navigationType:c}},[p,g,v,k,P,T,c]);return N==null?null:u.createElement(pn.Provider,{value:y},u.createElement(To.Provider,{children:l,value:N}))}function Eb(r){let{children:a,location:l}=r;return ub(Xd(a),l)}new Promise(()=>{});function Xd(r,a){a===void 0&&(a=[]);let l=[];return u.Children.forEach(r,(i,c)=>{if(!u.isValidElement(i))return;let d=[...a,c];if(i.type===u.Fragment){l.push.apply(l,Xd(i.props.children,d));return}i.type!==gt&&Dt(!1),!i.props.index||!i.props.children||Dt(!1);let m={id:i.props.id||d.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(m.children=Xd(i.props.children,d)),l.push(m)}),l}/** - * React Router DOM v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Jd(){return Jd=Object.assign?Object.assign.bind():function(r){for(var a=1;a=0)&&(l[c]=r[c]);return l}function Tb(r){return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}function Rb(r,a){return r.button===0&&(!a||a==="_self")&&!Tb(r)}function Zd(r){return r===void 0&&(r=""),new URLSearchParams(typeof r=="string"||Array.isArray(r)||r instanceof URLSearchParams?r:Object.keys(r).reduce((a,l)=>{let i=r[l];return a.concat(Array.isArray(i)?i.map(c=>[l,c]):[[l,i]])},[]))}function Ib(r,a){let l=Zd(r);return a&&a.forEach((i,c)=>{l.has(c)||a.getAll(c).forEach(d=>{l.append(c,d)})}),l}const _b=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Mb="6";try{window.__reactRouterVersion=Mb}catch{}const Ab="startTransition",$f=Po[Ab];function Db(r){let{basename:a,children:l,future:i,window:c}=r,d=u.useRef();d.current==null&&(d.current=Mv({window:c,v5Compat:!0}));let m=d.current,[f,p]=u.useState({action:m.action,location:m.location}),{v7_startTransition:y}=i||{},g=u.useCallback(v=>{y&&$f?$f(()=>p(v)):p(v)},[p,y]);return u.useLayoutEffect(()=>m.listen(g),[m,g]),u.useEffect(()=>Sb(i),[i]),u.createElement(kb,{basename:a,children:l,location:f.location,navigationType:f.action,navigator:m,future:i})}const Lb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ob=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,eu=u.forwardRef(function(a,l){let{onClick:i,relative:c,reloadDocument:d,replace:m,state:f,target:p,to:y,preventScrollReset:g,viewTransition:v}=a,k=Pb(a,_b),{basename:P}=u.useContext(pn),T,N=!1;if(typeof y=="string"&&Ob.test(y)&&(T=y,Lb))try{let b=new URL(window.location.href),R=y.startsWith("//")?new URL(b.protocol+y):new URL(y),G=Su(R.pathname,P);R.origin===b.origin&&G!=null?y=G+R.search+R.hash:N=!0}catch{}let j=ib(y,{relative:c}),C=Fb(y,{replace:m,state:f,target:p,preventScrollReset:g,relative:c,viewTransition:v});function E(b){i&&i(b),b.defaultPrevented||C(b)}return u.createElement("a",Jd({},k,{href:T||j,onClick:N||d?i:E,ref:l,target:p}))});var Bf;(function(r){r.UseScrollRestoration="useScrollRestoration",r.UseSubmit="useSubmit",r.UseSubmitFetcher="useSubmitFetcher",r.UseFetcher="useFetcher",r.useViewTransitionState="useViewTransitionState"})(Bf||(Bf={}));var Uf;(function(r){r.UseFetcher="useFetcher",r.UseFetchers="useFetchers",r.UseScrollRestoration="useScrollRestoration"})(Uf||(Uf={}));function Fb(r,a){let{target:l,replace:i,state:c,preventScrollReset:d,relative:m,viewTransition:f}=a===void 0?{}:a,p=yn(),y=gn(),g=Gx(r,{relative:m});return u.useCallback(v=>{if(Rb(v,l)){v.preventDefault();let k=i!==void 0?i:xo(y)===xo(g);p(r,{replace:k,state:c,preventScrollReset:d,relative:m,viewTransition:f})}},[y,p,g,i,c,l,r,d,m,f])}function Xx(r){let a=u.useRef(Zd(r)),l=u.useRef(!1),i=gn(),c=u.useMemo(()=>Ib(i.search,l.current?null:a.current),[i.search]),d=yn(),m=u.useCallback((f,p)=>{const y=Zd(typeof f=="function"?f(c):f);l.current=!0,d("?"+y,p)},[d,c]);return[c,m]}/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zb=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$b=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,l,i)=>i?i.toUpperCase():l.toLowerCase()),Vf=r=>{const a=$b(r);return a.charAt(0).toUpperCase()+a.slice(1)},Jx=(...r)=>r.filter((a,l,i)=>!!a&&a.trim()!==""&&i.indexOf(a)===l).join(" ").trim(),Bb=r=>{for(const a in r)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var Ub={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.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vb=u.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:i,className:c="",children:d,iconNode:m,...f},p)=>u.createElement("svg",{ref:p,...Ub,width:a,height:a,stroke:r,strokeWidth:i?Number(l)*24/Number(a):l,className:Jx("lucide",c),...!d&&!Bb(f)&&{"aria-hidden":"true"},...f},[...m.map(([y,g])=>u.createElement(y,g)),...Array.isArray(d)?d:[d]]));/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ee=(r,a)=>{const l=u.forwardRef(({className:i,...c},d)=>u.createElement(Vb,{ref:d,iconNode:a,className:Jx(`lucide-${zb(Vf(r))}`,`lucide-${r}`,i),...c}));return l.displayName=Vf(r),l};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Wb=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Hb=Ee("arrow-up-down",Wb);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Kb=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],Wf=Ee("bitcoin",Kb);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gb=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Fs=Ee("book-open",Gb);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Yb=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],po=Ee("calendar",Yb);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Qb=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],qb=Ee("chart-column",Qb);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xb=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ro=Ee("check",Xb);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Jb=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Bl=Ee("chevron-down",Jb);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Zb=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ej=Ee("chevron-left",Zb);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tj=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Aa=Ee("chevron-right",tj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sj=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Zx=Ee("chevron-up",sj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],nj=Ee("circle-alert",rj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aj=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Hf=Ee("circle-check-big",aj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],tu=Ee("circle-check",lj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ij=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ep=Ee("circle-question-mark",ij);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],_d=Ee("circle-user",oj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],tp=Ee("circle-x",cj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dj=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],su=Ee("clock",dj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uj=[["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"}]],sp=Ee("copy",uj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hj=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Kf=Ee("credit-card",hj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mj=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],an=Ee("crown",mj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fj=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],go=Ee("dollar-sign",fj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xj=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],pj=Ee("download",xj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gj=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],hn=Ee("external-link",gj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yj=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ru=Ee("eye",yj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vj=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],bj=Ee("file-text",vj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jj=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],rp=Ee("funnel",jj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Nj=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],wj=Ee("gift",Nj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Sj=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],Cj=Ee("git-merge",Sj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],nu=Ee("globe",kj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ej=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],Pj=Ee("graduation-cap",Ej);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Tj=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],jr=Ee("grip-vertical",Tj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Rj=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],Ij=Ee("handshake",Rj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _j=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Mj=Ee("house",_j);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Aj=[["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"}]],np=Ee("image",Aj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Dj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Zi=Ee("info",Dj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Lj=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Gf=Ee("key",Lj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Oj=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Fj=Ee("layout-dashboard",Oj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zj=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Sr=Ee("link-2",zj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $j=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Yf=Ee("link",$j);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Bj=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Uj=Ee("lock",Bj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vj=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Wj=Ee("log-out",Vj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hj=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],ap=Ee("map-pin",Hj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Kj=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Gj=Ee("menu",Kj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Yj=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],Qj=Ee("message-circle",Yj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qj=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],Da=Ee("navigation",qj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xj=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],Jj=Ee("palette",Xj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Zj=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],mt=Ee("pen-line",Zj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eN=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],tN=Ee("percent",eN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sN=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],rN=Ee("phone",sN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nN=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],aN=Ee("pin",nN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lN=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Rt=Ee("plus",lN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iN=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],Qf=Ee("qr-code",iN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oN=[["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"}]],Be=Ee("refresh-cw",oN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cN=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],It=Ee("save",cN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dN=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],dn=Ee("search",dN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uN=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],hN=Ee("send",uN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mN=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Yn=Ee("settings",mN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fN=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Md=Ee("settings-2",fN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xN=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Pu=Ee("shield-check",xN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pN=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],au=Ee("shopping-bag",pN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gN=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Ul=Ee("smartphone",gN);/** - * @license lucide-react v0.562.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=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],vN=Ee("star",yN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bN=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Ad=Ee("tag",bN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jN=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Gt=Ee("trash-2",jN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NN=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],La=Ee("trending-up",NN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wN=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],qf=Ee("trophy",wN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SN=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],lp=Ee("undo-2",SN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CN=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],yo=Ee("upload",CN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kN=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],lu=Ee("user-plus",kN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EN=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Oa=Ee("user",EN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PN=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Yt=Ee("users",PN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TN=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],$a=Ee("wallet",TN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xs=Ee("x",RN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IN=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],on=Ee("zap",IN),Tu="admin_token";function Ru(){try{return localStorage.getItem(Tu)}catch{return null}}function _N(r){try{localStorage.setItem(Tu,r)}catch{}}function MN(){try{localStorage.removeItem(Tu)}catch{}}const AN="https://soulapi.quwanzhi.com",DN=15e3,LN=()=>{const r="https://soulapi.quwanzhi.com";return r.length>0?r.replace(/\/$/,""):AN};function Ba(r){const a=LN(),l=r.startsWith("/")?r:`/${r}`;return a?`${a}${l}`:l}async function Io(r,a={}){const{data:l,...i}=a,c=Ba(r),d=new Headers(i.headers),m=Ru();m&&d.set("Authorization",`Bearer ${m}`),l!=null&&!d.has("Content-Type")&&d.set("Content-Type","application/json");const f=l!=null?JSON.stringify(l):i.body,p=new AbortController,y=setTimeout(()=>p.abort(),DN),g=await fetch(c,{...i,headers:d,body:f,credentials:"include",signal:p.signal}).finally(()=>clearTimeout(y)),k=(g.headers.get("Content-Type")||"").includes("application/json")?await g.json():g;if(!g.ok){const P=new Error((k==null?void 0:k.error)||`HTTP ${g.status}`);throw P.status=g.status,P.data=k,P}return k}function Le(r,a){return Io(r,{...a,method:"GET"})}function ut(r,a,l){return Io(r,{...l,method:"POST",data:a})}function yt(r,a,l){return Io(r,{...l,method:"PUT",data:a})}function Cr(r,a){return Io(r,{...a,method:"DELETE"})}const ON=[{icon:Fj,label:"数据概览",href:"/dashboard"},{icon:Fs,label:"内容管理",href:"/content"},{icon:Yt,label:"用户管理",href:"/users"},{icon:Cj,label:"找伙伴",href:"/find-partner"},{icon:$a,label:"推广中心",href:"/distribution"}];function FN(){const r=gn(),a=yn(),[l,i]=u.useState(!1),[c,d]=u.useState(!1);u.useEffect(()=>{i(!0)},[]),u.useEffect(()=>{if(!l)return;d(!1);let f=!1;return Le("/api/admin").then(p=>{f||(p&&p.success!==!1?d(!0):a("/login",{replace:!0}))}).catch(()=>{f||a("/login",{replace:!0})}),()=>{f=!0}},[l,a]);const m=async()=>{MN();try{await ut("/api/admin/logout",{})}catch{}a("/login",{replace:!0})};return!l||!c?e.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[e.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):e.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[e.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[e.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[e.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),e.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[ON.map(f=>{const p=r.pathname===f.href;return e.jsxs(eu,{to:f.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${p?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[e.jsx(f.icon,{className:"w-5 h-5 shrink-0"}),e.jsx("span",{className:"text-sm",children:f.label})]},f.href)}),e.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:e.jsxs(eu,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${r.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[e.jsx(Yn,{className:"w-5 h-5 shrink-0"}),e.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),e.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:e.jsxs("button",{type:"button",onClick:m,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white rounded-lg hover:bg-gray-700/50 transition-colors",children:[e.jsx(Wj,{className:"w-5 h-5"}),e.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),e.jsx("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0",children:e.jsx("div",{className:"w-full min-w-[1024px] min-h-full",children:e.jsx(Cb,{})})})]})}function Xf(r,a){if(typeof r=="function")return r(a);r!=null&&(r.current=a)}function Iu(...r){return a=>{let l=!1;const i=r.map(c=>{const d=Xf(c,a);return!l&&typeof d=="function"&&(l=!0),d});if(l)return()=>{for(let c=0;c{let{children:d,...m}=i;ip(d)&&typeof vo=="function"&&(d=vo(d._payload));const f=u.Children.toArray(d),p=f.find(VN);if(p){const y=p.props.children,g=f.map(v=>v===p?u.Children.count(y)>1?u.Children.only(null):u.isValidElement(y)?y.props.children:null:v);return e.jsx(a,{...m,ref:c,children:u.isValidElement(y)?u.cloneElement(y,void 0,g):null})}return e.jsx(a,{...m,ref:c,children:d})});return l.displayName=`${r}.Slot`,l}var cp=op("Slot");function BN(r){const a=u.forwardRef((l,i)=>{let{children:c,...d}=l;if(ip(c)&&typeof vo=="function"&&(c=vo(c._payload)),u.isValidElement(c)){const m=HN(c),f=WN(d,c.props);return c.type!==u.Fragment&&(f.ref=i?Iu(i,m):m),u.cloneElement(c,f)}return u.Children.count(c)>1?u.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var UN=Symbol("radix.slottable");function VN(r){return u.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===UN}function WN(r,a){const l={...a};for(const i in a){const c=r[i],d=a[i];/^on[A-Z]/.test(i)?c&&d?l[i]=(...f)=>{const p=d(...f);return c(...f),p}:c&&(l[i]=c):i==="style"?l[i]={...c,...d}:i==="className"&&(l[i]=[c,d].filter(Boolean).join(" "))}return{...r,...l}}function HN(r){var i,c;let a=(i=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:i.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?r.ref:(a=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?r.props.ref:r.props.ref||r.ref)}function dp(r){var a,l,i="";if(typeof r=="string"||typeof r=="number")i+=r;else if(typeof r=="object")if(Array.isArray(r)){var c=r.length;for(a=0;atypeof r=="boolean"?`${r}`:r===0?"0":r,Zf=up,hp=(r,a)=>l=>{var i;if((a==null?void 0:a.variants)==null)return Zf(r,l==null?void 0:l.class,l==null?void 0:l.className);const{variants:c,defaultVariants:d}=a,m=Object.keys(c).map(y=>{const g=l==null?void 0:l[y],v=d==null?void 0:d[y];if(g===null)return null;const k=Jf(g)||Jf(v);return c[y][k]}),f=l&&Object.entries(l).reduce((y,g)=>{let[v,k]=g;return k===void 0||(y[v]=k),y},{}),p=a==null||(i=a.compoundVariants)===null||i===void 0?void 0:i.reduce((y,g)=>{let{class:v,className:k,...P}=g;return Object.entries(P).every(T=>{let[N,j]=T;return Array.isArray(j)?j.includes({...d,...f}[N]):{...d,...f}[N]===j})?[...y,v,k]:y},[]);return Zf(r,m,p,l==null?void 0:l.class,l==null?void 0:l.className)},KN=(r,a)=>{const l=new Array(r.length+a.length);for(let i=0;i({classGroupId:r,validator:a}),mp=(r=new Map,a=null,l)=>({nextPart:r,validators:a,classGroupId:l}),bo="-",ex=[],YN="arbitrary..",QN=r=>{const a=XN(r),{conflictingClassGroups:l,conflictingClassGroupModifiers:i}=r;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return qN(m);const f=m.split(bo),p=f[0]===""&&f.length>1?1:0;return fp(f,p,a)},getConflictingClassGroupIds:(m,f)=>{if(f){const p=i[m],y=l[m];return p?y?KN(y,p):p:y||ex}return l[m]||ex}}},fp=(r,a,l)=>{if(r.length-a===0)return l.classGroupId;const c=r[a],d=l.nextPart.get(c);if(d){const y=fp(r,a+1,d);if(y)return y}const m=l.validators;if(m===null)return;const f=a===0?r.join(bo):r.slice(a).join(bo),p=m.length;for(let y=0;yr.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=r.slice(1,-1),l=a.indexOf(":"),i=a.slice(0,l);return i?YN+i:void 0})(),XN=r=>{const{theme:a,classGroups:l}=r;return JN(l,a)},JN=(r,a)=>{const l=mp();for(const i in r){const c=r[i];_u(c,l,i,a)}return l},_u=(r,a,l,i)=>{const c=r.length;for(let d=0;d{if(typeof r=="string"){e1(r,a,l);return}if(typeof r=="function"){t1(r,a,l,i);return}s1(r,a,l,i)},e1=(r,a,l)=>{const i=r===""?a:xp(a,r);i.classGroupId=l},t1=(r,a,l,i)=>{if(r1(r)){_u(r(i),a,l,i);return}a.validators===null&&(a.validators=[]),a.validators.push(GN(l,r))},s1=(r,a,l,i)=>{const c=Object.entries(r),d=c.length;for(let m=0;m{let l=r;const i=a.split(bo),c=i.length;for(let d=0;d"isThemeGetter"in r&&r.isThemeGetter===!0,n1=r=>{if(r<1)return{get:()=>{},set:()=>{}};let a=0,l=Object.create(null),i=Object.create(null);const c=(d,m)=>{l[d]=m,a++,a>r&&(a=0,i=l,l=Object.create(null))};return{get(d){let m=l[d];if(m!==void 0)return m;if((m=i[d])!==void 0)return c(d,m),m},set(d,m){d in l?l[d]=m:c(d,m)}}},iu="!",tx=":",a1=[],sx=(r,a,l,i,c)=>({modifiers:r,hasImportantModifier:a,baseClassName:l,maybePostfixModifierPosition:i,isExternal:c}),l1=r=>{const{prefix:a,experimentalParseClassName:l}=r;let i=c=>{const d=[];let m=0,f=0,p=0,y;const g=c.length;for(let N=0;Np?y-p:void 0;return sx(d,P,k,T)};if(a){const c=a+tx,d=i;i=m=>m.startsWith(c)?d(m.slice(c.length)):sx(a1,!1,m,void 0,!0)}if(l){const c=i;i=d=>l({className:d,parseClassName:c})}return i},i1=r=>{const a=new Map;return r.orderSensitiveModifiers.forEach((l,i)=>{a.set(l,1e6+i)}),l=>{const i=[];let c=[];for(let d=0;d0&&(c.sort(),i.push(...c),c=[]),i.push(m)):c.push(m)}return c.length>0&&(c.sort(),i.push(...c)),i}},o1=r=>({cache:n1(r.cacheSize),parseClassName:l1(r),sortModifiers:i1(r),...QN(r)}),c1=/\s+/,d1=(r,a)=>{const{parseClassName:l,getClassGroupId:i,getConflictingClassGroupIds:c,sortModifiers:d}=a,m=[],f=r.trim().split(c1);let p="";for(let y=f.length-1;y>=0;y-=1){const g=f[y],{isExternal:v,modifiers:k,hasImportantModifier:P,baseClassName:T,maybePostfixModifierPosition:N}=l(g);if(v){p=g+(p.length>0?" "+p:p);continue}let j=!!N,C=i(j?T.substring(0,N):T);if(!C){if(!j){p=g+(p.length>0?" "+p:p);continue}if(C=i(T),!C){p=g+(p.length>0?" "+p:p);continue}j=!1}const E=k.length===0?"":k.length===1?k[0]:d(k).join(":"),b=P?E+iu:E,R=b+C;if(m.indexOf(R)>-1)continue;m.push(R);const G=c(C,j);for(let X=0;X0?" "+p:p)}return p},u1=(...r)=>{let a=0,l,i,c="";for(;a{if(typeof r=="string")return r;let a,l="";for(let i=0;i{let l,i,c,d;const m=p=>{const y=a.reduce((g,v)=>v(g),r());return l=o1(y),i=l.cache.get,c=l.cache.set,d=f,f(p)},f=p=>{const y=i(p);if(y)return y;const g=d1(p,l);return c(p,g),g};return d=m,(...p)=>d(u1(...p))},m1=[],Ut=r=>{const a=l=>l[r]||m1;return a.isThemeGetter=!0,a},gp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,yp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,f1=/^\d+\/\d+$/,x1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,p1=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,g1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,y1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,v1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ra=r=>f1.test(r),Xe=r=>!!r&&!Number.isNaN(Number(r)),sn=r=>!!r&&Number.isInteger(Number(r)),Dd=r=>r.endsWith("%")&&Xe(r.slice(0,-1)),Nr=r=>x1.test(r),b1=()=>!0,j1=r=>p1.test(r)&&!g1.test(r),vp=()=>!1,N1=r=>y1.test(r),w1=r=>v1.test(r),S1=r=>!_e(r)&&!Me(r),C1=r=>Ha(r,Np,vp),_e=r=>gp.test(r),Kn=r=>Ha(r,wp,j1),Ld=r=>Ha(r,R1,Xe),rx=r=>Ha(r,bp,vp),k1=r=>Ha(r,jp,w1),eo=r=>Ha(r,Sp,N1),Me=r=>yp.test(r),Al=r=>Ka(r,wp),E1=r=>Ka(r,I1),nx=r=>Ka(r,bp),P1=r=>Ka(r,Np),T1=r=>Ka(r,jp),to=r=>Ka(r,Sp,!0),Ha=(r,a,l)=>{const i=gp.exec(r);return i?i[1]?a(i[1]):l(i[2]):!1},Ka=(r,a,l=!1)=>{const i=yp.exec(r);return i?i[1]?a(i[1]):l:!1},bp=r=>r==="position"||r==="percentage",jp=r=>r==="image"||r==="url",Np=r=>r==="length"||r==="size"||r==="bg-size",wp=r=>r==="length",R1=r=>r==="number",I1=r=>r==="family-name",Sp=r=>r==="shadow",_1=()=>{const r=Ut("color"),a=Ut("font"),l=Ut("text"),i=Ut("font-weight"),c=Ut("tracking"),d=Ut("leading"),m=Ut("breakpoint"),f=Ut("container"),p=Ut("spacing"),y=Ut("radius"),g=Ut("shadow"),v=Ut("inset-shadow"),k=Ut("text-shadow"),P=Ut("drop-shadow"),T=Ut("blur"),N=Ut("perspective"),j=Ut("aspect"),C=Ut("ease"),E=Ut("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],G=()=>[...R(),Me,_e],X=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],I=()=>[Me,_e,p],w=()=>[Ra,"full","auto",...I()],V=()=>[sn,"none","subgrid",Me,_e],te=()=>["auto",{span:["full",sn,Me,_e]},sn,Me,_e],ie=()=>[sn,"auto",Me,_e],Y=()=>["auto","min","max","fr",Me,_e],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],_=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...I()],ue=()=>[Ra,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],O=()=>[r,Me,_e],re=()=>[...R(),nx,rx,{position:[Me,_e]}],H=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",P1,C1,{size:[Me,_e]}],$=()=>[Dd,Al,Kn],z=()=>["","none","full",y,Me,_e],ee=()=>["",Xe,Al,Kn],K=()=>["solid","dashed","dotted","double"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>[Xe,Dd,nx,rx],ye=()=>["","none",T,Me,_e],Ce=()=>["none",Xe,Me,_e],F=()=>["none",Xe,Me,_e],xe=()=>[Xe,Me,_e],Pe=()=>[Ra,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Nr],breakpoint:[Nr],color:[b1],container:[Nr],"drop-shadow":[Nr],ease:["in","out","in-out"],font:[S1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Nr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Nr],shadow:[Nr],spacing:["px",Xe],text:[Nr],"text-shadow":[Nr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ra,_e,Me,j]}],container:["container"],columns:[{columns:[Xe,_e,Me,f]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:G()}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{start:w()}],end:[{end:w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[sn,"auto",Me,_e]}],basis:[{basis:[Ra,"full","auto",f,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Xe,Ra,"auto","initial","none",_e]}],grow:[{grow:["",Xe,Me,_e]}],shrink:[{shrink:["",Xe,Me,_e]}],order:[{order:[sn,"first","last","none",Me,_e]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Y()}],"auto-rows":[{"auto-rows":Y()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[..._(),"normal"]}],"justify-self":[{"justify-self":["auto",..._()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[..._(),{baseline:["","last"]}]}],"align-self":[{self:["auto",..._(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[..._(),"baseline"]}],"place-self":[{"place-self":["auto",..._()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:ue()}],w:[{w:[f,"screen",...ue()]}],"min-w":[{"min-w":[f,"screen","none",...ue()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[m]},...ue()]}],h:[{h:["screen","lh",...ue()]}],"min-h":[{"min-h":["screen","lh","none",...ue()]}],"max-h":[{"max-h":["screen","lh",...ue()]}],"font-size":[{text:["base",l,Al,Kn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,Me,Ld]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Dd,_e]}],"font-family":[{font:[E1,_e,a]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,Me,_e]}],"line-clamp":[{"line-clamp":[Xe,"none",Me,Ld]}],leading:[{leading:[d,...I()]}],"list-image":[{"list-image":["none",Me,_e]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Me,_e]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[Xe,"from-font","auto",Me,Kn]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[Xe,"auto",Me,_e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me,_e]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Me,_e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:re()}],"bg-repeat":[{bg:H()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},sn,Me,_e],radial:["",Me,_e],conic:[sn,Me,_e]},T1,k1]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Xe,Me,_e]}],"outline-w":[{outline:["",Xe,Al,Kn]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",g,to,eo]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",v,to,eo]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[Xe,Kn]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",k,to,eo]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[Xe,Me,_e]}],"mix-blend":[{"mix-blend":[...de(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":de()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Xe]}],"mask-image-linear-from-pos":[{"mask-linear-from":q()}],"mask-image-linear-to-pos":[{"mask-linear-to":q()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":q()}],"mask-image-t-to-pos":[{"mask-t-to":q()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":q()}],"mask-image-r-to-pos":[{"mask-r-to":q()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":q()}],"mask-image-b-to-pos":[{"mask-b-to":q()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":q()}],"mask-image-l-to-pos":[{"mask-l-to":q()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":q()}],"mask-image-x-to-pos":[{"mask-x-to":q()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":q()}],"mask-image-y-to-pos":[{"mask-y-to":q()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[Me,_e]}],"mask-image-radial-from-pos":[{"mask-radial-from":q()}],"mask-image-radial-to-pos":[{"mask-radial-to":q()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":R()}],"mask-image-conic-pos":[{"mask-conic":[Xe]}],"mask-image-conic-from-pos":[{"mask-conic-from":q()}],"mask-image-conic-to-pos":[{"mask-conic-to":q()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:re()}],"mask-repeat":[{mask:H()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Me,_e]}],filter:[{filter:["","none",Me,_e]}],blur:[{blur:ye()}],brightness:[{brightness:[Xe,Me,_e]}],contrast:[{contrast:[Xe,Me,_e]}],"drop-shadow":[{"drop-shadow":["","none",P,to,eo]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",Xe,Me,_e]}],"hue-rotate":[{"hue-rotate":[Xe,Me,_e]}],invert:[{invert:["",Xe,Me,_e]}],saturate:[{saturate:[Xe,Me,_e]}],sepia:[{sepia:["",Xe,Me,_e]}],"backdrop-filter":[{"backdrop-filter":["","none",Me,_e]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[Xe,Me,_e]}],"backdrop-contrast":[{"backdrop-contrast":[Xe,Me,_e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Xe,Me,_e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Xe,Me,_e]}],"backdrop-invert":[{"backdrop-invert":["",Xe,Me,_e]}],"backdrop-opacity":[{"backdrop-opacity":[Xe,Me,_e]}],"backdrop-saturate":[{"backdrop-saturate":[Xe,Me,_e]}],"backdrop-sepia":[{"backdrop-sepia":["",Xe,Me,_e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Me,_e]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Xe,"initial",Me,_e]}],ease:[{ease:["linear","initial",C,Me,_e]}],delay:[{delay:[Xe,Me,_e]}],animate:[{animate:["none",E,Me,_e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,Me,_e]}],"perspective-origin":[{"perspective-origin":G()}],rotate:[{rotate:Ce()}],"rotate-x":[{"rotate-x":Ce()}],"rotate-y":[{"rotate-y":Ce()}],"rotate-z":[{"rotate-z":Ce()}],scale:[{scale:F()}],"scale-x":[{"scale-x":F()}],"scale-y":[{"scale-y":F()}],"scale-z":[{"scale-z":F()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[Me,_e,"","none","gpu","cpu"]}],"transform-origin":[{origin:G()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pe()}],"translate-x":[{"translate-x":Pe()}],"translate-y":[{"translate-y":Pe()}],"translate-z":[{"translate-z":Pe()}],"translate-none":["translate-none"],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Me,_e]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Me,_e]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[Xe,Al,Kn,Ld]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},M1=h1(_1);function ot(...r){return M1(up(r))}const A1=hp("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Z({className:r,variant:a,size:l,asChild:i=!1,...c}){const d=i?cp:"button";return e.jsx(d,{"data-slot":"button",className:ot(A1({variant:a,size:l,className:r})),...c})}function ce({className:r,type:a,...l}){return e.jsx("input",{type:a,"data-slot":"input",className:ot("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 md:text-sm focus-visible:ring-2 focus-visible:ring-ring",r),...l})}function D1(){const r=yn(),[a,l]=u.useState(""),[i,c]=u.useState(""),[d,m]=u.useState(""),[f,p]=u.useState(!1),y=async()=>{m(""),p(!0);try{const g=await ut("/api/admin",{username:a.trim(),password:i});if((g==null?void 0:g.success)!==!1&&(g!=null&&g.token)){_N(g.token),r("/dashboard",{replace:!0});return}m(g.error||"用户名或密码错误")}catch(g){const v=g;m(v.status===401?"用户名或密码错误":(v==null?void 0:v.message)||"网络错误,请重试")}finally{p(!1)}};return e.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[e.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),e.jsxs("div",{className:"w-full max-w-md relative z-10",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-16 h-16 bg-[#38bdac]/20 rounded-2xl flex items-center justify-center mx-auto mb-4 border border-[#38bdac]/30",children:e.jsx(Pu,{className:"w-8 h-8 text-[#38bdac]"})}),e.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),e.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),e.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[e.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),e.jsxs("div",{className:"relative",children:[e.jsx(Oa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),e.jsx(ce,{type:"text",value:a,onChange:g=>l(g.target.value),placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),e.jsxs("div",{className:"relative",children:[e.jsx(Uj,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),e.jsx(ce,{type:"password",value:i,onChange:g=>c(g.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:g=>g.key==="Enter"&&y()})]})]}),d&&e.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:d}),e.jsx(Z,{onClick:y,disabled:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:f?"登录中...":"登录"})]})]}),e.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const we=u.forwardRef(({className:r,...a},l)=>e.jsx("div",{ref:l,className:ot("rounded-xl border bg-card text-card-foreground shadow",r),...a}));we.displayName="Card";const Qe=u.forwardRef(({className:r,...a},l)=>e.jsx("div",{ref:l,className:ot("flex flex-col space-y-1.5 p-6",r),...a}));Qe.displayName="CardHeader";const qe=u.forwardRef(({className:r,...a},l)=>e.jsx("h3",{ref:l,className:ot("font-semibold leading-none tracking-tight",r),...a}));qe.displayName="CardTitle";const vt=u.forwardRef(({className:r,...a},l)=>e.jsx("p",{ref:l,className:ot("text-sm text-muted-foreground",r),...a}));vt.displayName="CardDescription";const Se=u.forwardRef(({className:r,...a},l)=>e.jsx("div",{ref:l,className:ot("p-6 pt-0",r),...a}));Se.displayName="CardContent";const L1=u.forwardRef(({className:r,...a},l)=>e.jsx("div",{ref:l,className:ot("flex items-center p-6 pt-0",r),...a}));L1.displayName="CardFooter";function O1(){const r=yn(),[a,l]=u.useState(!0),[i,c]=u.useState([]),[d,m]=u.useState([]),[f,p]=u.useState(0),[y,g]=u.useState(0),[v,k]=u.useState(0),[P,T]=u.useState(0),[N,j]=u.useState(0),[C,E]=u.useState(0),[b,R]=u.useState(null);async function G(){var w;l(!0),R(null);try{try{const re=await Le("/api/admin/dashboard/overview");if(re!=null&&re.success){p(re.totalUsers??0),g(re.paidOrderCount??0),k(re.totalRevenue??0),T(re.conversionRate??0),j(re.totalMatches??0),E(re.matchRevenue??0),m(re.recentOrders??[]),c(re.newUsers??[]);return}}catch(re){console.error("数据概览接口失败,尝试降级拉取",re)}const[V,te]=await Promise.all([Le("/api/db/users?page=1&pageSize=10"),Le("/api/orders?page=1&pageSize=20&status=paid")]),ie=typeof(V==null?void 0:V.total)=="number"?V.total:((w=V==null?void 0:V.users)==null?void 0:w.length)??0,Y=(te==null?void 0:te.orders)??[],ne=typeof(te==null?void 0:te.total)=="number"?te.total:Y.length,_=Y.filter(re=>re.status==="paid"||re.status==="completed"||re.status==="success"),Q=_.reduce((re,H)=>re+Number(H.amount||0),0),ue=new Set(_.map(re=>re.userId).filter(Boolean)),O=ie>0&&ue.size>0?ue.size/ie*100:0;p(ie),g(ne),k(Q),T(O),m(Y.slice(0,5)),c((V==null?void 0:V.users)??[])}catch(V){console.error("降级拉取失败",V);const te=V;(te==null?void 0:te.status)===401?R("登录已过期,请重新登录"):(te==null?void 0:te.name)==="AbortError"?R("请求超时,请检查网络后点击重试"):R("加载失败,请检查网络或联系管理员")}finally{l(!1)}}if(u.useEffect(()=>{G();const w=setInterval(G,3e4);return()=>clearInterval(w)},[]),a)return e.jsxs("div",{className:"p-8 w-full",children:[e.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-24",children:[e.jsx(Be,{className:"w-12 h-12 text-[#38bdac] animate-spin mb-4"}),e.jsx("span",{className:"text-gray-400",children:"加载中..."})]})]});const X=f,L=w=>{const V=w.productType||"",te=w.description||"";if(te){if(V==="section"&&te.includes("章节")){if(te.includes("-")){const ie=te.split("-");if(ie.length>=3)return{title:`第${ie[1]}章 第${ie[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:te,subtitle:"章节购买"}}return V==="fullbook"||te.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:V==="match"||te.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:te,subtitle:V==="section"?"单章":V==="fullbook"?"全书":"其他"}}return V==="section"?{title:`章节 ${w.productId||""}`,subtitle:"单章购买"}:V==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:V==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:V||"其他"}},I=[{title:"总用户数",value:X,icon:Yt,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:`¥${(v??0).toFixed(2)}`,icon:La,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:y,icon:au,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:`${typeof P=="number"?P.toFixed(1):0}%`,icon:Fs,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"},{title:"匹配次数",value:String(N),icon:Yt,color:"text-cyan-400",bg:"bg-cyan-500/20",link:"/find-partner"},{title:"匹配收益",value:`¥${(C??0).toFixed(2)}`,icon:La,color:"text-pink-400",bg:"bg-pink-500/20",link:"/find-partner"}];return e.jsxs("div",{className:"p-8 w-full",children:[e.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),b&&e.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[e.jsx("span",{children:b}),e.jsx("button",{type:"button",onClick:()=>G(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:I.map((w,V)=>e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>w.link&&r(w.link),children:[e.jsxs(Qe,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsx(qe,{className:"text-sm font-medium text-gray-400",children:w.title}),e.jsx("div",{className:`p-2 rounded-lg ${w.bg}`,children:e.jsx(w.icon,{className:`w-4 h-4 ${w.color}`})})]}),e.jsx(Se,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:w.value}),e.jsx(Aa,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},V))}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{className:"flex flex-row items-center justify-between",children:[e.jsx(qe,{className:"text-white",children:"最近订单"}),e.jsxs("button",{type:"button",onClick:()=>G(),className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1",title:"刷新",children:[e.jsx(Be,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),e.jsx(Se,{children:e.jsxs("div",{className:"space-y-3",children:[d.slice(0,5).map(w=>{var ne;const V=w.referrerId?i.find(_=>_.id===w.referrerId):void 0,te=w.referralCode||(V==null?void 0:V.referralCode)||(V==null?void 0:V.nickname)||(w.referrerId?String(w.referrerId).slice(0,8):""),ie=L(w),Y=w.userNickname||((ne=i.find(_=>_.id===w.userId))==null?void 0:ne.nickname)||"匿名用户";return e.jsxs("div",{className:"flex items-start justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30 hover:border-[#38bdac]/30 transition-colors",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[w.userAvatar?e.jsx("img",{src:w.userAvatar,alt:Y,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:_=>{_.currentTarget.style.display="none";const Q=_.currentTarget.nextElementSibling;Q&&Q.classList.remove("hidden")}}):null,e.jsx("div",{className:`w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 mt-0.5 ${w.userAvatar?"hidden":""}`,children:Y.charAt(0)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-sm text-gray-300",children:Y}),e.jsx("span",{className:"text-gray-600",children:"·"}),e.jsx("span",{className:"text-sm font-medium text-white truncate",children:ie.title})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[e.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:ie.subtitle}),e.jsx("span",{children:new Date(w.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),te&&e.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",te]})]})]}),e.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[e.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(w.amount).toFixed(2)]}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:w.paymentMethod||"微信"})]})]},w.id)}),d.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(au,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsx(Qe,{children:e.jsx(qe,{className:"text-white",children:"新注册用户"})}),e.jsx(Se,{children:e.jsxs("div",{className:"space-y-3",children:[i.slice(0,5).map(w=>{var V;return e.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((V=w.nickname)==null?void 0:V.charAt(0))||"?"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-white",children:w.nickname||"匿名用户"}),e.jsx("p",{className:"text-xs text-gray-500",children:w.phone||"-"})]})]}),e.jsx("p",{className:"text-xs text-gray-400",children:w.createdAt?new Date(w.createdAt).toLocaleDateString():"-"})]},w.id)}),i.length===0&&e.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})]})]})]})}const ps=u.forwardRef(({className:r,...a},l)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:l,className:ot("w-full caption-bottom text-sm",r),...a})}));ps.displayName="Table";const gs=u.forwardRef(({className:r,...a},l)=>e.jsx("thead",{ref:l,className:ot("[&_tr]:border-b",r),...a}));gs.displayName="TableHeader";const ys=u.forwardRef(({className:r,...a},l)=>e.jsx("tbody",{ref:l,className:ot("[&_tr:last-child]:border-0",r),...a}));ys.displayName="TableBody";const et=u.forwardRef(({className:r,...a},l)=>e.jsx("tr",{ref:l,className:ot("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r),...a}));et.displayName="TableRow";const je=u.forwardRef(({className:r,...a},l)=>e.jsx("th",{ref:l,className:ot("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",r),...a}));je.displayName="TableHead";const ge=u.forwardRef(({className:r,...a},l)=>e.jsx("td",{ref:l,className:ot("p-4 align-middle [&:has([role=checkbox])]:pr-0",r),...a}));ge.displayName="TableCell";const F1=hp("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Oe({className:r,variant:a,asChild:l=!1,...i}){const c=l?cp:"span";return e.jsx(c,{className:ot(F1({variant:a}),r),...i})}function Ye(r,a,{checkForDefaultPrevented:l=!0}={}){return function(c){if(r==null||r(c),l===!1||!c.defaultPrevented)return a==null?void 0:a(c)}}function z1(r,a){const l=u.createContext(a),i=d=>{const{children:m,...f}=d,p=u.useMemo(()=>f,Object.values(f));return e.jsx(l.Provider,{value:p,children:m})};i.displayName=r+"Provider";function c(d){const m=u.useContext(l);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${r}\``)}return[i,c]}function vn(r,a=[]){let l=[];function i(d,m){const f=u.createContext(m),p=l.length;l=[...l,m];const y=v=>{var C;const{scope:k,children:P,...T}=v,N=((C=k==null?void 0:k[r])==null?void 0:C[p])||f,j=u.useMemo(()=>T,Object.values(T));return e.jsx(N.Provider,{value:j,children:P})};y.displayName=d+"Provider";function g(v,k){var N;const P=((N=k==null?void 0:k[r])==null?void 0:N[p])||f,T=u.useContext(P);if(T)return T;if(m!==void 0)return m;throw new Error(`\`${v}\` must be used within \`${d}\``)}return[y,g]}const c=()=>{const d=l.map(m=>u.createContext(m));return function(f){const p=(f==null?void 0:f[r])||d;return u.useMemo(()=>({[`__scope${r}`]:{...f,[r]:p}}),[f,p])}};return c.scopeName=r,[i,$1(c,...a)]}function $1(...r){const a=r[0];if(r.length===1)return a;const l=()=>{const i=r.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(d){const m=i.reduce((f,{useScope:p,scopeName:y})=>{const v=p(d)[`__scope${y}`];return{...f,...v}},{});return u.useMemo(()=>({[`__scope${a.scopeName}`]:m}),[m])}};return l.scopeName=a.scopeName,l}var ts=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},B1=Po[" useId ".trim().toString()]||(()=>{}),U1=0;function un(r){const[a,l]=u.useState(B1());return ts(()=>{l(i=>i??String(U1++))},[r]),a?`radix-${a}`:""}var V1=Po[" useInsertionEffect ".trim().toString()]||ts;function Qn({prop:r,defaultProp:a,onChange:l=()=>{},caller:i}){const[c,d,m]=W1({defaultProp:a,onChange:l}),f=r!==void 0,p=f?r:c;{const g=u.useRef(r!==void 0);u.useEffect(()=>{const v=g.current;v!==f&&console.warn(`${i} is changing from ${v?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=f},[f,i])}const y=u.useCallback(g=>{var v;if(f){const k=H1(g)?g(r):g;k!==r&&((v=m.current)==null||v.call(m,k))}else d(g)},[f,r,d,m]);return[p,y]}function W1({defaultProp:r,onChange:a}){const[l,i]=u.useState(r),c=u.useRef(l),d=u.useRef(a);return V1(()=>{d.current=a},[a]),u.useEffect(()=>{var m;c.current!==l&&((m=d.current)==null||m.call(d,l),c.current=l)},[l,c]),[l,i,d]}function H1(r){return typeof r=="function"}function Vl(r){const a=K1(r),l=u.forwardRef((i,c)=>{const{children:d,...m}=i,f=u.Children.toArray(d),p=f.find(Y1);if(p){const y=p.props.children,g=f.map(v=>v===p?u.Children.count(y)>1?u.Children.only(null):u.isValidElement(y)?y.props.children:null:v);return e.jsx(a,{...m,ref:c,children:u.isValidElement(y)?u.cloneElement(y,void 0,g):null})}return e.jsx(a,{...m,ref:c,children:d})});return l.displayName=`${r}.Slot`,l}function K1(r){const a=u.forwardRef((l,i)=>{const{children:c,...d}=l;if(u.isValidElement(c)){const m=q1(c),f=Q1(d,c.props);return c.type!==u.Fragment&&(f.ref=i?Iu(i,m):m),u.cloneElement(c,f)}return u.Children.count(c)>1?u.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var G1=Symbol("radix.slottable");function Y1(r){return u.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===G1}function Q1(r,a){const l={...a};for(const i in a){const c=r[i],d=a[i];/^on[A-Z]/.test(i)?c&&d?l[i]=(...f)=>{const p=d(...f);return c(...f),p}:c&&(l[i]=c):i==="style"?l[i]={...c,...d}:i==="className"&&(l[i]=[c,d].filter(Boolean).join(" "))}return{...r,...l}}function q1(r){var i,c;let a=(i=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:i.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?r.ref:(a=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?r.props.ref:r.props.ref||r.ref)}var X1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Je=X1.reduce((r,a)=>{const l=Vl(`Primitive.${a}`),i=u.forwardRef((c,d)=>{const{asChild:m,...f}=c,p=m?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(p,{...f,ref:d})});return i.displayName=`Primitive.${a}`,{...r,[a]:i}},{});function J1(r,a){r&&Hl.flushSync(()=>r.dispatchEvent(a))}function mn(r){const a=u.useRef(r);return u.useEffect(()=>{a.current=r}),u.useMemo(()=>(...l)=>{var i;return(i=a.current)==null?void 0:i.call(a,...l)},[])}function Z1(r,a=globalThis==null?void 0:globalThis.document){const l=mn(r);u.useEffect(()=>{const i=c=>{c.key==="Escape"&&l(c)};return a.addEventListener("keydown",i,{capture:!0}),()=>a.removeEventListener("keydown",i,{capture:!0})},[l,a])}var ew="DismissableLayer",ou="dismissableLayer.update",tw="dismissableLayer.pointerDownOutside",sw="dismissableLayer.focusOutside",ax,Cp=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Mu=u.forwardRef((r,a)=>{const{disableOutsidePointerEvents:l=!1,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:m,onDismiss:f,...p}=r,y=u.useContext(Cp),[g,v]=u.useState(null),k=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,P]=u.useState({}),T=it(a,L=>v(L)),N=Array.from(y.layers),[j]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),C=N.indexOf(j),E=g?N.indexOf(g):-1,b=y.layersWithOutsidePointerEventsDisabled.size>0,R=E>=C,G=aw(L=>{const I=L.target,w=[...y.branches].some(V=>V.contains(I));!R||w||(c==null||c(L),m==null||m(L),L.defaultPrevented||f==null||f())},k),X=lw(L=>{const I=L.target;[...y.branches].some(V=>V.contains(I))||(d==null||d(L),m==null||m(L),L.defaultPrevented||f==null||f())},k);return Z1(L=>{E===y.layers.size-1&&(i==null||i(L),!L.defaultPrevented&&f&&(L.preventDefault(),f()))},k),u.useEffect(()=>{if(g)return l&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(ax=k.body.style.pointerEvents,k.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(g)),y.layers.add(g),lx(),()=>{l&&y.layersWithOutsidePointerEventsDisabled.size===1&&(k.body.style.pointerEvents=ax)}},[g,k,l,y]),u.useEffect(()=>()=>{g&&(y.layers.delete(g),y.layersWithOutsidePointerEventsDisabled.delete(g),lx())},[g,y]),u.useEffect(()=>{const L=()=>P({});return document.addEventListener(ou,L),()=>document.removeEventListener(ou,L)},[]),e.jsx(Je.div,{...p,ref:T,style:{pointerEvents:b?R?"auto":"none":void 0,...r.style},onFocusCapture:Ye(r.onFocusCapture,X.onFocusCapture),onBlurCapture:Ye(r.onBlurCapture,X.onBlurCapture),onPointerDownCapture:Ye(r.onPointerDownCapture,G.onPointerDownCapture)})});Mu.displayName=ew;var rw="DismissableLayerBranch",nw=u.forwardRef((r,a)=>{const l=u.useContext(Cp),i=u.useRef(null),c=it(a,i);return u.useEffect(()=>{const d=i.current;if(d)return l.branches.add(d),()=>{l.branches.delete(d)}},[l.branches]),e.jsx(Je.div,{...r,ref:c})});nw.displayName=rw;function aw(r,a=globalThis==null?void 0:globalThis.document){const l=mn(r),i=u.useRef(!1),c=u.useRef(()=>{});return u.useEffect(()=>{const d=f=>{if(f.target&&!i.current){let p=function(){kp(tw,l,y,{discrete:!0})};const y={originalEvent:f};f.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=p,a.addEventListener("click",c.current,{once:!0})):p()}else a.removeEventListener("click",c.current);i.current=!1},m=window.setTimeout(()=>{a.addEventListener("pointerdown",d)},0);return()=>{window.clearTimeout(m),a.removeEventListener("pointerdown",d),a.removeEventListener("click",c.current)}},[a,l]),{onPointerDownCapture:()=>i.current=!0}}function lw(r,a=globalThis==null?void 0:globalThis.document){const l=mn(r),i=u.useRef(!1);return u.useEffect(()=>{const c=d=>{d.target&&!i.current&&kp(sw,l,{originalEvent:d},{discrete:!1})};return a.addEventListener("focusin",c),()=>a.removeEventListener("focusin",c)},[a,l]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function lx(){const r=new CustomEvent(ou);document.dispatchEvent(r)}function kp(r,a,l,{discrete:i}){const c=l.originalEvent.target,d=new CustomEvent(r,{bubbles:!1,cancelable:!0,detail:l});a&&c.addEventListener(r,a,{once:!0}),i?J1(c,d):c.dispatchEvent(d)}var Od="focusScope.autoFocusOnMount",Fd="focusScope.autoFocusOnUnmount",ix={bubbles:!1,cancelable:!0},iw="FocusScope",Au=u.forwardRef((r,a)=>{const{loop:l=!1,trapped:i=!1,onMountAutoFocus:c,onUnmountAutoFocus:d,...m}=r,[f,p]=u.useState(null),y=mn(c),g=mn(d),v=u.useRef(null),k=it(a,N=>p(N)),P=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(i){let N=function(b){if(P.paused||!f)return;const R=b.target;f.contains(R)?v.current=R:nn(v.current,{select:!0})},j=function(b){if(P.paused||!f)return;const R=b.relatedTarget;R!==null&&(f.contains(R)||nn(v.current,{select:!0}))},C=function(b){if(document.activeElement===document.body)for(const G of b)G.removedNodes.length>0&&nn(f)};document.addEventListener("focusin",N),document.addEventListener("focusout",j);const E=new MutationObserver(C);return f&&E.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",j),E.disconnect()}}},[i,f,P.paused]),u.useEffect(()=>{if(f){cx.add(P);const N=document.activeElement;if(!f.contains(N)){const C=new CustomEvent(Od,ix);f.addEventListener(Od,y),f.dispatchEvent(C),C.defaultPrevented||(ow(mw(Ep(f)),{select:!0}),document.activeElement===N&&nn(f))}return()=>{f.removeEventListener(Od,y),setTimeout(()=>{const C=new CustomEvent(Fd,ix);f.addEventListener(Fd,g),f.dispatchEvent(C),C.defaultPrevented||nn(N??document.body,{select:!0}),f.removeEventListener(Fd,g),cx.remove(P)},0)}}},[f,y,g,P]);const T=u.useCallback(N=>{if(!l&&!i||P.paused)return;const j=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,C=document.activeElement;if(j&&C){const E=N.currentTarget,[b,R]=cw(E);b&&R?!N.shiftKey&&C===R?(N.preventDefault(),l&&nn(b,{select:!0})):N.shiftKey&&C===b&&(N.preventDefault(),l&&nn(R,{select:!0})):C===E&&N.preventDefault()}},[l,i,P.paused]);return e.jsx(Je.div,{tabIndex:-1,...m,ref:k,onKeyDown:T})});Au.displayName=iw;function ow(r,{select:a=!1}={}){const l=document.activeElement;for(const i of r)if(nn(i,{select:a}),document.activeElement!==l)return}function cw(r){const a=Ep(r),l=ox(a,r),i=ox(a.reverse(),r);return[l,i]}function Ep(r){const a=[],l=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const c=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||c?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;l.nextNode();)a.push(l.currentNode);return a}function ox(r,a){for(const l of r)if(!dw(l,{upTo:a}))return l}function dw(r,{upTo:a}){if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(a!==void 0&&r===a)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1}function uw(r){return r instanceof HTMLInputElement&&"select"in r}function nn(r,{select:a=!1}={}){if(r&&r.focus){const l=document.activeElement;r.focus({preventScroll:!0}),r!==l&&uw(r)&&a&&r.select()}}var cx=hw();function hw(){let r=[];return{add(a){const l=r[0];a!==l&&(l==null||l.pause()),r=dx(r,a),r.unshift(a)},remove(a){var l;r=dx(r,a),(l=r[0])==null||l.resume()}}}function dx(r,a){const l=[...r],i=l.indexOf(a);return i!==-1&&l.splice(i,1),l}function mw(r){return r.filter(a=>a.tagName!=="A")}var fw="Portal",Du=u.forwardRef((r,a)=>{var f;const{container:l,...i}=r,[c,d]=u.useState(!1);ts(()=>d(!0),[]);const m=l||c&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return m?_v.createPortal(e.jsx(Je.div,{...i,ref:a}),m):null});Du.displayName=fw;function xw(r,a){return u.useReducer((l,i)=>a[l][i]??l,r)}var Kl=r=>{const{present:a,children:l}=r,i=pw(a),c=typeof l=="function"?l({present:i.isPresent}):u.Children.only(l),d=it(i.ref,gw(c));return typeof l=="function"||i.isPresent?u.cloneElement(c,{ref:d}):null};Kl.displayName="Presence";function pw(r){const[a,l]=u.useState(),i=u.useRef(null),c=u.useRef(r),d=u.useRef("none"),m=r?"mounted":"unmounted",[f,p]=xw(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const y=so(i.current);d.current=f==="mounted"?y:"none"},[f]),ts(()=>{const y=i.current,g=c.current;if(g!==r){const k=d.current,P=so(y);r?p("MOUNT"):P==="none"||(y==null?void 0:y.display)==="none"?p("UNMOUNT"):p(g&&k!==P?"ANIMATION_OUT":"UNMOUNT"),c.current=r}},[r,p]),ts(()=>{if(a){let y;const g=a.ownerDocument.defaultView??window,v=P=>{const N=so(i.current).includes(CSS.escape(P.animationName));if(P.target===a&&N&&(p("ANIMATION_END"),!c.current)){const j=a.style.animationFillMode;a.style.animationFillMode="forwards",y=g.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=j)})}},k=P=>{P.target===a&&(d.current=so(i.current))};return a.addEventListener("animationstart",k),a.addEventListener("animationcancel",v),a.addEventListener("animationend",v),()=>{g.clearTimeout(y),a.removeEventListener("animationstart",k),a.removeEventListener("animationcancel",v),a.removeEventListener("animationend",v)}}else p("ANIMATION_END")},[a,p]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:u.useCallback(y=>{i.current=y?getComputedStyle(y):null,l(y)},[])}}function so(r){return(r==null?void 0:r.animationName)||"none"}function gw(r){var i,c;let a=(i=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:i.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?r.ref:(a=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?r.props.ref:r.props.ref||r.ref)}var zd=0;function Pp(){u.useEffect(()=>{const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",r[0]??ux()),document.body.insertAdjacentElement("beforeend",r[1]??ux()),zd++,()=>{zd===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),zd--}},[])}function ux(){const r=document.createElement("span");return r.setAttribute("data-radix-focus-guard",""),r.tabIndex=0,r.style.outline="none",r.style.opacity="0",r.style.position="fixed",r.style.pointerEvents="none",r}var lr=function(){return lr=Object.assign||function(a){for(var l,i=1,c=arguments.length;i"u")return Aw;var a=Dw(r),l=document.documentElement.clientWidth,i=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,i-l+a[2]-a[0])}},Ow=_p(),Fa="data-scroll-locked",Fw=function(r,a,l,i){var c=r.left,d=r.top,m=r.right,f=r.gap;return l===void 0&&(l="margin"),` - .`.concat(vw,` { - overflow: hidden `).concat(i,`; - padding-right: `).concat(f,"px ").concat(i,`; - } - body[`).concat(Fa,`] { - overflow: hidden `).concat(i,`; - overscroll-behavior: contain; - `).concat([a&&"position: relative ".concat(i,";"),l==="margin"&&` - padding-left: `.concat(c,`px; - padding-top: `).concat(d,`px; - padding-right: `).concat(m,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(f,"px ").concat(i,`; - `),l==="padding"&&"padding-right: ".concat(f,"px ").concat(i,";")].filter(Boolean).join(""),` - } - - .`).concat(ho,` { - right: `).concat(f,"px ").concat(i,`; - } - - .`).concat(mo,` { - margin-right: `).concat(f,"px ").concat(i,`; - } - - .`).concat(ho," .").concat(ho,` { - right: 0 `).concat(i,`; - } - - .`).concat(mo," .").concat(mo,` { - margin-right: 0 `).concat(i,`; - } - - body[`).concat(Fa,`] { - `).concat(bw,": ").concat(f,`px; - } -`)},mx=function(){var r=parseInt(document.body.getAttribute(Fa)||"0",10);return isFinite(r)?r:0},zw=function(){u.useEffect(function(){return document.body.setAttribute(Fa,(mx()+1).toString()),function(){var r=mx()-1;r<=0?document.body.removeAttribute(Fa):document.body.setAttribute(Fa,r.toString())}},[])},$w=function(r){var a=r.noRelative,l=r.noImportant,i=r.gapMode,c=i===void 0?"margin":i;zw();var d=u.useMemo(function(){return Lw(c)},[c]);return u.createElement(Ow,{styles:Fw(d,!a,c,l?"":"!important")})},cu=!1;if(typeof window<"u")try{var ro=Object.defineProperty({},"passive",{get:function(){return cu=!0,!0}});window.addEventListener("test",ro,ro),window.removeEventListener("test",ro,ro)}catch{cu=!1}var Ia=cu?{passive:!1}:!1,Bw=function(r){return r.tagName==="TEXTAREA"},Mp=function(r,a){if(!(r instanceof Element))return!1;var l=window.getComputedStyle(r);return l[a]!=="hidden"&&!(l.overflowY===l.overflowX&&!Bw(r)&&l[a]==="visible")},Uw=function(r){return Mp(r,"overflowY")},Vw=function(r){return Mp(r,"overflowX")},fx=function(r,a){var l=a.ownerDocument,i=a;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var c=Ap(r,i);if(c){var d=Dp(r,i),m=d[1],f=d[2];if(m>f)return!0}i=i.parentNode}while(i&&i!==l.body);return!1},Ww=function(r){var a=r.scrollTop,l=r.scrollHeight,i=r.clientHeight;return[a,l,i]},Hw=function(r){var a=r.scrollLeft,l=r.scrollWidth,i=r.clientWidth;return[a,l,i]},Ap=function(r,a){return r==="v"?Uw(a):Vw(a)},Dp=function(r,a){return r==="v"?Ww(a):Hw(a)},Kw=function(r,a){return r==="h"&&a==="rtl"?-1:1},Gw=function(r,a,l,i,c){var d=Kw(r,window.getComputedStyle(a).direction),m=d*i,f=l.target,p=a.contains(f),y=!1,g=m>0,v=0,k=0;do{if(!f)break;var P=Dp(r,f),T=P[0],N=P[1],j=P[2],C=N-j-d*T;(T||C)&&Ap(r,f)&&(v+=C,k+=T);var E=f.parentNode;f=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!p&&f!==document.body||p&&(a.contains(f)||a===f));return(g&&Math.abs(v)<1||!g&&Math.abs(k)<1)&&(y=!0),y},no=function(r){return"changedTouches"in r?[r.changedTouches[0].clientX,r.changedTouches[0].clientY]:[0,0]},xx=function(r){return[r.deltaX,r.deltaY]},px=function(r){return r&&"current"in r?r.current:r},Yw=function(r,a){return r[0]===a[0]&&r[1]===a[1]},Qw=function(r){return` - .block-interactivity-`.concat(r,` {pointer-events: none;} - .allow-interactivity-`).concat(r,` {pointer-events: all;} -`)},qw=0,_a=[];function Xw(r){var a=u.useRef([]),l=u.useRef([0,0]),i=u.useRef(),c=u.useState(qw++)[0],d=u.useState(_p)[0],m=u.useRef(r);u.useEffect(function(){m.current=r},[r]),u.useEffect(function(){if(r.inert){document.body.classList.add("block-interactivity-".concat(c));var N=yw([r.lockRef.current],(r.shards||[]).map(px),!0).filter(Boolean);return N.forEach(function(j){return j.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),N.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(c))})}}},[r.inert,r.lockRef.current,r.shards]);var f=u.useCallback(function(N,j){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!m.current.allowPinchZoom;var C=no(N),E=l.current,b="deltaX"in N?N.deltaX:E[0]-C[0],R="deltaY"in N?N.deltaY:E[1]-C[1],G,X=N.target,L=Math.abs(b)>Math.abs(R)?"h":"v";if("touches"in N&&L==="h"&&X.type==="range")return!1;var I=window.getSelection(),w=I&&I.anchorNode,V=w?w===X||w.contains(X):!1;if(V)return!1;var te=fx(L,X);if(!te)return!0;if(te?G=L:(G=L==="v"?"h":"v",te=fx(L,X)),!te)return!1;if(!i.current&&"changedTouches"in N&&(b||R)&&(i.current=G),!G)return!0;var ie=i.current||G;return Gw(ie,j,N,ie==="h"?b:R)},[]),p=u.useCallback(function(N){var j=N;if(!(!_a.length||_a[_a.length-1]!==d)){var C="deltaY"in j?xx(j):no(j),E=a.current.filter(function(G){return G.name===j.type&&(G.target===j.target||j.target===G.shadowParent)&&Yw(G.delta,C)})[0];if(E&&E.should){j.cancelable&&j.preventDefault();return}if(!E){var b=(m.current.shards||[]).map(px).filter(Boolean).filter(function(G){return G.contains(j.target)}),R=b.length>0?f(j,b[0]):!m.current.noIsolation;R&&j.cancelable&&j.preventDefault()}}},[]),y=u.useCallback(function(N,j,C,E){var b={name:N,delta:j,target:C,should:E,shadowParent:Jw(C)};a.current.push(b),setTimeout(function(){a.current=a.current.filter(function(R){return R!==b})},1)},[]),g=u.useCallback(function(N){l.current=no(N),i.current=void 0},[]),v=u.useCallback(function(N){y(N.type,xx(N),N.target,f(N,r.lockRef.current))},[]),k=u.useCallback(function(N){y(N.type,no(N),N.target,f(N,r.lockRef.current))},[]);u.useEffect(function(){return _a.push(d),r.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:k}),document.addEventListener("wheel",p,Ia),document.addEventListener("touchmove",p,Ia),document.addEventListener("touchstart",g,Ia),function(){_a=_a.filter(function(N){return N!==d}),document.removeEventListener("wheel",p,Ia),document.removeEventListener("touchmove",p,Ia),document.removeEventListener("touchstart",g,Ia)}},[]);var P=r.removeScrollBar,T=r.inert;return u.createElement(u.Fragment,null,T?u.createElement(d,{styles:Qw(c)}):null,P?u.createElement($w,{noRelative:r.noRelative,gapMode:r.gapMode}):null)}function Jw(r){for(var a=null;r!==null;)r instanceof ShadowRoot&&(a=r.host,r=r.host),r=r.parentNode;return a}const Zw=Ew(Ip,Xw);var Lu=u.forwardRef(function(r,a){return u.createElement(_o,lr({},r,{ref:a,sideCar:Zw}))});Lu.classNames=_o.classNames;var e2=function(r){if(typeof document>"u")return null;var a=Array.isArray(r)?r[0]:r;return a.ownerDocument.body},Ma=new WeakMap,ao=new WeakMap,lo={},Vd=0,Lp=function(r){return r&&(r.host||Lp(r.parentNode))},t2=function(r,a){return a.map(function(l){if(r.contains(l))return l;var i=Lp(l);return i&&r.contains(i)?i:(console.error("aria-hidden",l,"in not contained inside",r,". Doing nothing"),null)}).filter(function(l){return!!l})},s2=function(r,a,l,i){var c=t2(a,Array.isArray(r)?r:[r]);lo[l]||(lo[l]=new WeakMap);var d=lo[l],m=[],f=new Set,p=new Set(c),y=function(v){!v||f.has(v)||(f.add(v),y(v.parentNode))};c.forEach(y);var g=function(v){!v||p.has(v)||Array.prototype.forEach.call(v.children,function(k){if(f.has(k))g(k);else try{var P=k.getAttribute(i),T=P!==null&&P!=="false",N=(Ma.get(k)||0)+1,j=(d.get(k)||0)+1;Ma.set(k,N),d.set(k,j),m.push(k),N===1&&T&&ao.set(k,!0),j===1&&k.setAttribute(l,"true"),T||k.setAttribute(i,"true")}catch(C){console.error("aria-hidden: cannot operate on ",k,C)}})};return g(a),f.clear(),Vd++,function(){m.forEach(function(v){var k=Ma.get(v)-1,P=d.get(v)-1;Ma.set(v,k),d.set(v,P),k||(ao.has(v)||v.removeAttribute(i),ao.delete(v)),P||v.removeAttribute(l)}),Vd--,Vd||(Ma=new WeakMap,Ma=new WeakMap,ao=new WeakMap,lo={})}},Op=function(r,a,l){l===void 0&&(l="data-aria-hidden");var i=Array.from(Array.isArray(r)?r:[r]),c=e2(r);return c?(i.push.apply(i,Array.from(c.querySelectorAll("[aria-live], script"))),s2(i,c,l,"aria-hidden")):function(){return null}},Mo="Dialog",[Fp]=vn(Mo),[r2,qs]=Fp(Mo),zp=r=>{const{__scopeDialog:a,children:l,open:i,defaultOpen:c,onOpenChange:d,modal:m=!0}=r,f=u.useRef(null),p=u.useRef(null),[y,g]=Qn({prop:i,defaultProp:c??!1,onChange:d,caller:Mo});return e.jsx(r2,{scope:a,triggerRef:f,contentRef:p,contentId:un(),titleId:un(),descriptionId:un(),open:y,onOpenChange:g,onOpenToggle:u.useCallback(()=>g(v=>!v),[g]),modal:m,children:l})};zp.displayName=Mo;var $p="DialogTrigger",n2=u.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=qs($p,l),d=it(a,c.triggerRef);return e.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":zu(c.open),...i,ref:d,onClick:Ye(r.onClick,c.onOpenToggle)})});n2.displayName=$p;var Ou="DialogPortal",[a2,Bp]=Fp(Ou,{forceMount:void 0}),Up=r=>{const{__scopeDialog:a,forceMount:l,children:i,container:c}=r,d=qs(Ou,a);return e.jsx(a2,{scope:a,forceMount:l,children:u.Children.map(i,m=>e.jsx(Kl,{present:l||d.open,children:e.jsx(Du,{asChild:!0,container:c,children:m})}))})};Up.displayName=Ou;var jo="DialogOverlay",Vp=u.forwardRef((r,a)=>{const l=Bp(jo,r.__scopeDialog),{forceMount:i=l.forceMount,...c}=r,d=qs(jo,r.__scopeDialog);return d.modal?e.jsx(Kl,{present:i||d.open,children:e.jsx(i2,{...c,ref:a})}):null});Vp.displayName=jo;var l2=Vl("DialogOverlay.RemoveScroll"),i2=u.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=qs(jo,l);return e.jsx(Lu,{as:l2,allowPinchZoom:!0,shards:[c.contentRef],children:e.jsx(Je.div,{"data-state":zu(c.open),...i,ref:a,style:{pointerEvents:"auto",...i.style}})})}),qn="DialogContent",Wp=u.forwardRef((r,a)=>{const l=Bp(qn,r.__scopeDialog),{forceMount:i=l.forceMount,...c}=r,d=qs(qn,r.__scopeDialog);return e.jsx(Kl,{present:i||d.open,children:d.modal?e.jsx(o2,{...c,ref:a}):e.jsx(c2,{...c,ref:a})})});Wp.displayName=qn;var o2=u.forwardRef((r,a)=>{const l=qs(qn,r.__scopeDialog),i=u.useRef(null),c=it(a,l.contentRef,i);return u.useEffect(()=>{const d=i.current;if(d)return Op(d)},[]),e.jsx(Hp,{...r,ref:c,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ye(r.onCloseAutoFocus,d=>{var m;d.preventDefault(),(m=l.triggerRef.current)==null||m.focus()}),onPointerDownOutside:Ye(r.onPointerDownOutside,d=>{const m=d.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0;(m.button===2||f)&&d.preventDefault()}),onFocusOutside:Ye(r.onFocusOutside,d=>d.preventDefault())})}),c2=u.forwardRef((r,a)=>{const l=qs(qn,r.__scopeDialog),i=u.useRef(!1),c=u.useRef(!1);return e.jsx(Hp,{...r,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{var m,f;(m=r.onCloseAutoFocus)==null||m.call(r,d),d.defaultPrevented||(i.current||(f=l.triggerRef.current)==null||f.focus(),d.preventDefault()),i.current=!1,c.current=!1},onInteractOutside:d=>{var p,y;(p=r.onInteractOutside)==null||p.call(r,d),d.defaultPrevented||(i.current=!0,d.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const m=d.target;((y=l.triggerRef.current)==null?void 0:y.contains(m))&&d.preventDefault(),d.detail.originalEvent.type==="focusin"&&c.current&&d.preventDefault()}})}),Hp=u.forwardRef((r,a)=>{const{__scopeDialog:l,trapFocus:i,onOpenAutoFocus:c,onCloseAutoFocus:d,...m}=r,f=qs(qn,l),p=u.useRef(null),y=it(a,p);return Pp(),e.jsxs(e.Fragment,{children:[e.jsx(Au,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:c,onUnmountAutoFocus:d,children:e.jsx(Mu,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":zu(f.open),...m,ref:y,onDismiss:()=>f.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(d2,{titleId:f.titleId}),e.jsx(h2,{contentRef:p,descriptionId:f.descriptionId})]})]})}),Fu="DialogTitle",Kp=u.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=qs(Fu,l);return e.jsx(Je.h2,{id:c.titleId,...i,ref:a})});Kp.displayName=Fu;var Gp="DialogDescription",Yp=u.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=qs(Gp,l);return e.jsx(Je.p,{id:c.descriptionId,...i,ref:a})});Yp.displayName=Gp;var Qp="DialogClose",qp=u.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=qs(Qp,l);return e.jsx(Je.button,{type:"button",...i,ref:a,onClick:Ye(r.onClick,()=>c.onOpenChange(!1))})});qp.displayName=Qp;function zu(r){return r?"open":"closed"}var Xp="DialogTitleWarning",[iC,Jp]=z1(Xp,{contentName:qn,titleName:Fu,docsSlug:"dialog"}),d2=({titleId:r})=>{const a=Jp(Xp),l=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return u.useEffect(()=>{r&&(document.getElementById(r)||console.error(l))},[l,r]),null},u2="DialogDescriptionWarning",h2=({contentRef:r,descriptionId:a})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Jp(u2).contentName}}.`;return u.useEffect(()=>{var d;const c=(d=r.current)==null?void 0:d.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(i))},[i,r,a]),null},m2=zp,f2=Up,x2=Vp,p2=Wp,g2=Kp,y2=Yp,v2=qp;function Ct(r){return e.jsx(m2,{"data-slot":"dialog",...r})}function b2(r){return e.jsx(f2,{...r})}const Zp=u.forwardRef(({className:r,...a},l)=>e.jsx(x2,{ref:l,className:ot("fixed inset-0 z-50 bg-black/50",r),...a}));Zp.displayName="DialogOverlay";const jt=u.forwardRef(({className:r,children:a,showCloseButton:l=!0,...i},c)=>e.jsxs(b2,{children:[e.jsx(Zp,{}),e.jsxs(p2,{ref:c,"aria-describedby":void 0,className:ot("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg sm:max-w-lg",r),...i,children:[a,l&&e.jsxs(v2,{className:"absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[e.jsx(xs,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));jt.displayName="DialogContent";function kt({className:r,...a}){return e.jsx("div",{className:ot("flex flex-col gap-2 text-center sm:text-left",r),...a})}function Ot({className:r,...a}){return e.jsx("div",{className:ot("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",r),...a})}function Et(r){return e.jsx(g2,{className:"text-lg font-semibold leading-none",...r})}function j2(r){return e.jsx(y2,{className:"text-sm text-muted-foreground",...r})}function $u(r,a){const[l,i]=u.useState(r);return u.useEffect(()=>{const c=setTimeout(()=>i(r),a);return()=>clearTimeout(c)},[r,a]),l}function Gs({page:r,totalPages:a,total:l,pageSize:i,onPageChange:c,onPageSizeChange:d,pageSizeOptions:m=[10,20,50,100]}){return a<=1&&!d?null:e.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[e.jsxs("span",{children:["共 ",l," 条"]}),d&&e.jsx("select",{value:i,onChange:f=>d(Number(f.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:m.map(f=>e.jsxs("option",{value:f,children:[f," 条/页"]},f))})]}),a>1&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>c(1),disabled:r<=1,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"首页"}),e.jsx("button",{type:"button",onClick:()=>c(r-1),disabled:r<=1,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"上一页"}),e.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[r," / ",a]}),e.jsx("button",{type:"button",onClick:()=>c(r+1),disabled:r>=a,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),e.jsx("button",{type:"button",onClick:()=>c(a),disabled:r>=a,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"末页"})]})]})}function N2(){const[r,a]=u.useState([]),[l,i]=u.useState([]),[c,d]=u.useState(0),[m,f]=u.useState(0),[p,y]=u.useState(0),[g,v]=u.useState(1),[k,P]=u.useState(10),[T,N]=u.useState(""),j=$u(T,300),[C,E]=u.useState("all"),[b,R]=u.useState(!0),[G,X]=u.useState(null),[L,I]=u.useState(null),[w,V]=u.useState(""),[te,ie]=u.useState(!1);async function Y(){R(!0),X(null);try{const H=C==="all"?"":C==="completed"?"completed":C,A=new URLSearchParams({page:String(g),pageSize:String(k),...H&&{status:H},...j&&{search:j}}),[$,z]=await Promise.all([Le(`/api/orders?${A}`),Le("/api/db/users?page=1&pageSize=500")]);$!=null&&$.success&&(a($.orders||[]),d($.total??0),f($.totalRevenue??0),y($.todayRevenue??0)),z!=null&&z.success&&z.users&&i(z.users)}catch(H){console.error("加载订单失败",H),X("加载订单失败,请检查网络后重试")}finally{R(!1)}}u.useEffect(()=>{v(1)},[j,C]),u.useEffect(()=>{Y()},[g,k,j,C]);const ne=H=>{var A;return H.userNickname||((A=l.find($=>$.id===H.userId))==null?void 0:A.nickname)||"匿名用户"},_=H=>{var A;return((A=l.find($=>$.id===H))==null?void 0:A.phone)||"-"},Q=H=>{const A=H.productType||H.type||"",$=H.description||"";if($){if(A==="section"&&$.includes("章节")){if($.includes("-")){const z=$.split("-");if(z.length>=3)return{name:`第${z[1]}章 第${z[2]}节`,type:"《一场Soul的创业实验》"}}return{name:$,type:"章节购买"}}return A==="fullbook"||$.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:A==="vip"||$.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:A==="match"||$.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:$,type:"其他"}}return A==="section"?{name:`章节 ${H.productId||H.sectionId||""}`,type:"单章"}:A==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:A==="vip"?{name:"VIP年度会员",type:"VIP"}:A==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:A||"其他"}},ue=Math.ceil(c/k)||1;async function O(){var H;if(!(!(L!=null&&L.orderSn)&&!(L!=null&&L.id))){ie(!0),X(null);try{const A=await yt("/api/admin/orders/refund",{orderSn:L.orderSn||L.id,reason:w||void 0});A!=null&&A.success?(I(null),V(""),Y()):X((A==null?void 0:A.error)||"退款失败")}catch(A){const $=A;X(((H=$==null?void 0:$.data)==null?void 0:H.error)||"退款失败,请检查网络后重试")}finally{ie(!1)}}}function re(){if(r.length===0){alert("暂无数据可导出");return}const H=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],A=r.map(de=>{const q=Q(de);return[de.orderSn||de.id||"",ne(de),_(de.userId),q.name,Number(de.amount||0).toFixed(2),de.paymentMethod==="wechat"?"微信支付":de.paymentMethod==="alipay"?"支付宝":de.paymentMethod||"微信支付",de.status==="refunded"?"已退款":de.status==="paid"||de.status==="completed"?"已完成":de.status==="pending"||de.status==="created"?"待支付":"已失败",de.status==="refunded"&&de.refundReason?de.refundReason:"-",de.referrerEarnings?Number(de.referrerEarnings).toFixed(2):"-",de.createdAt?new Date(de.createdAt).toLocaleString("zh-CN"):""].join(",")}),$="\uFEFF"+[H.join(","),...A].join(` -`),z=new Blob([$],{type:"text/csv;charset=utf-8"}),ee=URL.createObjectURL(z),K=document.createElement("a");K.href=ee,K.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,K.click(),URL.revokeObjectURL(ee)}return e.jsxs("div",{className:"p-8 w-full",children:[G&&e.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[e.jsx("span",{children:G}),e.jsx("button",{type:"button",onClick:()=>X(null),className:"hover:text-red-300",children:"×"})]}),e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),e.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",r.length," 笔订单"]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(Z,{variant:"outline",onClick:Y,disabled:b,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${b?"animate-spin":""}`}),"刷新"]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-gray-400",children:"总收入:"}),e.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",m.toFixed(2)]}),e.jsx("span",{className:"text-gray-600",children:"|"}),e.jsx("span",{className:"text-gray-400",children:"今日:"}),e.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",p.toFixed(2)]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(dn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),e.jsx(ce,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:T,onChange:H=>N(H.target.value)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(rp,{className:"w-4 h-4 text-gray-400"}),e.jsxs("select",{value:C,onChange:H=>E(H.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[e.jsx("option",{value:"all",children:"全部状态"}),e.jsx("option",{value:"completed",children:"已完成"}),e.jsx("option",{value:"pending",children:"待支付"}),e.jsx("option",{value:"created",children:"已创建"}),e.jsx("option",{value:"failed",children:"已失败"}),e.jsx("option",{value:"refunded",children:"已退款"})]})]}),e.jsxs(Z,{variant:"outline",onClick:re,disabled:r.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(pj,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:e.jsx(Se,{className:"p-0",children:b?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):e.jsxs("div",{children:[e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"订单号"}),e.jsx(je,{className:"text-gray-400",children:"用户"}),e.jsx(je,{className:"text-gray-400",children:"商品"}),e.jsx(je,{className:"text-gray-400",children:"金额"}),e.jsx(je,{className:"text-gray-400",children:"支付方式"}),e.jsx(je,{className:"text-gray-400",children:"状态"}),e.jsx(je,{className:"text-gray-400",children:"退款原因"}),e.jsx(je,{className:"text-gray-400",children:"分销佣金"}),e.jsx(je,{className:"text-gray-400",children:"下单时间"}),e.jsx(je,{className:"text-gray-400",children:"操作"})]})}),e.jsxs(ys,{children:[r.map(H=>{const A=Q(H);return e.jsxs(et,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[e.jsxs(ge,{className:"font-mono text-xs text-gray-400",children:[(H.orderSn||H.id||"").slice(0,12),"..."]}),e.jsx(ge,{children:e.jsxs("div",{children:[e.jsx("p",{className:"text-white text-sm",children:ne(H)}),e.jsx("p",{className:"text-gray-500 text-xs",children:_(H.userId)})]})}),e.jsx(ge,{children:e.jsxs("div",{children:[e.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[A.name,(H.productType||H.type)==="vip"&&e.jsx(Oe,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),e.jsx("p",{className:"text-gray-500 text-xs",children:A.type})]})}),e.jsxs(ge,{className:"text-[#38bdac] font-bold",children:["¥",Number(H.amount||0).toFixed(2)]}),e.jsx(ge,{className:"text-gray-300",children:H.paymentMethod==="wechat"?"微信支付":H.paymentMethod==="alipay"?"支付宝":H.paymentMethod||"微信支付"}),e.jsx(ge,{children:H.status==="refunded"?e.jsx(Oe,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):H.status==="paid"||H.status==="completed"?e.jsx(Oe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):H.status==="pending"||H.status==="created"?e.jsx(Oe,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):e.jsx(Oe,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),e.jsx(ge,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:H.refundReason,children:H.status==="refunded"&&H.refundReason?H.refundReason:"-"}),e.jsx(ge,{className:"text-[#FFD700]",children:H.referrerEarnings?`¥${Number(H.referrerEarnings).toFixed(2)}`:"-"}),e.jsx(ge,{className:"text-gray-400 text-sm",children:new Date(H.createdAt).toLocaleString("zh-CN")}),e.jsx(ge,{children:(H.status==="paid"||H.status==="completed")&&e.jsxs(Z,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{I(H),V("")},children:[e.jsx(lp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},H.id)}),r.length===0&&e.jsx(et,{children:e.jsx(ge,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),e.jsx(Gs,{page:g,totalPages:ue,total:c,pageSize:k,onPageChange:v,onPageSizeChange:H=>{P(H),v(1)}})]})})}),e.jsx(Ct,{open:!!L,onOpenChange:H=>!H&&I(null),children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[e.jsx(kt,{children:e.jsx(Et,{className:"text-white",children:"订单退款"})}),L&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",L.orderSn||L.id]}),e.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(L.amount||0).toFixed(2)]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),e.jsx("div",{className:"form-input",children:e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:w,onChange:H=>V(H.target.value)})})]}),e.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),e.jsxs(Ot,{children:[e.jsx(Z,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>I(null),disabled:te,children:"取消"}),e.jsx(Z,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:O,disabled:te,children:te?"退款中...":"确认退款"})]})]})})]})}var w2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],S2=w2.reduce((r,a)=>{const l=op(`Primitive.${a}`),i=u.forwardRef((c,d)=>{const{asChild:m,...f}=c,p=m?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(p,{...f,ref:d})});return i.displayName=`Primitive.${a}`,{...r,[a]:i}},{}),C2="Label",e0=u.forwardRef((r,a)=>e.jsx(S2.label,{...r,ref:a,onMouseDown:l=>{var c;l.target.closest("button, input, select, textarea")||((c=r.onMouseDown)==null||c.call(r,l),!l.defaultPrevented&&l.detail>1&&l.preventDefault())}}));e0.displayName=C2;var t0=e0;const se=u.forwardRef(({className:r,...a},l)=>e.jsx(t0,{ref:l,className:ot("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",r),...a}));se.displayName=t0.displayName;function Bu(r){const a=r+"CollectionProvider",[l,i]=vn(a),[c,d]=l(a,{collectionRef:{current:null},itemMap:new Map}),m=N=>{const{scope:j,children:C}=N,E=rn.useRef(null),b=rn.useRef(new Map).current;return e.jsx(c,{scope:j,itemMap:b,collectionRef:E,children:C})};m.displayName=a;const f=r+"CollectionSlot",p=Vl(f),y=rn.forwardRef((N,j)=>{const{scope:C,children:E}=N,b=d(f,C),R=it(j,b.collectionRef);return e.jsx(p,{ref:R,children:E})});y.displayName=f;const g=r+"CollectionItemSlot",v="data-radix-collection-item",k=Vl(g),P=rn.forwardRef((N,j)=>{const{scope:C,children:E,...b}=N,R=rn.useRef(null),G=it(j,R),X=d(g,C);return rn.useEffect(()=>(X.itemMap.set(R,{ref:R,...b}),()=>void X.itemMap.delete(R))),e.jsx(k,{[v]:"",ref:G,children:E})});P.displayName=g;function T(N){const j=d(r+"CollectionConsumer",N);return rn.useCallback(()=>{const E=j.collectionRef.current;if(!E)return[];const b=Array.from(E.querySelectorAll(`[${v}]`));return Array.from(j.itemMap.values()).sort((X,L)=>b.indexOf(X.ref.current)-b.indexOf(L.ref.current))},[j.collectionRef,j.itemMap])}return[{Provider:m,Slot:y,ItemSlot:P},T,i]}var k2=u.createContext(void 0);function Ao(r){const a=u.useContext(k2);return r||a||"ltr"}var Wd="rovingFocusGroup.onEntryFocus",E2={bubbles:!1,cancelable:!0},Gl="RovingFocusGroup",[du,s0,P2]=Bu(Gl),[T2,r0]=vn(Gl,[P2]),[R2,I2]=T2(Gl),n0=u.forwardRef((r,a)=>e.jsx(du.Provider,{scope:r.__scopeRovingFocusGroup,children:e.jsx(du.Slot,{scope:r.__scopeRovingFocusGroup,children:e.jsx(_2,{...r,ref:a})})}));n0.displayName=Gl;var _2=u.forwardRef((r,a)=>{const{__scopeRovingFocusGroup:l,orientation:i,loop:c=!1,dir:d,currentTabStopId:m,defaultCurrentTabStopId:f,onCurrentTabStopIdChange:p,onEntryFocus:y,preventScrollOnEntryFocus:g=!1,...v}=r,k=u.useRef(null),P=it(a,k),T=Ao(d),[N,j]=Qn({prop:m,defaultProp:f??null,onChange:p,caller:Gl}),[C,E]=u.useState(!1),b=mn(y),R=s0(l),G=u.useRef(!1),[X,L]=u.useState(0);return u.useEffect(()=>{const I=k.current;if(I)return I.addEventListener(Wd,b),()=>I.removeEventListener(Wd,b)},[b]),e.jsx(R2,{scope:l,orientation:i,dir:T,loop:c,currentTabStopId:N,onItemFocus:u.useCallback(I=>j(I),[j]),onItemShiftTab:u.useCallback(()=>E(!0),[]),onFocusableItemAdd:u.useCallback(()=>L(I=>I+1),[]),onFocusableItemRemove:u.useCallback(()=>L(I=>I-1),[]),children:e.jsx(Je.div,{tabIndex:C||X===0?-1:0,"data-orientation":i,...v,ref:P,style:{outline:"none",...r.style},onMouseDown:Ye(r.onMouseDown,()=>{G.current=!0}),onFocus:Ye(r.onFocus,I=>{const w=!G.current;if(I.target===I.currentTarget&&w&&!C){const V=new CustomEvent(Wd,E2);if(I.currentTarget.dispatchEvent(V),!V.defaultPrevented){const te=R().filter(Q=>Q.focusable),ie=te.find(Q=>Q.active),Y=te.find(Q=>Q.id===N),_=[ie,Y,...te].filter(Boolean).map(Q=>Q.ref.current);i0(_,g)}}G.current=!1}),onBlur:Ye(r.onBlur,()=>E(!1))})})}),a0="RovingFocusGroupItem",l0=u.forwardRef((r,a)=>{const{__scopeRovingFocusGroup:l,focusable:i=!0,active:c=!1,tabStopId:d,children:m,...f}=r,p=un(),y=d||p,g=I2(a0,l),v=g.currentTabStopId===y,k=s0(l),{onFocusableItemAdd:P,onFocusableItemRemove:T,currentTabStopId:N}=g;return u.useEffect(()=>{if(i)return P(),()=>T()},[i,P,T]),e.jsx(du.ItemSlot,{scope:l,id:y,focusable:i,active:c,children:e.jsx(Je.span,{tabIndex:v?0:-1,"data-orientation":g.orientation,...f,ref:a,onMouseDown:Ye(r.onMouseDown,j=>{i?g.onItemFocus(y):j.preventDefault()}),onFocus:Ye(r.onFocus,()=>g.onItemFocus(y)),onKeyDown:Ye(r.onKeyDown,j=>{if(j.key==="Tab"&&j.shiftKey){g.onItemShiftTab();return}if(j.target!==j.currentTarget)return;const C=D2(j,g.orientation,g.dir);if(C!==void 0){if(j.metaKey||j.ctrlKey||j.altKey||j.shiftKey)return;j.preventDefault();let b=k().filter(R=>R.focusable).map(R=>R.ref.current);if(C==="last")b.reverse();else if(C==="prev"||C==="next"){C==="prev"&&b.reverse();const R=b.indexOf(j.currentTarget);b=g.loop?L2(b,R+1):b.slice(R+1)}setTimeout(()=>i0(b))}}),children:typeof m=="function"?m({isCurrentTabStop:v,hasTabStop:N!=null}):m})})});l0.displayName=a0;var M2={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function A2(r,a){return a!=="rtl"?r:r==="ArrowLeft"?"ArrowRight":r==="ArrowRight"?"ArrowLeft":r}function D2(r,a,l){const i=A2(r.key,l);if(!(a==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(a==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return M2[i]}function i0(r,a=!1){const l=document.activeElement;for(const i of r)if(i===l||(i.focus({preventScroll:a}),document.activeElement!==l))return}function L2(r,a){return r.map((l,i)=>r[(a+i)%r.length])}var O2=n0,F2=l0,Do="Tabs",[z2]=vn(Do,[r0]),o0=r0(),[$2,Uu]=z2(Do),c0=u.forwardRef((r,a)=>{const{__scopeTabs:l,value:i,onValueChange:c,defaultValue:d,orientation:m="horizontal",dir:f,activationMode:p="automatic",...y}=r,g=Ao(f),[v,k]=Qn({prop:i,onChange:c,defaultProp:d??"",caller:Do});return e.jsx($2,{scope:l,baseId:un(),value:v,onValueChange:k,orientation:m,dir:g,activationMode:p,children:e.jsx(Je.div,{dir:g,"data-orientation":m,...y,ref:a})})});c0.displayName=Do;var d0="TabsList",u0=u.forwardRef((r,a)=>{const{__scopeTabs:l,loop:i=!0,...c}=r,d=Uu(d0,l),m=o0(l);return e.jsx(O2,{asChild:!0,...m,orientation:d.orientation,dir:d.dir,loop:i,children:e.jsx(Je.div,{role:"tablist","aria-orientation":d.orientation,...c,ref:a})})});u0.displayName=d0;var h0="TabsTrigger",m0=u.forwardRef((r,a)=>{const{__scopeTabs:l,value:i,disabled:c=!1,...d}=r,m=Uu(h0,l),f=o0(l),p=p0(m.baseId,i),y=g0(m.baseId,i),g=i===m.value;return e.jsx(F2,{asChild:!0,...f,focusable:!c,active:g,children:e.jsx(Je.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":y,"data-state":g?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:p,...d,ref:a,onMouseDown:Ye(r.onMouseDown,v=>{!c&&v.button===0&&v.ctrlKey===!1?m.onValueChange(i):v.preventDefault()}),onKeyDown:Ye(r.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&m.onValueChange(i)}),onFocus:Ye(r.onFocus,()=>{const v=m.activationMode!=="manual";!g&&!c&&v&&m.onValueChange(i)})})})});m0.displayName=h0;var f0="TabsContent",x0=u.forwardRef((r,a)=>{const{__scopeTabs:l,value:i,forceMount:c,children:d,...m}=r,f=Uu(f0,l),p=p0(f.baseId,i),y=g0(f.baseId,i),g=i===f.value,v=u.useRef(g);return u.useEffect(()=>{const k=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(k)},[]),e.jsx(Kl,{present:c||g,children:({present:k})=>e.jsx(Je.div,{"data-state":g?"active":"inactive","data-orientation":f.orientation,role:"tabpanel","aria-labelledby":p,hidden:!k,id:y,tabIndex:0,...m,ref:a,style:{...r.style,animationDuration:v.current?"0s":void 0},children:k&&d})})});x0.displayName=f0;function p0(r,a){return`${r}-trigger-${a}`}function g0(r,a){return`${r}-content-${a}`}var B2=c0,y0=u0,v0=m0,b0=x0;const Yl=B2,Ga=u.forwardRef(({className:r,...a},l)=>e.jsx(y0,{ref:l,className:ot("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",r),...a}));Ga.displayName=y0.displayName;const Ft=u.forwardRef(({className:r,...a},l)=>e.jsx(v0,{ref:l,className:ot("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",r),...a}));Ft.displayName=v0.displayName;const zt=u.forwardRef(({className:r,...a},l)=>e.jsx(b0,{ref:l,className:ot("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",r),...a}));zt.displayName=b0.displayName;function Vu(r){const a=u.useRef({value:r,previous:r});return u.useMemo(()=>(a.current.value!==r&&(a.current.previous=a.current.value,a.current.value=r),a.current.previous),[r])}function Wu(r){const[a,l]=u.useState(void 0);return ts(()=>{if(r){l({width:r.offsetWidth,height:r.offsetHeight});const i=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const d=c[0];let m,f;if("borderBoxSize"in d){const p=d.borderBoxSize,y=Array.isArray(p)?p[0]:p;m=y.inlineSize,f=y.blockSize}else m=r.offsetWidth,f=r.offsetHeight;l({width:m,height:f})});return i.observe(r,{box:"border-box"}),()=>i.unobserve(r)}else l(void 0)},[r]),a}var Lo="Switch",[U2]=vn(Lo),[V2,W2]=U2(Lo),j0=u.forwardRef((r,a)=>{const{__scopeSwitch:l,name:i,checked:c,defaultChecked:d,required:m,disabled:f,value:p="on",onCheckedChange:y,form:g,...v}=r,[k,P]=u.useState(null),T=it(a,b=>P(b)),N=u.useRef(!1),j=k?g||!!k.closest("form"):!0,[C,E]=Qn({prop:c,defaultProp:d??!1,onChange:y,caller:Lo});return e.jsxs(V2,{scope:l,checked:C,disabled:f,children:[e.jsx(Je.button,{type:"button",role:"switch","aria-checked":C,"aria-required":m,"data-state":C0(C),"data-disabled":f?"":void 0,disabled:f,value:p,...v,ref:T,onClick:Ye(r.onClick,b=>{E(R=>!R),j&&(N.current=b.isPropagationStopped(),N.current||b.stopPropagation())})}),j&&e.jsx(S0,{control:k,bubbles:!N.current,name:i,value:p,checked:C,required:m,disabled:f,form:g,style:{transform:"translateX(-100%)"}})]})});j0.displayName=Lo;var N0="SwitchThumb",w0=u.forwardRef((r,a)=>{const{__scopeSwitch:l,...i}=r,c=W2(N0,l);return e.jsx(Je.span,{"data-state":C0(c.checked),"data-disabled":c.disabled?"":void 0,...i,ref:a})});w0.displayName=N0;var H2="SwitchBubbleInput",S0=u.forwardRef(({__scopeSwitch:r,control:a,checked:l,bubbles:i=!0,...c},d)=>{const m=u.useRef(null),f=it(m,d),p=Vu(l),y=Wu(a);return u.useEffect(()=>{const g=m.current;if(!g)return;const v=window.HTMLInputElement.prototype,P=Object.getOwnPropertyDescriptor(v,"checked").set;if(p!==l&&P){const T=new Event("click",{bubbles:i});P.call(g,l),g.dispatchEvent(T)}},[p,l,i]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:l,...c,tabIndex:-1,ref:f,style:{...c.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});S0.displayName=H2;function C0(r){return r?"checked":"unchecked"}var k0=j0,K2=w0;const dt=u.forwardRef(({className:r,...a},l)=>e.jsx(k0,{className:ot("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 focus-visible:ring-offset-[#0a1628] disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-gray-600 data-[state=checked]:bg-[#38bdac]",r),...a,ref:l,children:e.jsx(K2,{className:ot("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));dt.displayName=k0.displayName;const Xn=u.forwardRef(({className:r,...a},l)=>e.jsx("textarea",{className:ot("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:l,...a}));Xn.displayName="Textarea";function E0({open:r,onClose:a,userId:l,onUserUpdated:i}){var $e;const[c,d]=u.useState(null),[m,f]=u.useState([]),[p,y]=u.useState([]),[g,v]=u.useState(!1),[k,P]=u.useState(!1),[T,N]=u.useState(!1),[j,C]=u.useState("info"),[E,b]=u.useState(""),[R,G]=u.useState(""),[X,L]=u.useState([]),[I,w]=u.useState(""),[V,te]=u.useState(!1),[ie,Y]=u.useState(null),[ne,_]=u.useState(null),[Q,ue]=u.useState(""),[O,re]=u.useState(""),[H,A]=u.useState(""),[$,z]=u.useState(!1),[ee,K]=u.useState(null),[de,q]=u.useState("");u.useEffect(()=>{r&&l&&(C("info"),Y(null),_(null),K(null),q(""),ye())},[r,l]);async function ye(){if(l){v(!0);try{const me=await Le(`/api/db/users?id=${encodeURIComponent(l)}`);if(me!=null&&me.success&&me.user){const pe=me.user;d(pe),b(pe.phone||""),G(pe.nickname||""),ue(pe.phone||""),re(pe.wechatId||""),A(pe.openId||"");try{L(typeof pe.tags=="string"?JSON.parse(pe.tags||"[]"):[])}catch{L([])}}try{const pe=await Le(`/api/user/track?userId=${encodeURIComponent(l)}&limit=50`);pe!=null&&pe.success&&pe.tracks&&f(pe.tracks)}catch{f([])}try{const pe=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(l)}`);pe!=null&&pe.success&&pe.referrals&&y(pe.referrals)}catch{y([])}}catch(me){console.error("Load user detail error:",me)}finally{v(!1)}}}async function Ce(){if(!(c!=null&&c.phone)){alert("用户未绑定手机号,无法同步");return}P(!0);try{const me=await ut("/api/ckb/sync",{action:"full_sync",phone:c.phone,userId:c.id});me!=null&&me.success?(alert("同步成功"),ye()):alert("同步失败: "+(me==null?void 0:me.error))}catch(me){console.error("Sync CKB error:",me),alert("同步失败")}finally{P(!1)}}async function F(){if(c){N(!0);try{const me={id:c.id,phone:E||void 0,nickname:R||void 0,tags:JSON.stringify(X)},pe=await yt("/api/db/users",me);pe!=null&&pe.success?(alert("保存成功"),ye(),i==null||i()):alert("保存失败: "+(pe==null?void 0:pe.error))}catch(me){console.error("Save user error:",me),alert("保存失败")}finally{N(!1)}}}const xe=()=>{I&&!X.includes(I)&&(L([...X,I]),w(""))},Pe=me=>L(X.filter(pe=>pe!==me));async function Ve(){if(!Q&&!H&&!O){_("请至少输入手机号、微信号或 OpenID 中的一项");return}te(!0),_(null),Y(null);try{const me=new URLSearchParams;Q&&me.set("phone",Q),H&&me.set("openId",H),O&&me.set("wechatId",O);const pe=await Le(`/api/admin/shensheshou/query?${me}`);pe!=null&&pe.success&&pe.data?(Y(pe.data),c&&await He(pe.data)):_((pe==null?void 0:pe.error)||"未查询到数据,该用户可能未在神射手收录")}catch(me){console.error("SSS query error:",me),_("请求失败,请检查神射手接口配置")}finally{te(!1)}}async function He(me){if(c)try{await ut("/api/admin/shensheshou/enrich",{userId:c.id,phone:Q||c.phone||"",openId:H||c.openId||"",wechatId:O||c.wechatId||""}),ye()}catch(pe){console.error("SSS enrich error:",pe)}}async function Ke(){if(c){z(!0),K(null);try{const me={users:[{phone:c.phone||"",name:c.nickname||"",openId:c.openId||"",tags:X}]},pe=await ut("/api/admin/shensheshou/ingest",me);pe!=null&&pe.success&&pe.data?K(pe.data):K({error:(pe==null?void 0:pe.error)||"推送失败"})}catch(me){console.error("SSS ingest error:",me),K({error:"请求失败"})}finally{z(!1)}}}const tt=me=>{const ft={view_chapter:Fs,purchase:au,match:Yt,login:Oa,register:Oa,share:Sr,bind_phone:rN,bind_wechat:Qj,fill_profile:Ad,visit_page:Da}[me]||su;return e.jsx(ft,{className:"w-4 h-4"})};return r?e.jsx(Ct,{open:r,onOpenChange:()=>a(),children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[e.jsx(Oa,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(c==null?void 0:c.phone)&&e.jsx(Oe,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(c==null?void 0:c.isVip)&&e.jsx(Oe,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),g?e.jsxs("div",{className:"flex items-center justify-center py-20",children:[e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):c?e.jsxs("div",{className:"flex flex-col h-[75vh]",children:[e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-3",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac] shrink-0",children:c.avatar?e.jsx("img",{src:c.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):(($e=c.nickname)==null?void 0:$e.charAt(0))||"?"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:c.nickname}),c.isAdmin&&e.jsx(Oe,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),c.hasFullBook&&e.jsx(Oe,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),c.vipRole&&e.jsx(Oe,{className:"bg-amber-500/20 text-amber-400 border-0",children:c.vipRole})]}),e.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[c.phone?`📱 ${c.phone}`:"未绑定手机",c.wechatId&&` · 💬 ${c.wechatId}`,c.mbti&&` · ${c.mbti}`]}),e.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[e.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",c.id.slice(0,16),"…"]}),c.referralCode&&e.jsxs("p",{className:"text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"推广码:"}),e.jsx("code",{className:"text-[#38bdac] bg-[#38bdac]/10 px-1.5 py-0.5 rounded",children:c.referralCode})]})]})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(c.earnings||0).toFixed(2)]}),e.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),e.jsxs(Yl,{value:j,onValueChange:C,className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs(Ga,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[e.jsx(Ft,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),e.jsx(Ft,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),e.jsxs(Ft,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[e.jsx(Da,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),e.jsx(Ft,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),e.jsxs(Ft,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[e.jsx(on,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),e.jsxs(zt,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"手机号"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:E,onChange:me=>b(me.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"昵称"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:R,onChange:me=>G(me.target.value)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[c.openId&&e.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[e.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"微信 OpenID"}),e.jsx("p",{className:"text-gray-300 font-mono text-xs break-all",children:c.openId})]}),c.region&&e.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[e.jsx(ap,{className:"w-4 h-4 text-gray-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500 text-xs",children:"地区"}),e.jsx("p",{className:"text-white",children:c.region})]})]}),c.industry&&e.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[e.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"行业"}),e.jsx("p",{className:"text-white",children:c.industry})]}),c.position&&e.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[e.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"职位"}),e.jsx("p",{className:"text-white",children:c.position})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),e.jsx("p",{className:"text-2xl font-bold text-white",children:c.referralCount??0})]}),e.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),e.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(c.pendingEarnings??0).toFixed(2)]})]}),e.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),e.jsx("p",{className:"text-sm text-white",children:c.createdAt?new Date(c.createdAt).toLocaleDateString():"-"})]})]}),c.isVip&&e.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(an,{className:"w-4 h-4 text-amber-400"}),e.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),e.jsx(Oe,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:c.vipRole||"VIP"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[c.vipName&&e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"展示名:"}),e.jsx("span",{className:"text-white",children:c.vipName})]}),c.vipProject&&e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"项目:"}),e.jsx("span",{className:"text-white",children:c.vipProject})]}),c.vipContact&&e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"联系方式:"}),e.jsx("span",{className:"text-white",children:c.vipContact})]}),c.vipExpireDate&&e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"到期时间:"}),e.jsx("span",{className:"text-white",children:new Date(c.vipExpireDate).toLocaleDateString()})]})]}),c.vipBio&&e.jsx("p",{className:"text-gray-400 text-sm mt-2",children:c.vipBio})]}),e.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-purple-500/20",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(Ul,{className:"w-4 h-4 text-purple-400"}),e.jsx("span",{className:"text-white font-medium",children:"微信归属"}),e.jsx("span",{className:"text-gray-500 text-xs",children:"该用户归属在哪个微信号下"})]}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:de,onChange:me=>q(me.target.value)}),e.jsxs(Z,{size:"sm",onClick:async()=>{if(!(!de||!c))try{await yt("/api/db/users",{id:c.id,wechatId:de}),alert("已保存微信归属"),ye()}catch{alert("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[e.jsx(It,{className:"w-4 h-4 mr-1"})," 保存"]})]}),c.wechatId&&e.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",e.jsx("span",{className:"text-purple-400",children:c.wechatId})]})]}),e.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Sr,{className:"w-4 h-4 text-[#38bdac]"}),e.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),e.jsx(Z,{size:"sm",onClick:Ce,disabled:k||!c.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:k?e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"同步状态:"}),c.ckbSyncedAt?e.jsx(Oe,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):e.jsx(Oe,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"最后同步:"}),e.jsx("span",{className:"text-gray-300 ml-1",children:c.ckbSyncedAt?new Date(c.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),e.jsxs(zt,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:[e.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(Ad,{className:"w-4 h-4 text-[#38bdac]"}),e.jsx("span",{className:"text-white font-medium",children:"用户标签"}),e.jsx("span",{className:"text-gray-500 text-xs",children:"基于《一场 Soul 的创业实验》维度打标"})]}),e.jsxs("div",{className:"mb-3 p-2.5 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-center gap-2 text-xs text-gray-400",children:[e.jsx(tu,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),"命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消"]}),e.jsx("div",{className:"mb-4 space-y-3",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(me=>e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:me.category}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:me.tags.map(pe=>e.jsxs("button",{type:"button",onClick:()=>{X.includes(pe)?Pe(pe):L([...X,pe])},className:`px-2 py-0.5 rounded text-xs border transition-all ${X.includes(pe)?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-transparent border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300"}`,children:[X.includes(pe)?"✓ ":"",pe]},pe))})]},me.category))}),e.jsxs("div",{className:"border-t border-gray-700/50 pt-3",children:[e.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"已选标签"}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 min-h-[32px]",children:[X.map((me,pe)=>e.jsxs(Oe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[me,e.jsx("button",{type:"button",onClick:()=>Pe(me),className:"ml-1 hover:text-red-400",children:e.jsx(xs,{className:"w-3 h-3"})})]},pe)),X.length===0&&e.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:I,onChange:me=>w(me.target.value),onKeyDown:me=>me.key==="Enter"&&xe()}),e.jsx(Z,{onClick:xe,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),c.ckbTags&&e.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Ad,{className:"w-4 h-4 text-purple-400"}),e.jsx("span",{className:"text-white font-medium",children:"存客宝标签"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:(typeof c.ckbTags=="string"?c.ckbTags.split(","):[]).map((me,pe)=>e.jsx(Oe,{className:"bg-purple-500/20 text-purple-400 border-0",children:me.trim()},pe))})]})]}),e.jsxs(zt,{value:"journey",className:"flex-1 overflow-auto",children:[e.jsxs("div",{className:"mb-3 p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[e.jsx(Da,{className:"w-4 h-4 text-[#38bdac]"}),e.jsxs("span",{className:"text-gray-400 text-sm",children:["记录用户从注册到付费的完整行动路径,共 ",m.length," 条记录"]})]}),e.jsx("div",{className:"space-y-2",children:m.length>0?m.map((me,pe)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:tt(me.action)}),pe0?p.map((me,pe)=>{var ss;const ft=me;return e.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((ss=ft.nickname)==null?void 0:ss.charAt(0))||"?"}),e.jsx("span",{className:"text-white text-sm",children:ft.nickname})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[ft.status==="vip"&&e.jsx(Oe,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),e.jsx("span",{className:"text-gray-500 text-xs",children:ft.createdAt?new Date(ft.createdAt).toLocaleDateString():""})]})]},ft.id||pe)}):e.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),e.jsxs(zt,{value:"shensheshou",className:"flex-1 overflow-auto space-y-4",children:[e.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(on,{className:"w-5 h-5 text-[#38bdac]"}),e.jsx("span",{className:"text-white font-medium",children:"用户资料完善"}),e.jsx("span",{className:"text-gray-500 text-xs",children:"通过多维度查询神射手数据,自动回填用户基础信息"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[e.jsxs("div",{children:[e.jsx(se,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),e.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:Q,onChange:me=>ue(me.target.value)})]}),e.jsxs("div",{children:[e.jsx(se,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),e.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:O,onChange:me=>re(me.target.value)})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(se,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),e.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:H,onChange:me=>A(me.target.value)})]})]}),e.jsx(Z,{onClick:Ve,disabled:V,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:V?e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(dn,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),e.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),ne&&e.jsx("div",{className:"mt-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400 text-sm",children:ne}),ie&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[e.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"神射手 RFM 分"}),e.jsx("p",{className:"text-2xl font-bold text-[#38bdac]",children:ie.rfm_score??"-"})]}),e.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[e.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"用户等级"}),e.jsx("p",{className:"text-2xl font-bold text-white",children:ie.user_level??"-"})]})]}),ie.tags&&ie.tags.length>0&&e.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[e.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"神射手标签"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ie.tags.map((me,pe)=>e.jsx(Oe,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:me},pe))})]}),ie.last_active&&e.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",ie.last_active]})]})]}),e.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(on,{className:"w-4 h-4 text-purple-400"}),e.jsx("span",{className:"text-white font-medium",children:"推送用户数据到神射手"})]}),e.jsx("p",{className:"text-gray-500 text-xs",children:"将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像"})]}),e.jsx(Z,{onClick:Ke,disabled:$||!c.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:$?e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):e.jsxs(e.Fragment,{children:[e.jsx(on,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!c.phone&&e.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),ee&&e.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:ee.error?e.jsx("p",{className:"text-red-400",children:String(ee.error)}):e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[e.jsx(tu,{className:"w-4 h-4"})," 推送成功"]}),ee.enriched!==void 0&&e.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(ee.new_tags_added??0)]})]})})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3",children:[e.jsxs(Z,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(xs,{className:"w-4 h-4 mr-2"}),"关闭"]}),e.jsxs(Z,{onClick:F,disabled:T,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),T?"保存中...":"保存修改"]})]})]}):e.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}const Hd={isVip:!1,vipExpireDate:"",vipSort:"",vipRole:"",vipRoleCustom:"",vipName:"",vipProject:"",vipContact:"",vipBio:""};function G2({open:r,onClose:a,userId:l,userNickname:i="",onSaved:c}){const[d,m]=u.useState(Hd),[f,p]=u.useState([]),[y,g]=u.useState(!1),[v,k]=u.useState(!1);u.useEffect(()=>{if(!r){m(Hd);return}let T=!1;return g(!0),Promise.all([Le("/api/db/vip-roles"),l?Le(`/api/db/users?id=${encodeURIComponent(l)}`):Promise.resolve(null)]).then(([N,j])=>{if(T)return;const C=N!=null&&N.success&&N.data?N.data:[];p(C);const E=j&&j.user?j.user:null;if(E){const b=String(E.vipRole??""),R=C.some(G=>G.name===b);m({isVip:!!(E.isVip??!1),vipExpireDate:E.vipExpireDate?String(E.vipExpireDate).slice(0,10):"",vipSort:typeof E.vipSort=="number"?E.vipSort:"",vipRole:R?b:b?"__custom__":"",vipRoleCustom:R?"":b,vipName:String(E.vipName??""),vipProject:String(E.vipProject??""),vipContact:String(E.vipContact??""),vipBio:String(E.vipBio??"")})}else m(Hd)}).catch(N=>{T||console.error("Load error:",N)}).finally(()=>{T||g(!1)}),()=>{T=!0}},[r,l]);async function P(){if(l){if(d.isVip&&!d.vipExpireDate.trim()){alert("开启 VIP 时请填写有效到期日");return}if(d.isVip&&d.vipExpireDate.trim()){const T=new Date(d.vipExpireDate);if(isNaN(T.getTime())){alert("到期日格式无效,请使用 YYYY-MM-DD");return}}k(!0);try{const T=d.vipRole==="__custom__"?d.vipRoleCustom.trim():d.vipRole,N={id:l,isVip:d.isVip,vipExpireDate:d.isVip?d.vipExpireDate:void 0,vipSort:d.vipSort===""?void 0:d.vipSort,vipRole:T||void 0,vipName:d.vipName||void 0,vipProject:d.vipProject||void 0,vipContact:d.vipContact||void 0,vipBio:d.vipBio||void 0},j=await yt("/api/db/users",N);j!=null&&j.success?(alert("VIP 设置已保存"),c==null||c(),a()):alert("保存失败: "+(j==null?void 0:j.error))}catch(T){console.error("Save VIP error:",T),alert("保存失败")}finally{k(!1)}}}return r?e.jsx(Ct,{open:r,onOpenChange:()=>a(),children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[e.jsx(an,{className:"w-5 h-5 text-amber-400"}),"设置 VIP - ",i||l]})}),y?e.jsx("div",{className:"py-8 text-center text-gray-400",children:"加载中..."}):e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(se,{className:"text-gray-300",children:"VIP 会员"}),e.jsx(dt,{checked:d.isVip,onCheckedChange:T=>m(N=>({...N,isVip:T}))})]}),d.isVip&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{className:"text-gray-300",children:["到期日 (YYYY-MM-DD) ",e.jsx("span",{className:"text-amber-400",children:"*"})]}),e.jsx(ce,{type:"date",className:"bg-[#0a1628] border-gray-700 text-white",value:d.vipExpireDate,onChange:T=>m(N=>({...N,vipExpireDate:T.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"排序"}),e.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"数字越小越靠前,留空按时间",value:d.vipSort===""?"":d.vipSort,onChange:T=>{const N=T.target.value;m(j=>({...j,vipSort:N===""?"":parseInt(N,10)||0}))}})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"角色"}),e.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md px-3 py-2",value:d.vipRole,onChange:T=>m(N=>({...N,vipRole:T.target.value})),children:[e.jsx("option",{value:"",children:"请选择或下方手动填写"}),f.map(T=>e.jsx("option",{value:T.name,children:T.name},T.id)),e.jsx("option",{value:"__custom__",children:"其他(手动填写)"})]}),d.vipRole==="__custom__"&&e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"输入自定义角色",value:d.vipRoleCustom,onChange:T=>m(N=>({...N,vipRoleCustom:T.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"VIP 展示名"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"创业老板排行展示名",value:d.vipName,onChange:T=>m(N=>({...N,vipName:T.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"项目/公司"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"项目名称",value:d.vipProject,onChange:T=>m(N=>({...N,vipProject:T.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"联系方式"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"微信号或手机",value:d.vipContact,onChange:T=>m(N=>({...N,vipContact:T.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"一句话简介"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"简要描述业务",value:d.vipBio,onChange:T=>m(N=>({...N,vipBio:T.target.value}))})]})]}),e.jsxs(Ot,{children:[e.jsxs(Z,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(xs,{className:"w-4 h-4 mr-2"}),"取消"]}),e.jsxs(Z,{onClick:P,disabled:v||y,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存"]})]})]})}):null}const io=[{id:"register",label:"注册/登录",icon:"👤",color:"bg-blue-500/20 border-blue-500/40 text-blue-400",desc:"微信授权登录或手机号注册"},{id:"browse",label:"浏览章节",icon:"📖",color:"bg-purple-500/20 border-purple-500/40 text-purple-400",desc:"点击免费/付费章节预览"},{id:"bind_phone",label:"绑定手机",icon:"📱",color:"bg-cyan-500/20 border-cyan-500/40 text-cyan-400",desc:"触发付费章节后绑定手机"},{id:"first_pay",label:"首次付款",icon:"💳",color:"bg-green-500/20 border-green-500/40 text-green-400",desc:"购买单章或全书"},{id:"fill_profile",label:"完善资料",icon:"✍️",color:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400",desc:"填写头像、MBTI、行业等"},{id:"match",label:"派对房匹配",icon:"🤝",color:"bg-orange-500/20 border-orange-500/40 text-orange-400",desc:"参与 Soul 派对房"},{id:"vip",label:"升级 VIP",icon:"👑",color:"bg-amber-500/20 border-amber-500/40 text-amber-400",desc:"付款 ¥1980 购买全书"},{id:"distribution",label:"开启分销",icon:"🔗",color:"bg-[#38bdac]/20 border-[#38bdac]/40 text-[#38bdac]",desc:"生成推广码并推荐好友"}];function Y2(){var Tn,Rn,la,In,_n;const[r,a]=Xx(),l=r.get("pool"),[i,c]=u.useState([]),[d,m]=u.useState(0),[f,p]=u.useState(1),[y,g]=u.useState(10),[v,k]=u.useState(""),P=$u(v,300),T=l==="vip"?"vip":l==="complete"?"complete":"all",[N,j]=u.useState(T),[C,E]=u.useState(!0),[b,R]=u.useState(null),[G,X]=u.useState(!1),[L,I]=u.useState("desc");u.useEffect(()=>{l==="vip"?j("vip"):l==="complete"?j("complete"):l==="all"&&j("all")},[l]);const[w,V]=u.useState(!1),[te,ie]=u.useState(!1),[Y,ne]=u.useState(null),[_,Q]=u.useState(""),[ue,O]=u.useState(""),[re,H]=u.useState(!1),[A,$]=u.useState(!1),[z,ee]=u.useState({referrals:[],stats:{}}),[K,de]=u.useState(!1),[q,ye]=u.useState(null),[Ce,F]=u.useState(!1),[xe,Pe]=u.useState(null),[Ve,He]=u.useState(!1),[Ke,tt]=u.useState(null),[$e,me]=u.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[pe,ft]=u.useState([]),[ss,ur]=u.useState(!1),[Nn,zs]=u.useState(!1),[vs,Tr]=u.useState(null),[_t,rs]=u.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[wn,Xs]=u.useState([]),[ns,Sn]=u.useState(!1),[ta,Es]=u.useState(!1),[Rr,Js]=u.useState(null),[Nt,Ps]=u.useState({name:"",sort:0}),[bs,Zs]=u.useState({}),[os,Ts]=u.useState(!1);async function Pt(){var U;E(!0),R(null);try{if(G){const We=new URLSearchParams({search:P,limit:String(y*5)}),Ge=await Le(`/api/db/users/rfm?${We}`);if(Ge!=null&&Ge.success){let Vt=Ge.users||[];L==="asc"&&(Vt=[...Vt].reverse());const lt=(f-1)*y;c(Vt.slice(lt,lt+y)),m(((U=Ge.users)==null?void 0:U.length)??0),Vt.length===0&&(X(!1),R("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else X(!1),R((Ge==null?void 0:Ge.error)||"RFM 加载失败,已切回普通模式")}else{const We=new URLSearchParams({page:String(f),pageSize:String(y),search:P,...N==="vip"&&{vip:"true"},...N==="complete"&&{pool:"complete"}}),Ge=await Le(`/api/db/users?${We}`);Ge!=null&&Ge.success?(c(Ge.users||[]),m(Ge.total??0)):R((Ge==null?void 0:Ge.error)||"加载失败")}}catch(We){console.error("Load users error:",We),R("网络错误")}finally{E(!1)}}u.useEffect(()=>{p(1)},[P,N,G]),u.useEffect(()=>{Pt()},[f,y,P,N,G,L]);const sa=Math.ceil(d/y)||1,ra=()=>{G?L==="desc"?I("asc"):(X(!1),I("desc")):(X(!0),I("desc"))},na=U=>({S:"bg-amber-500/20 text-amber-400",A:"bg-green-500/20 text-green-400",B:"bg-blue-500/20 text-blue-400",C:"bg-gray-500/20 text-gray-400",D:"bg-red-500/20 text-red-400"})[U||""]||"bg-gray-500/20 text-gray-400";async function Cn(U){if(confirm("确定要删除这个用户吗?"))try{const We=await Cr(`/api/db/users?id=${encodeURIComponent(U)}`);We!=null&&We.success?Pt():alert("删除失败: "+((We==null?void 0:We.error)||""))}catch{alert("删除失败")}}const kn=U=>{ne(U),me({phone:U.phone||"",nickname:U.nickname||"",password:"",isAdmin:!!(U.isAdmin??!1),hasFullBook:!!(U.hasFullBook??!1)}),V(!0)},En=()=>{ne(null),me({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),V(!0)};async function hr(){if(!$e.phone||!$e.nickname){alert("请填写手机号和昵称");return}H(!0);try{if(Y){const U=await yt("/api/db/users",{id:Y.id,nickname:$e.nickname,isAdmin:$e.isAdmin,hasFullBook:$e.hasFullBook,...$e.password&&{password:$e.password}});if(!(U!=null&&U.success)){alert("更新失败: "+((U==null?void 0:U.error)||""));return}}else{const U=await ut("/api/db/users",{phone:$e.phone,nickname:$e.nickname,password:$e.password,isAdmin:$e.isAdmin});if(!(U!=null&&U.success)){alert("创建失败: "+((U==null?void 0:U.error)||""));return}}V(!1),Pt()}catch{alert("保存失败")}finally{H(!1)}}const Ir=U=>{ne(U),Q(""),O(""),ie(!0)};async function er(U){ye(U),$(!0),de(!0);try{const We=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(U.id)}`);We!=null&&We.success?ee({referrals:We.referrals||[],stats:We.stats||{}}):ee({referrals:[],stats:{}})}catch{ee({referrals:[],stats:{}})}finally{de(!1)}}async function aa(){if(!_){alert("请输入新密码");return}if(_!==ue){alert("两次密码不一致");return}if(_.length<6){alert("密码至少6位");return}H(!0);try{const U=await yt("/api/db/users",{id:Y==null?void 0:Y.id,password:_});U!=null&&U.success?(alert("修改成功"),ie(!1)):alert("修改失败: "+((U==null?void 0:U.error)||""))}catch{alert("修改失败")}finally{H(!1)}}const as=u.useCallback(async()=>{ur(!0);try{const U=await Le("/api/db/user-rules");U!=null&&U.success&&ft(U.rules||[])}catch{}finally{ur(!1)}},[]);async function _r(){if(!_t.title){alert("请填写规则标题");return}H(!0);try{if(vs){const U=await yt("/api/db/user-rules",{id:vs.id,..._t});if(!(U!=null&&U.success)){alert("更新失败: "+((U==null?void 0:U.error)||""));return}}else{const U=await ut("/api/db/user-rules",_t);if(!(U!=null&&U.success)){alert("创建失败: "+((U==null?void 0:U.error)||""));return}}zs(!1),as()}catch{alert("保存失败")}finally{H(!1)}}async function Mr(U){if(confirm("确定删除?"))try{const We=await Cr(`/api/db/user-rules?id=${U}`);We!=null&&We.success&&as()}catch{}}async function Pn(U){try{await yt("/api/db/user-rules",{id:U.id,enabled:!U.enabled}),as()}catch{}}const Ar=u.useCallback(async()=>{Sn(!0);try{const U=await Le("/api/db/vip-roles");U!=null&&U.success&&Xs(U.roles||[])}catch{}finally{Sn(!1)}},[]);async function Ja(){if(!Nt.name){alert("请填写角色名称");return}H(!0);try{if(Rr){const U=await yt("/api/db/vip-roles",{id:Rr.id,...Nt});if(!(U!=null&&U.success)){alert("更新失败");return}}else{const U=await ut("/api/db/vip-roles",Nt);if(!(U!=null&&U.success)){alert("创建失败");return}}Es(!1),Ar()}catch{alert("保存失败")}finally{H(!1)}}async function Za(U){if(confirm("确定删除?"))try{const We=await Cr(`/api/db/vip-roles?id=${U}`);We!=null&&We.success&&Ar()}catch{}}const Rs=u.useCallback(async()=>{Ts(!0);try{const U=await Le("/api/db/users/journey-stats");U!=null&&U.success&&U.stats&&Zs(U.stats)}catch{}finally{Ts(!1)}},[]);return e.jsxs("div",{className:"p-8 w-full",children:[b&&e.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[e.jsx("span",{children:b}),e.jsx("button",{type:"button",onClick:()=>R(null),children:"×"})]}),e.jsx("div",{className:"flex justify-between items-center mb-6",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),e.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",d," 位注册用户",G&&" · RFM 排序中"]})]})}),e.jsxs(Yl,{defaultValue:"users",className:"w-full",children:[e.jsxs(Ga,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[e.jsxs(Ft,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[e.jsx(Yt,{className:"w-4 h-4"})," 用户列表"]}),e.jsxs(Ft,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Rs,children:[e.jsx(Da,{className:"w-4 h-4"})," 用户旅程总览"]}),e.jsxs(Ft,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:as,children:[e.jsx(Yn,{className:"w-4 h-4"})," 规则配置"]}),e.jsxs(Ft,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Ar,children:[e.jsx(an,{className:"w-4 h-4"})," VIP 角色"]})]}),e.jsxs(zt,{value:"users",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[e.jsxs(Z,{variant:"outline",onClick:Pt,disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${C?"animate-spin":""}`})," 刷新"]}),e.jsxs("select",{value:N,onChange:U=>{const We=U.target.value;j(We),p(1),l&&(r.delete("pool"),a(r))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:G,children:[e.jsx("option",{value:"all",children:"全部用户"}),e.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),e.jsx("option",{value:"complete",children:"完善资料用户"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(dn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),e.jsx(ce,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:v,onChange:U=>k(U.target.value)})]}),e.jsxs(Z,{onClick:En,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(lu,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:e.jsx(Se,{className:"p-0",children:C?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):e.jsxs("div",{children:[e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"用户信息"}),e.jsx(je,{className:"text-gray-400",children:"绑定信息"}),e.jsx(je,{className:"text-gray-400",children:"购买状态"}),e.jsx(je,{className:"text-gray-400",children:"分销收益"}),e.jsxs(je,{className:"text-gray-400 cursor-pointer select-none",onClick:ra,children:[e.jsxs("div",{className:"flex items-center gap-1 group",children:[e.jsx(La,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"RFM分值"}),G?L==="desc"?e.jsx(Bl,{className:"w-3.5 h-3.5 text-[#38bdac]"}):e.jsx(Zx,{className:"w-3.5 h-3.5 text-[#38bdac]"}):e.jsx(Hb,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),G&&e.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),e.jsx(je,{className:"text-gray-400",children:"注册时间"}),e.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),e.jsxs(ys,{children:[i.map(U=>{var We,Ge,Vt;return e.jsxs(et,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[e.jsx(ge,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:U.avatar?e.jsx("img",{src:U.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((We=U.nickname)==null?void 0:We.charAt(0))||"?"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("p",{className:"font-medium text-white",children:U.nickname}),U.isAdmin&&e.jsx(Oe,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),U.openId&&!((Ge=U.id)!=null&&Ge.startsWith("user_"))&&e.jsx(Oe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),e.jsx("p",{className:"text-xs text-gray-500 font-mono",children:U.openId?U.openId.slice(0,12)+"...":(Vt=U.id)==null?void 0:Vt.slice(0,12)})]})]})}),e.jsx(ge,{children:e.jsxs("div",{className:"space-y-1",children:[U.phone&&e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"📱"}),e.jsx("span",{className:"text-gray-300",children:U.phone})]}),U.wechatId&&e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"💬"}),e.jsx("span",{className:"text-gray-300",children:U.wechatId})]}),U.openId&&e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"🔗"}),e.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:U.openId,children:[U.openId.slice(0,12),"..."]})]}),!U.phone&&!U.wechatId&&!U.openId&&e.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),e.jsx(ge,{children:U.hasFullBook?e.jsx(Oe,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):e.jsx(Oe,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),e.jsx(ge,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(U.earnings||0)).toFixed(2)]}),parseFloat(String(U.pendingEarnings||0))>0&&e.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(U.pendingEarnings||0)).toFixed(2)]}),e.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>er(U),role:"button",tabIndex:0,onKeyDown:lt=>lt.key==="Enter"&&er(U),children:[e.jsx(Yt,{className:"w-3 h-3"})," 绑定",U.referralCount||0,"人"]})]})}),e.jsx(ge,{children:U.rfmScore!==void 0?e.jsx("div",{className:"flex flex-col gap-1",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-white font-bold text-base",children:U.rfmScore}),e.jsx(Oe,{className:`border-0 text-xs ${na(U.rfmLevel)}`,children:U.rfmLevel})]})}):e.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",e.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),e.jsx(ge,{className:"text-gray-400",children:U.createdAt?new Date(U.createdAt).toLocaleDateString():"-"}),e.jsx(ge,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>{tt(U),He(!0)},className:"text-gray-400 hover:text-amber-400 hover:bg-amber-400/10",title:"设置 VIP",children:e.jsx(an,{className:"w-4 h-4"})}),e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>{Pe(U.id),F(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"查看详情",children:e.jsx(ru,{className:"w-4 h-4"})}),e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>kn(U),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑",children:e.jsx(mt,{className:"w-4 h-4"})}),e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>Ir(U),className:"text-gray-400 hover:text-yellow-400 hover:bg-yellow-400/10",title:"修改密码",children:e.jsx(Gf,{className:"w-4 h-4"})}),e.jsx(Z,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Cn(U.id),title:"删除",children:e.jsx(Gt,{className:"w-4 h-4"})})]})})]},U.id)}),i.length===0&&e.jsx(et,{children:e.jsx(ge,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),e.jsx(Gs,{page:f,totalPages:sa,total:d,pageSize:y,onPageChange:p,onPageSizeChange:U=>{g(U),p(1)}})]})})})]}),e.jsxs(zt,{value:"journey",children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),e.jsxs(Z,{variant:"outline",onClick:Rs,disabled:os,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${os?"animate-spin":""}`})," 刷新数据"]})]}),e.jsxs("div",{className:"relative mb-8",children:[e.jsx("div",{className:"absolute top-16 left-0 right-0 h-0.5 bg-gradient-to-r from-blue-500/20 via-[#38bdac]/30 to-amber-500/20 mx-20"}),e.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:io.map((U,We)=>e.jsxs("div",{className:"relative flex flex-col items-center",children:[e.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${U.color} text-center cursor-default`,children:[e.jsx("div",{className:"text-2xl mb-1",children:U.icon}),e.jsx("div",{className:`text-xs font-medium ${U.color.split(" ").find(Ge=>Ge.startsWith("text-"))}`,children:U.label}),bs[U.id]!==void 0&&e.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[e.jsx("span",{className:"font-bold text-white",children:bs[U.id]})," 人"]}),e.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:We+1})]}),Wee.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[e.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:U.step}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-300",children:U.action}),e.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",U.next]})]})]},U.step))})]}),e.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(Fs,{className:"w-4 h-4 text-purple-400"}),e.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),e.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),os?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Be,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(bs).length>0?e.jsx("div",{className:"space-y-2",children:io.map(U=>{const We=bs[U.id]||0,Ge=Math.max(...io.map(lt=>bs[lt.id]||0),1),Vt=Math.round(We/Ge*100);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[U.icon," ",U.label]}),e.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${Vt}%`}})}),e.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:We})]},U.id)})}):e.jsx("div",{className:"text-center py-8",children:e.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),e.jsxs(zt,{value:"rules",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程引导规则,定义各行为节点的触发条件与引导内容"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Z,{variant:"outline",onClick:as,disabled:ss,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${ss?"animate-spin":""}`})," 刷新"]}),e.jsxs(Z,{onClick:()=>{Tr(null),rs({title:"",description:"",trigger:"",sort:0,enabled:!0}),zs(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),ss?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):pe.length===0?e.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[e.jsx(Fs,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),e.jsxs(Z,{onClick:as,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(Be,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):e.jsx("div",{className:"space-y-2",children:pe.map(U=>e.jsx("div",{className:`p-4 rounded-lg border transition-all ${U.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[e.jsx(mt,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),e.jsx("span",{className:"text-white font-medium",children:U.title}),U.trigger&&e.jsxs(Oe,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",U.trigger]}),e.jsx(Oe,{className:`text-xs border-0 ${U.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:U.enabled?"启用":"禁用"})]}),U.description&&e.jsx("p",{className:"text-gray-400 text-sm ml-6",children:U.description})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[e.jsx(dt,{checked:U.enabled,onCheckedChange:()=>Pn(U)}),e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>{Tr(U),rs({title:U.title,description:U.description,trigger:U.trigger,sort:U.sort,enabled:U.enabled}),zs(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:e.jsx(mt,{className:"w-4 h-4"})}),e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>Mr(U.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:e.jsx(Gt,{className:"w-4 h-4"})})]})]})},U.id))})]}),e.jsxs(zt,{value:"vip-roles",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"管理用户 VIP 角色分类,这些角色将在用户详情和会员展示中使用"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Z,{variant:"outline",onClick:Ar,disabled:ns,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${ns?"animate-spin":""}`})," 刷新"]}),e.jsxs(Z,{onClick:()=>{Js(null),Ps({name:"",sort:0}),Es(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"})," 添加角色"]})]})]}),ns?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):wn.length===0?e.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[e.jsx(an,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-400 mb-4",children:"暂无 VIP 角色"}),e.jsxs(Z,{onClick:()=>{Js(null),Ps({name:"",sort:0}),Es(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"})," 添加第一个角色"]})]}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:wn.map(U=>e.jsxs("div",{className:"p-4 bg-[#0f2137] border border-amber-500/20 rounded-xl hover:border-amber-500/40 transition-all group",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(an,{className:"w-4 h-4 text-amber-400"}),e.jsx("span",{className:"text-white font-medium",children:U.name})]}),e.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{type:"button",onClick:()=>{Js(U),Ps({name:U.name,sort:U.sort}),Es(!0)},className:"text-gray-500 hover:text-[#38bdac]",children:e.jsx(mt,{className:"w-3.5 h-3.5"})}),e.jsx("button",{type:"button",onClick:()=>Za(U.id),className:"text-gray-500 hover:text-red-400",children:e.jsx(Gt,{className:"w-3.5 h-3.5"})})]})]}),e.jsxs("p",{className:"text-gray-600 text-xs",children:["排序: ",U.sort]})]},U.id))})]})]}),e.jsx(Ct,{open:w,onOpenChange:V,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[Y?e.jsx(mt,{className:"w-5 h-5 text-[#38bdac]"}):e.jsx(lu,{className:"w-5 h-5 text-[#38bdac]"}),Y?"编辑用户":"添加用户"]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"手机号"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:$e.phone,onChange:U=>me({...$e,phone:U.target.value}),disabled:!!Y})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"昵称"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:$e.nickname,onChange:U=>me({...$e,nickname:U.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:Y?"新密码 (留空则不修改)":"密码"}),e.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:Y?"留空则不修改":"请输入密码",value:$e.password,onChange:U=>me({...$e,password:U.target.value})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(se,{className:"text-gray-300",children:"管理员权限"}),e.jsx(dt,{checked:$e.isAdmin,onCheckedChange:U=>me({...$e,isAdmin:U})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(se,{className:"text-gray-300",children:"已购全书"}),e.jsx(dt,{checked:$e.hasFullBook,onCheckedChange:U=>me({...$e,hasFullBook:U})})]})]}),e.jsxs(Ot,{children:[e.jsxs(Z,{variant:"outline",onClick:()=>V(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(xs,{className:"w-4 h-4 mr-2"}),"取消"]}),e.jsxs(Z,{onClick:hr,disabled:re,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),re?"保存中...":"保存"]})]})]})}),e.jsx(Ct,{open:te,onOpenChange:ie,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[e.jsx(Gf,{className:"w-5 h-5 text-[#38bdac]"}),"修改密码"]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3",children:[e.jsxs("p",{className:"text-gray-400 text-sm",children:["用户:",Y==null?void 0:Y.nickname]}),e.jsxs("p",{className:"text-gray-400 text-sm",children:["手机号:",Y==null?void 0:Y.phone]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"新密码"}),e.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入新密码 (至少6位)",value:_,onChange:U=>Q(U.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"确认密码"}),e.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请再次输入",value:ue,onChange:U=>O(U.target.value)})]})]}),e.jsxs(Ot,{children:[e.jsx(Z,{variant:"outline",onClick:()=>ie(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),e.jsx(Z,{onClick:aa,disabled:re,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:re?"保存中...":"确认修改"})]})]})}),e.jsx(Ct,{open:Nn,onOpenChange:zs,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[e.jsx(mt,{className:"w-5 h-5 text-[#38bdac]"}),vs?"编辑规则":"添加规则"]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"规则标题 *"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:_t.title,onChange:U=>rs({..._t,title:U.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"规则描述"}),e.jsx(Xn,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:_t.description,onChange:U=>rs({..._t,description:U.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"触发条件"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:_t.trigger,onChange:U=>rs({..._t,trigger:U.target.value})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx(se,{className:"text-gray-300",children:"启用状态"})}),e.jsx(dt,{checked:_t.enabled,onCheckedChange:U=>rs({..._t,enabled:U})})]})]}),e.jsxs(Ot,{children:[e.jsxs(Z,{variant:"outline",onClick:()=>zs(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(xs,{className:"w-4 h-4 mr-2"}),"取消"]}),e.jsxs(Z,{onClick:_r,disabled:re,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),re?"保存中...":"保存"]})]})]})}),e.jsx(Ct,{open:ta,onOpenChange:Es,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[e.jsx(an,{className:"w-5 h-5 text-amber-400"}),Rr?"编辑 VIP 角色":"添加 VIP 角色"]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"角色名称 *"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:创业者、资源整合者、技术咖",value:Nt.name,onChange:U=>Ps({...Nt,name:U.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"排序(越小越前)"}),e.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Nt.sort,onChange:U=>Ps({...Nt,sort:parseInt(U.target.value)||0})})]})]}),e.jsxs(Ot,{children:[e.jsxs(Z,{variant:"outline",onClick:()=>Es(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(xs,{className:"w-4 h-4 mr-2"}),"取消"]}),e.jsxs(Z,{onClick:Ja,disabled:re,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),re?"保存中...":"保存"]})]})]})}),e.jsx(Ct,{open:A,onOpenChange:$,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[e.jsx(Yt,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",q==null?void 0:q.nickname]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[e.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((Tn=z.stats)==null?void 0:Tn.total)||0}),e.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),e.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-green-400",children:((Rn=z.stats)==null?void 0:Rn.purchased)||0}),e.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),e.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[e.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((la=z.stats)==null?void 0:la.earnings)||0).toFixed(2)]}),e.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),e.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[e.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((In=z.stats)==null?void 0:In.pendingEarnings)||0).toFixed(2)]}),e.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),K?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(Be,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((_n=z.referrals)==null?void 0:_n.length)??0)>0?e.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(z.referrals??[]).map((U,We)=>{var Vt;const Ge=U;return e.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((Vt=Ge.nickname)==null?void 0:Vt.charAt(0))||"?"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white text-sm",children:Ge.nickname}),e.jsx("div",{className:"text-xs text-gray-500",children:Ge.phone||(Ge.hasOpenId?"微信用户":"未绑定")})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[Ge.status==="vip"&&e.jsx(Oe,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Ge.status==="paid"&&e.jsxs(Oe,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Ge.purchasedSections,"章"]}),Ge.status==="free"&&e.jsx(Oe,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),e.jsx("span",{className:"text-xs text-gray-500",children:Ge.createdAt?new Date(Ge.createdAt).toLocaleDateString():""})]})]},Ge.id||We)})}):e.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),e.jsx(Ot,{children:e.jsx(Z,{variant:"outline",onClick:()=>$(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),e.jsx(E0,{open:Ce,onClose:()=>F(!1),userId:xe,onUserUpdated:Pt}),e.jsx(G2,{open:Ve,onClose:()=>{He(!1),tt(null)},userId:(Ke==null?void 0:Ke.id)??null,userNickname:Ke==null?void 0:Ke.nickname,onSaved:Pt})]})}function No(r,[a,l]){return Math.min(l,Math.max(a,r))}var P0=["PageUp","PageDown"],T0=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],R0={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ya="Slider",[uu,Q2,q2]=Bu(Ya),[I0]=vn(Ya,[q2]),[X2,Oo]=I0(Ya),_0=u.forwardRef((r,a)=>{const{name:l,min:i=0,max:c=100,step:d=1,orientation:m="horizontal",disabled:f=!1,minStepsBetweenThumbs:p=0,defaultValue:y=[i],value:g,onValueChange:v=()=>{},onValueCommit:k=()=>{},inverted:P=!1,form:T,...N}=r,j=u.useRef(new Set),C=u.useRef(0),b=m==="horizontal"?J2:Z2,[R=[],G]=Qn({prop:g,defaultProp:y,onChange:te=>{var Y;(Y=[...j.current][C.current])==null||Y.focus(),v(te)}}),X=u.useRef(R);function L(te){const ie=n4(R,te);V(te,ie)}function I(te){V(te,C.current)}function w(){const te=X.current[C.current];R[C.current]!==te&&k(R)}function V(te,ie,{commit:Y}={commit:!1}){const ne=o4(d),_=c4(Math.round((te-i)/d)*d+i,ne),Q=No(_,[i,c]);G((ue=[])=>{const O=s4(ue,Q,ie);if(i4(O,p*d)){C.current=O.indexOf(Q);const re=String(O)!==String(ue);return re&&Y&&k(O),re?O:ue}else return ue})}return e.jsx(X2,{scope:r.__scopeSlider,name:l,disabled:f,min:i,max:c,valueIndexToChangeRef:C,thumbs:j.current,values:R,orientation:m,form:T,children:e.jsx(uu.Provider,{scope:r.__scopeSlider,children:e.jsx(uu.Slot,{scope:r.__scopeSlider,children:e.jsx(b,{"aria-disabled":f,"data-disabled":f?"":void 0,...N,ref:a,onPointerDown:Ye(N.onPointerDown,()=>{f||(X.current=R)}),min:i,max:c,inverted:P,onSlideStart:f?void 0:L,onSlideMove:f?void 0:I,onSlideEnd:f?void 0:w,onHomeKeyDown:()=>!f&&V(i,0,{commit:!0}),onEndKeyDown:()=>!f&&V(c,R.length-1,{commit:!0}),onStepKeyDown:({event:te,direction:ie})=>{if(!f){const _=P0.includes(te.key)||te.shiftKey&&T0.includes(te.key)?10:1,Q=C.current,ue=R[Q],O=d*_*ie;V(ue+O,Q,{commit:!0})}}})})})})});_0.displayName=Ya;var[M0,A0]=I0(Ya,{startEdge:"left",endEdge:"right",size:"width",direction:1}),J2=u.forwardRef((r,a)=>{const{min:l,max:i,dir:c,inverted:d,onSlideStart:m,onSlideMove:f,onSlideEnd:p,onStepKeyDown:y,...g}=r,[v,k]=u.useState(null),P=it(a,b=>k(b)),T=u.useRef(void 0),N=Ao(c),j=N==="ltr",C=j&&!d||!j&&d;function E(b){const R=T.current||v.getBoundingClientRect(),G=[0,R.width],L=Hu(G,C?[l,i]:[i,l]);return T.current=R,L(b-R.left)}return e.jsx(M0,{scope:r.__scopeSlider,startEdge:C?"left":"right",endEdge:C?"right":"left",direction:C?1:-1,size:"width",children:e.jsx(D0,{dir:N,"data-orientation":"horizontal",...g,ref:P,style:{...g.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const R=E(b.clientX);m==null||m(R)},onSlideMove:b=>{const R=E(b.clientX);f==null||f(R)},onSlideEnd:()=>{T.current=void 0,p==null||p()},onStepKeyDown:b=>{const G=R0[C?"from-left":"from-right"].includes(b.key);y==null||y({event:b,direction:G?-1:1})}})})}),Z2=u.forwardRef((r,a)=>{const{min:l,max:i,inverted:c,onSlideStart:d,onSlideMove:m,onSlideEnd:f,onStepKeyDown:p,...y}=r,g=u.useRef(null),v=it(a,g),k=u.useRef(void 0),P=!c;function T(N){const j=k.current||g.current.getBoundingClientRect(),C=[0,j.height],b=Hu(C,P?[i,l]:[l,i]);return k.current=j,b(N-j.top)}return e.jsx(M0,{scope:r.__scopeSlider,startEdge:P?"bottom":"top",endEdge:P?"top":"bottom",size:"height",direction:P?1:-1,children:e.jsx(D0,{"data-orientation":"vertical",...y,ref:v,style:{...y.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const j=T(N.clientY);d==null||d(j)},onSlideMove:N=>{const j=T(N.clientY);m==null||m(j)},onSlideEnd:()=>{k.current=void 0,f==null||f()},onStepKeyDown:N=>{const C=R0[P?"from-bottom":"from-top"].includes(N.key);p==null||p({event:N,direction:C?-1:1})}})})}),D0=u.forwardRef((r,a)=>{const{__scopeSlider:l,onSlideStart:i,onSlideMove:c,onSlideEnd:d,onHomeKeyDown:m,onEndKeyDown:f,onStepKeyDown:p,...y}=r,g=Oo(Ya,l);return e.jsx(Je.span,{...y,ref:a,onKeyDown:Ye(r.onKeyDown,v=>{v.key==="Home"?(m(v),v.preventDefault()):v.key==="End"?(f(v),v.preventDefault()):P0.concat(T0).includes(v.key)&&(p(v),v.preventDefault())}),onPointerDown:Ye(r.onPointerDown,v=>{const k=v.target;k.setPointerCapture(v.pointerId),v.preventDefault(),g.thumbs.has(k)?k.focus():i(v)}),onPointerMove:Ye(r.onPointerMove,v=>{v.target.hasPointerCapture(v.pointerId)&&c(v)}),onPointerUp:Ye(r.onPointerUp,v=>{const k=v.target;k.hasPointerCapture(v.pointerId)&&(k.releasePointerCapture(v.pointerId),d(v))})})}),L0="SliderTrack",O0=u.forwardRef((r,a)=>{const{__scopeSlider:l,...i}=r,c=Oo(L0,l);return e.jsx(Je.span,{"data-disabled":c.disabled?"":void 0,"data-orientation":c.orientation,...i,ref:a})});O0.displayName=L0;var hu="SliderRange",F0=u.forwardRef((r,a)=>{const{__scopeSlider:l,...i}=r,c=Oo(hu,l),d=A0(hu,l),m=u.useRef(null),f=it(a,m),p=c.values.length,y=c.values.map(k=>B0(k,c.min,c.max)),g=p>1?Math.min(...y):0,v=100-Math.max(...y);return e.jsx(Je.span,{"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,...i,ref:f,style:{...r.style,[d.startEdge]:g+"%",[d.endEdge]:v+"%"}})});F0.displayName=hu;var mu="SliderThumb",z0=u.forwardRef((r,a)=>{const l=Q2(r.__scopeSlider),[i,c]=u.useState(null),d=it(a,f=>c(f)),m=u.useMemo(()=>i?l().findIndex(f=>f.ref.current===i):-1,[l,i]);return e.jsx(e4,{...r,ref:d,index:m})}),e4=u.forwardRef((r,a)=>{const{__scopeSlider:l,index:i,name:c,...d}=r,m=Oo(mu,l),f=A0(mu,l),[p,y]=u.useState(null),g=it(a,E=>y(E)),v=p?m.form||!!p.closest("form"):!0,k=Wu(p),P=m.values[i],T=P===void 0?0:B0(P,m.min,m.max),N=r4(i,m.values.length),j=k==null?void 0:k[f.size],C=j?a4(j,T,f.direction):0;return u.useEffect(()=>{if(p)return m.thumbs.add(p),()=>{m.thumbs.delete(p)}},[p,m.thumbs]),e.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[f.startEdge]:`calc(${T}% + ${C}px)`},children:[e.jsx(uu.ItemSlot,{scope:r.__scopeSlider,children:e.jsx(Je.span,{role:"slider","aria-label":r["aria-label"]||N,"aria-valuemin":m.min,"aria-valuenow":P,"aria-valuemax":m.max,"aria-orientation":m.orientation,"data-orientation":m.orientation,"data-disabled":m.disabled?"":void 0,tabIndex:m.disabled?void 0:0,...d,ref:g,style:P===void 0?{display:"none"}:r.style,onFocus:Ye(r.onFocus,()=>{m.valueIndexToChangeRef.current=i})})}),v&&e.jsx($0,{name:c??(m.name?m.name+(m.values.length>1?"[]":""):void 0),form:m.form,value:P},i)]})});z0.displayName=mu;var t4="RadioBubbleInput",$0=u.forwardRef(({__scopeSlider:r,value:a,...l},i)=>{const c=u.useRef(null),d=it(c,i),m=Vu(a);return u.useEffect(()=>{const f=c.current;if(!f)return;const p=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(p,"value").set;if(m!==a&&g){const v=new Event("input",{bubbles:!0});g.call(f,a),f.dispatchEvent(v)}},[m,a]),e.jsx(Je.input,{style:{display:"none"},...l,ref:d,defaultValue:a})});$0.displayName=t4;function s4(r=[],a,l){const i=[...r];return i[l]=a,i.sort((c,d)=>c-d)}function B0(r,a,l){const d=100/(l-a)*(r-a);return No(d,[0,100])}function r4(r,a){return a>2?`Value ${r+1} of ${a}`:a===2?["Minimum","Maximum"][r]:void 0}function n4(r,a){if(r.length===1)return 0;const l=r.map(c=>Math.abs(c-a)),i=Math.min(...l);return l.indexOf(i)}function a4(r,a,l){const i=r/2,d=Hu([0,50],[0,i]);return(i-d(a)*l)*l}function l4(r){return r.slice(0,-1).map((a,l)=>r[l+1]-a)}function i4(r,a){if(a>0){const l=l4(r);return Math.min(...l)>=a}return!0}function Hu(r,a){return l=>{if(r[0]===r[1]||a[0]===a[1])return a[0];const i=(a[1]-a[0])/(r[1]-r[0]);return a[0]+i*(l-r[0])}}function o4(r){return(String(r).split(".")[1]||"").length}function c4(r,a){const l=Math.pow(10,a);return Math.round(r*l)/l}var d4=_0,u4=O0,h4=F0,m4=z0;function f4({className:r,defaultValue:a,value:l,min:i=0,max:c=100,...d}){const m=u.useMemo(()=>Array.isArray(l)?l:Array.isArray(a)?a:[i,c],[l,a,i,c]);return e.jsxs(d4,{defaultValue:a,value:l,min:i,max:c,className:ot("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",r),...d,children:[e.jsx(u4,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:e.jsx(h4,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:m.length},(f,p)=>e.jsx(m4,{className:"block size-4 shrink-0 rounded-full border-2 border-[#38bdac] bg-white shadow-sm focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},p))]})}const x4={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function U0({embedded:r=!1}){const[a,l]=u.useState(x4),[i,c]=u.useState(!0),[d,m]=u.useState(!1);u.useEffect(()=>{Le("/api/admin/referral-settings").then(y=>{const g=y==null?void 0:y.data;g&&typeof g=="object"&&l({distributorShare:g.distributorShare??90,minWithdrawAmount:g.minWithdrawAmount??10,bindingDays:g.bindingDays??30,userDiscount:g.userDiscount??5,enableAutoWithdraw:g.enableAutoWithdraw??!1,vipOrderShareVip:g.vipOrderShareVip??20,vipOrderShareNonVip:g.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>c(!1))},[]);const f=async()=>{m(!0);try{const y={distributorShare:Number(a.distributorShare)||0,minWithdrawAmount:Number(a.minWithdrawAmount)||0,bindingDays:Number(a.bindingDays)||0,userDiscount:Number(a.userDiscount)||0,enableAutoWithdraw:!!a.enableAutoWithdraw,vipOrderShareVip:Number(a.vipOrderShareVip)||20,vipOrderShareNonVip:Number(a.vipOrderShareNonVip)||10},g=await ut("/api/admin/referral-settings",y);if(!g||g.success===!1){alert("保存失败: "+(g&&typeof g=="object"&&"error"in g?g.error:""));return}alert(`✅ 分销配置已保存成功! - -• 小程序与网站的推广规则会一起生效 -• 绑定关系会使用新的天数配置 -• 佣金比例会立即应用到新订单 - -如有缓存,请刷新前台/小程序页面。`)}catch(y){console.error(y),alert("保存失败: "+(y instanceof Error?y.message:String(y)))}finally{m(!1)}},p=y=>g=>{const v=parseFloat(g.target.value||"0");l(k=>({...k,[y]:isNaN(v)?0:v}))};return i?e.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[e.jsx($a,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),e.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),e.jsxs(Z,{onClick:f,disabled:d||i,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),d?"保存中...":"保存配置"]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"flex items-center gap-2 text-white",children:[e.jsx(tN,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),e.jsx(vt,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),e.jsx(Se,{className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{className:"text-gray-300 flex items-center gap-2",children:[e.jsx(Zi,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),e.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:a.userDiscount,onChange:p("userDiscount")}),e.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{className:"text-gray-300 flex items-center gap-2",children:[e.jsx(Yt,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(f4,{className:"flex-1",min:10,max:100,step:1,value:[a.distributorShare],onValueChange:([y])=>l(g=>({...g,distributorShare:y}))}),e.jsx(ce,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:a.distributorShare,onChange:p("distributorShare")})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",e.jsxs("span",{className:"text-[#38bdac] font-mono",children:[a.distributorShare,"%"]}),";会员订单见下方。"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{className:"text-gray-300 flex items-center gap-2",children:[e.jsx(Zi,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),e.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:a.vipOrderShareVip,onChange:p("vipOrderShareVip")}),e.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{className:"text-gray-300 flex items-center gap-2",children:[e.jsx(Zi,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),e.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:a.vipOrderShareNonVip,onChange:p("vipOrderShareNonVip")}),e.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{className:"text-gray-300 flex items-center gap-2",children:[e.jsx(Yt,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),e.jsx(ce,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:a.bindingDays,onChange:p("bindingDays")}),e.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"flex items-center gap-2 text-white",children:[e.jsx($a,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),e.jsx(vt,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),e.jsx(Se,{className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"最低提现金额(元)"}),e.jsx(ce,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:a.minWithdrawAmount,onChange:p("minWithdrawAmount")}),e.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",e.jsx(Oe,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[e.jsx(dt,{checked:a.enableAutoWithdraw,onCheckedChange:y=>l(g=>({...g,enableAutoWithdraw:y}))}),e.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50",children:[e.jsx(Qe,{children:e.jsxs(qe,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[e.jsx(Zi,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),e.jsxs(Se,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[e.jsxs("p",{children:["1. 以上配置会写入"," ",e.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),e.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),e.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function p4(){var Ce;const[r,a]=u.useState("overview"),[l,i]=u.useState([]),[c,d]=u.useState(null),[m,f]=u.useState([]),[p,y]=u.useState([]),[g,v]=u.useState([]),[k,P]=u.useState(!0),[T,N]=u.useState(null),[j,C]=u.useState(""),[E,b]=u.useState("all"),[R,G]=u.useState(1),[X,L]=u.useState(10),[I,w]=u.useState(0),[V,te]=u.useState(new Set),[ie,Y]=u.useState(null),[ne,_]=u.useState(""),[Q,ue]=u.useState(!1);u.useEffect(()=>{O()},[]),u.useEffect(()=>{G(1)},[r,E]),u.useEffect(()=>{re(r)},[r]),u.useEffect(()=>{["orders","bindings","withdrawals"].includes(r)&&re(r,!0)},[R,X,E,j]);async function O(){N(null);try{const F=await Le("/api/admin/distribution/overview");F!=null&&F.success&&F.overview&&d(F.overview)}catch(F){console.error("[Admin] 概览接口异常:",F),N("加载概览失败")}try{const F=await Le("/api/db/users");v((F==null?void 0:F.users)||[])}catch(F){console.error("[Admin] 用户数据加载失败:",F)}}async function re(F,xe=!1){var Pe;if(!(!xe&&V.has(F))){P(!0);try{const Ve=g;switch(F){case"overview":break;case"orders":{try{const He=new URLSearchParams({page:String(R),pageSize:String(X),...E!=="all"&&{status:E},...j&&{search:j}}),Ke=await Le(`/api/orders?${He}`);if(Ke!=null&&Ke.success&&Ke.orders){const tt=Ke.orders.map($e=>{const me=Ve.find(ft=>ft.id===$e.userId),pe=$e.referrerId?Ve.find(ft=>ft.id===$e.referrerId):null;return{...$e,amount:parseFloat(String($e.amount))||0,userNickname:(me==null?void 0:me.nickname)||$e.userNickname||"未知用户",userPhone:(me==null?void 0:me.phone)||$e.userPhone||"-",referrerNickname:(pe==null?void 0:pe.nickname)||null,referrerCode:(pe==null?void 0:pe.referralCode)??null,type:$e.productType||$e.type}});i(tt),w(Ke.total??tt.length)}else i([]),w(0)}catch(He){console.error(He),N("加载订单失败"),i([])}break}case"bindings":{try{const He=new URLSearchParams({page:String(R),pageSize:String(X),...E!=="all"&&{status:E}}),Ke=await Le(`/api/db/distribution?${He}`);f((Ke==null?void 0:Ke.bindings)||[]),w((Ke==null?void 0:Ke.total)??((Pe=Ke==null?void 0:Ke.bindings)==null?void 0:Pe.length)??0)}catch(He){console.error(He),N("加载绑定数据失败"),f([])}break}case"withdrawals":{try{const He=E==="completed"?"success":E==="rejected"?"failed":E,Ke=new URLSearchParams({...He&&He!=="all"&&{status:He},page:String(R),pageSize:String(X)}),tt=await Le(`/api/admin/withdrawals?${Ke}`);if(tt!=null&&tt.success&&tt.withdrawals){const $e=tt.withdrawals.map(me=>({...me,account:me.account??"未绑定微信号",status:me.status==="success"?"completed":me.status==="failed"?"rejected":me.status}));y($e),w((tt==null?void 0:tt.total)??$e.length)}else tt!=null&&tt.success||N(`获取提现记录失败: ${(tt==null?void 0:tt.error)||"未知错误"}`),y([])}catch(He){console.error(He),N("加载提现数据失败"),y([])}break}}te(He=>new Set(He).add(F))}catch(Ve){console.error(Ve)}finally{P(!1)}}}async function H(){N(null),te(F=>{const xe=new Set(F);return xe.delete(r),xe}),r==="overview"&&O(),await re(r,!0)}async function A(F){if(confirm("确认审核通过并打款?"))try{const xe=await yt("/api/admin/withdrawals",{id:F,action:"approve"});if(!(xe!=null&&xe.success)){const Pe=(xe==null?void 0:xe.message)||(xe==null?void 0:xe.error)||"操作失败";alert(Pe);return}await H()}catch(xe){console.error(xe),alert("操作失败")}}async function $(F){const xe=prompt("请输入拒绝原因:");if(xe)try{const Pe=await yt("/api/admin/withdrawals",{id:F,action:"reject",errorMessage:xe});if(!(Pe!=null&&Pe.success)){alert((Pe==null?void 0:Pe.error)||"操作失败");return}await H()}catch(Pe){console.error(Pe),alert("操作失败")}}async function z(){var F;if(!(!(ie!=null&&ie.orderSn)&&!(ie!=null&&ie.id))){ue(!0),N(null);try{const xe=await yt("/api/admin/orders/refund",{orderSn:ie.orderSn||ie.id,reason:ne||void 0});xe!=null&&xe.success?(Y(null),_(""),await re("orders",!0)):N((xe==null?void 0:xe.error)||"退款失败")}catch(xe){const Pe=xe;N(((F=Pe==null?void 0:Pe.data)==null?void 0:F.error)||"退款失败,请检查网络后重试")}finally{ue(!1)}}}function ee(F){const xe={active:"bg-green-500/20 text-green-400",converted:"bg-blue-500/20 text-blue-400",expired:"bg-gray-500/20 text-gray-400",cancelled:"bg-red-500/20 text-red-400",pending:"bg-orange-500/20 text-orange-400",pending_confirm:"bg-orange-500/20 text-orange-400",processing:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",rejected:"bg-red-500/20 text-red-400"},Pe={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return e.jsx(Oe,{className:`${xe[F]||"bg-gray-500/20 text-gray-400"} border-0`,children:Pe[F]||F})}const K=Math.ceil(I/X)||1,de=l,q=m.filter(F=>{var Pe,Ve,He,Ke;if(!j)return!0;const xe=j.toLowerCase();return((Pe=F.refereeNickname)==null?void 0:Pe.toLowerCase().includes(xe))||((Ve=F.refereePhone)==null?void 0:Ve.includes(xe))||((He=F.referrerName)==null?void 0:He.toLowerCase().includes(xe))||((Ke=F.referrerCode)==null?void 0:Ke.toLowerCase().includes(xe))}),ye=p.filter(F=>{var Pe;if(!j)return!0;const xe=j.toLowerCase();return((Pe=F.userName)==null?void 0:Pe.toLowerCase().includes(xe))||F.account&&F.account.toLowerCase().includes(xe)});return e.jsxs("div",{className:"p-8 w-full",children:[T&&e.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[e.jsx("span",{children:T}),e.jsx("button",{type:"button",onClick:()=>N(null),className:"hover:text-red-300",children:"×"})]}),e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-white",children:"推广中心"}),e.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),e.jsxs(Z,{onClick:H,disabled:k,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${k?"animate-spin":""}`}),"刷新数据"]})]}),e.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4 flex-wrap",children:[{key:"overview",label:"数据概览",icon:La},{key:"orders",label:"订单管理",icon:go},{key:"bindings",label:"绑定管理",icon:Sr},{key:"withdrawals",label:"提现审核",icon:$a},{key:"settings",label:"推广设置",icon:Yn}].map(F=>e.jsxs("button",{type:"button",onClick:()=>{a(F.key),b("all"),C("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${r===F.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[e.jsx(F.icon,{className:"w-4 h-4"}),F.label]},F.key))}),k?e.jsxs("div",{className:"flex items-center justify-center py-20",children:[e.jsx(Be,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):e.jsxs(e.Fragment,{children:[r==="overview"&&c&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsx(Se,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),e.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c.todayClicks}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"总点击次数(实时)"})]}),e.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:e.jsx(ru,{className:"w-6 h-6 text-blue-400"})})]})})}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsx(Se,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"今日独立用户"}),e.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c.todayUniqueVisitors??0}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"去重访客数(实时)"})]}),e.jsx("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/20 flex items-center justify-center",children:e.jsx(Yt,{className:"w-6 h-6 text-cyan-400"})})]})})}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsx(Se,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"今日总文章点击率"}),e.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(c.todayClickRate??0).toFixed(2)}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"人均点击(总点击/独立用户)"})]}),e.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-500/20 flex items-center justify-center",children:e.jsx(La,{className:"w-6 h-6 text-amber-400"})})]})})}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsx(Se,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),e.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c.todayBindings})]}),e.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:e.jsx(Sr,{className:"w-6 h-6 text-green-400"})})]})})}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsx(Se,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),e.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c.todayConversions})]}),e.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:e.jsx(Hf,{className:"w-6 h-6 text-purple-400"})})]})})}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsx(Se,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),e.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",c.todayEarnings.toFixed(2)]})]}),e.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:e.jsx(go,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((Ce=c.todayClicksByPage)==null?void 0:Ce.length)??0)>0&&e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(ru,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),e.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),e.jsx(Se,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[e.jsx("th",{className:"pb-3 pr-4",children:"来源页/文章"}),e.jsx("th",{className:"pb-3 pr-4 text-right",children:"今日点击"}),e.jsx("th",{className:"pb-3 text-right",children:"占比"})]})}),e.jsx("tbody",{children:[...c.todayClicksByPage??[]].sort((F,xe)=>xe.clicks-F.clicks).map((F,xe)=>e.jsxs("tr",{className:"border-b border-gray-700/50",children:[e.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:F.page||"(未区分)"}),e.jsx("td",{className:"py-2 pr-4 text-right text-white",children:F.clicks}),e.jsxs("td",{className:"py-2 text-right text-gray-400",children:[c.todayClicks>0?(F.clicks/c.todayClicks*100).toFixed(1):0,"%"]})]},xe))})]})})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(we,{className:"bg-orange-500/10 border-orange-500/30",children:e.jsx(Se,{className:"p-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:e.jsx(su,{className:"w-6 h-6 text-orange-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),e.jsxs("p",{className:"text-2xl font-bold text-white",children:[c.expiringBindings," 个"]}),e.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),e.jsx(we,{className:"bg-blue-500/10 border-blue-500/30",children:e.jsx(Se,{className:"p-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:e.jsx($a,{className:"w-6 h-6 text-blue-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),e.jsxs("p",{className:"text-2xl font-bold text-white",children:[c.pendingWithdrawals," 笔"]}),e.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",c.pendingWithdrawAmount.toFixed(2)]})]}),e.jsx(Z,{onClick:()=>a("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50",children:[e.jsx(Qe,{children:e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(po,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),e.jsx(Se,{children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),e.jsx("p",{className:"text-xl font-bold text-white",children:c.monthClicks})]}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),e.jsx("p",{className:"text-xl font-bold text-white",children:c.monthBindings})]}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),e.jsx("p",{className:"text-xl font-bold text-white",children:c.monthConversions})]}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),e.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",c.monthEarnings.toFixed(2)]})]})]})})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50",children:[e.jsx(Qe,{children:e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(La,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),e.jsxs(Se,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),e.jsx("p",{className:"text-xl font-bold text-white",children:c.totalClicks.toLocaleString()})]}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),e.jsx("p",{className:"text-xl font-bold text-white",children:c.totalBindings.toLocaleString()})]}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),e.jsx("p",{className:"text-xl font-bold text-white",children:c.totalConversions})]}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),e.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",c.totalEarnings.toFixed(2)]})]})]}),e.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-300",children:"点击转化率"}),e.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[c.conversionRate,"%"]})]})]})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50",children:[e.jsx(Qe,{children:e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(Yt,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),e.jsx(Se,{children:e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[e.jsx("p",{className:"text-3xl font-bold text-white",children:c.totalDistributors}),e.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[e.jsx("p",{className:"text-3xl font-bold text-green-400",children:c.activeDistributors}),e.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[e.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),e.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[e.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),e.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),r==="orders"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(dn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx(ce,{value:j,onChange:F=>C(F.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),e.jsxs("select",{value:E,onChange:F=>b(F.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[e.jsx("option",{value:"all",children:"全部状态"}),e.jsx("option",{value:"completed",children:"已完成"}),e.jsx("option",{value:"pending",children:"待支付"}),e.jsx("option",{value:"failed",children:"已失败"}),e.jsx("option",{value:"refunded",children:"已退款"})]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsxs(Se,{className:"p-0",children:[l.length===0?e.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[e.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-700/50",children:de.map(F=>{var xe,Pe;return e.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[e.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(xe=F.id)==null?void 0:xe.slice(0,12),"..."]}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-white text-sm",children:F.userNickname}),e.jsx("p",{className:"text-gray-500 text-xs",children:F.userPhone})]})}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-white text-sm",children:(()=>{const Ve=F.productType||F.type;return Ve==="fullbook"?`${F.bookName||"《底层逻辑》"} - 全本`:Ve==="match"?"匹配次数购买":`${F.bookName||"《底层逻辑》"} - ${F.sectionTitle||F.chapterTitle||`章节${F.productId||F.sectionId||""}`}`})()}),e.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Ve=F.productType||F.type;return Ve==="fullbook"?"全书解锁":Ve==="match"?"功能权益":F.chapterTitle||"单章购买"})()})]})}),e.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof F.amount=="number"?F.amount.toFixed(2):parseFloat(String(F.amount||"0")).toFixed(2)]}),e.jsx("td",{className:"p-4 text-gray-300",children:F.paymentMethod==="wechat"?"微信支付":F.paymentMethod==="alipay"?"支付宝":F.paymentMethod||"微信支付"}),e.jsx("td",{className:"p-4",children:F.status==="refunded"?e.jsx(Oe,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):F.status==="completed"||F.status==="paid"?e.jsx(Oe,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):F.status==="pending"||F.status==="created"?e.jsx(Oe,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):e.jsx(Oe,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),e.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:F.refundReason,children:F.status==="refunded"&&F.refundReason?F.refundReason:"-"}),e.jsx("td",{className:"p-4 text-gray-300 text-sm",children:F.referrerId||F.referralCode?e.jsxs("span",{title:F.referralCode||F.referrerCode||F.referrerId||"",children:[F.referrerNickname||F.referralCode||F.referrerCode||((Pe=F.referrerId)==null?void 0:Pe.slice(0,8)),(F.referralCode||F.referrerCode)&&` (${F.referralCode||F.referrerCode})`]}):"-"}),e.jsx("td",{className:"p-4 text-[#FFD700]",children:F.referrerEarnings?`¥${(typeof F.referrerEarnings=="number"?F.referrerEarnings:parseFloat(String(F.referrerEarnings))).toFixed(2)}`:"-"}),e.jsx("td",{className:"p-4 text-gray-400 text-sm",children:F.createdAt?new Date(F.createdAt).toLocaleString("zh-CN"):"-"}),e.jsx("td",{className:"p-4",children:(F.status==="paid"||F.status==="completed")&&e.jsxs(Z,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{Y(F),_("")},children:[e.jsx(lp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},F.id)})})]})}),r==="orders"&&e.jsx(Gs,{page:R,totalPages:K,total:I,pageSize:X,onPageChange:G,onPageSizeChange:F=>{L(F),G(1)}})]})})]}),r==="bindings"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(dn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx(ce,{value:j,onChange:F=>C(F.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),e.jsxs("select",{value:E,onChange:F=>b(F.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[e.jsx("option",{value:"all",children:"全部状态"}),e.jsx("option",{value:"active",children:"有效"}),e.jsx("option",{value:"converted",children:"已转化"}),e.jsx("option",{value:"expired",children:"已过期"})]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsxs(Se,{className:"p-0",children:[q.length===0?e.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[e.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-700/50",children:q.map(F=>e.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[e.jsx("td",{className:"p-4",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:F.refereeNickname||"匿名用户"}),e.jsx("p",{className:"text-gray-500 text-xs",children:F.refereePhone})]})}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-white",children:F.referrerName||"-"}),e.jsx("p",{className:"text-gray-500 text-xs font-mono",children:F.referrerCode})]})}),e.jsx("td",{className:"p-4 text-gray-400",children:F.boundAt?new Date(F.boundAt).toLocaleDateString("zh-CN"):"-"}),e.jsx("td",{className:"p-4 text-gray-400",children:F.expiresAt?new Date(F.expiresAt).toLocaleDateString("zh-CN"):"-"}),e.jsx("td",{className:"p-4",children:ee(F.status)}),e.jsx("td",{className:"p-4",children:F.commission?e.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",F.commission.toFixed(2)]}):e.jsx("span",{className:"text-gray-500",children:"-"})})]},F.id))})]})}),r==="bindings"&&e.jsx(Gs,{page:R,totalPages:K,total:I,pageSize:X,onPageChange:G,onPageSizeChange:F=>{L(F),G(1)}})]})})]}),r==="withdrawals"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(dn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx(ce,{value:j,onChange:F=>C(F.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),e.jsxs("select",{value:E,onChange:F=>b(F.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[e.jsx("option",{value:"all",children:"全部状态"}),e.jsx("option",{value:"pending",children:"待审核"}),e.jsx("option",{value:"completed",children:"已完成"}),e.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsxs(Se,{className:"p-0",children:[ye.length===0?e.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[e.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),e.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-700/50",children:ye.map(F=>e.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[F.userAvatar?e.jsx("img",{src:F.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):e.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(F.userName||F.name||"?").slice(0,1)}),e.jsx("p",{className:"text-white font-medium",children:F.userName||F.name})]})}),e.jsx("td",{className:"p-4",children:e.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",F.amount.toFixed(2)]})}),e.jsx("td",{className:"p-4",children:e.jsx(Oe,{className:F.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:F.method==="wechat"?"微信":"支付宝"})}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-mono text-xs",children:F.account}),e.jsx("p",{className:"text-gray-500 text-xs",children:F.name})]})}),e.jsx("td",{className:"p-4 text-gray-400",children:F.createdAt?new Date(F.createdAt).toLocaleString("zh-CN"):"-"}),e.jsx("td",{className:"p-4",children:ee(F.status)}),e.jsx("td",{className:"p-4 text-right",children:F.status==="pending"&&e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsxs(Z,{size:"sm",onClick:()=>A(F.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(Hf,{className:"w-4 h-4 mr-1"}),"通过"]}),e.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>$(F.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[e.jsx(tp,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},F.id))})]})}),r==="withdrawals"&&e.jsx(Gs,{page:R,totalPages:K,total:I,pageSize:X,onPageChange:G,onPageSizeChange:F=>{L(F),G(1)}})]})})]})]}),e.jsx(Ct,{open:!!ie,onOpenChange:F=>!F&&Y(null),children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[e.jsx(kt,{children:e.jsx(Et,{className:"text-white",children:"订单退款"})}),ie&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",ie.orderSn||ie.id]}),e.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof ie.amount=="number"?ie.amount.toFixed(2):parseFloat(String(ie.amount||"0")).toFixed(2)]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),e.jsx("div",{className:"form-input",children:e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:ne,onChange:F=>_(F.target.value)})})]}),e.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),e.jsxs(Ot,{children:[e.jsx(Z,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>Y(null),disabled:Q,children:"取消"}),e.jsx(Z,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:z,disabled:Q,children:Q?"退款中...":"确认退款"})]})]})}),r==="settings"&&e.jsx("div",{className:"-mx-8 -mt-6",children:e.jsx(U0,{embedded:!0})})]})}function g4(){const[r,a]=u.useState([]),[l,i]=u.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[c,d]=u.useState(!0),[m,f]=u.useState(null),[p,y]=u.useState("all"),[g,v]=u.useState(1),[k,P]=u.useState(10),[T,N]=u.useState(0),[j,C]=u.useState(null);async function E(){var L,I,w,V,te,ie,Y;d(!0),f(null);try{const ne=new URLSearchParams({status:p,page:String(g),pageSize:String(k)}),_=await Le(`/api/admin/withdrawals?${ne}`);if(_!=null&&_.success){const Q=_.withdrawals||[];a(Q),N(_.total??((L=_.stats)==null?void 0:L.total)??Q.length),i({total:((I=_.stats)==null?void 0:I.total)??_.total??Q.length,pendingCount:((w=_.stats)==null?void 0:w.pendingCount)??0,pendingAmount:((V=_.stats)==null?void 0:V.pendingAmount)??0,successCount:((te=_.stats)==null?void 0:te.successCount)??0,successAmount:((ie=_.stats)==null?void 0:ie.successAmount)??0,failedCount:((Y=_.stats)==null?void 0:Y.failedCount)??0})}else f("加载提现记录失败")}catch(ne){console.error("Load withdrawals error:",ne),f("加载失败,请检查网络后重试")}finally{d(!1)}}u.useEffect(()=>{v(1)},[p]),u.useEffect(()=>{E()},[p,g,k]);const b=Math.ceil(T/k)||1;async function R(L){const I=r.find(w=>w.id===L);if(I!=null&&I.userCommissionInfo&&I.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${I.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 - -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;C(L);try{const w=await yt("/api/admin/withdrawals",{id:L,action:"approve"});w!=null&&w.success?E():alert("操作失败: "+((w==null?void 0:w.error)??""))}catch{alert("操作失败")}finally{C(null)}}async function G(L){const I=prompt("请输入拒绝原因(将返还用户余额):");if(I){C(L);try{const w=await yt("/api/admin/withdrawals",{id:L,action:"reject",errorMessage:I});w!=null&&w.success?E():alert("操作失败: "+((w==null?void 0:w.error)??""))}catch{alert("操作失败")}finally{C(null)}}}function X(L){switch(L){case"pending":return e.jsx(Oe,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return e.jsx(Oe,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return e.jsx(Oe,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return e.jsx(Oe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return e.jsx(Oe,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return e.jsx(Oe,{className:"bg-gray-500/20 text-gray-400 border-0",children:L})}}return e.jsxs("div",{className:"p-8 w-full",children:[m&&e.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[e.jsx("span",{children:m}),e.jsx("button",{type:"button",onClick:()=>f(null),className:"hover:text-red-300",children:"×"})]}),e.jsxs("div",{className:"flex justify-between items-start mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),e.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),e.jsxs(Z,{variant:"outline",onClick:E,disabled:c,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${c?"animate-spin":""}`}),"刷新"]})]}),e.jsx(we,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:e.jsx(Se,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(go,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),e.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[e.jsxs("p",{children:["• ",e.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",e.jsx("span",{className:"text-white font-medium",children:"90%"})]}),e.jsxs("p",{children:["• ",e.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),e.jsxs("p",{children:["• ",e.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),e.jsxs("p",{children:["• ",e.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),e.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsxs(Se,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:l.total}),e.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsxs(Se,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-orange-400",children:l.pendingCount}),e.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),e.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",l.pendingAmount.toFixed(2)]})]})}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsxs(Se,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-green-400",children:l.successCount}),e.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),e.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",l.successAmount.toFixed(2)]})]})}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsxs(Se,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-red-400",children:l.failedCount}),e.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),e.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(L=>e.jsx(Z,{variant:p===L?"default":"outline",size:"sm",onClick:()=>y(L),className:p===L?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:L==="all"?"全部":L==="pending"?"待处理":L==="success"?"已完成":"已拒绝"},L))}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:e.jsx(Se,{className:"p-0",children:c?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):r.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx($a,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[e.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),e.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),e.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-700/50",children:r.map(L=>e.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[e.jsx("td",{className:"p-4 text-gray-400",children:new Date(L.createdAt??"").toLocaleString()}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[L.userAvatar?e.jsx("img",{src:L.userAvatar,alt:L.userName??"",className:"w-8 h-8 rounded-full object-cover"}):e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(L.userName??"?").charAt(0)}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-white",children:L.userName??"未知"}),e.jsx("p",{className:"text-xs text-gray-500",children:L.userPhone??L.referralCode??(L.userId??"").slice(0,10)})]})]})}),e.jsx("td",{className:"p-4",children:e.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(L.amount).toFixed(2)]})}),e.jsx("td",{className:"p-4",children:L.userCommissionInfo?e.jsxs("div",{className:"text-xs space-y-1",children:[e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),e.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",L.userCommissionInfo.totalCommission.toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"text-gray-500",children:"已提现:"}),e.jsxs("span",{className:"text-gray-400",children:["¥",L.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"text-gray-500",children:"待审核:"}),e.jsxs("span",{className:"text-orange-400",children:["¥",L.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[e.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),e.jsxs("span",{className:L.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",L.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):e.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),e.jsxs("td",{className:"p-4",children:[X(L.status),L.errorMessage&&e.jsx("p",{className:"text-xs text-red-400 mt-1",children:L.errorMessage})]}),e.jsx("td",{className:"p-4 text-gray-400",children:L.processedAt?new Date(L.processedAt).toLocaleString():"-"}),e.jsx("td",{className:"p-4 text-gray-400",children:L.userConfirmedAt?e.jsxs("span",{className:"text-green-400",title:L.userConfirmedAt,children:["已确认 ",new Date(L.userConfirmedAt).toLocaleString()]}):"-"}),e.jsxs("td",{className:"p-4 text-right",children:[(L.status==="pending"||L.status==="pending_confirm")&&e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsxs(Z,{size:"sm",onClick:()=>R(L.id),disabled:j===L.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[e.jsx(Ro,{className:"w-4 h-4 mr-1"}),"批准"]}),e.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>G(L.id),disabled:j===L.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[e.jsx(xs,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(L.status==="success"||L.status==="completed")&&L.transactionId&&e.jsx("span",{className:"text-xs text-gray-500 font-mono",children:L.transactionId})]})]},L.id))})]})}),e.jsx(Gs,{page:g,totalPages:b,total:T,pageSize:k,onPageChange:v,onPageSizeChange:L=>{P(L),v(1)}})]})})})]})}const y4=["top","right","bottom","left"],fn=Math.min,Cs=Math.max,wo=Math.round,oo=Math.floor,or=r=>({x:r,y:r}),v4={left:"right",right:"left",bottom:"top",top:"bottom"},b4={start:"end",end:"start"};function fu(r,a,l){return Cs(r,fn(a,l))}function kr(r,a){return typeof r=="function"?r(a):r}function Er(r){return r.split("-")[0]}function Qa(r){return r.split("-")[1]}function Ku(r){return r==="x"?"y":"x"}function Gu(r){return r==="y"?"height":"width"}const j4=new Set(["top","bottom"]);function ir(r){return j4.has(Er(r))?"y":"x"}function Yu(r){return Ku(ir(r))}function N4(r,a,l){l===void 0&&(l=!1);const i=Qa(r),c=Yu(r),d=Gu(c);let m=c==="x"?i===(l?"end":"start")?"right":"left":i==="start"?"bottom":"top";return a.reference[d]>a.floating[d]&&(m=So(m)),[m,So(m)]}function w4(r){const a=So(r);return[xu(r),a,xu(a)]}function xu(r){return r.replace(/start|end/g,a=>b4[a])}const gx=["left","right"],yx=["right","left"],S4=["top","bottom"],C4=["bottom","top"];function k4(r,a,l){switch(r){case"top":case"bottom":return l?a?yx:gx:a?gx:yx;case"left":case"right":return a?S4:C4;default:return[]}}function E4(r,a,l,i){const c=Qa(r);let d=k4(Er(r),l==="start",i);return c&&(d=d.map(m=>m+"-"+c),a&&(d=d.concat(d.map(xu)))),d}function So(r){return r.replace(/left|right|bottom|top/g,a=>v4[a])}function P4(r){return{top:0,right:0,bottom:0,left:0,...r}}function V0(r){return typeof r!="number"?P4(r):{top:r,right:r,bottom:r,left:r}}function Co(r){const{x:a,y:l,width:i,height:c}=r;return{width:i,height:c,top:l,left:a,right:a+i,bottom:l+c,x:a,y:l}}function vx(r,a,l){let{reference:i,floating:c}=r;const d=ir(a),m=Yu(a),f=Gu(m),p=Er(a),y=d==="y",g=i.x+i.width/2-c.width/2,v=i.y+i.height/2-c.height/2,k=i[f]/2-c[f]/2;let P;switch(p){case"top":P={x:g,y:i.y-c.height};break;case"bottom":P={x:g,y:i.y+i.height};break;case"right":P={x:i.x+i.width,y:v};break;case"left":P={x:i.x-c.width,y:v};break;default:P={x:i.x,y:i.y}}switch(Qa(a)){case"start":P[m]-=k*(l&&y?-1:1);break;case"end":P[m]+=k*(l&&y?-1:1);break}return P}async function T4(r,a){var l;a===void 0&&(a={});const{x:i,y:c,platform:d,rects:m,elements:f,strategy:p}=r,{boundary:y="clippingAncestors",rootBoundary:g="viewport",elementContext:v="floating",altBoundary:k=!1,padding:P=0}=kr(a,r),T=V0(P),j=f[k?v==="floating"?"reference":"floating":v],C=Co(await d.getClippingRect({element:(l=await(d.isElement==null?void 0:d.isElement(j)))==null||l?j:j.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(f.floating)),boundary:y,rootBoundary:g,strategy:p})),E=v==="floating"?{x:i,y:c,width:m.floating.width,height:m.floating.height}:m.reference,b=await(d.getOffsetParent==null?void 0:d.getOffsetParent(f.floating)),R=await(d.isElement==null?void 0:d.isElement(b))?await(d.getScale==null?void 0:d.getScale(b))||{x:1,y:1}:{x:1,y:1},G=Co(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:E,offsetParent:b,strategy:p}):E);return{top:(C.top-G.top+T.top)/R.y,bottom:(G.bottom-C.bottom+T.bottom)/R.y,left:(C.left-G.left+T.left)/R.x,right:(G.right-C.right+T.right)/R.x}}const R4=async(r,a,l)=>{const{placement:i="bottom",strategy:c="absolute",middleware:d=[],platform:m}=l,f=d.filter(Boolean),p=await(m.isRTL==null?void 0:m.isRTL(a));let y=await m.getElementRects({reference:r,floating:a,strategy:c}),{x:g,y:v}=vx(y,i,p),k=i,P={},T=0;for(let j=0;j({name:"arrow",options:r,async fn(a){const{x:l,y:i,placement:c,rects:d,platform:m,elements:f,middlewareData:p}=a,{element:y,padding:g=0}=kr(r,a)||{};if(y==null)return{};const v=V0(g),k={x:l,y:i},P=Yu(c),T=Gu(P),N=await m.getDimensions(y),j=P==="y",C=j?"top":"left",E=j?"bottom":"right",b=j?"clientHeight":"clientWidth",R=d.reference[T]+d.reference[P]-k[P]-d.floating[T],G=k[P]-d.reference[P],X=await(m.getOffsetParent==null?void 0:m.getOffsetParent(y));let L=X?X[b]:0;(!L||!await(m.isElement==null?void 0:m.isElement(X)))&&(L=f.floating[b]||d.floating[T]);const I=R/2-G/2,w=L/2-N[T]/2-1,V=fn(v[C],w),te=fn(v[E],w),ie=V,Y=L-N[T]-te,ne=L/2-N[T]/2+I,_=fu(ie,ne,Y),Q=!p.arrow&&Qa(c)!=null&&ne!==_&&d.reference[T]/2-(nene<=0)){var te,ie;const ne=(((te=d.flip)==null?void 0:te.index)||0)+1,_=L[ne];if(_&&(!(v==="alignment"?E!==ir(_):!1)||V.every(O=>ir(O.placement)===E?O.overflows[0]>0:!0)))return{data:{index:ne,overflows:V},reset:{placement:_}};let Q=(ie=V.filter(ue=>ue.overflows[0]<=0).sort((ue,O)=>ue.overflows[1]-O.overflows[1])[0])==null?void 0:ie.placement;if(!Q)switch(P){case"bestFit":{var Y;const ue=(Y=V.filter(O=>{if(X){const re=ir(O.placement);return re===E||re==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(re=>re>0).reduce((re,H)=>re+H,0)]).sort((O,re)=>O[1]-re[1])[0])==null?void 0:Y[0];ue&&(Q=ue);break}case"initialPlacement":Q=f;break}if(c!==Q)return{reset:{placement:Q}}}return{}}}};function bx(r,a){return{top:r.top-a.height,right:r.right-a.width,bottom:r.bottom-a.height,left:r.left-a.width}}function jx(r){return y4.some(a=>r[a]>=0)}const M4=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(a){const{rects:l,platform:i}=a,{strategy:c="referenceHidden",...d}=kr(r,a);switch(c){case"referenceHidden":{const m=await i.detectOverflow(a,{...d,elementContext:"reference"}),f=bx(m,l.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:jx(f)}}}case"escaped":{const m=await i.detectOverflow(a,{...d,altBoundary:!0}),f=bx(m,l.floating);return{data:{escapedOffsets:f,escaped:jx(f)}}}default:return{}}}}},W0=new Set(["left","top"]);async function A4(r,a){const{placement:l,platform:i,elements:c}=r,d=await(i.isRTL==null?void 0:i.isRTL(c.floating)),m=Er(l),f=Qa(l),p=ir(l)==="y",y=W0.has(m)?-1:1,g=d&&p?-1:1,v=kr(a,r);let{mainAxis:k,crossAxis:P,alignmentAxis:T}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return f&&typeof T=="number"&&(P=f==="end"?T*-1:T),p?{x:P*g,y:k*y}:{x:k*y,y:P*g}}const D4=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(a){var l,i;const{x:c,y:d,placement:m,middlewareData:f}=a,p=await A4(a,r);return m===((l=f.offset)==null?void 0:l.placement)&&(i=f.arrow)!=null&&i.alignmentOffset?{}:{x:c+p.x,y:d+p.y,data:{...p,placement:m}}}}},L4=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(a){const{x:l,y:i,placement:c,platform:d}=a,{mainAxis:m=!0,crossAxis:f=!1,limiter:p={fn:C=>{let{x:E,y:b}=C;return{x:E,y:b}}},...y}=kr(r,a),g={x:l,y:i},v=await d.detectOverflow(a,y),k=ir(Er(c)),P=Ku(k);let T=g[P],N=g[k];if(m){const C=P==="y"?"top":"left",E=P==="y"?"bottom":"right",b=T+v[C],R=T-v[E];T=fu(b,T,R)}if(f){const C=k==="y"?"top":"left",E=k==="y"?"bottom":"right",b=N+v[C],R=N-v[E];N=fu(b,N,R)}const j=p.fn({...a,[P]:T,[k]:N});return{...j,data:{x:j.x-l,y:j.y-i,enabled:{[P]:m,[k]:f}}}}}},O4=function(r){return r===void 0&&(r={}),{options:r,fn(a){const{x:l,y:i,placement:c,rects:d,middlewareData:m}=a,{offset:f=0,mainAxis:p=!0,crossAxis:y=!0}=kr(r,a),g={x:l,y:i},v=ir(c),k=Ku(v);let P=g[k],T=g[v];const N=kr(f,a),j=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(p){const b=k==="y"?"height":"width",R=d.reference[k]-d.floating[b]+j.mainAxis,G=d.reference[k]+d.reference[b]-j.mainAxis;PG&&(P=G)}if(y){var C,E;const b=k==="y"?"width":"height",R=W0.has(Er(c)),G=d.reference[v]-d.floating[b]+(R&&((C=m.offset)==null?void 0:C[v])||0)+(R?0:j.crossAxis),X=d.reference[v]+d.reference[b]+(R?0:((E=m.offset)==null?void 0:E[v])||0)-(R?j.crossAxis:0);TX&&(T=X)}return{[k]:P,[v]:T}}}},F4=function(r){return r===void 0&&(r={}),{name:"size",options:r,async fn(a){var l,i;const{placement:c,rects:d,platform:m,elements:f}=a,{apply:p=()=>{},...y}=kr(r,a),g=await m.detectOverflow(a,y),v=Er(c),k=Qa(c),P=ir(c)==="y",{width:T,height:N}=d.floating;let j,C;v==="top"||v==="bottom"?(j=v,C=k===(await(m.isRTL==null?void 0:m.isRTL(f.floating))?"start":"end")?"left":"right"):(C=v,j=k==="end"?"top":"bottom");const E=N-g.top-g.bottom,b=T-g.left-g.right,R=fn(N-g[j],E),G=fn(T-g[C],b),X=!a.middlewareData.shift;let L=R,I=G;if((l=a.middlewareData.shift)!=null&&l.enabled.x&&(I=b),(i=a.middlewareData.shift)!=null&&i.enabled.y&&(L=E),X&&!k){const V=Cs(g.left,0),te=Cs(g.right,0),ie=Cs(g.top,0),Y=Cs(g.bottom,0);P?I=T-2*(V!==0||te!==0?V+te:Cs(g.left,g.right)):L=N-2*(ie!==0||Y!==0?ie+Y:Cs(g.top,g.bottom))}await p({...a,availableWidth:I,availableHeight:L});const w=await m.getDimensions(f.floating);return T!==w.width||N!==w.height?{reset:{rects:!0}}:{}}}};function Fo(){return typeof window<"u"}function qa(r){return H0(r)?(r.nodeName||"").toLowerCase():"#document"}function ks(r){var a;return(r==null||(a=r.ownerDocument)==null?void 0:a.defaultView)||window}function dr(r){var a;return(a=(H0(r)?r.ownerDocument:r.document)||window.document)==null?void 0:a.documentElement}function H0(r){return Fo()?r instanceof Node||r instanceof ks(r).Node:!1}function Ys(r){return Fo()?r instanceof Element||r instanceof ks(r).Element:!1}function cr(r){return Fo()?r instanceof HTMLElement||r instanceof ks(r).HTMLElement:!1}function Nx(r){return!Fo()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof ks(r).ShadowRoot}const z4=new Set(["inline","contents"]);function Ql(r){const{overflow:a,overflowX:l,overflowY:i,display:c}=Qs(r);return/auto|scroll|overlay|hidden|clip/.test(a+i+l)&&!z4.has(c)}const $4=new Set(["table","td","th"]);function B4(r){return $4.has(qa(r))}const U4=[":popover-open",":modal"];function zo(r){return U4.some(a=>{try{return r.matches(a)}catch{return!1}})}const V4=["transform","translate","scale","rotate","perspective"],W4=["transform","translate","scale","rotate","perspective","filter"],H4=["paint","layout","strict","content"];function Qu(r){const a=qu(),l=Ys(r)?Qs(r):r;return V4.some(i=>l[i]?l[i]!=="none":!1)||(l.containerType?l.containerType!=="normal":!1)||!a&&(l.backdropFilter?l.backdropFilter!=="none":!1)||!a&&(l.filter?l.filter!=="none":!1)||W4.some(i=>(l.willChange||"").includes(i))||H4.some(i=>(l.contain||"").includes(i))}function K4(r){let a=xn(r);for(;cr(a)&&!Ua(a);){if(Qu(a))return a;if(zo(a))return null;a=xn(a)}return null}function qu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const G4=new Set(["html","body","#document"]);function Ua(r){return G4.has(qa(r))}function Qs(r){return ks(r).getComputedStyle(r)}function $o(r){return Ys(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function xn(r){if(qa(r)==="html")return r;const a=r.assignedSlot||r.parentNode||Nx(r)&&r.host||dr(r);return Nx(a)?a.host:a}function K0(r){const a=xn(r);return Ua(a)?r.ownerDocument?r.ownerDocument.body:r.body:cr(a)&&Ql(a)?a:K0(a)}function Wl(r,a,l){var i;a===void 0&&(a=[]),l===void 0&&(l=!0);const c=K0(r),d=c===((i=r.ownerDocument)==null?void 0:i.body),m=ks(c);if(d){const f=pu(m);return a.concat(m,m.visualViewport||[],Ql(c)?c:[],f&&l?Wl(f):[])}return a.concat(c,Wl(c,[],l))}function pu(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function G0(r){const a=Qs(r);let l=parseFloat(a.width)||0,i=parseFloat(a.height)||0;const c=cr(r),d=c?r.offsetWidth:l,m=c?r.offsetHeight:i,f=wo(l)!==d||wo(i)!==m;return f&&(l=d,i=m),{width:l,height:i,$:f}}function Xu(r){return Ys(r)?r:r.contextElement}function za(r){const a=Xu(r);if(!cr(a))return or(1);const l=a.getBoundingClientRect(),{width:i,height:c,$:d}=G0(a);let m=(d?wo(l.width):l.width)/i,f=(d?wo(l.height):l.height)/c;return(!m||!Number.isFinite(m))&&(m=1),(!f||!Number.isFinite(f))&&(f=1),{x:m,y:f}}const Y4=or(0);function Y0(r){const a=ks(r);return!qu()||!a.visualViewport?Y4:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function Q4(r,a,l){return a===void 0&&(a=!1),!l||a&&l!==ks(r)?!1:a}function Jn(r,a,l,i){a===void 0&&(a=!1),l===void 0&&(l=!1);const c=r.getBoundingClientRect(),d=Xu(r);let m=or(1);a&&(i?Ys(i)&&(m=za(i)):m=za(r));const f=Q4(d,l,i)?Y0(d):or(0);let p=(c.left+f.x)/m.x,y=(c.top+f.y)/m.y,g=c.width/m.x,v=c.height/m.y;if(d){const k=ks(d),P=i&&Ys(i)?ks(i):i;let T=k,N=pu(T);for(;N&&i&&P!==T;){const j=za(N),C=N.getBoundingClientRect(),E=Qs(N),b=C.left+(N.clientLeft+parseFloat(E.paddingLeft))*j.x,R=C.top+(N.clientTop+parseFloat(E.paddingTop))*j.y;p*=j.x,y*=j.y,g*=j.x,v*=j.y,p+=b,y+=R,T=ks(N),N=pu(T)}}return Co({width:g,height:v,x:p,y})}function Bo(r,a){const l=$o(r).scrollLeft;return a?a.left+l:Jn(dr(r)).left+l}function Q0(r,a){const l=r.getBoundingClientRect(),i=l.left+a.scrollLeft-Bo(r,l),c=l.top+a.scrollTop;return{x:i,y:c}}function q4(r){let{elements:a,rect:l,offsetParent:i,strategy:c}=r;const d=c==="fixed",m=dr(i),f=a?zo(a.floating):!1;if(i===m||f&&d)return l;let p={scrollLeft:0,scrollTop:0},y=or(1);const g=or(0),v=cr(i);if((v||!v&&!d)&&((qa(i)!=="body"||Ql(m))&&(p=$o(i)),cr(i))){const P=Jn(i);y=za(i),g.x=P.x+i.clientLeft,g.y=P.y+i.clientTop}const k=m&&!v&&!d?Q0(m,p):or(0);return{width:l.width*y.x,height:l.height*y.y,x:l.x*y.x-p.scrollLeft*y.x+g.x+k.x,y:l.y*y.y-p.scrollTop*y.y+g.y+k.y}}function X4(r){return Array.from(r.getClientRects())}function J4(r){const a=dr(r),l=$o(r),i=r.ownerDocument.body,c=Cs(a.scrollWidth,a.clientWidth,i.scrollWidth,i.clientWidth),d=Cs(a.scrollHeight,a.clientHeight,i.scrollHeight,i.clientHeight);let m=-l.scrollLeft+Bo(r);const f=-l.scrollTop;return Qs(i).direction==="rtl"&&(m+=Cs(a.clientWidth,i.clientWidth)-c),{width:c,height:d,x:m,y:f}}const wx=25;function Z4(r,a){const l=ks(r),i=dr(r),c=l.visualViewport;let d=i.clientWidth,m=i.clientHeight,f=0,p=0;if(c){d=c.width,m=c.height;const g=qu();(!g||g&&a==="fixed")&&(f=c.offsetLeft,p=c.offsetTop)}const y=Bo(i);if(y<=0){const g=i.ownerDocument,v=g.body,k=getComputedStyle(v),P=g.compatMode==="CSS1Compat"&&parseFloat(k.marginLeft)+parseFloat(k.marginRight)||0,T=Math.abs(i.clientWidth-v.clientWidth-P);T<=wx&&(d-=T)}else y<=wx&&(d+=y);return{width:d,height:m,x:f,y:p}}const eS=new Set(["absolute","fixed"]);function tS(r,a){const l=Jn(r,!0,a==="fixed"),i=l.top+r.clientTop,c=l.left+r.clientLeft,d=cr(r)?za(r):or(1),m=r.clientWidth*d.x,f=r.clientHeight*d.y,p=c*d.x,y=i*d.y;return{width:m,height:f,x:p,y}}function Sx(r,a,l){let i;if(a==="viewport")i=Z4(r,l);else if(a==="document")i=J4(dr(r));else if(Ys(a))i=tS(a,l);else{const c=Y0(r);i={x:a.x-c.x,y:a.y-c.y,width:a.width,height:a.height}}return Co(i)}function q0(r,a){const l=xn(r);return l===a||!Ys(l)||Ua(l)?!1:Qs(l).position==="fixed"||q0(l,a)}function sS(r,a){const l=a.get(r);if(l)return l;let i=Wl(r,[],!1).filter(f=>Ys(f)&&qa(f)!=="body"),c=null;const d=Qs(r).position==="fixed";let m=d?xn(r):r;for(;Ys(m)&&!Ua(m);){const f=Qs(m),p=Qu(m);!p&&f.position==="fixed"&&(c=null),(d?!p&&!c:!p&&f.position==="static"&&!!c&&eS.has(c.position)||Ql(m)&&!p&&q0(r,m))?i=i.filter(g=>g!==m):c=f,m=xn(m)}return a.set(r,i),i}function rS(r){let{element:a,boundary:l,rootBoundary:i,strategy:c}=r;const m=[...l==="clippingAncestors"?zo(a)?[]:sS(a,this._c):[].concat(l),i],f=m[0],p=m.reduce((y,g)=>{const v=Sx(a,g,c);return y.top=Cs(v.top,y.top),y.right=fn(v.right,y.right),y.bottom=fn(v.bottom,y.bottom),y.left=Cs(v.left,y.left),y},Sx(a,f,c));return{width:p.right-p.left,height:p.bottom-p.top,x:p.left,y:p.top}}function nS(r){const{width:a,height:l}=G0(r);return{width:a,height:l}}function aS(r,a,l){const i=cr(a),c=dr(a),d=l==="fixed",m=Jn(r,!0,d,a);let f={scrollLeft:0,scrollTop:0};const p=or(0);function y(){p.x=Bo(c)}if(i||!i&&!d)if((qa(a)!=="body"||Ql(c))&&(f=$o(a)),i){const P=Jn(a,!0,d,a);p.x=P.x+a.clientLeft,p.y=P.y+a.clientTop}else c&&y();d&&!i&&c&&y();const g=c&&!i&&!d?Q0(c,f):or(0),v=m.left+f.scrollLeft-p.x-g.x,k=m.top+f.scrollTop-p.y-g.y;return{x:v,y:k,width:m.width,height:m.height}}function Kd(r){return Qs(r).position==="static"}function Cx(r,a){if(!cr(r)||Qs(r).position==="fixed")return null;if(a)return a(r);let l=r.offsetParent;return dr(r)===l&&(l=l.ownerDocument.body),l}function X0(r,a){const l=ks(r);if(zo(r))return l;if(!cr(r)){let c=xn(r);for(;c&&!Ua(c);){if(Ys(c)&&!Kd(c))return c;c=xn(c)}return l}let i=Cx(r,a);for(;i&&B4(i)&&Kd(i);)i=Cx(i,a);return i&&Ua(i)&&Kd(i)&&!Qu(i)?l:i||K4(r)||l}const lS=async function(r){const a=this.getOffsetParent||X0,l=this.getDimensions,i=await l(r.floating);return{reference:aS(r.reference,await a(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function iS(r){return Qs(r).direction==="rtl"}const oS={convertOffsetParentRelativeRectToViewportRelativeRect:q4,getDocumentElement:dr,getClippingRect:rS,getOffsetParent:X0,getElementRects:lS,getClientRects:X4,getDimensions:nS,getScale:za,isElement:Ys,isRTL:iS};function J0(r,a){return r.x===a.x&&r.y===a.y&&r.width===a.width&&r.height===a.height}function cS(r,a){let l=null,i;const c=dr(r);function d(){var f;clearTimeout(i),(f=l)==null||f.disconnect(),l=null}function m(f,p){f===void 0&&(f=!1),p===void 0&&(p=1),d();const y=r.getBoundingClientRect(),{left:g,top:v,width:k,height:P}=y;if(f||a(),!k||!P)return;const T=oo(v),N=oo(c.clientWidth-(g+k)),j=oo(c.clientHeight-(v+P)),C=oo(g),b={rootMargin:-T+"px "+-N+"px "+-j+"px "+-C+"px",threshold:Cs(0,fn(1,p))||1};let R=!0;function G(X){const L=X[0].intersectionRatio;if(L!==p){if(!R)return m();L?m(!1,L):i=setTimeout(()=>{m(!1,1e-7)},1e3)}L===1&&!J0(y,r.getBoundingClientRect())&&m(),R=!1}try{l=new IntersectionObserver(G,{...b,root:c.ownerDocument})}catch{l=new IntersectionObserver(G,b)}l.observe(r)}return m(!0),d}function dS(r,a,l,i){i===void 0&&(i={});const{ancestorScroll:c=!0,ancestorResize:d=!0,elementResize:m=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:p=!1}=i,y=Xu(r),g=c||d?[...y?Wl(y):[],...Wl(a)]:[];g.forEach(C=>{c&&C.addEventListener("scroll",l,{passive:!0}),d&&C.addEventListener("resize",l)});const v=y&&f?cS(y,l):null;let k=-1,P=null;m&&(P=new ResizeObserver(C=>{let[E]=C;E&&E.target===y&&P&&(P.unobserve(a),cancelAnimationFrame(k),k=requestAnimationFrame(()=>{var b;(b=P)==null||b.observe(a)})),l()}),y&&!p&&P.observe(y),P.observe(a));let T,N=p?Jn(r):null;p&&j();function j(){const C=Jn(r);N&&!J0(N,C)&&l(),N=C,T=requestAnimationFrame(j)}return l(),()=>{var C;g.forEach(E=>{c&&E.removeEventListener("scroll",l),d&&E.removeEventListener("resize",l)}),v==null||v(),(C=P)==null||C.disconnect(),P=null,p&&cancelAnimationFrame(T)}}const uS=D4,hS=L4,mS=_4,fS=F4,xS=M4,kx=I4,pS=O4,gS=(r,a,l)=>{const i=new Map,c={platform:oS,...l},d={...c.platform,_c:i};return R4(r,a,{...c,platform:d})};var yS=typeof document<"u",vS=function(){},fo=yS?u.useLayoutEffect:vS;function ko(r,a){if(r===a)return!0;if(typeof r!=typeof a)return!1;if(typeof r=="function"&&r.toString()===a.toString())return!0;let l,i,c;if(r&&a&&typeof r=="object"){if(Array.isArray(r)){if(l=r.length,l!==a.length)return!1;for(i=l;i--!==0;)if(!ko(r[i],a[i]))return!1;return!0}if(c=Object.keys(r),l=c.length,l!==Object.keys(a).length)return!1;for(i=l;i--!==0;)if(!{}.hasOwnProperty.call(a,c[i]))return!1;for(i=l;i--!==0;){const d=c[i];if(!(d==="_owner"&&r.$$typeof)&&!ko(r[d],a[d]))return!1}return!0}return r!==r&&a!==a}function Z0(r){return typeof window>"u"?1:(r.ownerDocument.defaultView||window).devicePixelRatio||1}function Ex(r,a){const l=Z0(r);return Math.round(a*l)/l}function Gd(r){const a=u.useRef(r);return fo(()=>{a.current=r}),a}function bS(r){r===void 0&&(r={});const{placement:a="bottom",strategy:l="absolute",middleware:i=[],platform:c,elements:{reference:d,floating:m}={},transform:f=!0,whileElementsMounted:p,open:y}=r,[g,v]=u.useState({x:0,y:0,strategy:l,placement:a,middlewareData:{},isPositioned:!1}),[k,P]=u.useState(i);ko(k,i)||P(i);const[T,N]=u.useState(null),[j,C]=u.useState(null),E=u.useCallback(O=>{O!==X.current&&(X.current=O,N(O))},[]),b=u.useCallback(O=>{O!==L.current&&(L.current=O,C(O))},[]),R=d||T,G=m||j,X=u.useRef(null),L=u.useRef(null),I=u.useRef(g),w=p!=null,V=Gd(p),te=Gd(c),ie=Gd(y),Y=u.useCallback(()=>{if(!X.current||!L.current)return;const O={placement:a,strategy:l,middleware:k};te.current&&(O.platform=te.current),gS(X.current,L.current,O).then(re=>{const H={...re,isPositioned:ie.current!==!1};ne.current&&!ko(I.current,H)&&(I.current=H,Hl.flushSync(()=>{v(H)}))})},[k,a,l,te,ie]);fo(()=>{y===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,v(O=>({...O,isPositioned:!1})))},[y]);const ne=u.useRef(!1);fo(()=>(ne.current=!0,()=>{ne.current=!1}),[]),fo(()=>{if(R&&(X.current=R),G&&(L.current=G),R&&G){if(V.current)return V.current(R,G,Y);Y()}},[R,G,Y,V,w]);const _=u.useMemo(()=>({reference:X,floating:L,setReference:E,setFloating:b}),[E,b]),Q=u.useMemo(()=>({reference:R,floating:G}),[R,G]),ue=u.useMemo(()=>{const O={position:l,left:0,top:0};if(!Q.floating)return O;const re=Ex(Q.floating,g.x),H=Ex(Q.floating,g.y);return f?{...O,transform:"translate("+re+"px, "+H+"px)",...Z0(Q.floating)>=1.5&&{willChange:"transform"}}:{position:l,left:re,top:H}},[l,f,Q.floating,g.x,g.y]);return u.useMemo(()=>({...g,update:Y,refs:_,elements:Q,floatingStyles:ue}),[g,Y,_,Q,ue])}const jS=r=>{function a(l){return{}.hasOwnProperty.call(l,"current")}return{name:"arrow",options:r,fn(l){const{element:i,padding:c}=typeof r=="function"?r(l):r;return i&&a(i)?i.current!=null?kx({element:i.current,padding:c}).fn(l):{}:i?kx({element:i,padding:c}).fn(l):{}}}},NS=(r,a)=>({...uS(r),options:[r,a]}),wS=(r,a)=>({...hS(r),options:[r,a]}),SS=(r,a)=>({...pS(r),options:[r,a]}),CS=(r,a)=>({...mS(r),options:[r,a]}),kS=(r,a)=>({...fS(r),options:[r,a]}),ES=(r,a)=>({...xS(r),options:[r,a]}),PS=(r,a)=>({...jS(r),options:[r,a]});var TS="Arrow",eg=u.forwardRef((r,a)=>{const{children:l,width:i=10,height:c=5,...d}=r;return e.jsx(Je.svg,{...d,ref:a,width:i,height:c,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:r.asChild?l:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});eg.displayName=TS;var RS=eg,Ju="Popper",[tg,sg]=vn(Ju),[IS,rg]=tg(Ju),ng=r=>{const{__scopePopper:a,children:l}=r,[i,c]=u.useState(null);return e.jsx(IS,{scope:a,anchor:i,onAnchorChange:c,children:l})};ng.displayName=Ju;var ag="PopperAnchor",lg=u.forwardRef((r,a)=>{const{__scopePopper:l,virtualRef:i,...c}=r,d=rg(ag,l),m=u.useRef(null),f=it(a,m),p=u.useRef(null);return u.useEffect(()=>{const y=p.current;p.current=(i==null?void 0:i.current)||m.current,y!==p.current&&d.onAnchorChange(p.current)}),i?null:e.jsx(Je.div,{...c,ref:f})});lg.displayName=ag;var Zu="PopperContent",[_S,MS]=tg(Zu),ig=u.forwardRef((r,a)=>{var q,ye,Ce,F,xe,Pe;const{__scopePopper:l,side:i="bottom",sideOffset:c=0,align:d="center",alignOffset:m=0,arrowPadding:f=0,avoidCollisions:p=!0,collisionBoundary:y=[],collisionPadding:g=0,sticky:v="partial",hideWhenDetached:k=!1,updatePositionStrategy:P="optimized",onPlaced:T,...N}=r,j=rg(Zu,l),[C,E]=u.useState(null),b=it(a,Ve=>E(Ve)),[R,G]=u.useState(null),X=Wu(R),L=(X==null?void 0:X.width)??0,I=(X==null?void 0:X.height)??0,w=i+(d!=="center"?"-"+d:""),V=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},te=Array.isArray(y)?y:[y],ie=te.length>0,Y={padding:V,boundary:te.filter(DS),altBoundary:ie},{refs:ne,floatingStyles:_,placement:Q,isPositioned:ue,middlewareData:O}=bS({strategy:"fixed",placement:w,whileElementsMounted:(...Ve)=>dS(...Ve,{animationFrame:P==="always"}),elements:{reference:j.anchor},middleware:[NS({mainAxis:c+I,alignmentAxis:m}),p&&wS({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?SS():void 0,...Y}),p&&CS({...Y}),kS({...Y,apply:({elements:Ve,rects:He,availableWidth:Ke,availableHeight:tt})=>{const{width:$e,height:me}=He.reference,pe=Ve.floating.style;pe.setProperty("--radix-popper-available-width",`${Ke}px`),pe.setProperty("--radix-popper-available-height",`${tt}px`),pe.setProperty("--radix-popper-anchor-width",`${$e}px`),pe.setProperty("--radix-popper-anchor-height",`${me}px`)}}),R&&PS({element:R,padding:f}),LS({arrowWidth:L,arrowHeight:I}),k&&ES({strategy:"referenceHidden",...Y})]}),[re,H]=dg(Q),A=mn(T);ts(()=>{ue&&(A==null||A())},[ue,A]);const $=(q=O.arrow)==null?void 0:q.x,z=(ye=O.arrow)==null?void 0:ye.y,ee=((Ce=O.arrow)==null?void 0:Ce.centerOffset)!==0,[K,de]=u.useState();return ts(()=>{C&&de(window.getComputedStyle(C).zIndex)},[C]),e.jsx("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{..._,transform:ue?_.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:K,"--radix-popper-transform-origin":[(F=O.transformOrigin)==null?void 0:F.x,(xe=O.transformOrigin)==null?void 0:xe.y].join(" "),...((Pe=O.hide)==null?void 0:Pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:r.dir,children:e.jsx(_S,{scope:l,placedSide:re,onArrowChange:G,arrowX:$,arrowY:z,shouldHideArrow:ee,children:e.jsx(Je.div,{"data-side":re,"data-align":H,...N,ref:b,style:{...N.style,animation:ue?void 0:"none"}})})})});ig.displayName=Zu;var og="PopperArrow",AS={top:"bottom",right:"left",bottom:"top",left:"right"},cg=u.forwardRef(function(a,l){const{__scopePopper:i,...c}=a,d=MS(og,i),m=AS[d.placedSide];return e.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[m]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:e.jsx(RS,{...c,ref:l,style:{...c.style,display:"block"}})})});cg.displayName=og;function DS(r){return r!==null}var LS=r=>({name:"transformOrigin",options:r,fn(a){var j,C,E;const{placement:l,rects:i,middlewareData:c}=a,m=((j=c.arrow)==null?void 0:j.centerOffset)!==0,f=m?0:r.arrowWidth,p=m?0:r.arrowHeight,[y,g]=dg(l),v={start:"0%",center:"50%",end:"100%"}[g],k=(((C=c.arrow)==null?void 0:C.x)??0)+f/2,P=(((E=c.arrow)==null?void 0:E.y)??0)+p/2;let T="",N="";return y==="bottom"?(T=m?v:`${k}px`,N=`${-p}px`):y==="top"?(T=m?v:`${k}px`,N=`${i.floating.height+p}px`):y==="right"?(T=`${-p}px`,N=m?v:`${P}px`):y==="left"&&(T=`${i.floating.width+p}px`,N=m?v:`${P}px`),{data:{x:T,y:N}}}});function dg(r){const[a,l="center"]=r.split("-");return[a,l]}var OS=ng,FS=lg,zS=ig,$S=cg,ug=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),BS="VisuallyHidden",US=u.forwardRef((r,a)=>e.jsx(Je.span,{...r,ref:a,style:{...ug,...r.style}}));US.displayName=BS;var VS=[" ","Enter","ArrowUp","ArrowDown"],WS=[" ","Enter"],Zn="Select",[Uo,Vo,HS]=Bu(Zn),[Xa]=vn(Zn,[HS,sg]),Wo=sg(),[KS,bn]=Xa(Zn),[GS,YS]=Xa(Zn),hg=r=>{const{__scopeSelect:a,children:l,open:i,defaultOpen:c,onOpenChange:d,value:m,defaultValue:f,onValueChange:p,dir:y,name:g,autoComplete:v,disabled:k,required:P,form:T}=r,N=Wo(a),[j,C]=u.useState(null),[E,b]=u.useState(null),[R,G]=u.useState(!1),X=Ao(y),[L,I]=Qn({prop:i,defaultProp:c??!1,onChange:d,caller:Zn}),[w,V]=Qn({prop:m,defaultProp:f,onChange:p,caller:Zn}),te=u.useRef(null),ie=j?T||!!j.closest("form"):!0,[Y,ne]=u.useState(new Set),_=Array.from(Y).map(Q=>Q.props.value).join(";");return e.jsx(OS,{...N,children:e.jsxs(KS,{required:P,scope:a,trigger:j,onTriggerChange:C,valueNode:E,onValueNodeChange:b,valueNodeHasChildren:R,onValueNodeHasChildrenChange:G,contentId:un(),value:w,onValueChange:V,open:L,onOpenChange:I,dir:X,triggerPointerDownPosRef:te,disabled:k,children:[e.jsx(Uo.Provider,{scope:a,children:e.jsx(GS,{scope:r.__scopeSelect,onNativeOptionAdd:u.useCallback(Q=>{ne(ue=>new Set(ue).add(Q))},[]),onNativeOptionRemove:u.useCallback(Q=>{ne(ue=>{const O=new Set(ue);return O.delete(Q),O})},[]),children:l})}),ie?e.jsxs(Ag,{"aria-hidden":!0,required:P,tabIndex:-1,name:g,autoComplete:v,value:w,onChange:Q=>V(Q.target.value),disabled:k,form:T,children:[w===void 0?e.jsx("option",{value:""}):null,Array.from(Y)]},_):null]})})};hg.displayName=Zn;var mg="SelectTrigger",fg=u.forwardRef((r,a)=>{const{__scopeSelect:l,disabled:i=!1,...c}=r,d=Wo(l),m=bn(mg,l),f=m.disabled||i,p=it(a,m.onTriggerChange),y=Vo(l),g=u.useRef("touch"),[v,k,P]=Lg(N=>{const j=y().filter(b=>!b.disabled),C=j.find(b=>b.value===m.value),E=Og(j,N,C);E!==void 0&&m.onValueChange(E.value)}),T=N=>{f||(m.onOpenChange(!0),P()),N&&(m.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return e.jsx(FS,{asChild:!0,...d,children:e.jsx(Je.button,{type:"button",role:"combobox","aria-controls":m.contentId,"aria-expanded":m.open,"aria-required":m.required,"aria-autocomplete":"none",dir:m.dir,"data-state":m.open?"open":"closed",disabled:f,"data-disabled":f?"":void 0,"data-placeholder":Dg(m.value)?"":void 0,...c,ref:p,onClick:Ye(c.onClick,N=>{N.currentTarget.focus(),g.current!=="mouse"&&T(N)}),onPointerDown:Ye(c.onPointerDown,N=>{g.current=N.pointerType;const j=N.target;j.hasPointerCapture(N.pointerId)&&j.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(T(N),N.preventDefault())}),onKeyDown:Ye(c.onKeyDown,N=>{const j=v.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&k(N.key),!(j&&N.key===" ")&&VS.includes(N.key)&&(T(),N.preventDefault())})})})});fg.displayName=mg;var xg="SelectValue",pg=u.forwardRef((r,a)=>{const{__scopeSelect:l,className:i,style:c,children:d,placeholder:m="",...f}=r,p=bn(xg,l),{onValueNodeHasChildrenChange:y}=p,g=d!==void 0,v=it(a,p.onValueNodeChange);return ts(()=>{y(g)},[y,g]),e.jsx(Je.span,{...f,ref:v,style:{pointerEvents:"none"},children:Dg(p.value)?e.jsx(e.Fragment,{children:m}):d})});pg.displayName=xg;var QS="SelectIcon",gg=u.forwardRef((r,a)=>{const{__scopeSelect:l,children:i,...c}=r;return e.jsx(Je.span,{"aria-hidden":!0,...c,ref:a,children:i||"▼"})});gg.displayName=QS;var qS="SelectPortal",yg=r=>e.jsx(Du,{asChild:!0,...r});yg.displayName=qS;var ea="SelectContent",vg=u.forwardRef((r,a)=>{const l=bn(ea,r.__scopeSelect),[i,c]=u.useState();if(ts(()=>{c(new DocumentFragment)},[]),!l.open){const d=i;return d?Hl.createPortal(e.jsx(bg,{scope:r.__scopeSelect,children:e.jsx(Uo.Slot,{scope:r.__scopeSelect,children:e.jsx("div",{children:r.children})})}),d):null}return e.jsx(jg,{...r,ref:a})});vg.displayName=ea;var Ks=10,[bg,jn]=Xa(ea),XS="SelectContentImpl",JS=Vl("SelectContent.RemoveScroll"),jg=u.forwardRef((r,a)=>{const{__scopeSelect:l,position:i="item-aligned",onCloseAutoFocus:c,onEscapeKeyDown:d,onPointerDownOutside:m,side:f,sideOffset:p,align:y,alignOffset:g,arrowPadding:v,collisionBoundary:k,collisionPadding:P,sticky:T,hideWhenDetached:N,avoidCollisions:j,...C}=r,E=bn(ea,l),[b,R]=u.useState(null),[G,X]=u.useState(null),L=it(a,q=>R(q)),[I,w]=u.useState(null),[V,te]=u.useState(null),ie=Vo(l),[Y,ne]=u.useState(!1),_=u.useRef(!1);u.useEffect(()=>{if(b)return Op(b)},[b]),Pp();const Q=u.useCallback(q=>{const[ye,...Ce]=ie().map(Pe=>Pe.ref.current),[F]=Ce.slice(-1),xe=document.activeElement;for(const Pe of q)if(Pe===xe||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===ye&&G&&(G.scrollTop=0),Pe===F&&G&&(G.scrollTop=G.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==xe))return},[ie,G]),ue=u.useCallback(()=>Q([I,b]),[Q,I,b]);u.useEffect(()=>{Y&&ue()},[Y,ue]);const{onOpenChange:O,triggerPointerDownPosRef:re}=E;u.useEffect(()=>{if(b){let q={x:0,y:0};const ye=F=>{var xe,Pe;q={x:Math.abs(Math.round(F.pageX)-(((xe=re.current)==null?void 0:xe.x)??0)),y:Math.abs(Math.round(F.pageY)-(((Pe=re.current)==null?void 0:Pe.y)??0))}},Ce=F=>{q.x<=10&&q.y<=10?F.preventDefault():b.contains(F.target)||O(!1),document.removeEventListener("pointermove",ye),re.current=null};return re.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",Ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",Ce,{capture:!0})}}},[b,O,re]),u.useEffect(()=>{const q=()=>O(!1);return window.addEventListener("blur",q),window.addEventListener("resize",q),()=>{window.removeEventListener("blur",q),window.removeEventListener("resize",q)}},[O]);const[H,A]=Lg(q=>{const ye=ie().filter(xe=>!xe.disabled),Ce=ye.find(xe=>xe.ref.current===document.activeElement),F=Og(ye,q,Ce);F&&setTimeout(()=>F.ref.current.focus())}),$=u.useCallback((q,ye,Ce)=>{const F=!_.current&&!Ce;(E.value!==void 0&&E.value===ye||F)&&(w(q),F&&(_.current=!0))},[E.value]),z=u.useCallback(()=>b==null?void 0:b.focus(),[b]),ee=u.useCallback((q,ye,Ce)=>{const F=!_.current&&!Ce;(E.value!==void 0&&E.value===ye||F)&&te(q)},[E.value]),K=i==="popper"?gu:Ng,de=K===gu?{side:f,sideOffset:p,align:y,alignOffset:g,arrowPadding:v,collisionBoundary:k,collisionPadding:P,sticky:T,hideWhenDetached:N,avoidCollisions:j}:{};return e.jsx(bg,{scope:l,content:b,viewport:G,onViewportChange:X,itemRefCallback:$,selectedItem:I,onItemLeave:z,itemTextRefCallback:ee,focusSelectedItem:ue,selectedItemText:V,position:i,isPositioned:Y,searchRef:H,children:e.jsx(Lu,{as:JS,allowPinchZoom:!0,children:e.jsx(Au,{asChild:!0,trapped:E.open,onMountAutoFocus:q=>{q.preventDefault()},onUnmountAutoFocus:Ye(c,q=>{var ye;(ye=E.trigger)==null||ye.focus({preventScroll:!0}),q.preventDefault()}),children:e.jsx(Mu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:q=>q.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:e.jsx(K,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:q=>q.preventDefault(),...C,...de,onPlaced:()=>ne(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:Ye(C.onKeyDown,q=>{const ye=q.ctrlKey||q.altKey||q.metaKey;if(q.key==="Tab"&&q.preventDefault(),!ye&&q.key.length===1&&A(q.key),["ArrowUp","ArrowDown","Home","End"].includes(q.key)){let F=ie().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);if(["ArrowUp","End"].includes(q.key)&&(F=F.slice().reverse()),["ArrowUp","ArrowDown"].includes(q.key)){const xe=q.target,Pe=F.indexOf(xe);F=F.slice(Pe+1)}setTimeout(()=>Q(F)),q.preventDefault()}})})})})})})});jg.displayName=XS;var ZS="SelectItemAlignedPosition",Ng=u.forwardRef((r,a)=>{const{__scopeSelect:l,onPlaced:i,...c}=r,d=bn(ea,l),m=jn(ea,l),[f,p]=u.useState(null),[y,g]=u.useState(null),v=it(a,L=>g(L)),k=Vo(l),P=u.useRef(!1),T=u.useRef(!0),{viewport:N,selectedItem:j,selectedItemText:C,focusSelectedItem:E}=m,b=u.useCallback(()=>{if(d.trigger&&d.valueNode&&f&&y&&N&&j&&C){const L=d.trigger.getBoundingClientRect(),I=y.getBoundingClientRect(),w=d.valueNode.getBoundingClientRect(),V=C.getBoundingClientRect();if(d.dir!=="rtl"){const xe=V.left-I.left,Pe=w.left-xe,Ve=L.left-Pe,He=L.width+Ve,Ke=Math.max(He,I.width),tt=window.innerWidth-Ks,$e=No(Pe,[Ks,Math.max(Ks,tt-Ke)]);f.style.minWidth=He+"px",f.style.left=$e+"px"}else{const xe=I.right-V.right,Pe=window.innerWidth-w.right-xe,Ve=window.innerWidth-L.right-Pe,He=L.width+Ve,Ke=Math.max(He,I.width),tt=window.innerWidth-Ks,$e=No(Pe,[Ks,Math.max(Ks,tt-Ke)]);f.style.minWidth=He+"px",f.style.right=$e+"px"}const te=k(),ie=window.innerHeight-Ks*2,Y=N.scrollHeight,ne=window.getComputedStyle(y),_=parseInt(ne.borderTopWidth,10),Q=parseInt(ne.paddingTop,10),ue=parseInt(ne.borderBottomWidth,10),O=parseInt(ne.paddingBottom,10),re=_+Q+Y+O+ue,H=Math.min(j.offsetHeight*5,re),A=window.getComputedStyle(N),$=parseInt(A.paddingTop,10),z=parseInt(A.paddingBottom,10),ee=L.top+L.height/2-Ks,K=ie-ee,de=j.offsetHeight/2,q=j.offsetTop+de,ye=_+Q+q,Ce=re-ye;if(ye<=ee){const xe=te.length>0&&j===te[te.length-1].ref.current;f.style.bottom="0px";const Pe=y.clientHeight-N.offsetTop-N.offsetHeight,Ve=Math.max(K,de+(xe?z:0)+Pe+ue),He=ye+Ve;f.style.height=He+"px"}else{const xe=te.length>0&&j===te[0].ref.current;f.style.top="0px";const Ve=Math.max(ee,_+N.offsetTop+(xe?$:0)+de)+Ce;f.style.height=Ve+"px",N.scrollTop=ye-ee+N.offsetTop}f.style.margin=`${Ks}px 0`,f.style.minHeight=H+"px",f.style.maxHeight=ie+"px",i==null||i(),requestAnimationFrame(()=>P.current=!0)}},[k,d.trigger,d.valueNode,f,y,N,j,C,d.dir,i]);ts(()=>b(),[b]);const[R,G]=u.useState();ts(()=>{y&&G(window.getComputedStyle(y).zIndex)},[y]);const X=u.useCallback(L=>{L&&T.current===!0&&(b(),E==null||E(),T.current=!1)},[b,E]);return e.jsx(t3,{scope:l,contentWrapper:f,shouldExpandOnScrollRef:P,onScrollButtonChange:X,children:e.jsx("div",{ref:p,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:e.jsx(Je.div,{...c,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});Ng.displayName=ZS;var e3="SelectPopperPosition",gu=u.forwardRef((r,a)=>{const{__scopeSelect:l,align:i="start",collisionPadding:c=Ks,...d}=r,m=Wo(l);return e.jsx(zS,{...m,...d,ref:a,align:i,collisionPadding:c,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});gu.displayName=e3;var[t3,eh]=Xa(ea,{}),yu="SelectViewport",wg=u.forwardRef((r,a)=>{const{__scopeSelect:l,nonce:i,...c}=r,d=jn(yu,l),m=eh(yu,l),f=it(a,d.onViewportChange),p=u.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),e.jsx(Uo.Slot,{scope:l,children:e.jsx(Je.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:Ye(c.onScroll,y=>{const g=y.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:k}=m;if(k!=null&&k.current&&v){const P=Math.abs(p.current-g.scrollTop);if(P>0){const T=window.innerHeight-Ks*2,N=parseFloat(v.style.minHeight),j=parseFloat(v.style.height),C=Math.max(N,j);if(C0?R:0,v.style.justifyContent="flex-end")}}}p.current=g.scrollTop})})})]})});wg.displayName=yu;var Sg="SelectGroup",[s3,r3]=Xa(Sg),n3=u.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r,c=un();return e.jsx(s3,{scope:l,id:c,children:e.jsx(Je.div,{role:"group","aria-labelledby":c,...i,ref:a})})});n3.displayName=Sg;var Cg="SelectLabel",a3=u.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r,c=r3(Cg,l);return e.jsx(Je.div,{id:c.id,...i,ref:a})});a3.displayName=Cg;var Eo="SelectItem",[l3,kg]=Xa(Eo),Eg=u.forwardRef((r,a)=>{const{__scopeSelect:l,value:i,disabled:c=!1,textValue:d,...m}=r,f=bn(Eo,l),p=jn(Eo,l),y=f.value===i,[g,v]=u.useState(d??""),[k,P]=u.useState(!1),T=it(a,E=>{var b;return(b=p.itemRefCallback)==null?void 0:b.call(p,E,i,c)}),N=un(),j=u.useRef("touch"),C=()=>{c||(f.onValueChange(i),f.onOpenChange(!1))};if(i==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(l3,{scope:l,value:i,disabled:c,textId:N,isSelected:y,onItemTextChange:u.useCallback(E=>{v(b=>b||((E==null?void 0:E.textContent)??"").trim())},[]),children:e.jsx(Uo.ItemSlot,{scope:l,value:i,disabled:c,textValue:g,children:e.jsx(Je.div,{role:"option","aria-labelledby":N,"data-highlighted":k?"":void 0,"aria-selected":y&&k,"data-state":y?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...m,ref:T,onFocus:Ye(m.onFocus,()=>P(!0)),onBlur:Ye(m.onBlur,()=>P(!1)),onClick:Ye(m.onClick,()=>{j.current!=="mouse"&&C()}),onPointerUp:Ye(m.onPointerUp,()=>{j.current==="mouse"&&C()}),onPointerDown:Ye(m.onPointerDown,E=>{j.current=E.pointerType}),onPointerMove:Ye(m.onPointerMove,E=>{var b;j.current=E.pointerType,c?(b=p.onItemLeave)==null||b.call(p):j.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ye(m.onPointerLeave,E=>{var b;E.currentTarget===document.activeElement&&((b=p.onItemLeave)==null||b.call(p))}),onKeyDown:Ye(m.onKeyDown,E=>{var R;((R=p.searchRef)==null?void 0:R.current)!==""&&E.key===" "||(WS.includes(E.key)&&C(),E.key===" "&&E.preventDefault())})})})})});Eg.displayName=Eo;var Dl="SelectItemText",Pg=u.forwardRef((r,a)=>{const{__scopeSelect:l,className:i,style:c,...d}=r,m=bn(Dl,l),f=jn(Dl,l),p=kg(Dl,l),y=YS(Dl,l),[g,v]=u.useState(null),k=it(a,C=>v(C),p.onItemTextChange,C=>{var E;return(E=f.itemTextRefCallback)==null?void 0:E.call(f,C,p.value,p.disabled)}),P=g==null?void 0:g.textContent,T=u.useMemo(()=>e.jsx("option",{value:p.value,disabled:p.disabled,children:P},p.value),[p.disabled,p.value,P]),{onNativeOptionAdd:N,onNativeOptionRemove:j}=y;return ts(()=>(N(T),()=>j(T)),[N,j,T]),e.jsxs(e.Fragment,{children:[e.jsx(Je.span,{id:p.textId,...d,ref:k}),p.isSelected&&m.valueNode&&!m.valueNodeHasChildren?Hl.createPortal(d.children,m.valueNode):null]})});Pg.displayName=Dl;var Tg="SelectItemIndicator",Rg=u.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r;return kg(Tg,l).isSelected?e.jsx(Je.span,{"aria-hidden":!0,...i,ref:a}):null});Rg.displayName=Tg;var vu="SelectScrollUpButton",Ig=u.forwardRef((r,a)=>{const l=jn(vu,r.__scopeSelect),i=eh(vu,r.__scopeSelect),[c,d]=u.useState(!1),m=it(a,i.onScrollButtonChange);return ts(()=>{if(l.viewport&&l.isPositioned){let f=function(){const y=p.scrollTop>0;d(y)};const p=l.viewport;return f(),p.addEventListener("scroll",f),()=>p.removeEventListener("scroll",f)}},[l.viewport,l.isPositioned]),c?e.jsx(Mg,{...r,ref:m,onAutoScroll:()=>{const{viewport:f,selectedItem:p}=l;f&&p&&(f.scrollTop=f.scrollTop-p.offsetHeight)}}):null});Ig.displayName=vu;var bu="SelectScrollDownButton",_g=u.forwardRef((r,a)=>{const l=jn(bu,r.__scopeSelect),i=eh(bu,r.__scopeSelect),[c,d]=u.useState(!1),m=it(a,i.onScrollButtonChange);return ts(()=>{if(l.viewport&&l.isPositioned){let f=function(){const y=p.scrollHeight-p.clientHeight,g=Math.ceil(p.scrollTop)p.removeEventListener("scroll",f)}},[l.viewport,l.isPositioned]),c?e.jsx(Mg,{...r,ref:m,onAutoScroll:()=>{const{viewport:f,selectedItem:p}=l;f&&p&&(f.scrollTop=f.scrollTop+p.offsetHeight)}}):null});_g.displayName=bu;var Mg=u.forwardRef((r,a)=>{const{__scopeSelect:l,onAutoScroll:i,...c}=r,d=jn("SelectScrollButton",l),m=u.useRef(null),f=Vo(l),p=u.useCallback(()=>{m.current!==null&&(window.clearInterval(m.current),m.current=null)},[]);return u.useEffect(()=>()=>p(),[p]),ts(()=>{var g;const y=f().find(v=>v.ref.current===document.activeElement);(g=y==null?void 0:y.ref.current)==null||g.scrollIntoView({block:"nearest"})},[f]),e.jsx(Je.div,{"aria-hidden":!0,...c,ref:a,style:{flexShrink:0,...c.style},onPointerDown:Ye(c.onPointerDown,()=>{m.current===null&&(m.current=window.setInterval(i,50))}),onPointerMove:Ye(c.onPointerMove,()=>{var y;(y=d.onItemLeave)==null||y.call(d),m.current===null&&(m.current=window.setInterval(i,50))}),onPointerLeave:Ye(c.onPointerLeave,()=>{p()})})}),i3="SelectSeparator",o3=u.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r;return e.jsx(Je.div,{"aria-hidden":!0,...i,ref:a})});o3.displayName=i3;var ju="SelectArrow",c3=u.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r,c=Wo(l),d=bn(ju,l),m=jn(ju,l);return d.open&&m.position==="popper"?e.jsx($S,{...c,...i,ref:a}):null});c3.displayName=ju;var d3="SelectBubbleInput",Ag=u.forwardRef(({__scopeSelect:r,value:a,...l},i)=>{const c=u.useRef(null),d=it(i,c),m=Vu(a);return u.useEffect(()=>{const f=c.current;if(!f)return;const p=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(p,"value").set;if(m!==a&&g){const v=new Event("change",{bubbles:!0});g.call(f,a),f.dispatchEvent(v)}},[m,a]),e.jsx(Je.select,{...l,style:{...ug,...l.style},ref:d,defaultValue:a})});Ag.displayName=d3;function Dg(r){return r===""||r===void 0}function Lg(r){const a=mn(r),l=u.useRef(""),i=u.useRef(0),c=u.useCallback(m=>{const f=l.current+m;a(f),(function p(y){l.current=y,window.clearTimeout(i.current),y!==""&&(i.current=window.setTimeout(()=>p(""),1e3))})(f)},[a]),d=u.useCallback(()=>{l.current="",window.clearTimeout(i.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(i.current),[]),[l,c,d]}function Og(r,a,l){const c=a.length>1&&Array.from(a).every(y=>y===a[0])?a[0]:a,d=l?r.indexOf(l):-1;let m=u3(r,Math.max(d,0));c.length===1&&(m=m.filter(y=>y!==l));const p=m.find(y=>y.textValue.toLowerCase().startsWith(c.toLowerCase()));return p!==l?p:void 0}function u3(r,a){return r.map((l,i)=>r[(a+i)%r.length])}var h3=hg,Fg=fg,m3=pg,f3=gg,x3=yg,zg=vg,p3=wg,$g=Eg,g3=Pg,y3=Rg,v3=Ig,b3=_g;const co=h3,uo=m3,Ll=u.forwardRef(({className:r,children:a,...l},i)=>e.jsxs(Fg,{ref:i,className:ot("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",r),...l,children:[a,e.jsx(f3,{asChild:!0,children:e.jsx(Bl,{className:"h-4 w-4 opacity-50"})})]}));Ll.displayName=Fg.displayName;const Ol=u.forwardRef(({className:r,children:a,position:l="popper",...i},c)=>e.jsx(x3,{children:e.jsxs(zg,{ref:c,className:ot("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",l==="popper"&&"data-[side=bottom]:translate-y-1",r),position:l,...i,children:[e.jsx(v3,{className:"flex cursor-default items-center justify-center py-1",children:e.jsx(Zx,{className:"h-4 w-4"})}),e.jsx(p3,{className:"p-1",children:a}),e.jsx(b3,{className:"flex cursor-default items-center justify-center py-1",children:e.jsx(Bl,{className:"h-4 w-4"})})]})}));Ol.displayName=zg.displayName;const Gn=u.forwardRef(({className:r,children:a,...l},i)=>e.jsxs($g,{ref:i,className:ot("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...l,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(y3,{children:e.jsx(Ro,{className:"h-4 w-4"})})}),e.jsx(g3,{children:a})]}));Gn.displayName=$g.displayName;const j3=["一","二","三","四","五","六","七","八","九","十"];function Yd(r){return r.startsWith("part:")?{type:"part",id:r.slice(5)}:r.startsWith("chapter:")?{type:"chapter",id:r.slice(8)}:r.startsWith("section:")?{type:"section",id:r.slice(8)}:null}function N3({parts:r,expandedParts:a,onTogglePart:l,onReorder:i,onReadSection:c,onDeleteSection:d,onAddSectionInPart:m,onAddChapterInPart:f,onDeleteChapter:p,onEditPart:y,onDeletePart:g,onEditChapter:v,selectedSectionIds:k=[],onToggleSectionSelect:P,onShowSectionOrders:T}){const[N,j]=u.useState(null),[C,E]=u.useState(null),b=(w,V)=>(N==null?void 0:N.type)===w&&(N==null?void 0:N.id)===V,R=(w,V)=>(C==null?void 0:C.type)===w&&(C==null?void 0:C.id)===V,G=u.useCallback(()=>{const w=[];for(const V of r)for(const te of V.chapters)for(const ie of te.sections)w.push({id:ie.id,partId:V.id,partTitle:V.title,chapterId:te.id,chapterTitle:te.title});return w},[r]),X=u.useCallback(async(w,V,te,ie)=>{var ue;w.preventDefault(),w.stopPropagation();const Y=w.dataTransfer.getData("text/plain"),ne=Yd(Y);if(!ne||ne.type===V&&ne.id===te)return;const _=G(),Q=new Map(_.map(O=>[O.id,O]));if(ne.type==="part"&&V==="part"){const O=r.map(z=>z.id),re=O.indexOf(ne.id),H=O.indexOf(te);if(re===-1||H===-1)return;const A=[...O];A.splice(re,1),A.splice(reK.id===z);if(ee)for(const K of ee.chapters)for(const de of K.sections){const q=Q.get(de.id);q&&$.push(q)}}await i($);return}if(ne.type==="chapter"&&(V==="chapter"||V==="section"||V==="part")){const O=r.find(q=>q.chapters.some(ye=>ye.id===ne.id)),re=O==null?void 0:O.chapters.find(q=>q.id===ne.id);if(!O||!re)return;let H,A,$=null;if(V==="section"){const q=Q.get(te);if(!q)return;H=q.partId,A=q.partTitle,$=te}else if(V==="chapter"){const q=r.find(F=>F.chapters.some(xe=>xe.id===te)),ye=q==null?void 0:q.chapters.find(F=>F.id===te);if(!q||!ye)return;H=q.id,A=q.title;const Ce=_.filter(F=>F.chapterId===te).pop();$=(Ce==null?void 0:Ce.id)??null}else{const q=r.find(Ce=>Ce.id===te);if(!q||!q.chapters[0])return;H=q.id,A=q.title;const ye=_.filter(Ce=>Ce.partId===q.id&&Ce.chapterId===q.chapters[0].id);$=((ue=ye[ye.length-1])==null?void 0:ue.id)??null}const z=re.sections.map(q=>q.id),ee=_.filter(q=>!z.includes(q.id));let K=ee.length;if($){const q=ee.findIndex(ye=>ye.id===$);q>=0&&(K=q+1)}const de=z.map(q=>({...Q.get(q),partId:H,partTitle:A,chapterId:re.id,chapterTitle:re.title}));await i([...ee.slice(0,K),...de,...ee.slice(K)]);return}if(ne.type==="section"&&(V==="section"||V==="chapter"||V==="part")){if(!ie)return;const{partId:O,partTitle:re,chapterId:H,chapterTitle:A}=ie;let $;if(V==="section")$=_.findIndex(ye=>ye.id===te);else if(V==="chapter"){const ye=_.filter(Ce=>Ce.chapterId===te).pop();$=ye?_.findIndex(Ce=>Ce.id===ye.id)+1:_.length}else{const ye=r.find(xe=>xe.id===te);if(!(ye!=null&&ye.chapters[0]))return;const Ce=_.filter(xe=>xe.partId===ye.id&&xe.chapterId===ye.chapters[0].id),F=Ce[Ce.length-1];$=F?_.findIndex(xe=>xe.id===F.id)+1:0}const z=_.findIndex(ye=>ye.id===ne.id);if(z===-1)return;const ee=_.filter(ye=>ye.id!==ne.id),K=z<$?$-1:$,q={..._[z],partId:O,partTitle:re,chapterId:H,chapterTitle:A};ee.splice(K,0,q),await i(ee)}},[r,G,i]),L=(w,V,te)=>({onDragEnter:ie=>{ie.preventDefault(),ie.stopPropagation(),ie.dataTransfer.dropEffect="move",E({type:w,id:V})},onDragOver:ie=>{ie.preventDefault(),ie.stopPropagation(),ie.dataTransfer.dropEffect="move",E({type:w,id:V})},onDragLeave:()=>E(null),onDrop:ie=>{E(null);const Y=Yd(ie.dataTransfer.getData("text/plain"));if(Y&&!(w==="section"&&Y.type==="section"&&Y.id===V))if(w==="part")if(Y.type==="part")X(ie,"part",V);else{const ne=r.find(Q=>Q.id===V);(ne==null?void 0:ne.chapters[0])&&te&&X(ie,"part",V,te)}else w==="chapter"&&te?(Y.type==="section"||Y.type==="chapter")&&X(ie,"chapter",V,te):w==="section"&&te&&X(ie,"section",V,te)}}),I=w=>j3[w]??String(w+1);return e.jsx("div",{className:"space-y-3",children:r.map((w,V)=>{var re,H,A,$;const te=w.title==="序言"||w.title.includes("序言"),ie=w.title==="尾声"||w.title.includes("尾声"),Y=w.title==="附录"||w.title.includes("附录"),ne=R("part",w.id),_=a.includes(w.id),Q=w.chapters.length,ue=w.chapters.reduce((z,ee)=>z+ee.sections.length,0);if(te&&w.chapters.length===1&&w.chapters[0].sections.length===1){const z=w.chapters[0].sections[0],ee=R("section",z.id),K={partId:w.id,partTitle:w.title,chapterId:w.chapters[0].id,chapterTitle:w.chapters[0].title};return e.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+z.id),de.dataTransfer.effectAllowed="move",j({type:"section",id:z.id})},onDragEnd:()=>{j(null),E(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${ee?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${b("section",z.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...L("section",z.id,K),children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[e.jsx(jr,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),P&&e.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:k.includes(z.id),onChange:()=>P(z.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),e.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:e.jsx(Fs,{className:"w-4 h-4 text-gray-400"})}),e.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[w.chapters[0].title," | ",z.title]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:de=>de.stopPropagation(),onClick:de=>de.stopPropagation(),children:[z.price===0||z.isFree?e.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):e.jsxs("span",{className:"text-xs text-gray-500",children:["¥",z.price]}),e.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",z.clickCount??0," · 付款 ",z.payCount??0]}),e.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(z.hotScore??0).toFixed(1)," · 第",z.hotRank&&z.hotRank>0?z.hotRank:"-","名"]}),T&&e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>T(z),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:e.jsx(mt,{className:"w-3.5 h-3.5"})}),e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>d(z),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:e.jsx(Gt,{className:"w-3.5 h-3.5"})})]})]})]},w.id)}if(w.title==="2026每日派对干货"||w.title.includes("2026每日派对干货")){const z=R("part",w.id);return e.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${z?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...L("part",w.id,{partId:w.id,partTitle:w.title,chapterId:((re=w.chapters[0])==null?void 0:re.id)??"",chapterTitle:((H=w.chapters[0])==null?void 0:H.title)??""}),children:[e.jsxs("div",{draggable:!0,onDragStart:ee=>{ee.stopPropagation(),ee.dataTransfer.setData("text/plain","part:"+w.id),ee.dataTransfer.effectAllowed="move",j({type:"part",id:w.id})},onDragEnd:()=>{j(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${b("part",w.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>l(w.id),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(jr,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),e.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-white text-base",children:w.title}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",ue," 节"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:ee=>ee.stopPropagation(),onClick:ee=>ee.stopPropagation(),children:[m&&e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>m(w),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:e.jsx(Rt,{className:"w-3.5 h-3.5"})}),y&&e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>y(w),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:e.jsx(mt,{className:"w-3.5 h-3.5"})}),g&&e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>g(w),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:e.jsx(Gt,{className:"w-3.5 h-3.5"})}),e.jsxs("span",{className:"text-xs text-gray-500",children:[Q,"章"]}),_?e.jsx(Bl,{className:"w-5 h-5 text-gray-500"}):e.jsx(Aa,{className:"w-5 h-5 text-gray-500"})]})]}),_&&w.chapters.length>0&&e.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:w.chapters.map(ee=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:ee.title}),e.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:K=>K.stopPropagation(),children:[v&&e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>v(w,ee),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:e.jsx(mt,{className:"w-3.5 h-3.5"})}),f&&e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>f(w),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:e.jsx(Rt,{className:"w-3.5 h-3.5"})}),p&&e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>p(w,ee),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:e.jsx(Gt,{className:"w-3.5 h-3.5"})})]})]}),e.jsx("div",{className:"space-y-1 pl-2",children:ee.sections.map(K=>{const de=R("section",K.id);return e.jsxs("div",{draggable:!0,onDragStart:q=>{q.stopPropagation(),q.dataTransfer.setData("text/plain","section:"+K.id),q.dataTransfer.effectAllowed="move",j({type:"section",id:K.id})},onDragEnd:()=>{j(null),E(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${de?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${b("section",K.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...L("section",K.id,{partId:w.id,partTitle:w.title,chapterId:ee.id,chapterTitle:ee.title}),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(jr,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),P&&e.jsx("label",{className:"shrink-0 flex items-center",onClick:q=>q.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:k.includes(K.id),onChange:()=>P(K.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),e.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[K.id," ",K.title]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",K.clickCount??0," · 付款 ",K.payCount??0]}),e.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(K.hotScore??0).toFixed(1)," · 第",K.hotRank&&K.hotRank>0?K.hotRank:"-","名"]}),T&&e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>T(K),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:e.jsx(mt,{className:"w-3.5 h-3.5"})}),e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>d(K),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:e.jsx(Gt,{className:"w-3.5 h-3.5"})})]})]},K.id)})})]},ee.id))})]},w.id)}if(Y)return e.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),e.jsx("div",{className:"space-y-3",children:w.chapters.map((z,ee)=>z.sections.length>0?z.sections.map(K=>{const de=R("section",K.id);return e.jsxs("div",{draggable:!0,onDragStart:q=>{q.stopPropagation(),q.dataTransfer.setData("text/plain","section:"+K.id),q.dataTransfer.effectAllowed="move",j({type:"section",id:K.id})},onDragEnd:()=>{j(null),E(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${de?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${b("section",K.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...L("section",K.id,{partId:w.id,partTitle:w.title,chapterId:z.id,chapterTitle:z.title}),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(jr,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),P&&e.jsx("label",{className:"shrink-0 flex items-center",onClick:q=>q.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:k.includes(K.id),onChange:()=>P(K.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),e.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",ee+1," | ",z.title," | ",K.title]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",K.clickCount??0," · 付款 ",K.payCount??0]}),e.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(K.hotScore??0).toFixed(1)," · 第",K.hotRank&&K.hotRank>0?K.hotRank:"-","名"]}),T&&e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>T(K),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),e.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>c(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:e.jsx(mt,{className:"w-3.5 h-3.5"})}),e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>d(K),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:e.jsx(Gt,{className:"w-3.5 h-3.5"})})]})]}),e.jsx(Aa,{className:"w-4 h-4 text-gray-500 shrink-0"})]},K.id)}):e.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[e.jsxs("span",{className:"text-sm text-gray-500",children:["附录",ee+1," | ",z.title,"(空)"]}),e.jsx(Aa,{className:"w-4 h-4 text-gray-500 shrink-0"})]},z.id))})]},w.id);if(ie&&w.chapters.length===1&&w.chapters[0].sections.length===1){const z=w.chapters[0].sections[0],ee=R("section",z.id),K={partId:w.id,partTitle:w.title,chapterId:w.chapters[0].id,chapterTitle:w.chapters[0].title};return e.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+z.id),de.dataTransfer.effectAllowed="move",j({type:"section",id:z.id})},onDragEnd:()=>{j(null),E(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${ee?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${b("section",z.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...L("section",z.id,K),children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[e.jsx(jr,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),P&&e.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:k.includes(z.id),onChange:()=>P(z.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),e.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:e.jsx(Fs,{className:"w-4 h-4 text-gray-400"})}),e.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[w.chapters[0].title," | ",z.title]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:de=>de.stopPropagation(),onClick:de=>de.stopPropagation(),children:[z.price===0||z.isFree?e.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):e.jsxs("span",{className:"text-xs text-gray-500",children:["¥",z.price]}),e.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",z.clickCount??0," · 付款 ",z.payCount??0]}),e.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(z.hotScore??0).toFixed(1)," · 第",z.hotRank&&z.hotRank>0?z.hotRank:"-","名"]}),T&&e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>T(z),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:e.jsx(mt,{className:"w-3.5 h-3.5"})}),e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>d(z),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:e.jsx(Gt,{className:"w-3.5 h-3.5"})})]})]})]},w.id)}return ie?e.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),e.jsx("div",{className:"space-y-3",children:w.chapters.map(z=>z.sections.map(ee=>{const K=R("section",ee.id);return e.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+ee.id),de.dataTransfer.effectAllowed="move",j({type:"section",id:ee.id})},onDragEnd:()=>{j(null),E(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${K?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${b("section",ee.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...L("section",ee.id,{partId:w.id,partTitle:w.title,chapterId:z.id,chapterTitle:z.title}),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(jr,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),P&&e.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:k.includes(ee.id),onChange:()=>P(ee.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),e.jsxs("span",{className:"text-sm text-gray-300",children:[z.title," | ",ee.title]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",ee.clickCount??0," · 付款 ",ee.payCount??0]}),e.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(ee.hotScore??0).toFixed(1)," · 第",ee.hotRank&&ee.hotRank>0?ee.hotRank:"-","名"]}),T&&e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>T(ee),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(ee),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:e.jsx(mt,{className:"w-3.5 h-3.5"})}),e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>d(ee),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:e.jsx(Gt,{className:"w-3.5 h-3.5"})})]})]})]},ee.id)}))})]},w.id):e.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${ne?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...L("part",w.id,{partId:w.id,partTitle:w.title,chapterId:((A=w.chapters[0])==null?void 0:A.id)??"",chapterTitle:(($=w.chapters[0])==null?void 0:$.title)??""}),children:[e.jsxs("div",{draggable:!0,onDragStart:z=>{z.stopPropagation(),z.dataTransfer.setData("text/plain","part:"+w.id),z.dataTransfer.effectAllowed="move",j({type:"part",id:w.id})},onDragEnd:()=>{j(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${b("part",w.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>l(w.id),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(jr,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),e.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:I(V)}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-white text-base",children:w.title}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",ue," 节"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:z=>z.stopPropagation(),onClick:z=>z.stopPropagation(),children:[m&&e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>m(w),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:e.jsx(Rt,{className:"w-3.5 h-3.5"})}),y&&e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>y(w),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:e.jsx(mt,{className:"w-3.5 h-3.5"})}),g&&e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>g(w),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:e.jsx(Gt,{className:"w-3.5 h-3.5"})}),e.jsxs("span",{className:"text-xs text-gray-500",children:[Q,"章"]}),_?e.jsx(Bl,{className:"w-5 h-5 text-gray-500"}):e.jsx(Aa,{className:"w-5 h-5 text-gray-500"})]})]}),_&&e.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:w.chapters.map(z=>{const ee=R("chapter",z.id);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsxs("div",{draggable:!0,onDragStart:K=>{K.stopPropagation(),K.dataTransfer.setData("text/plain","chapter:"+z.id),K.dataTransfer.effectAllowed="move",j({type:"chapter",id:z.id})},onDragEnd:()=>{j(null),E(null)},onDragEnter:K=>{K.preventDefault(),K.stopPropagation(),K.dataTransfer.dropEffect="move",E({type:"chapter",id:z.id})},onDragOver:K=>{K.preventDefault(),K.stopPropagation(),K.dataTransfer.dropEffect="move",E({type:"chapter",id:z.id})},onDragLeave:()=>E(null),onDrop:K=>{E(null);const de=Yd(K.dataTransfer.getData("text/plain"));if(!de)return;const q={partId:w.id,partTitle:w.title,chapterId:z.id,chapterTitle:z.title};(de.type==="section"||de.type==="chapter")&&X(K,"chapter",z.id,q)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${ee?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${b("chapter",z.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[e.jsx(jr,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),e.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:z.title})]}),e.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:K=>K.stopPropagation(),children:[v&&e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>v(w,z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:e.jsx(mt,{className:"w-3.5 h-3.5"})}),f&&e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>f(w),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:e.jsx(Rt,{className:"w-3.5 h-3.5"})}),p&&e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>p(w,z),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:e.jsx(Gt,{className:"w-3.5 h-3.5"})})]})]}),e.jsx("div",{className:"space-y-1 pl-2",children:z.sections.map(K=>{const de=R("section",K.id);return e.jsxs("div",{draggable:!0,onDragStart:q=>{q.stopPropagation(),q.dataTransfer.setData("text/plain","section:"+K.id),q.dataTransfer.effectAllowed="move",j({type:"section",id:K.id})},onDragEnd:()=>{j(null),E(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${de?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${b("section",K.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...L("section",K.id,{partId:w.id,partTitle:w.title,chapterId:z.id,chapterTitle:z.title}),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[P&&e.jsx("label",{className:"shrink-0 flex items-center",onClick:q=>q.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:k.includes(K.id),onChange:()=>P(K.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),e.jsx(jr,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),e.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${K.price===0||K.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),e.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[K.id," ",K.title]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:q=>q.stopPropagation(),onClick:q=>q.stopPropagation(),children:[K.isNew&&e.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),K.price===0||K.isFree?e.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):e.jsxs("span",{className:"text-xs text-gray-500",children:["¥",K.price]}),e.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",K.clickCount??0," · 付款 ",K.payCount??0]}),e.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(K.hotScore??0).toFixed(1)," · 第",K.hotRank&&K.hotRank>0?K.hotRank:"-","名"]}),T&&e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>T(K),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),e.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:e.jsx(mt,{className:"w-3.5 h-3.5"})}),e.jsx(Z,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>d(K),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:e.jsx(Gt,{className:"w-3.5 h-3.5"})})]})]})]},K.id)})})]},z.id)})})]},w.id)})})}function w3(r){const a=new Map;for(const f of r){const p=f.partId||"part-1",y=f.partTitle||"未分类",g=f.chapterId||"chapter-1",v=f.chapterTitle||"未分类";a.has(p)||a.set(p,{id:p,title:y,chapters:new Map});const k=a.get(p);k.chapters.has(g)||k.chapters.set(g,{id:g,title:v,sections:[]}),k.chapters.get(g).sections.push({id:f.id,title:f.title,price:f.price??1,filePath:f.filePath,isFree:f.isFree,isNew:f.isNew,clickCount:f.clickCount??0,payCount:f.payCount??0,hotScore:f.hotScore??0,hotRank:f.hotRank??0})}const l="part-2026-daily",i="2026每日派对干货";Array.from(a.values()).some(f=>f.title===i||f.title.includes(i))||a.set(l,{id:l,title:i,chapters:new Map([["chapter-2026-daily",{id:"chapter-2026-daily",title:i,sections:[]}]])});const d=Array.from(a.values()).map(f=>({...f,chapters:Array.from(f.chapters.values())})),m=f=>f.includes("序言")?0:f.includes(i)?1.5:f.includes("附录")?2:f.includes("尾声")?3:1;return d.sort((f,p)=>{const y=m(f.title),g=m(p.title);return y!==g?y-g:0})}function S3(){var ql,ia,el;const[r,a]=u.useState([]),[l,i]=u.useState(!0),[c,d]=u.useState([]),[m,f]=u.useState(null),[p,y]=u.useState(!1),[g,v]=u.useState(!1),[k,P]=u.useState(!1),[T,N]=u.useState(""),[j,C]=u.useState([]),[E,b]=u.useState(!1),[R,G]=u.useState(!1),X=u.useRef(null),[L,I]=u.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),[w,V]=u.useState(null),[te,ie]=u.useState(!1),[Y,ne]=u.useState(!1),[_,Q]=u.useState(null),[ue,O]=u.useState(!1),[re,H]=u.useState([]),[A,$]=u.useState(!1),[z,ee]=u.useState(""),[K,de]=u.useState(""),[q,ye]=u.useState(!1),[Ce,F]=u.useState(""),[xe,Pe]=u.useState(!1),[Ve,He]=u.useState(null),[Ke,tt]=u.useState(!1),[$e,me]=u.useState(!1),[pe,ft]=u.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[ss,ur]=u.useState(!1),[Nn,zs]=u.useState(!1),[vs,Tr]=u.useState(1),[_t,rs]=u.useState([]),[wn,Xs]=u.useState(!1),[ns,Sn]=u.useState(20),[ta,Es]=u.useState(!1),[Rr,Js]=u.useState(!1),Nt=w3(r),Ps=r.length,bs=[...r].sort((D,oe)=>(oe.hotScore??0)-(D.hotScore??0)),Zs=10,os=Math.max(1,Math.ceil(bs.length/Zs)),Ts=bs.slice((vs-1)*Zs,vs*Zs),Pt=async()=>{i(!0);try{const D=await Le("/api/db/book?action=list",{cache:"no-store"});a(Array.isArray(D==null?void 0:D.sections)?D.sections:[])}catch(D){console.error(D),a([])}finally{i(!1)}};u.useEffect(()=>{Pt()},[]);const sa=D=>{d(oe=>oe.includes(D)?oe.filter(Ne=>Ne!==D):[...oe,D])},ra=u.useCallback(D=>{const oe=r,Ne=D.flatMap(ke=>{const rt=oe.find(Is=>Is.id===ke.id);return rt?[{...rt,partId:ke.partId,partTitle:ke.partTitle,chapterId:ke.chapterId,chapterTitle:ke.chapterTitle}]:[]});return a(Ne),yt("/api/db/book",{action:"reorder",items:D}).then(ke=>{ke&&ke.success===!1&&(a(oe),alert("排序失败: "+(ke&&typeof ke=="object"&&"error"in ke?ke.error:"未知错误")))}).catch(ke=>{a(oe),console.error("排序失败:",ke),alert("排序失败: "+(ke instanceof Error?ke.message:"网络或服务异常"))}),Promise.resolve()},[r]),na=async D=>{if(confirm(`确定要删除章节「${D.title}」吗?此操作不可恢复。`))try{const oe=await Cr(`/api/db/book?id=${encodeURIComponent(D.id)}`);oe&&oe.success!==!1?(alert("已删除"),Pt()):alert("删除失败: "+(oe&&typeof oe=="object"&&"error"in oe?oe.error:"未知错误"))}catch(oe){console.error(oe),alert("删除失败")}},Cn=u.useCallback(async()=>{ur(!0);try{const D=await Le("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),oe=D&&D.data;oe&&typeof oe.readWeight=="number"&&typeof oe.recencyWeight=="number"&&typeof oe.payWeight=="number"&&ft({readWeight:Math.max(0,Math.min(1,oe.readWeight)),recencyWeight:Math.max(0,Math.min(1,oe.recencyWeight)),payWeight:Math.max(0,Math.min(1,oe.payWeight))})}catch{}finally{ur(!1)}},[]);u.useEffect(()=>{$e&&Cn()},[$e,Cn]);const kn=async()=>{const{readWeight:D,recencyWeight:oe,payWeight:Ne}=pe,ke=D+oe+Ne;if(Math.abs(ke-1)>.001){alert("三个权重之和必须等于 1");return}zs(!0);try{const rt=await ut("/api/db/config",{key:"article_ranking_weights",value:{readWeight:D,recencyWeight:oe,payWeight:Ne},description:"文章排名算法权重"});rt&&rt.success!==!1?(alert("已保存"),Pt()):alert("保存失败: "+(rt&&typeof rt=="object"&&"error"in rt?rt.error:""))}catch(rt){console.error(rt),alert("保存失败")}finally{zs(!1)}},En=u.useCallback(async()=>{Xs(!0);try{const D=await Le("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),oe=D&&D.data;Array.isArray(oe)&&rs(oe)}catch{}finally{Xs(!1)}},[]),hr=async D=>{const oe=_t.includes(D)?_t.filter(Ne=>Ne!==D):[..._t,D];rs(oe);try{await ut("/api/db/config",{key:"pinned_section_ids",value:oe,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{rs(_t)}},Ir=u.useCallback(async()=>{Es(!0);try{const D=await Le("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),oe=D&&D.data;typeof oe=="number"&&oe>0&&oe<=100&&Sn(oe)}catch{}finally{Es(!1)}},[]),er=async()=>{if(ns<1||ns>100){alert("预览比例需在 1~100 之间");return}Js(!0);try{const D=await ut("/api/db/config",{key:"unpaid_preview_percent",value:ns,description:"小程序未付费内容默认预览比例(%)"});D&&D.success!==!1?alert("已保存"):alert("保存失败: "+(D.error||""))}catch{alert("保存失败")}finally{Js(!1)}};u.useEffect(()=>{En(),Ir()},[En,Ir]);const aa=async D=>{He({section:D,orders:[]}),tt(!0);try{const oe=await Le(`/api/db/book?action=section-orders&id=${encodeURIComponent(D.id)}`),Ne=oe!=null&&oe.success&&Array.isArray(oe.orders)?oe.orders:[];He(ke=>ke?{...ke,orders:Ne}:null)}catch(oe){console.error(oe),He(Ne=>Ne?{...Ne,orders:[]}:null)}finally{tt(!1)}},as=async D=>{v(!0);try{const oe=await Le(`/api/db/book?action=read&id=${encodeURIComponent(D.id)}`);if(oe!=null&&oe.success&&oe.section){const Ne=oe.section;f({id:D.id,title:oe.section.title??D.title,price:oe.section.price??D.price,content:oe.section.content??"",filePath:D.filePath,isFree:D.isFree||D.price===0,isNew:Ne.isNew??D.isNew})}else f({id:D.id,title:D.title,price:D.price,content:"",filePath:D.filePath,isFree:D.isFree,isNew:D.isNew}),oe&&!oe.success&&alert("无法读取文件内容: "+(oe.error||"未知错误"))}catch(oe){console.error(oe),f({id:D.id,title:D.title,price:D.price,content:"",filePath:D.filePath,isFree:D.isFree})}finally{v(!1)}},_r=async()=>{var D;if(m){P(!0);try{let oe=m.content||"";const Ne=[new RegExp(`^#+\\s*${m.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${m.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(D=m.title)==null?void 0:D.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const rt of Ne)oe=oe.replace(rt,"");oe=oe.replace(/^\s*\n+/,"").trim();const ke=await yt("/api/db/book",{id:m.id,title:m.title,price:m.isFree?0:m.price,content:oe,isFree:m.isFree||m.price===0,isNew:m.isNew,saveToFile:!0});ke&&ke.success!==!1?(alert(`已保存章节: ${m.title}`),f(null),Pt()):alert("保存失败: "+(ke&&typeof ke=="object"&&"error"in ke?ke.error:"未知错误"))}catch(oe){console.error(oe),alert("保存失败")}finally{P(!1)}}},Mr=async()=>{if(!L.id||!L.title){alert("请填写章节ID和标题");return}P(!0);try{const D=await yt("/api/db/book",{id:L.id,title:L.title,price:L.price,content:L.content,partId:L.partId,chapterId:L.chapterId,saveToFile:!1});D&&D.success!==!1?(alert(`章节创建成功: ${L.title}`),y(!1),I({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),Pt()):alert("创建失败: "+(D&&typeof D=="object"&&"error"in D?D.error:"未知错误"))}catch(D){console.error(D),alert("创建失败")}finally{P(!1)}},Pn=D=>{I(oe=>{var Ne;return{...oe,partId:D.id,chapterId:((Ne=D.chapters[0])==null?void 0:Ne.id)??"chapter-1"}}),y(!0)},Ar=D=>{V({id:D.id,title:D.title})},Ja=async()=>{var D;if((D=w==null?void 0:w.title)!=null&&D.trim()){ie(!0);try{const oe=r.map(ke=>({id:ke.id,partId:ke.partId||"part-1",partTitle:ke.partId===w.id?w.title.trim():ke.partTitle||"",chapterId:ke.chapterId||"chapter-1",chapterTitle:ke.chapterTitle||""})),Ne=await yt("/api/db/book",{action:"reorder",items:oe});Ne&&Ne.success!==!1?(V(null),Pt()):alert("更新篇名失败: "+(Ne&&typeof Ne=="object"&&"error"in Ne?Ne.error:"未知错误"))}catch(oe){console.error(oe),alert("更新篇名失败")}finally{ie(!1)}}},Za=D=>{const oe=D.chapters.length+1,Ne=`chapter-${D.id}-${oe}-${Date.now()}`;I({id:`${oe}.1`,title:"新章节",price:1,partId:D.id,chapterId:Ne,content:""}),y(!0)},Rs=(D,oe)=>{Q({part:D,chapter:oe,title:oe.title})},Tn=async()=>{var D;if((D=_==null?void 0:_.title)!=null&&D.trim()){O(!0);try{const oe=r.map(ke=>({id:ke.id,partId:ke.partId||_.part.id,partTitle:ke.partId===_.part.id?_.part.title:ke.partTitle||"",chapterId:ke.chapterId||_.chapter.id,chapterTitle:ke.partId===_.part.id&&ke.chapterId===_.chapter.id?_.title.trim():ke.chapterTitle||""})),Ne=await yt("/api/db/book",{action:"reorder",items:oe});Ne&&Ne.success!==!1?(Q(null),Pt()):alert("保存失败: "+(Ne&&typeof Ne=="object"&&"error"in Ne?Ne.error:"未知错误"))}catch(oe){console.error(oe),alert("保存失败")}finally{O(!1)}}},Rn=async(D,oe)=>{const Ne=oe.sections.map(ke=>ke.id);if(Ne.length===0){alert("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${D.chapters.indexOf(oe)+1}章 | ${oe.title}」吗?将删除共 ${Ne.length} 节,此操作不可恢复。`))try{for(const ke of Ne)await Cr(`/api/db/book?id=${encodeURIComponent(ke)}`);Pt()}catch(ke){console.error(ke),alert("删除失败")}},la=async()=>{if(!Ce.trim()){alert("请输入篇名");return}Pe(!0);try{const D=`part-new-${Date.now()}`,oe="chapter-1",Ne=`part-placeholder-${Date.now()}`,ke=await yt("/api/db/book",{id:Ne,title:"占位节(可编辑)",price:0,content:"",partId:D,partTitle:Ce.trim(),chapterId:oe,chapterTitle:"第1章 | 待编辑",saveToFile:!1});ke&&ke.success!==!1?(alert(`篇「${Ce}」创建成功,请编辑占位节`),ne(!1),F(""),Pt()):alert("创建失败: "+(ke&&typeof ke=="object"&&"error"in ke?ke.error:"未知错误"))}catch(D){console.error(D),alert("创建失败")}finally{Pe(!1)}},In=async()=>{if(re.length===0){alert("请先勾选要移动的章节");return}const D=Nt.find(Ne=>Ne.id===z),oe=D==null?void 0:D.chapters.find(Ne=>Ne.id===K);if(!D||!oe||!z||!K){alert("请选择目标篇和章");return}ye(!0);try{const Ne=()=>{const nt=new Set(re),tr=r.map(Mt=>({id:Mt.id,partId:Mt.partId||"",partTitle:Mt.partTitle||"",chapterId:Mt.chapterId||"",chapterTitle:Mt.chapterTitle||""})),Ho=tr.filter(Mt=>nt.has(Mt.id)).map(Mt=>({...Mt,partId:z,partTitle:D.title||z,chapterId:K,chapterTitle:oe.title||K})),Mn=tr.filter(Mt=>!nt.has(Mt.id));let Dr=Mn.length;for(let Mt=Mn.length-1;Mt>=0;Mt-=1){const Lr=Mn[Mt];if(Lr.partId===z&&Lr.chapterId===K){Dr=Mt+1;break}}return[...Mn.slice(0,Dr),...Ho,...Mn.slice(Dr)]},ke=async()=>{const nt=Ne(),tr=await yt("/api/db/book",{action:"reorder",items:nt});return tr&&tr.success!==!1?(alert(`已移动 ${re.length} 节到「${D.title}」-「${oe.title}」`),$(!1),H([]),await Pt(),!0):!1},rt={action:"move-sections",sectionIds:re,targetPartId:z,targetChapterId:K,targetPartTitle:D.title||z,targetChapterTitle:oe.title||K},Is=await yt("/api/db/book",rt);if(Is&&Is.success!==!1)alert(`已移动 ${Is.count??re.length} 节到「${D.title}」-「${oe.title}」`),$(!1),H([]),await Pt();else{const nt=Is&&typeof Is=="object"&&"error"in Is?Is.error||"":"未知错误";if((nt.includes("缺少 id")||nt.includes("无效的 action"))&&await ke())return;alert("移动失败: "+nt)}}catch(Ne){console.error(Ne),alert("移动失败: "+(Ne instanceof Error?Ne.message:"网络或服务异常"))}finally{ye(!1)}},_n=D=>{H(oe=>oe.includes(D)?oe.filter(Ne=>Ne!==D):[...oe,D])},U=async D=>{const oe=r.filter(Ne=>Ne.partId===D.id).map(Ne=>Ne.id);if(oe.length===0){alert("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${D.title}」整篇吗?将删除共 ${oe.length} 节内容,此操作不可恢复。`))try{for(const Ne of oe)await Cr(`/api/db/book?id=${encodeURIComponent(Ne)}`);Pt()}catch(Ne){console.error(Ne),alert("删除失败")}},We=async D=>{var Ne,ke;const oe=(Ne=D.target.files)==null?void 0:Ne[0];if(oe){G(!0);try{const rt=new FormData;rt.append("file",oe),rt.append("folder","book-images");const nt=await(await fetch(Ba("/api/upload"),{method:"POST",body:rt,credentials:"include"})).json();if(nt!=null&&nt.success&&((ke=nt==null?void 0:nt.data)!=null&&ke.url)){const tr=`![${oe.name}](${nt.data.url})`;m&&f({...m,content:(m.content||"")+` - -`+tr}),alert(`图片上传成功: ${nt.data.url}`)}else alert("上传失败: "+((nt==null?void 0:nt.error)||"未知错误"))}catch(rt){console.error(rt),alert("上传失败")}finally{G(!1),X.current&&(X.current.value="")}}},Ge=async()=>{var D;if(T.trim()){b(!0);try{const oe=await Le(`/api/search?q=${encodeURIComponent(T)}`);oe!=null&&oe.success&&((D=oe.data)!=null&&D.results)?C(oe.data.results):(C([]),oe&&!oe.success&&alert("搜索失败: "+oe.error))}catch(oe){console.error(oe),C([]),alert("搜索失败")}finally{b(!1)}}},Vt=Nt.find(D=>D.id===L.partId),lt=(Vt==null?void 0:Vt.chapters)??[];return e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),e.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",Nt.length," 篇 · ",Ps," 节内容"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Z,{onClick:()=>me(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[e.jsx(Md,{className:"w-4 h-4 mr-2"}),"排名算法"]}),e.jsxs(Z,{onClick:()=>{const D=typeof window<"u"?`${window.location.origin}/api-doc`:"";D&&window.open(D,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Sr,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),e.jsx(Ct,{open:p,onOpenChange:y,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[e.jsx(Rt,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"章节ID *"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:L.id,onChange:D=>I({...L,id:D.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"价格 (元)"}),e.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:L.price,onChange:D=>I({...L,price:Number(D.target.value)})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"章节标题 *"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:L.title,onChange:D=>I({...L,title:D.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"所属篇"}),e.jsxs(co,{value:L.partId,onValueChange:D=>I({...L,partId:D,chapterId:"chapter-1"}),children:[e.jsx(Ll,{className:"bg-[#0a1628] border-gray-700 text-white",children:e.jsx(uo,{})}),e.jsxs(Ol,{className:"bg-[#0f2137] border-gray-700",children:[Nt.map(D=>e.jsx(Gn,{value:D.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:D.title},D.id)),Nt.length===0&&e.jsx(Gn,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"所属章"}),e.jsxs(co,{value:L.chapterId,onValueChange:D=>I({...L,chapterId:D}),children:[e.jsx(Ll,{className:"bg-[#0a1628] border-gray-700 text-white",children:e.jsx(uo,{})}),e.jsxs(Ol,{className:"bg-[#0f2137] border-gray-700",children:[lt.map(D=>e.jsx(Gn,{value:D.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:D.title},D.id)),lt.length===0&&e.jsx(Gn,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"内容 (Markdown格式)"}),e.jsx(Xn,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[300px] font-mono text-sm placeholder:text-gray-500",placeholder:"输入章节内容...",value:L.content,onChange:D=>I({...L,content:D.target.value})})]})]}),e.jsxs(Ot,{children:[e.jsx(Z,{variant:"outline",onClick:()=>y(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),e.jsx(Z,{onClick:Mr,disabled:k||!L.id||!L.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:k?e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),e.jsx(Ct,{open:!!w,onOpenChange:D=>!D&&V(null),children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[e.jsx(mt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),w&&e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"篇名"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:w.title,onChange:D=>V({...w,title:D.target.value}),placeholder:"输入篇名"})]})}),e.jsxs(Ot,{children:[e.jsx(Z,{variant:"outline",onClick:()=>V(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),e.jsx(Z,{onClick:Ja,disabled:te||!((ql=w==null?void 0:w.title)!=null&&ql.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:te?e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),e.jsx(Ct,{open:!!_,onOpenChange:D=>!D&&Q(null),children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[e.jsx(mt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),_&&e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:_.title,onChange:D=>Q({..._,title:D.target.value}),placeholder:"输入章节名称"})]})}),e.jsxs(Ot,{children:[e.jsx(Z,{variant:"outline",onClick:()=>Q(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),e.jsx(Z,{onClick:Tn,disabled:ue||!((ia=_==null?void 0:_.title)!=null&&ia.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ue?e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),e.jsx(Ct,{open:A,onOpenChange:D=>{var oe;if($(D),D&&Nt.length>0){const Ne=Nt[0];ee(Ne.id),de(((oe=Ne.chapters[0])==null?void 0:oe.id)??"")}},children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[e.jsx(kt,{children:e.jsx(Et,{className:"text-white",children:"批量移动至指定目录"})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",e.jsx("span",{className:"text-[#38bdac] font-medium",children:re.length})," 节,请选择目标篇与章。"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"目标篇"}),e.jsxs(co,{value:z,onValueChange:D=>{var Ne;ee(D);const oe=Nt.find(ke=>ke.id===D);de(((Ne=oe==null?void 0:oe.chapters[0])==null?void 0:Ne.id)??"")},children:[e.jsx(Ll,{className:"bg-[#0a1628] border-gray-700 text-white",children:e.jsx(uo,{placeholder:"选择篇"})}),e.jsx(Ol,{className:"bg-[#0f2137] border-gray-700",children:Nt.map(D=>e.jsx(Gn,{value:D.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:D.title},D.id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"目标章"}),e.jsxs(co,{value:K,onValueChange:de,children:[e.jsx(Ll,{className:"bg-[#0a1628] border-gray-700 text-white",children:e.jsx(uo,{placeholder:"选择章"})}),e.jsx(Ol,{className:"bg-[#0f2137] border-gray-700",children:(((el=Nt.find(D=>D.id===z))==null?void 0:el.chapters)??[]).map(D=>e.jsx(Gn,{value:D.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:D.title},D.id))})]})]})]}),e.jsxs(Ot,{children:[e.jsx(Z,{variant:"outline",onClick:()=>$(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),e.jsx(Z,{onClick:In,disabled:q||re.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:q?e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),e.jsx(Ct,{open:!!Ve,onOpenChange:D=>!D&&He(null),children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white",children:["付款记录 — ",(Ve==null?void 0:Ve.section.title)??""]})}),e.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Ke?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Ve&&Ve.orders.length===0?e.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):Ve?e.jsxs("table",{className:"w-full text-sm border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[e.jsx("th",{className:"py-2 pr-2",children:"订单号"}),e.jsx("th",{className:"py-2 pr-2",children:"用户ID"}),e.jsx("th",{className:"py-2 pr-2",children:"金额"}),e.jsx("th",{className:"py-2 pr-2",children:"状态"}),e.jsx("th",{className:"py-2 pr-2",children:"支付时间"})]})}),e.jsx("tbody",{children:Ve.orders.map(D=>e.jsxs("tr",{className:"border-b border-gray-700/50",children:[e.jsx("td",{className:"py-2 pr-2 text-gray-300",children:D.orderSn??"-"}),e.jsx("td",{className:"py-2 pr-2 text-gray-300",children:D.userId??D.openId??"-"}),e.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",D.amount??0]}),e.jsx("td",{className:"py-2 pr-2 text-gray-300",children:D.status??"-"}),e.jsx("td",{className:"py-2 pr-2 text-gray-500",children:D.payTime??D.createdAt??"-"})]},D.id??D.orderSn??""))})]}):null})]})}),e.jsx(Ct,{open:$e,onOpenChange:me,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[e.jsx(Md,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"热度积分 = 阅读权重×阅读排名分 + 新度权重×新度排名分 + 付款权重×付款排名分(三权重之和须为 1)"}),ss?e.jsx("p",{className:"text-gray-500",children:"加载中..."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(se,{className:"text-gray-400 text-xs",children:"阅读权重"}),e.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:pe.readWeight,onChange:D=>ft(oe=>({...oe,readWeight:Math.max(0,Math.min(1,parseFloat(D.target.value)||0))}))})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(se,{className:"text-gray-400 text-xs",children:"新度权重"}),e.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:pe.recencyWeight,onChange:D=>ft(oe=>({...oe,recencyWeight:Math.max(0,Math.min(1,parseFloat(D.target.value)||0))}))})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(se,{className:"text-gray-400 text-xs",children:"付款权重"}),e.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:pe.payWeight,onChange:D=>ft(oe=>({...oe,payWeight:Math.max(0,Math.min(1,parseFloat(D.target.value)||0))}))})]})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(pe.readWeight+pe.recencyWeight+pe.payWeight).toFixed(1)]}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[e.jsx("li",{children:"阅读量前 20 名:得分 20~1"}),e.jsx("li",{children:"最近更新前 30 篇:得分 30~1"}),e.jsx("li",{children:"付款数前 20 名:得分 20~1"})]}),e.jsx(Z,{onClick:kn,disabled:Nn||Math.abs(pe.readWeight+pe.recencyWeight+pe.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Nn?"保存中...":"保存权重"})]})]})]})}),e.jsx(Ct,{open:Y,onOpenChange:ne,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[e.jsx(Rt,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:Ce,onChange:D=>F(D.target.value),placeholder:"输入篇名"})]})}),e.jsxs(Ot,{children:[e.jsx(Z,{variant:"outline",onClick:()=>{ne(!1),F("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),e.jsx(Z,{onClick:la,disabled:xe||!Ce.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:xe?e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),e.jsx(Ct,{open:!!m,onOpenChange:()=>f(null),children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[e.jsx(kt,{className:"shrink-0 px-6 pt-6 pb-2",children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[e.jsx(mt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),m&&e.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"章节ID"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:m.id,onChange:D=>f({...m,id:D.target.value}),placeholder:"如: 9.15"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"价格 (元)"}),e.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:m.isFree?0:m.price,onChange:D=>f({...m,price:Number(D.target.value),isFree:Number(D.target.value)===0}),disabled:m.isFree})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"免费"}),e.jsx("div",{className:"flex items-center h-10",children:e.jsxs("label",{className:"flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:m.isFree||m.price===0,onChange:D=>f({...m,isFree:D.target.checked,price:D.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),e.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"最新新增"}),e.jsx("div",{className:"flex items-center h-10",children:e.jsxs("label",{className:"flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:m.isNew??!1,onChange:D=>f({...m,isNew:D.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),e.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"章节标题"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:m.title,onChange:D=>f({...m,title:D.target.value})})]}),m.filePath&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"文件路径"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:m.filePath,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(se,{className:"text-gray-300",children:"内容 (Markdown格式)"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:X,type:"file",accept:"image/*",onChange:We,className:"hidden"}),e.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{var D;return(D=X.current)==null?void 0:D.click()},disabled:R,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[R?e.jsx(Be,{className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(np,{className:"w-4 h-4 mr-1"}),"上传图片"]})]})]}),g?e.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):e.jsx(Xn,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[400px] font-mono text-sm placeholder:text-gray-500",placeholder:"此处输入章节内容,支持Markdown格式...",value:m.content,onChange:D=>f({...m,content:D.target.value})})]})]}),e.jsxs(Ot,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[e.jsxs(Z,{variant:"outline",onClick:()=>f(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(xs,{className:"w-4 h-4 mr-2"}),"取消"]}),e.jsx(Z,{onClick:_r,disabled:k,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:k?e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),e.jsxs(Yl,{defaultValue:"chapters",className:"space-y-6",children:[e.jsxs(Ga,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[e.jsxs(Ft,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[e.jsx(Fs,{className:"w-4 h-4 mr-2"}),"章节管理"]}),e.jsxs(Ft,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[e.jsx(dn,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),e.jsxs(Ft,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[e.jsx(qf,{className:"w-4 h-4 mr-2"}),"内容排行榜"]})]}),e.jsxs(zt,{value:"chapters",className:"space-y-4",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:e.jsx(Fs,{className:"w-6 h-6"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),e.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),e.jsxs("div",{className:"text-center shrink-0",children:[e.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:Ps}),e.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(Z,{onClick:()=>y(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"新建章节"]}),e.jsxs(Z,{onClick:()=>ne(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"新建篇"]}),e.jsxs(Z,{variant:"outline",onClick:()=>$(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",re.length," 节)"]})]}),l?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):e.jsx(N3,{parts:Nt,expandedParts:c,onTogglePart:sa,onReorder:ra,onReadSection:as,onDeleteSection:na,onAddSectionInPart:Pn,onAddChapterInPart:Za,onDeleteChapter:Rn,onEditPart:Ar,onDeletePart:U,onEditChapter:Rs,selectedSectionIds:re,onToggleSectionSelect:_n,onShowSectionOrders:aa})]}),e.jsx(zt,{value:"search",className:"space-y-4",children:e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsx(Qe,{children:e.jsx(qe,{className:"text-white",children:"内容搜索"})}),e.jsxs(Se,{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:T,onChange:D=>N(D.target.value),onKeyDown:D=>D.key==="Enter"&&Ge()}),e.jsx(Z,{onClick:Ge,disabled:E||!T.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?e.jsx(Be,{className:"w-4 h-4 animate-spin"}):e.jsx(dn,{className:"w-4 h-4"})})]}),j.length>0&&e.jsxs("div",{className:"space-y-2 mt-4",children:[e.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",j.length," 个结果"]}),j.map(D=>e.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>as({id:D.id,title:D.title,price:D.price??1,filePath:""}),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[#38bdac] font-mono text-xs mr-2",children:D.id}),e.jsx("span",{className:"text-white",children:D.title})]}),e.jsx(Oe,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:D.matchType==="title"?"标题匹配":"内容匹配"})]}),D.snippet&&e.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:D.snippet}),(D.partTitle||D.chapterTitle)&&e.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[D.partTitle," · ",D.chapterTitle]})]},D.id))]})]})]})}),e.jsxs(zt,{value:"ranking",className:"space-y-4",children:[e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsx(Qe,{className:"pb-3",children:e.jsxs(qe,{className:"text-white text-base flex items-center gap-2",children:[e.jsx(Md,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),e.jsx(Se,{children:e.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),e.jsx(ce,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:ns,onChange:D=>Sn(Math.max(1,Math.min(100,Number(D.target.value)||20))),disabled:ta}),e.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),e.jsx(Z,{size:"sm",onClick:er,disabled:Rr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Rr?"保存中...":"保存"}),e.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",ns,"% 内容"]})]})})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsx(Qe,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(qe,{className:"text-white text-base flex items-center gap-2",children:[e.jsx(qf,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",e.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",bs.length," 节"]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[e.jsx(Z,{variant:"ghost",size:"sm",disabled:vs<=1,onClick:()=>Tr(D=>Math.max(1,D-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:e.jsx(ej,{className:"w-4 h-4"})}),e.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[vs," / ",os]}),e.jsx(Z,{variant:"ghost",size:"sm",disabled:vs>=os,onClick:()=>Tr(D=>Math.min(os,D+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:e.jsx(Aa,{className:"w-4 h-4"})})]})]})}),e.jsx(Se,{children:e.jsxs("div",{className:"space-y-0",children:[e.jsxs("div",{className:"grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2 text-xs text-gray-500 border-b border-gray-700/50",children:[e.jsx("span",{children:"排名"}),e.jsx("span",{children:"置顶"}),e.jsx("span",{children:"标题"}),e.jsx("span",{className:"text-right",children:"点击量"}),e.jsx("span",{className:"text-right",children:"付款数"}),e.jsx("span",{className:"text-right",children:"热度"}),e.jsx("span",{className:"text-right",children:"操作"})]}),Ts.map((D,oe)=>{const Ne=(vs-1)*Zs+oe+1,ke=_t.includes(D.id);return e.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${ke?"bg-amber-500/5":""}`,children:[e.jsx("span",{className:`text-sm font-bold ${Ne<=3?"text-amber-400":"text-gray-500"}`,children:Ne<=3?["🥇","🥈","🥉"][Ne-1]:`#${Ne}`}),e.jsx(Z,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${ke?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>hr(D.id),disabled:wn,title:ke?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:ke?e.jsx(vN,{className:"w-3.5 h-3.5 fill-current"}):e.jsx(aN,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"text-white text-sm truncate block",children:D.title}),e.jsxs("span",{className:"text-gray-600 text-xs",children:[D.partTitle," · ",D.chapterTitle]})]}),e.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:D.clickCount??0}),e.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:D.payCount??0}),e.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(D.hotScore??0).toFixed(1)}),e.jsx("div",{className:"text-right",children:e.jsx(Z,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>aa({id:D.id,title:D.title,price:D.price}),title:"付款记录",children:e.jsx(Fs,{className:"w-3 h-3"})})})]},D.id)}),Ts.length===0&&e.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]})]})]})}const wr={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function Px(r){return Array.isArray(r)?r.map(a=>a&&typeof a=="object"&&"label"in a&&"value"in a?{label:String(a.label),value:String(a.value)}:{label:"",value:""}).filter(a=>a.label||a.value):wr.stats}function Tx(r){return Array.isArray(r)?r.map(a=>typeof a=="string"?a:String(a??"")).filter(Boolean):wr.highlights}function C3(){const[r,a]=u.useState(wr),[l,i]=u.useState(!0),[c,d]=u.useState(!1),[m,f]=u.useState(!1),p=u.useRef(null);u.useEffect(()=>{Le("/api/admin/author-settings").then(C=>{const E=C==null?void 0:C.data;E&&typeof E=="object"&&a({name:String(E.name??wr.name),avatar:String(E.avatar??wr.avatar),avatarImg:String(E.avatarImg??""),title:String(E.title??wr.title),bio:String(E.bio??wr.bio),stats:Px(E.stats).length?Px(E.stats):wr.stats,highlights:Tx(E.highlights).length?Tx(E.highlights):wr.highlights})}).catch(console.error).finally(()=>i(!1))},[]);const y=async()=>{d(!0);try{const C={name:r.name,avatar:r.avatar||"K",avatarImg:r.avatarImg,title:r.title,bio:r.bio,stats:r.stats.filter(R=>R.label||R.value),highlights:r.highlights.filter(Boolean)},E=await ut("/api/admin/author-settings",C);if(!E||E.success===!1){alert("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.error:""));return}d(!1);const b=document.createElement("div");b.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",b.textContent="作者设置已保存",document.body.appendChild(b),setTimeout(()=>b.remove(),2e3)}catch(C){console.error(C),alert("保存失败: "+(C instanceof Error?C.message:String(C)))}finally{d(!1)}},g=async C=>{var b;const E=(b=C.target.files)==null?void 0:b[0];if(E){f(!0);try{const R=new FormData;R.append("file",E),R.append("folder","avatars");const G=Ru(),X={};G&&(X.Authorization=`Bearer ${G}`);const I=await(await fetch(Ba("/api/upload"),{method:"POST",body:R,credentials:"include",headers:X})).json();I!=null&&I.success&&(I!=null&&I.url)?a(w=>({...w,avatarImg:I.url})):alert("上传失败: "+((I==null?void 0:I.error)||"未知错误"))}catch(R){console.error(R),alert("上传失败")}finally{f(!1),p.current&&(p.current.value="")}}},v=()=>a(C=>({...C,stats:[...C.stats,{label:"",value:""}]})),k=C=>a(E=>({...E,stats:E.stats.filter((b,R)=>R!==C)})),P=(C,E,b)=>a(R=>({...R,stats:R.stats.map((G,X)=>X===C?{...G,[E]:b}:G)})),T=()=>a(C=>({...C,highlights:[...C.highlights,""]})),N=C=>a(E=>({...E,highlights:E.highlights.filter((b,R)=>R!==C)})),j=(C,E)=>a(b=>({...b,highlights:b.highlights.map((R,G)=>G===C?E:R)}));return l?e.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[e.jsx(Oa,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),e.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),e.jsxs(Z,{onClick:y,disabled:c||l,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存"]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"flex items-center gap-2 text-white",children:[e.jsx(Oa,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),e.jsx(vt,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),e.jsxs(Se,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"姓名"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:r.name,onChange:C=>a(E=>({...E,name:C.target.value})),placeholder:"卡若"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:r.avatar,onChange:C=>a(E=>({...E,avatar:C.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{className:"text-gray-300 flex items-center gap-2",children:[e.jsx(np,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:r.avatarImg,onChange:C=>a(E=>({...E,avatarImg:C.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),e.jsx("input",{ref:p,type:"file",accept:"image/*",className:"hidden",onChange:g}),e.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:m,onClick:()=>{var C;return(C=p.current)==null?void 0:C.click()},children:[e.jsx(yo,{className:"w-4 h-4 mr-2"}),m?"上传中...":"上传"]})]}),r.avatarImg&&e.jsx("div",{className:"mt-2",children:e.jsx("img",{src:r.avatarImg.startsWith("http")?r.avatarImg:Ba(r.avatarImg),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"头衔"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:r.title,onChange:C=>a(E=>({...E,title:C.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"个人简介"}),e.jsx(Xn,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:r.bio,onChange:C=>a(E=>({...E,bio:C.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsx(qe,{className:"text-white",children:"统计数据"}),e.jsx(vt,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),e.jsxs(Se,{className:"space-y-3",children:[r.stats.map((C,E)=>e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:C.label,onChange:b=>P(E,"label",b.target.value),placeholder:"标签"}),e.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:C.value,onChange:b=>P(E,"value",b.target.value),placeholder:"数值"}),e.jsx(Z,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>k(E),children:e.jsx(xs,{className:"w-4 h-4"})})]},E)),e.jsxs(Z,{variant:"outline",size:"sm",onClick:v,className:"border-gray-600 text-gray-400",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsx(qe,{className:"text-white",children:"亮点标签"}),e.jsx(vt,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),e.jsxs(Se,{className:"space-y-3",children:[r.highlights.map((C,E)=>e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:C,onChange:b=>j(E,b.target.value),placeholder:"5年私域运营经验"}),e.jsx(Z,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>N(E),children:e.jsx(xs,{className:"w-4 h-4"})})]},E)),e.jsxs(Z,{variant:"outline",size:"sm",onClick:T,className:"border-gray-600 text-gray-400",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function k3(){const[r,a]=u.useState([]),[l,i]=u.useState(0),[c,d]=u.useState(1),[m]=u.useState(10),[f,p]=u.useState(0),[y,g]=u.useState(""),v=$u(y,300),[k,P]=u.useState(!0),[T,N]=u.useState(null),[j,C]=u.useState(!1),[E,b]=u.useState(null),[R,G]=u.useState(""),[X,L]=u.useState(""),[I,w]=u.useState(""),[V,te]=u.useState("admin"),[ie,Y]=u.useState("active"),[ne,_]=u.useState(!1);async function Q(){var $;P(!0),N(null);try{const z=new URLSearchParams({page:String(c),pageSize:String(m)});v.trim()&&z.set("search",v.trim());const ee=await Le(`/api/admin/users?${z}`);ee!=null&&ee.success?(a(ee.records||[]),i(ee.total??0),p(ee.totalPages??0)):N(ee.error||"加载失败")}catch(z){const ee=z;N(ee.status===403?"无权限访问":(($=ee==null?void 0:ee.data)==null?void 0:$.error)||"加载失败"),a([])}finally{P(!1)}}u.useEffect(()=>{Q()},[c,m,v]);const ue=()=>{b(null),G(""),L(""),w(""),te("admin"),Y("active"),C(!0)},O=$=>{b($),G($.username),L(""),w($.name||""),te($.role==="super_admin"?"super_admin":"admin"),Y($.status==="disabled"?"disabled":"active"),C(!0)},re=async()=>{var $;if(!R.trim()){N("用户名不能为空");return}if(!E&&!X){N("新建时密码必填,至少 6 位");return}if(X&&X.length<6){N("密码至少 6 位");return}N(null),_(!0);try{if(E){const z=await yt("/api/admin/users",{id:E.id,password:X||void 0,name:I.trim(),role:V,status:ie});z!=null&&z.success?(C(!1),Q()):N((z==null?void 0:z.error)||"保存失败")}else{const z=await ut("/api/admin/users",{username:R.trim(),password:X,name:I.trim(),role:V});z!=null&&z.success?(C(!1),Q()):N((z==null?void 0:z.error)||"保存失败")}}catch(z){const ee=z;N((($=ee==null?void 0:ee.data)==null?void 0:$.error)||"保存失败")}finally{_(!1)}},H=async $=>{var z;if(confirm("确定删除该管理员?"))try{const ee=await Cr(`/api/admin/users?id=${$}`);ee!=null&&ee.success?Q():N((ee==null?void 0:ee.error)||"删除失败")}catch(ee){const K=ee;N(((z=K==null?void 0:K.data)==null?void 0:z.error)||"删除失败")}},A=$=>{if(!$)return"-";try{const z=new Date($);return isNaN(z.getTime())?$:z.toLocaleString("zh-CN")}catch{return $}};return e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[e.jsx(Pu,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),e.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{placeholder:"搜索用户名/昵称",value:y,onChange:$=>g($.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),e.jsx(Z,{variant:"outline",size:"sm",onClick:Q,disabled:k,className:"border-gray-600 text-gray-300",children:e.jsx(Be,{className:`w-4 h-4 ${k?"animate-spin":""}`})}),e.jsxs(Z,{onClick:ue,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),T&&e.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[e.jsx("span",{children:T}),e.jsx("button",{type:"button",onClick:()=>N(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsx(Se,{className:"p-0",children:k?e.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):e.jsxs(e.Fragment,{children:[e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"ID"}),e.jsx(je,{className:"text-gray-400",children:"用户名"}),e.jsx(je,{className:"text-gray-400",children:"昵称"}),e.jsx(je,{className:"text-gray-400",children:"角色"}),e.jsx(je,{className:"text-gray-400",children:"状态"}),e.jsx(je,{className:"text-gray-400",children:"创建时间"}),e.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),e.jsxs(ys,{children:[r.map($=>e.jsxs(et,{className:"border-gray-700/50",children:[e.jsx(ge,{className:"text-gray-300",children:$.id}),e.jsx(ge,{className:"text-white font-medium",children:$.username}),e.jsx(ge,{className:"text-gray-400",children:$.name||"-"}),e.jsx(ge,{children:e.jsx(Oe,{variant:"outline",className:$.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:$.role==="super_admin"?"超级管理员":"管理员"})}),e.jsx(ge,{children:e.jsx(Oe,{variant:"outline",className:$.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:$.status==="active"?"正常":"已禁用"})}),e.jsx(ge,{className:"text-gray-500 text-sm",children:A($.createdAt)}),e.jsxs(ge,{className:"text-right",children:[e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>O($),className:"text-gray-400 hover:text-[#38bdac]",children:e.jsx(mt,{className:"w-4 h-4"})}),e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>H($.id),className:"text-gray-400 hover:text-red-400",children:e.jsx(Gt,{className:"w-4 h-4"})})]})]},$.id)),r.length===0&&!k&&e.jsx(et,{children:e.jsx(ge,{colSpan:7,className:"text-center py-12 text-gray-500",children:T==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),f>1&&e.jsx("div",{className:"p-4 border-t border-gray-700/50",children:e.jsx(Gs,{page:c,pageSize:m,total:l,totalPages:f,onPageChange:d})})]})})}),e.jsx(Ct,{open:j,onOpenChange:C,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[e.jsx(kt,{children:e.jsx(Et,{className:"text-white",children:E?"编辑管理员":"新增管理员"})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"用户名"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:R,onChange:$=>G($.target.value),disabled:!!E}),E&&e.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:E?"新密码(留空不改)":"密码"}),e.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:E?"留空表示不修改":"至少 6 位",value:X,onChange:$=>L($.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"昵称"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:I,onChange:$=>w($.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"角色"}),e.jsxs("select",{value:V,onChange:$=>te($.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[e.jsx("option",{value:"admin",children:"管理员"}),e.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),E&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"状态"}),e.jsxs("select",{value:ie,onChange:$=>Y($.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[e.jsx("option",{value:"active",children:"正常"}),e.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),e.jsxs(Ot,{children:[e.jsxs(Z,{variant:"outline",onClick:()=>C(!1),className:"border-gray-600 text-gray-300",children:[e.jsx(xs,{className:"w-4 h-4 mr-2"}),"取消"]}),e.jsxs(Z,{onClick:re,disabled:ne,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),ne?"保存中...":"保存"]})]})]})})]})}const E3={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},P3={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},T3={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...P3}},R3={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},I3=["system","author","admin"];function _3(){const[r,a]=Xx(),l=r.get("tab")??"system",i=I3.includes(l)?l:"system",[c,d]=u.useState(T3),[m,f]=u.useState(R3),[p,y]=u.useState(E3),[g,v]=u.useState(!1),[k,P]=u.useState(!0),[T,N]=u.useState(!1),[j,C]=u.useState(""),[E,b]=u.useState(""),[R,G]=u.useState(!1),[X,L]=u.useState(!1),I=(Y,ne,_=!1)=>{C(Y),b(ne),G(_),N(!0)};u.useEffect(()=>{(async()=>{try{const ne=await Le("/api/admin/settings");if(!ne||ne.success===!1)return;if(ne.featureConfig&&Object.keys(ne.featureConfig).length&&f(_=>({..._,...ne.featureConfig})),ne.mpConfig&&typeof ne.mpConfig=="object"&&y(_=>({..._,...ne.mpConfig})),ne.siteSettings&&typeof ne.siteSettings=="object"){const _=ne.siteSettings;d(Q=>({...Q,...typeof _.sectionPrice=="number"&&{sectionPrice:_.sectionPrice},...typeof _.baseBookPrice=="number"&&{baseBookPrice:_.baseBookPrice},...typeof _.distributorShare=="number"&&{distributorShare:_.distributorShare},..._.authorInfo&&typeof _.authorInfo=="object"&&{authorInfo:{...Q.authorInfo,..._.authorInfo}}}))}}catch(ne){console.error("Load settings error:",ne)}finally{P(!1)}})()},[]);const w=async(Y,ne)=>{L(!0);try{const _=await ut("/api/admin/settings",{featureConfig:Y});if(!_||_.success===!1){ne(),I("保存失败",(_==null?void 0:_.error)??"未知错误",!0);return}I("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(_){console.error("Save feature config error:",_),ne(),I("保存失败",_ instanceof Error?_.message:String(_),!0)}finally{L(!1)}},V=(Y,ne)=>{const _=m,Q={..._,[Y]:ne};f(Q),w(Q,()=>f(_))},te=async()=>{v(!0);try{const Y=await ut("/api/admin/settings",{featureConfig:m,siteSettings:{sectionPrice:c.sectionPrice,baseBookPrice:c.baseBookPrice,distributorShare:c.distributorShare,authorInfo:c.authorInfo},mpConfig:{...p,appId:p.appId||"",withdrawSubscribeTmplId:p.withdrawSubscribeTmplId||"",mchId:p.mchId||"",minWithdraw:typeof p.minWithdraw=="number"?p.minWithdraw:10}});if(!Y||Y.success===!1){I("保存失败",(Y==null?void 0:Y.error)??"未知错误",!0);return}I("已保存","设置已保存成功。")}catch(Y){console.error("Save settings error:",Y),I("保存失败",Y instanceof Error?Y.message:String(Y),!0)}finally{v(!1)}},ie=Y=>{a(Y==="system"?{}:{tab:Y})};return k?e.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),e.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),i==="system"&&e.jsxs(Z,{onClick:te,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存设置"]})]}),e.jsxs(Yl,{value:i,onValueChange:ie,className:"w-full",children:[e.jsxs(Ga,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[e.jsxs(Ft,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[e.jsx(Yn,{className:"w-4 h-4 mr-2"}),"系统设置"]}),e.jsxs(Ft,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[e.jsx(_d,{className:"w-4 h-4 mr-2"}),"作者详情"]}),e.jsxs(Ft,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[e.jsx(Pu,{className:"w-4 h-4 mr-2"}),"管理员"]})]}),e.jsx(zt,{value:"system",className:"mt-0",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(_d,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),e.jsx(vt,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),e.jsxs(Se,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[e.jsx(_d,{className:"w-3 h-3"}),"主理人名称"]}),e.jsx(ce,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:c.authorInfo.name??"",onChange:Y=>d(ne=>({...ne,authorInfo:{...ne.authorInfo,name:Y.target.value}}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[e.jsx(po,{className:"w-3 h-3"}),"开播日期"]}),e.jsx(ce,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:c.authorInfo.startDate??"",onChange:Y=>d(ne=>({...ne,authorInfo:{...ne.authorInfo,startDate:Y.target.value}}))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[e.jsx(po,{className:"w-3 h-3"}),"直播时间"]}),e.jsx(ce,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:c.authorInfo.liveTime??"",onChange:Y=>d(ne=>({...ne,authorInfo:{...ne.authorInfo,liveTime:Y.target.value}}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[e.jsx(ap,{className:"w-3 h-3"}),"直播平台"]}),e.jsx(ce,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:c.authorInfo.platform??"",onChange:Y=>d(ne=>({...ne,authorInfo:{...ne.authorInfo,platform:Y.target.value}}))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[e.jsx(Fs,{className:"w-3 h-3"}),"简介描述"]}),e.jsx(ce,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:c.authorInfo.description??"",onChange:Y=>d(ne=>({...ne,authorInfo:{...ne.authorInfo,description:Y.target.value}}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),e.jsx(Xn,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:c.authorInfo.bio??"",onChange:Y=>d(ne=>({...ne,authorInfo:{...ne.authorInfo,bio:Y.target.value}}))})]}),e.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(c.authorInfo.name??"K").charAt(0)}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-semibold",children:c.authorInfo.name}),e.jsx("p",{className:"text-gray-400 text-xs",children:c.authorInfo.description}),e.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",c.authorInfo.liveTime," · ",c.authorInfo.platform]})]})]})]})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(go,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),e.jsx(vt,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),e.jsx(Se,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"单节价格 (元)"}),e.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:c.sectionPrice,onChange:Y=>d(ne=>({...ne,sectionPrice:Number.parseFloat(Y.target.value)||1}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"整本价格 (元)"}),e.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:c.baseBookPrice,onChange:Y=>d(ne=>({...ne,baseBookPrice:Number.parseFloat(Y.target.value)||9.9}))})]})]})})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(Ul,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),e.jsx(vt,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),e.jsx(Se,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"小程序 AppID"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:p.appId??"",onChange:Y=>y(ne=>({...ne,appId:Y.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"提现订阅模板 ID"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:p.withdrawSubscribeTmplId??"",onChange:Y=>y(ne=>({...ne,withdrawSubscribeTmplId:Y.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"微信支付商户号"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:p.mchId??"",onChange:Y=>y(ne=>({...ne,mchId:Y.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"最低提现金额 (元)"}),e.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:p.minWithdraw??10,onChange:Y=>y(ne=>({...ne,minWithdraw:Number.parseFloat(Y.target.value)||10}))})]})]})})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(Yn,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),e.jsx(vt,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),e.jsxs(Se,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Yt,{className:"w-4 h-4 text-[#38bdac]"}),e.jsx(se,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),e.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),e.jsx(dt,{id:"match-enabled",checked:m.matchEnabled,disabled:X,onCheckedChange:Y=>V("matchEnabled",Y)})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wj,{className:"w-4 h-4 text-[#38bdac]"}),e.jsx(se,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),e.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),e.jsx(dt,{id:"referral-enabled",checked:m.referralEnabled,disabled:X,onCheckedChange:Y=>V("referralEnabled",Y)})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fs,{className:"w-4 h-4 text-[#38bdac]"}),e.jsx(se,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),e.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),e.jsx(dt,{id:"search-enabled",checked:m.searchEnabled,disabled:X,onCheckedChange:Y=>V("searchEnabled",Y)})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Yn,{className:"w-4 h-4 text-[#38bdac]"}),e.jsx(se,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),e.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),e.jsx(dt,{id:"about-enabled",checked:m.aboutEnabled,disabled:X,onCheckedChange:Y=>V("aboutEnabled",Y)})]})]}),e.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:e.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]})}),e.jsx(zt,{value:"author",className:"mt-0",children:e.jsx(C3,{})}),e.jsx(zt,{value:"admin",className:"mt-0",children:e.jsx(k3,{})})]}),e.jsx(Ct,{open:T,onOpenChange:N,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[e.jsxs(kt,{children:[e.jsx(Et,{className:R?"text-red-400":"text-[#38bdac]",children:j}),e.jsx(j2,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:E})]}),e.jsx(Ot,{className:"mt-4",children:e.jsx(Z,{onClick:()=>N(!1),className:R?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const Rx={wechat:{enabled:!0,qrCode:"/images/wechat-pay.png",account:"卡若",websiteAppId:"",merchantId:"",groupQrCode:"/images/party-group-qr.png"},alipay:{enabled:!0,qrCode:"/images/alipay.png",account:"卡若",partnerId:"",securityKey:""},usdt:{enabled:!1,network:"TRC20",address:"",exchangeRate:7.2},paypal:{enabled:!1,email:"",exchangeRate:7.2}};function M3(){const[r,a]=u.useState(!1),[l,i]=u.useState(Rx),[c,d]=u.useState(""),m=async()=>{a(!0);try{const C=await Le("/api/config");C!=null&&C.paymentMethods&&i({...Rx,...C.paymentMethods})}catch(C){console.error(C)}finally{a(!1)}};u.useEffect(()=>{m()},[]);const f=async()=>{a(!0);try{await ut("/api/db/config",{key:"payment_methods",value:l,description:"支付方式配置"}),alert("配置已保存!")}catch(C){console.error("保存失败:",C),alert("保存失败: "+(C instanceof Error?C.message:String(C)))}finally{a(!1)}},p=(C,E)=>{navigator.clipboard.writeText(C),d(E),setTimeout(()=>d(""),2e3)},y=(C,E)=>{i(b=>({...b,wechat:{...b.wechat,[C]:E}}))},g=(C,E)=>{i(b=>({...b,alipay:{...b.alipay,[C]:E}}))},v=(C,E)=>{i(b=>({...b,usdt:{...b.usdt,[C]:E}}))},k=(C,E)=>{i(b=>({...b,paypal:{...b.paypal,[C]:E}}))},P=l.wechat,T=l.alipay,N=l.usdt,j=l.paypal;return e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),e.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(Z,{variant:"outline",onClick:m,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`}),"同步配置"]}),e.jsxs(Z,{onClick:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),e.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ep,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),e.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[e.jsx("li",{children:"打开微信,进入目标微信群"}),e.jsx("li",{children:'点击右上角"..." → "群二维码"'}),e.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),e.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),e.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),e.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),e.jsxs(Yl,{defaultValue:"wechat",className:"space-y-6",children:[e.jsxs(Ga,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[e.jsxs(Ft,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[e.jsx(Ul,{className:"w-4 h-4 mr-2"}),"微信"]}),e.jsxs(Ft,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[e.jsx(Kf,{className:"w-4 h-4 mr-2"}),"支付宝"]}),e.jsxs(Ft,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[e.jsx(Wf,{className:"w-4 h-4 mr-2"}),"USDT"]}),e.jsxs(Ft,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[e.jsx(nu,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),e.jsx(zt,{value:"wechat",className:"space-y-4",children:e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(qe,{className:"text-[#07C160] flex items-center gap-2",children:[e.jsx(Ul,{className:"w-5 h-5"}),"微信支付配置"]}),e.jsx(vt,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),e.jsx(dt,{checked:!!P.enabled,onCheckedChange:C=>y("enabled",C)})]}),e.jsxs(Se,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"网站AppID"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(P.websiteAppId??""),onChange:C=>y("websiteAppId",C.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"商户号"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(P.merchantId??""),onChange:C=>y("merchantId",C.target.value)})]})]}),e.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[e.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[e.jsx(hn,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"微信收款码/支付链接"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(P.qrCode??""),onChange:C=>y("qrCode",C.target.value)}),e.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),e.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[e.jsx(se,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),e.jsx(ce,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(P.groupQrCode??""),onChange:C=>y("groupQrCode",C.target.value)}),e.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),e.jsx(zt,{value:"alipay",className:"space-y-4",children:e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(qe,{className:"text-[#1677FF] flex items-center gap-2",children:[e.jsx(Kf,{className:"w-5 h-5"}),"支付宝配置"]}),e.jsx(vt,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),e.jsx(dt,{checked:!!T.enabled,onCheckedChange:C=>g("enabled",C)})]}),e.jsxs(Se,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"合作者身份 (PID)"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(T.partnerId??""),onChange:C=>g("partnerId",C.target.value)}),e.jsx(Z,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>p(String(T.partnerId??""),"pid"),children:c==="pid"?e.jsx(Ro,{className:"w-4 h-4 text-green-500"}):e.jsx(sp,{className:"w-4 h-4 text-gray-400"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"安全校验码 (Key)"}),e.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(T.securityKey??""),onChange:C=>g("securityKey",C.target.value)})]})]}),e.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[e.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[e.jsx(hn,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(T.qrCode??""),onChange:C=>g("qrCode",C.target.value)}),e.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),e.jsx(zt,{value:"usdt",className:"space-y-4",children:e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(qe,{className:"text-[#26A17B] flex items-center gap-2",children:[e.jsx(Wf,{className:"w-5 h-5"}),"USDT配置"]}),e.jsx(vt,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),e.jsx(dt,{checked:!!N.enabled,onCheckedChange:C=>v("enabled",C)})]}),e.jsxs(Se,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"网络类型"}),e.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(N.network??"TRC20"),onChange:C=>v("network",C.target.value),children:[e.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),e.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),e.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"收款地址"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(N.address??""),onChange:C=>v("address",C.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),e.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(N.exchangeRate)??7.2,onChange:C=>v("exchangeRate",Number.parseFloat(C.target.value)||7.2)})]})]})]})}),e.jsx(zt,{value:"paypal",className:"space-y-4",children:e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(qe,{className:"text-[#169BD7] flex items-center gap-2",children:[e.jsx(nu,{className:"w-5 h-5"}),"PayPal配置"]}),e.jsx(vt,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),e.jsx(dt,{checked:!!j.enabled,onCheckedChange:C=>k("enabled",C)})]}),e.jsxs(Se,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"PayPal邮箱"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(j.email??""),onChange:C=>k("email",C.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),e.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:C=>k("exchangeRate",Number(C.target.value)||7.2)})]})]})]})})]})]})}const A3={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},D3={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},L3={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function O3(){const[r,a]=u.useState({siteConfig:{...A3},menuConfig:{...D3},pageConfig:{...L3}}),[l,i]=u.useState(!1),[c,d]=u.useState(!1);u.useEffect(()=>{Le("/api/config").then(g=>{g!=null&&g.siteConfig&&a(v=>({...v,siteConfig:{...v.siteConfig,...g.siteConfig}})),g!=null&&g.menuConfig&&a(v=>({...v,menuConfig:{...v.menuConfig,...g.menuConfig}})),g!=null&&g.pageConfig&&a(v=>({...v,pageConfig:{...v.pageConfig,...g.pageConfig}}))}).catch(console.error)},[]);const m=async()=>{d(!0);try{await ut("/api/db/config",{key:"site_config",value:r.siteConfig,description:"网站基础配置"}),await ut("/api/db/config",{key:"menu_config",value:r.menuConfig,description:"底部菜单配置"}),await ut("/api/db/config",{key:"page_config",value:r.pageConfig,description:"页面标题配置"}),i(!0),setTimeout(()=>i(!1),2e3),alert("配置已保存")}catch(g){console.error(g),alert("保存失败: "+(g instanceof Error?g.message:String(g)))}finally{d(!1)}},f=r.siteConfig,p=r.menuConfig,y=r.pageConfig;return e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),e.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),e.jsxs(Z,{onClick:m,disabled:c,className:`${l?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),c?"保存中...":l?"已保存":"保存设置"]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(nu,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),e.jsx(vt,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),e.jsxs(Se,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),e.jsx(ce,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:f.siteName??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,siteName:g.target.value}}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),e.jsx(ce,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:f.siteTitle??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,siteTitle:g.target.value}}))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),e.jsx(ce,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:f.siteDescription??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,siteDescription:g.target.value}}))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),e.jsx(ce,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:f.logo??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,logo:g.target.value}}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),e.jsx(ce,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:f.favicon??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,favicon:g.target.value}}))})]})]})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(Jj,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),e.jsx(vt,{className:"text-gray-400",children:"配置网站主题色"})]}),e.jsx(Se,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(se,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ce,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:f.primaryColor??"#00CED1",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,primaryColor:g.target.value}}))}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:f.primaryColor??"#00CED1",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,primaryColor:g.target.value}}))})]})]}),e.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:f.primaryColor??"#00CED1"},children:"预览"})]})})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(Gj,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),e.jsx(vt,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),e.jsx(Se,{className:"space-y-4",children:Object.entries(p).map(([g,v])=>e.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[e.jsx(dt,{checked:(v==null?void 0:v.enabled)??!0,onCheckedChange:k=>a(P=>({...P,menuConfig:{...P.menuConfig,[g]:{...v,enabled:k}}}))}),e.jsx("span",{className:"text-gray-300 w-16 capitalize",children:g}),e.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(v==null?void 0:v.label)??"",onChange:k=>a(P=>({...P,menuConfig:{...P.menuConfig,[g]:{...v,label:k.target.value}}}))})]}),e.jsx("span",{className:`text-sm ${v!=null&&v.enabled?"text-green-400":"text-gray-500"}`,children:v!=null&&v.enabled?"显示":"隐藏"})]},g))})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(bj,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),e.jsx(vt,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),e.jsxs(Se,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"首页标题"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.homeTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,homeTitle:g.target.value}}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"首页副标题"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.homeSubtitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,homeSubtitle:g.target.value}}))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"目录页标题"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.chaptersTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,chaptersTitle:g.target.value}}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"匹配页标题"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.matchTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,matchTitle:g.target.value}}))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"我的页标题"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.myTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,myTitle:g.target.value}}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"关于作者标题"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.aboutTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,aboutTitle:g.target.value}}))})]})]})]})]})]})]})}function F3(){const[r,a]=u.useState(""),[l,i]=u.useState(""),[c,d]=u.useState(""),[m,f]=u.useState({}),p=async()=>{var P,T,N,j;try{const C=await Le("/api/config"),E=(T=(P=C==null?void 0:C.liveQRCodes)==null?void 0:P[0])==null?void 0:T.urls;Array.isArray(E)&&a(E.join(` -`));const b=(j=(N=C==null?void 0:C.paymentMethods)==null?void 0:N.wechat)==null?void 0:j.groupQrCode;b&&i(b),f({paymentMethods:C==null?void 0:C.paymentMethods,liveQRCodes:C==null?void 0:C.liveQRCodes})}catch(C){console.error(C)}};u.useEffect(()=>{p()},[]);const y=(P,T)=>{navigator.clipboard.writeText(P),d(T),setTimeout(()=>d(""),2e3)},g=async()=>{try{const P=r.split(` -`).map(N=>N.trim()).filter(Boolean),T=[...m.liveQRCodes||[]];T[0]?T[0].urls=P:T.push({id:"live-1",name:"微信群活码",urls:P,clickCount:0}),await ut("/api/db/config",{key:"live_qr_codes",value:T,description:"群活码配置"}),alert("群活码配置已保存!"),await p()}catch(P){console.error(P),alert("保存失败: "+(P instanceof Error?P.message:String(P)))}},v=async()=>{var P;try{await ut("/api/db/config",{key:"payment_methods",value:{...m.paymentMethods||{},wechat:{...((P=m.paymentMethods)==null?void 0:P.wechat)||{},groupQrCode:l}},description:"支付方式配置"}),alert("微信群链接已保存!用户支付成功后将自动跳转"),await p()}catch(T){console.error(T),alert("保存失败: "+(T instanceof Error?T.message:String(T)))}},k=()=>{l?window.open(l,"_blank"):alert("请先配置微信群链接")};return e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),e.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),e.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ep,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),e.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[e.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),e.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[e.jsx("li",{children:"访问草料二维码创建活码"}),e.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),e.jsx("li",{children:"复制生成的短链接填入下方配置"}),e.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),e.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),e.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[e.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),e.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),e.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-[#07C160] flex items-center gap-2",children:[e.jsx(Qf,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),e.jsx(vt,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),e.jsxs(Se,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{className:"text-gray-300 flex items-center gap-2",children:[e.jsx(Yf,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ce,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:l,onChange:P=>i(P.target.value)}),e.jsx(Z,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>y(l,"group"),children:c==="group"?e.jsx(Ro,{className:"w-4 h-4 text-green-500"}):e.jsx(sp,{className:"w-4 h-4 text-gray-400"})})]}),e.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[e.jsx(hn,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(Z,{onClick:v,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[e.jsx(yo,{className:"w-4 h-4 mr-2"}),"保存配置"]}),e.jsxs(Z,{onClick:k,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[e.jsx(hn,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(Qf,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),e.jsx(vt,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),e.jsxs(Se,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(se,{className:"text-gray-300 flex items-center gap-2",children:[e.jsx(Yf,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),e.jsx(Xn,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:r,onChange:P=>a(P.target.value)}),e.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[e.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),e.jsxs("span",{className:"font-bold text-[#38bdac]",children:[r.split(` -`).filter(Boolean).length," 个"]})]}),e.jsxs(Z,{onClick:g,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(yo,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),e.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[e.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),e.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),e.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const Ix={matchTypes:[{id:"partner",label:"创业合伙",matchLabel:"创业伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10}},z3=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function $3(){const[r,a]=u.useState(Ix),[l,i]=u.useState(!0),[c,d]=u.useState(!1),[m,f]=u.useState(!1),[p,y]=u.useState(null),[g,v]=u.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),k=async()=>{i(!0);try{const b=await Le("/api/db/config/full?key=match_config"),R=(b==null?void 0:b.data)??(b==null?void 0:b.config);R&&a({...Ix,...R})}catch(b){console.error("加载匹配配置失败:",b)}finally{i(!1)}};u.useEffect(()=>{k()},[]);const P=async()=>{d(!0);try{const b=await ut("/api/db/config",{key:"match_config",value:r,description:"匹配功能配置"});b&&b.success!==!1?alert("配置保存成功!"):alert("保存失败: "+(b&&typeof b=="object"&&"error"in b?b.error:"未知错误"))}catch(b){console.error("保存配置失败:",b),alert("保存失败")}finally{d(!1)}},T=b=>{y(b),v({id:b.id,label:b.label,matchLabel:b.matchLabel,icon:b.icon,matchFromDB:b.matchFromDB,showJoinAfterMatch:b.showJoinAfterMatch,price:b.price,enabled:b.enabled}),f(!0)},N=()=>{y(null),v({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),f(!0)},j=()=>{if(!g.id||!g.label){alert("请填写类型ID和名称");return}const b=[...r.matchTypes];if(p){const R=b.findIndex(G=>G.id===p.id);R!==-1&&(b[R]={...g})}else{if(b.some(R=>R.id===g.id)){alert("类型ID已存在");return}b.push({...g})}a({...r,matchTypes:b}),f(!1)},C=b=>{confirm("确定要删除这个匹配类型吗?")&&a({...r,matchTypes:r.matchTypes.filter(R=>R.id!==b)})},E=b=>{a({...r,matchTypes:r.matchTypes.map(R=>R.id===b?{...R,enabled:!R.enabled}:R)})};return e.jsxs("div",{className:"p-8 w-full space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[e.jsx(Yn,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),e.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(Z,{variant:"outline",onClick:k,disabled:l,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]}),e.jsxs(Z,{onClick:P,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(on,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),e.jsx(vt,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),e.jsxs(Se,{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"每日免费匹配次数"}),e.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.freeMatchLimit,onChange:b=>a({...r,freeMatchLimit:parseInt(b.target.value,10)||0})}),e.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"付费匹配价格(元)"}),e.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:r.matchPrice,onChange:b=>a({...r,matchPrice:parseFloat(b.target.value)||1})}),e.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"每日最大匹配次数"}),e.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.settings.maxMatchesPerDay,onChange:b=>a({...r,settings:{...r.settings,maxMatchesPerDay:parseInt(b.target.value,10)||10}})}),e.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),e.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(dt,{checked:r.settings.enableFreeMatches,onCheckedChange:b=>a({...r,settings:{...r.settings,enableFreeMatches:b}})}),e.jsx(se,{className:"text-gray-300",children:"启用免费匹配"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(dt,{checked:r.settings.enablePaidMatches,onCheckedChange:b=>a({...r,settings:{...r.settings,enablePaidMatches:b}})}),e.jsx(se,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50",children:[e.jsxs(Qe,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(Yt,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),e.jsx(vt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),e.jsxs(Z,{onClick:N,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),e.jsx(Se,{children:e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"图标"}),e.jsx(je,{className:"text-gray-400",children:"类型ID"}),e.jsx(je,{className:"text-gray-400",children:"显示名称"}),e.jsx(je,{className:"text-gray-400",children:"匹配标签"}),e.jsx(je,{className:"text-gray-400",children:"价格"}),e.jsx(je,{className:"text-gray-400",children:"数据库匹配"}),e.jsx(je,{className:"text-gray-400",children:"状态"}),e.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),e.jsx(ys,{children:r.matchTypes.map(b=>e.jsxs(et,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[e.jsx(ge,{children:e.jsx("span",{className:"text-2xl",children:b.icon})}),e.jsx(ge,{className:"font-mono text-gray-300",children:b.id}),e.jsx(ge,{className:"text-white font-medium",children:b.label}),e.jsx(ge,{className:"text-gray-300",children:b.matchLabel}),e.jsx(ge,{children:e.jsxs(Oe,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",b.price]})}),e.jsx(ge,{children:b.matchFromDB?e.jsx(Oe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):e.jsx(Oe,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),e.jsx(ge,{children:e.jsx(dt,{checked:b.enabled,onCheckedChange:()=>E(b.id)})}),e.jsx(ge,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>T(b),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:e.jsx(mt,{className:"w-4 h-4"})}),e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>C(b.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:e.jsx(Gt,{className:"w-4 h-4"})})]})})]},b.id))})]})})]}),e.jsx(Ct,{open:m,onOpenChange:f,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[p?e.jsx(mt,{className:"w-5 h-5 text-[#38bdac]"}):e.jsx(Rt,{className:"w-5 h-5 text-[#38bdac]"}),p?"编辑匹配类型":"添加匹配类型"]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"类型ID(英文)"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:g.id,onChange:b=>v({...g,id:b.target.value}),disabled:!!p})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"图标"}),e.jsx("div",{className:"flex gap-1 flex-wrap",children:z3.map(b=>e.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${g.icon===b?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>v({...g,icon:b}),children:b},b))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"显示名称"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:g.label,onChange:b=>v({...g,label:b.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"匹配标签"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:g.matchLabel,onChange:b=>v({...g,matchLabel:b.target.value})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"单次匹配价格(元)"}),e.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:g.price,onChange:b=>v({...g,price:parseFloat(b.target.value)||1})})]}),e.jsxs("div",{className:"flex gap-6 pt-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(dt,{checked:g.matchFromDB,onCheckedChange:b=>v({...g,matchFromDB:b})}),e.jsx(se,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(dt,{checked:g.showJoinAfterMatch,onCheckedChange:b=>v({...g,showJoinAfterMatch:b})}),e.jsx(se,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(dt,{checked:g.enabled,onCheckedChange:b=>v({...g,enabled:b})}),e.jsx(se,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),e.jsxs(Ot,{children:[e.jsx(Z,{variant:"outline",onClick:()=>f(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),e.jsxs(Z,{onClick:j,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const _x={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function B3(){const[r,a]=u.useState([]),[l,i]=u.useState(0),[c,d]=u.useState(1),[m,f]=u.useState(10),[p,y]=u.useState(""),[g,v]=u.useState(!0),[k,P]=u.useState(null);async function T(){v(!0),P(null);try{const j=new URLSearchParams({page:String(c),pageSize:String(m)});p&&j.set("matchType",p);const C=await Le(`/api/db/match-records?${j}`);C!=null&&C.success?(a(C.records||[]),i(C.total??0)):P("加载匹配记录失败")}catch(j){console.error("加载匹配记录失败",j),P("加载失败,请检查网络后重试")}finally{v(!1)}}u.useEffect(()=>{T()},[c,p]);const N=Math.ceil(l/m)||1;return e.jsxs("div",{className:"p-8 w-full",children:[k&&e.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[e.jsx("span",{children:k}),e.jsx("button",{type:"button",onClick:()=>P(null),className:"hover:text-red-300",children:"×"})]}),e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),e.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",l," 条记录"]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("select",{value:p,onChange:j=>{y(j.target.value),d(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[e.jsx("option",{value:"",children:"全部类型"}),Object.entries(_x).map(([j,C])=>e.jsx("option",{value:j,children:C},j))]}),e.jsxs("button",{type:"button",onClick:T,disabled:g,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[e.jsx(Be,{className:`w-4 h-4 ${g?"animate-spin":""}`}),"刷新"]})]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:e.jsx(Se,{className:"p-0",children:g?e.jsxs("div",{className:"flex justify-center py-12",children:[e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"发起人"}),e.jsx(je,{className:"text-gray-400",children:"匹配到"}),e.jsx(je,{className:"text-gray-400",children:"类型"}),e.jsx(je,{className:"text-gray-400",children:"联系方式"}),e.jsx(je,{className:"text-gray-400",children:"匹配时间"})]})}),e.jsxs(ys,{children:[r.map(j=>e.jsxs(et,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[e.jsx(ge,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[j.userAvatar?e.jsx("img",{src:j.userAvatar,alt:"",className:"w-full h-full object-cover",onError:C=>{C.currentTarget.style.display="none";const E=C.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,e.jsx("span",{className:j.userAvatar?"hidden":"",children:(j.userNickname||j.userId||"?").charAt(0)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white",children:j.userNickname||j.userId}),e.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[j.userId.slice(0,16),"..."]})]})]})}),e.jsx(ge,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[j.matchedUserAvatar?e.jsx("img",{src:j.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:C=>{C.currentTarget.style.display="none";const E=C.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,e.jsx("span",{className:j.matchedUserAvatar?"hidden":"",children:(j.matchedNickname||j.matchedUserId||"?").charAt(0)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white",children:j.matchedNickname||j.matchedUserId}),e.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[j.matchedUserId.slice(0,16),"..."]})]})]})}),e.jsx(ge,{children:e.jsx(Oe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:_x[j.matchType]||j.matchType})}),e.jsxs(ge,{className:"text-gray-400 text-sm",children:[j.phone&&e.jsxs("div",{children:["📱 ",j.phone]}),j.wechatId&&e.jsxs("div",{children:["💬 ",j.wechatId]}),!j.phone&&!j.wechatId&&"-"]}),e.jsx(ge,{className:"text-gray-400",children:j.createdAt?new Date(j.createdAt).toLocaleString():"-"})]},j.id)),r.length===0&&e.jsx(et,{children:e.jsx(ge,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),e.jsx(Gs,{page:c,totalPages:N,total:l,pageSize:m,onPageChange:d,onPageSizeChange:j=>{f(j),d(1)}})]})})})]})}function U3(){const[r,a]=u.useState([]),[l,i]=u.useState(!0),[c,d]=u.useState(!1),[m,f]=u.useState(null),[p,y]=u.useState(""),[g,v]=u.useState(0),[k,P]=u.useState(!1);async function T(){i(!0);try{const b=await Le("/api/db/vip-roles");b!=null&&b.success&&b.data&&a(b.data)}catch(b){console.error("Load roles error:",b)}finally{i(!1)}}u.useEffect(()=>{T()},[]);const N=()=>{f(null),y(""),v(r.length>0?Math.max(...r.map(b=>b.sort))+1:0),d(!0)},j=b=>{f(b),y(b.name),v(b.sort),d(!0)},C=async()=>{if(!p.trim()){alert("角色名称不能为空");return}P(!0);try{if(m){const b=await yt("/api/db/vip-roles",{id:m.id,name:p.trim(),sort:g});b!=null&&b.success?(d(!1),T()):alert("更新失败: "+(b==null?void 0:b.error))}else{const b=await ut("/api/db/vip-roles",{name:p.trim(),sort:g});b!=null&&b.success?(d(!1),T()):alert("新增失败: "+(b==null?void 0:b.error))}}catch(b){console.error("Save error:",b),alert("保存失败")}finally{P(!1)}},E=async b=>{if(confirm("确定删除该角色?已设置该角色的 VIP 用户将保留角色名称。"))try{const R=await Cr(`/api/db/vip-roles?id=${b}`);R!=null&&R.success?T():alert("删除失败: "+(R==null?void 0:R.error))}catch(R){console.error("Delete error:",R),alert("删除失败")}};return e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[e.jsx(an,{className:"w-5 h-5 text-amber-400"}),"VIP 角色管理"]}),e.jsx("p",{className:"text-gray-400 mt-1",children:"超级个体固定角色,在「设置 VIP」时可选择或手动填写"})]}),e.jsxs(Z,{onClick:N,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"新增角色"]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsx(Se,{className:"p-0",children:l?e.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"ID"}),e.jsx(je,{className:"text-gray-400",children:"角色名称"}),e.jsx(je,{className:"text-gray-400",children:"排序"}),e.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),e.jsxs(ys,{children:[r.map(b=>e.jsxs(et,{className:"border-gray-700/50",children:[e.jsx(ge,{className:"text-gray-300",children:b.id}),e.jsx(ge,{className:"text-white",children:b.name}),e.jsx(ge,{className:"text-gray-400",children:b.sort}),e.jsxs(ge,{className:"text-right",children:[e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>j(b),className:"text-gray-400 hover:text-[#38bdac]",children:e.jsx(mt,{className:"w-4 h-4"})}),e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>E(b.id),className:"text-gray-400 hover:text-red-400",children:e.jsx(Gt,{className:"w-4 h-4"})})]})]},b.id)),r.length===0&&e.jsx(et,{children:e.jsx(ge,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无角色,点击「新增角色」添加"})})]})]})})}),e.jsx(Ct,{open:c,onOpenChange:d,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[e.jsx(kt,{children:e.jsx(Et,{className:"text-white",children:m?"编辑角色":"新增角色"})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"角色名称"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创始人、投资人",value:p,onChange:b=>y(b.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"排序(下拉展示顺序,越小越前)"}),e.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:g,onChange:b=>v(parseInt(b.target.value,10)||0)})]})]}),e.jsxs(Ot,{children:[e.jsxs(Z,{variant:"outline",onClick:()=>d(!1),className:"border-gray-600 text-gray-300",children:[e.jsx(xs,{className:"w-4 h-4 mr-2"}),"取消"]}),e.jsxs(Z,{onClick:C,disabled:k,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),k?"保存中...":"保存"]})]})]})})]})}function Bg({embedded:r=!1}){const[a,l]=u.useState([]),[i,c]=u.useState(!0),[d,m]=u.useState(!1),[f,p]=u.useState(null),[y,g]=u.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[v,k]=u.useState(!1),[P,T]=u.useState(!1),N=u.useRef(null),j=async I=>{var V;const w=(V=I.target.files)==null?void 0:V[0];if(w){T(!0);try{const te=new FormData;te.append("file",w),te.append("folder","mentors");const ie=Ru(),Y={};ie&&(Y.Authorization=`Bearer ${ie}`);const _=await(await fetch(Ba("/api/upload"),{method:"POST",body:te,credentials:"include",headers:Y})).json();_!=null&&_.success&&(_!=null&&_.url)?g(Q=>({...Q,avatar:_.url})):alert("上传失败: "+((_==null?void 0:_.error)||"未知错误"))}catch(te){console.error(te),alert("上传失败")}finally{T(!1),N.current&&(N.current.value="")}}};async function C(){c(!0);try{const I=await Le("/api/db/mentors");I!=null&&I.success&&I.data&&l(I.data)}catch(I){console.error("Load mentors error:",I)}finally{c(!1)}}u.useEffect(()=>{C()},[]);const E=()=>{g({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:a.length>0?Math.max(...a.map(I=>I.sort))+1:0,enabled:!0})},b=()=>{p(null),E(),m(!0)},R=I=>{p(I),g({name:I.name,avatar:I.avatar||"",intro:I.intro||"",tags:I.tags||"",priceSingle:I.priceSingle!=null?String(I.priceSingle):"",priceHalfYear:I.priceHalfYear!=null?String(I.priceHalfYear):"",priceYear:I.priceYear!=null?String(I.priceYear):"",quote:I.quote||"",whyFind:I.whyFind||"",offering:I.offering||"",judgmentStyle:I.judgmentStyle||"",sort:I.sort,enabled:I.enabled??!0}),m(!0)},G=async()=>{if(!y.name.trim()){alert("导师姓名不能为空");return}k(!0);try{const I=V=>V===""?void 0:parseFloat(V),w={name:y.name.trim(),avatar:y.avatar.trim()||void 0,intro:y.intro.trim()||void 0,tags:y.tags.trim()||void 0,priceSingle:I(y.priceSingle),priceHalfYear:I(y.priceHalfYear),priceYear:I(y.priceYear),quote:y.quote.trim()||void 0,whyFind:y.whyFind.trim()||void 0,offering:y.offering.trim()||void 0,judgmentStyle:y.judgmentStyle.trim()||void 0,sort:y.sort,enabled:y.enabled};if(f){const V=await yt("/api/db/mentors",{id:f.id,...w});V!=null&&V.success?(m(!1),C()):alert("更新失败: "+(V==null?void 0:V.error))}else{const V=await ut("/api/db/mentors",w);V!=null&&V.success?(m(!1),C()):alert("新增失败: "+(V==null?void 0:V.error))}}catch(I){console.error("Save error:",I),alert("保存失败")}finally{k(!1)}},X=async I=>{if(confirm("确定删除该导师?"))try{const w=await Cr(`/api/db/mentors?id=${I}`);w!=null&&w.success?C():alert("删除失败: "+(w==null?void 0:w.error))}catch(w){console.error("Delete error:",w),alert("删除失败")}},L=I=>I!=null?`¥${I}`:"-";return e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[e.jsx(Yt,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),e.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),e.jsxs(Z,{onClick:b,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsx(Se,{className:"p-0",children:i?e.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"ID"}),e.jsx(je,{className:"text-gray-400",children:"姓名"}),e.jsx(je,{className:"text-gray-400",children:"简介"}),e.jsx(je,{className:"text-gray-400",children:"单次"}),e.jsx(je,{className:"text-gray-400",children:"半年"}),e.jsx(je,{className:"text-gray-400",children:"年度"}),e.jsx(je,{className:"text-gray-400",children:"排序"}),e.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),e.jsxs(ys,{children:[a.map(I=>e.jsxs(et,{className:"border-gray-700/50",children:[e.jsx(ge,{className:"text-gray-300",children:I.id}),e.jsx(ge,{className:"text-white",children:I.name}),e.jsx(ge,{className:"text-gray-400 max-w-[200px] truncate",children:I.intro||"-"}),e.jsx(ge,{className:"text-gray-400",children:L(I.priceSingle)}),e.jsx(ge,{className:"text-gray-400",children:L(I.priceHalfYear)}),e.jsx(ge,{className:"text-gray-400",children:L(I.priceYear)}),e.jsx(ge,{className:"text-gray-400",children:I.sort}),e.jsxs(ge,{className:"text-right",children:[e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>R(I),className:"text-gray-400 hover:text-[#38bdac]",children:e.jsx(mt,{className:"w-4 h-4"})}),e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>X(I.id),className:"text-gray-400 hover:text-red-400",children:e.jsx(Gt,{className:"w-4 h-4"})})]})]},I.id)),a.length===0&&e.jsx(et,{children:e.jsx(ge,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),e.jsx(Ct,{open:d,onOpenChange:m,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsx(kt,{children:e.jsx(Et,{className:"text-white",children:f?"编辑导师":"新增导师"})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"姓名 *"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:y.name,onChange:I=>g(w=>({...w,name:I.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"排序"}),e.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:y.sort,onChange:I=>g(w=>({...w,sort:parseInt(I.target.value,10)||0}))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"头像"}),e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:y.avatar,onChange:I=>g(w=>({...w,avatar:I.target.value})),placeholder:"点击上传或粘贴图片地址"}),e.jsx("input",{ref:N,type:"file",accept:"image/*",className:"hidden",onChange:j}),e.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:P,onClick:()=>{var I;return(I=N.current)==null?void 0:I.click()},children:[e.jsx(yo,{className:"w-4 h-4 mr-2"}),P?"上传中...":"上传"]})]}),y.avatar&&e.jsx("div",{className:"mt-2",children:e.jsx("img",{src:y.avatar.startsWith("http")?y.avatar:Ba(y.avatar),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"简介"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:y.intro,onChange:I=>g(w=>({...w,intro:I.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:y.tags,onChange:I=>g(w=>({...w,tags:I.target.value}))})]}),e.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[e.jsx(se,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),e.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:y.priceSingle,onChange:I=>g(w=>({...w,priceSingle:I.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),e.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:y.priceHalfYear,onChange:I=>g(w=>({...w,priceHalfYear:I.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),e.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:y.priceYear,onChange:I=>g(w=>({...w,priceYear:I.target.value}))})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"引言"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:y.quote,onChange:I=>g(w=>({...w,quote:I.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"为什么找(文本)"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:y.whyFind,onChange:I=>g(w=>({...w,whyFind:I.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"提供什么(文本)"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:y.offering,onChange:I=>g(w=>({...w,offering:I.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:y.judgmentStyle,onChange:I=>g(w=>({...w,judgmentStyle:I.target.value}))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"enabled",checked:y.enabled,onChange:I=>g(w=>({...w,enabled:I.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),e.jsx(se,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),e.jsxs(Ot,{children:[e.jsxs(Z,{variant:"outline",onClick:()=>m(!1),className:"border-gray-600 text-gray-300",children:[e.jsx(xs,{className:"w-4 h-4 mr-2"}),"取消"]}),e.jsxs(Z,{onClick:G,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存"]})]})]})})]})}function V3(){const[r,a]=u.useState([]),[l,i]=u.useState(!0),[c,d]=u.useState("");async function m(){i(!0);try{const y=c?`/api/db/mentor-consultations?status=${c}`:"/api/db/mentor-consultations",g=await Le(y);g!=null&&g.success&&g.data&&a(g.data)}catch(y){console.error("Load consultations error:",y)}finally{i(!1)}}u.useEffect(()=>{m()},[c]);const f={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},p={single:"单次",half_year:"半年",year:"年度"};return e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[e.jsx(po,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),e.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:c,onChange:y=>d(y.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[e.jsx("option",{value:"",children:"全部状态"}),Object.entries(f).map(([y,g])=>e.jsx("option",{value:y,children:g},y))]}),e.jsxs(Z,{onClick:m,disabled:l,variant:"outline",className:"border-gray-600 text-gray-300",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]})]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsx(Se,{className:"p-0",children:l?e.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"ID"}),e.jsx(je,{className:"text-gray-400",children:"用户ID"}),e.jsx(je,{className:"text-gray-400",children:"导师ID"}),e.jsx(je,{className:"text-gray-400",children:"类型"}),e.jsx(je,{className:"text-gray-400",children:"金额"}),e.jsx(je,{className:"text-gray-400",children:"状态"}),e.jsx(je,{className:"text-gray-400",children:"创建时间"})]})}),e.jsxs(ys,{children:[r.map(y=>e.jsxs(et,{className:"border-gray-700/50",children:[e.jsx(ge,{className:"text-gray-300",children:y.id}),e.jsx(ge,{className:"text-gray-400",children:y.userId}),e.jsx(ge,{className:"text-gray-400",children:y.mentorId}),e.jsx(ge,{className:"text-gray-400",children:p[y.consultationType]||y.consultationType}),e.jsxs(ge,{className:"text-white",children:["¥",y.amount]}),e.jsx(ge,{className:"text-gray-400",children:f[y.status]||y.status}),e.jsx(ge,{className:"text-gray-500 text-sm",children:y.createdAt})]},y.id)),r.length===0&&e.jsx(et,{children:e.jsx(ge,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const Fl={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},Mx={matchTypes:[{id:"partner",label:"找伙伴",matchLabel:"找伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10},poolSettings:Fl},W3=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function H3(){const r=yn(),[a,l]=u.useState(Mx),[i,c]=u.useState(!0),[d,m]=u.useState(!1),[f,p]=u.useState(!1),[y,g]=u.useState(null),[v,k]=u.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[P,T]=u.useState(null),[N,j]=u.useState(!1),C=async()=>{j(!0);try{const w=await Le("/api/db/match-pool-counts");w!=null&&w.success&&w.data&&T(w.data)}catch(w){console.error("加载池子人数失败:",w)}finally{j(!1)}},E=async()=>{c(!0);try{const w=await Le("/api/db/config/full?key=match_config"),V=(w==null?void 0:w.data)??(w==null?void 0:w.config);if(V){let te=V.poolSettings??Fl;te.poolSource&&!Array.isArray(te.poolSource)&&(te={...te,poolSource:[te.poolSource]}),l({...Mx,...V,poolSettings:te})}}catch(w){console.error("加载匹配配置失败:",w)}finally{c(!1)}};u.useEffect(()=>{E(),C()},[]);const b=async()=>{m(!0);try{const w=await ut("/api/db/config",{key:"match_config",value:a,description:"匹配功能配置"});alert((w==null?void 0:w.success)!==!1?"配置保存成功!":"保存失败: "+((w==null?void 0:w.error)||"未知错误"))}catch(w){console.error(w),alert("保存失败")}finally{m(!1)}},R=w=>{g(w),k({...w}),p(!0)},G=()=>{g(null),k({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),p(!0)},X=()=>{if(!v.id||!v.label){alert("请填写类型ID和名称");return}const w=[...a.matchTypes];if(y){const V=w.findIndex(te=>te.id===y.id);V!==-1&&(w[V]={...v})}else{if(w.some(V=>V.id===v.id)){alert("类型ID已存在");return}w.push({...v})}l({...a,matchTypes:w}),p(!1)},L=w=>{confirm("确定要删除这个匹配类型吗?")&&l({...a,matchTypes:a.matchTypes.filter(V=>V.id!==w)})},I=w=>{l({...a,matchTypes:a.matchTypes.map(V=>V.id===w?{...V,enabled:!V.enabled}:V)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsxs(Z,{variant:"outline",onClick:E,disabled:i,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${i?"animate-spin":""}`})," 刷新"]}),e.jsxs(Z,{onClick:b,disabled:d,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"})," ",d?"保存中...":"保存配置"]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(rp,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),e.jsx(vt,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),e.jsxs(Se,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(se,{className:"text-gray-300",children:"匹配来源池"}),e.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(w=>{const V=a.poolSettings??Fl,ie=(Array.isArray(V.poolSource)?V.poolSource:[V.poolSource]).includes(w.value),Y=P==null?void 0:P[w.countKey],ne=()=>{const _=Array.isArray(V.poolSource)?[...V.poolSource]:[V.poolSource],Q=ie?_.filter(ue=>ue!==w.value):[..._,w.value];Q.length===0&&Q.push(w.value),l({...a,poolSettings:{...V,poolSource:Q}})};return e.jsxs("button",{type:"button",onClick:ne,className:`p-4 rounded-lg border text-left transition-all ${ie?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${ie?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:ie&&"✓"}),e.jsx("span",{className:"text-xl",children:w.icon}),e.jsx("span",{className:`text-sm font-medium ${ie?"text-[#38bdac]":"text-gray-300"}`,children:w.label})]}),e.jsxs("span",{className:"text-lg font-bold text-white",children:[N?"...":Y??"-",e.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),e.jsx("p",{className:"text-gray-500 text-xs mt-2",children:w.desc}),e.jsx("span",{role:"link",tabIndex:0,onClick:_=>{_.stopPropagation(),r(`/users?pool=${w.value}`)},onKeyDown:_=>{_.key==="Enter"&&(_.stopPropagation(),r(`/users?pool=${w.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},w.value)})})]}),e.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[e.jsx(se,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(w=>{const te=(a.poolSettings??Fl)[w.key];return e.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[e.jsx(dt,{checked:te,onCheckedChange:ie=>l({...a,poolSettings:{...a.poolSettings??Fl,[w.key]:ie}})}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:w.icon}),e.jsx(se,{className:"text-gray-300 text-sm",children:w.label})]})]},w.key)})})]})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50",children:[e.jsxs(Qe,{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(on,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),e.jsx(vt,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),e.jsxs(Se,{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"每日免费匹配次数"}),e.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:a.freeMatchLimit,onChange:w=>l({...a,freeMatchLimit:parseInt(w.target.value,10)||0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"付费匹配价格(元)"}),e.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:a.matchPrice,onChange:w=>l({...a,matchPrice:parseFloat(w.target.value)||1})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"每日最大匹配次数"}),e.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:a.settings.maxMatchesPerDay,onChange:w=>l({...a,settings:{...a.settings,maxMatchesPerDay:parseInt(w.target.value,10)||10}})})]})]}),e.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(dt,{checked:a.settings.enableFreeMatches,onCheckedChange:w=>l({...a,settings:{...a.settings,enableFreeMatches:w}})}),e.jsx(se,{className:"text-gray-300",children:"启用免费匹配"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(dt,{checked:a.settings.enablePaidMatches,onCheckedChange:w=>l({...a,settings:{...a.settings,enablePaidMatches:w}})}),e.jsx(se,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50",children:[e.jsxs(Qe,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(qe,{className:"text-white flex items-center gap-2",children:[e.jsx(Yt,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),e.jsx(vt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),e.jsxs(Z,{onClick:G,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(Rt,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),e.jsx(Se,{children:e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"图标"}),e.jsx(je,{className:"text-gray-400",children:"类型ID"}),e.jsx(je,{className:"text-gray-400",children:"显示名称"}),e.jsx(je,{className:"text-gray-400",children:"匹配标签"}),e.jsx(je,{className:"text-gray-400",children:"价格"}),e.jsx(je,{className:"text-gray-400",children:"数据库匹配"}),e.jsx(je,{className:"text-gray-400",children:"状态"}),e.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),e.jsx(ys,{children:a.matchTypes.map(w=>e.jsxs(et,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[e.jsx(ge,{children:e.jsx("span",{className:"text-2xl",children:w.icon})}),e.jsx(ge,{className:"font-mono text-gray-300",children:w.id}),e.jsx(ge,{className:"text-white font-medium",children:w.label}),e.jsx(ge,{className:"text-gray-300",children:w.matchLabel}),e.jsx(ge,{children:e.jsxs(Oe,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",w.price]})}),e.jsx(ge,{children:w.matchFromDB?e.jsx(Oe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):e.jsx(Oe,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),e.jsx(ge,{children:e.jsx(dt,{checked:w.enabled,onCheckedChange:()=>I(w.id)})}),e.jsx(ge,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>R(w),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:e.jsx(mt,{className:"w-4 h-4"})}),e.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>L(w.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:e.jsx(Gt,{className:"w-4 h-4"})})]})})]},w.id))})]})})]}),e.jsx(Ct,{open:f,onOpenChange:p,children:e.jsxs(jt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[e.jsx(kt,{children:e.jsxs(Et,{className:"text-white flex items-center gap-2",children:[y?e.jsx(mt,{className:"w-5 h-5 text-[#38bdac]"}):e.jsx(Rt,{className:"w-5 h-5 text-[#38bdac]"}),y?"编辑匹配类型":"添加匹配类型"]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"类型ID(英文)"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:v.id,onChange:w=>k({...v,id:w.target.value}),disabled:!!y})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"图标"}),e.jsx("div",{className:"flex gap-1 flex-wrap",children:W3.map(w=>e.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${v.icon===w?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>k({...v,icon:w}),children:w},w))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"显示名称"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:v.label,onChange:w=>k({...v,label:w.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"匹配标签"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:v.matchLabel,onChange:w=>k({...v,matchLabel:w.target.value})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"text-gray-300",children:"单次匹配价格(元)"}),e.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:v.price,onChange:w=>k({...v,price:parseFloat(w.target.value)||1})})]}),e.jsxs("div",{className:"flex gap-6 pt-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(dt,{checked:v.matchFromDB,onCheckedChange:w=>k({...v,matchFromDB:w})}),e.jsx(se,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(dt,{checked:v.showJoinAfterMatch,onCheckedChange:w=>k({...v,showJoinAfterMatch:w})}),e.jsx(se,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(dt,{checked:v.enabled,onCheckedChange:w=>k({...v,enabled:w})}),e.jsx(se,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),e.jsxs(Ot,{children:[e.jsx(Z,{variant:"outline",onClick:()=>p(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),e.jsxs(Z,{onClick:X,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const Ax={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function K3(){const[r,a]=u.useState([]),[l,i]=u.useState(0),[c,d]=u.useState(1),[m,f]=u.useState(10),[p,y]=u.useState(""),[g,v]=u.useState(!0),[k,P]=u.useState(null),[T,N]=u.useState(null);async function j(){v(!0),P(null);try{const b=new URLSearchParams({page:String(c),pageSize:String(m)});p&&b.set("matchType",p);const R=await Le(`/api/db/match-records?${b}`);R!=null&&R.success?(a(R.records||[]),i(R.total??0)):P("加载匹配记录失败")}catch{P("加载失败,请检查网络后重试")}finally{v(!1)}}u.useEffect(()=>{j()},[c,p]);const C=Math.ceil(l/m)||1,E=({userId:b,nickname:R,avatar:G})=>e.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>N(b),children:[e.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[G?e.jsx("img",{src:G,alt:"",className:"w-full h-full object-cover",onError:X=>{X.currentTarget.style.display="none"}}):null,e.jsx("span",{className:G?"hidden":"",children:(R||b||"?").charAt(0)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:R||b}),e.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[b==null?void 0:b.slice(0,16),(b==null?void 0:b.length)>16?"...":""]})]})]});return e.jsxs("div",{children:[k&&e.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[e.jsx("span",{children:k}),e.jsx("button",{type:"button",onClick:()=>P(null),className:"hover:text-red-300",children:"×"})]}),e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("p",{className:"text-gray-400",children:["共 ",l," 条匹配记录 · 点击用户名查看详情"]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("select",{value:p,onChange:b=>{y(b.target.value),d(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[e.jsx("option",{value:"",children:"全部类型"}),Object.entries(Ax).map(([b,R])=>e.jsx("option",{value:b,children:R},b))]}),e.jsxs("button",{type:"button",onClick:j,disabled:g,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[e.jsx(Be,{className:`w-4 h-4 ${g?"animate-spin":""}`})," 刷新"]})]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:e.jsx(Se,{className:"p-0",children:g?e.jsxs("div",{className:"flex justify-center py-12",children:[e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"发起人"}),e.jsx(je,{className:"text-gray-400",children:"匹配到"}),e.jsx(je,{className:"text-gray-400",children:"类型"}),e.jsx(je,{className:"text-gray-400",children:"联系方式"}),e.jsx(je,{className:"text-gray-400",children:"匹配时间"})]})}),e.jsxs(ys,{children:[r.map(b=>e.jsxs(et,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[e.jsx(ge,{children:e.jsx(E,{userId:b.userId,nickname:b.userNickname,avatar:b.userAvatar})}),e.jsx(ge,{children:b.matchedUserId?e.jsx(E,{userId:b.matchedUserId,nickname:b.matchedNickname,avatar:b.matchedUserAvatar}):e.jsx("span",{className:"text-gray-500",children:"—"})}),e.jsx(ge,{children:e.jsx(Oe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Ax[b.matchType]||b.matchType})}),e.jsxs(ge,{className:"text-sm",children:[b.phone&&e.jsxs("div",{className:"text-green-400",children:["📱 ",b.phone]}),b.wechatId&&e.jsxs("div",{className:"text-blue-400",children:["💬 ",b.wechatId]}),!b.phone&&!b.wechatId&&e.jsx("span",{className:"text-gray-600",children:"-"})]}),e.jsx(ge,{className:"text-gray-400",children:b.createdAt?new Date(b.createdAt).toLocaleString():"-"})]},b.id)),r.length===0&&e.jsx(et,{children:e.jsx(ge,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),e.jsx(Gs,{page:c,totalPages:C,total:l,pageSize:m,onPageChange:d,onPageSizeChange:b=>{f(b),d(1)}})]})})}),e.jsx(E0,{open:!!T,onClose:()=>N(null),userId:T,onUserUpdated:j})]})}function G3(){const[r,a]=u.useState("records");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>a("records"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${r==="records"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配记录"}),e.jsx("button",{type:"button",onClick:()=>a("pool"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${r==="pool"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配池设置"})]}),r==="records"&&e.jsx(K3,{}),r==="pool"&&e.jsx(H3,{})]})}const Dx={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function Y3(){const[r,a]=u.useState([]),[l,i]=u.useState(0),[c,d]=u.useState(1),[m,f]=u.useState(10),[p,y]=u.useState(!0),[g,v]=u.useState("investor"),[k,P]=u.useState(null);async function T(){y(!0);try{const E=new URLSearchParams({page:String(c),pageSize:String(m),matchType:g}),b=await Le(`/api/db/match-records?${E}`);b!=null&&b.success&&(a(b.records||[]),i(b.total??0))}catch(E){console.error(E)}finally{y(!1)}}u.useEffect(()=>{T()},[c,g]);const N=async E=>{if(!E.phone&&!E.wechatId){alert("该记录无联系方式,无法推送到存客宝");return}P(E.id);try{const b=await ut("/api/ckb/join",{type:E.matchType||"investor",phone:E.phone||"",wechat:E.wechatId||"",userId:E.userId,name:E.userNickname||""});alert((b==null?void 0:b.message)||(b!=null&&b.success?"推送成功":"推送失败"))}catch(b){alert("推送失败: "+(b instanceof Error?b.message:"网络错误"))}finally{P(null)}},j=Math.ceil(l/m)||1,C=E=>!!(E.phone||E.wechatId);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),e.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",l," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:g,onChange:E=>{v(E.target.value),d(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(Dx).map(([E,b])=>e.jsx("option",{value:E,children:b},E))}),e.jsxs(Z,{onClick:T,disabled:p,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${p?"animate-spin":""}`})," 刷新"]})]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:e.jsx(Se,{className:"p-0",children:p?e.jsxs("div",{className:"flex justify-center py-12",children:[e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"发起人"}),e.jsx(je,{className:"text-gray-400",children:"匹配到"}),e.jsx(je,{className:"text-gray-400",children:"类型"}),e.jsx(je,{className:"text-gray-400",children:"联系方式"}),e.jsx(je,{className:"text-gray-400",children:"时间"}),e.jsx(je,{className:"text-gray-400 text-right",children:"操作"})]})}),e.jsxs(ys,{children:[r.map(E=>{var b,R;return e.jsxs(et,{className:`border-gray-700/50 ${C(E)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[e.jsx(ge,{className:"text-white",children:E.userNickname||((b=E.userId)==null?void 0:b.slice(0,12))}),e.jsx(ge,{className:"text-white",children:E.matchedNickname||((R=E.matchedUserId)==null?void 0:R.slice(0,12))}),e.jsx(ge,{children:e.jsx(Oe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Dx[E.matchType]||E.matchType})}),e.jsxs(ge,{className:"text-sm",children:[E.phone&&e.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&e.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&e.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),e.jsx(ge,{className:"text-gray-400 text-sm",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"}),e.jsx(ge,{className:"text-right",children:C(E)?e.jsxs(Z,{size:"sm",onClick:()=>N(E),disabled:k===E.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[e.jsx(hN,{className:"w-3 h-3 mr-1"}),k===E.id?"推送中...":"推送CKB"]}):e.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},E.id)}),r.length===0&&e.jsx(et,{children:e.jsx(ge,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),e.jsx(Gs,{page:c,totalPages:j,total:l,pageSize:m,onPageChange:d,onPageSizeChange:E=>{f(E),d(1)}})]})})})]})}const Lx={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},Q3={single:"单次",half_year:"半年",year:"年度"};function q3(){const[r,a]=u.useState([]),[l,i]=u.useState(!0),[c,d]=u.useState("");async function m(){i(!0);try{const f=c?`/api/db/mentor-consultations?status=${c}`:"/api/db/mentor-consultations",p=await Le(f);p!=null&&p.success&&p.data&&a(p.data)}catch(f){console.error(f)}finally{i(!1)}}return u.useEffect(()=>{m()},[c]),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:c,onChange:f=>d(f.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[e.jsx("option",{value:"",children:"全部状态"}),Object.entries(Lx).map(([f,p])=>e.jsx("option",{value:f,children:p},f))]}),e.jsxs(Z,{onClick:m,disabled:l,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Be,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`})," 刷新"]})]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50",children:e.jsx(Se,{className:"p-0",children:l?e.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"ID"}),e.jsx(je,{className:"text-gray-400",children:"用户ID"}),e.jsx(je,{className:"text-gray-400",children:"导师ID"}),e.jsx(je,{className:"text-gray-400",children:"类型"}),e.jsx(je,{className:"text-gray-400",children:"金额"}),e.jsx(je,{className:"text-gray-400",children:"状态"}),e.jsx(je,{className:"text-gray-400",children:"创建时间"})]})}),e.jsxs(ys,{children:[r.map(f=>e.jsxs(et,{className:"border-gray-700/50",children:[e.jsx(ge,{className:"text-gray-300",children:f.id}),e.jsx(ge,{className:"text-gray-400",children:f.userId}),e.jsx(ge,{className:"text-gray-400",children:f.mentorId}),e.jsx(ge,{className:"text-gray-400",children:Q3[f.consultationType]||f.consultationType}),e.jsxs(ge,{className:"text-white",children:["¥",f.amount]}),e.jsx(ge,{className:"text-gray-400",children:Lx[f.status]||f.status}),e.jsx(ge,{className:"text-gray-500 text-sm",children:f.createdAt?new Date(f.createdAt).toLocaleString():"-"})]},f.id)),r.length===0&&e.jsx(et,{children:e.jsx(ge,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function X3(){const[r,a]=u.useState("booking");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>a("booking"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${r==="booking"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"预约记录"}),e.jsx("button",{type:"button",onClick:()=>a("manage"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${r==="manage"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"导师管理"})]}),r==="booking"&&e.jsx(q3,{}),r==="manage"&&e.jsx("div",{className:"-mx-8",children:e.jsx(Bg,{embedded:!0})})]})}function J3(){const[r,a]=u.useState([]),[l,i]=u.useState(0),[c,d]=u.useState(1),[m,f]=u.useState(10),[p,y]=u.useState(!0);async function g(){y(!0);try{const k=new URLSearchParams({page:String(c),pageSize:String(m),matchType:"team"}),P=await Le(`/api/db/match-records?${k}`);P!=null&&P.success&&(a(P.records||[]),i(P.total??0))}catch(k){console.error(k)}finally{y(!1)}}u.useEffect(()=>{g()},[c]);const v=Math.ceil(l/m)||1;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",l," 条"]}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),e.jsxs("button",{type:"button",onClick:g,disabled:p,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[e.jsx(Be,{className:`w-4 h-4 ${p?"animate-spin":""}`})," 刷新"]})]}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:e.jsx(Se,{className:"p-0",children:p?e.jsxs("div",{className:"flex justify-center py-12",children:[e.jsx(Be,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),e.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ps,{children:[e.jsx(gs,{children:e.jsxs(et,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[e.jsx(je,{className:"text-gray-400",children:"发起人"}),e.jsx(je,{className:"text-gray-400",children:"匹配到"}),e.jsx(je,{className:"text-gray-400",children:"联系方式"}),e.jsx(je,{className:"text-gray-400",children:"时间"})]})}),e.jsxs(ys,{children:[r.map(k=>e.jsxs(et,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[e.jsx(ge,{className:"text-white",children:k.userNickname||k.userId}),e.jsx(ge,{className:"text-white",children:k.matchedNickname||k.matchedUserId}),e.jsxs(ge,{className:"text-gray-400 text-sm",children:[k.phone&&e.jsxs("div",{children:["📱 ",k.phone]}),k.wechatId&&e.jsxs("div",{children:["💬 ",k.wechatId]}),!k.phone&&!k.wechatId&&"-"]}),e.jsx(ge,{className:"text-gray-400",children:k.createdAt?new Date(k.createdAt).toLocaleString():"-"})]},k.id)),r.length===0&&e.jsx(et,{children:e.jsx(ge,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),e.jsx(Gs,{page:c,totalPages:v,total:l,pageSize:m,onPageChange:d,onPageSizeChange:k=>{f(k),d(1)}})]})})})]})}const Ox={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"},Fx={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮"};function Z3({onSwitchTab:r,onOpenCKB:a}={}){const l=yn(),[i,c]=u.useState(null),[d,m]=u.useState(null),[f,p]=u.useState(!0),y=u.useCallback(async()=>{var v,k;p(!0);try{const[P,T]=await Promise.allSettled([Le("/api/db/match-records?stats=true"),Le("/api/db/ckb-plan-stats")]);if(P.status==="fulfilled"&&((v=P.value)!=null&&v.success)&&P.value.data){let N=P.value.data;if(N.totalMatches>0&&(!N.uniqueUsers||N.uniqueUsers===0))try{const j=await Le("/api/db/match-records?page=1&pageSize=200");if(j!=null&&j.success&&j.records){const C=new Set(j.records.map(E=>E.userId).filter(Boolean));N={...N,uniqueUsers:C.size}}}catch{}c(N)}T.status==="fulfilled"&&((k=T.value)!=null&&k.success)&&T.value.data&&m(T.value.data)}catch(P){console.error("加载统计失败:",P)}finally{p(!1)}},[]);u.useEffect(()=>{y()},[y]);const g=v=>f?"—":String(v??0);return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(Yt,{className:"w-5 h-5 text-[#38bdac]"})," 找伙伴数据"]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",children:[e.jsx(we,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-[#38bdac]/60 transition-all",onClick:()=>r==null?void 0:r("partner"),children:e.jsxs(Se,{className:"p-6",children:[e.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"总匹配次数"}),e.jsx("p",{className:"text-4xl font-bold text-white",children:g(i==null?void 0:i.totalMatches)}),e.jsxs("p",{className:"text-[#38bdac] text-xs mt-3 flex items-center gap-1",children:[e.jsx(hn,{className:"w-3 h-3"})," 查看匹配记录"]})]})}),e.jsx(we,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-yellow-500/60 transition-all",onClick:()=>r==null?void 0:r("partner"),children:e.jsxs(Se,{className:"p-6",children:[e.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"今日匹配"}),e.jsx("p",{className:"text-4xl font-bold text-white",children:g(i==null?void 0:i.todayMatches)}),e.jsxs("p",{className:"text-yellow-400/60 text-xs mt-3 flex items-center gap-1",children:[e.jsx(on,{className:"w-3 h-3"})," 今日实时"]})]})}),e.jsx(we,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-blue-500/60 transition-all",onClick:()=>l("/users"),children:e.jsxs(Se,{className:"p-6",children:[e.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"匹配用户数"}),e.jsx("p",{className:"text-4xl font-bold text-white",children:g(i==null?void 0:i.uniqueUsers)}),e.jsxs("p",{className:"text-blue-400/60 text-xs mt-3 flex items-center gap-1",children:[e.jsx(hn,{className:"w-3 h-3"})," 查看用户管理"]})]})}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/40",children:e.jsxs(Se,{className:"p-6",children:[e.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"人均匹配"}),e.jsx("p",{className:"text-3xl font-bold text-white",children:f?"—":i!=null&&i.uniqueUsers?(i.totalMatches/i.uniqueUsers).toFixed(1):"0"})]})}),e.jsx(we,{className:"bg-[#0f2137] border-gray-700/40",children:e.jsxs(Se,{className:"p-6",children:[e.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"付费匹配次数"}),e.jsx("p",{className:"text-3xl font-bold text-white",children:g(i==null?void 0:i.paidMatchCount)})]})})]})]}),(i==null?void 0:i.byType)&&i.byType.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"各类型匹配分布"}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:i.byType.map(v=>{const k=i.totalMatches>0?v.count/i.totalMatches*100:0;return e.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/40 rounded-xl p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:"text-2xl",children:Fx[v.matchType]||"📊"}),e.jsx("span",{className:"text-gray-300 font-medium",children:Ox[v.matchType]||v.matchType})]}),e.jsx("p",{className:"text-3xl font-bold text-white mb-2",children:v.count}),e.jsx("div",{className:"w-full h-2 bg-gray-700/50 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-[#38bdac] rounded-full transition-all",style:{width:`${Math.min(k,100)}%`}})}),e.jsxs("p",{className:"text-gray-500 text-xs mt-1.5",children:[k.toFixed(1),"%"]})]},v.matchType)})})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(Sr,{className:"w-5 h-5 text-orange-400"})," AI 获客数据"]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5 mb-6",children:[e.jsx(we,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>a==null?void 0:a("submitted"),children:e.jsxs(Se,{className:"p-6",children:[e.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"已提交线索"}),e.jsx("p",{className:"text-3xl font-bold text-white",children:f?"—":(d==null?void 0:d.ckbTotal)??0}),e.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),e.jsx(we,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>a==null?void 0:a("contact"),children:e.jsxs(Se,{className:"p-6",children:[e.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"有联系方式"}),e.jsx("p",{className:"text-3xl font-bold text-white",children:f?"—":(d==null?void 0:d.withContact)??0}),e.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),e.jsx(we,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>a==null?void 0:a("test"),children:e.jsxs(Se,{className:"p-6",children:[e.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"AI 添加进度"}),e.jsx("p",{className:"text-xl font-bold text-orange-400",children:"查看详情 →"}),e.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"添加成功率 · 回复率 · API 文档"})]})})]}),(d==null?void 0:d.byType)&&d.byType.length>0&&e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:d.byType.map(v=>e.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-lg p-4 flex items-center gap-3",children:[e.jsx("span",{className:"text-xl",children:Fx[v.matchType]||"📋"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-xs",children:Ox[v.matchType]||v.matchType}),e.jsx("p",{className:"text-xl font-bold text-white",children:v.total})]})]},v.matchType))})]})]})}const eC=["partner","investor","mentor","team"],Qd=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],zx=`# 场景获客接口摘要 -- 地址:POST /v1/api/scenarios -- 必填:apiKey、sign、timestamp -- 主标识:phone 或 wechatId 至少一项 -- 可选:name、source、remark、tags、siteTags、portrait -- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 -- 成功:code=200,message=新增成功 或 已存在`;function tC({initialTab:r="overview"}){const[a,l]=u.useState(r),[i,c]=u.useState("13800000000"),[d,m]=u.useState(""),[f,p]=u.useState(""),[y,g]=u.useState(zx),[v,k]=u.useState(!1),[P,T]=u.useState(!1),[N,j]=u.useState([]),[C,E]=u.useState([]),[b,R]=u.useState({}),[G,X]=u.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),L=u.useMemo(()=>{const _={};return Qd.forEach(Q=>{_[Q.key]=b[Q.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),_},[b]),I=_=>{const Q=i.trim(),ue=d.trim();return _<=3?{type:eC[_],phone:Q||void 0,wechat:ue||void 0,userId:"admin_test",name:"后台测试"}:_===4?{matchType:"partner",phone:Q||void 0,wechat:ue||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:_===5?{phone:Q||void 0,wechatId:ue||void 0,userId:"admin_test",name:"后台测试"}:{}};async function w(){T(!0);try{const[_,Q,ue]=await Promise.all([Le("/api/db/config/full?key=ckb_config"),Le("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Le("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),O=_==null?void 0:_.data;O!=null&&O.routes&&R(O.routes),O!=null&&O.docNotes&&p(O.docNotes),O!=null&&O.docContent&&g(O.docContent),Q!=null&&Q.success&&j(Q.records||[]),ue!=null&&ue.success&&E(ue.records||[])}finally{T(!1)}}u.useEffect(()=>{l(r)},[r]),u.useEffect(()=>{w()},[]);async function V(){k(!0);try{const _=await ut("/api/db/config",{key:"ckb_config",value:{routes:L,docNotes:f,docContent:y},description:"存客宝接口配置"});alert((_==null?void 0:_.success)!==!1?"存客宝配置已保存":`保存失败: ${(_==null?void 0:_.error)||"未知错误"}`)}catch(_){alert(`保存失败: ${_ instanceof Error?_.message:"网络错误"}`)}finally{k(!1)}}const te=(_,Q)=>{R(ue=>({...ue,[_]:{...L[_],...Q}}))},ie=async _=>{const Q=G[_];if(Q.method==="POST"&&!i.trim()&&!d.trim()){alert("请填写测试手机号");return}const ue=[...G];ue[_]={...Q,status:"testing",message:void 0,responseTime:void 0},X(ue);const O=performance.now();try{const re=Q.method==="GET"?await Le(Q.endpoint):await ut(Q.endpoint,I(_)),H=Math.round(performance.now()-O),A=(re==null?void 0:re.message)||"",$=(re==null?void 0:re.success)===!0||A.includes("已存在")||A.includes("已加入")||A.includes("已提交"),z=[...G];z[_]={...Q,status:$?"success":"error",message:A||($?"正常":"异常"),responseTime:H},X(z),await w()}catch(re){const H=Math.round(performance.now()-O),A=[...G];A[_]={...Q,status:"error",message:re instanceof Error?re.message:"失败",responseTime:H},X(A)}},Y=async()=>{if(!i.trim()&&!d.trim()){alert("请填写测试手机号");return}for(let _=0;_e.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),e.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),e.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),e.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),e.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),e.jsx("tbody",{children:_.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:Q})}):_.map(ue=>e.jsxs("tr",{className:"border-t border-gray-700/30",children:[e.jsx("td",{className:"px-4 py-3 text-white",children:ue.userNickname||ue.userId}),e.jsx("td",{className:"px-4 py-3 text-gray-300",children:ue.matchType}),e.jsx("td",{className:"px-4 py-3 text-green-400",children:ue.phone||"—"}),e.jsx("td",{className:"px-4 py-3 text-blue-400",children:ue.wechatId||"—"}),e.jsx("td",{className:"px-4 py-3 text-gray-400",children:ue.createdAt?new Date(ue.createdAt).toLocaleString():"—"})]},ue.id))})]})});return e.jsx(we,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:e.jsxs(Se,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),e.jsx(Oe,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),e.jsxs("button",{type:"button",onClick:()=>l("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[e.jsx(hn,{className:"w-3 h-3"})," API 文档"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Z,{onClick:()=>w(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[e.jsx(Be,{className:`w-3.5 h-3.5 mr-1 ${P?"animate-spin":""}`})," 刷新"]}),e.jsxs(Z,{onClick:V,disabled:v,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[e.jsx(It,{className:"w-3.5 h-3.5 mr-1"})," ",v?"保存中...":"保存配置"]})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","已提交线索"],["contact","有联系方式"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([_,Q])=>e.jsx("button",{type:"button",onClick:()=>l(_),className:`px-4 py-2 rounded-lg text-sm transition-colors ${a===_?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:Q},_))}),a==="overview"&&e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[e.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"已提交线索"}),e.jsx("p",{className:"text-3xl font-bold text-white",children:N.length})]}),e.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[e.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"有联系方式"}),e.jsx("p",{className:"text-3xl font-bold text-white",children:C.length})]}),e.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[e.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"场景配置数"}),e.jsx("p",{className:"text-3xl font-bold text-white",children:Qd.length})]}),e.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[e.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),e.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:f||"未填写"})]})]}),a==="submitted"&&ne(N,"暂无已提交线索"),a==="contact"&&ne(C,"暂无有联系方式线索"),a==="config"&&e.jsx("div",{className:"space-y-4",children:Qd.map(_=>e.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h4",{className:"text-white font-medium",children:_.label}),e.jsx(Oe,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:_.key})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(se,{className:"text-gray-500 text-xs",children:"API 地址"}),e.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:L[_.key].apiUrl,onChange:Q=>te(_.key,{apiUrl:Q.target.value})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(se,{className:"text-gray-500 text-xs",children:"API Key"}),e.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:L[_.key].apiKey,onChange:Q=>te(_.key,{apiKey:Q.target.value})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(se,{className:"text-gray-500 text-xs",children:"Source"}),e.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:L[_.key].source,onChange:Q=>te(_.key,{source:Q.target.value})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(se,{className:"text-gray-500 text-xs",children:"Tags"}),e.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:L[_.key].tags,onChange:Q=>te(_.key,{tags:Q.target.value})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(se,{className:"text-gray-500 text-xs",children:"SiteTags"}),e.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:L[_.key].siteTags,onChange:Q=>te(_.key,{siteTags:Q.target.value})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(se,{className:"text-gray-500 text-xs",children:"说明备注"}),e.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:L[_.key].notes,onChange:Q=>te(_.key,{notes:Q.target.value})})]})]})]},_.key))}),a==="test"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx(Ul,{className:"w-4 h-4 text-gray-500 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(se,{className:"text-gray-500 text-xs",children:"测试手机号"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:i,onChange:_=>c(_.target.value)})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(se,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),e.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:d,onChange:_=>m(_.target.value)})]})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs(Z,{onClick:Y,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[e.jsx(on,{className:"w-3.5 h-3.5 mr-1"})," 全部测试"]})})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:G.map((_,Q)=>e.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[_.status==="idle"&&e.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),_.status==="testing"&&e.jsx(Be,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),_.status==="success"&&e.jsx(tu,{className:"w-3 h-3 text-green-400 shrink-0"}),_.status==="error"&&e.jsx(tp,{className:"w-3 h-3 text-red-400 shrink-0"}),e.jsx("span",{className:"text-white text-xs truncate",children:_.label})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[_.responseTime!==void 0&&e.jsxs("span",{className:"text-gray-600 text-[10px]",children:[_.responseTime,"ms"]}),e.jsx("button",{type:"button",onClick:()=>ie(Q),disabled:_.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${_.endpoint}-${Q}`))})]}),a==="doc"&&e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h4",{className:"text-white text-sm font-medium",children:"场景获客 API 摘要"}),e.jsxs("a",{href:"https://ckbapi.quwanzhi.com/v1/api/scenarios",target:"_blank",rel:"noreferrer",className:"text-orange-400/70 hover:text-orange-400 text-xs flex items-center gap-1",children:[e.jsx(hn,{className:"w-3 h-3"})," 打开外链"]})]}),e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:y||zx})]}),e.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[e.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"说明备注(可编辑)"}),e.jsx("textarea",{className:"w-full min-h-[260px] bg-[#0f2137] border border-gray-700 rounded-md text-sm text-gray-300 p-3 outline-none focus:border-orange-500/50 resize-y",value:f,onChange:_=>p(_.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const sC=[{id:"stats",label:"数据统计",icon:qb},{id:"partner",label:"找伙伴",icon:Yt},{id:"resource",label:"资源对接",icon:Ij},{id:"mentor",label:"导师预约",icon:Pj},{id:"team",label:"团队招募",icon:lu}];function rC(){const[r,a]=u.useState("stats"),[l,i]=u.useState(!1),[c,d]=u.useState("overview");return e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[e.jsx(Yt,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),e.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),e.jsxs(Z,{type:"button",variant:"outline",onClick:()=>i(m=>!m),className:"border-orange-500/40 text-orange-300 hover:bg-orange-500/10 bg-transparent",children:[e.jsx(Sr,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),l&&e.jsx(tC,{initialTab:c}),e.jsx("div",{className:"flex flex-wrap gap-1 mb-6 bg-[#0f2137] rounded-lg p-1 border border-gray-700/50",children:sC.map(m=>{const f=r===m.id;return e.jsxs("button",{type:"button",onClick:()=>a(m.id),className:`flex items-center gap-2 px-5 py-2.5 rounded-md text-sm font-medium transition-all ${f?"bg-[#38bdac] text-white shadow-lg":"text-gray-400 hover:text-white hover:bg-gray-700/50"}`,children:[e.jsx(m.icon,{className:"w-4 h-4"}),m.label]},m.id)})}),r==="stats"&&e.jsx(Z3,{onSwitchTab:m=>a(m),onOpenCKB:m=>{d(m||"overview"),i(!0)}}),r==="partner"&&e.jsx(G3,{}),r==="resource"&&e.jsx(Y3,{}),r==="mentor"&&e.jsx(X3,{}),r==="team"&&e.jsx(J3,{})]})}function nC(){return e.jsxs("div",{className:"p-8 w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[e.jsx(Sr,{className:"w-8 h-8 text-[#38bdac]"}),e.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),e.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[e.jsx(Qe,{children:e.jsx(qe,{className:"text-white",children:"1. 接口总览"})}),e.jsxs(Se,{className:"space-y-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),e.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[e.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),e.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),e.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),e.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),e.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),e.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),e.jsx("li",{children:"/api/config — 配置系统"})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),e.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),e.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[e.jsx(Qe,{children:e.jsx(qe,{className:"text-white",children:"2. 书籍内容"})}),e.jsxs(Se,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[e.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),e.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),e.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[e.jsx(Qe,{children:e.jsx(qe,{className:"text-white",children:"3. 支付"})}),e.jsxs(Se,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[e.jsx("p",{children:"POST /api/payment/create-order — 创建订单"}),e.jsx("p",{children:"POST /api/payment/alipay/notify — 支付宝回调"}),e.jsx("p",{children:"POST /api/payment/wechat/notify — 微信回调"})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[e.jsx(Qe,{children:e.jsx(qe,{className:"text-white",children:"4. 分销与用户"})}),e.jsxs(Se,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[e.jsx("p",{children:"/api/referral/* — 邀请码、收益查询、提现"}),e.jsx("p",{children:"/api/user/* — 登录、注册、信息更新"}),e.jsx("p",{children:"/api/match/* — 匹配、匹配历史"})]})]}),e.jsxs(we,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[e.jsx(Qe,{children:e.jsx(qe,{className:"text-white",children:"5. 管理后台"})}),e.jsxs(Se,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[e.jsx("p",{children:"GET/POST /api/admin/referral-settings — 推广/分销设置(含 VIP 配置)"}),e.jsx("p",{children:"GET /api/db/users、/api/db/book — 用户与章节数据"}),e.jsx("p",{children:"GET /api/orders — 订单列表"})]})]}),e.jsx("p",{className:"text-gray-500 text-xs",children:"完整说明见项目内 开发文档/5、接口/API接口完整文档.md"})]})}function aC(){const r=gn();return e.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:e.jsxs("div",{className:"text-center max-w-md",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500/20 text-red-400 mb-6",children:e.jsx(nj,{className:"w-10 h-10"})}),e.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),e.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),e.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:r.pathname}),e.jsx(Z,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:e.jsxs(eu,{to:"/",children:[e.jsx(Mj,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function lC(){return e.jsxs(Eb,{children:[e.jsx(gt,{path:"/login",element:e.jsx(D1,{})}),e.jsxs(gt,{path:"/",element:e.jsx(FN,{}),children:[e.jsx(gt,{index:!0,element:e.jsx(Id,{to:"/dashboard",replace:!0})}),e.jsx(gt,{path:"dashboard",element:e.jsx(O1,{})}),e.jsx(gt,{path:"orders",element:e.jsx(N2,{})}),e.jsx(gt,{path:"users",element:e.jsx(Y2,{})}),e.jsx(gt,{path:"distribution",element:e.jsx(p4,{})}),e.jsx(gt,{path:"withdrawals",element:e.jsx(g4,{})}),e.jsx(gt,{path:"content",element:e.jsx(S3,{})}),e.jsx(gt,{path:"referral-settings",element:e.jsx(U0,{})}),e.jsx(gt,{path:"author-settings",element:e.jsx(Id,{to:"/settings?tab=author",replace:!0})}),e.jsx(gt,{path:"admin-users",element:e.jsx(Id,{to:"/settings?tab=admin",replace:!0})}),e.jsx(gt,{path:"vip-roles",element:e.jsx(U3,{})}),e.jsx(gt,{path:"mentors",element:e.jsx(Bg,{})}),e.jsx(gt,{path:"mentor-consultations",element:e.jsx(V3,{})}),e.jsx(gt,{path:"settings",element:e.jsx(_3,{})}),e.jsx(gt,{path:"payment",element:e.jsx(M3,{})}),e.jsx(gt,{path:"site",element:e.jsx(O3,{})}),e.jsx(gt,{path:"qrcodes",element:e.jsx(F3,{})}),e.jsx(gt,{path:"find-partner",element:e.jsx(rC,{})}),e.jsx(gt,{path:"match",element:e.jsx($3,{})}),e.jsx(gt,{path:"match-records",element:e.jsx(B3,{})}),e.jsx(gt,{path:"api-doc",element:e.jsx(nC,{})})]}),e.jsx(gt,{path:"*",element:e.jsx(aC,{})})]})}Iv.createRoot(document.getElementById("root")).render(e.jsx(u.StrictMode,{children:e.jsx(Db,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:e.jsx(lC,{})})})); diff --git a/soul-admin/dist/assets/index-z9Ciz_la.css b/soul-admin/dist/assets/index-z9Ciz_la.css new file mode 100644 index 00000000..1362fc15 --- /dev/null +++ b/soul-admin/dist/assets/index-z9Ciz_la.css @@ -0,0 +1 @@ +.rich-editor-wrapper{border:1px solid #374151;border-radius:.5rem;background:#0a1628;overflow:hidden}.rich-editor-toolbar{display:flex;align-items:center;gap:2px;padding:6px 8px;border-bottom:1px solid #374151;background:#0f1d32;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:1px}.toolbar-divider{width:1px;height:20px;background:#374151;margin:0 4px}.rich-editor-toolbar button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer;transition:all .15s}.rich-editor-toolbar button:hover{background:#1f2937;color:#d1d5db}.rich-editor-toolbar button.is-active{background:#38bdac33;color:#38bdac}.rich-editor-toolbar button:disabled{opacity:.3;cursor:not-allowed}.link-tag-select{background:#0a1628;border:1px solid #374151;color:#d1d5db;font-size:12px;padding:2px 6px;border-radius:4px;cursor:pointer;max-width:160px}.link-input-bar{display:flex;align-items:center;gap:4px;padding:4px 8px;border-bottom:1px solid #374151;background:#0f1d32}.link-input{flex:1;background:#0a1628;border:1px solid #374151;color:#fff;padding:4px 8px;border-radius:4px;font-size:13px}.link-confirm,.link-remove{padding:4px 10px;border-radius:4px;border:none;font-size:12px;cursor:pointer}.link-confirm{background:#38bdac;color:#fff}.link-remove{background:#374151;color:#9ca3af}.rich-editor-content{min-height:300px;max-height:500px;overflow-y:auto;padding:12px 16px;color:#e5e7eb;font-size:14px;line-height:1.7}.rich-editor-content:focus{outline:none}.rich-editor-content h1{font-size:1.5em;font-weight:700;margin:.8em 0 .4em;color:#fff}.rich-editor-content h2{font-size:1.3em;font-weight:600;margin:.7em 0 .3em;color:#fff}.rich-editor-content h3{font-size:1.15em;font-weight:600;margin:.6em 0 .3em;color:#fff}.rich-editor-content p{margin:.4em 0}.rich-editor-content strong{color:#fff}.rich-editor-content code{background:#1f2937;padding:2px 6px;border-radius:3px;font-size:.9em;color:#38bdac}.rich-editor-content pre{background:#1f2937;padding:12px;border-radius:6px;overflow-x:auto;margin:.6em 0}.rich-editor-content blockquote{border-left:3px solid #38bdac;padding-left:12px;margin:.6em 0;color:#9ca3af}.rich-editor-content ul,.rich-editor-content ol{padding-left:1.5em;margin:.4em 0}.rich-editor-content li{margin:.2em 0}.rich-editor-content hr{border:none;border-top:1px solid #374151;margin:1em 0}.rich-editor-content img{max-width:100%;border-radius:6px;margin:.5em 0}.rich-editor-content a,.rich-link{color:#38bdac;text-decoration:underline;cursor:pointer}.rich-editor-content table{border-collapse:collapse;width:100%;margin:.5em 0}.rich-editor-content th,.rich-editor-content td{border:1px solid #374151;padding:6px 10px;text-align:left}.rich-editor-content th{background:#1f2937;font-weight:600}.rich-editor-content .ProseMirror-placeholder:before{content:attr(data-placeholder);color:#6b7280;float:left;height:0;pointer-events:none}.mention-tag{background:#38bdac26;color:#38bdac;border-radius:4px;padding:1px 4px;font-weight:500}.mention-popup{position:fixed;z-index:9999;background:#1a2638;border:1px solid #374151;border-radius:8px;padding:4px;min-width:180px;max-height:240px;overflow-y:auto;box-shadow:0 4px 20px #0006}.mention-item{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:4px;cursor:pointer;color:#d1d5db;font-size:13px}.mention-item:hover,.mention-item.is-selected{background:#38bdac26;color:#38bdac}.mention-name{font-weight:500}.mention-id{font-size:11px;color:#6b7280}.bubble-menu{display:flex;gap:2px;background:#1a2638;border:1px solid #374151;border-radius:6px;padding:4px;box-shadow:0 4px 12px #0000004d}.bubble-menu button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer}.bubble-menu button:hover{background:#1f2937;color:#d1d5db}.bubble-menu button.is-active{color:#38bdac}/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2\.5{top:calc(var(--spacing)*-2.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.-left-2\.5{left:calc(var(--spacing)*-2.5)}.left-0{left:calc(var(--spacing)*0)}.left-1\/4{left:25%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-8{margin-inline:calc(var(--spacing)*-8)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-auto{margin-right:auto}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline\!{display:inline!important}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table\!{display:table!important}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-96{height:calc(var(--spacing)*96)}.h-\[75vh\]{height:75vh}.h-auto{height:auto}.h-full{height:100%}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[32px\]{min-height:32px}.min-h-\[40px\]{min-height:40px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[80px\]{min-height:80px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[260px\]{min-height:260px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-36{width:calc(var(--spacing)*36)}.w-40{width:calc(var(--spacing)*40)}.w-48{width:calc(var(--spacing)*48)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[1024px\]{min-width:1024px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}:where(.divide-gray-700\/50>:not(:last-child)){border-color:#36415380}@supports (color:color-mix(in lab,red,red)){:where(.divide-gray-700\/50>:not(:last-child)){border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}:where(.divide-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-\[\#07C160\]{border-color:#07c160}.border-\[\#07C160\]\/20{border-color:#07c16033}.border-\[\#07C160\]\/30{border-color:#07c1604d}.border-\[\#38bdac\]{border-color:#38bdac}.border-\[\#38bdac\]\/20{border-color:#38bdac33}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.border-cyan-500\/40{border-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/40{border-color:color-mix(in oklab,var(--color-cyan-500)40%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-700\/30{border-color:#3641534d}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/30{border-color:color-mix(in oklab,var(--color-gray-700)30%,transparent)}}.border-gray-700\/40{border-color:#36415366}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/40{border-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.border-gray-700\/50{border-color:#36415380}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/50{border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-orange-500\/20{border-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/20{border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.border-orange-500\/50{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/50{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.border-purple-500\/20{border-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/20{border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.border-purple-500\/40{border-color:#ac4bff66}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/40{border-color:color-mix(in oklab,var(--color-purple-500)40%,transparent)}}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-transparent{border-color:#0000}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.bg-\[\#0a1628\]{background-color:#0a1628}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#07C160\]{background-color:#07c160}.bg-\[\#07C160\]\/5{background-color:#07c1600d}.bg-\[\#07C160\]\/10{background-color:#07c1601a}.bg-\[\#38bdac\]{background-color:#38bdac}.bg-\[\#38bdac\]\/5{background-color:#38bdac0d}.bg-\[\#38bdac\]\/10{background-color:#38bdac1a}.bg-\[\#38bdac\]\/15{background-color:#38bdac26}.bg-\[\#38bdac\]\/20{background-color:#38bdac33}.bg-\[\#38bdac\]\/30{background-color:#38bdac4d}.bg-\[\#38bdac\]\/60{background-color:#38bdac99}.bg-\[\#38bdac\]\/80{background-color:#38bdaccc}.bg-\[\#162840\]{background-color:#162840}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-600\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#0f2137\]{--tw-gradient-from:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#162d4a\]{--tw-gradient-to:#162d4a;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-amber-400{fill:var(--color-amber-400)}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.py-24{padding-block:calc(var(--spacing)*24)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-6{padding-top:calc(var(--spacing)*6)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-4{padding-right:calc(var(--spacing)*4)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.text-wrap{text-wrap:wrap}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#00CED1\]{color:#00ced1}.text-\[\#07C160\]{color:#07c160}.text-\[\#07C160\]\/60{color:#07c16099}.text-\[\#07C160\]\/70{color:#07c160b3}.text-\[\#07C160\]\/80{color:#07c160cc}.text-\[\#26A17B\]{color:#26a17b}.text-\[\#38bdac\]{color:#38bdac}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#169BD7\]{color:#169bd7}.text-\[\#1677FF\]{color:#1677ff}.text-\[\#FFD700\]{color:gold}.text-amber-200{color:var(--color-amber-200)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/30{color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/30{color:color-mix(in oklab,var(--color-amber-400)30%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-blue-300\/60{color:#90c5ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/60{color:color-mix(in oklab,var(--color-blue-300)60%,transparent)}}.text-blue-400{color:var(--color-blue-400)}.text-blue-400\/60{color:#54a2ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-400\/60{color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/60{color:#ffb96d99}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/60{color:color-mix(in oklab,var(--color-orange-300)60%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-purple-400{color:var(--color-purple-400)}.text-red-400{color:var(--color-red-400)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-400\/60{color:#fac80099}@supports (color:color-mix(in lab,red,red)){.text-yellow-400\/60{color:color-mix(in oklab,var(--color-yellow-400)60%,transparent)}}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.italic\!{font-style:italic!important}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline\!{text-decoration-line:underline!important}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[\#38bdac\]\/20{--tw-shadow-color:#38bdac33}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/20{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.2) var(--tw-shadow-alpha),transparent)}}.shadow-\[\#38bdac\]\/30{--tw-shadow-color:#38bdac4d}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/30{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.3) var(--tw-shadow-alpha),transparent)}}.ring-\[\#38bdac\]{--tw-ring-color:#38bdac}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-\[\#38bdac\]:is(:where(.group):hover *){color:#38bdac}.group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.placeholder\:text-gray-500::placeholder{color:var(--color-gray-500)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-\[\#38bdac\]\/30:hover{border-color:#38bdac4d}.hover\:border-\[\#38bdac\]\/50:hover{border-color:#38bdac80}.hover\:border-\[\#38bdac\]\/60:hover{border-color:#38bdac99}.hover\:border-amber-500\/40:hover{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.hover\:border-amber-500\/40:hover{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.hover\:border-blue-500\/60:hover{border-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-500\/60:hover{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.hover\:border-gray-500:hover{border-color:var(--color-gray-500)}.hover\:border-gray-600:hover{border-color:var(--color-gray-600)}.hover\:border-orange-500\/50:hover{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.hover\:border-orange-500\/50:hover{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.hover\:border-yellow-500\/60:hover{border-color:#edb20099}@supports (color:color-mix(in lab,red,red)){.hover\:border-yellow-500\/60:hover{border-color:color-mix(in oklab,var(--color-yellow-500)60%,transparent)}}.hover\:bg-\[\#0a1628\]:hover{background-color:#0a1628}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-blue-400\/10:hover{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-400\/10:hover{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.hover\:bg-blue-500\/20:hover{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/20:hover{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-gray-500\/20:hover{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-500\/20:hover{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:text-\[\#2da396\]:hover{color:#2da396}.hover\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-300:hover{color:var(--color-amber-300)}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.focus\:border-orange-500\/50:focus{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.focus\:border-orange-500\/50:focus{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.focus\:bg-\[\#38bdac\]\/20:focus{background-color:#38bdac33}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[\#38bdac\]:focus{--tw-ring-color:#38bdac}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[\#38bdac\]:focus-visible{--tw-ring-color:#38bdac}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-\[\#0a1628\]:focus-visible{--tw-ring-offset-color:#0a1628}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-\[\#07C160\]\/20[data-state=active]{background-color:#07c16033}.data-\[state\=active\]\:bg-\[\#26A17B\]\/20[data-state=active]{background-color:#26a17b33}.data-\[state\=active\]\:bg-\[\#38bdac\]\/20[data-state=active]{background-color:#38bdac33}.data-\[state\=active\]\:bg-\[\#1677FF\]\/20[data-state=active]{background-color:#1677ff33}.data-\[state\=active\]\:bg-\[\#003087\]\/20[data-state=active]{background-color:#00308733}.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.data-\[state\=active\]\:font-medium[data-state=active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[state\=active\]\:text-\[\#07C160\][data-state=active]{color:#07c160}.data-\[state\=active\]\:text-\[\#26A17B\][data-state=active]{color:#26a17b}.data-\[state\=active\]\:text-\[\#38bdac\][data-state=active]{color:#38bdac}.data-\[state\=active\]\:text-\[\#169BD7\][data-state=active]{color:#169bd7}.data-\[state\=active\]\:text-\[\#1677FF\][data-state=active]{color:#1677ff}.data-\[state\=active\]\:text-amber-400[data-state=active]{color:var(--color-amber-400)}.data-\[state\=active\]\:text-purple-400[data-state=active]{color:var(--color-purple-400)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:bg-\[\#38bdac\][data-state=checked]{background-color:#38bdac}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-gray-600[data-state=unchecked]{background-color:var(--color-gray-600)}@media(min-width:40rem){.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/soul-admin/dist/index.html b/soul-admin/dist/index.html index 00b02796..40bf0dd2 100644 --- a/soul-admin/dist/index.html +++ b/soul-admin/dist/index.html @@ -4,8 +4,8 @@ 管理后台 - Soul创业派对 - - + +
    diff --git a/soul-admin/src/components/RichEditor.css b/soul-admin/src/components/RichEditor.css new file mode 100644 index 00000000..54747fd5 --- /dev/null +++ b/soul-admin/src/components/RichEditor.css @@ -0,0 +1,196 @@ +.rich-editor-wrapper { + border: 1px solid #374151; + border-radius: 0.5rem; + background: #0a1628; + overflow: hidden; +} + +.rich-editor-toolbar { + display: flex; + align-items: center; + gap: 2px; + padding: 6px 8px; + border-bottom: 1px solid #374151; + background: #0f1d32; + flex-wrap: wrap; +} + +.toolbar-group { + display: flex; + align-items: center; + gap: 1px; +} + +.toolbar-divider { + width: 1px; + height: 20px; + background: #374151; + margin: 0 4px; +} + +.rich-editor-toolbar button { + display: flex; + align-items: center; + justify-content: center; + width: 28px; + height: 28px; + border-radius: 4px; + border: none; + background: transparent; + color: #9ca3af; + cursor: pointer; + transition: all 0.15s; +} +.rich-editor-toolbar button:hover { background: #1f2937; color: #d1d5db; } +.rich-editor-toolbar button.is-active { background: rgba(56, 189, 172, 0.2); color: #38bdac; } +.rich-editor-toolbar button:disabled { opacity: 0.3; cursor: not-allowed; } + +.link-tag-select { + background: #0a1628; + border: 1px solid #374151; + color: #d1d5db; + font-size: 12px; + padding: 2px 6px; + border-radius: 4px; + cursor: pointer; + max-width: 160px; +} + +.link-input-bar { + display: flex; + align-items: center; + gap: 4px; + padding: 4px 8px; + border-bottom: 1px solid #374151; + background: #0f1d32; +} +.link-input { + flex: 1; + background: #0a1628; + border: 1px solid #374151; + color: white; + padding: 4px 8px; + border-radius: 4px; + font-size: 13px; +} +.link-confirm, .link-remove { + padding: 4px 10px; + border-radius: 4px; + border: none; + font-size: 12px; + cursor: pointer; +} +.link-confirm { background: #38bdac; color: white; } +.link-remove { background: #374151; color: #9ca3af; } + +.rich-editor-content { + min-height: 300px; + max-height: 500px; + overflow-y: auto; + padding: 12px 16px; + color: #e5e7eb; + font-size: 14px; + line-height: 1.7; +} + +.rich-editor-content:focus { outline: none; } + +.rich-editor-content h1 { font-size: 1.5em; font-weight: 700; margin: 0.8em 0 0.4em; color: white; } +.rich-editor-content h2 { font-size: 1.3em; font-weight: 600; margin: 0.7em 0 0.3em; color: white; } +.rich-editor-content h3 { font-size: 1.15em; font-weight: 600; margin: 0.6em 0 0.3em; color: white; } +.rich-editor-content p { margin: 0.4em 0; } +.rich-editor-content strong { color: white; } +.rich-editor-content code { background: #1f2937; padding: 2px 6px; border-radius: 3px; font-size: 0.9em; color: #38bdac; } +.rich-editor-content pre { background: #1f2937; padding: 12px; border-radius: 6px; overflow-x: auto; margin: 0.6em 0; } +.rich-editor-content blockquote { + border-left: 3px solid #38bdac; + padding-left: 12px; + margin: 0.6em 0; + color: #9ca3af; +} +.rich-editor-content ul, .rich-editor-content ol { padding-left: 1.5em; margin: 0.4em 0; } +.rich-editor-content li { margin: 0.2em 0; } +.rich-editor-content hr { border: none; border-top: 1px solid #374151; margin: 1em 0; } +.rich-editor-content img { max-width: 100%; border-radius: 6px; margin: 0.5em 0; } +.rich-editor-content a, .rich-link { color: #38bdac; text-decoration: underline; cursor: pointer; } + +.rich-editor-content table { + border-collapse: collapse; + width: 100%; + margin: 0.5em 0; +} +.rich-editor-content th, .rich-editor-content td { + border: 1px solid #374151; + padding: 6px 10px; + text-align: left; +} +.rich-editor-content th { background: #1f2937; font-weight: 600; } + +.rich-editor-content .ProseMirror-placeholder::before { + content: attr(data-placeholder); + color: #6b7280; + float: left; + height: 0; + pointer-events: none; +} + +.mention-tag { + background: rgba(56, 189, 172, 0.15); + color: #38bdac; + border-radius: 4px; + padding: 1px 4px; + font-weight: 500; +} + +.mention-popup { + position: fixed; + z-index: 9999; + background: #1a2638; + border: 1px solid #374151; + border-radius: 8px; + padding: 4px; + min-width: 180px; + max-height: 240px; + overflow-y: auto; + box-shadow: 0 4px 20px rgba(0,0,0,0.4); +} +.mention-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 6px 10px; + border-radius: 4px; + cursor: pointer; + color: #d1d5db; + font-size: 13px; +} +.mention-item:hover, .mention-item.is-selected { + background: rgba(56, 189, 172, 0.15); + color: #38bdac; +} +.mention-name { font-weight: 500; } +.mention-id { font-size: 11px; color: #6b7280; } + +.bubble-menu { + display: flex; + gap: 2px; + background: #1a2638; + border: 1px solid #374151; + border-radius: 6px; + padding: 4px; + box-shadow: 0 4px 12px rgba(0,0,0,0.3); +} +.bubble-menu button { + display: flex; + align-items: center; + justify-content: center; + width: 26px; + height: 26px; + border-radius: 4px; + border: none; + background: transparent; + color: #9ca3af; + cursor: pointer; +} +.bubble-menu button:hover { background: #1f2937; color: #d1d5db; } +.bubble-menu button.is-active { color: #38bdac; } diff --git a/soul-admin/src/components/RichEditor.tsx b/soul-admin/src/components/RichEditor.tsx new file mode 100644 index 00000000..58948690 --- /dev/null +++ b/soul-admin/src/components/RichEditor.tsx @@ -0,0 +1,335 @@ +import { useEditor, EditorContent } from '@tiptap/react' +import StarterKit from '@tiptap/starter-kit' +import Image from '@tiptap/extension-image' +import Link from '@tiptap/extension-link' +import Mention from '@tiptap/extension-mention' +import Placeholder from '@tiptap/extension-placeholder' +import { Table, TableRow, TableCell, TableHeader } from '@tiptap/extension-table' +import { useCallback, useEffect, useRef, useState, forwardRef, useImperativeHandle } from 'react' +import { + Bold, Italic, Strikethrough, Code, List, ListOrdered, Quote, + Heading1, Heading2, Heading3, Image as ImageIcon, Link as LinkIcon, + Table as TableIcon, Undo, Redo, Minus, +} from 'lucide-react' + +export interface PersonItem { + id: string + name: string + label?: string +} + +export interface LinkTagItem { + id: string + label: string + url: string + type: 'url' | 'miniprogram' | 'ckb' + appId?: string + pagePath?: string +} + +export interface RichEditorRef { + getHTML: () => string + getMarkdown: () => string +} + +interface RichEditorProps { + content: string + onChange: (html: string) => void + onImageUpload?: (file: File) => Promise + persons?: PersonItem[] + linkTags?: LinkTagItem[] + placeholder?: string + className?: string +} + +function htmlToMarkdown(html: string): string { + if (!html) return '' + let md = html + md = md.replace(/]*>(.*?)<\/h1>/gi, '# $1\n\n') + md = md.replace(/]*>(.*?)<\/h2>/gi, '## $1\n\n') + md = md.replace(/]*>(.*?)<\/h3>/gi, '### $1\n\n') + md = md.replace(/]*>(.*?)<\/strong>/gi, '**$1**') + md = md.replace(/]*>(.*?)<\/b>/gi, '**$1**') + md = md.replace(/]*>(.*?)<\/em>/gi, '*$1*') + md = md.replace(/]*>(.*?)<\/i>/gi, '*$1*') + md = md.replace(/]*>(.*?)<\/s>/gi, '~~$1~~') + md = md.replace(/]*>(.*?)<\/del>/gi, '~~$1~~') + md = md.replace(/]*>(.*?)<\/code>/gi, '`$1`') + md = md.replace(/]*>(.*?)<\/blockquote>/gi, '> $1\n\n') + md = md.replace(/]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi, '![$2]($1)') + md = md.replace(/]*src="([^"]*)"[^>]*>/gi, '![]($1)') + md = md.replace(/]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi, '[$2]($1)') + md = md.replace(/]*>(.*?)<\/li>/gi, '- $1\n') + md = md.replace(/<\/?[uo]l[^>]*>/gi, '\n') + md = md.replace(//gi, '\n') + md = md.replace(/]*>(.*?)<\/p>/gi, '$1\n\n') + md = md.replace(//gi, '---\n\n') + md = md.replace(/]*data-type="mention"[^>]*data-id="([^"]*)"[^>]*>@([^<]*)<\/span>/gi, '@$2') + md = md.replace(/]*data-type="linkTag"[^>]*data-url="([^"]*)"[^>]*>#([^<]*)<\/span>/gi, '#[$2]($1)') + md = md.replace(/<[^>]+>/g, '') + md = md.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'") + md = md.replace(/\n{3,}/g, '\n\n') + return md.trim() +} + +function markdownToHtml(md: string): string { + if (!md) return '' + if (md.startsWith('<') && md.includes('$1') + html = html.replace(/^## (.+)$/gm, '

    $1

    ') + html = html.replace(/^# (.+)$/gm, '

    $1

    ') + html = html.replace(/\*\*(.+?)\*\*/g, '$1') + html = html.replace(/\*(.+?)\*/g, '$1') + html = html.replace(/~~(.+?)~~/g, '$1') + html = html.replace(/`([^`]+)`/g, '$1') + html = html.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '$1') + html = html.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '$1') + html = html.replace(/^> (.+)$/gm, '

    $1

    ') + html = html.replace(/^---$/gm, '
    ') + html = html.replace(/^- (.+)$/gm, '
  • $1
  • ') + const lines = html.split('\n') + const result: string[] = [] + for (const line of lines) { + const trimmed = line.trim() + if (!trimmed) continue + if (/^<(?:h[1-6]|blockquote|hr|li|ul|ol|table|img)/.test(trimmed)) { + result.push(trimmed) + } else { + result.push(`

    ${trimmed}

    `) + } + } + return result.join('') +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const MentionSuggestion = (persons: PersonItem[]): any => ({ + items: ({ query }: { query: string }) => + persons.filter(p => p.name.toLowerCase().includes(query.toLowerCase()) || p.id.includes(query)).slice(0, 8), + render: () => { + let popup: HTMLDivElement | null = null + let selectedIndex = 0 + let items: PersonItem[] = [] + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let command: ((p: { id: string; label: string }) => void) | null = null + + const update = () => { + if (!popup) return + popup.innerHTML = items.map((item, i) => + `
    + @${item.name} + ${item.label || item.id} +
    ` + ).join('') + popup.querySelectorAll('.mention-item').forEach(el => { + el.addEventListener('click', () => { + const idx = parseInt(el.getAttribute('data-index') || '0') + if (command && items[idx]) command({ id: items[idx].id, label: items[idx].name }) + }) + }) + } + + return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onStart: (props: any) => { + popup = document.createElement('div') + popup.className = 'mention-popup' + document.body.appendChild(popup) + items = props.items + command = props.command + selectedIndex = 0 + update() + if (props.clientRect) { + const rect = props.clientRect() + if (rect) { + popup.style.top = `${rect.bottom + 4}px` + popup.style.left = `${rect.left}px` + } + } + }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onUpdate: (props: any) => { + items = props.items + command = props.command + selectedIndex = 0 + update() + if (props.clientRect && popup) { + const rect = props.clientRect() + if (rect) { + popup.style.top = `${rect.bottom + 4}px` + popup.style.left = `${rect.left}px` + } + } + }, + onKeyDown: (props: { event: KeyboardEvent }) => { + if (props.event.key === 'ArrowUp') { selectedIndex = Math.max(0, selectedIndex - 1); update(); return true } + if (props.event.key === 'ArrowDown') { selectedIndex = Math.min(items.length - 1, selectedIndex + 1); update(); return true } + if (props.event.key === 'Enter') { if (command && items[selectedIndex]) command({ id: items[selectedIndex].id, label: items[selectedIndex].name }); return true } + if (props.event.key === 'Escape') { popup?.remove(); popup = null; return true } + return false + }, + onExit: () => { popup?.remove(); popup = null }, + } + }, +}) + +const RichEditor = forwardRef(({ + content, + onChange, + onImageUpload, + persons = [], + linkTags = [], + placeholder = '开始编辑内容...', + className, +}, ref) => { + const fileInputRef = useRef(null) + const [linkUrl, setLinkUrl] = useState('') + const [showLinkInput, setShowLinkInput] = useState(false) + const initialContent = useRef(markdownToHtml(content)) + + const editor = useEditor({ + extensions: [ + StarterKit, + Image.configure({ inline: true, allowBase64: true }), + Link.configure({ openOnClick: false, HTMLAttributes: { class: 'rich-link' } }), + Mention.configure({ + HTMLAttributes: { class: 'mention-tag' }, + suggestion: MentionSuggestion(persons), + }), + Placeholder.configure({ placeholder }), + Table.configure({ resizable: true }), + TableRow, TableCell, TableHeader, + ], + content: initialContent.current, + onUpdate: ({ editor: ed }) => { + onChange(ed.getHTML()) + }, + editorProps: { + attributes: { class: 'rich-editor-content' }, + }, + }) + + useImperativeHandle(ref, () => ({ + getHTML: () => editor?.getHTML() || '', + getMarkdown: () => htmlToMarkdown(editor?.getHTML() || ''), + })) + + useEffect(() => { + if (editor && content !== editor.getHTML()) { + const html = markdownToHtml(content) + if (html !== editor.getHTML()) { + editor.commands.setContent(html) + } + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [content]) + + const handleImageUpload = useCallback(async (e: React.ChangeEvent) => { + const file = e.target.files?.[0] + if (!file || !editor) return + if (onImageUpload) { + const url = await onImageUpload(file) + if (url) editor.chain().focus().setImage({ src: url }).run() + } else { + const reader = new FileReader() + reader.onload = () => { + if (typeof reader.result === 'string') editor.chain().focus().setImage({ src: reader.result }).run() + } + reader.readAsDataURL(file) + } + e.target.value = '' + }, [editor, onImageUpload]) + + const insertLinkTag = useCallback((tag: LinkTagItem) => { + if (!editor) return + editor.chain().focus().insertContent({ + type: 'text', + marks: [{ type: 'link', attrs: { href: tag.url, target: '_blank' } }], + text: `#${tag.label}`, + }).run() + }, [editor]) + + const addLink = useCallback(() => { + if (!editor || !linkUrl) return + editor.chain().focus().setLink({ href: linkUrl }).run() + setLinkUrl('') + setShowLinkInput(false) + }, [editor, linkUrl]) + + if (!editor) return null + + return ( +
    +
    +
    + + + + +
    +
    +
    + + + +
    +
    +
    + + + + +
    +
    +
    + + + + +
    +
    +
    + + +
    + {linkTags.length > 0 && ( + <> +
    +
    + +
    + + )} +
    + {showLinkInput && ( +
    + setLinkUrl(e.target.value)} + onKeyDown={e => e.key === 'Enter' && addLink()} + className="link-input" + /> + + +
    + )} + +
    + ) +}) + +RichEditor.displayName = 'RichEditor' +export default RichEditor diff --git a/soul-admin/src/components/modules/user/UserDetailModal.tsx b/soul-admin/src/components/modules/user/UserDetailModal.tsx index 35eb5d57..a1670ebe 100644 --- a/soul-admin/src/components/modules/user/UserDetailModal.tsx +++ b/soul-admin/src/components/modules/user/UserDetailModal.tsx @@ -10,6 +10,7 @@ import { Badge } from '@/components/ui/badge' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' +import { Switch } from '@/components/ui/switch' import { User, Phone, @@ -28,6 +29,7 @@ import { Search, CheckCircle2, Crown, + Key, Navigation, Smartphone, } from 'lucide-react' @@ -110,6 +112,16 @@ export function UserDetailModal({ const [editTags, setEditTags] = useState([]) const [newTag, setNewTag] = useState('') + // 修改密码 + const [newPassword, setNewPassword] = useState('') + const [confirmPassword, setConfirmPassword] = useState('') + const [passwordSaving, setPasswordSaving] = useState(false) + + // 设成超级个体(VIP) + const [vipForm, setVipForm] = useState({ isVip: false, vipExpireDate: '', vipRole: '', vipName: '', vipProject: '', vipContact: '', vipBio: '' }) + const [vipRoles, setVipRoles] = useState<{ id: number; name: string }[]>([]) + const [vipSaving, setVipSaving] = useState(false) + // 用户资料完善(神射手) const [sssLoading, setSssLoading] = useState(false) const [sssData, setSssData] = useState(null) @@ -128,7 +140,12 @@ export function UserDetailModal({ setSssError(null) setBatchIngestResult(null) setCkbWechatOwner('') + setNewPassword('') + setConfirmPassword('') loadUserDetail() + get<{ success?: boolean; data?: { id: number; name: string }[] }>('/api/db/vip-roles').then((r) => { + if (r?.success && (r as { data?: { id: number; name: string }[] }).data) setVipRoles((r as { data: { id: number; name: string }[] }).data) + }).catch(() => {}) } }, [open, userId]) @@ -152,6 +169,15 @@ export function UserDetailModal({ } catch { setEditTags([]) } + setVipForm({ + isVip: !!(u.isVip ?? false), + vipExpireDate: u.vipExpireDate ? String(u.vipExpireDate).slice(0, 10) : '', + vipRole: String(u.vipRole ?? ''), + vipName: String(u.vipName ?? ''), + vipProject: String(u.vipProject ?? ''), + vipContact: String(u.vipContact ?? ''), + vipBio: String(u.vipBio ?? ''), + }) } // 行为轨迹(用户旅程) try { @@ -228,6 +254,40 @@ export function UserDetailModal({ const removeTag = (tag: string) => setEditTags(editTags.filter((t) => t !== tag)) + async function handleSavePassword() { + if (!user) return + if (!newPassword) { alert('请输入新密码'); return } + if (newPassword !== confirmPassword) { alert('两次密码不一致'); return } + if (newPassword.length < 6) { alert('密码至少 6 位'); return } + setPasswordSaving(true) + try { + const data = await put<{ success?: boolean; error?: string }>('/api/db/users', { id: user.id, password: newPassword }) + if (data?.success) { alert('修改成功'); setNewPassword(''); setConfirmPassword('') } + else alert('修改失败: ' + (data?.error || '')) + } catch { alert('修改失败') } finally { setPasswordSaving(false) } + } + + async function handleSaveVip() { + if (!user) return + if (vipForm.isVip && !vipForm.vipExpireDate.trim()) { alert('开启 VIP 请填写有效到期日'); return } + setVipSaving(true) + try { + const payload = { + id: user.id, + isVip: vipForm.isVip, + vipExpireDate: vipForm.isVip ? vipForm.vipExpireDate : undefined, + vipRole: vipForm.vipRole || undefined, + vipName: vipForm.vipName || undefined, + vipProject: vipForm.vipProject || undefined, + vipContact: vipForm.vipContact || undefined, + vipBio: vipForm.vipBio || undefined, + } + const data = await put<{ success?: boolean; error?: string }>('/api/db/users', payload) + if (data?.success) { alert('VIP 设置已保存'); loadUserDetail(); onUserUpdated?.() } + else alert('保存失败: ' + (data?.error || '')) + } catch { alert('保存失败') } finally { setVipSaving(false) } + } + // 用户资料完善查询(支持多维度) async function handleSSSQuery() { if (!sssQueryPhone && !sssQueryOpenId && !sssQueryWechatId) { @@ -469,7 +529,98 @@ export function UserDetailModal({

    - {/* VIP 信息 */} + + {/* 快捷操作:修改密码 & 设成超级个体 */} +
    +
    +
    + + 修改密码 +
    +
    + setNewPassword(e.target.value)} + /> + setConfirmPassword(e.target.value)} + /> + +
    +
    +
    +
    + + 设成超级个体 +
    +
    +
    + + setVipForm((f) => ({ ...f, isVip: c }))} + /> +
    + {vipForm.isVip && ( +
    + + setVipForm((f) => ({ ...f, vipExpireDate: e.target.value }))} + /> +
    + )} +
    + + +
    +
    + + setVipForm((f) => ({ ...f, vipName: e.target.value }))} + /> +
    + +
    +
    +
    + + {/* VIP 信息(只读展示) */} {user.isVip && (
    diff --git a/soul-admin/src/pages/content/ContentPage.tsx b/soul-admin/src/pages/content/ContentPage.tsx index 74b1be74..f6253b48 100644 --- a/soul-admin/src/pages/content/ContentPage.tsx +++ b/soul-admin/src/pages/content/ContentPage.tsx @@ -10,6 +10,8 @@ import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' import { Textarea } from '@/components/ui/textarea' +import RichEditor, { type PersonItem, type LinkTagItem, type RichEditorRef } from '@/components/RichEditor' +import '@/components/RichEditor.css' import { Select, SelectContent, @@ -34,13 +36,14 @@ import { RefreshCw, Link2, Plus, - Image as ImageIcon, Search, Trophy, ChevronLeft, ChevronRight as ChevronRightIcon, Pin, Star, + Hash, + ExternalLink, } from 'lucide-react' import { get, put, post, del } from '@/api/client' import { ChapterTree } from './ChapterTree' @@ -101,6 +104,7 @@ interface SectionOrder { interface EditingSection { id: string + originalId?: string title: string price: number content?: string @@ -183,8 +187,6 @@ export function ContentPage() { const [searchQuery, setSearchQuery] = useState('') const [searchResults, setSearchResults] = useState<{ id: string; title: string; price?: number; snippet?: string; partTitle?: string; chapterTitle?: string; matchType?: string }[]>([]) const [isSearching, setIsSearching] = useState(false) - const [uploadingImage, setUploadingImage] = useState(false) - const imageInputRef = useRef(null) const [newSection, setNewSection] = useState({ id: '', @@ -219,6 +221,11 @@ export function ContentPage() { const [previewPercent, setPreviewPercent] = useState(20) const [previewPercentLoading, setPreviewPercentLoading] = useState(false) const [previewPercentSaving, setPreviewPercentSaving] = useState(false) + const [persons, setPersons] = useState([]) + const [linkTags, setLinkTags] = useState([]) + const [newPerson, setNewPerson] = useState({ personId: '', name: '', label: '' }) + const [newLinkTag, setNewLinkTag] = useState({ tagId: '', label: '', url: '', type: 'url' as 'url' | 'miniprogram' | 'ckb', appId: '', pagePath: '' }) + const richEditorRef = useRef(null) const tree = buildTree(sectionsList) const totalSections = sectionsList.length @@ -366,6 +373,20 @@ export function ContentPage() { } catch { /* keep default */ } finally { setPinnedLoading(false) } }, []) + const loadPersons = useCallback(async () => { + try { + const data = await get<{ success?: boolean; persons?: { personId: string; name: string; label?: string }[] }>('/api/db/persons') + if (data?.success && data.persons) setPersons(data.persons.map(p => ({ id: p.personId, name: p.name, label: p.label }))) + } catch { /* ignore */ } + }, []) + + const loadLinkTags = useCallback(async () => { + try { + const data = await get<{ success?: boolean; linkTags?: { tagId: string; label: string; url: string; type: string; appId?: string; pagePath?: string }[] }>('/api/db/link-tags') + if (data?.success && data.linkTags) setLinkTags(data.linkTags.map(t => ({ id: t.tagId, label: t.label, url: t.url, type: t.type as 'url' | 'miniprogram', appId: t.appId, pagePath: t.pagePath }))) + } catch { /* ignore */ } + }, []) + const handleTogglePin = async (sectionId: string) => { const next = pinnedSectionIds.includes(sectionId) ? pinnedSectionIds.filter((id) => id !== sectionId) @@ -406,7 +427,7 @@ export function ContentPage() { } catch { alert('保存失败') } finally { setPreviewPercentSaving(false) } } - useEffect(() => { loadPinnedSections(); loadPreviewPercent() }, [loadPinnedSections, loadPreviewPercent]) + useEffect(() => { loadPinnedSections(); loadPreviewPercent(); loadPersons(); loadLinkTags() }, [loadPinnedSections, loadPreviewPercent, loadPersons, loadLinkTags]) const handleShowSectionOrders = async (section: Section & { filePath?: string }) => { setSectionOrdersModal({ section, orders: [] }) @@ -435,6 +456,7 @@ export function ContentPage() { const sec = data.section as { isNew?: boolean } setEditingSection({ id: section.id, + originalId: section.id, title: data.section.title ?? section.title, price: data.section.price ?? section.price, content: data.section.content ?? '', @@ -447,6 +469,7 @@ export function ContentPage() { } else { setEditingSection({ id: section.id, + originalId: section.id, title: section.title, price: section.price, content: '', @@ -488,8 +511,11 @@ export function ContentPage() { for (const pattern of titlePatterns) content = content.replace(pattern, '') content = content.replace(/^\s*\n+/, '').trim() + const originalId = editingSection.originalId || editingSection.id + const idChanged = editingSection.id !== originalId const res = await put<{ success?: boolean; error?: string }>('/api/db/book', { - id: editingSection.id, + id: originalId, + ...(idChanged ? { newId: editingSection.id } : {}), title: editingSection.title, price: editingSection.isFree ? 0 : editingSection.price, content, @@ -498,8 +524,9 @@ export function ContentPage() { hotScore: editingSection.hotScore, saveToFile: true, }) - if (editingSection.isPinned !== pinnedSectionIds.includes(editingSection.id)) { - await handleTogglePin(editingSection.id) + const effectiveId = idChanged ? editingSection.id : originalId + if (editingSection.isPinned !== pinnedSectionIds.includes(effectiveId)) { + await handleTogglePin(effectiveId) } if (res && (res as { success?: boolean }).success !== false) { alert(`已保存章节: ${editingSection.title}`) @@ -809,37 +836,6 @@ export function ContentPage() { } } - const handleImageUpload = async (e: React.ChangeEvent) => { - const file = e.target.files?.[0] - if (!file) return - setUploadingImage(true) - try { - const formData = new FormData() - formData.append('file', file) - formData.append('folder', 'book-images') - const res = await fetch(apiUrl('/api/upload'), { method: 'POST', body: formData, credentials: 'include' }) - const data = await res.json() - if (data?.success && data?.data?.url) { - const imageMarkdown = `![${file.name}](${data.data.url})` - if (editingSection) { - setEditingSection({ - ...editingSection, - content: (editingSection.content || '') + '\n\n' + imageMarkdown, - }) - } - alert(`图片上传成功: ${data.data.url}`) - } else { - alert('上传失败: ' + (data?.error || '未知错误')) - } - } catch (err) { - console.error(err) - alert('上传失败') - } finally { - setUploadingImage(false) - if (imageInputRef.current) imageInputRef.current.value = '' - } - } - const handleSearch = async () => { if (!searchQuery.trim()) return setIsSearching(true) @@ -1229,8 +1225,27 @@ export function ContentPage() { {sectionOrdersModal.orders.map((o) => ( - {o.orderSn ?? '-'} - {o.userId ?? o.openId ?? '-'} + + + + + + ¥{o.amount ?? 0} {o.status ?? '-'} {o.payTime ?? o.createdAt ?? '-'} @@ -1496,45 +1511,44 @@ export function ContentPage() {
    )}
    -
    - -
    - - -
    -
    + {isLoadingContent ? (
    加载中...
    ) : ( -