@nextclaw/ui 0.26.4 → 0.26.5
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/CHANGELOG.md +10 -0
- package/dist/.vite/manifest.json +361 -361
- package/dist/assets/{account-panel-DVi_jhkG.js → account-panel-BAH7FW6z.js} +1 -1
- package/dist/assets/{api-BZvNpFOS.js → api-DjiZvIa0.js} +1 -1
- package/dist/assets/app-presenter-provider-CCRFsFYr.js +232 -0
- package/dist/assets/{appearance-settings-page-AZNBzLmT.js → appearance-settings-page-CdP86QJ7.js} +1 -1
- package/dist/assets/{book-open-CmRdT3N1.js → book-open-Bcnn2_uV.js} +1 -1
- package/dist/assets/{card-CdRBL1E0.js → card-Cqs73hGI.js} +1 -1
- package/dist/assets/{channels-list-page-eZN74FN3.js → channels-list-page-5qGagKuE.js} +1 -1
- package/dist/assets/{circle-dashed-HOgt3gIJ.js → circle-dashed-EY1ScSMe.js} +1 -1
- package/dist/assets/{client-DKKbdJ6Q.js → client-CH7w6yRV.js} +1 -1
- package/dist/assets/{config-split-page-BA3V6b3Q.js → config-split-page-CuEGQL8Z.js} +1 -1
- package/dist/assets/{confirm-dialog-8vqYZ0wy.js → confirm-dialog-CxfecBzO.js} +1 -1
- package/dist/assets/{context-menu-DHVVdHzN.js → context-menu-BsCj2fRs.js} +1 -1
- package/dist/assets/{createLucideIcon-DE0sB9Nu.js → createLucideIcon-Cfo2ySi5.js} +1 -1
- package/dist/assets/{desktop-capabilities-page-B9-B9k1A.js → desktop-capabilities-page-BDYITStl.js} +1 -1
- package/dist/assets/{desktop-update-config-Cfr3IRUe.js → desktop-update-config-e-zhkJuS.js} +1 -1
- package/dist/assets/{dialog-BUfWO8hr.js → dialog-QjQoKbIV.js} +1 -1
- package/dist/assets/doc-browser-CLEdkH9z.js +1 -0
- package/dist/assets/{doc-browser-context-ClLgMbxd.js → doc-browser-context-DwgG6wrz.js} +1 -1
- package/dist/assets/{download-CKqS1Ksj.js → download-BoaKzDJk.js} +1 -1
- package/dist/assets/{es2015-BiB05Sav.js → es2015-Bp6cuSGh.js} +1 -1
- package/dist/assets/{extensions-vPD4dGqt.js → extensions-CgShSIkd.js} +1 -1
- package/dist/assets/{eye-bKzylu3p.js → eye-kisejBFH.js} +1 -1
- package/dist/assets/{form-actions-CCoxz33Q.js → form-actions-D9JWSFQu.js} +1 -1
- package/dist/assets/{i18n-OGmF0Ws_.js → i18n-Bm3Ov7Fy.js} +2 -2
- package/dist/assets/{keyboard-shortcuts-settings-page-D8rosOVh.js → keyboard-shortcuts-settings-page-DZ8A1iLg.js} +1 -1
- package/dist/assets/loader-circle-Bd1fTm-x.js +1 -0
- package/dist/assets/{login-page-BT3GV3Sb.js → login-page-C-DvcG3L.js} +1 -1
- package/dist/assets/login-page-D99JjH9F.js +1 -0
- package/dist/assets/{main-bEWCGDHr.js → main-Bt5r6b21.js} +2 -2
- package/dist/assets/main-DXd_aKJV.css +1 -0
- package/dist/assets/main-i18n-catalog.config-D0Ll36J_.js +1 -0
- package/dist/assets/mcp-marketplace-page-DUoGfSmY.js +1 -0
- package/dist/assets/{model-config-page-D21a-BO0.js → model-config-page-9NNf-mzK.js} +1 -1
- package/dist/assets/{navigation-link-DC-Pku0Y.js → navigation-link-CjxNC8aT.js} +1 -1
- package/dist/assets/panel-app-i18n-catalog.config-Ddf2Kv8A.js +1 -0
- package/dist/assets/{panelStandalone-CX8X2hjh.js → panelStandalone-BaUzY8Wy.js} +2 -2
- package/dist/assets/{privacy-settings-page-e0LFHZJm.js → privacy-settings-page-CVMBFuak.js} +1 -1
- package/dist/assets/projects-BEsU3box.js +1 -0
- package/dist/assets/{provider-models-DFQgF4hS.js → provider-models-Dm-pmWAA.js} +1 -1
- package/dist/assets/{provider-scoped-model-input-DaONL0j_.js → provider-scoped-model-input-CzrXg4cX.js} +1 -1
- package/dist/assets/{providers-config-page-CEOhQlMe.js → providers-config-page-839uUADZ.js} +1 -1
- package/dist/assets/{puzzle-D_TiFXOv.js → puzzle-BGvD2DPZ.js} +1 -1
- package/dist/assets/{pwa-C9ac_1dg.js → pwa-DNNK_8E9.js} +1 -1
- package/dist/assets/{refresh-cw-BG8VfcdA.js → refresh-cw-BlXDrVP0.js} +1 -1
- package/dist/assets/remote-B5qIuUbT.js +1 -0
- package/dist/assets/{rotate-cw-DPEegUU2.js → rotate-cw-ei6rPD6z.js} +1 -1
- package/dist/assets/{runtime-config-page-DDT1dVLt.js → runtime-config-page-Bf-4JYxQ.js} +1 -1
- package/dist/assets/{save-CPlctBjT.js → save-DdF-bXgC.js} +1 -1
- package/dist/assets/{search-config-page-CDwmd6eX.js → search-config-page-C0qA3j-T.js} +1 -1
- package/dist/assets/{secrets-config-page-1OvgmwPv.js → secrets-config-page-DxfZWpnk.js} +1 -1
- package/dist/assets/security-config-CItfIQZ4.js +1 -0
- package/dist/assets/{select-Y9IEbx9x.js → select-CWyjnar7.js} +1 -1
- package/dist/assets/{service-apps-panel-DPrLeF3N.js → service-apps-panel-D3SOkRVv.js} +1 -1
- package/dist/assets/{settings-2-CrGx9_De.js → settings-2-CrNhfInU.js} +1 -1
- package/dist/assets/{status-dot-Cb8ewlUr.js → status-dot-C3SRFEta.js} +1 -1
- package/dist/assets/{tag-chip-D-6aPuuh.js → tag-chip-BIuavK2K.js} +1 -1
- package/dist/assets/{theme-provider-BjF1Eowc.js → theme-provider-CWUz4yO9.js} +1 -1
- package/dist/assets/{trash-2-DER2EJKK.js → trash-2-hAbJh9VZ.js} +1 -1
- package/dist/assets/{use-config-BM5jC65L.js → use-config-evzage09.js} +1 -1
- package/dist/assets/{use-desktop-capabilities-ezKJwKqg.js → use-desktop-capabilities-BYDjFlpt.js} +1 -1
- package/dist/assets/{use-viewport-layout-vmbQUNT6.js → use-viewport-layout-D_9XWGDV.js} +1 -1
- package/dist/assets/x-ChPbNv39.js +1 -0
- package/dist/index.html +34 -34
- package/dist/panel-standalone.html +10 -10
- package/package.json +3 -3
- package/src/app/configs/__tests__/app-navigation.config.test.ts +4 -2
- package/src/app/configs/app-navigation.config.ts +7 -2
- package/src/features/chat/features/message/components/chat-message-list.container.tsx +0 -2
- package/src/features/chat/features/message/utils/__tests__/chat-message-process-summary.utils.test.ts +4 -6
- package/src/features/chat/features/message/utils/chat-message-process-summary.utils.ts +2 -10
- package/src/features/chat/features/message/utils/chat-message-texts.utils.ts +1 -0
- package/src/features/chat/features/session/components/chat-sidebar-project-groups.tsx +1 -0
- package/src/features/chat/features/workspace/components/chat-session-workspace-file-breadcrumbs.tsx +3 -3
- package/src/features/chat/features/workspace/components/chat-session-workspace-file-preview.tsx +1 -0
- package/src/features/chat/features/workspace/components/chat-session-workspace-panel-nav.tsx +1 -1
- package/src/features/inbox/pages/inbox-page.test.ts +12 -3
- package/src/features/inbox/pages/inbox-page.tsx +31 -24
- package/src/features/projects/pages/project-home-page.tsx +4 -2
- package/src/platforms/mobile/components/__tests__/mobile-app-shell.test.tsx +9 -0
- package/src/platforms/mobile/components/mobile-app-shell.tsx +4 -2
- package/src/platforms/mobile/components/mobile-topbar.tsx +2 -2
- package/src/shared/components/ui/tab-strip/compact-tab-strip.tsx +3 -3
- package/src/shared/components/workbench/workbench-surface.tsx +1 -1
- package/src/shared/lib/i18n/locales/en-US/chat.json +1 -2
- package/src/shared/lib/i18n/locales/zh-CN/chat.json +1 -2
- package/dist/assets/app-presenter-provider-BcYL-VNe.js +0 -124
- package/dist/assets/doc-browser-w8q1j0jL.js +0 -1
- package/dist/assets/loader-circle-Clq1Gtb1.js +0 -1
- package/dist/assets/login-page-DKId3By8.js +0 -1
- package/dist/assets/main-i18n-catalog.config-Bpu5GcwF.js +0 -1
- package/dist/assets/main-kqMRTwOs.css +0 -1
- package/dist/assets/mcp-marketplace-page-CZIP6j3L.js +0 -1
- package/dist/assets/panel-app-i18n-catalog.config-D44qmtfk.js +0 -1
- package/dist/assets/projects-Rki7Fmth.js +0 -1
- package/dist/assets/remote-DkSx5x4R.js +0 -1
- package/dist/assets/security-config-Pv4CM-kw.js +0 -1
- package/dist/assets/x-DSz9cGhy.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,cr as n,yr as r}from"./api-BZvNpFOS.js";import{t as i}from"./preload-helper-ca-nBW7U.js";import{t as a}from"./createLucideIcon-DE0sB9Nu.js";import{t as o}from"./host-capabilities-DuIFVsvM.js";var s=e(r(),1),c=`popstate`;function l(e={}){let{initialEntries:t=[`/`],initialIndex:n,v5Compat:r=!1}=e,i;i=t.map((e,t)=>u(e,typeof e==`string`?null:e.state,t===0?`default`:void 0));let a=c(n??i.length-1),o=`POP`,s=null;function c(e){return Math.min(Math.max(e,0),i.length-1)}function l(){return i[a]}function u(e,t=null,n){let r=h(i?l().pathname:`/`,e,t,n);return f(r.pathname.charAt(0)===`/`,`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),r}function d(e){return typeof e==`string`?e:g(e)}return{get index(){return a},get action(){return o},get location(){return l()},createHref:d,createURL(e){return new URL(d(e),`http://localhost`)},encodeLocation(e){let t=typeof e==`string`?_(e):e;return{pathname:t.pathname||``,search:t.search||``,hash:t.hash||``}},push(e,t){o=`PUSH`;let n=u(e,t);a+=1,i.splice(a,i.length,n),r&&s&&s({action:o,location:n,delta:1})},replace(e,t){o=`REPLACE`;let n=u(e,t);i[a]=n,r&&s&&s({action:o,location:n,delta:0})},go(e){o=`POP`;let t=c(a+e),n=i[t];a=t,s&&s({action:o,location:n,delta:e})},listen(e){return s=e,()=>{s=null}}}}function u(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return h(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:g(t)}return v(t,n,null,e)}function d(e,t){if(e===!1||e==null)throw Error(t)}function f(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function p(){return Math.random().toString(36).substring(2,10)}function m(e,t){return{usr:e.state,key:e.key,idx:t}}function h(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?_(t):t,state:n,key:t&&t.key||r||p()}}function g({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function _(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function v(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,l=null,u=d();u??(u=0,o.replaceState({...o.state,idx:u},``));function d(){return(o.state||{idx:null}).idx}function f(){s=`POP`;let e=d(),t=e==null?null:e-u;u=e,l&&l({action:s,location:v.location,delta:t})}function p(e,t){s=`PUSH`;let r=h(v.location,e,t);n&&n(r,e),u=d()+1;let c=m(r,u),f=v.createHref(r);try{o.pushState(c,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&l&&l({action:s,location:v.location,delta:1})}function g(e,t){s=`REPLACE`;let r=h(v.location,e,t);n&&n(r,e),u=d();let i=m(r,u),c=v.createHref(r);o.replaceState(i,``,c),a&&l&&l({action:s,location:v.location,delta:0})}function _(e){return y(e)}let v={get action(){return s},get location(){return e(i,o)},listen(e){if(l)throw Error(`A history only accepts one active listener`);return i.addEventListener(c,f),l=e,()=>{i.removeEventListener(c,f),l=null}},createHref(e){return t(i,e)},createURL:_,encodeLocation(e){let t=_(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:p,replace:g,go(e){return o.go(e)}};return v}function y(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),d(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:g(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function b(e,t,n=`/`){return x(e,t,n,!1)}function x(e,t,n,r){let i=D((typeof t==`string`?_(t):t).pathname||`/`,n);if(i==null)return null;let a=C(e);T(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=de(i);o=le(a[e],t,r)}return o}function S(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function C(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;d(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=j([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(d(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),C(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:se(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of w(e.path))a(e,t,!0,n)}),t}function w(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=w(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function T(e){e.sort((e,t)=>e.score===t.score?ce(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ee=/^:[\w-]+$/,te=3,ne=2,re=1,ie=10,ae=-2,oe=e=>e===`*`;function se(e,t){let n=e.split(`/`),r=n.length;return n.some(oe)&&(r+=ae),t&&(r+=ne),n.filter(e=>!oe(e)).reduce((e,t)=>e+(ee.test(t)?te:t===``?re:ie),r)}function ce(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function le(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:j([a,u.pathname]),pathnameBase:ge(j([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=j([a,u.pathnameBase]))}return o}function E(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=ue(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function ue(e,t=!1,n=!0){f(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function de(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return f(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function D(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var fe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function pe(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?_(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?me(n.substring(1),`/`):me(n,t)):a=t,{pathname:a,search:_e(r),hash:ve(i)}}function me(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function O(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function he(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function k(e){let t=he(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function A(e,t,n,r=!1){let i;typeof e==`string`?i=_(e):(i={...e},d(!i.pathname||!i.pathname.includes(`?`),O(`?`,`pathname`,`search`,i)),d(!i.pathname||!i.pathname.includes(`#`),O(`#`,`pathname`,`hash`,i)),d(!i.search||!i.search.includes(`#`),O(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=pe(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var j=e=>e.join(`/`).replace(/\/\/+/g,`/`),ge=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),_e=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,ve=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,ye=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function be(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function xe(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var Se=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ce(e,t){let n=e;if(typeof n!=`string`||!fe.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Se)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=D(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{f(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var we=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(we);var Te=[`GET`,...we];new Set(Te);var M=s.createContext(null);M.displayName=`DataRouter`;var N=s.createContext(null);N.displayName=`DataRouterState`;var Ee=s.createContext(!1),De=s.createContext({isTransitioning:!1});De.displayName=`ViewTransition`;var Oe=s.createContext(new Map);Oe.displayName=`Fetchers`;var ke=s.createContext(null);ke.displayName=`Await`;var P=s.createContext(null);P.displayName=`Navigation`;var F=s.createContext(null);F.displayName=`Location`;var I=s.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName=`Route`;var L=s.createContext(null);L.displayName=`RouteError`;var Ae=`REACT_ROUTER_ERROR`,je=`REDIRECT`,Me=`ROUTE_ERROR_RESPONSE`;function Ne(e){if(e.startsWith(`${Ae}:${je}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Pe(e){if(e.startsWith(`${Ae}:${Me}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new ye(t.status,t.statusText,t.data)}catch{}}function Fe(e,{relative:t}={}){d(R(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=s.useContext(P),{hash:i,pathname:a,search:o}=V(e,{relative:t}),c=a;return n!==`/`&&(c=a===`/`?n:j([n,a])),r.createHref({pathname:c,search:o,hash:i})}function R(){return s.useContext(F)!=null}function z(){return d(R(),`useLocation() may be used only in the context of a <Router> component.`),s.useContext(F).location}function Ie(e){d(R(),`useMatch() may be used only in the context of a <Router> component.`);let{pathname:t}=z();return s.useMemo(()=>E(e,de(t)),[t,e])}var Le=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Re(e){s.useContext(P).static||s.useLayoutEffect(e)}function B(){let{isDataRoute:e}=s.useContext(I);return e?rt():ze()}function ze(){d(R(),`useNavigate() may be used only in the context of a <Router> component.`);let e=s.useContext(M),{basename:t,navigator:n}=s.useContext(P),{matches:r}=s.useContext(I),{pathname:i}=z(),a=JSON.stringify(k(r)),o=s.useRef(!1);return Re(()=>{o.current=!0}),s.useCallback((r,s={})=>{if(f(o.current,Le),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=A(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:j([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}s.createContext(null);function Be(){let{matches:e}=s.useContext(I),t=e[e.length-1];return t?t.params:{}}function V(e,{relative:t}={}){let{matches:n}=s.useContext(I),{pathname:r}=z(),i=JSON.stringify(k(n));return s.useMemo(()=>A(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ve(e,t){return He(e,t)}function He(e,t,n,r,i){d(R(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=s.useContext(P),{matches:o}=s.useContext(I),c=o[o.length-1],l=c?c.params:{},u=c?c.pathname:`/`,p=c?c.pathnameBase:`/`,m=c&&c.route;{let e=m&&m.path||``;at(u,!m||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
1
|
+
import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,cr as n,yr as r}from"./api-DjiZvIa0.js";import{t as i}from"./preload-helper-ca-nBW7U.js";import{t as a}from"./createLucideIcon-Cfo2ySi5.js";import{t as o}from"./host-capabilities-DuIFVsvM.js";var s=e(r(),1),c=`popstate`;function l(e={}){let{initialEntries:t=[`/`],initialIndex:n,v5Compat:r=!1}=e,i;i=t.map((e,t)=>u(e,typeof e==`string`?null:e.state,t===0?`default`:void 0));let a=c(n??i.length-1),o=`POP`,s=null;function c(e){return Math.min(Math.max(e,0),i.length-1)}function l(){return i[a]}function u(e,t=null,n){let r=h(i?l().pathname:`/`,e,t,n);return f(r.pathname.charAt(0)===`/`,`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),r}function d(e){return typeof e==`string`?e:g(e)}return{get index(){return a},get action(){return o},get location(){return l()},createHref:d,createURL(e){return new URL(d(e),`http://localhost`)},encodeLocation(e){let t=typeof e==`string`?_(e):e;return{pathname:t.pathname||``,search:t.search||``,hash:t.hash||``}},push(e,t){o=`PUSH`;let n=u(e,t);a+=1,i.splice(a,i.length,n),r&&s&&s({action:o,location:n,delta:1})},replace(e,t){o=`REPLACE`;let n=u(e,t);i[a]=n,r&&s&&s({action:o,location:n,delta:0})},go(e){o=`POP`;let t=c(a+e),n=i[t];a=t,s&&s({action:o,location:n,delta:e})},listen(e){return s=e,()=>{s=null}}}}function u(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return h(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:g(t)}return v(t,n,null,e)}function d(e,t){if(e===!1||e==null)throw Error(t)}function f(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function p(){return Math.random().toString(36).substring(2,10)}function m(e,t){return{usr:e.state,key:e.key,idx:t}}function h(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?_(t):t,state:n,key:t&&t.key||r||p()}}function g({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function _(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function v(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,l=null,u=d();u??(u=0,o.replaceState({...o.state,idx:u},``));function d(){return(o.state||{idx:null}).idx}function f(){s=`POP`;let e=d(),t=e==null?null:e-u;u=e,l&&l({action:s,location:v.location,delta:t})}function p(e,t){s=`PUSH`;let r=h(v.location,e,t);n&&n(r,e),u=d()+1;let c=m(r,u),f=v.createHref(r);try{o.pushState(c,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&l&&l({action:s,location:v.location,delta:1})}function g(e,t){s=`REPLACE`;let r=h(v.location,e,t);n&&n(r,e),u=d();let i=m(r,u),c=v.createHref(r);o.replaceState(i,``,c),a&&l&&l({action:s,location:v.location,delta:0})}function _(e){return y(e)}let v={get action(){return s},get location(){return e(i,o)},listen(e){if(l)throw Error(`A history only accepts one active listener`);return i.addEventListener(c,f),l=e,()=>{i.removeEventListener(c,f),l=null}},createHref(e){return t(i,e)},createURL:_,encodeLocation(e){let t=_(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:p,replace:g,go(e){return o.go(e)}};return v}function y(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),d(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:g(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function b(e,t,n=`/`){return x(e,t,n,!1)}function x(e,t,n,r){let i=D((typeof t==`string`?_(t):t).pathname||`/`,n);if(i==null)return null;let a=C(e);T(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=de(i);o=le(a[e],t,r)}return o}function S(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function C(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;d(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=j([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(d(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),C(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:se(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of w(e.path))a(e,t,!0,n)}),t}function w(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=w(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function T(e){e.sort((e,t)=>e.score===t.score?ce(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ee=/^:[\w-]+$/,te=3,ne=2,re=1,ie=10,ae=-2,oe=e=>e===`*`;function se(e,t){let n=e.split(`/`),r=n.length;return n.some(oe)&&(r+=ae),t&&(r+=ne),n.filter(e=>!oe(e)).reduce((e,t)=>e+(ee.test(t)?te:t===``?re:ie),r)}function ce(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function le(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:j([a,u.pathname]),pathnameBase:ge(j([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=j([a,u.pathnameBase]))}return o}function E(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=ue(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function ue(e,t=!1,n=!0){f(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function de(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return f(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function D(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var fe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function pe(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?_(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?me(n.substring(1),`/`):me(n,t)):a=t,{pathname:a,search:_e(r),hash:ve(i)}}function me(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function O(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function he(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function k(e){let t=he(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function A(e,t,n,r=!1){let i;typeof e==`string`?i=_(e):(i={...e},d(!i.pathname||!i.pathname.includes(`?`),O(`?`,`pathname`,`search`,i)),d(!i.pathname||!i.pathname.includes(`#`),O(`#`,`pathname`,`hash`,i)),d(!i.search||!i.search.includes(`#`),O(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=pe(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var j=e=>e.join(`/`).replace(/\/\/+/g,`/`),ge=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),_e=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,ve=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,ye=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function be(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function xe(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var Se=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ce(e,t){let n=e;if(typeof n!=`string`||!fe.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Se)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=D(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{f(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var we=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(we);var Te=[`GET`,...we];new Set(Te);var M=s.createContext(null);M.displayName=`DataRouter`;var N=s.createContext(null);N.displayName=`DataRouterState`;var Ee=s.createContext(!1),De=s.createContext({isTransitioning:!1});De.displayName=`ViewTransition`;var Oe=s.createContext(new Map);Oe.displayName=`Fetchers`;var ke=s.createContext(null);ke.displayName=`Await`;var P=s.createContext(null);P.displayName=`Navigation`;var F=s.createContext(null);F.displayName=`Location`;var I=s.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName=`Route`;var L=s.createContext(null);L.displayName=`RouteError`;var Ae=`REACT_ROUTER_ERROR`,je=`REDIRECT`,Me=`ROUTE_ERROR_RESPONSE`;function Ne(e){if(e.startsWith(`${Ae}:${je}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Pe(e){if(e.startsWith(`${Ae}:${Me}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new ye(t.status,t.statusText,t.data)}catch{}}function Fe(e,{relative:t}={}){d(R(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=s.useContext(P),{hash:i,pathname:a,search:o}=V(e,{relative:t}),c=a;return n!==`/`&&(c=a===`/`?n:j([n,a])),r.createHref({pathname:c,search:o,hash:i})}function R(){return s.useContext(F)!=null}function z(){return d(R(),`useLocation() may be used only in the context of a <Router> component.`),s.useContext(F).location}function Ie(e){d(R(),`useMatch() may be used only in the context of a <Router> component.`);let{pathname:t}=z();return s.useMemo(()=>E(e,de(t)),[t,e])}var Le=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Re(e){s.useContext(P).static||s.useLayoutEffect(e)}function B(){let{isDataRoute:e}=s.useContext(I);return e?rt():ze()}function ze(){d(R(),`useNavigate() may be used only in the context of a <Router> component.`);let e=s.useContext(M),{basename:t,navigator:n}=s.useContext(P),{matches:r}=s.useContext(I),{pathname:i}=z(),a=JSON.stringify(k(r)),o=s.useRef(!1);return Re(()=>{o.current=!0}),s.useCallback((r,s={})=>{if(f(o.current,Le),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=A(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:j([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}s.createContext(null);function Be(){let{matches:e}=s.useContext(I),t=e[e.length-1];return t?t.params:{}}function V(e,{relative:t}={}){let{matches:n}=s.useContext(I),{pathname:r}=z(),i=JSON.stringify(k(n));return s.useMemo(()=>A(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ve(e,t){return He(e,t)}function He(e,t,n,r,i){d(R(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=s.useContext(P),{matches:o}=s.useContext(I),c=o[o.length-1],l=c?c.params:{},u=c?c.pathname:`/`,p=c?c.pathnameBase:`/`,m=c&&c.route;{let e=m&&m.path||``;at(u,!m||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
2
2
|
|
|
3
3
|
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let h=z(),g;if(t){let e=typeof t==`string`?_(t):t;d(p===`/`||e.pathname?.startsWith(p),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${e.pathname}" was given in the \`location\` prop.`),g=e}else g=h;let v=g.pathname||`/`,y=v;if(p!==`/`){let e=p.replace(/^\//,``).split(`/`);y=`/`+v.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let x=b(e,{pathname:y});f(m||x!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),f(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let S=Je(x&&x.map(e=>Object.assign({},e,{params:Object.assign({},l,e.params),pathname:j([p,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?p:j([p,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),o,n,r,i);return t&&S?s.createElement(F.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...g},navigationType:`POP`}},S):S}function Ue(){let e=nt(),t=be(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=s.createElement(s.Fragment,null,s.createElement(`p`,null,`💿 Hey developer 👋`),s.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,s.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,s.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),s.createElement(s.Fragment,null,s.createElement(`h2`,null,`Unexpected Application Error!`),s.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?s.createElement(`pre`,{style:i},n):null,o)}var We=s.createElement(Ue,null),Ge=class extends s.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Pe(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:s.createElement(I.Provider,{value:this.props.routeContext},s.createElement(L.Provider,{value:e,children:this.props.component}));return this.context?s.createElement(Ke,{error:e},t):t}};Ge.contextType=Ee;var H=new WeakMap;function Ke({children:e,error:t}){let{basename:n}=s.useContext(P);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ne(t.digest);if(e){let r=H.get(t);if(r)throw r;let i=Ce(e.location,n);if(Se&&!H.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw H.set(t,n),n}return s.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function qe({routeContext:e,match:t,children:n}){let r=s.useContext(M);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),s.createElement(I.Provider,{value:e},n)}function Je(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);d(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let c=!1,l=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(l=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){c=!0,a=l>=0?a.slice(0,l+1):[a[0]];break}}}let u=n&&r?(e,t)=>{r(e,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:xe(n.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,i)=>{let d,f=!1,p=null,m=null;n&&(d=o&&r.route.id?o[r.route.id]:void 0,p=r.route.errorElement||We,c&&(l<0&&i===0?(at(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):l===i&&(f=!0,m=r.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,i+1)),g=()=>{let t;return t=d?p:f?m:r.route.Component?s.createElement(r.route.Component,null):r.route.element?r.route.element:e,s.createElement(qe,{match:r,routeContext:{outlet:e,matches:h,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?s.createElement(Ge,{location:n.location,revalidation:n.revalidation,component:p,error:d,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:u}):g()},null)}function U(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ye(e){let t=s.useContext(M);return d(t,U(e)),t}function Xe(e){let t=s.useContext(N);return d(t,U(e)),t}function Ze(e){let t=s.useContext(I);return d(t,U(e)),t}function Qe(e){let t=Ze(e),n=t.matches[t.matches.length-1];return d(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function $e(){return Qe(`useRouteId`)}function et(){return Xe(`useNavigation`).navigation}function tt(){let{matches:e,loaderData:t}=Xe(`useMatches`);return s.useMemo(()=>e.map(e=>S(e,t)),[e,t])}function nt(){let e=s.useContext(L),t=Xe(`useRouteError`),n=Qe(`useRouteError`);return e===void 0?t.errors?.[n]:e}function rt(){let{router:e}=Ye(`useNavigate`),t=Qe(`useNavigate`),n=s.useRef(!1);return Re(()=>{n.current=!0}),s.useCallback(async(r,i={})=>{f(n.current,Le),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var it={};function at(e,t,n){!t&&!it[e]&&(it[e]=!0,f(!1,n))}s.useOptimistic,s.memo(ot);function ot({routes:e,future:t,state:n,onError:r}){return He(e,void 0,n,r,t)}function st({basename:e,children:t,initialEntries:n,initialIndex:r,unstable_useTransitions:i}){let a=s.useRef();a.current??=l({initialEntries:n,initialIndex:r,v5Compat:!0});let o=a.current,[c,u]=s.useState({action:o.action,location:o.location}),d=s.useCallback(e=>{i===!1?u(e):s.startTransition(()=>u(e))},[i]);return s.useLayoutEffect(()=>o.listen(d),[o,d]),s.createElement(ut,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:i})}function ct({to:e,replace:t,state:n,relative:r}){d(R(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=s.useContext(P);f(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=s.useContext(I),{pathname:o}=z(),c=B(),l=A(e,k(a),o,r===`path`),u=JSON.stringify(l);return s.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function lt(e){d(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function ut({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){d(!R(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),l=s.useMemo(()=>({basename:c,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[c,i,a,o]);typeof n==`string`&&(n=_(n));let{pathname:u=`/`,search:p=``,hash:m=``,state:h=null,key:g=`default`}=n,v=s.useMemo(()=>{let e=D(u,c);return e==null?null:{location:{pathname:e,search:p,hash:m,state:h,key:g},navigationType:r}},[c,u,p,m,h,g,r]);return f(v!=null,`<Router basename="${c}"> is not able to match the URL "${u}${p}${m}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:s.createElement(P.Provider,{value:l},s.createElement(F.Provider,{children:t,value:v}))}function dt({children:e,location:t}){return Ve(ft(e),t)}s.Component;function ft(e,t=[]){let n=[];return s.Children.forEach(e,(e,r)=>{if(!s.isValidElement(e))return;let i=[...t,r];if(e.type===s.Fragment){n.push.apply(n,ft(e.props.children,i));return}d(e.type===lt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),d(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=ft(e.props.children,i)),n.push(a)}),n}var W=`get`,G=`application/x-www-form-urlencoded`;function K(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function pt(e){return K(e)&&e.tagName.toLowerCase()===`button`}function mt(e){return K(e)&&e.tagName.toLowerCase()===`form`}function ht(e){return K(e)&&e.tagName.toLowerCase()===`input`}function gt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function _t(e,t){return e.button===0&&(!t||t===`_self`)&&!gt(e)}function vt(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function yt(e,t){let n=vt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var q=null;function bt(){if(q===null)try{new FormData(document.createElement(`form`),0),q=!1}catch{q=!0}return q}var xt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function St(e){return e!=null&&!xt.has(e)?(f(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${G}"`),null):e}function Ct(e,t){let n,r,i,a,o;if(mt(e)){let o=e.getAttribute(`action`);r=o?D(o,t):null,n=e.getAttribute(`method`)||W,i=St(e.getAttribute(`enctype`))||G,a=new FormData(e)}else if(pt(e)||ht(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?D(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||W,i=St(e.getAttribute(`formenctype`))||St(o.getAttribute(`enctype`))||G,a=new FormData(o,e),!bt()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(K(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=W,r=null,i=G,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var wt={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Tt=/[&><\u2028\u2029]/g;function Et(e){return e.replace(Tt,e=>wt[e])}function Dt(e,t){if(e===!1||e==null)throw Error(t)}function Ot(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&D(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function kt(e,t){if(e.id in t)return t[e.id];try{let n=await i(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function At(e){return e!=null&&typeof e.page==`string`}function jt(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Mt(e,t,n){return Lt((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await kt(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(jt).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Nt(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Pt(e,t,{includeHydrateFallback:n}={}){return Ft(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Ft(e){return[...new Set(e)]}function It(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Lt(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!At(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(It(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Rt(){let e=s.useContext(M);return Dt(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function zt(){let e=s.useContext(N);return Dt(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var J=s.createContext(void 0);J.displayName=`FrameworkContext`;function Bt(){let e=s.useContext(J);return Dt(e,`You must render this element inside a <HydratedRouter> element`),e}function Vt(e,t){let n=s.useContext(J),[r,i]=s.useState(!1),[a,o]=s.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=s.useRef(null);s.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),s.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),o(!1)};return n?e===`intent`?[a,p,{onFocus:Y(c,m),onBlur:Y(l,h),onMouseEnter:Y(u,m),onMouseLeave:Y(d,h),onTouchStart:Y(f,m)}]:[a,p,{}]:[!1,p,{}]}function Y(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ht({page:e,...t}){let{router:n}=Rt(),r=s.useMemo(()=>b(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?s.createElement(Wt,{page:e,matches:r,...t}):null}function Ut(e){let{manifest:t,routeModules:n}=Bt(),[r,i]=s.useState([]);return s.useEffect(()=>{let r=!1;return Mt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Wt({page:e,matches:t,...n}){let r=z(),{future:i,manifest:a,routeModules:o}=Bt(),{basename:c}=Rt(),{loaderData:l,matches:u}=zt(),d=s.useMemo(()=>Nt(e,t,u,a,r,`data`),[e,t,u,a,r]),f=s.useMemo(()=>Nt(e,t,u,a,r,`assets`),[e,t,u,a,r]),p=s.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let u=Ot(e,c,i.unstable_trailingSlashAwareDataRequests,`data`);return s&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,i.unstable_trailingSlashAwareDataRequests,l,r,a,d,t,e,o]),m=s.useMemo(()=>Pt(f,a),[f,a]),h=Ut(f);return s.createElement(s.Fragment,null,p.map(e=>s.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>s.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>s.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Gt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}s.Component;var Kt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Kt&&(window.__reactRouterVersion=`7.13.0`)}catch{}function qt({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=s.useRef();i.current??=u({window:r,v5Compat:!0});let a=i.current,[o,c]=s.useState({action:a.action,location:a.location}),l=s.useCallback(e=>{n===!1?c(e):s.startTransition(()=>c(e))},[n]);return s.useLayoutEffect(()=>a.listen(l),[a,l]),s.createElement(ut,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function Jt({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=s.useState({action:n.action,location:n.location}),o=s.useCallback(e=>{r===!1?a(e):s.startTransition(()=>a(e))},[r]);return s.useLayoutEffect(()=>n.listen(o),[n,o]),s.createElement(ut,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Jt.displayName=`unstable_HistoryRouter`;var Yt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,X=s.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,state:o,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,unstable_useTransitions:g}=s.useContext(P),_=typeof l==`string`&&Yt.test(l),v=Ce(l,h);l=v.to;let y=Fe(l,{relative:r}),[b,x,S]=Vt(n,p),C=nn(l,{replace:a,state:o,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:g});function w(t){e&&e(t),t.defaultPrevented||C(t)}let T=s.createElement(`a`,{...p,...S,href:v.absoluteURL||y,onClick:v.isExternal||i?e:w,ref:Gt(m,x),target:c,"data-discover":!_&&t===`render`?`true`:void 0});return b&&!_?s.createElement(s.Fragment,null,T,s.createElement(Ht,{page:y})):T});X.displayName=`Link`;var Xt=s.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:c,...l},u){let d=V(a,{relative:l.relative}),f=z(),p=s.useContext(N),{navigator:m,basename:h}=s.useContext(P),g=p!=null&&fn(d)&&o===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=D(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let ee=typeof i==`function`?i(C):i;return s.createElement(X,{...l,"aria-current":w,className:T,ref:u,style:ee,to:a,viewTransition:o},typeof c==`function`?c(C):c)});Xt.displayName=`NavLink`;var Zt=s.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=W,action:c,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:p,...m},h)=>{let{unstable_useTransitions:g}=s.useContext(P),_=sn(),v=cn(c,{relative:u}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof c==`string`&&Yt.test(c);return s.createElement(`form`,{ref:h,method:y,action:v,onSubmit:r?l:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,c=r?.getAttribute(`formmethod`)||o,m=()=>_(r||e.currentTarget,{fetcherKey:t,method:c,navigate:n,replace:i,state:a,relative:u,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:p});g&&n!==!1?s.startTransition(()=>m()):m()},...m,"data-discover":!b&&e===`render`?`true`:void 0})});Zt.displayName=`Form`;function Qt({getKey:e,storageKey:t,...n}){let r=s.useContext(J),{basename:i}=s.useContext(P),a=z(),o=tt();un({getKey:e,storageKey:t});let c=s.useMemo(()=>{if(!r||!e)return null;let t=Q(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let l=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return s.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${Et(JSON.stringify(t||ln))}, ${Et(JSON.stringify(c))})`}})}Qt.displayName=`ScrollRestoration`;function $t(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function en(e){let t=s.useContext(M);return d(t,$t(e)),t}function tn(e){let t=s.useContext(N);return d(t,$t(e)),t}function nn(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=B(),d=z(),f=V(e,{relative:a});return s.useCallback(p=>{if(_t(p,t)){p.preventDefault();let t=n===void 0?g(d)===g(f):n,m=()=>u(e,{replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:c});l?s.startTransition(()=>m()):m()}},[d,u,f,n,r,t,e,i,a,o,c,l])}function rn(e){f(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=s.useRef(vt(e)),n=s.useRef(!1),r=z(),i=s.useMemo(()=>yt(r.search,n.current?null:t.current),[r.search]),a=B();return[i,s.useCallback((e,t)=>{let r=vt(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var an=0,on=()=>`__${String(++an)}__`;function sn(){let{router:e}=en(`useSubmit`),{basename:t}=s.useContext(P),n=$e(),r=e.fetch,i=e.navigate;return s.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Ct(e,t);a.navigate===!1?await r(a.fetcherKey||on(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function cn(e,{relative:t}={}){let{basename:n}=s.useContext(P),r=s.useContext(I);d(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...V(e||`.`,{relative:t})},o=z();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:j([n,a.pathname])),g(a)}var ln=`react-router-scroll-positions`,Z={};function Q(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:D(e.pathname,n)||e.pathname},t)),i??=e.key,i}function un({getKey:e,storageKey:t}={}){let{router:n}=en(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=tn(`useScrollRestoration`),{basename:a}=s.useContext(P),o=z(),c=tt(),l=et();s.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),dn(s.useCallback(()=>{if(l.state===`idle`){let t=Q(o,c,a,e);Z[t]=window.scrollY}try{sessionStorage.setItem(t||ln,JSON.stringify(Z))}catch(e){f(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[l.state,e,a,o,c,t])),typeof document<`u`&&(s.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||ln);e&&(Z=JSON.parse(e))}catch{}},[t]),s.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Z,()=>window.scrollY,e?(t,n)=>Q(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),s.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{f(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function dn(e,t){let{capture:n}=t||{};s.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function fn(e,{relative:t}={}){let n=s.useContext(De);d(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=en(`useViewTransitionState`),i=V(e,{relative:t});if(!n.isTransitioning)return!1;let a=D(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=D(n.nextLocation.pathname,r)||n.nextLocation.pathname;return E(i.pathname,o)!=null||E(i.pathname,a)!=null}var pn=a(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),$=n(),mn={xs:`gap-1.5 text-xs`,sm:`gap-1.5 text-sm`},hn={xs:`h-3.5 w-3.5`,sm:`h-4 w-4`};function gn(e){return e.button===0&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey}function _n(e){return Array.from(new Set(`${e??``} noopener noreferrer`.trim().split(/\s+/))).join(` `)}function vn(e){try{let t=new URL(e,window.location.href);return t.protocol===`http:`||t.protocol===`https:`?t.toString():null}catch{return null}}var yn=(0,s.forwardRef)(function({children:e,className:n,external:r=!1,href:i,icon:a,iconPosition:s=`leading`,onClick:c,rel:l,size:u=`sm`,target:d,...f},p){let m=a===void 0&&r?pn:a,h=t(`inline-flex items-center rounded-sm font-medium text-primary underline-offset-4 transition-colors hover:text-primary-hover hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25`,mn[u],n),g=m?(0,$.jsx)(m,{"aria-hidden":`true`,className:t(`shrink-0`,hn[u])}):null,_=(0,$.jsxs)($.Fragment,{children:[s===`leading`?g:null,e,s===`trailing`?g:null]});return r?(0,$.jsx)(`a`,{ref:p,...f,href:i,target:d??`_blank`,rel:_n(l),className:h,onClick:e=>{c?.(e);let t=vn(i);t&&!e.defaultPrevented&&gn(e)&&(e.preventDefault(),o.openExternalUrl(t))},children:_}):(0,$.jsx)(X,{ref:p,...f,to:i,target:d,rel:l,className:h,onClick:c,children:_})});export{st as a,lt as c,Ie as d,B as f,X as i,dt as l,rn as m,pn as n,Xt as o,Be as p,qt as r,ct as s,yn as t,z as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./i18n-Bm3Ov7Fy.js";import{i as t,n,r,t as i}from"./panel-app-BYfQu_TS.js";function a(){e({zh:{...t,...r},en:{...n,...i}})}export{a as installPanelAppI18nCatalog};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/login-page-
|
|
2
|
-
import{i as e}from"./chunk-DF37yw5_.js";import{t}from"./client-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/login-page-D99JjH9F.js","assets/login-page-C-DvcG3L.js","assets/chunk-DF37yw5_.js","assets/api-DjiZvIa0.js","assets/i18n-Bm3Ov7Fy.js","assets/preload-helper-ca-nBW7U.js","assets/card-Cqs73hGI.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./chunk-DF37yw5_.js";import{t}from"./client-CH7w6yRV.js";import{Ht as n,Kn as r,Vt as i,cr as a,or as o,qn as s,yr as c}from"./api-DjiZvIa0.js";import{t as l}from"./preload-helper-ca-nBW7U.js";import{c as u,l as d,s as f,t as p,x as m}from"./theme-provider-CWUz4yO9.js";import{a as h,s as g}from"./i18n-Bm3Ov7Fy.js";var _=e(c(),1),v=t(),y=a(),b=(0,_.lazy)(async()=>({default:(await l(async()=>{let{LoginPage:e}=await import(`./login-page-D99JjH9F.js`);return{LoginPage:e}},__vite__mapDeps([0,1,2,3,4,5,6]))).LoginPage})),x=/^\/apps\/panel\/([^/]+)\/standalone\/?$/;function S(e){let t=x.exec(e);if(!t)return null;try{return decodeURIComponent(t[1])}catch{return null}}function C({appId:e}){let t=n(),r=t.isError&&i(t.error);return t.isLoading&&!t.isError||r||t.isError?(0,y.jsx)(u,{appId:e}):t.data?.enabled&&!t.data.authenticated?(0,y.jsx)(_.Suspense,{fallback:(0,y.jsx)(w,{message:g(`loading`)}),children:(0,y.jsx)(b,{username:t.data.username})}):(0,y.jsx)(u,{appId:e})}function w({message:e}){return(0,y.jsx)(`main`,{className:`flex h-dvh items-center justify-center bg-background px-6 text-sm text-muted-foreground`,children:e})}function T({pathname:e=window.location.pathname}){let t=S(e);return t?(0,y.jsx)(o,{client:r,children:(0,y.jsxs)(m,{children:[(0,y.jsx)(C,{appId:t}),(0,y.jsx)(f,{}),(0,y.jsx)(s,{position:`top-right`,richColors:!0,offset:16})]})}):(0,y.jsx)(w,{message:g(`panelAppsMainUnavailable`)})}await h();var E=document.getElementById(`root`);E&&(0,v.createRoot)(E).render((0,y.jsx)(_.StrictMode,{children:(0,y.jsx)(p,{children:(0,y.jsx)(d,{children:(0,y.jsx)(T,{})})})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Jt as e,Kt as t,Qt as n,Ut as r,cr as i,qt as a}from"./api-
|
|
1
|
+
import{Jt as e,Kt as t,Qt as n,Ut as r,cr as i,qt as a}from"./api-DjiZvIa0.js";import{a as o,i as s,n as c,r as l,t as u}from"./select-CWyjnar7.js";import{s as d}from"./i18n-Bm3Ov7Fy.js";import{t as f,u as p,v as m}from"./use-config-evzage09.js";var h=i();function g(){let i=f(),g=p(),v=m(),y=i.data?.productAnalytics.enabled??!0,b=i.data?.productAnalytics.audience??`external`,x=e=>{v.mutate({data:{enabled:e}})},S=e=>{let t=e;v.mutate({data:{audience:t}})};return(0,h.jsxs)(n,{title:d(`privacyPageTitle`),description:d(`privacyPageDescription`),children:[(0,h.jsx)(e,{title:d(`productAnalyticsSectionTitle`),description:d(`productAnalyticsSectionDescription`),children:(0,h.jsxs)(a,{children:[(0,h.jsx)(t,{title:d(`productAnalyticsEnabledTitle`),description:d(`productAnalyticsEnabledDescription`),control:(0,h.jsx)(r,{"aria-label":d(`productAnalyticsEnabledTitle`),checked:y,disabled:i.isLoading||v.isPending,onCheckedChange:x})}),(0,h.jsx)(t,{title:d(`productAnalyticsAudienceTitle`),description:d(`productAnalyticsAudienceDescription`),control:(0,h.jsxs)(u,{value:b,onValueChange:S,disabled:i.isLoading||v.isPending,children:[(0,h.jsx)(s,{"aria-label":d(`productAnalyticsAudienceTitle`),className:`w-40 sm:w-48`,children:(0,h.jsx)(o,{})}),(0,h.jsxs)(c,{children:[(0,h.jsx)(l,{value:`external`,children:d(`productAnalyticsAudienceExternal`)}),(0,h.jsx)(l,{value:`internal`,children:d(`productAnalyticsAudienceInternal`)}),(0,h.jsx)(l,{value:`qa`,children:d(`productAnalyticsAudienceQa`)})]})]})})]})}),(0,h.jsx)(e,{title:d(`productAnalyticsDataTitle`),children:(0,h.jsxs)(a,{children:[(0,h.jsx)(t,{layout:`stacked`,title:d(`productAnalyticsCollectedTitle`),description:d(`productAnalyticsCollectedDescription`)}),(0,h.jsx)(t,{layout:`stacked`,title:d(`productAnalyticsExcludedTitle`),description:d(`productAnalyticsExcludedDescription`)}),(0,h.jsx)(t,{layout:`stacked`,title:d(`productAnalyticsAnonymousTitle`),description:d(`productAnalyticsAnonymousDescription`)})]})}),(0,h.jsx)(e,{title:d(`productAnalyticsStatusSectionTitle`),children:(0,h.jsxs)(a,{children:[(0,h.jsx)(t,{layout:`stacked`,title:d(`productAnalyticsStatusTitle`),description:_(g.data,g.isLoading)}),g.data?.lastError?(0,h.jsx)(t,{layout:`stacked`,title:d(`productAnalyticsLastErrorTitle`),description:g.data.lastError}):null]})})]})}function _(e,t){if(t)return d(`productAnalyticsStatusLoading`);if(!e?.lastAttemptAt)return d(`productAnalyticsStatusNever`);let n=new Date(e.lastAttemptAt).toLocaleString();if(!e.lastSuccessAt)return`${d(`productAnalyticsLastAttemptLabel`)} ${n} · ${e.pendingReceiptCount} ${d(`productAnalyticsPendingLabel`)}`;let r=new Date(e.lastSuccessAt).toLocaleString();return`${d(`productAnalyticsLastSuccessLabel`)} ${r} · ${e.pendingReceiptCount} ${d(`productAnalyticsPendingLabel`)}`}export{g as PrivacySettingsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./chunk-DF37yw5_.js";import{Gn as t,Gt as n,Jn as r,Lt as i,Xn as a,Yn as o,Yt as s,cr as c,sr as l,yr as u}from"./api-DjiZvIa0.js";import{f as d,n as f,p,u as m}from"./navigation-link-CjxNC8aT.js";import{$ as h,Bt as g,Ft as _,H as v,Lt as y,Q as ee,X as b,Y as te,Z as x,et as ne,f as re,m as S,pt as C,tt as ie,yt as w}from"./app-presenter-provider-CCRFsFYr.js";import{t as T}from"./createLucideIcon-Cfo2ySi5.js";import{t as E}from"./use-viewport-layout-D_9XWGDV.js";import{C as D,a as O,i as k,n as A,r as j,t as M,w as N}from"./select-CWyjnar7.js";import{m as ae}from"./context-menu-BsCj2fRs.js";import{t as oe}from"./confirm-dialog-CxfecBzO.js";import{t as se}from"./circle-dashed-EY1ScSMe.js";import{a as ce,i as le,n as ue,r as P}from"./tag-chip-BIuavK2K.js";import{n as de,t as fe}from"./trash-2-hAbJh9VZ.js";import{t as pe}from"./settings-2-CrNhfInU.js";import{n as F,r as I,s as L,t as me}from"./i18n-Bm3Ov7Fy.js";import{a as R,i as he,n as ge,o as _e,r as ve,t as ye}from"./dialog-QjQoKbIV.js";import{a as be,i as xe,n as Se,t as Ce}from"./card-Cqs73hGI.js";var we=T(`CircleX`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Te=T(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ee=T(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),De=T(`List`,[[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 18h.01`,key:`1tta3j`}],[`path`,{d:`M3 6h.01`,key:`1rqtza`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 18h13`,key:`1lx6n3`}],[`path`,{d:`M8 6h13`,key:`ik3vkj`}]]),Oe=T(`Unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),z=e(u(),1),B=c();function V({title:e,children:t,className:n=``}){return(0,B.jsxs)(Ce,{hover:!1,surface:`flat`,className:n,children:[(0,B.jsx)(xe,{className:`p-4 pb-3`,children:(0,B.jsx)(be,{children:e})}),(0,B.jsx)(Se,{className:`p-4 pt-0`,children:t})]})}function H({children:e}){return(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:e})}function U({available:e,children:t,className:n,label:r,onOpen:i,path:a}){return e?(0,B.jsx)(`button`,{type:`button`,className:n,title:a,onClick:()=>i(a,r),children:t}):(0,B.jsx)(`div`,{className:n,children:t})}function ke({agreement:e,isLoading:t,isError:n,onOpenFile:r}){return(0,B.jsxs)(V,{title:L(`projectsAgreementFile`),children:[(0,B.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:L(`projectsAgreementDescription`)}),t?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:L(`projectsLoading`)}):n?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:L(`projectsLoadFailed`)}):e?.available?(0,B.jsxs)(U,{available:!0,path:e.path,label:e.path,onOpen:r,className:`block w-full rounded-xl bg-muted/45 p-3 text-left transition-colors enabled:hover:bg-[var(--interaction-hover)] enabled:focus-visible:outline-none enabled:focus-visible:ring-1 enabled:focus-visible:ring-border`,children:[(0,B.jsx)(`span`,{className:`block text-sm font-medium`,children:e.path}),(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:L(`projectsAgreementOpen`)})]}):(0,B.jsx)(H,{children:L(`projectsNoAgreement`)})]})}var W=e=>[`project-work`,e],G=e=>[`project-work-summary`,e],K=e=>[`project-work-states`,e],q=e=>[`project-work-artifacts`,e],J=(e,t)=>[`project-work-item`,e,t],Y=(e,t)=>[`project-work-activity`,e,t];function Ae(e,t={}){return g({queryKey:[...W(e??``),t],enabled:!!e,initialPageParam:null,queryFn:async({pageParam:n})=>await i.projects.listWork(e,{...t,...n?{cursor:n}:{}}),getNextPageParam:e=>e.nextCursor})}function je(e){return a({queryKey:G(e??``),enabled:!!e,queryFn:async()=>await i.projects.getWorkSummary(e)})}function Me(e){return a({queryKey:K(e??``),enabled:!!e,queryFn:async()=>await i.projects.listWorkStates(e)})}function Ne(e,t={}){return g({queryKey:[...q(e??``),t],enabled:!!e,initialPageParam:null,queryFn:async({pageParam:n})=>await i.projects.listRecentWorkArtifacts(e,{...t,...n?{cursor:n}:{}}),getNextPageParam:e=>e.nextCursor})}function Pe(e,t){return a({queryKey:J(e??``,t??``),enabled:!!(e&&t),queryFn:async()=>await i.projects.getWorkItem(e,t)})}function Fe(e,t){return a({queryKey:Y(e??``,t??``),enabled:!!(e&&t),queryFn:async()=>await i.projects.listWorkItemActivities(e,t,{limit:100})})}function X(e){let t=l(),n=async n=>{await Promise.all([t.invalidateQueries({queryKey:W(e)}),t.invalidateQueries({queryKey:G(e)}),t.invalidateQueries({queryKey:K(e)}),t.invalidateQueries({queryKey:q(e)}),...n?[t.invalidateQueries({queryKey:J(e,n)}),t.invalidateQueries({queryKey:Y(e,n)})]:[]])};return{createItem:o({mutationFn:async t=>await i.projects.createWorkItem(e,t),onSuccess:async e=>await n(e.id)}),updateItem:o({mutationFn:async t=>await i.projects.updateWorkItem(e,t.workItemId,t.patch),onSuccess:async e=>await n(e.id)}),deleteItem:o({mutationFn:async t=>await i.projects.deleteWorkItem(e,t),onSuccess:async e=>await n(e.id)}),restoreItem:o({mutationFn:async t=>await i.projects.restoreWorkItem(e,t),onSuccess:async e=>await n(e.id)}),linkArtifact:o({mutationFn:async t=>await i.projects.linkWorkItemArtifact(e,t.workItemId,{path:t.path,...t.label?{label:t.label}:{}}),onSuccess:async(e,t)=>await n(t.workItemId)}),unlinkArtifact:o({mutationFn:async t=>await i.projects.unlinkWorkItemArtifact(e,t.workItemId,t.artifactLinkId),onSuccess:async(e,t)=>await n(t.workItemId)}),createState:o({mutationFn:async t=>await i.projects.createWorkState(e,t),onSuccess:async()=>await n()}),updateState:o({mutationFn:async t=>await i.projects.updateWorkState(e,t.stateId,t.patch),onSuccess:async()=>await n()}),deleteState:o({mutationFn:async t=>await i.projects.deleteWorkState(e,t.stateId,t.migrateToStateId),onSuccess:async()=>await n()})}}function Z(e){let n=l();(0,z.useEffect)(()=>{if(e)return i.eventBus.on(t.projectWorkChanged,t=>{t.projectId===e&&(n.invalidateQueries({queryKey:W(e)}),n.invalidateQueries({queryKey:G(e)}),n.invalidateQueries({queryKey:K(e)}),n.invalidateQueries({queryKey:q(e)}),t.workItemId&&(n.invalidateQueries({queryKey:J(e,t.workItemId)}),n.invalidateQueries({queryKey:Y(e,t.workItemId)})))})},[e,n])}function Ie(e){return[...e].sort((e,t)=>e.position-t.position||e.name.localeCompare(t.name))}var Le={started:0,unstarted:1,backlog:2,completed:3,canceled:4};function Re(e){return[...e].sort((e,t)=>{let n=Le[e.category]-Le[t.category];return n===0?e.category===`completed`||e.category===`canceled`?e.position-t.position||e.name.localeCompare(t.name):t.position-e.position||e.name.localeCompare(t.name):n})}function Q(e,t){return`${e}${e.endsWith(`/`)||e.endsWith(`\\`)?``:`/`}${t}`}function ze(e,t=new Date){if(!e)return`-`;let n=new Date(e),r=t.getTime()-n.getTime();if(Number.isNaN(n.getTime()))return e;if(r<6e4)return L(`projectsTimeJustNow`);let i=Math.floor(r/6e4);if(i<60)return L(`projectsTimeMinutesAgo`).replace(`{count}`,String(i));let a=Math.floor(i/60);if(a<24)return L(`projectsTimeHoursAgo`).replace(`{count}`,String(a));let o=Math.floor(a/24);return o===1?L(`projectsTimeYesterday`):o<7?L(`projectsTimeDaysAgo`).replace(`{count}`,String(o)):me(e)}var Be=20;function Ve({projectId:e,onOpenFile:t}){let[n,r]=(0,z.useState)(``),i=Ne(e,{limit:Be,...n.trim()?{query:n.trim()}:{}}),a=i.data?.pages??[],o=a.flatMap(e=>e.artifacts),s=a[0]?.total??0;return i.isLoading?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:L(`projectsLoading`)}):i.isError?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:L(`projectsLoadFailed`)}):(0,B.jsxs)(`section`,{className:`min-w-0`,"aria-label":L(`projectsArtifacts`),children:[(0,B.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[I(s),` `,L(`projectsArtifactsCountSuffix`)]}),(0,B.jsx)(`input`,{type:`search`,value:n,className:`h-8 w-full min-w-0 rounded-lg border border-border/60 bg-transparent px-3 text-sm outline-none placeholder:text-muted-foreground sm:w-60`,placeholder:L(`projectsArtifactsSearchPlaceholder`),onChange:e=>r(e.target.value)})]}),o.length?(0,B.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/60`,children:[(0,B.jsx)(`div`,{className:`divide-y divide-border/60`,children:o.map(e=>(0,B.jsxs)(U,{available:e.exists,path:e.path,label:e.label??e.path,onOpen:t,className:`flex w-full min-w-0 items-center gap-3 px-3 py-3 text-left text-sm transition-colors enabled:hover:bg-[var(--interaction-hover)] enabled:focus-visible:outline-none enabled:focus-visible:ring-1 enabled:focus-visible:ring-border`,children:[(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate font-medium`,children:e.label??e.path}),(0,B.jsxs)(`span`,{className:`mt-1 block truncate text-xs text-muted-foreground`,children:[e.path,` · `,e.workItemTitle]})]}),(0,B.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground`,dateTime:e.createdAt,title:F(e.createdAt),children:ze(e.createdAt)}),e.exists?null:(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-destructive`,children:L(`projectsUnavailable`)})]},e.id))}),i.hasNextPage?(0,B.jsx)(`button`,{type:`button`,className:`w-full border-t border-border/60 px-3 py-2.5 text-left text-sm text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,disabled:i.isFetchingNextPage,onClick:()=>void i.fetchNextPage(),children:i.isFetchingNextPage?L(`projectsLoading`):L(`projectsArtifactsShowMore`)}):null]}):(0,B.jsx)(H,{children:n.trim()?L(`projectsArtifactsNoMatches`):L(`projectsNoArtifacts`)})]})}var He={Backlog:`projectsWorkState_backlog`,Planned:`projectsWorkState_planned`,"In Progress":`projectsWorkState_inProgress`,"In Review":`projectsWorkState_inReview`,"Awaiting Acceptance":`projectsWorkState_awaitingAcceptance`,Completed:`projectsWorkState_completed`,Canceled:`projectsWorkState_canceled`};function $(e,t){let n=He[e];return n?t?L(n,t):L(n):e}function Ue({projectId:e,onOpenArtifact:t,onOpenWorkItem:n}){Z(e);let r=je(e),i=Ae(e,{limit:5}),a=Ne(e,{limit:5}),o=a.data?.pages[0]?.artifacts??[],s=i.data?.pages.flatMap(e=>e.items).slice(0,5)??[];return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsx)(`section`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,"aria-label":L(`projectsWorkSummary`),children:r.data?[[`projectsWorkTotal`,r.data.total],[`projectsWorkActive`,r.data.active],[`projectsWorkNeedsAttention`,r.data.attention],[`projectsWorkCompleted`,r.data.completed]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`rounded-xl border border-border/60 bg-card p-4`,children:[(0,B.jsx)(`div`,{className:`text-2xl font-semibold`,children:t}),(0,B.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:L(e)})]},e)):(0,B.jsx)(`div`,{className:`col-span-full rounded-xl border border-border/60 p-5 text-sm text-muted-foreground`,children:r.isError?L(`projectsLoadFailed`):L(`projectsLoading`)})}),(0,B.jsxs)(`div`,{className:`grid min-w-0 gap-4 lg:grid-cols-2`,children:[(0,B.jsx)(V,{title:L(`projectsWorkRecentlyUpdated`),children:i.isLoading?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:L(`projectsLoading`)}):i.isError?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:L(`projectsLoadFailed`)}):s.length?(0,B.jsx)(`div`,{className:`space-y-2`,children:s.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 rounded-xl bg-muted/45 px-3 py-3 text-left transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>n(e.id),children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:e.title}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:$(e.state.name)})]},e.id))}):(0,B.jsx)(H,{children:L(`projectsWorkEmpty`)})}),(0,B.jsx)(V,{title:L(`projectsRecentArtifacts`),children:a.isLoading?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:L(`projectsLoading`)}):a.isError?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:L(`projectsLoadFailed`)}):o.length?(0,B.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,B.jsxs)(U,{available:e.exists,path:e.path,label:e.label??e.path,onOpen:t,className:`block w-full rounded-xl bg-muted/45 p-3 text-left text-sm transition-colors enabled:hover:bg-[var(--interaction-hover)] enabled:focus-visible:outline-none enabled:focus-visible:ring-1 enabled:focus-visible:ring-border`,children:[(0,B.jsx)(`span`,{className:`block truncate font-medium`,children:e.label??e.path}),(0,B.jsxs)(`span`,{className:`mt-1 block truncate text-xs text-muted-foreground`,children:[e.workItemTitle,(0,B.jsx)(`time`,{dateTime:e.createdAt,title:F(e.createdAt),children:` · ${ze(e.createdAt)}`}),e.exists?``:` · ${L(`projectsUnavailable`)}`]})]},e.id))}):(0,B.jsx)(H,{children:L(`projectsNoRecentArtifacts`)})})]})]})}function We({skills:e,isLoading:t,isError:n,onOpen:r}){return t?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:L(`projectsLoading`)}):n?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:L(`projectsLoadFailed`)}):(0,B.jsxs)(`section`,{className:`min-w-0`,"aria-label":L(`projectsSkills`),children:[(0,B.jsxs)(`p`,{className:`mb-3 text-sm text-muted-foreground`,children:[I(e.length),` `,L(`projectsSkillsCountSuffix`)]}),e.length?(0,B.jsx)(`div`,{className:`grid min-w-0 gap-3 md:grid-cols-2`,children:e.map(e=>(0,B.jsxs)(`div`,{className:`relative group/page-row rounded-xl border border-border/60 transition-colors hover:border-border hover:bg-[var(--interaction-hover)] focus-within:bg-[var(--interaction-hover)] has-[[data-context-menu-open]]:bg-[var(--interaction-hover)]`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`w-full min-w-0 rounded-xl p-3 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>r(e),children:[(0,B.jsx)(`h3`,{className:`pr-7 text-sm font-medium`,children:e.name}),(0,B.jsx)(`p`,{className:`mt-1 truncate text-xs text-muted-foreground`,title:e.path,children:e.path}),(0,B.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs text-muted-foreground`,title:e.description??e.ref,children:e.description??e.ref})]}),(0,B.jsx)(`span`,{className:`absolute right-2 top-2`,children:(0,B.jsx)(re,{revealOnHover:!0,page:S(`skill`,e.ref,e.name)})})]},e.ref))}):(0,B.jsx)(H,{children:L(`projectsNoSkills`)})]})}function Ge({onOpenArtifact:e,onOpenChange:t,projectId:n,projectRoot:r,workItemId:i}){let a=Pe(n,i),o=Fe(n,i);Z(n);let s=Me(n);return(0,B.jsx)(b,{open:!!i,onOpenChange:t,children:(0,B.jsxs)(x,{side:`right`,closeLabel:L(`projectsCloseDetails`),className:`flex h-full w-full flex-col overflow-hidden p-0 sm:max-w-[680px]`,children:[a.isLoading?(0,B.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:L(`projectsLoading`)}):null,a.isError?(0,B.jsx)(`div`,{className:`p-6 text-sm text-destructive`,children:L(`projectsWorkItemLoadFailed`)}):null,a.data?(0,B.jsx)(Ke,{item:a.data,states:s.data??[],activities:o.data?.activities??[],onOpenArtifact:(t,n)=>e(Q(r,t),n),onClose:()=>t(!1)},`${a.data.id}:${a.data.version}`):null]})})}function Ke({activities:e,item:t,onClose:i,onOpenArtifact:a,states:o}){let c=X(t.projectId),[l,u]=(0,z.useState)(t.title),[d,p]=(0,z.useState)(t.description),[m,g]=(0,z.useState)(t.stateId),[v,y]=(0,z.useState)(t.attention),[b,x]=(0,z.useState)(``),[C,w]=(0,z.useState)(``),[T,E]=(0,z.useState)(!1),D=async(e,t)=>{try{await e(),t?.()}catch(e){r.error(e instanceof Error?e.message:L(`projectsWorkActionFailed`))}},N=async()=>{try{await c.updateItem.mutateAsync({workItemId:t.id,patch:{title:l,description:d,stateId:m,attention:v,expectedVersion:t.version}}),r.success(L(`projectsWorkItemSaved`))}catch(e){r.error(e instanceof Error?e.message:L(`projectsWorkItemSaveFailed`))}},ae=async()=>{if(b.trim())try{await c.linkArtifact.mutateAsync({workItemId:t.id,path:b.trim(),...C.trim()?{label:C.trim()}:{}}),x(``),w(``)}catch(e){r.error(e instanceof Error?e.message:L(`projectsWorkArtifactLinkFailed`))}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(ne,{className:`shrink-0 border-b border-border/60 px-5 pb-5 pt-6 pr-14 sm:px-7 sm:pt-7`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(ie,{children:L(`projectsWorkDetails`)}),(0,B.jsx)(re,{page:S(`project-work`,JSON.stringify([t.projectId,t.id]),t.title)})]}),(0,B.jsxs)(ee,{children:[t.id,` · `,L(`projectsWorkVersion`),` `,t.version]})]}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-6 sm:px-7`,children:[(0,B.jsxs)(`section`,{className:`space-y-3`,children:[(0,B.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:L(`projectsWorkTitle`)}),(0,B.jsx)(n,{value:l,onChange:e=>u(e.target.value)}),(0,B.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:L(`projectsWorkDescription`)}),(0,B.jsx)(te,{className:`min-h-28`,value:d,onChange:e=>p(e.target.value)}),(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-muted-foreground`,children:L(`projectsStatus`)}),(0,B.jsxs)(M,{value:m,onValueChange:g,children:[(0,B.jsx)(k,{children:(0,B.jsx)(O,{})}),(0,B.jsx)(A,{children:o.map(e=>(0,B.jsx)(j,{value:e.id,children:$(e.name)},e.id))})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-muted-foreground`,children:L(`projectsWorkAttention`)}),(0,B.jsxs)(M,{value:v,onValueChange:e=>y(e),children:[(0,B.jsx)(k,{children:(0,B.jsx)(O,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(j,{value:`none`,children:L(`projectsWorkAttention_none`)}),(0,B.jsx)(j,{value:`blocked`,children:L(`projectsWorkAttention_blocked`)}),(0,B.jsx)(j,{value:`awaiting-user`,children:L(`projectsWorkAttention_awaiting-user`)})]})]})]})]})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`mb-3 text-sm font-semibold`,children:L(`projectsWorkArtifacts`)}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[t.artifacts.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-border/60 p-2`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg px-2 py-1 text-left hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>a(e.path,e.label??e.path),children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2 truncate text-sm font-medium`,children:[(0,B.jsx)(f,{className:`h-3.5 w-3.5 shrink-0`}),e.label??e.path]}),(0,B.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.path})]}),(0,B.jsx)(s,{size:`icon`,variant:`ghost`,"aria-label":L(`projectsWorkUnlinkArtifact`),onClick:()=>void D(()=>c.unlinkArtifact.mutateAsync({workItemId:t.id,artifactLinkId:e.id})),children:(0,B.jsx)(Oe,{className:`h-4 w-4`})})]},e.id)),t.artifacts.length?null:(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:L(`projectsWorkNoArtifacts`)})]}),(0,B.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-[1fr_12rem_auto]`,children:[(0,B.jsx)(n,{value:b,onChange:e=>x(e.target.value),placeholder:L(`projectsWorkArtifactPath`)}),(0,B.jsx)(n,{value:C,onChange:e=>w(e.target.value),placeholder:L(`projectsWorkArtifactLabel`)}),(0,B.jsxs)(s,{variant:`outline`,onClick:()=>void ae(),disabled:!b.trim()||c.linkArtifact.isPending,children:[(0,B.jsx)(_,{className:`mr-2 h-4 w-4`}),L(`projectsWorkLinkArtifact`)]})]})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`mb-3 text-sm font-semibold`,children:L(`projectsActivity`)}),(0,B.jsx)(`ol`,{className:`space-y-2`,children:e.map(e=>(0,B.jsxs)(`li`,{className:`rounded-xl bg-muted/35 px-3 py-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:L(`projectsWorkActivity_${e.type}`)}),(0,B.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[e.actor.kind,` ·`,` `,new Date(e.createdAt).toLocaleString()]})]},e.id))})]})]}),(0,B.jsxs)(h,{className:`shrink-0 border-t border-border/60 bg-background px-5 py-4 sm:px-7`,children:[t.deletedAt?(0,B.jsx)(s,{variant:`outline`,onClick:()=>void D(()=>c.restoreItem.mutateAsync(t.id)),children:L(`projectsRestore`)}):(0,B.jsxs)(s,{variant:`destructive`,onClick:()=>E(!0),children:[(0,B.jsx)(fe,{className:`mr-2 h-4 w-4`}),L(`projectsDelete`)]}),(0,B.jsx)(s,{onClick:()=>void N(),disabled:!l.trim()||c.updateItem.isPending,children:L(`save`)})]}),(0,B.jsx)(oe,{open:T,onOpenChange:E,title:L(`projectsDeleteWorkItem`),description:L(`projectsDeleteWorkItemDescription`),confirmLabel:L(`projectsDelete`),variant:`destructive`,onCancel:()=>E(!1),onConfirm:()=>void D(()=>c.deleteItem.mutateAsync(t.id),i)})]})}var qe=[`backlog`,`unstarted`,`started`,`completed`,`canceled`];function Je({open:e,onOpenChange:t,projectId:i,states:a}){let o=X(i),c=Ie(a),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(`unstarted`),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(``),_=async e=>{try{await e()}catch(e){r.error(e instanceof Error?e.message:L(`projectsWorkActionFailed`))}},v=async()=>{l.trim()&&await _(async()=>{await o.createState.mutateAsync({name:l.trim(),category:d}),u(``)})},y=async(e,t)=>{let n=c[e],r=c[e+t];!n||!r||await _(async()=>{await o.updateState.mutateAsync({stateId:n.id,patch:{position:r.position}}),await o.updateState.mutateAsync({stateId:r.id,patch:{position:n.position}})})};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ye,{open:e,onOpenChange:t,children:(0,B.jsxs)(ge,{className:`max-h-[85vh] overflow-y-auto sm:max-w-2xl`,children:[(0,B.jsxs)(R,{children:[(0,B.jsx)(_e,{children:L(`projectsWorkStateSettings`)}),(0,B.jsx)(ve,{children:L(`projectsWorkStateSettingsDescription`)})]}),(0,B.jsx)(`div`,{className:`space-y-2`,children:c.map((e,t)=>(0,B.jsxs)(`div`,{className:`grid gap-2 rounded-xl border border-border/60 p-3 sm:grid-cols-[1fr_11rem_auto]`,children:[(0,B.jsx)(n,{"aria-label":L(`projectsWorkStateName`),defaultValue:$(e.name),onBlur:t=>{let n=t.currentTarget.value.trim();n&&n!==$(e.name)&&_(()=>o.updateState.mutateAsync({stateId:e.id,patch:{name:n}}))}}),(0,B.jsxs)(M,{value:e.category,onValueChange:t=>void _(()=>o.updateState.mutateAsync({stateId:e.id,patch:{category:t}})),children:[(0,B.jsx)(k,{"aria-label":L(`projectsWorkStateCategory`),children:(0,B.jsx)(O,{})}),(0,B.jsx)(A,{children:qe.map(e=>(0,B.jsx)(j,{value:e,children:L(`projectsWorkCategory_${e}`)},e))})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,B.jsx)(s,{size:`icon`,variant:`ghost`,"aria-label":L(`projectsMoveUp`),disabled:t===0,onClick:()=>void y(t,-1),children:(0,B.jsx)(D,{className:`h-4 w-4`})}),(0,B.jsx)(s,{size:`icon`,variant:`ghost`,"aria-label":L(`projectsMoveDown`),disabled:t===c.length-1,onClick:()=>void y(t,1),children:(0,B.jsx)(N,{className:`h-4 w-4`})}),(0,B.jsx)(s,{size:`icon`,variant:`ghost`,"aria-label":L(`projectsDeleteState`),disabled:c.length<=1,onClick:()=>{m(e),g(``)},children:(0,B.jsx)(fe,{className:`h-4 w-4`})})]}),(0,B.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground sm:col-span-3`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`default-state`,checked:e.isDefault,onChange:()=>void _(()=>o.updateState.mutateAsync({stateId:e.id,patch:{isDefault:!0}}))}),L(`projectsWorkDefaultState`)]})]},e.id))}),(0,B.jsxs)(`div`,{className:`grid gap-2 border-t border-border/60 pt-4 sm:grid-cols-[1fr_11rem_auto]`,children:[(0,B.jsx)(n,{value:l,onChange:e=>u(e.target.value),placeholder:L(`projectsWorkNewState`)}),(0,B.jsxs)(M,{value:d,onValueChange:e=>f(e),children:[(0,B.jsx)(k,{children:(0,B.jsx)(O,{})}),(0,B.jsx)(A,{children:qe.map(e=>(0,B.jsx)(j,{value:e,children:L(`projectsWorkCategory_${e}`)},e))})]}),(0,B.jsxs)(s,{onClick:()=>void v(),disabled:!l.trim()||o.createState.isPending,children:[(0,B.jsx)(de,{className:`mr-2 h-4 w-4`}),L(`projectsAdd`)]})]})]})}),(0,B.jsx)(ye,{open:!!p,onOpenChange:e=>{e||m(null)},children:(0,B.jsxs)(ge,{children:[(0,B.jsxs)(R,{children:[(0,B.jsx)(_e,{children:L(`projectsDeleteState`)}),(0,B.jsx)(ve,{children:L(`projectsDeleteStateDescription`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:L(`projectsWorkStateMigration`)}),(0,B.jsxs)(M,{value:h,onValueChange:g,children:[(0,B.jsx)(k,{children:(0,B.jsx)(O,{placeholder:L(`projectsWorkStateMigrationOptional`)})}),(0,B.jsx)(A,{children:c.filter(e=>e.id!==p?.id).map(e=>(0,B.jsx)(j,{value:e.id,children:$(e.name)},e.id))})]})]}),(0,B.jsxs)(he,{children:[(0,B.jsx)(s,{variant:`outline`,onClick:()=>m(null),children:L(`cancel`)}),(0,B.jsx)(s,{variant:`destructive`,onClick:()=>{p&&_(async()=>{await o.deleteState.mutateAsync({stateId:p.id,migrateToStateId:h||null}),m(null)})},children:L(`projectsDelete`)})]})]})})]})}function Ye({startedProgress:e,state:t}){if(t.category===`backlog`)return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`backlog`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground/65`,children:(0,B.jsx)(se,{className:`h-4 w-4`})});if(t.category===`unstarted`)return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`unstarted`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground`,children:(0,B.jsx)(Te,{className:`h-4 w-4`,strokeWidth:2})});if(t.category===`completed`)return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`completed`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-emerald-600 dark:text-emerald-400`,children:(0,B.jsx)(y,{className:`h-4 w-4`,strokeWidth:2.25})});if(t.category===`canceled`)return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`canceled`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground/65`,children:(0,B.jsx)(we,{className:`h-4 w-4`})});let n=Math.round((e??.5)*100),r=n>=67?`text-emerald-600 dark:text-emerald-400`:n>=40?`text-orange-500 dark:text-orange-400`:`text-amber-500 dark:text-amber-400`;return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`started`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center ${r}`,children:(0,B.jsxs)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 16 16`,fill:`none`,children:[(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.5`,stroke:`currentColor`,strokeWidth:`1.75`,opacity:`0.22`}),(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.5`,pathLength:`100`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`${n} ${100-n}`,transform:`rotate(-90 8 8)`})]})})}function Xe({item:e,onOpen:t}){return(0,B.jsxs)(`button`,{type:`button`,className:`w-full rounded-xl border border-border/50 bg-card p-3 text-left text-sm shadow-sm transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:t,children:[(0,B.jsx)(`span`,{className:`block font-medium`,children:e.title}),(0,B.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:$(e.state.name)}),e.attention===`none`?null:(0,B.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-amber-700 dark:text-amber-300`,children:L(`projectsWorkAttention_${e.attention}`)}),e.deletedAt?(0,B.jsx)(`span`,{children:L(`projectsDeleted`)}):null]})]})}function Ze({hasNextPage:e,isError:t,isFetchingNextPage:n,isLoading:r,items:i,onLoadMore:a,onOpenWorkItem:o}){return r?(0,B.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:L(`projectsLoading`)}):t?(0,B.jsx)(`p`,{className:`py-3 text-xs text-destructive`,children:L(`projectsLoadFailed`)}):(0,B.jsxs)(B.Fragment,{children:[i.length?i.map(e=>(0,B.jsx)(Xe,{item:e,onOpen:()=>o(e.id)},e.id)):(0,B.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:L(`projectsNoData`)}),e?(0,B.jsx)(s,{type:`button`,variant:`ghost`,size:`sm`,className:`w-full`,disabled:n,onClick:a,children:L(n?`projectsLoading`:`projectsWorkLoadMore`)}):null]})}function Qe({includeDeleted:e,onOpenWorkItem:t,state:n,startedProgress:r,view:i}){let[a,o]=(0,z.useState)(!1),s=Ae(n.projectId,{stateId:n.id,includeDeleted:e,limit:20}),c=s.data?.pages.flatMap(e=>e.items)??[],l=s.data?.pages[0]?.total;return(0,B.jsxs)(`section`,{className:i===`board`?`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`:`min-w-0`,"aria-label":$(n.name),children:[(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full shrink-0 items-center gap-2 rounded-lg px-1 py-2 text-left transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-expanded":!a,onClick:()=>o(e=>!e),children:[a?(0,B.jsx)(ae,{className:`h-4 w-4 shrink-0`}):(0,B.jsx)(N,{className:`h-4 w-4 shrink-0`}),(0,B.jsx)(Ye,{state:n,startedProgress:r}),(0,B.jsx)(`span`,{className:`min-w-0 truncate text-sm font-semibold`,children:$(n.name)}),(0,B.jsx)(`span`,{className:`ml-0.5 shrink-0 text-xs font-medium tabular-nums text-muted-foreground`,children:l??`…`})]}),a?null:(0,B.jsx)(`div`,{className:i===`board`?`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain px-1 pb-3`:`space-y-2 px-1 pb-3`,children:(0,B.jsx)(Ze,{hasNextPage:s.hasNextPage,isError:s.isError,isFetchingNextPage:s.isFetchingNextPage,isLoading:s.isLoading,items:c,onLoadMore:()=>void s.fetchNextPage(),onOpenWorkItem:t})})]})}function $e({onOpenWorkItem:e,projectId:t}){let[i,a]=(0,z.useState)(`list`),[o,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(!1);Z(t);let p=Me(t),m=X(t),h=async()=>{if(l.trim())try{let t=await m.createItem.mutateAsync({title:l.trim()});u(``),e(t.id)}catch(e){r.error(e instanceof Error?e.message:L(`projectsWorkItemCreateFailed`))}};if(p.isLoading)return(0,B.jsx)(`div`,{className:`rounded-xl border border-border/60 p-5 text-sm text-muted-foreground`,children:L(`projectsLoading`)});if(p.isError)return(0,B.jsx)(`div`,{className:`rounded-xl border border-destructive/40 p-5 text-sm text-destructive`,children:L(`projectsLoadFailed`)});let g=Ie(p.data??[]),_=Re(p.data??[]),v=g.filter(e=>e.category===`started`),y=new Map(v.map((e,t)=>[e.id,(t+1)/(v.length+1)]));return(0,B.jsxs)(`section`,{"aria-label":L(`projectsWork`),className:`min-w-0 space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-[16rem] flex-1 gap-2`,children:[(0,B.jsx)(n,{value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h()},placeholder:L(`projectsWorkNewItem`)}),(0,B.jsxs)(s,{onClick:()=>void h(),disabled:!l.trim()||m.createItem.isPending,children:[(0,B.jsx)(de,{className:`mr-2 h-4 w-4`}),L(`projectsCreate`)]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 rounded-xl bg-muted/40 p-1`,role:`group`,"aria-label":L(`projectsWorkViews`),children:[(0,B.jsxs)(s,{size:`sm`,variant:i===`list`?`secondary`:`ghost`,"aria-pressed":i===`list`,onClick:()=>a(`list`),children:[(0,B.jsx)(De,{className:`mr-2 h-4 w-4`}),L(`projectsWorkList`)]}),(0,B.jsxs)(s,{size:`sm`,variant:i===`board`?`secondary`:`ghost`,"aria-pressed":i===`board`,onClick:()=>a(`board`),children:[(0,B.jsx)(Ee,{className:`mr-2 h-4 w-4`}),L(`projectsWorkBoard`)]})]}),(0,B.jsxs)(s,{variant:`outline`,size:`sm`,onClick:()=>f(!0),children:[(0,B.jsx)(pe,{className:`mr-2 h-4 w-4`}),L(`projectsWorkStateSettings`)]})]}),(0,B.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-xs text-muted-foreground`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>c(e.target.checked)}),L(`projectsWorkShowDeleted`)]}),i===`list`?(0,B.jsx)(`div`,{className:`space-y-3`,children:_.map(t=>(0,B.jsx)(Qe,{state:t,startedProgress:y.get(t.id)??null,view:i,includeDeleted:o,onOpenWorkItem:e},t.id))}):null,i===`board`?(0,B.jsx)(`div`,{className:`grid h-[calc(100dvh-17rem)] min-h-[28rem] max-h-[52rem] min-w-0 auto-cols-[minmax(18rem,1fr)] grid-flow-col items-stretch gap-3 overflow-x-auto overflow-y-hidden pb-2`,children:g.map(t=>(0,B.jsx)(Qe,{state:t,startedProgress:y.get(t.id)??null,view:i,includeDeleted:o,onOpenWorkItem:e},t.id))}):null,(0,B.jsx)(Je,{open:d,onOpenChange:f,projectId:t,states:g})]})}var et=e=>[`project-agreement`,e],tt=e=>[`project-skills`,e];function nt(e){return a({queryKey:et(e??``),enabled:!!e,queryFn:async()=>await i.projects.getAgreement(e)})}function rt(e){return a({queryKey:tt(e??``),enabled:!!e,queryFn:async()=>await i.projects.listProjectSkills(e)})}function it(e){return e===`overview`||e===`work`||e===`artifacts`||e===`skills`||e===`agreement`}var at=[`overview`,`work`,`artifacts`,`skills`,`agreement`];function ot(){let{projectId:e,tab:t}=p(),n=d(),{state:r}=m(),i=w(),{isMobile:a}=E(),o=C(),[s,c]=(0,z.useState)(null),l=o.data?.projects??[],u=l.find(t=>t.id===e)??null,f=it(t)?t:null,h=nt(f===`agreement`?u?.id??null:null),g=rt(f===`skills`?u?.id??null:null);if(o.isLoading)return(0,B.jsx)(`main`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:L(`projectsLoading`)});if(o.isError)return(0,B.jsxs)(`main`,{className:`p-6 text-sm text-destructive`,children:[L(`projectsLoadFailed`),`: `,o.error.message]});if(!l.length)return(0,B.jsx)(`main`,{className:`p-6 text-sm text-muted-foreground`,children:L(`projectsEmpty`)});if(!u||!f)return(0,B.jsxs)(`main`,{className:`space-y-3 p-4 text-sm text-muted-foreground sm:p-6`,children:[(0,B.jsx)(`label`,{htmlFor:`project-home-selection`,className:`block font-medium text-foreground`,children:L(`projectsChoose`)}),(0,B.jsxs)(`select`,{id:`project-home-selection`,value:``,onChange:e=>n(`/projects/${encodeURIComponent(e.target.value)}/overview`,{state:r}),className:`min-h-11 w-full rounded-xl border border-border bg-card px-3 text-base text-foreground`,children:[(0,B.jsx)(`option`,{value:``,disabled:!0,children:L(`projectsChoose`)}),l.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]});let _=(e,t)=>i.chatThreadManager.openFilePreview({path:e,label:t,viewMode:`preview`,previewViewer:`rendered`});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`main`,{className:`h-full min-w-0 flex-1 overflow-y-auto p-3 sm:p-4 md:p-6`,children:(0,B.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-4`,children:[(0,B.jsxs)(`header`,{className:`rounded-2xl border border-border/60 bg-card p-3 sm:p-4`,children:[(0,B.jsx)(`h1`,{className:`text-lg font-semibold`,children:u.name}),(0,B.jsx)(`p`,{className:`mt-1 break-all text-xs text-muted-foreground`,children:u.rootPath})]}),(0,B.jsxs)(ue,{value:f,onValueChange:e=>n(`/projects/${encodeURIComponent(u.id)}/${e}`,{state:r}),children:[(0,B.jsx)(`div`,{className:`min-w-0 overflow-x-auto pb-1`,children:(0,B.jsx)(le,{className:`w-max`,children:at.map(e=>(0,B.jsx)(ce,{value:e,children:L(`projects${e[0].toUpperCase()}${e.slice(1)}`)},e))})}),(0,B.jsx)(P,{value:`overview`,className:`mt-4`,children:(0,B.jsx)(Ue,{projectId:u.id,onOpenArtifact:(e,t)=>_(Q(u.rootPath,e),t),onOpenWorkItem:c})}),(0,B.jsx)(P,{value:`work`,className:`mt-4`,children:(0,B.jsx)($e,{projectId:u.id,onOpenWorkItem:c})}),(0,B.jsx)(P,{value:`artifacts`,className:`mt-4`,children:(0,B.jsx)(Ve,{projectId:u.id,onOpenFile:(e,t)=>_(Q(u.rootPath,e),t)})}),(0,B.jsx)(P,{value:`skills`,className:`mt-4`,children:(0,B.jsx)(We,{skills:g.data??[],isLoading:g.isLoading,isError:g.isError,onOpen:e=>_(Q(u.rootPath,e.path),e.name)})}),(0,B.jsx)(P,{value:`agreement`,className:`mt-4`,children:(0,B.jsx)(ke,{agreement:h.data,isLoading:h.isLoading,isError:h.isError,onOpenFile:(e,t)=>_(Q(u.rootPath,e),t)})})]})]})}),(0,B.jsx)(Ge,{projectId:u.id,projectRoot:u.rootPath,workItemId:s,onOpenChange:e=>{e||c(null)},onOpenArtifact:_}),(0,B.jsx)(v,{layoutMode:a?`mobile`:`desktop`,sessionKey:null,projectRoot:u.rootPath})]})}export{ot as ProjectsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,cr as n,yr as r}from"./api-
|
|
1
|
+
import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,cr as n,yr as r}from"./api-DjiZvIa0.js";import{c as i,l as a,o,r as s,s as c,u as l}from"./context-menu-BsCj2fRs.js";var u=e(r(),1),d=n(),f=`2rem`;function p(e){return`min(${e}, max(0px, calc(var(--radix-popover-content-available-height, 100vh) - ${f})))`}var m=p(`24rem`),h=a,g=l,_=o,v=u.forwardRef(({className:e,variant:n=`default`,sideOffset:r=8,align:a=`start`,collisionPadding:o=12,style:l,...u},f)=>(0,d.jsx)(i,{children:(0,d.jsx)(c,{ref:f,"data-theme-overlay":n===`menu`?`menu`:`popover`,sideOffset:r,align:a,collisionPadding:o,className:t(`z-[var(--z-popover,10100)] w-72 overflow-x-hidden overflow-y-auto rounded-xl border border-border/40 bg-popover p-4 text-popover-foreground shadow-floating animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e,n===`menu`&&`w-max min-w-52 max-w-[min(18rem,calc(100vw-16px))] overflow-y-auto rounded-xl border border-border/40 bg-popover p-1 text-popover-foreground shadow-floating outline-none`),style:{maxHeight:m,...l},...u,onEscapeKeyDown:e=>{s(e)||u.onEscapeKeyDown?.(e)}})}));v.displayName=c.displayName;var y=[`off`,`minimal`,`low`,`medium`,`high`,`adaptive`,`xhigh`],b=new Set(y);function x(e){if(!e||e.length===0)return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function S(e,t){let n=e.trim(),r=t.trim();if(!n||!r)return n;let i=`${r}/`;return n.startsWith(i)?n.slice(i.length):n}function C(e,t){let n=e.trim();if(!n)return``;for(let e of t)n=S(n,e);return n.trim()}function w(e,t){let n=t.trim(),r=e.trim();return n?r?`${r}/${n}`:n:``}function T(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t&&b.has(t)?t:null}function E(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=T(n);!e||t.includes(e)||t.push(e)}return t}function D(e){return e.includes(`off`)?[...e]:[`off`,...e]}function O(e,t){if(!e)return{};let n={};for(let[r,i]of Object.entries(e)){let e=C(r,t);if(!e)continue;let a={},o=E(i?.thinking?.supported);if(o.length>0){let e=T(i?.thinking?.default);a.thinking=e&&o.includes(e)?{supported:o,default:e}:{supported:o}}i?.vision===!0&&(a.vision=!0),(a.thinking||a.vision===!0)&&(n[e]=a)}return n}function k(e){return Object.fromEntries(Object.entries(e).filter(e=>!!e[1].thinking).map(([e,t])=>[e,t.thinking]))}function A(e,t,n){let r=C(t,n);return r?e[r]??null:null}function j(e,t){let n=e.trim();if(!n)return null;let r=null;for(let e of t)for(let t of e.aliases){let i=t.trim();i&&(n===i||n.startsWith(`${i}/`))&&(!r||i.length>r.score)&&(r={name:e.name,score:i.length})}if(r)return r.name;for(let e of t){let t=C(n,e.aliases);if(t&&x(e.models??[]).some(e=>e===t))return e.name}return null}function M(e){return e?e.enabled!==!1&&(e.apiKeyRequired===!1||e.apiKeySet===!0):!1}function N(e){let{providersView:t,templatesView:n,config:r,onlyConfigured:i=!1}=e,a=new Map((n?.providerTemplates??[]).map(e=>[e.providerType,e])),o=Object.values(t?.providers??r?.providers??{}).map(e=>{let{providerId:t}=e,n=e.providerType?a.get(e.providerType):void 0,r=t.trim(),i=x([t,n?.modelPrefix||``,n?.providerType||``]),o=x((e?.models??[]).map(e=>C(e,i))),s={...O(n?.modelConfig,i),...O(e?.modelConfig,i)},c=k(s),l=e?.displayName?.trim(),u=M(e);return{name:t,displayName:l||n?.displayName||t,prefix:r,aliases:i,models:o,modelConfig:s,modelThinking:c,configured:u}});return i?o.filter(e=>e.configured&&e.models.length>0):o}export{p as _,M as a,E as c,D as d,C as f,g,v as h,j as i,T as l,_ as m,N as n,O as o,h as p,w as r,x as s,y as t,A as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DF37yw5_.js";import{Gt as t,_n as n,cr as r,yr as i}from"./api-
|
|
1
|
+
import{i as e}from"./chunk-DF37yw5_.js";import{Gt as t,_n as n,cr as r,yr as i}from"./api-DjiZvIa0.js";import{t as a}from"./createLucideIcon-Cfo2ySi5.js";import{T as o,a as s,i as c,n as l,r as u,t as d}from"./select-CWyjnar7.js";import{s as f}from"./i18n-Bm3Ov7Fy.js";import{_ as p,f as m,h,i as g,m as _,p as v,r as y}from"./provider-models-Dm-pmWAA.js";var b=a(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),x=e(i(),1),S=r(),C=p(`15rem`);function w(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function T({id:e,value:r,onChange:i,options:a,disabled:s=!1,placeholder:c,className:l,inputClassName:u,emptyText:d,createText:f,toggleLabel:p,maxItems:m=1/0,onEnter:g}){let[y,T]=(0,x.useState)(!1),E=(0,x.useRef)(null);(0,x.useEffect)(()=>{s&&y&&T(!1)},[s,y]);let D=(0,x.useMemo)(()=>w(a),[a]),O=r.trim().toLowerCase(),k=(0,x.useMemo)(()=>{let e=D.map((e,t)=>({option:e,index:t}));O.length>0&&e.sort((e,t)=>{let n=e.option.toLowerCase(),r=t.option.toLowerCase(),i=n===O?0:n.startsWith(O)?1:n.includes(O)?2:3,a=r===O?0:r.startsWith(O)?1:r.includes(O)?2:3;return i===a?e.index-t.index:i-a});let t=e.map(e=>e.option);return Number.isFinite(m)?t.slice(0,Math.max(1,m)):t},[D,O,m]),A=r.trim().length>0&&D.some(e=>e===r.trim()),j=()=>T(!1);return(0,S.jsxs)(v,{open:y&&!s,onOpenChange:e=>T(!s&&e),children:[(0,S.jsx)(_,{asChild:!0,children:(0,S.jsxs)(`div`,{ref:E,className:n(`relative`,l),children:[(0,S.jsx)(t,{id:e,value:r,disabled:s,onFocus:()=>{s||T(!0)},onChange:e=>{i(e.target.value),!y&&!s&&T(!0)},onKeyDown:e=>{e.key===`Enter`&&(g&&(e.preventDefault(),g()),j())},placeholder:c,className:n(`pr-10`,u)}),(0,S.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>T(e=>!e),disabled:s,className:n(`absolute inset-y-0 right-0 inline-flex w-10 items-center justify-center`,s?`cursor-not-allowed text-gray-300`:`text-gray-400 hover:text-gray-600`),"aria-label":p,children:(0,S.jsx)(b,{className:`h-4 w-4`})})]})}),(0,S.jsx)(h,{align:`start`,className:`flex w-[var(--radix-popover-trigger-width)] min-w-[12rem] flex-col overflow-hidden rounded-xl border border-gray-200 p-0 shadow-lg`,onInteractOutside:e=>{e.target instanceof Node&&E.current?.contains(e.target)&&e.preventDefault()},onOpenAutoFocus:e=>e.preventDefault(),style:{maxHeight:C},children:(0,S.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto py-1`,children:[!A&&r.trim().length>0&&(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{i(r.trim()),j()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[var(--interaction-hover)]`,children:[(0,S.jsx)(o,{className:`h-4 w-4 text-transparent`}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:f.replace(`{value}`,r.trim())})]}),k.map(e=>(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{i(e),j()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[var(--interaction-hover)]`,children:[(0,S.jsx)(o,{className:n(`h-4 w-4`,e===r.trim()?`text-primary`:`text-transparent`)}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:e})]},e)),k.length===0&&r.trim().length===0&&(0,S.jsx)(`div`,{className:`px-3 py-2 text-sm text-gray-500`,children:d})]})})]})}var E=`provider/model`;function D(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function O({id:e,value:n,onChange:r,providerCatalog:i,disabled:a=!1,providerPlaceholder:o,modelPlaceholder:p,className:h}){let[_,v]=(0,x.useState)(``),[b,C]=(0,x.useState)(``),w=i.length>0,O=p??E,k=(0,x.useMemo)(()=>new Map(i.map(e=>[e.name,e])),[i]),A=k.get(_),j=(0,x.useMemo)(()=>A?.aliases??[],[A]),M=(0,x.useMemo)(()=>D(A?.models??[]),[A]);return(0,x.useEffect)(()=>{let e=n.trim();if(!w){v(``),C(e);return}if(!e){C(``),v(e=>k.has(e)?e:``);return}let t=g(e,i)??``,r=k.get(t)?.aliases??[];v(t),C(t?m(e,r):e)},[w,i,k,n]),w?(0,S.jsxs)(`div`,{className:h,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,S.jsx)(`div`,{className:`sm:w-[38%] sm:min-w-[170px]`,children:(0,S.jsxs)(d,{value:_,onValueChange:e=>{let t=D(k.get(e)?.models??[])[0]??``;if(v(e),C(t),!t){r(``);return}r(y(k.get(e)?.prefix??e,t))},disabled:a,children:[(0,S.jsx)(c,{className:`h-10 w-full rounded-xl`,children:(0,S.jsx)(s,{placeholder:o??f(`providersSelectPlaceholder`)})}),(0,S.jsx)(l,{children:i.map(e=>(0,S.jsx)(u,{value:e.name,children:e.displayName},e.name))})]})}),(0,S.jsx)(`span`,{className:`hidden h-10 items-center justify-center leading-none text-lg font-semibold text-gray-300 sm:inline-flex`,children:`/`}),(0,S.jsx)(T,{id:e,value:b,onChange:e=>{if(!A){let t=e.trim();C(t),r(t);return}let t=m(e,j);C(t),r(t?y(A.prefix,t):``)},options:M,disabled:a||!_,placeholder:O,className:`sm:flex-1`,inputClassName:`h-10 rounded-xl`,emptyText:f(`modelPickerNoOptions`),createText:f(`modelPickerUseCustom`),toggleLabel:f(`modelPickerToggleOptions`)},_)]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:f(`modelInputCustomHint`)})]}):(0,S.jsxs)(`div`,{className:h,children:[(0,S.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 px-4 py-3`,children:[(0,S.jsx)(`p`,{className:`text-sm font-semibold text-amber-950`,children:f(`providersEmptyTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-amber-900`,children:f(`providersEmptyDescription`)})]}),(0,S.jsx)(t,{id:e,value:n,disabled:a,onChange:e=>r(e.target.value),placeholder:O,className:`mt-3 h-10 rounded-xl`}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:f(`modelInputCustomHint`)})]})}export{O as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DF37yw5_.js";import{Gt as t,Jn as n,Qt as r,Ut as i,Wt as a,Yt as o,_n as s,cr as c,gn as l,sr as u,yr as d}from"./api-BZvNpFOS.js";import{t as f}from"./createLucideIcon-DE0sB9Nu.js";import{a as p,i as m,t as h}from"./use-viewport-layout-vmbQUNT6.js";import{a as g,i as _,n as v,r as y,t as b,w as x}from"./select-Y9IEbx9x.js";import{m as S}from"./context-menu-DHVVdHzN.js";import{i as C,n as w,r as T,t as E}from"./confirm-dialog-8vqYZ0wy.js";import{t as D}from"./eye-bKzylu3p.js";import{t as O}from"./loader-circle-Clq1Gtb1.js";import{n as k,t as A}from"./trash-2-DER2EJKK.js";import{t as j}from"./refresh-cw-BG8VfcdA.js";import{t as M}from"./settings-2-CrGx9_De.js";import{t as N}from"./x-DSz9cGhy.js";import{l as P,s as F}from"./i18n-OGmF0Ws_.js";import{a as I,c as L,g as R,h as z,l as B,o as V,p as H,t as ee}from"./provider-models-DFQgF4hS.js";import{n as U,t as W}from"./status-dot-Cb8ewlUr.js";import{t as te}from"./host-capabilities-DuIFVsvM.js";import{a as ne,c as G,d as K,f as q,h as re,i as ie,l as ae,m as oe,o as se,p as ce,r as le,y as ue}from"./use-config-BM5jC65L.js";import{t as de}from"./form-actions-CCoxz33Q.js";import{t as J}from"./config-hints-DbmiyTKg.js";import{a as fe,c as pe,i as me,l as he,n as ge,o as _e,r as ve,s as ye}from"./config-split-page-BA3V6b3Q.js";var be=f(`CircleDotDashed`,[[`path`,{d:`M10.1 2.18a9.93 9.93 0 0 1 3.8 0`,key:`1qdqn0`}],[`path`,{d:`M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7`,key:`1bq7p6`}],[`path`,{d:`M21.82 10.1a9.93 9.93 0 0 1 0 3.8`,key:`1rlaqf`}],[`path`,{d:`M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69`,key:`1xk03u`}],[`path`,{d:`M13.9 21.82a9.94 9.94 0 0 1-3.8 0`,key:`l7re25`}],[`path`,{d:`M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7`,key:`1v18p6`}],[`path`,{d:`M2.18 13.9a9.93 9.93 0 0 1 0-3.8`,key:`xdo6bj`}],[`path`,{d:`M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69`,key:`1jjmaz`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),xe=f(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Y=e(d(),1),Se={providerId:``,providerType:null,isBuiltInType:!1,isCustom:!0,enabled:!0,displayName:``,apiKeySet:!1,apiKeyMasked:void 0,apiBase:null,extraHeaders:null,wireApi:null,models:[],modelConfig:{}};function X(e){if(!e)return null;let t=Object.entries(e).map(([e,t])=>[e.trim(),t]).filter(([e])=>e.length>0);return t.length===0?null:Object.fromEntries(t)}function Ce(e,t){let n=X(e),r=X(t);if(n===null&&r===null)return!0;if(!n||!r)return!1;let i=Object.entries(n).sort(([e],[t])=>e.localeCompare(t)),a=Object.entries(r).sort(([e],[t])=>e.localeCompare(t));return i.length===a.length?i.every(([e,t],n)=>e===a[n][0]&&t===a[n][1]):!1}function Z(e){if(!e||e.length===0)return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function we(e,t){let n=e.trim();if(!n||!t.trim())return n;let r=`${t.trim()}/`;return n.startsWith(r)?n.slice(r.length):n}function Q(e,t){let n=e.trim();if(!n)return``;for(let e of t){let t=e.trim();t&&(n=we(n,t))}return n.trim()}function Te(e,t){return e.length===t.length?e.every((e,n)=>e===t[n]):!1}function Ee(e,t){return Z(t)}function De(e,t){return Z(e).map(e=>{let n=e.trim();return!n||n.startsWith(`${t}/`)?n:`${t}/${n}`})}function Oe(e,t){let n=new Set(t.map(e=>e.trim()).filter(Boolean)),r={};for(let[t,i]of Object.entries(e)){if(!n.has(t))continue;let e={},a=L(i.thinking?.supported);if(a.length>0){let t=B(i.thinking?.default);e.thinking=t&&a.includes(t)?{supported:a,default:t}:{supported:a}}i.vision===!0&&(e.vision=!0),(e.thinking||e.vision===!0)&&(r[t]=e)}return r}function ke(e,t,n){return{...V(e,n),...V(t,n)}}function Ae(e,t){let n=Object.keys(e).sort(),r=Object.keys(t).sort();if(n.length!==r.length)return!1;for(let i=0;i<n.length;i+=1){let a=n[i];if(a!==r[i])return!1;let o=e[a],s=t[a];if(!o||!s||!Te([...o.thinking?.supported??[]].sort(),[...s.thinking?.supported??[]].sort())||(o.thinking?.default??null)!==(s.thinking?.default??null)||(o.vision??!1)!==(s.vision??!1))return!1}return!0}function je(e){return e.providerName?e.apiKey.trim().length>0||e.apiBase.trim()!==e.currentApiBase.trim()||!Ce(e.extraHeaders,e.currentHeaders)||e.supportsWireApi&&e.wireApi!==e.currentWireApi||!Te(e.models,e.currentEditableModels)||!Ae(e.modelConfig,e.currentModelConfig)||e.providerDisplayName.trim()!==e.effectiveDisplayName:!1}function Me(e){let t={},n=e.apiKey.trim(),r=e.apiBase.trim(),i=X(e.extraHeaders),a=e.providerDisplayName.trim();return a!==e.effectiveDisplayName&&(t.displayName=a.length>0?a:null),n.length>0&&(t.apiKey=n),r!==e.currentApiBase.trim()&&(t.apiBase=r.length>0&&r!==e.defaultApiBase?r:null),Ce(i,e.currentHeaders)||(t.extraHeaders=i),e.supportsWireApi&&e.wireApi!==e.currentWireApi&&(t.wireApi=e.wireApi),Te(e.models,e.currentEditableModels)||(t.models=De(e.models,e.providerName??``)),Ae(e.modelConfig,e.currentModelConfig)||(t.modelConfig=Oe(e.modelConfig,e.models)),t}function Ne(e){let t=Q(e.models.find(e=>e.trim().length>0)??``,e.providerModelAliases),n={...Pe(e),model:t||null};return e.supportsWireApi&&(n.wireApi=e.wireApi),n}function Pe(e){let t={apiBase:e.apiBase.trim(),extraHeaders:X(e.extraHeaders)};return e.apiKey.trim().length>0&&(t.apiKey=e.apiKey.trim()),t}function Fe(e){return F(e===`off`?`chatThinkingLevelOff`:e===`minimal`?`chatThinkingLevelMinimal`:e===`low`?`chatThinkingLevelLow`:e===`medium`?`chatThinkingLevelMedium`:e===`high`?`chatThinkingLevelHigh`:e===`adaptive`?`chatThinkingLevelAdaptive`:`chatThinkingLevelXhigh`)}function Ie(e){let{providerName:t,methods:n,defaultMethodId:r,language:i}=e;if(n.length===0)return``;let a=new Map;for(let e of n){let t=e.id.trim();t&&a.set(t.toLowerCase(),t)}let o=(...e)=>{for(let t of e){let e=a.get(t.toLowerCase());if(e)return e}},s=r?.trim();if(t===`minimax-portal`){if(i===`zh`)return o(`cn`,`china-mainland`)??o(s??``)??n[0]?.id??``;if(i===`en`)return o(`global`,`intl`,`international`)??o(s??``)??n[0]?.id??``}if(s){let e=o(s);if(e)return e}return i===`zh`?o(`cn`)??n[0]?.id??``:i===`en`?o(`global`)??n[0]?.id??``:n[0]?.id??``}function Le(e){let{required:t,hasDefault:n,optionCount:r}=e;return t&&n&&r>1&&r<=3}function Re(e,t,n){let r=Q(t,n);return r?e.includes(r)?{models:e,draft:``}:{models:[...e,r],draft:``}:{models:e,draft:t}}function ze(e,t,n){let r=[...e],i=new Set(e);for(let e of t){let t=Q(e,n);t&&!i.has(t)&&(i.add(t),r.push(t))}return{models:r,addedCount:r.length-e.length}}function Be(e,t,n){return ze(e,t,n).models.slice(e.length)}function Ve(e,t,n){let r={...t};return delete r[n],{models:e.filter(e=>e!==n),modelConfig:r}}function He(e,t,n){let r=e[t],i=r?.thinking?.supported??[],a=i.includes(n)?i.filter(e=>e!==n):ee.filter(e=>e===n||i.includes(e)),o=r?.thinking?.default&&a.includes(r.thinking.default)?r.thinking.default:void 0,s={...r,thinking:a.length>0?o?{supported:a,default:o}:{supported:a}:void 0},c={...e};return s.thinking||s.vision===!0?c[t]=s:delete c[t],c}function Ue(e,t,n){let r=e[t],i=r?.thinking;return!i||i.supported.length===0||n&&!i.supported.includes(n)?e:{...e,[t]:{...r,thinking:n?{supported:i.supported,default:n}:{supported:i.supported}}}}function We(e,t,n){let r={...e[t],vision:n?!0:void 0},i={...e};return r.thinking||r.vision===!0?i[t]=r:delete i[t],i}function Ge(e){let{providerName:t,providerSpec:n,language:r}=e,i=n?.auth,a=i?.methods??[];return{providerAuth:i,providerAuthMethodOptions:a.map(e=>({value:e.id,label:e.label?.[r]||e.label?.en||e.id})),providerAuthMethods:a,preferredAuthMethodId:Ie({providerName:n?.providerType??t,methods:a,defaultMethodId:i?.defaultMethodId,language:r}),shouldUseAuthMethodPills:Le({required:i?.kind===`device_code`,hasDefault:!!i?.defaultMethodId?.trim(),optionCount:a.length})}}function Ke(e,t){let n=!!e?.supportsWireApi||t,r=(e?.wireApiOptions||[`auto`,`chat`,`responses`]).map(e=>({value:e,label:F(e===`chat`?`wireApiChat`:e===`responses`?`wireApiResponses`:`wireApiAuto`)}));return{shouldUseWireApiPills:Le({required:n,hasDefault:typeof e?.defaultWireApi==`string`&&e.defaultWireApi.length>0,optionCount:r.length}),supportsWireApi:n,wireApiSelectOptions:r}}function qe(e){let{providerName:t,providersView:n,templatesView:r,schema:i,language:a}=e,o=t?n?.providers[t]:null,s=r?.providerTemplates.find(e=>e.providerType===o?.providerType),c=o??Se,l=i?.uiHints,u=!!o?.isCustom,d=t?J(`providers.${t}.apiKey`,l):void 0,f=t?J(`providers.${t}.apiBase`,l):void 0,p=t?J(`providers.${t}.extraHeaders`,l):void 0,m=t?J(`providers.${t}.wireApi`,l):void 0,h=s?.displayName||o?.displayName||t||``,g=(c.displayName||``).trim()||h,_=c.enabled!==!1,v=u||s?.supportsModelDiscovery===!0,y=Z([s?.modelPrefix||s?.providerType||``,t||``]),b=s?.defaultApiBase||``,x=c.apiBase||b,S=X(c.extraHeaders||null),C=c.wireApi||s?.defaultWireApi||`auto`,w=Ee(Z((s?.defaultModels??[]).map(e=>Q(e,y))),Z((c.models??[]).map(e=>Q(e,y)))),T=Oe(ke(s?.modelConfig,c.modelConfig,y),w),E=s?.apiBaseHelp?.[a]||s?.apiBaseHelp?.en||f?.help||F(`providerApiBaseHelp`),D=Ge({providerName:t,providerSpec:s,language:a}),O=Ke(s,u);return{apiBaseHelpText:E,apiBaseHint:f,apiKeyHint:d,currentApiBase:x,currentEditableModels:w,currentEnabled:_,currentHeaders:S,currentModelConfig:T,currentWireApi:C,defaultApiBase:b,defaultDisplayName:h,effectiveDisplayName:g,extraHeadersHint:p,...D,providerConfig:o,providerModelAliases:y,resolvedProviderConfig:c,supportsModelDiscovery:v,wireApiHint:m,...O}}function Je(e){let{providerName:t,providerAuth:r,resolvedAuthMethodId:i}=e,a=u(),o=oe(),s=ae(),c=G(),[l,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(``),g=(0,Y.useRef)(null),_=(0,Y.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),v=(0,Y.useCallback)((e,r)=>{_(),g.current=window.setTimeout(()=>{(async()=>{if(t)try{let i=await s.mutateAsync({provider:t,data:{sessionId:e}});if(i.status===`pending`){h(F(`providerAuthWaitingBrowser`)),v(e,i.nextPollMs??r);return}if(i.status===`authorized`){p(null),_(),h(F(`providerAuthCompleted`)),n.success(F(`providerAuthCompleted`)),a.invalidateQueries({queryKey:[`config`]}),a.invalidateQueries({queryKey:[`providers`]});return}p(null),_(),h(i.message||`Authorization ${i.status}.`),n.error(i.message||`Authorization ${i.status}.`)}catch(e){p(null),_();let t=e instanceof Error?e.message:String(e);h(t),n.error(`Authorization failed: ${t}`)}})()},Math.max(1e3,r))},[_,s,t,a]),y=(0,Y.useCallback)(async()=>{if(!(!t||r?.kind!==`device_code`))try{d(t),h(``);let e=await o.mutateAsync({provider:t,data:i?{methodId:i}:{}});if(!e.sessionId||!e.verificationUri)throw Error(F(`providerAuthStartFailed`));p(e.sessionId),h(`${F(`providerAuthOpenPrompt`)}${e.userCode}${F(`providerAuthOpenPromptSuffix`)}`),await te.openExternalUrl(e.verificationUri),v(e.sessionId,e.intervalMs)}catch(e){let t=e instanceof Error?e.message:String(e);p(null),_(),h(t),n.error(`${F(`providerAuthStartFailed`)}: ${t}`)}},[_,r?.kind,t,i,v,o]),b=(0,Y.useCallback)(async()=>{if(!(!t||r?.kind!==`device_code`))try{d(t),_(),p(null);let e=await c.mutateAsync({provider:t});h(`${F(`providerAuthImportStatusPrefix`)}${e.expiresAt?` (expires: ${e.expiresAt})`:``}`),n.success(F(`providerAuthImportSuccess`)),a.invalidateQueries({queryKey:[`config`]}),a.invalidateQueries({queryKey:[`providers`]})}catch(e){let t=e instanceof Error?e.message:String(e);h(t),n.error(`${F(`providerAuthImportFailed`)}: ${t}`)}},[_,c,r?.kind,t,a]);return(0,Y.useEffect)(()=>{_()},[_,t]),(0,Y.useEffect)(()=>()=>_(),[_]),{authSessionId:l===t?f:null,authStatusMessage:l===t?m:``,importAuthFromCli:b,importPending:c.isPending,startAuth:y,startPending:o.isPending}}function Ye(e){let{providerName:t,apiKey:r,apiKeyRequired:i,apiKeySet:a,apiBase:o,extraHeaders:s,supportsWireApi:c,wireApi:u,models:d,providerModelAliases:f}=e,p=re(),m=se(),h=(0,Y.useMemo)(()=>JSON.stringify({providerName:t,apiKey:r,apiBase:o,extraHeaders:s}),[o,r,s,t]),[g,_]=(0,Y.useState)(null),v=(0,Y.useCallback)(async()=>{if(t)try{let e=await p.mutateAsync({provider:t,data:Ne({apiKey:r,apiBase:o,extraHeaders:s,supportsWireApi:c,wireApi:u,models:d,providerModelAliases:f})});if(e.success){n.success(`${F(`providerTestConnectionSuccess`)} (${e.latencyMs}ms)`);return}let i=[`provider=${e.provider}`,`latency=${e.latencyMs}ms`];e.model&&i.push(`model=${e.model}`),n.error(`${F(`providerTestConnectionFailed`)}: ${e.message} | ${i.join(` | `)}`)}catch(e){let t=e instanceof Error?e.message:String(e);n.error(`${F(`providerTestConnectionFailed`)}: ${t}`)}},[o,r,s,d,f,t,c,p,u]);return{discoverModels:(0,Y.useCallback)(async()=>{if(!t)return null;if(i&&!r.trim()&&!a)return n.error(F(`providerModelsApiKeyRequired`)),null;try{let e=await m.mutateAsync({provider:t,data:Pe({apiKey:r,apiBase:o,extraHeaders:s})});return _({key:h,models:e.models}),n.success(F(`providerModelsFetchSuccess`)),e.models}catch(e){if(e instanceof l&&(e.details?.upstreamStatus===401||e.details?.upstreamStatus===403))return n.error(F(`providerModelsAuthorizationFailed`)),null;let t=e instanceof Error?e.message:String(e);return n.error(`${F(`providerModelsFetchFailed`)}: ${t}`),null}},[o,r,i,a,m,h,s,t]),fetchedModels:g?.key===h?g.models:[],isDiscoveringModels:m.isPending,isTestPending:p.isPending,testConnection:v}}var $=c();function Xe({value:e,onChange:n,className:r}){let i=e?Object.entries(e):[],a=(e,t,r)=>{let a=[...i];a[e]=[t,r],n(Object.fromEntries(a))},c=()=>{n({...e,"":``})},l=e=>{let t=i.filter((t,n)=>n!==e);n(Object.fromEntries(t))};return(0,$.jsxs)(`div`,{className:s(`space-y-2`,r),children:[i.map(([e,n],r)=>(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(t,{type:`text`,value:e,onChange:e=>a(r,e.target.value,n),placeholder:F(`headerName`),className:`flex-1`}),(0,$.jsx)(t,{type:`text`,value:n,onChange:t=>a(r,e,t.target.value),placeholder:F(`headerValue`),className:`flex-1`}),(0,$.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>l(r),children:(0,$.jsx)(A,{className:`h-4 w-4 text-red-500`})})]},r)),(0,$.jsxs)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:c,children:[(0,$.jsx)(k,{className:`h-4 w-4 mr-2`}),F(`add`)]})]})}function Ze(e){let{value:t,onChange:n,options:r}=e;return(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let r=e.value===t;return(0,$.jsx)(`button`,{type:`button`,onClick:()=>n(e.value),"aria-pressed":r,className:`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors ${r?`border-[var(--interaction-selection-border)] bg-[var(--interaction-selection)] text-foreground`:`border-border/55 bg-muted/50 text-muted-foreground hover:border-border hover:bg-[var(--interaction-hover)] hover:text-foreground`}`,children:e.label},e.value)})})}function Qe(e){let{showAdvanced:t,onShowAdvancedChange:n,supportsWireApi:r,wireApiLabel:i,wireApi:o,onWireApiChange:s,shouldUseWireApiPills:c,wireApiSelectOptions:l,extraHeadersLabel:u,extraHeaders:d,onExtraHeadersChange:f}=e;return(0,$.jsxs)(`div`,{className:`border-t border-border/70 pt-4`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex w-full items-center justify-between text-sm text-muted-foreground transition-colors hover:text-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(M,{className:`h-3.5 w-3.5`}),F(`providerAdvancedSettings`)]}),(0,$.jsx)(x,{className:`h-4 w-4 transition-transform ${t?`rotate-180`:``}`})]}),t?(0,$.jsxs)(`div`,{className:`mt-4 space-y-5`,children:[r?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(a,{htmlFor:`wireApi`,className:`text-sm font-medium text-foreground`,children:i}),c?(0,$.jsx)(Ze,{value:o,onChange:e=>s(e),options:l}):(0,$.jsxs)(b,{value:o,onValueChange:e=>s(e),children:[(0,$.jsx)(_,{className:`rounded-xl`,children:(0,$.jsx)(g,{})}),(0,$.jsx)(v,{children:l.map(e=>(0,$.jsx)(y,{value:e.value,children:e.label},e.value))})]})]}):null,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(a,{className:`text-sm font-medium text-foreground`,children:u}),(0,$.jsx)(Xe,{value:d,onChange:f}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`providerExtraHeadersHelpShort`)})]})]}):null]})}function $e({isSet:e,className:n,value:r,onChange:i,placeholder:a,...c}){let[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),p=typeof r==`string`&&r.length>0;return(0,$.jsxs)(`div`,{className:`relative`,children:[e&&!p&&!d?(0,$.jsx)(`div`,{onClick:()=>f(!0),className:s(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-500 cursor-text items-center pr-12`,n),children:`••••••••••••`}):(0,$.jsx)(t,{type:l?`text`:`password`,className:s(`pr-12`,n),value:r,onChange:i,onBlur:()=>{p||f(!1)},placeholder:a,autoFocus:d,...c}),(0,$.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex gap-1`,children:(e||p)&&(0,$.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>u(!l),children:l?(0,$.jsx)(xe,{className:`h-4 w-4`}):(0,$.jsx)(D,{className:`h-4 w-4`})})})]})}function et(e){let{apiKey:t,apiKeyRequired:n,apiKeySet:r,apiKeyPlaceholder:i,providerAuth:s,providerAuthNote:c,providerAuthMethodOptions:l,providerAuthMethodsCount:u,selectedAuthMethodHint:d,shouldUseAuthMethodPills:f,resolvedAuthMethodId:p,onAuthMethodChange:m,onStartProviderAuth:h,onImportProviderAuthFromCli:x,startPending:S,importPending:C,authSessionId:w,authStatusMessage:T,onApiKeyChange:E}=e,D=n?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(a,{htmlFor:`apiKey`,className:`text-sm font-medium text-foreground`,children:F(`apiKey`)}),(0,$.jsx)($e,{id:`apiKey`,value:t,isSet:r,onChange:e=>E(e.target.value),placeholder:i,className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`leaveBlankToKeepUnchanged`)})]}):null;return s?.kind===`device_code`?(0,$.jsxs)($.Fragment,{children:[D,(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-muted/45 p-3`,children:[(0,$.jsx)(a,{className:`text-sm font-medium text-foreground`,children:s.displayName||F(`providerAuthSectionTitle`)}),c?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}):null,u>1?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(a,{className:`text-xs font-medium text-foreground`,children:F(`providerAuthMethodLabel`)}),f?(0,$.jsx)(Ze,{value:p,onChange:m,options:l}):(0,$.jsxs)(b,{value:p,onValueChange:m,children:[(0,$.jsx)(_,{className:`h-8 rounded-lg`,children:(0,$.jsx)(g,{placeholder:F(`providerAuthMethodPlaceholder`)})}),(0,$.jsx)(v,{children:l.map(e=>(0,$.jsx)(y,{value:e.value,children:e.label},e.value))})]}),d?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d}):null]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:h,disabled:S||!!w,children:F(S?`providerAuthStarting`:w?`providerAuthAuthorizing`:`providerAuthAuthorizeInBrowser`)}),s.supportsCliImport?(0,$.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:x,disabled:C,children:F(C?`providerAuthImporting`:`providerAuthImportFromCli`)}):null,w?(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[F(`providerAuthSessionLabel`),`: `,w.slice(0,8),`…`]}):null]}),T?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:T}):null]})]}):D}function tt(e){let{providerName:t,models:n,aliases:r,fetchedModels:i=[],onModelsChange:a}=e,o=K({pollWhileRefreshing:!0,refreshOnMount:!0}),s=t?o.data?.providers[t]:void 0,c=i.length>0?`fetched`:`background`,l=(0,Y.useMemo)(()=>Be(n,c===`fetched`?i:s?.models??[],r),[r,s?.models,i,n,c]);return{addSuggestedModels:(0,Y.useCallback)(e=>{let t=ze(n,e,r);t.addedCount>0&&a(t.models)},[r,n,a]),hasSuggestionError:!!(s?.lastError&&!s.fetchedAt),isCheckingSuggestions:!!(t&&(o.isLoading||o.data?.refreshing&&!s)),suggestedModels:l,suggestionSource:c}}function nt(e){let{models:t,modelConfig:n,onModelsChange:r,onRemoveModel:o,onToggleModelThinkingLevel:s,onSetModelThinkingDefault:c,onSetModelVision:l,thinkingLevels:u,formatThinkingLevelLabel:d}=e,[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(()=>new Set),x=(0,Y.useMemo)(()=>t.filter(e=>m.has(e)),[t,m]),S=e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},C=()=>{p(!1),h(new Set)};return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`flex min-h-7 flex-wrap items-center justify-end gap-2`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mr-auto text-xs text-muted-foreground`,children:F(`providerModelsSuggestionsSelected`).replace(`{count}`,String(x.length))}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-primary hover:text-primary/80`,onClick:()=>h(x.length===t.length?new Set:new Set(t)),children:F(x.length===t.length?`providerModelsClearSelection`:`providerModelsSelectAll`)}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-muted-foreground hover:text-foreground`,onClick:C,children:F(`cancel`)}),(0,$.jsxs)(`button`,{type:`button`,disabled:x.length===0,className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/15 disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>{x.length!==0&&(r(t.filter(e=>!m.has(e))),C())},children:[(0,$.jsx)(A,{className:`h-3 w-3`}),F(`providerModelsRemoveSelected`)]})]}):(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground`,onClick:()=>p(!0),children:[(0,$.jsx)(A,{className:`h-3 w-3`}),F(`providerModelsBulkRemove`)]})}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>{if(f)return(0,$.jsxs)(`label`,{className:`inline-flex max-w-full cursor-pointer items-center gap-2 rounded-full border border-border/55 bg-muted/45 px-3 py-1.5 hover:bg-[var(--interaction-hover)]`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:m.has(e),onChange:()=>S(e),"aria-label":F(`providerModelsSuggestionSelect`).replace(`{model}`,e),className:`h-3.5 w-3.5 shrink-0 accent-primary`}),(0,$.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-foreground sm:max-w-[220px]`,children:e})]},e);let t=n[e],r=t?.thinking,p=r?.supported??[],h=r?.default??null,x=t?.vision===!0;return(0,$.jsxs)(`div`,{className:`group inline-flex max-w-full items-center gap-1 rounded-full border border-border/55 bg-muted/45 px-3 py-1.5`,children:[(0,$.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-foreground sm:max-w-[220px]`,children:e}),(0,$.jsxs)(H,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground/70 opacity-100 transition-opacity hover:bg-[var(--interaction-hover)] hover:text-foreground md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":F(`providerModelThinkingTitle`),title:F(`providerModelThinkingTitle`),children:(0,$.jsx)(M,{className:`h-3 w-3`})})}),(0,$.jsxs)(z,{className:`w-80 space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-muted/50 px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:F(`providerModelVisionTitle`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`providerModelVisionHint`)})]}),(0,$.jsx)(i,{checked:x,onCheckedChange:t=>l(e,t)})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:F(`providerModelThinkingTitle`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`providerModelThinkingHint`)})]}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u.map(t=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>s(e,t),className:`rounded-full border px-2.5 py-1 text-xs font-medium transition-colors ${p.includes(t)?`border-[var(--interaction-selection-border)] bg-[var(--interaction-selection)] text-foreground`:`border-border/55 bg-muted/50 text-muted-foreground hover:border-border hover:bg-[var(--interaction-hover)] hover:text-foreground`}`,children:d(t)},t))}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(a,{className:`text-xs font-medium text-foreground`,children:F(`providerModelThinkingDefault`)}),(0,$.jsxs)(b,{value:h??`__none__`,onValueChange:t=>c(e,t===`__none__`?null:t),disabled:p.length===0,children:[(0,$.jsx)(_,{className:`h-8 rounded-lg text-xs`,children:(0,$.jsx)(g,{})}),(0,$.jsxs)(v,{children:[(0,$.jsx)(y,{value:`__none__`,children:F(`providerModelThinkingDefaultNone`)}),p.map(e=>(0,$.jsx)(y,{value:e,children:d(e)},e))]})]}),p.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`providerModelThinkingNoSupported`)}):null]})]})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground/70 opacity-100 transition-opacity hover:bg-[var(--interaction-hover)] hover:text-foreground md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":F(`remove`),children:(0,$.jsx)(N,{className:`h-3 w-3`})})]},e)})}),f?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`providerModelsRemoveSaveHint`)}):null]})}var rt=20,it=50,at=50;function ot(e){let{expanded:n,fetchedTotal:r,models:i,source:a,onExpandedChange:o,onAddModels:s}=e,[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(()=>new Set),f=(0,Y.useMemo)(()=>{let e=c.trim().toLowerCase();return e?i.filter(t=>t.toLowerCase().includes(e)):i},[i,c]),p=f.slice(0,at),h=(0,Y.useMemo)(()=>i.filter(e=>u.has(e)),[i,u]),g=e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},_=e=>{e.length!==0&&(s(e),l(``),d(new Set))},v=a===`fetched`?`providerModelsFetchedSuggestionsSummary`:`providerModelsSuggestionsSummary`;return a===`fetched`&&i.length===0?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-muted/35 px-3 py-2 text-xs text-muted-foreground`,role:`status`,children:[(0,$.jsx)(w,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,$.jsx)(`span`,{children:F(`providerModelsFetchedAllConfigured`).replace(`{count}`,String(r))})]}):(0,$.jsxs)(`div`,{className:`rounded-xl bg-muted/35 p-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":n,className:`flex min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:()=>o(!n),children:[(0,$.jsx)(w,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:F(v).replace(`{count}`,String(i.length))}),(0,$.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${n?`rotate-90`:``}`})]}),i.length<=it?(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-lg px-2 py-1.5 text-xs font-medium text-primary transition-colors hover:bg-[var(--interaction-hover)]`,onClick:()=>_(i),children:F(`providerModelsSuggestionsAddAll`)}):null]}),n?(0,$.jsxs)(`div`,{className:`px-1 pb-1`,children:[i.length>rt?(0,$.jsxs)(`div`,{className:`relative px-2 pb-1 pt-1.5`,children:[(0,$.jsx)(m,{className:`pointer-events-none absolute left-4 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(t,{value:c,onChange:e=>l(e.target.value),placeholder:F(`providerModelsSuggestionsSearchPlaceholder`),className:`h-8 rounded-lg pl-8 text-xs`})]}):null,(0,$.jsxs)(`div`,{className:`custom-scrollbar max-h-44 overflow-y-auto overscroll-contain`,children:[p.map(e=>(0,$.jsxs)(`label`,{className:`grid min-w-0 cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-[var(--interaction-hover)]`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:u.has(e),onChange:()=>g(e),"aria-label":F(`providerModelsSuggestionSelect`).replace(`{model}`,e),className:`h-3.5 w-3.5 shrink-0 accent-primary`}),(0,$.jsx)(`span`,{className:`block min-w-0 truncate text-xs text-foreground`,title:e,children:e})]},e)),f.length===0?(0,$.jsx)(`p`,{className:`px-2 py-4 text-center text-xs text-muted-foreground`,children:F(`providerModelsSuggestionsSearchEmpty`)}):null]}),f.length>p.length?(0,$.jsx)(`p`,{className:`px-2 pt-1 text-[11px] text-muted-foreground`,children:F(`providerModelsSuggestionsShowing`).replace(`{visible}`,String(p.length)).replace(`{count}`,String(f.length))}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pt-1.5`,children:[(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:F(`providerModelsSuggestionsSelected`).replace(`{count}`,String(h.length))}),(0,$.jsx)(`button`,{type:`button`,disabled:h.length===0,className:`shrink-0 rounded-md bg-primary/10 px-2 py-1 text-[11px] font-medium text-primary transition-colors hover:bg-[var(--interaction-hover)] disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>_(h),children:F(`providerModelsSuggestionsAddSelected`)})]}),(0,$.jsx)(`p`,{className:`px-2 pb-1 pt-1 text-[11px] text-muted-foreground`,children:F(`providerModelsSuggestionsSaveHint`)})]}):null]})}function st({hasFetchedCatalog:e,hasSuggestionError:t,supportsModelDiscovery:n}){return!n||!t||e?null:(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:[(0,$.jsx)(C,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),F(`providerModelsSuggestionsFailed`)]})}function ct(e){let{providerName:n,providerModelAliases:r,models:i,modelConfig:s,modelDraft:c,showModelInput:l,onModelDraftChange:u,onShowModelInputChange:d,onAddModel:f,onModelsChange:p,supportsModelDiscovery:m,onDiscoverModels:h,isDiscoveringModels:g,fetchedModels:_,onRemoveModel:v,onToggleModelThinkingLevel:y,onSetModelThinkingDefault:b,onSetModelVision:x,thinkingLevels:S,formatThinkingLevelLabel:C}=e,[w,T]=(0,Y.useState)(!1),E=(0,Y.useRef)(null),{addSuggestedModels:D,hasSuggestionError:A,isCheckingSuggestions:M,suggestedModels:P,suggestionSource:I}=tt({providerName:n,models:i,aliases:r,fetchedModels:_,onModelsChange:p}),L=async()=>{await h()&&(T(!0),window.requestAnimationFrame(()=>{let e=E.current;e?.scrollIntoView?.({behavior:`smooth`,block:`center`}),e?.focus({preventScroll:!0})}))},R=_.length>0;return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(a,{className:`text-sm font-medium text-foreground`,children:F(`providerModelsTitle`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[m?(0,$.jsxs)(`button`,{type:`button`,onClick:L,disabled:g,className:`flex items-center gap-1 text-xs font-medium text-primary transition-colors hover:text-primary/80 disabled:cursor-wait disabled:opacity-60`,children:[(0,$.jsx)(j,{className:`h-3 w-3 ${g?`animate-spin`:``}`}),F(g?`providerModelsFetching`:`providerModelsFetch`)]}):null,l?null:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>d(!0),className:`flex items-center gap-1 text-xs font-medium text-primary hover:text-primary/80`,children:[(0,$.jsx)(k,{className:`h-3 w-3`}),F(`providerAddModel`)]})]})]}),l?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(t,{value:c,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),f()),e.key===`Escape`&&(d(!1),u(``))},placeholder:F(`providerModelInputPlaceholder`),className:`flex-1 rounded-xl`,autoFocus:!0}),(0,$.jsx)(o,{type:`button`,size:`sm`,onClick:f,disabled:c.trim().length===0,children:F(`add`)}),(0,$.jsx)(o,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{d(!1),u(``)},children:(0,$.jsx)(N,{className:`h-4 w-4`})})]}):null,(0,$.jsx)(st,{hasFetchedCatalog:R,hasSuggestionError:A,supportsModelDiscovery:m}),m&&M&&!R?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-muted/35 px-3 py-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(O,{className:`h-3.5 w-3.5 animate-spin`}),F(`providerModelsSuggestionsChecking`)]}):m&&(P.length>0||R)?(0,$.jsx)(`div`,{ref:E,tabIndex:-1,"aria-live":`polite`,className:`scroll-m-4 outline-none`,children:(0,$.jsx)(ot,{expanded:w,fetchedTotal:_.length,models:P,source:I,onExpandedChange:T,onAddModels:D})}):null,i.length===0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-muted/35 px-4 py-6 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:F(`providerModelsEmptyShort`)}),l?null:(0,$.jsx)(`button`,{type:`button`,onClick:()=>d(!0),className:`mt-2 text-sm font-medium text-primary hover:text-primary/80`,children:F(`providerAddFirstModel`)})]}):(0,$.jsx)(nt,{models:i,modelConfig:s,onModelsChange:p,onRemoveModel:v,onToggleModelThinkingLevel:y,onSetModelThinkingDefault:b,onSetModelVision:x,thinkingLevels:S,formatThinkingLevelLabel:C})]})}function lt({apiKeyRequired:e=!0,apiKeySet:t,className:n,enabled:r}){if(!r)return(0,$.jsx)(W,{status:`inactive`,label:F(`disabled`),className:n});let i=!e||t;return(0,$.jsx)(W,{status:i?`ready`:`setup`,label:F(i?`statusReady`:`statusSetup`),className:n})}function ut(e){let{context:n,language:r,providerTitle:i,providerDisplayName:s,apiKey:c,apiBase:l,extraHeaders:u,wireApi:d,models:f,modelConfig:p,modelDraft:m,showAdvanced:h,showModelInput:g,resolvedAuthMethodId:_,authSessionId:v,authStatusMessage:y,hasChanges:b,isDeletePending:x,isUpdatePending:S,connectivity:C,startPending:w,importPending:T,onProviderDisplayNameChange:E,onApiKeyChange:D,onApiBaseChange:O,onAuthMethodChange:k,onStartProviderAuth:j,onImportProviderAuthFromCli:M,onModelDraftChange:N,onShowModelInputChange:P,onAddModel:I,onModelsChange:L,onRemoveModel:R,onToggleModelThinkingLevel:z,onSetModelThinkingDefault:B,onSetModelVision:V,onShowAdvancedChange:H,onWireApiChange:U,onExtraHeadersChange:W,onDeleteProvider:te,onSubmit:ne,onTestConnection:G}=e,K=n.providerAuthMethods.find(e=>e.id===_);return(0,$.jsxs)(ge,{children:[(0,$.jsx)(pe,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`truncate text-lg font-semibold text-foreground`,children:i}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:te,disabled:x,className:`text-muted-foreground/70 transition-colors hover:text-red-500`,title:F(`providerDelete`),children:(0,$.jsx)(A,{className:`h-4 w-4`})}),(0,$.jsx)(lt,{enabled:n.currentEnabled,apiKeyRequired:n.resolvedProviderConfig.apiKeyRequired,apiKeySet:n.resolvedProviderConfig.apiKeySet})]})]})}),(0,$.jsxs)(`form`,{onSubmit:ne,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(_e,{className:`space-y-4 px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(a,{htmlFor:`providerDisplayName`,className:`text-sm font-medium text-foreground`,children:F(`providerDisplayName`)}),(0,$.jsx)(t,{id:`providerDisplayName`,type:`text`,value:s,onChange:e=>E(e.target.value),placeholder:n.defaultDisplayName||F(`providerDisplayNamePlaceholder`),className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`providerDisplayNameHelpShort`)})]}),(0,$.jsx)(et,{apiKey:c,apiKeyRequired:n.resolvedProviderConfig.apiKeyRequired!==!1,apiKeySet:n.resolvedProviderConfig.apiKeySet,apiKeyPlaceholder:n.apiKeyHint?.placeholder??F(`enterApiKey`),providerAuth:n.providerAuth,providerAuthNote:n.providerAuth?.note?.[r]||n.providerAuth?.note?.en||n.providerAuth?.displayName||``,providerAuthMethodOptions:n.providerAuthMethodOptions,providerAuthMethodsCount:n.providerAuthMethods.length,selectedAuthMethodHint:K?.hint?.[r]||K?.hint?.en||``,shouldUseAuthMethodPills:n.shouldUseAuthMethodPills,resolvedAuthMethodId:_,onAuthMethodChange:k,onStartProviderAuth:j,onImportProviderAuthFromCli:M,startPending:w,importPending:T,authSessionId:v,authStatusMessage:y,onApiKeyChange:D}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(a,{htmlFor:`apiBase`,className:`text-sm font-medium text-foreground`,children:F(`apiBase`)}),(0,$.jsx)(t,{id:`apiBase`,type:`text`,value:l,onChange:e=>O(e.target.value),placeholder:n.defaultApiBase||n.apiBaseHint?.placeholder||`https://api.example.com`,className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.apiBaseHelpText})]}),(0,$.jsx)(ct,{providerName:n.providerConfig?.providerId??``,providerModelAliases:n.providerModelAliases,models:f,modelConfig:p,modelDraft:m,showModelInput:g,onModelDraftChange:N,onShowModelInputChange:P,onAddModel:I,onModelsChange:L,supportsModelDiscovery:n.supportsModelDiscovery,onDiscoverModels:C.discoverModels,isDiscoveringModels:C.isDiscoveringModels,fetchedModels:C.fetchedModels,onRemoveModel:R,onToggleModelThinkingLevel:z,onSetModelThinkingDefault:B,onSetModelVision:V,thinkingLevels:ee,formatThinkingLevelLabel:Fe},n.providerConfig?.providerId),(0,$.jsx)(Qe,{showAdvanced:h,onShowAdvancedChange:H,supportsWireApi:n.supportsWireApi,wireApiLabel:F(`wireApi`),wireApi:d,onWireApiChange:U,shouldUseWireApiPills:n.shouldUseWireApiPills,wireApiSelectOptions:n.wireApiSelectOptions,extraHeadersLabel:F(`extraHeaders`),extraHeaders:u,onExtraHeadersChange:W})]}),(0,$.jsx)(ye,{children:(0,$.jsxs)(de,{align:`between`,children:[(0,$.jsxs)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:G,disabled:C.isTestPending,children:[(0,$.jsx)(be,{className:`mr-1.5 h-3.5 w-3.5`}),C.isTestPending?F(`providerTestingConnection`):F(`providerTestConnection`)]}),(0,$.jsx)(o,{type:`submit`,size:`sm`,disabled:S||!b,children:F(S?`saving`:b?`save`:`unchanged`)})]})})]})]})}function dt({providerName:e,onProviderDeleted:t}){let{data:n}=ce(),{data:r}=q(),{data:i}=le(),a=P(),o=(0,Y.useMemo)(()=>qe({providerName:e,providersView:n,templatesView:r,schema:i,language:a}),[a,e,n,i,r]);if(!e||!o.providerConfig)return(0,$.jsx)(ve,{children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:F(`providersSelectTitle`)}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:F(`providersSelectDescription`)})]})});let s=JSON.stringify({providerConfig:o.providerConfig,currentApiBase:o.currentApiBase,currentEditableModels:o.currentEditableModels,currentModelConfig:o.currentModelConfig,currentWireApi:o.currentWireApi,effectiveDisplayName:o.effectiveDisplayName,preferredAuthMethodId:o.preferredAuthMethodId});return(0,$.jsx)(ft,{providerName:e,onProviderDeleted:t,context:o,language:a},s)}function ft({providerName:e,onProviderDeleted:t,context:n,language:r}){let i=ue(),a=ne(),{currentApiBase:o,currentEditableModels:s,currentHeaders:c,currentModelConfig:l,currentWireApi:u,defaultApiBase:d,effectiveDisplayName:f,providerAuth:p,providerAuthMethods:m,providerModelAliases:h,resolvedProviderConfig:g,preferredAuthMethodId:_,supportsWireApi:v}=n,[y,b]=(0,Y.useState)(``),[x,S]=(0,Y.useState)(o),[C,w]=(0,Y.useState)(g.extraHeaders||null),[T,E]=(0,Y.useState)(u),[D,O]=(0,Y.useState)(s),[k,A]=(0,Y.useState)(l),[j,M]=(0,Y.useState)(``),[N,P]=(0,Y.useState)(f),[I,L]=(0,Y.useState)(!1),[R,z]=(0,Y.useState)(!1),[B,V]=(0,Y.useState)(_),H=Ye({providerName:e,apiKey:y,apiKeyRequired:g.apiKeyRequired!==!1,apiKeySet:g.apiKeySet,apiBase:x,extraHeaders:C,supportsWireApi:v,wireApi:T,models:D,providerModelAliases:h}),ee=N.trim()||f||e||F(`providersSelectPlaceholder`),U=(0,Y.useMemo)(()=>{if(!m.length)return``;let e=B.trim();return e&&m.some(t=>t.id===e)?e:_||m[0]?.id||``},[B,_,m]),{authSessionId:W,authStatusMessage:te,importAuthFromCli:G,importPending:K,startAuth:q,startPending:re}=Je({providerName:e,providerAuth:p,resolvedAuthMethodId:U}),ie=(0,Y.useMemo)(()=>je({providerName:e,apiKey:y,apiBase:x,currentApiBase:o,extraHeaders:C,currentHeaders:c,supportsWireApi:v,wireApi:T,currentWireApi:u,models:D,currentEditableModels:s,modelConfig:k,currentModelConfig:l,providerDisplayName:N,effectiveDisplayName:f}),[e,y,x,o,C,c,v,T,u,D,s,k,l,N,f]),ae=e=>{O(e),A(t=>Oe(t,e))};return(0,$.jsx)(ut,{context:n,language:r,providerTitle:ee,providerDisplayName:N,apiKey:y,apiBase:x,extraHeaders:C,wireApi:T,models:D,modelConfig:k,modelDraft:j,showAdvanced:I,showModelInput:R,resolvedAuthMethodId:U,authSessionId:W,authStatusMessage:te,hasChanges:ie,isDeletePending:a.isPending,isUpdatePending:i.isPending,connectivity:H,startPending:re,importPending:K,onProviderDisplayNameChange:P,onApiKeyChange:b,onApiBaseChange:S,onAuthMethodChange:V,onStartProviderAuth:q,onImportProviderAuthFromCli:G,onModelDraftChange:M,onShowModelInputChange:z,onAddModel:()=>{let e=Re(D,j,h);ae(e.models),M(e.draft)},onModelsChange:ae,onRemoveModel:e=>{let t=Ve(D,k,e);O(t.models),A(t.modelConfig)},onToggleModelThinkingLevel:(e,t)=>{A(n=>He(n,e,t))},onSetModelThinkingDefault:(e,t)=>{A(n=>Ue(n,e,t))},onSetModelVision:(e,t)=>{A(n=>We(n,e,t))},onShowAdvancedChange:L,onWireApiChange:E,onExtraHeadersChange:w,onDeleteProvider:async()=>{if(e&&window.confirm(F(`providerDeleteConfirm`)))try{await a.mutateAsync({provider:e}),t?.(e)}catch{}},onSubmit:t=>{t.preventDefault(),e&&i.mutate({provider:e,data:Me({providerName:e,apiKey:y,apiBase:x,currentApiBase:o,defaultApiBase:d,extraHeaders:C,currentHeaders:c,supportsWireApi:v,wireApi:T,currentWireApi:u,models:D,currentEditableModels:s,modelConfig:k,currentModelConfig:l,providerDisplayName:N,effectiveDisplayName:f})})},onTestConnection:H.testConnection})}function pt(e){if(!e)return null;try{let t=new URL(e);return`${t.host}${t.pathname&&t.pathname!==`/`?t.pathname:``}`}catch{return e.replace(/^https?:\/\//,``)}}function mt(e,t=[]){let n=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({provider:e,index:t})).sort((e,t)=>{let r=n.get(e.provider.providerId),i=n.get(t.provider.providerId);if(r!==void 0||i!==void 0)return(r??2**53-1)-(i??2**53-1);let a=e.provider.providerType===`nextclaw`?1:0,o=t.provider.providerType===`nextclaw`?1:0;return a===o?e.index-t.index:a-o}).map(({provider:e})=>e)}function ht(e){let t=e.findIndex(e=>e.providerType===`zhipu`),n=e.findIndex(e=>e.providerType===`dashscope-coding-plan`);return e.map((e,t)=>({template:e,index:t})).sort((e,r)=>{let i=({template:e,index:r})=>e.providerType===`nextclaw`?2**53-1:e.providerType===`deepseek`&&n>=0?n-.5:e.providerType===`mimo`&&t>=0?t+.5:r;return i(e)-i(r)}).map(({template:e})=>e)}function gt(){let{isMobile:e}=h(),{data:n}=ce(),{data:a}=q(),c=ie(),l=ne(),u=ue(),[d,f]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)([]),[S,C]=(0,Y.useState)(``),w=(0,Y.useMemo)(()=>mt(Object.values(n?.providers??{}),b),[n?.providers,b]),D=(0,Y.useMemo)(()=>a?.providerTemplates??[],[a?.providerTemplates]),O=(0,Y.useMemo)(()=>ht(D),[D]),j=(0,Y.useMemo)(()=>new Map(D.map(e=>[e.providerType,e])),[D]),M=(0,Y.useMemo)(()=>{let e=S.trim().toLowerCase();return w.filter(t=>{if(!e)return!0;let n=t.providerType?j.get(t.providerType):null;return(t.displayName?.trim()||n?.displayName||t.providerId).toLowerCase().includes(e)||t.providerId.toLowerCase().includes(e)})},[w,S,j]),N=(0,Y.useMemo)(()=>d&&M.some(e=>e.providerId===d)?d:e?null:M[0]?.providerId??null,[M,e,d]);return!n||!a?(0,$.jsx)(r,{title:F(`providersPageTitle`),description:F(`providersPageDescription`),layout:`split`,children:(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:F(`providersLoading`)})}):(0,$.jsxs)(r,{title:F(`providersPageTitle`),description:F(`providersPageDescription`),layout:`split`,children:[(0,$.jsxs)(fe,{className:`md:min-h-0`,compactView:d?`detail`:`list`,onMobileBack:()=>f(null),mobileListLabel:F(`providersPageTitle`),children:[(0,$.jsxs)(he,{children:[(0,$.jsx)(pe,{className:`space-y-3 px-4 pb-3 pt-4`,children:(0,$.jsxs)(H,{open:v,onOpenChange:y,children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsxs)(o,{type:`button`,variant:`outline`,className:`w-full justify-center`,disabled:c.isPending,children:[(0,$.jsx)(k,{className:`mr-2 h-4 w-4`}),c.isPending?F(`saving`):F(`providerAdd`)]})}),(0,$.jsxs)(z,{className:`w-[42rem] max-w-[calc(100vw-2rem)] p-3`,align:`start`,children:[(0,$.jsx)(`div`,{className:`mb-2 px-1 text-xs font-semibold text-muted-foreground`,children:F(`providerTemplatePickerTitle`)}),(0,$.jsxs)(`div`,{className:`grid max-h-[24rem] grid-cols-2 gap-2 overflow-y-auto sm:grid-cols-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full flex-col items-start gap-2 rounded-lg border border-dashed border-border/70 bg-muted/20 px-3 py-2 text-left transition-colors hover:border-border hover:bg-[var(--interaction-hover)]`,onClick:async()=>{try{let e=await c.mutateAsync({data:{providerType:null}});C(``),f(e.providerId),x(t=>[e.providerId,...t.filter(t=>t!==e.providerId)]),y(!1)}catch{}},children:[(0,$.jsx)(U,{name:`custom`,className:`h-8 w-8 rounded-lg border border-border/60 bg-muted/50`}),(0,$.jsx)(`span`,{className:`line-clamp-2 min-w-0 text-xs font-semibold leading-4 text-foreground`,children:F(`providerAddCustom`)})]}),O.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full flex-col items-start gap-2 rounded-lg border border-border/55 bg-muted/15 px-3 py-2 text-left transition-colors hover:border-border/80 hover:bg-[var(--interaction-hover)]`,onClick:async()=>{try{let t=await c.mutateAsync({data:{providerType:e.providerType}});C(``),f(t.providerId),x(e=>[t.providerId,...e.filter(e=>e!==t.providerId)]),y(!1)}catch{}},children:[(0,$.jsx)(U,{name:e.providerType,src:e.logo?`/logos/${e.logo}`:null,className:`h-8 w-8 rounded-lg border border-border/55 bg-background`,imgClassName:`h-4 w-4 object-contain`}),(0,$.jsx)(`span`,{className:`line-clamp-2 min-w-0 text-xs font-semibold leading-4 text-foreground`,children:e.displayName||e.providerType})]},e.providerType))]})]})]})}),(0,$.jsx)(`div`,{className:`border-b border-border/70 px-4 py-3`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(m,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,$.jsx)(t,{value:S,onChange:e=>C(e.target.value),placeholder:F(`providersFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,$.jsxs)(_e,{className:`space-y-2 p-3`,children:[M.map(e=>{let t=e.providerType?j.get(e.providerType):null,n=e.enabled!==!1,r=I(e),a=e.displayName?.trim()||t?.displayName||e.providerId,o=pt(e.apiBase||t?.defaultApiBase||``)||F(`providersDefaultDescription`);return(0,$.jsx)(`div`,{onClick:()=>f(e.providerId),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),f(e.providerId))},role:`button`,tabIndex:0,className:s(`group w-full rounded-xl p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,N===e.providerId?`bg-[var(--interaction-selection)] text-foreground`:`bg-transparent text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:(0,$.jsxs)(`div`,{className:`relative min-h-10`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 pr-20`,children:[(0,$.jsx)(U,{name:e.providerType??e.providerId,src:t?.logo?`/logos/${t.logo}`:null,className:`h-10 w-10 rounded-lg bg-background/80`,imgClassName:`h-5 w-5 object-contain`,fallback:(0,$.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:e.providerId[0]})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:a}),(0,$.jsx)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground/65`,children:e.providerId}),(0,$.jsxs)(`p`,{className:`line-clamp-1 text-[11px] text-muted-foreground`,children:[o,` · `,e.models?.length??0]})]})]}),(0,$.jsxs)(`div`,{className:`absolute right-0 top-0 flex items-center gap-1.5 opacity-70 transition-opacity group-hover:opacity-100`,children:[(0,$.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,$.jsx)(i,{checked:n,disabled:u.isPending,title:F(n?`disabled`:`enabled`),className:`h-[18px] w-8`,thumbClassName:`h-4 w-4 data-[state=checked]:translate-x-4`,onCheckedChange:t=>{u.mutateAsync({provider:e.providerId,data:{enabled:t},silentSuccess:!0})}})}),(0,$.jsxs)(H,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground/70 hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:e=>e.stopPropagation(),title:F(`more`),children:(0,$.jsx)(T,{className:`h-4 w-4`})})}),(0,$.jsx)(z,{className:`w-40 p-1`,align:`end`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-2 text-sm text-red-600 hover:bg-destructive/10`,onClick:()=>_(e.providerId),children:[(0,$.jsx)(A,{className:`h-4 w-4`}),F(`providerDelete`)]})})]})]}),(0,$.jsx)(W,{status:n?r?`ready`:`setup`:`inactive`,label:F(n?r?`statusReady`:`statusSetup`:`disabled`),className:`absolute bottom-0 right-0 justify-end`})]})},e.providerId)}),M.length===0?(0,$.jsx)(me,{icon:p,title:F(`providersNoMatch`)}):null]})]}),(0,$.jsx)(dt,{providerName:N??void 0,onProviderDeleted:e=>{x(t=>t.filter(t=>t!==e)),e===N&&f(null)}})]}),(0,$.jsx)(E,{open:!!g,onOpenChange:e=>{e||_(null)},title:F(`providerDelete`),description:g??void 0,confirmLabel:F(`delete`),variant:`destructive`,onCancel:()=>_(null),onConfirm:()=>{g&&l.mutateAsync({provider:g}).then(()=>{x(e=>e.filter(e=>e!==g)),g===N&&f(null),_(null)})}})]})}export{gt as ProvidersConfigPage};
|
|
1
|
+
import{i as e}from"./chunk-DF37yw5_.js";import{Gt as t,Jn as n,Qt as r,Ut as i,Wt as a,Yt as o,_n as s,cr as c,gn as l,sr as u,yr as d}from"./api-DjiZvIa0.js";import{t as f}from"./createLucideIcon-Cfo2ySi5.js";import{a as p,i as m,t as h}from"./use-viewport-layout-D_9XWGDV.js";import{a as g,i as _,n as v,r as y,t as b,w as x}from"./select-CWyjnar7.js";import{m as S}from"./context-menu-BsCj2fRs.js";import{i as C,n as w,r as T,t as E}from"./confirm-dialog-CxfecBzO.js";import{t as D}from"./eye-kisejBFH.js";import{t as O}from"./loader-circle-Bd1fTm-x.js";import{n as k,t as A}from"./trash-2-hAbJh9VZ.js";import{t as j}from"./refresh-cw-BlXDrVP0.js";import{t as M}from"./settings-2-CrNhfInU.js";import{t as N}from"./x-ChPbNv39.js";import{l as P,s as F}from"./i18n-Bm3Ov7Fy.js";import{a as I,c as L,g as R,h as z,l as B,o as V,p as H,t as ee}from"./provider-models-Dm-pmWAA.js";import{n as U,t as W}from"./status-dot-C3SRFEta.js";import{t as te}from"./host-capabilities-DuIFVsvM.js";import{a as ne,c as G,d as K,f as q,h as re,i as ie,l as ae,m as oe,o as se,p as ce,r as le,y as ue}from"./use-config-evzage09.js";import{t as de}from"./form-actions-D9JWSFQu.js";import{t as J}from"./config-hints-DbmiyTKg.js";import{a as fe,c as pe,i as me,l as he,n as ge,o as _e,r as ve,s as ye}from"./config-split-page-CuEGQL8Z.js";var be=f(`CircleDotDashed`,[[`path`,{d:`M10.1 2.18a9.93 9.93 0 0 1 3.8 0`,key:`1qdqn0`}],[`path`,{d:`M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7`,key:`1bq7p6`}],[`path`,{d:`M21.82 10.1a9.93 9.93 0 0 1 0 3.8`,key:`1rlaqf`}],[`path`,{d:`M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69`,key:`1xk03u`}],[`path`,{d:`M13.9 21.82a9.94 9.94 0 0 1-3.8 0`,key:`l7re25`}],[`path`,{d:`M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7`,key:`1v18p6`}],[`path`,{d:`M2.18 13.9a9.93 9.93 0 0 1 0-3.8`,key:`xdo6bj`}],[`path`,{d:`M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69`,key:`1jjmaz`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),xe=f(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Y=e(d(),1),Se={providerId:``,providerType:null,isBuiltInType:!1,isCustom:!0,enabled:!0,displayName:``,apiKeySet:!1,apiKeyMasked:void 0,apiBase:null,extraHeaders:null,wireApi:null,models:[],modelConfig:{}};function X(e){if(!e)return null;let t=Object.entries(e).map(([e,t])=>[e.trim(),t]).filter(([e])=>e.length>0);return t.length===0?null:Object.fromEntries(t)}function Ce(e,t){let n=X(e),r=X(t);if(n===null&&r===null)return!0;if(!n||!r)return!1;let i=Object.entries(n).sort(([e],[t])=>e.localeCompare(t)),a=Object.entries(r).sort(([e],[t])=>e.localeCompare(t));return i.length===a.length?i.every(([e,t],n)=>e===a[n][0]&&t===a[n][1]):!1}function Z(e){if(!e||e.length===0)return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function we(e,t){let n=e.trim();if(!n||!t.trim())return n;let r=`${t.trim()}/`;return n.startsWith(r)?n.slice(r.length):n}function Q(e,t){let n=e.trim();if(!n)return``;for(let e of t){let t=e.trim();t&&(n=we(n,t))}return n.trim()}function Te(e,t){return e.length===t.length?e.every((e,n)=>e===t[n]):!1}function Ee(e,t){return Z(t)}function De(e,t){return Z(e).map(e=>{let n=e.trim();return!n||n.startsWith(`${t}/`)?n:`${t}/${n}`})}function Oe(e,t){let n=new Set(t.map(e=>e.trim()).filter(Boolean)),r={};for(let[t,i]of Object.entries(e)){if(!n.has(t))continue;let e={},a=L(i.thinking?.supported);if(a.length>0){let t=B(i.thinking?.default);e.thinking=t&&a.includes(t)?{supported:a,default:t}:{supported:a}}i.vision===!0&&(e.vision=!0),(e.thinking||e.vision===!0)&&(r[t]=e)}return r}function ke(e,t,n){return{...V(e,n),...V(t,n)}}function Ae(e,t){let n=Object.keys(e).sort(),r=Object.keys(t).sort();if(n.length!==r.length)return!1;for(let i=0;i<n.length;i+=1){let a=n[i];if(a!==r[i])return!1;let o=e[a],s=t[a];if(!o||!s||!Te([...o.thinking?.supported??[]].sort(),[...s.thinking?.supported??[]].sort())||(o.thinking?.default??null)!==(s.thinking?.default??null)||(o.vision??!1)!==(s.vision??!1))return!1}return!0}function je(e){return e.providerName?e.apiKey.trim().length>0||e.apiBase.trim()!==e.currentApiBase.trim()||!Ce(e.extraHeaders,e.currentHeaders)||e.supportsWireApi&&e.wireApi!==e.currentWireApi||!Te(e.models,e.currentEditableModels)||!Ae(e.modelConfig,e.currentModelConfig)||e.providerDisplayName.trim()!==e.effectiveDisplayName:!1}function Me(e){let t={},n=e.apiKey.trim(),r=e.apiBase.trim(),i=X(e.extraHeaders),a=e.providerDisplayName.trim();return a!==e.effectiveDisplayName&&(t.displayName=a.length>0?a:null),n.length>0&&(t.apiKey=n),r!==e.currentApiBase.trim()&&(t.apiBase=r.length>0&&r!==e.defaultApiBase?r:null),Ce(i,e.currentHeaders)||(t.extraHeaders=i),e.supportsWireApi&&e.wireApi!==e.currentWireApi&&(t.wireApi=e.wireApi),Te(e.models,e.currentEditableModels)||(t.models=De(e.models,e.providerName??``)),Ae(e.modelConfig,e.currentModelConfig)||(t.modelConfig=Oe(e.modelConfig,e.models)),t}function Ne(e){let t=Q(e.models.find(e=>e.trim().length>0)??``,e.providerModelAliases),n={...Pe(e),model:t||null};return e.supportsWireApi&&(n.wireApi=e.wireApi),n}function Pe(e){let t={apiBase:e.apiBase.trim(),extraHeaders:X(e.extraHeaders)};return e.apiKey.trim().length>0&&(t.apiKey=e.apiKey.trim()),t}function Fe(e){return F(e===`off`?`chatThinkingLevelOff`:e===`minimal`?`chatThinkingLevelMinimal`:e===`low`?`chatThinkingLevelLow`:e===`medium`?`chatThinkingLevelMedium`:e===`high`?`chatThinkingLevelHigh`:e===`adaptive`?`chatThinkingLevelAdaptive`:`chatThinkingLevelXhigh`)}function Ie(e){let{providerName:t,methods:n,defaultMethodId:r,language:i}=e;if(n.length===0)return``;let a=new Map;for(let e of n){let t=e.id.trim();t&&a.set(t.toLowerCase(),t)}let o=(...e)=>{for(let t of e){let e=a.get(t.toLowerCase());if(e)return e}},s=r?.trim();if(t===`minimax-portal`){if(i===`zh`)return o(`cn`,`china-mainland`)??o(s??``)??n[0]?.id??``;if(i===`en`)return o(`global`,`intl`,`international`)??o(s??``)??n[0]?.id??``}if(s){let e=o(s);if(e)return e}return i===`zh`?o(`cn`)??n[0]?.id??``:i===`en`?o(`global`)??n[0]?.id??``:n[0]?.id??``}function Le(e){let{required:t,hasDefault:n,optionCount:r}=e;return t&&n&&r>1&&r<=3}function Re(e,t,n){let r=Q(t,n);return r?e.includes(r)?{models:e,draft:``}:{models:[...e,r],draft:``}:{models:e,draft:t}}function ze(e,t,n){let r=[...e],i=new Set(e);for(let e of t){let t=Q(e,n);t&&!i.has(t)&&(i.add(t),r.push(t))}return{models:r,addedCount:r.length-e.length}}function Be(e,t,n){return ze(e,t,n).models.slice(e.length)}function Ve(e,t,n){let r={...t};return delete r[n],{models:e.filter(e=>e!==n),modelConfig:r}}function He(e,t,n){let r=e[t],i=r?.thinking?.supported??[],a=i.includes(n)?i.filter(e=>e!==n):ee.filter(e=>e===n||i.includes(e)),o=r?.thinking?.default&&a.includes(r.thinking.default)?r.thinking.default:void 0,s={...r,thinking:a.length>0?o?{supported:a,default:o}:{supported:a}:void 0},c={...e};return s.thinking||s.vision===!0?c[t]=s:delete c[t],c}function Ue(e,t,n){let r=e[t],i=r?.thinking;return!i||i.supported.length===0||n&&!i.supported.includes(n)?e:{...e,[t]:{...r,thinking:n?{supported:i.supported,default:n}:{supported:i.supported}}}}function We(e,t,n){let r={...e[t],vision:n?!0:void 0},i={...e};return r.thinking||r.vision===!0?i[t]=r:delete i[t],i}function Ge(e){let{providerName:t,providerSpec:n,language:r}=e,i=n?.auth,a=i?.methods??[];return{providerAuth:i,providerAuthMethodOptions:a.map(e=>({value:e.id,label:e.label?.[r]||e.label?.en||e.id})),providerAuthMethods:a,preferredAuthMethodId:Ie({providerName:n?.providerType??t,methods:a,defaultMethodId:i?.defaultMethodId,language:r}),shouldUseAuthMethodPills:Le({required:i?.kind===`device_code`,hasDefault:!!i?.defaultMethodId?.trim(),optionCount:a.length})}}function Ke(e,t){let n=!!e?.supportsWireApi||t,r=(e?.wireApiOptions||[`auto`,`chat`,`responses`]).map(e=>({value:e,label:F(e===`chat`?`wireApiChat`:e===`responses`?`wireApiResponses`:`wireApiAuto`)}));return{shouldUseWireApiPills:Le({required:n,hasDefault:typeof e?.defaultWireApi==`string`&&e.defaultWireApi.length>0,optionCount:r.length}),supportsWireApi:n,wireApiSelectOptions:r}}function qe(e){let{providerName:t,providersView:n,templatesView:r,schema:i,language:a}=e,o=t?n?.providers[t]:null,s=r?.providerTemplates.find(e=>e.providerType===o?.providerType),c=o??Se,l=i?.uiHints,u=!!o?.isCustom,d=t?J(`providers.${t}.apiKey`,l):void 0,f=t?J(`providers.${t}.apiBase`,l):void 0,p=t?J(`providers.${t}.extraHeaders`,l):void 0,m=t?J(`providers.${t}.wireApi`,l):void 0,h=s?.displayName||o?.displayName||t||``,g=(c.displayName||``).trim()||h,_=c.enabled!==!1,v=u||s?.supportsModelDiscovery===!0,y=Z([s?.modelPrefix||s?.providerType||``,t||``]),b=s?.defaultApiBase||``,x=c.apiBase||b,S=X(c.extraHeaders||null),C=c.wireApi||s?.defaultWireApi||`auto`,w=Ee(Z((s?.defaultModels??[]).map(e=>Q(e,y))),Z((c.models??[]).map(e=>Q(e,y)))),T=Oe(ke(s?.modelConfig,c.modelConfig,y),w),E=s?.apiBaseHelp?.[a]||s?.apiBaseHelp?.en||f?.help||F(`providerApiBaseHelp`),D=Ge({providerName:t,providerSpec:s,language:a}),O=Ke(s,u);return{apiBaseHelpText:E,apiBaseHint:f,apiKeyHint:d,currentApiBase:x,currentEditableModels:w,currentEnabled:_,currentHeaders:S,currentModelConfig:T,currentWireApi:C,defaultApiBase:b,defaultDisplayName:h,effectiveDisplayName:g,extraHeadersHint:p,...D,providerConfig:o,providerModelAliases:y,resolvedProviderConfig:c,supportsModelDiscovery:v,wireApiHint:m,...O}}function Je(e){let{providerName:t,providerAuth:r,resolvedAuthMethodId:i}=e,a=u(),o=oe(),s=ae(),c=G(),[l,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(``),g=(0,Y.useRef)(null),_=(0,Y.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),v=(0,Y.useCallback)((e,r)=>{_(),g.current=window.setTimeout(()=>{(async()=>{if(t)try{let i=await s.mutateAsync({provider:t,data:{sessionId:e}});if(i.status===`pending`){h(F(`providerAuthWaitingBrowser`)),v(e,i.nextPollMs??r);return}if(i.status===`authorized`){p(null),_(),h(F(`providerAuthCompleted`)),n.success(F(`providerAuthCompleted`)),a.invalidateQueries({queryKey:[`config`]}),a.invalidateQueries({queryKey:[`providers`]});return}p(null),_(),h(i.message||`Authorization ${i.status}.`),n.error(i.message||`Authorization ${i.status}.`)}catch(e){p(null),_();let t=e instanceof Error?e.message:String(e);h(t),n.error(`Authorization failed: ${t}`)}})()},Math.max(1e3,r))},[_,s,t,a]),y=(0,Y.useCallback)(async()=>{if(!(!t||r?.kind!==`device_code`))try{d(t),h(``);let e=await o.mutateAsync({provider:t,data:i?{methodId:i}:{}});if(!e.sessionId||!e.verificationUri)throw Error(F(`providerAuthStartFailed`));p(e.sessionId),h(`${F(`providerAuthOpenPrompt`)}${e.userCode}${F(`providerAuthOpenPromptSuffix`)}`),await te.openExternalUrl(e.verificationUri),v(e.sessionId,e.intervalMs)}catch(e){let t=e instanceof Error?e.message:String(e);p(null),_(),h(t),n.error(`${F(`providerAuthStartFailed`)}: ${t}`)}},[_,r?.kind,t,i,v,o]),b=(0,Y.useCallback)(async()=>{if(!(!t||r?.kind!==`device_code`))try{d(t),_(),p(null);let e=await c.mutateAsync({provider:t});h(`${F(`providerAuthImportStatusPrefix`)}${e.expiresAt?` (expires: ${e.expiresAt})`:``}`),n.success(F(`providerAuthImportSuccess`)),a.invalidateQueries({queryKey:[`config`]}),a.invalidateQueries({queryKey:[`providers`]})}catch(e){let t=e instanceof Error?e.message:String(e);h(t),n.error(`${F(`providerAuthImportFailed`)}: ${t}`)}},[_,c,r?.kind,t,a]);return(0,Y.useEffect)(()=>{_()},[_,t]),(0,Y.useEffect)(()=>()=>_(),[_]),{authSessionId:l===t?f:null,authStatusMessage:l===t?m:``,importAuthFromCli:b,importPending:c.isPending,startAuth:y,startPending:o.isPending}}function Ye(e){let{providerName:t,apiKey:r,apiKeyRequired:i,apiKeySet:a,apiBase:o,extraHeaders:s,supportsWireApi:c,wireApi:u,models:d,providerModelAliases:f}=e,p=re(),m=se(),h=(0,Y.useMemo)(()=>JSON.stringify({providerName:t,apiKey:r,apiBase:o,extraHeaders:s}),[o,r,s,t]),[g,_]=(0,Y.useState)(null),v=(0,Y.useCallback)(async()=>{if(t)try{let e=await p.mutateAsync({provider:t,data:Ne({apiKey:r,apiBase:o,extraHeaders:s,supportsWireApi:c,wireApi:u,models:d,providerModelAliases:f})});if(e.success){n.success(`${F(`providerTestConnectionSuccess`)} (${e.latencyMs}ms)`);return}let i=[`provider=${e.provider}`,`latency=${e.latencyMs}ms`];e.model&&i.push(`model=${e.model}`),n.error(`${F(`providerTestConnectionFailed`)}: ${e.message} | ${i.join(` | `)}`)}catch(e){let t=e instanceof Error?e.message:String(e);n.error(`${F(`providerTestConnectionFailed`)}: ${t}`)}},[o,r,s,d,f,t,c,p,u]);return{discoverModels:(0,Y.useCallback)(async()=>{if(!t)return null;if(i&&!r.trim()&&!a)return n.error(F(`providerModelsApiKeyRequired`)),null;try{let e=await m.mutateAsync({provider:t,data:Pe({apiKey:r,apiBase:o,extraHeaders:s})});return _({key:h,models:e.models}),n.success(F(`providerModelsFetchSuccess`)),e.models}catch(e){if(e instanceof l&&(e.details?.upstreamStatus===401||e.details?.upstreamStatus===403))return n.error(F(`providerModelsAuthorizationFailed`)),null;let t=e instanceof Error?e.message:String(e);return n.error(`${F(`providerModelsFetchFailed`)}: ${t}`),null}},[o,r,i,a,m,h,s,t]),fetchedModels:g?.key===h?g.models:[],isDiscoveringModels:m.isPending,isTestPending:p.isPending,testConnection:v}}var $=c();function Xe({value:e,onChange:n,className:r}){let i=e?Object.entries(e):[],a=(e,t,r)=>{let a=[...i];a[e]=[t,r],n(Object.fromEntries(a))},c=()=>{n({...e,"":``})},l=e=>{let t=i.filter((t,n)=>n!==e);n(Object.fromEntries(t))};return(0,$.jsxs)(`div`,{className:s(`space-y-2`,r),children:[i.map(([e,n],r)=>(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(t,{type:`text`,value:e,onChange:e=>a(r,e.target.value,n),placeholder:F(`headerName`),className:`flex-1`}),(0,$.jsx)(t,{type:`text`,value:n,onChange:t=>a(r,e,t.target.value),placeholder:F(`headerValue`),className:`flex-1`}),(0,$.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>l(r),children:(0,$.jsx)(A,{className:`h-4 w-4 text-red-500`})})]},r)),(0,$.jsxs)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:c,children:[(0,$.jsx)(k,{className:`h-4 w-4 mr-2`}),F(`add`)]})]})}function Ze(e){let{value:t,onChange:n,options:r}=e;return(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let r=e.value===t;return(0,$.jsx)(`button`,{type:`button`,onClick:()=>n(e.value),"aria-pressed":r,className:`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors ${r?`border-[var(--interaction-selection-border)] bg-[var(--interaction-selection)] text-foreground`:`border-border/55 bg-muted/50 text-muted-foreground hover:border-border hover:bg-[var(--interaction-hover)] hover:text-foreground`}`,children:e.label},e.value)})})}function Qe(e){let{showAdvanced:t,onShowAdvancedChange:n,supportsWireApi:r,wireApiLabel:i,wireApi:o,onWireApiChange:s,shouldUseWireApiPills:c,wireApiSelectOptions:l,extraHeadersLabel:u,extraHeaders:d,onExtraHeadersChange:f}=e;return(0,$.jsxs)(`div`,{className:`border-t border-border/70 pt-4`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex w-full items-center justify-between text-sm text-muted-foreground transition-colors hover:text-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(M,{className:`h-3.5 w-3.5`}),F(`providerAdvancedSettings`)]}),(0,$.jsx)(x,{className:`h-4 w-4 transition-transform ${t?`rotate-180`:``}`})]}),t?(0,$.jsxs)(`div`,{className:`mt-4 space-y-5`,children:[r?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(a,{htmlFor:`wireApi`,className:`text-sm font-medium text-foreground`,children:i}),c?(0,$.jsx)(Ze,{value:o,onChange:e=>s(e),options:l}):(0,$.jsxs)(b,{value:o,onValueChange:e=>s(e),children:[(0,$.jsx)(_,{className:`rounded-xl`,children:(0,$.jsx)(g,{})}),(0,$.jsx)(v,{children:l.map(e=>(0,$.jsx)(y,{value:e.value,children:e.label},e.value))})]})]}):null,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(a,{className:`text-sm font-medium text-foreground`,children:u}),(0,$.jsx)(Xe,{value:d,onChange:f}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`providerExtraHeadersHelpShort`)})]})]}):null]})}function $e({isSet:e,className:n,value:r,onChange:i,placeholder:a,...c}){let[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),p=typeof r==`string`&&r.length>0;return(0,$.jsxs)(`div`,{className:`relative`,children:[e&&!p&&!d?(0,$.jsx)(`div`,{onClick:()=>f(!0),className:s(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-500 cursor-text items-center pr-12`,n),children:`••••••••••••`}):(0,$.jsx)(t,{type:l?`text`:`password`,className:s(`pr-12`,n),value:r,onChange:i,onBlur:()=>{p||f(!1)},placeholder:a,autoFocus:d,...c}),(0,$.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex gap-1`,children:(e||p)&&(0,$.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>u(!l),children:l?(0,$.jsx)(xe,{className:`h-4 w-4`}):(0,$.jsx)(D,{className:`h-4 w-4`})})})]})}function et(e){let{apiKey:t,apiKeyRequired:n,apiKeySet:r,apiKeyPlaceholder:i,providerAuth:s,providerAuthNote:c,providerAuthMethodOptions:l,providerAuthMethodsCount:u,selectedAuthMethodHint:d,shouldUseAuthMethodPills:f,resolvedAuthMethodId:p,onAuthMethodChange:m,onStartProviderAuth:h,onImportProviderAuthFromCli:x,startPending:S,importPending:C,authSessionId:w,authStatusMessage:T,onApiKeyChange:E}=e,D=n?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(a,{htmlFor:`apiKey`,className:`text-sm font-medium text-foreground`,children:F(`apiKey`)}),(0,$.jsx)($e,{id:`apiKey`,value:t,isSet:r,onChange:e=>E(e.target.value),placeholder:i,className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`leaveBlankToKeepUnchanged`)})]}):null;return s?.kind===`device_code`?(0,$.jsxs)($.Fragment,{children:[D,(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-muted/45 p-3`,children:[(0,$.jsx)(a,{className:`text-sm font-medium text-foreground`,children:s.displayName||F(`providerAuthSectionTitle`)}),c?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}):null,u>1?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(a,{className:`text-xs font-medium text-foreground`,children:F(`providerAuthMethodLabel`)}),f?(0,$.jsx)(Ze,{value:p,onChange:m,options:l}):(0,$.jsxs)(b,{value:p,onValueChange:m,children:[(0,$.jsx)(_,{className:`h-8 rounded-lg`,children:(0,$.jsx)(g,{placeholder:F(`providerAuthMethodPlaceholder`)})}),(0,$.jsx)(v,{children:l.map(e=>(0,$.jsx)(y,{value:e.value,children:e.label},e.value))})]}),d?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d}):null]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:h,disabled:S||!!w,children:F(S?`providerAuthStarting`:w?`providerAuthAuthorizing`:`providerAuthAuthorizeInBrowser`)}),s.supportsCliImport?(0,$.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:x,disabled:C,children:F(C?`providerAuthImporting`:`providerAuthImportFromCli`)}):null,w?(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[F(`providerAuthSessionLabel`),`: `,w.slice(0,8),`…`]}):null]}),T?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:T}):null]})]}):D}function tt(e){let{providerName:t,models:n,aliases:r,fetchedModels:i=[],onModelsChange:a}=e,o=K({pollWhileRefreshing:!0,refreshOnMount:!0}),s=t?o.data?.providers[t]:void 0,c=i.length>0?`fetched`:`background`,l=(0,Y.useMemo)(()=>Be(n,c===`fetched`?i:s?.models??[],r),[r,s?.models,i,n,c]);return{addSuggestedModels:(0,Y.useCallback)(e=>{let t=ze(n,e,r);t.addedCount>0&&a(t.models)},[r,n,a]),hasSuggestionError:!!(s?.lastError&&!s.fetchedAt),isCheckingSuggestions:!!(t&&(o.isLoading||o.data?.refreshing&&!s)),suggestedModels:l,suggestionSource:c}}function nt(e){let{models:t,modelConfig:n,onModelsChange:r,onRemoveModel:o,onToggleModelThinkingLevel:s,onSetModelThinkingDefault:c,onSetModelVision:l,thinkingLevels:u,formatThinkingLevelLabel:d}=e,[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(()=>new Set),x=(0,Y.useMemo)(()=>t.filter(e=>m.has(e)),[t,m]),S=e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},C=()=>{p(!1),h(new Set)};return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`flex min-h-7 flex-wrap items-center justify-end gap-2`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mr-auto text-xs text-muted-foreground`,children:F(`providerModelsSuggestionsSelected`).replace(`{count}`,String(x.length))}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-primary hover:text-primary/80`,onClick:()=>h(x.length===t.length?new Set:new Set(t)),children:F(x.length===t.length?`providerModelsClearSelection`:`providerModelsSelectAll`)}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-muted-foreground hover:text-foreground`,onClick:C,children:F(`cancel`)}),(0,$.jsxs)(`button`,{type:`button`,disabled:x.length===0,className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/15 disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>{x.length!==0&&(r(t.filter(e=>!m.has(e))),C())},children:[(0,$.jsx)(A,{className:`h-3 w-3`}),F(`providerModelsRemoveSelected`)]})]}):(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground`,onClick:()=>p(!0),children:[(0,$.jsx)(A,{className:`h-3 w-3`}),F(`providerModelsBulkRemove`)]})}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>{if(f)return(0,$.jsxs)(`label`,{className:`inline-flex max-w-full cursor-pointer items-center gap-2 rounded-full border border-border/55 bg-muted/45 px-3 py-1.5 hover:bg-[var(--interaction-hover)]`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:m.has(e),onChange:()=>S(e),"aria-label":F(`providerModelsSuggestionSelect`).replace(`{model}`,e),className:`h-3.5 w-3.5 shrink-0 accent-primary`}),(0,$.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-foreground sm:max-w-[220px]`,children:e})]},e);let t=n[e],r=t?.thinking,p=r?.supported??[],h=r?.default??null,x=t?.vision===!0;return(0,$.jsxs)(`div`,{className:`group inline-flex max-w-full items-center gap-1 rounded-full border border-border/55 bg-muted/45 px-3 py-1.5`,children:[(0,$.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-foreground sm:max-w-[220px]`,children:e}),(0,$.jsxs)(H,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground/70 opacity-100 transition-opacity hover:bg-[var(--interaction-hover)] hover:text-foreground md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":F(`providerModelThinkingTitle`),title:F(`providerModelThinkingTitle`),children:(0,$.jsx)(M,{className:`h-3 w-3`})})}),(0,$.jsxs)(z,{className:`w-80 space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-muted/50 px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:F(`providerModelVisionTitle`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`providerModelVisionHint`)})]}),(0,$.jsx)(i,{checked:x,onCheckedChange:t=>l(e,t)})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:F(`providerModelThinkingTitle`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`providerModelThinkingHint`)})]}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u.map(t=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>s(e,t),className:`rounded-full border px-2.5 py-1 text-xs font-medium transition-colors ${p.includes(t)?`border-[var(--interaction-selection-border)] bg-[var(--interaction-selection)] text-foreground`:`border-border/55 bg-muted/50 text-muted-foreground hover:border-border hover:bg-[var(--interaction-hover)] hover:text-foreground`}`,children:d(t)},t))}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(a,{className:`text-xs font-medium text-foreground`,children:F(`providerModelThinkingDefault`)}),(0,$.jsxs)(b,{value:h??`__none__`,onValueChange:t=>c(e,t===`__none__`?null:t),disabled:p.length===0,children:[(0,$.jsx)(_,{className:`h-8 rounded-lg text-xs`,children:(0,$.jsx)(g,{})}),(0,$.jsxs)(v,{children:[(0,$.jsx)(y,{value:`__none__`,children:F(`providerModelThinkingDefaultNone`)}),p.map(e=>(0,$.jsx)(y,{value:e,children:d(e)},e))]})]}),p.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`providerModelThinkingNoSupported`)}):null]})]})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground/70 opacity-100 transition-opacity hover:bg-[var(--interaction-hover)] hover:text-foreground md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":F(`remove`),children:(0,$.jsx)(N,{className:`h-3 w-3`})})]},e)})}),f?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`providerModelsRemoveSaveHint`)}):null]})}var rt=20,it=50,at=50;function ot(e){let{expanded:n,fetchedTotal:r,models:i,source:a,onExpandedChange:o,onAddModels:s}=e,[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(()=>new Set),f=(0,Y.useMemo)(()=>{let e=c.trim().toLowerCase();return e?i.filter(t=>t.toLowerCase().includes(e)):i},[i,c]),p=f.slice(0,at),h=(0,Y.useMemo)(()=>i.filter(e=>u.has(e)),[i,u]),g=e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},_=e=>{e.length!==0&&(s(e),l(``),d(new Set))},v=a===`fetched`?`providerModelsFetchedSuggestionsSummary`:`providerModelsSuggestionsSummary`;return a===`fetched`&&i.length===0?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-muted/35 px-3 py-2 text-xs text-muted-foreground`,role:`status`,children:[(0,$.jsx)(w,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,$.jsx)(`span`,{children:F(`providerModelsFetchedAllConfigured`).replace(`{count}`,String(r))})]}):(0,$.jsxs)(`div`,{className:`rounded-xl bg-muted/35 p-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":n,className:`flex min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:()=>o(!n),children:[(0,$.jsx)(w,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:F(v).replace(`{count}`,String(i.length))}),(0,$.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${n?`rotate-90`:``}`})]}),i.length<=it?(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-lg px-2 py-1.5 text-xs font-medium text-primary transition-colors hover:bg-[var(--interaction-hover)]`,onClick:()=>_(i),children:F(`providerModelsSuggestionsAddAll`)}):null]}),n?(0,$.jsxs)(`div`,{className:`px-1 pb-1`,children:[i.length>rt?(0,$.jsxs)(`div`,{className:`relative px-2 pb-1 pt-1.5`,children:[(0,$.jsx)(m,{className:`pointer-events-none absolute left-4 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(t,{value:c,onChange:e=>l(e.target.value),placeholder:F(`providerModelsSuggestionsSearchPlaceholder`),className:`h-8 rounded-lg pl-8 text-xs`})]}):null,(0,$.jsxs)(`div`,{className:`custom-scrollbar max-h-44 overflow-y-auto overscroll-contain`,children:[p.map(e=>(0,$.jsxs)(`label`,{className:`grid min-w-0 cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-[var(--interaction-hover)]`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:u.has(e),onChange:()=>g(e),"aria-label":F(`providerModelsSuggestionSelect`).replace(`{model}`,e),className:`h-3.5 w-3.5 shrink-0 accent-primary`}),(0,$.jsx)(`span`,{className:`block min-w-0 truncate text-xs text-foreground`,title:e,children:e})]},e)),f.length===0?(0,$.jsx)(`p`,{className:`px-2 py-4 text-center text-xs text-muted-foreground`,children:F(`providerModelsSuggestionsSearchEmpty`)}):null]}),f.length>p.length?(0,$.jsx)(`p`,{className:`px-2 pt-1 text-[11px] text-muted-foreground`,children:F(`providerModelsSuggestionsShowing`).replace(`{visible}`,String(p.length)).replace(`{count}`,String(f.length))}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pt-1.5`,children:[(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:F(`providerModelsSuggestionsSelected`).replace(`{count}`,String(h.length))}),(0,$.jsx)(`button`,{type:`button`,disabled:h.length===0,className:`shrink-0 rounded-md bg-primary/10 px-2 py-1 text-[11px] font-medium text-primary transition-colors hover:bg-[var(--interaction-hover)] disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>_(h),children:F(`providerModelsSuggestionsAddSelected`)})]}),(0,$.jsx)(`p`,{className:`px-2 pb-1 pt-1 text-[11px] text-muted-foreground`,children:F(`providerModelsSuggestionsSaveHint`)})]}):null]})}function st({hasFetchedCatalog:e,hasSuggestionError:t,supportsModelDiscovery:n}){return!n||!t||e?null:(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:[(0,$.jsx)(C,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),F(`providerModelsSuggestionsFailed`)]})}function ct(e){let{providerName:n,providerModelAliases:r,models:i,modelConfig:s,modelDraft:c,showModelInput:l,onModelDraftChange:u,onShowModelInputChange:d,onAddModel:f,onModelsChange:p,supportsModelDiscovery:m,onDiscoverModels:h,isDiscoveringModels:g,fetchedModels:_,onRemoveModel:v,onToggleModelThinkingLevel:y,onSetModelThinkingDefault:b,onSetModelVision:x,thinkingLevels:S,formatThinkingLevelLabel:C}=e,[w,T]=(0,Y.useState)(!1),E=(0,Y.useRef)(null),{addSuggestedModels:D,hasSuggestionError:A,isCheckingSuggestions:M,suggestedModels:P,suggestionSource:I}=tt({providerName:n,models:i,aliases:r,fetchedModels:_,onModelsChange:p}),L=async()=>{await h()&&(T(!0),window.requestAnimationFrame(()=>{let e=E.current;e?.scrollIntoView?.({behavior:`smooth`,block:`center`}),e?.focus({preventScroll:!0})}))},R=_.length>0;return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(a,{className:`text-sm font-medium text-foreground`,children:F(`providerModelsTitle`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[m?(0,$.jsxs)(`button`,{type:`button`,onClick:L,disabled:g,className:`flex items-center gap-1 text-xs font-medium text-primary transition-colors hover:text-primary/80 disabled:cursor-wait disabled:opacity-60`,children:[(0,$.jsx)(j,{className:`h-3 w-3 ${g?`animate-spin`:``}`}),F(g?`providerModelsFetching`:`providerModelsFetch`)]}):null,l?null:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>d(!0),className:`flex items-center gap-1 text-xs font-medium text-primary hover:text-primary/80`,children:[(0,$.jsx)(k,{className:`h-3 w-3`}),F(`providerAddModel`)]})]})]}),l?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(t,{value:c,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),f()),e.key===`Escape`&&(d(!1),u(``))},placeholder:F(`providerModelInputPlaceholder`),className:`flex-1 rounded-xl`,autoFocus:!0}),(0,$.jsx)(o,{type:`button`,size:`sm`,onClick:f,disabled:c.trim().length===0,children:F(`add`)}),(0,$.jsx)(o,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{d(!1),u(``)},children:(0,$.jsx)(N,{className:`h-4 w-4`})})]}):null,(0,$.jsx)(st,{hasFetchedCatalog:R,hasSuggestionError:A,supportsModelDiscovery:m}),m&&M&&!R?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-muted/35 px-3 py-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(O,{className:`h-3.5 w-3.5 animate-spin`}),F(`providerModelsSuggestionsChecking`)]}):m&&(P.length>0||R)?(0,$.jsx)(`div`,{ref:E,tabIndex:-1,"aria-live":`polite`,className:`scroll-m-4 outline-none`,children:(0,$.jsx)(ot,{expanded:w,fetchedTotal:_.length,models:P,source:I,onExpandedChange:T,onAddModels:D})}):null,i.length===0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-muted/35 px-4 py-6 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:F(`providerModelsEmptyShort`)}),l?null:(0,$.jsx)(`button`,{type:`button`,onClick:()=>d(!0),className:`mt-2 text-sm font-medium text-primary hover:text-primary/80`,children:F(`providerAddFirstModel`)})]}):(0,$.jsx)(nt,{models:i,modelConfig:s,onModelsChange:p,onRemoveModel:v,onToggleModelThinkingLevel:y,onSetModelThinkingDefault:b,onSetModelVision:x,thinkingLevels:S,formatThinkingLevelLabel:C})]})}function lt({apiKeyRequired:e=!0,apiKeySet:t,className:n,enabled:r}){if(!r)return(0,$.jsx)(W,{status:`inactive`,label:F(`disabled`),className:n});let i=!e||t;return(0,$.jsx)(W,{status:i?`ready`:`setup`,label:F(i?`statusReady`:`statusSetup`),className:n})}function ut(e){let{context:n,language:r,providerTitle:i,providerDisplayName:s,apiKey:c,apiBase:l,extraHeaders:u,wireApi:d,models:f,modelConfig:p,modelDraft:m,showAdvanced:h,showModelInput:g,resolvedAuthMethodId:_,authSessionId:v,authStatusMessage:y,hasChanges:b,isDeletePending:x,isUpdatePending:S,connectivity:C,startPending:w,importPending:T,onProviderDisplayNameChange:E,onApiKeyChange:D,onApiBaseChange:O,onAuthMethodChange:k,onStartProviderAuth:j,onImportProviderAuthFromCli:M,onModelDraftChange:N,onShowModelInputChange:P,onAddModel:I,onModelsChange:L,onRemoveModel:R,onToggleModelThinkingLevel:z,onSetModelThinkingDefault:B,onSetModelVision:V,onShowAdvancedChange:H,onWireApiChange:U,onExtraHeadersChange:W,onDeleteProvider:te,onSubmit:ne,onTestConnection:G}=e,K=n.providerAuthMethods.find(e=>e.id===_);return(0,$.jsxs)(ge,{children:[(0,$.jsx)(pe,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`truncate text-lg font-semibold text-foreground`,children:i}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:te,disabled:x,className:`text-muted-foreground/70 transition-colors hover:text-red-500`,title:F(`providerDelete`),children:(0,$.jsx)(A,{className:`h-4 w-4`})}),(0,$.jsx)(lt,{enabled:n.currentEnabled,apiKeyRequired:n.resolvedProviderConfig.apiKeyRequired,apiKeySet:n.resolvedProviderConfig.apiKeySet})]})]})}),(0,$.jsxs)(`form`,{onSubmit:ne,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(_e,{className:`space-y-4 px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(a,{htmlFor:`providerDisplayName`,className:`text-sm font-medium text-foreground`,children:F(`providerDisplayName`)}),(0,$.jsx)(t,{id:`providerDisplayName`,type:`text`,value:s,onChange:e=>E(e.target.value),placeholder:n.defaultDisplayName||F(`providerDisplayNamePlaceholder`),className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:F(`providerDisplayNameHelpShort`)})]}),(0,$.jsx)(et,{apiKey:c,apiKeyRequired:n.resolvedProviderConfig.apiKeyRequired!==!1,apiKeySet:n.resolvedProviderConfig.apiKeySet,apiKeyPlaceholder:n.apiKeyHint?.placeholder??F(`enterApiKey`),providerAuth:n.providerAuth,providerAuthNote:n.providerAuth?.note?.[r]||n.providerAuth?.note?.en||n.providerAuth?.displayName||``,providerAuthMethodOptions:n.providerAuthMethodOptions,providerAuthMethodsCount:n.providerAuthMethods.length,selectedAuthMethodHint:K?.hint?.[r]||K?.hint?.en||``,shouldUseAuthMethodPills:n.shouldUseAuthMethodPills,resolvedAuthMethodId:_,onAuthMethodChange:k,onStartProviderAuth:j,onImportProviderAuthFromCli:M,startPending:w,importPending:T,authSessionId:v,authStatusMessage:y,onApiKeyChange:D}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(a,{htmlFor:`apiBase`,className:`text-sm font-medium text-foreground`,children:F(`apiBase`)}),(0,$.jsx)(t,{id:`apiBase`,type:`text`,value:l,onChange:e=>O(e.target.value),placeholder:n.defaultApiBase||n.apiBaseHint?.placeholder||`https://api.example.com`,className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.apiBaseHelpText})]}),(0,$.jsx)(ct,{providerName:n.providerConfig?.providerId??``,providerModelAliases:n.providerModelAliases,models:f,modelConfig:p,modelDraft:m,showModelInput:g,onModelDraftChange:N,onShowModelInputChange:P,onAddModel:I,onModelsChange:L,supportsModelDiscovery:n.supportsModelDiscovery,onDiscoverModels:C.discoverModels,isDiscoveringModels:C.isDiscoveringModels,fetchedModels:C.fetchedModels,onRemoveModel:R,onToggleModelThinkingLevel:z,onSetModelThinkingDefault:B,onSetModelVision:V,thinkingLevels:ee,formatThinkingLevelLabel:Fe},n.providerConfig?.providerId),(0,$.jsx)(Qe,{showAdvanced:h,onShowAdvancedChange:H,supportsWireApi:n.supportsWireApi,wireApiLabel:F(`wireApi`),wireApi:d,onWireApiChange:U,shouldUseWireApiPills:n.shouldUseWireApiPills,wireApiSelectOptions:n.wireApiSelectOptions,extraHeadersLabel:F(`extraHeaders`),extraHeaders:u,onExtraHeadersChange:W})]}),(0,$.jsx)(ye,{children:(0,$.jsxs)(de,{align:`between`,children:[(0,$.jsxs)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:G,disabled:C.isTestPending,children:[(0,$.jsx)(be,{className:`mr-1.5 h-3.5 w-3.5`}),C.isTestPending?F(`providerTestingConnection`):F(`providerTestConnection`)]}),(0,$.jsx)(o,{type:`submit`,size:`sm`,disabled:S||!b,children:F(S?`saving`:b?`save`:`unchanged`)})]})})]})]})}function dt({providerName:e,onProviderDeleted:t}){let{data:n}=ce(),{data:r}=q(),{data:i}=le(),a=P(),o=(0,Y.useMemo)(()=>qe({providerName:e,providersView:n,templatesView:r,schema:i,language:a}),[a,e,n,i,r]);if(!e||!o.providerConfig)return(0,$.jsx)(ve,{children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:F(`providersSelectTitle`)}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:F(`providersSelectDescription`)})]})});let s=JSON.stringify({providerConfig:o.providerConfig,currentApiBase:o.currentApiBase,currentEditableModels:o.currentEditableModels,currentModelConfig:o.currentModelConfig,currentWireApi:o.currentWireApi,effectiveDisplayName:o.effectiveDisplayName,preferredAuthMethodId:o.preferredAuthMethodId});return(0,$.jsx)(ft,{providerName:e,onProviderDeleted:t,context:o,language:a},s)}function ft({providerName:e,onProviderDeleted:t,context:n,language:r}){let i=ue(),a=ne(),{currentApiBase:o,currentEditableModels:s,currentHeaders:c,currentModelConfig:l,currentWireApi:u,defaultApiBase:d,effectiveDisplayName:f,providerAuth:p,providerAuthMethods:m,providerModelAliases:h,resolvedProviderConfig:g,preferredAuthMethodId:_,supportsWireApi:v}=n,[y,b]=(0,Y.useState)(``),[x,S]=(0,Y.useState)(o),[C,w]=(0,Y.useState)(g.extraHeaders||null),[T,E]=(0,Y.useState)(u),[D,O]=(0,Y.useState)(s),[k,A]=(0,Y.useState)(l),[j,M]=(0,Y.useState)(``),[N,P]=(0,Y.useState)(f),[I,L]=(0,Y.useState)(!1),[R,z]=(0,Y.useState)(!1),[B,V]=(0,Y.useState)(_),H=Ye({providerName:e,apiKey:y,apiKeyRequired:g.apiKeyRequired!==!1,apiKeySet:g.apiKeySet,apiBase:x,extraHeaders:C,supportsWireApi:v,wireApi:T,models:D,providerModelAliases:h}),ee=N.trim()||f||e||F(`providersSelectPlaceholder`),U=(0,Y.useMemo)(()=>{if(!m.length)return``;let e=B.trim();return e&&m.some(t=>t.id===e)?e:_||m[0]?.id||``},[B,_,m]),{authSessionId:W,authStatusMessage:te,importAuthFromCli:G,importPending:K,startAuth:q,startPending:re}=Je({providerName:e,providerAuth:p,resolvedAuthMethodId:U}),ie=(0,Y.useMemo)(()=>je({providerName:e,apiKey:y,apiBase:x,currentApiBase:o,extraHeaders:C,currentHeaders:c,supportsWireApi:v,wireApi:T,currentWireApi:u,models:D,currentEditableModels:s,modelConfig:k,currentModelConfig:l,providerDisplayName:N,effectiveDisplayName:f}),[e,y,x,o,C,c,v,T,u,D,s,k,l,N,f]),ae=e=>{O(e),A(t=>Oe(t,e))};return(0,$.jsx)(ut,{context:n,language:r,providerTitle:ee,providerDisplayName:N,apiKey:y,apiBase:x,extraHeaders:C,wireApi:T,models:D,modelConfig:k,modelDraft:j,showAdvanced:I,showModelInput:R,resolvedAuthMethodId:U,authSessionId:W,authStatusMessage:te,hasChanges:ie,isDeletePending:a.isPending,isUpdatePending:i.isPending,connectivity:H,startPending:re,importPending:K,onProviderDisplayNameChange:P,onApiKeyChange:b,onApiBaseChange:S,onAuthMethodChange:V,onStartProviderAuth:q,onImportProviderAuthFromCli:G,onModelDraftChange:M,onShowModelInputChange:z,onAddModel:()=>{let e=Re(D,j,h);ae(e.models),M(e.draft)},onModelsChange:ae,onRemoveModel:e=>{let t=Ve(D,k,e);O(t.models),A(t.modelConfig)},onToggleModelThinkingLevel:(e,t)=>{A(n=>He(n,e,t))},onSetModelThinkingDefault:(e,t)=>{A(n=>Ue(n,e,t))},onSetModelVision:(e,t)=>{A(n=>We(n,e,t))},onShowAdvancedChange:L,onWireApiChange:E,onExtraHeadersChange:w,onDeleteProvider:async()=>{if(e&&window.confirm(F(`providerDeleteConfirm`)))try{await a.mutateAsync({provider:e}),t?.(e)}catch{}},onSubmit:t=>{t.preventDefault(),e&&i.mutate({provider:e,data:Me({providerName:e,apiKey:y,apiBase:x,currentApiBase:o,defaultApiBase:d,extraHeaders:C,currentHeaders:c,supportsWireApi:v,wireApi:T,currentWireApi:u,models:D,currentEditableModels:s,modelConfig:k,currentModelConfig:l,providerDisplayName:N,effectiveDisplayName:f})})},onTestConnection:H.testConnection})}function pt(e){if(!e)return null;try{let t=new URL(e);return`${t.host}${t.pathname&&t.pathname!==`/`?t.pathname:``}`}catch{return e.replace(/^https?:\/\//,``)}}function mt(e,t=[]){let n=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({provider:e,index:t})).sort((e,t)=>{let r=n.get(e.provider.providerId),i=n.get(t.provider.providerId);if(r!==void 0||i!==void 0)return(r??2**53-1)-(i??2**53-1);let a=e.provider.providerType===`nextclaw`?1:0,o=t.provider.providerType===`nextclaw`?1:0;return a===o?e.index-t.index:a-o}).map(({provider:e})=>e)}function ht(e){let t=e.findIndex(e=>e.providerType===`zhipu`),n=e.findIndex(e=>e.providerType===`dashscope-coding-plan`);return e.map((e,t)=>({template:e,index:t})).sort((e,r)=>{let i=({template:e,index:r})=>e.providerType===`nextclaw`?2**53-1:e.providerType===`deepseek`&&n>=0?n-.5:e.providerType===`mimo`&&t>=0?t+.5:r;return i(e)-i(r)}).map(({template:e})=>e)}function gt(){let{isMobile:e}=h(),{data:n}=ce(),{data:a}=q(),c=ie(),l=ne(),u=ue(),[d,f]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)([]),[S,C]=(0,Y.useState)(``),w=(0,Y.useMemo)(()=>mt(Object.values(n?.providers??{}),b),[n?.providers,b]),D=(0,Y.useMemo)(()=>a?.providerTemplates??[],[a?.providerTemplates]),O=(0,Y.useMemo)(()=>ht(D),[D]),j=(0,Y.useMemo)(()=>new Map(D.map(e=>[e.providerType,e])),[D]),M=(0,Y.useMemo)(()=>{let e=S.trim().toLowerCase();return w.filter(t=>{if(!e)return!0;let n=t.providerType?j.get(t.providerType):null;return(t.displayName?.trim()||n?.displayName||t.providerId).toLowerCase().includes(e)||t.providerId.toLowerCase().includes(e)})},[w,S,j]),N=(0,Y.useMemo)(()=>d&&M.some(e=>e.providerId===d)?d:e?null:M[0]?.providerId??null,[M,e,d]);return!n||!a?(0,$.jsx)(r,{title:F(`providersPageTitle`),description:F(`providersPageDescription`),layout:`split`,children:(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:F(`providersLoading`)})}):(0,$.jsxs)(r,{title:F(`providersPageTitle`),description:F(`providersPageDescription`),layout:`split`,children:[(0,$.jsxs)(fe,{className:`md:min-h-0`,compactView:d?`detail`:`list`,onMobileBack:()=>f(null),mobileListLabel:F(`providersPageTitle`),children:[(0,$.jsxs)(he,{children:[(0,$.jsx)(pe,{className:`space-y-3 px-4 pb-3 pt-4`,children:(0,$.jsxs)(H,{open:v,onOpenChange:y,children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsxs)(o,{type:`button`,variant:`outline`,className:`w-full justify-center`,disabled:c.isPending,children:[(0,$.jsx)(k,{className:`mr-2 h-4 w-4`}),c.isPending?F(`saving`):F(`providerAdd`)]})}),(0,$.jsxs)(z,{className:`w-[42rem] max-w-[calc(100vw-2rem)] p-3`,align:`start`,children:[(0,$.jsx)(`div`,{className:`mb-2 px-1 text-xs font-semibold text-muted-foreground`,children:F(`providerTemplatePickerTitle`)}),(0,$.jsxs)(`div`,{className:`grid max-h-[24rem] grid-cols-2 gap-2 overflow-y-auto sm:grid-cols-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full flex-col items-start gap-2 rounded-lg border border-dashed border-border/70 bg-muted/20 px-3 py-2 text-left transition-colors hover:border-border hover:bg-[var(--interaction-hover)]`,onClick:async()=>{try{let e=await c.mutateAsync({data:{providerType:null}});C(``),f(e.providerId),x(t=>[e.providerId,...t.filter(t=>t!==e.providerId)]),y(!1)}catch{}},children:[(0,$.jsx)(U,{name:`custom`,className:`h-8 w-8 rounded-lg border border-border/60 bg-muted/50`}),(0,$.jsx)(`span`,{className:`line-clamp-2 min-w-0 text-xs font-semibold leading-4 text-foreground`,children:F(`providerAddCustom`)})]}),O.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full flex-col items-start gap-2 rounded-lg border border-border/55 bg-muted/15 px-3 py-2 text-left transition-colors hover:border-border/80 hover:bg-[var(--interaction-hover)]`,onClick:async()=>{try{let t=await c.mutateAsync({data:{providerType:e.providerType}});C(``),f(t.providerId),x(e=>[t.providerId,...e.filter(e=>e!==t.providerId)]),y(!1)}catch{}},children:[(0,$.jsx)(U,{name:e.providerType,src:e.logo?`/logos/${e.logo}`:null,className:`h-8 w-8 rounded-lg border border-border/55 bg-background`,imgClassName:`h-4 w-4 object-contain`}),(0,$.jsx)(`span`,{className:`line-clamp-2 min-w-0 text-xs font-semibold leading-4 text-foreground`,children:e.displayName||e.providerType})]},e.providerType))]})]})]})}),(0,$.jsx)(`div`,{className:`border-b border-border/70 px-4 py-3`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(m,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,$.jsx)(t,{value:S,onChange:e=>C(e.target.value),placeholder:F(`providersFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,$.jsxs)(_e,{className:`space-y-2 p-3`,children:[M.map(e=>{let t=e.providerType?j.get(e.providerType):null,n=e.enabled!==!1,r=I(e),a=e.displayName?.trim()||t?.displayName||e.providerId,o=pt(e.apiBase||t?.defaultApiBase||``)||F(`providersDefaultDescription`);return(0,$.jsx)(`div`,{onClick:()=>f(e.providerId),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),f(e.providerId))},role:`button`,tabIndex:0,className:s(`group w-full rounded-xl p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,N===e.providerId?`bg-[var(--interaction-selection)] text-foreground`:`bg-transparent text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:(0,$.jsxs)(`div`,{className:`relative min-h-10`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 pr-20`,children:[(0,$.jsx)(U,{name:e.providerType??e.providerId,src:t?.logo?`/logos/${t.logo}`:null,className:`h-10 w-10 rounded-lg bg-background/80`,imgClassName:`h-5 w-5 object-contain`,fallback:(0,$.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:e.providerId[0]})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:a}),(0,$.jsx)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground/65`,children:e.providerId}),(0,$.jsxs)(`p`,{className:`line-clamp-1 text-[11px] text-muted-foreground`,children:[o,` · `,e.models?.length??0]})]})]}),(0,$.jsxs)(`div`,{className:`absolute right-0 top-0 flex items-center gap-1.5 opacity-70 transition-opacity group-hover:opacity-100`,children:[(0,$.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,$.jsx)(i,{checked:n,disabled:u.isPending,title:F(n?`disabled`:`enabled`),className:`h-[18px] w-8`,thumbClassName:`h-4 w-4 data-[state=checked]:translate-x-4`,onCheckedChange:t=>{u.mutateAsync({provider:e.providerId,data:{enabled:t},silentSuccess:!0})}})}),(0,$.jsxs)(H,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground/70 hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:e=>e.stopPropagation(),title:F(`more`),children:(0,$.jsx)(T,{className:`h-4 w-4`})})}),(0,$.jsx)(z,{className:`w-40 p-1`,align:`end`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-2 text-sm text-red-600 hover:bg-destructive/10`,onClick:()=>_(e.providerId),children:[(0,$.jsx)(A,{className:`h-4 w-4`}),F(`providerDelete`)]})})]})]}),(0,$.jsx)(W,{status:n?r?`ready`:`setup`:`inactive`,label:F(n?r?`statusReady`:`statusSetup`:`disabled`),className:`absolute bottom-0 right-0 justify-end`})]})},e.providerId)}),M.length===0?(0,$.jsx)(me,{icon:p,title:F(`providersNoMatch`)}):null]})]}),(0,$.jsx)(dt,{providerName:N??void 0,onProviderDeleted:e=>{x(t=>t.filter(t=>t!==e)),e===N&&f(null)}})]}),(0,$.jsx)(E,{open:!!g,onOpenChange:e=>{e||_(null)},title:F(`providerDelete`),description:g??void 0,confirmLabel:F(`delete`),variant:`destructive`,onCancel:()=>_(null),onConfirm:()=>{g&&l.mutateAsync({provider:g}).then(()=>{x(e=>e.filter(e=>e!==g)),g===N&&f(null),_(null)})}})]})}export{gt as ProvidersConfigPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-
|
|
1
|
+
import{t as e}from"./createLucideIcon-Cfo2ySi5.js";var t=e(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),n=e(`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`}]]),r=e(`Puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]);export{n,t as r,r as t};
|