@nextclaw/ui 0.12.20-beta.4 → 0.12.20-beta.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 +62 -0
- package/dist/assets/api-Dai6UR3J.js +15 -0
- package/dist/assets/{app-manager-provider-Ut9nVFKt.js → app-manager-provider-BZr5VxCe.js} +1 -1
- package/dist/assets/{app-navigation.config-C7d-xDPw.js → app-navigation.config-BjIj_FLm.js} +1 -1
- package/dist/assets/{channels-list-page-f5u_2f7-.js → channels-list-page-L6FFtRYn.js} +1 -1
- package/dist/assets/{chat-DgO9oYBw.js → chat-ZQIVJChB.js} +1 -1
- package/dist/assets/{chat-page-C5N-dkK9.js → chat-page-CR1yI96r.js} +1 -1
- package/dist/assets/{desktop-update-config-B5mULxzY.js → desktop-update-config-AXzb7OEa.js} +1 -1
- package/dist/assets/{dialog-CAdlv2a0.js → dialog-DgybjpeU.js} +1 -1
- package/dist/assets/{dist-DTgPE_Ga.js → dist-CxcPOISF.js} +1 -1
- package/dist/assets/{es2015-B191DO9z.js → es2015-BVRlEE06.js} +1 -1
- package/dist/assets/{index-DfOJWwRN.js → index-B7RsQ-ne.js} +2 -2
- package/dist/assets/marketplace-page-Bj55-6F2.js +1 -0
- package/dist/assets/{marketplace-page-Cj6hxOWm.js → marketplace-page-ClRW-W3g.js} +1 -1
- package/dist/assets/{mcp-marketplace-page-0trY07NU.js → mcp-marketplace-page-DtngnIi0.js} +1 -1
- package/dist/assets/mcp-marketplace-page-_Wu2VnHy.js +1 -0
- package/dist/assets/{model-config-C4zBDpyV.js → model-config-D_y8F0j6.js} +1 -1
- package/dist/assets/{notice-card-DEEfIIf5.js → notice-card-uzwjFyML.js} +1 -1
- package/dist/assets/{popover-C4M83BGN.js → popover-C8tMB7tR.js} +1 -1
- package/dist/assets/{provider-scoped-model-input-D1v_5RKi.js → provider-scoped-model-input-ORZutTDv.js} +1 -1
- package/dist/assets/{providers-list-CxQXNhT5.js → providers-list-DSc3d8me.js} +1 -1
- package/dist/assets/remote-rWiu3cys.js +1 -0
- package/dist/assets/{runtime-config-page-DPN1sxKg.js → runtime-config-page-B4uSax1I.js} +1 -1
- package/dist/assets/{search-config-Cyo-2Wrf.js → search-config-CaqqlsdW.js} +1 -1
- package/dist/assets/{secrets-config-D2phuPae.js → secrets-config-llf5ROde.js} +1 -1
- package/dist/assets/{select-NL5-Ubvj.js → select-uO-zhYsH.js} +1 -1
- package/dist/assets/{sessions-config-page-BBs6G8cH.js → sessions-config-page-BqOXte9x.js} +1 -1
- package/dist/assets/{setting-row-CnvqvLxs.js → setting-row-BIiXR4hx.js} +1 -1
- package/dist/assets/{tag-chip-zfqovaH4.js → tag-chip-DVbgpsYW.js} +1 -1
- package/dist/assets/{theme-provider-BLhTqOZp.js → theme-provider-BU77FNSB.js} +1 -1
- package/dist/assets/{tooltip-hnT0-WDr.js → tooltip-CvAtG-kT.js} +1 -1
- package/dist/assets/{use-config-BGcKvTL2.js → use-config-D2QgG7qc.js} +1 -1
- package/dist/assets/{use-confirm-dialog-C_u_TetV.js → use-confirm-dialog-BBClFV8E.js} +1 -1
- package/dist/assets/{use-infinite-scroll-loader-C1QDayWw.js → use-infinite-scroll-loader-CWzpUecQ.js} +1 -1
- package/dist/assets/{use-viewport-layout-DVh0C_oF.js → use-viewport-layout-C6EN0_eq.js} +1 -1
- package/dist/index.html +15 -15
- package/package.json +9 -9
- package/vite.config.ts +3 -1
- package/vitest.config.ts +3 -1
- package/dist/assets/api-BbqBjnWk.js +0 -15
- package/dist/assets/marketplace-page-M6lsjEvL.js +0 -1
- package/dist/assets/mcp-marketplace-page-BYJA0yRg.js +0 -1
- package/dist/assets/remote-PWLGVNWC.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,n as r,p as i}from"./i18n-C5Mibli1.js";import{At as a,Ct as o,Dt as s,Et as c,It as l,Mt as u,Ot as d,Pt as f,Rt as p,Tt as m,a as h,bt as g,c as _,i as ee,jt as v,kt as y,l as te,o as ne,r as b,s as re,u as x,ut as S,wt as C}from"./api-BbqBjnWk.js";import{a as ie,n as ae,o as oe,r as se,t as w}from"./dialog-CAdlv2a0.js";import{t as T}from"./createLucideIcon-BZkY6emz.js";import{t as ce}from"./key-round-CnI1mc9F.js";import{t as E}from"./refresh-ccw-Bii4w8aB.js";import{t as D}from"./notice-card-DEEfIIf5.js";import{t as O}from"./status-dot-Dv_hiUVa.js";var k=T(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),A=T(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),j=T(`SquareArrowOutUpRight`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]);function M(){return p({queryKey:I,queryFn:h,staleTime:5e3,refetchOnWindowFocus:!0})}var N=e(n(),1),P=i();function F(e){let{label:t,muted:n,value:r}=e;return(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,P.jsx)(`span`,{className:`text-gray-500`,children:t}),(0,P.jsx)(`span`,{className:n?`text-right text-gray-500`:`text-right text-gray-900`,children:r==null||r===``?`-`:String(r)})]})}function le(){let e=$(),n=M(),i=n.data,a=U(e=>e.actionLabel),l=(0,N.useMemo)(()=>q(i),[i]),f=!!a,p=i?.runtime?.deviceName?.trim()||i?.settings.deviceName?.trim()||t(`remoteDeviceNameAuto`),h=!!(i?.account.loggedIn&&H(i)),{hero:g,issueHint:_}=l;return(0,N.useEffect)(()=>{e.remoteAccessManager.syncStatus(i)},[e,i]),n.isLoading&&!i?(0,P.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`remoteLoading`)}):(0,P.jsxs)(y,{className:`space-y-6`,children:[(0,P.jsx)(d,{title:t(`remotePageTitle`),description:t(`remotePageDescription`)}),(0,P.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,P.jsxs)(o,{children:[(0,P.jsxs)(c,{className:`space-y-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(s,{children:g.title}),(0,P.jsx)(O,{status:g.badgeStatus,label:g.badgeLabel})]}),(0,P.jsx)(m,{children:g.description})]}),(0,P.jsxs)(C,{className:`space-y-5`,children:[(0,P.jsxs)(D,{tone:`neutral`,children:[(0,P.jsx)(F,{label:t(`remoteSignedInAccount`),value:i?.account.email}),(0,P.jsx)(F,{label:t(`remoteDeviceName`),value:p}),(0,P.jsx)(F,{label:t(`remoteConnectionStatus`),value:g.badgeLabel}),(0,P.jsx)(F,{label:t(`remoteLastConnectedAt`),value:i?.runtime?.lastConnectedAt?r(i.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[l.primaryAction?(0,P.jsxs)(u,{onClick:()=>{if(l.primaryAction?.kind===`reauthorize`){e.remoteAccessManager.reauthorizeRemoteAccess(i);return}if(l.primaryAction?.kind===`repair`){e.remoteAccessManager.repairRemoteAccess(i);return}e.remoteAccessManager.enableRemoteAccess(i)},disabled:f,children:[l.primaryAction.showRefreshIcon?(0,P.jsx)(E,{className:`mr-2 h-4 w-4`}):null,a||l.primaryAction.label]}):null,(0,P.jsxs)(u,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:f||!h,children:[(0,P.jsx)(j,{className:`mr-2 h-4 w-4`}),t(`remoteOpenDeviceList`)]}),i?.settings.enabled?(0,P.jsx)(u,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(i),disabled:f,children:t(`remoteDisable`)}):null]}),l.shouldShowIssueHint&&_?(0,P.jsx)(D,{tone:`warning`,title:_.title,description:_.body}):null,(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`remoteOpenWebHint`)})]})]}),(0,P.jsxs)(o,{children:[(0,P.jsxs)(c,{children:[(0,P.jsxs)(s,{className:`flex items-center gap-2`,children:[(0,P.jsx)(k,{className:`h-4 w-4 text-primary`}),t(`remoteDeviceSectionTitle`)]}),(0,P.jsx)(m,{children:t(`remoteDeviceSectionDescription`)})]}),(0,P.jsxs)(C,{className:`space-y-5`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsx)(O,{status:i?.account.loggedIn?`ready`:`inactive`,label:i?.account.loggedIn?t(`remoteAccountConnected`):t(`remoteAccountNotConnected`)}),(0,P.jsx)(O,{status:i?.settings.enabled?`active`:`inactive`,label:i?.settings.enabled?t(`remoteEnabled`):t(`remoteStateDisabled`)}),(0,P.jsx)(O,{status:i?.service.running?`active`:`inactive`,label:i?.service.running?t(`remoteServiceRunning`):t(`remoteServiceStopped`)})]}),(0,P.jsxs)(D,{tone:`neutral`,children:[(0,P.jsx)(F,{label:t(`remoteDeviceName`),value:p}),(0,P.jsx)(F,{label:t(`remoteConnectionStatus`),value:g.badgeLabel}),(0,P.jsx)(F,{label:t(`remoteLastConnectedAt`),value:i?.runtime?.lastConnectedAt?r(i.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,P.jsx)(D,{tone:`neutral`,borderStyle:`dashed`,description:i?.account.loggedIn?t(`remoteOpenWebHint`):t(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})]})]})]})}var I=[`remote-status`],ue=`https://platform.nextclaw.io`,L=`https://nextclaw-platform-console.pages.dev`,R=async()=>await f.fetchQuery({queryKey:I,queryFn:h,staleTime:5e3}),z=async()=>(await f.invalidateQueries({queryKey:I}),await R()),B=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function V(e){let t=e?.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname===`platform.nextclaw.io`||n.hostname===`nextclaw-platform-console.pages.dev`)return n.origin;if(n.hostname===`ai-gateway-api.nextclaw.io`)return ue;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return L}var H=e=>V(e?.account.apiBase)||V(e?.settings.platformApiBase)||V(e?.platformBase)||V(e?.account.platformBase)||void 0,U=g(e=>({enabled:!1,deviceName:``,platformApiBase:``,advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:r})=>e({enabled:t,deviceName:n,platformApiBase:r,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})})),W=class{constructor(){this.accountManager=null,this.bindAccountManager=e=>{this.accountManager=e},this.syncStatus=e=>{if(!e)return;let t=U.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{U.getState().setEnabled(e)},this.setDeviceName=e=>{U.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{U.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{U.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await z(),n=U.getState();if(!t.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`},apiBase:n.platformApiBase});return}await this.applyEnabledState(!0,t)},this.disableRemoteAccess=async e=>{let t=e??await z();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let n=e??await z();if(!n.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`}});return}let r=n.service.running?`restart`:`start`;await this.runManagedAction({actionLabel:t(r===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await b(r);let e=await z();this.hydrateDraftFromStatus(e)},successMessage:t(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await z();await this.accountManager?.startBrowserSignIn({status:t,apiBase:U.getState().platformApiBase,pendingAction:{type:`repair-remote`}})},this.saveAdvancedSettings=async e=>{let n=e??await z(),r=U.getState();await this.runManagedAction({actionLabel:t(`remoteActionSavingAdvanced`),job:async()=>{await x({enabled:r.enabled,deviceName:r.deviceName.trim(),platformApiBase:r.platformApiBase.trim()});let e=await z();this.hydrateDraftFromStatus(e)},successMessage:n.settings.enabled===r.enabled?t(`remoteSettingsSaved`):t(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:t(`remoteDoctorRunning`),job:async()=>{let e=await ee();U.getState().setDoctor(e)},successMessage:t(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,t(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,t(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,t(`remoteActionStopping`))},this.resumePendingActionAfterSignIn=async(e,t)=>{if(e){if(e.type===`enable-remote`){await this.applyEnabledState(!0,t);return}e.type===`repair-remote`&&await this.repairRemoteAccess(t)}},this.applyEnabledState=async(e,n)=>{let r=U.getState();await this.runManagedAction({actionLabel:t(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await x({enabled:e,deviceName:r.deviceName.trim(),platformApiBase:r.platformApiBase.trim()});let t=await z();this.hydrateDraftFromStatus(t),e?await b(t.service.running?`restart`:`start`):n.service.running&&await b(`restart`);let i=await z();this.hydrateDraftFromStatus(i)},successMessage:t(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await b(e),n=await z();this.hydrateDraftFromStatus(n),l.success(t.message)}})},this.hydrateDraftFromStatus=e=>{U.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{U.getState().beginAction(e.actionLabel);try{await e.job(),e.successMessage&&l.success(e.successMessage)}catch(e){let n=e instanceof Error?e.message:t(`error`);throw l.error(n),e}finally{U.getState().finishAction()}}}},de=[/invalid or expired token/i,/missing bearer token/i,/token expired/i,/token is invalid/i,/run "nextclaw login"/i,/browser sign-in again/i];function G(e){return e?.runtime?.lastError?.trim()||``}function fe(e){let n=t(`remoteStatusIssueDetailGeneric`),r=G(e);return r?`${n} (${r})`:n}function K(e){if(!e?.settings.enabled)return!1;let t=G(e);return de.some(e=>e.test(t))}function q(e){return K(e)?{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteStateReauthorizationRequired`),title:t(`remoteStatusReauthorizationTitle`),description:t(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:t(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:t(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:t(`statusReady`),title:t(`remoteStatusReadyTitle`),description:t(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:t(`connecting`),title:t(`remoteStatusConnectingTitle`),description:t(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteStateDisconnected`),title:t(`remoteStatusIssueTitle`),description:t(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:fe(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteServiceStopped`),title:t(`remoteStatusNeedsServiceTitle`),description:t(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:t(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:t(`statusInactive`),title:t(`remoteStatusNeedsEnable`),description:t(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:t(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:t(`statusSetup`),title:t(`remoteStatusNeedsSignIn`),description:t(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:t(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var J=g(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,pendingAction:null,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),setPendingAction:t=>e({pendingAction:t}),clearPendingAction:()=>e({pendingAction:null}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:r,intervalMs:i,statusMessage:a})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:r,authPollIntervalMs:i,authStatusMessage:a}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(e=>({authStatusMessage:t??e.authStatusMessage,authPollIntervalMs:n??e.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})}));function Y({label:e,value:t}){return(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,P.jsx)(`span`,{className:`text-gray-500`,children:e}),(0,P.jsx)(`span`,{className:`text-right text-gray-900`,children:t?.trim()||`-`})]})}function pe(e){let{email:n,username:r,role:i,canSubmitUsername:o,savingUsername:s,usernameDraft:c,onUsernameDraftChange:l,onSubmitUsername:d,onOpenDeviceList:f,onLogout:p}=e;return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(D,{tone:`success`,title:t(`accountPanelSignedInTitle`),description:t(`accountPanelSignedInDescription`)}),(0,P.jsxs)(D,{tone:`neutral`,children:[(0,P.jsx)(Y,{label:t(`remoteAccountEmail`),value:n}),(0,P.jsx)(Y,{label:t(`remoteAccountUsername`),value:r}),(0,P.jsx)(Y,{label:t(`remoteAccountRole`),value:i})]}),r?(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`remoteAccountUsernameLockedHelp`)}):(0,P.jsxs)(D,{tone:`warning`,title:t(`remoteAccountUsernameRequiredTitle`),description:t(`remoteAccountUsernameRequiredDescription`),children:[(0,P.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,P.jsx)(a,{htmlFor:`account-panel-username`,children:t(`remoteAccountUsername`)}),(0,P.jsx)(v,{id:`account-panel-username`,value:c,onChange:e=>l(e.target.value),placeholder:t(`remoteAccountUsernamePlaceholder`),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,P.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,P.jsx)(u,{disabled:!o,onClick:()=>void d(),children:t(s?`remoteAccountUsernameSaving`:`remoteAccountUsernameSave`)})})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,P.jsxs)(u,{onClick:()=>void f(),children:[(0,P.jsx)(j,{className:`mr-2 h-4 w-4`}),t(`remoteOpenDeviceList`)]}),(0,P.jsxs)(u,{variant:`outline`,onClick:()=>void p(),children:[(0,P.jsx)(A,{className:`mr-2 h-4 w-4`}),t(`remoteLogout`)]})]})]})}function me(e){let{authSessionId:n,authExpiresAt:i,authStatusMessage:a,authVerificationUri:o,onStartBrowserSignIn:s,onResumeBrowserSignIn:c}=e;return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(D,{tone:`neutral`,title:t(`accountPanelSignedOutTitle`),description:t(`accountPanelSignedOutDescription`),children:n?(0,P.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,P.jsx)(Y,{label:t(`remoteBrowserAuthSession`),value:n}),(0,P.jsx)(Y,{label:t(`remoteBrowserAuthExpiresAt`),value:i?r(i):`-`})]}):null}),a?(0,P.jsx)(`p`,{className:`text-sm text-gray-600`,children:a}):null,(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,P.jsx)(u,{onClick:()=>void s(),children:t(n?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),o?(0,P.jsx)(u,{variant:`outline`,onClick:c,children:t(`remoteBrowserAuthResume`)}):null]})]})}function he(){let e=$(),n=M(),r=J(e=>e.panelOpen),i=J(e=>e.authSessionId),a=J(e=>e.authVerificationUri),o=J(e=>e.authExpiresAt),s=J(e=>e.authStatusMessage),c=n.data,[l,u]=(0,N.useState)(``),[d,f]=(0,N.useState)(!1);(0,N.useEffect)(()=>{e.accountManager.syncRemoteStatus(c)},[e,c]);let p=!d&&l.trim().length>0&&!c?.account.username;return(0,P.jsx)(w,{open:r,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,P.jsxs)(ae,{className:`max-w-xl`,children:[(0,P.jsxs)(ie,{children:[(0,P.jsxs)(oe,{className:`flex items-center gap-2`,children:[(0,P.jsx)(ce,{className:`h-5 w-5 text-primary`}),t(`accountPanelTitle`)]}),(0,P.jsx)(se,{children:t(`accountPanelDescription`)})]}),c?.account.loggedIn?(0,P.jsx)(pe,{email:c.account.email,username:c.account.username,role:c.account.role,canSubmitUsername:p,savingUsername:d,usernameDraft:l,onUsernameDraftChange:u,onSubmitUsername:async()=>{f(!0);try{await e.accountManager.updateUsername(l)}finally{f(!1)}},onOpenDeviceList:()=>e.accountManager.openNextClawWeb(`/account`),onLogout:()=>e.accountManager.logout()}):(0,P.jsx)(me,{authSessionId:i,authExpiresAt:o,authStatusMessage:s,authVerificationUri:a,onStartBrowserSignIn:()=>e.accountManager.startBrowserSignIn(),onResumeBrowserSignIn:()=>e.accountManager.resumeBrowserSignIn()})]})})}function X({username:e}){let n=S(),[r,i]=(0,N.useState)(e??``),[a,l]=(0,N.useState)(``),d=r.trim().length>0&&a.length>0&&!n.isPending;return(0,P.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,P.jsxs)(o,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,P.jsxs)(c,{children:[(0,P.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:t(`authBrand`)}),(0,P.jsx)(s,{className:`text-2xl`,children:t(`authLoginTitle`)}),(0,P.jsx)(m,{children:t(`authLoginDescription`)})]}),(0,P.jsx)(C,{children:(0,P.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),d&&n.mutate({username:r.trim(),password:a})},children:[(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:t(`authUsername`)}),(0,P.jsx)(v,{value:r,onChange:e=>i(e.target.value),placeholder:t(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:t(`authPassword`)}),(0,P.jsx)(v,{type:`password`,value:a,onChange:e=>l(e.target.value),placeholder:t(`authPasswordPlaceholder`)})]}),(0,P.jsx)(u,{type:`submit`,className:`w-full`,disabled:!d,children:n.isPending?t(`authLoggingIn`):t(`authLoginAction`)})]})})]})})}var ge=class{constructor(){this.authPollTimerId=null,this.afterSignedIn=null,this.bindSignedInContinuation=e=>{this.afterSignedIn=e},this.openAccountPanel=()=>{J.getState().openPanel()},this.closeAccountPanel=()=>{J.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),J.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=await R();return t.account.loggedIn?!0:(e?.pendingAction&&J.getState().setPendingAction(e.pendingAction),this.openAccountPanel(),await this.startBrowserSignIn({apiBase:e?.apiBase,status:t}),!1)},this.startBrowserSignIn=async e=>{try{let n=e?.apiBase,r=e?.pendingAction,i=e?.status??await R();r&&J.getState().setPendingAction(r);let a=await _({apiBase:B(i,n)});J.getState().beginBrowserAuth({sessionId:a.sessionId,verificationUri:a.verificationUri,expiresAt:a.expiresAt,intervalMs:a.intervalMs,statusMessage:t(`remoteBrowserAuthWaiting`)}),window.open(a.verificationUri,`_blank`,`noopener,noreferrer`)||J.getState().setAuthStatusMessage(t(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let n=e instanceof Error?e.message:t(`remoteBrowserAuthStartFailed`);l.error(`${t(`remoteBrowserAuthStartFailed`)}: ${n}`)}},this.resumeBrowserSignIn=()=>{let e=J.getState().authVerificationUri;e&&window.open(e,`_blank`,`noopener,noreferrer`)},this.logout=async()=>{try{await ne(),J.getState().clearPendingAction(),J.getState().clearBrowserAuth(),await z(),l.success(t(`remoteLogoutSuccess`))}catch(e){let n=e instanceof Error?e.message:t(`remoteLogoutFailed`);l.error(`${t(`remoteLogoutFailed`)}: ${n}`)}},this.updateUsername=async e=>{try{await te({username:e.trim()}),await z(),l.success(t(`remoteAccountUsernameSetSuccess`))}catch(e){let n=e instanceof Error?e.message:t(`remoteAccountUsernameSetFailed`);l.error(`${t(`remoteAccountUsernameSetFailed`)}: ${n}`)}},this.openNextClawWeb=async(e=`/`)=>{let n=H(await R());if(!n){l.error(t(`remoteOpenWebUnavailable`));return}let r=new URL(e,`${n.replace(/\/+$/,``)}/`).toString();window.open(r,`_blank`,`noopener,noreferrer`)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=J.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=J.getState();if(e.authSessionId)try{let n=await R(),r=await re({sessionId:e.authSessionId,apiBase:B(n)});if(r.status===`pending`){J.getState().updateBrowserAuth({statusMessage:t(`remoteBrowserAuthWaiting`),intervalMs:r.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(r.status===`expired`){this.clearPollTimer(),J.getState().clearBrowserAuth(),l.error(r.message||t(`remoteBrowserAuthExpired`));return}J.getState().setAuthStatusMessage(t(`remoteBrowserAuthCompleted`));let i=await z(),{pendingAction:a}=J.getState();this.clearPollTimer(),J.getState().clearBrowserAuth(),l.success(t(`remoteLoginSuccess`)),a&&this.afterSignedIn&&await this.afterSignedIn(a,i),J.getState().clearPendingAction()}catch(e){this.clearPollTimer(),J.getState().clearBrowserAuth();let n=e instanceof Error?e.message:t(`remoteBrowserAuthPollFailed`);l.error(`${t(`remoteBrowserAuthPollFailed`)}: ${n}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.getBrowserAuthSummary=()=>{let e=J.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?r(e.authExpiresAt):`-`}}}},Z=new class{constructor(){this.accountManager=new ge,this.remoteAccessManager=new W}};Z.accountManager.bindSignedInContinuation(Z.remoteAccessManager.resumePendingActionAfterSignIn),Z.remoteAccessManager.bindAccountManager(Z.accountManager);var Q=(0,N.createContext)(null);function _e({children:e}){return(0,P.jsx)(Q.Provider,{value:Z,children:e})}function $(){let e=(0,N.useContext)(Q);if(!e)throw Error(`useAppManager must be used inside AppManagerProvider`);return e}export{q as a,U as c,z as d,B as f,M as h,he as i,I as l,le as m,$ as n,K as o,H as p,X as r,W as s,_e as t,R as u};
|
|
1
|
+
import{_ as e,i as t,m as n,n as r,p as i}from"./i18n-C5Mibli1.js";import{At as a,Ct as o,Dt as s,Et as c,It as l,Mt as u,Ot as d,Pt as f,Rt as p,Tt as m,a as h,bt as g,c as _,i as ee,jt as v,kt as y,l as te,o as ne,r as b,s as re,u as x,ut as S,wt as C}from"./api-Dai6UR3J.js";import{a as ie,n as ae,o as oe,r as se,t as w}from"./dialog-DgybjpeU.js";import{t as T}from"./createLucideIcon-BZkY6emz.js";import{t as ce}from"./key-round-CnI1mc9F.js";import{t as E}from"./refresh-ccw-Bii4w8aB.js";import{t as D}from"./notice-card-uzwjFyML.js";import{t as O}from"./status-dot-Dv_hiUVa.js";var k=T(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),A=T(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),j=T(`SquareArrowOutUpRight`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]);function M(){return p({queryKey:I,queryFn:h,staleTime:5e3,refetchOnWindowFocus:!0})}var N=e(n(),1),P=i();function F(e){let{label:t,muted:n,value:r}=e;return(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,P.jsx)(`span`,{className:`text-gray-500`,children:t}),(0,P.jsx)(`span`,{className:n?`text-right text-gray-500`:`text-right text-gray-900`,children:r==null||r===``?`-`:String(r)})]})}function le(){let e=$(),n=M(),i=n.data,a=U(e=>e.actionLabel),l=(0,N.useMemo)(()=>q(i),[i]),f=!!a,p=i?.runtime?.deviceName?.trim()||i?.settings.deviceName?.trim()||t(`remoteDeviceNameAuto`),h=!!(i?.account.loggedIn&&H(i)),{hero:g,issueHint:_}=l;return(0,N.useEffect)(()=>{e.remoteAccessManager.syncStatus(i)},[e,i]),n.isLoading&&!i?(0,P.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`remoteLoading`)}):(0,P.jsxs)(y,{className:`space-y-6`,children:[(0,P.jsx)(d,{title:t(`remotePageTitle`),description:t(`remotePageDescription`)}),(0,P.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,P.jsxs)(o,{children:[(0,P.jsxs)(c,{className:`space-y-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(s,{children:g.title}),(0,P.jsx)(O,{status:g.badgeStatus,label:g.badgeLabel})]}),(0,P.jsx)(m,{children:g.description})]}),(0,P.jsxs)(C,{className:`space-y-5`,children:[(0,P.jsxs)(D,{tone:`neutral`,children:[(0,P.jsx)(F,{label:t(`remoteSignedInAccount`),value:i?.account.email}),(0,P.jsx)(F,{label:t(`remoteDeviceName`),value:p}),(0,P.jsx)(F,{label:t(`remoteConnectionStatus`),value:g.badgeLabel}),(0,P.jsx)(F,{label:t(`remoteLastConnectedAt`),value:i?.runtime?.lastConnectedAt?r(i.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[l.primaryAction?(0,P.jsxs)(u,{onClick:()=>{if(l.primaryAction?.kind===`reauthorize`){e.remoteAccessManager.reauthorizeRemoteAccess(i);return}if(l.primaryAction?.kind===`repair`){e.remoteAccessManager.repairRemoteAccess(i);return}e.remoteAccessManager.enableRemoteAccess(i)},disabled:f,children:[l.primaryAction.showRefreshIcon?(0,P.jsx)(E,{className:`mr-2 h-4 w-4`}):null,a||l.primaryAction.label]}):null,(0,P.jsxs)(u,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:f||!h,children:[(0,P.jsx)(j,{className:`mr-2 h-4 w-4`}),t(`remoteOpenDeviceList`)]}),i?.settings.enabled?(0,P.jsx)(u,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(i),disabled:f,children:t(`remoteDisable`)}):null]}),l.shouldShowIssueHint&&_?(0,P.jsx)(D,{tone:`warning`,title:_.title,description:_.body}):null,(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`remoteOpenWebHint`)})]})]}),(0,P.jsxs)(o,{children:[(0,P.jsxs)(c,{children:[(0,P.jsxs)(s,{className:`flex items-center gap-2`,children:[(0,P.jsx)(k,{className:`h-4 w-4 text-primary`}),t(`remoteDeviceSectionTitle`)]}),(0,P.jsx)(m,{children:t(`remoteDeviceSectionDescription`)})]}),(0,P.jsxs)(C,{className:`space-y-5`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsx)(O,{status:i?.account.loggedIn?`ready`:`inactive`,label:i?.account.loggedIn?t(`remoteAccountConnected`):t(`remoteAccountNotConnected`)}),(0,P.jsx)(O,{status:i?.settings.enabled?`active`:`inactive`,label:i?.settings.enabled?t(`remoteEnabled`):t(`remoteStateDisabled`)}),(0,P.jsx)(O,{status:i?.service.running?`active`:`inactive`,label:i?.service.running?t(`remoteServiceRunning`):t(`remoteServiceStopped`)})]}),(0,P.jsxs)(D,{tone:`neutral`,children:[(0,P.jsx)(F,{label:t(`remoteDeviceName`),value:p}),(0,P.jsx)(F,{label:t(`remoteConnectionStatus`),value:g.badgeLabel}),(0,P.jsx)(F,{label:t(`remoteLastConnectedAt`),value:i?.runtime?.lastConnectedAt?r(i.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,P.jsx)(D,{tone:`neutral`,borderStyle:`dashed`,description:i?.account.loggedIn?t(`remoteOpenWebHint`):t(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})]})]})]})}var I=[`remote-status`],ue=`https://platform.nextclaw.io`,L=`https://nextclaw-platform-console.pages.dev`,R=async()=>await f.fetchQuery({queryKey:I,queryFn:h,staleTime:5e3}),z=async()=>(await f.invalidateQueries({queryKey:I}),await R()),B=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function V(e){let t=e?.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname===`platform.nextclaw.io`||n.hostname===`nextclaw-platform-console.pages.dev`)return n.origin;if(n.hostname===`ai-gateway-api.nextclaw.io`)return ue;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return L}var H=e=>V(e?.account.apiBase)||V(e?.settings.platformApiBase)||V(e?.platformBase)||V(e?.account.platformBase)||void 0,U=g(e=>({enabled:!1,deviceName:``,platformApiBase:``,advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:r})=>e({enabled:t,deviceName:n,platformApiBase:r,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})})),W=class{constructor(){this.accountManager=null,this.bindAccountManager=e=>{this.accountManager=e},this.syncStatus=e=>{if(!e)return;let t=U.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{U.getState().setEnabled(e)},this.setDeviceName=e=>{U.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{U.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{U.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await z(),n=U.getState();if(!t.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`},apiBase:n.platformApiBase});return}await this.applyEnabledState(!0,t)},this.disableRemoteAccess=async e=>{let t=e??await z();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let n=e??await z();if(!n.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`}});return}let r=n.service.running?`restart`:`start`;await this.runManagedAction({actionLabel:t(r===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await b(r);let e=await z();this.hydrateDraftFromStatus(e)},successMessage:t(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await z();await this.accountManager?.startBrowserSignIn({status:t,apiBase:U.getState().platformApiBase,pendingAction:{type:`repair-remote`}})},this.saveAdvancedSettings=async e=>{let n=e??await z(),r=U.getState();await this.runManagedAction({actionLabel:t(`remoteActionSavingAdvanced`),job:async()=>{await x({enabled:r.enabled,deviceName:r.deviceName.trim(),platformApiBase:r.platformApiBase.trim()});let e=await z();this.hydrateDraftFromStatus(e)},successMessage:n.settings.enabled===r.enabled?t(`remoteSettingsSaved`):t(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:t(`remoteDoctorRunning`),job:async()=>{let e=await ee();U.getState().setDoctor(e)},successMessage:t(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,t(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,t(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,t(`remoteActionStopping`))},this.resumePendingActionAfterSignIn=async(e,t)=>{if(e){if(e.type===`enable-remote`){await this.applyEnabledState(!0,t);return}e.type===`repair-remote`&&await this.repairRemoteAccess(t)}},this.applyEnabledState=async(e,n)=>{let r=U.getState();await this.runManagedAction({actionLabel:t(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await x({enabled:e,deviceName:r.deviceName.trim(),platformApiBase:r.platformApiBase.trim()});let t=await z();this.hydrateDraftFromStatus(t),e?await b(t.service.running?`restart`:`start`):n.service.running&&await b(`restart`);let i=await z();this.hydrateDraftFromStatus(i)},successMessage:t(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await b(e),n=await z();this.hydrateDraftFromStatus(n),l.success(t.message)}})},this.hydrateDraftFromStatus=e=>{U.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{U.getState().beginAction(e.actionLabel);try{await e.job(),e.successMessage&&l.success(e.successMessage)}catch(e){let n=e instanceof Error?e.message:t(`error`);throw l.error(n),e}finally{U.getState().finishAction()}}}},de=[/invalid or expired token/i,/missing bearer token/i,/token expired/i,/token is invalid/i,/run "nextclaw login"/i,/browser sign-in again/i];function G(e){return e?.runtime?.lastError?.trim()||``}function fe(e){let n=t(`remoteStatusIssueDetailGeneric`),r=G(e);return r?`${n} (${r})`:n}function K(e){if(!e?.settings.enabled)return!1;let t=G(e);return de.some(e=>e.test(t))}function q(e){return K(e)?{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteStateReauthorizationRequired`),title:t(`remoteStatusReauthorizationTitle`),description:t(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:t(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:t(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:t(`statusReady`),title:t(`remoteStatusReadyTitle`),description:t(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:t(`connecting`),title:t(`remoteStatusConnectingTitle`),description:t(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteStateDisconnected`),title:t(`remoteStatusIssueTitle`),description:t(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:fe(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteServiceStopped`),title:t(`remoteStatusNeedsServiceTitle`),description:t(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:t(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:t(`statusInactive`),title:t(`remoteStatusNeedsEnable`),description:t(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:t(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:t(`statusSetup`),title:t(`remoteStatusNeedsSignIn`),description:t(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:t(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var J=g(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,pendingAction:null,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),setPendingAction:t=>e({pendingAction:t}),clearPendingAction:()=>e({pendingAction:null}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:r,intervalMs:i,statusMessage:a})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:r,authPollIntervalMs:i,authStatusMessage:a}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(e=>({authStatusMessage:t??e.authStatusMessage,authPollIntervalMs:n??e.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})}));function Y({label:e,value:t}){return(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,P.jsx)(`span`,{className:`text-gray-500`,children:e}),(0,P.jsx)(`span`,{className:`text-right text-gray-900`,children:t?.trim()||`-`})]})}function pe(e){let{email:n,username:r,role:i,canSubmitUsername:o,savingUsername:s,usernameDraft:c,onUsernameDraftChange:l,onSubmitUsername:d,onOpenDeviceList:f,onLogout:p}=e;return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(D,{tone:`success`,title:t(`accountPanelSignedInTitle`),description:t(`accountPanelSignedInDescription`)}),(0,P.jsxs)(D,{tone:`neutral`,children:[(0,P.jsx)(Y,{label:t(`remoteAccountEmail`),value:n}),(0,P.jsx)(Y,{label:t(`remoteAccountUsername`),value:r}),(0,P.jsx)(Y,{label:t(`remoteAccountRole`),value:i})]}),r?(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`remoteAccountUsernameLockedHelp`)}):(0,P.jsxs)(D,{tone:`warning`,title:t(`remoteAccountUsernameRequiredTitle`),description:t(`remoteAccountUsernameRequiredDescription`),children:[(0,P.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,P.jsx)(a,{htmlFor:`account-panel-username`,children:t(`remoteAccountUsername`)}),(0,P.jsx)(v,{id:`account-panel-username`,value:c,onChange:e=>l(e.target.value),placeholder:t(`remoteAccountUsernamePlaceholder`),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,P.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,P.jsx)(u,{disabled:!o,onClick:()=>void d(),children:t(s?`remoteAccountUsernameSaving`:`remoteAccountUsernameSave`)})})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,P.jsxs)(u,{onClick:()=>void f(),children:[(0,P.jsx)(j,{className:`mr-2 h-4 w-4`}),t(`remoteOpenDeviceList`)]}),(0,P.jsxs)(u,{variant:`outline`,onClick:()=>void p(),children:[(0,P.jsx)(A,{className:`mr-2 h-4 w-4`}),t(`remoteLogout`)]})]})]})}function me(e){let{authSessionId:n,authExpiresAt:i,authStatusMessage:a,authVerificationUri:o,onStartBrowserSignIn:s,onResumeBrowserSignIn:c}=e;return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(D,{tone:`neutral`,title:t(`accountPanelSignedOutTitle`),description:t(`accountPanelSignedOutDescription`),children:n?(0,P.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,P.jsx)(Y,{label:t(`remoteBrowserAuthSession`),value:n}),(0,P.jsx)(Y,{label:t(`remoteBrowserAuthExpiresAt`),value:i?r(i):`-`})]}):null}),a?(0,P.jsx)(`p`,{className:`text-sm text-gray-600`,children:a}):null,(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,P.jsx)(u,{onClick:()=>void s(),children:t(n?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),o?(0,P.jsx)(u,{variant:`outline`,onClick:c,children:t(`remoteBrowserAuthResume`)}):null]})]})}function he(){let e=$(),n=M(),r=J(e=>e.panelOpen),i=J(e=>e.authSessionId),a=J(e=>e.authVerificationUri),o=J(e=>e.authExpiresAt),s=J(e=>e.authStatusMessage),c=n.data,[l,u]=(0,N.useState)(``),[d,f]=(0,N.useState)(!1);(0,N.useEffect)(()=>{e.accountManager.syncRemoteStatus(c)},[e,c]);let p=!d&&l.trim().length>0&&!c?.account.username;return(0,P.jsx)(w,{open:r,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,P.jsxs)(ae,{className:`max-w-xl`,children:[(0,P.jsxs)(ie,{children:[(0,P.jsxs)(oe,{className:`flex items-center gap-2`,children:[(0,P.jsx)(ce,{className:`h-5 w-5 text-primary`}),t(`accountPanelTitle`)]}),(0,P.jsx)(se,{children:t(`accountPanelDescription`)})]}),c?.account.loggedIn?(0,P.jsx)(pe,{email:c.account.email,username:c.account.username,role:c.account.role,canSubmitUsername:p,savingUsername:d,usernameDraft:l,onUsernameDraftChange:u,onSubmitUsername:async()=>{f(!0);try{await e.accountManager.updateUsername(l)}finally{f(!1)}},onOpenDeviceList:()=>e.accountManager.openNextClawWeb(`/account`),onLogout:()=>e.accountManager.logout()}):(0,P.jsx)(me,{authSessionId:i,authExpiresAt:o,authStatusMessage:s,authVerificationUri:a,onStartBrowserSignIn:()=>e.accountManager.startBrowserSignIn(),onResumeBrowserSignIn:()=>e.accountManager.resumeBrowserSignIn()})]})})}function X({username:e}){let n=S(),[r,i]=(0,N.useState)(e??``),[a,l]=(0,N.useState)(``),d=r.trim().length>0&&a.length>0&&!n.isPending;return(0,P.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,P.jsxs)(o,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,P.jsxs)(c,{children:[(0,P.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:t(`authBrand`)}),(0,P.jsx)(s,{className:`text-2xl`,children:t(`authLoginTitle`)}),(0,P.jsx)(m,{children:t(`authLoginDescription`)})]}),(0,P.jsx)(C,{children:(0,P.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),d&&n.mutate({username:r.trim(),password:a})},children:[(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:t(`authUsername`)}),(0,P.jsx)(v,{value:r,onChange:e=>i(e.target.value),placeholder:t(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:t(`authPassword`)}),(0,P.jsx)(v,{type:`password`,value:a,onChange:e=>l(e.target.value),placeholder:t(`authPasswordPlaceholder`)})]}),(0,P.jsx)(u,{type:`submit`,className:`w-full`,disabled:!d,children:n.isPending?t(`authLoggingIn`):t(`authLoginAction`)})]})})]})})}var ge=class{constructor(){this.authPollTimerId=null,this.afterSignedIn=null,this.bindSignedInContinuation=e=>{this.afterSignedIn=e},this.openAccountPanel=()=>{J.getState().openPanel()},this.closeAccountPanel=()=>{J.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),J.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=await R();return t.account.loggedIn?!0:(e?.pendingAction&&J.getState().setPendingAction(e.pendingAction),this.openAccountPanel(),await this.startBrowserSignIn({apiBase:e?.apiBase,status:t}),!1)},this.startBrowserSignIn=async e=>{try{let n=e?.apiBase,r=e?.pendingAction,i=e?.status??await R();r&&J.getState().setPendingAction(r);let a=await _({apiBase:B(i,n)});J.getState().beginBrowserAuth({sessionId:a.sessionId,verificationUri:a.verificationUri,expiresAt:a.expiresAt,intervalMs:a.intervalMs,statusMessage:t(`remoteBrowserAuthWaiting`)}),window.open(a.verificationUri,`_blank`,`noopener,noreferrer`)||J.getState().setAuthStatusMessage(t(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let n=e instanceof Error?e.message:t(`remoteBrowserAuthStartFailed`);l.error(`${t(`remoteBrowserAuthStartFailed`)}: ${n}`)}},this.resumeBrowserSignIn=()=>{let e=J.getState().authVerificationUri;e&&window.open(e,`_blank`,`noopener,noreferrer`)},this.logout=async()=>{try{await ne(),J.getState().clearPendingAction(),J.getState().clearBrowserAuth(),await z(),l.success(t(`remoteLogoutSuccess`))}catch(e){let n=e instanceof Error?e.message:t(`remoteLogoutFailed`);l.error(`${t(`remoteLogoutFailed`)}: ${n}`)}},this.updateUsername=async e=>{try{await te({username:e.trim()}),await z(),l.success(t(`remoteAccountUsernameSetSuccess`))}catch(e){let n=e instanceof Error?e.message:t(`remoteAccountUsernameSetFailed`);l.error(`${t(`remoteAccountUsernameSetFailed`)}: ${n}`)}},this.openNextClawWeb=async(e=`/`)=>{let n=H(await R());if(!n){l.error(t(`remoteOpenWebUnavailable`));return}let r=new URL(e,`${n.replace(/\/+$/,``)}/`).toString();window.open(r,`_blank`,`noopener,noreferrer`)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=J.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=J.getState();if(e.authSessionId)try{let n=await R(),r=await re({sessionId:e.authSessionId,apiBase:B(n)});if(r.status===`pending`){J.getState().updateBrowserAuth({statusMessage:t(`remoteBrowserAuthWaiting`),intervalMs:r.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(r.status===`expired`){this.clearPollTimer(),J.getState().clearBrowserAuth(),l.error(r.message||t(`remoteBrowserAuthExpired`));return}J.getState().setAuthStatusMessage(t(`remoteBrowserAuthCompleted`));let i=await z(),{pendingAction:a}=J.getState();this.clearPollTimer(),J.getState().clearBrowserAuth(),l.success(t(`remoteLoginSuccess`)),a&&this.afterSignedIn&&await this.afterSignedIn(a,i),J.getState().clearPendingAction()}catch(e){this.clearPollTimer(),J.getState().clearBrowserAuth();let n=e instanceof Error?e.message:t(`remoteBrowserAuthPollFailed`);l.error(`${t(`remoteBrowserAuthPollFailed`)}: ${n}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.getBrowserAuthSummary=()=>{let e=J.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?r(e.authExpiresAt):`-`}}}},Z=new class{constructor(){this.accountManager=new ge,this.remoteAccessManager=new W}};Z.accountManager.bindSignedInContinuation(Z.remoteAccessManager.resumePendingActionAfterSignIn),Z.remoteAccessManager.bindAccountManager(Z.accountManager);var Q=(0,N.createContext)(null);function _e({children:e}){return(0,P.jsx)(Q.Provider,{value:Z,children:e})}function $(){let e=(0,N.useContext)(Q);if(!e)throw Error(`useAppManager must be used inside AppManagerProvider`);return e}export{q as a,U as c,z as d,B as f,M as h,he as i,I as l,le as m,$ as n,K as o,H as p,X as r,W as s,_e as t,R as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-BZkY6emz.js";import{_ as t,f as n,g as r,h as i,m as a,v as o}from"./theme-provider-
|
|
1
|
+
import{t as e}from"./createLucideIcon-BZkY6emz.js";import{_ as t,f as n,g as r,h as i,m as a,v as o}from"./theme-provider-BU77FNSB.js";import{t as s}from"./search-vChioOoe.js";import{n as c}from"./refresh-cw-BxojR62w.js";import{t as l}from"./key-round-CnI1mc9F.js";import{t as u}from"./message-square-D6Z4NwpG.js";import{t as d}from"./settings-CiRChctQ.js";import{t as f}from"./sparkles-D1ZKWdm4.js";var p=e(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),m=e(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),h=e(`Plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),g=e(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),_=e(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]);function v(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function y(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)}function b(e){let t=e.toLowerCase();return t.startsWith(`/chat/`)&&t!==`/chat`}function x(e){return[{target:`/chat`,label:e(`chat`),icon:a},{target:`/skills`,label:e(`marketplaceFilterSkills`),icon:r},{target:`/agents`,label:e(`agentsPageTitle`),icon:t},{target:`/settings`,label:e(`settings`),icon:d}]}function S(e){return[{target:`/model`,label:e(`model`),icon:p},{target:`/providers`,label:e(`providers`),icon:f},{target:`/channels`,label:e(`channels`),icon:u},{target:`/search`,label:e(`searchChannels`),icon:s},{target:`/runtime`,label:e(`runtime`),icon:p},{target:`/updates`,label:e(`updates`),icon:c},{target:`/remote`,label:e(`remote`),icon:_},{target:`/security`,label:e(`security`),icon:g},{target:`/sessions`,label:e(`sessions`),icon:m},{target:`/secrets`,label:e(`secrets`),icon:l},{target:`/cron`,label:e(`cron`),icon:o},{target:`/marketplace/plugins`,label:e(`marketplaceFilterPlugins`),icon:h},{target:`/marketplace/mcp`,label:e(`marketplaceFilterMcp`),icon:n}]}function C(e){return[{target:`/language`,label:e(`language`),icon:i},...S(e)]}function w(e){let t=e.toLowerCase();return t===`/settings`?!0:C(e=>e).some(e=>v(t,e.target))}function T(e,t){let n=e.toLowerCase(),r=C(t);if(b(n))return{title:t(`chat`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/chat`)return{title:t(`chat`),backTarget:null,backLabel:null};if(n===`/skills`||n.startsWith(`/skills/`))return{title:t(`marketplaceFilterSkills`),backTarget:null,backLabel:null};if(n===`/agents`||n.startsWith(`/agents/`))return{title:t(`agentsPageTitle`),backTarget:null,backLabel:null};if(n===`/settings`)return{title:t(`settings`),backTarget:null,backLabel:null};for(let e of r)if(v(n,e.target))return{title:e.label,backTarget:`/settings`,backLabel:t(`settings`)};return{title:t(`settings`),backTarget:null,backLabel:null}}export{y as a,b as i,C as n,w as o,S as r,T as s,x as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,h as t,i as n,m as r,n as i,o as a,p as o,u as s}from"./i18n-C5Mibli1.js";import{At as c,It as l,Lt as u,Mt as d,Ot as f,Rt as p,St as m,Vt as h,dt as g,et as _,jt as v,kt as y,ot as b,tt as x}from"./api-BbqBjnWk.js";import{t as S}from"./createLucideIcon-BZkY6emz.js";import{t as C}from"./search-vChioOoe.js";import{t as ee}from"./book-open-DgLqYpNY.js";import{O as te,a as ne,i as re,n as ie,r as ae,t as oe}from"./select-NL5-Ubvj.js";import{t as w}from"./external-link-Sw3ah_JD.js";import{n as se,t as T}from"./logos-CqVm0q0W.js";import{t as ce}from"./hash-zajSTDXZ.js";import{t as le}from"./key-round-CnI1mc9F.js";import{t as E}from"./loader-circle-B5i8oMMY.js";import{t as ue}from"./message-square-D6Z4NwpG.js";import{t as de}from"./settings-CiRChctQ.js";import{t as fe}from"./x-DpTzXQcX.js";import{t as D}from"./status-dot-Dv_hiUVa.js";import{t as pe}from"./use-viewport-layout-DVh0C_oF.js";import{b as me,i as O,n as k,r as A,u as he}from"./use-config-BGcKvTL2.js";import{t as j}from"./logo-badge-BQgKnVtz.js";import{t as ge}from"./tabs-custom-CsACkVji.js";import{t as _e}from"./tag-chip-zfqovaH4.js";import{t as M}from"./config-hints-MogHYQ8G.js";import{a as N,c as P,i as ve,n as ye,o as F,r as be,s as xe,t as Se}from"./config-split-page-BMRGuCJQ.js";var Ce=S(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),we=S(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),I=S(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),Te=S(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),L=e(r(),1),R=o();function Ee({value:e,onChange:t,className:r,placeholder:i=``}){let[a,o]=(0,L.useState)(``),c=n=>{n.key===`Enter`&&a.trim()?(n.preventDefault(),t([...e,a.trim()]),o(``)):n.key===`Backspace`&&!a&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,R.jsxs)(`div`,{className:s(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,r),children:[e.map((e,t)=>(0,R.jsxs)(_e,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,R.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,R.jsx)(fe,{className:`h-3 w-3`})})]},t)),(0,R.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:i||n(`enterTag`)})]})}function De(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,R.jsx)(le,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,R.jsx)(se,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,R.jsx)(Ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,R.jsx)(ce,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,R.jsx)(Te,{className:`h-3.5 w-3.5 text-gray-500`}):(0,R.jsx)(de,{className:`h-3.5 w-3.5 text-gray-500`})}function Oe({channelName:e,fields:t,formData:r,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,R.jsx)(R.Fragment,{children:t.map(t=>{let l=M(`channels.${e}.${t.name}`,s),u=l?.label??t.label,d=l?.placeholder;return(0,R.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,R.jsxs)(c,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[De(t.name),u]}),t.type===`boolean`&&(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,R.jsx)(`span`,{className:`text-sm text-gray-500`,children:r[t.name]?n(`enabled`):n(`disabled`)}),(0,R.jsx)(g,{id:t.name,checked:r[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,R.jsx)(v,{id:t.name,type:t.type,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:d,className:`rounded-xl`}),t.type===`password`&&(0,R.jsx)(v,{id:t.name,type:`password`,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:d??n(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,R.jsx)(v,{id:t.name,type:`number`,value:r[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:d,className:`rounded-xl`}),t.type===`tags`&&(0,R.jsx)(Ee,{value:r[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,R.jsxs)(oe,{value:r[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,R.jsx)(re,{className:`rounded-xl`,children:(0,R.jsx)(ne,{})}),(0,R.jsx)(ie,{children:(t.options??[]).map(e=>(0,R.jsx)(ae,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,R.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var ke=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),z=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),B=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Ae=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),je=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Me=t((e=>{var t=z().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Ne=t((e=>{var t=z().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Pe=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),V=t((e=>{var t=B(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Fe=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Ie=t((e=>{var t=Fe();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Le=t(((e,t)=>{var n=Ie();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),H=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),U=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
1
|
+
import{_ as e,h as t,i as n,m as r,n as i,o as a,p as o,u as s}from"./i18n-C5Mibli1.js";import{At as c,It as l,Lt as u,Mt as d,Ot as f,Rt as p,St as m,Vt as h,dt as g,et as _,jt as v,kt as y,ot as b,tt as x}from"./api-Dai6UR3J.js";import{t as S}from"./createLucideIcon-BZkY6emz.js";import{t as C}from"./search-vChioOoe.js";import{t as ee}from"./book-open-DgLqYpNY.js";import{O as te,a as ne,i as re,n as ie,r as ae,t as oe}from"./select-uO-zhYsH.js";import{t as w}from"./external-link-Sw3ah_JD.js";import{n as se,t as T}from"./logos-CqVm0q0W.js";import{t as ce}from"./hash-zajSTDXZ.js";import{t as le}from"./key-round-CnI1mc9F.js";import{t as E}from"./loader-circle-B5i8oMMY.js";import{t as ue}from"./message-square-D6Z4NwpG.js";import{t as de}from"./settings-CiRChctQ.js";import{t as fe}from"./x-DpTzXQcX.js";import{t as D}from"./status-dot-Dv_hiUVa.js";import{t as pe}from"./use-viewport-layout-C6EN0_eq.js";import{b as me,i as O,n as k,r as A,u as he}from"./use-config-D2QgG7qc.js";import{t as j}from"./logo-badge-BQgKnVtz.js";import{t as ge}from"./tabs-custom-CsACkVji.js";import{t as _e}from"./tag-chip-DVbgpsYW.js";import{t as M}from"./config-hints-MogHYQ8G.js";import{a as N,c as P,i as ve,n as ye,o as F,r as be,s as xe,t as Se}from"./config-split-page-BMRGuCJQ.js";var Ce=S(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),we=S(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),I=S(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),Te=S(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),L=e(r(),1),R=o();function Ee({value:e,onChange:t,className:r,placeholder:i=``}){let[a,o]=(0,L.useState)(``),c=n=>{n.key===`Enter`&&a.trim()?(n.preventDefault(),t([...e,a.trim()]),o(``)):n.key===`Backspace`&&!a&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,R.jsxs)(`div`,{className:s(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,r),children:[e.map((e,t)=>(0,R.jsxs)(_e,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,R.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,R.jsx)(fe,{className:`h-3 w-3`})})]},t)),(0,R.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:i||n(`enterTag`)})]})}function De(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,R.jsx)(le,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,R.jsx)(se,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,R.jsx)(Ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,R.jsx)(ce,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,R.jsx)(Te,{className:`h-3.5 w-3.5 text-gray-500`}):(0,R.jsx)(de,{className:`h-3.5 w-3.5 text-gray-500`})}function Oe({channelName:e,fields:t,formData:r,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,R.jsx)(R.Fragment,{children:t.map(t=>{let l=M(`channels.${e}.${t.name}`,s),u=l?.label??t.label,d=l?.placeholder;return(0,R.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,R.jsxs)(c,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[De(t.name),u]}),t.type===`boolean`&&(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,R.jsx)(`span`,{className:`text-sm text-gray-500`,children:r[t.name]?n(`enabled`):n(`disabled`)}),(0,R.jsx)(g,{id:t.name,checked:r[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,R.jsx)(v,{id:t.name,type:t.type,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:d,className:`rounded-xl`}),t.type===`password`&&(0,R.jsx)(v,{id:t.name,type:`password`,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:d??n(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,R.jsx)(v,{id:t.name,type:`number`,value:r[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:d,className:`rounded-xl`}),t.type===`tags`&&(0,R.jsx)(Ee,{value:r[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,R.jsxs)(oe,{value:r[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,R.jsx)(re,{className:`rounded-xl`,children:(0,R.jsx)(ne,{})}),(0,R.jsx)(ie,{children:(t.options??[]).map(e=>(0,R.jsx)(ae,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,R.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var ke=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),z=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),B=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Ae=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),je=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Me=t((e=>{var t=z().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Ne=t((e=>{var t=z().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Pe=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),V=t((e=>{var t=B(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Fe=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Ie=t((e=>{var t=Fe();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Le=t(((e,t)=>{var n=Ie();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),H=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),U=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
2
|
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),W=t((e=>{var t=H(),n=U();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Re=t((e=>{var t=z(),n=V(),r=B(),i=W(),a=H(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),ze=t((e=>{var t=z(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),Be=t(((e,t)=>{var n=W();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Ve=t(((e,t)=>{var n=W(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),He=t(((e,t)=>{var n=W();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Ue=t(((e,t)=>{var n=W(),r=z();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
3
3
|
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),We=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),Ge=t((e=>{var t=W(),n=Be(),r=Ve(),i=He(),a=Ue(),o=U(),s=z(),c=We();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
4
4
|
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Ke=t((e=>{var t=z(),n=B(),r=Ae(),i=je(),a=Me(),o=Ne(),s=Pe(),c=V(),l=Le(),u=Re(),d=ze(),f=W(),p=Ge();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,m as s,n as c,p as l,t as u,u as d}from"./i18n-C5Mibli1.js";import{At as f,It as p,Kt as m,Lt as h,Mt as g,Nt as _,Pt as v,Rt as y,V as b,Vt as x,at as S,bt as C,f as w,gt as T,h as E,it as D,jt as O,m as ee,n as k,nt as te,p as A,rt as ne,t as j,v as re,vt as ie,xt as ae,y as oe,yt as se}from"./api-BbqBjnWk.js";import{a as ce,i as le,n as ue,o as de,r as fe,t as pe}from"./dialog-CAdlv2a0.js";import{t as M}from"./createLucideIcon-BZkY6emz.js";import{_ as me,c as he,d as ge,f as _e,g as ve,h as ye,l as be,m as xe,n as Se,p as Ce,s as we,u as Te,v as Ee}from"./theme-provider-BLhTqOZp.js";import{n as De,t as Oe}from"./search-vChioOoe.js";import{t as ke}from"./book-open-DgLqYpNY.js";import{D as Ae,O as je,_ as Me,b as Ne,c as Pe,d as Fe,f as Ie,g as Le,h as Re,i as ze,k as Be,l as Ve,m as He,n as Ue,o as We,p as Ge,r as Ke,s as qe,t as Je,u as Ye,v as Xe,y as Ze}from"./select-NL5-Ubvj.js";import{t as Qe}from"./external-link-Sw3ah_JD.js";import{t as $e}from"./folder-D7-VTnkz.js";import{n as et,t as tt}from"./logos-CqVm0q0W.js";import{t as nt}from"./loader-circle-B5i8oMMY.js";import{t as rt}from"./plus-Di0KAkiO.js";import{t as it}from"./refresh-ccw-Bii4w8aB.js";import{t as at}from"./settings-CiRChctQ.js";import{t as ot}from"./sparkles-D1ZKWdm4.js";import{t as st}from"./trash-2-rY9ZteZX.js";import{t as ct}from"./x-DpTzXQcX.js";import{i as lt}from"./doc-browser-context-DfLHAWbG.js";import{n as ut}from"./doc-browser-BUlCkZo2.js";import{n as dt,t as ft}from"./use-viewport-layout-DVh0C_oF.js";import{m as pt}from"./use-config-BGcKvTL2.js";import{a as mt,c as ht,i as gt,n as _t,o as vt,r as yt,s as bt,t as xt}from"./popover-C4M83BGN.js";import{t as St}from"./logo-badge-BQgKnVtz.js";import{a as Ct,c as wt,i as Tt,l as Et,n as Dt,o as Ot,r as kt,s as At,t as jt}from"./tooltip-hnT0-WDr.js";import{t as Mt}from"./skeleton-CFQRIUzt.js";var Nt=M(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Pt=M(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Ft=M(`Brain`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`,key:`ep3f8r`}],[`path`,{d:`M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4`,key:`1p4c4q`}],[`path`,{d:`M17.599 6.5a3 3 0 0 0 .399-1.375`,key:`tmeiqw`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M19.938 10.5a4 4 0 0 1 .585.396`,key:`1qfode`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M19.967 17.484A4 4 0 0 1 18 18`,key:`159ez6`}]]),It=M(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Lt=M(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Rt=M(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),zt=M(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Bt=M(`FileArchive`,[[`path`,{d:`M10 12v-1`,key:`v7bkov`}],[`path`,{d:`M10 18v-2`,key:`1cjy8d`}],[`path`,{d:`M10 7V6`,key:`dljcrl`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01`,key:`gkbcor`}],[`circle`,{cx:`10`,cy:`20`,r:`2`,key:`1xzdoj`}]]),Vt=M(`FileAudio2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2`,key:`17k7jt`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`3`,cy:`17`,r:`1`,key:`vo6nti`}],[`path`,{d:`M2 17v-3a4 4 0 0 1 8 0v3`,key:`1ggdre`}],[`circle`,{cx:`9`,cy:`17`,r:`1`,key:`bc1fq4`}]]),Ht=M(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Ut=M(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Wt=M(`FileJson2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`fq0c9t`}],[`path`,{d:`M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`4gibmv`}]]),Gt=M(`FileSpreadsheet`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),Kt=M(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),qt=M(`FileVideo2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`rect`,{width:`8`,height:`6`,x:`2`,y:`12`,rx:`1`,key:`1a6c1e`}],[`path`,{d:`m10 15.5 4 2.5v-6l-4 2.5`,key:`t7cp39`}]]),Jt=M(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Yt=M(`FolderGit2`,[[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`path`,{d:`M18 19c-2.8 0-5-2.2-5-5v8`,key:`pkpw2h`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),Xt=M(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Zt=M(`FolderTree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Qt=M(`FolderUp`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`m9 13 3-3 3 3`,key:`1pxg3c`}]]),$t=M(`FolderX`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),en=M(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),tn=M(`House`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),nn=M(`MessageSquareText`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M13 8H7`,key:`14i4kc`}],[`path`,{d:`M17 12H7`,key:`16if0g`}]]),rn=M(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),an=M(`Paperclip`,[[`path`,{d:`m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48`,key:`1u3ebp`}]]),on=M(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),sn=M(`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`}]]),cn=M(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),ln=M(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),un=M(`User`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),N=l();function dn({isProjectFirstView:e,onSelectMode:t}){return(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,N.jsx)(`button`,{type:`button`,"aria-pressed":!e,onClick:()=>t(`time-first`),className:d(`transition-colors`,e?`text-gray-400 hover:text-gray-600`:`font-medium text-gray-600`),children:o(`chatSidebarViewTime`)}),(0,N.jsx)(`span`,{className:`text-gray-300`,children:`/`}),(0,N.jsx)(`button`,{type:`button`,"aria-pressed":e,onClick:()=>t(`project-first`),className:d(`transition-colors`,e?`font-medium text-gray-600`:`text-gray-400 hover:text-gray-600`),children:o(`chatSidebarViewProject`)})]})}var fn={wx:`weixin`,lark:`feishu`},pn={cron:{icon:`cron`}},mn={codex:`chatSessionTypeCodex`,claude:`chatSessionTypeClaude`};function hn(e){return e?.trim().toLowerCase()??``}function gn(e){return e.split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function _n(e,t){let n=hn(e);if(!n||n===`native`)return null;let r=t.find(e=>hn(e.value)===n);return r?.label.trim()?r.label.trim():gn(n)}function vn(e,t){let n=hn(e);return!n||n===`native`?null:t.find(e=>hn(e.value)===n)??null}function yn(e){let t=hn(e);if(!t)return null;let n=fn[t]??t;return tt(n)?n:null}function bn(e,t){let n=yn(e.channel??``);if(n)return{icon:{kind:`channel-logo`,channel:n},label:null};let r=pn[hn(e.type)];if(r)return{icon:{kind:`symbol`,icon:r.icon},label:null};let i=hn(e.sessionType),a=vn(i,t);if(a?.icon?.src?.trim())return{icon:{kind:`runtime-image`,src:a.icon.src,alt:a.icon.alt??null,name:a.label},label:null};let s=mn[i];return s?{icon:null,label:o(s)}:{icon:null,label:a?.label?.trim()||_n(e.sessionType,t)}}var xn=`app://`;function Sn(e){let t=e.trim().replace(/^\/+/,``);if(!t)return null;let n=t.split(`/`);return n.some(e=>e.trim().length===0||e===`.`||e===`..`)?null:n.join(`/`)}function Cn(e){let t=e.trim();if(!t)return null;if(!t.startsWith(xn))return t;let n=Sn(t.slice(6));return n?`/${n}`:null}function wn({icon:e,className:t}){if(e.kind===`channel-logo`)return(0,N.jsx)(Tn,{channel:e.channel,className:t});if(e.kind===`runtime-image`){let n=Cn(e.src);return(0,N.jsx)(St,{name:e.name?.trim()||e.alt?.trim()||`runtime`,src:n??void 0,className:d(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,N.jsx)(me,{className:d(`h-3 w-3 text-gray-500`,t)})})}return(0,N.jsx)(Ee,{className:d(`h-3.5 w-3.5`,t)})}function Tn({channel:e,className:t}){return(0,N.jsx)(St,{name:e,src:tt(e),className:d(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,N.jsx)(me,{className:`h-3 w-3 text-gray-500`})})}function En(e){let{option:t,onSelect:n}=e,r=t.ready===!1?t.reasonMessage?.trim()||o(`statusSetup`):null;return(0,N.jsx)(`button`,{type:`button`,onClick:n,className:`w-full rounded-2xl px-3 py-2.5 text-left transition-colors hover:bg-gray-50`,children:(0,N.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2.5`,children:[t.icon?.src?(0,N.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5`,children:(0,N.jsx)(wn,{icon:{kind:`runtime-image`,src:t.icon.src,alt:t.icon.alt??null,name:t.label}})}):(0,N.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5 text-gray-400`,children:(0,N.jsx)(me,{className:`h-4 w-4`})}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-[13px] font-semibold text-gray-900`,children:t.label}),(0,N.jsxs)(`span`,{className:d(`inline-flex shrink-0 items-center gap-1.5 text-[11px] font-medium`,t.ready===!1?`text-amber-700`:`text-emerald-600`),children:[(0,N.jsx)(`span`,{className:d(`h-1.5 w-1.5 rounded-full`,t.ready===!1?`bg-amber-500`:`bg-emerald-500`)}),t.ready===!1?o(`statusSetup`):o(`statusReady`)]})]}),r?(0,N.jsx)(`div`,{className:`mt-1 pr-4 text-[11px] leading-4 text-gray-500`,children:r}):null]})]})})})}var P=e(s(),1);function Dn(e,t){return t.some(t=>t.value===e)?e:t[0]?.value??e}function On(e){let{groups:t,defaultSessionType:n,sessionTypeOptions:r,renderSessionItem:i,onCreateSession:a}=e,[s,c]=(0,P.useState)(null),l=(0,P.useMemo)(()=>Dn(n,r),[n,r]),u=r.length>1;return(0,N.jsx)(`div`,{className:`space-y-3`,children:t.map(e=>{let t=`${o(`chatSidebarNewTask`)} · ${e.projectName}`;return(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 py-0.5`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,N.jsx)(`div`,{className:`truncate text-[11px] font-medium uppercase tracking-wider text-gray-500`,title:e.projectRoot,children:e.projectName}),(0,N.jsx)(`span`,{className:`shrink-0 text-[10px] text-gray-400`,children:e.items.length})]}),u?(0,N.jsxs)(xt,{open:s===e.projectRoot,onOpenChange:t=>{c(t?e.projectRoot:null)},children:[(0,N.jsx)(yt,{asChild:!0,children:(0,N.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-lg text-gray-400 hover:bg-white hover:text-gray-900`,"aria-label":t,title:t,children:(0,N.jsx)(rt,{className:`h-3.5 w-3.5`})})}),(0,N.jsxs)(_t,{align:`end`,className:`w-56 rounded-2xl border border-gray-200/80 bg-white p-1.5 shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:[(0,N.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400`,children:o(`chatSessionTypeLabel`)}),(0,N.jsx)(`div`,{className:`space-y-1`,children:r.map(t=>(0,N.jsx)(En,{option:t,onSelect:()=>{a(t.value,e.projectRoot),c(null)}},`${e.projectRoot}:${t.value}`))})]})]}):(0,N.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-lg text-gray-400 hover:bg-white hover:text-gray-900`,onClick:()=>a(l,e.projectRoot),"aria-label":t,title:t,children:(0,N.jsx)(rt,{className:`h-3.5 w-3.5`})})]}),(0,N.jsx)(`div`,{className:`space-y-0.5 pl-2`,children:e.items.map(i)})]},e.projectRoot)})})}var kn=[[`bg-amber-100`,`text-amber-700`],[`bg-emerald-100`,`text-emerald-700`],[`bg-blue-100`,`text-blue-700`],[`bg-rose-100`,`text-rose-700`],[`bg-cyan-100`,`text-cyan-700`],[`bg-violet-100`,`text-violet-700`]];function An(e){let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}function jn({agentId:e,displayName:t,avatarUrl:n,className:r}){let i=t?.trim()||e,[a,o]=kn[An(e)%kn.length]??kn[0];return n?.trim()?(0,N.jsx)(`img`,{src:n,alt:t?.trim()||e,className:d(`rounded-full object-cover`,r)}):(0,N.jsx)(`div`,{className:d(`rounded-full flex items-center justify-center font-semibold`,a,o,r),"aria-label":t?.trim()||e,children:e.trim().toLowerCase()===`main`?(0,N.jsx)(me,{className:`h-[55%] w-[55%]`,strokeWidth:2.4}):(i.trim()||`A`).slice(0,1).toUpperCase()})}function Mn({status:e,className:t}){let n=o(e===`running`?`sessionsRunStatusRunning`:`sessionsRunStatusQueued`);return(0,N.jsxs)(`span`,{className:d(`inline-flex h-3.5 w-3.5 items-center justify-center text-gray-400`,t),title:n,"aria-label":n,children:[(0,N.jsx)(nt,{className:`h-3 w-3 animate-spin`}),(0,N.jsx)(`span`,{className:`sr-only`,children:n})]})}function Nn({session:e,draftLabel:t,isSaving:n,onDraftLabelChange:r,onSave:i,onCancel:a}){return(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(O,{value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i()):e.key===`Escape`&&(e.preventDefault(),a())},placeholder:o(`sessionsLabelPlaceholder`),className:`h-8 rounded-lg border-gray-300 bg-white text-xs`,autoFocus:!0,disabled:n}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,N.jsx)(`div`,{className:`min-w-0 text-[11px] text-gray-400 truncate`,children:e.key}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,N.jsx)(g,{type:`button`,size:`icon`,variant:`ghost`,className:`h-7 w-7 rounded-lg text-gray-500 hover:bg-white hover:text-gray-900`,onClick:()=>void i(),disabled:n,"aria-label":o(`save`),children:(0,N.jsx)(Be,{className:`h-3.5 w-3.5`})}),(0,N.jsx)(g,{type:`button`,size:`icon`,variant:`ghost`,className:`h-7 w-7 rounded-lg text-gray-500 hover:bg-white hover:text-gray-900`,onClick:a,disabled:n,"aria-label":o(`cancel`),children:(0,N.jsx)(ct,{className:`h-3.5 w-3.5`})})]})]})]})}function Pn({session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:s,agentLabel:c,agentAvatarUrl:l,childSessionCount:f=0,onSelect:p,onOpenChildSessions:m,onStartEditing:h}){return(0,N.jsxs)(`div`,{className:`group/session relative`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:p,className:`w-full text-left`,children:[(0,N.jsxs)(`div`,{className:d(`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-2`,f>0&&m?`pr-14`:`pr-6`),children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[s?.trim()&&s.trim().toLowerCase()!==`main`?(0,N.jsx)(jn,{agentId:s,displayName:c,avatarUrl:l,className:`h-5 w-5 shrink-0`}):null,(0,N.jsx)(`span`,{className:`truncate font-medium`,children:a}),i.label?(0,N.jsx)(`span`,{className:d(`shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-semibold leading-none`,t?`border-gray-300 bg-white/80 text-gray-700`:`border-gray-200 bg-gray-100 text-gray-500`),children:i.label}):null,i.icon?(0,N.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] shrink-0 items-center justify-center`,children:(0,N.jsx)(wn,{icon:i.icon,className:t?`text-gray-700`:`text-gray-500`})}):null]}),r?(0,N.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-end gap-1.5 pt-0.5`,children:(0,N.jsx)(Mn,{status:r})}):null]}),(0,N.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[11px] text-gray-400`,children:[(0,N.jsxs)(`span`,{className:`min-w-0 truncate`,children:[c?.trim()?`${c} · `:``,e.messageCount]}),n?(0,N.jsx)(`span`,{"aria-label":o(`chatSessionUnread`),className:`ml-auto h-2 w-2 shrink-0 rounded-full bg-primary`}):(0,N.jsx)(`span`,{className:`ml-auto shrink-0`,children:u(e.updatedAt)})]})]}),f>0&&m?(0,N.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m()},className:d(`absolute right-6 top-0 inline-flex h-5 items-center gap-1 rounded-md px-1.5 text-[10px] font-medium text-gray-400 transition-all hover:bg-white hover:text-gray-900`,t?`opacity-100`:`opacity-0 group-hover/session:opacity-100 group-focus-within/session:opacity-100`),"aria-label":o(`chatSessionOpenChildSessions`),title:o(`chatSessionOpenChildSessions`),children:[(0,N.jsx)(en,{className:`h-3.5 w-3.5`}),(0,N.jsx)(`span`,{children:f})]}):null,(0,N.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h()},className:d(`absolute right-0 top-0 inline-flex h-5 w-5 items-center justify-center rounded-md text-gray-400 transition-all hover:bg-white hover:text-gray-900`,t?`opacity-100`:`opacity-0 group-hover/session:opacity-100 group-focus-within/session:opacity-100`),"aria-label":o(`edit`),children:(0,N.jsx)(on,{className:`h-3 w-3`})})]})}function Fn({session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:o,agentLabel:s,agentAvatarUrl:c,childSessionCount:l,isEditing:u,draftLabel:f,isSaving:p,onSelect:m,onOpenChildSessions:h,onStartEditing:g,onDraftLabelChange:_,onSave:v,onCancel:y}){return(0,N.jsx)(`div`,{className:d(`w-full rounded-xl px-3 py-2.5 text-left transition-all text-[13px]`,t?`bg-gray-200 text-gray-900 font-semibold shadow-sm`:`text-gray-700 hover:bg-gray-200/60 hover:text-gray-900`),children:u?(0,N.jsx)(Nn,{session:e,draftLabel:f,isSaving:p,onDraftLabelChange:_,onSave:v,onCancel:y}):(0,N.jsx)(Pn,{session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:o,agentLabel:s,agentAvatarUrl:c,onSelect:m,childSessionCount:l,onOpenChildSessions:h,onStartEditing:g})})}var In=[{icon:xe,titleKey:`chatWelcomeCapability1Title`,descKey:`chatWelcomeCapability1Desc`},{icon:ve,titleKey:`chatWelcomeCapability2Title`,descKey:`chatWelcomeCapability2Desc`},{icon:Ee,titleKey:`chatWelcomeCapability3Title`,descKey:`chatWelcomeCapability3Desc`}];function Ln({onCreateSession:e,agents:t,selectedAgentId:n,onSelectAgent:r}){let i=t.find(e=>e.id===n)??null;return(0,N.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,N.jsxs)(`div`,{className:`max-w-lg w-full text-center`,children:[(0,N.jsx)(`div`,{className:`mx-auto mb-6 h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center`,children:(0,N.jsx)(me,{className:`h-8 w-8 text-primary`})}),(0,N.jsx)(`h2`,{className:`text-xl font-semibold text-gray-900 mb-2`,children:o(`chatWelcomeTitle`)}),(0,N.jsx)(`p`,{className:`text-sm text-gray-500 mb-8`,children:o(`chatWelcomeSubtitle`)}),(0,N.jsxs)(`div`,{className:`mb-6 flex items-center justify-center gap-2.5`,children:[(0,N.jsx)(`span`,{className:`text-[13px] font-medium text-gray-500`,children:o(`chatDraftAgentTitle`)}),(0,N.jsxs)(Je,{value:n,onValueChange:r,children:[(0,N.jsxs)(ze,{"aria-label":o(`chatDraftAgentTitle`),className:`h-auto w-auto gap-1 rounded-full border-0 bg-transparent px-1.5 py-1 text-gray-500 shadow-none hover:bg-white/70 hover:text-gray-800 focus:ring-0`,children:[(0,N.jsx)(`span`,{className:`sr-only`,children:o(`chatDraftAgentTitle`)}),(0,N.jsx)(`div`,{className:`flex items-center gap-1.5`,children:i?(0,N.jsx)(jn,{agentId:i.id,displayName:i.displayName,avatarUrl:i.avatarUrl,className:`h-7 w-7 shrink-0`}):null})]}),(0,N.jsx)(Ue,{className:`rounded-xl border-gray-200/80 shadow-lg`,children:t.map(e=>(0,N.jsx)(Ke,{value:e.id,className:`rounded-lg pr-10`,children:(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(jn,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,N.jsx)(`span`,{className:`truncate text-sm font-medium text-gray-700`,children:e.displayName?.trim()||e.id})]})},e.id))})]})]}),(0,N.jsx)(`div`,{className:`grid grid-cols-3 gap-3`,children:In.map(t=>{let n=t.icon;return(0,N.jsxs)(`button`,{onClick:e,className:`rounded-2xl border border-gray-200 bg-white p-4 text-left shadow-card hover:shadow-card-hover transition-shadow cursor-pointer`,children:[(0,N.jsx)(`div`,{className:`h-9 w-9 rounded-xl bg-primary/8 flex items-center justify-center mb-3`,children:(0,N.jsx)(n,{className:`h-4.5 w-4.5 text-primary`})}),(0,N.jsx)(`div`,{className:`text-sm font-semibold text-gray-900 mb-1`,children:o(t.titleKey)}),(0,N.jsx)(`div`,{className:`text-[11px] text-gray-500 leading-relaxed`,children:o(t.descKey)})]},t.titleKey)})})]})})}var Rn=e=>`[data-item-index="${e}"]`;function zn(e){let{activeIndex:t,containerRef:n,getItemSelector:r,isEnabled:i,itemCount:a}=e,o=r??Rn;(0,P.useEffect)(()=>{if(!i||a===0)return;let e=n.current;if(!e)return;let r=e.querySelector(o(t));typeof r?.scrollIntoView==`function`&&r.scrollIntoView({block:`nearest`,inline:`nearest`})},[t,n,o,i,a])}function Bn(){let e=(0,P.useRef)(null),[t,n]=(0,P.useState)(null);return(0,P.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=()=>{n(t.getBoundingClientRect().width)};r();let i=new ResizeObserver(()=>r());return i.observe(t),()=>i.disconnect()},[]),{elementRef:e,width:t}}function F(...e){return n(r(e))}var Vn=P.forwardRef(({className:e,type:t,...n},r)=>(0,N.jsx)(`input`,{type:t,className:F(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-900 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));Vn.displayName=`ChatInput`;var Hn=bt,Un=ht,Wn=gt,Gn=P.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,...r},i)=>(0,N.jsx)(vt,{children:(0,N.jsx)(mt,{ref:i,sideOffset:t,align:n,className:F(`z-[var(--z-popover,50)] w-72 overflow-hidden rounded-2xl border border-gray-200/50 bg-white p-4 shadow-lg 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),...r})}));Gn.displayName=mt.displayName;var Kn=He,qn=qe,Jn=Ze,Yn=P.forwardRef(({className:e,children:t,...n},r)=>(0,N.jsxs)(Xe,{ref:r,className:F(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-gray-200/80 bg-white px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,N.jsx)(Pe,{asChild:!0,children:(0,N.jsx)(je,{className:`h-4 w-4 opacity-50`})})]}));Yn.displayName=Xe.displayName;var Xn=P.forwardRef(({className:e,...t},n)=>(0,N.jsx)(Le,{ref:n,className:F(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,N.jsx)(Ae,{className:`h-4 w-4`})}));Xn.displayName=Le.displayName;var Zn=P.forwardRef(({className:e,...t},n)=>(0,N.jsx)(Re,{ref:n,className:F(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,N.jsx)(je,{className:`h-4 w-4`})}));Zn.displayName=Re.displayName;var Qn=P.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,N.jsx)(Ge,{children:(0,N.jsxs)(We,{ref:i,className:F(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md bg-white text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,N.jsx)(Xn,{}),(0,N.jsx)(Ne,{className:F(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,N.jsx)(Zn,{})]})}));Qn.displayName=We.displayName;var $n=P.forwardRef(({className:e,...t},n)=>(0,N.jsx)(Ie,{ref:n,className:F(`px-2 py-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-gray-500`,e),...t}));$n.displayName=Ie.displayName;var er=P.forwardRef(({className:e,children:t,...n},r)=>(0,N.jsxs)(Ve,{ref:r,className:F(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-gray-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-gray-100`,e),...n,children:[(0,N.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,N.jsx)(Ye,{children:(0,N.jsx)(Be,{className:`h-4 w-4`})})}),(0,N.jsx)(Fe,{children:t})]}));er.displayName=Ve.displayName;var tr=P.forwardRef(({className:e,...t},n)=>(0,N.jsx)(Me,{ref:n,className:F(`-mx-1 my-1 h-px bg-gray-100`,e),...t}));tr.displayName=Me.displayName;var nr=At,rr=wt,ir=Et,ar=P.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,N.jsx)(Ot,{children:(0,N.jsx)(Ct,{ref:r,sideOffset:t,className:F(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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})}));ar.displayName=Ct.displayName;var or={Popover:Hn,PopoverAnchor:Wn,PopoverContent:Gn,PopoverTrigger:Un,Input:Vn,Select:Kn,SelectContent:Qn,SelectGroup:qn,SelectItem:er,SelectLabel:$n,SelectSeparator:tr,SelectTrigger:Yn,SelectValue:Jn,Tooltip:rr,TooltipContent:ar,TooltipProvider:nr,TooltipTrigger:ir},sr=680,cr=.82,lr=560;function ur(e){let{Popover:t,PopoverAnchor:n,PopoverContent:r}=or,{elementRef:i,width:a}=Bn(),o=(0,P.useRef)(null),{isOpen:s,isLoading:c,items:l,activeIndex:u,activeItem:d,texts:f,onSelectItem:p,onOpenChange:m,onSetActiveIndex:h}=e,g=(0,P.useMemo)(()=>{if(a)return Math.min(a>lr?a*cr:a,sr)},[a]);return zn({containerRef:o,activeIndex:u,itemCount:l.length,isEnabled:s&&!c,getItemSelector:e=>`[data-slash-index="${e}"]`}),(0,N.jsxs)(t,{open:s,onOpenChange:m,children:[(0,N.jsx)(n,{asChild:!0,children:(0,N.jsx)(`div`,{ref:i,className:`pointer-events-none absolute bottom-full left-3 right-3 h-0`})}),(0,N.jsx)(r,{side:`top`,align:`start`,sideOffset:10,className:`z-[70] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-2xl border border-gray-200 bg-white/95 p-0 shadow-2xl backdrop-blur-md`,onOpenAutoFocus:e=>e.preventDefault(),style:g?{width:`${g}px`}:void 0,children:(0,N.jsxs)(`div`,{className:`grid min-h-[240px] grid-cols-[minmax(220px,300px)_minmax(0,1fr)]`,children:[(0,N.jsx)(`div`,{ref:o,role:`listbox`,"aria-label":f.slashSectionLabel,className:`custom-scrollbar max-h-[320px] overflow-y-auto border-r border-gray-200 p-2.5`,children:c?(0,N.jsx)(`div`,{className:`p-2 text-xs text-gray-500`,children:f.slashLoadingLabel}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`mb-2 px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:f.slashSectionLabel}),l.length===0?(0,N.jsx)(`div`,{className:`px-2 text-xs text-gray-400`,children:f.slashEmptyLabel}):(0,N.jsx)(`div`,{className:`space-y-1`,children:l.map((e,t)=>{let n=t===u;return(0,N.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,"data-slash-index":t,onMouseEnter:()=>h(t),onClick:()=>p(e),className:`flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition ${n?`bg-gray-100 text-gray-900`:`text-gray-700 hover:bg-gray-50`}`,children:[(0,N.jsx)(`span`,{className:`truncate text-xs font-semibold`,children:e.title}),(0,N.jsx)(`span`,{className:`truncate text-xs text-gray-500`,children:e.subtitle})]},e.key)})})]})}),(0,N.jsx)(`div`,{className:`min-w-0 p-2.5`,children:d?(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary`,children:d.subtitle}),(0,N.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:d.title})]}),(0,N.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:d.description}),(0,N.jsx)(`div`,{className:`space-y-1`,children:d.detailLines.map(e=>(0,N.jsx)(`div`,{className:`min-w-0 break-all rounded-md bg-gray-50 px-2 py-1 text-[11px] leading-5 text-gray-600`,children:e},e))}),(0,N.jsx)(`div`,{className:`pt-1 text-[11px] text-gray-500`,children:f.slashSkillHintLabel})]}):(0,N.jsx)(`div`,{className:`text-xs text-gray-500`,children:f.slashHintLabel})})]})})]})}var dr=_(`inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-all duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-gray-200 bg-white hover:bg-gray-50 hover:text-gray-800 text-gray-600`,secondary:`bg-gray-100 text-gray-700 hover:bg-gray-200/80`,ghost:`hover:bg-gray-100/80 hover:text-gray-800`,link:`text-primary underline-offset-4 hover:underline`,primary:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,subtle:`bg-gray-100 text-gray-600 hover:bg-gray-200/80`,"primary-outline":`border border-primary/30 text-primary hover:bg-primary hover:text-primary-foreground`},size:{default:`h-9 px-4 py-2`,sm:`h-8 px-3 text-xs`,lg:`h-11 px-5 text-[14px]`,xl:`h-12 px-6 text-[15px]`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),fr=P.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,N.jsx)(`button`,{className:F(dr({variant:t,size:n,className:e})),ref:i,...r}));fr.displayName=`ChatButton`;var pr=120;function mr(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=pr?t:`${t.slice(0,pr-1)}…`}function hr(){return(0,N.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`chat-stop-icon`,className:`block h-3 w-3 rounded-[2px] bg-gray-700 shadow-[inset_0_0_0_1px_rgba(17,24,39,0.06)]`})}function gr({contextWindow:e}){let{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:i}=or,a=Math.max(0,Math.min(1,e.ratio)),o=Math.round(a*360);return(0,N.jsx)(r,{delayDuration:0,children:(0,N.jsxs)(t,{children:[(0,N.jsx)(i,{asChild:!0,children:(0,N.jsxs)(`button`,{type:`button`,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700`,"aria-label":e.label,title:e.label,children:[(0,N.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[7px] rounded-full`,style:{background:`conic-gradient(#9ca3af ${o}deg, #e5e7eb 0deg)`}}),(0,N.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[10px] rounded-full bg-white`})]})}),(0,N.jsx)(n,{side:`top`,className:`max-w-[18rem]`,children:(0,N.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-5 font-semibold text-gray-800`,children:[(0,N.jsx)(`span`,{children:e.label}),(0,N.jsx)(`span`,{children:e.percentLabel})]}),e.details.map(e=>(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-5 text-gray-600`,children:[(0,N.jsx)(`span`,{children:e.label}),(0,N.jsx)(`span`,{className:`font-medium text-gray-800`,children:e.value})]},e.label))]})})]})})}function _r({sendError:e,sendErrorDetailsLabel:t,isSending:n,canStopGeneration:r,sendDisabled:i,stopDisabled:a,stopHint:o,sendButtonLabel:s,stopButtonLabel:c,contextWindow:l,onSend:u,onStop:d}){let{Popover:f,PopoverContent:p,PopoverTrigger:m,Tooltip:h,TooltipContent:g,TooltipProvider:_,TooltipTrigger:v}=or,y=e?.trim()??``,b=y?mr(y):``,x=t?.trim()||`Details`;return(0,N.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[y?(0,N.jsxs)(`div`,{className:`flex max-w-[420px] items-start justify-end gap-2 text-right`,children:[(0,N.jsx)(`div`,{className:`min-w-0 flex-1 text-[11px] text-red-600`,children:(0,N.jsx)(`span`,{className:`block truncate`,title:y,children:b})}),(0,N.jsxs)(f,{children:[(0,N.jsx)(m,{asChild:!0,children:(0,N.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-full border border-red-200/80 bg-red-50 px-2 py-0.5 text-[10px] font-semibold text-red-700 transition-colors hover:bg-red-100`,children:x})}),(0,N.jsxs)(p,{align:`end`,className:`w-[min(32rem,calc(100vw-1.5rem))] border-red-100/80 p-0`,children:[(0,N.jsx)(`div`,{className:`border-b border-red-100 bg-red-50/80 px-4 py-2 text-xs font-semibold text-red-700`,children:x}),(0,N.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words px-4 py-3 text-xs leading-relaxed text-red-700`,children:y})]})]})]}):null,(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l?(0,N.jsx)(gr,{contextWindow:l}):null,n?r?(0,N.jsx)(fr,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":c,onClick:()=>void d(),disabled:a,children:(0,N.jsx)(hr,{})}):(0,N.jsx)(_,{children:(0,N.jsxs)(h,{children:[(0,N.jsx)(v,{asChild:!0,children:(0,N.jsx)(`span`,{children:(0,N.jsx)(fr,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":c,disabled:!0,children:(0,N.jsx)(hr,{})})})}),(0,N.jsx)(g,{side:`top`,children:(0,N.jsx)(`p`,{className:`text-xs`,children:o})})]})}):(0,N.jsx)(fr,{size:`icon`,className:`h-8 w-8 rounded-full`,"aria-label":s,onClick:()=>void u(),disabled:i,children:(0,N.jsx)(Pt,{className:`h-5 w-5`})})]})]})}function vr(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.label,e.key,e.description].filter(e=>typeof e==`string`&&e.trim().length>0).join(` `).toLowerCase().includes(n)):e}function yr(e){let{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:i}=or,{picker:a}=e,o=(0,P.useRef)(null),s=(0,P.useId)(),[c,l]=(0,P.useState)(``),[u,d]=(0,P.useState)(0),f=(0,P.useMemo)(()=>new Set(a.selectedKeys),[a.selectedKeys]),p=a.selectedKeys.length,m=c.trim().length>0,h=(0,P.useMemo)(()=>{if(m)return null;let e=a.groups?.filter(e=>e.options.length>0)??[];return e.length>0?e:null},[m,a.groups]),g=(0,P.useMemo)(()=>h?h.flatMap(e=>e.options):vr(a.options,c),[h,a.options,c]);(0,P.useEffect)(()=>{d(0)},[c]),(0,P.useEffect)(()=>{d(e=>g.length===0?0:Math.min(e,g.length-1))},[g.length]),zn({containerRef:o,activeIndex:u,itemCount:g.length,isEnabled:g.length>0,getItemSelector:e=>`[data-skill-index="${e}"]`});let _=e=>{if(f.has(e)){a.onSelectedKeysChange(a.selectedKeys.filter(t=>t!==e));return}a.onSelectedKeysChange([...a.selectedKeys,e])},v=e=>{if(g.length!==0){if(e.key===`ArrowDown`){e.preventDefault(),d(e=>Math.min(e+1,g.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),d(e=>Math.max(e-1,0));return}if(e.key===`Enter`){e.preventDefault();let t=g[u];t&&_(t.key)}}};return(0,N.jsxs)(n,{children:[(0,N.jsx)(i,{asChild:!0,children:(0,N.jsxs)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-label":a.title,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg px-0 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 sm:w-auto sm:gap-1.5 sm:px-3`,children:[(0,N.jsx)(ve,{className:`h-4 w-4`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:a.title}),p>0?(0,N.jsx)(`span`,{className:`absolute -right-1 -top-1 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold leading-none text-white shadow-sm sm:static sm:ml-0.5 sm:bg-primary/10 sm:text-primary sm:shadow-none`,children:p}):null]})}),(0,N.jsxs)(r,{side:`top`,align:`start`,className:`w-[360px] p-0`,children:[(0,N.jsxs)(`div`,{className:`space-y-2 border-b border-gray-100 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:a.title}),(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsx)(Oe,{className:`pointer-events-none absolute left-3 top-2.5 h-3.5 w-3.5 text-gray-400`}),(0,N.jsx)(t,{value:c,onChange:e=>l(e.target.value),onKeyDown:v,placeholder:a.searchPlaceholder,role:`combobox`,"aria-controls":s,"aria-expanded":`true`,"aria-autocomplete":`list`,"aria-activedescendant":g[u]?`${s}-option-${u}`:void 0,className:`h-8 rounded-lg pl-8 text-xs`})]})]}),(0,N.jsx)(`div`,{ref:o,id:s,role:`listbox`,"aria-multiselectable":`true`,className:`custom-scrollbar max-h-[320px] overflow-y-auto`,children:a.isLoading?(0,N.jsx)(`div`,{className:`p-4 text-xs text-gray-500`,children:a.loadingLabel}):g.length===0?(0,N.jsx)(`div`,{className:`p-4 text-center text-xs text-gray-500`,children:a.emptyLabel}):(0,N.jsx)(`div`,{className:`py-1`,children:(()=>{let e=h??[{key:`all-skills`,options:g}],t=0;return e.map(e=>(0,N.jsxs)(`div`,{children:[e.label?(0,N.jsx)(`div`,{className:`px-4 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:e.label}):null,e.options.map(e=>{let n=t;t+=1;let r=f.has(e.key),i=n===u;return(0,N.jsxs)(`button`,{type:`button`,id:`${s}-option-${n}`,role:`option`,"aria-selected":r,"data-skill-index":n,onClick:()=>_(e.key),onMouseEnter:()=>d(n),className:`flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors ${i?`bg-gray-50`:`hover:bg-gray-50`}`,children:[(0,N.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500`,children:(0,N.jsx)(sn,{className:`h-4 w-4`})}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`truncate text-sm text-gray-900`,children:e.label}),e.badgeLabel?(0,N.jsx)(`span`,{className:`shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:e.badgeLabel}):null]}),(0,N.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-gray-500`,children:e.description||e.key})]}),(0,N.jsx)(`div`,{className:`ml-3 shrink-0`,children:(0,N.jsx)(`span`,{className:r?`inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-white`:`inline-flex h-5 w-5 items-center justify-center rounded-full border border-gray-300 bg-white`,children:r?(0,N.jsx)(Be,{className:`h-3 w-3`}):null})})]},e.key)})]},e.key))})()})}),a.manageHref&&a.manageLabel?(0,N.jsx)(`div`,{className:`border-t border-gray-100 px-4 py-2.5`,children:(0,N.jsxs)(`a`,{href:a.manageHref,className:`inline-flex items-center gap-1.5 text-xs font-medium text-primary transition-colors hover:text-primary/80`,children:[a.manageLabel,(0,N.jsx)(Qe,{className:`h-3 w-3`})]})}):null]})]})}function br({icon:e}){return e===`sparkles`?(0,N.jsx)(ot,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):e===`brain`?(0,N.jsx)(Ft,{className:`h-3.5 w-3.5 shrink-0 text-gray-500`}):null}function xr({icon:e}){return e===`paperclip`?(0,N.jsx)(an,{className:`h-4 w-4`}):(0,N.jsx)(br,{icon:e})}var Sr={model:`min-w-0 flex-1 sm:min-w-[220px] sm:flex-none`,"session-type":`shrink-0`,thinking:`shrink-0`},Cr={model:`w-[min(18rem,calc(100vw-1rem))] sm:w-[320px]`,"session-type":`w-[220px]`,thinking:`w-[180px]`};function wr(e){return e.key===`model`&&e.selectedLabel&&e.selectedLabel.split(`/`).slice(1).join(`/`).trim()||e.selectedLabel}function Tr({item:e}){let{Select:t,SelectContent:n,SelectGroup:r,SelectItem:i,SelectLabel:a,SelectSeparator:o,SelectTrigger:s,SelectValue:c}=or,l=e.groups?.filter(e=>e.options.length>0)??(e.options.length>0?[{key:`${e.key}-default`,options:e.options}]:[]),u=l.some(e=>e.options.length>0),d=wr(e);return(0,N.jsxs)(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[(0,N.jsx)(s,{className:`h-8 w-auto rounded-lg border-0 bg-transparent px-2 text-xs font-medium text-gray-600 shadow-none hover:bg-gray-100 focus:ring-0 sm:px-3 ${Sr[e.key]??``}`,children:e.selectedLabel?(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-left`,children:[(0,N.jsx)(br,{icon:e.icon}),(0,N.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-700 sm:hidden`,children:d}),(0,N.jsx)(`span`,{className:`hidden truncate text-xs font-semibold text-gray-700 sm:inline`,children:e.selectedLabel})]}):e.loading?(0,N.jsx)(`div`,{className:`h-3 w-24 animate-pulse rounded bg-gray-200`}):(0,N.jsx)(c,{placeholder:e.placeholder})}),(0,N.jsxs)(n,{className:Cr[e.key]??``,children:[u?null:e.loading?(0,N.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,N.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-gray-200`}),(0,N.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-gray-200`}),(0,N.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-gray-200`})]}):e.emptyLabel?(0,N.jsx)(`div`,{className:`px-3 py-2 text-xs text-gray-500`,children:e.emptyLabel}):null,l.map((e,t)=>(0,N.jsxs)(`div`,{children:[t>0?(0,N.jsx)(o,{}):null,(0,N.jsxs)(r,{children:[e.label?(0,N.jsx)(a,{children:e.label}):null,e.options.map(e=>(0,N.jsx)(i,{value:e.value,className:`py-2`,children:e.description?(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,N.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-800`,children:e.label}),(0,N.jsx)(`span`,{className:`truncate text-[11px] text-gray-500`,children:e.description})]}):(0,N.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-800`,children:e.label})},e.value))]})]},e.key))]})]})}function Er({actions:e,accessories:t,selects:n,skillPicker:r}){let{Tooltip:i,TooltipContent:a,TooltipProvider:o,TooltipTrigger:s}=or;return(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 pb-3`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 overflow-hidden`,children:[r?(0,N.jsx)(yr,{picker:r}):null,n.map(e=>(0,N.jsx)(Tr,{item:e},e.key)),t?.map(e=>{let t=(0,N.jsxs)(`button`,{type:`button`,className:`inline-flex items-center rounded-lg py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:text-gray-400 ${e.iconOnly?`h-8 w-8 justify-center px-0`:`gap-1.5 px-3`}`,onClick:e.onClick,disabled:e.disabled,"aria-label":e.label,children:[(0,N.jsx)(xr,{icon:e.icon}),e.iconOnly?null:(0,N.jsx)(`span`,{children:e.label})]});return e.tooltip?(0,N.jsx)(o,{children:(0,N.jsxs)(i,{children:[(0,N.jsx)(s,{asChild:!0,children:e.disabled?(0,N.jsx)(`span`,{className:`inline-flex`,children:t}):t}),(0,N.jsx)(a,{side:`top`,children:(0,N.jsx)(`p`,{className:`text-xs`,children:e.tooltip})})]})},e.key):(0,N.jsx)(`div`,{children:t},e.key)})]}),(0,N.jsx)(_r,{...e})]})}var Dr=(0,P.createContext)(null);function Or(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function kr(){let e=(0,P.useContext)(Dr);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}function I(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ar(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var jr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Mr=jr&&`documentMode`in document?document.documentMode:null,Nr=jr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pr=jr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Fr=!(!jr||!(`InputEvent`in window)||Mr)&&`getTargetRanges`in new window.InputEvent(`input`),Ir=jr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Lr=jr&&/Android/.test(navigator.userAgent),Rr=jr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Lr,zr=jr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Br=jr&&Lr&&zr,Vr=jr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Nr&&!zr,Hr=0,Ur=1,Wr=2,Gr=1,Kr=2,qr=3,Jr=4,Yr=5,Xr=6,Zr=Rr||Ir||Vr?`\xA0`:``,Qr=`
|
|
1
|
+
import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,m as s,n as c,p as l,t as u,u as d}from"./i18n-C5Mibli1.js";import{At as f,It as p,Kt as m,Lt as h,Mt as g,Nt as _,Pt as v,Rt as y,V as b,Vt as x,at as S,bt as C,f as w,gt as T,h as E,it as D,jt as O,m as ee,n as k,nt as te,p as A,rt as ne,t as j,v as re,vt as ie,xt as ae,y as oe,yt as se}from"./api-Dai6UR3J.js";import{a as ce,i as le,n as ue,o as de,r as fe,t as pe}from"./dialog-DgybjpeU.js";import{t as M}from"./createLucideIcon-BZkY6emz.js";import{_ as me,c as he,d as ge,f as _e,g as ve,h as ye,l as be,m as xe,n as Se,p as Ce,s as we,u as Te,v as Ee}from"./theme-provider-BU77FNSB.js";import{n as De,t as Oe}from"./search-vChioOoe.js";import{t as ke}from"./book-open-DgLqYpNY.js";import{D as Ae,O as je,_ as Me,b as Ne,c as Pe,d as Fe,f as Ie,g as Le,h as Re,i as ze,k as Be,l as Ve,m as He,n as Ue,o as We,p as Ge,r as Ke,s as qe,t as Je,u as Ye,v as Xe,y as Ze}from"./select-uO-zhYsH.js";import{t as Qe}from"./external-link-Sw3ah_JD.js";import{t as $e}from"./folder-D7-VTnkz.js";import{n as et,t as tt}from"./logos-CqVm0q0W.js";import{t as nt}from"./loader-circle-B5i8oMMY.js";import{t as rt}from"./plus-Di0KAkiO.js";import{t as it}from"./refresh-ccw-Bii4w8aB.js";import{t as at}from"./settings-CiRChctQ.js";import{t as ot}from"./sparkles-D1ZKWdm4.js";import{t as st}from"./trash-2-rY9ZteZX.js";import{t as ct}from"./x-DpTzXQcX.js";import{i as lt}from"./doc-browser-context-DfLHAWbG.js";import{n as ut}from"./doc-browser-BUlCkZo2.js";import{n as dt,t as ft}from"./use-viewport-layout-C6EN0_eq.js";import{m as pt}from"./use-config-D2QgG7qc.js";import{a as mt,c as ht,i as gt,n as _t,o as vt,r as yt,s as bt,t as xt}from"./popover-C8tMB7tR.js";import{t as St}from"./logo-badge-BQgKnVtz.js";import{a as Ct,c as wt,i as Tt,l as Et,n as Dt,o as Ot,r as kt,s as At,t as jt}from"./tooltip-CvAtG-kT.js";import{t as Mt}from"./skeleton-CFQRIUzt.js";var Nt=M(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Pt=M(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Ft=M(`Brain`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`,key:`ep3f8r`}],[`path`,{d:`M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4`,key:`1p4c4q`}],[`path`,{d:`M17.599 6.5a3 3 0 0 0 .399-1.375`,key:`tmeiqw`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M19.938 10.5a4 4 0 0 1 .585.396`,key:`1qfode`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M19.967 17.484A4 4 0 0 1 18 18`,key:`159ez6`}]]),It=M(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Lt=M(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Rt=M(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),zt=M(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Bt=M(`FileArchive`,[[`path`,{d:`M10 12v-1`,key:`v7bkov`}],[`path`,{d:`M10 18v-2`,key:`1cjy8d`}],[`path`,{d:`M10 7V6`,key:`dljcrl`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01`,key:`gkbcor`}],[`circle`,{cx:`10`,cy:`20`,r:`2`,key:`1xzdoj`}]]),Vt=M(`FileAudio2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2`,key:`17k7jt`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`3`,cy:`17`,r:`1`,key:`vo6nti`}],[`path`,{d:`M2 17v-3a4 4 0 0 1 8 0v3`,key:`1ggdre`}],[`circle`,{cx:`9`,cy:`17`,r:`1`,key:`bc1fq4`}]]),Ht=M(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Ut=M(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Wt=M(`FileJson2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`fq0c9t`}],[`path`,{d:`M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`4gibmv`}]]),Gt=M(`FileSpreadsheet`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),Kt=M(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),qt=M(`FileVideo2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`rect`,{width:`8`,height:`6`,x:`2`,y:`12`,rx:`1`,key:`1a6c1e`}],[`path`,{d:`m10 15.5 4 2.5v-6l-4 2.5`,key:`t7cp39`}]]),Jt=M(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Yt=M(`FolderGit2`,[[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`path`,{d:`M18 19c-2.8 0-5-2.2-5-5v8`,key:`pkpw2h`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),Xt=M(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Zt=M(`FolderTree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Qt=M(`FolderUp`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`m9 13 3-3 3 3`,key:`1pxg3c`}]]),$t=M(`FolderX`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),en=M(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),tn=M(`House`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),nn=M(`MessageSquareText`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M13 8H7`,key:`14i4kc`}],[`path`,{d:`M17 12H7`,key:`16if0g`}]]),rn=M(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),an=M(`Paperclip`,[[`path`,{d:`m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48`,key:`1u3ebp`}]]),on=M(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),sn=M(`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`}]]),cn=M(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),ln=M(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),un=M(`User`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),N=l();function dn({isProjectFirstView:e,onSelectMode:t}){return(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,N.jsx)(`button`,{type:`button`,"aria-pressed":!e,onClick:()=>t(`time-first`),className:d(`transition-colors`,e?`text-gray-400 hover:text-gray-600`:`font-medium text-gray-600`),children:o(`chatSidebarViewTime`)}),(0,N.jsx)(`span`,{className:`text-gray-300`,children:`/`}),(0,N.jsx)(`button`,{type:`button`,"aria-pressed":e,onClick:()=>t(`project-first`),className:d(`transition-colors`,e?`font-medium text-gray-600`:`text-gray-400 hover:text-gray-600`),children:o(`chatSidebarViewProject`)})]})}var fn={wx:`weixin`,lark:`feishu`},pn={cron:{icon:`cron`}},mn={codex:`chatSessionTypeCodex`,claude:`chatSessionTypeClaude`};function hn(e){return e?.trim().toLowerCase()??``}function gn(e){return e.split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function _n(e,t){let n=hn(e);if(!n||n===`native`)return null;let r=t.find(e=>hn(e.value)===n);return r?.label.trim()?r.label.trim():gn(n)}function vn(e,t){let n=hn(e);return!n||n===`native`?null:t.find(e=>hn(e.value)===n)??null}function yn(e){let t=hn(e);if(!t)return null;let n=fn[t]??t;return tt(n)?n:null}function bn(e,t){let n=yn(e.channel??``);if(n)return{icon:{kind:`channel-logo`,channel:n},label:null};let r=pn[hn(e.type)];if(r)return{icon:{kind:`symbol`,icon:r.icon},label:null};let i=hn(e.sessionType),a=vn(i,t);if(a?.icon?.src?.trim())return{icon:{kind:`runtime-image`,src:a.icon.src,alt:a.icon.alt??null,name:a.label},label:null};let s=mn[i];return s?{icon:null,label:o(s)}:{icon:null,label:a?.label?.trim()||_n(e.sessionType,t)}}var xn=`app://`;function Sn(e){let t=e.trim().replace(/^\/+/,``);if(!t)return null;let n=t.split(`/`);return n.some(e=>e.trim().length===0||e===`.`||e===`..`)?null:n.join(`/`)}function Cn(e){let t=e.trim();if(!t)return null;if(!t.startsWith(xn))return t;let n=Sn(t.slice(6));return n?`/${n}`:null}function wn({icon:e,className:t}){if(e.kind===`channel-logo`)return(0,N.jsx)(Tn,{channel:e.channel,className:t});if(e.kind===`runtime-image`){let n=Cn(e.src);return(0,N.jsx)(St,{name:e.name?.trim()||e.alt?.trim()||`runtime`,src:n??void 0,className:d(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,N.jsx)(me,{className:d(`h-3 w-3 text-gray-500`,t)})})}return(0,N.jsx)(Ee,{className:d(`h-3.5 w-3.5`,t)})}function Tn({channel:e,className:t}){return(0,N.jsx)(St,{name:e,src:tt(e),className:d(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,N.jsx)(me,{className:`h-3 w-3 text-gray-500`})})}function En(e){let{option:t,onSelect:n}=e,r=t.ready===!1?t.reasonMessage?.trim()||o(`statusSetup`):null;return(0,N.jsx)(`button`,{type:`button`,onClick:n,className:`w-full rounded-2xl px-3 py-2.5 text-left transition-colors hover:bg-gray-50`,children:(0,N.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2.5`,children:[t.icon?.src?(0,N.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5`,children:(0,N.jsx)(wn,{icon:{kind:`runtime-image`,src:t.icon.src,alt:t.icon.alt??null,name:t.label}})}):(0,N.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5 text-gray-400`,children:(0,N.jsx)(me,{className:`h-4 w-4`})}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-[13px] font-semibold text-gray-900`,children:t.label}),(0,N.jsxs)(`span`,{className:d(`inline-flex shrink-0 items-center gap-1.5 text-[11px] font-medium`,t.ready===!1?`text-amber-700`:`text-emerald-600`),children:[(0,N.jsx)(`span`,{className:d(`h-1.5 w-1.5 rounded-full`,t.ready===!1?`bg-amber-500`:`bg-emerald-500`)}),t.ready===!1?o(`statusSetup`):o(`statusReady`)]})]}),r?(0,N.jsx)(`div`,{className:`mt-1 pr-4 text-[11px] leading-4 text-gray-500`,children:r}):null]})]})})})}var P=e(s(),1);function Dn(e,t){return t.some(t=>t.value===e)?e:t[0]?.value??e}function On(e){let{groups:t,defaultSessionType:n,sessionTypeOptions:r,renderSessionItem:i,onCreateSession:a}=e,[s,c]=(0,P.useState)(null),l=(0,P.useMemo)(()=>Dn(n,r),[n,r]),u=r.length>1;return(0,N.jsx)(`div`,{className:`space-y-3`,children:t.map(e=>{let t=`${o(`chatSidebarNewTask`)} · ${e.projectName}`;return(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 py-0.5`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,N.jsx)(`div`,{className:`truncate text-[11px] font-medium uppercase tracking-wider text-gray-500`,title:e.projectRoot,children:e.projectName}),(0,N.jsx)(`span`,{className:`shrink-0 text-[10px] text-gray-400`,children:e.items.length})]}),u?(0,N.jsxs)(xt,{open:s===e.projectRoot,onOpenChange:t=>{c(t?e.projectRoot:null)},children:[(0,N.jsx)(yt,{asChild:!0,children:(0,N.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-lg text-gray-400 hover:bg-white hover:text-gray-900`,"aria-label":t,title:t,children:(0,N.jsx)(rt,{className:`h-3.5 w-3.5`})})}),(0,N.jsxs)(_t,{align:`end`,className:`w-56 rounded-2xl border border-gray-200/80 bg-white p-1.5 shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:[(0,N.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400`,children:o(`chatSessionTypeLabel`)}),(0,N.jsx)(`div`,{className:`space-y-1`,children:r.map(t=>(0,N.jsx)(En,{option:t,onSelect:()=>{a(t.value,e.projectRoot),c(null)}},`${e.projectRoot}:${t.value}`))})]})]}):(0,N.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-lg text-gray-400 hover:bg-white hover:text-gray-900`,onClick:()=>a(l,e.projectRoot),"aria-label":t,title:t,children:(0,N.jsx)(rt,{className:`h-3.5 w-3.5`})})]}),(0,N.jsx)(`div`,{className:`space-y-0.5 pl-2`,children:e.items.map(i)})]},e.projectRoot)})})}var kn=[[`bg-amber-100`,`text-amber-700`],[`bg-emerald-100`,`text-emerald-700`],[`bg-blue-100`,`text-blue-700`],[`bg-rose-100`,`text-rose-700`],[`bg-cyan-100`,`text-cyan-700`],[`bg-violet-100`,`text-violet-700`]];function An(e){let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}function jn({agentId:e,displayName:t,avatarUrl:n,className:r}){let i=t?.trim()||e,[a,o]=kn[An(e)%kn.length]??kn[0];return n?.trim()?(0,N.jsx)(`img`,{src:n,alt:t?.trim()||e,className:d(`rounded-full object-cover`,r)}):(0,N.jsx)(`div`,{className:d(`rounded-full flex items-center justify-center font-semibold`,a,o,r),"aria-label":t?.trim()||e,children:e.trim().toLowerCase()===`main`?(0,N.jsx)(me,{className:`h-[55%] w-[55%]`,strokeWidth:2.4}):(i.trim()||`A`).slice(0,1).toUpperCase()})}function Mn({status:e,className:t}){let n=o(e===`running`?`sessionsRunStatusRunning`:`sessionsRunStatusQueued`);return(0,N.jsxs)(`span`,{className:d(`inline-flex h-3.5 w-3.5 items-center justify-center text-gray-400`,t),title:n,"aria-label":n,children:[(0,N.jsx)(nt,{className:`h-3 w-3 animate-spin`}),(0,N.jsx)(`span`,{className:`sr-only`,children:n})]})}function Nn({session:e,draftLabel:t,isSaving:n,onDraftLabelChange:r,onSave:i,onCancel:a}){return(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(O,{value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i()):e.key===`Escape`&&(e.preventDefault(),a())},placeholder:o(`sessionsLabelPlaceholder`),className:`h-8 rounded-lg border-gray-300 bg-white text-xs`,autoFocus:!0,disabled:n}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,N.jsx)(`div`,{className:`min-w-0 text-[11px] text-gray-400 truncate`,children:e.key}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,N.jsx)(g,{type:`button`,size:`icon`,variant:`ghost`,className:`h-7 w-7 rounded-lg text-gray-500 hover:bg-white hover:text-gray-900`,onClick:()=>void i(),disabled:n,"aria-label":o(`save`),children:(0,N.jsx)(Be,{className:`h-3.5 w-3.5`})}),(0,N.jsx)(g,{type:`button`,size:`icon`,variant:`ghost`,className:`h-7 w-7 rounded-lg text-gray-500 hover:bg-white hover:text-gray-900`,onClick:a,disabled:n,"aria-label":o(`cancel`),children:(0,N.jsx)(ct,{className:`h-3.5 w-3.5`})})]})]})]})}function Pn({session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:s,agentLabel:c,agentAvatarUrl:l,childSessionCount:f=0,onSelect:p,onOpenChildSessions:m,onStartEditing:h}){return(0,N.jsxs)(`div`,{className:`group/session relative`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:p,className:`w-full text-left`,children:[(0,N.jsxs)(`div`,{className:d(`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-2`,f>0&&m?`pr-14`:`pr-6`),children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[s?.trim()&&s.trim().toLowerCase()!==`main`?(0,N.jsx)(jn,{agentId:s,displayName:c,avatarUrl:l,className:`h-5 w-5 shrink-0`}):null,(0,N.jsx)(`span`,{className:`truncate font-medium`,children:a}),i.label?(0,N.jsx)(`span`,{className:d(`shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-semibold leading-none`,t?`border-gray-300 bg-white/80 text-gray-700`:`border-gray-200 bg-gray-100 text-gray-500`),children:i.label}):null,i.icon?(0,N.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] shrink-0 items-center justify-center`,children:(0,N.jsx)(wn,{icon:i.icon,className:t?`text-gray-700`:`text-gray-500`})}):null]}),r?(0,N.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-end gap-1.5 pt-0.5`,children:(0,N.jsx)(Mn,{status:r})}):null]}),(0,N.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[11px] text-gray-400`,children:[(0,N.jsxs)(`span`,{className:`min-w-0 truncate`,children:[c?.trim()?`${c} · `:``,e.messageCount]}),n?(0,N.jsx)(`span`,{"aria-label":o(`chatSessionUnread`),className:`ml-auto h-2 w-2 shrink-0 rounded-full bg-primary`}):(0,N.jsx)(`span`,{className:`ml-auto shrink-0`,children:u(e.updatedAt)})]})]}),f>0&&m?(0,N.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m()},className:d(`absolute right-6 top-0 inline-flex h-5 items-center gap-1 rounded-md px-1.5 text-[10px] font-medium text-gray-400 transition-all hover:bg-white hover:text-gray-900`,t?`opacity-100`:`opacity-0 group-hover/session:opacity-100 group-focus-within/session:opacity-100`),"aria-label":o(`chatSessionOpenChildSessions`),title:o(`chatSessionOpenChildSessions`),children:[(0,N.jsx)(en,{className:`h-3.5 w-3.5`}),(0,N.jsx)(`span`,{children:f})]}):null,(0,N.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h()},className:d(`absolute right-0 top-0 inline-flex h-5 w-5 items-center justify-center rounded-md text-gray-400 transition-all hover:bg-white hover:text-gray-900`,t?`opacity-100`:`opacity-0 group-hover/session:opacity-100 group-focus-within/session:opacity-100`),"aria-label":o(`edit`),children:(0,N.jsx)(on,{className:`h-3 w-3`})})]})}function Fn({session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:o,agentLabel:s,agentAvatarUrl:c,childSessionCount:l,isEditing:u,draftLabel:f,isSaving:p,onSelect:m,onOpenChildSessions:h,onStartEditing:g,onDraftLabelChange:_,onSave:v,onCancel:y}){return(0,N.jsx)(`div`,{className:d(`w-full rounded-xl px-3 py-2.5 text-left transition-all text-[13px]`,t?`bg-gray-200 text-gray-900 font-semibold shadow-sm`:`text-gray-700 hover:bg-gray-200/60 hover:text-gray-900`),children:u?(0,N.jsx)(Nn,{session:e,draftLabel:f,isSaving:p,onDraftLabelChange:_,onSave:v,onCancel:y}):(0,N.jsx)(Pn,{session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:o,agentLabel:s,agentAvatarUrl:c,onSelect:m,childSessionCount:l,onOpenChildSessions:h,onStartEditing:g})})}var In=[{icon:xe,titleKey:`chatWelcomeCapability1Title`,descKey:`chatWelcomeCapability1Desc`},{icon:ve,titleKey:`chatWelcomeCapability2Title`,descKey:`chatWelcomeCapability2Desc`},{icon:Ee,titleKey:`chatWelcomeCapability3Title`,descKey:`chatWelcomeCapability3Desc`}];function Ln({onCreateSession:e,agents:t,selectedAgentId:n,onSelectAgent:r}){let i=t.find(e=>e.id===n)??null;return(0,N.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,N.jsxs)(`div`,{className:`max-w-lg w-full text-center`,children:[(0,N.jsx)(`div`,{className:`mx-auto mb-6 h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center`,children:(0,N.jsx)(me,{className:`h-8 w-8 text-primary`})}),(0,N.jsx)(`h2`,{className:`text-xl font-semibold text-gray-900 mb-2`,children:o(`chatWelcomeTitle`)}),(0,N.jsx)(`p`,{className:`text-sm text-gray-500 mb-8`,children:o(`chatWelcomeSubtitle`)}),(0,N.jsxs)(`div`,{className:`mb-6 flex items-center justify-center gap-2.5`,children:[(0,N.jsx)(`span`,{className:`text-[13px] font-medium text-gray-500`,children:o(`chatDraftAgentTitle`)}),(0,N.jsxs)(Je,{value:n,onValueChange:r,children:[(0,N.jsxs)(ze,{"aria-label":o(`chatDraftAgentTitle`),className:`h-auto w-auto gap-1 rounded-full border-0 bg-transparent px-1.5 py-1 text-gray-500 shadow-none hover:bg-white/70 hover:text-gray-800 focus:ring-0`,children:[(0,N.jsx)(`span`,{className:`sr-only`,children:o(`chatDraftAgentTitle`)}),(0,N.jsx)(`div`,{className:`flex items-center gap-1.5`,children:i?(0,N.jsx)(jn,{agentId:i.id,displayName:i.displayName,avatarUrl:i.avatarUrl,className:`h-7 w-7 shrink-0`}):null})]}),(0,N.jsx)(Ue,{className:`rounded-xl border-gray-200/80 shadow-lg`,children:t.map(e=>(0,N.jsx)(Ke,{value:e.id,className:`rounded-lg pr-10`,children:(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(jn,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,N.jsx)(`span`,{className:`truncate text-sm font-medium text-gray-700`,children:e.displayName?.trim()||e.id})]})},e.id))})]})]}),(0,N.jsx)(`div`,{className:`grid grid-cols-3 gap-3`,children:In.map(t=>{let n=t.icon;return(0,N.jsxs)(`button`,{onClick:e,className:`rounded-2xl border border-gray-200 bg-white p-4 text-left shadow-card hover:shadow-card-hover transition-shadow cursor-pointer`,children:[(0,N.jsx)(`div`,{className:`h-9 w-9 rounded-xl bg-primary/8 flex items-center justify-center mb-3`,children:(0,N.jsx)(n,{className:`h-4.5 w-4.5 text-primary`})}),(0,N.jsx)(`div`,{className:`text-sm font-semibold text-gray-900 mb-1`,children:o(t.titleKey)}),(0,N.jsx)(`div`,{className:`text-[11px] text-gray-500 leading-relaxed`,children:o(t.descKey)})]},t.titleKey)})})]})})}var Rn=e=>`[data-item-index="${e}"]`;function zn(e){let{activeIndex:t,containerRef:n,getItemSelector:r,isEnabled:i,itemCount:a}=e,o=r??Rn;(0,P.useEffect)(()=>{if(!i||a===0)return;let e=n.current;if(!e)return;let r=e.querySelector(o(t));typeof r?.scrollIntoView==`function`&&r.scrollIntoView({block:`nearest`,inline:`nearest`})},[t,n,o,i,a])}function Bn(){let e=(0,P.useRef)(null),[t,n]=(0,P.useState)(null);return(0,P.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=()=>{n(t.getBoundingClientRect().width)};r();let i=new ResizeObserver(()=>r());return i.observe(t),()=>i.disconnect()},[]),{elementRef:e,width:t}}function F(...e){return n(r(e))}var Vn=P.forwardRef(({className:e,type:t,...n},r)=>(0,N.jsx)(`input`,{type:t,className:F(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-900 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));Vn.displayName=`ChatInput`;var Hn=bt,Un=ht,Wn=gt,Gn=P.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,...r},i)=>(0,N.jsx)(vt,{children:(0,N.jsx)(mt,{ref:i,sideOffset:t,align:n,className:F(`z-[var(--z-popover,50)] w-72 overflow-hidden rounded-2xl border border-gray-200/50 bg-white p-4 shadow-lg 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),...r})}));Gn.displayName=mt.displayName;var Kn=He,qn=qe,Jn=Ze,Yn=P.forwardRef(({className:e,children:t,...n},r)=>(0,N.jsxs)(Xe,{ref:r,className:F(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-gray-200/80 bg-white px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,N.jsx)(Pe,{asChild:!0,children:(0,N.jsx)(je,{className:`h-4 w-4 opacity-50`})})]}));Yn.displayName=Xe.displayName;var Xn=P.forwardRef(({className:e,...t},n)=>(0,N.jsx)(Le,{ref:n,className:F(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,N.jsx)(Ae,{className:`h-4 w-4`})}));Xn.displayName=Le.displayName;var Zn=P.forwardRef(({className:e,...t},n)=>(0,N.jsx)(Re,{ref:n,className:F(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,N.jsx)(je,{className:`h-4 w-4`})}));Zn.displayName=Re.displayName;var Qn=P.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,N.jsx)(Ge,{children:(0,N.jsxs)(We,{ref:i,className:F(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md bg-white text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,N.jsx)(Xn,{}),(0,N.jsx)(Ne,{className:F(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,N.jsx)(Zn,{})]})}));Qn.displayName=We.displayName;var $n=P.forwardRef(({className:e,...t},n)=>(0,N.jsx)(Ie,{ref:n,className:F(`px-2 py-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-gray-500`,e),...t}));$n.displayName=Ie.displayName;var er=P.forwardRef(({className:e,children:t,...n},r)=>(0,N.jsxs)(Ve,{ref:r,className:F(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-gray-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-gray-100`,e),...n,children:[(0,N.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,N.jsx)(Ye,{children:(0,N.jsx)(Be,{className:`h-4 w-4`})})}),(0,N.jsx)(Fe,{children:t})]}));er.displayName=Ve.displayName;var tr=P.forwardRef(({className:e,...t},n)=>(0,N.jsx)(Me,{ref:n,className:F(`-mx-1 my-1 h-px bg-gray-100`,e),...t}));tr.displayName=Me.displayName;var nr=At,rr=wt,ir=Et,ar=P.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,N.jsx)(Ot,{children:(0,N.jsx)(Ct,{ref:r,sideOffset:t,className:F(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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})}));ar.displayName=Ct.displayName;var or={Popover:Hn,PopoverAnchor:Wn,PopoverContent:Gn,PopoverTrigger:Un,Input:Vn,Select:Kn,SelectContent:Qn,SelectGroup:qn,SelectItem:er,SelectLabel:$n,SelectSeparator:tr,SelectTrigger:Yn,SelectValue:Jn,Tooltip:rr,TooltipContent:ar,TooltipProvider:nr,TooltipTrigger:ir},sr=680,cr=.82,lr=560;function ur(e){let{Popover:t,PopoverAnchor:n,PopoverContent:r}=or,{elementRef:i,width:a}=Bn(),o=(0,P.useRef)(null),{isOpen:s,isLoading:c,items:l,activeIndex:u,activeItem:d,texts:f,onSelectItem:p,onOpenChange:m,onSetActiveIndex:h}=e,g=(0,P.useMemo)(()=>{if(a)return Math.min(a>lr?a*cr:a,sr)},[a]);return zn({containerRef:o,activeIndex:u,itemCount:l.length,isEnabled:s&&!c,getItemSelector:e=>`[data-slash-index="${e}"]`}),(0,N.jsxs)(t,{open:s,onOpenChange:m,children:[(0,N.jsx)(n,{asChild:!0,children:(0,N.jsx)(`div`,{ref:i,className:`pointer-events-none absolute bottom-full left-3 right-3 h-0`})}),(0,N.jsx)(r,{side:`top`,align:`start`,sideOffset:10,className:`z-[70] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-2xl border border-gray-200 bg-white/95 p-0 shadow-2xl backdrop-blur-md`,onOpenAutoFocus:e=>e.preventDefault(),style:g?{width:`${g}px`}:void 0,children:(0,N.jsxs)(`div`,{className:`grid min-h-[240px] grid-cols-[minmax(220px,300px)_minmax(0,1fr)]`,children:[(0,N.jsx)(`div`,{ref:o,role:`listbox`,"aria-label":f.slashSectionLabel,className:`custom-scrollbar max-h-[320px] overflow-y-auto border-r border-gray-200 p-2.5`,children:c?(0,N.jsx)(`div`,{className:`p-2 text-xs text-gray-500`,children:f.slashLoadingLabel}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`mb-2 px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:f.slashSectionLabel}),l.length===0?(0,N.jsx)(`div`,{className:`px-2 text-xs text-gray-400`,children:f.slashEmptyLabel}):(0,N.jsx)(`div`,{className:`space-y-1`,children:l.map((e,t)=>{let n=t===u;return(0,N.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,"data-slash-index":t,onMouseEnter:()=>h(t),onClick:()=>p(e),className:`flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition ${n?`bg-gray-100 text-gray-900`:`text-gray-700 hover:bg-gray-50`}`,children:[(0,N.jsx)(`span`,{className:`truncate text-xs font-semibold`,children:e.title}),(0,N.jsx)(`span`,{className:`truncate text-xs text-gray-500`,children:e.subtitle})]},e.key)})})]})}),(0,N.jsx)(`div`,{className:`min-w-0 p-2.5`,children:d?(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary`,children:d.subtitle}),(0,N.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:d.title})]}),(0,N.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:d.description}),(0,N.jsx)(`div`,{className:`space-y-1`,children:d.detailLines.map(e=>(0,N.jsx)(`div`,{className:`min-w-0 break-all rounded-md bg-gray-50 px-2 py-1 text-[11px] leading-5 text-gray-600`,children:e},e))}),(0,N.jsx)(`div`,{className:`pt-1 text-[11px] text-gray-500`,children:f.slashSkillHintLabel})]}):(0,N.jsx)(`div`,{className:`text-xs text-gray-500`,children:f.slashHintLabel})})]})})]})}var dr=_(`inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-all duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-gray-200 bg-white hover:bg-gray-50 hover:text-gray-800 text-gray-600`,secondary:`bg-gray-100 text-gray-700 hover:bg-gray-200/80`,ghost:`hover:bg-gray-100/80 hover:text-gray-800`,link:`text-primary underline-offset-4 hover:underline`,primary:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,subtle:`bg-gray-100 text-gray-600 hover:bg-gray-200/80`,"primary-outline":`border border-primary/30 text-primary hover:bg-primary hover:text-primary-foreground`},size:{default:`h-9 px-4 py-2`,sm:`h-8 px-3 text-xs`,lg:`h-11 px-5 text-[14px]`,xl:`h-12 px-6 text-[15px]`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),fr=P.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,N.jsx)(`button`,{className:F(dr({variant:t,size:n,className:e})),ref:i,...r}));fr.displayName=`ChatButton`;var pr=120;function mr(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=pr?t:`${t.slice(0,pr-1)}…`}function hr(){return(0,N.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`chat-stop-icon`,className:`block h-3 w-3 rounded-[2px] bg-gray-700 shadow-[inset_0_0_0_1px_rgba(17,24,39,0.06)]`})}function gr({contextWindow:e}){let{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:i}=or,a=Math.max(0,Math.min(1,e.ratio)),o=Math.round(a*360);return(0,N.jsx)(r,{delayDuration:0,children:(0,N.jsxs)(t,{children:[(0,N.jsx)(i,{asChild:!0,children:(0,N.jsxs)(`button`,{type:`button`,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700`,"aria-label":e.label,title:e.label,children:[(0,N.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[7px] rounded-full`,style:{background:`conic-gradient(#9ca3af ${o}deg, #e5e7eb 0deg)`}}),(0,N.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[10px] rounded-full bg-white`})]})}),(0,N.jsx)(n,{side:`top`,className:`max-w-[18rem]`,children:(0,N.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-5 font-semibold text-gray-800`,children:[(0,N.jsx)(`span`,{children:e.label}),(0,N.jsx)(`span`,{children:e.percentLabel})]}),e.details.map(e=>(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-5 text-gray-600`,children:[(0,N.jsx)(`span`,{children:e.label}),(0,N.jsx)(`span`,{className:`font-medium text-gray-800`,children:e.value})]},e.label))]})})]})})}function _r({sendError:e,sendErrorDetailsLabel:t,isSending:n,canStopGeneration:r,sendDisabled:i,stopDisabled:a,stopHint:o,sendButtonLabel:s,stopButtonLabel:c,contextWindow:l,onSend:u,onStop:d}){let{Popover:f,PopoverContent:p,PopoverTrigger:m,Tooltip:h,TooltipContent:g,TooltipProvider:_,TooltipTrigger:v}=or,y=e?.trim()??``,b=y?mr(y):``,x=t?.trim()||`Details`;return(0,N.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[y?(0,N.jsxs)(`div`,{className:`flex max-w-[420px] items-start justify-end gap-2 text-right`,children:[(0,N.jsx)(`div`,{className:`min-w-0 flex-1 text-[11px] text-red-600`,children:(0,N.jsx)(`span`,{className:`block truncate`,title:y,children:b})}),(0,N.jsxs)(f,{children:[(0,N.jsx)(m,{asChild:!0,children:(0,N.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-full border border-red-200/80 bg-red-50 px-2 py-0.5 text-[10px] font-semibold text-red-700 transition-colors hover:bg-red-100`,children:x})}),(0,N.jsxs)(p,{align:`end`,className:`w-[min(32rem,calc(100vw-1.5rem))] border-red-100/80 p-0`,children:[(0,N.jsx)(`div`,{className:`border-b border-red-100 bg-red-50/80 px-4 py-2 text-xs font-semibold text-red-700`,children:x}),(0,N.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words px-4 py-3 text-xs leading-relaxed text-red-700`,children:y})]})]})]}):null,(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l?(0,N.jsx)(gr,{contextWindow:l}):null,n?r?(0,N.jsx)(fr,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":c,onClick:()=>void d(),disabled:a,children:(0,N.jsx)(hr,{})}):(0,N.jsx)(_,{children:(0,N.jsxs)(h,{children:[(0,N.jsx)(v,{asChild:!0,children:(0,N.jsx)(`span`,{children:(0,N.jsx)(fr,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":c,disabled:!0,children:(0,N.jsx)(hr,{})})})}),(0,N.jsx)(g,{side:`top`,children:(0,N.jsx)(`p`,{className:`text-xs`,children:o})})]})}):(0,N.jsx)(fr,{size:`icon`,className:`h-8 w-8 rounded-full`,"aria-label":s,onClick:()=>void u(),disabled:i,children:(0,N.jsx)(Pt,{className:`h-5 w-5`})})]})]})}function vr(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.label,e.key,e.description].filter(e=>typeof e==`string`&&e.trim().length>0).join(` `).toLowerCase().includes(n)):e}function yr(e){let{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:i}=or,{picker:a}=e,o=(0,P.useRef)(null),s=(0,P.useId)(),[c,l]=(0,P.useState)(``),[u,d]=(0,P.useState)(0),f=(0,P.useMemo)(()=>new Set(a.selectedKeys),[a.selectedKeys]),p=a.selectedKeys.length,m=c.trim().length>0,h=(0,P.useMemo)(()=>{if(m)return null;let e=a.groups?.filter(e=>e.options.length>0)??[];return e.length>0?e:null},[m,a.groups]),g=(0,P.useMemo)(()=>h?h.flatMap(e=>e.options):vr(a.options,c),[h,a.options,c]);(0,P.useEffect)(()=>{d(0)},[c]),(0,P.useEffect)(()=>{d(e=>g.length===0?0:Math.min(e,g.length-1))},[g.length]),zn({containerRef:o,activeIndex:u,itemCount:g.length,isEnabled:g.length>0,getItemSelector:e=>`[data-skill-index="${e}"]`});let _=e=>{if(f.has(e)){a.onSelectedKeysChange(a.selectedKeys.filter(t=>t!==e));return}a.onSelectedKeysChange([...a.selectedKeys,e])},v=e=>{if(g.length!==0){if(e.key===`ArrowDown`){e.preventDefault(),d(e=>Math.min(e+1,g.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),d(e=>Math.max(e-1,0));return}if(e.key===`Enter`){e.preventDefault();let t=g[u];t&&_(t.key)}}};return(0,N.jsxs)(n,{children:[(0,N.jsx)(i,{asChild:!0,children:(0,N.jsxs)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-label":a.title,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg px-0 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 sm:w-auto sm:gap-1.5 sm:px-3`,children:[(0,N.jsx)(ve,{className:`h-4 w-4`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:a.title}),p>0?(0,N.jsx)(`span`,{className:`absolute -right-1 -top-1 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold leading-none text-white shadow-sm sm:static sm:ml-0.5 sm:bg-primary/10 sm:text-primary sm:shadow-none`,children:p}):null]})}),(0,N.jsxs)(r,{side:`top`,align:`start`,className:`w-[360px] p-0`,children:[(0,N.jsxs)(`div`,{className:`space-y-2 border-b border-gray-100 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:a.title}),(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsx)(Oe,{className:`pointer-events-none absolute left-3 top-2.5 h-3.5 w-3.5 text-gray-400`}),(0,N.jsx)(t,{value:c,onChange:e=>l(e.target.value),onKeyDown:v,placeholder:a.searchPlaceholder,role:`combobox`,"aria-controls":s,"aria-expanded":`true`,"aria-autocomplete":`list`,"aria-activedescendant":g[u]?`${s}-option-${u}`:void 0,className:`h-8 rounded-lg pl-8 text-xs`})]})]}),(0,N.jsx)(`div`,{ref:o,id:s,role:`listbox`,"aria-multiselectable":`true`,className:`custom-scrollbar max-h-[320px] overflow-y-auto`,children:a.isLoading?(0,N.jsx)(`div`,{className:`p-4 text-xs text-gray-500`,children:a.loadingLabel}):g.length===0?(0,N.jsx)(`div`,{className:`p-4 text-center text-xs text-gray-500`,children:a.emptyLabel}):(0,N.jsx)(`div`,{className:`py-1`,children:(()=>{let e=h??[{key:`all-skills`,options:g}],t=0;return e.map(e=>(0,N.jsxs)(`div`,{children:[e.label?(0,N.jsx)(`div`,{className:`px-4 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:e.label}):null,e.options.map(e=>{let n=t;t+=1;let r=f.has(e.key),i=n===u;return(0,N.jsxs)(`button`,{type:`button`,id:`${s}-option-${n}`,role:`option`,"aria-selected":r,"data-skill-index":n,onClick:()=>_(e.key),onMouseEnter:()=>d(n),className:`flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors ${i?`bg-gray-50`:`hover:bg-gray-50`}`,children:[(0,N.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500`,children:(0,N.jsx)(sn,{className:`h-4 w-4`})}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`truncate text-sm text-gray-900`,children:e.label}),e.badgeLabel?(0,N.jsx)(`span`,{className:`shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:e.badgeLabel}):null]}),(0,N.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-gray-500`,children:e.description||e.key})]}),(0,N.jsx)(`div`,{className:`ml-3 shrink-0`,children:(0,N.jsx)(`span`,{className:r?`inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-white`:`inline-flex h-5 w-5 items-center justify-center rounded-full border border-gray-300 bg-white`,children:r?(0,N.jsx)(Be,{className:`h-3 w-3`}):null})})]},e.key)})]},e.key))})()})}),a.manageHref&&a.manageLabel?(0,N.jsx)(`div`,{className:`border-t border-gray-100 px-4 py-2.5`,children:(0,N.jsxs)(`a`,{href:a.manageHref,className:`inline-flex items-center gap-1.5 text-xs font-medium text-primary transition-colors hover:text-primary/80`,children:[a.manageLabel,(0,N.jsx)(Qe,{className:`h-3 w-3`})]})}):null]})]})}function br({icon:e}){return e===`sparkles`?(0,N.jsx)(ot,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):e===`brain`?(0,N.jsx)(Ft,{className:`h-3.5 w-3.5 shrink-0 text-gray-500`}):null}function xr({icon:e}){return e===`paperclip`?(0,N.jsx)(an,{className:`h-4 w-4`}):(0,N.jsx)(br,{icon:e})}var Sr={model:`min-w-0 flex-1 sm:min-w-[220px] sm:flex-none`,"session-type":`shrink-0`,thinking:`shrink-0`},Cr={model:`w-[min(18rem,calc(100vw-1rem))] sm:w-[320px]`,"session-type":`w-[220px]`,thinking:`w-[180px]`};function wr(e){return e.key===`model`&&e.selectedLabel&&e.selectedLabel.split(`/`).slice(1).join(`/`).trim()||e.selectedLabel}function Tr({item:e}){let{Select:t,SelectContent:n,SelectGroup:r,SelectItem:i,SelectLabel:a,SelectSeparator:o,SelectTrigger:s,SelectValue:c}=or,l=e.groups?.filter(e=>e.options.length>0)??(e.options.length>0?[{key:`${e.key}-default`,options:e.options}]:[]),u=l.some(e=>e.options.length>0),d=wr(e);return(0,N.jsxs)(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[(0,N.jsx)(s,{className:`h-8 w-auto rounded-lg border-0 bg-transparent px-2 text-xs font-medium text-gray-600 shadow-none hover:bg-gray-100 focus:ring-0 sm:px-3 ${Sr[e.key]??``}`,children:e.selectedLabel?(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-left`,children:[(0,N.jsx)(br,{icon:e.icon}),(0,N.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-700 sm:hidden`,children:d}),(0,N.jsx)(`span`,{className:`hidden truncate text-xs font-semibold text-gray-700 sm:inline`,children:e.selectedLabel})]}):e.loading?(0,N.jsx)(`div`,{className:`h-3 w-24 animate-pulse rounded bg-gray-200`}):(0,N.jsx)(c,{placeholder:e.placeholder})}),(0,N.jsxs)(n,{className:Cr[e.key]??``,children:[u?null:e.loading?(0,N.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,N.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-gray-200`}),(0,N.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-gray-200`}),(0,N.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-gray-200`})]}):e.emptyLabel?(0,N.jsx)(`div`,{className:`px-3 py-2 text-xs text-gray-500`,children:e.emptyLabel}):null,l.map((e,t)=>(0,N.jsxs)(`div`,{children:[t>0?(0,N.jsx)(o,{}):null,(0,N.jsxs)(r,{children:[e.label?(0,N.jsx)(a,{children:e.label}):null,e.options.map(e=>(0,N.jsx)(i,{value:e.value,className:`py-2`,children:e.description?(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,N.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-800`,children:e.label}),(0,N.jsx)(`span`,{className:`truncate text-[11px] text-gray-500`,children:e.description})]}):(0,N.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-800`,children:e.label})},e.value))]})]},e.key))]})]})}function Er({actions:e,accessories:t,selects:n,skillPicker:r}){let{Tooltip:i,TooltipContent:a,TooltipProvider:o,TooltipTrigger:s}=or;return(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 pb-3`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 overflow-hidden`,children:[r?(0,N.jsx)(yr,{picker:r}):null,n.map(e=>(0,N.jsx)(Tr,{item:e},e.key)),t?.map(e=>{let t=(0,N.jsxs)(`button`,{type:`button`,className:`inline-flex items-center rounded-lg py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:text-gray-400 ${e.iconOnly?`h-8 w-8 justify-center px-0`:`gap-1.5 px-3`}`,onClick:e.onClick,disabled:e.disabled,"aria-label":e.label,children:[(0,N.jsx)(xr,{icon:e.icon}),e.iconOnly?null:(0,N.jsx)(`span`,{children:e.label})]});return e.tooltip?(0,N.jsx)(o,{children:(0,N.jsxs)(i,{children:[(0,N.jsx)(s,{asChild:!0,children:e.disabled?(0,N.jsx)(`span`,{className:`inline-flex`,children:t}):t}),(0,N.jsx)(a,{side:`top`,children:(0,N.jsx)(`p`,{className:`text-xs`,children:e.tooltip})})]})},e.key):(0,N.jsx)(`div`,{children:t},e.key)})]}),(0,N.jsx)(_r,{...e})]})}var Dr=(0,P.createContext)(null);function Or(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function kr(){let e=(0,P.useContext)(Dr);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}function I(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ar(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var jr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Mr=jr&&`documentMode`in document?document.documentMode:null,Nr=jr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pr=jr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Fr=!(!jr||!(`InputEvent`in window)||Mr)&&`getTargetRanges`in new window.InputEvent(`input`),Ir=jr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Lr=jr&&/Android/.test(navigator.userAgent),Rr=jr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Lr,zr=jr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Br=jr&&Lr&&zr,Vr=jr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Nr&&!zr,Hr=0,Ur=1,Wr=2,Gr=1,Kr=2,qr=3,Jr=4,Yr=5,Xr=6,Zr=Rr||Ir||Vr?`\xA0`:``,Qr=`
|
|
2
2
|
|
|
3
3
|
`,$r=Pr?`\xA0`:Zr,ei={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},ti={directionless:1,unmergeable:2},ni={center:2,end:6,justify:4,left:1,right:3,start:5},ri={[Kr]:`center`,[Xr]:`end`,[Jr]:`justify`,[Gr]:`left`,[qr]:`right`,[Yr]:`start`},ii={normal:0,segmented:2,token:1},ai={[Hr]:`normal`,[Wr]:`segmented`,[Ur]:`token`},oi=`$config`;function si(e,t,n,r,i,a){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&(V(o)&&si(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}var ci=!1,li=0;function ui(e){li=e.timeStamp}function di(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&ll(e,n)!==void 0}function fi(e,t,n){let r=Zl(Ul(n)),i=null,a=null;r!==null&&r.anchorNode===e&&(i=r.anchorOffset,a=r.focusOffset);let o=e.nodeValue;o!==null&&Sl(t,o,i,a,!1)}function pi(e,t,n){if(z(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return Qc(t)&&n.isAttached()}function mi(e,t,n,r){for(let i=e;i&&!fu(i);i=Ll(i)){let e=ll(i,t);if(e!==void 0){let t=sl(e,n);if(t)return yc(t)||!$l(i)?void 0:[i,t]}else if(i===r)return[r,ml(n)]}}function hi(e,t,n){ci=!0;let r=performance.now()-li>100;try{pc(e,()=>{let i=B()||function(e){return e.getEditorState().read(()=>{let e=B();return e===null?null:e.clone()})}(e),a=new Map,o=e.getRootElement(),s=e._editorState,c=e._blockCursorElement,l=!1,u=``;for(let n=0;n<t.length;n++){let d=t[n],f=d.type,p=d.target,m=mi(p,e,s,o);if(!m)continue;let[h,g]=m;if(f===`characterData`)r&&R(g)&&Qc(p)&&pi(i,p,g)&&fi(p,g,e);else if(f===`childList`){l=!0;let t=d.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=cl(r),a=r.parentNode;if(a!=null&&r!==c&&i===null&&!di(r,a,e)){if(Pr){let e=($l(r)?r.innerText:null)||r.nodeValue;e&&(u+=e)}a.removeChild(r)}}let n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(di(r,p,e)||c===r)&&(p.appendChild(r),t++)}r!==t&&a.set(h,g)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){let n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||di(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(l&&hl(i),Pr&&Fl(e)&&i.insertRawText(u))})}finally{ci=!1}}function gi(e){let t=e._observer;t!==null&&hi(e,t.takeRecords(),t)}function _i(e){(function(e){li===0&&Ul(e).addEventListener(`textInput`,ui,!0)})(e),e._observer=new MutationObserver((t,n)=>{hi(e,t,n)})}var vi=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Ti).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function yi(e,t){return new vi(e,t)}function bi(e){let t=new Map,n=new Set;for(let r=typeof e==`function`?e:e.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){let{ownNodeConfig:e}=mu(r);if(e&&e.stateConfigs)for(let r of e.stateConfigs){let e;`stateConfig`in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}var xi=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState;this.size=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return wi(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=wi(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function Si(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new xi(t,Ci(t));return t.__state=n,n}function Ci(e){return e.__state?e.__state.sharedNodeState:Vc(au(),e.getType()).sharedNodeState}function wi(e){if(e)for(let t in e)return e}function Ti(e){return e}function Ei(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function Di(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function Oi(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function ki(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&Ei(n,e,t)||t&&Ei(n,t,e)||e&&Di(n,e,t)||t&&Di(n,t,e))}(c,l))}function Ai(e,t){let n=e.mergeWithSibling(t),r=ec()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function ji(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&R(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(ki(t,r)){r=Ai(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&R(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(ki(r,n)){r=Ai(r,n);break}break}n.remove()}}else r.remove()}function Mi(e){return Ni(e.anchor),Ni(e.focus),e}function Ni(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),R(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!V(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi=``,Gi=null,Ki=null,qi=!1,Ji=!1;function Yi(e,t){let n=Bi.get(e);if(t!==null){let n=pa(e);n.parentNode===t&&t.removeChild(n)}if(Vi.has(e)||Fi._keyToDOMMap.delete(e),V(n)){let e=sa(n,Bi);Xi(e,0,e.length-1,null)}n!==void 0&&Ml(Ui,Ii,Li,n,`destroyed`)}function Xi(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&Yi(t,r)}}function Zi(e,t){e.setProperty(`text-align`,t)}var Qi=`40px`;function $i(e,t){let n=Pi.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty(`padding-inline-start`,``);let r=getComputedStyle(Fi._rootElement||e).getPropertyValue(`--lexical-indent-base-value`)||Qi;e.style.setProperty(`padding-inline-start`,`calc(${t} * ${r})`)}function ea(e,t){let n=e.style;t===0?Zi(n,``):t===1?Zi(n,`left`):t===2?Zi(n,`center`):t===3?Zi(n,`right`):t===4?Zi(n,`justify`):t===5?Zi(n,`start`):t===6&&Zi(n,`end`)}function ta(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(xc(e))return null;let n=e.getParentOrThrow();return xc(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function na(e,t){let n=Vi.get(e);n===void 0&&I(60);let r=n.createDOM(Pi,Fi);if(function(e,t,n){let r=n._keyToDOMMap;(function(e,t,n){let r=`__lexicalKey_${t._key}`;e[r]=n})(t,n,e),r.set(e,t)}(e,r,Fi),R(n)?r.setAttribute(`data-lexical-text`,`true`):yc(n)&&r.setAttribute(`data-lexical-decorator`,`true`),V(n)){let e=n.__indent,t=n.__size;if(ta(r,n),e!==0&&$i(r,e),t!==0){let e=t-1;ra(sa(n,Vi),n,0,e,n.getDOMSlot(r))}let i=n.__format;i!==0&&ea(r,i),n.isInline()||aa(null,n,r)}else{let t=n.getTextContent();if(yc(n)){let t=n.decorate(Fi,Pi);t!==null&&la(e,t),r.contentEditable=`false`}Wi+=t}return t!==null&&t.insertChild(r),Ml(Ui,Ii,Li,n,`created`),r}function ra(e,t,n,r,i){let a=Wi;Wi=``;let o=n;for(;o<=r;++o){na(e[o],i);let t=Vi.get(e[o]);t!==null&&R(t)?Gi===null&&(Gi=t.getFormat(),Ki=t.getStyle()):V(t)&&o<r&&!t.isInline()&&(Wi+=Qr)}i.element.__lexicalTextContent=Wi,Wi=a+Wi}function ia(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return Go(e)?`line-break`:yc(e)&&e.isInline()?`decorator`:null}return`empty`}return null}function aa(e,t,n){let r=ia(e,Bi),i=ia(t,Vi);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function oa(e,t,n){var r;Gi=null,Ki=null,function(e,t,n){let r=Wi,i=e.__size,a=t.__size;Wi=``;let o=n.element;if(i===1&&a===1){let n=e.__first,r=t.__first;if(n===r)ca(n,o);else{let e=pa(n),t=na(r,null);try{o.replaceChild(t,e)}catch(i){if(typeof i==`object`&&i){let a=`${i.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw Error(a)}throw i}Yi(n,null)}let i=Vi.get(r);R(i)&&Gi===null&&(Gi=i.getFormat(),Ki=i.getStyle())}else{let r=sa(e,Bi),s=sa(t,Vi);if(r.length!==i&&I(227),s.length!==a&&I(228),i===0)a!==0&&ra(s,0,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&n.element.__lexicalLineBreak==null;Xi(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else (function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f];if(e===r)u=ua(ca(r,a.element)),d++,f++;else{if(l===void 0&&(l=da(n,f)),c===void 0)c=da(t,d);else if(!c.has(e)){d++;continue}if(!l.has(e)){u=ua(pa(e)),Yi(e,a.element),d++,c.delete(e);continue}if(c.has(r)){let e=Il(Fi,r);e!==u&&a.withBefore(u).insertChild(e),u=ua(ca(r,a.element)),d++,f++}else na(r,a.withBefore(u)),f++}let i=Vi.get(r);i!==null&&R(i)?Gi===null&&(Gi=i.getFormat(),Ki=i.getStyle()):V(i)&&f<=s&&!i.isInline()&&(Wi+=Qr)}let p=d>o,m=f>s;if(p&&!m){let e=n[s+1],t=e===void 0?null:Fi.getElementByKey(e);ra(n,0,f,s,a.withBefore(t))}else m&&!p&&Xi(t,d,o,a.element)})(0,r,s,i,a,n)}o.__lexicalTextContent=Wi,Wi=r+Wi}(e,t,t.getDOMSlot(n)),r=t,Gi==null||Gi===r.__textFormat||Ji||r.setTextFormat(Gi),function(e){Ki==null||Ki===e.__textStyle||Ji||e.setTextStyle(Ki)}(t)}function sa(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t.get(r);e===void 0&&I(101),n.push(r),r=e.__next}return n}function ca(e,t){let n=Bi.get(e),r=Vi.get(e);n!==void 0&&r!==void 0||I(61);let i=qi||zi.has(e)||Ri.has(e),a=Il(Fi,e);if(n===r&&!i){let e;if(V(n)){let t=a.__lexicalTextContent;typeof t==`string`?e=t:(e=n.getTextContent(),a.__lexicalTextContent=e)}else e=n.getTextContent();return Wi+=e,a}if(n!==r&&i&&Ml(Ui,Ii,Li,r,`updated`),r.updateDOM(n,a,Pi)){let n=na(e,null);return t===null&&I(62),t.replaceChild(n,a),Yi(e,null),n}if(V(n)){V(r)||I(334,e);let t=r.__indent;(qi||t!==n.__indent)&&$i(a,t);let o=r.__format;if((qi||o!==n.__format)&&ea(a,o),i)oa(n,r,a),xc(r)||r.isInline()||aa(n,r,a);else{let e=a.__lexicalTextContent,t;typeof e==`string`?t=e:(t=n.getTextContent(),a.__lexicalTextContent=t),Wi+=t}if((qi||r.__dir!==n.__dir)&&(ta(a,r),xc(r)&&!qi))for(let e of r.getChildren())V(e)&&ta(Il(Fi,e.getKey()),e)}else{let t=r.getTextContent();if(yc(r)){let t=r.decorate(Fi,Pi);t!==null&&la(e,t)}Wi+=t}if(!Ji&&xc(r)&&r.__cachedText!==Wi){let e=r.getWritable();e.__cachedText=Wi,r=e}return a}function la(e,t){let n=Fi._pendingDecorators,r=Fi._decorators;if(n===null){if(r[e]===t)return;n=dl(Fi)}n[e]=t}function ua(e){let t=e.nextSibling;return t!==null&&t===Fi._blockCursorElement&&(t=t.nextSibling),t}function da(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function fa(e,t,n,r,i,a){Wi=``,qi=r===2,Fi=n,Pi=n._config,Ii=n._nodes,Li=Fi._listeners.mutation,Ri=i,zi=a,Bi=e._nodeMap,Vi=t._nodeMap,Ji=t._readOnly,Hi=new Map(n._keyToDOMMap);let o=new Map;return Ui=o,ca(`root`,null),Fi=void 0,Ii=void 0,Ri=void 0,zi=void 0,Bi=void 0,Vi=void 0,Pi=void 0,Hi=void 0,Ui=void 0,o}function pa(e){let t=Hi.get(e);return t===void 0&&I(75,e),t}function L(e){return{type:e}}var ma=L(`SELECTION_CHANGE_COMMAND`),ha=L(`CLICK_COMMAND`),ga=L(`BEFORE_INPUT_COMMAND`),_a=L(`INPUT_COMMAND`),va=L(`COMPOSITION_START_COMMAND`),ya=L(`COMPOSITION_END_COMMAND`),ba=L(`DELETE_CHARACTER_COMMAND`),xa=L(`INSERT_LINE_BREAK_COMMAND`),Sa=L(`INSERT_PARAGRAPH_COMMAND`),Ca=L(`CONTROLLED_TEXT_INSERTION_COMMAND`),wa=L(`PASTE_COMMAND`),Ta=L(`REMOVE_TEXT_COMMAND`),Ea=L(`DELETE_WORD_COMMAND`),Da=L(`DELETE_LINE_COMMAND`),Oa=L(`FORMAT_TEXT_COMMAND`),ka=L(`UNDO_COMMAND`),Aa=L(`REDO_COMMAND`),ja=L(`KEYDOWN_COMMAND`),Ma=L(`KEY_ARROW_RIGHT_COMMAND`),Na=L(`MOVE_TO_END`),Pa=L(`KEY_ARROW_LEFT_COMMAND`),Fa=L(`MOVE_TO_START`),Ia=L(`KEY_ARROW_UP_COMMAND`),La=L(`KEY_ARROW_DOWN_COMMAND`),Ra=L(`KEY_ENTER_COMMAND`),za=L(`KEY_SPACE_COMMAND`),Ba=L(`KEY_BACKSPACE_COMMAND`),Va=L(`KEY_ESCAPE_COMMAND`),Ha=L(`KEY_DELETE_COMMAND`),Ua=L(`KEY_TAB_COMMAND`),Wa=L(`DROP_COMMAND`),Ga=L(`DRAGSTART_COMMAND`),Ka=L(`DRAGOVER_COMMAND`),qa=L(`DRAGEND_COMMAND`),Ja=L(`COPY_COMMAND`),Ya=L(`CUT_COMMAND`),Xa=L(`SELECT_ALL_COMMAND`),Za=L(`FOCUS_COMMAND`),Qa=L(`BLUR_COMMAND`),$a=L(`KEY_MODIFIER_COMMAND`),eo=Object.freeze({}),to=[[`keydown`,function(e,t){no=e.timeStamp,ro=e.key,!t.isComposing()&&U(t,ja,e)}],[`pointerdown`,function(e,t){let n=e.target,r=e.pointerType;eu(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&pc(t,()=>{Wc(n)||(lo=!0)})}],[`compositionstart`,function(e,t){U(t,va,e)}],[`compositionend`,function(e,t){Pr?fo=!0:Ir||!Rr&&!Vr?U(t,ya,e):(po=!0,mo=e.data)}],[`input`,function(e,t){e.stopPropagation(),pc(t,()=>{t.dispatchCommand(_a,e)},{event:e}),ao=null}],[`click`,function(e,t){pc(t,()=>{let n=B(),r=Zl(Ul(t)),i=Ns();if(r){if(z(n)){let t=n.anchor,a=t.getNode();if(t.type===`element`&&t.offset===0&&n.isCollapsed()&&!xc(a)&&pl().getChildrenSize()===1&&a.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&a!==n.focus.getNode()){let e=gu(a,e=>V(e)&&!e.isInline());V(e)&&e.select(0)}}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=r.anchorNode;($l(n)||Qc(n))&&hl(Ms(i,r,t,e))}}U(t,ha,e)})}],[`cut`,eo],[`copy`,eo],[`dragstart`,eo],[`dragover`,eo],[`dragend`,eo],[`paste`,eo],[`focus`,eo],[`blur`,eo],[`drop`,eo]];Fr&&to.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||Pr&&Fl(t)||n!==`insertCompositionText`&&U(t,ga,e)}(e,t)]);var no=0,ro=null,io=0,ao=null,oo=new WeakMap,so=new WeakMap,co=!1,lo=!1,uo=!1,fo=!1,po=!1,mo=``,ho=null,go=[0,``,0,`root`,0];function _o(e,t,n,r,i){let a=e.anchor,o=e.focus,s=a.getNode(),c=ec(),l=Zl(Ul(c)),u=l===null?null:l.anchorNode,d=a.key,f=c.getElementByKey(d),p=n.length;return d!==o.key||!R(s)||(!i&&(!Fr||io<r+50)||s.isDirty()&&p<2||_l(n))&&a.offset!==o.offset&&!s.isComposing()||Zc(s)||s.isDirty()&&p>1||(i||!Fr)&&f!==null&&!s.isComposing()&&u!==el(f)||l!==null&&t!==null&&(!t.collapsed||t.startContainer!==l.anchorNode||t.startOffset!==l.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=Xc(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(R(t)||V(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,s)}function vo(e,t){return Qc(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function yo(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=e;co&&(co=!1,vo(r,i)&&vo(a,o)&&!ho)||pc(t,()=>{if(!n)return void hl(null);if(!Kc(t,r,a))return;let s=B();if(ho&&z(s)&&s.isCollapsed()){let e=s.anchor,t=ho.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(s=ho.clone(),hl(s))}if(ho=null,z(s)){let n=s.anchor,r=n.getNode();if(s.isCollapsed()){e.type===`Range`&&e.anchorNode===e.focusNode&&(s.dirty=!0);let i=Ul(t).event,a=i?i.timeStamp:performance.now(),[o,c,l,u,d]=go,f=pl(),p=!1===t.isComposing()&&f.getTextContent()===``;if(a<d+200&&n.offset===l&&n.key===u)bo(s,o,c);else if(n.type===`text`)R(r)||I(141),xo(s,r);else if(n.type===`element`&&!p){V(r)||I(259);let e=n.getNode();e.isEmpty()?function(e,t){bo(e,t.getTextFormat(),t.getTextStyle())}(s,e):bo(s,s.format,``)}}else{let e=n.key,t=s.focus.key,r=s.getNodes(),a=r.length,c=s.isBackward(),l=c?o:i,u=c?i:o,d=c?t:e,f=c?e:t,p=2047,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(R(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}s.format=m?p:0}}U(t,ma,void 0)})}function bo(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function xo(e,t){bo(e,t.getFormat(),t.getStyle())}function So(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function Co(e){let t=e.inputType,n=So(e),r=ec(),i=B();if(t===`deleteContentBackward`){if(i===null){let e=Ns();if(!z(e))return!0;hl(e.clone())}if(z(i)){let t=i.anchor.key===i.focus.key;if(a=e.timeStamp,ro===`MediaLast`&&a<no+30&&r.isComposing()&&t){if(al(null),no=0,setTimeout(()=>{pc(r,()=>{al(null)})},30),z(i)){let e=i.anchor.getNode();e.markDirty(),R(e)||I(142),xo(i,e)}}else{al(null),e.preventDefault();let n=i.anchor.getNode(),a=n.getTextContent(),o=n.canInsertTextAfter(),s=i.anchor.offset===0&&i.focus.offset===a.length,c=Br&&t&&!s&&o;if(c&&i.isCollapsed()&&(c=!yc(Pl(i.anchor,!0))),!c){U(r,ba,!0);let e=B();Br&&z(e)&&e.isCollapsed()&&(ho=e,setTimeout(()=>ho=null))}}return!0}}var a;if(!z(i))return!0;let o=e.data;ao!==null&&xl(!1,r,ao),i.dirty&&ao===null||!i.isCollapsed()||xc(i.anchor.getNode())||n===null||i.applyDOMRange(n),ao=null;let s=i.anchor,c=i.focus,l=s.getNode(),u=c.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
|
|
4
4
|
`)e.preventDefault(),U(r,xa,!1);else if(o===Qr)e.preventDefault(),U(r,Sa,void 0);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),i.insertRawText(t)}else o!=null&&_o(i,n,o,e.timeStamp,!0)?(e.preventDefault(),U(r,Ca,o)):ao=o;return io=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:U(r,Ca,e);break;case`insertFromComposition`:al(null),U(r,Ca,e);break;case`insertLineBreak`:al(null),U(r,xa,!1);break;case`insertParagraph`:al(null),uo&&!Ir?(uo=!1,U(r,xa,!1)):U(r,Sa,void 0);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:U(r,wa,e);break;case`deleteByComposition`:(function(e,t){return e!==t||V(e)||V(t)||!Xc(e)||!Xc(t)})(l,u)&&U(r,Ta,e);break;case`deleteByDrag`:case`deleteByCut`:U(r,Ta,e);break;case`deleteContent`:U(r,ba,!1);break;case`deleteWordBackward`:U(r,Ea,!0);break;case`deleteWordForward`:U(r,Ea,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:U(r,Da,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:U(r,Da,!1);break;case`formatStrikeThrough`:U(r,Oa,`strikethrough`);break;case`formatBold`:U(r,Oa,`bold`);break;case`formatItalic`:U(r,Oa,`italic`);break;case`formatUnderline`:U(r,Oa,`underline`);break;case`historyUndo`:U(r,ka,void 0);break;case`historyRedo`:U(r,Aa,void 0)}return!0}function wo(e){if($l(e.target)&&Wc(e.target))return!0;let t=ec(),n=B(),r=e.data,i=So(e);if(r!=null&&z(n)&&_o(n,i,r,e.timeStamp,!1)){fo&&=(Do(t,r),!1);let i=n.anchor.getNode(),a=Zl(Ul(t));if(a===null)return!0;let o=n.isBackward(),s=o?n.anchor.offset:n.focus.offset,c=o?n.focus.offset:n.anchor.offset;Fr&&!n.isCollapsed()&&R(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,s)+r+i.getTextContent().slice(s+c)===bl(a.anchorNode)||U(t,Ca,r);let l=r.length;Pr&&l>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(n.anchor.offset-=l),Br&&t.isComposing()&&(no=0,al(null))}else xl(!1,t,r===null?void 0:r),fo&&=(Do(t,r||void 0),!1);return function(){Zs(),gi(ec())}(),!0}function To(e){let t=ec(),n=B();if(z(n)&&!t.isComposing()){let r=n.anchor,i=n.anchor.getNode();al(r.key),zl(Bo),(e.timeStamp<no+30||r.type===`element`||!n.isCollapsed()||i.getFormat()!==n.format||R(i)&&i.getStyle()!==n.style)&&U(t,Ca,$r)}return!0}function Eo(e){return Do(ec(),e.data),zl(Vo),!0}function Do(e,t){let n=e._compositionKey;if(al(null),n!==null&&t!=null){if(t===``){let t=sl(n),r=el(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&R(t)){let n=Zl(Ul(e)),i=null,a=null;n!==null&&n.anchorNode===r&&(i=n.anchorOffset,a=n.focusOffset),Sl(t,r.nodeValue,i,a,!0)}return}if(t[t.length-1]===`
|