@gulibs/vgrove-ui
Version:
VGrove UI component library built with HeroUI and React
1 lines • 239 kB
JavaScript
"use strict";var Do=Object.defineProperty;var Uo=(e,t,r)=>t in e?Do(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var he=(e,t,r)=>Uo(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("clsx"),l=require("react/jsx-runtime"),ye=require("@iconify/react"),St=require("lodash"),se=require("@heroui/react"),f=require("react"),ge=require("react-router"),zo=require("react-markdown"),un=require("react-helmet-async"),Ur=require("styled-components"),Bo=require("@ant-design/icons"),$o=require("react-dom"),Pt=require("lucide-react");function Go(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Os=Go(f),zr="-",Wo=e=>{const t=Ho(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{const a=o.split(zr);return a[0]===""&&a.length!==1&&a.shift(),dn(a,t)||qo(o)},getConflictingClassGroupIds:(o,a)=>{const c=r[o]||[];return a&&s[o]?[...c,...s[o]]:c}}},dn=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],s=t.nextPart.get(r),n=s?dn(e.slice(1),s):void 0;if(n)return n;if(t.validators.length===0)return;const i=e.join(zr);return t.validators.find(({validator:o})=>o(i))?.classGroupId},Ds=/^\[(.+)\]$/,qo=e=>{if(Ds.test(e)){const t=Ds.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},Ho=e=>{const{theme:t,classGroups:r}=e,s={nextPart:new Map,validators:[]};for(const n in r)Mr(r[n],s,n,t);return s},Mr=(e,t,r,s)=>{e.forEach(n=>{if(typeof n=="string"){const i=n===""?t:Us(t,n);i.classGroupId=r;return}if(typeof n=="function"){if(Ko(n)){Mr(n(s),t,r,s);return}t.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([i,o])=>{Mr(o,Us(t,i),r,s)})})},Us=(e,t)=>{let r=e;return t.split(zr).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},Ko=e=>e.isThemeGetter,Zo=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,s=new Map;const n=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,s=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=s.get(i))!==void 0)return n(i,o),o},set(i,o){r.has(i)?r.set(i,o):n(i,o)}}},Er="!",Ar=":",Yo=Ar.length,Xo=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=n=>{const i=[];let o=0,a=0,c=0,w;for(let p=0;p<n.length;p++){let m=n[p];if(o===0&&a===0){if(m===Ar){i.push(n.slice(c,p)),c=p+Yo;continue}if(m==="/"){w=p;continue}}m==="["?o++:m==="]"?o--:m==="("?a++:m===")"&&a--}const h=i.length===0?n:n.substring(c),x=Jo(h),u=x!==h,y=w&&w>c?w-c:void 0;return{modifiers:i,hasImportantModifier:u,baseClassName:x,maybePostfixModifierPosition:y}};if(t){const n=t+Ar,i=s;s=o=>o.startsWith(n)?i(o.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const n=s;s=i=>r({className:i,parseClassName:n})}return s},Jo=e=>e.endsWith(Er)?e.substring(0,e.length-1):e.startsWith(Er)?e.substring(1):e,Qo=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const n=[];let i=[];return s.forEach(o=>{o[0]==="["||t[o]?(n.push(...i.sort(),o),i=[]):i.push(o)}),n.push(...i.sort()),n}},ea=e=>({cache:Zo(e.cacheSize),parseClassName:Xo(e),sortModifiers:Qo(e),...Wo(e)}),ta=/\s+/,ra=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:n,sortModifiers:i}=t,o=[],a=e.trim().split(ta);let c="";for(let w=a.length-1;w>=0;w-=1){const h=a[w],{isExternal:x,modifiers:u,hasImportantModifier:y,baseClassName:p,maybePostfixModifierPosition:m}=r(h);if(x){c=h+(c.length>0?" "+c:c);continue}let b=!!m,P=s(b?p.substring(0,m):p);if(!P){if(!b){c=h+(c.length>0?" "+c:c);continue}if(P=s(p),!P){c=h+(c.length>0?" "+c:c);continue}b=!1}const I=i(u).join(":"),M=y?I+Er:I,j=M+P;if(o.includes(j))continue;o.push(j);const F=n(P,b);for(let $=0;$<F.length;++$){const E=F[$];o.push(M+E)}c=h+(c.length>0?" "+c:c)}return c};function sa(){let e=0,t,r,s="";for(;e<arguments.length;)(t=arguments[e++])&&(r=fn(t))&&(s&&(s+=" "),s+=r);return s}const fn=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=fn(e[s]))&&(r&&(r+=" "),r+=t);return r};function na(e,...t){let r,s,n,i=o;function o(c){const w=t.reduce((h,x)=>x(h),e());return r=ea(w),s=r.cache.get,n=r.cache.set,i=a,a(c)}function a(c){const w=s(c);if(w)return w;const h=ra(c,r);return n(c,h),h}return function(){return i(sa.apply(null,arguments))}}const Ae=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},hn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,mn=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ia=/^\d+\/\d+$/,oa=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aa=/\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$/,la=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ca=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ua=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kt=e=>ia.test(e),ue=e=>!!e&&!Number.isNaN(Number(e)),lt=e=>!!e&&Number.isInteger(Number(e)),Cr=e=>e.endsWith("%")&&ue(e.slice(0,-1)),rt=e=>oa.test(e),da=()=>!0,fa=e=>aa.test(e)&&!la.test(e),gn=()=>!1,ha=e=>ca.test(e),ma=e=>ua.test(e),ga=e=>!J(e)&&!Q(e),pa=e=>At(e,wn,gn),J=e=>hn.test(e),ht=e=>At(e,vn,fa),kr=e=>At(e,xa,ue),zs=e=>At(e,pn,gn),ba=e=>At(e,bn,ma),rr=e=>At(e,yn,ha),Q=e=>mn.test(e),Ft=e=>Rt(e,vn),wa=e=>Rt(e,Ca),Bs=e=>Rt(e,pn),va=e=>Rt(e,wn),ya=e=>Rt(e,bn),sr=e=>Rt(e,yn,!0),At=(e,t,r)=>{const s=hn.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},Rt=(e,t,r=!1)=>{const s=mn.exec(e);return s?s[1]?t(s[1]):r:!1},pn=e=>e==="position"||e==="percentage",bn=e=>e==="image"||e==="url",wn=e=>e==="length"||e==="size"||e==="bg-size",vn=e=>e==="length",xa=e=>e==="number",Ca=e=>e==="family-name",yn=e=>e==="shadow",ka=()=>{const e=Ae("color"),t=Ae("font"),r=Ae("text"),s=Ae("font-weight"),n=Ae("tracking"),i=Ae("leading"),o=Ae("breakpoint"),a=Ae("container"),c=Ae("spacing"),w=Ae("radius"),h=Ae("shadow"),x=Ae("inset-shadow"),u=Ae("text-shadow"),y=Ae("drop-shadow"),p=Ae("blur"),m=Ae("perspective"),b=Ae("aspect"),P=Ae("ease"),I=Ae("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],F=()=>[...j(),Q,J],$=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],A=()=>[Q,J,c],V=()=>[kt,"full","auto",...A()],O=()=>[lt,"none","subgrid",Q,J],H=()=>["auto",{span:["full",lt,Q,J]},lt,Q,J],L=()=>[lt,"auto",Q,J],K=()=>["auto","min","max","fr",Q,J],oe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],de=()=>["start","end","center","stretch","center-safe","end-safe"],ie=()=>["auto",...A()],te=()=>[kt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],U=()=>[e,Q,J],ae=()=>[...j(),Bs,zs,{position:[Q,J]}],ce=()=>["no-repeat",{repeat:["","x","y","space","round"]}],be=()=>["auto","cover","contain",va,pa,{size:[Q,J]}],re=()=>[Cr,Ft,ht],ee=()=>["","none","full",w,Q,J],we=()=>["",ue,Ft,ht],q=()=>["solid","dashed","dotted","double"],Le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],pe=()=>[ue,Cr,Bs,zs],Ge=()=>["","none",p,Q,J],Fe=()=>["none",ue,Q,J],Ve=()=>["none",ue,Q,J],We=()=>[ue,Q,J],Ce=()=>[kt,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[rt],breakpoint:[rt],color:[da],container:[rt],"drop-shadow":[rt],ease:["in","out","in-out"],font:[ga],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[rt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[rt],shadow:[rt],spacing:["px",ue],text:[rt],"text-shadow":[rt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",kt,J,Q,b]}],container:["container"],columns:[{columns:[ue,J,Q,a]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"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:F()}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[lt,"auto",Q,J]}],basis:[{basis:[kt,"full","auto",a,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ue,kt,"auto","initial","none",J]}],grow:[{grow:["",ue,Q,J]}],shrink:[{shrink:["",ue,Q,J]}],order:[{order:[lt,"first","last","none",Q,J]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...oe(),"normal"]}],"justify-items":[{"justify-items":[...de(),"normal"]}],"justify-self":[{"justify-self":["auto",...de()]}],"align-content":[{content:["normal",...oe()]}],"align-items":[{items:[...de(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...de(),{baseline:["","last"]}]}],"place-content":[{"place-content":oe()}],"place-items":[{"place-items":[...de(),"baseline"]}],"place-self":[{"place-self":["auto",...de()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:ie()}],mx:[{mx:ie()}],my:[{my:ie()}],ms:[{ms:ie()}],me:[{me:ie()}],mt:[{mt:ie()}],mr:[{mr:ie()}],mb:[{mb:ie()}],ml:[{ml:ie()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:te()}],w:[{w:[a,"screen",...te()]}],"min-w":[{"min-w":[a,"screen","none",...te()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...te()]}],h:[{h:["screen","lh",...te()]}],"min-h":[{"min-h":["screen","lh","none",...te()]}],"max-h":[{"max-h":["screen","lh",...te()]}],"font-size":[{text:["base",r,Ft,ht]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,Q,kr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Cr,J]}],"font-family":[{font:[wa,J,t]}],"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:[n,Q,J]}],"line-clamp":[{"line-clamp":[ue,"none",Q,kr]}],leading:[{leading:[i,...A()]}],"list-image":[{"list-image":["none",Q,J]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,J]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[ue,"from-font","auto",Q,ht]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[ue,"auto",Q,J]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q,J]}],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",Q,J]}],"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:ce()}],"bg-size":[{bg:be()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},lt,Q,J],radial:["",Q,J],conic:[lt,Q,J]},ya,ba]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:we()}],"border-w-x":[{"border-x":we()}],"border-w-y":[{"border-y":we()}],"border-w-s":[{"border-s":we()}],"border-w-e":[{"border-e":we()}],"border-w-t":[{"border-t":we()}],"border-w-r":[{"border-r":we()}],"border-w-b":[{"border-b":we()}],"border-w-l":[{"border-l":we()}],"divide-x":[{"divide-x":we()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":we()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ue,Q,J]}],"outline-w":[{outline:["",ue,Ft,ht]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",h,sr,rr]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",x,sr,rr]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:we()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[ue,ht]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":we()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",u,sr,rr]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[ue,Q,J]}],"mix-blend":[{"mix-blend":[...Le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Le()}],"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":[ue]}],"mask-image-linear-from-pos":[{"mask-linear-from":pe()}],"mask-image-linear-to-pos":[{"mask-linear-to":pe()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":pe()}],"mask-image-t-to-pos":[{"mask-t-to":pe()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":pe()}],"mask-image-r-to-pos":[{"mask-r-to":pe()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":pe()}],"mask-image-b-to-pos":[{"mask-b-to":pe()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":pe()}],"mask-image-l-to-pos":[{"mask-l-to":pe()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":pe()}],"mask-image-x-to-pos":[{"mask-x-to":pe()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":pe()}],"mask-image-y-to-pos":[{"mask-y-to":pe()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Q,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":pe()}],"mask-image-radial-to-pos":[{"mask-radial-to":pe()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"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":j()}],"mask-image-conic-pos":[{"mask-conic":[ue]}],"mask-image-conic-from-pos":[{"mask-conic-from":pe()}],"mask-image-conic-to-pos":[{"mask-conic-to":pe()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ae()}],"mask-repeat":[{mask:ce()}],"mask-size":[{mask:be()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,J]}],filter:[{filter:["","none",Q,J]}],blur:[{blur:Ge()}],brightness:[{brightness:[ue,Q,J]}],contrast:[{contrast:[ue,Q,J]}],"drop-shadow":[{"drop-shadow":["","none",y,sr,rr]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",ue,Q,J]}],"hue-rotate":[{"hue-rotate":[ue,Q,J]}],invert:[{invert:["",ue,Q,J]}],saturate:[{saturate:[ue,Q,J]}],sepia:[{sepia:["",ue,Q,J]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,J]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[ue,Q,J]}],"backdrop-contrast":[{"backdrop-contrast":[ue,Q,J]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ue,Q,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ue,Q,J]}],"backdrop-invert":[{"backdrop-invert":["",ue,Q,J]}],"backdrop-opacity":[{"backdrop-opacity":[ue,Q,J]}],"backdrop-saturate":[{"backdrop-saturate":[ue,Q,J]}],"backdrop-sepia":[{"backdrop-sepia":["",ue,Q,J]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Q,J]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ue,"initial",Q,J]}],ease:[{ease:["linear","initial",P,Q,J]}],delay:[{delay:[ue,Q,J]}],animate:[{animate:["none",I,Q,J]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,Q,J]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:Fe()}],"rotate-x":[{"rotate-x":Fe()}],"rotate-y":[{"rotate-y":Fe()}],"rotate-z":[{"rotate-z":Fe()}],scale:[{scale:Ve()}],"scale-x":[{"scale-x":Ve()}],"scale-y":[{"scale-y":Ve()}],"scale-z":[{"scale-z":Ve()}],"scale-3d":["scale-3d"],skew:[{skew:We()}],"skew-x":[{"skew-x":We()}],"skew-y":[{"skew-y":We()}],transform:[{transform:[Q,J,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ce()}],"translate-x":[{"translate-x":Ce()}],"translate-y":[{"translate-y":Ce()}],"translate-z":[{"translate-z":Ce()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"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",Q,J]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",Q,J]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[ue,Ft,ht,kr]}],stroke:[{stroke:["none",...U()]}],"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"]}},Ia=na(ka);function Sa(...e){return Ia(Y.clsx(e))}const xn=({logo:e,name:t,className:r,classNames:s,isCollapsed:n,onClick:i})=>{const o=()=>!t||n?null:l.jsx("div",{className:Y("flex items-center flex-1 min-w-0",s?.nameWrapper),children:l.jsx("span",{className:Y("text-small font-bold uppercase opacity-100",s?.name),children:t})}),a=()=>e?typeof e=="string"?l.jsx("img",{src:e,alt:"VGrove",className:Y(s?.logo)}):e:l.jsx(ye.Icon,{icon:"solar:code-square-line-duotone",className:"text-primary-foreground",width:24});return l.jsxs("div",{className:Y("flex","gap-2","items-center",{"py-2":n,"mb-2":!n,"px-3":!n,"cursor-pointer":!St.isUndefined(i)},s?.base,r),onClick:i,children:[a(),o()]})},Cn=({icon:e,collapse:t,onCollapsedChange:r,...s})=>{const[n,i]=f.useState(t||!1),o=()=>{i(!n)};return f.useEffect(()=>{r?.(n)},[n,r]),l.jsx(se.Button,{className:"bg-default-[0]",size:"sm",radius:"sm",variant:"flat",isIconOnly:!0,"aria-label":"Sidebar Collapse Button",startContent:e||l.jsx(ye.Icon,{width:24,icon:`${n?"solar:round-alt-arrow-right-line-duotone":"solar:round-alt-arrow-left-line-duotone"}`}),onPress:o,...s})},ct=class ct{constructor(t={}){he(this,"config");this.config={enabled:t.enabled??!1,auth:t.auth??!1,i18n:t.i18n??!1,performance:t.performance??!1,routing:t.routing??!1,storage:t.storage??!1,loader:t.loader??!1,action:t.action??!1,middleware:t.middleware??!1}}static getInstance(t){return ct.instance||(ct.instance=new ct(t)),ct.instance}static updateConfig(t){const r=ct.getInstance();r.config={...r.config,...t}}shouldLog(t){return this.config.enabled&&this.config[t]}auth(t,r){process.env.NODE_ENV==="development"&&this.shouldLog("auth")&&console.log(`🔐 Auth: ${t}`,r||"")}i18n(t,r){process.env.NODE_ENV==="development"&&this.shouldLog("i18n")&&console.log(`🌍 I18n: ${t}`,r||"")}performance(t,r){process.env.NODE_ENV==="development"&&this.shouldLog("performance")&&console.log(`⚡ Performance: ${t}`,r||"")}routing(t,r){process.env.NODE_ENV==="development"&&this.shouldLog("routing")&&console.log(`🚀 Routing: ${t}`,r||"")}storage(t,r){process.env.NODE_ENV==="development"&&this.shouldLog("storage")&&console.log(`💾 Storage: ${t}`,r||"")}error(t,r){process.env.NODE_ENV==="development"&&this.config.enabled&&console.error(`❌ Error: ${t}`,r||"")}warn(t,r){process.env.NODE_ENV==="development"&&this.config.enabled&&console.warn(`⚠️ Warning: ${t}`,r||"")}success(t,r){process.env.NODE_ENV==="development"&&this.config.enabled&&console.log(`✅ Success: ${t}`,r||"")}log(t,r){process.env.NODE_ENV==="development"&&this.config.enabled&&console.log(`📝 Log: ${t}`,r||"")}info(t,r){process.env.NODE_ENV==="development"&&this.config.enabled&&console.info(`ℹ️ Info: ${t}`,r||"")}loader(t,r){process.env.NODE_ENV==="development"&&this.shouldLog("loader")&&console.log(`🔄 Loader: ${t}`,r||"")}action(t,r){process.env.NODE_ENV==="development"&&this.shouldLog("action")&&console.log(`⚡ Action: ${t}`,r||"")}middleware(t,r){process.env.NODE_ENV==="development"&&this.shouldLog("middleware")&&console.log(`🔧 Middleware: ${t}`,r||"")}getConfig(){return{...this.config}}};he(ct,"instance");let Qe=ct;const C=Qe.getInstance(),kn=Qe.updateConfig,Pa={authCheck:()=>null,roleCheck:(e,t)=>e.roles?t.some(r=>e.roles.includes(r)):!1,permissionCheck:(e,t)=>e.permissions?t.some(r=>e.permissions.includes(r)):!1,loginPath:"/login",forbiddenPath:"/403",publicPaths:["/login","/register","/forgot-password","/404","/403"]};let Rr={};function In(e){Rr={...Rr,...e},C.auth("Loader 全局配置已更新",e)}function Kt(e){return{...Pa,...Rr,...e}}function Zt(e,t){return t.some(r=>r.endsWith("*")?e.startsWith(r.slice(0,-1)):e===r)}function Br(e){return async({request:t})=>{const r=Kt(e),s=new URL(t.url);if(C.auth("执行认证检查",{pathname:s.pathname}),Zt(s.pathname,r.publicPaths))return C.auth("公共路径,跳过认证检查",{pathname:s.pathname}),null;const n=await r.authCheck();if(!n){C.auth("用户未认证,重定向到登录页",{pathname:s.pathname,loginPath:r.loginPath});const i=new URL(r.loginPath,s.origin);throw i.searchParams.set("redirect",s.pathname+s.search),ge.redirect(i.toString())}return C.auth("认证检查通过",{userId:n.id}),{user:n}}}function Sn(e,t){return async({request:r})=>{const s=Kt(t),n=new URL(r.url);if(C.auth("执行角色检查",{pathname:n.pathname,requiredRoles:e}),Zt(n.pathname,s.publicPaths))return C.auth("公共路径,跳过角色检查",{pathname:n.pathname}),null;const i=await s.authCheck();if(!i){C.auth("用户未认证,重定向到登录页");const a=new URL(s.loginPath,n.origin);throw a.searchParams.set("redirect",n.pathname+n.search),ge.redirect(a.toString())}if(!s.roleCheck(i,e))throw C.auth("角色检查失败,重定向到禁止访问页",{userId:i.id,userRoles:i.roles,requiredRoles:e}),ge.redirect(s.forbiddenPath);return C.auth("角色检查通过",{userId:i.id,userRoles:i.roles,requiredRoles:e}),{user:i}}}function Pn(e,t){return async({request:r})=>{const s=Kt(t),n=new URL(r.url);if(C.auth("执行权限检查",{pathname:n.pathname,requiredPermissions:e}),Zt(n.pathname,s.publicPaths))return C.auth("公共路径,跳过权限检查",{pathname:n.pathname}),null;const i=await s.authCheck();if(!i){C.auth("用户未认证,重定向到登录页");const a=new URL(s.loginPath,n.origin);throw a.searchParams.set("redirect",n.pathname+n.search),ge.redirect(a.toString())}if(!s.permissionCheck(i,e))throw C.auth("权限检查失败,重定向到禁止访问页",{userId:i.id,userPermissions:i.permissions,requiredPermissions:e}),ge.redirect(s.forbiddenPath);return C.auth("权限检查通过",{userId:i.id,userPermissions:i.permissions,requiredPermissions:e}),{user:i}}}function Mn(e,t){return async({request:r})=>{const s=Kt(t),n=new URL(r.url),{roles:i=[],permissions:o=[],requireAll:a=!1}=e;if(C.auth("执行组合检查",{pathname:n.pathname,roles:i,permissions:o,requireAll:a}),Zt(n.pathname,s.publicPaths))return C.auth("公共路径,跳过组合检查",{pathname:n.pathname}),null;const c=await s.authCheck();if(!c){C.auth("用户未认证,重定向到登录页");const u=new URL(s.loginPath,n.origin);throw u.searchParams.set("redirect",n.pathname+n.search),ge.redirect(u.toString())}const w=i.length===0||s.roleCheck(c,i),h=o.length===0||s.permissionCheck(c,o);let x;if(a?x=w&&h:x=w||h,!x)throw C.auth("组合检查失败,重定向到禁止访问页",{userId:c.id,hasRole:w,hasPermission:h,requireAll:a}),ge.redirect(s.forbiddenPath);return C.auth("组合检查通过",{userId:c.id,hasRole:w,hasPermission:h}),{user:c}}}function Ma(e,t){return async({request:r})=>{const s=Kt(t),n=new URL(r.url);if(C.auth("执行自定义检查",{pathname:n.pathname}),Zt(n.pathname,s.publicPaths))return C.auth("公共路径,跳过自定义检查",{pathname:n.pathname}),null;const i=await s.authCheck();if(!await e(i,r)){if(C.auth("自定义检查失败"),i)throw ge.redirect(s.forbiddenPath);{const a=new URL(s.loginPath,n.origin);throw a.searchParams.set("redirect",n.pathname+n.search),ge.redirect(a.toString())}}return C.auth("自定义检查通过",{userId:i?.id}),{user:i}}}function Ea(...e){return async t=>{C.auth("执行组合 loader",{count:e.length});let r={};for(let s=0;s<e.length;s++){const n=e[s],i=await n(t);i&&(r={...r,...i})}return C.auth("组合 loader 执行完成"),Object.keys(r).length>0?r:null}}function Aa(e){return JSON.stringify(St.isMap(e)?En(e):e,null,2)}function En(e){const t=[];return e.forEach(r=>t.push(r)),t}const vt=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object;function An(e){if(!e||e==="/")return"/";const t=e.replace(/\/{2,}/g,"/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Ra(...e){const t=e.filter(Boolean).join("/").replace(/\/{2,}/g,"/");return An(t)}function Ta(e,t){const r=e.split("/").filter(Boolean),s=t.split("/").filter(Boolean);return r.length!==s.length?!1:r.every((n,i)=>n.startsWith(":")||n===s[i])}function ja(e,t){const r={},s=e.split("/").filter(Boolean),n=t.split("/").filter(Boolean);return s.length!==n.length||s.forEach((i,o)=>{if(i.startsWith(":")){const a=i.slice(1);r[a]=n[o]}}),r}function Fa(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}function Va(e){return typeof e=="function"}function Na(e){return e!=null&&typeof e.then=="function"}function La(e,t=0){const r=parseInt(String(e),10);return isNaN(r)?t:r}function _a(e){return e.replace(/-([a-z])/g,(t,r)=>r.toUpperCase())}function Oa(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,"")}function Da(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function Ua(e,t,r="..."){return e.length<=t?e:e.slice(0,t-r.length)+r}function Tr(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array)return e.map(t=>Tr(t));if(typeof e=="object"){const t={};return Object.keys(e).forEach(r=>{t[r]=Tr(e[r])}),t}return e}function Rn(e,t){if(!e||typeof e!="object")return t||{};if(!t||typeof t!="object")return e;const r={...e};return Object.keys(t).forEach(s=>{const n=t[s],i=r[s];n!==void 0&&(vt(n)&&vt(i)?r[s]=Rn(i,n):r[s]=n)}),r}function za(e,t){if(!t)return Array.from(new Set(e));const r=new Set;return e.filter(s=>{const n=t(s);return r.has(n)?!1:(r.add(n),!0)})}function Ba(e,t){return e.reduce((r,s)=>{const n=t(s);return r[n]||(r[n]=[]),r[n].push(s),r},{})}class Tn{constructor(t=3e5,r=100){he(this,"cache",new Map);he(this,"maxAge");he(this,"maxSize");this.maxAge=t,this.maxSize=r}set(t,r){if(this.cleanup(),this.cache.size>=this.maxSize){const s=this.cache.keys().next().value;s!==void 0&&this.cache.delete(s)}this.cache.set(t,{value:r,timestamp:Date.now()})}get(t){const r=this.cache.get(t);if(r){if(Date.now()-r.timestamp>this.maxAge){this.cache.delete(t);return}return r.value}}has(t){return this.get(t)!==void 0}delete(t){return this.cache.delete(t)}clear(){this.cache.clear()}cleanup(){const t=Date.now(),r=[];this.cache.forEach((s,n)=>{t-s.timestamp>this.maxAge&&r.push(n)}),r.forEach(s=>this.cache.delete(s))}}function $a(e,t){let r;return(...s)=>{clearTimeout(r),r=setTimeout(()=>e(...s),t)}}function Ga(e,t){let r=0;return(...s)=>{const n=Date.now();n-r>=t&&(r=n,e(...s))}}function Wa(e,t){return(...r)=>e(...r)}function jn(e){const t={},r=new URLSearchParams(e);for(const[s,n]of r.entries())t[s]=n;return t}function Fn(e){const t=new URLSearchParams;return Object.entries(e).forEach(([r,s])=>{s!=null&&t.append(r,String(s))}),t.toString()}function qa(e,t){const[r,s]=e.split("?"),i={...jn(s||""),...t},o=Fn(i);return o?`${r}?${o}`:r}function Ha(e,t){try{return e()}catch{return t}}async function Ka(e,t){try{return await e()}catch{return t}}function Za(e){return e!=null&&typeof e=="object"&&"localizedId"in e&&typeof e.localizedId=="string"}function jr(e,t={}){const{enableBehaviorCheck:r=!1}=t;if(typeof e!="function")return C.log("[isAsyncFunction] 输入不是函数类型"),!1;try{if(Object.prototype.toString.call(e)==="[object AsyncFunction]")return!0}catch(n){C.warn("[isAsyncFunction] 标准检测失败:",n.message)}let s="";try{s=Function.prototype.toString.call(e.constructor).match(/function\s*([^\s(]+)/)?.[1]||""}catch(n){C.warn("[isAsyncFunction] 获取构造函数名失败:",n.message),s="UNKNOWN_CONSTRUCTOR"}if(s==="AsyncFunction")return!0;try{const n=Function.prototype.toString.call(e);if(/^async\s+[^(]+\(/.test(n.trim())||n.includes("regeneratorRuntime")&&(n.includes("_async")||n.includes("asyncToGenerator")))return!0}catch(n){C.warn("[isAsyncFunction] 函数体分析失败:",n.message)}try{const n=async()=>{};if(Object.getPrototypeOf(e)===Object.getPrototypeOf(n)||e.__proto__===n.__proto__)return!0}catch(n){C.warn("[isAsyncFunction] 原型链检测失败:",n.message)}if(r)try{const n=e.constructor===(async()=>{}).constructor;return C.info("[isAsyncFunction] 行为检测结果:",n),n}catch(n){C.warn("[isAsyncFunction] 行为检测失败:",n.message)}return!1}const Ya={requireAuth:!1,authCheck:()=>null};let Fr={};function Vn(e){Fr={...Fr,...e},C.action("Action 全局配置已更新",e)}function Xa(e){return{...Ya,...Fr,...e}}function Nn(e){const t={};for(const[r,s]of e.entries())t[r]?Array.isArray(t[r])?t[r].push(s):t[r]=[t[r],s]:t[r]=s;return t}async function Ja(e,t,r){if(!e)return!1;if(t&&t.length>0){const s=e.roles||[];if(!t.some(i=>s.includes(i)))return!1}if(r&&r.length>0){const s=e.permissions||[];if(!r.some(i=>s.includes(i)))return!1}return!0}function Tt(e){return async({request:t})=>{const r=Xa(e);C.action("执行 action",{method:t.method,url:t.url,requireAuth:r.requireAuth});try{let s={};if(r.requireAuth&&r.authCheck&&(jr(r.authCheck)?s=await r.authCheck():s=r.authCheck(),!s))return C.action("用户未认证"),Response.json({success:!1,message:"用户未认证"},{status:401});if(s&&!await Ja(s,r.requiredRoles,r.requiredPermissions))return C.action("权限不足",{userId:s.id,requiredRoles:r.requiredRoles,requiredPermissions:r.requiredPermissions}),Response.json({success:!1,message:"权限不足"},{status:403});const n=await t.formData(),i=Nn(n);if(C.action("表单数据已解析",{fields:Object.keys(i)}),r.validator){const c=await r.validator(n);if(c.length>0)return C.action("表单验证失败",{errors:c}),Response.json({success:!1,errors:c,message:"表单验证失败"},{status:400})}let o;r.processor&&(jr(r.processor)?o=await r.processor(n,s||void 0):o=r.processor(n,s||void 0),C.action("数据处理完成",{hasResult:!!o}));const a={success:!0,data:o,message:"操作成功"};if(r.successRedirect)throw C.action("重定向到成功页面",{path:r.successRedirect}),ge.redirect(r.successRedirect);return C.action("Action 执行成功"),Response.json(a)}catch(s){if(s instanceof Response)throw s;if(C.action("Action 执行失败",{error:s instanceof Error?s.message:String(s)}),r.errorRedirect)throw ge.redirect(r.errorRedirect);return Response.json({success:!1,message:s instanceof Error?s.message:"操作失败"},{status:500})}}}function Ln(e,t){return Tt({...t,requireAuth:!1,validator:async r=>{const s=[],n=r.get("username"),i=r.get("password");return(!n||n.trim()==="")&&s.push({field:"username",message:"用户名不能为空"}),(!i||i.trim()==="")&&s.push({field:"password",message:"密码不能为空"}),s},processor:async r=>{const s=r.get("username"),n=r.get("password"),i=await e({username:s,password:n});return typeof window<"u"&&(localStorage.setItem("auth_user",JSON.stringify(i.user)),localStorage.setItem("auth_token",i.token)),i}})}function Qa(e,t){return Tt({...t,requireAuth:!1,validator:async r=>{const s=[],n=r.get("username"),i=r.get("email"),o=r.get("password"),a=r.get("confirmPassword");return(!n||n.trim()==="")&&s.push({field:"username",message:"用户名不能为空"}),!i||i.trim()===""?s.push({field:"email",message:"邮箱不能为空"}):/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)||s.push({field:"email",message:"邮箱格式不正确"}),(!o||o.length<6)&&s.push({field:"password",message:"密码至少需要6个字符"}),o!==a&&s.push({field:"confirmPassword",message:"两次输入的密码不一致"}),s},processor:async r=>{const s=Nn(r);delete s.confirmPassword;const n=await e(s);return typeof window<"u"&&(localStorage.setItem("auth_user",JSON.stringify(n.user)),localStorage.setItem("auth_token",n.token)),n}})}function _n(e,t){return Tt({...t,requireAuth:!0,processor:async()=>(e&&await e(),typeof window<"u"&&(localStorage.removeItem("auth_user"),localStorage.removeItem("auth_token"),localStorage.removeItem("auth_refresh_token")),{message:"登出成功"}),successRedirect:"/login"})}function el(e,t,r){const s=async n=>{const i=[];return e==="delete"&&(n.get("id")||i.push({field:"id",message:"ID 不能为空"})),i};return Tt({requireAuth:!0,...r,validator:r?.validator||s,processor:t})}function tl(e,t){return Tt({...t,requireAuth:!0,validator:async r=>{const s=[],n=r.getAll("files");n.length===0&&s.push({field:"files",message:"请选择要上传的文件"});for(const i of n)i.size>10*1024*1024&&s.push({field:"files",message:`文件 ${i.name} 超过10MB限制`});return s},processor:async(r,s)=>{const n=r.getAll("files");return await e(n,r,s)}})}function rl(...e){return async t=>{C.action("执行组合 action",{count:e.length});let r={};for(let s=0;s<e.length;s++){const n=e[s],i=await n(t);if(i instanceof Response&&i.status>=300&&i.status<400)return i;if(i instanceof Response){const o=await i.json();r={...r,...o}}else i&&(r={...r,...i})}return C.action("组合 action 执行完成"),Response.json(r)}}async function sl(){try{const t=await import("@gulibs/i18n-locales");return{resources:t.resources||{},supportedLocales:t.supportedLocales||[],keys:t.keys||[],config:t.config}}catch{return null}}class On{constructor(t={}){he(this,"config");he(this,"cache");he(this,"virtualModuleResources");he(this,"virtualModuleKeys");he(this,"virtualModuleSupportedLocales");he(this,"virtualModuleConfig");this.config={basePath:"/locales",extensions:[".json",".ts",".js"],localePattern:"directory",defaultLocale:"en",cacheTime:60*60*1e3,cache:!0,debug:!1,...t},this.cache=new Tn(this.config.cacheTime),this.initVirtualModule()}async initVirtualModule(){try{const t=await sl();t&&(this.virtualModuleResources=t.resources,this.virtualModuleKeys=t.keys,this.virtualModuleSupportedLocales=t.supportedLocales,this.virtualModuleConfig=t.config,Object.entries(t.resources).forEach(([r,s])=>{this.config.cache&&this.cache.set(r,s)}))}catch{}}getVirtualModuleResources(){return this.virtualModuleResources}getVirtualModuleConfig(){return this.virtualModuleConfig}async loadResources(t){if(this.config.cache&&this.cache.has(t)){const r=this.cache.get(t);if(r)return r}if(this.virtualModuleResources?.[t]){const r=this.virtualModuleResources[t];return this.config.cache&&this.cache.set(t,r),this.config.onLoad&&this.config.onLoad(t,r),r}return this.dynamicLoadResources(t)}async dynamicLoadResources(t){try{let r;if(this.config.fetchResources){const s=`${this.config.basePath}/${t}${this.config.extensions[0]}`;r=await this.config.fetchResources(t,s)}else{const s=this.config.extensions[0],n=`${this.config.basePath}/${t}${s}`,i=await fetch(n);if(!i.ok)throw new Error(`Failed to load locale ${t}: ${i.statusText}`);r=await i.json()}return this.config.cache&&this.cache.set(t,r),this.config.onLoad&&this.config.onLoad(t,r),r}catch(r){return this.config.onError&&r instanceof Error&&this.config.onError(t,r),{}}}async preloadResources(t){const r={};if(this.virtualModuleResources){t.forEach(n=>{this.virtualModuleResources[n]&&(r[n]=this.virtualModuleResources[n])});const s=t.filter(n=>!this.virtualModuleResources[n]);if(s.length===0)return r;t=s}return await Promise.all(t.map(async s=>{try{r[s]=await this.loadResources(s)}catch{r[s]={}}})),r}clearCache(t){t?this.cache.delete(t):this.cache.clear()}getConfig(){return{...this.config}}getAvailableKeys(){return this.virtualModuleKeys||[]}hasKey(t){return this.virtualModuleKeys?.includes(t)||!1}getNamespaceResources(t,r){return this.virtualModuleResources?.[t]?.[r]}getSupportedLocales(){return this.virtualModuleSupportedLocales||[this.config.defaultLocale]}isUsingVirtualModule(){return!!this.virtualModuleResources}}function $r(e={}){return new On(e)}class Bt{constructor(t){he(this,"config");he(this,"loader");this.config={defaultLocale:"zh",fallbackToDefault:!0,detectBrowserLanguage:!1,interpolation:{prefix:"{",suffix:"}",escape:r=>String(r)},persistence:{enabled:!0,key:"user_locale",storage:"localStorage"},...t},this.loader=$r(this.config)}getLoader(){return this.loader}getLoadResources(){return this.loader.loadResources.bind(this.loader)}async preloadResources(t){const r=t||this.config.supportedLocales||[this.config.defaultLocale];return this.loader.preloadResources(r)}clearCache(t){this.loader.clearCache(t)}getAvailableKeys(){return this.loader.getAvailableKeys?.()||[]}hasKey(t){return this.loader.hasKey?.(t)||!1}getNamespaceResources(t,r){return this.loader.getNamespaceResources?.(t,r)}isUsingVirtualModule(){return this.loader.isUsingVirtualModule?.()||!1}}const nl={enabled:!0,key:"user_locale",storage:"localStorage"};function il(e){let t={};try{if(!e?.resources){const o=$r(),a=o.getVirtualModuleConfig?.(),c=o.getVirtualModuleResources?.();a&&(t={supportedLocales:a.supportedLocales,basePath:a.basePath,localePattern:a.localePattern},c&&(t.resources=c),e?.debug)}}catch{e?.debug}const r={...nl,...e?.persistence||{}},{persistence:s,...n}=e||{},i={defaultLocale:"zh",fallbackToDefault:!0,detectBrowserLanguage:!1,interpolation:{prefix:"{",suffix:"}",escape:o=>String(o)},...t,...n,persistence:r};return!i.resources&&!i.supportedLocales&&e?.supportedLocales&&(i.supportedLocales=e.supportedLocales),new Bt(i)}const Dn=f.createContext({locale:"zh",setLocale:async()=>{},t:e=>e,td:(e,t)=>t,isReady:!1,availableLocales:["zh","en"],availableKeys:[],hasKey:()=>!1,getNamespaceResources:()=>{},isUsingVirtualModule:!1}),De={};function _t(e,t){if(typeof t!="string")return"";const r=t.split(".");let s=e;for(const n of r){if(s==null)return t;s=s[n]}return s!==void 0?s:t}function ol(e,t,r){const{prefix:s="{",suffix:n="}",escape:i=a=>String(a)}=r,o=new RegExp(`\\${s}([\\w.]+)\\${n}`,"g");return e.replace(o,(a,c)=>{const w=_t(t,c);return w!==c?i(w):`${s}${c}${n}`})}function al({children:e,client:t,defaultLocale:r="zh",locales:s=["zh","en"],loadResources:n,resources:i={}}){const o=f.useMemo(()=>t instanceof Bt?t:t?new Bt(t):new Bt({defaultLocale:r,supportedLocales:s,resources:i,fetchResources:n}),[t,r,s,n,i]),a=o.getLoader(),c=o.config.defaultLocale,w=f.useMemo(()=>o.config.supportedLocales||[c],[o.config.supportedLocales,c]),[h,x]=f.useState(c),[u,y]=f.useState(!1),p=f.useMemo(()=>o.getAvailableKeys(),[o.config]);f.useEffect(()=>{let E=!1;if(C.i18n("🚀 I18nProvider: 开始初始化",{defaultLocale:c,availableLocales:w,hasStaticResources:!!o.config.resources,isUsingVirtualModule:o.isUsingVirtualModule()}),o.config.resources&&Object.entries(o.config.resources).forEach(([A,V])=>{De[A]||(De[A]={}),De[A]={...De[A],...V},C.i18n("💿 I18nProvider: 缓存静态资源",{locale:A,resourceCount:Object.keys(V).length}),A===c&&(E=!0)}),!E&&o.isUsingVirtualModule()){const A=o.getLoader(),V=A.getVirtualModuleResources?.();V?(Object.entries(V).forEach(([O,H])=>{De[O]||(De[O]=H),O===c&&(E=!0)}),C.success("✅ I18nProvider: 从虚拟模块缓存加载资源成功")):(C.i18n("📦 I18nProvider: 异步加载虚拟模块资源",{locale:c}),A.loadResources(c).then(O=>{O&&Object.keys(O).length>0&&(De[c]=O,y(!0),C.success("✅ I18nProvider: 虚拟模块资源加载成功",{locale:c,resourceCount:Object.keys(O).length}))}).catch(O=>{C.error("❌ I18nProvider: 虚拟模块资源加载失败:",O),y(!0)}))}(E||!o.isUsingVirtualModule())&&(y(!0),C.success("✅ I18nProvider: 初始化完成",{hasInitialResources:E}))},[c,w,o,y]);const m=f.useCallback(async E=>{if(C.i18n("🚀 I18nProvider: 开始切换语言",{from:h,to:E,finalLocales:w,isValid:w.includes(E)}),!w.includes(E)){C.error("❌ I18nProvider: 语言不在支持列表中",{newLocale:E,finalLocales:w});return}y(!1);try{if(De[E])C.i18n("💿 I18nProvider: 使用缓存资源",{locale:E});else{C.i18n("📦 I18nProvider: 加载资源",{locale:E});const A=await a.loadResources(E);De[E]=A,C.success("✅ I18nProvider: 资源加载成功",{locale:E,resourceKeys:Object.keys(A).length})}if(x(E),C.success("✅ I18nProvider: 语言切换成功",{newLocale:E}),typeof document<"u"&&(document.documentElement.lang=E,C.i18n("🌍 I18nProvider: 更新 HTML lang 属性",{lang:E})),o.config.persistence?.enabled&&typeof window<"u")try{const A=o.config.persistence.storage==="sessionStorage"?sessionStorage:localStorage,V=o.config.persistence.key||"user_locale";A.setItem(V,E),C.i18n("💾 I18nProvider: 保存语言偏好",{key:V,locale:E})}catch(A){C.error("❌ I18nProvider: 保存语言偏好失败:",A)}}catch(A){C.error("❌ I18nProvider: 加载资源失败",{locale:E,error:A instanceof Error?A.message:A})}finally{y(!0)}},[w,a,o.config.persistence,h]),b=f.useMemo(()=>o.config.interpolation||{},[o.config.interpolation]),P=f.useCallback((E,A)=>A?ol(E,A,b):E,[b]),I=f.useMemo(()=>({keyPrefix:o.config.keyPrefix,fallbackToDefault:o.config.fallbackToDefault}),[o.config.keyPrefix,o.config.fallbackToDefault]),M=f.useCallback((E,A)=>{if(typeof E!="string"||!E)return"";const V=I.keyPrefix?`${I.keyPrefix}.${E}`:E,O=De[h]||{};let H=_t(O,V);if(H===V&&I.fallbackToDefault&&h!==c){const L=De[c]||{},K=_t(L,V);K!==V&&(H=K)}return H===V&&(H=E),P(String(H),A)},[h,c,I,P]),j=f.useCallback((E,A,V)=>{if(typeof E!="string"||!E)return A;const O=I.keyPrefix?`${I.keyPrefix}.${E}`:E,H=De[h]||{};let L=_t(H,O);if(L===O&&I.fallbackToDefault&&h!==c){const K=De[c]||{},oe=_t(K,O);oe!==O&&(L=oe)}return L===O&&(L=A),P(String(L),V)},[h,c,I,P]),F=f.useCallback(E=>o.hasKey(E),[o]),$=f.useCallback(E=>o.getNamespaceResources(h,E),[o,h]);return f.useEffect(()=>{let E=c,A=!1;C.i18n("🔍 I18nProvider: 检测初始语言",{defaultLocale:c,currentLocale:h,persistenceEnabled:o.config.persistence?.enabled,detectBrowserLanguage:o.config.detectBrowserLanguage});try{if(o.config.persistence?.enabled&&typeof window<"u"){const V=o.config.persistence.storage==="sessionStorage"?sessionStorage:localStorage,O=o.config.persistence.key||"user_locale",H=V.getItem(O);C.i18n("💾 I18nProvider: 检查保存的语言",{savedLocale:H,isValid:H&&w.includes(H)}),H&&w.includes(H)&&(E=H,A=!0,C.success("✅ I18nProvider: 恢复保存的语言",{locale:H}))}if(!A&&o.config.detectBrowserLanguage&&typeof navigator<"u"){const V=navigator.language.split("-")[0];C.i18n("🌍 I18nProvider: 检测浏览器语言",{browserLocale:V,isSupported:w.includes(V),isDifferent:V!==c}),w.includes(V)&&V!==c&&(E=V,A=!0,C.success("✅ I18nProvider: 使用浏览器语言",{locale:V}))}}catch(V){C.error("❌ I18nProvider: 语言检测失败:",V)}E!==h|