@onescience/onecode-web 1.14.50-202609111612 → 1.14.50-202609141631

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.
Files changed (58) hide show
  1. package/assets/{3Dmol-CXMSHzDq.js → 3Dmol-BcAnND8e.js} +1 -1
  2. package/assets/{account-system-fBThSwVu.js → account-system-C-X3tt5b.js} +1 -1
  3. package/assets/{alert-04-Cd09aZv7.js → alert-01-D6TAHx4S.js} +1 -1
  4. package/assets/{alert-05-B2vITv_N.js → alert-02-B06XMEjt.js} +1 -1
  5. package/assets/{alert-01-BMiyRUZE.js → alert-04-CaMG0Bzh.js} +1 -1
  6. package/assets/{alert-02-CKd_g3Ny.js → alert-05-D72dLAD1.js} +1 -1
  7. package/assets/alert-06-nnCZ59ig.js +1 -0
  8. package/assets/alert-07-K__uwA9X.js +1 -0
  9. package/assets/alert-08-BYGQ21_y.js +1 -0
  10. package/assets/alert-10-CMrTzbLq.js +1 -0
  11. package/assets/{bip-bop-03-BZF_yfR7.js → bip-bop-03-C0ptGXEB.js} +1 -1
  12. package/assets/{bip-bop-04-sdA3LsKV.js → bip-bop-04-CW9V4QqZ.js} +1 -1
  13. package/assets/{bip-bop-06-DRWZMRXj.js → bip-bop-06-J35fi2cB.js} +1 -1
  14. package/assets/{bip-bop-08-CORLCKUc.js → bip-bop-08-DK2AlLyt.js} +1 -1
  15. package/assets/bip-bop-09-DYuti-nv.js +1 -0
  16. package/assets/{center-C1vSBqI8.js → center-Cv8SnYAR.js} +1 -1
  17. package/assets/{current-project-BS01LChF.js → current-project-DpisCbmX.js} +1 -1
  18. package/assets/{dialog-edit-project-D7rJz0nW.js → dialog-edit-project-D1QiV1lb.js} +1 -1
  19. package/assets/{dialog-fork-D20BG6HY.js → dialog-fork-BTYK9k31.js} +1 -1
  20. package/assets/{dialog-project-upload-CXo0faUP.js → dialog-project-upload-DGBE14Yk.js} +1 -1
  21. package/assets/{dialog-select-file-DPtRwBjd.js → dialog-select-file-DNzVZ9Hn.js} +1 -1
  22. package/assets/{dialog-select-model-Drx7k1n7.js → dialog-select-model-BGvyGloR.js} +2 -2
  23. package/assets/{dialog-terminal-unavailable-BupywAXN.js → dialog-terminal-unavailable-e6R9_l2x.js} +1 -1
  24. package/assets/{docs-Cz9HRotc.js → docs-DJdUiAIL.js} +1 -1
  25. package/assets/{ghostty-web-D1otktCg.js → ghostty-web-Yz75Zh3l.js} +1 -1
  26. package/assets/{home-CmNBeixF.js → home-B8nBl6AZ.js} +1 -1
  27. package/assets/{index-Dmepx8Py.css → index-CAWVV-dl.css} +1 -1
  28. package/assets/{index-BekReNoJ.js → index-DcAzlkrJ.js} +217 -217
  29. package/assets/{intro-DgRB-hoa.js → intro-PHoyONe8.js} +1 -1
  30. package/assets/{nope-02-BYUZ5Yms.js → nope-02-ChI1e9rL.js} +1 -1
  31. package/assets/{nope-05-CwGll__G.js → nope-05-CyjuJbTA.js} +1 -1
  32. package/assets/{nope-08-CHDuZRJ3.js → nope-08-CTNnfMoW.js} +1 -1
  33. package/assets/{nope-11-DmTnM4bX.js → nope-11-C_tu4RX2.js} +1 -1
  34. package/assets/nope-12-Bp0uBd_Z.js +1 -0
  35. package/assets/{onescience-D_th-7lD.js → onescience-B63JrJAj.js} +1 -1
  36. package/assets/{resources-8zKg4hSj.js → resources-G5IkcMme.js} +1 -1
  37. package/assets/{selection-CloKK1VU.js → selection-DpNrNB6i.js} +1 -1
  38. package/assets/{shell-BKp97Y1O.js → shell-CZBfSOyt.js} +2 -2
  39. package/assets/{skills-D3zVS9ud.js → skills-BhDEuokd.js} +1 -1
  40. package/assets/{staplebops-03-nzJ34dkk.js → staplebops-03-C97Nsdaq.js} +1 -1
  41. package/assets/{staplebops-04-BijcCHcg.js → staplebops-04-L3aFWOFf.js} +1 -1
  42. package/assets/{staplebops-06-C5Q4TE6b.js → staplebops-06-DvMBO_Dt.js} +1 -1
  43. package/assets/{staplebops-07-BlZfyEdk.js → staplebops-07-wiVgDHWx.js} +1 -1
  44. package/assets/{status-popover-body-BMU9AfCe.js → status-popover-body-Af9z0NSU.js} +2 -2
  45. package/assets/{wizard-DpJkxUbL.js → wizard-B6YZTfze.js} +1 -1
  46. package/assets/{yup-01-G_zmVKUR.js → yup-01-BhA98P7h.js} +1 -1
  47. package/assets/{yup-03-CYQG2ZCs.js → yup-03-fouMySlJ.js} +1 -1
  48. package/assets/{yup-04-Dhp5C_ey.js → yup-04-B459Jion.js} +1 -1
  49. package/assets/{yup-05-DWZ2_9AQ.js → yup-05-BiAh1-eK.js} +1 -1
  50. package/assets/{zh-C2NNWL5w.js → zh-B_0loE3I.js} +2 -2
  51. package/index.html +11 -11
  52. package/package.json +2 -2
  53. package/assets/alert-06-DG6wEIAw.js +0 -1
  54. package/assets/alert-07-WLDHvPqx.js +0 -1
  55. package/assets/alert-08-KaJmglNl.js +0 -1
  56. package/assets/alert-10-B6OC0izi.js +0 -1
  57. package/assets/bip-bop-09-5SEVpNuX.js +0 -1
  58. package/assets/nope-12-BSXSFZzZ.js +0 -1
@@ -1,4 +1,4 @@
1
- import{eL as getDefaultExportFromCjs}from"./index-BekReNoJ.js";function _mergeNamespaces(K,D){for(var c=0;c<D.length;c++){const y=D[c];if(typeof y!="string"&&!Array.isArray(y)){for(const O in y)if(O!=="default"&&!(O in K)){const w=Object.getOwnPropertyDescriptor(y,O);w&&Object.defineProperty(K,O,w.get?w:{enumerable:!0,get:()=>y[O]})}}}return Object.freeze(Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}))}var _3Dmol$3={exports:{}};/*!
1
+ import{eL as getDefaultExportFromCjs}from"./index-DcAzlkrJ.js";function _mergeNamespaces(K,D){for(var c=0;c<D.length;c++){const y=D[c];if(typeof y!="string"&&!Array.isArray(y)){for(const O in y)if(O!=="default"&&!(O in K)){const w=Object.getOwnPropertyDescriptor(y,O);w&&Object.defineProperty(K,O,w.get?w:{enumerable:!0,get:()=>y[O]})}}}return Object.freeze(Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}))}var _3Dmol$3={exports:{}};/*!
2
2
  * 3dmol v2.5.5
3
3
  * JavaScript/TypeScript molecular visualization library
4
4
  * Author: David Koes and contributors
@@ -1 +1 @@
1
- import{k as ee,f as W,u as de,m as me,bT as N,q as te,i,c as C,n as V,o as K,t as v,b as we,S as k,X as z,W as f,Y as E,dZ as ve,x as ge,a2 as _e,d9 as Ce,da as ye,ac as xe,O as Se,z as Pe,db as fe,d_ as ke,d$ as pe,e0 as qe,e1 as Ae,e2 as Me,e3 as Te,e4 as De,e5 as Ee,dr as oe,e6 as Ue,a5 as le,e7 as He}from"./index-BekReNoJ.js";var G=v("<p class=os-auth-error>"),Le=v('<form class=os-auth-form><label><span>账户 / 邮箱</span><input autocomplete=username placeholder=账户名或注册邮箱></label><label><span>密码</span><input autocomplete=current-password type=password placeholder=输入密码></label><button type=submit class="os-button os-button-primary os-auth-submit">'),Re=v("<div class=os-auth-links><span>还没有账号?</span><a>创建账号</a><a>忘记密码?"),Ie=v("<p>"),Fe=v('<div class=os-auth-email-verify><button type=button class="os-button os-button-secondary os-auth-submit"></button><label><span></span><input autocomplete=one-time-code>'),Ne=v("<label><span>邀请码</span><input autocomplete=one-time-code placeholder=请输入邀请码><small class=os-auth-hint>当前已开启注册审核,需填写有效邀请码才能注册。"),ze=v('<form class=os-auth-form><label><span>账户</span><input autocomplete=username placeholder="例如 researcher01"><small class=os-auth-hint>用作登录标识及个人工作区目录名称。长度 3–32 个字符,须以小写字母开头,仅可包含小写字母、数字、点(.)、下划线(_)与连字符(-)。</small></label><label><span>邮箱</span><input autocomplete=email inputmode=email placeholder=name@example.com><small class=os-auth-hint>用于账号找回与系统通知,亦可作为登录凭证。</small></label><label><span>密码</span><input autocomplete=new-password type=password placeholder="至少 8 位"></label><label><span>确认密码</span><input autocomplete=new-password type=password placeholder=再次输入密码></label><button type=submit class="os-button os-button-primary os-auth-submit">'),je=v("<div class=os-auth-links><span>已有账号?</span><a>去登录"),Oe=v('<p class=os-auth-hint style="margin:0 0 0.35rem">通过注册邮箱获取验证码后重置密码。若无法收到邮件,请联系管理员。'),Q=v("<p class=os-account-success>"),Be=v('<form class=os-auth-form><label><span>账号邮箱</span><input autocomplete=email inputmode=email placeholder=name@example.com></label><button type=submit class="os-button os-button-secondary os-auth-submit">'),Ve=v("<label><span>邮件验证码</span><input autocomplete=one-time-code placeholder=输入邮件中的验证码>"),We=v('<form class=os-auth-form><label><span>新密码</span><input autocomplete=new-password type=password placeholder="至少 8 位"></label><label><span>确认新密码</span><input autocomplete=new-password type=password placeholder=再次输入新密码></label><button type=submit class="os-button os-button-primary os-auth-submit">'),Ge=v("<div class=os-auth-links><a>返回登录</a><a>创建账号"),Xe=v('<p class=os-auth-hint style="margin:0 0 0.35rem">请设置新密码以完成重置。'),Ye=v("<main class=os-account-page><div class=os-account-shell>"),Ze=v("<section class=os-account-loading><strong>正在加载账号信息</strong><span>请稍候"),Je=v('<section class=os-account-empty-state><strong></strong><span>登录后可以查看账号资料和开发空间。</span><a href="/login?redirect=%2Faccount"class="os-button os-button-primary">去登录'),Ke=v('<header class=os-account-header><div class=os-account-identity><div class=os-account-avatar></div><div><span class=os-account-kicker>账号中心</span><h1></h1><p></p></div></div><div class=os-account-actions><span class=os-account-status></span><a href=/code class="os-button os-button-secondary">进入科研开发</a><button type=button class="os-button os-button-danger">退出登录</button><button type=button class="os-button os-button-danger">'),Qe=v("<section class=os-account-workspace-hero><div class=os-account-workspace-hero-copy><span class=os-account-kicker>默认项目</span><strong>default</strong><p></p></div><div class=os-account-workspace-hero-meta><code>"),et=v('<section class=os-account-content-grid><section class=os-account-panel><div class=os-account-panel-head><strong>基本资料</strong><span class=os-account-session-expiry title="这是当前浏览器登录会话的有效期(约 14 天),不是账号本身到期。重新登录即可续期,账号与工作区数据不受影响。">登录会话 <!>失效</span></div><p class=os-account-session-expiry-note>提示:上方倒计时是登录会话有效期,重新登录即可续期;账号与工作区数据不会因此删除。</p><dl class=os-account-field-grid><div><dt>账户</dt><dd></dd></div><div><dt>邮箱</dt><dd></dd></div><div><dt>创建时间</dt><dd></dd></div><div><dt>默认入口</dt><dd>科研开发工作台</dd></div></dl></section><section class=os-account-panel><div class=os-account-panel-head><strong>修改密码</strong><span>本地账号</span></div><form class=os-account-password-form><label><span>当前密码</span><input autocomplete=current-password type=password placeholder=输入当前密码></label><label><span>新密码</span><input autocomplete=new-password type=password placeholder="至少 8 位"></label><label><span>确认新密码</span><input autocomplete=new-password type=password placeholder=再次输入新密码></label><button type=submit class="os-button os-button-danger os-auth-submit">'),tt=v('<div class="flex flex-col gap-4 pl-6 pr-2.5 pb-3"><p class="text-14-regular text-text-strong"></p><div class="flex justify-end gap-2"><button type=button class="os-button os-button-secondary"></button><button type=button class="os-button os-button-danger">'),rt=v("<main class=os-auth-page><section class=os-auth-shell><button type=button class=os-auth-dismiss aria-label=关闭并返回浏览><span aria-hidden=true>×</span></button><section class=os-auth-panel><a class=os-auth-brand href=/></a><div class=os-auth-links><button type=button class=os-auth-link-button>暂不登录,继续浏览");function dt(){const l=ee(),u=W(),[d,_]=N({name:"",email:"",password:"",confirmPassword:"",submitting:!1,error:""}),x=()=>typeof d.lockedUntil=="number"&&d.lockedUntil>Date.now(),a=async t=>{if(t.preventDefault(),x()){_("error",`尝试次数过多,请在 ${ct(d.lockedUntil-Date.now())} 后重试`);return}if(!d.email.trim()||!d.password){_("error","请输入账户/邮箱和密码");return}_({submitting:!0,error:"",lockedUntil:void 0});try{await fe(await ke({email:d.email.trim(),password:d.password}),l.storage),u(pe(location.search),{replace:!0});return}catch(m){const w=m instanceof Error&&"retryAfterMs"in m?Number(m.retryAfterMs):void 0;_({error:m instanceof Error?m.message:"登录失败,请稍后重试",submitting:!1,lockedUntil:typeof w=="number"&&w>0?Date.now()+w:void 0})}};return C(re,{mode:"login",get children(){return[(()=>{var t=Le(),m=t.firstChild,w=m.firstChild,S=w.nextSibling,r=m.nextSibling,e=r.firstChild,o=e.nextSibling,p=r.nextSibling;return t.addEventListener("submit",a),S.$$input=n=>_("email",n.currentTarget.value),o.$$input=n=>_("password",n.currentTarget.value),i(t,C(k,{get when(){return d.error},get children(){var n=G();return i(n,()=>d.error),n}}),p),i(p,(()=>{var n=z(()=>!!d.submitting);return()=>n()?"正在登录...":x()?"已锁定,请稍后重试":"登录"})()),f(n=>{var h=d.submitting,s=d.submitting,c=d.submitting||x();return h!==n.e&&(S.disabled=n.e=h),s!==n.t&&(o.disabled=n.t=s),c!==n.a&&(p.disabled=n.a=c),n},{e:void 0,t:void 0,a:void 0}),f(()=>S.value=d.email),f(()=>o.value=d.password),t})(),(()=>{var t=Re(),m=t.firstChild,w=m.nextSibling,S=w.nextSibling;return f(r=>{var e=`/register${location.search}`,o=`/forgot-password${location.search}`;return e!==r.e&&E(w,"href",r.e=e),o!==r.t&&E(S,"href",r.t=o),r},{e:void 0,t:void 0}),t})()]}})}function mt(){const l=ee(),u=W(),[d,_]=V(!1),[x,a]=V(!1),[t,m]=V(!1),[w,S]=V(Date.now()),[r,e]=N({name:"",email:"",password:"",confirmPassword:"",inviteCode:"",emailCode:"",submitting:!1,requestingCode:!1,requestHint:"",cooldownUntil:0,error:""});te(()=>{ve().then(c=>{_(!!c.inviteRequired),a(!!c.emailVerificationRequired)}).catch(()=>{_(!1),a(!1)});const s=window.setInterval(()=>S(Date.now()),250);ge(()=>window.clearInterval(s))});const o=K(()=>Math.max(0,Math.ceil(((r.cooldownUntil??0)-w())/1e3))),p=K(()=>o()>0),n=async()=>{if(r.requestingCode||r.submitting||p())return;const s=ue(r.email);if(s){e({error:s,requestHint:""});return}e({requestingCode:!0,error:"",requestHint:""});try{const c=await Te({email:r.email.trim()}),b=typeof c.retryAfterMs=="number"&&c.retryAfterMs>0?c.retryAfterMs:6e4;if(c.smtpUnreachable){m(!0),e({requestingCode:!1,requestHint:"无法连接邮件服务器,本次注册无需填写验证码。找回密码仍须邮件验证,收不到验证码请联系管理员。",error:"",cooldownUntil:Date.now()+b});return}m(!1),e({requestingCode:!1,requestHint:"验证码已发送,请查收邮箱后填入下方。",error:"",cooldownUntil:Date.now()+b})}catch(c){const b=c instanceof Error&&"retryAfterMs"in c?Number(c.retryAfterMs):void 0;e({requestingCode:!1,error:c instanceof Error?c.message:"发送验证码失败,请稍后重试",requestHint:"",...typeof b=="number"&&b>0?{cooldownUntil:Date.now()+b}:{}})}},h=async s=>{if(s.preventDefault(),!r.name.trim()||!r.email.trim()||!r.password){e("error","请输入账户、邮箱和密码");return}const c=lt(r.name);if(c){e("error",c);return}const b=ue(r.email);if(b){e("error",b);return}if(d()&&!(r.inviteCode??"").trim()){e("error","请填写邀请码");return}if(x()&&!t()&&!(r.emailCode??"").trim()){e("error","请填写邮箱验证码");return}if(r.password.length<8){e("error","密码至少需要 8 位");return}if(r.password!==r.confirmPassword){e("error","两次输入的密码不一致");return}e({submitting:!0,error:""});try{await fe(await Me({name:r.name.trim().toLowerCase(),email:r.email.trim(),password:r.password,...r.inviteCode?.trim()?{inviteCode:r.inviteCode.trim()}:{},...x()&&r.emailCode?.trim()?{emailCode:r.emailCode.trim()}:{}}),l.storage),u(pe(location.search),{replace:!0})}catch(g){e("error",g instanceof Error?g.message:"注册失败,请稍后重试"),e("submitting",!1)}};return C(re,{mode:"register",get children(){return[(()=>{var s=ze(),c=s.firstChild,b=c.firstChild,g=b.nextSibling,q=c.nextSibling,P=q.firstChild,M=P.nextSibling,U=q.nextSibling,I=U.firstChild,H=I.nextSibling,L=U.nextSibling,X=L.firstChild,Y=X.nextSibling,j=L.nextSibling;return s.addEventListener("submit",h),g.$$input=$=>e("name",$.currentTarget.value),E(g,"spellcheck",!1),M.$$input=$=>{e("email",$.currentTarget.value),m(!1)},i(s,C(k,{get when(){return x()},get children(){var $=Fe(),T=$.firstChild,D=T.nextSibling,F=D.firstChild,R=F.nextSibling;return T.$$click=()=>void n(),i(T,(()=>{var y=z(()=>!!r.requestingCode);return()=>y()?"正在发送...":z(()=>!!p())()?`重新发送 (${o()}s)`:"发送验证码"})()),i($,C(k,{get when(){return r.requestHint},get children(){var y=Ie();return i(y,()=>r.requestHint),f(()=>_e(y,t()?"os-auth-hint":"os-account-success")),y}}),D),i(F,()=>t()?"邮箱验证码(可不填)":"邮箱验证码"),R.$$input=y=>e("emailCode",y.currentTarget.value),E(R,"spellcheck",!1),f(y=>{var O=r.requestingCode||r.submitting||p()||!r.email.trim(),Z=t()?"邮件服务器不可达,可留空":"输入邮件中的验证码",B=r.submitting;return O!==y.e&&(T.disabled=y.e=O),Z!==y.t&&E(R,"placeholder",y.t=Z),B!==y.a&&(R.disabled=y.a=B),y},{e:void 0,t:void 0,a:void 0}),f(()=>R.value=r.emailCode??""),$}}),U),i(s,C(k,{get when(){return d()},get children(){var $=Ne(),T=$.firstChild,D=T.nextSibling;return D.$$input=F=>e("inviteCode",F.currentTarget.value),E(D,"spellcheck",!1),f(()=>D.value=r.inviteCode??""),$}}),U),H.$$input=$=>e("password",$.currentTarget.value),Y.$$input=$=>e("confirmPassword",$.currentTarget.value),i(s,C(k,{get when(){return r.error},get children(){var $=G();return i($,()=>r.error),$}}),j),i(j,()=>r.submitting?"正在创建...":"创建账号"),f($=>{var T=r.submitting||r.requestingCode,D=r.submitting;return T!==$.e&&(M.disabled=$.e=T),D!==$.t&&(j.disabled=$.t=D),$},{e:void 0,t:void 0}),f(()=>g.value=r.name),f(()=>M.value=r.email),f(()=>H.value=r.password),f(()=>Y.value=r.confirmPassword),s})(),(()=>{var s=je(),c=s.firstChild,b=c.nextSibling;return f(()=>E(b,"href",`/login${location.search}`)),s})()]}})}function gt(){const l=W(),u=typeof location<"u"?new URLSearchParams(location.search).get("token")?.trim()??"":"",d=!!u,[_,x]=V(Date.now()),[a,t]=N({email:"",token:u,newPassword:"",confirmPassword:"",requesting:!1,submitting:!1,error:"",success:"",requestHint:"",cooldownUntil:0});te(()=>{const e=window.setInterval(()=>x(Date.now()),250);ge(()=>window.clearInterval(e))});const m=K(()=>Math.max(0,Math.ceil((a.cooldownUntil-_())/1e3))),w=K(()=>m()>0),S=async()=>{if(!(a.requesting||a.submitting||w())){if(!a.email.trim()){t({error:"请输入账号邮箱",success:"",requestHint:""});return}t({requesting:!0,error:"",success:"",requestHint:""});try{const e=await De({email:a.email.trim()}),o=typeof e.retryAfterMs=="number"&&e.retryAfterMs>0?e.retryAfterMs:6e4;t({requesting:!1,requestHint:"若该邮箱已注册,验证码将发送至邮箱。请查收后在下方完成重置。",error:"",cooldownUntil:Date.now()+o})}catch(e){const o=e instanceof Error&&"retryAfterMs"in e?Number(e.retryAfterMs):void 0;t({requesting:!1,error:e instanceof Error?e.message:"发送验证码失败,请稍后重试",requestHint:"",...typeof o=="number"&&o>0?{cooldownUntil:Date.now()+o}:{}})}}},r=async e=>{if(e.preventDefault(),!a.token.trim()){t({error:"请输入邮件验证码",success:""});return}if(a.newPassword.length<8){t({error:"新密码至少需要 8 位",success:""});return}if(a.newPassword!==a.confirmPassword){t({error:"两次输入的新密码不一致",success:""});return}t({submitting:!0,error:"",success:""});try{await Ee({token:a.token.trim(),newPassword:a.newPassword}),t({submitting:!1,error:"",success:"密码已重置,请使用新密码登录",newPassword:"",confirmPassword:""});const o=new URLSearchParams(location.search);o.delete("token");const p=o.toString();window.setTimeout(()=>l(`/login${p?`?${p}`:""}`,{replace:!0}),1200)}catch(o){t({submitting:!1,error:o instanceof Error?o.message:"重置密码失败,请稍后重试",success:""})}};return C(re,{mode:"forgot-password",get children(){return[C(k,{when:!d,get fallback(){return Xe()},get children(){return Oe()}}),C(k,{when:!d,get children(){var e=Be(),o=e.firstChild,p=o.firstChild,n=p.nextSibling,h=o.nextSibling;return e.addEventListener("submit",s=>{s.preventDefault(),S()}),n.$$input=s=>t("email",s.currentTarget.value),i(h,(()=>{var s=z(()=>!!a.requesting);return()=>s()?"正在发送...":z(()=>!!w())()?`重新发送 (${m()}s)`:"获取验证码"})()),i(e,C(k,{get when(){return a.requestHint},get children(){var s=Q();return i(s,()=>a.requestHint),s}}),null),f(s=>{var c=a.requesting||a.submitting,b=a.requesting||a.submitting||w()||!a.email.trim();return c!==s.e&&(n.disabled=s.e=c),b!==s.t&&(h.disabled=s.t=b),s},{e:void 0,t:void 0}),f(()=>n.value=a.email),e}}),(()=>{var e=We(),o=e.firstChild,p=o.firstChild,n=p.nextSibling,h=o.nextSibling,s=h.firstChild,c=s.nextSibling,b=h.nextSibling;return e.addEventListener("submit",r),i(e,C(k,{when:!d,get children(){var g=Ve(),q=g.firstChild,P=q.nextSibling;return P.$$input=M=>t("token",M.currentTarget.value),f(()=>P.disabled=a.submitting),f(()=>P.value=a.token),g}}),o),n.$$input=g=>t("newPassword",g.currentTarget.value),c.$$input=g=>t("confirmPassword",g.currentTarget.value),i(e,C(k,{get when(){return a.error},get children(){var g=G();return i(g,()=>a.error),g}}),b),i(e,C(k,{get when(){return a.success},get children(){var g=Q();return i(g,()=>a.success),g}}),b),i(b,()=>a.submitting?"正在重置...":"重置密码"),f(g=>{var q=a.submitting,P=a.submitting,M=a.submitting;return q!==g.e&&(n.disabled=g.e=q),P!==g.t&&(c.disabled=g.t=P),M!==g.a&&(b.disabled=g.a=M),g},{e:void 0,t:void 0,a:void 0}),f(()=>n.value=a.newPassword),f(()=>c.value=a.confirmPassword),e})(),(()=>{var e=Ge(),o=e.firstChild,p=o.nextSibling;return f(n=>{var h=`/login${location.search}`,s=`/register${location.search}`;return h!==n.e&&E(o,"href",n.e=h),s!==n.t&&E(p,"href",n.t=s),n},{e:void 0,t:void 0}),e})()]}})}function ft(){const l=ee(),u=W(),d=de(),_=me(),[x,a]=N({loading:!0,error:""}),[t,m]=N({currentPassword:"",newPassword:"",confirmPassword:"",submitting:!1,error:"",success:""});te(()=>{const o=Ce();if(!o){a({loading:!1,error:"当前未登录"});return}ye(o).then(p=>a({session:p,loading:!1,error:""})).catch(p=>a({loading:!1,error:p instanceof Error?p.message:"会话已失效"}))});const w=()=>{if(l.platform==="desktop"){u("/login",{replace:!0});return}location.assign("/login")},S=()=>{oe(l.storage).finally(()=>w())},r=async()=>{try{await Ue(),le({variant:"success",icon:"circle-check",title:d.t("account.deleteAccount.toast.success")}),await oe(l.storage),w()}catch(o){le({variant:"error",title:d.t("account.deleteAccount.toast.error"),description:o instanceof Error?o.message:"请稍后重试"})}},e=async(o,p)=>{if(o.preventDefault(),!t.currentPassword||!t.newPassword||!t.confirmPassword){m({error:"请输入当前密码和新密码",success:""});return}if(t.newPassword.length<8){m({error:"新密码至少需要 8 位",success:""});return}if(t.currentPassword===t.newPassword){m({error:"新密码不能与当前密码相同",success:""});return}if(t.newPassword!==t.confirmPassword){m({error:"两次输入的新密码不一致",success:""});return}m({submitting:!0,error:"",success:""});try{await He({accountId:p.account.id,currentPassword:t.currentPassword,newPassword:t.newPassword}),m({currentPassword:"",newPassword:"",confirmPassword:"",submitting:!1,error:"",success:"密码已更新,下次登录请使用新密码"})}catch(n){m({submitting:!1,error:n instanceof Error?n.message:"修改密码失败,请稍后重试",success:""})}};return(()=>{var o=Ye(),p=o.firstChild;return i(p,C(k,{get when(){return!x.loading},get fallback(){return Ze()},get children(){return C(k,{get when(){return x.session},get fallback(){return(()=>{var n=Je(),h=n.firstChild,s=h.nextSibling;return s.nextSibling,i(h,()=>x.error||"当前未登录"),n})()},children:n=>[(()=>{var h=Ke(),s=h.firstChild,c=s.firstChild,b=c.nextSibling,g=b.firstChild,q=g.nextSibling,P=q.nextSibling,M=s.nextSibling,U=M.firstChild,I=U.nextSibling,H=I.nextSibling,L=H.nextSibling;return i(c,()=>st(n().account.name,n().account.email)),i(q,()=>n().account.name),i(P,()=>n().account.email),i(U,()=>at(n().account.status)),H.$$click=S,L.$$click=()=>_.show(()=>C(nt,{onConfirm:r})),i(L,()=>d.t("account.deleteAccount.button")),h})(),(()=>{var h=Qe(),s=h.firstChild,c=s.firstChild,b=c.nextSibling,g=b.nextSibling,q=s.nextSibling,P=q.firstChild;return i(g,()=>d.t("account.defaultProject.description")),i(P,()=>ce(n())||"未分配"),f(()=>E(P,"title",ce(n()))),h})(),(()=>{var h=et(),s=h.firstChild,c=s.firstChild,b=c.firstChild,g=b.nextSibling,q=g.firstChild,P=q.nextSibling;P.nextSibling;var M=c.nextSibling,U=M.nextSibling,I=U.firstChild,H=I.firstChild,L=H.nextSibling,X=I.nextSibling,Y=X.firstChild,j=Y.nextSibling,$=X.nextSibling,T=$.firstChild,D=T.nextSibling,F=s.nextSibling,R=F.firstChild,y=R.nextSibling,O=y.firstChild,Z=O.firstChild,B=Z.nextSibling,ne=O.nextSibling,he=ne.firstChild,se=he.nextSibling,ae=ne.nextSibling,$e=ae.firstChild,ie=$e.nextSibling,J=ae.nextSibling;return i(g,()=>ot(n().expiresAt),P),i(L,()=>n().account.name),i(j,()=>n().account.email),i(D,()=>it(n().account.timeCreated)),y.addEventListener("submit",A=>e(A,n())),B.$$input=A=>m("currentPassword",A.currentTarget.value),se.$$input=A=>m("newPassword",A.currentTarget.value),ie.$$input=A=>m("confirmPassword",A.currentTarget.value),i(y,C(k,{get when(){return t.error},get children(){var A=G();return i(A,()=>t.error),A}}),J),i(y,C(k,{get when(){return t.success},get children(){var A=Q();return i(A,()=>t.success),A}}),J),i(J,()=>t.submitting?"正在更新...":"更新密码"),f(()=>J.disabled=t.submitting),f(()=>B.value=t.currentPassword),f(()=>se.value=t.newPassword),f(()=>ie.value=t.confirmPassword),h})()]})}})),o})()}function nt(l){const u=de(),d=me(),[_,x]=N({submitting:!1,error:""}),a=async()=>{x({submitting:!0,error:""});try{await l.onConfirm(),d.close()}catch(t){x({submitting:!1,error:t instanceof Error?t.message:u.t("account.deleteAccount.toast.error")})}};return C(xe,{get title(){return u.t("account.deleteAccount.title")},fit:!0,transition:!0,get children(){var t=tt(),m=t.firstChild,w=m.nextSibling,S=w.firstChild,r=S.nextSibling;return i(m,()=>u.t("account.deleteAccount.description")),i(t,C(k,{get when(){return _.error},get children(){var e=G();return i(e,()=>_.error),e}}),w),S.$$click=()=>d.close(),i(S,()=>u.t("common.cancel")),r.$$click=a,i(r,(()=>{var e=z(()=>!!_.submitting);return()=>e()?"注销中...":u.t("account.deleteAccount.confirm")})()),f(e=>{var o=_.submitting,p=_.submitting;return o!==e.e&&(S.disabled=e.e=o),p!==e.t&&(r.disabled=e.t=p),e},{e:void 0,t:void 0}),t}})}function re(l){const u=W(),d=()=>{qe(),u(Ae(location.search),{replace:!0})};return(()=>{var _=rt(),x=_.firstChild,a=x.firstChild,t=a.nextSibling,m=t.firstChild,w=m.nextSibling,S=w.firstChild;return a.$$click=d,i(m,C(Se,{})),i(t,()=>l.children,w),S.$$click=d,f(()=>E(x,"data-mode",l.mode)),_})()}function st(l,u){return(l.trim()||u.trim()||"OS").slice(0,2).toUpperCase()}function at(l){return l==="active"?"正常":l==="frozen"?"已冻结":l==="limited"?"已限流":l==="pending"?"待激活":l||"未知"}function ce(l){return Pe(l)??""}function it(l){return l?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(be(l))):"未记录"}function ot(l){const u=Math.ceil(Math.max(0,be(l)-Date.now())/36e5);return u<=0?"已":u<24?`${u} 小时后`:`${Math.ceil(u/24)} 天后`}function lt(l){const u=l.trim().toLowerCase();return u?/^[a-z][a-z0-9._-]{2,31}$/.test(u)?u.includes("..")||u.endsWith(".")||u.startsWith(".")?"账户名不能以点开头/结尾,也不能包含连续的点":"":"账户名须为 3–32 位,以小写字母开头,仅含小写字母、数字、点、下划线或连字符":"请填写账户名"}function ue(l){const u=l.trim().toLowerCase();return!u||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(u)||u.length>254?"请填写有效邮箱":""}function ct(l){const u=Math.max(1,Math.ceil(l/1e3));if(u<60)return`${u} 秒`;const d=Math.ceil(u/60);return d<60?`${d} 分钟`:"1 小时"}function be(l){return l<1e10?l*1e3:l}we(["input","click"]);export{ft as AccountCenterPage,gt as ForgotPasswordPage,dt as LoginPage,mt as RegisterPage};
1
+ import{k as ee,f as W,u as de,m as me,bT as N,q as te,i,c as C,n as V,o as K,t as v,b as we,S as k,X as z,W as f,Y as E,dZ as ve,x as ge,a2 as _e,d9 as Ce,da as ye,ac as xe,O as Se,z as Pe,db as fe,d_ as ke,d$ as pe,e0 as qe,e1 as Ae,e2 as Me,e3 as Te,e4 as De,e5 as Ee,dr as oe,e6 as Ue,a5 as le,e7 as He}from"./index-DcAzlkrJ.js";var G=v("<p class=os-auth-error>"),Le=v('<form class=os-auth-form><label><span>账户 / 邮箱</span><input autocomplete=username placeholder=账户名或注册邮箱></label><label><span>密码</span><input autocomplete=current-password type=password placeholder=输入密码></label><button type=submit class="os-button os-button-primary os-auth-submit">'),Re=v("<div class=os-auth-links><span>还没有账号?</span><a>创建账号</a><a>忘记密码?"),Ie=v("<p>"),Fe=v('<div class=os-auth-email-verify><button type=button class="os-button os-button-secondary os-auth-submit"></button><label><span></span><input autocomplete=one-time-code>'),Ne=v("<label><span>邀请码</span><input autocomplete=one-time-code placeholder=请输入邀请码><small class=os-auth-hint>当前已开启注册审核,需填写有效邀请码才能注册。"),ze=v('<form class=os-auth-form><label><span>账户</span><input autocomplete=username placeholder="例如 researcher01"><small class=os-auth-hint>用作登录标识及个人工作区目录名称。长度 3–32 个字符,须以小写字母开头,仅可包含小写字母、数字、点(.)、下划线(_)与连字符(-)。</small></label><label><span>邮箱</span><input autocomplete=email inputmode=email placeholder=name@example.com><small class=os-auth-hint>用于账号找回与系统通知,亦可作为登录凭证。</small></label><label><span>密码</span><input autocomplete=new-password type=password placeholder="至少 8 位"></label><label><span>确认密码</span><input autocomplete=new-password type=password placeholder=再次输入密码></label><button type=submit class="os-button os-button-primary os-auth-submit">'),je=v("<div class=os-auth-links><span>已有账号?</span><a>去登录"),Oe=v('<p class=os-auth-hint style="margin:0 0 0.35rem">通过注册邮箱获取验证码后重置密码。若无法收到邮件,请联系管理员。'),Q=v("<p class=os-account-success>"),Be=v('<form class=os-auth-form><label><span>账号邮箱</span><input autocomplete=email inputmode=email placeholder=name@example.com></label><button type=submit class="os-button os-button-secondary os-auth-submit">'),Ve=v("<label><span>邮件验证码</span><input autocomplete=one-time-code placeholder=输入邮件中的验证码>"),We=v('<form class=os-auth-form><label><span>新密码</span><input autocomplete=new-password type=password placeholder="至少 8 位"></label><label><span>确认新密码</span><input autocomplete=new-password type=password placeholder=再次输入新密码></label><button type=submit class="os-button os-button-primary os-auth-submit">'),Ge=v("<div class=os-auth-links><a>返回登录</a><a>创建账号"),Xe=v('<p class=os-auth-hint style="margin:0 0 0.35rem">请设置新密码以完成重置。'),Ye=v("<main class=os-account-page><div class=os-account-shell>"),Ze=v("<section class=os-account-loading><strong>正在加载账号信息</strong><span>请稍候"),Je=v('<section class=os-account-empty-state><strong></strong><span>登录后可以查看账号资料和开发空间。</span><a href="/login?redirect=%2Faccount"class="os-button os-button-primary">去登录'),Ke=v('<header class=os-account-header><div class=os-account-identity><div class=os-account-avatar></div><div><span class=os-account-kicker>账号中心</span><h1></h1><p></p></div></div><div class=os-account-actions><span class=os-account-status></span><a href=/code class="os-button os-button-secondary">进入科研开发</a><button type=button class="os-button os-button-danger">退出登录</button><button type=button class="os-button os-button-danger">'),Qe=v("<section class=os-account-workspace-hero><div class=os-account-workspace-hero-copy><span class=os-account-kicker>默认项目</span><strong>default</strong><p></p></div><div class=os-account-workspace-hero-meta><code>"),et=v('<section class=os-account-content-grid><section class=os-account-panel><div class=os-account-panel-head><strong>基本资料</strong><span class=os-account-session-expiry title="这是当前浏览器登录会话的有效期(约 14 天),不是账号本身到期。重新登录即可续期,账号与工作区数据不受影响。">登录会话 <!>失效</span></div><p class=os-account-session-expiry-note>提示:上方倒计时是登录会话有效期,重新登录即可续期;账号与工作区数据不会因此删除。</p><dl class=os-account-field-grid><div><dt>账户</dt><dd></dd></div><div><dt>邮箱</dt><dd></dd></div><div><dt>创建时间</dt><dd></dd></div><div><dt>默认入口</dt><dd>科研开发工作台</dd></div></dl></section><section class=os-account-panel><div class=os-account-panel-head><strong>修改密码</strong><span>本地账号</span></div><form class=os-account-password-form><label><span>当前密码</span><input autocomplete=current-password type=password placeholder=输入当前密码></label><label><span>新密码</span><input autocomplete=new-password type=password placeholder="至少 8 位"></label><label><span>确认新密码</span><input autocomplete=new-password type=password placeholder=再次输入新密码></label><button type=submit class="os-button os-button-danger os-auth-submit">'),tt=v('<div class="flex flex-col gap-4 pl-6 pr-2.5 pb-3"><p class="text-14-regular text-text-strong"></p><div class="flex justify-end gap-2"><button type=button class="os-button os-button-secondary"></button><button type=button class="os-button os-button-danger">'),rt=v("<main class=os-auth-page><section class=os-auth-shell><button type=button class=os-auth-dismiss aria-label=关闭并返回浏览><span aria-hidden=true>×</span></button><section class=os-auth-panel><a class=os-auth-brand href=/></a><div class=os-auth-links><button type=button class=os-auth-link-button>暂不登录,继续浏览");function dt(){const l=ee(),u=W(),[d,_]=N({name:"",email:"",password:"",confirmPassword:"",submitting:!1,error:""}),x=()=>typeof d.lockedUntil=="number"&&d.lockedUntil>Date.now(),a=async t=>{if(t.preventDefault(),x()){_("error",`尝试次数过多,请在 ${ct(d.lockedUntil-Date.now())} 后重试`);return}if(!d.email.trim()||!d.password){_("error","请输入账户/邮箱和密码");return}_({submitting:!0,error:"",lockedUntil:void 0});try{await fe(await ke({email:d.email.trim(),password:d.password}),l.storage),u(pe(location.search),{replace:!0});return}catch(m){const w=m instanceof Error&&"retryAfterMs"in m?Number(m.retryAfterMs):void 0;_({error:m instanceof Error?m.message:"登录失败,请稍后重试",submitting:!1,lockedUntil:typeof w=="number"&&w>0?Date.now()+w:void 0})}};return C(re,{mode:"login",get children(){return[(()=>{var t=Le(),m=t.firstChild,w=m.firstChild,S=w.nextSibling,r=m.nextSibling,e=r.firstChild,o=e.nextSibling,p=r.nextSibling;return t.addEventListener("submit",a),S.$$input=n=>_("email",n.currentTarget.value),o.$$input=n=>_("password",n.currentTarget.value),i(t,C(k,{get when(){return d.error},get children(){var n=G();return i(n,()=>d.error),n}}),p),i(p,(()=>{var n=z(()=>!!d.submitting);return()=>n()?"正在登录...":x()?"已锁定,请稍后重试":"登录"})()),f(n=>{var h=d.submitting,s=d.submitting,c=d.submitting||x();return h!==n.e&&(S.disabled=n.e=h),s!==n.t&&(o.disabled=n.t=s),c!==n.a&&(p.disabled=n.a=c),n},{e:void 0,t:void 0,a:void 0}),f(()=>S.value=d.email),f(()=>o.value=d.password),t})(),(()=>{var t=Re(),m=t.firstChild,w=m.nextSibling,S=w.nextSibling;return f(r=>{var e=`/register${location.search}`,o=`/forgot-password${location.search}`;return e!==r.e&&E(w,"href",r.e=e),o!==r.t&&E(S,"href",r.t=o),r},{e:void 0,t:void 0}),t})()]}})}function mt(){const l=ee(),u=W(),[d,_]=V(!1),[x,a]=V(!1),[t,m]=V(!1),[w,S]=V(Date.now()),[r,e]=N({name:"",email:"",password:"",confirmPassword:"",inviteCode:"",emailCode:"",submitting:!1,requestingCode:!1,requestHint:"",cooldownUntil:0,error:""});te(()=>{ve().then(c=>{_(!!c.inviteRequired),a(!!c.emailVerificationRequired)}).catch(()=>{_(!1),a(!1)});const s=window.setInterval(()=>S(Date.now()),250);ge(()=>window.clearInterval(s))});const o=K(()=>Math.max(0,Math.ceil(((r.cooldownUntil??0)-w())/1e3))),p=K(()=>o()>0),n=async()=>{if(r.requestingCode||r.submitting||p())return;const s=ue(r.email);if(s){e({error:s,requestHint:""});return}e({requestingCode:!0,error:"",requestHint:""});try{const c=await Te({email:r.email.trim()}),b=typeof c.retryAfterMs=="number"&&c.retryAfterMs>0?c.retryAfterMs:6e4;if(c.smtpUnreachable){m(!0),e({requestingCode:!1,requestHint:"无法连接邮件服务器,本次注册无需填写验证码。找回密码仍须邮件验证,收不到验证码请联系管理员。",error:"",cooldownUntil:Date.now()+b});return}m(!1),e({requestingCode:!1,requestHint:"验证码已发送,请查收邮箱后填入下方。",error:"",cooldownUntil:Date.now()+b})}catch(c){const b=c instanceof Error&&"retryAfterMs"in c?Number(c.retryAfterMs):void 0;e({requestingCode:!1,error:c instanceof Error?c.message:"发送验证码失败,请稍后重试",requestHint:"",...typeof b=="number"&&b>0?{cooldownUntil:Date.now()+b}:{}})}},h=async s=>{if(s.preventDefault(),!r.name.trim()||!r.email.trim()||!r.password){e("error","请输入账户、邮箱和密码");return}const c=lt(r.name);if(c){e("error",c);return}const b=ue(r.email);if(b){e("error",b);return}if(d()&&!(r.inviteCode??"").trim()){e("error","请填写邀请码");return}if(x()&&!t()&&!(r.emailCode??"").trim()){e("error","请填写邮箱验证码");return}if(r.password.length<8){e("error","密码至少需要 8 位");return}if(r.password!==r.confirmPassword){e("error","两次输入的密码不一致");return}e({submitting:!0,error:""});try{await fe(await Me({name:r.name.trim().toLowerCase(),email:r.email.trim(),password:r.password,...r.inviteCode?.trim()?{inviteCode:r.inviteCode.trim()}:{},...x()&&r.emailCode?.trim()?{emailCode:r.emailCode.trim()}:{}}),l.storage),u(pe(location.search),{replace:!0})}catch(g){e("error",g instanceof Error?g.message:"注册失败,请稍后重试"),e("submitting",!1)}};return C(re,{mode:"register",get children(){return[(()=>{var s=ze(),c=s.firstChild,b=c.firstChild,g=b.nextSibling,q=c.nextSibling,P=q.firstChild,M=P.nextSibling,U=q.nextSibling,I=U.firstChild,H=I.nextSibling,L=U.nextSibling,X=L.firstChild,Y=X.nextSibling,j=L.nextSibling;return s.addEventListener("submit",h),g.$$input=$=>e("name",$.currentTarget.value),E(g,"spellcheck",!1),M.$$input=$=>{e("email",$.currentTarget.value),m(!1)},i(s,C(k,{get when(){return x()},get children(){var $=Fe(),T=$.firstChild,D=T.nextSibling,F=D.firstChild,R=F.nextSibling;return T.$$click=()=>void n(),i(T,(()=>{var y=z(()=>!!r.requestingCode);return()=>y()?"正在发送...":z(()=>!!p())()?`重新发送 (${o()}s)`:"发送验证码"})()),i($,C(k,{get when(){return r.requestHint},get children(){var y=Ie();return i(y,()=>r.requestHint),f(()=>_e(y,t()?"os-auth-hint":"os-account-success")),y}}),D),i(F,()=>t()?"邮箱验证码(可不填)":"邮箱验证码"),R.$$input=y=>e("emailCode",y.currentTarget.value),E(R,"spellcheck",!1),f(y=>{var O=r.requestingCode||r.submitting||p()||!r.email.trim(),Z=t()?"邮件服务器不可达,可留空":"输入邮件中的验证码",B=r.submitting;return O!==y.e&&(T.disabled=y.e=O),Z!==y.t&&E(R,"placeholder",y.t=Z),B!==y.a&&(R.disabled=y.a=B),y},{e:void 0,t:void 0,a:void 0}),f(()=>R.value=r.emailCode??""),$}}),U),i(s,C(k,{get when(){return d()},get children(){var $=Ne(),T=$.firstChild,D=T.nextSibling;return D.$$input=F=>e("inviteCode",F.currentTarget.value),E(D,"spellcheck",!1),f(()=>D.value=r.inviteCode??""),$}}),U),H.$$input=$=>e("password",$.currentTarget.value),Y.$$input=$=>e("confirmPassword",$.currentTarget.value),i(s,C(k,{get when(){return r.error},get children(){var $=G();return i($,()=>r.error),$}}),j),i(j,()=>r.submitting?"正在创建...":"创建账号"),f($=>{var T=r.submitting||r.requestingCode,D=r.submitting;return T!==$.e&&(M.disabled=$.e=T),D!==$.t&&(j.disabled=$.t=D),$},{e:void 0,t:void 0}),f(()=>g.value=r.name),f(()=>M.value=r.email),f(()=>H.value=r.password),f(()=>Y.value=r.confirmPassword),s})(),(()=>{var s=je(),c=s.firstChild,b=c.nextSibling;return f(()=>E(b,"href",`/login${location.search}`)),s})()]}})}function gt(){const l=W(),u=typeof location<"u"?new URLSearchParams(location.search).get("token")?.trim()??"":"",d=!!u,[_,x]=V(Date.now()),[a,t]=N({email:"",token:u,newPassword:"",confirmPassword:"",requesting:!1,submitting:!1,error:"",success:"",requestHint:"",cooldownUntil:0});te(()=>{const e=window.setInterval(()=>x(Date.now()),250);ge(()=>window.clearInterval(e))});const m=K(()=>Math.max(0,Math.ceil((a.cooldownUntil-_())/1e3))),w=K(()=>m()>0),S=async()=>{if(!(a.requesting||a.submitting||w())){if(!a.email.trim()){t({error:"请输入账号邮箱",success:"",requestHint:""});return}t({requesting:!0,error:"",success:"",requestHint:""});try{const e=await De({email:a.email.trim()}),o=typeof e.retryAfterMs=="number"&&e.retryAfterMs>0?e.retryAfterMs:6e4;t({requesting:!1,requestHint:"若该邮箱已注册,验证码将发送至邮箱。请查收后在下方完成重置。",error:"",cooldownUntil:Date.now()+o})}catch(e){const o=e instanceof Error&&"retryAfterMs"in e?Number(e.retryAfterMs):void 0;t({requesting:!1,error:e instanceof Error?e.message:"发送验证码失败,请稍后重试",requestHint:"",...typeof o=="number"&&o>0?{cooldownUntil:Date.now()+o}:{}})}}},r=async e=>{if(e.preventDefault(),!a.token.trim()){t({error:"请输入邮件验证码",success:""});return}if(a.newPassword.length<8){t({error:"新密码至少需要 8 位",success:""});return}if(a.newPassword!==a.confirmPassword){t({error:"两次输入的新密码不一致",success:""});return}t({submitting:!0,error:"",success:""});try{await Ee({token:a.token.trim(),newPassword:a.newPassword}),t({submitting:!1,error:"",success:"密码已重置,请使用新密码登录",newPassword:"",confirmPassword:""});const o=new URLSearchParams(location.search);o.delete("token");const p=o.toString();window.setTimeout(()=>l(`/login${p?`?${p}`:""}`,{replace:!0}),1200)}catch(o){t({submitting:!1,error:o instanceof Error?o.message:"重置密码失败,请稍后重试",success:""})}};return C(re,{mode:"forgot-password",get children(){return[C(k,{when:!d,get fallback(){return Xe()},get children(){return Oe()}}),C(k,{when:!d,get children(){var e=Be(),o=e.firstChild,p=o.firstChild,n=p.nextSibling,h=o.nextSibling;return e.addEventListener("submit",s=>{s.preventDefault(),S()}),n.$$input=s=>t("email",s.currentTarget.value),i(h,(()=>{var s=z(()=>!!a.requesting);return()=>s()?"正在发送...":z(()=>!!w())()?`重新发送 (${m()}s)`:"获取验证码"})()),i(e,C(k,{get when(){return a.requestHint},get children(){var s=Q();return i(s,()=>a.requestHint),s}}),null),f(s=>{var c=a.requesting||a.submitting,b=a.requesting||a.submitting||w()||!a.email.trim();return c!==s.e&&(n.disabled=s.e=c),b!==s.t&&(h.disabled=s.t=b),s},{e:void 0,t:void 0}),f(()=>n.value=a.email),e}}),(()=>{var e=We(),o=e.firstChild,p=o.firstChild,n=p.nextSibling,h=o.nextSibling,s=h.firstChild,c=s.nextSibling,b=h.nextSibling;return e.addEventListener("submit",r),i(e,C(k,{when:!d,get children(){var g=Ve(),q=g.firstChild,P=q.nextSibling;return P.$$input=M=>t("token",M.currentTarget.value),f(()=>P.disabled=a.submitting),f(()=>P.value=a.token),g}}),o),n.$$input=g=>t("newPassword",g.currentTarget.value),c.$$input=g=>t("confirmPassword",g.currentTarget.value),i(e,C(k,{get when(){return a.error},get children(){var g=G();return i(g,()=>a.error),g}}),b),i(e,C(k,{get when(){return a.success},get children(){var g=Q();return i(g,()=>a.success),g}}),b),i(b,()=>a.submitting?"正在重置...":"重置密码"),f(g=>{var q=a.submitting,P=a.submitting,M=a.submitting;return q!==g.e&&(n.disabled=g.e=q),P!==g.t&&(c.disabled=g.t=P),M!==g.a&&(b.disabled=g.a=M),g},{e:void 0,t:void 0,a:void 0}),f(()=>n.value=a.newPassword),f(()=>c.value=a.confirmPassword),e})(),(()=>{var e=Ge(),o=e.firstChild,p=o.nextSibling;return f(n=>{var h=`/login${location.search}`,s=`/register${location.search}`;return h!==n.e&&E(o,"href",n.e=h),s!==n.t&&E(p,"href",n.t=s),n},{e:void 0,t:void 0}),e})()]}})}function ft(){const l=ee(),u=W(),d=de(),_=me(),[x,a]=N({loading:!0,error:""}),[t,m]=N({currentPassword:"",newPassword:"",confirmPassword:"",submitting:!1,error:"",success:""});te(()=>{const o=Ce();if(!o){a({loading:!1,error:"当前未登录"});return}ye(o).then(p=>a({session:p,loading:!1,error:""})).catch(p=>a({loading:!1,error:p instanceof Error?p.message:"会话已失效"}))});const w=()=>{if(l.platform==="desktop"){u("/login",{replace:!0});return}location.assign("/login")},S=()=>{oe(l.storage).finally(()=>w())},r=async()=>{try{await Ue(),le({variant:"success",icon:"circle-check",title:d.t("account.deleteAccount.toast.success")}),await oe(l.storage),w()}catch(o){le({variant:"error",title:d.t("account.deleteAccount.toast.error"),description:o instanceof Error?o.message:"请稍后重试"})}},e=async(o,p)=>{if(o.preventDefault(),!t.currentPassword||!t.newPassword||!t.confirmPassword){m({error:"请输入当前密码和新密码",success:""});return}if(t.newPassword.length<8){m({error:"新密码至少需要 8 位",success:""});return}if(t.currentPassword===t.newPassword){m({error:"新密码不能与当前密码相同",success:""});return}if(t.newPassword!==t.confirmPassword){m({error:"两次输入的新密码不一致",success:""});return}m({submitting:!0,error:"",success:""});try{await He({accountId:p.account.id,currentPassword:t.currentPassword,newPassword:t.newPassword}),m({currentPassword:"",newPassword:"",confirmPassword:"",submitting:!1,error:"",success:"密码已更新,下次登录请使用新密码"})}catch(n){m({submitting:!1,error:n instanceof Error?n.message:"修改密码失败,请稍后重试",success:""})}};return(()=>{var o=Ye(),p=o.firstChild;return i(p,C(k,{get when(){return!x.loading},get fallback(){return Ze()},get children(){return C(k,{get when(){return x.session},get fallback(){return(()=>{var n=Je(),h=n.firstChild,s=h.nextSibling;return s.nextSibling,i(h,()=>x.error||"当前未登录"),n})()},children:n=>[(()=>{var h=Ke(),s=h.firstChild,c=s.firstChild,b=c.nextSibling,g=b.firstChild,q=g.nextSibling,P=q.nextSibling,M=s.nextSibling,U=M.firstChild,I=U.nextSibling,H=I.nextSibling,L=H.nextSibling;return i(c,()=>st(n().account.name,n().account.email)),i(q,()=>n().account.name),i(P,()=>n().account.email),i(U,()=>at(n().account.status)),H.$$click=S,L.$$click=()=>_.show(()=>C(nt,{onConfirm:r})),i(L,()=>d.t("account.deleteAccount.button")),h})(),(()=>{var h=Qe(),s=h.firstChild,c=s.firstChild,b=c.nextSibling,g=b.nextSibling,q=s.nextSibling,P=q.firstChild;return i(g,()=>d.t("account.defaultProject.description")),i(P,()=>ce(n())||"未分配"),f(()=>E(P,"title",ce(n()))),h})(),(()=>{var h=et(),s=h.firstChild,c=s.firstChild,b=c.firstChild,g=b.nextSibling,q=g.firstChild,P=q.nextSibling;P.nextSibling;var M=c.nextSibling,U=M.nextSibling,I=U.firstChild,H=I.firstChild,L=H.nextSibling,X=I.nextSibling,Y=X.firstChild,j=Y.nextSibling,$=X.nextSibling,T=$.firstChild,D=T.nextSibling,F=s.nextSibling,R=F.firstChild,y=R.nextSibling,O=y.firstChild,Z=O.firstChild,B=Z.nextSibling,ne=O.nextSibling,he=ne.firstChild,se=he.nextSibling,ae=ne.nextSibling,$e=ae.firstChild,ie=$e.nextSibling,J=ae.nextSibling;return i(g,()=>ot(n().expiresAt),P),i(L,()=>n().account.name),i(j,()=>n().account.email),i(D,()=>it(n().account.timeCreated)),y.addEventListener("submit",A=>e(A,n())),B.$$input=A=>m("currentPassword",A.currentTarget.value),se.$$input=A=>m("newPassword",A.currentTarget.value),ie.$$input=A=>m("confirmPassword",A.currentTarget.value),i(y,C(k,{get when(){return t.error},get children(){var A=G();return i(A,()=>t.error),A}}),J),i(y,C(k,{get when(){return t.success},get children(){var A=Q();return i(A,()=>t.success),A}}),J),i(J,()=>t.submitting?"正在更新...":"更新密码"),f(()=>J.disabled=t.submitting),f(()=>B.value=t.currentPassword),f(()=>se.value=t.newPassword),f(()=>ie.value=t.confirmPassword),h})()]})}})),o})()}function nt(l){const u=de(),d=me(),[_,x]=N({submitting:!1,error:""}),a=async()=>{x({submitting:!0,error:""});try{await l.onConfirm(),d.close()}catch(t){x({submitting:!1,error:t instanceof Error?t.message:u.t("account.deleteAccount.toast.error")})}};return C(xe,{get title(){return u.t("account.deleteAccount.title")},fit:!0,transition:!0,get children(){var t=tt(),m=t.firstChild,w=m.nextSibling,S=w.firstChild,r=S.nextSibling;return i(m,()=>u.t("account.deleteAccount.description")),i(t,C(k,{get when(){return _.error},get children(){var e=G();return i(e,()=>_.error),e}}),w),S.$$click=()=>d.close(),i(S,()=>u.t("common.cancel")),r.$$click=a,i(r,(()=>{var e=z(()=>!!_.submitting);return()=>e()?"注销中...":u.t("account.deleteAccount.confirm")})()),f(e=>{var o=_.submitting,p=_.submitting;return o!==e.e&&(S.disabled=e.e=o),p!==e.t&&(r.disabled=e.t=p),e},{e:void 0,t:void 0}),t}})}function re(l){const u=W(),d=()=>{qe(),u(Ae(location.search),{replace:!0})};return(()=>{var _=rt(),x=_.firstChild,a=x.firstChild,t=a.nextSibling,m=t.firstChild,w=m.nextSibling,S=w.firstChild;return a.$$click=d,i(m,C(Se,{})),i(t,()=>l.children,w),S.$$click=d,f(()=>E(x,"data-mode",l.mode)),_})()}function st(l,u){return(l.trim()||u.trim()||"OS").slice(0,2).toUpperCase()}function at(l){return l==="active"?"正常":l==="frozen"?"已冻结":l==="limited"?"已限流":l==="pending"?"待激活":l||"未知"}function ce(l){return Pe(l)??""}function it(l){return l?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(be(l))):"未记录"}function ot(l){const u=Math.ceil(Math.max(0,be(l)-Date.now())/36e5);return u<=0?"已":u<24?`${u} 小时后`:`${Math.ceil(u/24)} 天后`}function lt(l){const u=l.trim().toLowerCase();return u?/^[a-z][a-z0-9._-]{2,31}$/.test(u)?u.includes("..")||u.endsWith(".")||u.startsWith(".")?"账户名不能以点开头/结尾,也不能包含连续的点":"":"账户名须为 3–32 位,以小写字母开头,仅含小写字母、数字、点、下划线或连字符":"请填写账户名"}function ue(l){const u=l.trim().toLowerCase();return!u||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(u)||u.length>254?"请填写有效邮箱":""}function ct(l){const u=Math.max(1,Math.ceil(l/1e3));if(u<60)return`${u} 秒`;const d=Math.ceil(u/60);return d<60?`${d} 分钟`:"1 小时"}function be(l){return l<1e10?l*1e3:l}we(["input","click"]);export{ft as AccountCenterPage,gt as ForgotPasswordPage,dt as LoginPage,mt as RegisterPage};
@@ -1 +1 @@
1
- const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609111612/assets/alert-04-CaGsIGFP.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/alert-01-BuOD_o_q.aac";export{e as default};
@@ -1 +1 @@
1
- const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609111612/assets/alert-05-D2gbGoRH.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/alert-02-CS75AsoP.aac";export{e as default};
@@ -1 +1 @@
1
- const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609111612/assets/alert-01-BuOD_o_q.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/alert-04-CaGsIGFP.aac";export{e as default};
@@ -1 +1 @@
1
- const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609111612/assets/alert-02-CS75AsoP.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/alert-05-D2gbGoRH.aac";export{e as default};
@@ -0,0 +1 @@
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/alert-06-GK5Tqy6u.aac";export{e as default};
@@ -0,0 +1 @@
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/alert-07-0r0kiLGz.aac";export{e as default};
@@ -0,0 +1 @@
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/alert-08-CZowNquU.aac";export{e as default};
@@ -0,0 +1 @@
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/alert-10-Ck5hR7zH.aac";export{e as default};
@@ -1 +1 @@
1
- const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609111612/assets/bip-bop-03-DXp7Zb0f.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/bip-bop-03-DXp7Zb0f.aac";export{e as default};
@@ -1 +1 @@
1
- const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609111612/assets/bip-bop-04-CfVtpI7z.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/bip-bop-04-CfVtpI7z.aac";export{e as default};
@@ -1 +1 @@
1
- const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609111612/assets/bip-bop-06-BuvNosjK.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/bip-bop-06-BuvNosjK.aac";export{e as default};
@@ -1 +1 @@
1
- const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609111612/assets/bip-bop-08-DBf7Bwjz.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/bip-bop-08-DBf7Bwjz.aac";export{e as default};
@@ -0,0 +1 @@
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609141631/assets/bip-bop-09-CxEgoAHQ.aac";export{e as default};
@@ -1,4 +1,4 @@
1
- import{b as We,n as T,c as l,i as t,S as h,W as x,bh as Ea,t as o,bi as Aa,a0 as $t,bj as ta,bk as It,bf as Dt,z as Lt,s as Fe,bg as Tt,a4 as at,bl as nt,a3 as rt,a5 as _e,L as Ge,bm as Pa,a2 as zt,aC as Re,F as Y,X,Y as D,aB as ja,C as qe,x as aa,a1 as na,m as ra,o as ge,ac as Ra,bn as mt,bo as lt,l as it,h as st,g as ot,e as Ot,f as ct,be as dt,bp as la,bq as Fa,br as Ma,bs as qa,bt as za,bu as Ua,bv as Ae,bw as Ba,bx as Wa,by as Na,bz as Ha,bA as Ka,bB as Qa,bC as Va,bD as Ja,bE as Ya,bF as Xa,bG as Ga,bH as Za,bI as Ut,bJ as Bt,bK as en,q as yt,bL as ia,bM as tn,bN as an,bO as pt,az as sa,bP as nn,bQ as rn,bR as ln,bS as sn,bT as on,bU as _t,bV as cn,bW as dn,bX as Wt,b7 as un,bY as Ye,bZ as gn,b_ as hn,b$ as bn,R as Nt,c0 as pn}from"./index-BekReNoJ.js";import{m as vn,O as fn,S as $n,s as mn}from"./onescience-D_th-7lD.js";import{DialogProjectUpload as yn}from"./dialog-project-upload-CXo0faUP.js";import{d as _n,r as wn,s as Ht,w as Sn}from"./selection-CloKK1VU.js";import{s as kn,a as Kt,b as Cn,S as xn}from"./wizard-DpJkxUbL.js";import"./onescience-docs-CH5KBTI9.js";var In=o("<p class=os-client-capability-upload-error role=alert>"),Dn=o('<div class=os-client-capability-wizard-overlay role=dialog aria-modal=true aria-label=上传私有模型><button type=button class=os-client-capability-wizard-backdrop aria-label=关闭上传></button><form class=os-client-capability-upload-dialog><header class=os-client-capability-upload-head><div class=os-client-capability-upload-head-copy><div class=os-client-capability-upload-eyebrow>私有资产 · 模型</div><h2>上传私有模型</h2><p>填写与模型卡片一致的基础信息。保存后会出现在当前领域的 onemodel 列表,并标注为私有资产。</p></div><button type=button class=os-client-capability-upload-close aria-label=关闭>×</button></header><div class=os-client-capability-upload-notice role=note><strong>后台登记为 AI 原语</strong><p>AI 原语是后台知识资产体系,不对用户单独展示。上传后会自动登记,供 Agent 检索与编排时利用该模型知识。</p></div><div class=os-client-capability-upload-body><label class=os-client-capability-upload-field><span>名称<span class=os-client-capability-upload-required> *</span></span><small>显示在模型卡片标题</small><input maxlength=64 required placeholder="例如:团队内部微调 MACE"></label><label class=os-client-capability-upload-field><span>简介<span class=os-client-capability-upload-required> *</span></span><small>对应卡片正文,建议 1–2 句说明用途与适用场景</small><textarea maxlength=160 required rows=3 placeholder="例如:面向界面体系的内部势函数,可用于弛豫与短时程 MD 冒烟"></textarea></label><div class=os-client-capability-upload-grid data-cols=2><label class=os-client-capability-upload-field><span>标签<span class=os-client-capability-upload-required> *</span></span><small>逗号分隔,将显示为卡片标签;系统会自动加上「私有」</small><input required placeholder="例如:mlff, 界面, 内部模型"></label><label class=os-client-capability-upload-field><span>领域</span><small>跟随当前能力中心领域,卡片会出现在该领域下</small><input class=is-readonly readonly></label></div></div><footer class=os-client-capability-upload-actions><button type=button>取消</button><button type=submit data-primary=true>保存并发布');function Ln(e){return e.split(/[,,、]/).map(a=>a.trim()).filter(Boolean)}function Tn(e){const[a,r]=T(""),[i,n]=T(""),[s,u]=T(""),[c,g]=T(""),$=()=>{r(""),n(""),u(""),g("")},f=()=>{$(),e.onClose()},y=v=>{v.preventDefault();const m=a().trim(),O=i().trim(),P=Ln(s());if(!m||!O||P.length===0){g("请填写名称、简介和至少一个标签,以便生成与现有模型卡片一致的展示信息。");return}const ae=Aa({name:m,blurb:O,tags:P,domain:e.domain});e.onSaved({id:ae.id,name:ae.name}),f()};return l(h,{get when(){return e.open},get children(){var v=Dn(),m=v.firstChild,O=m.nextSibling,P=O.firstChild,ae=P.firstChild,_=ae.nextSibling,me=P.nextSibling,d=me.nextSibling,E=d.firstChild,Z=E.firstChild,N=Z.nextSibling,j=N.nextSibling,R=E.nextSibling,H=R.firstChild,ee=H.nextSibling,S=ee.nextSibling,k=R.nextSibling,I=k.firstChild,K=I.firstChild,he=K.nextSibling,se=he.nextSibling,L=I.nextSibling,te=L.firstChild,oe=te.nextSibling,we=oe.nextSibling,V=d.nextSibling,ce=V.firstChild;return m.$$click=f,O.addEventListener("submit",y),_.$$click=f,j.$$input=M=>r(M.currentTarget.value),S.$$input=M=>n(M.currentTarget.value),se.$$input=M=>u(M.currentTarget.value),t(O,l(h,{get when(){return c()},get children(){var M=In();return t(M,c),M}}),V),ce.$$click=f,x(()=>j.value=a()),x(()=>S.value=i()),x(()=>se.value=s()),x(()=>we.value=Ea(e.domain)),v}})}We(["click","input"]);function On(e,a){return e.includes("modelscope download --model ")?e:`${e}
1
+ import{b as We,n as T,c as l,i as t,S as h,W as x,bh as Ea,t as o,bi as Aa,a0 as $t,bj as ta,bk as It,bf as Dt,z as Lt,s as Fe,bg as Tt,a4 as at,bl as nt,a3 as rt,a5 as _e,L as Ge,bm as Pa,a2 as zt,aC as Re,F as Y,X,Y as D,aB as ja,C as qe,x as aa,a1 as na,m as ra,o as ge,ac as Ra,bn as mt,bo as lt,l as it,h as st,g as ot,e as Ot,f as ct,be as dt,bp as la,bq as Fa,br as Ma,bs as qa,bt as za,bu as Ua,bv as Ae,bw as Ba,bx as Wa,by as Na,bz as Ha,bA as Ka,bB as Qa,bC as Va,bD as Ja,bE as Ya,bF as Xa,bG as Ga,bH as Za,bI as Ut,bJ as Bt,bK as en,q as yt,bL as ia,bM as tn,bN as an,bO as pt,az as sa,bP as nn,bQ as rn,bR as ln,bS as sn,bT as on,bU as _t,bV as cn,bW as dn,bX as Wt,b7 as un,bY as Ye,bZ as gn,b_ as hn,b$ as bn,R as Nt,c0 as pn}from"./index-DcAzlkrJ.js";import{m as vn,O as fn,S as $n,s as mn}from"./onescience-B63JrJAj.js";import{DialogProjectUpload as yn}from"./dialog-project-upload-DGBE14Yk.js";import{d as _n,r as wn,s as Ht,w as Sn}from"./selection-DpNrNB6i.js";import{s as kn,a as Kt,b as Cn,S as xn}from"./wizard-B6YZTfze.js";import"./onescience-docs-CH5KBTI9.js";var In=o("<p class=os-client-capability-upload-error role=alert>"),Dn=o('<div class=os-client-capability-wizard-overlay role=dialog aria-modal=true aria-label=上传私有模型><button type=button class=os-client-capability-wizard-backdrop aria-label=关闭上传></button><form class=os-client-capability-upload-dialog><header class=os-client-capability-upload-head><div class=os-client-capability-upload-head-copy><div class=os-client-capability-upload-eyebrow>私有资产 · 模型</div><h2>上传私有模型</h2><p>填写与模型卡片一致的基础信息。保存后会出现在当前领域的 onemodel 列表,并标注为私有资产。</p></div><button type=button class=os-client-capability-upload-close aria-label=关闭>×</button></header><div class=os-client-capability-upload-notice role=note><strong>后台登记为 AI 原语</strong><p>AI 原语是后台知识资产体系,不对用户单独展示。上传后会自动登记,供 Agent 检索与编排时利用该模型知识。</p></div><div class=os-client-capability-upload-body><label class=os-client-capability-upload-field><span>名称<span class=os-client-capability-upload-required> *</span></span><small>显示在模型卡片标题</small><input maxlength=64 required placeholder="例如:团队内部微调 MACE"></label><label class=os-client-capability-upload-field><span>简介<span class=os-client-capability-upload-required> *</span></span><small>对应卡片正文,建议 1–2 句说明用途与适用场景</small><textarea maxlength=160 required rows=3 placeholder="例如:面向界面体系的内部势函数,可用于弛豫与短时程 MD 冒烟"></textarea></label><div class=os-client-capability-upload-grid data-cols=2><label class=os-client-capability-upload-field><span>标签<span class=os-client-capability-upload-required> *</span></span><small>逗号分隔,将显示为卡片标签;系统会自动加上「私有」</small><input required placeholder="例如:mlff, 界面, 内部模型"></label><label class=os-client-capability-upload-field><span>领域</span><small>跟随当前能力中心领域,卡片会出现在该领域下</small><input class=is-readonly readonly></label></div></div><footer class=os-client-capability-upload-actions><button type=button>取消</button><button type=submit data-primary=true>保存并发布');function Ln(e){return e.split(/[,,、]/).map(a=>a.trim()).filter(Boolean)}function Tn(e){const[a,r]=T(""),[i,n]=T(""),[s,u]=T(""),[c,g]=T(""),$=()=>{r(""),n(""),u(""),g("")},f=()=>{$(),e.onClose()},y=v=>{v.preventDefault();const m=a().trim(),O=i().trim(),P=Ln(s());if(!m||!O||P.length===0){g("请填写名称、简介和至少一个标签,以便生成与现有模型卡片一致的展示信息。");return}const ae=Aa({name:m,blurb:O,tags:P,domain:e.domain});e.onSaved({id:ae.id,name:ae.name}),f()};return l(h,{get when(){return e.open},get children(){var v=Dn(),m=v.firstChild,O=m.nextSibling,P=O.firstChild,ae=P.firstChild,_=ae.nextSibling,me=P.nextSibling,d=me.nextSibling,E=d.firstChild,Z=E.firstChild,N=Z.nextSibling,j=N.nextSibling,R=E.nextSibling,H=R.firstChild,ee=H.nextSibling,S=ee.nextSibling,k=R.nextSibling,I=k.firstChild,K=I.firstChild,he=K.nextSibling,se=he.nextSibling,L=I.nextSibling,te=L.firstChild,oe=te.nextSibling,we=oe.nextSibling,V=d.nextSibling,ce=V.firstChild;return m.$$click=f,O.addEventListener("submit",y),_.$$click=f,j.$$input=M=>r(M.currentTarget.value),S.$$input=M=>n(M.currentTarget.value),se.$$input=M=>u(M.currentTarget.value),t(O,l(h,{get when(){return c()},get children(){var M=In();return t(M,c),M}}),V),ce.$$click=f,x(()=>j.value=a()),x(()=>S.value=i()),x(()=>se.value=s()),x(()=>we.value=Ea(e.domain)),v}})}We(["click","input"]);function On(e,a){return e.includes("modelscope download --model ")?e:`${e}
2
2
 
3
3
  【从魔搭下载模型】
4
4
  ${vn(a,{kind:"local"})}`}function En(e){const a=ta(e);if(!a)throw new Error(`Unknown capability resource: ${e}`);if(!It(a))throw new Error(`Capability resource is not installable: ${e}`);const r=Pa(a);return{banner:a.install.banner,prompt:r?On(a.install.prompt,r):a.install.prompt}}function oa(e){if(!$t({navigate:e.navigate,action:{type:"install",resourceId:e.resourceId},isLoggedIn:e.isLoggedIn}))return!1;const a=ta(e.resourceId);if(!a||!It(a))return!1;const{banner:r,prompt:i}=En(e.resourceId),n=Dt({path:e.path,recent:e.recent,lastCodeWorkspace:e.lastCodeWorkspace})||Lt(Fe())||Tt(document,e.path);if(!n)return!1;const s=at(n);return nt(s,i),rt(s),e.openProject?.(n),e.touchCode?.(n),_e({variant:"success",title:r}),e.navigate(Ge(n)),!0}const An={all:"全部",weather:"地球科学",materials:"材料化学",bio:"生命科学",fluid:"流体仿真"};function Pn(e){switch(e){case"local_fs":return"工作区";case"http_dataset":return"公开网址";case"object_store":return"对象存储";case"remote_workspace":return"远端环境";case"onedata_ref":return"公开数据引用";default:return"其他"}}function jn(e){return e==="ready"?"可训练":"未就绪"}function wt(e){if(e.connector==="remote_workspace")return"远端环境上的数据不能发布;请先落到工作区路径后再发布。";if(e.connector==="onedata_ref")return"从公开 OneData 拉回的引用不能直接发布;请对话加工成新的可训练数据后再发布。";if(e.connector==="object_store"||/^(s3|oss|cos):\/\//i.test(e.uri))return"对象存储路径不能直接发布;请使用工作区路径或公开网址。";if(!(e.connector==="local_fs"||e.connector==="http_dataset"||!e.connector))return"当前数据来源不支持发布;请使用工作区路径或公开网址的可训练数据。"}function Rn(e){return e.status!=="ready"?!1:!wt(e)}function tt(e){switch(e){case"s3":return"Amazon S3";case"oss":return"阿里云 OSS";case"cos":return"腾讯云 COS"}}function Qt(e){const a=e.trim().toLowerCase();if(a.startsWith("http://")||a.startsWith("https://"))return"http_dataset";if(a.startsWith("s3://")||a.startsWith("oss://")||a.startsWith("cos://"))return"object_store"}function Fn(e){switch(e){case"local_fs":return"服务器上可访问的绝对路径(账号工作区或其他有权限的目录)";case"http_dataset":return"公开可访问的网址";case"object_store":return"对象存储路径或地址";case"remote_workspace":return"已连接远端机器上的文件路径"}}function Mn(e,a){const r=a.map(c=>c.replace(/\\/g,"/").trim()).filter(c=>c.startsWith("/")||/^[a-zA-Z]:\//.test(c));if(r.length>0&&r.length===a.length){if(r.length===1){const $=r[0];return[{kind:"file",label:$.split("/").filter(Boolean).at(-1)||$,uri:$}]}const c=qn(r),g=r.slice(0,50).map($=>({kind:"file",label:$,uri:$}));return c?[{kind:"folder",label:c,uri:c},...g]:g}const i=e.replace(/\/+$/,""),n=a.map(c=>c.replace(/\\/g,"/").replace(/^\/+/,"")).filter(Boolean);if(n.length===0)return[];if(n.length===1)return[{kind:"file",label:n[0],uri:`${i}/${n[0]}`}];const s=ca(n),u=n.slice(0,50).map(c=>({kind:"file",label:c,uri:`${i}/${c}`}));return s?[{kind:"folder",label:s,uri:`${i}/${s}`},...u]:u}function qn(e){const a=ca(e.map(r=>r.replace(/^\/+/,"")));return a?`/${a}`:void 0}function ca(e){const a=e.map(n=>n.split("/").filter(Boolean)),r=a[0];if(!r||r.length===0)return;let i=0;for(;i<r.length-1;){const n=r[i];if(!a.every(s=>s[i]===n))break;i+=1}if(i!==0)return r.slice(0,i).join("/")}function St(e){return!e||e<=0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function zn(e){return e.trim().replace(/[^\w.\u4e00-\u9fff-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function Un(e,a){const r=e.trim().replace(/\/+$/,""),i=zn(a)||"dataset";if(/^(https?|s3|oss|cos):\/\//i.test(r))return`onedata/ai-ready/${i}`;const n=r.split(/[/\\]/),s=n.at(-1)??"";if(/\.[A-Za-z0-9]+$/.test(s)){const c=s.replace(/\.[A-Za-z0-9]+$/,""),g=n.slice(0,-1).join("/");return g?`${g}/${c}-ai-ready`:`${c}-ai-ready`}return`${r}-ai-ready`}function Bn(e){return["请使用OneScience技能对原始数据进行数据标准化处理。","",`数据集名称:${e.name}`,`source dir(原始数据):${e.sourceDir}`,`target dir(AI Ready):${e.targetDir}`,"","从 source dir 读取,标准化后写入 target dir。","完成后调用 dataset_report,只传:name(数据集名称)、target_dir(上面的 AI Ready 路径)。","source 已绑定到本会话,血缘会自动挂上;不要写 .onescience/already.json。"].join(`
@@ -1 +1 @@
1
- import{h as o,l as t,o as c,be as s,bf as a,z as n,s as u,bg as d}from"./index-BekReNoJ.js";function l(e){return a(e)||n(u())||d(document,e.path)||""}function i(){const e=o(),r=t();return c(()=>l({path:e.data.path,recent:s(e.data.project),lastCodeWorkspace:r.projects.lastCode()}))}export{i as u};
1
+ import{h as o,l as t,o as c,be as s,bf as a,z as n,s as u,bg as d}from"./index-DcAzlkrJ.js";function l(e){return a(e)||n(u())||d(document,e.path)||""}function i(){const e=o(),r=t();return c(()=>l({path:e.data.path,recent:s(e.data.project),lastCodeWorkspace:r.projects.lastCode()}))}export{i as u};
@@ -1 +1 @@
1
- import{m as w,j as y,h as S,u as $,o,e8 as D,ar as C,as as F,au as P,ak as _,bT as E,e9 as M,c,i,ea as W,ab as p,X as z,ac as G,t as K}from"./index-BekReNoJ.js";var L=K('<form class="os-client-project-create-form flex flex-col gap-5 p-5 pt-4"><div class="flex flex-col gap-3"><p class="os-client-project-create-path text-12-regular text-text-weak"></p></div><div class="flex justify-end gap-2">');function R(e){const l=w(),f=y(),h=S(),r=$(),s=o(()=>D(e.project.worktree)),d=o(()=>e.project.name||s()),v=o(()=>{C(),F();const t=P(e.project.worktree),a=_(e.project.worktree)?.remotePath?.trim();return t.kind==="ssh"&&a?a.endsWith("/")?a:`${a}/`:`${e.project.worktree.replace(/\\/g,"/").replace(/\/+$/,"")}/`}),[m,x]=E({name:d()}),g=o(()=>{const t=m.name.trim();return t?t!==d():!1}),n=M(()=>({mutationFn:async()=>{const t=m.name.trim(),a=t===s()?"":t;if(e.project.id&&e.project.id!=="global"){await f.client.project.update({projectID:e.project.id,directory:e.project.worktree,name:a,icon:{color:e.project.icon?.color||"",override:e.project.icon?.override||""},commands:{start:e.project.commands?.start??""}}),l.close();return}h.project.meta(e.project.worktree,{name:a,icon:e.project.icon,commands:e.project.commands}),l.close()}}));function b(t){t.preventDefault(),!(n.isPending||!g())&&n.mutate()}return c(G,{get title(){return r.t("dialog.project.rename.title")},class:"os-client-project-create w-full max-w-[480px] mx-auto",get children(){var t=L(),a=t.firstChild,u=a.firstChild,j=a.nextSibling;return t.addEventListener("submit",b),i(a,c(W,{autofocus:!0,type:"text",get label(){return r.t("dialog.project.rename.name")},get placeholder(){return s()},get value(){return m.name},onChange:k=>x("name",k)}),u),i(u,()=>r.t("dialog.project.rename.path",{path:v()})),i(j,c(p,{type:"button",variant:"ghost",size:"large",onClick:()=>l.close(),get children(){return r.t("common.cancel")}}),null),i(j,c(p,{type:"submit",variant:"primary",size:"large",get disabled(){return n.isPending||!g()},get children(){return z(()=>!!n.isPending)()?r.t("common.saving"):r.t("common.confirm")}}),null),t}})}export{R as DialogEditProject};
1
+ import{m as w,j as y,h as S,u as $,o,e8 as D,ar as C,as as F,au as P,ak as _,bT as E,e9 as M,c,i,ea as W,ab as p,X as z,ac as G,t as K}from"./index-DcAzlkrJ.js";var L=K('<form class="os-client-project-create-form flex flex-col gap-5 p-5 pt-4"><div class="flex flex-col gap-3"><p class="os-client-project-create-path text-12-regular text-text-weak"></p></div><div class="flex justify-end gap-2">');function R(e){const l=w(),f=y(),h=S(),r=$(),s=o(()=>D(e.project.worktree)),d=o(()=>e.project.name||s()),v=o(()=>{C(),F();const t=P(e.project.worktree),a=_(e.project.worktree)?.remotePath?.trim();return t.kind==="ssh"&&a?a.endsWith("/")?a:`${a}/`:`${e.project.worktree.replace(/\\/g,"/").replace(/\/+$/,"")}/`}),[m,x]=E({name:d()}),g=o(()=>{const t=m.name.trim();return t?t!==d():!1}),n=M(()=>({mutationFn:async()=>{const t=m.name.trim(),a=t===s()?"":t;if(e.project.id&&e.project.id!=="global"){await f.client.project.update({projectID:e.project.id,directory:e.project.worktree,name:a,icon:{color:e.project.icon?.color||"",override:e.project.icon?.override||""},commands:{start:e.project.commands?.start??""}}),l.close();return}h.project.meta(e.project.worktree,{name:a,icon:e.project.icon,commands:e.project.commands}),l.close()}}));function b(t){t.preventDefault(),!(n.isPending||!g())&&n.mutate()}return c(G,{get title(){return r.t("dialog.project.rename.title")},class:"os-client-project-create w-full max-w-[480px] mx-auto",get children(){var t=L(),a=t.firstChild,u=a.firstChild,j=a.nextSibling;return t.addEventListener("submit",b),i(a,c(W,{autofocus:!0,type:"text",get label(){return r.t("dialog.project.rename.name")},get placeholder(){return s()},get value(){return m.name},onChange:k=>x("name",k)}),u),i(u,()=>r.t("dialog.project.rename.path",{path:v()})),i(j,c(p,{type:"button",variant:"ghost",size:"large",onClick:()=>l.close(),get children(){return r.t("common.cancel")}}),null),i(j,c(p,{type:"submit",variant:"primary",size:"large",get disabled(){return n.isPending||!g()},get children(){return z(()=>!!n.isPending)()?r.t("common.saving"):r.t("common.confirm")}}),null),t}})}export{R as DialogEditProject};
@@ -1 +1 @@
1
- import{ek as D,e as S,f as k,ez as P,ap as _,eA as w,m as F,u as L,o as $,c as d,en as I,i as u,ac as T,eB as b,a4 as q,a5 as g,es as C,t as E}from"./index-BekReNoJ.js";var K=E('<div class="w-full flex items-center gap-2"><span class="truncate flex-1 min-w-0 text-left font-normal"></span><span class="text-text-weak shrink-0 font-normal">');function M(i){return i.toLocaleTimeString(void 0,{timeStyle:"short"})}const z=()=>{const i=D(),p=S(),f=k(),c=P(),l=_(),h=w(),x=F(),n=L(),y=$(()=>{const t=i.id;if(!t)return[];const a=c.data.message[t]??[],o=[];for(const s of a){if(s.role!=="user")continue;const e=(c.data.part[s.id]??[]).find(r=>r.type==="text"&&!r.synthetic&&!r.ignored);e&&o.push({id:s.id,text:e.text.replace(/\n/g," ").slice(0,200),time:M(new Date(s.time.created))})}return o.reverse()}),v=t=>{if(!t)return;const a=i.id;if(!a)return;const o=c.data.part[t.id]??[],s=b(o,{directory:l.directory,attachmentName:n.t("common.attachment")}),m=q(l.directory);l.client.session.fork({sessionID:a,messageID:t.id}).then(e=>{if(!e.data){g({title:n.t("common.requestFailed")});return}x.close(),h.set(s,void 0,{dir:m,id:e.data.id}),f(C(p.pathname,m,e.data.id))}).catch(e=>{const r=e instanceof Error?e.message:String(e);g({title:n.t("common.requestFailed"),description:r})})};return d(T,{get title(){return n.t("command.session.fork")},get children(){return d(I,{class:"flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0",get search(){return{placeholder:n.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return n.t("dialog.fork.empty")},key:t=>t.id,items:y,filterKeys:["text"],onSelect:v,children:t=>(()=>{var a=K(),o=a.firstChild,s=o.nextSibling;return u(o,()=>t.text),u(s,()=>t.time),a})()})}})};export{z as DialogFork};
1
+ import{ek as D,e as S,f as k,ez as P,ap as _,eA as w,m as F,u as L,o as $,c as d,en as I,i as u,ac as T,eB as b,a4 as q,a5 as g,es as C,t as E}from"./index-DcAzlkrJ.js";var K=E('<div class="w-full flex items-center gap-2"><span class="truncate flex-1 min-w-0 text-left font-normal"></span><span class="text-text-weak shrink-0 font-normal">');function M(i){return i.toLocaleTimeString(void 0,{timeStyle:"short"})}const z=()=>{const i=D(),p=S(),f=k(),c=P(),l=_(),h=w(),x=F(),n=L(),y=$(()=>{const t=i.id;if(!t)return[];const a=c.data.message[t]??[],o=[];for(const s of a){if(s.role!=="user")continue;const e=(c.data.part[s.id]??[]).find(r=>r.type==="text"&&!r.synthetic&&!r.ignored);e&&o.push({id:s.id,text:e.text.replace(/\n/g," ").slice(0,200),time:M(new Date(s.time.created))})}return o.reverse()}),v=t=>{if(!t)return;const a=i.id;if(!a)return;const o=c.data.part[t.id]??[],s=b(o,{directory:l.directory,attachmentName:n.t("common.attachment")}),m=q(l.directory);l.client.session.fork({sessionID:a,messageID:t.id}).then(e=>{if(!e.data){g({title:n.t("common.requestFailed")});return}x.close(),h.set(s,void 0,{dir:m,id:e.data.id}),f(C(p.pathname,m,e.data.id))}).catch(e=>{const r=e instanceof Error?e.message:String(e);g({title:n.t("common.requestFailed"),description:r})})};return d(T,{get title(){return n.t("command.session.fork")},get children(){return d(I,{class:"flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0",get search(){return{placeholder:n.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return n.t("dialog.fork.empty")},key:t=>t.id,items:y,filterKeys:["text"],onSelect:v,children:t=>(()=>{var a=K(),o=a.firstChild,s=o.nextSibling;return u(o,()=>t.text),u(s,()=>t.time),a})()})}})};export{z as DialogFork};
@@ -1,2 +1,2 @@
1
- import{b as Ce,m as ze,u as Ie,l as Re,h as Ae,n as f,C as fe,o as b,eb as He,ec as Me,ed as be,ee as Oe,ef as We,c as i,i as l,S as u,Y as ve,W as U,a1 as $e,X as q,eg as w,eh as me,F as Ne,ac as Xe,t as v,ei as qe,ej as Ge,a5 as Ve}from"./index-BekReNoJ.js";var Ye=v("<input class=os-project-upload-path-input>"),ye=v("<p class=os-project-upload-warn>"),G=v("<p class=os-section-copy>"),Je=v("<ul class=os-project-upload-file-list>"),Ke=v("<div class=os-project-upload-summary role=status><strong>"),V=v("<p class=os-project-upload-error role=alert>"),Qe=v('<div class="os-upload-dialog os-download-dialog os-project-upload-panel"><div class=os-upload-head><div><div class=os-eyebrow></div><h2></h2></div><button type=button class="os-button os-button-secondary os-button-square">×</button></div><div class=os-project-upload-body><div class=os-download-env-field><span class=os-field-label></span><p class=os-section-copy></p></div><div class=os-project-upload-picks><button type=button class="os-button os-button-secondary"></button><button type=button class="os-button os-button-secondary"></button><input type=file class=hidden multiple><input type=file class=hidden multiple></div><p class=os-section-copy></p><label class=os-project-upload-overwrite><input type=checkbox><span></span></label></div><div class=os-upload-actions><button type=button class="os-button os-button-secondary"></button><button type=button class="os-button os-button-primary">'),Ze=v("<code class=os-project-upload-path>/"),et=v("<li class=truncate>");function lt(n){const C=ze(),o=Ie(),Y=Re(),_e=Ae(),[s,je]=f([]),[we,Se]=f(!1),[J,xe]=f(!1),[K,Q]=f(),[ke,z]=f(!0),[h,Z]=f(!1),[ee,te]=f({done:0,total:0,written:0,skipped:0,failed:0}),[I,E]=f("");let le,ae;const oe=()=>n.pathPrefix?.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")||void 0,R=()=>{const t=n.directory.replace(/\/+$/,""),a=oe();return a?`${t}/${a}`:t},[ne,re]=f(R());fe(()=>{re(R())});const Ee=t=>{if(n.allowEditDestination)return t;const a=oe();return a?`${a}/${t}`:t},S=()=>n.allowEditDestination?ne().replace(/\/+$/,"")||R():n.directory.replace(/\/+$/,""),Le=t=>`${S()}/${t.replace(/^\/+/,"")}`,De=b(()=>{const t=_e.data.path.home,a=S();return t&&a.startsWith(t)?`~${a.slice(t.length)}`:a}),Te=b(()=>{if(!n.allowEditDestination)return!1;const t=n.directory.replace(/\/+$/,""),a=S();return!(a===t||a.startsWith(`${t}/`))}),A=b(()=>He(s())),T=b(()=>Me(s())),H=b(()=>be(s(),{maxFileBytes:n.maxFileBytes,maxTotalBytes:n.maxTotalBytes})),ie=b(()=>{const t=K();return t===void 0||t<=0?!1:A()>t}),se=b(()=>s().length>0&&!h()&&!ie()&&!H()&&!!S()),M=b(()=>s().slice(0,Oe)),Be=b(()=>s().length>0&&!T()),ce=(t=H())=>t?t.kind==="file"?o.t("dialog.project.upload.fileTooLarge",{path:t.path,size:w(t.size),max:w(t.max)}):o.t("dialog.project.upload.totalTooLarge",{size:w(t.size),max:w(t.max)}):"";fe(()=>{const t=S(),a=Y.current?.http;if(!t||!a){z(!1);return}let c=!1;return z(!0),We(a.url,t).then(p=>{c||Q(p.availableBytes)}).catch(()=>{c||Q(void 0)}).finally(()=>{c||z(!1)}),()=>{c=!0}});const de=t=>{if(!t?.length)return;E("");const a=qe(t);je(a.entries),Se(a.truncated);const c=be(a.entries,{maxFileBytes:n.maxFileBytes,maxTotalBytes:n.maxTotalBytes});if(c){E(ce(c));return}a.truncated&&E(o.t("dialog.project.upload.tooManyFiles",{max:String(me),selected:String(a.totalSelected)}))},Pe=async()=>{const t=Y.current?.http;if(!t||!se())return;const a=s(),c=S();Z(!0),E(""),te({done:0,total:a.length,written:0,skipped:0,failed:0});let p=0,_=0,$=0;const d=[],m=[];for(let j=0;j<a.length;j+=1){const x=a[j],L=Ee(x.path);try{const g=await Ge(t.url,c,{path:L,file:x.file,overwrite:J()});g.status==="written"?p+=1:_+=1,m.push(Le(g.path||L))}catch(g){$+=1;const k=g instanceof Error?g.message:o.t("dialog.project.upload.failed");d.length<3&&d.push(`${x.path}: ${k}`)}te({done:j+1,total:a.length,written:p,skipped:_,failed:$})}if(Z(!1),$===0){Ve({title:o.t("toast.project.upload.success",{written:String(p),skipped:String(_)})}),n.onUploadedPaths?.(m),n.onUploaded?.(),C.close();return}E([o.t("dialog.project.upload.partialFailed",{written:String(p),skipped:String(_),failed:String($)}),...d].join(`
1
+ import{b as Ce,m as ze,u as Ie,l as Re,h as Ae,n as f,C as fe,o as b,eb as He,ec as Me,ed as be,ee as Oe,ef as We,c as i,i as l,S as u,Y as ve,W as U,a1 as $e,X as q,eg as w,eh as me,F as Ne,ac as Xe,t as v,ei as qe,ej as Ge,a5 as Ve}from"./index-DcAzlkrJ.js";var Ye=v("<input class=os-project-upload-path-input>"),ye=v("<p class=os-project-upload-warn>"),G=v("<p class=os-section-copy>"),Je=v("<ul class=os-project-upload-file-list>"),Ke=v("<div class=os-project-upload-summary role=status><strong>"),V=v("<p class=os-project-upload-error role=alert>"),Qe=v('<div class="os-upload-dialog os-download-dialog os-project-upload-panel"><div class=os-upload-head><div><div class=os-eyebrow></div><h2></h2></div><button type=button class="os-button os-button-secondary os-button-square">×</button></div><div class=os-project-upload-body><div class=os-download-env-field><span class=os-field-label></span><p class=os-section-copy></p></div><div class=os-project-upload-picks><button type=button class="os-button os-button-secondary"></button><button type=button class="os-button os-button-secondary"></button><input type=file class=hidden multiple><input type=file class=hidden multiple></div><p class=os-section-copy></p><label class=os-project-upload-overwrite><input type=checkbox><span></span></label></div><div class=os-upload-actions><button type=button class="os-button os-button-secondary"></button><button type=button class="os-button os-button-primary">'),Ze=v("<code class=os-project-upload-path>/"),et=v("<li class=truncate>");function lt(n){const C=ze(),o=Ie(),Y=Re(),_e=Ae(),[s,je]=f([]),[we,Se]=f(!1),[J,xe]=f(!1),[K,Q]=f(),[ke,z]=f(!0),[h,Z]=f(!1),[ee,te]=f({done:0,total:0,written:0,skipped:0,failed:0}),[I,E]=f("");let le,ae;const oe=()=>n.pathPrefix?.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")||void 0,R=()=>{const t=n.directory.replace(/\/+$/,""),a=oe();return a?`${t}/${a}`:t},[ne,re]=f(R());fe(()=>{re(R())});const Ee=t=>{if(n.allowEditDestination)return t;const a=oe();return a?`${a}/${t}`:t},S=()=>n.allowEditDestination?ne().replace(/\/+$/,"")||R():n.directory.replace(/\/+$/,""),Le=t=>`${S()}/${t.replace(/^\/+/,"")}`,De=b(()=>{const t=_e.data.path.home,a=S();return t&&a.startsWith(t)?`~${a.slice(t.length)}`:a}),Te=b(()=>{if(!n.allowEditDestination)return!1;const t=n.directory.replace(/\/+$/,""),a=S();return!(a===t||a.startsWith(`${t}/`))}),A=b(()=>He(s())),T=b(()=>Me(s())),H=b(()=>be(s(),{maxFileBytes:n.maxFileBytes,maxTotalBytes:n.maxTotalBytes})),ie=b(()=>{const t=K();return t===void 0||t<=0?!1:A()>t}),se=b(()=>s().length>0&&!h()&&!ie()&&!H()&&!!S()),M=b(()=>s().slice(0,Oe)),Be=b(()=>s().length>0&&!T()),ce=(t=H())=>t?t.kind==="file"?o.t("dialog.project.upload.fileTooLarge",{path:t.path,size:w(t.size),max:w(t.max)}):o.t("dialog.project.upload.totalTooLarge",{size:w(t.size),max:w(t.max)}):"";fe(()=>{const t=S(),a=Y.current?.http;if(!t||!a){z(!1);return}let c=!1;return z(!0),We(a.url,t).then(p=>{c||Q(p.availableBytes)}).catch(()=>{c||Q(void 0)}).finally(()=>{c||z(!1)}),()=>{c=!0}});const de=t=>{if(!t?.length)return;E("");const a=qe(t);je(a.entries),Se(a.truncated);const c=be(a.entries,{maxFileBytes:n.maxFileBytes,maxTotalBytes:n.maxTotalBytes});if(c){E(ce(c));return}a.truncated&&E(o.t("dialog.project.upload.tooManyFiles",{max:String(me),selected:String(a.totalSelected)}))},Pe=async()=>{const t=Y.current?.http;if(!t||!se())return;const a=s(),c=S();Z(!0),E(""),te({done:0,total:a.length,written:0,skipped:0,failed:0});let p=0,_=0,$=0;const d=[],m=[];for(let j=0;j<a.length;j+=1){const x=a[j],L=Ee(x.path);try{const g=await Ge(t.url,c,{path:L,file:x.file,overwrite:J()});g.status==="written"?p+=1:_+=1,m.push(Le(g.path||L))}catch(g){$+=1;const k=g instanceof Error?g.message:o.t("dialog.project.upload.failed");d.length<3&&d.push(`${x.path}: ${k}`)}te({done:j+1,total:a.length,written:p,skipped:_,failed:$})}if(Z(!1),$===0){Ve({title:o.t("toast.project.upload.success",{written:String(p),skipped:String(_)})}),n.onUploadedPaths?.(m),n.onUploaded?.(),C.close();return}E([o.t("dialog.project.upload.partialFailed",{written:String(p),skipped:String(_),failed:String($)}),...d].join(`
2
2
  `)),(p>0||_>0)&&(n.onUploadedPaths?.(m),n.onUploaded?.())};return i(Xe,{fit:!0,class:"os-project-upload-dialog",get children(){var t=Qe(),a=t.firstChild,c=a.firstChild,p=c.firstChild,_=p.nextSibling,$=c.nextSibling,d=a.nextSibling,m=d.firstChild,j=m.firstChild,x=j.nextSibling,L=m.nextSibling,g=L.firstChild,k=g.nextSibling,O=k.nextSibling,ue=O.nextSibling,W=L.nextSibling,N=W.nextSibling,B=N.firstChild,Fe=B.nextSibling,Ue=d.nextSibling,P=Ue.firstChild,X=P.nextSibling;return l(p,()=>o.t("dialog.project.upload.eyebrow")),l(_,()=>n.title??o.t("command.project.upload")),$.$$click=()=>C.close(),l(j,()=>n.destinationLabel??o.t("dialog.project.upload.destinationLabel")),l(m,i(u,{get when(){return n.allowEditDestination},get fallback(){return(()=>{var e=Ze(),y=e.firstChild;return l(e,De,y),e})()},get children(){var e=Ye();return e.$$input=y=>re(y.currentTarget.value),ve(e,"spellcheck",!1),U(()=>e.disabled=h()),U(()=>e.value=ne()),e}}),x),l(x,()=>n.destinationHint??o.t("dialog.project.upload.destinationHint")),l(m,i(u,{get when(){return Te()},get children(){var e=ye();return l(e,()=>o.t("dialog.project.upload.destinationRisk")),e}}),null),g.$$click=()=>le?.click(),l(g,()=>o.t("dialog.project.upload.pickFiles")),k.$$click=()=>ae?.click(),l(k,()=>o.t("dialog.project.upload.pickFolder")),O.addEventListener("change",e=>{de(e.currentTarget.files),e.currentTarget.value=""}),$e(e=>{le=e},O),ue.addEventListener("change",e=>{de(e.currentTarget.files),e.currentTarget.value=""}),$e(e=>{ae=e,e&&e.setAttribute("webkitdirectory","")},ue),l(d,i(u,{get when(){return s().length>0},get children(){var e=Ke(),y=e.firstChild;return l(y,(()=>{var r=q(()=>!!T());return()=>r()?o.t("dialog.project.upload.folderSummary",{folder:T(),count:String(s().length),size:w(A())}):o.t("dialog.project.upload.summary",{count:String(s().length),size:w(A())})})()),l(e,i(u,{get when(){return we()},get children(){var r=ye();return l(r,()=>o.t("dialog.project.upload.truncatedHint",{max:String(me)})),r}}),null),l(e,i(u,{get when(){return T()},get children(){var r=G();return l(r,()=>o.t("dialog.project.upload.folderHint")),r}}),null),l(e,i(u,{get when(){return Be()},get children(){return[(()=>{var r=Je();return l(r,i(Ne,{get each(){return M()},children:F=>(()=>{var D=et();return l(D,()=>F.path),D})()})),r})(),i(u,{get when(){return s().length>M().length},get children(){var r=G();return l(r,()=>o.t("dialog.project.upload.moreFiles",{count:String(s().length-M().length)})),r}})]}}),null),e}}),W),l(W,()=>o.t("dialog.project.upload.diskSpace",{space:ke()?o.t("common.loading"):w(K())})),l(d,i(u,{get when(){return ie()},get children(){var e=V();return l(e,()=>o.t("dialog.project.upload.diskInsufficient")),e}}),N),l(d,i(u,{get when(){return q(()=>!!H())()&&!I()},get children(){var e=V();return l(e,ce),e}}),N),B.addEventListener("change",e=>xe(e.currentTarget.checked)),l(Fe,()=>o.t("dialog.project.upload.overwrite")),l(d,i(u,{get when(){return h()},get children(){var e=G();return l(e,()=>o.t("dialog.project.upload.progress",{done:String(ee().done),total:String(ee().total)})),e}}),null),l(d,i(u,{get when(){return I()},get children(){var e=V();return l(e,I),e}}),null),P.$$click=()=>C.close(),l(P,()=>o.t("common.cancel")),X.$$click=()=>void Pe(),l(X,(()=>{var e=q(()=>!!h());return()=>e()?o.t("dialog.project.upload.uploading"):o.t("dialog.project.upload.confirm")})()),U(e=>{var y=h(),r=o.t("common.cancel"),F=h(),D=h(),pe=h(),ge=h(),he=!se();return y!==e.e&&($.disabled=e.e=y),r!==e.t&&ve($,"aria-label",e.t=r),F!==e.a&&(g.disabled=e.a=F),D!==e.o&&(k.disabled=e.o=D),pe!==e.i&&(B.disabled=e.i=pe),ge!==e.n&&(P.disabled=e.n=ge),he!==e.s&&(X.disabled=e.s=he),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),U(()=>B.checked=J()),t}})}Ce(["click","input"]);export{lt as DialogProjectUpload};
@@ -1 +1 @@
1
- import{i as f,W as E,cj as V,t as $,b0 as X,u as Z,g as ee,ao as te,m as ne,e as se,f as re,j as ae,h as oe,em as ie,n as ce,o as b,B as le,x as de,c as w,en as ue,aB as fe,aC as P,S as C,eo as ge,I as he,ep as pe,eq as me,e8 as K,ac as we,er as ye,es as ve,a4 as be}from"./index-BekReNoJ.js";var xe=$("<span data-component=keybind>");function ke(t){return(()=>{var n=xe();return f(n,()=>t.children),E(a=>V(n,{...t.classList,[t.class??""]:!!t.class},a)),n})()}function $e(t,n){const a=Math.floor(Math.max(0,t)/1e3),l=Math.floor(a/60),s=Math.floor(l/60),d=Math.floor(s/24);return a<60?n("common.time.justNow"):l<60?n("common.time.minutesAgo.short",{count:l}):s<24?n("common.time.hoursAgo.short",{count:s}):n("common.time.daysAgo.short",{count:d})}function Se(t,n){return $e(Date.now()-new Date(t).getTime(),n)}var q=$('<span class="text-14-regular text-text-weak truncate">'),_e=$('<div class="w-full flex items-center justify-between gap-4"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong whitespace-nowrap">'),De=$('<span class="text-12-regular text-text-weak whitespace-nowrap ml-2">'),Me=$('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong truncate">'),Ce=$('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap">');const I=5,Fe=["session.new","workspace.new","session.previous","session.next","terminal.toggle","review.toggle"],A=t=>{const n=new Set,a=[];for(const l of t)n.has(l.id)||(n.add(l.id),a.push(l));return a},N=(t,n)=>({id:"command:"+t.id,type:"command",title:t.title,description:t.description,keybind:t.keybind,category:n,option:t}),F=(t,n)=>({id:"file:"+t,type:"file",title:t,category:n,path:t}),Te=(t,n)=>({id:`session:${t.directory}:${t.id}`,type:"session",title:t.title,description:t.description,category:n,directory:t.directory,sessionID:t.id,archived:t.archived,updated:t.updated});function Ee(t){const n=b(()=>t.filesOnly()?[]:t.command.options.filter(s=>!s.disabled&&!s.hidden&&!s.id.startsWith("suggested.")&&s.id!=="file.open")),a=b(()=>{const s=t.language.t("palette.group.commands");return n().map(d=>N(d,s))}),l=b(()=>{const s=n(),d=new Map(Fe.map((o,c)=>[o,c])),y=s.filter(o=>d.has(o.id)),i=y.length?y:s.slice(0,I),h=y.length?[...i].sort((o,c)=>(d.get(o.id)??0)-(d.get(c.id)??0)):i,v=t.language.t("palette.group.commands");return h.map(o=>N(o,v))});return{allowed:n,list:a,picks:l}}function Ie(t){const n=ye({tabs:t.tabs,pathFromTab:t.file.pathFromTab,normalizeTab:s=>s.startsWith("file://")?t.file.tab(s):s}),a=b(()=>{const s=n.openedTabs(),d=n.activeFileTab(),y=d?[d,...s.filter(o=>o!==d)]:s,i=new Set,h=t.language.t("palette.group.files"),v=[];for(const o of y){const c=t.file.pathFromTab(o);c&&(i.has(c)||(i.add(c),v.push(F(c,h))))}return v.slice(0,I)}),l=b(()=>{const s=t.language.t("palette.group.files");return t.file.tree.children("").filter(i=>i.type==="file").map(i=>i.path).sort((i,h)=>i.localeCompare(h)).slice(0,I).map(i=>F(i,s))});return{recent:a,root:l}}function Le(t){const n={token:0,inflight:void 0,cached:void 0};return{sessions:l=>{if(!l.trim())return n.token+=1,n.inflight=void 0,n.cached=void 0,[];if(n.cached)return n.cached;if(n.inflight)return n.inflight;const d=n.token,y=t.workspaces();return y.length===0?[]:(n.inflight=Promise.all(y.map(i=>{const h=t.label(i);return t.globalSDK.client.session.list({directory:i,roots:!0}).then(v=>(v.data??[]).filter(o=>!!o?.id).map(o=>({id:o.id,title:o.title??t.language.t("command.session.new"),description:h,directory:i,archived:o.time?.archived,updated:o.time?.updated}))).catch(()=>[])})).then(i=>{if(n.token!==d)return[];const h=new Set,v=t.language.t("command.category.session"),o=i.flat().filter(c=>{const S=`${c.directory}:${c.id}`;return h.has(S)?!1:(h.add(S),!0)}).map(c=>Te(c,v));return n.cached=o,o}).catch(()=>[]).finally(()=>{n.inflight=void 0}),n.inflight)}}}function Oe(t){const n=X(),a=Z(),l=ee(),s=te(),d=ne(),y=se(),i=re(),h=ae(),v=oe(),{params:o,tabs:c,view:S}=ie(),D=()=>t.mode==="files",k={cleanup:void 0,committed:!1},[R,z]=ce(!1),L=Ee({filesOnly:D,command:n,language:a}),_=Ie({file:s,tabs:c,language:a}),j=b(()=>le(o.dir)??""),O=b(()=>{const e=j();if(e)return l.projects.list().find(r=>r.worktree===e||r.sandboxes?.includes(e))}),B=b(()=>{const e=j(),r=O();if(!r)return e?[e]:[];const u=[r.worktree,...r.sandboxes??[]];return e&&!u.includes(e)?[...u,e]:u}),G=b(()=>v.data.path.home),H=e=>{const r=O(),u=r&&e===r.worktree?a.t("workspace.type.local"):a.t("workspace.type.sandbox"),[p]=v.child(e,{bootstrap:!1}),g=G(),m=g?e.replace(g,"~"):e,x=p.vcs?.branch??K(e);return`${u} : ${x||m}`},{sessions:W}=Le({workspaces:B,label:H,globalSDK:h,language:a}),Y=async e=>{const r=e.trim();if(z(r.length>0),!r&&D()){const x=s.tree.state("")?.loaded,T=x?Promise.resolve():s.tree.list(""),M=A([..._.recent(),..._.root()]);return x||M.length>0?M:(await T,A([..._.recent(),..._.root()]))}if(!r)return[...L.picks(),..._.recent()];if(D()){const x=await s.searchFiles(r),T=a.t("palette.group.files");return x.map(M=>F(M,T))}const[u,p]=await Promise.all([s.searchFiles(r),Promise.resolve(W(r))]),g=a.t("palette.group.files"),m=u.map(x=>F(x,g));return[...L.list(),...p,...m]},J=e=>{k.cleanup?.(),e&&e.type==="command"&&(k.cleanup=e.option?.onHighlight?.())},Q=e=>{const r=s.tab(e);c().open(r),s.load(e),S().reviewPanel.opened()||S().reviewPanel.open(),l.fileTree.setTab("all"),t.onOpenFile?.(e),c().setActive(r)},U=e=>{if(e){if(k.committed=!0,k.cleanup=void 0,d.close(),e.type==="command"){e.option?.onSelect?.("palette");return}if(e.type==="session"){if(!e.directory||!e.sessionID)return;i(ve(y.pathname,be(e.directory),e.sessionID));return}e.path&&Q(e.path)}};return de(()=>{k.committed||k.cleanup?.()}),w(we,{class:"pt-3 pb-0 !max-h-[480px]",transition:!0,get children(){return w(ue,{get search(){return{placeholder:D()?a.t("session.header.searchFiles"):a.t("palette.search.placeholder"),autofocus:!0,hideIcon:!0}},get emptyMessage(){return a.t("palette.empty")},get loadingMessage(){return a.t("common.loading")},items:Y,key:e=>e.id,filterKeys:["title","description","category"],get groupBy(){return R()?e=>e.category:()=>""},onMove:J,onSelect:U,children:e=>w(fe,{get fallback(){return(()=>{var r=Ce(),u=r.firstChild,p=u.firstChild,g=p.firstChild,m=g.nextSibling;return f(u,w(pe,{get node(){return{path:e.path??"",type:"file"}},class:"shrink-0 size-4"}),p),f(g,()=>me(e.path??"")),f(m,()=>K(e.path??"")),r})()},get children(){return[w(P,{get when(){return e.type==="command"},get children(){var r=_e(),u=r.firstChild,p=u.firstChild;return f(p,()=>e.title),f(u,w(C,{get when(){return e.description},get children(){var g=q();return f(g,()=>e.description),g}}),null),f(r,w(C,{get when(){return e.keybind},get children(){return w(ke,{class:"rounded-[4px]",get children(){return ge(e.keybind??"",a.t)}})}}),null),r}}),w(P,{get when(){return e.type==="session"},get children(){var r=Me(),u=r.firstChild,p=u.firstChild,g=p.firstChild;return f(u,w(he,{name:"bubble-5",size:"small",class:"shrink-0 text-icon-weak"}),p),f(g,()=>e.title),f(p,w(C,{get when(){return e.description},get children(){var m=q();return f(m,()=>e.description),E(()=>m.classList.toggle("opacity-70",!!e.archived)),m}}),null),f(r,w(C,{get when(){return e.updated},get children(){var m=De();return f(m,()=>Se(new Date(e.updated).toISOString(),a.t)),m}}),null),E(()=>g.classList.toggle("opacity-70",!!e.archived)),r}})]}})})}})}export{Oe as DialogSelectFile};
1
+ import{i as f,W as E,cj as V,t as $,b0 as X,u as Z,g as ee,ao as te,m as ne,e as se,f as re,j as ae,h as oe,em as ie,n as ce,o as b,B as le,x as de,c as w,en as ue,aB as fe,aC as P,S as C,eo as ge,I as he,ep as pe,eq as me,e8 as K,ac as we,er as ye,es as ve,a4 as be}from"./index-DcAzlkrJ.js";var xe=$("<span data-component=keybind>");function ke(t){return(()=>{var n=xe();return f(n,()=>t.children),E(a=>V(n,{...t.classList,[t.class??""]:!!t.class},a)),n})()}function $e(t,n){const a=Math.floor(Math.max(0,t)/1e3),l=Math.floor(a/60),s=Math.floor(l/60),d=Math.floor(s/24);return a<60?n("common.time.justNow"):l<60?n("common.time.minutesAgo.short",{count:l}):s<24?n("common.time.hoursAgo.short",{count:s}):n("common.time.daysAgo.short",{count:d})}function Se(t,n){return $e(Date.now()-new Date(t).getTime(),n)}var q=$('<span class="text-14-regular text-text-weak truncate">'),_e=$('<div class="w-full flex items-center justify-between gap-4"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong whitespace-nowrap">'),De=$('<span class="text-12-regular text-text-weak whitespace-nowrap ml-2">'),Me=$('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong truncate">'),Ce=$('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap">');const I=5,Fe=["session.new","workspace.new","session.previous","session.next","terminal.toggle","review.toggle"],A=t=>{const n=new Set,a=[];for(const l of t)n.has(l.id)||(n.add(l.id),a.push(l));return a},N=(t,n)=>({id:"command:"+t.id,type:"command",title:t.title,description:t.description,keybind:t.keybind,category:n,option:t}),F=(t,n)=>({id:"file:"+t,type:"file",title:t,category:n,path:t}),Te=(t,n)=>({id:`session:${t.directory}:${t.id}`,type:"session",title:t.title,description:t.description,category:n,directory:t.directory,sessionID:t.id,archived:t.archived,updated:t.updated});function Ee(t){const n=b(()=>t.filesOnly()?[]:t.command.options.filter(s=>!s.disabled&&!s.hidden&&!s.id.startsWith("suggested.")&&s.id!=="file.open")),a=b(()=>{const s=t.language.t("palette.group.commands");return n().map(d=>N(d,s))}),l=b(()=>{const s=n(),d=new Map(Fe.map((o,c)=>[o,c])),y=s.filter(o=>d.has(o.id)),i=y.length?y:s.slice(0,I),h=y.length?[...i].sort((o,c)=>(d.get(o.id)??0)-(d.get(c.id)??0)):i,v=t.language.t("palette.group.commands");return h.map(o=>N(o,v))});return{allowed:n,list:a,picks:l}}function Ie(t){const n=ye({tabs:t.tabs,pathFromTab:t.file.pathFromTab,normalizeTab:s=>s.startsWith("file://")?t.file.tab(s):s}),a=b(()=>{const s=n.openedTabs(),d=n.activeFileTab(),y=d?[d,...s.filter(o=>o!==d)]:s,i=new Set,h=t.language.t("palette.group.files"),v=[];for(const o of y){const c=t.file.pathFromTab(o);c&&(i.has(c)||(i.add(c),v.push(F(c,h))))}return v.slice(0,I)}),l=b(()=>{const s=t.language.t("palette.group.files");return t.file.tree.children("").filter(i=>i.type==="file").map(i=>i.path).sort((i,h)=>i.localeCompare(h)).slice(0,I).map(i=>F(i,s))});return{recent:a,root:l}}function Le(t){const n={token:0,inflight:void 0,cached:void 0};return{sessions:l=>{if(!l.trim())return n.token+=1,n.inflight=void 0,n.cached=void 0,[];if(n.cached)return n.cached;if(n.inflight)return n.inflight;const d=n.token,y=t.workspaces();return y.length===0?[]:(n.inflight=Promise.all(y.map(i=>{const h=t.label(i);return t.globalSDK.client.session.list({directory:i,roots:!0}).then(v=>(v.data??[]).filter(o=>!!o?.id).map(o=>({id:o.id,title:o.title??t.language.t("command.session.new"),description:h,directory:i,archived:o.time?.archived,updated:o.time?.updated}))).catch(()=>[])})).then(i=>{if(n.token!==d)return[];const h=new Set,v=t.language.t("command.category.session"),o=i.flat().filter(c=>{const S=`${c.directory}:${c.id}`;return h.has(S)?!1:(h.add(S),!0)}).map(c=>Te(c,v));return n.cached=o,o}).catch(()=>[]).finally(()=>{n.inflight=void 0}),n.inflight)}}}function Oe(t){const n=X(),a=Z(),l=ee(),s=te(),d=ne(),y=se(),i=re(),h=ae(),v=oe(),{params:o,tabs:c,view:S}=ie(),D=()=>t.mode==="files",k={cleanup:void 0,committed:!1},[R,z]=ce(!1),L=Ee({filesOnly:D,command:n,language:a}),_=Ie({file:s,tabs:c,language:a}),j=b(()=>le(o.dir)??""),O=b(()=>{const e=j();if(e)return l.projects.list().find(r=>r.worktree===e||r.sandboxes?.includes(e))}),B=b(()=>{const e=j(),r=O();if(!r)return e?[e]:[];const u=[r.worktree,...r.sandboxes??[]];return e&&!u.includes(e)?[...u,e]:u}),G=b(()=>v.data.path.home),H=e=>{const r=O(),u=r&&e===r.worktree?a.t("workspace.type.local"):a.t("workspace.type.sandbox"),[p]=v.child(e,{bootstrap:!1}),g=G(),m=g?e.replace(g,"~"):e,x=p.vcs?.branch??K(e);return`${u} : ${x||m}`},{sessions:W}=Le({workspaces:B,label:H,globalSDK:h,language:a}),Y=async e=>{const r=e.trim();if(z(r.length>0),!r&&D()){const x=s.tree.state("")?.loaded,T=x?Promise.resolve():s.tree.list(""),M=A([..._.recent(),..._.root()]);return x||M.length>0?M:(await T,A([..._.recent(),..._.root()]))}if(!r)return[...L.picks(),..._.recent()];if(D()){const x=await s.searchFiles(r),T=a.t("palette.group.files");return x.map(M=>F(M,T))}const[u,p]=await Promise.all([s.searchFiles(r),Promise.resolve(W(r))]),g=a.t("palette.group.files"),m=u.map(x=>F(x,g));return[...L.list(),...p,...m]},J=e=>{k.cleanup?.(),e&&e.type==="command"&&(k.cleanup=e.option?.onHighlight?.())},Q=e=>{const r=s.tab(e);c().open(r),s.load(e),S().reviewPanel.opened()||S().reviewPanel.open(),l.fileTree.setTab("all"),t.onOpenFile?.(e),c().setActive(r)},U=e=>{if(e){if(k.committed=!0,k.cleanup=void 0,d.close(),e.type==="command"){e.option?.onSelect?.("palette");return}if(e.type==="session"){if(!e.directory||!e.sessionID)return;i(ve(y.pathname,be(e.directory),e.sessionID));return}e.path&&Q(e.path)}};return de(()=>{k.committed||k.cleanup?.()}),w(we,{class:"pt-3 pb-0 !max-h-[480px]",transition:!0,get children(){return w(ue,{get search(){return{placeholder:D()?a.t("session.header.searchFiles"):a.t("palette.search.placeholder"),autofocus:!0,hideIcon:!0}},get emptyMessage(){return a.t("palette.empty")},get loadingMessage(){return a.t("common.loading")},items:Y,key:e=>e.id,filterKeys:["title","description","category"],get groupBy(){return R()?e=>e.category:()=>""},onMove:J,onSelect:U,children:e=>w(fe,{get fallback(){return(()=>{var r=Ce(),u=r.firstChild,p=u.firstChild,g=p.firstChild,m=g.nextSibling;return f(u,w(pe,{get node(){return{path:e.path??"",type:"file"}},class:"shrink-0 size-4"}),p),f(g,()=>me(e.path??"")),f(m,()=>K(e.path??"")),r})()},get children(){return[w(P,{get when(){return e.type==="command"},get children(){var r=_e(),u=r.firstChild,p=u.firstChild;return f(p,()=>e.title),f(u,w(C,{get when(){return e.description},get children(){var g=q();return f(g,()=>e.description),g}}),null),f(r,w(C,{get when(){return e.keybind},get children(){return w(ke,{class:"rounded-[4px]",get children(){return ge(e.keybind??"",a.t)}})}}),null),r}}),w(P,{get when(){return e.type==="session"},get children(){var r=Me(),u=r.firstChild,p=u.firstChild,g=p.firstChild;return f(u,w(he,{name:"bubble-5",size:"small",class:"shrink-0 text-icon-weak"}),p),f(g,()=>e.title),f(p,w(C,{get when(){return e.description},get children(){var m=q();return f(m,()=>e.description),E(()=>m.classList.toggle("opacity-70",!!e.archived)),m}}),null),f(r,w(C,{get when(){return e.updated},get children(){var m=De();return f(m,()=>Se(new Date(e.updated).toISOString(),a.t)),m}}),null),E(()=>g.classList.toggle("opacity-70",!!e.archived)),r}})]}})})}})}export{Oe as DialogSelectFile};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BekReNoJ.js","assets/index-Dmepx8Py.css"])))=>i.map(i=>d[i]);
2
- import{u as x,i as d,c as i,S as h,t as b,m as y,ab as P,ac as M,bT as O,et as v,N as k,eu as S,ev as C,ew as z,o as B,ex as _,ey as p,en as E,ae as L,a6 as T}from"./index-BekReNoJ.js";var j=b('<div class="flex flex-col gap-1 py-1"><div class=text-13-medium></div><div class="text-12-regular text-text-invert-base"></div><div class="text-12-regular text-text-invert-base">'),A=b('<div class="text-12-regular text-text-invert-base">');const F=o=>{const n=x(),a=e=>{const l=`${e.id} ${e.name}`.toLowerCase();return/claude|anthropic/.test(l)?n.t("model.provider.anthropic"):/gpt|o[1-4]|codex|openai/.test(l)?n.t("model.provider.openai"):/gemini|palm|bard|google/.test(l)?n.t("model.provider.google"):/grok|xai/.test(l)?n.t("model.provider.xai"):/llama|meta/.test(l)?n.t("model.provider.meta"):e.provider.name},c=e=>e==="text"?n.t("model.input.text"):e==="image"?n.t("model.input.image"):e==="audio"?n.t("model.input.audio"):e==="video"?n.t("model.input.video"):e==="pdf"?n.t("model.input.pdf"):e,t=()=>{const e=[];o.latest&&e.push(n.t("model.tag.latest")),o.free&&e.push(n.t("model.tag.free")),o.limited&&e.push(n.t("model.tag.limited"));const l=e.length?` (${e.join(", ")})`:"";return`${a(o.model)} ${o.model.name}${l}`},r=()=>{if(o.model.capabilities){const g=o.model.capabilities.input,f=["text","image","audio","video","pdf"].filter(m=>g[m]).map(m=>c(m));return f.length?f.join(", "):void 0}const e=o.model.modalities?.input;if(!e)return;const l=e.map(g=>c(g));return l.length?l.join(", "):void 0},u=()=>o.model.capabilities?o.model.capabilities.reasoning?n.t("model.tooltip.reasoning.allowed"):n.t("model.tooltip.reasoning.none"):o.model.reasoning?n.t("model.tooltip.reasoning.allowed"):n.t("model.tooltip.reasoning.none"),s=()=>n.t("model.tooltip.context",{limit:o.model.limit.context.toLocaleString()});return(()=>{var e=j(),l=e.firstChild,g=l.nextSibling,D=g.nextSibling;return d(l,t),d(e,i(h,{get when(){return r()},children:f=>(()=>{var m=A();return d(m,()=>n.t("model.tooltip.allows",{inputs:f()})),m})()}),g),d(g,u),d(D,s),e})()};var N=b('<div class="w-full flex items-center gap-x-2 text-13-regular"><span class=truncate>'),K=b('<div class="flex items-center gap-1">');const $=(o,n)=>o==="opencode"&&(!n||n.input===0),w=o=>o==="onescience",I=o=>{const n=o.model??z().model,a=x(),c=B(()=>n.list().filter(r=>o.provider?r.provider.id===o.provider:!0).filter(r=>n.visible({modelID:r.id,providerID:r.provider.id})).map(r=>({...r,search:[r.provider.name,r.provider.id,r.name,r.id,r.family,$(r.provider.id,r.cost)?"free 免费":"",w(r.provider.id)?"limited 限免":"",r.latest?"latest 最新":""].join(" ")})));return i(E,{get class(){return`flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0 ${o.class??""}`},get search(){return{placeholder:a.t("dialog.model.search.placeholder"),autofocus:!0,action:o.action}},get emptyMessage(){return a.t("dialog.model.empty")},key:t=>`${t.provider.id}:${t.id}`,items:c,get current(){return n.current()},scrollToCurrent:!1,filterKeys:["search"],sortBy:(t,r)=>t.name.localeCompare(r.name),groupBy:t=>t.provider.name,sortGroupsBy:(t,r)=>{const u=t.items[0].provider.id,s=r.items[0].provider.id;return p.includes(u)&&!p.includes(s)?-1:!p.includes(u)&&p.includes(s)?1:p.indexOf(u)-p.indexOf(s)},itemWrapper:(t,r)=>i(S,{class:"w-full",placement:"right-start",gutter:12,get value(){return i(F,{model:t,get latest(){return t.latest},get free(){return $(t.provider.id,t.cost)},get limited(){return w(t.provider.id)}})},children:r}),onSelect:t=>{n.set(t?{modelID:t.id,providerID:t.provider.id}:void 0,{recent:!0}),o.onSelect()},children:t=>(()=>{var r=N(),u=r.firstChild;return d(u,()=>t.name),d(r,i(h,{get when(){return $(t.provider.id,t.cost)},get children(){return i(_,{get children(){return a.t("model.tag.free")}})}}),null),d(r,i(h,{get when(){return w(t.provider.id)},get children(){return i(_,{get children(){return a.t("model.tag.limited")}})}}),null),d(r,i(h,{get when(){return t.latest},get children(){return i(_,{get children(){return a.t("model.tag.latest")}})}}),null),r})()})};function V(o){const[n,a]=O({open:!1,dismiss:null}),c=y(),t=e=>{a("dismiss",e),a("open",!1)},r=()=>{t("manage"),c.show(()=>i(L,{tab:"models"}))},u=()=>{t("provider"),T(()=>import("./index-BekReNoJ.js").then(e=>e.eN),__vite__mapDeps([0,1])).then(e=>{c.show(()=>i(e.DialogSelectProvider,{}))})},s=x();return i(v,{get open(){return n.open},onOpenChange:e=>{e&&a("dismiss",null),a("open",e)},modal:!1,placement:"top-start",gutter:4,get children(){return[i(v.Trigger,k({get as(){return o.triggerAs??"div"}},()=>o.triggerProps,{get children(){return o.children}})),i(v.Portal,{get children(){return i(v.Content,{class:"w-72 h-80 flex flex-col p-2 rounded-md border border-border-base bg-surface-raised-stronger-non-alpha shadow-md z-50 outline-none overflow-hidden",onEscapeKeyDown:e=>{t("escape"),e.preventDefault(),e.stopPropagation()},onPointerDownOutside:()=>t("outside"),onFocusOutside:()=>t("outside"),onCloseAutoFocus:e=>{const l=n.dismiss;l==="outside"&&e.preventDefault(),(l==="escape"||l==="select")&&(e.preventDefault(),o.onClose?.(l)),a("dismiss",null)},get children(){return[i(v.Title,{class:"sr-only",get children(){return s.t("dialog.model.select.title")}}),i(I,{get provider(){return o.provider},get model(){return o.model},onSelect:()=>t("select"),class:"p-1",get action(){return(()=>{var e=K();return d(e,i(S,{placement:"top",get value(){return s.t("command.provider.connect")},get children(){return i(C,{icon:"plus-small",variant:"ghost",iconSize:"normal",class:"size-6",get"aria-label"(){return s.t("command.provider.connect")},onClick:u})}}),null),d(e,i(S,{placement:"top",get value(){return s.t("settings.models.title")},get children(){return i(C,{icon:"sliders",variant:"ghost",iconSize:"normal",class:"size-6",get"aria-label"(){return s.t("settings.models.title")},onClick:r})}}),null),e})()}})]}})}})]}})}const G=o=>{const n=y(),a=x(),c=()=>{T(()=>import("./index-BekReNoJ.js").then(r=>r.eN),__vite__mapDeps([0,1])).then(r=>{n.show(()=>i(r.DialogSelectProvider,{}))})},t=()=>{n.show(()=>i(L,{tab:"models"}))};return i(M,{get title(){return a.t("dialog.model.select.title")},get action(){return i(P,{class:"h-7 -my-1 text-14-medium",icon:"plus-small",tabIndex:-1,onClick:c,get children(){return a.t("command.provider.connect")}})},get children(){return[i(I,{get provider(){return o.provider},get model(){return o.model},onSelect:()=>n.close()}),i(P,{variant:"ghost",class:"ml-3 mt-5 mb-6 text-text-base self-start",onClick:t,get children(){return a.t("settings.models.title")}})]}})};export{G as DialogSelectModel,V as ModelSelectorPopover};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DcAzlkrJ.js","assets/index-CAWVV-dl.css"])))=>i.map(i=>d[i]);
2
+ import{u as x,i as d,c as i,S as h,t as b,m as y,ab as P,ac as M,bT as O,et as v,N as k,eu as S,ev as C,ew as z,o as B,ex as _,ey as p,en as E,ae as L,a6 as T}from"./index-DcAzlkrJ.js";var j=b('<div class="flex flex-col gap-1 py-1"><div class=text-13-medium></div><div class="text-12-regular text-text-invert-base"></div><div class="text-12-regular text-text-invert-base">'),A=b('<div class="text-12-regular text-text-invert-base">');const F=o=>{const n=x(),a=e=>{const l=`${e.id} ${e.name}`.toLowerCase();return/claude|anthropic/.test(l)?n.t("model.provider.anthropic"):/gpt|o[1-4]|codex|openai/.test(l)?n.t("model.provider.openai"):/gemini|palm|bard|google/.test(l)?n.t("model.provider.google"):/grok|xai/.test(l)?n.t("model.provider.xai"):/llama|meta/.test(l)?n.t("model.provider.meta"):e.provider.name},c=e=>e==="text"?n.t("model.input.text"):e==="image"?n.t("model.input.image"):e==="audio"?n.t("model.input.audio"):e==="video"?n.t("model.input.video"):e==="pdf"?n.t("model.input.pdf"):e,t=()=>{const e=[];o.latest&&e.push(n.t("model.tag.latest")),o.free&&e.push(n.t("model.tag.free")),o.limited&&e.push(n.t("model.tag.limited"));const l=e.length?` (${e.join(", ")})`:"";return`${a(o.model)} ${o.model.name}${l}`},r=()=>{if(o.model.capabilities){const g=o.model.capabilities.input,f=["text","image","audio","video","pdf"].filter(m=>g[m]).map(m=>c(m));return f.length?f.join(", "):void 0}const e=o.model.modalities?.input;if(!e)return;const l=e.map(g=>c(g));return l.length?l.join(", "):void 0},u=()=>o.model.capabilities?o.model.capabilities.reasoning?n.t("model.tooltip.reasoning.allowed"):n.t("model.tooltip.reasoning.none"):o.model.reasoning?n.t("model.tooltip.reasoning.allowed"):n.t("model.tooltip.reasoning.none"),s=()=>n.t("model.tooltip.context",{limit:o.model.limit.context.toLocaleString()});return(()=>{var e=j(),l=e.firstChild,g=l.nextSibling,D=g.nextSibling;return d(l,t),d(e,i(h,{get when(){return r()},children:f=>(()=>{var m=A();return d(m,()=>n.t("model.tooltip.allows",{inputs:f()})),m})()}),g),d(g,u),d(D,s),e})()};var N=b('<div class="w-full flex items-center gap-x-2 text-13-regular"><span class=truncate>'),K=b('<div class="flex items-center gap-1">');const $=(o,n)=>o==="opencode"&&(!n||n.input===0),w=o=>o==="onescience",I=o=>{const n=o.model??z().model,a=x(),c=B(()=>n.list().filter(r=>o.provider?r.provider.id===o.provider:!0).filter(r=>n.visible({modelID:r.id,providerID:r.provider.id})).map(r=>({...r,search:[r.provider.name,r.provider.id,r.name,r.id,r.family,$(r.provider.id,r.cost)?"free 免费":"",w(r.provider.id)?"limited 限免":"",r.latest?"latest 最新":""].join(" ")})));return i(E,{get class(){return`flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0 ${o.class??""}`},get search(){return{placeholder:a.t("dialog.model.search.placeholder"),autofocus:!0,action:o.action}},get emptyMessage(){return a.t("dialog.model.empty")},key:t=>`${t.provider.id}:${t.id}`,items:c,get current(){return n.current()},scrollToCurrent:!1,filterKeys:["search"],sortBy:(t,r)=>t.name.localeCompare(r.name),groupBy:t=>t.provider.name,sortGroupsBy:(t,r)=>{const u=t.items[0].provider.id,s=r.items[0].provider.id;return p.includes(u)&&!p.includes(s)?-1:!p.includes(u)&&p.includes(s)?1:p.indexOf(u)-p.indexOf(s)},itemWrapper:(t,r)=>i(S,{class:"w-full",placement:"right-start",gutter:12,get value(){return i(F,{model:t,get latest(){return t.latest},get free(){return $(t.provider.id,t.cost)},get limited(){return w(t.provider.id)}})},children:r}),onSelect:t=>{n.set(t?{modelID:t.id,providerID:t.provider.id}:void 0,{recent:!0}),o.onSelect()},children:t=>(()=>{var r=N(),u=r.firstChild;return d(u,()=>t.name),d(r,i(h,{get when(){return $(t.provider.id,t.cost)},get children(){return i(_,{get children(){return a.t("model.tag.free")}})}}),null),d(r,i(h,{get when(){return w(t.provider.id)},get children(){return i(_,{get children(){return a.t("model.tag.limited")}})}}),null),d(r,i(h,{get when(){return t.latest},get children(){return i(_,{get children(){return a.t("model.tag.latest")}})}}),null),r})()})};function V(o){const[n,a]=O({open:!1,dismiss:null}),c=y(),t=e=>{a("dismiss",e),a("open",!1)},r=()=>{t("manage"),c.show(()=>i(L,{tab:"models"}))},u=()=>{t("provider"),T(()=>import("./index-DcAzlkrJ.js").then(e=>e.eN),__vite__mapDeps([0,1])).then(e=>{c.show(()=>i(e.DialogSelectProvider,{}))})},s=x();return i(v,{get open(){return n.open},onOpenChange:e=>{e&&a("dismiss",null),a("open",e)},modal:!1,placement:"top-start",gutter:4,get children(){return[i(v.Trigger,k({get as(){return o.triggerAs??"div"}},()=>o.triggerProps,{get children(){return o.children}})),i(v.Portal,{get children(){return i(v.Content,{class:"w-72 h-80 flex flex-col p-2 rounded-md border border-border-base bg-surface-raised-stronger-non-alpha shadow-md z-50 outline-none overflow-hidden",onEscapeKeyDown:e=>{t("escape"),e.preventDefault(),e.stopPropagation()},onPointerDownOutside:()=>t("outside"),onFocusOutside:()=>t("outside"),onCloseAutoFocus:e=>{const l=n.dismiss;l==="outside"&&e.preventDefault(),(l==="escape"||l==="select")&&(e.preventDefault(),o.onClose?.(l)),a("dismiss",null)},get children(){return[i(v.Title,{class:"sr-only",get children(){return s.t("dialog.model.select.title")}}),i(I,{get provider(){return o.provider},get model(){return o.model},onSelect:()=>t("select"),class:"p-1",get action(){return(()=>{var e=K();return d(e,i(S,{placement:"top",get value(){return s.t("command.provider.connect")},get children(){return i(C,{icon:"plus-small",variant:"ghost",iconSize:"normal",class:"size-6",get"aria-label"(){return s.t("command.provider.connect")},onClick:u})}}),null),d(e,i(S,{placement:"top",get value(){return s.t("settings.models.title")},get children(){return i(C,{icon:"sliders",variant:"ghost",iconSize:"normal",class:"size-6",get"aria-label"(){return s.t("settings.models.title")},onClick:r})}}),null),e})()}})]}})}})]}})}const G=o=>{const n=y(),a=x(),c=()=>{T(()=>import("./index-DcAzlkrJ.js").then(r=>r.eN),__vite__mapDeps([0,1])).then(r=>{n.show(()=>i(r.DialogSelectProvider,{}))})},t=()=>{n.show(()=>i(L,{tab:"models"}))};return i(M,{get title(){return a.t("dialog.model.select.title")},get action(){return i(P,{class:"h-7 -my-1 text-14-medium",icon:"plus-small",tabIndex:-1,onClick:c,get children(){return a.t("command.provider.connect")}})},get children(){return[i(I,{get provider(){return o.provider},get model(){return o.model},onSelect:()=>n.close()}),i(P,{variant:"ghost",class:"ml-3 mt-5 mb-6 text-text-base self-start",onClick:t,get children(){return a.t("settings.models.title")}})]}})};export{G as DialogSelectModel,V as ModelSelectorPopover};
@@ -1,3 +1,3 @@
1
- import{m as $,ek as A,o as r,s as N,ar as T,aw as D,B as L,el as R,c as u,i as a,S as h,ab as k,ac as U,t as p}from"./index-BekReNoJ.js";var P=p('<pre class="m-0 shrink-0 max-h-28 overflow-y-auto rounded-lg border border-border-weak-base bg-background-weak p-3 text-12-regular text-text-strong leading-5 whitespace-pre-wrap break-all">服务端返回:'),M=p('<pre class="m-0 shrink-0 max-h-24 overflow-y-auto rounded-lg border border-border-weak-base bg-background-weak p-3 text-12-regular text-text-strong leading-5 whitespace-pre-wrap break-all">探测详情:'),B=p('<div class="flex flex-col gap-2 min-w-0 min-h-0"><div class="flex items-center justify-between gap-2 shrink-0"><strong class="text-13-medium text-text-strong">建议在服务器上执行</strong></div><pre class="m-0 max-h-[36vh] overflow-y-auto rounded-lg border border-border-weak-base bg-background-weak p-3 text-12-regular text-text-strong leading-5 whitespace-pre-wrap break-all">'),G=p('<div class="flex flex-col gap-4 px-6 pb-6 pt-0 min-h-0"><p class="text-14-regular text-text-weak m-0 leading-6 shrink-0"></p><p class="text-12-regular text-text-weak m-0 shrink-0"></p><div class="flex justify-end shrink-0">');function j(x={}){const v=$(),_=A(),l=r(()=>N()),n=r(()=>l()?.capabilities.terminalUnavailableReason??""),f=r(()=>l()?.capabilities.terminalUnavailableDetail??""),i=r(()=>l()?.capabilities.terminalIsolation??""),s=r(()=>(x.failure??"").trim()),o=r(()=>!!l()&&l()?.capabilities.terminal===!0&&!n()),g=r(()=>!n()&&!o()&&i()==="bubblewrap"),b=r(()=>(T(),!!D(L(_.dir)??""))),m=r(()=>{if(b())return[];if(o()&&s())return[];if(o())return i()==="docker"?["# 1) 无 GPU:改用 bubblewrap 后重启 OneCode,并重新登录","export ONECODE_TERMINAL_ISOLATION=bubblewrap","# 2) 有 GPU 且必须用 docker:给运行账号加组后重新登录系统再启 OneCode",'sudo usermod -aG docker "$USER"',"docker info"]:i()==="bubblewrap"?["# A. 临时绕过隔离(先验证终端能否打开)","export ONECODE_TERMINAL_ISOLATION=native","# 然后重启 onecode,浏览器重新登录后再开终端","","# B. 继续用 bubblewrap 时,在运行 OneCode 的机器上检查:","which bwrap; bwrap --version","bwrap --unshare-all --die-with-parent --new-session --proc /proc --dev /dev --ro-bind-try /usr /usr --ro-bind-try /bin /bin --tmpfs /tmp -- /usr/bin/true; echo exit:$?","cat /proc/sys/kernel/unprivileged_userns_clone","cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null || true","","# C. 若 exit 非 0,可临时放开(需管理员;重启后可能失效)","sudo sysctl -w kernel.unprivileged_userns_clone=1","sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0","","# D. 服务端日志(搜 creating session / exited)",'ls ~/.local/share/opencode/log/ 2>/dev/null || ls "$HOME"/.local/share/opencode/log/']:["# 查看服务端日志(搜 creating session / exited)",'ls ~/.local/share/opencode/log/ 2>/dev/null || ls "$HOME"/.local/share/opencode/log/',"# 临时可改:export ONECODE_TERMINAL_ISOLATION=native 后重启并重新登录"];const e=R(l());return Array.isArray(e)&&e.length>0?e:g()?["export ONECODE_TERMINAL_ISOLATION=native","cat /proc/sys/kernel/unprivileged_userns_clone"]:[]}),O=r(()=>m().length>0),C=r(()=>b()||o()?"无法打开终端":n()==="docker-missing"?"无法打开终端:Docker 不可用":n()==="disabled"?"无法打开终端:服务未启用":n()==="bubblewrap-unusable"?"无法打开终端:bubblewrap 异常":g()?"无法打开终端:隔离环境异常":"无法打开终端:需要 bubblewrap"),y=r(()=>b()&&s()?"在远端创建或连接普通 shell 失败。下方是服务端返回;远端终端不使用本机 bubblewrap。":b()?"SSH 已连接时,终端应在远端以普通 shell 打开,不使用本机 bubblewrap。请关闭失效标签后新建,或断开后重新连接远端再打开终端。":o()&&s()?"创建终端失败。请查看下方服务端返回。SSH 远端项目的终端在远端以普通 shell 运行,不使用本机 bubblewrap。":o()?i()==="docker"?"隔离模式为 docker,创建终端失败。常见原因是当前用户无权访问 docker.sock。无 GPU 请改用 bubblewrap;有 GPU 请把运行账号加入 docker 组。":i()==="bubblewrap"?"隔离模式为 bubblewrap,创建终端失败(服务端 POST /pty 返回错误)。可先按下方 A 改用 native 验证;若需继续隔离,再按 B/C 检查 bubblewrap 与内核命名空间。":s()?"远端或本机创建终端失败。下方是服务端返回;SSH 远端终端应是普通 shell,不使用本机 bubblewrap。":`隔离模式为 ${i()||"native"},创建终端失败。请按下方命令查看日志或临时调整隔离模式后重试。`:n()==="docker-missing"?"已配置 docker 隔离,但当前用户无法使用 Docker。无 GPU 请改用 bubblewrap;有 GPU 请将运行账号加入 docker 组。":n()==="disabled"?"服务端未启用平台账号终端。":n()==="bubblewrap-unusable"?"已安装 bubblewrap,但无法创建用户命名空间。请按下方命令检查后重启 OneCode 并重新登录。":g()?"bubblewrap 终端启动失败。可临时改用 native,或检查 user namespace 相关 sysctl。":"需要安装 bubblewrap 后重启 OneCode 并重新登录。容器部署可使用 ONECODE_TERMINAL_ISOLATION=native。"),S=async()=>{const e=m().filter(c=>c.trim().length>0&&!c.trim().startsWith("#")).join(`
1
+ import{m as $,ek as A,o as r,s as N,ar as T,aw as D,B as L,el as R,c as u,i as a,S as h,ab as k,ac as U,t as p}from"./index-DcAzlkrJ.js";var P=p('<pre class="m-0 shrink-0 max-h-28 overflow-y-auto rounded-lg border border-border-weak-base bg-background-weak p-3 text-12-regular text-text-strong leading-5 whitespace-pre-wrap break-all">服务端返回:'),M=p('<pre class="m-0 shrink-0 max-h-24 overflow-y-auto rounded-lg border border-border-weak-base bg-background-weak p-3 text-12-regular text-text-strong leading-5 whitespace-pre-wrap break-all">探测详情:'),B=p('<div class="flex flex-col gap-2 min-w-0 min-h-0"><div class="flex items-center justify-between gap-2 shrink-0"><strong class="text-13-medium text-text-strong">建议在服务器上执行</strong></div><pre class="m-0 max-h-[36vh] overflow-y-auto rounded-lg border border-border-weak-base bg-background-weak p-3 text-12-regular text-text-strong leading-5 whitespace-pre-wrap break-all">'),G=p('<div class="flex flex-col gap-4 px-6 pb-6 pt-0 min-h-0"><p class="text-14-regular text-text-weak m-0 leading-6 shrink-0"></p><p class="text-12-regular text-text-weak m-0 shrink-0"></p><div class="flex justify-end shrink-0">');function j(x={}){const v=$(),_=A(),l=r(()=>N()),n=r(()=>l()?.capabilities.terminalUnavailableReason??""),f=r(()=>l()?.capabilities.terminalUnavailableDetail??""),i=r(()=>l()?.capabilities.terminalIsolation??""),s=r(()=>(x.failure??"").trim()),o=r(()=>!!l()&&l()?.capabilities.terminal===!0&&!n()),g=r(()=>!n()&&!o()&&i()==="bubblewrap"),b=r(()=>(T(),!!D(L(_.dir)??""))),m=r(()=>{if(b())return[];if(o()&&s())return[];if(o())return i()==="docker"?["# 1) 无 GPU:改用 bubblewrap 后重启 OneCode,并重新登录","export ONECODE_TERMINAL_ISOLATION=bubblewrap","# 2) 有 GPU 且必须用 docker:给运行账号加组后重新登录系统再启 OneCode",'sudo usermod -aG docker "$USER"',"docker info"]:i()==="bubblewrap"?["# A. 临时绕过隔离(先验证终端能否打开)","export ONECODE_TERMINAL_ISOLATION=native","# 然后重启 onecode,浏览器重新登录后再开终端","","# B. 继续用 bubblewrap 时,在运行 OneCode 的机器上检查:","which bwrap; bwrap --version","bwrap --unshare-all --die-with-parent --new-session --proc /proc --dev /dev --ro-bind-try /usr /usr --ro-bind-try /bin /bin --tmpfs /tmp -- /usr/bin/true; echo exit:$?","cat /proc/sys/kernel/unprivileged_userns_clone","cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null || true","","# C. 若 exit 非 0,可临时放开(需管理员;重启后可能失效)","sudo sysctl -w kernel.unprivileged_userns_clone=1","sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0","","# D. 服务端日志(搜 creating session / exited)",'ls ~/.local/share/opencode/log/ 2>/dev/null || ls "$HOME"/.local/share/opencode/log/']:["# 查看服务端日志(搜 creating session / exited)",'ls ~/.local/share/opencode/log/ 2>/dev/null || ls "$HOME"/.local/share/opencode/log/',"# 临时可改:export ONECODE_TERMINAL_ISOLATION=native 后重启并重新登录"];const e=R(l());return Array.isArray(e)&&e.length>0?e:g()?["export ONECODE_TERMINAL_ISOLATION=native","cat /proc/sys/kernel/unprivileged_userns_clone"]:[]}),O=r(()=>m().length>0),C=r(()=>b()||o()?"无法打开终端":n()==="docker-missing"?"无法打开终端:Docker 不可用":n()==="disabled"?"无法打开终端:服务未启用":n()==="bubblewrap-unusable"?"无法打开终端:bubblewrap 异常":g()?"无法打开终端:隔离环境异常":"无法打开终端:需要 bubblewrap"),y=r(()=>b()&&s()?"在远端创建或连接普通 shell 失败。下方是服务端返回;远端终端不使用本机 bubblewrap。":b()?"SSH 已连接时,终端应在远端以普通 shell 打开,不使用本机 bubblewrap。请关闭失效标签后新建,或断开后重新连接远端再打开终端。":o()&&s()?"创建终端失败。请查看下方服务端返回。SSH 远端项目的终端在远端以普通 shell 运行,不使用本机 bubblewrap。":o()?i()==="docker"?"隔离模式为 docker,创建终端失败。常见原因是当前用户无权访问 docker.sock。无 GPU 请改用 bubblewrap;有 GPU 请把运行账号加入 docker 组。":i()==="bubblewrap"?"隔离模式为 bubblewrap,创建终端失败(服务端 POST /pty 返回错误)。可先按下方 A 改用 native 验证;若需继续隔离,再按 B/C 检查 bubblewrap 与内核命名空间。":s()?"远端或本机创建终端失败。下方是服务端返回;SSH 远端终端应是普通 shell,不使用本机 bubblewrap。":`隔离模式为 ${i()||"native"},创建终端失败。请按下方命令查看日志或临时调整隔离模式后重试。`:n()==="docker-missing"?"已配置 docker 隔离,但当前用户无法使用 Docker。无 GPU 请改用 bubblewrap;有 GPU 请将运行账号加入 docker 组。":n()==="disabled"?"服务端未启用平台账号终端。":n()==="bubblewrap-unusable"?"已安装 bubblewrap,但无法创建用户命名空间。请按下方命令检查后重启 OneCode 并重新登录。":g()?"bubblewrap 终端启动失败。可临时改用 native,或检查 user namespace 相关 sysctl。":"需要安装 bubblewrap 后重启 OneCode 并重新登录。容器部署可使用 ONECODE_TERMINAL_ISOLATION=native。"),S=async()=>{const e=m().filter(c=>c.trim().length>0&&!c.trim().startsWith("#")).join(`
2
2
  `);if(e)try{await navigator.clipboard.writeText(e)}catch{}};return u(U,{get title(){return C()},class:"os-client-terminal-dialog w-full",size:"normal",get children(){var e=G(),c=e.firstChild,d=c.nextSibling,E=d.nextSibling;return a(c,y),a(e,u(h,{get when(){return s()},get children(){var t=P();return t.firstChild,a(t,s,null),t}}),d),a(e,u(h,{get when(){return f()},get children(){var t=M();return t.firstChild,a(t,f,null),t}}),d),a(e,u(h,{get when(){return O()},get children(){var t=B(),w=t.firstChild;w.firstChild;var I=w.nextSibling;return a(w,u(k,{type:"button",size:"normal",variant:"ghost",onClick:()=>void S(),children:"复制命令"}),null),a(I,()=>m().join(`
3
3
  `)),t}}),d),a(d,()=>b()?"远端终端在远端以普通 shell 运行,不使用本机隔离。":"修改环境变量后需重启 OneCode,并在浏览器中重新登录后再打开终端。"),a(E,u(k,{type:"button",variant:"primary",size:"large",onClick:()=>v.close(),children:"知道了"})),e}})}export{j as DialogTerminalUnavailable};
@@ -1 +1 @@
1
- import{e as I,f as M,n as N,C as O,o as P,i as t,c as d,t as n,b as T,T as Y,R as j,W as x,Y as k,F as g,S as q,_ as z}from"./index-BekReNoJ.js";import{d as B}from"./onescience-docs-CH5KBTI9.js";var G=n("<div class=os-client-capability-page-grid>"),J=n('<div class="os-client-capability-page os-client-docs-page"><header class=os-client-docs-head><div class=os-client-docs-head-copy><h2>帮助</h2><p>平台使用说明、插件镜像与版本记录</p></div></header><section class=os-client-capability-selector aria-label=帮助与文档><div class=os-client-capability-current-domain><span>文档分类:</span><strong></strong><small>点击条目在新窗口打开原文</small></div><div class="os-client-capability-tabs os-client-docs-tabs"role=tablist aria-label=文档分类></div></section><div class=os-client-capability-page-body><section class=os-client-capability-resource-panel>'),K=n("<button type=button><strong></strong><small>"),Q=n("<p class=os-client-capability-empty>该分类下暂无文档。"),U=n("<article class=os-client-capability-card><div><h4></h4><p></p></div><div class=os-client-capability-meta></div><div class=os-client-capability-actions><a target=_blank rel=noreferrer data-primary=true>"),V=n("<span>");const v=[{id:"manual",label:"用户手册",hint:"平台与 OneSkills 使用说明",match:e=>e.includes("用户手册")},{id:"plugins",label:"插件与镜像",hint:"插件协议与运行镜像",match:e=>e.includes("插件")||e.includes("镜像")},{id:"release",label:"发版记录",hint:"版本变化与重要调整",match:e=>e.includes("发版记录")||e.includes("版本记录")}];function w(e){const c=e.replace(/^#/,"").trim().toLowerCase();return c==="manual"||c==="plugins"||c==="release"?c:"manual"}function ee(){const e=I(),c=M(),[b,f]=N(w(e.hash));O(()=>f(w(e.hash)));const H=a=>{f(a),c(z(a),{replace:!0})},_=()=>v.find(a=>a.id===b())??v[0],$=P(()=>B.filter(a=>_().match(a.tags)));return(()=>{var a=J(),u=a.firstChild;u.firstChild;var m=u.nextSibling,y=m.firstChild,E=y.firstChild,F=E.nextSibling,L=y.nextSibling,A=m.nextSibling,D=A.firstChild;return t(u,d(j,{get href(){return Y()},class:"os-client-docs-close","aria-label":"关闭帮助",children:"×"}),null),t(F,()=>_().label),t(L,d(g,{each:v,children:i=>(()=>{var l=K(),r=l.firstChild,h=r.nextSibling;return l.$$click=()=>H(i.id),t(r,()=>i.label),t(h,()=>i.hint),x(s=>{var p=b()===i.id,o=b()===i.id;return p!==s.e&&l.classList.toggle("is-active",s.e=p),o!==s.t&&k(l,"aria-pressed",s.t=o),s},{e:void 0,t:void 0}),l})()})),t(D,d(q,{get when(){return $().length>0},get fallback(){return Q()},get children(){var i=G();return t(i,d(g,{get each(){return $()},children:l=>(()=>{var r=U(),h=r.firstChild,s=h.firstChild,p=s.nextSibling,o=h.nextSibling,R=o.nextSibling,S=R.firstChild;return t(s,()=>l.title),t(p,()=>l.copy),t(o,d(g,{get each(){return l.tags},children:W=>(()=>{var C=V();return t(C,W),C})()})),t(S,()=>l.action),x(()=>k(S,"href",l.href)),r})()})),i}})),a})()}T(["click"]);export{ee as WorkbenchDocsPage};
1
+ import{e as I,f as M,n as N,C as O,o as P,i as t,c as d,t as n,b as T,T as Y,R as j,W as x,Y as k,F as g,S as q,_ as z}from"./index-DcAzlkrJ.js";import{d as B}from"./onescience-docs-CH5KBTI9.js";var G=n("<div class=os-client-capability-page-grid>"),J=n('<div class="os-client-capability-page os-client-docs-page"><header class=os-client-docs-head><div class=os-client-docs-head-copy><h2>帮助</h2><p>平台使用说明、插件镜像与版本记录</p></div></header><section class=os-client-capability-selector aria-label=帮助与文档><div class=os-client-capability-current-domain><span>文档分类:</span><strong></strong><small>点击条目在新窗口打开原文</small></div><div class="os-client-capability-tabs os-client-docs-tabs"role=tablist aria-label=文档分类></div></section><div class=os-client-capability-page-body><section class=os-client-capability-resource-panel>'),K=n("<button type=button><strong></strong><small>"),Q=n("<p class=os-client-capability-empty>该分类下暂无文档。"),U=n("<article class=os-client-capability-card><div><h4></h4><p></p></div><div class=os-client-capability-meta></div><div class=os-client-capability-actions><a target=_blank rel=noreferrer data-primary=true>"),V=n("<span>");const v=[{id:"manual",label:"用户手册",hint:"平台与 OneSkills 使用说明",match:e=>e.includes("用户手册")},{id:"plugins",label:"插件与镜像",hint:"插件协议与运行镜像",match:e=>e.includes("插件")||e.includes("镜像")},{id:"release",label:"发版记录",hint:"版本变化与重要调整",match:e=>e.includes("发版记录")||e.includes("版本记录")}];function w(e){const c=e.replace(/^#/,"").trim().toLowerCase();return c==="manual"||c==="plugins"||c==="release"?c:"manual"}function ee(){const e=I(),c=M(),[b,f]=N(w(e.hash));O(()=>f(w(e.hash)));const H=a=>{f(a),c(z(a),{replace:!0})},_=()=>v.find(a=>a.id===b())??v[0],$=P(()=>B.filter(a=>_().match(a.tags)));return(()=>{var a=J(),u=a.firstChild;u.firstChild;var m=u.nextSibling,y=m.firstChild,E=y.firstChild,F=E.nextSibling,L=y.nextSibling,A=m.nextSibling,D=A.firstChild;return t(u,d(j,{get href(){return Y()},class:"os-client-docs-close","aria-label":"关闭帮助",children:"×"}),null),t(F,()=>_().label),t(L,d(g,{each:v,children:i=>(()=>{var l=K(),r=l.firstChild,h=r.nextSibling;return l.$$click=()=>H(i.id),t(r,()=>i.label),t(h,()=>i.hint),x(s=>{var p=b()===i.id,o=b()===i.id;return p!==s.e&&l.classList.toggle("is-active",s.e=p),o!==s.t&&k(l,"aria-pressed",s.t=o),s},{e:void 0,t:void 0}),l})()})),t(D,d(q,{get when(){return $().length>0},get fallback(){return Q()},get children(){var i=G();return t(i,d(g,{get each(){return $()},children:l=>(()=>{var r=U(),h=r.firstChild,s=h.firstChild,p=s.nextSibling,o=h.nextSibling,R=o.nextSibling,S=R.firstChild;return t(s,()=>l.title),t(p,()=>l.copy),t(o,d(g,{get each(){return l.tags},children:W=>(()=>{var C=V();return t(C,W),C})()})),t(S,()=>l.action),x(()=>k(S,"href",l.href)),r})()})),i}})),a})()}T(["click"]);export{ee as WorkbenchDocsPage};