opencami 1.8.8 → 1.8.9
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/dist/client/assets/{CSPContext-nHSyQniZ.js → CSPContext-DI-5GAnQ.js} +1 -1
- package/dist/client/assets/{DirectionContext-B1cuzwIr.js → DirectionContext-CrIsc5n9.js} +1 -1
- package/dist/client/assets/_sessionKey-B4NZmxf3.js +21 -0
- package/dist/client/assets/agents-bptidK8z.js +2 -0
- package/dist/client/assets/{agents-screen-DpNSh5Ok.js → agents-screen-6qdnPmx2.js} +1 -1
- package/dist/client/assets/bots-BWpbaQ-E.js +2 -0
- package/dist/client/assets/{bots-screen-Qh_IK9hC.js → bots-screen-BTKCOohV.js} +1 -1
- package/dist/client/assets/{button-DdG8c-XQ.js → button-8ab4wOwy.js} +1 -1
- package/dist/client/assets/{composite-Cx-QHT9o.js → composite-B2qsrzf3.js} +1 -1
- package/dist/client/assets/{connect-CSbeSBTn.js → connect-B3_p7C4I.js} +1 -1
- package/dist/client/assets/dashboard-BtClHYpn.js +1 -0
- package/dist/client/assets/{event-Dwf9IDxK.js → event-DG3RKJz8.js} +1 -1
- package/dist/client/assets/{file-explorer-screen-DzDX4HcB.js → file-explorer-screen-Djl8x-8P.js} +1 -1
- package/dist/client/assets/files-CjbCJDgC.js +2 -0
- package/dist/client/assets/{follow-up-suggestions-BYWq-d8P.js → follow-up-suggestions-BSCMXRXh.js} +1 -1
- package/dist/client/assets/{index-BxsgifDH.js → index-BXiha-Vz.js} +1 -1
- package/dist/client/assets/{index-B551ln24.js → index-CtlYu8Ug.js} +1 -1
- package/dist/client/assets/{keyboard-shortcuts-dialog-BX-hH4Wf.js → keyboard-shortcuts-dialog-HAufCn9C.js} +1 -1
- package/dist/client/assets/{main-DBmooBKx.js → main-CQKtcNr3.js} +2 -2
- package/dist/client/assets/{markdown-Bpat4kTr.js → markdown-DFJF-FsV.js} +1 -1
- package/dist/client/assets/memory-DnJOmcwU.js +2 -0
- package/dist/client/assets/{memory-screen-1DgDLyZf.js → memory-screen-Bm4NMAnU.js} +1 -1
- package/dist/client/assets/{menu-ByR1BVmq.js → menu-D26Vmgxl.js} +1 -1
- package/dist/client/assets/{opencami-logo-BV1uPYe6.js → opencami-logo-BSed2Wez.js} +1 -1
- package/dist/client/assets/{popupStateMapping-CGDLUl5Y.js → popupStateMapping-DkI2OCkW.js} +1 -1
- package/dist/client/assets/{proxy-DYrSkM35.js → proxy-CHQ-VCN1.js} +1 -1
- package/dist/client/assets/{react-dSDkXQu6.js → react-WkSlhZJd.js} +1 -1
- package/dist/client/assets/{search-dialog-B3XJLq-O.js → search-dialog-CCl4d0Pi.js} +1 -1
- package/dist/client/assets/{search-sources-badge-CTd0gLuz.js → search-sources-badge-Du8KpUEb.js} +1 -1
- package/dist/client/assets/{session-export-dialog-Cib97JLm.js → session-export-dialog-io9FvLKq.js} +1 -1
- package/dist/client/assets/{settings-dialog-B4NLq1ZS.js → settings-dialog-B93qswor.js} +1 -1
- package/dist/client/assets/skills-BNDGnHwM.js +2 -0
- package/dist/client/assets/{skills-panel-Cj7yHGbX.js → skills-panel-CVh1I-7D.js} +1 -1
- package/dist/client/assets/{switch-kXs1I0oW.js → switch-CSnzINDW.js} +1 -1
- package/dist/client/assets/{tabs-B6GW7TBf.js → tabs-CWfn44FL.js} +1 -1
- package/dist/client/assets/{thinking-DTP9JDQl.js → thinking-BmoLlbFC.js} +1 -1
- package/dist/client/assets/{tooltip-CtHpm-sQ.js → tooltip-CSGMH2t4.js} +1 -1
- package/dist/client/assets/{use-file-explorer-state-C-D2CShe.js → use-file-explorer-state-BYVzjwPA.js} +1 -1
- package/dist/client/assets/{useBaseUiId-Ckx_aJky.js → useBaseUiId-DiwX_3so.js} +1 -1
- package/dist/client/assets/{useCompositeItem-CkvfeGmG.js → useCompositeItem-UPIPwR9H.js} +1 -1
- package/dist/client/assets/{useControlled-8D4PSDAL.js → useControlled-CT2hRlcU.js} +1 -1
- package/dist/client/assets/{useMutation-DckvFKPC.js → useMutation-rx8UH99I.js} +1 -1
- package/dist/client/assets/{useQuery-CtUiG53w.js → useQuery-Boaa6oF3.js} +1 -1
- package/dist/server/assets/{_sessionKey-LV6xK9IM.js → _sessionKey-B6iYeyCS.js} +342 -257
- package/dist/server/assets/{_tanstack-start-manifest_v-qVhiIEVc.js → _tanstack-start-manifest_v-C9chPgNH.js} +1 -1
- package/dist/server/assets/{dashboard-GCKodTiJ.js → dashboard-UYRCu_mQ.js} +19 -3
- package/dist/server/assets/{follow-up-suggestions-CSSc4PDe.js → follow-up-suggestions-mzRQIB0k.js} +2 -2
- package/dist/server/assets/{index-DMKS4aeI.js → index-COElhwGA.js} +1 -1
- package/dist/server/assets/{router-Cr2xCvGA.js → router-BqLGFd4L.js} +3 -3
- package/dist/server/assets/{search-dialog-DR6zBnui.js → search-dialog-CmI7naPN.js} +2 -2
- package/dist/server/assets/{settings-dialog-DEMlCMCP.js → settings-dialog-BZ67gr9N.js} +2 -2
- package/dist/server/assets/{thinking-BpAc3itF.js → thinking-CA8PSwKJ.js} +2 -2
- package/dist/server/server.js +2 -2
- package/package.json +2 -2
- package/dist/client/assets/_sessionKey-CNw4O2rY.js +0 -19
- package/dist/client/assets/agents-C6Ev94B1.js +0 -2
- package/dist/client/assets/bots-B2_u-OmP.js +0 -2
- package/dist/client/assets/dashboard-DA1fTRcH.js +0 -1
- package/dist/client/assets/files-PsZnGOUx.js +0 -2
- package/dist/client/assets/memory-Bs8hOoEv.js +0 -2
- package/dist/client/assets/skills-pueagQNc.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as t}from"./main-DBmooBKx.js";import{c as Fe}from"./react-dSDkXQu6.js";import{B as O,H as C,V as Ke,z as ze,f as Be,P as Re,S as Me,g as De,R as _e,s as Ue,j as Ye,c as L,o as Ge,v as He,k as qe,m as Je,n as Xe,h as $e,J as Y,t as Qe}from"./button-DdG8c-XQ.js";import{D as Ze,a as et,b as tt,c as at,d as G}from"./use-file-explorer-state-C-D2CShe.js";import{S as m}from"./switch-kXs1I0oW.js";import{T as y,a as v,b as j}from"./tabs-B6GW7TBf.js";import{u as rt}from"./index-BxsgifDH.js";import{u as st,g as H}from"./_sessionKey-CNw4O2rY.js";import"./useBaseUiId-Ckx_aJky.js";import"./event-Dwf9IDxK.js";import"./popupStateMapping-CGDLUl5Y.js";import"./visuallyHidden-COI6QeQH.js";import"./composite-Cx-QHT9o.js";import"./useControlled-8D4PSDAL.js";import"./useCompositeItem-CkvfeGmG.js";import"./DirectionContext-B1cuzwIr.js";import"./CSPContext-nHSyQniZ.js";import"./useQuery-CtUiG53w.js";import"./tooltip-CtHpm-sQ.js";import"./useMutation-DckvFKPC.js";import"./menu-ByR1BVmq.js";import"./opencami-logo-BV1uPYe6.js";import"./proxy-DYrSkM35.js";import"./markdown-Bpat4kTr.js";import"./index-T4TOjvD0.js";function lt(){if(typeof window>"u")return!1;try{return window.localStorage.getItem("feature_artifacts")==="true"}catch{return!1}}const nt=Fe()(n=>({isEnabled:lt(),isPanelOpen:!1,content:"",type:null,setArtifact:function(h,a){n({content:h,type:a,isPanelOpen:!0})},clearArtifact:function(){n({content:"",type:null})},openPanel:function(){n({isPanelOpen:!0})},closePanel:function(){n({isPanelOpen:!1})},setEnabled:function(h){if(typeof window<"u")try{window.localStorage.setItem("feature_artifacts",String(h))}catch{}n({isEnabled:h})}}));function b({title:n,tabId:l,activeTab:h,children:a}){const c=l&&h&&l!==h;return t.jsxs("div",{className:L("border-b border-primary-200 py-2 last:border-0",c&&"md:hidden"),children:[t.jsx("h3",{className:"mb-1.5 text-sm font-semibold text-primary-700",children:n}),t.jsx("div",{className:"space-y-1.5",children:a})]})}function s({label:n,description:l,inline:h,children:a}){return h?t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex-1 select-none",children:[t.jsx("div",{className:"text-[13px] font-medium text-primary-800",children:n}),l&&t.jsx("div",{className:"text-xs text-primary-500",children:l})]}),t.jsx("div",{className:"flex items-center gap-2",children:a})]}):t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"select-none",children:[t.jsx("div",{className:"text-[13px] font-medium text-primary-800",children:n}),l&&t.jsx("div",{className:"text-xs text-primary-500",children:l})]}),t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:a})]})}const te=[{value:"14px",label:"S"},{value:"16px",label:"M"},{value:"18px",label:"L"},{value:"20px",label:"XL"}],W=[{value:"system",label:"System",cssValue:'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',previewClass:"font-sans"},{value:"inter",label:"Inter",cssValue:'"Inter", sans-serif',previewClass:'font-["Inter",sans-serif]'},{value:"roboto",label:"Roboto",cssValue:'"Roboto", sans-serif',previewClass:'font-["Roboto",sans-serif]'}],ae=[{value:"compact",label:"Compact"},{value:"comfortable",label:"Comfortable"},{value:"spacious",label:"Spacious"}],F=[{value:"green",label:"Green",accent:"#22c55e",hover:"#16a34a",light:"rgba(34, 197, 94, 0.10)"},{value:"blue",label:"Blue",accent:"#3b82f6",hover:"#2563eb",light:"rgba(59, 130, 246, 0.10)"},{value:"purple",label:"Purple",accent:"#8b5cf6",hover:"#7c3aed",light:"rgba(139, 92, 246, 0.10)"},{value:"orange",label:"Orange",accent:"#f97316",hover:"#ea580c",light:"rgba(249, 115, 22, 0.10)"},{value:"pink",label:"Pink",accent:"#ec4899",hover:"#db2777",light:"rgba(236, 72, 153, 0.10)"},{value:"red",label:"Red",accent:"#ef4444",hover:"#dc2626",light:"rgba(239, 68, 68, 0.10)"},{value:"cyan",label:"Cyan",accent:"#06b6d4",hover:"#0891b2",light:"rgba(6, 182, 212, 0.10)"},{value:"yellow",label:"Yellow",accent:"#eab308",hover:"#ca8a04",light:"rgba(234, 179, 8, 0.10)"}],K=[{value:"narrow",label:"Narrow",cssValue:"640px"},{value:"medium",label:"Medium",cssValue:"800px"},{value:"wide",label:"Wide",cssValue:"1000px"},{value:"full",label:"Full",cssValue:"100%"}],z=[{value:"compact",label:"Compact",cssValue:"200px"},{value:"normal",label:"Normal",cssValue:"260px"},{value:"wide",label:"Wide",cssValue:"320px"},{value:"xl",label:"XL",cssValue:"400px"}],re=[{value:"default",label:"Default"},{value:"bubbles",label:"Bubbles"},{value:"minimal",label:"Minimal"}];function q(n){return te.some(l=>l.value===n)}function J(n){return W.some(l=>l.value===n)}function X(n){return ae.some(l=>l.value===n)}function $(n){return F.some(l=>l.value===n)}function Q(n){return K.some(l=>l.value===n)}function Z(n){return z.some(l=>l.value===n)}function ee(n){return re.some(l=>l.value===n)}function Vt({open:n,onOpenChange:l,onClose:h}){const{settings:a,updateSettings:c}=rt(),{settings:u,updateSettings:f,status:w,testApiKey:se}=st(),[p,le]=o.useState("appearance"),[g,R]=o.useState(u.llmApiKey),[M,D]=o.useState(!1),[S,k]=o.useState(null),[ne,ie]=o.useState(()=>{if(typeof window>"u")return"16px";try{const e=localStorage.getItem("opencami-text-size");if(e&&q(e))return e}catch{}return"16px"}),[oe,ce]=o.useState(()=>{if(typeof window>"u")return!0;try{const e=localStorage.getItem("opencami-tts-enabled");return e===null?!0:e==="true"}catch{return!0}}),[_,de]=o.useState(()=>{if(typeof window>"u")return"auto";try{return localStorage.getItem("opencami-tts-provider")||"auto"}catch{return"auto"}}),[ue,me]=o.useState(()=>{if(typeof window>"u")return"nova";try{return localStorage.getItem("opencami-tts-voice")||"nova"}catch{return"nova"}}),[he,pe]=o.useState(()=>{if(typeof window>"u")return"auto";try{return localStorage.getItem("opencami-stt-provider")||"auto"}catch{return"auto"}});o.useEffect(()=>{if(!(typeof window>"u"))try{const e=localStorage.getItem("opencami-font-family");e&&J(e)?(I(e),a.fontFamily!==e&&c({fontFamily:e})):I(a.fontFamily);const r=localStorage.getItem("opencami-density");r&&X(r)?(N(r),a.density!==r&&c({density:r})):N(a.density);const i=localStorage.getItem("opencami-accent-color");i&&$(i)?(P(i),a.accentColor!==i&&c({accentColor:i})):P(a.accentColor);const d=localStorage.getItem("opencami-chat-width");d&&Q(d)?(A(d),a.chatWidth!==d&&c({chatWidth:d})):A(a.chatWidth);const x=localStorage.getItem("opencami-sidebar-width");x&&Z(x)?(E(x),a.sidebarWidth!==x&&c({sidebarWidth:x})):E(a.sidebarWidth);const V=localStorage.getItem("opencami-bubble-style");V&&ee(V)?(T(V),a.bubbleStyle!==V&&c({bubbleStyle:V})):T(a.bubbleStyle)}catch{I(a.fontFamily),N(a.density),P(a.accentColor),A(a.chatWidth),E(a.sidebarWidth),T(a.bubbleStyle)}},[]),o.useEffect(()=>{I(a.fontFamily)},[a.fontFamily]),o.useEffect(()=>{N(a.density)},[a.density]),o.useEffect(()=>{P(a.accentColor)},[a.accentColor]),o.useEffect(()=>{A(a.chatWidth)},[a.chatWidth]),o.useEffect(()=>{E(a.sidebarWidth)},[a.sidebarWidth]),o.useEffect(()=>{T(a.bubbleStyle)},[a.bubbleStyle]);const xe=e=>{de(e);try{localStorage.setItem("opencami-tts-provider",e)}catch{}},be=e=>{me(e);try{localStorage.setItem("opencami-tts-voice",e)}catch{}},fe=e=>{pe(e);try{localStorage.setItem("opencami-stt-provider",e)}catch{}};function ge(e){typeof document>"u"||document.documentElement.style.setProperty("--opencami-text-size",e)}function I(e){if(typeof document>"u")return;const i=W.find(d=>d.value===e)?.cssValue??W[0].cssValue;document.documentElement.style.setProperty("--opencami-font-family",i)}function N(e){if(typeof document>"u")return;const r=document.documentElement;if(r.style.setProperty("--opencami-density",e),e==="compact"){r.style.setProperty("--opencami-msg-padding-y","0.25rem"),r.style.setProperty("--opencami-msg-gap","0.25rem"),r.style.setProperty("--opencami-user-bubble-py","0.4rem");return}if(e==="spacious"){r.style.setProperty("--opencami-msg-padding-y","1.25rem"),r.style.setProperty("--opencami-msg-gap","1rem"),r.style.setProperty("--opencami-user-bubble-py","1rem");return}r.style.setProperty("--opencami-msg-padding-y","0.75rem"),r.style.setProperty("--opencami-msg-gap","0.5rem"),r.style.setProperty("--opencami-user-bubble-py","0.625rem")}function P(e){if(typeof document>"u")return;const r=F.find(d=>d.value===e)??F[0],i=document.documentElement;i.style.setProperty("--opencami-accent",r.accent),i.style.setProperty("--opencami-accent-hover",r.hover),i.style.setProperty("--opencami-accent-light",r.light)}function A(e){if(typeof document>"u")return;const r=K.find(i=>i.value===e)??K[2];document.documentElement.style.setProperty("--opencami-chat-width",r.cssValue)}function E(e){if(typeof document>"u")return;const r=z.find(i=>i.value===e)??z[1];document.documentElement.style.setProperty("--opencami-sidebar-width",r.cssValue)}function T(e){typeof document>"u"||document.documentElement.setAttribute("data-opencami-bubble-style",e)}const ye=e=>{if(q(e)){ie(e),ge(e);try{localStorage.setItem("opencami-text-size",e)}catch{}}},ve=e=>{if(J(e)){I(e),c({fontFamily:e});try{localStorage.setItem("opencami-font-family",e)}catch{}}},je=e=>{if(X(e)){N(e),c({density:e});try{localStorage.setItem("opencami-density",e)}catch{}}},we=e=>{if($(e)){P(e),c({accentColor:e});try{localStorage.setItem("opencami-accent-color",e)}catch{}}},Se=e=>{if(Q(e)){A(e),c({chatWidth:e});try{localStorage.setItem("opencami-chat-width",e)}catch{}}},Ce=e=>{if(Z(e)){E(e),c({sidebarWidth:e});try{localStorage.setItem("opencami-sidebar-width",e)}catch{}}},ke=e=>{if(ee(e)){T(e),c({bubbleStyle:e});try{localStorage.setItem("opencami-bubble-style",e)}catch{}}},Ie=e=>{ce(e);try{localStorage.setItem("opencami-tts-enabled",String(e))}catch{}window.dispatchEvent(new StorageEvent("storage",{key:"opencami-tts-enabled",newValue:String(e)}))},[U,Ne]=o.useState(!1),B=o.useRef(null),[Pe,Ae]=o.useState(()=>{if(typeof window>"u")return!0;try{const e=localStorage.getItem("opencami-personas-enabled");return e===null?!0:e==="true"}catch{return!0}});o.useEffect(()=>{let e=!0;async function r(){B.current?.abort();const i=new AbortController;B.current=i;try{const d=await fetch("/api/personas",{signal:i.signal});if(!d.ok)return;const x=await d.json();e&&x.ok&&Ne(x.available)}catch(d){if(d instanceof Error&&d.name==="AbortError")return}}return r(),()=>{e=!1,B.current?.abort()}},[]);const Ee=e=>{Ae(e);try{localStorage.setItem("opencami-personas-enabled",String(e))}catch{}window.dispatchEvent(new StorageEvent("storage",{key:"opencami-personas-enabled",newValue:String(e)}))},Te=async()=>{if(g.trim()){D(!0),k(null);try{const e=await se(g.trim());k(e),e.valid&&f({llmApiKey:g.trim()})}finally{D(!1)}}},Ve=()=>{f({llmApiKey:g.trim()}),k(null)},Oe=()=>{R(""),f({llmApiKey:""}),k(null)},Le=[{value:"system",label:"Auto",icon:Ge},{value:"light",label:"Light",icon:He},{value:"dark",label:"Dark",icon:qe},{value:"chameleon",label:"Cham",icon:Je},{value:"frost-light",label:"Ice",icon:Xe}];function We(e){if(typeof document>"u")return;const r=document.documentElement,i=window.matchMedia("(prefers-color-scheme: dark)");r.classList.remove("light","dark","system","chameleon","frost","frost-light","frost-dark"),r.style.colorScheme="",r.classList.add(e);const d=e==="frost-light",x=e==="frost-dark";(d||x)&&r.classList.add("frost"),x&&r.classList.add("dark"),e==="system"&&i.matches&&r.classList.add("dark"),d&&(r.classList.remove("dark"),r.style.colorScheme="light")}return t.jsx(Ze,{open:n,onOpenChange:l,children:t.jsx(et,{className:"w-[min(680px,92vw)] max-h-[85vh] overflow-y-auto",children:t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{children:[t.jsx(tt,{className:"mb-1",children:"Settings"}),t.jsx(at,{className:"hidden",children:"Configure OpenCami"})]}),t.jsx(G,{render:t.jsx(O,{size:"icon-sm",variant:"ghost",className:"text-primary-500 hover:bg-primary-100 hover:text-primary-700","aria-label":"Close",children:t.jsx(C,{icon:Ke,size:20,strokeWidth:1.5})})})]}),t.jsxs("div",{className:"mt-2 flex md:flex-row flex-col md:gap-3 gap-0 md:min-h-[400px]",children:[t.jsx("nav",{className:"hidden md:flex flex-col gap-0.5 min-w-[160px] border-r border-primary-200 pr-3",children:[{id:"connection",label:"Connection",icon:ze},{id:"appearance",label:"Appearance",icon:Be},{id:"chat",label:"Chat",icon:Re},{id:"workspace",label:"Workspace",icon:Me},{id:"personas",label:"Personas",icon:De},{id:"voice",label:"Voice",icon:_e},{id:"llm",label:"LLM Features",icon:Ue},{id:"about",label:"About",icon:Ye}].map(e=>t.jsxs("button",{onClick:()=>le(e.id),className:L("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-sm text-left transition-colors",p===e.id?"text-primary-900 font-medium":"text-primary-600 hover:text-primary-900 hover:bg-primary-50"),style:p===e.id?{backgroundColor:"var(--opencami-accent-light)"}:void 0,children:[t.jsx(C,{icon:e.icon,size:16,strokeWidth:1.5}),e.label]},e.id))}),t.jsxs("div",{className:"flex-1 overflow-y-auto md:max-h-[calc(85vh-90px)] max-h-none",children:[t.jsx(b,{title:"Connection",tabId:"connection",activeTab:p,children:t.jsx(s,{inline:!0,label:"Status",children:t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-green-600",children:[t.jsx("span",{className:"size-2 rounded-full bg-green-500"}),"Connected"]})})}),t.jsxs(b,{title:"Appearance",tabId:"appearance",activeTab:p,children:[t.jsx(s,{label:"Theme",children:t.jsx(y,{value:a.theme,onValueChange:e=>{const r=e;We(r),c({theme:r})},children:t.jsx(v,{variant:"default",className:"gap-1.5 flex-wrap *:data-[slot=tab-indicator]:duration-0",children:Le.map(e=>t.jsxs(j,{value:e.value,className:"text-[11px] px-1 py-0.5 gap-0.5",children:[e.icon&&t.jsx(C,{icon:e.icon,size:13,strokeWidth:1.5}),t.jsx("span",{children:e.label})]},e.value))})})}),t.jsx(s,{label:"Accent Color",children:t.jsx("div",{className:"flex gap-0.5 flex-wrap",children:F.map(e=>{const r=a.accentColor===e.value;return t.jsx("button",{type:"button",onClick:()=>we(e.value),className:L("flex items-center justify-center rounded-md p-1 transition-all duration-150",r?"scale-110":"hover:bg-primary-50 hover:scale-105"),children:t.jsx("span",{className:L("size-6 rounded-full transition-shadow duration-150",r?"ring-2 ring-offset-2":"border-2 border-primary-200"),style:{backgroundColor:e.accent,...r?{"--tw-ring-color":e.accent}:{}}})},e.value)})})}),t.jsx(s,{label:"Text Size",children:t.jsx(y,{value:ne,onValueChange:ye,children:t.jsx(v,{variant:"default",className:"gap-2 *:data-[slot=tab-indicator]:duration-0",children:te.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"tabular-nums text-xs",children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Font",children:t.jsx(y,{value:a.fontFamily,onValueChange:ve,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:W.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",style:{fontFamily:e.cssValue},children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Density",children:t.jsx(y,{value:a.density,onValueChange:je,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:ae.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Bubbles",children:t.jsx(y,{value:a.bubbleStyle,onValueChange:ke,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:re.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Chat Width",children:t.jsx(y,{value:a.chatWidth,onValueChange:Se,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:K.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Sidebar",children:t.jsx(y,{value:a.sidebarWidth,onValueChange:Ce,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:z.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})})]}),t.jsxs(b,{title:"Chat",tabId:"chat",activeTab:p,children:[t.jsx(s,{inline:!0,label:"Show tool messages",children:t.jsx(m,{checked:a.showToolMessages,onCheckedChange:e=>c({showToolMessages:e})})}),t.jsx(s,{inline:!0,label:"Show reasoning blocks",children:t.jsx(m,{checked:a.showReasoningBlocks,onCheckedChange:e=>c({showReasoningBlocks:e})})}),t.jsx(s,{inline:!0,label:"Show search sources",children:t.jsx(m,{checked:a.showSearchSources,onCheckedChange:e=>c({showSearchSources:e})})}),t.jsx(s,{inline:!0,label:"Inline File Preview",description:"Make file paths in messages clickable to preview file contents",children:t.jsx(m,{checked:a.inlineFilePreview,onCheckedChange:e=>c({inlineFilePreview:e})})})]}),t.jsxs(b,{title:"Workspace",tabId:"workspace",activeTab:p,children:[t.jsx(s,{inline:!0,label:"File Explorer",description:"Browse and edit workspace files from the sidebar",children:t.jsx(m,{checked:(()=>{try{const e=localStorage.getItem("opencami-file-explorer");return e===null?!0:e==="true"}catch{return!0}})(),onCheckedChange:e=>{localStorage.setItem("opencami-file-explorer",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Memory Viewer",description:"Browse and edit MEMORY.md and daily memory files",children:t.jsx(m,{checked:(()=>{try{const e=localStorage.getItem("opencami-memory-viewer");return e===null?!0:e==="true"}catch{return!0}})(),onCheckedChange:e=>{localStorage.setItem("opencami-memory-viewer",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Agent Manager (Beta)",description:"Show Agent Manager in sidebar for creating and managing agents",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("opencami-agent-manager")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("opencami-agent-manager",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Skills Browser (Beta)",description:"Browse and install skills from ClawHub",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("opencami-skills-browser")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("opencami-skills-browser",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Cron Jobs Panel (Beta)",description:"Show Cron Jobs in sidebar for managing OpenClaw cron schedules",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("opencami-cron-manager")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("opencami-cron-manager",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Dashboard (Beta)",description:"Show Dashboard in sidebar with system and gateway widgets",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("feature_dashboard")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("feature_dashboard",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Artifacts Preview (Beta)",description:"Show live HTML/SVG preview panel when AI generates code",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("feature_artifacts")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("feature_artifacts",String(e)),nt.getState().setEnabled(e)}})})]}),t.jsxs(b,{title:"Personas",tabId:"personas",activeTab:p,children:[U?t.jsx(s,{inline:!0,label:"Persona Picker",description:"Show persona picker in chat (20 personalities)",children:t.jsx(m,{checked:Pe,onCheckedChange:Ee})}):t.jsx(s,{inline:!0,label:"Persona Picker",description:"Install the Personas skill to unlock 20 AI personalities",children:t.jsx(m,{checked:!1,disabled:!0})}),!U&&t.jsx("div",{className:"pt-1",children:t.jsx("a",{href:"https://www.clawhub.ai/robbyczgw-cla/personas",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary-600 hover:text-primary-900 hover:underline",children:"Get it on ClawHub →"})})]}),t.jsxs(b,{title:"Text-to-Speech",tabId:"voice",activeTab:p,children:[t.jsx(s,{inline:!0,label:"Voice Playback",description:"Add a 🔊 button to AI messages for text-to-speech",children:t.jsx(m,{checked:oe,onCheckedChange:Ie})}),t.jsx(s,{inline:!0,label:"TTS Provider",description:"Choose which service generates speech",children:t.jsxs("select",{value:_,onChange:e=>xe(e.target.value),className:"rounded-md border border-primary-200 bg-surface px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500",children:[t.jsx("option",{value:"auto",children:"Auto"}),t.jsx("option",{value:"elevenlabs",children:"ElevenLabs"}),t.jsx("option",{value:"openai",children:"OpenAI"}),t.jsx("option",{value:"edge",children:"Edge TTS (free)"})]})}),_==="openai"&&t.jsx(s,{inline:!0,label:"Voice",description:"OpenAI voice selection",children:t.jsx("select",{value:ue,onChange:e=>be(e.target.value),className:"rounded-md border border-primary-200 bg-surface px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500",children:["alloy","echo","fable","onyx","nova","shimmer"].map(e=>t.jsx("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})})]}),t.jsx(b,{title:"Speech-to-Text",tabId:"voice",activeTab:p,children:t.jsx(s,{inline:!0,label:"STT Provider",description:"Choose which service transcribes your voice",children:t.jsxs("select",{value:he,onChange:e=>fe(e.target.value),className:"rounded-md border border-primary-200 bg-surface px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500",children:[t.jsx("option",{value:"auto",children:"Auto"}),t.jsx("option",{value:"elevenlabs",children:"ElevenLabs"}),t.jsx("option",{value:"openai",children:"OpenAI"}),t.jsx("option",{value:"browser",children:"Browser (free)"})]})})}),t.jsxs(b,{title:"LLM Features",tabId:"llm",activeTab:p,children:[t.jsxs("div",{className:"text-xs text-primary-500 mb-3",children:["Enhance session titles and follow-up suggestions using an LLM provider.",w.hasEnvKey&&t.jsx("span",{className:"block mt-1 text-green-600",children:"✓ Server has OPENAI_API_KEY configured"}),w.hasOpenRouterKey&&t.jsx("span",{className:"block mt-1 text-green-600",children:"✓ Server has OPENROUTER_API_KEY configured"}),w.hasKilocodeKey&&t.jsx("span",{className:"block mt-1 text-green-600",children:"✓ Server has KILOCODE_API_KEY configured"})]}),t.jsx(s,{inline:!0,label:"Provider",description:"Choose LLM provider for titles & follow-ups",children:t.jsxs("select",{value:u.llmProvider,onChange:e=>{const r=e.target.value;f({llmProvider:r,llmBaseUrl:"",llmModel:""})},className:"px-2 py-1 text-sm rounded-md border border-primary-200 bg-surface focus:outline-none focus:ring-2 focus:ring-primary-500",children:[t.jsx("option",{value:"openai",children:"OpenAI"}),t.jsx("option",{value:"openrouter",children:"OpenRouter"}),t.jsx("option",{value:"kilocode",children:"Kilo Gateway"}),t.jsx("option",{value:"ollama",children:"Ollama (local)"}),t.jsx("option",{value:"custom",children:"Custom"})]})}),t.jsx(s,{inline:!0,label:"Smart session titles",description:"Generate concise titles using AI",children:t.jsx(m,{checked:u.useLlmTitles,onCheckedChange:e=>f({useLlmTitles:e}),disabled:!w.isAvailable})}),t.jsx(s,{inline:!0,label:"Smart follow-up suggestions",description:"AI-generated contextual follow-ups",children:t.jsx(m,{checked:u.useLlmFollowUps,onCheckedChange:e=>f({useLlmFollowUps:e}),disabled:!w.isAvailable})}),t.jsxs("div",{className:"mt-2 space-y-2",children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-xs text-primary-500 mb-1",children:"Model"}),t.jsx("input",{type:"text",value:u.llmModel,onChange:e=>f({llmModel:e.target.value}),placeholder:H(u.llmProvider).model||"model-name",className:"w-full px-3 py-1.5 text-sm rounded-md border border-primary-200 bg-surface focus:outline-none focus:ring-2 focus:ring-primary-500"})]}),(u.llmProvider==="custom"||u.llmProvider==="ollama")&&t.jsxs("div",{children:[t.jsx("div",{className:"text-xs text-primary-500 mb-1",children:"Base URL"}),t.jsx("input",{type:"text",value:u.llmBaseUrl,onChange:e=>f({llmBaseUrl:e.target.value}),placeholder:H(u.llmProvider).baseUrl||"https://...",className:"w-full px-3 py-1.5 text-sm rounded-md border border-primary-200 bg-surface focus:outline-none focus:ring-2 focus:ring-primary-500"})]})]}),t.jsxs("div",{className:"mt-4 pt-3 border-t border-primary-100",children:[t.jsx("div",{className:"text-sm text-primary-800 mb-2",children:u.llmProvider==="ollama"?"API Key (optional)":"API Key"}),t.jsx("div",{className:"text-xs text-primary-500 mb-2",children:u.llmProvider==="ollama"?"Not required for local Ollama":w.hasEnvKey&&u.llmProvider==="openai"?"Optional: Override server key with your own":`Required for ${u.llmProvider==="openrouter"?"OpenRouter":u.llmProvider==="kilocode"?"Kilo Gateway":"LLM features"} (stored locally)`}),t.jsxs("div",{className:"text-xs text-amber-600 bg-amber-50 border border-amber-200 rounded-md px-2 py-1.5 mb-2",children:["⚠️ ",t.jsx("strong",{children:"Security Note:"})," API keys are stored in your browser's localStorage. This is convenient but not secure for shared computers. For production use, configure keys server-side via environment variables (OPENAI_API_KEY, OPENROUTER_API_KEY, KILOCODE_API_KEY)."]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{type:"password",value:g,onChange:e=>{R(e.target.value),k(null)},placeholder:"sk-...",className:"flex-1 px-3 py-1.5 text-sm rounded-md border border-primary-200 bg-surface focus:outline-none focus:ring-2 focus:ring-primary-500"}),t.jsx(O,{size:"sm",variant:"outline",onClick:Te,disabled:!g.trim()||M,className:"min-w-[60px]",children:M?t.jsx(C,{icon:$e,size:16,className:"animate-spin"}):"Test"})]}),S&&t.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-xs ${S.valid?"text-green-600":"text-red-600"}`,children:[t.jsx(C,{icon:S.valid?Y:Qe,size:14}),S.valid?"API key is valid":S.error||"Invalid API key"]}),u.llmApiKey&&t.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[t.jsxs("span",{className:"text-xs text-green-600 flex items-center gap-1",children:[t.jsx(C,{icon:Y,size:14}),"Key saved"]}),t.jsx(O,{size:"sm",variant:"ghost",onClick:Oe,className:"text-xs text-red-600 hover:text-red-700 hover:bg-red-50",children:"Clear"})]}),g&&g!==u.llmApiKey&&!S?.valid&&t.jsx(O,{size:"sm",variant:"outline",onClick:Ve,className:"mt-2 w-full",children:"Save without testing"})]})]}),t.jsxs(b,{title:"About",tabId:"about",activeTab:p,children:[t.jsx("div",{className:"text-sm text-primary-800",children:"OpenCami"}),t.jsxs("div",{className:"flex gap-4 pt-2",children:[t.jsx("a",{href:"https://github.com/robbyczgw-cla/opencami",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary-600 hover:text-primary-900 hover:underline",children:"GitHub"}),t.jsx("a",{href:"https://docs.openclaw.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary-600 hover:text-primary-900 hover:underline",children:"OpenClaw docs"})]})]})]})]}),t.jsx("div",{className:"mt-2 flex justify-end",children:t.jsx(G,{onClick:h,children:"Close"})})]})})})}export{Vt as SettingsDialog};
|
|
1
|
+
import{r as o,j as t}from"./main-CQKtcNr3.js";import{c as Fe}from"./react-WkSlhZJd.js";import{B as O,H as C,V as Ke,z as ze,f as Be,P as Re,S as Me,g as De,R as _e,s as Ue,j as Ye,c as L,o as Ge,v as He,k as qe,m as Je,n as Xe,h as $e,J as Y,t as Qe}from"./button-8ab4wOwy.js";import{D as Ze,a as et,b as tt,c as at,d as G}from"./use-file-explorer-state-BYVzjwPA.js";import{S as m}from"./switch-CSnzINDW.js";import{T as y,a as v,b as j}from"./tabs-CWfn44FL.js";import{u as rt}from"./index-BXiha-Vz.js";import{u as st,g as H}from"./_sessionKey-B4NZmxf3.js";import"./useBaseUiId-DiwX_3so.js";import"./event-DG3RKJz8.js";import"./popupStateMapping-DkI2OCkW.js";import"./visuallyHidden-COI6QeQH.js";import"./composite-B2qsrzf3.js";import"./useControlled-CT2hRlcU.js";import"./useCompositeItem-UPIPwR9H.js";import"./DirectionContext-CrIsc5n9.js";import"./CSPContext-DI-5GAnQ.js";import"./useQuery-Boaa6oF3.js";import"./tooltip-CSGMH2t4.js";import"./useMutation-rx8UH99I.js";import"./menu-D26Vmgxl.js";import"./opencami-logo-BSed2Wez.js";import"./proxy-CHQ-VCN1.js";import"./markdown-DFJF-FsV.js";import"./index-T4TOjvD0.js";function lt(){if(typeof window>"u")return!1;try{return window.localStorage.getItem("feature_artifacts")==="true"}catch{return!1}}const nt=Fe()(n=>({isEnabled:lt(),isPanelOpen:!1,content:"",type:null,setArtifact:function(h,a){n({content:h,type:a,isPanelOpen:!0})},clearArtifact:function(){n({content:"",type:null})},openPanel:function(){n({isPanelOpen:!0})},closePanel:function(){n({isPanelOpen:!1})},setEnabled:function(h){if(typeof window<"u")try{window.localStorage.setItem("feature_artifacts",String(h))}catch{}n({isEnabled:h})}}));function b({title:n,tabId:l,activeTab:h,children:a}){const c=l&&h&&l!==h;return t.jsxs("div",{className:L("border-b border-primary-200 py-2 last:border-0",c&&"md:hidden"),children:[t.jsx("h3",{className:"mb-1.5 text-sm font-semibold text-primary-700",children:n}),t.jsx("div",{className:"space-y-1.5",children:a})]})}function s({label:n,description:l,inline:h,children:a}){return h?t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex-1 select-none",children:[t.jsx("div",{className:"text-[13px] font-medium text-primary-800",children:n}),l&&t.jsx("div",{className:"text-xs text-primary-500",children:l})]}),t.jsx("div",{className:"flex items-center gap-2",children:a})]}):t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"select-none",children:[t.jsx("div",{className:"text-[13px] font-medium text-primary-800",children:n}),l&&t.jsx("div",{className:"text-xs text-primary-500",children:l})]}),t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:a})]})}const te=[{value:"14px",label:"S"},{value:"16px",label:"M"},{value:"18px",label:"L"},{value:"20px",label:"XL"}],W=[{value:"system",label:"System",cssValue:'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',previewClass:"font-sans"},{value:"inter",label:"Inter",cssValue:'"Inter", sans-serif',previewClass:'font-["Inter",sans-serif]'},{value:"roboto",label:"Roboto",cssValue:'"Roboto", sans-serif',previewClass:'font-["Roboto",sans-serif]'}],ae=[{value:"compact",label:"Compact"},{value:"comfortable",label:"Comfortable"},{value:"spacious",label:"Spacious"}],F=[{value:"green",label:"Green",accent:"#22c55e",hover:"#16a34a",light:"rgba(34, 197, 94, 0.10)"},{value:"blue",label:"Blue",accent:"#3b82f6",hover:"#2563eb",light:"rgba(59, 130, 246, 0.10)"},{value:"purple",label:"Purple",accent:"#8b5cf6",hover:"#7c3aed",light:"rgba(139, 92, 246, 0.10)"},{value:"orange",label:"Orange",accent:"#f97316",hover:"#ea580c",light:"rgba(249, 115, 22, 0.10)"},{value:"pink",label:"Pink",accent:"#ec4899",hover:"#db2777",light:"rgba(236, 72, 153, 0.10)"},{value:"red",label:"Red",accent:"#ef4444",hover:"#dc2626",light:"rgba(239, 68, 68, 0.10)"},{value:"cyan",label:"Cyan",accent:"#06b6d4",hover:"#0891b2",light:"rgba(6, 182, 212, 0.10)"},{value:"yellow",label:"Yellow",accent:"#eab308",hover:"#ca8a04",light:"rgba(234, 179, 8, 0.10)"}],K=[{value:"narrow",label:"Narrow",cssValue:"640px"},{value:"medium",label:"Medium",cssValue:"800px"},{value:"wide",label:"Wide",cssValue:"1000px"},{value:"full",label:"Full",cssValue:"100%"}],z=[{value:"compact",label:"Compact",cssValue:"200px"},{value:"normal",label:"Normal",cssValue:"260px"},{value:"wide",label:"Wide",cssValue:"320px"},{value:"xl",label:"XL",cssValue:"400px"}],re=[{value:"default",label:"Default"},{value:"bubbles",label:"Bubbles"},{value:"minimal",label:"Minimal"}];function q(n){return te.some(l=>l.value===n)}function J(n){return W.some(l=>l.value===n)}function X(n){return ae.some(l=>l.value===n)}function $(n){return F.some(l=>l.value===n)}function Q(n){return K.some(l=>l.value===n)}function Z(n){return z.some(l=>l.value===n)}function ee(n){return re.some(l=>l.value===n)}function Vt({open:n,onOpenChange:l,onClose:h}){const{settings:a,updateSettings:c}=rt(),{settings:u,updateSettings:f,status:w,testApiKey:se}=st(),[p,le]=o.useState("appearance"),[g,R]=o.useState(u.llmApiKey),[M,D]=o.useState(!1),[S,k]=o.useState(null),[ne,ie]=o.useState(()=>{if(typeof window>"u")return"16px";try{const e=localStorage.getItem("opencami-text-size");if(e&&q(e))return e}catch{}return"16px"}),[oe,ce]=o.useState(()=>{if(typeof window>"u")return!0;try{const e=localStorage.getItem("opencami-tts-enabled");return e===null?!0:e==="true"}catch{return!0}}),[_,de]=o.useState(()=>{if(typeof window>"u")return"auto";try{return localStorage.getItem("opencami-tts-provider")||"auto"}catch{return"auto"}}),[ue,me]=o.useState(()=>{if(typeof window>"u")return"nova";try{return localStorage.getItem("opencami-tts-voice")||"nova"}catch{return"nova"}}),[he,pe]=o.useState(()=>{if(typeof window>"u")return"auto";try{return localStorage.getItem("opencami-stt-provider")||"auto"}catch{return"auto"}});o.useEffect(()=>{if(!(typeof window>"u"))try{const e=localStorage.getItem("opencami-font-family");e&&J(e)?(I(e),a.fontFamily!==e&&c({fontFamily:e})):I(a.fontFamily);const r=localStorage.getItem("opencami-density");r&&X(r)?(N(r),a.density!==r&&c({density:r})):N(a.density);const i=localStorage.getItem("opencami-accent-color");i&&$(i)?(P(i),a.accentColor!==i&&c({accentColor:i})):P(a.accentColor);const d=localStorage.getItem("opencami-chat-width");d&&Q(d)?(A(d),a.chatWidth!==d&&c({chatWidth:d})):A(a.chatWidth);const x=localStorage.getItem("opencami-sidebar-width");x&&Z(x)?(E(x),a.sidebarWidth!==x&&c({sidebarWidth:x})):E(a.sidebarWidth);const V=localStorage.getItem("opencami-bubble-style");V&&ee(V)?(T(V),a.bubbleStyle!==V&&c({bubbleStyle:V})):T(a.bubbleStyle)}catch{I(a.fontFamily),N(a.density),P(a.accentColor),A(a.chatWidth),E(a.sidebarWidth),T(a.bubbleStyle)}},[]),o.useEffect(()=>{I(a.fontFamily)},[a.fontFamily]),o.useEffect(()=>{N(a.density)},[a.density]),o.useEffect(()=>{P(a.accentColor)},[a.accentColor]),o.useEffect(()=>{A(a.chatWidth)},[a.chatWidth]),o.useEffect(()=>{E(a.sidebarWidth)},[a.sidebarWidth]),o.useEffect(()=>{T(a.bubbleStyle)},[a.bubbleStyle]);const xe=e=>{de(e);try{localStorage.setItem("opencami-tts-provider",e)}catch{}},be=e=>{me(e);try{localStorage.setItem("opencami-tts-voice",e)}catch{}},fe=e=>{pe(e);try{localStorage.setItem("opencami-stt-provider",e)}catch{}};function ge(e){typeof document>"u"||document.documentElement.style.setProperty("--opencami-text-size",e)}function I(e){if(typeof document>"u")return;const i=W.find(d=>d.value===e)?.cssValue??W[0].cssValue;document.documentElement.style.setProperty("--opencami-font-family",i)}function N(e){if(typeof document>"u")return;const r=document.documentElement;if(r.style.setProperty("--opencami-density",e),e==="compact"){r.style.setProperty("--opencami-msg-padding-y","0.25rem"),r.style.setProperty("--opencami-msg-gap","0.25rem"),r.style.setProperty("--opencami-user-bubble-py","0.4rem");return}if(e==="spacious"){r.style.setProperty("--opencami-msg-padding-y","1.25rem"),r.style.setProperty("--opencami-msg-gap","1rem"),r.style.setProperty("--opencami-user-bubble-py","1rem");return}r.style.setProperty("--opencami-msg-padding-y","0.75rem"),r.style.setProperty("--opencami-msg-gap","0.5rem"),r.style.setProperty("--opencami-user-bubble-py","0.625rem")}function P(e){if(typeof document>"u")return;const r=F.find(d=>d.value===e)??F[0],i=document.documentElement;i.style.setProperty("--opencami-accent",r.accent),i.style.setProperty("--opencami-accent-hover",r.hover),i.style.setProperty("--opencami-accent-light",r.light)}function A(e){if(typeof document>"u")return;const r=K.find(i=>i.value===e)??K[2];document.documentElement.style.setProperty("--opencami-chat-width",r.cssValue)}function E(e){if(typeof document>"u")return;const r=z.find(i=>i.value===e)??z[1];document.documentElement.style.setProperty("--opencami-sidebar-width",r.cssValue)}function T(e){typeof document>"u"||document.documentElement.setAttribute("data-opencami-bubble-style",e)}const ye=e=>{if(q(e)){ie(e),ge(e);try{localStorage.setItem("opencami-text-size",e)}catch{}}},ve=e=>{if(J(e)){I(e),c({fontFamily:e});try{localStorage.setItem("opencami-font-family",e)}catch{}}},je=e=>{if(X(e)){N(e),c({density:e});try{localStorage.setItem("opencami-density",e)}catch{}}},we=e=>{if($(e)){P(e),c({accentColor:e});try{localStorage.setItem("opencami-accent-color",e)}catch{}}},Se=e=>{if(Q(e)){A(e),c({chatWidth:e});try{localStorage.setItem("opencami-chat-width",e)}catch{}}},Ce=e=>{if(Z(e)){E(e),c({sidebarWidth:e});try{localStorage.setItem("opencami-sidebar-width",e)}catch{}}},ke=e=>{if(ee(e)){T(e),c({bubbleStyle:e});try{localStorage.setItem("opencami-bubble-style",e)}catch{}}},Ie=e=>{ce(e);try{localStorage.setItem("opencami-tts-enabled",String(e))}catch{}window.dispatchEvent(new StorageEvent("storage",{key:"opencami-tts-enabled",newValue:String(e)}))},[U,Ne]=o.useState(!1),B=o.useRef(null),[Pe,Ae]=o.useState(()=>{if(typeof window>"u")return!0;try{const e=localStorage.getItem("opencami-personas-enabled");return e===null?!0:e==="true"}catch{return!0}});o.useEffect(()=>{let e=!0;async function r(){B.current?.abort();const i=new AbortController;B.current=i;try{const d=await fetch("/api/personas",{signal:i.signal});if(!d.ok)return;const x=await d.json();e&&x.ok&&Ne(x.available)}catch(d){if(d instanceof Error&&d.name==="AbortError")return}}return r(),()=>{e=!1,B.current?.abort()}},[]);const Ee=e=>{Ae(e);try{localStorage.setItem("opencami-personas-enabled",String(e))}catch{}window.dispatchEvent(new StorageEvent("storage",{key:"opencami-personas-enabled",newValue:String(e)}))},Te=async()=>{if(g.trim()){D(!0),k(null);try{const e=await se(g.trim());k(e),e.valid&&f({llmApiKey:g.trim()})}finally{D(!1)}}},Ve=()=>{f({llmApiKey:g.trim()}),k(null)},Oe=()=>{R(""),f({llmApiKey:""}),k(null)},Le=[{value:"system",label:"Auto",icon:Ge},{value:"light",label:"Light",icon:He},{value:"dark",label:"Dark",icon:qe},{value:"chameleon",label:"Cham",icon:Je},{value:"frost-light",label:"Ice",icon:Xe}];function We(e){if(typeof document>"u")return;const r=document.documentElement,i=window.matchMedia("(prefers-color-scheme: dark)");r.classList.remove("light","dark","system","chameleon","frost","frost-light","frost-dark"),r.style.colorScheme="",r.classList.add(e);const d=e==="frost-light",x=e==="frost-dark";(d||x)&&r.classList.add("frost"),x&&r.classList.add("dark"),e==="system"&&i.matches&&r.classList.add("dark"),d&&(r.classList.remove("dark"),r.style.colorScheme="light")}return t.jsx(Ze,{open:n,onOpenChange:l,children:t.jsx(et,{className:"w-[min(680px,92vw)] max-h-[85vh] overflow-y-auto",children:t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{children:[t.jsx(tt,{className:"mb-1",children:"Settings"}),t.jsx(at,{className:"hidden",children:"Configure OpenCami"})]}),t.jsx(G,{render:t.jsx(O,{size:"icon-sm",variant:"ghost",className:"text-primary-500 hover:bg-primary-100 hover:text-primary-700","aria-label":"Close",children:t.jsx(C,{icon:Ke,size:20,strokeWidth:1.5})})})]}),t.jsxs("div",{className:"mt-2 flex md:flex-row flex-col md:gap-3 gap-0 md:min-h-[400px]",children:[t.jsx("nav",{className:"hidden md:flex flex-col gap-0.5 min-w-[160px] border-r border-primary-200 pr-3",children:[{id:"connection",label:"Connection",icon:ze},{id:"appearance",label:"Appearance",icon:Be},{id:"chat",label:"Chat",icon:Re},{id:"workspace",label:"Workspace",icon:Me},{id:"personas",label:"Personas",icon:De},{id:"voice",label:"Voice",icon:_e},{id:"llm",label:"LLM Features",icon:Ue},{id:"about",label:"About",icon:Ye}].map(e=>t.jsxs("button",{onClick:()=>le(e.id),className:L("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-sm text-left transition-colors",p===e.id?"text-primary-900 font-medium":"text-primary-600 hover:text-primary-900 hover:bg-primary-50"),style:p===e.id?{backgroundColor:"var(--opencami-accent-light)"}:void 0,children:[t.jsx(C,{icon:e.icon,size:16,strokeWidth:1.5}),e.label]},e.id))}),t.jsxs("div",{className:"flex-1 overflow-y-auto md:max-h-[calc(85vh-90px)] max-h-none",children:[t.jsx(b,{title:"Connection",tabId:"connection",activeTab:p,children:t.jsx(s,{inline:!0,label:"Status",children:t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-green-600",children:[t.jsx("span",{className:"size-2 rounded-full bg-green-500"}),"Connected"]})})}),t.jsxs(b,{title:"Appearance",tabId:"appearance",activeTab:p,children:[t.jsx(s,{label:"Theme",children:t.jsx(y,{value:a.theme,onValueChange:e=>{const r=e;We(r),c({theme:r})},children:t.jsx(v,{variant:"default",className:"gap-1.5 flex-wrap *:data-[slot=tab-indicator]:duration-0",children:Le.map(e=>t.jsxs(j,{value:e.value,className:"text-[11px] px-1 py-0.5 gap-0.5",children:[e.icon&&t.jsx(C,{icon:e.icon,size:13,strokeWidth:1.5}),t.jsx("span",{children:e.label})]},e.value))})})}),t.jsx(s,{label:"Accent Color",children:t.jsx("div",{className:"flex gap-0.5 flex-wrap",children:F.map(e=>{const r=a.accentColor===e.value;return t.jsx("button",{type:"button",onClick:()=>we(e.value),className:L("flex items-center justify-center rounded-md p-1 transition-all duration-150",r?"scale-110":"hover:bg-primary-50 hover:scale-105"),children:t.jsx("span",{className:L("size-6 rounded-full transition-shadow duration-150",r?"ring-2 ring-offset-2":"border-2 border-primary-200"),style:{backgroundColor:e.accent,...r?{"--tw-ring-color":e.accent}:{}}})},e.value)})})}),t.jsx(s,{label:"Text Size",children:t.jsx(y,{value:ne,onValueChange:ye,children:t.jsx(v,{variant:"default",className:"gap-2 *:data-[slot=tab-indicator]:duration-0",children:te.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"tabular-nums text-xs",children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Font",children:t.jsx(y,{value:a.fontFamily,onValueChange:ve,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:W.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",style:{fontFamily:e.cssValue},children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Density",children:t.jsx(y,{value:a.density,onValueChange:je,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:ae.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Bubbles",children:t.jsx(y,{value:a.bubbleStyle,onValueChange:ke,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:re.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Chat Width",children:t.jsx(y,{value:a.chatWidth,onValueChange:Se,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:K.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Sidebar",children:t.jsx(y,{value:a.sidebarWidth,onValueChange:Ce,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:z.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})})]}),t.jsxs(b,{title:"Chat",tabId:"chat",activeTab:p,children:[t.jsx(s,{inline:!0,label:"Show tool messages",children:t.jsx(m,{checked:a.showToolMessages,onCheckedChange:e=>c({showToolMessages:e})})}),t.jsx(s,{inline:!0,label:"Show reasoning blocks",children:t.jsx(m,{checked:a.showReasoningBlocks,onCheckedChange:e=>c({showReasoningBlocks:e})})}),t.jsx(s,{inline:!0,label:"Show search sources",children:t.jsx(m,{checked:a.showSearchSources,onCheckedChange:e=>c({showSearchSources:e})})}),t.jsx(s,{inline:!0,label:"Inline File Preview",description:"Make file paths in messages clickable to preview file contents",children:t.jsx(m,{checked:a.inlineFilePreview,onCheckedChange:e=>c({inlineFilePreview:e})})})]}),t.jsxs(b,{title:"Workspace",tabId:"workspace",activeTab:p,children:[t.jsx(s,{inline:!0,label:"File Explorer",description:"Browse and edit workspace files from the sidebar",children:t.jsx(m,{checked:(()=>{try{const e=localStorage.getItem("opencami-file-explorer");return e===null?!0:e==="true"}catch{return!0}})(),onCheckedChange:e=>{localStorage.setItem("opencami-file-explorer",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Memory Viewer",description:"Browse and edit MEMORY.md and daily memory files",children:t.jsx(m,{checked:(()=>{try{const e=localStorage.getItem("opencami-memory-viewer");return e===null?!0:e==="true"}catch{return!0}})(),onCheckedChange:e=>{localStorage.setItem("opencami-memory-viewer",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Agent Manager (Beta)",description:"Show Agent Manager in sidebar for creating and managing agents",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("opencami-agent-manager")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("opencami-agent-manager",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Skills Browser (Beta)",description:"Browse and install skills from ClawHub",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("opencami-skills-browser")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("opencami-skills-browser",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Cron Jobs Panel (Beta)",description:"Show Cron Jobs in sidebar for managing OpenClaw cron schedules",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("opencami-cron-manager")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("opencami-cron-manager",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Dashboard (Beta)",description:"Show Dashboard in sidebar with system and gateway widgets",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("feature_dashboard")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("feature_dashboard",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Artifacts Preview (Beta)",description:"Show live HTML/SVG preview panel when AI generates code",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("feature_artifacts")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("feature_artifacts",String(e)),nt.getState().setEnabled(e)}})})]}),t.jsxs(b,{title:"Personas",tabId:"personas",activeTab:p,children:[U?t.jsx(s,{inline:!0,label:"Persona Picker",description:"Show persona picker in chat (20 personalities)",children:t.jsx(m,{checked:Pe,onCheckedChange:Ee})}):t.jsx(s,{inline:!0,label:"Persona Picker",description:"Install the Personas skill to unlock 20 AI personalities",children:t.jsx(m,{checked:!1,disabled:!0})}),!U&&t.jsx("div",{className:"pt-1",children:t.jsx("a",{href:"https://www.clawhub.ai/robbyczgw-cla/personas",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary-600 hover:text-primary-900 hover:underline",children:"Get it on ClawHub →"})})]}),t.jsxs(b,{title:"Text-to-Speech",tabId:"voice",activeTab:p,children:[t.jsx(s,{inline:!0,label:"Voice Playback",description:"Add a 🔊 button to AI messages for text-to-speech",children:t.jsx(m,{checked:oe,onCheckedChange:Ie})}),t.jsx(s,{inline:!0,label:"TTS Provider",description:"Choose which service generates speech",children:t.jsxs("select",{value:_,onChange:e=>xe(e.target.value),className:"rounded-md border border-primary-200 bg-surface px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500",children:[t.jsx("option",{value:"auto",children:"Auto"}),t.jsx("option",{value:"elevenlabs",children:"ElevenLabs"}),t.jsx("option",{value:"openai",children:"OpenAI"}),t.jsx("option",{value:"edge",children:"Edge TTS (free)"})]})}),_==="openai"&&t.jsx(s,{inline:!0,label:"Voice",description:"OpenAI voice selection",children:t.jsx("select",{value:ue,onChange:e=>be(e.target.value),className:"rounded-md border border-primary-200 bg-surface px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500",children:["alloy","echo","fable","onyx","nova","shimmer"].map(e=>t.jsx("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})})]}),t.jsx(b,{title:"Speech-to-Text",tabId:"voice",activeTab:p,children:t.jsx(s,{inline:!0,label:"STT Provider",description:"Choose which service transcribes your voice",children:t.jsxs("select",{value:he,onChange:e=>fe(e.target.value),className:"rounded-md border border-primary-200 bg-surface px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500",children:[t.jsx("option",{value:"auto",children:"Auto"}),t.jsx("option",{value:"elevenlabs",children:"ElevenLabs"}),t.jsx("option",{value:"openai",children:"OpenAI"}),t.jsx("option",{value:"browser",children:"Browser (free)"})]})})}),t.jsxs(b,{title:"LLM Features",tabId:"llm",activeTab:p,children:[t.jsxs("div",{className:"text-xs text-primary-500 mb-3",children:["Enhance session titles and follow-up suggestions using an LLM provider.",w.hasEnvKey&&t.jsx("span",{className:"block mt-1 text-green-600",children:"✓ Server has OPENAI_API_KEY configured"}),w.hasOpenRouterKey&&t.jsx("span",{className:"block mt-1 text-green-600",children:"✓ Server has OPENROUTER_API_KEY configured"}),w.hasKilocodeKey&&t.jsx("span",{className:"block mt-1 text-green-600",children:"✓ Server has KILOCODE_API_KEY configured"})]}),t.jsx(s,{inline:!0,label:"Provider",description:"Choose LLM provider for titles & follow-ups",children:t.jsxs("select",{value:u.llmProvider,onChange:e=>{const r=e.target.value;f({llmProvider:r,llmBaseUrl:"",llmModel:""})},className:"px-2 py-1 text-sm rounded-md border border-primary-200 bg-surface focus:outline-none focus:ring-2 focus:ring-primary-500",children:[t.jsx("option",{value:"openai",children:"OpenAI"}),t.jsx("option",{value:"openrouter",children:"OpenRouter"}),t.jsx("option",{value:"kilocode",children:"Kilo Gateway"}),t.jsx("option",{value:"ollama",children:"Ollama (local)"}),t.jsx("option",{value:"custom",children:"Custom"})]})}),t.jsx(s,{inline:!0,label:"Smart session titles",description:"Generate concise titles using AI",children:t.jsx(m,{checked:u.useLlmTitles,onCheckedChange:e=>f({useLlmTitles:e}),disabled:!w.isAvailable})}),t.jsx(s,{inline:!0,label:"Smart follow-up suggestions",description:"AI-generated contextual follow-ups",children:t.jsx(m,{checked:u.useLlmFollowUps,onCheckedChange:e=>f({useLlmFollowUps:e}),disabled:!w.isAvailable})}),t.jsxs("div",{className:"mt-2 space-y-2",children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-xs text-primary-500 mb-1",children:"Model"}),t.jsx("input",{type:"text",value:u.llmModel,onChange:e=>f({llmModel:e.target.value}),placeholder:H(u.llmProvider).model||"model-name",className:"w-full px-3 py-1.5 text-sm rounded-md border border-primary-200 bg-surface focus:outline-none focus:ring-2 focus:ring-primary-500"})]}),(u.llmProvider==="custom"||u.llmProvider==="ollama")&&t.jsxs("div",{children:[t.jsx("div",{className:"text-xs text-primary-500 mb-1",children:"Base URL"}),t.jsx("input",{type:"text",value:u.llmBaseUrl,onChange:e=>f({llmBaseUrl:e.target.value}),placeholder:H(u.llmProvider).baseUrl||"https://...",className:"w-full px-3 py-1.5 text-sm rounded-md border border-primary-200 bg-surface focus:outline-none focus:ring-2 focus:ring-primary-500"})]})]}),t.jsxs("div",{className:"mt-4 pt-3 border-t border-primary-100",children:[t.jsx("div",{className:"text-sm text-primary-800 mb-2",children:u.llmProvider==="ollama"?"API Key (optional)":"API Key"}),t.jsx("div",{className:"text-xs text-primary-500 mb-2",children:u.llmProvider==="ollama"?"Not required for local Ollama":w.hasEnvKey&&u.llmProvider==="openai"?"Optional: Override server key with your own":`Required for ${u.llmProvider==="openrouter"?"OpenRouter":u.llmProvider==="kilocode"?"Kilo Gateway":"LLM features"} (stored locally)`}),t.jsxs("div",{className:"text-xs text-amber-600 bg-amber-50 border border-amber-200 rounded-md px-2 py-1.5 mb-2",children:["⚠️ ",t.jsx("strong",{children:"Security Note:"})," API keys are stored in your browser's localStorage. This is convenient but not secure for shared computers. For production use, configure keys server-side via environment variables (OPENAI_API_KEY, OPENROUTER_API_KEY, KILOCODE_API_KEY)."]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{type:"password",value:g,onChange:e=>{R(e.target.value),k(null)},placeholder:"sk-...",className:"flex-1 px-3 py-1.5 text-sm rounded-md border border-primary-200 bg-surface focus:outline-none focus:ring-2 focus:ring-primary-500"}),t.jsx(O,{size:"sm",variant:"outline",onClick:Te,disabled:!g.trim()||M,className:"min-w-[60px]",children:M?t.jsx(C,{icon:$e,size:16,className:"animate-spin"}):"Test"})]}),S&&t.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-xs ${S.valid?"text-green-600":"text-red-600"}`,children:[t.jsx(C,{icon:S.valid?Y:Qe,size:14}),S.valid?"API key is valid":S.error||"Invalid API key"]}),u.llmApiKey&&t.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[t.jsxs("span",{className:"text-xs text-green-600 flex items-center gap-1",children:[t.jsx(C,{icon:Y,size:14}),"Key saved"]}),t.jsx(O,{size:"sm",variant:"ghost",onClick:Oe,className:"text-xs text-red-600 hover:text-red-700 hover:bg-red-50",children:"Clear"})]}),g&&g!==u.llmApiKey&&!S?.valid&&t.jsx(O,{size:"sm",variant:"outline",onClick:Ve,className:"mt-2 w-full",children:"Save without testing"})]})]}),t.jsxs(b,{title:"About",tabId:"about",activeTab:p,children:[t.jsx("div",{className:"text-sm text-primary-800",children:"OpenCami"}),t.jsxs("div",{className:"flex gap-4 pt-2",children:[t.jsx("a",{href:"https://github.com/robbyczgw-cla/opencami",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary-600 hover:text-primary-900 hover:underline",children:"GitHub"}),t.jsx("a",{href:"https://docs.openclaw.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary-600 hover:text-primary-900 hover:underline",children:"OpenClaw docs"})]})]})]})]}),t.jsx("div",{className:"mt-2 flex justify-end",children:t.jsx(G,{onClick:h,children:"Close"})})]})})})}export{Vt as SettingsDialog};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/skills-panel-CVh1I-7D.js","assets/main-CQKtcNr3.js","assets/button-8ab4wOwy.js","assets/tabs-CWfn44FL.js","assets/useControlled-CT2hRlcU.js","assets/useBaseUiId-DiwX_3so.js","assets/useCompositeItem-UPIPwR9H.js","assets/DirectionContext-CrIsc5n9.js","assets/event-DG3RKJz8.js","assets/composite-B2qsrzf3.js","assets/CSPContext-DI-5GAnQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as e,r as t,_ as r}from"./main-CQKtcNr3.js";const l=t.lazy(()=>r(()=>import("./skills-panel-CVh1I-7D.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(s=>({default:s.SkillsPanel})));function a(){return e.jsx(t.Suspense,{fallback:e.jsx("div",{className:"flex h-screen items-center justify-center text-primary-500 text-sm",children:"Loading…"}),children:e.jsx(l,{})})}export{a as component};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as o,j as e,L as H}from"./main-
|
|
1
|
+
import{r as o,j as e,L as H}from"./main-CQKtcNr3.js";import{H as m,r as W,h as f,d as D,D as A,y as E,J as I,e as R,A as _,B as J,i as F}from"./button-8ab4wOwy.js";import{T as K,a as Q,b as k}from"./tabs-CWfn44FL.js";import"./useControlled-CT2hRlcU.js";import"./useBaseUiId-DiwX_3so.js";import"./useCompositeItem-UPIPwR9H.js";import"./DirectionContext-CrIsc5n9.js";import"./event-DG3RKJz8.js";import"./composite-B2qsrzf3.js";import"./CSPContext-DI-5GAnQ.js";async function v(s){const n=await fetch(s);if(!n.ok)throw new Error(`HTTP ${n.status}`);const r=await n.json();if(!r.ok)throw new Error(r.error||"Unknown error");return r.skills}function b(){const[s,n]=o.useState([]),[r,l]=o.useState(!0),[c,a]=o.useState(null),i=o.useCallback(async()=>{l(!0),a(null);try{const t=await v("/api/skills?action=installed");n(t)}catch(t){a(t instanceof Error?t.message:String(t))}finally{l(!1)}},[]);return o.useEffect(()=>{i()},[i]),{skills:s,loading:r,error:c,refresh:i}}function Z(s,n){const[r,l]=o.useState([]),[c,a]=o.useState(!0),[i,t]=o.useState(null);return o.useEffect(()=>{let x=!1;return a(!0),t(null),v(`/api/skills?action=explore&sort=${s}&limit=${n}`).then(d=>{x||l(d)}).catch(d=>{x||t(d instanceof Error?d.message:String(d))}).finally(()=>{x||a(!1)}),()=>{x=!0}},[s,n]),{skills:r,loading:c,error:i}}function q(s){const[n,r]=o.useState([]),[l,c]=o.useState(!1),[a,i]=o.useState(null),t=o.useRef(null);return o.useEffect(()=>{if(t.current&&clearTimeout(t.current),!s.trim()){r([]),c(!1);return}return c(!0),t.current=setTimeout(()=>{v(`/api/skills?action=search&q=${encodeURIComponent(s)}&limit=10`).then(r).catch(x=>i(x instanceof Error?x.message:String(x))).finally(()=>c(!1))},400),()=>{t.current&&clearTimeout(t.current)}},[s]),{skills:n,loading:l,error:a}}function V(){const[s,n]=o.useState([]),[r,l]=o.useState(!0),[c,a]=o.useState(null),i=o.useCallback(async()=>{l(!0),a(null);try{const t=await v("/api/skills?action=my-skills");n(t)}catch(t){a(t instanceof Error?t.message:String(t))}finally{l(!1)}},[]);return o.useEffect(()=>{i()},[i]),{skills:s,loading:r,error:c,refresh:i}}function G(){const[s,n]=o.useState([]),[r,l]=o.useState(!0),[c,a]=o.useState(null),i=o.useCallback(async()=>{l(!0),a(null);try{const t=await v("/api/skills?action=recommended");n(t)}catch(t){a(t instanceof Error?t.message:String(t))}finally{l(!1)}},[]);return o.useEffect(()=>{i()},[i]),{skills:s,loading:r,error:c,refresh:i}}function M(){const[s,n]=o.useState(null),[r,l]=o.useState(null);return{install:o.useCallback(async a=>{n(a),l(null);try{const t=await(await fetch("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"install",slug:a})})).json();if(!t.ok)throw new Error(t.error||"Install failed")}catch(i){throw l(i instanceof Error?i.message:String(i)),i}finally{n(null)}},[]),installing:s,error:r}}function X(){const[s,n]=o.useState(null),[r,l]=o.useState(null);return{update:o.useCallback(async a=>{n(a),l(null);try{const t=await(await fetch("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update",slug:a})})).json();if(!t.ok)throw new Error(t.error||"Update failed")}catch(i){throw l(i instanceof Error?i.message:String(i)),i}finally{n(null)}},[]),updating:s,error:r}}const Y=new Set(["openclaw","clawhub","anthropic","robbyczgw-cla"]),ee=100;function U(s,n){if(n)return{type:"installed",label:"Installed"};const r=s.publisher||s.author||"",l=s.stats?.downloads||0;return Y.has(r.toLowerCase())||l>=ee?{type:"verified",label:"Verified"}:{type:"community",label:"Community"}}function $({type:s,label:n}){const r={verified:"bg-emerald-50 text-emerald-600 border-emerald-100",community:"bg-primary-50 text-primary-500 border-primary-100",installed:"bg-sky-50 text-sky-600 border-sky-100"};return e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-medium rounded-full border ${r[s]}`,title:`${n} Skill`,children:[e.jsx(m,{icon:s==="installed"?I:F,size:10,strokeWidth:2}),n]})}function B({skill:s,installed:n,installing:r,onInstall:l,onUpdate:c,updating:a,showUpdate:i,onClick:t}){const x=s.slug||"",d=s.displayName||x,p=s.summary,h=s.version||s.latestVersion?.version||"",y=s.stats?.downloads,j=U(s,n);return e.jsxs("div",{className:`
|
|
2
2
|
group rounded-lg border border-primary-100 bg-surface p-4
|
|
3
3
|
transition-all duration-150 ease-out
|
|
4
4
|
${t?"cursor-pointer hover:border-primary-200 hover:shadow-sm":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,w as he,j as V}from"./main-
|
|
1
|
+
import{r as i,w as he,j as V}from"./main-CQKtcNr3.js";import{ac as G,af as c,ab as P,E as ve,ad as pe,ag as K,c as H}from"./button-8ab4wOwy.js";import{u as be}from"./useControlled-CT2hRlcU.js";import{a as M,u as x,d as Q,e as ge,f as xe,g as ke,n as ye}from"./useBaseUiId-DiwX_3so.js";import{v as Ce,a as Ie}from"./visuallyHidden-COI6QeQH.js";const W=i.createContext(void 0);function Ve(){const e=i.useContext(W);if(e===void 0)throw new Error(G(63));return e}let Y=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Re={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ee={valid(e){return e===null?null:e?{[Y.valid]:""}:{[Y.invalid]:""}}};let J=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const X={...Ee,checked(e){return e?{[J.checked]:""}:{[J.unchecked]:""}}};function we(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}const Pe=i.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:c,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Z(){return i.useContext(Pe)}const Me=i.createContext({invalid:void 0,name:void 0,validityData:{state:Re,errors:[],error:"",value:"",initialValue:null},setValidityData:c,disabled:void 0,touched:!1,setTouched:c,dirty:!1,setDirty:c,filled:!1,setFilled:c,focused:!1,setFocused:c,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=P)=>e,getInputValidationProps:(e=P)=>e,inputRef:{current:null},commit:async()=>{}}});function T(e=!0){const t=i.useContext(Me);if(t.setValidityData===c&&!e)throw new Error(G(28));return t}function Te(e){const{enabled:t=!0,value:a,id:n,name:f,controlRef:s,commit:d}=e,{formRef:r}=Z(),{invalid:k,markedDirtyRef:y,validityData:C,setValidityData:p}=T(),o=M(e.getValue);x(()=>{if(!t)return;let u=a;u===void 0&&(u=o()),C.initialValue===null&&u!==null&&p(b=>({...b,initialValue:u}))},[t,p,a,C.initialValue,o]),x(()=>{!t||!n||r.current.fields.set(n,{getValue:o,name:f,controlRef:s,validityData:we(C,k),validate(u=!0){let b=a;b===void 0&&(b=o()),y.current=!0,u?he.flushSync(()=>d(b)):d(b)}})},[d,s,t,r,o,n,k,y,f,C,a]),x(()=>{const u=r.current.fields;return()=>{n&&u.delete(n)}},[r,n])}const ze=i.createContext({controlId:void 0,setControlId:c,labelId:void 0,setLabelId:c,messageIds:[],setMessageIds:c,getDescriptionProps:e=>e});function $(){return i.useContext(ze)}function Se(e={}){const{id:t,implicit:a=!1,controlRef:n}=e,{controlId:f,setControlId:s}=$(),d=Q(t);return x(()=>{if(!(!a&&!t||s===c)){if(a){const r=n?.current;ge(r)&&r.closest("label")!=null?s(t??null):s(f??d)}else t&&s(t);return()=>{t&&s(void 0)}}},[t,n,f,s,a,d]),f??d}function _e(e,t){const a=i.useRef(e),n=M(t);x(()=>{a.current!==e&&n(a.current)},[e,n]),x(()=>{a.current=e},[e])}const Be=i.forwardRef(function(t,a){const{checked:n,className:f,defaultChecked:s,id:d,inputRef:r,name:k,nativeButton:y=!1,onCheckedChange:C,readOnly:p=!1,required:o=!1,disabled:u=!1,render:b,uncheckedValue:z,value:E,...A}=t,{clearErrors:ee}=Z(),{state:S,setTouched:te,setDirty:ae,validityData:ne,setFilled:w,setFocused:_,shouldValidateOnChange:ie,validationMode:se,disabled:le,name:de,validation:m}=T(),{labelId:re}=$(),h=le||u,g=de??k,B=M(C),I=i.useRef(null),L=ve(I,r,m.inputRef),R=i.useRef(null),j=Q(),F=Se({id:d,implicit:!1,controlRef:R}),O=y?void 0:F,[l,N]=be({controlled:n,default:!!s,name:"Switch",state:"checked"});Te({id:j,commit:m.commit,value:l,controlRef:R,name:g,getValue:()=>l}),x(()=>{I.current&&w(I.current.checked)},[I,w]),_e(l,()=>{ee(g),ae(l!==ne.initialValue),w(l),ie()?m.commit(l):m.commit(l,!0)});const{getButtonProps:oe,buttonRef:ce}=xe({disabled:h,native:y}),ue={id:y?F:j,role:"switch","aria-checked":l,"aria-readonly":p||void 0,"aria-required":o||void 0,"aria-labelledby":re,onFocus(){h||_(!0)},onBlur(){const v=I.current;!v||h||(te(!0),_(!1),se==="onBlur"&&m.commit(v.checked))},onClick(v){p||h||(v.preventDefault(),I?.current?.click())}},fe=i.useMemo(()=>pe({checked:l,disabled:h,id:O,name:g,required:o,style:g?Ce:Ie,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:L,onChange(v){if(v.nativeEvent.defaultPrevented)return;const D=v.target.checked,U=ke(ye,v.nativeEvent);B?.(D,U),!U.isCanceled&&N(D)},onFocus(){R.current?.focus()}},m.getInputValidationProps,E!==void 0?{value:E}:P),[l,h,L,O,g,B,o,N,m,E]),q=i.useMemo(()=>({...S,checked:l,disabled:h,readOnly:p,required:o}),[S,l,h,p,o]),me=K("span",t,{state:q,ref:[a,R,ce],props:[ue,m.getValidationProps,A,oe],stateAttributesMapping:X});return V.jsxs(W.Provider,{value:q,children:[me,!l&&g&&z!==void 0&&V.jsx("input",{type:"hidden",name:g,value:z}),V.jsx("input",{...fe})]})}),Le=i.forwardRef(function(t,a){const{render:n,className:f,...s}=t,{state:d}=T(),r=Ve(),k={...d,...r};return K("span",t,{state:k,ref:a,stateAttributesMapping:X,props:s})});function De({className:e,...t}){return V.jsx(Be,{className:H("inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(5)] focus-visible:ring-2 focus-visible:ring-primary-950 focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary-900 data-unchecked:bg-primary-200 data-disabled:opacity-64 sm:[--thumb-size:--spacing(4)]",e),"data-slot":"switch",...t,children:V.jsx(Le,{className:H("pointer-events-none block aspect-square h-full origin-left in-[[role=switch]:active,[data-slot=label]:active]:not-data-disabled:scale-x-110 in-[[role=switch]:active,[data-slot=label]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.1)] rounded-(--thumb-size) bg-primary-50 shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s] data-checked:origin-[var(--thumb-size)_50%] data-checked:translate-x-[calc(var(--thumb-size)-4px)]"),"data-slot":"switch-thumb"})})}export{De as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as z}from"./main-DBmooBKx.js";import{ac as ht,ag as q,E as Rt,ah as et,ab as Mt,c as Z}from"./button-DdG8c-XQ.js";import{u as yt}from"./useControlled-8D4PSDAL.js";import{h as Et,i as Ct,a as Y,u as nt,d as St,f as wt,g as it,n as at,C as Pt}from"./useBaseUiId-Ckx_aJky.js";import{C as gt,u as At,g as Ht,a as Lt,c as Dt,i as J,b as Ot,d as kt,e as zt,f as _t,h as Kt}from"./useCompositeItem-CkvfeGmG.js";import{r as st,u as bt}from"./DirectionContext-B1cuzwIr.js";import{s as rt,A as Nt,a as Bt,i as lt,b as U,c as Q,H as Wt,E as jt,d as ct,e as tt,V as Ft,f as Yt,g as $t,h as Vt,M as Gt}from"./composite-Cx-QHT9o.js";import{d as Ut,o as ut,e as Zt,u as Xt}from"./event-Dwf9IDxK.js";import{u as qt}from"./CSPContext-nHSyQniZ.js";function Jt(){const[,t]=o.useState({});return o.useCallback(()=>{t({})},[])}function dt(t){const s=Et(t);let l=parseFloat(s.width)||0,b=parseFloat(s.height)||0;const i=Ct(t),a=i?t.offsetWidth:l,r=i?t.offsetHeight:b;return(st(l)!==a||st(b)!==r)&&(l=a,b=r),{width:l,height:b}}const pt=o.createContext(void 0);function X(){const t=o.useContext(pt);if(t===void 0)throw new Error(ht(64));return t}let Qt=(function(t){return t.activationDirection="data-activation-direction",t.orientation="data-orientation",t})({});const ot={tabActivationDirection:t=>({[Qt.activationDirection]:t})},te=o.forwardRef(function(s,l){const{className:b,defaultValue:i=0,onValueChange:a,orientation:r="horizontal",render:w,value:R,...P}=s,x=bt(),y=Object.hasOwn(s,"defaultValue"),d=o.useRef([]),[k,D]=o.useState(()=>new Map),[T,M]=yt({controlled:R,default:i,name:"Tabs",state:"value"}),v=R!==void 0,[h,c]=o.useState(()=>new Map),[E,p]=o.useState("none"),g=Y((e,m)=>{a?.(e,m),!m.isCanceled&&(M(e),p(m.activationDirection))}),f=Y((e,m)=>{D(u=>{if(u.get(e)===m)return u;const I=new Map(u);return I.set(e,m),I})}),A=Y((e,m)=>{D(u=>{if(!u.has(e)||u.get(e)!==m)return u;const I=new Map(u);return I.delete(e),I})}),n=o.useCallback(e=>k.get(e),[k]),C=o.useCallback(e=>{for(const m of h.values())if(e===m?.value)return m?.id},[h]),O=o.useCallback(e=>{if(e===void 0)return null;for(const[m,u]of h.entries())if(u!=null&&e===(u.value??u.index))return m;return null},[h]),H=o.useMemo(()=>({direction:x,getTabElementBySelectedValue:O,getTabIdByPanelValue:C,getTabPanelIdByValue:n,onValueChange:g,orientation:r,registerMountedTabPanel:f,setTabMap:c,unregisterMountedTabPanel:A,tabActivationDirection:E,value:T}),[x,O,C,n,g,r,f,c,A,E,T]),S=o.useMemo(()=>{for(const e of h.values())if(e!=null&&e.value===T)return e},[h,T]),L=o.useMemo(()=>{for(const e of h.values())if(e!=null&&!e.disabled)return e.value},[h]);nt(()=>{if(v||h.size===0)return;const e=S?.disabled,m=S==null&&T!==null;if(y&&e&&T===i||!e&&!m)return;const I=L??null;T!==I&&(M(I),p("none"))},[i,L,y,v,S,p,M,h,T]);const K=q("div",s,{state:{orientation:r,tabActivationDirection:E},ref:l,props:P,stateAttributesMapping:ot});return z.jsx(pt.Provider,{value:H,children:z.jsx(gt,{elementsRef:d,children:K})})}),mt="data-composite-item-active",vt=o.createContext(void 0);function xt(){const t=o.useContext(vt);if(t===void 0)throw new Error(ht(65));return t}const ee=o.forwardRef(function(s,l){const{className:b,disabled:i=!1,render:a,value:r,id:w,nativeButton:R=!0,...P}=s,{value:x,getTabPanelIdByValue:y,orientation:d}=X(),{activateOnFocus:k,highlightedTabIndex:D,onTabActivation:T,setHighlightedTabIndex:M,tabsListElement:v}=xt(),h=St(w),c=o.useMemo(()=>({disabled:i,id:h,value:r}),[i,h,r]),{compositeProps:E,compositeRef:p,index:g}=At({metadata:c}),f=r===x,A=o.useRef(!1);nt(()=>{if(A.current){A.current=!1;return}if(!(f&&g>-1&&D!==g))return;const u=v;if(u!=null){const I=Ut(ut(u));if(I&&Zt(u,I))return}i||M(g)},[f,g,D,M,i,v]);const{getButtonProps:n,buttonRef:C}=wt({disabled:i,native:R,focusableWhenDisabled:!0}),O=y(r),H=o.useRef(!1),S=o.useRef(!1);function L(u){f||i||T(r,it(at,u.nativeEvent,void 0,{activationDirection:"none"}))}function _(u){f||(g>-1&&!i&&M(g),!i&&k&&(!H.current||H.current&&S.current)&&T(r,it(at,u.nativeEvent,void 0,{activationDirection:"none"})))}function K(u){if(f||i)return;H.current=!0;function I(){H.current=!1,S.current=!1}(!u.button||u.button===0)&&(S.current=!0,ut(u.currentTarget).addEventListener("pointerup",I,{once:!0}))}const e=o.useMemo(()=>({disabled:i,active:f,orientation:d}),[i,f,d]);return q("button",s,{state:e,ref:[l,C,p],props:[E,{role:"tab","aria-controls":O,"aria-selected":f,id:h,onClick:L,onFocus:_,onPointerDown:K,[mt]:f?"":void 0,onKeyDownCapture(){A.current=!0}},P,n]})}),ne='!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();';let F=(function(t){return t.activeTabLeft="--active-tab-left",t.activeTabRight="--active-tab-right",t.activeTabTop="--active-tab-top",t.activeTabBottom="--active-tab-bottom",t.activeTabWidth="--active-tab-width",t.activeTabHeight="--active-tab-height",t})({});const oe={...ot,activeTabPosition:()=>null,activeTabSize:()=>null},ie=o.forwardRef(function(s,l){const{className:b,render:i,renderBeforeHydration:a=!1,...r}=s,{nonce:w}=qt(),{getTabElementBySelectedValue:R,orientation:P,tabActivationDirection:x,value:y}=X(),{tabsListElement:d}=xt(),[k,D]=o.useState(!1),{value:T}=X();Xt(()=>D(!0));const M=Jt();o.useEffect(()=>{if(y!=null&&d!=null&&typeof ResizeObserver<"u"){const L=new ResizeObserver(M);return L.observe(d),()=>{L.disconnect()}}},[y,d,M]);let v=0,h=0,c=0,E=0,p=0,g=0,f=!1;if(y!=null&&d!=null){const L=R(y);if(f=!0,L!=null){const{width:_,height:K}=dt(L),{width:e,height:m}=dt(d),u=L.getBoundingClientRect(),I=d.getBoundingClientRect(),j=e>0?I.width/e:1,G=m>0?I.height/m:1;if(Math.abs(j)>Number.EPSILON&&Math.abs(G)>Number.EPSILON){const N=u.left-I.left,$=u.top-I.top;v=N/j+d.scrollLeft-d.clientLeft,c=$/G+d.scrollTop-d.clientTop}else v=L.offsetLeft,c=L.offsetTop;p=_,g=K,h=d.scrollWidth-v-p,E=d.scrollHeight-c-g}}const A=o.useMemo(()=>f?{left:v,right:h,top:c,bottom:E}:null,[v,h,c,E,f]),n=o.useMemo(()=>f?{width:p,height:g}:null,[p,g,f]),C=o.useMemo(()=>{if(f)return{[F.activeTabLeft]:`${v}px`,[F.activeTabRight]:`${h}px`,[F.activeTabTop]:`${c}px`,[F.activeTabBottom]:`${E}px`,[F.activeTabWidth]:`${p}px`,[F.activeTabHeight]:`${g}px`}},[v,h,c,E,p,g,f]),O=f&&p>0&&g>0,H=o.useMemo(()=>({orientation:P,activeTabPosition:A,activeTabSize:n,tabActivationDirection:x}),[P,A,n,x]),S=q("span",s,{state:H,ref:l,props:[{role:"presentation",style:C,hidden:!O},r,{suppressHydrationWarning:!0}],stateAttributesMapping:oe});return T==null?null:z.jsxs(o.Fragment,{children:[S,!k&&a&&z.jsx("script",{nonce:w,dangerouslySetInnerHTML:{__html:ne},suppressHydrationWarning:!0})]})});function ae(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}const se=[];function re(t){const{itemSizes:s,cols:l=1,loopFocus:b=!0,dense:i=!1,orientation:a="both",direction:r,highlightedIndex:w,onHighlightedIndexChange:R,rootRef:P,enableHomeAndEndKeys:x=!1,stopEventPropagation:y=!1,disabledIndices:d,modifierKeys:k=se}=t,[D,T]=o.useState(0),M=l>1,v=o.useRef(null),h=Rt(v,P),c=o.useRef([]),E=o.useRef(!1),p=w??D,g=Y((n,C=!1)=>{if((R??T)(n),C){const O=c.current[n];rt(v.current,O,r,a)}}),f=Y(n=>{if(n.size===0||E.current)return;E.current=!0;const C=Array.from(n.keys()),O=C.find(S=>S?.hasAttribute(mt))??null,H=O?C.indexOf(O):-1;H!==-1&&g(H),rt(v.current,O,r,a)}),A=o.useMemo(()=>({"aria-orientation":a==="both"?void 0:a,ref:h,onFocus(n){!v.current||!lt(n.target)||n.target.setSelectionRange(0,n.target.value.length??0)},onKeyDown(n){const C=x?Nt:Bt;if(!C.has(n.key)||le(n,k)||!v.current)return;const H=r==="rtl",S=H?ct:Q,L={horizontal:S,vertical:U,both:S}[a],_=H?Q:ct,K={horizontal:_,vertical:tt,both:_}[a];if(lt(n.target)&&!ae(n.target)){const B=n.target.selectionStart,N=n.target.selectionEnd,$=n.target.value??"";if(B==null||n.shiftKey||B!==N||n.key!==K&&B<$.length||n.key!==L&&B>0)return}let e=p;const m=Ht(c,d),u=Lt(c,d);if(M){const B=s||Array.from({length:c.current.length},()=>({width:1,height:1})),N=Dt(B,l,i),$=N.findIndex(W=>W!=null&&!J(c,W,d)),Tt=N.reduce((W,V,It)=>V!=null&&!J(c,V,d)?It:W,-1);e=N[Ot({current:N.map(W=>W?c.current[W]:null)},{event:n,orientation:a,loopFocus:b,cols:l,disabledIndices:zt([...d||c.current.map((W,V)=>J(c,V)?V:void 0),void 0],N),minIndex:$,maxIndex:Tt,prevIndex:kt(p>u?m:p,B,N,l,n.key===U?"bl":n.key===Q?"tr":"tl"),rtl:H})]}const I={horizontal:[S],vertical:[U],both:[S,U]}[a],j={horizontal:[_],vertical:[tt],both:[_,tt]}[a],G=M?C:{horizontal:x?$t:Vt,vertical:x?Ft:Yt,both:C}[a];x&&(n.key===Wt?e=m:n.key===jt&&(e=u)),e===p&&(I.includes(n.key)||j.includes(n.key))&&(b&&e===u&&I.includes(n.key)?e=m:b&&e===m&&j.includes(n.key)?e=u:e=_t(c,{startingIndex:e,decrement:j.includes(n.key),disabledIndices:d})),e!==p&&!Kt(c,e)&&(y&&n.stopPropagation(),G.has(n.key)&&n.preventDefault(),g(e,!0),queueMicrotask(()=>{c.current[e]?.focus()}))}}),[l,i,r,d,c,x,p,M,s,b,h,k,g,a,y]);return o.useMemo(()=>({props:A,highlightedIndex:p,onHighlightedIndexChange:g,elementsRef:c,disabledIndices:d,onMapChange:f,relayKeyboardEvent:A.onKeyDown}),[A,p,g,c,d,f])}function le(t,s){for(const l of Gt.values())if(!s.includes(l)&&t.getModifierState(l))return!0;return!1}function ce(t){const{render:s,className:l,refs:b=et,props:i=et,state:a=Mt,stateAttributesMapping:r,highlightedIndex:w,onHighlightedIndexChange:R,orientation:P,dense:x,itemSizes:y,loopFocus:d,cols:k,enableHomeAndEndKeys:D,onMapChange:T,stopEventPropagation:M=!0,rootRef:v,disabledIndices:h,modifierKeys:c,highlightItemOnHover:E=!1,tag:p="div",...g}=t,f=bt(),{props:A,highlightedIndex:n,onHighlightedIndexChange:C,elementsRef:O,onMapChange:H,relayKeyboardEvent:S}=re({itemSizes:y,cols:k,loopFocus:d,dense:x,orientation:P,highlightedIndex:w,onHighlightedIndexChange:R,rootRef:v,stopEventPropagation:M,enableHomeAndEndKeys:D,direction:f,disabledIndices:h,modifierKeys:c}),L=q(p,t,{state:a,ref:b,props:[A,...i,g],stateAttributesMapping:r}),_=o.useMemo(()=>({highlightedIndex:n,onHighlightedIndexChange:C,highlightItemOnHover:E,relayKeyboardEvent:S}),[n,C,E,S]);return z.jsx(Pt.Provider,{value:_,children:z.jsx(gt,{elementsRef:O,onMapChange:K=>{T?.(K),H(K)},children:L})})}const ue=o.forwardRef(function(s,l){const{activateOnFocus:b=!1,className:i,loopFocus:a=!0,render:r,...w}=s,{getTabElementBySelectedValue:R,onValueChange:P,orientation:x,value:y,setTabMap:d,tabActivationDirection:k}=X(),[D,T]=o.useState(0),[M,v]=o.useState(null),h=de(y,x,M,R),c=Y((f,A)=>{if(f!==y){const n=h(f);A.activationDirection=n,P(f,A)}}),E=o.useMemo(()=>({orientation:x,tabActivationDirection:k}),[x,k]),p={"aria-orientation":x==="vertical"?"vertical":void 0,role:"tablist"},g=o.useMemo(()=>({activateOnFocus:b,highlightedTabIndex:D,onTabActivation:c,setHighlightedTabIndex:T,tabsListElement:M,value:y}),[b,D,c,T,M,y]);return z.jsx(vt.Provider,{value:g,children:z.jsx(ce,{render:r,className:i,state:E,refs:[l,v],props:[p,w],stateAttributesMapping:ot,highlightedIndex:D,enableHomeAndEndKeys:!0,loopFocus:a,orientation:x,onHighlightedIndexChange:T,onMapChange:d,disabledIndices:et})})});function ft(t,s){const{left:l,top:b}=t.getBoundingClientRect(),{left:i,top:a}=s.getBoundingClientRect(),r=l-i,w=b-a;return{left:r,top:w}}function de(t,s,l,b){const[i,a]=o.useState(null);return nt(()=>{if(t==null||l==null){a(null);return}const r=b(t);if(r==null){a(null);return}const{left:w,top:R}=ft(r,l);a(s==="horizontal"?w:R)},[s,b,l,t]),o.useCallback(r=>{if(r===t)return"none";if(r==null)return a(null),"none";if(r!=null&&l!=null){const w=b(r);if(w!=null){const{left:R,top:P}=ft(w,l);if(i==null)return a(s==="horizontal"?R:P),"none";if(s==="horizontal"){if(R<i)return a(R),"left";if(R>i)return a(R),"right"}else{if(P<i)return a(P),"up";if(P>i)return a(P),"down"}}}return"none"},[b,s,i,l,t])}function Ie({className:t,...s}){return z.jsx(te,{className:Z("flex flex-col gap-2 data-[orientation=vertical]:flex-row",t),"data-slot":"tabs",...s})}function Re({variant:t="default",className:s,children:l,...b}){return z.jsxs(ue,{className:Z("relative z-0 flex w-fit items-center justify-center gap-x-0.5 text-primary-600","data-[orientation=vertical]:flex-col",t==="default"?"p-0.5 text-primary-600/80":"data-[orientation=vertical]:px-1 data-[orientation=horizontal]:py-1",s),"data-slot":"tabs-list",...b,children:[l,z.jsx(ie,{className:Z("-translate-y-(--active-tab-bottom) absolute bottom-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) transition-[width,translate] duration-200 ease-in-out",t==="underline"?"data-[orientation=vertical]:-translate-x-px z-10 bg-[var(--opencami-accent)] data-[orientation=horizontal]:h-0.5 data-[orientation=vertical]:w-0.5 data-[orientation=horizontal]:translate-y-px":"z-0 rounded-md bg-[var(--opencami-accent-light)]"),"data-slot":"tab-indicator"})]})}function Me({className:t,...s}){return z.jsx(ee,{className:Z('[&_svg]:-mx-0.5 relative z-10 flex h-8 shrink-0 grow cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-3 text-sm font-medium outline-none transition-[color,background-color,box-shadow] hover:text-primary-900 focus-visible:ring-2 focus-visible:ring-[var(--opencami-accent)] data-disabled:pointer-events-none data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start data-active:text-primary-900 data-disabled:opacity-64 [&_svg:not([class*="size-"])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0',t),"data-slot":"tabs-tab",...s})}export{Ie as T,Re as a,Me as b};
|
|
1
|
+
import{r as o,j as z}from"./main-CQKtcNr3.js";import{ac as ht,ag as q,E as Rt,ah as et,ab as Mt,c as Z}from"./button-8ab4wOwy.js";import{u as yt}from"./useControlled-CT2hRlcU.js";import{h as Et,i as Ct,a as Y,u as nt,d as St,f as wt,g as it,n as at,C as Pt}from"./useBaseUiId-DiwX_3so.js";import{C as gt,u as At,g as Ht,a as Lt,c as Dt,i as J,b as Ot,d as kt,e as zt,f as _t,h as Kt}from"./useCompositeItem-UPIPwR9H.js";import{r as st,u as bt}from"./DirectionContext-CrIsc5n9.js";import{s as rt,A as Nt,a as Bt,i as lt,b as U,c as Q,H as Wt,E as jt,d as ct,e as tt,V as Ft,f as Yt,g as $t,h as Vt,M as Gt}from"./composite-B2qsrzf3.js";import{d as Ut,o as ut,e as Zt,u as Xt}from"./event-DG3RKJz8.js";import{u as qt}from"./CSPContext-DI-5GAnQ.js";function Jt(){const[,t]=o.useState({});return o.useCallback(()=>{t({})},[])}function dt(t){const s=Et(t);let l=parseFloat(s.width)||0,b=parseFloat(s.height)||0;const i=Ct(t),a=i?t.offsetWidth:l,r=i?t.offsetHeight:b;return(st(l)!==a||st(b)!==r)&&(l=a,b=r),{width:l,height:b}}const pt=o.createContext(void 0);function X(){const t=o.useContext(pt);if(t===void 0)throw new Error(ht(64));return t}let Qt=(function(t){return t.activationDirection="data-activation-direction",t.orientation="data-orientation",t})({});const ot={tabActivationDirection:t=>({[Qt.activationDirection]:t})},te=o.forwardRef(function(s,l){const{className:b,defaultValue:i=0,onValueChange:a,orientation:r="horizontal",render:w,value:R,...P}=s,x=bt(),y=Object.hasOwn(s,"defaultValue"),d=o.useRef([]),[k,D]=o.useState(()=>new Map),[T,M]=yt({controlled:R,default:i,name:"Tabs",state:"value"}),v=R!==void 0,[h,c]=o.useState(()=>new Map),[E,p]=o.useState("none"),g=Y((e,m)=>{a?.(e,m),!m.isCanceled&&(M(e),p(m.activationDirection))}),f=Y((e,m)=>{D(u=>{if(u.get(e)===m)return u;const I=new Map(u);return I.set(e,m),I})}),A=Y((e,m)=>{D(u=>{if(!u.has(e)||u.get(e)!==m)return u;const I=new Map(u);return I.delete(e),I})}),n=o.useCallback(e=>k.get(e),[k]),C=o.useCallback(e=>{for(const m of h.values())if(e===m?.value)return m?.id},[h]),O=o.useCallback(e=>{if(e===void 0)return null;for(const[m,u]of h.entries())if(u!=null&&e===(u.value??u.index))return m;return null},[h]),H=o.useMemo(()=>({direction:x,getTabElementBySelectedValue:O,getTabIdByPanelValue:C,getTabPanelIdByValue:n,onValueChange:g,orientation:r,registerMountedTabPanel:f,setTabMap:c,unregisterMountedTabPanel:A,tabActivationDirection:E,value:T}),[x,O,C,n,g,r,f,c,A,E,T]),S=o.useMemo(()=>{for(const e of h.values())if(e!=null&&e.value===T)return e},[h,T]),L=o.useMemo(()=>{for(const e of h.values())if(e!=null&&!e.disabled)return e.value},[h]);nt(()=>{if(v||h.size===0)return;const e=S?.disabled,m=S==null&&T!==null;if(y&&e&&T===i||!e&&!m)return;const I=L??null;T!==I&&(M(I),p("none"))},[i,L,y,v,S,p,M,h,T]);const K=q("div",s,{state:{orientation:r,tabActivationDirection:E},ref:l,props:P,stateAttributesMapping:ot});return z.jsx(pt.Provider,{value:H,children:z.jsx(gt,{elementsRef:d,children:K})})}),mt="data-composite-item-active",vt=o.createContext(void 0);function xt(){const t=o.useContext(vt);if(t===void 0)throw new Error(ht(65));return t}const ee=o.forwardRef(function(s,l){const{className:b,disabled:i=!1,render:a,value:r,id:w,nativeButton:R=!0,...P}=s,{value:x,getTabPanelIdByValue:y,orientation:d}=X(),{activateOnFocus:k,highlightedTabIndex:D,onTabActivation:T,setHighlightedTabIndex:M,tabsListElement:v}=xt(),h=St(w),c=o.useMemo(()=>({disabled:i,id:h,value:r}),[i,h,r]),{compositeProps:E,compositeRef:p,index:g}=At({metadata:c}),f=r===x,A=o.useRef(!1);nt(()=>{if(A.current){A.current=!1;return}if(!(f&&g>-1&&D!==g))return;const u=v;if(u!=null){const I=Ut(ut(u));if(I&&Zt(u,I))return}i||M(g)},[f,g,D,M,i,v]);const{getButtonProps:n,buttonRef:C}=wt({disabled:i,native:R,focusableWhenDisabled:!0}),O=y(r),H=o.useRef(!1),S=o.useRef(!1);function L(u){f||i||T(r,it(at,u.nativeEvent,void 0,{activationDirection:"none"}))}function _(u){f||(g>-1&&!i&&M(g),!i&&k&&(!H.current||H.current&&S.current)&&T(r,it(at,u.nativeEvent,void 0,{activationDirection:"none"})))}function K(u){if(f||i)return;H.current=!0;function I(){H.current=!1,S.current=!1}(!u.button||u.button===0)&&(S.current=!0,ut(u.currentTarget).addEventListener("pointerup",I,{once:!0}))}const e=o.useMemo(()=>({disabled:i,active:f,orientation:d}),[i,f,d]);return q("button",s,{state:e,ref:[l,C,p],props:[E,{role:"tab","aria-controls":O,"aria-selected":f,id:h,onClick:L,onFocus:_,onPointerDown:K,[mt]:f?"":void 0,onKeyDownCapture(){A.current=!0}},P,n]})}),ne='!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();';let F=(function(t){return t.activeTabLeft="--active-tab-left",t.activeTabRight="--active-tab-right",t.activeTabTop="--active-tab-top",t.activeTabBottom="--active-tab-bottom",t.activeTabWidth="--active-tab-width",t.activeTabHeight="--active-tab-height",t})({});const oe={...ot,activeTabPosition:()=>null,activeTabSize:()=>null},ie=o.forwardRef(function(s,l){const{className:b,render:i,renderBeforeHydration:a=!1,...r}=s,{nonce:w}=qt(),{getTabElementBySelectedValue:R,orientation:P,tabActivationDirection:x,value:y}=X(),{tabsListElement:d}=xt(),[k,D]=o.useState(!1),{value:T}=X();Xt(()=>D(!0));const M=Jt();o.useEffect(()=>{if(y!=null&&d!=null&&typeof ResizeObserver<"u"){const L=new ResizeObserver(M);return L.observe(d),()=>{L.disconnect()}}},[y,d,M]);let v=0,h=0,c=0,E=0,p=0,g=0,f=!1;if(y!=null&&d!=null){const L=R(y);if(f=!0,L!=null){const{width:_,height:K}=dt(L),{width:e,height:m}=dt(d),u=L.getBoundingClientRect(),I=d.getBoundingClientRect(),j=e>0?I.width/e:1,G=m>0?I.height/m:1;if(Math.abs(j)>Number.EPSILON&&Math.abs(G)>Number.EPSILON){const N=u.left-I.left,$=u.top-I.top;v=N/j+d.scrollLeft-d.clientLeft,c=$/G+d.scrollTop-d.clientTop}else v=L.offsetLeft,c=L.offsetTop;p=_,g=K,h=d.scrollWidth-v-p,E=d.scrollHeight-c-g}}const A=o.useMemo(()=>f?{left:v,right:h,top:c,bottom:E}:null,[v,h,c,E,f]),n=o.useMemo(()=>f?{width:p,height:g}:null,[p,g,f]),C=o.useMemo(()=>{if(f)return{[F.activeTabLeft]:`${v}px`,[F.activeTabRight]:`${h}px`,[F.activeTabTop]:`${c}px`,[F.activeTabBottom]:`${E}px`,[F.activeTabWidth]:`${p}px`,[F.activeTabHeight]:`${g}px`}},[v,h,c,E,p,g,f]),O=f&&p>0&&g>0,H=o.useMemo(()=>({orientation:P,activeTabPosition:A,activeTabSize:n,tabActivationDirection:x}),[P,A,n,x]),S=q("span",s,{state:H,ref:l,props:[{role:"presentation",style:C,hidden:!O},r,{suppressHydrationWarning:!0}],stateAttributesMapping:oe});return T==null?null:z.jsxs(o.Fragment,{children:[S,!k&&a&&z.jsx("script",{nonce:w,dangerouslySetInnerHTML:{__html:ne},suppressHydrationWarning:!0})]})});function ae(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}const se=[];function re(t){const{itemSizes:s,cols:l=1,loopFocus:b=!0,dense:i=!1,orientation:a="both",direction:r,highlightedIndex:w,onHighlightedIndexChange:R,rootRef:P,enableHomeAndEndKeys:x=!1,stopEventPropagation:y=!1,disabledIndices:d,modifierKeys:k=se}=t,[D,T]=o.useState(0),M=l>1,v=o.useRef(null),h=Rt(v,P),c=o.useRef([]),E=o.useRef(!1),p=w??D,g=Y((n,C=!1)=>{if((R??T)(n),C){const O=c.current[n];rt(v.current,O,r,a)}}),f=Y(n=>{if(n.size===0||E.current)return;E.current=!0;const C=Array.from(n.keys()),O=C.find(S=>S?.hasAttribute(mt))??null,H=O?C.indexOf(O):-1;H!==-1&&g(H),rt(v.current,O,r,a)}),A=o.useMemo(()=>({"aria-orientation":a==="both"?void 0:a,ref:h,onFocus(n){!v.current||!lt(n.target)||n.target.setSelectionRange(0,n.target.value.length??0)},onKeyDown(n){const C=x?Nt:Bt;if(!C.has(n.key)||le(n,k)||!v.current)return;const H=r==="rtl",S=H?ct:Q,L={horizontal:S,vertical:U,both:S}[a],_=H?Q:ct,K={horizontal:_,vertical:tt,both:_}[a];if(lt(n.target)&&!ae(n.target)){const B=n.target.selectionStart,N=n.target.selectionEnd,$=n.target.value??"";if(B==null||n.shiftKey||B!==N||n.key!==K&&B<$.length||n.key!==L&&B>0)return}let e=p;const m=Ht(c,d),u=Lt(c,d);if(M){const B=s||Array.from({length:c.current.length},()=>({width:1,height:1})),N=Dt(B,l,i),$=N.findIndex(W=>W!=null&&!J(c,W,d)),Tt=N.reduce((W,V,It)=>V!=null&&!J(c,V,d)?It:W,-1);e=N[Ot({current:N.map(W=>W?c.current[W]:null)},{event:n,orientation:a,loopFocus:b,cols:l,disabledIndices:zt([...d||c.current.map((W,V)=>J(c,V)?V:void 0),void 0],N),minIndex:$,maxIndex:Tt,prevIndex:kt(p>u?m:p,B,N,l,n.key===U?"bl":n.key===Q?"tr":"tl"),rtl:H})]}const I={horizontal:[S],vertical:[U],both:[S,U]}[a],j={horizontal:[_],vertical:[tt],both:[_,tt]}[a],G=M?C:{horizontal:x?$t:Vt,vertical:x?Ft:Yt,both:C}[a];x&&(n.key===Wt?e=m:n.key===jt&&(e=u)),e===p&&(I.includes(n.key)||j.includes(n.key))&&(b&&e===u&&I.includes(n.key)?e=m:b&&e===m&&j.includes(n.key)?e=u:e=_t(c,{startingIndex:e,decrement:j.includes(n.key),disabledIndices:d})),e!==p&&!Kt(c,e)&&(y&&n.stopPropagation(),G.has(n.key)&&n.preventDefault(),g(e,!0),queueMicrotask(()=>{c.current[e]?.focus()}))}}),[l,i,r,d,c,x,p,M,s,b,h,k,g,a,y]);return o.useMemo(()=>({props:A,highlightedIndex:p,onHighlightedIndexChange:g,elementsRef:c,disabledIndices:d,onMapChange:f,relayKeyboardEvent:A.onKeyDown}),[A,p,g,c,d,f])}function le(t,s){for(const l of Gt.values())if(!s.includes(l)&&t.getModifierState(l))return!0;return!1}function ce(t){const{render:s,className:l,refs:b=et,props:i=et,state:a=Mt,stateAttributesMapping:r,highlightedIndex:w,onHighlightedIndexChange:R,orientation:P,dense:x,itemSizes:y,loopFocus:d,cols:k,enableHomeAndEndKeys:D,onMapChange:T,stopEventPropagation:M=!0,rootRef:v,disabledIndices:h,modifierKeys:c,highlightItemOnHover:E=!1,tag:p="div",...g}=t,f=bt(),{props:A,highlightedIndex:n,onHighlightedIndexChange:C,elementsRef:O,onMapChange:H,relayKeyboardEvent:S}=re({itemSizes:y,cols:k,loopFocus:d,dense:x,orientation:P,highlightedIndex:w,onHighlightedIndexChange:R,rootRef:v,stopEventPropagation:M,enableHomeAndEndKeys:D,direction:f,disabledIndices:h,modifierKeys:c}),L=q(p,t,{state:a,ref:b,props:[A,...i,g],stateAttributesMapping:r}),_=o.useMemo(()=>({highlightedIndex:n,onHighlightedIndexChange:C,highlightItemOnHover:E,relayKeyboardEvent:S}),[n,C,E,S]);return z.jsx(Pt.Provider,{value:_,children:z.jsx(gt,{elementsRef:O,onMapChange:K=>{T?.(K),H(K)},children:L})})}const ue=o.forwardRef(function(s,l){const{activateOnFocus:b=!1,className:i,loopFocus:a=!0,render:r,...w}=s,{getTabElementBySelectedValue:R,onValueChange:P,orientation:x,value:y,setTabMap:d,tabActivationDirection:k}=X(),[D,T]=o.useState(0),[M,v]=o.useState(null),h=de(y,x,M,R),c=Y((f,A)=>{if(f!==y){const n=h(f);A.activationDirection=n,P(f,A)}}),E=o.useMemo(()=>({orientation:x,tabActivationDirection:k}),[x,k]),p={"aria-orientation":x==="vertical"?"vertical":void 0,role:"tablist"},g=o.useMemo(()=>({activateOnFocus:b,highlightedTabIndex:D,onTabActivation:c,setHighlightedTabIndex:T,tabsListElement:M,value:y}),[b,D,c,T,M,y]);return z.jsx(vt.Provider,{value:g,children:z.jsx(ce,{render:r,className:i,state:E,refs:[l,v],props:[p,w],stateAttributesMapping:ot,highlightedIndex:D,enableHomeAndEndKeys:!0,loopFocus:a,orientation:x,onHighlightedIndexChange:T,onMapChange:d,disabledIndices:et})})});function ft(t,s){const{left:l,top:b}=t.getBoundingClientRect(),{left:i,top:a}=s.getBoundingClientRect(),r=l-i,w=b-a;return{left:r,top:w}}function de(t,s,l,b){const[i,a]=o.useState(null);return nt(()=>{if(t==null||l==null){a(null);return}const r=b(t);if(r==null){a(null);return}const{left:w,top:R}=ft(r,l);a(s==="horizontal"?w:R)},[s,b,l,t]),o.useCallback(r=>{if(r===t)return"none";if(r==null)return a(null),"none";if(r!=null&&l!=null){const w=b(r);if(w!=null){const{left:R,top:P}=ft(w,l);if(i==null)return a(s==="horizontal"?R:P),"none";if(s==="horizontal"){if(R<i)return a(R),"left";if(R>i)return a(R),"right"}else{if(P<i)return a(P),"up";if(P>i)return a(P),"down"}}}return"none"},[b,s,i,l,t])}function Ie({className:t,...s}){return z.jsx(te,{className:Z("flex flex-col gap-2 data-[orientation=vertical]:flex-row",t),"data-slot":"tabs",...s})}function Re({variant:t="default",className:s,children:l,...b}){return z.jsxs(ue,{className:Z("relative z-0 flex w-fit items-center justify-center gap-x-0.5 text-primary-600","data-[orientation=vertical]:flex-col",t==="default"?"p-0.5 text-primary-600/80":"data-[orientation=vertical]:px-1 data-[orientation=horizontal]:py-1",s),"data-slot":"tabs-list",...b,children:[l,z.jsx(ie,{className:Z("-translate-y-(--active-tab-bottom) absolute bottom-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) transition-[width,translate] duration-200 ease-in-out",t==="underline"?"data-[orientation=vertical]:-translate-x-px z-10 bg-[var(--opencami-accent)] data-[orientation=horizontal]:h-0.5 data-[orientation=vertical]:w-0.5 data-[orientation=horizontal]:translate-y-px":"z-0 rounded-md bg-[var(--opencami-accent-light)]"),"data-slot":"tab-indicator"})]})}function Me({className:t,...s}){return z.jsx(ee,{className:Z('[&_svg]:-mx-0.5 relative z-10 flex h-8 shrink-0 grow cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-3 text-sm font-medium outline-none transition-[color,background-color,box-shadow] hover:text-primary-900 focus-visible:ring-2 focus-visible:ring-[var(--opencami-accent)] data-disabled:pointer-events-none data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start data-active:text-primary-900 data-disabled:opacity-64 [&_svg:not([class*="size-"])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0',t),"data-slot":"tabs-tab",...s})}export{Ie as T,Re as a,Me as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,r as s}from"./main-
|
|
1
|
+
import{j as t,r as s}from"./main-CQKtcNr3.js";import{C as a,a as m,b as p}from"./_sessionKey-B4NZmxf3.js";import{H as l,T as c,B as d}from"./button-8ab4wOwy.js";import"./useQuery-Boaa6oF3.js";import"./tooltip-CSGMH2t4.js";import"./popupStateMapping-DkI2OCkW.js";import"./useBaseUiId-DiwX_3so.js";import"./event-DG3RKJz8.js";import"./visuallyHidden-COI6QeQH.js";import"./DirectionContext-CrIsc5n9.js";import"./useMutation-rx8UH99I.js";import"./use-file-explorer-state-BYVzjwPA.js";import"./composite-B2qsrzf3.js";import"./react-WkSlhZJd.js";import"./useControlled-CT2hRlcU.js";import"./CSPContext-DI-5GAnQ.js";import"./menu-D26Vmgxl.js";import"./useCompositeItem-UPIPwR9H.js";import"./opencami-logo-BSed2Wez.js";import"./proxy-CHQ-VCN1.js";import"./markdown-DFJF-FsV.js";import"./index-BXiha-Vz.js";import"./index-T4TOjvD0.js";function x(){const[i,e]=s.useState(()=>typeof window<"u"?window.innerWidth<768:!1);return s.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia("(max-width: 767px)"),o=n=>e(n.matches);return r.addEventListener("change",o),e(r.matches),()=>r.removeEventListener("change",o)},[]),i}function P({content:i}){const e=x();return t.jsx("div",{className:"inline-flex flex-col",children:t.jsxs(a,{defaultOpen:!e,children:[t.jsxs(m,{render:t.jsx(d,{variant:"ghost",className:"h-auto gap-1.5 px-1.5 py-0.5 -mx-2"}),children:[t.jsx("span",{className:"text-sm font-medium text-primary-900",children:"Thinking"}),t.jsx(l,{icon:c,size:14,strokeWidth:1.5,className:"text-primary-900 transition-transform duration-150 group-data-panel-open:rotate-180"})]}),t.jsx(p,{children:t.jsx("div",{className:"pt-1 mb-3",children:t.jsx("p",{className:"text-sm text-primary-700 whitespace-pre-wrap",children:i})})})]})})}export{P as Thinking};
|