dsh-artifact-studio 0.8.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +72 -10
  2. package/THIRD_PARTY_NOTICES.md +57 -0
  3. package/assets/canvas.engine.js +72 -72
  4. package/assets/canvas.viewer.js +6415 -0
  5. package/client.canvas.js +1 -1
  6. package/client.doc.js +67 -79
  7. package/client.js +313 -291
  8. package/client.sheet.js +218 -0
  9. package/dist/contract.js +32 -5
  10. package/dist/host/lib/assets.js +12 -0
  11. package/dist/host/lib/brief.js +127 -0
  12. package/dist/host/lib/checks.js +62 -8
  13. package/dist/host/lib/design-catalog.js +149 -0
  14. package/dist/host/lib/design-render.js +37 -0
  15. package/dist/host/lib/design-system.js +1 -1
  16. package/dist/host/lib/export.js +123 -5
  17. package/dist/host/lib/fsutil.js +41 -0
  18. package/dist/host/lib/generation.js +36 -0
  19. package/dist/host/lib/guide.js +130 -0
  20. package/dist/host/lib/paths.js +2 -1
  21. package/dist/host/lib/recipes.js +224 -0
  22. package/dist/host/lib/rpc.js +20 -5
  23. package/dist/host/lib/service.js +253 -24
  24. package/dist/host/lib/skill.js +59 -18
  25. package/dist/host/lib/store.js +107 -25
  26. package/dist/host/lib/svg-model.js +85 -0
  27. package/dist/host/lib/svg-viewer.js +380 -0
  28. package/dist/host/lib/tools.js +346 -35
  29. package/dist/host/lib/validate.js +24 -0
  30. package/dist/host/lib/viewer.js +150 -0
  31. package/dist/host/lib/xlsx.js +314 -0
  32. package/dist/host/worker/design-worker.js +71 -5
  33. package/dist/host/worker/page-model.js +169 -0
  34. package/dist/html-tags.js +51 -0
  35. package/dist/kit.js +224 -0
  36. package/dist/render.js +10 -3
  37. package/dist/sheet/formula.js +475 -0
  38. package/dist/sheet/functions.js +463 -0
  39. package/dist/sheet/index.js +9 -0
  40. package/dist/sheet/model.js +695 -0
  41. package/dist/sheet/operations.js +384 -0
  42. package/dist/sheet/output.js +182 -0
  43. package/package.json +15 -3
package/client.js CHANGED
@@ -4,39 +4,60 @@ window.__ModuleLoader__.load({
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
6
  globalThis.__dshArtifactsRequireAsync = require.async;
7
- "use strict";var Pn=Object.create;var Tt=Object.defineProperty;var Ln=Object.getOwnPropertyDescriptor;var Mn=Object.getOwnPropertyNames;var On=Object.getPrototypeOf,jn=Object.prototype.hasOwnProperty;var Fn=(e,t)=>{for(var a in t)Tt(e,a,{get:t[a],enumerable:!0})},qa=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Mn(t))!jn.call(e,n)&&n!==a&&Tt(e,n,{get:()=>t[n],enumerable:!(r=Ln(t,n))||r.enumerable});return e};var Bn=(e,t,a)=>(a=e!=null?Pn(On(e)):{},qa(t||!e||!e.__esModule?Tt(a,"default",{value:e,enumerable:!0}):a,e)),Hn=e=>qa(Tt({},"__esModule",{value:!0}),e);var ni={};Fn(ni,{ARTIFACT_ID:()=>ut,ARTIFACT_KIND:()=>Sa,ArtifactCard:()=>Ta,ArtifactTab:()=>wa,CARD_TOOLS:()=>pn,DocView:()=>Lt,GALLERY_ID:()=>Vt,GALLERY_KIND:()=>Na,PANEL_ID:()=>Ze,apply:()=>ri,inject:()=>Jo});module.exports=Hn(ni);var dn=require("@deepseek-ai/dsh-client-ui-primitives");var Vn=["page","doc","design"];function _n(e){return Vn.some(t=>t===e)}var Ka={page:["html"],doc:["md","docx","html"],design:["png","svg","fig"]};var St=/^art_(ws|lib)_[a-z0-9]{10,32}$/;var it=["primary","accent","surface","text","muted","background","raised","border","control","action","actionText","focus","success","warning","danger"];function sa(e){if(e===null||typeof e!="object")return!1;let t={...e};return typeof t.pages=="number"&&typeof t.nodes=="number"&&t.types!==null&&typeof t.types=="object"&&Array.isArray(t.fonts)&&t.fonts.every(a=>typeof a=="string")&&Array.isArray(t.warnings)&&t.warnings.every(a=>typeof a=="string")}function la(e){if(e===null||typeof e!="object")return!1;let t="origin"in e?e.origin:void 0,a="action"in e?e.action:void 0;return(t==="agent"||t==="user")&&(a==="create"||a==="update"||a==="restore")}function It(e){if(e===null||typeof e!="object")return!1;let t={...e};return t.schemaVersion===1&&typeof t.id=="string"&&St.test(t.id)&&(t.scope==="workspace"||t.scope==="library")&&typeof t.type=="string"&&_n(t.type)&&typeof t.title=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string"&&typeof t.version=="number"&&Number.isInteger(t.version)&&t.version>=1&&typeof t.contentFile=="string"&&typeof t.contentBytes=="number"&&typeof t.contentHash=="string"&&la(t.source)}var Nt="dsh-resource://artifact/",Ct="data-artifact-theme";function K(e){return e.scope==="workspace"?`${Nt}workspace/${encodeURIComponent(e.workspaceId)}/${e.id}`:`${Nt}library/${e.id}`}function we(e){if(typeof e!="string"||!e.startsWith(Nt))return;let t=e.slice(Nt.length).split("/");if(t[0]==="library"&&t.length===2){let a=t[1]??"";return St.test(a)&&a.startsWith("art_lib_")?{scope:"library",id:a}:void 0}if(t[0]==="workspace"&&t.length===3){let a=t[2]??"",r;try{r=decodeURIComponent(t[1]??"")}catch{return}return r===""||!St.test(a)||!a.startsWith("art_ws_")?void 0:{scope:"workspace",workspaceId:r,id:a}}}function Ya(e){if(St.test(e))return e.startsWith("art_ws_")?"workspace":"library"}function ia(e){return"--artifact-color-"+e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Qa(e){let t=[];for(let r of it)t.push(`${ia(r)}: ${e.colors[r]};`);t.push(`--artifact-font-family: ${e.typography.fontFamily};`),t.push(`--artifact-font-display: ${e.typography.displayFamily};`),t.push(`--artifact-font-mono: ${e.typography.monoFamily};`),e.typography.scale.forEach((r,n)=>t.push(`--artifact-font-size-${n}: ${r}px;`)),t.push(`--artifact-space-unit: ${e.spacing.unit}px;`),e.spacing.scale.forEach((r,n)=>t.push(`--artifact-space-${n}: ${r}px;`));for(let[r,n]of Object.entries(e.radius))t.push(`--artifact-radius-${r}: ${n}px;`);let a=it.map(r=>`${ia(r)}: ${e.colorsDark[r]};`).join(`
7
+ "use strict";var Mo=Object.create;var Bt=Object.defineProperty;var Po=Object.getOwnPropertyDescriptor;var Oo=Object.getOwnPropertyNames;var jo=Object.getPrototypeOf,Fo=Object.prototype.hasOwnProperty;var Bo=(e,t)=>{for(var a in t)Bt(e,a,{get:t[a],enumerable:!0})},hr=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Oo(t))!Fo.call(e,n)&&n!==a&&Bt(e,n,{get:()=>t[n],enumerable:!(r=Po(t,n))||r.enumerable});return e};var Ho=(e,t,a)=>(a=e!=null?Mo(jo(e)):{},hr(t||!e||!e.__esModule?Bt(a,"default",{value:e,enumerable:!0}):a,e)),_o=e=>hr(Bt({},"__esModule",{value:!0}),e);var Es={};Bo(Es,{ARTIFACT_ID:()=>Nt,ARTIFACT_KIND:()=>$a,ArtifactCard:()=>Ua,ArtifactTab:()=>Ga,CARD_TOOLS:()=>so,DocView:()=>ea,GALLERY_ID:()=>la,GALLERY_KIND:()=>Ka,PANEL_ID:()=>dt,apply:()=>As,inject:()=>Ns});module.exports=_o(Es);var io=require("@deepseek-ai/dsh-client-ui-primitives");var Vo=["page","doc","design","sheet"];function Wo(e){return Vo.some(t=>t===e)}var vr={page:["html"],doc:["md","docx","html"],design:["png","svg","fig","html","html-svg"],sheet:["csv","xlsx"]};var Ht=/^art_(ws|lib)_[a-z0-9]{10,32}$/,br=/^[a-z][a-z0-9-]{1,39}$/;var $e=["primary","accent","surface","text","muted","background","raised","border","control","action","actionText","focus","success","warning","danger"];function Aa(e){if(e===null||typeof e!="object")return!1;let t={...e};return typeof t.pages=="number"&&typeof t.nodes=="number"&&t.types!==null&&typeof t.types=="object"&&Array.isArray(t.fonts)&&t.fonts.every(a=>typeof a=="string")&&Array.isArray(t.warnings)&&t.warnings.every(a=>typeof a=="string")}function Ea(e){if(e===null||typeof e!="object")return!1;let t="origin"in e?e.origin:void 0,a="action"in e?e.action:void 0;return(t==="agent"||t==="user")&&(a==="create"||a==="update"||a==="restore"||a==="rebase")}function Wt(e){if(e===null||typeof e!="object")return!1;let t={...e};return t.schemaVersion===1&&typeof t.id=="string"&&Ht.test(t.id)&&(t.scope==="workspace"||t.scope==="library")&&typeof t.type=="string"&&Wo(t.type)&&typeof t.title=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string"&&typeof t.version=="number"&&Number.isInteger(t.version)&&t.version>=1&&typeof t.contentFile=="string"&&typeof t.contentBytes=="number"&&typeof t.contentHash=="string"&&Ea(t.source)&&(t.recipe===void 0||typeof t.recipe=="string"&&br.test(t.recipe))&&(t.generation===void 0||$t(t.generation))}var _t="dsh-resource://artifact/",Vt="data-artifact-theme";function ee(e){return e.scope==="workspace"?`${_t}workspace/${encodeURIComponent(e.workspaceId)}/${e.id}`:`${_t}library/${e.id}`}function He(e){if(typeof e!="string"||!e.startsWith(_t))return;let t=e.slice(_t.length).split("/");if(t[0]==="library"&&t.length===2){let a=t[1]??"";return Ht.test(a)&&a.startsWith("art_lib_")?{scope:"library",id:a}:void 0}if(t[0]==="workspace"&&t.length===3){let a=t[2]??"",r;try{r=decodeURIComponent(t[1]??"")}catch{return}return r===""||!Ht.test(a)||!a.startsWith("art_ws_")?void 0:{scope:"workspace",workspaceId:r,id:a}}}function yr(e){if(Ht.test(e))return e.startsWith("art_ws_")?"workspace":"library"}function Ra(e){return"--artifact-color-"+e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function wr(e){let t=[];for(let r of $e)t.push(`${Ra(r)}: ${e.colors[r]};`);t.push(`--artifact-font-family: ${e.typography.fontFamily};`),t.push(`--artifact-font-display: ${e.typography.displayFamily};`),t.push(`--artifact-font-mono: ${e.typography.monoFamily};`),e.typography.scale.forEach((r,n)=>t.push(`--artifact-font-size-${n}: ${r}px;`)),t.push(`--artifact-space-unit: ${e.spacing.unit}px;`),e.spacing.scale.forEach((r,n)=>t.push(`--artifact-space-${n}: ${r}px;`));for(let[r,n]of Object.entries(e.radius))t.push(`--artifact-radius-${r}: ${n}px;`);let a=$e.map(r=>`${Ra(r)}: ${e.colorsDark[r]};`).join(`
8
8
  `);return[`:root {
9
9
  ${t.join(`
10
10
  `)}
11
- }`,`:root[${Ct}="dark"] {
11
+ }`,`:root[${Vt}="dark"] {
12
12
  color-scheme: dark;
13
13
  ${a}
14
14
  }`,`@media (prefers-color-scheme: dark) {
15
- :root[${Ct}="auto"] {
15
+ :root[${Vt}="auto"] {
16
16
  color-scheme: dark;
17
17
  ${a.replace(/\n /g,`
18
18
  `)}
19
19
  }
20
20
  }`].join(`
21
- `)}function Xa(e,t){let a=t?e.colorsDark:e.colors,r={"--artifact-font-family":e.typography.fontFamily,"--artifact-font-display":e.typography.displayFamily,"--artifact-font-mono":e.typography.monoFamily};for(let n of it)r[ia(n)]=a[n];e.typography.scale.forEach((n,o)=>{r[`--artifact-font-size-${o}`]=`${n}px`}),e.spacing.scale.forEach((n,o)=>{r[`--artifact-space-${o}`]=`${n}px`});for(let[n,o]of Object.entries(e.radius))r[`--artifact-radius-${n}`]=`${o}px`;return r}var Un="/artifacts-rpc",je=class extends Error{code;details;constructor(t,a,r){super(a),this.name="ArtifactCallError",this.code=t,this.details=r}},da=null;function Za(e){da=e}async function oe(e,t,a,r){if(da===null)throw new je("artifact/not-ready","The artifact channel is not ready.",{});let n=await da.rpc.call(Un,e,t,r);if(!n.ok)throw new je(n.error.code,n.error.message,n.error.details);if(!a(n.value))throw new je("artifact/bad-response",`The ${e} response has an unexpected shape.`,{});return n.value}function J(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Wn(e){return J(e)&&Array.isArray(e.items)&&e.items.every(It)&&typeof e.total=="number"&&typeof e.hasMore=="boolean"}function Gn(e){return J(e)&&It(e.manifest)&&typeof e.content=="string"&&typeof e.version=="number"&&typeof e.designCss=="string"&&Ja(e.design)&&(e.designInfo===void 0||sa(e.designInfo))}function At(e){return J(e)&&It(e.manifest)}function $n(e){return J(e)&&typeof e.version=="number"&&typeof e.createdAt=="string"&&typeof e.contentHash=="string"&&typeof e.contentBytes=="number"&&la(e.source)}function qn(e){return J(e)&&Array.isArray(e.versions)&&e.versions.every($n)}function Kn(e){return J(e)&&e.trashed===!0&&typeof e.trashPath=="string"}function Yn(e){return J(e)&&typeof e.path=="string"&&typeof e.bytes=="number"&&typeof e.fileName=="string"&&typeof e.mediaType=="string"&&typeof e.data=="string"}function Qn(e){return J(e)&&typeof e.html=="string"}function Xn(e){return J(e)&&typeof e.mediaType=="string"&&typeof e.data=="string"&&typeof e.width=="number"&&typeof e.height=="number"&&sa(e.info)}function Ja(e){return J(e)&&e.schemaVersion===1&&typeof e.name=="string"&&J(e.colors)&&J(e.colorsDark)&&J(e.typography)&&J(e.spacing)&&J(e.radius)}function ca(e){return J(e)&&Ja(e.tokens)&&(e.source==="workspace"||e.source==="library"||e.source==="default")&&typeof e.css=="string"}function le(e){return{scope:e.scope,...e.workspaceId===null?{}:{workspaceId:e.workspaceId}}}var U={list:(e,t,a)=>oe("list",{...le(e),...t},Wn,a),get:(e,t,a,r)=>oe("get",{...le(e),id:t,...a===void 0?{}:{version:a}},Gn,r),create:(e,t,a,r)=>oe("create",{...le(e),type:t,title:a,content:r},At),update:(e,t,a,r,n)=>oe("update",{...le(e),id:t,baseVersion:a,content:r,...n===void 0?{}:{title:n}},At),rename:(e,t,a,r)=>oe("update",{...le(e),id:t,baseVersion:a,title:r},At),remove:(e,t)=>oe("delete",{...le(e),id:t},Kn),history:(e,t,a)=>oe("history",{...le(e),id:t},qn,a),restore:(e,t,a,r)=>oe("restore",{...le(e),id:t,version:a,baseVersion:r},At),exportFile:(e,t,a,r)=>oe("export",{...le(e),id:t,format:a,version:r},Yn),printable:(e,t,a)=>oe("printable",{...le(e),id:t,version:a},Qn),preview:(e,t,a,r)=>oe("preview",{...le(e),id:t,...a===void 0?{}:{version:a}},Xn,r),designSystem:(e,t)=>oe("designSystem",e===null?{}:{workspaceId:e},ca,t),saveDesignSystem:(e,t)=>oe("saveDesignSystem",{...le(e),tokens:t},ca),clearDesignSystem:e=>oe("clearDesignSystem",{workspaceId:e,scope:"workspace"},ca)};function ee(e){return e instanceof je?e.code:void 0}function te(e){switch(e){case"artifact/not-found":return"error.notFound";case"artifact/stale-version":return"error.stale";case"artifact/too-large":return"error.tooLarge";case"artifact/no-workspace":return"error.noWorkspace";case"artifact/forbidden-path":return"error.forbidden";case"artifact/corrupt":return"error.corrupt";case"artifact/invalid-tokens":return"error.tokens";case"artifact/library-unavailable":return"error.library";case"artifact/design-invalid":return"error.designInvalid";case"artifact/design-icon-unsupported":return"error.designIcon";case"artifact/design-icon-not-found":return"error.designIconNotFound";case"artifact/design-render-failed":return"error.designRender";case"artifact/design-timeout":return"error.designTimeout";case"artifact/design-unavailable":return"error.designUnavailable";case"artifact/unsupported-type":return"error.unsupportedType";default:return"error.generic"}}function pa(e){if(!(!(e instanceof je)||!e.code.startsWith("artifact/design-")))return e.message===""?void 0:e.message}function er(e,t){return pa(t)??e(te(ee(t)))}function tr(e){let t=atob(e.data),a=new Uint8Array(t.length);for(let o=0;o<t.length;o+=1)a[o]=t.charCodeAt(o);let r=URL.createObjectURL(new Blob([a],{type:e.mediaType})),n=document.createElement("a");n.href=r,n.download=e.fileName,n.rel="noopener",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}var Ye=require("react");var lt=require("react");function Rt(e){let t=e,a=new Set;return{get:()=>t,set(r){t=r;for(let n of a)n()},subscribe(r){return a.add(r),()=>a.delete(r)}}}var qe=Rt(new Map);function ke(e,t){if(qe.get().get(e)===t)return;let a=new Map(qe.get());a.set(e,t),qe.set(a)}function ar(e){return qe.get().get(e)}function rr(e){return(0,lt.useSyncExternalStore)(qe.subscribe,()=>e===void 0?void 0:qe.get().get(e))}var st=Rt(new Map);function Fe(e,t){if((st.get().get(e)??0)>=t)return;let a=new Map(st.get());a.set(e,t),st.set(a)}function nr(e){return(0,lt.useSyncExternalStore)(st.subscribe,()=>e===void 0?0:st.get().get(e)??0)}var Et=Rt(0);function Te(){Et.set(Et.get()+1)}function Dt(){return(0,lt.useSyncExternalStore)(Et.subscribe,Et.get)}var Ke=Rt(null);function Z(e){Ke.set({seq:(Ke.get()?.seq??0)+1,message:e})}function or(){return(0,lt.useSyncExternalStore)(Ke.subscribe,Ke.get)}function ua(e){let t=Ke.get();t===null||e!==void 0&&t.seq!==e||Ke.set(null)}var Se=new Map,fa;function ir(){fa?.();let e=t=>{[...Se.values()].some(a=>a.getSnapshot().draft!==null||a.getSnapshot().saving)&&(t.preventDefault(),t.returnValue="")};return window.addEventListener("beforeunload",e),fa=()=>window.removeEventListener("beforeunload",e),fa}var ga=class{state={payload:null,draft:null,loading:!0,saving:!1,conflict:!1,revision:0};listeners=new Set;pending=null;readSequence=0;mounts=0;renameTo;where;key;address;constructor(t){this.address=t,this.key=K(t),this.where={scope:t.scope,workspaceId:t.scope==="workspace"?t.workspaceId:null}}getSnapshot=()=>this.state;subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));publish(t){this.state={...this.state,...t},this.state.draft!==null||this.state.saving?Se.set(this.key,this):this.mounts===0&&Se.get(this.key)===this&&Se.delete(this.key);for(let a of this.listeners)a()}attach(){return this.mounts+=1,Se.set(this.key,this),this.mounts===1&&(this.state.payload===null||this.state.draft===null)&&this.load(),()=>{this.mounts-=1,this.mounts===0&&this.state.draft===null&&!this.state.saving&&Se.get(this.key)===this&&Se.delete(this.key)}}async load(){let t=++this.readSequence;this.publish({loading:!0,failure:void 0,failureMessage:void 0});try{let a=await U.get(this.where,this.address.id);if(t!==this.readSequence)return;if(this.state.draft!==null&&this.state.payload!==null){this.publish({loading:!1,conflict:a.version!==this.state.payload.version});return}this.publish({payload:a,loading:!1,conflict:!1,failure:void 0,revision:this.state.revision+1}),ke(this.address.id,a.manifest.title),Fe(this.address.id,a.version)}catch(a){t===this.readSequence&&this.publish({loading:!1,failure:ee(a)??"artifact/storage-failure",failureMessage:void 0})}}edit(t){this.publish({draft:t,failure:void 0,failureMessage:void 0})}async discardAndReload(){this.pending!==null&&await this.pending,this.publish({draft:null,conflict:!1,failure:void 0,failureMessage:void 0}),await this.load()}externalVersion(t){this.state.payload===null||t<=this.state.payload.version||this.state.saving||(this.state.draft!==null?this.publish({conflict:!0}):this.load())}save(t){return t!==void 0&&(this.renameTo=t),this.pending!==null?this.pending:this.state.conflict||this.state.payload===null?Promise.resolve(!1):(this.pending=Promise.resolve().then(()=>this.drain()),this.pending)}async drain(){this.publish({saving:!0,failure:void 0,failureMessage:void 0});try{for(;this.state.draft!==null||this.renameTo!==void 0;){let t=this.state.payload;if(t===null||this.state.conflict)return!1;let a=this.state.draft,r=a??t.content,n=this.renameTo,{manifest:o}=await U.update(this.where,this.address.id,t.version,r,n);this.renameTo===n&&(this.renameTo=void 0),this.accept(o,r,this.state.draft===a?null:this.state.draft)}return!0}catch(t){let a=ee(t)??"artifact/storage-failure";return this.renameTo=void 0,this.publish({failure:a,failureMessage:a.startsWith("artifact/design-")?pa(t):void 0,conflict:a==="artifact/stale-version"}),!1}finally{this.pending=null,this.publish({saving:!1})}}accept(t,a,r){let n=this.state.payload;n!==null&&(++this.readSequence,this.publish({payload:{...n,manifest:t,content:a,version:t.version},draft:r,conflict:!1,loading:!1}),ke(t.id,t.title),Fe(t.id,t.version),Te())}};function sr(e){let t=K(e),a=(0,Ye.useMemo)(()=>{let n=Se.get(t);if(n!==void 0)return n;let o=new ga(e);return Se.set(t,o),o},[t]),r=(0,Ye.useSyncExternalStore)(a.subscribe,a.getSnapshot,a.getSnapshot);return(0,Ye.useEffect)(()=>a.attach(),[a]),{model:a,state:r}}var T=require("react"),b=require("@deepseek-ai/dsh-client-ui-primitives");var ce=require("react"),me=require("@deepseek-ai/dsh-client-ui-primitives");var mi=require("react"),w=require("react/jsx-runtime");function Y({children:e,size:t=16}){return(0,w.jsx)("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e})}var ct=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,w.jsx)("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,w.jsx)("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.5"}),(0,w.jsx)("path",{d:"M17 13.5v7M13.5 17h7"})]}),ge=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,w.jsx)("path",{d:"M3.5 8.5h17M9 13l-2 1.8L9 16.5M15 13l2 1.8-2 1.7"})]}),Ne=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("path",{d:"M6.5 3.5h7l4 4v13h-11z"}),(0,w.jsx)("path",{d:"M13.5 3.5v4h4M9 12h6M9 15.5h6"})]}),Be=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,w.jsx)("path",{d:"M3.5 14.5l4.5-4.5 4 4 3-3 5 5"}),(0,w.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.2"})]}),lr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("path",{d:"M20.5 12a8.5 8.5 0 1 1-8.5-8.5c4.7 0 8.5 3.4 8.5 7.6 0 2.1-1.7 3.8-3.8 3.8h-1.4c-1 0-1.9.8-1.9 1.8 0 .8.5 1.3.5 2.1 0 1-.7 1.7-1.9 1.7Z"}),(0,w.jsx)("circle",{cx:"7.6",cy:"10",r:"1.1",fill:"currentColor",stroke:"none"}),(0,w.jsx)("circle",{cx:"10",cy:"6.8",r:"1.1",fill:"currentColor",stroke:"none"}),(0,w.jsx)("circle",{cx:"14",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),(0,w.jsx)("circle",{cx:"17",cy:"10.2",r:"1.1",fill:"currentColor",stroke:"none"})]}),cr=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M7 3v18M17 3v18M3 7h18M3 17h18"})}),dr=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M5 6h14M12 6v13"})}),pr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"3.5",y:"3.5",width:"11",height:"11",rx:"2"}),(0,w.jsx)("circle",{cx:"15.5",cy:"15.5",r:"5"})]}),ur=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"3.5",y:"3.5",width:"12",height:"12",rx:"2"}),(0,w.jsx)("path",{d:"M8.5 8.5h12v12h-12z"})]}),fr=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M5 3.5l12.5 8.2-5.7 1.2L14 19l-2.4 1-2.1-5.1L5 18.2z"})}),gr=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M8 12V5.5a1.5 1.5 0 0 1 3 0V11M11 10.5V4.5a1.5 1.5 0 0 1 3 0V11M14 10.5V6.5a1.5 1.5 0 0 1 3 0V13c0 4-2.4 7-6 7-3.3 0-4.6-1.6-6.5-5.2L3.2 11.5a1.5 1.5 0 0 1 2.5-1.6L8 12.5"})}),mr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"4.5",y:"4.5",width:"15",height:"15",rx:"2"}),(0,w.jsx)("path",{d:"M8.5 4.5v15M15.5 4.5v15M4.5 8.5h15M4.5 15.5h15"})]}),yr=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M4.5 6.5h15M12 6.5v12"})}),br=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M4 9.5h9.5a5.5 5.5 0 0 1 0 11H9M4 9.5l4-4M4 9.5l4 4"})}),hr=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M20 9.5h-9.5a5.5 5.5 0 0 0 0 11H15M20 9.5l-4-4M20 9.5l-4 4"})}),vr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,w.jsx)("circle",{cx:"12",cy:"12",r:"2.6"})]}),xr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,w.jsx)("path",{d:"M4 4l16 16"})]}),wr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"5",y:"10.5",width:"14",height:"9.5",rx:"2"}),(0,w.jsx)("path",{d:"M8 10.5V7a4 4 0 0 1 8 0v3.5"})]}),kr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"5",y:"10.5",width:"14",height:"9.5",rx:"2"}),(0,w.jsx)("path",{d:"M8 10.5V7a4 4 0 0 1 7.4-2"})]});var B=require("react/jsx-runtime"),zt=null;function Zn(e){return e===null||typeof e!="object"?!1:typeof{...e}.mountDesignCanvas=="function"}async function Jn(){return zt??=(async()=>{let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")throw new Error("The canvas loader is unavailable.");let t=await e("./client.canvas.js");if(!Zn(t))throw new Error("The canvas engine did not load.");return t})(),zt.catch(()=>{zt=null}),zt}var eo=[{value:"select",label:"canvas.select",icon:(0,B.jsx)(fr,{size:16})},{value:"hand",label:"canvas.hand",icon:(0,B.jsx)(gr,{size:16})},{value:"frame",label:"canvas.frame",icon:(0,B.jsx)(mr,{size:16})},{value:"text",label:"canvas.text",icon:(0,B.jsx)(yr,{size:16})}];function Tr({t:e,source:t,revision:a,title:r,mode:n,onChange:o,onSave:l,onFailure:s,onHandle:y,onSelection:c,attempt:h,fallback:v}){let x=(0,ce.useRef)(null),d=(0,ce.useRef)(null),p=(0,ce.useRef)(t),u=(0,ce.useRef)({onChange:o,onSave:l,onFailure:s,onHandle:y,onSelection:c});u.current={onChange:o,onSave:l,onFailure:s,onHandle:y,onSelection:c};let[m,L]=(0,ce.useState)({status:"loading"}),[S,V]=(0,ce.useState)(null);(0,ce.useEffect)(()=>{let C=x.current;if(C===null)return;let F=!1,_=null;return L({status:"loading"}),V(null),(async()=>{try{let P=await Jn();if(F)return;let A=await P.mountDesignCanvas({element:C,source:p.current,mode:n,onChange:O=>{p.current=O,u.current.onChange(O)},onSave:()=>u.current.onSave(),onFailure:O=>{L({status:"failed"}),u.current.onFailure(O)},t:e});if(F){A.destroy();return}d.current=A,u.current.onFailure(null),u.current.onHandle(A),L({status:"ready"});let $=A.getSnapshot();V($),u.current.onSelection($.selection),_=A.subscribe(O=>{V(O),u.current.onSelection(O.selection)})}catch(P){F||(L({status:"failed"}),u.current.onFailure(P instanceof Error?P.message:String(P)))}})(),()=>{F=!0,_?.(),d.current?.destroy(),d.current=null,u.current.onHandle(null)}},[h]),(0,ce.useEffect)(()=>{let C=d.current;C===null||t===p.current||(p.current=t,C.setSource(t))},[a,t]),(0,ce.useEffect)(()=>{d.current?.setMode(n)},[n]);let D=m.status==="ready",H=eo.map(C=>(0,B.jsx)(me.Tooltip,{label:e(C.label),side:"top",portal:!0,children:(0,B.jsx)(me.Button,{size:"sm",className:"art-dock-button","aria-label":e(C.label),"aria-pressed":S?.tool===C.value,onClick:()=>d.current?.setTool(C.value),children:C.icon})},C.value));return(0,B.jsx)("div",{className:"art-canvas",children:(0,B.jsxs)("div",{className:"art-canvas-stage",children:[(0,B.jsx)("div",{className:"art-canvas-mount",ref:x,role:"application","aria-label":r,tabIndex:0,hidden:m.status==="failed","data-ready":D?"1":void 0}),D?null:(0,B.jsx)("div",{className:"art-canvas-fallback",children:v}),m.status==="loading"?(0,B.jsx)("div",{className:"art-canvas-opening",role:"status",children:e("canvas.opening")}):null,D&&S!==null&&S.rows.length===0?(0,B.jsx)("p",{className:"art-canvas-empty",children:e("canvas.empty")}):null,D?(0,B.jsxs)("div",{className:"art-canvas-dock",role:"toolbar","aria-label":e("canvas.toolbar"),children:[n==="edit"?(0,B.jsxs)(B.Fragment,{children:[H,(0,B.jsx)("span",{className:"art-dock-divider","aria-hidden":"true"}),(0,B.jsx)(me.Tooltip,{label:e("canvas.undo"),side:"top",portal:!0,children:(0,B.jsx)(me.Button,{size:"sm",className:"art-dock-button","aria-label":e("canvas.undo"),disabled:S?.canUndo===!1,onClick:()=>d.current?.undo(),children:(0,B.jsx)(br,{size:16})})}),(0,B.jsx)(me.Tooltip,{label:e("canvas.redo"),side:"top",portal:!0,children:(0,B.jsx)(me.Button,{size:"sm",className:"art-dock-button","aria-label":e("canvas.redo"),disabled:S?.canRedo===!1,onClick:()=>d.current?.redo(),children:(0,B.jsx)(hr,{size:16})})}),(0,B.jsx)("span",{className:"art-dock-divider","aria-hidden":"true"})]}):null,(0,B.jsx)(me.ZoomControls,{className:"art-dock-zoom",zoom:S?.zoom??1,fit:{label:e("canvas.fit"),selected:S?.fit??!1,onSelect:()=>d.current?.zoomToFit()},labels:{controls:e("canvas.zoomControls"),out:e("canvas.zoomOut"),into:e("canvas.zoomIn"),menu:e("canvas.zoomMenu"),value:C=>e("canvas.zoomValue",{percent:C})},visible:D,onZoom:C=>d.current?.setZoom(C),onActiveChange:()=>{}})]}):null]})})}var pe=require("react"),De=require("@deepseek-ai/dsh-client-ui-primitives");var k=require("react/jsx-runtime"),to=["Inter","Roboto","Noto Naskh Arabic"],ao=[400,500,600,700];function Pt(e){switch(e){case"FRAME":case"SECTION":return(0,k.jsx)(cr,{size:14});case"TEXT":return(0,k.jsx)(dr,{size:14});case"GROUP":case"COMPONENT":case"COMPONENT_SET":case"INSTANCE":return(0,k.jsx)(ur,{size:14});default:return(0,k.jsx)(pr,{size:14})}}function ma(e,t){switch(t){case"FRAME":return e("layer.type.frame");case"SECTION":return e("layer.type.section");case"TEXT":return e("layer.type.text");case"RECTANGLE":return e("layer.type.rectangle");case"ELLIPSE":return e("layer.type.ellipse");case"LINE":return e("layer.type.line");case"VECTOR":case"STAR":case"POLYGON":return e("layer.type.vector");case"GROUP":return e("layer.type.group");case"COMPONENT":case"COMPONENT_SET":return e("layer.type.component");case"INSTANCE":return e("layer.type.instance");default:return e("layer.type.other")}}function ro({t:e,label:t,value:a,mixed:r,min:n,max:o,step:l=1,onPreview:s,onCommit:y}){let[c,h]=(0,pe.useState)(""),v=(0,pe.useRef)(!1),x=(0,pe.useRef)(0),d=(0,pe.useRef)(!1),p=(0,pe.useRef)(!1),u=a===null?"":String(a);(0,pe.useEffect)(()=>{v.current||h(a===null?"":String(a))},[a]);let m=()=>h(a===null?"":String(a)),L=()=>{v.current=!1;let S=Number(c);if(c.trim()===""||!Number.isFinite(S)){m(),d.current&&y(x.current,x.current),d.current=!1;return}d.current&&y(S,x.current),d.current=!1};return(0,k.jsxs)("label",{className:"art-inspector-field",children:[(0,k.jsx)("span",{className:"art-inspector-field-label",children:t}),(0,k.jsx)(De.Input,{className:"art-inspector-input","aria-label":t,type:"number",inputMode:"decimal",min:n,max:o,step:l,value:c,placeholder:r||u===""?e("panel.mixed"):void 0,onFocus:()=>{v.current=!0,x.current=a??0,d.current=!1,h(a===null?"":String(a))},onChange:S=>{let V=S.target.value;h(V);let D=Number(V);V.trim()!==""&&Number.isFinite(D)&&(d.current=!0,s(D))},onBlur:()=>{if(p.current){p.current=!1,v.current=!1,m();return}L()},onKeyDown:S=>{S.key==="Enter"?(S.preventDefault(),S.currentTarget.blur()):S.key==="Escape"&&(S.preventDefault(),m(),d.current&&y(x.current,x.current),d.current=!1,p.current=!0,S.currentTarget.blur())}})]})}function no({t:e,handle:t,snapshot:a}){let[r,n]=(0,pe.useState)(null),[o,l]=(0,pe.useState)(""),s=a.rows,y=s.findIndex(d=>d.selected),c=d=>{let p=s[d];p!==void 0&&t.select(p.id,"replace")},h=d=>{l(d.name),n(d.id)},v=d=>{let p=o.trim();n(null),p!==""&&p!==d.name&&t.rename(d.id,p)},x=d=>{let p=y===-1?void 0:s[y];if(d.key==="ArrowDown"){d.preventDefault(),c(y===-1?0:Math.min(y+1,s.length-1));return}if(d.key==="ArrowUp"){d.preventDefault(),c(y===-1?s.length-1:Math.max(y-1,0));return}if(p!==void 0){if(d.key==="ArrowLeft"){if(d.preventDefault(),p.hasChildren&&p.expanded){t.toggleExpand(p.id);return}for(let u=y-1;u>=0;u-=1)if(s[u].level<p.level){t.select(s[u].id,"replace");return}return}if(d.key==="ArrowRight"){if(d.preventDefault(),p.hasChildren&&!p.expanded)t.toggleExpand(p.id);else{let u=s[y+1];u!==void 0&&u.level>p.level&&t.select(u.id,"replace")}return}d.key==="Enter"&&(d.preventDefault(),h(p))}};return s.length===0?(0,k.jsx)("p",{className:"art-inspector-empty",children:e("panel.none")}):(0,k.jsx)("div",{className:"art-layer-tree",role:"tree","aria-label":e("panel.layers"),tabIndex:0,onKeyDown:x,children:s.map(d=>(0,k.jsxs)("div",{className:"art-layer-row"+(d.selected?" is-selected":""),"data-layer-id":d.id,role:"treeitem","aria-level":d.level,"aria-selected":d.selected,"aria-expanded":d.hasChildren?d.expanded:void 0,style:{paddingInlineStart:(d.level-1)*14+6},onClick:p=>{p.shiftKey?t.select(d.id,"range"):p.metaKey||p.ctrlKey?t.select(d.id,"add"):t.select(d.id,"replace")},onDoubleClick:()=>h(d),children:[d.hasChildren?(0,k.jsx)("button",{type:"button",className:"art-layer-caret","aria-label":e(d.expanded?"panel.collapse":"panel.expand"),onClick:p=>{p.stopPropagation(),t.toggleExpand(d.id)},children:d.expanded?(0,k.jsx)(De.IconChevronDownOutlineRegular,{size:12}):(0,k.jsx)(De.IconChevronRightOutlineRegular,{size:12})}):(0,k.jsx)("span",{className:"art-layer-caret","aria-hidden":"true"}),(0,k.jsx)("span",{className:"art-layer-icon","aria-hidden":"true",children:Pt(d.type)}),r===d.id?(0,k.jsx)("input",{className:"art-layer-rename","aria-label":e("panel.rename"),autoFocus:!0,value:o,onChange:p=>l(p.target.value),onClick:p=>p.stopPropagation(),onBlur:()=>v(d),onKeyDown:p=>{p.key==="Enter"?(p.preventDefault(),v(d)):p.key==="Escape"&&(p.preventDefault(),n(null))}}):(0,k.jsx)("span",{className:"art-layer-name",title:d.name,children:d.name}),(0,k.jsxs)("span",{className:"art-layer-actions",children:[(0,k.jsx)("button",{type:"button",className:"art-layer-action","aria-label":e(d.visible?"panel.hide":"panel.show"),"aria-pressed":!d.visible,onClick:p=>{p.stopPropagation(),t.toggleVisibility(d.id)},children:d.visible?(0,k.jsx)(vr,{size:13}):(0,k.jsx)(xr,{size:13})}),(0,k.jsx)("button",{type:"button",className:"art-layer-action","aria-label":e(d.locked?"panel.unlock":"panel.lock"),"aria-pressed":d.locked,onClick:p=>{p.stopPropagation(),t.toggleLock(d.id)},children:d.locked?(0,k.jsx)(wr,{size:13}):(0,k.jsx)(kr,{size:13})})]})]},d.id))})}function oo({t:e,handle:t,snapshot:a}){let r=a.properties;if(r.ids.length===0)return(0,k.jsx)("p",{className:"art-inspector-empty",children:e("panel.selectLayerHint")});let n=(o,l,s,y={})=>(0,k.jsx)(ro,{t:e,label:l,value:s,mixed:s===null,...y,onPreview:c=>t.preview(o,c),onCommit:(c,h)=>t.commit(o,c,h)});return(0,k.jsxs)("div",{className:"art-inspector-properties",children:[(0,k.jsxs)("div",{className:"art-inspector-node",children:[(0,k.jsx)("span",{className:"art-inspector-node-icon","aria-hidden":"true",children:Pt(r.type??"")}),(0,k.jsx)("span",{className:"art-inspector-node-name",title:r.name??"",children:r.name}),(0,k.jsx)("span",{className:"art-inspector-node-type",children:ma(e,r.type??"")})]}),(0,k.jsxs)("section",{className:"art-inspector-group",children:[(0,k.jsx)("h3",{className:"art-inspector-heading",children:e("panel.positionSize")}),(0,k.jsxs)("div",{className:"art-inspector-grid",children:[n("x",e("panel.x"),r.x),n("y",e("panel.y"),r.y),n("width",e("panel.w"),r.width,{min:1}),n("height",e("panel.h"),r.height,{min:1}),n("rotation",e("panel.rotation"),r.rotation),n("radius",e("panel.radius"),r.radius,{min:0})]})]}),(0,k.jsxs)("section",{className:"art-inspector-group",children:[(0,k.jsx)("h3",{className:"art-inspector-heading",children:e("panel.appearance")}),(0,k.jsxs)("div",{className:"art-inspector-appearance",children:[n("opacity",e("panel.opacity"),r.opacity,{min:0,max:100}),(0,k.jsxs)("label",{className:"art-inspector-switch",children:[(0,k.jsx)("span",{className:"art-inspector-field-label",children:e("panel.visible")}),(0,k.jsx)(De.Switch,{checked:r.visible===!0,label:e("panel.visible"),onChange:o=>t.setVisible(o)})]})]})]}),a.isText&&r.text!==null?(0,k.jsxs)("section",{className:"art-inspector-group",children:[(0,k.jsx)("h3",{className:"art-inspector-heading",children:e("panel.text")}),(0,k.jsxs)("div",{className:"art-inspector-grid",children:[(0,k.jsxs)("label",{className:"art-inspector-field",children:[(0,k.jsx)("span",{className:"art-inspector-field-label",children:e("panel.family")}),(0,k.jsx)("select",{className:"art-inspector-select","aria-label":e("panel.family"),value:r.text.family,onChange:o=>t.setFamily(o.target.value),children:to.map(o=>(0,k.jsx)("option",{value:o,children:o},o))})]}),(0,k.jsxs)("label",{className:"art-inspector-field",children:[(0,k.jsx)("span",{className:"art-inspector-field-label",children:e("panel.weight")}),(0,k.jsx)("select",{className:"art-inspector-select","aria-label":e("panel.weight"),value:String(r.text.weight),onChange:o=>t.setWeight(Number(o.target.value)),children:ao.map(o=>(0,k.jsx)("option",{value:String(o),children:String(o)},o))})]}),n("fontSize",e("panel.fontSize"),r.text.fontSize,{min:1})]})]}):(0,k.jsx)("p",{className:"art-inspector-hint",children:e("panel.selectTextHint")})]})}function Sr({t:e,handle:t,snapshot:a,tab:r}){return t===null||a===null?(0,k.jsx)("p",{className:"art-inspector-empty",children:e("canvas.opening")}):r==="layers"?(0,k.jsx)(no,{t:e,handle:t,snapshot:a}):(0,k.jsx)(oo,{t:e,handle:t,snapshot:a})}var dt=require("react"),Nr=require("@deepseek-ai/dsh-client-ui-primitives");var se=require("react/jsx-runtime");function ya({t:e,where:t,id:a,version:r,title:n}){let[o,l]=(0,dt.useState)({status:"loading"}),[s,y]=(0,dt.useState)(0);if((0,dt.useEffect)(()=>{let h=new AbortController;return l({status:"loading"}),U.preview(t,a,r,h.signal).then(v=>{h.signal.aborted||l({status:"ready",preview:v})}).catch(v=>{h.signal.aborted||l({status:"failed",message:er(e,v)})}),()=>h.abort()},[t.scope,t.workspaceId,a,r,s,e]),o.status==="loading")return(0,se.jsx)("div",{className:"art-design-state",role:"status","aria-busy":"true",children:e("preview.loading")});if(o.status==="failed")return(0,se.jsxs)("div",{className:"art-design-state",role:"alert",children:[(0,se.jsx)("span",{className:"art-design-error",children:o.message}),(0,se.jsx)(Nr.Button,{size:"sm",variant:"outline",onClick:()=>y(h=>h+1),children:e("preview.retry")})]});let{preview:c}=o;return(0,se.jsxs)("div",{className:"art-design-preview",children:[(0,se.jsx)("div",{className:"art-design-canvas",children:(0,se.jsx)("img",{className:"art-design-image",src:`data:${c.mediaType};base64,${c.data}`,alt:n,width:c.width,height:c.height})}),c.info.warnings.length===0?null:(0,se.jsxs)("div",{className:"art-design-warnings",role:"note",children:[(0,se.jsx)("span",{className:"art-design-warnings-title",children:e("preview.warnings")}),(0,se.jsx)("ul",{children:c.info.warnings.map(h=>(0,se.jsx)("li",{children:h},h))})]})]})}var W=require("react"),Cr=require("@deepseek-ai/dsh-client-ui-primitives");var ye=require("react/jsx-runtime"),pt=null;function io(){if(pt===null){let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")return Promise.reject(new Error("The document editor loader is unavailable."));pt=e("./client.doc.js"),pt.catch(()=>{pt=null})}return pt}var so=["heading","bold","italic","bulletList","orderedList","codeBlock"];function lo(e){let t=window.getSelection(),a=e.getBoundingClientRect(),n=(t!==null&&t.rangeCount>0?t.getRangeAt(0):null)?.getBoundingClientRect();if(n===void 0||n.width===0&&n.height===0)return{top:e.scrollTop+8,left:16};let o=Math.min(Math.max(n.left-a.left+n.width/2,120),Math.max(a.width-120,120));return{top:Math.max(n.top-a.top+e.scrollTop-46,e.scrollTop+4),left:o}}function Lt({markdown:e,revision:t,editable:a,label:r,loadingLabel:n,failedLabel:o,onChange:l,onSave:s,onSelectionText:y,t:c,design:h,dark:v=!1,selectionAction:x}){let d=(0,W.useRef)(null),p=(0,W.useRef)(null),u=(0,W.useRef)(null),m=(0,W.useRef)(l);m.current=l;let L=(0,W.useRef)(y);L.current=y;let S=(0,W.useRef)({markdown:e,editable:a,label:r});S.current={markdown:e,editable:a,label:r};let[V,D]=(0,W.useState)([]),[H,C]=(0,W.useState)("loading"),[F,_]=(0,W.useState)(null),P=(0,W.useRef)(null);(0,W.useLayoutEffect)(()=>{let E=P.current,q=d.current;if(E===null||q===null||F===null)return;let N=E.offsetWidth/2,Q=q.clientWidth,_e=N*2+16>=Q?Q/2:Math.min(Math.max(F.left,N+8),Q-N-8);E.style.left=_e+"px"});let A=(0,W.useMemo)(()=>h===void 0?{}:{...Xa(h,v),colorScheme:v?"dark":"light"},[h,v]),$=E=>{L.current?.(E);let q=d.current;_(E===""||q===null?null:lo(q))},O=(0,W.useRef)($);O.current=$,(0,W.useEffect)(()=>{let E=!1;return io().then(q=>{E||p.current===null||(u.current=q.mountDocEditor({element:p.current,...S.current,onChange:N=>m.current(N),onSelectionChange:D,onSelectionText:N=>O.current(N)}),C("ready"))}).catch(()=>{E||C("failed")}),()=>{E=!0,u.current?.destroy(),u.current=null}},[]),(0,W.useEffect)(()=>{let E=u.current;E!==null&&E.getMarkdown()!==e&&E.setMarkdown(e)},[t,e]),(0,W.useEffect)(()=>{u.current?.setEditable(a)},[a]),(0,W.useEffect)(()=>{let E=()=>{let q=u.current,N=d.current,Q=window.getSelection();q===null||N===null||Q!==null&&Q.anchorNode!==null&&!N.contains(Q.anchorNode)||O.current(q.getSelectionText())};return document.addEventListener("selectionchange",E),()=>document.removeEventListener("selectionchange",E)},[]);let Le=F!==null&&c!==void 0&&(a||x!=null);return(0,ye.jsxs)("div",{className:"art-doc",ref:d,"data-doc-revision":t,onKeyDown:E=>{(E.ctrlKey||E.metaKey)&&E.key.toLowerCase()==="s"&&(E.preventDefault(),s()),E.key==="Escape"&&F!==null&&_(null)},children:[Le?(0,ye.jsxs)("div",{ref:P,className:"art-doc-toolbar",role:"toolbar","aria-label":c("format.toolbar"),style:{top:F.top,left:F.left},children:[a?so.map(E=>(0,ye.jsx)(Cr.Button,{size:"sm",variant:"ghost","aria-pressed":V.includes(E),disabled:H!=="ready",onMouseDown:q=>q.preventDefault(),onClick:()=>u.current?.format(E),children:c(`format.${E}`)},E)):null,a&&x!=null?(0,ye.jsx)("span",{className:"art-doc-toolbar-gap","aria-hidden":"true"}):null,x]}):null,H==="loading"?(0,ye.jsx)("p",{className:"art-note",children:n}):null,H==="failed"?(0,ye.jsx)("p",{className:"art-note",children:o}):null,(0,ye.jsx)("div",{className:"art-docpage",style:A,children:(0,ye.jsx)("div",{className:"art-doc-mount",ref:p})})]})}function co(e){return/<meta\b[^>]*name\s*=\s*["']?color-scheme["']?[^>]*content\s*=\s*["'][^"']*\bdark\b/i.test(e)||/<meta\b[^>]*content\s*=\s*["'][^"']*\bdark\b[^"']*["'][^>]*name\s*=\s*["']?color-scheme/i.test(e)}var Ar="default-src 'none'; img-src data: blob:; media-src data: blob:; style-src 'unsafe-inline'; script-src 'unsafe-inline' 'unsafe-eval'; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'",Er=["body, .art-docpage { color: var(--artifact-color-text); font-family: var(--artifact-font-family); font-size: 16px; line-height: 1.65; }","h1, h2, h3, h4 { font-family: var(--artifact-font-display); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; margin: 1.8em 0 0.5em; color: var(--artifact-color-text); text-wrap: balance; }","h1 { font-size: 2.1em; margin-top: 0; }","h2 { font-size: 1.45em; }","h3 { font-size: 1.15em; }","p, ul, ol, blockquote, table, pre { margin: 0 0 1em; }","a { color: var(--artifact-color-primary); text-underline-offset: 2px; }","strong { font-weight: 650; }","code { font-family: var(--artifact-font-mono); font-size: 0.88em; padding: 0.1em 0.35em; border-radius: var(--artifact-radius-sm); background: color-mix(in srgb, var(--artifact-color-text) 7%, transparent); }","pre { font-family: var(--artifact-font-mono); font-size: 0.86em; line-height: 1.55; padding: 14px 16px; border-radius: var(--artifact-radius-md); background: color-mix(in srgb, var(--artifact-color-text) 6%, transparent); overflow: auto; }","pre code { padding: 0; background: none; font-size: 1em; }","blockquote { padding: 0 0 0 16px; border-left: 3px solid var(--artifact-color-accent); color: var(--artifact-color-muted); }","ul, ol { padding-left: 1.4em; }","li + li { margin-top: 0.25em; }","table { border-collapse: collapse; width: 100%; font-size: 0.94em; font-variant-numeric: tabular-nums; }","th, td { padding: 8px 10px; border-bottom: 1px solid color-mix(in srgb, var(--artifact-color-text) 14%, transparent); text-align: left; vertical-align: top; }","th { font-weight: 600; color: var(--artifact-color-muted); border-bottom-color: color-mix(in srgb, var(--artifact-color-text) 28%, transparent); }","hr { border: none; border-top: 1px solid color-mix(in srgb, var(--artifact-color-text) 14%, transparent); margin: 2em 0; }"].join(`
22
- `);var ba="<script>addEventListener('message',function(e){if(e.source!==parent||e.data!=='dsh-artifact-print')return;addEventListener('afterprint',function(){parent.postMessage('dsh-artifact-printed','*')},{once:true});print()})<\/script>";function Ir(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function po(e){return e.replace(/<meta\b[^>]*http-equiv\s*=\s*["']?refresh["']?[^>]*>/gi,"").replace(/<meta\b[^>]*content\s*=\s*["'][^"']*url\s*=[^>]*>/gi,"")}function Rr(e,t,a,r,n="",o="auto"){let l='<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">'+(a===null?"":`<meta http-equiv="Content-Security-Policy" content="${Ir(a)}">`)+`<title>${Ir(r)}</title><style data-artifact-tokens>${t}</style>`+n;return`<!doctype html><html${co(e)?` ${Ct}="${o}"`:""}><head>${l}</head><body>${po(e)}</body></html>`}var Dr="allow-scripts",uo="allow-scripts allow-modals",fo=3e4,go="<script>(function(){var t;document.addEventListener('selectionchange',function(){clearTimeout(t);t=setTimeout(function(){var s=String(getSelection()||'');parent.postMessage({dshArtifactSelection:s.slice(0,4000)},'*')},150)})})()<\/script>",mo=4e3;function Mt(e,t,a,r="auto",n=!1){return Rr(e,t,Ar,a,n?go:"",r)}function zr(e){if(e===null||typeof e!="object")return;let t={...e};return typeof t.dshArtifactSelection=="string"?t.dshArtifactSelection.slice(0,mo):void 0}function Pr(e){let t=/<\/head>/i.test(e)?e.replace(/<\/head>/i,`${ba}</head>`):`${ba}${e}`,a=URL.createObjectURL(new Blob([t],{type:"text/html"})),r=document.createElement("iframe");r.setAttribute("sandbox",uo),r.setAttribute("aria-hidden","true"),r.tabIndex=-1,r.style.cssText="position:fixed;left:-10000px;top:0;width:800px;height:1000px;border:0;";let n=!1,o=()=>{n||(n=!0,clearTimeout(s),window.removeEventListener("message",l),r.remove(),URL.revokeObjectURL(a))},l=y=>{y.source===r.contentWindow&&y.data==="dsh-artifact-printed"&&o()};window.addEventListener("message",l);let s=setTimeout(o,fo);r.addEventListener("load",()=>{r.contentWindow?.postMessage("dsh-artifact-print","*")},{once:!0}),r.src=a,document.body.appendChild(r)}var Lr={"agent.ask":"Edit with agent","agent.reference":'In artifact "{title}" ({id}, v{version}):',"agent.referenceOld":'In artifact "{title}" ({id}, v{version}, the current version is v{current}):',"agent.referenceProject":'In artifact "{title}" ({id}, workspace {workspaceId}, v{version}):',"agent.referenceOldProject":'In artifact "{title}" ({id}, workspace {workspaceId}, v{version}, the current version is v{current}):',"agent.added":"Added to your message. Describe the change, then send.","agent.addedTruncated":"Added to your message. The selection was shortened to 2,000 characters.","agent.insertFailed":"The message box is busy, so the request was copied instead.","agent.copied":"Copied. Paste it into a conversation, then send.","agent.copyTitle":"Copy the request","card.creating":"Creating {title}","card.updating":"Updating {title}","card.updatingUntitled":"Updating the artifact","card.openNamed":"Open {title}","tab.codeHint":"Read-only code. Select text to ask the agent about it.","tab.editSource":"Edit code","tab.deleteTitle":"Move to trash?","code.copy":"Copy code","dialog.close":"Close","dialog.done":"Done","design.colorsDark":"Dark colors","panel.layers":"Layers","panel.properties":"Properties","panel.none":"No layers","panel.mixed":"Mixed","panel.expand":"Expand","panel.collapse":"Collapse","panel.show":"Show","panel.hide":"Hide","panel.lock":"Lock","panel.unlock":"Unlock","panel.rename":"Rename layer","panel.x":"X","panel.y":"Y","panel.rotation":"Rotate","panel.radius":"Radius","panel.opacity":"Opacity","panel.visible":"Visible","panel.hidden":"Hidden","panel.family":"Font family","panel.weight":"Weight","panel.fontSize":"Size","panel.w":"W","panel.h":"H","panel.positionSize":"Position and size","panel.appearance":"Appearance","panel.text":"Text","panel.selectLayerHint":"Select a layer to see its properties.","panel.selectTextHint":"Select a text layer to change its font, weight, and size.","layer.parentLine":"{type} in {parent}","layer.type.frame":"Frame","layer.type.section":"Section","layer.type.text":"Text","layer.type.rectangle":"Rectangle","layer.type.ellipse":"Ellipse","layer.type.line":"Line","layer.type.vector":"Vector","layer.type.group":"Group","layer.type.component":"Component","layer.type.instance":"Instance","layer.type.other":"Layer","canvas.viewMode":"View","canvas.editMode":"Edit","canvas.opening":"Opening the canvas\u2026","canvas.startFailed":"The canvas did not start. Showing the saved image.","canvas.empty":"This mockup has no layers yet. Switch to Edit to draw one.","canvas.zoomControls":"Zoom","canvas.zoomOut":"Zoom out","canvas.zoomIn":"Zoom in","canvas.zoomMenu":"Zoom level","canvas.zoomValue":"{percent}%","canvas.inspector":"Inspector","canvas.closeInspector":"Close inspector","canvas.inspectorTabs":"Inspector sections","canvas.editOldVersion":"Old versions open in View only. Restore this version to edit.","agent.quoteDesign":`Layer "{name}"
21
+ `)}function Gt(e,t){let a=t?e.colorsDark:e.colors,r={"--artifact-font-family":e.typography.fontFamily,"--artifact-font-display":e.typography.displayFamily,"--artifact-font-mono":e.typography.monoFamily};for(let n of $e)r[Ra(n)]=a[n];e.typography.scale.forEach((n,o)=>{r[`--artifact-font-size-${o}`]=`${n}px`}),e.spacing.scale.forEach((n,o)=>{r[`--artifact-space-${o}`]=`${n}px`});for(let[n,o]of Object.entries(e.radius))r[`--artifact-radius-${n}`]=`${o}px`;return r}var Go=/^ds_[a-z0-9]{16}$/,Uo=/^sha256:[a-f0-9]{64}$/;function Ut(e){if(e===null||typeof e!="object")return!1;let t={...e};return typeof t.id=="string"&&Go.test(t.id)&&typeof t.revision=="number"&&Number.isSafeInteger(t.revision)&&t.revision>0&&(t.scope==="workspace"||t.scope==="library")&&typeof t.name=="string"&&t.name.length>0&&t.name.length<=80}function $t(e){if(e===null||typeof e!="object")return!1;let t={...e};return typeof t.hash=="string"&&Uo.test(t.hash)&&typeof t.bytes=="number"&&Number.isSafeInteger(t.bytes)&&t.bytes>0&&t.bytes<=65536&&(t.system===null||Ut(t.system))&&(t.recipe===null||typeof t.recipe=="string"&&br.test(t.recipe))&&(t.kit===null||typeof t.kit=="string"&&t.kit.length<=20)}var $o="/artifacts-rpc",Ke=class extends Error{code;details;constructor(t,a,r){super(a),this.name="ArtifactCallError",this.code=t,this.details=r}},Da=null;function xr(e){Da=e}async function ae(e,t,a,r){if(Da===null)throw new Ke("artifact/not-ready","The artifact channel is not ready.",{});let n=await Da.rpc.call($o,e,t,r);if(!n.ok)throw new Ke(n.error.code,n.error.message,n.error.details);if(!a(n.value))throw new Ke("artifact/bad-response",`The ${e} response has an unexpected shape.`,{});return n.value}function se(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ko(e){return se(e)&&Array.isArray(e.items)&&e.items.every(Wt)&&typeof e.total=="number"&&typeof e.hasMore=="boolean"}function qo(e){return se(e)&&Wt(e.manifest)&&typeof e.content=="string"&&typeof e.version=="number"&&typeof e.designCss=="string"&&kr(e.design)&&(e.generation===void 0||$t(e.generation))&&(e.designInfo===void 0||Aa(e.designInfo))}function bt(e){return se(e)&&Wt(e.manifest)}function Yo(e){return se(e)&&typeof e.version=="number"&&typeof e.createdAt=="string"&&typeof e.contentHash=="string"&&typeof e.contentBytes=="number"&&Ea(e.source)&&(e.generation===void 0||$t(e.generation))}function Xo(e){return se(e)&&Array.isArray(e.versions)&&e.versions.every(Yo)}function Qo(e){return se(e)&&e.trashed===!0&&typeof e.trashPath=="string"}function Jo(e){return se(e)&&typeof e.path=="string"&&typeof e.bytes=="number"&&typeof e.fileName=="string"&&typeof e.mediaType=="string"&&typeof e.data=="string"}function Zo(e){return se(e)&&typeof e.html=="string"}function ei(e){return se(e)&&typeof e.mediaType=="string"&&typeof e.data=="string"&&typeof e.width=="number"&&typeof e.height=="number"&&Aa(e.info)}function kr(e){return se(e)&&e.schemaVersion===1&&typeof e.name=="string"&&se(e.colors)&&se(e.colorsDark)&&se(e.typography)&&se(e.spacing)&&se(e.radius)}function yt(e){return se(e)&&kr(e.tokens)&&(e.source==="workspace"||e.source==="library"||e.source==="default")&&typeof e.css=="string"&&(e.system===void 0||Ut(e.system))}function ti(e){return se(e)&&(e.scope==="workspace"||e.scope==="library")&&typeof e.revision=="number"&&Number.isSafeInteger(e.revision)&&e.revision>=0&&(e.defaultId===null||typeof e.defaultId=="string")&&Array.isArray(e.systems)&&e.systems.every(Ut)}function pe(e){return{scope:e.scope,...e.workspaceId===null?{}:{workspaceId:e.workspaceId}}}var B={list:(e,t,a)=>ae("list",{...pe(e),...t},Ko,a),get:(e,t,a,r)=>ae("get",{...pe(e),id:t,...a===void 0?{}:{version:a}},qo,r),create:(e,t,a,r)=>ae("create",{...pe(e),type:t,title:a,content:r},bt),update:(e,t,a,r,n)=>ae("update",{...pe(e),id:t,baseVersion:a,content:r,...n===void 0?{}:{title:n}},bt),rename:(e,t,a,r)=>ae("update",{...pe(e),id:t,baseVersion:a,title:r},bt),remove:(e,t)=>ae("delete",{...pe(e),id:t},Qo),history:(e,t,a)=>ae("history",{...pe(e),id:t},Xo,a),restore:(e,t,a,r)=>ae("restore",{...pe(e),id:t,version:a,baseVersion:r},bt),exportFile:(e,t,a,r)=>ae("export",{...pe(e),id:t,format:a,version:r},Jo),printable:(e,t,a)=>ae("printable",{...pe(e),id:t,version:a},Zo),preview:(e,t,a,r)=>ae("preview",{...pe(e),id:t,...a===void 0?{}:{version:a}},ei,r),designSystem:(e,t)=>ae("designSystem",e===null?{}:{workspaceId:e},yt,t),selectedDesign:(e,t={},a)=>ae("designSystem",{...pe(e),systemId:t.systemId,systemScope:t.systemScope,systemRevision:t.revision},yt,a),designSystems:(e,t)=>ae("designSystems",pe(e),ti,t),saveDesignSystem:(e,t,a)=>ae("saveDesignSystem",{...pe(e),tokens:t,...a},yt),setDesignDefault:(e,t,a)=>ae("setDesignDefault",{...pe(e),systemId:t,expectedRevision:a},yt),rebase:(e,t,a,r={})=>ae("rebase",{...pe(e),id:t,baseVersion:a,systemId:r.systemId,systemScope:r.systemScope,systemRevision:r.revision},bt),clearDesignSystem:e=>ae("clearDesignSystem",{workspaceId:e,scope:"workspace"},yt)};function Y(e){return e instanceof Ke?e.code:void 0}function X(e){switch(e){case"artifact/not-found":return"error.notFound";case"artifact/stale-catalog":return"error.staleCatalog";case"artifact/writer-busy":return"error.writerBusy";case"artifact/unsupported-kit":return"error.unsupportedKit";case"artifact/stale-version":return"error.stale";case"artifact/too-large":return"error.tooLarge";case"artifact/no-workspace":return"error.noWorkspace";case"artifact/forbidden-path":return"error.forbidden";case"artifact/corrupt":return"error.corrupt";case"artifact/invalid-tokens":return"error.tokens";case"artifact/library-unavailable":return"error.library";case"artifact/design-invalid":return"error.designInvalid";case"artifact/design-icon-unsupported":return"error.designIcon";case"artifact/design-icon-not-found":return"error.designIconNotFound";case"artifact/design-render-failed":return"error.designRender";case"artifact/design-timeout":return"error.designTimeout";case"artifact/design-unavailable":return"error.designUnavailable";case"artifact/unsupported-type":return"error.unsupportedType";case"artifact/invalid-sheet":return"error.sheetInvalid";default:return"error.generic"}}function La(e){if(!(!(e instanceof Ke)||!e.code.startsWith("artifact/design-")))return e.message===""?void 0:e.message}function Sr(e,t){return La(t)??e(X(Y(t)))}function Tr(e){let t=atob(e.data),a=new Uint8Array(t.length);for(let o=0;o<t.length;o+=1)a[o]=t.charCodeAt(o);let r=URL.createObjectURL(new Blob([a],{type:e.mediaType})),n=document.createElement("a");n.href=r,n.download=e.fileName,n.rel="noopener",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}var st=require("react");var xt=require("react");function qt(e){let t=e,a=new Set;return{get:()=>t,set(r){t=r;for(let n of a)n()},subscribe(r){return a.add(r),()=>a.delete(r)}}}var ot=qt(new Map);function Me(e,t){if(ot.get().get(e)===t)return;let a=new Map(ot.get());a.set(e,t),ot.set(a)}function Cr(e){return ot.get().get(e)}function Nr(e){return(0,xt.useSyncExternalStore)(ot.subscribe,()=>e===void 0?void 0:ot.get().get(e))}var wt=qt(new Map);function _e(e,t){if((wt.get().get(e)??0)>=t)return;let a=new Map(wt.get());a.set(e,t),wt.set(a)}function zr(e){return(0,xt.useSyncExternalStore)(wt.subscribe,()=>e===void 0?0:wt.get().get(e)??0)}var Kt=qt(0);function Ne(){Kt.set(Kt.get()+1)}function Yt(){return(0,xt.useSyncExternalStore)(Kt.subscribe,Kt.get)}var it=qt(null);function le(e){it.set({seq:(it.get()?.seq??0)+1,message:e})}function Ir(){return(0,xt.useSyncExternalStore)(it.subscribe,it.get)}function Ma(e){let t=it.get();t===null||e!==void 0&&t.seq!==e||it.set(null)}var Pe=new Map,Pa;function Rr(){Pa?.();let e=t=>{[...Pe.values()].some(a=>a.getSnapshot().draft!==null||a.getSnapshot().saving)&&(t.preventDefault(),t.returnValue="")};return window.addEventListener("beforeunload",e),Pa=()=>window.removeEventListener("beforeunload",e),Pa}var Oa=class{state={payload:null,draft:null,loading:!0,saving:!1,conflict:!1,revision:0};listeners=new Set;pending=null;readSequence=0;mounts=0;renameTo;where;key;address;constructor(t){this.address=t,this.key=ee(t),this.where={scope:t.scope,workspaceId:t.scope==="workspace"?t.workspaceId:null}}getSnapshot=()=>this.state;subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));publish(t){this.state={...this.state,...t},this.state.draft!==null||this.state.saving?Pe.set(this.key,this):this.mounts===0&&Pe.get(this.key)===this&&Pe.delete(this.key);for(let a of this.listeners)a()}attach(){return this.mounts+=1,Pe.set(this.key,this),this.mounts===1&&(this.state.payload===null||this.state.draft===null)&&this.load(),()=>{this.mounts-=1,this.mounts===0&&this.state.draft===null&&!this.state.saving&&Pe.get(this.key)===this&&Pe.delete(this.key)}}async load(){let t=++this.readSequence;this.publish({loading:!0,failure:void 0,failureMessage:void 0});try{let a=await B.get(this.where,this.address.id);if(t!==this.readSequence)return;if(this.state.draft!==null&&this.state.payload!==null){this.publish({loading:!1,conflict:a.version!==this.state.payload.version});return}this.publish({payload:a,loading:!1,conflict:!1,failure:void 0,revision:this.state.revision+1}),Me(this.address.id,a.manifest.title),_e(this.address.id,a.version)}catch(a){t===this.readSequence&&this.publish({loading:!1,failure:Y(a)??"artifact/storage-failure",failureMessage:void 0})}}edit(t){this.publish({draft:t,failure:void 0,failureMessage:void 0})}async discardAndReload(){this.pending!==null&&await this.pending,this.publish({draft:null,conflict:!1,failure:void 0,failureMessage:void 0}),await this.load()}externalVersion(t){this.state.payload===null||t<=this.state.payload.version||this.state.saving||(this.state.draft!==null?this.publish({conflict:!0}):this.load())}save(t){return t!==void 0&&(this.renameTo=t),this.pending!==null?this.pending:this.state.conflict||this.state.payload===null?Promise.resolve(!1):(this.pending=Promise.resolve().then(()=>this.drain()),this.pending)}async drain(){this.publish({saving:!0,failure:void 0,failureMessage:void 0});try{for(;this.state.draft!==null||this.renameTo!==void 0;){let t=this.state.payload;if(t===null||this.state.conflict)return!1;let a=this.state.draft,r=a??t.content,n=this.renameTo,{manifest:o}=await B.update(this.where,this.address.id,t.version,r,n);this.renameTo===n&&(this.renameTo=void 0),this.accept(o,r,this.state.draft===a?null:this.state.draft)}return!0}catch(t){let a=Y(t)??"artifact/storage-failure";return this.renameTo=void 0,this.publish({failure:a,failureMessage:a.startsWith("artifact/design-")?La(t):void 0,conflict:a==="artifact/stale-version"}),!1}finally{this.pending=null,this.publish({saving:!1})}}accept(t,a,r){let n=this.state.payload;n!==null&&(++this.readSequence,this.publish({payload:{...n,manifest:t,content:a,version:t.version},draft:r,conflict:!1,loading:!1}),Me(t.id,t.title),_e(t.id,t.version),t.type==="design"&&this.state.draft===null&&B.get(this.where,this.address.id).then(o=>{this.state.draft!==null||o.version!==t.version||this.publish({payload:o,revision:this.state.revision+1})}).catch(()=>{}),Ne())}};function Ar(e){let t=ee(e),a=(0,st.useMemo)(()=>{let n=Pe.get(t);if(n!==void 0)return n;let o=new Oa(e);return Pe.set(t,o),o},[t]),r=(0,st.useSyncExternalStore)(a.subscribe,a.getSnapshot,a.getSnapshot);return(0,st.useEffect)(()=>a.attach(),[a]),{model:a,state:r}}var N=require("react"),T=require("@deepseek-ai/dsh-client-ui-primitives");var ye=require("react"),we=require("@deepseek-ai/dsh-client-ui-primitives");var g=require("react/jsx-runtime");function _({children:e,size:t=16}){return(0,g.jsx)("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e})}var kt=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,g.jsx)("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,g.jsx)("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.5"}),(0,g.jsx)("path",{d:"M17 13.5v7M13.5 17h7"})]}),ze=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,g.jsx)("path",{d:"M3.5 8.5h17M9 13l-2 1.8L9 16.5M15 13l2 1.8-2 1.7"})]}),Oe=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("path",{d:"M6.5 3.5h7l4 4v13h-11z"}),(0,g.jsx)("path",{d:"M13.5 3.5v4h4M9 12h6M9 15.5h6"})]}),qe=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,g.jsx)("path",{d:"M3.5 9.5h17M9.5 9.5v10M15 9.5v10M3.5 14.5h17"})]}),Ye=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,g.jsx)("path",{d:"M3.5 14.5l4.5-4.5 4 4 3-3 5 5"}),(0,g.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.2"})]}),Er=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("path",{d:"M20.5 12a8.5 8.5 0 1 1-8.5-8.5c4.7 0 8.5 3.4 8.5 7.6 0 2.1-1.7 3.8-3.8 3.8h-1.4c-1 0-1.9.8-1.9 1.8 0 .8.5 1.3.5 2.1 0 1-.7 1.7-1.9 1.7Z"}),(0,g.jsx)("circle",{cx:"7.6",cy:"10",r:"1.1",fill:"currentColor",stroke:"none"}),(0,g.jsx)("circle",{cx:"10",cy:"6.8",r:"1.1",fill:"currentColor",stroke:"none"}),(0,g.jsx)("circle",{cx:"14",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),(0,g.jsx)("circle",{cx:"17",cy:"10.2",r:"1.1",fill:"currentColor",stroke:"none"})]}),Dr=({size:e})=>(0,g.jsx)(_,{size:e,children:(0,g.jsx)("path",{d:"M7 3v18M17 3v18M3 7h18M3 17h18"})}),Lr=({size:e})=>(0,g.jsx)(_,{size:e,children:(0,g.jsx)("path",{d:"M5 6h14M12 6v13"})}),Mr=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"3.5",y:"3.5",width:"11",height:"11",rx:"2"}),(0,g.jsx)("circle",{cx:"15.5",cy:"15.5",r:"5"})]}),Pr=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"3.5",y:"3.5",width:"12",height:"12",rx:"2"}),(0,g.jsx)("path",{d:"M8.5 8.5h12v12h-12z"})]}),Or=({size:e})=>(0,g.jsx)(_,{size:e,children:(0,g.jsx)("path",{d:"M5 3.5l12.5 8.2-5.7 1.2L14 19l-2.4 1-2.1-5.1L5 18.2z"})}),jr=({size:e})=>(0,g.jsx)(_,{size:e,children:(0,g.jsx)("path",{d:"M8 12V5.5a1.5 1.5 0 0 1 3 0V11M11 10.5V4.5a1.5 1.5 0 0 1 3 0V11M14 10.5V6.5a1.5 1.5 0 0 1 3 0V13c0 4-2.4 7-6 7-3.3 0-4.6-1.6-6.5-5.2L3.2 11.5a1.5 1.5 0 0 1 2.5-1.6L8 12.5"})}),Fr=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"4.5",y:"4.5",width:"15",height:"15",rx:"2"}),(0,g.jsx)("path",{d:"M8.5 4.5v15M15.5 4.5v15M4.5 8.5h15M4.5 15.5h15"})]}),Br=({size:e})=>(0,g.jsx)(_,{size:e,children:(0,g.jsx)("path",{d:"M4.5 6.5h15M12 6.5v12"})}),Hr=({size:e})=>(0,g.jsx)(_,{size:e,children:(0,g.jsx)("rect",{x:"4.5",y:"6",width:"15",height:"12",rx:"1.5"})}),_r=({size:e})=>(0,g.jsx)(_,{size:e,children:(0,g.jsx)("ellipse",{cx:"12",cy:"12",rx:"7.5",ry:"6"})}),Vr=({size:e})=>(0,g.jsx)(_,{size:e,children:(0,g.jsx)("path",{d:"M4.5 19.5l15-15"})}),Wr=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("path",{d:"M12 19.5C8.5 19.5 6 17.3 6 14.3 6 9.9 12 3.5 12 3.5s6 6.4 6 10.8c0 3-2.5 5.2-6 5.2Z"}),(0,g.jsx)("circle",{cx:"12",cy:"14.5",r:"1.6"})]}),Gr=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"8.5",y:"8.5",width:"11",height:"11",rx:"2"}),(0,g.jsx)("path",{d:"M15.5 4.5h-8a3 3 0 0 0-3 3v8"})]}),Ur=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"9.5",y:"9.5",width:"10",height:"10",rx:"1.5",fill:"currentColor",stroke:"none"}),(0,g.jsx)("path",{d:"M7.5 7.5h10M7.5 7.5v10M4.5 13v-6a2 2 0 0 1 2-2h6"})]}),$r=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"4.5",y:"4.5",width:"10",height:"10",rx:"1.5"}),(0,g.jsx)("path",{d:"M16.5 9.5h-6"})]}),Kr=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"5.5",y:"5.5",width:"10",height:"5.5",rx:"1"}),(0,g.jsx)("rect",{x:"5.5",y:"14.5",width:"6",height:"5.5",rx:"1"}),(0,g.jsx)("path",{d:"M3.5 3.5v17"})]}),qr=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"6.5",y:"5.5",width:"9",height:"5.5",rx:"1"}),(0,g.jsx)("rect",{x:"9",y:"14.5",width:"4",height:"5.5",rx:"1"}),(0,g.jsx)("path",{d:"M11 3.5v17",strokeDasharray:"3 2"})]}),Yr=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"8.5",y:"5.5",width:"10",height:"5.5",rx:"1"}),(0,g.jsx)("rect",{x:"12.5",y:"14.5",width:"6",height:"5.5",rx:"1"}),(0,g.jsx)("path",{d:"M20.5 3.5v17"})]}),Xr=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"5.5",y:"5.5",width:"5.5",height:"10",rx:"1"}),(0,g.jsx)("rect",{x:"14.5",y:"5.5",width:"5.5",height:"6",rx:"1"}),(0,g.jsx)("path",{d:"M3.5 3.5h17"})]}),Qr=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"5.5",y:"6.5",width:"5.5",height:"9",rx:"1"}),(0,g.jsx)("rect",{x:"14.5",y:"9",width:"5.5",height:"4",rx:"1"}),(0,g.jsx)("path",{d:"M3.5 11h17",strokeDasharray:"3 2"})]}),Jr=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"5.5",y:"8.5",width:"5.5",height:"10",rx:"1"}),(0,g.jsx)("rect",{x:"14.5",y:"12.5",width:"5.5",height:"6",rx:"1"}),(0,g.jsx)("path",{d:"M3.5 20.5h17"})]}),Zr=({size:e})=>(0,g.jsx)(_,{size:e,children:(0,g.jsx)("path",{d:"M4 9.5h9.5a5.5 5.5 0 0 1 0 11H9M4 9.5l4-4M4 9.5l4 4"})}),en=({size:e})=>(0,g.jsx)(_,{size:e,children:(0,g.jsx)("path",{d:"M20 9.5h-9.5a5.5 5.5 0 0 0 0 11H15M20 9.5l-4-4M20 9.5l-4 4"})}),tn=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,g.jsx)("circle",{cx:"12",cy:"12",r:"2.6"})]}),an=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,g.jsx)("path",{d:"M4 4l16 16"})]}),rn=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"5",y:"10.5",width:"14",height:"9.5",rx:"2"}),(0,g.jsx)("path",{d:"M8 10.5V7a4 4 0 0 1 8 0v3.5"})]}),nn=({size:e})=>(0,g.jsxs)(_,{size:e,children:[(0,g.jsx)("rect",{x:"5",y:"10.5",width:"14",height:"9.5",rx:"2"}),(0,g.jsx)("path",{d:"M8 10.5V7a4 4 0 0 1 7.4-2"})]});var V=require("react/jsx-runtime"),Xt=null;function ai(e){return e===null||typeof e!="object"?!1:typeof{...e}.mountDesignCanvas=="function"}async function ri(){return Xt??=(async()=>{let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")throw new Error("The canvas loader is unavailable.");let t=await e("./client.canvas.js");if(!ai(t))throw new Error("The canvas engine did not load.");return t})(),Xt.catch(()=>{Xt=null}),Xt}var ni=[{value:"select",label:"canvas.select",icon:(0,V.jsx)(Or,{size:16})},{value:"hand",label:"canvas.hand",icon:(0,V.jsx)(jr,{size:16})},{value:"rectangle",label:"canvas.rectangle",icon:(0,V.jsx)(Hr,{size:16})},{value:"ellipse",label:"canvas.ellipse",icon:(0,V.jsx)(_r,{size:16})},{value:"line",label:"canvas.line",icon:(0,V.jsx)(Vr,{size:16})},{value:"pen",label:"canvas.pen",icon:(0,V.jsx)(Wr,{size:16})},{value:"frame",label:"canvas.frame",icon:(0,V.jsx)(Fr,{size:16})},{value:"text",label:"canvas.text",icon:(0,V.jsx)(Br,{size:16})}];function on({t:e,source:t,revision:a,title:r,mode:n,onChange:o,onSave:s,onFailure:l,onHandle:c,onSelection:i,attempt:h,fallback:k}){let b=(0,ye.useRef)(null),p=(0,ye.useRef)(null),u=(0,ye.useRef)(t),y=(0,ye.useRef)({onChange:o,onSave:s,onFailure:l,onHandle:c,onSelection:i});y.current={onChange:o,onSave:s,onFailure:l,onHandle:c,onSelection:i};let[v,D]=(0,ye.useState)({status:"loading"}),[S,C]=(0,ye.useState)(null);(0,ye.useEffect)(()=>{let z=b.current;if(z===null)return;let W=!1,U=null;return D({status:"loading"}),C(null),(async()=>{try{let H=await ri();if(W)return;let M=await H.mountDesignCanvas({element:z,source:u.current,mode:n,onChange:A=>{u.current=A,y.current.onChange(A)},onSave:()=>y.current.onSave(),onFailure:A=>{D({status:"failed"}),y.current.onFailure(A)},t:e});if(W){M.destroy();return}p.current=M,y.current.onFailure(null),y.current.onHandle(M),D({status:"ready"});let x=M.getSnapshot();C(x),y.current.onSelection(x.selection),U=M.subscribe(A=>{C(A),y.current.onSelection(A.selection)})}catch(H){W||(D({status:"failed"}),y.current.onFailure(H instanceof Error?H.message:String(H)))}})(),()=>{W=!0,U?.(),p.current?.destroy(),p.current=null,y.current.onHandle(null)}},[h]),(0,ye.useEffect)(()=>{let z=p.current;z===null||t===u.current||(u.current=t,z.setSource(t))},[a,t]),(0,ye.useEffect)(()=>{p.current?.setMode(n)},[n]);let E=v.status==="ready",F=ni.map(z=>(0,V.jsx)(we.Tooltip,{label:e(z.label),side:"top",portal:!0,children:(0,V.jsx)(we.Button,{size:"sm",className:"art-dock-button","aria-label":e(z.label),"aria-pressed":S?.tool===z.value,onClick:()=>p.current?.setTool(z.value),children:z.icon})},z.value));return(0,V.jsx)("div",{className:"art-canvas",children:(0,V.jsxs)("div",{className:"art-canvas-stage",children:[(0,V.jsx)("div",{className:"art-canvas-mount",ref:b,role:"application","aria-label":r,tabIndex:0,hidden:v.status==="failed","data-ready":E?"1":void 0}),E?null:(0,V.jsx)("div",{className:"art-canvas-fallback",children:k}),v.status==="loading"?(0,V.jsx)("div",{className:"art-canvas-opening",role:"status",children:(0,V.jsx)(we.TextShimmer,{active:!0,children:e("canvas.opening")})}):null,E&&S!==null&&S.rows.length===0?(0,V.jsx)("p",{className:"art-canvas-empty",children:e("canvas.empty")}):null,E?(0,V.jsxs)("div",{className:"art-canvas-dock",role:"toolbar","aria-label":e("canvas.toolbar"),children:[n==="edit"?(0,V.jsxs)(V.Fragment,{children:[F,(0,V.jsx)("span",{className:"art-dock-divider","aria-hidden":"true"}),(0,V.jsx)(we.Tooltip,{label:e("canvas.undo"),side:"top",portal:!0,children:(0,V.jsx)(we.Button,{size:"sm",className:"art-dock-button","aria-label":e("canvas.undo"),disabled:S?.canUndo===!1,onClick:()=>p.current?.undo(),children:(0,V.jsx)(Zr,{size:16})})}),(0,V.jsx)(we.Tooltip,{label:e("canvas.redo"),side:"top",portal:!0,children:(0,V.jsx)(we.Button,{size:"sm",className:"art-dock-button","aria-label":e("canvas.redo"),disabled:S?.canRedo===!1,onClick:()=>p.current?.redo(),children:(0,V.jsx)(en,{size:16})})}),(0,V.jsx)("span",{className:"art-dock-divider","aria-hidden":"true"})]}):null,(0,V.jsx)(we.ZoomControls,{className:"art-dock-zoom",zoom:S?.zoom??1,fit:{label:e("canvas.fit"),selected:S?.fit??!1,onSelect:()=>p.current?.zoomToFit()},labels:{controls:e("canvas.zoomControls"),out:e("canvas.zoomOut"),into:e("canvas.zoomIn"),menu:e("canvas.zoomMenu"),value:z=>e("canvas.zoomValue",{percent:z})},visible:E,onZoom:z=>p.current?.setZoom(z),onActiveChange:()=>{}})]}):null]})})}var ue=require("react"),ce=require("@deepseek-ai/dsh-client-ui-primitives");var w=require("react/jsx-runtime"),oi=["Inter","Roboto","Noto Naskh Arabic"],ii=[400,500,600,700];function Qt(e){switch(e){case"FRAME":case"SECTION":return(0,w.jsx)(Dr,{size:14});case"TEXT":return(0,w.jsx)(Lr,{size:14});case"GROUP":case"COMPONENT":case"COMPONENT_SET":case"INSTANCE":return(0,w.jsx)(Pr,{size:14});default:return(0,w.jsx)(Mr,{size:14})}}function Fa(e,t){switch(t){case"FRAME":return e("layer.type.frame");case"SECTION":return e("layer.type.section");case"TEXT":return e("layer.type.text");case"RECTANGLE":return e("layer.type.rectangle");case"ELLIPSE":return e("layer.type.ellipse");case"LINE":return e("layer.type.line");case"VECTOR":case"STAR":case"POLYGON":return e("layer.type.vector");case"GROUP":return e("layer.type.group");case"COMPONENT":case"COMPONENT_SET":return e("layer.type.component");case"INSTANCE":return e("layer.type.instance");default:return e("layer.type.other")}}function si({t:e,label:t,value:a,mixed:r,min:n,max:o,step:s=1,onPreview:l,onCommit:c}){let[i,h]=(0,ue.useState)(""),k=(0,ue.useRef)(!1),b=(0,ue.useRef)(0),p=(0,ue.useRef)(!1),u=(0,ue.useRef)(!1),y=a===null?"":String(a);(0,ue.useEffect)(()=>{k.current||h(a===null?"":String(a))},[a]);let v=()=>h(a===null?"":String(a)),D=()=>{k.current=!1;let S=Number(i);if(i.trim()===""||!Number.isFinite(S)){v(),p.current&&c(b.current,b.current),p.current=!1;return}p.current&&c(S,b.current),p.current=!1};return(0,w.jsxs)("label",{className:"art-inspector-field",children:[(0,w.jsx)("span",{className:"art-inspector-field-label",children:t}),(0,w.jsx)(ce.Input,{className:"art-inspector-input","aria-label":t,type:"number",inputMode:"decimal",min:n,max:o,step:s,value:i,placeholder:r||y===""?e("panel.mixed"):void 0,onFocus:()=>{k.current=!0,b.current=a??0,p.current=!1,h(a===null?"":String(a))},onChange:S=>{let C=S.target.value;h(C);let E=Number(C);C.trim()!==""&&Number.isFinite(E)&&(p.current=!0,l(E))},onBlur:()=>{if(u.current){u.current=!1,k.current=!1,v();return}D()},onKeyDown:S=>{S.key==="Enter"?(S.preventDefault(),S.currentTarget.blur()):S.key==="Escape"&&(S.preventDefault(),v(),p.current&&c(b.current,b.current),p.current=!1,u.current=!0,S.currentTarget.blur())}})]})}function li({t:e,handle:t,snapshot:a}){let[r,n]=(0,ue.useState)(null),[o,s]=(0,ue.useState)(""),l=a.rows,c=l.findIndex(p=>p.selected),i=p=>{let u=l[p];u!==void 0&&t.select(u.id,"replace")},h=p=>{s(p.name),n(p.id)},k=p=>{let u=o.trim();n(null),u!==""&&u!==p.name&&t.rename(p.id,u)},b=p=>{let u=c===-1?void 0:l[c];if(p.key==="ArrowDown"){p.preventDefault(),i(c===-1?0:Math.min(c+1,l.length-1));return}if(p.key==="ArrowUp"){p.preventDefault(),i(c===-1?l.length-1:Math.max(c-1,0));return}if(u!==void 0){if(p.key==="ArrowLeft"){if(p.preventDefault(),u.hasChildren&&u.expanded){t.toggleExpand(u.id);return}for(let y=c-1;y>=0;y-=1)if(l[y].level<u.level){t.select(l[y].id,"replace");return}return}if(p.key==="ArrowRight"){if(p.preventDefault(),u.hasChildren&&!u.expanded)t.toggleExpand(u.id);else{let y=l[c+1];y!==void 0&&y.level>u.level&&t.select(y.id,"replace")}return}p.key==="Enter"&&(p.preventDefault(),h(u))}};return l.length===0?(0,w.jsx)("p",{className:"art-inspector-empty",children:e("panel.none")}):(0,w.jsx)("div",{className:"art-layer-tree",role:"tree","aria-label":e("panel.layers"),tabIndex:0,onKeyDown:b,children:l.map(p=>(0,w.jsxs)("div",{className:"art-layer-row"+(p.selected?" is-selected":""),"data-layer-id":p.id,role:"treeitem","aria-level":p.level,"aria-selected":p.selected,"aria-expanded":p.hasChildren?p.expanded:void 0,style:{paddingInlineStart:(p.level-1)*14+6},onClick:u=>{u.shiftKey?t.select(p.id,"range"):u.metaKey||u.ctrlKey?t.select(p.id,"add"):t.select(p.id,"replace")},onDoubleClick:()=>h(p),children:[p.hasChildren?(0,w.jsx)(ce.Button,{size:"sm",className:"art-layer-caret","aria-label":e(p.expanded?"panel.collapse":"panel.expand"),onClick:u=>{u.stopPropagation(),t.toggleExpand(p.id)},children:p.expanded?(0,w.jsx)(ce.IconChevronDownOutlineRegular,{size:12}):(0,w.jsx)(ce.IconChevronRightOutlineRegular,{size:12})}):(0,w.jsx)("span",{className:"art-layer-caret","aria-hidden":"true"}),(0,w.jsx)("span",{className:"art-layer-icon","aria-hidden":"true",children:Qt(p.type)}),r===p.id?(0,w.jsx)(ce.Input,{className:"art-layer-rename","aria-label":e("panel.rename"),autoFocus:!0,value:o,onChange:u=>s(u.target.value),onClick:u=>u.stopPropagation(),onBlur:()=>k(p),onKeyDown:u=>{u.key==="Enter"?(u.preventDefault(),k(p)):u.key==="Escape"&&(u.preventDefault(),n(null))}}):(0,w.jsx)("span",{className:"art-layer-name",title:p.name,children:p.name}),(0,w.jsxs)("span",{className:"art-layer-actions",children:[(0,w.jsx)(ce.Button,{size:"sm",className:"art-layer-action","aria-label":e(p.visible?"panel.hide":"panel.show"),"aria-pressed":!p.visible,onClick:u=>{u.stopPropagation(),t.toggleVisibility(p.id)},children:p.visible?(0,w.jsx)(tn,{size:13}):(0,w.jsx)(an,{size:13})}),(0,w.jsx)(ce.Button,{size:"sm",className:"art-layer-action","aria-label":e(p.locked?"panel.unlock":"panel.lock"),"aria-pressed":p.locked,onClick:u=>{u.stopPropagation(),t.toggleLock(p.id)},children:p.locked?(0,w.jsx)(rn,{size:13}):(0,w.jsx)(nn,{size:13})})]})]},p.id))})}var ja=/^#[0-9a-f]{6}$/;function ci({t:e,label:t,hex:a,onInput:r,onCommit:n}){let[o,s]=(0,ue.useState)(""),l=(0,ue.useRef)(!1),c=(0,ue.useRef)(null),i=(0,ue.useRef)(null),h=a??"",k=l.current?o:h,b=p=>{let u=p.trim().toLowerCase();return ja.test(u)?u:null};return(0,ue.useEffect)(()=>{l.current||s("")},[a]),(0,w.jsxs)("label",{className:"art-inspector-field",children:[(0,w.jsx)("span",{className:"art-inspector-field-label",children:t}),(0,w.jsx)("input",{type:"color",className:"art-inspector-color","aria-label":t,value:a!==null&&ja.test(a)?a:"#000000",disabled:a===null,onFocus:()=>{c.current=a},onInput:p=>{let u=p.currentTarget.value.toLowerCase();i.current=u,r(u)},onChange:p=>{let u=p.currentTarget.value.toLowerCase();i.current=u,n(u)}}),(0,w.jsx)(ce.Input,{className:"art-inspector-input","aria-label":t+" CSS",type:"text",value:k,placeholder:a===null?e("panel.mixed"):void 0,onFocus:()=>{l.current=!0,c.current=a,i.current=null,s("")},onChange:p=>{s(p.target.value);let u=b(p.target.value);u!==null&&(i.current=u,r(u))},onBlur:()=>{l.current=!1;let p=b(o)??i.current;s(""),p!==null&&n(p)},onKeyDown:p=>{if(p.key==="Enter")p.preventDefault(),p.currentTarget.blur();else if(p.key==="Escape"){s("");let u=c.current;i.current=null,u!==null&&n(u),p.currentTarget.blur()}}})]})}function di({t:e,handle:t,snapshot:a,palette:r}){let n=a.properties;if(n.ids.length===0)return(0,w.jsx)("p",{className:"art-inspector-empty",children:e("panel.selectLayerHint")});let o=(c,i,h,k={})=>(0,w.jsx)(si,{t:e,label:i,value:h,mixed:h===null,...k,onPreview:b=>t.preview(c,b),onCommit:(b,p)=>t.commit(c,b,p)}),s=(c,i,h,k)=>(0,w.jsx)(ce.Tooltip,{label:e(c),side:"top",portal:!0,children:(0,w.jsx)(ce.Button,{size:"sm",className:"art-inspector-action","aria-label":e(c),disabled:h,onClick:k,children:i})}),l=c=>i=>t.alignSelection(c,i);return(0,w.jsxs)("div",{className:"art-inspector-properties",children:[(0,w.jsxs)("div",{className:"art-inspector-node",children:[(0,w.jsx)("span",{className:"art-inspector-node-icon","aria-hidden":"true",children:Qt(n.type??"")}),(0,w.jsx)("span",{className:"art-inspector-node-name",title:n.name??"",children:n.name}),(0,w.jsx)("span",{className:"art-inspector-node-type",children:Fa(e,n.type??"")})]}),(0,w.jsxs)("div",{className:"art-inspector-actions",role:"toolbar","aria-label":e("panel.layerActions"),children:[s("panel.duplicate",(0,w.jsx)(Gr,{size:14}),n.ids.length===0,()=>t.duplicateSelection()),s("panel.forward",(0,w.jsx)(Ur,{size:14}),n.ids.length===0,()=>t.changeOrder("forward")),s("panel.backward",(0,w.jsx)($r,{size:14}),n.ids.length===0,()=>t.changeOrder("backward"))]}),n.ids.length<2?null:(0,w.jsxs)("div",{className:"art-inspector-actions",role:"toolbar","aria-label":e("panel.align"),children:[s("panel.alignLeft",(0,w.jsx)(Kr,{size:14}),!1,()=>l("horizontal")("min")),s("panel.alignCenterX",(0,w.jsx)(qr,{size:14}),!1,()=>l("horizontal")("center")),s("panel.alignRight",(0,w.jsx)(Yr,{size:14}),!1,()=>l("horizontal")("max")),s("panel.alignTop",(0,w.jsx)(Xr,{size:14}),!1,()=>l("vertical")("min")),s("panel.alignMiddle",(0,w.jsx)(Qr,{size:14}),!1,()=>l("vertical")("center")),s("panel.alignBottom",(0,w.jsx)(Jr,{size:14}),!1,()=>l("vertical")("max"))]}),["fill","stroke"].map(c=>(0,w.jsxs)("section",{className:"art-inspector-group",children:[(0,w.jsx)("h3",{className:"art-inspector-heading",children:e(c==="fill"?"panel.fill":"panel.stroke")}),(0,w.jsx)(ci,{t:e,label:e(c==="fill"?"panel.fill":"panel.stroke"),hex:c==="fill"?n.fill:n.stroke,onInput:i=>t.setColor(c,i,!1),onCommit:i=>t.setColor(c,i,!0)}),(0,w.jsx)("div",{className:"art-inspector-swatches",children:$e.map(i=>{let h=r?.[i];return h===void 0||!ja.test(h)?null:(0,w.jsx)("button",{type:"button",className:"art-inspector-swatch",style:{background:h},title:e(`design.color.${i}`),"aria-label":e(`design.color.${i}`),onClick:()=>t.setColor(c,h,!0)},i)})})]},c)),(0,w.jsxs)("section",{className:"art-inspector-group",children:[(0,w.jsx)("h3",{className:"art-inspector-heading",children:e("panel.positionSize")}),(0,w.jsxs)("div",{className:"art-inspector-grid",children:[o("x",e("panel.x"),n.x),o("y",e("panel.y"),n.y),o("width",e("panel.w"),n.width,{min:1}),o("height",e("panel.h"),n.height,{min:1}),o("rotation",e("panel.rotation"),n.rotation),o("radius",e("panel.radius"),n.radius,{min:0})]})]}),(0,w.jsxs)("section",{className:"art-inspector-group",children:[(0,w.jsx)("h3",{className:"art-inspector-heading",children:e("panel.appearance")}),(0,w.jsxs)("div",{className:"art-inspector-appearance",children:[o("opacity",e("panel.opacity"),n.opacity,{min:0,max:100}),(0,w.jsxs)("label",{className:"art-inspector-switch",children:[(0,w.jsx)("span",{className:"art-inspector-field-label",children:e("panel.visible")}),(0,w.jsx)(ce.Switch,{checked:n.visible===!0,label:e("panel.visible"),onChange:c=>t.setVisible(c)})]})]})]}),a.isText&&n.text!==null?(0,w.jsxs)("section",{className:"art-inspector-group",children:[(0,w.jsx)("h3",{className:"art-inspector-heading",children:e("panel.text")}),(0,w.jsxs)("div",{className:"art-inspector-grid",children:[(0,w.jsxs)("label",{className:"art-inspector-field",children:[(0,w.jsx)("span",{className:"art-inspector-field-label",children:e("panel.family")}),(0,w.jsx)("select",{className:"art-select art-inspector-select","aria-label":e("panel.family"),value:n.text.family,onChange:c=>t.setFamily(c.target.value),children:oi.map(c=>(0,w.jsx)("option",{value:c,children:c},c))})]}),(0,w.jsxs)("label",{className:"art-inspector-field",children:[(0,w.jsx)("span",{className:"art-inspector-field-label",children:e("panel.weight")}),(0,w.jsx)("select",{className:"art-select art-inspector-select","aria-label":e("panel.weight"),value:String(n.text.weight),onChange:c=>t.setWeight(Number(c.target.value)),children:ii.map(c=>(0,w.jsx)("option",{value:String(c),children:String(c)},c))})]}),o("fontSize",e("panel.fontSize"),n.text.fontSize,{min:1})]})]}):(0,w.jsx)("p",{className:"art-inspector-hint",children:e("panel.selectTextHint")})]})}function sn({t:e,handle:t,snapshot:a,tab:r,palette:n}){return t===null||a===null?(0,w.jsx)("p",{className:"art-inspector-empty",children:e("canvas.opening")}):r==="layers"?(0,w.jsx)(li,{t:e,handle:t,snapshot:a}):(0,w.jsx)(di,{t:e,handle:t,snapshot:a,palette:n})}var St=require("react"),Jt=require("@deepseek-ai/dsh-client-ui-primitives");var me=require("react/jsx-runtime");function Ba({t:e,where:t,id:a,version:r,title:n}){let[o,s]=(0,St.useState)({status:"loading"}),[l,c]=(0,St.useState)(0);if((0,St.useEffect)(()=>{let h=new AbortController;return s({status:"loading"}),B.preview(t,a,r,h.signal).then(k=>{h.signal.aborted||s({status:"ready",preview:k})}).catch(k=>{h.signal.aborted||s({status:"failed",message:Sr(e,k)})}),()=>h.abort()},[t.scope,t.workspaceId,a,r,l,e]),o.status==="loading")return(0,me.jsx)("div",{className:"art-state",role:"status","aria-busy":"true",children:(0,me.jsx)(Jt.TextShimmer,{active:!0,children:e("preview.loading")})});if(o.status==="failed")return(0,me.jsxs)("div",{className:"art-state",role:"alert",children:[(0,me.jsx)("span",{className:"art-design-error",children:o.message}),(0,me.jsx)(Jt.Button,{size:"sm",variant:"outline",onClick:()=>c(h=>h+1),children:e("preview.retry")})]});let{preview:i}=o;return(0,me.jsxs)("div",{className:"art-design-preview",children:[(0,me.jsx)("div",{className:"art-design-canvas",children:(0,me.jsx)("img",{className:"art-design-image",src:`data:${i.mediaType};base64,${i.data}`,alt:n,width:i.width,height:i.height})}),i.info.warnings.length===0?null:(0,me.jsxs)("div",{className:"art-design-warnings",role:"note",children:[(0,me.jsx)("span",{className:"art-design-warnings-title",children:e("preview.warnings")}),(0,me.jsx)("ul",{children:i.info.warnings.map(h=>(0,me.jsx)("li",{children:h},h))})]})]})}var Z=require("react"),Zt=require("@deepseek-ai/dsh-client-ui-primitives");var ke=require("react/jsx-runtime"),Tt=null;function pi(){if(Tt===null){let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")return Promise.reject(new Error("The document editor loader is unavailable."));Tt=e("./client.doc.js"),Tt.catch(()=>{Tt=null})}return Tt}var ui=["heading","bold","italic","bulletList","orderedList","codeBlock"];function fi(e){let t=window.getSelection(),a=e.getBoundingClientRect(),n=(t!==null&&t.rangeCount>0?t.getRangeAt(0):null)?.getBoundingClientRect();if(n===void 0||n.width===0&&n.height===0)return{top:e.scrollTop+8,left:16};let o=Math.min(Math.max(n.left-a.left+n.width/2,120),Math.max(a.width-120,120));return{top:Math.max(n.top-a.top+e.scrollTop-46,e.scrollTop+4),left:o}}function ea({markdown:e,revision:t,editable:a,label:r,loadingLabel:n,failedLabel:o,onChange:s,onSave:l,onSelectionText:c,t:i,design:h,dark:k=!1,selectionAction:b}){let p=(0,Z.useRef)(null),u=(0,Z.useRef)(null),y=(0,Z.useRef)(null),v=(0,Z.useRef)(s);v.current=s;let D=(0,Z.useRef)(c);D.current=c;let S=(0,Z.useRef)({markdown:e,editable:a,label:r});S.current={markdown:e,editable:a,label:r};let[C,E]=(0,Z.useState)([]),[F,z]=(0,Z.useState)("loading"),[W,U]=(0,Z.useState)(null),H=(0,Z.useRef)(null);(0,Z.useLayoutEffect)(()=>{let L=H.current,q=p.current;if(L===null||q===null||W===null)return;let I=L.offsetWidth/2,J=q.clientWidth,Ze=I*2+16>=J?J/2:Math.min(Math.max(W.left,I+8),J-I-8);L.style.left=Ze+"px"});let M=(0,Z.useMemo)(()=>h===void 0?{}:{...Gt(h,k),colorScheme:k?"dark":"light"},[h,k]),x=L=>{D.current?.(L);let q=p.current;U(L===""||q===null?null:fi(q))},A=(0,Z.useRef)(x);A.current=x,(0,Z.useEffect)(()=>{let L=!1;return pi().then(q=>{L||u.current===null||(y.current=q.mountDocEditor({element:u.current,...S.current,onChange:I=>v.current(I),onSelectionChange:E,onSelectionText:I=>A.current(I)}),z("ready"))}).catch(()=>{L||z("failed")}),()=>{L=!0,y.current?.destroy(),y.current=null}},[]),(0,Z.useEffect)(()=>{let L=y.current;L!==null&&L.getMarkdown()!==e&&L.setMarkdown(e)},[t,e]),(0,Z.useEffect)(()=>{y.current?.setEditable(a)},[a]),(0,Z.useEffect)(()=>{let L=()=>{let q=y.current,I=p.current,J=window.getSelection();q===null||I===null||J!==null&&J.anchorNode!==null&&!I.contains(J.anchorNode)||A.current(q.getSelectionText())};return document.addEventListener("selectionchange",L),()=>document.removeEventListener("selectionchange",L)},[]);let Q=W!==null&&i!==void 0&&(a||b!=null);return(0,ke.jsxs)("div",{className:"art-doc",ref:p,"data-doc-revision":t,onKeyDown:L=>{(L.ctrlKey||L.metaKey)&&L.key.toLowerCase()==="s"&&(L.preventDefault(),l()),L.key==="Escape"&&W!==null&&U(null)},children:[Q?(0,ke.jsxs)("div",{ref:H,className:"art-doc-toolbar",role:"toolbar","aria-label":i("format.toolbar"),style:{top:W.top,left:W.left},children:[a?ui.map(L=>(0,ke.jsx)(Zt.Button,{size:"sm",variant:"ghost","aria-pressed":C.includes(L),disabled:F!=="ready",onMouseDown:q=>q.preventDefault(),onClick:()=>y.current?.format(L),children:i(`format.${L}`)},L)):null,a&&b!=null?(0,ke.jsx)("span",{className:"art-doc-toolbar-gap","aria-hidden":"true"}):null,b]}):null,F==="loading"?(0,ke.jsx)("div",{className:"art-state",role:"status",children:(0,ke.jsx)(Zt.TextShimmer,{active:!0,children:n})}):null,F==="failed"?(0,ke.jsx)("div",{className:"art-state",role:"alert",children:o}):null,(0,ke.jsx)("div",{className:"art-docpage",style:M,hidden:F!=="ready",children:(0,ke.jsx)("div",{className:"art-doc-mount",ref:u})})]})}function*ln(e){let t=e.toLowerCase(),a=new Set(["script","style","textarea","title","template","noscript"]),r=0;for(;r<e.length;){let n=e.indexOf("<",r);if(n<0)return;if(e.startsWith("<!--",n)){let i=e.indexOf("-->",n+4);if(i<0)return;r=i+3;continue}let o=n+1,s="";for(;o<e.length;o++){let i=e[o];if(s!=="")i===s&&(s="");else if(i==='"'||i==="'")s=i;else if(i===">")break}if(o===e.length)return;r=o+1;let l=e.slice(n,r),c=/^<([a-z][a-z0-9:-]*)(?=\s|\/?>)/i.exec(l)?.[1]?.toLowerCase();if(c!==void 0&&(yield{name:c,text:l},a.has(c))){let i=t.indexOf("</"+c,r);if(i<0)return;let h=e.indexOf(">",i);if(h<0)return;r=h+1}}}var cn=["*, *::before, *::after { box-sizing: border-box; }","[hidden] { display: none !important; }","html { background: var(--artifact-color-background); -webkit-text-size-adjust: 100%; }","body { margin: 0; color: var(--artifact-color-text); font: var(--artifact-font-size-2)/1.6 var(--artifact-font-family); overflow-wrap: anywhere; }","::selection { background: color-mix(in srgb, var(--artifact-color-action) 26%, transparent); }",":focus-visible { outline: 2px solid var(--artifact-color-focus); outline-offset: 2px; }",":where(h1, h2, h3, h4):not(:where(.ak-demo, .ak-demo *)) { margin: 0; font-family: var(--artifact-font-display); font-weight: 600; line-height: 1.2; text-wrap: balance; }",":where(h1):not(:where(.ak-demo, .ak-demo *)) { font-size: clamp(1.9rem, 5vw, 2.6rem); letter-spacing: -0.02em; }",":where(h2):not(:where(.ak-demo, .ak-demo *)) { font-size: clamp(1.35rem, 3.2vw, 1.75rem); letter-spacing: -0.01em; }",":where(h3):not(:where(.ak-demo, .ak-demo *)) { font-size: var(--artifact-font-size-3); }",":where(h4):not(:where(.ak-demo, .ak-demo *)) { font-size: var(--artifact-font-size-2); }",":where(p, ul, ol, dl, figure, blockquote):not(:where(.ak-demo, .ak-demo *)) { margin: 0; }",":where(a):not(:where(.ak-demo, .ak-demo *)) { color: var(--artifact-color-primary); text-underline-offset: 0.2em; }",":where(code, kbd, samp, pre):not(:where(.ak-demo, .ak-demo *)) { font-family: var(--artifact-font-mono); font-size: 0.92em; }",":where(:not(pre) > code):not(:where(.ak-demo, .ak-demo *)) { padding: 0.1em 0.35em; border-radius: var(--artifact-radius-sm); background: color-mix(in srgb, var(--artifact-color-text) 7%, transparent); }","button, input, select, textarea { font: inherit; color: inherit; }","img { max-width: 100%; height: auto; }",".ak-page { display: grid; gap: var(--artifact-space-6); width: min(100% - 2 * var(--artifact-space-4), 72rem); margin-inline: auto; padding-block: var(--artifact-space-5) var(--artifact-space-6); }",".ak-page--narrow { width: min(100% - 2 * var(--artifact-space-4), 48rem); }",".ak-page > * { min-width: 0; }",".ak-header { display: grid; gap: var(--artifact-space-3); padding-bottom: var(--artifact-space-5); border-bottom: 1px solid var(--artifact-color-border); }",".ak-eyebrow { color: var(--artifact-color-muted); font-size: var(--artifact-font-size-1); font-weight: 600; letter-spacing: 0.01em; }",".ak-lede { max-width: 60ch; color: var(--artifact-color-muted); font-size: calc((var(--artifact-font-size-2) + var(--artifact-font-size-3)) / 2); line-height: 1.5; }",".ak-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--artifact-space-1) var(--artifact-space-3); padding: 0; list-style: none; color: var(--artifact-color-muted); font-size: var(--artifact-font-size-1); }",".ak-section { display: grid; gap: var(--artifact-space-4); scroll-margin-top: var(--artifact-space-4); }",".ak-section__head { display: grid; gap: var(--artifact-space-1); }",".ak-section__head p { max-width: 68ch; color: var(--artifact-color-muted); }",".ak-prose { display: grid; gap: var(--artifact-space-3); }",".ak-prose > *, .ak-section > p, .ak-section > ul, .ak-section > ol { max-width: 68ch; }",".ak-prose ul, .ak-prose ol, .ak-section > ul, .ak-section > ol { display: grid; gap: var(--artifact-space-1); padding-left: 1.3em; }",".ak-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: var(--artifact-space-4); }",".ak-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: var(--artifact-space-4); align-items: start; }",".ak-card { display: grid; align-content: start; gap: var(--artifact-space-2); padding: var(--artifact-space-4); border: 1px solid var(--artifact-color-border); border-radius: var(--artifact-radius-lg); background: var(--artifact-color-surface); }",".ak-muted { color: var(--artifact-color-muted); }",".ak-small { font-size: var(--artifact-font-size-1); }",".ak-num { font-family: var(--artifact-font-mono); font-variant-numeric: tabular-nums; }",".ak-callout { --ak-tone: var(--artifact-color-accent); display: grid; gap: var(--artifact-space-1); padding: var(--artifact-space-3) var(--artifact-space-4); border-left: 3px solid var(--ak-tone); border-radius: 0 var(--artifact-radius-md) var(--artifact-radius-md) 0; background: var(--artifact-color-raised); }",".ak-callout__title { font-weight: 650; }",".ak-callout--info { --ak-tone: var(--artifact-color-focus); }",".ak-callout--success { --ak-tone: var(--artifact-color-success); }",".ak-callout--warning { --ak-tone: var(--artifact-color-warning); }",".ak-callout--danger { --ak-tone: var(--artifact-color-danger); }",".ak-badge { --ak-tone: var(--artifact-color-muted); display: inline-flex; align-items: center; gap: 0.4em; padding: 0.1em 0.6em; border: 1px solid color-mix(in srgb, var(--ak-tone) 45%, transparent); border-radius: 999px; color: var(--ak-tone); font-size: var(--artifact-font-size-1); font-weight: 600; line-height: 1.5; white-space: nowrap; }",'.ak-badge::before { content: ""; flex: none; width: 0.45em; height: 0.45em; border-radius: 50%; background: currentColor; }',".ak-badge--plain::before { display: none; }",".ak-badge--info { --ak-tone: var(--artifact-color-focus); }",".ak-badge--success { --ak-tone: var(--artifact-color-success); }",".ak-badge--warning { --ak-tone: var(--artifact-color-warning); }",".ak-badge--danger { --ak-tone: var(--artifact-color-danger); }",".ak-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: var(--artifact-space-3); }",".ak-facts > div { display: grid; gap: 2px; padding-top: var(--artifact-space-2); border-top: 1px solid var(--artifact-color-border); }",".ak-facts dt { color: var(--artifact-color-muted); font-size: var(--artifact-font-size-1); }",".ak-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }",".ak-table { max-width: 100%; overflow-x: auto; border: 1px solid var(--artifact-color-border); border-radius: var(--artifact-radius-md); background: var(--artifact-color-surface); }",".ak-table table { width: 100%; border-collapse: collapse; font-size: var(--artifact-font-size-1); font-variant-numeric: tabular-nums; }",".ak-table caption { padding: var(--artifact-space-3) var(--artifact-space-3) var(--artifact-space-2); color: var(--artifact-color-muted); text-align: left; }",".ak-table caption strong { color: var(--artifact-color-text); }",".ak-table th, .ak-table td { padding: var(--artifact-space-2) var(--artifact-space-3); border-top: 1px solid var(--artifact-color-border); text-align: left; vertical-align: top; }",".ak-table thead th { background: var(--artifact-color-raised); color: var(--artifact-color-muted); font-weight: 600; }",".ak-table tbody th { font-weight: 600; }","@media (max-width: 640px) {"," .ak-table--stack table, .ak-table--stack caption, .ak-table--stack tbody, .ak-table--stack tr, .ak-table--stack th, .ak-table--stack td { display: block; }"," .ak-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }"," .ak-table--stack tr { padding: var(--artifact-space-2) 0; border-top: 1px solid var(--artifact-color-border); }"," .ak-table--stack th, .ak-table--stack td { padding: var(--artifact-space-1) var(--artifact-space-3); border: 0; }"," .ak-table--stack td[data-label]::before { content: attr(data-label); display: block; color: var(--artifact-color-muted); font-size: var(--artifact-font-size-0); font-weight: 600; }","}",".ak-code { display: grid; overflow: hidden; border: 1px solid var(--artifact-color-border); border-radius: var(--artifact-radius-md); background: var(--artifact-color-surface); }",".ak-code figcaption { padding: var(--artifact-space-1) var(--artifact-space-3); border-bottom: 1px solid var(--artifact-color-border); color: var(--artifact-color-muted); font: 600 var(--artifact-font-size-0)/1.6 var(--artifact-font-mono); }",".ak-code pre { margin: 0; padding: var(--artifact-space-3); overflow-x: auto; font-size: var(--artifact-font-size-1); line-height: 1.55; tab-size: 2; }",".ak-steps { display: grid; gap: var(--artifact-space-3); padding: 0; list-style: none; counter-reset: ak-step; }",".ak-steps > li { position: relative; display: grid; gap: var(--artifact-space-1); min-height: 2rem; padding-left: 2.75rem; counter-increment: ak-step; }",".ak-steps > li::before { content: counter(ak-step); position: absolute; top: 0; left: 0; display: grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--artifact-color-border); border-radius: 50%; background: var(--artifact-color-raised); font: 600 var(--artifact-font-size-1)/1 var(--artifact-font-mono); }",".ak-decision { display: grid; gap: var(--artifact-space-2); padding: var(--artifact-space-4); border: 1px solid var(--artifact-color-border); border-radius: var(--artifact-radius-lg); background: var(--artifact-color-surface); }",".ak-decision__pick { padding: var(--artifact-space-2) var(--artifact-space-3); border-radius: var(--artifact-radius-md); background: color-mix(in srgb, var(--artifact-color-success) 10%, var(--artifact-color-surface)); }",".ak-quote { display: grid; gap: var(--artifact-space-1); max-width: 68ch; padding-left: var(--artifact-space-4); border-left: 3px solid var(--artifact-color-border); }",".ak-quote p { font-family: var(--artifact-font-display); font-size: calc((var(--artifact-font-size-2) + var(--artifact-font-size-3)) / 2); }",".ak-quote cite { color: var(--artifact-color-muted); font-size: var(--artifact-font-size-1); font-style: normal; }",".ak-switch { display: grid; gap: var(--artifact-space-3); }",".ak-switch > * { min-width: 0; }",".ak-switch__bar { display: inline-flex; flex-wrap: wrap; justify-self: start; gap: 2px; padding: 2px; border: 1px solid var(--artifact-color-border); border-radius: var(--artifact-radius-md); background: var(--artifact-color-raised); }",".ak-switch__bar button { min-height: 36px; padding: 0 var(--artifact-space-3); border: 0; border-radius: max(0px, calc(var(--artifact-radius-md) - 2px)); background: transparent; color: var(--artifact-color-muted); font-size: var(--artifact-font-size-1); font-weight: 600; cursor: pointer; }",'.ak-switch__bar button[aria-pressed="true"] { background: var(--artifact-color-surface); color: var(--artifact-color-text); box-shadow: 0 0 0 1px var(--artifact-color-control); text-decoration: underline; text-underline-offset: 0.2em; }',".ak-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: var(--artifact-space-4); }",".ak-compare > * { display: grid; align-content: start; gap: var(--artifact-space-2); min-width: 0; }",".ak-compare__label { color: var(--artifact-color-muted); font-size: var(--artifact-font-size-1); font-weight: 600; }",".ak-frame { display: grid; overflow: hidden; border: 1px solid var(--artifact-color-border); border-radius: var(--artifact-radius-lg); background: var(--artifact-color-surface); box-shadow: 0 1px 3px color-mix(in srgb, var(--artifact-color-text) 10%, transparent); }",".ak-frame__bar { display: flex; align-items: center; gap: var(--artifact-space-2); min-height: 34px; padding: 0 var(--artifact-space-3); overflow: hidden; border-bottom: 1px solid var(--artifact-color-border); background: var(--artifact-color-raised); color: var(--artifact-color-muted); font: var(--artifact-font-size-0)/1.4 var(--artifact-font-mono); white-space: nowrap; text-overflow: ellipsis; }",'.ak-frame__bar::before { content: ""; flex: none; width: 34px; height: 8px; background: radial-gradient(circle, var(--artifact-color-control) 3px, transparent 3.5px) 0 50% / 13px 8px repeat-x; opacity: 0.55; }',".ak-frame__body { min-width: 0; overflow: auto; }",".ak-frame__caption { padding: var(--artifact-space-2) var(--artifact-space-3); border-top: 1px solid var(--artifact-color-border); color: var(--artifact-color-muted); font-size: var(--artifact-font-size-1); }",".ak-demo { color: var(--demo-text, var(--artifact-color-text)); background: var(--demo-bg, transparent); font-family: var(--demo-font, var(--artifact-font-family)); }",".ak-demo { font-size: var(--demo-font-size, 16px); line-height: var(--demo-line-height, 1.5); }",":where(.ak-demo h1, .ak-demo h2, .ak-demo h3, .ak-demo h4, .ak-demo a, .ak-demo code, .ak-demo pre) { font: inherit; color: inherit; letter-spacing: normal; }",".ak-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--artifact-space-1); min-height: 40px; padding: 0 var(--artifact-space-3); border: 1px solid var(--artifact-color-control); border-radius: var(--artifact-radius-sm); background: var(--artifact-color-surface); color: var(--artifact-color-text); font-size: var(--artifact-font-size-1); font-weight: 600; cursor: pointer; }",".ak-button:hover:not(:disabled) { border-color: var(--artifact-color-text); }",".ak-button--primary { border-color: var(--artifact-color-action); background: var(--artifact-color-action); color: var(--artifact-color-action-text); }",".ak-button--primary:hover:not(:disabled) { border-color: var(--artifact-color-action); background: color-mix(in srgb, var(--artifact-color-action) 88%, var(--artifact-color-text)); }",".ak-button:disabled { opacity: 0.5; cursor: not-allowed; }",".ak-actions { display: flex; flex-wrap: wrap; gap: var(--artifact-space-2); }",".ak-field { display: grid; gap: var(--artifact-space-1); font-size: var(--artifact-font-size-1); font-weight: 600; }",".ak-input { width: 100%; min-width: 0; min-height: 40px; padding: var(--artifact-space-1) var(--artifact-space-2); border: 1px solid var(--artifact-color-control); border-radius: var(--artifact-radius-sm); background: var(--artifact-color-surface); font-weight: 400; }",".ak-input::placeholder { color: var(--artifact-color-muted); opacity: 1; }",'.ak-input[aria-invalid="true"] { border-color: var(--artifact-color-danger); }',".ak-footer { padding-top: var(--artifact-space-4); border-top: 1px solid var(--artifact-color-border); color: var(--artifact-color-muted); font-size: var(--artifact-font-size-1); }","@media (prefers-reduced-motion: no-preference) { .ak-button, .ak-switch__bar button { transition: background-color 0.15s ease, border-color 0.15s ease; } }","@media print { .ak-switch__bar { display: none; } .ak-switch [data-ak-panel][hidden] { display: grid !important; } .ak-page { width: auto; } }"].join(`
22
+ `),mi=["(function () {",' var marker = "data-ak-switch-ready";'," if (document.documentElement.hasAttribute(marker)) return;",' document.documentElement.setAttribute(marker, "");',' function own(sw, node) { return node.closest("[data-ak-switch]") === sw; }'," function choose(sw, value) {",' sw.querySelectorAll("[data-ak-option]").forEach(function (b) { if (own(sw, b)) b.setAttribute("aria-pressed", String(b.getAttribute("data-ak-option") === value)); });',' sw.querySelectorAll("[data-ak-panel]").forEach(function (p) { if (own(sw, p)) p.hidden = p.getAttribute("data-ak-panel") !== value; });',' sw.dispatchEvent(new CustomEvent("ak-change", { bubbles: true, detail: { value: value } }));'," }",' document.addEventListener("click", function (event) {'," var target = event.target;"," if (!(target instanceof Element)) return;",' var button = target.closest("button[data-ak-option]:not(:disabled)");',' var sw = button && button.closest("[data-ak-switch]");',' if (sw) choose(sw, button.getAttribute("data-ak-option"));'," });"," function init() {",' document.querySelectorAll("[data-ak-switch]").forEach(function (sw) {',' var options = Array.prototype.filter.call(sw.querySelectorAll("[data-ak-option]"), function (b) { return own(sw, b); });',' var pick = options.find(function (b) { return b.getAttribute("aria-pressed") === "true"; }) || options[0];',' if (pick) choose(sw, pick.getAttribute("data-ak-option"));'," });"," }",' if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", init); else init();',"})();"].join(`
23
+ `);function gi(e){return[...new Set([...e.matchAll(/\.(ak-[a-z0-9_-]+)/g)].map(t=>t[1]??""))].sort()}var dn={1:{css:cn,script:mi,classes:gi(cn)}};function hi(e){return e!==void 0&&Object.hasOwn(dn,e)?dn[e]:void 0}var vi="artifact-kit";function bi(e){for(let{name:t,text:a}of ln(e)){if(t!=="meta")continue;let r=new Map;for(let n of a.slice(5,-1).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)){let o=(n[1]??"").toLowerCase();r.has(o)||r.set(o,n[2]??n[3]??n[4]??"")}if(r.get("name")?.toLowerCase()===vi)return r.get("content")??""}}function pn(e){let t=bi(e),a=hi(t);return a===void 0?"":'<style data-artifact-kit="'+t+'">'+a.css+'</style><script data-artifact-kit="'+t+'">'+a.script+"<\/script>"}var el=String.raw`Kit 1. Add <meta name="artifact-kit" content="1"> and the renderer injects these classes and the switch script. The kit already styles body text, headings, links, code, focus, and selection from the tokens, so write no base styles of your own. Page CSS may add layout for content the kit does not cover.
24
+
25
+ Page: <main class="ak-page"> (72rem) or "ak-page ak-page--narrow" (48rem, reading pages).
26
+ Header: <header class="ak-header"><h1>Title</h1><p class="ak-lede">One-paragraph answer.</p><ul class="ak-meta"><li>Date</li><li><span class="ak-badge ak-badge--warning">Draft</span></li></ul></header>
27
+ Section: <section class="ak-section" data-section="key" aria-labelledby="key"><div class="ak-section__head"><h2 id="key">Heading</h2><p>Optional standfirst.</p></div>...</section>. Long text goes in <div class="ak-prose">.
28
+ Layout: ak-grid (cards that wrap), ak-split (two columns that stack), ak-card.
29
+ Callout: <aside class="ak-callout ak-callout--info"><p class="ak-callout__title">Title</p><p>Text</p></aside>. Choose ak-callout--info, ak-callout--success, ak-callout--warning, or ak-callout--danger. Use one for a rule or risk, not for emphasis.
30
+ Badge: <span class="ak-badge ak-badge--info">Text</span>. Choose ak-badge--info, ak-badge--success, ak-badge--warning, or ak-badge--danger; ak-badge--plain drops the dot. Always carry a text label.
31
+ Facts: <dl class="ak-facts"><div><dt>Label</dt><dd>Value</dd></div></dl>.
32
+ Table: <div class="ak-table" tabindex="0" role="region" aria-label="..."><table><caption>Scope or source of the rows</caption>...</table></div>. Add ak-table--stack and data-label on each td to stack rows on narrow panels.
33
+ Code: <figure class="ak-code"><figcaption>path/or/label</figcaption><pre><code>...</code></pre></figure>.
34
+ Steps: <ol class="ak-steps"><li><strong>Step</strong><p>Detail</p></li></ol>.
35
+ Decision: <article class="ak-decision"><h3>Question</h3><p>Options and evidence</p><p class="ak-decision__pick"><strong>Recommended:</strong> choice and reason</p></article>.
36
+ Quote: <blockquote class="ak-quote"><p>Exact words</p><cite>Who, where</cite></blockquote>.
37
+ Switch (before and after, scenarios, tabs of states): <div class="ak-switch" data-ak-switch><div class="ak-switch__bar" role="group" aria-label="View"><button type="button" data-ak-option="before" aria-pressed="true">Before</button><button type="button" data-ak-option="after" aria-pressed="false">After</button></div><div data-ak-panel="before">...</div><div data-ak-panel="after" hidden>...</div></div>. The switch emits an ak-change event with detail.value. Print shows every panel. Give each panel its own visible heading so its meaning survives without the switch buttons.
38
+ Compare (side by side): <div class="ak-compare"><div><p class="ak-compare__label">Today</p>...</div><div><p class="ak-compare__label">Proposed</p>...</div></div>.
39
+ Product UI replica: <figure class="ak-frame"><div class="ak-frame__bar">app.example.com/settings</div><div class="ak-frame__body ak-demo">...</div><figcaption class="ak-frame__caption">What to notice</figcaption></figure>. Inside .ak-demo, recreate the product's own look: define its colors and fonts once as custom properties on the .ak-demo element (--demo-bg, --demo-text, --demo-font, and any others you need) and use only those variables in the replica's rules. Prefix every replica selector with .ak-demo; this is a styling convention, not CSS isolation. Set --demo-font-size and --demo-line-height when needed.
40
+ Controls: ak-button, ak-button--primary, ak-actions (button row), <label class="ak-field">Label<input class="ak-input" name="..."></label>. Buttons use type="button".
41
+ Small text: ak-muted, ak-small, ak-num (tabular numbers). Footer: <footer class="ak-footer">.
42
+ `;function yi(e){return/<meta\b[^>]*name\s*=\s*["']?color-scheme["']?[^>]*content\s*=\s*["'][^"']*\bdark\b/i.test(e)||/<meta\b[^>]*content\s*=\s*["'][^"']*\bdark\b[^"']*["'][^>]*name\s*=\s*["']?color-scheme/i.test(e)}var fn="default-src 'none'; img-src data: blob:; media-src data: blob:; style-src 'unsafe-inline'; script-src 'unsafe-inline' 'unsafe-eval'; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'",mn=["body, .art-docpage { color: var(--artifact-color-text); font-family: var(--artifact-font-family); font-size: 16px; line-height: 1.65; }","h1, h2, h3, h4 { font-family: var(--artifact-font-display); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; margin: 1.8em 0 0.5em; color: var(--artifact-color-text); text-wrap: balance; }","h1 { font-size: 2.1em; margin-top: 0; }","h2 { font-size: 1.45em; }","h3 { font-size: 1.15em; }","p, ul, ol, blockquote, table, pre { margin: 0 0 1em; }","a { color: var(--artifact-color-primary); text-underline-offset: 2px; }","strong { font-weight: 650; }","code { font-family: var(--artifact-font-mono); font-size: 0.88em; padding: 0.1em 0.35em; border-radius: var(--artifact-radius-sm); background: color-mix(in srgb, var(--artifact-color-text) 7%, transparent); }","pre { font-family: var(--artifact-font-mono); font-size: 0.86em; line-height: 1.55; padding: 14px 16px; border-radius: var(--artifact-radius-md); background: color-mix(in srgb, var(--artifact-color-text) 6%, transparent); overflow: auto; }","pre code { padding: 0; background: none; font-size: 1em; }","blockquote { padding: 0 0 0 16px; border-left: 3px solid var(--artifact-color-accent); color: var(--artifact-color-muted); }","ul, ol { padding-left: 1.4em; }","li + li { margin-top: 0.25em; }","table { border-collapse: collapse; width: 100%; font-size: 0.94em; font-variant-numeric: tabular-nums; }","th, td { padding: 8px 10px; border-bottom: 1px solid color-mix(in srgb, var(--artifact-color-text) 14%, transparent); text-align: left; vertical-align: top; }","th { font-weight: 600; color: var(--artifact-color-muted); border-bottom-color: color-mix(in srgb, var(--artifact-color-text) 28%, transparent); }","hr { border: none; border-top: 1px solid color-mix(in srgb, var(--artifact-color-text) 14%, transparent); margin: 2em 0; }"].join(`
43
+ `);var Ha="<script>addEventListener('message',function(e){if(e.source!==parent||e.data!=='dsh-artifact-print')return;addEventListener('afterprint',function(){parent.postMessage('dsh-artifact-printed','*')},{once:true});print()})<\/script>";function un(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function wi(e){return e.replace(/<meta\b[^>]*http-equiv\s*=\s*["']?refresh["']?[^>]*>/gi,"").replace(/<meta\b[^>]*content\s*=\s*["'][^"']*url\s*=[^>]*>/gi,"")}function gn(e,t,a,r,n="",o="auto"){let s=e.replace(/<style\b(?=[^>]*\sdata-artifact-(?:tokens|kit)(?:\s|=|>))[^>]*>[\s\S]*?<\/style\s*>/gi,""),l='<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">'+(a===null?"":`<meta http-equiv="Content-Security-Policy" content="${un(a)}">`)+`<title>${un(r)}</title><style data-artifact-tokens>${t}</style>`+pn(s)+n;return`<!doctype html><html${yi(e)?` ${Vt}="${o}"`:""}><head>${l}</head><body>${wi(s)}</body></html>`}var hn="allow-scripts",xi="allow-scripts allow-modals",ki=3e4,Si="<script>(function(){var t;document.addEventListener('selectionchange',function(){clearTimeout(t);t=setTimeout(function(){var s=String(getSelection()||'');parent.postMessage({dshArtifactSelection:s.slice(0,4000)},'*')},150)})})()<\/script>",Ti=4e3;function ta(e,t,a,r="auto",n=!1){return gn(e,t,fn,a,n?Si:"",r)}function vn(e){if(e===null||typeof e!="object")return;let t={...e};return typeof t.dshArtifactSelection=="string"?t.dshArtifactSelection.slice(0,Ti):void 0}function bn(e){let t=/<\/head>/i.test(e)?e.replace(/<\/head>/i,`${Ha}</head>`):`${Ha}${e}`,a=URL.createObjectURL(new Blob([t],{type:"text/html"})),r=document.createElement("iframe");r.setAttribute("sandbox",xi),r.setAttribute("aria-hidden","true"),r.tabIndex=-1,r.style.cssText="position:fixed;left:-10000px;top:0;width:800px;height:1000px;border:0;";let n=!1,o=()=>{n||(n=!0,clearTimeout(l),window.removeEventListener("message",s),r.remove(),URL.revokeObjectURL(a))},s=c=>{c.source===r.contentWindow&&c.data==="dsh-artifact-printed"&&o()};window.addEventListener("message",s);let l=setTimeout(o,ki);r.addEventListener("load",()=>{r.contentWindow?.postMessage("dsh-artifact-print","*")},{once:!0}),r.src=a,document.body.appendChild(r)}var ra=require("@deepseek-ai/dsh-client-ui-primitives");var yn={"design.system":"Named system","design.defaultChoice":"Current default","design.copy":"Save as new system","design.saveRevision":"Save new revision","design.useDefault":"Use for new artifacts","design.revision":"{name}, revision {revision}","design.catalogReload":"Reload catalog, keep edits","design.unsavedSelection":"Save or discard these token edits before switching systems.","design.discardEdits":"Discard token edits","design.pinHint":"New artifacts keep these settings. Existing pinned artifacts change only through rebase.","generation.pinned":"Pinned design","generation.legacy":"Live design, legacy version","generation.rebase":"Rebase design","generation.confirm":"Create a new version with this design?","generation.explain":"Your content stays unchanged. Any unsaved edits will be saved first. The selected design revision and current recipe will be pinned in a new version.","generation.apply":"Save and rebase","generation.done":"Design rebased in a new version","error.staleCatalog":"The catalog changed. Reload it and review your edits before saving again.","error.writerBusy":"Another writer or a stale lock owns this store. Finish that writer or recover the lock after a crash.","error.unsupportedKit":"This saved component kit is not installed. Install its version before opening this artifact.","agent.ask":"Edit with agent","agent.reference":'In artifact "{title}" ({id}, v{version}):',"agent.referenceOld":'In artifact "{title}" ({id}, v{version}, the current version is v{current}):',"agent.referenceProject":'In artifact "{title}" ({id}, workspace {workspaceId}, v{version}):',"agent.referenceOldProject":'In artifact "{title}" ({id}, workspace {workspaceId}, v{version}, the current version is v{current}):',"agent.added":"Added to your message. Describe the change, then send.","agent.addedTruncated":"Added to your message. The selection was shortened to 2,000 characters.","agent.insertFailed":"The message box is busy, so the request was copied instead.","agent.copied":"Copied. Paste it into a conversation, then send.","agent.copyTitle":"Copy the request","card.creating":"Creating {title}","card.updating":"Updating {title}","card.updatingUntitled":"Updating the artifact","card.openNamed":"Open {title}","tab.codeHint":"Read-only code. Select text to ask the agent about it.","tab.editSource":"Edit code","tab.deleteTitle":"Move to trash?","code.copy":"Copy code","dialog.close":"Close","dialog.done":"Done","design.colorsDark":"Dark colors","panel.layers":"Layers","panel.properties":"Properties","panel.none":"No layers","panel.mixed":"Mixed","panel.expand":"Expand","panel.collapse":"Collapse","panel.show":"Show","panel.hide":"Hide","panel.lock":"Lock","panel.unlock":"Unlock","panel.rename":"Rename layer","panel.x":"X","panel.y":"Y","panel.rotation":"Rotate","panel.radius":"Radius","panel.opacity":"Opacity","panel.visible":"Visible","panel.hidden":"Hidden","panel.family":"Font family","panel.weight":"Weight","panel.fontSize":"Size","panel.w":"W","panel.h":"H","panel.positionSize":"Position and size","panel.layerActions":"Layer actions","panel.duplicate":"Duplicate","panel.forward":"Bring forward","panel.backward":"Send backward","panel.align":"Align","panel.alignLeft":"Align left","panel.alignCenterX":"Align horizontal centers","panel.alignRight":"Align right","panel.alignTop":"Align top","panel.alignMiddle":"Align vertical centers","panel.alignBottom":"Align bottom","panel.fill":"Fill","panel.stroke":"Stroke","panel.appearance":"Appearance","panel.text":"Text","panel.selectLayerHint":"Select a layer to see its properties.","panel.selectTextHint":"Select a text layer to change its font, weight, and size.","layer.parentLine":"{type} in {parent}","layer.type.frame":"Frame","layer.type.section":"Section","layer.type.text":"Text","layer.type.rectangle":"Rectangle","layer.type.ellipse":"Ellipse","layer.type.line":"Line","layer.type.vector":"Vector","layer.type.group":"Group","layer.type.component":"Component","layer.type.instance":"Instance","layer.type.other":"Layer","canvas.viewMode":"View","canvas.editMode":"Edit","canvas.opening":"Opening the canvas\u2026","canvas.startFailed":"The canvas did not start. Showing the saved image.","canvas.empty":"This mockup has no layers yet. Switch to Edit to draw one.","canvas.zoomControls":"Zoom","canvas.zoomOut":"Zoom out","canvas.zoomIn":"Zoom in","canvas.zoomMenu":"Zoom level","canvas.zoomValue":"{percent}%","canvas.inspector":"Inspector","canvas.closeInspector":"Close inspector","canvas.inspectorTabs":"Inspector sections","canvas.editOldVersion":"Old versions open in View only. Restore this version to edit.","agent.quoteDesign":`Layer "{name}"
23
44
  Path: {path}
24
45
 
25
- Design JSX:`,"agent.quoteCut":"The Design JSX was shortened to {limit} characters.","agent.addedTruncatedDesign":"Added to your message. The layer's code was shortened to 4,000 characters.","canvas.toolbar":"Canvas tools","canvas.tools":"Tool","canvas.select":"Select","canvas.hand":"Hand","canvas.frame":"Frame","canvas.text":"Text","canvas.undo":"Undo","canvas.redo":"Redo","canvas.fit":"Fit","preview.loading":"Rendering the mockup\u2026","preview.retry":"Render again","preview.warnings":"Preview warnings","error.designIconNotFound":"That icon is not in the bundled set. Use an mdi: name from Material Design Icons.","design.display":"Heading font stack","composer.recent":"This project","composer.empty":"No artifacts yet","composer.start":"Start with","composer.all":"All artifacts","gallery.copyPrompt":"Copy prompt","gallery.copyPromptNamed":"Copy the {name} prompt","gallery.promptCopied":"Prompt copied. Paste it into a conversation.","prompt.dashboard":"Dashboard","prompt.dashboardText":"Create an artifact page: a dashboard that shows ","prompt.explainer":"Explainer","prompt.explainerText":"Create an artifact page: a one-page visual explainer of ","prompt.report":"Report","prompt.reportText":"Create an artifact doc: a report about ","prompt.brief":"Project brief","prompt.briefText":"Create an artifact doc: a project brief with context, goal, scope, and open questions for ","filter.type":"Filter by type","tab.mode":"Page view","tab.manualSave":"Page source saves with Save or Ctrl/Cmd+S.","tab.manualSaveDesign":"Mockup source saves with Save or Ctrl/Cmd+S.","tab.versionPicker":"Choose version","tab.currentVersion":"current","tab.allVersions":"All versions","tab.agentUpdate":"Updated to v{version}","tab.viewHistory":"View history","tab.dismiss":"Dismiss","tab.leaveTitle":"Unsaved changes","tab.leaveHint":"Save your changes before continuing, or discard them.","tab.leaveDiscard":"Discard","tab.leaveSave":"Save","tab.copyDraft":"Copy my draft","tab.discardReload":"Discard mine and reload","history.close":"Close history","action.copied":"Copied","action.copyFailed":"Copy was blocked. Select the text and copy it manually.","format.toolbar":"Document formatting","format.heading":"Heading","format.bold":"Bold","format.italic":"Italic","format.bulletList":"Bullet list","format.orderedList":"Numbered list","format.codeBlock":"Code block",panel:"Artifacts","right.guideHint":"Pages, documents, and mockups in this project.","action.back":"Back","scope.label":"Scope","scope.all":"All projects","scope.workspace":"This project","scope.library":"Library","type.page":"Page","type.doc":"Document","type.design":"Mockup","type.all":"All types","gallery.search":"Search artifacts","gallery.searchLabel":"Search by title","gallery.create":"New artifact","gallery.newPage":"New page","gallery.newDoc":"New document","gallery.newDesign":"New mockup","gallery.design":"Design system","gallery.refresh":"Refresh","gallery.more":"Show more","gallery.truncated":"Only the first 500 artifacts are scanned.","gallery.failedProjects":"Some sources could not be loaded.","gallery.version":"v{version}","gallery.updated":"Updated {time}","gallery.count":"{count} artifacts","gallery.pinned":"Pinned","gallery.recent":"Recently updated","gallery.coverTitle":"Preview of {title}","gallery.coverFailed":"Preview unavailable","gallery.pin":"Pin {title}","gallery.unpin":"Unpin {title}","gallery.allPinned":"Everything here is pinned.","empty.workspaceTitle":"No artifacts in this project yet","empty.workspaceHint":"Ask the agent for a dashboard, report, or one-pager, or start one here.","empty.allTitle":"No artifacts yet","empty.allHint":"Artifacts from every project and your library appear here.","empty.libraryTitle":"Your library is empty","empty.libraryHint":"Library artifacts follow you to every project. Ask the agent to save one to the library.","empty.noMatch":"Nothing matches that search.","empty.typeMatch":"No {type} artifacts match the filter.","empty.noWorkspace":"Open a session in a workspace to see its artifacts.","empty.loading":"Loading...","create.title":"New {type}","create.name":"Title","create.scope":"Save to","create.submit":"Create","create.cancel":"Cancel","create.untitledPage":"Untitled page","create.untitledDesign":"Untitled mockup","create.untitledDoc":"Untitled document","tab.preview":"Preview","tab.source":"Code","tab.history":"History","tab.export":"Export","tab.reload":"Reload","tab.rename":"Rename","tab.delete":"Move to trash","tab.deleteConfirm":'"{title}" moves to the trash. Its files stay there for 7 days.',"tab.save":"Save","tab.saving":"Saving...","tab.saved":"Saved","tab.readOnly":"Read-only","tab.saveFailed":"Save failed","tab.unsaved":"Unsaved changes","tab.frameTitle":"Artifact preview: {title}","tab.versionOf":"Version {version}","tab.viewingOld":"Viewing version {version}. The current version is {current}.","tab.backToCurrent":"Back to current","tab.restoreThis":"Restore this version","tab.conflictTitle":"This artifact changed","tab.conflictHint":"A newer version was saved while you were editing. Your draft is kept here. Copy it before discarding, then reload the latest version.","tab.deleted":"This artifact is no longer here","tab.deletedHint":"It was moved to the trash or deleted.","tab.close":"Close tab","history.title":"Versions","history.current":"Current","history.byAgent":"Agent","history.byUser":"You","history.restored":"Restored from v{version}","history.created":"Created","history.updated":"Edited","history.empty":"No earlier versions.","export.html":"HTML file","export.png":"PNG image","export.svg":"SVG image","export.fig":"OpenPencil document (.fig)","export.md":"Markdown file","export.docx":"Word document","export.print":"Print or save as PDF","export.done":"Saved {name} to {path}","design.title":"Design system","design.hint":"Pages and documents use these values through CSS variables.","design.source.workspace":"This project overrides the library.","design.source.library":"Inherited from your library.","design.source.default":"Built-in defaults. Save to start your own.","design.name":"Name","design.colors":"Colors","design.color.primary":"Primary","design.color.accent":"Accent","design.color.surface":"Surface","design.color.text":"Text","design.color.muted":"Muted","design.color.background":"Page background","design.color.raised":"Raised background","design.color.border":"Divider","design.color.control":"Control border","design.color.action":"Action background","design.color.actionText":"Action text","design.color.focus":"Focus ring","design.color.success":"Success","design.color.warning":"Warning","design.color.danger":"Danger","design.type":"Typography","design.font":"Body font stack","design.mono":"Code font stack","design.radius":"Corner radius","design.radius.sm":"Small","design.radius.md":"Medium","design.radius.lg":"Large","design.notes":"Notes for the agent","design.notesHint":"Tone, layout rules, or brand guidance the agent reads before it designs.","design.saveWorkspace":"Save for this project","design.saveWorkspaceNamed":"Save for {name}","design.saveLibrary":"Save to library","design.clear":"Remove project override","design.saved":"Design system saved","design.preview":"Preview","design.previewHeading":"Quarterly review","design.previewBody":"Revenue grew in every region this quarter.","design.previewButton":"Primary action","card.created":"Created","card.updated":"Updated","card.working":"Writing the artifact...","card.failed":"The artifact was not saved","card.missing":"This result has no artifact details.","composer.label":"Artifacts","error.generic":"Something went wrong. Try again.","error.designInvalid":"The mockup source is not valid.","error.designIcon":"The mockup cannot use that icon.","error.designRender":"The mockup could not be rendered.","error.designTimeout":"The mockup took too long to render.","error.designUnavailable":"This runtime cannot render mockups.","error.unsupportedType":"That action is not available for this artifact.","error.notFound":"This artifact no longer exists.","error.stale":"The artifact changed. Reload to continue.","error.tooLarge":"The content is over the 2 MiB limit.","error.noWorkspace":"This session has no workspace.","error.forbidden":"That path is not allowed.","error.corrupt":"The artifact files are damaged.","error.tokens":"A design value is not valid CSS.","error.library":"The library folder cannot be created.","error.surface":"The artifact panel failed to draw.","error.surfaceHint":"Reload the window. Your artifacts are safe on disk.","action.retry":"Retry","action.reloadWindow":"Reload window","time.justNow":"just now","time.minutes":"{count} min ago","time.hours":"{count} h ago","time.days":"{count} d ago"},Mr={"agent.ask":"\u8BA9\u667A\u80FD\u4F53\u4FEE\u6539","agent.reference":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0Cv{version}\uFF09\u4E2D\uFF1A","agent.referenceOld":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0Cv{version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A v{current}\uFF09\u4E2D\uFF1A","agent.referenceProject":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0C\u5DE5\u4F5C\u533A {workspaceId}\uFF0Cv{version}\uFF09\u4E2D\uFF1A","agent.referenceOldProject":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0C\u5DE5\u4F5C\u533A {workspaceId}\uFF0Cv{version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A v{current}\uFF09\u4E2D\uFF1A","agent.added":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u63CF\u8FF0\u8981\u4FEE\u6539\u7684\u5185\u5BB9\u540E\u53D1\u9001\u3002","agent.addedTruncated":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u9009\u4E2D\u7684\u6587\u672C\u5DF2\u7F29\u77ED\u4E3A 2,000 \u4E2A\u5B57\u7B26\u3002","agent.insertFailed":"\u6D88\u606F\u6846\u6B63\u5FD9\uFF0C\u5DF2\u6539\u4E3A\u590D\u5236\u8BF7\u6C42\u3002","agent.copied":"\u5DF2\u590D\u5236\u3002\u7C98\u8D34\u5230\u5BF9\u8BDD\u4E2D\u540E\u53D1\u9001\u3002","agent.copyTitle":"\u590D\u5236\u8BF7\u6C42","card.creating":"\u6B63\u5728\u521B\u5EFA {title}","card.updating":"\u6B63\u5728\u66F4\u65B0 {title}","card.updatingUntitled":"\u6B63\u5728\u66F4\u65B0\u4EA7\u7269","card.openNamed":"\u6253\u5F00 {title}","tab.codeHint":"\u53EA\u8BFB\u4EE3\u7801\u3002\u9009\u4E2D\u6587\u672C\u5373\u53EF\u8BA9\u667A\u80FD\u4F53\u5904\u7406\u3002","tab.editSource":"\u7F16\u8F91\u4EE3\u7801","tab.deleteTitle":"\u79FB\u5230\u56DE\u6536\u7AD9\uFF1F","code.copy":"\u590D\u5236\u4EE3\u7801","dialog.close":"\u5173\u95ED","dialog.done":"\u5B8C\u6210","design.colorsDark":"\u6DF1\u8272\u914D\u8272","panel.layers":"\u56FE\u5C42","panel.properties":"\u5C5E\u6027","panel.none":"\u6CA1\u6709\u56FE\u5C42","panel.mixed":"\u6DF7\u5408","panel.expand":"\u5C55\u5F00","panel.collapse":"\u6298\u53E0","panel.show":"\u663E\u793A","panel.hide":"\u9690\u85CF","panel.lock":"\u9501\u5B9A","panel.unlock":"\u89E3\u9501","panel.rename":"\u91CD\u547D\u540D\u56FE\u5C42","panel.x":"X","panel.y":"Y","panel.rotation":"\u65CB\u8F6C","panel.radius":"\u5706\u89D2","panel.opacity":"\u4E0D\u900F\u660E\u5EA6","panel.visible":"\u53EF\u89C1","panel.hidden":"\u5DF2\u9690\u85CF","panel.family":"\u5B57\u4F53","panel.weight":"\u5B57\u91CD","panel.fontSize":"\u5B57\u53F7","panel.w":"\u5BBD","panel.h":"\u9AD8","panel.positionSize":"\u4F4D\u7F6E\u548C\u5C3A\u5BF8","panel.appearance":"\u5916\u89C2","panel.text":"\u6587\u672C","panel.selectLayerHint":"\u9009\u62E9\u4E00\u4E2A\u56FE\u5C42\u4EE5\u67E5\u770B\u5176\u5C5E\u6027\u3002","panel.selectTextHint":"\u9009\u62E9\u6587\u672C\u56FE\u5C42\u53EF\u4FEE\u6539\u5B57\u4F53\u3001\u5B57\u91CD\u548C\u5B57\u53F7\u3002","layer.parentLine":"{type}\uFF0C\u4F4D\u4E8E {parent}","layer.type.frame":"\u6846\u67B6","layer.type.section":"\u5206\u533A","layer.type.text":"\u6587\u672C","layer.type.rectangle":"\u77E9\u5F62","layer.type.ellipse":"\u692D\u5706","layer.type.line":"\u7EBF","layer.type.vector":"\u77E2\u91CF","layer.type.group":"\u7F16\u7EC4","layer.type.component":"\u7EC4\u4EF6","layer.type.instance":"\u5B9E\u4F8B","layer.type.other":"\u56FE\u5C42","canvas.viewMode":"\u67E5\u770B","canvas.editMode":"\u7F16\u8F91","canvas.opening":"\u6B63\u5728\u6253\u5F00\u753B\u5E03\u2026","canvas.startFailed":"\u753B\u5E03\u672A\u80FD\u542F\u52A8\uFF0C\u73B0\u663E\u793A\u5DF2\u4FDD\u5B58\u7684\u56FE\u7247\u3002","canvas.empty":"\u6B64\u539F\u578B\u8FD8\u6CA1\u6709\u56FE\u5C42\u3002\u5207\u6362\u5230\u7F16\u8F91\u6A21\u5F0F\u5373\u53EF\u7ED8\u5236\u3002","canvas.zoomControls":"\u7F29\u653E","canvas.zoomOut":"\u7F29\u5C0F","canvas.zoomIn":"\u653E\u5927","canvas.zoomMenu":"\u7F29\u653E\u7EA7\u522B","canvas.zoomValue":"{percent}%","canvas.inspector":"\u68C0\u67E5\u5668","canvas.closeInspector":"\u5173\u95ED\u68C0\u67E5\u5668","canvas.inspectorTabs":"\u68C0\u67E5\u5668\u5206\u533A","canvas.editOldVersion":"\u65E7\u7248\u672C\u4EC5\u53EF\u67E5\u770B\u3002\u6062\u590D\u6B64\u7248\u672C\u540E\u624D\u80FD\u7F16\u8F91\u3002","agent.quoteDesign":`\u56FE\u5C42\u201C{name}\u201D
46
+ Design JSX:`,"agent.quoteCut":"The Design JSX was shortened to {limit} characters.","agent.addedTruncatedDesign":"Added to your message. The layer's code was shortened to 4,000 characters.","canvas.toolbar":"Canvas tools","canvas.tools":"Tool","canvas.select":"Select","canvas.hand":"Hand","canvas.frame":"Frame","canvas.text":"Text","canvas.rectangle":"Rectangle","canvas.ellipse":"Ellipse","canvas.line":"Line","canvas.pen":"Pen","canvas.undo":"Undo","canvas.redo":"Redo","canvas.fit":"Fit","preview.loading":"Rendering the mockup\u2026","preview.retry":"Render again","preview.warnings":"Preview warnings","error.designIconNotFound":"That icon is not in the bundled set. Use an mdi: name from Material Design Icons.","design.display":"Heading font stack","composer.recent":"This project","composer.empty":"No artifacts yet","composer.start":"Start with","composer.all":"All artifacts","gallery.copyPrompt":"Copy prompt","gallery.copyPromptNamed":"Copy the {name} prompt","gallery.promptCopied":"Prompt copied. Paste it into a conversation.","prompt.dashboard":"Dashboard","prompt.dashboardText":"Create an artifact page: a dashboard that shows ","prompt.explainer":"Explainer","prompt.explainerText":"Create an artifact page: a one-page visual explainer of ","prompt.report":"Report","prompt.reportText":"Create an artifact doc: a report about ","prompt.brief":"Project brief","prompt.briefText":"Create an artifact doc: a project brief with context, goal, scope, and open questions for ","prompt.sheet":"Spreadsheet","prompt.sheetText":"Create an artifact sheet: a spreadsheet that tracks ","filter.type":"Filter by type","tab.mode":"Page view","tab.manualSave":"Page source saves with Save or Ctrl/Cmd+S.","tab.manualSaveDesign":"Mockup source saves with Save or Ctrl/Cmd+S.","tab.designWarnings":"Design warnings (version {version})","tab.versionPicker":"Choose version","tab.currentVersion":"current","tab.allVersions":"All versions","tab.agentUpdate":"Updated to v{version}","tab.viewHistory":"View history","tab.dismiss":"Dismiss","tab.leaveTitle":"Unsaved changes","tab.leaveHint":"Save your changes before continuing, or discard them.","tab.leaveDiscard":"Discard","tab.leaveSave":"Save","tab.copyDraft":"Copy my draft","tab.discardReload":"Discard mine and reload","history.close":"Close history","action.copied":"Copied","action.copyFailed":"Copy was blocked. Select the text and copy it manually.","format.toolbar":"Document formatting","format.heading":"Heading","format.bold":"Bold","format.italic":"Italic","format.bulletList":"Bullet list","format.orderedList":"Numbered list","format.codeBlock":"Code block",panel:"Artifacts","right.guideHint":"Pages, documents, and mockups in this project.","action.back":"Back","scope.label":"Scope","scope.all":"All projects","scope.workspace":"This project","scope.library":"Library","type.page":"Page","type.doc":"Document","type.design":"Mockup","type.sheet":"Spreadsheet","type.all":"All types","gallery.search":"Search artifacts","gallery.searchLabel":"Search by title","gallery.create":"New artifact","gallery.newPage":"New page","gallery.newDoc":"New document","gallery.newDesign":"New mockup","gallery.newSheet":"New spreadsheet","gallery.design":"Design system","gallery.refresh":"Refresh","gallery.more":"Show more","gallery.truncated":"Only the first 500 artifacts are scanned.","gallery.failedProjects":"Some sources could not be loaded.","gallery.version":"v{version}","gallery.updated":"Updated {time}","gallery.count":"{count} artifacts","gallery.pinned":"Pinned","gallery.recent":"Recently updated","gallery.coverTitle":"Preview of {title}","gallery.coverFailed":"Preview unavailable","gallery.pin":"Pin {title}","gallery.unpin":"Unpin {title}","gallery.allPinned":"Everything here is pinned.","empty.workspaceTitle":"No artifacts in this project yet","empty.workspaceHint":"Ask the agent for a dashboard, report, or one-pager, or start one here.","empty.allTitle":"No artifacts yet","empty.allHint":"Artifacts from every project and your library appear here.","empty.libraryTitle":"Your library is empty","empty.libraryHint":"Library artifacts follow you to every project. Ask the agent to save one to the library.","empty.noMatch":"Nothing matches that search.","empty.typeMatch":"No {type} artifacts match the filter.","empty.noWorkspace":"Open a session in a workspace to see its artifacts.","empty.loading":"Loading...","create.title":"New {type}","create.name":"Title","create.scope":"Save to","create.submit":"Create","create.cancel":"Cancel","create.untitledPage":"Untitled page","create.untitledDesign":"Untitled mockup","create.untitledDoc":"Untitled document","create.untitledSheet":"Untitled spreadsheet","sheet.toolbar":"Spreadsheet tools","sheet.selection":"Selected cells","sheet.formulaBar":"Formula bar","sheet.selectColumn":"Select column {name}","sheet.selectRow":"Select row {row}","sheet.undo":"Undo","sheet.redo":"Redo","sheet.bold":"Bold","sheet.italic":"Italic","sheet.underline":"Underline","sheet.alignLeft":"Align left","sheet.alignCenter":"Align center","sheet.alignRight":"Align right","sheet.numberFormat":"Number format","sheet.format.general":"General","sheet.format.number":"Number","sheet.format.integer":"Whole number","sheet.format.currency":"Currency","sheet.format.percent":"Percent","sheet.format.date":"Date","sheet.fillColor":"Fill color","sheet.textColor":"Text color","sheet.invalid":"This sheet cannot be read.","sheet.editCell":"Edit cell {ref}","sheet.sheets":"Sheets","sheet.addSheet":"Add sheet","sheet.sheetName":"Sheet name","sheet.sheetActions":"Sheet actions","sheet.renameSheet":"Rename sheet","sheet.deleteSheet":"Delete sheet","sheet.deleteConfirm":'Delete "{name}"? Its cells are removed in a new version; History keeps the old one.',"sheet.delete":"Delete","sheet.cancel":"Cancel","tab.preview":"Preview","tab.source":"Code","tab.history":"History","tab.export":"Export","tab.reload":"Reload","tab.rename":"Rename","tab.delete":"Move to trash","tab.deleteConfirm":'"{title}" moves to the trash. Its files stay there for 7 days.',"tab.save":"Save","tab.saving":"Saving...","tab.saved":"Saved","tab.readOnly":"Read-only","tab.saveFailed":"Save failed","tab.unsaved":"Unsaved changes","tab.frameTitle":"Artifact preview: {title}","tab.versionOf":"Version {version}","tab.viewingOld":"Viewing version {version}. The current version is {current}.","tab.backToCurrent":"Back to current","tab.restoreThis":"Restore this version","tab.conflictTitle":"This artifact changed","tab.conflictHint":"A newer version was saved while you were editing. Your draft is kept here. Copy it before discarding, then reload the latest version.","tab.deleted":"This artifact is no longer here","tab.deletedHint":"It was moved to the trash or deleted.","tab.close":"Close tab","history.title":"Versions","history.current":"Current","history.byAgent":"Agent","history.byUser":"You","history.restored":"Restored from v{version}","history.created":"Created","history.updated":"Edited","history.empty":"No earlier versions.","export.html":"HTML file","export.mockupHtml":"Interactive HTML (view-only)","export.mockupSvgHtml":"Static HTML (SVG, smaller)","export.png":"PNG image","export.svg":"SVG image","export.fig":"OpenPencil document (.fig)","export.md":"Markdown file","export.docx":"Word document","export.csv":"CSV file","export.xlsx":"Excel workbook","export.downloaded":"Downloaded {name}.","export.print":"Print or save as PDF","export.done":"Saved {name} to {path}","design.title":"Design system","design.hint":"Pages and documents use these values through CSS variables.","design.source.workspace":"This project overrides the library.","design.source.library":"Inherited from your library.","design.source.default":"Built-in defaults. Save to start your own.","design.name":"Name","design.colors":"Colors","design.color.primary":"Primary","design.color.accent":"Accent","design.color.surface":"Surface","design.color.text":"Text","design.color.muted":"Muted","design.color.background":"Page background","design.color.raised":"Raised background","design.color.border":"Divider","design.color.control":"Control border","design.color.action":"Action background","design.color.actionText":"Action text","design.color.focus":"Focus ring","design.color.success":"Success","design.color.warning":"Warning","design.color.danger":"Danger","design.type":"Typography","design.font":"Body font stack","design.mono":"Code font stack","design.radius":"Corner radius","design.radius.sm":"Small","design.radius.md":"Medium","design.radius.lg":"Large","design.notes":"Notes for the agent","design.notesHint":"Tone, layout rules, or brand guidance the agent reads before it designs.","design.saveWorkspace":"Save for this project","design.saveWorkspaceNamed":"Save for {name}","design.saveLibrary":"Save to library","design.clear":"Remove project override","design.saved":"Design system saved","design.preview":"Preview","design.previewHeading":"Quarterly review","design.previewBody":"Revenue grew in every region this quarter.","design.previewButton":"Primary action","card.created":"Created","card.updated":"Updated","card.working":"Writing the artifact...","card.failed":"The artifact was not saved","card.missing":"This result has no artifact details.","composer.label":"Artifacts","error.generic":"Something went wrong. Try again.","error.designInvalid":"The mockup source is not valid.","error.designIcon":"The mockup cannot use that icon.","error.designRender":"The mockup could not be rendered.","error.designTimeout":"The mockup took too long to render.","error.designUnavailable":"This runtime cannot render mockups.","error.unsupportedType":"That action is not available for this artifact.","error.sheetInvalid":"The sheet workbook is not valid.","error.notFound":"This artifact no longer exists.","error.stale":"The artifact changed. Reload to continue.","error.tooLarge":"The content is over the 2 MiB limit.","error.noWorkspace":"This session has no workspace.","error.forbidden":"That path is not allowed.","error.corrupt":"The artifact files are damaged.","error.tokens":"A design value is not valid CSS.","error.library":"The library folder cannot be created.","error.surface":"The artifact panel failed to draw.","error.surfaceHint":"Reload the window. Your artifacts are safe on disk.","action.retry":"Retry","action.reloadWindow":"Reload window","time.justNow":"just now","time.minutes":"{count} min ago","time.hours":"{count} h ago","time.days":"{count} d ago"},wn={"design.system":"\u547D\u540D\u8BBE\u8BA1\u7CFB\u7EDF","design.defaultChoice":"\u5F53\u524D\u9ED8\u8BA4","design.copy":"\u53E6\u5B58\u4E3A\u65B0\u7CFB\u7EDF","design.saveRevision":"\u4FDD\u5B58\u65B0\u4FEE\u8BA2","design.useDefault":"\u7528\u4E8E\u65B0\u4EA7\u7269","design.revision":"{name}\uFF0C\u4FEE\u8BA2 {revision}","design.catalogReload":"\u91CD\u65B0\u52A0\u8F7D\u76EE\u5F55\u5E76\u4FDD\u7559\u7F16\u8F91","design.unsavedSelection":"\u5207\u6362\u7CFB\u7EDF\u524D\u8BF7\u4FDD\u5B58\u6216\u653E\u5F03\u4EE4\u724C\u7F16\u8F91\u3002","design.discardEdits":"\u653E\u5F03\u4EE4\u724C\u7F16\u8F91","design.pinHint":"\u65B0\u4EA7\u7269\u4F1A\u56FA\u5B9A\u8FD9\u4E9B\u8BBE\u7F6E\u3002\u5DF2\u6709\u56FA\u5B9A\u8BBE\u7F6E\u7684\u4EA7\u7269\u53EA\u4F1A\u901A\u8FC7\u91CD\u65B0\u5E94\u7528\u8BBE\u8BA1\u66F4\u6539\u3002","generation.pinned":"\u5DF2\u56FA\u5B9A\u8BBE\u8BA1","generation.legacy":"\u5B9E\u65F6\u8BBE\u8BA1\uFF0C\u65E7\u7248\u672C","generation.rebase":"\u91CD\u65B0\u5E94\u7528\u8BBE\u8BA1","generation.confirm":"\u4F7F\u7528\u6B64\u8BBE\u8BA1\u521B\u5EFA\u65B0\u7248\u672C\uFF1F","generation.explain":"\u5185\u5BB9\u4FDD\u6301\u4E0D\u53D8\u3002\u672A\u4FDD\u5B58\u7684\u7F16\u8F91\u5C06\u5148\u4FDD\u5B58\u3002\u6240\u9009\u8BBE\u8BA1\u4FEE\u8BA2\u548C\u5F53\u524D\u6A21\u677F\u5C06\u56FA\u5B9A\u5728\u65B0\u7248\u672C\u4E2D\u3002","generation.apply":"\u4FDD\u5B58\u5E76\u5E94\u7528\u8BBE\u8BA1","generation.done":"\u8BBE\u8BA1\u5DF2\u5E94\u7528\u5230\u65B0\u7248\u672C","error.staleCatalog":"\u76EE\u5F55\u5DF2\u66F4\u6539\u3002\u8BF7\u91CD\u65B0\u52A0\u8F7D\u5E76\u68C0\u67E5\u7F16\u8F91\u540E\u518D\u4FDD\u5B58\u3002","error.writerBusy":"\u53E6\u4E00\u4E2A\u5199\u5165\u8FDB\u7A0B\u6216\u9057\u7559\u9501\u5360\u7528\u4E86\u6B64\u5B58\u50A8\u3002\u8BF7\u7B49\u5F85\u5199\u5165\u7ED3\u675F\uFF0C\u6216\u5728\u5D29\u6E83\u540E\u6062\u590D\u9501\u3002","error.unsupportedKit":"\u672A\u5B89\u88C5\u6B64\u4EA7\u7269\u4F7F\u7528\u7684\u7EC4\u4EF6\u5957\u4EF6\u3002\u8BF7\u5148\u5B89\u88C5\u5BF9\u5E94\u7248\u672C\u3002","agent.ask":"\u8BA9\u667A\u80FD\u4F53\u4FEE\u6539","agent.reference":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0Cv{version}\uFF09\u4E2D\uFF1A","agent.referenceOld":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0Cv{version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A v{current}\uFF09\u4E2D\uFF1A","agent.referenceProject":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0C\u5DE5\u4F5C\u533A {workspaceId}\uFF0Cv{version}\uFF09\u4E2D\uFF1A","agent.referenceOldProject":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0C\u5DE5\u4F5C\u533A {workspaceId}\uFF0Cv{version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A v{current}\uFF09\u4E2D\uFF1A","agent.added":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u63CF\u8FF0\u8981\u4FEE\u6539\u7684\u5185\u5BB9\u540E\u53D1\u9001\u3002","agent.addedTruncated":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u9009\u4E2D\u7684\u6587\u672C\u5DF2\u7F29\u77ED\u4E3A 2,000 \u4E2A\u5B57\u7B26\u3002","agent.insertFailed":"\u6D88\u606F\u6846\u6B63\u5FD9\uFF0C\u5DF2\u6539\u4E3A\u590D\u5236\u8BF7\u6C42\u3002","agent.copied":"\u5DF2\u590D\u5236\u3002\u7C98\u8D34\u5230\u5BF9\u8BDD\u4E2D\u540E\u53D1\u9001\u3002","agent.copyTitle":"\u590D\u5236\u8BF7\u6C42","card.creating":"\u6B63\u5728\u521B\u5EFA {title}","card.updating":"\u6B63\u5728\u66F4\u65B0 {title}","card.updatingUntitled":"\u6B63\u5728\u66F4\u65B0\u4EA7\u7269","card.openNamed":"\u6253\u5F00 {title}","tab.codeHint":"\u53EA\u8BFB\u4EE3\u7801\u3002\u9009\u4E2D\u6587\u672C\u5373\u53EF\u8BA9\u667A\u80FD\u4F53\u5904\u7406\u3002","tab.editSource":"\u7F16\u8F91\u4EE3\u7801","tab.deleteTitle":"\u79FB\u5230\u56DE\u6536\u7AD9\uFF1F","code.copy":"\u590D\u5236\u4EE3\u7801","dialog.close":"\u5173\u95ED","dialog.done":"\u5B8C\u6210","design.colorsDark":"\u6DF1\u8272\u914D\u8272","panel.layers":"\u56FE\u5C42","panel.properties":"\u5C5E\u6027","panel.none":"\u6CA1\u6709\u56FE\u5C42","panel.mixed":"\u6DF7\u5408","panel.expand":"\u5C55\u5F00","panel.collapse":"\u6298\u53E0","panel.show":"\u663E\u793A","panel.hide":"\u9690\u85CF","panel.lock":"\u9501\u5B9A","panel.unlock":"\u89E3\u9501","panel.rename":"\u91CD\u547D\u540D\u56FE\u5C42","panel.x":"X","panel.y":"Y","panel.rotation":"\u65CB\u8F6C","panel.radius":"\u5706\u89D2","panel.opacity":"\u4E0D\u900F\u660E\u5EA6","panel.visible":"\u53EF\u89C1","panel.hidden":"\u5DF2\u9690\u85CF","panel.family":"\u5B57\u4F53","panel.weight":"\u5B57\u91CD","panel.fontSize":"\u5B57\u53F7","panel.w":"\u5BBD","panel.h":"\u9AD8","panel.positionSize":"\u4F4D\u7F6E\u548C\u5C3A\u5BF8","panel.layerActions":"\u56FE\u5C42\u64CD\u4F5C","panel.duplicate":"\u590D\u5236","panel.forward":"\u5411\u524D\u79FB\u52A8","panel.backward":"\u5411\u540E\u79FB\u52A8","panel.align":"\u5BF9\u9F50","panel.alignLeft":"\u5DE6\u5BF9\u9F50","panel.alignCenterX":"\u6C34\u5E73\u5C45\u4E2D\u5BF9\u9F50","panel.alignRight":"\u53F3\u5BF9\u9F50","panel.alignTop":"\u9876\u5BF9\u9F50","panel.alignMiddle":"\u5782\u76F4\u5C45\u4E2D\u5BF9\u9F50","panel.alignBottom":"\u5E95\u5BF9\u9F50","panel.fill":"\u586B\u5145","panel.stroke":"\u63CF\u8FB9","panel.appearance":"\u5916\u89C2","panel.text":"\u6587\u672C","panel.selectLayerHint":"\u9009\u62E9\u4E00\u4E2A\u56FE\u5C42\u4EE5\u67E5\u770B\u5176\u5C5E\u6027\u3002","panel.selectTextHint":"\u9009\u62E9\u6587\u672C\u56FE\u5C42\u53EF\u4FEE\u6539\u5B57\u4F53\u3001\u5B57\u91CD\u548C\u5B57\u53F7\u3002","layer.parentLine":"{type}\uFF0C\u4F4D\u4E8E {parent}","layer.type.frame":"\u6846\u67B6","layer.type.section":"\u5206\u533A","layer.type.text":"\u6587\u672C","layer.type.rectangle":"\u77E9\u5F62","layer.type.ellipse":"\u692D\u5706","layer.type.line":"\u7EBF","layer.type.vector":"\u77E2\u91CF","layer.type.group":"\u7F16\u7EC4","layer.type.component":"\u7EC4\u4EF6","layer.type.instance":"\u5B9E\u4F8B","layer.type.other":"\u56FE\u5C42","canvas.viewMode":"\u67E5\u770B","canvas.editMode":"\u7F16\u8F91","canvas.opening":"\u6B63\u5728\u6253\u5F00\u753B\u5E03\u2026","canvas.startFailed":"\u753B\u5E03\u672A\u80FD\u542F\u52A8\uFF0C\u73B0\u663E\u793A\u5DF2\u4FDD\u5B58\u7684\u56FE\u7247\u3002","canvas.empty":"\u6B64\u539F\u578B\u8FD8\u6CA1\u6709\u56FE\u5C42\u3002\u5207\u6362\u5230\u7F16\u8F91\u6A21\u5F0F\u5373\u53EF\u7ED8\u5236\u3002","canvas.zoomControls":"\u7F29\u653E","canvas.zoomOut":"\u7F29\u5C0F","canvas.zoomIn":"\u653E\u5927","canvas.zoomMenu":"\u7F29\u653E\u7EA7\u522B","canvas.zoomValue":"{percent}%","canvas.inspector":"\u68C0\u67E5\u5668","canvas.closeInspector":"\u5173\u95ED\u68C0\u67E5\u5668","canvas.inspectorTabs":"\u68C0\u67E5\u5668\u5206\u533A","canvas.editOldVersion":"\u65E7\u7248\u672C\u4EC5\u53EF\u67E5\u770B\u3002\u6062\u590D\u6B64\u7248\u672C\u540E\u624D\u80FD\u7F16\u8F91\u3002","agent.quoteDesign":`\u56FE\u5C42\u201C{name}\u201D
26
47
  \u8DEF\u5F84\uFF1A{path}
27
48
 
28
- \u8BBE\u8BA1 JSX\uFF1A`,"agent.quoteCut":"\u8BBE\u8BA1 JSX \u5DF2\u7F29\u77ED\u4E3A {limit} \u4E2A\u5B57\u7B26\u3002","agent.addedTruncatedDesign":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u56FE\u5C42\u4EE3\u7801\u5DF2\u7F29\u77ED\u4E3A 4,000 \u4E2A\u5B57\u7B26\u3002","canvas.toolbar":"\u753B\u5E03\u5DE5\u5177","canvas.tools":"\u5DE5\u5177","canvas.select":"\u9009\u62E9","canvas.hand":"\u6293\u624B","canvas.frame":"\u6846\u67B6","canvas.text":"\u6587\u672C","canvas.undo":"\u64A4\u9500","canvas.redo":"\u91CD\u505A","canvas.fit":"\u9002\u5E94","preview.loading":"\u6B63\u5728\u6E32\u67D3\u539F\u578B\u2026","preview.retry":"\u91CD\u65B0\u6E32\u67D3","preview.warnings":"\u9884\u89C8\u8B66\u544A","error.designIconNotFound":"\u8BE5\u56FE\u6807\u4E0D\u5728\u5185\u7F6E\u56FE\u6807\u96C6\u4E2D\u3002\u8BF7\u4F7F\u7528 Material Design Icons \u7684 mdi: \u540D\u79F0\u3002","design.display":"\u6807\u9898\u5B57\u4F53\u6808","composer.recent":"\u5F53\u524D\u9879\u76EE","composer.empty":"\u8FD8\u6CA1\u6709\u4EA7\u7269","composer.start":"\u4ECE\u8FD9\u91CC\u5F00\u59CB","composer.all":"\u5168\u90E8\u4EA7\u7269","gallery.copyPrompt":"\u590D\u5236\u63D0\u793A\u8BCD","gallery.copyPromptNamed":"\u590D\u5236\u201C{name}\u201D\u63D0\u793A\u8BCD","gallery.promptCopied":"\u63D0\u793A\u8BCD\u5DF2\u590D\u5236\u3002\u7C98\u8D34\u5230\u5BF9\u8BDD\u4E2D\u5373\u53EF\u3002","prompt.dashboard":"\u4EEA\u8868\u76D8","prompt.dashboardText":"\u521B\u5EFA\u4E00\u4E2A artifact \u9875\u9762\uFF1A\u4E00\u4E2A\u4EEA\u8868\u76D8\uFF0C\u5C55\u793A","prompt.explainer":"\u56FE\u89E3\u8BF4\u660E","prompt.explainerText":"\u521B\u5EFA\u4E00\u4E2A artifact \u9875\u9762\uFF1A\u4E00\u9875\u53EF\u89C6\u5316\u8BF4\u660E\uFF0C\u4E3B\u9898\u662F","prompt.report":"\u62A5\u544A","prompt.reportText":"\u521B\u5EFA\u4E00\u4E2A artifact \u6587\u6863\uFF1A\u4E00\u4EFD\u62A5\u544A\uFF0C\u4E3B\u9898\u662F","prompt.brief":"\u9879\u76EE\u7B80\u4ECB","prompt.briefText":"\u521B\u5EFA\u4E00\u4E2A artifact \u6587\u6863\uFF1A\u4E00\u4EFD\u9879\u76EE\u7B80\u4ECB\uFF0C\u5305\u542B\u80CC\u666F\u3001\u76EE\u6807\u3001\u8303\u56F4\u548C\u5F85\u5B9A\u95EE\u9898\uFF0C\u9879\u76EE\u662F","filter.type":"\u6309\u7C7B\u578B\u7B5B\u9009","tab.mode":"\u9875\u9762\u89C6\u56FE","tab.manualSave":"\u9875\u9762\u6E90\u7801\u9700\u70B9\u51FB\u4FDD\u5B58\u6216\u6309 Ctrl/Cmd+S\u3002","tab.manualSaveDesign":"\u539F\u578B\u6E90\u7801\u9700\u70B9\u51FB\u4FDD\u5B58\u6216\u6309 Ctrl/Cmd+S\u3002","tab.versionPicker":"\u9009\u62E9\u7248\u672C","tab.currentVersion":"\u5F53\u524D","tab.allVersions":"\u5168\u90E8\u7248\u672C","tab.agentUpdate":"\u5DF2\u66F4\u65B0\u5230 v{version}","tab.viewHistory":"\u67E5\u770B\u5386\u53F2","tab.dismiss":"\u5173\u95ED","tab.leaveTitle":"\u672A\u4FDD\u5B58\u7684\u66F4\u6539","tab.leaveHint":"\u7EE7\u7EED\u524D\u4FDD\u5B58\u66F4\u6539\uFF0C\u6216\u653E\u5F03\u5B83\u4EEC\u3002","tab.leaveDiscard":"\u653E\u5F03","tab.leaveSave":"\u4FDD\u5B58","tab.copyDraft":"\u590D\u5236\u6211\u7684\u8349\u7A3F","tab.discardReload":"\u653E\u5F03\u6211\u7684\u66F4\u6539\u5E76\u91CD\u65B0\u52A0\u8F7D","history.close":"\u5173\u95ED\u5386\u53F2","action.copied":"\u5DF2\u590D\u5236","action.copyFailed":"\u590D\u5236\u88AB\u963B\u6B62\u3002\u8BF7\u9009\u4E2D\u6587\u672C\u540E\u624B\u52A8\u590D\u5236\u3002","format.toolbar":"\u6587\u6863\u683C\u5F0F","format.heading":"\u6807\u9898","format.bold":"\u7C97\u4F53","format.italic":"\u659C\u4F53","format.bulletList":"\u9879\u76EE\u7B26\u53F7\u5217\u8868","format.orderedList":"\u7F16\u53F7\u5217\u8868","format.codeBlock":"\u4EE3\u7801\u5757",panel:"\u4EA7\u7269","right.guideHint":"\u6B64\u9879\u76EE\u4E2D\u7684\u9875\u9762\u3001\u6587\u6863\u548C\u539F\u578B\u3002","action.back":"\u8FD4\u56DE","scope.label":"\u8303\u56F4","scope.all":"\u5168\u90E8\u9879\u76EE","scope.workspace":"\u5F53\u524D\u9879\u76EE","scope.library":"\u8D44\u6599\u5E93","type.page":"\u9875\u9762","type.doc":"\u6587\u6863","type.design":"\u539F\u578B","type.all":"\u5168\u90E8\u7C7B\u578B","gallery.search":"\u641C\u7D22\u4EA7\u7269","gallery.searchLabel":"\u6309\u6807\u9898\u641C\u7D22","gallery.create":"\u65B0\u5EFA\u4EA7\u7269","gallery.newPage":"\u65B0\u5EFA\u9875\u9762","gallery.newDoc":"\u65B0\u5EFA\u6587\u6863","gallery.newDesign":"\u65B0\u5EFA\u539F\u578B","gallery.design":"\u8BBE\u8BA1\u7CFB\u7EDF","gallery.refresh":"\u5237\u65B0","gallery.more":"\u663E\u793A\u66F4\u591A","gallery.truncated":"\u4EC5\u626B\u63CF\u524D 500 \u4E2A\u4EA7\u7269\u3002","gallery.failedProjects":"\u90E8\u5206\u6765\u6E90\u52A0\u8F7D\u5931\u8D25\u3002","gallery.version":"v{version}","gallery.updated":"\u66F4\u65B0\u4E8E {time}","gallery.count":"{count} \u4E2A\u4EA7\u7269","gallery.pinned":"\u5DF2\u7F6E\u9876","gallery.recent":"\u6700\u8FD1\u66F4\u65B0","gallery.coverTitle":"{title} \u7684\u9884\u89C8","gallery.coverFailed":"\u9884\u89C8\u4E0D\u53EF\u7528","gallery.pin":"\u7F6E\u9876 {title}","gallery.unpin":"\u53D6\u6D88\u7F6E\u9876 {title}","gallery.allPinned":"\u8FD9\u91CC\u7684\u4EA7\u7269\u90FD\u5DF2\u7F6E\u9876\u3002","empty.workspaceTitle":"\u672C\u9879\u76EE\u8FD8\u6CA1\u6709\u4EA7\u7269","empty.workspaceHint":"\u8BA9\u667A\u80FD\u4F53\u751F\u6210\u4EEA\u8868\u76D8\u3001\u62A5\u544A\u6216\u5355\u9875\uFF0C\u6216\u5728\u8FD9\u91CC\u65B0\u5EFA\u3002","empty.allTitle":"\u8FD8\u6CA1\u6709\u4EA7\u7269","empty.allHint":"\u8FD9\u91CC\u663E\u793A\u6240\u6709\u9879\u76EE\u548C\u8D44\u6599\u5E93\u4E2D\u7684\u4EA7\u7269\u3002","empty.libraryTitle":"\u8D44\u6599\u5E93\u4E3A\u7A7A","empty.libraryHint":"\u8D44\u6599\u5E93\u4E2D\u7684\u4EA7\u7269\u5728\u6240\u6709\u9879\u76EE\u53EF\u7528\u3002\u8BA9\u667A\u80FD\u4F53\u628A\u4EA7\u7269\u4FDD\u5B58\u5230\u8D44\u6599\u5E93\u3002","empty.noMatch":"\u6CA1\u6709\u5339\u914D\u7684\u4EA7\u7269\u3002","empty.typeMatch":"\u6CA1\u6709\u7B26\u5408\u7C7B\u578B\u7B5B\u9009\u7684{type}\u4EA7\u7269\u3002","empty.noWorkspace":"\u5728\u5DE5\u4F5C\u533A\u4E2D\u6253\u5F00\u4F1A\u8BDD\u4EE5\u67E5\u770B\u5176\u4EA7\u7269\u3002","empty.loading":"\u52A0\u8F7D\u4E2D...","create.title":"\u65B0\u5EFA{type}","create.name":"\u6807\u9898","create.scope":"\u4FDD\u5B58\u5230","create.submit":"\u521B\u5EFA","create.cancel":"\u53D6\u6D88","create.untitledPage":"\u672A\u547D\u540D\u9875\u9762","create.untitledDesign":"\u672A\u547D\u540D\u539F\u578B","create.untitledDoc":"\u672A\u547D\u540D\u6587\u6863","tab.preview":"\u9884\u89C8","tab.source":"\u4EE3\u7801","tab.history":"\u5386\u53F2","tab.export":"\u5BFC\u51FA","tab.reload":"\u91CD\u65B0\u52A0\u8F7D","tab.rename":"\u91CD\u547D\u540D","tab.delete":"\u79FB\u5230\u56DE\u6536\u7AD9","tab.deleteConfirm":"\u201C{title}\u201D\u5C06\u79FB\u5230\u56DE\u6536\u7AD9\uFF0C\u6587\u4EF6\u4F1A\u4FDD\u7559 7 \u5929\u3002","tab.save":"\u4FDD\u5B58","tab.saving":"\u6B63\u5728\u4FDD\u5B58...","tab.saved":"\u5DF2\u4FDD\u5B58","tab.readOnly":"\u53EA\u8BFB","tab.saveFailed":"\u4FDD\u5B58\u5931\u8D25","tab.unsaved":"\u6709\u672A\u4FDD\u5B58\u7684\u66F4\u6539","tab.frameTitle":"\u4EA7\u7269\u9884\u89C8\uFF1A{title}","tab.versionOf":"\u7248\u672C {version}","tab.viewingOld":"\u6B63\u5728\u67E5\u770B\u7248\u672C {version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A {current}\u3002","tab.backToCurrent":"\u56DE\u5230\u5F53\u524D\u7248\u672C","tab.restoreThis":"\u6062\u590D\u6B64\u7248\u672C","tab.conflictTitle":"\u6B64\u4EA7\u7269\u5DF2\u66F4\u6539","tab.conflictHint":"\u7F16\u8F91\u671F\u95F4\u4FDD\u5B58\u4E86\u66F4\u65B0\u7248\u672C\u3002\u8349\u7A3F\u4ECD\u4FDD\u7559\u5728\u8FD9\u91CC\u3002\u653E\u5F03\u524D\u53EF\u5148\u590D\u5236\u8349\u7A3F\uFF0C\u518D\u91CD\u65B0\u52A0\u8F7D\u6700\u65B0\u7248\u672C\u3002","tab.deleted":"\u6B64\u4EA7\u7269\u5DF2\u4E0D\u5B58\u5728","tab.deletedHint":"\u5B83\u5DF2\u88AB\u79FB\u5230\u56DE\u6536\u7AD9\u6216\u5220\u9664\u3002","tab.close":"\u5173\u95ED\u6807\u7B7E\u9875","history.title":"\u7248\u672C","history.current":"\u5F53\u524D","history.byAgent":"\u667A\u80FD\u4F53","history.byUser":"\u4F60","history.restored":"\u4ECE v{version} \u6062\u590D","history.created":"\u521B\u5EFA","history.updated":"\u7F16\u8F91","history.empty":"\u6CA1\u6709\u66F4\u65E9\u7684\u7248\u672C\u3002","export.html":"HTML \u6587\u4EF6","export.png":"PNG \u56FE\u7247","export.svg":"SVG \u56FE\u7247","export.fig":"OpenPencil \u6587\u6863\uFF08.fig\uFF09","export.md":"Markdown \u6587\u4EF6","export.docx":"Word \u6587\u6863","export.print":"\u6253\u5370\u6216\u53E6\u5B58\u4E3A PDF","export.done":"\u5DF2\u5C06 {name} \u4FDD\u5B58\u5230 {path}","design.title":"\u8BBE\u8BA1\u7CFB\u7EDF","design.hint":"\u9875\u9762\u548C\u6587\u6863\u901A\u8FC7 CSS \u53D8\u91CF\u4F7F\u7528\u8FD9\u4E9B\u503C\u3002","design.source.workspace":"\u672C\u9879\u76EE\u8986\u76D6\u4E86\u8D44\u6599\u5E93\u8BBE\u7F6E\u3002","design.source.library":"\u7EE7\u627F\u81EA\u8D44\u6599\u5E93\u3002","design.source.default":"\u5185\u7F6E\u9ED8\u8BA4\u503C\u3002\u4FDD\u5B58\u540E\u5373\u53EF\u81EA\u5B9A\u4E49\u3002","design.name":"\u540D\u79F0","design.colors":"\u989C\u8272","design.color.primary":"\u4E3B\u8272","design.color.accent":"\u5F3A\u8C03\u8272","design.color.surface":"\u5E95\u8272","design.color.text":"\u6587\u5B57","design.color.muted":"\u6B21\u8981","design.color.background":"\u9875\u9762\u80CC\u666F","design.color.raised":"\u6B21\u7EA7\u80CC\u666F","design.color.border":"\u5206\u9694\u7EBF","design.color.control":"\u63A7\u4EF6\u8FB9\u6846","design.color.action":"\u64CD\u4F5C\u80CC\u666F","design.color.actionText":"\u64CD\u4F5C\u6587\u5B57","design.color.focus":"\u7126\u70B9\u8F6E\u5ED3","design.color.success":"\u6210\u529F","design.color.warning":"\u8B66\u544A","design.color.danger":"\u5371\u9669","design.type":"\u5B57\u4F53","design.font":"\u6B63\u6587\u5B57\u4F53","design.mono":"\u4EE3\u7801\u5B57\u4F53","design.radius":"\u5706\u89D2","design.radius.sm":"\u5C0F","design.radius.md":"\u4E2D","design.radius.lg":"\u5927","design.notes":"\u7ED9\u667A\u80FD\u4F53\u7684\u8BF4\u660E","design.notesHint":"\u667A\u80FD\u4F53\u8BBE\u8BA1\u524D\u4F1A\u8BFB\u53D6\u7684\u8BED\u6C14\u3001\u6392\u7248\u89C4\u5219\u6216\u54C1\u724C\u89C4\u8303\u3002","design.saveWorkspace":"\u4FDD\u5B58\u5230\u672C\u9879\u76EE","design.saveWorkspaceNamed":"\u4FDD\u5B58\u5230 {name}","design.saveLibrary":"\u4FDD\u5B58\u5230\u8D44\u6599\u5E93","design.clear":"\u79FB\u9664\u9879\u76EE\u8986\u76D6","design.saved":"\u8BBE\u8BA1\u7CFB\u7EDF\u5DF2\u4FDD\u5B58","design.preview":"\u9884\u89C8","design.previewHeading":"\u5B63\u5EA6\u56DE\u987E","design.previewBody":"\u672C\u5B63\u5EA6\u5404\u533A\u57DF\u6536\u5165\u5747\u6709\u589E\u957F\u3002","design.previewButton":"\u4E3B\u8981\u64CD\u4F5C","card.created":"\u5DF2\u521B\u5EFA","card.updated":"\u5DF2\u66F4\u65B0","card.working":"\u6B63\u5728\u5199\u5165\u4EA7\u7269...","card.failed":"\u4EA7\u7269\u672A\u4FDD\u5B58","card.missing":"\u6B64\u7ED3\u679C\u6CA1\u6709\u4EA7\u7269\u4FE1\u606F\u3002","composer.label":"\u4EA7\u7269","error.generic":"\u51FA\u9519\u4E86\uFF0C\u8BF7\u91CD\u8BD5\u3002","error.designInvalid":"\u539F\u578B\u6E90\u7801\u65E0\u6548\u3002","error.designIcon":"\u8BE5\u539F\u578B\u65E0\u6CD5\u4F7F\u7528\u6B64\u56FE\u6807\u3002","error.designRender":"\u539F\u578B\u65E0\u6CD5\u6E32\u67D3\u3002","error.designTimeout":"\u539F\u578B\u6E32\u67D3\u8D85\u65F6\u3002","error.designUnavailable":"\u6B64\u8FD0\u884C\u65F6\u65E0\u6CD5\u6E32\u67D3\u539F\u578B\u3002","error.unsupportedType":"\u8BE5\u4EA7\u7269\u4E0D\u652F\u6301\u6B64\u64CD\u4F5C\u3002","error.notFound":"\u6B64\u4EA7\u7269\u5DF2\u4E0D\u5B58\u5728\u3002","error.stale":"\u4EA7\u7269\u5DF2\u66F4\u6539\uFF0C\u8BF7\u91CD\u65B0\u52A0\u8F7D\u3002","error.tooLarge":"\u5185\u5BB9\u8D85\u8FC7 2 MiB \u4E0A\u9650\u3002","error.noWorkspace":"\u6B64\u4F1A\u8BDD\u6CA1\u6709\u5DE5\u4F5C\u533A\u3002","error.forbidden":"\u4E0D\u5141\u8BB8\u8BBF\u95EE\u8BE5\u8DEF\u5F84\u3002","error.corrupt":"\u4EA7\u7269\u6587\u4EF6\u5DF2\u635F\u574F\u3002","error.tokens":"\u67D0\u4E2A\u8BBE\u8BA1\u503C\u4E0D\u662F\u6709\u6548\u7684 CSS\u3002","error.library":"\u65E0\u6CD5\u521B\u5EFA\u8D44\u6599\u5E93\u6587\u4EF6\u5939\u3002","error.surface":"\u4EA7\u7269\u9762\u677F\u7ED8\u5236\u5931\u8D25\u3002","error.surfaceHint":"\u8BF7\u91CD\u65B0\u52A0\u8F7D\u7A97\u53E3\u3002\u4F60\u7684\u4EA7\u7269\u4ECD\u5B89\u5168\u4FDD\u5B58\u5728\u78C1\u76D8\u4E0A\u3002","action.retry":"\u91CD\u8BD5","action.reloadWindow":"\u91CD\u65B0\u52A0\u8F7D\u7A97\u53E3","time.justNow":"\u521A\u521A","time.minutes":"{count} \u5206\u949F\u524D","time.hours":"{count} \u5C0F\u65F6\u524D","time.days":"{count} \u5929\u524D"};function Ot(e,t,a=Date.now()){let r=Math.max(0,a-Date.parse(t)),n=Math.floor(r/6e4);if(n<1)return e("time.justNow");if(n<60)return e("time.minutes",{count:n});let o=Math.floor(n/60);if(o<24)return e("time.hours",{count:o});let l=Math.floor(o/24);return l<7?e("time.days",{count:l}):new Date(t).toLocaleDateString()}var ue=require("react/jsx-runtime");function yo(e,t){let a=t.source.origin==="agent"?e("history.byAgent"):e("history.byUser"),r=t.source.action==="restore"&&t.source.restoredFrom!==void 0?e("history.restored",{version:t.source.restoredFrom}):t.source.action==="create"?e("history.created"):e("history.updated");return`${a} \xB7 ${r} \xB7 ${Ot(e,t.createdAt)}`}function Or({t:e,versions:t,failed:a,current:r,selected:n,onSelect:o}){return(0,ue.jsxs)("div",{className:"art-history-body",children:[t===null?(0,ue.jsx)("p",{className:"art-note",children:e("empty.loading")}):null,a?(0,ue.jsx)("p",{className:"art-note",children:e("error.generic")}):null,!a&&t!==null&&t.length<=1?(0,ue.jsx)("p",{className:"art-note",children:e("history.empty")}):null,t?.map(l=>(0,ue.jsxs)("button",{type:"button",className:"art-version","aria-current":l.version===n?"true":void 0,onClick:()=>o(l.version),children:[(0,ue.jsxs)("span",{className:"art-version-top",children:[(0,ue.jsx)("span",{children:e("tab.versionOf",{version:l.version})}),l.version===r?(0,ue.jsx)("span",{className:"art-badge",children:e("history.current")}):null]}),(0,ue.jsx)("span",{className:"art-version-sub",children:yo(e,l)})]},l.version))]})}var be=require("react");var ze=require("react/jsx-runtime");function jt({content:e,designCss:t,title:a,frameTitle:r,dark:n=!1,onSelectionText:o}){let[l,s]=(0,be.useState)(null),[y,c]=(0,be.useState)(!1),h=(0,be.useRef)(0),v=(0,be.useRef)(null),x=(0,be.useRef)(o);x.current=o;let d=o!==void 0;return(0,be.useEffect)(()=>{h.current=0,c(!1);let p=URL.createObjectURL(new Blob([Mt(e,t,a,n?"dark":"light",d)],{type:"text/html"}));return s(p),()=>URL.revokeObjectURL(p)},[e,t,a,n,d]),(0,be.useEffect)(()=>{if(!d)return;let p=u=>{if(v.current===null||h.current>1||u.source!==v.current.contentWindow)return;let m=zr(u.data);m!==void 0&&x.current?.(m)};return window.addEventListener("message",p),()=>window.removeEventListener("message",p)},[d]),y?(0,ze.jsx)("div",{className:"art-center",role:"alert",children:a}):l===null?null:(0,ze.jsx)("iframe",{ref:v,className:"art-frame",title:r,sandbox:Dr,referrerPolicy:"no-referrer",src:l,onLoad:()=>{h.current+=1,h.current>1&&c(!0)}},l)}function jr({value:e,readOnly:t,label:a,hint:r,onChange:n,onSave:o,onSelectionText:l}){let s=y=>{t||l?.(y.value.slice(y.selectionStart,y.selectionEnd))};return(0,ze.jsxs)("div",{className:"art-source-wrap",children:[r===void 0?null:(0,ze.jsx)("div",{className:"art-code-bar",children:(0,ze.jsx)("span",{children:r})}),(0,ze.jsx)("textarea",{className:"art-source","aria-label":a,spellCheck:!1,readOnly:t,value:e,autoFocus:!t,onChange:y=>{n(y.target.value),l?.("")},onSelect:y=>s(y.currentTarget),onMouseUp:y=>s(y.currentTarget),onKeyUp:y=>s(y.currentTarget),onKeyDown:y=>{if((y.ctrlKey||y.metaKey)&&y.key.toLowerCase()==="s"){y.preventDefault(),o();return}if(y.key==="Tab"&&!y.shiftKey&&!t){y.preventDefault();let c=y.currentTarget,h=c.selectionStart,v=c.selectionEnd,x=e.slice(0,h)+" "+e.slice(v);n(x),requestAnimationFrame(()=>c.setSelectionRange(h+2,h+2))}}})]})}function ha(e,t=2e3){let a=e.replace(/\r\n/g,`
49
+ \u8BBE\u8BA1 JSX\uFF1A`,"agent.quoteCut":"\u8BBE\u8BA1 JSX \u5DF2\u7F29\u77ED\u4E3A {limit} \u4E2A\u5B57\u7B26\u3002","agent.addedTruncatedDesign":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u56FE\u5C42\u4EE3\u7801\u5DF2\u7F29\u77ED\u4E3A 4,000 \u4E2A\u5B57\u7B26\u3002","canvas.toolbar":"\u753B\u5E03\u5DE5\u5177","canvas.tools":"\u5DE5\u5177","canvas.select":"\u9009\u62E9","canvas.hand":"\u6293\u624B","canvas.frame":"\u6846\u67B6","canvas.text":"\u6587\u672C","canvas.rectangle":"\u77E9\u5F62","canvas.ellipse":"\u692D\u5706","canvas.line":"\u76F4\u7EBF","canvas.pen":"\u94A2\u7B14","canvas.undo":"\u64A4\u9500","canvas.redo":"\u91CD\u505A","canvas.fit":"\u9002\u5E94","preview.loading":"\u6B63\u5728\u6E32\u67D3\u539F\u578B\u2026","preview.retry":"\u91CD\u65B0\u6E32\u67D3","preview.warnings":"\u9884\u89C8\u8B66\u544A","error.designIconNotFound":"\u8BE5\u56FE\u6807\u4E0D\u5728\u5185\u7F6E\u56FE\u6807\u96C6\u4E2D\u3002\u8BF7\u4F7F\u7528 Material Design Icons \u7684 mdi: \u540D\u79F0\u3002","design.display":"\u6807\u9898\u5B57\u4F53\u6808","composer.recent":"\u5F53\u524D\u9879\u76EE","composer.empty":"\u8FD8\u6CA1\u6709\u4EA7\u7269","composer.start":"\u4ECE\u8FD9\u91CC\u5F00\u59CB","composer.all":"\u5168\u90E8\u4EA7\u7269","gallery.copyPrompt":"\u590D\u5236\u63D0\u793A\u8BCD","gallery.copyPromptNamed":"\u590D\u5236\u201C{name}\u201D\u63D0\u793A\u8BCD","gallery.promptCopied":"\u63D0\u793A\u8BCD\u5DF2\u590D\u5236\u3002\u7C98\u8D34\u5230\u5BF9\u8BDD\u4E2D\u5373\u53EF\u3002","prompt.dashboard":"\u4EEA\u8868\u76D8","prompt.dashboardText":"\u521B\u5EFA\u4E00\u4E2A artifact \u9875\u9762\uFF1A\u4E00\u4E2A\u4EEA\u8868\u76D8\uFF0C\u5C55\u793A","prompt.explainer":"\u56FE\u89E3\u8BF4\u660E","prompt.explainerText":"\u521B\u5EFA\u4E00\u4E2A artifact \u9875\u9762\uFF1A\u4E00\u9875\u53EF\u89C6\u5316\u8BF4\u660E\uFF0C\u4E3B\u9898\u662F","prompt.report":"\u62A5\u544A","prompt.reportText":"\u521B\u5EFA\u4E00\u4E2A artifact \u6587\u6863\uFF1A\u4E00\u4EFD\u62A5\u544A\uFF0C\u4E3B\u9898\u662F","prompt.brief":"\u9879\u76EE\u7B80\u4ECB","prompt.briefText":"\u521B\u5EFA\u4E00\u4E2A artifact \u6587\u6863\uFF1A\u4E00\u4EFD\u9879\u76EE\u7B80\u4ECB\uFF0C\u5305\u542B\u80CC\u666F\u3001\u76EE\u6807\u3001\u8303\u56F4\u548C\u5F85\u5B9A\u95EE\u9898\uFF0C\u9879\u76EE\u662F","prompt.sheet":"\u8868\u683C","prompt.sheetText":"\u521B\u5EFA\u4E00\u4E2A artifact \u8868\u683C\uFF1A\u4E00\u4E2A\u7528\u4E8E\u8DDF\u8E2A\u4EE5\u4E0B\u5185\u5BB9\u7684\u7535\u5B50\u8868\u683C\uFF1A","filter.type":"\u6309\u7C7B\u578B\u7B5B\u9009","tab.mode":"\u9875\u9762\u89C6\u56FE","tab.manualSave":"\u9875\u9762\u6E90\u7801\u9700\u70B9\u51FB\u4FDD\u5B58\u6216\u6309 Ctrl/Cmd+S\u3002","tab.manualSaveDesign":"\u539F\u578B\u6E90\u7801\u9700\u70B9\u51FB\u4FDD\u5B58\u6216\u6309 Ctrl/Cmd+S\u3002","tab.designWarnings":"\u8BBE\u8BA1\u8B66\u544A\uFF08\u7248\u672C {version}\uFF09","tab.versionPicker":"\u9009\u62E9\u7248\u672C","tab.currentVersion":"\u5F53\u524D","tab.allVersions":"\u5168\u90E8\u7248\u672C","tab.agentUpdate":"\u5DF2\u66F4\u65B0\u5230 v{version}","tab.viewHistory":"\u67E5\u770B\u5386\u53F2","tab.dismiss":"\u5173\u95ED","tab.leaveTitle":"\u672A\u4FDD\u5B58\u7684\u66F4\u6539","tab.leaveHint":"\u7EE7\u7EED\u524D\u4FDD\u5B58\u66F4\u6539\uFF0C\u6216\u653E\u5F03\u5B83\u4EEC\u3002","tab.leaveDiscard":"\u653E\u5F03","tab.leaveSave":"\u4FDD\u5B58","tab.copyDraft":"\u590D\u5236\u6211\u7684\u8349\u7A3F","tab.discardReload":"\u653E\u5F03\u6211\u7684\u66F4\u6539\u5E76\u91CD\u65B0\u52A0\u8F7D","history.close":"\u5173\u95ED\u5386\u53F2","action.copied":"\u5DF2\u590D\u5236","action.copyFailed":"\u590D\u5236\u88AB\u963B\u6B62\u3002\u8BF7\u9009\u4E2D\u6587\u672C\u540E\u624B\u52A8\u590D\u5236\u3002","format.toolbar":"\u6587\u6863\u683C\u5F0F","format.heading":"\u6807\u9898","format.bold":"\u7C97\u4F53","format.italic":"\u659C\u4F53","format.bulletList":"\u9879\u76EE\u7B26\u53F7\u5217\u8868","format.orderedList":"\u7F16\u53F7\u5217\u8868","format.codeBlock":"\u4EE3\u7801\u5757",panel:"\u4EA7\u7269","right.guideHint":"\u6B64\u9879\u76EE\u4E2D\u7684\u9875\u9762\u3001\u6587\u6863\u548C\u539F\u578B\u3002","action.back":"\u8FD4\u56DE","scope.label":"\u8303\u56F4","scope.all":"\u5168\u90E8\u9879\u76EE","scope.workspace":"\u5F53\u524D\u9879\u76EE","scope.library":"\u8D44\u6599\u5E93","type.page":"\u9875\u9762","type.doc":"\u6587\u6863","type.design":"\u539F\u578B","type.sheet":"\u8868\u683C","type.all":"\u5168\u90E8\u7C7B\u578B","gallery.search":"\u641C\u7D22\u4EA7\u7269","gallery.searchLabel":"\u6309\u6807\u9898\u641C\u7D22","gallery.create":"\u65B0\u5EFA\u4EA7\u7269","gallery.newPage":"\u65B0\u5EFA\u9875\u9762","gallery.newDoc":"\u65B0\u5EFA\u6587\u6863","gallery.newDesign":"\u65B0\u5EFA\u539F\u578B","gallery.newSheet":"\u65B0\u5EFA\u8868\u683C","gallery.design":"\u8BBE\u8BA1\u7CFB\u7EDF","gallery.refresh":"\u5237\u65B0","gallery.more":"\u663E\u793A\u66F4\u591A","gallery.truncated":"\u4EC5\u626B\u63CF\u524D 500 \u4E2A\u4EA7\u7269\u3002","gallery.failedProjects":"\u90E8\u5206\u6765\u6E90\u52A0\u8F7D\u5931\u8D25\u3002","gallery.version":"v{version}","gallery.updated":"\u66F4\u65B0\u4E8E {time}","gallery.count":"{count} \u4E2A\u4EA7\u7269","gallery.pinned":"\u5DF2\u7F6E\u9876","gallery.recent":"\u6700\u8FD1\u66F4\u65B0","gallery.coverTitle":"{title} \u7684\u9884\u89C8","gallery.coverFailed":"\u9884\u89C8\u4E0D\u53EF\u7528","gallery.pin":"\u7F6E\u9876 {title}","gallery.unpin":"\u53D6\u6D88\u7F6E\u9876 {title}","gallery.allPinned":"\u8FD9\u91CC\u7684\u4EA7\u7269\u90FD\u5DF2\u7F6E\u9876\u3002","empty.workspaceTitle":"\u672C\u9879\u76EE\u8FD8\u6CA1\u6709\u4EA7\u7269","empty.workspaceHint":"\u8BA9\u667A\u80FD\u4F53\u751F\u6210\u4EEA\u8868\u76D8\u3001\u62A5\u544A\u6216\u5355\u9875\uFF0C\u6216\u5728\u8FD9\u91CC\u65B0\u5EFA\u3002","empty.allTitle":"\u8FD8\u6CA1\u6709\u4EA7\u7269","empty.allHint":"\u8FD9\u91CC\u663E\u793A\u6240\u6709\u9879\u76EE\u548C\u8D44\u6599\u5E93\u4E2D\u7684\u4EA7\u7269\u3002","empty.libraryTitle":"\u8D44\u6599\u5E93\u4E3A\u7A7A","empty.libraryHint":"\u8D44\u6599\u5E93\u4E2D\u7684\u4EA7\u7269\u5728\u6240\u6709\u9879\u76EE\u53EF\u7528\u3002\u8BA9\u667A\u80FD\u4F53\u628A\u4EA7\u7269\u4FDD\u5B58\u5230\u8D44\u6599\u5E93\u3002","empty.noMatch":"\u6CA1\u6709\u5339\u914D\u7684\u4EA7\u7269\u3002","empty.typeMatch":"\u6CA1\u6709\u7B26\u5408\u7C7B\u578B\u7B5B\u9009\u7684{type}\u4EA7\u7269\u3002","empty.noWorkspace":"\u5728\u5DE5\u4F5C\u533A\u4E2D\u6253\u5F00\u4F1A\u8BDD\u4EE5\u67E5\u770B\u5176\u4EA7\u7269\u3002","empty.loading":"\u52A0\u8F7D\u4E2D...","create.title":"\u65B0\u5EFA{type}","create.name":"\u6807\u9898","create.scope":"\u4FDD\u5B58\u5230","create.submit":"\u521B\u5EFA","create.cancel":"\u53D6\u6D88","create.untitledPage":"\u672A\u547D\u540D\u9875\u9762","create.untitledDesign":"\u672A\u547D\u540D\u539F\u578B","create.untitledDoc":"\u672A\u547D\u540D\u6587\u6863","create.untitledSheet":"\u672A\u547D\u540D\u8868\u683C","sheet.toolbar":"\u8868\u683C\u5DE5\u5177","sheet.selection":"\u9009\u4E2D\u7684\u5355\u5143\u683C","sheet.formulaBar":"\u7F16\u8F91\u680F","sheet.selectColumn":"\u9009\u62E9\u5217 {name}","sheet.selectRow":"\u9009\u62E9\u884C {row}","sheet.undo":"\u64A4\u9500","sheet.redo":"\u91CD\u505A","sheet.bold":"\u7C97\u4F53","sheet.italic":"\u659C\u4F53","sheet.underline":"\u4E0B\u5212\u7EBF","sheet.alignLeft":"\u5DE6\u5BF9\u9F50","sheet.alignCenter":"\u5C45\u4E2D\u5BF9\u9F50","sheet.alignRight":"\u53F3\u5BF9\u9F50","sheet.numberFormat":"\u6570\u5B57\u683C\u5F0F","sheet.format.general":"\u5E38\u89C4","sheet.format.number":"\u6570\u5B57","sheet.format.integer":"\u6574\u6570","sheet.format.currency":"\u8D27\u5E01","sheet.format.percent":"\u767E\u5206\u6BD4","sheet.format.date":"\u65E5\u671F","sheet.fillColor":"\u586B\u5145\u989C\u8272","sheet.textColor":"\u6587\u5B57\u989C\u8272","sheet.invalid":"\u65E0\u6CD5\u8BFB\u53D6\u6B64\u8868\u683C\u3002","sheet.editCell":"\u7F16\u8F91\u5355\u5143\u683C {ref}","sheet.sheets":"\u5DE5\u4F5C\u8868","sheet.addSheet":"\u6DFB\u52A0\u5DE5\u4F5C\u8868","sheet.sheetName":"\u5DE5\u4F5C\u8868\u540D\u79F0","sheet.sheetActions":"\u5DE5\u4F5C\u8868\u64CD\u4F5C","sheet.renameSheet":"\u91CD\u547D\u540D\u5DE5\u4F5C\u8868","sheet.deleteSheet":"\u5220\u9664\u5DE5\u4F5C\u8868","sheet.deleteConfirm":"\u5220\u9664\u201C{name}\u201D\uFF1F\u5176\u5355\u5143\u683C\u4F1A\u5728\u65B0\u7248\u672C\u4E2D\u79FB\u9664\uFF0C\u5386\u53F2\u7248\u672C\u4ECD\u4FDD\u7559\u65E7\u5185\u5BB9\u3002","sheet.delete":"\u5220\u9664","sheet.cancel":"\u53D6\u6D88","tab.preview":"\u9884\u89C8","tab.source":"\u4EE3\u7801","tab.history":"\u5386\u53F2","tab.export":"\u5BFC\u51FA","tab.reload":"\u91CD\u65B0\u52A0\u8F7D","tab.rename":"\u91CD\u547D\u540D","tab.delete":"\u79FB\u5230\u56DE\u6536\u7AD9","tab.deleteConfirm":"\u201C{title}\u201D\u5C06\u79FB\u5230\u56DE\u6536\u7AD9\uFF0C\u6587\u4EF6\u4F1A\u4FDD\u7559 7 \u5929\u3002","tab.save":"\u4FDD\u5B58","tab.saving":"\u6B63\u5728\u4FDD\u5B58...","tab.saved":"\u5DF2\u4FDD\u5B58","tab.readOnly":"\u53EA\u8BFB","tab.saveFailed":"\u4FDD\u5B58\u5931\u8D25","tab.unsaved":"\u6709\u672A\u4FDD\u5B58\u7684\u66F4\u6539","tab.frameTitle":"\u4EA7\u7269\u9884\u89C8\uFF1A{title}","tab.versionOf":"\u7248\u672C {version}","tab.viewingOld":"\u6B63\u5728\u67E5\u770B\u7248\u672C {version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A {current}\u3002","tab.backToCurrent":"\u56DE\u5230\u5F53\u524D\u7248\u672C","tab.restoreThis":"\u6062\u590D\u6B64\u7248\u672C","tab.conflictTitle":"\u6B64\u4EA7\u7269\u5DF2\u66F4\u6539","tab.conflictHint":"\u7F16\u8F91\u671F\u95F4\u4FDD\u5B58\u4E86\u66F4\u65B0\u7248\u672C\u3002\u8349\u7A3F\u4ECD\u4FDD\u7559\u5728\u8FD9\u91CC\u3002\u653E\u5F03\u524D\u53EF\u5148\u590D\u5236\u8349\u7A3F\uFF0C\u518D\u91CD\u65B0\u52A0\u8F7D\u6700\u65B0\u7248\u672C\u3002","tab.deleted":"\u6B64\u4EA7\u7269\u5DF2\u4E0D\u5B58\u5728","tab.deletedHint":"\u5B83\u5DF2\u88AB\u79FB\u5230\u56DE\u6536\u7AD9\u6216\u5220\u9664\u3002","tab.close":"\u5173\u95ED\u6807\u7B7E\u9875","history.title":"\u7248\u672C","history.current":"\u5F53\u524D","history.byAgent":"\u667A\u80FD\u4F53","history.byUser":"\u4F60","history.restored":"\u4ECE v{version} \u6062\u590D","history.created":"\u521B\u5EFA","history.updated":"\u7F16\u8F91","history.empty":"\u6CA1\u6709\u66F4\u65E9\u7684\u7248\u672C\u3002","export.html":"HTML \u6587\u4EF6","export.mockupHtml":"\u4EA4\u4E92\u5F0F HTML\uFF08\u53EA\u8BFB\uFF09","export.mockupSvgHtml":"\u9759\u6001 HTML\uFF08SVG\uFF0C\u8F83\u5C0F\uFF09","export.png":"PNG \u56FE\u7247","export.svg":"SVG \u56FE\u7247","export.fig":"OpenPencil \u6587\u6863\uFF08.fig\uFF09","export.md":"Markdown \u6587\u4EF6","export.docx":"Word \u6587\u6863","export.csv":"CSV \u6587\u4EF6","export.xlsx":"Excel \u5DE5\u4F5C\u7C3F","export.downloaded":"\u5DF2\u4E0B\u8F7D {name}\u3002","export.print":"\u6253\u5370\u6216\u53E6\u5B58\u4E3A PDF","export.done":"\u5DF2\u5C06 {name} \u4FDD\u5B58\u5230 {path}","design.title":"\u8BBE\u8BA1\u7CFB\u7EDF","design.hint":"\u9875\u9762\u548C\u6587\u6863\u901A\u8FC7 CSS \u53D8\u91CF\u4F7F\u7528\u8FD9\u4E9B\u503C\u3002","design.source.workspace":"\u672C\u9879\u76EE\u8986\u76D6\u4E86\u8D44\u6599\u5E93\u8BBE\u7F6E\u3002","design.source.library":"\u7EE7\u627F\u81EA\u8D44\u6599\u5E93\u3002","design.source.default":"\u5185\u7F6E\u9ED8\u8BA4\u503C\u3002\u4FDD\u5B58\u540E\u5373\u53EF\u81EA\u5B9A\u4E49\u3002","design.name":"\u540D\u79F0","design.colors":"\u989C\u8272","design.color.primary":"\u4E3B\u8272","design.color.accent":"\u5F3A\u8C03\u8272","design.color.surface":"\u5E95\u8272","design.color.text":"\u6587\u5B57","design.color.muted":"\u6B21\u8981","design.color.background":"\u9875\u9762\u80CC\u666F","design.color.raised":"\u6B21\u7EA7\u80CC\u666F","design.color.border":"\u5206\u9694\u7EBF","design.color.control":"\u63A7\u4EF6\u8FB9\u6846","design.color.action":"\u64CD\u4F5C\u80CC\u666F","design.color.actionText":"\u64CD\u4F5C\u6587\u5B57","design.color.focus":"\u7126\u70B9\u8F6E\u5ED3","design.color.success":"\u6210\u529F","design.color.warning":"\u8B66\u544A","design.color.danger":"\u5371\u9669","design.type":"\u5B57\u4F53","design.font":"\u6B63\u6587\u5B57\u4F53","design.mono":"\u4EE3\u7801\u5B57\u4F53","design.radius":"\u5706\u89D2","design.radius.sm":"\u5C0F","design.radius.md":"\u4E2D","design.radius.lg":"\u5927","design.notes":"\u7ED9\u667A\u80FD\u4F53\u7684\u8BF4\u660E","design.notesHint":"\u667A\u80FD\u4F53\u8BBE\u8BA1\u524D\u4F1A\u8BFB\u53D6\u7684\u8BED\u6C14\u3001\u6392\u7248\u89C4\u5219\u6216\u54C1\u724C\u89C4\u8303\u3002","design.saveWorkspace":"\u4FDD\u5B58\u5230\u672C\u9879\u76EE","design.saveWorkspaceNamed":"\u4FDD\u5B58\u5230 {name}","design.saveLibrary":"\u4FDD\u5B58\u5230\u8D44\u6599\u5E93","design.clear":"\u79FB\u9664\u9879\u76EE\u8986\u76D6","design.saved":"\u8BBE\u8BA1\u7CFB\u7EDF\u5DF2\u4FDD\u5B58","design.preview":"\u9884\u89C8","design.previewHeading":"\u5B63\u5EA6\u56DE\u987E","design.previewBody":"\u672C\u5B63\u5EA6\u5404\u533A\u57DF\u6536\u5165\u5747\u6709\u589E\u957F\u3002","design.previewButton":"\u4E3B\u8981\u64CD\u4F5C","card.created":"\u5DF2\u521B\u5EFA","card.updated":"\u5DF2\u66F4\u65B0","card.working":"\u6B63\u5728\u5199\u5165\u4EA7\u7269...","card.failed":"\u4EA7\u7269\u672A\u4FDD\u5B58","card.missing":"\u6B64\u7ED3\u679C\u6CA1\u6709\u4EA7\u7269\u4FE1\u606F\u3002","composer.label":"\u4EA7\u7269","error.generic":"\u51FA\u9519\u4E86\uFF0C\u8BF7\u91CD\u8BD5\u3002","error.designInvalid":"\u539F\u578B\u6E90\u7801\u65E0\u6548\u3002","error.designIcon":"\u8BE5\u539F\u578B\u65E0\u6CD5\u4F7F\u7528\u6B64\u56FE\u6807\u3002","error.designRender":"\u539F\u578B\u65E0\u6CD5\u6E32\u67D3\u3002","error.designTimeout":"\u539F\u578B\u6E32\u67D3\u8D85\u65F6\u3002","error.designUnavailable":"\u6B64\u8FD0\u884C\u65F6\u65E0\u6CD5\u6E32\u67D3\u539F\u578B\u3002","error.unsupportedType":"\u8BE5\u4EA7\u7269\u4E0D\u652F\u6301\u6B64\u64CD\u4F5C\u3002","error.sheetInvalid":"\u8868\u683C\u6570\u636E\u65E0\u6548\u3002","error.notFound":"\u6B64\u4EA7\u7269\u5DF2\u4E0D\u5B58\u5728\u3002","error.stale":"\u4EA7\u7269\u5DF2\u66F4\u6539\uFF0C\u8BF7\u91CD\u65B0\u52A0\u8F7D\u3002","error.tooLarge":"\u5185\u5BB9\u8D85\u8FC7 2 MiB \u4E0A\u9650\u3002","error.noWorkspace":"\u6B64\u4F1A\u8BDD\u6CA1\u6709\u5DE5\u4F5C\u533A\u3002","error.forbidden":"\u4E0D\u5141\u8BB8\u8BBF\u95EE\u8BE5\u8DEF\u5F84\u3002","error.corrupt":"\u4EA7\u7269\u6587\u4EF6\u5DF2\u635F\u574F\u3002","error.tokens":"\u67D0\u4E2A\u8BBE\u8BA1\u503C\u4E0D\u662F\u6709\u6548\u7684 CSS\u3002","error.library":"\u65E0\u6CD5\u521B\u5EFA\u8D44\u6599\u5E93\u6587\u4EF6\u5939\u3002","error.surface":"\u4EA7\u7269\u9762\u677F\u7ED8\u5236\u5931\u8D25\u3002","error.surfaceHint":"\u8BF7\u91CD\u65B0\u52A0\u8F7D\u7A97\u53E3\u3002\u4F60\u7684\u4EA7\u7269\u4ECD\u5B89\u5168\u4FDD\u5B58\u5728\u78C1\u76D8\u4E0A\u3002","action.retry":"\u91CD\u8BD5","action.reloadWindow":"\u91CD\u65B0\u52A0\u8F7D\u7A97\u53E3","time.justNow":"\u521A\u521A","time.minutes":"{count} \u5206\u949F\u524D","time.hours":"{count} \u5C0F\u65F6\u524D","time.days":"{count} \u5929\u524D"};function aa(e,t,a=Date.now()){let r=Math.max(0,a-Date.parse(t)),n=Math.floor(r/6e4);if(n<1)return e("time.justNow");if(n<60)return e("time.minutes",{count:n});let o=Math.floor(n/60);if(o<24)return e("time.hours",{count:o});let s=Math.floor(o/24);return s<7?e("time.days",{count:s}):new Date(t).toLocaleDateString()}var xe=require("react/jsx-runtime");function Ci(e,t){let a=t.source.origin==="agent"?e("history.byAgent"):e("history.byUser"),r=t.source.action==="restore"&&t.source.restoredFrom!==void 0?e("history.restored",{version:t.source.restoredFrom}):t.source.action==="create"?e("history.created"):e("history.updated");return`${a} \xB7 ${r} \xB7 ${aa(e,t.createdAt)}`}function xn({t:e,versions:t,failed:a,current:r,selected:n,onSelect:o}){return(0,xe.jsxs)("div",{className:"art-history-body",children:[t===null?(0,xe.jsx)("p",{className:"art-note",role:"status",children:(0,xe.jsx)(ra.TextShimmer,{active:!0,children:e("empty.loading")})}):null,a?(0,xe.jsx)("p",{className:"art-note",children:e("error.generic")}):null,!a&&t!==null&&t.length<=1?(0,xe.jsx)("p",{className:"art-note",children:e("history.empty")}):null,t?.map(s=>(0,xe.jsxs)("button",{type:"button",className:"art-version","aria-current":s.version===n?"true":void 0,onClick:()=>o(s.version),children:[(0,xe.jsxs)("span",{className:"art-version-top",children:[(0,xe.jsx)("span",{children:e("tab.versionOf",{version:s.version})}),s.version===r?(0,xe.jsx)(ra.Tag,{tone:"neutral",children:e("history.current")}):null]}),(0,xe.jsx)("span",{className:"art-version-sub",children:Ci(e,s)})]},s.version))]})}var Ie=require("react");var Ve=require("react/jsx-runtime");function na({content:e,designCss:t,title:a,frameTitle:r,dark:n=!1,onSelectionText:o}){let[s,l]=(0,Ie.useState)(null),[c,i]=(0,Ie.useState)(!1),h=(0,Ie.useRef)(0),k=(0,Ie.useRef)(null),b=(0,Ie.useRef)(o);b.current=o;let p=o!==void 0;return(0,Ie.useEffect)(()=>{h.current=0,i(!1);let u=URL.createObjectURL(new Blob([ta(e,t,a,n?"dark":"light",p)],{type:"text/html"}));return l(u),()=>URL.revokeObjectURL(u)},[e,t,a,n,p]),(0,Ie.useEffect)(()=>{if(!p)return;let u=y=>{if(k.current===null||h.current>1||y.source!==k.current.contentWindow)return;let v=vn(y.data);v!==void 0&&b.current?.(v)};return window.addEventListener("message",u),()=>window.removeEventListener("message",u)},[p]),c?(0,Ve.jsx)("div",{className:"art-center",role:"alert",children:a}):s===null?null:(0,Ve.jsx)("iframe",{ref:k,className:"art-frame",title:r,sandbox:hn,referrerPolicy:"no-referrer",src:s,onLoad:()=>{h.current+=1,h.current>1&&i(!0)}},s)}function kn({value:e,readOnly:t,label:a,hint:r,onChange:n,onSave:o,onSelectionText:s}){let l=c=>{t||s?.(c.value.slice(c.selectionStart,c.selectionEnd))};return(0,Ve.jsxs)("div",{className:"art-source-wrap",children:[r===void 0?null:(0,Ve.jsx)("div",{className:"art-code-bar",children:(0,Ve.jsx)("span",{children:r})}),(0,Ve.jsx)("textarea",{className:"art-source","aria-label":a,spellCheck:!1,readOnly:t,value:e,autoFocus:!t,onChange:c=>{n(c.target.value),s?.("")},onSelect:c=>l(c.currentTarget),onMouseUp:c=>l(c.currentTarget),onKeyUp:c=>l(c.currentTarget),onKeyDown:c=>{if((c.ctrlKey||c.metaKey)&&c.key.toLowerCase()==="s"){c.preventDefault(),o();return}if(c.key==="Tab"&&!c.shiftKey&&!t){c.preventDefault();let i=c.currentTarget,h=i.selectionStart,k=i.selectionEnd,b=e.slice(0,h)+" "+e.slice(k);n(b),requestAnimationFrame(()=>i.setSelectionRange(h+2,h+2))}}})]})}var Sn=require("@deepseek-ai/dsh-client-ui-primitives"),ve=require("react");var Xe=require("react/jsx-runtime"),Ct=null;function Ni(){if(Ct===null){let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")return Promise.reject(new Error("The sheet editor loader is unavailable."));Ct=e("./client.sheet.js"),Ct.catch(()=>{Ct=null})}return Ct}function Tn(e){let t=(0,ve.useRef)(null),a=(0,ve.useRef)(null),[r,n]=(0,ve.useState)("loading"),o=(0,ve.useRef)({onChange:e.onChange,onSave:e.onSave,onSelectionText:e.onSelectionText??(()=>{}),t:e.t});o.current.onChange=e.onChange,o.current.onSave=e.onSave,o.current.onSelectionText=e.onSelectionText??(()=>{}),o.current.t=e.t;let s=(0,ve.useMemo)(()=>e.design===void 0?{}:{...Gt(e.design,e.dark===!0),colorScheme:e.dark===!0?"dark":"light"},[e.design,e.dark]);return(0,ve.useEffect)(()=>{let l=!1;return Ni().then(c=>{l||t.current===null||(a.current=c.mountSheetEditor({element:t.current,content:e.content,editable:e.editable,label:e.label,...e.design===void 0?{}:{design:e.design},dark:e.dark===!0,live:o}),n("ready"))}).catch(()=>{l||n("failed")}),()=>{l=!0,a.current?.destroy(),a.current=null}},[]),(0,ve.useEffect)(()=>{if(r!=="ready")return;let l=a.current;l!==null&&l.getJson()!==e.content&&l.setContent(e.content)},[e.revision,e.content,r]),(0,ve.useEffect)(()=>{a.current?.setEditable(e.editable)},[e.editable]),(0,ve.useEffect)(()=>{a.current?.setAppearance(e.design,e.dark===!0)},[e.design,e.dark]),(0,Xe.jsxs)("div",{className:"art-sheet",style:s,children:[r==="loading"?(0,Xe.jsx)("div",{className:"art-state",role:"status",children:(0,Xe.jsx)(Sn.TextShimmer,{active:!0,children:e.loadingLabel})}):null,r==="failed"?(0,Xe.jsx)("div",{className:"art-state",role:"alert",children:e.failedLabel}):null,(0,Xe.jsx)("div",{className:"art-sheet-mount",ref:t})]})}function _a(e,t=2e3){let a=e.replace(/\r\n/g,`
29
50
  `).replace(/[ \t]+\n/g,`
30
51
  `).replace(/\n{3,}/g,`
31
52
 
32
- `).trim();return a.length<=t?{text:a,truncated:!1}:{text:a.slice(0,t).trimEnd(),truncated:!0}}function Fr(e,t){let a=t.workspaceId!==void 0&&t.workspaceId!=="",r=t.version===t.current?a?"agent.referenceProject":"agent.reference":a?"agent.referenceOldProject":"agent.referenceOld",n={title:t.title,id:t.id,version:t.version,current:t.current,...a?{workspaceId:t.workspaceId}:{}};return`${e(r,n)} `}function va(e,t){let r=e("agent.quoteDesign",{name:t.name,path:t.path})+"\n\n```jsx\n"+t.jsx+"\n```";if(r.length<=4e3)return{text:r,truncated:!1};let n=`
53
+ `).trim();return a.length<=t?{text:a,truncated:!1}:{text:a.slice(0,t).trimEnd(),truncated:!0}}function Cn(e,t){let a=t.workspaceId!==void 0&&t.workspaceId!=="",r=t.version===t.current?a?"agent.referenceProject":"agent.reference":a?"agent.referenceOldProject":"agent.referenceOld",n={title:t.title,id:t.id,version:t.version,current:t.current,...a?{workspaceId:t.workspaceId}:{}};return`${e(r,n)} `}function Va(e,t){let r=e("agent.quoteDesign",{name:t.name,path:t.path})+"\n\n```jsx\n"+t.jsx+"\n```";if(r.length<=4e3)return{text:r,truncated:!1};let n=`
33
54
 
34
- `+e("agent.quoteCut",{limit:4e3});return{text:r.slice(0,4e3-n.length).trimEnd()+n,truncated:!0}}function xa(e,t){return e===""?t:`${e.split(`
55
+ `+e("agent.quoteCut",{limit:4e3});return{text:r.slice(0,4e3-n.length).trimEnd()+n,truncated:!0}}function Wa(e,t){return e===""?t:`${e.split(`
35
56
  `).map(a=>`> ${a}`).join(`
36
57
  `)}
37
58
 
38
- ${t}`}var Br=require("react"),Hr="data-ds-dark-theme";function bo(){return typeof document<"u"&&document.body?.hasAttribute(Hr)===!0}function ho(e){if(typeof document>"u"||document.body===null)return()=>{};let t=new MutationObserver(e);return t.observe(document.body,{attributes:!0,attributeFilter:[Hr]}),()=>t.disconnect()}function Qe(){return(0,Br.useSyncExternalStore)(ho,bo,()=>!1)}var i=require("react/jsx-runtime");function He({label:e,icon:t,onClick:a,pressed:r,disabled:n,buttonRef:o}){return(0,i.jsx)(b.Tooltip,{label:e,side:"bottom",portal:!0,children:(0,i.jsx)(b.Button,{ref:o,size:"sm",className:"art-icon-button","aria-label":e,"aria-pressed":r,disabled:n,onClick:a,children:t})})}function vo({quote:e,askLabel:t,dismissLabel:a,onAsk:r,onDismiss:n}){return(0,i.jsxs)("div",{className:"art-selection-bar",role:"toolbar","aria-label":t,children:[(0,i.jsx)("span",{className:"art-selection-quote",title:e,children:e}),(0,i.jsx)(b.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,i.jsx)(b.IconSparkleRegular,{size:14}),onClick:r,children:t}),(0,i.jsx)(He,{label:a,icon:(0,i.jsx)(b.IconCloseOutlineRegular,{size:14}),onClick:n})]})}function xo({t:e,layer:t,askLabel:a,dismissLabel:r,onAsk:n,onDismiss:o}){let l=ma(e,t.type);return(0,i.jsxs)("div",{className:"art-selection-bar art-layer-bar",role:"toolbar","aria-label":a,children:[(0,i.jsx)("span",{className:"art-layer-bar-glyph","aria-hidden":"true",children:Pt(t.type)}),(0,i.jsxs)("span",{className:"art-layer-bar-text",children:[(0,i.jsx)("span",{className:"art-layer-bar-name",title:t.name,children:t.name}),(0,i.jsx)("span",{className:"art-layer-bar-sub",children:t.parentName===""?l:e("layer.parentLine",{type:l,parent:t.parentName})})]}),(0,i.jsx)(b.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,i.jsx)(b.IconSparkleRegular,{size:14}),onClick:n,children:a}),(0,i.jsx)(He,{label:r,icon:(0,i.jsx)(b.IconCloseOutlineRegular,{size:14}),onClick:o})]})}function wo({label:e,closeLabel:t,overlay:a,onClose:r,head:n,children:o}){let l=(0,T.useRef)(null);return(0,T.useEffect)(()=>{l.current?.querySelector("[data-drawer-initial]")?.focus()??l.current?.querySelector(".art-version, button")?.focus()},[e]),(0,T.useEffect)(()=>{if(!a)return;let s=y=>{let c=l.current;c===null||y.target instanceof Node&&c.contains(y.target)||c.querySelector("button")?.focus()};return document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)},[a]),(0,i.jsxs)("div",{className:"art-drawer-layer","data-overlay":a?"true":void 0,children:[a?(0,i.jsx)("div",{className:"art-drawer-scrim","aria-hidden":"true",onPointerDown:r}):null,(0,i.jsxs)("aside",{ref:l,className:"art-drawer",role:"dialog","aria-modal":a?"true":void 0,"aria-label":e,onKeyDown:s=>{if(s.key==="Escape"){s.preventDefault(),s.stopPropagation(),r();return}if(s.key!=="Tab"||!a)return;let y=[...l.current?.querySelectorAll("button:not(:disabled)")??[]],c=y[0],h=y[y.length-1];c===void 0||h===void 0||(s.shiftKey&&document.activeElement===c?(s.preventDefault(),h.focus()):!s.shiftKey&&document.activeElement===h&&(s.preventDefault(),c.focus()))},children:[(0,i.jsxs)("div",{className:"art-drawer-head",children:[n??(0,i.jsx)("h2",{children:e}),(0,i.jsx)(He,{label:t,icon:(0,i.jsx)(b.IconCloseOutlineRegular,{size:14}),onClick:r})]}),(0,i.jsx)("div",{className:"art-drawer-body",children:o})]})]})}function wa(e){let t=e.useTabInfo(),a=we(t.tab.contentId??t.tab.navigation?.address),r=e.useWorkspaces(n=>n.items.find(o=>a?.scope==="workspace"&&o.workspaceId===a.workspaceId)?.title);return a===void 0?(0,i.jsx)("section",{className:"art-root",children:(0,i.jsx)("p",{className:"art-note",children:e.t("error.notFound")})}):(0,i.jsx)(Vr,{t:e.t,address:a,useTabInfo:e.useTabInfo,onBack:t.tab.actions?.close,workspaceName:r,inputActions:e.inputActions},K(a))}function ka({t:e,address:t,onBack:a,workspaceName:r,inputActions:n}){return(0,i.jsx)(Vr,{t:e,address:t,onBack:a,workspaceName:r,back:!0,inputActions:n},K(t))}var ko=()=>{};function Vr({t:e,address:t,useTabInfo:a,onBack:r,workspaceName:n,back:o,inputActions:l}){let{model:s,state:y}=sr(t),{payload:c,draft:h,saving:v,conflict:x,failure:d,failureMessage:p}=y,u=s.where,m=t.id,L=Qe(),[S,V]=(0,T.useState)("view"),[D,H]=(0,T.useState)(!1),[C,F]=(0,T.useState)(!1),[_,P]=(0,T.useState)(!1),[A,$]=(0,T.useState)("layers"),[O,Le]=(0,T.useState)(null),[E,q]=(0,T.useState)(null),[N,Q]=(0,T.useState)([]),[_e,Ue]=(0,T.useState)(null),[Kt,yt]=(0,T.useState)(0),[Je,un]=(0,T.useState)(!1),[za,Yt]=(0,T.useState)(null),[fn,Pa]=(0,T.useState)(!1),[et,Me]=(0,T.useState)(!1),[ne,We]=(0,T.useState)(null),[he,ie]=(0,T.useState)(null),[gn,bt]=(0,T.useState)(!1),[Qt,La]=(0,T.useState)(""),[Xt,tt]=(0,T.useState)(null),[mn,ht]=(0,T.useState)(!1),[fe,Re]=(0,T.useState)(!1),[Ge,ve]=(0,T.useState)(null),[Ma,Zt]=(0,T.useState)(null),[Oa,at]=(0,T.useState)(null),xe=(0,T.useRef)(0),vt=(0,T.useRef)(null),ja=(0,T.useRef)(null),Fa=(0,T.useRef)(null),Jt=(0,T.useRef)(!1),xt=nr(m),Ba=(a??ko)();(0,T.useEffect)(()=>{c!==null&&xt>c.version&&h===null&&!v&&!x&&at(xt),s.externalVersion(xt)},[xt,s,v,c?.version,h,x]),(0,T.useEffect)(()=>{x&&at(null)},[x]),(0,T.useEffect)(()=>{ve(null),Q([])},[c?.version,ne?.version,y.revision]),(0,T.useEffect)(()=>{if(O===null){q(null);return}return q(O.getSnapshot()),O.subscribe(q)},[O]);let Ha=ne!==null;(0,T.useEffect)(()=>{Ha&&S==="edit"&&(V("view"),P(!1))},[Ha,S]);let yn=c!==null,$e=(0,T.useCallback)(()=>{let f=vt.current,R=f===null?0:f.clientWidth;un(R>0?R<=600:window.innerWidth<=600)},[]);(0,T.useEffect)(()=>{let f=vt.current;if(f===null)return;$e();let R=new ResizeObserver($e);return R.observe(f),window.addEventListener("resize",$e),()=>{R.disconnect(),window.removeEventListener("resize",$e)}},[yn,$e]);let Oe=(0,T.useCallback)(f=>{s.getSnapshot().draft!==null||s.getSnapshot().saving?tt({run:f}):f()},[s]),ea=(0,T.useCallback)(()=>{++xe.current,Me(!1),We(null),ve(null),ie(null),at(null)},[]),wt=(0,T.useCallback)(async()=>{ea(),await s.discardAndReload()},[s,ea]);(0,T.useEffect)(()=>Ba?.tab.actions?.bindCommands({refresh:()=>Oe(wt)}),[Ba?.tab.actions,Oe,wt]),(0,T.useEffect)(()=>{if(c?.manifest.type!=="doc"||h===null||x||v)return;let f=setTimeout(()=>void s.save(),1200);return()=>clearTimeout(f)},[h,x,v,s,c?.manifest.type]),(0,T.useEffect)(()=>{if(!C||c===null)return;let f=new AbortController;return Yt(null),Pa(!1),U.history(u,m,f.signal).then(R=>{f.signal.aborted||Yt(R.versions)}).catch(()=>{f.signal.aborted||Pa(!0)}),()=>f.abort()},[C,c?.version,s]),(0,T.useEffect)(()=>()=>{++xe.current},[]),(0,T.useEffect)(()=>{if(C){Jt.current=!0;return}Jt.current&&(Jt.current=!1,Fa.current?.focus())},[C]),(0,T.useEffect)(()=>{if(S!=="source"||c?.manifest.type!=="page")return;let f=()=>{let R=ja.current,ae=window.getSelection();if(R===null||ae===null||ae.anchorNode===null||!R.contains(ae.anchorNode))return;let ot=ha(ae.toString());ve(ot.text===""?null:ot)};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[S,c?.manifest.type]);let bn=(0,T.useCallback)(f=>Le(f),[]),hn=(0,T.useCallback)(f=>Q(f),[]),vn=(0,T.useCallback)(f=>Ue(f),[]),xn=()=>P(!1),Va=()=>{++xe.current,Me(!1),We(null),F(!1)},ta=()=>{$e(),++xe.current,Me(!1),We(null),ie(null),P(!1),F(!0)},_a=async f=>{let R=++xe.current;if(ie(null),ve(null),f===c?.version){Me(!1),We(null);return}Me(!0);try{let ae=await U.get(u,m,f);R===xe.current&&We(ae)}catch(ae){R===xe.current&&Z(e(te(ee(ae))))}finally{R===xe.current&&Me(!1)}},Ua=async()=>et?null:ne!==null?ne.version:await s.save()?s.getSnapshot().payload?.version??null:null,Wa=async f=>{if(!fe){Re(!0);try{let R=await Ua();if(R===null)return;if(f==="print")Pr((await U.printable(u,m,R)).html);else{let ae=await U.exportFile(u,m,f,R);tr(ae),Z(e("export.done",{name:ae.fileName,path:ae.path}))}}catch(R){Z(e(te(ee(R))))}finally{Re(!1)}}},wn=async()=>{Qt.trim()===""||v||await s.save(Qt.trim())&&bt(!1)},kn=async()=>{if(ne===null||fe)return;let f=ne.version;Oe(async()=>{Re(!0);try{let R=await U.restore(u,m,f,s.getSnapshot().payload?.version??0);Fe(m,R.manifest.version),Te(),ea(),await s.load()}catch(R){Z(e(te(ee(R))))}finally{Re(!1)}})},aa=async(f,R)=>{try{await navigator.clipboard.writeText(f),Z(e(R))}catch{Zt(f)}},rt=async(f,R="agent.addedTruncated")=>{if(!(fe||x||et||c===null)){Re(!0);try{let ae=await Ua();if(ae===null)return;let ot=s.getSnapshot().payload??c,oa=Fr(e,{title:ot.manifest.title,id:m,version:ae,current:ot.version,...t.scope==="workspace"?{workspaceId:t.workspaceId}:{}}),kt=f?.text??"";if(ve(null),Q([]),O?.clearSelection(),l===void 0){await aa(xa(kt,oa),"agent.copied");return}if((kt===""||l.insertQuote(kt))&&l.insertText(oa,l.captureInsertion())){Z(e(f?.truncated===!0?R:"agent.added"));return}await aa(xa(kt,oa),"agent.insertFailed")}finally{Re(!1)}}},ra=(0,T.useCallback)(f=>{let R=ha(f);ve(R.text===""?null:R)},[]),Tn=async()=>{if(he==="version"){ie(null);return}if(c!==null){try{let f=await U.history(u,m);Yt(f.versions)}catch(f){Z(e(te(ee(f))));return}ie("version")}};if(c===null)return(0,i.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",ref:vt,children:(0,i.jsxs)("div",{className:"art-center",role:d===void 0?"status":"alert",children:[(0,i.jsx)("p",{className:"art-center-hint",children:e(d===void 0?"empty.loading":te(d))}),(0,i.jsxs)("div",{className:"art-center-actions",children:[d===void 0?null:(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>void s.load(),children:e("action.retry")}),r===void 0?null:(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:r,children:e("tab.close")})]})]})});let X=c.manifest.type,nt=ne?.content??h??c.content,de=ne!==null,na=ne?.version??c.version,Sn=e(v?"tab.saving":x?"tab.conflictTitle":et?"empty.loading":ne!==null?"tab.readOnly":d!==void 0?"tab.saveFailed":h!==null?"tab.unsaved":"tab.saved"),Nn=x||d!==void 0&&!v?"error":v?"warn":void 0,Cn=t.scope==="workspace"?n??t.workspaceId:e("scope.library"),In=S==="source"&&!de&&(D||h!==null),Ga=[...Ka[X].map(f=>({id:f,label:e(`export.${f}`)})),...X==="design"?[]:[{type:"separator",id:"export-gap"},{id:"print",label:e("export.print")}]],$a=f=>{ie(null),Wa(f==="print"?"print":f)},An=[...Je?[...Ga,{type:"separator",id:"more-gap"}]:[],{id:"rename",label:e("tab.rename")},{id:"reload",label:e("tab.reload")},{type:"separator",id:"danger-gap"},{id:"delete",label:e("tab.delete"),danger:!0}],En=f=>{ie(null),f==="rename"?(La(c.manifest.title),bt(!0)):f==="reload"?Oe(wt):f==="delete"?ht(!0):$a(f)},Rn=[...(za??[]).map(f=>({id:"v"+f.version,label:e("tab.versionOf",{version:f.version})+(f.version===c.version?" \xB7 "+e("tab.currentVersion"):"")})),{type:"separator",id:"versions-gap"},{id:"all",label:e("tab.allVersions")}],Dn=f=>{ie(null),f==="all"?ta():_a(Number(f.slice(1)))},zn=(0,i.jsx)(b.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,i.jsx)(b.IconSparkleRegular,{size:14}),disabled:fe||x||et,onClick:()=>{if(X==="design"){let f=O?.quoteSelection();if(f!=null){rt(va(e,f),"agent.addedTruncatedDesign");return}}rt(Ge)},children:e("agent.ask")});return(0,i.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"","data-artifact-id":m,"aria-busy":fe,ref:vt,children:[(0,i.jsxs)("header",{className:"art-header art-editor-header",children:[(0,i.jsxs)("div",{className:"art-heading",children:[!o||r===void 0?null:(0,i.jsx)(He,{label:e("action.back"),icon:(0,i.jsx)(b.IconChevronLeftOutlineRegular,{size:16}),onClick:()=>Oe(r)}),(0,i.jsxs)("div",{className:"art-identity",children:[(0,i.jsx)("h1",{className:"art-title",title:c.manifest.title,children:c.manifest.title}),(0,i.jsxs)("div",{className:"art-meta",children:[(0,i.jsxs)("span",{className:"art-meta-text",children:[Cn,t.scope==="workspace"?" \xB7 "+e("scope.workspace"):null]}),(0,i.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,i.jsx)(b.Menu,{open:he==="version",onClose:()=>ie(null),items:Rn,onSelect:Dn,portal:!0,autoFocus:!0,anchor:(0,i.jsxs)("button",{type:"button",className:"art-version-button","aria-label":e("tab.versionPicker"),"aria-haspopup":"menu","aria-expanded":he==="version",onClick:()=>void Tn(),children:[e("gallery.version",{version:na}),(0,i.jsx)(b.IconChevronDownOutlineRegular,{size:12})]})}),(0,i.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,i.jsx)("span",{className:"art-save-status","data-tone":Nn,"aria-live":"polite",children:Sn})]})]})]}),(0,i.jsxs)("div",{className:"art-actions art-editor-actions",children:[X==="doc"?null:(0,i.jsx)(b.SegmentedControl,{id:"art-mode-"+m,className:"art-segment",label:e("tab.mode"),value:S,options:X==="design"?[{value:"view",label:e("canvas.viewMode")},{value:"edit",label:e("canvas.editMode"),disabled:de,title:de?e("canvas.editOldVersion"):void 0},{value:"source",label:e("tab.source")}]:[{value:"view",label:e("tab.preview")},{value:"source",label:e("tab.source")}],onChange:f=>{V(f),ve(null),P(X==="design"&&f==="edit"&&!de)}}),X==="design"&&S==="edit"&&!de?(0,i.jsx)(He,{label:e("canvas.inspector"),icon:(0,i.jsx)(b.IconSlidersTwoOutlineRegular,{size:16}),pressed:_,onClick:()=>{_?P(!1):(F(!1),P(!0))}}):null,h===null||de?null:(0,i.jsx)(He,{label:e("tab.save"),icon:(0,i.jsx)(b.IconSaveOutlineRegular,{size:16}),disabled:x,onClick:()=>void s.save()}),(0,i.jsx)(He,{buttonRef:Fa,label:e("tab.history"),icon:(0,i.jsx)(b.IconClockOutlineRegular,{size:16}),pressed:C,onClick:()=>{C?Va():ta()}}),Je?null:(0,i.jsx)(b.Menu,{open:he==="export",onClose:()=>ie(null),items:Ga,onSelect:$a,align:"end",portal:!0,autoFocus:!0,anchor:(0,i.jsx)(b.Button,{size:"sm",icon:(0,i.jsx)(b.IconDownloadOutlineRegular,{size:14}),"aria-label":e("tab.export"),"aria-haspopup":"menu","aria-expanded":he==="export",disabled:fe||et,onClick:()=>ie(he==="export"?null:"export"),children:e("tab.export")})}),zn,(0,i.jsx)(b.Menu,{open:he==="more",onClose:()=>ie(null),items:An,onSelect:En,align:"end",portal:!0,autoFocus:!0,anchor:(0,i.jsx)(b.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.more"),"aria-haspopup":"menu","aria-expanded":he==="more",onClick:()=>ie(he==="more"?null:"more"),children:(0,i.jsx)(b.IconEllipsisOutlineRegular,{size:14})})})]})]}),gn?(0,i.jsxs)("form",{className:"art-inline-form",onSubmit:f=>{f.preventDefault(),wn()},children:[(0,i.jsx)("input",{"aria-label":e("tab.rename"),value:Qt,maxLength:120,autoFocus:!0,onChange:f=>La(f.target.value),onKeyDown:f=>{f.key==="Escape"&&bt(!1)}}),(0,i.jsx)(b.Button,{type:"submit",size:"sm",variant:"primary",disabled:v||x,children:e("tab.save")}),(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>bt(!1),children:e("create.cancel")})]}):null,Oa===null?null:(0,i.jsxs)("div",{className:"art-bar",role:"status",children:[(0,i.jsx)("span",{children:e("tab.agentUpdate",{version:Oa})}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>{at(null),ta()},children:e("tab.viewHistory")}),(0,i.jsx)(b.Button,{size:"sm",onClick:()=>at(null),children:e("tab.dismiss")})]})]}),x?(0,i.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"alert",children:[(0,i.jsxs)("span",{className:"art-bar-text",children:[(0,i.jsx)("strong",{children:e("tab.conflictTitle")}),(0,i.jsx)("span",{children:e("tab.conflictHint")})]}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>void aa(h??"","action.copied"),children:e("tab.copyDraft")}),(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>Oe(wt),children:e("tab.discardReload")})]})]}):null,!x&&d!==void 0?(0,i.jsxs)("div",{className:"art-bar","data-tone":"error",role:"alert",children:[(0,i.jsx)("span",{children:p??e(te(d))}),(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>void s.save(),children:e("action.retry")})]}):null,ne===null?null:(0,i.jsxs)("div",{className:"art-bar",role:"status",children:[(0,i.jsx)("span",{children:e("tab.viewingOld",{version:ne.version,current:c.version})}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>{++xe.current,Me(!1),We(null),ve(null)},children:e("tab.backToCurrent")}),(0,i.jsx)(b.Button,{size:"sm",variant:"outline",disabled:fe,onClick:()=>void kn(),children:e("tab.restoreThis")})]})]}),X!=="design"||_e===null?null:(0,i.jsxs)("div",{className:"art-bar","data-tone":"error",role:"alert",children:[(0,i.jsx)("span",{children:e("canvas.startFailed")}),(0,i.jsx)("span",{className:"art-bar-actions",children:(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>{Ue(null),yt(f=>f+1)},children:e("action.retry")})})]}),(0,i.jsxs)("div",{className:"art-body",children:[(0,i.jsxs)("div",{className:"art-stage",role:X==="doc"?void 0:"tabpanel",id:X==="doc"?void 0:"art-mode-"+m+"-"+S+"-panel","aria-labelledby":X==="doc"?void 0:"art-mode-"+m+"-"+S,children:[X==="page"&&Ge!==null&&!C?(0,i.jsx)(vo,{quote:Ge.text,askLabel:e("agent.ask"),dismissLabel:e("tab.dismiss"),onAsk:()=>void rt(Ge),onDismiss:()=>ve(null)}):null,X==="design"&&S!=="source"&&!de&&N[0]!==void 0?(0,i.jsx)(xo,{t:e,layer:N[0],askLabel:e("agent.ask"),dismissLabel:e("tab.dismiss"),onAsk:()=>{let f=O?.quoteSelection();f!=null&&rt(va(e,f),"agent.addedTruncatedDesign")},onDismiss:()=>O?.clearSelection()}):null,X==="doc"?(0,i.jsx)(Lt,{markdown:nt,revision:(ne?.version??0)+":"+y.revision,editable:!de&&!x,label:c.manifest.title,loadingLabel:e("empty.loading"),failedLabel:e("error.generic"),design:c.design,dark:L,t:e,onChange:f=>s.edit(f),onSave:()=>void s.save(),onSelectionText:ra,selectionAction:Ge===null?null:(0,i.jsx)(b.Button,{size:"sm",variant:"primary",icon:(0,i.jsx)(b.IconSparkleRegular,{size:14}),onMouseDown:f=>f.preventDefault(),onClick:()=>void rt(Ge),children:e("agent.ask")})}):S!=="source"?X==="design"?de?(0,i.jsx)(ya,{t:e,where:u,id:m,version:na,title:c.manifest.title}):(0,i.jsx)(Tr,{t:e,source:nt,revision:"0:"+y.revision,title:c.manifest.title,mode:S==="edit"?"edit":"view",onChange:f=>s.edit(f),onSave:()=>void s.save(),onFailure:vn,onHandle:bn,onSelection:hn,attempt:Kt,fallback:(0,i.jsx)(ya,{t:e,where:u,id:m,version:na,title:c.manifest.title})}):(0,i.jsx)(jt,{content:nt,designCss:c.designCss,title:c.manifest.title,frameTitle:e("tab.frameTitle",{title:c.manifest.title}),dark:L,onSelectionText:ra}):In?(0,i.jsx)(jr,{value:nt,readOnly:!1,label:e("tab.source"),hint:e(X==="design"?"tab.manualSaveDesign":"tab.manualSave"),onChange:f=>s.edit(f),onSave:()=>void s.save(),onSelectionText:ra}):(0,i.jsxs)("div",{className:"art-code",ref:ja,children:[(0,i.jsxs)("div",{className:"art-code-bar",children:[(0,i.jsx)("span",{children:e(de?"tab.readOnly":"tab.codeHint")}),de?null:(0,i.jsx)(b.Button,{size:"sm",variant:"outline",icon:(0,i.jsx)(b.IconEditOutlineRegular,{size:14}),onClick:()=>H(!0),children:e("tab.editSource")})]}),(0,i.jsx)(b.CodeBlock,{code:nt,lang:X==="design"?"jsx":"html",lineNumbers:!0,showHeader:!1,wrap:!0,className:"art-code-block",copyLabel:e("code.copy"),copiedLabel:e("action.copied")})]})]}),!C&&!_?null:(0,i.jsx)(wo,{label:e(C?"history.title":"canvas.inspector"),closeLabel:e(C?"history.close":"canvas.closeInspector"),overlay:Je,onClose:C?Va:xn,head:C?void 0:(0,i.jsx)(b.SegmentedTabs,{className:"art-inspector-tabs",items:[{value:"layers",label:e("panel.layers"),id:"art-inspector-"+m+"-layers-tab",panelId:"art-inspector-"+m+"-layers"},{value:"properties",label:e("panel.properties"),id:"art-inspector-"+m+"-properties-tab",panelId:"art-inspector-"+m+"-properties"}],value:A,onChange:$,label:e("canvas.inspectorTabs"),size:"sm"}),children:C?(0,i.jsx)(Or,{t:e,versions:za,failed:fn,current:c.version,selected:ne?.version??c.version,onSelect:f=>void _a(f)}):(0,i.jsx)("div",{className:"art-inspector",role:"tabpanel",id:"art-inspector-"+m+"-"+A,"aria-labelledby":"art-inspector-"+m+"-"+A+"-tab",children:(0,i.jsx)(Sr,{t:e,handle:O,snapshot:E,tab:A})})})]}),(0,i.jsx)(b.Modal,{open:Xt!==null,onClose:()=>tt(null),title:e("tab.leaveTitle"),closeLabel:e("dialog.close"),description:e(x?"tab.conflictHint":"tab.leaveHint"),footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(b.Button,{variant:"outline",disabled:fe,onClick:()=>tt(null),children:e("create.cancel")}),(0,i.jsx)(b.Button,{variant:"outline",disabled:v||fe,onClick:()=>{let f=Xt?.run;tt(null),f!==void 0&&s.discardAndReload().then(f)},children:e("tab.leaveDiscard")}),(0,i.jsx)(b.Button,{variant:"primary",disabled:x||fe,onClick:async()=>{Re(!0);let f=await s.save();Re(!1);let R=Xt?.run;f&&R!==void 0&&(tt(null),await R())},children:e("tab.leaveSave")})]}),children:d===void 0?null:(0,i.jsx)("p",{className:"art-modal-error",role:"alert",children:p??e(te(d))})}),(0,i.jsx)(b.Modal,{open:mn,onClose:()=>ht(!1),title:e("tab.deleteTitle"),closeLabel:e("dialog.close"),description:e("tab.deleteConfirm",{title:c.manifest.title}),footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(b.Button,{variant:"outline",onClick:()=>ht(!1),children:e("create.cancel")}),(0,i.jsx)(b.Button,{variant:"primary",onClick:()=>{ht(!1),Oe(async()=>{try{await U.remove(u,m),Te(),r?.()}catch(f){Z(e(te(ee(f))))}})},children:e("tab.delete")})]})}),(0,i.jsx)(b.Modal,{open:Ma!==null,onClose:()=>Zt(null),title:e("agent.copyTitle"),closeLabel:e("dialog.close"),description:e("action.copyFailed"),footer:(0,i.jsx)(b.Button,{variant:"primary",onClick:()=>Zt(null),children:e("dialog.done")}),children:(0,i.jsx)("textarea",{className:"art-fallback",readOnly:!0,value:Ma??"","aria-label":e("agent.copyTitle"),onFocus:f=>f.currentTarget.select()})})]})}var _r=Bn(require("react"),1),Ur=require("@deepseek-ai/dsh-client-ui-primitives"),Ve=require("react/jsx-runtime"),Ft=class extends _r.default.Component{constructor(t){super(t),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,Ve.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",children:(0,Ve.jsxs)("div",{className:"art-center",role:"alert",children:[(0,Ve.jsx)("p",{className:"art-center-title",children:this.props.title}),(0,Ve.jsx)("p",{className:"art-center-hint",children:this.props.hint}),(0,Ve.jsx)(Ur.Button,{size:"sm",variant:"outline",onClick:()=>window.location.reload(),children:this.props.reloadLabel})]})}):this.props.children}};var Bt=require("react"),Xe=require("@deepseek-ai/dsh-client-ui-primitives");var Ce={sidebarRight:null,layout:null};var M=require("react/jsx-runtime");function To(e){if(e===null||typeof e!="object")return null;let t={...e},{id:a,type:r,title:n,version:o,workspaceId:l}=t;if(t.kind!=="artifact"||typeof a!="string"||typeof n!="string"||typeof o!="number"||r!=="page"&&r!=="doc"&&r!=="design")return null;let s=Ya(a);return s===void 0?null:s==="workspace"?typeof l!="string"||l===""?null:{id:a,type:r,title:n,version:o,address:{scope:s,workspaceId:l,id:a}}:{id:a,type:r,title:n,version:o,address:{scope:s,id:a}}}function So(e){return Array.isArray(e)?e.map(t=>{if(t===null||typeof t!="object")return"";let a={...t};return a.type==="text"&&typeof a.text=="string"?a.text:""}).filter(t=>t!=="").join(`
39
- `).trim():""}function No(e){if(e===null||typeof e!="object")return;let t={...e};return typeof t.title=="string"&&t.title.trim()!==""?t.title.trim():void 0}var Wr=new Set;function Ta({t:e,phase:t,toolName:a,block:r}){let n=t==="result"&&r?.isError!==!0?To(r?.meta):null,o=(0,Bt.useRef)(t!=="result");t!=="result"&&(o.current=!0);let l=a==="artifact_update";if((0,Bt.useEffect)(()=>{if(n===null)return;ke(n.id,n.title),Fe(n.id,n.version),Te();let y=n.id+":"+n.version;!o.current||Wr.has(y)||(Wr.add(y),Ce.sidebarRight?.openResource(K(n.address)))},[n?.id,n?.version,n?.title]),t!=="result"){let y=No(r?.args),c=y===void 0?e(l?"card.updatingUntitled":"card.working"):e(l?"card.updating":"card.creating",{title:y});return(0,M.jsxs)("div",{className:"art-card","data-artifact-card":"working",children:[(0,M.jsx)("span",{className:"art-card-icon",children:(0,M.jsx)(ge,{})}),(0,M.jsx)("span",{className:"art-card-text",children:(0,M.jsx)(Xe.TextShimmer,{active:!0,className:"art-card-title",children:(0,M.jsx)("span",{role:"status",children:c})})}),(0,M.jsx)(Xe.StateDot,{state:"ongoing"})]})}if(r?.isError===!0)return(0,M.jsxs)("div",{className:"art-card","data-artifact-card":"error",children:[(0,M.jsx)("span",{className:"art-card-icon","data-tone":"error",children:(0,M.jsx)(ge,{})}),(0,M.jsxs)("span",{className:"art-card-text",children:[(0,M.jsx)("span",{className:"art-card-title",children:e("card.failed")}),(0,M.jsx)("span",{className:"art-card-sub","data-tone":"error",children:So(r.content)})]})]});if(n===null)return(0,M.jsxs)("div",{className:"art-card","data-artifact-card":"missing",children:[(0,M.jsx)("span",{className:"art-card-icon",children:(0,M.jsx)(ge,{})}),(0,M.jsx)("span",{className:"art-card-sub",children:e("card.missing")})]});let s=K(n.address);return(0,M.jsxs)("button",{type:"button",className:"art-card art-card-open","data-artifact-card":"ready","data-artifact-id":n.id,"aria-label":e("card.openNamed",{title:n.title}),onClick:()=>Ce.sidebarRight?.openResource(s),children:[(0,M.jsx)("span",{className:"art-card-icon",children:n.type==="page"?(0,M.jsx)(ge,{}):n.type==="doc"?(0,M.jsx)(Ne,{}):(0,M.jsx)(Be,{})}),(0,M.jsxs)("span",{className:"art-card-text",children:[(0,M.jsx)("span",{className:"art-card-title",title:n.title,children:n.title}),(0,M.jsxs)("span",{className:"art-card-sub",children:[e(l?"card.updated":"card.created")," \xB7 ",e(`type.${n.type}`)," \xB7 ",e("gallery.version",{version:n.version}),n.address.scope==="library"?" \xB7 "+e("scope.library"):""]})]}),(0,M.jsx)("span",{className:"art-card-go","aria-hidden":"true",children:(0,M.jsx)(Xe.IconChevronRightOutlineRegular,{size:14})})]})}var ft=require("react"),_t=require("@deepseek-ai/dsh-client-ui-primitives");var Gr=require("react");function Ht({sessionId:e,useSessions:t,useWorkspaces:a}){let r=a(o=>o.items),n=t(o=>o.byId[e]);return(0,Gr.useMemo)(()=>{let o=typeof n?.cwd=="string"?n.cwd:null,l=r.find(s=>s.sessionIds?.includes(e))??r.find(s=>o!==null&&(o===s.path||o.startsWith(`${s.path}/`)))??null;return{root:o??l?.path??null,workspaceId:l?.workspaceId??null}},[r,n,e])}var ut="dsh-artifact-studio/artifact",Sa="artifact",Ze="dsh-artifact-studio-panel",Vt="dsh-artifact-studio/artifacts",Na="artifacts";var Pe=require("react/jsx-runtime"),Co=6,Ca=["dashboard","explainer","report","brief"];function Io(e,t){let a=e.filter(n=>n.source.sessionId===t),r=e.filter(n=>n.source.sessionId!==t);return[...a,...r].slice(0,Co)}function $r(e){let{t,sessionId:a,inputActions:r}=e,o=Ht(e).workspaceId,l=Dt(),[s,y]=(0,ft.useState)(!1),[c,h]=(0,ft.useState)(null);(0,ft.useEffect)(()=>{if(!s||o===null)return;let p=new AbortController;return U.list({scope:"workspace",workspaceId:o},{},p.signal).then(u=>{p.signal.aborted||h(Io(u.items,a))}).catch(()=>{p.signal.aborted||h([])}),()=>p.abort()},[s,o,a,l]);let v=o===null?[{type:"label",id:"no-workspace",text:t("empty.noWorkspace")}]:c===null?[{type:"label",id:"loading",text:t("empty.loading")}]:c.length===0?[{type:"label",id:"empty",text:t("composer.empty")}]:c.map(p=>({id:"open:"+p.id,label:p.title,icon:p.type==="page"?(0,Pe.jsx)(ge,{size:14}):p.type==="doc"?(0,Pe.jsx)(Ne,{size:14}):(0,Pe.jsx)(Be,{size:14})})),x=[{type:"label",id:"recent",text:t("composer.recent")},...v,...r===void 0?[]:[{type:"separator",id:"start-gap"},{type:"label",id:"start",text:t("composer.start")},...Ca.map(p=>({id:"prompt:"+p,label:t(`prompt.${p}`)}))],{type:"separator",id:"all-gap"},{id:"all",label:t("composer.all")}];return(0,Pe.jsx)(_t.Menu,{open:s,onClose:()=>y(!1),items:x,onSelect:p=>{if(y(!1),p==="all"){Ce.layout?.selectPanel(Ze);return}if(p.startsWith("prompt:")&&r!==void 0){r.insertText(t(`prompt.${p.slice(7)}Text`),r.captureInsertion());return}let u=c?.find(m=>"open:"+m.id===p);u===void 0||o===null||(ke(u.id,u.title),Ce.sidebarRight?.openResource(K({scope:"workspace",workspaceId:o,id:u.id})))},side:"top",portal:!0,autoFocus:!0,anchor:(0,Pe.jsx)(_t.Tooltip,{label:t("composer.label"),side:"top",portal:!0,children:(0,Pe.jsx)("button",{type:"button",className:"art-composer","aria-label":t("composer.label"),"aria-haspopup":"menu","aria-expanded":s,onClick:()=>y(p=>!p),children:(0,Pe.jsx)(ct,{})})})})}var G=require("react");var j=require("react"),z=require("@deepseek-ai/dsh-client-ui-primitives");var Ie=require("react"),Ut=require("@deepseek-ai/dsh-client-ui-primitives");var I=require("react/jsx-runtime"),Ao=["sm","md","lg"],Eo=e=>`<!doctype html><html><head><meta name="color-scheme" content="light dark"><style>
59
+ ${t}`}var Re=require("react"),We=require("@deepseek-ai/dsh-client-ui-primitives");var te=require("react/jsx-runtime");function Nn({t:e,where:t,onClose:a,onApply:r}){let[n,o]=(0,Re.useState)(null),[s,l]=(0,Re.useState)(""),[c,i]=(0,Re.useState)(null),[h,k]=(0,Re.useState)(!1),[b,p]=(0,Re.useState)(null),[u,y]=(0,Re.useState)(0),v=n?.find(C=>C.scope+":"+C.id===s),D=v?{systemId:v.id,systemScope:v.scope,revision:v.revision}:{};(0,Re.useEffect)(()=>{let C=new AbortController,E=t.scope==="library"?[t]:[t,{scope:"library",workspaceId:null}];return Promise.all(E.map(F=>B.designSystems(F,C.signal))).then(F=>{C.signal.aborted||o(F.flatMap(z=>z.systems))}).catch(F=>{C.signal.aborted||p(e(X(Y(F))))}),()=>C.abort()},[t.scope,t.workspaceId,u]),(0,Re.useEffect)(()=>{let C=new AbortController;return i(null),p(null),B.selectedDesign(t,D,C.signal).then(E=>{C.signal.aborted||i(E)}).catch(E=>{C.signal.aborted||p(e(X(Y(E))))}),()=>C.abort()},[s,n,u]);let S=async()=>{if(!(!c||n===null||h)){k(!0),p(null);try{let C=c.system;await r(C?{systemId:C.id,systemScope:C.scope,revision:C.revision}:D),a()}catch(C){p(e(X(Y(C))))}finally{k(!1)}}};return(0,te.jsxs)(We.Modal,{open:!0,onClose:()=>{h||a()},title:e("generation.confirm"),closeLabel:e("dialog.close"),footer:(0,te.jsxs)(te.Fragment,{children:[(0,te.jsx)(We.Button,{variant:"outline",disabled:h,onClick:a,children:e("create.cancel")}),(0,te.jsx)(We.Button,{variant:"primary",disabled:h||c===null||n===null||b!==null,onClick:()=>void S(),children:e("generation.apply")})]}),children:[(0,te.jsx)("p",{className:"art-note",children:e("generation.explain")}),(0,te.jsxs)("label",{className:"art-field",children:[e("design.system"),(0,te.jsxs)("select",{className:"art-select",disabled:h||n===null,value:s,onChange:C=>l(C.target.value),children:[(0,te.jsx)("option",{value:"",children:e("design.defaultChoice")}),n?.map(C=>(0,te.jsxs)("option",{value:C.scope+":"+C.id,children:[C.scope==="workspace"?e("scope.workspace"):e("scope.library"),": ",e("design.revision",{name:C.name,revision:C.revision})]},C.scope+C.id))]})]}),c?(0,te.jsx)("p",{className:"art-note",children:c.system?e("design.revision",{name:c.system.name,revision:c.system.revision}):c.tokens.name}):(0,te.jsx)("p",{className:"art-note",role:"status",children:(0,te.jsx)(We.TextShimmer,{active:!0,children:e("empty.loading")})}),b?(0,te.jsxs)("div",{role:"alert",children:[(0,te.jsx)("p",{className:"art-modal-error",children:b}),(0,te.jsx)(We.Button,{variant:"outline",size:"sm",disabled:h,onClick:()=>y(C=>C+1),children:e("action.retry")})]}):null]})}var zn=require("react"),In="data-ds-dark-theme";function zi(){return typeof document<"u"&&document.body?.hasAttribute(In)===!0}function Ii(e){if(typeof document>"u"||document.body===null)return()=>{};let t=new MutationObserver(e);return t.observe(document.body,{attributes:!0,attributeFilter:[In]}),()=>t.disconnect()}function lt(){return(0,zn.useSyncExternalStore)(Ii,zi,()=>!1)}var d=require("react/jsx-runtime");function Qe({label:e,icon:t,onClick:a,pressed:r,disabled:n,buttonRef:o}){return(0,d.jsx)(T.Tooltip,{label:e,side:"bottom",portal:!0,children:(0,d.jsx)(T.Button,{ref:o,size:"sm",className:"art-icon-button","aria-label":e,"aria-pressed":r,disabled:n,onClick:a,children:t})})}function Ri({quote:e,askLabel:t,dismissLabel:a,onAsk:r,onDismiss:n}){return(0,d.jsxs)("div",{className:"art-selection-bar",role:"toolbar","aria-label":t,children:[(0,d.jsx)("span",{className:"art-selection-quote",title:e,children:e}),(0,d.jsx)(T.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,d.jsx)(T.IconSparkleRegular,{size:14}),onClick:r,children:t}),(0,d.jsx)(Qe,{label:a,icon:(0,d.jsx)(T.IconCloseOutlineRegular,{size:14}),onClick:n})]})}function Ai({t:e,layer:t,askLabel:a,dismissLabel:r,onAsk:n,onDismiss:o}){let s=Fa(e,t.type);return(0,d.jsxs)("div",{className:"art-selection-bar art-layer-bar",role:"toolbar","aria-label":a,children:[(0,d.jsx)("span",{className:"art-layer-bar-glyph","aria-hidden":"true",children:Qt(t.type)}),(0,d.jsxs)("span",{className:"art-layer-bar-text",children:[(0,d.jsx)("span",{className:"art-layer-bar-name",title:t.name,children:t.name}),(0,d.jsx)("span",{className:"art-layer-bar-sub",children:t.parentName===""?s:e("layer.parentLine",{type:s,parent:t.parentName})})]}),(0,d.jsx)(T.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,d.jsx)(T.IconSparkleRegular,{size:14}),onClick:n,children:a}),(0,d.jsx)(Qe,{label:r,icon:(0,d.jsx)(T.IconCloseOutlineRegular,{size:14}),onClick:o})]})}function Ei({label:e,closeLabel:t,overlay:a,onClose:r,head:n,children:o}){let s=(0,N.useRef)(null);return(0,N.useEffect)(()=>{s.current?.querySelector("[data-drawer-initial]")?.focus()??s.current?.querySelector(".art-version, button")?.focus()},[e]),(0,N.useEffect)(()=>{if(!a)return;let l=c=>{let i=s.current;i===null||c.target instanceof Node&&i.contains(c.target)||i.querySelector("button")?.focus()};return document.addEventListener("focusin",l),()=>document.removeEventListener("focusin",l)},[a]),(0,d.jsxs)("div",{className:"art-drawer-layer","data-overlay":a?"true":void 0,children:[a?(0,d.jsx)("div",{className:"art-drawer-scrim","aria-hidden":"true",onPointerDown:r}):null,(0,d.jsxs)("aside",{ref:s,className:"art-drawer",role:"dialog","aria-modal":a?"true":void 0,"aria-label":e,onKeyDown:l=>{if(l.key==="Escape"){l.preventDefault(),l.stopPropagation(),r();return}if(l.key!=="Tab"||!a)return;let c=[...s.current?.querySelectorAll('button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex="0"]')??[]],i=c[0],h=c[c.length-1];i===void 0||h===void 0||(l.shiftKey&&document.activeElement===i?(l.preventDefault(),h.focus()):!l.shiftKey&&document.activeElement===h&&(l.preventDefault(),i.focus()))},children:[(0,d.jsxs)("div",{className:"art-drawer-head",children:[n??(0,d.jsx)("h2",{children:e}),(0,d.jsx)(Qe,{label:t,icon:(0,d.jsx)(T.IconCloseOutlineRegular,{size:14}),onClick:r})]}),(0,d.jsx)("div",{className:"art-drawer-body",children:o})]})]})}function Ga(e){let t=e.useTabInfo(),a=He(t.tab.contentId??t.tab.navigation?.address),r=e.useWorkspaces(n=>n.items.find(o=>a?.scope==="workspace"&&o.workspaceId===a.workspaceId)?.title);return a===void 0?(0,d.jsx)("section",{className:"art-root",children:(0,d.jsx)("p",{className:"art-note",children:e.t("error.notFound")})}):(0,d.jsx)(An,{t:e.t,address:a,useTabInfo:e.useTabInfo,onBack:t.tab.actions?.close,workspaceName:r,inputActions:e.inputActions},ee(a))}function Rn({t:e,address:t,onBack:a,workspaceName:r,inputActions:n}){return(0,d.jsx)(An,{t:e,address:t,onBack:a,workspaceName:r,back:!0,inputActions:n},ee(t))}var Di=()=>{};function An({t:e,address:t,useTabInfo:a,onBack:r,workspaceName:n,back:o,inputActions:s}){let{model:l,state:c}=Ar(t),{payload:i,draft:h,saving:k,conflict:b,failure:p,failureMessage:u}=c,y=l.where,v=t.id,D=lt(),[S,C]=(0,N.useState)("view"),[E,F]=(0,N.useState)(!1),[z,W]=(0,N.useState)(!1),[U,H]=(0,N.useState)(!1),[M,x]=(0,N.useState)("layers"),[A,Q]=(0,N.useState)(null),[L,q]=(0,N.useState)(null),[I,J]=(0,N.useState)([]),[Ze,et]=(0,N.useState)(null),[ha,At]=(0,N.useState)(null),[va,lo]=(0,N.useState)(0),[ba,co]=(0,N.useState)(!1),[er,ya]=(0,N.useState)(null),[po,tr]=(0,N.useState)(!1),[ft,Ge]=(0,N.useState)(!1),[oe,tt]=(0,N.useState)(null),[Ae,he]=(0,N.useState)(null),[uo,Et]=(0,N.useState)(!1),[fo,ar]=(0,N.useState)(!1),[wa,rr]=(0,N.useState)(""),[xa,mt]=(0,N.useState)(null),[mo,Dt]=(0,N.useState)(!1),[be,Ce]=(0,N.useState)(!1),[at,Ee]=(0,N.useState)(null),[nr,ka]=(0,N.useState)(null),[or,gt]=(0,N.useState)(null),De=(0,N.useRef)(0),Lt=(0,N.useRef)(null),ir=(0,N.useRef)(null),sr=(0,N.useRef)(null),Sa=(0,N.useRef)(!1),Mt=zr(v),lr=(a??Di)();(0,N.useEffect)(()=>{i!==null&&Mt>i.version&&h===null&&!k&&!b&&gt(Mt),l.externalVersion(Mt)},[Mt,l,k,i?.version,h,b]),(0,N.useEffect)(()=>{b&&gt(null)},[b]),(0,N.useEffect)(()=>{Ee(null),J([])},[i?.version,oe?.version,c.revision]),(0,N.useEffect)(()=>{if(A===null){q(null);return}return q(A.getSnapshot()),A.subscribe(q)},[A]);let cr=oe!==null;(0,N.useEffect)(()=>{cr&&S==="edit"&&(C("view"),H(!1))},[cr,S]);let go=i!==null,rt=(0,N.useCallback)(()=>{let f=Lt.current,P=f===null?0:f.clientWidth;co(P>0?P<=600:window.innerWidth<=600)},[]);(0,N.useEffect)(()=>{let f=Lt.current;if(f===null)return;rt();let P=new ResizeObserver(rt);return P.observe(f),window.addEventListener("resize",rt),()=>{P.disconnect(),window.removeEventListener("resize",rt)}},[go,rt]);let Ue=(0,N.useCallback)(f=>{l.getSnapshot().draft!==null||l.getSnapshot().saving?mt({run:f}):f()},[l]),Pt=(0,N.useCallback)(()=>{++De.current,Ge(!1),tt(null),Ee(null),he(null),gt(null)},[]),Ot=(0,N.useCallback)(async()=>{Pt(),await l.discardAndReload()},[l,Pt]);(0,N.useEffect)(()=>lr?.tab.actions?.bindCommands({refresh:()=>Ue(Ot)}),[lr?.tab.actions,Ue,Ot]),(0,N.useEffect)(()=>{if(i?.manifest.type!=="doc"&&i?.manifest.type!=="sheet"||h===null||b||k)return;let f=setTimeout(()=>void l.save(),1200);return()=>clearTimeout(f)},[h,b,k,l,i?.manifest.type]),(0,N.useEffect)(()=>{if(!z||i===null)return;let f=new AbortController;return ya(null),tr(!1),B.history(y,v,f.signal).then(P=>{f.signal.aborted||ya(P.versions)}).catch(()=>{f.signal.aborted||tr(!0)}),()=>f.abort()},[z,i?.version,l]),(0,N.useEffect)(()=>()=>{++De.current},[]),(0,N.useEffect)(()=>{if(z){Sa.current=!0;return}Sa.current&&(Sa.current=!1,sr.current?.focus())},[z]),(0,N.useEffect)(()=>{if(S!=="source"||i?.manifest.type!=="page")return;let f=()=>{let P=ir.current,ie=window.getSelection();if(P===null||ie===null||ie.anchorNode===null||!P.contains(ie.anchorNode))return;let vt=_a(ie.toString());Ee(vt.text===""?null:vt)};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[S,i?.manifest.type]);let ho=(0,N.useCallback)(f=>Q(f),[]),vo=(0,N.useCallback)(f=>J(f),[]),bo=(0,N.useCallback)(f=>et(f),[]),yo=()=>H(!1),dr=()=>{++De.current,Ge(!1),tt(null),W(!1)},Ta=()=>{rt(),++De.current,Ge(!1),tt(null),he(null),H(!1),W(!0)},pr=async f=>{let P=++De.current;if(he(null),Ee(null),f===i?.version){Ge(!1),tt(null);return}Ge(!0);try{let ie=await B.get(y,v,f);P===De.current&&tt(ie)}catch(ie){P===De.current&&le(e(X(Y(ie))))}finally{P===De.current&&Ge(!1)}},ur=async()=>ft?null:oe!==null?oe.version:await l.save()?l.getSnapshot().payload?.version??null:null,fr=async f=>{if(!be){Ce(!0);try{let P=await ur();if(P===null)return;if(f==="print")bn((await B.printable(y,v,P)).html);else{let ie=await B.exportFile(y,v,f,P);Tr(ie),le(e("export.done",{name:ie.fileName,path:ie.path}))}}catch(P){le(e(X(Y(P))))}finally{Ce(!1)}}},wo=async f=>{if(!(oe!==null||b||be)){Ce(!0);try{if(!await l.save())throw new Error(e("error.stale"));let P=l.getSnapshot();if(P.draft!==null||P.conflict||P.payload===null)throw new Error(e("error.stale"));let ie=await B.rebase(y,v,P.payload.version,f);_e(v,ie.manifest.version),Ne(),Pt(),await l.load(),le(e("generation.done"))}finally{Ce(!1)}}},xo=async()=>{wa.trim()===""||k||await l.save(wa.trim())&&Et(!1)},ko=async()=>{if(oe===null||be)return;let f=oe.version;Ue(async()=>{Ce(!0);try{let P=await B.restore(y,v,f,l.getSnapshot().payload?.version??0);_e(v,P.manifest.version),Ne(),Pt(),await l.load()}catch(P){le(e(X(Y(P))))}finally{Ce(!1)}})},Ca=async(f,P)=>{try{await navigator.clipboard.writeText(f),le(e(P))}catch{ka(f)}},ht=async(f,P="agent.addedTruncated")=>{if(!(be||b||ft||i===null)){Ce(!0);try{let ie=await ur();if(ie===null)return;let vt=l.getSnapshot().payload??i,Ia=Cn(e,{title:vt.manifest.title,id:v,version:ie,current:vt.version,...t.scope==="workspace"?{workspaceId:t.workspaceId}:{}}),Ft=f?.text??"";if(Ee(null),J([]),A?.clearSelection(),s===void 0){await Ca(Wa(Ft,Ia),"agent.copied");return}if((Ft===""||s.insertQuote(Ft))&&s.insertText(Ia,s.captureInsertion())){le(e(f?.truncated===!0?P:"agent.added"));return}await Ca(Wa(Ft,Ia),"agent.insertFailed")}finally{Ce(!1)}}},jt=(0,N.useCallback)(f=>{let P=_a(f);Ee(P.text===""?null:P)},[]),So=async()=>{if(Ae==="version"){he(null);return}if(i!==null){try{let f=await B.history(y,v);ya(f.versions)}catch(f){le(e(X(Y(f))));return}he("version")}};if(i===null)return(0,d.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",ref:Lt,children:(0,d.jsxs)("div",{className:"art-center",role:p===void 0?"status":"alert",children:[(0,d.jsx)("p",{className:"art-center-hint",children:e(p===void 0?"empty.loading":X(p))}),(0,d.jsxs)("div",{className:"art-center-actions",children:[p===void 0?null:(0,d.jsx)(T.Button,{size:"sm",variant:"outline",onClick:()=>void l.load(),children:e("action.retry")}),r===void 0?null:(0,d.jsx)(T.Button,{size:"sm",variant:"outline",onClick:r,children:e("tab.close")})]})]})});let K=i.manifest.type,Le=oe??i,nt=oe?.content??h??i.content,fe=oe!==null,Na=oe?.version??i.version,To=e(k?"tab.saving":b?"tab.conflictTitle":ft?"empty.loading":oe!==null?"tab.readOnly":p!==void 0?"tab.saveFailed":h!==null?"tab.unsaved":"tab.saved"),Co=b||p!==void 0&&!k?"error":k?"warn":void 0,No=t.scope==="workspace"?n??t.workspaceId:e("scope.library"),zo=S==="source"&&!fe&&(E||h!==null),za=K==="doc"||K==="sheet",Io=f=>e(K==="design"&&f==="html"?"export.mockupHtml":K==="design"&&f==="html-svg"?"export.mockupSvgHtml":`export.${f}`),mr=[...vr[K].map(f=>({id:f,label:Io(f)})),...K==="design"?[]:[{type:"separator",id:"export-gap"},{id:"print",label:e("export.print")}]],gr=f=>{he(null),fr(f==="print"?"print":f)},Ro=[...ba?[...mr,{type:"separator",id:"more-gap"}]:[],...K==="design"||K==="sheet"||fe?[]:[{id:"rebase",label:e("generation.rebase"),disabled:be||k||b}],{id:"rename",label:e("tab.rename")},{id:"reload",label:e("tab.reload")},{type:"separator",id:"danger-gap"},{id:"delete",label:e("tab.delete"),danger:!0}],Ao=f=>{he(null),f==="rename"?(rr(i.manifest.title),Et(!0)):f==="rebase"?ar(!0):f==="reload"?Ue(Ot):f==="delete"?Dt(!0):gr(f)},Eo=[...(er??[]).map(f=>({id:"v"+f.version,label:e("tab.versionOf",{version:f.version})+(f.version===i.version?" \xB7 "+e("tab.currentVersion"):"")})),{type:"separator",id:"versions-gap"},{id:"all",label:e("tab.allVersions")}],Do=f=>{he(null),f==="all"?Ta():pr(Number(f.slice(1)))},Lo=(0,d.jsx)(T.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,d.jsx)(T.IconSparkleRegular,{size:14}),disabled:be||b||ft,onClick:()=>{if(K==="design"){let f=A?.quoteSelection();if(f!=null){ht(Va(e,f),"agent.addedTruncatedDesign");return}}ht(at)},children:e("agent.ask")});return(0,d.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"","data-artifact-id":v,"aria-busy":be,ref:Lt,children:[(0,d.jsxs)("header",{className:"art-header art-editor-header",children:[(0,d.jsxs)("div",{className:"art-heading",children:[!o||r===void 0?null:(0,d.jsx)(Qe,{label:e("action.back"),icon:(0,d.jsx)(T.IconChevronLeftOutlineRegular,{size:16}),onClick:()=>Ue(r)}),(0,d.jsxs)("div",{className:"art-identity",children:[(0,d.jsx)("h1",{className:"art-title",title:i.manifest.title,children:i.manifest.title}),(0,d.jsxs)("div",{className:"art-meta",children:[(0,d.jsxs)("span",{className:"art-meta-text",children:[No,t.scope==="workspace"?" \xB7 "+e("scope.workspace"):null]}),(0,d.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,d.jsx)(T.Menu,{open:Ae==="version",onClose:()=>he(null),items:Eo,onSelect:Do,portal:!0,autoFocus:!0,anchor:(0,d.jsxs)(T.Button,{size:"sm",className:"art-version-button","aria-label":e("tab.versionPicker"),"aria-haspopup":"menu","aria-expanded":Ae==="version",onClick:()=>void So(),children:[e("gallery.version",{version:Na}),(0,d.jsx)(T.IconChevronDownOutlineRegular,{size:12})]})}),(0,d.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,d.jsx)("span",{className:"art-save-status","data-tone":Co,"aria-live":"polite",children:To}),K==="design"||K==="sheet"?null:(0,d.jsxs)("span",{className:"art-generation",title:Le.generation?.system?e("design.revision",{name:Le.generation.system.name,revision:Le.generation.system.revision}):void 0,children:[" \xB7 ",e(Le.generation?"generation.pinned":"generation.legacy")]})]})]})]}),(0,d.jsxs)("div",{className:"art-actions art-editor-actions",children:[K==="doc"||K==="sheet"?null:(0,d.jsx)(T.SegmentedControl,{id:"art-mode-"+v,className:"art-segment",label:e("tab.mode"),value:S,options:K==="design"?[{value:"view",label:e("canvas.viewMode")},{value:"edit",label:e("canvas.editMode"),disabled:fe,title:fe?e("canvas.editOldVersion"):void 0},{value:"source",label:e("tab.source")}]:[{value:"view",label:e("tab.preview")},{value:"source",label:e("tab.source")}],onChange:f=>{C(f),Ee(null),H(K==="design"&&f==="edit"&&!fe)}}),K==="design"&&S==="edit"&&!fe?(0,d.jsx)(Qe,{label:e("canvas.inspector"),icon:(0,d.jsx)(T.IconSlidersTwoOutlineRegular,{size:16}),pressed:U,onClick:()=>{U?H(!1):(W(!1),H(!0))}}):null,h===null||fe?null:(0,d.jsx)(Qe,{label:e("tab.save"),icon:(0,d.jsx)(T.IconSaveOutlineRegular,{size:16}),disabled:b,onClick:()=>void l.save()}),(0,d.jsx)(Qe,{buttonRef:sr,label:e("tab.history"),icon:(0,d.jsx)(T.IconClockOutlineRegular,{size:16}),pressed:z,onClick:()=>{z?dr():Ta()}}),ba?null:(0,d.jsx)(T.Menu,{open:Ae==="export",onClose:()=>he(null),items:mr,onSelect:gr,align:"end",portal:!0,autoFocus:!0,anchor:(0,d.jsx)(T.Button,{size:"sm",icon:(0,d.jsx)(T.IconDownloadOutlineRegular,{size:14}),"aria-label":e("tab.export"),"aria-haspopup":"menu","aria-expanded":Ae==="export",disabled:be||ft,onClick:()=>he(Ae==="export"?null:"export"),children:e("tab.export")})}),Lo,(0,d.jsx)(T.Menu,{open:Ae==="more",onClose:()=>he(null),items:Ro,onSelect:Ao,align:"end",portal:!0,autoFocus:!0,anchor:(0,d.jsx)(T.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.more"),"aria-haspopup":"menu","aria-expanded":Ae==="more",onClick:()=>he(Ae==="more"?null:"more"),children:(0,d.jsx)(T.IconEllipsisOutlineRegular,{size:14})})})]})]}),fo?(0,d.jsx)(Nn,{t:e,where:y,onClose:()=>ar(!1),onApply:wo}):null,uo?(0,d.jsxs)("form",{className:"art-inline-form",onSubmit:f=>{f.preventDefault(),xo()},children:[(0,d.jsx)(T.Input,{"aria-label":e("tab.rename"),value:wa,maxLength:120,autoFocus:!0,onChange:f=>rr(f.target.value),onKeyDown:f=>{f.key==="Escape"&&Et(!1)}}),(0,d.jsx)(T.Button,{type:"submit",size:"sm",variant:"primary",disabled:k||b,children:e("tab.save")}),(0,d.jsx)(T.Button,{size:"sm",variant:"outline",onClick:()=>Et(!1),children:e("create.cancel")})]}):null,or===null?null:(0,d.jsxs)("div",{className:"art-bar",role:"status",children:[(0,d.jsx)("span",{children:e("tab.agentUpdate",{version:or})}),(0,d.jsxs)("span",{className:"art-bar-actions",children:[(0,d.jsx)(T.Button,{size:"sm",variant:"outline",onClick:()=>{gt(null),Ta()},children:e("tab.viewHistory")}),(0,d.jsx)(T.Button,{size:"sm",variant:"outline",onClick:()=>gt(null),children:e("tab.dismiss")})]})]}),b?(0,d.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"alert",children:[(0,d.jsxs)("span",{className:"art-bar-text",children:[(0,d.jsx)("strong",{children:e("tab.conflictTitle")}),(0,d.jsx)("span",{children:e("tab.conflictHint")})]}),(0,d.jsxs)("span",{className:"art-bar-actions",children:[(0,d.jsx)(T.Button,{size:"sm",variant:"outline",onClick:()=>void Ca(h??"","action.copied"),children:e("tab.copyDraft")}),(0,d.jsx)(T.Button,{size:"sm",variant:"outline",onClick:()=>Ue(Ot),children:e("tab.discardReload")})]})]}):null,!b&&p!==void 0?(0,d.jsxs)("div",{className:"art-bar","data-tone":"error",role:"alert",children:[(0,d.jsx)("span",{children:u??e(X(p))}),(0,d.jsx)(T.Button,{size:"sm",variant:"outline",onClick:()=>void l.save(),children:e("action.retry")})]}):null,oe===null?null:(0,d.jsxs)("div",{className:"art-bar",role:"status",children:[(0,d.jsx)("span",{children:e("tab.viewingOld",{version:oe.version,current:i.version})}),(0,d.jsxs)("span",{className:"art-bar-actions",children:[(0,d.jsx)(T.Button,{size:"sm",variant:"outline",onClick:()=>{++De.current,Ge(!1),tt(null),Ee(null)},children:e("tab.backToCurrent")}),(0,d.jsx)(T.Button,{size:"sm",variant:"outline",disabled:be,onClick:()=>void ko(),children:e("tab.restoreThis")})]})]}),K!=="design"||Ze===null?null:(0,d.jsxs)("div",{className:"art-bar","data-tone":"error",role:"alert",children:[(0,d.jsx)("span",{children:e("canvas.startFailed")}),(0,d.jsx)("span",{className:"art-bar-actions",children:(0,d.jsx)(T.Button,{size:"sm",variant:"outline",onClick:()=>{et(null),lo(f=>f+1)},children:e("action.retry")})})]}),K!=="design"||fe||S==="source"?null:(()=>{let f=(i.designInfo?.warnings??[]).filter(Boolean);return f.length===0||ha===v+":"+String(i.version)?null:(0,d.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"note",children:[(0,d.jsxs)("span",{className:"art-bar-text",children:[(0,d.jsx)("strong",{children:e("tab.designWarnings",{version:i.version})}),(0,d.jsx)("span",{children:f.join(" \xB7 ")})]}),(0,d.jsx)("span",{className:"art-bar-actions",children:(0,d.jsx)(T.Button,{size:"sm",variant:"outline",onClick:()=>At(v+":"+String(i.version)),children:e("tab.dismiss")})})]})})(),(0,d.jsxs)("div",{className:"art-body",children:[(0,d.jsxs)("div",{className:"art-stage",role:za?void 0:"tabpanel",id:za?void 0:"art-mode-"+v+"-"+S+"-panel","aria-labelledby":za?void 0:"art-mode-"+v+"-"+S,children:[(K==="page"||K==="sheet")&&at!==null&&!z?(0,d.jsx)(Ri,{quote:at.text,askLabel:e("agent.ask"),dismissLabel:e("tab.dismiss"),onAsk:()=>void ht(at),onDismiss:()=>Ee(null)}):null,K==="design"&&S!=="source"&&!fe&&I[0]!==void 0?(0,d.jsx)(Ai,{t:e,layer:I[0],askLabel:e("agent.ask"),dismissLabel:e("tab.dismiss"),onAsk:()=>{let f=A?.quoteSelection();f!=null&&ht(Va(e,f),"agent.addedTruncatedDesign")},onDismiss:()=>A?.clearSelection()}):null,K==="sheet"?(0,d.jsx)(Tn,{content:nt,revision:(oe?.version??0)+":"+c.revision,editable:!fe&&!b,label:i.manifest.title,loadingLabel:e("empty.loading"),failedLabel:e("error.generic"),design:Le.design,dark:D,t:e,onChange:f=>l.edit(f),onSave:()=>void l.save(),onSelectionText:jt}):K==="doc"?(0,d.jsx)(ea,{markdown:nt,revision:(oe?.version??0)+":"+c.revision,editable:!fe&&!b,label:i.manifest.title,loadingLabel:e("empty.loading"),failedLabel:e("error.generic"),design:Le.design,dark:D,t:e,onChange:f=>l.edit(f),onSave:()=>void l.save(),onSelectionText:jt,selectionAction:at===null?null:(0,d.jsx)(T.Button,{size:"sm",variant:"primary",icon:(0,d.jsx)(T.IconSparkleRegular,{size:14}),onMouseDown:f=>f.preventDefault(),onClick:()=>void ht(at),children:e("agent.ask")})}):S!=="source"?K==="design"?fe?(0,d.jsx)(Ba,{t:e,where:y,id:v,version:Na,title:i.manifest.title}):(0,d.jsx)(on,{t:e,source:nt,revision:"0:"+c.revision,title:i.manifest.title,mode:S==="edit"?"edit":"view",onChange:f=>l.edit(f),onSave:()=>void l.save(),onFailure:bo,onHandle:ho,onSelection:vo,attempt:va,fallback:(0,d.jsx)(Ba,{t:e,where:y,id:v,version:Na,title:i.manifest.title})}):(0,d.jsx)(na,{content:nt,designCss:Le.designCss,title:i.manifest.title,frameTitle:e("tab.frameTitle",{title:i.manifest.title}),dark:D,onSelectionText:jt}):zo?(0,d.jsx)(kn,{value:nt,readOnly:!1,label:e("tab.source"),hint:e(K==="design"?"tab.manualSaveDesign":"tab.manualSave"),onChange:f=>l.edit(f),onSave:()=>void l.save(),onSelectionText:jt}):(0,d.jsxs)("div",{className:"art-code",ref:ir,children:[(0,d.jsxs)("div",{className:"art-code-bar",children:[(0,d.jsx)("span",{children:e(fe?"tab.readOnly":"tab.codeHint")}),fe?null:(0,d.jsx)(T.Button,{size:"sm",variant:"outline",icon:(0,d.jsx)(T.IconEditOutlineRegular,{size:14}),onClick:()=>F(!0),children:e("tab.editSource")})]}),(0,d.jsx)(T.CodeBlock,{code:nt,lang:K==="design"?"jsx":"html",lineNumbers:!0,showHeader:!1,wrap:!0,className:"art-code-block",copyLabel:e("code.copy"),copiedLabel:e("action.copied")})]})]}),!z&&!U?null:(0,d.jsx)(Ei,{label:e(z?"history.title":"canvas.inspector"),closeLabel:e(z?"history.close":"canvas.closeInspector"),overlay:ba,onClose:z?dr:yo,head:z?void 0:(0,d.jsx)(T.SegmentedControl,{id:"art-inspector-"+v,className:"art-inspector-tabs",options:[{value:"layers",label:e("panel.layers")},{value:"properties",label:e("panel.properties")}],value:M,onChange:x,label:e("canvas.inspectorTabs")}),children:z?(0,d.jsx)(xn,{t:e,versions:er,failed:po,current:i.version,selected:oe?.version??i.version,onSelect:f=>void pr(f)}):(0,d.jsx)("div",{className:"art-inspector",role:"tabpanel",id:"art-inspector-"+v+"-"+M+"-panel","aria-labelledby":"art-inspector-"+v+"-"+M,children:(0,d.jsx)(sn,{t:e,handle:A,snapshot:L,tab:M,palette:D?Le.design.colorsDark:Le.design.colors})})})]}),(0,d.jsx)(T.Modal,{open:xa!==null,onClose:()=>mt(null),title:e("tab.leaveTitle"),closeLabel:e("dialog.close"),description:e(b?"tab.conflictHint":"tab.leaveHint"),footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(T.Button,{variant:"outline",disabled:be,onClick:()=>mt(null),children:e("create.cancel")}),(0,d.jsx)(T.Button,{variant:"outline",disabled:k||be,onClick:()=>{let f=xa?.run;mt(null),f!==void 0&&l.discardAndReload().then(f)},children:e("tab.leaveDiscard")}),(0,d.jsx)(T.Button,{variant:"primary",disabled:b||be,onClick:async()=>{Ce(!0);let f=await l.save();Ce(!1);let P=xa?.run;f&&P!==void 0&&(mt(null),await P())},children:e("tab.leaveSave")})]}),children:p===void 0?null:(0,d.jsx)("p",{className:"art-modal-error",role:"alert",children:u??e(X(p))})}),(0,d.jsx)(T.Modal,{open:mo,onClose:()=>Dt(!1),title:e("tab.deleteTitle"),closeLabel:e("dialog.close"),description:e("tab.deleteConfirm",{title:i.manifest.title}),footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(T.Button,{variant:"outline",onClick:()=>Dt(!1),children:e("create.cancel")}),(0,d.jsx)(T.Button,{variant:"primary",onClick:()=>{Dt(!1),Ue(async()=>{try{await B.remove(y,v),Ne(),r?.()}catch(f){le(e(X(Y(f))))}})},children:e("tab.delete")})]})}),(0,d.jsx)(T.Modal,{open:nr!==null,onClose:()=>ka(null),title:e("agent.copyTitle"),closeLabel:e("dialog.close"),description:e("action.copyFailed"),footer:(0,d.jsx)(T.Button,{variant:"primary",onClick:()=>ka(null),children:e("dialog.done")}),children:(0,d.jsx)("textarea",{className:"art-fallback",readOnly:!0,value:nr??"","aria-label":e("agent.copyTitle"),onFocus:f=>f.currentTarget.select()})})]})}var En=Ho(require("react"),1),Dn=require("@deepseek-ai/dsh-client-ui-primitives"),Je=require("react/jsx-runtime"),oa=class extends En.default.Component{constructor(t){super(t),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,Je.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",children:(0,Je.jsxs)("div",{className:"art-center",role:"alert",children:[(0,Je.jsx)("p",{className:"art-center-title",children:this.props.title}),(0,Je.jsx)("p",{className:"art-center-hint",children:this.props.hint}),(0,Je.jsx)(Dn.Button,{size:"sm",variant:"outline",onClick:()=>window.location.reload(),children:this.props.reloadLabel})]})}):this.props.children}};var ia=require("react"),ct=require("@deepseek-ai/dsh-client-ui-primitives");var Se={sidebarRight:null,layout:null};var G=require("react/jsx-runtime");function Li(e){if(e===null||typeof e!="object")return null;let t={...e},{id:a,type:r,title:n,version:o,workspaceId:s}=t;if(t.kind!=="artifact"||typeof a!="string"||typeof n!="string"||typeof o!="number"||r!=="page"&&r!=="doc"&&r!=="design"&&r!=="sheet")return null;let l=yr(a);return l===void 0?null:l==="workspace"?typeof s!="string"||s===""?null:{id:a,type:r,title:n,version:o,address:{scope:l,workspaceId:s,id:a}}:{id:a,type:r,title:n,version:o,address:{scope:l,id:a}}}function Mi(e){return Array.isArray(e)?e.map(t=>{if(t===null||typeof t!="object")return"";let a={...t};return a.type==="text"&&typeof a.text=="string"?a.text:""}).filter(t=>t!=="").join(`
60
+ `).trim():""}function Pi(e){if(e===null||typeof e!="object")return;let t={...e};return typeof t.title=="string"&&t.title.trim()!==""?t.title.trim():void 0}var Ln=new Set;function Ua({t:e,phase:t,toolName:a,block:r}){let n=t==="result"&&r?.isError!==!0?Li(r?.meta):null,o=(0,ia.useRef)(t!=="result");t!=="result"&&(o.current=!0);let s=a==="artifact_update";if((0,ia.useEffect)(()=>{if(n===null)return;Me(n.id,n.title),_e(n.id,n.version),Ne();let c=n.id+":"+n.version;!o.current||Ln.has(c)||(Ln.add(c),Se.sidebarRight?.openResource(ee(n.address)))},[n?.id,n?.version,n?.title]),t!=="result"){let c=Pi(r?.args),i=c===void 0?e(s?"card.updatingUntitled":"card.working"):e(s?"card.updating":"card.creating",{title:c});return(0,G.jsxs)("div",{className:"art-card","data-artifact-card":"working",children:[(0,G.jsx)("span",{className:"art-card-icon",children:(0,G.jsx)(ze,{})}),(0,G.jsx)("span",{className:"art-card-text",children:(0,G.jsx)(ct.TextShimmer,{active:!0,className:"art-card-title",children:(0,G.jsx)("span",{role:"status",children:i})})}),(0,G.jsx)(ct.StateDot,{state:"ongoing"})]})}if(r?.isError===!0)return(0,G.jsxs)("div",{className:"art-card","data-artifact-card":"error",children:[(0,G.jsx)("span",{className:"art-card-icon","data-tone":"error",children:(0,G.jsx)(ze,{})}),(0,G.jsxs)("span",{className:"art-card-text",children:[(0,G.jsx)("span",{className:"art-card-title",children:e("card.failed")}),(0,G.jsx)("span",{className:"art-card-sub","data-tone":"error",children:Mi(r.content)})]})]});if(n===null)return(0,G.jsxs)("div",{className:"art-card","data-artifact-card":"missing",children:[(0,G.jsx)("span",{className:"art-card-icon",children:(0,G.jsx)(ze,{})}),(0,G.jsx)("span",{className:"art-card-sub",children:e("card.missing")})]});let l=ee(n.address);return(0,G.jsxs)("button",{type:"button",className:"art-card art-card-open","data-artifact-card":"ready","data-artifact-id":n.id,"aria-label":e("card.openNamed",{title:n.title}),onClick:()=>Se.sidebarRight?.openResource(l),children:[(0,G.jsx)("span",{className:"art-card-icon",children:n.type==="page"?(0,G.jsx)(ze,{}):n.type==="doc"?(0,G.jsx)(Oe,{}):n.type==="sheet"?(0,G.jsx)(qe,{}):(0,G.jsx)(Ye,{})}),(0,G.jsxs)("span",{className:"art-card-text",children:[(0,G.jsx)("span",{className:"art-card-title",title:n.title,children:n.title}),(0,G.jsxs)("span",{className:"art-card-sub",children:[e(s?"card.updated":"card.created")," \xB7 ",e(`type.${n.type}`)," \xB7 ",e("gallery.version",{version:n.version}),n.address.scope==="library"?" \xB7 "+e("scope.library"):""]})]}),(0,G.jsx)("span",{className:"art-card-go","aria-hidden":"true",children:(0,G.jsx)(ct.IconChevronRightOutlineRegular,{size:14})})]})}var zt=require("react"),pt=require("@deepseek-ai/dsh-client-ui-primitives");var Mn=require("react");function sa({sessionId:e,useSessions:t,useWorkspaces:a}){let r=a(o=>o.items),n=t(o=>o.byId[e]);return(0,Mn.useMemo)(()=>{let o=typeof n?.cwd=="string"?n.cwd:null,s=r.find(l=>l.sessionIds?.includes(e))??r.find(l=>o!==null&&(o===l.path||o.startsWith(`${l.path}/`)))??null;return{root:o??s?.path??null,workspaceId:s?.workspaceId??null}},[r,n,e])}var Nt="dsh-artifact-studio/artifact",$a="artifact",dt="dsh-artifact-studio-panel",la="dsh-artifact-studio/artifacts",Ka="artifacts";var je=require("react/jsx-runtime"),Oi=6,qa=["dashboard","explainer","report","brief","sheet"];function ji(e,t){let a=e.filter(n=>n.source.sessionId===t),r=e.filter(n=>n.source.sessionId!==t);return[...a,...r].slice(0,Oi)}function Pn(e){let{t,sessionId:a,inputActions:r}=e,o=sa(e).workspaceId,s=Yt(),[l,c]=(0,zt.useState)(!1),[i,h]=(0,zt.useState)(null);(0,zt.useEffect)(()=>{if(!l||o===null)return;let u=new AbortController;return B.list({scope:"workspace",workspaceId:o},{},u.signal).then(y=>{u.signal.aborted||h(ji(y.items,a))}).catch(()=>{u.signal.aborted||h([])}),()=>u.abort()},[l,o,a,s]);let k=o===null?[{type:"label",id:"no-workspace",text:t("empty.noWorkspace")}]:i===null?[{type:"label",id:"loading",text:t("empty.loading")}]:i.length===0?[{type:"label",id:"empty",text:t("composer.empty")}]:i.map(u=>({id:"open:"+u.id,label:u.title,icon:u.type==="page"?(0,je.jsx)(ze,{size:14}):u.type==="doc"?(0,je.jsx)(Oe,{size:14}):u.type==="sheet"?(0,je.jsx)(qe,{size:14}):(0,je.jsx)(Ye,{size:14})})),b=[{type:"label",id:"recent",text:t("composer.recent")},...k,...r===void 0?[]:[{type:"separator",id:"start-gap"},{type:"label",id:"start",text:t("composer.start")},...qa.map(u=>({id:"prompt:"+u,label:t(`prompt.${u}`)}))],{type:"separator",id:"all-gap"},{id:"all",label:t("composer.all")}];return(0,je.jsx)(pt.Menu,{open:l,onClose:()=>c(!1),items:b,onSelect:u=>{if(c(!1),u==="all"){Se.layout?.selectPanel(dt);return}if(u.startsWith("prompt:")&&r!==void 0){r.insertText(t(`prompt.${u.slice(7)}Text`),r.captureInsertion());return}let y=i?.find(v=>"open:"+v.id===u);y===void 0||o===null||(Me(y.id,y.title),Se.sidebarRight?.openResource(ee({scope:"workspace",workspaceId:o,id:y.id})))},side:"top",portal:!0,autoFocus:!0,anchor:(0,je.jsx)(pt.Tooltip,{label:t("composer.label"),side:"top",portal:!0,children:(0,je.jsx)(pt.Button,{size:"sm",className:"art-composer","aria-label":t("composer.label"),"aria-haspopup":"menu","aria-expanded":l,onClick:()=>c(u=>!u),children:(0,je.jsx)(kt,{})})})})}var ne=require("react");var $=require("react"),O=require("@deepseek-ai/dsh-client-ui-primitives");var ge=require("react"),de=require("@deepseek-ai/dsh-client-ui-primitives");var R=require("react/jsx-runtime"),Fi=["sm","md","lg"],Bi=e=>`<!doctype html><html><head><meta name="color-scheme" content="light dark"><style>
40
61
  body { margin: 0; padding: 20px; font-family: var(--artifact-font-family); background: var(--artifact-color-surface); color: var(--artifact-color-text); }
41
62
  h2 { margin: 0 0 6px; font-family: var(--artifact-font-display); font-size: var(--artifact-font-size-4); letter-spacing: -0.02em; }
42
63
  p { margin: 0 0 14px; color: var(--artifact-color-muted); }
@@ -45,7 +66,7 @@ button { padding: 8px 14px; border: 0; border-radius: var(--artifact-radius-md);
45
66
  .tag { padding: 3px 8px; border-radius: var(--artifact-radius-sm); background: var(--artifact-color-raised); color: var(--artifact-color-success); font-size: 12px; }
46
67
  code { font-family: var(--artifact-font-mono); font-size: 12px; }
47
68
  </style></head><body><h2>${e("design.previewHeading")}</h2><p>${e("design.previewBody")}</p>
48
- <div class="row"><button>${e("design.previewButton")}</button><span class="tag">+12%</span><code>var(--artifact-color-primary)</code></div></body></html>`;function Ro(e){return/^#[0-9a-f]{6}$/i.test(e)}function qr({t:e,workspaceId:t,workspaceTitle:a}){let[r,n]=(0,Ie.useState)(null),[o,l]=(0,Ie.useState)(null),[s,y]=(0,Ie.useState)(!1),[c,h]=(0,Ie.useState)(!1),v=Qe();(0,Ie.useEffect)(()=>{let u=new AbortController;return U.designSystem(t,u.signal).then(m=>{n(m),l(m.tokens)}).catch(()=>{u.signal.aborted||y(!0)}),()=>u.abort()},[t]);let x=(0,Ie.useMemo)(()=>o===null?"":Qa(o),[o]);if(s)return(0,I.jsx)("p",{className:"art-note",children:e("error.generic")});if(r===null||o===null)return(0,I.jsx)("p",{className:"art-note",children:e("empty.loading")});let d=async u=>{h(!0);try{let m=await U.saveDesignSystem({scope:u,workspaceId:t},o);n(m),l(m.tokens),Z(e("design.saved"))}catch(m){Z(e(te(ee(m))))}finally{h(!1)}},p=async()=>{if(t!==null){h(!0);try{let u=await U.clearDesignSystem(t);n(u),l(u.tokens)}catch(u){Z(e(te(ee(u))))}finally{h(!1)}}};return(0,I.jsxs)("div",{className:"art-design",children:[(0,I.jsxs)("p",{className:"art-design-source",children:[e("design.hint")," ",e(`design.source.${r.source}`)]}),(0,I.jsxs)("div",{className:"art-design-group",children:[(0,I.jsx)("h3",{children:e("design.preview")}),(0,I.jsx)("div",{className:"art-design-preview",style:{height:150,display:"flex"},children:(0,I.jsx)(jt,{content:Eo(e),designCss:x,title:o.name,frameTitle:e("design.preview"),dark:v})})]}),(0,I.jsxs)("label",{className:"art-field",children:[e("design.name"),(0,I.jsx)("input",{type:"text",value:o.name,maxLength:80,onChange:u=>l({...o,name:u.target.value})})]}),["colors","colorsDark"].map(u=>(0,I.jsxs)("div",{className:"art-design-group",children:[(0,I.jsx)("h3",{children:e(u==="colors"?"design.colors":"design.colorsDark")}),(0,I.jsx)("div",{className:"art-swatches",children:it.map(m=>{let L=S=>{let V={...o[u],[m]:S};l({...o,[u]:V})};return(0,I.jsxs)("div",{className:"art-swatch",children:[(0,I.jsx)("input",{type:"color","aria-label":e(`design.color.${m}`)+" "+e(u==="colors"?"design.colors":"design.colorsDark"),value:Ro(o[u][m])?o[u][m]:"#000000",onChange:S=>L(S.target.value)}),(0,I.jsxs)("span",{className:"art-swatch-text",children:[e(`design.color.${m}`),(0,I.jsx)("input",{type:"text","aria-label":e(`design.color.${m}`)+" "+e(u==="colors"?"design.colors":"design.colorsDark")+" CSS",value:o[u][m],onChange:S=>L(S.target.value)})]})]},m)})})]},u)),(0,I.jsxs)("div",{className:"art-design-group",children:[(0,I.jsx)("h3",{children:e("design.type")}),(0,I.jsxs)("label",{className:"art-field",children:[e("design.font"),(0,I.jsx)("input",{type:"text",value:o.typography.fontFamily,onChange:u=>l({...o,typography:{...o.typography,fontFamily:u.target.value}})})]}),(0,I.jsxs)("label",{className:"art-field",children:[e("design.display"),(0,I.jsx)("input",{type:"text",value:o.typography.displayFamily,onChange:u=>l({...o,typography:{...o.typography,displayFamily:u.target.value}})})]}),(0,I.jsxs)("label",{className:"art-field",children:[e("design.mono"),(0,I.jsx)("input",{type:"text",value:o.typography.monoFamily,onChange:u=>l({...o,typography:{...o.typography,monoFamily:u.target.value}})})]})]}),(0,I.jsxs)("div",{className:"art-design-group",children:[(0,I.jsx)("h3",{children:e("design.radius")}),(0,I.jsx)("div",{className:"art-radius-row",children:Ao.map(u=>(0,I.jsxs)("label",{children:[e(`design.radius.${u}`),(0,I.jsx)("input",{type:"number",min:0,max:64,value:o.radius[u],onChange:m=>l({...o,radius:{...o.radius,[u]:Number(m.target.value)||0}})})]},u))})]}),(0,I.jsxs)("label",{className:"art-field",children:[e("design.notes"),(0,I.jsx)("textarea",{value:o.notes,maxLength:4e3,onChange:u=>l({...o,notes:u.target.value})}),(0,I.jsx)("span",{className:"art-field-hint",children:e("design.notesHint")})]}),(0,I.jsxs)("div",{className:"art-design-actions",children:[t===null?null:(0,I.jsx)(Ut.Button,{size:"sm",variant:"primary",disabled:c,onClick:()=>void d("workspace"),children:a===void 0?e("design.saveWorkspace"):e("design.saveWorkspaceNamed",{name:a})}),(0,I.jsx)(Ut.Button,{size:"sm",variant:t===null?"primary":"outline",disabled:c,onClick:()=>void d("library"),children:e("design.saveLibrary")}),r.source==="workspace"&&t!==null?(0,I.jsx)(Ut.Button,{size:"sm",variant:"outline",disabled:c,onClick:()=>void p(),children:e("design.clear")}):null]})]})}var Kr=require("react"),Yr="dsh-artifact-studio.pins";function Do(){if(typeof window>"u")return new Set;try{let e=window.localStorage.getItem(Yr);if(e===null)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(a=>typeof a=="string")):new Set}catch{return new Set}}var Wt=Do(),Ia=new Set;function zo(e){return Ia.add(e),()=>Ia.delete(e)}function Qr(){return(0,Kr.useSyncExternalStore)(zo,()=>Wt,()=>Wt)}function Xr(e){let t=new Set(Wt);t.has(e)?t.delete(e):t.add(e),Wt=t;try{window.localStorage.setItem(Yr,JSON.stringify([...t]))}catch{}for(let a of Ia)a()}var Po=`<!doctype html>
69
+ <div class="row"><button>${e("design.previewButton")}</button><span class="tag">+12%</span><code>var(--artifact-color-primary)</code></div></body></html>`;function Hi(e){return/^#[0-9a-f]{6}$/i.test(e)}function On({t:e,workspaceId:t,workspaceTitle:a}){let[r,n]=(0,ge.useState)(null),[o,s]=(0,ge.useState)(null),[l,c]=(0,ge.useState)(!1),[i,h]=(0,ge.useState)(!1),k=lt(),b={workspaceId:t,scope:t===null?"library":"workspace"},[p,u]=(0,ge.useState)(null),[y,v]=(0,ge.useState)(""),[D,S]=(0,ge.useState)(null),C=(0,ge.useRef)(0),E=r!==null&&o!==null&&JSON.stringify(o)!==JSON.stringify(r.tokens);(0,ge.useEffect)(()=>{let x=new AbortController;return n(null),s(null),u(null),c(!1),Promise.all([B.designSystem(t,x.signal),B.designSystems(b,x.signal)]).then(([A,Q])=>{x.signal.aborted||(n(A),s(A.tokens),u(Q))}).catch(()=>{x.signal.aborted||c(!0)}),()=>x.abort()},[t]);let F=(0,ge.useMemo)(()=>o===null?"":wr(o),[o]);if(l)return(0,R.jsx)("div",{className:"art-state",role:"alert",children:e("error.generic")});if(r===null||o===null)return(0,R.jsx)("div",{className:"art-state",role:"status",children:(0,R.jsx)(de.TextShimmer,{active:!0,children:e("empty.loading")})});let z=async(x,A=!1)=>{h(!0);try{let Q={scope:x,workspaceId:x==="library"?null:t},L=x===b.scope?p:await B.designSystems(Q);if(L===null)return;let q=!A&&r.system?.scope===x?r.system.id:void 0,I=A||q?{systemId:q,createNew:q===void 0,expectedRevision:L.revision}:void 0,J=await B.saveDesignSystem(Q,o,I);x===b.scope&&(n(J),s(J.tokens),v(J.system?.id??""),u(await B.designSystems(b))),S(null),le(e("design.saved"))}catch(Q){S(e(X(Y(Q))))}finally{h(!1)}},W=async()=>{if(t!==null){h(!0);try{let x=await B.clearDesignSystem(t);n(x),s(x.tokens)}catch(x){S(e(X(Y(x))))}finally{h(!1)}}},U=async x=>{if(E){S(e("design.unsavedSelection"));return}let A=++C.current;h(!0);try{let Q=await B.selectedDesign(b,x===""?{}:{systemId:x,systemScope:b.scope});A===C.current&&(v(x),n(Q),s(Q.tokens),S(null))}catch(Q){S(e(X(Y(Q))))}finally{A===C.current&&h(!1)}},H=async()=>{try{u(await B.designSystems(b)),S(null)}catch(x){S(e(X(Y(x))))}},M=async()=>{if(!(!p||!r.system||r.system.scope!==b.scope)){h(!0);try{await B.setDesignDefault(b,r.system.id,p.revision),await H(),le(e("design.saved"))}catch(x){S(e(X(Y(x))))}finally{h(!1)}}};return(0,R.jsxs)("div",{className:"art-design",children:[(0,R.jsxs)("label",{className:"art-field",children:[e("design.system"),(0,R.jsxs)("select",{className:"art-select",value:y,disabled:i,onChange:x=>void U(x.target.value),children:[(0,R.jsx)("option",{value:"",children:e("design.defaultChoice")}),p?.systems.map(x=>(0,R.jsx)("option",{value:x.id,children:e("design.revision",{name:x.name,revision:x.revision})},x.id))]})]}),(0,R.jsx)("p",{className:"art-note",children:e("design.pinHint")}),r.system?(0,R.jsx)("p",{className:"art-note",children:e("design.revision",{name:r.system.name,revision:r.system.revision})}):null,D?(0,R.jsx)("p",{role:"alert",className:"art-note",children:D}):null,(0,R.jsxs)("div",{className:"art-design-actions",children:[(0,R.jsx)(de.Button,{size:"sm",disabled:i||!p,onClick:()=>void z(b.scope,!0),children:e("design.copy")}),r.system?.scope===b.scope?(0,R.jsx)(de.Button,{size:"sm",disabled:i||E||p?.defaultId===r.system.id,onClick:()=>void M(),children:e("design.useDefault")}):null,(0,R.jsx)(de.Button,{size:"sm",disabled:i,onClick:()=>void H(),children:e("design.catalogReload")}),E?(0,R.jsx)(de.Button,{size:"sm",disabled:i,onClick:()=>{s(r.tokens),S(null)},children:e("design.discardEdits")}):null]}),(0,R.jsxs)("p",{className:"art-design-source",children:[e("design.hint")," ",e(`design.source.${r.source}`)]}),(0,R.jsxs)("div",{className:"art-design-group",children:[(0,R.jsx)("h3",{children:e("design.preview")}),(0,R.jsx)("div",{className:"art-token-preview",children:(0,R.jsx)(na,{content:Bi(e),designCss:F,title:o.name,frameTitle:e("design.preview"),dark:k})})]}),(0,R.jsxs)("fieldset",{disabled:i,style:{border:0,padding:0,margin:0,minWidth:0},children:[(0,R.jsxs)("label",{className:"art-field",children:[e("design.name"),(0,R.jsx)(de.Input,{type:"text",value:o.name,maxLength:80,onChange:x=>s({...o,name:x.target.value})})]}),["colors","colorsDark"].map(x=>(0,R.jsxs)("div",{className:"art-design-group",children:[(0,R.jsx)("h3",{children:e(x==="colors"?"design.colors":"design.colorsDark")}),(0,R.jsx)("div",{className:"art-swatches",children:$e.map(A=>{let Q=L=>{let q={...o[x],[A]:L};s({...o,[x]:q})};return(0,R.jsxs)("div",{className:"art-swatch",children:[(0,R.jsx)("input",{type:"color","aria-label":e(`design.color.${A}`)+" "+e(x==="colors"?"design.colors":"design.colorsDark"),value:Hi(o[x][A])?o[x][A]:"#000000",onChange:L=>Q(L.target.value)}),(0,R.jsxs)("span",{className:"art-swatch-text",children:[e(`design.color.${A}`),(0,R.jsx)(de.Input,{type:"text","aria-label":e(`design.color.${A}`)+" "+e(x==="colors"?"design.colors":"design.colorsDark")+" CSS",value:o[x][A],onChange:L=>Q(L.target.value)})]})]},A)})})]},x)),(0,R.jsxs)("div",{className:"art-design-group",children:[(0,R.jsx)("h3",{children:e("design.type")}),(0,R.jsxs)("label",{className:"art-field",children:[e("design.font"),(0,R.jsx)(de.Input,{type:"text",value:o.typography.fontFamily,onChange:x=>s({...o,typography:{...o.typography,fontFamily:x.target.value}})})]}),(0,R.jsxs)("label",{className:"art-field",children:[e("design.display"),(0,R.jsx)(de.Input,{type:"text",value:o.typography.displayFamily,onChange:x=>s({...o,typography:{...o.typography,displayFamily:x.target.value}})})]}),(0,R.jsxs)("label",{className:"art-field",children:[e("design.mono"),(0,R.jsx)(de.Input,{type:"text",value:o.typography.monoFamily,onChange:x=>s({...o,typography:{...o.typography,monoFamily:x.target.value}})})]})]}),(0,R.jsxs)("div",{className:"art-design-group",children:[(0,R.jsx)("h3",{children:e("design.radius")}),(0,R.jsx)("div",{className:"art-radius-row",children:Fi.map(x=>(0,R.jsxs)("label",{children:[e(`design.radius.${x}`),(0,R.jsx)(de.Input,{type:"number",min:0,max:64,value:o.radius[x],onChange:A=>s({...o,radius:{...o.radius,[x]:Number(A.target.value)||0}})})]},x))})]}),(0,R.jsxs)("label",{className:"art-field",children:[e("design.notes"),(0,R.jsx)("textarea",{value:o.notes,maxLength:4e3,onChange:x=>s({...o,notes:x.target.value})}),(0,R.jsx)("span",{className:"art-field-hint",children:e("design.notesHint")})]})]}),(0,R.jsxs)("div",{className:"art-design-actions",children:[t===null?null:(0,R.jsx)(de.Button,{size:"sm",variant:"primary",disabled:i,onClick:()=>void z("workspace"),children:a===void 0?e("design.saveWorkspace"):e("design.saveWorkspaceNamed",{name:a})}),(0,R.jsx)(de.Button,{size:"sm",variant:t===null?"primary":"outline",disabled:i,onClick:()=>void z("library"),children:e("design.saveLibrary")}),r.source==="workspace"&&t!==null?(0,R.jsx)(de.Button,{size:"sm",variant:"outline",disabled:i,onClick:()=>void W(),children:e("design.clear")}):null]})]})}var re={maxSheets:20,maxRows:5e3,maxColumns:100,maxCells:2e4,maxFormulaCells:5e3,maxCellText:1e4,maxFormula:2e3,maxName:31,minColumnWidth:24,maxColumnWidth:800,defaultColumnWidth:96,defaultRowHeight:28,maxOperations:200,maxOperationCells:4e3,maxEvaluationCells:2e5,maxSelectionQuote:1500},j=class extends Error{code;constructor(t,a="sheet/invalid"){super(t),this.name="SheetError",this.code=a}},_i=/^\$?([A-Za-z]{1,3})\$?([1-9][0-9]{0,6})$/,Vi=/^[A-Za-z]{1,3}$/,Wi=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,Gi=/[\\/?*[\]:]/,jn=["general","number","integer","currency","percent","date"],Ui=["left","center","right"],$i=["bold","italic","underline","strike","align","color","background","numberFormat"],Ki=["value","formula","style"],qi=["name","cells","columnWidths"],Yi=["schemaVersion","sheets"];function ut(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function da(e,t,a){for(let r of Object.keys(e))if(!t.includes(r))throw new j(a+' has an unknown field "'+r+'". Use '+t.join(", ")+".")}function Hn(e){if(!Number.isInteger(e)||e<0)throw new j("A column index must be a non-negative integer.");let t=e+1,a="";for(;t>0;){let r=(t-1)%26;a=String.fromCharCode(65+r)+a,t=Math.floor((t-1)/26)}return a}function _n(e){if(!Vi.test(e))return;let t=0;for(let r of e.toUpperCase())t=t*26+(r.charCodeAt(0)-64);let a=t-1;return a<re.maxColumns?a:void 0}function ca(e){let t=_i.exec(e.trim());if(t===null)return;let a=_n(t[1]??""),r=Number(t[2]);if(!(a===void 0||!Number.isInteger(r)||r<1||r>re.maxRows))return{row:r,column:a}}function pa(e,t){return Hn(t)+String(e)}function Xi(e,t="The sheet name"){if(typeof e!="string")throw new j(t+" must be a string.");let a=e.trim();if(a===""||a.length>re.maxName)throw new j(t+" must be 1 to "+String(re.maxName)+" characters.");if(Gi.test(a))throw new j(t+" cannot contain \\ / ? * [ ] or : characters.");if(a.startsWith("'")||a.endsWith("'"))throw new j(t+" cannot start or end with an apostrophe.");return a}function Fn(e,t){if(typeof e!="string"||!Wi.test(e.trim()))throw new j(t+" must be a hex color such as #1f2933.");let a=e.trim().toLowerCase();return a.length===4?"#"+a[1]+a[1]+a[2]+a[2]+a[3]+a[3]:a}function Qi(e,t){if(!ut(e))throw new j(t+" must be an object.");da(e,$i,t);let a={};for(let r of["bold","italic","underline","strike"]){let n=e[r];if(n!==void 0){if(typeof n!="boolean")throw new j(t+"."+r+" must be true or false.");a[r]=n}}if(e.align!==void 0){if(typeof e.align!="string"||!Ui.includes(e.align))throw new j(t+".align must be left, center, or right.");a.align=e.align}if(e.numberFormat!==void 0){if(typeof e.numberFormat!="string"||!jn.includes(e.numberFormat))throw new j(t+".numberFormat must be "+jn.join(", ")+".");a.numberFormat=e.numberFormat}return e.color!==void 0&&(a.color=Fn(e.color,t+".color")),e.background!==void 0&&(a.background=Fn(e.background,t+".background")),a}function Ji(e){return Object.keys(e).length===0}function Bn(e,t){if(e!=null){if(typeof e=="boolean")return e;if(typeof e=="number"){if(!Number.isFinite(e))throw new j(t+" must be a finite number.");return e}if(typeof e=="string"){if(e.length>re.maxCellText)throw new j(t+" is longer than "+String(re.maxCellText)+" characters.");return e}throw new j(t+" must be a string, number, boolean, or null.")}}function Vn(e,t){if(e===null)return;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean"){let s=Bn(e,t);return s===void 0?void 0:typeof s=="string"&&s.startsWith("=")?Vn({formula:s},t):{value:s}}if(!ut(e))throw new j(t+" must be a JSON scalar or an object with value, formula, or style.");da(e,Ki,t);let a=e.style===void 0?void 0:Qi(e.style,t+".style"),r=e.formula===void 0?void 0:Zi(e.formula,t+".formula");if(r!==void 0&&e.value!==void 0)throw new j(t+" cannot have both value and formula; the value of a formula is computed.");let n=Bn(e.value,t+".value"),o={};if(r!==void 0&&(o.formula=r),n!==void 0&&(o.value=n),a!==void 0&&!Ji(a)&&(o.style=a),!(o.formula===void 0&&o.value===void 0&&o.style===void 0))return o}function Zi(e,t){if(typeof e!="string")throw new j(t+" must be a string formula.");let a=e.trim();if(a===""||a==="=")throw new j(t+" is empty.");if(a.startsWith("=")||(a="="+a),a.length>re.maxFormula)throw new j(t+" is longer than "+String(re.maxFormula)+" characters.");return a}function es(e,t){if(e===void 0)return;if(!ut(e))throw new j(t+" must be an object of column letters to pixel widths.");let a={};for(let[r,n]of Object.entries(e)){let o=_n(r);if(o===void 0)throw new j(t+' has an invalid column "'+r+'".');if(typeof n!="number"||!Number.isFinite(n)||!Number.isInteger(n))throw new j(t+"."+r+" must be a whole number of pixels.");if(n<re.minColumnWidth||n>re.maxColumnWidth)throw new j(t+"."+r+" must be between "+String(re.minColumnWidth)+" and "+String(re.maxColumnWidth)+" pixels.");let s=Hn(o);if(a[s]!==void 0)throw new j(t+" names column "+s+" twice.");a[s]=n}return Object.keys(a).length===0?void 0:a}function ts(e){if(!ut(e))throw new j("A sheet workbook must be a JSON object.");if(da(e,Yi,"The workbook"),e.schemaVersion!==void 0&&e.schemaVersion!==1)throw new j("Unsupported sheet schemaVersion "+String(e.schemaVersion)+"; this build reads version "+String(1)+".");let t=e.sheets;if(!Array.isArray(t)||t.length===0)throw new j('A sheet workbook needs a "sheets" array with at least one sheet.');if(t.length>re.maxSheets)throw new j("A workbook holds at most "+String(re.maxSheets)+" sheets.");let a=new Set,r=0,n=0;return{schemaVersion:1,sheets:t.map((s,l)=>{let c="sheets["+String(l)+"]";if(!ut(s))throw new j(c+" must be an object.");da(s,qi,c);let i=Xi(s.name,c+".name");if(a.has(i.toLowerCase()))throw new j('Two sheets are named "'+i+'"; names must be unique.');a.add(i.toLowerCase());let h=s.cells??{};if(!ut(h))throw new j(c+".cells must be an object of cell references to values.");let k={};for(let[y,v]of Object.entries(h)){let D=ca(y);if(D===void 0)throw new j(c+'.cells has an invalid cell reference "'+y+'".');let S=Vn(v,c+".cells."+pa(D.row,D.column));S!==void 0&&(r+=1,S.formula!==void 0&&(n+=1),k[pa(D.row,D.column)]=S)}if(r>re.maxCells)throw new j("A sheet artifact holds at most "+String(re.maxCells)+" cells.");if(n>re.maxFormulaCells)throw new j("A sheet artifact holds at most "+String(re.maxFormulaCells)+" formulas.");let b={},p=Object.keys(k).sort((y,v)=>{let D=ca(y),S=ca(v);return D===void 0||S===void 0?y<v?-1:1:D.row===S.row?D.column-S.column:D.row-S.row});for(let y of p){let v=k[y];v!==void 0&&(b[y]=v)}let u=es(s.columnWidths,c+".columnWidths");return{name:i,cells:b,...u===void 0?{}:{columnWidths:u}}})}}function Wn(e){let t;try{t=JSON.parse(e)}catch{throw new j("The sheet content is not valid JSON. Send one JSON object with schemaVersion and sheets.")}return ts(t)}function Gn(e){let t=0,a=0;for(let r of Object.keys(e.cells)){let n=ca(r);n!==void 0&&(n.row>t&&(t=n.row),n.column+1>a&&(a=n.column+1))}return{rows:t,columns:a}}var Un=require("react"),$n="dsh-artifact-studio.pins";function as(){if(typeof window>"u")return new Set;try{let e=window.localStorage.getItem($n);if(e===null)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(a=>typeof a=="string")):new Set}catch{return new Set}}var ua=as(),Ya=new Set;function rs(e){return Ya.add(e),()=>Ya.delete(e)}function Kn(){return(0,Un.useSyncExternalStore)(rs,()=>ua,()=>ua)}function qn(e){let t=new Set(ua);t.has(e)?t.delete(e):t.add(e),ua=t;try{window.localStorage.setItem($n,JSON.stringify([...t]))}catch{}for(let a of Ya)a()}var ns=`<!doctype html>
49
70
  <html lang="en">
50
71
  <head>
51
72
  <meta charset="utf-8">
@@ -71,10 +92,11 @@ code { font-family: var(--artifact-font-mono); font-size: 12px; }
71
92
  </main>
72
93
  </body>
73
94
  </html>
74
- `,Lo=`# {{title}}
95
+ `,os=`# {{title}}
75
96
 
76
97
  Start writing, or select text and choose Edit with agent.
77
- `,Mo=`<Frame w={720} p={40} bg="#ffffff" flex="col" gap={12}>
98
+ `;function is(e){return JSON.stringify({schemaVersion:1,sheets:[{name:"Sheet1",cells:{A1:{value:e,style:{bold:!0}},A3:"Item",B3:"Amount",A4:"Example",B4:100,B5:"Total",B6:"=SUM(B4:B5)"},columnWidths:{A:180}}]},null,2)+`
99
+ `}var ss=`<Frame w={720} p={40} bg="#ffffff" flex="col" gap={12}>
78
100
  <Text size={13} weight={600} color="#2856c7">DESIGN</Text>
79
101
  <Text size={40} weight={700} color="#16181d">{{title}}</Text>
80
102
  <Text size={16} color="#5b6170">Edit the source, or ask the agent for a change.</Text>
@@ -82,10 +104,24 @@ Start writing, or select text and choose Edit with agent.
82
104
  <Text size={15} weight={600} color="#ffffff">Get started</Text>
83
105
  </Frame>
84
106
  </Frame>
85
- `;function Oo(e){return e.replace(/[&<>"']/g,t=>`&#${t.charCodeAt(0)};`)}function jo(e){return e.replace(/[\\`*_\[\]#]/g,t=>`\\${t}`)}function Fo(e){return e.replace(/[{}<>]/g," ")}function Zr(e,t){return e==="doc"?Lo.replace("{{title}}",jo(t)):e==="design"?Mo.replace("{{title}}",Fo(t)):Po.replace("{{title}}",Oo(t))}var g=require("react/jsx-runtime");function $t(e){return e.kind==="workspace"?"ws:"+e.workspaceId:e.kind}function Ra(e){if(e==="all")return{kind:"all"};if(e==="library")return{kind:"library"};if(e==null||!e.startsWith("ws:"))return;let t=e.slice(3);return t===""?void 0:{kind:"workspace",workspaceId:t}}function tn(e,t,a){return e.scope==="library"?{manifest:e,address:{scope:"library",id:e.id},where:{scope:"library",workspaceId:t},project:null}:a===null?null:{manifest:e,address:{scope:"workspace",workspaceId:a.workspaceId,id:e.id},where:{scope:"workspace",workspaceId:a.workspaceId},project:a.title}}function Bo(e,t){e!==void 0&&(ke(t.manifest.id,t.manifest.title),e(K(t.address)))}function an(e){let t=K(e.address);return e.manifest.scope==="library"?t+"@"+(e.where.workspaceId??""):t}var gt=new Map,Aa=new Map,Ho=2,Gt=new Map,mt=[],Ea=0;function Jr(){for(;Ea<Ho&&mt.length>0;){let e=mt.shift();if(e===void 0)return;Ea+=1,e.start()}}function Vo(e){let t={start:()=>{e().finally(()=>{Ea-=1,Jr()})}};return mt.push(t),Jr(),()=>{let a=mt.indexOf(t);a!==-1&&mt.splice(a,1)}}function _o(e){let t=an(e),a=gt.get(t);if(a!==void 0&&a.version>=e.manifest.version)return Promise.resolve(a);let r=t+":"+e.manifest.version,n=Aa.get(r);if(n!==void 0)return n;let o=U.get(e.where,e.manifest.id).then(l=>{let s={version:l.version,content:l.content,designCss:l.designCss},y=gt.get(t);return(y===void 0||y.version<=s.version)&&(gt.size>=60&&gt.clear(),gt.set(t,s)),s}).finally(()=>{Aa.delete(r)});return Aa.set(r,o),o}function Uo(e){if(typeof DOMParser>"u")return e.replace(/<script\b[^>]*>[\s\S]*?<\/script\s*>/gi,"").replace(/<script\b[^>]*\/?>/gi,"").replace(/\son[a-z]+\s*=\s*"[^"]*"/gi,"");let t=new DOMParser().parseFromString(e,"text/html");for(let a of t.querySelectorAll("script, iframe, object, embed, base"))a.remove();for(let a of t.querySelectorAll("*"))for(let r of[...a.attributes]){let n=r.name.toLowerCase();(n.startsWith("on")||n==="srcdoc")&&a.removeAttribute(r.name)}return t.documentElement.outerHTML}function Wo(e){let t=e.replace(/\x60{3}[\s\S]*?\x60{3}/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/<[^>]+>/g," ").replace(/[#>*_\x60~]/g," ").replace(/\s+/g," ").trim();return t.length>220?t.slice(0,220).trimEnd()+"...":t}function Go({t:e,view:t}){let[a,r]=(0,j.useState)(null),[n,o]=(0,j.useState)(!1),[l,s]=(0,j.useState)(typeof IntersectionObserver>"u"),[y,c]=(0,j.useState)(null),[h,v]=(0,j.useState)(null),x=(0,j.useRef)(null),d=Qe(),p=an(t),u=t.manifest.title,m=t.manifest.type,L=t.manifest.version;(0,j.useEffect)(()=>{if(l)return;let D=x.current;if(D===null)return;let H=new IntersectionObserver(C=>{C.some(F=>F.isIntersecting)&&(s(!0),H.disconnect())},{rootMargin:"140px"});return H.observe(D),()=>H.disconnect()},[l]),(0,j.useEffect)(()=>{if(!l||m!=="design")return;let D=p+"@"+L,H=Gt.get(D);if(H!==void 0){v(H),o(!1);return}let C=new AbortController,F=!1,_=Vo(async()=>{try{let P=await U.preview(t.where,t.manifest.id,L,C.signal);if(F)return;let A="data:"+P.mediaType+";base64,"+P.data;Gt.size>=40&&Gt.clear(),Gt.set(D,A),v(A),o(!1)}catch{F||o(!0)}});return()=>{F=!0,C.abort(),_()}},[l,p,L,m]),(0,j.useEffect)(()=>{if(!l||m==="design")return;let D=!1;return _o(t).then(H=>{!D&&H.version===L&&(r(H),o(!1))}).catch(()=>{D||o(!0)}),()=>{D=!0}},[l,p,L]),(0,j.useEffect)(()=>{if(m!=="page"||a===null){c(null);return}let D=URL.createObjectURL(new Blob([Mt(Uo(a.content),a.designCss,u,d?"dark":"light")],{type:"text/html"}));return c(D),()=>URL.revokeObjectURL(D)},[a,m,u,d]);let S=m==="page"?(0,g.jsx)(ge,{}):m==="doc"?(0,g.jsx)(Ne,{}):(0,g.jsx)(Be,{});if(n)return(0,g.jsx)("span",{className:"art-cover",ref:x,"aria-hidden":"true",children:(0,g.jsx)("span",{className:"art-cover-fallback",children:S})});if(m==="design")return(0,g.jsx)("span",{className:"art-cover",ref:x,"aria-hidden":"true",children:h===null?(0,g.jsx)("span",{className:"art-cover-fallback",children:S}):(0,g.jsx)("img",{className:"art-cover-design",src:h,alt:""})});if(m==="page")return(0,g.jsx)("span",{className:"art-cover",ref:x,"aria-hidden":"true",children:y===null?(0,g.jsx)("span",{className:"art-cover-fallback",children:S}):(0,g.jsx)("span",{className:"art-cover-frame-wrap",children:(0,g.jsx)("iframe",{className:"art-cover-frame",src:y,sandbox:"",title:e("gallery.coverTitle",{title:u}),tabIndex:-1,loading:"lazy",referrerPolicy:"no-referrer"})})});let V=a===null?"":Wo(a.content);return(0,g.jsx)("span",{className:"art-cover",ref:x,"aria-hidden":"true",children:V===""?(0,g.jsx)("span",{className:"art-cover-fallback",children:S}):(0,g.jsxs)("span",{className:"art-cover-doc",children:[(0,g.jsx)("span",{className:"art-cover-doc-title",children:u}),(0,g.jsx)("span",{className:"art-cover-doc-text",children:V})]})})}function $o({t:e,view:t,pinned:a,onOpen:r,showProject:n}){let o=K(t.address),l=e(a?"gallery.unpin":"gallery.pin",{title:t.manifest.title}),s=t.manifest.scope==="library"?" \xB7 "+e("scope.library"):n&&t.project!==null?" \xB7 "+t.project:"";return(0,g.jsxs)("li",{className:"art-tile",children:[(0,g.jsxs)("button",{type:"button",className:"art-tile-open",onClick:()=>r(t),children:[(0,g.jsx)(Go,{t:e,view:t}),(0,g.jsxs)("span",{className:"art-tile-body",children:[(0,g.jsx)("span",{className:"art-tile-title",title:t.manifest.title,children:t.manifest.title}),(0,g.jsxs)("span",{className:"art-tile-sub",children:[e(`type.${t.manifest.type}`)," \xB7 ",e("gallery.updated",{time:Ot(e,t.manifest.updatedAt)})," \xB7 ",e("gallery.version",{version:t.manifest.version}),s]})]})]}),(0,g.jsx)(z.Tooltip,{label:l,side:"left",portal:!0,children:(0,g.jsx)("button",{type:"button",className:"art-tile-pin","aria-label":l,"aria-pressed":a,onClick:()=>Xr(o),children:a?(0,g.jsx)(z.IconPinFillRegular,{size:14}):(0,g.jsx)(z.IconPinOutlineRegular,{size:14})})})]})}function en({t:e,heading:t,views:a,pinned:r,onOpen:n,showProject:o}){let l=(0,j.useId)();return a.length===0?null:(0,g.jsxs)("section",{className:"art-section","aria-labelledby":l,children:[(0,g.jsxs)("div",{className:"art-section-head",children:[(0,g.jsx)("h2",{className:"art-section-title",id:l,children:t}),(0,g.jsx)("span",{className:"art-section-hint",children:e("gallery.count",{count:a.length})})]}),(0,g.jsx)("ul",{className:"art-grid",children:a.map(s=>(0,g.jsx)($o,{t:e,view:s,pinned:r.has(K(s.address)),onOpen:n,showProject:o},K(s.address)))})]})}function qo(e,t,a){let r={where:{scope:"library",workspaceId:a},project:null};if(e.kind==="library")return[r];if(e.kind==="workspace"){let n=t.find(o=>o.workspaceId===e.workspaceId);return n===void 0?[]:[{where:{scope:"workspace",workspaceId:n.workspaceId},project:n}]}return[...t.map(n=>({where:{scope:"workspace",workspaceId:n.workspaceId},project:n})),r]}var Ko=12;function Yo(e,t,a,r,n,o){let[l,s]=(0,j.useState)(1),[y,c]=(0,j.useState)({key:"",state:{status:"loading"}}),h=t.map(p=>p.workspaceId+":"+p.title).join(","),v=$t(e)+":"+h+":"+(a??"")+":"+r+":"+(n??""),x=e.kind==="all",d=y.key===v?y.state:{status:"loading"};return(0,j.useEffect)(()=>s(1),[v,r]),(0,j.useEffect)(()=>{let p=qo(e,t,a);if(p.length===0){c({key:v,state:{status:"ready",items:[],hasMore:!1,truncated:!1,failed:0}});return}let u=new AbortController,m=setTimeout(async()=>{let L=x?Ko:void 0,S=await Promise.all(p.map(async _=>{let P=[];for(let A=0;A<l;A+=1)try{let $=await U.list(_.where,{query:r,type:n,offset:A*(L??50),...L===void 0?{}:{limit:L}},u.signal);if(P.push($),!$.hasMore)break}catch($){return{loaded:P,failed:!0,code:ee($)}}return{loaded:P,failed:!1}}));if(u.signal.aborted)return;let V=[],D=!1,H=!1,C=0,F;if(S.forEach((_,P)=>{let A=p[P];if(A===void 0)return;_.failed&&(C+=1,F===void 0&&(F=_.code));let $=_.loaded[_.loaded.length-1];if($!==void 0){$.hasMore&&(D=!0),$.truncated&&(H=!0);for(let O of _.loaded)for(let Le of O.items){let E=tn(Le,a,A.project);E!==null&&V.push(E)}}}),C===p.length){c({key:v,state:{status:"failed",code:F}});return}V.sort((_,P)=>Date.parse(P.manifest.updatedAt)-Date.parse(_.manifest.updatedAt)),c({key:v,state:{status:"ready",items:V,hasMore:D,truncated:H,failed:C}})},r===""?0:180);return()=>{u.abort(),clearTimeout(m)}},[v,o,l]),{state:d,more:()=>s(p=>p+1)}}function Qo({t:e,variant:t}){let a=t==="all"?"empty.allTitle":t==="library"?"empty.libraryTitle":"empty.workspaceTitle",r=t==="all"?"empty.allHint":t==="library"?"empty.libraryHint":"empty.workspaceHint",n=async o=>{try{await navigator.clipboard.writeText(o),Z(e("gallery.promptCopied"))}catch{Z(e("action.copyFailed"))}};return(0,g.jsxs)("div",{className:"art-empty",children:[(0,g.jsx)("p",{className:"art-empty-title",children:e(a)}),(0,g.jsx)("p",{className:"art-empty-hint",children:e(r)}),(0,g.jsx)("ul",{className:"art-starters",children:Ca.map(o=>(0,g.jsxs)("li",{className:"art-starter",children:[(0,g.jsxs)("span",{className:"art-starter-text",children:[(0,g.jsx)("span",{className:"art-starter-name",children:e(`prompt.${o}`)}),(0,g.jsx)("span",{className:"art-starter-hint",children:e(`prompt.${o}Text`)})]}),(0,g.jsx)(z.Tooltip,{label:e("gallery.copyPrompt"),side:"left",portal:!0,children:(0,g.jsx)(z.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.copyPromptNamed",{name:e(`prompt.${o}`)}),onClick:()=>void n(e(`prompt.${o}Text`)),children:(0,g.jsx)(z.IconCopyOutlineRegular,{size:14})})})]},o))})]})}function Da({t:e,projects:t,scope:a,contextWorkspaceId:r,onScopeChange:n,scopeLocked:o=!1,open:l}){let[s,y]=(0,j.useState)(""),[c,h]=(0,j.useState)(void 0),[v,x]=(0,j.useState)("list"),[d,p]=(0,j.useState)(!1),[u,m]=(0,j.useState)(0),L=Dt()+u,S=Qr(),V=Yo(a,t,r,s,c,L),D=(0,j.useId)(),H=t.find(N=>N.workspaceId===r)??null,C=a.kind==="library"?null:r,F=C===null?null:t.find(N=>N.workspaceId===C)??null,_=a.kind==="library"||H===null?"library":"workspace",P=_==="library"?e("scope.library"):H?.title??e("scope.library"),A=V.state,$=A.status==="ready"?A.items:[],O=(0,j.useCallback)(N=>Bo(l,N),[l]),Le=(0,j.useCallback)(async(N,Q)=>{if(Q==="workspace"&&r===null)return;let _e=e(N==="page"?"create.untitledPage":N==="doc"?"create.untitledDoc":"create.untitledDesign");try{let{manifest:Ue}=await U.create({scope:Q,workspaceId:r},N,_e,Zr(N,_e));Te();let Kt=Q==="workspace"?t.find(Je=>Je.workspaceId===r)??null:null,yt=tn(Ue,r,Kt);yt!==null&&O(yt)}catch(Ue){Z(e(te(ee(Ue))))}},[r,t,e,O]),E=$.filter(N=>S.has(K(N.address))),q=$.filter(N=>!S.has(K(N.address)));return(0,g.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"",children:[(0,g.jsxs)("header",{className:"art-header",children:[(0,g.jsxs)("div",{className:"art-heading",children:[v==="design"?(0,g.jsx)(z.Tooltip,{label:e("panel"),side:"bottom",portal:!0,children:(0,g.jsx)(z.Button,{size:"sm",className:"art-icon-button","aria-label":e("panel"),onClick:()=>x("list"),children:(0,g.jsx)(z.IconChevronLeftOutlineRegular,{size:16})})}):null,(0,g.jsx)("span",{className:"art-title",children:e(v==="design"?"design.title":"panel")})]}),v==="list"?o?(0,g.jsx)("span",{className:"art-scope-fixed",title:H?.title??e("scope.workspace"),children:H?.title??e("scope.workspace")}):(0,g.jsxs)("label",{className:"art-workspace",children:[(0,g.jsx)("span",{className:"art-workspace-label",children:e("scope.label")}),(0,g.jsxs)("select",{className:"art-workspace-select","aria-label":e("scope.label"),value:$t(a),onChange:N=>{let Q=Ra(N.target.value);Q!==void 0&&n?.(Q)},children:[(0,g.jsx)("option",{value:"all",children:e("scope.all")}),t.map(N=>(0,g.jsx)("option",{value:"ws:"+N.workspaceId,children:N.title},N.workspaceId)),(0,g.jsx)("option",{value:"library",children:e("scope.library")})]})]}):null,v==="list"?(0,g.jsxs)("div",{className:"art-actions",children:[(0,g.jsx)(z.Tooltip,{label:e("gallery.design"),side:"bottom",portal:!0,children:(0,g.jsx)(z.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.design"),onClick:()=>x("design"),children:(0,g.jsx)(lr,{size:16})})}),(0,g.jsx)(z.Tooltip,{label:e("gallery.refresh"),side:"bottom",portal:!0,children:(0,g.jsx)(z.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.refresh"),onClick:()=>m(N=>N+1),children:(0,g.jsx)(z.IconRefreshOutlineRegular,{size:16})})}),(0,g.jsx)(z.Menu,{open:d,onClose:()=>p(!1),align:"end",portal:!0,autoFocus:!0,items:[{id:"page",label:e("gallery.newPage")+" \xB7 "+P,icon:(0,g.jsx)(ge,{size:14})},{id:"doc",label:e("gallery.newDoc")+" \xB7 "+P,icon:(0,g.jsx)(Ne,{size:14})},{id:"design",label:e("gallery.newDesign")+" \xB7 "+P,icon:(0,g.jsx)(Be,{size:14})}],onSelect:N=>{p(!1),Le(N==="doc"?"doc":N==="design"?"design":"page",_)},anchor:(0,g.jsx)(z.Button,{size:"sm",variant:"outline",icon:(0,g.jsx)(z.IconPlusOutlineRegular,{size:14}),"aria-haspopup":"menu","aria-expanded":d,onClick:()=>p(N=>!N),children:e("gallery.create")})})]}):null]}),v==="design"?(0,g.jsx)("div",{className:"art-scroll",children:(0,g.jsx)(qr,{t:e,workspaceId:C,workspaceTitle:F?.title})}):(0,g.jsx)("div",{className:"art-scroll",children:(0,g.jsxs)("div",{className:"art-gallery",children:[(0,g.jsxs)("div",{className:"art-toolbar",children:[(0,g.jsx)("input",{className:"art-search",type:"search","aria-label":e("gallery.searchLabel"),placeholder:e("gallery.search"),value:s,onChange:N=>y(N.target.value)}),(0,g.jsx)(z.SegmentedControl,{id:D,className:"art-segment",label:e("filter.type"),value:c??"all",options:[{value:"all",label:e("type.all")},{value:"page",label:e("type.page")},{value:"doc",label:e("type.doc")},{value:"design",label:e("type.design")}],onChange:N=>h(N==="all"?void 0:N)})]}),(0,g.jsxs)("div",{role:"tabpanel",id:D+"-"+(c??"all")+"-panel","aria-labelledby":D+"-"+(c??"all"),children:[A.status==="loading"?(0,g.jsx)("p",{className:"art-note",children:e("empty.loading")}):null,A.status==="failed"?(0,g.jsxs)("div",{className:"art-empty",role:"alert",children:[(0,g.jsx)("p",{className:"art-empty-title",children:e(te(A.code))}),(0,g.jsx)(z.Button,{size:"sm",variant:"outline",onClick:()=>m(N=>N+1),children:e("action.retry")})]}):null,A.status==="ready"&&A.failed>0?(0,g.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"status",children:[(0,g.jsx)("span",{children:e("gallery.failedProjects")}),(0,g.jsx)(z.Button,{size:"sm",variant:"outline",onClick:()=>m(N=>N+1),children:e("action.retry")})]}):null,A.status==="ready"&&A.items.length===0&&A.failed===0?s!==""?(0,g.jsx)("p",{className:"art-note",children:e("empty.noMatch")}):c!==void 0?(0,g.jsx)("p",{className:"art-note",children:e("empty.typeMatch",{type:e(`type.${c}`)})}):(0,g.jsx)(Qo,{t:e,variant:a.kind}):null,A.status==="ready"&&A.items.length>0?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(en,{t:e,heading:e("gallery.pinned"),views:E,pinned:S,onOpen:O,showProject:a.kind==="all"}),q.length===0?(0,g.jsx)("p",{className:"art-note",children:e("gallery.allPinned")}):(0,g.jsx)(en,{t:e,heading:e("gallery.recent"),views:q,pinned:S,onOpen:O,showProject:a.kind==="all"}),A.hasMore?(0,g.jsx)("div",{className:"art-gallery-more",children:(0,g.jsx)(z.Button,{size:"sm",variant:"outline",onClick:V.more,children:e("gallery.more")})}):null,A.truncated?(0,g.jsx)("p",{className:"art-note",children:e("gallery.truncated")}):null]}):null]})]})})]})}var re=require("react/jsx-runtime"),rn="dsh-artifact-studio.panel.scope",nn="dsh-artifact-studio.panel.workspace";function on({t:e,workspaces:t}){let a=(0,G.useCallback)(m=>t.subscribe(m),[t]),r=(0,G.useCallback)(()=>t.getSnapshot(),[t]),o=(0,G.useSyncExternalStore)(a,r,r).items,l=(0,G.useMemo)(()=>o.map(({workspaceId:m,title:L})=>({workspaceId:m,title:L})),[o]),[s,y]=(0,G.useState)(()=>Ra(window.localStorage.getItem(rn))??{kind:"all"}),[c,h]=(0,G.useState)(()=>{let m=window.localStorage.getItem(nn);return m===null||m===""?null:m}),[v,x]=(0,G.useState)(null),d=s.kind==="workspace"?o.find(m=>m.workspaceId===s.workspaceId):void 0,p=d!==void 0?d.workspaceId:c!==null&&o.some(m=>m.workspaceId===c)?c:o[0]?.workspaceId??null;(0,G.useEffect)(()=>{if(o.length!==0){if(s.kind==="workspace"&&!o.some(m=>m.workspaceId===s.workspaceId)){y({kind:"all"});return}p!==null&&p!==c&&h(p)}},[o,s,p,c]),(0,G.useEffect)(()=>{window.localStorage.setItem(rn,$t(s))},[s]),(0,G.useEffect)(()=>{c!==null&&window.localStorage.setItem(nn,c)},[c]);let u=(0,G.useMemo)(()=>v===null?void 0:we(v),[v]);return(0,re.jsxs)("div",{className:"art-panel-stack",children:[(0,re.jsx)("div",{className:"art-panel-region",hidden:u!==void 0,children:(0,re.jsx)(Da,{t:e,projects:l,scope:s,contextWorkspaceId:p,onScopeChange:y,open:m=>x(m)})}),u===void 0?null:(0,re.jsx)("div",{className:"art-panel-region",children:(0,re.jsx)(ka,{t:e,address:u,workspaceName:o.find(m=>u.scope==="workspace"&&m.workspaceId===u.workspaceId)?.title,onBack:()=>x(null)})})]})}function sn({t:e,sessionId:t,useSessions:a,useWorkspaces:r,inputActions:n}){let l=Ht({sessionId:t,useSessions:a,useWorkspaces:r}).workspaceId,s=r(x=>x.items.find(d=>d.workspaceId===l)?.title),[y,c]=(0,G.useState)(null);(0,G.useEffect)(()=>{c(null)},[l]);let h=(0,G.useMemo)(()=>l===null?[]:[{workspaceId:l,title:s??l}],[l,s]),v=(0,G.useMemo)(()=>y===null?void 0:we(y),[y]);return l===null?(0,re.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",children:(0,re.jsx)("div",{className:"art-center",role:"status",children:(0,re.jsx)("p",{className:"art-center-hint",children:e("empty.noWorkspace")})})}):(0,re.jsxs)("div",{className:"art-panel-stack",children:[(0,re.jsx)("div",{className:"art-panel-region",hidden:v!==void 0,children:(0,re.jsx)(Da,{t:e,projects:h,scope:{kind:"workspace",workspaceId:l},contextWorkspaceId:l,scopeLocked:!0,open:x=>c(x)})}),v===void 0?null:(0,re.jsx)("div",{className:"art-panel-region",children:(0,re.jsx)(ka,{t:e,address:v,workspaceName:s,onBack:()=>c(null),...n===void 0?{}:{inputActions:n}})})]})}var ln="dsh-artifact-studio/styles",Xo=Er.split(`
107
+ `;function ls(e){return e.replace(/[&<>"']/g,t=>`&#${t.charCodeAt(0)};`)}function cs(e){return e.replace(/[\\`*_\[\]#]/g,t=>`\\${t}`)}function ds(e){return e.replace(/[{}<>]/g," ")}function Yn(e,t){return e==="doc"?os.replace("{{title}}",cs(t)):e==="design"?ss.replace("{{title}}",ds(t)):e==="sheet"?is(t):ns.replace("{{title}}",ls(t))}var m=require("react/jsx-runtime");function ma(e){return e.kind==="workspace"?"ws:"+e.workspaceId:e.kind}function Ja(e){if(e==="all")return{kind:"all"};if(e==="library")return{kind:"library"};if(e==null||!e.startsWith("ws:"))return;let t=e.slice(3);return t===""?void 0:{kind:"workspace",workspaceId:t}}function Jn(e,t,a){return e.scope==="library"?{manifest:e,address:{scope:"library",id:e.id},where:{scope:"library",workspaceId:t},project:null}:a===null?null:{manifest:e,address:{scope:"workspace",workspaceId:a.workspaceId,id:e.id},where:{scope:"workspace",workspaceId:a.workspaceId},project:a.title}}function ps(e,t){e!==void 0&&(Me(t.manifest.id,t.manifest.title),e(ee(t.address)))}function Zn(e){let t=ee(e.address);return e.manifest.scope==="library"?t+"@"+(e.where.workspaceId??""):t}var It=new Map,Xa=new Map,us=2,fa=new Map,Rt=[],Qa=0;function Xn(){for(;Qa<us&&Rt.length>0;){let e=Rt.shift();if(e===void 0)return;Qa+=1,e.start()}}function fs(e){let t={start:()=>{e().finally(()=>{Qa-=1,Xn()})}};return Rt.push(t),Xn(),()=>{let a=Rt.indexOf(t);a!==-1&&Rt.splice(a,1)}}function ms(e){let t=Zn(e),a=It.get(t);if(a!==void 0&&a.version>=e.manifest.version)return Promise.resolve(a);let r=t+":"+e.manifest.version,n=Xa.get(r);if(n!==void 0)return n;let o=B.get(e.where,e.manifest.id).then(s=>{let l={version:s.version,content:s.content,designCss:s.designCss},c=It.get(t);return(c===void 0||c.version<=l.version)&&(It.size>=60&&It.clear(),It.set(t,l)),l}).finally(()=>{Xa.delete(r)});return Xa.set(r,o),o}function gs(e){if(typeof DOMParser>"u")return e.replace(/<script\b[^>]*>[\s\S]*?<\/script\s*>/gi,"").replace(/<script\b[^>]*\/?>/gi,"").replace(/\son[a-z]+\s*=\s*"[^"]*"/gi,"");let t=new DOMParser().parseFromString(e,"text/html");for(let a of t.querySelectorAll("script, iframe, object, embed, base"))a.remove();for(let a of t.querySelectorAll("*"))for(let r of[...a.attributes]){let n=r.name.toLowerCase();(n.startsWith("on")||n==="srcdoc")&&a.removeAttribute(r.name)}return"<!doctype html>"+t.documentElement.outerHTML}function hs(e){let t=e.replace(/\x60{3}[\s\S]*?\x60{3}/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/<[^>]+>/g," ").replace(/[#>*_\x60~]/g," ").replace(/\s+/g," ").trim();return t.length>220?t.slice(0,220).trimEnd()+"...":t}function vs(e){try{let a=Wn(e).sheets[0];if(a===void 0)return null;let r=Gn(a),n=Math.min(5,Math.max(1,r.rows)),o=Math.min(4,Math.max(1,r.columns)),s=[];for(let l=1;l<=n;l+=1){let c=[];for(let i=0;i<o;i+=1){let h=a.cells[pa(l,i)];h===void 0?c.push(""):h.formula!==void 0?c.push(h.formula):h.value===void 0?c.push(""):c.push(String(h.value))}s.push(c)}return{name:a.name,rows:s}}catch{return null}}function bs({t:e,view:t}){let[a,r]=(0,$.useState)(null),[n,o]=(0,$.useState)(!1),[s,l]=(0,$.useState)(typeof IntersectionObserver>"u"),[c,i]=(0,$.useState)(null),[h,k]=(0,$.useState)(null),b=(0,$.useRef)(null),p=lt(),u=Zn(t),y=t.manifest.title,v=t.manifest.type,D=t.manifest.version;(0,$.useEffect)(()=>{if(s)return;let E=b.current;if(E===null)return;let F=new IntersectionObserver(z=>{z.some(W=>W.isIntersecting)&&(l(!0),F.disconnect())},{rootMargin:"140px"});return F.observe(E),()=>F.disconnect()},[s]),(0,$.useEffect)(()=>{if(!s||v!=="design")return;let E=u+"@"+D,F=fa.get(E);if(F!==void 0){k(F),o(!1);return}let z=new AbortController,W=!1,U=fs(async()=>{try{let H=await B.preview(t.where,t.manifest.id,D,z.signal);if(W)return;let M="data:"+H.mediaType+";base64,"+H.data;fa.size>=40&&fa.clear(),fa.set(E,M),k(M),o(!1)}catch{W||o(!0)}});return()=>{W=!0,z.abort(),U()}},[s,u,D,v]),(0,$.useEffect)(()=>{if(!s||v==="design")return;let E=!1;return ms(t).then(F=>{!E&&F.version===D&&(r(F),o(!1))}).catch(()=>{E||o(!0)}),()=>{E=!0}},[s,u,D]),(0,$.useEffect)(()=>{if(v!=="page"||a===null){i(null);return}let E=URL.createObjectURL(new Blob([gs(ta(a.content,a.designCss,y,p?"dark":"light"))],{type:"text/html"}));return i(E),()=>URL.revokeObjectURL(E)},[a,v,y,p]);let S=v==="page"?(0,m.jsx)(ze,{}):v==="doc"?(0,m.jsx)(Oe,{}):v==="sheet"?(0,m.jsx)(qe,{}):(0,m.jsx)(Ye,{});if(n)return(0,m.jsx)("span",{className:"art-cover",ref:b,"aria-hidden":"true",children:(0,m.jsx)("span",{className:"art-cover-fallback",children:S})});if(v==="design")return(0,m.jsx)("span",{className:"art-cover",ref:b,"aria-hidden":"true",children:h===null?(0,m.jsx)("span",{className:"art-cover-fallback",children:S}):(0,m.jsx)("img",{className:"art-cover-design",src:h,alt:""})});if(v==="page")return(0,m.jsx)("span",{className:"art-cover",ref:b,"aria-hidden":"true",children:c===null?(0,m.jsx)("span",{className:"art-cover-fallback",children:S}):(0,m.jsx)("span",{className:"art-cover-frame-wrap",children:(0,m.jsx)("iframe",{className:"art-cover-frame",src:c,sandbox:"",title:e("gallery.coverTitle",{title:y}),tabIndex:-1,loading:"lazy",referrerPolicy:"no-referrer"})})});if(v==="sheet"){let E=a===null?null:vs(a.content);return(0,m.jsx)("span",{className:"art-cover",ref:b,"aria-hidden":"true",children:E===null?(0,m.jsx)("span",{className:"art-cover-fallback",children:S}):(0,m.jsxs)("span",{className:"art-cover-sheet",children:[(0,m.jsx)("span",{className:"art-cover-sheet-name",children:E.name}),(0,m.jsx)("span",{className:"art-cover-sheet-table",children:E.rows.map((F,z)=>(0,m.jsxs)("span",{className:"art-cover-sheet-row",children:[(0,m.jsx)("span",{className:"art-cover-sheet-index",children:z+1}),F.map((W,U)=>(0,m.jsx)("span",{className:"art-cover-sheet-cell",children:W},U))]},z))})]})})}let C=a===null?"":hs(a.content);return(0,m.jsx)("span",{className:"art-cover",ref:b,"aria-hidden":"true",children:C===""?(0,m.jsx)("span",{className:"art-cover-fallback",children:S}):(0,m.jsxs)("span",{className:"art-cover-doc",children:[(0,m.jsx)("span",{className:"art-cover-doc-title",children:y}),(0,m.jsx)("span",{className:"art-cover-doc-text",children:C})]})})}function ys({t:e,view:t,pinned:a,onOpen:r,showProject:n}){let o=ee(t.address),s=e(a?"gallery.unpin":"gallery.pin",{title:t.manifest.title}),l=t.manifest.scope==="library"?" \xB7 "+e("scope.library"):n&&t.project!==null?" \xB7 "+t.project:"";return(0,m.jsxs)("li",{className:"art-tile",children:[(0,m.jsxs)("button",{type:"button",className:"art-tile-open",onClick:()=>r(t),children:[(0,m.jsx)(bs,{t:e,view:t}),(0,m.jsxs)("span",{className:"art-tile-body",children:[(0,m.jsx)("span",{className:"art-tile-title",title:t.manifest.title,children:t.manifest.title}),(0,m.jsxs)("span",{className:"art-tile-sub",children:[e(`type.${t.manifest.type}`)," \xB7 ",e("gallery.updated",{time:aa(e,t.manifest.updatedAt)})," \xB7 ",e("gallery.version",{version:t.manifest.version}),l]})]})]}),(0,m.jsx)(O.Tooltip,{label:s,side:"left",portal:!0,children:(0,m.jsx)(O.Button,{size:"sm",className:"art-tile-pin","aria-label":s,"aria-pressed":a,onClick:()=>qn(o),children:a?(0,m.jsx)(O.IconPinFillRegular,{size:14}):(0,m.jsx)(O.IconPinOutlineRegular,{size:14})})})]})}function Qn({t:e,heading:t,views:a,pinned:r,onOpen:n,showProject:o}){let s=(0,$.useId)();return a.length===0?null:(0,m.jsxs)("section",{className:"art-section","aria-labelledby":s,children:[(0,m.jsxs)("div",{className:"art-section-head",children:[(0,m.jsx)("h2",{className:"art-section-title",id:s,children:t}),(0,m.jsx)("span",{className:"art-section-hint",children:e("gallery.count",{count:a.length})})]}),(0,m.jsx)("ul",{className:"art-grid",children:a.map(l=>(0,m.jsx)(ys,{t:e,view:l,pinned:r.has(ee(l.address)),onOpen:n,showProject:o},ee(l.address)))})]})}function ws(e,t,a){let r={where:{scope:"library",workspaceId:a},project:null};if(e.kind==="library")return[r];if(e.kind==="workspace"){let n=t.find(o=>o.workspaceId===e.workspaceId);return n===void 0?[]:[{where:{scope:"workspace",workspaceId:n.workspaceId},project:n}]}return[...t.map(n=>({where:{scope:"workspace",workspaceId:n.workspaceId},project:n})),r]}var xs=12;function ks(e,t,a,r,n,o){let[s,l]=(0,$.useState)(1),[c,i]=(0,$.useState)({key:"",state:{status:"loading"}}),h=t.map(u=>u.workspaceId+":"+u.title).join(","),k=ma(e)+":"+h+":"+(a??"")+":"+r+":"+(n??""),b=e.kind==="all",p=c.key===k?c.state:{status:"loading"};return(0,$.useEffect)(()=>l(1),[k,r]),(0,$.useEffect)(()=>{let u=ws(e,t,a);if(u.length===0){i({key:k,state:{status:"ready",items:[],hasMore:!1,truncated:!1,failed:0}});return}let y=new AbortController,v=setTimeout(async()=>{let D=b?xs:void 0,S=await Promise.all(u.map(async U=>{let H=[];for(let M=0;M<s;M+=1)try{let x=await B.list(U.where,{query:r,type:n,offset:M*(D??50),...D===void 0?{}:{limit:D}},y.signal);if(H.push(x),!x.hasMore)break}catch(x){return{loaded:H,failed:!0,code:Y(x)}}return{loaded:H,failed:!1}}));if(y.signal.aborted)return;let C=[],E=!1,F=!1,z=0,W;if(S.forEach((U,H)=>{let M=u[H];if(M===void 0)return;U.failed&&(z+=1,W===void 0&&(W=U.code));let x=U.loaded[U.loaded.length-1];if(x!==void 0){x.hasMore&&(E=!0),x.truncated&&(F=!0);for(let A of U.loaded)for(let Q of A.items){let L=Jn(Q,a,M.project);L!==null&&C.push(L)}}}),z===u.length){i({key:k,state:{status:"failed",code:W}});return}C.sort((U,H)=>Date.parse(H.manifest.updatedAt)-Date.parse(U.manifest.updatedAt)),i({key:k,state:{status:"ready",items:C,hasMore:E,truncated:F,failed:z}})},r===""?0:180);return()=>{y.abort(),clearTimeout(v)}},[k,o,s]),{state:p,more:()=>l(u=>u+1)}}function Ss({t:e,variant:t}){let a=t==="all"?"empty.allTitle":t==="library"?"empty.libraryTitle":"empty.workspaceTitle",r=t==="all"?"empty.allHint":t==="library"?"empty.libraryHint":"empty.workspaceHint",n=async o=>{try{await navigator.clipboard.writeText(o),le(e("gallery.promptCopied"))}catch{le(e("action.copyFailed"))}};return(0,m.jsxs)("div",{className:"art-empty",children:[(0,m.jsx)("p",{className:"art-empty-title",children:e(a)}),(0,m.jsx)("p",{className:"art-empty-hint",children:e(r)}),(0,m.jsx)("ul",{className:"art-starters",children:qa.map(o=>(0,m.jsxs)("li",{className:"art-starter",children:[(0,m.jsxs)("span",{className:"art-starter-text",children:[(0,m.jsx)("span",{className:"art-starter-name",children:e(`prompt.${o}`)}),(0,m.jsx)("span",{className:"art-starter-hint",children:e(`prompt.${o}Text`)})]}),(0,m.jsx)(O.Tooltip,{label:e("gallery.copyPrompt"),side:"left",portal:!0,children:(0,m.jsx)(O.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.copyPromptNamed",{name:e(`prompt.${o}`)}),onClick:()=>void n(e(`prompt.${o}Text`)),children:(0,m.jsx)(O.IconCopyOutlineRegular,{size:14})})})]},o))})]})}function Za({t:e,projects:t,scope:a,contextWorkspaceId:r,onScopeChange:n,scopeLocked:o=!1,open:s}){let[l,c]=(0,$.useState)(""),[i,h]=(0,$.useState)(void 0),[k,b]=(0,$.useState)("list"),[p,u]=(0,$.useState)(!1),[y,v]=(0,$.useState)(0),D=Yt()+y,S=Kn(),C=ks(a,t,r,l,i,D),E=(0,$.useId)(),F=t.find(I=>I.workspaceId===r)??null,z=a.kind==="library"?null:r,W=z===null?null:t.find(I=>I.workspaceId===z)??null,U=a.kind==="library"||F===null?"library":"workspace",H=U==="library"?e("scope.library"):F?.title??e("scope.library"),M=C.state,x=M.status==="ready"?M.items:[],A=(0,$.useCallback)(I=>ps(s,I),[s]),Q=(0,$.useCallback)(async(I,J)=>{if(J==="workspace"&&r===null)return;let Ze=e(I==="page"?"create.untitledPage":I==="doc"?"create.untitledDoc":I==="sheet"?"create.untitledSheet":"create.untitledDesign");try{let{manifest:et}=await B.create({scope:J,workspaceId:r},I,Ze,Yn(I,Ze));Ne();let ha=J==="workspace"?t.find(va=>va.workspaceId===r)??null:null,At=Jn(et,r,ha);At!==null&&A(At)}catch(et){le(e(X(Y(et))))}},[r,t,e,A]),L=x.filter(I=>S.has(ee(I.address))),q=x.filter(I=>!S.has(ee(I.address)));return(0,m.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"",children:[(0,m.jsxs)("header",{className:"art-header",children:[(0,m.jsxs)("div",{className:"art-heading",children:[k==="design"?(0,m.jsx)(O.Tooltip,{label:e("panel"),side:"bottom",portal:!0,children:(0,m.jsx)(O.Button,{size:"sm",className:"art-icon-button","aria-label":e("panel"),onClick:()=>b("list"),children:(0,m.jsx)(O.IconChevronLeftOutlineRegular,{size:16})})}):null,(0,m.jsx)("span",{className:"art-title",children:e(k==="design"?"design.title":"panel")})]}),k==="list"?o?(0,m.jsx)("span",{className:"art-scope-fixed",title:F?.title??e("scope.workspace"),children:F?.title??e("scope.workspace")}):(0,m.jsxs)("label",{className:"art-workspace",children:[(0,m.jsx)("span",{className:"art-workspace-label",children:e("scope.label")}),(0,m.jsxs)("select",{className:"art-select art-workspace-select","aria-label":e("scope.label"),value:ma(a),onChange:I=>{let J=Ja(I.target.value);J!==void 0&&n?.(J)},children:[(0,m.jsx)("option",{value:"all",children:e("scope.all")}),t.map(I=>(0,m.jsx)("option",{value:"ws:"+I.workspaceId,children:I.title},I.workspaceId)),(0,m.jsx)("option",{value:"library",children:e("scope.library")})]})]}):null,k==="list"?(0,m.jsxs)("div",{className:"art-actions",children:[(0,m.jsx)(O.Tooltip,{label:e("gallery.design"),side:"bottom",portal:!0,children:(0,m.jsx)(O.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.design"),onClick:()=>b("design"),children:(0,m.jsx)(Er,{size:16})})}),(0,m.jsx)(O.Tooltip,{label:e("gallery.refresh"),side:"bottom",portal:!0,children:(0,m.jsx)(O.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.refresh"),onClick:()=>v(I=>I+1),children:(0,m.jsx)(O.IconRefreshOutlineRegular,{size:16})})}),(0,m.jsx)(O.Menu,{open:p,onClose:()=>u(!1),align:"end",portal:!0,autoFocus:!0,items:[{id:"page",label:e("gallery.newPage")+" \xB7 "+H,icon:(0,m.jsx)(ze,{size:14})},{id:"doc",label:e("gallery.newDoc")+" \xB7 "+H,icon:(0,m.jsx)(Oe,{size:14})},{id:"sheet",label:e("gallery.newSheet")+" \xB7 "+H,icon:(0,m.jsx)(qe,{size:14})},{id:"design",label:e("gallery.newDesign")+" \xB7 "+H,icon:(0,m.jsx)(Ye,{size:14})}],onSelect:I=>{u(!1),Q(I==="doc"?"doc":I==="design"?"design":I==="sheet"?"sheet":"page",U)},anchor:(0,m.jsx)(O.Button,{size:"sm",variant:"outline",icon:(0,m.jsx)(O.IconPlusOutlineRegular,{size:14}),"aria-haspopup":"menu","aria-expanded":p,onClick:()=>u(I=>!I),children:e("gallery.create")})})]}):null]}),k==="design"?(0,m.jsx)("div",{className:"art-scroll",children:(0,m.jsx)(On,{t:e,workspaceId:z,workspaceTitle:W?.title})}):(0,m.jsx)("div",{className:"art-scroll",children:(0,m.jsxs)("div",{className:"art-gallery",children:[(0,m.jsxs)("div",{className:"art-toolbar",children:[(0,m.jsx)(O.Input,{icon:(0,m.jsx)(O.IconSearchOutlineRegular,{size:16}),className:"art-search",type:"search","aria-label":e("gallery.searchLabel"),placeholder:e("gallery.search"),value:l,onChange:I=>c(I.target.value)}),(0,m.jsx)(O.SegmentedControl,{id:E,className:"art-segment",label:e("filter.type"),value:i??"all",options:[{value:"all",label:e("type.all")},{value:"page",label:e("type.page")},{value:"doc",label:e("type.doc")},{value:"sheet",label:e("type.sheet")},{value:"design",label:e("type.design")}],onChange:I=>h(I==="all"?void 0:I)})]}),(0,m.jsxs)("div",{role:"tabpanel",id:E+"-"+(i??"all")+"-panel","aria-labelledby":E+"-"+(i??"all"),children:[M.status==="loading"?(0,m.jsx)("div",{className:"art-state",role:"status",children:(0,m.jsx)(O.TextShimmer,{active:!0,children:e("empty.loading")})}):null,M.status==="failed"?(0,m.jsxs)("div",{className:"art-state",role:"alert",children:[(0,m.jsx)("p",{className:"art-empty-title",children:e(X(M.code))}),(0,m.jsx)(O.Button,{size:"sm",variant:"outline",onClick:()=>v(I=>I+1),children:e("action.retry")})]}):null,M.status==="ready"&&M.failed>0?(0,m.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"status",children:[(0,m.jsx)("span",{children:e("gallery.failedProjects")}),(0,m.jsx)(O.Button,{size:"sm",variant:"outline",onClick:()=>v(I=>I+1),children:e("action.retry")})]}):null,M.status==="ready"&&M.items.length===0&&M.failed===0?l!==""?(0,m.jsx)("p",{className:"art-note",children:e("empty.noMatch")}):i!==void 0?(0,m.jsx)("p",{className:"art-note",children:e("empty.typeMatch",{type:e(`type.${i}`)})}):(0,m.jsx)(Ss,{t:e,variant:a.kind}):null,M.status==="ready"&&M.items.length>0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Qn,{t:e,heading:e("gallery.pinned"),views:L,pinned:S,onOpen:A,showProject:a.kind==="all"}),q.length===0?(0,m.jsx)("p",{className:"art-note",children:e("gallery.allPinned")}):(0,m.jsx)(Qn,{t:e,heading:e("gallery.recent"),views:q,pinned:S,onOpen:A,showProject:a.kind==="all"}),M.hasMore?(0,m.jsx)("div",{className:"art-gallery-more",children:(0,m.jsx)(O.Button,{size:"sm",variant:"outline",onClick:C.more,children:e("gallery.more")})}):null,M.truncated?(0,m.jsx)("p",{className:"art-note",children:e("gallery.truncated")}):null]}):null]})]})})]})}var Te=require("react/jsx-runtime"),eo="dsh-artifact-studio.panel.scope",to="dsh-artifact-studio.panel.workspace";function ao({t:e,workspaces:t}){let a=(0,ne.useCallback)(v=>t.subscribe(v),[t]),r=(0,ne.useCallback)(()=>t.getSnapshot(),[t]),o=(0,ne.useSyncExternalStore)(a,r,r).items,s=(0,ne.useMemo)(()=>o.map(({workspaceId:v,title:D})=>({workspaceId:v,title:D})),[o]),[l,c]=(0,ne.useState)(()=>Ja(window.localStorage.getItem(eo))??{kind:"all"}),[i,h]=(0,ne.useState)(()=>{let v=window.localStorage.getItem(to);return v===null||v===""?null:v}),[k,b]=(0,ne.useState)(null),p=l.kind==="workspace"?o.find(v=>v.workspaceId===l.workspaceId):void 0,u=p!==void 0?p.workspaceId:i!==null&&o.some(v=>v.workspaceId===i)?i:o[0]?.workspaceId??null;(0,ne.useEffect)(()=>{if(o.length!==0){if(l.kind==="workspace"&&!o.some(v=>v.workspaceId===l.workspaceId)){c({kind:"all"});return}u!==null&&u!==i&&h(u)}},[o,l,u,i]),(0,ne.useEffect)(()=>{window.localStorage.setItem(eo,ma(l))},[l]),(0,ne.useEffect)(()=>{i!==null&&window.localStorage.setItem(to,i)},[i]);let y=(0,ne.useMemo)(()=>k===null?void 0:He(k),[k]);return(0,Te.jsxs)("div",{className:"art-panel-stack",children:[(0,Te.jsx)("div",{className:"art-panel-region",hidden:y!==void 0,children:(0,Te.jsx)(Za,{t:e,projects:s,scope:l,contextWorkspaceId:u,onScopeChange:c,open:v=>b(v)})}),y===void 0?null:(0,Te.jsx)("div",{className:"art-panel-region",children:(0,Te.jsx)(Rn,{t:e,address:y,workspaceName:o.find(v=>y.scope==="workspace"&&v.workspaceId===y.workspaceId)?.title,onBack:()=>b(null)})})]})}function ro({t:e,sessionId:t,useSessions:a,useWorkspaces:r}){let o=sa({sessionId:t,useSessions:a,useWorkspaces:r}).workspaceId,s=r(i=>i.items.find(h=>h.workspaceId===o)?.title),l=(0,ne.useCallback)(i=>{Se.sidebarRight?.openResource(i)},[]),c=(0,ne.useMemo)(()=>o===null?[]:[{workspaceId:o,title:s??o}],[o,s]);return o===null?(0,Te.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",children:(0,Te.jsx)("div",{className:"art-center",role:"status",children:(0,Te.jsx)("p",{className:"art-center-hint",children:e("empty.noWorkspace")})})}):(0,Te.jsx)(Za,{t:e,projects:c,scope:{kind:"workspace",workspaceId:o},contextWorkspaceId:o,scopeLocked:!0,open:l})}var no="dsh-artifact-studio/styles",Ts=mn.split(`
86
108
  `).map(e=>{let t=e.indexOf("{"),a=e.slice(0,t).split(",").map(n=>n.trim()).filter(n=>n!=="body"&&n!==".art-docpage");return(a.length===0?".art-docpage":a.map(n=>".art-docpage .art-prose "+n).join(", "))+" "+e.slice(t)}).join(`
87
- `),Zo=`
109
+ `),Cs=`
110
+ body {
111
+ --art-space-2: 2px;
112
+ --art-space-4: 4px;
113
+ --art-space-6: 6px;
114
+ --art-space-8: 8px;
115
+ --art-space-12: 12px;
116
+ --art-space-16: 16px;
117
+ --art-space-24: 24px;
118
+ --art-control-inline: 20px;
119
+ --art-control-sm: 28px;
120
+ --art-control-md: 36px;
121
+ }
88
122
  .art-root {
123
+ position: relative;
124
+ container-type: inline-size;
89
125
  box-sizing: border-box;
90
126
  display: flex;
91
127
  flex-direction: column;
@@ -94,13 +130,12 @@ Start writing, or select text and choose Edit with agent.
94
130
  min-width: 0;
95
131
  color: var(--dsw-alias-label-primary);
96
132
  background: var(--dsw-alias-bg-base);
97
- font-size: 13px;
98
- line-height: 1.5;
133
+ font: var(--dsw-font-xs-13);
99
134
  }
100
135
  .art-root *, .art-root *::before, .art-root *::after, .art-card * { box-sizing: border-box; }
101
- .art-root ::selection { background: color-mix(in srgb, var(--dsw-alias-brand-primary) 28%, transparent); }
136
+ .art-root ::selection { background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 28%, transparent); }
102
137
  .art-root :focus-visible, .art-card :focus-visible, .art-composer:focus-visible {
103
- outline: 2px solid var(--dsw-alias-brand-primary);
138
+ outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
104
139
  outline-offset: 1px;
105
140
  }
106
141
  .art-header {
@@ -108,105 +143,76 @@ Start writing, or select text and choose Edit with agent.
108
143
  display: flex;
109
144
  align-items: center;
110
145
  flex-wrap: wrap;
111
- gap: 12px;
146
+ gap: var(--art-space-12);
112
147
  min-height: 44px;
113
- padding: 8px 12px;
148
+ padding: var(--art-space-8) var(--art-space-12);
114
149
  border-bottom: .5px solid var(--dsw-alias-border-l2);
115
150
  }
116
- .art-heading { flex: 1 1 auto; min-width: 0; overflow: hidden; display: flex; align-items: center; gap: 8px; }
151
+ .art-heading { flex: 1 1 auto; min-width: 0; overflow: hidden; display: flex; align-items: center; gap: var(--art-space-8); }
117
152
  .art-title {
118
153
  min-width: 0;
119
154
  margin: 0;
120
155
  overflow: hidden;
121
156
  text-overflow: ellipsis;
122
157
  white-space: nowrap;
123
- font-size: 14px;
124
- font-weight: 600;
125
- line-height: 1.35;
158
+ font-size: var(--dsw-font-s-14-font-size);
159
+ font-weight: 500;
160
+ line-height: var(--dsw-font-s-14-line-height);
126
161
  color: var(--dsw-alias-label-primary);
127
162
  }
128
- .art-title-input {
129
- min-width: 0;
130
- flex: 1;
131
- height: 26px;
132
- padding: 0 6px;
133
- border: 1px solid var(--dsw-alias-brand-primary);
134
- border-radius: 6px;
135
- background: var(--dsw-alias-bg-base);
136
- color: var(--dsw-alias-label-primary);
137
- font: inherit;
138
- font-weight: 600;
139
- }
140
163
  .art-meta {
141
164
  display: flex;
142
165
  align-items: baseline;
143
- gap: 2px;
166
+ gap: var(--art-space-2);
144
167
  min-width: 0;
145
168
  color: var(--dsw-alias-label-secondary);
146
- font-size: 11px;
147
- line-height: 1.4;
169
+ font-size: var(--dsw-font-xxxs-11-font-size);
170
+ line-height: var(--dsw-font-xxxs-11-line-height);
148
171
  font-variant-numeric: tabular-nums;
149
172
  }
150
173
  .art-meta-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
151
174
  .art-save-status { flex: none; white-space: nowrap; }
152
175
  .art-save-status[data-tone="warn"] { color: var(--dsw-alias-state-warn-primary); }
153
176
  .art-save-status[data-tone="error"] { color: var(--dsw-alias-state-error-primary); }
154
- .art-actions { flex: none; display: flex; align-items: center; gap: 4px; }
177
+ .art-actions { flex: none; display: flex; align-items: center; gap: var(--art-space-4); }
155
178
  .art-toolbar {
156
179
  flex: none;
157
180
  display: flex;
158
181
  align-items: center;
159
182
  flex-wrap: wrap;
160
- gap: 8px;
161
- padding: 10px 0;
183
+ gap: var(--art-space-8);
184
+ padding: var(--art-space-8) 0;
162
185
  border-bottom: .5px solid var(--dsw-alias-border-l2);
163
186
  }
164
- .art-search {
165
- flex: 1;
166
- min-width: 0;
167
- height: 42px;
168
- padding: 0 10px;
169
- border: 1px solid var(--dsw-alias-border-l1);
170
- border-radius: 7px;
171
- background: var(--dsw-alias-bg-base);
172
- color: var(--dsw-alias-label-primary);
173
- font: inherit;
174
- }
175
- .art-search::placeholder { color: var(--dsw-alias-label-secondary); }
176
- .art-search:focus { outline: none; border-color: var(--dsw-alias-brand-primary); }
187
+ .art-search { flex: 1 1 140px; min-width: 140px; height: var(--art-control-md); }
188
+ .art-search input::placeholder { color: var(--dsw-alias-label-secondary); }
177
189
  .art-scroll { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; }
178
- .art-scroll::-webkit-scrollbar, .art-drawer-body::-webkit-scrollbar { width: 10px; height: 10px; }
179
- .art-scroll::-webkit-scrollbar-thumb, .art-drawer-body::-webkit-scrollbar-thumb {
180
- border: 3px solid transparent;
181
- border-radius: 10px;
182
- background: color-mix(in srgb, var(--dsw-alias-label-secondary) 40%, transparent) padding-box;
183
- }
184
190
  .art-gallery {
185
191
  width: 100%;
186
192
  max-width: 860px;
187
193
  margin-inline: auto;
188
- padding: 0 12px 24px;
194
+ padding: 0 var(--art-space-12) var(--art-space-24);
189
195
  }
190
- .art-section { padding: 4px 0 18px; }
196
+ .art-section { padding: var(--art-space-4) 0 var(--art-space-16); }
191
197
  .art-section-head {
192
198
  display: flex;
193
199
  align-items: baseline;
194
200
  justify-content: space-between;
195
- gap: 8px;
196
- padding: 10px 0 6px;
201
+ gap: var(--art-space-8);
202
+ padding: var(--art-space-8) 0 var(--art-space-6);
197
203
  }
198
- .art-section-title { margin: 0; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-primary); }
199
- .art-section-hint { font-size: 11px; color: var(--dsw-alias-label-secondary); }
200
- .art-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
204
+ .art-section-title { margin: 0; font-size: var(--dsw-font-xxs-12-font-size); font-weight: 500; color: var(--dsw-alias-label-primary); }
205
+ .art-section-hint { font-size: var(--dsw-font-xxxs-11-font-size); color: var(--dsw-alias-label-secondary); }
206
+ .art-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--art-space-8); }
201
207
  .art-tile {
202
208
  position: relative;
203
209
  min-width: 0;
204
210
  overflow: hidden;
205
211
  border: .5px solid var(--dsw-alias-border-l1);
206
- border-radius: 10px;
207
- background: var(--dsw-alias-bg-layer-1);
212
+ border-radius: var(--dsw-radius-md);
213
+ background: var(--dsw-alias-card-fill);
208
214
  }
209
- .art-tile:hover { border-color: var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-2); }
215
+ .art-tile:hover { border-color: var(--dsw-alias-border-l2); background: var(--dsw-alias-card-fill-hover); }
210
216
  .art-tile-open {
211
217
  display: block;
212
218
  width: 100%;
@@ -219,10 +225,10 @@ Start writing, or select text and choose Edit with agent.
219
225
  text-align: left;
220
226
  cursor: pointer;
221
227
  }
222
- .art-tile-open:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }
223
- .art-tile-body { display: flex; flex-direction: column; gap: 3px; padding: 9px 10px 10px; }
224
- .art-tile-title { min-width: 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 600; line-height: 1.45; }
225
- .art-tile-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--dsw-alias-label-secondary); }
228
+ .art-tile-open:focus-visible { outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: -2px; }
229
+ .art-tile-body { display: flex; flex-direction: column; gap: var(--art-space-2); padding: var(--art-space-8) var(--art-space-8) var(--art-space-8); }
230
+ .art-tile-title { min-width: 0; overflow-wrap: anywhere; font-size: var(--dsw-font-xxs-12-font-size); font-weight: 500; line-height: var(--dsw-font-xxs-12-line-height); }
231
+ .art-tile-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--dsw-font-xxxs-11-font-size); color: var(--dsw-alias-label-secondary); }
226
232
  .art-tile-pin {
227
233
  position: absolute;
228
234
  z-index: 2;
@@ -231,11 +237,11 @@ Start writing, or select text and choose Edit with agent.
231
237
  display: inline-flex;
232
238
  align-items: center;
233
239
  justify-content: center;
234
- width: 26px;
235
- height: 26px;
240
+ width: var(--art-control-sm);
241
+ height: var(--art-control-sm);
236
242
  padding: 0;
237
243
  border: none;
238
- border-radius: 6px;
244
+ border-radius: var(--dsw-radius-sm);
239
245
  background: color-mix(in srgb, var(--dsw-alias-bg-base) 82%, transparent);
240
246
  color: var(--dsw-alias-label-secondary);
241
247
  cursor: pointer;
@@ -243,45 +249,50 @@ Start writing, or select text and choose Edit with agent.
243
249
  }
244
250
  .art-tile-pin:hover, .art-tile-pin:focus-visible { opacity: 1; background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); }
245
251
  .art-tile-pin[aria-pressed="true"] { opacity: 1; color: var(--dsw-alias-brand-primary); }
246
- .art-tile-pin svg { width: 15px; height: 15px; }
247
252
  .art-cover { display: block; position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--dsw-alias-bg-layer-2); border-bottom: .5px solid var(--dsw-alias-border-l1); }
248
253
  .art-cover-frame-wrap { display: block; width: 274px; height: 205px; margin: 0 auto; overflow: hidden; }
249
254
  .art-cover-frame { display: block; width: 720px; height: 540px; border: 0; transform: scale(.38); transform-origin: top left; pointer-events: none; background: var(--dsw-static-neutral-00); }
250
255
  .art-cover-fallback { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--dsw-alias-label-secondary); }
251
256
  .art-cover-fallback svg { width: 26px; height: 26px; opacity: .55; }
252
- .art-cover-design { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--dsw-alias-bg-document-preview, var(--dsw-alias-bg-layer-2)); }
253
- .art-cover-doc { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 14px 14px 10px; background: var(--dsw-alias-bg-base); }
254
- .art-cover-doc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
255
- .art-cover-doc-text { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 6; -webkit-box-orient: vertical; font-size: 11px; line-height: 1.6; color: var(--dsw-alias-label-secondary); }
256
- .art-gallery-more { display: flex; justify-content: center; padding: 4px 0 10px; }
257
+ .art-cover-design { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--dsw-alias-bg-document-preview); }
258
+ .art-cover-sheet { display: flex; flex-direction: column; gap: var(--art-space-4); height: 100%; padding: var(--art-space-8) var(--art-space-8) var(--art-space-8); background: var(--dsw-alias-bg-base); overflow: hidden; }
259
+ .art-cover-sheet-name { flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 500; color: var(--dsw-alias-label-secondary); }
260
+ .art-cover-sheet-table { display: flex; flex-direction: column; border: .5px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-xs); overflow: hidden; }
261
+ .art-cover-sheet-row { display: flex; min-height: 18px; border-bottom: .5px solid var(--dsw-alias-border-l1); }
262
+ .art-cover-sheet-row:last-child { border-bottom: 0; }
263
+ .art-cover-sheet-index { flex: none; width: 14px; display: flex; align-items: center; justify-content: center; background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-tertiary); font-size: 8px; }
264
+ .art-cover-sheet-cell { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: var(--art-space-2) var(--art-space-4); border-left: .5px solid var(--dsw-alias-border-l1); font-size: 9px; color: var(--dsw-alias-label-primary); }
265
+ .art-cover-doc { display: flex; flex-direction: column; gap: var(--art-space-6); height: 100%; padding: var(--art-space-12) var(--art-space-12) var(--art-space-8); background: var(--dsw-alias-bg-base); }
266
+ .art-cover-doc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--dsw-font-xxs-12-font-size); font-weight: 500; }
267
+ .art-cover-doc-text { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 6; -webkit-box-orient: vertical; font-size: var(--dsw-font-xxxs-11-font-size); line-height: var(--dsw-font-xxxs-11-line-height); color: var(--dsw-alias-label-secondary); }
268
+ .art-gallery-more { display: flex; justify-content: center; padding: var(--art-space-4) 0 var(--art-space-8); }
257
269
  .art-empty {
258
270
  display: flex;
259
271
  flex-direction: column;
260
- align-items: flex-start;
261
- gap: 6px;
272
+ align-items: stretch;
273
+ gap: var(--art-space-6);
262
274
  margin: 2px 0 6px;
263
- padding: 14px;
275
+ padding: var(--art-space-12);
264
276
  border: 1px dashed var(--dsw-alias-border-l1);
265
- border-radius: 10px;
277
+ border-radius: var(--dsw-radius-md);
266
278
  color: var(--dsw-alias-label-secondary);
267
279
  }
268
- .art-empty-title { margin: 0; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-primary); }
269
- .art-empty-hint { margin: 0; font-size: 12px; line-height: 1.55; max-width: 44ch; }
270
- .art-empty-actions { display: flex; gap: 6px; margin-top: 4px; }
280
+ .art-empty-title { margin: 0; font-size: var(--dsw-font-xxs-12-font-size); font-weight: 500; color: var(--dsw-alias-label-primary); }
281
+ .art-empty-hint { margin: 0; font-size: var(--dsw-font-xxs-12-font-size); line-height: var(--dsw-font-xxs-12-line-height); max-width: 44ch; }
271
282
  .art-center {
272
283
  flex: 1;
273
284
  display: flex;
274
285
  flex-direction: column;
275
286
  align-items: center;
276
287
  justify-content: center;
277
- gap: 8px;
278
- padding: 24px;
288
+ gap: var(--art-space-8);
289
+ padding: var(--art-space-24);
279
290
  text-align: center;
280
291
  color: var(--dsw-alias-label-secondary);
281
292
  }
282
- .art-center-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--dsw-alias-label-primary); }
283
- .art-center-hint { margin: 0; max-width: 40ch; font-size: 12px; line-height: 1.55; }
284
- .art-note { margin: 0; padding: 4px 8px; font-size: 11px; color: var(--dsw-alias-label-secondary); }
293
+ .art-center-title { margin: 0; font-size: var(--dsw-font-xs-13-font-size); font-weight: 500; color: var(--dsw-alias-label-primary); }
294
+ .art-center-hint { margin: 0; max-width: 40ch; font-size: var(--dsw-font-xxs-12-font-size); line-height: var(--dsw-font-xxs-12-line-height); }
295
+ .art-note { margin: 0; padding: var(--art-space-4) var(--art-space-8); font-size: var(--dsw-font-xxxs-11-font-size); color: var(--dsw-alias-label-secondary); }
285
296
  .art-body { flex: 1; min-height: 0; min-width: 0; display: flex; }
286
297
  .art-stage { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--dsw-alias-bg-layer-1); }
287
298
  .art-drawer-layer { flex: none; display: flex; min-width: 0; min-height: 0; }
@@ -297,20 +308,19 @@ Start writing, or select text and choose Edit with agent.
297
308
  background: var(--dsw-alias-bg-base);
298
309
  }
299
310
  .art-drawer-layer[data-overlay="true"] .art-drawer { position: relative; z-index: 1; width: min(320px, 100%); }
300
- .art-drawer-scrim { position: absolute; inset: 0; background: var(--dsw-alias-bg-mask-2); }
301
- .art-drawer-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: .5px solid var(--dsw-alias-border-l2); }
302
- .art-drawer-head h2 { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.4; }
311
+ .art-drawer-scrim { position: absolute; inset: 0; background: var(--dsw-alias-bg-mask-1); }
312
+ .art-drawer-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--art-space-8); padding: var(--art-space-8) var(--art-space-8) var(--art-space-8) var(--art-space-12); border-bottom: .5px solid var(--dsw-alias-border-l2); }
313
+ .art-drawer-head h2 { margin: 0; font-size: var(--dsw-font-xs-13-font-size); font-weight: 500; line-height: var(--dsw-font-xs-13-line-height); }
303
314
  .art-drawer-body { flex: 1; min-height: 0; overflow: auto; }
304
315
 
305
316
  /* Design previews are rendered on the host; the plugin only frames the image. */
306
- .art-design-preview { flex: 1; min-height: 0; overflow: auto; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; background: var(--dsw-alias-bg-layer-1); }
317
+ .art-design-preview { flex: 1; min-height: 0; overflow: auto; padding: var(--art-space-16); display: flex; flex-direction: column; align-items: center; gap: var(--art-space-12); background: var(--dsw-alias-bg-layer-1); }
307
318
  .art-design-canvas { display: flex; justify-content: center; width: 100%; }
308
- .art-design-image { display: block; max-width: 100%; height: auto; border-radius: 10px; background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 10px 30px rgba(0, 0, 0, .10); }
309
- .art-design-state { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; color: var(--dsw-alias-label-secondary); font-size: 12px; text-align: center; }
310
- .art-design-error { max-width: 52ch; color: var(--dsw-alias-label-primary); line-height: 1.5; }
311
- .art-design-warnings { width: 100%; max-width: 720px; padding: 10px 12px; border: .5px solid var(--dsw-alias-border-l2); border-radius: 8px; background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary); font-size: 12px; }
312
- .art-design-warnings-title { display: block; margin-bottom: 4px; font-weight: 600; color: var(--dsw-alias-label-primary); }
313
- .art-design-warnings ul { margin: 0; padding-left: 18px; }
319
+ .art-design-image { display: block; max-width: 100%; height: auto; border-radius: var(--dsw-radius-md); background: var(--dsw-static-neutral-00); box-shadow: var(--dsw-shadow-lv2); }
320
+ .art-design-error { max-width: 52ch; color: var(--dsw-alias-label-primary); line-height: var(--dsw-font-xs-13-line-height); }
321
+ .art-design-warnings { width: 100%; max-width: 720px; padding: var(--art-space-8) var(--art-space-12); border: .5px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary); font-size: var(--dsw-font-xxs-12-font-size); }
322
+ .art-design-warnings-title { display: block; margin-bottom: 4px; font-weight: 500; color: var(--dsw-alias-label-primary); }
323
+ .art-design-warnings ul { margin: 0; padding-left: var(--art-space-16); }
314
324
 
315
325
  /* The iframe canvas is the artifact's, not plugin chrome: HTML paints white by default, so a page that sets no background must not inherit the host theme. */
316
326
  .art-frame { flex: 1; width: 100%; min-height: 0; border: none; background: var(--dsw-static-neutral-00); }
@@ -318,28 +328,24 @@ Start writing, or select text and choose Edit with agent.
318
328
  flex: 1;
319
329
  min-height: 0;
320
330
  width: 100%;
321
- padding: 12px 14px;
331
+ padding: var(--art-space-12) var(--art-space-12);
322
332
  border: none;
323
333
  resize: none;
324
334
  background: var(--dsw-alias-bg-base);
325
335
  color: var(--dsw-alias-label-primary);
326
- font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
327
- font-size: 12px;
328
- line-height: 1.6;
336
+ font-family: var(--ds-font-family-code);
337
+ font-size: var(--dsw-font-xxs-12-font-size);
338
+ line-height: var(--dsw-font-xxs-12-line-height);
329
339
  tab-size: 2;
330
340
  }
331
341
  .art-source:focus { outline: none; }
332
- .art-prose ul[data-type="taskList"] { list-style: none; padding-left: .2em; }
333
- .art-prose ul[data-type="taskList"] li { display: flex; gap: 8px; }
334
- .art-prose ul[data-type="taskList"] li > label { flex: none; margin-top: .2em; }
335
- .art-prose ul[data-type="taskList"] li > div { flex: 1; }
336
342
  .art-history-body { display: flex; flex-direction: column; min-height: 0; }
337
343
  .art-version {
338
344
  display: flex;
339
345
  flex-direction: column;
340
- gap: 2px;
346
+ gap: var(--art-space-2);
341
347
  width: 100%;
342
- padding: 8px 12px;
348
+ padding: var(--art-space-8) var(--art-space-12);
343
349
  border: none;
344
350
  background: transparent;
345
351
  color: inherit;
@@ -347,72 +353,44 @@ Start writing, or select text and choose Edit with agent.
347
353
  text-align: left;
348
354
  cursor: pointer;
349
355
  }
350
- .art-version:hover { background: var(--dsw-alias-bg-layer-1); }
351
- .art-version[aria-current="true"] { background: var(--dsw-alias-bg-layer-2); }
352
- .art-version-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
353
- .art-version-sub { font-size: 11px; color: var(--dsw-alias-label-secondary); }
356
+ .art-version:hover { background: var(--dsw-alias-interactive-bg-hover); }
357
+ .art-version[aria-current="true"] { background: var(--dsw-alias-interactive-bg-hover-accent); }
358
+ .art-version-top { display: flex; align-items: center; justify-content: space-between; gap: var(--art-space-6); font-size: var(--dsw-font-xxs-12-font-size); font-weight: 500; font-variant-numeric: tabular-nums; }
359
+ .art-version-sub { font-size: var(--dsw-font-xxxs-11-font-size); color: var(--dsw-alias-label-secondary); }
354
360
  .art-bar {
355
361
  flex: none;
356
362
  display: flex;
357
363
  align-items: center;
358
364
  justify-content: space-between;
359
- gap: 10px;
360
- padding: 8px 12px;
365
+ gap: var(--art-space-8);
366
+ padding: var(--art-space-8) var(--art-space-12);
361
367
  border-bottom: .5px solid var(--dsw-alias-border-l2);
362
368
  background: var(--dsw-alias-bg-layer-2);
363
- font-size: 12px;
369
+ font-size: var(--dsw-font-xxs-12-font-size);
364
370
  }
365
371
  .art-bar[data-tone="warn"] { background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 14%, var(--dsw-alias-bg-base)); }
366
372
  .art-bar[data-tone="error"] { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 12%, var(--dsw-alias-bg-base)); }
367
373
  .art-bar-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
368
- .art-bar-text strong { font-weight: 600; }
369
- .art-bar-actions { flex: none; display: flex; gap: 6px; }
370
- .art-status {
371
- flex: none;
372
- display: flex;
373
- align-items: center;
374
- justify-content: space-between;
375
- gap: 10px;
376
- height: 28px;
377
- padding: 0 12px;
378
- border-top: .5px solid var(--dsw-alias-border-l2);
379
- color: var(--dsw-alias-label-secondary);
380
- font-size: 11px;
381
- white-space: nowrap;
382
- }
383
- .art-status span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
384
- .art-relative { position: relative; }
385
- .art-form { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-bottom: .5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-1); }
386
- .art-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dsw-alias-label-secondary); }
387
- .art-field input[type="text"], .art-field textarea {
388
- height: 30px;
389
- padding: 0 9px;
390
- border: 1px solid var(--dsw-alias-border-l1);
391
- border-radius: 7px;
392
- background: var(--dsw-alias-bg-base);
393
- color: var(--dsw-alias-label-primary);
394
- font: inherit;
395
- font-size: 13px;
396
- }
397
- .art-field textarea { height: 84px; padding: 8px 9px; resize: vertical; line-height: 1.5; }
398
- .art-field input:focus, .art-field textarea:focus { outline: none; border-color: var(--dsw-alias-brand-primary); }
399
- .art-field-hint { font-size: 11px; color: var(--dsw-alias-label-secondary); }
400
- .art-form-actions { display: flex; justify-content: flex-end; gap: 6px; }
401
- .art-radio { display: flex; gap: 6px; }
402
- .art-design { display: flex; flex-direction: column; gap: 18px; padding: 14px 14px 40px; }
403
- .art-design-group { display: flex; flex-direction: column; gap: 8px; }
404
- .art-design-group h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-primary); }
405
- .art-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
374
+ .art-bar-text strong { font-weight: 500; }
375
+ .art-bar-actions { flex: none; display: flex; gap: var(--art-space-6); }
376
+ .art-field { display: flex; flex-direction: column; gap: var(--art-space-4); font-size: var(--dsw-font-xxs-12-font-size); color: var(--dsw-alias-label-secondary); }
377
+ .art-field textarea { height: 84px; padding: var(--art-space-8); border: .5px solid var(--dsw-alias-border-l4); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font: var(--dsw-font-xs-13); resize: vertical; }
378
+ .art-field input:focus, .art-field textarea:focus { outline: none; border-color: var(--dsw-alias-state-business-primary); }
379
+ .art-field-hint { font-size: var(--dsw-font-xxxs-11-font-size); color: var(--dsw-alias-label-secondary); }
380
+ .art-design { display: flex; flex-direction: column; gap: var(--art-space-16); padding: var(--art-space-12) var(--art-space-12) 40px; }
381
+ .art-design-group { display: flex; flex-direction: column; gap: var(--art-space-8); }
382
+ .art-design-group h3 { margin: 0; font-size: var(--dsw-font-xxs-12-font-size); font-weight: 500; color: var(--dsw-alias-label-primary); }
383
+ .art-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--art-space-8); }
406
384
  .art-swatch {
407
385
  display: flex;
408
386
  align-items: center;
409
- gap: 8px;
410
- padding: 6px 8px;
387
+ gap: var(--art-space-8);
388
+ padding: var(--art-space-6) var(--art-space-8);
411
389
  border: 1px solid var(--dsw-alias-border-l1);
412
- border-radius: 8px;
390
+ border-radius: var(--dsw-radius-sm);
413
391
  }
414
- .art-swatch input[type="color"] { flex: none; width: 26px; height: 26px; padding: 0; border: none; border-radius: 6px; background: none; cursor: pointer; }
415
- .art-swatch-text { display: flex; flex-direction: column; min-width: 0; font-size: 11px; color: var(--dsw-alias-label-secondary); }
392
+ .art-swatch input[type="color"] { flex: none; width: var(--art-control-sm); height: var(--art-control-sm); padding: 0; border: none; border-radius: var(--dsw-radius-sm); background: none; cursor: pointer; }
393
+ .art-swatch-text { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: var(--dsw-font-xxxs-11-font-size); color: var(--dsw-alias-label-secondary); }
416
394
  .art-swatch-text input {
417
395
  width: 100%;
418
396
  min-width: 0;
@@ -420,60 +398,45 @@ Start writing, or select text and choose Edit with agent.
420
398
  border: none;
421
399
  background: transparent;
422
400
  color: var(--dsw-alias-label-primary);
423
- font-family: ui-monospace, Menlo, Consolas, monospace;
424
- font-size: 12px;
401
+ font-family: var(--ds-font-family-code);
402
+ font-size: var(--dsw-font-xxs-12-font-size);
425
403
  }
426
404
  .art-swatch-text input:focus { outline: none; }
427
- .art-radius-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
428
- .art-radius-row label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--dsw-alias-label-secondary); }
429
- .art-radius-row input {
430
- height: 28px;
431
- padding: 0 8px;
432
- border: 1px solid var(--dsw-alias-border-l1);
433
- border-radius: 6px;
434
- background: var(--dsw-alias-bg-base);
435
- color: var(--dsw-alias-label-primary);
436
- font: inherit;
437
- font-variant-numeric: tabular-nums;
438
- }
439
- .art-design-preview { overflow: hidden; border: 1px solid var(--dsw-alias-border-l1); border-radius: 10px; }
440
- .art-design-source { font-size: 12px; color: var(--dsw-alias-label-secondary); }
441
- .art-design-actions { display: flex; flex-wrap: wrap; gap: 6px; }
405
+ .art-radius-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--art-space-8); }
406
+ .art-radius-row label { display: flex; flex-direction: column; gap: var(--art-space-4); font-size: var(--dsw-font-xxxs-11-font-size); color: var(--dsw-alias-label-secondary); }
407
+ .art-radius-row input { width: 100%; font-variant-numeric: tabular-nums; }
408
+ .art-token-preview { height: 150px; display: flex; overflow: hidden; border: .5px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-md); }
409
+ .art-design-source { font-size: var(--dsw-font-xxs-12-font-size); color: var(--dsw-alias-label-secondary); }
410
+ .art-design-actions { display: flex; flex-wrap: wrap; gap: var(--art-space-6); }
442
411
  .art-composer {
443
412
  display: inline-flex;
444
413
  align-items: center;
445
414
  justify-content: center;
446
415
  width: 28px;
447
- height: 28px;
416
+ height: var(--art-control-sm);
448
417
  padding: 0;
449
418
  border: none;
450
- border-radius: 7px;
419
+ border-radius: var(--dsw-radius-sm);
451
420
  background: transparent;
452
421
  color: var(--dsw-alias-label-secondary);
453
422
  cursor: pointer;
454
423
  }
455
- .art-composer:hover { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
456
- .art-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
424
+ .art-composer:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
425
+ .art-chip { display: inline-flex; align-items: center; gap: var(--art-space-6); min-width: 0; }
457
426
  .art-chip svg { flex: none; width: 14px; height: 14px; color: var(--dsw-alias-label-secondary); }
458
427
  .art-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
459
- .art-workspace { display: flex; align-items: center; gap: 6px; margin-left: auto; min-width: 0; }
460
- .art-workspace-label { font-size: 11px; color: var(--dsw-alias-label-secondary); white-space: nowrap; }
461
- .art-workspace-select {
462
- max-width: 180px; min-width: 90px; height: 26px; padding: 0 6px;
463
- border: .5px solid var(--dsw-alias-border-l2); border-radius: 6px;
464
- background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary);
465
- font: inherit; font-size: 12px;
466
- }
467
- .art-scope-fixed { flex: none; max-width: 180px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dsw-alias-label-secondary); }
428
+ .art-workspace { display: flex; align-items: center; gap: var(--art-space-6); margin-left: auto; min-width: 0; }
429
+ .art-workspace-label { font-size: var(--dsw-font-xxxs-11-font-size); color: var(--dsw-alias-label-secondary); white-space: nowrap; }
430
+ .art-workspace-select { max-width: 180px; min-width: 90px; }
431
+ .art-scope-fixed { flex: none; max-width: 180px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--dsw-font-xxs-12-font-size); color: var(--dsw-alias-label-secondary); }
468
432
  .art-panel-stack, .art-panel-region { height: 100%; min-height: 0; min-width: 0; }
469
433
  .art-panel-region[hidden] { display: none; }
470
- .art-root { container-type: inline-size; }
471
- .art-editor-header { position: relative; flex-wrap: wrap; padding: 8px 12px; gap: 10px; }
434
+ .art-editor-header { position: relative; flex-wrap: nowrap; padding: var(--art-space-8) var(--art-space-12); gap: var(--art-space-8); }
472
435
  .art-identity { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
473
436
  .art-identity .art-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
474
- .art-editor-actions { margin-left: auto; flex: none; flex-wrap: wrap; justify-content: flex-end; }
475
- .art-inline-form { display: flex; gap: 6px; padding: 8px 12px; }
476
- .art-inline-form input { min-width: 0; flex: 1; padding: 4px 8px; background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); border: 1px solid var(--dsw-alias-border-l1); border-radius: 6px; font: inherit; }
437
+ .art-editor-actions { margin-left: auto; flex: none; flex-wrap: nowrap; justify-content: flex-end; }
438
+ .art-inline-form { display: flex; gap: var(--art-space-6); padding: var(--art-space-8) var(--art-space-12); }
439
+ .art-inline-form > span { min-width: 0; flex: 1; }
477
440
  .art-selection-bar {
478
441
  position: absolute;
479
442
  z-index: 12;
@@ -482,56 +445,54 @@ Start writing, or select text and choose Edit with agent.
482
445
  transform: translateX(-50%);
483
446
  display: flex;
484
447
  align-items: center;
485
- gap: 8px;
448
+ gap: var(--art-space-8);
486
449
  width: max-content;
487
450
  max-width: min(620px, calc(100% - 24px));
488
- padding: 7px 8px 7px 11px;
489
- border: .5px solid var(--dsw-alias-border-l2);
490
- border-radius: 10px;
491
- background: var(--dsw-alias-bg-overlay);
492
- box-shadow: 0 8px 24px color-mix(in srgb, var(--dsw-alias-label-primary) 18%, transparent);
451
+ padding: var(--art-space-6) var(--art-space-8) var(--art-space-6) var(--art-space-8);
452
+ border: 0;
453
+ border-radius: var(--dsw-radius-md);
454
+ background: var(--dsw-alias-bg-layer-1);
455
+ box-shadow: var(--dsw-elevation-panel);
493
456
  }
494
- .art-selection-quote { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dsw-alias-label-secondary); }
457
+ .art-selection-quote { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--dsw-font-xxs-12-font-size); color: var(--dsw-alias-label-secondary); }
495
458
  .art-version-button {
496
459
  display: inline-flex;
497
460
  align-items: center;
498
461
  gap: 1px;
499
- height: 20px;
500
- padding: 0 4px;
462
+ height: var(--art-control-inline);
463
+ padding: 0 var(--art-space-4);
501
464
  border: .5px solid var(--dsw-alias-border-l1);
502
- border-radius: 5px;
465
+ border-radius: var(--dsw-radius-xs);
503
466
  background: transparent;
504
467
  color: var(--dsw-alias-label-secondary);
505
468
  font: inherit;
506
- font-size: 11px;
469
+ font-size: var(--dsw-font-xxxs-11-font-size);
507
470
  font-variant-numeric: tabular-nums;
508
471
  cursor: pointer;
509
472
  }
510
- .art-version-button:hover, .art-version-button[aria-expanded="true"] { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
473
+ .art-version-button:hover, .art-version-button[aria-expanded="true"] { background: var(--dsw-alias-interactive-bg-hover-accent); color: var(--dsw-alias-label-primary); }
511
474
  .art-version-button svg { width: 12px; height: 12px; }
512
- .art-root { position: relative; }
513
475
  .art-bar { flex-wrap: wrap; }
514
476
  .art-bar-actions { flex-wrap: wrap; }
515
- .art-search { flex-basis: 140px; }
516
- .art-source:focus-visible, .art-prose:focus-visible, .art-swatch-text input:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }
517
- .art-status { height: 28px; padding: 0 12px; }
477
+ .art-source:focus-visible, .art-prose:focus-visible, .art-swatch-text input:focus-visible { outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: -2px; }
518
478
  @container (max-width: 600px) {
479
+ .art-editor-header { flex-wrap: wrap; }
519
480
  .art-editor-header .art-heading { flex-basis: 100%; }
520
- .art-editor-actions { width: 100%; justify-content: flex-end; }
481
+ .art-editor-actions { width: 100%; flex-wrap: wrap; justify-content: flex-end; }
521
482
  .art-editor-actions .art-segment { margin-right: auto; }
522
483
  .art-drawer-layer { position: absolute; inset: 0; z-index: 30; justify-content: flex-end; }
523
484
  .art-drawer { width: min(320px, 100%); }
524
485
  .art-workspace-label { display: none; }
525
486
  .art-docpage { padding: 28px 20px 64px; }
526
- .art-canvas-dock { gap: 0; padding: 3px 4px; max-width: calc(100% - 12px); }
487
+ .art-canvas-dock { gap: 0; padding: var(--art-space-2) var(--art-space-4); max-width: calc(100% - 12px); }
527
488
  .art-dock-divider { margin: 0 2px; }
528
489
  .art-layer-bar { bottom: 54px; }
529
490
  }
530
491
  @container (max-width: 520px) {
531
492
  .art-toolbar { flex-direction: column; align-items: stretch; }
532
493
  .art-search { width: 100%; flex: none; }
533
- .art-toolbar .art-segment { align-self: flex-start; }
534
- .art-gallery { padding: 0 10px 18px; }
494
+ .art-toolbar .art-segment { align-self: flex-start; max-width: 100%; overflow-x: auto; }
495
+ .art-gallery { padding: 0 var(--art-space-8) var(--art-space-16); }
535
496
  .art-grid { grid-template-columns: 1fr; }
536
497
  .art-cover { aspect-ratio: 16 / 10; }
537
498
  .art-selection-bar { left: 8px; right: 8px; width: auto; max-width: none; transform: none; }
@@ -539,72 +500,72 @@ Start writing, or select text and choose Edit with agent.
539
500
  }
540
501
  @media (pointer: coarse) { .art-icon-button, .art-tile-pin, .art-composer { min-height: 44px; min-width: 44px; } }
541
502
  @media (prefers-reduced-motion: no-preference) {
542
- .art-tile, .art-tile-pin, .art-version, .art-card-open { transition: background-color .12s ease-out, color .12s ease-out, border-color .12s ease-out, opacity .12s ease-out; }
543
- .art-doc-toolbar { animation: art-rise .14s cubic-bezier(.16, 1, .3, 1); }
503
+ .art-tile, .art-tile-pin, .art-version, .art-card-open { transition: background-color var(--ds-transition-duration-fast) var(--ds-ease-in-out), color var(--ds-transition-duration-fast) var(--ds-ease-in-out), border-color var(--ds-transition-duration-fast) var(--ds-ease-in-out), opacity var(--ds-transition-duration-fast) var(--ds-ease-in-out); }
504
+ .art-doc-toolbar { animation: art-rise var(--ds-transition-duration-fast) var(--ds-ease-in-out); }
544
505
  }
545
506
  @keyframes art-rise { from { opacity: 0; transform: translate(-50%, 4px); } to { opacity: 1; transform: translate(-50%, 0); } }
546
- .art-icon-button { flex: none; }
547
- .art-icon-button[aria-pressed="true"] { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
548
- .art-meta-dot { color: var(--dsw-alias-label-tertiary, var(--dsw-alias-label-secondary)); padding: 0 2px; }
507
+ .art-icon-button { flex: none; width: var(--art-control-sm); padding: 0; }
508
+ .art-icon-button[aria-pressed="true"] { background: var(--dsw-alias-interactive-bg-hover-accent); color: var(--dsw-alias-label-primary); }
509
+ .art-meta-dot { color: var(--dsw-alias-label-tertiary); padding: 0 var(--art-space-2); }
549
510
  .art-ask { flex: none; white-space: nowrap; }
550
- .art-center-actions { display: flex; gap: 8px; }
551
- .art-modal-error { margin: 0; color: var(--dsw-alias-state-error-primary); font-size: 13px; }
552
- .art-fallback { width: 100%; min-height: 140px; padding: 10px 12px; border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-sm, 8px); background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: 12px/1.55 ui-monospace, Menlo, Consolas, monospace; resize: vertical; }
511
+ .art-center-actions { display: flex; gap: var(--art-space-8); }
512
+ .art-modal-error { margin: 0; color: var(--dsw-alias-state-error-primary); font-size: var(--dsw-font-xs-13-font-size); }
513
+ .art-fallback { width: 100%; min-height: 140px; padding: var(--art-space-8) var(--art-space-12); border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: var(--dsw-font-xxs-12); font-family: var(--ds-font-family-code); resize: vertical; }
553
514
  .art-code, .art-source-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--dsw-alias-bg-base); }
554
515
  .art-code { overflow: auto; }
555
- .art-code-bar { flex: none; position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 6px 12px; border-bottom: .5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary); font-size: 12px; }
516
+ .art-code-bar { flex: none; position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: var(--art-space-8); min-height: 40px; padding: var(--art-space-6) var(--art-space-12); border-bottom: .5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary); font-size: var(--dsw-font-xxs-12-font-size); }
556
517
  .art-code-block { margin: 0; border: none; border-radius: 0; }
557
- .art-code pre.prim-code { margin: 0; padding: 12px 14px; white-space: pre-wrap; font: 12px/1.6 ui-monospace, Menlo, Consolas, monospace; }
518
+ .art-code pre.prim-code { margin: 0; padding: var(--art-space-12) var(--art-space-12); white-space: pre-wrap; font: var(--dsw-font-xxs-12); font-family: var(--ds-font-family-code); }
558
519
  .art-doc { position: relative; flex: 1; min-height: 0; overflow: auto; background: var(--dsw-alias-bg-layer-1); }
559
- .art-docpage { box-sizing: border-box; width: min(100%, 820px); min-height: calc(100% - 32px); margin: 16px auto; padding: 56px 64px 96px; border-radius: var(--dsw-radius-md, 12px); background: var(--artifact-color-surface, var(--dsw-alias-bg-base)); box-shadow: 0 0 0 .5px var(--dsw-alias-border-l1), 0 1px 3px color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent); }
520
+ .art-docpage[hidden] { display: none; }
521
+ .art-docpage { box-sizing: border-box; width: min(100%, 820px); min-height: calc(100% - 32px); margin: 16px auto; padding: 56px 64px 96px; border-radius: var(--dsw-radius-md); background: var(--artifact-color-surface, var(--dsw-alias-bg-base)); box-shadow: var(--dsw-elevation-stroke), var(--dsw-shadow-lv1); }
560
522
  .art-doc-mount { max-width: 70ch; margin: 0 auto; }
561
523
  .art-prose, .art-prose:focus-visible { outline: none; }
562
524
  .art-prose > :first-child { margin-top: 0; }
563
525
  .art-prose ul[data-type="taskList"] { list-style: none; padding-left: .2em; }
564
- .art-prose ul[data-type="taskList"] li { display: flex; gap: 8px; }
526
+ .art-prose ul[data-type="taskList"] li { display: flex; gap: var(--art-space-8); }
565
527
  .art-prose ul[data-type="taskList"] li > label { flex: none; margin-top: .25em; }
566
528
  .art-prose ul[data-type="taskList"] li > div { flex: 1; }
567
529
  .art-prose ::selection { background: color-mix(in srgb, var(--artifact-color-primary, var(--dsw-alias-brand-primary)) 24%, transparent); }
568
- .art-doc-toolbar { position: absolute; z-index: 15; display: flex; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 16px); align-items: center; gap: 2px; padding: 4px; border-radius: var(--dsw-radius-md, 12px); background: var(--dsw-alias-bg-overlay, var(--dsw-alias-bg-base)); box-shadow: 0 0 0 .5px var(--dsw-alias-border-l2), 0 8px 24px color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent); transform: translateX(-50%); white-space: nowrap; }
569
- .art-doc-toolbar [aria-pressed="true"] { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
570
- .art-doc-toolbar-gap { width: .5px; align-self: stretch; margin: 2px 4px; background: var(--dsw-alias-border-l2); }
571
- .art-card { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; max-width: 480px; padding: 10px 12px 10px 10px; border: .5px solid var(--dsw-alias-border-l1); border-radius: 16px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: inherit; font-size: 13px; text-align: left; }
530
+ .art-doc-toolbar { position: absolute; z-index: 15; display: flex; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 16px); align-items: center; gap: var(--art-space-2); padding: var(--art-space-4); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-layer-1); box-shadow: var(--dsw-elevation-panel); transform: translateX(-50%); white-space: nowrap; }
531
+ .art-doc-toolbar [aria-pressed="true"] { background: var(--dsw-alias-interactive-bg-hover-accent); color: var(--dsw-alias-label-primary); }
532
+ .art-doc-toolbar-gap, .art-dock-divider, .art-sheet-divider { flex: none; width: .5px; height: var(--art-control-inline); margin: 0 var(--art-space-4); background: var(--dsw-alias-border-l2); }
533
+ .art-card { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: var(--art-space-12); width: 100%; max-width: 480px; padding: var(--art-space-8) var(--art-space-12) var(--art-space-8) var(--art-space-8); border: .5px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-lg); background: var(--dsw-alias-card-fill); color: var(--dsw-alias-label-primary); font: inherit; font-size: var(--dsw-font-xs-13-font-size); text-align: left; }
572
534
  .art-card-open { cursor: pointer; }
573
- .art-card-open:hover { border-color: var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-2); }
535
+ .art-card-open:hover { border-color: var(--dsw-alias-border-l2); background: var(--dsw-alias-card-fill-hover); }
574
536
  .art-card-open:hover .art-card-go { color: var(--dsw-alias-label-primary); transform: translateX(1px); }
575
- .art-card-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; border: .5px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary); }
537
+ .art-card-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--dsw-radius-md); border: .5px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary); }
576
538
  .art-card-icon[data-tone="error"] { color: var(--dsw-alias-state-error-primary); }
577
539
  .art-card-icon svg { width: 18px; height: 18px; }
578
- .art-card-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
579
- .art-card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
580
- .art-card-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dsw-alias-label-secondary); }
540
+ .art-card-text { min-width: 0; display: flex; flex-direction: column; gap: var(--art-space-2); }
541
+ .art-card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
542
+ .art-card-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--dsw-font-xxs-12-font-size); color: var(--dsw-alias-label-secondary); }
581
543
  .art-card-sub[data-tone="error"] { color: var(--dsw-alias-state-error-primary); white-space: normal; }
582
- .art-card-go { display: flex; color: var(--dsw-alias-label-secondary); transition: transform .12s ease-out, color .12s ease-out; }
544
+ .art-card-go { display: flex; color: var(--dsw-alias-label-secondary); transition: transform var(--ds-transition-duration-fast) var(--ds-ease-in-out), color var(--ds-transition-duration-fast) var(--ds-ease-in-out); }
583
545
  .art-composer svg { width: 16px; height: 16px; }
584
- .art-empty { align-items: stretch; }
585
- .art-starters { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin: 10px 0 0; padding: 0; }
586
- .art-starter { display: flex; align-items: flex-start; gap: 8px; padding: 10px 8px 10px 12px; border: .5px solid var(--dsw-alias-border-l1); border-radius: 12px; background: var(--dsw-alias-bg-base); }
587
- .art-starter-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
588
- .art-starter-name { font-size: 13px; font-weight: 600; color: var(--dsw-alias-label-primary); }
589
- .art-starter-hint { font-size: 12px; line-height: 1.5; color: var(--dsw-alias-label-secondary); }
546
+ .art-starters { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--art-space-8); margin: 10px 0 0; padding: 0; }
547
+ .art-starter { display: flex; align-items: flex-start; gap: var(--art-space-8); padding: var(--art-space-8) var(--art-space-8) var(--art-space-8) var(--art-space-12); border: .5px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-base); }
548
+ .art-starter-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--art-space-2); }
549
+ .art-starter-name { font-size: var(--dsw-font-xs-13-font-size); font-weight: 500; color: var(--dsw-alias-label-primary); }
550
+ .art-starter-hint { font-size: var(--dsw-font-xxs-12-font-size); line-height: var(--dsw-font-xxs-12-line-height); color: var(--dsw-alias-label-secondary); }
590
551
  .art-tile-pin svg { width: 14px; height: 14px; }
591
552
  .art-canvas { flex: 1; min-height: 0; display: flex; flex-direction: column; }
592
- .art-canvas-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--dsw-alias-bg-document-preview, var(--dsw-alias-bg-layer-1)); }
553
+ .art-canvas-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--dsw-alias-bg-document-preview); }
593
554
  .art-canvas-mount { position: absolute; inset: 0; }
594
555
  .art-canvas-mount[hidden] { display: none; }
595
- .art-canvas-mount:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }
556
+ .art-canvas-mount:focus-visible { outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: -2px; }
596
557
  .art-canvas-fallback { position: absolute; inset: 0; display: flex; overflow: auto; }
597
558
  .art-canvas-opening {
598
559
  position: absolute;
599
560
  z-index: 3;
600
561
  top: 10px;
601
562
  left: 12px;
602
- padding: 3px 8px;
563
+ padding: var(--art-space-2) var(--art-space-8);
603
564
  border: .5px solid var(--dsw-alias-border-l2);
604
- border-radius: 6px;
565
+ border-radius: var(--dsw-radius-sm);
605
566
  background: var(--dsw-alias-bg-base);
606
567
  color: var(--dsw-alias-label-secondary);
607
- font-size: 12px;
568
+ font-size: var(--dsw-font-xxs-12-font-size);
608
569
  }
609
570
  .art-canvas-empty {
610
571
  position: absolute;
@@ -614,9 +575,9 @@ Start writing, or select text and choose Edit with agent.
614
575
  align-items: center;
615
576
  justify-content: center;
616
577
  margin: 0;
617
- padding: 24px;
578
+ padding: var(--art-space-24);
618
579
  color: var(--dsw-alias-label-secondary);
619
- font-size: 12px;
580
+ font-size: var(--dsw-font-xxs-12-font-size);
620
581
  text-align: center;
621
582
  pointer-events: none;
622
583
  }
@@ -628,17 +589,16 @@ Start writing, or select text and choose Edit with agent.
628
589
  transform: translateX(-50%);
629
590
  display: flex;
630
591
  align-items: center;
631
- gap: 2px;
592
+ gap: var(--art-space-2);
632
593
  max-width: calc(100% - 20px);
633
- padding: 4px 6px;
634
- border: .5px solid var(--dsw-alias-border-l3);
635
- border-radius: var(--dsw-radius-lg);
594
+ padding: var(--art-space-4) var(--art-space-6);
595
+ border: 0;
596
+ border-radius: var(--dsw-radius-md);
636
597
  background: var(--dsw-alias-bg-layer-1);
637
- box-shadow: 0 8px 24px color-mix(in srgb, var(--dsw-alias-label-primary) 18%, transparent);
598
+ box-shadow: var(--dsw-elevation-panel);
638
599
  }
639
600
  .art-dock-button { flex: none; width: 28px; padding: 0; }
640
601
  .art-dock-button[aria-pressed="true"] { background: var(--dsw-alias-interactive-bg-hover-accent); color: var(--dsw-alias-label-primary); }
641
- .art-dock-divider { flex: none; width: .5px; height: 20px; margin: 0 4px; background: var(--dsw-alias-border-l2); }
642
602
  .art-canvas-dock .art-dock-zoom,
643
603
  .art-canvas-dock .art-dock-zoom.visible {
644
604
  position: static;
@@ -653,48 +613,110 @@ Start writing, or select text and choose Edit with agent.
653
613
  box-shadow: none;
654
614
  transition: none;
655
615
  }
656
- .art-layer-bar { bottom: 62px; gap: 8px; max-width: min(560px, calc(100% - 24px)); }
616
+ .art-layer-bar { bottom: 62px; gap: var(--art-space-8); max-width: min(560px, calc(100% - 24px)); }
657
617
  .art-layer-bar-glyph { flex: none; display: flex; color: var(--dsw-alias-label-secondary); }
658
618
  .art-layer-bar-text { display: flex; flex-direction: column; min-width: 0; gap: 0; }
659
- .art-layer-bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-primary); }
660
- .art-layer-bar-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--dsw-alias-label-secondary); }
619
+ .art-layer-bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--dsw-font-xxs-12-font-size); font-weight: 500; color: var(--dsw-alias-label-primary); }
620
+ .art-layer-bar-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--dsw-font-xxxs-11-font-size); color: var(--dsw-alias-label-secondary); }
661
621
  .art-inspector { display: flex; flex-direction: column; min-height: 0; height: 100%; }
662
622
  .art-inspector-tabs { flex: 1; min-width: 0; }
663
- .art-layer-tree { flex: 1; min-height: 0; overflow: auto; padding: 4px 6px 10px; outline: none; }
664
- .art-layer-tree:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }
665
- .art-layer-row { display: flex; align-items: center; gap: 4px; height: 28px; padding-inline-end: 4px; border-radius: 6px; color: var(--dsw-alias-label-primary); font-size: 12px; }
623
+ .art-layer-tree { flex: 1; min-height: 0; overflow: auto; padding: var(--art-space-4) var(--art-space-6) var(--art-space-8); outline: none; }
624
+ .art-layer-tree:focus-visible { outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: -2px; }
625
+ .art-layer-row { display: flex; align-items: center; gap: var(--art-space-4); height: var(--art-control-sm); padding-inline-end: var(--art-space-4); border-radius: var(--dsw-radius-sm); color: var(--dsw-alias-label-primary); font-size: var(--dsw-font-xxs-12-font-size); }
666
626
  .art-layer-row:hover, .art-layer-row:focus-within { background: var(--dsw-alias-interactive-bg-hover); }
667
627
  .art-layer-row.is-selected { background: var(--dsw-alias-interactive-bg-hover-accent); }
668
- .art-layer-caret { flex: none; display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--dsw-alias-label-secondary); cursor: pointer; }
628
+ .art-layer-caret { flex: none; display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: 0; border-radius: var(--dsw-radius-xs); background: none; color: var(--dsw-alias-label-secondary); cursor: pointer; }
669
629
  .art-layer-icon { flex: none; display: flex; color: var(--dsw-alias-label-secondary); }
670
630
  .art-layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
671
- .art-layer-rename { flex: 1; min-width: 0; height: 20px; padding: 0 4px; border: .5px solid var(--dsw-alias-brand-primary); border-radius: 4px; background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font: inherit; font-size: 12px; }
672
- .art-layer-actions { display: none; flex: none; gap: 2px; }
631
+ .art-layer-rename { flex: 1; min-width: 0; height: var(--art-control-inline); padding: 0 var(--art-space-4); }
632
+ .art-layer-rename input { font: var(--dsw-font-xxs-12); }
633
+ .art-layer-actions { display: none; flex: none; gap: var(--art-space-2); }
673
634
  .art-layer-row:hover .art-layer-actions, .art-layer-row:focus-within .art-layer-actions, .art-layer-row.is-selected .art-layer-actions { display: flex; }
674
- .art-layer-action { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--dsw-alias-label-secondary); cursor: pointer; }
635
+ .art-layer-action { display: flex; align-items: center; justify-content: center; width: 20px; height: var(--art-control-inline); padding: 0; border: 0; border-radius: var(--dsw-radius-xs); background: none; color: var(--dsw-alias-label-secondary); cursor: pointer; }
675
636
  .art-layer-action:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
676
- .art-inspector-empty { margin: 0; padding: 14px 12px; color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 1.55; }
677
- .art-inspector-properties { display: flex; flex-direction: column; gap: 14px; padding: 10px 12px 16px; font-variant-numeric: tabular-nums; }
678
- .art-inspector-node { display: flex; align-items: center; gap: 6px; min-width: 0; }
637
+ .art-inspector-empty { margin: 0; padding: var(--art-space-12) var(--art-space-12); color: var(--dsw-alias-label-secondary); font-size: var(--dsw-font-xxs-12-font-size); line-height: var(--dsw-font-xxs-12-line-height); }
638
+ .art-inspector-properties { display: flex; flex-direction: column; gap: var(--art-space-12); padding: var(--art-space-8) var(--art-space-12) var(--art-space-16); font-variant-numeric: tabular-nums; }
639
+ .art-inspector-node { display: flex; align-items: center; gap: var(--art-space-6); min-width: 0; }
679
640
  .art-inspector-node-icon { flex: none; display: flex; color: var(--dsw-alias-label-secondary); }
680
- .art-inspector-node-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
681
- .art-inspector-node-type { flex: none; color: var(--dsw-alias-label-secondary); font-size: 11px; }
682
- .art-inspector-group { display: flex; flex-direction: column; gap: 6px; }
683
- .art-inspector-heading { margin: 0; font-size: 11px; font-weight: 600; color: var(--dsw-alias-label-secondary); }
684
- .art-inspector-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
685
- .art-inspector-field { display: flex; align-items: center; gap: 6px; min-width: 0; }
686
- .art-inspector-field-label { flex: none; color: var(--dsw-alias-label-tertiary); font-size: 11px; }
687
- .art-inspector .art-inspector-input { flex: 1; min-width: 0; height: 28px; padding: 0 6px; border-radius: 6px; }
688
- .art-inspector .art-inspector-input input { font-size: 12px; }
689
- .art-inspector-appearance { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
690
- .art-inspector-switch { display: flex; align-items: center; gap: 6px; height: 28px; }
691
- .art-inspector-select { width: 100%; min-width: 0; height: 28px; padding: 0 6px; border: .5px solid var(--dsw-alias-border-l2); border-radius: 6px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; }
692
- .art-inspector-hint { margin: 0; color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 1.55; }
641
+ .art-inspector-node-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--dsw-font-xxs-12-font-size); font-weight: 500; }
642
+ .art-inspector-node-type { flex: none; color: var(--dsw-alias-label-secondary); font-size: var(--dsw-font-xxxs-11-font-size); }
643
+ .art-inspector-actions { display: flex; flex-wrap: wrap; gap: var(--art-space-4); }
644
+ .art-inspector .art-inspector-action { flex: none; width: 24px; padding: 0; height: var(--art-control-sm); }
645
+ .art-inspector-color { flex: none; width: 22px; height: 22px; padding: 0; border: none; border-radius: var(--dsw-radius-sm); background: none; cursor: pointer; }
646
+ .art-inspector-swatches { display: flex; flex-wrap: wrap; gap: var(--art-space-4); }
647
+ .art-inspector-swatch { width: 16px; height: 16px; padding: 0; border: 0.5px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-xs); cursor: pointer; }
648
+ .art-inspector-swatch:hover { border-color: var(--dsw-alias-border-l2); }
649
+ .art-inspector-group { display: flex; flex-direction: column; gap: var(--art-space-6); }
650
+ .art-inspector-heading { margin: 0; font-size: var(--dsw-font-xxxs-11-font-size); font-weight: 500; color: var(--dsw-alias-label-secondary); }
651
+ .art-inspector-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--art-space-6); }
652
+ .art-inspector-field { display: flex; align-items: center; gap: var(--art-space-6); min-width: 0; }
653
+ .art-inspector-field-label { flex: none; color: var(--dsw-alias-label-tertiary); font-size: var(--dsw-font-xxxs-11-font-size); }
654
+ .art-inspector .art-inspector-input { flex: 1; min-width: 0; height: var(--art-control-sm); padding: 0 var(--art-space-6); border-radius: var(--dsw-radius-sm); }
655
+ .art-inspector .art-inspector-input input { font-size: var(--dsw-font-xxs-12-font-size); }
656
+ .art-inspector-appearance { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--art-space-8); }
657
+ .art-inspector-switch { display: flex; align-items: center; gap: var(--art-space-6); height: var(--art-control-sm); }
658
+ .art-inspector-select { width: 100%; font-variant-numeric: tabular-nums; }
659
+ .art-inspector-hint { margin: 0; color: var(--dsw-alias-label-secondary); font-size: var(--dsw-font-xxs-12-font-size); line-height: var(--dsw-font-xxs-12-line-height); }
693
660
  .op-root { display: flex; width: 100%; height: 100%; min-width: 0; }
694
661
  .op-canvas { position: relative; flex: 1; min-width: 0; height: 100%; }
695
662
  .op-surface { width: 100%; height: 100%; }
696
663
  .op-bridge { display: none; }
697
- `;function cn(){if(typeof document>"u"||document.querySelector(`style[data-plugin-css="${ln}"]`)!==null)return;let e=document.createElement("style");e.dataset.plugin="dsh-artifact-studio",e.dataset.pluginCss=ln,e.textContent=Zo+Xo,document.head.appendChild(e)}var Ee=require("react/jsx-runtime");var Ae="artifacts",pn=["artifact_create","artifact_update"],Jo=["connection","slots","locale","sidebarRightTabs","sidebarRight","workspaces"];function ei(e){if(e===null||typeof e!="object"||!("selectPanel"in e))return null;let{selectPanel:t}=e;return typeof t!="function"?null:{selectPanel:a=>{t.call(e,a)}}}function qt(e){return function(a){return(0,Ee.jsx)(Ft,{title:a.t("error.surface"),hint:a.t("error.surfaceHint"),reloadLabel:a.t("action.reloadWindow"),children:(0,Ee.jsx)(e,{...a})})}}function ti(){let e=or();return e===null?null:(0,Ee.jsx)(dn.Toast,{text:e.message,onDone:()=>ua(e.seq)},e.seq)}function ai({useTabInfo:e}){let{tab:t}=e(),a=we(t.contentId??t.navigation?.address),r=rr(a?.id);return(0,Ee.jsxs)("span",{className:"art-chip",children:[(0,Ee.jsx)(Ne,{}),(0,Ee.jsx)("span",{children:r??a?.id??""})]})}function ri(e){cn(),e.effect(ir,"dsh-artifact-studio: unsaved draft guard"),Za(e.connection),Ce.sidebarRight=e.sidebarRight,Ce.layout=ei(e.get("layout")),e.locale.register(Ae,"en",Lr),e.locale.register(Ae,"zh",Mr);let t=e.locale.bind(Ae),a=(l,s)=>t(l,s);e.effect(()=>e.sidebarRightTabs.register({id:ut,kind:Sa,priority:"extension",patterns:["dsh-resource://artifact/**"],canOpen:l=>we(l)!==void 0,title:l=>{let s=we(l);return s===void 0?"":ar(s.id)??s.id}}),"dsh-artifact-studio: artifact tab type"),e.effect(()=>e.sidebarRightTabs.register({id:Vt,kind:Na,priority:"extension",title:()=>a("panel"),guide:[{id:"artifacts",order:30,title:()=>a("panel"),description:()=>a("right.guideHint"),icon:ct}]}),"dsh-artifact-studio: right panel artifacts page");let r=()=>({t:a});e.effect(()=>()=>ua(),"dsh-artifact-studio: notification cleanup"),e.slots.inject("shell.overlay",()=>e.slots.register({name:"shell.overlay",id:"dsh-artifact-studio.notice"},ti)),e.slots.inject("sidebar.right.pane.tab",()=>e.slots.register({name:"sidebar.right.pane.tab",key:ut,locale:Ae,inject:r},qt(wa))),e.slots.inject("sidebar.right.pane.tab.title",()=>e.slots.register({name:"sidebar.right.pane.tab.title",key:ut,locale:Ae,inject:r},ai)),e.slots.inject("sidebar.right.pane.tab",()=>e.slots.register({name:"sidebar.right.pane.tab",key:Vt,locale:Ae,inject:r},qt(sn)));for(let l of pn)e.slots.inject("tool.call.toolview",()=>e.slots.register({name:"tool.call.toolview",key:l,locale:Ae,inject:r},qt(Ta)));e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"dsh-artifact-studio",order:40,locale:Ae,inject:r},$r));function n({size:l}){return(0,Ee.jsx)(ct,{size:l})}let o=()=>({t:a,workspaces:e.workspaces.list});e.slots.inject("main",()=>e.slots.register({name:"main",key:Ze,locale:Ae,inject:o},qt(on))),e.slots.inject("sidebar.panellist",()=>e.slots.register({name:"sidebar.panellist",id:Ze,order:10,label:()=>a("panel")},n))}
664
+
665
+ /* Sheet editor: Harness chrome around an artifact-token grid. */
666
+ .art-sheet { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--dsw-alias-bg-layer-1); }
667
+ .art-sheet-mount { flex: 1; min-height: 0; display: flex; flex-direction: column; }
668
+ .art-sheet-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--dsw-alias-bg-layer-1); }
669
+ .art-sheet-toolbar { flex: none; display: flex; flex-direction: column; gap: var(--art-space-2); padding: var(--art-space-4); border-bottom: .5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-1); }
670
+ .art-sheet-formula { display: flex; align-items: center; gap: var(--art-space-6); min-width: 0; }
671
+ .art-sheet-ref { flex: none; min-width: 64px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 var(--art-space-6); font-size: var(--dsw-font-xxxs-11-font-size); font-variant-numeric: tabular-nums; color: var(--dsw-alias-label-secondary); }
672
+ .art-sheet-formula-input { flex: 1; min-width: 0; height: var(--art-control-sm); padding: 0 var(--art-space-8); border: .5px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font: inherit; font-size: var(--dsw-font-xxs-12-font-size); font-family: var(--ds-font-family-code); }
673
+ .art-sheet-formula-input:focus { outline: none; border-color: var(--dsw-alias-state-business-primary); }
674
+ .art-sheet-formatbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1px; min-width: 0; }
675
+ .art-sheet-tool { flex: none; min-width: 26px; padding: 0 var(--art-space-4); }
676
+ .art-sheet-tool-text { font-size: var(--dsw-font-xs-13-font-size); }
677
+ .art-sheet-format-label { min-width: 64px; justify-content: flex-start; font-size: var(--dsw-font-xxxs-11-font-size); }
678
+ .art-sheet-color { position: relative; display: inline-flex; align-items: center; justify-content: center; width: var(--art-control-sm); height: var(--art-control-sm); border-radius: var(--dsw-radius-sm); cursor: pointer; }
679
+ .art-sheet-color:hover { background: var(--dsw-alias-interactive-bg-hover); }
680
+ .art-sheet-color input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; }
681
+ .art-sheet-color-swatch { width: 16px; height: 16px; border-radius: var(--dsw-radius-xs); border: .5px solid var(--dsw-alias-border-l3); }
682
+ .art-sheet-color-letter { display: inline-flex; align-items: center; justify-content: center; background: var(--dsw-alias-bg-base); font-size: var(--dsw-font-xxxs-11-font-size); font-weight: 500; }
683
+ .art-sheet-error { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--art-space-6); padding: var(--art-space-24); text-align: center; }
684
+ .art-sheet-error > p:first-child { margin: 0; font: var(--dsw-font-xs-13); color: var(--dsw-alias-label-primary); }
685
+ .art-sheet-error-detail { margin: 0; max-width: 52ch; color: var(--dsw-alias-label-secondary); font: var(--dsw-font-xxs-12); font-family: var(--ds-font-family-code); }
686
+ .art-sheet-gridwrap { position: relative; flex: 1; min-height: 0; min-width: 0; overflow: hidden; background: var(--dsw-alias-bg-base); }
687
+ .art-sheet-corner { position: absolute; z-index: 4; top: 0; left: 0; width: 48px; height: var(--art-control-sm); border-right: .5px solid var(--dsw-alias-border-l2); border-bottom: .5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-2); }
688
+ .art-sheet-colheads { position: absolute; z-index: 3; top: 0; left: 48px; right: 0; height: var(--art-control-sm); overflow: hidden; border-bottom: .5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-2); }
689
+ .art-sheet-colheads-inner, .art-sheet-rowheads-inner { position: absolute; top: 0; left: 0; }
690
+ .art-sheet-colhead { position: absolute; top: 0; height: var(--art-control-sm); display: flex; align-items: center; justify-content: center; border-right: .5px solid var(--dsw-alias-border-l2); color: var(--dsw-alias-label-secondary); font-size: var(--dsw-font-xxxs-11-font-size); }
691
+ .art-sheet-colhead[data-active="true"], .art-sheet-rowhead[data-active="true"] { background: var(--dsw-alias-interactive-bg-hover-accent); color: var(--dsw-alias-label-primary); font-weight: 500; }
692
+ .art-sheet-headbutton { width: 100%; height: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
693
+ .art-sheet-resize { position: absolute; z-index: 1; top: 0; right: -3px; width: 6px; height: 100%; cursor: col-resize; }
694
+ .art-sheet-resize::after { content: ''; position: absolute; top: 25%; left: 2px; width: 1px; height: 50%; background: var(--dsw-alias-border-l3); opacity: 0; }
695
+ .art-sheet-colhead:hover .art-sheet-resize::after { opacity: 1; }
696
+ .art-sheet-rowheads { position: absolute; z-index: 3; top: 28px; left: 0; bottom: 0; width: 48px; overflow: hidden; border-right: .5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-2); }
697
+ .art-sheet-rowhead { position: absolute; left: 0; width: 48px; display: flex; align-items: center; justify-content: center; border-bottom: .5px solid var(--dsw-alias-border-l2); color: var(--dsw-alias-label-secondary); font-size: var(--dsw-font-xxxs-11-font-size); }
698
+ .art-sheet-scroll { position: absolute; z-index: 2; top: 28px; left: 48px; right: 0; bottom: 0; overflow: auto; outline: none; }
699
+ .art-sheet-scroll:focus-visible { outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: -2px; }
700
+ .art-sheet-canvas { position: relative; }
701
+ .art-sheet-cell { position: absolute; display: flex; align-items: center; overflow: hidden; padding: 0 var(--art-space-6); border-right: .5px solid var(--dsw-alias-border-l2); border-bottom: .5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font-size: var(--dsw-font-xxs-12-font-size); line-height: var(--dsw-font-xxs-12-line-height); white-space: nowrap; }
702
+ .art-sheet-selected { position: absolute; z-index: 1; pointer-events: none; background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 12%, transparent); }
703
+ .art-sheet-active { position: absolute; z-index: 2; pointer-events: none; box-shadow: inset 0 0 0 2px var(--dsw-alias-state-business-primary); }
704
+ .art-sheet-cell-input { position: absolute; z-index: 3; margin: 0; padding: 0 var(--art-space-4); border: 2px solid var(--dsw-alias-state-business-primary); border-radius: 0; background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font: inherit; font-size: var(--dsw-font-xxs-12-font-size); outline: none; }
705
+ .art-sheet-tabs { flex: none; display: flex; align-items: center; gap: var(--art-space-2); padding: var(--art-space-2) var(--art-space-4); border-top: .5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-1); overflow-x: auto; }
706
+ .art-sheet-tablist { display: flex; align-items: center; gap: var(--art-space-2); min-width: 0; }
707
+ .art-sheet-tab { flex: none; }
708
+ .art-sheet-tab-button { height: var(--art-control-sm); padding: 0 var(--art-space-8); border: .5px solid transparent; border-radius: var(--dsw-radius-xs); background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: var(--dsw-font-xxxs-11-font-size); white-space: nowrap; cursor: pointer; }
709
+ .art-sheet-tab-button[aria-selected="true"] { border-color: var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font-weight: 500; }
710
+ .art-sheet-tab-input { width: 96px; height: var(--art-control-sm); padding: 0 var(--art-space-4); border: .5px solid var(--dsw-alias-state-business-primary); border-radius: var(--dsw-radius-xs); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font: inherit; font-size: var(--dsw-font-xxxs-11-font-size); }
711
+ .art-sheet-add, .art-sheet-tab-more { flex: none; min-width: 24px; padding: 0 var(--art-space-4); }
712
+ @media (max-width: 420px) { .art-sheet-ref { display: none; } .art-sheet-format-label { min-width: 0; } }
713
+ .art-sheet-tool[aria-pressed="true"] { background: var(--dsw-alias-interactive-bg-hover-accent); color: var(--dsw-alias-label-primary); }
714
+ .art-select { min-width: 0; height: var(--art-control-sm); padding: 0 var(--art-space-8); border: .5px solid var(--dsw-alias-border-l4); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: var(--dsw-font-xxs-12); }
715
+ .art-select:focus { border-color: var(--dsw-alias-state-business-primary); }
716
+ .art-generation { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
717
+ .art-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--art-space-8); min-height: 96px; padding: var(--art-space-24); text-align: center; color: var(--dsw-alias-label-secondary); font: var(--dsw-font-xs-13); }
718
+ .art-state p { margin: 0; max-width: 52ch; }
719
+ `;function oo(){if(typeof document>"u"||document.querySelector(`style[data-plugin-css="${no}"]`)!==null)return;let e=document.createElement("style");e.dataset.plugin="dsh-artifact-studio",e.dataset.pluginCss=no,e.textContent=Cs+Ts,document.head.appendChild(e)}var Be=require("react/jsx-runtime");var Fe="artifacts",so=["artifact_create","artifact_update"],Ns=["connection","slots","locale","sidebarRightTabs","sidebarRight","workspaces"];function zs(e){if(e===null||typeof e!="object"||!("selectPanel"in e))return null;let{selectPanel:t}=e;return typeof t!="function"?null:{selectPanel:a=>{t.call(e,a)}}}function ga(e){return function(a){return(0,Be.jsx)(oa,{title:a.t("error.surface"),hint:a.t("error.surfaceHint"),reloadLabel:a.t("action.reloadWindow"),children:(0,Be.jsx)(e,{...a})})}}function Is(){let e=Ir();return e===null?null:(0,Be.jsx)(io.Toast,{text:e.message,onDone:()=>Ma(e.seq)},e.seq)}function Rs({useTabInfo:e}){let{tab:t}=e(),a=He(t.contentId??t.navigation?.address),r=Nr(a?.id);return(0,Be.jsxs)("span",{className:"art-chip",children:[(0,Be.jsx)(Oe,{}),(0,Be.jsx)("span",{children:r??a?.id??""})]})}function As(e){oo(),e.effect(Rr,"dsh-artifact-studio: unsaved draft guard"),xr(e.connection),Se.sidebarRight=e.sidebarRight,Se.layout=zs(e.get("layout")),e.locale.register(Fe,"en",yn),e.locale.register(Fe,"zh",wn);let t=e.locale.bind(Fe),a=(s,l)=>t(s,l);e.effect(()=>e.sidebarRightTabs.register({id:Nt,kind:$a,priority:"extension",patterns:["dsh-resource://artifact/**"],canOpen:s=>He(s)!==void 0,title:s=>{let l=He(s);return l===void 0?"":Cr(l.id)??l.id}}),"dsh-artifact-studio: artifact tab type"),e.effect(()=>e.sidebarRightTabs.register({id:la,kind:Ka,priority:"extension",title:()=>a("panel"),guide:[{id:"artifacts",order:30,title:()=>a("panel"),description:()=>a("right.guideHint"),icon:kt}]}),"dsh-artifact-studio: right panel artifacts page");let r=()=>({t:a});e.effect(()=>()=>Ma(),"dsh-artifact-studio: notification cleanup"),e.slots.inject("shell.overlay",()=>e.slots.register({name:"shell.overlay",id:"dsh-artifact-studio.notice"},Is)),e.slots.inject("sidebar.right.pane.tab",()=>e.slots.register({name:"sidebar.right.pane.tab",key:Nt,locale:Fe,inject:r},ga(Ga))),e.slots.inject("sidebar.right.pane.tab.title",()=>e.slots.register({name:"sidebar.right.pane.tab.title",key:Nt,locale:Fe,inject:r},Rs)),e.slots.inject("sidebar.right.pane.tab",()=>e.slots.register({name:"sidebar.right.pane.tab",key:la,locale:Fe,inject:r},ga(ro)));for(let s of so)e.slots.inject("tool.call.toolview",()=>e.slots.register({name:"tool.call.toolview",key:s,locale:Fe,inject:r},ga(Ua)));e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"dsh-artifact-studio",order:40,locale:Fe,inject:r},Pn));function n({size:s}){return(0,Be.jsx)(kt,{size:s})}let o=()=>({t:a,workspaces:e.workspaces.list});e.slots.inject("main",()=>e.slots.register({name:"main",key:dt,locale:Fe,inject:o},ga(ao))),e.slots.inject("sidebar.panellist",()=>e.slots.register({name:"sidebar.panellist",id:dt,order:10,label:()=>a("panel")},n))}
698
720
 
699
721
  return module.exports;
700
722
  },