ekarouter 1.0.0
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/README.md +36 -0
- package/bin/cli.js +192 -0
- package/binaries/ekarouter-linux-amd64 +0 -0
- package/binaries/ekarouter-windows-amd64.exe +0 -0
- package/package.json +36 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/assets/LoginView-CSzx0ltN.js +1 -0
- package/public/assets/OrangeSwitch-Dc_G3ztN.js +1 -0
- package/public/assets/QueryClientProvider-BjElddVn.js +1 -0
- package/public/assets/_id-BC10EHRw.js +4 -0
- package/public/assets/_id-CnBJVbQB.js +2 -0
- package/public/assets/api-lXjeGSiV.js +2 -0
- package/public/assets/bot-mZlhzHVu.js +1 -0
- package/public/assets/boxes-DXduN63I.js +1 -0
- package/public/assets/callback-D2O49UZw.js +2 -0
- package/public/assets/callback-pJodpDyd.js +1 -0
- package/public/assets/check-36OnHiEM.js +1 -0
- package/public/assets/chevron-down-DxUrtHFo.js +1 -0
- package/public/assets/chevron-right-CHJcvRU6.js +1 -0
- package/public/assets/circle-alert-CcGnUa7l.js +1 -0
- package/public/assets/cli-tools-DCOrwuor.js +21 -0
- package/public/assets/cloud-upload-D41DfGnv.js +1 -0
- package/public/assets/code-xml-BsvsUoDv.js +1 -0
- package/public/assets/combos-Df1jA7_R.js +1 -0
- package/public/assets/console-log-Bl-Kc0eo.js +2 -0
- package/public/assets/copy-B1k2VT2A.js +1 -0
- package/public/assets/createLucideIcon-CLdWFMku.js +1 -0
- package/public/assets/dialog-B56WVEML.js +41 -0
- package/public/assets/dist-yiyhte89.js +1 -0
- package/public/assets/endpoint-C-3fXtUc.js +36 -0
- package/public/assets/external-link-BYVStqz6.js +1 -0
- package/public/assets/eye-Cbs9C6DS.js +1 -0
- package/public/assets/eye-off-DIe2-cve.js +1 -0
- package/public/assets/file-text-BRzD_S8I.js +1 -0
- package/public/assets/flask-conical-CoRklKsr.js +1 -0
- package/public/assets/globe-hcLYcRzz.js +1 -0
- package/public/assets/hard-drive-Dakvr_if.js +1 -0
- package/public/assets/headerSearch-C758FsaX.js +1 -0
- package/public/assets/image-B10s4838.js +1 -0
- package/public/assets/jsx-runtime-B-hcVAMW.js +1 -0
- package/public/assets/key-BXUPFSjV.js +1 -0
- package/public/assets/kit-DGWILC5k.js +1 -0
- package/public/assets/laptop-D_8f9_v7.js +1 -0
- package/public/assets/layers-C_9oEa0w.js +1 -0
- package/public/assets/loader-circle-NEOay2w5.js +1 -0
- package/public/assets/lock-Chb45-Rn.js +1 -0
- package/public/assets/log-out-wyRkCSAT.js +1 -0
- package/public/assets/login-BuQTIKrL.js +1 -0
- package/public/assets/media-providers-C_wofVbG.js +1 -0
- package/public/assets/mic-D6DQAnIR.js +1 -0
- package/public/assets/network-D0tNT-6h.js +1 -0
- package/public/assets/pencil-CFgylVBP.js +1 -0
- package/public/assets/play-CPV0a6Tn.js +1 -0
- package/public/assets/playground-BIwkZcr_.js +67 -0
- package/public/assets/plus-qKI-KwZh.js +1 -0
- package/public/assets/preload-helper-CzRBhNKp.js +1 -0
- package/public/assets/providers-D8WoK8lA.js +1 -0
- package/public/assets/providersData-lrEpUDQM.js +1 -0
- package/public/assets/proxy-pools-BusHbtGD.js +5 -0
- package/public/assets/react-dom-8HkkFvw6.js +1 -0
- package/public/assets/refresh-cw-CHzni4H4.js +1 -0
- package/public/assets/routes-r_aF-Xnw.js +1 -0
- package/public/assets/search-BtJsgOj6.js +1 -0
- package/public/assets/server-CAbKLNFx.js +1 -0
- package/public/assets/settings-Tk-iCnFy.js +1 -0
- package/public/assets/shield-CMYlc0qf.js +1 -0
- package/public/assets/skills-D0d-ShKH.js +1 -0
- package/public/assets/spa-Bs7oEq98.js +10 -0
- package/public/assets/sparkles-DZ5Pl1vD.js +1 -0
- package/public/assets/styles-BSGa23zc.css +2 -0
- package/public/assets/terminal-BkaGpO2M.js +1 -0
- package/public/assets/theme-o081sJEj.js +1 -0
- package/public/assets/token-saver-DgfF_Mvq.js +1 -0
- package/public/assets/trash-2-D9HI9O7Q.js +1 -0
- package/public/assets/triangle-alert-DUFscLic.js +1 -0
- package/public/assets/upload--8EEkrQJ.js +1 -0
- package/public/assets/usage-D2lS5DQa.js +56 -0
- package/public/assets/useNavigate-D06Ztr27.js +1 -0
- package/public/assets/useQuery-BrM5_EQu.js +1 -0
- package/public/assets/utils-B6KiDbIe.js +1 -0
- package/public/assets/volume-2-DoDae9nb.js +1 -0
- package/public/assets/wifi-Bsq09YFd.js +1 -0
- package/public/assets/x-CGuQtexA.js +1 -0
- package/public/assets/zap-BS7lyU9U.js +1 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/favicon.png +0 -0
- package/public/favicon.svg +3 -0
- package/public/icon-192.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/icon.png +0 -0
- package/public/icons.svg +24 -0
- package/public/index.html +55 -0
- package/public/logo-icon-dark.svg +28 -0
- package/public/logo.png +0 -0
- package/public/providers/agentrouter.png +0 -0
- package/public/providers/alicode-intl.png +0 -0
- package/public/providers/alicode.png +0 -0
- package/public/providers/alims-intl.png +0 -0
- package/public/providers/alitp-intl.png +0 -0
- package/public/providers/amp.png +0 -0
- package/public/providers/anthropic-m.png +0 -0
- package/public/providers/anthropic.png +0 -0
- package/public/providers/antigravity.png +0 -0
- package/public/providers/api-airforce.png +0 -0
- package/public/providers/assemblyai.png +0 -0
- package/public/providers/aws-polly.png +0 -0
- package/public/providers/azure.png +0 -0
- package/public/providers/baidu.png +0 -0
- package/public/providers/bazaarlink.png +0 -0
- package/public/providers/black-forest-labs.png +0 -0
- package/public/providers/blackbox.png +0 -0
- package/public/providers/bluesminds.png +0 -0
- package/public/providers/brave-search.png +0 -0
- package/public/providers/bynara.svg +28 -0
- package/public/providers/byteplus.png +0 -0
- package/public/providers/cartesia.png +0 -0
- package/public/providers/cerebras.png +0 -0
- package/public/providers/chutes.png +0 -0
- package/public/providers/claude.png +0 -0
- package/public/providers/cline.png +0 -0
- package/public/providers/clinepass.png +0 -0
- package/public/providers/cloudflare-ai.png +0 -0
- package/public/providers/codebuddy-cn.png +0 -0
- package/public/providers/codebuddy-intl.png +0 -0
- package/public/providers/codex.png +0 -0
- package/public/providers/cohere.png +0 -0
- package/public/providers/comfyui.png +0 -0
- package/public/providers/commandcode.png +0 -0
- package/public/providers/continue.png +0 -0
- package/public/providers/copilot.png +0 -0
- package/public/providers/coqui.png +0 -0
- package/public/providers/cursor.png +0 -0
- package/public/providers/deepgram.png +0 -0
- package/public/providers/deepseek-tui.png +0 -0
- package/public/providers/deepseek.png +0 -0
- package/public/providers/devin-cli.png +0 -0
- package/public/providers/droid.png +0 -0
- package/public/providers/edge-tts.png +0 -0
- package/public/providers/elevenlabs.png +0 -0
- package/public/providers/exa.png +0 -0
- package/public/providers/fal-ai.png +0 -0
- package/public/providers/featherless.png +0 -0
- package/public/providers/firecrawl.png +0 -0
- package/public/providers/fireworks.png +0 -0
- package/public/providers/fish-audio.png +0 -0
- package/public/providers/gemini-cli.png +0 -0
- package/public/providers/gemini.png +0 -0
- package/public/providers/github.png +0 -0
- package/public/providers/gitlab.png +0 -0
- package/public/providers/glm-cn.png +0 -0
- package/public/providers/glm.png +0 -0
- package/public/providers/google-pse.png +0 -0
- package/public/providers/google-tts.png +0 -0
- package/public/providers/grok-cli.png +0 -0
- package/public/providers/grok-web.png +0 -0
- package/public/providers/groq.png +0 -0
- package/public/providers/hermes.png +0 -0
- package/public/providers/huggingface.png +0 -0
- package/public/providers/hyperbolic.png +0 -0
- package/public/providers/iflow.png +0 -0
- package/public/providers/inworld.png +0 -0
- package/public/providers/jcode.png +0 -0
- package/public/providers/jina-ai.png +0 -0
- package/public/providers/jina-reader.png +0 -0
- package/public/providers/kilo-gateway.png +0 -0
- package/public/providers/kilocode.png +0 -0
- package/public/providers/kimchi.png +0 -0
- package/public/providers/kimchi.svg +4 -0
- package/public/providers/kimi-coding.png +0 -0
- package/public/providers/kimi.png +0 -0
- package/public/providers/kiro.png +0 -0
- package/public/providers/linkup.png +0 -0
- package/public/providers/llm7.png +0 -0
- package/public/providers/local-device.png +0 -0
- package/public/providers/longcat.png +0 -0
- package/public/providers/mimo-free.png +0 -0
- package/public/providers/minimax-cn.png +0 -0
- package/public/providers/minimax.png +0 -0
- package/public/providers/mistral.png +0 -0
- package/public/providers/mmf.png +0 -0
- package/public/providers/morph.png +0 -0
- package/public/providers/nanobanana.png +0 -0
- package/public/providers/nara.svg +28 -0
- package/public/providers/nebius.png +0 -0
- package/public/providers/novita.png +0 -0
- package/public/providers/nvidia.png +0 -0
- package/public/providers/oai-cc.png +0 -0
- package/public/providers/oai-r.png +0 -0
- package/public/providers/ollama-local.png +0 -0
- package/public/providers/ollama.png +0 -0
- package/public/providers/openai.png +0 -0
- package/public/providers/openclaw.png +0 -0
- package/public/providers/opencode-go.png +0 -0
- package/public/providers/opencode.png +0 -0
- package/public/providers/opendesign.png +0 -0
- package/public/providers/openrouter.png +0 -0
- package/public/providers/perplexity-agent.png +0 -0
- package/public/providers/perplexity-web.png +0 -0
- package/public/providers/perplexity.png +0 -0
- package/public/providers/playht.png +0 -0
- package/public/providers/poolside.png +0 -0
- package/public/providers/qoder.png +0 -0
- package/public/providers/qwen.png +0 -0
- package/public/providers/recraft.png +0 -0
- package/public/providers/reka.png +0 -0
- package/public/providers/roo.png +0 -0
- package/public/providers/runwayml.png +0 -0
- package/public/providers/sambanova.png +0 -0
- package/public/providers/sdwebui.png +0 -0
- package/public/providers/searchapi.png +0 -0
- package/public/providers/searxng.png +0 -0
- package/public/providers/selfhosted-embedding.png +0 -0
- package/public/providers/selfhosted-stt.png +0 -0
- package/public/providers/selfhosted-tts.png +0 -0
- package/public/providers/serper.png +0 -0
- package/public/providers/siliconflow.png +0 -0
- package/public/providers/stability-ai.png +0 -0
- package/public/providers/tavily.png +0 -0
- package/public/providers/tencent.png +0 -0
- package/public/providers/together.png +0 -0
- package/public/providers/tokenrouter.png +0 -0
- package/public/providers/topaz.png +0 -0
- package/public/providers/tortoise.png +0 -0
- package/public/providers/trae.png +0 -0
- package/public/providers/venice.png +0 -0
- package/public/providers/vercel-ai-gateway.png +0 -0
- package/public/providers/vercel.png +0 -0
- package/public/providers/vertex-partner.png +0 -0
- package/public/providers/vertex.png +0 -0
- package/public/providers/volcengine-ark.png +0 -0
- package/public/providers/voyage-ai.png +0 -0
- package/public/providers/windsurf.png +0 -0
- package/public/providers/workbuddy.png +0 -0
- package/public/providers/xai.png +0 -0
- package/public/providers/xiaomi-mimo.png +0 -0
- package/public/providers/xiaomi-tokenplan.png +0 -0
- package/public/providers/xquik.png +0 -0
- package/public/providers/youcom.png +0 -0
- package/public/providers/zed.png +0 -0
- package/public/robots.txt +14 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{t as r}from"./createLucideIcon-CLdWFMku.js";import{t as i}from"./check-36OnHiEM.js";import{t as a}from"./chevron-down-DxUrtHFo.js";import{t as o}from"./loader-circle-NEOay2w5.js";import{t as s}from"./refresh-cw-CHzni4H4.js";import{t as c}from"./x-CGuQtexA.js";import{t as l}from"./utils-B6KiDbIe.js";var u=r(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),d=e(t(),1),f=n();function p({children:e,title:t,subtitle:n,icon:r,action:i,padding:a=`md`,hover:o=!1,elev:s=!1,className:c,onClick:u}){return(0,f.jsxs)(`div`,{onClick:u,className:l(`relative rounded-2xl border border-border bg-card text-card-foreground shadow-xs transition-all duration-200`,s&&`shadow-md border-border-strong`,o&&`hover:border-primary/40 hover:shadow-md cursor-pointer`,{none:``,xs:`p-3`,sm:`p-4`,md:`p-5 sm:p-6`,lg:`p-6 sm:p-8`}[a],c),children:[(t||i||r)&&(0,f.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[r&&(0,f.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border bg-muted/60 text-primary`,children:r}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[t&&(0,f.jsx)(`h3`,{className:`truncate text-sm font-semibold tracking-tight text-foreground sm:text-base`,children:t}),n&&(0,f.jsx)(`p`,{className:`truncate text-xs text-muted-foreground mt-0.5`,children:n})]})]}),i&&(0,f.jsx)(`div`,{className:`shrink-0`,children:i})]}),e]})}p.Header=function({title:e,subtitle:t,icon:n,action:r,className:i,children:a}){return(0,f.jsxs)(`div`,{className:l(`flex flex-wrap items-center justify-between gap-3 border-b border-border/60 pb-3.5 mb-4`,i),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[n&&(0,f.jsx)(`span`,{className:`text-primary shrink-0`,children:n}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[e&&(0,f.jsx)(`h3`,{className:`text-sm font-semibold text-foreground truncate`,children:e}),t&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t})]})]}),r&&(0,f.jsx)(`div`,{className:`shrink-0`,children:r}),a]})},p.Body=function({children:e,className:t}){return(0,f.jsx)(`div`,{className:l(`space-y-4`,t),children:e})},p.Section=function({children:e,className:t}){return(0,f.jsx)(`div`,{className:l(`rounded-xl border border-border bg-muted/40 p-4 transition-colors`,t),children:e})},p.Row=function({children:e,className:t,hover:n=!0,onClick:r}){return(0,f.jsx)(`div`,{onClick:r,className:l(`flex items-center justify-between gap-3 border-b border-border/50 px-4 py-3.5 last:border-b-0 transition-colors`,n&&`hover:bg-hover`,r&&`cursor-pointer`,t),children:e})},p.ListItem=function({icon:e,title:t,subtitle:n,badge:r,actions:i,className:a,children:o}){return(0,f.jsxs)(`div`,{className:l(`flex flex-wrap items-center justify-between gap-3 border-b border-border/50 px-4 py-3.5 last:border-b-0 hover:bg-hover transition-colors`,a),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[e&&(0,f.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-hover/80 text-muted-foreground`,children:e}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-sm font-medium text-foreground truncate`,children:t}),r]}),n&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:n})]})]}),i&&(0,f.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:i}),o]})};function m({variant:e=`outline`,size:t=`md`,icon:n,iconRight:r,loading:i=!1,fullWidth:a=!1,disabled:s,className:c,children:u,...d}){let p={xs:`h-7 px-2.5 text-[11px] rounded-[6px] gap-1.5`,sm:`h-8 px-3 text-xs rounded-[7px] gap-2 font-medium`,md:`h-9 px-3.5 text-[13px] rounded-[8px] gap-2 font-medium`,lg:`h-10 px-4 text-sm rounded-[9px] gap-2.5 font-medium`,icon:`h-7 w-7 p-0 rounded-[6px] justify-center`},m={primary:`bg-primary hover:bg-primary-light text-primary-foreground font-semibold shadow-xs border border-primary active:brightness-95`,secondary:`bg-muted hover:bg-hover text-foreground border border-border shadow-xs active:bg-muted`,outline:`bg-card hover:bg-hover text-foreground border border-border active:bg-hover/80`,ghost:`bg-transparent hover:bg-hover text-muted-foreground hover:text-foreground border border-transparent active:bg-hover/80`,"ghost-danger":`bg-transparent hover:bg-danger/10 text-danger hover:text-danger/90 border border-transparent active:bg-danger/20`,danger:`bg-danger hover:brightness-110 text-white font-medium shadow-xs border border-danger active:brightness-90`,"danger-outline":`bg-transparent hover:bg-danger/10 text-danger border border-danger/30 active:bg-danger/20`,success:`bg-success hover:brightness-110 text-white font-medium shadow-xs border border-success active:brightness-90`};return(0,f.jsxs)(`button`,{...d,disabled:s||i,className:l(`focus-ring inline-flex items-center justify-center transition-all duration-150 ease-out cursor-pointer select-none`,`active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50 disabled:active:scale-100`,m[e],p[t],a&&`w-full`,c),children:[i?(0,f.jsx)(o,{className:`h-3.5 w-3.5 animate-spin shrink-0`}):n?(0,f.jsx)(`span`,{className:`shrink-0 flex items-center justify-center [&>svg]:h-3.5 [&>svg]:w-3.5`,children:n}):null,u,r&&!i&&(0,f.jsx)(`span`,{className:`shrink-0 flex items-center justify-center [&>svg]:h-3.5 [&>svg]:w-3.5`,children:r})]})}function h({label:e,icon:t,shortcut:n,error:r,hint:i,action:a,className:o,disabled:s,...c}){return(0,f.jsxs)(`div`,{className:`flex w-full flex-col gap-1.5`,children:[e&&(0,f.jsxs)(`label`,{className:`text-xs font-medium text-foreground`,children:[e,c.required&&(0,f.jsx)(`span`,{className:`ml-1 text-danger`,children:`*`})]}),(0,f.jsxs)(`div`,{className:`relative flex items-center w-full`,children:[t&&(0,f.jsx)(`div`,{className:`pointer-events-none absolute left-3 flex items-center text-muted-foreground [&>svg]:h-4 [&>svg]:w-4`,children:t}),(0,f.jsx)(`input`,{...c,disabled:s,className:l(`focus-ring h-9 w-full rounded-[8px] border border-border/80 bg-hover/40 px-3 text-[13px] text-foreground placeholder:text-dim transition-all`,t&&`pl-9`,(n||a)&&`pr-12`,r&&`border-danger ring-1 ring-danger/40 focus-visible:border-danger`,s&&`cursor-not-allowed opacity-50`,o)}),n&&(0,f.jsx)(`span`,{className:`pointer-events-none absolute right-2.5 rounded bg-hover px-1.5 py-0.5 text-[10px] font-mono text-dim border border-border/60`,children:n}),a&&(0,f.jsx)(`div`,{className:`absolute right-2 flex items-center`,children:a})]}),r&&(0,f.jsx)(`p`,{className:`text-[11px] text-danger`,children:r}),i&&!r&&(0,f.jsx)(`p`,{className:`text-[11px] text-dim`,children:i})]})}function g({label:e,error:t,hint:n,placeholder:r=`Select an option`,options:o,value:s,onChange:c,className:u,triggerClassName:p,compact:m=!1,children:h,disabled:g,required:_,...v}){let[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(!1),C=(0,d.useRef)(null),w=(0,d.useRef)(null),T=(0,d.useRef)(null),E=(0,d.useMemo)(()=>{if(o&&o.length>0)return o;let e=[];return d.Children.forEach(h,t=>{if((0,d.isValidElement)(t)){let n=t.props,i=n.value===void 0?``:String(n.value),a=``;if(typeof n.children==`string`&&n.children.trim()?a=n.children.trim():typeof n.children==`number`?a=String(n.children):i&&(a=i),!a&&!i&&e.length>0)return;e.push({label:a||i||r||`Option`,value:i,disabled:!!n.disabled})}}),e},[o,h,r]),D=(0,d.useMemo)(()=>s===void 0||s===``?E.find(e=>e.value===``):E.find(e=>String(e.value)===String(s)),[E,s]),O=D?D.label:s!==void 0&&s!==``?String(s):r,k=()=>{if(!g){if(!y&&w.current){let e=w.current.getBoundingClientRect(),t=window.innerHeight-e.bottom;S(t<240&&e.top>240)}b(e=>!e)}};(0,d.useEffect)(()=>{if(!y)return;let e=e=>{e.key===`Escape`&&b(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[y]);let A=e=>{b(!1),c&&c({target:{value:e,name:v.name},currentTarget:{value:e,name:v.name},type:`change`})};return(0,f.jsxs)(`div`,{ref:C,className:l(`relative flex w-full flex-col gap-1.5`,u),children:[e&&(0,f.jsxs)(`label`,{className:`text-xs font-medium text-foreground`,children:[e,_&&(0,f.jsx)(`span`,{className:`text-red-400 ml-1`,children:`*`})]}),(0,f.jsx)(`select`,{ref:T,value:s,onChange:c,disabled:g,tabIndex:-1,"aria-hidden":`true`,className:`sr-only`,...v,children:E.map((e,t)=>(0,f.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},`${e.value}-${t}`))}),(0,f.jsxs)(`div`,{className:`relative w-full`,children:[(0,f.jsxs)(`button`,{ref:w,type:`button`,disabled:g,onClick:k,className:l(`focus-ring flex w-full items-center justify-between rounded-[8px] border border-border/80 bg-card text-foreground transition-all duration-150 hover:border-border-strong cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`,m?`h-8 px-2.5 py-1 text-xs`:`h-9 px-3 py-2 text-[13px]`,t&&`border-danger ring-1 ring-danger/40`,y&&`border-primary ring-1 ring-primary/40`,p),"aria-haspopup":`listbox`,"aria-expanded":y,children:[(0,f.jsx)(`span`,{className:l(`truncate text-left`,!D&&`text-muted-foreground`),children:O}),(0,f.jsx)(a,{className:l(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200 ml-2`,y&&`rotate-180 text-primary`)})]}),y&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`fixed inset-0 z-40 bg-transparent`,onClick:()=>b(!1)}),(0,f.jsx)(`div`,{className:l(`absolute left-0 right-0 z-50 max-h-60 overflow-y-auto rounded-[10px] border border-border bg-popover text-popover-foreground p-1 shadow-2xl animate-in fade-in-0 zoom-in-95 duration-100`,x?`bottom-full mb-1.5`:`top-full mt-1.5`),role:`listbox`,children:E.length===0?(0,f.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground text-center`,children:`No options`}):E.map((e,t)=>{let n=s!==void 0&&s!==``?String(e.value)===String(s):e.value===``&&t===0;return(0,f.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>A(e.value),className:l(`flex w-full items-center justify-between rounded-[6px] px-2.5 py-2 text-xs text-foreground transition-colors cursor-pointer text-left hover:bg-hover hover:text-foreground disabled:pointer-events-none disabled:opacity-40`,n&&`bg-primary/15 text-primary font-medium hover:bg-primary/20 hover:text-primary`),role:`option`,"aria-selected":n,children:[(0,f.jsx)(`span`,{className:`truncate`,children:e.label||e.value||`Option`}),n&&(0,f.jsx)(i,{className:`h-3.5 w-3.5 shrink-0 text-primary ml-2`})]},`${e.value}-${t}`)})})]})]}),t&&(0,f.jsx)(`p`,{className:`text-[11px] text-danger`,children:t}),n&&!t&&(0,f.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:n})]})}function _({tone:e=`muted`,variant:t,size:n=`sm`,dot:r=!1,icon:i,className:a,children:o}){let s=t||e;return(0,f.jsxs)(`span`,{className:l(`inline-flex items-center gap-1.5 font-medium select-none transition-colors`,{default:`bg-muted text-foreground border border-border`,muted:`bg-muted/60 text-muted-foreground border border-border/60`,primary:`bg-primary/10 text-primary border border-primary/25`,success:`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/25`,warning:`bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/25`,danger:`bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/25`,info:`bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/25`,purple:`bg-purple-500/10 text-purple-600 dark:text-purple-300 border border-purple-500/25`}[s],{sm:`px-2 py-0.5 text-[11px] rounded-md`,md:`px-2.5 py-1 text-xs rounded-md`,lg:`px-3 py-1.5 text-sm rounded-lg`}[n],a),children:[r&&(0,f.jsx)(v,{tone:s===`primary`?`primary`:s===`success`?`success`:s===`warning`?`warning`:s===`danger`?`danger`:`muted`}),i&&(0,f.jsx)(`span`,{className:`shrink-0 [&>svg]:h-3 [&>svg]:w-3`,children:i}),o]})}function v({tone:e=`muted`,ping:t=!1}){let n={success:`bg-emerald-400 shadow-[0_0_8px_rgba(52,211,153,0.5)]`,danger:`bg-red-400 shadow-[0_0_8px_rgba(248,113,113,0.5)]`,warning:`bg-amber-400 shadow-[0_0_8px_rgba(251,191,36,0.5)]`,primary:`bg-[#f0643b] shadow-[0_0_8px_rgba(240,100,59,0.5)]`,muted:`bg-zinc-500`};return(0,f.jsxs)(`span`,{className:`relative flex h-2 w-2 items-center justify-center`,children:[t&&(0,f.jsx)(`span`,{className:l(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,n[e])}),(0,f.jsx)(`span`,{className:l(`relative inline-block h-1.5 w-1.5 rounded-full`,n[e])})]})}function y({checked:e=!1,onChange:t,label:n,description:r,disabled:i=!1,size:a=`sm`,className:o,title:s}){let c={sm:{track:`w-8 h-4`,thumb:`h-3 w-3`,translate:`translate-x-4`},md:{track:`w-11 h-6`,thumb:`h-5 w-5`,translate:`translate-x-5`},lg:{track:`w-14 h-7`,thumb:`h-6 w-6`,translate:`translate-x-7`}};return(0,f.jsxs)(`div`,{className:l(`inline-flex items-center gap-2 select-none`,i&&`opacity-50 cursor-not-allowed`,o),children:[(0,f.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":n||s||`Toggle`,title:s,disabled:i,onClick:()=>{!i&&t&&t(!e)},className:l(`relative inline-flex shrink-0 cursor-pointer rounded-full p-0.5 transition-colors duration-200 ease-in-out focus:outline-none`,e?`bg-primary`:`bg-muted-foreground/30 hover:bg-muted-foreground/40`,c[a].track,i&&`cursor-not-allowed`),children:(0,f.jsx)(`span`,{className:l(`pointer-events-none inline-block rounded-full bg-white shadow-xs transition-transform duration-200 ease-in-out`,c[a].thumb,e?c[a].translate:`translate-x-0`)})}),(n||r)&&(0,f.jsxs)(`div`,{className:`flex flex-col leading-tight`,children:[n&&(0,f.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:n}),r&&(0,f.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:r})]})]})}function b({open:e,onClose:t,title:n,subtitle:r,size:i=`md`,footer:a,children:o,className:s}){let u=(0,d.useRef)(null);return(0,d.useEffect)(()=>(e?document.body.style.overflow=`hidden`:document.body.style.overflow=``,()=>{document.body.style.overflow=``}),[e]),(0,d.useEffect)(()=>{let n=n=>{n.key===`Escape`&&e&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),(0,d.useEffect)(()=>{if(!e)return;let t=u.current;if(!t)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,r=()=>Array.from(t.querySelectorAll(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>e.getClientRects().length>0);(r()[0]??t).focus();let i=e=>{if(e.key!==`Tab`)return;let n=r();if(n.length===0){e.preventDefault(),t.focus();return}let i=n[0],a=n[n.length-1];!i||!a||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),i.focus()))};return document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`keydown`,i),n?.focus()}},[e]),e?(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-[3px] animate-in fade-in duration-150`,onClick:t,role:`presentation`,children:(0,f.jsxs)(`div`,{ref:u,role:`dialog`,"aria-modal":`true`,"aria-label":n||`Dialog`,tabIndex:-1,onClick:e=>e.stopPropagation(),className:l(`relative flex max-h-[90vh] w-full flex-col overflow-hidden rounded-[14px] border border-border/80 bg-card/95 text-foreground shadow-2xl backdrop-blur-xl`,{sm:`max-w-sm`,md:`max-w-md`,lg:`max-w-lg`,xl:`max-w-2xl`,full:`max-w-4xl`}[i],s),children:[(0,f.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 pr-2`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:t,title:`Close`,className:`group flex h-3 w-3 items-center justify-center rounded-full bg-[#ff5f56] hover:brightness-90 transition-all cursor-pointer`,children:(0,f.jsx)(`span`,{className:`text-[8px] font-bold text-black/60 opacity-0 group-hover:opacity-100 leading-none`,children:`✕`})}),(0,f.jsx)(`div`,{className:`h-3 w-3 rounded-full bg-[#ffbd2e]/40`}),(0,f.jsx)(`div`,{className:`h-3 w-3 rounded-full bg-[#27c93f]/40`})]}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[n&&(0,f.jsx)(`h3`,{className:`truncate text-[14px] font-semibold tracking-tight text-foreground`,children:n}),r&&(0,f.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:r})]})]}),(0,f.jsx)(`button`,{type:`button`,onClick:t,className:`p-1 text-muted-foreground hover:text-foreground rounded-md hover:bg-hover md:hidden`,"aria-label":`Close`,children:(0,f.jsx)(c,{className:`h-4 w-4`})})]}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto p-5 custom-scrollbar`,children:o}),a&&(0,f.jsx)(`div`,{className:`flex shrink-0 items-center justify-end gap-2.5 border-t border-border/60 bg-hover/20 px-5 py-3.5`,children:a})]})}):null}function x({label:e=`Loading...`}){return(0,f.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-14 text-xs text-muted-foreground`,children:[(0,f.jsx)(o,{className:`h-4 w-4 animate-spin text-primary`}),(0,f.jsx)(`span`,{children:e})]})}function S({icon:e,label:t,description:n,action:r}){return(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-14 text-center px-4`,children:[(0,f.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-hover text-dim mb-1`,children:e||(0,f.jsx)(u,{className:`h-5 w-5`})}),(0,f.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:t}),n&&(0,f.jsx)(`p`,{className:`max-w-xs text-[11px] text-muted-foreground`,children:n}),r&&(0,f.jsx)(`div`,{className:`mt-3`,children:r})]})}function C({message:e,onRetry:t}){return(0,f.jsxs)(`div`,{className:`flex min-h-36 flex-col items-center justify-center gap-3 py-12 text-center px-4`,children:[(0,f.jsx)(`p`,{className:`font-mono text-xs text-danger`,children:e}),t&&(0,f.jsxs)(m,{size:`sm`,variant:`outline`,onClick:t,children:[(0,f.jsx)(s,{className:`h-3 w-3`}),`Retry`]})]})}export{S as a,x as c,y as d,v as i,b as l,m as n,C as o,p as r,h as s,_ as t,g as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),n=e(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]);export{t as n,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),n=e(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]);export{t as n,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./LoginView-CSzx0ltN.js";var t=e;export{t as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{t as r}from"./createLucideIcon-CLdWFMku.js";import{t as i}from"./globe-hcLYcRzz.js";import{t as a}from"./image-B10s4838.js";import{t as o}from"./mic-D6DQAnIR.js";import{t as s}from"./search-BtJsgOj6.js";import{t as c}from"./volume-2-DoDae9nb.js";import{t as l}from"./utils-B6KiDbIe.js";var u=r(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),d=r(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),f=r(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),p=r(`music`,[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]),m=e(t(),1),h=n();function g(){let[e,t]=(0,m.useState)(`embedding`),n=[{id:`embedding`,label:`Embedding`,icon:d,endpoint:`POST /v1/embeddings`},{id:`image`,label:`Text to Image`,icon:u,endpoint:`POST /v1/images/generations`},{id:`imageToText`,label:`Image to Text`,icon:a,endpoint:`POST /v1/images/understanding`},{id:`tts`,label:`Text To Speech`,icon:c,endpoint:`POST /v1/audio/speech`},{id:`stt`,label:`Speech To Text`,icon:o,endpoint:`POST /v1/audio/transcriptions`},{id:`webSearch`,label:`Web Search`,icon:s,endpoint:`POST /v1/search`},{id:`webFetch`,label:`Web Fetch`,icon:i,endpoint:`POST /v1/web/fetch`},{id:`video`,label:`Video`,icon:f,endpoint:`POST /v1/videos/generations`},{id:`music`,label:`Music`,icon:p,endpoint:`POST /v1/audio/music`}],r={embedding:[{id:`openai`,name:`OpenAI text-embedding-3-small`,icon:`/providers/openai.png`,status:`Ready`},{id:`cohere`,name:`Cohere embed-multilingual-v3.0`,icon:`/providers/cohere.png`,status:`Ready`},{id:`voyage`,name:`Voyage AI voyage-3`,icon:`/providers/together.png`,status:`Configured`}],image:[{id:`fal-ai`,name:`FLUX.1 [dev] via Fal.ai`,icon:`/providers/fal-ai.png`,status:`Ready`},{id:`openai`,name:`DALL-E 3 via OpenAI`,icon:`/providers/openai.png`,status:`Ready`},{id:`midjourney`,name:`Midjourney Proxy v6`,icon:`/providers/together.png`,status:`Optional`}],tts:[{id:`elevenlabs`,name:`ElevenLabs Multilingual v2`,icon:`/providers/elevenlabs.png`,status:`Ready`},{id:`edge-tts`,name:`Microsoft Edge TTS Free`,icon:`/providers/azure.png`,status:`Free (No Key)`}],stt:[{id:`groq-whisper`,name:`Whisper Large v3 (Groq Ultra-Fast)`,icon:`/providers/groq.png`,status:`Ready`},{id:`openai-whisper`,name:`Whisper-1 via OpenAI`,icon:`/providers/openai.png`,status:`Ready`}],webSearch:[{id:`tavily`,name:`Tavily AI Search Engine`,icon:`/providers/openrouter.png`,status:`Ready`},{id:`exa`,name:`Exa Neural Search`,icon:`/providers/exa.png`,status:`Ready`},{id:`serper`,name:`Google Search via Serper`,icon:`/providers/google-pse.png`,status:`Ready`}]}[e]||[{id:`auto`,name:`Default Gateway Router`,icon:`/providers/openrouter.png`,status:`Ready`}],g=n.find(t=>t.id===e)||n[0];return g?(0,h.jsxs)(`div`,{className:`space-y-6`,children:[(0,h.jsx)(`div`,{className:`flex items-center gap-1.5 overflow-x-auto pb-2 border-b border-[#242834]`,children:n.map(n=>{let r=n.icon,i=e===n.id;return(0,h.jsxs)(`button`,{onClick:()=>t(n.id),className:l(`inline-flex items-center gap-2 rounded-xl px-3.5 py-2 text-xs font-semibold whitespace-nowrap transition-all`,i?`bg-orange-500/20 border border-orange-500/40 text-orange-400 shadow-sm`:`border border-transparent text-zinc-400 hover:bg-[#1a1d24] hover:text-white`),children:[(0,h.jsx)(r,{className:`h-3.5 w-3.5`}),(0,h.jsx)(`span`,{children:n.label})]},n.id)})}),(0,h.jsxs)(`div`,{className:`flex items-center justify-between rounded-2xl border border-[#242834] bg-[#1a1d24] p-4`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,h.jsx)(g.icon,{className:`h-5 w-5 text-orange-400`}),(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`h2`,{className:`text-sm font-semibold text-white`,children:[g.label,` Gateway`]}),(0,h.jsx)(`code`,{className:`text-[11px] font-mono text-zinc-400`,children:g.endpoint})]})]}),(0,h.jsx)(`span`,{className:`rounded-md bg-emerald-950/60 border border-emerald-800/80 px-2.5 py-1 text-xs font-semibold text-emerald-400`,children:`Active`})]}),(0,h.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4`,children:r.map(e=>(0,h.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-2xl border border-[#242834] bg-[#1a1d24] p-4 shadow-sm`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,h.jsx)(`img`,{src:e.icon,alt:``,className:`h-8 w-8 rounded-lg object-contain bg-[#12141a] p-1 border border-[#282d3b] shrink-0`,onError:e=>{e.currentTarget.style.display=`none`}}),(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`h3`,{className:`truncate text-xs font-semibold text-white`,children:e.name}),(0,h.jsx)(`span`,{className:`text-[11px] text-zinc-400`,children:e.status})]})]}),(0,h.jsx)(`span`,{className:`rounded-md bg-[#232734] border border-[#2e3444] px-2 py-0.5 text-[10px] font-semibold text-emerald-400`,children:`Connected`})]},e.id))})]}):null}var _=g;export{_ as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]);export{t};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{t as r}from"./useQuery-BrM5_EQu.js";import{i,n as a,r as o}from"./api-lXjeGSiV.js";import{t as s}from"./createLucideIcon-CLdWFMku.js";import{t as c}from"./bot-mZlhzHVu.js";import{t as l}from"./check-36OnHiEM.js";import{t as u}from"./chevron-down-DxUrtHFo.js";import{t as d}from"./circle-alert-CcGnUa7l.js";import{t as f}from"./code-xml-BsvsUoDv.js";import{t as p}from"./copy-B1k2VT2A.js";import{t as m}from"./eye-Cbs9C6DS.js";import{t as h}from"./file-text-BRzD_S8I.js";import{t as ee}from"./mic-D6DQAnIR.js";import{t as te}from"./plus-qKI-KwZh.js";import{t as ne}from"./search-BtJsgOj6.js";import{t as g}from"./sparkles-DZ5Pl1vD.js";import{t as re}from"./trash-2-D9HI9O7Q.js";import{t as ie}from"./volume-2-DoDae9nb.js";import{t as ae}from"./x-CGuQtexA.js";import{t as oe}from"./zap-BS7lyU9U.js";import{t as _}from"./utils-B6KiDbIe.js";import{n as se}from"./providersData-lrEpUDQM.js";var ce=s(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),le=s(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),ue=s(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),de=s(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),fe=s(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),pe=s(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),me=s(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),he=s(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),ge=s(`volume-x`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),v=e(t(),1);function y(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var b=y();function x(e){b=e}var S={exec:()=>null};function C(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function w(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(T.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var _e=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),T={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:C(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:C(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:C(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:C(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:C(e=>RegExp(`^ {0,${e}}(?:</?(?:${A})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:C(e=>RegExp(`^ {0,${e}}>`))},ve=/^(?:[ \t]*(?:\n|$))+/,ye=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,be=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,E=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,xe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Se=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Ce=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,D=w(Ce).replace(/bull/g,Se).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),we=w(Ce).replace(/bull/g,Se).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),O=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Te=/^[^\n]+/,k=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ee=w(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,k).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),De=w(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Se).getRegex(),A=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Oe=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ke=w(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Oe).replace(`tag`,A).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ae=e=>w(O).replace(`hr`,E).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,A).getRegex(),je=Ae(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Me=Ae(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),j={blockquote:w(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Me).getRegex(),code:ye,def:Ee,fences:be,heading:xe,hr:E,html:ke,lheading:D,list:De,newline:ve,paragraph:je,table:S,text:Te},Ne=w(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,E).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,A).getRegex(),M={...j,lheading:we,table:Ne,paragraph:w(O).replace(`hr`,E).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Ne).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,A).getRegex()},Pe={...j,html:w(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Oe).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:S,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:w(O).replace(`hr`,E).replace(`heading`,` *#{1,6} *[^
|
|
2
|
+
]`).replace(`lheading`,D).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Fe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,N=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ie=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,Le=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,P=/[\p{P}\p{S}]/u,F=/[\s\p{P}\p{S}]/u,I=/[^\s\p{P}\p{S}]/u,Re=w(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,F).getRegex(),ze=/[\p{Pi}\p{Ps}"']/u,L=/(?!~)[\p{P}\p{S}]/u,Be=/(?!~)[\s\p{P}\p{S}]/u,Ve=/(?:[^\s\p{P}\p{S}]|~)/u,He=w(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,_e?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Ue=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,We=w(Ue,`u`).replace(/punct/g,P).getRegex(),Ge=w(Ue,`u`).replace(/punct/g,L).getRegex(),Ke=w(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,ze).replace(/punct/g,P).getRegex(),qe=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Je=w(qe,`gu`).replace(/notPunctSpace/g,I).replace(/punctSpace/g,F).replace(/punct/g,P).getRegex(),Ye=w(qe,`gu`).replace(/notPunctSpace/g,Ve).replace(/punctSpace/g,Be).replace(/punct/g,L).getRegex(),R=w(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,I).replace(/punctSpace/g,F).replace(/punct/g,P).getRegex(),z=w(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,I).replace(/punctSpace/g,F).replace(/punct/g,P).getRegex(),B=w(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,I).replace(/punctSpace/g,F).replace(/punct/g,P).getRegex(),V=w(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,P).getRegex(),Xe=w(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,I).replace(/punctSpace/g,F).replace(/punct/g,P).getRegex(),H=w(/\\(punct)/,`gu`).replace(/punct/g,P).getRegex(),Ze=w(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Qe=w(Oe).replace(`(?:-->|$)`,`-->`).getRegex(),$e=w(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Qe).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),U=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,W=w(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,U).getRegex(),et=w(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,W).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),tt=w(/^!?\[(label)\]\[(ref)\]/).replace(`label`,W).replace(`ref`,k).getRegex(),nt=w(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,k).getRegex(),rt=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,it=w(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,U).getRegex(),at=w(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,w(/^!?\[(label)\]\[(ref)\]/).replace(`label`,it).replace(`ref`,rt).getRegex()).replace(`nolink`,w(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,rt).getRegex()).getRegex(),ot=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,st={_backpedal:S,anyPunctuation:H,autolink:Ze,blockSkip:He,br:Ie,code:N,del:S,delLDelim:S,delRDelim:S,emStrongLDelim:We,emStrongRDelimAst:Je,emStrongRDelimUnd:z,escape:Fe,link:et,nolink:nt,punctuation:Re,reflink:tt,reflinkSearch:at,tag:$e,text:Le,url:S},ct={...st,emStrongLDelim:Ke,emStrongRDelimAst:R,emStrongRDelimUnd:B,link:w(/^!?\[(label)\]\((.*?)\)/).replace(`label`,W).getRegex(),reflink:w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,W).getRegex()},lt={...st,emStrongRDelimAst:Ye,emStrongLDelim:Ge,delLDelim:V,delRDelim:Xe,url:w(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,ot).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:w(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,ot).getRegex()},ut={...lt,br:w(Ie).replace(`{2,}`,`*`).getRegex(),text:w(lt.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},dt={normal:j,gfm:M,pedantic:Pe},ft={normal:st,gfm:lt,breaks:ut,pedantic:ct},pt={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},mt=e=>pt[e];function G(e,t){if(t){if(T.escapeTest.test(e))return e.replace(T.escapeReplace,mt)}else if(T.escapeTestNoEncode.test(e))return e.replace(T.escapeReplaceNoEncode,mt);return e}function ht(e){try{e=encodeURI(e).replace(T.percentDecode,`%`)}catch{return null}return e}function gt(e,t){let n=e.replace(T.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(T.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(T.slashPipe,`|`);return n}function K(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function _t(e){let t=e.split(`
|
|
3
|
+
`),n=t.length-1;for(;n>=0&&T.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
4
|
+
`)}function vt(e){return e.toLowerCase().toUpperCase().toLowerCase()}function yt(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function bt(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function xt(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function St(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
5
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
|
|
6
|
+
`)}function Ct(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var wt=class{options;rules;lexer;constructor(e){this.options=e||b}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:_t(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=St(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=K(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:K(t[0],`
|
|
7
|
+
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:K(t[0],`
|
|
8
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=K(t[0],`
|
|
9
|
+
`).split(`
|
|
10
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
11
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
12
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
13
|
+
${s}`:s,r=r?`${r}
|
|
14
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
|
|
15
|
+
`),o=t.raw+`
|
|
16
|
+
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s,n=`${n}
|
|
17
|
+
${a}`,r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
18
|
+
`+e.join(`
|
|
19
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
20
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=bt(t[2].split(`
|
|
21
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
22
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
23
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
24
|
+
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
25
|
+
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
26
|
+
`+l}u=!l.trim(),r+=p+`
|
|
27
|
+
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=_t(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=vt(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:K(t[0],`
|
|
28
|
+
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=gt(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
29
|
+
`):[],a={type:`table`,raw:K(t[0],`
|
|
30
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(gt(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:K(t[0],`
|
|
31
|
+
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
32
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Ct(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=K(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=yt(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),xt(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Ct(e,n[1],r,this.rules))return;let i=t[vt((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return xt(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},q=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||b,this.options.tokenizer=this.options.tokenizer||new wt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:T,block:dt.normal,inline:ft.normal};this.options.pedantic?(t.block=dt.pedantic,t.inline=ft.pedantic):this.options.gfm&&(t.block=dt.gfm,t.inline=this.options.breaks?ft.breaks:ft.gfm),this.tokenizer.rules=t}static get rules(){return{block:dt,inline:ft}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(T.carriageReturn,`
|
|
33
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(T.tabCharGlobal,` `).replace(T.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
34
|
+
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
35
|
+
`)?``:`
|
|
36
|
+
`)+i.raw,n.text+=`
|
|
37
|
+
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
38
|
+
`)?``:`
|
|
39
|
+
`)+i.raw,n.text+=`
|
|
40
|
+
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
41
|
+
`)?``:`
|
|
42
|
+
`)+i.raw,r.text+=`
|
|
43
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
44
|
+
`)?``:`
|
|
45
|
+
`)+i.raw,n.text+=`
|
|
46
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(!(e.charAt(0)===`!`||!Object.hasOwn(this.tokens.links,vt(e.slice(n+1,-1))))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,vt(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},Tt=class{options;parser;constructor(e){this.options=e||b}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(T.notSpaceStart)?.[0],i=e?e.replace(T.endingNewline,``)+`
|
|
47
|
+
`:``;return r?`<pre><code class="language-`+G(r)+`">`+(n?i:G(i,!0))+`</code></pre>
|
|
48
|
+
`:`<pre><code>`+(n?i:G(i,!0))+`</code></pre>
|
|
49
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
50
|
+
${this.parser.parse(e)}</blockquote>
|
|
51
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
52
|
+
`}hr(e){return`<hr>
|
|
53
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
54
|
+
`+r+`</`+i+`>
|
|
55
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
56
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
57
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
58
|
+
<thead>
|
|
59
|
+
`+t+`</thead>
|
|
60
|
+
`+r+`</table>
|
|
61
|
+
`}tablerow({text:e}){return`<tr>
|
|
62
|
+
${e}</tr>
|
|
63
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
64
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${G(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?G(n,!0):this.parser.parseInline(r),o=ht(e);if(o===null)return a;e=G(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+G(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=ht(e);if(i===null)return G(n);e=i;let a=`<img src="${G(e)}" alt="${G(n)}"`;return t&&(a+=` title="${G(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:G(e.text)}},Et=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},J=class e{options;renderer;textRenderer;constructor(e){this.options=e||b,this.options.renderer=this.options.renderer||new Tt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Et}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Dt=class{options;block;constructor(e){this.options=e||b}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?q.lex:q.lexInline}provideParser(e=this.block){return e?J.parse:J.parseInline}},Y=new class{defaults=y();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=J;Renderer=Tt;TextRenderer=Et;Lexer=q;Tokenizer=wt;Hooks=Dt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Tt(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new wt(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Dt;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Dt.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Dt.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return q.lex(e,t??this.defaults)}parser(e,t){return J.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?q.lex:q.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?J.parse:J.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?q.lex:q.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?J.parse:J.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
65
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+G(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function X(e,t){return Y.parse(e,t)}X.options=X.setOptions=function(e){return Y.setOptions(e),X.defaults=Y.defaults,x(X.defaults),X},X.getDefaults=y,X.defaults=b;function Ot(...e){return Y.use(...e),X.defaults=Y.defaults,x(X.defaults),X}X.use=Ot,X.walkTokens=function(e,t){return Y.walkTokens(e,t)},X.parseInline=Y.parseInline,X.Parser=J,X.parser=J.parse,X.Renderer=Tt,X.TextRenderer=Et,X.Lexer=q,X.lexer=q.lex,X.Tokenizer=wt,X.Hooks=Dt,X.parse=X,X.options,X.setOptions,X.walkTokens,X.parseInline,J.parse,q.lex;var Z=n();function kt({content:e,defaultMode:t=`markdown`,showViewToggle:n=!0}){let[r,i]=(0,v.useState)(t),[a,o]=(0,v.useState)(!1),s=(0,v.useMemo)(()=>e.includes("```html")||e.includes(`<!DOCTYPE`)||/<(div|p|span|table|h[1-6]|button|form|ul|ol|li|section|header|footer|style|script)\b/i.test(e),[e]),c=(0,v.useMemo)(()=>{if(!e)return``;try{return X.parse(e,{gfm:!0,breaks:!0})}catch{return e}},[e]);return e?(0,Z.jsxs)(`div`,{className:`group/renderer relative w-full space-y-2`,children:[n&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/40 pb-1.5 mb-2 text-[11px]`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground/70 font-medium`,children:`View:`}),(0,Z.jsxs)(`div`,{className:`inline-flex rounded-lg border border-border/60 bg-muted/40 p-0.5`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>i(`markdown`),className:_(`flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium transition cursor-pointer`,r===`markdown`?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),title:`Rendered Markdown View`,children:[(0,Z.jsx)(g,{className:`h-3 w-3 text-primary`}),(0,Z.jsx)(`span`,{children:`Markdown`})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>i(`html`),className:_(`flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium transition cursor-pointer`,r===`html`?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),title:`Live HTML View`,children:[(0,Z.jsx)(m,{className:`h-3 w-3 text-emerald-500`}),(0,Z.jsx)(`span`,{children:`HTML View`}),s&&(0,Z.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse`})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>i(`raw`),className:_(`flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium transition cursor-pointer`,r===`raw`?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),title:`Raw Text / Markdown`,children:[(0,Z.jsx)(h,{className:`h-3 w-3 text-blue-400`}),(0,Z.jsx)(`span`,{children:`Raw`})]})]})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},className:`flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-muted-foreground hover:bg-hover hover:text-foreground transition cursor-pointer`,title:`Copy entire text`,children:a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(l,{className:`h-3 w-3 text-emerald-500`}),(0,Z.jsx)(`span`,{className:`text-emerald-500`,children:`Tersalin!`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(p,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{children:`Salin`})]})})]}),r===`markdown`&&(0,Z.jsx)(At,{content:e}),r===`html`&&(0,Z.jsxs)(`div`,{className:`rounded-xl border border-border/80 bg-background/80 p-4 shadow-sm`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between border-b border-border/50 pb-2`,children:[(0,Z.jsxs)(`span`,{className:`text-[11px] font-semibold tracking-wider text-muted-foreground uppercase flex items-center gap-1.5`,children:[(0,Z.jsx)(f,{className:`h-3.5 w-3.5 text-emerald-500`}),` Live HTML Preview`]}),(0,Z.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Sandboxed rendering`})]}),(0,Z.jsx)(`div`,{className:`prose dark:prose-invert max-w-none text-foreground text-sm leading-relaxed overflow-x-auto`,dangerouslySetInnerHTML:{__html:c}})]}),r===`raw`&&(0,Z.jsx)(`pre`,{className:`overflow-x-auto rounded-xl border border-border bg-muted/40 p-3.5 font-mono text-xs leading-5 text-foreground selection:bg-primary/20`,children:(0,Z.jsx)(`code`,{children:e})})]}):null}function At({content:e}){let t=(0,v.useMemo)(()=>jt(e),[e]);return(0,Z.jsx)(`div`,{className:`space-y-3 text-[13px] leading-relaxed break-words text-foreground`,children:t.map((e,t)=>e.type===`code`?(0,Z.jsx)(Mt,{language:e.language||`text`,code:e.code},t):(0,Z.jsx)(Nt,{text:e.text},t))})}function jt(e){let t=[],n=/```([a-zA-Z0-9_-]*)\n?([\s\S]*?)```/g,r=0,i;for(;(i=n.exec(e))!==null;)i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)}),t.push({type:`code`,language:i[1]||`text`,code:i[2]?.trimEnd()||``}),r=n.lastIndex;return r<e.length&&t.push({type:`text`,text:e.slice(r)}),t}function Mt({language:e,code:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(e.toLowerCase()===`html`),o=e.toLowerCase()===`html`||e.toLowerCase()===`svg`;return(0,Z.jsxs)(`div`,{className:`my-2.5 overflow-hidden rounded-xl border border-border bg-card shadow-xs`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border bg-muted/60 px-3.5 py-1.5 text-[11px] text-muted-foreground`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-mono font-semibold uppercase tracking-wider text-foreground/80`,children:e||`code`}),o&&(0,Z.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:_(`rounded px-1.5 py-0.5 text-[10px] font-medium transition cursor-pointer`,i?`bg-emerald-500/20 text-emerald-600 dark:text-emerald-400`:`bg-muted text-muted-foreground hover:text-foreground`),children:i?`Preview ON`:`Preview`})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}catch{}},className:`flex items-center gap-1.5 rounded-md px-2 py-0.5 text-muted-foreground hover:bg-hover hover:text-foreground transition cursor-pointer active:scale-95`,title:`Copy code`,children:n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(l,{className:`h-3 w-3 text-emerald-500`}),(0,Z.jsx)(`span`,{className:`text-emerald-500 font-medium`,children:`Tersalin!`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(p,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{children:`Salin`})]})})]}),i&&o&&(0,Z.jsx)(`div`,{className:`border-b border-border bg-background p-4`,children:(0,Z.jsx)(`div`,{className:`rounded-lg border border-border/60 p-3 bg-card`,dangerouslySetInnerHTML:{__html:t}})}),(0,Z.jsx)(`pre`,{className:`overflow-x-auto p-3.5 font-mono text-[12px] leading-5 text-foreground selection:bg-primary/20 bg-muted/30`,children:(0,Z.jsx)(`code`,{children:t})})]})}function Nt({text:e}){if(e.includes(`|`)&&e.includes(`
|
|
66
|
+
|`))try{let t=X.parse(e,{gfm:!0,breaks:!0});return(0,Z.jsx)(`div`,{className:`markdown-content text-foreground leading-relaxed overflow-x-auto py-1`,dangerouslySetInnerHTML:{__html:t}})}catch{}let t=e.split(/\n{2,}/);return(0,Z.jsx)(`div`,{className:`space-y-2.5`,children:t.map((e,t)=>{let n=e.trim();if(n.startsWith(`### `))return(0,Z.jsx)(`h3`,{className:`text-sm font-bold text-foreground mt-3 mb-1`,children:Q(n.slice(4))},t);if(n.startsWith(`## `))return(0,Z.jsx)(`h2`,{className:`text-base font-bold text-foreground mt-3.5 mb-1.5`,children:Q(n.slice(3))},t);if(n.startsWith(`# `))return(0,Z.jsx)(`h1`,{className:`text-lg font-extrabold text-foreground mt-4 mb-2`,children:Q(n.slice(2))},t);if(n.startsWith(`> `))return(0,Z.jsx)(`blockquote`,{className:`border-l-3 border-primary/70 bg-muted/40 rounded-r-lg px-3 py-1.5 text-muted-foreground italic my-2`,children:Q(n.slice(2))},t);let r=e.split(`
|
|
67
|
+
`);return(0,Z.jsx)(`div`,{className:`leading-6`,children:r.map((e,t)=>{let n=e.trim();if(n.startsWith(`- `)||n.startsWith(`* `))return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 pl-2 my-0.5`,children:[(0,Z.jsx)(`span`,{className:`mt-2 h-1.5 w-1.5 rounded-full bg-primary/70 shrink-0`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:Q(n.slice(2))})]},t);let r=n.match(/^(\d+)\.\s+(.*)/);return r?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 pl-2 my-0.5`,children:[(0,Z.jsxs)(`span`,{className:`font-mono text-xs text-primary/80 font-semibold shrink-0 min-w-[1.2rem]`,children:[r[1],`.`]}),(0,Z.jsx)(`span`,{className:`flex-1`,children:Q(r[2]||``)})]},t):(0,Z.jsxs)(v.Fragment,{children:[t>0&&(0,Z.jsx)(`br`,{}),Q(e)]},t)})},t)})})}function Q(e){let t=[],n=/(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[([^\]]+)\]\(([^)]+)\))/g,r=0,i;for(;(i=n.exec(e))!==null;){i.index>r&&t.push(e.slice(r,i.index));let a=i[0];a.startsWith("`")&&a.endsWith("`")?t.push((0,Z.jsx)(`code`,{className:`rounded-md border border-border bg-muted/80 px-1.5 py-0.5 font-mono text-[11.5px] text-primary font-medium`,children:a.slice(1,-1)},i.index)):a.startsWith(`**`)&&a.endsWith(`**`)?t.push((0,Z.jsx)(`strong`,{className:`font-semibold text-foreground`,children:a.slice(2,-2)},i.index)):a.startsWith(`*`)&&a.endsWith(`*`)?t.push((0,Z.jsx)(`em`,{className:`italic text-foreground/90`,children:a.slice(1,-1)},i.index)):i[2]&&i[3]&&t.push((0,Z.jsx)(`a`,{href:i[3],target:`_blank`,rel:`noreferrer`,className:`text-primary hover:underline font-medium`,children:i[2]},i.index)),r=n.lastIndex}return r<e.length&&t.push(e.slice(r)),t}var $={sessions:`ekarouter.playground.sessions.v3`,activeSessionId:`ekarouter.playground.activeSessionId.v3`,selectedProvider:`ekarouter.playground.selectedProvider.v3`,selectedModel:`ekarouter.playground.selectedModel.v3`};function Pt(e=``){return String(e).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()||`Unknown`}function Ft(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`msg_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}function It(e){if(!e)return`Now`;let t=Math.max(0,Date.now()-new Date(e).getTime()),n=Math.floor(t/6e4);if(n<1)return`Just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Lt(){let e=r({queryKey:[`models`],queryFn:a.models,retry:!1}),t=r({queryKey:[`provider-definitions`],queryFn:a.providerDefinitions,retry:!1}),n=r({queryKey:[`provider-nodes`],queryFn:a.providerNodes,retry:!1}),s=r({queryKey:[`providers`],queryFn:a.providers,retry:!1}),[f,m]=(0,v.useState)([]),[h,g]=(0,v.useState)(``),[y,b]=(0,v.useState)(``),[x,S]=(0,v.useState)(``),C=(0,v.useRef)(!1);(0,v.useEffect)(()=>{try{let e=localStorage.getItem($.sessions);if(e){let t=JSON.parse(e);Array.isArray(t)&&t.length>0&&m(t)}let t=localStorage.getItem($.activeSessionId);t&&g(t);let n=localStorage.getItem($.selectedProvider);n&&n!==`all`&&b(n);let r=localStorage.getItem($.selectedModel);r&&S(r)}catch{}C.current=!0},[]);let[w,_e]=(0,v.useState)(``),[T,ve]=(0,v.useState)(.7),[ye,be]=(0,v.useState)(4096),[E,xe]=(0,v.useState)(1),[Se,Ce]=(0,v.useState)(!0),[D,we]=(0,v.useState)(``),[O,Te]=(0,v.useState)([]),[k,Ee]=(0,v.useState)(!1),[De,A]=(0,v.useState)(null),[Oe,ke]=(0,v.useState)(!1),[Ae,je]=(0,v.useState)(!1),[Me,j]=(0,v.useState)(!1),[Ne,M]=(0,v.useState)(!1),[Pe,Fe]=(0,v.useState)(``),[N,Ie]=(0,v.useState)(``),[Le,P]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),[Re,ze]=(0,v.useState)(null),[L,Be]=(0,v.useState)(!1),Ve=(0,v.useRef)(null),He=(0,v.useRef)(null),Ue=(0,v.useRef)(null),We=(0,v.useRef)(null),Ge=(0,v.useRef)(null),Ke=(0,v.useRef)(null),qe=(0,v.useRef)(null),Je=(0,v.useRef)(null),Ye=(0,v.useRef)(null),R=(0,v.useMemo)(()=>{let t=e.data;return(Array.isArray(t)?t:Array.isArray(t?.data)?t.data:Array.isArray(t?.models)?t.models:[]).map(e=>{let t=e?.id||e?.model||e?.routedModel||e?.fullModel||e?.name||``,n=e?.provider||(t.includes(`/`)?t.split(`/`)[0]:`custom`);return{...e,id:t,provider:n,displayName:e?.name||t,caps:e?.caps||{}}})},[e.data]),z=(0,v.useMemo)(()=>{let e=new Map,r=new Map,i=t.data||[];for(let e of i){if(!e?.id)continue;let t=e.id,n={id:t,name:e.name||Pt(e.id)};r.set(t.toLowerCase(),n),e.alias&&r.set(e.alias.toLowerCase(),n)}let a=n.data||[];for(let e of a){if(!e?.id)continue;let t=e.id,n={id:t,name:e.name||Pt(e.id)};r.set(t.toLowerCase(),n);let i=e.data?.prefix||e.prefix;i&&r.set(i.toLowerCase(),n)}let o=s.data||[];for(let e of o)if(e?.provider){let t=e.provider.toLowerCase();r.has(t)||r.set(t,{id:e.provider,name:Pt(e.provider)})}for(let t of R){let n=(t.provider||`custom`).toLowerCase(),i=r.get(n),a=i?.id||t.provider||`custom`,o=i?.name||Pt(a);e.has(a)||e.set(a,{providerId:a,providerName:o,models:[]});let s=e.get(a);s.models.some(e=>e.id===t.id)||s.models.push(t)}let c=new Set(o.filter(e=>e?.isActive!==!1).map(e=>(e?.provider||``).toLowerCase()));return Array.from(e.values()).sort((e,t)=>{let n=+!!c.has(e.providerId.toLowerCase()),r=+!!c.has(t.providerId.toLowerCase());return r===n?t.models.length-e.models.length:r-n})},[R,t.data,n.data,s.data]),B=(0,v.useMemo)(()=>{if(y&&y!==`all`&&z.some(e=>e.providerId===y))return y;if(x){let e=R.find(e=>e.id===x);if(e?.provider){let t=z.find(t=>t.providerId===e.provider||t.models.some(t=>t.id===e.id));if(t)return t.providerId}}return z[0]?.providerId||`gemini`},[y,x,R,z]),V=(0,v.useMemo)(()=>z.find(e=>e.providerId===B)||null,[z,B]),Xe=(0,v.useMemo)(()=>V?V.providerName:Pt(B),[V,B]),H=(0,v.useMemo)(()=>{if(V&&V.models.length>0){if(x){let e=V.models.find(e=>e.id===x);if(e)return e}return V.models[0]}if(x){let e=R.find(e=>e.id===x);if(e)return e}return R[0]||null},[x,R,V]),Ze=(0,v.useMemo)(()=>{let e=V?V.models:[],t=new Set,n=[];for(let r of e)t.has(r.id)||(t.add(r.id),n.push(r));if(!N.trim())return n;let r=N.toLowerCase();return n.filter(e=>e.id.toLowerCase().includes(r)||e.displayName.toLowerCase().includes(r)||e.provider.toLowerCase().includes(r))},[V,N]),Qe=(0,v.useMemo)(()=>{if(!Pe.trim())return z;let e=Pe.toLowerCase();return z.filter(t=>t.providerId.toLowerCase().includes(e)||t.providerName.toLowerCase().includes(e))},[z,Pe]),$e=e=>{b(e);let t=z.find(t=>t.providerId===e);t&&t.models.length>0&&(t.models.some(e=>e.id===x)||S(t.models[0].id))};(0,v.useEffect)(()=>{H?.provider&&H.provider!==y&&b(H.provider)},[H?.provider]),(0,v.useEffect)(()=>{!x&&R.length>0&&S(R[0].id)},[x,R]);let U=(0,v.useMemo)(()=>f.find(e=>e.id===h)||null,[f,h]),W=(0,v.useMemo)(()=>U?.messages||[],[U]);(0,v.useEffect)(()=>{if(f.length>0&&!h){let e=f[0];e&&g(e.id)}},[f,h]),(0,v.useEffect)(()=>{if(C.current)try{localStorage.setItem($.sessions,JSON.stringify(f)),localStorage.setItem($.activeSessionId,h),localStorage.setItem($.selectedProvider,y),localStorage.setItem($.selectedModel,x)}catch{}},[f,h,y,x]),(0,v.useEffect)(()=>{let e=e=>{Ke.current&&!Ke.current.contains(e.target)&&j(!1),qe.current&&!qe.current.contains(e.target)&&M(!1),Je.current&&!Je.current.contains(e.target)&&ke(!1),Ye.current&&!Ye.current.contains(e.target)&&je(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let et=()=>{We.current?.scrollIntoView({behavior:`smooth`})};(0,v.useEffect)(()=>{et()},[W,k]);let tt=e=>{let t=e||x||R[0]?.id||`default`,n=R.find(e=>e.id===t),r={id:Ft(),title:`New Chat`,providerId:n?.provider||`custom`,modelId:t,systemPrompt:w,temperature:T,maxTokens:ye,topP:E,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messages:[]};return m(e=>[r,...e]),g(r.id),we(``),Te([]),A(null),ke(!1),r},nt=(e,t)=>{t?.stopPropagation();let n=f.filter(t=>t.id!==e);m(n),h===e&&g(n[0]?.id||``)},rt=()=>{h&&(m(e=>e.map(e=>e.id===h?{...e,messages:[],updatedAt:new Date().toISOString()}:e)),A(null))},it=async e=>{let t=Array.from(e.target.files||[]);if(!t.length)return;let n=t.filter(e=>e.type.startsWith(`image/`));if(!n.length){e.target.value=``;return}let r=await Promise.all(n.map(async e=>({id:Ft(),name:e.name,type:e.type,size:e.size,dataUrl:await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error),r.readAsDataURL(e)})})));Te(e=>[...e,...r]),e.target.value=``},at=e=>{Te(t=>t.filter(t=>t.id!==e))},ot=async e=>{let t=Array.from(e.clipboardData.items||[]).filter(e=>e.type.startsWith(`image/`));if(t.length===0)return;let n=[];for(let e of t){let t=e.getAsFile();if(!t)continue;let r=await new Promise(e=>{let n=new FileReader;n.onload=()=>e(String(n.result||``)),n.readAsDataURL(t)});n.push({id:Ft(),name:`pasted_${Date.now()}.png`,type:t.type,size:t.size,dataUrl:r})}n.length>0&&(e.preventDefault(),Te(e=>[...e,...n]))},st=()=>{if(L){Ue.current?.stop(),Be(!1);return}let e=window.SpeechRecognition||window.webkitSpeechRecognition;if(!e){alert(`Browser Anda belum mendukung Web Speech Recognition.`);return}try{let t=new e;t.continuous=!0,t.interimResults=!0,t.lang=`id-ID`,t.onstart=()=>{Be(!0)},t.onresult=e=>{let t=``;for(let n=e.resultIndex;n<e.results.length;n++)t+=e.results[n][0].transcript;we(e=>e?`${e} ${t}`:t)},t.onerror=()=>{Be(!1)},t.onend=()=>{Be(!1)},Ue.current=t,t.start()}catch{Be(!1)}},ct=(e,t)=>{if(typeof window>`u`||!(`speechSynthesis`in window)){alert(`Browser tidak mendukung Text-to-Speech.`);return}if(Re===e){window.speechSynthesis.cancel(),ze(null);return}window.speechSynthesis.cancel();let n=t.replace(/```[\s\S]*?```/g,``).replace(/[*_`#]/g,``),r=new SpeechSynthesisUtterance(n);r.lang=`id-ID`,r.onend=()=>ze(null),r.onerror=()=>ze(null),ze(e),window.speechSynthesis.speak(r)},lt=async(e,t)=>{try{await navigator.clipboard.writeText(t),I(e),setTimeout(()=>I(null),2e3)}catch{}},ut=async e=>{let t=(e===void 0?D:e).trim();if(!t&&O.length===0||!x)return;let n=U;n||=tt();let r=[...O],a={id:Ft(),role:`user`,content:t,attachments:r.length>0?r:void 0,createdAt:new Date().toISOString()},s=Ft(),c={id:s,role:`assistant`,content:``,createdAt:new Date().toISOString()},l=[...n.messages,a,c],u=n.title===`New Chat`&&t?t.slice(0,36)+(t.length>36?`…`:``):n.title;m(e=>e.map(e=>e.id===n.id?{...e,title:u,modelId:x,providerId:H?.provider||e.providerId,updatedAt:new Date().toISOString(),messages:l}:e)),we(``),Te([]),Ee(!0),A(null);let d=new AbortController;Ve.current=d;let f=[...w.trim()?[{role:`system`,content:w.trim()}]:[],...n.messages.map(e=>{if(e.role===`user`&&e.attachments&&e.attachments.length>0){let t=[{type:`text`,text:e.content||``}];for(let n of e.attachments)t.push({type:`image_url`,image_url:{url:n.dataUrl}});return{role:`user`,content:t}}return{role:e.role,content:e.content}}),(()=>{if(r.length>0){let e=[{type:`text`,text:t}];for(let t of r)e.push({type:`image_url`,image_url:{url:t.dataUrl}});return{role:`user`,content:e}}return{role:`user`,content:t}})()],p=performance.now(),h=!0,ee=0,te=!x.includes(`/`)&&B&&B!==`all`?`${B}/${x}`:x;try{await i({model:te,temperature:T,max_tokens:ye,top_p:E,stream:Se,messages:f},e=>{h&&=(ee=Math.round(performance.now()-p),!1),m(t=>t.map(t=>{if(t.id!==n.id)return t;let r=[...t.messages],i=r[r.length-1];return i&&i.id===s&&(r[r.length-1]={...i,content:i.content+e}),{...t,messages:r}}))},d.signal);let e=Math.round(performance.now()-p);m(t=>t.map(t=>{if(t.id!==n.id)return t;let r=[...t.messages],i=r[r.length-1];return i&&i.id===s&&(r[r.length-1]={...i,metrics:{ttftMs:ee,durationMs:e,model:x}}),{...t,messages:r}}))}catch(e){if(e?.name!==`AbortError`){let t=o(e)||e?.message||`Terjadi kesalahan saat memproses permintaan.`;A(t),m(e=>e.map(e=>{if(e.id!==n.id)return e;let r=e.messages.map(e=>e.id===s?{...e,error:t}:e);return{...e,messages:r}}))}}finally{Ee(!1),Ve.current=null}},dt=()=>{if(!U||U.messages.length===0||k)return;let e=[...U.messages];e[e.length-1]?.role===`assistant`&&e.pop();let t=e[e.length-1];if(t&&t.role===`user`){let n=t.content;e.pop(),m(t=>t.map(t=>t.id===U.id?{...t,messages:e}:t)),ut(n)}},ft=H?H.displayName:`Select model`;return H&&H.id,(0,Z.jsxs)(`div`,{className:`relative flex-1 flex flex-col h-full min-h-0 min-w-0 bg-background text-foreground overflow-hidden`,children:[(0,Z.jsxs)(`div`,{className:`relative mx-auto flex flex-1 h-full min-h-0 w-full max-w-4xl flex-col`,children:[(0,Z.jsxs)(`div`,{className:`relative z-30 flex shrink-0 items-center justify-between gap-3 px-4 py-3 border-b border-border bg-card/95 backdrop-blur-md`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,Z.jsxs)(`div`,{ref:Ke,className:`relative`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{j(e=>!e),M(!1)},className:_(`flex items-center gap-2.5 rounded-xl border px-3 py-1.5 text-left transition active:scale-98 cursor-pointer shadow-xs`,Me?`border-primary/50 bg-primary/10 text-foreground`:`border-border bg-card hover:bg-hover text-foreground`),title:`Pilih Provider`,children:[(0,Z.jsx)(`img`,{src:se(B),alt:``,className:`h-5 w-5 rounded-md object-contain shrink-0`,onError:e=>{e.target.style.display=`none`}}),(0,Z.jsxs)(`div`,{className:`min-w-0 pr-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] uppercase font-bold tracking-wider text-muted-foreground leading-none block`,children:`Provider`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 mt-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-semibold text-foreground truncate max-w-[110px] sm:max-w-[150px] leading-tight`,children:Xe}),(0,Z.jsx)(u,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`})]})]})]}),Me&&(0,Z.jsxs)(`div`,{className:`absolute left-0 top-[calc(100%+8px)] z-50 w-[min(320px,calc(100vw-2rem))] overflow-hidden rounded-2xl border border-border bg-[#181b24] shadow-2xl shadow-black/60 backdrop-blur-xl`,children:[(0,Z.jsx)(`div`,{className:`border-b border-border p-2.5`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-border bg-muted/60 px-3 py-1.5 text-xs`,children:[(0,Z.jsx)(ne,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,Z.jsx)(`input`,{type:`text`,placeholder:`Cari provider...`,value:Pe,onChange:e=>Fe(e.target.value),className:`w-full bg-transparent text-xs text-foreground outline-none placeholder:text-muted-foreground`,autoFocus:!0}),Pe&&(0,Z.jsx)(`button`,{type:`button`,onClick:()=>Fe(``),className:`text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(ae,{className:`h-3 w-3`})})]})}),(0,Z.jsx)(`div`,{className:`max-h-[50vh] overflow-y-auto p-1.5 space-y-1 custom-scrollbar`,children:Qe.map(e=>{let t=B===e.providerId;return(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{$e(e.providerId),j(!1),M(!0)},className:_(`flex w-full items-center justify-between gap-2.5 rounded-xl px-3 py-2 text-left transition cursor-pointer text-xs`,t?`border border-primary/40 bg-primary/10 font-semibold text-foreground`:`border border-transparent bg-transparent hover:bg-hover text-foreground`),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,Z.jsx)(`img`,{src:se(e.providerId),alt:``,className:`h-6 w-6 rounded-lg object-contain shrink-0`,onError:e=>{e.target.style.display=`none`}}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`p`,{className:`truncate font-semibold text-foreground`,children:e.providerName}),(0,Z.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[e.models.length,` model tersedia`]})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,Z.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground font-medium`,children:e.models.length}),t&&(0,Z.jsx)(l,{className:`h-3.5 w-3.5 text-primary`})]})]},e.providerId)})})]})]}),(0,Z.jsxs)(`div`,{ref:qe,className:`relative`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{M(e=>!e),j(!1)},className:_(`flex items-center gap-2.5 rounded-xl border px-3 py-1.5 text-left transition active:scale-98 cursor-pointer shadow-xs`,Ne?`border-primary/50 bg-primary/10 text-foreground`:`border-border bg-card hover:bg-hover text-foreground`),title:`Pilih Model`,children:(0,Z.jsxs)(`div`,{className:`min-w-0 pr-0.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] uppercase font-bold tracking-wider text-muted-foreground leading-none`,children:`Model`}),H?.caps?.vision&&(0,Z.jsx)(`span`,{className:`rounded bg-emerald-500/20 px-1 py-0.2 text-[9px] text-emerald-600 dark:text-emerald-300 font-semibold leading-none`,children:`Vision`})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 mt-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-semibold text-foreground truncate max-w-[130px] sm:max-w-[200px] leading-tight`,children:ft}),(0,Z.jsx)(u,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`})]})]})}),Ne&&(0,Z.jsxs)(`div`,{className:`absolute left-0 top-[calc(100%+8px)] z-50 w-[min(540px,calc(100vw-2rem))] overflow-hidden rounded-2xl border border-border bg-[#181b24] shadow-2xl shadow-black/60 backdrop-blur-xl`,children:[(0,Z.jsxs)(`div`,{className:`border-b border-border p-3 space-y-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Z.jsx)(`img`,{src:se(B),alt:``,className:`h-4 w-4 object-contain shrink-0`,onError:e=>{e.target.style.display=`none`}}),(0,Z.jsxs)(`span`,{className:`text-xs font-semibold text-foreground truncate`,children:[`Model `,Xe]}),(0,Z.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground font-medium`,children:V?.models.length||0})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{M(!1),j(!0)},className:`text-[11px] text-primary hover:underline font-medium cursor-pointer shrink-0`,children:`Ganti Provider`})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-border bg-muted/60 px-3 py-2 text-xs`,children:[(0,Z.jsx)(ne,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,Z.jsx)(`input`,{type:`text`,placeholder:`Cari model ${Xe}...`,value:N,onChange:e=>Ie(e.target.value),className:`w-full bg-transparent text-xs text-foreground outline-none placeholder:text-muted-foreground`,autoFocus:!0}),N&&(0,Z.jsx)(`button`,{type:`button`,onClick:()=>Ie(``),className:`text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(ae,{className:`h-3.5 w-3.5`})})]})]}),(0,Z.jsx)(`div`,{className:`max-h-[60vh] overflow-y-auto p-2.5 custom-scrollbar`,children:Ze.length===0?(0,Z.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:N?`Tidak ada model "${N}" pada provider ${Xe}`:`Tidak ada model yang tersedia untuk provider ${Xe}`}):(0,Z.jsx)(`div`,{className:`grid gap-1.5 sm:grid-cols-2`,children:Ze.map((e,t)=>{let n=e.id===x;return(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{S(e.id),M(!1)},className:_(`rounded-xl border p-2.5 text-left transition cursor-pointer`,n?`border-primary/50 bg-primary/10 text-foreground`:`border-border bg-card hover:bg-hover`),children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`truncate text-xs font-semibold text-foreground`,children:e.displayName}),(0,Z.jsx)(`p`,{className:`truncate text-[10px] text-muted-foreground font-mono mt-0.5`,children:e.id})]}),n&&(0,Z.jsx)(l,{className:`h-4 w-4 text-primary shrink-0 mt-0.5`})]}),e.caps?.vision&&(0,Z.jsx)(`span`,{className:`mt-1.5 inline-block rounded bg-emerald-500/20 px-1.5 py-0.5 text-[9px] text-emerald-600 dark:text-emerald-300 font-medium`,children:`Vision`})]},`${e.provider||B}_${e.id}_${t}`)})})})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`div`,{ref:Je,className:`relative`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>ke(e=>!e),className:`flex items-center gap-1.5 rounded-xl border border-border bg-card px-3 py-2 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-hover active:scale-95 transition cursor-pointer`,children:[(0,Z.jsx)(le,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:`History`}),f.length>0&&(0,Z.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 text-[10px] text-muted-foreground font-semibold`,children:f.length})]}),Oe&&(0,Z.jsxs)(`div`,{className:`absolute right-0 top-[calc(100%+8px)] z-50 w-[min(340px,calc(100vw-2rem))] rounded-2xl border border-border bg-[#181b24] p-2 shadow-2xl shadow-black/60 backdrop-blur-xl`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border mb-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Recent Chats`}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>tt(),className:`flex items-center gap-1 rounded-lg bg-primary/15 border border-primary/30 px-2 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 transition cursor-pointer`,children:[(0,Z.jsx)(te,{className:`h-3 w-3`}),`New`]})]}),(0,Z.jsx)(`div`,{className:`max-h-[48vh] space-y-1.5 overflow-y-auto custom-scrollbar p-1`,children:f.length===0?(0,Z.jsx)(`div`,{className:`py-6 text-center text-xs text-muted-foreground`,children:`No conversations yet.`}):f.map(e=>{let t=e.id===h;return(0,Z.jsxs)(`div`,{onClick:()=>{g(e.id),e.modelId&&S(e.modelId),ke(!1)},className:_(`group flex cursor-pointer items-start justify-between gap-2 rounded-xl border p-2.5 text-left transition`,t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card hover:bg-hover`),children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`truncate text-xs font-medium text-foreground`,children:e.title}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-[10px] text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`truncate max-w-[120px]`,children:e.modelId}),(0,Z.jsx)(`span`,{children:`•`}),(0,Z.jsx)(`span`,{suppressHydrationWarning:!0,children:It(e.updatedAt)})]})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:t=>nt(e.id,t),className:`opacity-0 group-hover:opacity-100 p-1 text-muted-foreground hover:text-rose-500 transition`,title:`Delete chat`,children:(0,Z.jsx)(re,{className:`h-3.5 w-3.5`})})]},e.id)})}),f.length>0&&(0,Z.jsx)(`div`,{className:`border-t border-border pt-2 mt-2`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{confirm(`Clear all chat history?`)&&(m([]),g(``))},className:`w-full flex items-center justify-center gap-1.5 rounded-lg border border-rose-500/20 bg-rose-500/10 py-1.5 text-xs text-rose-600 dark:text-rose-300 hover:bg-rose-500/20 transition cursor-pointer`,children:[(0,Z.jsx)(re,{className:`h-3 w-3`}),`Clear All History`]})})]})]}),(0,Z.jsxs)(`div`,{ref:Ye,className:`relative`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>je(e=>!e),className:`flex items-center gap-1.5 rounded-xl border border-border bg-card px-3 py-2 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-hover active:scale-95 transition cursor-pointer`,title:`Generation Parameters`,children:[(0,Z.jsx)(pe,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:`Settings`})]}),Ae&&(0,Z.jsxs)(`div`,{className:`absolute right-0 top-[calc(100%+8px)] z-50 w-[min(320px,calc(100vw-2rem))] rounded-2xl border border-border bg-[#181b24] p-4 shadow-2xl shadow-black/60 backdrop-blur-xl space-y-3.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border pb-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Parameters`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>je(!1),className:`text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(ae,{className:`h-4 w-4`})})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-foreground`,children:`System Prompt`}),(0,Z.jsx)(`textarea`,{value:w,onChange:e=>_e(e.target.value),rows:3,placeholder:`Prompt`,className:`w-full rounded-xl border border-border bg-muted/50 p-2 text-xs text-foreground outline-none focus:border-primary placeholder:text-muted-foreground`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex items-center justify-between text-xs`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`Temperature`}),(0,Z.jsx)(`span`,{className:`font-mono text-primary font-semibold`,children:T.toFixed(2)})]}),(0,Z.jsx)(`input`,{type:`range`,min:0,max:2,step:.05,value:T,onChange:e=>ve(Number(e.target.value)),className:`w-full accent-[var(--color-primary)] cursor-pointer`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex items-center justify-between text-xs`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`Max Tokens`}),(0,Z.jsx)(`span`,{className:`font-mono text-primary font-semibold`,children:ye})]}),(0,Z.jsx)(`input`,{type:`range`,min:256,max:16384,step:256,value:ye,onChange:e=>be(Number(e.target.value)),className:`w-full accent-[var(--color-primary)] cursor-pointer`})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl border border-border bg-muted/40 p-2.5`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,children:`Stream (SSE)`}),(0,Z.jsx)(`input`,{type:`checkbox`,checked:Se,onChange:e=>Ce(e.target.checked),className:`h-4 w-4 accent-[var(--color-primary)] rounded`})]})]})]}),W.length>0&&(0,Z.jsxs)(`button`,{type:`button`,onClick:rt,className:`flex items-center gap-1.5 rounded-xl border border-border bg-card px-3 py-2 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-hover active:scale-95 transition cursor-pointer`,title:`Clear conversation`,children:[(0,Z.jsx)(re,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:`Clear`})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0 overflow-hidden`,children:[(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto py-6 px-4 custom-scrollbar`,children:W.length===0?(0,Z.jsx)(`div`,{className:`flex min-h-[50vh] items-center justify-center text-center px-4`,children:(0,Z.jsxs)(`div`,{className:`max-w-md space-y-4`,children:[(0,Z.jsx)(`div`,{className:`mx-auto flex size-14 items-center justify-center rounded-2xl border border-border bg-card text-primary shadow-sm`,children:(0,Z.jsx)(c,{className:`h-7 w-7 text-primary`})}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`h2`,{className:`text-xl font-semibold text-foreground tracking-tight`,children:`Start a conversation`}),(0,Z.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:`Simple chat interface to interact with any AI model from connected providers. Supports vision, voice dictation, speech playback, and fast streaming.`})]}),(0,Z.jsx)(`div`,{className:`grid gap-2 pt-2 text-left sm:grid-cols-2`,children:[`Jelaskan arsitektur LLM Gateway dengan Go`,`Analisis perbandingan model AI terbaru`,`Buatkan regex email RFC 5322`,`Optimasi query database SQLite`].map((e,t)=>(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{we(e),Ge.current?.focus()},className:`rounded-xl border border-border bg-card p-3 text-xs text-muted-foreground hover:bg-hover hover:border-primary/40 hover:text-foreground transition cursor-pointer`,children:e},t))})]})}):(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4`,children:[W.map(e=>{let t=e.role===`user`;return(0,Z.jsx)(`div`,{className:_(`flex w-full mb-4`,t?`justify-end`:`justify-start`),children:(0,Z.jsxs)(`div`,{className:_(`max-w-[min(90%,42rem)]`,t?`rounded-2xl rounded-tr-sm bg-primary/10 border border-primary/25 px-4 py-3 text-foreground shadow-xs`:`rounded-2xl rounded-tl-sm bg-card border border-border px-4 py-3 text-foreground shadow-xs w-full`),children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between gap-3 text-xs font-medium text-muted-foreground`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-1.5`,children:t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(he,{className:`h-3.5 w-3.5 text-primary`}),(0,Z.jsx)(`span`,{children:`You`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`img`,{src:se(H?.provider||``),alt:``,className:`h-3.5 w-3.5 object-contain`,onError:e=>{e.target.style.display=`none`}}),(0,Z.jsx)(`span`,{className:`text-foreground font-semibold`,children:e.metrics?.model||H?.displayName||`Assistant`})]})}),(0,Z.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,suppressHydrationWarning:!0,children:It(e.createdAt)})]}),e.attachments&&e.attachments.length>0&&(0,Z.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-2`,children:e.attachments.map(e=>(0,Z.jsx)(`button`,{type:`button`,onClick:()=>P(e.dataUrl),className:`overflow-hidden rounded-xl border border-border bg-muted/30 hover:border-primary/50 transition cursor-pointer`,children:(0,Z.jsx)(`img`,{src:e.dataUrl,alt:e.name,className:`h-24 w-24 object-cover`})},e.id))}),t?(0,Z.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-sm leading-6`,children:e.content}):(0,Z.jsxs)(Z.Fragment,{children:[e.error?(0,Z.jsxs)(`div`,{className:`my-1 rounded-xl border border-rose-500/30 bg-rose-500/10 p-3.5 text-xs`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,Z.jsx)(d,{className:`h-4 w-4 shrink-0 text-rose-500 mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,Z.jsx)(`p`,{className:`font-semibold text-rose-600 dark:text-rose-400`,children:`Gagal Mendapatkan Respon`}),(0,Z.jsx)(`p`,{className:`text-rose-700/90 dark:text-rose-300/90 break-words leading-relaxed`,children:e.error})]})]}),(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 pt-2 border-t border-rose-500/20`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:dt,className:`flex items-center gap-1.5 rounded-lg bg-rose-500/20 px-2.5 py-1 text-[11px] font-medium text-rose-600 dark:text-rose-300 hover:bg-rose-500/30 transition cursor-pointer`,children:[(0,Z.jsx)(fe,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{children:`Coba Lagi`})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>M(!0),className:`flex items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:text-foreground transition cursor-pointer`,children:(0,Z.jsx)(`span`,{children:`Ganti Model`})})]})]}):e.content?(0,Z.jsx)(kt,{content:e.content}):k?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-1 text-xs text-primary animate-pulse`,children:[(0,Z.jsx)(oe,{className:`h-3.5 w-3.5`}),(0,Z.jsx)(`span`,{children:`Generating response…`})]}):(0,Z.jsxs)(`div`,{className:`py-2 text-xs text-muted-foreground flex items-center gap-2`,children:[(0,Z.jsx)(d,{className:`h-3.5 w-3.5 text-amber-500`}),(0,Z.jsx)(`span`,{children:`Respon kosong dari provider. Silakan coba lagi atau gunakan model lain.`})]}),e.content&&(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-border pt-2 text-[11px] text-muted-foreground`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.metrics?.ttftMs!==void 0&&(0,Z.jsxs)(`span`,{children:[`TTFT:`,` `,(0,Z.jsxs)(`strong`,{className:`font-mono text-emerald-600 dark:text-emerald-400`,children:[e.metrics.ttftMs,`ms`]})]}),e.metrics?.durationMs!==void 0&&(0,Z.jsxs)(`span`,{children:[`Total:`,` `,(0,Z.jsxs)(`strong`,{className:`font-mono text-primary font-semibold`,children:[(e.metrics.durationMs/1e3).toFixed(1),`s`]})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>ct(e.id,e.content),className:_(`rounded-lg p-1.5 transition cursor-pointer`,Re===e.id?`bg-emerald-500/20 text-emerald-600 dark:text-emerald-300`:`text-muted-foreground hover:bg-hover hover:text-foreground`),title:Re===e.id?`Stop voice`:`Read aloud`,children:Re===e.id?(0,Z.jsx)(ge,{className:`h-3.5 w-3.5`}):(0,Z.jsx)(ie,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>lt(e.id,e.content),className:`rounded-lg p-1.5 text-muted-foreground hover:bg-hover hover:text-foreground transition cursor-pointer`,title:`Copy response`,children:F===e.id?(0,Z.jsx)(l,{className:`h-3.5 w-3.5 text-emerald-500`}):(0,Z.jsx)(p,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:dt,className:`rounded-lg p-1.5 text-muted-foreground hover:bg-hover hover:text-foreground transition cursor-pointer`,title:`Regenerate`,children:(0,Z.jsx)(fe,{className:`h-3.5 w-3.5`})})]})]})]})]})},e.id)}),De&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-xl border border-rose-500/30 bg-rose-500/10 p-3 text-xs text-rose-700 dark:text-rose-200`,children:[(0,Z.jsx)(d,{className:`h-4 w-4 shrink-0 text-rose-500 dark:text-rose-400 mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex-1`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-rose-700 dark:text-rose-300`,children:`Request Error`}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-rose-700/80 dark:text-rose-200/80`,children:De})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>A(null),className:`text-rose-500 hover:text-rose-700 dark:text-rose-400 dark:hover:text-rose-200 transition cursor-pointer`,children:(0,Z.jsx)(ae,{className:`h-4 w-4`})})]}),(0,Z.jsx)(`div`,{ref:We})]})}),(0,Z.jsxs)(`div`,{className:`shrink-0 pt-2 pb-4 bg-gradient-to-t from-background via-background/95 to-transparent`,children:[O.length>0&&(0,Z.jsx)(`div`,{className:`mx-auto mb-2 flex w-full max-w-3xl flex-wrap gap-2 px-4`,children:O.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-full border border-border bg-card px-3 py-1.5 text-xs shadow-sm`,children:[(0,Z.jsx)(`img`,{src:e.dataUrl,alt:e.name,className:`h-5 w-5 rounded-full object-cover`}),(0,Z.jsx)(`span`,{className:`max-w-[12rem] truncate text-foreground`,children:e.name}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>at(e.id),className:`text-muted-foreground hover:text-rose-500 transition cursor-pointer`,children:(0,Z.jsx)(ae,{className:`h-3.5 w-3.5`})})]},e.id))}),(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-3xl px-4`,children:(0,Z.jsxs)(`div`,{className:_(`rounded-[24px] bg-card px-4 pt-3 pb-2.5 shadow-xl border transition-all ring-1 ring-border/50`,L?`border-rose-500/60 ring-2 ring-rose-500/20`:`border-border focus-within:border-primary/50`),onPaste:ot,children:[L&&(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 border-b border-rose-500/20 pb-2 text-xs text-rose-600 dark:text-rose-300`,children:[(0,Z.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-rose-500 animate-ping`}),(0,Z.jsx)(`span`,{children:`Listening to your voice… Speak now.`})]}),(0,Z.jsx)(`textarea`,{ref:Ge,value:D,onChange:e=>we(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ut())},placeholder:`Pesan...`,rows:1,className:`w-full resize-none bg-transparent text-sm leading-6 text-foreground outline-none placeholder:text-muted-foreground max-h-[22vh] overflow-y-auto custom-scrollbar`}),(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-3 pt-1 border-t border-border/50`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>He.current?.click(),className:`flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground hover:bg-hover hover:text-foreground transition cursor-pointer`,title:`Attach image (Vision)`,children:(0,Z.jsx)(de,{className:`h-4 w-4`})}),(0,Z.jsx)(`input`,{ref:He,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:it}),(0,Z.jsx)(`button`,{type:`button`,onClick:st,className:_(`flex h-8 w-8 items-center justify-center rounded-full transition cursor-pointer`,L?`bg-rose-500 text-white animate-pulse`:`text-muted-foreground hover:bg-hover hover:text-foreground`),title:L?`Stop listening`:`Voice dictation`,children:L?(0,Z.jsx)(ue,{className:`h-4 w-4`}):(0,Z.jsx)(ee,{className:`h-4 w-4`})}),(0,Z.jsx)(`span`,{className:`hidden sm:inline-block max-w-[140px] truncate text-[11px] text-muted-foreground font-medium ml-1`,children:H?H.displayName:`No model`})]}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:k?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>Ve.current?.abort(),className:`flex h-8 w-8 items-center justify-center rounded-full bg-rose-500/20 text-rose-600 dark:text-rose-300 border border-rose-500/40 hover:bg-rose-500/30 transition cursor-pointer`,title:`Stop generation`,children:(0,Z.jsx)(me,{className:`h-3.5 w-3.5`})}):(0,Z.jsx)(`button`,{type:`button`,onClick:()=>void ut(),disabled:!D.trim()&&O.length===0||!x,className:_(`flex h-8 w-8 items-center justify-center rounded-full transition cursor-pointer`,!D.trim()&&O.length===0||!x?`bg-muted text-muted-foreground/40 cursor-not-allowed`:`bg-primary text-primary-foreground hover:bg-primary-light active:scale-95 shadow-md`),title:`Send message`,children:(0,Z.jsx)(ce,{className:`h-4 w-4 stroke-[2.5]`})})})]})]})}),(0,Z.jsx)(`p`,{className:`mx-auto mt-2 max-w-3xl px-4 text-center text-[11px] text-muted-foreground`,children:`Model list is filtered from connected providers. Messages are streamed in real-time.`})]})]})]}),Le&&(0,Z.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/85 p-4 backdrop-blur-sm`,onClick:()=>P(null),children:(0,Z.jsxs)(`div`,{className:`relative max-h-[90vh] max-w-[90vw] overflow-hidden rounded-2xl border border-border bg-card shadow-2xl`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>P(null),className:`absolute right-3 top-3 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-black/60 text-white hover:bg-black`,children:(0,Z.jsx)(ae,{className:`h-4 w-4`})}),(0,Z.jsx)(`img`,{src:Le,alt:`Preview`,className:`max-h-[85vh] max-w-[85vw] object-contain`})]})})]})}var Rt=Lt;export{Rt as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,r as n,t as r}from"./jsx-runtime-B-hcVAMW.js";import{t as i}from"./react-dom-8HkkFvw6.js";import{a,n as o,o as s,r as c,s as l}from"./useNavigate-D06Ztr27.js";function u(e){return e[e.length-1]}function d(e){return typeof e==`function`}function f(e,t){return d(e)?e(t):e}var p=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable;function h(e){for(let t in e)if(p.call(e,t))return!0;return!1}var g=()=>Object.create(null),_=(e,t)=>v(e,t,g);function v(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=S(e)&&S(i);if(!a&&!(b(e)&&b(i)))return i;let o=a?e:y(e);if(!o)return i;let s=a?i:y(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:p.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let m=v(l,f,n,r+1);u[o]=m,m===l&&d++}return c===l&&d===c?e:u}function y(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!m.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!m.call(e,t))return!1;r.push(t)}return r}function b(e){if(!x(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!x(n)||!n.hasOwnProperty(`isPrototypeOf`))}function x(e){return Object.prototype.toString.call(e)===`[object Object]`}function S(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function C(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!C(e[r],t[r],n))return!1;return!0}if(b(e)&&b(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!C(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!C(e[o],t[o],n)))return!1;return i===a}return!1}function w(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function T(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}function E(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}var D=/[\x00-\x1f\x7f"<>`{}]/g;function O(e){return e.replace(D,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function k(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return O(t)}var A=[`http:`,`https:`,`mailto:`,`tel:`];function ee(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}var j={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},te=/[&><\u2028\u2029]/g;function ne(e){return e.replace(te,e=>j[e])}function re(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=k(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=k(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function ie(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function ae(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function oe(){throw Error(`Invariant failed`)}function se(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var M=4,ce=5;function le(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function N(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=le(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function P(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=N(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=L(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=L(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=R(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=R(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=R(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=L(n.fullPath??n.from);e.kind=ce,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=L(n.fullPath??n.from);e.kind=M,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)P(e,t,r,s,i,a,o)}function F(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function I(e){if(e.pathless)for(let t of e.pathless)I(t);if(e.static)for(let t of e.static.values())I(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())I(t);if(e.dynamic?.length){e.dynamic.sort(F);for(let t of e.dynamic)I(t)}if(e.optional?.length){e.optional.sort(F);for(let t of e.optional)I(t)}if(e.wildcard?.length){e.wildcard.sort(F);for(let t of e.wildcard)I(t)}}function L(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function R(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function ue(e,t){let n=L(`/`),r=new Uint16Array(6);for(let t of e)P(!1,r,t,1,n,0);I(n),t.masksTree=n,t.flatCache=se(1e3)}function z(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=U(e,t.masksTree);return t.flatCache.set(e,r),r}function B(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=L(`/`),P(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),U(r,o,n)}function de(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=U(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=fe(a.route)),t.matchCache.set(r,a),a}function V(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function H(e,t=!1,n){let r=L(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return P(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&oe(),a[e.id]=e,s!==0&&e.path){let t=V(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),I(r),{processedTree:{segmentTree:r,singleCache:se(1e3),matchCache:se(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function U(e,t,n=!1){let r=e.split(`/`),i=me(e,r,t,n);if(!i)return null;let[a]=W(e,r,i);return{route:i.node.route,rawParams:a}}function W(e,t,n){let r=pe(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===M)break;if(u.kind===ce){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function fe(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function pe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function me(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!u(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!J(l,n))continue;if(i.parse){if(!q(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==M&&J(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===M||i.kind===2)&&J(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(q(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&K(p,o))return n;J(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+G(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+G(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+G(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+G(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function G(e,t){return 2**(e-t-1)}function K(e,t){return e===2**(t-1)-1}function q(e,t,n){let r,i;try{[r,i]=W(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function J(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===M)>(e.node.kind===M)||t.node.kind===M==(e.node.kind===M)&&t.depth>e.depth)))}function Y(e){return he(e.filter(e=>e!==void 0).join(`/`))}function he(e){return e.replace(/\/{2,}/g,`/`)}function ge(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function _e(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function ve(e){return _e(ge(e))}function ye(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function be(e,t,n){return ye(e,n)===ye(t,n)}function xe({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&u(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(u(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=he(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function Se(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function Ce(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>Te(e,n)).join(`/`):Te(r,n):r}function we({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=N(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=Ce(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Ce(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Ce(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function Te(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var Ee=`__root__`;function De(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Oe(e){return e instanceof Response&&!!e.options}var ke=`Error preloading route! ☝️`,Ae=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Ee:this.parentRoute||oe();let r=n?Ee:t?.path;r&&r!==`/`&&(r=ge(r));let i=t?.id||r,a=n?Ee:Y([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=Y([`/`,a]));let o=a===`__root__`?`/`:Y([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=_e(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>De({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},je=class extends Ae{constructor(e){super(e)}},X=e(t(),1),Me=r();function Ne({children:e,fallback:t=null}){return Pe()?(0,Me.jsx)(X.Fragment,{children:e}):(0,Me.jsx)(X.Fragment,{children:t})}function Pe(){return X.useSyncExternalStore(Fe,()=>!0,()=>!1)}function Fe(){return()=>{}}var Ie=X.createContext(void 0),Le=X.createContext(void 0),Re=n((e=>{var n=t();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useState,o=n.useEffect,s=n.useLayoutEffect,c=n.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=n.useSyncExternalStore===void 0?f:n.useSyncExternalStore})),ze=n(((e,t)=>{t.exports=Re()})),Be=n((e=>{var n=t(),r=ze();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=n.useRef,c=n.useEffect,l=n.useMemo,u=n.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),Ve=n(((e,t)=>{t.exports=Be()}))();function He(e,t){return e===t}function Ue(e,t,n=He){let r=(0,X.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,X.useCallback)(()=>e?.get(),[e]);return(0,Ve.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var We={get(){},subscribe(){return{unsubscribe(){}}}};function Ge(e,t){let n=X.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=v(n.current,i):i}}function Z(e){let t=c(),n=X.useContext(e.from?Le:Ie),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),i=Ge(e,t),a=Ue(r??We,e=>e?i(e):We);if(a!==We)return a;(e.shouldThrow??!0)&&oe()}function Ke(e){return Z({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function qe(e){let{select:t,...n}=e;return Z({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Je(e){return Z({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Ye(e){return Z({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Xe(e){return Z({...e,select:t=>e.select?e.select(t.context):t.context})}var Ze=e(i(),1);function Qe(e,t){let n=c(),r=s(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:u,preload:d,preloadDelay:p,preloadIntentProximity:m,hashScrollIntoView:h,replace:g,startTransition:_,resetScroll:v,viewTransition:y,children:b,target:x,disabled:S,style:w,className:T,onClick:E,onBlur:D,onFocus:O,onMouseEnter:k,onMouseLeave:A,onTouchStart:j,ignoreBlocker:te,params:ne,search:re,hash:ie,state:ae,mask:oe,reloadDocument:se,unsafeRelative:M,from:ce,_fromLocation:le,...N}=e,P=Pe(),F=X.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),I=Ue(n.stores.location,e=>e,(e,t)=>e.href===t.href),L=X.useMemo(()=>{let e={_fromLocation:I,...F};return n.buildLocation(e)},[n,I,F]),R=L.maskedLocation?L.maskedLocation.publicHref:L.publicHref,ue=L.maskedLocation?L.maskedLocation.external:L.external,z=X.useMemo(()=>at(R,ue,n.history,S),[S,ue,R,n.history]),B=X.useMemo(()=>{if(z?.external)return ee(z.href,n.protocolAllowlist)?void 0:z.href;if(!ot(u)&&typeof u==`string`&&u.indexOf(`:`)!==-1)try{return new URL(u),ee(u,n.protocolAllowlist)?void 0:u}catch{}},[u,z,n.protocolAllowlist]),de=X.useMemo(()=>{if(B)return!1;if(o?.exact){if(!be(I.pathname,L.pathname,n.basepath))return!1}else{let e=ye(I.pathname,n.basepath),t=ye(L.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!C(I.search,L.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:!o?.includeHash||P&&I.hash===L.hash},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,I,B,P,L.hash,L.pathname,L.search,n.basepath]),V=de?f(i,{})??et:$e,H=de?$e:f(a,{})??$e,U=[T,V.className,H.className].filter(Boolean).join(` `),W=(w||V.style||H.style)&&{...w,...V.style,...H.style},[fe,pe]=X.useState(!1),me=X.useRef(!1),G=e.reloadDocument||B?!1:d??n.options.defaultPreload,K=p??n.options.defaultPreloadDelay??0,q=X.useCallback(()=>{n.preloadRoute({...F,_builtLocation:L}).catch(e=>{console.warn(e),console.warn(ke)})},[n,F,L]);l(r,X.useCallback(e=>{e?.isIntersecting&&q()},[q]),it,{disabled:!!S||G!==`viewport`}),X.useEffect(()=>{me.current||!S&&G===`render`&&(q(),me.current=!0)},[S,q,G]);let J=e=>{let t=e.currentTarget.getAttribute(`target`),r=x===void 0?t:x;if(!S&&!ct(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Ze.flushSync)(()=>{pe(!0)});let t=n.subscribe(`onResolved`,()=>{t(),pe(!1)});n.navigate({...F,replace:g,resetScroll:v,hashScrollIntoView:h,startTransition:_,viewTransition:y,ignoreBlocker:te})}};if(B)return{...N,ref:r,href:B,...b&&{children:b},...x&&{target:x},...S&&{disabled:S},...w&&{style:w},...T&&{className:T},...E&&{onClick:E},...D&&{onBlur:D},...O&&{onFocus:O},...k&&{onMouseEnter:k},...A&&{onMouseLeave:A},...j&&{onTouchStart:j}};let Y=e=>{if(S||G!==`intent`)return;if(!K){q();return}let t=e.currentTarget;if(Q.has(t))return;let n=setTimeout(()=>{Q.delete(t),q()},K);Q.set(t,n)},he=e=>{S||G!==`intent`||q()},ge=e=>{if(S||!G||!K)return;let t=e.currentTarget,n=Q.get(t);n&&(clearTimeout(n),Q.delete(t))};return{...N,...V,...H,href:z?.href,ref:r,onClick:$([E,J]),onBlur:$([D,ge]),onFocus:$([O,Y]),onMouseEnter:$([k,Y]),onMouseLeave:$([A,ge]),onTouchStart:$([j,he]),disabled:!!S,target:x,...W&&{style:W},...U&&{className:U},...S&&tt,...de&&nt,...P&&fe&&rt}}var $e={},et={className:`active`},tt={role:`link`,"aria-disabled":!0},nt={"data-status":`active`,"aria-current":`page`},rt={"data-transitioning":`transitioning`},Q=new WeakMap,it={rootMargin:`100px`},$=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function at(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function ot(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var st=X.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Qe(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return X.createElement(`a`,t,o)}return X.createElement(n,a,o)});function ct(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var lt=class extends Ae{constructor(e){super(e),this.useMatch=e=>Z({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Xe({...e,from:this.id}),this.useSearch=e=>Ye({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Je({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>qe({...e,from:this.id}),this.useLoaderData=e=>Ke({...e,from:this.id}),this.useNavigate=()=>o({from:this.fullPath}),this.Link=X.forwardRef((e,t)=>(0,Me.jsx)(st,{ref:t,from:this.fullPath,...e}))}};function ut(e){return new lt(e)}function dt(){return e=>pt(e)}var ft=class extends je{constructor(e){super(e),this.useMatch=e=>Z({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Xe({...e,from:this.id}),this.useSearch=e=>Ye({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Je({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>qe({...e,from:this.id}),this.useLoaderData=e=>Ke({...e,from:this.id}),this.useNavigate=()=>o({from:this.fullPath}),this.Link=X.forwardRef((e,t)=>(0,Me.jsx)(st,{ref:t,from:this.fullPath,...e}))}};function pt(e){return new ft(e)}function mt(e){return new ht(e,{silent:!0}).createRoute}var ht=class{constructor(e,t){this.path=e,this.createRoute=e=>{let t=ut(e);return t.isRoot=!1,t},this.silent=t?.silent}};function gt(e,t){let n,r,i,o,s=()=>(n||=e().then(e=>{n=void 0,r=e[t??`default`]}).catch(e=>{if(i=e,T(i)&&i instanceof Error&&typeof window<`u`&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;sessionStorage.getItem(e)||(sessionStorage.setItem(e,`1`),o=!0)}}),n),c=function(e){if(o)throw window.location.reload(),new Promise(()=>{});if(i)throw i;if(!r)if(a)a(s());else throw s();return X.createElement(r,e)};return c.preload=s,c}var _t=`modulepreload`,vt=function(e){return`/`+e},yt={},bt=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=vt(t,n),t=s(t),t in yt)return;yt[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:_t,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};export{ae as A,u as B,de as C,se as D,H as E,ne as F,v as H,f as I,h as L,re as M,C as N,oe as O,ie as P,ee as R,z as S,ue as T,_ as V,Y as _,st as a,_e as b,Ie as c,Oe as d,De as f,we as g,Se as h,dt as i,w as j,A as k,Ne as l,he as m,gt as n,Ge as o,Ee as p,mt as r,Ue as s,bt as t,Pe as u,xe as v,B as w,fe as x,ve as y,E as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{n as r}from"./useNavigate-D06Ztr27.js";import{t as i}from"./useQuery-BrM5_EQu.js";import{n as a}from"./QueryClientProvider-BjElddVn.js";import{n as o,r as s}from"./api-lXjeGSiV.js";import{t as c}from"./createLucideIcon-CLdWFMku.js";import{t as l}from"./check-36OnHiEM.js";import{t as u}from"./chevron-down-DxUrtHFo.js";import{u as d}from"./kit-DGWILC5k.js";import{t as f}from"./play-CPV0a6Tn.js";import{t as p}from"./plus-qKI-KwZh.js";import{t as m}from"./refresh-cw-CHzni4H4.js";import{t as h}from"./server-CAbKLNFx.js";import{t as g}from"./sparkles-DZ5Pl1vD.js";import{t as _}from"./trash-2-D9HI9O7Q.js";import{t as v}from"./x-CGuQtexA.js";import{t as y}from"./zap-BS7lyU9U.js";import{t as b}from"./utils-B6KiDbIe.js";import{n as x}from"./dist-yiyhte89.js";import{n as S,t as C}from"./headerSearch-C758FsaX.js";var w=c(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),T=e(t(),1),E=n(),D={gemini:`gemini.png`,google:`gemini.png`,gemma:`gemini.png`,deepseek:`deepseek.png`,ds:`deepseek.png`,nvidia:`nvidia.png`,nim:`nvidia.png`,"cloudflare-ai":`cloudflare-ai.png`,cloudflare:`cloudflare-ai.png`,kimi:`kimi.png`,moonshot:`kimi.png`,mimo:`mimo-free.png`,"mimo-free":`mimo-free.png`,xiaomi:`xiaomi-mimo.png`,"xiaomi-mimo":`xiaomi-mimo.png`,copilot:`copilot.png`,github:`copilot.png`,antigravity:`antigravity.png`,ag:`antigravity.png`,cline:`cline.png`,clinepass:`clinepass.png`,kiro:`kiro.png`,"opencode-go":`opencode-go.png`,"opencode-free":`opencode.png`,opencode:`opencode.png`,qoder:`qoder.png`,exa:`exa.png`,poolside:`poolside.png`,groq:`groq.png`,openrouter:`openrouter.png`,mistral:`mistral.png`,codestral:`mistral.png`,sambanova:`sambanova.png`,siliconflow:`siliconflow.png`,chutes:`chutes.png`,together:`together.png`,ollama:`ollama.png`,"ollama-cloud":`ollama.png`,cohere:`cohere.png`,minimax:`minimax.png`,qwen:`qwen.png`,glm:`glm.png`,huggingface:`huggingface.png`,vercel:`vercel.png`,"vercel-ai-gateway":`vercel.png`,tokenrouter:`tokenrouter.png`,tabitoken:`tokenrouter.png`,tabi:`tokenrouter.png`,"gemini-cli":`gemini-cli.png`,"grok-cli":`grok-cli.png`,grok:`grok-cli.png`,xai:`grok-cli.png`,codebuddy:`codebuddy-intl.png`,"codebuddy-intl":`codebuddy-intl.png`,"codebuddy-cn":`codebuddy-cn.png`,featherless:`featherless.png`,morph:`morph.png`,llm7:`llm7.png`,anthropic:`claude.png`,claude:`claude.png`,openai:`openai.png`,oa:`openai.png`,codex:`codex.png`,cx:`codex.png`,hyperbolic:`hyperbolic.png`,"api-airforce":`api-airforce.png`,airforce:`api-airforce.png`,nara:`nara.svg`,bynara:`bynara.svg`};function O(e,t){if(!e&&!t)return null;let n=(e||``).toLowerCase().trim().replace(/^(node_|openai-compatible-chat-|openai-compatible-|anthropic-compatible-)/,``),r=(t||``).toLowerCase().trim().replace(/^(node_|openai-compatible-chat-|openai-compatible-|anthropic-compatible-)/,``),i=D[n]||(r?D[r]:void 0)||D[e.toLowerCase().trim()]||(t?D[t.toLowerCase().trim()]:void 0);return i?`/providers/${i}`:`/providers/${n}.png`}var k=new Set([`openai`,`oa`,`anthropic`,`claude`,`perplexity`,`nebius`,`byteplus`,`bazaarlink`,`codex`,`cx`,`cerebras`,`deepseek`,`ds`,`qwen`,`glm`,`llm7`,`xai`,`grok`,`grok-cli`,`kiro`,`poolside`]);function A(){return(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,E.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#ff5f56]`}),(0,E.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#ffbd2e]`}),(0,E.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#27c93f]`})]})}function j({name:e,icon:t,alias:n,providerId:r,isCustomNode:i,connectedCount:a,allDisabled:o,onClick:s,onDelete:c}){let[l,u]=(0,T.useState)(!1),d=(0,T.useMemo)(()=>t&&(t.startsWith(`/`)||t.startsWith(`http`)||t.startsWith(`data:`))?t:O(t||r||e,n),[t,r,e,n]);return(0,E.jsxs)(`div`,{onClick:s,className:`group flex min-h-[54px] cursor-pointer items-center justify-between gap-3 rounded-xl border border-border bg-card px-3.5 py-2.5 shadow-xs transition-all hover:border-border-strong hover:bg-hover active:scale-[0.99]`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-muted`,children:d&&!l?(0,E.jsx)(`img`,{src:d,alt:e,onError:()=>u(!0),className:`h-6 w-6 rounded-md object-contain`,loading:`lazy`}):i?(0,E.jsx)(`div`,{className:`flex h-full w-full items-center justify-center bg-primary/10 text-[11px] font-bold text-primary`,children:e.slice(0,2).toUpperCase()}):(0,E.jsx)(`span`,{className:`text-[11px] font-semibold text-muted-foreground uppercase`,children:e.slice(0,2)})}),(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`h3`,{className:`truncate text-xs font-semibold text-foreground transition-colors group-hover:text-primary`,children:e}),(0,E.jsx)(`div`,{className:`mt-0.5 flex items-center gap-1.5 text-xs`,children:o?(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-border bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:[(0,E.jsx)(w,{className:`h-2.5 w-2.5 text-dim`}),`Disabled`]}):a>0?(0,E.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] font-medium text-emerald-600 dark:text-emerald-400`,children:[(0,E.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-500 dark:bg-emerald-400 shadow-[0_0_6px_rgba(52,211,153,0.8)]`}),a,` Connected`]}):(0,E.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`No connections`})})]})]}),c&&(0,E.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},className:`opacity-0 group-hover:opacity-100 p-1.5 rounded-lg text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-all cursor-pointer shrink-0 active:scale-90`,title:`Hapus ${e}`,children:(0,E.jsx)(_,{className:`h-3.5 w-3.5`})})]})}function M({initialVariant:e=`openai`,isOpen:t,onClose:n,onCreated:r}){let[i,a]=(0,T.useState)(e),c=i===`anthropic`,[d,f]=(0,T.useState)(``),[p,x]=(0,T.useState)(``),[S,C]=(0,T.useState)(`chat`),[w,D]=(0,T.useState)(c?`https://api.anthropic.com/v1`:`https://api.openai.com/v1`),[O,k]=(0,T.useState)(``),[A,j]=(0,T.useState)(``),[M,N]=(0,T.useState)(``),[P,F]=(0,T.useState)(``),[I,L]=(0,T.useState)(!1),[R,z]=(0,T.useState)([]),[B,V]=(0,T.useState)([]),[H,U]=(0,T.useState)(``),[W,G]=(0,T.useState)(!1),[K,q]=(0,T.useState)(null),[ee,te]=(0,T.useState)(``),[ne,re]=(0,T.useState)(``),[J,Y]=(0,T.useState)(!1),[X,Z]=(0,T.useState)(!1),[Q,$]=(0,T.useState)(null),ie=(0,T.useRef)(null),ae=e=>{a(e),e===`anthropic`?w===`https://api.openai.com/v1`&&D(`https://api.anthropic.com/v1`):w===`https://api.anthropic.com/v1`&&D(`https://api.openai.com/v1`)},oe=e=>{let t=e.target.files?.[0];if(!t)return;if(t.size>2097152){alert(`File size max 2MB`);return}let n=new FileReader;n.onload=()=>{typeof n.result==`string`&&N(n.result)},n.readAsDataURL(t)},se=()=>{z(e=>[...e,{id:`h_${Date.now()}_${Math.random().toString(36).slice(2,5)}`,key:``,value:``}])},ce=e=>{z(t=>t.filter(t=>t.id!==e))},le=(e,t,n)=>{z(r=>r.map(r=>r.id===e?{...r,[t]:n}:r))},ue=()=>{let e=H.trim();if(e){if(B.some(t=>t.id.toLowerCase()===e.toLowerCase())){U(``);return}V(t=>[...t,{id:e,name:e,vision:!1,reasoning:!1}]),U(``)}},de=e=>{V(t=>t.filter(t=>t.id!==e))},fe=(e,t)=>{V(n=>n.map(n=>n.id===e?{...n,[t]:!n[t]}:n))};return t?(0,E.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/75 p-4 backdrop-blur-sm`,onClick:n,children:(0,E.jsxs)(`div`,{className:`w-full max-w-[500px] overflow-hidden rounded-2xl border border-[#2f3545] bg-[#161920] shadow-2xl transition-all`,onClick:e=>e.stopPropagation(),children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[#252a38] px-5 py-3.5 bg-[#11141a]`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,E.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#ff5f56]`}),(0,E.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#ffbd2e]`}),(0,E.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#27c93f]`})]}),(0,E.jsx)(`h3`,{className:`text-sm font-bold text-white tracking-tight`,children:`Add Custom Provider`})]}),(0,E.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-lg p-1.5 text-zinc-400 hover:bg-[#232836] hover:text-white transition-colors cursor-pointer`,children:(0,E.jsx)(v,{className:`h-4 w-4`})})]}),(0,E.jsx)(`div`,{className:`px-5 pt-4`,children:(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-1 rounded-xl border border-[#272d3b] bg-[#11141a] p-1`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:()=>ae(`openai`),className:b(`flex items-center justify-center gap-2 rounded-lg py-1.5 text-xs font-semibold transition-all cursor-pointer`,c?`text-zinc-400 hover:text-white hover:bg-[#1a1e28]`:`bg-[#222836] text-white border border-[#374055] shadow-sm`),children:`OpenAI Compatible`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>ae(`anthropic`),className:b(`flex items-center justify-center gap-2 rounded-lg py-1.5 text-xs font-semibold transition-all cursor-pointer`,c?`bg-[#222836] text-white border border-[#374055] shadow-sm`:`text-zinc-400 hover:text-white hover:bg-[#1a1e28]`),children:`Anthropic`})]})}),(0,E.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),!d.trim()||!w.trim())return;Y(!0);let t={};R.forEach(e=>{e.key.trim()&&e.value.trim()&&(t[e.key.trim()]=e.value.trim())});let i={name:d.trim(),prefix:p.trim()||void 0,type:c?`anthropic-compatible`:`openai-compatible`,apiType:c?void 0:S,baseUrl:w.trim(),website:O.trim()||void 0,signupUrl:O.trim()||void 0,apiKey:A.trim()||void 0,icon:M.trim()||void 0,headers:t,models:B.map(e=>({id:e.id,name:e.name||e.id,vision:e.vision,reasoning:e.reasoning}))};try{r(await o.createProviderNode(i)),n()}catch{r({id:`node_${Date.now()}`,name:d.trim(),type:c?`anthropic-compatible`:`openai-compatible`,data:i}),n()}finally{Y(!1)}},className:`p-5 space-y-3.5 max-h-[75vh] overflow-y-auto`,children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1`,children:`Provider Name`}),(0,E.jsx)(`input`,{type:`text`,required:!0,placeholder:`Nama Provider`,value:d,onChange:e=>f(e.target.value),className:`w-full rounded-xl border border-[#2f3545] bg-[#12141a] px-3.5 py-2 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none transition-colors`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1`,children:[`Model Prefix `,(0,E.jsx)(`span`,{className:`text-zinc-500 font-normal`,children:`(Optional)`})]}),(0,E.jsx)(`input`,{type:`text`,placeholder:`Prefix`,value:p,onChange:e=>x(e.target.value),className:`w-full rounded-xl border border-[#2f3545] bg-[#12141a] px-3.5 py-2 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none font-mono transition-colors`})]})]}),!c&&(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1`,children:`API Type`}),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsxs)(`select`,{value:S,onChange:e=>C(e.target.value),className:`w-full appearance-none rounded-xl border border-[#2f3545] bg-[#12141a] px-3.5 py-2 text-xs text-white focus:border-orange-500 focus:outline-none pr-8 cursor-pointer`,children:[(0,E.jsx)(`option`,{value:`chat`,children:`Chat Completions (/v1/chat/completions)`}),(0,E.jsx)(`option`,{value:`responses`,children:`Responses API (/v1/responses)`})]}),(0,E.jsx)(u,{className:`pointer-events-none absolute right-3 top-2.5 h-3.5 w-3.5 text-zinc-400`})]})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1`,children:`Base URL`}),(0,E.jsx)(`input`,{type:`text`,required:!0,placeholder:c?`https://api.anthropic.com/v1`:`https://api.openai.com/v1`,value:w,onChange:e=>D(e.target.value),className:`w-full rounded-xl border border-[#2f3545] bg-[#12141a] px-3.5 py-2 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none font-mono transition-colors`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1`,children:[`Website / Get API Key URL `,(0,E.jsx)(`span`,{className:`text-zinc-500 font-normal`,children:`(Optional)`})]}),(0,E.jsx)(`input`,{type:`url`,placeholder:`https://... (URL untuk mendapatkan API Key)`,value:O,onChange:e=>k(e.target.value),className:`w-full rounded-xl border border-[#2f3545] bg-[#12141a] px-3.5 py-2 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none font-mono transition-colors`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1`,children:`API Key`}),(0,E.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,E.jsx)(`input`,{type:`password`,placeholder:`Key`,value:A,onChange:e=>{j(e.target.value),$(null)},className:`flex-1 rounded-xl border border-[#2f3545] bg-[#12141a] px-3.5 py-2 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none font-mono transition-colors`}),(0,E.jsxs)(`button`,{type:`button`,onClick:async()=>{if(!w.trim())return;Z(!0),$(null);let e={};R.forEach(t=>{t.key.trim()&&t.value.trim()&&(e[t.key.trim()]=t.value.trim())});let t=ee.trim()||A.trim()||void 0,n=ne.trim()||(B[0]?.id?B[0].id:void 0);try{let e=await o.validateProvider({baseUrl:w.trim(),apiKey:t,type:c?`anthropic-compatible`:`openai-compatible`,modelId:n});$({valid:e.valid,error:e.message})}catch(e){$({valid:!1,error:s(e)})}finally{Z(!1)}},disabled:!w.trim()||X,className:`shrink-0 rounded-xl bg-[#222836] hover:bg-[#2b3345] border border-[#353e54] px-4 py-2 text-xs font-semibold text-white transition-all disabled:opacity-50 flex items-center gap-1.5 cursor-pointer`,children:[X?(0,E.jsx)(m,{className:`h-3.5 w-3.5 animate-spin text-orange-400`}):(0,E.jsx)(y,{className:`h-3.5 w-3.5 text-orange-400`}),(0,E.jsx)(`span`,{children:`Check`})]})]})]}),Q&&(0,E.jsxs)(`div`,{className:b(`rounded-xl border px-3.5 py-2 text-xs flex items-center gap-2`,Q.valid?`border-emerald-500/30 bg-emerald-500/10 text-emerald-300`:`border-rose-500/30 bg-rose-500/10 text-rose-300`),children:[Q.valid?(0,E.jsx)(l,{className:`h-4 w-4 shrink-0 text-emerald-400`}):(0,E.jsx)(v,{className:`h-4 w-4 shrink-0 text-rose-400`}),(0,E.jsx)(`span`,{children:Q.valid?`Koneksi berhasil terverifikasi!`:Q.error||`Validasi gagal`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,E.jsxs)(`label`,{className:`text-xs font-medium text-zinc-300`,children:[`Models `,(0,E.jsxs)(`span`,{className:`text-zinc-500 font-normal`,children:[`(`,B.length,`)`]})]}),(0,E.jsxs)(`button`,{type:`button`,onClick:async()=>{if(w.trim()){G(!0),q(null);try{let e=w.trim().replace(/\/chat\/completions$/,``).replace(/\/messages$/,``).replace(/\/responses$/,``),t=e.endsWith(`/models`)?e:`${e}/models`,n={};R.forEach(e=>{e.key.trim()&&e.value.trim()&&(n[e.key.trim()]=e.value.trim())});let r=await o.discoverProviderModels(c?`claude`:`openai`,{apiKey:A.trim()||void 0,customModelsUrl:t}),i=r?.models??r?.data??[];if(Array.isArray(i)&&i.length>0){let e=i.map(e=>{let t=typeof e==`string`?e:e.id||e.name||``;return{id:t,name:typeof e==`string`?e:e.name||e.id||t,vision:typeof e==`object`&&!!e.vision,reasoning:typeof e==`object`&&!!e.reasoning}});V(t=>{let n=new Set(t.map(e=>e.id.toLowerCase())),r=[...t];return e.forEach(e=>{e.id&&!n.has(e.id.toLowerCase())&&r.push(e)}),r}),q({ok:!0,text:`${e.length} Model Ditemukan`})}else q({ok:!1,text:`Model tidak ditemukan`})}catch(e){q({ok:!1,text:s(e)||`Gagal mengambil`})}finally{G(!1)}}},disabled:W||!w.trim(),className:`inline-flex items-center gap-1 text-[11px] font-medium text-orange-400 hover:text-orange-300 disabled:opacity-40 transition-colors cursor-pointer`,children:[W?(0,E.jsx)(m,{className:`h-3 w-3 animate-spin`}):(0,E.jsx)(g,{className:`h-3 w-3`}),(0,E.jsx)(`span`,{children:`Fetch Models`})]})]}),K&&(0,E.jsx)(`div`,{className:b(`mb-2 rounded-lg px-2.5 py-1 text-[11px]`,K.ok?`bg-emerald-500/10 text-emerald-400 border border-emerald-500/20`:`bg-rose-500/10 text-rose-400 border border-rose-500/20`),children:K.text}),(0,E.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,E.jsx)(`input`,{type:`text`,placeholder:`Nama model (e.g. gpt-4o, claude-3-5-sonnet)`,value:H,onChange:e=>U(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),ue())},className:`flex-1 rounded-xl border border-[#2f3545] bg-[#12141a] px-3.5 py-2 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none transition-colors`}),(0,E.jsx)(`button`,{type:`button`,onClick:ue,disabled:!H.trim(),className:`shrink-0 rounded-xl bg-[#222836] hover:bg-[#2b3345] border border-[#353e54] px-3.5 py-2 text-xs font-semibold text-white transition-all disabled:opacity-50 cursor-pointer`,children:`+ Tambah`})]}),B.length>0&&(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-2 max-h-32 overflow-y-auto`,children:B.map(e=>(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-[#272d3b] bg-[#11141a] px-2.5 py-1 text-xs text-zinc-200`,children:[(0,E.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.id}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>fe(e.id,`vision`),className:b(`text-[10px] px-1 rounded transition-colors cursor-pointer`,e.vision?`text-sky-400 bg-sky-950/40`:`text-zinc-600 hover:text-zinc-400`),title:`Toggle Vision`,children:`👁`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>fe(e.id,`reasoning`),className:b(`text-[10px] px-1 rounded transition-colors cursor-pointer`,e.reasoning?`text-amber-400 bg-amber-950/40`:`text-zinc-600 hover:text-zinc-400`),title:`Toggle Reasoning`,children:`🧠`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>de(e.id),className:`text-zinc-500 hover:text-rose-400 transition-colors ml-0.5 cursor-pointer`,children:(0,E.jsx)(v,{className:`h-3 w-3`})})]},e.id))})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,E.jsxs)(`label`,{className:`text-xs font-medium text-zinc-300`,children:[`Custom Headers `,(0,E.jsxs)(`span`,{className:`text-zinc-500 font-normal`,children:[`(`,R.length,`)`]})]}),(0,E.jsx)(`button`,{type:`button`,onClick:se,className:`text-[11px] font-medium text-orange-400 hover:text-orange-300 transition-colors cursor-pointer`,children:`+ Tambah Header`})]}),R.length>0&&(0,E.jsx)(`div`,{className:`space-y-2 pt-1 max-h-32 overflow-y-auto`,children:R.map(e=>(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`input`,{type:`text`,placeholder:`Header Name`,value:e.key,onChange:t=>le(e.id,`key`,t.target.value),className:`w-1/2 rounded-xl border border-[#2f3545] bg-[#12141a] px-3 py-1.5 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none font-mono`}),(0,E.jsx)(`input`,{type:`text`,placeholder:`Value`,value:e.value,onChange:t=>le(e.id,`value`,t.target.value),className:`w-1/2 rounded-xl border border-[#2f3545] bg-[#12141a] px-3 py-1.5 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>ce(e.id),className:`p-1.5 text-zinc-500 hover:text-rose-400 transition-colors shrink-0 cursor-pointer`,children:(0,E.jsx)(_,{className:`h-3.5 w-3.5`})})]},e.id))})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1.5`,children:[`Icon `,(0,E.jsx)(`span`,{className:`text-zinc-500 font-normal`,children:`(Optional)`})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2.5 flex-wrap`,children:[(0,E.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-[#2f3545] bg-[#12141a]`,children:M?(0,E.jsx)(`img`,{src:M,alt:`Preview`,className:`h-6 w-6 object-contain`}):(0,E.jsx)(h,{className:`h-4 w-4 text-zinc-500`})}),(0,E.jsx)(`input`,{ref:ie,type:`file`,accept:`image/*`,onChange:oe,className:`hidden`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>ie.current?.click(),className:`rounded-xl border border-[#2f3545] bg-[#1e222b] px-3 py-1.5 text-xs font-medium text-zinc-300 hover:bg-[#252a36] hover:text-white transition-colors cursor-pointer`,children:`Upload`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>L(!I),className:`rounded-xl border border-[#2f3545] bg-[#1e222b] px-3 py-1.5 text-xs font-medium text-zinc-300 hover:bg-[#252a36] hover:text-white transition-colors cursor-pointer`,children:`URL`}),[{label:`OpenAI`,src:`/providers/openai.png`},{label:`Claude`,src:`/providers/claude.png`},{label:`Gemini`,src:`/providers/gemini.png`},{label:`Groq`,src:`/providers/groq.png`},{label:`Ollama`,src:`/providers/ollama.png`},{label:`DeepSeek`,src:`/providers/deepseek.png`}].map(e=>(0,E.jsx)(`button`,{type:`button`,onClick:()=>N(e.src),className:b(`flex h-7 w-7 items-center justify-center rounded-lg border border-[#2f3545] bg-[#12141a] hover:border-orange-500 transition-all cursor-pointer p-1`,M===e.src&&`border-orange-500 bg-[#222836]`),title:e.label,children:(0,E.jsx)(`img`,{src:e.src,alt:e.label,className:`h-4 w-4 object-contain`})},e.label)),M&&(0,E.jsx)(`button`,{type:`button`,onClick:()=>N(``),className:`text-zinc-500 hover:text-rose-400 p-1 cursor-pointer`,title:`Reset Icon`,children:(0,E.jsx)(v,{className:`h-3.5 w-3.5`})})]}),I&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,E.jsx)(`input`,{type:`text`,placeholder:`https://... atau /providers/...`,value:P,onChange:e=>F(e.target.value),className:`flex-1 rounded-xl border border-[#2f3545] bg-[#12141a] px-3 py-1.5 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>{P.trim()&&N(P.trim())},className:`rounded-xl bg-[#222836] border border-[#353e54] px-3 py-1.5 text-xs font-semibold text-white hover:bg-[#2b3345] cursor-pointer`,children:`Terapkan`})]})]}),(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-3 border-t border-[#252a38]`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-xl border border-[#2f3545] bg-[#1c202a] px-4 py-2 text-xs font-medium text-zinc-300 hover:bg-[#242a37] hover:text-white transition-colors cursor-pointer`,children:`Batal`}),(0,E.jsx)(`button`,{type:`submit`,disabled:J||!d.trim()||!w.trim(),className:`rounded-xl bg-[#f0643b] px-5 py-2 text-xs font-semibold text-white hover:bg-[#ff744c] shadow-sm disabled:opacity-50 transition-colors cursor-pointer active:scale-95`,children:J?`Menyimpan...`:`Simpan`})]})]})]})}):null}function N({provider:e,connections:t,isOpen:n,onClose:r,onUpdate:i}){let[a,s]=(0,T.useState)(null),[c,l]=(0,T.useState)(null);if(!n||!e)return null;let u=async e=>{try{await o.updateProvider(e.id,{isActive:!e.isActive}),i()}catch(e){console.error(e)}},d=async e=>{s(e),l(null);try{let t=await o.testProvider(e);l({id:e,msg:t.success?`Online (${t.latencyMs??150}ms)`:t.message||`Test failed`,ok:t.success})}catch{l({id:e,msg:`Test failed`,ok:!1})}finally{s(null)}},f=async e=>{try{await o.deleteProvider(e),i()}catch(e){console.error(e)}};return(0,E.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm`,onClick:r,children:(0,E.jsxs)(`div`,{className:`w-full max-w-[620px] max-h-[85vh] flex flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-3.5 bg-muted/40`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(A,{}),(0,E.jsxs)(`h3`,{className:`text-sm font-semibold text-foreground flex items-center gap-2`,children:[e.name,(0,E.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,t.length,` connection`,t.length===1?``:`s`,`)`]})]})]}),(0,E.jsx)(`button`,{onClick:r,className:`rounded-lg p-1 text-muted-foreground hover:bg-hover hover:text-foreground`,children:(0,E.jsx)(v,{className:`h-4 w-4`})})]}),(0,E.jsx)(`div`,{className:`p-5 flex-1 overflow-y-auto space-y-3`,children:t.length===0?(0,E.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:`No active connections found for this provider.`}):t.map(e=>(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-border bg-muted/30 p-3`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`span`,{className:b(`h-2 w-2 rounded-full`,e.isActive?`bg-emerald-500 dark:bg-emerald-400 shadow-[0_0_6px_rgba(52,211,153,0.8)]`:`bg-muted-foreground/40`)}),(0,E.jsx)(`p`,{className:`truncate text-xs font-semibold text-foreground`,children:e.displayName||e.name||e.id}),e.authType&&(0,E.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground uppercase`,children:e.authType})]}),e.email&&(0,E.jsx)(`p`,{className:`mt-0.5 text-[11px] text-muted-foreground truncate`,children:e.email}),c?.id===e.id&&(0,E.jsx)(`p`,{className:b(`mt-1 text-[11px] font-medium`,c.ok?`text-emerald-600 dark:text-emerald-400`:`text-rose-600 dark:text-rose-400`),children:c.msg})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,E.jsx)(`button`,{onClick:()=>d(e.id),disabled:a===e.id,className:`rounded-lg border border-border bg-card px-2.5 py-1 text-[11px] font-medium text-foreground hover:bg-hover`,children:a===e.id?(0,E.jsx)(m,{className:`h-3 w-3 animate-spin`}):`Test`}),(0,E.jsx)(`button`,{onClick:()=>u(e),className:b(`rounded-lg px-2.5 py-1 text-[11px] font-medium transition-colors`,e.isActive?`border border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 hover:bg-emerald-500/20`:`border border-border bg-muted text-muted-foreground hover:bg-hover hover:text-foreground`),children:e.isActive?`Active`:`Disabled`}),(0,E.jsx)(`button`,{onClick:()=>f(e.id),className:`rounded-lg border border-rose-500/30 bg-rose-500/10 p-1 text-rose-600 dark:text-rose-400 hover:bg-rose-500/20`,children:(0,E.jsx)(v,{className:`h-3 w-3`})})]})]},e.id))})]})})}function P(){let e=r(),t=a(),{query:n}=S(),[s,c]=(0,T.useState)(`all`),[l,u]=(0,T.useState)(null),[h,g]=(0,T.useState)(null),[v,y]=(0,T.useState)(null),[b,w]=(0,T.useState)(null),[D,A]=(0,T.useState)(!1);(0,T.useEffect)(()=>(C.register(`Cari`),()=>C.unregister()),[]);let P=i({queryKey:[`provider-definitions`],queryFn:o.providerDefinitions,retry:!1,staleTime:6e4}),F=i({queryKey:[`connections`,`providers-pixel-perfect`],queryFn:()=>o.connections({pageSize:500}),retry:!1}),I=i({queryKey:[`provider-nodes`],queryFn:o.providerNodes,retry:!1}),L=F.data?.connections??[],R=(0,T.useMemo)(()=>{let e=P.data??[],t=[],n=new Set;return e.forEach(e=>{let r=e.id.toLowerCase().trim(),i=e.alias?.toLowerCase().trim();if(e.category===`oauth`||k.has(r)||i&&k.has(i))return;let a=e.category===`custom`||r.startsWith(`node_`)||r.startsWith(`openai-compatible`)||r.startsWith(`anthropic-compatible`)||e.isBuiltin===!1,o=e.icon||O(e.id,e.alias)||void 0,s={id:e.id,name:e.name,alias:e.alias,icon:o,category:e.category,isCustomNode:a};!n.has(r)&&(!i||!n.has(i))&&(n.add(r),i&&n.add(i),t.push(s))}),(I.data??[]).forEach(e=>{let r=e.id.toLowerCase().trim();if(!n.has(r)){n.add(r);let i=e.icon||e.data?.icon||``;t.push({id:e.id,name:e.name,icon:i,isCustomNode:!0,category:`custom`})}}),t},[P.data,I.data]),z=(e,t,n)=>{let r=e.toLowerCase().trim(),i=n?n.toLowerCase().trim():``,a=L.filter(e=>{let t=(e.provider||``).toLowerCase().trim();return!!(t===r||t===`node_${r}`||r===`node_${t}`||i&&(t===i||t===`node_${i}`))}),o=a.length,s=o>0&&a.every(e=>e.isActive===!1);return{total:o,allDisabled:s,connectedCount:s?0:o,matching:a}},B=async e=>{A(!0);try{let n=await o.deleteProvider(e.id);n&&n.success!==!1?(x.success(`Provider ${e.name} berhasil dihapus`),t.invalidateQueries({queryKey:[`provider-definitions`]}),t.invalidateQueries({queryKey:[`provider-nodes`]}),t.invalidateQueries({queryKey:[`connections`]}),t.invalidateQueries({queryKey:[`providers`]}),w(null)):x.error(`Gagal menghapus provider ${e.name}`)}catch(t){x.error(t?.message||`Gagal menghapus provider ${e.name}`)}finally{A(!1)}},V=async()=>{if(!v){y(`ai`);try{let e=new Set(R.map(e=>e.id.toLowerCase())),n=L.filter(t=>e.has(t.provider.toLowerCase()));await Promise.allSettled(n.slice(0,10).map(e=>o.testProvider(e.id).catch(()=>null))),t.invalidateQueries({queryKey:[`connections`]})}finally{setTimeout(()=>y(null),800)}}},H=(e=>e.filter(e=>{if(n.trim()){let t=n.toLowerCase().trim();if(!e.name.toLowerCase().includes(t)&&!e.id.toLowerCase().includes(t)&&!(e.alias&&e.alias.toLowerCase().includes(t)))return!1}let t=z(e.id,e.name,e.alias);return s===`connected`?t.connectedCount>0:s!==`disabled`||t.allDisabled}).sort((e,t)=>{let n=z(e.id,e.name,e.alias),r=z(t.id,t.name,t.alias);return r.connectedCount===n.connectedCount?r.total===n.total?e.name.localeCompare(t.name):r.total-n.total:r.connectedCount-n.connectedCount}))(R);return(0,E.jsxs)(`div`,{className:`space-y-6`,children:[(0,E.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,E.jsx)(`div`,{className:`w-32`,children:(0,E.jsx)(d,{compact:!0,value:s,onChange:e=>c(e.target.value),options:[{label:`All`,value:`all`},{label:`Connected`,value:`connected`},{label:`Disabled`,value:`disabled`}]})})}),(0,E.jsxs)(`section`,{className:`space-y-3.5`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`h2`,{className:`text-base sm:text-lg font-semibold text-foreground`,children:`AI Providers`}),(0,E.jsx)(`span`,{className:`rounded-md border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:H.length})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsxs)(`button`,{onClick:()=>u(`openai`),className:`inline-flex items-center gap-1.5 rounded-lg border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs font-medium text-primary transition-all hover:bg-primary/20 hover:border-primary cursor-pointer active:scale-95`,children:[(0,E.jsx)(p,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:`Add Provider`})]}),(0,E.jsxs)(`button`,{onClick:V,disabled:!!v,className:`inline-flex items-center gap-1.5 rounded-lg border border-border bg-card px-3 py-1.5 text-xs font-medium text-foreground transition-colors hover:border-border-strong hover:bg-hover disabled:opacity-50 cursor-pointer active:scale-95`,children:[v===`ai`?(0,E.jsx)(m,{className:`h-3.5 w-3.5 animate-spin text-primary`}):(0,E.jsx)(f,{className:`h-3.5 w-3.5 fill-current text-muted-foreground`}),(0,E.jsx)(`span`,{children:v===`ai`?`Testing...`:`Test All`})]})]})]}),H.length===0?(0,E.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border py-10 text-center text-xs text-muted-foreground`,children:`No providers match the current filter`}):(0,E.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`,children:H.map(t=>{let n=z(t.id,t.name,t.alias);return(0,E.jsx)(j,{name:t.name,icon:t.icon,alias:t.alias,providerId:t.id,isCustomNode:t.isCustomNode,connectedCount:n.connectedCount,allDisabled:n.allDisabled,onClick:()=>{e({to:`/providers/${t.id}`})},onDelete:()=>w(t)},t.id)})})]}),b&&(0,E.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs p-4 animate-in fade-in`,children:(0,E.jsxs)(`div`,{className:`w-full max-w-md rounded-2xl border border-border bg-card p-6 shadow-xl space-y-4 animate-in zoom-in-95`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-destructive/10 text-destructive border border-destructive/20`,children:(0,E.jsx)(_,{className:`h-5 w-5`})}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:`Hapus Provider`}),(0,E.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:[`Apakah Anda yakin ingin menghapus `,(0,E.jsx)(`strong`,{children:b.name}),`?`]})]})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:`Tindakan ini akan menghapus provider, seluruh akun koneksi, serta model terkait secara permanen dari database.`}),(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-2`,children:[(0,E.jsx)(`button`,{type:`button`,disabled:D,onClick:()=>w(null),className:`rounded-lg border border-border bg-card px-3.5 py-1.5 text-xs font-medium text-foreground hover:bg-hover cursor-pointer`,children:`Batal`}),(0,E.jsxs)(`button`,{type:`button`,disabled:D,onClick:()=>B(b),className:`inline-flex items-center gap-1.5 rounded-lg bg-destructive px-3.5 py-1.5 text-xs font-medium text-destructive-foreground hover:bg-destructive/90 cursor-pointer disabled:opacity-50`,children:[D?(0,E.jsx)(m,{className:`h-3.5 w-3.5 animate-spin`}):(0,E.jsx)(_,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:D?`Menghapus...`:`Hapus Provider`})]})]})]})}),l&&(0,E.jsx)(M,{initialVariant:l,isOpen:!0,onClose:()=>u(null),onCreated:()=>{t.invalidateQueries({queryKey:[`provider-nodes`]}),t.invalidateQueries({queryKey:[`connections`]}),t.invalidateQueries({queryKey:[`provider-definitions`]})}}),h&&(0,E.jsx)(N,{provider:h.meta,connections:h.conns,isOpen:!0,onClose:()=>g(null),onUpdate:()=>{t.invalidateQueries({queryKey:[`connections`]})}})]})}var F=P;export{F as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={gemini:{id:`gemini`,name:`Google Gemini`,icon:`/providers/gemini.png`,alias:`google`,category:`free`,website:`https://ai.google.dev`,signupUrl:`https://aistudio.google.com`,models:[{id:`gemini-2.5-flash`,name:`Gemini 2.5 Flash`,caps:{vision:!0,reasoning:!0}},{id:`gemini-2.5-pro`,name:`Gemini 2.5 Pro`,caps:{vision:!0,reasoning:!0}},{id:`gemini-2.0-flash`,name:`Gemini 2.0 Flash`,caps:{vision:!0,reasoning:!0}},{id:`gemini-2.0-flash-lite`,name:`Gemini 2.0 Flash Lite`,caps:{vision:!0}},{id:`gemini-3.8-flash`,name:`Gemini 3.8 Flash`,caps:{vision:!0,reasoning:!0}},{id:`gemini-3.7-flash`,name:`Gemini 3.7 Flash`,caps:{vision:!0,reasoning:!0}},{id:`gemini-3.6-flash`,name:`Gemini 3.6 Flash`,caps:{vision:!0,reasoning:!0}},{id:`gemini-1.5-flash`,name:`Gemini 1.5 Flash`,caps:{vision:!0}},{id:`gemini-1.5-pro`,name:`Gemini 1.5 Pro`,caps:{vision:!0,reasoning:!0}}],sampleConnections:[]},groq:{id:`groq`,name:`Groq`,icon:`/providers/groq.png`,alias:`groq`,category:`free`,website:`https://groq.com`,signupUrl:`https://console.groq.com`,models:[{id:`qwen/qwen3.8-27b`,name:`Qwen 3.8 27B`,caps:{reasoning:!1}},{id:`openai/gpt-oss-120b`,name:`OpenAI GPT-OSS 120B`,caps:{reasoning:!1}},{id:`openai/gpt-oss-20b`,name:`OpenAI GPT-OSS 20B`,caps:{reasoning:!1}},{id:`allam-2-7b`,name:`Allam 2 7B`,caps:{}},{id:`whisper-large-v3-turbo`,name:`Whisper Large v3 Turbo`,caps:{}},{id:`whisper-large-v3`,name:`Whisper Large v3`,caps:{}}],sampleConnections:[]},openrouter:{id:`openrouter`,name:`OpenRouter`,icon:`/providers/openrouter.png`,alias:`openrouter`,category:`free`,website:`https://openrouter.ai`,signupUrl:`https://openrouter.ai/keys`,models:[{id:`google/gemini-2.0-flash-exp:free`,name:`Gemini 2.0 Flash (Free)`,caps:{vision:!0}},{id:`meta-llama/llama-3.3-70b-instruct:free`,name:`Llama 3.3 70B (Free)`,caps:{}},{id:`deepseek/deepseek-r1:free`,name:`DeepSeek R1 (Free)`,caps:{reasoning:!0}},{id:`deepseek/deepseek-chat:free`,name:`DeepSeek V3 (Free)`,caps:{}}],sampleConnections:[]},mistral:{id:`mistral`,name:`Mistral`,icon:`/providers/mistral.png`,alias:`mistral`,category:`free`,website:`https://mistral.ai`,signupUrl:`https://console.mistral.ai`,models:[{id:`open-mistral-nemo`,name:`Mistral NeMo 12B`,caps:{reasoning:!0}},{id:`codestral-latest`,name:`Codestral 22B`,caps:{reasoning:!0}},{id:`pixtral-12b-2409`,name:`Pixtral 12B`,caps:{vision:!0}},{id:`ministral-8b-latest`,name:`Ministral 8B`,caps:{}},{id:`ministral-3b-latest`,name:`Ministral 3B`,caps:{}},{id:`open-mistral-7b`,name:`Mistral 7B`,caps:{}}],sampleConnections:[]},sambanova:{id:`sambanova`,name:`SambaNova`,icon:`/providers/sambanova.png`,alias:`sambanova`,category:`free`,website:`https://sambanova.ai`,signupUrl:`https://cloud.sambanova.ai`,models:[{id:`Meta-Llama-3.1-8B-Instruct`,name:`Llama 3.1 8B`,caps:{}},{id:`Meta-Llama-3.3-70B-Instruct`,name:`Llama 3.3 70B`,caps:{reasoning:!0}},{id:`Qwen2.5-Coder-32B-Instruct`,name:`Qwen 2.5 Coder 32B`,caps:{reasoning:!0}},{id:`Qwen2.5-72B-Instruct`,name:`Qwen 2.5 72B`,caps:{}},{id:`Llama-3.2-11B-Vision-Instruct`,name:`Llama 3.2 11B Vision`,caps:{vision:!0}},{id:`DeepSeek-R1-Distill-Llama-70B`,name:`DeepSeek R1 Distill 70B`,caps:{reasoning:!0}}],sampleConnections:[]},together:{id:`together`,name:`Together AI`,icon:`/providers/together.png`,alias:`together`,category:`free`,website:`https://www.together.ai`,signupUrl:`https://api.together.ai/settings/api-keys`,models:[{id:`meta-llama/Llama-3.3-70B-Instruct-Turbo`,name:`Llama 3.3 70B Turbo`,caps:{reasoning:!0}},{id:`meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo`,name:`Llama 3.1 8B Turbo`,caps:{}},{id:`deepseek-ai/DeepSeek-R1`,name:`DeepSeek R1`,caps:{reasoning:!0}},{id:`deepseek-ai/DeepSeek-V3`,name:`DeepSeek V3`,caps:{}},{id:`Qwen/Qwen2.5-Coder-32B-Instruct`,name:`Qwen 2.5 Coder 32B`,caps:{reasoning:!0}}],sampleConnections:[]},"cloudflare-ai":{id:`cloudflare-ai`,name:`Cloudflare AI`,icon:`/providers/cloudflare-ai.png`,alias:`cloudflare`,category:`free`,website:`https://developers.cloudflare.com/workers-ai`,signupUrl:`https://dash.cloudflare.com`,models:[{id:`@cf/meta/llama-3.3-70b-instruct`,name:`Llama 3.3 70B`,caps:{reasoning:!0}},{id:`@cf/meta/llama-3.1-8b-instruct`,name:`Llama 3.1 8B`,caps:{}},{id:`@cf/qwen/qwen2.5-coder-32b-instruct`,name:`Qwen 2.5 Coder 32B`,caps:{reasoning:!0}},{id:`@cf/deepseek-ai/deepseek-r1-distill-qwen-32b`,name:`DeepSeek R1 Distill Qwen 32B`,caps:{reasoning:!0}}],sampleConnections:[]},siliconflow:{id:`siliconflow`,name:`SiliconFlow`,icon:`/providers/siliconflow.png`,alias:`siliconflow`,category:`free`,website:`https://siliconflow.cn`,signupUrl:`https://cloud.siliconflow.cn/account/ak`,models:[{id:`deepseek-ai/DeepSeek-V3`,name:`DeepSeek V3`,caps:{}},{id:`deepseek-ai/DeepSeek-R1`,name:`DeepSeek R1`,caps:{reasoning:!0}},{id:`Qwen/Qwen2.5-72B-Instruct`,name:`Qwen 2.5 72B`,caps:{}}],sampleConnections:[]},chutes:{id:`chutes`,name:`Chutes AI`,icon:`/providers/chutes.png`,alias:`chutes`,category:`free`,website:`https://chutes.ai`,signupUrl:`https://chutes.ai/app/keys`,models:[{id:`chutes/deepseek-ai/DeepSeek-R1`,name:`DeepSeek R1`,caps:{reasoning:!0}},{id:`chutes/deepseek-ai/DeepSeek-V3`,name:`DeepSeek V3`,caps:{}}],sampleConnections:[]},nvidia:{id:`nvidia`,name:`NVIDIA NIM`,icon:`/providers/nvidia.png`,alias:`nim`,category:`free`,website:`https://build.nvidia.com`,signupUrl:`https://build.nvidia.com`,models:[{id:`meta/llama-3.3-70b-instruct`,name:`Llama 3.3 70B`,caps:{reasoning:!0}},{id:`deepseek-ai/deepseek-r1`,name:`DeepSeek R1`,caps:{reasoning:!0}},{id:`nvidia/llama-3.1-nemotron-70b-instruct`,name:`Nemotron 70B`,caps:{reasoning:!0}}],sampleConnections:[]},ollama:{id:`ollama`,name:`Ollama Cloud`,icon:`/providers/ollama.png`,alias:`ollama`,category:`free`,website:`https://ollama.com`,signupUrl:`https://ollama.com`,models:[{id:`llama3.3:70b`,name:`Llama 3.3 70B`,caps:{reasoning:!0}},{id:`llama3.1:8b`,name:`Llama 3.1 8B`,caps:{}},{id:`qwen2.5-coder:32b`,name:`Qwen 2.5 Coder 32B`,caps:{reasoning:!0}},{id:`deepseek-r1:70b`,name:`DeepSeek R1 70B`,caps:{reasoning:!0}},{id:`phi4:14b`,name:`Phi 4 14B`,caps:{reasoning:!0}}],sampleConnections:[]},cohere:{id:`cohere`,name:`Cohere`,icon:`/providers/cohere.png`,alias:`cohere`,category:`free`,website:`https://cohere.com`,signupUrl:`https://dashboard.cohere.com/api-keys`,models:[{id:`command-r-plus-08-2024`,name:`Command R+ (08-2024)`,caps:{reasoning:!0}},{id:`command-r-08-2024`,name:`Command R (08-2024)`,caps:{}},{id:`command-r7b-12-2024`,name:`Command R7B (12-2024)`,caps:{}}],sampleConnections:[]},kimi:{id:`kimi`,name:`Kimi (Moonshot)`,icon:`/providers/kimi.png`,alias:`moonshot`,category:`free`,website:`https://moonshot.cn`,signupUrl:`https://platform.moonshot.cn/console/api-keys`,models:[{id:`moonshot-v1-8k`,name:`Moonshot v1 8K`,caps:{}},{id:`moonshot-v1-32k`,name:`Moonshot v1 32K`,caps:{}},{id:`moonshot-v1-128k`,name:`Moonshot v1 128K`,caps:{}}],sampleConnections:[]},minimax:{id:`minimax`,name:`MiniMax`,icon:`/providers/minimax.png`,alias:`minimax`,category:`free`,website:`https://minimax.chat`,signupUrl:`https://platform.minimaxi.com/user-center/basic-information/interface-key`,models:[{id:`MiniMax-Text-01`,name:`MiniMax Text 01`,caps:{reasoning:!0}},{id:`abab6.5s-chat`,name:`abab 6.5s Chat`,caps:{}}],sampleConnections:[]},huggingface:{id:`huggingface`,name:`HuggingFace`,icon:`/providers/huggingface.png`,alias:`hf`,category:`free`,website:`https://huggingface.co`,signupUrl:`https://huggingface.co/settings/tokens`,models:[{id:`meta-llama/Llama-3.3-70B-Instruct`,name:`Llama 3.3 70B`,caps:{}},{id:`deepseek-ai/DeepSeek-R1`,name:`DeepSeek R1`,caps:{reasoning:!0}}],sampleConnections:[]},vercel:{id:`vercel`,name:`Vercel AI Gateway`,icon:`/providers/vercel.png`,alias:`vercel`,category:`free`,website:`https://sdk.vercel.ai`,signupUrl:`https://vercel.com/dashboard`,models:[{id:`openai/gpt-4o-mini`,name:`GPT-4o Mini (Vercel)`,caps:{}}],sampleConnections:[]},tokenrouter:{id:`tokenrouter`,name:`TokenRouter`,icon:`/providers/tokenrouter.png`,alias:`tabitoken`,category:`free`,website:`https://tokenrouter.io`,signupUrl:`https://tokenrouter.io`,models:[{id:`tokenrouter-default`,name:`TokenRouter Default`,caps:{}}],sampleConnections:[]},mimo:{id:`mimo`,name:`Xiaomi MiMo (TokenPlan)`,icon:`/providers/mimo-free.png`,alias:`xiaomi-mimo`,category:`free`,website:`https://mimo.ai`,signupUrl:`https://mimo.ai`,models:[{id:`mimo-code-latest`,name:`MiMo Code Latest`,caps:{}},{id:`mimo-chat`,name:`MiMo Chat`,caps:{}}],sampleConnections:[]},"xiaomi-tokenplan":{id:`xiaomi-tokenplan`,name:`Xiaomi MiMo (TokenPlan)`,icon:`/providers/mimo-free.png`,alias:`mimo`,category:`free`,website:`https://mimo.ai`,signupUrl:`https://mimo.ai`,models:[{id:`mimo-code-latest`,name:`MiMo Code Latest`,caps:{}},{id:`mimo-chat`,name:`MiMo Chat`,caps:{}}],sampleConnections:[]},xiaomi:{id:`xiaomi`,name:`Xiaomi MiMo`,icon:`/providers/xiaomi-mimo.png`,alias:`xiaomi-mimo`,category:`free`,website:`https://mimo.ai`,signupUrl:`https://mimo.ai`,models:[{id:`mimo-code-latest`,name:`MiMo Code Latest`,caps:{}}],sampleConnections:[]},"opencode-free":{id:`opencode-free`,name:`OpenCode Free`,icon:`/providers/opencode.png`,alias:`opencode`,category:`free`,website:`https://opencode.ai`,signupUrl:`https://opencode.ai`,models:[{id:`opencode-general`,name:`OpenCode General`,caps:{}}],sampleConnections:[]},featherless:{id:`featherless`,name:`Featherless`,icon:`/providers/featherless.png`,alias:`featherless`,category:`free`,website:`https://featherless.ai`,signupUrl:`https://featherless.ai`,models:[{id:`featherless-default`,name:`Featherless Default`,caps:{}}],sampleConnections:[]},"api-airforce":{id:`api-airforce`,name:`API Airforce`,icon:`/providers/api-airforce.png`,alias:`airforce`,category:`free`,website:`https://api.airforce`,signupUrl:`https://api.airforce`,models:[{id:`chatgpt-4o-latest`,name:`ChatGPT 4o Latest`,caps:{vision:!0}},{id:`claude-3-5-sonnet-20241022`,name:`Claude 3.5 Sonnet`,caps:{vision:!0}},{id:`deepseek-r1`,name:`DeepSeek R1`,caps:{reasoning:!0}},{id:`deepseek-v3`,name:`DeepSeek V3`,caps:{}}],sampleConnections:[]},airforce:{id:`airforce`,name:`API Airforce`,icon:`/providers/api-airforce.png`,alias:`api-airforce`,category:`free`,website:`https://api.airforce`,signupUrl:`https://api.airforce`,models:[{id:`chatgpt-4o-latest`,name:`ChatGPT 4o Latest`,caps:{vision:!0}},{id:`claude-3-5-sonnet-20241022`,name:`Claude 3.5 Sonnet`,caps:{vision:!0}},{id:`deepseek-r1`,name:`DeepSeek R1`,caps:{reasoning:!0}},{id:`deepseek-v3`,name:`DeepSeek V3`,caps:{}}],sampleConnections:[]}},t={gemini:`gemini.png`,google:`gemini.png`,gemma:`gemini.png`,deepseek:`deepseek.png`,ds:`deepseek.png`,nvidia:`nvidia.png`,nim:`nvidia.png`,"cloudflare-ai":`cloudflare-ai.png`,cloudflare:`cloudflare-ai.png`,kimi:`kimi.png`,moonshot:`kimi.png`,mimo:`mimo-free.png`,"mimo-free":`mimo-free.png`,xiaomi:`xiaomi-mimo.png`,"xiaomi-mimo":`xiaomi-mimo.png`,"opencode-free":`opencode.png`,opencode:`opencode.png`,groq:`groq.png`,openrouter:`openrouter.png`,mistral:`mistral.png`,codestral:`mistral.png`,sambanova:`sambanova.png`,siliconflow:`siliconflow.png`,chutes:`chutes.png`,together:`together.png`,ollama:`ollama.png`,"ollama-cloud":`ollama.png`,cohere:`cohere.png`,huggingface:`huggingface.png`,hf:`huggingface.png`,githubmodels:`githubmodels.png`,"github-models":`githubmodels.png`,"vercel-ai-gateway":`vercel.png`,vercel:`vercel.png`,featherless:`featherless.png`,tokenrouter:`tokenrouter.png`,"api-airforce":`api-airforce.png`,airforce:`api-airforce.png`,nara:`nara.svg`,bynara:`bynara.svg`};function n(e){if(!e)return`/providers/custom.png`;let n=e.toLowerCase().trim().replace(/^(node_|openai-compatible-chat-|openai-compatible-|anthropic-compatible-)/,``);return t[n]?`/providers/${t[n]}`:t[e.toLowerCase().trim()]?`/providers/${t[e.toLowerCase().trim()]}`:`/providers/${n}.png`}function r(t){let r=(t||``).toLowerCase().trim().replace(/^(node_|openai-compatible-chat-|openai-compatible-|anthropic-compatible-)/,``),i=e[r]||e[t.toLowerCase().trim()]||{id:r||t,name:(r||t).split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `),icon:n(r||t),alias:r||t,category:`free`,models:[{id:`default-model`,name:`Default Model`,caps:{vision:!0}}],sampleConnections:[]};if(typeof window<`u`)try{let e=localStorage.getItem(`ekarouter.custom_icon.`+(r||t));if(e)return{...i,icon:e}}catch{}return i}export{n,r as t};
|