hermium 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/hermium.mjs +9 -11
- package/dist/public/assets/css/styles-B8p6jk5Z.css +1 -0
- package/dist/public/assets/js/{ChatInputBlock-BgJMx5nW.js → ChatInputBlock-D4CYR2D_.js} +1 -1
- package/dist/{server/public/assets/js/MarkdownMessage-Dd6VsKhk.js → public/assets/js/MarkdownMessage-Bu4diQAT.js} +1 -1
- package/dist/{server/public/assets/js/base-ui-Ls-HE_Zl.js → public/assets/js/base-ui-DKZpRETY.js} +1 -1
- package/dist/public/assets/js/{chat._sessionId-Yif-J0_7.js → chat._sessionId-IyYhnI65.js} +1 -1
- package/dist/public/assets/js/{chat.index-QgwoSqOs.js → chat.index-CdO1bi1g.js} +1 -1
- package/dist/public/assets/js/{index-BDLsrzTe.js → index-CGq67I5U.js} +4 -4
- package/dist/public/assets/js/{index-DRH0t4ti.js → index-CYDXRqze.js} +1 -1
- package/dist/public/assets/js/{memory-CHpNNtU2.js → memory-BC-tVM26.js} +1 -1
- package/dist/public/assets/js/{router-B8BATVn7.js → router-Cdi9aGOg.js} +1 -1
- package/dist/public/assets/js/{settings-CRV3Pp8x.js → settings-CthZPCPZ.js} +1 -1
- package/dist/{server/public/assets/js/skills-C8G72gXr.js → public/assets/js/skills-COr12qk7.js} +1 -1
- package/dist/public/assets/js/{usage-Bev8hqwh.js → usage-oWmLZ5Lt.js} +1 -1
- package/dist/server/_libs/h3.mjs +117 -0
- package/dist/server/_libs/ufo.mjs +158 -1
- package/dist/server/_ssr/{ChatInputBlock-Bu2-iop_.mjs → ChatInputBlock-BTSt3ldw.mjs} +1 -1
- package/dist/server/_ssr/{MarkdownMessage-CNS7OSKN.mjs → MarkdownMessage-DzImLKnw.mjs} +1 -1
- package/dist/server/_ssr/{chat._sessionId-P02iSfut.mjs → chat._sessionId-CUSsvbBX.mjs} +4 -4
- package/dist/server/_ssr/{chat.index-BYB_48NC.mjs → chat.index-YqIyLr2b.mjs} +1 -1
- package/dist/server/_ssr/{index-DFV9_oCk.mjs → index--T6rScER.mjs} +2 -2
- package/dist/server/_ssr/{index-C1mT_2d8.mjs → index-Be17Jodh.mjs} +2 -2
- package/dist/server/_ssr/{memory-CW_fSOG9.mjs → memory-DLVdk8UN.mjs} +3 -3
- package/dist/server/_ssr/{router-CUAfx91O.mjs → router-C0m-TE_e.mjs} +7 -9
- package/dist/server/_ssr/{skills-Cs7A5ZwO.mjs → skills-DAVualEA.mjs} +3 -3
- package/dist/server/_ssr/{usage-Bs2-LXGz.mjs → usage-CCOujow3.mjs} +1 -1
- package/dist/server/{_tanstack-start-manifest_v-C7Upe2TI.mjs → _tanstack-start-manifest_v-wG3l04YA.mjs} +1 -1
- package/dist/server/index.mjs +158 -117
- package/dist/server/public/assets/css/styles-B8p6jk5Z.css +1 -0
- package/dist/server/public/assets/js/{ChatInputBlock-BgJMx5nW.js → ChatInputBlock-D4CYR2D_.js} +1 -1
- package/dist/{public/assets/js/MarkdownMessage-Dd6VsKhk.js → server/public/assets/js/MarkdownMessage-Bu4diQAT.js} +1 -1
- package/dist/{public/assets/js/base-ui-Ls-HE_Zl.js → server/public/assets/js/base-ui-DKZpRETY.js} +1 -1
- package/dist/server/public/assets/js/{chat._sessionId-Yif-J0_7.js → chat._sessionId-IyYhnI65.js} +1 -1
- package/dist/server/public/assets/js/{chat.index-QgwoSqOs.js → chat.index-CdO1bi1g.js} +1 -1
- package/dist/server/public/assets/js/{index-BDLsrzTe.js → index-CGq67I5U.js} +4 -4
- package/dist/server/public/assets/js/{index-DRH0t4ti.js → index-CYDXRqze.js} +1 -1
- package/dist/server/public/assets/js/{memory-CHpNNtU2.js → memory-BC-tVM26.js} +1 -1
- package/dist/server/public/assets/js/{router-B8BATVn7.js → router-Cdi9aGOg.js} +1 -1
- package/dist/server/public/assets/js/{settings-CRV3Pp8x.js → settings-CthZPCPZ.js} +1 -1
- package/dist/{public/assets/js/skills-C8G72gXr.js → server/public/assets/js/skills-COr12qk7.js} +1 -1
- package/dist/server/public/assets/js/{usage-Bev8hqwh.js → usage-oWmLZ5Lt.js} +1 -1
- package/package.json +1 -1
- package/dist/public/assets/css/styles-o9LLzp-x.css +0 -1
- package/dist/server/public/assets/css/styles-o9LLzp-x.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{am as e}from"./index-
|
|
1
|
+
import{am as e}from"./index-CGq67I5U.js";import{d as a}from"./router-Cdi9aGOg.js";import{C as n}from"./ChatInputBlock-D4CYR2D_.js";import"./base-ui-DKZpRETY.js";function x(){const t=a();return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-4",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 w-full max-w-2xl mx-auto",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-semibold tracking-tight text-foreground text-center",children:"What can I help you with?"}),e.jsx("div",{className:"w-full",children:e.jsx(n,{onCreateSession:s=>{t({to:"/chat/$sessionId",params:{sessionId:s}})}})})]})})}export{x as component};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{aw as y,ar as r,aF as w,am as e,j as g,S as z,D as k,d as j,b as u,p as C,l as I,s as M,r as E}from"./index-
|
|
1
|
+
import{aw as y,ar as r,aF as w,am as e,j as g,S as z,D as k,d as j,b as u,p as C,l as I,s as M,r as E}from"./index-CGq67I5U.js";import{M as A}from"./MarkdownMessage-Bu4diQAT.js";import"./base-ui-DKZpRETY.js";import"./router-Cdi9aGOg.js";async function D(){return y("/api/hermes/memory")}async function F(s,o){await y("/api/hermes/memory",{method:"POST",body:JSON.stringify({section:s,content:o})})}const L={memory:{title:"My Notes",icon:e.jsx(E,{className:"size-4"}),empty:"No notes yet. Write down things you want the AI to remember.",placeholder:"Write anything you want the AI to remember about this conversation, context, or preferences..."},user:{title:"User Profile",icon:e.jsx(M,{className:"size-4"}),empty:"No user profile. Add details about yourself.",placeholder:"Describe yourself — your role, expertise, preferences, communication style..."},soul:{title:"Soul",icon:e.jsx(j,{className:"size-4"}),empty:"No soul defined. Set the AI's personality and behavior.",placeholder:"Define the AI's personality, tone, expertise, and how it should behave..."}};function P(s){if(!s)return"";try{return new Date(s).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return""}}function p({section:s,data:o,onSave:f}){const[l,i]=r.useState(!1),[c,m]=r.useState(""),[d,n]=r.useState(!1),a=L[s],t=o[s],x=o[`${s}_mtime`],N=!t.trim(),v=()=>{m(t),i(!0)},b=()=>{i(!1),m("")},S=async()=>{n(!0);try{await f(s,c),i(!1)}catch(h){console.error("Failed to save memory:",h)}finally{n(!1)}};return e.jsxs("div",{className:"flex flex-col border rounded-lg overflow-hidden h-full min-h-0",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5 bg-muted/50 border-b shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:a.icon}),e.jsx("span",{className:"text-sm font-medium",children:a.title}),x?e.jsx("span",{className:"text-[10px] text-muted-foreground/60 ml-1",children:P(x)}):null]}),l?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(u,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:b,disabled:d,children:"Cancel"}),e.jsx(u,{size:"sm",className:"h-7 px-3 text-xs",onClick:S,disabled:d,children:d?e.jsx(g,{className:"size-3 animate-spin"}):"Save"})]}):e.jsxs(u,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:v,children:[e.jsx(I,{className:"size-3 mr-1"}),"Edit"]})]}),l?e.jsx("textarea",{value:c,onChange:h=>m(h.target.value),placeholder:a.placeholder,spellCheck:!1,className:"flex-1 min-h-0 w-full resize-none border-0 bg-transparent px-3 py-3 text-sm leading-relaxed outline-none focus-visible:ring-0 font-mono"}):e.jsx("div",{className:"flex-1 overflow-y-auto p-3 min-h-0",children:N?e.jsx("p",{className:"text-sm text-muted-foreground italic",children:a.empty}):e.jsx(A,{content:t.replace(/§/g,`
|
|
2
2
|
|
|
3
3
|
`)})})]})}function U(){const[s,o]=r.useState(null),[f,l]=r.useState(!0),[i,c]=r.useState(!1),{state:m}=w(),d=m==="collapsed",n=r.useCallback(async()=>{try{const t=await D();o(t)}catch(t){console.error("Failed to load memory:",t)}},[]);r.useEffect(()=>{l(!0),n().finally(()=>l(!1))},[n]);const a=async(t,x)=>{await F(t,x),await n()};return f?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(g,{className:"size-4 animate-spin"}),"Loading memory…"]})}):s?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("header",{className:"flex items-center justify-between border-b px-4 py-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[d&&e.jsx(z,{className:k("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsx(j,{className:"size-5 text-muted-foreground"}),e.jsx("h2",{className:"text-sm font-medium",children:"Memory"})]}),e.jsxs(u,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{c(!0),n().finally(()=>c(!1))},disabled:i,children:[i?e.jsx(g,{className:"size-3 animate-spin"}):e.jsx(C,{className:"size-3"}),"Refresh"]})]}),e.jsx("div",{className:"flex-1 min-h-0 p-4 overflow-hidden",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 h-full min-h-0",children:[e.jsx(p,{section:"memory",data:s,onSave:a}),e.jsx(p,{section:"user",data:s,onSave:a}),e.jsx(p,{section:"soul",data:s,onSave:a})]})})]}):e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load memory."})})}export{U as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ar as c,am as i,J as ze,T as q,R as O,aG as g,a8 as k,av as we,a9 as xe,N as Je,au as Re,H as b,Q as Ce,ap as $e,aq as Ge,B as Ve,a as Qe,ae as Ye,ag as J,a1 as Ze,ay as ie,aj as Xe,F as et,ai as tt,Z as z,aC as Ie,A as Le,a5 as rt,E as Pe,y as nt,a6 as ot,K as st,ac as at,W as be,ax as it}from"./index-BDLsrzTe.js";var $=c.use,H=typeof window<"u"?c.useLayoutEffect:c.useEffect;function se(e){const t=c.useRef({value:e,prev:null}),r=t.current.value;return e!==r&&(t.current={value:e,prev:r}),t.current.prev}function ct(e,t,r={},n={}){c.useEffect(()=>{if(!e.current||n.disabled||typeof IntersectionObserver!="function")return;const a=new IntersectionObserver(([o])=>{t(o)},r);return a.observe(e.current),()=>{a.disconnect()}},[t,r,n.disabled,e])}function ut(e){const t=c.useRef(null);return c.useImperativeHandle(e,()=>t.current,[]),t}function lt({promise:e}){if($)return $(e);const t=ze(e);if(t[q].status==="pending")throw t;if(t[q].status==="error")throw t[q].error;return t[q].data}function rr(e){const t=i.jsx(dt,{...e});return e.fallback?i.jsx(c.Suspense,{fallback:e.fallback,children:t}):t}function dt(e){const t=lt(e);return e.children(t)}function ce(e){const t=e.errorComponent??ue;return i.jsx(ft,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:r,reset:n})=>r?c.createElement(t,{error:r,reset:n}):e.children})}var ft=class extends c.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const r=e.getResetKey();return t.error&&t.resetKey!==r?{resetKey:r,error:null}:{resetKey:r}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function ue({error:e}){const[t,r]=c.useState(!1);return i.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[i.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),i.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>r(n=>!n),children:t?"Hide Error":"Show Error"})]}),i.jsx("div",{style:{height:".25rem"}}),t?i.jsx("div",{children:i.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?i.jsx("code",{children:e.message}):null})}):null]})}function ht({children:e,fallback:t=null}){return le()?i.jsx(O.Fragment,{children:e}):i.jsx(O.Fragment,{children:t})}function le(){return O.useSyncExternalStore(pt,()=>!0,()=>!1)}function pt(){return()=>{}}var _e=c.createContext(null);function S(e){return c.useContext(_e)}var G=c.createContext(void 0),mt=c.createContext(void 0),gt={get:()=>{},subscribe:()=>({unsubscribe:()=>{}})};function _(e){const t=S(),r=c.useContext(e.from?mt:G),n=e.from??r,a=n?e.from?t.stores.getRouteMatchStore(n):t.stores.matchStores.get(n):void 0,o=c.useRef(void 0);return g(a??gt,s=>{if((e.shouldThrow??!0)&&!s&&k(),s===void 0)return;const u=e.select?e.select(s):s;if(e.structuralSharing??t.options.defaultStructuralSharing){const h=we(o.current,u);return o.current=h,h}return u})}function Te(e){return _({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Me(e){const{select:t,...r}=e;return _({...r,select:n=>t?t(n.loaderDeps):n.loaderDeps})}function Ee(e){return _({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const r=e.strict===!1?t.params:t._strictParams;return e.select?e.select(r):r}})}function ke(e){return _({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ae(e){const t=S();return c.useCallback(r=>t.navigate({...r,from:r.from??e?.from}),[e?.from,t])}function Be(e){return _({...e,select:t=>e.select?e.select(t.context):t.context})}function yt(e,t){const r=S(),n=ut(t),{activeProps:a,inactiveProps:o,activeOptions:s,to:u,preload:h,preloadDelay:l,preloadIntentProximity:d,hashScrollIntoView:f,replace:y,startTransition:p,resetScroll:v,viewTransition:I,children:P,target:A,disabled:C,style:W,className:V,onClick:Q,onBlur:Y,onFocus:Z,onMouseEnter:X,onMouseLeave:ee,onTouchStart:te,ignoreBlocker:Oe,params:Jt,search:$t,hash:Gt,state:Vt,mask:Qt,reloadDocument:Yt,unsafeRelative:Zt,from:Xt,_fromLocation:er,...de}=e,re=le(),B=c.useMemo(()=>e,[r,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),j=g(r.stores.location,m=>m,(m,R)=>m.href===R.href),x=c.useMemo(()=>{const m={_fromLocation:j,...B};return r.buildLocation(m)},[r,j,B]),fe=x.maskedLocation?x.maskedLocation.publicHref:x.publicHref,he=x.maskedLocation?x.maskedLocation.external:x.external,F=c.useMemo(()=>It(fe,he,r.history,C),[C,he,fe,r.history]),D=c.useMemo(()=>{if(F?.external)return xe(F.href,r.protocolAllowlist)?void 0:F.href;if(!Pt(u)&&!(typeof u!="string"||u.indexOf(":")===-1))try{return new URL(u),xe(u,r.protocolAllowlist)?void 0:u}catch{}},[u,F,r.protocolAllowlist]),ne=c.useMemo(()=>{if(D)return!1;if(s?.exact){if(!Je(j.pathname,x.pathname,r.basepath))return!1}else{const m=Re(j.pathname,r.basepath),R=Re(x.pathname,r.basepath);if(!(m.startsWith(R)&&(m.length===R.length||m[R.length]==="/")))return!1}return(s?.includeSearch??!0)&&!b(j.search,x.search,{partial:!s?.exact,ignoreUndefined:!s?.explicitUndefined})?!1:s?.includeHash?re&&j.hash===x.hash:!0},[s?.exact,s?.explicitUndefined,s?.includeHash,s?.includeSearch,j,D,re,x.hash,x.pathname,x.search,r.basepath]),K=ne?Ce(a,{})??vt:ae,U=ne?ae:Ce(o,{})??ae,pe=[V,K.className,U.className].filter(Boolean).join(" "),me=(W||K.style||U.style)&&{...W,...K.style,...U.style},[We,ge]=c.useState(!1),ye=c.useRef(!1),T=e.reloadDocument||D?!1:h??r.options.defaultPreload,oe=l??r.options.defaultPreloadDelay??0,w=c.useCallback(()=>{r.preloadRoute({...B,_builtLocation:x}).catch(m=>{console.warn(m),console.warn($e)})},[r,B,x]);ct(n,c.useCallback(m=>{m?.isIntersecting&&w()},[w]),Ct,{disabled:!!C||T!=="viewport"}),c.useEffect(()=>{ye.current||!C&&T==="render"&&(w(),ye.current=!0)},[C,w,T]);const Ke=m=>{const R=m.currentTarget.getAttribute("target"),L=A!==void 0?A:R;if(!C&&!bt(m)&&!m.defaultPrevented&&(!L||L==="_self")&&m.button===0){m.preventDefault(),Ge.flushSync(()=>{ge(!0)});const qe=r.subscribe("onResolved",()=>{qe(),ge(!1)});r.navigate({...B,replace:y,resetScroll:v,hashScrollIntoView:f,startTransition:p,viewTransition:I,ignoreBlocker:Oe})}};if(D)return{...de,ref:n,href:D,...P&&{children:P},...A&&{target:A},...C&&{disabled:C},...W&&{style:W},...V&&{className:V},...Q&&{onClick:Q},...Y&&{onBlur:Y},...Z&&{onFocus:Z},...X&&{onMouseEnter:X},...ee&&{onMouseLeave:ee},...te&&{onTouchStart:te}};const ve=m=>{if(C||T!=="intent")return;if(!oe){w();return}const R=m.currentTarget;if(N.has(R))return;const L=setTimeout(()=>{N.delete(R),w()},oe);N.set(R,L)},Ue=m=>{C||T!=="intent"||w()},Se=m=>{if(C||!T||!oe)return;const R=m.currentTarget,L=N.get(R);L&&(clearTimeout(L),N.delete(R))};return{...de,...K,...U,href:F?.href,ref:n,onClick:M([Q,Ke]),onBlur:M([Y,Se]),onFocus:M([Z,ve]),onMouseEnter:M([X,ve]),onMouseLeave:M([ee,Se]),onTouchStart:M([te,Ue]),disabled:!!C,target:A,...me&&{style:me},...pe&&{className:pe},...C&&St,...ne&&xt,...re&&We&&Rt}}var ae={},vt={className:"active"},St={role:"link","aria-disabled":!0},xt={"data-status":"active","aria-current":"page"},Rt={"data-transitioning":"transitioning"},N=new WeakMap,Ct={rootMargin:"100px"},M=e=>t=>{for(const r of e)if(r){if(t.defaultPrevented)return;r(t)}};function It(e,t,r,n){if(!n)return t?{href:e,external:!0}:{href:r.createHref(e)||"/",external:!1}}function Pt(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Fe=c.forwardRef((e,t)=>{const{_asChild:r,...n}=e,{type:a,...o}=yt(n,t),s=typeof n.children=="function"?n.children({isActive:o["data-status"]==="active"}):n.children;if(!r){const{disabled:u,...h}=o;return c.createElement("a",h,s)}return c.createElement(r,o,s)});function bt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var jt=class extends Qe{constructor(e){super(e),this.useMatch=t=>_({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Be({...t,from:this.id}),this.useSearch=t=>ke({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Ee({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Me({...t,from:this.id}),this.useLoaderData=t=>Te({...t,from:this.id}),this.useNavigate=()=>Ae({from:this.fullPath}),this.Link=O.forwardRef((t,r)=>i.jsx(Fe,{ref:r,from:this.fullPath,...t}))}};function wt(e){return new jt(e)}var Lt=class extends Ve{constructor(e){super(e),this.useMatch=t=>_({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Be({...t,from:this.id}),this.useSearch=t=>ke({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Ee({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Me({...t,from:this.id}),this.useLoaderData=t=>Te({...t,from:this.id}),this.useNavigate=()=>Ae({from:this.fullPath}),this.Link=O.forwardRef((t,r)=>i.jsx(Fe,{ref:r,from:this.fullPath,...t}))}};function nr(e){return new Lt(e)}function or(e){return new _t(e,{silent:!0}).createRoute}var _t=class{constructor(e,t){this.path=e,this.createRoute=r=>{const n=wt(r);return n.isRoot=!1,n},this.silent=t?.silent}};function sr(e,t){let r,n,a,o;const s=()=>(r||(r=e().then(h=>{r=void 0,n=h[t]}).catch(h=>{if(a=h,Ye(a)&&a instanceof Error&&typeof window<"u"&&typeof sessionStorage<"u"){const l=`tanstack_router_reload:${a.message}`;sessionStorage.getItem(l)||(sessionStorage.setItem(l,"1"),o=!0)}})),r),u=function(l){if(o)throw window.location.reload(),new Promise(()=>{});if(a)throw a;if(!n)if($)$(s());else throw s();return c.createElement(n,l)};return u.preload=s,u}function Tt(e){const t=S(),r=`not-found-${g(t.stores.location,n=>n.pathname)}-${g(t.stores.status,n=>n)}`;return i.jsx(ce,{getResetKey:()=>r,onCatch:(n,a)=>{if(J(n))e.onCatch?.(n,a);else throw n},errorComponent:({error:n})=>{if(J(n))return e.fallback?.(n);throw n},children:e.children})}function Mt(){return i.jsx("p",{children:"Not Found"})}function E(e){return i.jsx(i.Fragment,{children:e.children})}function De(e,t,r){return t.options.notFoundComponent?i.jsx(t.options.notFoundComponent,{...r}):e.options.defaultNotFoundComponent?i.jsx(e.options.defaultNotFoundComponent,{...r}):i.jsx(Mt,{})}function Et(){return Ze(S()),null}var Ne=c.memo(function({matchId:t}){const r=S(),n=r.stores.matchStores.get(t);n||k();const a=g(r.stores.loadedAt,s=>s),o=g(n,s=>s);return i.jsx(kt,{router:r,matchId:t,resetKey:a,matchState:c.useMemo(()=>{const s=o.routeId,u=r.routesById[s].parentRoute?.id;return{routeId:s,ssr:o.ssr,_displayPending:o._displayPending,parentRouteId:u}},[o._displayPending,o.routeId,o.ssr,r.routesById])})});function kt({router:e,matchId:t,resetKey:r,matchState:n}){const a=e.routesById[n.routeId],o=a.options.pendingComponent??e.options.defaultPendingComponent,s=o?i.jsx(o,{}):null,u=a.options.errorComponent??e.options.defaultErrorComponent,h=a.options.onCatch??e.options.defaultOnCatch,l=a.isRoot?a.options.notFoundComponent??e.options.notFoundRoute?.options.component:a.options.notFoundComponent,d=n.ssr===!1||n.ssr==="data-only",f=(!a.isRoot||a.options.wrapInSuspense||d)&&(a.options.wrapInSuspense??o??(a.options.errorComponent?.preload||d))?c.Suspense:E,y=u?ce:E,p=l?Tt:E;return i.jsxs(a.isRoot?a.options.shellComponent??E:E,{children:[i.jsx(G.Provider,{value:t,children:i.jsx(f,{fallback:s,children:i.jsx(y,{getResetKey:()=>r,errorComponent:u||ue,onCatch:(v,I)=>{if(J(v))throw v.routeId??=n.routeId,v;h?.(v,I)},children:i.jsx(p,{fallback:v=>{if(v.routeId??=n.routeId,!l||v.routeId&&v.routeId!==n.routeId||!v.routeId&&!a.isRoot)throw v;return c.createElement(l,v)},children:d||n._displayPending?i.jsx(ht,{fallback:s,children:i.jsx(je,{matchId:t})}):i.jsx(je,{matchId:t})})})})}),n.parentRouteId===ie?i.jsxs(i.Fragment,{children:[i.jsx(At,{resetKey:r}),e.options.scrollRestoration&&Xe?i.jsx(Et,{}):null]}):null]})}function At({resetKey:e}){const t=S(),r=c.useRef(void 0);return H(()=>{const n=t.latestLocation.href;(r.current===void 0||r.current!==n)&&(t.emit({type:"onRendered",...z(t.stores.location.get(),t.stores.resolvedLocation.get())}),r.current=n)},[t.latestLocation.state.__TSR_key,e,t]),null}var je=c.memo(function({matchId:t}){const r=S(),n=(d,f)=>r.getMatch(d.id)?._nonReactive[f]??d._nonReactive[f],a=r.stores.matchStores.get(t);a||k();const o=g(a,d=>d),s=o.routeId,u=r.routesById[s],h=c.useMemo(()=>{const d=(r.routesById[s].options.remountDeps??r.options.defaultRemountDeps)?.({routeId:s,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return d?JSON.stringify(d):void 0},[s,o.loaderDeps,o._strictParams,o._strictSearch,r.options.defaultRemountDeps,r.routesById]),l=c.useMemo(()=>{const d=u.options.component??r.options.defaultComponent;return d?i.jsx(d,{},h):i.jsx(Bt,{})},[h,u.options.component,r.options.defaultComponent]);if(o._displayPending)throw n(o,"displayPendingPromise");if(o._forcePending)throw n(o,"minPendingPromise");if(o.status==="pending"){const d=u.options.pendingMinMs??r.options.defaultPendingMinMs;if(d){const f=r.getMatch(o.id);if(f&&!f._nonReactive.minPendingPromise){const y=et();f._nonReactive.minPendingPromise=y,setTimeout(()=>{y.resolve(),f._nonReactive.minPendingPromise=void 0},d)}}throw n(o,"loadPromise")}if(o.status==="notFound")return J(o.error)||k(),De(r,u,o.error);if(o.status==="redirected")throw tt(o.error)||k(),n(o,"loadPromise");if(o.status==="error")throw o.error;return l}),Bt=c.memo(function(){const t=S(),r=c.useContext(G);let n,a=!1,o;{const l=r?t.stores.matchStores.get(r):void 0;[n,a]=g(l,d=>[d?.routeId,d?.globalNotFound??!1]),o=g(t.stores.matchesId,d=>d[d.findIndex(f=>f===r)+1])}const s=n?t.routesById[n]:void 0,u=t.options.defaultPendingComponent?i.jsx(t.options.defaultPendingComponent,{}):null;if(a)return s||k(),De(t,s,void 0);if(!o)return null;const h=i.jsx(Ne,{matchId:o});return n===ie?i.jsx(c.Suspense,{fallback:u,children:h}):h});function Ft(){const e=S(),t=c.useRef({router:e,mounted:!1}),[r,n]=c.useState(!1),a=g(e.stores.isLoading,f=>f),o=g(e.stores.hasPending,f=>f),s=se(a),u=a||r||o,h=se(u),l=a||o,d=se(l);return e.startTransition=f=>{n(!0),c.startTransition(()=>{f(),n(!1)})},c.useEffect(()=>{const f=e.history.subscribe(e.load),y=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Ie(e.latestLocation.publicHref)!==Ie(y.publicHref)&&e.commitLocation({...y,replace:!0}),()=>{f()}},[e,e.history]),H(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(y){console.error(y)}})()},[e]),H(()=>{s&&!a&&e.emit({type:"onLoad",...z(e.stores.location.get(),e.stores.resolvedLocation.get())})},[s,e,a]),H(()=>{d&&!l&&e.emit({type:"onBeforeRouteMount",...z(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,d,e]),H(()=>{if(h&&!u){const f=z(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...f}),Le(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())}),f.hrefChanged&&rt(e)}},[u,h,e]),null}function Dt(){const e=S(),t=e.routesById[ie].options.pendingComponent??e.options.defaultPendingComponent,r=t?i.jsx(t,{}):null,n=i.jsxs(typeof document<"u"&&e.ssr?E:c.Suspense,{fallback:r,children:[i.jsx(Ft,{}),i.jsx(Nt,{})]});return e.options.InnerWrap?i.jsx(e.options.InnerWrap,{children:n}):n}function Nt(){const e=S(),t=g(e.stores.firstId,a=>a),r=g(e.stores.loadedAt,a=>a),n=t?i.jsx(Ne,{matchId:t}):null;return i.jsx(G.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?n:i.jsx(ce,{getResetKey:()=>r,errorComponent:ue,onCatch:void 0,children:n})})}var Ht=e=>({createMutableStore:Pe,createReadonlyStore:Pe,batch:Le}),ar=e=>new Ot(e),Ot=class extends nt{constructor(e){super(e,Ht)}};function Wt({router:e,children:t,...r}){ot(r)&&e.update({...e.options,...r,context:{...e.options.context,...r.context}});const n=i.jsx(_e.Provider,{value:e,children:t});return e.options.Wrap?i.jsx(e.options.Wrap,{children:n}):n}function ir({router:e,...t}){return i.jsx(Wt,{router:e,...t,children:i.jsx(Dt,{})})}function cr(e){const t=S(),r=c.useRef(void 0);return g(t.stores.location,n=>{const a=n;if(t.options.defaultStructuralSharing){const o=we(r.current,a);return r.current=o,o}return a})}function He(e){const{attrs:t,children:r,nonce:n}=e;switch(e.tag){case"title":return i.jsx("title",{...t,suppressHydrationWarning:!0,children:r});case"meta":return i.jsx("meta",{...t,suppressHydrationWarning:!0});case"link":return i.jsx("link",{...t,precedence:t?.precedence??(t?.rel==="stylesheet"?"default":void 0),nonce:n,suppressHydrationWarning:!0});case"style":return e.inlineCss,i.jsx("style",{...t,dangerouslySetInnerHTML:{__html:r},nonce:n});case"script":return i.jsx(Kt,{attrs:t,children:r});default:return null}}function Kt({attrs:e,children:t}){S();const r=le(),n=typeof e?.type=="string"&&e.type!==""&&e.type!=="text/javascript"&&e.type!=="module";if(c.useEffect(()=>{if(!n){if(e?.src){const a=(()=>{try{const s=document.baseURI||window.location.href;return new URL(e.src,s).href}catch{return e.src}})();if(Array.from(document.querySelectorAll("script[src]")).find(s=>s.src===a))return;const o=document.createElement("script");for(const[s,u]of Object.entries(e))s!=="suppressHydrationWarning"&&u!==void 0&&u!==!1&&o.setAttribute(s,typeof u=="boolean"?"":String(u));return document.head.appendChild(o),()=>{o.parentNode&&o.parentNode.removeChild(o)}}if(typeof t=="string"){const a=typeof e?.type=="string"?e.type:"text/javascript",o=typeof e?.nonce=="string"?e.nonce:void 0;if(Array.from(document.querySelectorAll("script:not([src])")).find(u=>{if(!(u instanceof HTMLScriptElement))return!1;const h=u.getAttribute("type")??"text/javascript",l=u.getAttribute("nonce")??void 0;return u.textContent===t&&h===a&&l===o}))return;const s=document.createElement("script");if(s.textContent=t,e)for(const[u,h]of Object.entries(e))u!=="suppressHydrationWarning"&&h!==void 0&&h!==!1&&s.setAttribute(u,typeof h=="boolean"?"":String(h));return document.head.appendChild(s),()=>{s.parentNode&&s.parentNode.removeChild(s)}}}},[e,t,n]),n&&typeof t=="string")return i.jsx("script",{...e,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:t}});if(!r){if(e?.src)return i.jsx("script",{...e,suppressHydrationWarning:!0});if(typeof t=="string")return i.jsx("script",{...e,dangerouslySetInnerHTML:{__html:t},suppressHydrationWarning:!0})}return null}var Ut=e=>{const t=S(),r=t.options.ssr?.nonce,n=g(t.stores.matches,l=>l.map(d=>d.meta).filter(Boolean),b),a=c.useMemo(()=>{const l=[],d={};let f;for(let y=n.length-1;y>=0;y--){const p=n[y];for(let v=p.length-1;v>=0;v--){const I=p[v];if(I)if(I.title)f||(f={tag:"title",children:I.title});else if("script:ld+json"in I)try{const P=JSON.stringify(I["script:ld+json"]);l.push({tag:"script",attrs:{type:"application/ld+json"},children:st(P)})}catch{}else{const P=I.name??I.property;if(P){if(d[P])continue;d[P]=!0}l.push({tag:"meta",attrs:{...I,nonce:r}})}}}return f&&l.push(f),r&&l.push({tag:"meta",attrs:{property:"csp-nonce",content:r}}),l.reverse(),l},[n,r]),o=g(t.stores.matches,l=>{const d=l.map(p=>p.links).filter(Boolean).flat(1).map(p=>({tag:"link",attrs:{...p,nonce:r}})),f=t.ssr?.manifest,y=l.map(p=>f?.routes[p.routeId]?.assets??[]).filter(Boolean).flat(1).flatMap(p=>p.tag==="link"?at(f,p)?[]:[{tag:"link",attrs:{...p.attrs,crossOrigin:be(e,"stylesheet")??p.attrs?.crossOrigin,suppressHydrationWarning:!0,nonce:r}}]:p.tag==="style"?[{tag:"style",attrs:{...p.attrs,nonce:r},children:p.children,...p.inlineCss?{inlineCss:!0}:{}}]:[]);return[...d,...y]},b),s=g(t.stores.matches,l=>{const d=[];return l.map(f=>t.looseRoutesById[f.routeId]).forEach(f=>t.ssr?.manifest?.routes[f.id]?.preloads?.filter(Boolean).forEach(y=>{const p=it(y);d.push({tag:"link",attrs:{rel:"modulepreload",href:p.href,crossOrigin:be(e,"modulepreload")??p.crossOrigin,nonce:r}})})),d},b),u=g(t.stores.matches,l=>l.map(d=>d.styles).flat(1).filter(Boolean).map(({children:d,...f})=>({tag:"style",attrs:{...f,nonce:r},children:d})),b),h=g(t.stores.matches,l=>l.map(d=>d.headScripts).flat(1).filter(Boolean).map(({children:d,...f})=>({tag:"script",attrs:{...f,nonce:r},children:d})),b);return qt([...a,...s,...o,...u,...h],l=>JSON.stringify(l))};function qt(e,t){const r=new Set;return e.filter(n=>{const a=t(n);return r.has(a)?!1:(r.add(a),!0)})}function ur(e){const t=Ut(e.assetCrossOrigin),r=S().options.ssr?.nonce;return i.jsx(i.Fragment,{children:t.map(n=>c.createElement(He,{...n,key:`tsr-meta-${JSON.stringify(n)}`,nonce:r}))})}var lr=()=>{const e=S(),t=e.options.ssr?.nonce,r=o=>{const s=[],u=e.ssr?.manifest;return u?(o.map(h=>e.looseRoutesById[h.routeId]).forEach(h=>u.routes[h.id]?.assets?.filter(l=>l.tag==="script").forEach(l=>{s.push({tag:"script",attrs:{...l.attrs,nonce:t},children:l.children})})),s):[]},n=o=>o.map(s=>s.scripts).flat(1).filter(Boolean).map(({children:s,...u})=>({tag:"script",attrs:{...u,suppressHydrationWarning:!0,nonce:t},children:s})),a=g(e.stores.matches,r,b);return zt(e,g(e.stores.matches,n,b),a)};function zt(e,t,r){let n;e.serverSsr&&(n=e.serverSsr.takeBufferedScripts());const a=[...t,...r];return n&&a.unshift(n),i.jsx(i.Fragment,{children:a.map((o,s)=>c.createElement(He,{...o,key:`tsr-scripts-${o.tag}-${s}`}))})}export{rr as A,ur as H,Fe as L,ir as R,lr as S,nr as a,ar as b,or as c,Ae as d,sr as l,cr as u};
|
|
1
|
+
import{ar as c,am as i,J as ze,T as q,R as O,aG as g,a8 as k,av as we,a9 as xe,N as Je,au as Re,H as b,Q as Ce,ap as $e,aq as Ge,B as Ve,a as Qe,ae as Ye,ag as J,a1 as Ze,ay as ie,aj as Xe,F as et,ai as tt,Z as z,aC as Ie,A as Le,a5 as rt,E as Pe,y as nt,a6 as ot,K as st,ac as at,W as be,ax as it}from"./index-CGq67I5U.js";var $=c.use,H=typeof window<"u"?c.useLayoutEffect:c.useEffect;function se(e){const t=c.useRef({value:e,prev:null}),r=t.current.value;return e!==r&&(t.current={value:e,prev:r}),t.current.prev}function ct(e,t,r={},n={}){c.useEffect(()=>{if(!e.current||n.disabled||typeof IntersectionObserver!="function")return;const a=new IntersectionObserver(([o])=>{t(o)},r);return a.observe(e.current),()=>{a.disconnect()}},[t,r,n.disabled,e])}function ut(e){const t=c.useRef(null);return c.useImperativeHandle(e,()=>t.current,[]),t}function lt({promise:e}){if($)return $(e);const t=ze(e);if(t[q].status==="pending")throw t;if(t[q].status==="error")throw t[q].error;return t[q].data}function rr(e){const t=i.jsx(dt,{...e});return e.fallback?i.jsx(c.Suspense,{fallback:e.fallback,children:t}):t}function dt(e){const t=lt(e);return e.children(t)}function ce(e){const t=e.errorComponent??ue;return i.jsx(ft,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:r,reset:n})=>r?c.createElement(t,{error:r,reset:n}):e.children})}var ft=class extends c.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const r=e.getResetKey();return t.error&&t.resetKey!==r?{resetKey:r,error:null}:{resetKey:r}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function ue({error:e}){const[t,r]=c.useState(!1);return i.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[i.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),i.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>r(n=>!n),children:t?"Hide Error":"Show Error"})]}),i.jsx("div",{style:{height:".25rem"}}),t?i.jsx("div",{children:i.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?i.jsx("code",{children:e.message}):null})}):null]})}function ht({children:e,fallback:t=null}){return le()?i.jsx(O.Fragment,{children:e}):i.jsx(O.Fragment,{children:t})}function le(){return O.useSyncExternalStore(pt,()=>!0,()=>!1)}function pt(){return()=>{}}var _e=c.createContext(null);function S(e){return c.useContext(_e)}var G=c.createContext(void 0),mt=c.createContext(void 0),gt={get:()=>{},subscribe:()=>({unsubscribe:()=>{}})};function _(e){const t=S(),r=c.useContext(e.from?mt:G),n=e.from??r,a=n?e.from?t.stores.getRouteMatchStore(n):t.stores.matchStores.get(n):void 0,o=c.useRef(void 0);return g(a??gt,s=>{if((e.shouldThrow??!0)&&!s&&k(),s===void 0)return;const u=e.select?e.select(s):s;if(e.structuralSharing??t.options.defaultStructuralSharing){const h=we(o.current,u);return o.current=h,h}return u})}function Te(e){return _({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Me(e){const{select:t,...r}=e;return _({...r,select:n=>t?t(n.loaderDeps):n.loaderDeps})}function Ee(e){return _({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const r=e.strict===!1?t.params:t._strictParams;return e.select?e.select(r):r}})}function ke(e){return _({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ae(e){const t=S();return c.useCallback(r=>t.navigate({...r,from:r.from??e?.from}),[e?.from,t])}function Be(e){return _({...e,select:t=>e.select?e.select(t.context):t.context})}function yt(e,t){const r=S(),n=ut(t),{activeProps:a,inactiveProps:o,activeOptions:s,to:u,preload:h,preloadDelay:l,preloadIntentProximity:d,hashScrollIntoView:f,replace:y,startTransition:p,resetScroll:v,viewTransition:I,children:P,target:A,disabled:C,style:W,className:V,onClick:Q,onBlur:Y,onFocus:Z,onMouseEnter:X,onMouseLeave:ee,onTouchStart:te,ignoreBlocker:Oe,params:Jt,search:$t,hash:Gt,state:Vt,mask:Qt,reloadDocument:Yt,unsafeRelative:Zt,from:Xt,_fromLocation:er,...de}=e,re=le(),B=c.useMemo(()=>e,[r,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),j=g(r.stores.location,m=>m,(m,R)=>m.href===R.href),x=c.useMemo(()=>{const m={_fromLocation:j,...B};return r.buildLocation(m)},[r,j,B]),fe=x.maskedLocation?x.maskedLocation.publicHref:x.publicHref,he=x.maskedLocation?x.maskedLocation.external:x.external,F=c.useMemo(()=>It(fe,he,r.history,C),[C,he,fe,r.history]),D=c.useMemo(()=>{if(F?.external)return xe(F.href,r.protocolAllowlist)?void 0:F.href;if(!Pt(u)&&!(typeof u!="string"||u.indexOf(":")===-1))try{return new URL(u),xe(u,r.protocolAllowlist)?void 0:u}catch{}},[u,F,r.protocolAllowlist]),ne=c.useMemo(()=>{if(D)return!1;if(s?.exact){if(!Je(j.pathname,x.pathname,r.basepath))return!1}else{const m=Re(j.pathname,r.basepath),R=Re(x.pathname,r.basepath);if(!(m.startsWith(R)&&(m.length===R.length||m[R.length]==="/")))return!1}return(s?.includeSearch??!0)&&!b(j.search,x.search,{partial:!s?.exact,ignoreUndefined:!s?.explicitUndefined})?!1:s?.includeHash?re&&j.hash===x.hash:!0},[s?.exact,s?.explicitUndefined,s?.includeHash,s?.includeSearch,j,D,re,x.hash,x.pathname,x.search,r.basepath]),K=ne?Ce(a,{})??vt:ae,U=ne?ae:Ce(o,{})??ae,pe=[V,K.className,U.className].filter(Boolean).join(" "),me=(W||K.style||U.style)&&{...W,...K.style,...U.style},[We,ge]=c.useState(!1),ye=c.useRef(!1),T=e.reloadDocument||D?!1:h??r.options.defaultPreload,oe=l??r.options.defaultPreloadDelay??0,w=c.useCallback(()=>{r.preloadRoute({...B,_builtLocation:x}).catch(m=>{console.warn(m),console.warn($e)})},[r,B,x]);ct(n,c.useCallback(m=>{m?.isIntersecting&&w()},[w]),Ct,{disabled:!!C||T!=="viewport"}),c.useEffect(()=>{ye.current||!C&&T==="render"&&(w(),ye.current=!0)},[C,w,T]);const Ke=m=>{const R=m.currentTarget.getAttribute("target"),L=A!==void 0?A:R;if(!C&&!bt(m)&&!m.defaultPrevented&&(!L||L==="_self")&&m.button===0){m.preventDefault(),Ge.flushSync(()=>{ge(!0)});const qe=r.subscribe("onResolved",()=>{qe(),ge(!1)});r.navigate({...B,replace:y,resetScroll:v,hashScrollIntoView:f,startTransition:p,viewTransition:I,ignoreBlocker:Oe})}};if(D)return{...de,ref:n,href:D,...P&&{children:P},...A&&{target:A},...C&&{disabled:C},...W&&{style:W},...V&&{className:V},...Q&&{onClick:Q},...Y&&{onBlur:Y},...Z&&{onFocus:Z},...X&&{onMouseEnter:X},...ee&&{onMouseLeave:ee},...te&&{onTouchStart:te}};const ve=m=>{if(C||T!=="intent")return;if(!oe){w();return}const R=m.currentTarget;if(N.has(R))return;const L=setTimeout(()=>{N.delete(R),w()},oe);N.set(R,L)},Ue=m=>{C||T!=="intent"||w()},Se=m=>{if(C||!T||!oe)return;const R=m.currentTarget,L=N.get(R);L&&(clearTimeout(L),N.delete(R))};return{...de,...K,...U,href:F?.href,ref:n,onClick:M([Q,Ke]),onBlur:M([Y,Se]),onFocus:M([Z,ve]),onMouseEnter:M([X,ve]),onMouseLeave:M([ee,Se]),onTouchStart:M([te,Ue]),disabled:!!C,target:A,...me&&{style:me},...pe&&{className:pe},...C&&St,...ne&&xt,...re&&We&&Rt}}var ae={},vt={className:"active"},St={role:"link","aria-disabled":!0},xt={"data-status":"active","aria-current":"page"},Rt={"data-transitioning":"transitioning"},N=new WeakMap,Ct={rootMargin:"100px"},M=e=>t=>{for(const r of e)if(r){if(t.defaultPrevented)return;r(t)}};function It(e,t,r,n){if(!n)return t?{href:e,external:!0}:{href:r.createHref(e)||"/",external:!1}}function Pt(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Fe=c.forwardRef((e,t)=>{const{_asChild:r,...n}=e,{type:a,...o}=yt(n,t),s=typeof n.children=="function"?n.children({isActive:o["data-status"]==="active"}):n.children;if(!r){const{disabled:u,...h}=o;return c.createElement("a",h,s)}return c.createElement(r,o,s)});function bt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var jt=class extends Qe{constructor(e){super(e),this.useMatch=t=>_({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Be({...t,from:this.id}),this.useSearch=t=>ke({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Ee({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Me({...t,from:this.id}),this.useLoaderData=t=>Te({...t,from:this.id}),this.useNavigate=()=>Ae({from:this.fullPath}),this.Link=O.forwardRef((t,r)=>i.jsx(Fe,{ref:r,from:this.fullPath,...t}))}};function wt(e){return new jt(e)}var Lt=class extends Ve{constructor(e){super(e),this.useMatch=t=>_({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Be({...t,from:this.id}),this.useSearch=t=>ke({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Ee({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Me({...t,from:this.id}),this.useLoaderData=t=>Te({...t,from:this.id}),this.useNavigate=()=>Ae({from:this.fullPath}),this.Link=O.forwardRef((t,r)=>i.jsx(Fe,{ref:r,from:this.fullPath,...t}))}};function nr(e){return new Lt(e)}function or(e){return new _t(e,{silent:!0}).createRoute}var _t=class{constructor(e,t){this.path=e,this.createRoute=r=>{const n=wt(r);return n.isRoot=!1,n},this.silent=t?.silent}};function sr(e,t){let r,n,a,o;const s=()=>(r||(r=e().then(h=>{r=void 0,n=h[t]}).catch(h=>{if(a=h,Ye(a)&&a instanceof Error&&typeof window<"u"&&typeof sessionStorage<"u"){const l=`tanstack_router_reload:${a.message}`;sessionStorage.getItem(l)||(sessionStorage.setItem(l,"1"),o=!0)}})),r),u=function(l){if(o)throw window.location.reload(),new Promise(()=>{});if(a)throw a;if(!n)if($)$(s());else throw s();return c.createElement(n,l)};return u.preload=s,u}function Tt(e){const t=S(),r=`not-found-${g(t.stores.location,n=>n.pathname)}-${g(t.stores.status,n=>n)}`;return i.jsx(ce,{getResetKey:()=>r,onCatch:(n,a)=>{if(J(n))e.onCatch?.(n,a);else throw n},errorComponent:({error:n})=>{if(J(n))return e.fallback?.(n);throw n},children:e.children})}function Mt(){return i.jsx("p",{children:"Not Found"})}function E(e){return i.jsx(i.Fragment,{children:e.children})}function De(e,t,r){return t.options.notFoundComponent?i.jsx(t.options.notFoundComponent,{...r}):e.options.defaultNotFoundComponent?i.jsx(e.options.defaultNotFoundComponent,{...r}):i.jsx(Mt,{})}function Et(){return Ze(S()),null}var Ne=c.memo(function({matchId:t}){const r=S(),n=r.stores.matchStores.get(t);n||k();const a=g(r.stores.loadedAt,s=>s),o=g(n,s=>s);return i.jsx(kt,{router:r,matchId:t,resetKey:a,matchState:c.useMemo(()=>{const s=o.routeId,u=r.routesById[s].parentRoute?.id;return{routeId:s,ssr:o.ssr,_displayPending:o._displayPending,parentRouteId:u}},[o._displayPending,o.routeId,o.ssr,r.routesById])})});function kt({router:e,matchId:t,resetKey:r,matchState:n}){const a=e.routesById[n.routeId],o=a.options.pendingComponent??e.options.defaultPendingComponent,s=o?i.jsx(o,{}):null,u=a.options.errorComponent??e.options.defaultErrorComponent,h=a.options.onCatch??e.options.defaultOnCatch,l=a.isRoot?a.options.notFoundComponent??e.options.notFoundRoute?.options.component:a.options.notFoundComponent,d=n.ssr===!1||n.ssr==="data-only",f=(!a.isRoot||a.options.wrapInSuspense||d)&&(a.options.wrapInSuspense??o??(a.options.errorComponent?.preload||d))?c.Suspense:E,y=u?ce:E,p=l?Tt:E;return i.jsxs(a.isRoot?a.options.shellComponent??E:E,{children:[i.jsx(G.Provider,{value:t,children:i.jsx(f,{fallback:s,children:i.jsx(y,{getResetKey:()=>r,errorComponent:u||ue,onCatch:(v,I)=>{if(J(v))throw v.routeId??=n.routeId,v;h?.(v,I)},children:i.jsx(p,{fallback:v=>{if(v.routeId??=n.routeId,!l||v.routeId&&v.routeId!==n.routeId||!v.routeId&&!a.isRoot)throw v;return c.createElement(l,v)},children:d||n._displayPending?i.jsx(ht,{fallback:s,children:i.jsx(je,{matchId:t})}):i.jsx(je,{matchId:t})})})})}),n.parentRouteId===ie?i.jsxs(i.Fragment,{children:[i.jsx(At,{resetKey:r}),e.options.scrollRestoration&&Xe?i.jsx(Et,{}):null]}):null]})}function At({resetKey:e}){const t=S(),r=c.useRef(void 0);return H(()=>{const n=t.latestLocation.href;(r.current===void 0||r.current!==n)&&(t.emit({type:"onRendered",...z(t.stores.location.get(),t.stores.resolvedLocation.get())}),r.current=n)},[t.latestLocation.state.__TSR_key,e,t]),null}var je=c.memo(function({matchId:t}){const r=S(),n=(d,f)=>r.getMatch(d.id)?._nonReactive[f]??d._nonReactive[f],a=r.stores.matchStores.get(t);a||k();const o=g(a,d=>d),s=o.routeId,u=r.routesById[s],h=c.useMemo(()=>{const d=(r.routesById[s].options.remountDeps??r.options.defaultRemountDeps)?.({routeId:s,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return d?JSON.stringify(d):void 0},[s,o.loaderDeps,o._strictParams,o._strictSearch,r.options.defaultRemountDeps,r.routesById]),l=c.useMemo(()=>{const d=u.options.component??r.options.defaultComponent;return d?i.jsx(d,{},h):i.jsx(Bt,{})},[h,u.options.component,r.options.defaultComponent]);if(o._displayPending)throw n(o,"displayPendingPromise");if(o._forcePending)throw n(o,"minPendingPromise");if(o.status==="pending"){const d=u.options.pendingMinMs??r.options.defaultPendingMinMs;if(d){const f=r.getMatch(o.id);if(f&&!f._nonReactive.minPendingPromise){const y=et();f._nonReactive.minPendingPromise=y,setTimeout(()=>{y.resolve(),f._nonReactive.minPendingPromise=void 0},d)}}throw n(o,"loadPromise")}if(o.status==="notFound")return J(o.error)||k(),De(r,u,o.error);if(o.status==="redirected")throw tt(o.error)||k(),n(o,"loadPromise");if(o.status==="error")throw o.error;return l}),Bt=c.memo(function(){const t=S(),r=c.useContext(G);let n,a=!1,o;{const l=r?t.stores.matchStores.get(r):void 0;[n,a]=g(l,d=>[d?.routeId,d?.globalNotFound??!1]),o=g(t.stores.matchesId,d=>d[d.findIndex(f=>f===r)+1])}const s=n?t.routesById[n]:void 0,u=t.options.defaultPendingComponent?i.jsx(t.options.defaultPendingComponent,{}):null;if(a)return s||k(),De(t,s,void 0);if(!o)return null;const h=i.jsx(Ne,{matchId:o});return n===ie?i.jsx(c.Suspense,{fallback:u,children:h}):h});function Ft(){const e=S(),t=c.useRef({router:e,mounted:!1}),[r,n]=c.useState(!1),a=g(e.stores.isLoading,f=>f),o=g(e.stores.hasPending,f=>f),s=se(a),u=a||r||o,h=se(u),l=a||o,d=se(l);return e.startTransition=f=>{n(!0),c.startTransition(()=>{f(),n(!1)})},c.useEffect(()=>{const f=e.history.subscribe(e.load),y=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Ie(e.latestLocation.publicHref)!==Ie(y.publicHref)&&e.commitLocation({...y,replace:!0}),()=>{f()}},[e,e.history]),H(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(y){console.error(y)}})()},[e]),H(()=>{s&&!a&&e.emit({type:"onLoad",...z(e.stores.location.get(),e.stores.resolvedLocation.get())})},[s,e,a]),H(()=>{d&&!l&&e.emit({type:"onBeforeRouteMount",...z(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,d,e]),H(()=>{if(h&&!u){const f=z(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...f}),Le(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())}),f.hrefChanged&&rt(e)}},[u,h,e]),null}function Dt(){const e=S(),t=e.routesById[ie].options.pendingComponent??e.options.defaultPendingComponent,r=t?i.jsx(t,{}):null,n=i.jsxs(typeof document<"u"&&e.ssr?E:c.Suspense,{fallback:r,children:[i.jsx(Ft,{}),i.jsx(Nt,{})]});return e.options.InnerWrap?i.jsx(e.options.InnerWrap,{children:n}):n}function Nt(){const e=S(),t=g(e.stores.firstId,a=>a),r=g(e.stores.loadedAt,a=>a),n=t?i.jsx(Ne,{matchId:t}):null;return i.jsx(G.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?n:i.jsx(ce,{getResetKey:()=>r,errorComponent:ue,onCatch:void 0,children:n})})}var Ht=e=>({createMutableStore:Pe,createReadonlyStore:Pe,batch:Le}),ar=e=>new Ot(e),Ot=class extends nt{constructor(e){super(e,Ht)}};function Wt({router:e,children:t,...r}){ot(r)&&e.update({...e.options,...r,context:{...e.options.context,...r.context}});const n=i.jsx(_e.Provider,{value:e,children:t});return e.options.Wrap?i.jsx(e.options.Wrap,{children:n}):n}function ir({router:e,...t}){return i.jsx(Wt,{router:e,...t,children:i.jsx(Dt,{})})}function cr(e){const t=S(),r=c.useRef(void 0);return g(t.stores.location,n=>{const a=n;if(t.options.defaultStructuralSharing){const o=we(r.current,a);return r.current=o,o}return a})}function He(e){const{attrs:t,children:r,nonce:n}=e;switch(e.tag){case"title":return i.jsx("title",{...t,suppressHydrationWarning:!0,children:r});case"meta":return i.jsx("meta",{...t,suppressHydrationWarning:!0});case"link":return i.jsx("link",{...t,precedence:t?.precedence??(t?.rel==="stylesheet"?"default":void 0),nonce:n,suppressHydrationWarning:!0});case"style":return e.inlineCss,i.jsx("style",{...t,dangerouslySetInnerHTML:{__html:r},nonce:n});case"script":return i.jsx(Kt,{attrs:t,children:r});default:return null}}function Kt({attrs:e,children:t}){S();const r=le(),n=typeof e?.type=="string"&&e.type!==""&&e.type!=="text/javascript"&&e.type!=="module";if(c.useEffect(()=>{if(!n){if(e?.src){const a=(()=>{try{const s=document.baseURI||window.location.href;return new URL(e.src,s).href}catch{return e.src}})();if(Array.from(document.querySelectorAll("script[src]")).find(s=>s.src===a))return;const o=document.createElement("script");for(const[s,u]of Object.entries(e))s!=="suppressHydrationWarning"&&u!==void 0&&u!==!1&&o.setAttribute(s,typeof u=="boolean"?"":String(u));return document.head.appendChild(o),()=>{o.parentNode&&o.parentNode.removeChild(o)}}if(typeof t=="string"){const a=typeof e?.type=="string"?e.type:"text/javascript",o=typeof e?.nonce=="string"?e.nonce:void 0;if(Array.from(document.querySelectorAll("script:not([src])")).find(u=>{if(!(u instanceof HTMLScriptElement))return!1;const h=u.getAttribute("type")??"text/javascript",l=u.getAttribute("nonce")??void 0;return u.textContent===t&&h===a&&l===o}))return;const s=document.createElement("script");if(s.textContent=t,e)for(const[u,h]of Object.entries(e))u!=="suppressHydrationWarning"&&h!==void 0&&h!==!1&&s.setAttribute(u,typeof h=="boolean"?"":String(h));return document.head.appendChild(s),()=>{s.parentNode&&s.parentNode.removeChild(s)}}}},[e,t,n]),n&&typeof t=="string")return i.jsx("script",{...e,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:t}});if(!r){if(e?.src)return i.jsx("script",{...e,suppressHydrationWarning:!0});if(typeof t=="string")return i.jsx("script",{...e,dangerouslySetInnerHTML:{__html:t},suppressHydrationWarning:!0})}return null}var Ut=e=>{const t=S(),r=t.options.ssr?.nonce,n=g(t.stores.matches,l=>l.map(d=>d.meta).filter(Boolean),b),a=c.useMemo(()=>{const l=[],d={};let f;for(let y=n.length-1;y>=0;y--){const p=n[y];for(let v=p.length-1;v>=0;v--){const I=p[v];if(I)if(I.title)f||(f={tag:"title",children:I.title});else if("script:ld+json"in I)try{const P=JSON.stringify(I["script:ld+json"]);l.push({tag:"script",attrs:{type:"application/ld+json"},children:st(P)})}catch{}else{const P=I.name??I.property;if(P){if(d[P])continue;d[P]=!0}l.push({tag:"meta",attrs:{...I,nonce:r}})}}}return f&&l.push(f),r&&l.push({tag:"meta",attrs:{property:"csp-nonce",content:r}}),l.reverse(),l},[n,r]),o=g(t.stores.matches,l=>{const d=l.map(p=>p.links).filter(Boolean).flat(1).map(p=>({tag:"link",attrs:{...p,nonce:r}})),f=t.ssr?.manifest,y=l.map(p=>f?.routes[p.routeId]?.assets??[]).filter(Boolean).flat(1).flatMap(p=>p.tag==="link"?at(f,p)?[]:[{tag:"link",attrs:{...p.attrs,crossOrigin:be(e,"stylesheet")??p.attrs?.crossOrigin,suppressHydrationWarning:!0,nonce:r}}]:p.tag==="style"?[{tag:"style",attrs:{...p.attrs,nonce:r},children:p.children,...p.inlineCss?{inlineCss:!0}:{}}]:[]);return[...d,...y]},b),s=g(t.stores.matches,l=>{const d=[];return l.map(f=>t.looseRoutesById[f.routeId]).forEach(f=>t.ssr?.manifest?.routes[f.id]?.preloads?.filter(Boolean).forEach(y=>{const p=it(y);d.push({tag:"link",attrs:{rel:"modulepreload",href:p.href,crossOrigin:be(e,"modulepreload")??p.crossOrigin,nonce:r}})})),d},b),u=g(t.stores.matches,l=>l.map(d=>d.styles).flat(1).filter(Boolean).map(({children:d,...f})=>({tag:"style",attrs:{...f,nonce:r},children:d})),b),h=g(t.stores.matches,l=>l.map(d=>d.headScripts).flat(1).filter(Boolean).map(({children:d,...f})=>({tag:"script",attrs:{...f,nonce:r},children:d})),b);return qt([...a,...s,...o,...u,...h],l=>JSON.stringify(l))};function qt(e,t){const r=new Set;return e.filter(n=>{const a=t(n);return r.has(a)?!1:(r.add(a),!0)})}function ur(e){const t=Ut(e.assetCrossOrigin),r=S().options.ssr?.nonce;return i.jsx(i.Fragment,{children:t.map(n=>c.createElement(He,{...n,key:`tsr-meta-${JSON.stringify(n)}`,nonce:r}))})}var lr=()=>{const e=S(),t=e.options.ssr?.nonce,r=o=>{const s=[],u=e.ssr?.manifest;return u?(o.map(h=>e.looseRoutesById[h.routeId]).forEach(h=>u.routes[h.id]?.assets?.filter(l=>l.tag==="script").forEach(l=>{s.push({tag:"script",attrs:{...l.attrs,nonce:t},children:l.children})})),s):[]},n=o=>o.map(s=>s.scripts).flat(1).filter(Boolean).map(({children:s,...u})=>({tag:"script",attrs:{...u,suppressHydrationWarning:!0,nonce:t},children:s})),a=g(e.stores.matches,r,b);return zt(e,g(e.stores.matches,n,b),a)};function zt(e,t,r){let n;e.serverSsr&&(n=e.serverSsr.takeBufferedScripts());const a=[...t,...r];return n&&a.unshift(n),i.jsx(i.Fragment,{children:a.map((o,s)=>c.createElement(He,{...o,key:`tsr-scripts-${o.tag}-${s}`}))})}export{rr as A,ur as H,Fe as L,ir as R,lr as S,nr as a,ar as b,or as c,Ae as d,sr as l,cr as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{am as e}from"./index-
|
|
1
|
+
import{am as e}from"./index-CGq67I5U.js";import"./base-ui-DKZpRETY.js";import"./router-Cdi9aGOg.js";function n(){return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Settings"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"Configure profiles, models, and preferences."})]})}export{n as component};
|
package/dist/{server/public/assets/js/skills-C8G72gXr.js → public/assets/js/skills-COr12qk7.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aw as j,am as e,D as m,aF as ae,ar as l,S as R,b as z,I as q,j as C,p as B,i as le,t as E,q as re,v as ie,g as K,f as O,n as ne}from"./index-BDLsrzTe.js";import{S as oe,n as ce}from"./base-ui-Ls-HE_Zl.js";import{M as H}from"./MarkdownMessage-Dd6VsKhk.js";import"./router-B8BATVn7.js";async function de(){return j("/api/hermes/skills")}async function F(n){return(await j(`/api/hermes/skills/${n}`)).content}async function J(n,c){return(await j(`/api/hermes/skills/${n}/${c}/files`)).files}async function ue(n,c){await j("/api/hermes/skills/toggle",{method:"PUT",body:JSON.stringify({name:n,enabled:c})})}function me({className:n,size:c="default",...o}){return e.jsx(oe,{"data-slot":"switch","data-size":c,className:m("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",n),...o,children:e.jsx(ce,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function U({source:n}){const c=n==="builtin"?"bg-muted-foreground":n==="hub"?"bg-blue-400":"bg-emerald-400";return e.jsx("span",{className:m("size-2 rounded-full shrink-0",c)})}function ge(){const{state:n}=ae(),c=n==="collapsed",[o,L]=l.useState(null),[v,x]=l.useState(!0),[d,V]=l.useState(""),[u,W]=l.useState("all"),[I,G]=l.useState(new Set),[k,Q]=l.useState(!0),[r,b]=l.useState(null),[X,h]=l.useState(""),[$,N]=l.useState([]),[P,f]=l.useState(!1),[A,y]=l.useState(null),[Y,p]=l.useState(""),[,D]=l.useState(!1),w=l.useCallback(async()=>{try{const s=await de();L(s)}catch(s){console.error("Failed to load skills:",s)}},[]);l.useEffect(()=>{x(!0),w().finally(()=>x(!1))},[w]),l.useEffect(()=>{if(!r){h(""),N([]),y(null),p("");return}f(!0);const s=`${r.category}/${r.skill}/SKILL.md`;Promise.all([F(s),J(r.category,r.skill)]).then(([t,a])=>{h(t),N(a.filter(i=>!i.isDir))}).catch(t=>{h(`Failed to load skill: ${t.message}`)}).finally(()=>f(!1))},[r]);const M=l.useMemo(()=>{if(!o)return[];let s=o.categories;if(u!=="all"&&(s=s.map(t=>({...t,skills:t.skills.filter(a=>(a.source||"local")===u)})).filter(t=>t.skills.length>0)),d.trim()){const t=d.toLowerCase();s=s.map(a=>({...a,skills:a.skills.filter(i=>i.name.toLowerCase().includes(t)||i.description.toLowerCase().includes(t))})).filter(a=>a.skills.length>0||a.name.toLowerCase().includes(t))}return s},[o,u,d]),T=l.useMemo(()=>{if(!o)return[];let s=o.archived;if(u!=="all"&&(s=s.filter(t=>(t.source||"local")===u)),d.trim()){const t=d.toLowerCase();s=s.filter(a=>a.name.toLowerCase().includes(t)||a.description.toLowerCase().includes(t))}return s},[o,u,d]),Z=s=>{G(t=>{const a=new Set(t);return a.has(s)?a.delete(s):a.add(s),a})},_=async(s,t,a)=>{try{await ue(t,a),L(i=>i&&{...i,categories:i.categories.map(g=>g.name===s?{...g,skills:g.skills.map(S=>S.name===t?{...S,enabled:a}:S)}:g)})}catch(i){console.error("Toggle failed:",i)}},ee=async s=>{if(r){D(!0),y(s);try{const t=`${r.category}/${r.skill}/`,a=await F(`${t}${s}`);p(a)}catch(t){p(`Failed to load file: ${t.message}`)}finally{D(!1)}}},se=()=>{y(null),p("")},te=[{label:"All",value:"all"},{label:"Builtin",value:"builtin"},{label:"Hub",value:"hub"},{label:"Local",value:"local"}];return r?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("header",{className:"flex items-center justify-between border-b px-4 py-3 shrink-0 relative",children:[e.jsxs("div",{className:"flex items-center gap-2 z-10",children:[c&&e.jsx(R,{className:m("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsxs(z,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>b(null),children:[e.jsx(q,{className:"size-3.5 mr-1"}),"Back"]})]}),e.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 flex items-center gap-2 max-w-[50%]",children:[e.jsx("span",{className:"text-muted-foreground text-sm truncate",children:r.category}),e.jsx("span",{className:"text-muted-foreground shrink-0",children:"/"}),e.jsx("span",{className:"text-sm font-medium truncate",children:r.skill})]}),e.jsx("div",{className:"z-10",children:e.jsxs(z,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{f(!0);const s=`${r.category}/${r.skill}/SKILL.md`;Promise.all([F(s),J(r.category,r.skill)]).then(([t,a])=>{h(t),N(a.filter(i=>!i.isDir))}).finally(()=>f(!1))},disabled:P,children:[P?e.jsx(C,{className:"size-3 animate-spin"}):e.jsx(B,{className:"size-3"}),"Refresh"]})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:e.jsx("div",{className:"max-w-3xl mx-auto flex flex-col gap-4",children:A?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:se,className:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline w-fit",children:[e.jsx(q,{className:"size-3"}),"Back to ",r.skill]}),e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:A}),e.jsx(H,{content:Y})]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{content:X}),$.length>0&&e.jsxs("div",{className:"border-t pt-4 mt-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Attached Files"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:$.map(s=>e.jsxs("button",{onClick:()=>ee(s.path),className:"inline-flex items-center gap-1.5 rounded-md border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[e.jsx(le,{className:"size-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate max-w-[180px]",children:s.path})]},s.path))})]})]})})})]}):e.jsxs("div",{className:"flex h-full",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col h-full shrink-0",children:[e.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-3 shrink-0",children:[c&&e.jsx(R,{className:m("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsx(E,{className:"size-5 text-muted-foreground"}),e.jsx("h2",{className:"text-sm font-medium",children:"Skills"}),e.jsx(z,{variant:"ghost",size:"sm",className:"ml-auto h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{x(!0),w().finally(()=>x(!1))},disabled:v,children:v?e.jsx(C,{className:"size-3 animate-spin"}):e.jsx(B,{className:"size-3"})})]}),e.jsxs("div",{className:"px-3 py-2 border-b flex flex-col gap-2 shrink-0",children:[e.jsxs("div",{className:"relative",children:[e.jsx(re,{className:"absolute left-2 top-1/2 -translate-y-1/2 size-3.5 text-muted-foreground"}),e.jsx(ie,{value:d,onChange:s=>V(s.target.value),placeholder:"Search skills...",className:"h-8 pl-7 text-xs"})]}),e.jsx("div",{className:"flex items-center gap-1",children:te.map(s=>e.jsx("button",{onClick:()=>W(s.value),className:m("px-2 py-0.5 text-[11px] rounded-sm transition-colors",u===s.value?"bg-primary text-primary-foreground font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:s.label},s.value))})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:v?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(C,{className:"size-4 animate-spin text-muted-foreground"})}):!o||M.length===0?e.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:d?"No skills match your search.":"No skills found."}):e.jsxs("div",{className:"flex flex-col gap-1",children:[M.map(s=>e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("button",{onClick:()=>Z(s.name),className:"flex items-center gap-1.5 px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider rounded-md hover:bg-muted/50 transition-colors",children:[I.has(s.name)?e.jsx(K,{className:"size-3 shrink-0"}):e.jsx(O,{className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:s.name}),e.jsx("span",{className:"ml-auto text-[10px] bg-muted px-1.5 py-0.5 rounded-full",children:s.skills.length})]}),!I.has(s.name)&&e.jsx("div",{className:"flex flex-col",children:s.skills.map(t=>e.jsxs("div",{className:"group flex items-center gap-2 px-2 py-1.5 pl-7 rounded-md hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>b({category:s.name,skill:t.name}),children:[e.jsx(U,{source:t.source}),e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs font-medium truncate",children:t.name}),t.modified&&e.jsx("span",{className:"text-[10px] text-amber-500",title:"Modified",children:"✎"}),t.pinned&&e.jsx(ne,{className:"size-3 text-amber-500 shrink-0"})]}),t.description&&e.jsx("span",{className:"text-[10px] text-muted-foreground truncate",children:t.description})]}),e.jsx(me,{checked:t.enabled!==!1,onCheckedChange:a=>_(s.name,t.name,a),className:"scale-75 shrink-0",onClick:a=>a.stopPropagation()})]},t.name))})]},s.name)),(T.length>0||(o?.archived.length??0)>0)&&e.jsxs("div",{className:"flex flex-col mt-2 pt-2 border-t",children:[e.jsxs("button",{onClick:()=>Q(!k),className:"flex items-center gap-1.5 px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider rounded-md hover:bg-muted/50 transition-colors",children:[k?e.jsx(K,{className:"size-3 shrink-0"}):e.jsx(O,{className:"size-3 shrink-0"}),e.jsx("span",{children:"Archived"}),e.jsx("span",{className:"ml-auto text-[10px] bg-muted px-1.5 py-0.5 rounded-full",children:o?.archived.length??0})]}),!k&&T.map(s=>e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 pl-7 rounded-md hover:bg-muted/50 cursor-pointer transition-colors opacity-60",onClick:()=>b({category:".archive",skill:s.name}),children:[e.jsx(U,{source:s.source}),e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsx("span",{className:"text-xs font-medium truncate",children:s.name}),s.description&&e.jsx("span",{className:"text-[10px] text-muted-foreground truncate",children:s.description})]})]},s.name))]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[e.jsx(E,{className:"size-12 opacity-20"}),e.jsx("p",{className:"text-sm",children:"Select a skill to view its details"})]})})]})}export{ge as component};
|
|
1
|
+
import{aw as j,am as e,D as m,aF as ae,ar as l,S as R,b as z,I as q,j as C,p as B,i as le,t as E,q as re,v as ie,g as K,f as O,n as ne}from"./index-CGq67I5U.js";import{S as oe,n as ce}from"./base-ui-DKZpRETY.js";import{M as H}from"./MarkdownMessage-Bu4diQAT.js";import"./router-Cdi9aGOg.js";async function de(){return j("/api/hermes/skills")}async function F(n){return(await j(`/api/hermes/skills/${n}`)).content}async function J(n,c){return(await j(`/api/hermes/skills/${n}/${c}/files`)).files}async function ue(n,c){await j("/api/hermes/skills/toggle",{method:"PUT",body:JSON.stringify({name:n,enabled:c})})}function me({className:n,size:c="default",...o}){return e.jsx(oe,{"data-slot":"switch","data-size":c,className:m("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",n),...o,children:e.jsx(ce,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function U({source:n}){const c=n==="builtin"?"bg-muted-foreground":n==="hub"?"bg-blue-400":"bg-emerald-400";return e.jsx("span",{className:m("size-2 rounded-full shrink-0",c)})}function ge(){const{state:n}=ae(),c=n==="collapsed",[o,L]=l.useState(null),[v,x]=l.useState(!0),[d,V]=l.useState(""),[u,W]=l.useState("all"),[I,G]=l.useState(new Set),[k,Q]=l.useState(!0),[r,b]=l.useState(null),[X,h]=l.useState(""),[$,N]=l.useState([]),[P,f]=l.useState(!1),[A,y]=l.useState(null),[Y,p]=l.useState(""),[,D]=l.useState(!1),w=l.useCallback(async()=>{try{const s=await de();L(s)}catch(s){console.error("Failed to load skills:",s)}},[]);l.useEffect(()=>{x(!0),w().finally(()=>x(!1))},[w]),l.useEffect(()=>{if(!r){h(""),N([]),y(null),p("");return}f(!0);const s=`${r.category}/${r.skill}/SKILL.md`;Promise.all([F(s),J(r.category,r.skill)]).then(([t,a])=>{h(t),N(a.filter(i=>!i.isDir))}).catch(t=>{h(`Failed to load skill: ${t.message}`)}).finally(()=>f(!1))},[r]);const M=l.useMemo(()=>{if(!o)return[];let s=o.categories;if(u!=="all"&&(s=s.map(t=>({...t,skills:t.skills.filter(a=>(a.source||"local")===u)})).filter(t=>t.skills.length>0)),d.trim()){const t=d.toLowerCase();s=s.map(a=>({...a,skills:a.skills.filter(i=>i.name.toLowerCase().includes(t)||i.description.toLowerCase().includes(t))})).filter(a=>a.skills.length>0||a.name.toLowerCase().includes(t))}return s},[o,u,d]),T=l.useMemo(()=>{if(!o)return[];let s=o.archived;if(u!=="all"&&(s=s.filter(t=>(t.source||"local")===u)),d.trim()){const t=d.toLowerCase();s=s.filter(a=>a.name.toLowerCase().includes(t)||a.description.toLowerCase().includes(t))}return s},[o,u,d]),Z=s=>{G(t=>{const a=new Set(t);return a.has(s)?a.delete(s):a.add(s),a})},_=async(s,t,a)=>{try{await ue(t,a),L(i=>i&&{...i,categories:i.categories.map(g=>g.name===s?{...g,skills:g.skills.map(S=>S.name===t?{...S,enabled:a}:S)}:g)})}catch(i){console.error("Toggle failed:",i)}},ee=async s=>{if(r){D(!0),y(s);try{const t=`${r.category}/${r.skill}/`,a=await F(`${t}${s}`);p(a)}catch(t){p(`Failed to load file: ${t.message}`)}finally{D(!1)}}},se=()=>{y(null),p("")},te=[{label:"All",value:"all"},{label:"Builtin",value:"builtin"},{label:"Hub",value:"hub"},{label:"Local",value:"local"}];return r?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("header",{className:"flex items-center justify-between border-b px-4 py-3 shrink-0 relative",children:[e.jsxs("div",{className:"flex items-center gap-2 z-10",children:[c&&e.jsx(R,{className:m("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsxs(z,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>b(null),children:[e.jsx(q,{className:"size-3.5 mr-1"}),"Back"]})]}),e.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 flex items-center gap-2 max-w-[50%]",children:[e.jsx("span",{className:"text-muted-foreground text-sm truncate",children:r.category}),e.jsx("span",{className:"text-muted-foreground shrink-0",children:"/"}),e.jsx("span",{className:"text-sm font-medium truncate",children:r.skill})]}),e.jsx("div",{className:"z-10",children:e.jsxs(z,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{f(!0);const s=`${r.category}/${r.skill}/SKILL.md`;Promise.all([F(s),J(r.category,r.skill)]).then(([t,a])=>{h(t),N(a.filter(i=>!i.isDir))}).finally(()=>f(!1))},disabled:P,children:[P?e.jsx(C,{className:"size-3 animate-spin"}):e.jsx(B,{className:"size-3"}),"Refresh"]})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:e.jsx("div",{className:"max-w-3xl mx-auto flex flex-col gap-4",children:A?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:se,className:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline w-fit",children:[e.jsx(q,{className:"size-3"}),"Back to ",r.skill]}),e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:A}),e.jsx(H,{content:Y})]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{content:X}),$.length>0&&e.jsxs("div",{className:"border-t pt-4 mt-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Attached Files"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:$.map(s=>e.jsxs("button",{onClick:()=>ee(s.path),className:"inline-flex items-center gap-1.5 rounded-md border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[e.jsx(le,{className:"size-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate max-w-[180px]",children:s.path})]},s.path))})]})]})})})]}):e.jsxs("div",{className:"flex h-full",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col h-full shrink-0",children:[e.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-3 shrink-0",children:[c&&e.jsx(R,{className:m("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsx(E,{className:"size-5 text-muted-foreground"}),e.jsx("h2",{className:"text-sm font-medium",children:"Skills"}),e.jsx(z,{variant:"ghost",size:"sm",className:"ml-auto h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{x(!0),w().finally(()=>x(!1))},disabled:v,children:v?e.jsx(C,{className:"size-3 animate-spin"}):e.jsx(B,{className:"size-3"})})]}),e.jsxs("div",{className:"px-3 py-2 border-b flex flex-col gap-2 shrink-0",children:[e.jsxs("div",{className:"relative",children:[e.jsx(re,{className:"absolute left-2 top-1/2 -translate-y-1/2 size-3.5 text-muted-foreground"}),e.jsx(ie,{value:d,onChange:s=>V(s.target.value),placeholder:"Search skills...",className:"h-8 pl-7 text-xs"})]}),e.jsx("div",{className:"flex items-center gap-1",children:te.map(s=>e.jsx("button",{onClick:()=>W(s.value),className:m("px-2 py-0.5 text-[11px] rounded-sm transition-colors",u===s.value?"bg-primary text-primary-foreground font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:s.label},s.value))})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:v?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(C,{className:"size-4 animate-spin text-muted-foreground"})}):!o||M.length===0?e.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:d?"No skills match your search.":"No skills found."}):e.jsxs("div",{className:"flex flex-col gap-1",children:[M.map(s=>e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("button",{onClick:()=>Z(s.name),className:"flex items-center gap-1.5 px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider rounded-md hover:bg-muted/50 transition-colors",children:[I.has(s.name)?e.jsx(K,{className:"size-3 shrink-0"}):e.jsx(O,{className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:s.name}),e.jsx("span",{className:"ml-auto text-[10px] bg-muted px-1.5 py-0.5 rounded-full",children:s.skills.length})]}),!I.has(s.name)&&e.jsx("div",{className:"flex flex-col",children:s.skills.map(t=>e.jsxs("div",{className:"group flex items-center gap-2 px-2 py-1.5 pl-7 rounded-md hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>b({category:s.name,skill:t.name}),children:[e.jsx(U,{source:t.source}),e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs font-medium truncate",children:t.name}),t.modified&&e.jsx("span",{className:"text-[10px] text-amber-500",title:"Modified",children:"✎"}),t.pinned&&e.jsx(ne,{className:"size-3 text-amber-500 shrink-0"})]}),t.description&&e.jsx("span",{className:"text-[10px] text-muted-foreground truncate",children:t.description})]}),e.jsx(me,{checked:t.enabled!==!1,onCheckedChange:a=>_(s.name,t.name,a),className:"scale-75 shrink-0",onClick:a=>a.stopPropagation()})]},t.name))})]},s.name)),(T.length>0||(o?.archived.length??0)>0)&&e.jsxs("div",{className:"flex flex-col mt-2 pt-2 border-t",children:[e.jsxs("button",{onClick:()=>Q(!k),className:"flex items-center gap-1.5 px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider rounded-md hover:bg-muted/50 transition-colors",children:[k?e.jsx(K,{className:"size-3 shrink-0"}):e.jsx(O,{className:"size-3 shrink-0"}),e.jsx("span",{children:"Archived"}),e.jsx("span",{className:"ml-auto text-[10px] bg-muted px-1.5 py-0.5 rounded-full",children:o?.archived.length??0})]}),!k&&T.map(s=>e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 pl-7 rounded-md hover:bg-muted/50 cursor-pointer transition-colors opacity-60",onClick:()=>b({category:".archive",skill:s.name}),children:[e.jsx(U,{source:s.source}),e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsx("span",{className:"text-xs font-medium truncate",children:s.name}),s.description&&e.jsx("span",{className:"text-[10px] text-muted-foreground truncate",children:s.description})]})]},s.name))]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[e.jsx(E,{className:"size-12 opacity-20"}),e.jsx("p",{className:"text-sm",children:"Select a skill to view its details"})]})})]})}export{ge as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aw as f,am as e,ar as o}from"./index-
|
|
1
|
+
import{aw as f,am as e,ar as o}from"./index-CGq67I5U.js";import"./base-ui-DKZpRETY.js";import"./router-Cdi9aGOg.js";async function g(t=30){const a=new URLSearchParams({days:String(t)});return f(`/api/hermes/usage/stats?${a}`)}const x=["#4fd1c5","#63b3ed","#f6ad55","#b794f4","#68d391","#fc8181","#f687b3","#90cdf4","#fbd38d","#9ae6b4"];function m(t){return(t||"").trim()||"unknown"}function j(t){const a=m(t);let n=0;for(let s=0;s<a.length;s++)n=(n<<5)-n+a.charCodeAt(s),n|=0;return x[Math.abs(n)%x.length]}function l(t){return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":String(t)}function u(t){return t===0?"$0.00":t<.01?"<$0.01":"$"+t.toFixed(2)}function c(t,a){return a<=0?0:t/a*100}function h(t,a){const n=t+a;return n===0?"--":(a/n*100).toFixed(1)+"%"}function b(t=30){const[a,n]=o.useState(null),[s,r]=o.useState(!1);return o.useEffect(()=>{r(!0),g(t).then(n).catch(console.error).finally(()=>r(!1))},[t]),{stats:a,loading:s}}function d({label:t,value:a,sub:n}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:t}),e.jsx("div",{className:"text-xl font-semibold",children:a}),n&&e.jsx("div",{className:"text-[11px] text-muted-foreground mt-1",children:n})]})}function N({stats:t}){const a=t.total_input_tokens+t.total_output_tokens,n=t.total_cache_read_tokens,s=a+n>0?(n/(t.total_input_tokens+n)*100).toFixed(1)+"%":"--",r=t.daily_usage.filter(p=>p.sessions>0).length,i=r>0?(t.total_sessions/r).toFixed(1):"0.0";return e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-5",children:[e.jsx(d,{label:"Total Tokens",value:l(a),sub:`${l(t.total_input_tokens)} input / ${l(t.total_output_tokens)} output`}),e.jsx(d,{label:"Total Sessions",value:String(t.total_sessions),sub:`${i} avg/day`}),e.jsx(d,{label:"Estimated Cost",value:u(t.total_cost??0)}),e.jsx(d,{label:"Cache Hit Rate",value:s,sub:n>0?`${l(n)} tokens`:void 0})]})}function k({stats:t}){const a=o.useMemo(()=>(t.daily_usage??[]).map(s=>{const r=s.input_tokens+s.output_tokens+s.cache_read_tokens;return{...s,visualTokens:r,inputPercent:c(s.input_tokens,r),outputPercent:c(s.output_tokens,r),cachePercent:c(s.cache_read_tokens,r)}}),[t]),n=o.useMemo(()=>Math.max(...a.map(s=>s.visualTokens),1),[a]);return a.length===0?null:e.jsxs("div",{className:"rounded-lg border bg-card p-4 mb-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-secondary-foreground mb-3",children:"Daily Trend"}),e.jsx("div",{className:"flex gap-0.5 mb-2",children:a.map(s=>e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col items-center relative group",children:[e.jsx("div",{className:"w-full h-36 bg-muted/40 rounded-t-sm flex items-end overflow-hidden",children:e.jsxs("div",{className:"w-full flex flex-col-reverse justify-start transition-all",style:{height:`${s.visualTokens/n*100}%`},children:[s.output_tokens>0&&e.jsx("div",{className:"w-full bg-emerald-500/80",style:{height:`${s.outputPercent}%`}}),s.input_tokens>0&&e.jsx("div",{className:"w-full bg-indigo-500/80",style:{height:`${s.inputPercent}%`}}),s.cache_read_tokens>0&&e.jsx("div",{className:"w-full bg-amber-400/80",style:{height:`${s.cachePercent}%`}})]})}),e.jsxs("div",{className:"hidden group-hover:block absolute bottom-[calc(100%+8px)] left-1/2 -translate-x-1/2 bg-popover text-popover-foreground text-[11px] whitespace-nowrap z-10 rounded-md border px-2 py-1.5 shadow-md",children:[e.jsx("div",{className:"font-semibold mb-0.5",children:s.date}),e.jsxs("div",{children:["Input: ",l(s.input_tokens)]}),e.jsxs("div",{children:["Output: ",l(s.output_tokens)]}),e.jsxs("div",{children:["Cache read: ",l(s.cache_read_tokens)]}),e.jsxs("div",{children:["Cache write: ",l(s.cache_write_tokens)]}),e.jsxs("div",{children:["Hit rate: ",h(s.input_tokens,s.cache_read_tokens)]}),e.jsxs("div",{children:["Sessions: ",s.sessions]}),e.jsxs("div",{children:["Cost: ",u(s.cost??0)]})]})]},s.date))}),e.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mb-3",children:[e.jsx("span",{children:a[0]?.date.slice(5)}),e.jsx("span",{children:a[a.length-1]?.date.slice(5)})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground mb-4",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm bg-indigo-500/80"})," Input"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm bg-emerald-500/80"})," Output"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm bg-amber-400/80"})," Cache read"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-[11px] border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-muted-foreground text-left",children:[e.jsx("th",{className:"pb-1.5 pr-2 font-medium",children:"Date"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Input"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Output"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Cache read"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Cache write"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Hit rate"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Sessions"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Cost"})]})}),e.jsx("tbody",{children:[...a].reverse().map(s=>e.jsxs("tr",{className:"border-t",children:[e.jsx("td",{className:"py-1.5 pr-2",children:s.date}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:l(s.input_tokens)}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:l(s.output_tokens)}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:l(s.cache_read_tokens)}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:l(s.cache_write_tokens)}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:h(s.input_tokens,s.cache_read_tokens)}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:s.sessions}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:u(s.cost??0)})]},s.date))})]})})]})}function v({stats:t}){const a=o.useMemo(()=>(t.model_usage??[]).map(s=>{const r=s.input_tokens+s.output_tokens,i=r+s.cache_read_tokens;return{model:m(s.model),inputTokens:s.input_tokens,outputTokens:s.output_tokens,cacheTokens:s.cache_read_tokens,cacheWriteTokens:s.cache_write_tokens,totalTokens:r,visualTokens:i,sessions:s.sessions,color:j(s.model),inputPercent:c(s.input_tokens,i),outputPercent:c(s.output_tokens,i),cachePercent:c(s.cache_read_tokens,i)}}).sort((s,r)=>r.visualTokens-s.visualTokens),[t]),n=o.useMemo(()=>Math.max(...a.map(s=>s.visualTokens),1),[a]);return a.length===0?null:e.jsxs("div",{className:"rounded-lg border bg-card p-4 mb-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-secondary-foreground mb-3",children:"Model Breakdown"}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground mb-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm bg-indigo-500/80"})," Input"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm bg-emerald-500/80"})," Output"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm bg-amber-400/80"})," Cache read"]})]}),e.jsx("div",{className:"flex flex-col gap-2",children:a.map(s=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:s.color}}),e.jsx("span",{className:"text-xs font-mono text-secondary-foreground w-32 shrink-0 truncate",title:s.model,children:s.model}),e.jsx("div",{className:"flex-1 h-4 bg-muted/40 rounded-sm overflow-hidden",children:e.jsxs("div",{className:"h-full flex min-w-[2px] transition-all",style:{width:`${s.visualTokens/n*100}%`},children:[s.inputTokens>0&&e.jsx("div",{className:"h-full bg-indigo-500/80",style:{width:`${s.inputPercent}%`}}),s.outputTokens>0&&e.jsx("div",{className:"h-full bg-emerald-500/80",style:{width:`${s.outputPercent}%`}}),s.cacheTokens>0&&e.jsx("div",{className:"h-full bg-amber-400/80",style:{width:`${s.cachePercent}%`}})]})}),e.jsxs("span",{className:"text-xs text-muted-foreground w-20 text-right shrink-0",children:[l(s.totalTokens),s.cacheTokens>0&&e.jsxs("span",{className:"text-[10px] text-amber-500 ml-1",children:["+",l(s.cacheTokens)]})]})]},s.model))})]})}function T(){const{stats:t,loading:a}=b(30);return e.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-6",children:e.jsxs("div",{className:"mx-auto max-w-5xl",children:[e.jsxs("header",{className:"mb-5",children:[e.jsx("h1",{className:"text-lg font-semibold",children:"Usage"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Token consumption and cost estimates over the last 30 days."})]}),a&&e.jsx("div",{className:"text-sm text-muted-foreground py-8",children:"Loading usage stats…"}),!a&&!t&&e.jsx("div",{className:"text-sm text-muted-foreground py-8",children:"Failed to load usage data."}),!a&&t&&t.total_sessions===0&&e.jsx("div",{className:"text-sm text-muted-foreground py-8",children:"No usage data yet."}),!a&&t&&t.total_sessions>0&&e.jsxs(e.Fragment,{children:[e.jsx(N,{stats:t}),e.jsx(v,{stats:t}),e.jsx(k,{stats:t})]})]})})}export{T as component};
|
package/dist/server/_libs/h3.mjs
CHANGED
|
@@ -398,11 +398,128 @@ var H3Core = class {
|
|
|
398
398
|
return routeMiddleware ? [...globalMiddleware, ...routeMiddleware] : globalMiddleware;
|
|
399
399
|
}
|
|
400
400
|
};
|
|
401
|
+
const PayloadMethods = /* @__PURE__ */ new Set([
|
|
402
|
+
"PATCH",
|
|
403
|
+
"POST",
|
|
404
|
+
"PUT",
|
|
405
|
+
"DELETE"
|
|
406
|
+
]);
|
|
407
|
+
const ignoredHeaders = /* @__PURE__ */ new Set([
|
|
408
|
+
"transfer-encoding",
|
|
409
|
+
"connection",
|
|
410
|
+
"keep-alive",
|
|
411
|
+
"upgrade",
|
|
412
|
+
"expect",
|
|
413
|
+
"host",
|
|
414
|
+
"accept"
|
|
415
|
+
]);
|
|
416
|
+
function rewriteCookieProperty(header, map, property) {
|
|
417
|
+
const _map = typeof map === "string" ? { "*": map } : map;
|
|
418
|
+
return header.replace(new RegExp(`(;\\s*${property}=)([^;]+)`, "gi"), (match, prefix, previousValue) => {
|
|
419
|
+
let newValue;
|
|
420
|
+
if (previousValue in _map) newValue = _map[previousValue];
|
|
421
|
+
else if ("*" in _map) newValue = _map["*"];
|
|
422
|
+
else return match;
|
|
423
|
+
return newValue ? prefix + newValue : "";
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
function mergeHeaders(defaults, ...inputs) {
|
|
427
|
+
const _inputs = inputs.filter(Boolean);
|
|
428
|
+
if (_inputs.length === 0) return defaults;
|
|
429
|
+
const merged = new Headers(defaults);
|
|
430
|
+
for (const input of _inputs) {
|
|
431
|
+
const entries = Array.isArray(input) ? input : typeof input.entries === "function" ? input.entries() : Object.entries(input);
|
|
432
|
+
for (const [key, value] of entries) if (value !== void 0) merged.set(key, value);
|
|
433
|
+
}
|
|
434
|
+
return merged;
|
|
435
|
+
}
|
|
436
|
+
async function proxyRequest(event, target, opts = {}) {
|
|
437
|
+
const requestBody = PayloadMethods.has(event.req.method) ? event.req.body : void 0;
|
|
438
|
+
const method = opts.fetchOptions?.method || event.req.method;
|
|
439
|
+
const fetchHeaders = mergeHeaders(getProxyRequestHeaders(event, {
|
|
440
|
+
host: target.startsWith("/"),
|
|
441
|
+
forwardHeaders: opts.forwardHeaders,
|
|
442
|
+
filterHeaders: opts.filterHeaders
|
|
443
|
+
}), opts.fetchOptions?.headers, opts.headers);
|
|
444
|
+
return proxy(event, target, {
|
|
445
|
+
...opts,
|
|
446
|
+
fetchOptions: {
|
|
447
|
+
method,
|
|
448
|
+
body: requestBody,
|
|
449
|
+
duplex: requestBody ? "half" : void 0,
|
|
450
|
+
...opts.fetchOptions,
|
|
451
|
+
headers: fetchHeaders
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
async function proxy(event, target, opts = {}) {
|
|
456
|
+
const fetchOptions = {
|
|
457
|
+
headers: opts.headers,
|
|
458
|
+
...opts.fetchOptions
|
|
459
|
+
};
|
|
460
|
+
let response;
|
|
461
|
+
try {
|
|
462
|
+
response = target[0] === "/" ? await event.app.fetch(createSubRequest(event, target, fetchOptions)) : await fetch(target, fetchOptions);
|
|
463
|
+
} catch (error) {
|
|
464
|
+
throw new HTTPError({
|
|
465
|
+
status: 502,
|
|
466
|
+
cause: error
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
const headers = new Headers();
|
|
470
|
+
const cookies = [];
|
|
471
|
+
for (const [key, value] of response.headers.entries()) {
|
|
472
|
+
if (key === "content-encoding" || key === "content-length" || key === "transfer-encoding") continue;
|
|
473
|
+
if (key === "set-cookie") {
|
|
474
|
+
cookies.push(value);
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
headers.append(key, value);
|
|
478
|
+
}
|
|
479
|
+
if (cookies.length > 0) {
|
|
480
|
+
const _cookies = cookies.map((cookie) => {
|
|
481
|
+
if (opts.cookieDomainRewrite) cookie = rewriteCookieProperty(cookie, opts.cookieDomainRewrite, "domain");
|
|
482
|
+
if (opts.cookiePathRewrite) cookie = rewriteCookieProperty(cookie, opts.cookiePathRewrite, "path");
|
|
483
|
+
return cookie;
|
|
484
|
+
});
|
|
485
|
+
for (const cookie of _cookies) headers.append("set-cookie", cookie);
|
|
486
|
+
}
|
|
487
|
+
if (opts.onResponse) await opts.onResponse(event, response);
|
|
488
|
+
return new HTTPResponse(response.body, {
|
|
489
|
+
status: response.status,
|
|
490
|
+
statusText: response.statusText,
|
|
491
|
+
headers
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
function getProxyRequestHeaders(event, opts) {
|
|
495
|
+
const headers = new NullProtoObj();
|
|
496
|
+
for (const [name, value] of event.req.headers.entries()) {
|
|
497
|
+
if (opts?.filterHeaders?.includes(name)) continue;
|
|
498
|
+
if (opts?.forwardHeaders?.includes(name)) {
|
|
499
|
+
headers[name] = value;
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
if (!ignoredHeaders.has(name) || name === "host" && opts?.host) {
|
|
503
|
+
headers[name] = value;
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return headers;
|
|
508
|
+
}
|
|
509
|
+
function createSubRequest(event, path, init) {
|
|
510
|
+
const url = new URL(path, event.url);
|
|
511
|
+
const req = new Request(url, init);
|
|
512
|
+
req.runtime = event.req.runtime;
|
|
513
|
+
req.waitUntil = event.req.waitUntil;
|
|
514
|
+
req.ip = event.req.ip;
|
|
515
|
+
return req;
|
|
516
|
+
}
|
|
401
517
|
export {
|
|
402
518
|
H3Core as H,
|
|
403
519
|
HTTPError as a,
|
|
404
520
|
defineLazyEventHandler as b,
|
|
405
521
|
toRequest as c,
|
|
406
522
|
defineHandler as d,
|
|
523
|
+
proxyRequest as p,
|
|
407
524
|
toEventHandler as t
|
|
408
525
|
};
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
+
const HASH_RE = /#/g;
|
|
2
|
+
const AMPERSAND_RE = /&/g;
|
|
3
|
+
const SLASH_RE = /\//g;
|
|
4
|
+
const EQUAL_RE = /=/g;
|
|
5
|
+
const PLUS_RE = /\+/g;
|
|
6
|
+
const ENC_CARET_RE = /%5e/gi;
|
|
7
|
+
const ENC_BACKTICK_RE = /%60/gi;
|
|
8
|
+
const ENC_PIPE_RE = /%7c/gi;
|
|
9
|
+
const ENC_SPACE_RE = /%20/gi;
|
|
1
10
|
const ENC_SLASH_RE = /%2f/gi;
|
|
11
|
+
function encode(text) {
|
|
12
|
+
return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
|
|
13
|
+
}
|
|
14
|
+
function encodeQueryValue(input) {
|
|
15
|
+
return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
|
|
16
|
+
}
|
|
17
|
+
function encodeQueryKey(text) {
|
|
18
|
+
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
|
19
|
+
}
|
|
2
20
|
function decode(text = "") {
|
|
3
21
|
try {
|
|
4
22
|
return decodeURIComponent("" + text);
|
|
@@ -9,7 +27,67 @@ function decode(text = "") {
|
|
|
9
27
|
function decodePath(text) {
|
|
10
28
|
return decode(text.replace(ENC_SLASH_RE, "%252F"));
|
|
11
29
|
}
|
|
30
|
+
function decodeQueryKey(text) {
|
|
31
|
+
return decode(text.replace(PLUS_RE, " "));
|
|
32
|
+
}
|
|
33
|
+
function decodeQueryValue(text) {
|
|
34
|
+
return decode(text.replace(PLUS_RE, " "));
|
|
35
|
+
}
|
|
36
|
+
function parseQuery(parametersString = "") {
|
|
37
|
+
const object = /* @__PURE__ */ Object.create(null);
|
|
38
|
+
if (parametersString[0] === "?") {
|
|
39
|
+
parametersString = parametersString.slice(1);
|
|
40
|
+
}
|
|
41
|
+
for (const parameter of parametersString.split("&")) {
|
|
42
|
+
const s = parameter.match(/([^=]+)=?(.*)/) || [];
|
|
43
|
+
if (s.length < 2) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const key = decodeQueryKey(s[1]);
|
|
47
|
+
if (key === "__proto__" || key === "constructor") {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const value = decodeQueryValue(s[2] || "");
|
|
51
|
+
if (object[key] === void 0) {
|
|
52
|
+
object[key] = value;
|
|
53
|
+
} else if (Array.isArray(object[key])) {
|
|
54
|
+
object[key].push(value);
|
|
55
|
+
} else {
|
|
56
|
+
object[key] = [object[key], value];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return object;
|
|
60
|
+
}
|
|
61
|
+
function encodeQueryItem(key, value) {
|
|
62
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
63
|
+
value = String(value);
|
|
64
|
+
}
|
|
65
|
+
if (!value) {
|
|
66
|
+
return encodeQueryKey(key);
|
|
67
|
+
}
|
|
68
|
+
if (Array.isArray(value)) {
|
|
69
|
+
return value.map(
|
|
70
|
+
(_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`
|
|
71
|
+
).join("&");
|
|
72
|
+
}
|
|
73
|
+
return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
|
|
74
|
+
}
|
|
75
|
+
function stringifyQuery(query) {
|
|
76
|
+
return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
|
|
77
|
+
}
|
|
78
|
+
const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
|
|
79
|
+
const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
|
|
80
|
+
const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
|
|
12
81
|
const JOIN_LEADING_SLASH_RE = /^\.?\//;
|
|
82
|
+
function hasProtocol(inputString, opts = {}) {
|
|
83
|
+
if (typeof opts === "boolean") {
|
|
84
|
+
opts = { acceptRelative: opts };
|
|
85
|
+
}
|
|
86
|
+
if (opts.strict) {
|
|
87
|
+
return PROTOCOL_STRICT_REGEX.test(inputString);
|
|
88
|
+
}
|
|
89
|
+
return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
|
|
90
|
+
}
|
|
13
91
|
function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
|
14
92
|
{
|
|
15
93
|
return input.endsWith("/");
|
|
@@ -31,6 +109,30 @@ function hasLeadingSlash(input = "") {
|
|
|
31
109
|
function withLeadingSlash(input = "") {
|
|
32
110
|
return hasLeadingSlash(input) ? input : "/" + input;
|
|
33
111
|
}
|
|
112
|
+
function withoutBase(input, base) {
|
|
113
|
+
if (isEmptyURL(base)) {
|
|
114
|
+
return input;
|
|
115
|
+
}
|
|
116
|
+
const _base = withoutTrailingSlash(base);
|
|
117
|
+
if (!input.startsWith(_base)) {
|
|
118
|
+
return input;
|
|
119
|
+
}
|
|
120
|
+
const nextChar = input[_base.length];
|
|
121
|
+
if (nextChar && nextChar !== "/" && nextChar !== "?") {
|
|
122
|
+
return input;
|
|
123
|
+
}
|
|
124
|
+
const trimmed = input.slice(_base.length).replace(/^\/+/, "");
|
|
125
|
+
return "/" + trimmed;
|
|
126
|
+
}
|
|
127
|
+
function withQuery(input, query) {
|
|
128
|
+
const parsed = parseURL(input);
|
|
129
|
+
const mergedQuery = { ...parseQuery(parsed.search), ...query };
|
|
130
|
+
parsed.search = stringifyQuery(mergedQuery);
|
|
131
|
+
return stringifyParsedURL(parsed);
|
|
132
|
+
}
|
|
133
|
+
function isEmptyURL(url) {
|
|
134
|
+
return !url || url === "/";
|
|
135
|
+
}
|
|
34
136
|
function isNonEmptyURL(url) {
|
|
35
137
|
return url && url !== "/";
|
|
36
138
|
}
|
|
@@ -46,8 +148,63 @@ function joinURL(base, ...input) {
|
|
|
46
148
|
}
|
|
47
149
|
return url;
|
|
48
150
|
}
|
|
151
|
+
const protocolRelative = /* @__PURE__ */ Symbol.for("ufo:protocolRelative");
|
|
152
|
+
function parseURL(input = "", defaultProto) {
|
|
153
|
+
const _specialProtoMatch = input.match(
|
|
154
|
+
/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i
|
|
155
|
+
);
|
|
156
|
+
if (_specialProtoMatch) {
|
|
157
|
+
const [, _proto, _pathname = ""] = _specialProtoMatch;
|
|
158
|
+
return {
|
|
159
|
+
protocol: _proto.toLowerCase(),
|
|
160
|
+
pathname: _pathname,
|
|
161
|
+
href: _proto + _pathname,
|
|
162
|
+
auth: "",
|
|
163
|
+
host: "",
|
|
164
|
+
search: "",
|
|
165
|
+
hash: ""
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
if (!hasProtocol(input, { acceptRelative: true })) {
|
|
169
|
+
return parsePath(input);
|
|
170
|
+
}
|
|
171
|
+
const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
|
|
172
|
+
let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
|
|
173
|
+
if (protocol === "file:") {
|
|
174
|
+
path = path.replace(/\/(?=[A-Za-z]:)/, "");
|
|
175
|
+
}
|
|
176
|
+
const { pathname, search, hash } = parsePath(path);
|
|
177
|
+
return {
|
|
178
|
+
protocol: protocol.toLowerCase(),
|
|
179
|
+
auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
|
|
180
|
+
host,
|
|
181
|
+
pathname,
|
|
182
|
+
search,
|
|
183
|
+
hash,
|
|
184
|
+
[protocolRelative]: !protocol
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function parsePath(input = "") {
|
|
188
|
+
const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
|
|
189
|
+
return {
|
|
190
|
+
pathname,
|
|
191
|
+
search,
|
|
192
|
+
hash
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function stringifyParsedURL(parsed) {
|
|
196
|
+
const pathname = parsed.pathname || "";
|
|
197
|
+
const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
|
|
198
|
+
const hash = parsed.hash || "";
|
|
199
|
+
const auth = parsed.auth ? parsed.auth + "@" : "";
|
|
200
|
+
const host = parsed.host || "";
|
|
201
|
+
const proto = parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "";
|
|
202
|
+
return proto + auth + host + pathname + search + hash;
|
|
203
|
+
}
|
|
49
204
|
export {
|
|
50
|
-
|
|
205
|
+
withQuery as a,
|
|
206
|
+
withoutBase as b,
|
|
207
|
+
withoutTrailingSlash as c,
|
|
51
208
|
decodePath as d,
|
|
52
209
|
joinURL as j,
|
|
53
210
|
withLeadingSlash as w
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
-
import { u as useChatStore, B as Button, c as cn } from "./router-
|
|
2
|
+
import { u as useChatStore, B as Button, c as cn } from "./router-C0m-TE_e.mjs";
|
|
3
3
|
import { k as IconFile, C as IconX, o as IconPaperclip, q as IconPhotoScan, t as IconPlayerStop, a as IconArrowUp } from "../_libs/tabler__icons-react.mjs";
|
|
4
4
|
function Textarea({ className, ...props }) {
|
|
5
5
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
-
import "./index-
|
|
2
|
+
import "./index-Be17Jodh.mjs";
|
|
3
3
|
import { M as Markdown } from "../_libs/react-markdown.mjs";
|
|
4
4
|
import { r as rehypeHighlight } from "../_libs/rehype-highlight.mjs";
|
|
5
5
|
import { r as remarkGfm } from "../_libs/remark-gfm.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
-
import { R as Route, u as useChatStore, d as useSidebar, S as SidebarTrigger, c as cn } from "./router-
|
|
3
|
-
import { M as MarkdownMessage } from "./MarkdownMessage-
|
|
4
|
-
import { C as ChatInputBlock } from "./ChatInputBlock-
|
|
5
|
-
import "./index-
|
|
2
|
+
import { R as Route, u as useChatStore, d as useSidebar, S as SidebarTrigger, c as cn } from "./router-C0m-TE_e.mjs";
|
|
3
|
+
import { M as MarkdownMessage } from "./MarkdownMessage-DzImLKnw.mjs";
|
|
4
|
+
import { C as ChatInputBlock } from "./ChatInputBlock-BTSt3ldw.mjs";
|
|
5
|
+
import "./index-Be17Jodh.mjs";
|
|
6
6
|
import { k as IconFile, f as IconChevronRight, m as IconLoader2, d as IconCheck, i as IconCopy } from "../_libs/tabler__icons-react.mjs";
|
|
7
7
|
import "../_libs/tanstack__react-router.mjs";
|
|
8
8
|
import "../_libs/tanstack__router-core.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
2
|
import { d as useNavigate } from "../_libs/tanstack__react-router.mjs";
|
|
3
|
-
import { u as useChatStore, a as createSession } from "./router-
|
|
3
|
+
import { u as useChatStore, a as createSession } from "./router-C0m-TE_e.mjs";
|
|
4
4
|
import "../_libs/tanstack__router-core.mjs";
|
|
5
5
|
import "../_libs/tanstack__history.mjs";
|
|
6
6
|
import "node:stream/web";
|