@onescience/onecode-web 1.14.50-202609031600 → 1.14.50-202609041106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{3Dmol-CcTSgS_I.js → 3Dmol-7YMNJqfC.js} +1 -1
- package/assets/account-system-Cw5e9KGB.js +1 -0
- package/assets/{alert-04-Db4ZS6xF.js → alert-01-CYAeyCMP.js} +1 -1
- package/assets/{alert-05-BrjFsUk3.js → alert-02-a2ki0UoQ.js} +1 -1
- package/assets/{alert-01-CPXWs6nf.js → alert-04-CcZgG6bJ.js} +1 -1
- package/assets/{alert-02-DI1DD_3d.js → alert-05-D7-V4rRk.js} +1 -1
- package/assets/alert-06-cxwQaG-M.js +1 -0
- package/assets/alert-07-Co7x1ur1.js +1 -0
- package/assets/alert-08-CF8mI3pz.js +1 -0
- package/assets/alert-10-DELx7y93.js +1 -0
- package/assets/{bip-bop-03-CYdvX8k_.js → bip-bop-03-CQtp5UBI.js} +1 -1
- package/assets/{bip-bop-04-KJbD4lUd.js → bip-bop-04-B5JxsVo8.js} +1 -1
- package/assets/{bip-bop-06-Cc85gIuq.js → bip-bop-06-CM-arrml.js} +1 -1
- package/assets/{bip-bop-08-DQAl-h9L.js → bip-bop-08-CZmdmAH8.js} +1 -1
- package/assets/bip-bop-09-DG1FB07M.js +1 -0
- package/assets/center-B41zMqFC.js +4 -0
- package/assets/dialog-edit-project-DHNm7Ey_.js +1 -0
- package/assets/dialog-fork-CI25AsCv.js +1 -0
- package/assets/dialog-project-upload-CkgODEoQ.js +2 -0
- package/assets/dialog-select-file-CExSniO7.js +1 -0
- package/assets/dialog-select-model-DA1fqH_v.js +2 -0
- package/assets/dialog-terminal-unavailable-BJfv1EHP.js +3 -0
- package/assets/docs-wIg32xY_.js +1 -0
- package/assets/ghostty-web-v5wxn2ZG.js +13 -0
- package/assets/home-8jUqij3D.js +1 -0
- package/assets/{index-Cxa2Vk80.js → index-DSFO1zPs.js} +149 -149
- package/assets/index-DgFAbOBA.css +1 -0
- package/assets/intro-f3CyX3LG.js +1 -0
- package/assets/{nope-02-CEsZCG3w.js → nope-02-Dud-xmOl.js} +1 -1
- package/assets/{nope-05-BpK9LKjZ.js → nope-05-CRb47w2t.js} +1 -1
- package/assets/{nope-08-D-5nAWNU.js → nope-08-C6-KHO6r.js} +1 -1
- package/assets/{nope-11-COnsf8VE.js → nope-11-CLbBShpj.js} +1 -1
- package/assets/nope-12-DKbH8IN1.js +1 -0
- package/assets/onescience-DnetzwjT.js +82 -0
- package/assets/{resources-C7NB-V9a.js → resources-vDDc_MJX.js} +2 -2
- package/assets/selection-BwmaAH41.js +1 -0
- package/assets/shell-Cbn2njzj.js +2 -0
- package/assets/skills-DYlf3B0U.js +1 -0
- package/assets/{staplebops-03-DSwM4GRQ.js → staplebops-03-D24uBgZq.js} +1 -1
- package/assets/{staplebops-04-ze2zihJz.js → staplebops-04-uT3rFS3Z.js} +1 -1
- package/assets/{staplebops-06-BJVX7hv9.js → staplebops-06-CKdUVJT0.js} +1 -1
- package/assets/{staplebops-07-B3Bn5VQK.js → staplebops-07-DLe3dmB5.js} +1 -1
- package/assets/status-popover-body-D7ovCoeA.js +2 -0
- package/assets/wizard-1E0A0kso.js +1 -0
- package/assets/{yup-01-Ctxq7OVz.js → yup-01-CXyCbhDP.js} +1 -1
- package/assets/{yup-03-C8Lemx9x.js → yup-03-DlREv1-t.js} +1 -1
- package/assets/{yup-04-tKpnqLFc.js → yup-04-Dy8s-aaY.js} +1 -1
- package/assets/{yup-05-ByOdNO_N.js → yup-05-DzUfJrew.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/assets/account-system-DRcY1oD1.js +0 -1
- package/assets/alert-06-CBhGhcW9.js +0 -1
- package/assets/alert-07-BiN6DBuL.js +0 -1
- package/assets/alert-08-pH5OhsOk.js +0 -1
- package/assets/alert-10-kyJVFv2A.js +0 -1
- package/assets/bip-bop-09-C5SnVe_l.js +0 -1
- package/assets/center-Cp7MBrmk.js +0 -1
- package/assets/dialog-edit-project-TXt8WU1J.js +0 -1
- package/assets/dialog-fork-fs_cIK4A.js +0 -1
- package/assets/dialog-project-upload-B8QKyumt.js +0 -2
- package/assets/dialog-select-file-CfgzSPbz.js +0 -1
- package/assets/dialog-select-model-C8p6HIH2.js +0 -2
- package/assets/dialog-terminal-unavailable-BPf6D9pa.js +0 -3
- package/assets/docs-BW2dQfrB.js +0 -1
- package/assets/ghostty-web-CbT7vRAF.js +0 -13
- package/assets/home-v-RyEJXO.js +0 -1
- package/assets/index-q70uwQje.css +0 -1
- package/assets/intro-BwCcm56A.js +0 -1
- package/assets/nope-12-UlwuxqTc.js +0 -1
- package/assets/onescience-DBtZsoEm.js +0 -82
- package/assets/onescience-skill-detail-dialog-C23957tN.js +0 -1
- package/assets/shell-Bex4QMb_.js +0 -2
- package/assets/skills-BgxyM9mc.js +0 -1
- package/assets/status-popover-body-BhWWbkYJ.js +0 -2
- package/assets/wizard-BQDxCspK.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`):""}function Se(i,n){return n.type==="remote"?Q({name:i,transport:"remote",url:n.url??"",headers:te(n.headers),enabled:n.enabled!==!1}):Q({name:i,transport:"local",command:Ce(n.command??[]),environment:te(n.environment),enabled:n.enabled!==!1})}function Pe(i,n,u){const e=i.name.trim();if(!e)return"name";if(e!==u&&n.includes(e))return"duplicate";if(i.transport==="local")return le(i.command).length===0?"command":void 0;if(!i.url.trim())return"url"}function ke(i){const n=i.enabled;return i.transport==="remote"?{type:"remote",url:i.url.trim(),enabled:n,headers:ee(i.headers)}:{type:"local",command:le(i.command),enabled:n,environment:ee(i.environment)}}var Me=b('<div class=os-wb-ssh-list-shell><div class=os-wb-ssh-toolbar><button type=button class="os-wb-ssh-action os-wb-ssh-action-primary">'),Fe=b("<div class=os-wb-mcp-panel>"),re=b('<div class="flex flex-col gap-5">'),Ee=b('<p class="text-12-regular text-text-critical-base">'),Ke=b('<div class=os-wb-ssh-form-shell><button type=button class=os-wb-ssh-form-back>← 返回列表</button><div class="min-h-0 flex-1 overflow-y-auto pr-1"><div class="os-wb-ssh-form-card flex flex-col gap-5 p-5"><div class="flex flex-col gap-2"><span class="text-12-medium text-text-strong"></span></div><div class="flex items-center justify-between gap-3 rounded-xl border border-[#e8ebf0] px-3 py-3"><div class="flex flex-col gap-1"><span class="text-13-medium text-text-strong"></span><span class="text-12-regular text-text-weak"></span></div></div></div></div><div class=os-wb-ssh-form-actions><button type=button class=os-wb-ssh-action></button><button type=button class="os-wb-ssh-action os-wb-ssh-action-primary">'),je=b("<span class=os-wb-ssh-row-badge>"),Le=b("<span class=os-wb-ssh-row-meta>"),Oe=b("<span class=os-wb-ssh-row-path>"),Ae=b('<div class=os-wb-ssh-row><div class="flex flex-col gap-0.5 min-w-0 flex-1"><div class="flex items-center gap-2 min-w-0"><span class=os-wb-ssh-row-title></span></div></div><div class="flex items-center gap-2 shrink-0"><button type=button class=os-wb-ssh-action>');const qe={connected:"mcp.status.connected",failed:"mcp.status.failed",needs_auth:"mcp.status.needs_auth",disabled:"mcp.status.disabled"},ne={name:"dialog.mcp.error.name",command:"dialog.mcp.error.command",url:"dialog.mcp.error.url",duplicate:"dialog.mcp.error.duplicate"};function Qe(i={}){const n=oe(),u=ce(),e=se(),g=de(),k=me(),v=E(()=>ue(ge())?.trim()||n.data.path.directory?.trim()||""),K=E(()=>u.createClient({directory:v()||void 0,throwOnError:!0})),V=pe(()=>({...k.mcp(U(v()||"__mcp__")),enabled:!!v()})),[s,$]=fe({mode:i.initialMode==="add"?"form":"list",editing:void 0,form:Q(),error:""}),C=E(()=>n.data.config.mcp??{}),S=E(()=>V.data??{}),W=E(()=>{const t=new Set([...Object.keys(C()),...Object.keys(S())]);return Array.from(t).map(l=>({name:l,status:S()[l]?.status??(C()[l]?"disabled":void 0)})).sort((l,f)=>l.name.localeCompare(f.name))}),T=E(()=>Object.keys(C())),w=t=>$("form",t),D=()=>{if(v())return g.refetchQueries(k.mcp(U(v())))},p=X(()=>({mutationFn:async t=>{S()[t]?.status==="connected"?await K().mcp.disconnect({name:t}):await K().mcp.connect({name:t})},onSuccess:()=>D(),onError:t=>{G({variant:"error",title:e.t("common.requestFailed"),description:t instanceof Error?t.message:String(t)})}})),m=X(()=>({mutationFn:async()=>{const t=Pe(s.form,T(),s.editing);if(t)throw $("error",e.t(ne[t])),new Error(t);$("error","");const l=s.form.name.trim(),f=ke(s.form),x={...C()};return s.editing&&s.editing!==l&&delete x[s.editing],x[l]=f,await n.updateConfig({mcp:x}),f.enabled!==!1&&await K().mcp.add({name:l,config:f}).catch(()=>{}),l},onSuccess:async()=>{G({title:e.t("dialog.mcp.toast.saved")});const t=async()=>{await Promise.all([D(),g.invalidateQueries({queryKey:["config"]})])};await t(),setTimeout(()=>void t(),500),setTimeout(()=>void t(),1500),_()},onError:t=>{t instanceof Error&&t.message in ne||G({variant:"error",title:e.t("common.requestFailed"),description:t instanceof Error?t.message:String(t)})}}));function _(){$({mode:"list",editing:void 0,form:Q(),error:""})}function M(){$({mode:"form",editing:void 0,form:Q(),error:""})}function H(t){const l=C()[t];if(!l||!("type"in l)){G({variant:"error",title:e.t("dialog.mcp.error.missingConfig")});return}$({mode:"form",editing:t,form:Se(t,l),error:""})}return(()=>{var t=Fe();return r(t,c(P,{get when(){return s.mode==="list"},get fallback(){return(()=>{var l=Ke(),f=l.firstChild,x=f.nextSibling,d=x.firstChild,y=d.firstChild,B=y.firstChild,j=y.nextSibling,z=j.firstChild,h=z.firstChild,O=h.nextSibling,A=x.nextSibling,L=A.firstChild,F=L.nextSibling;return f.$$click=_,r(d,c(q,{get label(){return e.t("dialog.mcp.form.name")},get placeholder(){return e.t("dialog.mcp.form.namePlaceholder")},get value(){return s.form.name},get disabled(){return m.isPending||!!s.editing},onChange:a=>w({name:a})}),y),r(B,()=>e.t("dialog.mcp.form.transport")),r(y,c(be,{options:["local","remote"],get current(){return s.form.transport},value:a=>a,label:a=>a==="local"?e.t("dialog.mcp.form.transport.local"):e.t("dialog.mcp.form.transport.remote"),onSelect:a=>{!a||m.isPending||w({transport:a})}}),null),r(d,c(P,{get when(){return s.form.transport==="local"},get fallback(){return(()=>{var a=re();return r(a,c(q,{get label(){return e.t("dialog.mcp.form.url")},get placeholder(){return e.t("dialog.mcp.form.urlPlaceholder")},get value(){return s.form.url},get disabled(){return m.isPending},onChange:o=>w({url:o})}),null),r(a,c(q,{multiline:!0,get label(){return e.t("dialog.mcp.form.headers")},get placeholder(){return e.t("dialog.mcp.form.headersPlaceholder")},get value(){return s.form.headers},get disabled(){return m.isPending},onChange:o=>w({headers:o}),class:"min-h-24"}),null),a})()},get children(){var a=re();return r(a,c(q,{get label(){return e.t("dialog.mcp.form.command")},get placeholder(){return e.t("dialog.mcp.form.commandPlaceholder")},get value(){return s.form.command},get disabled(){return m.isPending},onChange:o=>w({command:o})}),null),r(a,c(q,{multiline:!0,get label(){return e.t("dialog.mcp.form.environment")},get placeholder(){return e.t("dialog.mcp.form.environmentPlaceholder")},get value(){return s.form.environment},get disabled(){return m.isPending},onChange:o=>w({environment:o}),class:"min-h-24"}),null),a}}),j),r(h,()=>e.t("dialog.mcp.form.enabled")),r(O,()=>e.t("dialog.mcp.form.enabledDescription")),r(j,c(Y,{get checked(){return s.form.enabled},get disabled(){return m.isPending},onChange:a=>w({enabled:a})}),null),r(d,c(P,{get when(){return s.error},get children(){var a=Ee();return r(a,()=>s.error),a}}),null),L.$$click=_,r(L,()=>e.t("common.cancel")),F.$$click=()=>{m.isPending||m.mutate()},r(F,(()=>{var a=R(()=>!!m.isPending);return()=>a()?e.t("common.saving"):e.t("common.save")})()),I(a=>{var o=m.isPending,J=m.isPending;return o!==a.e&&(L.disabled=a.e=o),J!==a.t&&(F.disabled=a.t=J),a},{e:void 0,t:void 0}),l})()},get children(){var l=Me(),f=l.firstChild,x=f.firstChild;return r(l,c(he,{get search(){return{placeholder:e.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return e.t("dialog.mcp.empty")},key:d=>d?.name??"",items:W,filterKeys:["name","status"],sortBy:(d,y)=>d.name.localeCompare(y.name),class:"os-wb-ssh-list flex-1 min-h-0",onSelect:d=>{!d||p.isPending||p.mutate(d.name)},children:d=>{const y=()=>S()[d.name]?.status??d.status,B=()=>{const h=y()?qe[y()]:void 0;if(h)return e.t(h)},j=()=>{const h=S()[d.name];return h?.status==="failed"?h.error:void 0},z=()=>y()==="connected";return(()=>{var h=Ae(),O=h.firstChild,A=O.firstChild,L=A.firstChild,F=O.nextSibling,a=F.firstChild;return r(L,()=>d.name),r(A,c(P,{get when(){return B()},get children(){var o=je();return r(o,B),o}}),null),r(A,c(P,{get when(){return R(()=>!!p.isPending)()&&p.variables===d.name},get children(){var o=Le();return r(o,()=>e.t("common.loading.ellipsis")),o}}),null),r(O,c(P,{get when(){return j()},get children(){var o=Oe();return r(o,j),o}}),null),F.$$click=o=>o.stopPropagation(),a.$$click=()=>H(d.name),r(a,()=>e.t("common.edit")),r(F,c(Y,{get checked(){return z()},get disabled(){return R(()=>!!p.isPending)()&&p.variables===d.name},onChange:()=>{p.isPending||p.mutate(d.name)}}),null),h})()}}),f),x.$$click=M,r(x,()=>e.t("dialog.mcp.addButton")),l}})),I(()=>ae(t,"data-mode",s.mode)),t})()}ie(["click"]);var Te=b('<div class="os-client-capability-page os-client-resources-page"><header class=os-client-resources-head><div class=os-client-resources-head-copy><h2>资源配置</h2><p>SSH 连接与 MCP 工具链接</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-domain-row role=tablist aria-label=资源配置类型></div></section><div class="os-client-capability-page-body os-client-resources-body">'),De=b("<button type=button>");const N=[{id:"ssh",label:"SSH 连接",descriptionKey:"dialog.ssh.description"},{id:"mcp",label:"MCP 链接",descriptionKey:"dialog.server.mcp.description"}];function Be(){const i=se(),[n,u]=ve(),[e,g]=Z("ssh"),[k,v]=Z(!1);$e(()=>{const s=n.section==="mcp"?"mcp":"ssh";g(s),v(s==="mcp"&&n.mode==="add")});const K=E(()=>N.find(s=>s.id===e())??N[0]),V=s=>{g(s),v(!1),u({section:s==="ssh"?void 0:s,mode:void 0},{replace:!0})};return(()=>{var s=Te(),$=s.firstChild;$.firstChild;var C=$.nextSibling,S=C.firstChild,W=S.firstChild,T=W.nextSibling,w=T.nextSibling,D=S.nextSibling,p=C.nextSibling;return r($,c(we,{get href(){return ye()},class:"os-client-resources-close","aria-label":"关闭资源配置",children:"×"}),null),r(T,()=>K().label),r(w,()=>i.t(K().descriptionKey)),r(D,c(_e,{each:N,children:m=>(()=>{var _=De();return _.$$click=()=>V(m.id),r(_,()=>m.label),I(M=>{var H=m.id===e(),t=m.id===e();return H!==M.e&&_.classList.toggle("is-active",M.e=H),t!==M.t&&ae(_,"aria-pressed",M.t=t),M},{e:void 0,t:void 0}),_})()})),r(p,c(P,{get when(){return e()==="ssh"},get children(){return c(xe,{variant:"page"})}}),null),r(p,c(P,{get when(){return R(()=>e()==="mcp")()?k()?"add":"list":!1},keyed:!0,children:m=>c(Qe,{initialMode:m==="add"?"add":void 0})}),null),s})()}ie(["click"]);export{Be as WorkbenchResourcesPage};
|
|
1
|
+
import{h as oe,j as ce,u as se,b$ as de,dk as me,o as E,dl as ue,s as ge,dm as pe,p as U,be as fe,dn as X,_ as G,i as r,c,dp as he,S as P,R as W,dq as Y,dr as Q,ds as be,Q as I,T as ae,t as b,b as ie,dd as ve,n as Z,x as $e,N as ye,L as _e,F as we,dt as xe}from"./index-DSFO1zPs.js";function q(i){return{name:"",transport:"local",command:"",environment:"",url:"",headers:"",enabled:!0,...i}}function le(i){const n=[],u=/"([^"]*)"|'([^']*)'|(\S+)/g;let e;for(;e=u.exec(i.trim());)n.push(e[1]??e[2]??e[3]??"");return n.filter(g=>g.length>0)}function Se(i){return i.map(n=>/[\s"']/.test(n)?`"${n.replaceAll('"','\\"')}"`:n).join(" ")}function ee(i){const n={};for(const u of i.split(/\r?\n/)){const e=u.trim();if(!e||e.startsWith("#"))continue;const g=e.indexOf("=");if(g<=0)continue;const k=e.slice(0,g).trim(),v=e.slice(g+1).trim();k&&(n[k]=v)}return Object.keys(n).length>0?n:void 0}function te(i){return i?Object.entries(i).map(([n,u])=>`${n}=${u}`).join(`
|
|
2
|
+
`):""}function Ce(i,n){return n.type==="remote"?q({name:i,transport:"remote",url:n.url??"",headers:te(n.headers),enabled:n.enabled!==!1}):q({name:i,transport:"local",command:Se(n.command??[]),environment:te(n.environment),enabled:n.enabled!==!1})}function Pe(i,n,u){const e=i.name.trim();if(!e)return"name";if(e!==u&&n.includes(e))return"duplicate";if(i.transport==="local")return le(i.command).length===0?"command":void 0;if(!i.url.trim())return"url"}function ke(i){const n=i.enabled;return i.transport==="remote"?{type:"remote",url:i.url.trim(),enabled:n,headers:ee(i.headers)}:{type:"local",command:le(i.command),enabled:n,environment:ee(i.environment)}}var Me=b('<div class=os-wb-ssh-list-shell><div class=os-wb-ssh-toolbar><button type=button class="os-wb-ssh-action os-wb-ssh-action-primary">'),Fe=b("<div class=os-wb-mcp-panel>"),re=b('<div class="flex flex-col gap-5">'),Ee=b('<p class="text-12-regular text-text-critical-base">'),Ke=b('<div class=os-wb-ssh-form-shell><button type=button class=os-wb-ssh-form-back>← 返回列表</button><div class="min-h-0 flex-1 overflow-y-auto pr-1"><div class="os-wb-ssh-form-card flex flex-col gap-5 p-5"><div class="flex flex-col gap-2"><span class="text-12-medium text-text-strong"></span></div><div class="flex items-center justify-between gap-3 rounded-xl border border-[#e8ebf0] px-3 py-3"><div class="flex flex-col gap-1"><span class="text-13-medium text-text-strong"></span><span class="text-12-regular text-text-weak"></span></div></div></div></div><div class=os-wb-ssh-form-actions><button type=button class=os-wb-ssh-action></button><button type=button class="os-wb-ssh-action os-wb-ssh-action-primary">'),Le=b("<span class=os-wb-ssh-row-badge>"),je=b("<span class=os-wb-ssh-row-meta>"),Oe=b("<span class=os-wb-ssh-row-path>"),Ae=b('<div class=os-wb-ssh-row><div class="flex flex-col gap-0.5 min-w-0 flex-1"><div class="flex items-center gap-2 min-w-0"><span class=os-wb-ssh-row-title></span></div></div><div class="flex items-center gap-2 shrink-0"><button type=button class=os-wb-ssh-action>');const Qe={connected:"mcp.status.connected",failed:"mcp.status.failed",needs_auth:"mcp.status.needs_auth",disabled:"mcp.status.disabled"},ne={name:"dialog.mcp.error.name",command:"dialog.mcp.error.command",url:"dialog.mcp.error.url",duplicate:"dialog.mcp.error.duplicate"};function qe(i={}){const n=oe(),u=ce(),e=se(),g=de(),k=me(),v=E(()=>ue(ge())?.trim()||n.data.path.directory?.trim()||""),K=E(()=>u.createClient({directory:v()||void 0,throwOnError:!0})),B=pe(()=>({...k.mcp(U(v()||"__mcp__")),enabled:!!v()})),[s,$]=fe({mode:i.initialMode==="add"?"form":"list",editing:void 0,form:q(),error:""}),S=E(()=>n.data.config.mcp??{}),C=E(()=>B.data??{}),N=E(()=>{const t=new Set([...Object.keys(S()),...Object.keys(C())]);return Array.from(t).map(l=>({name:l,status:C()[l]?.status??(S()[l]?"disabled":void 0)})).sort((l,f)=>l.name.localeCompare(f.name))}),T=E(()=>Object.keys(S())),_=t=>$("form",t),D=()=>{if(v())return g.refetchQueries(k.mcp(U(v())))},p=X(()=>({mutationFn:async t=>{C()[t]?.status==="connected"?await K().mcp.disconnect({name:t}):await K().mcp.connect({name:t})},onSuccess:()=>D(),onError:t=>{G({variant:"error",title:e.t("common.requestFailed"),description:t instanceof Error?t.message:String(t)})}})),m=X(()=>({mutationFn:async()=>{const t=Pe(s.form,T(),s.editing);if(t)throw $("error",e.t(ne[t])),new Error(t);$("error","");const l=s.form.name.trim(),f=ke(s.form),x={...S()};return s.editing&&s.editing!==l&&delete x[s.editing],x[l]=f,await n.updateConfig({mcp:x}),f.enabled!==!1&&await K().mcp.add({name:l,config:f}).catch(()=>{}),l},onSuccess:async()=>{G({title:e.t("dialog.mcp.toast.saved")});const t=async()=>{await Promise.all([D(),g.invalidateQueries({queryKey:["config"]})])};await t(),setTimeout(()=>void t(),500),setTimeout(()=>void t(),1500),w()},onError:t=>{t instanceof Error&&t.message in ne||G({variant:"error",title:e.t("common.requestFailed"),description:t instanceof Error?t.message:String(t)})}}));function w(){$({mode:"list",editing:void 0,form:q(),error:""})}function M(){$({mode:"form",editing:void 0,form:q(),error:""})}function H(t){const l=S()[t];if(!l||!("type"in l)){G({variant:"error",title:e.t("dialog.mcp.error.missingConfig")});return}$({mode:"form",editing:t,form:Ce(t,l),error:""})}return(()=>{var t=Fe();return r(t,c(P,{get when(){return s.mode==="list"},get fallback(){return(()=>{var l=Ke(),f=l.firstChild,x=f.nextSibling,d=x.firstChild,y=d.firstChild,R=y.firstChild,L=y.nextSibling,V=L.firstChild,h=V.firstChild,O=h.nextSibling,A=x.nextSibling,j=A.firstChild,F=j.nextSibling;return f.$$click=w,r(d,c(Q,{get label(){return e.t("dialog.mcp.form.name")},get placeholder(){return e.t("dialog.mcp.form.namePlaceholder")},get value(){return s.form.name},get disabled(){return m.isPending||!!s.editing},onChange:a=>_({name:a})}),y),r(R,()=>e.t("dialog.mcp.form.transport")),r(y,c(be,{options:["local","remote"],get current(){return s.form.transport},value:a=>a,label:a=>a==="local"?e.t("dialog.mcp.form.transport.local"):e.t("dialog.mcp.form.transport.remote"),onSelect:a=>{!a||m.isPending||_({transport:a})}}),null),r(d,c(P,{get when(){return s.form.transport==="local"},get fallback(){return(()=>{var a=re();return r(a,c(Q,{get label(){return e.t("dialog.mcp.form.url")},get placeholder(){return e.t("dialog.mcp.form.urlPlaceholder")},get value(){return s.form.url},get disabled(){return m.isPending},onChange:o=>_({url:o})}),null),r(a,c(Q,{multiline:!0,get label(){return e.t("dialog.mcp.form.headers")},get placeholder(){return e.t("dialog.mcp.form.headersPlaceholder")},get value(){return s.form.headers},get disabled(){return m.isPending},onChange:o=>_({headers:o}),class:"min-h-24"}),null),a})()},get children(){var a=re();return r(a,c(Q,{get label(){return e.t("dialog.mcp.form.command")},get placeholder(){return e.t("dialog.mcp.form.commandPlaceholder")},get value(){return s.form.command},get disabled(){return m.isPending},onChange:o=>_({command:o})}),null),r(a,c(Q,{multiline:!0,get label(){return e.t("dialog.mcp.form.environment")},get placeholder(){return e.t("dialog.mcp.form.environmentPlaceholder")},get value(){return s.form.environment},get disabled(){return m.isPending},onChange:o=>_({environment:o}),class:"min-h-24"}),null),a}}),L),r(h,()=>e.t("dialog.mcp.form.enabled")),r(O,()=>e.t("dialog.mcp.form.enabledDescription")),r(L,c(Y,{get checked(){return s.form.enabled},get disabled(){return m.isPending},onChange:a=>_({enabled:a})}),null),r(d,c(P,{get when(){return s.error},get children(){var a=Ee();return r(a,()=>s.error),a}}),null),j.$$click=w,r(j,()=>e.t("common.cancel")),F.$$click=()=>{m.isPending||m.mutate()},r(F,(()=>{var a=W(()=>!!m.isPending);return()=>a()?e.t("common.saving"):e.t("common.save")})()),I(a=>{var o=m.isPending,J=m.isPending;return o!==a.e&&(j.disabled=a.e=o),J!==a.t&&(F.disabled=a.t=J),a},{e:void 0,t:void 0}),l})()},get children(){var l=Me(),f=l.firstChild,x=f.firstChild;return r(l,c(he,{get search(){return{placeholder:e.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return e.t("dialog.mcp.empty")},key:d=>d?.name??"",items:N,filterKeys:["name","status"],sortBy:(d,y)=>d.name.localeCompare(y.name),class:"os-wb-ssh-list flex-1 min-h-0",onSelect:d=>{!d||p.isPending||p.mutate(d.name)},children:d=>{const y=()=>C()[d.name]?.status??d.status,R=()=>{const h=y()?Qe[y()]:void 0;if(h)return e.t(h)},L=()=>{const h=C()[d.name];return h?.status==="failed"?h.error:void 0},V=()=>y()==="connected";return(()=>{var h=Ae(),O=h.firstChild,A=O.firstChild,j=A.firstChild,F=O.nextSibling,a=F.firstChild;return r(j,()=>d.name),r(A,c(P,{get when(){return R()},get children(){var o=Le();return r(o,R),o}}),null),r(A,c(P,{get when(){return W(()=>!!p.isPending)()&&p.variables===d.name},get children(){var o=je();return r(o,()=>e.t("common.loading.ellipsis")),o}}),null),r(O,c(P,{get when(){return L()},get children(){var o=Oe();return r(o,L),o}}),null),F.$$click=o=>o.stopPropagation(),a.$$click=()=>H(d.name),r(a,()=>e.t("common.edit")),r(F,c(Y,{get checked(){return V()},get disabled(){return W(()=>!!p.isPending)()&&p.variables===d.name},onChange:()=>{p.isPending||p.mutate(d.name)}}),null),h})()}}),f),x.$$click=M,r(x,()=>e.t("dialog.mcp.addButton")),l}})),I(()=>ae(t,"data-mode",s.mode)),t})()}ie(["click"]);var Te=b('<div class="os-client-capability-page os-client-resources-page"><header class=os-client-resources-head><div class=os-client-resources-head-copy><h2>资源配置</h2><p>SSH 连接与 MCP 工具链接</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-domain-row role=tablist aria-label=资源配置类型></div></section><div class="os-client-capability-page-body os-client-resources-body">'),De=b("<button type=button>");const z=[{id:"ssh",label:"SSH 连接",descriptionKey:"dialog.ssh.description"},{id:"mcp",label:"MCP 链接",descriptionKey:"dialog.server.mcp.description"}];function Re(){const i=se(),[n,u]=ve(),[e,g]=Z("ssh"),[k,v]=Z(!1);$e(()=>{const s=n.section==="mcp"?"mcp":"ssh";g(s),v(s==="mcp"&&n.mode==="add")});const K=E(()=>z.find(s=>s.id===e())??z[0]),B=s=>{g(s),v(!1),u({section:s==="ssh"?void 0:s,mode:void 0},{replace:!0})};return(()=>{var s=Te(),$=s.firstChild;$.firstChild;var S=$.nextSibling,C=S.firstChild,N=C.firstChild,T=N.nextSibling,_=T.nextSibling,D=C.nextSibling,p=S.nextSibling;return r($,c(_e,{get href(){return ye()},class:"os-client-resources-close","aria-label":"关闭资源配置",children:"×"}),null),r(T,()=>K().label),r(_,()=>i.t(K().descriptionKey)),r(D,c(we,{each:z,children:m=>(()=>{var w=De();return w.$$click=()=>B(m.id),r(w,()=>m.label),I(M=>{var H=m.id===e(),t=m.id===e();return H!==M.e&&w.classList.toggle("is-active",M.e=H),t!==M.t&&ae(w,"aria-pressed",M.t=t),M},{e:void 0,t:void 0}),w})()})),r(p,c(P,{get when(){return e()==="ssh"},get children(){return c(xe,{variant:"page"})}}),null),r(p,c(P,{get when(){return W(()=>e()==="mcp")()?k()?"add":"list":!1},keyed:!0,children:m=>c(qe,{initialMode:m==="add"?"add":void 0})}),null),s})()}ie(["click"]);export{Re as WorkbenchResourcesPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bf as s,b1 as y}from"./index-DSFO1zPs.js";const m="os-capability-catalog-selection",l={categoryId:"scenario",domainId:"all"};function n(t){return t==="scenario"||t==="onemodel"||t==="hpc"||t==="onedata"||t==="oneskills"}function i(t){return t==="all"||t==="materials"||t==="weather"||t==="fluid"||t==="bio"}function f(t){const a=new URLSearchParams(t).get("category");return n(a)?a:void 0}function u(t){const a=new URLSearchParams(t).get("domain");return i(a)?a:void 0}function g(){try{if(typeof localStorage>"u")return;const t=localStorage.getItem(m);if(!t)return;const a=JSON.parse(t);return!n(a.categoryId)||!i(a.domainId)?void 0:{categoryId:a.categoryId,domainId:a.domainId}}catch{return}}function p(t){try{if(typeof localStorage>"u"||!n(t.categoryId)||!i(t.domainId))return;localStorage.setItem(m,JSON.stringify(t))}catch{}}function S(){const t=g()??l,a=new URLSearchParams({category:t.categoryId,domain:t.domainId});return`${s.capabilities}?${a}`}function b(t,a){const o=f(a),r=u(a),c=g();if(o)return r?{categoryId:o,domainId:r}:o==="oneskills"?{categoryId:o,domainId:c?.domainId??"all"}:{categoryId:o,domainId:"all"};const d=new RegExp(`^${s.capabilities}/([^/]+)`).exec(t),e=d?.[1]?y(d[1]):void 0;return e?{categoryId:e.category,domainId:r??e.domain}:c??l}export{S as c,u as d,g as r,b as s,p as w};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-project-upload-CkgODEoQ.js","assets/index-DSFO1zPs.js","assets/index-DgFAbOBA.css","assets/dialog-terminal-unavailable-BJfv1EHP.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as Ie,c as e,I as ie,D as $,i as r,S as _,F as pe,d as Be,t as i,p as ge,a as _e,s as J,b as ye,e as rt,f as Vt,g as st,h as Xt,j as Gt,k as Jt,l as Qt,m as Dt,n as W,o as y,q as Zt,r as ht,v as Yt,w as it,x as K,y as gt,z as Ve,A as en,B as mt,C as tn,E as he,G as nn,H as rn,M as sn,J as on,K as an,L as le,N as ln,O as cn,P as dn,Q as N,R as ve,T as j,U as un,V as hn,W as It,X as Xe,Y as vt,Z as pt,_ as me,$ as tt,a0 as gn,a1 as Mt,a2 as mn,a3 as vn,a4 as Ne,a5 as ft,a6 as Ge,a7 as pn,a8 as fn,a9 as bn,aa as wn,ab as $n,ac as _n,ad as yn,ae as kn,af as Sn,ag as Ke,ah as bt,ai as Rt,aj as xn,ak as nt,al as Cn,am as jt,an as ce,ao as Pn,ap as wt,aq as Ln,ar as En,as as Dn,at as In,au as Mn,av as qe,aw as Rn,ax as jn,ay as Tn,az as Tt,aA as zt,aB as De,aC as At,aD as zn,aE as An,aF as Hn,aG as Wn,aH as Fn,aI as Nn,aJ as On,aK as $t,aL as _t,aM as yt,aN as kt,aO as Bn,aP as Le}from"./index-DSFO1zPs.js";import{DialogEditProject as qn}from"./dialog-edit-project-DHNm7Ey_.js";import{c as Kn}from"./selection-BwmaAH41.js";var Un=i("<span class=os-client-session-menu-label>"),Vn=i("<div class=os-client-session-menu-empty>");const Je="os-client-session-menu",Xn="os-client-session-menu os-client-session-menu-sub";function Gn(l){const a=Ie(),n=()=>J(),P=()=>_e(n(),l.currentDirectory),u=()=>l.projects().filter(h=>ge(h.worktree)!==ge(l.currentDirectory)).filter(h=>!_e(n(),h.worktree));return e(_,{get when(){return P()},get children(){return e($.Sub,{get children(){return[e($.SubTrigger,{"data-action":"session-move",class:"os-client-session-menu-item",get children(){return[e(ie,{name:"folder",size:"small",class:"os-client-session-menu-icon"}),(()=>{var h=Un();return r(h,()=>a.t("session.move.toProject")),h})(),e(ie,{name:"chevron-right",size:"small",class:"os-client-session-menu-chevron"})]}}),e($.Portal,{get children(){return e($.SubContent,{class:Xn,get children(){return[e($.Item,{"data-action":"session-move-new-project",class:"os-client-session-menu-item",onSelect:()=>l.onNewProject(),get children(){return[e(ie,{name:"plus",size:"small",class:"os-client-session-menu-icon"}),e($.ItemLabel,{class:"os-client-session-menu-label",get children(){return a.t("session.move.newProject")}})]}}),e($.Separator,{class:"os-client-session-menu-separator"}),e(_,{get when(){return u().length>0},get fallback(){return(()=>{var h=Vn();return r(h,()=>a.t("session.move.emptyProjects")),h})()},get children(){return e(pe,{get each(){return u()},children:h=>e($.Item,{"data-action":"session-move-target",class:"os-client-session-menu-item",onSelect:()=>l.onMove(h.worktree),get children(){return[e(ie,{name:"folder",size:"small",class:"os-client-session-menu-icon"}),e($.ItemLabel,{class:"os-client-session-menu-label",get children(){return Be(h)}})]}})})}})]}})}})]}})}})}function St(l){const a=Ie();return[e($.Item,{"data-action":"session-archive",class:"os-client-session-menu-item",onSelect:()=>l.onArchive(),get children(){return[e(ie,{name:"archive",size:"small",class:"os-client-session-menu-icon"}),e($.ItemLabel,{class:"os-client-session-menu-label",get children(){return a.t("common.archive")}})]}}),e(Gn,{get currentDirectory(){return l.currentDirectory},get projects(){return l.projects},get onMove(){return l.onMove},get onNewProject(){return l.onNewProject}}),e($.Separator,{class:"os-client-session-menu-separator"}),e($.Item,{"data-action":"session-delete",class:"os-client-session-menu-item is-danger",onSelect:()=>l.onDelete(),get children(){return[e(ie,{name:"trash",size:"small",class:"os-client-session-menu-icon"}),e($.ItemLabel,{class:"os-client-session-menu-label",get children(){return a.t("common.delete")}})]}})]}var xt=i('<div class="flex flex-col gap-4 pl-6 pr-2.5 pb-3"><span class="text-14-regular text-text-strong"></span><div class="flex justify-end gap-2">'),Jn=i("<span class=os-sidebar-label>"),Qn=i('<svg class=os-sidebar-icon viewBox="0 0 24 24"aria-hidden=true><path d="M21 15a2 2 0 0 1-2 2H8l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z">'),Zn=i("<span class=os-sidebar-label>新建会话"),Yn=i('<svg class=os-sidebar-icon viewBox="0 0 24 24"aria-hidden=true><path d="M5 5h5v5H5z"></path><path d="M14 5h5v5h-5z"></path><path d="M5 14h5v5H5z"></path><path d="M14 14h5v5h-5z">'),er=i("<span class=os-sidebar-label>能力中心"),tr=i('<svg class=os-sidebar-icon viewBox="0 0 24 24"aria-hidden=true><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.5-3.5a5.8 5.8 0 0 1-7.6 7.6l-6.8 6.8a2.1 2.1 0 0 1-3-3l6.8-6.8a5.8 5.8 0 0 1 7.6-7.6z">'),nr=i("<span class=os-sidebar-label>skills设置"),rr=i('<svg class=os-sidebar-icon viewBox="0 0 24 24"aria-hidden=true><rect x=3 y=4 width=18 height=6 rx=1.5></rect><rect x=3 y=14 width=18 height=6 rx=1.5></rect><path d="M7 7h.01"></path><path d="M7 17h.01">'),sr=i("<span class=os-sidebar-label>资源配置"),ir=i("<p class=os-client-empty-hint>登录后同步个人空间"),or=i("<div class=os-client-task-list-scroll>"),ar=i("<button type=button class=os-client-task-more data-action=recent-expand>展开更多"),lr=i("<button type=button class=os-client-task-more data-action=recent-collapse>收起"),cr=i("<p class=os-client-empty-hint>登录后查看未分类会话"),dr=i("<button type=button class=os-client-shared-cases-more data-action=shared-cases-expand>展开更多"),ur=i("<button type=button class=os-client-shared-cases-more data-action=shared-cases-collapse>收起"),hr=i("<div class=os-client-shared-cases-list>"),gr=i('<section class="os-sidebar-group os-client-shared-cases"data-section=shared-cases><button type=button class=os-client-shared-cases-toggle data-action=shared-cases-toggle><span class=os-client-shared-cases-chevron aria-hidden=true></span><span>'),mr=i('<svg class=os-sidebar-icon viewBox="0 0 24 24"aria-hidden=true><path d="M7 4h7l3 3v13H7z"></path><path d="M14 4v4h4"></path><path d="M10 12h5"></path><path d="M10 16h5">'),vr=i("<span class=os-sidebar-label>帮助"),pr=i('<aside class=os-sidebar><div class=os-sidebar-brand></div><nav class=os-sidebar-nav><div class=os-sidebar-nav-scroll><div class="os-sidebar-group os-client-capability-group"></div><div class="os-sidebar-group os-client-list-section"><div class=os-client-section-title><span>项目</span><span class=os-client-section-actions><button type=button aria-label=新建项目>+</button></span></div><div class=os-client-project-list></div></div><div class="os-sidebar-group os-client-list-section"><div class=os-client-section-title><span>未分类</span><span class=os-client-section-actions><button type=button aria-label=新建会话>+</button></span></div><div class=os-client-task-list></div></div></div></nav><div class=os-sidebar-footer><div class=os-sidebar-footer-actions><button type=button class=os-sidebar-footer-action><svg class=os-sidebar-icon viewBox="0 0 24 24"aria-hidden=true><path d="M12 8.5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7Z"></path><path d="M12 3.5v2"></path><path d="M12 18.5v2"></path><path d="m5.6 5.6 1.4 1.4"></path><path d="m17 17 1.4 1.4"></path><path d="M3.5 12h2"></path><path d="M18.5 12h2"></path><path d="m5.6 18.4 1.4-1.4"></path><path d="m17 7 1.4-1.4"></path></svg><span class=os-sidebar-label>设置'),fr=i("<p class=os-client-empty-hint>暂无项目,点击 + 打开目录"),br=i("<div class=os-client-project-sessions>"),wr=i("<div class=os-client-project-block><div class=os-client-project-row>"),Qe=i("<span class=os-client-task-main><span>"),Ct=i("<div class=os-client-session-row>"),$r=i("<p class=os-client-empty-hint>暂无未分类会话,点击 + 新建"),_r=i("<p class=os-client-empty-hint>暂无默认案例");const Oe=4,Pt=200,Ze=4;function yr(){const l=rt(),a=Vt(),n=Ie(),P=st(),u=Xt(),h=Gt(),m=Jt(),A=Qt(),L=Dt(),w=()=>!!J(),I=()=>It(l.pathname),T=()=>(l.pathname,l.search,Kn()),b=()=>l.pathname.startsWith("/workspace/capabilities"),k=()=>l.pathname.startsWith("/workspace/skills"),oe=()=>l.pathname.startsWith("/workspace/resources"),X=()=>l.pathname.startsWith("/workspace/docs"),[S,C]=W(!0),[D,U]=W(!1),[V,ae]=W(!1),Q=y(()=>Zt(P.projects.list(),J())),q=y(()=>Q().filter(t=>!_e(J(),t.worktree))),fe=y(()=>ht(J())?.trim()||""),re=y(()=>Yt(J())?.trim()||""),de=y(()=>{const t=/^\/workspace\/([^/]+)\/session/.exec(l.pathname)?.[1];return t?it(t)??"":""}),Z=()=>/\/session\/([^/?#]+)/.exec(l.pathname)?.[1],ue=t=>{const o=de();if(!o)return!1;const g=ge(o);return ge(t.worktree)===g?!0:t.sandboxes?.some(H=>ge(H)===g)??!1};K(()=>{if(!w())return;const t=[...q().flatMap(o=>[o.worktree,...o.sandboxes??[]]),fe()].filter(o=>o.length>0);for(const o of t)gt(()=>{u.project.loadSessions(o)})}),K(()=>{const t=re();if(!t)return;const[o,g]=u.child(t,{bootstrap:!1});(o.limit??0)<Pt&&g("limit",Pt),gt(()=>{u.project.loadSessions(t)})});const te=y(()=>{const t=fe();if(!t)return[];const[o]=u.child(t,{bootstrap:!1});return Ve(o,Date.now(),t).map(g=>({session:g,directory:t}))}),c=y(()=>V()?te():te().slice(0,Ze)),M=y(()=>!V()&&te().length>Ze),d=y(()=>V()&&te().length>Ze),f=y(()=>{const t=re();if(!t)return[];const[o]=u.child(t,{bootstrap:!1});return en(Ve(o,Date.now(),t).filter(g=>mt(g.id)))}),v=y(()=>S()?D()?f():f().slice(0,Oe):[]),p=y(()=>S()&&!D()&&f().length>Oe),s=y(()=>S()&&D()&&f().length>Oe);K(()=>{const t=tn(l.search),o=Z(),g=t&&t!=="open"?t:mt(o)?o:void 0;if((t||g)&&C(!0),g&&f().findIndex(G=>G.id===g)>=Oe&&U(!0),!t||t==="open")return;const H=re();H&&o!==t&&a(he(H,t),{replace:!0})});function E(t,o=!0){P.projects.open(t),A.projects.touchCode(t),o&&a(he(t))}function B(){L.show(()=>e(_n,{onCreated:t=>E(t)}))}function Me(t){L.show(()=>e(qn,{project:t}))}function Re(t){const o=t.worktree;if(_e(J(),o))return;const g=q(),H=ge(o),z=g.findIndex(se=>ge(se.worktree)===H);if(z===-1)return;if(ue(t)){const se=g[z+1]??g[z-1];a(se?he(se.worktree):"/workspace")}P.projects.close(o)}async function je(){const t=m.openDirectoryPickerDialog;function o(g){if(Array.isArray(g)){g.forEach((H,z)=>E(H,z===0));return}g&&E(g)}if(t&&fn({hasNativePicker:!!t,isLocalServer:!!A.isLocal(),hasPlatformSession:!!J()})){const g=await t({title:n.t("command.project.open"),multiple:!0});o(g);return}L.show(()=>e(bn,{multiple:!0,onSelect:o,onCreateFolder:B}),()=>o(null))}function be(){Xe({navigate:a,action:{type:"install",resourceId:"__project__"},isLoggedIn:w()})&&je()}function Te(){if(!Xe({navigate:a,action:{type:"install",resourceId:"__task__"},isLoggedIn:w()}))return;const t=ht(J());t&&(vt(pt(t)),E(t))}function ze(t){Xe({navigate:a,action:{type:"install",resourceId:"__task__"},isLoggedIn:w()})&&(vt(pt(t)),E(t))}function ke(t){const o=J();return gn(o,t)?!1:Mt(o,t)}function Ae(t){if(!ke(t)){me({title:n.t("dialog.project.upload.failed"),description:n.t("dialog.project.upload.destinationHint"),variant:"error"});return}tt(()=>import("./dialog-project-upload-CkgODEoQ.js"),__vite__mapDeps([0,1,2])).then(o=>{L.show(()=>e(o.DialogProjectUpload,{directory:t}))})}function He(t){tt(()=>import("./index-DSFO1zPs.js").then(o=>o.ed),__vite__mapDeps([1,2])).then(o=>{L.show(()=>e(o.DialogProjectEnvironment,{directory:t}))})}function Se(t){if(Z()!==t.id)return;const o=de();if(!o){a("/workspace");return}a(he(o))}function we(t,o){const[,g]=u.child(t,{bootstrap:!1});g(wn(H=>{const z=$n.search(H.session,o,se=>se.id);if(!z.found)return;const G=H.session[z.index];H.session.splice(z.index,1),G&&!G.parentID&&(H.sessionTotal=Math.max(0,H.sessionTotal-1))}))}async function xe(t){we(t.directory,t.id),Se(t),await h.client.session.update({directory:t.directory,sessionID:t.id,time:{archived:Date.now()}}).then(()=>!0).catch(g=>(me({title:n.t("common.archive"),description:Ge(g,n.t("common.requestFailed"))}),!1))||u.project.loadSessions(t.directory)}async function We(t){return await h.client.session.delete({sessionID:t.id,directory:t.directory}).then(g=>g.data).catch(g=>(me({title:n.t("session.delete.failed.title"),description:Ge(g,n.t("common.requestFailed"))}),!1))?(we(t.directory,t.id),Se(t),!0):!1}function Ce(t){const o=$e(t);L.show(()=>e(ft,{get title(){return n.t("session.delete.title")},fit:!0,get children(){var g=xt(),H=g.firstChild,z=H.nextSibling;return r(H,()=>n.t("session.delete.confirm",{name:o})),r(z,e(Ne,{variant:"ghost",size:"large",onClick:()=>L.close(),get children(){return n.t("common.cancel")}}),null),r(z,e(Ne,{variant:"primary",size:"large",onClick:()=>{We(t).then(G=>{G&&L.close()})},get children(){return n.t("session.delete.button")}}),null),g}}))}function Fe(t){const[o]=u.child(t,{bootstrap:!1});return Ve(o,Date.now(),t).map(g=>({session:g,directory:t}))}function $e(t){const[o]=u.child(t.directory,{bootstrap:!1});return mn({title:t.title,fallbackText:vn(t.id,o.message,o.part),emptyLabel:n.t("command.session.new")})}function Pe(t,o){if(ge(t.directory)===ge(o))return;if(!_e(J(),t.directory)){me({title:n.t("session.move.failed.title"),description:n.t("session.move.failed.onlyDefault")});return}if(_e(J(),o)){me({title:n.t("session.move.failed.title"),description:n.t("session.move.failed.onlyDefault")});return}const g=Be({worktree:o});L.show(()=>e(ft,{get title(){return n.t("session.move.confirm.title")},fit:!0,get children(){var H=xt(),z=H.firstChild,G=z.nextSibling;return r(z,()=>n.t("session.move.confirm.description",{project:g})),r(G,e(Ne,{variant:"ghost",size:"large",onClick:()=>L.close(),get children(){return n.t("common.cancel")}}),null),r(G,e(Ne,{variant:"primary",size:"large",onClick:()=>{Ht(t,o).then(se=>{se&&L.close()})},get children(){return n.t("session.move.confirm.action")}}),null),H}}))}async function Ht(t,o){const g=t.directory;return await h.client.session.update({directory:t.directory,sessionID:t.id,moveTo:o}).then(()=>!0).catch(z=>(me({title:n.t("session.move.failed.title"),description:Ge(z,n.t("common.requestFailed"))}),!1))?(we(g,t.id),P.projects.open(o),A.projects.touchCode(o),u.project.loadSessions(g),u.project.loadSessions(o),Z()===t.id?(a(he(o,t.id)),!0):(me({title:n.t("session.move.success.title"),description:n.t("session.move.success.description",{project:Be({worktree:o})})}),!0)):!1}function Wt(){L.show(()=>e(pn,{tab:"account"}))}return(()=>{var t=pr(),o=t.firstChild,g=o.nextSibling,H=g.firstChild,z=H.firstChild,G=z.nextSibling,se=G.firstChild,Ft=se.firstChild,Nt=Ft.nextSibling,ot=Nt.firstChild,Ot=se.nextSibling,at=G.nextSibling,lt=at.firstChild,Bt=lt.firstChild,qt=Bt.nextSibling,ct=qt.firstChild,Kt=lt.nextSibling,Ut=g.nextSibling,dt=Ut.firstChild,ut=dt.firstChild;return nn(o,rn(()=>m.platform==="desktop"?{"data-tauri-drag-region":!0}:{}),!1,!0),r(o,e(le,{get href(){return an(m.platform)},class:"os-sidebar-brand-link",get children(){return[e(sn,{class:"os-sidebar-brand-mark"}),(()=>{var x=Jn();return r(x,()=>on(m.platform)),x})()]}})),r(z,e(le,{get href(){return ln()},class:"os-sidebar-link",get classList(){return{"is-active":I()}},get children(){return[Qn(),Zn()]}}),null),r(z,e(le,{get href(){return T()},class:"os-sidebar-link",get classList(){return{"is-active":b()}},get children(){return[Yn(),er()]}}),null),r(z,e(le,{get href(){return cn()},class:"os-sidebar-link",get classList(){return{"is-active":k()}},get children(){return[tr(),nr()]}}),null),r(z,e(le,{get href(){return dn()},class:"os-sidebar-link",get classList(){return{"is-active":oe()}},get children(){return[rr(),sr()]}}),null),ot.$$click=be,r(Ot,e(_,{get when(){return ve(()=>!!w())()&&q().length>0},get fallback(){return e(_,{get when(){return w()},get children(){return fr()}})},get children(){return e(pe,{get each(){return q()},children:x=>(()=>{var F=wr(),Y=F.firstChild;return r(Y,e(le,{get href(){return he(x.worktree)},class:"os-client-project-item",get children(){return Be(x)}}),null),r(Y,e($,{get children(){return[e($.Trigger,{type:"button",class:"os-client-project-more",get"aria-label"(){return n.t("common.moreOptions")},onClick:ee=>ee.stopPropagation(),children:"..."}),e($.Portal,{get children(){return e($.Content,{class:Je,get children(){return[e($.Item,{"data-action":"project-new-session",class:"os-client-session-menu-item",onSelect:()=>ze(x.worktree),get children(){return[e(ie,{name:"new-session",size:"small",class:"os-client-session-menu-icon"}),e($.ItemLabel,{class:"os-client-session-menu-label",get children(){return n.t("command.session.new")}})]}}),e(_,{get when(){return ke(x.worktree)},get children(){return e($.Item,{"data-action":"project-upload",class:"os-client-session-menu-item",onSelect:()=>Ae(x.worktree),get children(){return[e(ie,{name:"cloud-upload",size:"small",class:"os-client-session-menu-icon"}),e($.ItemLabel,{class:"os-client-session-menu-label",get children(){return n.t("command.project.upload")}})]}})}}),e($.Item,{"data-action":"project-environment",class:"os-client-session-menu-item",onSelect:()=>He(x.worktree),get children(){return[e(ie,{name:"console",size:"small",class:"os-client-session-menu-icon"}),e($.ItemLabel,{class:"os-client-session-menu-label",get children(){return n.t("sidebar.project.environment")}})]}}),e($.Item,{"data-action":"project-rename",class:"os-client-session-menu-item",onSelect:()=>Me(x),get children(){return[e(ie,{name:"edit",size:"small",class:"os-client-session-menu-icon"}),e($.ItemLabel,{class:"os-client-session-menu-label",get children(){return n.t("common.rename")}})]}}),e($.Separator,{class:"os-client-session-menu-separator"}),e($.Item,{"data-action":"project-remove-from-view",class:"os-client-session-menu-item",onSelect:()=>Re(x),get children(){return[e(ie,{name:"close-small",size:"small",class:"os-client-session-menu-icon"}),e($.ItemLabel,{class:"os-client-session-menu-label",get children(){return n.t("sidebar.project.removeFromView")}})]}})]}})}})]}}),null),r(F,e(_,{get when(){return ue(x)},get children(){var ee=br();return r(ee,e(pe,{get each(){return Fe(x.worktree)},children:R=>(()=>{var O=Ct();return r(O,e(le,{get href(){return he(R.directory,R.session.id)},class:"os-client-task-item",get classList(){return{"is-active":Z()===R.session.id}},get"data-session-id"(){return R.session.id},get children(){var ne=Qe(),Ue=ne.firstChild;return r(Ue,()=>$e(R.session)),ne}}),null),r(O,e($,{get children(){return[e($.Trigger,{type:"button",class:"os-client-session-more",get"aria-label"(){return n.t("common.moreOptions")},onClick:ne=>ne.stopPropagation(),children:"..."}),e($.Portal,{get children(){return e($.Content,{class:Je,get children(){return e(St,{get currentDirectory(){return R.directory},projects:q,onArchive:()=>void xe(R.session),onDelete:()=>Ce(R.session),onMove:ne=>Pe(R.session,ne),onNewProject:be})}})}})]}}),null),N(()=>O.classList.toggle("is-active",Z()===R.session.id)),O})()})),ee}}),null),F})()})}})),r(G,e(_,{get when(){return!w()},get children(){return ir()}}),null),ct.$$click=Te,r(Kt,e(_,{get when(){return ve(()=>!!w())()&&te().length>0},get fallback(){return e(_,{get when(){return w()},get children(){return $r()}})},get children(){return[(()=>{var x=or();return r(x,e(pe,{get each(){return c()},children:F=>(()=>{var Y=Ct();return r(Y,e(le,{get href(){return he(F.directory,F.session.id)},class:"os-client-task-item",get classList(){return{"is-active":Z()===F.session.id}},get"data-session-id"(){return F.session.id},get children(){var ee=Qe(),R=ee.firstChild;return r(R,()=>$e(F.session)),ee}}),null),r(Y,e($,{get children(){return[e($.Trigger,{type:"button",class:"os-client-session-more",get"aria-label"(){return n.t("common.moreOptions")},onClick:ee=>ee.stopPropagation(),children:"..."}),e($.Portal,{get children(){return e($.Content,{class:Je,get children(){return e(St,{get currentDirectory(){return F.directory},projects:q,onArchive:()=>void xe(F.session),onDelete:()=>Ce(F.session),onMove:ee=>Pe(F.session,ee),onNewProject:be})}})}})]}}),null),N(()=>Y.classList.toggle("is-active",Z()===F.session.id)),Y})()})),N(()=>j(x,"data-expanded",V()?"true":"false")),x})(),e(_,{get when(){return M()},get children(){var x=ar();return x.$$click=()=>ae(!0),x}}),e(_,{get when(){return d()},get children(){var x=lr();return x.$$click=()=>ae(!1),x}})]}})),r(at,e(_,{get when(){return!w()},get children(){return cr()}}),null),r(g,e(_,{get when(){return re()},get children(){var x=gr(),F=x.firstChild,Y=F.firstChild,ee=Y.nextSibling;return F.$$click=()=>C(R=>!R),r(ee,()=>n.t("sidebar.section.sharedCases")),r(x,e(_,{get when(){return S()},get children(){var R=hr();return r(R,e(_,{get when(){return v().length>0},get fallback(){return _r()},get children(){return e(pe,{get each(){return v()},children:O=>e(le,{get href(){return he(re(),O.id)},class:"os-client-task-item",get classList(){return{"is-active":Z()===O.id}},get"data-session-id"(){return O.id},get children(){var ne=Qe(),Ue=ne.firstChild;return r(Ue,()=>un(O.title)??O.id),ne}})})}}),null),r(R,e(_,{get when(){return p()},get children(){var O=dr();return O.$$click=()=>U(!0),O}}),null),r(R,e(_,{get when(){return s()},get children(){var O=ur();return O.$$click=()=>U(!1),O}}),null),R}}),null),N(R=>{var O=S(),ne=S()?"true":"false";return O!==R.e&&j(F,"aria-expanded",R.e=O),ne!==R.t&&j(Y,"data-open",R.t=ne),R},{e:void 0,t:void 0}),x}}),null),r(dt,e(le,{get href(){return hn()},class:"os-sidebar-footer-action",get classList(){return{"is-active":X()}},get children(){return[mr(),vr()]}}),ut),ut.$$click=Wt,N(x=>{var F=!w(),Y=!w();return F!==x.e&&ot.classList.toggle("is-muted",x.e=F),Y!==x.t&&ct.classList.toggle("is-muted",x.t=Y),x},{e:void 0,t:void 0}),t})()}ye(["click"]);var kr=i('<pre class="os-client-right-files-preview whitespace-pre-wrap break-all p-3 text-12-regular m-0">'),Sr=i("<button type=button class=os-client-right-files-back>← 返回目录"),xr=i("<span class=os-client-right-files-title>"),Cr=i("<button type=button>"),Pr=i("<div class=os-client-right-files-actions><button type=button>关闭"),Lr=i("<p class=os-client-right-files-hint>正在加载目录…"),Er=i("<p class=os-client-right-files-hint>该目录为空"),Dr=i("<div class=os-client-right-files-tree><p class=os-client-right-files-root></p><div class=os-client-right-files-tree-scroll>"),Ir=i("<div class=os-client-right-files-unsaved>"),Mr=i("<p class=os-client-right-files-hint>…"),Rr=i("<textarea class=os-client-right-files-textarea autocapitalize=off autocomplete=off autocorrect=off>"),jr=i("<pre class=os-client-right-files-preview>"),Tr=i("<div class=os-client-right-files-editor>"),zr=i("<section class=os-client-right-files><header class=os-client-right-files-header>"),Ar=i("<strong>目录"),Hr=i("<div class=os-client-right-files-actions><button type=button aria-label=刷新>刷新</button><button type=button>关闭"),Wr=i("<p class=os-client-right-files-hint>加载失败:"),Fr=i("<p class=os-client-right-files-hint>");function Nr(l){const a=l.replace(/\\/g,"/").split("/");return a[a.length-1]||l}function Or(l){const a=yn(),n=kn(),P=Ie(),[u,h]=W("tree"),[m,A]=W(),[L,w]=W(""),[I,T]=W(!1),[b,k]=W(!1),[oe,X]=W(0);let S;const C=y(()=>a.tree.state("")),D=y(()=>a.tree.children("")),U=y(()=>Sn(m())),V=(d=!1)=>{n.directory&&(d?a.tree.refresh(""):a.tree.list(""))};Ke(()=>{queueMicrotask(()=>V(!0))}),K(()=>{if(!n.directory||u()!=="tree")return;const f=C();f?.loading||f?.loaded||f?.error||a.tree.list("")});const ae=y(()=>{const d=m();if(d)return a.get(d)}),Q=y(()=>ae()?.content?.content??""),q=y(()=>!!ae()?.loaded),fe=y(()=>!!ae()?.loading),re=y(()=>ae()?.error),de=y(()=>{const d=ae();return!(!d?.loaded||d.content?.type!=="text"||d.content.encoding==="base64"||bt(m()))}),Z=y(()=>de()&&U()==="text"),ue=y(()=>{if(!(!de()||Z()))return{draft:L,setDraft:d=>{w(d),T(!0)},textareaRef:d=>{S=d},class:"os-client-right-files-textarea"}}),te=d=>(()=>{var f=kr();return r(f,d),f})();K(()=>{const d=m();d&&a.load(d)}),K(Rt(m,()=>{T(!1),w(q()?Q():""),X(0)},{defer:!1})),K(()=>{!q()||I()||w(Q())});const c=async()=>{const d=m();if(!(!d||b()||!I()||!de())){k(!0);try{await a.write(d,L()),T(!1),wt(d)&&X(f=>f+1)}finally{k(!1)}}};K(()=>{if(typeof window>"u")return;xn(window,"keydown",f=>{!(f.metaKey||f.ctrlKey)||f.key.toLowerCase()!=="s"||!S?.contains(document.activeElement)&&document.activeElement!==S||(f.preventDefault(),c())})});const M=d=>{A(d),h("editor")};return(()=>{var d=zr(),f=d.firstChild;return r(f,e(_,{get when(){return u()==="editor"},get fallback(){return[Ar(),(()=>{var v=Hr(),p=v.firstChild,s=p.nextSibling;return p.$$click=()=>{V(!0),a.tree.refreshAll()},nt(s,"click",l.onClose,!0),v})()]},get children(){return[(()=>{var v=Sr();return v.$$click=()=>h("tree"),v})(),(()=>{var v=xr();return r(v,(()=>{var p=ve(()=>!!m());return()=>p()?Nr(m()):""})()),N(()=>j(v,"title",m())),v})(),(()=>{var v=Pr(),p=v.firstChild;return r(v,e(_,{get when(){return de()},get children(){var s=Cr();return s.$$click=()=>void c(),r(s,(()=>{var E=ve(()=>!!b());return()=>E()?P.t("common.saving"):P.t("common.save")})()),N(()=>s.disabled=!I()||b()),s}}),p),nt(p,"click",l.onClose,!0),v})()]}})),r(d,e(_,{get when(){return u()==="tree"},get children(){var v=Dr(),p=v.firstChild,s=p.nextSibling;return r(p,()=>n.directory),r(v,e(_,{get when(){return ve(()=>!!C()?.loading)()&&D().length===0},get children(){return Lr()}}),s),r(v,e(_,{get when(){return C()?.error},children:E=>(()=>{var B=Wr();return B.firstChild,r(B,E,null),B})()}),s),r(v,e(_,{get when(){return ve(()=>!!(C()?.loaded&&D().length===0))()&&!C()?.error},get children(){return Er()}}),s),r(s,e(Cn,{path:"",class:"os-client-right-file-tree",nodeClass:"os-client-right-file-node",get active(){return m()},draggable:!1,onFileClick:E=>M(E.path)})),N(()=>j(p,"title",n.directory)),v}}),null),r(d,e(_,{get when(){return u()==="editor"},get children(){var v=Tr();return r(v,e(_,{get when(){return I()},get children(){var p=Ir();return r(p,()=>P.t("session.file.unsaved")),p}}),null),r(v,e(_,{get when(){return ve(()=>!!fe())()&&!q()},get children(){var p=Mr(),s=p.firstChild;return r(p,()=>P.t("common.loading"),s),p}}),null),r(v,e(_,{get when(){return re()},children:p=>(()=>{var s=Fr();return r(s,p),s})()}),null),r(v,e(_,{get when(){return q()},get children(){return e(jt,{get children(){return[e(ce,{get when(){return wt(m())},get children(){return e(Pn,{path:m,contents:Q,renderSource:te,get editSource(){return ue()},previewRevision:oe,chrome:"workbench"})}}),e(ce,{get when(){return U()==="markdown"},get children(){return e(Ln,{path:m,contents:Q,renderSource:te,get editSource(){return ue()},chrome:"workbench"})}}),e(ce,{get when(){return U()==="csv"},get children(){return e(En,{path:m,contents:Q,renderSource:te,get editSource(){return ue()},chrome:"workbench"})}}),e(ce,{get when(){return bt(m())},get children(){return e(Dn,{path:m,chrome:"workbench"})}}),e(ce,{get when(){return Mn(m())},get children(){return e(In,{path:m,contents:Q,renderSource:te,get editSource(){return ue()},chrome:"workbench"})}}),e(ce,{get when(){return Z()},get children(){var p=Rr();p.$$input=E=>{w(E.currentTarget.value),T(!0)};var s=S;return typeof s=="function"?qe(s,p):S=p,j(p,"spellcheck",!1),N(()=>p.value=L()),p}}),e(ce,{when:!0,get children(){var p=jr();return r(p,()=>Q()||"(二进制或不支持预览的文件)"),p}})]}})}}),null),v}}),null),N(()=>j(d,"data-view",u())),d})()}ye(["click","input"]);var Br=i('<svg viewBox="0 0 12 12"width=12 height=12 fill=currentColor aria-hidden=true><circle cx=6 cy=6 r=3 class=os-client-right-todo-pulse>'),qr=i("<ul class=os-client-right-todo-list>"),Kr=i("<span class=os-client-right-todo-text>"),Ur=i("<li class=os-client-right-todo-item>"),Vr=i("<p class=os-client-right-todo-progress>已完成 <!> / "),Xr=i("<section class=os-client-right-todo><header class=os-client-right-todo-header><strong></strong><button type=button>关闭"),Gr=i("<p class=os-client-right-todo-empty>暂无场景工作流。从能力中心场景创建任务后,步骤会显示在这里。"),Jr=i("<span class=os-client-right-todo-stop> · ");function Qr(l){return l==="completed"?"completed":l==="in_progress"?"in_progress":l==="failed"?"cancelled":"pending"}function Zr(l){if(l==="in_progress")return Br()}function Yr(l){return(()=>{var a=qr();return r(a,e(pe,{get each(){return l.items},children:n=>(()=>{var P=Ur();return r(P,e(Tn,{readOnly:!0,get checked(){return n.status==="completed"},get indeterminate(){return n.status==="in_progress"},get icon(){return Zr(n.status)},get children(){var u=Kr();return r(u,()=>n.content),N(h=>{var m=n.status==="completed"||n.status==="cancelled",A=n.status==="pending";return m!==h.e&&u.classList.toggle("is-done",h.e=m),A!==h.t&&u.classList.toggle("is-pending",h.t=A),h},{e:void 0,t:void 0}),u}})),N(()=>j(P,"data-state",n.status)),P})()})),a})()}function es(l){Rn();const a=y(()=>jn(l.directoryKey)),n=y(()=>{const h=a();return h?.steps.length?h.steps.map(m=>({content:m.name,status:Qr(m.status)})):[]}),P=y(()=>n().filter(h=>h.status==="completed").length),u=y(()=>a()?.title||"待办");return(()=>{var h=Xr(),m=h.firstChild,A=m.firstChild,L=A.nextSibling;return r(A,u),nt(L,"click",l.onClose,!0),r(h,e(_,{get when(){return n().length>0},get fallback(){return Gr()},get children(){return[(()=>{var w=Vr(),I=w.firstChild,T=I.nextSibling;return T.nextSibling,r(w,P,T),r(w,()=>n().length,null),r(w,e(_,{get when(){return a()?.stopReason},children:b=>(()=>{var k=Jr();return k.firstChild,r(k,b,null),k})()}),null),w})(),e(Yr,{get items(){return n()}})]}}),null),N(()=>j(A,"title",u())),h})()}ye(["click"]);var ts=i("<div class=os-client-right-add-dropdown role=menu>"),ns=i('<aside class="os-client-right-sidebar os-client-right-dock"><div class=os-client-right-toolbar><div class=os-client-right-add-menu><button type=button class=os-client-right-add-button aria-label=打开页面><span class=os-client-right-add-icon aria-hidden=true></span></button></div></div><div class=os-client-right-dock-body>'),rs=i("<button type=button role=menuitem>"),ss=i("<section class=os-client-right-empty><strong>尚未打开页面</strong><p>点击 + 打开目录、可视化组件或待办;在会话中可从目录点文件到右侧编辑。"),is=i("<section class=os-client-right-pane-stub><header><strong>可视化组件</strong><button type=button>关闭</button></header><p>请从「目录」中打开 `.html` / `.md` / `.csv` / `.pdf` / `.xyz` 文件查看可视化预览;后续版本将提供独立可视化入口。"),os=i("<section class=os-client-right-pane-stub><header><strong>目录</strong><button type=button>关闭</button></header><p>请先打开项目或任务后再查看目录。"),as=i("<section class=os-client-right-pane-stub><header><strong>待办</strong><button type=button>关闭</button></header><p>请先打开项目或任务后再查看待办。");const ls=[{id:"directory",label:"目录"},{id:"viz",label:"可视化组件"},{id:"todo",label:"待办"}];function cs(){const l=rt(),[a,n]=W(!1),[P,u]=W();let h;const m=y(()=>Tt(l.pathname)),A=y(()=>{const I=m()?.dir;return I?it(I)??"":""}),L=y(()=>zt(l.pathname)&&!!A());Ke(()=>{const I=T=>{a()&&(h?.contains(T.target)||n(!1))};document.addEventListener("pointerdown",I),De(()=>document.removeEventListener("pointerdown",I))}),K(()=>{if(!At())return;const T=zn();T&&(u(T),n(!1))});const w=I=>{u(I),n(!1)};return(()=>{var I=ns(),T=I.firstChild,b=T.firstChild,k=b.firstChild,oe=T.nextSibling,X=h;return typeof X=="function"?qe(X,T):h=T,k.$$click=()=>n(S=>!S),r(b,e(_,{get when(){return a()},get children(){var S=ts();return r(S,e(pe,{get each(){return[...ls]},children:C=>(()=>{var D=rs();return D.$$click=()=>w(C.id),r(D,()=>C.label),D})()})),S}}),null),r(oe,e(_,{get when(){return P()},get fallback(){return ss()},children:S=>e(jt,{get children(){return[e(ce,{get when(){return S()==="directory"},get children(){return e(_,{get when(){return L()},get fallback(){return(()=>{var C=os(),D=C.firstChild,U=D.firstChild,V=U.nextSibling;return V.$$click=()=>u(void 0),C})()},get children(){return e(An,{params:()=>({dir:m().dir,id:m()?.id}),get children(){return e(Hn,{directory:()=>A(),get children(){return e(Wn,{get children(){return e(Fn,{get children(){return e(Or,{onClose:()=>u(void 0)})}})}})}})}})}})}}),e(ce,{get when(){return S()==="todo"},get children(){return e(_,{get when(){return m()?.dir},get fallback(){return(()=>{var C=as(),D=C.firstChild,U=D.firstChild,V=U.nextSibling;return V.$$click=()=>u(void 0),C})()},children:C=>e(es,{get directoryKey(){return C()},get sessionID(){return m()?.id},onClose:()=>u(void 0)})})}}),e(ce,{get when(){return S()==="viz"},get children(){var C=is(),D=C.firstChild,U=D.firstChild,V=U.nextSibling;return V.$$click=()=>u(void 0),C}})]}})})),N(S=>{var C=!!a(),D=a();return C!==S.e&&k.classList.toggle("is-open",S.e=C),D!==S.t&&j(k,"aria-expanded",S.t=D),S},{e:void 0,t:void 0}),I})()}ye(["click"]);var ds=i('<button type=button class="os-client-panel-toggle os-client-terminal-toggle"aria-controls=terminal-panel>'),us=i('<svg class=os-client-pane-toggle-icon viewBox="0 0 24 24"aria-hidden=true><rect x=4.5 y=5.5 width=15 height=13 rx=1.35 fill=none stroke=currentColor stroke-width=1.4></rect><path d="M8 10.25l2.4 2.25L8 14.75M12.25 14.75H16"fill=none stroke=currentColor stroke-width=1.4 stroke-linecap=round stroke-linejoin=round>');function hs(){const l=rt(),a=st(),n=Ie(),P=Nn(),u=Dt(),[h,m]=W(J()),A=y(()=>It(l.pathname)||zt(l.pathname)),L=y(()=>!A()||On()&&!h()?!1:a.terminal.enabled()?!0:$t(h())),w=y(()=>a.view("workbench").terminal.opened()),I=y(()=>{const b=Tt(l.pathname);return b?.dir?it(b.dir)??"":""});Ke(()=>{const b=()=>m(J());window.addEventListener(_t,b),window.addEventListener(yt,b),window.addEventListener("storage",b),De(()=>{window.removeEventListener(_t,b),window.removeEventListener(yt,b),window.removeEventListener("storage",b)})}),K(()=>{L()&&kt()}),K(Rt(A,(b,k)=>{k===void 0||b||!k||w()&&(a.view("workbench").terminal.close(),a.terminal.closeFullscreen())}));const T=()=>{if($t(h())||!a.terminal.enabled()){tt(()=>import("./dialog-terminal-unavailable-BJfv1EHP.js"),__vite__mapDeps([3,1,2])).then(b=>{u.show(()=>e(b.DialogTerminalUnavailable,{}))});return}if(!w()){const b=I();if(b&&!Mt(h(),b))return;kt()}a.view("workbench").terminal.toggle()};return e(_,{get when(){return L()},get children(){var b=ds();return b.$$click=k=>k.preventDefault(),b.$$pointerdown=k=>{k.button===0&&(k.preventDefault(),T())},r(b,e(gs,{get active(){return w()}})),N(k=>{var oe=!!w(),X=n.t("command.terminal.toggle"),S=n.t("command.terminal.toggle"),C=w(),D=`${n.t("command.terminal.toggle")} (${P.keybind("terminal.toggle")})`;return oe!==k.e&&b.classList.toggle("is-active",k.e=oe),X!==k.t&&j(b,"data-tooltip",k.t=X),S!==k.a&&j(b,"aria-label",k.a=S),C!==k.o&&j(b,"aria-expanded",k.o=C),D!==k.i&&j(b,"title",k.i=D),k},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),b}})}function gs(l){return(()=>{var a=us(),n=a.firstChild,P=n.nextSibling;return N(()=>j(P,"opacity",l.active?1:.85)),a})()}ye(["pointerdown","click"]);var ms=i('<svg class=os-client-pane-toggle-icon viewBox="0 0 24 24"aria-hidden=true><rect class=os-client-pane-toggle-icon-main x=4.5 y=5.5 width=7.7 height=13 rx=1.35></rect><rect class=os-client-pane-toggle-icon-divider x=12.15 y=5.5 width=1.15 height=13 rx=0.55></rect><rect class=os-client-pane-toggle-icon-side x=14.05 y=5.5 width=5.45 height=13 rx=1.35>'),vs=i('<div class="os-client-pane-resizer os-client-pane-resizer-sidebar"role=separator aria-orientation=vertical aria-label=调整左边栏宽度 aria-valuemin=230 aria-valuemax=430 tabindex=0>'),ps=i('<div class="os-client-pane-resizer os-client-pane-resizer-tool"role=separator aria-orientation=vertical aria-label=调整右边栏宽度 aria-valuemin=200 aria-valuemax=1280 tabindex=0>'),fs=i("<main class=os-client-workbench><div class=os-client-workbench-chrome><button type=button class=os-client-panel-toggle></button><button type=button class=os-client-panel-toggle></button></div><section class=os-workspace-main></section><div class=os-client-terminal-dock>");const Ee=320,bs=230,ws=430,$s=200,Lt=1280;function Et(l){return(()=>{var a=ms();return N(n=>{var P=l.side,u=l.open?"true":"false";return P!==n.e&&j(a,"data-side",n.e=P),u!==n.t&&j(a,"data-open",n.t=u),n},{e:void 0,t:void 0}),a})()}function Ye(l){return Math.min(ws,Math.max(bs,Math.round(l)))}function et(l){const a=typeof window>"u"?Lt:Math.min(Lt,Math.floor(window.innerWidth*.85));return Math.min(a,Math.max($s,Math.round(l)))}function Ss(l){const a=st(),[n,P]=W(!0),[u,h]=W(!1),[m,A]=W(Ee),[L,w]=W(Ee),[I,T]=W(!1),[b,k]=W(!1),[oe,X]=W(0),[S,C]=W({left:0,right:0}),[D,U]=W(),[V,ae]=W(),Q=y(()=>a.view("workbench").terminal.opened()),q=()=>Q(),fe=y(()=>{if(!Q())return 0;const c=oe();return c>0?c:a.terminal.height()}),re=()=>{const c=D();if(!c)return;const M=c.querySelector(":scope > .os-workspace-main");if(!M)return;const d=c.getBoundingClientRect(),f=getComputedStyle(c),v=d.left+(parseFloat(f.borderLeftWidth)||0),p=d.right-(parseFloat(f.borderRightWidth)||0),s=M.getBoundingClientRect(),B=c.querySelector(":scope > .os-client-right-sidebar")?.getBoundingClientRect()??s;C({left:Math.max(0,Math.round(s.left-v)),right:Math.max(0,Math.round(p-B.right))})},de=()=>{P(c=>(c||A(Ee),!c))},Z=()=>{h(c=>(c||w(Ee),!c))};K(()=>{At()&&(h(!0),w(M=>M>0?M:Ee))});const ue=c=>{if(c.button!==0)return;c.preventDefault();const M=c.clientX,d=m();T(!0);const f=p=>{A(Ye(d+(p.clientX-M)))},v=()=>{T(!1),window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v)};window.addEventListener("pointermove",f),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v)},te=c=>{if(c.button!==0)return;c.preventDefault();const M=c.clientX,d=L();k(!0);const f=p=>{w(et(d+(M-p.clientX)))},v=()=>{k(!1),window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v)};window.addEventListener("pointermove",f),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v)};return K(()=>{const c=V();if(!c||typeof ResizeObserver>"u")return;const M=()=>{const f=c.querySelector("#terminal-panel");X(f?Math.round(f.getBoundingClientRect().height):0)};M();const d=new ResizeObserver(M);d.observe(c),De(()=>d.disconnect())}),K(()=>{Q()||X(0)}),Ke(()=>{a.view("workbench").terminal.close(),a.terminal.closeFullscreen(),X(0)}),K(()=>{n(),u(),m(),L(),I(),b(),q(),D(),re();const c=requestAnimationFrame(re);De(()=>cancelAnimationFrame(c))}),K(()=>{const c=D();if(!c||typeof ResizeObserver>"u")return;const M=new ResizeObserver(()=>re());M.observe(c);const d=c.querySelector(":scope > .os-workspace-main");d&&M.observe(d);const f=c.querySelector(":scope > .os-client-right-sidebar");f&&M.observe(f),De(()=>M.disconnect())}),(()=>{var c=fs(),M=c.firstChild,d=M.firstChild,f=d.nextSibling,v=M.nextSibling,p=v.nextSibling;return qe(U,c),d.$$click=de,r(d,e(Et,{side:"left",get open(){return n()}})),r(M,e(hs,{}),f),f.$$click=Z,r(f,e(Et,{side:"right",get open(){return u()}})),r(c,e(_,{get when(){return n()},get children(){return[e(yr,{}),(()=>{var s=vs();return s.$$keydown=E=>{if(E.key==="ArrowLeft"){E.preventDefault(),A(B=>Ye(B-16));return}E.key==="ArrowRight"&&(E.preventDefault(),A(B=>Ye(B+16)))},s.$$pointerdown=ue,N(()=>j(s,"aria-valuenow",m())),s})()]}}),v),r(v,()=>l.children),r(c,e(_,{get when(){return u()},get children(){return[(()=>{var s=ps();return s.$$keydown=E=>{if(E.key==="ArrowLeft"){E.preventDefault(),w(B=>et(B+16));return}E.key==="ArrowRight"&&(E.preventDefault(),w(B=>et(B-16)))},s.$$pointerdown=te,N(()=>j(s,"aria-valuenow",L())),s})(),e(cs,{})]}}),p),qe(ae,p),j(p,"id",Bn),N(s=>{var E=!!n(),B=!!u(),Me=!!I(),Re=!!b(),je=!!q(),be=!!(a.terminal.fullscreen()&&a.view("workbench").terminal.opened()),Te=`${m()}px`,ze=`${L()}px`,ke=`${fe()}px`,Ae=`${S().left}px`,He=`${S().right}px`,Se=!!n(),we=n()?"关闭左侧栏":"打开左侧栏",xe=n()?"关闭左侧栏":"打开左侧栏",We=!!u(),Ce=u()?"关闭右侧栏":"打开右侧栏",Fe=u()?"关闭右侧栏":"打开右侧栏",$e=!!q(),Pe=!q();return E!==s.e&&c.classList.toggle("has-left-sidebar",s.e=E),B!==s.t&&c.classList.toggle("has-right-sidebar",s.t=B),Me!==s.a&&c.classList.toggle("is-resizing-left",s.a=Me),Re!==s.o&&c.classList.toggle("is-resizing-right",s.o=Re),je!==s.i&&c.classList.toggle("has-terminal-open",s.i=je),be!==s.n&&c.classList.toggle("has-terminal-fullscreen",s.n=be),Te!==s.s&&Le(c,"--os-client-sidebar-w",s.s=Te),ze!==s.h&&Le(c,"--os-client-tool-w",s.h=ze),ke!==s.r&&Le(c,"--os-client-terminal-h",s.r=ke),Ae!==s.d&&Le(c,"--os-client-terminal-left",s.d=Ae),He!==s.l&&Le(c,"--os-client-terminal-right",s.l=He),Se!==s.u&&d.classList.toggle("is-active",s.u=Se),we!==s.c&&j(d,"data-tooltip",s.c=we),xe!==s.w&&j(d,"aria-label",s.w=xe),We!==s.m&&f.classList.toggle("is-active",s.m=We),Ce!==s.f&&j(f,"data-tooltip",s.f=Ce),Fe!==s.y&&j(f,"aria-label",s.y=Fe),$e!==s.g&&p.classList.toggle("is-open",s.g=$e),Pe!==s.p&&j(p,"aria-hidden",s.p=Pe),s},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0,y:void 0,g:void 0,p:void 0}),c})()}ye(["click","pointerdown","keydown"]);export{Ss as WorkbenchShell};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as q,f as D,l as I,n as E,o as g,ag as O,i as a,c as o,t as v,di as u,b as B,s as _,b6 as H,r as N,aT as y,aM as C,aL as L,aB as Q,L as z,O as T,S as G,Q as J,T as K,F as V,R as X,dj as Y}from"./index-DSFO1zPs.js";var Z=v("<p class=os-client-skills-login-hint>登录后可同步个人空间技能。 "),ee=v('<div class="os-client-capability-page os-client-skills-page"><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-skills-tabs"role=tablist aria-label=技能管理视图></div></section><div class=os-client-capability-page-body>'),te=v("<button type=button><strong></strong><small>");function ae(c){const s=new URLSearchParams(c).get("tab");if(s==="list"||s==="repo"||s==="upload")return s}function ne(){const c=q(),s=D(),A=I(),[b,P]=E(0),R=g(()=>(b(),!!_())),d=g(()=>!R()),[n,x]=E(ae(c.search)??"list"),M=g(()=>{b();const e=_();return e&&(H(e,A.projects.lastCode())||N(e))||""}),p=e=>{x(e),s(T(e),{replace:!0})};O(()=>{const e=()=>P(i=>i+1);window.addEventListener(y,e),window.addEventListener(C,e),window.addEventListener(L,e),Q(()=>{window.removeEventListener(y,e),window.removeEventListener(C,e),window.removeEventListener(L,e)})});const h=()=>u.find(e=>e.id===n())??u[0];return(()=>{var e=ee(),i=e.firstChild,f=i.firstChild,j=f.firstChild,m=j.nextSibling,F=m.nextSibling,w=f.nextSibling,U=i.nextSibling;return a(m,()=>h().label),a(F,()=>h().hint),a(i,o(G,{get when(){return d()},get children(){var t=Z();return t.firstChild,a(t,o(z,{get href(){return`/login?redirect=${encodeURIComponent(T(n()))}`},children:"去登录"}),null),t}}),w),a(w,o(V,{each:u,children:t=>(()=>{var r=te(),S=r.firstChild,W=S.nextSibling;return r.$$click=()=>p(t.id),a(S,()=>t.label),a(W,()=>t.hint),J(l=>{var $=n()===t.id,k=n()===t.id;return $!==l.e&&r.classList.toggle("is-active",l.e=$),k!==l.t&&K(r,"aria-pressed",l.t=k),l},{e:void 0,t:void 0}),r})()})),a(U,o(Y,{get directory(){return X(()=>!!d())()?void 0:M()||void 0},get loginRequired(){return d()},get tab(){return n()},onTabChange:p,variant:"page-body"})),e})()}B(["click"]);export{ne as WorkbenchSkillsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/assets/staplebops-03-Aug82oH0.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/assets/staplebops-04-olyHi8qQ.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/assets/staplebops-06-Cj_2vOI4.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/assets/staplebops-07-cqQEvbIf.aac";export{e as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DSFO1zPs.js","assets/index-DgFAbOBA.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{e0 as V,h as X,j as Y,b$ as z,m as Z,f as ee,u as H,aB as K,n as te,x as ae,e3 as se,e4 as Q,e5 as ne,e6 as re,o as O,e7 as le,i as a,c as s,e8 as b,S as _,F as A,dq as oe,R as T,Q as G,bI as ce,a4 as w,e9 as ie,T as ue,ae as de,dk as ge,dn as pe,_ as he,p as ve,t as u,P as be,$ as me,b as fe}from"./index-DSFO1zPs.js";var xe=u("<div class=os-ssh-dialog-stack>"),I=u('<div class="flex flex-col px-2 pb-2"><div class="flex flex-col p-3 bg-background-base rounded-sm min-h-14 gap-2"><div class="flex flex-wrap gap-2 pt-1">'),ye=u('<div class="flex items-center gap-1 w-[360px] rounded-xl shadow-[var(--shadow-lg-border-base)]">'),N=u('<div class="text-14-regular text-text-base text-center my-auto py-2">'),_e=u('<button type=button class="flex items-center gap-2 w-full h-8 pl-3 pr-2 py-1 rounded-md hover:bg-surface-raised-base-hover transition-colors text-left"><div></div><span class="text-14-regular text-text-base truncate flex-1"></span><div>'),$e=u('<span class="text-11-regular text-text-weaker shrink-0">· 检测中...'),ke=u('<span class="text-12-regular text-text-weak truncate pl-3.5">'),Se=u('<button type=button class="flex flex-col gap-0.5 w-full px-3 py-1.5 rounded-md hover:bg-surface-raised-base-hover transition-colors text-left"><div class="flex items-center gap-2 min-w-0"><span class="os-ssh-connectivity-dot shrink-0"aria-hidden=true></span><span class="text-14-regular text-text-base truncate"></span><span class="text-11-regular text-text-weaker shrink-0">'),we=u('<span class="text-11-regular text-text-weaker shrink-0">· ');const Ce=()=>{const $=V(),m=de(),f=H(),k=z(),C=ge();return pe(()=>({mutationFn:async i=>{await($.data.mcp[i]?.status==="connected"?m.client.mcp.disconnect({name:i}):m.client.mcp.connect({name:i}))},onSuccess:()=>k.refetchQueries(C.mcp(ve($.directory))),onError:i=>{he({variant:"error",title:f.t("common.requestFailed"),description:i instanceof Error?i.message:String(i)})}}))};function De($){const m=V(),f=X(),k=Y(),C=z(),i=Z(),E=ee(),o=H();let M=0,F=!1;K(()=>{F=!0,M+=1});const[R,L]=te();ae(()=>{if(!$.shown()){L(void 0);return}let r=!1;const e=Q();(async()=>{const t=await se(k.url);r||e!==Q()||t===void 0||(L(t),ne(t),await re({serverUrl:k.url,queryClient:C}).catch(()=>{}))})(),K(()=>{r=!0})});const d=Ce(),j=O(()=>{const r=new Set([...Object.keys(f.data.config.mcp??{}),...Object.keys(m.data.mcp??{})]);return Array.from(r).sort((e,t)=>e.localeCompare(t))}),U=r=>m.data.mcp?.[r]?.status,q=O(()=>{const r=R()??f.data.config.ssh??{};return Object.entries(r).map(([e,t])=>({name:e,config:t})).filter(e=>!!e.config&&typeof e.config=="object"&&"host"in e.config).sort((e,t)=>e.name.localeCompare(t.name))}),J=O(()=>R()??f.data.config.ssh),D=le({ssh:J}),P=r=>{const e=++M;me(()=>import("./index-DSFO1zPs.js").then(t=>t.eb),__vite__mapDeps([0,1])).then(t=>{F||M!==e||i.show(()=>(()=>{var c=xe();return a(c,s(t.DialogSelectSsh,{initialMode:r})),c})())})},B=r=>{E(be("mcp",r))};return(()=>{var r=ye();return a(r,s(b,{get"aria-label"(){return o.t("status.popover.ariaLabel")},class:"tabs bg-background-strong rounded-xl overflow-hidden","data-component":"tabs","data-active":"mcp",defaultValue:"mcp",variant:"alt",get children(){return[s(b.List,{"data-slot":"tablist",class:"bg-transparent border-b-0 px-4 pt-2 pb-0 gap-3 h-10",get children(){return[s(b.Trigger,{value:"mcp","data-slot":"tab",class:"text-12-regular",get children(){return o.t("status.popover.tab.mcp")}}),s(b.Trigger,{value:"ssh","data-slot":"tab",class:"text-12-regular",get children(){return o.t("status.popover.tab.ssh")}})]}}),s(b.Content,{value:"mcp",get children(){var e=I(),t=e.firstChild,c=t.firstChild;return a(t,s(_,{get when(){return j().length>0},get fallback(){return(()=>{var n=N();return a(n,()=>o.t("dialog.mcp.empty")),n})()},get children(){return s(A,{get each(){return j()},children:n=>{const h=()=>U(n),g=()=>h()==="connected";return(()=>{var p=_e(),x=p.firstChild,y=x.nextSibling,S=y.nextSibling;return p.$$click=()=>{d.isPending||d.mutate(n)},a(y,n),S.$$click=l=>l.stopPropagation(),a(S,s(oe,{get checked(){return g()},get disabled(){return T(()=>!!d.isPending)()&&d.variables===n},onChange:()=>{d.isPending||d.mutate(n)}})),G(l=>{var v=d.isPending&&d.variables===n,W={"size-2 rounded-full shrink-0":!0,"bg-icon-success-base":g(),"bg-border-weak-base":!g()};return v!==l.e&&(p.disabled=l.e=v),l.t=ce(x,W,l.t),l},{e:void 0,t:void 0}),p})()}})}}),c),a(c,s(w,{variant:"secondary",class:"h-8 px-3 py-1.5",onClick:()=>B(),get children(){return o.t("status.popover.action.manageMcp")}}),null),a(c,s(w,{variant:"secondary",icon:"plus-small",class:"h-8 px-3 py-1.5",onClick:()=>B("add"),get children(){return o.t("dialog.mcp.addButton")}}),null),e}}),s(b.Content,{value:"ssh",get children(){var e=I(),t=e.firstChild,c=t.firstChild;return a(t,s(_,{get when(){return q().length>0},get fallback(){return(()=>{var n=N();return a(n,()=>o.t("dialog.ssh.empty")),n})()},get children(){return s(A,{get each(){return q()},children:n=>{const h=()=>D.byName()[n.name];return(()=>{var g=Se(),p=g.firstChild,x=p.firstChild,y=x.nextSibling,S=y.nextSibling;return g.$$click=()=>P(),a(y,()=>n.name),a(S,(()=>{var l=T(()=>n.config.enabled===!1);return()=>l()?o.t("dialog.ssh.status.disabled"):o.t("dialog.ssh.status.enabled")})()),a(p,s(_,{get when(){return h()},children:l=>(()=>{var v=we();return v.firstChild,a(v,()=>ie(l().connectivity),null),v})()}),null),a(p,s(_,{get when(){return T(()=>!!D.loading())()&&!h()},get children(){return $e()}}),null),a(g,s(_,{get when(){return n.config.remotePath},get children(){var l=ke();return a(l,()=>n.config.remotePath),l}}),null),G(()=>ue(x,"data-state",D.loading()&&!h()?"testing":h()?.connectivity??"idle")),g})()}})}}),c),a(c,s(w,{variant:"secondary",class:"h-8 px-3 py-1.5",onClick:()=>P(),get children(){return o.t("status.popover.action.manageSsh")}}),null),a(c,s(w,{variant:"secondary",icon:"plus-small",class:"h-8 px-3 py-1.5",onClick:()=>P("add"),get children(){return o.t("dialog.ssh.addButton")}}),null),e}})]}})),r})()}fe(["click"]);export{De as StatusPopoverBody};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as Ge,m as Je,be as Ne,d1 as He,x as et,o as W,d2 as tt,d3 as xe,d4 as ze,d5 as Me,d6 as oe,d7 as it,d8 as at,ak as _e,i as t,c as a,S as g,Q as f,F as U,T as A,R as Oe,d9 as lt,da as Ee,db as rt,t as l,dc as nt,c_ as st,e as ct,dd as ot,f as dt,h as ut,g as pt,l as gt,n as ht,ag as bt,X as Ie,aQ as Pe,r as Le,s as fe,aS as Fe,Z as Te,b3 as je,Y as Re,_ as We,E as qe,de as $t,df as vt,dg as _t,b1 as Qe,bl as Be,dh as mt,bj as ft,L as Y,bK as Ue,c$ as yt,bm as St,d0 as wt,aR as Ct}from"./index-DSFO1zPs.js";var xt=l("<div class=os-client-capability-wizard-papers><h3>HPC 软件</h3><span>"),zt=l("<div class=os-client-capability-wizard-papers><h3>相关论文"),kt=l("<p class=os-client-capability-wizard-note>工作目录与运行环境由系统自动识别,本步只需填写下列业务参数。"),It=l("<p class=os-client-capability-wizard-missing>本步还有 <!> 个必填参数未填写。"),Pt=l("<p class=os-client-capability-wizard-missing>其他步骤还有 <!> 个必填参数未填写,可点击左侧步骤继续补全。"),ke=l("<small>"),Lt=l("<ul class=os-client-capability-wizard-output-list>"),Ft=l("<div class=os-client-capability-wizard-quality><strong>质量门禁</strong><p>"),Tt=l('<div class="os-client-capability-wizard-outputs os-client-capability-wizard-overall"aria-label=全局交付要点><div class=os-client-capability-wizard-outputs-head><span>全局交付要点</span></div><ul class=os-client-capability-wizard-output-list>'),jt=l('<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><section class=os-client-capability-wizard-dialog><header class=os-client-capability-wizard-head><button type=button class=os-client-capability-wizard-intro-back>返回场景列表</button><div class=os-client-capability-wizard-head-title><h2></h2><p></p></div><button type=button class=os-client-capability-wizard-close aria-label=关闭>×</button></header><div class=os-client-capability-wizard-columns><aside class=os-client-capability-wizard-column aria-label=工作流><h3>工作流</h3><p class=os-client-capability-wizard-note>点击步骤查看对应参数与产出;创建后将自动按序执行。</p><ol class=os-client-capability-wizard-workflow></ol></aside><section class=os-client-capability-wizard-column aria-label=补充信息><div class=os-client-capability-wizard-column-head><h3>本步参数</h3><small>/<!> · 已填 <!>/</small></div><div class=os-client-capability-wizard-fields></div><div class=os-client-capability-wizard-step-nav><button type=button>上一步</button><button type=button>下一步</button></div></section><section class=os-client-capability-wizard-column aria-label="本步产出与 Prompt"><div class=os-client-capability-wizard-outputs aria-label=本步产出><div class=os-client-capability-wizard-outputs-head><span>本步产出</span></div></div><div class=os-client-capability-wizard-column-head><h3>本步 Prompt</h3><small>第 <!> 步</small></div><textarea class=os-client-capability-wizard-prompt rows=12 readonly></textarea></section></div><footer class=os-client-capability-wizard-footer><button type=button>返回能力中心</button><button type=button data-primary=true>创建任务并自动逐步执行'),Rt=l("<em>参数 <!>/"),Wt=l("<li><button type=button class=os-client-capability-wizard-step><span></span><div><p>"),qt=l("<a target=_blank rel=noreferrer> · "),Dt=l("<div class=os-client-capability-wizard-step-banner><strong>"),Ht=l("<p>"),Mt=l("<p class=os-client-capability-wizard-note>本步无需额外用户参数。"),Ot=l("<em>*"),Et=l("<textarea rows=3>"),Ut=l("<label class=os-client-capability-wizard-field><span>"),At=l("<input type=text>"),Vt=l("<p class=os-client-capability-wizard-outputs-empty>本步暂无结构化产出清单。"),Ae=l("<li>");function Kt(e){const d=Je(),[s,$]=Ne({values:He(e.scenario),attempted:!1,activeStepIndex:0});et(()=>{$({values:He(e.scenario),attempted:!1,activeStepIndex:0})});const y=W(()=>tt(e.scenario)),k=W(()=>y()[s.activeStepIndex]??y()[0]),V=W(()=>{const v=k();return v?xe(e.scenario,v):e.scenario.user_input}),F=W(()=>ze(e.scenario,s.values)),de=W(()=>V().filter(v=>Me(v)?!String(s.values[oe(v)]??"").trim():!1)),Z=W(()=>V().filter(v=>String(s.values[oe(v)]??"").trim()).length),ye=W(()=>{const T=k()?.prompt||e.scenario.ai_prompt?.template||"";return it(T,s.values)}),C=W(()=>k()?.outputs??[]),K=W(()=>at(e.scenario)),G=()=>(e.scenario.related_papers??[]).slice(0,3),ae=(v,T)=>{$("values",v,T)},M=v=>{$("activeStepIndex",v)},ue=()=>{$("attempted",!0);const v=ze(e.scenario,s.values);if(v.length===0){e.onSubmit({values:{...s.values}});return}const T=oe(v[0]),le=y().findIndex(N=>xe(e.scenario,N).some(q=>oe(q)===T));le>=0&&$("activeStepIndex",le),d.show(()=>a(nt,{title:"请补充必填参数",get reason(){return`还有 ${v.length} 个必填参数未填写,补充后即可创建任务并自动逐步执行。`},fields:v,get values(){return s.values},onConfirm:N=>{const q={...s.values,...N};$("values",q),!(ze(e.scenario,q).length>0)&&e.onSubmit({values:q})}}))};return(()=>{var v=jt(),T=v.firstChild,le=T.nextSibling,N=le.firstChild,q=N.firstChild,re=q.nextSibling,be=re.firstChild,Se=be.nextSibling,r=re.nextSibling,p=N.nextSibling,b=p.firstChild,_=b.firstChild,j=_.nextSibling,Q=j.nextSibling,O=b.nextSibling,pe=O.firstChild,we=pe.firstChild,B=we.nextSibling,ne=B.firstChild,ge=ne.nextSibling,he=ge.nextSibling,$e=he.nextSibling;$e.nextSibling;var X=pe.nextSibling,ve=X.nextSibling,se=ve.firstChild,ce=se.nextSibling,u=O.nextSibling,o=u.firstChild,m=o.firstChild;m.firstChild;var x=o.nextSibling,P=x.firstChild,R=P.nextSibling,D=R.firstChild,J=D.nextSibling;J.nextSibling;var E=x.nextSibling,ee=p.nextSibling,te=ee.firstChild,Ce=te.nextSibling;return _e(T,"click",e.onClose,!0),_e(q,"click",e.onClose,!0),t(be,()=>e.scenario.name),t(Se,()=>e.scenario.problem_and_applicability),_e(r,"click",e.onClose,!0),t(Q,a(U,{get each(){return y()},children:(i,n)=>{const c=()=>xe(e.scenario,i),w=()=>c().filter(H=>String(s.values[oe(H)]??"").trim()).length,S=()=>c().length;return(()=>{var H=Wt(),h=H.firstChild,L=h.firstChild,ie=L.nextSibling,I=ie.firstChild;return h.$$click=()=>M(n()),t(L,()=>n()+1),t(I,()=>i.name),t(ie,a(g,{get when(){return i.purpose},get children(){var z=ke();return t(z,()=>i.purpose),z}}),null),t(ie,a(g,{get when(){return S()>0},get children(){var z=Rt(),Ze=z.firstChild,De=Ze.nextSibling;return De.nextSibling,t(z,w,De),t(z,S,null),z}}),null),f(()=>H.classList.toggle("is-active",s.activeStepIndex===n())),H})()}})),t(b,a(g,{get when(){return e.scenario.HPC},get children(){var i=xt(),n=i.firstChild,c=n.nextSibling;return t(c,()=>e.scenario.HPC),i}}),null),t(b,a(g,{get when(){return G().length>0},get children(){var i=zt();return i.firstChild,t(i,a(U,{get each(){return G()},children:n=>(()=>{var c=qt(),w=c.firstChild;return t(c,()=>n.paper_id,w),t(c,()=>n.relation,null),f(()=>A(c,"href",n.url)),c})()}),null),i}}),null),t(B,()=>s.activeStepIndex+1,ne),t(B,()=>y().length,ge),t(B,Z,$e),t(B,()=>V().length,null),t(O,a(g,{get when(){return k()},children:i=>(()=>{var n=Dt(),c=n.firstChild;return t(c,()=>i().name),t(n,a(g,{get when(){return i().purpose},children:w=>(()=>{var S=Ht();return t(S,w),S})()}),null),n})()}),X),t(O,a(g,{get when(){return e.scenario.system_auto_detection?.fields?.length},get children(){return kt()}}),X),t(O,a(g,{get when(){return Oe(()=>!!s.attempted)()&&de().length>0},get children(){var i=It(),n=i.firstChild,c=n.nextSibling;return c.nextSibling,t(i,()=>de().length,c),i}}),X),t(O,a(g,{get when(){return Oe(()=>!!(s.attempted&&F().length>0))()&&de().length===0},get children(){var i=Pt(),n=i.firstChild,c=n.nextSibling;return c.nextSibling,t(i,()=>F().length,c),i}}),X),t(X,a(g,{get when(){return V().length>0},get fallback(){return Mt()},get children(){return a(U,{get each(){return V()},children:i=>{const n=oe(i),c=Me(i),w=s.attempted&&c&&!String(s.values[n]??"").trim();return(()=>{var S=Ut(),H=S.firstChild;return S.classList.toggle("is-required",!!c),S.classList.toggle("is-invalid",!!w),t(H,()=>lt(i),null),t(H,a(g,{when:c,get children(){return Ot()}}),null),t(S,a(g,{get when(){return rt(i)},get fallback(){return(()=>{var h=At();return h.$$input=L=>ae(n,L.currentTarget.value),f(()=>A(h,"placeholder",Ee(i))),f(()=>h.value=s.values[n]??""),h})()},get children(){var h=Et();return h.$$input=L=>ae(n,L.currentTarget.value),f(()=>A(h,"placeholder",Ee(i))),f(()=>h.value=s.values[n]??""),h}}),null),S})()}})}})),se.$$click=()=>M(Math.max(0,s.activeStepIndex-1)),ce.$$click=()=>M(Math.min(y().length-1,s.activeStepIndex+1)),t(m,a(g,{get when(){return k()?.result_subfolder},get children(){var i=ke();return t(i,()=>k()?.result_subfolder),f(()=>A(i,"title",k()?.result_subfolder)),i}}),null),t(o,a(g,{get when(){return C().length>0},get fallback(){return Vt()},get children(){var i=Lt();return t(i,a(U,{get each(){return C()},children:n=>(()=>{var c=Ae();return t(c,n),c})()})),i}}),null),t(o,a(g,{get when(){return k()?.quality_gate},get children(){var i=Ft(),n=i.firstChild,c=n.nextSibling;return t(c,()=>k()?.quality_gate),i}}),null),t(u,a(g,{get when(){return K().length>0},get children(){var i=Tt(),n=i.firstChild;n.firstChild;var c=n.nextSibling;return t(n,a(g,{get when(){return e.scenario.results_folder},get children(){var w=ke();return t(w,()=>e.scenario.results_folder),f(()=>A(w,"title",e.scenario.results_folder)),w}}),null),t(c,a(U,{get each(){return K().slice(0,6)},children:w=>(()=>{var S=Ae();return t(S,w),S})()})),i}}),x),t(R,()=>s.activeStepIndex+1,J),_e(te,"click",e.onClose,!0),Ce.$$click=ue,f(i=>{var n=s.activeStepIndex<=0,c=s.activeStepIndex>=y().length-1;return n!==i.e&&(se.disabled=i.e=n),c!==i.t&&(ce.disabled=i.t=c),i},{e:void 0,t:void 0}),f(()=>E.value=ye()),v})()}Ge(["click","input"]);function Gt(e,d){return e.replace(/\{\{(\w+)\}\}/g,(s,$)=>d[$]??"")}var Nt=l("<div class=os-client-capability-wizard-overlay role=dialog aria-modal=true aria-label=能力向导>"),Qt=l("<section class=os-client-capability-wizard-dialog><p>未找到该能力。"),Bt=l("<div class=os-client-capability-wizard-scenario-group><span>完整工作流场景"),Xt=l("<section class=os-client-capability-wizard-dialog><header class=os-client-capability-wizard-head><div class=os-client-capability-wizard-head-title><h2></h2></div></header><div class=os-client-capability-wizard-columns><aside class=os-client-capability-wizard-column aria-label=你想做什么?><h3>你想做什么?</h3><div class=os-client-capability-wizard-scenarios></div></aside><section class=os-client-capability-wizard-column aria-label=补充信息><h3>补充信息</h3></section><section class=os-client-capability-wizard-column aria-label=起始任务><div class=os-client-capability-wizard-column-head><h3>起始任务</h3><button type=button>重新生成</button></div><textarea class=os-client-capability-wizard-prompt rows=14></textarea></section></div><footer class=os-client-capability-wizard-footer><button type=button data-primary=true>创建任务"),Yt=l("<section class=os-client-capability-wizard-dialog><p>「<!>」暂无 OneScience 源码或魔搭映射,当前不可使用。"),Zt=l("<button type=button><strong></strong><p>"),Jt=l("<button type=button><strong></strong><p></p><small> · <!> 步"),Ve=l("<p class=os-client-capability-wizard-empty>请先选择任务场景。"),ei=l("<div class=os-client-capability-wizard-required aria-label=该能力需要什么数据><h4>该能力需要什么数据</h4><ul>"),ti=l("<div class=os-client-capability-wizard-middle><div class=os-client-capability-wizard-fields></div><div class=os-client-capability-wizard-summary aria-label=当前能力配置><h4>当前能力配置</h4><dl><div><dt>当前能力</dt><dd></dd></div><div><dt>关键配置</dt><dd></dd></div><div><dt>运行资源</dt><dd></dd></div><div><dt>交付结果</dt><dd>"),ii=l("<textarea rows=3>"),ai=l("<label class=os-client-capability-wizard-field><span>"),li=l("<input type=text>"),ri=l("<li>"),ni=l("<div class=os-client-capability-wizard-right-head><strong></strong><p>"),si=l("<div class=os-client-capability-wizard-outputs aria-label=预计产出><span>预计产出</span><p>");function ci(e){return e==="hpc"?"软件介绍":"模型介绍"}function oi(e){return`使用 ${e} 开始科研任务`}function di(e){if(!Ie({navigate:e.navigate,action:{type:"prompt",prompt:e.prompt,title:e.title,workflow:e.workflow},isLoggedIn:e.isLoggedIn}))return!1;const d=Pe({path:e.path,recent:e.recent,lastCodeWorkspace:e.lastCodeWorkspace})||Le(fe())||Fe(document,e.path);if(!d)return!1;const s=Te(d);return je(s,e.prompt),Re(s),e.openProject?.(d),e.touchCode?.(d),We({variant:"success",title:`已为你创建「${e.title}」任务`}),e.navigate(qe(d)),!0}function Xe(e){const d=$t(e.scenario),s=d[0];if(!s?.promptTemplate.trim()||!Ie({navigate:e.navigate,action:{type:"scenario-run",scenarioId:e.scenario.scenario_id,values:e.values},isLoggedIn:e.isLoggedIn}))return!1;const $=Pe({path:e.path,recent:e.recent,lastCodeWorkspace:e.lastCodeWorkspace})||Le(fe())||Fe(document,e.path);if(!$)return!1;const y=Te($);return vt(y,{title:e.scenario.name,scenarioId:e.scenario.scenario_id,values:e.values,steps:d}),je(y,_t(s,e.values)),Re(y),e.openProject?.($),e.touchCode?.($),We({variant:"success",title:`已创建「${e.scenario.name}」`,description:`将按 ${d.length} 步自动依次执行,缺参或失败时暂停`}),e.navigate(qe($)),!0}function Ye(e){if(!Ie({navigate:e.navigate,action:{type:"wizard",resourceId:e.resourceId,scenarioId:e.scenarioId,values:e.values,prompt:e.prompt},isLoggedIn:e.isLoggedIn}))return!1;const d=Qe(e.resourceId),s=d?.scenarios.find(k=>k.id===e.scenarioId);if(!d||!s||!Be(d))return!1;const $=Pe({path:e.path,recent:e.recent,lastCodeWorkspace:e.lastCodeWorkspace})||Le(fe())||Fe(document,e.path);if(!$)return!1;const y=Te($);return je(y,e.prompt),Re(y),e.openProject?.($),e.touchCode?.($),We({variant:"success",title:`已为你创建 ${d.name}「${s.title}」任务`}),e.navigate(qe($)),!0}function me(e,d){return Gt(e.promptTemplate,d)}function Ke(e){return Object.fromEntries(e.fields.map(d=>[d.id,ui(d)]))}function ui(e){return e.default?.trim()?e.default:e.placeholder?.replace(/^例如[::]\s*/,"").trim()??""}function pi(){const e=st(),d=ct(),[s]=ot(),$=dt(),y=ut(),k=pt(),V=gt(),F=()=>Qe(e.id??""),de=()=>wt(d.search),Z=()=>yt(d.search,{category:F()?.category??"onemodel",domain:F()?.domain??"materials"}),ye=()=>St(e.id??"",de()),[C,K]=Ne({scenarioId:"",values:{},prompt:""}),[G,ae]=ht(""),M=()=>F()?.scenarios.find(r=>r.id===C.scenarioId),ue=W(()=>{const r=F();return r?mt({domain:r.domain,name:r.name,id:r.id}):[]}),v=W(()=>{const r=G();if(r)return ft(r)??ue().find(p=>p.scenario_id===r)}),T=()=>({navigate:$,isLoggedIn:!!fe(),path:y.data.path,recent:Ct(y.data.project),lastCodeWorkspace:V.projects.lastCode(),openProject:r=>k.projects.open(r),touchCode:r=>V.projects.touchCode(r)}),le=()=>{const r=M();r&&K("prompt",me(r,C.values))};bt(()=>{const r=F();if(!r?.scenarios.length)return;const p=s.scenario,_=(p?r.scenarios.find(Q=>Q.id===p):void 0)??r.scenarios[0],j=Ke(_);K({scenarioId:_.id,values:j,prompt:me(_,j)})});const N=r=>{const b=F()?.scenarios.find(j=>j.id===r);if(!b)return;ae("");const _=Ke(b);K({scenarioId:b.id,values:_,prompt:me(b,_)})},q=r=>{ae(r)},re=(r,p)=>{const b=M();if(!b)return;const _={...C.values,[r]:p};K({values:_,prompt:me(b,_)})},be=()=>{const r=F(),p=M();!r||!p||Ye({resourceId:r.id,scenarioId:p.id,values:{...C.values},prompt:C.prompt,...T()})},Se=(r,p)=>{Xe({scenario:r,values:p.values,...T()})};return(()=>{var r=Nt();return t(r,a(g,{get when(){return F()},get fallback(){return[a(Y,{class:"os-client-capability-wizard-backdrop",get href(){return Ue()},"aria-label":"关闭向导"}),(()=>{var p=Qt();return p.firstChild,t(p,a(Y,{get href(){return Ue()},children:"返回能力中心"}),null),p})()]},children:p=>a(g,{get when(){return Be(p())},get fallback(){return[a(Y,{class:"os-client-capability-wizard-backdrop",get href(){return Z()},"aria-label":"关闭向导"}),(()=>{var b=Yt(),_=b.firstChild,j=_.firstChild,Q=j.nextSibling;return Q.nextSibling,t(_,()=>p().name,Q),t(b,a(Y,{get href(){return Z()},children:"返回模型库"}),null),b})()]},get children(){return[a(Y,{class:"os-client-capability-wizard-backdrop",get href(){return Z()},"aria-label":"关闭向导"}),(()=>{var b=Xt(),_=b.firstChild,j=_.firstChild,Q=j.firstChild,O=_.nextSibling,pe=O.firstChild,we=pe.firstChild,B=we.nextSibling,ne=pe.nextSibling;ne.firstChild;var ge=ne.nextSibling,he=ge.firstChild,$e=he.firstChild,X=$e.nextSibling,ve=he.nextSibling,se=O.nextSibling,ce=se.firstChild;return t(_,a(Y,{class:"os-client-capability-wizard-intro-back",get href(){return ye()},get children(){return ci(p().category)}}),j),t(Q,()=>oi(p().name)),t(_,a(Y,{class:"os-client-capability-wizard-close",get href(){return Z()},"aria-label":"关闭",children:"×"}),null),t(B,a(U,{get each(){return p().scenarios},children:u=>(()=>{var o=Zt(),m=o.firstChild,x=m.nextSibling;return o.$$click=()=>N(u.id),t(m,()=>u.title),t(x,()=>u.summary),f(P=>{var R=!G()&&C.scenarioId===u.id,D=!G()&&C.scenarioId===u.id;return R!==P.e&&o.classList.toggle("is-active",P.e=R),D!==P.t&&A(o,"aria-pressed",P.t=D),P},{e:void 0,t:void 0}),o})()}),null),t(B,a(g,{get when(){return ue().length>0},get children(){var u=Bt();return u.firstChild,t(u,a(U,{get each(){return ue()},children:o=>(()=>{var m=Jt(),x=m.firstChild,P=x.nextSibling,R=P.nextSibling,D=R.firstChild,J=D.nextSibling;return J.nextSibling,m.$$click=()=>q(o.scenario_id),t(x,()=>o.name),t(P,()=>o.problem_and_applicability),t(R,()=>o.scenario_id,D),t(R,()=>o.workflow_steps?.length||o.workflow.length,J),f(E=>{var ee=G()===o.scenario_id,te=G()===o.scenario_id;return ee!==E.e&&m.classList.toggle("is-active",E.e=ee),te!==E.t&&A(m,"aria-pressed",E.t=te),E},{e:void 0,t:void 0}),m})()}),null),u}}),null),t(ne,a(g,{get when(){return M()},keyed:!0,get fallback(){return Ve()},children:u=>(()=>{var o=ti(),m=o.firstChild,x=m.nextSibling,P=x.firstChild,R=P.nextSibling,D=R.firstChild,J=D.firstChild,E=J.nextSibling,ee=D.nextSibling,te=ee.firstChild,Ce=te.nextSibling,i=ee.nextSibling,n=i.firstChild,c=n.nextSibling,w=i.nextSibling,S=w.firstChild,H=S.nextSibling;return t(m,a(U,{get each(){return u.fields},children:h=>(()=>{var L=ai(),ie=L.firstChild;return t(ie,()=>h.label),t(L,a(g,{get when(){return h.multiline},get fallback(){return(()=>{var I=li();return I.$$input=z=>re(h.id,z.currentTarget.value),f(()=>A(I,"placeholder",h.placeholder)),f(()=>I.value=C.values[h.id]??""),I})()},get children(){var I=ii();return I.$$input=z=>re(h.id,z.currentTarget.value),f(()=>A(I,"placeholder",h.placeholder)),f(()=>I.value=C.values[h.id]??""),I}}),null),L})()})),t(E,()=>u.capabilitySummary.current),t(Ce,()=>u.capabilitySummary.keyConfig),t(c,()=>u.capabilitySummary.resources),t(H,()=>u.capabilitySummary.deliverables),t(o,a(g,{get when(){return u.requiredData?.length},get children(){var h=ei(),L=h.firstChild,ie=L.nextSibling;return t(ie,a(U,{get each(){return u.requiredData},children:I=>(()=>{var z=ri();return t(z,I),z})()})),h}}),null),o})()}),null),t(ge,a(g,{get when(){return M()},keyed:!0,get fallback(){return Ve()},children:u=>[(()=>{var o=ni(),m=o.firstChild,x=m.nextSibling;return t(m,()=>u.title),t(x,()=>u.summary),o})(),(()=>{var o=si(),m=o.firstChild,x=m.nextSibling;return t(x,()=>u.expectedOutputs),o})()]}),he),X.$$click=le,ve.$$input=u=>K("prompt",u.currentTarget.value),t(se,a(Y,{get href(){return Z()},children:"返回能力中心"}),ce),ce.$$click=be,f(()=>ce.disabled=!C.prompt.trim()),f(()=>ve.value=C.prompt),b})(),a(g,{get when(){return v()},children:b=>a(Kt,{get scenario(){return b()},onClose:()=>ae(""),onSubmit:_=>Se(b(),_)})})]}})})),r})()}Ge(["click","input"]);const hi=Object.freeze(Object.defineProperty({__proto__:null,CapabilityWizardPage:pi,startCapabilityPromptTask:di,startCapabilityScenarioRunTask:Xe,startCapabilityWizardTask:Ye},Symbol.toStringTag,{value:"Module"}));export{Kt as S,Xe as a,Ye as b,di as s,hi as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/assets/yup-01-BtRq6dLN.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/assets/yup-03-BHLEoqSS.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/assets/yup-04-C7yadpJT.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/assets/yup-05-CuuaeyjC.aac";export{e as default};
|
package/index.html
CHANGED
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
name="description"
|
|
9
9
|
content="OneScience is an AI for Science workspace for research discovery, agent workflows, and scientific knowledge."
|
|
10
10
|
/>
|
|
11
|
-
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
12
|
-
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
13
|
-
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
14
|
-
<link rel="manifest" href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
15
|
-
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
16
|
-
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
11
|
+
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/favicon-96x96-v3.png" sizes="96x96" />
|
|
12
|
+
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/favicon-v3.ico" />
|
|
13
|
+
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/apple-touch-icon-v3.png" />
|
|
14
|
+
<link rel="manifest" href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/site.webmanifest" />
|
|
15
|
+
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/assets/fonts/inter-400.woff2" as="font" type="font/woff2" crossorigin />
|
|
16
|
+
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/assets/fonts/noto-sc-400.woff2" as="font" type="font/woff2" crossorigin />
|
|
17
17
|
<meta name="theme-color" content="#F8F7F7" />
|
|
18
18
|
<meta name="theme-color" content="#131010" media="(prefers-color-scheme: dark)" />
|
|
19
|
-
<meta property="og:image" content="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
20
|
-
<meta property="twitter:image" content="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
21
|
-
<script id="oc-theme-preload-script" src="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
22
|
-
<script type="module" crossorigin src="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
23
|
-
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
19
|
+
<meta property="og:image" content="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/social-share.png" />
|
|
20
|
+
<meta property="twitter:image" content="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/social-share.png" />
|
|
21
|
+
<script id="oc-theme-preload-script" src="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/oc-theme-preload.js"></script>
|
|
22
|
+
<script type="module" crossorigin src="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/assets/index-DSFO1zPs.js"></script>
|
|
23
|
+
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/assets/index-DgFAbOBA.css">
|
|
24
24
|
</head>
|
|
25
25
|
<body class="antialiased overscroll-none text-12-regular overflow-hidden">
|
|
26
26
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onescience/onecode-web",
|
|
3
|
-
"version": "1.14.50-
|
|
3
|
+
"version": "1.14.50-202609041106",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "OneCode web UI static assets for CDN delivery.",
|
|
8
|
-
"homepage": "https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
8
|
+
"homepage": "https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609041106/index.html",
|
|
9
9
|
"jsdelivr": "index.html",
|
|
10
10
|
"files": [
|
|
11
11
|
"**/*"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{M as ee,Q as W,bC as de,W as me,b3 as N,y as te,i,b as C,c as V,B as Y,t as v,d as we,S as k,m as z,f,s as E,ds as ve,x as ge,h as _e,b4 as Ce,b5 as ye,bU as xe,bK as Se,bm as Pe,b6 as fe,dt as ke,du as be,dv as qe,dw as Ae,dx as Me,dy as Te,dz as De,dA as Ee,bn as oe,dB as Ue,bk as le,dC as He}from"./index-Cxa2Vk80.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">'),Be=v("<div class=os-auth-links><span>已有账号?</span><a>去登录"),je=v('<p class=os-auth-hint style="margin:0 0 0.35rem">通过注册邮箱获取验证码后重置密码。若无法收到邮件,请联系管理员。'),Z=v("<p class=os-account-success>"),Oe=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>创建账号"),Ke=v('<p class=os-auth-hint style="margin:0 0 0.35rem">请设置新密码以完成重置。'),Qe=v("<main class=os-account-page><div class=os-account-shell>"),Je=v("<section class=os-account-loading><strong>正在加载账号信息</strong><span>请稍候"),Xe=v('<section class=os-account-empty-state><strong></strong><span>登录后可以查看账号资料和开发空间。</span><a href="/login?redirect=%2Faccount"class="os-button os-button-primary">去登录'),Ye=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">'),Ze=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(be(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,b=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}}),b),i(b,(()=>{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&&(b.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=Y(()=>Math.max(0,Math.ceil(((r.cooldownUntil??0)-w())/1e3))),b=Y(()=>o()>0),n=async()=>{if(r.requestingCode||r.submitting||b())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()}),p=typeof c.retryAfterMs=="number"&&c.retryAfterMs>0?c.retryAfterMs:6e4;if(c.smtpUnreachable){m(!0),e({requestingCode:!1,requestHint:"无法连接邮件服务器,本次注册无需填写验证码。找回密码仍须邮件验证,收不到验证码请联系管理员。",error:"",cooldownUntil:Date.now()+p});return}m(!1),e({requestingCode:!1,requestHint:"验证码已发送,请查收邮箱后填入下方。",error:"",cooldownUntil:Date.now()+p})}catch(c){const p=c instanceof Error&&"retryAfterMs"in c?Number(c.retryAfterMs):void 0;e({requestingCode:!1,error:c instanceof Error?c.message:"发送验证码失败,请稍后重试",requestHint:"",...typeof p=="number"&&p>0?{cooldownUntil:Date.now()+p}:{}})}},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 p=ue(r.email);if(p){e("error",p);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(be(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,p=c.firstChild,g=p.nextSibling,q=c.nextSibling,P=q.firstChild,M=P.nextSibling,U=q.nextSibling,I=U.firstChild,H=I.nextSibling,L=U.nextSibling,K=L.firstChild,Q=K.nextSibling,B=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(()=>!!b())()?`重新发送 (${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 j=r.requestingCode||r.submitting||b()||!r.email.trim(),J=t()?"邮件服务器不可达,可留空":"输入邮件中的验证码",O=r.submitting;return j!==y.e&&(T.disabled=y.e=j),J!==y.t&&E(R,"placeholder",y.t=J),O!==y.a&&(R.disabled=y.a=O),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),Q.$$input=$=>e("confirmPassword",$.currentTarget.value),i(s,C(k,{get when(){return r.error},get children(){var $=G();return i($,()=>r.error),$}}),B),i(B,()=>r.submitting?"正在创建...":"创建账号"),f($=>{var T=r.submitting||r.requestingCode,D=r.submitting;return T!==$.e&&(M.disabled=$.e=T),D!==$.t&&(B.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(()=>Q.value=r.confirmPassword),s})(),(()=>{var s=Be(),c=s.firstChild,p=c.nextSibling;return f(()=>E(p,"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=Y(()=>Math.max(0,Math.ceil((a.cooldownUntil-_())/1e3))),w=Y(()=>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 b=o.toString();window.setTimeout(()=>l(`/login${b?`?${b}`:""}`,{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 Ke()},get children(){return je()}}),C(k,{when:!d,get children(){var e=Oe(),o=e.firstChild,b=o.firstChild,n=b.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=Z();return i(s,()=>a.requestHint),s}}),null),f(s=>{var c=a.requesting||a.submitting,p=a.requesting||a.submitting||w()||!a.email.trim();return c!==s.e&&(n.disabled=s.e=c),p!==s.t&&(h.disabled=s.t=p),s},{e:void 0,t:void 0}),f(()=>n.value=a.email),e}}),(()=>{var e=We(),o=e.firstChild,b=o.firstChild,n=b.nextSibling,h=o.nextSibling,s=h.firstChild,c=s.nextSibling,p=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}}),p),i(e,C(k,{get when(){return a.success},get children(){var g=Z();return i(g,()=>a.success),g}}),p),i(p,()=>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&&(p.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,b=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(b,"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(b=>a({session:b,loading:!1,error:""})).catch(b=>a({loading:!1,error:b instanceof Error?b.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,b)=>{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:b.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=Qe(),b=o.firstChild;return i(b,C(k,{get when(){return!x.loading},get fallback(){return Je()},get children(){return C(k,{get when(){return x.session},get fallback(){return(()=>{var n=Xe(),h=n.firstChild,s=h.nextSibling;return s.nextSibling,i(h,()=>x.error||"当前未登录"),n})()},children:n=>[(()=>{var h=Ye(),s=h.firstChild,c=s.firstChild,p=c.nextSibling,g=p.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=Ze(),s=h.firstChild,c=s.firstChild,p=c.nextSibling,g=p.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,p=c.firstChild,g=p.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,K=I.nextSibling,Q=K.firstChild,B=Q.nextSibling,$=K.nextSibling,T=$.firstChild,D=T.nextSibling,F=s.nextSibling,R=F.firstChild,y=R.nextSibling,j=y.firstChild,J=j.firstChild,O=J.nextSibling,ne=j.nextSibling,he=ne.firstChild,se=he.nextSibling,ae=ne.nextSibling,$e=ae.firstChild,ie=$e.nextSibling,X=ae.nextSibling;return i(g,()=>ot(n().expiresAt),P),i(L,()=>n().account.name),i(B,()=>n().account.email),i(D,()=>it(n().account.timeCreated)),y.addEventListener("submit",A=>e(A,n())),O.$$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}}),X),i(y,C(k,{get when(){return t.success},get children(){var A=Z();return i(A,()=>t.success),A}}),X),i(X,()=>t.submitting?"正在更新...":"更新密码"),f(()=>X.disabled=t.submitting),f(()=>O.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,b=_.submitting;return o!==e.e&&(S.disabled=e.e=o),b!==e.t&&(r.disabled=e.t=b),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(pe(l))):"未记录"}function ot(l){const u=Math.ceil(Math.max(0,pe(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 pe(l){return l<1e10?l*1e3:l}we(["input","click"]);export{ft as AccountCenterPage,gt as ForgotPasswordPage,dt as LoginPage,mt as RegisterPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609031600/assets/alert-06-GK5Tqy6u.aac";export{e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609031600/assets/alert-07-0r0kiLGz.aac";export{e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609031600/assets/alert-08-CZowNquU.aac";export{e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609031600/assets/alert-10-Ck5hR7zH.aac";export{e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609031600/assets/bip-bop-09-CxEgoAHQ.aac";export{e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as ie,c as M,b as i,i as a,S as m,f as P,cG as ze,t as o,cH as Be,bp as te,cI as re,cJ as ne,a9 as we,bm as Ie,ab as G,ao as xe,p as Le,q as De,r as Pe,bk as z,bw as Oe,Q as se,O as ce,T as oe,U as de,B,al as ue,y as ae,_ as Ee,m as V,F as H,s as T,cK as Ge,a4 as Ne,bq as Ve,br as ee,e as Re,ae as Ke,G as Ye,cL as Je,cM as Xe,cN as Te,R as Ze,b3 as et,a as tt,cO as at,cP as he,cQ as lt,cR as me,cz as it,cS as X,cT as ge,cU as rt,A as $e,cV as nt}from"./index-Cxa2Vk80.js";import{S as st,s as ct}from"./onescience-skill-detail-dialog-C23957tN.js";import{s as ot,a as fe,b as dt,S as ut}from"./wizard-BQDxCspK.js";var gt=o("<p class=os-client-capability-upload-error role=alert>"),pt=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 bt(e){return e.split(/[,,、]/).map(l=>l.trim()).filter(Boolean)}function vt(e){const[l,r]=M(""),[c,t]=M(""),[n,u]=M(""),[v,f]=M(""),_=()=>{r(""),t(""),u(""),f("")},$=()=>{_(),e.onClose()},p=d=>{d.preventDefault();const b=l().trim(),w=c().trim(),S=bt(n());if(!b||!w||S.length===0){f("请填写名称、简介和至少一个标签,以便生成与现有模型卡片一致的展示信息。");return}const I=Be({name:b,blurb:w,tags:S,domain:e.domain});e.onSaved({id:I.id,name:I.name}),$()};return i(m,{get when(){return e.open},get children(){var d=pt(),b=d.firstChild,w=b.nextSibling,S=w.firstChild,I=S.firstChild,E=I.nextSibling,s=S.nextSibling,L=s.nextSibling,F=L.firstChild,q=F.firstChild,Q=q.nextSibling,k=Q.nextSibling,x=F.nextSibling,U=x.firstChild,g=U.nextSibling,C=g.nextSibling,y=x.nextSibling,D=y.firstChild,R=D.firstChild,j=R.nextSibling,h=j.nextSibling,O=D.nextSibling,A=O.firstChild,K=A.nextSibling,Z=K.nextSibling,N=L.nextSibling,Y=N.firstChild;return b.$$click=$,w.addEventListener("submit",p),E.$$click=$,k.$$input=W=>r(W.currentTarget.value),C.$$input=W=>t(W.currentTarget.value),h.$$input=W=>u(W.currentTarget.value),a(w,i(m,{get when(){return v()},get children(){var W=gt();return a(W,v),W}}),N),Y.$$click=$,P(()=>k.value=l()),P(()=>C.value=c()),P(()=>h.value=n()),P(()=>Z.value=ze(e.domain)),d}})}ie(["click","input"]);function yt(e){const l=re(e);if(!l)throw new Error(`Unknown capability resource: ${e}`);if(!ne(l))throw new Error(`Capability resource is not installable: ${e}`);return{banner:l.install.banner,prompt:l.install.prompt}}function Ue(e){if(!te({navigate:e.navigate,action:{type:"install",resourceId:e.resourceId},isLoggedIn:e.isLoggedIn}))return!1;const l=re(e.resourceId);if(!l||!ne(l))return!1;const{banner:r,prompt:c}=yt(e.resourceId),t=we({path:e.path,recent:e.recent,lastCodeWorkspace:e.lastCodeWorkspace})||Ie(G())||xe(document,e.path);if(!t)return!1;const n=Le(t);return De(n,c),Pe(n),e.openProject?.(t),e.touchCode?.(t),z({variant:"success",title:r}),e.navigate(Oe(t)),!0}var ht=o('<article class="os-client-capability-card os-client-capability-skill-card"><div class=os-client-capability-skill-card-head><h4></h4></div><p></p><div class=os-client-capability-meta><span class=os-client-capability-skill-provider></span></div><div class=os-client-capability-actions><button type=button>详情</button><button type=button data-primary=true>开发'),je=o("<span>"),mt=o("<div>"),$t=o("<button type=button class=os-client-capability-oneskills-expand>"),ft=o("<section class=os-client-capability-oneskills-section><header class=os-client-capability-oneskills-section-head><div class=os-client-capability-oneskills-section-title><h3></h3></div><p>"),_t=o("<p class=os-client-capability-empty>当前分类暂无技能卡片。"),Ct=o("<span class=os-client-capability-oneskills-count> 个技能"),St=o("<p class=os-client-capability-oneskills-error>"),kt=o("<div class=os-client-capability-oneskills-top-row>"),wt=o("<div class=os-client-capability-oneskills-overview>"),It=o('<section class="os-client-capability-resource-panel os-client-capability-oneskills-panel"><header class=os-client-capability-oneskills-toolbar><div class=os-client-capability-oneskills-toolbar-copy><p>按 OneSkills 分层浏览官方技能,查看详情或进入开发。</p></div><div class=os-client-capability-oneskills-actions><span class=inline-flex><button type=button class=os-client-capability-oneskills-upgrade>'),xt=o("<p class=os-client-capability-empty>正在加载 OneSkills 技能..."),Lt=o("<p class=os-client-capability-empty>暂无可展示的 OneSkills 技能,请先安装或更新技能。");const _e=4,le=new Set(["orchestrator","resource"]);function Dt(e,l){return e.layer===l.title||e.tags.includes(l.title)||e.tags.includes(l.id)}function Pt(e){return we(e)||Ge(G(),e.lastCodeWorkspace)||Ie(G())||xe(document,e.path)}function Ot(e){const l=()=>e.item.tags.filter(r=>r!==e.item.layer&&r!==e.item.provider).slice(0,3);return(()=>{var r=ht(),c=r.firstChild,t=c.firstChild,n=c.nextSibling,u=n.nextSibling,v=u.firstChild,f=u.nextSibling,_=f.firstChild,$=_.nextSibling;return Re(r,"click",e.onOpen,!0),a(t,()=>e.item.title),a(n,()=>e.item.copy),a(v,()=>e.item.provider),a(u,i(H,{get each(){return l()},children:p=>(()=>{var d=je();return a(d,p),d})()}),null),_.$$click=p=>{p.stopPropagation(),e.onOpen()},$.$$click=p=>{p.stopPropagation(),e.onDevelop()},P(p=>{var d=e.layerId,b=e.canDevelop?void 0:"登录后使用";return d!==p.e&&T(r,"data-layer",p.e=d),b!==p.t&&T($,"title",p.t=b),p},{e:void 0,t:void 0}),r})()}function Ce(e){const[l,r]=M(!1),c=()=>e.items.length,t=()=>Math.max(0,c()-_e),n=()=>l()||t()===0?e.items:e.items.slice(0,_e),u=()=>le.has(e.group.id);return(()=>{var v=ft(),f=v.firstChild,_=f.firstChild,$=_.firstChild,p=_.nextSibling;return a($,()=>e.group.title),a(_,i(m,{get when(){return c()>0},get children(){var d=je();return a(d,c),d}}),null),a(p,()=>e.group.copy),a(v,i(m,{get when(){return c()>0},get fallback(){return _t()},get children(){return[(()=>{var d=mt();return a(d,i(H,{get each(){return n()},children:b=>i(Ot,{item:b,get layerId(){return e.group.id},get canDevelop(){return e.canDevelop},onOpen:()=>e.onOpen(b),onDevelop:()=>e.onDevelop(b)})})),P(b=>{var w=!u(),S=!!u();return w!==b.e&&d.classList.toggle("os-client-capability-page-grid",b.e=w),S!==b.t&&d.classList.toggle("os-client-capability-oneskills-compact-grid",b.t=S),b},{e:void 0,t:void 0}),d})(),i(m,{get when(){return V(()=>!u())()&&t()>0},get children(){var d=$t();return d.$$click=()=>r(b=>!b),a(d,(()=>{var b=V(()=>!!l());return()=>b()?"收起":`展开其余 ${t()} 个`})()),P(()=>T(d,"aria-expanded",l())),d}})]}}),null),P(d=>{var b=e.group.id,w=!!e.compact,S=e.group.id;return b!==d.e&&T(v,"id",d.e=b),w!==d.t&&v.classList.toggle("is-compact",d.t=w),S!==d.a&&T(v,"data-layer",d.a=S),d},{e:void 0,t:void 0,a:void 0}),v})()}function Et(){const e=se(),l=ce(),r=oe(),c=de(),[t,n]=M([]),[u,v]=M(!1),[f,_]=M(!1),[$,p]=M(),[d,b]=M(!1),[w,S]=M(),I=B(()=>!!G()?.account.id),E=B(()=>Pt({path:r.data.path,recent:ue(r.data.project),lastCodeWorkspace:l.projects.lastCode()})),s=async()=>{const g=l.current;if(!g){n([]),v(!0);return}const C=await Ne(g.http.url,{limit:100});n(C.loaded?C.items:[]),v(!0)};ae(()=>{e(Ee("oneskills"),{replace:!0}),s()});const L=g=>t().filter(C=>Dt(C,g)),F=()=>Ke.filter(g=>L(g).length>0),q=()=>{const g=F();return{pair:g.filter(C=>le.has(C.id)),rest:g.filter(C=>!le.has(C.id))}},Q=g=>{S(g),b(!0)},k=()=>{b(!1),S(void 0)},x=g=>{if(!te({navigate:e,action:{type:"prompt",prompt:""},isLoggedIn:I()}))return;const C=E();if(!C){z({variant:"error",title:"无法开发",description:"未检测到工作目录"});return}const y=ct({id:g.id,title:g.title,copy:g.copy,layer:g.layer,tags:g.tags,provider:g.provider}),D=Le(C);De(D,y.prompt,{skill:y.skill}),Pe(D),c.projects.open(C),l.projects.touchCode(C),b(!1),S(void 0),z({variant:"success",title:`已为你创建「${g.title}」开发任务`}),e(Oe(C))},U=async()=>{if(!te({navigate:e,action:{type:"install",resourceId:"oneskills"},isLoggedIn:I()}))return;const g=l.current,C=E();if(!g){const y=ee();p(y),z({variant:"error",title:"更新失败",description:y});return}if(!C){const y=ee();p(y),z({variant:"error",title:"更新失败",description:y});return}_(!0),p(void 0);try{const y=await Ve(g.http.url,C);await s();const D=y.version?`版本 ${y.version} · ${y.skillCount} 个技能`:`${y.skillCount} 个技能`,R=y.seedSource==="bundled"&&y.seedFallbackReason?"原语已回退内置 seed":y.seedSource==="disk"?"原语已同步磁盘 oneskills":void 0;z({variant:"success",title:"OneSkills 已更新",description:R?`${D} · ${R}`:D})}catch(y){const D=ee(y instanceof Error?y.message:"更新 OneSkills 失败");p(D),z({variant:"error",title:"更新失败",description:D})}finally{_(!1)}};return(()=>{var g=It(),C=g.firstChild,y=C.firstChild;y.firstChild;var D=y.nextSibling,R=D.firstChild,j=R.firstChild;return a(y,i(m,{get when(){return V(()=>!!u())()&&t().length>0},get children(){var h=Ct(),O=h.firstChild;return a(h,()=>t().length,O),h}}),null),a(D,i(m,{get when(){return $()},get children(){var h=St();return a(h,$),h}}),R),j.$$click=()=>void U(),a(j,()=>f()?"更新中...":"更新 OneSkills"),a(g,i(m,{get when(){return u()},get fallback(){return xt()},get children(){return i(m,{get when(){return t().length>0},get fallback(){return Lt()},get children(){var h=wt();return a(h,i(m,{get when(){return q().pair.length>0},get children(){var O=kt();return a(O,i(H,{get each(){return q().pair},children:A=>i(Ce,{group:A,get items(){return L(A)},compact:!0,get canDevelop(){return I()},onOpen:Q,onDevelop:x})})),O}}),null),a(h,i(H,{get each(){return q().rest},children:O=>i(Ce,{group:O,get items(){return L(O)},get canDevelop(){return I()},onOpen:Q,onDevelop:x})}),null),h}})}}),null),a(g,i(st,{variant:"workbench",get item(){return w()},get open(){return d()},get serverUrl(){return l.current?.http.url},onClose:k,onDevelop:()=>{const h=w();h&&(k(),x(h))}}),null),P(h=>{var O=I()?void 0:"登录后使用",A=f();return O!==h.e&&T(R,"title",h.e=O),A!==h.t&&(j.disabled=h.t=A),h},{e:void 0,t:void 0}),g})()}ie(["click"]);async function Rt(e,l){const r=new URLSearchParams;r.set("limit","200");const c=await Ye(`${Je(e)}/experimental/onescience/scenario?${r}`);if(!c.ok)throw new Error(`scenario catalog failed: ${c.status}`);const n=((await c.json()).items??[]).map(u=>({...u,model_ids:u.model_ids?.length?u.model_ids:[u.model.trim().toLowerCase()]}));return Xe(n),n}function Tt(e){const l=new URLSearchParams(e).get("category");if(l==="scenario"||l==="onemodel"||l==="hpc"||l==="onedata"||l==="oneskills")return l}function Ut(e){const l=new URLSearchParams(e).get("domain");if(l==="materials"||l==="weather"||l==="fluid"||l==="bio")return l;if(l==="all")return"all"}function Se(e,l){const r=Tt(l),c=Ut(l);if(r)return{categoryId:r,domainId:c??(r==="onemodel"||r==="hpc"?"all":"materials")};const t=new RegExp(`^${Te.capabilities}/([^/]+)`).exec(e),n=t?.[1]?re(t[1]):void 0;return n?{categoryId:n.category,domainId:n.domain}:{categoryId:"scenario",domainId:"materials"}}var jt=o("<span>当前范围:"),Mt=o("<strong>全领域"),Ht=o("<small>OneSkills 原语跨领域通用,不区分材料 / 气象 / 流体 / 生信"),Wt=o("<div class=os-client-capability-domain-row role=tablist aria-label=能力中心领域>"),At=o("<div class=os-client-capability-scenario-grid>"),Qt=o("<section class=os-client-capability-scenario-panel><div class=os-client-capability-scenario-toolbar><span>场景卡片</span><strong></strong><small> · 点击卡片打开场景弹窗</small><label class=os-client-capability-scenario-search><input type=search placeholder=搜索场景名称、ID、模型、HPC… aria-label=搜索场景>"),qt=o("<div class=os-client-capability-page><section class=os-client-capability-selector aria-label=能力中心筛选><div class=os-client-capability-current-domain></div><div class=os-client-capability-filter-tabs aria-label=能力类型></div></section><div class=os-client-capability-page-body>"),Ft=o("<span>当前领域:"),zt=o("<strong>"),Bt=o("<small>"),Gt=o("<button type=button>"),Nt=o("<button type=button class=os-client-capability-filter-tab role=tab><div class=os-client-capability-filter-tab-text><strong></strong><small>"),Vt=o("<p class=os-client-capability-hint>"),pe=o("<span>"),Kt=o("<button type=button class=os-client-capability-scenario-card><div class=os-client-capability-scenario-card-head><h4></h4><span></span></div><p></p><div class=os-client-capability-scenario-card-meta><span></span><span></span><span> 步工作流</span><span> 个字段</span></div><div class=os-client-capability-scenario-card-action><span>使用"),Yt=o('<section class=os-client-capability-resource-panel><header class="os-client-capability-page-section-head os-client-capability-page-section-head-active"><p></p></header><p class=os-client-capability-empty>onedata 卡片即将上线,敬请期待。'),Jt=o("<button type=button class=os-client-capability-upload-trigger><span aria-hidden=true>+</span>上传私有模型"),Xt=o("<label class=os-client-capability-catalog-search><span>搜索</span><input type=search placeholder=按名称、简介或标签筛选>"),Zt=o("<div class=os-client-capability-catalog-toolbar><div class=os-client-capability-catalog-toolbar-side><span class=os-client-capability-catalog-count></span><div class=os-client-capability-view-switch role=tablist aria-label=展示方式>"),ea=o('<section class=os-client-capability-resource-panel><header class="os-client-capability-page-section-head os-client-capability-page-section-head-active"><p>'),ta=o("<p class=os-client-capability-empty>当前「<!>」领域暂无<!>卡片。"),aa=o("<button type=button role=tab>"),la=o("<p class=os-client-capability-empty>没有匹配的结果,试试换个关键词。"),ia=o("<div class=os-client-capability-catalog role=list>"),ra=o("<article class=os-client-capability-catalog-row role=listitem>"),na=o("<div class=os-client-capability-page-grid>"),Me=o("<span class=os-client-capability-private-badge>私有资产"),He=o("<span class=os-client-capability-unavailable-badge>暂不可用"),sa=o("<div class=os-client-capability-meta>"),ca=o("<article class=os-client-capability-card><div class=os-client-capability-card-body><div class=os-client-capability-card-head><div class=os-client-capability-card-title><h4></h4></div></div><p>"),oa=o("<p class=os-client-capability-unavailable-hint>暂无 OneScience 源码或魔搭映射"),da=o("<div class=os-client-capability-catalog-tags>"),ua=o("<div class=os-client-capability-catalog-copy><div class=os-client-capability-card-title><h4></h4></div><p>"),ga=o("<div>"),pa=o("<button type=button>安装");const ba=[{id:"all",label:"全部"},{id:"materials",label:"材料"},{id:"weather",label:"气象"},{id:"fluid",label:"流体"},{id:"bio",label:"生信"}],va=[{id:"scenario",label:"场景",title:"场景库"},{id:"onemodel",label:"onemodel",title:"模型库"},{id:"hpc",label:"HPC 软件",title:"软件库"},{id:"onedata",label:"onedata",title:"数据集"},{id:"oneskills",label:"oneskills",title:"技能库"}],ya=[{id:"cards",label:"卡片"},{id:"list",label:"列表"}],We="os-capability-view-mode";function ke(e){return e==="all"||e==="materials"||e==="weather"||e==="fluid"||e==="bio"?e:"materials"}function ha(e){return e==="materials"||e==="weather"||e==="fluid"||e==="bio"?e:"materials"}function ma(e,l){const r=e.split("?")[0]??e;return new RegExp(`^${Te.capabilities}/[^/]+`).test(r)?!new URLSearchParams(l).has("domain"):!1}function Pa(e){const l=Ze(),r=se(),c=Se(l.pathname,l.search),[t,n]=et({domainId:ke(c.domainId),categoryId:c.categoryId,scenarioQuery:"",activeScenarioId:"",uploadPage:null,scenarioCatalogTick:0}),u=oe(),v=de(),f=ce();ae(()=>{const s=f.current?.http.url;s&&Rt(s).then(()=>n("scenarioCatalogTick",L=>L+1)).catch(()=>{})});const _=s=>{r(Ee(s.categoryId,s.categoryId==="oneskills"?void 0:s.domainId),{replace:!0})};tt(()=>{const s=Se(l.pathname,l.search);if(ma(l.pathname,l.search)){n("categoryId",s.categoryId);return}n({domainId:ke(s.domainId),categoryId:s.categoryId})});const $=B(()=>(at(),t.domainId==="all"?he():he(t.domainId))),p=B(()=>$().find(s=>s.id===t.categoryId)??$()[0]),d=B(()=>(t.scenarioCatalogTick,lt(t.domainId,t.scenarioQuery))),b=B(()=>{if(t.scenarioCatalogTick,!!t.activeScenarioId)return me(t.activeScenarioId)}),w=s=>{n({categoryId:s,activeScenarioId:"",scenarioQuery:s==="scenario"?t.scenarioQuery:""}),_({domainId:t.domainId,categoryId:s})},S=()=>n("activeScenarioId",""),I=()=>({navigate:r,isLoggedIn:!!G(),path:u.data.path,recent:ue(u.data.project),lastCodeWorkspace:f.projects.lastCode(),openProject:s=>v.projects.open(s),touchCode:s=>f.projects.touchCode(s)});ae(()=>{const s=it();if(s)try{if(s.type==="install"){if(s.resourceId==="oneskills"){n("categoryId","oneskills"),_({domainId:t.domainId,categoryId:"oneskills"});return}if(s.resourceId.startsWith("__"))return;Ue({resourceId:s.resourceId,...I()});return}if(s.type==="prompt"&&s.prompt.trim()){ot({prompt:s.prompt,title:s.title||"能力中心任务",workflow:s.workflow,...I()});return}if(s.type==="scenario-run"){const L=me(s.scenarioId);if(!L)return;fe({scenario:L,values:s.values,...I()});return}s.type==="wizard"&&dt({resourceId:s.resourceId,scenarioId:s.scenarioId,values:s.values,prompt:s.prompt,...I()})}catch{}});const E=(s,L)=>{fe({scenario:s,values:L.values,...I()})};return(()=>{var s=qt(),L=s.firstChild,F=L.firstChild,q=F.nextSibling,Q=L.nextSibling;return a(F,i(m,{get when(){return t.categoryId==="oneskills"},get fallback(){return[Ft(),(()=>{var k=zt();return a(k,()=>X(t.domainId)),k})(),(()=>{var k=Bt();return a(k,()=>t.categoryId==="scenario"?"切换领域后,下方场景同步刷新":"切换领域后,下方模型、HPC 软件内容同步刷新"),k})()]},get children(){return[jt(),Mt(),Ht()]}})),a(L,i(m,{get when(){return t.categoryId!=="oneskills"},get children(){var k=Wt();return a(k,i(H,{each:ba,children:x=>(()=>{var U=Gt();return U.$$click=()=>{n({domainId:x.id,activeScenarioId:"",scenarioQuery:""}),_({domainId:x.id,categoryId:t.categoryId})},a(U,()=>x.label),P(g=>{var C=x.id===t.domainId,y=x.id===t.domainId;return C!==g.e&&U.classList.toggle("is-active",g.e=C),y!==g.t&&T(U,"aria-pressed",g.t=y),g},{e:void 0,t:void 0}),U})()})),k}}),q),a(q,i(H,{each:va,children:k=>(()=>{var x=Nt(),U=x.firstChild,g=U.firstChild,C=g.nextSibling;return x.$$click=()=>w(k.id),a(g,()=>k.label),a(C,()=>k.title),P(y=>{var D=t.categoryId===k.id,R=t.categoryId===k.id;return D!==y.e&&x.classList.toggle("is-active",y.e=D),R!==y.t&&T(x,"aria-selected",y.t=R),y},{e:void 0,t:void 0}),x})()})),a(Q,i(m,{get when(){return t.categoryId==="oneskills"},get children(){return i(Et,{})}}),null),a(Q,i(m,{get when(){return t.categoryId==="scenario"},get children(){var k=Qt(),x=k.firstChild,U=x.firstChild,g=U.nextSibling,C=g.nextSibling,y=C.firstChild,D=C.nextSibling,R=D.firstChild;return a(g,()=>d().length),a(C,()=>X(t.domainId),y),R.$$input=j=>n("scenarioQuery",j.currentTarget.value),a(k,i(m,{get when(){return d().length>0},get fallback(){return(()=>{var j=Vt();return a(j,(()=>{var h=V(()=>!!t.scenarioQuery.trim());return()=>h()?`未找到匹配「${t.scenarioQuery.trim()}」的场景。`:`当前「${X(t.domainId)}」领域暂无场景卡片。`})()),j})()},get children(){var j=At();return a(j,i(H,{get each(){return d()},children:h=>(()=>{var O=Kt(),A=O.firstChild,K=A.firstChild,Z=K.nextSibling,N=A.nextSibling,Y=N.nextSibling,W=Y.firstChild,be=W.nextSibling,J=be.nextSibling,qe=J.firstChild,ve=J.nextSibling,Fe=ve.firstChild;return O.$$click=()=>n("activeScenarioId",h.scenario_id),a(K,()=>h.name),a(Z,()=>h.scenario_id),a(N,()=>h.problem_and_applicability),a(W,()=>h.type),a(be,()=>h.model),a(Y,i(m,{get when(){return h.HPC},get children(){var ye=pe();return a(ye,()=>h.HPC),ye}}),J),a(J,()=>h.workflow_steps?.length||h.workflow.length,qe),a(ve,()=>h.user_input.length,Fe),O})()})),j}}),null),P(()=>R.value=t.scenarioQuery),k}}),null),a(Q,i(m,{get when(){return t.categoryId==="onemodel"||t.categoryId==="hpc"},get children(){return i(fa,{get category(){return p()},get domainId(){return t.domainId},get domainLabel(){return X(t.domainId)},get onUpload(){return t.categoryId==="onemodel"?()=>n("uploadPage","models"):void 0}})}}),null),a(Q,i(m,{get when(){return t.categoryId==="onedata"},get children(){return i($a,{get category(){return p()}})}}),null),a(s,i(m,{get when(){return b()},children:k=>i(ut,{get scenario(){return k()},onClose:S,onSubmit:x=>E(k(),x)})}),null),a(s,i(vt,{get open(){return t.uploadPage!==null},page:"models",get domain(){return ha(t.domainId)},onClose:()=>n("uploadPage",null),onSaved:()=>{n({categoryId:"onemodel",uploadPage:null,activeScenarioId:""}),_({domainId:t.domainId,categoryId:"onemodel"})}}),null),a(s,()=>e.children,null),s})()}function $a(e){return(()=>{var l=Yt(),r=l.firstChild,c=r.firstChild;return a(c,()=>e.category.copy.replace(/[。.]$/,"")),l})()}function fa(e){const[l,r]=M(""),[c,t]=M(wa()),n=()=>({category:e.category.id,domain:e.domainId}),u=B(()=>{const f=l().trim().toLowerCase();return f?e.category.items.filter(_=>[_.name,_.blurb,..._.tags].some($=>$.toLowerCase().includes(f))):e.category.items}),v=f=>{t(f),Ia(f)};return(()=>{var f=ea(),_=f.firstChild,$=_.firstChild;return a($,()=>e.category.copy.replace(/[。.]$/,"")),a(_,i(m,{get when(){return e.onUpload},get children(){var p=Jt();return Re(p,"click",e.onUpload,!0),p}}),null),a(f,i(m,{get when(){return e.category.items.length>0},get fallback(){return(()=>{var p=ta(),d=p.firstChild,b=d.nextSibling,w=b.nextSibling,S=w.nextSibling;return S.nextSibling,a(p,()=>e.domainLabel,b),a(p,()=>e.category.id==="hpc"?" HPC 软件":"模型",S),p})()},get children(){return[(()=>{var p=Zt(),d=p.firstChild,b=d.firstChild,w=b.nextSibling;return a(p,i(m,{get when(){return e.category.items.length>=6},get children(){var S=Xt(),I=S.firstChild,E=I.nextSibling;return E.$$input=s=>r(s.currentTarget.value),P(()=>E.value=l()),S}}),d),a(b,(()=>{var S=V(()=>u().length===e.category.items.length);return()=>S()?`共 ${e.category.items.length} 项`:`${u().length} / ${e.category.items.length} 项`})()),a(w,i(H,{each:ya,children:S=>(()=>{var I=aa();return I.$$click=()=>v(S.id),a(I,()=>S.label),P(E=>{var s=c()===S.id,L=c()===S.id;return s!==E.e&&T(I,"aria-selected",E.e=s),L!==E.t&&I.classList.toggle("is-active",E.t=L),E},{e:void 0,t:void 0}),I})()})),p})(),i(m,{get when(){return u().length>0},get fallback(){return la()},get children(){return[i(m,{get when(){return c()==="list"},get children(){return i(_a,{get items(){return u()},get catalog(){return n()}})}}),i(m,{get when(){return c()==="cards"},get children(){return i(Ca,{get items(){return u()},get catalog(){return n()}})}})]}})]}}),null),f})()}function _a(e){return(()=>{var l=ia();return a(l,i(H,{get each(){return e.items},children:r=>{const c=()=>ge(r);return(()=>{var t=ra();return a(t,i(Sa,{item:r}),null),a(t,i(m,{get when(){return c()},get fallback(){return i(Ae,{})},get children(){return i(Qe,{item:r,get catalog(){return e.catalog}})}}),null),P(n=>{var u=r.ownership==="private",v=!c(),f=c()?void 0:!0,_=c()?void 0:"暂无 OneScience 源码或魔搭映射,暂不可用";return u!==n.e&&t.classList.toggle("is-private",n.e=u),v!==n.t&&t.classList.toggle("is-unavailable",n.t=v),f!==n.a&&T(t,"aria-disabled",n.a=f),_!==n.o&&T(t,"title",n.o=_),n},{e:void 0,t:void 0,a:void 0,o:void 0}),t})()}})),l})()}function Ca(e){return(()=>{var l=na();return a(l,i(H,{get each(){return e.items},children:r=>{const c=()=>ge(r);return(()=>{var t=ca(),n=t.firstChild,u=n.firstChild,v=u.firstChild,f=v.firstChild,_=u.nextSibling;return a(f,()=>r.name),a(v,i(m,{get when(){return r.ownership==="private"},get children(){return Me()}}),null),a(v,i(m,{get when(){return!c()},get children(){return He()}}),null),a(u,i(m,{get when(){return r.tags.length>0},get children(){var $=sa();return a($,i(H,{get each(){return r.tags},children:p=>(()=>{var d=pe();return a(d,p),d})()})),$}}),null),a(_,()=>r.blurb),a(t,i(m,{get when(){return c()},get fallback(){return i(Ae,{variant:"card"})},get children(){return i(Qe,{item:r,variant:"card",get catalog(){return e.catalog}})}}),null),P($=>{var p=r.ownership==="private",d=!c(),b=c()?void 0:!0,w=c()?void 0:"暂无 OneScience 源码或魔搭映射,暂不可用";return p!==$.e&&t.classList.toggle("is-private",$.e=p),d!==$.t&&t.classList.toggle("is-unavailable",$.t=d),b!==$.a&&T(t,"aria-disabled",$.a=b),w!==$.o&&T(t,"title",$.o=w),$},{e:void 0,t:void 0,a:void 0,o:void 0}),t})()}})),l})()}function Ae(e){return(()=>{var l=oa();return P(()=>l.classList.toggle("os-client-capability-unavailable-hint-card",e.variant==="card")),l})()}function Sa(e){return(()=>{var l=ua(),r=l.firstChild,c=r.firstChild,t=r.nextSibling;return a(c,()=>e.item.name),a(r,i(m,{get when(){return e.item.ownership==="private"},get children(){return Me()}}),null),a(r,i(m,{get when(){return!ge(e.item)},get children(){return He()}}),null),a(t,()=>e.item.blurb),a(l,i(m,{get when(){return e.item.tags.length>0},get children(){var n=da();return a(n,i(H,{get each(){return e.item.tags},children:u=>(()=>{var v=pe();return a(v,u),v})()})),n}}),null),l})()}function Qe(e){const l=()=>e.catalog?{category:e.catalog.category,domain:e.catalog.domain}:void 0;return(()=>{var r=ga();return a(r,i($e,{get href(){return rt(e.item.id,l())},children:"详情"}),null),a(r,i(ka,{get item(){return e.item}}),null),a(r,i($e,{get href(){return nt(e.item.id,void 0,l())},"data-primary":"true",children:"使用"}),null),P(c=>{var t=e.variant!=="card",n=e.variant==="card";return t!==c.e&&r.classList.toggle("os-client-capability-catalog-actions",c.e=t),n!==c.t&&r.classList.toggle("os-client-capability-actions",c.t=n),c},{e:void 0,t:void 0}),r})()}function ka(e){const l=se(),r=oe(),c=de(),t=ce(),n=()=>ne(e.item);return(()=>{var u=pa();return u.$$click=()=>{n()&&Ue({resourceId:e.item.id,navigate:l,isLoggedIn:!!G(),path:r.data.path,recent:ue(r.data.project),lastCodeWorkspace:t.projects.lastCode(),openProject:v=>c.projects.open(v),touchCode:v=>t.projects.touchCode(v)})},P(v=>{var f=!n(),_=n()?void 0:"暂无魔搭安装包";return f!==v.e&&(u.disabled=v.e=f),_!==v.t&&T(u,"title",v.t=_),v},{e:void 0,t:void 0}),u})()}function wa(){if(typeof localStorage>"u")return"cards";const e=localStorage.getItem(We);return e==="cards"||e==="list"?e:"cards"}function Ia(e){typeof localStorage>"u"||localStorage.setItem(We,e)}ie(["input","click"]);export{Pa as CapabilityCenterPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{W as S,V as w,T as D,bC as $,B as o,dD as k,b3 as C,dl as _,b as c,i as l,dp as P,bT as j,m as F,bU as M,t as T}from"./index-Cxa2Vk80.js";var z=T('<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 E(e){const i=S(),f=w(),b=D(),a=$(),s=o(()=>k(e.project.worktree)),u=o(()=>e.project.name||s()),x=o(()=>`${e.project.worktree.replace(/\\/g,"/").replace(/\/+$/,"")}/`),[m,h]=C({name:u()}),d=o(()=>{const t=m.name.trim();return t?t!==u():!1}),r=_(()=>({mutationFn:async()=>{const t=m.name.trim(),n=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:n,icon:{color:e.project.icon?.color||"",override:e.project.icon?.override||""},commands:{start:e.project.commands?.start??""}}),i.close();return}b.project.meta(e.project.worktree,{name:n,icon:e.project.icon,commands:e.project.commands}),i.close()}}));function v(t){t.preventDefault(),!(r.isPending||!d())&&r.mutate()}return c(M,{get title(){return a.t("dialog.project.rename.title")},class:"os-client-project-create w-full max-w-[480px] mx-auto",get children(){var t=z(),n=t.firstChild,g=n.firstChild,p=n.nextSibling;return t.addEventListener("submit",v),l(n,c(P,{autofocus:!0,type:"text",get label(){return a.t("dialog.project.rename.name")},get placeholder(){return s()},get value(){return m.name},onChange:y=>h("name",y)}),g),l(g,()=>a.t("dialog.project.rename.path",{path:x()})),l(p,c(j,{type:"button",variant:"ghost",size:"large",onClick:()=>i.close(),get children(){return a.t("common.cancel")}}),null),l(p,c(j,{type:"submit",variant:"primary",size:"large",get disabled(){return r.isPending||!d()},get children(){return F(()=>!!r.isPending)()?a.t("common.saving"):a.t("common.confirm")}}),null),t}})}export{E as DialogEditProject};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{dZ as v,R as D,Q as k,d_ as _,c0 as b,d$ as P,W as w,bC as F,B as $,b as m,dm as L,i as u,bU as C,e0 as I,p as T,bk as g,dS as q,t as E}from"./index-Cxa2Vk80.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 R=()=>{const i=v(),p=D(),f=k(),c=_(),l=b(),h=P(),x=w(),n=F(),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()}),S=t=>{if(!t)return;const a=i.id;if(!a)return;const o=c.data.part[t.id]??[],s=I(o,{directory:l.directory,attachmentName:n.t("common.attachment")}),d=T(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:d,id:e.data.id}),f(q(p.pathname,d,e.data.id))}).catch(e=>{const r=e instanceof Error?e.message:String(e);g({title:n.t("common.requestFailed"),description:r})})};return m(C,{get title(){return n.t("command.session.fork")},get children(){return m(L,{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:S,children:t=>(()=>{var a=K(),o=a.firstChild,s=o.nextSibling;return u(o,()=>t.text),u(s,()=>t.time),a})()})}})};export{R as DialogFork};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{W as oe,bC as se,O as ce,T as de,c as g,B as x,dF as ue,dG as ge,dH as pe,a as fe,dI as he,b as n,i as t,bT as k,C as J,S as p,m as K,dJ as L,dK as V,F as xe,cg as me,bU as ve,t as f,dL as be,dM as we,bk as ye}from"./index-Cxa2Vk80.js";var _e=f('<p class="text-12-regular text-icon-warning-base">'),U=f('<p class="text-12-regular text-text-weak">'),$e=f('<ul class="max-h-36 overflow-auto text-12-regular text-text-weak font-mono">'),Se=f('<div class="flex flex-col gap-2 rounded-md border border-border-weak-base bg-background-weak px-3 py-3"><p class="text-13-medium text-text-strong">'),ke=f("<p class=text-text-critical-base>"),je=f('<p class="text-12-regular text-text-critical-base whitespace-pre-wrap">'),Ce=f('<div class="flex flex-col gap-5 p-6 pt-0"><div class="flex flex-col gap-2"><p class="text-12-regular text-text-weak"></p><p class="text-13-medium text-text-strong break-all font-mono">/</p><p class="text-12-regular text-text-weak"></p></div><div class="flex flex-wrap gap-2"><input type=file class=hidden multiple><input type=file class=hidden multiple></div><div class="flex flex-col gap-1 text-12-regular text-text-weak"><p></p></div><div class="flex justify-end gap-2">'),Ee=f("<li class=truncate>");function Ue(w){const F=oe(),r=se(),T=ce(),X=de(),[s,q]=g([]),[Q,Y]=g(!1),[B,Z]=g(!1),[D,I]=g(),[ee,j]=g(!0),[h,P]=g(!1),[z,A]=g({done:0,total:0,written:0,skipped:0,failed:0}),[R,$]=g("");let H,M;const te=x(()=>{const l=X.data.path.home,a=w.directory;return l&&a.startsWith(l)?`~${a.slice(l.length)}`:a}),C=x(()=>ue(s())),S=x(()=>ge(s())),O=x(()=>{const l=D();return l===void 0?!1:C()>l}),W=x(()=>s().length>0&&!h()&&!O()),E=x(()=>s().slice(0,pe)),re=x(()=>s().length>0&&!S());fe(()=>{const l=w.directory,a=T.current?.http;if(!l||!a){j(!1);return}let i=!1;return j(!0),he(a.url,l).then(c=>{i||I(c.availableBytes)}).catch(()=>{i||I(void 0)}).finally(()=>{i||j(!1)}),()=>{i=!0}});const G=l=>{if(!l?.length)return;$("");const a=be(l);q(a.entries),Y(a.truncated),a.truncated&&$(r.t("dialog.project.upload.tooManyFiles",{max:String(V),selected:String(a.totalSelected)}))},le=async()=>{const l=T.current?.http;if(!l||!W())return;const a=s();P(!0),$(""),A({done:0,total:a.length,written:0,skipped:0,failed:0});let i=0,c=0,m=0;const y=[];for(let d=0;d<a.length;d+=1){const u=a[d];try{(await we(l.url,w.directory,{path:u.path,file:u.file,overwrite:B()})).status==="written"?i+=1:c+=1}catch(v){m+=1;const b=v instanceof Error?v.message:r.t("dialog.project.upload.failed");y.length<3&&y.push(`${u.path}: ${b}`)}A({done:d+1,total:a.length,written:i,skipped:c,failed:m})}if(P(!1),m===0){ye({title:r.t("toast.project.upload.success",{written:String(i),skipped:String(c)})}),w.onUploaded?.(),F.close();return}$([r.t("dialog.project.upload.partialFailed",{written:String(i),skipped:String(c),failed:String(m)}),...y].join(`
|
|
2
|
-
`)),(i>0||c>0)&&w.onUploaded?.()};return n(ve,{get title(){return r.t("command.project.upload")},class:"w-full max-w-[520px] mx-auto",get children(){var l=Ce(),a=l.firstChild,i=a.firstChild,c=i.nextSibling,m=c.firstChild,y=c.nextSibling,d=a.nextSibling,u=d.firstChild,v=u.nextSibling,b=d.nextSibling,ae=b.firstChild,_=b.nextSibling;return t(i,()=>r.t("dialog.project.upload.destinationLabel")),t(c,te,m),t(y,()=>r.t("dialog.project.upload.destinationHint")),t(d,n(k,{type:"button",variant:"secondary",size:"large",get disabled(){return h()},onClick:()=>H?.click(),get children(){return r.t("dialog.project.upload.pickFiles")}}),u),t(d,n(k,{type:"button",variant:"secondary",size:"large",get disabled(){return h()},onClick:()=>M?.click(),get children(){return r.t("dialog.project.upload.pickFolder")}}),u),u.addEventListener("change",e=>{G(e.currentTarget.files),e.currentTarget.value=""}),J(e=>{H=e},u),v.addEventListener("change",e=>{G(e.currentTarget.files),e.currentTarget.value=""}),J(e=>{M=e,e&&e.setAttribute("webkitdirectory","")},v),t(l,n(p,{get when(){return s().length>0},get children(){var e=Se(),ne=e.firstChild;return t(ne,(()=>{var o=K(()=>!!S());return()=>o()?r.t("dialog.project.upload.folderSummary",{folder:S(),count:String(s().length),size:L(C())}):r.t("dialog.project.upload.summary",{count:String(s().length),size:L(C())})})()),t(e,n(p,{get when(){return Q()},get children(){var o=_e();return t(o,()=>r.t("dialog.project.upload.truncatedHint",{max:String(V)})),o}}),null),t(e,n(p,{get when(){return S()},get children(){var o=U();return t(o,()=>r.t("dialog.project.upload.folderHint")),o}}),null),t(e,n(p,{get when(){return re()},get children(){return[(()=>{var o=$e();return t(o,n(xe,{get each(){return E()},children:ie=>(()=>{var N=Ee();return t(N,()=>ie.path),N})()})),o})(),n(p,{get when(){return s().length>E().length},get children(){var o=U();return t(o,()=>r.t("dialog.project.upload.moreFiles",{count:String(s().length-E().length)})),o}})]}}),null),e}}),b),t(ae,()=>r.t("dialog.project.upload.diskSpace",{space:ee()?r.t("common.loading"):L(D())})),t(b,n(p,{get when(){return O()},get children(){var e=ke();return t(e,()=>r.t("dialog.project.upload.diskInsufficient")),e}}),null),t(l,n(me,{get checked(){return B()},onChange:Z,get disabled(){return h()},get children(){return r.t("dialog.project.upload.overwrite")}}),_),t(l,n(p,{get when(){return h()},get children(){var e=U();return t(e,()=>r.t("dialog.project.upload.progress",{done:String(z().done),total:String(z().total)})),e}}),_),t(l,n(p,{get when(){return R()},get children(){var e=je();return t(e,R),e}}),_),t(_,n(k,{type:"button",variant:"ghost",size:"large",get disabled(){return h()},onClick:()=>F.close(),get children(){return r.t("common.cancel")}}),null),t(_,n(k,{type:"button",variant:"primary",size:"large",get disabled(){return!W()},onClick:()=>void le(),get children(){return K(()=>!!h())()?r.t("dialog.project.upload.uploading"):r.t("dialog.project.upload.confirm")}}),null),l}})}export{Ue as DialogProjectUpload};
|